UNPKG

849 kBJavaScriptView Raw
1/******/ (function(modules) { // webpackBootstrap
2/******/ // The module cache
3/******/ var installedModules = {};
4/******/
5/******/ // The require function
6/******/ function __webpack_require__(moduleId) {
7/******/
8/******/ // Check if module is in cache
9/******/ if(installedModules[moduleId])
10/******/ return installedModules[moduleId].exports;
11/******/
12/******/ // Create a new module (and put it into the cache)
13/******/ var module = installedModules[moduleId] = {
14/******/ exports: {},
15/******/ id: moduleId,
16/******/ loaded: false
17/******/ };
18/******/
19/******/ // Execute the module function
20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ // Flag the module as loaded
23/******/ module.loaded = true;
24/******/
25/******/ // Return the exports of the module
26/******/ return module.exports;
27/******/ }
28/******/
29/******/
30/******/ // expose the modules object (__webpack_modules__)
31/******/ __webpack_require__.m = modules;
32/******/
33/******/ // expose the module cache
34/******/ __webpack_require__.c = installedModules;
35/******/
36/******/ // __webpack_public_path__
37/******/ __webpack_require__.p = "";
38/******/
39/******/ // Load entry module and return exports
40/******/ return __webpack_require__(0);
41/******/ })
42/************************************************************************/
43/******/ ([
44/* 0 */
45/***/ (function(module, exports, __webpack_require__) {
46
47 'use strict';
48
49 var _react = __webpack_require__(1);
50
51 var _react2 = _interopRequireDefault(_react);
52
53 var _reactDom = __webpack_require__(12);
54
55 var _reactDom2 = _interopRequireDefault(_reactDom);
56
57 var _src = __webpack_require__(25);
58
59 var _src2 = _interopRequireDefault(_src);
60
61 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
62
63 var styles = {
64 border: '1px solid',
65 width: '100%',
66 height: '100%'
67 };
68
69 var Header = function Header(_ref) {
70 var children = _ref.children;
71 return _react2.default.createElement(
72 'h1',
73 null,
74 children
75 );
76 };
77
78 var Content = function Content(_ref2) {
79 var children = _ref2.children;
80 return _react2.default.createElement(
81 'section',
82 null,
83 children
84 );
85 };
86
87 var App = function App() {
88 return _react2.default.createElement(
89 'div',
90 null,
91 _react2.default.createElement(
92 Header,
93 null,
94 'Frame example of wrapping application'
95 ),
96 _react2.default.createElement(
97 Content,
98 null,
99 _react2.default.createElement(
100 'h2',
101 null,
102 'This whole app is wrapped inside an iFrame'
103 )
104 )
105 );
106 };
107
108 _reactDom2.default.render(_react2.default.createElement(
109 _src2.default,
110 { style: styles },
111 _react2.default.createElement(App, null)
112 ), document.querySelector('#example1'));
113
114 var Foobar = function Foobar() {
115 return _react2.default.createElement(
116 _src2.default,
117 { style: styles, head: _react2.default.createElement(
118 'style',
119 null,
120 '*{color:red}'
121 ) },
122 _react2.default.createElement(
123 'h1',
124 null,
125 'Frame example of wrapping component'
126 ),
127 _react2.default.createElement(
128 'p',
129 null,
130 'This is also showing encapuslated styles. All text is red inside this component.'
131 )
132 );
133 };
134
135 _reactDom2.default.render(_react2.default.createElement(Foobar, null), document.querySelector('#example2'));
136
137/***/ }),
138/* 1 */
139/***/ (function(module, exports, __webpack_require__) {
140
141 /* WEBPACK VAR INJECTION */(function(process) {'use strict';
142
143 if (process.env.NODE_ENV === 'production') {
144 module.exports = __webpack_require__(3);
145 } else {
146 module.exports = __webpack_require__(8);
147 }
148
149 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
150
151/***/ }),
152/* 2 */
153/***/ (function(module, exports) {
154
155 // shim for using process in browser
156 var process = module.exports = {};
157
158 // cached from whatever global is present so that test runners that stub it
159 // don't break things. But we need to wrap it in a try catch in case it is
160 // wrapped in strict mode code which doesn't define any globals. It's inside a
161 // function because try/catches deoptimize in certain engines.
162
163 var cachedSetTimeout;
164 var cachedClearTimeout;
165
166 function defaultSetTimout() {
167 throw new Error('setTimeout has not been defined');
168 }
169 function defaultClearTimeout () {
170 throw new Error('clearTimeout has not been defined');
171 }
172 (function () {
173 try {
174 if (typeof setTimeout === 'function') {
175 cachedSetTimeout = setTimeout;
176 } else {
177 cachedSetTimeout = defaultSetTimout;
178 }
179 } catch (e) {
180 cachedSetTimeout = defaultSetTimout;
181 }
182 try {
183 if (typeof clearTimeout === 'function') {
184 cachedClearTimeout = clearTimeout;
185 } else {
186 cachedClearTimeout = defaultClearTimeout;
187 }
188 } catch (e) {
189 cachedClearTimeout = defaultClearTimeout;
190 }
191 } ())
192 function runTimeout(fun) {
193 if (cachedSetTimeout === setTimeout) {
194 //normal enviroments in sane situations
195 return setTimeout(fun, 0);
196 }
197 // if setTimeout wasn't available but was latter defined
198 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
199 cachedSetTimeout = setTimeout;
200 return setTimeout(fun, 0);
201 }
202 try {
203 // when when somebody has screwed with setTimeout but no I.E. maddness
204 return cachedSetTimeout(fun, 0);
205 } catch(e){
206 try {
207 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
208 return cachedSetTimeout.call(null, fun, 0);
209 } catch(e){
210 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
211 return cachedSetTimeout.call(this, fun, 0);
212 }
213 }
214
215
216 }
217 function runClearTimeout(marker) {
218 if (cachedClearTimeout === clearTimeout) {
219 //normal enviroments in sane situations
220 return clearTimeout(marker);
221 }
222 // if clearTimeout wasn't available but was latter defined
223 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
224 cachedClearTimeout = clearTimeout;
225 return clearTimeout(marker);
226 }
227 try {
228 // when when somebody has screwed with setTimeout but no I.E. maddness
229 return cachedClearTimeout(marker);
230 } catch (e){
231 try {
232 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
233 return cachedClearTimeout.call(null, marker);
234 } catch (e){
235 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
236 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
237 return cachedClearTimeout.call(this, marker);
238 }
239 }
240
241
242
243 }
244 var queue = [];
245 var draining = false;
246 var currentQueue;
247 var queueIndex = -1;
248
249 function cleanUpNextTick() {
250 if (!draining || !currentQueue) {
251 return;
252 }
253 draining = false;
254 if (currentQueue.length) {
255 queue = currentQueue.concat(queue);
256 } else {
257 queueIndex = -1;
258 }
259 if (queue.length) {
260 drainQueue();
261 }
262 }
263
264 function drainQueue() {
265 if (draining) {
266 return;
267 }
268 var timeout = runTimeout(cleanUpNextTick);
269 draining = true;
270
271 var len = queue.length;
272 while(len) {
273 currentQueue = queue;
274 queue = [];
275 while (++queueIndex < len) {
276 if (currentQueue) {
277 currentQueue[queueIndex].run();
278 }
279 }
280 queueIndex = -1;
281 len = queue.length;
282 }
283 currentQueue = null;
284 draining = false;
285 runClearTimeout(timeout);
286 }
287
288 process.nextTick = function (fun) {
289 var args = new Array(arguments.length - 1);
290 if (arguments.length > 1) {
291 for (var i = 1; i < arguments.length; i++) {
292 args[i - 1] = arguments[i];
293 }
294 }
295 queue.push(new Item(fun, args));
296 if (queue.length === 1 && !draining) {
297 runTimeout(drainQueue);
298 }
299 };
300
301 // v8 likes predictible objects
302 function Item(fun, array) {
303 this.fun = fun;
304 this.array = array;
305 }
306 Item.prototype.run = function () {
307 this.fun.apply(null, this.array);
308 };
309 process.title = 'browser';
310 process.browser = true;
311 process.env = {};
312 process.argv = [];
313 process.version = ''; // empty string to avoid regexp issues
314 process.versions = {};
315
316 function noop() {}
317
318 process.on = noop;
319 process.addListener = noop;
320 process.once = noop;
321 process.off = noop;
322 process.removeListener = noop;
323 process.removeAllListeners = noop;
324 process.emit = noop;
325 process.prependListener = noop;
326 process.prependOnceListener = noop;
327
328 process.listeners = function (name) { return [] }
329
330 process.binding = function (name) {
331 throw new Error('process.binding is not supported');
332 };
333
334 process.cwd = function () { return '/' };
335 process.chdir = function (dir) {
336 throw new Error('process.chdir is not supported');
337 };
338 process.umask = function() { return 0; };
339
340
341/***/ }),
342/* 3 */
343/***/ (function(module, exports, __webpack_require__) {
344
345 /** @license React v16.3.2
346 * react.production.min.js
347 *
348 * Copyright (c) 2013-present, Facebook, Inc.
349 *
350 * This source code is licensed under the MIT license found in the
351 * LICENSE file in the root directory of this source tree.
352 */
353
354 'use strict';var m=__webpack_require__(4),n=__webpack_require__(5),p=__webpack_require__(6),q=__webpack_require__(7),r="function"===typeof Symbol&&Symbol["for"],t=r?Symbol["for"]("react.element"):60103,u=r?Symbol["for"]("react.portal"):60106,v=r?Symbol["for"]("react.fragment"):60107,w=r?Symbol["for"]("react.strict_mode"):60108,x=r?Symbol["for"]("react.provider"):60109,y=r?Symbol["for"]("react.context"):60110,z=r?Symbol["for"]("react.async_mode"):60111,A=r?Symbol["for"]("react.forward_ref"):
355 60112,B="function"===typeof Symbol&&Symbol.iterator;function C(a){for(var b=arguments.length-1,e="http://reactjs.org/docs/error-decoder.html?invariant\x3d"+a,c=0;c<b;c++)e+="\x26args[]\x3d"+encodeURIComponent(arguments[c+1]);n(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};
356 function E(a,b,e){this.props=a;this.context=b;this.refs=p;this.updater=e||D}E.prototype.isReactComponent={};E.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?C("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=p;this.updater=e||D}var H=G.prototype=new F;
357 H.constructor=G;m(H,E.prototype);H.isPureReactComponent=!0;var I={current:null},J=Object.prototype.hasOwnProperty,K={key:!0,ref:!0,__self:!0,__source:!0};
358 function L(a,b,e){var c=void 0,d={},g=null,h=null;if(null!=b)for(c in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(g=""+b.key),b)J.call(b,c)&&!K.hasOwnProperty(c)&&(d[c]=b[c]);var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){for(var k=Array(f),l=0;l<f;l++)k[l]=arguments[l+2];d.children=k}if(a&&a.defaultProps)for(c in f=a.defaultProps,f)void 0===d[c]&&(d[c]=f[c]);return{$$typeof:t,type:a,key:g,ref:h,props:d,_owner:I.current}}
359 function M(a){return"object"===typeof a&&null!==a&&a.$$typeof===t}function escape(a){var b={"\x3d":"\x3d0",":":"\x3d2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var N=/\/+/g,O=[];function P(a,b,e,c){if(O.length){var d=O.pop();d.result=a;d.keyPrefix=b;d.func=e;d.context=c;d.count=0;return d}return{result:a,keyPrefix:b,func:e,context:c,count:0}}function Q(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>O.length&&O.push(a)}
360 function R(a,b,e,c){var d=typeof a;if("undefined"===d||"boolean"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case t:case u:g=!0}}if(g)return e(c,a,""===b?"."+S(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var h=0;h<a.length;h++){d=a[h];var f=b+S(d,h);g+=R(d,f,e,c)}else if(null===a||"undefined"===typeof a?f=null:(f=B&&a[B]||a["@@iterator"],f="function"===typeof f?f:null),"function"===typeof f)for(a=f.call(a),
361 h=0;!(d=a.next()).done;)d=d.value,f=b+S(d,h++),g+=R(d,f,e,c);else"object"===d&&(e=""+a,C("31","[object Object]"===e?"object with keys {"+Object.keys(a).join(", ")+"}":e,""));return g}function S(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function T(a,b){a.func.call(a.context,b,a.count++)}
362 function U(a,b,e){var c=a.result,d=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?V(a,c,e,q.thatReturnsArgument):null!=a&&(M(a)&&(b=d+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(N,"$\x26/")+"/")+e,a={$$typeof:t,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}),c.push(a))}function V(a,b,e,c,d){var g="";null!=e&&(g=(""+e).replace(N,"$\x26/")+"/");b=P(b,g,c,d);null==a||R(a,"",U,b);Q(b)}
363 var W={Children:{map:function(a,b,e){if(null==a)return a;var c=[];V(a,c,null,b,e);return c},forEach:function(a,b,e){if(null==a)return a;b=P(null,null,b,e);null==a||R(a,"",T,b);Q(b)},count:function(a){return null==a?0:R(a,"",q.thatReturnsNull,null)},toArray:function(a){var b=[];V(a,b,null,q.thatReturnsArgument);return b},only:function(a){M(a)?void 0:C("143");return a}},createRef:function(){return{current:null}},Component:E,PureComponent:G,createContext:function(a,b){void 0===b&&(b=null);a={$$typeof:y,
364 _calculateChangedBits:b,_defaultValue:a,_currentValue:a,_changedBits:0,Provider:null,Consumer:null};a.Provider={$$typeof:x,_context:a};return a.Consumer=a},forwardRef:function(a){return{$$typeof:A,render:a}},Fragment:v,StrictMode:w,unstable_AsyncMode:z,createElement:L,cloneElement:function(a,b,e){null===a||void 0===a?C("267",a):void 0;var c=void 0,d=m({},a.props),g=a.key,h=a.ref,f=a._owner;if(null!=b){void 0!==b.ref&&(h=b.ref,f=I.current);void 0!==b.key&&(g=""+b.key);var k=void 0;a.type&&a.type.defaultProps&&
365 (k=a.type.defaultProps);for(c in b)J.call(b,c)&&!K.hasOwnProperty(c)&&(d[c]=void 0===b[c]&&void 0!==k?k[c]:b[c])}c=arguments.length-2;if(1===c)d.children=e;else if(1<c){k=Array(c);for(var l=0;l<c;l++)k[l]=arguments[l+2];d.children=k}return{$$typeof:t,type:a.type,key:g,ref:h,props:d,_owner:f}},createFactory:function(a){var b=L.bind(null,a);b.type=a;return b},isValidElement:M,version:"16.3.2",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:I,assign:m}},X=Object.freeze({default:W}),
366 Y=X&&W||X;module.exports=Y["default"]?Y["default"]:Y;
367
368
369/***/ }),
370/* 4 */
371/***/ (function(module, exports) {
372
373 /*
374 object-assign
375 (c) Sindre Sorhus
376 @license MIT
377 */
378
379 'use strict';
380 /* eslint-disable no-unused-vars */
381 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
382 var hasOwnProperty = Object.prototype.hasOwnProperty;
383 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
384
385 function toObject(val) {
386 if (val === null || val === undefined) {
387 throw new TypeError('Object.assign cannot be called with null or undefined');
388 }
389
390 return Object(val);
391 }
392
393 function shouldUseNative() {
394 try {
395 if (!Object.assign) {
396 return false;
397 }
398
399 // Detect buggy property enumeration order in older V8 versions.
400
401 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
402 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
403 test1[5] = 'de';
404 if (Object.getOwnPropertyNames(test1)[0] === '5') {
405 return false;
406 }
407
408 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
409 var test2 = {};
410 for (var i = 0; i < 10; i++) {
411 test2['_' + String.fromCharCode(i)] = i;
412 }
413 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
414 return test2[n];
415 });
416 if (order2.join('') !== '0123456789') {
417 return false;
418 }
419
420 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
421 var test3 = {};
422 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
423 test3[letter] = letter;
424 });
425 if (Object.keys(Object.assign({}, test3)).join('') !==
426 'abcdefghijklmnopqrst') {
427 return false;
428 }
429
430 return true;
431 } catch (err) {
432 // We don't expect any of the above to throw, but better to be safe.
433 return false;
434 }
435 }
436
437 module.exports = shouldUseNative() ? Object.assign : function (target, source) {
438 var from;
439 var to = toObject(target);
440 var symbols;
441
442 for (var s = 1; s < arguments.length; s++) {
443 from = Object(arguments[s]);
444
445 for (var key in from) {
446 if (hasOwnProperty.call(from, key)) {
447 to[key] = from[key];
448 }
449 }
450
451 if (getOwnPropertySymbols) {
452 symbols = getOwnPropertySymbols(from);
453 for (var i = 0; i < symbols.length; i++) {
454 if (propIsEnumerable.call(from, symbols[i])) {
455 to[symbols[i]] = from[symbols[i]];
456 }
457 }
458 }
459 }
460
461 return to;
462 };
463
464
465/***/ }),
466/* 5 */
467/***/ (function(module, exports, __webpack_require__) {
468
469 /* WEBPACK VAR INJECTION */(function(process) {/**
470 * Copyright (c) 2013-present, Facebook, Inc.
471 *
472 * This source code is licensed under the MIT license found in the
473 * LICENSE file in the root directory of this source tree.
474 *
475 */
476
477 'use strict';
478
479 /**
480 * Use invariant() to assert state which your program assumes to be true.
481 *
482 * Provide sprintf-style format (only %s is supported) and arguments
483 * to provide information about what broke and what you were
484 * expecting.
485 *
486 * The invariant message will be stripped in production, but the invariant
487 * will remain to ensure logic does not differ in production.
488 */
489
490 var validateFormat = function validateFormat(format) {};
491
492 if (process.env.NODE_ENV !== 'production') {
493 validateFormat = function validateFormat(format) {
494 if (format === undefined) {
495 throw new Error('invariant requires an error message argument');
496 }
497 };
498 }
499
500 function invariant(condition, format, a, b, c, d, e, f) {
501 validateFormat(format);
502
503 if (!condition) {
504 var error;
505 if (format === undefined) {
506 error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
507 } else {
508 var args = [a, b, c, d, e, f];
509 var argIndex = 0;
510 error = new Error(format.replace(/%s/g, function () {
511 return args[argIndex++];
512 }));
513 error.name = 'Invariant Violation';
514 }
515
516 error.framesToPop = 1; // we don't care about invariant's own frame
517 throw error;
518 }
519 }
520
521 module.exports = invariant;
522 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
523
524/***/ }),
525/* 6 */
526/***/ (function(module, exports, __webpack_require__) {
527
528 /* WEBPACK VAR INJECTION */(function(process) {/**
529 * Copyright (c) 2013-present, Facebook, Inc.
530 *
531 * This source code is licensed under the MIT license found in the
532 * LICENSE file in the root directory of this source tree.
533 *
534 */
535
536 'use strict';
537
538 var emptyObject = {};
539
540 if (process.env.NODE_ENV !== 'production') {
541 Object.freeze(emptyObject);
542 }
543
544 module.exports = emptyObject;
545 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
546
547/***/ }),
548/* 7 */
549/***/ (function(module, exports) {
550
551 "use strict";
552
553 /**
554 * Copyright (c) 2013-present, Facebook, Inc.
555 *
556 * This source code is licensed under the MIT license found in the
557 * LICENSE file in the root directory of this source tree.
558 *
559 *
560 */
561
562 function makeEmptyFunction(arg) {
563 return function () {
564 return arg;
565 };
566 }
567
568 /**
569 * This function accepts and discards inputs; it has no side effects. This is
570 * primarily useful idiomatically for overridable function endpoints which
571 * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
572 */
573 var emptyFunction = function emptyFunction() {};
574
575 emptyFunction.thatReturns = makeEmptyFunction;
576 emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
577 emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
578 emptyFunction.thatReturnsNull = makeEmptyFunction(null);
579 emptyFunction.thatReturnsThis = function () {
580 return this;
581 };
582 emptyFunction.thatReturnsArgument = function (arg) {
583 return arg;
584 };
585
586 module.exports = emptyFunction;
587
588/***/ }),
589/* 8 */
590/***/ (function(module, exports, __webpack_require__) {
591
592 /* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.3.2
593 * react.development.js
594 *
595 * Copyright (c) 2013-present, Facebook, Inc.
596 *
597 * This source code is licensed under the MIT license found in the
598 * LICENSE file in the root directory of this source tree.
599 */
600
601 'use strict';
602
603
604
605 if (process.env.NODE_ENV !== "production") {
606 (function() {
607 'use strict';
608
609 var _assign = __webpack_require__(4);
610 var invariant = __webpack_require__(5);
611 var emptyObject = __webpack_require__(6);
612 var warning = __webpack_require__(9);
613 var emptyFunction = __webpack_require__(7);
614 var checkPropTypes = __webpack_require__(10);
615
616 // TODO: this is special because it gets imported during build.
617
618 var ReactVersion = '16.3.2';
619
620 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
621 // nor polyfill, then a plain number is used for performance.
622 var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
623
624 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
625 var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
626 var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
627 var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
628 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
629 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
630 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
631 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
632 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
633 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol['for']('react.forward_ref') : 0xead0;
634
635 var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
636 var FAUX_ITERATOR_SYMBOL = '@@iterator';
637
638 function getIteratorFn(maybeIterable) {
639 if (maybeIterable === null || typeof maybeIterable === 'undefined') {
640 return null;
641 }
642 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
643 if (typeof maybeIterator === 'function') {
644 return maybeIterator;
645 }
646 return null;
647 }
648
649 // Relying on the `invariant()` implementation lets us
650 // have preserve the format and params in the www builds.
651
652 /**
653 * Forked from fbjs/warning:
654 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
655 *
656 * Only change is we use console.warn instead of console.error,
657 * and do nothing when 'console' is not supported.
658 * This really simplifies the code.
659 * ---
660 * Similar to invariant but only logs a warning if the condition is not met.
661 * This can be used to log issues in development environments in critical
662 * paths. Removing the logging code for production environments will keep the
663 * same logic and follow the same code paths.
664 */
665
666 var lowPriorityWarning = function () {};
667
668 {
669 var printWarning = function (format) {
670 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
671 args[_key - 1] = arguments[_key];
672 }
673
674 var argIndex = 0;
675 var message = 'Warning: ' + format.replace(/%s/g, function () {
676 return args[argIndex++];
677 });
678 if (typeof console !== 'undefined') {
679 console.warn(message);
680 }
681 try {
682 // --- Welcome to debugging React ---
683 // This error was thrown as a convenience so that you can use this stack
684 // to find the callsite that caused this warning to fire.
685 throw new Error(message);
686 } catch (x) {}
687 };
688
689 lowPriorityWarning = function (condition, format) {
690 if (format === undefined) {
691 throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
692 }
693 if (!condition) {
694 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
695 args[_key2 - 2] = arguments[_key2];
696 }
697
698 printWarning.apply(undefined, [format].concat(args));
699 }
700 };
701 }
702
703 var lowPriorityWarning$1 = lowPriorityWarning;
704
705 var didWarnStateUpdateForUnmountedComponent = {};
706
707 function warnNoop(publicInstance, callerName) {
708 {
709 var _constructor = publicInstance.constructor;
710 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
711 var warningKey = componentName + '.' + callerName;
712 if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
713 return;
714 }
715 warning(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
716 didWarnStateUpdateForUnmountedComponent[warningKey] = true;
717 }
718 }
719
720 /**
721 * This is the abstract API for an update queue.
722 */
723 var ReactNoopUpdateQueue = {
724 /**
725 * Checks whether or not this composite component is mounted.
726 * @param {ReactClass} publicInstance The instance we want to test.
727 * @return {boolean} True if mounted, false otherwise.
728 * @protected
729 * @final
730 */
731 isMounted: function (publicInstance) {
732 return false;
733 },
734
735 /**
736 * Forces an update. This should only be invoked when it is known with
737 * certainty that we are **not** in a DOM transaction.
738 *
739 * You may want to call this when you know that some deeper aspect of the
740 * component's state has changed but `setState` was not called.
741 *
742 * This will not invoke `shouldComponentUpdate`, but it will invoke
743 * `componentWillUpdate` and `componentDidUpdate`.
744 *
745 * @param {ReactClass} publicInstance The instance that should rerender.
746 * @param {?function} callback Called after component is updated.
747 * @param {?string} callerName name of the calling function in the public API.
748 * @internal
749 */
750 enqueueForceUpdate: function (publicInstance, callback, callerName) {
751 warnNoop(publicInstance, 'forceUpdate');
752 },
753
754 /**
755 * Replaces all of the state. Always use this or `setState` to mutate state.
756 * You should treat `this.state` as immutable.
757 *
758 * There is no guarantee that `this.state` will be immediately updated, so
759 * accessing `this.state` after calling this method may return the old value.
760 *
761 * @param {ReactClass} publicInstance The instance that should rerender.
762 * @param {object} completeState Next state.
763 * @param {?function} callback Called after component is updated.
764 * @param {?string} callerName name of the calling function in the public API.
765 * @internal
766 */
767 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
768 warnNoop(publicInstance, 'replaceState');
769 },
770
771 /**
772 * Sets a subset of the state. This only exists because _pendingState is
773 * internal. This provides a merging strategy that is not available to deep
774 * properties which is confusing. TODO: Expose pendingState or don't use it
775 * during the merge.
776 *
777 * @param {ReactClass} publicInstance The instance that should rerender.
778 * @param {object} partialState Next partial state to be merged with state.
779 * @param {?function} callback Called after component is updated.
780 * @param {?string} Name of the calling function in the public API.
781 * @internal
782 */
783 enqueueSetState: function (publicInstance, partialState, callback, callerName) {
784 warnNoop(publicInstance, 'setState');
785 }
786 };
787
788 /**
789 * Base class helpers for the updating state of a component.
790 */
791 function Component(props, context, updater) {
792 this.props = props;
793 this.context = context;
794 this.refs = emptyObject;
795 // We initialize the default updater but the real one gets injected by the
796 // renderer.
797 this.updater = updater || ReactNoopUpdateQueue;
798 }
799
800 Component.prototype.isReactComponent = {};
801
802 /**
803 * Sets a subset of the state. Always use this to mutate
804 * state. You should treat `this.state` as immutable.
805 *
806 * There is no guarantee that `this.state` will be immediately updated, so
807 * accessing `this.state` after calling this method may return the old value.
808 *
809 * There is no guarantee that calls to `setState` will run synchronously,
810 * as they may eventually be batched together. You can provide an optional
811 * callback that will be executed when the call to setState is actually
812 * completed.
813 *
814 * When a function is provided to setState, it will be called at some point in
815 * the future (not synchronously). It will be called with the up to date
816 * component arguments (state, props, context). These values can be different
817 * from this.* because your function may be called after receiveProps but before
818 * shouldComponentUpdate, and this new state, props, and context will not yet be
819 * assigned to this.
820 *
821 * @param {object|function} partialState Next partial state or function to
822 * produce next partial state to be merged with current state.
823 * @param {?function} callback Called after state is updated.
824 * @final
825 * @protected
826 */
827 Component.prototype.setState = function (partialState, callback) {
828 !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
829 this.updater.enqueueSetState(this, partialState, callback, 'setState');
830 };
831
832 /**
833 * Forces an update. This should only be invoked when it is known with
834 * certainty that we are **not** in a DOM transaction.
835 *
836 * You may want to call this when you know that some deeper aspect of the
837 * component's state has changed but `setState` was not called.
838 *
839 * This will not invoke `shouldComponentUpdate`, but it will invoke
840 * `componentWillUpdate` and `componentDidUpdate`.
841 *
842 * @param {?function} callback Called after update is complete.
843 * @final
844 * @protected
845 */
846 Component.prototype.forceUpdate = function (callback) {
847 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
848 };
849
850 /**
851 * Deprecated APIs. These APIs used to exist on classic React classes but since
852 * we would like to deprecate them, we're not going to move them over to this
853 * modern base class. Instead, we define a getter that warns if it's accessed.
854 */
855 {
856 var deprecatedAPIs = {
857 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
858 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
859 };
860 var defineDeprecationWarning = function (methodName, info) {
861 Object.defineProperty(Component.prototype, methodName, {
862 get: function () {
863 lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
864 return undefined;
865 }
866 });
867 };
868 for (var fnName in deprecatedAPIs) {
869 if (deprecatedAPIs.hasOwnProperty(fnName)) {
870 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
871 }
872 }
873 }
874
875 function ComponentDummy() {}
876 ComponentDummy.prototype = Component.prototype;
877
878 /**
879 * Convenience component with default shallow equality check for sCU.
880 */
881 function PureComponent(props, context, updater) {
882 this.props = props;
883 this.context = context;
884 this.refs = emptyObject;
885 this.updater = updater || ReactNoopUpdateQueue;
886 }
887
888 var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
889 pureComponentPrototype.constructor = PureComponent;
890 // Avoid an extra prototype jump for these methods.
891 _assign(pureComponentPrototype, Component.prototype);
892 pureComponentPrototype.isPureReactComponent = true;
893
894 // an immutable object with a single mutable value
895 function createRef() {
896 var refObject = {
897 current: null
898 };
899 {
900 Object.seal(refObject);
901 }
902 return refObject;
903 }
904
905 /**
906 * Keeps track of the current owner.
907 *
908 * The current owner is the component who should own any components that are
909 * currently being constructed.
910 */
911 var ReactCurrentOwner = {
912 /**
913 * @internal
914 * @type {ReactComponent}
915 */
916 current: null
917 };
918
919 var hasOwnProperty = Object.prototype.hasOwnProperty;
920
921 var RESERVED_PROPS = {
922 key: true,
923 ref: true,
924 __self: true,
925 __source: true
926 };
927
928 var specialPropKeyWarningShown = void 0;
929 var specialPropRefWarningShown = void 0;
930
931 function hasValidRef(config) {
932 {
933 if (hasOwnProperty.call(config, 'ref')) {
934 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
935 if (getter && getter.isReactWarning) {
936 return false;
937 }
938 }
939 }
940 return config.ref !== undefined;
941 }
942
943 function hasValidKey(config) {
944 {
945 if (hasOwnProperty.call(config, 'key')) {
946 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
947 if (getter && getter.isReactWarning) {
948 return false;
949 }
950 }
951 }
952 return config.key !== undefined;
953 }
954
955 function defineKeyPropWarningGetter(props, displayName) {
956 var warnAboutAccessingKey = function () {
957 if (!specialPropKeyWarningShown) {
958 specialPropKeyWarningShown = true;
959 warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
960 }
961 };
962 warnAboutAccessingKey.isReactWarning = true;
963 Object.defineProperty(props, 'key', {
964 get: warnAboutAccessingKey,
965 configurable: true
966 });
967 }
968
969 function defineRefPropWarningGetter(props, displayName) {
970 var warnAboutAccessingRef = function () {
971 if (!specialPropRefWarningShown) {
972 specialPropRefWarningShown = true;
973 warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
974 }
975 };
976 warnAboutAccessingRef.isReactWarning = true;
977 Object.defineProperty(props, 'ref', {
978 get: warnAboutAccessingRef,
979 configurable: true
980 });
981 }
982
983 /**
984 * Factory method to create a new React element. This no longer adheres to
985 * the class pattern, so do not use new to call it. Also, no instanceof check
986 * will work. Instead test $$typeof field against Symbol.for('react.element') to check
987 * if something is a React Element.
988 *
989 * @param {*} type
990 * @param {*} key
991 * @param {string|object} ref
992 * @param {*} self A *temporary* helper to detect places where `this` is
993 * different from the `owner` when React.createElement is called, so that we
994 * can warn. We want to get rid of owner and replace string `ref`s with arrow
995 * functions, and as long as `this` and owner are the same, there will be no
996 * change in behavior.
997 * @param {*} source An annotation object (added by a transpiler or otherwise)
998 * indicating filename, line number, and/or other information.
999 * @param {*} owner
1000 * @param {*} props
1001 * @internal
1002 */
1003 var ReactElement = function (type, key, ref, self, source, owner, props) {
1004 var element = {
1005 // This tag allows us to uniquely identify this as a React Element
1006 $$typeof: REACT_ELEMENT_TYPE,
1007
1008 // Built-in properties that belong on the element
1009 type: type,
1010 key: key,
1011 ref: ref,
1012 props: props,
1013
1014 // Record the component responsible for creating this element.
1015 _owner: owner
1016 };
1017
1018 {
1019 // The validation flag is currently mutative. We put it on
1020 // an external backing store so that we can freeze the whole object.
1021 // This can be replaced with a WeakMap once they are implemented in
1022 // commonly used development environments.
1023 element._store = {};
1024
1025 // To make comparing ReactElements easier for testing purposes, we make
1026 // the validation flag non-enumerable (where possible, which should
1027 // include every environment we run tests in), so the test framework
1028 // ignores it.
1029 Object.defineProperty(element._store, 'validated', {
1030 configurable: false,
1031 enumerable: false,
1032 writable: true,
1033 value: false
1034 });
1035 // self and source are DEV only properties.
1036 Object.defineProperty(element, '_self', {
1037 configurable: false,
1038 enumerable: false,
1039 writable: false,
1040 value: self
1041 });
1042 // Two elements created in two different places should be considered
1043 // equal for testing purposes and therefore we hide it from enumeration.
1044 Object.defineProperty(element, '_source', {
1045 configurable: false,
1046 enumerable: false,
1047 writable: false,
1048 value: source
1049 });
1050 if (Object.freeze) {
1051 Object.freeze(element.props);
1052 Object.freeze(element);
1053 }
1054 }
1055
1056 return element;
1057 };
1058
1059 /**
1060 * Create and return a new ReactElement of the given type.
1061 * See https://reactjs.org/docs/react-api.html#createelement
1062 */
1063 function createElement(type, config, children) {
1064 var propName = void 0;
1065
1066 // Reserved names are extracted
1067 var props = {};
1068
1069 var key = null;
1070 var ref = null;
1071 var self = null;
1072 var source = null;
1073
1074 if (config != null) {
1075 if (hasValidRef(config)) {
1076 ref = config.ref;
1077 }
1078 if (hasValidKey(config)) {
1079 key = '' + config.key;
1080 }
1081
1082 self = config.__self === undefined ? null : config.__self;
1083 source = config.__source === undefined ? null : config.__source;
1084 // Remaining properties are added to a new props object
1085 for (propName in config) {
1086 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1087 props[propName] = config[propName];
1088 }
1089 }
1090 }
1091
1092 // Children can be more than one argument, and those are transferred onto
1093 // the newly allocated props object.
1094 var childrenLength = arguments.length - 2;
1095 if (childrenLength === 1) {
1096 props.children = children;
1097 } else if (childrenLength > 1) {
1098 var childArray = Array(childrenLength);
1099 for (var i = 0; i < childrenLength; i++) {
1100 childArray[i] = arguments[i + 2];
1101 }
1102 {
1103 if (Object.freeze) {
1104 Object.freeze(childArray);
1105 }
1106 }
1107 props.children = childArray;
1108 }
1109
1110 // Resolve default props
1111 if (type && type.defaultProps) {
1112 var defaultProps = type.defaultProps;
1113 for (propName in defaultProps) {
1114 if (props[propName] === undefined) {
1115 props[propName] = defaultProps[propName];
1116 }
1117 }
1118 }
1119 {
1120 if (key || ref) {
1121 if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
1122 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1123 if (key) {
1124 defineKeyPropWarningGetter(props, displayName);
1125 }
1126 if (ref) {
1127 defineRefPropWarningGetter(props, displayName);
1128 }
1129 }
1130 }
1131 }
1132 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1133 }
1134
1135 /**
1136 * Return a function that produces ReactElements of a given type.
1137 * See https://reactjs.org/docs/react-api.html#createfactory
1138 */
1139
1140
1141 function cloneAndReplaceKey(oldElement, newKey) {
1142 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
1143
1144 return newElement;
1145 }
1146
1147 /**
1148 * Clone and return a new ReactElement using element as the starting point.
1149 * See https://reactjs.org/docs/react-api.html#cloneelement
1150 */
1151 function cloneElement(element, config, children) {
1152 !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
1153
1154 var propName = void 0;
1155
1156 // Original props are copied
1157 var props = _assign({}, element.props);
1158
1159 // Reserved names are extracted
1160 var key = element.key;
1161 var ref = element.ref;
1162 // Self is preserved since the owner is preserved.
1163 var self = element._self;
1164 // Source is preserved since cloneElement is unlikely to be targeted by a
1165 // transpiler, and the original source is probably a better indicator of the
1166 // true owner.
1167 var source = element._source;
1168
1169 // Owner will be preserved, unless ref is overridden
1170 var owner = element._owner;
1171
1172 if (config != null) {
1173 if (hasValidRef(config)) {
1174 // Silently steal the ref from the parent.
1175 ref = config.ref;
1176 owner = ReactCurrentOwner.current;
1177 }
1178 if (hasValidKey(config)) {
1179 key = '' + config.key;
1180 }
1181
1182 // Remaining properties override existing props
1183 var defaultProps = void 0;
1184 if (element.type && element.type.defaultProps) {
1185 defaultProps = element.type.defaultProps;
1186 }
1187 for (propName in config) {
1188 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1189 if (config[propName] === undefined && defaultProps !== undefined) {
1190 // Resolve default props
1191 props[propName] = defaultProps[propName];
1192 } else {
1193 props[propName] = config[propName];
1194 }
1195 }
1196 }
1197 }
1198
1199 // Children can be more than one argument, and those are transferred onto
1200 // the newly allocated props object.
1201 var childrenLength = arguments.length - 2;
1202 if (childrenLength === 1) {
1203 props.children = children;
1204 } else if (childrenLength > 1) {
1205 var childArray = Array(childrenLength);
1206 for (var i = 0; i < childrenLength; i++) {
1207 childArray[i] = arguments[i + 2];
1208 }
1209 props.children = childArray;
1210 }
1211
1212 return ReactElement(element.type, key, ref, self, source, owner, props);
1213 }
1214
1215 /**
1216 * Verifies the object is a ReactElement.
1217 * See https://reactjs.org/docs/react-api.html#isvalidelement
1218 * @param {?object} object
1219 * @return {boolean} True if `object` is a valid component.
1220 * @final
1221 */
1222 function isValidElement(object) {
1223 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1224 }
1225
1226 var ReactDebugCurrentFrame = {};
1227
1228 {
1229 // Component that is being worked on
1230 ReactDebugCurrentFrame.getCurrentStack = null;
1231
1232 ReactDebugCurrentFrame.getStackAddendum = function () {
1233 var impl = ReactDebugCurrentFrame.getCurrentStack;
1234 if (impl) {
1235 return impl();
1236 }
1237 return null;
1238 };
1239 }
1240
1241 var SEPARATOR = '.';
1242 var SUBSEPARATOR = ':';
1243
1244 /**
1245 * Escape and wrap key so it is safe to use as a reactid
1246 *
1247 * @param {string} key to be escaped.
1248 * @return {string} the escaped key.
1249 */
1250 function escape(key) {
1251 var escapeRegex = /[=:]/g;
1252 var escaperLookup = {
1253 '=': '=0',
1254 ':': '=2'
1255 };
1256 var escapedString = ('' + key).replace(escapeRegex, function (match) {
1257 return escaperLookup[match];
1258 });
1259
1260 return '$' + escapedString;
1261 }
1262
1263 /**
1264 * TODO: Test that a single child and an array with one item have the same key
1265 * pattern.
1266 */
1267
1268 var didWarnAboutMaps = false;
1269
1270 var userProvidedKeyEscapeRegex = /\/+/g;
1271 function escapeUserProvidedKey(text) {
1272 return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
1273 }
1274
1275 var POOL_SIZE = 10;
1276 var traverseContextPool = [];
1277 function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
1278 if (traverseContextPool.length) {
1279 var traverseContext = traverseContextPool.pop();
1280 traverseContext.result = mapResult;
1281 traverseContext.keyPrefix = keyPrefix;
1282 traverseContext.func = mapFunction;
1283 traverseContext.context = mapContext;
1284 traverseContext.count = 0;
1285 return traverseContext;
1286 } else {
1287 return {
1288 result: mapResult,
1289 keyPrefix: keyPrefix,
1290 func: mapFunction,
1291 context: mapContext,
1292 count: 0
1293 };
1294 }
1295 }
1296
1297 function releaseTraverseContext(traverseContext) {
1298 traverseContext.result = null;
1299 traverseContext.keyPrefix = null;
1300 traverseContext.func = null;
1301 traverseContext.context = null;
1302 traverseContext.count = 0;
1303 if (traverseContextPool.length < POOL_SIZE) {
1304 traverseContextPool.push(traverseContext);
1305 }
1306 }
1307
1308 /**
1309 * @param {?*} children Children tree container.
1310 * @param {!string} nameSoFar Name of the key path so far.
1311 * @param {!function} callback Callback to invoke with each child found.
1312 * @param {?*} traverseContext Used to pass information throughout the traversal
1313 * process.
1314 * @return {!number} The number of children in this subtree.
1315 */
1316 function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
1317 var type = typeof children;
1318
1319 if (type === 'undefined' || type === 'boolean') {
1320 // All of the above are perceived as null.
1321 children = null;
1322 }
1323
1324 var invokeCallback = false;
1325
1326 if (children === null) {
1327 invokeCallback = true;
1328 } else {
1329 switch (type) {
1330 case 'string':
1331 case 'number':
1332 invokeCallback = true;
1333 break;
1334 case 'object':
1335 switch (children.$$typeof) {
1336 case REACT_ELEMENT_TYPE:
1337 case REACT_PORTAL_TYPE:
1338 invokeCallback = true;
1339 }
1340 }
1341 }
1342
1343 if (invokeCallback) {
1344 callback(traverseContext, children,
1345 // If it's the only child, treat the name as if it was wrapped in an array
1346 // so that it's consistent if the number of children grows.
1347 nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
1348 return 1;
1349 }
1350
1351 var child = void 0;
1352 var nextName = void 0;
1353 var subtreeCount = 0; // Count of children found in the current subtree.
1354 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1355
1356 if (Array.isArray(children)) {
1357 for (var i = 0; i < children.length; i++) {
1358 child = children[i];
1359 nextName = nextNamePrefix + getComponentKey(child, i);
1360 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1361 }
1362 } else {
1363 var iteratorFn = getIteratorFn(children);
1364 if (typeof iteratorFn === 'function') {
1365 {
1366 // Warn about using Maps as children
1367 if (iteratorFn === children.entries) {
1368 !didWarnAboutMaps ? warning(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', ReactDebugCurrentFrame.getStackAddendum()) : void 0;
1369 didWarnAboutMaps = true;
1370 }
1371 }
1372
1373 var iterator = iteratorFn.call(children);
1374 var step = void 0;
1375 var ii = 0;
1376 while (!(step = iterator.next()).done) {
1377 child = step.value;
1378 nextName = nextNamePrefix + getComponentKey(child, ii++);
1379 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1380 }
1381 } else if (type === 'object') {
1382 var addendum = '';
1383 {
1384 addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
1385 }
1386 var childrenString = '' + children;
1387 invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
1388 }
1389 }
1390
1391 return subtreeCount;
1392 }
1393
1394 /**
1395 * Traverses children that are typically specified as `props.children`, but
1396 * might also be specified through attributes:
1397 *
1398 * - `traverseAllChildren(this.props.children, ...)`
1399 * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
1400 *
1401 * The `traverseContext` is an optional argument that is passed through the
1402 * entire traversal. It can be used to store accumulations or anything else that
1403 * the callback might find relevant.
1404 *
1405 * @param {?*} children Children tree object.
1406 * @param {!function} callback To invoke upon traversing each child.
1407 * @param {?*} traverseContext Context for traversal.
1408 * @return {!number} The number of children in this subtree.
1409 */
1410 function traverseAllChildren(children, callback, traverseContext) {
1411 if (children == null) {
1412 return 0;
1413 }
1414
1415 return traverseAllChildrenImpl(children, '', callback, traverseContext);
1416 }
1417
1418 /**
1419 * Generate a key string that identifies a component within a set.
1420 *
1421 * @param {*} component A component that could contain a manual key.
1422 * @param {number} index Index that is used if a manual key is not provided.
1423 * @return {string}
1424 */
1425 function getComponentKey(component, index) {
1426 // Do some typechecking here since we call this blindly. We want to ensure
1427 // that we don't block potential future ES APIs.
1428 if (typeof component === 'object' && component !== null && component.key != null) {
1429 // Explicit key
1430 return escape(component.key);
1431 }
1432 // Implicit key determined by the index in the set
1433 return index.toString(36);
1434 }
1435
1436 function forEachSingleChild(bookKeeping, child, name) {
1437 var func = bookKeeping.func,
1438 context = bookKeeping.context;
1439
1440 func.call(context, child, bookKeeping.count++);
1441 }
1442
1443 /**
1444 * Iterates through children that are typically specified as `props.children`.
1445 *
1446 * See https://reactjs.org/docs/react-api.html#react.children.foreach
1447 *
1448 * The provided forEachFunc(child, index) will be called for each
1449 * leaf child.
1450 *
1451 * @param {?*} children Children tree container.
1452 * @param {function(*, int)} forEachFunc
1453 * @param {*} forEachContext Context for forEachContext.
1454 */
1455 function forEachChildren(children, forEachFunc, forEachContext) {
1456 if (children == null) {
1457 return children;
1458 }
1459 var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
1460 traverseAllChildren(children, forEachSingleChild, traverseContext);
1461 releaseTraverseContext(traverseContext);
1462 }
1463
1464 function mapSingleChildIntoContext(bookKeeping, child, childKey) {
1465 var result = bookKeeping.result,
1466 keyPrefix = bookKeeping.keyPrefix,
1467 func = bookKeeping.func,
1468 context = bookKeeping.context;
1469
1470
1471 var mappedChild = func.call(context, child, bookKeeping.count++);
1472 if (Array.isArray(mappedChild)) {
1473 mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
1474 } else if (mappedChild != null) {
1475 if (isValidElement(mappedChild)) {
1476 mappedChild = cloneAndReplaceKey(mappedChild,
1477 // Keep both the (mapped) and old keys if they differ, just as
1478 // traverseAllChildren used to do for objects as children
1479 keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
1480 }
1481 result.push(mappedChild);
1482 }
1483 }
1484
1485 function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
1486 var escapedPrefix = '';
1487 if (prefix != null) {
1488 escapedPrefix = escapeUserProvidedKey(prefix) + '/';
1489 }
1490 var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
1491 traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
1492 releaseTraverseContext(traverseContext);
1493 }
1494
1495 /**
1496 * Maps children that are typically specified as `props.children`.
1497 *
1498 * See https://reactjs.org/docs/react-api.html#react.children.map
1499 *
1500 * The provided mapFunction(child, key, index) will be called for each
1501 * leaf child.
1502 *
1503 * @param {?*} children Children tree container.
1504 * @param {function(*, int)} func The map function.
1505 * @param {*} context Context for mapFunction.
1506 * @return {object} Object containing the ordered map of results.
1507 */
1508 function mapChildren(children, func, context) {
1509 if (children == null) {
1510 return children;
1511 }
1512 var result = [];
1513 mapIntoWithKeyPrefixInternal(children, result, null, func, context);
1514 return result;
1515 }
1516
1517 /**
1518 * Count the number of children that are typically specified as
1519 * `props.children`.
1520 *
1521 * See https://reactjs.org/docs/react-api.html#react.children.count
1522 *
1523 * @param {?*} children Children tree container.
1524 * @return {number} The number of children.
1525 */
1526 function countChildren(children, context) {
1527 return traverseAllChildren(children, emptyFunction.thatReturnsNull, null);
1528 }
1529
1530 /**
1531 * Flatten a children object (typically specified as `props.children`) and
1532 * return an array with appropriately re-keyed children.
1533 *
1534 * See https://reactjs.org/docs/react-api.html#react.children.toarray
1535 */
1536 function toArray(children) {
1537 var result = [];
1538 mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
1539 return result;
1540 }
1541
1542 /**
1543 * Returns the first child in a collection of children and verifies that there
1544 * is only one child in the collection.
1545 *
1546 * See https://reactjs.org/docs/react-api.html#react.children.only
1547 *
1548 * The current implementation of this function assumes that a single child gets
1549 * passed without a wrapper, but the purpose of this helper function is to
1550 * abstract away the particular structure of children.
1551 *
1552 * @param {?object} children Child collection structure.
1553 * @return {ReactElement} The first and only `ReactElement` contained in the
1554 * structure.
1555 */
1556 function onlyChild(children) {
1557 !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
1558 return children;
1559 }
1560
1561 function createContext(defaultValue, calculateChangedBits) {
1562 if (calculateChangedBits === undefined) {
1563 calculateChangedBits = null;
1564 } else {
1565 {
1566 !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warning(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
1567 }
1568 }
1569
1570 var context = {
1571 $$typeof: REACT_CONTEXT_TYPE,
1572 _calculateChangedBits: calculateChangedBits,
1573 _defaultValue: defaultValue,
1574 _currentValue: defaultValue,
1575 _changedBits: 0,
1576 // These are circular
1577 Provider: null,
1578 Consumer: null
1579 };
1580
1581 context.Provider = {
1582 $$typeof: REACT_PROVIDER_TYPE,
1583 _context: context
1584 };
1585 context.Consumer = context;
1586
1587 {
1588 context._currentRenderer = null;
1589 }
1590
1591 return context;
1592 }
1593
1594 function forwardRef(render) {
1595 {
1596 !(typeof render === 'function') ? warning(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render) : void 0;
1597 }
1598
1599 return {
1600 $$typeof: REACT_FORWARD_REF_TYPE,
1601 render: render
1602 };
1603 }
1604
1605 var describeComponentFrame = function (name, source, ownerName) {
1606 return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
1607 };
1608
1609 function isValidElementType(type) {
1610 return typeof type === 'string' || typeof type === 'function' ||
1611 // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1612 type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
1613 }
1614
1615 function getComponentName(fiber) {
1616 var type = fiber.type;
1617
1618 if (typeof type === 'function') {
1619 return type.displayName || type.name;
1620 }
1621 if (typeof type === 'string') {
1622 return type;
1623 }
1624 switch (type) {
1625 case REACT_FRAGMENT_TYPE:
1626 return 'ReactFragment';
1627 case REACT_PORTAL_TYPE:
1628 return 'ReactPortal';
1629 case REACT_CALL_TYPE:
1630 return 'ReactCall';
1631 case REACT_RETURN_TYPE:
1632 return 'ReactReturn';
1633 }
1634 if (typeof type === 'object' && type !== null) {
1635 switch (type.$$typeof) {
1636 case REACT_FORWARD_REF_TYPE:
1637 var functionName = type.render.displayName || type.render.name || '';
1638 return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
1639 }
1640 }
1641 return null;
1642 }
1643
1644 /**
1645 * ReactElementValidator provides a wrapper around a element factory
1646 * which validates the props passed to the element. This is intended to be
1647 * used only in DEV and could be replaced by a static type checker for languages
1648 * that support it.
1649 */
1650
1651 var currentlyValidatingElement = void 0;
1652 var propTypesMisspellWarningShown = void 0;
1653
1654 var getDisplayName = function () {};
1655 var getStackAddendum = function () {};
1656
1657 {
1658 currentlyValidatingElement = null;
1659
1660 propTypesMisspellWarningShown = false;
1661
1662 getDisplayName = function (element) {
1663 if (element == null) {
1664 return '#empty';
1665 } else if (typeof element === 'string' || typeof element === 'number') {
1666 return '#text';
1667 } else if (typeof element.type === 'string') {
1668 return element.type;
1669 } else if (element.type === REACT_FRAGMENT_TYPE) {
1670 return 'React.Fragment';
1671 } else {
1672 return element.type.displayName || element.type.name || 'Unknown';
1673 }
1674 };
1675
1676 getStackAddendum = function () {
1677 var stack = '';
1678 if (currentlyValidatingElement) {
1679 var name = getDisplayName(currentlyValidatingElement);
1680 var owner = currentlyValidatingElement._owner;
1681 stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
1682 }
1683 stack += ReactDebugCurrentFrame.getStackAddendum() || '';
1684 return stack;
1685 };
1686 }
1687
1688 function getDeclarationErrorAddendum() {
1689 if (ReactCurrentOwner.current) {
1690 var name = getComponentName(ReactCurrentOwner.current);
1691 if (name) {
1692 return '\n\nCheck the render method of `' + name + '`.';
1693 }
1694 }
1695 return '';
1696 }
1697
1698 function getSourceInfoErrorAddendum(elementProps) {
1699 if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
1700 var source = elementProps.__source;
1701 var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1702 var lineNumber = source.lineNumber;
1703 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1704 }
1705 return '';
1706 }
1707
1708 /**
1709 * Warn if there's no key explicitly set on dynamic arrays of children or
1710 * object keys are not valid. This allows us to keep track of children between
1711 * updates.
1712 */
1713 var ownerHasKeyUseWarning = {};
1714
1715 function getCurrentComponentErrorInfo(parentType) {
1716 var info = getDeclarationErrorAddendum();
1717
1718 if (!info) {
1719 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1720 if (parentName) {
1721 info = '\n\nCheck the top-level render call using <' + parentName + '>.';
1722 }
1723 }
1724 return info;
1725 }
1726
1727 /**
1728 * Warn if the element doesn't have an explicit key assigned to it.
1729 * This element is in an array. The array could grow and shrink or be
1730 * reordered. All children that haven't already been validated are required to
1731 * have a "key" property assigned to it. Error statuses are cached so a warning
1732 * will only be shown once.
1733 *
1734 * @internal
1735 * @param {ReactElement} element Element that requires a key.
1736 * @param {*} parentType element's parent's type.
1737 */
1738 function validateExplicitKey(element, parentType) {
1739 if (!element._store || element._store.validated || element.key != null) {
1740 return;
1741 }
1742 element._store.validated = true;
1743
1744 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1745 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1746 return;
1747 }
1748 ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1749
1750 // Usually the current owner is the offender, but if it accepts children as a
1751 // property, it may be the creator of the child that's responsible for
1752 // assigning it a key.
1753 var childOwner = '';
1754 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1755 // Give the component that originally created this child.
1756 childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
1757 }
1758
1759 currentlyValidatingElement = element;
1760 {
1761 warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getStackAddendum());
1762 }
1763 currentlyValidatingElement = null;
1764 }
1765
1766 /**
1767 * Ensure that every element either is passed in a static location, in an
1768 * array with an explicit keys property defined, or in an object literal
1769 * with valid key property.
1770 *
1771 * @internal
1772 * @param {ReactNode} node Statically passed child of any type.
1773 * @param {*} parentType node's parent's type.
1774 */
1775 function validateChildKeys(node, parentType) {
1776 if (typeof node !== 'object') {
1777 return;
1778 }
1779 if (Array.isArray(node)) {
1780 for (var i = 0; i < node.length; i++) {
1781 var child = node[i];
1782 if (isValidElement(child)) {
1783 validateExplicitKey(child, parentType);
1784 }
1785 }
1786 } else if (isValidElement(node)) {
1787 // This element was passed in a valid location.
1788 if (node._store) {
1789 node._store.validated = true;
1790 }
1791 } else if (node) {
1792 var iteratorFn = getIteratorFn(node);
1793 if (typeof iteratorFn === 'function') {
1794 // Entry iterators used to provide implicit keys,
1795 // but now we print a separate warning for them later.
1796 if (iteratorFn !== node.entries) {
1797 var iterator = iteratorFn.call(node);
1798 var step = void 0;
1799 while (!(step = iterator.next()).done) {
1800 if (isValidElement(step.value)) {
1801 validateExplicitKey(step.value, parentType);
1802 }
1803 }
1804 }
1805 }
1806 }
1807 }
1808
1809 /**
1810 * Given an element, validate that its props follow the propTypes definition,
1811 * provided by the type.
1812 *
1813 * @param {ReactElement} element
1814 */
1815 function validatePropTypes(element) {
1816 var componentClass = element.type;
1817 if (typeof componentClass !== 'function') {
1818 return;
1819 }
1820 var name = componentClass.displayName || componentClass.name;
1821 var propTypes = componentClass.propTypes;
1822 if (propTypes) {
1823 currentlyValidatingElement = element;
1824 checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum);
1825 currentlyValidatingElement = null;
1826 } else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1827 propTypesMisspellWarningShown = true;
1828 warning(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1829 }
1830 if (typeof componentClass.getDefaultProps === 'function') {
1831 !componentClass.getDefaultProps.isReactClassApproved ? warning(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
1832 }
1833 }
1834
1835 /**
1836 * Given a fragment, validate that it can only be provided with fragment props
1837 * @param {ReactElement} fragment
1838 */
1839 function validateFragmentProps(fragment) {
1840 currentlyValidatingElement = fragment;
1841
1842 var keys = Object.keys(fragment.props);
1843 for (var i = 0; i < keys.length; i++) {
1844 var key = keys[i];
1845 if (key !== 'children' && key !== 'key') {
1846 warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
1847 break;
1848 }
1849 }
1850
1851 if (fragment.ref !== null) {
1852 warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
1853 }
1854
1855 currentlyValidatingElement = null;
1856 }
1857
1858 function createElementWithValidation(type, props, children) {
1859 var validType = isValidElementType(type);
1860
1861 // We warn in this case but don't throw. We expect the element creation to
1862 // succeed and there will likely be errors in render.
1863 if (!validType) {
1864 var info = '';
1865 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1866 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1867 }
1868
1869 var sourceInfo = getSourceInfoErrorAddendum(props);
1870 if (sourceInfo) {
1871 info += sourceInfo;
1872 } else {
1873 info += getDeclarationErrorAddendum();
1874 }
1875
1876 info += getStackAddendum() || '';
1877
1878 var typeString = void 0;
1879 if (type === null) {
1880 typeString = 'null';
1881 } else if (Array.isArray(type)) {
1882 typeString = 'array';
1883 } else {
1884 typeString = typeof type;
1885 }
1886
1887 warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1888 }
1889
1890 var element = createElement.apply(this, arguments);
1891
1892 // The result can be nullish if a mock or a custom function is used.
1893 // TODO: Drop this when these are no longer allowed as the type argument.
1894 if (element == null) {
1895 return element;
1896 }
1897
1898 // Skip key warning if the type isn't valid since our key validation logic
1899 // doesn't expect a non-string/function type and can throw confusing errors.
1900 // We don't want exception behavior to differ between dev and prod.
1901 // (Rendering will throw with a helpful message and as soon as the type is
1902 // fixed, the key warnings will appear.)
1903 if (validType) {
1904 for (var i = 2; i < arguments.length; i++) {
1905 validateChildKeys(arguments[i], type);
1906 }
1907 }
1908
1909 if (type === REACT_FRAGMENT_TYPE) {
1910 validateFragmentProps(element);
1911 } else {
1912 validatePropTypes(element);
1913 }
1914
1915 return element;
1916 }
1917
1918 function createFactoryWithValidation(type) {
1919 var validatedFactory = createElementWithValidation.bind(null, type);
1920 validatedFactory.type = type;
1921 // Legacy hook: remove it
1922 {
1923 Object.defineProperty(validatedFactory, 'type', {
1924 enumerable: false,
1925 get: function () {
1926 lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
1927 Object.defineProperty(this, 'type', {
1928 value: type
1929 });
1930 return type;
1931 }
1932 });
1933 }
1934
1935 return validatedFactory;
1936 }
1937
1938 function cloneElementWithValidation(element, props, children) {
1939 var newElement = cloneElement.apply(this, arguments);
1940 for (var i = 2; i < arguments.length; i++) {
1941 validateChildKeys(arguments[i], newElement.type);
1942 }
1943 validatePropTypes(newElement);
1944 return newElement;
1945 }
1946
1947 var React = {
1948 Children: {
1949 map: mapChildren,
1950 forEach: forEachChildren,
1951 count: countChildren,
1952 toArray: toArray,
1953 only: onlyChild
1954 },
1955
1956 createRef: createRef,
1957 Component: Component,
1958 PureComponent: PureComponent,
1959
1960 createContext: createContext,
1961 forwardRef: forwardRef,
1962
1963 Fragment: REACT_FRAGMENT_TYPE,
1964 StrictMode: REACT_STRICT_MODE_TYPE,
1965 unstable_AsyncMode: REACT_ASYNC_MODE_TYPE,
1966
1967 createElement: createElementWithValidation,
1968 cloneElement: cloneElementWithValidation,
1969 createFactory: createFactoryWithValidation,
1970 isValidElement: isValidElement,
1971
1972 version: ReactVersion,
1973
1974 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
1975 ReactCurrentOwner: ReactCurrentOwner,
1976 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
1977 assign: _assign
1978 }
1979 };
1980
1981 {
1982 _assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
1983 // These should not be included in production.
1984 ReactDebugCurrentFrame: ReactDebugCurrentFrame,
1985 // Shim for React DOM 16.0.0 which still destructured (but not used) this.
1986 // TODO: remove in React 17.0.
1987 ReactComponentTreeHook: {}
1988 });
1989 }
1990
1991
1992
1993 var React$2 = Object.freeze({
1994 default: React
1995 });
1996
1997 var React$3 = ( React$2 && React ) || React$2;
1998
1999 // TODO: decide on the top-level export form.
2000 // This is hacky but makes it work with both Rollup and Jest.
2001 var react = React$3['default'] ? React$3['default'] : React$3;
2002
2003 module.exports = react;
2004 })();
2005 }
2006
2007 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
2008
2009/***/ }),
2010/* 9 */
2011/***/ (function(module, exports, __webpack_require__) {
2012
2013 /* WEBPACK VAR INJECTION */(function(process) {/**
2014 * Copyright (c) 2014-present, Facebook, Inc.
2015 *
2016 * This source code is licensed under the MIT license found in the
2017 * LICENSE file in the root directory of this source tree.
2018 *
2019 */
2020
2021 'use strict';
2022
2023 var emptyFunction = __webpack_require__(7);
2024
2025 /**
2026 * Similar to invariant but only logs a warning if the condition is not met.
2027 * This can be used to log issues in development environments in critical
2028 * paths. Removing the logging code for production environments will keep the
2029 * same logic and follow the same code paths.
2030 */
2031
2032 var warning = emptyFunction;
2033
2034 if (process.env.NODE_ENV !== 'production') {
2035 var printWarning = function printWarning(format) {
2036 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2037 args[_key - 1] = arguments[_key];
2038 }
2039
2040 var argIndex = 0;
2041 var message = 'Warning: ' + format.replace(/%s/g, function () {
2042 return args[argIndex++];
2043 });
2044 if (typeof console !== 'undefined') {
2045 console.error(message);
2046 }
2047 try {
2048 // --- Welcome to debugging React ---
2049 // This error was thrown as a convenience so that you can use this stack
2050 // to find the callsite that caused this warning to fire.
2051 throw new Error(message);
2052 } catch (x) {}
2053 };
2054
2055 warning = function warning(condition, format) {
2056 if (format === undefined) {
2057 throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
2058 }
2059
2060 if (format.indexOf('Failed Composite propType: ') === 0) {
2061 return; // Ignore CompositeComponent proptype check.
2062 }
2063
2064 if (!condition) {
2065 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
2066 args[_key2 - 2] = arguments[_key2];
2067 }
2068
2069 printWarning.apply(undefined, [format].concat(args));
2070 }
2071 };
2072 }
2073
2074 module.exports = warning;
2075 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
2076
2077/***/ }),
2078/* 10 */
2079/***/ (function(module, exports, __webpack_require__) {
2080
2081 /* WEBPACK VAR INJECTION */(function(process) {/**
2082 * Copyright (c) 2013-present, Facebook, Inc.
2083 *
2084 * This source code is licensed under the MIT license found in the
2085 * LICENSE file in the root directory of this source tree.
2086 */
2087
2088 'use strict';
2089
2090 if (process.env.NODE_ENV !== 'production') {
2091 var invariant = __webpack_require__(5);
2092 var warning = __webpack_require__(9);
2093 var ReactPropTypesSecret = __webpack_require__(11);
2094 var loggedTypeFailures = {};
2095 }
2096
2097 /**
2098 * Assert that the values match with the type specs.
2099 * Error messages are memorized and will only be shown once.
2100 *
2101 * @param {object} typeSpecs Map of name to a ReactPropType
2102 * @param {object} values Runtime values that need to be type-checked
2103 * @param {string} location e.g. "prop", "context", "child context"
2104 * @param {string} componentName Name of the component for error messages.
2105 * @param {?Function} getStack Returns the component stack.
2106 * @private
2107 */
2108 function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
2109 if (process.env.NODE_ENV !== 'production') {
2110 for (var typeSpecName in typeSpecs) {
2111 if (typeSpecs.hasOwnProperty(typeSpecName)) {
2112 var error;
2113 // Prop type validation may throw. In case they do, we don't want to
2114 // fail the render phase where it didn't fail before. So we log it.
2115 // After these have been cleaned up, we'll let them throw.
2116 try {
2117 // This is intentionally an invariant that gets caught. It's the same
2118 // behavior as without this statement except with a better message.
2119 invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
2120 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
2121 } catch (ex) {
2122 error = ex;
2123 }
2124 warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
2125 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
2126 // Only monitor this failure once because there tends to be a lot of the
2127 // same error.
2128 loggedTypeFailures[error.message] = true;
2129
2130 var stack = getStack ? getStack() : '';
2131
2132 warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
2133 }
2134 }
2135 }
2136 }
2137 }
2138
2139 module.exports = checkPropTypes;
2140
2141 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
2142
2143/***/ }),
2144/* 11 */
2145/***/ (function(module, exports) {
2146
2147 /**
2148 * Copyright (c) 2013-present, Facebook, Inc.
2149 *
2150 * This source code is licensed under the MIT license found in the
2151 * LICENSE file in the root directory of this source tree.
2152 */
2153
2154 'use strict';
2155
2156 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2157
2158 module.exports = ReactPropTypesSecret;
2159
2160
2161/***/ }),
2162/* 12 */
2163/***/ (function(module, exports, __webpack_require__) {
2164
2165 /* WEBPACK VAR INJECTION */(function(process) {'use strict';
2166
2167 function checkDCE() {
2168 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
2169 if (
2170 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||
2171 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'
2172 ) {
2173 return;
2174 }
2175 if (process.env.NODE_ENV !== 'production') {
2176 // This branch is unreachable because this function is only called
2177 // in production, but the condition is true only in development.
2178 // Therefore if the branch is still here, dead code elimination wasn't
2179 // properly applied.
2180 // Don't change the message. React DevTools relies on it. Also make sure
2181 // this message doesn't occur elsewhere in this function, or it will cause
2182 // a false positive.
2183 throw new Error('^_^');
2184 }
2185 try {
2186 // Verify that the code above has been dead code eliminated (DCE'd).
2187 __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
2188 } catch (err) {
2189 // DevTools shouldn't crash React, no matter what.
2190 // We should still report in case we break this code.
2191 console.error(err);
2192 }
2193 }
2194
2195 if (process.env.NODE_ENV === 'production') {
2196 // DCE check should happen before ReactDOM bundle executes so that
2197 // DevTools can report bad minification during injection.
2198 checkDCE();
2199 module.exports = __webpack_require__(13);
2200 } else {
2201 module.exports = __webpack_require__(20);
2202 }
2203
2204 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
2205
2206/***/ }),
2207/* 13 */
2208/***/ (function(module, exports, __webpack_require__) {
2209
2210 /** @license React v16.3.2
2211 * react-dom.production.min.js
2212 *
2213 * Copyright (c) 2013-present, Facebook, Inc.
2214 *
2215 * This source code is licensed under the MIT license found in the
2216 * LICENSE file in the root directory of this source tree.
2217 */
2218
2219 /*
2220 Modernizr 3.0.0pre (Custom Build) | MIT
2221 */
2222 'use strict';var ba=__webpack_require__(5),ea=__webpack_require__(1),m=__webpack_require__(14),A=__webpack_require__(4),C=__webpack_require__(7),fa=__webpack_require__(15),ha=__webpack_require__(16),ja=__webpack_require__(17),ka=__webpack_require__(6);
2223 function D(a){for(var b=arguments.length-1,c="http://reactjs.org/docs/error-decoder.html?invariant\x3d"+a,d=0;d<b;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+1]);ba(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",c)}ea?void 0:D("227");
2224 function ma(a,b,c,d,e,f,h,g,k){this._hasCaughtError=!1;this._caughtError=null;var v=Array.prototype.slice.call(arguments,3);try{b.apply(c,v)}catch(l){this._caughtError=l,this._hasCaughtError=!0}}
2225 var E={_caughtError:null,_hasCaughtError:!1,_rethrowError:null,_hasRethrowError:!1,invokeGuardedCallback:function(a,b,c,d,e,f,h,g,k){ma.apply(E,arguments)},invokeGuardedCallbackAndCatchFirstError:function(a,b,c,d,e,f,h,g,k){E.invokeGuardedCallback.apply(this,arguments);if(E.hasCaughtError()){var v=E.clearCaughtError();E._hasRethrowError||(E._hasRethrowError=!0,E._rethrowError=v)}},rethrowCaughtError:function(){return na.apply(E,arguments)},hasCaughtError:function(){return E._hasCaughtError},clearCaughtError:function(){if(E._hasCaughtError){var a=
2226 E._caughtError;E._caughtError=null;E._hasCaughtError=!1;return a}D("198")}};function na(){if(E._hasRethrowError){var a=E._rethrowError;E._rethrowError=null;E._hasRethrowError=!1;throw a;}}var oa=null,pa={};
2227 function qa(){if(oa)for(var a in pa){var b=pa[a],c=oa.indexOf(a);-1<c?void 0:D("96",a);if(!ra[c]){b.extractEvents?void 0:D("97",a);ra[c]=b;c=b.eventTypes;for(var d in c){var e=void 0;var f=c[d],h=b,g=d;sa.hasOwnProperty(g)?D("99",g):void 0;sa[g]=f;var k=f.phasedRegistrationNames;if(k){for(e in k)k.hasOwnProperty(e)&&ta(k[e],h,g);e=!0}else f.registrationName?(ta(f.registrationName,h,g),e=!0):e=!1;e?void 0:D("98",d,a)}}}}
2228 function ta(a,b,c){ua[a]?D("100",a):void 0;ua[a]=b;va[a]=b.eventTypes[c].dependencies}var ra=[],sa={},ua={},va={};function wa(a){oa?D("101"):void 0;oa=Array.prototype.slice.call(a);qa()}function xa(a){var b=!1,c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];pa.hasOwnProperty(c)&&pa[c]===d||(pa[c]?D("102",c):void 0,pa[c]=d,b=!0)}b&&qa()}
2229 var Ca=Object.freeze({plugins:ra,eventNameDispatchConfigs:sa,registrationNameModules:ua,registrationNameDependencies:va,possibleRegistrationNames:null,injectEventPluginOrder:wa,injectEventPluginsByName:xa}),Da=null,Ea=null,Fa=null;function Ga(a,b,c,d){b=a.type||"unknown-event";a.currentTarget=Fa(d);E.invokeGuardedCallbackAndCatchFirstError(b,c,void 0,a);a.currentTarget=null}
2230 function Ha(a,b){null==b?D("30"):void 0;if(null==a)return b;if(Array.isArray(a)){if(Array.isArray(b))return a.push.apply(a,b),a;a.push(b);return a}return Array.isArray(b)?[a].concat(b):[a,b]}function Ia(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)}var Ja=null;
2231 function Ka(a,b){if(a){var c=a._dispatchListeners,d=a._dispatchInstances;if(Array.isArray(c))for(var e=0;e<c.length&&!a.isPropagationStopped();e++)Ga(a,b,c[e],d[e]);else c&&Ga(a,b,c,d);a._dispatchListeners=null;a._dispatchInstances=null;a.isPersistent()||a.constructor.release(a)}}function La(a){return Ka(a,!0)}function Ma(a){return Ka(a,!1)}var Na={injectEventPluginOrder:wa,injectEventPluginsByName:xa};
2232 function Oa(a,b){var c=a.stateNode;if(!c)return null;var d=Da(c);if(!d)return null;c=d[b];a:switch(b){case "onClick":case "onClickCapture":case "onDoubleClick":case "onDoubleClickCapture":case "onMouseDown":case "onMouseDownCapture":case "onMouseMove":case "onMouseMoveCapture":case "onMouseUp":case "onMouseUpCapture":(d=!d.disabled)||(a=a.type,d=!("button"===a||"input"===a||"select"===a||"textarea"===a));a=!d;break a;default:a=!1}if(a)return null;c&&"function"!==typeof c?D("231",b,typeof c):void 0;
2233 return c}function Pa(a,b){null!==a&&(Ja=Ha(Ja,a));a=Ja;Ja=null;a&&(b?Ia(a,La):Ia(a,Ma),Ja?D("95"):void 0,E.rethrowCaughtError())}function Qa(a,b,c,d){for(var e=null,f=0;f<ra.length;f++){var h=ra[f];h&&(h=h.extractEvents(a,b,c,d))&&(e=Ha(e,h))}Pa(e,!1)}var Ra=Object.freeze({injection:Na,getListener:Oa,runEventsInBatch:Pa,runExtractedEventsInBatch:Qa}),Sa=Math.random().toString(36).slice(2),F="__reactInternalInstance$"+Sa,Ta="__reactEventHandlers$"+Sa;
2234 function Ua(a){if(a[F])return a[F];for(;!a[F];)if(a.parentNode)a=a.parentNode;else return null;a=a[F];return 5===a.tag||6===a.tag?a:null}function Va(a){if(5===a.tag||6===a.tag)return a.stateNode;D("33")}function Xa(a){return a[Ta]||null}var bb=Object.freeze({precacheFiberNode:function(a,b){b[F]=a},getClosestInstanceFromNode:Ua,getInstanceFromNode:function(a){a=a[F];return!a||5!==a.tag&&6!==a.tag?null:a},getNodeFromInstance:Va,getFiberCurrentPropsFromNode:Xa,updateFiberProps:function(a,b){a[Ta]=b}});
2235 function L(a){do a=a["return"];while(a&&5!==a.tag);return a?a:null}function cb(a,b,c){for(var d=[];a;)d.push(a),a=L(a);for(a=d.length;0<a--;)b(d[a],"captured",c);for(a=0;a<d.length;a++)b(d[a],"bubbled",c)}function db(a,b,c){if(b=Oa(a,c.dispatchConfig.phasedRegistrationNames[b]))c._dispatchListeners=Ha(c._dispatchListeners,b),c._dispatchInstances=Ha(c._dispatchInstances,a)}function eb(a){a&&a.dispatchConfig.phasedRegistrationNames&&cb(a._targetInst,db,a)}
2236 function fb(a){if(a&&a.dispatchConfig.phasedRegistrationNames){var b=a._targetInst;b=b?L(b):null;cb(b,db,a)}}function gb(a,b,c){a&&c&&c.dispatchConfig.registrationName&&(b=Oa(a,c.dispatchConfig.registrationName))&&(c._dispatchListeners=Ha(c._dispatchListeners,b),c._dispatchInstances=Ha(c._dispatchInstances,a))}function hb(a){a&&a.dispatchConfig.registrationName&&gb(a._targetInst,null,a)}function ib(a){Ia(a,eb)}
2237 function jb(a,b,c,d){if(c&&d)a:{var e=c;for(var f=d,h=0,g=e;g;g=L(g))h++;g=0;for(var k=f;k;k=L(k))g++;for(;0<h-g;)e=L(e),h--;for(;0<g-h;)f=L(f),g--;for(;h--;){if(e===f||e===f.alternate)break a;e=L(e);f=L(f)}e=null}else e=null;f=e;for(e=[];c&&c!==f;){h=c.alternate;if(null!==h&&h===f)break;e.push(c);c=L(c)}for(c=[];d&&d!==f;){h=d.alternate;if(null!==h&&h===f)break;c.push(d);d=L(d)}for(d=0;d<e.length;d++)gb(e[d],"bubbled",a);for(a=c.length;0<a--;)gb(c[a],"captured",b)}
2238 var kb=Object.freeze({accumulateTwoPhaseDispatches:ib,accumulateTwoPhaseDispatchesSkipTarget:function(a){Ia(a,fb)},accumulateEnterLeaveDispatches:jb,accumulateDirectDispatches:function(a){Ia(a,hb)}}),lb=null;function mb(){!lb&&m.canUseDOM&&(lb="textContent"in document.documentElement?"textContent":"innerText");return lb}var M={_root:null,_startText:null,_fallbackText:null};
2239 function nb(){if(M._fallbackText)return M._fallbackText;var a,b=M._startText,c=b.length,d,e=ob(),f=e.length;for(a=0;a<c&&b[a]===e[a];a++);var h=c-a;for(d=1;d<=h&&b[c-d]===e[f-d];d++);M._fallbackText=e.slice(a,1<d?1-d:void 0);return M._fallbackText}function ob(){return"value"in M._root?M._root.value:M._root[mb()]}
2240 var pb="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),qb={type:null,target:null,currentTarget:C.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
2241 function N(a,b,c,d){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var e in a)a.hasOwnProperty(e)&&((b=a[e])?this[e]=b(c):"target"===e?this.target=d:this[e]=c[e]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?C.thatReturnsTrue:C.thatReturnsFalse;this.isPropagationStopped=C.thatReturnsFalse;return this}
2242 A(N.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=C.thatReturnsTrue)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=C.thatReturnsTrue)},persist:function(){this.isPersistent=C.thatReturnsTrue},isPersistent:C.thatReturnsFalse,
2243 destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=null;for(a=0;a<pb.length;a++)this[pb[a]]=null}});N.Interface=qb;N.extend=function(a){function b(){}function c(){return d.apply(this,arguments)}var d=this;b.prototype=d.prototype;var e=new b;A(e,c.prototype);c.prototype=e;c.prototype.constructor=c;c.Interface=A({},d.Interface,a);c.extend=d.extend;rb(c);return c};rb(N);
2244 function sb(a,b,c,d){if(this.eventPool.length){var e=this.eventPool.pop();this.call(e,a,b,c,d);return e}return new this(a,b,c,d)}function tb(a){a instanceof this?void 0:D("223");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function rb(a){a.eventPool=[];a.getPooled=sb;a.release=tb}var ub=N.extend({data:null}),vb=N.extend({data:null}),wb=[9,13,27,32],xb=m.canUseDOM&&"CompositionEvent"in window,yb=null;m.canUseDOM&&"documentMode"in document&&(yb=document.documentMode);
2245 var zb=m.canUseDOM&&"TextEvent"in window&&!yb,Ab=m.canUseDOM&&(!xb||yb&&8<yb&&11>=yb),Bb=String.fromCharCode(32),Kb={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"topBlur topCompositionEnd topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",
2246 captured:"onCompositionStartCapture"},dependencies:"topBlur topCompositionStart topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"topBlur topCompositionUpdate topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")}},Lb=!1;
2247 function Mb(a,b){switch(a){case "topKeyUp":return-1!==wb.indexOf(b.keyCode);case "topKeyDown":return 229!==b.keyCode;case "topKeyPress":case "topMouseDown":case "topBlur":return!0;default:return!1}}function Nb(a){a=a.detail;return"object"===typeof a&&"data"in a?a.data:null}var Ob=!1;function Pb(a,b){switch(a){case "topCompositionEnd":return Nb(b);case "topKeyPress":if(32!==b.which)return null;Lb=!0;return Bb;case "topTextInput":return a=b.data,a===Bb&&Lb?null:a;default:return null}}
2248 function Qb(a,b){if(Ob)return"topCompositionEnd"===a||!xb&&Mb(a,b)?(a=nb(),M._root=null,M._startText=null,M._fallbackText=null,Ob=!1,a):null;switch(a){case "topPaste":return null;case "topKeyPress":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1<b.char.length)return b.char;if(b.which)return String.fromCharCode(b.which)}return null;case "topCompositionEnd":return Ab?null:b.data;default:return null}}
2249 var Rb={eventTypes:Kb,extractEvents:function(a,b,c,d){var e=void 0;var f=void 0;if(xb)b:{switch(a){case "topCompositionStart":e=Kb.compositionStart;break b;case "topCompositionEnd":e=Kb.compositionEnd;break b;case "topCompositionUpdate":e=Kb.compositionUpdate;break b}e=void 0}else Ob?Mb(a,c)&&(e=Kb.compositionEnd):"topKeyDown"===a&&229===c.keyCode&&(e=Kb.compositionStart);e?(Ab&&(Ob||e!==Kb.compositionStart?e===Kb.compositionEnd&&Ob&&(f=nb()):(M._root=d,M._startText=ob(),Ob=!0)),e=ub.getPooled(e,
2250 b,c,d),f?e.data=f:(f=Nb(c),null!==f&&(e.data=f)),ib(e),f=e):f=null;(a=zb?Pb(a,c):Qb(a,c))?(b=vb.getPooled(Kb.beforeInput,b,c,d),b.data=a,ib(b)):b=null;return null===f?b:null===b?f:[f,b]}},Sb=null,Tb={injectFiberControlledHostComponent:function(a){Sb=a}},Ub=null,Vb=null;function Wb(a){if(a=Ea(a)){Sb&&"function"===typeof Sb.restoreControlledState?void 0:D("194");var b=Da(a.stateNode);Sb.restoreControlledState(a.stateNode,a.type,b)}}function Xb(a){Ub?Vb?Vb.push(a):Vb=[a]:Ub=a}
2251 function Yb(){return null!==Ub||null!==Vb}function Zb(){if(Ub){var a=Ub,b=Vb;Vb=Ub=null;Wb(a);if(b)for(a=0;a<b.length;a++)Wb(b[a])}}var $b=Object.freeze({injection:Tb,enqueueStateRestore:Xb,needsStateRestore:Yb,restoreStateIfNeeded:Zb});function ac(a,b){return a(b)}function bc(a,b,c){return a(b,c)}function cc(){}var dc=!1;function ec(a,b){if(dc)return a(b);dc=!0;try{return ac(a,b)}finally{dc=!1,Yb()&&(cc(),Zb())}}
2252 var fc={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function gc(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return"input"===b?!!fc[a.type]:"textarea"===b?!0:!1}function hc(a){a=a.target||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}
2253 function ic(a,b){if(!m.canUseDOM||b&&!("addEventListener"in document))return!1;a="on"+a;b=a in document;b||(b=document.createElement("div"),b.setAttribute(a,"return;"),b="function"===typeof b[a]);return b}function jc(a){var b=a.type;return(a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===b)}
2254 function kc(a){var b=jc(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"function"===typeof c.get&&"function"===typeof c.set)return Object.defineProperty(a,b,{configurable:!0,get:function(){return c.get.call(this)},set:function(a){d=""+a;c.set.call(this,a)}}),Object.defineProperty(a,b,{enumerable:c.enumerable}),{getValue:function(){return d},setValue:function(a){d=""+a},stopTracking:function(){a._valueTracker=null;delete a[b]}}}
2255 function lc(a){a._valueTracker||(a._valueTracker=kc(a))}function mc(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d="";a&&(d=jc(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}
2256 var nc=ea.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,O="function"===typeof Symbol&&Symbol["for"],oc=O?Symbol["for"]("react.element"):60103,pc=O?Symbol["for"]("react.call"):60104,qc=O?Symbol["for"]("react.return"):60105,rc=O?Symbol["for"]("react.portal"):60106,sc=O?Symbol["for"]("react.fragment"):60107,tc=O?Symbol["for"]("react.strict_mode"):60108,uc=O?Symbol["for"]("react.provider"):60109,vc=O?Symbol["for"]("react.context"):60110,wc=O?Symbol["for"]("react.async_mode"):60111,
2257 xc=O?Symbol["for"]("react.forward_ref"):60112,yc="function"===typeof Symbol&&Symbol.iterator;function zc(a){if(null===a||"undefined"===typeof a)return null;a=yc&&a[yc]||a["@@iterator"];return"function"===typeof a?a:null}
2258 function Ac(a){a=a.type;if("function"===typeof a)return a.displayName||a.name;if("string"===typeof a)return a;switch(a){case sc:return"ReactFragment";case rc:return"ReactPortal";case pc:return"ReactCall";case qc:return"ReactReturn"}if("object"===typeof a&&null!==a)switch(a.$$typeof){case xc:return a=a.render.displayName||a.render.name||"",""!==a?"ForwardRef("+a+")":"ForwardRef"}return null}
2259 function Bc(a){var b="";do{a:switch(a.tag){case 0:case 1:case 2:case 5:var c=a._debugOwner,d=a._debugSource;var e=Ac(a);var f=null;c&&(f=Ac(c));c=d;e="\n in "+(e||"Unknown")+(c?" (at "+c.fileName.replace(/^.*[\\\/]/,"")+":"+c.lineNumber+")":f?" (created by "+f+")":"");break a;default:e=""}b+=e;a=a["return"]}while(a);return b}
2260 var Cc=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Dc={},Ec={};function Fc(a){if(Ec.hasOwnProperty(a))return!0;if(Dc.hasOwnProperty(a))return!1;if(Cc.test(a))return Ec[a]=!0;Dc[a]=!0;return!1}
2261 function Gc(a,b,c,d){if(null!==c&&0===c.type)return!1;switch(typeof b){case "function":case "symbol":return!0;case "boolean":if(d)return!1;if(null!==c)return!c.acceptsBooleans;a=a.toLowerCase().slice(0,5);return"data-"!==a&&"aria-"!==a;default:return!1}}function Hc(a,b,c,d){if(null===b||"undefined"===typeof b||Gc(a,b,c,d))return!0;if(null!==c)switch(c.type){case 3:return!b;case 4:return!1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return!1}
2262 function U(a,b,c,d,e){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b}var V={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){V[a]=new U(a,0,!1,a,null)});
2263 [["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];V[b]=new U(b,1,!1,a[1],null)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){V[a]=new U(a,2,!1,a.toLowerCase(),null)});["autoReverse","externalResourcesRequired","preserveAlpha"].forEach(function(a){V[a]=new U(a,2,!1,a,null)});
2264 "allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){V[a]=new U(a,3,!1,a.toLowerCase(),null)});["checked","multiple","muted","selected"].forEach(function(a){V[a]=new U(a,3,!0,a.toLowerCase(),null)});["capture","download"].forEach(function(a){V[a]=new U(a,4,!1,a.toLowerCase(),null)});
2265 ["cols","rows","size","span"].forEach(function(a){V[a]=new U(a,6,!1,a.toLowerCase(),null)});["rowSpan","start"].forEach(function(a){V[a]=new U(a,5,!1,a.toLowerCase(),null)});var Sc=/[\-:]([a-z])/g;function Tc(a){return a[1].toUpperCase()}
2266 "accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(Sc,
2267 Tc);V[b]=new U(b,1,!1,a,null)});"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(Sc,Tc);V[b]=new U(b,1,!1,a,"http://www.w3.org/1999/xlink")});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(Sc,Tc);V[b]=new U(b,1,!1,a,"http://www.w3.org/XML/1998/namespace")});V.tabIndex=new U("tabIndex",1,!1,"tabindex",null);
2268 function Uc(a,b,c,d){var e=V.hasOwnProperty(b)?V[b]:null;var f=null!==e?0===e.type:d?!1:!(2<b.length)||"o"!==b[0]&&"O"!==b[0]||"n"!==b[1]&&"N"!==b[1]?!1:!0;f||(Hc(b,c,e,d)&&(c=null),d||null===e?Fc(b)&&(null===c?a.removeAttribute(b):a.setAttribute(b,""+c)):e.mustUseProperty?a[e.propertyName]=null===c?3===e.type?!1:"":c:(b=e.attributeName,d=e.attributeNamespace,null===c?a.removeAttribute(b):(e=e.type,c=3===e||4===e&&!0===c?"":""+c,d?a.setAttributeNS(d,b,c):a.setAttribute(b,c))))}
2269 function Vc(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Wc(a,b){var c=null==b.defaultValue?"":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Xc(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:"checkbox"===b.type||"radio"===b.type?null!=b.checked:null!=b.value}}function Yc(a,b){b=b.checked;null!=b&&Uc(a,"checked",b,!1)}
2270 function Zc(a,b){Yc(a,b);var c=Xc(b.value);if(null!=c)if("number"===b.type){if(0===c&&""===a.value||a.value!=c)a.value=""+c}else a.value!==""+c&&(a.value=""+c);b.hasOwnProperty("value")?$c(a,b.type,c):b.hasOwnProperty("defaultValue")&&$c(a,b.type,Xc(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}
2271 function ad(a,b){if(b.hasOwnProperty("value")||b.hasOwnProperty("defaultValue"))""===a.value&&(a.value=""+a._wrapperState.initialValue),a.defaultValue=""+a._wrapperState.initialValue;b=a.name;""!==b&&(a.name="");a.defaultChecked=!a.defaultChecked;a.defaultChecked=!a.defaultChecked;""!==b&&(a.name=b)}function $c(a,b,c){if("number"!==b||a.ownerDocument.activeElement!==a)null==c?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c)}
2272 function Xc(a){switch(typeof a){case "boolean":case "number":case "object":case "string":case "undefined":return a;default:return""}}var bd={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"topBlur topChange topClick topFocus topInput topKeyDown topKeyUp topSelectionChange".split(" ")}};function cd(a,b,c){a=N.getPooled(bd.change,a,b,c);a.type="change";Xb(c);ib(a);return a}var dd=null,ed=null;function fd(a){Pa(a,!1)}
2273 function gd(a){var b=Va(a);if(mc(b))return a}function hd(a,b){if("topChange"===a)return b}var id=!1;m.canUseDOM&&(id=ic("input")&&(!document.documentMode||9<document.documentMode));function jd(){dd&&(dd.detachEvent("onpropertychange",kd),ed=dd=null)}function kd(a){"value"===a.propertyName&&gd(ed)&&(a=cd(ed,a,hc(a)),ec(fd,a))}function ld(a,b,c){"topFocus"===a?(jd(),dd=b,ed=c,dd.attachEvent("onpropertychange",kd)):"topBlur"===a&&jd()}
2274 function md(a){if("topSelectionChange"===a||"topKeyUp"===a||"topKeyDown"===a)return gd(ed)}function nd(a,b){if("topClick"===a)return gd(b)}function od(a,b){if("topInput"===a||"topChange"===a)return gd(b)}
2275 var pd={eventTypes:bd,_isInputEventSupported:id,extractEvents:function(a,b,c,d){var e=b?Va(b):window,f=void 0,h=void 0,g=e.nodeName&&e.nodeName.toLowerCase();"select"===g||"input"===g&&"file"===e.type?f=hd:gc(e)?id?f=od:(f=md,h=ld):(g=e.nodeName)&&"input"===g.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)&&(f=nd);if(f&&(f=f(a,b)))return cd(f,c,d);h&&h(a,e,b);"topBlur"===a&&null!=b&&(a=b._wrapperState||e._wrapperState)&&a.controlled&&"number"===e.type&&$c(e,"number",e.value)}},qd=N.extend({view:null,
2276 detail:null}),rd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sd(a){var b=this.nativeEvent;return b.getModifierState?b.getModifierState(a):(a=rd[a])?!!b[a]:!1}function td(){return sd}
2277 var ud=qd.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:td,button:null,buttons:null,relatedTarget:function(a){return a.relatedTarget||(a.fromElement===a.srcElement?a.toElement:a.fromElement)}}),vd={mouseEnter:{registrationName:"onMouseEnter",dependencies:["topMouseOut","topMouseOver"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["topMouseOut","topMouseOver"]}},wd={eventTypes:vd,extractEvents:function(a,
2278 b,c,d){if("topMouseOver"===a&&(c.relatedTarget||c.fromElement)||"topMouseOut"!==a&&"topMouseOver"!==a)return null;var e=d.window===d?d:(e=d.ownerDocument)?e.defaultView||e.parentWindow:window;"topMouseOut"===a?(a=b,b=(b=c.relatedTarget||c.toElement)?Ua(b):null):a=null;if(a===b)return null;var f=null==a?e:Va(a);e=null==b?e:Va(b);var h=ud.getPooled(vd.mouseLeave,a,c,d);h.type="mouseleave";h.target=f;h.relatedTarget=e;c=ud.getPooled(vd.mouseEnter,b,c,d);c.type="mouseenter";c.target=e;c.relatedTarget=
2279 f;jb(h,c,a,b);return[h,c]}};function xd(a){var b=a;if(a.alternate)for(;b["return"];)b=b["return"];else{if(0!==(b.effectTag&2))return 1;for(;b["return"];)if(b=b["return"],0!==(b.effectTag&2))return 1}return 3===b.tag?2:3}function yd(a){return(a=a._reactInternalFiber)?2===xd(a):!1}function zd(a){2!==xd(a)?D("188"):void 0}
2280 function Ad(a){var b=a.alternate;if(!b)return b=xd(a),3===b?D("188"):void 0,1===b?null:a;for(var c=a,d=b;;){var e=c["return"],f=e?e.alternate:null;if(!e||!f)break;if(e.child===f.child){for(var h=e.child;h;){if(h===c)return zd(e),a;if(h===d)return zd(e),b;h=h.sibling}D("188")}if(c["return"]!==d["return"])c=e,d=f;else{h=!1;for(var g=e.child;g;){if(g===c){h=!0;c=e;d=f;break}if(g===d){h=!0;d=e;c=f;break}g=g.sibling}if(!h){for(g=f.child;g;){if(g===c){h=!0;c=f;d=e;break}if(g===d){h=!0;d=f;c=e;break}g=g.sibling}h?
2281 void 0:D("189")}}c.alternate!==d?D("190"):void 0}3!==c.tag?D("188"):void 0;return c.stateNode.current===c?a:b}function Bd(a){a=Ad(a);if(!a)return null;for(var b=a;;){if(5===b.tag||6===b.tag)return b;if(b.child)b.child["return"]=b,b=b.child;else{if(b===a)break;for(;!b.sibling;){if(!b["return"]||b["return"]===a)return null;b=b["return"]}b.sibling["return"]=b["return"];b=b.sibling}}return null}
2282 function Cd(a){a=Ad(a);if(!a)return null;for(var b=a;;){if(5===b.tag||6===b.tag)return b;if(b.child&&4!==b.tag)b.child["return"]=b,b=b.child;else{if(b===a)break;for(;!b.sibling;){if(!b["return"]||b["return"]===a)return null;b=b["return"]}b.sibling["return"]=b["return"];b=b.sibling}}return null}var Dd=N.extend({animationName:null,elapsedTime:null,pseudoElement:null}),Ed=N.extend({clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),Fd=qd.extend({relatedTarget:null});
2283 function Gd(a){var b=a.keyCode;"charCode"in a?(a=a.charCode,0===a&&13===b&&(a=13)):a=b;10===a&&(a=13);return 32<=a||13===a?a:0}
2284 var Hd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Id={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",
2285 116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Jd=qd.extend({key:function(a){if(a.key){var b=Hd[a.key]||a.key;if("Unidentified"!==b)return b}return"keypress"===a.type?(a=Gd(a),13===a?"Enter":String.fromCharCode(a)):"keydown"===a.type||"keyup"===a.type?Id[a.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:td,charCode:function(a){return"keypress"===
2286 a.type?Gd(a):0},keyCode:function(a){return"keydown"===a.type||"keyup"===a.type?a.keyCode:0},which:function(a){return"keypress"===a.type?Gd(a):"keydown"===a.type||"keyup"===a.type?a.keyCode:0}}),Kd=ud.extend({dataTransfer:null}),Ld=qd.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:td}),Md=N.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),Nd=ud.extend({deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in
2287 a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:null,deltaMode:null}),Od={},Pd={};function Qd(a,b){var c=a[0].toUpperCase()+a.slice(1),d="on"+c;c="top"+c;b={phasedRegistrationNames:{bubbled:d,captured:d+"Capture"},dependencies:[c],isInteractive:b};Od[a]=b;Pd[c]=b}
2288 "blur cancel click close contextMenu copy cut doubleClick dragEnd dragStart drop focus input invalid keyDown keyPress keyUp mouseDown mouseUp paste pause play rateChange reset seeked submit touchCancel touchEnd touchStart volumeChange".split(" ").forEach(function(a){Qd(a,!0)});
2289 "abort animationEnd animationIteration animationStart canPlay canPlayThrough drag dragEnter dragExit dragLeave dragOver durationChange emptied encrypted ended error load loadedData loadedMetadata loadStart mouseMove mouseOut mouseOver playing progress scroll seeking stalled suspend timeUpdate toggle touchMove transitionEnd waiting wheel".split(" ").forEach(function(a){Qd(a,!1)});
2290 var Rd={eventTypes:Od,isInteractiveTopLevelEventType:function(a){a=Pd[a];return void 0!==a&&!0===a.isInteractive},extractEvents:function(a,b,c,d){var e=Pd[a];if(!e)return null;switch(a){case "topKeyPress":if(0===Gd(c))return null;case "topKeyDown":case "topKeyUp":a=Jd;break;case "topBlur":case "topFocus":a=Fd;break;case "topClick":if(2===c.button)return null;case "topDoubleClick":case "topMouseDown":case "topMouseMove":case "topMouseUp":case "topMouseOut":case "topMouseOver":case "topContextMenu":a=
2291 ud;break;case "topDrag":case "topDragEnd":case "topDragEnter":case "topDragExit":case "topDragLeave":case "topDragOver":case "topDragStart":case "topDrop":a=Kd;break;case "topTouchCancel":case "topTouchEnd":case "topTouchMove":case "topTouchStart":a=Ld;break;case "topAnimationEnd":case "topAnimationIteration":case "topAnimationStart":a=Dd;break;case "topTransitionEnd":a=Md;break;case "topScroll":a=qd;break;case "topWheel":a=Nd;break;case "topCopy":case "topCut":case "topPaste":a=Ed;break;default:a=
2292 N}b=a.getPooled(e,b,c,d);ib(b);return b}},Sd=Rd.isInteractiveTopLevelEventType,Td=[];function Ud(a){var b=a.targetInst;do{if(!b){a.ancestors.push(b);break}var c;for(c=b;c["return"];)c=c["return"];c=3!==c.tag?null:c.stateNode.containerInfo;if(!c)break;a.ancestors.push(b);b=Ua(c)}while(b);for(c=0;c<a.ancestors.length;c++)b=a.ancestors[c],Qa(a.topLevelType,b,a.nativeEvent,hc(a.nativeEvent))}var Vd=!0;function Wd(a){Vd=!!a}
2293 function W(a,b,c){if(!c)return null;a=(Sd(a)?Xd:Yd).bind(null,a);c.addEventListener(b,a,!1)}function Zd(a,b,c){if(!c)return null;a=(Sd(a)?Xd:Yd).bind(null,a);c.addEventListener(b,a,!0)}function Xd(a,b){bc(Yd,a,b)}
2294 function Yd(a,b){if(Vd){var c=hc(b);c=Ua(c);null!==c&&"number"===typeof c.tag&&2!==xd(c)&&(c=null);if(Td.length){var d=Td.pop();d.topLevelType=a;d.nativeEvent=b;d.targetInst=c;a=d}else a={topLevelType:a,nativeEvent:b,targetInst:c,ancestors:[]};try{ec(Ud,a)}finally{a.topLevelType=null,a.nativeEvent=null,a.targetInst=null,a.ancestors.length=0,10>Td.length&&Td.push(a)}}}
2295 var $d=Object.freeze({get _enabled(){return Vd},setEnabled:Wd,isEnabled:function(){return Vd},trapBubbledEvent:W,trapCapturedEvent:Zd,dispatchEvent:Yd});function ae(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;c["ms"+a]="MS"+b;c["O"+a]="o"+b.toLowerCase();return c}
2296 var be={animationend:ae("Animation","AnimationEnd"),animationiteration:ae("Animation","AnimationIteration"),animationstart:ae("Animation","AnimationStart"),transitionend:ae("Transition","TransitionEnd")},ce={},de={};m.canUseDOM&&(de=document.createElement("div").style,"AnimationEvent"in window||(delete be.animationend.animation,delete be.animationiteration.animation,delete be.animationstart.animation),"TransitionEvent"in window||delete be.transitionend.transition);
2297 function ee(a){if(ce[a])return ce[a];if(!be[a])return a;var b=be[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in de)return ce[a]=b[c];return a}
2298 var fe={topAnimationEnd:ee("animationend"),topAnimationIteration:ee("animationiteration"),topAnimationStart:ee("animationstart"),topBlur:"blur",topCancel:"cancel",topChange:"change",topClick:"click",topClose:"close",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",
2299 topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoad:"load",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topToggle:"toggle",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",
2300 topTouchStart:"touchstart",topTransitionEnd:ee("transitionend"),topWheel:"wheel"},ge={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",
2301 topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},he={},ie=0,je="_reactListenersID"+(""+Math.random()).slice(2);function ke(a){Object.prototype.hasOwnProperty.call(a,je)||(a[je]=ie++,he[a[je]]={});return he[a[je]]}function le(a){for(;a&&a.firstChild;)a=a.firstChild;return a}
2302 function me(a,b){var c=le(a);a=0;for(var d;c;){if(3===c.nodeType){d=a+c.textContent.length;if(a<=b&&d>=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=le(c)}}function ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&"text"===a.type||"textarea"===b||"true"===a.contentEditable)}
2303 var oe=m.canUseDOM&&"documentMode"in document&&11>=document.documentMode,pe={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"topBlur topContextMenu topFocus topKeyDown topKeyUp topMouseDown topMouseUp topSelectionChange".split(" ")}},qe=null,re=null,se=null,te=!1;
2304 function ue(a,b){if(te||null==qe||qe!==fa())return null;var c=qe;"selectionStart"in c&&ne(c)?c={start:c.selectionStart,end:c.selectionEnd}:window.getSelection?(c=window.getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}):c=void 0;return se&&ha(se,c)?null:(se=c,a=N.getPooled(pe.select,re,a,b),a.type="select",a.target=qe,ib(a),a)}
2305 var ve={eventTypes:pe,extractEvents:function(a,b,c,d){var e=d.window===d?d.document:9===d.nodeType?d:d.ownerDocument,f;if(!(f=!e)){a:{e=ke(e);f=va.onSelect;for(var h=0;h<f.length;h++){var g=f[h];if(!e.hasOwnProperty(g)||!e[g]){e=!1;break a}}e=!0}f=!e}if(f)return null;e=b?Va(b):window;switch(a){case "topFocus":if(gc(e)||"true"===e.contentEditable)qe=e,re=b,se=null;break;case "topBlur":se=re=qe=null;break;case "topMouseDown":te=!0;break;case "topContextMenu":case "topMouseUp":return te=!1,ue(c,d);case "topSelectionChange":if(oe)break;
2306 case "topKeyDown":case "topKeyUp":return ue(c,d)}return null}};Na.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin TapEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));Da=bb.getFiberCurrentPropsFromNode;Ea=bb.getInstanceFromNode;Fa=bb.getNodeFromInstance;Na.injectEventPluginsByName({SimpleEventPlugin:Rd,EnterLeaveEventPlugin:wd,ChangeEventPlugin:pd,SelectEventPlugin:ve,BeforeInputEventPlugin:Rb});
2307 function xe(a,b,c,d){this.tag=a;this.key=c;this.stateNode=this.type=null;this.sibling=this.child=this["return"]=null;this.index=0;this.ref=null;this.pendingProps=b;this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.effectTag=0;this.lastEffect=this.firstEffect=this.nextEffect=null;this.expirationTime=0;this.alternate=null}
2308 function ze(a,b,c){var d=a.alternate;null===d?(d=new xe(a.tag,b,a.key,a.mode),d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.pendingProps=b,d.effectTag=0,d.nextEffect=null,d.firstEffect=null,d.lastEffect=null);d.expirationTime=c;d.child=a.child;d.memoizedProps=a.memoizedProps;d.memoizedState=a.memoizedState;d.updateQueue=a.updateQueue;d.sibling=a.sibling;d.index=a.index;d.ref=a.ref;return d}
2309 function Ae(a,b,c){var d=a.type,e=a.key;a=a.props;var f=void 0;if("function"===typeof d)f=d.prototype&&d.prototype.isReactComponent?2:0;else if("string"===typeof d)f=5;else switch(d){case sc:return Be(a.children,b,c,e);case wc:f=11;b|=3;break;case tc:f=11;b|=2;break;case pc:f=7;break;case qc:f=9;break;default:if("object"===typeof d&&null!==d)switch(d.$$typeof){case uc:f=13;break;case vc:f=12;break;case xc:f=14;break;default:if("number"===typeof d.tag)return b=d,b.pendingProps=a,b.expirationTime=c,
2310 b;D("130",null==d?d:typeof d,"")}else D("130",null==d?d:typeof d,"")}b=new xe(f,a,e,b);b.type=d;b.expirationTime=c;return b}function Be(a,b,c,d){a=new xe(10,a,d,b);a.expirationTime=c;return a}function Ce(a,b,c){a=new xe(6,a,null,b);a.expirationTime=c;return a}function De(a,b,c){b=new xe(4,null!==a.children?a.children:[],a.key,b);b.expirationTime=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}var Ee=null,Fe=null;
2311 function Ge(a){return function(b){try{return a(b)}catch(c){}}}function He(a){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var b=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(b.isDisabled||!b.supportsFiber)return!0;try{var c=b.inject(a);Ee=Ge(function(a){return b.onCommitFiberRoot(c,a)});Fe=Ge(function(a){return b.onCommitFiberUnmount(c,a)})}catch(d){}return!0}function Ie(a){"function"===typeof Ee&&Ee(a)}function Je(a){"function"===typeof Fe&&Fe(a)}new Set;
2312 function Ke(a){return{baseState:a,expirationTime:0,first:null,last:null,callbackList:null,hasForceUpdate:!1,isInitialized:!1,capturedValues:null}}function Le(a,b){null===a.last?a.first=a.last=b:(a.last.next=b,a.last=b);if(0===a.expirationTime||a.expirationTime>b.expirationTime)a.expirationTime=b.expirationTime}var Me=void 0,Ne=void 0;
2313 function Oe(a){Me=Ne=null;var b=a.alternate,c=a.updateQueue;null===c&&(c=a.updateQueue=Ke(null));null!==b?(a=b.updateQueue,null===a&&(a=b.updateQueue=Ke(null))):a=null;Me=c;Ne=a!==c?a:null}function Pe(a,b){Oe(a);a=Me;var c=Ne;null===c?Le(a,b):null===a.last||null===c.last?(Le(a,b),Le(c,b)):(Le(a,b),c.last=b)}function Qe(a,b,c,d){a=a.partialState;return"function"===typeof a?a.call(b,c,d):a}
2314 function Re(a,b,c,d,e,f){null!==a&&a.updateQueue===c&&(c=b.updateQueue={baseState:c.baseState,expirationTime:c.expirationTime,first:c.first,last:c.last,isInitialized:c.isInitialized,capturedValues:c.capturedValues,callbackList:null,hasForceUpdate:!1});c.expirationTime=0;c.isInitialized?a=c.baseState:(a=c.baseState=b.memoizedState,c.isInitialized=!0);for(var h=!0,g=c.first,k=!1;null!==g;){var v=g.expirationTime;if(v>f){var l=c.expirationTime;if(0===l||l>v)c.expirationTime=v;k||(k=!0,c.baseState=a)}else{k||
2315 (c.first=g.next,null===c.first&&(c.last=null));if(g.isReplace)a=Qe(g,d,a,e),h=!0;else if(v=Qe(g,d,a,e))a=h?A({},a,v):A(a,v),h=!1;g.isForced&&(c.hasForceUpdate=!0);null!==g.callback&&(v=c.callbackList,null===v&&(v=c.callbackList=[]),v.push(g));null!==g.capturedValue&&(v=c.capturedValues,null===v?c.capturedValues=[g.capturedValue]:v.push(g.capturedValue))}g=g.next}null!==c.callbackList?b.effectTag|=32:null!==c.first||c.hasForceUpdate||null!==c.capturedValues||(b.updateQueue=null);k||(c.baseState=a);
2316 return a}function Se(a,b){var c=a.callbackList;if(null!==c)for(a.callbackList=null,a=0;a<c.length;a++){var d=c[a],e=d.callback;d.callback=null;"function"!==typeof e?D("191",e):void 0;e.call(b)}}
2317 function Te(a,b,c,d,e){function f(a,b,c,d,e,f){if(null===b||null!==a.updateQueue&&a.updateQueue.hasForceUpdate)return!0;var n=a.stateNode;a=a.type;return"function"===typeof n.shouldComponentUpdate?n.shouldComponentUpdate(c,e,f):a.prototype&&a.prototype.isPureReactComponent?!ha(b,c)||!ha(d,e):!0}function h(a,b){b.updater=r;a.stateNode=b;b._reactInternalFiber=a}function g(a,b,c,d){a=b.state;"function"===typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d);"function"===typeof b.UNSAFE_componentWillReceiveProps&&
2318 b.UNSAFE_componentWillReceiveProps(c,d);b.state!==a&&r.enqueueReplaceState(b,b.state,null)}function k(a,b,c,d){a=a.type;if("function"===typeof a.getDerivedStateFromProps)return a.getDerivedStateFromProps.call(null,c,d)}var v=a.cacheContext,l=a.getMaskedContext,p=a.getUnmaskedContext,z=a.isContextConsumer,B=a.hasContextChanged,r={isMounted:yd,enqueueSetState:function(a,d,e){a=a._reactInternalFiber;e=void 0===e?null:e;var f=c(a);Pe(a,{expirationTime:f,partialState:d,callback:e,isReplace:!1,isForced:!1,
2319 capturedValue:null,next:null});b(a,f)},enqueueReplaceState:function(a,d,e){a=a._reactInternalFiber;e=void 0===e?null:e;var f=c(a);Pe(a,{expirationTime:f,partialState:d,callback:e,isReplace:!0,isForced:!1,capturedValue:null,next:null});b(a,f)},enqueueForceUpdate:function(a,d){a=a._reactInternalFiber;d=void 0===d?null:d;var e=c(a);Pe(a,{expirationTime:e,partialState:null,callback:d,isReplace:!1,isForced:!0,capturedValue:null,next:null});b(a,e)}};return{adoptClassInstance:h,callGetDerivedStateFromProps:k,
2320 constructClassInstance:function(a,b){var c=a.type,d=p(a),e=z(a),f=e?l(a,d):ka;c=new c(b,f);var n=null!==c.state&&void 0!==c.state?c.state:null;h(a,c);a.memoizedState=n;b=k(a,c,b,n);null!==b&&void 0!==b&&(a.memoizedState=A({},a.memoizedState,b));e&&v(a,d,f);return c},mountClassInstance:function(a,b){var c=a.type,d=a.alternate,e=a.stateNode,f=a.pendingProps,n=p(a);e.props=f;e.state=a.memoizedState;e.refs=ka;e.context=l(a,n);"function"===typeof c.getDerivedStateFromProps||"function"===typeof e.getSnapshotBeforeUpdate||
2321 "function"!==typeof e.UNSAFE_componentWillMount&&"function"!==typeof e.componentWillMount||(c=e.state,"function"===typeof e.componentWillMount&&e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),c!==e.state&&r.enqueueReplaceState(e,e.state,null),c=a.updateQueue,null!==c&&(e.state=Re(d,a,c,e,f,b)));"function"===typeof e.componentDidMount&&(a.effectTag|=4)},resumeMountClassInstance:function(a,b){var c=a.type,n=a.stateNode;n.props=a.memoizedProps;n.state=
2322 a.memoizedState;var h=a.memoizedProps,r=a.pendingProps,z=n.context,q=p(a);q=l(a,q);(c="function"===typeof c.getDerivedStateFromProps||"function"===typeof n.getSnapshotBeforeUpdate)||"function"!==typeof n.UNSAFE_componentWillReceiveProps&&"function"!==typeof n.componentWillReceiveProps||(h!==r||z!==q)&&g(a,n,r,q);z=a.memoizedState;b=null!==a.updateQueue?Re(null,a,a.updateQueue,n,r,b):z;var u=void 0;h!==r&&(u=k(a,n,r,b));if(null!==u&&void 0!==u){b=null===b||void 0===b?u:A({},b,u);var t=a.updateQueue;
2323 null!==t&&(t.baseState=A({},t.baseState,u))}if(!(h!==r||z!==b||B()||null!==a.updateQueue&&a.updateQueue.hasForceUpdate))return"function"===typeof n.componentDidMount&&(a.effectTag|=4),!1;(h=f(a,h,r,z,b,q))?(c||"function"!==typeof n.UNSAFE_componentWillMount&&"function"!==typeof n.componentWillMount||("function"===typeof n.componentWillMount&&n.componentWillMount(),"function"===typeof n.UNSAFE_componentWillMount&&n.UNSAFE_componentWillMount()),"function"===typeof n.componentDidMount&&(a.effectTag|=
2324 4)):("function"===typeof n.componentDidMount&&(a.effectTag|=4),d(a,r),e(a,b));n.props=r;n.state=b;n.context=q;return h},updateClassInstance:function(a,b,c){var n=b.type,x=b.stateNode;x.props=b.memoizedProps;x.state=b.memoizedState;var h=b.memoizedProps,r=b.pendingProps,q=x.context,u=p(b);u=l(b,u);(n="function"===typeof n.getDerivedStateFromProps||"function"===typeof x.getSnapshotBeforeUpdate)||"function"!==typeof x.UNSAFE_componentWillReceiveProps&&"function"!==typeof x.componentWillReceiveProps||
2325 (h!==r||q!==u)&&g(b,x,r,u);q=b.memoizedState;c=null!==b.updateQueue?Re(a,b,b.updateQueue,x,r,c):q;var t=void 0;h!==r&&(t=k(b,x,r,c));if(null!==t&&void 0!==t){c=null===c||void 0===c?t:A({},c,t);var y=b.updateQueue;null!==y&&(y.baseState=A({},y.baseState,t))}if(!(h!==r||q!==c||B()||null!==b.updateQueue&&b.updateQueue.hasForceUpdate))return"function"!==typeof x.componentDidUpdate||h===a.memoizedProps&&q===a.memoizedState||(b.effectTag|=4),"function"!==typeof x.getSnapshotBeforeUpdate||h===a.memoizedProps&&
2326 q===a.memoizedState||(b.effectTag|=2048),!1;(t=f(b,h,r,q,c,u))?(n||"function"!==typeof x.UNSAFE_componentWillUpdate&&"function"!==typeof x.componentWillUpdate||("function"===typeof x.componentWillUpdate&&x.componentWillUpdate(r,c,u),"function"===typeof x.UNSAFE_componentWillUpdate&&x.UNSAFE_componentWillUpdate(r,c,u)),"function"===typeof x.componentDidUpdate&&(b.effectTag|=4),"function"===typeof x.getSnapshotBeforeUpdate&&(b.effectTag|=2048)):("function"!==typeof x.componentDidUpdate||h===a.memoizedProps&&
2327 q===a.memoizedState||(b.effectTag|=4),"function"!==typeof x.getSnapshotBeforeUpdate||h===a.memoizedProps&&q===a.memoizedState||(b.effectTag|=2048),d(b,r),e(b,c));x.props=r;x.state=c;x.context=u;return t}}}var Ue=Array.isArray;
2328 function Ve(a,b,c){a=c.ref;if(null!==a&&"function"!==typeof a&&"object"!==typeof a){if(c._owner){c=c._owner;var d=void 0;c&&(2!==c.tag?D("110"):void 0,d=c.stateNode);d?void 0:D("147",a);var e=""+a;if(null!==b&&null!==b.ref&&b.ref._stringRef===e)return b.ref;b=function(a){var b=d.refs===ka?d.refs={}:d.refs;null===a?delete b[e]:b[e]=a};b._stringRef=e;return b}"string"!==typeof a?D("148"):void 0;c._owner?void 0:D("254",a)}return a}
2329 function We(a,b){"textarea"!==a.type&&D("31","[object Object]"===Object.prototype.toString.call(b)?"object with keys {"+Object.keys(b).join(", ")+"}":b,"")}
2330 function Xe(a){function b(b,c){if(a){var d=b.lastEffect;null!==d?(d.nextEffect=c,b.lastEffect=c):b.firstEffect=b.lastEffect=c;c.nextEffect=null;c.effectTag=8}}function c(c,d){if(!a)return null;for(;null!==d;)b(c,d),d=d.sibling;return null}function d(a,b){for(a=new Map;null!==b;)null!==b.key?a.set(b.key,b):a.set(b.index,b),b=b.sibling;return a}function e(a,b,c){a=ze(a,b,c);a.index=0;a.sibling=null;return a}function f(b,c,d){b.index=d;if(!a)return c;d=b.alternate;if(null!==d)return d=d.index,d<c?(b.effectTag=
2331 2,c):d;b.effectTag=2;return c}function h(b){a&&null===b.alternate&&(b.effectTag=2);return b}function g(a,b,c,d){if(null===b||6!==b.tag)return b=Ce(c,a.mode,d),b["return"]=a,b;b=e(b,c,d);b["return"]=a;return b}function k(a,b,c,d){if(null!==b&&b.type===c.type)return d=e(b,c.props,d),d.ref=Ve(a,b,c),d["return"]=a,d;d=Ae(c,a.mode,d);d.ref=Ve(a,b,c);d["return"]=a;return d}function v(a,b,c,d){if(null===b||4!==b.tag||b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==c.implementation)return b=
2332 De(c,a.mode,d),b["return"]=a,b;b=e(b,c.children||[],d);b["return"]=a;return b}function l(a,b,c,d,f){if(null===b||10!==b.tag)return b=Be(c,a.mode,d,f),b["return"]=a,b;b=e(b,c,d);b["return"]=a;return b}function p(a,b,c){if("string"===typeof b||"number"===typeof b)return b=Ce(""+b,a.mode,c),b["return"]=a,b;if("object"===typeof b&&null!==b){switch(b.$$typeof){case oc:return c=Ae(b,a.mode,c),c.ref=Ve(a,null,b),c["return"]=a,c;case rc:return b=De(b,a.mode,c),b["return"]=a,b}if(Ue(b)||zc(b))return b=Be(b,
2333 a.mode,c,null),b["return"]=a,b;We(a,b)}return null}function z(a,b,c,d){var e=null!==b?b.key:null;if("string"===typeof c||"number"===typeof c)return null!==e?null:g(a,b,""+c,d);if("object"===typeof c&&null!==c){switch(c.$$typeof){case oc:return c.key===e?c.type===sc?l(a,b,c.props.children,d,e):k(a,b,c,d):null;case rc:return c.key===e?v(a,b,c,d):null}if(Ue(c)||zc(c))return null!==e?null:l(a,b,c,d,null);We(a,c)}return null}function B(a,b,c,d,e){if("string"===typeof d||"number"===typeof d)return a=a.get(c)||
2334 null,g(b,a,""+d,e);if("object"===typeof d&&null!==d){switch(d.$$typeof){case oc:return a=a.get(null===d.key?c:d.key)||null,d.type===sc?l(b,a,d.props.children,e,d.key):k(b,a,d,e);case rc:return a=a.get(null===d.key?c:d.key)||null,v(b,a,d,e)}if(Ue(d)||zc(d))return a=a.get(c)||null,l(b,a,d,e,null);We(b,d)}return null}function r(e,l,g,h){for(var r=null,k=null,q=l,u=l=0,t=null;null!==q&&u<g.length;u++){q.index>u?(t=q,q=null):t=q.sibling;var n=z(e,q,g[u],h);if(null===n){null===q&&(q=t);break}a&&q&&null===
2335 n.alternate&&b(e,q);l=f(n,l,u);null===k?r=n:k.sibling=n;k=n;q=t}if(u===g.length)return c(e,q),r;if(null===q){for(;u<g.length;u++)if(q=p(e,g[u],h))l=f(q,l,u),null===k?r=q:k.sibling=q,k=q;return r}for(q=d(e,q);u<g.length;u++)if(t=B(q,e,u,g[u],h)){if(a&&null!==t.alternate)q["delete"](null===t.key?u:t.key);l=f(t,l,u);null===k?r=t:k.sibling=t;k=t}a&&q.forEach(function(a){return b(e,a)});return r}function Q(e,l,g,h){var r=zc(g);"function"!==typeof r?D("150"):void 0;g=r.call(g);null==g?D("151"):void 0;for(var k=
2336 r=null,q=l,u=l=0,t=null,n=g.next();null!==q&&!n.done;u++,n=g.next()){q.index>u?(t=q,q=null):t=q.sibling;var H=z(e,q,n.value,h);if(null===H){q||(q=t);break}a&&q&&null===H.alternate&&b(e,q);l=f(H,l,u);null===k?r=H:k.sibling=H;k=H;q=t}if(n.done)return c(e,q),r;if(null===q){for(;!n.done;u++,n=g.next())n=p(e,n.value,h),null!==n&&(l=f(n,l,u),null===k?r=n:k.sibling=n,k=n);return r}for(q=d(e,q);!n.done;u++,n=g.next())if(n=B(q,e,u,n.value,h),null!==n){if(a&&null!==n.alternate)q["delete"](null===n.key?u:n.key);
2337 l=f(n,l,u);null===k?r=n:k.sibling=n;k=n}a&&q.forEach(function(a){return b(e,a)});return r}return function(a,d,f,l){"object"===typeof f&&null!==f&&f.type===sc&&null===f.key&&(f=f.props.children);var g="object"===typeof f&&null!==f;if(g)switch(f.$$typeof){case oc:a:{var k=f.key;for(g=d;null!==g;){if(g.key===k)if(10===g.tag?f.type===sc:g.type===f.type){c(a,g.sibling);d=e(g,f.type===sc?f.props.children:f.props,l);d.ref=Ve(a,g,f);d["return"]=a;a=d;break a}else{c(a,g);break}else b(a,g);g=g.sibling}f.type===
2338 sc?(d=Be(f.props.children,a.mode,l,f.key),d["return"]=a,a=d):(l=Ae(f,a.mode,l),l.ref=Ve(a,d,f),l["return"]=a,a=l)}return h(a);case rc:a:{for(g=f.key;null!==d;){if(d.key===g)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[],l);d["return"]=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=De(f,a.mode,l);d["return"]=a;a=d}return h(a)}if("string"===typeof f||"number"===typeof f)return f=""+f,null!==d&&
2339 6===d.tag?(c(a,d.sibling),d=e(d,f,l),d["return"]=a,a=d):(c(a,d),d=Ce(f,a.mode,l),d["return"]=a,a=d),h(a);if(Ue(f))return r(a,d,f,l);if(zc(f))return Q(a,d,f,l);g&&We(a,f);if("undefined"===typeof f)switch(a.tag){case 2:case 1:l=a.type,D("152",l.displayName||l.name||"Component")}return c(a,d)}}var Ye=Xe(!0),Ze=Xe(!1);
2340 function $e(a,b,c,d,e,f,h){function g(a,b,c){k(a,b,c,b.expirationTime)}function k(a,b,c,d){b.child=null===a?Ze(b,null,c,d):Ye(b,a.child,c,d)}function v(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.effectTag|=128}function l(a,b,c,d,e,f){v(a,b);if(!c&&!e)return d&&y(b,!1),r(a,b);c=b.stateNode;nc.current=b;var l=e?null:c.render();b.effectTag|=1;e&&(k(a,b,null,f),b.child=null);k(a,b,l,f);b.memoizedState=c.state;b.memoizedProps=c.props;d&&y(b,!0);return b.child}function p(a){var b=a.stateNode;
2341 b.pendingContext?t(a,b.pendingContext,b.pendingContext!==b.context):b.context&&t(a,b.context,!1);Y(a,b.containerInfo)}function z(a,b,c,d){var e=a.child;for(null!==e&&(e["return"]=a);null!==e;){switch(e.tag){case 12:var f=e.stateNode|0;if(e.type===b&&0!==(f&c)){for(f=e;null!==f;){var l=f.alternate;if(0===f.expirationTime||f.expirationTime>d)f.expirationTime=d,null!==l&&(0===l.expirationTime||l.expirationTime>d)&&(l.expirationTime=d);else if(null!==l&&(0===l.expirationTime||l.expirationTime>d))l.expirationTime=
2342 d;else break;f=f["return"]}f=null}else f=e.child;break;case 13:f=e.type===a.type?null:e.child;break;default:f=e.child}if(null!==f)f["return"]=e;else for(f=e;null!==f;){if(f===a){f=null;break}e=f.sibling;if(null!==e){f=e;break}f=f["return"]}e=f}}function B(a,b,c){var d=b.type._context,e=b.pendingProps,f=b.memoizedProps;if(!q()&&f===e)return b.stateNode=0,G(b),r(a,b);var l=e.value;b.memoizedProps=e;if(null===f)l=1073741823;else if(f.value===e.value){if(f.children===e.children)return b.stateNode=0,G(b),
2343 r(a,b);l=0}else{var h=f.value;if(h===l&&(0!==h||1/h===1/l)||h!==h&&l!==l){if(f.children===e.children)return b.stateNode=0,G(b),r(a,b);l=0}else if(l="function"===typeof d._calculateChangedBits?d._calculateChangedBits(h,l):1073741823,l|=0,0===l){if(f.children===e.children)return b.stateNode=0,G(b),r(a,b)}else z(b,d,l,c)}b.stateNode=l;G(b);g(a,b,e.children);return b.child}function r(a,b){null!==a&&b.child!==a.child?D("153"):void 0;if(null!==b.child){a=b.child;var c=ze(a,a.pendingProps,a.expirationTime);
2344 b.child=c;for(c["return"]=b;null!==a.sibling;)a=a.sibling,c=c.sibling=ze(a,a.pendingProps,a.expirationTime),c["return"]=b;c.sibling=null}return b.child}var Q=a.shouldSetTextContent,n=a.shouldDeprioritizeSubtree,x=b.pushHostContext,Y=b.pushHostContainer,G=d.pushProvider,R=c.getMaskedContext,S=c.getUnmaskedContext,q=c.hasContextChanged,u=c.pushContextProvider,t=c.pushTopLevelContextObject,y=c.invalidateContextProvider,H=e.enterHydrationState,Wa=e.resetHydrationState,Cb=e.tryToClaimNextHydratableInstance;
2345 a=Te(c,f,h,function(a,b){a.memoizedProps=b},function(a,b){a.memoizedState=b});var Jc=a.adoptClassInstance,Kc=a.callGetDerivedStateFromProps,Lc=a.constructClassInstance,Db=a.mountClassInstance,Mc=a.resumeMountClassInstance,Eb=a.updateClassInstance;return{beginWork:function(a,b,c){if(0===b.expirationTime||b.expirationTime>c){switch(b.tag){case 3:p(b);break;case 2:u(b);break;case 4:Y(b,b.stateNode.containerInfo);break;case 13:G(b)}return null}switch(b.tag){case 0:null!==a?D("155"):void 0;var d=b.type,
2346 e=b.pendingProps,f=S(b);f=R(b,f);d=d(e,f);b.effectTag|=1;"object"===typeof d&&null!==d&&"function"===typeof d.render&&void 0===d.$$typeof?(f=b.type,b.tag=2,b.memoizedState=null!==d.state&&void 0!==d.state?d.state:null,"function"===typeof f.getDerivedStateFromProps&&(e=Kc(b,d,e,b.memoizedState),null!==e&&void 0!==e&&(b.memoizedState=A({},b.memoizedState,e))),e=u(b),Jc(b,d),Db(b,c),a=l(a,b,!0,e,!1,c)):(b.tag=1,g(a,b,d),b.memoizedProps=e,a=b.child);return a;case 1:return e=b.type,c=b.pendingProps,q()||
2347 b.memoizedProps!==c?(d=S(b),d=R(b,d),e=e(c,d),b.effectTag|=1,g(a,b,e),b.memoizedProps=c,a=b.child):a=r(a,b),a;case 2:e=u(b);null===a?null===b.stateNode?(Lc(b,b.pendingProps),Db(b,c),d=!0):d=Mc(b,c):d=Eb(a,b,c);f=!1;var h=b.updateQueue;null!==h&&null!==h.capturedValues&&(f=d=!0);return l(a,b,d,e,f,c);case 3:a:if(p(b),d=b.updateQueue,null!==d){f=b.memoizedState;e=Re(a,b,d,null,null,c);b.memoizedState=e;d=b.updateQueue;if(null!==d&&null!==d.capturedValues)d=null;else if(f===e){Wa();a=r(a,b);break a}else d=
2348 e.element;f=b.stateNode;(null===a||null===a.child)&&f.hydrate&&H(b)?(b.effectTag|=2,b.child=Ze(b,null,d,c)):(Wa(),g(a,b,d));b.memoizedState=e;a=b.child}else Wa(),a=r(a,b);return a;case 5:a:{x(b);null===a&&Cb(b);e=b.type;h=b.memoizedProps;d=b.pendingProps;f=null!==a?a.memoizedProps:null;if(!q()&&h===d){if(h=b.mode&1&&n(e,d))b.expirationTime=1073741823;if(!h||1073741823!==c){a=r(a,b);break a}}h=d.children;Q(e,d)?h=null:f&&Q(e,f)&&(b.effectTag|=16);v(a,b);1073741823!==c&&b.mode&1&&n(e,d)?(b.expirationTime=
2349 1073741823,b.memoizedProps=d,a=null):(g(a,b,h),b.memoizedProps=d,a=b.child)}return a;case 6:return null===a&&Cb(b),b.memoizedProps=b.pendingProps,null;case 8:b.tag=7;case 7:return e=b.pendingProps,q()||b.memoizedProps!==e||(e=b.memoizedProps),d=e.children,b.stateNode=null===a?Ze(b,b.stateNode,d,c):Ye(b,a.stateNode,d,c),b.memoizedProps=e,b.stateNode;case 9:return null;case 4:return Y(b,b.stateNode.containerInfo),e=b.pendingProps,q()||b.memoizedProps!==e?(null===a?b.child=Ye(b,null,e,c):g(a,b,e),b.memoizedProps=
2350 e,a=b.child):a=r(a,b),a;case 14:return c=b.type.render,c=c(b.pendingProps,b.ref),g(a,b,c),b.memoizedProps=c,b.child;case 10:return c=b.pendingProps,q()||b.memoizedProps!==c?(g(a,b,c),b.memoizedProps=c,a=b.child):a=r(a,b),a;case 11:return c=b.pendingProps.children,q()||null!==c&&b.memoizedProps!==c?(g(a,b,c),b.memoizedProps=c,a=b.child):a=r(a,b),a;case 13:return B(a,b,c);case 12:a:{d=b.type;f=b.pendingProps;h=b.memoizedProps;e=d._currentValue;var t=d._changedBits;if(q()||0!==t||h!==f){b.memoizedProps=
2351 f;var k=f.unstable_observedBits;if(void 0===k||null===k)k=1073741823;b.stateNode=k;if(0!==(t&k))z(b,d,t,c);else if(h===f){a=r(a,b);break a}c=f.children;c=c(e);g(a,b,c);a=b.child}else a=r(a,b)}return a;default:D("156")}}}}
2352 function af(a,b,c,d,e){function f(a){a.effectTag|=4}var h=a.createInstance,g=a.createTextInstance,k=a.appendInitialChild,v=a.finalizeInitialChildren,l=a.prepareUpdate,p=a.persistence,z=b.getRootHostContainer,B=b.popHostContext,r=b.getHostContext,Q=b.popHostContainer,n=c.popContextProvider,x=c.popTopLevelContextObject,Y=d.popProvider,G=e.prepareToHydrateHostInstance,R=e.prepareToHydrateHostTextInstance,S=e.popHydrationState,q=void 0,u=void 0,t=void 0;a.mutation?(q=function(){},u=function(a,b,c){(b.updateQueue=
2353 c)&&f(b)},t=function(a,b,c,d){c!==d&&f(b)}):p?D("235"):D("236");return{completeWork:function(a,b,c){var d=b.pendingProps;switch(b.tag){case 1:return null;case 2:return n(b),a=b.stateNode,d=b.updateQueue,null!==d&&null!==d.capturedValues&&(b.effectTag&=-65,"function"===typeof a.componentDidCatch?b.effectTag|=256:d.capturedValues=null),null;case 3:Q(b);x(b);d=b.stateNode;d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null);if(null===a||null===a.child)S(b),b.effectTag&=-3;q(b);a=b.updateQueue;
2354 null!==a&&null!==a.capturedValues&&(b.effectTag|=256);return null;case 5:B(b);c=z();var e=b.type;if(null!==a&&null!=b.stateNode){var p=a.memoizedProps,H=b.stateNode,y=r();H=l(H,e,p,d,c,y);u(a,b,H,e,p,d,c,y);a.ref!==b.ref&&(b.effectTag|=128)}else{if(!d)return null===b.stateNode?D("166"):void 0,null;a=r();if(S(b))G(b,c,a)&&f(b);else{p=h(e,d,c,a,b);a:for(y=b.child;null!==y;){if(5===y.tag||6===y.tag)k(p,y.stateNode);else if(4!==y.tag&&null!==y.child){y.child["return"]=y;y=y.child;continue}if(y===b)break;
2355 for(;null===y.sibling;){if(null===y["return"]||y["return"]===b)break a;y=y["return"]}y.sibling["return"]=y["return"];y=y.sibling}v(p,e,d,c,a)&&f(b);b.stateNode=p}null!==b.ref&&(b.effectTag|=128)}return null;case 6:if(a&&null!=b.stateNode)t(a,b,a.memoizedProps,d);else{if("string"!==typeof d)return null===b.stateNode?D("166"):void 0,null;a=z();c=r();S(b)?R(b)&&f(b):b.stateNode=g(d,a,c,b)}return null;case 7:(d=b.memoizedProps)?void 0:D("165");b.tag=8;e=[];a:for((p=b.stateNode)&&(p["return"]=b);null!==
2356 p;){if(5===p.tag||6===p.tag||4===p.tag)D("247");else if(9===p.tag)e.push(p.pendingProps.value);else if(null!==p.child){p.child["return"]=p;p=p.child;continue}for(;null===p.sibling;){if(null===p["return"]||p["return"]===b)break a;p=p["return"]}p.sibling["return"]=p["return"];p=p.sibling}p=d.handler;d=p(d.props,e);b.child=Ye(b,null!==a?a.child:null,d,c);return b.child;case 8:return b.tag=7,null;case 9:return null;case 14:return null;case 10:return null;case 11:return null;case 4:return Q(b),q(b),null;
2357 case 13:return Y(b),null;case 12:return null;case 0:D("167");default:D("156")}}}}
2358 function bf(a,b,c,d,e){var f=a.popHostContainer,h=a.popHostContext,g=b.popContextProvider,k=b.popTopLevelContextObject,v=c.popProvider;return{throwException:function(a,b,c){b.effectTag|=512;b.firstEffect=b.lastEffect=null;b={value:c,source:b,stack:Bc(b)};do{switch(a.tag){case 3:Oe(a);a.updateQueue.capturedValues=[b];a.effectTag|=1024;return;case 2:if(c=a.stateNode,0===(a.effectTag&64)&&null!==c&&"function"===typeof c.componentDidCatch&&!e(c)){Oe(a);c=a.updateQueue;var d=c.capturedValues;null===d?
2359 c.capturedValues=[b]:d.push(b);a.effectTag|=1024;return}}a=a["return"]}while(null!==a)},unwindWork:function(a){switch(a.tag){case 2:g(a);var b=a.effectTag;return b&1024?(a.effectTag=b&-1025|64,a):null;case 3:return f(a),k(a),b=a.effectTag,b&1024?(a.effectTag=b&-1025|64,a):null;case 5:return h(a),null;case 4:return f(a),null;case 13:return v(a),null;default:return null}},unwindInterruptedWork:function(a){switch(a.tag){case 2:g(a);break;case 3:f(a);k(a);break;case 5:h(a);break;case 4:f(a);break;case 13:v(a)}}}}
2360 function cf(a,b){var c=b.source;null===b.stack&&Bc(c);null!==c&&Ac(c);b=b.value;null!==a&&2===a.tag&&Ac(a);try{b&&b.suppressReactErrorLogging||console.error(b)}catch(d){d&&d.suppressReactErrorLogging||console.error(d)}}
2361 function df(a,b,c,d,e){function f(a){var c=a.ref;if(null!==c)if("function"===typeof c)try{c(null)}catch(t){b(a,t)}else c.current=null}function h(a){"function"===typeof Je&&Je(a);switch(a.tag){case 2:f(a);var c=a.stateNode;if("function"===typeof c.componentWillUnmount)try{c.props=a.memoizedProps,c.state=a.memoizedState,c.componentWillUnmount()}catch(t){b(a,t)}break;case 5:f(a);break;case 7:g(a.stateNode);break;case 4:p&&v(a)}}function g(a){for(var b=a;;)if(h(b),null===b.child||p&&4===b.tag){if(b===
2362 a)break;for(;null===b.sibling;){if(null===b["return"]||b["return"]===a)return;b=b["return"]}b.sibling["return"]=b["return"];b=b.sibling}else b.child["return"]=b,b=b.child}function k(a){return 5===a.tag||3===a.tag||4===a.tag}function v(a){for(var b=a,c=!1,d=void 0,e=void 0;;){if(!c){c=b["return"];a:for(;;){null===c?D("160"):void 0;switch(c.tag){case 5:d=c.stateNode;e=!1;break a;case 3:d=c.stateNode.containerInfo;e=!0;break a;case 4:d=c.stateNode.containerInfo;e=!0;break a}c=c["return"]}c=!0}if(5===
2363 b.tag||6===b.tag)g(b),e?S(d,b.stateNode):R(d,b.stateNode);else if(4===b.tag?d=b.stateNode.containerInfo:h(b),null!==b.child){b.child["return"]=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b["return"]||b["return"]===a)return;b=b["return"];4===b.tag&&(c=!1)}b.sibling["return"]=b["return"];b=b.sibling}}var l=a.getPublicInstance,p=a.mutation;a=a.persistence;p||(a?D("235"):D("236"));var z=p.commitMount,B=p.commitUpdate,r=p.resetTextContent,Q=p.commitTextUpdate,n=p.appendChild,
2364 x=p.appendChildToContainer,Y=p.insertBefore,G=p.insertInContainerBefore,R=p.removeChild,S=p.removeChildFromContainer;return{commitBeforeMutationLifeCycles:function(a,b){switch(b.tag){case 2:if(b.effectTag&2048&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;a.props=b.memoizedProps;a.state=b.memoizedState;b=a.getSnapshotBeforeUpdate(c,d);a.__reactInternalSnapshotBeforeUpdate=b}break;case 3:case 5:case 6:case 4:break;default:D("163")}},commitResetTextContent:function(a){r(a.stateNode)},
2365 commitPlacement:function(a){a:{for(var b=a["return"];null!==b;){if(k(b)){var c=b;break a}b=b["return"]}D("160");c=void 0}var d=b=void 0;switch(c.tag){case 5:b=c.stateNode;d=!1;break;case 3:b=c.stateNode.containerInfo;d=!0;break;case 4:b=c.stateNode.containerInfo;d=!0;break;default:D("161")}c.effectTag&16&&(r(b),c.effectTag&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c["return"]||k(c["return"])){c=null;break a}c=c["return"]}c.sibling["return"]=c["return"];for(c=c.sibling;5!==c.tag&&6!==
2366 c.tag;){if(c.effectTag&2)continue b;if(null===c.child||4===c.tag)continue b;else c.child["return"]=c,c=c.child}if(!(c.effectTag&2)){c=c.stateNode;break a}}for(var e=a;;){if(5===e.tag||6===e.tag)c?d?G(b,e.stateNode,c):Y(b,e.stateNode,c):d?x(b,e.stateNode):n(b,e.stateNode);else if(4!==e.tag&&null!==e.child){e.child["return"]=e;e=e.child;continue}if(e===a)break;for(;null===e.sibling;){if(null===e["return"]||e["return"]===a)return;e=e["return"]}e.sibling["return"]=e["return"];e=e.sibling}},commitDeletion:function(a){v(a);
2367 a["return"]=null;a.child=null;a.alternate&&(a.alternate.child=null,a.alternate["return"]=null)},commitWork:function(a,b){switch(b.tag){case 2:break;case 5:var c=b.stateNode;if(null!=c){var d=b.memoizedProps;a=null!==a?a.memoizedProps:d;var e=b.type,f=b.updateQueue;b.updateQueue=null;null!==f&&B(c,f,e,a,d,b)}break;case 6:null===b.stateNode?D("162"):void 0;c=b.memoizedProps;Q(b.stateNode,null!==a?a.memoizedProps:c,c);break;case 3:break;default:D("163")}},commitLifeCycles:function(a,b,c){switch(c.tag){case 2:a=
2368 c.stateNode;if(c.effectTag&4)if(null===b)a.props=c.memoizedProps,a.state=c.memoizedState,a.componentDidMount();else{var d=b.memoizedProps;b=b.memoizedState;a.props=c.memoizedProps;a.state=c.memoizedState;a.componentDidUpdate(d,b,a.__reactInternalSnapshotBeforeUpdate)}c=c.updateQueue;null!==c&&Se(c,a);break;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=l(c.child.stateNode);break;case 2:a=c.child.stateNode}Se(b,a)}break;case 5:a=c.stateNode;null===b&&c.effectTag&
2369 4&&z(a,c.type,c.memoizedProps,c);break;case 6:break;case 4:break;default:D("163")}},commitErrorLogging:function(a,b){switch(a.tag){case 2:var c=a.type;b=a.stateNode;var d=a.updateQueue;null===d||null===d.capturedValues?D("264"):void 0;var f=d.capturedValues;d.capturedValues=null;"function"!==typeof c.getDerivedStateFromCatch&&e(b);b.props=a.memoizedProps;b.state=a.memoizedState;for(c=0;c<f.length;c++){d=f[c];var l=d.value,g=d.stack;cf(a,d);b.componentDidCatch(l,{componentStack:null!==g?g:""})}break;
2370 case 3:c=a.updateQueue;null===c||null===c.capturedValues?D("264"):void 0;f=c.capturedValues;c.capturedValues=null;for(c=0;c<f.length;c++)d=f[c],cf(a,d),b(d.value);break;default:D("265")}},commitAttachRef:function(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=l(c);break;default:a=c}"function"===typeof b?b(a):b.current=a}},commitDetachRef:function(a){a=a.ref;null!==a&&("function"===typeof a?a(null):a.current=null)}}}var ef={};
2371 function ff(a,b){function c(a){a===ef?D("174"):void 0;return a}var d=a.getChildHostContext,e=a.getRootHostContext;a=b.createCursor;var f=b.push,h=b.pop,g=a(ef),k=a(ef),v=a(ef);return{getHostContext:function(){return c(g.current)},getRootHostContainer:function(){return c(v.current)},popHostContainer:function(a){h(g,a);h(k,a);h(v,a)},popHostContext:function(a){k.current===a&&(h(g,a),h(k,a))},pushHostContainer:function(a,b){f(v,b,a);f(k,a,a);f(g,ef,a);b=e(b);h(g,a);f(g,b,a)},pushHostContext:function(a){var b=
2372 c(v.current),e=c(g.current);b=d(e,a.type,b);e!==b&&(f(k,a,a),f(g,b,a))}}}
2373 function gf(a){function b(a,b){var c=new xe(5,null,null,0);c.type="DELETED";c.stateNode=b;c["return"]=a;c.effectTag=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c}function c(a,b){switch(a.tag){case 5:return b=f(b,a.type,a.pendingProps),null!==b?(a.stateNode=b,!0):!1;case 6:return b=h(b,a.pendingProps),null!==b?(a.stateNode=b,!0):!1;default:return!1}}function d(a){for(a=a["return"];null!==a&&5!==a.tag&&3!==a.tag;)a=a["return"];p=a}var e=a.shouldSetTextContent;
2374 a=a.hydration;if(!a)return{enterHydrationState:function(){return!1},resetHydrationState:function(){},tryToClaimNextHydratableInstance:function(){},prepareToHydrateHostInstance:function(){D("175")},prepareToHydrateHostTextInstance:function(){D("176")},popHydrationState:function(){return!1}};var f=a.canHydrateInstance,h=a.canHydrateTextInstance,g=a.getNextHydratableSibling,k=a.getFirstHydratableChild,v=a.hydrateInstance,l=a.hydrateTextInstance,p=null,z=null,B=!1;return{enterHydrationState:function(a){z=
2375 k(a.stateNode.containerInfo);p=a;return B=!0},resetHydrationState:function(){z=p=null;B=!1},tryToClaimNextHydratableInstance:function(a){if(B){var d=z;if(d){if(!c(a,d)){d=g(d);if(!d||!c(a,d)){a.effectTag|=2;B=!1;p=a;return}b(p,z)}p=a;z=k(d)}else a.effectTag|=2,B=!1,p=a}},prepareToHydrateHostInstance:function(a,b,c){b=v(a.stateNode,a.type,a.memoizedProps,b,c,a);a.updateQueue=b;return null!==b?!0:!1},prepareToHydrateHostTextInstance:function(a){return l(a.stateNode,a.memoizedProps,a)},popHydrationState:function(a){if(a!==
2376 p)return!1;if(!B)return d(a),B=!0,!1;var c=a.type;if(5!==a.tag||"head"!==c&&"body"!==c&&!e(c,a.memoizedProps))for(c=z;c;)b(a,c),c=g(c);d(a);z=p?g(a.stateNode):null;return!0}}}
2377 function hf(a){function b(a,b,c){a=a.stateNode;a.__reactInternalMemoizedUnmaskedChildContext=b;a.__reactInternalMemoizedMaskedChildContext=c}function c(a){return 2===a.tag&&null!=a.type.childContextTypes}function d(a,b){var c=a.stateNode,d=a.type.childContextTypes;if("function"!==typeof c.getChildContext)return b;c=c.getChildContext();for(var e in c)e in d?void 0:D("108",Ac(a)||"Unknown",e);return A({},b,c)}var e=a.createCursor,f=a.push,h=a.pop,g=e(ka),k=e(!1),v=ka;return{getUnmaskedContext:function(a){return c(a)?
2378 v:g.current},cacheContext:b,getMaskedContext:function(a,c){var d=a.type.contextTypes;if(!d)return ka;var e=a.stateNode;if(e&&e.__reactInternalMemoizedUnmaskedChildContext===c)return e.__reactInternalMemoizedMaskedChildContext;var f={},g;for(g in d)f[g]=c[g];e&&b(a,c,f);return f},hasContextChanged:function(){return k.current},isContextConsumer:function(a){return 2===a.tag&&null!=a.type.contextTypes},isContextProvider:c,popContextProvider:function(a){c(a)&&(h(k,a),h(g,a))},popTopLevelContextObject:function(a){h(k,
2379 a);h(g,a)},pushTopLevelContextObject:function(a,b,c){null!=g.cursor?D("168"):void 0;f(g,b,a);f(k,c,a)},processChildContext:d,pushContextProvider:function(a){if(!c(a))return!1;var b=a.stateNode;b=b&&b.__reactInternalMemoizedMergedChildContext||ka;v=g.current;f(g,b,a);f(k,k.current,a);return!0},invalidateContextProvider:function(a,b){var c=a.stateNode;c?void 0:D("169");if(b){var e=d(a,v);c.__reactInternalMemoizedMergedChildContext=e;h(k,a);h(g,a);f(g,e,a)}else h(k,a);f(k,b,a)},findCurrentUnmaskedContext:function(a){for(2!==
2380 xd(a)||2!==a.tag?D("170"):void 0;3!==a.tag;){if(c(a))return a.stateNode.__reactInternalMemoizedMergedChildContext;(a=a["return"])?void 0:D("171")}return a.stateNode.context}}}
2381 function jf(a){var b=a.createCursor,c=a.push,d=a.pop,e=b(null),f=b(null),h=b(0);return{pushProvider:function(a){var b=a.type._context;c(h,b._changedBits,a);c(f,b._currentValue,a);c(e,a,a);b._currentValue=a.pendingProps.value;b._changedBits=a.stateNode},popProvider:function(a){var b=h.current,c=f.current;d(e,a);d(f,a);d(h,a);a=a.type._context;a._currentValue=c;a._changedBits=b}}}
2382 function kf(){var a=[],b=-1;return{createCursor:function(a){return{current:a}},isEmpty:function(){return-1===b},pop:function(c){0>b||(c.current=a[b],a[b]=null,b--)},push:function(c,d){b++;a[b]=c.current;c.current=d},checkThatStackIsEmpty:function(){},resetStackAfterFatalErrorInDev:function(){}}}
2383 function lf(a){function b(){if(null!==I)for(var a=I["return"];null!==a;)Lc(a),a=a["return"];Ya=null;Z=0;I=null;Nc=!1}function c(a){return null!==ya&&ya.has(a)}function d(a){for(;;){var b=a.alternate,c=a["return"],d=a.sibling;if(0===(a.effectTag&512)){b=Cb(b,a,Z);var e=a;if(1073741823===Z||1073741823!==e.expirationTime){b:switch(e.tag){case 3:case 2:var f=e.updateQueue;f=null===f?0:f.expirationTime;break b;default:f=0}for(var g=e.child;null!==g;)0!==g.expirationTime&&(0===f||f>g.expirationTime)&&(f=
2384 g.expirationTime),g=g.sibling;e.expirationTime=f}if(null!==b)return b;null!==c&&0===(c.effectTag&512)&&(null===c.firstEffect&&(c.firstEffect=a.firstEffect),null!==a.lastEffect&&(null!==c.lastEffect&&(c.lastEffect.nextEffect=a.firstEffect),c.lastEffect=a.lastEffect),1<a.effectTag&&(null!==c.lastEffect?c.lastEffect.nextEffect=a:c.firstEffect=a,c.lastEffect=a));if(null!==d)return d;if(null!==c)a=c;else{Nc=!0;break}}else{a=Kc(a);if(null!==a)return a.effectTag&=2559,a;null!==c&&(c.firstEffect=c.lastEffect=
2385 null,c.effectTag|=512);if(null!==d)return d;if(null!==c)a=c;else break}}return null}function e(a){var b=Wa(a.alternate,a,Z);null===b&&(b=d(a));nc.current=null;return b}function f(a,c,f){ca?D("243"):void 0;ca=!0;if(c!==Z||a!==Ya||null===I)b(),Ya=a,Z=c,I=ze(Ya.current,null,Z),a.pendingCommitExpirationTime=0;var g=!1;do{try{if(f)for(;null!==I&&!S();)I=e(I);else for(;null!==I;)I=e(I)}catch(Oc){if(null===I){g=!0;q(Oc);break}f=I;var h=f["return"];if(null===h){g=!0;q(Oc);break}Jc(h,f,Oc);I=d(f)}break}while(1);
2386 ca=!1;if(g||null!==I)return null;if(Nc)return a.pendingCommitExpirationTime=c,a.current.alternate;D("262")}function h(a,b,c,d){a={value:c,source:a,stack:Bc(a)};Pe(b,{expirationTime:d,partialState:null,callback:null,isReplace:!1,isForced:!1,capturedValue:a,next:null});v(b,d)}function g(a,b){a:{ca&&!Za?D("263"):void 0;for(var d=a["return"];null!==d;){switch(d.tag){case 2:var e=d.stateNode;if("function"===typeof d.type.getDerivedStateFromCatch||"function"===typeof e.componentDidCatch&&!c(e)){h(a,d,b,
2387 1);a=void 0;break a}break;case 3:h(a,d,b,1);a=void 0;break a}d=d["return"]}3===a.tag&&h(a,a,b,1);a=void 0}return a}function k(a){a=0!==ia?ia:ca?Za?1:Z:a.mode&1?za?10*(((l()+15)/10|0)+1):25*(((l()+500)/25|0)+1):1;za&&(0===da||a>da)&&(da=a);return a}function v(a,c){a:{for(;null!==a;){if(0===a.expirationTime||a.expirationTime>c)a.expirationTime=c;null!==a.alternate&&(0===a.alternate.expirationTime||a.alternate.expirationTime>c)&&(a.alternate.expirationTime=c);if(null===a["return"])if(3===a.tag){var d=
2388 a.stateNode;!ca&&0!==Z&&c<Z&&b();ca&&!Za&&Ya===d||B(d,c);Fb>xg&&D("185")}else{c=void 0;break a}a=a["return"]}c=void 0}return c}function l(){ye=Ic()-Pc;return yg=(ye/10|0)+2}function p(a,b,c,d,e){var f=ia;ia=1;try{return a(b,c,d,e)}finally{ia=f}}function z(a){if(0!==Gb){if(a>Gb)return;mg(Qc)}var b=Ic()-Pc;Gb=a;Qc=lg(Q,{timeout:10*(a-2)-b})}function B(a,b){if(null===a.nextScheduledRoot)a.remainingExpirationTime=b,null===K?(la=K=a,a.nextScheduledRoot=a):(K=K.nextScheduledRoot=a,K.nextScheduledRoot=la);
2389 else{var c=a.remainingExpirationTime;if(0===c||b<c)a.remainingExpirationTime=b}T||(J?Hb&&(aa=a,P=1,G(a,1,!1)):1===b?n():z(b))}function r(){var a=0,b=null;if(null!==K)for(var c=K,d=la;null!==d;){var e=d.remainingExpirationTime;if(0===e){null===c||null===K?D("244"):void 0;if(d===d.nextScheduledRoot){la=K=d.nextScheduledRoot=null;break}else if(d===la)la=e=d.nextScheduledRoot,K.nextScheduledRoot=e,d.nextScheduledRoot=null;else if(d===K){K=c;K.nextScheduledRoot=la;d.nextScheduledRoot=null;break}else c.nextScheduledRoot=
2390 d.nextScheduledRoot,d.nextScheduledRoot=null;d=c.nextScheduledRoot}else{if(0===a||e<a)a=e,b=d;if(d===K)break;c=d;d=d.nextScheduledRoot}}c=aa;null!==c&&c===b&&1===a?Fb++:Fb=0;aa=b;P=a}function Q(a){x(0,!0,a)}function n(){x(1,!1,null)}function x(a,b,c){$a=c;r();if(b)for(;null!==aa&&0!==P&&(0===a||a>=P)&&(!Ib||l()>=P);)G(aa,P,!Ib),r();else for(;null!==aa&&0!==P&&(0===a||a>=P);)G(aa,P,!1),r();null!==$a&&(Gb=0,Qc=-1);0!==P&&z(P);$a=null;Ib=!1;Y()}function Y(){Fb=0;if(null!==Aa){var a=Aa;Aa=null;for(var b=
2391 0;b<a.length;b++){var c=a[b];try{c._onComplete()}catch(wg){Ba||(Ba=!0,Jb=wg)}}}if(Ba)throw a=Jb,Jb=null,Ba=!1,a;}function G(a,b,c){T?D("245"):void 0;T=!0;c?(c=a.finishedWork,null!==c?R(a,c,b):(a.finishedWork=null,c=f(a,b,!0),null!==c&&(S()?a.finishedWork=c:R(a,c,b)))):(c=a.finishedWork,null!==c?R(a,c,b):(a.finishedWork=null,c=f(a,b,!1),null!==c&&R(a,c,b)));T=!1}function R(a,b,c){var d=a.firstBatch;if(null!==d&&d._expirationTime<=c&&(null===Aa?Aa=[d]:Aa.push(d),d._defer)){a.finishedWork=b;a.remainingExpirationTime=
2392 0;return}a.finishedWork=null;Za=ca=!0;c=b.stateNode;c.current===b?D("177"):void 0;d=c.pendingCommitExpirationTime;0===d?D("261"):void 0;c.pendingCommitExpirationTime=0;var e=l();nc.current=null;if(1<b.effectTag)if(null!==b.lastEffect){b.lastEffect.nextEffect=b;var f=b.firstEffect}else f=b;else f=b.firstEffect;zg(c.containerInfo);for(w=f;null!==w;){var h=!1,k=void 0;try{for(;null!==w;)w.effectTag&2048&&Db(w.alternate,w),w=w.nextEffect}catch(ab){h=!0,k=ab}h&&(null===w?D("178"):void 0,g(w,k),null!==
2393 w&&(w=w.nextEffect))}for(w=f;null!==w;){h=!1;k=void 0;try{for(;null!==w;){var p=w.effectTag;p&16&&Mc(w);if(p&128){var n=w.alternate;null!==n&&kg(n)}switch(p&14){case 2:Eb(w);w.effectTag&=-3;break;case 6:Eb(w);w.effectTag&=-3;we(w.alternate,w);break;case 4:we(w.alternate,w);break;case 8:gg(w)}w=w.nextEffect}}catch(ab){h=!0,k=ab}h&&(null===w?D("178"):void 0,g(w,k),null!==w&&(w=w.nextEffect))}Ag(c.containerInfo);c.current=b;for(w=f;null!==w;){p=!1;n=void 0;try{for(f=c,h=e,k=d;null!==w;){var r=w.effectTag;
2394 r&36&&hg(f,w.alternate,w,h,k);r&256&&ig(w,q);r&128&&jg(w);var t=w.nextEffect;w.nextEffect=null;w=t}}catch(ab){p=!0,n=ab}p&&(null===w?D("178"):void 0,g(w,n),null!==w&&(w=w.nextEffect))}ca=Za=!1;"function"===typeof Ie&&Ie(b.stateNode);b=c.current.expirationTime;0===b&&(ya=null);a.remainingExpirationTime=b}function S(){return null===$a||$a.timeRemaining()>Bg?!1:Ib=!0}function q(a){null===aa?D("246"):void 0;aa.remainingExpirationTime=0;Ba||(Ba=!0,Jb=a)}var u=kf(),t=ff(a,u),y=hf(u);u=jf(u);var H=gf(a),
2395 Wa=$e(a,t,y,u,H,v,k).beginWork,Cb=af(a,t,y,u,H).completeWork;t=bf(t,y,u,v,c);var Jc=t.throwException,Kc=t.unwindWork,Lc=t.unwindInterruptedWork;t=df(a,g,v,k,function(a){null===ya?ya=new Set([a]):ya.add(a)},l);var Db=t.commitBeforeMutationLifeCycles,Mc=t.commitResetTextContent,Eb=t.commitPlacement,gg=t.commitDeletion,we=t.commitWork,hg=t.commitLifeCycles,ig=t.commitErrorLogging,jg=t.commitAttachRef,kg=t.commitDetachRef,Ic=a.now,lg=a.scheduleDeferredCallback,mg=a.cancelDeferredCallback,zg=a.prepareForCommit,
2396 Ag=a.resetAfterCommit,Pc=Ic(),yg=2,ye=Pc,Rc=0,ia=0,ca=!1,I=null,Ya=null,Z=0,w=null,Za=!1,Nc=!1,ya=null,la=null,K=null,Gb=0,Qc=-1,T=!1,aa=null,P=0,da=0,Ib=!1,Ba=!1,Jb=null,$a=null,J=!1,Hb=!1,za=!1,Aa=null,xg=1E3,Fb=0,Bg=1;return{recalculateCurrentTime:l,computeExpirationForFiber:k,scheduleWork:v,requestWork:B,flushRoot:function(a,b){T?D("253"):void 0;aa=a;P=b;G(a,b,!1);n();Y()},batchedUpdates:function(a,b){var c=J;J=!0;try{return a(b)}finally{(J=c)||T||n()}},unbatchedUpdates:function(a,b){if(J&&!Hb){Hb=
2397 !0;try{return a(b)}finally{Hb=!1}}return a(b)},flushSync:function(a,b){T?D("187"):void 0;var c=J;J=!0;try{return p(a,b)}finally{J=c,n()}},flushControlled:function(a){var b=J;J=!0;try{p(a)}finally{(J=b)||T||x(1,!1,null)}},deferredUpdates:function(a){var b=ia;ia=25*(((l()+500)/25|0)+1);try{return a()}finally{ia=b}},syncUpdates:p,interactiveUpdates:function(a,b,c){if(za)return a(b,c);J||T||0===da||(x(da,!1,null),da=0);var d=za,e=J;J=za=!0;try{return a(b,c)}finally{za=d,(J=e)||T||n()}},flushInteractiveUpdates:function(){T||
2398 0===da||(x(da,!1,null),da=0)},computeUniqueAsyncExpiration:function(){var a=25*(((l()+500)/25|0)+1);a<=Rc&&(a=Rc+1);return Rc=a},legacyContext:y}}
2399 function mf(a){function b(a,b,c,d,e,h){d=b.current;if(c){c=c._reactInternalFiber;var l=g(c);c=k(c)?v(c,l):l}else c=ka;null===b.context?b.context=c:b.pendingContext=c;b=h;Pe(d,{expirationTime:e,partialState:{element:a},callback:void 0===b?null:b,isReplace:!1,isForced:!1,capturedValue:null,next:null});f(d,e);return e}var c=a.getPublicInstance;a=lf(a);var d=a.recalculateCurrentTime,e=a.computeExpirationForFiber,f=a.scheduleWork,h=a.legacyContext,g=h.findCurrentUnmaskedContext,k=h.isContextProvider,v=
2400 h.processChildContext;return{createContainer:function(a,b,c){b=new xe(3,null,null,b?3:0);a={current:b,containerInfo:a,pendingChildren:null,pendingCommitExpirationTime:0,finishedWork:null,context:null,pendingContext:null,hydrate:c,remainingExpirationTime:0,firstBatch:null,nextScheduledRoot:null};return b.stateNode=a},updateContainer:function(a,c,f,h){var g=c.current,k=d();g=e(g);return b(a,c,f,k,g,h)},updateContainerAtExpirationTime:function(a,c,e,f,g){var h=d();return b(a,c,e,h,f,g)},flushRoot:a.flushRoot,
2401 requestWork:a.requestWork,computeUniqueAsyncExpiration:a.computeUniqueAsyncExpiration,batchedUpdates:a.batchedUpdates,unbatchedUpdates:a.unbatchedUpdates,deferredUpdates:a.deferredUpdates,syncUpdates:a.syncUpdates,interactiveUpdates:a.interactiveUpdates,flushInteractiveUpdates:a.flushInteractiveUpdates,flushControlled:a.flushControlled,flushSync:a.flushSync,getPublicRootInstance:function(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return c(a.child.stateNode);default:return a.child.stateNode}},
2402 findHostInstance:function(a){var b=a._reactInternalFiber;void 0===b&&("function"===typeof a.render?D("188"):D("268",Object.keys(a)));a=Bd(b);return null===a?null:a.stateNode},findHostInstanceWithNoPortals:function(a){a=Cd(a);return null===a?null:a.stateNode},injectIntoDevTools:function(a){var b=a.findFiberByHostInstance;return He(A({},a,{findHostInstanceByFiber:function(a){a=Bd(a);return null===a?null:a.stateNode},findFiberByHostInstance:function(a){return b?b(a):null}}))}}}
2403 var nf=Object.freeze({default:mf}),of=nf&&mf||nf,pf=of["default"]?of["default"]:of;function qf(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:rc,key:null==d?null:""+d,children:a,containerInfo:b,implementation:c}}var rf="object"===typeof performance&&"function"===typeof performance.now,sf=void 0;sf=rf?function(){return performance.now()}:function(){return Date.now()};var tf=void 0,uf=void 0;
2404 if(m.canUseDOM)if("function"!==typeof requestIdleCallback||"function"!==typeof cancelIdleCallback){var vf=null,wf=!1,xf=-1,yf=!1,zf=0,Af=33,Bf=33,Cf=void 0;Cf=rf?{didTimeout:!1,timeRemaining:function(){var a=zf-performance.now();return 0<a?a:0}}:{didTimeout:!1,timeRemaining:function(){var a=zf-Date.now();return 0<a?a:0}};var Df="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(a){if(a.source===window&&a.data===Df){wf=!1;a=sf();if(0>=zf-a)if(-1!==
2405 xf&&xf<=a)Cf.didTimeout=!0;else{yf||(yf=!0,requestAnimationFrame(Ef));return}else Cf.didTimeout=!1;xf=-1;a=vf;vf=null;null!==a&&a(Cf)}},!1);var Ef=function(a){yf=!1;var b=a-zf+Bf;b<Bf&&Af<Bf?(8>b&&(b=8),Bf=b<Af?Af:b):Af=b;zf=a+Bf;wf||(wf=!0,window.postMessage(Df,"*"))};tf=function(a,b){vf=a;null!=b&&"number"===typeof b.timeout&&(xf=sf()+b.timeout);yf||(yf=!0,requestAnimationFrame(Ef));return 0};uf=function(){vf=null;wf=!1;xf=-1}}else tf=window.requestIdleCallback,uf=window.cancelIdleCallback;else tf=
2406 function(a){return setTimeout(function(){a({timeRemaining:function(){return Infinity},didTimeout:!1})})},uf=function(a){clearTimeout(a)};function Ff(a){var b="";ea.Children.forEach(a,function(a){null==a||"string"!==typeof a&&"number"!==typeof a||(b+=a)});return b}function Gf(a,b){a=A({children:void 0},b);if(b=Ff(b.children))a.children=b;return a}
2407 function Hf(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e<c.length;e++)b["$"+c[e]]=!0;for(c=0;c<a.length;c++)e=b.hasOwnProperty("$"+a[c].value),a[c].selected!==e&&(a[c].selected=e),e&&d&&(a[c].defaultSelected=!0)}else{c=""+c;b=null;for(e=0;e<a.length;e++){if(a[e].value===c){a[e].selected=!0;d&&(a[e].defaultSelected=!0);return}null!==b||a[e].disabled||(b=a[e])}null!==b&&(b.selected=!0)}}
2408 function If(a,b){var c=b.value;a._wrapperState={initialValue:null!=c?c:b.defaultValue,wasMultiple:!!b.multiple}}function Jf(a,b){null!=b.dangerouslySetInnerHTML?D("91"):void 0;return A({},b,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function Kf(a,b){var c=b.value;null==c&&(c=b.defaultValue,b=b.children,null!=b&&(null!=c?D("92"):void 0,Array.isArray(b)&&(1>=b.length?void 0:D("93"),b=b[0]),c=""+b),null==c&&(c=""));a._wrapperState={initialValue:""+c}}
2409 function Lf(a,b){var c=b.value;null!=c&&(c=""+c,c!==a.value&&(a.value=c),null==b.defaultValue&&(a.defaultValue=c));null!=b.defaultValue&&(a.defaultValue=b.defaultValue)}function Mf(a){var b=a.textContent;b===a._wrapperState.initialValue&&(a.value=b)}var Nf={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};
2410 function Of(a){switch(a){case "svg":return"http://www.w3.org/2000/svg";case "math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Pf(a,b){return null==a||"http://www.w3.org/1999/xhtml"===a?Of(b):"http://www.w3.org/2000/svg"===a&&"foreignObject"===b?"http://www.w3.org/1999/xhtml":a}
2411 var Qf=void 0,Rf=function(a){return"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)})}:a}(function(a,b){if(a.namespaceURI!==Nf.svg||"innerHTML"in a)a.innerHTML=b;else{Qf=Qf||document.createElement("div");Qf.innerHTML="\x3csvg\x3e"+b+"\x3c/svg\x3e";for(b=Qf.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});
2412 function Sf(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}
2413 var Tf={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,
2414 stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Uf=["Webkit","ms","Moz","O"];Object.keys(Tf).forEach(function(a){Uf.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);Tf[b]=Tf[a]})});
2415 function Vf(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf("--");var e=c;var f=b[c];e=null==f||"boolean"===typeof f||""===f?"":d||"number"!==typeof f||0===f||Tf.hasOwnProperty(e)&&Tf[e]?(""+f).trim():f+"px";"float"===c&&(c="cssFloat");d?a.setProperty(c,e):a[c]=e}}var Wf=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});
2416 function Xf(a,b,c){b&&(Wf[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML?D("137",a,c()):void 0),null!=b.dangerouslySetInnerHTML&&(null!=b.children?D("60"):void 0,"object"===typeof b.dangerouslySetInnerHTML&&"__html"in b.dangerouslySetInnerHTML?void 0:D("61")),null!=b.style&&"object"!==typeof b.style?D("62",c()):void 0)}
2417 function Yf(a,b){if(-1===a.indexOf("-"))return"string"===typeof b.is;switch(a){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":return!1;default:return!0}}var Zf=C.thatReturns("");
2418 function $f(a,b){a=9===a.nodeType||11===a.nodeType?a:a.ownerDocument;var c=ke(a);b=va[b];for(var d=0;d<b.length;d++){var e=b[d];c.hasOwnProperty(e)&&c[e]||("topScroll"===e?Zd("topScroll","scroll",a):"topFocus"===e||"topBlur"===e?(Zd("topFocus","focus",a),Zd("topBlur","blur",a),c.topBlur=!0,c.topFocus=!0):"topCancel"===e?(ic("cancel",!0)&&Zd("topCancel","cancel",a),c.topCancel=!0):"topClose"===e?(ic("close",!0)&&Zd("topClose","close",a),c.topClose=!0):fe.hasOwnProperty(e)&&W(e,fe[e],a),c[e]=!0)}}
2419 function ag(a,b,c,d){c=9===c.nodeType?c:c.ownerDocument;d===Nf.html&&(d=Of(a));d===Nf.html?"script"===a?(a=c.createElement("div"),a.innerHTML="\x3cscript\x3e\x3c/script\x3e",a=a.removeChild(a.firstChild)):a="string"===typeof b.is?c.createElement(a,{is:b.is}):c.createElement(a):a=c.createElementNS(d,a);return a}function bg(a,b){return(9===b.nodeType?b:b.ownerDocument).createTextNode(a)}
2420 function cg(a,b,c,d){var e=Yf(b,c);switch(b){case "iframe":case "object":W("topLoad","load",a);var f=c;break;case "video":case "audio":for(f in ge)ge.hasOwnProperty(f)&&W(f,ge[f],a);f=c;break;case "source":W("topError","error",a);f=c;break;case "img":case "image":case "link":W("topError","error",a);W("topLoad","load",a);f=c;break;case "form":W("topReset","reset",a);W("topSubmit","submit",a);f=c;break;case "details":W("topToggle","toggle",a);f=c;break;case "input":Wc(a,c);f=Vc(a,c);W("topInvalid",
2421 "invalid",a);$f(d,"onChange");break;case "option":f=Gf(a,c);break;case "select":If(a,c);f=A({},c,{value:void 0});W("topInvalid","invalid",a);$f(d,"onChange");break;case "textarea":Kf(a,c);f=Jf(a,c);W("topInvalid","invalid",a);$f(d,"onChange");break;default:f=c}Xf(b,f,Zf);var h=f,g;for(g in h)if(h.hasOwnProperty(g)){var k=h[g];"style"===g?Vf(a,k,Zf):"dangerouslySetInnerHTML"===g?(k=k?k.__html:void 0,null!=k&&Rf(a,k)):"children"===g?"string"===typeof k?("textarea"!==b||""!==k)&&Sf(a,k):"number"===typeof k&&
2422 Sf(a,""+k):"suppressContentEditableWarning"!==g&&"suppressHydrationWarning"!==g&&"autoFocus"!==g&&(ua.hasOwnProperty(g)?null!=k&&$f(d,g):null!=k&&Uc(a,g,k,e))}switch(b){case "input":lc(a);ad(a,c);break;case "textarea":lc(a);Mf(a,c);break;case "option":null!=c.value&&a.setAttribute("value",c.value);break;case "select":a.multiple=!!c.multiple;b=c.value;null!=b?Hf(a,!!c.multiple,b,!1):null!=c.defaultValue&&Hf(a,!!c.multiple,c.defaultValue,!0);break;default:"function"===typeof f.onClick&&(a.onclick=C)}}
2423 function dg(a,b,c,d,e){var f=null;switch(b){case "input":c=Vc(a,c);d=Vc(a,d);f=[];break;case "option":c=Gf(a,c);d=Gf(a,d);f=[];break;case "select":c=A({},c,{value:void 0});d=A({},d,{value:void 0});f=[];break;case "textarea":c=Jf(a,c);d=Jf(a,d);f=[];break;default:"function"!==typeof c.onClick&&"function"===typeof d.onClick&&(a.onclick=C)}Xf(b,d,Zf);b=a=void 0;var h=null;for(a in c)if(!d.hasOwnProperty(a)&&c.hasOwnProperty(a)&&null!=c[a])if("style"===a){var g=c[a];for(b in g)g.hasOwnProperty(b)&&(h||
2424 (h={}),h[b]="")}else"dangerouslySetInnerHTML"!==a&&"children"!==a&&"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&"autoFocus"!==a&&(ua.hasOwnProperty(a)?f||(f=[]):(f=f||[]).push(a,null));for(a in d){var k=d[a];g=null!=c?c[a]:void 0;if(d.hasOwnProperty(a)&&k!==g&&(null!=k||null!=g))if("style"===a)if(g){for(b in g)!g.hasOwnProperty(b)||k&&k.hasOwnProperty(b)||(h||(h={}),h[b]="");for(b in k)k.hasOwnProperty(b)&&g[b]!==k[b]&&(h||(h={}),h[b]=k[b])}else h||(f||(f=[]),f.push(a,h)),
2425 h=k;else"dangerouslySetInnerHTML"===a?(k=k?k.__html:void 0,g=g?g.__html:void 0,null!=k&&g!==k&&(f=f||[]).push(a,""+k)):"children"===a?g===k||"string"!==typeof k&&"number"!==typeof k||(f=f||[]).push(a,""+k):"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&(ua.hasOwnProperty(a)?(null!=k&&$f(e,a),f||g===k||(f=[])):(f=f||[]).push(a,k))}h&&(f=f||[]).push("style",h);return f}
2426 function eg(a,b,c,d,e){"input"===c&&"radio"===e.type&&null!=e.name&&Yc(a,e);Yf(c,d);d=Yf(c,e);for(var f=0;f<b.length;f+=2){var h=b[f],g=b[f+1];"style"===h?Vf(a,g,Zf):"dangerouslySetInnerHTML"===h?Rf(a,g):"children"===h?Sf(a,g):Uc(a,h,g,d)}switch(c){case "input":Zc(a,e);break;case "textarea":Lf(a,e);break;case "select":a._wrapperState.initialValue=void 0,b=a._wrapperState.wasMultiple,a._wrapperState.wasMultiple=!!e.multiple,c=e.value,null!=c?Hf(a,!!e.multiple,c,!1):b!==!!e.multiple&&(null!=e.defaultValue?
2427 Hf(a,!!e.multiple,e.defaultValue,!0):Hf(a,!!e.multiple,e.multiple?[]:"",!1))}}
2428 function fg(a,b,c,d,e){switch(b){case "iframe":case "object":W("topLoad","load",a);break;case "video":case "audio":for(var f in ge)ge.hasOwnProperty(f)&&W(f,ge[f],a);break;case "source":W("topError","error",a);break;case "img":case "image":case "link":W("topError","error",a);W("topLoad","load",a);break;case "form":W("topReset","reset",a);W("topSubmit","submit",a);break;case "details":W("topToggle","toggle",a);break;case "input":Wc(a,c);W("topInvalid","invalid",a);$f(e,"onChange");break;case "select":If(a,
2429 c);W("topInvalid","invalid",a);$f(e,"onChange");break;case "textarea":Kf(a,c),W("topInvalid","invalid",a),$f(e,"onChange")}Xf(b,c,Zf);d=null;for(var h in c)c.hasOwnProperty(h)&&(f=c[h],"children"===h?"string"===typeof f?a.textContent!==f&&(d=["children",f]):"number"===typeof f&&a.textContent!==""+f&&(d=["children",""+f]):ua.hasOwnProperty(h)&&null!=f&&$f(e,h));switch(b){case "input":lc(a);ad(a,c);break;case "textarea":lc(a);Mf(a,c);break;case "select":case "option":break;default:"function"===typeof c.onClick&&
2430 (a.onclick=C)}return d}function ng(a,b){return a.nodeValue!==b}
2431 var og=Object.freeze({createElement:ag,createTextNode:bg,setInitialProperties:cg,diffProperties:dg,updateProperties:eg,diffHydratedProperties:fg,diffHydratedText:ng,warnForUnmatchedText:function(){},warnForDeletedHydratableElement:function(){},warnForDeletedHydratableText:function(){},warnForInsertedHydratedElement:function(){},warnForInsertedHydratedText:function(){},restoreControlledState:function(a,b,c){switch(b){case "input":Zc(a,c);b=c.name;if("radio"===c.type&&null!=b){for(c=a;c.parentNode;)c=
2432 c.parentNode;c=c.querySelectorAll("input[name\x3d"+JSON.stringify(""+b)+'][type\x3d"radio"]');for(b=0;b<c.length;b++){var d=c[b];if(d!==a&&d.form===a.form){var e=Xa(d);e?void 0:D("90");mc(d);Zc(d,e)}}}break;case "textarea":Lf(a,c);break;case "select":b=c.value,null!=b&&Hf(a,!!c.multiple,b,!1)}}});Tb.injectFiberControlledHostComponent(og);var pg=null,qg=null;
2433 function rg(a){this._expirationTime=X.computeUniqueAsyncExpiration();this._root=a;this._callbacks=this._next=null;this._hasChildren=this._didComplete=!1;this._children=null;this._defer=!0}rg.prototype.render=function(a){this._defer?void 0:D("250");this._hasChildren=!0;this._children=a;var b=this._root._internalRoot,c=this._expirationTime,d=new sg;X.updateContainerAtExpirationTime(a,b,null,c,d._onCommit);return d};
2434 rg.prototype.then=function(a){if(this._didComplete)a();else{var b=this._callbacks;null===b&&(b=this._callbacks=[]);b.push(a)}};
2435 rg.prototype.commit=function(){var a=this._root._internalRoot,b=a.firstBatch;this._defer&&null!==b?void 0:D("251");if(this._hasChildren){var c=this._expirationTime;if(b!==this){this._hasChildren&&(c=this._expirationTime=b._expirationTime,this.render(this._children));for(var d=null,e=b;e!==this;)d=e,e=e._next;null===d?D("251"):void 0;d._next=e._next;this._next=b;a.firstBatch=this}this._defer=!1;X.flushRoot(a,c);b=this._next;this._next=null;b=a.firstBatch=b;null!==b&&b._hasChildren&&b.render(b._children)}else this._next=
2436 null,this._defer=!1};rg.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var a=this._callbacks;if(null!==a)for(var b=0;b<a.length;b++)(0,a[b])()}};function sg(){this._callbacks=null;this._didCommit=!1;this._onCommit=this._onCommit.bind(this)}sg.prototype.then=function(a){if(this._didCommit)a();else{var b=this._callbacks;null===b&&(b=this._callbacks=[]);b.push(a)}};
2437 sg.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var a=this._callbacks;if(null!==a)for(var b=0;b<a.length;b++){var c=a[b];"function"!==typeof c?D("191",c):void 0;c()}}};function tg(a,b,c){this._internalRoot=X.createContainer(a,b,c)}tg.prototype.render=function(a,b){var c=this._internalRoot,d=new sg;b=void 0===b?null:b;null!==b&&d.then(b);X.updateContainer(a,c,null,d._onCommit);return d};
2438 tg.prototype.unmount=function(a){var b=this._internalRoot,c=new sg;a=void 0===a?null:a;null!==a&&c.then(a);X.updateContainer(null,b,null,c._onCommit);return c};tg.prototype.legacy_renderSubtreeIntoContainer=function(a,b,c){var d=this._internalRoot,e=new sg;c=void 0===c?null:c;null!==c&&e.then(c);X.updateContainer(b,d,a,e._onCommit);return e};
2439 tg.prototype.createBatch=function(){var a=new rg(this),b=a._expirationTime,c=this._internalRoot,d=c.firstBatch;if(null===d)c.firstBatch=a,a._next=null;else{for(c=null;null!==d&&d._expirationTime<=b;)c=d,d=d._next;a._next=d;null!==c&&(c._next=a)}return a};function ug(a){return!(!a||1!==a.nodeType&&9!==a.nodeType&&11!==a.nodeType&&(8!==a.nodeType||" react-mount-point-unstable "!==a.nodeValue))}
2440 function vg(a,b){switch(a){case "button":case "input":case "select":case "textarea":return!!b.autoFocus}return!1}
2441 var X=pf({getRootHostContext:function(a){var b=a.nodeType;switch(b){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:Pf(null,"");break;default:b=8===b?a.parentNode:a,a=b.namespaceURI||null,b=b.tagName,a=Pf(a,b)}return a},getChildHostContext:function(a,b){return Pf(a,b)},getPublicInstance:function(a){return a},prepareForCommit:function(){pg=Vd;var a=fa();if(ne(a)){if("selectionStart"in a)var b={start:a.selectionStart,end:a.selectionEnd};else a:{var c=window.getSelection&&window.getSelection();
2442 if(c&&0!==c.rangeCount){b=c.anchorNode;var d=c.anchorOffset,e=c.focusNode;c=c.focusOffset;try{b.nodeType,e.nodeType}catch(B){b=null;break a}var f=0,h=-1,g=-1,k=0,v=0,l=a,p=null;b:for(;;){for(var z;;){l!==b||0!==d&&3!==l.nodeType||(h=f+d);l!==e||0!==c&&3!==l.nodeType||(g=f+c);3===l.nodeType&&(f+=l.nodeValue.length);if(null===(z=l.firstChild))break;p=l;l=z}for(;;){if(l===a)break b;p===b&&++k===d&&(h=f);p===e&&++v===c&&(g=f);if(null!==(z=l.nextSibling))break;l=p;p=l.parentNode}l=z}b=-1===h||-1===g?null:
2443 {start:h,end:g}}else b=null}b=b||{start:0,end:0}}else b=null;qg={focusedElem:a,selectionRange:b};Wd(!1)},resetAfterCommit:function(){var a=qg,b=fa(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&ja(document.documentElement,c)){if(ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),"selectionStart"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(window.getSelection){b=window.getSelection();var e=c[mb()].length;a=Math.min(d.start,e);d=void 0===d.end?a:Math.min(d.end,e);!b.extend&&a>
2444 d&&(e=d,d=a,a=e);e=me(c,a);var f=me(c,d);if(e&&f&&(1!==b.rangeCount||b.anchorNode!==e.node||b.anchorOffset!==e.offset||b.focusNode!==f.node||b.focusOffset!==f.offset)){var h=document.createRange();h.setStart(e.node,e.offset);b.removeAllRanges();a>d?(b.addRange(h),b.extend(f.node,f.offset)):(h.setEnd(f.node,f.offset),b.addRange(h))}}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});c.focus();for(c=0;c<b.length;c++)a=b[c],a.element.scrollLeft=a.left,
2445 a.element.scrollTop=a.top}qg=null;Wd(pg);pg=null},createInstance:function(a,b,c,d,e){a=ag(a,b,c,d);a[F]=e;a[Ta]=b;return a},appendInitialChild:function(a,b){a.appendChild(b)},finalizeInitialChildren:function(a,b,c,d){cg(a,b,c,d);return vg(b,c)},prepareUpdate:function(a,b,c,d,e){return dg(a,b,c,d,e)},shouldSetTextContent:function(a,b){return"textarea"===a||"string"===typeof b.children||"number"===typeof b.children||"object"===typeof b.dangerouslySetInnerHTML&&null!==b.dangerouslySetInnerHTML&&"string"===
2446 typeof b.dangerouslySetInnerHTML.__html},shouldDeprioritizeSubtree:function(a,b){return!!b.hidden},createTextInstance:function(a,b,c,d){a=bg(a,b);a[F]=d;return a},now:sf,mutation:{commitMount:function(a,b,c){vg(b,c)&&a.focus()},commitUpdate:function(a,b,c,d,e){a[Ta]=e;eg(a,b,c,d,e)},resetTextContent:function(a){Sf(a,"")},commitTextUpdate:function(a,b,c){a.nodeValue=c},appendChild:function(a,b){a.appendChild(b)},appendChildToContainer:function(a,b){8===a.nodeType?a.parentNode.insertBefore(b,a):a.appendChild(b)},
2447 insertBefore:function(a,b,c){a.insertBefore(b,c)},insertInContainerBefore:function(a,b,c){8===a.nodeType?a.parentNode.insertBefore(b,c):a.insertBefore(b,c)},removeChild:function(a,b){a.removeChild(b)},removeChildFromContainer:function(a,b){8===a.nodeType?a.parentNode.removeChild(b):a.removeChild(b)}},hydration:{canHydrateInstance:function(a,b){return 1!==a.nodeType||b.toLowerCase()!==a.nodeName.toLowerCase()?null:a},canHydrateTextInstance:function(a,b){return""===b||3!==a.nodeType?null:a},getNextHydratableSibling:function(a){for(a=
2448 a.nextSibling;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a},getFirstHydratableChild:function(a){for(a=a.firstChild;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a},hydrateInstance:function(a,b,c,d,e,f){a[F]=f;a[Ta]=c;return fg(a,b,c,e,d)},hydrateTextInstance:function(a,b,c){a[F]=c;return ng(a,b)},didNotMatchHydratedContainerTextInstance:function(){},didNotMatchHydratedTextInstance:function(){},didNotHydrateContainerInstance:function(){},didNotHydrateInstance:function(){},
2449 didNotFindHydratableContainerInstance:function(){},didNotFindHydratableContainerTextInstance:function(){},didNotFindHydratableInstance:function(){},didNotFindHydratableTextInstance:function(){}},scheduleDeferredCallback:tf,cancelDeferredCallback:uf}),Cg=X;ac=Cg.batchedUpdates;bc=Cg.interactiveUpdates;cc=Cg.flushInteractiveUpdates;
2450 function Dg(a,b){b||(b=a?9===a.nodeType?a.documentElement:a.firstChild:null,b=!(!b||1!==b.nodeType||!b.hasAttribute("data-reactroot")));if(!b)for(var c;c=a.lastChild;)a.removeChild(c);return new tg(a,!1,b)}
2451 function Eg(a,b,c,d,e){ug(c)?void 0:D("200");var f=c._reactRootContainer;if(f){if("function"===typeof e){var h=e;e=function(){var a=X.getPublicRootInstance(f._internalRoot);h.call(a)}}null!=a?f.legacy_renderSubtreeIntoContainer(a,b,e):f.render(b,e)}else{f=c._reactRootContainer=Dg(c,d);if("function"===typeof e){var g=e;e=function(){var a=X.getPublicRootInstance(f._internalRoot);g.call(a)}}X.unbatchedUpdates(function(){null!=a?f.legacy_renderSubtreeIntoContainer(a,b,e):f.render(b,e)})}return X.getPublicRootInstance(f._internalRoot)}
2452 function Fg(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;ug(b)?void 0:D("200");return qf(a,b,null,c)}
2453 var Gg={createPortal:Fg,findDOMNode:function(a){return null==a?null:1===a.nodeType?a:X.findHostInstance(a)},hydrate:function(a,b,c){return Eg(null,a,b,!0,c)},render:function(a,b,c){return Eg(null,a,b,!1,c)},unstable_renderSubtreeIntoContainer:function(a,b,c,d){null==a||void 0===a._reactInternalFiber?D("38"):void 0;return Eg(a,b,c,!1,d)},unmountComponentAtNode:function(a){ug(a)?void 0:D("40");return a._reactRootContainer?(X.unbatchedUpdates(function(){Eg(null,null,a,!1,function(){a._reactRootContainer=
2454 null})}),!0):!1},unstable_createPortal:function(){return Fg.apply(void 0,arguments)},unstable_batchedUpdates:X.batchedUpdates,unstable_deferredUpdates:X.deferredUpdates,flushSync:X.flushSync,unstable_flushControlled:X.flushControlled,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{EventPluginHub:Ra,EventPluginRegistry:Ca,EventPropagators:kb,ReactControlledComponent:$b,ReactDOMComponentTree:bb,ReactDOMEventListener:$d},unstable_createRoot:function(a,b){return new tg(a,!0,null!=b&&!0===b.hydrate)}};
2455 X.injectIntoDevTools({findFiberByHostInstance:Ua,bundleType:0,version:"16.3.2",rendererPackageName:"react-dom"});var Hg=Object.freeze({default:Gg}),Ig=Hg&&Gg||Hg;module.exports=Ig["default"]?Ig["default"]:Ig;
2456
2457
2458/***/ }),
2459/* 14 */
2460/***/ (function(module, exports) {
2461
2462 /**
2463 * Copyright (c) 2013-present, Facebook, Inc.
2464 *
2465 * This source code is licensed under the MIT license found in the
2466 * LICENSE file in the root directory of this source tree.
2467 *
2468 */
2469
2470 'use strict';
2471
2472 var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
2473
2474 /**
2475 * Simple, lightweight module assisting with the detection and context of
2476 * Worker. Helps avoid circular dependencies and allows code to reason about
2477 * whether or not they are in a Worker, even if they never include the main
2478 * `ReactWorker` dependency.
2479 */
2480 var ExecutionEnvironment = {
2481
2482 canUseDOM: canUseDOM,
2483
2484 canUseWorkers: typeof Worker !== 'undefined',
2485
2486 canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
2487
2488 canUseViewport: canUseDOM && !!window.screen,
2489
2490 isInWorker: !canUseDOM // For now, this is true - might change in the future.
2491
2492 };
2493
2494 module.exports = ExecutionEnvironment;
2495
2496/***/ }),
2497/* 15 */
2498/***/ (function(module, exports) {
2499
2500 'use strict';
2501
2502 /**
2503 * Copyright (c) 2013-present, Facebook, Inc.
2504 *
2505 * This source code is licensed under the MIT license found in the
2506 * LICENSE file in the root directory of this source tree.
2507 *
2508 * @typechecks
2509 */
2510
2511 /* eslint-disable fb-www/typeof-undefined */
2512
2513 /**
2514 * Same as document.activeElement but wraps in a try-catch block. In IE it is
2515 * not safe to call document.activeElement if there is nothing focused.
2516 *
2517 * The activeElement will be null only if the document or document body is not
2518 * yet defined.
2519 *
2520 * @param {?DOMDocument} doc Defaults to current document.
2521 * @return {?DOMElement}
2522 */
2523 function getActiveElement(doc) /*?DOMElement*/{
2524 doc = doc || (typeof document !== 'undefined' ? document : undefined);
2525 if (typeof doc === 'undefined') {
2526 return null;
2527 }
2528 try {
2529 return doc.activeElement || doc.body;
2530 } catch (e) {
2531 return doc.body;
2532 }
2533 }
2534
2535 module.exports = getActiveElement;
2536
2537/***/ }),
2538/* 16 */
2539/***/ (function(module, exports) {
2540
2541 /**
2542 * Copyright (c) 2013-present, Facebook, Inc.
2543 *
2544 * This source code is licensed under the MIT license found in the
2545 * LICENSE file in the root directory of this source tree.
2546 *
2547 * @typechecks
2548 *
2549 */
2550
2551 /*eslint-disable no-self-compare */
2552
2553 'use strict';
2554
2555 var hasOwnProperty = Object.prototype.hasOwnProperty;
2556
2557 /**
2558 * inlined Object.is polyfill to avoid requiring consumers ship their own
2559 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2560 */
2561 function is(x, y) {
2562 // SameValue algorithm
2563 if (x === y) {
2564 // Steps 1-5, 7-10
2565 // Steps 6.b-6.e: +0 != -0
2566 // Added the nonzero y check to make Flow happy, but it is redundant
2567 return x !== 0 || y !== 0 || 1 / x === 1 / y;
2568 } else {
2569 // Step 6.a: NaN == NaN
2570 return x !== x && y !== y;
2571 }
2572 }
2573
2574 /**
2575 * Performs equality by iterating through keys on an object and returning false
2576 * when any key has values which are not strictly equal between the arguments.
2577 * Returns true when the values of all keys are strictly equal.
2578 */
2579 function shallowEqual(objA, objB) {
2580 if (is(objA, objB)) {
2581 return true;
2582 }
2583
2584 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
2585 return false;
2586 }
2587
2588 var keysA = Object.keys(objA);
2589 var keysB = Object.keys(objB);
2590
2591 if (keysA.length !== keysB.length) {
2592 return false;
2593 }
2594
2595 // Test for A's keys different from B.
2596 for (var i = 0; i < keysA.length; i++) {
2597 if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
2598 return false;
2599 }
2600 }
2601
2602 return true;
2603 }
2604
2605 module.exports = shallowEqual;
2606
2607/***/ }),
2608/* 17 */
2609/***/ (function(module, exports, __webpack_require__) {
2610
2611 'use strict';
2612
2613 /**
2614 * Copyright (c) 2013-present, Facebook, Inc.
2615 *
2616 * This source code is licensed under the MIT license found in the
2617 * LICENSE file in the root directory of this source tree.
2618 *
2619 *
2620 */
2621
2622 var isTextNode = __webpack_require__(18);
2623
2624 /*eslint-disable no-bitwise */
2625
2626 /**
2627 * Checks if a given DOM node contains or is another DOM node.
2628 */
2629 function containsNode(outerNode, innerNode) {
2630 if (!outerNode || !innerNode) {
2631 return false;
2632 } else if (outerNode === innerNode) {
2633 return true;
2634 } else if (isTextNode(outerNode)) {
2635 return false;
2636 } else if (isTextNode(innerNode)) {
2637 return containsNode(outerNode, innerNode.parentNode);
2638 } else if ('contains' in outerNode) {
2639 return outerNode.contains(innerNode);
2640 } else if (outerNode.compareDocumentPosition) {
2641 return !!(outerNode.compareDocumentPosition(innerNode) & 16);
2642 } else {
2643 return false;
2644 }
2645 }
2646
2647 module.exports = containsNode;
2648
2649/***/ }),
2650/* 18 */
2651/***/ (function(module, exports, __webpack_require__) {
2652
2653 'use strict';
2654
2655 /**
2656 * Copyright (c) 2013-present, Facebook, Inc.
2657 *
2658 * This source code is licensed under the MIT license found in the
2659 * LICENSE file in the root directory of this source tree.
2660 *
2661 * @typechecks
2662 */
2663
2664 var isNode = __webpack_require__(19);
2665
2666 /**
2667 * @param {*} object The object to check.
2668 * @return {boolean} Whether or not the object is a DOM text node.
2669 */
2670 function isTextNode(object) {
2671 return isNode(object) && object.nodeType == 3;
2672 }
2673
2674 module.exports = isTextNode;
2675
2676/***/ }),
2677/* 19 */
2678/***/ (function(module, exports) {
2679
2680 'use strict';
2681
2682 /**
2683 * Copyright (c) 2013-present, Facebook, Inc.
2684 *
2685 * This source code is licensed under the MIT license found in the
2686 * LICENSE file in the root directory of this source tree.
2687 *
2688 * @typechecks
2689 */
2690
2691 /**
2692 * @param {*} object The object to check.
2693 * @return {boolean} Whether or not the object is a DOM node.
2694 */
2695 function isNode(object) {
2696 var doc = object ? object.ownerDocument || object : document;
2697 var defaultView = doc.defaultView || window;
2698 return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
2699 }
2700
2701 module.exports = isNode;
2702
2703/***/ }),
2704/* 20 */
2705/***/ (function(module, exports, __webpack_require__) {
2706
2707 /* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.3.2
2708 * react-dom.development.js
2709 *
2710 * Copyright (c) 2013-present, Facebook, Inc.
2711 *
2712 * This source code is licensed under the MIT license found in the
2713 * LICENSE file in the root directory of this source tree.
2714 */
2715
2716 'use strict';
2717
2718
2719
2720 if (process.env.NODE_ENV !== "production") {
2721 (function() {
2722 'use strict';
2723
2724 var invariant = __webpack_require__(5);
2725 var React = __webpack_require__(1);
2726 var warning = __webpack_require__(9);
2727 var ExecutionEnvironment = __webpack_require__(14);
2728 var _assign = __webpack_require__(4);
2729 var emptyFunction = __webpack_require__(7);
2730 var checkPropTypes = __webpack_require__(10);
2731 var getActiveElement = __webpack_require__(15);
2732 var shallowEqual = __webpack_require__(16);
2733 var containsNode = __webpack_require__(17);
2734 var emptyObject = __webpack_require__(6);
2735 var hyphenateStyleName = __webpack_require__(21);
2736 var camelizeStyleName = __webpack_require__(23);
2737
2738 // Relying on the `invariant()` implementation lets us
2739 // have preserve the format and params in the www builds.
2740
2741 !React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
2742
2743 var invokeGuardedCallback = function (name, func, context, a, b, c, d, e, f) {
2744 this._hasCaughtError = false;
2745 this._caughtError = null;
2746 var funcArgs = Array.prototype.slice.call(arguments, 3);
2747 try {
2748 func.apply(context, funcArgs);
2749 } catch (error) {
2750 this._caughtError = error;
2751 this._hasCaughtError = true;
2752 }
2753 };
2754
2755 {
2756 // In DEV mode, we swap out invokeGuardedCallback for a special version
2757 // that plays more nicely with the browser's DevTools. The idea is to preserve
2758 // "Pause on exceptions" behavior. Because React wraps all user-provided
2759 // functions in invokeGuardedCallback, and the production version of
2760 // invokeGuardedCallback uses a try-catch, all user exceptions are treated
2761 // like caught exceptions, and the DevTools won't pause unless the developer
2762 // takes the extra step of enabling pause on caught exceptions. This is
2763 // untintuitive, though, because even though React has caught the error, from
2764 // the developer's perspective, the error is uncaught.
2765 //
2766 // To preserve the expected "Pause on exceptions" behavior, we don't use a
2767 // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
2768 // DOM node, and call the user-provided callback from inside an event handler
2769 // for that fake event. If the callback throws, the error is "captured" using
2770 // a global event handler. But because the error happens in a different
2771 // event loop context, it does not interrupt the normal program flow.
2772 // Effectively, this gives us try-catch behavior without actually using
2773 // try-catch. Neat!
2774
2775 // Check that the browser supports the APIs we need to implement our special
2776 // DEV version of invokeGuardedCallback
2777 if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
2778 var fakeNode = document.createElement('react');
2779
2780 var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
2781 // If document doesn't exist we know for sure we will crash in this method
2782 // when we call document.createEvent(). However this can cause confusing
2783 // errors: https://github.com/facebookincubator/create-react-app/issues/3482
2784 // So we preemptively throw with a better message instead.
2785 !(typeof document !== 'undefined') ? invariant(false, 'The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.') : void 0;
2786 var evt = document.createEvent('Event');
2787
2788 // Keeps track of whether the user-provided callback threw an error. We
2789 // set this to true at the beginning, then set it to false right after
2790 // calling the function. If the function errors, `didError` will never be
2791 // set to false. This strategy works even if the browser is flaky and
2792 // fails to call our global error handler, because it doesn't rely on
2793 // the error event at all.
2794 var didError = true;
2795
2796 // Create an event handler for our fake event. We will synchronously
2797 // dispatch our fake event using `dispatchEvent`. Inside the handler, we
2798 // call the user-provided callback.
2799 var funcArgs = Array.prototype.slice.call(arguments, 3);
2800 function callCallback() {
2801 // We immediately remove the callback from event listeners so that
2802 // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
2803 // nested call would trigger the fake event handlers of any call higher
2804 // in the stack.
2805 fakeNode.removeEventListener(evtType, callCallback, false);
2806 func.apply(context, funcArgs);
2807 didError = false;
2808 }
2809
2810 // Create a global error event handler. We use this to capture the value
2811 // that was thrown. It's possible that this error handler will fire more
2812 // than once; for example, if non-React code also calls `dispatchEvent`
2813 // and a handler for that event throws. We should be resilient to most of
2814 // those cases. Even if our error event handler fires more than once, the
2815 // last error event is always used. If the callback actually does error,
2816 // we know that the last error event is the correct one, because it's not
2817 // possible for anything else to have happened in between our callback
2818 // erroring and the code that follows the `dispatchEvent` call below. If
2819 // the callback doesn't error, but the error event was fired, we know to
2820 // ignore it because `didError` will be false, as described above.
2821 var error = void 0;
2822 // Use this to track whether the error event is ever called.
2823 var didSetError = false;
2824 var isCrossOriginError = false;
2825
2826 function onError(event) {
2827 error = event.error;
2828 didSetError = true;
2829 if (error === null && event.colno === 0 && event.lineno === 0) {
2830 isCrossOriginError = true;
2831 }
2832 }
2833
2834 // Create a fake event type.
2835 var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
2836
2837 // Attach our event handlers
2838 window.addEventListener('error', onError);
2839 fakeNode.addEventListener(evtType, callCallback, false);
2840
2841 // Synchronously dispatch our fake event. If the user-provided function
2842 // errors, it will trigger our global error handler.
2843 evt.initEvent(evtType, false, false);
2844 fakeNode.dispatchEvent(evt);
2845
2846 if (didError) {
2847 if (!didSetError) {
2848 // The callback errored, but the error event never fired.
2849 error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
2850 } else if (isCrossOriginError) {
2851 error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
2852 }
2853 this._hasCaughtError = true;
2854 this._caughtError = error;
2855 } else {
2856 this._hasCaughtError = false;
2857 this._caughtError = null;
2858 }
2859
2860 // Remove our event listeners
2861 window.removeEventListener('error', onError);
2862 };
2863
2864 invokeGuardedCallback = invokeGuardedCallbackDev;
2865 }
2866 }
2867
2868 var invokeGuardedCallback$1 = invokeGuardedCallback;
2869
2870 var ReactErrorUtils = {
2871 // Used by Fiber to simulate a try-catch.
2872 _caughtError: null,
2873 _hasCaughtError: false,
2874
2875 // Used by event system to capture/rethrow the first error.
2876 _rethrowError: null,
2877 _hasRethrowError: false,
2878
2879 /**
2880 * Call a function while guarding against errors that happens within it.
2881 * Returns an error if it throws, otherwise null.
2882 *
2883 * In production, this is implemented using a try-catch. The reason we don't
2884 * use a try-catch directly is so that we can swap out a different
2885 * implementation in DEV mode.
2886 *
2887 * @param {String} name of the guard to use for logging or debugging
2888 * @param {Function} func The function to invoke
2889 * @param {*} context The context to use when calling the function
2890 * @param {...*} args Arguments for function
2891 */
2892 invokeGuardedCallback: function (name, func, context, a, b, c, d, e, f) {
2893 invokeGuardedCallback$1.apply(ReactErrorUtils, arguments);
2894 },
2895
2896 /**
2897 * Same as invokeGuardedCallback, but instead of returning an error, it stores
2898 * it in a global so it can be rethrown by `rethrowCaughtError` later.
2899 * TODO: See if _caughtError and _rethrowError can be unified.
2900 *
2901 * @param {String} name of the guard to use for logging or debugging
2902 * @param {Function} func The function to invoke
2903 * @param {*} context The context to use when calling the function
2904 * @param {...*} args Arguments for function
2905 */
2906 invokeGuardedCallbackAndCatchFirstError: function (name, func, context, a, b, c, d, e, f) {
2907 ReactErrorUtils.invokeGuardedCallback.apply(this, arguments);
2908 if (ReactErrorUtils.hasCaughtError()) {
2909 var error = ReactErrorUtils.clearCaughtError();
2910 if (!ReactErrorUtils._hasRethrowError) {
2911 ReactErrorUtils._hasRethrowError = true;
2912 ReactErrorUtils._rethrowError = error;
2913 }
2914 }
2915 },
2916
2917 /**
2918 * During execution of guarded functions we will capture the first error which
2919 * we will rethrow to be handled by the top level error handler.
2920 */
2921 rethrowCaughtError: function () {
2922 return rethrowCaughtError.apply(ReactErrorUtils, arguments);
2923 },
2924
2925 hasCaughtError: function () {
2926 return ReactErrorUtils._hasCaughtError;
2927 },
2928
2929 clearCaughtError: function () {
2930 if (ReactErrorUtils._hasCaughtError) {
2931 var error = ReactErrorUtils._caughtError;
2932 ReactErrorUtils._caughtError = null;
2933 ReactErrorUtils._hasCaughtError = false;
2934 return error;
2935 } else {
2936 invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
2937 }
2938 }
2939 };
2940
2941 var rethrowCaughtError = function () {
2942 if (ReactErrorUtils._hasRethrowError) {
2943 var error = ReactErrorUtils._rethrowError;
2944 ReactErrorUtils._rethrowError = null;
2945 ReactErrorUtils._hasRethrowError = false;
2946 throw error;
2947 }
2948 };
2949
2950 /**
2951 * Injectable ordering of event plugins.
2952 */
2953 var eventPluginOrder = null;
2954
2955 /**
2956 * Injectable mapping from names to event plugin modules.
2957 */
2958 var namesToPlugins = {};
2959
2960 /**
2961 * Recomputes the plugin list using the injected plugins and plugin ordering.
2962 *
2963 * @private
2964 */
2965 function recomputePluginOrdering() {
2966 if (!eventPluginOrder) {
2967 // Wait until an `eventPluginOrder` is injected.
2968 return;
2969 }
2970 for (var pluginName in namesToPlugins) {
2971 var pluginModule = namesToPlugins[pluginName];
2972 var pluginIndex = eventPluginOrder.indexOf(pluginName);
2973 !(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
2974 if (plugins[pluginIndex]) {
2975 continue;
2976 }
2977 !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
2978 plugins[pluginIndex] = pluginModule;
2979 var publishedEvents = pluginModule.eventTypes;
2980 for (var eventName in publishedEvents) {
2981 !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0;
2982 }
2983 }
2984 }
2985
2986 /**
2987 * Publishes an event so that it can be dispatched by the supplied plugin.
2988 *
2989 * @param {object} dispatchConfig Dispatch configuration for the event.
2990 * @param {object} PluginModule Plugin publishing the event.
2991 * @return {boolean} True if the event was successfully published.
2992 * @private
2993 */
2994 function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
2995 !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
2996 eventNameDispatchConfigs[eventName] = dispatchConfig;
2997
2998 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
2999 if (phasedRegistrationNames) {
3000 for (var phaseName in phasedRegistrationNames) {
3001 if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
3002 var phasedRegistrationName = phasedRegistrationNames[phaseName];
3003 publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
3004 }
3005 }
3006 return true;
3007 } else if (dispatchConfig.registrationName) {
3008 publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
3009 return true;
3010 }
3011 return false;
3012 }
3013
3014 /**
3015 * Publishes a registration name that is used to identify dispatched events.
3016 *
3017 * @param {string} registrationName Registration name to add.
3018 * @param {object} PluginModule Plugin publishing the event.
3019 * @private
3020 */
3021 function publishRegistrationName(registrationName, pluginModule, eventName) {
3022 !!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0;
3023 registrationNameModules[registrationName] = pluginModule;
3024 registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
3025
3026 {
3027 var lowerCasedName = registrationName.toLowerCase();
3028 possibleRegistrationNames[lowerCasedName] = registrationName;
3029
3030 if (registrationName === 'onDoubleClick') {
3031 possibleRegistrationNames.ondblclick = registrationName;
3032 }
3033 }
3034 }
3035
3036 /**
3037 * Registers plugins so that they can extract and dispatch events.
3038 *
3039 * @see {EventPluginHub}
3040 */
3041
3042 /**
3043 * Ordered list of injected plugins.
3044 */
3045 var plugins = [];
3046
3047 /**
3048 * Mapping from event name to dispatch config
3049 */
3050 var eventNameDispatchConfigs = {};
3051
3052 /**
3053 * Mapping from registration name to plugin module
3054 */
3055 var registrationNameModules = {};
3056
3057 /**
3058 * Mapping from registration name to event name
3059 */
3060 var registrationNameDependencies = {};
3061
3062 /**
3063 * Mapping from lowercase registration names to the properly cased version,
3064 * used to warn in the case of missing event handlers. Available
3065 * only in true.
3066 * @type {Object}
3067 */
3068 var possibleRegistrationNames = {};
3069 // Trust the developer to only use possibleRegistrationNames in true
3070
3071 /**
3072 * Injects an ordering of plugins (by plugin name). This allows the ordering
3073 * to be decoupled from injection of the actual plugins so that ordering is
3074 * always deterministic regardless of packaging, on-the-fly injection, etc.
3075 *
3076 * @param {array} InjectedEventPluginOrder
3077 * @internal
3078 * @see {EventPluginHub.injection.injectEventPluginOrder}
3079 */
3080 function injectEventPluginOrder(injectedEventPluginOrder) {
3081 !!eventPluginOrder ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0;
3082 // Clone the ordering so it cannot be dynamically mutated.
3083 eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
3084 recomputePluginOrdering();
3085 }
3086
3087 /**
3088 * Injects plugins to be used by `EventPluginHub`. The plugin names must be
3089 * in the ordering injected by `injectEventPluginOrder`.
3090 *
3091 * Plugins can be injected as part of page initialization or on-the-fly.
3092 *
3093 * @param {object} injectedNamesToPlugins Map from names to plugin modules.
3094 * @internal
3095 * @see {EventPluginHub.injection.injectEventPluginsByName}
3096 */
3097 function injectEventPluginsByName(injectedNamesToPlugins) {
3098 var isOrderingDirty = false;
3099 for (var pluginName in injectedNamesToPlugins) {
3100 if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
3101 continue;
3102 }
3103 var pluginModule = injectedNamesToPlugins[pluginName];
3104 if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
3105 !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0;
3106 namesToPlugins[pluginName] = pluginModule;
3107 isOrderingDirty = true;
3108 }
3109 }
3110 if (isOrderingDirty) {
3111 recomputePluginOrdering();
3112 }
3113 }
3114
3115 var EventPluginRegistry = Object.freeze({
3116 plugins: plugins,
3117 eventNameDispatchConfigs: eventNameDispatchConfigs,
3118 registrationNameModules: registrationNameModules,
3119 registrationNameDependencies: registrationNameDependencies,
3120 possibleRegistrationNames: possibleRegistrationNames,
3121 injectEventPluginOrder: injectEventPluginOrder,
3122 injectEventPluginsByName: injectEventPluginsByName
3123 });
3124
3125 var getFiberCurrentPropsFromNode = null;
3126 var getInstanceFromNode = null;
3127 var getNodeFromInstance = null;
3128
3129 var injection$1 = {
3130 injectComponentTree: function (Injected) {
3131 getFiberCurrentPropsFromNode = Injected.getFiberCurrentPropsFromNode;
3132 getInstanceFromNode = Injected.getInstanceFromNode;
3133 getNodeFromInstance = Injected.getNodeFromInstance;
3134
3135 {
3136 !(getNodeFromInstance && getInstanceFromNode) ? warning(false, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
3137 }
3138 }
3139 };
3140
3141
3142
3143
3144
3145
3146 var validateEventDispatches = void 0;
3147 {
3148 validateEventDispatches = function (event) {
3149 var dispatchListeners = event._dispatchListeners;
3150 var dispatchInstances = event._dispatchInstances;
3151
3152 var listenersIsArr = Array.isArray(dispatchListeners);
3153 var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
3154
3155 var instancesIsArr = Array.isArray(dispatchInstances);
3156 var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
3157
3158 !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warning(false, 'EventPluginUtils: Invalid `event`.') : void 0;
3159 };
3160 }
3161
3162 /**
3163 * Dispatch the event to the listener.
3164 * @param {SyntheticEvent} event SyntheticEvent to handle
3165 * @param {boolean} simulated If the event is simulated (changes exn behavior)
3166 * @param {function} listener Application-level callback
3167 * @param {*} inst Internal component instance
3168 */
3169 function executeDispatch(event, simulated, listener, inst) {
3170 var type = event.type || 'unknown-event';
3171 event.currentTarget = getNodeFromInstance(inst);
3172 ReactErrorUtils.invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
3173 event.currentTarget = null;
3174 }
3175
3176 /**
3177 * Standard/simple iteration through an event's collected dispatches.
3178 */
3179 function executeDispatchesInOrder(event, simulated) {
3180 var dispatchListeners = event._dispatchListeners;
3181 var dispatchInstances = event._dispatchInstances;
3182 {
3183 validateEventDispatches(event);
3184 }
3185 if (Array.isArray(dispatchListeners)) {
3186 for (var i = 0; i < dispatchListeners.length; i++) {
3187 if (event.isPropagationStopped()) {
3188 break;
3189 }
3190 // Listeners and Instances are two parallel arrays that are always in sync.
3191 executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]);
3192 }
3193 } else if (dispatchListeners) {
3194 executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
3195 }
3196 event._dispatchListeners = null;
3197 event._dispatchInstances = null;
3198 }
3199
3200 /**
3201 * @see executeDispatchesInOrderStopAtTrueImpl
3202 */
3203
3204
3205 /**
3206 * Execution of a "direct" dispatch - there must be at most one dispatch
3207 * accumulated on the event or it is considered an error. It doesn't really make
3208 * sense for an event with multiple dispatches (bubbled) to keep track of the
3209 * return values at each dispatch execution, but it does tend to make sense when
3210 * dealing with "direct" dispatches.
3211 *
3212 * @return {*} The return value of executing the single dispatch.
3213 */
3214
3215
3216 /**
3217 * @param {SyntheticEvent} event
3218 * @return {boolean} True iff number of dispatches accumulated is greater than 0.
3219 */
3220
3221 /**
3222 * Accumulates items that must not be null or undefined into the first one. This
3223 * is used to conserve memory by avoiding array allocations, and thus sacrifices
3224 * API cleanness. Since `current` can be null before being passed in and not
3225 * null after this function, make sure to assign it back to `current`:
3226 *
3227 * `a = accumulateInto(a, b);`
3228 *
3229 * This API should be sparingly used. Try `accumulate` for something cleaner.
3230 *
3231 * @return {*|array<*>} An accumulation of items.
3232 */
3233
3234 function accumulateInto(current, next) {
3235 !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0;
3236
3237 if (current == null) {
3238 return next;
3239 }
3240
3241 // Both are not empty. Warning: Never call x.concat(y) when you are not
3242 // certain that x is an Array (x could be a string with concat method).
3243 if (Array.isArray(current)) {
3244 if (Array.isArray(next)) {
3245 current.push.apply(current, next);
3246 return current;
3247 }
3248 current.push(next);
3249 return current;
3250 }
3251
3252 if (Array.isArray(next)) {
3253 // A bit too dangerous to mutate `next`.
3254 return [current].concat(next);
3255 }
3256
3257 return [current, next];
3258 }
3259
3260 /**
3261 * @param {array} arr an "accumulation" of items which is either an Array or
3262 * a single item. Useful when paired with the `accumulate` module. This is a
3263 * simple utility that allows us to reason about a collection of items, but
3264 * handling the case when there is exactly one item (and we do not need to
3265 * allocate an array).
3266 * @param {function} cb Callback invoked with each element or a collection.
3267 * @param {?} [scope] Scope used as `this` in a callback.
3268 */
3269 function forEachAccumulated(arr, cb, scope) {
3270 if (Array.isArray(arr)) {
3271 arr.forEach(cb, scope);
3272 } else if (arr) {
3273 cb.call(scope, arr);
3274 }
3275 }
3276
3277 /**
3278 * Internal queue of events that have accumulated their dispatches and are
3279 * waiting to have their dispatches executed.
3280 */
3281 var eventQueue = null;
3282
3283 /**
3284 * Dispatches an event and releases it back into the pool, unless persistent.
3285 *
3286 * @param {?object} event Synthetic event to be dispatched.
3287 * @param {boolean} simulated If the event is simulated (changes exn behavior)
3288 * @private
3289 */
3290 var executeDispatchesAndRelease = function (event, simulated) {
3291 if (event) {
3292 executeDispatchesInOrder(event, simulated);
3293
3294 if (!event.isPersistent()) {
3295 event.constructor.release(event);
3296 }
3297 }
3298 };
3299 var executeDispatchesAndReleaseSimulated = function (e) {
3300 return executeDispatchesAndRelease(e, true);
3301 };
3302 var executeDispatchesAndReleaseTopLevel = function (e) {
3303 return executeDispatchesAndRelease(e, false);
3304 };
3305
3306 function isInteractive(tag) {
3307 return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
3308 }
3309
3310 function shouldPreventMouseEvent(name, type, props) {
3311 switch (name) {
3312 case 'onClick':
3313 case 'onClickCapture':
3314 case 'onDoubleClick':
3315 case 'onDoubleClickCapture':
3316 case 'onMouseDown':
3317 case 'onMouseDownCapture':
3318 case 'onMouseMove':
3319 case 'onMouseMoveCapture':
3320 case 'onMouseUp':
3321 case 'onMouseUpCapture':
3322 return !!(props.disabled && isInteractive(type));
3323 default:
3324 return false;
3325 }
3326 }
3327
3328 /**
3329 * This is a unified interface for event plugins to be installed and configured.
3330 *
3331 * Event plugins can implement the following properties:
3332 *
3333 * `extractEvents` {function(string, DOMEventTarget, string, object): *}
3334 * Required. When a top-level event is fired, this method is expected to
3335 * extract synthetic events that will in turn be queued and dispatched.
3336 *
3337 * `eventTypes` {object}
3338 * Optional, plugins that fire events must publish a mapping of registration
3339 * names that are used to register listeners. Values of this mapping must
3340 * be objects that contain `registrationName` or `phasedRegistrationNames`.
3341 *
3342 * `executeDispatch` {function(object, function, string)}
3343 * Optional, allows plugins to override how an event gets dispatched. By
3344 * default, the listener is simply invoked.
3345 *
3346 * Each plugin that is injected into `EventsPluginHub` is immediately operable.
3347 *
3348 * @public
3349 */
3350
3351 /**
3352 * Methods for injecting dependencies.
3353 */
3354 var injection = {
3355 /**
3356 * @param {array} InjectedEventPluginOrder
3357 * @public
3358 */
3359 injectEventPluginOrder: injectEventPluginOrder,
3360
3361 /**
3362 * @param {object} injectedNamesToPlugins Map from names to plugin modules.
3363 */
3364 injectEventPluginsByName: injectEventPluginsByName
3365 };
3366
3367 /**
3368 * @param {object} inst The instance, which is the source of events.
3369 * @param {string} registrationName Name of listener (e.g. `onClick`).
3370 * @return {?function} The stored callback.
3371 */
3372 function getListener(inst, registrationName) {
3373 var listener = void 0;
3374
3375 // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
3376 // live here; needs to be moved to a better place soon
3377 var stateNode = inst.stateNode;
3378 if (!stateNode) {
3379 // Work in progress (ex: onload events in incremental mode).
3380 return null;
3381 }
3382 var props = getFiberCurrentPropsFromNode(stateNode);
3383 if (!props) {
3384 // Work in progress.
3385 return null;
3386 }
3387 listener = props[registrationName];
3388 if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
3389 return null;
3390 }
3391 !(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0;
3392 return listener;
3393 }
3394
3395 /**
3396 * Allows registered plugins an opportunity to extract events from top-level
3397 * native browser events.
3398 *
3399 * @return {*} An accumulation of synthetic events.
3400 * @internal
3401 */
3402 function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
3403 var events = null;
3404 for (var i = 0; i < plugins.length; i++) {
3405 // Not every plugin in the ordering may be loaded at runtime.
3406 var possiblePlugin = plugins[i];
3407 if (possiblePlugin) {
3408 var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
3409 if (extractedEvents) {
3410 events = accumulateInto(events, extractedEvents);
3411 }
3412 }
3413 }
3414 return events;
3415 }
3416
3417 function runEventsInBatch(events, simulated) {
3418 if (events !== null) {
3419 eventQueue = accumulateInto(eventQueue, events);
3420 }
3421
3422 // Set `eventQueue` to null before processing it so that we can tell if more
3423 // events get enqueued while processing.
3424 var processingEventQueue = eventQueue;
3425 eventQueue = null;
3426
3427 if (!processingEventQueue) {
3428 return;
3429 }
3430
3431 if (simulated) {
3432 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
3433 } else {
3434 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
3435 }
3436 !!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0;
3437 // This would be a good time to rethrow if any of the event handlers threw.
3438 ReactErrorUtils.rethrowCaughtError();
3439 }
3440
3441 function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
3442 var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
3443 runEventsInBatch(events, false);
3444 }
3445
3446 var EventPluginHub = Object.freeze({
3447 injection: injection,
3448 getListener: getListener,
3449 runEventsInBatch: runEventsInBatch,
3450 runExtractedEventsInBatch: runExtractedEventsInBatch
3451 });
3452
3453 var IndeterminateComponent = 0; // Before we know whether it is functional or class
3454 var FunctionalComponent = 1;
3455 var ClassComponent = 2;
3456 var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
3457 var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
3458 var HostComponent = 5;
3459 var HostText = 6;
3460 var CallComponent = 7;
3461 var CallHandlerPhase = 8;
3462 var ReturnComponent = 9;
3463 var Fragment = 10;
3464 var Mode = 11;
3465 var ContextConsumer = 12;
3466 var ContextProvider = 13;
3467 var ForwardRef = 14;
3468
3469 var randomKey = Math.random().toString(36).slice(2);
3470 var internalInstanceKey = '__reactInternalInstance$' + randomKey;
3471 var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
3472
3473 function precacheFiberNode$1(hostInst, node) {
3474 node[internalInstanceKey] = hostInst;
3475 }
3476
3477 /**
3478 * Given a DOM node, return the closest ReactDOMComponent or
3479 * ReactDOMTextComponent instance ancestor.
3480 */
3481 function getClosestInstanceFromNode(node) {
3482 if (node[internalInstanceKey]) {
3483 return node[internalInstanceKey];
3484 }
3485
3486 while (!node[internalInstanceKey]) {
3487 if (node.parentNode) {
3488 node = node.parentNode;
3489 } else {
3490 // Top of the tree. This node must not be part of a React tree (or is
3491 // unmounted, potentially).
3492 return null;
3493 }
3494 }
3495
3496 var inst = node[internalInstanceKey];
3497 if (inst.tag === HostComponent || inst.tag === HostText) {
3498 // In Fiber, this will always be the deepest root.
3499 return inst;
3500 }
3501
3502 return null;
3503 }
3504
3505 /**
3506 * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
3507 * instance, or null if the node was not rendered by this React.
3508 */
3509 function getInstanceFromNode$1(node) {
3510 var inst = node[internalInstanceKey];
3511 if (inst) {
3512 if (inst.tag === HostComponent || inst.tag === HostText) {
3513 return inst;
3514 } else {
3515 return null;
3516 }
3517 }
3518 return null;
3519 }
3520
3521 /**
3522 * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
3523 * DOM node.
3524 */
3525 function getNodeFromInstance$1(inst) {
3526 if (inst.tag === HostComponent || inst.tag === HostText) {
3527 // In Fiber this, is just the state node right now. We assume it will be
3528 // a host component or host text.
3529 return inst.stateNode;
3530 }
3531
3532 // Without this first invariant, passing a non-DOM-component triggers the next
3533 // invariant for a missing parent, which is super confusing.
3534 invariant(false, 'getNodeFromInstance: Invalid argument.');
3535 }
3536
3537 function getFiberCurrentPropsFromNode$1(node) {
3538 return node[internalEventHandlersKey] || null;
3539 }
3540
3541 function updateFiberProps$1(node, props) {
3542 node[internalEventHandlersKey] = props;
3543 }
3544
3545 var ReactDOMComponentTree = Object.freeze({
3546 precacheFiberNode: precacheFiberNode$1,
3547 getClosestInstanceFromNode: getClosestInstanceFromNode,
3548 getInstanceFromNode: getInstanceFromNode$1,
3549 getNodeFromInstance: getNodeFromInstance$1,
3550 getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode$1,
3551 updateFiberProps: updateFiberProps$1
3552 });
3553
3554 function getParent(inst) {
3555 do {
3556 inst = inst['return'];
3557 // TODO: If this is a HostRoot we might want to bail out.
3558 // That is depending on if we want nested subtrees (layers) to bubble
3559 // events to their parent. We could also go through parentNode on the
3560 // host node but that wouldn't work for React Native and doesn't let us
3561 // do the portal feature.
3562 } while (inst && inst.tag !== HostComponent);
3563 if (inst) {
3564 return inst;
3565 }
3566 return null;
3567 }
3568
3569 /**
3570 * Return the lowest common ancestor of A and B, or null if they are in
3571 * different trees.
3572 */
3573 function getLowestCommonAncestor(instA, instB) {
3574 var depthA = 0;
3575 for (var tempA = instA; tempA; tempA = getParent(tempA)) {
3576 depthA++;
3577 }
3578 var depthB = 0;
3579 for (var tempB = instB; tempB; tempB = getParent(tempB)) {
3580 depthB++;
3581 }
3582
3583 // If A is deeper, crawl up.
3584 while (depthA - depthB > 0) {
3585 instA = getParent(instA);
3586 depthA--;
3587 }
3588
3589 // If B is deeper, crawl up.
3590 while (depthB - depthA > 0) {
3591 instB = getParent(instB);
3592 depthB--;
3593 }
3594
3595 // Walk in lockstep until we find a match.
3596 var depth = depthA;
3597 while (depth--) {
3598 if (instA === instB || instA === instB.alternate) {
3599 return instA;
3600 }
3601 instA = getParent(instA);
3602 instB = getParent(instB);
3603 }
3604 return null;
3605 }
3606
3607 /**
3608 * Return if A is an ancestor of B.
3609 */
3610
3611
3612 /**
3613 * Return the parent instance of the passed-in instance.
3614 */
3615 function getParentInstance(inst) {
3616 return getParent(inst);
3617 }
3618
3619 /**
3620 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
3621 */
3622 function traverseTwoPhase(inst, fn, arg) {
3623 var path = [];
3624 while (inst) {
3625 path.push(inst);
3626 inst = getParent(inst);
3627 }
3628 var i = void 0;
3629 for (i = path.length; i-- > 0;) {
3630 fn(path[i], 'captured', arg);
3631 }
3632 for (i = 0; i < path.length; i++) {
3633 fn(path[i], 'bubbled', arg);
3634 }
3635 }
3636
3637 /**
3638 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
3639 * should would receive a `mouseEnter` or `mouseLeave` event.
3640 *
3641 * Does not invoke the callback on the nearest common ancestor because nothing
3642 * "entered" or "left" that element.
3643 */
3644 function traverseEnterLeave(from, to, fn, argFrom, argTo) {
3645 var common = from && to ? getLowestCommonAncestor(from, to) : null;
3646 var pathFrom = [];
3647 while (true) {
3648 if (!from) {
3649 break;
3650 }
3651 if (from === common) {
3652 break;
3653 }
3654 var alternate = from.alternate;
3655 if (alternate !== null && alternate === common) {
3656 break;
3657 }
3658 pathFrom.push(from);
3659 from = getParent(from);
3660 }
3661 var pathTo = [];
3662 while (true) {
3663 if (!to) {
3664 break;
3665 }
3666 if (to === common) {
3667 break;
3668 }
3669 var _alternate = to.alternate;
3670 if (_alternate !== null && _alternate === common) {
3671 break;
3672 }
3673 pathTo.push(to);
3674 to = getParent(to);
3675 }
3676 for (var i = 0; i < pathFrom.length; i++) {
3677 fn(pathFrom[i], 'bubbled', argFrom);
3678 }
3679 for (var _i = pathTo.length; _i-- > 0;) {
3680 fn(pathTo[_i], 'captured', argTo);
3681 }
3682 }
3683
3684 /**
3685 * Some event types have a notion of different registration names for different
3686 * "phases" of propagation. This finds listeners by a given phase.
3687 */
3688 function listenerAtPhase(inst, event, propagationPhase) {
3689 var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
3690 return getListener(inst, registrationName);
3691 }
3692
3693 /**
3694 * A small set of propagation patterns, each of which will accept a small amount
3695 * of information, and generate a set of "dispatch ready event objects" - which
3696 * are sets of events that have already been annotated with a set of dispatched
3697 * listener functions/ids. The API is designed this way to discourage these
3698 * propagation strategies from actually executing the dispatches, since we
3699 * always want to collect the entire set of dispatches before executing even a
3700 * single one.
3701 */
3702
3703 /**
3704 * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
3705 * here, allows us to not have to bind or create functions for each event.
3706 * Mutating the event's members allows us to not have to create a wrapping
3707 * "dispatch" object that pairs the event with the listener.
3708 */
3709 function accumulateDirectionalDispatches(inst, phase, event) {
3710 {
3711 !inst ? warning(false, 'Dispatching inst must not be null') : void 0;
3712 }
3713 var listener = listenerAtPhase(inst, event, phase);
3714 if (listener) {
3715 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
3716 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
3717 }
3718 }
3719
3720 /**
3721 * Collect dispatches (must be entirely collected before dispatching - see unit
3722 * tests). Lazily allocate the array to conserve memory. We must loop through
3723 * each event and perform the traversal for each one. We cannot perform a
3724 * single traversal for the entire collection of events because each event may
3725 * have a different target.
3726 */
3727 function accumulateTwoPhaseDispatchesSingle(event) {
3728 if (event && event.dispatchConfig.phasedRegistrationNames) {
3729 traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
3730 }
3731 }
3732
3733 /**
3734 * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
3735 */
3736 function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
3737 if (event && event.dispatchConfig.phasedRegistrationNames) {
3738 var targetInst = event._targetInst;
3739 var parentInst = targetInst ? getParentInstance(targetInst) : null;
3740 traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
3741 }
3742 }
3743
3744 /**
3745 * Accumulates without regard to direction, does not look for phased
3746 * registration names. Same as `accumulateDirectDispatchesSingle` but without
3747 * requiring that the `dispatchMarker` be the same as the dispatched ID.
3748 */
3749 function accumulateDispatches(inst, ignoredDirection, event) {
3750 if (inst && event && event.dispatchConfig.registrationName) {
3751 var registrationName = event.dispatchConfig.registrationName;
3752 var listener = getListener(inst, registrationName);
3753 if (listener) {
3754 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
3755 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
3756 }
3757 }
3758 }
3759
3760 /**
3761 * Accumulates dispatches on an `SyntheticEvent`, but only for the
3762 * `dispatchMarker`.
3763 * @param {SyntheticEvent} event
3764 */
3765 function accumulateDirectDispatchesSingle(event) {
3766 if (event && event.dispatchConfig.registrationName) {
3767 accumulateDispatches(event._targetInst, null, event);
3768 }
3769 }
3770
3771 function accumulateTwoPhaseDispatches(events) {
3772 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
3773 }
3774
3775 function accumulateTwoPhaseDispatchesSkipTarget(events) {
3776 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
3777 }
3778
3779 function accumulateEnterLeaveDispatches(leave, enter, from, to) {
3780 traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
3781 }
3782
3783 function accumulateDirectDispatches(events) {
3784 forEachAccumulated(events, accumulateDirectDispatchesSingle);
3785 }
3786
3787 var EventPropagators = Object.freeze({
3788 accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
3789 accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
3790 accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches,
3791 accumulateDirectDispatches: accumulateDirectDispatches
3792 });
3793
3794 var contentKey = null;
3795
3796 /**
3797 * Gets the key used to access text content on a DOM node.
3798 *
3799 * @return {?string} Key used to access text content.
3800 * @internal
3801 */
3802 function getTextContentAccessor() {
3803 if (!contentKey && ExecutionEnvironment.canUseDOM) {
3804 // Prefer textContent to innerText because many browsers support both but
3805 // SVG <text> elements don't support innerText even when <div> does.
3806 contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
3807 }
3808 return contentKey;
3809 }
3810
3811 /**
3812 * This helper object stores information about text content of a target node,
3813 * allowing comparison of content before and after a given event.
3814 *
3815 * Identify the node where selection currently begins, then observe
3816 * both its text content and its current position in the DOM. Since the
3817 * browser may natively replace the target node during composition, we can
3818 * use its position to find its replacement.
3819 *
3820 *
3821 */
3822 var compositionState = {
3823 _root: null,
3824 _startText: null,
3825 _fallbackText: null
3826 };
3827
3828 function initialize(nativeEventTarget) {
3829 compositionState._root = nativeEventTarget;
3830 compositionState._startText = getText();
3831 return true;
3832 }
3833
3834 function reset() {
3835 compositionState._root = null;
3836 compositionState._startText = null;
3837 compositionState._fallbackText = null;
3838 }
3839
3840 function getData() {
3841 if (compositionState._fallbackText) {
3842 return compositionState._fallbackText;
3843 }
3844
3845 var start = void 0;
3846 var startValue = compositionState._startText;
3847 var startLength = startValue.length;
3848 var end = void 0;
3849 var endValue = getText();
3850 var endLength = endValue.length;
3851
3852 for (start = 0; start < startLength; start++) {
3853 if (startValue[start] !== endValue[start]) {
3854 break;
3855 }
3856 }
3857
3858 var minEnd = startLength - start;
3859 for (end = 1; end <= minEnd; end++) {
3860 if (startValue[startLength - end] !== endValue[endLength - end]) {
3861 break;
3862 }
3863 }
3864
3865 var sliceTail = end > 1 ? 1 - end : undefined;
3866 compositionState._fallbackText = endValue.slice(start, sliceTail);
3867 return compositionState._fallbackText;
3868 }
3869
3870 function getText() {
3871 if ('value' in compositionState._root) {
3872 return compositionState._root.value;
3873 }
3874 return compositionState._root[getTextContentAccessor()];
3875 }
3876
3877 /* eslint valid-typeof: 0 */
3878
3879 var didWarnForAddedNewProperty = false;
3880 var EVENT_POOL_SIZE = 10;
3881
3882 var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
3883
3884 /**
3885 * @interface Event
3886 * @see http://www.w3.org/TR/DOM-Level-3-Events/
3887 */
3888 var EventInterface = {
3889 type: null,
3890 target: null,
3891 // currentTarget is set when dispatching; no use in copying it here
3892 currentTarget: emptyFunction.thatReturnsNull,
3893 eventPhase: null,
3894 bubbles: null,
3895 cancelable: null,
3896 timeStamp: function (event) {
3897 return event.timeStamp || Date.now();
3898 },
3899 defaultPrevented: null,
3900 isTrusted: null
3901 };
3902
3903 /**
3904 * Synthetic events are dispatched by event plugins, typically in response to a
3905 * top-level event delegation handler.
3906 *
3907 * These systems should generally use pooling to reduce the frequency of garbage
3908 * collection. The system should check `isPersistent` to determine whether the
3909 * event should be released into the pool after being dispatched. Users that
3910 * need a persisted event should invoke `persist`.
3911 *
3912 * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
3913 * normalizing browser quirks. Subclasses do not necessarily have to implement a
3914 * DOM interface; custom application-specific events can also subclass this.
3915 *
3916 * @param {object} dispatchConfig Configuration used to dispatch this event.
3917 * @param {*} targetInst Marker identifying the event target.
3918 * @param {object} nativeEvent Native browser event.
3919 * @param {DOMEventTarget} nativeEventTarget Target node.
3920 */
3921 function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
3922 {
3923 // these have a getter/setter for warnings
3924 delete this.nativeEvent;
3925 delete this.preventDefault;
3926 delete this.stopPropagation;
3927 }
3928
3929 this.dispatchConfig = dispatchConfig;
3930 this._targetInst = targetInst;
3931 this.nativeEvent = nativeEvent;
3932
3933 var Interface = this.constructor.Interface;
3934 for (var propName in Interface) {
3935 if (!Interface.hasOwnProperty(propName)) {
3936 continue;
3937 }
3938 {
3939 delete this[propName]; // this has a getter/setter for warnings
3940 }
3941 var normalize = Interface[propName];
3942 if (normalize) {
3943 this[propName] = normalize(nativeEvent);
3944 } else {
3945 if (propName === 'target') {
3946 this.target = nativeEventTarget;
3947 } else {
3948 this[propName] = nativeEvent[propName];
3949 }
3950 }
3951 }
3952
3953 var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
3954 if (defaultPrevented) {
3955 this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
3956 } else {
3957 this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
3958 }
3959 this.isPropagationStopped = emptyFunction.thatReturnsFalse;
3960 return this;
3961 }
3962
3963 _assign(SyntheticEvent.prototype, {
3964 preventDefault: function () {
3965 this.defaultPrevented = true;
3966 var event = this.nativeEvent;
3967 if (!event) {
3968 return;
3969 }
3970
3971 if (event.preventDefault) {
3972 event.preventDefault();
3973 } else if (typeof event.returnValue !== 'unknown') {
3974 event.returnValue = false;
3975 }
3976 this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
3977 },
3978
3979 stopPropagation: function () {
3980 var event = this.nativeEvent;
3981 if (!event) {
3982 return;
3983 }
3984
3985 if (event.stopPropagation) {
3986 event.stopPropagation();
3987 } else if (typeof event.cancelBubble !== 'unknown') {
3988 // The ChangeEventPlugin registers a "propertychange" event for
3989 // IE. This event does not support bubbling or cancelling, and
3990 // any references to cancelBubble throw "Member not found". A
3991 // typeof check of "unknown" circumvents this issue (and is also
3992 // IE specific).
3993 event.cancelBubble = true;
3994 }
3995
3996 this.isPropagationStopped = emptyFunction.thatReturnsTrue;
3997 },
3998
3999 /**
4000 * We release all dispatched `SyntheticEvent`s after each event loop, adding
4001 * them back into the pool. This allows a way to hold onto a reference that
4002 * won't be added back into the pool.
4003 */
4004 persist: function () {
4005 this.isPersistent = emptyFunction.thatReturnsTrue;
4006 },
4007
4008 /**
4009 * Checks if this event should be released back into the pool.
4010 *
4011 * @return {boolean} True if this should not be released, false otherwise.
4012 */
4013 isPersistent: emptyFunction.thatReturnsFalse,
4014
4015 /**
4016 * `PooledClass` looks for `destructor` on each instance it releases.
4017 */
4018 destructor: function () {
4019 var Interface = this.constructor.Interface;
4020 for (var propName in Interface) {
4021 {
4022 Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
4023 }
4024 }
4025 for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
4026 this[shouldBeReleasedProperties[i]] = null;
4027 }
4028 {
4029 Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
4030 Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
4031 Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
4032 }
4033 }
4034 });
4035
4036 SyntheticEvent.Interface = EventInterface;
4037
4038 /**
4039 * Helper to reduce boilerplate when creating subclasses.
4040 */
4041 SyntheticEvent.extend = function (Interface) {
4042 var Super = this;
4043
4044 var E = function () {};
4045 E.prototype = Super.prototype;
4046 var prototype = new E();
4047
4048 function Class() {
4049 return Super.apply(this, arguments);
4050 }
4051 _assign(prototype, Class.prototype);
4052 Class.prototype = prototype;
4053 Class.prototype.constructor = Class;
4054
4055 Class.Interface = _assign({}, Super.Interface, Interface);
4056 Class.extend = Super.extend;
4057 addEventPoolingTo(Class);
4058
4059 return Class;
4060 };
4061
4062 /** Proxying after everything set on SyntheticEvent
4063 * to resolve Proxy issue on some WebKit browsers
4064 * in which some Event properties are set to undefined (GH#10010)
4065 */
4066 {
4067 var isProxySupported = typeof Proxy === 'function' &&
4068 // https://github.com/facebook/react/issues/12011
4069 !Object.isSealed(new Proxy({}, {}));
4070
4071 if (isProxySupported) {
4072 /*eslint-disable no-func-assign */
4073 SyntheticEvent = new Proxy(SyntheticEvent, {
4074 construct: function (target, args) {
4075 return this.apply(target, Object.create(target.prototype), args);
4076 },
4077 apply: function (constructor, that, args) {
4078 return new Proxy(constructor.apply(that, args), {
4079 set: function (target, prop, value) {
4080 if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
4081 !(didWarnForAddedNewProperty || target.isPersistent()) ? warning(false, "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
4082 didWarnForAddedNewProperty = true;
4083 }
4084 target[prop] = value;
4085 return true;
4086 }
4087 });
4088 }
4089 });
4090 /*eslint-enable no-func-assign */
4091 }
4092 }
4093
4094 addEventPoolingTo(SyntheticEvent);
4095
4096 /**
4097 * Helper to nullify syntheticEvent instance properties when destructing
4098 *
4099 * @param {String} propName
4100 * @param {?object} getVal
4101 * @return {object} defineProperty object
4102 */
4103 function getPooledWarningPropertyDefinition(propName, getVal) {
4104 var isFunction = typeof getVal === 'function';
4105 return {
4106 configurable: true,
4107 set: set,
4108 get: get
4109 };
4110
4111 function set(val) {
4112 var action = isFunction ? 'setting the method' : 'setting the property';
4113 warn(action, 'This is effectively a no-op');
4114 return val;
4115 }
4116
4117 function get() {
4118 var action = isFunction ? 'accessing the method' : 'accessing the property';
4119 var result = isFunction ? 'This is a no-op function' : 'This is set to null';
4120 warn(action, result);
4121 return getVal;
4122 }
4123
4124 function warn(action, result) {
4125 var warningCondition = false;
4126 !warningCondition ? warning(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
4127 }
4128 }
4129
4130 function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
4131 var EventConstructor = this;
4132 if (EventConstructor.eventPool.length) {
4133 var instance = EventConstructor.eventPool.pop();
4134 EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
4135 return instance;
4136 }
4137 return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
4138 }
4139
4140 function releasePooledEvent(event) {
4141 var EventConstructor = this;
4142 !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
4143 event.destructor();
4144 if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
4145 EventConstructor.eventPool.push(event);
4146 }
4147 }
4148
4149 function addEventPoolingTo(EventConstructor) {
4150 EventConstructor.eventPool = [];
4151 EventConstructor.getPooled = getPooledEvent;
4152 EventConstructor.release = releasePooledEvent;
4153 }
4154
4155 var SyntheticEvent$1 = SyntheticEvent;
4156
4157 /**
4158 * @interface Event
4159 * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
4160 */
4161 var SyntheticCompositionEvent = SyntheticEvent$1.extend({
4162 data: null
4163 });
4164
4165 /**
4166 * @interface Event
4167 * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
4168 * /#events-inputevents
4169 */
4170 var SyntheticInputEvent = SyntheticEvent$1.extend({
4171 data: null
4172 });
4173
4174 var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
4175 var START_KEYCODE = 229;
4176
4177 var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
4178
4179 var documentMode = null;
4180 if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
4181 documentMode = document.documentMode;
4182 }
4183
4184 // Webkit offers a very useful `textInput` event that can be used to
4185 // directly represent `beforeInput`. The IE `textinput` event is not as
4186 // useful, so we don't use it.
4187 var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode;
4188
4189 // In IE9+, we have access to composition events, but the data supplied
4190 // by the native compositionend event may be incorrect. Japanese ideographic
4191 // spaces, for instance (\u3000) are not recorded correctly.
4192 var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
4193
4194 var SPACEBAR_CODE = 32;
4195 var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
4196
4197 // Events and their corresponding property names.
4198 var eventTypes = {
4199 beforeInput: {
4200 phasedRegistrationNames: {
4201 bubbled: 'onBeforeInput',
4202 captured: 'onBeforeInputCapture'
4203 },
4204 dependencies: ['topCompositionEnd', 'topKeyPress', 'topTextInput', 'topPaste']
4205 },
4206 compositionEnd: {
4207 phasedRegistrationNames: {
4208 bubbled: 'onCompositionEnd',
4209 captured: 'onCompositionEndCapture'
4210 },
4211 dependencies: ['topBlur', 'topCompositionEnd', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
4212 },
4213 compositionStart: {
4214 phasedRegistrationNames: {
4215 bubbled: 'onCompositionStart',
4216 captured: 'onCompositionStartCapture'
4217 },
4218 dependencies: ['topBlur', 'topCompositionStart', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
4219 },
4220 compositionUpdate: {
4221 phasedRegistrationNames: {
4222 bubbled: 'onCompositionUpdate',
4223 captured: 'onCompositionUpdateCapture'
4224 },
4225 dependencies: ['topBlur', 'topCompositionUpdate', 'topKeyDown', 'topKeyPress', 'topKeyUp', 'topMouseDown']
4226 }
4227 };
4228
4229 // Track whether we've ever handled a keypress on the space key.
4230 var hasSpaceKeypress = false;
4231
4232 /**
4233 * Return whether a native keypress event is assumed to be a command.
4234 * This is required because Firefox fires `keypress` events for key commands
4235 * (cut, copy, select-all, etc.) even though no character is inserted.
4236 */
4237 function isKeypressCommand(nativeEvent) {
4238 return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
4239 // ctrlKey && altKey is equivalent to AltGr, and is not a command.
4240 !(nativeEvent.ctrlKey && nativeEvent.altKey);
4241 }
4242
4243 /**
4244 * Translate native top level events into event types.
4245 *
4246 * @param {string} topLevelType
4247 * @return {object}
4248 */
4249 function getCompositionEventType(topLevelType) {
4250 switch (topLevelType) {
4251 case 'topCompositionStart':
4252 return eventTypes.compositionStart;
4253 case 'topCompositionEnd':
4254 return eventTypes.compositionEnd;
4255 case 'topCompositionUpdate':
4256 return eventTypes.compositionUpdate;
4257 }
4258 }
4259
4260 /**
4261 * Does our fallback best-guess model think this event signifies that
4262 * composition has begun?
4263 *
4264 * @param {string} topLevelType
4265 * @param {object} nativeEvent
4266 * @return {boolean}
4267 */
4268 function isFallbackCompositionStart(topLevelType, nativeEvent) {
4269 return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE;
4270 }
4271
4272 /**
4273 * Does our fallback mode think that this event is the end of composition?
4274 *
4275 * @param {string} topLevelType
4276 * @param {object} nativeEvent
4277 * @return {boolean}
4278 */
4279 function isFallbackCompositionEnd(topLevelType, nativeEvent) {
4280 switch (topLevelType) {
4281 case 'topKeyUp':
4282 // Command keys insert or clear IME input.
4283 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
4284 case 'topKeyDown':
4285 // Expect IME keyCode on each keydown. If we get any other
4286 // code we must have exited earlier.
4287 return nativeEvent.keyCode !== START_KEYCODE;
4288 case 'topKeyPress':
4289 case 'topMouseDown':
4290 case 'topBlur':
4291 // Events are not possible without cancelling IME.
4292 return true;
4293 default:
4294 return false;
4295 }
4296 }
4297
4298 /**
4299 * Google Input Tools provides composition data via a CustomEvent,
4300 * with the `data` property populated in the `detail` object. If this
4301 * is available on the event object, use it. If not, this is a plain
4302 * composition event and we have nothing special to extract.
4303 *
4304 * @param {object} nativeEvent
4305 * @return {?string}
4306 */
4307 function getDataFromCustomEvent(nativeEvent) {
4308 var detail = nativeEvent.detail;
4309 if (typeof detail === 'object' && 'data' in detail) {
4310 return detail.data;
4311 }
4312 return null;
4313 }
4314
4315 // Track the current IME composition status, if any.
4316 var isComposing = false;
4317
4318 /**
4319 * @return {?object} A SyntheticCompositionEvent.
4320 */
4321 function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
4322 var eventType = void 0;
4323 var fallbackData = void 0;
4324
4325 if (canUseCompositionEvent) {
4326 eventType = getCompositionEventType(topLevelType);
4327 } else if (!isComposing) {
4328 if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
4329 eventType = eventTypes.compositionStart;
4330 }
4331 } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
4332 eventType = eventTypes.compositionEnd;
4333 }
4334
4335 if (!eventType) {
4336 return null;
4337 }
4338
4339 if (useFallbackCompositionData) {
4340 // The current composition is stored statically and must not be
4341 // overwritten while composition continues.
4342 if (!isComposing && eventType === eventTypes.compositionStart) {
4343 isComposing = initialize(nativeEventTarget);
4344 } else if (eventType === eventTypes.compositionEnd) {
4345 if (isComposing) {
4346 fallbackData = getData();
4347 }
4348 }
4349 }
4350
4351 var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
4352
4353 if (fallbackData) {
4354 // Inject data generated from fallback path into the synthetic event.
4355 // This matches the property of native CompositionEventInterface.
4356 event.data = fallbackData;
4357 } else {
4358 var customData = getDataFromCustomEvent(nativeEvent);
4359 if (customData !== null) {
4360 event.data = customData;
4361 }
4362 }
4363
4364 accumulateTwoPhaseDispatches(event);
4365 return event;
4366 }
4367
4368 /**
4369 * @param {TopLevelTypes} topLevelType Record from `BrowserEventConstants`.
4370 * @param {object} nativeEvent Native browser event.
4371 * @return {?string} The string corresponding to this `beforeInput` event.
4372 */
4373 function getNativeBeforeInputChars(topLevelType, nativeEvent) {
4374 switch (topLevelType) {
4375 case 'topCompositionEnd':
4376 return getDataFromCustomEvent(nativeEvent);
4377 case 'topKeyPress':
4378 /**
4379 * If native `textInput` events are available, our goal is to make
4380 * use of them. However, there is a special case: the spacebar key.
4381 * In Webkit, preventing default on a spacebar `textInput` event
4382 * cancels character insertion, but it *also* causes the browser
4383 * to fall back to its default spacebar behavior of scrolling the
4384 * page.
4385 *
4386 * Tracking at:
4387 * https://code.google.com/p/chromium/issues/detail?id=355103
4388 *
4389 * To avoid this issue, use the keypress event as if no `textInput`
4390 * event is available.
4391 */
4392 var which = nativeEvent.which;
4393 if (which !== SPACEBAR_CODE) {
4394 return null;
4395 }
4396
4397 hasSpaceKeypress = true;
4398 return SPACEBAR_CHAR;
4399
4400 case 'topTextInput':
4401 // Record the characters to be added to the DOM.
4402 var chars = nativeEvent.data;
4403
4404 // If it's a spacebar character, assume that we have already handled
4405 // it at the keypress level and bail immediately. Android Chrome
4406 // doesn't give us keycodes, so we need to blacklist it.
4407 if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
4408 return null;
4409 }
4410
4411 return chars;
4412
4413 default:
4414 // For other native event types, do nothing.
4415 return null;
4416 }
4417 }
4418
4419 /**
4420 * For browsers that do not provide the `textInput` event, extract the
4421 * appropriate string to use for SyntheticInputEvent.
4422 *
4423 * @param {string} topLevelType Record from `BrowserEventConstants`.
4424 * @param {object} nativeEvent Native browser event.
4425 * @return {?string} The fallback string for this `beforeInput` event.
4426 */
4427 function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
4428 // If we are currently composing (IME) and using a fallback to do so,
4429 // try to extract the composed characters from the fallback object.
4430 // If composition event is available, we extract a string only at
4431 // compositionevent, otherwise extract it at fallback events.
4432 if (isComposing) {
4433 if (topLevelType === 'topCompositionEnd' || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
4434 var chars = getData();
4435 reset();
4436 isComposing = false;
4437 return chars;
4438 }
4439 return null;
4440 }
4441
4442 switch (topLevelType) {
4443 case 'topPaste':
4444 // If a paste event occurs after a keypress, throw out the input
4445 // chars. Paste events should not lead to BeforeInput events.
4446 return null;
4447 case 'topKeyPress':
4448 /**
4449 * As of v27, Firefox may fire keypress events even when no character
4450 * will be inserted. A few possibilities:
4451 *
4452 * - `which` is `0`. Arrow keys, Esc key, etc.
4453 *
4454 * - `which` is the pressed key code, but no char is available.
4455 * Ex: 'AltGr + d` in Polish. There is no modified character for
4456 * this key combination and no character is inserted into the
4457 * document, but FF fires the keypress for char code `100` anyway.
4458 * No `input` event will occur.
4459 *
4460 * - `which` is the pressed key code, but a command combination is
4461 * being used. Ex: `Cmd+C`. No character is inserted, and no
4462 * `input` event will occur.
4463 */
4464 if (!isKeypressCommand(nativeEvent)) {
4465 // IE fires the `keypress` event when a user types an emoji via
4466 // Touch keyboard of Windows. In such a case, the `char` property
4467 // holds an emoji character like `\uD83D\uDE0A`. Because its length
4468 // is 2, the property `which` does not represent an emoji correctly.
4469 // In such a case, we directly return the `char` property instead of
4470 // using `which`.
4471 if (nativeEvent.char && nativeEvent.char.length > 1) {
4472 return nativeEvent.char;
4473 } else if (nativeEvent.which) {
4474 return String.fromCharCode(nativeEvent.which);
4475 }
4476 }
4477 return null;
4478 case 'topCompositionEnd':
4479 return useFallbackCompositionData ? null : nativeEvent.data;
4480 default:
4481 return null;
4482 }
4483 }
4484
4485 /**
4486 * Extract a SyntheticInputEvent for `beforeInput`, based on either native
4487 * `textInput` or fallback behavior.
4488 *
4489 * @return {?object} A SyntheticInputEvent.
4490 */
4491 function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
4492 var chars = void 0;
4493
4494 if (canUseTextInputEvent) {
4495 chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
4496 } else {
4497 chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
4498 }
4499
4500 // If no characters are being inserted, no BeforeInput event should
4501 // be fired.
4502 if (!chars) {
4503 return null;
4504 }
4505
4506 var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
4507
4508 event.data = chars;
4509 accumulateTwoPhaseDispatches(event);
4510 return event;
4511 }
4512
4513 /**
4514 * Create an `onBeforeInput` event to match
4515 * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
4516 *
4517 * This event plugin is based on the native `textInput` event
4518 * available in Chrome, Safari, Opera, and IE. This event fires after
4519 * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
4520 *
4521 * `beforeInput` is spec'd but not implemented in any browsers, and
4522 * the `input` event does not provide any useful information about what has
4523 * actually been added, contrary to the spec. Thus, `textInput` is the best
4524 * available event to identify the characters that have actually been inserted
4525 * into the target node.
4526 *
4527 * This plugin is also responsible for emitting `composition` events, thus
4528 * allowing us to share composition fallback code for both `beforeInput` and
4529 * `composition` event types.
4530 */
4531 var BeforeInputEventPlugin = {
4532 eventTypes: eventTypes,
4533
4534 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
4535 var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
4536
4537 var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
4538
4539 if (composition === null) {
4540 return beforeInput;
4541 }
4542
4543 if (beforeInput === null) {
4544 return composition;
4545 }
4546
4547 return [composition, beforeInput];
4548 }
4549 };
4550
4551 // Use to restore controlled state after a change event has fired.
4552
4553 var fiberHostComponent = null;
4554
4555 var ReactControlledComponentInjection = {
4556 injectFiberControlledHostComponent: function (hostComponentImpl) {
4557 // The fiber implementation doesn't use dynamic dispatch so we need to
4558 // inject the implementation.
4559 fiberHostComponent = hostComponentImpl;
4560 }
4561 };
4562
4563 var restoreTarget = null;
4564 var restoreQueue = null;
4565
4566 function restoreStateOfTarget(target) {
4567 // We perform this translation at the end of the event loop so that we
4568 // always receive the correct fiber here
4569 var internalInstance = getInstanceFromNode(target);
4570 if (!internalInstance) {
4571 // Unmounted
4572 return;
4573 }
4574 !(fiberHostComponent && typeof fiberHostComponent.restoreControlledState === 'function') ? invariant(false, 'Fiber needs to be injected to handle a fiber target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0;
4575 var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
4576 fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props);
4577 }
4578
4579 var injection$2 = ReactControlledComponentInjection;
4580
4581 function enqueueStateRestore(target) {
4582 if (restoreTarget) {
4583 if (restoreQueue) {
4584 restoreQueue.push(target);
4585 } else {
4586 restoreQueue = [target];
4587 }
4588 } else {
4589 restoreTarget = target;
4590 }
4591 }
4592
4593 function needsStateRestore() {
4594 return restoreTarget !== null || restoreQueue !== null;
4595 }
4596
4597 function restoreStateIfNeeded() {
4598 if (!restoreTarget) {
4599 return;
4600 }
4601 var target = restoreTarget;
4602 var queuedTargets = restoreQueue;
4603 restoreTarget = null;
4604 restoreQueue = null;
4605
4606 restoreStateOfTarget(target);
4607 if (queuedTargets) {
4608 for (var i = 0; i < queuedTargets.length; i++) {
4609 restoreStateOfTarget(queuedTargets[i]);
4610 }
4611 }
4612 }
4613
4614 var ReactControlledComponent = Object.freeze({
4615 injection: injection$2,
4616 enqueueStateRestore: enqueueStateRestore,
4617 needsStateRestore: needsStateRestore,
4618 restoreStateIfNeeded: restoreStateIfNeeded
4619 });
4620
4621 // Used as a way to call batchedUpdates when we don't have a reference to
4622 // the renderer. Such as when we're dispatching events or if third party
4623 // libraries need to call batchedUpdates. Eventually, this API will go away when
4624 // everything is batched by default. We'll then have a similar API to opt-out of
4625 // scheduled work and instead do synchronous work.
4626
4627 // Defaults
4628 var _batchedUpdates = function (fn, bookkeeping) {
4629 return fn(bookkeeping);
4630 };
4631 var _interactiveUpdates = function (fn, a, b) {
4632 return fn(a, b);
4633 };
4634 var _flushInteractiveUpdates = function () {};
4635
4636 var isBatching = false;
4637 function batchedUpdates(fn, bookkeeping) {
4638 if (isBatching) {
4639 // If we are currently inside another batch, we need to wait until it
4640 // fully completes before restoring state.
4641 return fn(bookkeeping);
4642 }
4643 isBatching = true;
4644 try {
4645 return _batchedUpdates(fn, bookkeeping);
4646 } finally {
4647 // Here we wait until all updates have propagated, which is important
4648 // when using controlled components within layers:
4649 // https://github.com/facebook/react/issues/1698
4650 // Then we restore state of any controlled component.
4651 isBatching = false;
4652 var controlledComponentsHavePendingUpdates = needsStateRestore();
4653 if (controlledComponentsHavePendingUpdates) {
4654 // If a controlled event was fired, we may need to restore the state of
4655 // the DOM node back to the controlled value. This is necessary when React
4656 // bails out of the update without touching the DOM.
4657 _flushInteractiveUpdates();
4658 restoreStateIfNeeded();
4659 }
4660 }
4661 }
4662
4663 function interactiveUpdates(fn, a, b) {
4664 return _interactiveUpdates(fn, a, b);
4665 }
4666
4667
4668
4669 var injection$3 = {
4670 injectRenderer: function (renderer) {
4671 _batchedUpdates = renderer.batchedUpdates;
4672 _interactiveUpdates = renderer.interactiveUpdates;
4673 _flushInteractiveUpdates = renderer.flushInteractiveUpdates;
4674 }
4675 };
4676
4677 /**
4678 * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
4679 */
4680 var supportedInputTypes = {
4681 color: true,
4682 date: true,
4683 datetime: true,
4684 'datetime-local': true,
4685 email: true,
4686 month: true,
4687 number: true,
4688 password: true,
4689 range: true,
4690 search: true,
4691 tel: true,
4692 text: true,
4693 time: true,
4694 url: true,
4695 week: true
4696 };
4697
4698 function isTextInputElement(elem) {
4699 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
4700
4701 if (nodeName === 'input') {
4702 return !!supportedInputTypes[elem.type];
4703 }
4704
4705 if (nodeName === 'textarea') {
4706 return true;
4707 }
4708
4709 return false;
4710 }
4711
4712 /**
4713 * HTML nodeType values that represent the type of the node
4714 */
4715
4716 var ELEMENT_NODE = 1;
4717 var TEXT_NODE = 3;
4718 var COMMENT_NODE = 8;
4719 var DOCUMENT_NODE = 9;
4720 var DOCUMENT_FRAGMENT_NODE = 11;
4721
4722 /**
4723 * Gets the target node from a native browser event by accounting for
4724 * inconsistencies in browser DOM APIs.
4725 *
4726 * @param {object} nativeEvent Native browser event.
4727 * @return {DOMEventTarget} Target node.
4728 */
4729 function getEventTarget(nativeEvent) {
4730 var target = nativeEvent.target || window;
4731
4732 // Normalize SVG <use> element events #4963
4733 if (target.correspondingUseElement) {
4734 target = target.correspondingUseElement;
4735 }
4736
4737 // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
4738 // @see http://www.quirksmode.org/js/events_properties.html
4739 return target.nodeType === TEXT_NODE ? target.parentNode : target;
4740 }
4741
4742 /**
4743 * Checks if an event is supported in the current execution environment.
4744 *
4745 * NOTE: This will not work correctly for non-generic events such as `change`,
4746 * `reset`, `load`, `error`, and `select`.
4747 *
4748 * Borrows from Modernizr.
4749 *
4750 * @param {string} eventNameSuffix Event name, e.g. "click".
4751 * @param {?boolean} capture Check if the capture phase is supported.
4752 * @return {boolean} True if the event is supported.
4753 * @internal
4754 * @license Modernizr 3.0.0pre (Custom Build) | MIT
4755 */
4756 function isEventSupported(eventNameSuffix, capture) {
4757 if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
4758 return false;
4759 }
4760
4761 var eventName = 'on' + eventNameSuffix;
4762 var isSupported = eventName in document;
4763
4764 if (!isSupported) {
4765 var element = document.createElement('div');
4766 element.setAttribute(eventName, 'return;');
4767 isSupported = typeof element[eventName] === 'function';
4768 }
4769
4770 return isSupported;
4771 }
4772
4773 function isCheckable(elem) {
4774 var type = elem.type;
4775 var nodeName = elem.nodeName;
4776 return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
4777 }
4778
4779 function getTracker(node) {
4780 return node._valueTracker;
4781 }
4782
4783 function detachTracker(node) {
4784 node._valueTracker = null;
4785 }
4786
4787 function getValueFromNode(node) {
4788 var value = '';
4789 if (!node) {
4790 return value;
4791 }
4792
4793 if (isCheckable(node)) {
4794 value = node.checked ? 'true' : 'false';
4795 } else {
4796 value = node.value;
4797 }
4798
4799 return value;
4800 }
4801
4802 function trackValueOnNode(node) {
4803 var valueField = isCheckable(node) ? 'checked' : 'value';
4804 var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
4805
4806 var currentValue = '' + node[valueField];
4807
4808 // if someone has already defined a value or Safari, then bail
4809 // and don't track value will cause over reporting of changes,
4810 // but it's better then a hard failure
4811 // (needed for certain tests that spyOn input values and Safari)
4812 if (node.hasOwnProperty(valueField) || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
4813 return;
4814 }
4815
4816 Object.defineProperty(node, valueField, {
4817 configurable: true,
4818 get: function () {
4819 return descriptor.get.call(this);
4820 },
4821 set: function (value) {
4822 currentValue = '' + value;
4823 descriptor.set.call(this, value);
4824 }
4825 });
4826 // We could've passed this the first time
4827 // but it triggers a bug in IE11 and Edge 14/15.
4828 // Calling defineProperty() again should be equivalent.
4829 // https://github.com/facebook/react/issues/11768
4830 Object.defineProperty(node, valueField, {
4831 enumerable: descriptor.enumerable
4832 });
4833
4834 var tracker = {
4835 getValue: function () {
4836 return currentValue;
4837 },
4838 setValue: function (value) {
4839 currentValue = '' + value;
4840 },
4841 stopTracking: function () {
4842 detachTracker(node);
4843 delete node[valueField];
4844 }
4845 };
4846 return tracker;
4847 }
4848
4849 function track(node) {
4850 if (getTracker(node)) {
4851 return;
4852 }
4853
4854 // TODO: Once it's just Fiber we can move this to node._wrapperState
4855 node._valueTracker = trackValueOnNode(node);
4856 }
4857
4858 function updateValueIfChanged(node) {
4859 if (!node) {
4860 return false;
4861 }
4862
4863 var tracker = getTracker(node);
4864 // if there is no tracker at this point it's unlikely
4865 // that trying again will succeed
4866 if (!tracker) {
4867 return true;
4868 }
4869
4870 var lastValue = tracker.getValue();
4871 var nextValue = getValueFromNode(node);
4872 if (nextValue !== lastValue) {
4873 tracker.setValue(nextValue);
4874 return true;
4875 }
4876 return false;
4877 }
4878
4879 var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
4880
4881 var ReactCurrentOwner = ReactInternals.ReactCurrentOwner;
4882 var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
4883
4884 var describeComponentFrame = function (name, source, ownerName) {
4885 return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
4886 };
4887
4888 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
4889 // nor polyfill, then a plain number is used for performance.
4890 var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
4891
4892 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
4893 var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
4894 var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
4895 var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
4896 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
4897 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
4898 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
4899 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
4900 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
4901 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol['for']('react.forward_ref') : 0xead0;
4902
4903 var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
4904 var FAUX_ITERATOR_SYMBOL = '@@iterator';
4905
4906 function getIteratorFn(maybeIterable) {
4907 if (maybeIterable === null || typeof maybeIterable === 'undefined') {
4908 return null;
4909 }
4910 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
4911 if (typeof maybeIterator === 'function') {
4912 return maybeIterator;
4913 }
4914 return null;
4915 }
4916
4917 function getComponentName(fiber) {
4918 var type = fiber.type;
4919
4920 if (typeof type === 'function') {
4921 return type.displayName || type.name;
4922 }
4923 if (typeof type === 'string') {
4924 return type;
4925 }
4926 switch (type) {
4927 case REACT_FRAGMENT_TYPE:
4928 return 'ReactFragment';
4929 case REACT_PORTAL_TYPE:
4930 return 'ReactPortal';
4931 case REACT_CALL_TYPE:
4932 return 'ReactCall';
4933 case REACT_RETURN_TYPE:
4934 return 'ReactReturn';
4935 }
4936 if (typeof type === 'object' && type !== null) {
4937 switch (type.$$typeof) {
4938 case REACT_FORWARD_REF_TYPE:
4939 var functionName = type.render.displayName || type.render.name || '';
4940 return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
4941 }
4942 }
4943 return null;
4944 }
4945
4946 function describeFiber(fiber) {
4947 switch (fiber.tag) {
4948 case IndeterminateComponent:
4949 case FunctionalComponent:
4950 case ClassComponent:
4951 case HostComponent:
4952 var owner = fiber._debugOwner;
4953 var source = fiber._debugSource;
4954 var name = getComponentName(fiber);
4955 var ownerName = null;
4956 if (owner) {
4957 ownerName = getComponentName(owner);
4958 }
4959 return describeComponentFrame(name, source, ownerName);
4960 default:
4961 return '';
4962 }
4963 }
4964
4965 // This function can only be called with a work-in-progress fiber and
4966 // only during begin or complete phase. Do not call it under any other
4967 // circumstances.
4968 function getStackAddendumByWorkInProgressFiber(workInProgress) {
4969 var info = '';
4970 var node = workInProgress;
4971 do {
4972 info += describeFiber(node);
4973 // Otherwise this return pointer might point to the wrong tree:
4974 node = node['return'];
4975 } while (node);
4976 return info;
4977 }
4978
4979 function getCurrentFiberOwnerName$1() {
4980 {
4981 var fiber = ReactDebugCurrentFiber.current;
4982 if (fiber === null) {
4983 return null;
4984 }
4985 var owner = fiber._debugOwner;
4986 if (owner !== null && typeof owner !== 'undefined') {
4987 return getComponentName(owner);
4988 }
4989 }
4990 return null;
4991 }
4992
4993 function getCurrentFiberStackAddendum$1() {
4994 {
4995 var fiber = ReactDebugCurrentFiber.current;
4996 if (fiber === null) {
4997 return null;
4998 }
4999 // Safe because if current fiber exists, we are reconciling,
5000 // and it is guaranteed to be the work-in-progress version.
5001 return getStackAddendumByWorkInProgressFiber(fiber);
5002 }
5003 return null;
5004 }
5005
5006 function resetCurrentFiber() {
5007 ReactDebugCurrentFrame.getCurrentStack = null;
5008 ReactDebugCurrentFiber.current = null;
5009 ReactDebugCurrentFiber.phase = null;
5010 }
5011
5012 function setCurrentFiber(fiber) {
5013 ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackAddendum$1;
5014 ReactDebugCurrentFiber.current = fiber;
5015 ReactDebugCurrentFiber.phase = null;
5016 }
5017
5018 function setCurrentPhase(phase) {
5019 ReactDebugCurrentFiber.phase = phase;
5020 }
5021
5022 var ReactDebugCurrentFiber = {
5023 current: null,
5024 phase: null,
5025 resetCurrentFiber: resetCurrentFiber,
5026 setCurrentFiber: setCurrentFiber,
5027 setCurrentPhase: setCurrentPhase,
5028 getCurrentFiberOwnerName: getCurrentFiberOwnerName$1,
5029 getCurrentFiberStackAddendum: getCurrentFiberStackAddendum$1
5030 };
5031
5032 // A reserved attribute.
5033 // It is handled by React separately and shouldn't be written to the DOM.
5034 var RESERVED = 0;
5035
5036 // A simple string attribute.
5037 // Attributes that aren't in the whitelist are presumed to have this type.
5038 var STRING = 1;
5039
5040 // A string attribute that accepts booleans in React. In HTML, these are called
5041 // "enumerated" attributes with "true" and "false" as possible values.
5042 // When true, it should be set to a "true" string.
5043 // When false, it should be set to a "false" string.
5044 var BOOLEANISH_STRING = 2;
5045
5046 // A real boolean attribute.
5047 // When true, it should be present (set either to an empty string or its name).
5048 // When false, it should be omitted.
5049 var BOOLEAN = 3;
5050
5051 // An attribute that can be used as a flag as well as with a value.
5052 // When true, it should be present (set either to an empty string or its name).
5053 // When false, it should be omitted.
5054 // For any other value, should be present with that value.
5055 var OVERLOADED_BOOLEAN = 4;
5056
5057 // An attribute that must be numeric or parse as a numeric.
5058 // When falsy, it should be removed.
5059 var NUMERIC = 5;
5060
5061 // An attribute that must be positive numeric or parse as a positive numeric.
5062 // When falsy, it should be removed.
5063 var POSITIVE_NUMERIC = 6;
5064
5065 /* eslint-disable max-len */
5066 var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
5067 /* eslint-enable max-len */
5068 var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
5069
5070
5071 var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
5072 var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
5073
5074 var illegalAttributeNameCache = {};
5075 var validatedAttributeNameCache = {};
5076
5077 function isAttributeNameSafe(attributeName) {
5078 if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
5079 return true;
5080 }
5081 if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
5082 return false;
5083 }
5084 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
5085 validatedAttributeNameCache[attributeName] = true;
5086 return true;
5087 }
5088 illegalAttributeNameCache[attributeName] = true;
5089 {
5090 warning(false, 'Invalid attribute name: `%s`', attributeName);
5091 }
5092 return false;
5093 }
5094
5095 function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
5096 if (propertyInfo !== null) {
5097 return propertyInfo.type === RESERVED;
5098 }
5099 if (isCustomComponentTag) {
5100 return false;
5101 }
5102 if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
5103 return true;
5104 }
5105 return false;
5106 }
5107
5108 function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
5109 if (propertyInfo !== null && propertyInfo.type === RESERVED) {
5110 return false;
5111 }
5112 switch (typeof value) {
5113 case 'function':
5114 // $FlowIssue symbol is perfectly valid here
5115 case 'symbol':
5116 // eslint-disable-line
5117 return true;
5118 case 'boolean':
5119 {
5120 if (isCustomComponentTag) {
5121 return false;
5122 }
5123 if (propertyInfo !== null) {
5124 return !propertyInfo.acceptsBooleans;
5125 } else {
5126 var prefix = name.toLowerCase().slice(0, 5);
5127 return prefix !== 'data-' && prefix !== 'aria-';
5128 }
5129 }
5130 default:
5131 return false;
5132 }
5133 }
5134
5135 function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
5136 if (value === null || typeof value === 'undefined') {
5137 return true;
5138 }
5139 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
5140 return true;
5141 }
5142 if (propertyInfo !== null) {
5143 switch (propertyInfo.type) {
5144 case BOOLEAN:
5145 return !value;
5146 case OVERLOADED_BOOLEAN:
5147 return value === false;
5148 case NUMERIC:
5149 return isNaN(value);
5150 case POSITIVE_NUMERIC:
5151 return isNaN(value) || value < 1;
5152 }
5153 }
5154 return false;
5155 }
5156
5157 function getPropertyInfo(name) {
5158 return properties.hasOwnProperty(name) ? properties[name] : null;
5159 }
5160
5161 function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
5162 this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
5163 this.attributeName = attributeName;
5164 this.attributeNamespace = attributeNamespace;
5165 this.mustUseProperty = mustUseProperty;
5166 this.propertyName = name;
5167 this.type = type;
5168 }
5169
5170 // When adding attributes to this list, be sure to also add them to
5171 // the `possibleStandardNames` module to ensure casing and incorrect
5172 // name warnings.
5173 var properties = {};
5174
5175 // These props are reserved by React. They shouldn't be written to the DOM.
5176 ['children', 'dangerouslySetInnerHTML',
5177 // TODO: This prevents the assignment of defaultValue to regular
5178 // elements (not just inputs). Now that ReactDOMInput assigns to the
5179 // defaultValue property -- do we need this?
5180 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
5181 properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
5182 name, // attributeName
5183 null);
5184 });
5185
5186 // A few React string attributes have a different name.
5187 // This is a mapping from React prop names to the attribute names.
5188 [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
5189 var name = _ref[0],
5190 attributeName = _ref[1];
5191
5192 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
5193 attributeName, // attributeName
5194 null);
5195 });
5196
5197 // These are "enumerated" HTML attributes that accept "true" and "false".
5198 // In React, we let users pass `true` and `false` even though technically
5199 // these aren't boolean attributes (they are coerced to strings).
5200 ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
5201 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
5202 name.toLowerCase(), // attributeName
5203 null);
5204 });
5205
5206 // These are "enumerated" SVG attributes that accept "true" and "false".
5207 // In React, we let users pass `true` and `false` even though technically
5208 // these aren't boolean attributes (they are coerced to strings).
5209 // Since these are SVG attributes, their attribute names are case-sensitive.
5210 ['autoReverse', 'externalResourcesRequired', 'preserveAlpha'].forEach(function (name) {
5211 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
5212 name, // attributeName
5213 null);
5214 });
5215
5216 // These are HTML boolean attributes.
5217 ['allowFullScreen', 'async',
5218 // Note: there is a special case that prevents it from being written to the DOM
5219 // on the client side because the browsers are inconsistent. Instead we call focus().
5220 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
5221 // Microdata
5222 'itemScope'].forEach(function (name) {
5223 properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
5224 name.toLowerCase(), // attributeName
5225 null);
5226 });
5227
5228 // These are the few React props that we set as DOM properties
5229 // rather than attributes. These are all booleans.
5230 ['checked',
5231 // Note: `option.selected` is not updated if `select.multiple` is
5232 // disabled with `removeAttribute`. We have special logic for handling this.
5233 'multiple', 'muted', 'selected'].forEach(function (name) {
5234 properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
5235 name.toLowerCase(), // attributeName
5236 null);
5237 });
5238
5239 // These are HTML attributes that are "overloaded booleans": they behave like
5240 // booleans, but can also accept a string value.
5241 ['capture', 'download'].forEach(function (name) {
5242 properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
5243 name.toLowerCase(), // attributeName
5244 null);
5245 });
5246
5247 // These are HTML attributes that must be positive numbers.
5248 ['cols', 'rows', 'size', 'span'].forEach(function (name) {
5249 properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
5250 name.toLowerCase(), // attributeName
5251 null);
5252 });
5253
5254 // These are HTML attributes that must be numbers.
5255 ['rowSpan', 'start'].forEach(function (name) {
5256 properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
5257 name.toLowerCase(), // attributeName
5258 null);
5259 });
5260
5261 var CAMELIZE = /[\-\:]([a-z])/g;
5262 var capitalize = function (token) {
5263 return token[1].toUpperCase();
5264 };
5265
5266 // This is a list of all SVG attributes that need special casing, namespacing,
5267 // or boolean value assignment. Regular attributes that just accept strings
5268 // and have the same names are omitted, just like in the HTML whitelist.
5269 // Some of these attributes can be hard to find. This list was created by
5270 // scrapping the MDN documentation.
5271 ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
5272 var name = attributeName.replace(CAMELIZE, capitalize);
5273 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
5274 attributeName, null);
5275 });
5276
5277 // String SVG attributes with the xlink namespace.
5278 ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
5279 var name = attributeName.replace(CAMELIZE, capitalize);
5280 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
5281 attributeName, 'http://www.w3.org/1999/xlink');
5282 });
5283
5284 // String SVG attributes with the xml namespace.
5285 ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
5286 var name = attributeName.replace(CAMELIZE, capitalize);
5287 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
5288 attributeName, 'http://www.w3.org/XML/1998/namespace');
5289 });
5290
5291 // Special case: this attribute exists both in HTML and SVG.
5292 // Its "tabindex" attribute name is case-sensitive in SVG so we can't just use
5293 // its React `tabIndex` name, like we do for attributes that exist only in HTML.
5294 properties.tabIndex = new PropertyInfoRecord('tabIndex', STRING, false, // mustUseProperty
5295 'tabindex', // attributeName
5296 null);
5297
5298 /**
5299 * Get the value for a property on a node. Only used in DEV for SSR validation.
5300 * The "expected" argument is used as a hint of what the expected value is.
5301 * Some properties have multiple equivalent values.
5302 */
5303 function getValueForProperty(node, name, expected, propertyInfo) {
5304 {
5305 if (propertyInfo.mustUseProperty) {
5306 var propertyName = propertyInfo.propertyName;
5307
5308 return node[propertyName];
5309 } else {
5310 var attributeName = propertyInfo.attributeName;
5311
5312 var stringValue = null;
5313
5314 if (propertyInfo.type === OVERLOADED_BOOLEAN) {
5315 if (node.hasAttribute(attributeName)) {
5316 var value = node.getAttribute(attributeName);
5317 if (value === '') {
5318 return true;
5319 }
5320 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
5321 return value;
5322 }
5323 if (value === '' + expected) {
5324 return expected;
5325 }
5326 return value;
5327 }
5328 } else if (node.hasAttribute(attributeName)) {
5329 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
5330 // We had an attribute but shouldn't have had one, so read it
5331 // for the error message.
5332 return node.getAttribute(attributeName);
5333 }
5334 if (propertyInfo.type === BOOLEAN) {
5335 // If this was a boolean, it doesn't matter what the value is
5336 // the fact that we have it is the same as the expected.
5337 return expected;
5338 }
5339 // Even if this property uses a namespace we use getAttribute
5340 // because we assume its namespaced name is the same as our config.
5341 // To use getAttributeNS we need the local name which we don't have
5342 // in our config atm.
5343 stringValue = node.getAttribute(attributeName);
5344 }
5345
5346 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
5347 return stringValue === null ? expected : stringValue;
5348 } else if (stringValue === '' + expected) {
5349 return expected;
5350 } else {
5351 return stringValue;
5352 }
5353 }
5354 }
5355 }
5356
5357 /**
5358 * Get the value for a attribute on a node. Only used in DEV for SSR validation.
5359 * The third argument is used as a hint of what the expected value is. Some
5360 * attributes have multiple equivalent values.
5361 */
5362 function getValueForAttribute(node, name, expected) {
5363 {
5364 if (!isAttributeNameSafe(name)) {
5365 return;
5366 }
5367 if (!node.hasAttribute(name)) {
5368 return expected === undefined ? undefined : null;
5369 }
5370 var value = node.getAttribute(name);
5371 if (value === '' + expected) {
5372 return expected;
5373 }
5374 return value;
5375 }
5376 }
5377
5378 /**
5379 * Sets the value for a property on a node.
5380 *
5381 * @param {DOMElement} node
5382 * @param {string} name
5383 * @param {*} value
5384 */
5385 function setValueForProperty(node, name, value, isCustomComponentTag) {
5386 var propertyInfo = getPropertyInfo(name);
5387 if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
5388 return;
5389 }
5390 if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
5391 value = null;
5392 }
5393 // If the prop isn't in the special list, treat it as a simple attribute.
5394 if (isCustomComponentTag || propertyInfo === null) {
5395 if (isAttributeNameSafe(name)) {
5396 var _attributeName = name;
5397 if (value === null) {
5398 node.removeAttribute(_attributeName);
5399 } else {
5400 node.setAttribute(_attributeName, '' + value);
5401 }
5402 }
5403 return;
5404 }
5405 var mustUseProperty = propertyInfo.mustUseProperty;
5406
5407 if (mustUseProperty) {
5408 var propertyName = propertyInfo.propertyName;
5409
5410 if (value === null) {
5411 var type = propertyInfo.type;
5412
5413 node[propertyName] = type === BOOLEAN ? false : '';
5414 } else {
5415 // Contrary to `setAttribute`, object properties are properly
5416 // `toString`ed by IE8/9.
5417 node[propertyName] = value;
5418 }
5419 return;
5420 }
5421 // The rest are treated as attributes with special cases.
5422 var attributeName = propertyInfo.attributeName,
5423 attributeNamespace = propertyInfo.attributeNamespace;
5424
5425 if (value === null) {
5426 node.removeAttribute(attributeName);
5427 } else {
5428 var _type = propertyInfo.type;
5429
5430 var attributeValue = void 0;
5431 if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
5432 attributeValue = '';
5433 } else {
5434 // `setAttribute` with objects becomes only `[object]` in IE8/9,
5435 // ('' + value) makes it output the correct toString()-value.
5436 attributeValue = '' + value;
5437 }
5438 if (attributeNamespace) {
5439 node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
5440 } else {
5441 node.setAttribute(attributeName, attributeValue);
5442 }
5443 }
5444 }
5445
5446 var ReactControlledValuePropTypes = {
5447 checkPropTypes: null
5448 };
5449
5450 {
5451 var hasReadOnlyValue = {
5452 button: true,
5453 checkbox: true,
5454 image: true,
5455 hidden: true,
5456 radio: true,
5457 reset: true,
5458 submit: true
5459 };
5460
5461 var propTypes = {
5462 value: function (props, propName, componentName) {
5463 if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
5464 return null;
5465 }
5466 return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
5467 },
5468 checked: function (props, propName, componentName) {
5469 if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
5470 return null;
5471 }
5472 return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
5473 }
5474 };
5475
5476 /**
5477 * Provide a linked `value` attribute for controlled forms. You should not use
5478 * this outside of the ReactDOM controlled form components.
5479 */
5480 ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) {
5481 checkPropTypes(propTypes, props, 'prop', tagName, getStack);
5482 };
5483 }
5484
5485 // TODO: direct imports like some-package/src/* are bad. Fix me.
5486 var getCurrentFiberOwnerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName;
5487 var getCurrentFiberStackAddendum = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
5488
5489 var didWarnValueDefaultValue = false;
5490 var didWarnCheckedDefaultChecked = false;
5491 var didWarnControlledToUncontrolled = false;
5492 var didWarnUncontrolledToControlled = false;
5493
5494 function isControlled(props) {
5495 var usesChecked = props.type === 'checkbox' || props.type === 'radio';
5496 return usesChecked ? props.checked != null : props.value != null;
5497 }
5498
5499 /**
5500 * Implements an <input> host component that allows setting these optional
5501 * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
5502 *
5503 * If `checked` or `value` are not supplied (or null/undefined), user actions
5504 * that affect the checked state or value will trigger updates to the element.
5505 *
5506 * If they are supplied (and not null/undefined), the rendered element will not
5507 * trigger updates to the element. Instead, the props must change in order for
5508 * the rendered element to be updated.
5509 *
5510 * The rendered element will be initialized as unchecked (or `defaultChecked`)
5511 * with an empty value (or `defaultValue`).
5512 *
5513 * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
5514 */
5515
5516 function getHostProps(element, props) {
5517 var node = element;
5518 var checked = props.checked;
5519
5520 var hostProps = _assign({}, props, {
5521 defaultChecked: undefined,
5522 defaultValue: undefined,
5523 value: undefined,
5524 checked: checked != null ? checked : node._wrapperState.initialChecked
5525 });
5526
5527 return hostProps;
5528 }
5529
5530 function initWrapperState(element, props) {
5531 {
5532 ReactControlledValuePropTypes.checkPropTypes('input', props, getCurrentFiberStackAddendum);
5533
5534 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
5535 warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerName() || 'A component', props.type);
5536 didWarnCheckedDefaultChecked = true;
5537 }
5538 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
5539 warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerName() || 'A component', props.type);
5540 didWarnValueDefaultValue = true;
5541 }
5542 }
5543
5544 var node = element;
5545 var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
5546
5547 node._wrapperState = {
5548 initialChecked: props.checked != null ? props.checked : props.defaultChecked,
5549 initialValue: getSafeValue(props.value != null ? props.value : defaultValue),
5550 controlled: isControlled(props)
5551 };
5552 }
5553
5554 function updateChecked(element, props) {
5555 var node = element;
5556 var checked = props.checked;
5557 if (checked != null) {
5558 setValueForProperty(node, 'checked', checked, false);
5559 }
5560 }
5561
5562 function updateWrapper(element, props) {
5563 var node = element;
5564 {
5565 var _controlled = isControlled(props);
5566
5567 if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) {
5568 warning(false, 'A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components%s', props.type, getCurrentFiberStackAddendum());
5569 didWarnUncontrolledToControlled = true;
5570 }
5571 if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) {
5572 warning(false, 'A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components%s', props.type, getCurrentFiberStackAddendum());
5573 didWarnControlledToUncontrolled = true;
5574 }
5575 }
5576
5577 updateChecked(element, props);
5578
5579 var value = getSafeValue(props.value);
5580
5581 if (value != null) {
5582 if (props.type === 'number') {
5583 if (value === 0 && node.value === '' ||
5584 // eslint-disable-next-line
5585 node.value != value) {
5586 node.value = '' + value;
5587 }
5588 } else if (node.value !== '' + value) {
5589 node.value = '' + value;
5590 }
5591 }
5592
5593 if (props.hasOwnProperty('value')) {
5594 setDefaultValue(node, props.type, value);
5595 } else if (props.hasOwnProperty('defaultValue')) {
5596 setDefaultValue(node, props.type, getSafeValue(props.defaultValue));
5597 }
5598
5599 if (props.checked == null && props.defaultChecked != null) {
5600 node.defaultChecked = !!props.defaultChecked;
5601 }
5602 }
5603
5604 function postMountWrapper(element, props) {
5605 var node = element;
5606
5607 if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
5608 // Do not assign value if it is already set. This prevents user text input
5609 // from being lost during SSR hydration.
5610 if (node.value === '') {
5611 node.value = '' + node._wrapperState.initialValue;
5612 }
5613
5614 // value must be assigned before defaultValue. This fixes an issue where the
5615 // visually displayed value of date inputs disappears on mobile Safari and Chrome:
5616 // https://github.com/facebook/react/issues/7233
5617 node.defaultValue = '' + node._wrapperState.initialValue;
5618 }
5619
5620 // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
5621 // this is needed to work around a chrome bug where setting defaultChecked
5622 // will sometimes influence the value of checked (even after detachment).
5623 // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
5624 // We need to temporarily unset name to avoid disrupting radio button groups.
5625 var name = node.name;
5626 if (name !== '') {
5627 node.name = '';
5628 }
5629 node.defaultChecked = !node.defaultChecked;
5630 node.defaultChecked = !node.defaultChecked;
5631 if (name !== '') {
5632 node.name = name;
5633 }
5634 }
5635
5636 function restoreControlledState(element, props) {
5637 var node = element;
5638 updateWrapper(node, props);
5639 updateNamedCousins(node, props);
5640 }
5641
5642 function updateNamedCousins(rootNode, props) {
5643 var name = props.name;
5644 if (props.type === 'radio' && name != null) {
5645 var queryRoot = rootNode;
5646
5647 while (queryRoot.parentNode) {
5648 queryRoot = queryRoot.parentNode;
5649 }
5650
5651 // If `rootNode.form` was non-null, then we could try `form.elements`,
5652 // but that sometimes behaves strangely in IE8. We could also try using
5653 // `form.getElementsByName`, but that will only return direct children
5654 // and won't include inputs that use the HTML5 `form=` attribute. Since
5655 // the input might not even be in a form. It might not even be in the
5656 // document. Let's just use the local `querySelectorAll` to ensure we don't
5657 // miss anything.
5658 var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
5659
5660 for (var i = 0; i < group.length; i++) {
5661 var otherNode = group[i];
5662 if (otherNode === rootNode || otherNode.form !== rootNode.form) {
5663 continue;
5664 }
5665 // This will throw if radio buttons rendered by different copies of React
5666 // and the same name are rendered into the same form (same as #1939).
5667 // That's probably okay; we don't support it just as we don't support
5668 // mixing React radio buttons with non-React ones.
5669 var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
5670 !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0;
5671
5672 // We need update the tracked value on the named cousin since the value
5673 // was changed but the input saw no event or value set
5674 updateValueIfChanged(otherNode);
5675
5676 // If this is a controlled radio button group, forcing the input that
5677 // was previously checked to update will cause it to be come re-checked
5678 // as appropriate.
5679 updateWrapper(otherNode, otherProps);
5680 }
5681 }
5682 }
5683
5684 // In Chrome, assigning defaultValue to certain input types triggers input validation.
5685 // For number inputs, the display value loses trailing decimal points. For email inputs,
5686 // Chrome raises "The specified value <x> is not a valid email address".
5687 //
5688 // Here we check to see if the defaultValue has actually changed, avoiding these problems
5689 // when the user is inputting text
5690 //
5691 // https://github.com/facebook/react/issues/7253
5692 function setDefaultValue(node, type, value) {
5693 if (
5694 // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
5695 type !== 'number' || node.ownerDocument.activeElement !== node) {
5696 if (value == null) {
5697 node.defaultValue = '' + node._wrapperState.initialValue;
5698 } else if (node.defaultValue !== '' + value) {
5699 node.defaultValue = '' + value;
5700 }
5701 }
5702 }
5703
5704 function getSafeValue(value) {
5705 switch (typeof value) {
5706 case 'boolean':
5707 case 'number':
5708 case 'object':
5709 case 'string':
5710 case 'undefined':
5711 return value;
5712 default:
5713 // function, symbol are assigned as empty strings
5714 return '';
5715 }
5716 }
5717
5718 var eventTypes$1 = {
5719 change: {
5720 phasedRegistrationNames: {
5721 bubbled: 'onChange',
5722 captured: 'onChangeCapture'
5723 },
5724 dependencies: ['topBlur', 'topChange', 'topClick', 'topFocus', 'topInput', 'topKeyDown', 'topKeyUp', 'topSelectionChange']
5725 }
5726 };
5727
5728 function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
5729 var event = SyntheticEvent$1.getPooled(eventTypes$1.change, inst, nativeEvent, target);
5730 event.type = 'change';
5731 // Flag this event loop as needing state restore.
5732 enqueueStateRestore(target);
5733 accumulateTwoPhaseDispatches(event);
5734 return event;
5735 }
5736 /**
5737 * For IE shims
5738 */
5739 var activeElement = null;
5740 var activeElementInst = null;
5741
5742 /**
5743 * SECTION: handle `change` event
5744 */
5745 function shouldUseChangeEvent(elem) {
5746 var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
5747 return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
5748 }
5749
5750 function manualDispatchChangeEvent(nativeEvent) {
5751 var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent));
5752
5753 // If change and propertychange bubbled, we'd just bind to it like all the
5754 // other events and have it go through ReactBrowserEventEmitter. Since it
5755 // doesn't, we manually listen for the events and so we have to enqueue and
5756 // process the abstract event manually.
5757 //
5758 // Batching is necessary here in order to ensure that all event handlers run
5759 // before the next rerender (including event handlers attached to ancestor
5760 // elements instead of directly on the input). Without this, controlled
5761 // components don't work properly in conjunction with event bubbling because
5762 // the component is rerendered and the value reverted before all the event
5763 // handlers can run. See https://github.com/facebook/react/issues/708.
5764 batchedUpdates(runEventInBatch, event);
5765 }
5766
5767 function runEventInBatch(event) {
5768 runEventsInBatch(event, false);
5769 }
5770
5771 function getInstIfValueChanged(targetInst) {
5772 var targetNode = getNodeFromInstance$1(targetInst);
5773 if (updateValueIfChanged(targetNode)) {
5774 return targetInst;
5775 }
5776 }
5777
5778 function getTargetInstForChangeEvent(topLevelType, targetInst) {
5779 if (topLevelType === 'topChange') {
5780 return targetInst;
5781 }
5782 }
5783
5784 /**
5785 * SECTION: handle `input` event
5786 */
5787 var isInputEventSupported = false;
5788 if (ExecutionEnvironment.canUseDOM) {
5789 // IE9 claims to support the input event but fails to trigger it when
5790 // deleting text, so we ignore its input events.
5791 isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
5792 }
5793
5794 /**
5795 * (For IE <=9) Starts tracking propertychange events on the passed-in element
5796 * and override the value property so that we can distinguish user events from
5797 * value changes in JS.
5798 */
5799 function startWatchingForValueChange(target, targetInst) {
5800 activeElement = target;
5801 activeElementInst = targetInst;
5802 activeElement.attachEvent('onpropertychange', handlePropertyChange);
5803 }
5804
5805 /**
5806 * (For IE <=9) Removes the event listeners from the currently-tracked element,
5807 * if any exists.
5808 */
5809 function stopWatchingForValueChange() {
5810 if (!activeElement) {
5811 return;
5812 }
5813 activeElement.detachEvent('onpropertychange', handlePropertyChange);
5814 activeElement = null;
5815 activeElementInst = null;
5816 }
5817
5818 /**
5819 * (For IE <=9) Handles a propertychange event, sending a `change` event if
5820 * the value of the active element has changed.
5821 */
5822 function handlePropertyChange(nativeEvent) {
5823 if (nativeEvent.propertyName !== 'value') {
5824 return;
5825 }
5826 if (getInstIfValueChanged(activeElementInst)) {
5827 manualDispatchChangeEvent(nativeEvent);
5828 }
5829 }
5830
5831 function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
5832 if (topLevelType === 'topFocus') {
5833 // In IE9, propertychange fires for most input events but is buggy and
5834 // doesn't fire when text is deleted, but conveniently, selectionchange
5835 // appears to fire in all of the remaining cases so we catch those and
5836 // forward the event if the value has changed
5837 // In either case, we don't want to call the event handler if the value
5838 // is changed from JS so we redefine a setter for `.value` that updates
5839 // our activeElementValue variable, allowing us to ignore those changes
5840 //
5841 // stopWatching() should be a noop here but we call it just in case we
5842 // missed a blur event somehow.
5843 stopWatchingForValueChange();
5844 startWatchingForValueChange(target, targetInst);
5845 } else if (topLevelType === 'topBlur') {
5846 stopWatchingForValueChange();
5847 }
5848 }
5849
5850 // For IE8 and IE9.
5851 function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
5852 if (topLevelType === 'topSelectionChange' || topLevelType === 'topKeyUp' || topLevelType === 'topKeyDown') {
5853 // On the selectionchange event, the target is just document which isn't
5854 // helpful for us so just check activeElement instead.
5855 //
5856 // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
5857 // propertychange on the first input event after setting `value` from a
5858 // script and fires only keydown, keypress, keyup. Catching keyup usually
5859 // gets it and catching keydown lets us fire an event for the first
5860 // keystroke if user does a key repeat (it'll be a little delayed: right
5861 // before the second keystroke). Other input methods (e.g., paste) seem to
5862 // fire selectionchange normally.
5863 return getInstIfValueChanged(activeElementInst);
5864 }
5865 }
5866
5867 /**
5868 * SECTION: handle `click` event
5869 */
5870 function shouldUseClickEvent(elem) {
5871 // Use the `click` event to detect changes to checkbox and radio inputs.
5872 // This approach works across all browsers, whereas `change` does not fire
5873 // until `blur` in IE8.
5874 var nodeName = elem.nodeName;
5875 return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
5876 }
5877
5878 function getTargetInstForClickEvent(topLevelType, targetInst) {
5879 if (topLevelType === 'topClick') {
5880 return getInstIfValueChanged(targetInst);
5881 }
5882 }
5883
5884 function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
5885 if (topLevelType === 'topInput' || topLevelType === 'topChange') {
5886 return getInstIfValueChanged(targetInst);
5887 }
5888 }
5889
5890 function handleControlledInputBlur(inst, node) {
5891 // TODO: In IE, inst is occasionally null. Why?
5892 if (inst == null) {
5893 return;
5894 }
5895
5896 // Fiber and ReactDOM keep wrapper state in separate places
5897 var state = inst._wrapperState || node._wrapperState;
5898
5899 if (!state || !state.controlled || node.type !== 'number') {
5900 return;
5901 }
5902
5903 // If controlled, assign the value attribute to the current value on blur
5904 setDefaultValue(node, 'number', node.value);
5905 }
5906
5907 /**
5908 * This plugin creates an `onChange` event that normalizes change events
5909 * across form elements. This event fires at a time when it's possible to
5910 * change the element's value without seeing a flicker.
5911 *
5912 * Supported elements are:
5913 * - input (see `isTextInputElement`)
5914 * - textarea
5915 * - select
5916 */
5917 var ChangeEventPlugin = {
5918 eventTypes: eventTypes$1,
5919
5920 _isInputEventSupported: isInputEventSupported,
5921
5922 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
5923 var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
5924
5925 var getTargetInstFunc = void 0,
5926 handleEventFunc = void 0;
5927 if (shouldUseChangeEvent(targetNode)) {
5928 getTargetInstFunc = getTargetInstForChangeEvent;
5929 } else if (isTextInputElement(targetNode)) {
5930 if (isInputEventSupported) {
5931 getTargetInstFunc = getTargetInstForInputOrChangeEvent;
5932 } else {
5933 getTargetInstFunc = getTargetInstForInputEventPolyfill;
5934 handleEventFunc = handleEventsForInputEventPolyfill;
5935 }
5936 } else if (shouldUseClickEvent(targetNode)) {
5937 getTargetInstFunc = getTargetInstForClickEvent;
5938 }
5939
5940 if (getTargetInstFunc) {
5941 var inst = getTargetInstFunc(topLevelType, targetInst);
5942 if (inst) {
5943 var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
5944 return event;
5945 }
5946 }
5947
5948 if (handleEventFunc) {
5949 handleEventFunc(topLevelType, targetNode, targetInst);
5950 }
5951
5952 // When blurring, set the value attribute for number inputs
5953 if (topLevelType === 'topBlur') {
5954 handleControlledInputBlur(targetInst, targetNode);
5955 }
5956 }
5957 };
5958
5959 /**
5960 * Module that is injectable into `EventPluginHub`, that specifies a
5961 * deterministic ordering of `EventPlugin`s. A convenient way to reason about
5962 * plugins, without having to package every one of them. This is better than
5963 * having plugins be ordered in the same order that they are injected because
5964 * that ordering would be influenced by the packaging order.
5965 * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
5966 * preventing default on events is convenient in `SimpleEventPlugin` handlers.
5967 */
5968 var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'TapEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
5969
5970 var SyntheticUIEvent = SyntheticEvent$1.extend({
5971 view: null,
5972 detail: null
5973 });
5974
5975 /**
5976 * Translation from modifier key to the associated property in the event.
5977 * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
5978 */
5979
5980 var modifierKeyToProp = {
5981 Alt: 'altKey',
5982 Control: 'ctrlKey',
5983 Meta: 'metaKey',
5984 Shift: 'shiftKey'
5985 };
5986
5987 // IE8 does not implement getModifierState so we simply map it to the only
5988 // modifier keys exposed by the event itself, does not support Lock-keys.
5989 // Currently, all major browsers except Chrome seems to support Lock-keys.
5990 function modifierStateGetter(keyArg) {
5991 var syntheticEvent = this;
5992 var nativeEvent = syntheticEvent.nativeEvent;
5993 if (nativeEvent.getModifierState) {
5994 return nativeEvent.getModifierState(keyArg);
5995 }
5996 var keyProp = modifierKeyToProp[keyArg];
5997 return keyProp ? !!nativeEvent[keyProp] : false;
5998 }
5999
6000 function getEventModifierState(nativeEvent) {
6001 return modifierStateGetter;
6002 }
6003
6004 /**
6005 * @interface MouseEvent
6006 * @see http://www.w3.org/TR/DOM-Level-3-Events/
6007 */
6008 var SyntheticMouseEvent = SyntheticUIEvent.extend({
6009 screenX: null,
6010 screenY: null,
6011 clientX: null,
6012 clientY: null,
6013 pageX: null,
6014 pageY: null,
6015 ctrlKey: null,
6016 shiftKey: null,
6017 altKey: null,
6018 metaKey: null,
6019 getModifierState: getEventModifierState,
6020 button: null,
6021 buttons: null,
6022 relatedTarget: function (event) {
6023 return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
6024 }
6025 });
6026
6027 var eventTypes$2 = {
6028 mouseEnter: {
6029 registrationName: 'onMouseEnter',
6030 dependencies: ['topMouseOut', 'topMouseOver']
6031 },
6032 mouseLeave: {
6033 registrationName: 'onMouseLeave',
6034 dependencies: ['topMouseOut', 'topMouseOver']
6035 }
6036 };
6037
6038 var EnterLeaveEventPlugin = {
6039 eventTypes: eventTypes$2,
6040
6041 /**
6042 * For almost every interaction we care about, there will be both a top-level
6043 * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
6044 * we do not extract duplicate events. However, moving the mouse into the
6045 * browser from outside will not fire a `mouseout` event. In this case, we use
6046 * the `mouseover` top-level event.
6047 */
6048 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
6049 if (topLevelType === 'topMouseOver' && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
6050 return null;
6051 }
6052 if (topLevelType !== 'topMouseOut' && topLevelType !== 'topMouseOver') {
6053 // Must not be a mouse in or mouse out - ignoring.
6054 return null;
6055 }
6056
6057 var win = void 0;
6058 if (nativeEventTarget.window === nativeEventTarget) {
6059 // `nativeEventTarget` is probably a window object.
6060 win = nativeEventTarget;
6061 } else {
6062 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
6063 var doc = nativeEventTarget.ownerDocument;
6064 if (doc) {
6065 win = doc.defaultView || doc.parentWindow;
6066 } else {
6067 win = window;
6068 }
6069 }
6070
6071 var from = void 0;
6072 var to = void 0;
6073 if (topLevelType === 'topMouseOut') {
6074 from = targetInst;
6075 var related = nativeEvent.relatedTarget || nativeEvent.toElement;
6076 to = related ? getClosestInstanceFromNode(related) : null;
6077 } else {
6078 // Moving to a node from outside the window.
6079 from = null;
6080 to = targetInst;
6081 }
6082
6083 if (from === to) {
6084 // Nothing pertains to our managed components.
6085 return null;
6086 }
6087
6088 var fromNode = from == null ? win : getNodeFromInstance$1(from);
6089 var toNode = to == null ? win : getNodeFromInstance$1(to);
6090
6091 var leave = SyntheticMouseEvent.getPooled(eventTypes$2.mouseLeave, from, nativeEvent, nativeEventTarget);
6092 leave.type = 'mouseleave';
6093 leave.target = fromNode;
6094 leave.relatedTarget = toNode;
6095
6096 var enter = SyntheticMouseEvent.getPooled(eventTypes$2.mouseEnter, to, nativeEvent, nativeEventTarget);
6097 enter.type = 'mouseenter';
6098 enter.target = toNode;
6099 enter.relatedTarget = fromNode;
6100
6101 accumulateEnterLeaveDispatches(leave, enter, from, to);
6102
6103 return [leave, enter];
6104 }
6105 };
6106
6107 /**
6108 * `ReactInstanceMap` maintains a mapping from a public facing stateful
6109 * instance (key) and the internal representation (value). This allows public
6110 * methods to accept the user facing instance as an argument and map them back
6111 * to internal methods.
6112 *
6113 * Note that this module is currently shared and assumed to be stateless.
6114 * If this becomes an actual Map, that will break.
6115 */
6116
6117 /**
6118 * This API should be called `delete` but we'd have to make sure to always
6119 * transform these to strings for IE support. When this transform is fully
6120 * supported we can rename it.
6121 */
6122
6123
6124 function get(key) {
6125 return key._reactInternalFiber;
6126 }
6127
6128 function has(key) {
6129 return key._reactInternalFiber !== undefined;
6130 }
6131
6132 function set(key, value) {
6133 key._reactInternalFiber = value;
6134 }
6135
6136 // Don't change these two values. They're used by React Dev Tools.
6137 var NoEffect = /* */0;
6138 var PerformedWork = /* */1;
6139
6140 // You can change the rest (and add more).
6141 var Placement = /* */2;
6142 var Update = /* */4;
6143 var PlacementAndUpdate = /* */6;
6144 var Deletion = /* */8;
6145 var ContentReset = /* */16;
6146 var Callback = /* */32;
6147 var DidCapture = /* */64;
6148 var Ref = /* */128;
6149 var ErrLog = /* */256;
6150 var Snapshot = /* */2048;
6151
6152 // Union of all host effects
6153 var HostEffectMask = /* */2559;
6154
6155 var Incomplete = /* */512;
6156 var ShouldCapture = /* */1024;
6157
6158 var MOUNTING = 1;
6159 var MOUNTED = 2;
6160 var UNMOUNTED = 3;
6161
6162 function isFiberMountedImpl(fiber) {
6163 var node = fiber;
6164 if (!fiber.alternate) {
6165 // If there is no alternate, this might be a new tree that isn't inserted
6166 // yet. If it is, then it will have a pending insertion effect on it.
6167 if ((node.effectTag & Placement) !== NoEffect) {
6168 return MOUNTING;
6169 }
6170 while (node['return']) {
6171 node = node['return'];
6172 if ((node.effectTag & Placement) !== NoEffect) {
6173 return MOUNTING;
6174 }
6175 }
6176 } else {
6177 while (node['return']) {
6178 node = node['return'];
6179 }
6180 }
6181 if (node.tag === HostRoot) {
6182 // TODO: Check if this was a nested HostRoot when used with
6183 // renderContainerIntoSubtree.
6184 return MOUNTED;
6185 }
6186 // If we didn't hit the root, that means that we're in an disconnected tree
6187 // that has been unmounted.
6188 return UNMOUNTED;
6189 }
6190
6191 function isFiberMounted(fiber) {
6192 return isFiberMountedImpl(fiber) === MOUNTED;
6193 }
6194
6195 function isMounted(component) {
6196 {
6197 var owner = ReactCurrentOwner.current;
6198 if (owner !== null && owner.tag === ClassComponent) {
6199 var ownerFiber = owner;
6200 var instance = ownerFiber.stateNode;
6201 !instance._warnedAboutRefsInRender ? warning(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber) || 'A component') : void 0;
6202 instance._warnedAboutRefsInRender = true;
6203 }
6204 }
6205
6206 var fiber = get(component);
6207 if (!fiber) {
6208 return false;
6209 }
6210 return isFiberMountedImpl(fiber) === MOUNTED;
6211 }
6212
6213 function assertIsMounted(fiber) {
6214 !(isFiberMountedImpl(fiber) === MOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
6215 }
6216
6217 function findCurrentFiberUsingSlowPath(fiber) {
6218 var alternate = fiber.alternate;
6219 if (!alternate) {
6220 // If there is no alternate, then we only need to check if it is mounted.
6221 var state = isFiberMountedImpl(fiber);
6222 !(state !== UNMOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
6223 if (state === MOUNTING) {
6224 return null;
6225 }
6226 return fiber;
6227 }
6228 // If we have two possible branches, we'll walk backwards up to the root
6229 // to see what path the root points to. On the way we may hit one of the
6230 // special cases and we'll deal with them.
6231 var a = fiber;
6232 var b = alternate;
6233 while (true) {
6234 var parentA = a['return'];
6235 var parentB = parentA ? parentA.alternate : null;
6236 if (!parentA || !parentB) {
6237 // We're at the root.
6238 break;
6239 }
6240
6241 // If both copies of the parent fiber point to the same child, we can
6242 // assume that the child is current. This happens when we bailout on low
6243 // priority: the bailed out fiber's child reuses the current child.
6244 if (parentA.child === parentB.child) {
6245 var child = parentA.child;
6246 while (child) {
6247 if (child === a) {
6248 // We've determined that A is the current branch.
6249 assertIsMounted(parentA);
6250 return fiber;
6251 }
6252 if (child === b) {
6253 // We've determined that B is the current branch.
6254 assertIsMounted(parentA);
6255 return alternate;
6256 }
6257 child = child.sibling;
6258 }
6259 // We should never have an alternate for any mounting node. So the only
6260 // way this could possibly happen is if this was unmounted, if at all.
6261 invariant(false, 'Unable to find node on an unmounted component.');
6262 }
6263
6264 if (a['return'] !== b['return']) {
6265 // The return pointer of A and the return pointer of B point to different
6266 // fibers. We assume that return pointers never criss-cross, so A must
6267 // belong to the child set of A.return, and B must belong to the child
6268 // set of B.return.
6269 a = parentA;
6270 b = parentB;
6271 } else {
6272 // The return pointers point to the same fiber. We'll have to use the
6273 // default, slow path: scan the child sets of each parent alternate to see
6274 // which child belongs to which set.
6275 //
6276 // Search parent A's child set
6277 var didFindChild = false;
6278 var _child = parentA.child;
6279 while (_child) {
6280 if (_child === a) {
6281 didFindChild = true;
6282 a = parentA;
6283 b = parentB;
6284 break;
6285 }
6286 if (_child === b) {
6287 didFindChild = true;
6288 b = parentA;
6289 a = parentB;
6290 break;
6291 }
6292 _child = _child.sibling;
6293 }
6294 if (!didFindChild) {
6295 // Search parent B's child set
6296 _child = parentB.child;
6297 while (_child) {
6298 if (_child === a) {
6299 didFindChild = true;
6300 a = parentB;
6301 b = parentA;
6302 break;
6303 }
6304 if (_child === b) {
6305 didFindChild = true;
6306 b = parentB;
6307 a = parentA;
6308 break;
6309 }
6310 _child = _child.sibling;
6311 }
6312 !didFindChild ? invariant(false, 'Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.') : void 0;
6313 }
6314 }
6315
6316 !(a.alternate === b) ? invariant(false, 'Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.') : void 0;
6317 }
6318 // If the root is not a host container, we're in a disconnected tree. I.e.
6319 // unmounted.
6320 !(a.tag === HostRoot) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
6321 if (a.stateNode.current === a) {
6322 // We've determined that A is the current branch.
6323 return fiber;
6324 }
6325 // Otherwise B has to be current branch.
6326 return alternate;
6327 }
6328
6329 function findCurrentHostFiber(parent) {
6330 var currentParent = findCurrentFiberUsingSlowPath(parent);
6331 if (!currentParent) {
6332 return null;
6333 }
6334
6335 // Next we'll drill down this component to find the first HostComponent/Text.
6336 var node = currentParent;
6337 while (true) {
6338 if (node.tag === HostComponent || node.tag === HostText) {
6339 return node;
6340 } else if (node.child) {
6341 node.child['return'] = node;
6342 node = node.child;
6343 continue;
6344 }
6345 if (node === currentParent) {
6346 return null;
6347 }
6348 while (!node.sibling) {
6349 if (!node['return'] || node['return'] === currentParent) {
6350 return null;
6351 }
6352 node = node['return'];
6353 }
6354 node.sibling['return'] = node['return'];
6355 node = node.sibling;
6356 }
6357 // Flow needs the return null here, but ESLint complains about it.
6358 // eslint-disable-next-line no-unreachable
6359 return null;
6360 }
6361
6362 function findCurrentHostFiberWithNoPortals(parent) {
6363 var currentParent = findCurrentFiberUsingSlowPath(parent);
6364 if (!currentParent) {
6365 return null;
6366 }
6367
6368 // Next we'll drill down this component to find the first HostComponent/Text.
6369 var node = currentParent;
6370 while (true) {
6371 if (node.tag === HostComponent || node.tag === HostText) {
6372 return node;
6373 } else if (node.child && node.tag !== HostPortal) {
6374 node.child['return'] = node;
6375 node = node.child;
6376 continue;
6377 }
6378 if (node === currentParent) {
6379 return null;
6380 }
6381 while (!node.sibling) {
6382 if (!node['return'] || node['return'] === currentParent) {
6383 return null;
6384 }
6385 node = node['return'];
6386 }
6387 node.sibling['return'] = node['return'];
6388 node = node.sibling;
6389 }
6390 // Flow needs the return null here, but ESLint complains about it.
6391 // eslint-disable-next-line no-unreachable
6392 return null;
6393 }
6394
6395 function addEventBubbleListener(element, eventType, listener) {
6396 element.addEventListener(eventType, listener, false);
6397 }
6398
6399 function addEventCaptureListener(element, eventType, listener) {
6400 element.addEventListener(eventType, listener, true);
6401 }
6402
6403 /**
6404 * @interface Event
6405 * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
6406 * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
6407 */
6408 var SyntheticAnimationEvent = SyntheticEvent$1.extend({
6409 animationName: null,
6410 elapsedTime: null,
6411 pseudoElement: null
6412 });
6413
6414 /**
6415 * @interface Event
6416 * @see http://www.w3.org/TR/clipboard-apis/
6417 */
6418 var SyntheticClipboardEvent = SyntheticEvent$1.extend({
6419 clipboardData: function (event) {
6420 return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
6421 }
6422 });
6423
6424 /**
6425 * @interface FocusEvent
6426 * @see http://www.w3.org/TR/DOM-Level-3-Events/
6427 */
6428 var SyntheticFocusEvent = SyntheticUIEvent.extend({
6429 relatedTarget: null
6430 });
6431
6432 /**
6433 * `charCode` represents the actual "character code" and is safe to use with
6434 * `String.fromCharCode`. As such, only keys that correspond to printable
6435 * characters produce a valid `charCode`, the only exception to this is Enter.
6436 * The Tab-key is considered non-printable and does not have a `charCode`,
6437 * presumably because it does not produce a tab-character in browsers.
6438 *
6439 * @param {object} nativeEvent Native browser event.
6440 * @return {number} Normalized `charCode` property.
6441 */
6442 function getEventCharCode(nativeEvent) {
6443 var charCode = void 0;
6444 var keyCode = nativeEvent.keyCode;
6445
6446 if ('charCode' in nativeEvent) {
6447 charCode = nativeEvent.charCode;
6448
6449 // FF does not set `charCode` for the Enter-key, check against `keyCode`.
6450 if (charCode === 0 && keyCode === 13) {
6451 charCode = 13;
6452 }
6453 } else {
6454 // IE8 does not implement `charCode`, but `keyCode` has the correct value.
6455 charCode = keyCode;
6456 }
6457
6458 // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
6459 // report Enter as charCode 10 when ctrl is pressed.
6460 if (charCode === 10) {
6461 charCode = 13;
6462 }
6463
6464 // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
6465 // Must not discard the (non-)printable Enter-key.
6466 if (charCode >= 32 || charCode === 13) {
6467 return charCode;
6468 }
6469
6470 return 0;
6471 }
6472
6473 /**
6474 * Normalization of deprecated HTML5 `key` values
6475 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
6476 */
6477 var normalizeKey = {
6478 Esc: 'Escape',
6479 Spacebar: ' ',
6480 Left: 'ArrowLeft',
6481 Up: 'ArrowUp',
6482 Right: 'ArrowRight',
6483 Down: 'ArrowDown',
6484 Del: 'Delete',
6485 Win: 'OS',
6486 Menu: 'ContextMenu',
6487 Apps: 'ContextMenu',
6488 Scroll: 'ScrollLock',
6489 MozPrintableKey: 'Unidentified'
6490 };
6491
6492 /**
6493 * Translation from legacy `keyCode` to HTML5 `key`
6494 * Only special keys supported, all others depend on keyboard layout or browser
6495 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
6496 */
6497 var translateToKey = {
6498 '8': 'Backspace',
6499 '9': 'Tab',
6500 '12': 'Clear',
6501 '13': 'Enter',
6502 '16': 'Shift',
6503 '17': 'Control',
6504 '18': 'Alt',
6505 '19': 'Pause',
6506 '20': 'CapsLock',
6507 '27': 'Escape',
6508 '32': ' ',
6509 '33': 'PageUp',
6510 '34': 'PageDown',
6511 '35': 'End',
6512 '36': 'Home',
6513 '37': 'ArrowLeft',
6514 '38': 'ArrowUp',
6515 '39': 'ArrowRight',
6516 '40': 'ArrowDown',
6517 '45': 'Insert',
6518 '46': 'Delete',
6519 '112': 'F1',
6520 '113': 'F2',
6521 '114': 'F3',
6522 '115': 'F4',
6523 '116': 'F5',
6524 '117': 'F6',
6525 '118': 'F7',
6526 '119': 'F8',
6527 '120': 'F9',
6528 '121': 'F10',
6529 '122': 'F11',
6530 '123': 'F12',
6531 '144': 'NumLock',
6532 '145': 'ScrollLock',
6533 '224': 'Meta'
6534 };
6535
6536 /**
6537 * @param {object} nativeEvent Native browser event.
6538 * @return {string} Normalized `key` property.
6539 */
6540 function getEventKey(nativeEvent) {
6541 if (nativeEvent.key) {
6542 // Normalize inconsistent values reported by browsers due to
6543 // implementations of a working draft specification.
6544
6545 // FireFox implements `key` but returns `MozPrintableKey` for all
6546 // printable characters (normalized to `Unidentified`), ignore it.
6547 var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
6548 if (key !== 'Unidentified') {
6549 return key;
6550 }
6551 }
6552
6553 // Browser does not implement `key`, polyfill as much of it as we can.
6554 if (nativeEvent.type === 'keypress') {
6555 var charCode = getEventCharCode(nativeEvent);
6556
6557 // The enter-key is technically both printable and non-printable and can
6558 // thus be captured by `keypress`, no other non-printable key should.
6559 return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
6560 }
6561 if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
6562 // While user keyboard layout determines the actual meaning of each
6563 // `keyCode` value, almost all function keys have a universal value.
6564 return translateToKey[nativeEvent.keyCode] || 'Unidentified';
6565 }
6566 return '';
6567 }
6568
6569 /**
6570 * @interface KeyboardEvent
6571 * @see http://www.w3.org/TR/DOM-Level-3-Events/
6572 */
6573 var SyntheticKeyboardEvent = SyntheticUIEvent.extend({
6574 key: getEventKey,
6575 location: null,
6576 ctrlKey: null,
6577 shiftKey: null,
6578 altKey: null,
6579 metaKey: null,
6580 repeat: null,
6581 locale: null,
6582 getModifierState: getEventModifierState,
6583 // Legacy Interface
6584 charCode: function (event) {
6585 // `charCode` is the result of a KeyPress event and represents the value of
6586 // the actual printable character.
6587
6588 // KeyPress is deprecated, but its replacement is not yet final and not
6589 // implemented in any major browser. Only KeyPress has charCode.
6590 if (event.type === 'keypress') {
6591 return getEventCharCode(event);
6592 }
6593 return 0;
6594 },
6595 keyCode: function (event) {
6596 // `keyCode` is the result of a KeyDown/Up event and represents the value of
6597 // physical keyboard key.
6598
6599 // The actual meaning of the value depends on the users' keyboard layout
6600 // which cannot be detected. Assuming that it is a US keyboard layout
6601 // provides a surprisingly accurate mapping for US and European users.
6602 // Due to this, it is left to the user to implement at this time.
6603 if (event.type === 'keydown' || event.type === 'keyup') {
6604 return event.keyCode;
6605 }
6606 return 0;
6607 },
6608 which: function (event) {
6609 // `which` is an alias for either `keyCode` or `charCode` depending on the
6610 // type of the event.
6611 if (event.type === 'keypress') {
6612 return getEventCharCode(event);
6613 }
6614 if (event.type === 'keydown' || event.type === 'keyup') {
6615 return event.keyCode;
6616 }
6617 return 0;
6618 }
6619 });
6620
6621 /**
6622 * @interface DragEvent
6623 * @see http://www.w3.org/TR/DOM-Level-3-Events/
6624 */
6625 var SyntheticDragEvent = SyntheticMouseEvent.extend({
6626 dataTransfer: null
6627 });
6628
6629 /**
6630 * @interface TouchEvent
6631 * @see http://www.w3.org/TR/touch-events/
6632 */
6633 var SyntheticTouchEvent = SyntheticUIEvent.extend({
6634 touches: null,
6635 targetTouches: null,
6636 changedTouches: null,
6637 altKey: null,
6638 metaKey: null,
6639 ctrlKey: null,
6640 shiftKey: null,
6641 getModifierState: getEventModifierState
6642 });
6643
6644 /**
6645 * @interface Event
6646 * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
6647 * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
6648 */
6649 var SyntheticTransitionEvent = SyntheticEvent$1.extend({
6650 propertyName: null,
6651 elapsedTime: null,
6652 pseudoElement: null
6653 });
6654
6655 /**
6656 * @interface WheelEvent
6657 * @see http://www.w3.org/TR/DOM-Level-3-Events/
6658 */
6659 var SyntheticWheelEvent = SyntheticMouseEvent.extend({
6660 deltaX: function (event) {
6661 return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
6662 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
6663 },
6664 deltaY: function (event) {
6665 return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
6666 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
6667 'wheelDelta' in event ? -event.wheelDelta : 0;
6668 },
6669
6670 deltaZ: null,
6671
6672 // Browsers without "deltaMode" is reporting in raw wheel delta where one
6673 // notch on the scroll is always +/- 120, roughly equivalent to pixels.
6674 // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
6675 // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
6676 deltaMode: null
6677 });
6678
6679 /**
6680 * Turns
6681 * ['abort', ...]
6682 * into
6683 * eventTypes = {
6684 * 'abort': {
6685 * phasedRegistrationNames: {
6686 * bubbled: 'onAbort',
6687 * captured: 'onAbortCapture',
6688 * },
6689 * dependencies: ['topAbort'],
6690 * },
6691 * ...
6692 * };
6693 * topLevelEventsToDispatchConfig = {
6694 * 'topAbort': { sameConfig }
6695 * };
6696 */
6697 var interactiveEventTypeNames = ['blur', 'cancel', 'click', 'close', 'contextMenu', 'copy', 'cut', 'doubleClick', 'dragEnd', 'dragStart', 'drop', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'mouseDown', 'mouseUp', 'paste', 'pause', 'play', 'rateChange', 'reset', 'seeked', 'submit', 'touchCancel', 'touchEnd', 'touchStart', 'volumeChange'];
6698 var nonInteractiveEventTypeNames = ['abort', 'animationEnd', 'animationIteration', 'animationStart', 'canPlay', 'canPlayThrough', 'drag', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'mouseMove', 'mouseOut', 'mouseOver', 'playing', 'progress', 'scroll', 'seeking', 'stalled', 'suspend', 'timeUpdate', 'toggle', 'touchMove', 'transitionEnd', 'waiting', 'wheel'];
6699
6700 var eventTypes$4 = {};
6701 var topLevelEventsToDispatchConfig = {};
6702
6703 function addEventTypeNameToConfig(event, isInteractive) {
6704 var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
6705 var onEvent = 'on' + capitalizedEvent;
6706 var topEvent = 'top' + capitalizedEvent;
6707
6708 var type = {
6709 phasedRegistrationNames: {
6710 bubbled: onEvent,
6711 captured: onEvent + 'Capture'
6712 },
6713 dependencies: [topEvent],
6714 isInteractive: isInteractive
6715 };
6716 eventTypes$4[event] = type;
6717 topLevelEventsToDispatchConfig[topEvent] = type;
6718 }
6719
6720 interactiveEventTypeNames.forEach(function (eventTypeName) {
6721 addEventTypeNameToConfig(eventTypeName, true);
6722 });
6723 nonInteractiveEventTypeNames.forEach(function (eventTypeName) {
6724 addEventTypeNameToConfig(eventTypeName, false);
6725 });
6726
6727 // Only used in DEV for exhaustiveness validation.
6728 var knownHTMLTopLevelTypes = ['topAbort', 'topCancel', 'topCanPlay', 'topCanPlayThrough', 'topClose', 'topDurationChange', 'topEmptied', 'topEncrypted', 'topEnded', 'topError', 'topInput', 'topInvalid', 'topLoad', 'topLoadedData', 'topLoadedMetadata', 'topLoadStart', 'topPause', 'topPlay', 'topPlaying', 'topProgress', 'topRateChange', 'topReset', 'topSeeked', 'topSeeking', 'topStalled', 'topSubmit', 'topSuspend', 'topTimeUpdate', 'topToggle', 'topVolumeChange', 'topWaiting'];
6729
6730 var SimpleEventPlugin = {
6731 eventTypes: eventTypes$4,
6732
6733 isInteractiveTopLevelEventType: function (topLevelType) {
6734 var config = topLevelEventsToDispatchConfig[topLevelType];
6735 return config !== undefined && config.isInteractive === true;
6736 },
6737
6738
6739 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
6740 var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
6741 if (!dispatchConfig) {
6742 return null;
6743 }
6744 var EventConstructor = void 0;
6745 switch (topLevelType) {
6746 case 'topKeyPress':
6747 // Firefox creates a keypress event for function keys too. This removes
6748 // the unwanted keypress events. Enter is however both printable and
6749 // non-printable. One would expect Tab to be as well (but it isn't).
6750 if (getEventCharCode(nativeEvent) === 0) {
6751 return null;
6752 }
6753 /* falls through */
6754 case 'topKeyDown':
6755 case 'topKeyUp':
6756 EventConstructor = SyntheticKeyboardEvent;
6757 break;
6758 case 'topBlur':
6759 case 'topFocus':
6760 EventConstructor = SyntheticFocusEvent;
6761 break;
6762 case 'topClick':
6763 // Firefox creates a click event on right mouse clicks. This removes the
6764 // unwanted click events.
6765 if (nativeEvent.button === 2) {
6766 return null;
6767 }
6768 /* falls through */
6769 case 'topDoubleClick':
6770 case 'topMouseDown':
6771 case 'topMouseMove':
6772 case 'topMouseUp':
6773 // TODO: Disabled elements should not respond to mouse events
6774 /* falls through */
6775 case 'topMouseOut':
6776 case 'topMouseOver':
6777 case 'topContextMenu':
6778 EventConstructor = SyntheticMouseEvent;
6779 break;
6780 case 'topDrag':
6781 case 'topDragEnd':
6782 case 'topDragEnter':
6783 case 'topDragExit':
6784 case 'topDragLeave':
6785 case 'topDragOver':
6786 case 'topDragStart':
6787 case 'topDrop':
6788 EventConstructor = SyntheticDragEvent;
6789 break;
6790 case 'topTouchCancel':
6791 case 'topTouchEnd':
6792 case 'topTouchMove':
6793 case 'topTouchStart':
6794 EventConstructor = SyntheticTouchEvent;
6795 break;
6796 case 'topAnimationEnd':
6797 case 'topAnimationIteration':
6798 case 'topAnimationStart':
6799 EventConstructor = SyntheticAnimationEvent;
6800 break;
6801 case 'topTransitionEnd':
6802 EventConstructor = SyntheticTransitionEvent;
6803 break;
6804 case 'topScroll':
6805 EventConstructor = SyntheticUIEvent;
6806 break;
6807 case 'topWheel':
6808 EventConstructor = SyntheticWheelEvent;
6809 break;
6810 case 'topCopy':
6811 case 'topCut':
6812 case 'topPaste':
6813 EventConstructor = SyntheticClipboardEvent;
6814 break;
6815 default:
6816 {
6817 if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
6818 warning(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
6819 }
6820 }
6821 // HTML Events
6822 // @see http://www.w3.org/TR/html5/index.html#events-0
6823 EventConstructor = SyntheticEvent$1;
6824 break;
6825 }
6826 var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
6827 accumulateTwoPhaseDispatches(event);
6828 return event;
6829 }
6830 };
6831
6832 var isInteractiveTopLevelEventType = SimpleEventPlugin.isInteractiveTopLevelEventType;
6833
6834
6835 var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
6836 var callbackBookkeepingPool = [];
6837
6838 /**
6839 * Find the deepest React component completely containing the root of the
6840 * passed-in instance (for use when entire React trees are nested within each
6841 * other). If React trees are not nested, returns null.
6842 */
6843 function findRootContainerNode(inst) {
6844 // TODO: It may be a good idea to cache this to prevent unnecessary DOM
6845 // traversal, but caching is difficult to do correctly without using a
6846 // mutation observer to listen for all DOM changes.
6847 while (inst['return']) {
6848 inst = inst['return'];
6849 }
6850 if (inst.tag !== HostRoot) {
6851 // This can happen if we're in a detached tree.
6852 return null;
6853 }
6854 return inst.stateNode.containerInfo;
6855 }
6856
6857 // Used to store ancestor hierarchy in top level callback
6858 function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) {
6859 if (callbackBookkeepingPool.length) {
6860 var instance = callbackBookkeepingPool.pop();
6861 instance.topLevelType = topLevelType;
6862 instance.nativeEvent = nativeEvent;
6863 instance.targetInst = targetInst;
6864 return instance;
6865 }
6866 return {
6867 topLevelType: topLevelType,
6868 nativeEvent: nativeEvent,
6869 targetInst: targetInst,
6870 ancestors: []
6871 };
6872 }
6873
6874 function releaseTopLevelCallbackBookKeeping(instance) {
6875 instance.topLevelType = null;
6876 instance.nativeEvent = null;
6877 instance.targetInst = null;
6878 instance.ancestors.length = 0;
6879 if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
6880 callbackBookkeepingPool.push(instance);
6881 }
6882 }
6883
6884 function handleTopLevel(bookKeeping) {
6885 var targetInst = bookKeeping.targetInst;
6886
6887 // Loop through the hierarchy, in case there's any nested components.
6888 // It's important that we build the array of ancestors before calling any
6889 // event handlers, because event handlers can modify the DOM, leading to
6890 // inconsistencies with ReactMount's node cache. See #1105.
6891 var ancestor = targetInst;
6892 do {
6893 if (!ancestor) {
6894 bookKeeping.ancestors.push(ancestor);
6895 break;
6896 }
6897 var root = findRootContainerNode(ancestor);
6898 if (!root) {
6899 break;
6900 }
6901 bookKeeping.ancestors.push(ancestor);
6902 ancestor = getClosestInstanceFromNode(root);
6903 } while (ancestor);
6904
6905 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
6906 targetInst = bookKeeping.ancestors[i];
6907 runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
6908 }
6909 }
6910
6911 // TODO: can we stop exporting these?
6912 var _enabled = true;
6913
6914 function setEnabled(enabled) {
6915 _enabled = !!enabled;
6916 }
6917
6918 function isEnabled() {
6919 return _enabled;
6920 }
6921
6922 /**
6923 * Traps top-level events by using event bubbling.
6924 *
6925 * @param {string} topLevelType Record from `BrowserEventConstants`.
6926 * @param {string} handlerBaseName Event name (e.g. "click").
6927 * @param {object} element Element on which to attach listener.
6928 * @return {?object} An object with a remove function which will forcefully
6929 * remove the listener.
6930 * @internal
6931 */
6932 function trapBubbledEvent(topLevelType, handlerBaseName, element) {
6933 if (!element) {
6934 return null;
6935 }
6936 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
6937
6938 addEventBubbleListener(element, handlerBaseName,
6939 // Check if interactive and wrap in interactiveUpdates
6940 dispatch.bind(null, topLevelType));
6941 }
6942
6943 /**
6944 * Traps a top-level event by using event capturing.
6945 *
6946 * @param {string} topLevelType Record from `BrowserEventConstants`.
6947 * @param {string} handlerBaseName Event name (e.g. "click").
6948 * @param {object} element Element on which to attach listener.
6949 * @return {?object} An object with a remove function which will forcefully
6950 * remove the listener.
6951 * @internal
6952 */
6953 function trapCapturedEvent(topLevelType, handlerBaseName, element) {
6954 if (!element) {
6955 return null;
6956 }
6957 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
6958
6959 addEventCaptureListener(element, handlerBaseName,
6960 // Check if interactive and wrap in interactiveUpdates
6961 dispatch.bind(null, topLevelType));
6962 }
6963
6964 function dispatchInteractiveEvent(topLevelType, nativeEvent) {
6965 interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);
6966 }
6967
6968 function dispatchEvent(topLevelType, nativeEvent) {
6969 if (!_enabled) {
6970 return;
6971 }
6972
6973 var nativeEventTarget = getEventTarget(nativeEvent);
6974 var targetInst = getClosestInstanceFromNode(nativeEventTarget);
6975 if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) {
6976 // If we get an event (ex: img onload) before committing that
6977 // component's mount, ignore it for now (that is, treat it as if it was an
6978 // event on a non-React tree). We might also consider queueing events and
6979 // dispatching them after the mount.
6980 targetInst = null;
6981 }
6982
6983 var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst);
6984
6985 try {
6986 // Event queue being processed in the same cycle allows
6987 // `preventDefault`.
6988 batchedUpdates(handleTopLevel, bookKeeping);
6989 } finally {
6990 releaseTopLevelCallbackBookKeeping(bookKeeping);
6991 }
6992 }
6993
6994 var ReactDOMEventListener = Object.freeze({
6995 get _enabled () { return _enabled; },
6996 setEnabled: setEnabled,
6997 isEnabled: isEnabled,
6998 trapBubbledEvent: trapBubbledEvent,
6999 trapCapturedEvent: trapCapturedEvent,
7000 dispatchEvent: dispatchEvent
7001 });
7002
7003 /**
7004 * Generate a mapping of standard vendor prefixes using the defined style property and event name.
7005 *
7006 * @param {string} styleProp
7007 * @param {string} eventName
7008 * @returns {object}
7009 */
7010 function makePrefixMap(styleProp, eventName) {
7011 var prefixes = {};
7012
7013 prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
7014 prefixes['Webkit' + styleProp] = 'webkit' + eventName;
7015 prefixes['Moz' + styleProp] = 'moz' + eventName;
7016 prefixes['ms' + styleProp] = 'MS' + eventName;
7017 prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
7018
7019 return prefixes;
7020 }
7021
7022 /**
7023 * A list of event names to a configurable list of vendor prefixes.
7024 */
7025 var vendorPrefixes = {
7026 animationend: makePrefixMap('Animation', 'AnimationEnd'),
7027 animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
7028 animationstart: makePrefixMap('Animation', 'AnimationStart'),
7029 transitionend: makePrefixMap('Transition', 'TransitionEnd')
7030 };
7031
7032 /**
7033 * Event names that have already been detected and prefixed (if applicable).
7034 */
7035 var prefixedEventNames = {};
7036
7037 /**
7038 * Element to check for prefixes on.
7039 */
7040 var style = {};
7041
7042 /**
7043 * Bootstrap if a DOM exists.
7044 */
7045 if (ExecutionEnvironment.canUseDOM) {
7046 style = document.createElement('div').style;
7047
7048 // On some platforms, in particular some releases of Android 4.x,
7049 // the un-prefixed "animation" and "transition" properties are defined on the
7050 // style object but the events that fire will still be prefixed, so we need
7051 // to check if the un-prefixed events are usable, and if not remove them from the map.
7052 if (!('AnimationEvent' in window)) {
7053 delete vendorPrefixes.animationend.animation;
7054 delete vendorPrefixes.animationiteration.animation;
7055 delete vendorPrefixes.animationstart.animation;
7056 }
7057
7058 // Same as above
7059 if (!('TransitionEvent' in window)) {
7060 delete vendorPrefixes.transitionend.transition;
7061 }
7062 }
7063
7064 /**
7065 * Attempts to determine the correct vendor prefixed event name.
7066 *
7067 * @param {string} eventName
7068 * @returns {string}
7069 */
7070 function getVendorPrefixedEventName(eventName) {
7071 if (prefixedEventNames[eventName]) {
7072 return prefixedEventNames[eventName];
7073 } else if (!vendorPrefixes[eventName]) {
7074 return eventName;
7075 }
7076
7077 var prefixMap = vendorPrefixes[eventName];
7078
7079 for (var styleProp in prefixMap) {
7080 if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
7081 return prefixedEventNames[eventName] = prefixMap[styleProp];
7082 }
7083 }
7084
7085 return eventName;
7086 }
7087
7088 /**
7089 * Types of raw signals from the browser caught at the top level.
7090 *
7091 * For events like 'submit' or audio/video events which don't consistently
7092 * bubble (which we trap at a lower node than `document`), binding
7093 * at `document` would cause duplicate events so we don't include them here.
7094 */
7095 var topLevelTypes = {
7096 topAnimationEnd: getVendorPrefixedEventName('animationend'),
7097 topAnimationIteration: getVendorPrefixedEventName('animationiteration'),
7098 topAnimationStart: getVendorPrefixedEventName('animationstart'),
7099 topBlur: 'blur',
7100 topCancel: 'cancel',
7101 topChange: 'change',
7102 topClick: 'click',
7103 topClose: 'close',
7104 topCompositionEnd: 'compositionend',
7105 topCompositionStart: 'compositionstart',
7106 topCompositionUpdate: 'compositionupdate',
7107 topContextMenu: 'contextmenu',
7108 topCopy: 'copy',
7109 topCut: 'cut',
7110 topDoubleClick: 'dblclick',
7111 topDrag: 'drag',
7112 topDragEnd: 'dragend',
7113 topDragEnter: 'dragenter',
7114 topDragExit: 'dragexit',
7115 topDragLeave: 'dragleave',
7116 topDragOver: 'dragover',
7117 topDragStart: 'dragstart',
7118 topDrop: 'drop',
7119 topFocus: 'focus',
7120 topInput: 'input',
7121 topKeyDown: 'keydown',
7122 topKeyPress: 'keypress',
7123 topKeyUp: 'keyup',
7124 topLoad: 'load',
7125 topLoadStart: 'loadstart',
7126 topMouseDown: 'mousedown',
7127 topMouseMove: 'mousemove',
7128 topMouseOut: 'mouseout',
7129 topMouseOver: 'mouseover',
7130 topMouseUp: 'mouseup',
7131 topPaste: 'paste',
7132 topScroll: 'scroll',
7133 topSelectionChange: 'selectionchange',
7134 topTextInput: 'textInput',
7135 topToggle: 'toggle',
7136 topTouchCancel: 'touchcancel',
7137 topTouchEnd: 'touchend',
7138 topTouchMove: 'touchmove',
7139 topTouchStart: 'touchstart',
7140 topTransitionEnd: getVendorPrefixedEventName('transitionend'),
7141 topWheel: 'wheel'
7142 };
7143
7144 // There are so many media events, it makes sense to just
7145 // maintain a list of them. Note these aren't technically
7146 // "top-level" since they don't bubble. We should come up
7147 // with a better naming convention if we come to refactoring
7148 // the event system.
7149 var mediaEventTypes = {
7150 topAbort: 'abort',
7151 topCanPlay: 'canplay',
7152 topCanPlayThrough: 'canplaythrough',
7153 topDurationChange: 'durationchange',
7154 topEmptied: 'emptied',
7155 topEncrypted: 'encrypted',
7156 topEnded: 'ended',
7157 topError: 'error',
7158 topLoadedData: 'loadeddata',
7159 topLoadedMetadata: 'loadedmetadata',
7160 topLoadStart: 'loadstart',
7161 topPause: 'pause',
7162 topPlay: 'play',
7163 topPlaying: 'playing',
7164 topProgress: 'progress',
7165 topRateChange: 'ratechange',
7166 topSeeked: 'seeked',
7167 topSeeking: 'seeking',
7168 topStalled: 'stalled',
7169 topSuspend: 'suspend',
7170 topTimeUpdate: 'timeupdate',
7171 topVolumeChange: 'volumechange',
7172 topWaiting: 'waiting'
7173 };
7174
7175 /**
7176 * Summary of `ReactBrowserEventEmitter` event handling:
7177 *
7178 * - Top-level delegation is used to trap most native browser events. This
7179 * may only occur in the main thread and is the responsibility of
7180 * ReactDOMEventListener, which is injected and can therefore support
7181 * pluggable event sources. This is the only work that occurs in the main
7182 * thread.
7183 *
7184 * - We normalize and de-duplicate events to account for browser quirks. This
7185 * may be done in the worker thread.
7186 *
7187 * - Forward these native events (with the associated top-level type used to
7188 * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
7189 * to extract any synthetic events.
7190 *
7191 * - The `EventPluginHub` will then process each event by annotating them with
7192 * "dispatches", a sequence of listeners and IDs that care about that event.
7193 *
7194 * - The `EventPluginHub` then dispatches the events.
7195 *
7196 * Overview of React and the event system:
7197 *
7198 * +------------+ .
7199 * | DOM | .
7200 * +------------+ .
7201 * | .
7202 * v .
7203 * +------------+ .
7204 * | ReactEvent | .
7205 * | Listener | .
7206 * +------------+ . +-----------+
7207 * | . +--------+|SimpleEvent|
7208 * | . | |Plugin |
7209 * +-----|------+ . v +-----------+
7210 * | | | . +--------------+ +------------+
7211 * | +-----------.--->|EventPluginHub| | Event |
7212 * | | . | | +-----------+ | Propagators|
7213 * | ReactEvent | . | | |TapEvent | |------------|
7214 * | Emitter | . | |<---+|Plugin | |other plugin|
7215 * | | . | | +-----------+ | utilities |
7216 * | +-----------.--->| | +------------+
7217 * | | | . +--------------+
7218 * +-----|------+ . ^ +-----------+
7219 * | . | |Enter/Leave|
7220 * + . +-------+|Plugin |
7221 * +-------------+ . +-----------+
7222 * | application | .
7223 * |-------------| .
7224 * | | .
7225 * | | .
7226 * +-------------+ .
7227 * .
7228 * React Core . General Purpose Event Plugin System
7229 */
7230
7231 var alreadyListeningTo = {};
7232 var reactTopListenersCounter = 0;
7233
7234 /**
7235 * To ensure no conflicts with other potential React instances on the page
7236 */
7237 var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2);
7238
7239 function getListeningForDocument(mountAt) {
7240 // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
7241 // directly.
7242 if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
7243 mountAt[topListenersIDKey] = reactTopListenersCounter++;
7244 alreadyListeningTo[mountAt[topListenersIDKey]] = {};
7245 }
7246 return alreadyListeningTo[mountAt[topListenersIDKey]];
7247 }
7248
7249 /**
7250 * We listen for bubbled touch events on the document object.
7251 *
7252 * Firefox v8.01 (and possibly others) exhibited strange behavior when
7253 * mounting `onmousemove` events at some node that was not the document
7254 * element. The symptoms were that if your mouse is not moving over something
7255 * contained within that mount point (for example on the background) the
7256 * top-level listeners for `onmousemove` won't be called. However, if you
7257 * register the `mousemove` on the document object, then it will of course
7258 * catch all `mousemove`s. This along with iOS quirks, justifies restricting
7259 * top-level listeners to the document object only, at least for these
7260 * movement types of events and possibly all events.
7261 *
7262 * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
7263 *
7264 * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
7265 * they bubble to document.
7266 *
7267 * @param {string} registrationName Name of listener (e.g. `onClick`).
7268 * @param {object} contentDocumentHandle Document which owns the container
7269 */
7270 function listenTo(registrationName, contentDocumentHandle) {
7271 var mountAt = contentDocumentHandle;
7272 var isListening = getListeningForDocument(mountAt);
7273 var dependencies = registrationNameDependencies[registrationName];
7274
7275 for (var i = 0; i < dependencies.length; i++) {
7276 var dependency = dependencies[i];
7277 if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
7278 if (dependency === 'topScroll') {
7279 trapCapturedEvent('topScroll', 'scroll', mountAt);
7280 } else if (dependency === 'topFocus' || dependency === 'topBlur') {
7281 trapCapturedEvent('topFocus', 'focus', mountAt);
7282 trapCapturedEvent('topBlur', 'blur', mountAt);
7283
7284 // to make sure blur and focus event listeners are only attached once
7285 isListening.topBlur = true;
7286 isListening.topFocus = true;
7287 } else if (dependency === 'topCancel') {
7288 if (isEventSupported('cancel', true)) {
7289 trapCapturedEvent('topCancel', 'cancel', mountAt);
7290 }
7291 isListening.topCancel = true;
7292 } else if (dependency === 'topClose') {
7293 if (isEventSupported('close', true)) {
7294 trapCapturedEvent('topClose', 'close', mountAt);
7295 }
7296 isListening.topClose = true;
7297 } else if (topLevelTypes.hasOwnProperty(dependency)) {
7298 trapBubbledEvent(dependency, topLevelTypes[dependency], mountAt);
7299 }
7300
7301 isListening[dependency] = true;
7302 }
7303 }
7304 }
7305
7306 function isListeningToAllDependencies(registrationName, mountAt) {
7307 var isListening = getListeningForDocument(mountAt);
7308 var dependencies = registrationNameDependencies[registrationName];
7309 for (var i = 0; i < dependencies.length; i++) {
7310 var dependency = dependencies[i];
7311 if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
7312 return false;
7313 }
7314 }
7315 return true;
7316 }
7317
7318 /**
7319 * Given any node return the first leaf node without children.
7320 *
7321 * @param {DOMElement|DOMTextNode} node
7322 * @return {DOMElement|DOMTextNode}
7323 */
7324 function getLeafNode(node) {
7325 while (node && node.firstChild) {
7326 node = node.firstChild;
7327 }
7328 return node;
7329 }
7330
7331 /**
7332 * Get the next sibling within a container. This will walk up the
7333 * DOM if a node's siblings have been exhausted.
7334 *
7335 * @param {DOMElement|DOMTextNode} node
7336 * @return {?DOMElement|DOMTextNode}
7337 */
7338 function getSiblingNode(node) {
7339 while (node) {
7340 if (node.nextSibling) {
7341 return node.nextSibling;
7342 }
7343 node = node.parentNode;
7344 }
7345 }
7346
7347 /**
7348 * Get object describing the nodes which contain characters at offset.
7349 *
7350 * @param {DOMElement|DOMTextNode} root
7351 * @param {number} offset
7352 * @return {?object}
7353 */
7354 function getNodeForCharacterOffset(root, offset) {
7355 var node = getLeafNode(root);
7356 var nodeStart = 0;
7357 var nodeEnd = 0;
7358
7359 while (node) {
7360 if (node.nodeType === TEXT_NODE) {
7361 nodeEnd = nodeStart + node.textContent.length;
7362
7363 if (nodeStart <= offset && nodeEnd >= offset) {
7364 return {
7365 node: node,
7366 offset: offset - nodeStart
7367 };
7368 }
7369
7370 nodeStart = nodeEnd;
7371 }
7372
7373 node = getLeafNode(getSiblingNode(node));
7374 }
7375 }
7376
7377 /**
7378 * @param {DOMElement} outerNode
7379 * @return {?object}
7380 */
7381 function getOffsets(outerNode) {
7382 var selection = window.getSelection && window.getSelection();
7383
7384 if (!selection || selection.rangeCount === 0) {
7385 return null;
7386 }
7387
7388 var anchorNode = selection.anchorNode,
7389 anchorOffset = selection.anchorOffset,
7390 focusNode = selection.focusNode,
7391 focusOffset = selection.focusOffset;
7392
7393 // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the
7394 // up/down buttons on an <input type="number">. Anonymous divs do not seem to
7395 // expose properties, triggering a "Permission denied error" if any of its
7396 // properties are accessed. The only seemingly possible way to avoid erroring
7397 // is to access a property that typically works for non-anonymous divs and
7398 // catch any error that may otherwise arise. See
7399 // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
7400
7401 try {
7402 /* eslint-disable no-unused-expressions */
7403 anchorNode.nodeType;
7404 focusNode.nodeType;
7405 /* eslint-enable no-unused-expressions */
7406 } catch (e) {
7407 return null;
7408 }
7409
7410 return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
7411 }
7412
7413 /**
7414 * Returns {start, end} where `start` is the character/codepoint index of
7415 * (anchorNode, anchorOffset) within the textContent of `outerNode`, and
7416 * `end` is the index of (focusNode, focusOffset).
7417 *
7418 * Returns null if you pass in garbage input but we should probably just crash.
7419 *
7420 * Exported only for testing.
7421 */
7422 function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
7423 var length = 0;
7424 var start = -1;
7425 var end = -1;
7426 var indexWithinAnchor = 0;
7427 var indexWithinFocus = 0;
7428 var node = outerNode;
7429 var parentNode = null;
7430
7431 outer: while (true) {
7432 var next = null;
7433
7434 while (true) {
7435 if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
7436 start = length + anchorOffset;
7437 }
7438 if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
7439 end = length + focusOffset;
7440 }
7441
7442 if (node.nodeType === TEXT_NODE) {
7443 length += node.nodeValue.length;
7444 }
7445
7446 if ((next = node.firstChild) === null) {
7447 break;
7448 }
7449 // Moving from `node` to its first child `next`.
7450 parentNode = node;
7451 node = next;
7452 }
7453
7454 while (true) {
7455 if (node === outerNode) {
7456 // If `outerNode` has children, this is always the second time visiting
7457 // it. If it has no children, this is still the first loop, and the only
7458 // valid selection is anchorNode and focusNode both equal to this node
7459 // and both offsets 0, in which case we will have handled above.
7460 break outer;
7461 }
7462 if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
7463 start = length;
7464 }
7465 if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
7466 end = length;
7467 }
7468 if ((next = node.nextSibling) !== null) {
7469 break;
7470 }
7471 node = parentNode;
7472 parentNode = node.parentNode;
7473 }
7474
7475 // Moving from `node` to its next sibling `next`.
7476 node = next;
7477 }
7478
7479 if (start === -1 || end === -1) {
7480 // This should never happen. (Would happen if the anchor/focus nodes aren't
7481 // actually inside the passed-in node.)
7482 return null;
7483 }
7484
7485 return {
7486 start: start,
7487 end: end
7488 };
7489 }
7490
7491 /**
7492 * In modern non-IE browsers, we can support both forward and backward
7493 * selections.
7494 *
7495 * Note: IE10+ supports the Selection object, but it does not support
7496 * the `extend` method, which means that even in modern IE, it's not possible
7497 * to programmatically create a backward selection. Thus, for all IE
7498 * versions, we use the old IE API to create our selections.
7499 *
7500 * @param {DOMElement|DOMTextNode} node
7501 * @param {object} offsets
7502 */
7503 function setOffsets(node, offsets) {
7504 if (!window.getSelection) {
7505 return;
7506 }
7507
7508 var selection = window.getSelection();
7509 var length = node[getTextContentAccessor()].length;
7510 var start = Math.min(offsets.start, length);
7511 var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
7512
7513 // IE 11 uses modern selection, but doesn't support the extend method.
7514 // Flip backward selections, so we can set with a single range.
7515 if (!selection.extend && start > end) {
7516 var temp = end;
7517 end = start;
7518 start = temp;
7519 }
7520
7521 var startMarker = getNodeForCharacterOffset(node, start);
7522 var endMarker = getNodeForCharacterOffset(node, end);
7523
7524 if (startMarker && endMarker) {
7525 if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
7526 return;
7527 }
7528 var range = document.createRange();
7529 range.setStart(startMarker.node, startMarker.offset);
7530 selection.removeAllRanges();
7531
7532 if (start > end) {
7533 selection.addRange(range);
7534 selection.extend(endMarker.node, endMarker.offset);
7535 } else {
7536 range.setEnd(endMarker.node, endMarker.offset);
7537 selection.addRange(range);
7538 }
7539 }
7540 }
7541
7542 function isInDocument(node) {
7543 return containsNode(document.documentElement, node);
7544 }
7545
7546 /**
7547 * @ReactInputSelection: React input selection module. Based on Selection.js,
7548 * but modified to be suitable for react and has a couple of bug fixes (doesn't
7549 * assume buttons have range selections allowed).
7550 * Input selection module for React.
7551 */
7552
7553 function hasSelectionCapabilities(elem) {
7554 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
7555 return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
7556 }
7557
7558 function getSelectionInformation() {
7559 var focusedElem = getActiveElement();
7560 return {
7561 focusedElem: focusedElem,
7562 selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null
7563 };
7564 }
7565
7566 /**
7567 * @restoreSelection: If any selection information was potentially lost,
7568 * restore it. This is useful when performing operations that could remove dom
7569 * nodes and place them back in, resulting in focus being lost.
7570 */
7571 function restoreSelection(priorSelectionInformation) {
7572 var curFocusedElem = getActiveElement();
7573 var priorFocusedElem = priorSelectionInformation.focusedElem;
7574 var priorSelectionRange = priorSelectionInformation.selectionRange;
7575 if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
7576 if (hasSelectionCapabilities(priorFocusedElem)) {
7577 setSelection(priorFocusedElem, priorSelectionRange);
7578 }
7579
7580 // Focusing a node can change the scroll position, which is undesirable
7581 var ancestors = [];
7582 var ancestor = priorFocusedElem;
7583 while (ancestor = ancestor.parentNode) {
7584 if (ancestor.nodeType === ELEMENT_NODE) {
7585 ancestors.push({
7586 element: ancestor,
7587 left: ancestor.scrollLeft,
7588 top: ancestor.scrollTop
7589 });
7590 }
7591 }
7592
7593 priorFocusedElem.focus();
7594
7595 for (var i = 0; i < ancestors.length; i++) {
7596 var info = ancestors[i];
7597 info.element.scrollLeft = info.left;
7598 info.element.scrollTop = info.top;
7599 }
7600 }
7601 }
7602
7603 /**
7604 * @getSelection: Gets the selection bounds of a focused textarea, input or
7605 * contentEditable node.
7606 * -@input: Look up selection bounds of this input
7607 * -@return {start: selectionStart, end: selectionEnd}
7608 */
7609 function getSelection$1(input) {
7610 var selection = void 0;
7611
7612 if ('selectionStart' in input) {
7613 // Modern browser with input or textarea.
7614 selection = {
7615 start: input.selectionStart,
7616 end: input.selectionEnd
7617 };
7618 } else {
7619 // Content editable or old IE textarea.
7620 selection = getOffsets(input);
7621 }
7622
7623 return selection || { start: 0, end: 0 };
7624 }
7625
7626 /**
7627 * @setSelection: Sets the selection bounds of a textarea or input and focuses
7628 * the input.
7629 * -@input Set selection bounds of this input or textarea
7630 * -@offsets Object of same form that is returned from get*
7631 */
7632 function setSelection(input, offsets) {
7633 var start = offsets.start,
7634 end = offsets.end;
7635
7636 if (end === undefined) {
7637 end = start;
7638 }
7639
7640 if ('selectionStart' in input) {
7641 input.selectionStart = start;
7642 input.selectionEnd = Math.min(end, input.value.length);
7643 } else {
7644 setOffsets(input, offsets);
7645 }
7646 }
7647
7648 var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
7649
7650 var eventTypes$3 = {
7651 select: {
7652 phasedRegistrationNames: {
7653 bubbled: 'onSelect',
7654 captured: 'onSelectCapture'
7655 },
7656 dependencies: ['topBlur', 'topContextMenu', 'topFocus', 'topKeyDown', 'topKeyUp', 'topMouseDown', 'topMouseUp', 'topSelectionChange']
7657 }
7658 };
7659
7660 var activeElement$1 = null;
7661 var activeElementInst$1 = null;
7662 var lastSelection = null;
7663 var mouseDown = false;
7664
7665 /**
7666 * Get an object which is a unique representation of the current selection.
7667 *
7668 * The return value will not be consistent across nodes or browsers, but
7669 * two identical selections on the same node will return identical objects.
7670 *
7671 * @param {DOMElement} node
7672 * @return {object}
7673 */
7674 function getSelection(node) {
7675 if ('selectionStart' in node && hasSelectionCapabilities(node)) {
7676 return {
7677 start: node.selectionStart,
7678 end: node.selectionEnd
7679 };
7680 } else if (window.getSelection) {
7681 var selection = window.getSelection();
7682 return {
7683 anchorNode: selection.anchorNode,
7684 anchorOffset: selection.anchorOffset,
7685 focusNode: selection.focusNode,
7686 focusOffset: selection.focusOffset
7687 };
7688 }
7689 }
7690
7691 /**
7692 * Poll selection to see whether it's changed.
7693 *
7694 * @param {object} nativeEvent
7695 * @return {?SyntheticEvent}
7696 */
7697 function constructSelectEvent(nativeEvent, nativeEventTarget) {
7698 // Ensure we have the right element, and that the user is not dragging a
7699 // selection (this matches native `select` event behavior). In HTML5, select
7700 // fires only on input and textarea thus if there's no focused element we
7701 // won't dispatch.
7702 if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement()) {
7703 return null;
7704 }
7705
7706 // Only fire when selection has actually changed.
7707 var currentSelection = getSelection(activeElement$1);
7708 if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
7709 lastSelection = currentSelection;
7710
7711 var syntheticEvent = SyntheticEvent$1.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget);
7712
7713 syntheticEvent.type = 'select';
7714 syntheticEvent.target = activeElement$1;
7715
7716 accumulateTwoPhaseDispatches(syntheticEvent);
7717
7718 return syntheticEvent;
7719 }
7720
7721 return null;
7722 }
7723
7724 /**
7725 * This plugin creates an `onSelect` event that normalizes select events
7726 * across form elements.
7727 *
7728 * Supported elements are:
7729 * - input (see `isTextInputElement`)
7730 * - textarea
7731 * - contentEditable
7732 *
7733 * This differs from native browser implementations in the following ways:
7734 * - Fires on contentEditable fields as well as inputs.
7735 * - Fires for collapsed selection.
7736 * - Fires after user input.
7737 */
7738 var SelectEventPlugin = {
7739 eventTypes: eventTypes$3,
7740
7741 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
7742 var doc = nativeEventTarget.window === nativeEventTarget ? nativeEventTarget.document : nativeEventTarget.nodeType === DOCUMENT_NODE ? nativeEventTarget : nativeEventTarget.ownerDocument;
7743 // Track whether all listeners exists for this plugin. If none exist, we do
7744 // not extract events. See #3639.
7745 if (!doc || !isListeningToAllDependencies('onSelect', doc)) {
7746 return null;
7747 }
7748
7749 var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
7750
7751 switch (topLevelType) {
7752 // Track the input node that has focus.
7753 case 'topFocus':
7754 if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
7755 activeElement$1 = targetNode;
7756 activeElementInst$1 = targetInst;
7757 lastSelection = null;
7758 }
7759 break;
7760 case 'topBlur':
7761 activeElement$1 = null;
7762 activeElementInst$1 = null;
7763 lastSelection = null;
7764 break;
7765 // Don't fire the event while the user is dragging. This matches the
7766 // semantics of the native select event.
7767 case 'topMouseDown':
7768 mouseDown = true;
7769 break;
7770 case 'topContextMenu':
7771 case 'topMouseUp':
7772 mouseDown = false;
7773 return constructSelectEvent(nativeEvent, nativeEventTarget);
7774 // Chrome and IE fire non-standard event when selection is changed (and
7775 // sometimes when it hasn't). IE's event fires out of order with respect
7776 // to key and input events on deletion, so we discard it.
7777 //
7778 // Firefox doesn't support selectionchange, so check selection status
7779 // after each key entry. The selection changes after keydown and before
7780 // keyup, but we check on keydown as well in the case of holding down a
7781 // key, when multiple keydown events are fired but only one keyup is.
7782 // This is also our approach for IE handling, for the reason above.
7783 case 'topSelectionChange':
7784 if (skipSelectionChangeEvent) {
7785 break;
7786 }
7787 // falls through
7788 case 'topKeyDown':
7789 case 'topKeyUp':
7790 return constructSelectEvent(nativeEvent, nativeEventTarget);
7791 }
7792
7793 return null;
7794 }
7795 };
7796
7797 /**
7798 * Inject modules for resolving DOM hierarchy and plugin ordering.
7799 */
7800 injection.injectEventPluginOrder(DOMEventPluginOrder);
7801 injection$1.injectComponentTree(ReactDOMComponentTree);
7802
7803 /**
7804 * Some important event plugins included by default (without having to require
7805 * them).
7806 */
7807 injection.injectEventPluginsByName({
7808 SimpleEventPlugin: SimpleEventPlugin,
7809 EnterLeaveEventPlugin: EnterLeaveEventPlugin,
7810 ChangeEventPlugin: ChangeEventPlugin,
7811 SelectEventPlugin: SelectEventPlugin,
7812 BeforeInputEventPlugin: BeforeInputEventPlugin
7813 });
7814
7815 // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
7816 // Math.pow(2, 30) - 1
7817 // 0b111111111111111111111111111111
7818 var MAX_SIGNED_31_BIT_INT = 1073741823;
7819
7820 // TODO: Use an opaque type once ESLint et al support the syntax
7821
7822
7823 var NoWork = 0;
7824 var Sync = 1;
7825 var Never = MAX_SIGNED_31_BIT_INT;
7826
7827 var UNIT_SIZE = 10;
7828 var MAGIC_NUMBER_OFFSET = 2;
7829
7830 // 1 unit of expiration time represents 10ms.
7831 function msToExpirationTime(ms) {
7832 // Always add an offset so that we don't clash with the magic number for NoWork.
7833 return (ms / UNIT_SIZE | 0) + MAGIC_NUMBER_OFFSET;
7834 }
7835
7836 function expirationTimeToMs(expirationTime) {
7837 return (expirationTime - MAGIC_NUMBER_OFFSET) * UNIT_SIZE;
7838 }
7839
7840 function ceiling(num, precision) {
7841 return ((num / precision | 0) + 1) * precision;
7842 }
7843
7844 function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
7845 return ceiling(currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
7846 }
7847
7848 var NoContext = 0;
7849 var AsyncMode = 1;
7850 var StrictMode = 2;
7851
7852 var hasBadMapPolyfill = void 0;
7853
7854 {
7855 hasBadMapPolyfill = false;
7856 try {
7857 var nonExtensibleObject = Object.preventExtensions({});
7858 var testMap = new Map([[nonExtensibleObject, null]]);
7859 var testSet = new Set([nonExtensibleObject]);
7860 // This is necessary for Rollup to not consider these unused.
7861 // https://github.com/rollup/rollup/issues/1771
7862 // TODO: we can remove these if Rollup fixes the bug.
7863 testMap.set(0, 0);
7864 testSet.add(0);
7865 } catch (e) {
7866 // TODO: Consider warning about bad polyfills
7867 hasBadMapPolyfill = true;
7868 }
7869 }
7870
7871 // A Fiber is work on a Component that needs to be done or was done. There can
7872 // be more than one per component.
7873
7874
7875 var debugCounter = void 0;
7876
7877 {
7878 debugCounter = 1;
7879 }
7880
7881 function FiberNode(tag, pendingProps, key, mode) {
7882 // Instance
7883 this.tag = tag;
7884 this.key = key;
7885 this.type = null;
7886 this.stateNode = null;
7887
7888 // Fiber
7889 this['return'] = null;
7890 this.child = null;
7891 this.sibling = null;
7892 this.index = 0;
7893
7894 this.ref = null;
7895
7896 this.pendingProps = pendingProps;
7897 this.memoizedProps = null;
7898 this.updateQueue = null;
7899 this.memoizedState = null;
7900
7901 this.mode = mode;
7902
7903 // Effects
7904 this.effectTag = NoEffect;
7905 this.nextEffect = null;
7906
7907 this.firstEffect = null;
7908 this.lastEffect = null;
7909
7910 this.expirationTime = NoWork;
7911
7912 this.alternate = null;
7913
7914 {
7915 this._debugID = debugCounter++;
7916 this._debugSource = null;
7917 this._debugOwner = null;
7918 this._debugIsCurrentlyTiming = false;
7919 if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
7920 Object.preventExtensions(this);
7921 }
7922 }
7923 }
7924
7925 // This is a constructor function, rather than a POJO constructor, still
7926 // please ensure we do the following:
7927 // 1) Nobody should add any instance methods on this. Instance methods can be
7928 // more difficult to predict when they get optimized and they are almost
7929 // never inlined properly in static compilers.
7930 // 2) Nobody should rely on `instanceof Fiber` for type testing. We should
7931 // always know when it is a fiber.
7932 // 3) We might want to experiment with using numeric keys since they are easier
7933 // to optimize in a non-JIT environment.
7934 // 4) We can easily go from a constructor to a createFiber object literal if that
7935 // is faster.
7936 // 5) It should be easy to port this to a C struct and keep a C implementation
7937 // compatible.
7938 var createFiber = function (tag, pendingProps, key, mode) {
7939 // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
7940 return new FiberNode(tag, pendingProps, key, mode);
7941 };
7942
7943 function shouldConstruct(Component) {
7944 return !!(Component.prototype && Component.prototype.isReactComponent);
7945 }
7946
7947 // This is used to create an alternate fiber to do work on.
7948 function createWorkInProgress(current, pendingProps, expirationTime) {
7949 var workInProgress = current.alternate;
7950 if (workInProgress === null) {
7951 // We use a double buffering pooling technique because we know that we'll
7952 // only ever need at most two versions of a tree. We pool the "other" unused
7953 // node that we're free to reuse. This is lazily created to avoid allocating
7954 // extra objects for things that are never updated. It also allow us to
7955 // reclaim the extra memory if needed.
7956 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
7957 workInProgress.type = current.type;
7958 workInProgress.stateNode = current.stateNode;
7959
7960 {
7961 // DEV-only fields
7962 workInProgress._debugID = current._debugID;
7963 workInProgress._debugSource = current._debugSource;
7964 workInProgress._debugOwner = current._debugOwner;
7965 }
7966
7967 workInProgress.alternate = current;
7968 current.alternate = workInProgress;
7969 } else {
7970 workInProgress.pendingProps = pendingProps;
7971
7972 // We already have an alternate.
7973 // Reset the effect tag.
7974 workInProgress.effectTag = NoEffect;
7975
7976 // The effect list is no longer valid.
7977 workInProgress.nextEffect = null;
7978 workInProgress.firstEffect = null;
7979 workInProgress.lastEffect = null;
7980 }
7981
7982 workInProgress.expirationTime = expirationTime;
7983
7984 workInProgress.child = current.child;
7985 workInProgress.memoizedProps = current.memoizedProps;
7986 workInProgress.memoizedState = current.memoizedState;
7987 workInProgress.updateQueue = current.updateQueue;
7988
7989 // These will be overridden during the parent's reconciliation
7990 workInProgress.sibling = current.sibling;
7991 workInProgress.index = current.index;
7992 workInProgress.ref = current.ref;
7993
7994 return workInProgress;
7995 }
7996
7997 function createHostRootFiber(isAsync) {
7998 var mode = isAsync ? AsyncMode | StrictMode : NoContext;
7999 return createFiber(HostRoot, null, null, mode);
8000 }
8001
8002 function createFiberFromElement(element, mode, expirationTime) {
8003 var owner = null;
8004 {
8005 owner = element._owner;
8006 }
8007
8008 var fiber = void 0;
8009 var type = element.type;
8010 var key = element.key;
8011 var pendingProps = element.props;
8012
8013 var fiberTag = void 0;
8014 if (typeof type === 'function') {
8015 fiberTag = shouldConstruct(type) ? ClassComponent : IndeterminateComponent;
8016 } else if (typeof type === 'string') {
8017 fiberTag = HostComponent;
8018 } else {
8019 switch (type) {
8020 case REACT_FRAGMENT_TYPE:
8021 return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
8022 case REACT_ASYNC_MODE_TYPE:
8023 fiberTag = Mode;
8024 mode |= AsyncMode | StrictMode;
8025 break;
8026 case REACT_STRICT_MODE_TYPE:
8027 fiberTag = Mode;
8028 mode |= StrictMode;
8029 break;
8030 case REACT_CALL_TYPE:
8031 fiberTag = CallComponent;
8032 break;
8033 case REACT_RETURN_TYPE:
8034 fiberTag = ReturnComponent;
8035 break;
8036 default:
8037 {
8038 if (typeof type === 'object' && type !== null) {
8039 switch (type.$$typeof) {
8040 case REACT_PROVIDER_TYPE:
8041 fiberTag = ContextProvider;
8042 break;
8043 case REACT_CONTEXT_TYPE:
8044 // This is a consumer
8045 fiberTag = ContextConsumer;
8046 break;
8047 case REACT_FORWARD_REF_TYPE:
8048 fiberTag = ForwardRef;
8049 break;
8050 default:
8051 if (typeof type.tag === 'number') {
8052 // Currently assumed to be a continuation and therefore is a
8053 // fiber already.
8054 // TODO: The yield system is currently broken for updates in
8055 // some cases. The reified yield stores a fiber, but we don't
8056 // know which fiber that is; the current or a workInProgress?
8057 // When the continuation gets rendered here we don't know if we
8058 // can reuse that fiber or if we need to clone it. There is
8059 // probably a clever way to restructure this.
8060 fiber = type;
8061 fiber.pendingProps = pendingProps;
8062 fiber.expirationTime = expirationTime;
8063 return fiber;
8064 } else {
8065 throwOnInvalidElementType(type, owner);
8066 }
8067 break;
8068 }
8069 } else {
8070 throwOnInvalidElementType(type, owner);
8071 }
8072 }
8073 }
8074 }
8075
8076 fiber = createFiber(fiberTag, pendingProps, key, mode);
8077 fiber.type = type;
8078 fiber.expirationTime = expirationTime;
8079
8080 {
8081 fiber._debugSource = element._source;
8082 fiber._debugOwner = element._owner;
8083 }
8084
8085 return fiber;
8086 }
8087
8088 function throwOnInvalidElementType(type, owner) {
8089 var info = '';
8090 {
8091 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
8092 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.';
8093 }
8094 var ownerName = owner ? getComponentName(owner) : null;
8095 if (ownerName) {
8096 info += '\n\nCheck the render method of `' + ownerName + '`.';
8097 }
8098 }
8099 invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info);
8100 }
8101
8102 function createFiberFromFragment(elements, mode, expirationTime, key) {
8103 var fiber = createFiber(Fragment, elements, key, mode);
8104 fiber.expirationTime = expirationTime;
8105 return fiber;
8106 }
8107
8108 function createFiberFromText(content, mode, expirationTime) {
8109 var fiber = createFiber(HostText, content, null, mode);
8110 fiber.expirationTime = expirationTime;
8111 return fiber;
8112 }
8113
8114 function createFiberFromHostInstanceForDeletion() {
8115 var fiber = createFiber(HostComponent, null, null, NoContext);
8116 fiber.type = 'DELETED';
8117 return fiber;
8118 }
8119
8120 function createFiberFromPortal(portal, mode, expirationTime) {
8121 var pendingProps = portal.children !== null ? portal.children : [];
8122 var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
8123 fiber.expirationTime = expirationTime;
8124 fiber.stateNode = {
8125 containerInfo: portal.containerInfo,
8126 pendingChildren: null, // Used by persistent updates
8127 implementation: portal.implementation
8128 };
8129 return fiber;
8130 }
8131
8132 // Used for stashing WIP properties to replay failed work in DEV.
8133 function assignFiberPropertiesInDEV(target, source) {
8134 if (target === null) {
8135 // This Fiber's initial properties will always be overwritten.
8136 // We only use a Fiber to ensure the same hidden class so DEV isn't slow.
8137 target = createFiber(IndeterminateComponent, null, null, NoContext);
8138 }
8139
8140 // This is intentionally written as a list of all properties.
8141 // We tried to use Object.assign() instead but this is called in
8142 // the hottest path, and Object.assign() was too slow:
8143 // https://github.com/facebook/react/issues/12502
8144 // This code is DEV-only so size is not a concern.
8145
8146 target.tag = source.tag;
8147 target.key = source.key;
8148 target.type = source.type;
8149 target.stateNode = source.stateNode;
8150 target['return'] = source['return'];
8151 target.child = source.child;
8152 target.sibling = source.sibling;
8153 target.index = source.index;
8154 target.ref = source.ref;
8155 target.pendingProps = source.pendingProps;
8156 target.memoizedProps = source.memoizedProps;
8157 target.updateQueue = source.updateQueue;
8158 target.memoizedState = source.memoizedState;
8159 target.mode = source.mode;
8160 target.effectTag = source.effectTag;
8161 target.nextEffect = source.nextEffect;
8162 target.firstEffect = source.firstEffect;
8163 target.lastEffect = source.lastEffect;
8164 target.expirationTime = source.expirationTime;
8165 target.alternate = source.alternate;
8166 target._debugID = source._debugID;
8167 target._debugSource = source._debugSource;
8168 target._debugOwner = source._debugOwner;
8169 target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
8170 return target;
8171 }
8172
8173 // TODO: This should be lifted into the renderer.
8174
8175
8176 function createFiberRoot(containerInfo, isAsync, hydrate) {
8177 // Cyclic construction. This cheats the type system right now because
8178 // stateNode is any.
8179 var uninitializedFiber = createHostRootFiber(isAsync);
8180 var root = {
8181 current: uninitializedFiber,
8182 containerInfo: containerInfo,
8183 pendingChildren: null,
8184 pendingCommitExpirationTime: NoWork,
8185 finishedWork: null,
8186 context: null,
8187 pendingContext: null,
8188 hydrate: hydrate,
8189 remainingExpirationTime: NoWork,
8190 firstBatch: null,
8191 nextScheduledRoot: null
8192 };
8193 uninitializedFiber.stateNode = root;
8194 return root;
8195 }
8196
8197 var onCommitFiberRoot = null;
8198 var onCommitFiberUnmount = null;
8199 var hasLoggedError = false;
8200
8201 function catchErrors(fn) {
8202 return function (arg) {
8203 try {
8204 return fn(arg);
8205 } catch (err) {
8206 if (true && !hasLoggedError) {
8207 hasLoggedError = true;
8208 warning(false, 'React DevTools encountered an error: %s', err);
8209 }
8210 }
8211 };
8212 }
8213
8214 function injectInternals(internals) {
8215 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
8216 // No DevTools
8217 return false;
8218 }
8219 var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
8220 if (hook.isDisabled) {
8221 // This isn't a real property on the hook, but it can be set to opt out
8222 // of DevTools integration and associated warnings and logs.
8223 // https://github.com/facebook/react/issues/3877
8224 return true;
8225 }
8226 if (!hook.supportsFiber) {
8227 {
8228 warning(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
8229 }
8230 // DevTools exists, even though it doesn't support Fiber.
8231 return true;
8232 }
8233 try {
8234 var rendererID = hook.inject(internals);
8235 // We have successfully injected, so now it is safe to set up hooks.
8236 onCommitFiberRoot = catchErrors(function (root) {
8237 return hook.onCommitFiberRoot(rendererID, root);
8238 });
8239 onCommitFiberUnmount = catchErrors(function (fiber) {
8240 return hook.onCommitFiberUnmount(rendererID, fiber);
8241 });
8242 } catch (err) {
8243 // Catch all errors because it is unsafe to throw during initialization.
8244 {
8245 warning(false, 'React DevTools encountered an error: %s.', err);
8246 }
8247 }
8248 // DevTools exists
8249 return true;
8250 }
8251
8252 function onCommitRoot(root) {
8253 if (typeof onCommitFiberRoot === 'function') {
8254 onCommitFiberRoot(root);
8255 }
8256 }
8257
8258 function onCommitUnmount(fiber) {
8259 if (typeof onCommitFiberUnmount === 'function') {
8260 onCommitFiberUnmount(fiber);
8261 }
8262 }
8263
8264 /**
8265 * Forked from fbjs/warning:
8266 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
8267 *
8268 * Only change is we use console.warn instead of console.error,
8269 * and do nothing when 'console' is not supported.
8270 * This really simplifies the code.
8271 * ---
8272 * Similar to invariant but only logs a warning if the condition is not met.
8273 * This can be used to log issues in development environments in critical
8274 * paths. Removing the logging code for production environments will keep the
8275 * same logic and follow the same code paths.
8276 */
8277
8278 var lowPriorityWarning = function () {};
8279
8280 {
8281 var printWarning = function (format) {
8282 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
8283 args[_key - 1] = arguments[_key];
8284 }
8285
8286 var argIndex = 0;
8287 var message = 'Warning: ' + format.replace(/%s/g, function () {
8288 return args[argIndex++];
8289 });
8290 if (typeof console !== 'undefined') {
8291 console.warn(message);
8292 }
8293 try {
8294 // --- Welcome to debugging React ---
8295 // This error was thrown as a convenience so that you can use this stack
8296 // to find the callsite that caused this warning to fire.
8297 throw new Error(message);
8298 } catch (x) {}
8299 };
8300
8301 lowPriorityWarning = function (condition, format) {
8302 if (format === undefined) {
8303 throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
8304 }
8305 if (!condition) {
8306 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
8307 args[_key2 - 2] = arguments[_key2];
8308 }
8309
8310 printWarning.apply(undefined, [format].concat(args));
8311 }
8312 };
8313 }
8314
8315 var lowPriorityWarning$1 = lowPriorityWarning;
8316
8317 var ReactStrictModeWarnings = {
8318 discardPendingWarnings: function () {},
8319 flushPendingDeprecationWarnings: function () {},
8320 flushPendingUnsafeLifecycleWarnings: function () {},
8321 recordDeprecationWarnings: function (fiber, instance) {},
8322 recordUnsafeLifecycleWarnings: function (fiber, instance) {}
8323 };
8324
8325 {
8326 var LIFECYCLE_SUGGESTIONS = {
8327 UNSAFE_componentWillMount: 'componentDidMount',
8328 UNSAFE_componentWillReceiveProps: 'static getDerivedStateFromProps',
8329 UNSAFE_componentWillUpdate: 'componentDidUpdate'
8330 };
8331
8332 var pendingComponentWillMountWarnings = [];
8333 var pendingComponentWillReceivePropsWarnings = [];
8334 var pendingComponentWillUpdateWarnings = [];
8335 var pendingUnsafeLifecycleWarnings = new Map();
8336
8337 // Tracks components we have already warned about.
8338 var didWarnAboutDeprecatedLifecycles = new Set();
8339 var didWarnAboutUnsafeLifecycles = new Set();
8340
8341 var setToSortedString = function (set) {
8342 var array = [];
8343 set.forEach(function (value) {
8344 array.push(value);
8345 });
8346 return array.sort().join(', ');
8347 };
8348
8349 ReactStrictModeWarnings.discardPendingWarnings = function () {
8350 pendingComponentWillMountWarnings = [];
8351 pendingComponentWillReceivePropsWarnings = [];
8352 pendingComponentWillUpdateWarnings = [];
8353 pendingUnsafeLifecycleWarnings = new Map();
8354 };
8355
8356 ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
8357 pendingUnsafeLifecycleWarnings.forEach(function (lifecycleWarningsMap, strictRoot) {
8358 var lifecyclesWarningMesages = [];
8359
8360 Object.keys(lifecycleWarningsMap).forEach(function (lifecycle) {
8361 var lifecycleWarnings = lifecycleWarningsMap[lifecycle];
8362 if (lifecycleWarnings.length > 0) {
8363 var componentNames = new Set();
8364 lifecycleWarnings.forEach(function (fiber) {
8365 componentNames.add(getComponentName(fiber) || 'Component');
8366 didWarnAboutUnsafeLifecycles.add(fiber.type);
8367 });
8368
8369 var formatted = lifecycle.replace('UNSAFE_', '');
8370 var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle];
8371 var sortedComponentNames = setToSortedString(componentNames);
8372
8373 lifecyclesWarningMesages.push(formatted + ': Please update the following components to use ' + (suggestion + ' instead: ' + sortedComponentNames));
8374 }
8375 });
8376
8377 if (lifecyclesWarningMesages.length > 0) {
8378 var strictRootComponentStack = getStackAddendumByWorkInProgressFiber(strictRoot);
8379
8380 warning(false, 'Unsafe lifecycle methods were found within a strict-mode tree:%s' + '\n\n%s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, lifecyclesWarningMesages.join('\n\n'));
8381 }
8382 });
8383
8384 pendingUnsafeLifecycleWarnings = new Map();
8385 };
8386
8387 var getStrictRoot = function (fiber) {
8388 var maybeStrictRoot = null;
8389
8390 while (fiber !== null) {
8391 if (fiber.mode & StrictMode) {
8392 maybeStrictRoot = fiber;
8393 }
8394
8395 fiber = fiber['return'];
8396 }
8397
8398 return maybeStrictRoot;
8399 };
8400
8401 ReactStrictModeWarnings.flushPendingDeprecationWarnings = function () {
8402 if (pendingComponentWillMountWarnings.length > 0) {
8403 var uniqueNames = new Set();
8404 pendingComponentWillMountWarnings.forEach(function (fiber) {
8405 uniqueNames.add(getComponentName(fiber) || 'Component');
8406 didWarnAboutDeprecatedLifecycles.add(fiber.type);
8407 });
8408
8409 var sortedNames = setToSortedString(uniqueNames);
8410
8411 lowPriorityWarning$1(false, 'componentWillMount is deprecated and will be removed in the next major version. ' + 'Use componentDidMount instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillMount.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', sortedNames);
8412
8413 pendingComponentWillMountWarnings = [];
8414 }
8415
8416 if (pendingComponentWillReceivePropsWarnings.length > 0) {
8417 var _uniqueNames = new Set();
8418 pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
8419 _uniqueNames.add(getComponentName(fiber) || 'Component');
8420 didWarnAboutDeprecatedLifecycles.add(fiber.type);
8421 });
8422
8423 var _sortedNames = setToSortedString(_uniqueNames);
8424
8425 lowPriorityWarning$1(false, 'componentWillReceiveProps is deprecated and will be removed in the next major version. ' + 'Use static getDerivedStateFromProps instead.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames);
8426
8427 pendingComponentWillReceivePropsWarnings = [];
8428 }
8429
8430 if (pendingComponentWillUpdateWarnings.length > 0) {
8431 var _uniqueNames2 = new Set();
8432 pendingComponentWillUpdateWarnings.forEach(function (fiber) {
8433 _uniqueNames2.add(getComponentName(fiber) || 'Component');
8434 didWarnAboutDeprecatedLifecycles.add(fiber.type);
8435 });
8436
8437 var _sortedNames2 = setToSortedString(_uniqueNames2);
8438
8439 lowPriorityWarning$1(false, 'componentWillUpdate is deprecated and will be removed in the next major version. ' + 'Use componentDidUpdate instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillUpdate.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames2);
8440
8441 pendingComponentWillUpdateWarnings = [];
8442 }
8443 };
8444
8445 ReactStrictModeWarnings.recordDeprecationWarnings = function (fiber, instance) {
8446 // Dedup strategy: Warn once per component.
8447 if (didWarnAboutDeprecatedLifecycles.has(fiber.type)) {
8448 return;
8449 }
8450
8451 // Don't warn about react-lifecycles-compat polyfilled components.
8452 if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
8453 pendingComponentWillMountWarnings.push(fiber);
8454 }
8455 if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
8456 pendingComponentWillReceivePropsWarnings.push(fiber);
8457 }
8458 if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
8459 pendingComponentWillUpdateWarnings.push(fiber);
8460 }
8461 };
8462
8463 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
8464 var strictRoot = getStrictRoot(fiber);
8465
8466 // Dedup strategy: Warn once per component.
8467 // This is difficult to track any other way since component names
8468 // are often vague and are likely to collide between 3rd party libraries.
8469 // An expand property is probably okay to use here since it's DEV-only,
8470 // and will only be set in the event of serious warnings.
8471 if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
8472 return;
8473 }
8474
8475 // Don't warn about react-lifecycles-compat polyfilled components.
8476 // Note that it is sufficient to check for the presence of a
8477 // single lifecycle, componentWillMount, with the polyfill flag.
8478 if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning === true) {
8479 return;
8480 }
8481
8482 var warningsForRoot = void 0;
8483 if (!pendingUnsafeLifecycleWarnings.has(strictRoot)) {
8484 warningsForRoot = {
8485 UNSAFE_componentWillMount: [],
8486 UNSAFE_componentWillReceiveProps: [],
8487 UNSAFE_componentWillUpdate: []
8488 };
8489
8490 pendingUnsafeLifecycleWarnings.set(strictRoot, warningsForRoot);
8491 } else {
8492 warningsForRoot = pendingUnsafeLifecycleWarnings.get(strictRoot);
8493 }
8494
8495 var unsafeLifecycles = [];
8496 if (typeof instance.componentWillMount === 'function' || typeof instance.UNSAFE_componentWillMount === 'function') {
8497 unsafeLifecycles.push('UNSAFE_componentWillMount');
8498 }
8499 if (typeof instance.componentWillReceiveProps === 'function' || typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
8500 unsafeLifecycles.push('UNSAFE_componentWillReceiveProps');
8501 }
8502 if (typeof instance.componentWillUpdate === 'function' || typeof instance.UNSAFE_componentWillUpdate === 'function') {
8503 unsafeLifecycles.push('UNSAFE_componentWillUpdate');
8504 }
8505
8506 if (unsafeLifecycles.length > 0) {
8507 unsafeLifecycles.forEach(function (lifecycle) {
8508 warningsForRoot[lifecycle].push(fiber);
8509 });
8510 }
8511 };
8512 }
8513
8514 // Exports ReactDOM.createRoot
8515 var enableUserTimingAPI = true;
8516
8517 // Mutating mode (React DOM, React ART, React Native):
8518 var enableMutatingReconciler = true;
8519 // Experimental noop mode (currently unused):
8520 var enableNoopReconciler = false;
8521 // Experimental persistent mode (Fabric):
8522 var enablePersistentReconciler = false;
8523 // Experimental error-boundary API that can recover from errors within a single
8524 // render phase
8525 var enableGetDerivedStateFromCatch = false;
8526 // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
8527 var debugRenderPhaseSideEffects = false;
8528
8529 // In some cases, StrictMode should also double-render lifecycles.
8530 // This can be confusing for tests though,
8531 // And it can be bad for performance in production.
8532 // This feature flag can be used to control the behavior:
8533 var debugRenderPhaseSideEffectsForStrictMode = true;
8534
8535 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
8536 // replay the begin phase of a failed component inside invokeGuardedCallback.
8537 var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
8538
8539 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
8540 var warnAboutDeprecatedLifecycles = false;
8541
8542 var alwaysUseRequestIdleCallbackPolyfill = false;
8543
8544 // Only used in www builds.
8545
8546 // Prefix measurements so that it's possible to filter them.
8547 // Longer prefixes are hard to read in DevTools.
8548 var reactEmoji = '\u269B';
8549 var warningEmoji = '\u26D4';
8550 var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
8551
8552 // Keep track of current fiber so that we know the path to unwind on pause.
8553 // TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them?
8554 var currentFiber = null;
8555 // If we're in the middle of user code, which fiber and method is it?
8556 // Reusing `currentFiber` would be confusing for this because user code fiber
8557 // can change during commit phase too, but we don't need to unwind it (since
8558 // lifecycles in the commit phase don't resemble a tree).
8559 var currentPhase = null;
8560 var currentPhaseFiber = null;
8561 // Did lifecycle hook schedule an update? This is often a performance problem,
8562 // so we will keep track of it, and include it in the report.
8563 // Track commits caused by cascading updates.
8564 var isCommitting = false;
8565 var hasScheduledUpdateInCurrentCommit = false;
8566 var hasScheduledUpdateInCurrentPhase = false;
8567 var commitCountInCurrentWorkLoop = 0;
8568 var effectCountInCurrentCommit = 0;
8569 var isWaitingForCallback = false;
8570 // During commits, we only show a measurement once per method name
8571 // to avoid stretch the commit phase with measurement overhead.
8572 var labelsInCurrentCommit = new Set();
8573
8574 var formatMarkName = function (markName) {
8575 return reactEmoji + ' ' + markName;
8576 };
8577
8578 var formatLabel = function (label, warning$$1) {
8579 var prefix = warning$$1 ? warningEmoji + ' ' : reactEmoji + ' ';
8580 var suffix = warning$$1 ? ' Warning: ' + warning$$1 : '';
8581 return '' + prefix + label + suffix;
8582 };
8583
8584 var beginMark = function (markName) {
8585 performance.mark(formatMarkName(markName));
8586 };
8587
8588 var clearMark = function (markName) {
8589 performance.clearMarks(formatMarkName(markName));
8590 };
8591
8592 var endMark = function (label, markName, warning$$1) {
8593 var formattedMarkName = formatMarkName(markName);
8594 var formattedLabel = formatLabel(label, warning$$1);
8595 try {
8596 performance.measure(formattedLabel, formattedMarkName);
8597 } catch (err) {}
8598 // If previous mark was missing for some reason, this will throw.
8599 // This could only happen if React crashed in an unexpected place earlier.
8600 // Don't pile on with more errors.
8601
8602 // Clear marks immediately to avoid growing buffer.
8603 performance.clearMarks(formattedMarkName);
8604 performance.clearMeasures(formattedLabel);
8605 };
8606
8607 var getFiberMarkName = function (label, debugID) {
8608 return label + ' (#' + debugID + ')';
8609 };
8610
8611 var getFiberLabel = function (componentName, isMounted, phase) {
8612 if (phase === null) {
8613 // These are composite component total time measurements.
8614 return componentName + ' [' + (isMounted ? 'update' : 'mount') + ']';
8615 } else {
8616 // Composite component methods.
8617 return componentName + '.' + phase;
8618 }
8619 };
8620
8621 var beginFiberMark = function (fiber, phase) {
8622 var componentName = getComponentName(fiber) || 'Unknown';
8623 var debugID = fiber._debugID;
8624 var isMounted = fiber.alternate !== null;
8625 var label = getFiberLabel(componentName, isMounted, phase);
8626
8627 if (isCommitting && labelsInCurrentCommit.has(label)) {
8628 // During the commit phase, we don't show duplicate labels because
8629 // there is a fixed overhead for every measurement, and we don't
8630 // want to stretch the commit phase beyond necessary.
8631 return false;
8632 }
8633 labelsInCurrentCommit.add(label);
8634
8635 var markName = getFiberMarkName(label, debugID);
8636 beginMark(markName);
8637 return true;
8638 };
8639
8640 var clearFiberMark = function (fiber, phase) {
8641 var componentName = getComponentName(fiber) || 'Unknown';
8642 var debugID = fiber._debugID;
8643 var isMounted = fiber.alternate !== null;
8644 var label = getFiberLabel(componentName, isMounted, phase);
8645 var markName = getFiberMarkName(label, debugID);
8646 clearMark(markName);
8647 };
8648
8649 var endFiberMark = function (fiber, phase, warning$$1) {
8650 var componentName = getComponentName(fiber) || 'Unknown';
8651 var debugID = fiber._debugID;
8652 var isMounted = fiber.alternate !== null;
8653 var label = getFiberLabel(componentName, isMounted, phase);
8654 var markName = getFiberMarkName(label, debugID);
8655 endMark(label, markName, warning$$1);
8656 };
8657
8658 var shouldIgnoreFiber = function (fiber) {
8659 // Host components should be skipped in the timeline.
8660 // We could check typeof fiber.type, but does this work with RN?
8661 switch (fiber.tag) {
8662 case HostRoot:
8663 case HostComponent:
8664 case HostText:
8665 case HostPortal:
8666 case CallComponent:
8667 case ReturnComponent:
8668 case Fragment:
8669 case ContextProvider:
8670 case ContextConsumer:
8671 case Mode:
8672 return true;
8673 default:
8674 return false;
8675 }
8676 };
8677
8678 var clearPendingPhaseMeasurement = function () {
8679 if (currentPhase !== null && currentPhaseFiber !== null) {
8680 clearFiberMark(currentPhaseFiber, currentPhase);
8681 }
8682 currentPhaseFiber = null;
8683 currentPhase = null;
8684 hasScheduledUpdateInCurrentPhase = false;
8685 };
8686
8687 var pauseTimers = function () {
8688 // Stops all currently active measurements so that they can be resumed
8689 // if we continue in a later deferred loop from the same unit of work.
8690 var fiber = currentFiber;
8691 while (fiber) {
8692 if (fiber._debugIsCurrentlyTiming) {
8693 endFiberMark(fiber, null, null);
8694 }
8695 fiber = fiber['return'];
8696 }
8697 };
8698
8699 var resumeTimersRecursively = function (fiber) {
8700 if (fiber['return'] !== null) {
8701 resumeTimersRecursively(fiber['return']);
8702 }
8703 if (fiber._debugIsCurrentlyTiming) {
8704 beginFiberMark(fiber, null);
8705 }
8706 };
8707
8708 var resumeTimers = function () {
8709 // Resumes all measurements that were active during the last deferred loop.
8710 if (currentFiber !== null) {
8711 resumeTimersRecursively(currentFiber);
8712 }
8713 };
8714
8715 function recordEffect() {
8716 if (enableUserTimingAPI) {
8717 effectCountInCurrentCommit++;
8718 }
8719 }
8720
8721 function recordScheduleUpdate() {
8722 if (enableUserTimingAPI) {
8723 if (isCommitting) {
8724 hasScheduledUpdateInCurrentCommit = true;
8725 }
8726 if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') {
8727 hasScheduledUpdateInCurrentPhase = true;
8728 }
8729 }
8730 }
8731
8732 function startRequestCallbackTimer() {
8733 if (enableUserTimingAPI) {
8734 if (supportsUserTiming && !isWaitingForCallback) {
8735 isWaitingForCallback = true;
8736 beginMark('(Waiting for async callback...)');
8737 }
8738 }
8739 }
8740
8741 function stopRequestCallbackTimer(didExpire, expirationTime) {
8742 if (enableUserTimingAPI) {
8743 if (supportsUserTiming) {
8744 isWaitingForCallback = false;
8745 var warning$$1 = didExpire ? 'React was blocked by main thread' : null;
8746 endMark('(Waiting for async callback... will force flush in ' + expirationTime + ' ms)', '(Waiting for async callback...)', warning$$1);
8747 }
8748 }
8749 }
8750
8751 function startWorkTimer(fiber) {
8752 if (enableUserTimingAPI) {
8753 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
8754 return;
8755 }
8756 // If we pause, this is the fiber to unwind from.
8757 currentFiber = fiber;
8758 if (!beginFiberMark(fiber, null)) {
8759 return;
8760 }
8761 fiber._debugIsCurrentlyTiming = true;
8762 }
8763 }
8764
8765 function cancelWorkTimer(fiber) {
8766 if (enableUserTimingAPI) {
8767 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
8768 return;
8769 }
8770 // Remember we shouldn't complete measurement for this fiber.
8771 // Otherwise flamechart will be deep even for small updates.
8772 fiber._debugIsCurrentlyTiming = false;
8773 clearFiberMark(fiber, null);
8774 }
8775 }
8776
8777 function stopWorkTimer(fiber) {
8778 if (enableUserTimingAPI) {
8779 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
8780 return;
8781 }
8782 // If we pause, its parent is the fiber to unwind from.
8783 currentFiber = fiber['return'];
8784 if (!fiber._debugIsCurrentlyTiming) {
8785 return;
8786 }
8787 fiber._debugIsCurrentlyTiming = false;
8788 endFiberMark(fiber, null, null);
8789 }
8790 }
8791
8792 function stopFailedWorkTimer(fiber) {
8793 if (enableUserTimingAPI) {
8794 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
8795 return;
8796 }
8797 // If we pause, its parent is the fiber to unwind from.
8798 currentFiber = fiber['return'];
8799 if (!fiber._debugIsCurrentlyTiming) {
8800 return;
8801 }
8802 fiber._debugIsCurrentlyTiming = false;
8803 var warning$$1 = 'An error was thrown inside this error boundary';
8804 endFiberMark(fiber, null, warning$$1);
8805 }
8806 }
8807
8808 function startPhaseTimer(fiber, phase) {
8809 if (enableUserTimingAPI) {
8810 if (!supportsUserTiming) {
8811 return;
8812 }
8813 clearPendingPhaseMeasurement();
8814 if (!beginFiberMark(fiber, phase)) {
8815 return;
8816 }
8817 currentPhaseFiber = fiber;
8818 currentPhase = phase;
8819 }
8820 }
8821
8822 function stopPhaseTimer() {
8823 if (enableUserTimingAPI) {
8824 if (!supportsUserTiming) {
8825 return;
8826 }
8827 if (currentPhase !== null && currentPhaseFiber !== null) {
8828 var warning$$1 = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
8829 endFiberMark(currentPhaseFiber, currentPhase, warning$$1);
8830 }
8831 currentPhase = null;
8832 currentPhaseFiber = null;
8833 }
8834 }
8835
8836 function startWorkLoopTimer(nextUnitOfWork) {
8837 if (enableUserTimingAPI) {
8838 currentFiber = nextUnitOfWork;
8839 if (!supportsUserTiming) {
8840 return;
8841 }
8842 commitCountInCurrentWorkLoop = 0;
8843 // This is top level call.
8844 // Any other measurements are performed within.
8845 beginMark('(React Tree Reconciliation)');
8846 // Resume any measurements that were in progress during the last loop.
8847 resumeTimers();
8848 }
8849 }
8850
8851 function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
8852 if (enableUserTimingAPI) {
8853 if (!supportsUserTiming) {
8854 return;
8855 }
8856 var warning$$1 = null;
8857 if (interruptedBy !== null) {
8858 if (interruptedBy.tag === HostRoot) {
8859 warning$$1 = 'A top-level update interrupted the previous render';
8860 } else {
8861 var componentName = getComponentName(interruptedBy) || 'Unknown';
8862 warning$$1 = 'An update to ' + componentName + ' interrupted the previous render';
8863 }
8864 } else if (commitCountInCurrentWorkLoop > 1) {
8865 warning$$1 = 'There were cascading updates';
8866 }
8867 commitCountInCurrentWorkLoop = 0;
8868 var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)';
8869 // Pause any measurements until the next loop.
8870 pauseTimers();
8871 endMark(label, '(React Tree Reconciliation)', warning$$1);
8872 }
8873 }
8874
8875 function startCommitTimer() {
8876 if (enableUserTimingAPI) {
8877 if (!supportsUserTiming) {
8878 return;
8879 }
8880 isCommitting = true;
8881 hasScheduledUpdateInCurrentCommit = false;
8882 labelsInCurrentCommit.clear();
8883 beginMark('(Committing Changes)');
8884 }
8885 }
8886
8887 function stopCommitTimer() {
8888 if (enableUserTimingAPI) {
8889 if (!supportsUserTiming) {
8890 return;
8891 }
8892
8893 var warning$$1 = null;
8894 if (hasScheduledUpdateInCurrentCommit) {
8895 warning$$1 = 'Lifecycle hook scheduled a cascading update';
8896 } else if (commitCountInCurrentWorkLoop > 0) {
8897 warning$$1 = 'Caused by a cascading update in earlier commit';
8898 }
8899 hasScheduledUpdateInCurrentCommit = false;
8900 commitCountInCurrentWorkLoop++;
8901 isCommitting = false;
8902 labelsInCurrentCommit.clear();
8903
8904 endMark('(Committing Changes)', '(Committing Changes)', warning$$1);
8905 }
8906 }
8907
8908 function startCommitSnapshotEffectsTimer() {
8909 if (enableUserTimingAPI) {
8910 if (!supportsUserTiming) {
8911 return;
8912 }
8913 effectCountInCurrentCommit = 0;
8914 beginMark('(Committing Snapshot Effects)');
8915 }
8916 }
8917
8918 function stopCommitSnapshotEffectsTimer() {
8919 if (enableUserTimingAPI) {
8920 if (!supportsUserTiming) {
8921 return;
8922 }
8923 var count = effectCountInCurrentCommit;
8924 effectCountInCurrentCommit = 0;
8925 endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null);
8926 }
8927 }
8928
8929 function startCommitHostEffectsTimer() {
8930 if (enableUserTimingAPI) {
8931 if (!supportsUserTiming) {
8932 return;
8933 }
8934 effectCountInCurrentCommit = 0;
8935 beginMark('(Committing Host Effects)');
8936 }
8937 }
8938
8939 function stopCommitHostEffectsTimer() {
8940 if (enableUserTimingAPI) {
8941 if (!supportsUserTiming) {
8942 return;
8943 }
8944 var count = effectCountInCurrentCommit;
8945 effectCountInCurrentCommit = 0;
8946 endMark('(Committing Host Effects: ' + count + ' Total)', '(Committing Host Effects)', null);
8947 }
8948 }
8949
8950 function startCommitLifeCyclesTimer() {
8951 if (enableUserTimingAPI) {
8952 if (!supportsUserTiming) {
8953 return;
8954 }
8955 effectCountInCurrentCommit = 0;
8956 beginMark('(Calling Lifecycle Methods)');
8957 }
8958 }
8959
8960 function stopCommitLifeCyclesTimer() {
8961 if (enableUserTimingAPI) {
8962 if (!supportsUserTiming) {
8963 return;
8964 }
8965 var count = effectCountInCurrentCommit;
8966 effectCountInCurrentCommit = 0;
8967 endMark('(Calling Lifecycle Methods: ' + count + ' Total)', '(Calling Lifecycle Methods)', null);
8968 }
8969 }
8970
8971 var didWarnUpdateInsideUpdate = void 0;
8972
8973 {
8974 didWarnUpdateInsideUpdate = false;
8975 }
8976
8977 // Callbacks are not validated until invocation
8978
8979
8980 // Singly linked-list of updates. When an update is scheduled, it is added to
8981 // the queue of the current fiber and the work-in-progress fiber. The two queues
8982 // are separate but they share a persistent structure.
8983 //
8984 // During reconciliation, updates are removed from the work-in-progress fiber,
8985 // but they remain on the current fiber. That ensures that if a work-in-progress
8986 // is aborted, the aborted updates are recovered by cloning from current.
8987 //
8988 // The work-in-progress queue is always a subset of the current queue.
8989 //
8990 // When the tree is committed, the work-in-progress becomes the current.
8991
8992
8993 function createUpdateQueue(baseState) {
8994 var queue = {
8995 baseState: baseState,
8996 expirationTime: NoWork,
8997 first: null,
8998 last: null,
8999 callbackList: null,
9000 hasForceUpdate: false,
9001 isInitialized: false,
9002 capturedValues: null
9003 };
9004 {
9005 queue.isProcessing = false;
9006 }
9007 return queue;
9008 }
9009
9010 function insertUpdateIntoQueue(queue, update) {
9011 // Append the update to the end of the list.
9012 if (queue.last === null) {
9013 // Queue is empty
9014 queue.first = queue.last = update;
9015 } else {
9016 queue.last.next = update;
9017 queue.last = update;
9018 }
9019 if (queue.expirationTime === NoWork || queue.expirationTime > update.expirationTime) {
9020 queue.expirationTime = update.expirationTime;
9021 }
9022 }
9023
9024 var q1 = void 0;
9025 var q2 = void 0;
9026 function ensureUpdateQueues(fiber) {
9027 q1 = q2 = null;
9028 // We'll have at least one and at most two distinct update queues.
9029 var alternateFiber = fiber.alternate;
9030 var queue1 = fiber.updateQueue;
9031 if (queue1 === null) {
9032 // TODO: We don't know what the base state will be until we begin work.
9033 // It depends on which fiber is the next current. Initialize with an empty
9034 // base state, then set to the memoizedState when rendering. Not super
9035 // happy with this approach.
9036 queue1 = fiber.updateQueue = createUpdateQueue(null);
9037 }
9038
9039 var queue2 = void 0;
9040 if (alternateFiber !== null) {
9041 queue2 = alternateFiber.updateQueue;
9042 if (queue2 === null) {
9043 queue2 = alternateFiber.updateQueue = createUpdateQueue(null);
9044 }
9045 } else {
9046 queue2 = null;
9047 }
9048 queue2 = queue2 !== queue1 ? queue2 : null;
9049
9050 // Use module variables instead of returning a tuple
9051 q1 = queue1;
9052 q2 = queue2;
9053 }
9054
9055 function insertUpdateIntoFiber(fiber, update) {
9056 ensureUpdateQueues(fiber);
9057 var queue1 = q1;
9058 var queue2 = q2;
9059
9060 // Warn if an update is scheduled from inside an updater function.
9061 {
9062 if ((queue1.isProcessing || queue2 !== null && queue2.isProcessing) && !didWarnUpdateInsideUpdate) {
9063 warning(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
9064 didWarnUpdateInsideUpdate = true;
9065 }
9066 }
9067
9068 // If there's only one queue, add the update to that queue and exit.
9069 if (queue2 === null) {
9070 insertUpdateIntoQueue(queue1, update);
9071 return;
9072 }
9073
9074 // If either queue is empty, we need to add to both queues.
9075 if (queue1.last === null || queue2.last === null) {
9076 insertUpdateIntoQueue(queue1, update);
9077 insertUpdateIntoQueue(queue2, update);
9078 return;
9079 }
9080
9081 // If both lists are not empty, the last update is the same for both lists
9082 // because of structural sharing. So, we should only append to one of
9083 // the lists.
9084 insertUpdateIntoQueue(queue1, update);
9085 // But we still need to update the `last` pointer of queue2.
9086 queue2.last = update;
9087 }
9088
9089 function getUpdateExpirationTime(fiber) {
9090 switch (fiber.tag) {
9091 case HostRoot:
9092 case ClassComponent:
9093 var updateQueue = fiber.updateQueue;
9094 if (updateQueue === null) {
9095 return NoWork;
9096 }
9097 return updateQueue.expirationTime;
9098 default:
9099 return NoWork;
9100 }
9101 }
9102
9103 function getStateFromUpdate(update, instance, prevState, props) {
9104 var partialState = update.partialState;
9105 if (typeof partialState === 'function') {
9106 return partialState.call(instance, prevState, props);
9107 } else {
9108 return partialState;
9109 }
9110 }
9111
9112 function processUpdateQueue(current, workInProgress, queue, instance, props, renderExpirationTime) {
9113 if (current !== null && current.updateQueue === queue) {
9114 // We need to create a work-in-progress queue, by cloning the current queue.
9115 var currentQueue = queue;
9116 queue = workInProgress.updateQueue = {
9117 baseState: currentQueue.baseState,
9118 expirationTime: currentQueue.expirationTime,
9119 first: currentQueue.first,
9120 last: currentQueue.last,
9121 isInitialized: currentQueue.isInitialized,
9122 capturedValues: currentQueue.capturedValues,
9123 // These fields are no longer valid because they were already committed.
9124 // Reset them.
9125 callbackList: null,
9126 hasForceUpdate: false
9127 };
9128 }
9129
9130 {
9131 // Set this flag so we can warn if setState is called inside the update
9132 // function of another setState.
9133 queue.isProcessing = true;
9134 }
9135
9136 // Reset the remaining expiration time. If we skip over any updates, we'll
9137 // increase this accordingly.
9138 queue.expirationTime = NoWork;
9139
9140 // TODO: We don't know what the base state will be until we begin work.
9141 // It depends on which fiber is the next current. Initialize with an empty
9142 // base state, then set to the memoizedState when rendering. Not super
9143 // happy with this approach.
9144 var state = void 0;
9145 if (queue.isInitialized) {
9146 state = queue.baseState;
9147 } else {
9148 state = queue.baseState = workInProgress.memoizedState;
9149 queue.isInitialized = true;
9150 }
9151 var dontMutatePrevState = true;
9152 var update = queue.first;
9153 var didSkip = false;
9154 while (update !== null) {
9155 var updateExpirationTime = update.expirationTime;
9156 if (updateExpirationTime > renderExpirationTime) {
9157 // This update does not have sufficient priority. Skip it.
9158 var remainingExpirationTime = queue.expirationTime;
9159 if (remainingExpirationTime === NoWork || remainingExpirationTime > updateExpirationTime) {
9160 // Update the remaining expiration time.
9161 queue.expirationTime = updateExpirationTime;
9162 }
9163 if (!didSkip) {
9164 didSkip = true;
9165 queue.baseState = state;
9166 }
9167 // Continue to the next update.
9168 update = update.next;
9169 continue;
9170 }
9171
9172 // This update does have sufficient priority.
9173
9174 // If no previous updates were skipped, drop this update from the queue by
9175 // advancing the head of the list.
9176 if (!didSkip) {
9177 queue.first = update.next;
9178 if (queue.first === null) {
9179 queue.last = null;
9180 }
9181 }
9182
9183 // Invoke setState callback an extra time to help detect side-effects.
9184 // Ignore the return value in this case.
9185 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
9186 getStateFromUpdate(update, instance, state, props);
9187 }
9188
9189 // Process the update
9190 var _partialState = void 0;
9191 if (update.isReplace) {
9192 state = getStateFromUpdate(update, instance, state, props);
9193 dontMutatePrevState = true;
9194 } else {
9195 _partialState = getStateFromUpdate(update, instance, state, props);
9196 if (_partialState) {
9197 if (dontMutatePrevState) {
9198 // $FlowFixMe: Idk how to type this properly.
9199 state = _assign({}, state, _partialState);
9200 } else {
9201 state = _assign(state, _partialState);
9202 }
9203 dontMutatePrevState = false;
9204 }
9205 }
9206 if (update.isForced) {
9207 queue.hasForceUpdate = true;
9208 }
9209 if (update.callback !== null) {
9210 // Append to list of callbacks.
9211 var _callbackList = queue.callbackList;
9212 if (_callbackList === null) {
9213 _callbackList = queue.callbackList = [];
9214 }
9215 _callbackList.push(update);
9216 }
9217 if (update.capturedValue !== null) {
9218 var _capturedValues = queue.capturedValues;
9219 if (_capturedValues === null) {
9220 queue.capturedValues = [update.capturedValue];
9221 } else {
9222 _capturedValues.push(update.capturedValue);
9223 }
9224 }
9225 update = update.next;
9226 }
9227
9228 if (queue.callbackList !== null) {
9229 workInProgress.effectTag |= Callback;
9230 } else if (queue.first === null && !queue.hasForceUpdate && queue.capturedValues === null) {
9231 // The queue is empty. We can reset it.
9232 workInProgress.updateQueue = null;
9233 }
9234
9235 if (!didSkip) {
9236 didSkip = true;
9237 queue.baseState = state;
9238 }
9239
9240 {
9241 // No longer processing.
9242 queue.isProcessing = false;
9243 }
9244
9245 return state;
9246 }
9247
9248 function commitCallbacks(queue, context) {
9249 var callbackList = queue.callbackList;
9250 if (callbackList === null) {
9251 return;
9252 }
9253 // Set the list to null to make sure they don't get called more than once.
9254 queue.callbackList = null;
9255 for (var i = 0; i < callbackList.length; i++) {
9256 var update = callbackList[i];
9257 var _callback = update.callback;
9258 // This update might be processed again. Clear the callback so it's only
9259 // called once.
9260 update.callback = null;
9261 !(typeof _callback === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', _callback) : void 0;
9262 _callback.call(context);
9263 }
9264 }
9265
9266 var fakeInternalInstance = {};
9267 var isArray = Array.isArray;
9268
9269 var didWarnAboutStateAssignmentForComponent = void 0;
9270 var didWarnAboutUndefinedDerivedState = void 0;
9271 var didWarnAboutUninitializedState = void 0;
9272 var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0;
9273 var didWarnAboutLegacyLifecyclesAndDerivedState = void 0;
9274 var warnOnInvalidCallback$1 = void 0;
9275
9276 {
9277 didWarnAboutStateAssignmentForComponent = new Set();
9278 didWarnAboutUndefinedDerivedState = new Set();
9279 didWarnAboutUninitializedState = new Set();
9280 didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
9281 didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
9282
9283 var didWarnOnInvalidCallback = new Set();
9284
9285 warnOnInvalidCallback$1 = function (callback, callerName) {
9286 if (callback === null || typeof callback === 'function') {
9287 return;
9288 }
9289 var key = callerName + '_' + callback;
9290 if (!didWarnOnInvalidCallback.has(key)) {
9291 didWarnOnInvalidCallback.add(key);
9292 warning(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
9293 }
9294 };
9295
9296 // This is so gross but it's at least non-critical and can be removed if
9297 // it causes problems. This is meant to give a nicer error message for
9298 // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,
9299 // ...)) which otherwise throws a "_processChildContext is not a function"
9300 // exception.
9301 Object.defineProperty(fakeInternalInstance, '_processChildContext', {
9302 enumerable: false,
9303 value: function () {
9304 invariant(false, '_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn\'t supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).');
9305 }
9306 });
9307 Object.freeze(fakeInternalInstance);
9308 }
9309 function callGetDerivedStateFromCatch(ctor, capturedValues) {
9310 var resultState = {};
9311 for (var i = 0; i < capturedValues.length; i++) {
9312 var capturedValue = capturedValues[i];
9313 var error = capturedValue.value;
9314 var partialState = ctor.getDerivedStateFromCatch.call(null, error);
9315 if (partialState !== null && partialState !== undefined) {
9316 _assign(resultState, partialState);
9317 }
9318 }
9319 return resultState;
9320 }
9321
9322 var ReactFiberClassComponent = function (legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState) {
9323 var cacheContext = legacyContext.cacheContext,
9324 getMaskedContext = legacyContext.getMaskedContext,
9325 getUnmaskedContext = legacyContext.getUnmaskedContext,
9326 isContextConsumer = legacyContext.isContextConsumer,
9327 hasContextChanged = legacyContext.hasContextChanged;
9328
9329 // Class component state updater
9330
9331 var updater = {
9332 isMounted: isMounted,
9333 enqueueSetState: function (instance, partialState, callback) {
9334 var fiber = get(instance);
9335 callback = callback === undefined ? null : callback;
9336 {
9337 warnOnInvalidCallback$1(callback, 'setState');
9338 }
9339 var expirationTime = computeExpirationForFiber(fiber);
9340 var update = {
9341 expirationTime: expirationTime,
9342 partialState: partialState,
9343 callback: callback,
9344 isReplace: false,
9345 isForced: false,
9346 capturedValue: null,
9347 next: null
9348 };
9349 insertUpdateIntoFiber(fiber, update);
9350 scheduleWork(fiber, expirationTime);
9351 },
9352 enqueueReplaceState: function (instance, state, callback) {
9353 var fiber = get(instance);
9354 callback = callback === undefined ? null : callback;
9355 {
9356 warnOnInvalidCallback$1(callback, 'replaceState');
9357 }
9358 var expirationTime = computeExpirationForFiber(fiber);
9359 var update = {
9360 expirationTime: expirationTime,
9361 partialState: state,
9362 callback: callback,
9363 isReplace: true,
9364 isForced: false,
9365 capturedValue: null,
9366 next: null
9367 };
9368 insertUpdateIntoFiber(fiber, update);
9369 scheduleWork(fiber, expirationTime);
9370 },
9371 enqueueForceUpdate: function (instance, callback) {
9372 var fiber = get(instance);
9373 callback = callback === undefined ? null : callback;
9374 {
9375 warnOnInvalidCallback$1(callback, 'forceUpdate');
9376 }
9377 var expirationTime = computeExpirationForFiber(fiber);
9378 var update = {
9379 expirationTime: expirationTime,
9380 partialState: null,
9381 callback: callback,
9382 isReplace: false,
9383 isForced: true,
9384 capturedValue: null,
9385 next: null
9386 };
9387 insertUpdateIntoFiber(fiber, update);
9388 scheduleWork(fiber, expirationTime);
9389 }
9390 };
9391
9392 function checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext) {
9393 if (oldProps === null || workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate) {
9394 // If the workInProgress already has an Update effect, return true
9395 return true;
9396 }
9397
9398 var instance = workInProgress.stateNode;
9399 var ctor = workInProgress.type;
9400 if (typeof instance.shouldComponentUpdate === 'function') {
9401 startPhaseTimer(workInProgress, 'shouldComponentUpdate');
9402 var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, newContext);
9403 stopPhaseTimer();
9404
9405 {
9406 !(shouldUpdate !== undefined) ? warning(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(workInProgress) || 'Component') : void 0;
9407 }
9408
9409 return shouldUpdate;
9410 }
9411
9412 if (ctor.prototype && ctor.prototype.isPureReactComponent) {
9413 return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
9414 }
9415
9416 return true;
9417 }
9418
9419 function checkClassInstance(workInProgress) {
9420 var instance = workInProgress.stateNode;
9421 var type = workInProgress.type;
9422 {
9423 var name = getComponentName(workInProgress) || 'Component';
9424 var renderPresent = instance.render;
9425
9426 if (!renderPresent) {
9427 if (type.prototype && typeof type.prototype.render === 'function') {
9428 warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
9429 } else {
9430 warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
9431 }
9432 }
9433
9434 var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
9435 !noGetInitialStateOnES6 ? warning(false, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name) : void 0;
9436 var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
9437 !noGetDefaultPropsOnES6 ? warning(false, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name) : void 0;
9438 var noInstancePropTypes = !instance.propTypes;
9439 !noInstancePropTypes ? warning(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
9440 var noInstanceContextTypes = !instance.contextTypes;
9441 !noInstanceContextTypes ? warning(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
9442 var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
9443 !noComponentShouldUpdate ? warning(false, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name) : void 0;
9444 if (type.prototype && type.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
9445 warning(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(workInProgress) || 'A pure component');
9446 }
9447 var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
9448 !noComponentDidUnmount ? warning(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
9449 var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
9450 !noComponentDidReceiveProps ? warning(false, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name) : void 0;
9451 var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
9452 !noComponentWillRecieveProps ? warning(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
9453 var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
9454 !noUnsafeComponentWillRecieveProps ? warning(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
9455 var hasMutatedProps = instance.props !== workInProgress.pendingProps;
9456 !(instance.props === undefined || !hasMutatedProps) ? warning(false, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name) : void 0;
9457 var noInstanceDefaultProps = !instance.defaultProps;
9458 !noInstanceDefaultProps ? warning(false, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name) : void 0;
9459
9460 if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(type)) {
9461 didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(type);
9462 warning(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(workInProgress));
9463 }
9464
9465 var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
9466 !noInstanceGetDerivedStateFromProps ? warning(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
9467 var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromCatch !== 'function';
9468 !noInstanceGetDerivedStateFromCatch ? warning(false, '%s: getDerivedStateFromCatch() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
9469 var noStaticGetSnapshotBeforeUpdate = typeof type.getSnapshotBeforeUpdate !== 'function';
9470 !noStaticGetSnapshotBeforeUpdate ? warning(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
9471 var _state = instance.state;
9472 if (_state && (typeof _state !== 'object' || isArray(_state))) {
9473 warning(false, '%s.state: must be set to an object or null', name);
9474 }
9475 if (typeof instance.getChildContext === 'function') {
9476 !(typeof type.childContextTypes === 'object') ? warning(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
9477 }
9478 }
9479 }
9480
9481 function resetInputPointers(workInProgress, instance) {
9482 instance.props = workInProgress.memoizedProps;
9483 instance.state = workInProgress.memoizedState;
9484 }
9485
9486 function adoptClassInstance(workInProgress, instance) {
9487 instance.updater = updater;
9488 workInProgress.stateNode = instance;
9489 // The instance needs access to the fiber so that it can schedule updates
9490 set(instance, workInProgress);
9491 {
9492 instance._reactInternalInstance = fakeInternalInstance;
9493 }
9494 }
9495
9496 function constructClassInstance(workInProgress, props) {
9497 var ctor = workInProgress.type;
9498 var unmaskedContext = getUnmaskedContext(workInProgress);
9499 var needsContext = isContextConsumer(workInProgress);
9500 var context = needsContext ? getMaskedContext(workInProgress, unmaskedContext) : emptyObject;
9501
9502 // Instantiate twice to help detect side-effects.
9503 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
9504 new ctor(props, context); // eslint-disable-line no-new
9505 }
9506
9507 var instance = new ctor(props, context);
9508 var state = instance.state !== null && instance.state !== undefined ? instance.state : null;
9509 adoptClassInstance(workInProgress, instance);
9510
9511 {
9512 if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
9513 var componentName = getComponentName(workInProgress) || 'Component';
9514 if (!didWarnAboutUninitializedState.has(componentName)) {
9515 didWarnAboutUninitializedState.add(componentName);
9516 warning(false, '%s: Did not properly initialize state during construction. ' + 'Expected state to be an object, but it was %s.', componentName, instance.state === null ? 'null' : 'undefined');
9517 }
9518 }
9519
9520 // If new component APIs are defined, "unsafe" lifecycles won't be called.
9521 // Warn about these lifecycles if they are present.
9522 // Don't warn about react-lifecycles-compat polyfilled methods though.
9523 if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
9524 var foundWillMountName = null;
9525 var foundWillReceivePropsName = null;
9526 var foundWillUpdateName = null;
9527 if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
9528 foundWillMountName = 'componentWillMount';
9529 } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
9530 foundWillMountName = 'UNSAFE_componentWillMount';
9531 }
9532 if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
9533 foundWillReceivePropsName = 'componentWillReceiveProps';
9534 } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
9535 foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
9536 }
9537 if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
9538 foundWillUpdateName = 'componentWillUpdate';
9539 } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
9540 foundWillUpdateName = 'UNSAFE_componentWillUpdate';
9541 }
9542 if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
9543 var _componentName = getComponentName(workInProgress) || 'Component';
9544 var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
9545 if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
9546 didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
9547 warning(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', _componentName, newApiName, foundWillMountName !== null ? '\n ' + foundWillMountName : '', foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '', foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '');
9548 }
9549 }
9550 }
9551 }
9552
9553 workInProgress.memoizedState = state;
9554
9555 var partialState = callGetDerivedStateFromProps(workInProgress, instance, props, state);
9556
9557 if (partialState !== null && partialState !== undefined) {
9558 // Render-phase updates (like this) should not be added to the update queue,
9559 // So that multiple render passes do not enqueue multiple updates.
9560 // Instead, just synchronously merge the returned state into the instance.
9561 workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState);
9562 }
9563
9564 // Cache unmasked context so we can avoid recreating masked context unless necessary.
9565 // ReactFiberContext usually updates this cache but can't for newly-created instances.
9566 if (needsContext) {
9567 cacheContext(workInProgress, unmaskedContext, context);
9568 }
9569
9570 return instance;
9571 }
9572
9573 function callComponentWillMount(workInProgress, instance) {
9574 startPhaseTimer(workInProgress, 'componentWillMount');
9575 var oldState = instance.state;
9576
9577 if (typeof instance.componentWillMount === 'function') {
9578 instance.componentWillMount();
9579 }
9580 if (typeof instance.UNSAFE_componentWillMount === 'function') {
9581 instance.UNSAFE_componentWillMount();
9582 }
9583
9584 stopPhaseTimer();
9585
9586 if (oldState !== instance.state) {
9587 {
9588 warning(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress) || 'Component');
9589 }
9590 updater.enqueueReplaceState(instance, instance.state, null);
9591 }
9592 }
9593
9594 function callComponentWillReceiveProps(workInProgress, instance, newProps, newContext) {
9595 var oldState = instance.state;
9596 startPhaseTimer(workInProgress, 'componentWillReceiveProps');
9597 if (typeof instance.componentWillReceiveProps === 'function') {
9598 instance.componentWillReceiveProps(newProps, newContext);
9599 }
9600 if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
9601 instance.UNSAFE_componentWillReceiveProps(newProps, newContext);
9602 }
9603 stopPhaseTimer();
9604
9605 if (instance.state !== oldState) {
9606 {
9607 var componentName = getComponentName(workInProgress) || 'Component';
9608 if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
9609 didWarnAboutStateAssignmentForComponent.add(componentName);
9610 warning(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
9611 }
9612 }
9613 updater.enqueueReplaceState(instance, instance.state, null);
9614 }
9615 }
9616
9617 function callGetDerivedStateFromProps(workInProgress, instance, nextProps, prevState) {
9618 var type = workInProgress.type;
9619
9620
9621 if (typeof type.getDerivedStateFromProps === 'function') {
9622 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
9623 // Invoke method an extra time to help detect side-effects.
9624 type.getDerivedStateFromProps.call(null, nextProps, prevState);
9625 }
9626
9627 var partialState = type.getDerivedStateFromProps.call(null, nextProps, prevState);
9628
9629 {
9630 if (partialState === undefined) {
9631 var componentName = getComponentName(workInProgress) || 'Component';
9632 if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
9633 didWarnAboutUndefinedDerivedState.add(componentName);
9634 warning(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
9635 }
9636 }
9637 }
9638
9639 return partialState;
9640 }
9641 }
9642
9643 // Invokes the mount life-cycles on a previously never rendered instance.
9644 function mountClassInstance(workInProgress, renderExpirationTime) {
9645 var ctor = workInProgress.type;
9646 var current = workInProgress.alternate;
9647
9648 {
9649 checkClassInstance(workInProgress);
9650 }
9651
9652 var instance = workInProgress.stateNode;
9653 var props = workInProgress.pendingProps;
9654 var unmaskedContext = getUnmaskedContext(workInProgress);
9655
9656 instance.props = props;
9657 instance.state = workInProgress.memoizedState;
9658 instance.refs = emptyObject;
9659 instance.context = getMaskedContext(workInProgress, unmaskedContext);
9660
9661 {
9662 if (workInProgress.mode & StrictMode) {
9663 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
9664 }
9665
9666 if (warnAboutDeprecatedLifecycles) {
9667 ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance);
9668 }
9669 }
9670
9671 // In order to support react-lifecycles-compat polyfilled components,
9672 // Unsafe lifecycles should not be invoked for components using the new APIs.
9673 if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
9674 callComponentWillMount(workInProgress, instance);
9675 // If we had additional state updates during this life-cycle, let's
9676 // process them now.
9677 var updateQueue = workInProgress.updateQueue;
9678 if (updateQueue !== null) {
9679 instance.state = processUpdateQueue(current, workInProgress, updateQueue, instance, props, renderExpirationTime);
9680 }
9681 }
9682 if (typeof instance.componentDidMount === 'function') {
9683 workInProgress.effectTag |= Update;
9684 }
9685 }
9686
9687 function resumeMountClassInstance(workInProgress, renderExpirationTime) {
9688 var ctor = workInProgress.type;
9689 var instance = workInProgress.stateNode;
9690 resetInputPointers(workInProgress, instance);
9691
9692 var oldProps = workInProgress.memoizedProps;
9693 var newProps = workInProgress.pendingProps;
9694 var oldContext = instance.context;
9695 var newUnmaskedContext = getUnmaskedContext(workInProgress);
9696 var newContext = getMaskedContext(workInProgress, newUnmaskedContext);
9697
9698 var hasNewLifecycles = typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
9699
9700 // Note: During these life-cycles, instance.props/instance.state are what
9701 // ever the previously attempted to render - not the "current". However,
9702 // during componentDidUpdate we pass the "current" props.
9703
9704 // In order to support react-lifecycles-compat polyfilled components,
9705 // Unsafe lifecycles should not be invoked for components using the new APIs.
9706 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
9707 if (oldProps !== newProps || oldContext !== newContext) {
9708 callComponentWillReceiveProps(workInProgress, instance, newProps, newContext);
9709 }
9710 }
9711
9712 // Compute the next state using the memoized state and the update queue.
9713 var oldState = workInProgress.memoizedState;
9714 // TODO: Previous state can be null.
9715 var newState = void 0;
9716 var derivedStateFromCatch = void 0;
9717 if (workInProgress.updateQueue !== null) {
9718 newState = processUpdateQueue(null, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime);
9719
9720 var updateQueue = workInProgress.updateQueue;
9721 if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') {
9722 var capturedValues = updateQueue.capturedValues;
9723 // Don't remove these from the update queue yet. We need them in
9724 // finishClassComponent. Do the reset there.
9725 // TODO: This is awkward. Refactor class components.
9726 // updateQueue.capturedValues = null;
9727 derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues);
9728 }
9729 } else {
9730 newState = oldState;
9731 }
9732
9733 var derivedStateFromProps = void 0;
9734 if (oldProps !== newProps) {
9735 // The prevState parameter should be the partially updated state.
9736 // Otherwise, spreading state in return values could override updates.
9737 derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState);
9738 }
9739
9740 if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) {
9741 // Render-phase updates (like this) should not be added to the update queue,
9742 // So that multiple render passes do not enqueue multiple updates.
9743 // Instead, just synchronously merge the returned state into the instance.
9744 newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps);
9745
9746 // Update the base state of the update queue.
9747 // FIXME: This is getting ridiculous. Refactor plz!
9748 var _updateQueue = workInProgress.updateQueue;
9749 if (_updateQueue !== null) {
9750 _updateQueue.baseState = _assign({}, _updateQueue.baseState, derivedStateFromProps);
9751 }
9752 }
9753 if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) {
9754 // Render-phase updates (like this) should not be added to the update queue,
9755 // So that multiple render passes do not enqueue multiple updates.
9756 // Instead, just synchronously merge the returned state into the instance.
9757 newState = newState === null || newState === undefined ? derivedStateFromCatch : _assign({}, newState, derivedStateFromCatch);
9758
9759 // Update the base state of the update queue.
9760 // FIXME: This is getting ridiculous. Refactor plz!
9761 var _updateQueue2 = workInProgress.updateQueue;
9762 if (_updateQueue2 !== null) {
9763 _updateQueue2.baseState = _assign({}, _updateQueue2.baseState, derivedStateFromCatch);
9764 }
9765 }
9766
9767 if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) {
9768 // If an update was already in progress, we should schedule an Update
9769 // effect even though we're bailing out, so that cWU/cDU are called.
9770 if (typeof instance.componentDidMount === 'function') {
9771 workInProgress.effectTag |= Update;
9772 }
9773 return false;
9774 }
9775
9776 var shouldUpdate = checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext);
9777
9778 if (shouldUpdate) {
9779 // In order to support react-lifecycles-compat polyfilled components,
9780 // Unsafe lifecycles should not be invoked for components using the new APIs.
9781 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
9782 startPhaseTimer(workInProgress, 'componentWillMount');
9783 if (typeof instance.componentWillMount === 'function') {
9784 instance.componentWillMount();
9785 }
9786 if (typeof instance.UNSAFE_componentWillMount === 'function') {
9787 instance.UNSAFE_componentWillMount();
9788 }
9789 stopPhaseTimer();
9790 }
9791 if (typeof instance.componentDidMount === 'function') {
9792 workInProgress.effectTag |= Update;
9793 }
9794 } else {
9795 // If an update was already in progress, we should schedule an Update
9796 // effect even though we're bailing out, so that cWU/cDU are called.
9797 if (typeof instance.componentDidMount === 'function') {
9798 workInProgress.effectTag |= Update;
9799 }
9800
9801 // If shouldComponentUpdate returned false, we should still update the
9802 // memoized props/state to indicate that this work can be reused.
9803 memoizeProps(workInProgress, newProps);
9804 memoizeState(workInProgress, newState);
9805 }
9806
9807 // Update the existing instance's state, props, and context pointers even
9808 // if shouldComponentUpdate returns false.
9809 instance.props = newProps;
9810 instance.state = newState;
9811 instance.context = newContext;
9812
9813 return shouldUpdate;
9814 }
9815
9816 // Invokes the update life-cycles and returns false if it shouldn't rerender.
9817 function updateClassInstance(current, workInProgress, renderExpirationTime) {
9818 var ctor = workInProgress.type;
9819 var instance = workInProgress.stateNode;
9820 resetInputPointers(workInProgress, instance);
9821
9822 var oldProps = workInProgress.memoizedProps;
9823 var newProps = workInProgress.pendingProps;
9824 var oldContext = instance.context;
9825 var newUnmaskedContext = getUnmaskedContext(workInProgress);
9826 var newContext = getMaskedContext(workInProgress, newUnmaskedContext);
9827
9828 var hasNewLifecycles = typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
9829
9830 // Note: During these life-cycles, instance.props/instance.state are what
9831 // ever the previously attempted to render - not the "current". However,
9832 // during componentDidUpdate we pass the "current" props.
9833
9834 // In order to support react-lifecycles-compat polyfilled components,
9835 // Unsafe lifecycles should not be invoked for components using the new APIs.
9836 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
9837 if (oldProps !== newProps || oldContext !== newContext) {
9838 callComponentWillReceiveProps(workInProgress, instance, newProps, newContext);
9839 }
9840 }
9841
9842 // Compute the next state using the memoized state and the update queue.
9843 var oldState = workInProgress.memoizedState;
9844 // TODO: Previous state can be null.
9845 var newState = void 0;
9846 var derivedStateFromCatch = void 0;
9847
9848 if (workInProgress.updateQueue !== null) {
9849 newState = processUpdateQueue(current, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime);
9850
9851 var updateQueue = workInProgress.updateQueue;
9852 if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') {
9853 var capturedValues = updateQueue.capturedValues;
9854 // Don't remove these from the update queue yet. We need them in
9855 // finishClassComponent. Do the reset there.
9856 // TODO: This is awkward. Refactor class components.
9857 // updateQueue.capturedValues = null;
9858 derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues);
9859 }
9860 } else {
9861 newState = oldState;
9862 }
9863
9864 var derivedStateFromProps = void 0;
9865 if (oldProps !== newProps) {
9866 // The prevState parameter should be the partially updated state.
9867 // Otherwise, spreading state in return values could override updates.
9868 derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState);
9869 }
9870
9871 if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) {
9872 // Render-phase updates (like this) should not be added to the update queue,
9873 // So that multiple render passes do not enqueue multiple updates.
9874 // Instead, just synchronously merge the returned state into the instance.
9875 newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps);
9876
9877 // Update the base state of the update queue.
9878 // FIXME: This is getting ridiculous. Refactor plz!
9879 var _updateQueue3 = workInProgress.updateQueue;
9880 if (_updateQueue3 !== null) {
9881 _updateQueue3.baseState = _assign({}, _updateQueue3.baseState, derivedStateFromProps);
9882 }
9883 }
9884 if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) {
9885 // Render-phase updates (like this) should not be added to the update queue,
9886 // So that multiple render passes do not enqueue multiple updates.
9887 // Instead, just synchronously merge the returned state into the instance.
9888 newState = newState === null || newState === undefined ? derivedStateFromCatch : _assign({}, newState, derivedStateFromCatch);
9889
9890 // Update the base state of the update queue.
9891 // FIXME: This is getting ridiculous. Refactor plz!
9892 var _updateQueue4 = workInProgress.updateQueue;
9893 if (_updateQueue4 !== null) {
9894 _updateQueue4.baseState = _assign({}, _updateQueue4.baseState, derivedStateFromCatch);
9895 }
9896 }
9897
9898 if (oldProps === newProps && oldState === newState && !hasContextChanged() && !(workInProgress.updateQueue !== null && workInProgress.updateQueue.hasForceUpdate)) {
9899 // If an update was already in progress, we should schedule an Update
9900 // effect even though we're bailing out, so that cWU/cDU are called.
9901 if (typeof instance.componentDidUpdate === 'function') {
9902 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
9903 workInProgress.effectTag |= Update;
9904 }
9905 }
9906 if (typeof instance.getSnapshotBeforeUpdate === 'function') {
9907 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
9908 workInProgress.effectTag |= Snapshot;
9909 }
9910 }
9911 return false;
9912 }
9913
9914 var shouldUpdate = checkShouldComponentUpdate(workInProgress, oldProps, newProps, oldState, newState, newContext);
9915
9916 if (shouldUpdate) {
9917 // In order to support react-lifecycles-compat polyfilled components,
9918 // Unsafe lifecycles should not be invoked for components using the new APIs.
9919 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
9920 startPhaseTimer(workInProgress, 'componentWillUpdate');
9921 if (typeof instance.componentWillUpdate === 'function') {
9922 instance.componentWillUpdate(newProps, newState, newContext);
9923 }
9924 if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
9925 instance.UNSAFE_componentWillUpdate(newProps, newState, newContext);
9926 }
9927 stopPhaseTimer();
9928 }
9929 if (typeof instance.componentDidUpdate === 'function') {
9930 workInProgress.effectTag |= Update;
9931 }
9932 if (typeof instance.getSnapshotBeforeUpdate === 'function') {
9933 workInProgress.effectTag |= Snapshot;
9934 }
9935 } else {
9936 // If an update was already in progress, we should schedule an Update
9937 // effect even though we're bailing out, so that cWU/cDU are called.
9938 if (typeof instance.componentDidUpdate === 'function') {
9939 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
9940 workInProgress.effectTag |= Update;
9941 }
9942 }
9943 if (typeof instance.getSnapshotBeforeUpdate === 'function') {
9944 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
9945 workInProgress.effectTag |= Snapshot;
9946 }
9947 }
9948
9949 // If shouldComponentUpdate returned false, we should still update the
9950 // memoized props/state to indicate that this work can be reused.
9951 memoizeProps(workInProgress, newProps);
9952 memoizeState(workInProgress, newState);
9953 }
9954
9955 // Update the existing instance's state, props, and context pointers even
9956 // if shouldComponentUpdate returns false.
9957 instance.props = newProps;
9958 instance.state = newState;
9959 instance.context = newContext;
9960
9961 return shouldUpdate;
9962 }
9963
9964 return {
9965 adoptClassInstance: adoptClassInstance,
9966 callGetDerivedStateFromProps: callGetDerivedStateFromProps,
9967 constructClassInstance: constructClassInstance,
9968 mountClassInstance: mountClassInstance,
9969 resumeMountClassInstance: resumeMountClassInstance,
9970 updateClassInstance: updateClassInstance
9971 };
9972 };
9973
9974 var getCurrentFiberStackAddendum$2 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
9975
9976
9977 var didWarnAboutMaps = void 0;
9978 var didWarnAboutStringRefInStrictMode = void 0;
9979 var ownerHasKeyUseWarning = void 0;
9980 var ownerHasFunctionTypeWarning = void 0;
9981 var warnForMissingKey = function (child) {};
9982
9983 {
9984 didWarnAboutMaps = false;
9985 didWarnAboutStringRefInStrictMode = {};
9986
9987 /**
9988 * Warn if there's no key explicitly set on dynamic arrays of children or
9989 * object keys are not valid. This allows us to keep track of children between
9990 * updates.
9991 */
9992 ownerHasKeyUseWarning = {};
9993 ownerHasFunctionTypeWarning = {};
9994
9995 warnForMissingKey = function (child) {
9996 if (child === null || typeof child !== 'object') {
9997 return;
9998 }
9999 if (!child._store || child._store.validated || child.key != null) {
10000 return;
10001 }
10002 !(typeof child._store === 'object') ? invariant(false, 'React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.') : void 0;
10003 child._store.validated = true;
10004
10005 var currentComponentErrorInfo = 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + (getCurrentFiberStackAddendum$2() || '');
10006 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
10007 return;
10008 }
10009 ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
10010
10011 warning(false, 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.%s', getCurrentFiberStackAddendum$2());
10012 };
10013 }
10014
10015 var isArray$1 = Array.isArray;
10016
10017 function coerceRef(returnFiber, current, element) {
10018 var mixedRef = element.ref;
10019 if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
10020 {
10021 if (returnFiber.mode & StrictMode) {
10022 var componentName = getComponentName(returnFiber) || 'Component';
10023 if (!didWarnAboutStringRefInStrictMode[componentName]) {
10024 warning(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using createRef() instead.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-string-ref', mixedRef, getStackAddendumByWorkInProgressFiber(returnFiber));
10025 didWarnAboutStringRefInStrictMode[componentName] = true;
10026 }
10027 }
10028 }
10029
10030 if (element._owner) {
10031 var owner = element._owner;
10032 var inst = void 0;
10033 if (owner) {
10034 var ownerFiber = owner;
10035 !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Stateless function components cannot have refs.') : void 0;
10036 inst = ownerFiber.stateNode;
10037 }
10038 !inst ? invariant(false, 'Missing owner for string ref %s. This error is likely caused by a bug in React. Please file an issue.', mixedRef) : void 0;
10039 var stringRef = '' + mixedRef;
10040 // Check if previous string ref matches new string ref
10041 if (current !== null && current.ref !== null && current.ref._stringRef === stringRef) {
10042 return current.ref;
10043 }
10044 var ref = function (value) {
10045 var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
10046 if (value === null) {
10047 delete refs[stringRef];
10048 } else {
10049 refs[stringRef] = value;
10050 }
10051 };
10052 ref._stringRef = stringRef;
10053 return ref;
10054 } else {
10055 !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function or a string.') : void 0;
10056 !element._owner ? invariant(false, 'Element ref was specified as a string (%s) but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a functional component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.', mixedRef) : void 0;
10057 }
10058 }
10059 return mixedRef;
10060 }
10061
10062 function throwOnInvalidObjectType(returnFiber, newChild) {
10063 if (returnFiber.type !== 'textarea') {
10064 var addendum = '';
10065 {
10066 addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + (getCurrentFiberStackAddendum$2() || '');
10067 }
10068 invariant(false, 'Objects are not valid as a React child (found: %s).%s', Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild, addendum);
10069 }
10070 }
10071
10072 function warnOnFunctionType() {
10073 var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + (getCurrentFiberStackAddendum$2() || '');
10074
10075 if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
10076 return;
10077 }
10078 ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
10079
10080 warning(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.%s', getCurrentFiberStackAddendum$2() || '');
10081 }
10082
10083 // This wrapper function exists because I expect to clone the code in each path
10084 // to be able to optimize each path individually by branching early. This needs
10085 // a compiler or we can do it manually. Helpers that don't need this branching
10086 // live outside of this function.
10087 function ChildReconciler(shouldTrackSideEffects) {
10088 function deleteChild(returnFiber, childToDelete) {
10089 if (!shouldTrackSideEffects) {
10090 // Noop.
10091 return;
10092 }
10093 // Deletions are added in reversed order so we add it to the front.
10094 // At this point, the return fiber's effect list is empty except for
10095 // deletions, so we can just append the deletion to the list. The remaining
10096 // effects aren't added until the complete phase. Once we implement
10097 // resuming, this may not be true.
10098 var last = returnFiber.lastEffect;
10099 if (last !== null) {
10100 last.nextEffect = childToDelete;
10101 returnFiber.lastEffect = childToDelete;
10102 } else {
10103 returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
10104 }
10105 childToDelete.nextEffect = null;
10106 childToDelete.effectTag = Deletion;
10107 }
10108
10109 function deleteRemainingChildren(returnFiber, currentFirstChild) {
10110 if (!shouldTrackSideEffects) {
10111 // Noop.
10112 return null;
10113 }
10114
10115 // TODO: For the shouldClone case, this could be micro-optimized a bit by
10116 // assuming that after the first child we've already added everything.
10117 var childToDelete = currentFirstChild;
10118 while (childToDelete !== null) {
10119 deleteChild(returnFiber, childToDelete);
10120 childToDelete = childToDelete.sibling;
10121 }
10122 return null;
10123 }
10124
10125 function mapRemainingChildren(returnFiber, currentFirstChild) {
10126 // Add the remaining children to a temporary map so that we can find them by
10127 // keys quickly. Implicit (null) keys get added to this set with their index
10128 var existingChildren = new Map();
10129
10130 var existingChild = currentFirstChild;
10131 while (existingChild !== null) {
10132 if (existingChild.key !== null) {
10133 existingChildren.set(existingChild.key, existingChild);
10134 } else {
10135 existingChildren.set(existingChild.index, existingChild);
10136 }
10137 existingChild = existingChild.sibling;
10138 }
10139 return existingChildren;
10140 }
10141
10142 function useFiber(fiber, pendingProps, expirationTime) {
10143 // We currently set sibling to null and index to 0 here because it is easy
10144 // to forget to do before returning it. E.g. for the single child case.
10145 var clone = createWorkInProgress(fiber, pendingProps, expirationTime);
10146 clone.index = 0;
10147 clone.sibling = null;
10148 return clone;
10149 }
10150
10151 function placeChild(newFiber, lastPlacedIndex, newIndex) {
10152 newFiber.index = newIndex;
10153 if (!shouldTrackSideEffects) {
10154 // Noop.
10155 return lastPlacedIndex;
10156 }
10157 var current = newFiber.alternate;
10158 if (current !== null) {
10159 var oldIndex = current.index;
10160 if (oldIndex < lastPlacedIndex) {
10161 // This is a move.
10162 newFiber.effectTag = Placement;
10163 return lastPlacedIndex;
10164 } else {
10165 // This item can stay in place.
10166 return oldIndex;
10167 }
10168 } else {
10169 // This is an insertion.
10170 newFiber.effectTag = Placement;
10171 return lastPlacedIndex;
10172 }
10173 }
10174
10175 function placeSingleChild(newFiber) {
10176 // This is simpler for the single child case. We only need to do a
10177 // placement for inserting new children.
10178 if (shouldTrackSideEffects && newFiber.alternate === null) {
10179 newFiber.effectTag = Placement;
10180 }
10181 return newFiber;
10182 }
10183
10184 function updateTextNode(returnFiber, current, textContent, expirationTime) {
10185 if (current === null || current.tag !== HostText) {
10186 // Insert
10187 var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
10188 created['return'] = returnFiber;
10189 return created;
10190 } else {
10191 // Update
10192 var existing = useFiber(current, textContent, expirationTime);
10193 existing['return'] = returnFiber;
10194 return existing;
10195 }
10196 }
10197
10198 function updateElement(returnFiber, current, element, expirationTime) {
10199 if (current !== null && current.type === element.type) {
10200 // Move based on index
10201 var existing = useFiber(current, element.props, expirationTime);
10202 existing.ref = coerceRef(returnFiber, current, element);
10203 existing['return'] = returnFiber;
10204 {
10205 existing._debugSource = element._source;
10206 existing._debugOwner = element._owner;
10207 }
10208 return existing;
10209 } else {
10210 // Insert
10211 var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
10212 created.ref = coerceRef(returnFiber, current, element);
10213 created['return'] = returnFiber;
10214 return created;
10215 }
10216 }
10217
10218 function updatePortal(returnFiber, current, portal, expirationTime) {
10219 if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) {
10220 // Insert
10221 var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
10222 created['return'] = returnFiber;
10223 return created;
10224 } else {
10225 // Update
10226 var existing = useFiber(current, portal.children || [], expirationTime);
10227 existing['return'] = returnFiber;
10228 return existing;
10229 }
10230 }
10231
10232 function updateFragment(returnFiber, current, fragment, expirationTime, key) {
10233 if (current === null || current.tag !== Fragment) {
10234 // Insert
10235 var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
10236 created['return'] = returnFiber;
10237 return created;
10238 } else {
10239 // Update
10240 var existing = useFiber(current, fragment, expirationTime);
10241 existing['return'] = returnFiber;
10242 return existing;
10243 }
10244 }
10245
10246 function createChild(returnFiber, newChild, expirationTime) {
10247 if (typeof newChild === 'string' || typeof newChild === 'number') {
10248 // Text nodes don't have keys. If the previous node is implicitly keyed
10249 // we can continue to replace it without aborting even if it is not a text
10250 // node.
10251 var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
10252 created['return'] = returnFiber;
10253 return created;
10254 }
10255
10256 if (typeof newChild === 'object' && newChild !== null) {
10257 switch (newChild.$$typeof) {
10258 case REACT_ELEMENT_TYPE:
10259 {
10260 var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
10261 _created.ref = coerceRef(returnFiber, null, newChild);
10262 _created['return'] = returnFiber;
10263 return _created;
10264 }
10265 case REACT_PORTAL_TYPE:
10266 {
10267 var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
10268 _created2['return'] = returnFiber;
10269 return _created2;
10270 }
10271 }
10272
10273 if (isArray$1(newChild) || getIteratorFn(newChild)) {
10274 var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
10275 _created3['return'] = returnFiber;
10276 return _created3;
10277 }
10278
10279 throwOnInvalidObjectType(returnFiber, newChild);
10280 }
10281
10282 {
10283 if (typeof newChild === 'function') {
10284 warnOnFunctionType();
10285 }
10286 }
10287
10288 return null;
10289 }
10290
10291 function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
10292 // Update the fiber if the keys match, otherwise return null.
10293
10294 var key = oldFiber !== null ? oldFiber.key : null;
10295
10296 if (typeof newChild === 'string' || typeof newChild === 'number') {
10297 // Text nodes don't have keys. If the previous node is implicitly keyed
10298 // we can continue to replace it without aborting even if it is not a text
10299 // node.
10300 if (key !== null) {
10301 return null;
10302 }
10303 return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
10304 }
10305
10306 if (typeof newChild === 'object' && newChild !== null) {
10307 switch (newChild.$$typeof) {
10308 case REACT_ELEMENT_TYPE:
10309 {
10310 if (newChild.key === key) {
10311 if (newChild.type === REACT_FRAGMENT_TYPE) {
10312 return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
10313 }
10314 return updateElement(returnFiber, oldFiber, newChild, expirationTime);
10315 } else {
10316 return null;
10317 }
10318 }
10319 case REACT_PORTAL_TYPE:
10320 {
10321 if (newChild.key === key) {
10322 return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
10323 } else {
10324 return null;
10325 }
10326 }
10327 }
10328
10329 if (isArray$1(newChild) || getIteratorFn(newChild)) {
10330 if (key !== null) {
10331 return null;
10332 }
10333
10334 return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
10335 }
10336
10337 throwOnInvalidObjectType(returnFiber, newChild);
10338 }
10339
10340 {
10341 if (typeof newChild === 'function') {
10342 warnOnFunctionType();
10343 }
10344 }
10345
10346 return null;
10347 }
10348
10349 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
10350 if (typeof newChild === 'string' || typeof newChild === 'number') {
10351 // Text nodes don't have keys, so we neither have to check the old nor
10352 // new node for the key. If both are text nodes, they match.
10353 var matchedFiber = existingChildren.get(newIdx) || null;
10354 return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
10355 }
10356
10357 if (typeof newChild === 'object' && newChild !== null) {
10358 switch (newChild.$$typeof) {
10359 case REACT_ELEMENT_TYPE:
10360 {
10361 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
10362 if (newChild.type === REACT_FRAGMENT_TYPE) {
10363 return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
10364 }
10365 return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
10366 }
10367 case REACT_PORTAL_TYPE:
10368 {
10369 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
10370 return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
10371 }
10372 }
10373
10374 if (isArray$1(newChild) || getIteratorFn(newChild)) {
10375 var _matchedFiber3 = existingChildren.get(newIdx) || null;
10376 return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
10377 }
10378
10379 throwOnInvalidObjectType(returnFiber, newChild);
10380 }
10381
10382 {
10383 if (typeof newChild === 'function') {
10384 warnOnFunctionType();
10385 }
10386 }
10387
10388 return null;
10389 }
10390
10391 /**
10392 * Warns if there is a duplicate or missing key
10393 */
10394 function warnOnInvalidKey(child, knownKeys) {
10395 {
10396 if (typeof child !== 'object' || child === null) {
10397 return knownKeys;
10398 }
10399 switch (child.$$typeof) {
10400 case REACT_ELEMENT_TYPE:
10401 case REACT_PORTAL_TYPE:
10402 warnForMissingKey(child);
10403 var key = child.key;
10404 if (typeof key !== 'string') {
10405 break;
10406 }
10407 if (knownKeys === null) {
10408 knownKeys = new Set();
10409 knownKeys.add(key);
10410 break;
10411 }
10412 if (!knownKeys.has(key)) {
10413 knownKeys.add(key);
10414 break;
10415 }
10416 warning(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.%s', key, getCurrentFiberStackAddendum$2());
10417 break;
10418 default:
10419 break;
10420 }
10421 }
10422 return knownKeys;
10423 }
10424
10425 function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
10426 // This algorithm can't optimize by searching from boths ends since we
10427 // don't have backpointers on fibers. I'm trying to see how far we can get
10428 // with that model. If it ends up not being worth the tradeoffs, we can
10429 // add it later.
10430
10431 // Even with a two ended optimization, we'd want to optimize for the case
10432 // where there are few changes and brute force the comparison instead of
10433 // going for the Map. It'd like to explore hitting that path first in
10434 // forward-only mode and only go for the Map once we notice that we need
10435 // lots of look ahead. This doesn't handle reversal as well as two ended
10436 // search but that's unusual. Besides, for the two ended optimization to
10437 // work on Iterables, we'd need to copy the whole set.
10438
10439 // In this first iteration, we'll just live with hitting the bad case
10440 // (adding everything to a Map) in for every insert/move.
10441
10442 // If you change this code, also update reconcileChildrenIterator() which
10443 // uses the same algorithm.
10444
10445 {
10446 // First, validate keys.
10447 var knownKeys = null;
10448 for (var i = 0; i < newChildren.length; i++) {
10449 var child = newChildren[i];
10450 knownKeys = warnOnInvalidKey(child, knownKeys);
10451 }
10452 }
10453
10454 var resultingFirstChild = null;
10455 var previousNewFiber = null;
10456
10457 var oldFiber = currentFirstChild;
10458 var lastPlacedIndex = 0;
10459 var newIdx = 0;
10460 var nextOldFiber = null;
10461 for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
10462 if (oldFiber.index > newIdx) {
10463 nextOldFiber = oldFiber;
10464 oldFiber = null;
10465 } else {
10466 nextOldFiber = oldFiber.sibling;
10467 }
10468 var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
10469 if (newFiber === null) {
10470 // TODO: This breaks on empty slots like null children. That's
10471 // unfortunate because it triggers the slow path all the time. We need
10472 // a better way to communicate whether this was a miss or null,
10473 // boolean, undefined, etc.
10474 if (oldFiber === null) {
10475 oldFiber = nextOldFiber;
10476 }
10477 break;
10478 }
10479 if (shouldTrackSideEffects) {
10480 if (oldFiber && newFiber.alternate === null) {
10481 // We matched the slot, but we didn't reuse the existing fiber, so we
10482 // need to delete the existing child.
10483 deleteChild(returnFiber, oldFiber);
10484 }
10485 }
10486 lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
10487 if (previousNewFiber === null) {
10488 // TODO: Move out of the loop. This only happens for the first run.
10489 resultingFirstChild = newFiber;
10490 } else {
10491 // TODO: Defer siblings if we're not at the right index for this slot.
10492 // I.e. if we had null values before, then we want to defer this
10493 // for each null value. However, we also don't want to call updateSlot
10494 // with the previous one.
10495 previousNewFiber.sibling = newFiber;
10496 }
10497 previousNewFiber = newFiber;
10498 oldFiber = nextOldFiber;
10499 }
10500
10501 if (newIdx === newChildren.length) {
10502 // We've reached the end of the new children. We can delete the rest.
10503 deleteRemainingChildren(returnFiber, oldFiber);
10504 return resultingFirstChild;
10505 }
10506
10507 if (oldFiber === null) {
10508 // If we don't have any more existing children we can choose a fast path
10509 // since the rest will all be insertions.
10510 for (; newIdx < newChildren.length; newIdx++) {
10511 var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
10512 if (!_newFiber) {
10513 continue;
10514 }
10515 lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
10516 if (previousNewFiber === null) {
10517 // TODO: Move out of the loop. This only happens for the first run.
10518 resultingFirstChild = _newFiber;
10519 } else {
10520 previousNewFiber.sibling = _newFiber;
10521 }
10522 previousNewFiber = _newFiber;
10523 }
10524 return resultingFirstChild;
10525 }
10526
10527 // Add all children to a key map for quick lookups.
10528 var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
10529
10530 // Keep scanning and use the map to restore deleted items as moves.
10531 for (; newIdx < newChildren.length; newIdx++) {
10532 var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
10533 if (_newFiber2) {
10534 if (shouldTrackSideEffects) {
10535 if (_newFiber2.alternate !== null) {
10536 // The new fiber is a work in progress, but if there exists a
10537 // current, that means that we reused the fiber. We need to delete
10538 // it from the child list so that we don't add it to the deletion
10539 // list.
10540 existingChildren['delete'](_newFiber2.key === null ? newIdx : _newFiber2.key);
10541 }
10542 }
10543 lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
10544 if (previousNewFiber === null) {
10545 resultingFirstChild = _newFiber2;
10546 } else {
10547 previousNewFiber.sibling = _newFiber2;
10548 }
10549 previousNewFiber = _newFiber2;
10550 }
10551 }
10552
10553 if (shouldTrackSideEffects) {
10554 // Any existing children that weren't consumed above were deleted. We need
10555 // to add them to the deletion list.
10556 existingChildren.forEach(function (child) {
10557 return deleteChild(returnFiber, child);
10558 });
10559 }
10560
10561 return resultingFirstChild;
10562 }
10563
10564 function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
10565 // This is the same implementation as reconcileChildrenArray(),
10566 // but using the iterator instead.
10567
10568 var iteratorFn = getIteratorFn(newChildrenIterable);
10569 !(typeof iteratorFn === 'function') ? invariant(false, 'An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.') : void 0;
10570
10571 {
10572 // Warn about using Maps as children
10573 if (typeof newChildrenIterable.entries === 'function') {
10574 var possibleMap = newChildrenIterable;
10575 if (possibleMap.entries === iteratorFn) {
10576 !didWarnAboutMaps ? warning(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getCurrentFiberStackAddendum$2()) : void 0;
10577 didWarnAboutMaps = true;
10578 }
10579 }
10580
10581 // First, validate keys.
10582 // We'll get a different iterator later for the main pass.
10583 var _newChildren = iteratorFn.call(newChildrenIterable);
10584 if (_newChildren) {
10585 var knownKeys = null;
10586 var _step = _newChildren.next();
10587 for (; !_step.done; _step = _newChildren.next()) {
10588 var child = _step.value;
10589 knownKeys = warnOnInvalidKey(child, knownKeys);
10590 }
10591 }
10592 }
10593
10594 var newChildren = iteratorFn.call(newChildrenIterable);
10595 !(newChildren != null) ? invariant(false, 'An iterable object provided no iterator.') : void 0;
10596
10597 var resultingFirstChild = null;
10598 var previousNewFiber = null;
10599
10600 var oldFiber = currentFirstChild;
10601 var lastPlacedIndex = 0;
10602 var newIdx = 0;
10603 var nextOldFiber = null;
10604
10605 var step = newChildren.next();
10606 for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
10607 if (oldFiber.index > newIdx) {
10608 nextOldFiber = oldFiber;
10609 oldFiber = null;
10610 } else {
10611 nextOldFiber = oldFiber.sibling;
10612 }
10613 var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
10614 if (newFiber === null) {
10615 // TODO: This breaks on empty slots like null children. That's
10616 // unfortunate because it triggers the slow path all the time. We need
10617 // a better way to communicate whether this was a miss or null,
10618 // boolean, undefined, etc.
10619 if (!oldFiber) {
10620 oldFiber = nextOldFiber;
10621 }
10622 break;
10623 }
10624 if (shouldTrackSideEffects) {
10625 if (oldFiber && newFiber.alternate === null) {
10626 // We matched the slot, but we didn't reuse the existing fiber, so we
10627 // need to delete the existing child.
10628 deleteChild(returnFiber, oldFiber);
10629 }
10630 }
10631 lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
10632 if (previousNewFiber === null) {
10633 // TODO: Move out of the loop. This only happens for the first run.
10634 resultingFirstChild = newFiber;
10635 } else {
10636 // TODO: Defer siblings if we're not at the right index for this slot.
10637 // I.e. if we had null values before, then we want to defer this
10638 // for each null value. However, we also don't want to call updateSlot
10639 // with the previous one.
10640 previousNewFiber.sibling = newFiber;
10641 }
10642 previousNewFiber = newFiber;
10643 oldFiber = nextOldFiber;
10644 }
10645
10646 if (step.done) {
10647 // We've reached the end of the new children. We can delete the rest.
10648 deleteRemainingChildren(returnFiber, oldFiber);
10649 return resultingFirstChild;
10650 }
10651
10652 if (oldFiber === null) {
10653 // If we don't have any more existing children we can choose a fast path
10654 // since the rest will all be insertions.
10655 for (; !step.done; newIdx++, step = newChildren.next()) {
10656 var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
10657 if (_newFiber3 === null) {
10658 continue;
10659 }
10660 lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
10661 if (previousNewFiber === null) {
10662 // TODO: Move out of the loop. This only happens for the first run.
10663 resultingFirstChild = _newFiber3;
10664 } else {
10665 previousNewFiber.sibling = _newFiber3;
10666 }
10667 previousNewFiber = _newFiber3;
10668 }
10669 return resultingFirstChild;
10670 }
10671
10672 // Add all children to a key map for quick lookups.
10673 var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
10674
10675 // Keep scanning and use the map to restore deleted items as moves.
10676 for (; !step.done; newIdx++, step = newChildren.next()) {
10677 var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
10678 if (_newFiber4 !== null) {
10679 if (shouldTrackSideEffects) {
10680 if (_newFiber4.alternate !== null) {
10681 // The new fiber is a work in progress, but if there exists a
10682 // current, that means that we reused the fiber. We need to delete
10683 // it from the child list so that we don't add it to the deletion
10684 // list.
10685 existingChildren['delete'](_newFiber4.key === null ? newIdx : _newFiber4.key);
10686 }
10687 }
10688 lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
10689 if (previousNewFiber === null) {
10690 resultingFirstChild = _newFiber4;
10691 } else {
10692 previousNewFiber.sibling = _newFiber4;
10693 }
10694 previousNewFiber = _newFiber4;
10695 }
10696 }
10697
10698 if (shouldTrackSideEffects) {
10699 // Any existing children that weren't consumed above were deleted. We need
10700 // to add them to the deletion list.
10701 existingChildren.forEach(function (child) {
10702 return deleteChild(returnFiber, child);
10703 });
10704 }
10705
10706 return resultingFirstChild;
10707 }
10708
10709 function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
10710 // There's no need to check for keys on text nodes since we don't have a
10711 // way to define them.
10712 if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
10713 // We already have an existing node so let's just update it and delete
10714 // the rest.
10715 deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
10716 var existing = useFiber(currentFirstChild, textContent, expirationTime);
10717 existing['return'] = returnFiber;
10718 return existing;
10719 }
10720 // The existing first child is not a text node so we need to create one
10721 // and delete the existing ones.
10722 deleteRemainingChildren(returnFiber, currentFirstChild);
10723 var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
10724 created['return'] = returnFiber;
10725 return created;
10726 }
10727
10728 function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
10729 var key = element.key;
10730 var child = currentFirstChild;
10731 while (child !== null) {
10732 // TODO: If key === null and child.key === null, then this only applies to
10733 // the first item in the list.
10734 if (child.key === key) {
10735 if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) {
10736 deleteRemainingChildren(returnFiber, child.sibling);
10737 var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
10738 existing.ref = coerceRef(returnFiber, child, element);
10739 existing['return'] = returnFiber;
10740 {
10741 existing._debugSource = element._source;
10742 existing._debugOwner = element._owner;
10743 }
10744 return existing;
10745 } else {
10746 deleteRemainingChildren(returnFiber, child);
10747 break;
10748 }
10749 } else {
10750 deleteChild(returnFiber, child);
10751 }
10752 child = child.sibling;
10753 }
10754
10755 if (element.type === REACT_FRAGMENT_TYPE) {
10756 var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
10757 created['return'] = returnFiber;
10758 return created;
10759 } else {
10760 var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
10761 _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
10762 _created4['return'] = returnFiber;
10763 return _created4;
10764 }
10765 }
10766
10767 function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
10768 var key = portal.key;
10769 var child = currentFirstChild;
10770 while (child !== null) {
10771 // TODO: If key === null and child.key === null, then this only applies to
10772 // the first item in the list.
10773 if (child.key === key) {
10774 if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
10775 deleteRemainingChildren(returnFiber, child.sibling);
10776 var existing = useFiber(child, portal.children || [], expirationTime);
10777 existing['return'] = returnFiber;
10778 return existing;
10779 } else {
10780 deleteRemainingChildren(returnFiber, child);
10781 break;
10782 }
10783 } else {
10784 deleteChild(returnFiber, child);
10785 }
10786 child = child.sibling;
10787 }
10788
10789 var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
10790 created['return'] = returnFiber;
10791 return created;
10792 }
10793
10794 // This API will tag the children with the side-effect of the reconciliation
10795 // itself. They will be added to the side-effect list as we pass through the
10796 // children and the parent.
10797 function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
10798 // This function is not recursive.
10799 // If the top level item is an array, we treat it as a set of children,
10800 // not as a fragment. Nested arrays on the other hand will be treated as
10801 // fragment nodes. Recursion happens at the normal flow.
10802
10803 // Handle top level unkeyed fragments as if they were arrays.
10804 // This leads to an ambiguity between <>{[...]}</> and <>...</>.
10805 // We treat the ambiguous cases above the same.
10806 if (typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null) {
10807 newChild = newChild.props.children;
10808 }
10809
10810 // Handle object types
10811 var isObject = typeof newChild === 'object' && newChild !== null;
10812
10813 if (isObject) {
10814 switch (newChild.$$typeof) {
10815 case REACT_ELEMENT_TYPE:
10816 return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
10817 case REACT_PORTAL_TYPE:
10818 return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
10819 }
10820 }
10821
10822 if (typeof newChild === 'string' || typeof newChild === 'number') {
10823 return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
10824 }
10825
10826 if (isArray$1(newChild)) {
10827 return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
10828 }
10829
10830 if (getIteratorFn(newChild)) {
10831 return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
10832 }
10833
10834 if (isObject) {
10835 throwOnInvalidObjectType(returnFiber, newChild);
10836 }
10837
10838 {
10839 if (typeof newChild === 'function') {
10840 warnOnFunctionType();
10841 }
10842 }
10843 if (typeof newChild === 'undefined') {
10844 // If the new child is undefined, and the return fiber is a composite
10845 // component, throw an error. If Fiber return types are disabled,
10846 // we already threw above.
10847 switch (returnFiber.tag) {
10848 case ClassComponent:
10849 {
10850 {
10851 var instance = returnFiber.stateNode;
10852 if (instance.render._isMockFunction) {
10853 // We allow auto-mocks to proceed as if they're returning null.
10854 break;
10855 }
10856 }
10857 }
10858 // Intentionally fall through to the next case, which handles both
10859 // functions and classes
10860 // eslint-disable-next-lined no-fallthrough
10861 case FunctionalComponent:
10862 {
10863 var Component = returnFiber.type;
10864 invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', Component.displayName || Component.name || 'Component');
10865 }
10866 }
10867 }
10868
10869 // Remaining cases are all treated as empty.
10870 return deleteRemainingChildren(returnFiber, currentFirstChild);
10871 }
10872
10873 return reconcileChildFibers;
10874 }
10875
10876 var reconcileChildFibers = ChildReconciler(true);
10877 var mountChildFibers = ChildReconciler(false);
10878
10879 function cloneChildFibers(current, workInProgress) {
10880 !(current === null || workInProgress.child === current.child) ? invariant(false, 'Resuming work not yet implemented.') : void 0;
10881
10882 if (workInProgress.child === null) {
10883 return;
10884 }
10885
10886 var currentChild = workInProgress.child;
10887 var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
10888 workInProgress.child = newChild;
10889
10890 newChild['return'] = workInProgress;
10891 while (currentChild.sibling !== null) {
10892 currentChild = currentChild.sibling;
10893 newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
10894 newChild['return'] = workInProgress;
10895 }
10896 newChild.sibling = null;
10897 }
10898
10899 var didWarnAboutBadClass = void 0;
10900 var didWarnAboutGetDerivedStateOnFunctionalComponent = void 0;
10901 var didWarnAboutStatelessRefs = void 0;
10902
10903 {
10904 didWarnAboutBadClass = {};
10905 didWarnAboutGetDerivedStateOnFunctionalComponent = {};
10906 didWarnAboutStatelessRefs = {};
10907 }
10908
10909 var ReactFiberBeginWork = function (config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber) {
10910 var shouldSetTextContent = config.shouldSetTextContent,
10911 shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree;
10912 var pushHostContext = hostContext.pushHostContext,
10913 pushHostContainer = hostContext.pushHostContainer;
10914 var pushProvider = newContext.pushProvider;
10915 var getMaskedContext = legacyContext.getMaskedContext,
10916 getUnmaskedContext = legacyContext.getUnmaskedContext,
10917 hasLegacyContextChanged = legacyContext.hasContextChanged,
10918 pushLegacyContextProvider = legacyContext.pushContextProvider,
10919 pushTopLevelContextObject = legacyContext.pushTopLevelContextObject,
10920 invalidateContextProvider = legacyContext.invalidateContextProvider;
10921 var enterHydrationState = hydrationContext.enterHydrationState,
10922 resetHydrationState = hydrationContext.resetHydrationState,
10923 tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance;
10924
10925 var _ReactFiberClassCompo = ReactFiberClassComponent(legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState),
10926 adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance,
10927 callGetDerivedStateFromProps = _ReactFiberClassCompo.callGetDerivedStateFromProps,
10928 constructClassInstance = _ReactFiberClassCompo.constructClassInstance,
10929 mountClassInstance = _ReactFiberClassCompo.mountClassInstance,
10930 resumeMountClassInstance = _ReactFiberClassCompo.resumeMountClassInstance,
10931 updateClassInstance = _ReactFiberClassCompo.updateClassInstance;
10932
10933 // TODO: Remove this and use reconcileChildrenAtExpirationTime directly.
10934
10935
10936 function reconcileChildren(current, workInProgress, nextChildren) {
10937 reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, workInProgress.expirationTime);
10938 }
10939
10940 function reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime) {
10941 if (current === null) {
10942 // If this is a fresh new component that hasn't been rendered yet, we
10943 // won't update its child set by applying minimal side-effects. Instead,
10944 // we will add them all to the child before it gets rendered. That means
10945 // we can optimize this reconciliation pass by not tracking side-effects.
10946 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
10947 } else {
10948 // If the current child is the same as the work in progress, it means that
10949 // we haven't yet started any work on these children. Therefore, we use
10950 // the clone algorithm to create a copy of all the current children.
10951
10952 // If we had any progressed work already, that is invalid at this point so
10953 // let's throw it out.
10954 workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime);
10955 }
10956 }
10957
10958 function updateForwardRef(current, workInProgress) {
10959 var render = workInProgress.type.render;
10960 var nextChildren = render(workInProgress.pendingProps, workInProgress.ref);
10961 reconcileChildren(current, workInProgress, nextChildren);
10962 memoizeProps(workInProgress, nextChildren);
10963 return workInProgress.child;
10964 }
10965
10966 function updateFragment(current, workInProgress) {
10967 var nextChildren = workInProgress.pendingProps;
10968 if (hasLegacyContextChanged()) {
10969 // Normally we can bail out on props equality but if context has changed
10970 // we don't do the bailout and we have to reuse existing props instead.
10971 } else if (workInProgress.memoizedProps === nextChildren) {
10972 return bailoutOnAlreadyFinishedWork(current, workInProgress);
10973 }
10974 reconcileChildren(current, workInProgress, nextChildren);
10975 memoizeProps(workInProgress, nextChildren);
10976 return workInProgress.child;
10977 }
10978
10979 function updateMode(current, workInProgress) {
10980 var nextChildren = workInProgress.pendingProps.children;
10981 if (hasLegacyContextChanged()) {
10982 // Normally we can bail out on props equality but if context has changed
10983 // we don't do the bailout and we have to reuse existing props instead.
10984 } else if (nextChildren === null || workInProgress.memoizedProps === nextChildren) {
10985 return bailoutOnAlreadyFinishedWork(current, workInProgress);
10986 }
10987 reconcileChildren(current, workInProgress, nextChildren);
10988 memoizeProps(workInProgress, nextChildren);
10989 return workInProgress.child;
10990 }
10991
10992 function markRef(current, workInProgress) {
10993 var ref = workInProgress.ref;
10994 if (current === null && ref !== null || current !== null && current.ref !== ref) {
10995 // Schedule a Ref effect
10996 workInProgress.effectTag |= Ref;
10997 }
10998 }
10999
11000 function updateFunctionalComponent(current, workInProgress) {
11001 var fn = workInProgress.type;
11002 var nextProps = workInProgress.pendingProps;
11003
11004 if (hasLegacyContextChanged()) {
11005 // Normally we can bail out on props equality but if context has changed
11006 // we don't do the bailout and we have to reuse existing props instead.
11007 } else {
11008 if (workInProgress.memoizedProps === nextProps) {
11009 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11010 }
11011 // TODO: consider bringing fn.shouldComponentUpdate() back.
11012 // It used to be here.
11013 }
11014
11015 var unmaskedContext = getUnmaskedContext(workInProgress);
11016 var context = getMaskedContext(workInProgress, unmaskedContext);
11017
11018 var nextChildren = void 0;
11019
11020 {
11021 ReactCurrentOwner.current = workInProgress;
11022 ReactDebugCurrentFiber.setCurrentPhase('render');
11023 nextChildren = fn(nextProps, context);
11024 ReactDebugCurrentFiber.setCurrentPhase(null);
11025 }
11026 // React DevTools reads this flag.
11027 workInProgress.effectTag |= PerformedWork;
11028 reconcileChildren(current, workInProgress, nextChildren);
11029 memoizeProps(workInProgress, nextProps);
11030 return workInProgress.child;
11031 }
11032
11033 function updateClassComponent(current, workInProgress, renderExpirationTime) {
11034 // Push context providers early to prevent context stack mismatches.
11035 // During mounting we don't know the child context yet as the instance doesn't exist.
11036 // We will invalidate the child context in finishClassComponent() right after rendering.
11037 var hasContext = pushLegacyContextProvider(workInProgress);
11038 var shouldUpdate = void 0;
11039 if (current === null) {
11040 if (workInProgress.stateNode === null) {
11041 // In the initial pass we might need to construct the instance.
11042 constructClassInstance(workInProgress, workInProgress.pendingProps);
11043 mountClassInstance(workInProgress, renderExpirationTime);
11044
11045 shouldUpdate = true;
11046 } else {
11047 // In a resume, we'll already have an instance we can reuse.
11048 shouldUpdate = resumeMountClassInstance(workInProgress, renderExpirationTime);
11049 }
11050 } else {
11051 shouldUpdate = updateClassInstance(current, workInProgress, renderExpirationTime);
11052 }
11053
11054 // We processed the update queue inside updateClassInstance. It may have
11055 // included some errors that were dispatched during the commit phase.
11056 // TODO: Refactor class components so this is less awkward.
11057 var didCaptureError = false;
11058 var updateQueue = workInProgress.updateQueue;
11059 if (updateQueue !== null && updateQueue.capturedValues !== null) {
11060 shouldUpdate = true;
11061 didCaptureError = true;
11062 }
11063 return finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime);
11064 }
11065
11066 function finishClassComponent(current, workInProgress, shouldUpdate, hasContext, didCaptureError, renderExpirationTime) {
11067 // Refs should update even if shouldComponentUpdate returns false
11068 markRef(current, workInProgress);
11069
11070 if (!shouldUpdate && !didCaptureError) {
11071 // Context providers should defer to sCU for rendering
11072 if (hasContext) {
11073 invalidateContextProvider(workInProgress, false);
11074 }
11075
11076 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11077 }
11078
11079 var ctor = workInProgress.type;
11080 var instance = workInProgress.stateNode;
11081
11082 // Rerender
11083 ReactCurrentOwner.current = workInProgress;
11084 var nextChildren = void 0;
11085 if (didCaptureError && (!enableGetDerivedStateFromCatch || typeof ctor.getDerivedStateFromCatch !== 'function')) {
11086 // If we captured an error, but getDerivedStateFrom catch is not defined,
11087 // unmount all the children. componentDidCatch will schedule an update to
11088 // re-render a fallback. This is temporary until we migrate everyone to
11089 // the new API.
11090 // TODO: Warn in a future release.
11091 nextChildren = null;
11092 } else {
11093 {
11094 ReactDebugCurrentFiber.setCurrentPhase('render');
11095 nextChildren = instance.render();
11096 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
11097 instance.render();
11098 }
11099 ReactDebugCurrentFiber.setCurrentPhase(null);
11100 }
11101 }
11102
11103 // React DevTools reads this flag.
11104 workInProgress.effectTag |= PerformedWork;
11105 if (didCaptureError) {
11106 // If we're recovering from an error, reconcile twice: first to delete
11107 // all the existing children.
11108 reconcileChildrenAtExpirationTime(current, workInProgress, null, renderExpirationTime);
11109 workInProgress.child = null;
11110 // Now we can continue reconciling like normal. This has the effect of
11111 // remounting all children regardless of whether their their
11112 // identity matches.
11113 }
11114 reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime);
11115 // Memoize props and state using the values we just used to render.
11116 // TODO: Restructure so we never read values from the instance.
11117 memoizeState(workInProgress, instance.state);
11118 memoizeProps(workInProgress, instance.props);
11119
11120 // The context might have changed so we need to recalculate it.
11121 if (hasContext) {
11122 invalidateContextProvider(workInProgress, true);
11123 }
11124
11125 return workInProgress.child;
11126 }
11127
11128 function pushHostRootContext(workInProgress) {
11129 var root = workInProgress.stateNode;
11130 if (root.pendingContext) {
11131 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
11132 } else if (root.context) {
11133 // Should always be set
11134 pushTopLevelContextObject(workInProgress, root.context, false);
11135 }
11136 pushHostContainer(workInProgress, root.containerInfo);
11137 }
11138
11139 function updateHostRoot(current, workInProgress, renderExpirationTime) {
11140 pushHostRootContext(workInProgress);
11141 var updateQueue = workInProgress.updateQueue;
11142 if (updateQueue !== null) {
11143 var prevState = workInProgress.memoizedState;
11144 var state = processUpdateQueue(current, workInProgress, updateQueue, null, null, renderExpirationTime);
11145 memoizeState(workInProgress, state);
11146 updateQueue = workInProgress.updateQueue;
11147
11148 var element = void 0;
11149 if (updateQueue !== null && updateQueue.capturedValues !== null) {
11150 // There's an uncaught error. Unmount the whole root.
11151 element = null;
11152 } else if (prevState === state) {
11153 // If the state is the same as before, that's a bailout because we had
11154 // no work that expires at this time.
11155 resetHydrationState();
11156 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11157 } else {
11158 element = state.element;
11159 }
11160 var root = workInProgress.stateNode;
11161 if ((current === null || current.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
11162 // If we don't have any current children this might be the first pass.
11163 // We always try to hydrate. If this isn't a hydration pass there won't
11164 // be any children to hydrate which is effectively the same thing as
11165 // not hydrating.
11166
11167 // This is a bit of a hack. We track the host root as a placement to
11168 // know that we're currently in a mounting state. That way isMounted
11169 // works as expected. We must reset this before committing.
11170 // TODO: Delete this when we delete isMounted and findDOMNode.
11171 workInProgress.effectTag |= Placement;
11172
11173 // Ensure that children mount into this root without tracking
11174 // side-effects. This ensures that we don't store Placement effects on
11175 // nodes that will be hydrated.
11176 workInProgress.child = mountChildFibers(workInProgress, null, element, renderExpirationTime);
11177 } else {
11178 // Otherwise reset hydration state in case we aborted and resumed another
11179 // root.
11180 resetHydrationState();
11181 reconcileChildren(current, workInProgress, element);
11182 }
11183 memoizeState(workInProgress, state);
11184 return workInProgress.child;
11185 }
11186 resetHydrationState();
11187 // If there is no update queue, that's a bailout because the root has no props.
11188 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11189 }
11190
11191 function updateHostComponent(current, workInProgress, renderExpirationTime) {
11192 pushHostContext(workInProgress);
11193
11194 if (current === null) {
11195 tryToClaimNextHydratableInstance(workInProgress);
11196 }
11197
11198 var type = workInProgress.type;
11199 var memoizedProps = workInProgress.memoizedProps;
11200 var nextProps = workInProgress.pendingProps;
11201 var prevProps = current !== null ? current.memoizedProps : null;
11202
11203 if (hasLegacyContextChanged()) {
11204 // Normally we can bail out on props equality but if context has changed
11205 // we don't do the bailout and we have to reuse existing props instead.
11206 } else if (memoizedProps === nextProps) {
11207 var isHidden = workInProgress.mode & AsyncMode && shouldDeprioritizeSubtree(type, nextProps);
11208 if (isHidden) {
11209 // Before bailing out, make sure we've deprioritized a hidden component.
11210 workInProgress.expirationTime = Never;
11211 }
11212 if (!isHidden || renderExpirationTime !== Never) {
11213 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11214 }
11215 // If we're rendering a hidden node at hidden priority, don't bailout. The
11216 // parent is complete, but the children may not be.
11217 }
11218
11219 var nextChildren = nextProps.children;
11220 var isDirectTextChild = shouldSetTextContent(type, nextProps);
11221
11222 if (isDirectTextChild) {
11223 // We special case a direct text child of a host node. This is a common
11224 // case. We won't handle it as a reified child. We will instead handle
11225 // this in the host environment that also have access to this prop. That
11226 // avoids allocating another HostText fiber and traversing it.
11227 nextChildren = null;
11228 } else if (prevProps && shouldSetTextContent(type, prevProps)) {
11229 // If we're switching from a direct text child to a normal child, or to
11230 // empty, we need to schedule the text content to be reset.
11231 workInProgress.effectTag |= ContentReset;
11232 }
11233
11234 markRef(current, workInProgress);
11235
11236 // Check the host config to see if the children are offscreen/hidden.
11237 if (renderExpirationTime !== Never && workInProgress.mode & AsyncMode && shouldDeprioritizeSubtree(type, nextProps)) {
11238 // Down-prioritize the children.
11239 workInProgress.expirationTime = Never;
11240 // Bailout and come back to this fiber later.
11241 workInProgress.memoizedProps = nextProps;
11242 return null;
11243 }
11244
11245 reconcileChildren(current, workInProgress, nextChildren);
11246 memoizeProps(workInProgress, nextProps);
11247 return workInProgress.child;
11248 }
11249
11250 function updateHostText(current, workInProgress) {
11251 if (current === null) {
11252 tryToClaimNextHydratableInstance(workInProgress);
11253 }
11254 var nextProps = workInProgress.pendingProps;
11255 memoizeProps(workInProgress, nextProps);
11256 // Nothing to do here. This is terminal. We'll do the completion step
11257 // immediately after.
11258 return null;
11259 }
11260
11261 function mountIndeterminateComponent(current, workInProgress, renderExpirationTime) {
11262 !(current === null) ? invariant(false, 'An indeterminate component should never have mounted. This error is likely caused by a bug in React. Please file an issue.') : void 0;
11263 var fn = workInProgress.type;
11264 var props = workInProgress.pendingProps;
11265 var unmaskedContext = getUnmaskedContext(workInProgress);
11266 var context = getMaskedContext(workInProgress, unmaskedContext);
11267
11268 var value = void 0;
11269
11270 {
11271 if (fn.prototype && typeof fn.prototype.render === 'function') {
11272 var componentName = getComponentName(workInProgress) || 'Unknown';
11273
11274 if (!didWarnAboutBadClass[componentName]) {
11275 warning(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
11276 didWarnAboutBadClass[componentName] = true;
11277 }
11278 }
11279 ReactCurrentOwner.current = workInProgress;
11280 value = fn(props, context);
11281 }
11282 // React DevTools reads this flag.
11283 workInProgress.effectTag |= PerformedWork;
11284
11285 if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
11286 var Component = workInProgress.type;
11287
11288 // Proceed under the assumption that this is a class instance
11289 workInProgress.tag = ClassComponent;
11290
11291 workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
11292
11293 if (typeof Component.getDerivedStateFromProps === 'function') {
11294 var partialState = callGetDerivedStateFromProps(workInProgress, value, props, workInProgress.memoizedState);
11295
11296 if (partialState !== null && partialState !== undefined) {
11297 workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState);
11298 }
11299 }
11300
11301 // Push context providers early to prevent context stack mismatches.
11302 // During mounting we don't know the child context yet as the instance doesn't exist.
11303 // We will invalidate the child context in finishClassComponent() right after rendering.
11304 var hasContext = pushLegacyContextProvider(workInProgress);
11305 adoptClassInstance(workInProgress, value);
11306 mountClassInstance(workInProgress, renderExpirationTime);
11307 return finishClassComponent(current, workInProgress, true, hasContext, false, renderExpirationTime);
11308 } else {
11309 // Proceed under the assumption that this is a functional component
11310 workInProgress.tag = FunctionalComponent;
11311 {
11312 var _Component = workInProgress.type;
11313
11314 if (_Component) {
11315 !!_Component.childContextTypes ? warning(false, '%s(...): childContextTypes cannot be defined on a functional component.', _Component.displayName || _Component.name || 'Component') : void 0;
11316 }
11317 if (workInProgress.ref !== null) {
11318 var info = '';
11319 var ownerName = ReactDebugCurrentFiber.getCurrentFiberOwnerName();
11320 if (ownerName) {
11321 info += '\n\nCheck the render method of `' + ownerName + '`.';
11322 }
11323
11324 var warningKey = ownerName || workInProgress._debugID || '';
11325 var debugSource = workInProgress._debugSource;
11326 if (debugSource) {
11327 warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
11328 }
11329 if (!didWarnAboutStatelessRefs[warningKey]) {
11330 didWarnAboutStatelessRefs[warningKey] = true;
11331 warning(false, 'Stateless function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s%s', info, ReactDebugCurrentFiber.getCurrentFiberStackAddendum());
11332 }
11333 }
11334
11335 if (typeof fn.getDerivedStateFromProps === 'function') {
11336 var _componentName = getComponentName(workInProgress) || 'Unknown';
11337
11338 if (!didWarnAboutGetDerivedStateOnFunctionalComponent[_componentName]) {
11339 warning(false, '%s: Stateless functional components do not support getDerivedStateFromProps.', _componentName);
11340 didWarnAboutGetDerivedStateOnFunctionalComponent[_componentName] = true;
11341 }
11342 }
11343 }
11344 reconcileChildren(current, workInProgress, value);
11345 memoizeProps(workInProgress, props);
11346 return workInProgress.child;
11347 }
11348 }
11349
11350 function updateCallComponent(current, workInProgress, renderExpirationTime) {
11351 var nextProps = workInProgress.pendingProps;
11352 if (hasLegacyContextChanged()) {
11353 // Normally we can bail out on props equality but if context has changed
11354 // we don't do the bailout and we have to reuse existing props instead.
11355 } else if (workInProgress.memoizedProps === nextProps) {
11356 nextProps = workInProgress.memoizedProps;
11357 // TODO: When bailing out, we might need to return the stateNode instead
11358 // of the child. To check it for work.
11359 // return bailoutOnAlreadyFinishedWork(current, workInProgress);
11360 }
11361
11362 var nextChildren = nextProps.children;
11363
11364 // The following is a fork of reconcileChildrenAtExpirationTime but using
11365 // stateNode to store the child.
11366 if (current === null) {
11367 workInProgress.stateNode = mountChildFibers(workInProgress, workInProgress.stateNode, nextChildren, renderExpirationTime);
11368 } else {
11369 workInProgress.stateNode = reconcileChildFibers(workInProgress, current.stateNode, nextChildren, renderExpirationTime);
11370 }
11371
11372 memoizeProps(workInProgress, nextProps);
11373 // This doesn't take arbitrary time so we could synchronously just begin
11374 // eagerly do the work of workInProgress.child as an optimization.
11375 return workInProgress.stateNode;
11376 }
11377
11378 function updatePortalComponent(current, workInProgress, renderExpirationTime) {
11379 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
11380 var nextChildren = workInProgress.pendingProps;
11381 if (hasLegacyContextChanged()) {
11382 // Normally we can bail out on props equality but if context has changed
11383 // we don't do the bailout and we have to reuse existing props instead.
11384 } else if (workInProgress.memoizedProps === nextChildren) {
11385 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11386 }
11387
11388 if (current === null) {
11389 // Portals are special because we don't append the children during mount
11390 // but at commit. Therefore we need to track insertions which the normal
11391 // flow doesn't do during mount. This doesn't happen at the root because
11392 // the root always starts with a "current" with a null child.
11393 // TODO: Consider unifying this with how the root works.
11394 workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
11395 memoizeProps(workInProgress, nextChildren);
11396 } else {
11397 reconcileChildren(current, workInProgress, nextChildren);
11398 memoizeProps(workInProgress, nextChildren);
11399 }
11400 return workInProgress.child;
11401 }
11402
11403 function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
11404 var fiber = workInProgress.child;
11405 if (fiber !== null) {
11406 // Set the return pointer of the child to the work-in-progress fiber.
11407 fiber['return'] = workInProgress;
11408 }
11409 while (fiber !== null) {
11410 var nextFiber = void 0;
11411 // Visit this fiber.
11412 switch (fiber.tag) {
11413 case ContextConsumer:
11414 // Check if the context matches.
11415 var observedBits = fiber.stateNode | 0;
11416 if (fiber.type === context && (observedBits & changedBits) !== 0) {
11417 // Update the expiration time of all the ancestors, including
11418 // the alternates.
11419 var node = fiber;
11420 while (node !== null) {
11421 var alternate = node.alternate;
11422 if (node.expirationTime === NoWork || node.expirationTime > renderExpirationTime) {
11423 node.expirationTime = renderExpirationTime;
11424 if (alternate !== null && (alternate.expirationTime === NoWork || alternate.expirationTime > renderExpirationTime)) {
11425 alternate.expirationTime = renderExpirationTime;
11426 }
11427 } else if (alternate !== null && (alternate.expirationTime === NoWork || alternate.expirationTime > renderExpirationTime)) {
11428 alternate.expirationTime = renderExpirationTime;
11429 } else {
11430 // Neither alternate was updated, which means the rest of the
11431 // ancestor path already has sufficient priority.
11432 break;
11433 }
11434 node = node['return'];
11435 }
11436 // Don't scan deeper than a matching consumer. When we render the
11437 // consumer, we'll continue scanning from that point. This way the
11438 // scanning work is time-sliced.
11439 nextFiber = null;
11440 } else {
11441 // Traverse down.
11442 nextFiber = fiber.child;
11443 }
11444 break;
11445 case ContextProvider:
11446 // Don't scan deeper if this is a matching provider
11447 nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
11448 break;
11449 default:
11450 // Traverse down.
11451 nextFiber = fiber.child;
11452 break;
11453 }
11454 if (nextFiber !== null) {
11455 // Set the return pointer of the child to the work-in-progress fiber.
11456 nextFiber['return'] = fiber;
11457 } else {
11458 // No child. Traverse to next sibling.
11459 nextFiber = fiber;
11460 while (nextFiber !== null) {
11461 if (nextFiber === workInProgress) {
11462 // We're back to the root of this subtree. Exit.
11463 nextFiber = null;
11464 break;
11465 }
11466 var sibling = nextFiber.sibling;
11467 if (sibling !== null) {
11468 nextFiber = sibling;
11469 break;
11470 }
11471 // No more siblings. Traverse up.
11472 nextFiber = nextFiber['return'];
11473 }
11474 }
11475 fiber = nextFiber;
11476 }
11477 }
11478
11479 function updateContextProvider(current, workInProgress, renderExpirationTime) {
11480 var providerType = workInProgress.type;
11481 var context = providerType._context;
11482
11483 var newProps = workInProgress.pendingProps;
11484 var oldProps = workInProgress.memoizedProps;
11485
11486 if (hasLegacyContextChanged()) {
11487 // Normally we can bail out on props equality but if context has changed
11488 // we don't do the bailout and we have to reuse existing props instead.
11489 } else if (oldProps === newProps) {
11490 workInProgress.stateNode = 0;
11491 pushProvider(workInProgress);
11492 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11493 }
11494
11495 var newValue = newProps.value;
11496 workInProgress.memoizedProps = newProps;
11497
11498 var changedBits = void 0;
11499 if (oldProps === null) {
11500 // Initial render
11501 changedBits = MAX_SIGNED_31_BIT_INT;
11502 } else {
11503 if (oldProps.value === newProps.value) {
11504 // No change. Bailout early if children are the same.
11505 if (oldProps.children === newProps.children) {
11506 workInProgress.stateNode = 0;
11507 pushProvider(workInProgress);
11508 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11509 }
11510 changedBits = 0;
11511 } else {
11512 var oldValue = oldProps.value;
11513 // Use Object.is to compare the new context value to the old value.
11514 // Inlined Object.is polyfill.
11515 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
11516 if (oldValue === newValue && (oldValue !== 0 || 1 / oldValue === 1 / newValue) || oldValue !== oldValue && newValue !== newValue // eslint-disable-line no-self-compare
11517 ) {
11518 // No change. Bailout early if children are the same.
11519 if (oldProps.children === newProps.children) {
11520 workInProgress.stateNode = 0;
11521 pushProvider(workInProgress);
11522 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11523 }
11524 changedBits = 0;
11525 } else {
11526 changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
11527 {
11528 !((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits) ? warning(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
11529 }
11530 changedBits |= 0;
11531
11532 if (changedBits === 0) {
11533 // No change. Bailout early if children are the same.
11534 if (oldProps.children === newProps.children) {
11535 workInProgress.stateNode = 0;
11536 pushProvider(workInProgress);
11537 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11538 }
11539 } else {
11540 propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
11541 }
11542 }
11543 }
11544 }
11545
11546 workInProgress.stateNode = changedBits;
11547 pushProvider(workInProgress);
11548
11549 var newChildren = newProps.children;
11550 reconcileChildren(current, workInProgress, newChildren);
11551 return workInProgress.child;
11552 }
11553
11554 function updateContextConsumer(current, workInProgress, renderExpirationTime) {
11555 var context = workInProgress.type;
11556 var newProps = workInProgress.pendingProps;
11557 var oldProps = workInProgress.memoizedProps;
11558
11559 var newValue = context._currentValue;
11560 var changedBits = context._changedBits;
11561
11562 if (hasLegacyContextChanged()) {
11563 // Normally we can bail out on props equality but if context has changed
11564 // we don't do the bailout and we have to reuse existing props instead.
11565 } else if (changedBits === 0 && oldProps === newProps) {
11566 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11567 }
11568 workInProgress.memoizedProps = newProps;
11569
11570 var observedBits = newProps.unstable_observedBits;
11571 if (observedBits === undefined || observedBits === null) {
11572 // Subscribe to all changes by default
11573 observedBits = MAX_SIGNED_31_BIT_INT;
11574 }
11575 // Store the observedBits on the fiber's stateNode for quick access.
11576 workInProgress.stateNode = observedBits;
11577
11578 if ((changedBits & observedBits) !== 0) {
11579 // Context change propagation stops at matching consumers, for time-
11580 // slicing. Continue the propagation here.
11581 propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
11582 } else if (oldProps === newProps) {
11583 // Skip over a memoized parent with a bitmask bailout even
11584 // if we began working on it because of a deeper matching child.
11585 return bailoutOnAlreadyFinishedWork(current, workInProgress);
11586 }
11587 // There is no bailout on `children` equality because we expect people
11588 // to often pass a bound method as a child, but it may reference
11589 // `this.state` or `this.props` (and thus needs to re-render on `setState`).
11590
11591 var render = newProps.children;
11592
11593 {
11594 !(typeof render === 'function') ? warning(false, 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.') : void 0;
11595 }
11596
11597 var newChildren = render(newValue);
11598 reconcileChildren(current, workInProgress, newChildren);
11599 return workInProgress.child;
11600 }
11601
11602 /*
11603 function reuseChildrenEffects(returnFiber : Fiber, firstChild : Fiber) {
11604 let child = firstChild;
11605 do {
11606 // Ensure that the first and last effect of the parent corresponds
11607 // to the children's first and last effect.
11608 if (!returnFiber.firstEffect) {
11609 returnFiber.firstEffect = child.firstEffect;
11610 }
11611 if (child.lastEffect) {
11612 if (returnFiber.lastEffect) {
11613 returnFiber.lastEffect.nextEffect = child.firstEffect;
11614 }
11615 returnFiber.lastEffect = child.lastEffect;
11616 }
11617 } while (child = child.sibling);
11618 }
11619 */
11620
11621 function bailoutOnAlreadyFinishedWork(current, workInProgress) {
11622 cancelWorkTimer(workInProgress);
11623
11624 // TODO: We should ideally be able to bail out early if the children have no
11625 // more work to do. However, since we don't have a separation of this
11626 // Fiber's priority and its children yet - we don't know without doing lots
11627 // of the same work we do anyway. Once we have that separation we can just
11628 // bail out here if the children has no more work at this priority level.
11629 // if (workInProgress.priorityOfChildren <= priorityLevel) {
11630 // // If there are side-effects in these children that have not yet been
11631 // // committed we need to ensure that they get properly transferred up.
11632 // if (current && current.child !== workInProgress.child) {
11633 // reuseChildrenEffects(workInProgress, child);
11634 // }
11635 // return null;
11636 // }
11637
11638 cloneChildFibers(current, workInProgress);
11639 return workInProgress.child;
11640 }
11641
11642 function bailoutOnLowPriority(current, workInProgress) {
11643 cancelWorkTimer(workInProgress);
11644
11645 // TODO: Handle HostComponent tags here as well and call pushHostContext()?
11646 // See PR 8590 discussion for context
11647 switch (workInProgress.tag) {
11648 case HostRoot:
11649 pushHostRootContext(workInProgress);
11650 break;
11651 case ClassComponent:
11652 pushLegacyContextProvider(workInProgress);
11653 break;
11654 case HostPortal:
11655 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
11656 break;
11657 case ContextProvider:
11658 pushProvider(workInProgress);
11659 break;
11660 }
11661 // TODO: What if this is currently in progress?
11662 // How can that happen? How is this not being cloned?
11663 return null;
11664 }
11665
11666 // TODO: Delete memoizeProps/State and move to reconcile/bailout instead
11667 function memoizeProps(workInProgress, nextProps) {
11668 workInProgress.memoizedProps = nextProps;
11669 }
11670
11671 function memoizeState(workInProgress, nextState) {
11672 workInProgress.memoizedState = nextState;
11673 // Don't reset the updateQueue, in case there are pending updates. Resetting
11674 // is handled by processUpdateQueue.
11675 }
11676
11677 function beginWork(current, workInProgress, renderExpirationTime) {
11678 if (workInProgress.expirationTime === NoWork || workInProgress.expirationTime > renderExpirationTime) {
11679 return bailoutOnLowPriority(current, workInProgress);
11680 }
11681
11682 switch (workInProgress.tag) {
11683 case IndeterminateComponent:
11684 return mountIndeterminateComponent(current, workInProgress, renderExpirationTime);
11685 case FunctionalComponent:
11686 return updateFunctionalComponent(current, workInProgress);
11687 case ClassComponent:
11688 return updateClassComponent(current, workInProgress, renderExpirationTime);
11689 case HostRoot:
11690 return updateHostRoot(current, workInProgress, renderExpirationTime);
11691 case HostComponent:
11692 return updateHostComponent(current, workInProgress, renderExpirationTime);
11693 case HostText:
11694 return updateHostText(current, workInProgress);
11695 case CallHandlerPhase:
11696 // This is a restart. Reset the tag to the initial phase.
11697 workInProgress.tag = CallComponent;
11698 // Intentionally fall through since this is now the same.
11699 case CallComponent:
11700 return updateCallComponent(current, workInProgress, renderExpirationTime);
11701 case ReturnComponent:
11702 // A return component is just a placeholder, we can just run through the
11703 // next one immediately.
11704 return null;
11705 case HostPortal:
11706 return updatePortalComponent(current, workInProgress, renderExpirationTime);
11707 case ForwardRef:
11708 return updateForwardRef(current, workInProgress);
11709 case Fragment:
11710 return updateFragment(current, workInProgress);
11711 case Mode:
11712 return updateMode(current, workInProgress);
11713 case ContextProvider:
11714 return updateContextProvider(current, workInProgress, renderExpirationTime);
11715 case ContextConsumer:
11716 return updateContextConsumer(current, workInProgress, renderExpirationTime);
11717 default:
11718 invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
11719 }
11720 }
11721
11722 return {
11723 beginWork: beginWork
11724 };
11725 };
11726
11727 var ReactFiberCompleteWork = function (config, hostContext, legacyContext, newContext, hydrationContext) {
11728 var createInstance = config.createInstance,
11729 createTextInstance = config.createTextInstance,
11730 appendInitialChild = config.appendInitialChild,
11731 finalizeInitialChildren = config.finalizeInitialChildren,
11732 prepareUpdate = config.prepareUpdate,
11733 mutation = config.mutation,
11734 persistence = config.persistence;
11735 var getRootHostContainer = hostContext.getRootHostContainer,
11736 popHostContext = hostContext.popHostContext,
11737 getHostContext = hostContext.getHostContext,
11738 popHostContainer = hostContext.popHostContainer;
11739 var popLegacyContextProvider = legacyContext.popContextProvider,
11740 popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject;
11741 var popProvider = newContext.popProvider;
11742 var prepareToHydrateHostInstance = hydrationContext.prepareToHydrateHostInstance,
11743 prepareToHydrateHostTextInstance = hydrationContext.prepareToHydrateHostTextInstance,
11744 popHydrationState = hydrationContext.popHydrationState;
11745
11746
11747 function markUpdate(workInProgress) {
11748 // Tag the fiber with an update effect. This turns a Placement into
11749 // a PlacementAndUpdate.
11750 workInProgress.effectTag |= Update;
11751 }
11752
11753 function markRef(workInProgress) {
11754 workInProgress.effectTag |= Ref;
11755 }
11756
11757 function appendAllReturns(returns, workInProgress) {
11758 var node = workInProgress.stateNode;
11759 if (node) {
11760 node['return'] = workInProgress;
11761 }
11762 while (node !== null) {
11763 if (node.tag === HostComponent || node.tag === HostText || node.tag === HostPortal) {
11764 invariant(false, 'A call cannot have host component children.');
11765 } else if (node.tag === ReturnComponent) {
11766 returns.push(node.pendingProps.value);
11767 } else if (node.child !== null) {
11768 node.child['return'] = node;
11769 node = node.child;
11770 continue;
11771 }
11772 while (node.sibling === null) {
11773 if (node['return'] === null || node['return'] === workInProgress) {
11774 return;
11775 }
11776 node = node['return'];
11777 }
11778 node.sibling['return'] = node['return'];
11779 node = node.sibling;
11780 }
11781 }
11782
11783 function moveCallToHandlerPhase(current, workInProgress, renderExpirationTime) {
11784 var props = workInProgress.memoizedProps;
11785 !props ? invariant(false, 'Should be resolved by now. This error is likely caused by a bug in React. Please file an issue.') : void 0;
11786
11787 // First step of the call has completed. Now we need to do the second.
11788 // TODO: It would be nice to have a multi stage call represented by a
11789 // single component, or at least tail call optimize nested ones. Currently
11790 // that requires additional fields that we don't want to add to the fiber.
11791 // So this requires nested handlers.
11792 // Note: This doesn't mutate the alternate node. I don't think it needs to
11793 // since this stage is reset for every pass.
11794 workInProgress.tag = CallHandlerPhase;
11795
11796 // Build up the returns.
11797 // TODO: Compare this to a generator or opaque helpers like Children.
11798 var returns = [];
11799 appendAllReturns(returns, workInProgress);
11800 var fn = props.handler;
11801 var childProps = props.props;
11802 var nextChildren = fn(childProps, returns);
11803
11804 var currentFirstChild = current !== null ? current.child : null;
11805 workInProgress.child = reconcileChildFibers(workInProgress, currentFirstChild, nextChildren, renderExpirationTime);
11806 return workInProgress.child;
11807 }
11808
11809 function appendAllChildren(parent, workInProgress) {
11810 // We only have the top Fiber that was created but we need recurse down its
11811 // children to find all the terminal nodes.
11812 var node = workInProgress.child;
11813 while (node !== null) {
11814 if (node.tag === HostComponent || node.tag === HostText) {
11815 appendInitialChild(parent, node.stateNode);
11816 } else if (node.tag === HostPortal) {
11817 // If we have a portal child, then we don't want to traverse
11818 // down its children. Instead, we'll get insertions from each child in
11819 // the portal directly.
11820 } else if (node.child !== null) {
11821 node.child['return'] = node;
11822 node = node.child;
11823 continue;
11824 }
11825 if (node === workInProgress) {
11826 return;
11827 }
11828 while (node.sibling === null) {
11829 if (node['return'] === null || node['return'] === workInProgress) {
11830 return;
11831 }
11832 node = node['return'];
11833 }
11834 node.sibling['return'] = node['return'];
11835 node = node.sibling;
11836 }
11837 }
11838
11839 var updateHostContainer = void 0;
11840 var updateHostComponent = void 0;
11841 var updateHostText = void 0;
11842 if (mutation) {
11843 if (enableMutatingReconciler) {
11844 // Mutation mode
11845 updateHostContainer = function (workInProgress) {
11846 // Noop
11847 };
11848 updateHostComponent = function (current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance, currentHostContext) {
11849 // TODO: Type this specific to this type of component.
11850 workInProgress.updateQueue = updatePayload;
11851 // If the update payload indicates that there is a change or if there
11852 // is a new ref we mark this as an update. All the work is done in commitWork.
11853 if (updatePayload) {
11854 markUpdate(workInProgress);
11855 }
11856 };
11857 updateHostText = function (current, workInProgress, oldText, newText) {
11858 // If the text differs, mark it as an update. All the work in done in commitWork.
11859 if (oldText !== newText) {
11860 markUpdate(workInProgress);
11861 }
11862 };
11863 } else {
11864 invariant(false, 'Mutating reconciler is disabled.');
11865 }
11866 } else if (persistence) {
11867 if (enablePersistentReconciler) {
11868 // Persistent host tree mode
11869 var cloneInstance = persistence.cloneInstance,
11870 createContainerChildSet = persistence.createContainerChildSet,
11871 appendChildToContainerChildSet = persistence.appendChildToContainerChildSet,
11872 finalizeContainerChildren = persistence.finalizeContainerChildren;
11873
11874 // An unfortunate fork of appendAllChildren because we have two different parent types.
11875
11876 var appendAllChildrenToContainer = function (containerChildSet, workInProgress) {
11877 // We only have the top Fiber that was created but we need recurse down its
11878 // children to find all the terminal nodes.
11879 var node = workInProgress.child;
11880 while (node !== null) {
11881 if (node.tag === HostComponent || node.tag === HostText) {
11882 appendChildToContainerChildSet(containerChildSet, node.stateNode);
11883 } else if (node.tag === HostPortal) {
11884 // If we have a portal child, then we don't want to traverse
11885 // down its children. Instead, we'll get insertions from each child in
11886 // the portal directly.
11887 } else if (node.child !== null) {
11888 node.child['return'] = node;
11889 node = node.child;
11890 continue;
11891 }
11892 if (node === workInProgress) {
11893 return;
11894 }
11895 while (node.sibling === null) {
11896 if (node['return'] === null || node['return'] === workInProgress) {
11897 return;
11898 }
11899 node = node['return'];
11900 }
11901 node.sibling['return'] = node['return'];
11902 node = node.sibling;
11903 }
11904 };
11905 updateHostContainer = function (workInProgress) {
11906 var portalOrRoot = workInProgress.stateNode;
11907 var childrenUnchanged = workInProgress.firstEffect === null;
11908 if (childrenUnchanged) {
11909 // No changes, just reuse the existing instance.
11910 } else {
11911 var container = portalOrRoot.containerInfo;
11912 var newChildSet = createContainerChildSet(container);
11913 // If children might have changed, we have to add them all to the set.
11914 appendAllChildrenToContainer(newChildSet, workInProgress);
11915 portalOrRoot.pendingChildren = newChildSet;
11916 // Schedule an update on the container to swap out the container.
11917 markUpdate(workInProgress);
11918 finalizeContainerChildren(container, newChildSet);
11919 }
11920 };
11921 updateHostComponent = function (current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance, currentHostContext) {
11922 // If there are no effects associated with this node, then none of our children had any updates.
11923 // This guarantees that we can reuse all of them.
11924 var childrenUnchanged = workInProgress.firstEffect === null;
11925 var currentInstance = current.stateNode;
11926 if (childrenUnchanged && updatePayload === null) {
11927 // No changes, just reuse the existing instance.
11928 // Note that this might release a previous clone.
11929 workInProgress.stateNode = currentInstance;
11930 } else {
11931 var recyclableInstance = workInProgress.stateNode;
11932 var newInstance = cloneInstance(currentInstance, updatePayload, type, oldProps, newProps, workInProgress, childrenUnchanged, recyclableInstance);
11933 if (finalizeInitialChildren(newInstance, type, newProps, rootContainerInstance, currentHostContext)) {
11934 markUpdate(workInProgress);
11935 }
11936 workInProgress.stateNode = newInstance;
11937 if (childrenUnchanged) {
11938 // If there are no other effects in this tree, we need to flag this node as having one.
11939 // Even though we're not going to use it for anything.
11940 // Otherwise parents won't know that there are new children to propagate upwards.
11941 markUpdate(workInProgress);
11942 } else {
11943 // If children might have changed, we have to add them all to the set.
11944 appendAllChildren(newInstance, workInProgress);
11945 }
11946 }
11947 };
11948 updateHostText = function (current, workInProgress, oldText, newText) {
11949 if (oldText !== newText) {
11950 // If the text content differs, we'll create a new text instance for it.
11951 var rootContainerInstance = getRootHostContainer();
11952 var currentHostContext = getHostContext();
11953 workInProgress.stateNode = createTextInstance(newText, rootContainerInstance, currentHostContext, workInProgress);
11954 // We'll have to mark it as having an effect, even though we won't use the effect for anything.
11955 // This lets the parents know that at least one of their children has changed.
11956 markUpdate(workInProgress);
11957 }
11958 };
11959 } else {
11960 invariant(false, 'Persistent reconciler is disabled.');
11961 }
11962 } else {
11963 if (enableNoopReconciler) {
11964 // No host operations
11965 updateHostContainer = function (workInProgress) {
11966 // Noop
11967 };
11968 updateHostComponent = function (current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance, currentHostContext) {
11969 // Noop
11970 };
11971 updateHostText = function (current, workInProgress, oldText, newText) {
11972 // Noop
11973 };
11974 } else {
11975 invariant(false, 'Noop reconciler is disabled.');
11976 }
11977 }
11978
11979 function completeWork(current, workInProgress, renderExpirationTime) {
11980 var newProps = workInProgress.pendingProps;
11981 switch (workInProgress.tag) {
11982 case FunctionalComponent:
11983 return null;
11984 case ClassComponent:
11985 {
11986 // We are leaving this subtree, so pop context if any.
11987 popLegacyContextProvider(workInProgress);
11988
11989 // If this component caught an error, schedule an error log effect.
11990 var instance = workInProgress.stateNode;
11991 var updateQueue = workInProgress.updateQueue;
11992 if (updateQueue !== null && updateQueue.capturedValues !== null) {
11993 workInProgress.effectTag &= ~DidCapture;
11994 if (typeof instance.componentDidCatch === 'function') {
11995 workInProgress.effectTag |= ErrLog;
11996 } else {
11997 // Normally we clear this in the commit phase, but since we did not
11998 // schedule an effect, we need to reset it here.
11999 updateQueue.capturedValues = null;
12000 }
12001 }
12002 return null;
12003 }
12004 case HostRoot:
12005 {
12006 popHostContainer(workInProgress);
12007 popTopLevelLegacyContextObject(workInProgress);
12008 var fiberRoot = workInProgress.stateNode;
12009 if (fiberRoot.pendingContext) {
12010 fiberRoot.context = fiberRoot.pendingContext;
12011 fiberRoot.pendingContext = null;
12012 }
12013 if (current === null || current.child === null) {
12014 // If we hydrated, pop so that we can delete any remaining children
12015 // that weren't hydrated.
12016 popHydrationState(workInProgress);
12017 // This resets the hacky state to fix isMounted before committing.
12018 // TODO: Delete this when we delete isMounted and findDOMNode.
12019 workInProgress.effectTag &= ~Placement;
12020 }
12021 updateHostContainer(workInProgress);
12022
12023 var _updateQueue = workInProgress.updateQueue;
12024 if (_updateQueue !== null && _updateQueue.capturedValues !== null) {
12025 workInProgress.effectTag |= ErrLog;
12026 }
12027 return null;
12028 }
12029 case HostComponent:
12030 {
12031 popHostContext(workInProgress);
12032 var rootContainerInstance = getRootHostContainer();
12033 var type = workInProgress.type;
12034 if (current !== null && workInProgress.stateNode != null) {
12035 // If we have an alternate, that means this is an update and we need to
12036 // schedule a side-effect to do the updates.
12037 var oldProps = current.memoizedProps;
12038 // If we get updated because one of our children updated, we don't
12039 // have newProps so we'll have to reuse them.
12040 // TODO: Split the update API as separate for the props vs. children.
12041 // Even better would be if children weren't special cased at all tho.
12042 var _instance = workInProgress.stateNode;
12043 var currentHostContext = getHostContext();
12044 // TODO: Experiencing an error where oldProps is null. Suggests a host
12045 // component is hitting the resume path. Figure out why. Possibly
12046 // related to `hidden`.
12047 var updatePayload = prepareUpdate(_instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
12048
12049 updateHostComponent(current, workInProgress, updatePayload, type, oldProps, newProps, rootContainerInstance, currentHostContext);
12050
12051 if (current.ref !== workInProgress.ref) {
12052 markRef(workInProgress);
12053 }
12054 } else {
12055 if (!newProps) {
12056 !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
12057 // This can happen when we abort work.
12058 return null;
12059 }
12060
12061 var _currentHostContext = getHostContext();
12062 // TODO: Move createInstance to beginWork and keep it on a context
12063 // "stack" as the parent. Then append children as we go in beginWork
12064 // or completeWork depending on we want to add then top->down or
12065 // bottom->up. Top->down is faster in IE11.
12066 var wasHydrated = popHydrationState(workInProgress);
12067 if (wasHydrated) {
12068 // TODO: Move this and createInstance step into the beginPhase
12069 // to consolidate.
12070 if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, _currentHostContext)) {
12071 // If changes to the hydrated node needs to be applied at the
12072 // commit-phase we mark this as such.
12073 markUpdate(workInProgress);
12074 }
12075 } else {
12076 var _instance2 = createInstance(type, newProps, rootContainerInstance, _currentHostContext, workInProgress);
12077
12078 appendAllChildren(_instance2, workInProgress);
12079
12080 // Certain renderers require commit-time effects for initial mount.
12081 // (eg DOM renderer supports auto-focus for certain elements).
12082 // Make sure such renderers get scheduled for later work.
12083 if (finalizeInitialChildren(_instance2, type, newProps, rootContainerInstance, _currentHostContext)) {
12084 markUpdate(workInProgress);
12085 }
12086 workInProgress.stateNode = _instance2;
12087 }
12088
12089 if (workInProgress.ref !== null) {
12090 // If there is a ref on a host node we need to schedule a callback
12091 markRef(workInProgress);
12092 }
12093 }
12094 return null;
12095 }
12096 case HostText:
12097 {
12098 var newText = newProps;
12099 if (current && workInProgress.stateNode != null) {
12100 var oldText = current.memoizedProps;
12101 // If we have an alternate, that means this is an update and we need
12102 // to schedule a side-effect to do the updates.
12103 updateHostText(current, workInProgress, oldText, newText);
12104 } else {
12105 if (typeof newText !== 'string') {
12106 !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
12107 // This can happen when we abort work.
12108 return null;
12109 }
12110 var _rootContainerInstance = getRootHostContainer();
12111 var _currentHostContext2 = getHostContext();
12112 var _wasHydrated = popHydrationState(workInProgress);
12113 if (_wasHydrated) {
12114 if (prepareToHydrateHostTextInstance(workInProgress)) {
12115 markUpdate(workInProgress);
12116 }
12117 } else {
12118 workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext2, workInProgress);
12119 }
12120 }
12121 return null;
12122 }
12123 case CallComponent:
12124 return moveCallToHandlerPhase(current, workInProgress, renderExpirationTime);
12125 case CallHandlerPhase:
12126 // Reset the tag to now be a first phase call.
12127 workInProgress.tag = CallComponent;
12128 return null;
12129 case ReturnComponent:
12130 // Does nothing.
12131 return null;
12132 case ForwardRef:
12133 return null;
12134 case Fragment:
12135 return null;
12136 case Mode:
12137 return null;
12138 case HostPortal:
12139 popHostContainer(workInProgress);
12140 updateHostContainer(workInProgress);
12141 return null;
12142 case ContextProvider:
12143 // Pop provider fiber
12144 popProvider(workInProgress);
12145 return null;
12146 case ContextConsumer:
12147 return null;
12148 // Error cases
12149 case IndeterminateComponent:
12150 invariant(false, 'An indeterminate component should have become determinate before completing. This error is likely caused by a bug in React. Please file an issue.');
12151 // eslint-disable-next-line no-fallthrough
12152 default:
12153 invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
12154 }
12155 }
12156
12157 return {
12158 completeWork: completeWork
12159 };
12160 };
12161
12162 function createCapturedValue(value, source) {
12163 // If the value is an error, call this function immediately after it is thrown
12164 // so the stack is accurate.
12165 return {
12166 value: value,
12167 source: source,
12168 stack: getStackAddendumByWorkInProgressFiber(source)
12169 };
12170 }
12171
12172 var ReactFiberUnwindWork = function (hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary) {
12173 var popHostContainer = hostContext.popHostContainer,
12174 popHostContext = hostContext.popHostContext;
12175 var popLegacyContextProvider = legacyContext.popContextProvider,
12176 popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject;
12177 var popProvider = newContext.popProvider;
12178
12179
12180 function throwException(returnFiber, sourceFiber, rawValue) {
12181 // The source fiber did not complete.
12182 sourceFiber.effectTag |= Incomplete;
12183 // Its effect list is no longer valid.
12184 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
12185
12186 var value = createCapturedValue(rawValue, sourceFiber);
12187
12188 var workInProgress = returnFiber;
12189 do {
12190 switch (workInProgress.tag) {
12191 case HostRoot:
12192 {
12193 // Uncaught error
12194 var errorInfo = value;
12195 ensureUpdateQueues(workInProgress);
12196 var updateQueue = workInProgress.updateQueue;
12197 updateQueue.capturedValues = [errorInfo];
12198 workInProgress.effectTag |= ShouldCapture;
12199 return;
12200 }
12201 case ClassComponent:
12202 // Capture and retry
12203 var ctor = workInProgress.type;
12204 var _instance = workInProgress.stateNode;
12205 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) {
12206 ensureUpdateQueues(workInProgress);
12207 var _updateQueue = workInProgress.updateQueue;
12208 var capturedValues = _updateQueue.capturedValues;
12209 if (capturedValues === null) {
12210 _updateQueue.capturedValues = [value];
12211 } else {
12212 capturedValues.push(value);
12213 }
12214 workInProgress.effectTag |= ShouldCapture;
12215 return;
12216 }
12217 break;
12218 default:
12219 break;
12220 }
12221 workInProgress = workInProgress['return'];
12222 } while (workInProgress !== null);
12223 }
12224
12225 function unwindWork(workInProgress) {
12226 switch (workInProgress.tag) {
12227 case ClassComponent:
12228 {
12229 popLegacyContextProvider(workInProgress);
12230 var effectTag = workInProgress.effectTag;
12231 if (effectTag & ShouldCapture) {
12232 workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
12233 return workInProgress;
12234 }
12235 return null;
12236 }
12237 case HostRoot:
12238 {
12239 popHostContainer(workInProgress);
12240 popTopLevelLegacyContextObject(workInProgress);
12241 var _effectTag = workInProgress.effectTag;
12242 if (_effectTag & ShouldCapture) {
12243 workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
12244 return workInProgress;
12245 }
12246 return null;
12247 }
12248 case HostComponent:
12249 {
12250 popHostContext(workInProgress);
12251 return null;
12252 }
12253 case HostPortal:
12254 popHostContainer(workInProgress);
12255 return null;
12256 case ContextProvider:
12257 popProvider(workInProgress);
12258 return null;
12259 default:
12260 return null;
12261 }
12262 }
12263
12264 function unwindInterruptedWork(interruptedWork) {
12265 switch (interruptedWork.tag) {
12266 case ClassComponent:
12267 {
12268 popLegacyContextProvider(interruptedWork);
12269 break;
12270 }
12271 case HostRoot:
12272 {
12273 popHostContainer(interruptedWork);
12274 popTopLevelLegacyContextObject(interruptedWork);
12275 break;
12276 }
12277 case HostComponent:
12278 {
12279 popHostContext(interruptedWork);
12280 break;
12281 }
12282 case HostPortal:
12283 popHostContainer(interruptedWork);
12284 break;
12285 case ContextProvider:
12286 popProvider(interruptedWork);
12287 break;
12288 default:
12289 break;
12290 }
12291 }
12292
12293 return {
12294 throwException: throwException,
12295 unwindWork: unwindWork,
12296 unwindInterruptedWork: unwindInterruptedWork
12297 };
12298 };
12299
12300 // This module is forked in different environments.
12301 // By default, return `true` to log errors to the console.
12302 // Forks can return `false` if this isn't desirable.
12303 function showErrorDialog(capturedError) {
12304 return true;
12305 }
12306
12307 function logCapturedError(capturedError) {
12308 var logError = showErrorDialog(capturedError);
12309
12310 // Allow injected showErrorDialog() to prevent default console.error logging.
12311 // This enables renderers like ReactNative to better manage redbox behavior.
12312 if (logError === false) {
12313 return;
12314 }
12315
12316 var error = capturedError.error;
12317 var suppressLogging = error && error.suppressReactErrorLogging;
12318 if (suppressLogging) {
12319 return;
12320 }
12321
12322 {
12323 var componentName = capturedError.componentName,
12324 componentStack = capturedError.componentStack,
12325 errorBoundaryName = capturedError.errorBoundaryName,
12326 errorBoundaryFound = capturedError.errorBoundaryFound,
12327 willRetry = capturedError.willRetry;
12328
12329
12330 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
12331
12332 var errorBoundaryMessage = void 0;
12333 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
12334 if (errorBoundaryFound && errorBoundaryName) {
12335 if (willRetry) {
12336 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
12337 } else {
12338 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
12339 }
12340 } else {
12341 errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.';
12342 }
12343 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
12344
12345 // In development, we provide our own message with just the component stack.
12346 // We don't include the original error message and JS stack because the browser
12347 // has already printed it. Even if the application swallows the error, it is still
12348 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
12349 console.error(combinedMessage);
12350 }
12351 }
12352
12353 var invokeGuardedCallback$3 = ReactErrorUtils.invokeGuardedCallback;
12354 var hasCaughtError$1 = ReactErrorUtils.hasCaughtError;
12355 var clearCaughtError$1 = ReactErrorUtils.clearCaughtError;
12356
12357
12358 var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
12359 {
12360 didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
12361 }
12362
12363 function logError(boundary, errorInfo) {
12364 var source = errorInfo.source;
12365 var stack = errorInfo.stack;
12366 if (stack === null) {
12367 stack = getStackAddendumByWorkInProgressFiber(source);
12368 }
12369
12370 var capturedError = {
12371 componentName: source !== null ? getComponentName(source) : null,
12372 componentStack: stack !== null ? stack : '',
12373 error: errorInfo.value,
12374 errorBoundary: null,
12375 errorBoundaryName: null,
12376 errorBoundaryFound: false,
12377 willRetry: false
12378 };
12379
12380 if (boundary !== null && boundary.tag === ClassComponent) {
12381 capturedError.errorBoundary = boundary.stateNode;
12382 capturedError.errorBoundaryName = getComponentName(boundary);
12383 capturedError.errorBoundaryFound = true;
12384 capturedError.willRetry = true;
12385 }
12386
12387 try {
12388 logCapturedError(capturedError);
12389 } catch (e) {
12390 // Prevent cycle if logCapturedError() throws.
12391 // A cycle may still occur if logCapturedError renders a component that throws.
12392 var suppressLogging = e && e.suppressReactErrorLogging;
12393 if (!suppressLogging) {
12394 console.error(e);
12395 }
12396 }
12397 }
12398
12399 var ReactFiberCommitWork = function (config, captureError, scheduleWork, computeExpirationForFiber, markLegacyErrorBoundaryAsFailed, recalculateCurrentTime) {
12400 var getPublicInstance = config.getPublicInstance,
12401 mutation = config.mutation,
12402 persistence = config.persistence;
12403
12404
12405 var callComponentWillUnmountWithTimer = function (current, instance) {
12406 startPhaseTimer(current, 'componentWillUnmount');
12407 instance.props = current.memoizedProps;
12408 instance.state = current.memoizedState;
12409 instance.componentWillUnmount();
12410 stopPhaseTimer();
12411 };
12412
12413 // Capture errors so they don't interrupt unmounting.
12414 function safelyCallComponentWillUnmount(current, instance) {
12415 {
12416 invokeGuardedCallback$3(null, callComponentWillUnmountWithTimer, null, current, instance);
12417 if (hasCaughtError$1()) {
12418 var unmountError = clearCaughtError$1();
12419 captureError(current, unmountError);
12420 }
12421 }
12422 }
12423
12424 function safelyDetachRef(current) {
12425 var ref = current.ref;
12426 if (ref !== null) {
12427 if (typeof ref === 'function') {
12428 {
12429 invokeGuardedCallback$3(null, ref, null, null);
12430 if (hasCaughtError$1()) {
12431 var refError = clearCaughtError$1();
12432 captureError(current, refError);
12433 }
12434 }
12435 } else {
12436 ref.current = null;
12437 }
12438 }
12439 }
12440
12441 function commitBeforeMutationLifeCycles(current, finishedWork) {
12442 switch (finishedWork.tag) {
12443 case ClassComponent:
12444 {
12445 if (finishedWork.effectTag & Snapshot) {
12446 if (current !== null) {
12447 var prevProps = current.memoizedProps;
12448 var prevState = current.memoizedState;
12449 startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
12450 var _instance = finishedWork.stateNode;
12451 _instance.props = finishedWork.memoizedProps;
12452 _instance.state = finishedWork.memoizedState;
12453 var snapshot = _instance.getSnapshotBeforeUpdate(prevProps, prevState);
12454 {
12455 var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
12456 if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
12457 didWarnSet.add(finishedWork.type);
12458 warning(false, '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork));
12459 }
12460 }
12461 _instance.__reactInternalSnapshotBeforeUpdate = snapshot;
12462 stopPhaseTimer();
12463 }
12464 }
12465 return;
12466 }
12467 case HostRoot:
12468 case HostComponent:
12469 case HostText:
12470 case HostPortal:
12471 // Nothing to do for these component types
12472 return;
12473 default:
12474 {
12475 invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
12476 }
12477 }
12478 }
12479
12480 function commitLifeCycles(finishedRoot, current, finishedWork, currentTime, committedExpirationTime) {
12481 switch (finishedWork.tag) {
12482 case ClassComponent:
12483 {
12484 var _instance2 = finishedWork.stateNode;
12485 if (finishedWork.effectTag & Update) {
12486 if (current === null) {
12487 startPhaseTimer(finishedWork, 'componentDidMount');
12488 _instance2.props = finishedWork.memoizedProps;
12489 _instance2.state = finishedWork.memoizedState;
12490 _instance2.componentDidMount();
12491 stopPhaseTimer();
12492 } else {
12493 var prevProps = current.memoizedProps;
12494 var prevState = current.memoizedState;
12495 startPhaseTimer(finishedWork, 'componentDidUpdate');
12496 _instance2.props = finishedWork.memoizedProps;
12497 _instance2.state = finishedWork.memoizedState;
12498 _instance2.componentDidUpdate(prevProps, prevState, _instance2.__reactInternalSnapshotBeforeUpdate);
12499 stopPhaseTimer();
12500 }
12501 }
12502 var updateQueue = finishedWork.updateQueue;
12503 if (updateQueue !== null) {
12504 commitCallbacks(updateQueue, _instance2);
12505 }
12506 return;
12507 }
12508 case HostRoot:
12509 {
12510 var _updateQueue = finishedWork.updateQueue;
12511 if (_updateQueue !== null) {
12512 var _instance3 = null;
12513 if (finishedWork.child !== null) {
12514 switch (finishedWork.child.tag) {
12515 case HostComponent:
12516 _instance3 = getPublicInstance(finishedWork.child.stateNode);
12517 break;
12518 case ClassComponent:
12519 _instance3 = finishedWork.child.stateNode;
12520 break;
12521 }
12522 }
12523 commitCallbacks(_updateQueue, _instance3);
12524 }
12525 return;
12526 }
12527 case HostComponent:
12528 {
12529 var _instance4 = finishedWork.stateNode;
12530
12531 // Renderers may schedule work to be done after host components are mounted
12532 // (eg DOM renderer may schedule auto-focus for inputs and form controls).
12533 // These effects should only be committed when components are first mounted,
12534 // aka when there is no current/alternate.
12535 if (current === null && finishedWork.effectTag & Update) {
12536 var type = finishedWork.type;
12537 var props = finishedWork.memoizedProps;
12538 commitMount(_instance4, type, props, finishedWork);
12539 }
12540
12541 return;
12542 }
12543 case HostText:
12544 {
12545 // We have no life-cycles associated with text.
12546 return;
12547 }
12548 case HostPortal:
12549 {
12550 // We have no life-cycles associated with portals.
12551 return;
12552 }
12553 default:
12554 {
12555 invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
12556 }
12557 }
12558 }
12559
12560 function commitErrorLogging(finishedWork, onUncaughtError) {
12561 switch (finishedWork.tag) {
12562 case ClassComponent:
12563 {
12564 var ctor = finishedWork.type;
12565 var _instance5 = finishedWork.stateNode;
12566 var updateQueue = finishedWork.updateQueue;
12567 !(updateQueue !== null && updateQueue.capturedValues !== null) ? invariant(false, 'An error logging effect should not have been scheduled if no errors were captured. This error is likely caused by a bug in React. Please file an issue.') : void 0;
12568 var capturedErrors = updateQueue.capturedValues;
12569 updateQueue.capturedValues = null;
12570
12571 if (typeof ctor.getDerivedStateFromCatch !== 'function') {
12572 // To preserve the preexisting retry behavior of error boundaries,
12573 // we keep track of which ones already failed during this batch.
12574 // This gets reset before we yield back to the browser.
12575 // TODO: Warn in strict mode if getDerivedStateFromCatch is
12576 // not defined.
12577 markLegacyErrorBoundaryAsFailed(_instance5);
12578 }
12579
12580 _instance5.props = finishedWork.memoizedProps;
12581 _instance5.state = finishedWork.memoizedState;
12582 for (var i = 0; i < capturedErrors.length; i++) {
12583 var errorInfo = capturedErrors[i];
12584 var _error = errorInfo.value;
12585 var stack = errorInfo.stack;
12586 logError(finishedWork, errorInfo);
12587 _instance5.componentDidCatch(_error, {
12588 componentStack: stack !== null ? stack : ''
12589 });
12590 }
12591 }
12592 break;
12593 case HostRoot:
12594 {
12595 var _updateQueue2 = finishedWork.updateQueue;
12596 !(_updateQueue2 !== null && _updateQueue2.capturedValues !== null) ? invariant(false, 'An error logging effect should not have been scheduled if no errors were captured. This error is likely caused by a bug in React. Please file an issue.') : void 0;
12597 var _capturedErrors = _updateQueue2.capturedValues;
12598 _updateQueue2.capturedValues = null;
12599 for (var _i = 0; _i < _capturedErrors.length; _i++) {
12600 var _errorInfo = _capturedErrors[_i];
12601 logError(finishedWork, _errorInfo);
12602 onUncaughtError(_errorInfo.value);
12603 }
12604 break;
12605 }
12606 default:
12607 invariant(false, 'This unit of work tag cannot capture errors. This error is likely caused by a bug in React. Please file an issue.');
12608 }
12609 }
12610
12611 function commitAttachRef(finishedWork) {
12612 var ref = finishedWork.ref;
12613 if (ref !== null) {
12614 var _instance6 = finishedWork.stateNode;
12615 var instanceToUse = void 0;
12616 switch (finishedWork.tag) {
12617 case HostComponent:
12618 instanceToUse = getPublicInstance(_instance6);
12619 break;
12620 default:
12621 instanceToUse = _instance6;
12622 }
12623 if (typeof ref === 'function') {
12624 ref(instanceToUse);
12625 } else {
12626 {
12627 if (!ref.hasOwnProperty('current')) {
12628 warning(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork), getStackAddendumByWorkInProgressFiber(finishedWork));
12629 }
12630 }
12631
12632 ref.current = instanceToUse;
12633 }
12634 }
12635 }
12636
12637 function commitDetachRef(current) {
12638 var currentRef = current.ref;
12639 if (currentRef !== null) {
12640 if (typeof currentRef === 'function') {
12641 currentRef(null);
12642 } else {
12643 currentRef.current = null;
12644 }
12645 }
12646 }
12647
12648 // User-originating errors (lifecycles and refs) should not interrupt
12649 // deletion, so don't let them throw. Host-originating errors should
12650 // interrupt deletion, so it's okay
12651 function commitUnmount(current) {
12652 if (typeof onCommitUnmount === 'function') {
12653 onCommitUnmount(current);
12654 }
12655
12656 switch (current.tag) {
12657 case ClassComponent:
12658 {
12659 safelyDetachRef(current);
12660 var _instance7 = current.stateNode;
12661 if (typeof _instance7.componentWillUnmount === 'function') {
12662 safelyCallComponentWillUnmount(current, _instance7);
12663 }
12664 return;
12665 }
12666 case HostComponent:
12667 {
12668 safelyDetachRef(current);
12669 return;
12670 }
12671 case CallComponent:
12672 {
12673 commitNestedUnmounts(current.stateNode);
12674 return;
12675 }
12676 case HostPortal:
12677 {
12678 // TODO: this is recursive.
12679 // We are also not using this parent because
12680 // the portal will get pushed immediately.
12681 if (enableMutatingReconciler && mutation) {
12682 unmountHostComponents(current);
12683 } else if (enablePersistentReconciler && persistence) {
12684 emptyPortalContainer(current);
12685 }
12686 return;
12687 }
12688 }
12689 }
12690
12691 function commitNestedUnmounts(root) {
12692 // While we're inside a removed host node we don't want to call
12693 // removeChild on the inner nodes because they're removed by the top
12694 // call anyway. We also want to call componentWillUnmount on all
12695 // composites before this host node is removed from the tree. Therefore
12696 var node = root;
12697 while (true) {
12698 commitUnmount(node);
12699 // Visit children because they may contain more composite or host nodes.
12700 // Skip portals because commitUnmount() currently visits them recursively.
12701 if (node.child !== null && (
12702 // If we use mutation we drill down into portals using commitUnmount above.
12703 // If we don't use mutation we drill down into portals here instead.
12704 !mutation || node.tag !== HostPortal)) {
12705 node.child['return'] = node;
12706 node = node.child;
12707 continue;
12708 }
12709 if (node === root) {
12710 return;
12711 }
12712 while (node.sibling === null) {
12713 if (node['return'] === null || node['return'] === root) {
12714 return;
12715 }
12716 node = node['return'];
12717 }
12718 node.sibling['return'] = node['return'];
12719 node = node.sibling;
12720 }
12721 }
12722
12723 function detachFiber(current) {
12724 // Cut off the return pointers to disconnect it from the tree. Ideally, we
12725 // should clear the child pointer of the parent alternate to let this
12726 // get GC:ed but we don't know which for sure which parent is the current
12727 // one so we'll settle for GC:ing the subtree of this child. This child
12728 // itself will be GC:ed when the parent updates the next time.
12729 current['return'] = null;
12730 current.child = null;
12731 if (current.alternate) {
12732 current.alternate.child = null;
12733 current.alternate['return'] = null;
12734 }
12735 }
12736
12737 var emptyPortalContainer = void 0;
12738
12739 if (!mutation) {
12740 var commitContainer = void 0;
12741 if (persistence) {
12742 var replaceContainerChildren = persistence.replaceContainerChildren,
12743 createContainerChildSet = persistence.createContainerChildSet;
12744
12745 emptyPortalContainer = function (current) {
12746 var portal = current.stateNode;
12747 var containerInfo = portal.containerInfo;
12748
12749 var emptyChildSet = createContainerChildSet(containerInfo);
12750 replaceContainerChildren(containerInfo, emptyChildSet);
12751 };
12752 commitContainer = function (finishedWork) {
12753 switch (finishedWork.tag) {
12754 case ClassComponent:
12755 {
12756 return;
12757 }
12758 case HostComponent:
12759 {
12760 return;
12761 }
12762 case HostText:
12763 {
12764 return;
12765 }
12766 case HostRoot:
12767 case HostPortal:
12768 {
12769 var portalOrRoot = finishedWork.stateNode;
12770 var containerInfo = portalOrRoot.containerInfo,
12771 _pendingChildren = portalOrRoot.pendingChildren;
12772
12773 replaceContainerChildren(containerInfo, _pendingChildren);
12774 return;
12775 }
12776 default:
12777 {
12778 invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
12779 }
12780 }
12781 };
12782 } else {
12783 commitContainer = function (finishedWork) {
12784 // Noop
12785 };
12786 }
12787 if (enablePersistentReconciler || enableNoopReconciler) {
12788 return {
12789 commitResetTextContent: function (finishedWork) {},
12790 commitPlacement: function (finishedWork) {},
12791 commitDeletion: function (current) {
12792 // Detach refs and call componentWillUnmount() on the whole subtree.
12793 commitNestedUnmounts(current);
12794 detachFiber(current);
12795 },
12796 commitWork: function (current, finishedWork) {
12797 commitContainer(finishedWork);
12798 },
12799
12800 commitLifeCycles: commitLifeCycles,
12801 commitBeforeMutationLifeCycles: commitBeforeMutationLifeCycles,
12802 commitErrorLogging: commitErrorLogging,
12803 commitAttachRef: commitAttachRef,
12804 commitDetachRef: commitDetachRef
12805 };
12806 } else if (persistence) {
12807 invariant(false, 'Persistent reconciler is disabled.');
12808 } else {
12809 invariant(false, 'Noop reconciler is disabled.');
12810 }
12811 }
12812 var commitMount = mutation.commitMount,
12813 commitUpdate = mutation.commitUpdate,
12814 resetTextContent = mutation.resetTextContent,
12815 commitTextUpdate = mutation.commitTextUpdate,
12816 appendChild = mutation.appendChild,
12817 appendChildToContainer = mutation.appendChildToContainer,
12818 insertBefore = mutation.insertBefore,
12819 insertInContainerBefore = mutation.insertInContainerBefore,
12820 removeChild = mutation.removeChild,
12821 removeChildFromContainer = mutation.removeChildFromContainer;
12822
12823
12824 function getHostParentFiber(fiber) {
12825 var parent = fiber['return'];
12826 while (parent !== null) {
12827 if (isHostParent(parent)) {
12828 return parent;
12829 }
12830 parent = parent['return'];
12831 }
12832 invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.');
12833 }
12834
12835 function isHostParent(fiber) {
12836 return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
12837 }
12838
12839 function getHostSibling(fiber) {
12840 // We're going to search forward into the tree until we find a sibling host
12841 // node. Unfortunately, if multiple insertions are done in a row we have to
12842 // search past them. This leads to exponential search for the next sibling.
12843 var node = fiber;
12844 siblings: while (true) {
12845 // If we didn't find anything, let's try the next sibling.
12846 while (node.sibling === null) {
12847 if (node['return'] === null || isHostParent(node['return'])) {
12848 // If we pop out of the root or hit the parent the fiber we are the
12849 // last sibling.
12850 return null;
12851 }
12852 node = node['return'];
12853 }
12854 node.sibling['return'] = node['return'];
12855 node = node.sibling;
12856 while (node.tag !== HostComponent && node.tag !== HostText) {
12857 // If it is not host node and, we might have a host node inside it.
12858 // Try to search down until we find one.
12859 if (node.effectTag & Placement) {
12860 // If we don't have a child, try the siblings instead.
12861 continue siblings;
12862 }
12863 // If we don't have a child, try the siblings instead.
12864 // We also skip portals because they are not part of this host tree.
12865 if (node.child === null || node.tag === HostPortal) {
12866 continue siblings;
12867 } else {
12868 node.child['return'] = node;
12869 node = node.child;
12870 }
12871 }
12872 // Check if this host node is stable or about to be placed.
12873 if (!(node.effectTag & Placement)) {
12874 // Found it!
12875 return node.stateNode;
12876 }
12877 }
12878 }
12879
12880 function commitPlacement(finishedWork) {
12881 // Recursively insert all host nodes into the parent.
12882 var parentFiber = getHostParentFiber(finishedWork);
12883 var parent = void 0;
12884 var isContainer = void 0;
12885 switch (parentFiber.tag) {
12886 case HostComponent:
12887 parent = parentFiber.stateNode;
12888 isContainer = false;
12889 break;
12890 case HostRoot:
12891 parent = parentFiber.stateNode.containerInfo;
12892 isContainer = true;
12893 break;
12894 case HostPortal:
12895 parent = parentFiber.stateNode.containerInfo;
12896 isContainer = true;
12897 break;
12898 default:
12899 invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.');
12900 }
12901 if (parentFiber.effectTag & ContentReset) {
12902 // Reset the text content of the parent before doing any insertions
12903 resetTextContent(parent);
12904 // Clear ContentReset from the effect tag
12905 parentFiber.effectTag &= ~ContentReset;
12906 }
12907
12908 var before = getHostSibling(finishedWork);
12909 // We only have the top Fiber that was inserted but we need recurse down its
12910 // children to find all the terminal nodes.
12911 var node = finishedWork;
12912 while (true) {
12913 if (node.tag === HostComponent || node.tag === HostText) {
12914 if (before) {
12915 if (isContainer) {
12916 insertInContainerBefore(parent, node.stateNode, before);
12917 } else {
12918 insertBefore(parent, node.stateNode, before);
12919 }
12920 } else {
12921 if (isContainer) {
12922 appendChildToContainer(parent, node.stateNode);
12923 } else {
12924 appendChild(parent, node.stateNode);
12925 }
12926 }
12927 } else if (node.tag === HostPortal) {
12928 // If the insertion itself is a portal, then we don't want to traverse
12929 // down its children. Instead, we'll get insertions from each child in
12930 // the portal directly.
12931 } else if (node.child !== null) {
12932 node.child['return'] = node;
12933 node = node.child;
12934 continue;
12935 }
12936 if (node === finishedWork) {
12937 return;
12938 }
12939 while (node.sibling === null) {
12940 if (node['return'] === null || node['return'] === finishedWork) {
12941 return;
12942 }
12943 node = node['return'];
12944 }
12945 node.sibling['return'] = node['return'];
12946 node = node.sibling;
12947 }
12948 }
12949
12950 function unmountHostComponents(current) {
12951 // We only have the top Fiber that was inserted but we need recurse down its
12952 var node = current;
12953
12954 // Each iteration, currentParent is populated with node's host parent if not
12955 // currentParentIsValid.
12956 var currentParentIsValid = false;
12957 var currentParent = void 0;
12958 var currentParentIsContainer = void 0;
12959
12960 while (true) {
12961 if (!currentParentIsValid) {
12962 var parent = node['return'];
12963 findParent: while (true) {
12964 !(parent !== null) ? invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.') : void 0;
12965 switch (parent.tag) {
12966 case HostComponent:
12967 currentParent = parent.stateNode;
12968 currentParentIsContainer = false;
12969 break findParent;
12970 case HostRoot:
12971 currentParent = parent.stateNode.containerInfo;
12972 currentParentIsContainer = true;
12973 break findParent;
12974 case HostPortal:
12975 currentParent = parent.stateNode.containerInfo;
12976 currentParentIsContainer = true;
12977 break findParent;
12978 }
12979 parent = parent['return'];
12980 }
12981 currentParentIsValid = true;
12982 }
12983
12984 if (node.tag === HostComponent || node.tag === HostText) {
12985 commitNestedUnmounts(node);
12986 // After all the children have unmounted, it is now safe to remove the
12987 // node from the tree.
12988 if (currentParentIsContainer) {
12989 removeChildFromContainer(currentParent, node.stateNode);
12990 } else {
12991 removeChild(currentParent, node.stateNode);
12992 }
12993 // Don't visit children because we already visited them.
12994 } else if (node.tag === HostPortal) {
12995 // When we go into a portal, it becomes the parent to remove from.
12996 // We will reassign it back when we pop the portal on the way up.
12997 currentParent = node.stateNode.containerInfo;
12998 // Visit children because portals might contain host components.
12999 if (node.child !== null) {
13000 node.child['return'] = node;
13001 node = node.child;
13002 continue;
13003 }
13004 } else {
13005 commitUnmount(node);
13006 // Visit children because we may find more host components below.
13007 if (node.child !== null) {
13008 node.child['return'] = node;
13009 node = node.child;
13010 continue;
13011 }
13012 }
13013 if (node === current) {
13014 return;
13015 }
13016 while (node.sibling === null) {
13017 if (node['return'] === null || node['return'] === current) {
13018 return;
13019 }
13020 node = node['return'];
13021 if (node.tag === HostPortal) {
13022 // When we go out of the portal, we need to restore the parent.
13023 // Since we don't keep a stack of them, we will search for it.
13024 currentParentIsValid = false;
13025 }
13026 }
13027 node.sibling['return'] = node['return'];
13028 node = node.sibling;
13029 }
13030 }
13031
13032 function commitDeletion(current) {
13033 // Recursively delete all host nodes from the parent.
13034 // Detach refs and call componentWillUnmount() on the whole subtree.
13035 unmountHostComponents(current);
13036 detachFiber(current);
13037 }
13038
13039 function commitWork(current, finishedWork) {
13040 switch (finishedWork.tag) {
13041 case ClassComponent:
13042 {
13043 return;
13044 }
13045 case HostComponent:
13046 {
13047 var _instance8 = finishedWork.stateNode;
13048 if (_instance8 != null) {
13049 // Commit the work prepared earlier.
13050 var newProps = finishedWork.memoizedProps;
13051 // For hydration we reuse the update path but we treat the oldProps
13052 // as the newProps. The updatePayload will contain the real change in
13053 // this case.
13054 var oldProps = current !== null ? current.memoizedProps : newProps;
13055 var type = finishedWork.type;
13056 // TODO: Type the updateQueue to be specific to host components.
13057 var updatePayload = finishedWork.updateQueue;
13058 finishedWork.updateQueue = null;
13059 if (updatePayload !== null) {
13060 commitUpdate(_instance8, updatePayload, type, oldProps, newProps, finishedWork);
13061 }
13062 }
13063 return;
13064 }
13065 case HostText:
13066 {
13067 !(finishedWork.stateNode !== null) ? invariant(false, 'This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13068 var textInstance = finishedWork.stateNode;
13069 var newText = finishedWork.memoizedProps;
13070 // For hydration we reuse the update path but we treat the oldProps
13071 // as the newProps. The updatePayload will contain the real change in
13072 // this case.
13073 var oldText = current !== null ? current.memoizedProps : newText;
13074 commitTextUpdate(textInstance, oldText, newText);
13075 return;
13076 }
13077 case HostRoot:
13078 {
13079 return;
13080 }
13081 default:
13082 {
13083 invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
13084 }
13085 }
13086 }
13087
13088 function commitResetTextContent(current) {
13089 resetTextContent(current.stateNode);
13090 }
13091
13092 if (enableMutatingReconciler) {
13093 return {
13094 commitBeforeMutationLifeCycles: commitBeforeMutationLifeCycles,
13095 commitResetTextContent: commitResetTextContent,
13096 commitPlacement: commitPlacement,
13097 commitDeletion: commitDeletion,
13098 commitWork: commitWork,
13099 commitLifeCycles: commitLifeCycles,
13100 commitErrorLogging: commitErrorLogging,
13101 commitAttachRef: commitAttachRef,
13102 commitDetachRef: commitDetachRef
13103 };
13104 } else {
13105 invariant(false, 'Mutating reconciler is disabled.');
13106 }
13107 };
13108
13109 var NO_CONTEXT = {};
13110
13111 var ReactFiberHostContext = function (config, stack) {
13112 var getChildHostContext = config.getChildHostContext,
13113 getRootHostContext = config.getRootHostContext;
13114 var createCursor = stack.createCursor,
13115 push = stack.push,
13116 pop = stack.pop;
13117
13118
13119 var contextStackCursor = createCursor(NO_CONTEXT);
13120 var contextFiberStackCursor = createCursor(NO_CONTEXT);
13121 var rootInstanceStackCursor = createCursor(NO_CONTEXT);
13122
13123 function requiredContext(c) {
13124 !(c !== NO_CONTEXT) ? invariant(false, 'Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13125 return c;
13126 }
13127
13128 function getRootHostContainer() {
13129 var rootInstance = requiredContext(rootInstanceStackCursor.current);
13130 return rootInstance;
13131 }
13132
13133 function pushHostContainer(fiber, nextRootInstance) {
13134 // Push current root instance onto the stack;
13135 // This allows us to reset root when portals are popped.
13136 push(rootInstanceStackCursor, nextRootInstance, fiber);
13137 // Track the context and the Fiber that provided it.
13138 // This enables us to pop only Fibers that provide unique contexts.
13139 push(contextFiberStackCursor, fiber, fiber);
13140
13141 // Finally, we need to push the host context to the stack.
13142 // However, we can't just call getRootHostContext() and push it because
13143 // we'd have a different number of entries on the stack depending on
13144 // whether getRootHostContext() throws somewhere in renderer code or not.
13145 // So we push an empty value first. This lets us safely unwind on errors.
13146 push(contextStackCursor, NO_CONTEXT, fiber);
13147 var nextRootContext = getRootHostContext(nextRootInstance);
13148 // Now that we know this function doesn't throw, replace it.
13149 pop(contextStackCursor, fiber);
13150 push(contextStackCursor, nextRootContext, fiber);
13151 }
13152
13153 function popHostContainer(fiber) {
13154 pop(contextStackCursor, fiber);
13155 pop(contextFiberStackCursor, fiber);
13156 pop(rootInstanceStackCursor, fiber);
13157 }
13158
13159 function getHostContext() {
13160 var context = requiredContext(contextStackCursor.current);
13161 return context;
13162 }
13163
13164 function pushHostContext(fiber) {
13165 var rootInstance = requiredContext(rootInstanceStackCursor.current);
13166 var context = requiredContext(contextStackCursor.current);
13167 var nextContext = getChildHostContext(context, fiber.type, rootInstance);
13168
13169 // Don't push this Fiber's context unless it's unique.
13170 if (context === nextContext) {
13171 return;
13172 }
13173
13174 // Track the context and the Fiber that provided it.
13175 // This enables us to pop only Fibers that provide unique contexts.
13176 push(contextFiberStackCursor, fiber, fiber);
13177 push(contextStackCursor, nextContext, fiber);
13178 }
13179
13180 function popHostContext(fiber) {
13181 // Do not pop unless this Fiber provided the current context.
13182 // pushHostContext() only pushes Fibers that provide unique contexts.
13183 if (contextFiberStackCursor.current !== fiber) {
13184 return;
13185 }
13186
13187 pop(contextStackCursor, fiber);
13188 pop(contextFiberStackCursor, fiber);
13189 }
13190
13191 return {
13192 getHostContext: getHostContext,
13193 getRootHostContainer: getRootHostContainer,
13194 popHostContainer: popHostContainer,
13195 popHostContext: popHostContext,
13196 pushHostContainer: pushHostContainer,
13197 pushHostContext: pushHostContext
13198 };
13199 };
13200
13201 var ReactFiberHydrationContext = function (config) {
13202 var shouldSetTextContent = config.shouldSetTextContent,
13203 hydration = config.hydration;
13204
13205 // If this doesn't have hydration mode.
13206
13207 if (!hydration) {
13208 return {
13209 enterHydrationState: function () {
13210 return false;
13211 },
13212 resetHydrationState: function () {},
13213 tryToClaimNextHydratableInstance: function () {},
13214 prepareToHydrateHostInstance: function () {
13215 invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
13216 },
13217 prepareToHydrateHostTextInstance: function () {
13218 invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
13219 },
13220 popHydrationState: function (fiber) {
13221 return false;
13222 }
13223 };
13224 }
13225
13226 var canHydrateInstance = hydration.canHydrateInstance,
13227 canHydrateTextInstance = hydration.canHydrateTextInstance,
13228 getNextHydratableSibling = hydration.getNextHydratableSibling,
13229 getFirstHydratableChild = hydration.getFirstHydratableChild,
13230 hydrateInstance = hydration.hydrateInstance,
13231 hydrateTextInstance = hydration.hydrateTextInstance,
13232 didNotMatchHydratedContainerTextInstance = hydration.didNotMatchHydratedContainerTextInstance,
13233 didNotMatchHydratedTextInstance = hydration.didNotMatchHydratedTextInstance,
13234 didNotHydrateContainerInstance = hydration.didNotHydrateContainerInstance,
13235 didNotHydrateInstance = hydration.didNotHydrateInstance,
13236 didNotFindHydratableContainerInstance = hydration.didNotFindHydratableContainerInstance,
13237 didNotFindHydratableContainerTextInstance = hydration.didNotFindHydratableContainerTextInstance,
13238 didNotFindHydratableInstance = hydration.didNotFindHydratableInstance,
13239 didNotFindHydratableTextInstance = hydration.didNotFindHydratableTextInstance;
13240
13241 // The deepest Fiber on the stack involved in a hydration context.
13242 // This may have been an insertion or a hydration.
13243
13244 var hydrationParentFiber = null;
13245 var nextHydratableInstance = null;
13246 var isHydrating = false;
13247
13248 function enterHydrationState(fiber) {
13249 var parentInstance = fiber.stateNode.containerInfo;
13250 nextHydratableInstance = getFirstHydratableChild(parentInstance);
13251 hydrationParentFiber = fiber;
13252 isHydrating = true;
13253 return true;
13254 }
13255
13256 function deleteHydratableInstance(returnFiber, instance) {
13257 {
13258 switch (returnFiber.tag) {
13259 case HostRoot:
13260 didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
13261 break;
13262 case HostComponent:
13263 didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
13264 break;
13265 }
13266 }
13267
13268 var childToDelete = createFiberFromHostInstanceForDeletion();
13269 childToDelete.stateNode = instance;
13270 childToDelete['return'] = returnFiber;
13271 childToDelete.effectTag = Deletion;
13272
13273 // This might seem like it belongs on progressedFirstDeletion. However,
13274 // these children are not part of the reconciliation list of children.
13275 // Even if we abort and rereconcile the children, that will try to hydrate
13276 // again and the nodes are still in the host tree so these will be
13277 // recreated.
13278 if (returnFiber.lastEffect !== null) {
13279 returnFiber.lastEffect.nextEffect = childToDelete;
13280 returnFiber.lastEffect = childToDelete;
13281 } else {
13282 returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
13283 }
13284 }
13285
13286 function insertNonHydratedInstance(returnFiber, fiber) {
13287 fiber.effectTag |= Placement;
13288 {
13289 switch (returnFiber.tag) {
13290 case HostRoot:
13291 {
13292 var parentContainer = returnFiber.stateNode.containerInfo;
13293 switch (fiber.tag) {
13294 case HostComponent:
13295 var type = fiber.type;
13296 var props = fiber.pendingProps;
13297 didNotFindHydratableContainerInstance(parentContainer, type, props);
13298 break;
13299 case HostText:
13300 var text = fiber.pendingProps;
13301 didNotFindHydratableContainerTextInstance(parentContainer, text);
13302 break;
13303 }
13304 break;
13305 }
13306 case HostComponent:
13307 {
13308 var parentType = returnFiber.type;
13309 var parentProps = returnFiber.memoizedProps;
13310 var parentInstance = returnFiber.stateNode;
13311 switch (fiber.tag) {
13312 case HostComponent:
13313 var _type = fiber.type;
13314 var _props = fiber.pendingProps;
13315 didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
13316 break;
13317 case HostText:
13318 var _text = fiber.pendingProps;
13319 didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
13320 break;
13321 }
13322 break;
13323 }
13324 default:
13325 return;
13326 }
13327 }
13328 }
13329
13330 function tryHydrate(fiber, nextInstance) {
13331 switch (fiber.tag) {
13332 case HostComponent:
13333 {
13334 var type = fiber.type;
13335 var props = fiber.pendingProps;
13336 var instance = canHydrateInstance(nextInstance, type, props);
13337 if (instance !== null) {
13338 fiber.stateNode = instance;
13339 return true;
13340 }
13341 return false;
13342 }
13343 case HostText:
13344 {
13345 var text = fiber.pendingProps;
13346 var textInstance = canHydrateTextInstance(nextInstance, text);
13347 if (textInstance !== null) {
13348 fiber.stateNode = textInstance;
13349 return true;
13350 }
13351 return false;
13352 }
13353 default:
13354 return false;
13355 }
13356 }
13357
13358 function tryToClaimNextHydratableInstance(fiber) {
13359 if (!isHydrating) {
13360 return;
13361 }
13362 var nextInstance = nextHydratableInstance;
13363 if (!nextInstance) {
13364 // Nothing to hydrate. Make it an insertion.
13365 insertNonHydratedInstance(hydrationParentFiber, fiber);
13366 isHydrating = false;
13367 hydrationParentFiber = fiber;
13368 return;
13369 }
13370 if (!tryHydrate(fiber, nextInstance)) {
13371 // If we can't hydrate this instance let's try the next one.
13372 // We use this as a heuristic. It's based on intuition and not data so it
13373 // might be flawed or unnecessary.
13374 nextInstance = getNextHydratableSibling(nextInstance);
13375 if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
13376 // Nothing to hydrate. Make it an insertion.
13377 insertNonHydratedInstance(hydrationParentFiber, fiber);
13378 isHydrating = false;
13379 hydrationParentFiber = fiber;
13380 return;
13381 }
13382 // We matched the next one, we'll now assume that the first one was
13383 // superfluous and we'll delete it. Since we can't eagerly delete it
13384 // we'll have to schedule a deletion. To do that, this node needs a dummy
13385 // fiber associated with it.
13386 deleteHydratableInstance(hydrationParentFiber, nextHydratableInstance);
13387 }
13388 hydrationParentFiber = fiber;
13389 nextHydratableInstance = getFirstHydratableChild(nextInstance);
13390 }
13391
13392 function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
13393 var instance = fiber.stateNode;
13394 var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
13395 // TODO: Type this specific to this type of component.
13396 fiber.updateQueue = updatePayload;
13397 // If the update payload indicates that there is a change or if there
13398 // is a new ref we mark this as an update.
13399 if (updatePayload !== null) {
13400 return true;
13401 }
13402 return false;
13403 }
13404
13405 function prepareToHydrateHostTextInstance(fiber) {
13406 var textInstance = fiber.stateNode;
13407 var textContent = fiber.memoizedProps;
13408 var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
13409 {
13410 if (shouldUpdate) {
13411 // We assume that prepareToHydrateHostTextInstance is called in a context where the
13412 // hydration parent is the parent host component of this host text.
13413 var returnFiber = hydrationParentFiber;
13414 if (returnFiber !== null) {
13415 switch (returnFiber.tag) {
13416 case HostRoot:
13417 {
13418 var parentContainer = returnFiber.stateNode.containerInfo;
13419 didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
13420 break;
13421 }
13422 case HostComponent:
13423 {
13424 var parentType = returnFiber.type;
13425 var parentProps = returnFiber.memoizedProps;
13426 var parentInstance = returnFiber.stateNode;
13427 didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
13428 break;
13429 }
13430 }
13431 }
13432 }
13433 }
13434 return shouldUpdate;
13435 }
13436
13437 function popToNextHostParent(fiber) {
13438 var parent = fiber['return'];
13439 while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot) {
13440 parent = parent['return'];
13441 }
13442 hydrationParentFiber = parent;
13443 }
13444
13445 function popHydrationState(fiber) {
13446 if (fiber !== hydrationParentFiber) {
13447 // We're deeper than the current hydration context, inside an inserted
13448 // tree.
13449 return false;
13450 }
13451 if (!isHydrating) {
13452 // If we're not currently hydrating but we're in a hydration context, then
13453 // we were an insertion and now need to pop up reenter hydration of our
13454 // siblings.
13455 popToNextHostParent(fiber);
13456 isHydrating = true;
13457 return false;
13458 }
13459
13460 var type = fiber.type;
13461
13462 // If we have any remaining hydratable nodes, we need to delete them now.
13463 // We only do this deeper than head and body since they tend to have random
13464 // other nodes in them. We also ignore components with pure text content in
13465 // side of them.
13466 // TODO: Better heuristic.
13467 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
13468 var nextInstance = nextHydratableInstance;
13469 while (nextInstance) {
13470 deleteHydratableInstance(fiber, nextInstance);
13471 nextInstance = getNextHydratableSibling(nextInstance);
13472 }
13473 }
13474
13475 popToNextHostParent(fiber);
13476 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
13477 return true;
13478 }
13479
13480 function resetHydrationState() {
13481 hydrationParentFiber = null;
13482 nextHydratableInstance = null;
13483 isHydrating = false;
13484 }
13485
13486 return {
13487 enterHydrationState: enterHydrationState,
13488 resetHydrationState: resetHydrationState,
13489 tryToClaimNextHydratableInstance: tryToClaimNextHydratableInstance,
13490 prepareToHydrateHostInstance: prepareToHydrateHostInstance,
13491 prepareToHydrateHostTextInstance: prepareToHydrateHostTextInstance,
13492 popHydrationState: popHydrationState
13493 };
13494 };
13495
13496 // This lets us hook into Fiber to debug what it's doing.
13497 // See https://github.com/facebook/react/pull/8033.
13498 // This is not part of the public API, not even for React DevTools.
13499 // You may only inject a debugTool if you work on React Fiber itself.
13500 var ReactFiberInstrumentation = {
13501 debugTool: null
13502 };
13503
13504 var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
13505
13506 var warnedAboutMissingGetChildContext = void 0;
13507
13508 {
13509 warnedAboutMissingGetChildContext = {};
13510 }
13511
13512 var ReactFiberLegacyContext = function (stack) {
13513 var createCursor = stack.createCursor,
13514 push = stack.push,
13515 pop = stack.pop;
13516
13517 // A cursor to the current merged context object on the stack.
13518
13519 var contextStackCursor = createCursor(emptyObject);
13520 // A cursor to a boolean indicating whether the context has changed.
13521 var didPerformWorkStackCursor = createCursor(false);
13522 // Keep track of the previous context object that was on the stack.
13523 // We use this to get access to the parent context after we have already
13524 // pushed the next context provider, and now need to merge their contexts.
13525 var previousContext = emptyObject;
13526
13527 function getUnmaskedContext(workInProgress) {
13528 var hasOwnContext = isContextProvider(workInProgress);
13529 if (hasOwnContext) {
13530 // If the fiber is a context provider itself, when we read its context
13531 // we have already pushed its own child context on the stack. A context
13532 // provider should not "see" its own child context. Therefore we read the
13533 // previous (parent) context instead for a context provider.
13534 return previousContext;
13535 }
13536 return contextStackCursor.current;
13537 }
13538
13539 function cacheContext(workInProgress, unmaskedContext, maskedContext) {
13540 var instance = workInProgress.stateNode;
13541 instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
13542 instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
13543 }
13544
13545 function getMaskedContext(workInProgress, unmaskedContext) {
13546 var type = workInProgress.type;
13547 var contextTypes = type.contextTypes;
13548 if (!contextTypes) {
13549 return emptyObject;
13550 }
13551
13552 // Avoid recreating masked context unless unmasked context has changed.
13553 // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
13554 // This may trigger infinite loops if componentWillReceiveProps calls setState.
13555 var instance = workInProgress.stateNode;
13556 if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
13557 return instance.__reactInternalMemoizedMaskedChildContext;
13558 }
13559
13560 var context = {};
13561 for (var key in contextTypes) {
13562 context[key] = unmaskedContext[key];
13563 }
13564
13565 {
13566 var name = getComponentName(workInProgress) || 'Unknown';
13567 checkPropTypes(contextTypes, context, 'context', name, ReactDebugCurrentFiber.getCurrentFiberStackAddendum);
13568 }
13569
13570 // Cache unmasked context so we can avoid recreating masked context unless necessary.
13571 // Context is created before the class component is instantiated so check for instance.
13572 if (instance) {
13573 cacheContext(workInProgress, unmaskedContext, context);
13574 }
13575
13576 return context;
13577 }
13578
13579 function hasContextChanged() {
13580 return didPerformWorkStackCursor.current;
13581 }
13582
13583 function isContextConsumer(fiber) {
13584 return fiber.tag === ClassComponent && fiber.type.contextTypes != null;
13585 }
13586
13587 function isContextProvider(fiber) {
13588 return fiber.tag === ClassComponent && fiber.type.childContextTypes != null;
13589 }
13590
13591 function popContextProvider(fiber) {
13592 if (!isContextProvider(fiber)) {
13593 return;
13594 }
13595
13596 pop(didPerformWorkStackCursor, fiber);
13597 pop(contextStackCursor, fiber);
13598 }
13599
13600 function popTopLevelContextObject(fiber) {
13601 pop(didPerformWorkStackCursor, fiber);
13602 pop(contextStackCursor, fiber);
13603 }
13604
13605 function pushTopLevelContextObject(fiber, context, didChange) {
13606 !(contextStackCursor.cursor == null) ? invariant(false, 'Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13607
13608 push(contextStackCursor, context, fiber);
13609 push(didPerformWorkStackCursor, didChange, fiber);
13610 }
13611
13612 function processChildContext(fiber, parentContext) {
13613 var instance = fiber.stateNode;
13614 var childContextTypes = fiber.type.childContextTypes;
13615
13616 // TODO (bvaughn) Replace this behavior with an invariant() in the future.
13617 // It has only been added in Fiber to match the (unintentional) behavior in Stack.
13618 if (typeof instance.getChildContext !== 'function') {
13619 {
13620 var componentName = getComponentName(fiber) || 'Unknown';
13621
13622 if (!warnedAboutMissingGetChildContext[componentName]) {
13623 warnedAboutMissingGetChildContext[componentName] = true;
13624 warning(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
13625 }
13626 }
13627 return parentContext;
13628 }
13629
13630 var childContext = void 0;
13631 {
13632 ReactDebugCurrentFiber.setCurrentPhase('getChildContext');
13633 }
13634 startPhaseTimer(fiber, 'getChildContext');
13635 childContext = instance.getChildContext();
13636 stopPhaseTimer();
13637 {
13638 ReactDebugCurrentFiber.setCurrentPhase(null);
13639 }
13640 for (var contextKey in childContext) {
13641 !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(fiber) || 'Unknown', contextKey) : void 0;
13642 }
13643 {
13644 var name = getComponentName(fiber) || 'Unknown';
13645 checkPropTypes(childContextTypes, childContext, 'child context', name,
13646 // In practice, there is one case in which we won't get a stack. It's when
13647 // somebody calls unstable_renderSubtreeIntoContainer() and we process
13648 // context from the parent component instance. The stack will be missing
13649 // because it's outside of the reconciliation, and so the pointer has not
13650 // been set. This is rare and doesn't matter. We'll also remove that API.
13651 ReactDebugCurrentFiber.getCurrentFiberStackAddendum);
13652 }
13653
13654 return _assign({}, parentContext, childContext);
13655 }
13656
13657 function pushContextProvider(workInProgress) {
13658 if (!isContextProvider(workInProgress)) {
13659 return false;
13660 }
13661
13662 var instance = workInProgress.stateNode;
13663 // We push the context as early as possible to ensure stack integrity.
13664 // If the instance does not exist yet, we will push null at first,
13665 // and replace it on the stack later when invalidating the context.
13666 var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyObject;
13667
13668 // Remember the parent context so we can merge with it later.
13669 // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
13670 previousContext = contextStackCursor.current;
13671 push(contextStackCursor, memoizedMergedChildContext, workInProgress);
13672 push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
13673
13674 return true;
13675 }
13676
13677 function invalidateContextProvider(workInProgress, didChange) {
13678 var instance = workInProgress.stateNode;
13679 !instance ? invariant(false, 'Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13680
13681 if (didChange) {
13682 // Merge parent and own context.
13683 // Skip this if we're not updating due to sCU.
13684 // This avoids unnecessarily recomputing memoized values.
13685 var mergedContext = processChildContext(workInProgress, previousContext);
13686 instance.__reactInternalMemoizedMergedChildContext = mergedContext;
13687
13688 // Replace the old (or empty) context with the new one.
13689 // It is important to unwind the context in the reverse order.
13690 pop(didPerformWorkStackCursor, workInProgress);
13691 pop(contextStackCursor, workInProgress);
13692 // Now push the new context and mark that it has changed.
13693 push(contextStackCursor, mergedContext, workInProgress);
13694 push(didPerformWorkStackCursor, didChange, workInProgress);
13695 } else {
13696 pop(didPerformWorkStackCursor, workInProgress);
13697 push(didPerformWorkStackCursor, didChange, workInProgress);
13698 }
13699 }
13700
13701 function findCurrentUnmaskedContext(fiber) {
13702 // Currently this is only used with renderSubtreeIntoContainer; not sure if it
13703 // makes sense elsewhere
13704 !(isFiberMounted(fiber) && fiber.tag === ClassComponent) ? invariant(false, 'Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13705
13706 var node = fiber;
13707 while (node.tag !== HostRoot) {
13708 if (isContextProvider(node)) {
13709 return node.stateNode.__reactInternalMemoizedMergedChildContext;
13710 }
13711 var parent = node['return'];
13712 !parent ? invariant(false, 'Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13713 node = parent;
13714 }
13715 return node.stateNode.context;
13716 }
13717
13718 return {
13719 getUnmaskedContext: getUnmaskedContext,
13720 cacheContext: cacheContext,
13721 getMaskedContext: getMaskedContext,
13722 hasContextChanged: hasContextChanged,
13723 isContextConsumer: isContextConsumer,
13724 isContextProvider: isContextProvider,
13725 popContextProvider: popContextProvider,
13726 popTopLevelContextObject: popTopLevelContextObject,
13727 pushTopLevelContextObject: pushTopLevelContextObject,
13728 processChildContext: processChildContext,
13729 pushContextProvider: pushContextProvider,
13730 invalidateContextProvider: invalidateContextProvider,
13731 findCurrentUnmaskedContext: findCurrentUnmaskedContext
13732 };
13733 };
13734
13735 var ReactFiberNewContext = function (stack) {
13736 var createCursor = stack.createCursor,
13737 push = stack.push,
13738 pop = stack.pop;
13739
13740
13741 var providerCursor = createCursor(null);
13742 var valueCursor = createCursor(null);
13743 var changedBitsCursor = createCursor(0);
13744
13745 var rendererSigil = void 0;
13746 {
13747 // Use this to detect multiple renderers using the same context
13748 rendererSigil = {};
13749 }
13750
13751 function pushProvider(providerFiber) {
13752 var context = providerFiber.type._context;
13753
13754 push(changedBitsCursor, context._changedBits, providerFiber);
13755 push(valueCursor, context._currentValue, providerFiber);
13756 push(providerCursor, providerFiber, providerFiber);
13757
13758 context._currentValue = providerFiber.pendingProps.value;
13759 context._changedBits = providerFiber.stateNode;
13760
13761 {
13762 !(context._currentRenderer === null || context._currentRenderer === rendererSigil) ? warning(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
13763 context._currentRenderer = rendererSigil;
13764 }
13765 }
13766
13767 function popProvider(providerFiber) {
13768 var changedBits = changedBitsCursor.current;
13769 var currentValue = valueCursor.current;
13770
13771 pop(providerCursor, providerFiber);
13772 pop(valueCursor, providerFiber);
13773 pop(changedBitsCursor, providerFiber);
13774
13775 var context = providerFiber.type._context;
13776 context._currentValue = currentValue;
13777 context._changedBits = changedBits;
13778 }
13779
13780 return {
13781 pushProvider: pushProvider,
13782 popProvider: popProvider
13783 };
13784 };
13785
13786 var ReactFiberStack = function () {
13787 var valueStack = [];
13788
13789 var fiberStack = void 0;
13790
13791 {
13792 fiberStack = [];
13793 }
13794
13795 var index = -1;
13796
13797 function createCursor(defaultValue) {
13798 return {
13799 current: defaultValue
13800 };
13801 }
13802
13803 function isEmpty() {
13804 return index === -1;
13805 }
13806
13807 function pop(cursor, fiber) {
13808 if (index < 0) {
13809 {
13810 warning(false, 'Unexpected pop.');
13811 }
13812 return;
13813 }
13814
13815 {
13816 if (fiber !== fiberStack[index]) {
13817 warning(false, 'Unexpected Fiber popped.');
13818 }
13819 }
13820
13821 cursor.current = valueStack[index];
13822
13823 valueStack[index] = null;
13824
13825 {
13826 fiberStack[index] = null;
13827 }
13828
13829 index--;
13830 }
13831
13832 function push(cursor, value, fiber) {
13833 index++;
13834
13835 valueStack[index] = cursor.current;
13836
13837 {
13838 fiberStack[index] = fiber;
13839 }
13840
13841 cursor.current = value;
13842 }
13843
13844 function checkThatStackIsEmpty() {
13845 {
13846 if (index !== -1) {
13847 warning(false, 'Expected an empty stack. Something was not reset properly.');
13848 }
13849 }
13850 }
13851
13852 function resetStackAfterFatalErrorInDev() {
13853 {
13854 index = -1;
13855 valueStack.length = 0;
13856 fiberStack.length = 0;
13857 }
13858 }
13859
13860 return {
13861 createCursor: createCursor,
13862 isEmpty: isEmpty,
13863 pop: pop,
13864 push: push,
13865 checkThatStackIsEmpty: checkThatStackIsEmpty,
13866 resetStackAfterFatalErrorInDev: resetStackAfterFatalErrorInDev
13867 };
13868 };
13869
13870 var invokeGuardedCallback$2 = ReactErrorUtils.invokeGuardedCallback;
13871 var hasCaughtError = ReactErrorUtils.hasCaughtError;
13872 var clearCaughtError = ReactErrorUtils.clearCaughtError;
13873
13874
13875 var didWarnAboutStateTransition = void 0;
13876 var didWarnSetStateChildContext = void 0;
13877 var warnAboutUpdateOnUnmounted = void 0;
13878 var warnAboutInvalidUpdates = void 0;
13879
13880 {
13881 didWarnAboutStateTransition = false;
13882 didWarnSetStateChildContext = false;
13883 var didWarnStateUpdateForUnmountedComponent = {};
13884
13885 warnAboutUpdateOnUnmounted = function (fiber) {
13886 // We show the whole stack but dedupe on the top component's name because
13887 // the problematic code almost always lies inside that component.
13888 var componentName = getComponentName(fiber) || 'ReactClass';
13889 if (didWarnStateUpdateForUnmountedComponent[componentName]) {
13890 return;
13891 }
13892 warning(false, "Can't call setState (or forceUpdate) on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in the ' + 'componentWillUnmount method.%s', getStackAddendumByWorkInProgressFiber(fiber));
13893 didWarnStateUpdateForUnmountedComponent[componentName] = true;
13894 };
13895
13896 warnAboutInvalidUpdates = function (instance) {
13897 switch (ReactDebugCurrentFiber.phase) {
13898 case 'getChildContext':
13899 if (didWarnSetStateChildContext) {
13900 return;
13901 }
13902 warning(false, 'setState(...): Cannot call setState() inside getChildContext()');
13903 didWarnSetStateChildContext = true;
13904 break;
13905 case 'render':
13906 if (didWarnAboutStateTransition) {
13907 return;
13908 }
13909 warning(false, 'Cannot update during an existing state transition (such as within ' + "`render` or another component's constructor). Render methods should " + 'be a pure function of props and state; constructor side-effects are ' + 'an anti-pattern, but can be moved to `componentWillMount`.');
13910 didWarnAboutStateTransition = true;
13911 break;
13912 }
13913 };
13914 }
13915
13916 var ReactFiberScheduler = function (config) {
13917 var stack = ReactFiberStack();
13918 var hostContext = ReactFiberHostContext(config, stack);
13919 var legacyContext = ReactFiberLegacyContext(stack);
13920 var newContext = ReactFiberNewContext(stack);
13921 var popHostContext = hostContext.popHostContext,
13922 popHostContainer = hostContext.popHostContainer;
13923 var popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject,
13924 popLegacyContextProvider = legacyContext.popContextProvider;
13925 var popProvider = newContext.popProvider;
13926
13927 var hydrationContext = ReactFiberHydrationContext(config);
13928
13929 var _ReactFiberBeginWork = ReactFiberBeginWork(config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber),
13930 beginWork = _ReactFiberBeginWork.beginWork;
13931
13932 var _ReactFiberCompleteWo = ReactFiberCompleteWork(config, hostContext, legacyContext, newContext, hydrationContext),
13933 completeWork = _ReactFiberCompleteWo.completeWork;
13934
13935 var _ReactFiberUnwindWork = ReactFiberUnwindWork(hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary),
13936 throwException = _ReactFiberUnwindWork.throwException,
13937 unwindWork = _ReactFiberUnwindWork.unwindWork,
13938 unwindInterruptedWork = _ReactFiberUnwindWork.unwindInterruptedWork;
13939
13940 var _ReactFiberCommitWork = ReactFiberCommitWork(config, onCommitPhaseError, scheduleWork, computeExpirationForFiber, markLegacyErrorBoundaryAsFailed, recalculateCurrentTime),
13941 commitBeforeMutationLifeCycles = _ReactFiberCommitWork.commitBeforeMutationLifeCycles,
13942 commitResetTextContent = _ReactFiberCommitWork.commitResetTextContent,
13943 commitPlacement = _ReactFiberCommitWork.commitPlacement,
13944 commitDeletion = _ReactFiberCommitWork.commitDeletion,
13945 commitWork = _ReactFiberCommitWork.commitWork,
13946 commitLifeCycles = _ReactFiberCommitWork.commitLifeCycles,
13947 commitErrorLogging = _ReactFiberCommitWork.commitErrorLogging,
13948 commitAttachRef = _ReactFiberCommitWork.commitAttachRef,
13949 commitDetachRef = _ReactFiberCommitWork.commitDetachRef;
13950
13951 var now = config.now,
13952 scheduleDeferredCallback = config.scheduleDeferredCallback,
13953 cancelDeferredCallback = config.cancelDeferredCallback,
13954 prepareForCommit = config.prepareForCommit,
13955 resetAfterCommit = config.resetAfterCommit;
13956
13957 // Represents the current time in ms.
13958
13959 var originalStartTimeMs = now();
13960 var mostRecentCurrentTime = msToExpirationTime(0);
13961 var mostRecentCurrentTimeMs = originalStartTimeMs;
13962
13963 // Used to ensure computeUniqueAsyncExpiration is monotonically increases.
13964 var lastUniqueAsyncExpiration = 0;
13965
13966 // Represents the expiration time that incoming updates should use. (If this
13967 // is NoWork, use the default strategy: async updates in async mode, sync
13968 // updates in sync mode.)
13969 var expirationContext = NoWork;
13970
13971 var isWorking = false;
13972
13973 // The next work in progress fiber that we're currently working on.
13974 var nextUnitOfWork = null;
13975 var nextRoot = null;
13976 // The time at which we're currently rendering work.
13977 var nextRenderExpirationTime = NoWork;
13978
13979 // The next fiber with an effect that we're currently committing.
13980 var nextEffect = null;
13981
13982 var isCommitting = false;
13983
13984 var isRootReadyForCommit = false;
13985
13986 var legacyErrorBoundariesThatAlreadyFailed = null;
13987
13988 // Used for performance tracking.
13989 var interruptedBy = null;
13990
13991 var stashedWorkInProgressProperties = void 0;
13992 var replayUnitOfWork = void 0;
13993 var isReplayingFailedUnitOfWork = void 0;
13994 var originalReplayError = void 0;
13995 var rethrowOriginalError = void 0;
13996 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
13997 stashedWorkInProgressProperties = null;
13998 isReplayingFailedUnitOfWork = false;
13999 originalReplayError = null;
14000 replayUnitOfWork = function (failedUnitOfWork, error, isAsync) {
14001 // Restore the original state of the work-in-progress
14002 assignFiberPropertiesInDEV(failedUnitOfWork, stashedWorkInProgressProperties);
14003 switch (failedUnitOfWork.tag) {
14004 case HostRoot:
14005 popHostContainer(failedUnitOfWork);
14006 popTopLevelLegacyContextObject(failedUnitOfWork);
14007 break;
14008 case HostComponent:
14009 popHostContext(failedUnitOfWork);
14010 break;
14011 case ClassComponent:
14012 popLegacyContextProvider(failedUnitOfWork);
14013 break;
14014 case HostPortal:
14015 popHostContainer(failedUnitOfWork);
14016 break;
14017 case ContextProvider:
14018 popProvider(failedUnitOfWork);
14019 break;
14020 }
14021 // Replay the begin phase.
14022 isReplayingFailedUnitOfWork = true;
14023 originalReplayError = error;
14024 invokeGuardedCallback$2(null, workLoop, null, isAsync);
14025 isReplayingFailedUnitOfWork = false;
14026 originalReplayError = null;
14027 if (hasCaughtError()) {
14028 clearCaughtError();
14029 } else {
14030 // If the begin phase did not fail the second time, set this pointer
14031 // back to the original value.
14032 nextUnitOfWork = failedUnitOfWork;
14033 }
14034 };
14035 rethrowOriginalError = function () {
14036 throw originalReplayError;
14037 };
14038 }
14039
14040 function resetStack() {
14041 if (nextUnitOfWork !== null) {
14042 var interruptedWork = nextUnitOfWork['return'];
14043 while (interruptedWork !== null) {
14044 unwindInterruptedWork(interruptedWork);
14045 interruptedWork = interruptedWork['return'];
14046 }
14047 }
14048
14049 {
14050 ReactStrictModeWarnings.discardPendingWarnings();
14051 stack.checkThatStackIsEmpty();
14052 }
14053
14054 nextRoot = null;
14055 nextRenderExpirationTime = NoWork;
14056 nextUnitOfWork = null;
14057
14058 isRootReadyForCommit = false;
14059 }
14060
14061 function commitAllHostEffects() {
14062 while (nextEffect !== null) {
14063 {
14064 ReactDebugCurrentFiber.setCurrentFiber(nextEffect);
14065 }
14066 recordEffect();
14067
14068 var effectTag = nextEffect.effectTag;
14069
14070 if (effectTag & ContentReset) {
14071 commitResetTextContent(nextEffect);
14072 }
14073
14074 if (effectTag & Ref) {
14075 var current = nextEffect.alternate;
14076 if (current !== null) {
14077 commitDetachRef(current);
14078 }
14079 }
14080
14081 // The following switch statement is only concerned about placement,
14082 // updates, and deletions. To avoid needing to add a case for every
14083 // possible bitmap value, we remove the secondary effects from the
14084 // effect tag and switch on that value.
14085 var primaryEffectTag = effectTag & (Placement | Update | Deletion);
14086 switch (primaryEffectTag) {
14087 case Placement:
14088 {
14089 commitPlacement(nextEffect);
14090 // Clear the "placement" from effect tag so that we know that this is inserted, before
14091 // any life-cycles like componentDidMount gets called.
14092 // TODO: findDOMNode doesn't rely on this any more but isMounted
14093 // does and isMounted is deprecated anyway so we should be able
14094 // to kill this.
14095 nextEffect.effectTag &= ~Placement;
14096 break;
14097 }
14098 case PlacementAndUpdate:
14099 {
14100 // Placement
14101 commitPlacement(nextEffect);
14102 // Clear the "placement" from effect tag so that we know that this is inserted, before
14103 // any life-cycles like componentDidMount gets called.
14104 nextEffect.effectTag &= ~Placement;
14105
14106 // Update
14107 var _current = nextEffect.alternate;
14108 commitWork(_current, nextEffect);
14109 break;
14110 }
14111 case Update:
14112 {
14113 var _current2 = nextEffect.alternate;
14114 commitWork(_current2, nextEffect);
14115 break;
14116 }
14117 case Deletion:
14118 {
14119 commitDeletion(nextEffect);
14120 break;
14121 }
14122 }
14123 nextEffect = nextEffect.nextEffect;
14124 }
14125
14126 {
14127 ReactDebugCurrentFiber.resetCurrentFiber();
14128 }
14129 }
14130
14131 function commitBeforeMutationLifecycles() {
14132 while (nextEffect !== null) {
14133 var effectTag = nextEffect.effectTag;
14134
14135 if (effectTag & Snapshot) {
14136 recordEffect();
14137 var current = nextEffect.alternate;
14138 commitBeforeMutationLifeCycles(current, nextEffect);
14139 }
14140
14141 // Don't cleanup effects yet;
14142 // This will be done by commitAllLifeCycles()
14143 nextEffect = nextEffect.nextEffect;
14144 }
14145 }
14146
14147 function commitAllLifeCycles(finishedRoot, currentTime, committedExpirationTime) {
14148 {
14149 ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
14150
14151 if (warnAboutDeprecatedLifecycles) {
14152 ReactStrictModeWarnings.flushPendingDeprecationWarnings();
14153 }
14154 }
14155 while (nextEffect !== null) {
14156 var effectTag = nextEffect.effectTag;
14157
14158 if (effectTag & (Update | Callback)) {
14159 recordEffect();
14160 var current = nextEffect.alternate;
14161 commitLifeCycles(finishedRoot, current, nextEffect, currentTime, committedExpirationTime);
14162 }
14163
14164 if (effectTag & ErrLog) {
14165 commitErrorLogging(nextEffect, onUncaughtError);
14166 }
14167
14168 if (effectTag & Ref) {
14169 recordEffect();
14170 commitAttachRef(nextEffect);
14171 }
14172
14173 var next = nextEffect.nextEffect;
14174 // Ensure that we clean these up so that we don't accidentally keep them.
14175 // I'm not actually sure this matters because we can't reset firstEffect
14176 // and lastEffect since they're on every node, not just the effectful
14177 // ones. So we have to clean everything as we reuse nodes anyway.
14178 nextEffect.nextEffect = null;
14179 // Ensure that we reset the effectTag here so that we can rely on effect
14180 // tags to reason about the current life-cycle.
14181 nextEffect = next;
14182 }
14183 }
14184
14185 function isAlreadyFailedLegacyErrorBoundary(instance) {
14186 return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
14187 }
14188
14189 function markLegacyErrorBoundaryAsFailed(instance) {
14190 if (legacyErrorBoundariesThatAlreadyFailed === null) {
14191 legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
14192 } else {
14193 legacyErrorBoundariesThatAlreadyFailed.add(instance);
14194 }
14195 }
14196
14197 function commitRoot(finishedWork) {
14198 isWorking = true;
14199 isCommitting = true;
14200 startCommitTimer();
14201
14202 var root = finishedWork.stateNode;
14203 !(root.current !== finishedWork) ? invariant(false, 'Cannot commit the same tree as before. This is probably a bug related to the return field. This error is likely caused by a bug in React. Please file an issue.') : void 0;
14204 var committedExpirationTime = root.pendingCommitExpirationTime;
14205 !(committedExpirationTime !== NoWork) ? invariant(false, 'Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
14206 root.pendingCommitExpirationTime = NoWork;
14207
14208 var currentTime = recalculateCurrentTime();
14209
14210 // Reset this to null before calling lifecycles
14211 ReactCurrentOwner.current = null;
14212
14213 var firstEffect = void 0;
14214 if (finishedWork.effectTag > PerformedWork) {
14215 // A fiber's effect list consists only of its children, not itself. So if
14216 // the root has an effect, we need to add it to the end of the list. The
14217 // resulting list is the set that would belong to the root's parent, if
14218 // it had one; that is, all the effects in the tree including the root.
14219 if (finishedWork.lastEffect !== null) {
14220 finishedWork.lastEffect.nextEffect = finishedWork;
14221 firstEffect = finishedWork.firstEffect;
14222 } else {
14223 firstEffect = finishedWork;
14224 }
14225 } else {
14226 // There is no effect on the root.
14227 firstEffect = finishedWork.firstEffect;
14228 }
14229
14230 prepareForCommit(root.containerInfo);
14231
14232 // Invoke instances of getSnapshotBeforeUpdate before mutation.
14233 nextEffect = firstEffect;
14234 startCommitSnapshotEffectsTimer();
14235 while (nextEffect !== null) {
14236 var didError = false;
14237 var error = void 0;
14238 {
14239 invokeGuardedCallback$2(null, commitBeforeMutationLifecycles, null);
14240 if (hasCaughtError()) {
14241 didError = true;
14242 error = clearCaughtError();
14243 }
14244 }
14245 if (didError) {
14246 !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
14247 onCommitPhaseError(nextEffect, error);
14248 // Clean-up
14249 if (nextEffect !== null) {
14250 nextEffect = nextEffect.nextEffect;
14251 }
14252 }
14253 }
14254 stopCommitSnapshotEffectsTimer();
14255
14256 // Commit all the side-effects within a tree. We'll do this in two passes.
14257 // The first pass performs all the host insertions, updates, deletions and
14258 // ref unmounts.
14259 nextEffect = firstEffect;
14260 startCommitHostEffectsTimer();
14261 while (nextEffect !== null) {
14262 var _didError = false;
14263 var _error = void 0;
14264 {
14265 invokeGuardedCallback$2(null, commitAllHostEffects, null);
14266 if (hasCaughtError()) {
14267 _didError = true;
14268 _error = clearCaughtError();
14269 }
14270 }
14271 if (_didError) {
14272 !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
14273 onCommitPhaseError(nextEffect, _error);
14274 // Clean-up
14275 if (nextEffect !== null) {
14276 nextEffect = nextEffect.nextEffect;
14277 }
14278 }
14279 }
14280 stopCommitHostEffectsTimer();
14281
14282 resetAfterCommit(root.containerInfo);
14283
14284 // The work-in-progress tree is now the current tree. This must come after
14285 // the first pass of the commit phase, so that the previous tree is still
14286 // current during componentWillUnmount, but before the second pass, so that
14287 // the finished work is current during componentDidMount/Update.
14288 root.current = finishedWork;
14289
14290 // In the second pass we'll perform all life-cycles and ref callbacks.
14291 // Life-cycles happen as a separate pass so that all placements, updates,
14292 // and deletions in the entire tree have already been invoked.
14293 // This pass also triggers any renderer-specific initial effects.
14294 nextEffect = firstEffect;
14295 startCommitLifeCyclesTimer();
14296 while (nextEffect !== null) {
14297 var _didError2 = false;
14298 var _error2 = void 0;
14299 {
14300 invokeGuardedCallback$2(null, commitAllLifeCycles, null, root, currentTime, committedExpirationTime);
14301 if (hasCaughtError()) {
14302 _didError2 = true;
14303 _error2 = clearCaughtError();
14304 }
14305 }
14306 if (_didError2) {
14307 !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
14308 onCommitPhaseError(nextEffect, _error2);
14309 if (nextEffect !== null) {
14310 nextEffect = nextEffect.nextEffect;
14311 }
14312 }
14313 }
14314
14315 isCommitting = false;
14316 isWorking = false;
14317 stopCommitLifeCyclesTimer();
14318 stopCommitTimer();
14319 if (typeof onCommitRoot === 'function') {
14320 onCommitRoot(finishedWork.stateNode);
14321 }
14322 if (true && ReactFiberInstrumentation_1.debugTool) {
14323 ReactFiberInstrumentation_1.debugTool.onCommitWork(finishedWork);
14324 }
14325
14326 var remainingTime = root.current.expirationTime;
14327 if (remainingTime === NoWork) {
14328 // If there's no remaining work, we can clear the set of already failed
14329 // error boundaries.
14330 legacyErrorBoundariesThatAlreadyFailed = null;
14331 }
14332 return remainingTime;
14333 }
14334
14335 function resetExpirationTime(workInProgress, renderTime) {
14336 if (renderTime !== Never && workInProgress.expirationTime === Never) {
14337 // The children of this component are hidden. Don't bubble their
14338 // expiration times.
14339 return;
14340 }
14341
14342 // Check for pending updates.
14343 var newExpirationTime = getUpdateExpirationTime(workInProgress);
14344
14345 // TODO: Calls need to visit stateNode
14346
14347 // Bubble up the earliest expiration time.
14348 var child = workInProgress.child;
14349 while (child !== null) {
14350 if (child.expirationTime !== NoWork && (newExpirationTime === NoWork || newExpirationTime > child.expirationTime)) {
14351 newExpirationTime = child.expirationTime;
14352 }
14353 child = child.sibling;
14354 }
14355 workInProgress.expirationTime = newExpirationTime;
14356 }
14357
14358 function completeUnitOfWork(workInProgress) {
14359 // Attempt to complete the current unit of work, then move to the
14360 // next sibling. If there are no more siblings, return to the
14361 // parent fiber.
14362 while (true) {
14363 // The current, flushed, state of this fiber is the alternate.
14364 // Ideally nothing should rely on this, but relying on it here
14365 // means that we don't need an additional field on the work in
14366 // progress.
14367 var current = workInProgress.alternate;
14368 {
14369 ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
14370 }
14371
14372 var returnFiber = workInProgress['return'];
14373 var siblingFiber = workInProgress.sibling;
14374
14375 if ((workInProgress.effectTag & Incomplete) === NoEffect) {
14376 // This fiber completed.
14377 var next = completeWork(current, workInProgress, nextRenderExpirationTime);
14378 stopWorkTimer(workInProgress);
14379 resetExpirationTime(workInProgress, nextRenderExpirationTime);
14380 {
14381 ReactDebugCurrentFiber.resetCurrentFiber();
14382 }
14383
14384 if (next !== null) {
14385 stopWorkTimer(workInProgress);
14386 if (true && ReactFiberInstrumentation_1.debugTool) {
14387 ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
14388 }
14389 // If completing this work spawned new work, do that next. We'll come
14390 // back here again.
14391 return next;
14392 }
14393
14394 if (returnFiber !== null &&
14395 // Do not append effects to parents if a sibling failed to complete
14396 (returnFiber.effectTag & Incomplete) === NoEffect) {
14397 // Append all the effects of the subtree and this fiber onto the effect
14398 // list of the parent. The completion order of the children affects the
14399 // side-effect order.
14400 if (returnFiber.firstEffect === null) {
14401 returnFiber.firstEffect = workInProgress.firstEffect;
14402 }
14403 if (workInProgress.lastEffect !== null) {
14404 if (returnFiber.lastEffect !== null) {
14405 returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
14406 }
14407 returnFiber.lastEffect = workInProgress.lastEffect;
14408 }
14409
14410 // If this fiber had side-effects, we append it AFTER the children's
14411 // side-effects. We can perform certain side-effects earlier if
14412 // needed, by doing multiple passes over the effect list. We don't want
14413 // to schedule our own side-effect on our own list because if end up
14414 // reusing children we'll schedule this effect onto itself since we're
14415 // at the end.
14416 var effectTag = workInProgress.effectTag;
14417 // Skip both NoWork and PerformedWork tags when creating the effect list.
14418 // PerformedWork effect is read by React DevTools but shouldn't be committed.
14419 if (effectTag > PerformedWork) {
14420 if (returnFiber.lastEffect !== null) {
14421 returnFiber.lastEffect.nextEffect = workInProgress;
14422 } else {
14423 returnFiber.firstEffect = workInProgress;
14424 }
14425 returnFiber.lastEffect = workInProgress;
14426 }
14427 }
14428
14429 if (true && ReactFiberInstrumentation_1.debugTool) {
14430 ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
14431 }
14432
14433 if (siblingFiber !== null) {
14434 // If there is more work to do in this returnFiber, do that next.
14435 return siblingFiber;
14436 } else if (returnFiber !== null) {
14437 // If there's no more work in this returnFiber. Complete the returnFiber.
14438 workInProgress = returnFiber;
14439 continue;
14440 } else {
14441 // We've reached the root.
14442 isRootReadyForCommit = true;
14443 return null;
14444 }
14445 } else {
14446 // This fiber did not complete because something threw. Pop values off
14447 // the stack without entering the complete phase. If this is a boundary,
14448 // capture values if possible.
14449 var _next = unwindWork(workInProgress);
14450 // Because this fiber did not complete, don't reset its expiration time.
14451 if (workInProgress.effectTag & DidCapture) {
14452 // Restarting an error boundary
14453 stopFailedWorkTimer(workInProgress);
14454 } else {
14455 stopWorkTimer(workInProgress);
14456 }
14457
14458 {
14459 ReactDebugCurrentFiber.resetCurrentFiber();
14460 }
14461
14462 if (_next !== null) {
14463 stopWorkTimer(workInProgress);
14464 if (true && ReactFiberInstrumentation_1.debugTool) {
14465 ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
14466 }
14467 // If completing this work spawned new work, do that next. We'll come
14468 // back here again.
14469 // Since we're restarting, remove anything that is not a host effect
14470 // from the effect tag.
14471 _next.effectTag &= HostEffectMask;
14472 return _next;
14473 }
14474
14475 if (returnFiber !== null) {
14476 // Mark the parent fiber as incomplete and clear its effect list.
14477 returnFiber.firstEffect = returnFiber.lastEffect = null;
14478 returnFiber.effectTag |= Incomplete;
14479 }
14480
14481 if (true && ReactFiberInstrumentation_1.debugTool) {
14482 ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
14483 }
14484
14485 if (siblingFiber !== null) {
14486 // If there is more work to do in this returnFiber, do that next.
14487 return siblingFiber;
14488 } else if (returnFiber !== null) {
14489 // If there's no more work in this returnFiber. Complete the returnFiber.
14490 workInProgress = returnFiber;
14491 continue;
14492 } else {
14493 return null;
14494 }
14495 }
14496 }
14497
14498 // Without this explicit null return Flow complains of invalid return type
14499 // TODO Remove the above while(true) loop
14500 // eslint-disable-next-line no-unreachable
14501 return null;
14502 }
14503
14504 function performUnitOfWork(workInProgress) {
14505 // The current, flushed, state of this fiber is the alternate.
14506 // Ideally nothing should rely on this, but relying on it here
14507 // means that we don't need an additional field on the work in
14508 // progress.
14509 var current = workInProgress.alternate;
14510
14511 // See if beginning this work spawns more work.
14512 startWorkTimer(workInProgress);
14513 {
14514 ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
14515 }
14516
14517 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
14518 stashedWorkInProgressProperties = assignFiberPropertiesInDEV(stashedWorkInProgressProperties, workInProgress);
14519 }
14520 var next = beginWork(current, workInProgress, nextRenderExpirationTime);
14521 {
14522 ReactDebugCurrentFiber.resetCurrentFiber();
14523 if (isReplayingFailedUnitOfWork) {
14524 // Currently replaying a failed unit of work. This should be unreachable,
14525 // because the render phase is meant to be idempotent, and it should
14526 // have thrown again. Since it didn't, rethrow the original error, so
14527 // React's internal stack is not misaligned.
14528 rethrowOriginalError();
14529 }
14530 }
14531 if (true && ReactFiberInstrumentation_1.debugTool) {
14532 ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress);
14533 }
14534
14535 if (next === null) {
14536 // If this doesn't spawn new work, complete the current work.
14537 next = completeUnitOfWork(workInProgress);
14538 }
14539
14540 ReactCurrentOwner.current = null;
14541
14542 return next;
14543 }
14544
14545 function workLoop(isAsync) {
14546 if (!isAsync) {
14547 // Flush all expired work.
14548 while (nextUnitOfWork !== null) {
14549 nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
14550 }
14551 } else {
14552 // Flush asynchronous work until the deadline runs out of time.
14553 while (nextUnitOfWork !== null && !shouldYield()) {
14554 nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
14555 }
14556 }
14557 }
14558
14559 function renderRoot(root, expirationTime, isAsync) {
14560 !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
14561 isWorking = true;
14562
14563 // Check if we're starting from a fresh stack, or if we're resuming from
14564 // previously yielded work.
14565 if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
14566 // Reset the stack and start working from the root.
14567 resetStack();
14568 nextRoot = root;
14569 nextRenderExpirationTime = expirationTime;
14570 nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime);
14571 root.pendingCommitExpirationTime = NoWork;
14572 }
14573
14574 var didFatal = false;
14575
14576 startWorkLoopTimer(nextUnitOfWork);
14577
14578 do {
14579 try {
14580 workLoop(isAsync);
14581 } catch (thrownValue) {
14582 if (nextUnitOfWork === null) {
14583 // This is a fatal error.
14584 didFatal = true;
14585 onUncaughtError(thrownValue);
14586 break;
14587 }
14588
14589 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
14590 var failedUnitOfWork = nextUnitOfWork;
14591 replayUnitOfWork(failedUnitOfWork, thrownValue, isAsync);
14592 }
14593
14594 var sourceFiber = nextUnitOfWork;
14595 var returnFiber = sourceFiber['return'];
14596 if (returnFiber === null) {
14597 // This is the root. The root could capture its own errors. However,
14598 // we don't know if it errors before or after we pushed the host
14599 // context. This information is needed to avoid a stack mismatch.
14600 // Because we're not sure, treat this as a fatal error. We could track
14601 // which phase it fails in, but doesn't seem worth it. At least
14602 // for now.
14603 didFatal = true;
14604 onUncaughtError(thrownValue);
14605 break;
14606 }
14607 throwException(returnFiber, sourceFiber, thrownValue);
14608 nextUnitOfWork = completeUnitOfWork(sourceFiber);
14609 }
14610 break;
14611 } while (true);
14612
14613 // We're done performing work. Time to clean up.
14614 var didCompleteRoot = false;
14615 isWorking = false;
14616
14617 // Yield back to main thread.
14618 if (didFatal) {
14619 stopWorkLoopTimer(interruptedBy, didCompleteRoot);
14620 interruptedBy = null;
14621 // There was a fatal error.
14622 {
14623 stack.resetStackAfterFatalErrorInDev();
14624 }
14625 return null;
14626 } else if (nextUnitOfWork === null) {
14627 // We reached the root.
14628 if (isRootReadyForCommit) {
14629 didCompleteRoot = true;
14630 stopWorkLoopTimer(interruptedBy, didCompleteRoot);
14631 interruptedBy = null;
14632 // The root successfully completed. It's ready for commit.
14633 root.pendingCommitExpirationTime = expirationTime;
14634 var finishedWork = root.current.alternate;
14635 return finishedWork;
14636 } else {
14637 // The root did not complete.
14638 stopWorkLoopTimer(interruptedBy, didCompleteRoot);
14639 interruptedBy = null;
14640 invariant(false, 'Expired work should have completed. This error is likely caused by a bug in React. Please file an issue.');
14641 }
14642 } else {
14643 stopWorkLoopTimer(interruptedBy, didCompleteRoot);
14644 interruptedBy = null;
14645 // There's more work to do, but we ran out of time. Yield back to
14646 // the renderer.
14647 return null;
14648 }
14649 }
14650
14651 function scheduleCapture(sourceFiber, boundaryFiber, value, expirationTime) {
14652 // TODO: We only support dispatching errors.
14653 var capturedValue = createCapturedValue(value, sourceFiber);
14654 var update = {
14655 expirationTime: expirationTime,
14656 partialState: null,
14657 callback: null,
14658 isReplace: false,
14659 isForced: false,
14660 capturedValue: capturedValue,
14661 next: null
14662 };
14663 insertUpdateIntoFiber(boundaryFiber, update);
14664 scheduleWork(boundaryFiber, expirationTime);
14665 }
14666
14667 function dispatch(sourceFiber, value, expirationTime) {
14668 !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0;
14669
14670 // TODO: Handle arrays
14671
14672 var fiber = sourceFiber['return'];
14673 while (fiber !== null) {
14674 switch (fiber.tag) {
14675 case ClassComponent:
14676 var ctor = fiber.type;
14677 var instance = fiber.stateNode;
14678 if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
14679 scheduleCapture(sourceFiber, fiber, value, expirationTime);
14680 return;
14681 }
14682 break;
14683 // TODO: Handle async boundaries
14684 case HostRoot:
14685 scheduleCapture(sourceFiber, fiber, value, expirationTime);
14686 return;
14687 }
14688 fiber = fiber['return'];
14689 }
14690
14691 if (sourceFiber.tag === HostRoot) {
14692 // Error was thrown at the root. There is no parent, so the root
14693 // itself should capture it.
14694 scheduleCapture(sourceFiber, sourceFiber, value, expirationTime);
14695 }
14696 }
14697
14698 function onCommitPhaseError(fiber, error) {
14699 return dispatch(fiber, error, Sync);
14700 }
14701
14702 function computeAsyncExpiration(currentTime) {
14703 // Given the current clock time, returns an expiration time. We use rounding
14704 // to batch like updates together.
14705 // Should complete within ~1000ms. 1200ms max.
14706 var expirationMs = 5000;
14707 var bucketSizeMs = 250;
14708 return computeExpirationBucket(currentTime, expirationMs, bucketSizeMs);
14709 }
14710
14711 function computeInteractiveExpiration(currentTime) {
14712 var expirationMs = void 0;
14713 // We intentionally set a higher expiration time for interactive updates in
14714 // dev than in production.
14715 // If the main thread is being blocked so long that you hit the expiration,
14716 // it's a problem that could be solved with better scheduling.
14717 // People will be more likely to notice this and fix it with the long
14718 // expiration time in development.
14719 // In production we opt for better UX at the risk of masking scheduling
14720 // problems, by expiring fast.
14721 {
14722 // Should complete within ~500ms. 600ms max.
14723 expirationMs = 500;
14724 }
14725 var bucketSizeMs = 100;
14726 return computeExpirationBucket(currentTime, expirationMs, bucketSizeMs);
14727 }
14728
14729 // Creates a unique async expiration time.
14730 function computeUniqueAsyncExpiration() {
14731 var currentTime = recalculateCurrentTime();
14732 var result = computeAsyncExpiration(currentTime);
14733 if (result <= lastUniqueAsyncExpiration) {
14734 // Since we assume the current time monotonically increases, we only hit
14735 // this branch when computeUniqueAsyncExpiration is fired multiple times
14736 // within a 200ms window (or whatever the async bucket size is).
14737 result = lastUniqueAsyncExpiration + 1;
14738 }
14739 lastUniqueAsyncExpiration = result;
14740 return lastUniqueAsyncExpiration;
14741 }
14742
14743 function computeExpirationForFiber(fiber) {
14744 var expirationTime = void 0;
14745 if (expirationContext !== NoWork) {
14746 // An explicit expiration context was set;
14747 expirationTime = expirationContext;
14748 } else if (isWorking) {
14749 if (isCommitting) {
14750 // Updates that occur during the commit phase should have sync priority
14751 // by default.
14752 expirationTime = Sync;
14753 } else {
14754 // Updates during the render phase should expire at the same time as
14755 // the work that is being rendered.
14756 expirationTime = nextRenderExpirationTime;
14757 }
14758 } else {
14759 // No explicit expiration context was set, and we're not currently
14760 // performing work. Calculate a new expiration time.
14761 if (fiber.mode & AsyncMode) {
14762 if (isBatchingInteractiveUpdates) {
14763 // This is an interactive update
14764 var currentTime = recalculateCurrentTime();
14765 expirationTime = computeInteractiveExpiration(currentTime);
14766 } else {
14767 // This is an async update
14768 var _currentTime = recalculateCurrentTime();
14769 expirationTime = computeAsyncExpiration(_currentTime);
14770 }
14771 } else {
14772 // This is a sync update
14773 expirationTime = Sync;
14774 }
14775 }
14776 if (isBatchingInteractiveUpdates) {
14777 // This is an interactive update. Keep track of the lowest pending
14778 // interactive expiration time. This allows us to synchronously flush
14779 // all interactive updates when needed.
14780 if (lowestPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPendingInteractiveExpirationTime) {
14781 lowestPendingInteractiveExpirationTime = expirationTime;
14782 }
14783 }
14784 return expirationTime;
14785 }
14786
14787 function scheduleWork(fiber, expirationTime) {
14788 return scheduleWorkImpl(fiber, expirationTime, false);
14789 }
14790
14791 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
14792 recordScheduleUpdate();
14793
14794 {
14795 if (!isErrorRecovery && fiber.tag === ClassComponent) {
14796 var instance = fiber.stateNode;
14797 warnAboutInvalidUpdates(instance);
14798 }
14799 }
14800
14801 var node = fiber;
14802 while (node !== null) {
14803 // Walk the parent path to the root and update each node's
14804 // expiration time.
14805 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
14806 node.expirationTime = expirationTime;
14807 }
14808 if (node.alternate !== null) {
14809 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
14810 node.alternate.expirationTime = expirationTime;
14811 }
14812 }
14813 if (node['return'] === null) {
14814 if (node.tag === HostRoot) {
14815 var root = node.stateNode;
14816 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
14817 // This is an interruption. (Used for performance tracking.)
14818 interruptedBy = fiber;
14819 resetStack();
14820 }
14821 if (
14822 // If we're in the render phase, we don't need to schedule this root
14823 // for an update, because we'll do it before we exit...
14824 !isWorking || isCommitting ||
14825 // ...unless this is a different root than the one we're rendering.
14826 nextRoot !== root) {
14827 // Add this root to the root schedule.
14828 requestWork(root, expirationTime);
14829 }
14830 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
14831 invariant(false, 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.');
14832 }
14833 } else {
14834 {
14835 if (!isErrorRecovery && fiber.tag === ClassComponent) {
14836 warnAboutUpdateOnUnmounted(fiber);
14837 }
14838 }
14839 return;
14840 }
14841 }
14842 node = node['return'];
14843 }
14844 }
14845
14846 function recalculateCurrentTime() {
14847 // Subtract initial time so it fits inside 32bits
14848 mostRecentCurrentTimeMs = now() - originalStartTimeMs;
14849 mostRecentCurrentTime = msToExpirationTime(mostRecentCurrentTimeMs);
14850 return mostRecentCurrentTime;
14851 }
14852
14853 function deferredUpdates(fn) {
14854 var previousExpirationContext = expirationContext;
14855 var currentTime = recalculateCurrentTime();
14856 expirationContext = computeAsyncExpiration(currentTime);
14857 try {
14858 return fn();
14859 } finally {
14860 expirationContext = previousExpirationContext;
14861 }
14862 }
14863 function syncUpdates(fn, a, b, c, d) {
14864 var previousExpirationContext = expirationContext;
14865 expirationContext = Sync;
14866 try {
14867 return fn(a, b, c, d);
14868 } finally {
14869 expirationContext = previousExpirationContext;
14870 }
14871 }
14872
14873 // TODO: Everything below this is written as if it has been lifted to the
14874 // renderers. I'll do this in a follow-up.
14875
14876 // Linked-list of roots
14877 var firstScheduledRoot = null;
14878 var lastScheduledRoot = null;
14879
14880 var callbackExpirationTime = NoWork;
14881 var callbackID = -1;
14882 var isRendering = false;
14883 var nextFlushedRoot = null;
14884 var nextFlushedExpirationTime = NoWork;
14885 var lowestPendingInteractiveExpirationTime = NoWork;
14886 var deadlineDidExpire = false;
14887 var hasUnhandledError = false;
14888 var unhandledError = null;
14889 var deadline = null;
14890
14891 var isBatchingUpdates = false;
14892 var isUnbatchingUpdates = false;
14893 var isBatchingInteractiveUpdates = false;
14894
14895 var completedBatches = null;
14896
14897 // Use these to prevent an infinite loop of nested updates
14898 var NESTED_UPDATE_LIMIT = 1000;
14899 var nestedUpdateCount = 0;
14900
14901 var timeHeuristicForUnitOfWork = 1;
14902
14903 function scheduleCallbackWithExpiration(expirationTime) {
14904 if (callbackExpirationTime !== NoWork) {
14905 // A callback is already scheduled. Check its expiration time (timeout).
14906 if (expirationTime > callbackExpirationTime) {
14907 // Existing callback has sufficient timeout. Exit.
14908 return;
14909 } else {
14910 // Existing callback has insufficient timeout. Cancel and schedule a
14911 // new one.
14912 cancelDeferredCallback(callbackID);
14913 }
14914 // The request callback timer is already running. Don't start a new one.
14915 } else {
14916 startRequestCallbackTimer();
14917 }
14918
14919 // Compute a timeout for the given expiration time.
14920 var currentMs = now() - originalStartTimeMs;
14921 var expirationMs = expirationTimeToMs(expirationTime);
14922 var timeout = expirationMs - currentMs;
14923
14924 callbackExpirationTime = expirationTime;
14925 callbackID = scheduleDeferredCallback(performAsyncWork, { timeout: timeout });
14926 }
14927
14928 // requestWork is called by the scheduler whenever a root receives an update.
14929 // It's up to the renderer to call renderRoot at some point in the future.
14930 function requestWork(root, expirationTime) {
14931 addRootToSchedule(root, expirationTime);
14932
14933 if (isRendering) {
14934 // Prevent reentrancy. Remaining work will be scheduled at the end of
14935 // the currently rendering batch.
14936 return;
14937 }
14938
14939 if (isBatchingUpdates) {
14940 // Flush work at the end of the batch.
14941 if (isUnbatchingUpdates) {
14942 // ...unless we're inside unbatchedUpdates, in which case we should
14943 // flush it now.
14944 nextFlushedRoot = root;
14945 nextFlushedExpirationTime = Sync;
14946 performWorkOnRoot(root, Sync, false);
14947 }
14948 return;
14949 }
14950
14951 // TODO: Get rid of Sync and use current time?
14952 if (expirationTime === Sync) {
14953 performSyncWork();
14954 } else {
14955 scheduleCallbackWithExpiration(expirationTime);
14956 }
14957 }
14958
14959 function addRootToSchedule(root, expirationTime) {
14960 // Add the root to the schedule.
14961 // Check if this root is already part of the schedule.
14962 if (root.nextScheduledRoot === null) {
14963 // This root is not already scheduled. Add it.
14964 root.remainingExpirationTime = expirationTime;
14965 if (lastScheduledRoot === null) {
14966 firstScheduledRoot = lastScheduledRoot = root;
14967 root.nextScheduledRoot = root;
14968 } else {
14969 lastScheduledRoot.nextScheduledRoot = root;
14970 lastScheduledRoot = root;
14971 lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
14972 }
14973 } else {
14974 // This root is already scheduled, but its priority may have increased.
14975 var remainingExpirationTime = root.remainingExpirationTime;
14976 if (remainingExpirationTime === NoWork || expirationTime < remainingExpirationTime) {
14977 // Update the priority.
14978 root.remainingExpirationTime = expirationTime;
14979 }
14980 }
14981 }
14982
14983 function findHighestPriorityRoot() {
14984 var highestPriorityWork = NoWork;
14985 var highestPriorityRoot = null;
14986 if (lastScheduledRoot !== null) {
14987 var previousScheduledRoot = lastScheduledRoot;
14988 var root = firstScheduledRoot;
14989 while (root !== null) {
14990 var remainingExpirationTime = root.remainingExpirationTime;
14991 if (remainingExpirationTime === NoWork) {
14992 // This root no longer has work. Remove it from the scheduler.
14993
14994 // TODO: This check is redudant, but Flow is confused by the branch
14995 // below where we set lastScheduledRoot to null, even though we break
14996 // from the loop right after.
14997 !(previousScheduledRoot !== null && lastScheduledRoot !== null) ? invariant(false, 'Should have a previous and last root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
14998 if (root === root.nextScheduledRoot) {
14999 // This is the only root in the list.
15000 root.nextScheduledRoot = null;
15001 firstScheduledRoot = lastScheduledRoot = null;
15002 break;
15003 } else if (root === firstScheduledRoot) {
15004 // This is the first root in the list.
15005 var next = root.nextScheduledRoot;
15006 firstScheduledRoot = next;
15007 lastScheduledRoot.nextScheduledRoot = next;
15008 root.nextScheduledRoot = null;
15009 } else if (root === lastScheduledRoot) {
15010 // This is the last root in the list.
15011 lastScheduledRoot = previousScheduledRoot;
15012 lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
15013 root.nextScheduledRoot = null;
15014 break;
15015 } else {
15016 previousScheduledRoot.nextScheduledRoot = root.nextScheduledRoot;
15017 root.nextScheduledRoot = null;
15018 }
15019 root = previousScheduledRoot.nextScheduledRoot;
15020 } else {
15021 if (highestPriorityWork === NoWork || remainingExpirationTime < highestPriorityWork) {
15022 // Update the priority, if it's higher
15023 highestPriorityWork = remainingExpirationTime;
15024 highestPriorityRoot = root;
15025 }
15026 if (root === lastScheduledRoot) {
15027 break;
15028 }
15029 previousScheduledRoot = root;
15030 root = root.nextScheduledRoot;
15031 }
15032 }
15033 }
15034
15035 // If the next root is the same as the previous root, this is a nested
15036 // update. To prevent an infinite loop, increment the nested update count.
15037 var previousFlushedRoot = nextFlushedRoot;
15038 if (previousFlushedRoot !== null && previousFlushedRoot === highestPriorityRoot && highestPriorityWork === Sync) {
15039 nestedUpdateCount++;
15040 } else {
15041 // Reset whenever we switch roots.
15042 nestedUpdateCount = 0;
15043 }
15044 nextFlushedRoot = highestPriorityRoot;
15045 nextFlushedExpirationTime = highestPriorityWork;
15046 }
15047
15048 function performAsyncWork(dl) {
15049 performWork(NoWork, true, dl);
15050 }
15051
15052 function performSyncWork() {
15053 performWork(Sync, false, null);
15054 }
15055
15056 function performWork(minExpirationTime, isAsync, dl) {
15057 deadline = dl;
15058
15059 // Keep working on roots until there's no more work, or until the we reach
15060 // the deadline.
15061 findHighestPriorityRoot();
15062
15063 if (enableUserTimingAPI && deadline !== null) {
15064 var didExpire = nextFlushedExpirationTime < recalculateCurrentTime();
15065 var timeout = expirationTimeToMs(nextFlushedExpirationTime);
15066 stopRequestCallbackTimer(didExpire, timeout);
15067 }
15068
15069 if (isAsync) {
15070 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) {
15071 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire);
15072 findHighestPriorityRoot();
15073 }
15074 } else {
15075 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) {
15076 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false);
15077 findHighestPriorityRoot();
15078 }
15079 }
15080
15081 // We're done flushing work. Either we ran out of time in this callback,
15082 // or there's no more work left with sufficient priority.
15083
15084 // If we're inside a callback, set this to false since we just completed it.
15085 if (deadline !== null) {
15086 callbackExpirationTime = NoWork;
15087 callbackID = -1;
15088 }
15089 // If there's work left over, schedule a new callback.
15090 if (nextFlushedExpirationTime !== NoWork) {
15091 scheduleCallbackWithExpiration(nextFlushedExpirationTime);
15092 }
15093
15094 // Clean-up.
15095 deadline = null;
15096 deadlineDidExpire = false;
15097
15098 finishRendering();
15099 }
15100
15101 function flushRoot(root, expirationTime) {
15102 !!isRendering ? invariant(false, 'work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.') : void 0;
15103 // Perform work on root as if the given expiration time is the current time.
15104 // This has the effect of synchronously flushing all work up to and
15105 // including the given time.
15106 nextFlushedRoot = root;
15107 nextFlushedExpirationTime = expirationTime;
15108 performWorkOnRoot(root, expirationTime, false);
15109 // Flush any sync work that was scheduled by lifecycles
15110 performSyncWork();
15111 finishRendering();
15112 }
15113
15114 function finishRendering() {
15115 nestedUpdateCount = 0;
15116
15117 if (completedBatches !== null) {
15118 var batches = completedBatches;
15119 completedBatches = null;
15120 for (var i = 0; i < batches.length; i++) {
15121 var batch = batches[i];
15122 try {
15123 batch._onComplete();
15124 } catch (error) {
15125 if (!hasUnhandledError) {
15126 hasUnhandledError = true;
15127 unhandledError = error;
15128 }
15129 }
15130 }
15131 }
15132
15133 if (hasUnhandledError) {
15134 var error = unhandledError;
15135 unhandledError = null;
15136 hasUnhandledError = false;
15137 throw error;
15138 }
15139 }
15140
15141 function performWorkOnRoot(root, expirationTime, isAsync) {
15142 !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
15143
15144 isRendering = true;
15145
15146 // Check if this is async work or sync/expired work.
15147 if (!isAsync) {
15148 // Flush sync work.
15149 var finishedWork = root.finishedWork;
15150 if (finishedWork !== null) {
15151 // This root is already complete. We can commit it.
15152 completeRoot(root, finishedWork, expirationTime);
15153 } else {
15154 root.finishedWork = null;
15155 finishedWork = renderRoot(root, expirationTime, false);
15156 if (finishedWork !== null) {
15157 // We've completed the root. Commit it.
15158 completeRoot(root, finishedWork, expirationTime);
15159 }
15160 }
15161 } else {
15162 // Flush async work.
15163 var _finishedWork = root.finishedWork;
15164 if (_finishedWork !== null) {
15165 // This root is already complete. We can commit it.
15166 completeRoot(root, _finishedWork, expirationTime);
15167 } else {
15168 root.finishedWork = null;
15169 _finishedWork = renderRoot(root, expirationTime, true);
15170 if (_finishedWork !== null) {
15171 // We've completed the root. Check the deadline one more time
15172 // before committing.
15173 if (!shouldYield()) {
15174 // Still time left. Commit the root.
15175 completeRoot(root, _finishedWork, expirationTime);
15176 } else {
15177 // There's no time left. Mark this root as complete. We'll come
15178 // back and commit it later.
15179 root.finishedWork = _finishedWork;
15180 }
15181 }
15182 }
15183 }
15184
15185 isRendering = false;
15186 }
15187
15188 function completeRoot(root, finishedWork, expirationTime) {
15189 // Check if there's a batch that matches this expiration time.
15190 var firstBatch = root.firstBatch;
15191 if (firstBatch !== null && firstBatch._expirationTime <= expirationTime) {
15192 if (completedBatches === null) {
15193 completedBatches = [firstBatch];
15194 } else {
15195 completedBatches.push(firstBatch);
15196 }
15197 if (firstBatch._defer) {
15198 // This root is blocked from committing by a batch. Unschedule it until
15199 // we receive another update.
15200 root.finishedWork = finishedWork;
15201 root.remainingExpirationTime = NoWork;
15202 return;
15203 }
15204 }
15205
15206 // Commit the root.
15207 root.finishedWork = null;
15208 root.remainingExpirationTime = commitRoot(finishedWork);
15209 }
15210
15211 // When working on async work, the reconciler asks the renderer if it should
15212 // yield execution. For DOM, we implement this with requestIdleCallback.
15213 function shouldYield() {
15214 if (deadline === null) {
15215 return false;
15216 }
15217 if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {
15218 // Disregard deadline.didTimeout. Only expired work should be flushed
15219 // during a timeout. This path is only hit for non-expired work.
15220 return false;
15221 }
15222 deadlineDidExpire = true;
15223 return true;
15224 }
15225
15226 function onUncaughtError(error) {
15227 !(nextFlushedRoot !== null) ? invariant(false, 'Should be working on a root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
15228 // Unschedule this root so we don't work on it again until there's
15229 // another update.
15230 nextFlushedRoot.remainingExpirationTime = NoWork;
15231 if (!hasUnhandledError) {
15232 hasUnhandledError = true;
15233 unhandledError = error;
15234 }
15235 }
15236
15237 // TODO: Batching should be implemented at the renderer level, not inside
15238 // the reconciler.
15239 function batchedUpdates(fn, a) {
15240 var previousIsBatchingUpdates = isBatchingUpdates;
15241 isBatchingUpdates = true;
15242 try {
15243 return fn(a);
15244 } finally {
15245 isBatchingUpdates = previousIsBatchingUpdates;
15246 if (!isBatchingUpdates && !isRendering) {
15247 performSyncWork();
15248 }
15249 }
15250 }
15251
15252 // TODO: Batching should be implemented at the renderer level, not inside
15253 // the reconciler.
15254 function unbatchedUpdates(fn, a) {
15255 if (isBatchingUpdates && !isUnbatchingUpdates) {
15256 isUnbatchingUpdates = true;
15257 try {
15258 return fn(a);
15259 } finally {
15260 isUnbatchingUpdates = false;
15261 }
15262 }
15263 return fn(a);
15264 }
15265
15266 // TODO: Batching should be implemented at the renderer level, not within
15267 // the reconciler.
15268 function flushSync(fn, a) {
15269 !!isRendering ? invariant(false, 'flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.') : void 0;
15270 var previousIsBatchingUpdates = isBatchingUpdates;
15271 isBatchingUpdates = true;
15272 try {
15273 return syncUpdates(fn, a);
15274 } finally {
15275 isBatchingUpdates = previousIsBatchingUpdates;
15276 performSyncWork();
15277 }
15278 }
15279
15280 function interactiveUpdates(fn, a, b) {
15281 if (isBatchingInteractiveUpdates) {
15282 return fn(a, b);
15283 }
15284 // If there are any pending interactive updates, synchronously flush them.
15285 // This needs to happen before we read any handlers, because the effect of
15286 // the previous event may influence which handlers are called during
15287 // this event.
15288 if (!isBatchingUpdates && !isRendering && lowestPendingInteractiveExpirationTime !== NoWork) {
15289 // Synchronously flush pending interactive updates.
15290 performWork(lowestPendingInteractiveExpirationTime, false, null);
15291 lowestPendingInteractiveExpirationTime = NoWork;
15292 }
15293 var previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates;
15294 var previousIsBatchingUpdates = isBatchingUpdates;
15295 isBatchingInteractiveUpdates = true;
15296 isBatchingUpdates = true;
15297 try {
15298 return fn(a, b);
15299 } finally {
15300 isBatchingInteractiveUpdates = previousIsBatchingInteractiveUpdates;
15301 isBatchingUpdates = previousIsBatchingUpdates;
15302 if (!isBatchingUpdates && !isRendering) {
15303 performSyncWork();
15304 }
15305 }
15306 }
15307
15308 function flushInteractiveUpdates() {
15309 if (!isRendering && lowestPendingInteractiveExpirationTime !== NoWork) {
15310 // Synchronously flush pending interactive updates.
15311 performWork(lowestPendingInteractiveExpirationTime, false, null);
15312 lowestPendingInteractiveExpirationTime = NoWork;
15313 }
15314 }
15315
15316 function flushControlled(fn) {
15317 var previousIsBatchingUpdates = isBatchingUpdates;
15318 isBatchingUpdates = true;
15319 try {
15320 syncUpdates(fn);
15321 } finally {
15322 isBatchingUpdates = previousIsBatchingUpdates;
15323 if (!isBatchingUpdates && !isRendering) {
15324 performWork(Sync, false, null);
15325 }
15326 }
15327 }
15328
15329 return {
15330 recalculateCurrentTime: recalculateCurrentTime,
15331 computeExpirationForFiber: computeExpirationForFiber,
15332 scheduleWork: scheduleWork,
15333 requestWork: requestWork,
15334 flushRoot: flushRoot,
15335 batchedUpdates: batchedUpdates,
15336 unbatchedUpdates: unbatchedUpdates,
15337 flushSync: flushSync,
15338 flushControlled: flushControlled,
15339 deferredUpdates: deferredUpdates,
15340 syncUpdates: syncUpdates,
15341 interactiveUpdates: interactiveUpdates,
15342 flushInteractiveUpdates: flushInteractiveUpdates,
15343 computeUniqueAsyncExpiration: computeUniqueAsyncExpiration,
15344 legacyContext: legacyContext
15345 };
15346 };
15347
15348 var didWarnAboutNestedUpdates = void 0;
15349
15350 {
15351 didWarnAboutNestedUpdates = false;
15352 }
15353
15354 // 0 is PROD, 1 is DEV.
15355 // Might add PROFILE later.
15356
15357
15358 var ReactFiberReconciler$1 = function (config) {
15359 var getPublicInstance = config.getPublicInstance;
15360
15361 var _ReactFiberScheduler = ReactFiberScheduler(config),
15362 computeUniqueAsyncExpiration = _ReactFiberScheduler.computeUniqueAsyncExpiration,
15363 recalculateCurrentTime = _ReactFiberScheduler.recalculateCurrentTime,
15364 computeExpirationForFiber = _ReactFiberScheduler.computeExpirationForFiber,
15365 scheduleWork = _ReactFiberScheduler.scheduleWork,
15366 requestWork = _ReactFiberScheduler.requestWork,
15367 flushRoot = _ReactFiberScheduler.flushRoot,
15368 batchedUpdates = _ReactFiberScheduler.batchedUpdates,
15369 unbatchedUpdates = _ReactFiberScheduler.unbatchedUpdates,
15370 flushSync = _ReactFiberScheduler.flushSync,
15371 flushControlled = _ReactFiberScheduler.flushControlled,
15372 deferredUpdates = _ReactFiberScheduler.deferredUpdates,
15373 syncUpdates = _ReactFiberScheduler.syncUpdates,
15374 interactiveUpdates = _ReactFiberScheduler.interactiveUpdates,
15375 flushInteractiveUpdates = _ReactFiberScheduler.flushInteractiveUpdates,
15376 legacyContext = _ReactFiberScheduler.legacyContext;
15377
15378 var findCurrentUnmaskedContext = legacyContext.findCurrentUnmaskedContext,
15379 isContextProvider = legacyContext.isContextProvider,
15380 processChildContext = legacyContext.processChildContext;
15381
15382
15383 function getContextForSubtree(parentComponent) {
15384 if (!parentComponent) {
15385 return emptyObject;
15386 }
15387
15388 var fiber = get(parentComponent);
15389 var parentContext = findCurrentUnmaskedContext(fiber);
15390 return isContextProvider(fiber) ? processChildContext(fiber, parentContext) : parentContext;
15391 }
15392
15393 function scheduleRootUpdate(current, element, currentTime, expirationTime, callback) {
15394 {
15395 if (ReactDebugCurrentFiber.phase === 'render' && ReactDebugCurrentFiber.current !== null && !didWarnAboutNestedUpdates) {
15396 didWarnAboutNestedUpdates = true;
15397 warning(false, 'Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(ReactDebugCurrentFiber.current) || 'Unknown');
15398 }
15399 }
15400
15401 callback = callback === undefined ? null : callback;
15402 {
15403 !(callback === null || typeof callback === 'function') ? warning(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
15404 }
15405
15406 var update = {
15407 expirationTime: expirationTime,
15408 partialState: { element: element },
15409 callback: callback,
15410 isReplace: false,
15411 isForced: false,
15412 capturedValue: null,
15413 next: null
15414 };
15415 insertUpdateIntoFiber(current, update);
15416 scheduleWork(current, expirationTime);
15417
15418 return expirationTime;
15419 }
15420
15421 function updateContainerAtExpirationTime(element, container, parentComponent, currentTime, expirationTime, callback) {
15422 // TODO: If this is a nested container, this won't be the root.
15423 var current = container.current;
15424
15425 {
15426 if (ReactFiberInstrumentation_1.debugTool) {
15427 if (current.alternate === null) {
15428 ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
15429 } else if (element === null) {
15430 ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
15431 } else {
15432 ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
15433 }
15434 }
15435 }
15436
15437 var context = getContextForSubtree(parentComponent);
15438 if (container.context === null) {
15439 container.context = context;
15440 } else {
15441 container.pendingContext = context;
15442 }
15443
15444 return scheduleRootUpdate(current, element, currentTime, expirationTime, callback);
15445 }
15446
15447 function findHostInstance(component) {
15448 var fiber = get(component);
15449 if (fiber === undefined) {
15450 if (typeof component.render === 'function') {
15451 invariant(false, 'Unable to find node on an unmounted component.');
15452 } else {
15453 invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
15454 }
15455 }
15456 var hostFiber = findCurrentHostFiber(fiber);
15457 if (hostFiber === null) {
15458 return null;
15459 }
15460 return hostFiber.stateNode;
15461 }
15462
15463 return {
15464 createContainer: function (containerInfo, isAsync, hydrate) {
15465 return createFiberRoot(containerInfo, isAsync, hydrate);
15466 },
15467 updateContainer: function (element, container, parentComponent, callback) {
15468 var current = container.current;
15469 var currentTime = recalculateCurrentTime();
15470 var expirationTime = computeExpirationForFiber(current);
15471 return updateContainerAtExpirationTime(element, container, parentComponent, currentTime, expirationTime, callback);
15472 },
15473 updateContainerAtExpirationTime: function (element, container, parentComponent, expirationTime, callback) {
15474 var currentTime = recalculateCurrentTime();
15475 return updateContainerAtExpirationTime(element, container, parentComponent, currentTime, expirationTime, callback);
15476 },
15477
15478
15479 flushRoot: flushRoot,
15480
15481 requestWork: requestWork,
15482
15483 computeUniqueAsyncExpiration: computeUniqueAsyncExpiration,
15484
15485 batchedUpdates: batchedUpdates,
15486
15487 unbatchedUpdates: unbatchedUpdates,
15488
15489 deferredUpdates: deferredUpdates,
15490
15491 syncUpdates: syncUpdates,
15492
15493 interactiveUpdates: interactiveUpdates,
15494
15495 flushInteractiveUpdates: flushInteractiveUpdates,
15496
15497 flushControlled: flushControlled,
15498
15499 flushSync: flushSync,
15500
15501 getPublicRootInstance: function (container) {
15502 var containerFiber = container.current;
15503 if (!containerFiber.child) {
15504 return null;
15505 }
15506 switch (containerFiber.child.tag) {
15507 case HostComponent:
15508 return getPublicInstance(containerFiber.child.stateNode);
15509 default:
15510 return containerFiber.child.stateNode;
15511 }
15512 },
15513
15514
15515 findHostInstance: findHostInstance,
15516
15517 findHostInstanceWithNoPortals: function (fiber) {
15518 var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
15519 if (hostFiber === null) {
15520 return null;
15521 }
15522 return hostFiber.stateNode;
15523 },
15524 injectIntoDevTools: function (devToolsConfig) {
15525 var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
15526
15527 return injectInternals(_assign({}, devToolsConfig, {
15528 findHostInstanceByFiber: function (fiber) {
15529 var hostFiber = findCurrentHostFiber(fiber);
15530 if (hostFiber === null) {
15531 return null;
15532 }
15533 return hostFiber.stateNode;
15534 },
15535 findFiberByHostInstance: function (instance) {
15536 if (!findFiberByHostInstance) {
15537 // Might not be implemented by the renderer.
15538 return null;
15539 }
15540 return findFiberByHostInstance(instance);
15541 }
15542 }));
15543 }
15544 };
15545 };
15546
15547 var ReactFiberReconciler$2 = Object.freeze({
15548 default: ReactFiberReconciler$1
15549 });
15550
15551 var ReactFiberReconciler$3 = ( ReactFiberReconciler$2 && ReactFiberReconciler$1 ) || ReactFiberReconciler$2;
15552
15553 // TODO: bundle Flow types with the package.
15554
15555
15556
15557 // TODO: decide on the top-level export form.
15558 // This is hacky but makes it work with both Rollup and Jest.
15559 var reactReconciler = ReactFiberReconciler$3['default'] ? ReactFiberReconciler$3['default'] : ReactFiberReconciler$3;
15560
15561 function createPortal$1(children, containerInfo,
15562 // TODO: figure out the API for cross-renderer implementation.
15563 implementation) {
15564 var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
15565
15566 return {
15567 // This tag allow us to uniquely identify this as a React Portal
15568 $$typeof: REACT_PORTAL_TYPE,
15569 key: key == null ? null : '' + key,
15570 children: children,
15571 containerInfo: containerInfo,
15572 implementation: implementation
15573 };
15574 }
15575
15576 // TODO: this is special because it gets imported during build.
15577
15578 var ReactVersion = '16.3.2';
15579
15580 // a requestAnimationFrame, storing the time for the start of the frame, then
15581 // scheduling a postMessage which gets scheduled after paint. Within the
15582 // postMessage handler do as much work as possible until time + frame rate.
15583 // By separating the idle call into a separate event tick we ensure that
15584 // layout, paint and other browser work is counted against the available time.
15585 // The frame rate is dynamically adjusted.
15586
15587 {
15588 if (ExecutionEnvironment.canUseDOM && typeof requestAnimationFrame !== 'function') {
15589 warning(false, 'React depends on requestAnimationFrame. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
15590 }
15591 }
15592
15593 var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
15594
15595 var now = void 0;
15596 if (hasNativePerformanceNow) {
15597 now = function () {
15598 return performance.now();
15599 };
15600 } else {
15601 now = function () {
15602 return Date.now();
15603 };
15604 }
15605
15606 // TODO: There's no way to cancel, because Fiber doesn't atm.
15607 var rIC = void 0;
15608 var cIC = void 0;
15609
15610 if (!ExecutionEnvironment.canUseDOM) {
15611 rIC = function (frameCallback) {
15612 return setTimeout(function () {
15613 frameCallback({
15614 timeRemaining: function () {
15615 return Infinity;
15616 },
15617
15618 didTimeout: false
15619 });
15620 });
15621 };
15622 cIC = function (timeoutID) {
15623 clearTimeout(timeoutID);
15624 };
15625 } else if (alwaysUseRequestIdleCallbackPolyfill || typeof requestIdleCallback !== 'function' || typeof cancelIdleCallback !== 'function') {
15626 // Polyfill requestIdleCallback and cancelIdleCallback
15627
15628 var scheduledRICCallback = null;
15629 var isIdleScheduled = false;
15630 var timeoutTime = -1;
15631
15632 var isAnimationFrameScheduled = false;
15633
15634 var frameDeadline = 0;
15635 // We start out assuming that we run at 30fps but then the heuristic tracking
15636 // will adjust this value to a faster fps if we get more frequent animation
15637 // frames.
15638 var previousFrameTime = 33;
15639 var activeFrameTime = 33;
15640
15641 var frameDeadlineObject = void 0;
15642 if (hasNativePerformanceNow) {
15643 frameDeadlineObject = {
15644 didTimeout: false,
15645 timeRemaining: function () {
15646 // We assume that if we have a performance timer that the rAF callback
15647 // gets a performance timer value. Not sure if this is always true.
15648 var remaining = frameDeadline - performance.now();
15649 return remaining > 0 ? remaining : 0;
15650 }
15651 };
15652 } else {
15653 frameDeadlineObject = {
15654 didTimeout: false,
15655 timeRemaining: function () {
15656 // Fallback to Date.now()
15657 var remaining = frameDeadline - Date.now();
15658 return remaining > 0 ? remaining : 0;
15659 }
15660 };
15661 }
15662
15663 // We use the postMessage trick to defer idle work until after the repaint.
15664 var messageKey = '__reactIdleCallback$' + Math.random().toString(36).slice(2);
15665 var idleTick = function (event) {
15666 if (event.source !== window || event.data !== messageKey) {
15667 return;
15668 }
15669
15670 isIdleScheduled = false;
15671
15672 var currentTime = now();
15673 if (frameDeadline - currentTime <= 0) {
15674 // There's no time left in this idle period. Check if the callback has
15675 // a timeout and whether it's been exceeded.
15676 if (timeoutTime !== -1 && timeoutTime <= currentTime) {
15677 // Exceeded the timeout. Invoke the callback even though there's no
15678 // time left.
15679 frameDeadlineObject.didTimeout = true;
15680 } else {
15681 // No timeout.
15682 if (!isAnimationFrameScheduled) {
15683 // Schedule another animation callback so we retry later.
15684 isAnimationFrameScheduled = true;
15685 requestAnimationFrame(animationTick);
15686 }
15687 // Exit without invoking the callback.
15688 return;
15689 }
15690 } else {
15691 // There's still time left in this idle period.
15692 frameDeadlineObject.didTimeout = false;
15693 }
15694
15695 timeoutTime = -1;
15696 var callback = scheduledRICCallback;
15697 scheduledRICCallback = null;
15698 if (callback !== null) {
15699 callback(frameDeadlineObject);
15700 }
15701 };
15702 // Assumes that we have addEventListener in this environment. Might need
15703 // something better for old IE.
15704 window.addEventListener('message', idleTick, false);
15705
15706 var animationTick = function (rafTime) {
15707 isAnimationFrameScheduled = false;
15708 var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
15709 if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
15710 if (nextFrameTime < 8) {
15711 // Defensive coding. We don't support higher frame rates than 120hz.
15712 // If we get lower than that, it is probably a bug.
15713 nextFrameTime = 8;
15714 }
15715 // If one frame goes long, then the next one can be short to catch up.
15716 // If two frames are short in a row, then that's an indication that we
15717 // actually have a higher frame rate than what we're currently optimizing.
15718 // We adjust our heuristic dynamically accordingly. For example, if we're
15719 // running on 120hz display or 90hz VR display.
15720 // Take the max of the two in case one of them was an anomaly due to
15721 // missed frame deadlines.
15722 activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
15723 } else {
15724 previousFrameTime = nextFrameTime;
15725 }
15726 frameDeadline = rafTime + activeFrameTime;
15727 if (!isIdleScheduled) {
15728 isIdleScheduled = true;
15729 window.postMessage(messageKey, '*');
15730 }
15731 };
15732
15733 rIC = function (callback, options) {
15734 // This assumes that we only schedule one callback at a time because that's
15735 // how Fiber uses it.
15736 scheduledRICCallback = callback;
15737 if (options != null && typeof options.timeout === 'number') {
15738 timeoutTime = now() + options.timeout;
15739 }
15740 if (!isAnimationFrameScheduled) {
15741 // If rAF didn't already schedule one, we need to schedule a frame.
15742 // TODO: If this rAF doesn't materialize because the browser throttles, we
15743 // might want to still have setTimeout trigger rIC as a backup to ensure
15744 // that we keep performing work.
15745 isAnimationFrameScheduled = true;
15746 requestAnimationFrame(animationTick);
15747 }
15748 return 0;
15749 };
15750
15751 cIC = function () {
15752 scheduledRICCallback = null;
15753 isIdleScheduled = false;
15754 timeoutTime = -1;
15755 };
15756 } else {
15757 rIC = window.requestIdleCallback;
15758 cIC = window.cancelIdleCallback;
15759 }
15760
15761 var didWarnSelectedSetOnOption = false;
15762
15763 function flattenChildren(children) {
15764 var content = '';
15765
15766 // Flatten children and warn if they aren't strings or numbers;
15767 // invalid types are ignored.
15768 // We can silently skip them because invalid DOM nesting warning
15769 // catches these cases in Fiber.
15770 React.Children.forEach(children, function (child) {
15771 if (child == null) {
15772 return;
15773 }
15774 if (typeof child === 'string' || typeof child === 'number') {
15775 content += child;
15776 }
15777 });
15778
15779 return content;
15780 }
15781
15782 /**
15783 * Implements an <option> host component that warns when `selected` is set.
15784 */
15785
15786 function validateProps(element, props) {
15787 // TODO (yungsters): Remove support for `selected` in <option>.
15788 {
15789 if (props.selected != null && !didWarnSelectedSetOnOption) {
15790 warning(false, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
15791 didWarnSelectedSetOnOption = true;
15792 }
15793 }
15794 }
15795
15796 function postMountWrapper$1(element, props) {
15797 // value="" should make a value attribute (#6219)
15798 if (props.value != null) {
15799 element.setAttribute('value', props.value);
15800 }
15801 }
15802
15803 function getHostProps$1(element, props) {
15804 var hostProps = _assign({ children: undefined }, props);
15805 var content = flattenChildren(props.children);
15806
15807 if (content) {
15808 hostProps.children = content;
15809 }
15810
15811 return hostProps;
15812 }
15813
15814 // TODO: direct imports like some-package/src/* are bad. Fix me.
15815 var getCurrentFiberOwnerName$3 = ReactDebugCurrentFiber.getCurrentFiberOwnerName;
15816 var getCurrentFiberStackAddendum$4 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
15817
15818
15819 var didWarnValueDefaultValue$1 = void 0;
15820
15821 {
15822 didWarnValueDefaultValue$1 = false;
15823 }
15824
15825 function getDeclarationErrorAddendum() {
15826 var ownerName = getCurrentFiberOwnerName$3();
15827 if (ownerName) {
15828 return '\n\nCheck the render method of `' + ownerName + '`.';
15829 }
15830 return '';
15831 }
15832
15833 var valuePropNames = ['value', 'defaultValue'];
15834
15835 /**
15836 * Validation function for `value` and `defaultValue`.
15837 */
15838 function checkSelectPropTypes(props) {
15839 ReactControlledValuePropTypes.checkPropTypes('select', props, getCurrentFiberStackAddendum$4);
15840
15841 for (var i = 0; i < valuePropNames.length; i++) {
15842 var propName = valuePropNames[i];
15843 if (props[propName] == null) {
15844 continue;
15845 }
15846 var isArray = Array.isArray(props[propName]);
15847 if (props.multiple && !isArray) {
15848 warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
15849 } else if (!props.multiple && isArray) {
15850 warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
15851 }
15852 }
15853 }
15854
15855 function updateOptions(node, multiple, propValue, setDefaultSelected) {
15856 var options = node.options;
15857
15858 if (multiple) {
15859 var selectedValues = propValue;
15860 var selectedValue = {};
15861 for (var i = 0; i < selectedValues.length; i++) {
15862 // Prefix to avoid chaos with special keys.
15863 selectedValue['$' + selectedValues[i]] = true;
15864 }
15865 for (var _i = 0; _i < options.length; _i++) {
15866 var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
15867 if (options[_i].selected !== selected) {
15868 options[_i].selected = selected;
15869 }
15870 if (selected && setDefaultSelected) {
15871 options[_i].defaultSelected = true;
15872 }
15873 }
15874 } else {
15875 // Do not set `select.value` as exact behavior isn't consistent across all
15876 // browsers for all cases.
15877 var _selectedValue = '' + propValue;
15878 var defaultSelected = null;
15879 for (var _i2 = 0; _i2 < options.length; _i2++) {
15880 if (options[_i2].value === _selectedValue) {
15881 options[_i2].selected = true;
15882 if (setDefaultSelected) {
15883 options[_i2].defaultSelected = true;
15884 }
15885 return;
15886 }
15887 if (defaultSelected === null && !options[_i2].disabled) {
15888 defaultSelected = options[_i2];
15889 }
15890 }
15891 if (defaultSelected !== null) {
15892 defaultSelected.selected = true;
15893 }
15894 }
15895 }
15896
15897 /**
15898 * Implements a <select> host component that allows optionally setting the
15899 * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
15900 * stringable. If `multiple` is true, the prop must be an array of stringables.
15901 *
15902 * If `value` is not supplied (or null/undefined), user actions that change the
15903 * selected option will trigger updates to the rendered options.
15904 *
15905 * If it is supplied (and not null/undefined), the rendered options will not
15906 * update in response to user actions. Instead, the `value` prop must change in
15907 * order for the rendered options to update.
15908 *
15909 * If `defaultValue` is provided, any options with the supplied values will be
15910 * selected.
15911 */
15912
15913 function getHostProps$2(element, props) {
15914 return _assign({}, props, {
15915 value: undefined
15916 });
15917 }
15918
15919 function initWrapperState$1(element, props) {
15920 var node = element;
15921 {
15922 checkSelectPropTypes(props);
15923 }
15924
15925 var value = props.value;
15926 node._wrapperState = {
15927 initialValue: value != null ? value : props.defaultValue,
15928 wasMultiple: !!props.multiple
15929 };
15930
15931 {
15932 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
15933 warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
15934 didWarnValueDefaultValue$1 = true;
15935 }
15936 }
15937 }
15938
15939 function postMountWrapper$2(element, props) {
15940 var node = element;
15941 node.multiple = !!props.multiple;
15942 var value = props.value;
15943 if (value != null) {
15944 updateOptions(node, !!props.multiple, value, false);
15945 } else if (props.defaultValue != null) {
15946 updateOptions(node, !!props.multiple, props.defaultValue, true);
15947 }
15948 }
15949
15950 function postUpdateWrapper(element, props) {
15951 var node = element;
15952 // After the initial mount, we control selected-ness manually so don't pass
15953 // this value down
15954 node._wrapperState.initialValue = undefined;
15955
15956 var wasMultiple = node._wrapperState.wasMultiple;
15957 node._wrapperState.wasMultiple = !!props.multiple;
15958
15959 var value = props.value;
15960 if (value != null) {
15961 updateOptions(node, !!props.multiple, value, false);
15962 } else if (wasMultiple !== !!props.multiple) {
15963 // For simplicity, reapply `defaultValue` if `multiple` is toggled.
15964 if (props.defaultValue != null) {
15965 updateOptions(node, !!props.multiple, props.defaultValue, true);
15966 } else {
15967 // Revert the select back to its default unselected state.
15968 updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
15969 }
15970 }
15971 }
15972
15973 function restoreControlledState$2(element, props) {
15974 var node = element;
15975 var value = props.value;
15976
15977 if (value != null) {
15978 updateOptions(node, !!props.multiple, value, false);
15979 }
15980 }
15981
15982 // TODO: direct imports like some-package/src/* are bad. Fix me.
15983 var getCurrentFiberStackAddendum$5 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
15984
15985 var didWarnValDefaultVal = false;
15986
15987 /**
15988 * Implements a <textarea> host component that allows setting `value`, and
15989 * `defaultValue`. This differs from the traditional DOM API because value is
15990 * usually set as PCDATA children.
15991 *
15992 * If `value` is not supplied (or null/undefined), user actions that affect the
15993 * value will trigger updates to the element.
15994 *
15995 * If `value` is supplied (and not null/undefined), the rendered element will
15996 * not trigger updates to the element. Instead, the `value` prop must change in
15997 * order for the rendered element to be updated.
15998 *
15999 * The rendered element will be initialized with an empty value, the prop
16000 * `defaultValue` if specified, or the children content (deprecated).
16001 */
16002
16003 function getHostProps$3(element, props) {
16004 var node = element;
16005 !(props.dangerouslySetInnerHTML == null) ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : void 0;
16006
16007 // Always set children to the same thing. In IE9, the selection range will
16008 // get reset if `textContent` is mutated. We could add a check in setTextContent
16009 // to only set the value if/when the value differs from the node value (which would
16010 // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
16011 // solution. The value can be a boolean or object so that's why it's forced
16012 // to be a string.
16013 var hostProps = _assign({}, props, {
16014 value: undefined,
16015 defaultValue: undefined,
16016 children: '' + node._wrapperState.initialValue
16017 });
16018
16019 return hostProps;
16020 }
16021
16022 function initWrapperState$2(element, props) {
16023 var node = element;
16024 {
16025 ReactControlledValuePropTypes.checkPropTypes('textarea', props, getCurrentFiberStackAddendum$5);
16026 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
16027 warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
16028 didWarnValDefaultVal = true;
16029 }
16030 }
16031
16032 var initialValue = props.value;
16033
16034 // Only bother fetching default value if we're going to use it
16035 if (initialValue == null) {
16036 var defaultValue = props.defaultValue;
16037 // TODO (yungsters): Remove support for children content in <textarea>.
16038 var children = props.children;
16039 if (children != null) {
16040 {
16041 warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
16042 }
16043 !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
16044 if (Array.isArray(children)) {
16045 !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
16046 children = children[0];
16047 }
16048
16049 defaultValue = '' + children;
16050 }
16051 if (defaultValue == null) {
16052 defaultValue = '';
16053 }
16054 initialValue = defaultValue;
16055 }
16056
16057 node._wrapperState = {
16058 initialValue: '' + initialValue
16059 };
16060 }
16061
16062 function updateWrapper$1(element, props) {
16063 var node = element;
16064 var value = props.value;
16065 if (value != null) {
16066 // Cast `value` to a string to ensure the value is set correctly. While
16067 // browsers typically do this as necessary, jsdom doesn't.
16068 var newValue = '' + value;
16069
16070 // To avoid side effects (such as losing text selection), only set value if changed
16071 if (newValue !== node.value) {
16072 node.value = newValue;
16073 }
16074 if (props.defaultValue == null) {
16075 node.defaultValue = newValue;
16076 }
16077 }
16078 if (props.defaultValue != null) {
16079 node.defaultValue = props.defaultValue;
16080 }
16081 }
16082
16083 function postMountWrapper$3(element, props) {
16084 var node = element;
16085 // This is in postMount because we need access to the DOM node, which is not
16086 // available until after the component has mounted.
16087 var textContent = node.textContent;
16088
16089 // Only set node.value if textContent is equal to the expected
16090 // initial value. In IE10/IE11 there is a bug where the placeholder attribute
16091 // will populate textContent as well.
16092 // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
16093 if (textContent === node._wrapperState.initialValue) {
16094 node.value = textContent;
16095 }
16096 }
16097
16098 function restoreControlledState$3(element, props) {
16099 // DOM component is still mounted; update
16100 updateWrapper$1(element, props);
16101 }
16102
16103 var HTML_NAMESPACE$1 = 'http://www.w3.org/1999/xhtml';
16104 var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
16105 var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
16106
16107 var Namespaces = {
16108 html: HTML_NAMESPACE$1,
16109 mathml: MATH_NAMESPACE,
16110 svg: SVG_NAMESPACE
16111 };
16112
16113 // Assumes there is no parent namespace.
16114 function getIntrinsicNamespace(type) {
16115 switch (type) {
16116 case 'svg':
16117 return SVG_NAMESPACE;
16118 case 'math':
16119 return MATH_NAMESPACE;
16120 default:
16121 return HTML_NAMESPACE$1;
16122 }
16123 }
16124
16125 function getChildNamespace(parentNamespace, type) {
16126 if (parentNamespace == null || parentNamespace === HTML_NAMESPACE$1) {
16127 // No (or default) parent namespace: potential entry point.
16128 return getIntrinsicNamespace(type);
16129 }
16130 if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
16131 // We're leaving SVG.
16132 return HTML_NAMESPACE$1;
16133 }
16134 // By default, pass namespace below.
16135 return parentNamespace;
16136 }
16137
16138 /* globals MSApp */
16139
16140 /**
16141 * Create a function which has 'unsafe' privileges (required by windows8 apps)
16142 */
16143 var createMicrosoftUnsafeLocalFunction = function (func) {
16144 if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
16145 return function (arg0, arg1, arg2, arg3) {
16146 MSApp.execUnsafeLocalFunction(function () {
16147 return func(arg0, arg1, arg2, arg3);
16148 });
16149 };
16150 } else {
16151 return func;
16152 }
16153 };
16154
16155 // SVG temp container for IE lacking innerHTML
16156 var reusableSVGContainer = void 0;
16157
16158 /**
16159 * Set the innerHTML property of a node
16160 *
16161 * @param {DOMElement} node
16162 * @param {string} html
16163 * @internal
16164 */
16165 var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
16166 // IE does not have innerHTML for SVG nodes, so instead we inject the
16167 // new markup in a temp node and then move the child nodes across into
16168 // the target node
16169
16170 if (node.namespaceURI === Namespaces.svg && !('innerHTML' in node)) {
16171 reusableSVGContainer = reusableSVGContainer || document.createElement('div');
16172 reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
16173 var svgNode = reusableSVGContainer.firstChild;
16174 while (node.firstChild) {
16175 node.removeChild(node.firstChild);
16176 }
16177 while (svgNode.firstChild) {
16178 node.appendChild(svgNode.firstChild);
16179 }
16180 } else {
16181 node.innerHTML = html;
16182 }
16183 });
16184
16185 /**
16186 * Set the textContent property of a node. For text updates, it's faster
16187 * to set the `nodeValue` of the Text node directly instead of using
16188 * `.textContent` which will remove the existing node and create a new one.
16189 *
16190 * @param {DOMElement} node
16191 * @param {string} text
16192 * @internal
16193 */
16194 var setTextContent = function (node, text) {
16195 if (text) {
16196 var firstChild = node.firstChild;
16197
16198 if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
16199 firstChild.nodeValue = text;
16200 return;
16201 }
16202 }
16203 node.textContent = text;
16204 };
16205
16206 /**
16207 * CSS properties which accept numbers but are not in units of "px".
16208 */
16209 var isUnitlessNumber = {
16210 animationIterationCount: true,
16211 borderImageOutset: true,
16212 borderImageSlice: true,
16213 borderImageWidth: true,
16214 boxFlex: true,
16215 boxFlexGroup: true,
16216 boxOrdinalGroup: true,
16217 columnCount: true,
16218 columns: true,
16219 flex: true,
16220 flexGrow: true,
16221 flexPositive: true,
16222 flexShrink: true,
16223 flexNegative: true,
16224 flexOrder: true,
16225 gridRow: true,
16226 gridRowEnd: true,
16227 gridRowSpan: true,
16228 gridRowStart: true,
16229 gridColumn: true,
16230 gridColumnEnd: true,
16231 gridColumnSpan: true,
16232 gridColumnStart: true,
16233 fontWeight: true,
16234 lineClamp: true,
16235 lineHeight: true,
16236 opacity: true,
16237 order: true,
16238 orphans: true,
16239 tabSize: true,
16240 widows: true,
16241 zIndex: true,
16242 zoom: true,
16243
16244 // SVG-related properties
16245 fillOpacity: true,
16246 floodOpacity: true,
16247 stopOpacity: true,
16248 strokeDasharray: true,
16249 strokeDashoffset: true,
16250 strokeMiterlimit: true,
16251 strokeOpacity: true,
16252 strokeWidth: true
16253 };
16254
16255 /**
16256 * @param {string} prefix vendor-specific prefix, eg: Webkit
16257 * @param {string} key style name, eg: transitionDuration
16258 * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
16259 * WebkitTransitionDuration
16260 */
16261 function prefixKey(prefix, key) {
16262 return prefix + key.charAt(0).toUpperCase() + key.substring(1);
16263 }
16264
16265 /**
16266 * Support style names that may come passed in prefixed by adding permutations
16267 * of vendor prefixes.
16268 */
16269 var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
16270
16271 // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
16272 // infinite loop, because it iterates over the newly added props too.
16273 Object.keys(isUnitlessNumber).forEach(function (prop) {
16274 prefixes.forEach(function (prefix) {
16275 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
16276 });
16277 });
16278
16279 /**
16280 * Convert a value into the proper css writable value. The style name `name`
16281 * should be logical (no hyphens), as specified
16282 * in `CSSProperty.isUnitlessNumber`.
16283 *
16284 * @param {string} name CSS property name such as `topMargin`.
16285 * @param {*} value CSS property value such as `10px`.
16286 * @return {string} Normalized style value with dimensions applied.
16287 */
16288 function dangerousStyleValue(name, value, isCustomProperty) {
16289 // Note that we've removed escapeTextForBrowser() calls here since the
16290 // whole string will be escaped when the attribute is injected into
16291 // the markup. If you provide unsafe user data here they can inject
16292 // arbitrary CSS which may be problematic (I couldn't repro this):
16293 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
16294 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
16295 // This is not an XSS hole but instead a potential CSS injection issue
16296 // which has lead to a greater discussion about how we're going to
16297 // trust URLs moving forward. See #2115901
16298
16299 var isEmpty = value == null || typeof value === 'boolean' || value === '';
16300 if (isEmpty) {
16301 return '';
16302 }
16303
16304 if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
16305 return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
16306 }
16307
16308 return ('' + value).trim();
16309 }
16310
16311 var warnValidStyle = emptyFunction;
16312
16313 {
16314 // 'msTransform' is correct, but the other prefixes should be capitalized
16315 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
16316
16317 // style values shouldn't contain a semicolon
16318 var badStyleValueWithSemicolonPattern = /;\s*$/;
16319
16320 var warnedStyleNames = {};
16321 var warnedStyleValues = {};
16322 var warnedForNaNValue = false;
16323 var warnedForInfinityValue = false;
16324
16325 var warnHyphenatedStyleName = function (name, getStack) {
16326 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
16327 return;
16328 }
16329
16330 warnedStyleNames[name] = true;
16331 warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), getStack());
16332 };
16333
16334 var warnBadVendoredStyleName = function (name, getStack) {
16335 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
16336 return;
16337 }
16338
16339 warnedStyleNames[name] = true;
16340 warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), getStack());
16341 };
16342
16343 var warnStyleValueWithSemicolon = function (name, value, getStack) {
16344 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
16345 return;
16346 }
16347
16348 warnedStyleValues[value] = true;
16349 warning(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.%s', name, value.replace(badStyleValueWithSemicolonPattern, ''), getStack());
16350 };
16351
16352 var warnStyleValueIsNaN = function (name, value, getStack) {
16353 if (warnedForNaNValue) {
16354 return;
16355 }
16356
16357 warnedForNaNValue = true;
16358 warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, getStack());
16359 };
16360
16361 var warnStyleValueIsInfinity = function (name, value, getStack) {
16362 if (warnedForInfinityValue) {
16363 return;
16364 }
16365
16366 warnedForInfinityValue = true;
16367 warning(false, '`Infinity` is an invalid value for the `%s` css style property.%s', name, getStack());
16368 };
16369
16370 warnValidStyle = function (name, value, getStack) {
16371 if (name.indexOf('-') > -1) {
16372 warnHyphenatedStyleName(name, getStack);
16373 } else if (badVendoredStyleNamePattern.test(name)) {
16374 warnBadVendoredStyleName(name, getStack);
16375 } else if (badStyleValueWithSemicolonPattern.test(value)) {
16376 warnStyleValueWithSemicolon(name, value, getStack);
16377 }
16378
16379 if (typeof value === 'number') {
16380 if (isNaN(value)) {
16381 warnStyleValueIsNaN(name, value, getStack);
16382 } else if (!isFinite(value)) {
16383 warnStyleValueIsInfinity(name, value, getStack);
16384 }
16385 }
16386 };
16387 }
16388
16389 var warnValidStyle$1 = warnValidStyle;
16390
16391 /**
16392 * Operations for dealing with CSS properties.
16393 */
16394
16395 /**
16396 * This creates a string that is expected to be equivalent to the style
16397 * attribute generated by server-side rendering. It by-passes warnings and
16398 * security checks so it's not safe to use this value for anything other than
16399 * comparison. It is only used in DEV for SSR validation.
16400 */
16401 function createDangerousStringForStyles(styles) {
16402 {
16403 var serialized = '';
16404 var delimiter = '';
16405 for (var styleName in styles) {
16406 if (!styles.hasOwnProperty(styleName)) {
16407 continue;
16408 }
16409 var styleValue = styles[styleName];
16410 if (styleValue != null) {
16411 var isCustomProperty = styleName.indexOf('--') === 0;
16412 serialized += delimiter + hyphenateStyleName(styleName) + ':';
16413 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
16414
16415 delimiter = ';';
16416 }
16417 }
16418 return serialized || null;
16419 }
16420 }
16421
16422 /**
16423 * Sets the value for multiple styles on a node. If a value is specified as
16424 * '' (empty string), the corresponding style property will be unset.
16425 *
16426 * @param {DOMElement} node
16427 * @param {object} styles
16428 */
16429 function setValueForStyles(node, styles, getStack) {
16430 var style = node.style;
16431 for (var styleName in styles) {
16432 if (!styles.hasOwnProperty(styleName)) {
16433 continue;
16434 }
16435 var isCustomProperty = styleName.indexOf('--') === 0;
16436 {
16437 if (!isCustomProperty) {
16438 warnValidStyle$1(styleName, styles[styleName], getStack);
16439 }
16440 }
16441 var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
16442 if (styleName === 'float') {
16443 styleName = 'cssFloat';
16444 }
16445 if (isCustomProperty) {
16446 style.setProperty(styleName, styleValue);
16447 } else {
16448 style[styleName] = styleValue;
16449 }
16450 }
16451 }
16452
16453 // For HTML, certain tags should omit their close tag. We keep a whitelist for
16454 // those special-case tags.
16455
16456 var omittedCloseTags = {
16457 area: true,
16458 base: true,
16459 br: true,
16460 col: true,
16461 embed: true,
16462 hr: true,
16463 img: true,
16464 input: true,
16465 keygen: true,
16466 link: true,
16467 meta: true,
16468 param: true,
16469 source: true,
16470 track: true,
16471 wbr: true
16472 };
16473
16474 // For HTML, certain tags cannot have children. This has the same purpose as
16475 // `omittedCloseTags` except that `menuitem` should still have its closing tag.
16476
16477 var voidElementTags = _assign({
16478 menuitem: true
16479 }, omittedCloseTags);
16480
16481 var HTML$1 = '__html';
16482
16483 function assertValidProps(tag, props, getStack) {
16484 if (!props) {
16485 return;
16486 }
16487 // Note the use of `==` which checks for null or undefined.
16488 if (voidElementTags[tag]) {
16489 !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, getStack()) : void 0;
16490 }
16491 if (props.dangerouslySetInnerHTML != null) {
16492 !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
16493 !(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
16494 }
16495 {
16496 !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.%s', getStack()) : void 0;
16497 }
16498 !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
16499 }
16500
16501 function isCustomComponent(tagName, props) {
16502 if (tagName.indexOf('-') === -1) {
16503 return typeof props.is === 'string';
16504 }
16505 switch (tagName) {
16506 // These are reserved SVG and MathML elements.
16507 // We don't mind this whitelist too much because we expect it to never grow.
16508 // The alternative is to track the namespace in a few places which is convoluted.
16509 // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
16510 case 'annotation-xml':
16511 case 'color-profile':
16512 case 'font-face':
16513 case 'font-face-src':
16514 case 'font-face-uri':
16515 case 'font-face-format':
16516 case 'font-face-name':
16517 case 'missing-glyph':
16518 return false;
16519 default:
16520 return true;
16521 }
16522 }
16523
16524 // When adding attributes to the HTML or SVG whitelist, be sure to
16525 // also add them to this module to ensure casing and incorrect name
16526 // warnings.
16527 var possibleStandardNames = {
16528 // HTML
16529 accept: 'accept',
16530 acceptcharset: 'acceptCharset',
16531 'accept-charset': 'acceptCharset',
16532 accesskey: 'accessKey',
16533 action: 'action',
16534 allowfullscreen: 'allowFullScreen',
16535 alt: 'alt',
16536 as: 'as',
16537 async: 'async',
16538 autocapitalize: 'autoCapitalize',
16539 autocomplete: 'autoComplete',
16540 autocorrect: 'autoCorrect',
16541 autofocus: 'autoFocus',
16542 autoplay: 'autoPlay',
16543 autosave: 'autoSave',
16544 capture: 'capture',
16545 cellpadding: 'cellPadding',
16546 cellspacing: 'cellSpacing',
16547 challenge: 'challenge',
16548 charset: 'charSet',
16549 checked: 'checked',
16550 children: 'children',
16551 cite: 'cite',
16552 'class': 'className',
16553 classid: 'classID',
16554 classname: 'className',
16555 cols: 'cols',
16556 colspan: 'colSpan',
16557 content: 'content',
16558 contenteditable: 'contentEditable',
16559 contextmenu: 'contextMenu',
16560 controls: 'controls',
16561 controlslist: 'controlsList',
16562 coords: 'coords',
16563 crossorigin: 'crossOrigin',
16564 dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
16565 data: 'data',
16566 datetime: 'dateTime',
16567 'default': 'default',
16568 defaultchecked: 'defaultChecked',
16569 defaultvalue: 'defaultValue',
16570 defer: 'defer',
16571 dir: 'dir',
16572 disabled: 'disabled',
16573 download: 'download',
16574 draggable: 'draggable',
16575 enctype: 'encType',
16576 'for': 'htmlFor',
16577 form: 'form',
16578 formmethod: 'formMethod',
16579 formaction: 'formAction',
16580 formenctype: 'formEncType',
16581 formnovalidate: 'formNoValidate',
16582 formtarget: 'formTarget',
16583 frameborder: 'frameBorder',
16584 headers: 'headers',
16585 height: 'height',
16586 hidden: 'hidden',
16587 high: 'high',
16588 href: 'href',
16589 hreflang: 'hrefLang',
16590 htmlfor: 'htmlFor',
16591 httpequiv: 'httpEquiv',
16592 'http-equiv': 'httpEquiv',
16593 icon: 'icon',
16594 id: 'id',
16595 innerhtml: 'innerHTML',
16596 inputmode: 'inputMode',
16597 integrity: 'integrity',
16598 is: 'is',
16599 itemid: 'itemID',
16600 itemprop: 'itemProp',
16601 itemref: 'itemRef',
16602 itemscope: 'itemScope',
16603 itemtype: 'itemType',
16604 keyparams: 'keyParams',
16605 keytype: 'keyType',
16606 kind: 'kind',
16607 label: 'label',
16608 lang: 'lang',
16609 list: 'list',
16610 loop: 'loop',
16611 low: 'low',
16612 manifest: 'manifest',
16613 marginwidth: 'marginWidth',
16614 marginheight: 'marginHeight',
16615 max: 'max',
16616 maxlength: 'maxLength',
16617 media: 'media',
16618 mediagroup: 'mediaGroup',
16619 method: 'method',
16620 min: 'min',
16621 minlength: 'minLength',
16622 multiple: 'multiple',
16623 muted: 'muted',
16624 name: 'name',
16625 nomodule: 'noModule',
16626 nonce: 'nonce',
16627 novalidate: 'noValidate',
16628 open: 'open',
16629 optimum: 'optimum',
16630 pattern: 'pattern',
16631 placeholder: 'placeholder',
16632 playsinline: 'playsInline',
16633 poster: 'poster',
16634 preload: 'preload',
16635 profile: 'profile',
16636 radiogroup: 'radioGroup',
16637 readonly: 'readOnly',
16638 referrerpolicy: 'referrerPolicy',
16639 rel: 'rel',
16640 required: 'required',
16641 reversed: 'reversed',
16642 role: 'role',
16643 rows: 'rows',
16644 rowspan: 'rowSpan',
16645 sandbox: 'sandbox',
16646 scope: 'scope',
16647 scoped: 'scoped',
16648 scrolling: 'scrolling',
16649 seamless: 'seamless',
16650 selected: 'selected',
16651 shape: 'shape',
16652 size: 'size',
16653 sizes: 'sizes',
16654 span: 'span',
16655 spellcheck: 'spellCheck',
16656 src: 'src',
16657 srcdoc: 'srcDoc',
16658 srclang: 'srcLang',
16659 srcset: 'srcSet',
16660 start: 'start',
16661 step: 'step',
16662 style: 'style',
16663 summary: 'summary',
16664 tabindex: 'tabIndex',
16665 target: 'target',
16666 title: 'title',
16667 type: 'type',
16668 usemap: 'useMap',
16669 value: 'value',
16670 width: 'width',
16671 wmode: 'wmode',
16672 wrap: 'wrap',
16673
16674 // SVG
16675 about: 'about',
16676 accentheight: 'accentHeight',
16677 'accent-height': 'accentHeight',
16678 accumulate: 'accumulate',
16679 additive: 'additive',
16680 alignmentbaseline: 'alignmentBaseline',
16681 'alignment-baseline': 'alignmentBaseline',
16682 allowreorder: 'allowReorder',
16683 alphabetic: 'alphabetic',
16684 amplitude: 'amplitude',
16685 arabicform: 'arabicForm',
16686 'arabic-form': 'arabicForm',
16687 ascent: 'ascent',
16688 attributename: 'attributeName',
16689 attributetype: 'attributeType',
16690 autoreverse: 'autoReverse',
16691 azimuth: 'azimuth',
16692 basefrequency: 'baseFrequency',
16693 baselineshift: 'baselineShift',
16694 'baseline-shift': 'baselineShift',
16695 baseprofile: 'baseProfile',
16696 bbox: 'bbox',
16697 begin: 'begin',
16698 bias: 'bias',
16699 by: 'by',
16700 calcmode: 'calcMode',
16701 capheight: 'capHeight',
16702 'cap-height': 'capHeight',
16703 clip: 'clip',
16704 clippath: 'clipPath',
16705 'clip-path': 'clipPath',
16706 clippathunits: 'clipPathUnits',
16707 cliprule: 'clipRule',
16708 'clip-rule': 'clipRule',
16709 color: 'color',
16710 colorinterpolation: 'colorInterpolation',
16711 'color-interpolation': 'colorInterpolation',
16712 colorinterpolationfilters: 'colorInterpolationFilters',
16713 'color-interpolation-filters': 'colorInterpolationFilters',
16714 colorprofile: 'colorProfile',
16715 'color-profile': 'colorProfile',
16716 colorrendering: 'colorRendering',
16717 'color-rendering': 'colorRendering',
16718 contentscripttype: 'contentScriptType',
16719 contentstyletype: 'contentStyleType',
16720 cursor: 'cursor',
16721 cx: 'cx',
16722 cy: 'cy',
16723 d: 'd',
16724 datatype: 'datatype',
16725 decelerate: 'decelerate',
16726 descent: 'descent',
16727 diffuseconstant: 'diffuseConstant',
16728 direction: 'direction',
16729 display: 'display',
16730 divisor: 'divisor',
16731 dominantbaseline: 'dominantBaseline',
16732 'dominant-baseline': 'dominantBaseline',
16733 dur: 'dur',
16734 dx: 'dx',
16735 dy: 'dy',
16736 edgemode: 'edgeMode',
16737 elevation: 'elevation',
16738 enablebackground: 'enableBackground',
16739 'enable-background': 'enableBackground',
16740 end: 'end',
16741 exponent: 'exponent',
16742 externalresourcesrequired: 'externalResourcesRequired',
16743 fill: 'fill',
16744 fillopacity: 'fillOpacity',
16745 'fill-opacity': 'fillOpacity',
16746 fillrule: 'fillRule',
16747 'fill-rule': 'fillRule',
16748 filter: 'filter',
16749 filterres: 'filterRes',
16750 filterunits: 'filterUnits',
16751 floodopacity: 'floodOpacity',
16752 'flood-opacity': 'floodOpacity',
16753 floodcolor: 'floodColor',
16754 'flood-color': 'floodColor',
16755 focusable: 'focusable',
16756 fontfamily: 'fontFamily',
16757 'font-family': 'fontFamily',
16758 fontsize: 'fontSize',
16759 'font-size': 'fontSize',
16760 fontsizeadjust: 'fontSizeAdjust',
16761 'font-size-adjust': 'fontSizeAdjust',
16762 fontstretch: 'fontStretch',
16763 'font-stretch': 'fontStretch',
16764 fontstyle: 'fontStyle',
16765 'font-style': 'fontStyle',
16766 fontvariant: 'fontVariant',
16767 'font-variant': 'fontVariant',
16768 fontweight: 'fontWeight',
16769 'font-weight': 'fontWeight',
16770 format: 'format',
16771 from: 'from',
16772 fx: 'fx',
16773 fy: 'fy',
16774 g1: 'g1',
16775 g2: 'g2',
16776 glyphname: 'glyphName',
16777 'glyph-name': 'glyphName',
16778 glyphorientationhorizontal: 'glyphOrientationHorizontal',
16779 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
16780 glyphorientationvertical: 'glyphOrientationVertical',
16781 'glyph-orientation-vertical': 'glyphOrientationVertical',
16782 glyphref: 'glyphRef',
16783 gradienttransform: 'gradientTransform',
16784 gradientunits: 'gradientUnits',
16785 hanging: 'hanging',
16786 horizadvx: 'horizAdvX',
16787 'horiz-adv-x': 'horizAdvX',
16788 horizoriginx: 'horizOriginX',
16789 'horiz-origin-x': 'horizOriginX',
16790 ideographic: 'ideographic',
16791 imagerendering: 'imageRendering',
16792 'image-rendering': 'imageRendering',
16793 in2: 'in2',
16794 'in': 'in',
16795 inlist: 'inlist',
16796 intercept: 'intercept',
16797 k1: 'k1',
16798 k2: 'k2',
16799 k3: 'k3',
16800 k4: 'k4',
16801 k: 'k',
16802 kernelmatrix: 'kernelMatrix',
16803 kernelunitlength: 'kernelUnitLength',
16804 kerning: 'kerning',
16805 keypoints: 'keyPoints',
16806 keysplines: 'keySplines',
16807 keytimes: 'keyTimes',
16808 lengthadjust: 'lengthAdjust',
16809 letterspacing: 'letterSpacing',
16810 'letter-spacing': 'letterSpacing',
16811 lightingcolor: 'lightingColor',
16812 'lighting-color': 'lightingColor',
16813 limitingconeangle: 'limitingConeAngle',
16814 local: 'local',
16815 markerend: 'markerEnd',
16816 'marker-end': 'markerEnd',
16817 markerheight: 'markerHeight',
16818 markermid: 'markerMid',
16819 'marker-mid': 'markerMid',
16820 markerstart: 'markerStart',
16821 'marker-start': 'markerStart',
16822 markerunits: 'markerUnits',
16823 markerwidth: 'markerWidth',
16824 mask: 'mask',
16825 maskcontentunits: 'maskContentUnits',
16826 maskunits: 'maskUnits',
16827 mathematical: 'mathematical',
16828 mode: 'mode',
16829 numoctaves: 'numOctaves',
16830 offset: 'offset',
16831 opacity: 'opacity',
16832 operator: 'operator',
16833 order: 'order',
16834 orient: 'orient',
16835 orientation: 'orientation',
16836 origin: 'origin',
16837 overflow: 'overflow',
16838 overlineposition: 'overlinePosition',
16839 'overline-position': 'overlinePosition',
16840 overlinethickness: 'overlineThickness',
16841 'overline-thickness': 'overlineThickness',
16842 paintorder: 'paintOrder',
16843 'paint-order': 'paintOrder',
16844 panose1: 'panose1',
16845 'panose-1': 'panose1',
16846 pathlength: 'pathLength',
16847 patterncontentunits: 'patternContentUnits',
16848 patterntransform: 'patternTransform',
16849 patternunits: 'patternUnits',
16850 pointerevents: 'pointerEvents',
16851 'pointer-events': 'pointerEvents',
16852 points: 'points',
16853 pointsatx: 'pointsAtX',
16854 pointsaty: 'pointsAtY',
16855 pointsatz: 'pointsAtZ',
16856 prefix: 'prefix',
16857 preservealpha: 'preserveAlpha',
16858 preserveaspectratio: 'preserveAspectRatio',
16859 primitiveunits: 'primitiveUnits',
16860 property: 'property',
16861 r: 'r',
16862 radius: 'radius',
16863 refx: 'refX',
16864 refy: 'refY',
16865 renderingintent: 'renderingIntent',
16866 'rendering-intent': 'renderingIntent',
16867 repeatcount: 'repeatCount',
16868 repeatdur: 'repeatDur',
16869 requiredextensions: 'requiredExtensions',
16870 requiredfeatures: 'requiredFeatures',
16871 resource: 'resource',
16872 restart: 'restart',
16873 result: 'result',
16874 results: 'results',
16875 rotate: 'rotate',
16876 rx: 'rx',
16877 ry: 'ry',
16878 scale: 'scale',
16879 security: 'security',
16880 seed: 'seed',
16881 shaperendering: 'shapeRendering',
16882 'shape-rendering': 'shapeRendering',
16883 slope: 'slope',
16884 spacing: 'spacing',
16885 specularconstant: 'specularConstant',
16886 specularexponent: 'specularExponent',
16887 speed: 'speed',
16888 spreadmethod: 'spreadMethod',
16889 startoffset: 'startOffset',
16890 stddeviation: 'stdDeviation',
16891 stemh: 'stemh',
16892 stemv: 'stemv',
16893 stitchtiles: 'stitchTiles',
16894 stopcolor: 'stopColor',
16895 'stop-color': 'stopColor',
16896 stopopacity: 'stopOpacity',
16897 'stop-opacity': 'stopOpacity',
16898 strikethroughposition: 'strikethroughPosition',
16899 'strikethrough-position': 'strikethroughPosition',
16900 strikethroughthickness: 'strikethroughThickness',
16901 'strikethrough-thickness': 'strikethroughThickness',
16902 string: 'string',
16903 stroke: 'stroke',
16904 strokedasharray: 'strokeDasharray',
16905 'stroke-dasharray': 'strokeDasharray',
16906 strokedashoffset: 'strokeDashoffset',
16907 'stroke-dashoffset': 'strokeDashoffset',
16908 strokelinecap: 'strokeLinecap',
16909 'stroke-linecap': 'strokeLinecap',
16910 strokelinejoin: 'strokeLinejoin',
16911 'stroke-linejoin': 'strokeLinejoin',
16912 strokemiterlimit: 'strokeMiterlimit',
16913 'stroke-miterlimit': 'strokeMiterlimit',
16914 strokewidth: 'strokeWidth',
16915 'stroke-width': 'strokeWidth',
16916 strokeopacity: 'strokeOpacity',
16917 'stroke-opacity': 'strokeOpacity',
16918 suppresscontenteditablewarning: 'suppressContentEditableWarning',
16919 suppresshydrationwarning: 'suppressHydrationWarning',
16920 surfacescale: 'surfaceScale',
16921 systemlanguage: 'systemLanguage',
16922 tablevalues: 'tableValues',
16923 targetx: 'targetX',
16924 targety: 'targetY',
16925 textanchor: 'textAnchor',
16926 'text-anchor': 'textAnchor',
16927 textdecoration: 'textDecoration',
16928 'text-decoration': 'textDecoration',
16929 textlength: 'textLength',
16930 textrendering: 'textRendering',
16931 'text-rendering': 'textRendering',
16932 to: 'to',
16933 transform: 'transform',
16934 'typeof': 'typeof',
16935 u1: 'u1',
16936 u2: 'u2',
16937 underlineposition: 'underlinePosition',
16938 'underline-position': 'underlinePosition',
16939 underlinethickness: 'underlineThickness',
16940 'underline-thickness': 'underlineThickness',
16941 unicode: 'unicode',
16942 unicodebidi: 'unicodeBidi',
16943 'unicode-bidi': 'unicodeBidi',
16944 unicoderange: 'unicodeRange',
16945 'unicode-range': 'unicodeRange',
16946 unitsperem: 'unitsPerEm',
16947 'units-per-em': 'unitsPerEm',
16948 unselectable: 'unselectable',
16949 valphabetic: 'vAlphabetic',
16950 'v-alphabetic': 'vAlphabetic',
16951 values: 'values',
16952 vectoreffect: 'vectorEffect',
16953 'vector-effect': 'vectorEffect',
16954 version: 'version',
16955 vertadvy: 'vertAdvY',
16956 'vert-adv-y': 'vertAdvY',
16957 vertoriginx: 'vertOriginX',
16958 'vert-origin-x': 'vertOriginX',
16959 vertoriginy: 'vertOriginY',
16960 'vert-origin-y': 'vertOriginY',
16961 vhanging: 'vHanging',
16962 'v-hanging': 'vHanging',
16963 videographic: 'vIdeographic',
16964 'v-ideographic': 'vIdeographic',
16965 viewbox: 'viewBox',
16966 viewtarget: 'viewTarget',
16967 visibility: 'visibility',
16968 vmathematical: 'vMathematical',
16969 'v-mathematical': 'vMathematical',
16970 vocab: 'vocab',
16971 widths: 'widths',
16972 wordspacing: 'wordSpacing',
16973 'word-spacing': 'wordSpacing',
16974 writingmode: 'writingMode',
16975 'writing-mode': 'writingMode',
16976 x1: 'x1',
16977 x2: 'x2',
16978 x: 'x',
16979 xchannelselector: 'xChannelSelector',
16980 xheight: 'xHeight',
16981 'x-height': 'xHeight',
16982 xlinkactuate: 'xlinkActuate',
16983 'xlink:actuate': 'xlinkActuate',
16984 xlinkarcrole: 'xlinkArcrole',
16985 'xlink:arcrole': 'xlinkArcrole',
16986 xlinkhref: 'xlinkHref',
16987 'xlink:href': 'xlinkHref',
16988 xlinkrole: 'xlinkRole',
16989 'xlink:role': 'xlinkRole',
16990 xlinkshow: 'xlinkShow',
16991 'xlink:show': 'xlinkShow',
16992 xlinktitle: 'xlinkTitle',
16993 'xlink:title': 'xlinkTitle',
16994 xlinktype: 'xlinkType',
16995 'xlink:type': 'xlinkType',
16996 xmlbase: 'xmlBase',
16997 'xml:base': 'xmlBase',
16998 xmllang: 'xmlLang',
16999 'xml:lang': 'xmlLang',
17000 xmlns: 'xmlns',
17001 'xml:space': 'xmlSpace',
17002 xmlnsxlink: 'xmlnsXlink',
17003 'xmlns:xlink': 'xmlnsXlink',
17004 xmlspace: 'xmlSpace',
17005 y1: 'y1',
17006 y2: 'y2',
17007 y: 'y',
17008 ychannelselector: 'yChannelSelector',
17009 z: 'z',
17010 zoomandpan: 'zoomAndPan'
17011 };
17012
17013 var ariaProperties = {
17014 'aria-current': 0, // state
17015 'aria-details': 0,
17016 'aria-disabled': 0, // state
17017 'aria-hidden': 0, // state
17018 'aria-invalid': 0, // state
17019 'aria-keyshortcuts': 0,
17020 'aria-label': 0,
17021 'aria-roledescription': 0,
17022 // Widget Attributes
17023 'aria-autocomplete': 0,
17024 'aria-checked': 0,
17025 'aria-expanded': 0,
17026 'aria-haspopup': 0,
17027 'aria-level': 0,
17028 'aria-modal': 0,
17029 'aria-multiline': 0,
17030 'aria-multiselectable': 0,
17031 'aria-orientation': 0,
17032 'aria-placeholder': 0,
17033 'aria-pressed': 0,
17034 'aria-readonly': 0,
17035 'aria-required': 0,
17036 'aria-selected': 0,
17037 'aria-sort': 0,
17038 'aria-valuemax': 0,
17039 'aria-valuemin': 0,
17040 'aria-valuenow': 0,
17041 'aria-valuetext': 0,
17042 // Live Region Attributes
17043 'aria-atomic': 0,
17044 'aria-busy': 0,
17045 'aria-live': 0,
17046 'aria-relevant': 0,
17047 // Drag-and-Drop Attributes
17048 'aria-dropeffect': 0,
17049 'aria-grabbed': 0,
17050 // Relationship Attributes
17051 'aria-activedescendant': 0,
17052 'aria-colcount': 0,
17053 'aria-colindex': 0,
17054 'aria-colspan': 0,
17055 'aria-controls': 0,
17056 'aria-describedby': 0,
17057 'aria-errormessage': 0,
17058 'aria-flowto': 0,
17059 'aria-labelledby': 0,
17060 'aria-owns': 0,
17061 'aria-posinset': 0,
17062 'aria-rowcount': 0,
17063 'aria-rowindex': 0,
17064 'aria-rowspan': 0,
17065 'aria-setsize': 0
17066 };
17067
17068 var warnedProperties = {};
17069 var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
17070 var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
17071
17072 var hasOwnProperty = Object.prototype.hasOwnProperty;
17073
17074 function getStackAddendum() {
17075 var stack = ReactDebugCurrentFrame.getStackAddendum();
17076 return stack != null ? stack : '';
17077 }
17078
17079 function validateProperty(tagName, name) {
17080 if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
17081 return true;
17082 }
17083
17084 if (rARIACamel.test(name)) {
17085 var ariaName = 'aria-' + name.slice(4).toLowerCase();
17086 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
17087
17088 // If this is an aria-* attribute, but is not listed in the known DOM
17089 // DOM properties, then it is an invalid aria-* attribute.
17090 if (correctName == null) {
17091 warning(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum());
17092 warnedProperties[name] = true;
17093 return true;
17094 }
17095 // aria-* attributes should be lowercase; suggest the lowercase version.
17096 if (name !== correctName) {
17097 warning(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum());
17098 warnedProperties[name] = true;
17099 return true;
17100 }
17101 }
17102
17103 if (rARIA.test(name)) {
17104 var lowerCasedName = name.toLowerCase();
17105 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
17106
17107 // If this is an aria-* attribute, but is not listed in the known DOM
17108 // DOM properties, then it is an invalid aria-* attribute.
17109 if (standardName == null) {
17110 warnedProperties[name] = true;
17111 return false;
17112 }
17113 // aria-* attributes should be lowercase; suggest the lowercase version.
17114 if (name !== standardName) {
17115 warning(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum());
17116 warnedProperties[name] = true;
17117 return true;
17118 }
17119 }
17120
17121 return true;
17122 }
17123
17124 function warnInvalidARIAProps(type, props) {
17125 var invalidProps = [];
17126
17127 for (var key in props) {
17128 var isValid = validateProperty(type, key);
17129 if (!isValid) {
17130 invalidProps.push(key);
17131 }
17132 }
17133
17134 var unknownPropString = invalidProps.map(function (prop) {
17135 return '`' + prop + '`';
17136 }).join(', ');
17137
17138 if (invalidProps.length === 1) {
17139 warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum());
17140 } else if (invalidProps.length > 1) {
17141 warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum());
17142 }
17143 }
17144
17145 function validateProperties(type, props) {
17146 if (isCustomComponent(type, props)) {
17147 return;
17148 }
17149 warnInvalidARIAProps(type, props);
17150 }
17151
17152 var didWarnValueNull = false;
17153
17154 function getStackAddendum$1() {
17155 var stack = ReactDebugCurrentFrame.getStackAddendum();
17156 return stack != null ? stack : '';
17157 }
17158
17159 function validateProperties$1(type, props) {
17160 if (type !== 'input' && type !== 'textarea' && type !== 'select') {
17161 return;
17162 }
17163
17164 if (props != null && props.value === null && !didWarnValueNull) {
17165 didWarnValueNull = true;
17166 if (type === 'select' && props.multiple) {
17167 warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.%s', type, getStackAddendum$1());
17168 } else {
17169 warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', type, getStackAddendum$1());
17170 }
17171 }
17172 }
17173
17174 function getStackAddendum$2() {
17175 var stack = ReactDebugCurrentFrame.getStackAddendum();
17176 return stack != null ? stack : '';
17177 }
17178
17179 var validateProperty$1 = function () {};
17180
17181 {
17182 var warnedProperties$1 = {};
17183 var _hasOwnProperty = Object.prototype.hasOwnProperty;
17184 var EVENT_NAME_REGEX = /^on./;
17185 var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
17186 var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
17187 var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
17188
17189 validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
17190 if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
17191 return true;
17192 }
17193
17194 var lowerCasedName = name.toLowerCase();
17195 if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
17196 warning(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
17197 warnedProperties$1[name] = true;
17198 return true;
17199 }
17200
17201 // We can't rely on the event system being injected on the server.
17202 if (canUseEventSystem) {
17203 if (registrationNameModules.hasOwnProperty(name)) {
17204 return true;
17205 }
17206 var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
17207 if (registrationName != null) {
17208 warning(false, 'Invalid event handler property `%s`. Did you mean `%s`?%s', name, registrationName, getStackAddendum$2());
17209 warnedProperties$1[name] = true;
17210 return true;
17211 }
17212 if (EVENT_NAME_REGEX.test(name)) {
17213 warning(false, 'Unknown event handler property `%s`. It will be ignored.%s', name, getStackAddendum$2());
17214 warnedProperties$1[name] = true;
17215 return true;
17216 }
17217 } else if (EVENT_NAME_REGEX.test(name)) {
17218 // If no event plugins have been injected, we are in a server environment.
17219 // So we can't tell if the event name is correct for sure, but we can filter
17220 // out known bad ones like `onclick`. We can't suggest a specific replacement though.
17221 if (INVALID_EVENT_NAME_REGEX.test(name)) {
17222 warning(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.%s', name, getStackAddendum$2());
17223 }
17224 warnedProperties$1[name] = true;
17225 return true;
17226 }
17227
17228 // Let the ARIA attribute hook validate ARIA attributes
17229 if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
17230 return true;
17231 }
17232
17233 if (lowerCasedName === 'innerhtml') {
17234 warning(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
17235 warnedProperties$1[name] = true;
17236 return true;
17237 }
17238
17239 if (lowerCasedName === 'aria') {
17240 warning(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
17241 warnedProperties$1[name] = true;
17242 return true;
17243 }
17244
17245 if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
17246 warning(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.%s', typeof value, getStackAddendum$2());
17247 warnedProperties$1[name] = true;
17248 return true;
17249 }
17250
17251 if (typeof value === 'number' && isNaN(value)) {
17252 warning(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.%s', name, getStackAddendum$2());
17253 warnedProperties$1[name] = true;
17254 return true;
17255 }
17256
17257 var propertyInfo = getPropertyInfo(name);
17258 var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
17259
17260 // Known attributes should match the casing specified in the property config.
17261 if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
17262 var standardName = possibleStandardNames[lowerCasedName];
17263 if (standardName !== name) {
17264 warning(false, 'Invalid DOM property `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$2());
17265 warnedProperties$1[name] = true;
17266 return true;
17267 }
17268 } else if (!isReserved && name !== lowerCasedName) {
17269 // Unknown attributes should have lowercase casing since that's how they
17270 // will be cased anyway with server rendering.
17271 warning(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.%s', name, lowerCasedName, getStackAddendum$2());
17272 warnedProperties$1[name] = true;
17273 return true;
17274 }
17275
17276 if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
17277 if (value) {
17278 warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.%s', value, name, name, value, name, getStackAddendum$2());
17279 } else {
17280 warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.%s', value, name, name, value, name, name, name, getStackAddendum$2());
17281 }
17282 warnedProperties$1[name] = true;
17283 return true;
17284 }
17285
17286 // Now that we've validated casing, do not validate
17287 // data types for reserved props
17288 if (isReserved) {
17289 return true;
17290 }
17291
17292 // Warn when a known attribute is a bad type
17293 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
17294 warnedProperties$1[name] = true;
17295 return false;
17296 }
17297
17298 return true;
17299 };
17300 }
17301
17302 var warnUnknownProperties = function (type, props, canUseEventSystem) {
17303 var unknownProps = [];
17304 for (var key in props) {
17305 var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
17306 if (!isValid) {
17307 unknownProps.push(key);
17308 }
17309 }
17310
17311 var unknownPropString = unknownProps.map(function (prop) {
17312 return '`' + prop + '`';
17313 }).join(', ');
17314 if (unknownProps.length === 1) {
17315 warning(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$2());
17316 } else if (unknownProps.length > 1) {
17317 warning(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$2());
17318 }
17319 };
17320
17321 function validateProperties$2(type, props, canUseEventSystem) {
17322 if (isCustomComponent(type, props)) {
17323 return;
17324 }
17325 warnUnknownProperties(type, props, canUseEventSystem);
17326 }
17327
17328 // TODO: direct imports like some-package/src/* are bad. Fix me.
17329 var getCurrentFiberOwnerName$2 = ReactDebugCurrentFiber.getCurrentFiberOwnerName;
17330 var getCurrentFiberStackAddendum$3 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
17331
17332 var didWarnInvalidHydration = false;
17333 var didWarnShadyDOM = false;
17334
17335 var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
17336 var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
17337 var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
17338 var AUTOFOCUS = 'autoFocus';
17339 var CHILDREN = 'children';
17340 var STYLE = 'style';
17341 var HTML = '__html';
17342
17343 var HTML_NAMESPACE = Namespaces.html;
17344
17345
17346 var getStack = emptyFunction.thatReturns('');
17347
17348 var warnedUnknownTags = void 0;
17349 var suppressHydrationWarning = void 0;
17350
17351 var validatePropertiesInDevelopment = void 0;
17352 var warnForTextDifference = void 0;
17353 var warnForPropDifference = void 0;
17354 var warnForExtraAttributes = void 0;
17355 var warnForInvalidEventListener = void 0;
17356
17357 var normalizeMarkupForTextOrAttribute = void 0;
17358 var normalizeHTML = void 0;
17359
17360 {
17361 getStack = getCurrentFiberStackAddendum$3;
17362
17363 warnedUnknownTags = {
17364 // Chrome is the only major browser not shipping <time>. But as of July
17365 // 2017 it intends to ship it due to widespread usage. We intentionally
17366 // *don't* warn for <time> even if it's unrecognized by Chrome because
17367 // it soon will be, and many apps have been using it anyway.
17368 time: true,
17369 // There are working polyfills for <dialog>. Let people use it.
17370 dialog: true
17371 };
17372
17373 validatePropertiesInDevelopment = function (type, props) {
17374 validateProperties(type, props);
17375 validateProperties$1(type, props);
17376 validateProperties$2(type, props, /* canUseEventSystem */true);
17377 };
17378
17379 // HTML parsing normalizes CR and CRLF to LF.
17380 // It also can turn \u0000 into \uFFFD inside attributes.
17381 // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream
17382 // If we have a mismatch, it might be caused by that.
17383 // We will still patch up in this case but not fire the warning.
17384 var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
17385 var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
17386
17387 normalizeMarkupForTextOrAttribute = function (markup) {
17388 var markupString = typeof markup === 'string' ? markup : '' + markup;
17389 return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
17390 };
17391
17392 warnForTextDifference = function (serverText, clientText) {
17393 if (didWarnInvalidHydration) {
17394 return;
17395 }
17396 var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
17397 var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
17398 if (normalizedServerText === normalizedClientText) {
17399 return;
17400 }
17401 didWarnInvalidHydration = true;
17402 warning(false, 'Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
17403 };
17404
17405 warnForPropDifference = function (propName, serverValue, clientValue) {
17406 if (didWarnInvalidHydration) {
17407 return;
17408 }
17409 var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
17410 var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
17411 if (normalizedServerValue === normalizedClientValue) {
17412 return;
17413 }
17414 didWarnInvalidHydration = true;
17415 warning(false, 'Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
17416 };
17417
17418 warnForExtraAttributes = function (attributeNames) {
17419 if (didWarnInvalidHydration) {
17420 return;
17421 }
17422 didWarnInvalidHydration = true;
17423 var names = [];
17424 attributeNames.forEach(function (name) {
17425 names.push(name);
17426 });
17427 warning(false, 'Extra attributes from the server: %s', names);
17428 };
17429
17430 warnForInvalidEventListener = function (registrationName, listener) {
17431 if (listener === false) {
17432 warning(false, 'Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.%s', registrationName, registrationName, registrationName, getCurrentFiberStackAddendum$3());
17433 } else {
17434 warning(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.%s', registrationName, typeof listener, getCurrentFiberStackAddendum$3());
17435 }
17436 };
17437
17438 // Parse the HTML and read it back to normalize the HTML string so that it
17439 // can be used for comparison.
17440 normalizeHTML = function (parent, html) {
17441 // We could have created a separate document here to avoid
17442 // re-initializing custom elements if they exist. But this breaks
17443 // how <noscript> is being handled. So we use the same document.
17444 // See the discussion in https://github.com/facebook/react/pull/11157.
17445 var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
17446 testElement.innerHTML = html;
17447 return testElement.innerHTML;
17448 };
17449 }
17450
17451 function ensureListeningTo(rootContainerElement, registrationName) {
17452 var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE;
17453 var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument;
17454 listenTo(registrationName, doc);
17455 }
17456
17457 function getOwnerDocumentFromRootContainer(rootContainerElement) {
17458 return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
17459 }
17460
17461 function trapClickOnNonInteractiveElement(node) {
17462 // Mobile Safari does not fire properly bubble click events on
17463 // non-interactive elements, which means delegated click listeners do not
17464 // fire. The workaround for this bug involves attaching an empty click
17465 // listener on the target node.
17466 // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
17467 // Just set it using the onclick property so that we don't have to manage any
17468 // bookkeeping for it. Not sure if we need to clear it when the listener is
17469 // removed.
17470 // TODO: Only do this for the relevant Safaris maybe?
17471 node.onclick = emptyFunction;
17472 }
17473
17474 function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
17475 for (var propKey in nextProps) {
17476 if (!nextProps.hasOwnProperty(propKey)) {
17477 continue;
17478 }
17479 var nextProp = nextProps[propKey];
17480 if (propKey === STYLE) {
17481 {
17482 if (nextProp) {
17483 // Freeze the next style object so that we can assume it won't be
17484 // mutated. We have already warned for this in the past.
17485 Object.freeze(nextProp);
17486 }
17487 }
17488 // Relies on `updateStylesByID` not mutating `styleUpdates`.
17489 setValueForStyles(domElement, nextProp, getStack);
17490 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
17491 var nextHtml = nextProp ? nextProp[HTML] : undefined;
17492 if (nextHtml != null) {
17493 setInnerHTML(domElement, nextHtml);
17494 }
17495 } else if (propKey === CHILDREN) {
17496 if (typeof nextProp === 'string') {
17497 // Avoid setting initial textContent when the text is empty. In IE11 setting
17498 // textContent on a <textarea> will cause the placeholder to not
17499 // show within the <textarea> until it has been focused and blurred again.
17500 // https://github.com/facebook/react/issues/6731#issuecomment-254874553
17501 var canSetTextContent = tag !== 'textarea' || nextProp !== '';
17502 if (canSetTextContent) {
17503 setTextContent(domElement, nextProp);
17504 }
17505 } else if (typeof nextProp === 'number') {
17506 setTextContent(domElement, '' + nextProp);
17507 }
17508 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
17509 // Noop
17510 } else if (propKey === AUTOFOCUS) {
17511 // We polyfill it separately on the client during commit.
17512 // We blacklist it here rather than in the property list because we emit it in SSR.
17513 } else if (registrationNameModules.hasOwnProperty(propKey)) {
17514 if (nextProp != null) {
17515 if (true && typeof nextProp !== 'function') {
17516 warnForInvalidEventListener(propKey, nextProp);
17517 }
17518 ensureListeningTo(rootContainerElement, propKey);
17519 }
17520 } else if (nextProp != null) {
17521 setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
17522 }
17523 }
17524 }
17525
17526 function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
17527 // TODO: Handle wasCustomComponentTag
17528 for (var i = 0; i < updatePayload.length; i += 2) {
17529 var propKey = updatePayload[i];
17530 var propValue = updatePayload[i + 1];
17531 if (propKey === STYLE) {
17532 setValueForStyles(domElement, propValue, getStack);
17533 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
17534 setInnerHTML(domElement, propValue);
17535 } else if (propKey === CHILDREN) {
17536 setTextContent(domElement, propValue);
17537 } else {
17538 setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
17539 }
17540 }
17541 }
17542
17543 function createElement$1(type, props, rootContainerElement, parentNamespace) {
17544 var isCustomComponentTag = void 0;
17545
17546 // We create tags in the namespace of their parent container, except HTML
17547 // tags get no namespace.
17548 var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
17549 var domElement = void 0;
17550 var namespaceURI = parentNamespace;
17551 if (namespaceURI === HTML_NAMESPACE) {
17552 namespaceURI = getIntrinsicNamespace(type);
17553 }
17554 if (namespaceURI === HTML_NAMESPACE) {
17555 {
17556 isCustomComponentTag = isCustomComponent(type, props);
17557 // Should this check be gated by parent namespace? Not sure we want to
17558 // allow <SVG> or <mATH>.
17559 !(isCustomComponentTag || type === type.toLowerCase()) ? warning(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type) : void 0;
17560 }
17561
17562 if (type === 'script') {
17563 // Create the script via .innerHTML so its "parser-inserted" flag is
17564 // set to true and it does not execute
17565 var div = ownerDocument.createElement('div');
17566 div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
17567 // This is guaranteed to yield a script element.
17568 var firstChild = div.firstChild;
17569 domElement = div.removeChild(firstChild);
17570 } else if (typeof props.is === 'string') {
17571 // $FlowIssue `createElement` should be updated for Web Components
17572 domElement = ownerDocument.createElement(type, { is: props.is });
17573 } else {
17574 // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
17575 // See discussion in https://github.com/facebook/react/pull/6896
17576 // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
17577 domElement = ownerDocument.createElement(type);
17578 }
17579 } else {
17580 domElement = ownerDocument.createElementNS(namespaceURI, type);
17581 }
17582
17583 {
17584 if (namespaceURI === HTML_NAMESPACE) {
17585 if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
17586 warnedUnknownTags[type] = true;
17587 warning(false, 'The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type);
17588 }
17589 }
17590 }
17591
17592 return domElement;
17593 }
17594
17595 function createTextNode$1(text, rootContainerElement) {
17596 return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
17597 }
17598
17599 function setInitialProperties$1(domElement, tag, rawProps, rootContainerElement) {
17600 var isCustomComponentTag = isCustomComponent(tag, rawProps);
17601 {
17602 validatePropertiesInDevelopment(tag, rawProps);
17603 if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
17604 warning(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerName$2() || 'A component');
17605 didWarnShadyDOM = true;
17606 }
17607 }
17608
17609 // TODO: Make sure that we check isMounted before firing any of these events.
17610 var props = void 0;
17611 switch (tag) {
17612 case 'iframe':
17613 case 'object':
17614 trapBubbledEvent('topLoad', 'load', domElement);
17615 props = rawProps;
17616 break;
17617 case 'video':
17618 case 'audio':
17619 // Create listener for each media event
17620 for (var event in mediaEventTypes) {
17621 if (mediaEventTypes.hasOwnProperty(event)) {
17622 trapBubbledEvent(event, mediaEventTypes[event], domElement);
17623 }
17624 }
17625 props = rawProps;
17626 break;
17627 case 'source':
17628 trapBubbledEvent('topError', 'error', domElement);
17629 props = rawProps;
17630 break;
17631 case 'img':
17632 case 'image':
17633 case 'link':
17634 trapBubbledEvent('topError', 'error', domElement);
17635 trapBubbledEvent('topLoad', 'load', domElement);
17636 props = rawProps;
17637 break;
17638 case 'form':
17639 trapBubbledEvent('topReset', 'reset', domElement);
17640 trapBubbledEvent('topSubmit', 'submit', domElement);
17641 props = rawProps;
17642 break;
17643 case 'details':
17644 trapBubbledEvent('topToggle', 'toggle', domElement);
17645 props = rawProps;
17646 break;
17647 case 'input':
17648 initWrapperState(domElement, rawProps);
17649 props = getHostProps(domElement, rawProps);
17650 trapBubbledEvent('topInvalid', 'invalid', domElement);
17651 // For controlled components we always need to ensure we're listening
17652 // to onChange. Even if there is no listener.
17653 ensureListeningTo(rootContainerElement, 'onChange');
17654 break;
17655 case 'option':
17656 validateProps(domElement, rawProps);
17657 props = getHostProps$1(domElement, rawProps);
17658 break;
17659 case 'select':
17660 initWrapperState$1(domElement, rawProps);
17661 props = getHostProps$2(domElement, rawProps);
17662 trapBubbledEvent('topInvalid', 'invalid', domElement);
17663 // For controlled components we always need to ensure we're listening
17664 // to onChange. Even if there is no listener.
17665 ensureListeningTo(rootContainerElement, 'onChange');
17666 break;
17667 case 'textarea':
17668 initWrapperState$2(domElement, rawProps);
17669 props = getHostProps$3(domElement, rawProps);
17670 trapBubbledEvent('topInvalid', 'invalid', domElement);
17671 // For controlled components we always need to ensure we're listening
17672 // to onChange. Even if there is no listener.
17673 ensureListeningTo(rootContainerElement, 'onChange');
17674 break;
17675 default:
17676 props = rawProps;
17677 }
17678
17679 assertValidProps(tag, props, getStack);
17680
17681 setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
17682
17683 switch (tag) {
17684 case 'input':
17685 // TODO: Make sure we check if this is still unmounted or do any clean
17686 // up necessary since we never stop tracking anymore.
17687 track(domElement);
17688 postMountWrapper(domElement, rawProps);
17689 break;
17690 case 'textarea':
17691 // TODO: Make sure we check if this is still unmounted or do any clean
17692 // up necessary since we never stop tracking anymore.
17693 track(domElement);
17694 postMountWrapper$3(domElement, rawProps);
17695 break;
17696 case 'option':
17697 postMountWrapper$1(domElement, rawProps);
17698 break;
17699 case 'select':
17700 postMountWrapper$2(domElement, rawProps);
17701 break;
17702 default:
17703 if (typeof props.onClick === 'function') {
17704 // TODO: This cast may not be sound for SVG, MathML or custom elements.
17705 trapClickOnNonInteractiveElement(domElement);
17706 }
17707 break;
17708 }
17709 }
17710
17711 // Calculate the diff between the two objects.
17712 function diffProperties$1(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
17713 {
17714 validatePropertiesInDevelopment(tag, nextRawProps);
17715 }
17716
17717 var updatePayload = null;
17718
17719 var lastProps = void 0;
17720 var nextProps = void 0;
17721 switch (tag) {
17722 case 'input':
17723 lastProps = getHostProps(domElement, lastRawProps);
17724 nextProps = getHostProps(domElement, nextRawProps);
17725 updatePayload = [];
17726 break;
17727 case 'option':
17728 lastProps = getHostProps$1(domElement, lastRawProps);
17729 nextProps = getHostProps$1(domElement, nextRawProps);
17730 updatePayload = [];
17731 break;
17732 case 'select':
17733 lastProps = getHostProps$2(domElement, lastRawProps);
17734 nextProps = getHostProps$2(domElement, nextRawProps);
17735 updatePayload = [];
17736 break;
17737 case 'textarea':
17738 lastProps = getHostProps$3(domElement, lastRawProps);
17739 nextProps = getHostProps$3(domElement, nextRawProps);
17740 updatePayload = [];
17741 break;
17742 default:
17743 lastProps = lastRawProps;
17744 nextProps = nextRawProps;
17745 if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
17746 // TODO: This cast may not be sound for SVG, MathML or custom elements.
17747 trapClickOnNonInteractiveElement(domElement);
17748 }
17749 break;
17750 }
17751
17752 assertValidProps(tag, nextProps, getStack);
17753
17754 var propKey = void 0;
17755 var styleName = void 0;
17756 var styleUpdates = null;
17757 for (propKey in lastProps) {
17758 if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
17759 continue;
17760 }
17761 if (propKey === STYLE) {
17762 var lastStyle = lastProps[propKey];
17763 for (styleName in lastStyle) {
17764 if (lastStyle.hasOwnProperty(styleName)) {
17765 if (!styleUpdates) {
17766 styleUpdates = {};
17767 }
17768 styleUpdates[styleName] = '';
17769 }
17770 }
17771 } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) {
17772 // Noop. This is handled by the clear text mechanism.
17773 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
17774 // Noop
17775 } else if (propKey === AUTOFOCUS) {
17776 // Noop. It doesn't work on updates anyway.
17777 } else if (registrationNameModules.hasOwnProperty(propKey)) {
17778 // This is a special case. If any listener updates we need to ensure
17779 // that the "current" fiber pointer gets updated so we need a commit
17780 // to update this element.
17781 if (!updatePayload) {
17782 updatePayload = [];
17783 }
17784 } else {
17785 // For all other deleted properties we add it to the queue. We use
17786 // the whitelist in the commit phase instead.
17787 (updatePayload = updatePayload || []).push(propKey, null);
17788 }
17789 }
17790 for (propKey in nextProps) {
17791 var nextProp = nextProps[propKey];
17792 var lastProp = lastProps != null ? lastProps[propKey] : undefined;
17793 if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
17794 continue;
17795 }
17796 if (propKey === STYLE) {
17797 {
17798 if (nextProp) {
17799 // Freeze the next style object so that we can assume it won't be
17800 // mutated. We have already warned for this in the past.
17801 Object.freeze(nextProp);
17802 }
17803 }
17804 if (lastProp) {
17805 // Unset styles on `lastProp` but not on `nextProp`.
17806 for (styleName in lastProp) {
17807 if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
17808 if (!styleUpdates) {
17809 styleUpdates = {};
17810 }
17811 styleUpdates[styleName] = '';
17812 }
17813 }
17814 // Update styles that changed since `lastProp`.
17815 for (styleName in nextProp) {
17816 if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
17817 if (!styleUpdates) {
17818 styleUpdates = {};
17819 }
17820 styleUpdates[styleName] = nextProp[styleName];
17821 }
17822 }
17823 } else {
17824 // Relies on `updateStylesByID` not mutating `styleUpdates`.
17825 if (!styleUpdates) {
17826 if (!updatePayload) {
17827 updatePayload = [];
17828 }
17829 updatePayload.push(propKey, styleUpdates);
17830 }
17831 styleUpdates = nextProp;
17832 }
17833 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
17834 var nextHtml = nextProp ? nextProp[HTML] : undefined;
17835 var lastHtml = lastProp ? lastProp[HTML] : undefined;
17836 if (nextHtml != null) {
17837 if (lastHtml !== nextHtml) {
17838 (updatePayload = updatePayload || []).push(propKey, '' + nextHtml);
17839 }
17840 } else {
17841 // TODO: It might be too late to clear this if we have children
17842 // inserted already.
17843 }
17844 } else if (propKey === CHILDREN) {
17845 if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
17846 (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
17847 }
17848 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
17849 // Noop
17850 } else if (registrationNameModules.hasOwnProperty(propKey)) {
17851 if (nextProp != null) {
17852 // We eagerly listen to this even though we haven't committed yet.
17853 if (true && typeof nextProp !== 'function') {
17854 warnForInvalidEventListener(propKey, nextProp);
17855 }
17856 ensureListeningTo(rootContainerElement, propKey);
17857 }
17858 if (!updatePayload && lastProp !== nextProp) {
17859 // This is a special case. If any listener updates we need to ensure
17860 // that the "current" props pointer gets updated so we need a commit
17861 // to update this element.
17862 updatePayload = [];
17863 }
17864 } else {
17865 // For any other property we always add it to the queue and then we
17866 // filter it out using the whitelist during the commit.
17867 (updatePayload = updatePayload || []).push(propKey, nextProp);
17868 }
17869 }
17870 if (styleUpdates) {
17871 (updatePayload = updatePayload || []).push(STYLE, styleUpdates);
17872 }
17873 return updatePayload;
17874 }
17875
17876 // Apply the diff.
17877 function updateProperties$1(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
17878 // Update checked *before* name.
17879 // In the middle of an update, it is possible to have multiple checked.
17880 // When a checked radio tries to change name, browser makes another radio's checked false.
17881 if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) {
17882 updateChecked(domElement, nextRawProps);
17883 }
17884
17885 var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
17886 var isCustomComponentTag = isCustomComponent(tag, nextRawProps);
17887 // Apply the diff.
17888 updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag);
17889
17890 // TODO: Ensure that an update gets scheduled if any of the special props
17891 // changed.
17892 switch (tag) {
17893 case 'input':
17894 // Update the wrapper around inputs *after* updating props. This has to
17895 // happen after `updateDOMProperties`. Otherwise HTML5 input validations
17896 // raise warnings and prevent the new value from being assigned.
17897 updateWrapper(domElement, nextRawProps);
17898 break;
17899 case 'textarea':
17900 updateWrapper$1(domElement, nextRawProps);
17901 break;
17902 case 'select':
17903 // <select> value update needs to occur after <option> children
17904 // reconciliation
17905 postUpdateWrapper(domElement, nextRawProps);
17906 break;
17907 }
17908 }
17909
17910 function getPossibleStandardName(propName) {
17911 {
17912 var lowerCasedName = propName.toLowerCase();
17913 if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
17914 return null;
17915 }
17916 return possibleStandardNames[lowerCasedName] || null;
17917 }
17918 return null;
17919 }
17920
17921 function diffHydratedProperties$1(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
17922 var isCustomComponentTag = void 0;
17923 var extraAttributeNames = void 0;
17924
17925 {
17926 suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING$1] === true;
17927 isCustomComponentTag = isCustomComponent(tag, rawProps);
17928 validatePropertiesInDevelopment(tag, rawProps);
17929 if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
17930 warning(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerName$2() || 'A component');
17931 didWarnShadyDOM = true;
17932 }
17933 }
17934
17935 // TODO: Make sure that we check isMounted before firing any of these events.
17936 switch (tag) {
17937 case 'iframe':
17938 case 'object':
17939 trapBubbledEvent('topLoad', 'load', domElement);
17940 break;
17941 case 'video':
17942 case 'audio':
17943 // Create listener for each media event
17944 for (var event in mediaEventTypes) {
17945 if (mediaEventTypes.hasOwnProperty(event)) {
17946 trapBubbledEvent(event, mediaEventTypes[event], domElement);
17947 }
17948 }
17949 break;
17950 case 'source':
17951 trapBubbledEvent('topError', 'error', domElement);
17952 break;
17953 case 'img':
17954 case 'image':
17955 case 'link':
17956 trapBubbledEvent('topError', 'error', domElement);
17957 trapBubbledEvent('topLoad', 'load', domElement);
17958 break;
17959 case 'form':
17960 trapBubbledEvent('topReset', 'reset', domElement);
17961 trapBubbledEvent('topSubmit', 'submit', domElement);
17962 break;
17963 case 'details':
17964 trapBubbledEvent('topToggle', 'toggle', domElement);
17965 break;
17966 case 'input':
17967 initWrapperState(domElement, rawProps);
17968 trapBubbledEvent('topInvalid', 'invalid', domElement);
17969 // For controlled components we always need to ensure we're listening
17970 // to onChange. Even if there is no listener.
17971 ensureListeningTo(rootContainerElement, 'onChange');
17972 break;
17973 case 'option':
17974 validateProps(domElement, rawProps);
17975 break;
17976 case 'select':
17977 initWrapperState$1(domElement, rawProps);
17978 trapBubbledEvent('topInvalid', 'invalid', domElement);
17979 // For controlled components we always need to ensure we're listening
17980 // to onChange. Even if there is no listener.
17981 ensureListeningTo(rootContainerElement, 'onChange');
17982 break;
17983 case 'textarea':
17984 initWrapperState$2(domElement, rawProps);
17985 trapBubbledEvent('topInvalid', 'invalid', domElement);
17986 // For controlled components we always need to ensure we're listening
17987 // to onChange. Even if there is no listener.
17988 ensureListeningTo(rootContainerElement, 'onChange');
17989 break;
17990 }
17991
17992 assertValidProps(tag, rawProps, getStack);
17993
17994 {
17995 extraAttributeNames = new Set();
17996 var attributes = domElement.attributes;
17997 for (var i = 0; i < attributes.length; i++) {
17998 var name = attributes[i].name.toLowerCase();
17999 switch (name) {
18000 // Built-in SSR attribute is whitelisted
18001 case 'data-reactroot':
18002 break;
18003 // Controlled attributes are not validated
18004 // TODO: Only ignore them on controlled tags.
18005 case 'value':
18006 break;
18007 case 'checked':
18008 break;
18009 case 'selected':
18010 break;
18011 default:
18012 // Intentionally use the original name.
18013 // See discussion in https://github.com/facebook/react/pull/10676.
18014 extraAttributeNames.add(attributes[i].name);
18015 }
18016 }
18017 }
18018
18019 var updatePayload = null;
18020 for (var propKey in rawProps) {
18021 if (!rawProps.hasOwnProperty(propKey)) {
18022 continue;
18023 }
18024 var nextProp = rawProps[propKey];
18025 if (propKey === CHILDREN) {
18026 // For text content children we compare against textContent. This
18027 // might match additional HTML that is hidden when we read it using
18028 // textContent. E.g. "foo" will match "f<span>oo</span>" but that still
18029 // satisfies our requirement. Our requirement is not to produce perfect
18030 // HTML and attributes. Ideally we should preserve structure but it's
18031 // ok not to if the visible content is still enough to indicate what
18032 // even listeners these nodes might be wired up to.
18033 // TODO: Warn if there is more than a single textNode as a child.
18034 // TODO: Should we use domElement.firstChild.nodeValue to compare?
18035 if (typeof nextProp === 'string') {
18036 if (domElement.textContent !== nextProp) {
18037 if (true && !suppressHydrationWarning) {
18038 warnForTextDifference(domElement.textContent, nextProp);
18039 }
18040 updatePayload = [CHILDREN, nextProp];
18041 }
18042 } else if (typeof nextProp === 'number') {
18043 if (domElement.textContent !== '' + nextProp) {
18044 if (true && !suppressHydrationWarning) {
18045 warnForTextDifference(domElement.textContent, nextProp);
18046 }
18047 updatePayload = [CHILDREN, '' + nextProp];
18048 }
18049 }
18050 } else if (registrationNameModules.hasOwnProperty(propKey)) {
18051 if (nextProp != null) {
18052 if (true && typeof nextProp !== 'function') {
18053 warnForInvalidEventListener(propKey, nextProp);
18054 }
18055 ensureListeningTo(rootContainerElement, propKey);
18056 }
18057 } else if (true &&
18058 // Convince Flow we've calculated it (it's DEV-only in this method.)
18059 typeof isCustomComponentTag === 'boolean') {
18060 // Validate that the properties correspond to their expected values.
18061 var serverValue = void 0;
18062 var propertyInfo = getPropertyInfo(propKey);
18063 if (suppressHydrationWarning) {
18064 // Don't bother comparing. We're ignoring all these warnings.
18065 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1 ||
18066 // Controlled attributes are not validated
18067 // TODO: Only ignore them on controlled tags.
18068 propKey === 'value' || propKey === 'checked' || propKey === 'selected') {
18069 // Noop
18070 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
18071 var rawHtml = nextProp ? nextProp[HTML] || '' : '';
18072 var serverHTML = domElement.innerHTML;
18073 var expectedHTML = normalizeHTML(domElement, rawHtml);
18074 if (expectedHTML !== serverHTML) {
18075 warnForPropDifference(propKey, serverHTML, expectedHTML);
18076 }
18077 } else if (propKey === STYLE) {
18078 // $FlowFixMe - Should be inferred as not undefined.
18079 extraAttributeNames['delete'](propKey);
18080 var expectedStyle = createDangerousStringForStyles(nextProp);
18081 serverValue = domElement.getAttribute('style');
18082 if (expectedStyle !== serverValue) {
18083 warnForPropDifference(propKey, serverValue, expectedStyle);
18084 }
18085 } else if (isCustomComponentTag) {
18086 // $FlowFixMe - Should be inferred as not undefined.
18087 extraAttributeNames['delete'](propKey.toLowerCase());
18088 serverValue = getValueForAttribute(domElement, propKey, nextProp);
18089
18090 if (nextProp !== serverValue) {
18091 warnForPropDifference(propKey, serverValue, nextProp);
18092 }
18093 } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
18094 var isMismatchDueToBadCasing = false;
18095 if (propertyInfo !== null) {
18096 // $FlowFixMe - Should be inferred as not undefined.
18097 extraAttributeNames['delete'](propertyInfo.attributeName);
18098 serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
18099 } else {
18100 var ownNamespace = parentNamespace;
18101 if (ownNamespace === HTML_NAMESPACE) {
18102 ownNamespace = getIntrinsicNamespace(tag);
18103 }
18104 if (ownNamespace === HTML_NAMESPACE) {
18105 // $FlowFixMe - Should be inferred as not undefined.
18106 extraAttributeNames['delete'](propKey.toLowerCase());
18107 } else {
18108 var standardName = getPossibleStandardName(propKey);
18109 if (standardName !== null && standardName !== propKey) {
18110 // If an SVG prop is supplied with bad casing, it will
18111 // be successfully parsed from HTML, but will produce a mismatch
18112 // (and would be incorrectly rendered on the client).
18113 // However, we already warn about bad casing elsewhere.
18114 // So we'll skip the misleading extra mismatch warning in this case.
18115 isMismatchDueToBadCasing = true;
18116 // $FlowFixMe - Should be inferred as not undefined.
18117 extraAttributeNames['delete'](standardName);
18118 }
18119 // $FlowFixMe - Should be inferred as not undefined.
18120 extraAttributeNames['delete'](propKey);
18121 }
18122 serverValue = getValueForAttribute(domElement, propKey, nextProp);
18123 }
18124
18125 if (nextProp !== serverValue && !isMismatchDueToBadCasing) {
18126 warnForPropDifference(propKey, serverValue, nextProp);
18127 }
18128 }
18129 }
18130 }
18131
18132 {
18133 // $FlowFixMe - Should be inferred as not undefined.
18134 if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
18135 // $FlowFixMe - Should be inferred as not undefined.
18136 warnForExtraAttributes(extraAttributeNames);
18137 }
18138 }
18139
18140 switch (tag) {
18141 case 'input':
18142 // TODO: Make sure we check if this is still unmounted or do any clean
18143 // up necessary since we never stop tracking anymore.
18144 track(domElement);
18145 postMountWrapper(domElement, rawProps);
18146 break;
18147 case 'textarea':
18148 // TODO: Make sure we check if this is still unmounted or do any clean
18149 // up necessary since we never stop tracking anymore.
18150 track(domElement);
18151 postMountWrapper$3(domElement, rawProps);
18152 break;
18153 case 'select':
18154 case 'option':
18155 // For input and textarea we current always set the value property at
18156 // post mount to force it to diverge from attributes. However, for
18157 // option and select we don't quite do the same thing and select
18158 // is not resilient to the DOM state changing so we don't do that here.
18159 // TODO: Consider not doing this for input and textarea.
18160 break;
18161 default:
18162 if (typeof rawProps.onClick === 'function') {
18163 // TODO: This cast may not be sound for SVG, MathML or custom elements.
18164 trapClickOnNonInteractiveElement(domElement);
18165 }
18166 break;
18167 }
18168
18169 return updatePayload;
18170 }
18171
18172 function diffHydratedText$1(textNode, text) {
18173 var isDifferent = textNode.nodeValue !== text;
18174 return isDifferent;
18175 }
18176
18177 function warnForUnmatchedText$1(textNode, text) {
18178 {
18179 warnForTextDifference(textNode.nodeValue, text);
18180 }
18181 }
18182
18183 function warnForDeletedHydratableElement$1(parentNode, child) {
18184 {
18185 if (didWarnInvalidHydration) {
18186 return;
18187 }
18188 didWarnInvalidHydration = true;
18189 warning(false, 'Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
18190 }
18191 }
18192
18193 function warnForDeletedHydratableText$1(parentNode, child) {
18194 {
18195 if (didWarnInvalidHydration) {
18196 return;
18197 }
18198 didWarnInvalidHydration = true;
18199 warning(false, 'Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
18200 }
18201 }
18202
18203 function warnForInsertedHydratedElement$1(parentNode, tag, props) {
18204 {
18205 if (didWarnInvalidHydration) {
18206 return;
18207 }
18208 didWarnInvalidHydration = true;
18209 warning(false, 'Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase());
18210 }
18211 }
18212
18213 function warnForInsertedHydratedText$1(parentNode, text) {
18214 {
18215 if (text === '') {
18216 // We expect to insert empty text nodes since they're not represented in
18217 // the HTML.
18218 // TODO: Remove this special case if we can just avoid inserting empty
18219 // text nodes.
18220 return;
18221 }
18222 if (didWarnInvalidHydration) {
18223 return;
18224 }
18225 didWarnInvalidHydration = true;
18226 warning(false, 'Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
18227 }
18228 }
18229
18230 function restoreControlledState$1(domElement, tag, props) {
18231 switch (tag) {
18232 case 'input':
18233 restoreControlledState(domElement, props);
18234 return;
18235 case 'textarea':
18236 restoreControlledState$3(domElement, props);
18237 return;
18238 case 'select':
18239 restoreControlledState$2(domElement, props);
18240 return;
18241 }
18242 }
18243
18244 var ReactDOMFiberComponent = Object.freeze({
18245 createElement: createElement$1,
18246 createTextNode: createTextNode$1,
18247 setInitialProperties: setInitialProperties$1,
18248 diffProperties: diffProperties$1,
18249 updateProperties: updateProperties$1,
18250 diffHydratedProperties: diffHydratedProperties$1,
18251 diffHydratedText: diffHydratedText$1,
18252 warnForUnmatchedText: warnForUnmatchedText$1,
18253 warnForDeletedHydratableElement: warnForDeletedHydratableElement$1,
18254 warnForDeletedHydratableText: warnForDeletedHydratableText$1,
18255 warnForInsertedHydratedElement: warnForInsertedHydratedElement$1,
18256 warnForInsertedHydratedText: warnForInsertedHydratedText$1,
18257 restoreControlledState: restoreControlledState$1
18258 });
18259
18260 // TODO: direct imports like some-package/src/* are bad. Fix me.
18261 var getCurrentFiberStackAddendum$6 = ReactDebugCurrentFiber.getCurrentFiberStackAddendum;
18262
18263 var validateDOMNesting = emptyFunction;
18264
18265 {
18266 // This validation code was written based on the HTML5 parsing spec:
18267 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
18268 //
18269 // Note: this does not catch all invalid nesting, nor does it try to (as it's
18270 // not clear what practical benefit doing so provides); instead, we warn only
18271 // for cases where the parser will give a parse tree differing from what React
18272 // intended. For example, <b><div></div></b> is invalid but we don't warn
18273 // because it still parses correctly; we do warn for other cases like nested
18274 // <p> tags where the beginning of the second element implicitly closes the
18275 // first, causing a confusing mess.
18276
18277 // https://html.spec.whatwg.org/multipage/syntax.html#special
18278 var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
18279
18280 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
18281 var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
18282
18283 // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
18284 // TODO: Distinguish by namespace here -- for <title>, including it here
18285 // errs on the side of fewer warnings
18286 'foreignObject', 'desc', 'title'];
18287
18288 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
18289 var buttonScopeTags = inScopeTags.concat(['button']);
18290
18291 // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
18292 var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
18293
18294 var emptyAncestorInfo = {
18295 current: null,
18296
18297 formTag: null,
18298 aTagInScope: null,
18299 buttonTagInScope: null,
18300 nobrTagInScope: null,
18301 pTagInButtonScope: null,
18302
18303 listItemTagAutoclosing: null,
18304 dlItemTagAutoclosing: null
18305 };
18306
18307 var updatedAncestorInfo$1 = function (oldInfo, tag, instance) {
18308 var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
18309 var info = { tag: tag, instance: instance };
18310
18311 if (inScopeTags.indexOf(tag) !== -1) {
18312 ancestorInfo.aTagInScope = null;
18313 ancestorInfo.buttonTagInScope = null;
18314 ancestorInfo.nobrTagInScope = null;
18315 }
18316 if (buttonScopeTags.indexOf(tag) !== -1) {
18317 ancestorInfo.pTagInButtonScope = null;
18318 }
18319
18320 // See rules for 'li', 'dd', 'dt' start tags in
18321 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
18322 if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
18323 ancestorInfo.listItemTagAutoclosing = null;
18324 ancestorInfo.dlItemTagAutoclosing = null;
18325 }
18326
18327 ancestorInfo.current = info;
18328
18329 if (tag === 'form') {
18330 ancestorInfo.formTag = info;
18331 }
18332 if (tag === 'a') {
18333 ancestorInfo.aTagInScope = info;
18334 }
18335 if (tag === 'button') {
18336 ancestorInfo.buttonTagInScope = info;
18337 }
18338 if (tag === 'nobr') {
18339 ancestorInfo.nobrTagInScope = info;
18340 }
18341 if (tag === 'p') {
18342 ancestorInfo.pTagInButtonScope = info;
18343 }
18344 if (tag === 'li') {
18345 ancestorInfo.listItemTagAutoclosing = info;
18346 }
18347 if (tag === 'dd' || tag === 'dt') {
18348 ancestorInfo.dlItemTagAutoclosing = info;
18349 }
18350
18351 return ancestorInfo;
18352 };
18353
18354 /**
18355 * Returns whether
18356 */
18357 var isTagValidWithParent = function (tag, parentTag) {
18358 // First, let's check if we're in an unusual parsing mode...
18359 switch (parentTag) {
18360 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
18361 case 'select':
18362 return tag === 'option' || tag === 'optgroup' || tag === '#text';
18363 case 'optgroup':
18364 return tag === 'option' || tag === '#text';
18365 // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
18366 // but
18367 case 'option':
18368 return tag === '#text';
18369 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
18370 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
18371 // No special behavior since these rules fall back to "in body" mode for
18372 // all except special table nodes which cause bad parsing behavior anyway.
18373
18374 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
18375 case 'tr':
18376 return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
18377 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
18378 case 'tbody':
18379 case 'thead':
18380 case 'tfoot':
18381 return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
18382 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
18383 case 'colgroup':
18384 return tag === 'col' || tag === 'template';
18385 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
18386 case 'table':
18387 return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
18388 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
18389 case 'head':
18390 return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
18391 // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
18392 case 'html':
18393 return tag === 'head' || tag === 'body';
18394 case '#document':
18395 return tag === 'html';
18396 }
18397
18398 // Probably in the "in body" parsing mode, so we outlaw only tag combos
18399 // where the parsing rules cause implicit opens or closes to be added.
18400 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
18401 switch (tag) {
18402 case 'h1':
18403 case 'h2':
18404 case 'h3':
18405 case 'h4':
18406 case 'h5':
18407 case 'h6':
18408 return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
18409
18410 case 'rp':
18411 case 'rt':
18412 return impliedEndTags.indexOf(parentTag) === -1;
18413
18414 case 'body':
18415 case 'caption':
18416 case 'col':
18417 case 'colgroup':
18418 case 'frame':
18419 case 'head':
18420 case 'html':
18421 case 'tbody':
18422 case 'td':
18423 case 'tfoot':
18424 case 'th':
18425 case 'thead':
18426 case 'tr':
18427 // These tags are only valid with a few parents that have special child
18428 // parsing rules -- if we're down here, then none of those matched and
18429 // so we allow it only if we don't know what the parent is, as all other
18430 // cases are invalid.
18431 return parentTag == null;
18432 }
18433
18434 return true;
18435 };
18436
18437 /**
18438 * Returns whether
18439 */
18440 var findInvalidAncestorForTag = function (tag, ancestorInfo) {
18441 switch (tag) {
18442 case 'address':
18443 case 'article':
18444 case 'aside':
18445 case 'blockquote':
18446 case 'center':
18447 case 'details':
18448 case 'dialog':
18449 case 'dir':
18450 case 'div':
18451 case 'dl':
18452 case 'fieldset':
18453 case 'figcaption':
18454 case 'figure':
18455 case 'footer':
18456 case 'header':
18457 case 'hgroup':
18458 case 'main':
18459 case 'menu':
18460 case 'nav':
18461 case 'ol':
18462 case 'p':
18463 case 'section':
18464 case 'summary':
18465 case 'ul':
18466 case 'pre':
18467 case 'listing':
18468 case 'table':
18469 case 'hr':
18470 case 'xmp':
18471 case 'h1':
18472 case 'h2':
18473 case 'h3':
18474 case 'h4':
18475 case 'h5':
18476 case 'h6':
18477 return ancestorInfo.pTagInButtonScope;
18478
18479 case 'form':
18480 return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
18481
18482 case 'li':
18483 return ancestorInfo.listItemTagAutoclosing;
18484
18485 case 'dd':
18486 case 'dt':
18487 return ancestorInfo.dlItemTagAutoclosing;
18488
18489 case 'button':
18490 return ancestorInfo.buttonTagInScope;
18491
18492 case 'a':
18493 // Spec says something about storing a list of markers, but it sounds
18494 // equivalent to this check.
18495 return ancestorInfo.aTagInScope;
18496
18497 case 'nobr':
18498 return ancestorInfo.nobrTagInScope;
18499 }
18500
18501 return null;
18502 };
18503
18504 var didWarn = {};
18505
18506 validateDOMNesting = function (childTag, childText, ancestorInfo) {
18507 ancestorInfo = ancestorInfo || emptyAncestorInfo;
18508 var parentInfo = ancestorInfo.current;
18509 var parentTag = parentInfo && parentInfo.tag;
18510
18511 if (childText != null) {
18512 !(childTag == null) ? warning(false, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
18513 childTag = '#text';
18514 }
18515
18516 var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
18517 var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
18518 var invalidParentOrAncestor = invalidParent || invalidAncestor;
18519 if (!invalidParentOrAncestor) {
18520 return;
18521 }
18522
18523 var ancestorTag = invalidParentOrAncestor.tag;
18524 var addendum = getCurrentFiberStackAddendum$6();
18525
18526 var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
18527 if (didWarn[warnKey]) {
18528 return;
18529 }
18530 didWarn[warnKey] = true;
18531
18532 var tagDisplayName = childTag;
18533 var whitespaceInfo = '';
18534 if (childTag === '#text') {
18535 if (/\S/.test(childText)) {
18536 tagDisplayName = 'Text nodes';
18537 } else {
18538 tagDisplayName = 'Whitespace text nodes';
18539 whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
18540 }
18541 } else {
18542 tagDisplayName = '<' + childTag + '>';
18543 }
18544
18545 if (invalidParent) {
18546 var info = '';
18547 if (ancestorTag === 'table' && childTag === 'tr') {
18548 info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
18549 }
18550 warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info, addendum);
18551 } else {
18552 warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.%s', tagDisplayName, ancestorTag, addendum);
18553 }
18554 };
18555
18556 // TODO: turn this into a named export
18557 validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo$1;
18558 }
18559
18560 var validateDOMNesting$1 = validateDOMNesting;
18561
18562 // TODO: This type is shared between the reconciler and ReactDOM, but will
18563 // eventually be lifted out to the renderer.
18564
18565 // TODO: direct imports like some-package/src/* are bad. Fix me.
18566 var createElement = createElement$1;
18567 var createTextNode = createTextNode$1;
18568 var setInitialProperties = setInitialProperties$1;
18569 var diffProperties = diffProperties$1;
18570 var updateProperties = updateProperties$1;
18571 var diffHydratedProperties = diffHydratedProperties$1;
18572 var diffHydratedText = diffHydratedText$1;
18573 var warnForUnmatchedText = warnForUnmatchedText$1;
18574 var warnForDeletedHydratableElement = warnForDeletedHydratableElement$1;
18575 var warnForDeletedHydratableText = warnForDeletedHydratableText$1;
18576 var warnForInsertedHydratedElement = warnForInsertedHydratedElement$1;
18577 var warnForInsertedHydratedText = warnForInsertedHydratedText$1;
18578 var updatedAncestorInfo = validateDOMNesting$1.updatedAncestorInfo;
18579 var precacheFiberNode = precacheFiberNode$1;
18580 var updateFiberProps = updateFiberProps$1;
18581
18582
18583 var SUPPRESS_HYDRATION_WARNING = void 0;
18584 var topLevelUpdateWarnings = void 0;
18585 var warnOnInvalidCallback = void 0;
18586 var didWarnAboutUnstableCreatePortal = false;
18587
18588 {
18589 SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
18590 if (typeof Map !== 'function' || Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
18591 warning(false, 'React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
18592 }
18593
18594 topLevelUpdateWarnings = function (container) {
18595 if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
18596 var hostInstance = DOMRenderer.findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
18597 if (hostInstance) {
18598 !(hostInstance.parentNode === container) ? warning(false, 'render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.') : void 0;
18599 }
18600 }
18601
18602 var isRootRenderedBySomeReact = !!container._reactRootContainer;
18603 var rootEl = getReactRootElementInContainer(container);
18604 var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
18605
18606 !(!hasNonRootReactChild || isRootRenderedBySomeReact) ? warning(false, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
18607
18608 !(container.nodeType !== ELEMENT_NODE || !container.tagName || container.tagName.toUpperCase() !== 'BODY') ? warning(false, 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
18609 };
18610
18611 warnOnInvalidCallback = function (callback, callerName) {
18612 !(callback === null || typeof callback === 'function') ? warning(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback) : void 0;
18613 };
18614 }
18615
18616 injection$2.injectFiberControlledHostComponent(ReactDOMFiberComponent);
18617
18618 var eventsEnabled = null;
18619 var selectionInformation = null;
18620
18621 function ReactBatch(root) {
18622 var expirationTime = DOMRenderer.computeUniqueAsyncExpiration();
18623 this._expirationTime = expirationTime;
18624 this._root = root;
18625 this._next = null;
18626 this._callbacks = null;
18627 this._didComplete = false;
18628 this._hasChildren = false;
18629 this._children = null;
18630 this._defer = true;
18631 }
18632 ReactBatch.prototype.render = function (children) {
18633 !this._defer ? invariant(false, 'batch.render: Cannot render a batch that already committed.') : void 0;
18634 this._hasChildren = true;
18635 this._children = children;
18636 var internalRoot = this._root._internalRoot;
18637 var expirationTime = this._expirationTime;
18638 var work = new ReactWork();
18639 DOMRenderer.updateContainerAtExpirationTime(children, internalRoot, null, expirationTime, work._onCommit);
18640 return work;
18641 };
18642 ReactBatch.prototype.then = function (onComplete) {
18643 if (this._didComplete) {
18644 onComplete();
18645 return;
18646 }
18647 var callbacks = this._callbacks;
18648 if (callbacks === null) {
18649 callbacks = this._callbacks = [];
18650 }
18651 callbacks.push(onComplete);
18652 };
18653 ReactBatch.prototype.commit = function () {
18654 var internalRoot = this._root._internalRoot;
18655 var firstBatch = internalRoot.firstBatch;
18656 !(this._defer && firstBatch !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
18657
18658 if (!this._hasChildren) {
18659 // This batch is empty. Return.
18660 this._next = null;
18661 this._defer = false;
18662 return;
18663 }
18664
18665 var expirationTime = this._expirationTime;
18666
18667 // Ensure this is the first batch in the list.
18668 if (firstBatch !== this) {
18669 // This batch is not the earliest batch. We need to move it to the front.
18670 // Update its expiration time to be the expiration time of the earliest
18671 // batch, so that we can flush it without flushing the other batches.
18672 if (this._hasChildren) {
18673 expirationTime = this._expirationTime = firstBatch._expirationTime;
18674 // Rendering this batch again ensures its children will be the final state
18675 // when we flush (updates are processed in insertion order: last
18676 // update wins).
18677 // TODO: This forces a restart. Should we print a warning?
18678 this.render(this._children);
18679 }
18680
18681 // Remove the batch from the list.
18682 var previous = null;
18683 var batch = firstBatch;
18684 while (batch !== this) {
18685 previous = batch;
18686 batch = batch._next;
18687 }
18688 !(previous !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
18689 previous._next = batch._next;
18690
18691 // Add it to the front.
18692 this._next = firstBatch;
18693 firstBatch = internalRoot.firstBatch = this;
18694 }
18695
18696 // Synchronously flush all the work up to this batch's expiration time.
18697 this._defer = false;
18698 DOMRenderer.flushRoot(internalRoot, expirationTime);
18699
18700 // Pop the batch from the list.
18701 var next = this._next;
18702 this._next = null;
18703 firstBatch = internalRoot.firstBatch = next;
18704
18705 // Append the next earliest batch's children to the update queue.
18706 if (firstBatch !== null && firstBatch._hasChildren) {
18707 firstBatch.render(firstBatch._children);
18708 }
18709 };
18710 ReactBatch.prototype._onComplete = function () {
18711 if (this._didComplete) {
18712 return;
18713 }
18714 this._didComplete = true;
18715 var callbacks = this._callbacks;
18716 if (callbacks === null) {
18717 return;
18718 }
18719 // TODO: Error handling.
18720 for (var i = 0; i < callbacks.length; i++) {
18721 var _callback = callbacks[i];
18722 _callback();
18723 }
18724 };
18725
18726 function ReactWork() {
18727 this._callbacks = null;
18728 this._didCommit = false;
18729 // TODO: Avoid need to bind by replacing callbacks in the update queue with
18730 // list of Work objects.
18731 this._onCommit = this._onCommit.bind(this);
18732 }
18733 ReactWork.prototype.then = function (onCommit) {
18734 if (this._didCommit) {
18735 onCommit();
18736 return;
18737 }
18738 var callbacks = this._callbacks;
18739 if (callbacks === null) {
18740 callbacks = this._callbacks = [];
18741 }
18742 callbacks.push(onCommit);
18743 };
18744 ReactWork.prototype._onCommit = function () {
18745 if (this._didCommit) {
18746 return;
18747 }
18748 this._didCommit = true;
18749 var callbacks = this._callbacks;
18750 if (callbacks === null) {
18751 return;
18752 }
18753 // TODO: Error handling.
18754 for (var i = 0; i < callbacks.length; i++) {
18755 var _callback2 = callbacks[i];
18756 !(typeof _callback2 === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', _callback2) : void 0;
18757 _callback2();
18758 }
18759 };
18760
18761 function ReactRoot(container, isAsync, hydrate) {
18762 var root = DOMRenderer.createContainer(container, isAsync, hydrate);
18763 this._internalRoot = root;
18764 }
18765 ReactRoot.prototype.render = function (children, callback) {
18766 var root = this._internalRoot;
18767 var work = new ReactWork();
18768 callback = callback === undefined ? null : callback;
18769 {
18770 warnOnInvalidCallback(callback, 'render');
18771 }
18772 if (callback !== null) {
18773 work.then(callback);
18774 }
18775 DOMRenderer.updateContainer(children, root, null, work._onCommit);
18776 return work;
18777 };
18778 ReactRoot.prototype.unmount = function (callback) {
18779 var root = this._internalRoot;
18780 var work = new ReactWork();
18781 callback = callback === undefined ? null : callback;
18782 {
18783 warnOnInvalidCallback(callback, 'render');
18784 }
18785 if (callback !== null) {
18786 work.then(callback);
18787 }
18788 DOMRenderer.updateContainer(null, root, null, work._onCommit);
18789 return work;
18790 };
18791 ReactRoot.prototype.legacy_renderSubtreeIntoContainer = function (parentComponent, children, callback) {
18792 var root = this._internalRoot;
18793 var work = new ReactWork();
18794 callback = callback === undefined ? null : callback;
18795 {
18796 warnOnInvalidCallback(callback, 'render');
18797 }
18798 if (callback !== null) {
18799 work.then(callback);
18800 }
18801 DOMRenderer.updateContainer(children, root, parentComponent, work._onCommit);
18802 return work;
18803 };
18804 ReactRoot.prototype.createBatch = function () {
18805 var batch = new ReactBatch(this);
18806 var expirationTime = batch._expirationTime;
18807
18808 var internalRoot = this._internalRoot;
18809 var firstBatch = internalRoot.firstBatch;
18810 if (firstBatch === null) {
18811 internalRoot.firstBatch = batch;
18812 batch._next = null;
18813 } else {
18814 // Insert sorted by expiration time then insertion order
18815 var insertAfter = null;
18816 var insertBefore = firstBatch;
18817 while (insertBefore !== null && insertBefore._expirationTime <= expirationTime) {
18818 insertAfter = insertBefore;
18819 insertBefore = insertBefore._next;
18820 }
18821 batch._next = insertBefore;
18822 if (insertAfter !== null) {
18823 insertAfter._next = batch;
18824 }
18825 }
18826
18827 return batch;
18828 };
18829
18830 /**
18831 * True if the supplied DOM node is a valid node element.
18832 *
18833 * @param {?DOMElement} node The candidate DOM node.
18834 * @return {boolean} True if the DOM is a valid DOM node.
18835 * @internal
18836 */
18837 function isValidContainer(node) {
18838 return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));
18839 }
18840
18841 function getReactRootElementInContainer(container) {
18842 if (!container) {
18843 return null;
18844 }
18845
18846 if (container.nodeType === DOCUMENT_NODE) {
18847 return container.documentElement;
18848 } else {
18849 return container.firstChild;
18850 }
18851 }
18852
18853 function shouldHydrateDueToLegacyHeuristic(container) {
18854 var rootElement = getReactRootElementInContainer(container);
18855 return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
18856 }
18857
18858 function shouldAutoFocusHostComponent(type, props) {
18859 switch (type) {
18860 case 'button':
18861 case 'input':
18862 case 'select':
18863 case 'textarea':
18864 return !!props.autoFocus;
18865 }
18866 return false;
18867 }
18868
18869 var DOMRenderer = reactReconciler({
18870 getRootHostContext: function (rootContainerInstance) {
18871 var type = void 0;
18872 var namespace = void 0;
18873 var nodeType = rootContainerInstance.nodeType;
18874 switch (nodeType) {
18875 case DOCUMENT_NODE:
18876 case DOCUMENT_FRAGMENT_NODE:
18877 {
18878 type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment';
18879 var root = rootContainerInstance.documentElement;
18880 namespace = root ? root.namespaceURI : getChildNamespace(null, '');
18881 break;
18882 }
18883 default:
18884 {
18885 var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
18886 var ownNamespace = container.namespaceURI || null;
18887 type = container.tagName;
18888 namespace = getChildNamespace(ownNamespace, type);
18889 break;
18890 }
18891 }
18892 {
18893 var validatedTag = type.toLowerCase();
18894 var _ancestorInfo = updatedAncestorInfo(null, validatedTag, null);
18895 return { namespace: namespace, ancestorInfo: _ancestorInfo };
18896 }
18897 return namespace;
18898 },
18899 getChildHostContext: function (parentHostContext, type) {
18900 {
18901 var parentHostContextDev = parentHostContext;
18902 var _namespace = getChildNamespace(parentHostContextDev.namespace, type);
18903 var _ancestorInfo2 = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type, null);
18904 return { namespace: _namespace, ancestorInfo: _ancestorInfo2 };
18905 }
18906 var parentNamespace = parentHostContext;
18907 return getChildNamespace(parentNamespace, type);
18908 },
18909 getPublicInstance: function (instance) {
18910 return instance;
18911 },
18912 prepareForCommit: function () {
18913 eventsEnabled = isEnabled();
18914 selectionInformation = getSelectionInformation();
18915 setEnabled(false);
18916 },
18917 resetAfterCommit: function () {
18918 restoreSelection(selectionInformation);
18919 selectionInformation = null;
18920 setEnabled(eventsEnabled);
18921 eventsEnabled = null;
18922 },
18923 createInstance: function (type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
18924 var parentNamespace = void 0;
18925 {
18926 // TODO: take namespace into account when validating.
18927 var hostContextDev = hostContext;
18928 validateDOMNesting$1(type, null, hostContextDev.ancestorInfo);
18929 if (typeof props.children === 'string' || typeof props.children === 'number') {
18930 var string = '' + props.children;
18931 var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type, null);
18932 validateDOMNesting$1(null, string, ownAncestorInfo);
18933 }
18934 parentNamespace = hostContextDev.namespace;
18935 }
18936 var domElement = createElement(type, props, rootContainerInstance, parentNamespace);
18937 precacheFiberNode(internalInstanceHandle, domElement);
18938 updateFiberProps(domElement, props);
18939 return domElement;
18940 },
18941 appendInitialChild: function (parentInstance, child) {
18942 parentInstance.appendChild(child);
18943 },
18944 finalizeInitialChildren: function (domElement, type, props, rootContainerInstance) {
18945 setInitialProperties(domElement, type, props, rootContainerInstance);
18946 return shouldAutoFocusHostComponent(type, props);
18947 },
18948 prepareUpdate: function (domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
18949 {
18950 var hostContextDev = hostContext;
18951 if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) {
18952 var string = '' + newProps.children;
18953 var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type, null);
18954 validateDOMNesting$1(null, string, ownAncestorInfo);
18955 }
18956 }
18957 return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance);
18958 },
18959 shouldSetTextContent: function (type, props) {
18960 return type === 'textarea' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && typeof props.dangerouslySetInnerHTML.__html === 'string';
18961 },
18962 shouldDeprioritizeSubtree: function (type, props) {
18963 return !!props.hidden;
18964 },
18965 createTextInstance: function (text, rootContainerInstance, hostContext, internalInstanceHandle) {
18966 {
18967 var hostContextDev = hostContext;
18968 validateDOMNesting$1(null, text, hostContextDev.ancestorInfo);
18969 }
18970 var textNode = createTextNode(text, rootContainerInstance);
18971 precacheFiberNode(internalInstanceHandle, textNode);
18972 return textNode;
18973 },
18974
18975
18976 now: now,
18977
18978 mutation: {
18979 commitMount: function (domElement, type, newProps, internalInstanceHandle) {
18980 // Despite the naming that might imply otherwise, this method only
18981 // fires if there is an `Update` effect scheduled during mounting.
18982 // This happens if `finalizeInitialChildren` returns `true` (which it
18983 // does to implement the `autoFocus` attribute on the client). But
18984 // there are also other cases when this might happen (such as patching
18985 // up text content during hydration mismatch). So we'll check this again.
18986 if (shouldAutoFocusHostComponent(type, newProps)) {
18987 domElement.focus();
18988 }
18989 },
18990 commitUpdate: function (domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
18991 // Update the props handle so that we know which props are the ones with
18992 // with current event handlers.
18993 updateFiberProps(domElement, newProps);
18994 // Apply the diff to the DOM node.
18995 updateProperties(domElement, updatePayload, type, oldProps, newProps);
18996 },
18997 resetTextContent: function (domElement) {
18998 setTextContent(domElement, '');
18999 },
19000 commitTextUpdate: function (textInstance, oldText, newText) {
19001 textInstance.nodeValue = newText;
19002 },
19003 appendChild: function (parentInstance, child) {
19004 parentInstance.appendChild(child);
19005 },
19006 appendChildToContainer: function (container, child) {
19007 if (container.nodeType === COMMENT_NODE) {
19008 container.parentNode.insertBefore(child, container);
19009 } else {
19010 container.appendChild(child);
19011 }
19012 },
19013 insertBefore: function (parentInstance, child, beforeChild) {
19014 parentInstance.insertBefore(child, beforeChild);
19015 },
19016 insertInContainerBefore: function (container, child, beforeChild) {
19017 if (container.nodeType === COMMENT_NODE) {
19018 container.parentNode.insertBefore(child, beforeChild);
19019 } else {
19020 container.insertBefore(child, beforeChild);
19021 }
19022 },
19023 removeChild: function (parentInstance, child) {
19024 parentInstance.removeChild(child);
19025 },
19026 removeChildFromContainer: function (container, child) {
19027 if (container.nodeType === COMMENT_NODE) {
19028 container.parentNode.removeChild(child);
19029 } else {
19030 container.removeChild(child);
19031 }
19032 }
19033 },
19034
19035 hydration: {
19036 canHydrateInstance: function (instance, type, props) {
19037 if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
19038 return null;
19039 }
19040 // This has now been refined to an element node.
19041 return instance;
19042 },
19043 canHydrateTextInstance: function (instance, text) {
19044 if (text === '' || instance.nodeType !== TEXT_NODE) {
19045 // Empty strings are not parsed by HTML so there won't be a correct match here.
19046 return null;
19047 }
19048 // This has now been refined to a text node.
19049 return instance;
19050 },
19051 getNextHydratableSibling: function (instance) {
19052 var node = instance.nextSibling;
19053 // Skip non-hydratable nodes.
19054 while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE) {
19055 node = node.nextSibling;
19056 }
19057 return node;
19058 },
19059 getFirstHydratableChild: function (parentInstance) {
19060 var next = parentInstance.firstChild;
19061 // Skip non-hydratable nodes.
19062 while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE) {
19063 next = next.nextSibling;
19064 }
19065 return next;
19066 },
19067 hydrateInstance: function (instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
19068 precacheFiberNode(internalInstanceHandle, instance);
19069 // TODO: Possibly defer this until the commit phase where all the events
19070 // get attached.
19071 updateFiberProps(instance, props);
19072 var parentNamespace = void 0;
19073 {
19074 var hostContextDev = hostContext;
19075 parentNamespace = hostContextDev.namespace;
19076 }
19077 return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance);
19078 },
19079 hydrateTextInstance: function (textInstance, text, internalInstanceHandle) {
19080 precacheFiberNode(internalInstanceHandle, textInstance);
19081 return diffHydratedText(textInstance, text);
19082 },
19083 didNotMatchHydratedContainerTextInstance: function (parentContainer, textInstance, text) {
19084 {
19085 warnForUnmatchedText(textInstance, text);
19086 }
19087 },
19088 didNotMatchHydratedTextInstance: function (parentType, parentProps, parentInstance, textInstance, text) {
19089 if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
19090 warnForUnmatchedText(textInstance, text);
19091 }
19092 },
19093 didNotHydrateContainerInstance: function (parentContainer, instance) {
19094 {
19095 if (instance.nodeType === 1) {
19096 warnForDeletedHydratableElement(parentContainer, instance);
19097 } else {
19098 warnForDeletedHydratableText(parentContainer, instance);
19099 }
19100 }
19101 },
19102 didNotHydrateInstance: function (parentType, parentProps, parentInstance, instance) {
19103 if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
19104 if (instance.nodeType === 1) {
19105 warnForDeletedHydratableElement(parentInstance, instance);
19106 } else {
19107 warnForDeletedHydratableText(parentInstance, instance);
19108 }
19109 }
19110 },
19111 didNotFindHydratableContainerInstance: function (parentContainer, type, props) {
19112 {
19113 warnForInsertedHydratedElement(parentContainer, type, props);
19114 }
19115 },
19116 didNotFindHydratableContainerTextInstance: function (parentContainer, text) {
19117 {
19118 warnForInsertedHydratedText(parentContainer, text);
19119 }
19120 },
19121 didNotFindHydratableInstance: function (parentType, parentProps, parentInstance, type, props) {
19122 if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
19123 warnForInsertedHydratedElement(parentInstance, type, props);
19124 }
19125 },
19126 didNotFindHydratableTextInstance: function (parentType, parentProps, parentInstance, text) {
19127 if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
19128 warnForInsertedHydratedText(parentInstance, text);
19129 }
19130 }
19131 },
19132
19133 scheduleDeferredCallback: rIC,
19134 cancelDeferredCallback: cIC
19135 });
19136
19137 injection$3.injectRenderer(DOMRenderer);
19138
19139 var warnedAboutHydrateAPI = false;
19140
19141 function legacyCreateRootFromDOMContainer(container, forceHydrate) {
19142 var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
19143 // First clear any existing content.
19144 if (!shouldHydrate) {
19145 var warned = false;
19146 var rootSibling = void 0;
19147 while (rootSibling = container.lastChild) {
19148 {
19149 if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
19150 warned = true;
19151 warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.');
19152 }
19153 }
19154 container.removeChild(rootSibling);
19155 }
19156 }
19157 {
19158 if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
19159 warnedAboutHydrateAPI = true;
19160 lowPriorityWarning$1(false, 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
19161 }
19162 }
19163 // Legacy roots are not async by default.
19164 var isAsync = false;
19165 return new ReactRoot(container, isAsync, shouldHydrate);
19166 }
19167
19168 function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
19169 // TODO: Ensure all entry points contain this check
19170 !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
19171
19172 {
19173 topLevelUpdateWarnings(container);
19174 }
19175
19176 // TODO: Without `any` type, Flow says "Property cannot be accessed on any
19177 // member of intersection type." Whyyyyyy.
19178 var root = container._reactRootContainer;
19179 if (!root) {
19180 // Initial mount
19181 root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
19182 if (typeof callback === 'function') {
19183 var originalCallback = callback;
19184 callback = function () {
19185 var instance = DOMRenderer.getPublicRootInstance(root._internalRoot);
19186 originalCallback.call(instance);
19187 };
19188 }
19189 // Initial mount should not be batched.
19190 DOMRenderer.unbatchedUpdates(function () {
19191 if (parentComponent != null) {
19192 root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
19193 } else {
19194 root.render(children, callback);
19195 }
19196 });
19197 } else {
19198 if (typeof callback === 'function') {
19199 var _originalCallback = callback;
19200 callback = function () {
19201 var instance = DOMRenderer.getPublicRootInstance(root._internalRoot);
19202 _originalCallback.call(instance);
19203 };
19204 }
19205 // Update
19206 if (parentComponent != null) {
19207 root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
19208 } else {
19209 root.render(children, callback);
19210 }
19211 }
19212 return DOMRenderer.getPublicRootInstance(root._internalRoot);
19213 }
19214
19215 function createPortal(children, container) {
19216 var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
19217
19218 !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
19219 // TODO: pass ReactDOM portal implementation as third argument
19220 return createPortal$1(children, container, null, key);
19221 }
19222
19223 var ReactDOM = {
19224 createPortal: createPortal,
19225
19226 findDOMNode: function (componentOrElement) {
19227 {
19228 var owner = ReactCurrentOwner.current;
19229 if (owner !== null && owner.stateNode !== null) {
19230 var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
19231 !warnedAboutRefsInRender ? warning(false, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner) || 'A component') : void 0;
19232 owner.stateNode._warnedAboutRefsInRender = true;
19233 }
19234 }
19235 if (componentOrElement == null) {
19236 return null;
19237 }
19238 if (componentOrElement.nodeType === ELEMENT_NODE) {
19239 return componentOrElement;
19240 }
19241
19242 return DOMRenderer.findHostInstance(componentOrElement);
19243 },
19244 hydrate: function (element, container, callback) {
19245 // TODO: throw or warn if we couldn't hydrate?
19246 return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
19247 },
19248 render: function (element, container, callback) {
19249 return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
19250 },
19251 unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
19252 !(parentComponent != null && has(parentComponent)) ? invariant(false, 'parentComponent must be a valid React Component') : void 0;
19253 return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
19254 },
19255 unmountComponentAtNode: function (container) {
19256 !isValidContainer(container) ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : void 0;
19257
19258 if (container._reactRootContainer) {
19259 {
19260 var rootEl = getReactRootElementInContainer(container);
19261 var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
19262 !!renderedByDifferentReact ? warning(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
19263 }
19264
19265 // Unmount should not be batched.
19266 DOMRenderer.unbatchedUpdates(function () {
19267 legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
19268 container._reactRootContainer = null;
19269 });
19270 });
19271 // If you call unmountComponentAtNode twice in quick succession, you'll
19272 // get `true` twice. That's probably fine?
19273 return true;
19274 } else {
19275 {
19276 var _rootEl = getReactRootElementInContainer(container);
19277 var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl));
19278
19279 // Check if the container itself is a React root node.
19280 var isContainerReactRoot = container.nodeType === 1 && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
19281
19282 !!hasNonRootReactChild ? warning(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
19283 }
19284
19285 return false;
19286 }
19287 },
19288
19289
19290 // Temporary alias since we already shipped React 16 RC with it.
19291 // TODO: remove in React 17.
19292 unstable_createPortal: function () {
19293 if (!didWarnAboutUnstableCreatePortal) {
19294 didWarnAboutUnstableCreatePortal = true;
19295 lowPriorityWarning$1(false, 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' + 'but without the "unstable_" prefix.');
19296 }
19297 return createPortal.apply(undefined, arguments);
19298 },
19299
19300
19301 unstable_batchedUpdates: DOMRenderer.batchedUpdates,
19302
19303 unstable_deferredUpdates: DOMRenderer.deferredUpdates,
19304
19305 flushSync: DOMRenderer.flushSync,
19306
19307 unstable_flushControlled: DOMRenderer.flushControlled,
19308
19309 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
19310 // For TapEventPlugin which is popular in open source
19311 EventPluginHub: EventPluginHub,
19312 // Used by test-utils
19313 EventPluginRegistry: EventPluginRegistry,
19314 EventPropagators: EventPropagators,
19315 ReactControlledComponent: ReactControlledComponent,
19316 ReactDOMComponentTree: ReactDOMComponentTree,
19317 ReactDOMEventListener: ReactDOMEventListener
19318 }
19319 };
19320
19321 ReactDOM.unstable_createRoot = function createRoot(container, options) {
19322 var hydrate = options != null && options.hydrate === true;
19323 return new ReactRoot(container, true, hydrate);
19324 };
19325
19326 var foundDevTools = DOMRenderer.injectIntoDevTools({
19327 findFiberByHostInstance: getClosestInstanceFromNode,
19328 bundleType: 1,
19329 version: ReactVersion,
19330 rendererPackageName: 'react-dom'
19331 });
19332
19333 {
19334 if (!foundDevTools && ExecutionEnvironment.canUseDOM && window.top === window.self) {
19335 // If we're in Chrome or Firefox, provide a download link if not installed.
19336 if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
19337 var protocol = window.location.protocol;
19338 // Don't warn in exotic cases like chrome-extension://.
19339 if (/^(https?|file):$/.test(protocol)) {
19340 console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://fb.me/react-devtools' + (protocol === 'file:' ? '\nYou might need to use a local HTTP server (instead of file://): ' + 'https://fb.me/react-devtools-faq' : ''), 'font-weight:bold');
19341 }
19342 }
19343 }
19344 }
19345
19346
19347
19348 var ReactDOM$2 = Object.freeze({
19349 default: ReactDOM
19350 });
19351
19352 var ReactDOM$3 = ( ReactDOM$2 && ReactDOM ) || ReactDOM$2;
19353
19354 // TODO: decide on the top-level export form.
19355 // This is hacky but makes it work with both Rollup and Jest.
19356 var reactDom = ReactDOM$3['default'] ? ReactDOM$3['default'] : ReactDOM$3;
19357
19358 module.exports = reactDom;
19359 })();
19360 }
19361
19362 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
19363
19364/***/ }),
19365/* 21 */
19366/***/ (function(module, exports, __webpack_require__) {
19367
19368 /**
19369 * Copyright (c) 2013-present, Facebook, Inc.
19370 *
19371 * This source code is licensed under the MIT license found in the
19372 * LICENSE file in the root directory of this source tree.
19373 *
19374 * @typechecks
19375 */
19376
19377 'use strict';
19378
19379 var hyphenate = __webpack_require__(22);
19380
19381 var msPattern = /^ms-/;
19382
19383 /**
19384 * Hyphenates a camelcased CSS property name, for example:
19385 *
19386 * > hyphenateStyleName('backgroundColor')
19387 * < "background-color"
19388 * > hyphenateStyleName('MozTransition')
19389 * < "-moz-transition"
19390 * > hyphenateStyleName('msTransition')
19391 * < "-ms-transition"
19392 *
19393 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
19394 * is converted to `-ms-`.
19395 *
19396 * @param {string} string
19397 * @return {string}
19398 */
19399 function hyphenateStyleName(string) {
19400 return hyphenate(string).replace(msPattern, '-ms-');
19401 }
19402
19403 module.exports = hyphenateStyleName;
19404
19405/***/ }),
19406/* 22 */
19407/***/ (function(module, exports) {
19408
19409 'use strict';
19410
19411 /**
19412 * Copyright (c) 2013-present, Facebook, Inc.
19413 *
19414 * This source code is licensed under the MIT license found in the
19415 * LICENSE file in the root directory of this source tree.
19416 *
19417 * @typechecks
19418 */
19419
19420 var _uppercasePattern = /([A-Z])/g;
19421
19422 /**
19423 * Hyphenates a camelcased string, for example:
19424 *
19425 * > hyphenate('backgroundColor')
19426 * < "background-color"
19427 *
19428 * For CSS style names, use `hyphenateStyleName` instead which works properly
19429 * with all vendor prefixes, including `ms`.
19430 *
19431 * @param {string} string
19432 * @return {string}
19433 */
19434 function hyphenate(string) {
19435 return string.replace(_uppercasePattern, '-$1').toLowerCase();
19436 }
19437
19438 module.exports = hyphenate;
19439
19440/***/ }),
19441/* 23 */
19442/***/ (function(module, exports, __webpack_require__) {
19443
19444 /**
19445 * Copyright (c) 2013-present, Facebook, Inc.
19446 *
19447 * This source code is licensed under the MIT license found in the
19448 * LICENSE file in the root directory of this source tree.
19449 *
19450 * @typechecks
19451 */
19452
19453 'use strict';
19454
19455 var camelize = __webpack_require__(24);
19456
19457 var msPattern = /^-ms-/;
19458
19459 /**
19460 * Camelcases a hyphenated CSS property name, for example:
19461 *
19462 * > camelizeStyleName('background-color')
19463 * < "backgroundColor"
19464 * > camelizeStyleName('-moz-transition')
19465 * < "MozTransition"
19466 * > camelizeStyleName('-ms-transition')
19467 * < "msTransition"
19468 *
19469 * As Andi Smith suggests
19470 * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
19471 * is converted to lowercase `ms`.
19472 *
19473 * @param {string} string
19474 * @return {string}
19475 */
19476 function camelizeStyleName(string) {
19477 return camelize(string.replace(msPattern, 'ms-'));
19478 }
19479
19480 module.exports = camelizeStyleName;
19481
19482/***/ }),
19483/* 24 */
19484/***/ (function(module, exports) {
19485
19486 "use strict";
19487
19488 /**
19489 * Copyright (c) 2013-present, Facebook, Inc.
19490 *
19491 * This source code is licensed under the MIT license found in the
19492 * LICENSE file in the root directory of this source tree.
19493 *
19494 * @typechecks
19495 */
19496
19497 var _hyphenPattern = /-(.)/g;
19498
19499 /**
19500 * Camelcases a hyphenated string, for example:
19501 *
19502 * > camelize('background-color')
19503 * < "backgroundColor"
19504 *
19505 * @param {string} string
19506 * @return {string}
19507 */
19508 function camelize(string) {
19509 return string.replace(_hyphenPattern, function (_, character) {
19510 return character.toUpperCase();
19511 });
19512 }
19513
19514 module.exports = camelize;
19515
19516/***/ }),
19517/* 25 */
19518/***/ (function(module, exports, __webpack_require__) {
19519
19520 'use strict';
19521
19522 Object.defineProperty(exports, "__esModule", {
19523 value: true
19524 });
19525
19526 var _Frame = __webpack_require__(26);
19527
19528 var _Frame2 = _interopRequireDefault(_Frame);
19529
19530 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19531
19532 exports.default = _Frame2.default;
19533
19534/***/ }),
19535/* 26 */
19536/***/ (function(module, exports, __webpack_require__) {
19537
19538 'use strict';
19539
19540 Object.defineProperty(exports, "__esModule", {
19541 value: true
19542 });
19543
19544 var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
19545
19546 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
19547
19548 var _react = __webpack_require__(1);
19549
19550 var _react2 = _interopRequireDefault(_react);
19551
19552 var _reactDom = __webpack_require__(12);
19553
19554 var _reactDom2 = _interopRequireDefault(_reactDom);
19555
19556 var _propTypes = __webpack_require__(27);
19557
19558 var _propTypes2 = _interopRequireDefault(_propTypes);
19559
19560 var _DocumentContext = __webpack_require__(30);
19561
19562 var _DocumentContext2 = _interopRequireDefault(_DocumentContext);
19563
19564 var _Content = __webpack_require__(31);
19565
19566 var _Content2 = _interopRequireDefault(_Content);
19567
19568 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19569
19570 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19571
19572 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
19573
19574 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
19575
19576 var Frame = function (_Component) {
19577 _inherits(Frame, _Component);
19578
19579 // React warns when you render directly into the body since browser extensions
19580 // also inject into the body and can mess up React. For this reason
19581 // initialContent is expected to have a div inside of the body
19582 // element that we render react into.
19583 function Frame(props, context) {
19584 _classCallCheck(this, Frame);
19585
19586 var _this = _possibleConstructorReturn(this, (Frame.__proto__ || Object.getPrototypeOf(Frame)).call(this, props, context));
19587
19588 _this.handleLoad = function () {
19589 _this.forceUpdate();
19590 };
19591
19592 _this._isMounted = false;
19593 return _this;
19594 }
19595
19596 _createClass(Frame, [{
19597 key: 'componentDidMount',
19598 value: function componentDidMount() {
19599 this._isMounted = true;
19600
19601 var doc = this.getDoc();
19602 if (doc && doc.readyState === 'complete') {
19603 this.forceUpdate();
19604 } else {
19605 this.node.addEventListener('load', this.handleLoad);
19606 }
19607 }
19608 }, {
19609 key: 'componentWillUnmount',
19610 value: function componentWillUnmount() {
19611 this._isMounted = false;
19612
19613 this.node.removeEventListener('load', this.handleLoad);
19614 }
19615 }, {
19616 key: 'getDoc',
19617 value: function getDoc() {
19618 return this.node.contentDocument; // eslint-disable-line
19619 }
19620 }, {
19621 key: 'getMountTarget',
19622 value: function getMountTarget() {
19623 var doc = this.getDoc();
19624 if (this.props.mountTarget) {
19625 return doc.querySelector(this.props.mountTarget);
19626 }
19627 return doc.body.children[0];
19628 }
19629 }, {
19630 key: 'renderFrameContents',
19631 value: function renderFrameContents() {
19632 if (!this._isMounted) {
19633 return null;
19634 }
19635
19636 var doc = this.getDoc();
19637
19638 if (doc.querySelector('.frame-content') === null) {
19639 this._setInitialContent = false;
19640 }
19641
19642 var contentDidMount = this.props.contentDidMount;
19643 var contentDidUpdate = this.props.contentDidUpdate;
19644
19645 var win = doc.defaultView || doc.parentView;
19646 var initialRender = !this._setInitialContent;
19647 var contents = _react2.default.createElement(
19648 _Content2.default,
19649 { contentDidMount: contentDidMount, contentDidUpdate: contentDidUpdate },
19650 _react2.default.createElement(
19651 _DocumentContext2.default,
19652 { document: doc, window: win },
19653 _react2.default.createElement(
19654 'div',
19655 { className: 'frame-content' },
19656 this.props.children
19657 )
19658 )
19659 );
19660
19661 if (initialRender) {
19662 doc.open('text/html', 'replace');
19663 doc.write(this.props.initialContent);
19664 doc.close();
19665 this._setInitialContent = true;
19666 }
19667
19668 var mountTarget = this.getMountTarget();
19669
19670 return [_reactDom2.default.createPortal(this.props.head, this.getDoc().head), _reactDom2.default.createPortal(contents, mountTarget)];
19671 }
19672 }, {
19673 key: 'render',
19674 value: function render() {
19675 var _this2 = this;
19676
19677 var props = _extends({}, this.props, {
19678 children: undefined // The iframe isn't ready so we drop children from props here. #12, #17
19679 });
19680 delete props.head;
19681 delete props.initialContent;
19682 delete props.mountTarget;
19683 delete props.contentDidMount;
19684 delete props.contentDidUpdate;
19685 return _react2.default.createElement(
19686 'iframe',
19687 _extends({}, props, { ref: function ref(node) {
19688 return _this2.node = node;
19689 } }),
19690 this.renderFrameContents()
19691 );
19692 }
19693 }]);
19694
19695 return Frame;
19696 }(_react.Component);
19697
19698 Frame.propTypes = {
19699 style: _propTypes2.default.object, // eslint-disable-line
19700 head: _propTypes2.default.node,
19701 initialContent: _propTypes2.default.string,
19702 mountTarget: _propTypes2.default.string,
19703 contentDidMount: _propTypes2.default.func,
19704 contentDidUpdate: _propTypes2.default.func,
19705 children: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.arrayOf(_propTypes2.default.element)])
19706 };
19707 Frame.defaultProps = {
19708 style: {},
19709 head: null,
19710 children: undefined,
19711 mountTarget: undefined,
19712 contentDidMount: function contentDidMount() {},
19713 contentDidUpdate: function contentDidUpdate() {},
19714 initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
19715 };
19716 exports.default = Frame;
19717
19718/***/ }),
19719/* 27 */
19720/***/ (function(module, exports, __webpack_require__) {
19721
19722 /* WEBPACK VAR INJECTION */(function(process) {/**
19723 * Copyright (c) 2013-present, Facebook, Inc.
19724 *
19725 * This source code is licensed under the MIT license found in the
19726 * LICENSE file in the root directory of this source tree.
19727 */
19728
19729 if (process.env.NODE_ENV !== 'production') {
19730 var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
19731 Symbol.for &&
19732 Symbol.for('react.element')) ||
19733 0xeac7;
19734
19735 var isValidElement = function(object) {
19736 return typeof object === 'object' &&
19737 object !== null &&
19738 object.$$typeof === REACT_ELEMENT_TYPE;
19739 };
19740
19741 // By explicitly using `prop-types` you are opting into new development behavior.
19742 // http://fb.me/prop-types-in-prod
19743 var throwOnDirectAccess = true;
19744 module.exports = __webpack_require__(28)(isValidElement, throwOnDirectAccess);
19745 } else {
19746 // By explicitly using `prop-types` you are opting into new production behavior.
19747 // http://fb.me/prop-types-in-prod
19748 module.exports = __webpack_require__(29)();
19749 }
19750
19751 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
19752
19753/***/ }),
19754/* 28 */
19755/***/ (function(module, exports, __webpack_require__) {
19756
19757 /* WEBPACK VAR INJECTION */(function(process) {/**
19758 * Copyright (c) 2013-present, Facebook, Inc.
19759 *
19760 * This source code is licensed under the MIT license found in the
19761 * LICENSE file in the root directory of this source tree.
19762 */
19763
19764 'use strict';
19765
19766 var emptyFunction = __webpack_require__(7);
19767 var invariant = __webpack_require__(5);
19768 var warning = __webpack_require__(9);
19769 var assign = __webpack_require__(4);
19770
19771 var ReactPropTypesSecret = __webpack_require__(11);
19772 var checkPropTypes = __webpack_require__(10);
19773
19774 module.exports = function(isValidElement, throwOnDirectAccess) {
19775 /* global Symbol */
19776 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
19777 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
19778
19779 /**
19780 * Returns the iterator method function contained on the iterable object.
19781 *
19782 * Be sure to invoke the function with the iterable as context:
19783 *
19784 * var iteratorFn = getIteratorFn(myIterable);
19785 * if (iteratorFn) {
19786 * var iterator = iteratorFn.call(myIterable);
19787 * ...
19788 * }
19789 *
19790 * @param {?object} maybeIterable
19791 * @return {?function}
19792 */
19793 function getIteratorFn(maybeIterable) {
19794 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
19795 if (typeof iteratorFn === 'function') {
19796 return iteratorFn;
19797 }
19798 }
19799
19800 /**
19801 * Collection of methods that allow declaration and validation of props that are
19802 * supplied to React components. Example usage:
19803 *
19804 * var Props = require('ReactPropTypes');
19805 * var MyArticle = React.createClass({
19806 * propTypes: {
19807 * // An optional string prop named "description".
19808 * description: Props.string,
19809 *
19810 * // A required enum prop named "category".
19811 * category: Props.oneOf(['News','Photos']).isRequired,
19812 *
19813 * // A prop named "dialog" that requires an instance of Dialog.
19814 * dialog: Props.instanceOf(Dialog).isRequired
19815 * },
19816 * render: function() { ... }
19817 * });
19818 *
19819 * A more formal specification of how these methods are used:
19820 *
19821 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
19822 * decl := ReactPropTypes.{type}(.isRequired)?
19823 *
19824 * Each and every declaration produces a function with the same signature. This
19825 * allows the creation of custom validation functions. For example:
19826 *
19827 * var MyLink = React.createClass({
19828 * propTypes: {
19829 * // An optional string or URI prop named "href".
19830 * href: function(props, propName, componentName) {
19831 * var propValue = props[propName];
19832 * if (propValue != null && typeof propValue !== 'string' &&
19833 * !(propValue instanceof URI)) {
19834 * return new Error(
19835 * 'Expected a string or an URI for ' + propName + ' in ' +
19836 * componentName
19837 * );
19838 * }
19839 * }
19840 * },
19841 * render: function() {...}
19842 * });
19843 *
19844 * @internal
19845 */
19846
19847 var ANONYMOUS = '<<anonymous>>';
19848
19849 // Important!
19850 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
19851 var ReactPropTypes = {
19852 array: createPrimitiveTypeChecker('array'),
19853 bool: createPrimitiveTypeChecker('boolean'),
19854 func: createPrimitiveTypeChecker('function'),
19855 number: createPrimitiveTypeChecker('number'),
19856 object: createPrimitiveTypeChecker('object'),
19857 string: createPrimitiveTypeChecker('string'),
19858 symbol: createPrimitiveTypeChecker('symbol'),
19859
19860 any: createAnyTypeChecker(),
19861 arrayOf: createArrayOfTypeChecker,
19862 element: createElementTypeChecker(),
19863 instanceOf: createInstanceTypeChecker,
19864 node: createNodeChecker(),
19865 objectOf: createObjectOfTypeChecker,
19866 oneOf: createEnumTypeChecker,
19867 oneOfType: createUnionTypeChecker,
19868 shape: createShapeTypeChecker,
19869 exact: createStrictShapeTypeChecker,
19870 };
19871
19872 /**
19873 * inlined Object.is polyfill to avoid requiring consumers ship their own
19874 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
19875 */
19876 /*eslint-disable no-self-compare*/
19877 function is(x, y) {
19878 // SameValue algorithm
19879 if (x === y) {
19880 // Steps 1-5, 7-10
19881 // Steps 6.b-6.e: +0 != -0
19882 return x !== 0 || 1 / x === 1 / y;
19883 } else {
19884 // Step 6.a: NaN == NaN
19885 return x !== x && y !== y;
19886 }
19887 }
19888 /*eslint-enable no-self-compare*/
19889
19890 /**
19891 * We use an Error-like object for backward compatibility as people may call
19892 * PropTypes directly and inspect their output. However, we don't use real
19893 * Errors anymore. We don't inspect their stack anyway, and creating them
19894 * is prohibitively expensive if they are created too often, such as what
19895 * happens in oneOfType() for any type before the one that matched.
19896 */
19897 function PropTypeError(message) {
19898 this.message = message;
19899 this.stack = '';
19900 }
19901 // Make `instanceof Error` still work for returned errors.
19902 PropTypeError.prototype = Error.prototype;
19903
19904 function createChainableTypeChecker(validate) {
19905 if (process.env.NODE_ENV !== 'production') {
19906 var manualPropTypeCallCache = {};
19907 var manualPropTypeWarningCount = 0;
19908 }
19909 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
19910 componentName = componentName || ANONYMOUS;
19911 propFullName = propFullName || propName;
19912
19913 if (secret !== ReactPropTypesSecret) {
19914 if (throwOnDirectAccess) {
19915 // New behavior only for users of `prop-types` package
19916 invariant(
19917 false,
19918 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
19919 'Use `PropTypes.checkPropTypes()` to call them. ' +
19920 'Read more at http://fb.me/use-check-prop-types'
19921 );
19922 } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
19923 // Old behavior for people using React.PropTypes
19924 var cacheKey = componentName + ':' + propName;
19925 if (
19926 !manualPropTypeCallCache[cacheKey] &&
19927 // Avoid spamming the console because they are often not actionable except for lib authors
19928 manualPropTypeWarningCount < 3
19929 ) {
19930 warning(
19931 false,
19932 'You are manually calling a React.PropTypes validation ' +
19933 'function for the `%s` prop on `%s`. This is deprecated ' +
19934 'and will throw in the standalone `prop-types` package. ' +
19935 'You may be seeing this warning due to a third-party PropTypes ' +
19936 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
19937 propFullName,
19938 componentName
19939 );
19940 manualPropTypeCallCache[cacheKey] = true;
19941 manualPropTypeWarningCount++;
19942 }
19943 }
19944 }
19945 if (props[propName] == null) {
19946 if (isRequired) {
19947 if (props[propName] === null) {
19948 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
19949 }
19950 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
19951 }
19952 return null;
19953 } else {
19954 return validate(props, propName, componentName, location, propFullName);
19955 }
19956 }
19957
19958 var chainedCheckType = checkType.bind(null, false);
19959 chainedCheckType.isRequired = checkType.bind(null, true);
19960
19961 return chainedCheckType;
19962 }
19963
19964 function createPrimitiveTypeChecker(expectedType) {
19965 function validate(props, propName, componentName, location, propFullName, secret) {
19966 var propValue = props[propName];
19967 var propType = getPropType(propValue);
19968 if (propType !== expectedType) {
19969 // `propValue` being instance of, say, date/regexp, pass the 'object'
19970 // check, but we can offer a more precise error message here rather than
19971 // 'of type `object`'.
19972 var preciseType = getPreciseType(propValue);
19973
19974 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
19975 }
19976 return null;
19977 }
19978 return createChainableTypeChecker(validate);
19979 }
19980
19981 function createAnyTypeChecker() {
19982 return createChainableTypeChecker(emptyFunction.thatReturnsNull);
19983 }
19984
19985 function createArrayOfTypeChecker(typeChecker) {
19986 function validate(props, propName, componentName, location, propFullName) {
19987 if (typeof typeChecker !== 'function') {
19988 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
19989 }
19990 var propValue = props[propName];
19991 if (!Array.isArray(propValue)) {
19992 var propType = getPropType(propValue);
19993 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
19994 }
19995 for (var i = 0; i < propValue.length; i++) {
19996 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
19997 if (error instanceof Error) {
19998 return error;
19999 }
20000 }
20001 return null;
20002 }
20003 return createChainableTypeChecker(validate);
20004 }
20005
20006 function createElementTypeChecker() {
20007 function validate(props, propName, componentName, location, propFullName) {
20008 var propValue = props[propName];
20009 if (!isValidElement(propValue)) {
20010 var propType = getPropType(propValue);
20011 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
20012 }
20013 return null;
20014 }
20015 return createChainableTypeChecker(validate);
20016 }
20017
20018 function createInstanceTypeChecker(expectedClass) {
20019 function validate(props, propName, componentName, location, propFullName) {
20020 if (!(props[propName] instanceof expectedClass)) {
20021 var expectedClassName = expectedClass.name || ANONYMOUS;
20022 var actualClassName = getClassName(props[propName]);
20023 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
20024 }
20025 return null;
20026 }
20027 return createChainableTypeChecker(validate);
20028 }
20029
20030 function createEnumTypeChecker(expectedValues) {
20031 if (!Array.isArray(expectedValues)) {
20032 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
20033 return emptyFunction.thatReturnsNull;
20034 }
20035
20036 function validate(props, propName, componentName, location, propFullName) {
20037 var propValue = props[propName];
20038 for (var i = 0; i < expectedValues.length; i++) {
20039 if (is(propValue, expectedValues[i])) {
20040 return null;
20041 }
20042 }
20043
20044 var valuesString = JSON.stringify(expectedValues);
20045 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
20046 }
20047 return createChainableTypeChecker(validate);
20048 }
20049
20050 function createObjectOfTypeChecker(typeChecker) {
20051 function validate(props, propName, componentName, location, propFullName) {
20052 if (typeof typeChecker !== 'function') {
20053 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
20054 }
20055 var propValue = props[propName];
20056 var propType = getPropType(propValue);
20057 if (propType !== 'object') {
20058 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
20059 }
20060 for (var key in propValue) {
20061 if (propValue.hasOwnProperty(key)) {
20062 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
20063 if (error instanceof Error) {
20064 return error;
20065 }
20066 }
20067 }
20068 return null;
20069 }
20070 return createChainableTypeChecker(validate);
20071 }
20072
20073 function createUnionTypeChecker(arrayOfTypeCheckers) {
20074 if (!Array.isArray(arrayOfTypeCheckers)) {
20075 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
20076 return emptyFunction.thatReturnsNull;
20077 }
20078
20079 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
20080 var checker = arrayOfTypeCheckers[i];
20081 if (typeof checker !== 'function') {
20082 warning(
20083 false,
20084 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
20085 'received %s at index %s.',
20086 getPostfixForTypeWarning(checker),
20087 i
20088 );
20089 return emptyFunction.thatReturnsNull;
20090 }
20091 }
20092
20093 function validate(props, propName, componentName, location, propFullName) {
20094 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
20095 var checker = arrayOfTypeCheckers[i];
20096 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
20097 return null;
20098 }
20099 }
20100
20101 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
20102 }
20103 return createChainableTypeChecker(validate);
20104 }
20105
20106 function createNodeChecker() {
20107 function validate(props, propName, componentName, location, propFullName) {
20108 if (!isNode(props[propName])) {
20109 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
20110 }
20111 return null;
20112 }
20113 return createChainableTypeChecker(validate);
20114 }
20115
20116 function createShapeTypeChecker(shapeTypes) {
20117 function validate(props, propName, componentName, location, propFullName) {
20118 var propValue = props[propName];
20119 var propType = getPropType(propValue);
20120 if (propType !== 'object') {
20121 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
20122 }
20123 for (var key in shapeTypes) {
20124 var checker = shapeTypes[key];
20125 if (!checker) {
20126 continue;
20127 }
20128 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
20129 if (error) {
20130 return error;
20131 }
20132 }
20133 return null;
20134 }
20135 return createChainableTypeChecker(validate);
20136 }
20137
20138 function createStrictShapeTypeChecker(shapeTypes) {
20139 function validate(props, propName, componentName, location, propFullName) {
20140 var propValue = props[propName];
20141 var propType = getPropType(propValue);
20142 if (propType !== 'object') {
20143 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
20144 }
20145 // We need to check all keys in case some are required but missing from
20146 // props.
20147 var allKeys = assign({}, props[propName], shapeTypes);
20148 for (var key in allKeys) {
20149 var checker = shapeTypes[key];
20150 if (!checker) {
20151 return new PropTypeError(
20152 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
20153 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
20154 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
20155 );
20156 }
20157 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
20158 if (error) {
20159 return error;
20160 }
20161 }
20162 return null;
20163 }
20164
20165 return createChainableTypeChecker(validate);
20166 }
20167
20168 function isNode(propValue) {
20169 switch (typeof propValue) {
20170 case 'number':
20171 case 'string':
20172 case 'undefined':
20173 return true;
20174 case 'boolean':
20175 return !propValue;
20176 case 'object':
20177 if (Array.isArray(propValue)) {
20178 return propValue.every(isNode);
20179 }
20180 if (propValue === null || isValidElement(propValue)) {
20181 return true;
20182 }
20183
20184 var iteratorFn = getIteratorFn(propValue);
20185 if (iteratorFn) {
20186 var iterator = iteratorFn.call(propValue);
20187 var step;
20188 if (iteratorFn !== propValue.entries) {
20189 while (!(step = iterator.next()).done) {
20190 if (!isNode(step.value)) {
20191 return false;
20192 }
20193 }
20194 } else {
20195 // Iterator will provide entry [k,v] tuples rather than values.
20196 while (!(step = iterator.next()).done) {
20197 var entry = step.value;
20198 if (entry) {
20199 if (!isNode(entry[1])) {
20200 return false;
20201 }
20202 }
20203 }
20204 }
20205 } else {
20206 return false;
20207 }
20208
20209 return true;
20210 default:
20211 return false;
20212 }
20213 }
20214
20215 function isSymbol(propType, propValue) {
20216 // Native Symbol.
20217 if (propType === 'symbol') {
20218 return true;
20219 }
20220
20221 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
20222 if (propValue['@@toStringTag'] === 'Symbol') {
20223 return true;
20224 }
20225
20226 // Fallback for non-spec compliant Symbols which are polyfilled.
20227 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
20228 return true;
20229 }
20230
20231 return false;
20232 }
20233
20234 // Equivalent of `typeof` but with special handling for array and regexp.
20235 function getPropType(propValue) {
20236 var propType = typeof propValue;
20237 if (Array.isArray(propValue)) {
20238 return 'array';
20239 }
20240 if (propValue instanceof RegExp) {
20241 // Old webkits (at least until Android 4.0) return 'function' rather than
20242 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
20243 // passes PropTypes.object.
20244 return 'object';
20245 }
20246 if (isSymbol(propType, propValue)) {
20247 return 'symbol';
20248 }
20249 return propType;
20250 }
20251
20252 // This handles more types than `getPropType`. Only used for error messages.
20253 // See `createPrimitiveTypeChecker`.
20254 function getPreciseType(propValue) {
20255 if (typeof propValue === 'undefined' || propValue === null) {
20256 return '' + propValue;
20257 }
20258 var propType = getPropType(propValue);
20259 if (propType === 'object') {
20260 if (propValue instanceof Date) {
20261 return 'date';
20262 } else if (propValue instanceof RegExp) {
20263 return 'regexp';
20264 }
20265 }
20266 return propType;
20267 }
20268
20269 // Returns a string that is postfixed to a warning about an invalid type.
20270 // For example, "undefined" or "of type array"
20271 function getPostfixForTypeWarning(value) {
20272 var type = getPreciseType(value);
20273 switch (type) {
20274 case 'array':
20275 case 'object':
20276 return 'an ' + type;
20277 case 'boolean':
20278 case 'date':
20279 case 'regexp':
20280 return 'a ' + type;
20281 default:
20282 return type;
20283 }
20284 }
20285
20286 // Returns class name of the object, if any.
20287 function getClassName(propValue) {
20288 if (!propValue.constructor || !propValue.constructor.name) {
20289 return ANONYMOUS;
20290 }
20291 return propValue.constructor.name;
20292 }
20293
20294 ReactPropTypes.checkPropTypes = checkPropTypes;
20295 ReactPropTypes.PropTypes = ReactPropTypes;
20296
20297 return ReactPropTypes;
20298 };
20299
20300 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
20301
20302/***/ }),
20303/* 29 */
20304/***/ (function(module, exports, __webpack_require__) {
20305
20306 /**
20307 * Copyright (c) 2013-present, Facebook, Inc.
20308 *
20309 * This source code is licensed under the MIT license found in the
20310 * LICENSE file in the root directory of this source tree.
20311 */
20312
20313 'use strict';
20314
20315 var emptyFunction = __webpack_require__(7);
20316 var invariant = __webpack_require__(5);
20317 var ReactPropTypesSecret = __webpack_require__(11);
20318
20319 module.exports = function() {
20320 function shim(props, propName, componentName, location, propFullName, secret) {
20321 if (secret === ReactPropTypesSecret) {
20322 // It is still safe when called from React.
20323 return;
20324 }
20325 invariant(
20326 false,
20327 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
20328 'Use PropTypes.checkPropTypes() to call them. ' +
20329 'Read more at http://fb.me/use-check-prop-types'
20330 );
20331 };
20332 shim.isRequired = shim;
20333 function getShim() {
20334 return shim;
20335 };
20336 // Important!
20337 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
20338 var ReactPropTypes = {
20339 array: shim,
20340 bool: shim,
20341 func: shim,
20342 number: shim,
20343 object: shim,
20344 string: shim,
20345 symbol: shim,
20346
20347 any: shim,
20348 arrayOf: getShim,
20349 element: shim,
20350 instanceOf: getShim,
20351 node: shim,
20352 objectOf: getShim,
20353 oneOf: getShim,
20354 oneOfType: getShim,
20355 shape: getShim,
20356 exact: getShim
20357 };
20358
20359 ReactPropTypes.checkPropTypes = emptyFunction;
20360 ReactPropTypes.PropTypes = ReactPropTypes;
20361
20362 return ReactPropTypes;
20363 };
20364
20365
20366/***/ }),
20367/* 30 */
20368/***/ (function(module, exports, __webpack_require__) {
20369
20370 'use strict';
20371
20372 Object.defineProperty(exports, "__esModule", {
20373 value: true
20374 });
20375
20376 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
20377
20378 var _react = __webpack_require__(1);
20379
20380 var _react2 = _interopRequireDefault(_react);
20381
20382 var _propTypes = __webpack_require__(27);
20383
20384 var _propTypes2 = _interopRequireDefault(_propTypes);
20385
20386 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20387
20388 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20389
20390 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
20391
20392 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // eslint-disable-line no-unused-vars
20393
20394
20395 var DocumentContext = function (_Component) {
20396 _inherits(DocumentContext, _Component);
20397
20398 function DocumentContext() {
20399 _classCallCheck(this, DocumentContext);
20400
20401 return _possibleConstructorReturn(this, (DocumentContext.__proto__ || Object.getPrototypeOf(DocumentContext)).apply(this, arguments));
20402 }
20403
20404 _createClass(DocumentContext, [{
20405 key: 'getChildContext',
20406 value: function getChildContext() {
20407 return {
20408 document: this.props.document,
20409 window: this.props.window
20410 };
20411 }
20412 }, {
20413 key: 'render',
20414 value: function render() {
20415 return _react.Children.only(this.props.children);
20416 }
20417 }]);
20418
20419 return DocumentContext;
20420 }(_react.Component);
20421
20422 DocumentContext.propTypes = {
20423 document: _propTypes2.default.object.isRequired,
20424 window: _propTypes2.default.object.isRequired,
20425 children: _propTypes2.default.element.isRequired
20426 };
20427 DocumentContext.childContextTypes = {
20428 document: _propTypes2.default.object.isRequired,
20429 window: _propTypes2.default.object.isRequired
20430 };
20431 exports.default = DocumentContext;
20432
20433/***/ }),
20434/* 31 */
20435/***/ (function(module, exports, __webpack_require__) {
20436
20437 'use strict';
20438
20439 Object.defineProperty(exports, "__esModule", {
20440 value: true
20441 });
20442
20443 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
20444
20445 var _react = __webpack_require__(1);
20446
20447 var _react2 = _interopRequireDefault(_react);
20448
20449 var _propTypes = __webpack_require__(27);
20450
20451 var _propTypes2 = _interopRequireDefault(_propTypes);
20452
20453 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20454
20455 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20456
20457 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
20458
20459 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // eslint-disable-line no-unused-vars
20460
20461
20462 var Content = function (_Component) {
20463 _inherits(Content, _Component);
20464
20465 function Content() {
20466 _classCallCheck(this, Content);
20467
20468 return _possibleConstructorReturn(this, (Content.__proto__ || Object.getPrototypeOf(Content)).apply(this, arguments));
20469 }
20470
20471 _createClass(Content, [{
20472 key: 'componentDidMount',
20473 value: function componentDidMount() {
20474 this.props.contentDidMount();
20475 }
20476 }, {
20477 key: 'componentDidUpdate',
20478 value: function componentDidUpdate() {
20479 this.props.contentDidUpdate();
20480 }
20481 }, {
20482 key: 'render',
20483 value: function render() {
20484 return _react.Children.only(this.props.children);
20485 }
20486 }]);
20487
20488 return Content;
20489 }(_react.Component);
20490
20491 Content.propTypes = {
20492 children: _propTypes2.default.element.isRequired,
20493 contentDidMount: _propTypes2.default.func.isRequired,
20494 contentDidUpdate: _propTypes2.default.func.isRequired
20495 };
20496 exports.default = Content;
20497
20498/***/ })
20499/******/ ]);
20500//# sourceMappingURL=appbundle.js.map
\No newline at end of file