UNPKG

1.3 MBJavaScriptView Raw
1require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2function _assertThisInitialized(self) {
3 if (self === void 0) {
4 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
5 }
6
7 return self;
8}
9
10module.exports = _assertThisInitialized;
11},{}],2:[function(require,module,exports){
12function _extends() {
13 module.exports = _extends = Object.assign || function (target) {
14 for (var i = 1; i < arguments.length; i++) {
15 var source = arguments[i];
16
17 for (var key in source) {
18 if (Object.prototype.hasOwnProperty.call(source, key)) {
19 target[key] = source[key];
20 }
21 }
22 }
23
24 return target;
25 };
26
27 return _extends.apply(this, arguments);
28}
29
30module.exports = _extends;
31},{}],3:[function(require,module,exports){
32function _inheritsLoose(subClass, superClass) {
33 subClass.prototype = Object.create(superClass.prototype);
34 subClass.prototype.constructor = subClass;
35 subClass.__proto__ = superClass;
36}
37
38module.exports = _inheritsLoose;
39},{}],4:[function(require,module,exports){
40function _interopRequireDefault(obj) {
41 return obj && obj.__esModule ? obj : {
42 default: obj
43 };
44}
45
46module.exports = _interopRequireDefault;
47},{}],5:[function(require,module,exports){
48function _interopRequireWildcard(obj) {
49 if (obj && obj.__esModule) {
50 return obj;
51 } else {
52 var newObj = {};
53
54 if (obj != null) {
55 for (var key in obj) {
56 if (Object.prototype.hasOwnProperty.call(obj, key)) {
57 var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
58
59 if (desc.get || desc.set) {
60 Object.defineProperty(newObj, key, desc);
61 } else {
62 newObj[key] = obj[key];
63 }
64 }
65 }
66 }
67
68 newObj.default = obj;
69 return newObj;
70 }
71}
72
73module.exports = _interopRequireWildcard;
74},{}],6:[function(require,module,exports){
75function _objectWithoutPropertiesLoose(source, excluded) {
76 if (source == null) return {};
77 var target = {};
78 var sourceKeys = Object.keys(source);
79 var key, i;
80
81 for (i = 0; i < sourceKeys.length; i++) {
82 key = sourceKeys[i];
83 if (excluded.indexOf(key) >= 0) continue;
84 target[key] = source[key];
85 }
86
87 return target;
88}
89
90module.exports = _objectWithoutPropertiesLoose;
91},{}],7:[function(require,module,exports){
92/**
93 * Returns a function, that, as long as it continues to be invoked, will not
94 * be triggered. The function will be called after it stops being called for
95 * N milliseconds. If `immediate` is passed, trigger the function on the
96 * leading edge, instead of the trailing. The function also has a property 'clear'
97 * that is a function which will clear the timer to prevent previously scheduled executions.
98 *
99 * @source underscore.js
100 * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
101 * @param {Function} function to wrap
102 * @param {Number} timeout in ms (`100`)
103 * @param {Boolean} whether to execute at the beginning (`false`)
104 * @api public
105 */
106function debounce(func, wait, immediate){
107 var timeout, args, context, timestamp, result;
108 if (null == wait) wait = 100;
109
110 function later() {
111 var last = Date.now() - timestamp;
112
113 if (last < wait && last >= 0) {
114 timeout = setTimeout(later, wait - last);
115 } else {
116 timeout = null;
117 if (!immediate) {
118 result = func.apply(context, args);
119 context = args = null;
120 }
121 }
122 };
123
124 var debounced = function(){
125 context = this;
126 args = arguments;
127 timestamp = Date.now();
128 var callNow = immediate && !timeout;
129 if (!timeout) timeout = setTimeout(later, wait);
130 if (callNow) {
131 result = func.apply(context, args);
132 context = args = null;
133 }
134
135 return result;
136 };
137
138 debounced.clear = function() {
139 if (timeout) {
140 clearTimeout(timeout);
141 timeout = null;
142 }
143 };
144
145 debounced.flush = function() {
146 if (timeout) {
147 result = func.apply(context, args);
148 context = args = null;
149
150 clearTimeout(timeout);
151 timeout = null;
152 }
153 };
154
155 return debounced;
156};
157
158// Adds compatibility for ES modules
159debounce.debounce = debounce;
160
161module.exports = debounce;
162
163},{}],8:[function(require,module,exports){
164(function (global){
165/*!
166 * deep-diff.
167 * Licensed under the MIT License.
168 */
169;(function(root, factory) {
170 'use strict';
171 if (typeof define === 'function' && define.amd) {
172 // AMD. Register as an anonymous module.
173 define([], function() {
174 return factory();
175 });
176 } else if (typeof exports === 'object') {
177 // Node. Does not work with strict CommonJS, but
178 // only CommonJS-like environments that support module.exports,
179 // like Node.
180 module.exports = factory();
181 } else {
182 // Browser globals (root is window)
183 root.DeepDiff = factory();
184 }
185}(this, function(undefined) {
186 'use strict';
187
188 var $scope, conflict, conflictResolution = [];
189 if (typeof global === 'object' && global) {
190 $scope = global;
191 } else if (typeof window !== 'undefined') {
192 $scope = window;
193 } else {
194 $scope = {};
195 }
196 conflict = $scope.DeepDiff;
197 if (conflict) {
198 conflictResolution.push(
199 function() {
200 if ('undefined' !== typeof conflict && $scope.DeepDiff === accumulateDiff) {
201 $scope.DeepDiff = conflict;
202 conflict = undefined;
203 }
204 });
205 }
206
207 // nodejs compatible on server side and in the browser.
208 function inherits(ctor, superCtor) {
209 ctor.super_ = superCtor;
210 ctor.prototype = Object.create(superCtor.prototype, {
211 constructor: {
212 value: ctor,
213 enumerable: false,
214 writable: true,
215 configurable: true
216 }
217 });
218 }
219
220 function Diff(kind, path) {
221 Object.defineProperty(this, 'kind', {
222 value: kind,
223 enumerable: true
224 });
225 if (path && path.length) {
226 Object.defineProperty(this, 'path', {
227 value: path,
228 enumerable: true
229 });
230 }
231 }
232
233 function DiffEdit(path, origin, value) {
234 DiffEdit.super_.call(this, 'E', path);
235 Object.defineProperty(this, 'lhs', {
236 value: origin,
237 enumerable: true
238 });
239 Object.defineProperty(this, 'rhs', {
240 value: value,
241 enumerable: true
242 });
243 }
244 inherits(DiffEdit, Diff);
245
246 function DiffNew(path, value) {
247 DiffNew.super_.call(this, 'N', path);
248 Object.defineProperty(this, 'rhs', {
249 value: value,
250 enumerable: true
251 });
252 }
253 inherits(DiffNew, Diff);
254
255 function DiffDeleted(path, value) {
256 DiffDeleted.super_.call(this, 'D', path);
257 Object.defineProperty(this, 'lhs', {
258 value: value,
259 enumerable: true
260 });
261 }
262 inherits(DiffDeleted, Diff);
263
264 function DiffArray(path, index, item) {
265 DiffArray.super_.call(this, 'A', path);
266 Object.defineProperty(this, 'index', {
267 value: index,
268 enumerable: true
269 });
270 Object.defineProperty(this, 'item', {
271 value: item,
272 enumerable: true
273 });
274 }
275 inherits(DiffArray, Diff);
276
277 function arrayRemove(arr, from, to) {
278 var rest = arr.slice((to || from) + 1 || arr.length);
279 arr.length = from < 0 ? arr.length + from : from;
280 arr.push.apply(arr, rest);
281 return arr;
282 }
283
284 function realTypeOf(subject) {
285 var type = typeof subject;
286 if (type !== 'object') {
287 return type;
288 }
289
290 if (subject === Math) {
291 return 'math';
292 } else if (subject === null) {
293 return 'null';
294 } else if (Array.isArray(subject)) {
295 return 'array';
296 } else if (Object.prototype.toString.call(subject) === '[object Date]') {
297 return 'date';
298 } else if (typeof subject.toString !== 'undefined' && /^\/.*\//.test(subject.toString())) {
299 return 'regexp';
300 }
301 return 'object';
302 }
303
304 function deepDiff(lhs, rhs, changes, prefilter, path, key, stack) {
305 path = path || [];
306 var currentPath = path.slice(0);
307 if (typeof key !== 'undefined') {
308 if (prefilter) {
309 if (typeof(prefilter) === 'function' && prefilter(currentPath, key)) { return; }
310 else if (typeof(prefilter) === 'object') {
311 if (prefilter.prefilter && prefilter.prefilter(currentPath, key)) { return; }
312 if (prefilter.normalize) {
313 var alt = prefilter.normalize(currentPath, key, lhs, rhs);
314 if (alt) {
315 lhs = alt[0];
316 rhs = alt[1];
317 }
318 }
319 }
320 }
321 currentPath.push(key);
322 }
323
324 // Use string comparison for regexes
325 if (realTypeOf(lhs) === 'regexp' && realTypeOf(rhs) === 'regexp') {
326 lhs = lhs.toString();
327 rhs = rhs.toString();
328 }
329
330 var ltype = typeof lhs;
331 var rtype = typeof rhs;
332 if (ltype === 'undefined') {
333 if (rtype !== 'undefined') {
334 changes(new DiffNew(currentPath, rhs));
335 }
336 } else if (rtype === 'undefined') {
337 changes(new DiffDeleted(currentPath, lhs));
338 } else if (realTypeOf(lhs) !== realTypeOf(rhs)) {
339 changes(new DiffEdit(currentPath, lhs, rhs));
340 } else if (Object.prototype.toString.call(lhs) === '[object Date]' && Object.prototype.toString.call(rhs) === '[object Date]' && ((lhs - rhs) !== 0)) {
341 changes(new DiffEdit(currentPath, lhs, rhs));
342 } else if (ltype === 'object' && lhs !== null && rhs !== null) {
343 stack = stack || [];
344 if (stack.indexOf(lhs) < 0) {
345 stack.push(lhs);
346 if (Array.isArray(lhs)) {
347 var i, len = lhs.length;
348 for (i = 0; i < lhs.length; i++) {
349 if (i >= rhs.length) {
350 changes(new DiffArray(currentPath, i, new DiffDeleted(undefined, lhs[i])));
351 } else {
352 deepDiff(lhs[i], rhs[i], changes, prefilter, currentPath, i, stack);
353 }
354 }
355 while (i < rhs.length) {
356 changes(new DiffArray(currentPath, i, new DiffNew(undefined, rhs[i++])));
357 }
358 } else {
359 var akeys = Object.keys(lhs);
360 var pkeys = Object.keys(rhs);
361 akeys.forEach(function(k, i) {
362 var other = pkeys.indexOf(k);
363 if (other >= 0) {
364 deepDiff(lhs[k], rhs[k], changes, prefilter, currentPath, k, stack);
365 pkeys = arrayRemove(pkeys, other);
366 } else {
367 deepDiff(lhs[k], undefined, changes, prefilter, currentPath, k, stack);
368 }
369 });
370 pkeys.forEach(function(k) {
371 deepDiff(undefined, rhs[k], changes, prefilter, currentPath, k, stack);
372 });
373 }
374 stack.length = stack.length - 1;
375 }
376 } else if (lhs !== rhs) {
377 if (!(ltype === 'number' && isNaN(lhs) && isNaN(rhs))) {
378 changes(new DiffEdit(currentPath, lhs, rhs));
379 }
380 }
381 }
382
383 function accumulateDiff(lhs, rhs, prefilter, accum) {
384 accum = accum || [];
385 deepDiff(lhs, rhs,
386 function(diff) {
387 if (diff) {
388 accum.push(diff);
389 }
390 },
391 prefilter);
392 return (accum.length) ? accum : undefined;
393 }
394
395 function applyArrayChange(arr, index, change) {
396 if (change.path && change.path.length) {
397 var it = arr[index],
398 i, u = change.path.length - 1;
399 for (i = 0; i < u; i++) {
400 it = it[change.path[i]];
401 }
402 switch (change.kind) {
403 case 'A':
404 applyArrayChange(it[change.path[i]], change.index, change.item);
405 break;
406 case 'D':
407 delete it[change.path[i]];
408 break;
409 case 'E':
410 case 'N':
411 it[change.path[i]] = change.rhs;
412 break;
413 }
414 } else {
415 switch (change.kind) {
416 case 'A':
417 applyArrayChange(arr[index], change.index, change.item);
418 break;
419 case 'D':
420 arr = arrayRemove(arr, index);
421 break;
422 case 'E':
423 case 'N':
424 arr[index] = change.rhs;
425 break;
426 }
427 }
428 return arr;
429 }
430
431 function applyChange(target, source, change) {
432 if (target && source && change && change.kind) {
433 var it = target,
434 i = -1,
435 last = change.path ? change.path.length - 1 : 0;
436 while (++i < last) {
437 if (typeof it[change.path[i]] === 'undefined') {
438 it[change.path[i]] = (typeof change.path[i] === 'number') ? [] : {};
439 }
440 it = it[change.path[i]];
441 }
442 switch (change.kind) {
443 case 'A':
444 applyArrayChange(change.path ? it[change.path[i]] : it, change.index, change.item);
445 break;
446 case 'D':
447 delete it[change.path[i]];
448 break;
449 case 'E':
450 case 'N':
451 it[change.path[i]] = change.rhs;
452 break;
453 }
454 }
455 }
456
457 function revertArrayChange(arr, index, change) {
458 if (change.path && change.path.length) {
459 // the structure of the object at the index has changed...
460 var it = arr[index],
461 i, u = change.path.length - 1;
462 for (i = 0; i < u; i++) {
463 it = it[change.path[i]];
464 }
465 switch (change.kind) {
466 case 'A':
467 revertArrayChange(it[change.path[i]], change.index, change.item);
468 break;
469 case 'D':
470 it[change.path[i]] = change.lhs;
471 break;
472 case 'E':
473 it[change.path[i]] = change.lhs;
474 break;
475 case 'N':
476 delete it[change.path[i]];
477 break;
478 }
479 } else {
480 // the array item is different...
481 switch (change.kind) {
482 case 'A':
483 revertArrayChange(arr[index], change.index, change.item);
484 break;
485 case 'D':
486 arr[index] = change.lhs;
487 break;
488 case 'E':
489 arr[index] = change.lhs;
490 break;
491 case 'N':
492 arr = arrayRemove(arr, index);
493 break;
494 }
495 }
496 return arr;
497 }
498
499 function revertChange(target, source, change) {
500 if (target && source && change && change.kind) {
501 var it = target,
502 i, u;
503 u = change.path.length - 1;
504 for (i = 0; i < u; i++) {
505 if (typeof it[change.path[i]] === 'undefined') {
506 it[change.path[i]] = {};
507 }
508 it = it[change.path[i]];
509 }
510 switch (change.kind) {
511 case 'A':
512 // Array was modified...
513 // it will be an array...
514 revertArrayChange(it[change.path[i]], change.index, change.item);
515 break;
516 case 'D':
517 // Item was deleted...
518 it[change.path[i]] = change.lhs;
519 break;
520 case 'E':
521 // Item was edited...
522 it[change.path[i]] = change.lhs;
523 break;
524 case 'N':
525 // Item is new...
526 delete it[change.path[i]];
527 break;
528 }
529 }
530 }
531
532 function applyDiff(target, source, filter) {
533 if (target && source) {
534 var onChange = function(change) {
535 if (!filter || filter(target, source, change)) {
536 applyChange(target, source, change);
537 }
538 };
539 deepDiff(target, source, onChange);
540 }
541 }
542
543 Object.defineProperties(accumulateDiff, {
544
545 diff: {
546 value: accumulateDiff,
547 enumerable: true
548 },
549 observableDiff: {
550 value: deepDiff,
551 enumerable: true
552 },
553 applyDiff: {
554 value: applyDiff,
555 enumerable: true
556 },
557 applyChange: {
558 value: applyChange,
559 enumerable: true
560 },
561 revertChange: {
562 value: revertChange,
563 enumerable: true
564 },
565 isConflict: {
566 value: function() {
567 return 'undefined' !== typeof conflict;
568 },
569 enumerable: true
570 },
571 noConflict: {
572 value: function() {
573 if (conflictResolution) {
574 conflictResolution.forEach(function(it) {
575 it();
576 });
577 conflictResolution = null;
578 }
579 return accumulateDiff;
580 },
581 enumerable: true
582 }
583 });
584
585 return accumulateDiff;
586}));
587
588}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
589
590},{}],9:[function(require,module,exports){
591'use strict';
592
593/**
594 * Copyright 2015, Yahoo! Inc.
595 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
596 */
597var ReactIs = require('react-is');
598var REACT_STATICS = {
599 childContextTypes: true,
600 contextType: true,
601 contextTypes: true,
602 defaultProps: true,
603 displayName: true,
604 getDefaultProps: true,
605 getDerivedStateFromError: true,
606 getDerivedStateFromProps: true,
607 mixins: true,
608 propTypes: true,
609 type: true
610};
611
612var KNOWN_STATICS = {
613 name: true,
614 length: true,
615 prototype: true,
616 caller: true,
617 callee: true,
618 arguments: true,
619 arity: true
620};
621
622var FORWARD_REF_STATICS = {
623 '$$typeof': true,
624 render: true,
625 defaultProps: true,
626 displayName: true,
627 propTypes: true
628};
629
630var MEMO_STATICS = {
631 '$$typeof': true,
632 compare: true,
633 defaultProps: true,
634 displayName: true,
635 propTypes: true,
636 type: true
637};
638
639var TYPE_STATICS = {};
640TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS;
641
642function getStatics(component) {
643 if (ReactIs.isMemo(component)) {
644 return MEMO_STATICS;
645 }
646 return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
647}
648
649var defineProperty = Object.defineProperty;
650var getOwnPropertyNames = Object.getOwnPropertyNames;
651var getOwnPropertySymbols = Object.getOwnPropertySymbols;
652var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
653var getPrototypeOf = Object.getPrototypeOf;
654var objectPrototype = Object.prototype;
655
656function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
657 if (typeof sourceComponent !== 'string') {
658 // don't hoist over string (html) components
659
660 if (objectPrototype) {
661 var inheritedComponent = getPrototypeOf(sourceComponent);
662 if (inheritedComponent && inheritedComponent !== objectPrototype) {
663 hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
664 }
665 }
666
667 var keys = getOwnPropertyNames(sourceComponent);
668
669 if (getOwnPropertySymbols) {
670 keys = keys.concat(getOwnPropertySymbols(sourceComponent));
671 }
672
673 var targetStatics = getStatics(targetComponent);
674 var sourceStatics = getStatics(sourceComponent);
675
676 for (var i = 0; i < keys.length; ++i) {
677 var key = keys[i];
678 if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
679 var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
680 try {
681 // Avoid failures from read-only properties
682 defineProperty(targetComponent, key, descriptor);
683 } catch (e) {}
684 }
685 }
686
687 return targetComponent;
688 }
689
690 return targetComponent;
691}
692
693module.exports = hoistNonReactStatics;
694
695},{"react-is":33}],10:[function(require,module,exports){
696function merge(a, b) {
697 var r = {};
698 for (var i=0;i<a.length;++i) {
699 r[a[i]] = b[i];
700 }
701 return r;
702}
703
704function Houkou(pattern, cfg) {
705 if (!(this instanceof Houkou)) {
706 return new Houkou(pattern, cfg);
707 }
708
709 var self = this;
710
711 this.cfg = cfg || {};
712 this.cfg.requirements || (this.cfg.requirements = {});
713 this.cfg.defaults || (this.cfg.defaults = {});
714 this.cfg.paramChar || (this.cfg.paramChar = ':');
715
716 var paramRegx = new RegExp(this.cfg.paramChar + '([a-z_]+)', 'gi');
717
718 this.parameters = (pattern.match(paramRegx) || []).map(function(p) { return p.substr(1); });
719 this.pattern = new RegExp(("^" + pattern.replace(/\//g, "\\/").replace(/\./g, "\\.").replace(paramRegx, function(m,t) { return "(" + (self.cfg.requirements[t] || ".+?") + ")"; }) + "$"));
720 this.build = new Function("v", 'return !this.validate(v) ? false : "' + pattern.replace(paramRegx, '" + ((typeof v["$1"] !== "undefined" && v["$1"] !== null) ? v["$1"] : this.cfg.defaults["$1"]) + "') + '";');
721}
722
723Houkou.prototype.validate = function(params) {
724 for (var param in params) {
725 if (!params.hasOwnProperty(param) || !this.cfg.requirements[param]) {
726 continue;
727 }
728 if (!RegExp(this.cfg.requirements[param]).test(params[param])) {
729 return false;
730 }
731 }
732 return true;
733};
734
735Houkou.prototype.match = function(url) {
736 var matches;
737
738 if (matches = this.pattern.exec(url)) {
739 matches.shift();
740 return merge(this.parameters, matches);
741 }
742
743 return false;
744};
745
746(typeof module === "object") && (module.exports = Houkou);
747
748},{}],11:[function(require,module,exports){
749/**
750 * Copyright (c) 2013-present, Facebook, Inc.
751 *
752 * This source code is licensed under the MIT license found in the
753 * LICENSE file in the root directory of this source tree.
754 */
755
756'use strict';
757
758/**
759 * Use invariant() to assert state which your program assumes to be true.
760 *
761 * Provide sprintf-style format (only %s is supported) and arguments
762 * to provide information about what broke and what you were
763 * expecting.
764 *
765 * The invariant message will be stripped in production, but the invariant
766 * will remain to ensure logic does not differ in production.
767 */
768
769var invariant = function(condition, format, a, b, c, d, e, f) {
770 if ("development" !== 'production') {
771 if (format === undefined) {
772 throw new Error('invariant requires an error message argument');
773 }
774 }
775
776 if (!condition) {
777 var error;
778 if (format === undefined) {
779 error = new Error(
780 'Minified exception occurred; use the non-minified dev environment ' +
781 'for the full error message and additional helpful warnings.'
782 );
783 } else {
784 var args = [a, b, c, d, e, f];
785 var argIndex = 0;
786 error = new Error(
787 format.replace(/%s/g, function() { return args[argIndex++]; })
788 );
789 error.name = 'Invariant Violation';
790 }
791
792 error.framesToPop = 1; // we don't care about invariant's own frame
793 throw error;
794 }
795};
796
797module.exports = invariant;
798
799},{}],12:[function(require,module,exports){
800var root = require('./_root');
801
802/** Built-in value references. */
803var Symbol = root.Symbol;
804
805module.exports = Symbol;
806
807},{"./_root":19}],13:[function(require,module,exports){
808var Symbol = require('./_Symbol'),
809 getRawTag = require('./_getRawTag'),
810 objectToString = require('./_objectToString');
811
812/** `Object#toString` result references. */
813var nullTag = '[object Null]',
814 undefinedTag = '[object Undefined]';
815
816/** Built-in value references. */
817var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
818
819/**
820 * The base implementation of `getTag` without fallbacks for buggy environments.
821 *
822 * @private
823 * @param {*} value The value to query.
824 * @returns {string} Returns the `toStringTag`.
825 */
826function baseGetTag(value) {
827 if (value == null) {
828 return value === undefined ? undefinedTag : nullTag;
829 }
830 return (symToStringTag && symToStringTag in Object(value))
831 ? getRawTag(value)
832 : objectToString(value);
833}
834
835module.exports = baseGetTag;
836
837},{"./_Symbol":12,"./_getRawTag":16,"./_objectToString":17}],14:[function(require,module,exports){
838(function (global){
839/** Detect free variable `global` from Node.js. */
840var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
841
842module.exports = freeGlobal;
843
844}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
845
846},{}],15:[function(require,module,exports){
847var overArg = require('./_overArg');
848
849/** Built-in value references. */
850var getPrototype = overArg(Object.getPrototypeOf, Object);
851
852module.exports = getPrototype;
853
854},{"./_overArg":18}],16:[function(require,module,exports){
855var Symbol = require('./_Symbol');
856
857/** Used for built-in method references. */
858var objectProto = Object.prototype;
859
860/** Used to check objects for own properties. */
861var hasOwnProperty = objectProto.hasOwnProperty;
862
863/**
864 * Used to resolve the
865 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
866 * of values.
867 */
868var nativeObjectToString = objectProto.toString;
869
870/** Built-in value references. */
871var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
872
873/**
874 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
875 *
876 * @private
877 * @param {*} value The value to query.
878 * @returns {string} Returns the raw `toStringTag`.
879 */
880function getRawTag(value) {
881 var isOwn = hasOwnProperty.call(value, symToStringTag),
882 tag = value[symToStringTag];
883
884 try {
885 value[symToStringTag] = undefined;
886 var unmasked = true;
887 } catch (e) {}
888
889 var result = nativeObjectToString.call(value);
890 if (unmasked) {
891 if (isOwn) {
892 value[symToStringTag] = tag;
893 } else {
894 delete value[symToStringTag];
895 }
896 }
897 return result;
898}
899
900module.exports = getRawTag;
901
902},{"./_Symbol":12}],17:[function(require,module,exports){
903/** Used for built-in method references. */
904var objectProto = Object.prototype;
905
906/**
907 * Used to resolve the
908 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
909 * of values.
910 */
911var nativeObjectToString = objectProto.toString;
912
913/**
914 * Converts `value` to a string using `Object.prototype.toString`.
915 *
916 * @private
917 * @param {*} value The value to convert.
918 * @returns {string} Returns the converted string.
919 */
920function objectToString(value) {
921 return nativeObjectToString.call(value);
922}
923
924module.exports = objectToString;
925
926},{}],18:[function(require,module,exports){
927/**
928 * Creates a unary function that invokes `func` with its argument transformed.
929 *
930 * @private
931 * @param {Function} func The function to wrap.
932 * @param {Function} transform The argument transform.
933 * @returns {Function} Returns the new function.
934 */
935function overArg(func, transform) {
936 return function(arg) {
937 return func(transform(arg));
938 };
939}
940
941module.exports = overArg;
942
943},{}],19:[function(require,module,exports){
944var freeGlobal = require('./_freeGlobal');
945
946/** Detect free variable `self`. */
947var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
948
949/** Used as a reference to the global object. */
950var root = freeGlobal || freeSelf || Function('return this')();
951
952module.exports = root;
953
954},{"./_freeGlobal":14}],20:[function(require,module,exports){
955/**
956 * Checks if `value` is object-like. A value is object-like if it's not `null`
957 * and has a `typeof` result of "object".
958 *
959 * @static
960 * @memberOf _
961 * @since 4.0.0
962 * @category Lang
963 * @param {*} value The value to check.
964 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
965 * @example
966 *
967 * _.isObjectLike({});
968 * // => true
969 *
970 * _.isObjectLike([1, 2, 3]);
971 * // => true
972 *
973 * _.isObjectLike(_.noop);
974 * // => false
975 *
976 * _.isObjectLike(null);
977 * // => false
978 */
979function isObjectLike(value) {
980 return value != null && typeof value == 'object';
981}
982
983module.exports = isObjectLike;
984
985},{}],21:[function(require,module,exports){
986var baseGetTag = require('./_baseGetTag'),
987 getPrototype = require('./_getPrototype'),
988 isObjectLike = require('./isObjectLike');
989
990/** `Object#toString` result references. */
991var objectTag = '[object Object]';
992
993/** Used for built-in method references. */
994var funcProto = Function.prototype,
995 objectProto = Object.prototype;
996
997/** Used to resolve the decompiled source of functions. */
998var funcToString = funcProto.toString;
999
1000/** Used to check objects for own properties. */
1001var hasOwnProperty = objectProto.hasOwnProperty;
1002
1003/** Used to infer the `Object` constructor. */
1004var objectCtorString = funcToString.call(Object);
1005
1006/**
1007 * Checks if `value` is a plain object, that is, an object created by the
1008 * `Object` constructor or one with a `[[Prototype]]` of `null`.
1009 *
1010 * @static
1011 * @memberOf _
1012 * @since 0.8.0
1013 * @category Lang
1014 * @param {*} value The value to check.
1015 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
1016 * @example
1017 *
1018 * function Foo() {
1019 * this.a = 1;
1020 * }
1021 *
1022 * _.isPlainObject(new Foo);
1023 * // => false
1024 *
1025 * _.isPlainObject([1, 2, 3]);
1026 * // => false
1027 *
1028 * _.isPlainObject({ 'x': 0, 'y': 0 });
1029 * // => true
1030 *
1031 * _.isPlainObject(Object.create(null));
1032 * // => true
1033 */
1034function isPlainObject(value) {
1035 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
1036 return false;
1037 }
1038 var proto = getPrototype(value);
1039 if (proto === null) {
1040 return true;
1041 }
1042 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
1043 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
1044 funcToString.call(Ctor) == objectCtorString;
1045}
1046
1047module.exports = isPlainObject;
1048
1049},{"./_baseGetTag":13,"./_getPrototype":15,"./isObjectLike":20}],22:[function(require,module,exports){
1050'use strict';
1051
1052var id = 1;
1053
1054function index () {
1055 return "" + id++;
1056}
1057
1058module.exports = index;
1059},{}],23:[function(require,module,exports){
1060/*
1061object-assign
1062(c) Sindre Sorhus
1063@license MIT
1064*/
1065
1066'use strict';
1067/* eslint-disable no-unused-vars */
1068var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1069var hasOwnProperty = Object.prototype.hasOwnProperty;
1070var propIsEnumerable = Object.prototype.propertyIsEnumerable;
1071
1072function toObject(val) {
1073 if (val === null || val === undefined) {
1074 throw new TypeError('Object.assign cannot be called with null or undefined');
1075 }
1076
1077 return Object(val);
1078}
1079
1080function shouldUseNative() {
1081 try {
1082 if (!Object.assign) {
1083 return false;
1084 }
1085
1086 // Detect buggy property enumeration order in older V8 versions.
1087
1088 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
1089 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
1090 test1[5] = 'de';
1091 if (Object.getOwnPropertyNames(test1)[0] === '5') {
1092 return false;
1093 }
1094
1095 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1096 var test2 = {};
1097 for (var i = 0; i < 10; i++) {
1098 test2['_' + String.fromCharCode(i)] = i;
1099 }
1100 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
1101 return test2[n];
1102 });
1103 if (order2.join('') !== '0123456789') {
1104 return false;
1105 }
1106
1107 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1108 var test3 = {};
1109 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
1110 test3[letter] = letter;
1111 });
1112 if (Object.keys(Object.assign({}, test3)).join('') !==
1113 'abcdefghijklmnopqrst') {
1114 return false;
1115 }
1116
1117 return true;
1118 } catch (err) {
1119 // We don't expect any of the above to throw, but better to be safe.
1120 return false;
1121 }
1122}
1123
1124module.exports = shouldUseNative() ? Object.assign : function (target, source) {
1125 var from;
1126 var to = toObject(target);
1127 var symbols;
1128
1129 for (var s = 1; s < arguments.length; s++) {
1130 from = Object(arguments[s]);
1131
1132 for (var key in from) {
1133 if (hasOwnProperty.call(from, key)) {
1134 to[key] = from[key];
1135 }
1136 }
1137
1138 if (getOwnPropertySymbols) {
1139 symbols = getOwnPropertySymbols(from);
1140 for (var i = 0; i < symbols.length; i++) {
1141 if (propIsEnumerable.call(from, symbols[i])) {
1142 to[symbols[i]] = from[symbols[i]];
1143 }
1144 }
1145 }
1146 }
1147
1148 return to;
1149};
1150
1151},{}],24:[function(require,module,exports){
1152// shim for using process in browser
1153var process = module.exports = {};
1154
1155// cached from whatever global is present so that test runners that stub it
1156// don't break things. But we need to wrap it in a try catch in case it is
1157// wrapped in strict mode code which doesn't define any globals. It's inside a
1158// function because try/catches deoptimize in certain engines.
1159
1160var cachedSetTimeout;
1161var cachedClearTimeout;
1162
1163function defaultSetTimout() {
1164 throw new Error('setTimeout has not been defined');
1165}
1166function defaultClearTimeout () {
1167 throw new Error('clearTimeout has not been defined');
1168}
1169(function () {
1170 try {
1171 if (typeof setTimeout === 'function') {
1172 cachedSetTimeout = setTimeout;
1173 } else {
1174 cachedSetTimeout = defaultSetTimout;
1175 }
1176 } catch (e) {
1177 cachedSetTimeout = defaultSetTimout;
1178 }
1179 try {
1180 if (typeof clearTimeout === 'function') {
1181 cachedClearTimeout = clearTimeout;
1182 } else {
1183 cachedClearTimeout = defaultClearTimeout;
1184 }
1185 } catch (e) {
1186 cachedClearTimeout = defaultClearTimeout;
1187 }
1188} ())
1189function runTimeout(fun) {
1190 if (cachedSetTimeout === setTimeout) {
1191 //normal enviroments in sane situations
1192 return setTimeout(fun, 0);
1193 }
1194 // if setTimeout wasn't available but was latter defined
1195 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
1196 cachedSetTimeout = setTimeout;
1197 return setTimeout(fun, 0);
1198 }
1199 try {
1200 // when when somebody has screwed with setTimeout but no I.E. maddness
1201 return cachedSetTimeout(fun, 0);
1202 } catch(e){
1203 try {
1204 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1205 return cachedSetTimeout.call(null, fun, 0);
1206 } catch(e){
1207 // 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
1208 return cachedSetTimeout.call(this, fun, 0);
1209 }
1210 }
1211
1212
1213}
1214function runClearTimeout(marker) {
1215 if (cachedClearTimeout === clearTimeout) {
1216 //normal enviroments in sane situations
1217 return clearTimeout(marker);
1218 }
1219 // if clearTimeout wasn't available but was latter defined
1220 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
1221 cachedClearTimeout = clearTimeout;
1222 return clearTimeout(marker);
1223 }
1224 try {
1225 // when when somebody has screwed with setTimeout but no I.E. maddness
1226 return cachedClearTimeout(marker);
1227 } catch (e){
1228 try {
1229 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1230 return cachedClearTimeout.call(null, marker);
1231 } catch (e){
1232 // 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.
1233 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
1234 return cachedClearTimeout.call(this, marker);
1235 }
1236 }
1237
1238
1239
1240}
1241var queue = [];
1242var draining = false;
1243var currentQueue;
1244var queueIndex = -1;
1245
1246function cleanUpNextTick() {
1247 if (!draining || !currentQueue) {
1248 return;
1249 }
1250 draining = false;
1251 if (currentQueue.length) {
1252 queue = currentQueue.concat(queue);
1253 } else {
1254 queueIndex = -1;
1255 }
1256 if (queue.length) {
1257 drainQueue();
1258 }
1259}
1260
1261function drainQueue() {
1262 if (draining) {
1263 return;
1264 }
1265 var timeout = runTimeout(cleanUpNextTick);
1266 draining = true;
1267
1268 var len = queue.length;
1269 while(len) {
1270 currentQueue = queue;
1271 queue = [];
1272 while (++queueIndex < len) {
1273 if (currentQueue) {
1274 currentQueue[queueIndex].run();
1275 }
1276 }
1277 queueIndex = -1;
1278 len = queue.length;
1279 }
1280 currentQueue = null;
1281 draining = false;
1282 runClearTimeout(timeout);
1283}
1284
1285process.nextTick = function (fun) {
1286 var args = new Array(arguments.length - 1);
1287 if (arguments.length > 1) {
1288 for (var i = 1; i < arguments.length; i++) {
1289 args[i - 1] = arguments[i];
1290 }
1291 }
1292 queue.push(new Item(fun, args));
1293 if (queue.length === 1 && !draining) {
1294 runTimeout(drainQueue);
1295 }
1296};
1297
1298// v8 likes predictible objects
1299function Item(fun, array) {
1300 this.fun = fun;
1301 this.array = array;
1302}
1303Item.prototype.run = function () {
1304 this.fun.apply(null, this.array);
1305};
1306process.title = 'browser';
1307process.browser = true;
1308process.env = {};
1309process.argv = [];
1310process.version = ''; // empty string to avoid regexp issues
1311process.versions = {};
1312
1313function noop() {}
1314
1315process.on = noop;
1316process.addListener = noop;
1317process.once = noop;
1318process.off = noop;
1319process.removeListener = noop;
1320process.removeAllListeners = noop;
1321process.emit = noop;
1322process.prependListener = noop;
1323process.prependOnceListener = noop;
1324
1325process.listeners = function (name) { return [] }
1326
1327process.binding = function (name) {
1328 throw new Error('process.binding is not supported');
1329};
1330
1331process.cwd = function () { return '/' };
1332process.chdir = function (dir) {
1333 throw new Error('process.chdir is not supported');
1334};
1335process.umask = function() { return 0; };
1336
1337},{}],25:[function(require,module,exports){
1338/**
1339 * Copyright (c) 2013-present, Facebook, Inc.
1340 *
1341 * This source code is licensed under the MIT license found in the
1342 * LICENSE file in the root directory of this source tree.
1343 */
1344
1345'use strict';
1346
1347var printWarning = function() {};
1348
1349if ("development" !== 'production') {
1350 var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
1351 var loggedTypeFailures = {};
1352
1353 printWarning = function(text) {
1354 var message = 'Warning: ' + text;
1355 if (typeof console !== 'undefined') {
1356 console.error(message);
1357 }
1358 try {
1359 // --- Welcome to debugging React ---
1360 // This error was thrown as a convenience so that you can use this stack
1361 // to find the callsite that caused this warning to fire.
1362 throw new Error(message);
1363 } catch (x) {}
1364 };
1365}
1366
1367/**
1368 * Assert that the values match with the type specs.
1369 * Error messages are memorized and will only be shown once.
1370 *
1371 * @param {object} typeSpecs Map of name to a ReactPropType
1372 * @param {object} values Runtime values that need to be type-checked
1373 * @param {string} location e.g. "prop", "context", "child context"
1374 * @param {string} componentName Name of the component for error messages.
1375 * @param {?Function} getStack Returns the component stack.
1376 * @private
1377 */
1378function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1379 if ("development" !== 'production') {
1380 for (var typeSpecName in typeSpecs) {
1381 if (typeSpecs.hasOwnProperty(typeSpecName)) {
1382 var error;
1383 // Prop type validation may throw. In case they do, we don't want to
1384 // fail the render phase where it didn't fail before. So we log it.
1385 // After these have been cleaned up, we'll let them throw.
1386 try {
1387 // This is intentionally an invariant that gets caught. It's the same
1388 // behavior as without this statement except with a better message.
1389 if (typeof typeSpecs[typeSpecName] !== 'function') {
1390 var err = Error(
1391 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
1392 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
1393 );
1394 err.name = 'Invariant Violation';
1395 throw err;
1396 }
1397 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
1398 } catch (ex) {
1399 error = ex;
1400 }
1401 if (error && !(error instanceof Error)) {
1402 printWarning(
1403 (componentName || 'React class') + ': type specification of ' +
1404 location + ' `' + typeSpecName + '` is invalid; the type checker ' +
1405 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
1406 'You may have forgotten to pass an argument to the type checker ' +
1407 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
1408 'shape all require an argument).'
1409 )
1410
1411 }
1412 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
1413 // Only monitor this failure once because there tends to be a lot of the
1414 // same error.
1415 loggedTypeFailures[error.message] = true;
1416
1417 var stack = getStack ? getStack() : '';
1418
1419 printWarning(
1420 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
1421 );
1422 }
1423 }
1424 }
1425 }
1426}
1427
1428module.exports = checkPropTypes;
1429
1430},{"./lib/ReactPropTypesSecret":28}],26:[function(require,module,exports){
1431/**
1432 * Copyright (c) 2013-present, Facebook, Inc.
1433 *
1434 * This source code is licensed under the MIT license found in the
1435 * LICENSE file in the root directory of this source tree.
1436 */
1437
1438'use strict';
1439
1440var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
1441
1442function emptyFunction() {}
1443
1444module.exports = function() {
1445 function shim(props, propName, componentName, location, propFullName, secret) {
1446 if (secret === ReactPropTypesSecret) {
1447 // It is still safe when called from React.
1448 return;
1449 }
1450 var err = new Error(
1451 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1452 'Use PropTypes.checkPropTypes() to call them. ' +
1453 'Read more at http://fb.me/use-check-prop-types'
1454 );
1455 err.name = 'Invariant Violation';
1456 throw err;
1457 };
1458 shim.isRequired = shim;
1459 function getShim() {
1460 return shim;
1461 };
1462 // Important!
1463 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1464 var ReactPropTypes = {
1465 array: shim,
1466 bool: shim,
1467 func: shim,
1468 number: shim,
1469 object: shim,
1470 string: shim,
1471 symbol: shim,
1472
1473 any: shim,
1474 arrayOf: getShim,
1475 element: shim,
1476 instanceOf: getShim,
1477 node: shim,
1478 objectOf: getShim,
1479 oneOf: getShim,
1480 oneOfType: getShim,
1481 shape: getShim,
1482 exact: getShim
1483 };
1484
1485 ReactPropTypes.checkPropTypes = emptyFunction;
1486 ReactPropTypes.PropTypes = ReactPropTypes;
1487
1488 return ReactPropTypes;
1489};
1490
1491},{"./lib/ReactPropTypesSecret":28}],27:[function(require,module,exports){
1492/**
1493 * Copyright (c) 2013-present, Facebook, Inc.
1494 *
1495 * This source code is licensed under the MIT license found in the
1496 * LICENSE file in the root directory of this source tree.
1497 */
1498
1499'use strict';
1500
1501var assign = require('object-assign');
1502
1503var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
1504var checkPropTypes = require('./checkPropTypes');
1505
1506var printWarning = function() {};
1507
1508if ("development" !== 'production') {
1509 printWarning = function(text) {
1510 var message = 'Warning: ' + text;
1511 if (typeof console !== 'undefined') {
1512 console.error(message);
1513 }
1514 try {
1515 // --- Welcome to debugging React ---
1516 // This error was thrown as a convenience so that you can use this stack
1517 // to find the callsite that caused this warning to fire.
1518 throw new Error(message);
1519 } catch (x) {}
1520 };
1521}
1522
1523function emptyFunctionThatReturnsNull() {
1524 return null;
1525}
1526
1527module.exports = function(isValidElement, throwOnDirectAccess) {
1528 /* global Symbol */
1529 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
1530 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
1531
1532 /**
1533 * Returns the iterator method function contained on the iterable object.
1534 *
1535 * Be sure to invoke the function with the iterable as context:
1536 *
1537 * var iteratorFn = getIteratorFn(myIterable);
1538 * if (iteratorFn) {
1539 * var iterator = iteratorFn.call(myIterable);
1540 * ...
1541 * }
1542 *
1543 * @param {?object} maybeIterable
1544 * @return {?function}
1545 */
1546 function getIteratorFn(maybeIterable) {
1547 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
1548 if (typeof iteratorFn === 'function') {
1549 return iteratorFn;
1550 }
1551 }
1552
1553 /**
1554 * Collection of methods that allow declaration and validation of props that are
1555 * supplied to React components. Example usage:
1556 *
1557 * var Props = require('ReactPropTypes');
1558 * var MyArticle = React.createClass({
1559 * propTypes: {
1560 * // An optional string prop named "description".
1561 * description: Props.string,
1562 *
1563 * // A required enum prop named "category".
1564 * category: Props.oneOf(['News','Photos']).isRequired,
1565 *
1566 * // A prop named "dialog" that requires an instance of Dialog.
1567 * dialog: Props.instanceOf(Dialog).isRequired
1568 * },
1569 * render: function() { ... }
1570 * });
1571 *
1572 * A more formal specification of how these methods are used:
1573 *
1574 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
1575 * decl := ReactPropTypes.{type}(.isRequired)?
1576 *
1577 * Each and every declaration produces a function with the same signature. This
1578 * allows the creation of custom validation functions. For example:
1579 *
1580 * var MyLink = React.createClass({
1581 * propTypes: {
1582 * // An optional string or URI prop named "href".
1583 * href: function(props, propName, componentName) {
1584 * var propValue = props[propName];
1585 * if (propValue != null && typeof propValue !== 'string' &&
1586 * !(propValue instanceof URI)) {
1587 * return new Error(
1588 * 'Expected a string or an URI for ' + propName + ' in ' +
1589 * componentName
1590 * );
1591 * }
1592 * }
1593 * },
1594 * render: function() {...}
1595 * });
1596 *
1597 * @internal
1598 */
1599
1600 var ANONYMOUS = '<<anonymous>>';
1601
1602 // Important!
1603 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
1604 var ReactPropTypes = {
1605 array: createPrimitiveTypeChecker('array'),
1606 bool: createPrimitiveTypeChecker('boolean'),
1607 func: createPrimitiveTypeChecker('function'),
1608 number: createPrimitiveTypeChecker('number'),
1609 object: createPrimitiveTypeChecker('object'),
1610 string: createPrimitiveTypeChecker('string'),
1611 symbol: createPrimitiveTypeChecker('symbol'),
1612
1613 any: createAnyTypeChecker(),
1614 arrayOf: createArrayOfTypeChecker,
1615 element: createElementTypeChecker(),
1616 instanceOf: createInstanceTypeChecker,
1617 node: createNodeChecker(),
1618 objectOf: createObjectOfTypeChecker,
1619 oneOf: createEnumTypeChecker,
1620 oneOfType: createUnionTypeChecker,
1621 shape: createShapeTypeChecker,
1622 exact: createStrictShapeTypeChecker,
1623 };
1624
1625 /**
1626 * inlined Object.is polyfill to avoid requiring consumers ship their own
1627 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1628 */
1629 /*eslint-disable no-self-compare*/
1630 function is(x, y) {
1631 // SameValue algorithm
1632 if (x === y) {
1633 // Steps 1-5, 7-10
1634 // Steps 6.b-6.e: +0 != -0
1635 return x !== 0 || 1 / x === 1 / y;
1636 } else {
1637 // Step 6.a: NaN == NaN
1638 return x !== x && y !== y;
1639 }
1640 }
1641 /*eslint-enable no-self-compare*/
1642
1643 /**
1644 * We use an Error-like object for backward compatibility as people may call
1645 * PropTypes directly and inspect their output. However, we don't use real
1646 * Errors anymore. We don't inspect their stack anyway, and creating them
1647 * is prohibitively expensive if they are created too often, such as what
1648 * happens in oneOfType() for any type before the one that matched.
1649 */
1650 function PropTypeError(message) {
1651 this.message = message;
1652 this.stack = '';
1653 }
1654 // Make `instanceof Error` still work for returned errors.
1655 PropTypeError.prototype = Error.prototype;
1656
1657 function createChainableTypeChecker(validate) {
1658 if ("development" !== 'production') {
1659 var manualPropTypeCallCache = {};
1660 var manualPropTypeWarningCount = 0;
1661 }
1662 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
1663 componentName = componentName || ANONYMOUS;
1664 propFullName = propFullName || propName;
1665
1666 if (secret !== ReactPropTypesSecret) {
1667 if (throwOnDirectAccess) {
1668 // New behavior only for users of `prop-types` package
1669 var err = new Error(
1670 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1671 'Use `PropTypes.checkPropTypes()` to call them. ' +
1672 'Read more at http://fb.me/use-check-prop-types'
1673 );
1674 err.name = 'Invariant Violation';
1675 throw err;
1676 } else if ("development" !== 'production' && typeof console !== 'undefined') {
1677 // Old behavior for people using React.PropTypes
1678 var cacheKey = componentName + ':' + propName;
1679 if (
1680 !manualPropTypeCallCache[cacheKey] &&
1681 // Avoid spamming the console because they are often not actionable except for lib authors
1682 manualPropTypeWarningCount < 3
1683 ) {
1684 printWarning(
1685 'You are manually calling a React.PropTypes validation ' +
1686 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
1687 'and will throw in the standalone `prop-types` package. ' +
1688 'You may be seeing this warning due to a third-party PropTypes ' +
1689 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
1690 );
1691 manualPropTypeCallCache[cacheKey] = true;
1692 manualPropTypeWarningCount++;
1693 }
1694 }
1695 }
1696 if (props[propName] == null) {
1697 if (isRequired) {
1698 if (props[propName] === null) {
1699 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
1700 }
1701 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
1702 }
1703 return null;
1704 } else {
1705 return validate(props, propName, componentName, location, propFullName);
1706 }
1707 }
1708
1709 var chainedCheckType = checkType.bind(null, false);
1710 chainedCheckType.isRequired = checkType.bind(null, true);
1711
1712 return chainedCheckType;
1713 }
1714
1715 function createPrimitiveTypeChecker(expectedType) {
1716 function validate(props, propName, componentName, location, propFullName, secret) {
1717 var propValue = props[propName];
1718 var propType = getPropType(propValue);
1719 if (propType !== expectedType) {
1720 // `propValue` being instance of, say, date/regexp, pass the 'object'
1721 // check, but we can offer a more precise error message here rather than
1722 // 'of type `object`'.
1723 var preciseType = getPreciseType(propValue);
1724
1725 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
1726 }
1727 return null;
1728 }
1729 return createChainableTypeChecker(validate);
1730 }
1731
1732 function createAnyTypeChecker() {
1733 return createChainableTypeChecker(emptyFunctionThatReturnsNull);
1734 }
1735
1736 function createArrayOfTypeChecker(typeChecker) {
1737 function validate(props, propName, componentName, location, propFullName) {
1738 if (typeof typeChecker !== 'function') {
1739 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
1740 }
1741 var propValue = props[propName];
1742 if (!Array.isArray(propValue)) {
1743 var propType = getPropType(propValue);
1744 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
1745 }
1746 for (var i = 0; i < propValue.length; i++) {
1747 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
1748 if (error instanceof Error) {
1749 return error;
1750 }
1751 }
1752 return null;
1753 }
1754 return createChainableTypeChecker(validate);
1755 }
1756
1757 function createElementTypeChecker() {
1758 function validate(props, propName, componentName, location, propFullName) {
1759 var propValue = props[propName];
1760 if (!isValidElement(propValue)) {
1761 var propType = getPropType(propValue);
1762 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
1763 }
1764 return null;
1765 }
1766 return createChainableTypeChecker(validate);
1767 }
1768
1769 function createInstanceTypeChecker(expectedClass) {
1770 function validate(props, propName, componentName, location, propFullName) {
1771 if (!(props[propName] instanceof expectedClass)) {
1772 var expectedClassName = expectedClass.name || ANONYMOUS;
1773 var actualClassName = getClassName(props[propName]);
1774 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
1775 }
1776 return null;
1777 }
1778 return createChainableTypeChecker(validate);
1779 }
1780
1781 function createEnumTypeChecker(expectedValues) {
1782 if (!Array.isArray(expectedValues)) {
1783 "development" !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
1784 return emptyFunctionThatReturnsNull;
1785 }
1786
1787 function validate(props, propName, componentName, location, propFullName) {
1788 var propValue = props[propName];
1789 for (var i = 0; i < expectedValues.length; i++) {
1790 if (is(propValue, expectedValues[i])) {
1791 return null;
1792 }
1793 }
1794
1795 var valuesString = JSON.stringify(expectedValues);
1796 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
1797 }
1798 return createChainableTypeChecker(validate);
1799 }
1800
1801 function createObjectOfTypeChecker(typeChecker) {
1802 function validate(props, propName, componentName, location, propFullName) {
1803 if (typeof typeChecker !== 'function') {
1804 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
1805 }
1806 var propValue = props[propName];
1807 var propType = getPropType(propValue);
1808 if (propType !== 'object') {
1809 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
1810 }
1811 for (var key in propValue) {
1812 if (propValue.hasOwnProperty(key)) {
1813 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1814 if (error instanceof Error) {
1815 return error;
1816 }
1817 }
1818 }
1819 return null;
1820 }
1821 return createChainableTypeChecker(validate);
1822 }
1823
1824 function createUnionTypeChecker(arrayOfTypeCheckers) {
1825 if (!Array.isArray(arrayOfTypeCheckers)) {
1826 "development" !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
1827 return emptyFunctionThatReturnsNull;
1828 }
1829
1830 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1831 var checker = arrayOfTypeCheckers[i];
1832 if (typeof checker !== 'function') {
1833 printWarning(
1834 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
1835 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
1836 );
1837 return emptyFunctionThatReturnsNull;
1838 }
1839 }
1840
1841 function validate(props, propName, componentName, location, propFullName) {
1842 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1843 var checker = arrayOfTypeCheckers[i];
1844 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
1845 return null;
1846 }
1847 }
1848
1849 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
1850 }
1851 return createChainableTypeChecker(validate);
1852 }
1853
1854 function createNodeChecker() {
1855 function validate(props, propName, componentName, location, propFullName) {
1856 if (!isNode(props[propName])) {
1857 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1858 }
1859 return null;
1860 }
1861 return createChainableTypeChecker(validate);
1862 }
1863
1864 function createShapeTypeChecker(shapeTypes) {
1865 function validate(props, propName, componentName, location, propFullName) {
1866 var propValue = props[propName];
1867 var propType = getPropType(propValue);
1868 if (propType !== 'object') {
1869 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1870 }
1871 for (var key in shapeTypes) {
1872 var checker = shapeTypes[key];
1873 if (!checker) {
1874 continue;
1875 }
1876 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1877 if (error) {
1878 return error;
1879 }
1880 }
1881 return null;
1882 }
1883 return createChainableTypeChecker(validate);
1884 }
1885
1886 function createStrictShapeTypeChecker(shapeTypes) {
1887 function validate(props, propName, componentName, location, propFullName) {
1888 var propValue = props[propName];
1889 var propType = getPropType(propValue);
1890 if (propType !== 'object') {
1891 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1892 }
1893 // We need to check all keys in case some are required but missing from
1894 // props.
1895 var allKeys = assign({}, props[propName], shapeTypes);
1896 for (var key in allKeys) {
1897 var checker = shapeTypes[key];
1898 if (!checker) {
1899 return new PropTypeError(
1900 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
1901 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
1902 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
1903 );
1904 }
1905 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1906 if (error) {
1907 return error;
1908 }
1909 }
1910 return null;
1911 }
1912
1913 return createChainableTypeChecker(validate);
1914 }
1915
1916 function isNode(propValue) {
1917 switch (typeof propValue) {
1918 case 'number':
1919 case 'string':
1920 case 'undefined':
1921 return true;
1922 case 'boolean':
1923 return !propValue;
1924 case 'object':
1925 if (Array.isArray(propValue)) {
1926 return propValue.every(isNode);
1927 }
1928 if (propValue === null || isValidElement(propValue)) {
1929 return true;
1930 }
1931
1932 var iteratorFn = getIteratorFn(propValue);
1933 if (iteratorFn) {
1934 var iterator = iteratorFn.call(propValue);
1935 var step;
1936 if (iteratorFn !== propValue.entries) {
1937 while (!(step = iterator.next()).done) {
1938 if (!isNode(step.value)) {
1939 return false;
1940 }
1941 }
1942 } else {
1943 // Iterator will provide entry [k,v] tuples rather than values.
1944 while (!(step = iterator.next()).done) {
1945 var entry = step.value;
1946 if (entry) {
1947 if (!isNode(entry[1])) {
1948 return false;
1949 }
1950 }
1951 }
1952 }
1953 } else {
1954 return false;
1955 }
1956
1957 return true;
1958 default:
1959 return false;
1960 }
1961 }
1962
1963 function isSymbol(propType, propValue) {
1964 // Native Symbol.
1965 if (propType === 'symbol') {
1966 return true;
1967 }
1968
1969 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1970 if (propValue['@@toStringTag'] === 'Symbol') {
1971 return true;
1972 }
1973
1974 // Fallback for non-spec compliant Symbols which are polyfilled.
1975 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1976 return true;
1977 }
1978
1979 return false;
1980 }
1981
1982 // Equivalent of `typeof` but with special handling for array and regexp.
1983 function getPropType(propValue) {
1984 var propType = typeof propValue;
1985 if (Array.isArray(propValue)) {
1986 return 'array';
1987 }
1988 if (propValue instanceof RegExp) {
1989 // Old webkits (at least until Android 4.0) return 'function' rather than
1990 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1991 // passes PropTypes.object.
1992 return 'object';
1993 }
1994 if (isSymbol(propType, propValue)) {
1995 return 'symbol';
1996 }
1997 return propType;
1998 }
1999
2000 // This handles more types than `getPropType`. Only used for error messages.
2001 // See `createPrimitiveTypeChecker`.
2002 function getPreciseType(propValue) {
2003 if (typeof propValue === 'undefined' || propValue === null) {
2004 return '' + propValue;
2005 }
2006 var propType = getPropType(propValue);
2007 if (propType === 'object') {
2008 if (propValue instanceof Date) {
2009 return 'date';
2010 } else if (propValue instanceof RegExp) {
2011 return 'regexp';
2012 }
2013 }
2014 return propType;
2015 }
2016
2017 // Returns a string that is postfixed to a warning about an invalid type.
2018 // For example, "undefined" or "of type array"
2019 function getPostfixForTypeWarning(value) {
2020 var type = getPreciseType(value);
2021 switch (type) {
2022 case 'array':
2023 case 'object':
2024 return 'an ' + type;
2025 case 'boolean':
2026 case 'date':
2027 case 'regexp':
2028 return 'a ' + type;
2029 default:
2030 return type;
2031 }
2032 }
2033
2034 // Returns class name of the object, if any.
2035 function getClassName(propValue) {
2036 if (!propValue.constructor || !propValue.constructor.name) {
2037 return ANONYMOUS;
2038 }
2039 return propValue.constructor.name;
2040 }
2041
2042 ReactPropTypes.checkPropTypes = checkPropTypes;
2043 ReactPropTypes.PropTypes = ReactPropTypes;
2044
2045 return ReactPropTypes;
2046};
2047
2048},{"./checkPropTypes":25,"./lib/ReactPropTypesSecret":28,"object-assign":23}],28:[function(require,module,exports){
2049/**
2050 * Copyright (c) 2013-present, Facebook, Inc.
2051 *
2052 * This source code is licensed under the MIT license found in the
2053 * LICENSE file in the root directory of this source tree.
2054 */
2055
2056'use strict';
2057
2058var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2059
2060module.exports = ReactPropTypesSecret;
2061
2062},{}],29:[function(require,module,exports){
2063/** @license React v16.7.0
2064 * react-dom.development.js
2065 *
2066 * Copyright (c) Facebook, Inc. and its affiliates.
2067 *
2068 * This source code is licensed under the MIT license found in the
2069 * LICENSE file in the root directory of this source tree.
2070 */
2071
2072'use strict';
2073
2074
2075
2076if ("development" !== "production") {
2077 (function() {
2078'use strict';
2079
2080var React = require('react');
2081var _assign = require('object-assign');
2082var checkPropTypes = require('prop-types/checkPropTypes');
2083var scheduler = require('scheduler');
2084var tracing = require('scheduler/tracing');
2085
2086/**
2087 * Use invariant() to assert state which your program assumes to be true.
2088 *
2089 * Provide sprintf-style format (only %s is supported) and arguments
2090 * to provide information about what broke and what you were
2091 * expecting.
2092 *
2093 * The invariant message will be stripped in production, but the invariant
2094 * will remain to ensure logic does not differ in production.
2095 */
2096
2097var validateFormat = function () {};
2098
2099{
2100 validateFormat = function (format) {
2101 if (format === undefined) {
2102 throw new Error('invariant requires an error message argument');
2103 }
2104 };
2105}
2106
2107function invariant(condition, format, a, b, c, d, e, f) {
2108 validateFormat(format);
2109
2110 if (!condition) {
2111 var error = void 0;
2112 if (format === undefined) {
2113 error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
2114 } else {
2115 var args = [a, b, c, d, e, f];
2116 var argIndex = 0;
2117 error = new Error(format.replace(/%s/g, function () {
2118 return args[argIndex++];
2119 }));
2120 error.name = 'Invariant Violation';
2121 }
2122
2123 error.framesToPop = 1; // we don't care about invariant's own frame
2124 throw error;
2125 }
2126}
2127
2128// Relying on the `invariant()` implementation lets us
2129// preserve the format and params in the www builds.
2130
2131!React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
2132
2133var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
2134 var funcArgs = Array.prototype.slice.call(arguments, 3);
2135 try {
2136 func.apply(context, funcArgs);
2137 } catch (error) {
2138 this.onError(error);
2139 }
2140};
2141
2142{
2143 // In DEV mode, we swap out invokeGuardedCallback for a special version
2144 // that plays more nicely with the browser's DevTools. The idea is to preserve
2145 // "Pause on exceptions" behavior. Because React wraps all user-provided
2146 // functions in invokeGuardedCallback, and the production version of
2147 // invokeGuardedCallback uses a try-catch, all user exceptions are treated
2148 // like caught exceptions, and the DevTools won't pause unless the developer
2149 // takes the extra step of enabling pause on caught exceptions. This is
2150 // untintuitive, though, because even though React has caught the error, from
2151 // the developer's perspective, the error is uncaught.
2152 //
2153 // To preserve the expected "Pause on exceptions" behavior, we don't use a
2154 // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
2155 // DOM node, and call the user-provided callback from inside an event handler
2156 // for that fake event. If the callback throws, the error is "captured" using
2157 // a global event handler. But because the error happens in a different
2158 // event loop context, it does not interrupt the normal program flow.
2159 // Effectively, this gives us try-catch behavior without actually using
2160 // try-catch. Neat!
2161
2162 // Check that the browser supports the APIs we need to implement our special
2163 // DEV version of invokeGuardedCallback
2164 if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
2165 var fakeNode = document.createElement('react');
2166
2167 var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
2168 // If document doesn't exist we know for sure we will crash in this method
2169 // when we call document.createEvent(). However this can cause confusing
2170 // errors: https://github.com/facebookincubator/create-react-app/issues/3482
2171 // So we preemptively throw with a better message instead.
2172 !(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;
2173 var evt = document.createEvent('Event');
2174
2175 // Keeps track of whether the user-provided callback threw an error. We
2176 // set this to true at the beginning, then set it to false right after
2177 // calling the function. If the function errors, `didError` will never be
2178 // set to false. This strategy works even if the browser is flaky and
2179 // fails to call our global error handler, because it doesn't rely on
2180 // the error event at all.
2181 var didError = true;
2182
2183 // Keeps track of the value of window.event so that we can reset it
2184 // during the callback to let user code access window.event in the
2185 // browsers that support it.
2186 var windowEvent = window.event;
2187
2188 // Keeps track of the descriptor of window.event to restore it after event
2189 // dispatching: https://github.com/facebook/react/issues/13688
2190 var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
2191
2192 // Create an event handler for our fake event. We will synchronously
2193 // dispatch our fake event using `dispatchEvent`. Inside the handler, we
2194 // call the user-provided callback.
2195 var funcArgs = Array.prototype.slice.call(arguments, 3);
2196 function callCallback() {
2197 // We immediately remove the callback from event listeners so that
2198 // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
2199 // nested call would trigger the fake event handlers of any call higher
2200 // in the stack.
2201 fakeNode.removeEventListener(evtType, callCallback, false);
2202
2203 // We check for window.hasOwnProperty('event') to prevent the
2204 // window.event assignment in both IE <= 10 as they throw an error
2205 // "Member not found" in strict mode, and in Firefox which does not
2206 // support window.event.
2207 if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
2208 window.event = windowEvent;
2209 }
2210
2211 func.apply(context, funcArgs);
2212 didError = false;
2213 }
2214
2215 // Create a global error event handler. We use this to capture the value
2216 // that was thrown. It's possible that this error handler will fire more
2217 // than once; for example, if non-React code also calls `dispatchEvent`
2218 // and a handler for that event throws. We should be resilient to most of
2219 // those cases. Even if our error event handler fires more than once, the
2220 // last error event is always used. If the callback actually does error,
2221 // we know that the last error event is the correct one, because it's not
2222 // possible for anything else to have happened in between our callback
2223 // erroring and the code that follows the `dispatchEvent` call below. If
2224 // the callback doesn't error, but the error event was fired, we know to
2225 // ignore it because `didError` will be false, as described above.
2226 var error = void 0;
2227 // Use this to track whether the error event is ever called.
2228 var didSetError = false;
2229 var isCrossOriginError = false;
2230
2231 function handleWindowError(event) {
2232 error = event.error;
2233 didSetError = true;
2234 if (error === null && event.colno === 0 && event.lineno === 0) {
2235 isCrossOriginError = true;
2236 }
2237 if (event.defaultPrevented) {
2238 // Some other error handler has prevented default.
2239 // Browsers silence the error report if this happens.
2240 // We'll remember this to later decide whether to log it or not.
2241 if (error != null && typeof error === 'object') {
2242 try {
2243 error._suppressLogging = true;
2244 } catch (inner) {
2245 // Ignore.
2246 }
2247 }
2248 }
2249 }
2250
2251 // Create a fake event type.
2252 var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
2253
2254 // Attach our event handlers
2255 window.addEventListener('error', handleWindowError);
2256 fakeNode.addEventListener(evtType, callCallback, false);
2257
2258 // Synchronously dispatch our fake event. If the user-provided function
2259 // errors, it will trigger our global error handler.
2260 evt.initEvent(evtType, false, false);
2261 fakeNode.dispatchEvent(evt);
2262
2263 if (windowEventDescriptor) {
2264 Object.defineProperty(window, 'event', windowEventDescriptor);
2265 }
2266
2267 if (didError) {
2268 if (!didSetError) {
2269 // The callback errored, but the error event never fired.
2270 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.');
2271 } else if (isCrossOriginError) {
2272 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.');
2273 }
2274 this.onError(error);
2275 }
2276
2277 // Remove our event listeners
2278 window.removeEventListener('error', handleWindowError);
2279 };
2280
2281 invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
2282 }
2283}
2284
2285var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
2286
2287// Used by Fiber to simulate a try-catch.
2288var hasError = false;
2289var caughtError = null;
2290
2291// Used by event system to capture/rethrow the first error.
2292var hasRethrowError = false;
2293var rethrowError = null;
2294
2295var reporter = {
2296 onError: function (error) {
2297 hasError = true;
2298 caughtError = error;
2299 }
2300};
2301
2302/**
2303 * Call a function while guarding against errors that happens within it.
2304 * Returns an error if it throws, otherwise null.
2305 *
2306 * In production, this is implemented using a try-catch. The reason we don't
2307 * use a try-catch directly is so that we can swap out a different
2308 * implementation in DEV mode.
2309 *
2310 * @param {String} name of the guard to use for logging or debugging
2311 * @param {Function} func The function to invoke
2312 * @param {*} context The context to use when calling the function
2313 * @param {...*} args Arguments for function
2314 */
2315function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
2316 hasError = false;
2317 caughtError = null;
2318 invokeGuardedCallbackImpl$1.apply(reporter, arguments);
2319}
2320
2321/**
2322 * Same as invokeGuardedCallback, but instead of returning an error, it stores
2323 * it in a global so it can be rethrown by `rethrowCaughtError` later.
2324 * TODO: See if caughtError and rethrowError can be unified.
2325 *
2326 * @param {String} name of the guard to use for logging or debugging
2327 * @param {Function} func The function to invoke
2328 * @param {*} context The context to use when calling the function
2329 * @param {...*} args Arguments for function
2330 */
2331function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
2332 invokeGuardedCallback.apply(this, arguments);
2333 if (hasError) {
2334 var error = clearCaughtError();
2335 if (!hasRethrowError) {
2336 hasRethrowError = true;
2337 rethrowError = error;
2338 }
2339 }
2340}
2341
2342/**
2343 * During execution of guarded functions we will capture the first error which
2344 * we will rethrow to be handled by the top level error handler.
2345 */
2346function rethrowCaughtError() {
2347 if (hasRethrowError) {
2348 var error = rethrowError;
2349 hasRethrowError = false;
2350 rethrowError = null;
2351 throw error;
2352 }
2353}
2354
2355function hasCaughtError() {
2356 return hasError;
2357}
2358
2359function clearCaughtError() {
2360 if (hasError) {
2361 var error = caughtError;
2362 hasError = false;
2363 caughtError = null;
2364 return error;
2365 } else {
2366 invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
2367 }
2368}
2369
2370/**
2371 * Injectable ordering of event plugins.
2372 */
2373var eventPluginOrder = null;
2374
2375/**
2376 * Injectable mapping from names to event plugin modules.
2377 */
2378var namesToPlugins = {};
2379
2380/**
2381 * Recomputes the plugin list using the injected plugins and plugin ordering.
2382 *
2383 * @private
2384 */
2385function recomputePluginOrdering() {
2386 if (!eventPluginOrder) {
2387 // Wait until an `eventPluginOrder` is injected.
2388 return;
2389 }
2390 for (var pluginName in namesToPlugins) {
2391 var pluginModule = namesToPlugins[pluginName];
2392 var pluginIndex = eventPluginOrder.indexOf(pluginName);
2393 !(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
2394 if (plugins[pluginIndex]) {
2395 continue;
2396 }
2397 !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
2398 plugins[pluginIndex] = pluginModule;
2399 var publishedEvents = pluginModule.eventTypes;
2400 for (var eventName in publishedEvents) {
2401 !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0;
2402 }
2403 }
2404}
2405
2406/**
2407 * Publishes an event so that it can be dispatched by the supplied plugin.
2408 *
2409 * @param {object} dispatchConfig Dispatch configuration for the event.
2410 * @param {object} PluginModule Plugin publishing the event.
2411 * @return {boolean} True if the event was successfully published.
2412 * @private
2413 */
2414function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
2415 !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
2416 eventNameDispatchConfigs[eventName] = dispatchConfig;
2417
2418 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
2419 if (phasedRegistrationNames) {
2420 for (var phaseName in phasedRegistrationNames) {
2421 if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
2422 var phasedRegistrationName = phasedRegistrationNames[phaseName];
2423 publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
2424 }
2425 }
2426 return true;
2427 } else if (dispatchConfig.registrationName) {
2428 publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
2429 return true;
2430 }
2431 return false;
2432}
2433
2434/**
2435 * Publishes a registration name that is used to identify dispatched events.
2436 *
2437 * @param {string} registrationName Registration name to add.
2438 * @param {object} PluginModule Plugin publishing the event.
2439 * @private
2440 */
2441function publishRegistrationName(registrationName, pluginModule, eventName) {
2442 !!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0;
2443 registrationNameModules[registrationName] = pluginModule;
2444 registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
2445
2446 {
2447 var lowerCasedName = registrationName.toLowerCase();
2448 possibleRegistrationNames[lowerCasedName] = registrationName;
2449
2450 if (registrationName === 'onDoubleClick') {
2451 possibleRegistrationNames.ondblclick = registrationName;
2452 }
2453 }
2454}
2455
2456/**
2457 * Registers plugins so that they can extract and dispatch events.
2458 *
2459 * @see {EventPluginHub}
2460 */
2461
2462/**
2463 * Ordered list of injected plugins.
2464 */
2465var plugins = [];
2466
2467/**
2468 * Mapping from event name to dispatch config
2469 */
2470var eventNameDispatchConfigs = {};
2471
2472/**
2473 * Mapping from registration name to plugin module
2474 */
2475var registrationNameModules = {};
2476
2477/**
2478 * Mapping from registration name to event name
2479 */
2480var registrationNameDependencies = {};
2481
2482/**
2483 * Mapping from lowercase registration names to the properly cased version,
2484 * used to warn in the case of missing event handlers. Available
2485 * only in true.
2486 * @type {Object}
2487 */
2488var possibleRegistrationNames = {};
2489// Trust the developer to only use possibleRegistrationNames in true
2490
2491/**
2492 * Injects an ordering of plugins (by plugin name). This allows the ordering
2493 * to be decoupled from injection of the actual plugins so that ordering is
2494 * always deterministic regardless of packaging, on-the-fly injection, etc.
2495 *
2496 * @param {array} InjectedEventPluginOrder
2497 * @internal
2498 * @see {EventPluginHub.injection.injectEventPluginOrder}
2499 */
2500function injectEventPluginOrder(injectedEventPluginOrder) {
2501 !!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;
2502 // Clone the ordering so it cannot be dynamically mutated.
2503 eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
2504 recomputePluginOrdering();
2505}
2506
2507/**
2508 * Injects plugins to be used by `EventPluginHub`. The plugin names must be
2509 * in the ordering injected by `injectEventPluginOrder`.
2510 *
2511 * Plugins can be injected as part of page initialization or on-the-fly.
2512 *
2513 * @param {object} injectedNamesToPlugins Map from names to plugin modules.
2514 * @internal
2515 * @see {EventPluginHub.injection.injectEventPluginsByName}
2516 */
2517function injectEventPluginsByName(injectedNamesToPlugins) {
2518 var isOrderingDirty = false;
2519 for (var pluginName in injectedNamesToPlugins) {
2520 if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
2521 continue;
2522 }
2523 var pluginModule = injectedNamesToPlugins[pluginName];
2524 if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
2525 !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0;
2526 namesToPlugins[pluginName] = pluginModule;
2527 isOrderingDirty = true;
2528 }
2529 }
2530 if (isOrderingDirty) {
2531 recomputePluginOrdering();
2532 }
2533}
2534
2535/**
2536 * Similar to invariant but only logs a warning if the condition is not met.
2537 * This can be used to log issues in development environments in critical
2538 * paths. Removing the logging code for production environments will keep the
2539 * same logic and follow the same code paths.
2540 */
2541
2542var warningWithoutStack = function () {};
2543
2544{
2545 warningWithoutStack = function (condition, format) {
2546 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2547 args[_key - 2] = arguments[_key];
2548 }
2549
2550 if (format === undefined) {
2551 throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
2552 }
2553 if (args.length > 8) {
2554 // Check before the condition to catch violations early.
2555 throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
2556 }
2557 if (condition) {
2558 return;
2559 }
2560 if (typeof console !== 'undefined') {
2561 var argsWithFormat = args.map(function (item) {
2562 return '' + item;
2563 });
2564 argsWithFormat.unshift('Warning: ' + format);
2565
2566 // We intentionally don't use spread (or .apply) directly because it
2567 // breaks IE9: https://github.com/facebook/react/issues/13610
2568 Function.prototype.apply.call(console.error, console, argsWithFormat);
2569 }
2570 try {
2571 // --- Welcome to debugging React ---
2572 // This error was thrown as a convenience so that you can use this stack
2573 // to find the callsite that caused this warning to fire.
2574 var argIndex = 0;
2575 var message = 'Warning: ' + format.replace(/%s/g, function () {
2576 return args[argIndex++];
2577 });
2578 throw new Error(message);
2579 } catch (x) {}
2580 };
2581}
2582
2583var warningWithoutStack$1 = warningWithoutStack;
2584
2585var getFiberCurrentPropsFromNode = null;
2586var getInstanceFromNode = null;
2587var getNodeFromInstance = null;
2588
2589function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
2590 getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
2591 getInstanceFromNode = getInstanceFromNodeImpl;
2592 getNodeFromInstance = getNodeFromInstanceImpl;
2593 {
2594 !(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
2595 }
2596}
2597
2598var validateEventDispatches = void 0;
2599{
2600 validateEventDispatches = function (event) {
2601 var dispatchListeners = event._dispatchListeners;
2602 var dispatchInstances = event._dispatchInstances;
2603
2604 var listenersIsArr = Array.isArray(dispatchListeners);
2605 var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
2606
2607 var instancesIsArr = Array.isArray(dispatchInstances);
2608 var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
2609
2610 !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
2611 };
2612}
2613
2614/**
2615 * Dispatch the event to the listener.
2616 * @param {SyntheticEvent} event SyntheticEvent to handle
2617 * @param {function} listener Application-level callback
2618 * @param {*} inst Internal component instance
2619 */
2620function executeDispatch(event, listener, inst) {
2621 var type = event.type || 'unknown-event';
2622 event.currentTarget = getNodeFromInstance(inst);
2623 invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
2624 event.currentTarget = null;
2625}
2626
2627/**
2628 * Standard/simple iteration through an event's collected dispatches.
2629 */
2630function executeDispatchesInOrder(event) {
2631 var dispatchListeners = event._dispatchListeners;
2632 var dispatchInstances = event._dispatchInstances;
2633 {
2634 validateEventDispatches(event);
2635 }
2636 if (Array.isArray(dispatchListeners)) {
2637 for (var i = 0; i < dispatchListeners.length; i++) {
2638 if (event.isPropagationStopped()) {
2639 break;
2640 }
2641 // Listeners and Instances are two parallel arrays that are always in sync.
2642 executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
2643 }
2644 } else if (dispatchListeners) {
2645 executeDispatch(event, dispatchListeners, dispatchInstances);
2646 }
2647 event._dispatchListeners = null;
2648 event._dispatchInstances = null;
2649}
2650
2651/**
2652 * @see executeDispatchesInOrderStopAtTrueImpl
2653 */
2654
2655
2656/**
2657 * Execution of a "direct" dispatch - there must be at most one dispatch
2658 * accumulated on the event or it is considered an error. It doesn't really make
2659 * sense for an event with multiple dispatches (bubbled) to keep track of the
2660 * return values at each dispatch execution, but it does tend to make sense when
2661 * dealing with "direct" dispatches.
2662 *
2663 * @return {*} The return value of executing the single dispatch.
2664 */
2665
2666
2667/**
2668 * @param {SyntheticEvent} event
2669 * @return {boolean} True iff number of dispatches accumulated is greater than 0.
2670 */
2671
2672/**
2673 * Accumulates items that must not be null or undefined into the first one. This
2674 * is used to conserve memory by avoiding array allocations, and thus sacrifices
2675 * API cleanness. Since `current` can be null before being passed in and not
2676 * null after this function, make sure to assign it back to `current`:
2677 *
2678 * `a = accumulateInto(a, b);`
2679 *
2680 * This API should be sparingly used. Try `accumulate` for something cleaner.
2681 *
2682 * @return {*|array<*>} An accumulation of items.
2683 */
2684
2685function accumulateInto(current, next) {
2686 !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0;
2687
2688 if (current == null) {
2689 return next;
2690 }
2691
2692 // Both are not empty. Warning: Never call x.concat(y) when you are not
2693 // certain that x is an Array (x could be a string with concat method).
2694 if (Array.isArray(current)) {
2695 if (Array.isArray(next)) {
2696 current.push.apply(current, next);
2697 return current;
2698 }
2699 current.push(next);
2700 return current;
2701 }
2702
2703 if (Array.isArray(next)) {
2704 // A bit too dangerous to mutate `next`.
2705 return [current].concat(next);
2706 }
2707
2708 return [current, next];
2709}
2710
2711/**
2712 * @param {array} arr an "accumulation" of items which is either an Array or
2713 * a single item. Useful when paired with the `accumulate` module. This is a
2714 * simple utility that allows us to reason about a collection of items, but
2715 * handling the case when there is exactly one item (and we do not need to
2716 * allocate an array).
2717 * @param {function} cb Callback invoked with each element or a collection.
2718 * @param {?} [scope] Scope used as `this` in a callback.
2719 */
2720function forEachAccumulated(arr, cb, scope) {
2721 if (Array.isArray(arr)) {
2722 arr.forEach(cb, scope);
2723 } else if (arr) {
2724 cb.call(scope, arr);
2725 }
2726}
2727
2728/**
2729 * Internal queue of events that have accumulated their dispatches and are
2730 * waiting to have their dispatches executed.
2731 */
2732var eventQueue = null;
2733
2734/**
2735 * Dispatches an event and releases it back into the pool, unless persistent.
2736 *
2737 * @param {?object} event Synthetic event to be dispatched.
2738 * @private
2739 */
2740var executeDispatchesAndRelease = function (event) {
2741 if (event) {
2742 executeDispatchesInOrder(event);
2743
2744 if (!event.isPersistent()) {
2745 event.constructor.release(event);
2746 }
2747 }
2748};
2749var executeDispatchesAndReleaseTopLevel = function (e) {
2750 return executeDispatchesAndRelease(e);
2751};
2752
2753function isInteractive(tag) {
2754 return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
2755}
2756
2757function shouldPreventMouseEvent(name, type, props) {
2758 switch (name) {
2759 case 'onClick':
2760 case 'onClickCapture':
2761 case 'onDoubleClick':
2762 case 'onDoubleClickCapture':
2763 case 'onMouseDown':
2764 case 'onMouseDownCapture':
2765 case 'onMouseMove':
2766 case 'onMouseMoveCapture':
2767 case 'onMouseUp':
2768 case 'onMouseUpCapture':
2769 return !!(props.disabled && isInteractive(type));
2770 default:
2771 return false;
2772 }
2773}
2774
2775/**
2776 * This is a unified interface for event plugins to be installed and configured.
2777 *
2778 * Event plugins can implement the following properties:
2779 *
2780 * `extractEvents` {function(string, DOMEventTarget, string, object): *}
2781 * Required. When a top-level event is fired, this method is expected to
2782 * extract synthetic events that will in turn be queued and dispatched.
2783 *
2784 * `eventTypes` {object}
2785 * Optional, plugins that fire events must publish a mapping of registration
2786 * names that are used to register listeners. Values of this mapping must
2787 * be objects that contain `registrationName` or `phasedRegistrationNames`.
2788 *
2789 * `executeDispatch` {function(object, function, string)}
2790 * Optional, allows plugins to override how an event gets dispatched. By
2791 * default, the listener is simply invoked.
2792 *
2793 * Each plugin that is injected into `EventsPluginHub` is immediately operable.
2794 *
2795 * @public
2796 */
2797
2798/**
2799 * Methods for injecting dependencies.
2800 */
2801var injection = {
2802 /**
2803 * @param {array} InjectedEventPluginOrder
2804 * @public
2805 */
2806 injectEventPluginOrder: injectEventPluginOrder,
2807
2808 /**
2809 * @param {object} injectedNamesToPlugins Map from names to plugin modules.
2810 */
2811 injectEventPluginsByName: injectEventPluginsByName
2812};
2813
2814/**
2815 * @param {object} inst The instance, which is the source of events.
2816 * @param {string} registrationName Name of listener (e.g. `onClick`).
2817 * @return {?function} The stored callback.
2818 */
2819function getListener(inst, registrationName) {
2820 var listener = void 0;
2821
2822 // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
2823 // live here; needs to be moved to a better place soon
2824 var stateNode = inst.stateNode;
2825 if (!stateNode) {
2826 // Work in progress (ex: onload events in incremental mode).
2827 return null;
2828 }
2829 var props = getFiberCurrentPropsFromNode(stateNode);
2830 if (!props) {
2831 // Work in progress.
2832 return null;
2833 }
2834 listener = props[registrationName];
2835 if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
2836 return null;
2837 }
2838 !(!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;
2839 return listener;
2840}
2841
2842/**
2843 * Allows registered plugins an opportunity to extract events from top-level
2844 * native browser events.
2845 *
2846 * @return {*} An accumulation of synthetic events.
2847 * @internal
2848 */
2849function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
2850 var events = null;
2851 for (var i = 0; i < plugins.length; i++) {
2852 // Not every plugin in the ordering may be loaded at runtime.
2853 var possiblePlugin = plugins[i];
2854 if (possiblePlugin) {
2855 var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
2856 if (extractedEvents) {
2857 events = accumulateInto(events, extractedEvents);
2858 }
2859 }
2860 }
2861 return events;
2862}
2863
2864function runEventsInBatch(events) {
2865 if (events !== null) {
2866 eventQueue = accumulateInto(eventQueue, events);
2867 }
2868
2869 // Set `eventQueue` to null before processing it so that we can tell if more
2870 // events get enqueued while processing.
2871 var processingEventQueue = eventQueue;
2872 eventQueue = null;
2873
2874 if (!processingEventQueue) {
2875 return;
2876 }
2877
2878 forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
2879 !!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0;
2880 // This would be a good time to rethrow if any of the event handlers threw.
2881 rethrowCaughtError();
2882}
2883
2884function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
2885 var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
2886 runEventsInBatch(events);
2887}
2888
2889var FunctionComponent = 0;
2890var ClassComponent = 1;
2891var IndeterminateComponent = 2; // Before we know whether it is function or class
2892var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
2893var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
2894var HostComponent = 5;
2895var HostText = 6;
2896var Fragment = 7;
2897var Mode = 8;
2898var ContextConsumer = 9;
2899var ContextProvider = 10;
2900var ForwardRef = 11;
2901var Profiler = 12;
2902var SuspenseComponent = 13;
2903var MemoComponent = 14;
2904var SimpleMemoComponent = 15;
2905var LazyComponent = 16;
2906var IncompleteClassComponent = 17;
2907
2908var randomKey = Math.random().toString(36).slice(2);
2909var internalInstanceKey = '__reactInternalInstance$' + randomKey;
2910var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
2911
2912function precacheFiberNode(hostInst, node) {
2913 node[internalInstanceKey] = hostInst;
2914}
2915
2916/**
2917 * Given a DOM node, return the closest ReactDOMComponent or
2918 * ReactDOMTextComponent instance ancestor.
2919 */
2920function getClosestInstanceFromNode(node) {
2921 if (node[internalInstanceKey]) {
2922 return node[internalInstanceKey];
2923 }
2924
2925 while (!node[internalInstanceKey]) {
2926 if (node.parentNode) {
2927 node = node.parentNode;
2928 } else {
2929 // Top of the tree. This node must not be part of a React tree (or is
2930 // unmounted, potentially).
2931 return null;
2932 }
2933 }
2934
2935 var inst = node[internalInstanceKey];
2936 if (inst.tag === HostComponent || inst.tag === HostText) {
2937 // In Fiber, this will always be the deepest root.
2938 return inst;
2939 }
2940
2941 return null;
2942}
2943
2944/**
2945 * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
2946 * instance, or null if the node was not rendered by this React.
2947 */
2948function getInstanceFromNode$1(node) {
2949 var inst = node[internalInstanceKey];
2950 if (inst) {
2951 if (inst.tag === HostComponent || inst.tag === HostText) {
2952 return inst;
2953 } else {
2954 return null;
2955 }
2956 }
2957 return null;
2958}
2959
2960/**
2961 * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
2962 * DOM node.
2963 */
2964function getNodeFromInstance$1(inst) {
2965 if (inst.tag === HostComponent || inst.tag === HostText) {
2966 // In Fiber this, is just the state node right now. We assume it will be
2967 // a host component or host text.
2968 return inst.stateNode;
2969 }
2970
2971 // Without this first invariant, passing a non-DOM-component triggers the next
2972 // invariant for a missing parent, which is super confusing.
2973 invariant(false, 'getNodeFromInstance: Invalid argument.');
2974}
2975
2976function getFiberCurrentPropsFromNode$1(node) {
2977 return node[internalEventHandlersKey] || null;
2978}
2979
2980function updateFiberProps(node, props) {
2981 node[internalEventHandlersKey] = props;
2982}
2983
2984function getParent(inst) {
2985 do {
2986 inst = inst.return;
2987 // TODO: If this is a HostRoot we might want to bail out.
2988 // That is depending on if we want nested subtrees (layers) to bubble
2989 // events to their parent. We could also go through parentNode on the
2990 // host node but that wouldn't work for React Native and doesn't let us
2991 // do the portal feature.
2992 } while (inst && inst.tag !== HostComponent);
2993 if (inst) {
2994 return inst;
2995 }
2996 return null;
2997}
2998
2999/**
3000 * Return the lowest common ancestor of A and B, or null if they are in
3001 * different trees.
3002 */
3003function getLowestCommonAncestor(instA, instB) {
3004 var depthA = 0;
3005 for (var tempA = instA; tempA; tempA = getParent(tempA)) {
3006 depthA++;
3007 }
3008 var depthB = 0;
3009 for (var tempB = instB; tempB; tempB = getParent(tempB)) {
3010 depthB++;
3011 }
3012
3013 // If A is deeper, crawl up.
3014 while (depthA - depthB > 0) {
3015 instA = getParent(instA);
3016 depthA--;
3017 }
3018
3019 // If B is deeper, crawl up.
3020 while (depthB - depthA > 0) {
3021 instB = getParent(instB);
3022 depthB--;
3023 }
3024
3025 // Walk in lockstep until we find a match.
3026 var depth = depthA;
3027 while (depth--) {
3028 if (instA === instB || instA === instB.alternate) {
3029 return instA;
3030 }
3031 instA = getParent(instA);
3032 instB = getParent(instB);
3033 }
3034 return null;
3035}
3036
3037/**
3038 * Return if A is an ancestor of B.
3039 */
3040
3041
3042/**
3043 * Return the parent instance of the passed-in instance.
3044 */
3045
3046
3047/**
3048 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
3049 */
3050function traverseTwoPhase(inst, fn, arg) {
3051 var path = [];
3052 while (inst) {
3053 path.push(inst);
3054 inst = getParent(inst);
3055 }
3056 var i = void 0;
3057 for (i = path.length; i-- > 0;) {
3058 fn(path[i], 'captured', arg);
3059 }
3060 for (i = 0; i < path.length; i++) {
3061 fn(path[i], 'bubbled', arg);
3062 }
3063}
3064
3065/**
3066 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
3067 * should would receive a `mouseEnter` or `mouseLeave` event.
3068 *
3069 * Does not invoke the callback on the nearest common ancestor because nothing
3070 * "entered" or "left" that element.
3071 */
3072function traverseEnterLeave(from, to, fn, argFrom, argTo) {
3073 var common = from && to ? getLowestCommonAncestor(from, to) : null;
3074 var pathFrom = [];
3075 while (true) {
3076 if (!from) {
3077 break;
3078 }
3079 if (from === common) {
3080 break;
3081 }
3082 var alternate = from.alternate;
3083 if (alternate !== null && alternate === common) {
3084 break;
3085 }
3086 pathFrom.push(from);
3087 from = getParent(from);
3088 }
3089 var pathTo = [];
3090 while (true) {
3091 if (!to) {
3092 break;
3093 }
3094 if (to === common) {
3095 break;
3096 }
3097 var _alternate = to.alternate;
3098 if (_alternate !== null && _alternate === common) {
3099 break;
3100 }
3101 pathTo.push(to);
3102 to = getParent(to);
3103 }
3104 for (var i = 0; i < pathFrom.length; i++) {
3105 fn(pathFrom[i], 'bubbled', argFrom);
3106 }
3107 for (var _i = pathTo.length; _i-- > 0;) {
3108 fn(pathTo[_i], 'captured', argTo);
3109 }
3110}
3111
3112/**
3113 * Some event types have a notion of different registration names for different
3114 * "phases" of propagation. This finds listeners by a given phase.
3115 */
3116function listenerAtPhase(inst, event, propagationPhase) {
3117 var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
3118 return getListener(inst, registrationName);
3119}
3120
3121/**
3122 * A small set of propagation patterns, each of which will accept a small amount
3123 * of information, and generate a set of "dispatch ready event objects" - which
3124 * are sets of events that have already been annotated with a set of dispatched
3125 * listener functions/ids. The API is designed this way to discourage these
3126 * propagation strategies from actually executing the dispatches, since we
3127 * always want to collect the entire set of dispatches before executing even a
3128 * single one.
3129 */
3130
3131/**
3132 * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
3133 * here, allows us to not have to bind or create functions for each event.
3134 * Mutating the event's members allows us to not have to create a wrapping
3135 * "dispatch" object that pairs the event with the listener.
3136 */
3137function accumulateDirectionalDispatches(inst, phase, event) {
3138 {
3139 !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
3140 }
3141 var listener = listenerAtPhase(inst, event, phase);
3142 if (listener) {
3143 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
3144 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
3145 }
3146}
3147
3148/**
3149 * Collect dispatches (must be entirely collected before dispatching - see unit
3150 * tests). Lazily allocate the array to conserve memory. We must loop through
3151 * each event and perform the traversal for each one. We cannot perform a
3152 * single traversal for the entire collection of events because each event may
3153 * have a different target.
3154 */
3155function accumulateTwoPhaseDispatchesSingle(event) {
3156 if (event && event.dispatchConfig.phasedRegistrationNames) {
3157 traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
3158 }
3159}
3160
3161/**
3162 * Accumulates without regard to direction, does not look for phased
3163 * registration names. Same as `accumulateDirectDispatchesSingle` but without
3164 * requiring that the `dispatchMarker` be the same as the dispatched ID.
3165 */
3166function accumulateDispatches(inst, ignoredDirection, event) {
3167 if (inst && event && event.dispatchConfig.registrationName) {
3168 var registrationName = event.dispatchConfig.registrationName;
3169 var listener = getListener(inst, registrationName);
3170 if (listener) {
3171 event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
3172 event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
3173 }
3174 }
3175}
3176
3177/**
3178 * Accumulates dispatches on an `SyntheticEvent`, but only for the
3179 * `dispatchMarker`.
3180 * @param {SyntheticEvent} event
3181 */
3182function accumulateDirectDispatchesSingle(event) {
3183 if (event && event.dispatchConfig.registrationName) {
3184 accumulateDispatches(event._targetInst, null, event);
3185 }
3186}
3187
3188function accumulateTwoPhaseDispatches(events) {
3189 forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
3190}
3191
3192
3193
3194function accumulateEnterLeaveDispatches(leave, enter, from, to) {
3195 traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
3196}
3197
3198function accumulateDirectDispatches(events) {
3199 forEachAccumulated(events, accumulateDirectDispatchesSingle);
3200}
3201
3202var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
3203
3204// Do not uses the below two methods directly!
3205// Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
3206// (It is the only module that is allowed to access these methods.)
3207
3208function unsafeCastStringToDOMTopLevelType(topLevelType) {
3209 return topLevelType;
3210}
3211
3212function unsafeCastDOMTopLevelTypeToString(topLevelType) {
3213 return topLevelType;
3214}
3215
3216/**
3217 * Generate a mapping of standard vendor prefixes using the defined style property and event name.
3218 *
3219 * @param {string} styleProp
3220 * @param {string} eventName
3221 * @returns {object}
3222 */
3223function makePrefixMap(styleProp, eventName) {
3224 var prefixes = {};
3225
3226 prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
3227 prefixes['Webkit' + styleProp] = 'webkit' + eventName;
3228 prefixes['Moz' + styleProp] = 'moz' + eventName;
3229
3230 return prefixes;
3231}
3232
3233/**
3234 * A list of event names to a configurable list of vendor prefixes.
3235 */
3236var vendorPrefixes = {
3237 animationend: makePrefixMap('Animation', 'AnimationEnd'),
3238 animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
3239 animationstart: makePrefixMap('Animation', 'AnimationStart'),
3240 transitionend: makePrefixMap('Transition', 'TransitionEnd')
3241};
3242
3243/**
3244 * Event names that have already been detected and prefixed (if applicable).
3245 */
3246var prefixedEventNames = {};
3247
3248/**
3249 * Element to check for prefixes on.
3250 */
3251var style = {};
3252
3253/**
3254 * Bootstrap if a DOM exists.
3255 */
3256if (canUseDOM) {
3257 style = document.createElement('div').style;
3258
3259 // On some platforms, in particular some releases of Android 4.x,
3260 // the un-prefixed "animation" and "transition" properties are defined on the
3261 // style object but the events that fire will still be prefixed, so we need
3262 // to check if the un-prefixed events are usable, and if not remove them from the map.
3263 if (!('AnimationEvent' in window)) {
3264 delete vendorPrefixes.animationend.animation;
3265 delete vendorPrefixes.animationiteration.animation;
3266 delete vendorPrefixes.animationstart.animation;
3267 }
3268
3269 // Same as above
3270 if (!('TransitionEvent' in window)) {
3271 delete vendorPrefixes.transitionend.transition;
3272 }
3273}
3274
3275/**
3276 * Attempts to determine the correct vendor prefixed event name.
3277 *
3278 * @param {string} eventName
3279 * @returns {string}
3280 */
3281function getVendorPrefixedEventName(eventName) {
3282 if (prefixedEventNames[eventName]) {
3283 return prefixedEventNames[eventName];
3284 } else if (!vendorPrefixes[eventName]) {
3285 return eventName;
3286 }
3287
3288 var prefixMap = vendorPrefixes[eventName];
3289
3290 for (var styleProp in prefixMap) {
3291 if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
3292 return prefixedEventNames[eventName] = prefixMap[styleProp];
3293 }
3294 }
3295
3296 return eventName;
3297}
3298
3299/**
3300 * To identify top level events in ReactDOM, we use constants defined by this
3301 * module. This is the only module that uses the unsafe* methods to express
3302 * that the constants actually correspond to the browser event names. This lets
3303 * us save some bundle size by avoiding a top level type -> event name map.
3304 * The rest of ReactDOM code should import top level types from this file.
3305 */
3306var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
3307var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
3308var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
3309var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
3310var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
3311var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
3312var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
3313var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
3314var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
3315var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
3316var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
3317var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
3318var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
3319var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
3320var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
3321var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
3322var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
3323var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
3324var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick');
3325var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
3326var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
3327var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
3328var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
3329var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
3330var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
3331var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
3332var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
3333var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
3334var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
3335var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
3336var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
3337var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
3338var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
3339var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture');
3340var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
3341var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid');
3342var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
3343var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
3344var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
3345var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
3346var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
3347var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
3348var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
3349var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture');
3350var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
3351var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
3352var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
3353var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
3354var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
3355var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
3356var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
3357var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
3358var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
3359var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel');
3360var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown');
3361
3362
3363var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove');
3364var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout');
3365var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover');
3366var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup');
3367var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
3368var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
3369var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset');
3370var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
3371var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
3372var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
3373var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
3374var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
3375var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit');
3376var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
3377var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
3378var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
3379var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
3380var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
3381var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
3382var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
3383var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
3384var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
3385var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
3386var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
3387var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
3388
3389// List of events that need to be individually attached to media elements.
3390// Note that events in this list will *not* be listened to at the top level
3391// unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
3392var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING];
3393
3394function getRawEventName(topLevelType) {
3395 return unsafeCastDOMTopLevelTypeToString(topLevelType);
3396}
3397
3398/**
3399 * These variables store information about text content of a target node,
3400 * allowing comparison of content before and after a given event.
3401 *
3402 * Identify the node where selection currently begins, then observe
3403 * both its text content and its current position in the DOM. Since the
3404 * browser may natively replace the target node during composition, we can
3405 * use its position to find its replacement.
3406 *
3407 *
3408 */
3409
3410var root = null;
3411var startText = null;
3412var fallbackText = null;
3413
3414function initialize(nativeEventTarget) {
3415 root = nativeEventTarget;
3416 startText = getText();
3417 return true;
3418}
3419
3420function reset() {
3421 root = null;
3422 startText = null;
3423 fallbackText = null;
3424}
3425
3426function getData() {
3427 if (fallbackText) {
3428 return fallbackText;
3429 }
3430
3431 var start = void 0;
3432 var startValue = startText;
3433 var startLength = startValue.length;
3434 var end = void 0;
3435 var endValue = getText();
3436 var endLength = endValue.length;
3437
3438 for (start = 0; start < startLength; start++) {
3439 if (startValue[start] !== endValue[start]) {
3440 break;
3441 }
3442 }
3443
3444 var minEnd = startLength - start;
3445 for (end = 1; end <= minEnd; end++) {
3446 if (startValue[startLength - end] !== endValue[endLength - end]) {
3447 break;
3448 }
3449 }
3450
3451 var sliceTail = end > 1 ? 1 - end : undefined;
3452 fallbackText = endValue.slice(start, sliceTail);
3453 return fallbackText;
3454}
3455
3456function getText() {
3457 if ('value' in root) {
3458 return root.value;
3459 }
3460 return root.textContent;
3461}
3462
3463/* eslint valid-typeof: 0 */
3464
3465var EVENT_POOL_SIZE = 10;
3466
3467/**
3468 * @interface Event
3469 * @see http://www.w3.org/TR/DOM-Level-3-Events/
3470 */
3471var EventInterface = {
3472 type: null,
3473 target: null,
3474 // currentTarget is set when dispatching; no use in copying it here
3475 currentTarget: function () {
3476 return null;
3477 },
3478 eventPhase: null,
3479 bubbles: null,
3480 cancelable: null,
3481 timeStamp: function (event) {
3482 return event.timeStamp || Date.now();
3483 },
3484 defaultPrevented: null,
3485 isTrusted: null
3486};
3487
3488function functionThatReturnsTrue() {
3489 return true;
3490}
3491
3492function functionThatReturnsFalse() {
3493 return false;
3494}
3495
3496/**
3497 * Synthetic events are dispatched by event plugins, typically in response to a
3498 * top-level event delegation handler.
3499 *
3500 * These systems should generally use pooling to reduce the frequency of garbage
3501 * collection. The system should check `isPersistent` to determine whether the
3502 * event should be released into the pool after being dispatched. Users that
3503 * need a persisted event should invoke `persist`.
3504 *
3505 * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
3506 * normalizing browser quirks. Subclasses do not necessarily have to implement a
3507 * DOM interface; custom application-specific events can also subclass this.
3508 *
3509 * @param {object} dispatchConfig Configuration used to dispatch this event.
3510 * @param {*} targetInst Marker identifying the event target.
3511 * @param {object} nativeEvent Native browser event.
3512 * @param {DOMEventTarget} nativeEventTarget Target node.
3513 */
3514function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
3515 {
3516 // these have a getter/setter for warnings
3517 delete this.nativeEvent;
3518 delete this.preventDefault;
3519 delete this.stopPropagation;
3520 delete this.isDefaultPrevented;
3521 delete this.isPropagationStopped;
3522 }
3523
3524 this.dispatchConfig = dispatchConfig;
3525 this._targetInst = targetInst;
3526 this.nativeEvent = nativeEvent;
3527
3528 var Interface = this.constructor.Interface;
3529 for (var propName in Interface) {
3530 if (!Interface.hasOwnProperty(propName)) {
3531 continue;
3532 }
3533 {
3534 delete this[propName]; // this has a getter/setter for warnings
3535 }
3536 var normalize = Interface[propName];
3537 if (normalize) {
3538 this[propName] = normalize(nativeEvent);
3539 } else {
3540 if (propName === 'target') {
3541 this.target = nativeEventTarget;
3542 } else {
3543 this[propName] = nativeEvent[propName];
3544 }
3545 }
3546 }
3547
3548 var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
3549 if (defaultPrevented) {
3550 this.isDefaultPrevented = functionThatReturnsTrue;
3551 } else {
3552 this.isDefaultPrevented = functionThatReturnsFalse;
3553 }
3554 this.isPropagationStopped = functionThatReturnsFalse;
3555 return this;
3556}
3557
3558_assign(SyntheticEvent.prototype, {
3559 preventDefault: function () {
3560 this.defaultPrevented = true;
3561 var event = this.nativeEvent;
3562 if (!event) {
3563 return;
3564 }
3565
3566 if (event.preventDefault) {
3567 event.preventDefault();
3568 } else if (typeof event.returnValue !== 'unknown') {
3569 event.returnValue = false;
3570 }
3571 this.isDefaultPrevented = functionThatReturnsTrue;
3572 },
3573
3574 stopPropagation: function () {
3575 var event = this.nativeEvent;
3576 if (!event) {
3577 return;
3578 }
3579
3580 if (event.stopPropagation) {
3581 event.stopPropagation();
3582 } else if (typeof event.cancelBubble !== 'unknown') {
3583 // The ChangeEventPlugin registers a "propertychange" event for
3584 // IE. This event does not support bubbling or cancelling, and
3585 // any references to cancelBubble throw "Member not found". A
3586 // typeof check of "unknown" circumvents this issue (and is also
3587 // IE specific).
3588 event.cancelBubble = true;
3589 }
3590
3591 this.isPropagationStopped = functionThatReturnsTrue;
3592 },
3593
3594 /**
3595 * We release all dispatched `SyntheticEvent`s after each event loop, adding
3596 * them back into the pool. This allows a way to hold onto a reference that
3597 * won't be added back into the pool.
3598 */
3599 persist: function () {
3600 this.isPersistent = functionThatReturnsTrue;
3601 },
3602
3603 /**
3604 * Checks if this event should be released back into the pool.
3605 *
3606 * @return {boolean} True if this should not be released, false otherwise.
3607 */
3608 isPersistent: functionThatReturnsFalse,
3609
3610 /**
3611 * `PooledClass` looks for `destructor` on each instance it releases.
3612 */
3613 destructor: function () {
3614 var Interface = this.constructor.Interface;
3615 for (var propName in Interface) {
3616 {
3617 Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
3618 }
3619 }
3620 this.dispatchConfig = null;
3621 this._targetInst = null;
3622 this.nativeEvent = null;
3623 this.isDefaultPrevented = functionThatReturnsFalse;
3624 this.isPropagationStopped = functionThatReturnsFalse;
3625 this._dispatchListeners = null;
3626 this._dispatchInstances = null;
3627 {
3628 Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
3629 Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
3630 Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
3631 Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
3632 Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
3633 }
3634 }
3635});
3636
3637SyntheticEvent.Interface = EventInterface;
3638
3639/**
3640 * Helper to reduce boilerplate when creating subclasses.
3641 */
3642SyntheticEvent.extend = function (Interface) {
3643 var Super = this;
3644
3645 var E = function () {};
3646 E.prototype = Super.prototype;
3647 var prototype = new E();
3648
3649 function Class() {
3650 return Super.apply(this, arguments);
3651 }
3652 _assign(prototype, Class.prototype);
3653 Class.prototype = prototype;
3654 Class.prototype.constructor = Class;
3655
3656 Class.Interface = _assign({}, Super.Interface, Interface);
3657 Class.extend = Super.extend;
3658 addEventPoolingTo(Class);
3659
3660 return Class;
3661};
3662
3663addEventPoolingTo(SyntheticEvent);
3664
3665/**
3666 * Helper to nullify syntheticEvent instance properties when destructing
3667 *
3668 * @param {String} propName
3669 * @param {?object} getVal
3670 * @return {object} defineProperty object
3671 */
3672function getPooledWarningPropertyDefinition(propName, getVal) {
3673 var isFunction = typeof getVal === 'function';
3674 return {
3675 configurable: true,
3676 set: set,
3677 get: get
3678 };
3679
3680 function set(val) {
3681 var action = isFunction ? 'setting the method' : 'setting the property';
3682 warn(action, 'This is effectively a no-op');
3683 return val;
3684 }
3685
3686 function get() {
3687 var action = isFunction ? 'accessing the method' : 'accessing the property';
3688 var result = isFunction ? 'This is a no-op function' : 'This is set to null';
3689 warn(action, result);
3690 return getVal;
3691 }
3692
3693 function warn(action, result) {
3694 var warningCondition = false;
3695 !warningCondition ? warningWithoutStack$1(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;
3696 }
3697}
3698
3699function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
3700 var EventConstructor = this;
3701 if (EventConstructor.eventPool.length) {
3702 var instance = EventConstructor.eventPool.pop();
3703 EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
3704 return instance;
3705 }
3706 return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
3707}
3708
3709function releasePooledEvent(event) {
3710 var EventConstructor = this;
3711 !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
3712 event.destructor();
3713 if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
3714 EventConstructor.eventPool.push(event);
3715 }
3716}
3717
3718function addEventPoolingTo(EventConstructor) {
3719 EventConstructor.eventPool = [];
3720 EventConstructor.getPooled = getPooledEvent;
3721 EventConstructor.release = releasePooledEvent;
3722}
3723
3724/**
3725 * @interface Event
3726 * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
3727 */
3728var SyntheticCompositionEvent = SyntheticEvent.extend({
3729 data: null
3730});
3731
3732/**
3733 * @interface Event
3734 * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
3735 * /#events-inputevents
3736 */
3737var SyntheticInputEvent = SyntheticEvent.extend({
3738 data: null
3739});
3740
3741var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
3742var START_KEYCODE = 229;
3743
3744var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
3745
3746var documentMode = null;
3747if (canUseDOM && 'documentMode' in document) {
3748 documentMode = document.documentMode;
3749}
3750
3751// Webkit offers a very useful `textInput` event that can be used to
3752// directly represent `beforeInput`. The IE `textinput` event is not as
3753// useful, so we don't use it.
3754var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode;
3755
3756// In IE9+, we have access to composition events, but the data supplied
3757// by the native compositionend event may be incorrect. Japanese ideographic
3758// spaces, for instance (\u3000) are not recorded correctly.
3759var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
3760
3761var SPACEBAR_CODE = 32;
3762var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
3763
3764// Events and their corresponding property names.
3765var eventTypes = {
3766 beforeInput: {
3767 phasedRegistrationNames: {
3768 bubbled: 'onBeforeInput',
3769 captured: 'onBeforeInputCapture'
3770 },
3771 dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE]
3772 },
3773 compositionEnd: {
3774 phasedRegistrationNames: {
3775 bubbled: 'onCompositionEnd',
3776 captured: 'onCompositionEndCapture'
3777 },
3778 dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
3779 },
3780 compositionStart: {
3781 phasedRegistrationNames: {
3782 bubbled: 'onCompositionStart',
3783 captured: 'onCompositionStartCapture'
3784 },
3785 dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
3786 },
3787 compositionUpdate: {
3788 phasedRegistrationNames: {
3789 bubbled: 'onCompositionUpdate',
3790 captured: 'onCompositionUpdateCapture'
3791 },
3792 dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
3793 }
3794};
3795
3796// Track whether we've ever handled a keypress on the space key.
3797var hasSpaceKeypress = false;
3798
3799/**
3800 * Return whether a native keypress event is assumed to be a command.
3801 * This is required because Firefox fires `keypress` events for key commands
3802 * (cut, copy, select-all, etc.) even though no character is inserted.
3803 */
3804function isKeypressCommand(nativeEvent) {
3805 return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
3806 // ctrlKey && altKey is equivalent to AltGr, and is not a command.
3807 !(nativeEvent.ctrlKey && nativeEvent.altKey);
3808}
3809
3810/**
3811 * Translate native top level events into event types.
3812 *
3813 * @param {string} topLevelType
3814 * @return {object}
3815 */
3816function getCompositionEventType(topLevelType) {
3817 switch (topLevelType) {
3818 case TOP_COMPOSITION_START:
3819 return eventTypes.compositionStart;
3820 case TOP_COMPOSITION_END:
3821 return eventTypes.compositionEnd;
3822 case TOP_COMPOSITION_UPDATE:
3823 return eventTypes.compositionUpdate;
3824 }
3825}
3826
3827/**
3828 * Does our fallback best-guess model think this event signifies that
3829 * composition has begun?
3830 *
3831 * @param {string} topLevelType
3832 * @param {object} nativeEvent
3833 * @return {boolean}
3834 */
3835function isFallbackCompositionStart(topLevelType, nativeEvent) {
3836 return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE;
3837}
3838
3839/**
3840 * Does our fallback mode think that this event is the end of composition?
3841 *
3842 * @param {string} topLevelType
3843 * @param {object} nativeEvent
3844 * @return {boolean}
3845 */
3846function isFallbackCompositionEnd(topLevelType, nativeEvent) {
3847 switch (topLevelType) {
3848 case TOP_KEY_UP:
3849 // Command keys insert or clear IME input.
3850 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
3851 case TOP_KEY_DOWN:
3852 // Expect IME keyCode on each keydown. If we get any other
3853 // code we must have exited earlier.
3854 return nativeEvent.keyCode !== START_KEYCODE;
3855 case TOP_KEY_PRESS:
3856 case TOP_MOUSE_DOWN:
3857 case TOP_BLUR:
3858 // Events are not possible without cancelling IME.
3859 return true;
3860 default:
3861 return false;
3862 }
3863}
3864
3865/**
3866 * Google Input Tools provides composition data via a CustomEvent,
3867 * with the `data` property populated in the `detail` object. If this
3868 * is available on the event object, use it. If not, this is a plain
3869 * composition event and we have nothing special to extract.
3870 *
3871 * @param {object} nativeEvent
3872 * @return {?string}
3873 */
3874function getDataFromCustomEvent(nativeEvent) {
3875 var detail = nativeEvent.detail;
3876 if (typeof detail === 'object' && 'data' in detail) {
3877 return detail.data;
3878 }
3879 return null;
3880}
3881
3882/**
3883 * Check if a composition event was triggered by Korean IME.
3884 * Our fallback mode does not work well with IE's Korean IME,
3885 * so just use native composition events when Korean IME is used.
3886 * Although CompositionEvent.locale property is deprecated,
3887 * it is available in IE, where our fallback mode is enabled.
3888 *
3889 * @param {object} nativeEvent
3890 * @return {boolean}
3891 */
3892function isUsingKoreanIME(nativeEvent) {
3893 return nativeEvent.locale === 'ko';
3894}
3895
3896// Track the current IME composition status, if any.
3897var isComposing = false;
3898
3899/**
3900 * @return {?object} A SyntheticCompositionEvent.
3901 */
3902function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
3903 var eventType = void 0;
3904 var fallbackData = void 0;
3905
3906 if (canUseCompositionEvent) {
3907 eventType = getCompositionEventType(topLevelType);
3908 } else if (!isComposing) {
3909 if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
3910 eventType = eventTypes.compositionStart;
3911 }
3912 } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
3913 eventType = eventTypes.compositionEnd;
3914 }
3915
3916 if (!eventType) {
3917 return null;
3918 }
3919
3920 if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
3921 // The current composition is stored statically and must not be
3922 // overwritten while composition continues.
3923 if (!isComposing && eventType === eventTypes.compositionStart) {
3924 isComposing = initialize(nativeEventTarget);
3925 } else if (eventType === eventTypes.compositionEnd) {
3926 if (isComposing) {
3927 fallbackData = getData();
3928 }
3929 }
3930 }
3931
3932 var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
3933
3934 if (fallbackData) {
3935 // Inject data generated from fallback path into the synthetic event.
3936 // This matches the property of native CompositionEventInterface.
3937 event.data = fallbackData;
3938 } else {
3939 var customData = getDataFromCustomEvent(nativeEvent);
3940 if (customData !== null) {
3941 event.data = customData;
3942 }
3943 }
3944
3945 accumulateTwoPhaseDispatches(event);
3946 return event;
3947}
3948
3949/**
3950 * @param {TopLevelType} topLevelType Number from `TopLevelType`.
3951 * @param {object} nativeEvent Native browser event.
3952 * @return {?string} The string corresponding to this `beforeInput` event.
3953 */
3954function getNativeBeforeInputChars(topLevelType, nativeEvent) {
3955 switch (topLevelType) {
3956 case TOP_COMPOSITION_END:
3957 return getDataFromCustomEvent(nativeEvent);
3958 case TOP_KEY_PRESS:
3959 /**
3960 * If native `textInput` events are available, our goal is to make
3961 * use of them. However, there is a special case: the spacebar key.
3962 * In Webkit, preventing default on a spacebar `textInput` event
3963 * cancels character insertion, but it *also* causes the browser
3964 * to fall back to its default spacebar behavior of scrolling the
3965 * page.
3966 *
3967 * Tracking at:
3968 * https://code.google.com/p/chromium/issues/detail?id=355103
3969 *
3970 * To avoid this issue, use the keypress event as if no `textInput`
3971 * event is available.
3972 */
3973 var which = nativeEvent.which;
3974 if (which !== SPACEBAR_CODE) {
3975 return null;
3976 }
3977
3978 hasSpaceKeypress = true;
3979 return SPACEBAR_CHAR;
3980
3981 case TOP_TEXT_INPUT:
3982 // Record the characters to be added to the DOM.
3983 var chars = nativeEvent.data;
3984
3985 // If it's a spacebar character, assume that we have already handled
3986 // it at the keypress level and bail immediately. Android Chrome
3987 // doesn't give us keycodes, so we need to ignore it.
3988 if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
3989 return null;
3990 }
3991
3992 return chars;
3993
3994 default:
3995 // For other native event types, do nothing.
3996 return null;
3997 }
3998}
3999
4000/**
4001 * For browsers that do not provide the `textInput` event, extract the
4002 * appropriate string to use for SyntheticInputEvent.
4003 *
4004 * @param {number} topLevelType Number from `TopLevelEventTypes`.
4005 * @param {object} nativeEvent Native browser event.
4006 * @return {?string} The fallback string for this `beforeInput` event.
4007 */
4008function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
4009 // If we are currently composing (IME) and using a fallback to do so,
4010 // try to extract the composed characters from the fallback object.
4011 // If composition event is available, we extract a string only at
4012 // compositionevent, otherwise extract it at fallback events.
4013 if (isComposing) {
4014 if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
4015 var chars = getData();
4016 reset();
4017 isComposing = false;
4018 return chars;
4019 }
4020 return null;
4021 }
4022
4023 switch (topLevelType) {
4024 case TOP_PASTE:
4025 // If a paste event occurs after a keypress, throw out the input
4026 // chars. Paste events should not lead to BeforeInput events.
4027 return null;
4028 case TOP_KEY_PRESS:
4029 /**
4030 * As of v27, Firefox may fire keypress events even when no character
4031 * will be inserted. A few possibilities:
4032 *
4033 * - `which` is `0`. Arrow keys, Esc key, etc.
4034 *
4035 * - `which` is the pressed key code, but no char is available.
4036 * Ex: 'AltGr + d` in Polish. There is no modified character for
4037 * this key combination and no character is inserted into the
4038 * document, but FF fires the keypress for char code `100` anyway.
4039 * No `input` event will occur.
4040 *
4041 * - `which` is the pressed key code, but a command combination is
4042 * being used. Ex: `Cmd+C`. No character is inserted, and no
4043 * `input` event will occur.
4044 */
4045 if (!isKeypressCommand(nativeEvent)) {
4046 // IE fires the `keypress` event when a user types an emoji via
4047 // Touch keyboard of Windows. In such a case, the `char` property
4048 // holds an emoji character like `\uD83D\uDE0A`. Because its length
4049 // is 2, the property `which` does not represent an emoji correctly.
4050 // In such a case, we directly return the `char` property instead of
4051 // using `which`.
4052 if (nativeEvent.char && nativeEvent.char.length > 1) {
4053 return nativeEvent.char;
4054 } else if (nativeEvent.which) {
4055 return String.fromCharCode(nativeEvent.which);
4056 }
4057 }
4058 return null;
4059 case TOP_COMPOSITION_END:
4060 return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
4061 default:
4062 return null;
4063 }
4064}
4065
4066/**
4067 * Extract a SyntheticInputEvent for `beforeInput`, based on either native
4068 * `textInput` or fallback behavior.
4069 *
4070 * @return {?object} A SyntheticInputEvent.
4071 */
4072function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
4073 var chars = void 0;
4074
4075 if (canUseTextInputEvent) {
4076 chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
4077 } else {
4078 chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
4079 }
4080
4081 // If no characters are being inserted, no BeforeInput event should
4082 // be fired.
4083 if (!chars) {
4084 return null;
4085 }
4086
4087 var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
4088
4089 event.data = chars;
4090 accumulateTwoPhaseDispatches(event);
4091 return event;
4092}
4093
4094/**
4095 * Create an `onBeforeInput` event to match
4096 * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
4097 *
4098 * This event plugin is based on the native `textInput` event
4099 * available in Chrome, Safari, Opera, and IE. This event fires after
4100 * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
4101 *
4102 * `beforeInput` is spec'd but not implemented in any browsers, and
4103 * the `input` event does not provide any useful information about what has
4104 * actually been added, contrary to the spec. Thus, `textInput` is the best
4105 * available event to identify the characters that have actually been inserted
4106 * into the target node.
4107 *
4108 * This plugin is also responsible for emitting `composition` events, thus
4109 * allowing us to share composition fallback code for both `beforeInput` and
4110 * `composition` event types.
4111 */
4112var BeforeInputEventPlugin = {
4113 eventTypes: eventTypes,
4114
4115 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
4116 var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
4117
4118 var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
4119
4120 if (composition === null) {
4121 return beforeInput;
4122 }
4123
4124 if (beforeInput === null) {
4125 return composition;
4126 }
4127
4128 return [composition, beforeInput];
4129 }
4130};
4131
4132// Use to restore controlled state after a change event has fired.
4133
4134var restoreImpl = null;
4135var restoreTarget = null;
4136var restoreQueue = null;
4137
4138function restoreStateOfTarget(target) {
4139 // We perform this translation at the end of the event loop so that we
4140 // always receive the correct fiber here
4141 var internalInstance = getInstanceFromNode(target);
4142 if (!internalInstance) {
4143 // Unmounted
4144 return;
4145 }
4146 !(typeof restoreImpl === 'function') ? invariant(false, 'setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0;
4147 var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
4148 restoreImpl(internalInstance.stateNode, internalInstance.type, props);
4149}
4150
4151function setRestoreImplementation(impl) {
4152 restoreImpl = impl;
4153}
4154
4155function enqueueStateRestore(target) {
4156 if (restoreTarget) {
4157 if (restoreQueue) {
4158 restoreQueue.push(target);
4159 } else {
4160 restoreQueue = [target];
4161 }
4162 } else {
4163 restoreTarget = target;
4164 }
4165}
4166
4167function needsStateRestore() {
4168 return restoreTarget !== null || restoreQueue !== null;
4169}
4170
4171function restoreStateIfNeeded() {
4172 if (!restoreTarget) {
4173 return;
4174 }
4175 var target = restoreTarget;
4176 var queuedTargets = restoreQueue;
4177 restoreTarget = null;
4178 restoreQueue = null;
4179
4180 restoreStateOfTarget(target);
4181 if (queuedTargets) {
4182 for (var i = 0; i < queuedTargets.length; i++) {
4183 restoreStateOfTarget(queuedTargets[i]);
4184 }
4185 }
4186}
4187
4188// Used as a way to call batchedUpdates when we don't have a reference to
4189// the renderer. Such as when we're dispatching events or if third party
4190// libraries need to call batchedUpdates. Eventually, this API will go away when
4191// everything is batched by default. We'll then have a similar API to opt-out of
4192// scheduled work and instead do synchronous work.
4193
4194// Defaults
4195var _batchedUpdatesImpl = function (fn, bookkeeping) {
4196 return fn(bookkeeping);
4197};
4198var _interactiveUpdatesImpl = function (fn, a, b) {
4199 return fn(a, b);
4200};
4201var _flushInteractiveUpdatesImpl = function () {};
4202
4203var isBatching = false;
4204function batchedUpdates(fn, bookkeeping) {
4205 if (isBatching) {
4206 // If we are currently inside another batch, we need to wait until it
4207 // fully completes before restoring state.
4208 return fn(bookkeeping);
4209 }
4210 isBatching = true;
4211 try {
4212 return _batchedUpdatesImpl(fn, bookkeeping);
4213 } finally {
4214 // Here we wait until all updates have propagated, which is important
4215 // when using controlled components within layers:
4216 // https://github.com/facebook/react/issues/1698
4217 // Then we restore state of any controlled component.
4218 isBatching = false;
4219 var controlledComponentsHavePendingUpdates = needsStateRestore();
4220 if (controlledComponentsHavePendingUpdates) {
4221 // If a controlled event was fired, we may need to restore the state of
4222 // the DOM node back to the controlled value. This is necessary when React
4223 // bails out of the update without touching the DOM.
4224 _flushInteractiveUpdatesImpl();
4225 restoreStateIfNeeded();
4226 }
4227 }
4228}
4229
4230function interactiveUpdates(fn, a, b) {
4231 return _interactiveUpdatesImpl(fn, a, b);
4232}
4233
4234
4235
4236function setBatchingImplementation(batchedUpdatesImpl, interactiveUpdatesImpl, flushInteractiveUpdatesImpl) {
4237 _batchedUpdatesImpl = batchedUpdatesImpl;
4238 _interactiveUpdatesImpl = interactiveUpdatesImpl;
4239 _flushInteractiveUpdatesImpl = flushInteractiveUpdatesImpl;
4240}
4241
4242/**
4243 * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
4244 */
4245var supportedInputTypes = {
4246 color: true,
4247 date: true,
4248 datetime: true,
4249 'datetime-local': true,
4250 email: true,
4251 month: true,
4252 number: true,
4253 password: true,
4254 range: true,
4255 search: true,
4256 tel: true,
4257 text: true,
4258 time: true,
4259 url: true,
4260 week: true
4261};
4262
4263function isTextInputElement(elem) {
4264 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
4265
4266 if (nodeName === 'input') {
4267 return !!supportedInputTypes[elem.type];
4268 }
4269
4270 if (nodeName === 'textarea') {
4271 return true;
4272 }
4273
4274 return false;
4275}
4276
4277/**
4278 * HTML nodeType values that represent the type of the node
4279 */
4280
4281var ELEMENT_NODE = 1;
4282var TEXT_NODE = 3;
4283var COMMENT_NODE = 8;
4284var DOCUMENT_NODE = 9;
4285var DOCUMENT_FRAGMENT_NODE = 11;
4286
4287/**
4288 * Gets the target node from a native browser event by accounting for
4289 * inconsistencies in browser DOM APIs.
4290 *
4291 * @param {object} nativeEvent Native browser event.
4292 * @return {DOMEventTarget} Target node.
4293 */
4294function getEventTarget(nativeEvent) {
4295 // Fallback to nativeEvent.srcElement for IE9
4296 // https://github.com/facebook/react/issues/12506
4297 var target = nativeEvent.target || nativeEvent.srcElement || window;
4298
4299 // Normalize SVG <use> element events #4963
4300 if (target.correspondingUseElement) {
4301 target = target.correspondingUseElement;
4302 }
4303
4304 // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
4305 // @see http://www.quirksmode.org/js/events_properties.html
4306 return target.nodeType === TEXT_NODE ? target.parentNode : target;
4307}
4308
4309/**
4310 * Checks if an event is supported in the current execution environment.
4311 *
4312 * NOTE: This will not work correctly for non-generic events such as `change`,
4313 * `reset`, `load`, `error`, and `select`.
4314 *
4315 * Borrows from Modernizr.
4316 *
4317 * @param {string} eventNameSuffix Event name, e.g. "click".
4318 * @return {boolean} True if the event is supported.
4319 * @internal
4320 * @license Modernizr 3.0.0pre (Custom Build) | MIT
4321 */
4322function isEventSupported(eventNameSuffix) {
4323 if (!canUseDOM) {
4324 return false;
4325 }
4326
4327 var eventName = 'on' + eventNameSuffix;
4328 var isSupported = eventName in document;
4329
4330 if (!isSupported) {
4331 var element = document.createElement('div');
4332 element.setAttribute(eventName, 'return;');
4333 isSupported = typeof element[eventName] === 'function';
4334 }
4335
4336 return isSupported;
4337}
4338
4339function isCheckable(elem) {
4340 var type = elem.type;
4341 var nodeName = elem.nodeName;
4342 return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
4343}
4344
4345function getTracker(node) {
4346 return node._valueTracker;
4347}
4348
4349function detachTracker(node) {
4350 node._valueTracker = null;
4351}
4352
4353function getValueFromNode(node) {
4354 var value = '';
4355 if (!node) {
4356 return value;
4357 }
4358
4359 if (isCheckable(node)) {
4360 value = node.checked ? 'true' : 'false';
4361 } else {
4362 value = node.value;
4363 }
4364
4365 return value;
4366}
4367
4368function trackValueOnNode(node) {
4369 var valueField = isCheckable(node) ? 'checked' : 'value';
4370 var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
4371
4372 var currentValue = '' + node[valueField];
4373
4374 // if someone has already defined a value or Safari, then bail
4375 // and don't track value will cause over reporting of changes,
4376 // but it's better then a hard failure
4377 // (needed for certain tests that spyOn input values and Safari)
4378 if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
4379 return;
4380 }
4381 var get = descriptor.get,
4382 set = descriptor.set;
4383
4384 Object.defineProperty(node, valueField, {
4385 configurable: true,
4386 get: function () {
4387 return get.call(this);
4388 },
4389 set: function (value) {
4390 currentValue = '' + value;
4391 set.call(this, value);
4392 }
4393 });
4394 // We could've passed this the first time
4395 // but it triggers a bug in IE11 and Edge 14/15.
4396 // Calling defineProperty() again should be equivalent.
4397 // https://github.com/facebook/react/issues/11768
4398 Object.defineProperty(node, valueField, {
4399 enumerable: descriptor.enumerable
4400 });
4401
4402 var tracker = {
4403 getValue: function () {
4404 return currentValue;
4405 },
4406 setValue: function (value) {
4407 currentValue = '' + value;
4408 },
4409 stopTracking: function () {
4410 detachTracker(node);
4411 delete node[valueField];
4412 }
4413 };
4414 return tracker;
4415}
4416
4417function track(node) {
4418 if (getTracker(node)) {
4419 return;
4420 }
4421
4422 // TODO: Once it's just Fiber we can move this to node._wrapperState
4423 node._valueTracker = trackValueOnNode(node);
4424}
4425
4426function updateValueIfChanged(node) {
4427 if (!node) {
4428 return false;
4429 }
4430
4431 var tracker = getTracker(node);
4432 // if there is no tracker at this point it's unlikely
4433 // that trying again will succeed
4434 if (!tracker) {
4435 return true;
4436 }
4437
4438 var lastValue = tracker.getValue();
4439 var nextValue = getValueFromNode(node);
4440 if (nextValue !== lastValue) {
4441 tracker.setValue(nextValue);
4442 return true;
4443 }
4444 return false;
4445}
4446
4447var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
4448
4449var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
4450
4451var describeComponentFrame = function (name, source, ownerName) {
4452 var sourceInfo = '';
4453 if (source) {
4454 var path = source.fileName;
4455 var fileName = path.replace(BEFORE_SLASH_RE, '');
4456 {
4457 // In DEV, include code for a common special case:
4458 // prefer "folder/index.js" instead of just "index.js".
4459 if (/^index\./.test(fileName)) {
4460 var match = path.match(BEFORE_SLASH_RE);
4461 if (match) {
4462 var pathBeforeSlash = match[1];
4463 if (pathBeforeSlash) {
4464 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
4465 fileName = folderName + '/' + fileName;
4466 }
4467 }
4468 }
4469 }
4470 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
4471 } else if (ownerName) {
4472 sourceInfo = ' (created by ' + ownerName + ')';
4473 }
4474 return '\n in ' + (name || 'Unknown') + sourceInfo;
4475};
4476
4477// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
4478// nor polyfill, then a plain number is used for performance.
4479var hasSymbol = typeof Symbol === 'function' && Symbol.for;
4480
4481var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
4482var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
4483var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
4484var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
4485var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
4486var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
4487var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
4488
4489var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
4490var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
4491var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
4492var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
4493var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
4494
4495var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
4496var FAUX_ITERATOR_SYMBOL = '@@iterator';
4497
4498function getIteratorFn(maybeIterable) {
4499 if (maybeIterable === null || typeof maybeIterable !== 'object') {
4500 return null;
4501 }
4502 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
4503 if (typeof maybeIterator === 'function') {
4504 return maybeIterator;
4505 }
4506 return null;
4507}
4508
4509var Pending = 0;
4510var Resolved = 1;
4511var Rejected = 2;
4512
4513function refineResolvedLazyComponent(lazyComponent) {
4514 return lazyComponent._status === Resolved ? lazyComponent._result : null;
4515}
4516
4517function getWrappedName(outerType, innerType, wrapperName) {
4518 var functionName = innerType.displayName || innerType.name || '';
4519 return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
4520}
4521
4522function getComponentName(type) {
4523 if (type == null) {
4524 // Host root, text node or just invalid type.
4525 return null;
4526 }
4527 {
4528 if (typeof type.tag === 'number') {
4529 warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
4530 }
4531 }
4532 if (typeof type === 'function') {
4533 return type.displayName || type.name || null;
4534 }
4535 if (typeof type === 'string') {
4536 return type;
4537 }
4538 switch (type) {
4539 case REACT_CONCURRENT_MODE_TYPE:
4540 return 'ConcurrentMode';
4541 case REACT_FRAGMENT_TYPE:
4542 return 'Fragment';
4543 case REACT_PORTAL_TYPE:
4544 return 'Portal';
4545 case REACT_PROFILER_TYPE:
4546 return 'Profiler';
4547 case REACT_STRICT_MODE_TYPE:
4548 return 'StrictMode';
4549 case REACT_SUSPENSE_TYPE:
4550 return 'Suspense';
4551 }
4552 if (typeof type === 'object') {
4553 switch (type.$$typeof) {
4554 case REACT_CONTEXT_TYPE:
4555 return 'Context.Consumer';
4556 case REACT_PROVIDER_TYPE:
4557 return 'Context.Provider';
4558 case REACT_FORWARD_REF_TYPE:
4559 return getWrappedName(type, type.render, 'ForwardRef');
4560 case REACT_MEMO_TYPE:
4561 return getComponentName(type.type);
4562 case REACT_LAZY_TYPE:
4563 {
4564 var thenable = type;
4565 var resolvedThenable = refineResolvedLazyComponent(thenable);
4566 if (resolvedThenable) {
4567 return getComponentName(resolvedThenable);
4568 }
4569 }
4570 }
4571 }
4572 return null;
4573}
4574
4575var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
4576
4577function describeFiber(fiber) {
4578 switch (fiber.tag) {
4579 case HostRoot:
4580 case HostPortal:
4581 case HostText:
4582 case Fragment:
4583 case ContextProvider:
4584 case ContextConsumer:
4585 return '';
4586 default:
4587 var owner = fiber._debugOwner;
4588 var source = fiber._debugSource;
4589 var name = getComponentName(fiber.type);
4590 var ownerName = null;
4591 if (owner) {
4592 ownerName = getComponentName(owner.type);
4593 }
4594 return describeComponentFrame(name, source, ownerName);
4595 }
4596}
4597
4598function getStackByFiberInDevAndProd(workInProgress) {
4599 var info = '';
4600 var node = workInProgress;
4601 do {
4602 info += describeFiber(node);
4603 node = node.return;
4604 } while (node);
4605 return info;
4606}
4607
4608var current = null;
4609var phase = null;
4610
4611function getCurrentFiberOwnerNameInDevOrNull() {
4612 {
4613 if (current === null) {
4614 return null;
4615 }
4616 var owner = current._debugOwner;
4617 if (owner !== null && typeof owner !== 'undefined') {
4618 return getComponentName(owner.type);
4619 }
4620 }
4621 return null;
4622}
4623
4624function getCurrentFiberStackInDev() {
4625 {
4626 if (current === null) {
4627 return '';
4628 }
4629 // Safe because if current fiber exists, we are reconciling,
4630 // and it is guaranteed to be the work-in-progress version.
4631 return getStackByFiberInDevAndProd(current);
4632 }
4633 return '';
4634}
4635
4636function resetCurrentFiber() {
4637 {
4638 ReactDebugCurrentFrame.getCurrentStack = null;
4639 current = null;
4640 phase = null;
4641 }
4642}
4643
4644function setCurrentFiber(fiber) {
4645 {
4646 ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev;
4647 current = fiber;
4648 phase = null;
4649 }
4650}
4651
4652function setCurrentPhase(lifeCyclePhase) {
4653 {
4654 phase = lifeCyclePhase;
4655 }
4656}
4657
4658/**
4659 * Similar to invariant but only logs a warning if the condition is not met.
4660 * This can be used to log issues in development environments in critical
4661 * paths. Removing the logging code for production environments will keep the
4662 * same logic and follow the same code paths.
4663 */
4664
4665var warning = warningWithoutStack$1;
4666
4667{
4668 warning = function (condition, format) {
4669 if (condition) {
4670 return;
4671 }
4672 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
4673 var stack = ReactDebugCurrentFrame.getStackAddendum();
4674 // eslint-disable-next-line react-internal/warning-and-invariant-args
4675
4676 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
4677 args[_key - 2] = arguments[_key];
4678 }
4679
4680 warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
4681 };
4682}
4683
4684var warning$1 = warning;
4685
4686// A reserved attribute.
4687// It is handled by React separately and shouldn't be written to the DOM.
4688var RESERVED = 0;
4689
4690// A simple string attribute.
4691// Attributes that aren't in the whitelist are presumed to have this type.
4692var STRING = 1;
4693
4694// A string attribute that accepts booleans in React. In HTML, these are called
4695// "enumerated" attributes with "true" and "false" as possible values.
4696// When true, it should be set to a "true" string.
4697// When false, it should be set to a "false" string.
4698var BOOLEANISH_STRING = 2;
4699
4700// A real boolean attribute.
4701// When true, it should be present (set either to an empty string or its name).
4702// When false, it should be omitted.
4703var BOOLEAN = 3;
4704
4705// An attribute that can be used as a flag as well as with a value.
4706// When true, it should be present (set either to an empty string or its name).
4707// When false, it should be omitted.
4708// For any other value, should be present with that value.
4709var OVERLOADED_BOOLEAN = 4;
4710
4711// An attribute that must be numeric or parse as a numeric.
4712// When falsy, it should be removed.
4713var NUMERIC = 5;
4714
4715// An attribute that must be positive numeric or parse as a positive numeric.
4716// When falsy, it should be removed.
4717var POSITIVE_NUMERIC = 6;
4718
4719/* eslint-disable max-len */
4720var 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';
4721/* eslint-enable max-len */
4722var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
4723
4724
4725var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
4726var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
4727
4728var hasOwnProperty = Object.prototype.hasOwnProperty;
4729var illegalAttributeNameCache = {};
4730var validatedAttributeNameCache = {};
4731
4732function isAttributeNameSafe(attributeName) {
4733 if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
4734 return true;
4735 }
4736 if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
4737 return false;
4738 }
4739 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
4740 validatedAttributeNameCache[attributeName] = true;
4741 return true;
4742 }
4743 illegalAttributeNameCache[attributeName] = true;
4744 {
4745 warning$1(false, 'Invalid attribute name: `%s`', attributeName);
4746 }
4747 return false;
4748}
4749
4750function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
4751 if (propertyInfo !== null) {
4752 return propertyInfo.type === RESERVED;
4753 }
4754 if (isCustomComponentTag) {
4755 return false;
4756 }
4757 if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
4758 return true;
4759 }
4760 return false;
4761}
4762
4763function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
4764 if (propertyInfo !== null && propertyInfo.type === RESERVED) {
4765 return false;
4766 }
4767 switch (typeof value) {
4768 case 'function':
4769 // $FlowIssue symbol is perfectly valid here
4770 case 'symbol':
4771 // eslint-disable-line
4772 return true;
4773 case 'boolean':
4774 {
4775 if (isCustomComponentTag) {
4776 return false;
4777 }
4778 if (propertyInfo !== null) {
4779 return !propertyInfo.acceptsBooleans;
4780 } else {
4781 var prefix = name.toLowerCase().slice(0, 5);
4782 return prefix !== 'data-' && prefix !== 'aria-';
4783 }
4784 }
4785 default:
4786 return false;
4787 }
4788}
4789
4790function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
4791 if (value === null || typeof value === 'undefined') {
4792 return true;
4793 }
4794 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
4795 return true;
4796 }
4797 if (isCustomComponentTag) {
4798 return false;
4799 }
4800 if (propertyInfo !== null) {
4801 switch (propertyInfo.type) {
4802 case BOOLEAN:
4803 return !value;
4804 case OVERLOADED_BOOLEAN:
4805 return value === false;
4806 case NUMERIC:
4807 return isNaN(value);
4808 case POSITIVE_NUMERIC:
4809 return isNaN(value) || value < 1;
4810 }
4811 }
4812 return false;
4813}
4814
4815function getPropertyInfo(name) {
4816 return properties.hasOwnProperty(name) ? properties[name] : null;
4817}
4818
4819function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
4820 this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
4821 this.attributeName = attributeName;
4822 this.attributeNamespace = attributeNamespace;
4823 this.mustUseProperty = mustUseProperty;
4824 this.propertyName = name;
4825 this.type = type;
4826}
4827
4828// When adding attributes to this list, be sure to also add them to
4829// the `possibleStandardNames` module to ensure casing and incorrect
4830// name warnings.
4831var properties = {};
4832
4833// These props are reserved by React. They shouldn't be written to the DOM.
4834['children', 'dangerouslySetInnerHTML',
4835// TODO: This prevents the assignment of defaultValue to regular
4836// elements (not just inputs). Now that ReactDOMInput assigns to the
4837// defaultValue property -- do we need this?
4838'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
4839 properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
4840 name, // attributeName
4841 null);
4842} // attributeNamespace
4843);
4844
4845// A few React string attributes have a different name.
4846// This is a mapping from React prop names to the attribute names.
4847[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
4848 var name = _ref[0],
4849 attributeName = _ref[1];
4850
4851 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
4852 attributeName, // attributeName
4853 null);
4854} // attributeNamespace
4855);
4856
4857// These are "enumerated" HTML attributes that accept "true" and "false".
4858// In React, we let users pass `true` and `false` even though technically
4859// these aren't boolean attributes (they are coerced to strings).
4860['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
4861 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
4862 name.toLowerCase(), // attributeName
4863 null);
4864} // attributeNamespace
4865);
4866
4867// These are "enumerated" SVG attributes that accept "true" and "false".
4868// In React, we let users pass `true` and `false` even though technically
4869// these aren't boolean attributes (they are coerced to strings).
4870// Since these are SVG attributes, their attribute names are case-sensitive.
4871['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
4872 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
4873 name, // attributeName
4874 null);
4875} // attributeNamespace
4876);
4877
4878// These are HTML boolean attributes.
4879['allowFullScreen', 'async',
4880// Note: there is a special case that prevents it from being written to the DOM
4881// on the client side because the browsers are inconsistent. Instead we call focus().
4882'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
4883// Microdata
4884'itemScope'].forEach(function (name) {
4885 properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
4886 name.toLowerCase(), // attributeName
4887 null);
4888} // attributeNamespace
4889);
4890
4891// These are the few React props that we set as DOM properties
4892// rather than attributes. These are all booleans.
4893['checked',
4894// Note: `option.selected` is not updated if `select.multiple` is
4895// disabled with `removeAttribute`. We have special logic for handling this.
4896'multiple', 'muted', 'selected'].forEach(function (name) {
4897 properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
4898 name, // attributeName
4899 null);
4900} // attributeNamespace
4901);
4902
4903// These are HTML attributes that are "overloaded booleans": they behave like
4904// booleans, but can also accept a string value.
4905['capture', 'download'].forEach(function (name) {
4906 properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
4907 name, // attributeName
4908 null);
4909} // attributeNamespace
4910);
4911
4912// These are HTML attributes that must be positive numbers.
4913['cols', 'rows', 'size', 'span'].forEach(function (name) {
4914 properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
4915 name, // attributeName
4916 null);
4917} // attributeNamespace
4918);
4919
4920// These are HTML attributes that must be numbers.
4921['rowSpan', 'start'].forEach(function (name) {
4922 properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
4923 name.toLowerCase(), // attributeName
4924 null);
4925} // attributeNamespace
4926);
4927
4928var CAMELIZE = /[\-\:]([a-z])/g;
4929var capitalize = function (token) {
4930 return token[1].toUpperCase();
4931};
4932
4933// This is a list of all SVG attributes that need special casing, namespacing,
4934// or boolean value assignment. Regular attributes that just accept strings
4935// and have the same names are omitted, just like in the HTML whitelist.
4936// Some of these attributes can be hard to find. This list was created by
4937// scrapping the MDN documentation.
4938['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) {
4939 var name = attributeName.replace(CAMELIZE, capitalize);
4940 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
4941 attributeName, null);
4942} // attributeNamespace
4943);
4944
4945// String SVG attributes with the xlink namespace.
4946['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
4947 var name = attributeName.replace(CAMELIZE, capitalize);
4948 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
4949 attributeName, 'http://www.w3.org/1999/xlink');
4950});
4951
4952// String SVG attributes with the xml namespace.
4953['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
4954 var name = attributeName.replace(CAMELIZE, capitalize);
4955 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
4956 attributeName, 'http://www.w3.org/XML/1998/namespace');
4957});
4958
4959// Special case: this attribute exists both in HTML and SVG.
4960// Its "tabindex" attribute name is case-sensitive in SVG so we can't just use
4961// its React `tabIndex` name, like we do for attributes that exist only in HTML.
4962properties.tabIndex = new PropertyInfoRecord('tabIndex', STRING, false, // mustUseProperty
4963'tabindex', // attributeName
4964null);
4965
4966/**
4967 * Get the value for a property on a node. Only used in DEV for SSR validation.
4968 * The "expected" argument is used as a hint of what the expected value is.
4969 * Some properties have multiple equivalent values.
4970 */
4971function getValueForProperty(node, name, expected, propertyInfo) {
4972 {
4973 if (propertyInfo.mustUseProperty) {
4974 var propertyName = propertyInfo.propertyName;
4975
4976 return node[propertyName];
4977 } else {
4978 var attributeName = propertyInfo.attributeName;
4979
4980 var stringValue = null;
4981
4982 if (propertyInfo.type === OVERLOADED_BOOLEAN) {
4983 if (node.hasAttribute(attributeName)) {
4984 var value = node.getAttribute(attributeName);
4985 if (value === '') {
4986 return true;
4987 }
4988 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
4989 return value;
4990 }
4991 if (value === '' + expected) {
4992 return expected;
4993 }
4994 return value;
4995 }
4996 } else if (node.hasAttribute(attributeName)) {
4997 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
4998 // We had an attribute but shouldn't have had one, so read it
4999 // for the error message.
5000 return node.getAttribute(attributeName);
5001 }
5002 if (propertyInfo.type === BOOLEAN) {
5003 // If this was a boolean, it doesn't matter what the value is
5004 // the fact that we have it is the same as the expected.
5005 return expected;
5006 }
5007 // Even if this property uses a namespace we use getAttribute
5008 // because we assume its namespaced name is the same as our config.
5009 // To use getAttributeNS we need the local name which we don't have
5010 // in our config atm.
5011 stringValue = node.getAttribute(attributeName);
5012 }
5013
5014 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
5015 return stringValue === null ? expected : stringValue;
5016 } else if (stringValue === '' + expected) {
5017 return expected;
5018 } else {
5019 return stringValue;
5020 }
5021 }
5022 }
5023}
5024
5025/**
5026 * Get the value for a attribute on a node. Only used in DEV for SSR validation.
5027 * The third argument is used as a hint of what the expected value is. Some
5028 * attributes have multiple equivalent values.
5029 */
5030function getValueForAttribute(node, name, expected) {
5031 {
5032 if (!isAttributeNameSafe(name)) {
5033 return;
5034 }
5035 if (!node.hasAttribute(name)) {
5036 return expected === undefined ? undefined : null;
5037 }
5038 var value = node.getAttribute(name);
5039 if (value === '' + expected) {
5040 return expected;
5041 }
5042 return value;
5043 }
5044}
5045
5046/**
5047 * Sets the value for a property on a node.
5048 *
5049 * @param {DOMElement} node
5050 * @param {string} name
5051 * @param {*} value
5052 */
5053function setValueForProperty(node, name, value, isCustomComponentTag) {
5054 var propertyInfo = getPropertyInfo(name);
5055 if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
5056 return;
5057 }
5058 if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
5059 value = null;
5060 }
5061 // If the prop isn't in the special list, treat it as a simple attribute.
5062 if (isCustomComponentTag || propertyInfo === null) {
5063 if (isAttributeNameSafe(name)) {
5064 var _attributeName = name;
5065 if (value === null) {
5066 node.removeAttribute(_attributeName);
5067 } else {
5068 node.setAttribute(_attributeName, '' + value);
5069 }
5070 }
5071 return;
5072 }
5073 var mustUseProperty = propertyInfo.mustUseProperty;
5074
5075 if (mustUseProperty) {
5076 var propertyName = propertyInfo.propertyName;
5077
5078 if (value === null) {
5079 var type = propertyInfo.type;
5080
5081 node[propertyName] = type === BOOLEAN ? false : '';
5082 } else {
5083 // Contrary to `setAttribute`, object properties are properly
5084 // `toString`ed by IE8/9.
5085 node[propertyName] = value;
5086 }
5087 return;
5088 }
5089 // The rest are treated as attributes with special cases.
5090 var attributeName = propertyInfo.attributeName,
5091 attributeNamespace = propertyInfo.attributeNamespace;
5092
5093 if (value === null) {
5094 node.removeAttribute(attributeName);
5095 } else {
5096 var _type = propertyInfo.type;
5097
5098 var attributeValue = void 0;
5099 if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
5100 attributeValue = '';
5101 } else {
5102 // `setAttribute` with objects becomes only `[object]` in IE8/9,
5103 // ('' + value) makes it output the correct toString()-value.
5104 attributeValue = '' + value;
5105 }
5106 if (attributeNamespace) {
5107 node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
5108 } else {
5109 node.setAttribute(attributeName, attributeValue);
5110 }
5111 }
5112}
5113
5114// Flow does not allow string concatenation of most non-string types. To work
5115// around this limitation, we use an opaque type that can only be obtained by
5116// passing the value through getToStringValue first.
5117function toString(value) {
5118 return '' + value;
5119}
5120
5121function getToStringValue(value) {
5122 switch (typeof value) {
5123 case 'boolean':
5124 case 'number':
5125 case 'object':
5126 case 'string':
5127 case 'undefined':
5128 return value;
5129 default:
5130 // function, symbol are assigned as empty strings
5131 return '';
5132 }
5133}
5134
5135var ReactDebugCurrentFrame$1 = null;
5136
5137var ReactControlledValuePropTypes = {
5138 checkPropTypes: null
5139};
5140
5141{
5142 ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
5143
5144 var hasReadOnlyValue = {
5145 button: true,
5146 checkbox: true,
5147 image: true,
5148 hidden: true,
5149 radio: true,
5150 reset: true,
5151 submit: true
5152 };
5153
5154 var propTypes = {
5155 value: function (props, propName, componentName) {
5156 if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
5157 return null;
5158 }
5159 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`.');
5160 },
5161 checked: function (props, propName, componentName) {
5162 if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
5163 return null;
5164 }
5165 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`.');
5166 }
5167 };
5168
5169 /**
5170 * Provide a linked `value` attribute for controlled forms. You should not use
5171 * this outside of the ReactDOM controlled form components.
5172 */
5173 ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
5174 checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
5175 };
5176}
5177
5178var enableUserTimingAPI = true;
5179
5180var enableHooks = false;
5181// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
5182var debugRenderPhaseSideEffects = false;
5183
5184// In some cases, StrictMode should also double-render lifecycles.
5185// This can be confusing for tests though,
5186// And it can be bad for performance in production.
5187// This feature flag can be used to control the behavior:
5188var debugRenderPhaseSideEffectsForStrictMode = true;
5189
5190// To preserve the "Pause on caught exceptions" behavior of the debugger, we
5191// replay the begin phase of a failed component inside invokeGuardedCallback.
5192var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
5193
5194// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
5195var warnAboutDeprecatedLifecycles = false;
5196
5197// Gather advanced timing metrics for Profiler subtrees.
5198var enableProfilerTimer = true;
5199
5200// Trace which interactions trigger each commit.
5201var enableSchedulerTracing = true;
5202
5203// Only used in www builds.
5204 // TODO: true? Here it might just be false.
5205
5206// Only used in www builds.
5207
5208
5209// Only used in www builds.
5210
5211
5212// React Fire: prevent the value and checked attributes from syncing
5213// with their related DOM properties
5214var disableInputAttributeSyncing = false;
5215
5216// These APIs will no longer be "unstable" in the upcoming 16.7 release,
5217// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
5218var enableStableConcurrentModeAPIs = false;
5219
5220var warnAboutShorthandPropertyCollision = false;
5221
5222// TODO: direct imports like some-package/src/* are bad. Fix me.
5223var didWarnValueDefaultValue = false;
5224var didWarnCheckedDefaultChecked = false;
5225var didWarnControlledToUncontrolled = false;
5226var didWarnUncontrolledToControlled = false;
5227
5228function isControlled(props) {
5229 var usesChecked = props.type === 'checkbox' || props.type === 'radio';
5230 return usesChecked ? props.checked != null : props.value != null;
5231}
5232
5233/**
5234 * Implements an <input> host component that allows setting these optional
5235 * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
5236 *
5237 * If `checked` or `value` are not supplied (or null/undefined), user actions
5238 * that affect the checked state or value will trigger updates to the element.
5239 *
5240 * If they are supplied (and not null/undefined), the rendered element will not
5241 * trigger updates to the element. Instead, the props must change in order for
5242 * the rendered element to be updated.
5243 *
5244 * The rendered element will be initialized as unchecked (or `defaultChecked`)
5245 * with an empty value (or `defaultValue`).
5246 *
5247 * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
5248 */
5249
5250function getHostProps(element, props) {
5251 var node = element;
5252 var checked = props.checked;
5253
5254 var hostProps = _assign({}, props, {
5255 defaultChecked: undefined,
5256 defaultValue: undefined,
5257 value: undefined,
5258 checked: checked != null ? checked : node._wrapperState.initialChecked
5259 });
5260
5261 return hostProps;
5262}
5263
5264function initWrapperState(element, props) {
5265 {
5266 ReactControlledValuePropTypes.checkPropTypes('input', props);
5267
5268 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
5269 warning$1(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', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
5270 didWarnCheckedDefaultChecked = true;
5271 }
5272 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
5273 warning$1(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', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
5274 didWarnValueDefaultValue = true;
5275 }
5276 }
5277
5278 var node = element;
5279 var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
5280
5281 node._wrapperState = {
5282 initialChecked: props.checked != null ? props.checked : props.defaultChecked,
5283 initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
5284 controlled: isControlled(props)
5285 };
5286}
5287
5288function updateChecked(element, props) {
5289 var node = element;
5290 var checked = props.checked;
5291 if (checked != null) {
5292 setValueForProperty(node, 'checked', checked, false);
5293 }
5294}
5295
5296function updateWrapper(element, props) {
5297 var node = element;
5298 {
5299 var _controlled = isControlled(props);
5300
5301 if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) {
5302 warning$1(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', props.type);
5303 didWarnUncontrolledToControlled = true;
5304 }
5305 if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) {
5306 warning$1(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', props.type);
5307 didWarnControlledToUncontrolled = true;
5308 }
5309 }
5310
5311 updateChecked(element, props);
5312
5313 var value = getToStringValue(props.value);
5314 var type = props.type;
5315
5316 if (value != null) {
5317 if (type === 'number') {
5318 if (value === 0 && node.value === '' ||
5319 // We explicitly want to coerce to number here if possible.
5320 // eslint-disable-next-line
5321 node.value != value) {
5322 node.value = toString(value);
5323 }
5324 } else if (node.value !== toString(value)) {
5325 node.value = toString(value);
5326 }
5327 } else if (type === 'submit' || type === 'reset') {
5328 // Submit/reset inputs need the attribute removed completely to avoid
5329 // blank-text buttons.
5330 node.removeAttribute('value');
5331 return;
5332 }
5333
5334 if (disableInputAttributeSyncing) {
5335 // When not syncing the value attribute, React only assigns a new value
5336 // whenever the defaultValue React prop has changed. When not present,
5337 // React does nothing
5338 if (props.hasOwnProperty('defaultValue')) {
5339 setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
5340 }
5341 } else {
5342 // When syncing the value attribute, the value comes from a cascade of
5343 // properties:
5344 // 1. The value React property
5345 // 2. The defaultValue React property
5346 // 3. Otherwise there should be no change
5347 if (props.hasOwnProperty('value')) {
5348 setDefaultValue(node, props.type, value);
5349 } else if (props.hasOwnProperty('defaultValue')) {
5350 setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
5351 }
5352 }
5353
5354 if (disableInputAttributeSyncing) {
5355 // When not syncing the checked attribute, the attribute is directly
5356 // controllable from the defaultValue React property. It needs to be
5357 // updated as new props come in.
5358 if (props.defaultChecked == null) {
5359 node.removeAttribute('checked');
5360 } else {
5361 node.defaultChecked = !!props.defaultChecked;
5362 }
5363 } else {
5364 // When syncing the checked attribute, it only changes when it needs
5365 // to be removed, such as transitioning from a checkbox into a text input
5366 if (props.checked == null && props.defaultChecked != null) {
5367 node.defaultChecked = !!props.defaultChecked;
5368 }
5369 }
5370}
5371
5372function postMountWrapper(element, props, isHydrating) {
5373 var node = element;
5374
5375 // Do not assign value if it is already set. This prevents user text input
5376 // from being lost during SSR hydration.
5377 if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
5378 var type = props.type;
5379 var isButton = type === 'submit' || type === 'reset';
5380
5381 // Avoid setting value attribute on submit/reset inputs as it overrides the
5382 // default value provided by the browser. See: #12872
5383 if (isButton && (props.value === undefined || props.value === null)) {
5384 return;
5385 }
5386
5387 var _initialValue = toString(node._wrapperState.initialValue);
5388
5389 // Do not assign value if it is already set. This prevents user text input
5390 // from being lost during SSR hydration.
5391 if (!isHydrating) {
5392 if (disableInputAttributeSyncing) {
5393 var value = getToStringValue(props.value);
5394
5395 // When not syncing the value attribute, the value property points
5396 // directly to the React prop. Only assign it if it exists.
5397 if (value != null) {
5398 // Always assign on buttons so that it is possible to assign an
5399 // empty string to clear button text.
5400 //
5401 // Otherwise, do not re-assign the value property if is empty. This
5402 // potentially avoids a DOM write and prevents Firefox (~60.0.1) from
5403 // prematurely marking required inputs as invalid. Equality is compared
5404 // to the current value in case the browser provided value is not an
5405 // empty string.
5406 if (isButton || value !== node.value) {
5407 node.value = toString(value);
5408 }
5409 }
5410 } else {
5411 // When syncing the value attribute, the value property should use
5412 // the wrapperState._initialValue property. This uses:
5413 //
5414 // 1. The value React property when present
5415 // 2. The defaultValue React property when present
5416 // 3. An empty string
5417 if (_initialValue !== node.value) {
5418 node.value = _initialValue;
5419 }
5420 }
5421 }
5422
5423 if (disableInputAttributeSyncing) {
5424 // When not syncing the value attribute, assign the value attribute
5425 // directly from the defaultValue React property (when present)
5426 var defaultValue = getToStringValue(props.defaultValue);
5427 if (defaultValue != null) {
5428 node.defaultValue = toString(defaultValue);
5429 }
5430 } else {
5431 // Otherwise, the value attribute is synchronized to the property,
5432 // so we assign defaultValue to the same thing as the value property
5433 // assignment step above.
5434 node.defaultValue = _initialValue;
5435 }
5436 }
5437
5438 // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
5439 // this is needed to work around a chrome bug where setting defaultChecked
5440 // will sometimes influence the value of checked (even after detachment).
5441 // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
5442 // We need to temporarily unset name to avoid disrupting radio button groups.
5443 var name = node.name;
5444 if (name !== '') {
5445 node.name = '';
5446 }
5447
5448 if (disableInputAttributeSyncing) {
5449 // When not syncing the checked attribute, the checked property
5450 // never gets assigned. It must be manually set. We don't want
5451 // to do this when hydrating so that existing user input isn't
5452 // modified
5453 if (!isHydrating) {
5454 updateChecked(element, props);
5455 }
5456
5457 // Only assign the checked attribute if it is defined. This saves
5458 // a DOM write when controlling the checked attribute isn't needed
5459 // (text inputs, submit/reset)
5460 if (props.hasOwnProperty('defaultChecked')) {
5461 node.defaultChecked = !node.defaultChecked;
5462 node.defaultChecked = !!props.defaultChecked;
5463 }
5464 } else {
5465 // When syncing the checked attribute, both the checked property and
5466 // attribute are assigned at the same time using defaultChecked. This uses:
5467 //
5468 // 1. The checked React property when present
5469 // 2. The defaultChecked React property when present
5470 // 3. Otherwise, false
5471 node.defaultChecked = !node.defaultChecked;
5472 node.defaultChecked = !!node._wrapperState.initialChecked;
5473 }
5474
5475 if (name !== '') {
5476 node.name = name;
5477 }
5478}
5479
5480function restoreControlledState(element, props) {
5481 var node = element;
5482 updateWrapper(node, props);
5483 updateNamedCousins(node, props);
5484}
5485
5486function updateNamedCousins(rootNode, props) {
5487 var name = props.name;
5488 if (props.type === 'radio' && name != null) {
5489 var queryRoot = rootNode;
5490
5491 while (queryRoot.parentNode) {
5492 queryRoot = queryRoot.parentNode;
5493 }
5494
5495 // If `rootNode.form` was non-null, then we could try `form.elements`,
5496 // but that sometimes behaves strangely in IE8. We could also try using
5497 // `form.getElementsByName`, but that will only return direct children
5498 // and won't include inputs that use the HTML5 `form=` attribute. Since
5499 // the input might not even be in a form. It might not even be in the
5500 // document. Let's just use the local `querySelectorAll` to ensure we don't
5501 // miss anything.
5502 var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
5503
5504 for (var i = 0; i < group.length; i++) {
5505 var otherNode = group[i];
5506 if (otherNode === rootNode || otherNode.form !== rootNode.form) {
5507 continue;
5508 }
5509 // This will throw if radio buttons rendered by different copies of React
5510 // and the same name are rendered into the same form (same as #1939).
5511 // That's probably okay; we don't support it just as we don't support
5512 // mixing React radio buttons with non-React ones.
5513 var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
5514 !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0;
5515
5516 // We need update the tracked value on the named cousin since the value
5517 // was changed but the input saw no event or value set
5518 updateValueIfChanged(otherNode);
5519
5520 // If this is a controlled radio button group, forcing the input that
5521 // was previously checked to update will cause it to be come re-checked
5522 // as appropriate.
5523 updateWrapper(otherNode, otherProps);
5524 }
5525 }
5526}
5527
5528// In Chrome, assigning defaultValue to certain input types triggers input validation.
5529// For number inputs, the display value loses trailing decimal points. For email inputs,
5530// Chrome raises "The specified value <x> is not a valid email address".
5531//
5532// Here we check to see if the defaultValue has actually changed, avoiding these problems
5533// when the user is inputting text
5534//
5535// https://github.com/facebook/react/issues/7253
5536function setDefaultValue(node, type, value) {
5537 if (
5538 // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
5539 type !== 'number' || node.ownerDocument.activeElement !== node) {
5540 if (value == null) {
5541 node.defaultValue = toString(node._wrapperState.initialValue);
5542 } else if (node.defaultValue !== toString(value)) {
5543 node.defaultValue = toString(value);
5544 }
5545 }
5546}
5547
5548var eventTypes$1 = {
5549 change: {
5550 phasedRegistrationNames: {
5551 bubbled: 'onChange',
5552 captured: 'onChangeCapture'
5553 },
5554 dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE]
5555 }
5556};
5557
5558function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
5559 var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target);
5560 event.type = 'change';
5561 // Flag this event loop as needing state restore.
5562 enqueueStateRestore(target);
5563 accumulateTwoPhaseDispatches(event);
5564 return event;
5565}
5566/**
5567 * For IE shims
5568 */
5569var activeElement = null;
5570var activeElementInst = null;
5571
5572/**
5573 * SECTION: handle `change` event
5574 */
5575function shouldUseChangeEvent(elem) {
5576 var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
5577 return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
5578}
5579
5580function manualDispatchChangeEvent(nativeEvent) {
5581 var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent));
5582
5583 // If change and propertychange bubbled, we'd just bind to it like all the
5584 // other events and have it go through ReactBrowserEventEmitter. Since it
5585 // doesn't, we manually listen for the events and so we have to enqueue and
5586 // process the abstract event manually.
5587 //
5588 // Batching is necessary here in order to ensure that all event handlers run
5589 // before the next rerender (including event handlers attached to ancestor
5590 // elements instead of directly on the input). Without this, controlled
5591 // components don't work properly in conjunction with event bubbling because
5592 // the component is rerendered and the value reverted before all the event
5593 // handlers can run. See https://github.com/facebook/react/issues/708.
5594 batchedUpdates(runEventInBatch, event);
5595}
5596
5597function runEventInBatch(event) {
5598 runEventsInBatch(event);
5599}
5600
5601function getInstIfValueChanged(targetInst) {
5602 var targetNode = getNodeFromInstance$1(targetInst);
5603 if (updateValueIfChanged(targetNode)) {
5604 return targetInst;
5605 }
5606}
5607
5608function getTargetInstForChangeEvent(topLevelType, targetInst) {
5609 if (topLevelType === TOP_CHANGE) {
5610 return targetInst;
5611 }
5612}
5613
5614/**
5615 * SECTION: handle `input` event
5616 */
5617var isInputEventSupported = false;
5618if (canUseDOM) {
5619 // IE9 claims to support the input event but fails to trigger it when
5620 // deleting text, so we ignore its input events.
5621 isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
5622}
5623
5624/**
5625 * (For IE <=9) Starts tracking propertychange events on the passed-in element
5626 * and override the value property so that we can distinguish user events from
5627 * value changes in JS.
5628 */
5629function startWatchingForValueChange(target, targetInst) {
5630 activeElement = target;
5631 activeElementInst = targetInst;
5632 activeElement.attachEvent('onpropertychange', handlePropertyChange);
5633}
5634
5635/**
5636 * (For IE <=9) Removes the event listeners from the currently-tracked element,
5637 * if any exists.
5638 */
5639function stopWatchingForValueChange() {
5640 if (!activeElement) {
5641 return;
5642 }
5643 activeElement.detachEvent('onpropertychange', handlePropertyChange);
5644 activeElement = null;
5645 activeElementInst = null;
5646}
5647
5648/**
5649 * (For IE <=9) Handles a propertychange event, sending a `change` event if
5650 * the value of the active element has changed.
5651 */
5652function handlePropertyChange(nativeEvent) {
5653 if (nativeEvent.propertyName !== 'value') {
5654 return;
5655 }
5656 if (getInstIfValueChanged(activeElementInst)) {
5657 manualDispatchChangeEvent(nativeEvent);
5658 }
5659}
5660
5661function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
5662 if (topLevelType === TOP_FOCUS) {
5663 // In IE9, propertychange fires for most input events but is buggy and
5664 // doesn't fire when text is deleted, but conveniently, selectionchange
5665 // appears to fire in all of the remaining cases so we catch those and
5666 // forward the event if the value has changed
5667 // In either case, we don't want to call the event handler if the value
5668 // is changed from JS so we redefine a setter for `.value` that updates
5669 // our activeElementValue variable, allowing us to ignore those changes
5670 //
5671 // stopWatching() should be a noop here but we call it just in case we
5672 // missed a blur event somehow.
5673 stopWatchingForValueChange();
5674 startWatchingForValueChange(target, targetInst);
5675 } else if (topLevelType === TOP_BLUR) {
5676 stopWatchingForValueChange();
5677 }
5678}
5679
5680// For IE8 and IE9.
5681function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
5682 if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) {
5683 // On the selectionchange event, the target is just document which isn't
5684 // helpful for us so just check activeElement instead.
5685 //
5686 // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
5687 // propertychange on the first input event after setting `value` from a
5688 // script and fires only keydown, keypress, keyup. Catching keyup usually
5689 // gets it and catching keydown lets us fire an event for the first
5690 // keystroke if user does a key repeat (it'll be a little delayed: right
5691 // before the second keystroke). Other input methods (e.g., paste) seem to
5692 // fire selectionchange normally.
5693 return getInstIfValueChanged(activeElementInst);
5694 }
5695}
5696
5697/**
5698 * SECTION: handle `click` event
5699 */
5700function shouldUseClickEvent(elem) {
5701 // Use the `click` event to detect changes to checkbox and radio inputs.
5702 // This approach works across all browsers, whereas `change` does not fire
5703 // until `blur` in IE8.
5704 var nodeName = elem.nodeName;
5705 return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
5706}
5707
5708function getTargetInstForClickEvent(topLevelType, targetInst) {
5709 if (topLevelType === TOP_CLICK) {
5710 return getInstIfValueChanged(targetInst);
5711 }
5712}
5713
5714function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
5715 if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) {
5716 return getInstIfValueChanged(targetInst);
5717 }
5718}
5719
5720function handleControlledInputBlur(node) {
5721 var state = node._wrapperState;
5722
5723 if (!state || !state.controlled || node.type !== 'number') {
5724 return;
5725 }
5726
5727 if (!disableInputAttributeSyncing) {
5728 // If controlled, assign the value attribute to the current value on blur
5729 setDefaultValue(node, 'number', node.value);
5730 }
5731}
5732
5733/**
5734 * This plugin creates an `onChange` event that normalizes change events
5735 * across form elements. This event fires at a time when it's possible to
5736 * change the element's value without seeing a flicker.
5737 *
5738 * Supported elements are:
5739 * - input (see `isTextInputElement`)
5740 * - textarea
5741 * - select
5742 */
5743var ChangeEventPlugin = {
5744 eventTypes: eventTypes$1,
5745
5746 _isInputEventSupported: isInputEventSupported,
5747
5748 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
5749 var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
5750
5751 var getTargetInstFunc = void 0,
5752 handleEventFunc = void 0;
5753 if (shouldUseChangeEvent(targetNode)) {
5754 getTargetInstFunc = getTargetInstForChangeEvent;
5755 } else if (isTextInputElement(targetNode)) {
5756 if (isInputEventSupported) {
5757 getTargetInstFunc = getTargetInstForInputOrChangeEvent;
5758 } else {
5759 getTargetInstFunc = getTargetInstForInputEventPolyfill;
5760 handleEventFunc = handleEventsForInputEventPolyfill;
5761 }
5762 } else if (shouldUseClickEvent(targetNode)) {
5763 getTargetInstFunc = getTargetInstForClickEvent;
5764 }
5765
5766 if (getTargetInstFunc) {
5767 var inst = getTargetInstFunc(topLevelType, targetInst);
5768 if (inst) {
5769 var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
5770 return event;
5771 }
5772 }
5773
5774 if (handleEventFunc) {
5775 handleEventFunc(topLevelType, targetNode, targetInst);
5776 }
5777
5778 // When blurring, set the value attribute for number inputs
5779 if (topLevelType === TOP_BLUR) {
5780 handleControlledInputBlur(targetNode);
5781 }
5782 }
5783};
5784
5785/**
5786 * Module that is injectable into `EventPluginHub`, that specifies a
5787 * deterministic ordering of `EventPlugin`s. A convenient way to reason about
5788 * plugins, without having to package every one of them. This is better than
5789 * having plugins be ordered in the same order that they are injected because
5790 * that ordering would be influenced by the packaging order.
5791 * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
5792 * preventing default on events is convenient in `SimpleEventPlugin` handlers.
5793 */
5794var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
5795
5796var SyntheticUIEvent = SyntheticEvent.extend({
5797 view: null,
5798 detail: null
5799});
5800
5801var modifierKeyToProp = {
5802 Alt: 'altKey',
5803 Control: 'ctrlKey',
5804 Meta: 'metaKey',
5805 Shift: 'shiftKey'
5806};
5807
5808// Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
5809// getModifierState. If getModifierState is not supported, we map it to a set of
5810// modifier keys exposed by the event. In this case, Lock-keys are not supported.
5811/**
5812 * Translation from modifier key to the associated property in the event.
5813 * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
5814 */
5815
5816function modifierStateGetter(keyArg) {
5817 var syntheticEvent = this;
5818 var nativeEvent = syntheticEvent.nativeEvent;
5819 if (nativeEvent.getModifierState) {
5820 return nativeEvent.getModifierState(keyArg);
5821 }
5822 var keyProp = modifierKeyToProp[keyArg];
5823 return keyProp ? !!nativeEvent[keyProp] : false;
5824}
5825
5826function getEventModifierState(nativeEvent) {
5827 return modifierStateGetter;
5828}
5829
5830var previousScreenX = 0;
5831var previousScreenY = 0;
5832// Use flags to signal movementX/Y has already been set
5833var isMovementXSet = false;
5834var isMovementYSet = false;
5835
5836/**
5837 * @interface MouseEvent
5838 * @see http://www.w3.org/TR/DOM-Level-3-Events/
5839 */
5840var SyntheticMouseEvent = SyntheticUIEvent.extend({
5841 screenX: null,
5842 screenY: null,
5843 clientX: null,
5844 clientY: null,
5845 pageX: null,
5846 pageY: null,
5847 ctrlKey: null,
5848 shiftKey: null,
5849 altKey: null,
5850 metaKey: null,
5851 getModifierState: getEventModifierState,
5852 button: null,
5853 buttons: null,
5854 relatedTarget: function (event) {
5855 return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
5856 },
5857 movementX: function (event) {
5858 if ('movementX' in event) {
5859 return event.movementX;
5860 }
5861
5862 var screenX = previousScreenX;
5863 previousScreenX = event.screenX;
5864
5865 if (!isMovementXSet) {
5866 isMovementXSet = true;
5867 return 0;
5868 }
5869
5870 return event.type === 'mousemove' ? event.screenX - screenX : 0;
5871 },
5872 movementY: function (event) {
5873 if ('movementY' in event) {
5874 return event.movementY;
5875 }
5876
5877 var screenY = previousScreenY;
5878 previousScreenY = event.screenY;
5879
5880 if (!isMovementYSet) {
5881 isMovementYSet = true;
5882 return 0;
5883 }
5884
5885 return event.type === 'mousemove' ? event.screenY - screenY : 0;
5886 }
5887});
5888
5889/**
5890 * @interface PointerEvent
5891 * @see http://www.w3.org/TR/pointerevents/
5892 */
5893var SyntheticPointerEvent = SyntheticMouseEvent.extend({
5894 pointerId: null,
5895 width: null,
5896 height: null,
5897 pressure: null,
5898 tangentialPressure: null,
5899 tiltX: null,
5900 tiltY: null,
5901 twist: null,
5902 pointerType: null,
5903 isPrimary: null
5904});
5905
5906var eventTypes$2 = {
5907 mouseEnter: {
5908 registrationName: 'onMouseEnter',
5909 dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
5910 },
5911 mouseLeave: {
5912 registrationName: 'onMouseLeave',
5913 dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
5914 },
5915 pointerEnter: {
5916 registrationName: 'onPointerEnter',
5917 dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
5918 },
5919 pointerLeave: {
5920 registrationName: 'onPointerLeave',
5921 dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
5922 }
5923};
5924
5925var EnterLeaveEventPlugin = {
5926 eventTypes: eventTypes$2,
5927
5928 /**
5929 * For almost every interaction we care about, there will be both a top-level
5930 * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
5931 * we do not extract duplicate events. However, moving the mouse into the
5932 * browser from outside will not fire a `mouseout` event. In this case, we use
5933 * the `mouseover` top-level event.
5934 */
5935 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
5936 var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
5937 var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT;
5938
5939 if (isOverEvent && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
5940 return null;
5941 }
5942
5943 if (!isOutEvent && !isOverEvent) {
5944 // Must not be a mouse or pointer in or out - ignoring.
5945 return null;
5946 }
5947
5948 var win = void 0;
5949 if (nativeEventTarget.window === nativeEventTarget) {
5950 // `nativeEventTarget` is probably a window object.
5951 win = nativeEventTarget;
5952 } else {
5953 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
5954 var doc = nativeEventTarget.ownerDocument;
5955 if (doc) {
5956 win = doc.defaultView || doc.parentWindow;
5957 } else {
5958 win = window;
5959 }
5960 }
5961
5962 var from = void 0;
5963 var to = void 0;
5964 if (isOutEvent) {
5965 from = targetInst;
5966 var related = nativeEvent.relatedTarget || nativeEvent.toElement;
5967 to = related ? getClosestInstanceFromNode(related) : null;
5968 } else {
5969 // Moving to a node from outside the window.
5970 from = null;
5971 to = targetInst;
5972 }
5973
5974 if (from === to) {
5975 // Nothing pertains to our managed components.
5976 return null;
5977 }
5978
5979 var eventInterface = void 0,
5980 leaveEventType = void 0,
5981 enterEventType = void 0,
5982 eventTypePrefix = void 0;
5983
5984 if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
5985 eventInterface = SyntheticMouseEvent;
5986 leaveEventType = eventTypes$2.mouseLeave;
5987 enterEventType = eventTypes$2.mouseEnter;
5988 eventTypePrefix = 'mouse';
5989 } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) {
5990 eventInterface = SyntheticPointerEvent;
5991 leaveEventType = eventTypes$2.pointerLeave;
5992 enterEventType = eventTypes$2.pointerEnter;
5993 eventTypePrefix = 'pointer';
5994 }
5995
5996 var fromNode = from == null ? win : getNodeFromInstance$1(from);
5997 var toNode = to == null ? win : getNodeFromInstance$1(to);
5998
5999 var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget);
6000 leave.type = eventTypePrefix + 'leave';
6001 leave.target = fromNode;
6002 leave.relatedTarget = toNode;
6003
6004 var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget);
6005 enter.type = eventTypePrefix + 'enter';
6006 enter.target = toNode;
6007 enter.relatedTarget = fromNode;
6008
6009 accumulateEnterLeaveDispatches(leave, enter, from, to);
6010
6011 return [leave, enter];
6012 }
6013};
6014
6015/*eslint-disable no-self-compare */
6016
6017var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
6018
6019/**
6020 * inlined Object.is polyfill to avoid requiring consumers ship their own
6021 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
6022 */
6023function is(x, y) {
6024 // SameValue algorithm
6025 if (x === y) {
6026 // Steps 1-5, 7-10
6027 // Steps 6.b-6.e: +0 != -0
6028 // Added the nonzero y check to make Flow happy, but it is redundant
6029 return x !== 0 || y !== 0 || 1 / x === 1 / y;
6030 } else {
6031 // Step 6.a: NaN == NaN
6032 return x !== x && y !== y;
6033 }
6034}
6035
6036/**
6037 * Performs equality by iterating through keys on an object and returning false
6038 * when any key has values which are not strictly equal between the arguments.
6039 * Returns true when the values of all keys are strictly equal.
6040 */
6041function shallowEqual(objA, objB) {
6042 if (is(objA, objB)) {
6043 return true;
6044 }
6045
6046 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
6047 return false;
6048 }
6049
6050 var keysA = Object.keys(objA);
6051 var keysB = Object.keys(objB);
6052
6053 if (keysA.length !== keysB.length) {
6054 return false;
6055 }
6056
6057 // Test for A's keys different from B.
6058 for (var i = 0; i < keysA.length; i++) {
6059 if (!hasOwnProperty$1.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
6060 return false;
6061 }
6062 }
6063
6064 return true;
6065}
6066
6067/**
6068 * `ReactInstanceMap` maintains a mapping from a public facing stateful
6069 * instance (key) and the internal representation (value). This allows public
6070 * methods to accept the user facing instance as an argument and map them back
6071 * to internal methods.
6072 *
6073 * Note that this module is currently shared and assumed to be stateless.
6074 * If this becomes an actual Map, that will break.
6075 */
6076
6077/**
6078 * This API should be called `delete` but we'd have to make sure to always
6079 * transform these to strings for IE support. When this transform is fully
6080 * supported we can rename it.
6081 */
6082
6083
6084function get(key) {
6085 return key._reactInternalFiber;
6086}
6087
6088function has(key) {
6089 return key._reactInternalFiber !== undefined;
6090}
6091
6092function set(key, value) {
6093 key._reactInternalFiber = value;
6094}
6095
6096// Don't change these two values. They're used by React Dev Tools.
6097var NoEffect = /* */0;
6098var PerformedWork = /* */1;
6099
6100// You can change the rest (and add more).
6101var Placement = /* */2;
6102var Update = /* */4;
6103var PlacementAndUpdate = /* */6;
6104var Deletion = /* */8;
6105var ContentReset = /* */16;
6106var Callback = /* */32;
6107var DidCapture = /* */64;
6108var Ref = /* */128;
6109var Snapshot = /* */256;
6110var Passive = /* */512;
6111
6112// Passive & Update & Callback & Ref & Snapshot
6113var LifecycleEffectMask = /* */932;
6114
6115// Union of all host effects
6116var HostEffectMask = /* */1023;
6117
6118var Incomplete = /* */1024;
6119var ShouldCapture = /* */2048;
6120
6121var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
6122
6123var MOUNTING = 1;
6124var MOUNTED = 2;
6125var UNMOUNTED = 3;
6126
6127function isFiberMountedImpl(fiber) {
6128 var node = fiber;
6129 if (!fiber.alternate) {
6130 // If there is no alternate, this might be a new tree that isn't inserted
6131 // yet. If it is, then it will have a pending insertion effect on it.
6132 if ((node.effectTag & Placement) !== NoEffect) {
6133 return MOUNTING;
6134 }
6135 while (node.return) {
6136 node = node.return;
6137 if ((node.effectTag & Placement) !== NoEffect) {
6138 return MOUNTING;
6139 }
6140 }
6141 } else {
6142 while (node.return) {
6143 node = node.return;
6144 }
6145 }
6146 if (node.tag === HostRoot) {
6147 // TODO: Check if this was a nested HostRoot when used with
6148 // renderContainerIntoSubtree.
6149 return MOUNTED;
6150 }
6151 // If we didn't hit the root, that means that we're in an disconnected tree
6152 // that has been unmounted.
6153 return UNMOUNTED;
6154}
6155
6156function isFiberMounted(fiber) {
6157 return isFiberMountedImpl(fiber) === MOUNTED;
6158}
6159
6160function isMounted(component) {
6161 {
6162 var owner = ReactCurrentOwner$1.current;
6163 if (owner !== null && owner.tag === ClassComponent) {
6164 var ownerFiber = owner;
6165 var instance = ownerFiber.stateNode;
6166 !instance._warnedAboutRefsInRender ? warningWithoutStack$1(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.type) || 'A component') : void 0;
6167 instance._warnedAboutRefsInRender = true;
6168 }
6169 }
6170
6171 var fiber = get(component);
6172 if (!fiber) {
6173 return false;
6174 }
6175 return isFiberMountedImpl(fiber) === MOUNTED;
6176}
6177
6178function assertIsMounted(fiber) {
6179 !(isFiberMountedImpl(fiber) === MOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
6180}
6181
6182function findCurrentFiberUsingSlowPath(fiber) {
6183 var alternate = fiber.alternate;
6184 if (!alternate) {
6185 // If there is no alternate, then we only need to check if it is mounted.
6186 var state = isFiberMountedImpl(fiber);
6187 !(state !== UNMOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
6188 if (state === MOUNTING) {
6189 return null;
6190 }
6191 return fiber;
6192 }
6193 // If we have two possible branches, we'll walk backwards up to the root
6194 // to see what path the root points to. On the way we may hit one of the
6195 // special cases and we'll deal with them.
6196 var a = fiber;
6197 var b = alternate;
6198 while (true) {
6199 var parentA = a.return;
6200 var parentB = parentA ? parentA.alternate : null;
6201 if (!parentA || !parentB) {
6202 // We're at the root.
6203 break;
6204 }
6205
6206 // If both copies of the parent fiber point to the same child, we can
6207 // assume that the child is current. This happens when we bailout on low
6208 // priority: the bailed out fiber's child reuses the current child.
6209 if (parentA.child === parentB.child) {
6210 var child = parentA.child;
6211 while (child) {
6212 if (child === a) {
6213 // We've determined that A is the current branch.
6214 assertIsMounted(parentA);
6215 return fiber;
6216 }
6217 if (child === b) {
6218 // We've determined that B is the current branch.
6219 assertIsMounted(parentA);
6220 return alternate;
6221 }
6222 child = child.sibling;
6223 }
6224 // We should never have an alternate for any mounting node. So the only
6225 // way this could possibly happen is if this was unmounted, if at all.
6226 invariant(false, 'Unable to find node on an unmounted component.');
6227 }
6228
6229 if (a.return !== b.return) {
6230 // The return pointer of A and the return pointer of B point to different
6231 // fibers. We assume that return pointers never criss-cross, so A must
6232 // belong to the child set of A.return, and B must belong to the child
6233 // set of B.return.
6234 a = parentA;
6235 b = parentB;
6236 } else {
6237 // The return pointers point to the same fiber. We'll have to use the
6238 // default, slow path: scan the child sets of each parent alternate to see
6239 // which child belongs to which set.
6240 //
6241 // Search parent A's child set
6242 var didFindChild = false;
6243 var _child = parentA.child;
6244 while (_child) {
6245 if (_child === a) {
6246 didFindChild = true;
6247 a = parentA;
6248 b = parentB;
6249 break;
6250 }
6251 if (_child === b) {
6252 didFindChild = true;
6253 b = parentA;
6254 a = parentB;
6255 break;
6256 }
6257 _child = _child.sibling;
6258 }
6259 if (!didFindChild) {
6260 // Search parent B's child set
6261 _child = parentB.child;
6262 while (_child) {
6263 if (_child === a) {
6264 didFindChild = true;
6265 a = parentB;
6266 b = parentA;
6267 break;
6268 }
6269 if (_child === b) {
6270 didFindChild = true;
6271 b = parentB;
6272 a = parentA;
6273 break;
6274 }
6275 _child = _child.sibling;
6276 }
6277 !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;
6278 }
6279 }
6280
6281 !(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;
6282 }
6283 // If the root is not a host container, we're in a disconnected tree. I.e.
6284 // unmounted.
6285 !(a.tag === HostRoot) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
6286 if (a.stateNode.current === a) {
6287 // We've determined that A is the current branch.
6288 return fiber;
6289 }
6290 // Otherwise B has to be current branch.
6291 return alternate;
6292}
6293
6294function findCurrentHostFiber(parent) {
6295 var currentParent = findCurrentFiberUsingSlowPath(parent);
6296 if (!currentParent) {
6297 return null;
6298 }
6299
6300 // Next we'll drill down this component to find the first HostComponent/Text.
6301 var node = currentParent;
6302 while (true) {
6303 if (node.tag === HostComponent || node.tag === HostText) {
6304 return node;
6305 } else if (node.child) {
6306 node.child.return = node;
6307 node = node.child;
6308 continue;
6309 }
6310 if (node === currentParent) {
6311 return null;
6312 }
6313 while (!node.sibling) {
6314 if (!node.return || node.return === currentParent) {
6315 return null;
6316 }
6317 node = node.return;
6318 }
6319 node.sibling.return = node.return;
6320 node = node.sibling;
6321 }
6322 // Flow needs the return null here, but ESLint complains about it.
6323 // eslint-disable-next-line no-unreachable
6324 return null;
6325}
6326
6327function findCurrentHostFiberWithNoPortals(parent) {
6328 var currentParent = findCurrentFiberUsingSlowPath(parent);
6329 if (!currentParent) {
6330 return null;
6331 }
6332
6333 // Next we'll drill down this component to find the first HostComponent/Text.
6334 var node = currentParent;
6335 while (true) {
6336 if (node.tag === HostComponent || node.tag === HostText) {
6337 return node;
6338 } else if (node.child && node.tag !== HostPortal) {
6339 node.child.return = node;
6340 node = node.child;
6341 continue;
6342 }
6343 if (node === currentParent) {
6344 return null;
6345 }
6346 while (!node.sibling) {
6347 if (!node.return || node.return === currentParent) {
6348 return null;
6349 }
6350 node = node.return;
6351 }
6352 node.sibling.return = node.return;
6353 node = node.sibling;
6354 }
6355 // Flow needs the return null here, but ESLint complains about it.
6356 // eslint-disable-next-line no-unreachable
6357 return null;
6358}
6359
6360function addEventBubbleListener(element, eventType, listener) {
6361 element.addEventListener(eventType, listener, false);
6362}
6363
6364function addEventCaptureListener(element, eventType, listener) {
6365 element.addEventListener(eventType, listener, true);
6366}
6367
6368/**
6369 * @interface Event
6370 * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
6371 * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
6372 */
6373var SyntheticAnimationEvent = SyntheticEvent.extend({
6374 animationName: null,
6375 elapsedTime: null,
6376 pseudoElement: null
6377});
6378
6379/**
6380 * @interface Event
6381 * @see http://www.w3.org/TR/clipboard-apis/
6382 */
6383var SyntheticClipboardEvent = SyntheticEvent.extend({
6384 clipboardData: function (event) {
6385 return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
6386 }
6387});
6388
6389/**
6390 * @interface FocusEvent
6391 * @see http://www.w3.org/TR/DOM-Level-3-Events/
6392 */
6393var SyntheticFocusEvent = SyntheticUIEvent.extend({
6394 relatedTarget: null
6395});
6396
6397/**
6398 * `charCode` represents the actual "character code" and is safe to use with
6399 * `String.fromCharCode`. As such, only keys that correspond to printable
6400 * characters produce a valid `charCode`, the only exception to this is Enter.
6401 * The Tab-key is considered non-printable and does not have a `charCode`,
6402 * presumably because it does not produce a tab-character in browsers.
6403 *
6404 * @param {object} nativeEvent Native browser event.
6405 * @return {number} Normalized `charCode` property.
6406 */
6407function getEventCharCode(nativeEvent) {
6408 var charCode = void 0;
6409 var keyCode = nativeEvent.keyCode;
6410
6411 if ('charCode' in nativeEvent) {
6412 charCode = nativeEvent.charCode;
6413
6414 // FF does not set `charCode` for the Enter-key, check against `keyCode`.
6415 if (charCode === 0 && keyCode === 13) {
6416 charCode = 13;
6417 }
6418 } else {
6419 // IE8 does not implement `charCode`, but `keyCode` has the correct value.
6420 charCode = keyCode;
6421 }
6422
6423 // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
6424 // report Enter as charCode 10 when ctrl is pressed.
6425 if (charCode === 10) {
6426 charCode = 13;
6427 }
6428
6429 // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
6430 // Must not discard the (non-)printable Enter-key.
6431 if (charCode >= 32 || charCode === 13) {
6432 return charCode;
6433 }
6434
6435 return 0;
6436}
6437
6438/**
6439 * Normalization of deprecated HTML5 `key` values
6440 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
6441 */
6442var normalizeKey = {
6443 Esc: 'Escape',
6444 Spacebar: ' ',
6445 Left: 'ArrowLeft',
6446 Up: 'ArrowUp',
6447 Right: 'ArrowRight',
6448 Down: 'ArrowDown',
6449 Del: 'Delete',
6450 Win: 'OS',
6451 Menu: 'ContextMenu',
6452 Apps: 'ContextMenu',
6453 Scroll: 'ScrollLock',
6454 MozPrintableKey: 'Unidentified'
6455};
6456
6457/**
6458 * Translation from legacy `keyCode` to HTML5 `key`
6459 * Only special keys supported, all others depend on keyboard layout or browser
6460 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
6461 */
6462var translateToKey = {
6463 '8': 'Backspace',
6464 '9': 'Tab',
6465 '12': 'Clear',
6466 '13': 'Enter',
6467 '16': 'Shift',
6468 '17': 'Control',
6469 '18': 'Alt',
6470 '19': 'Pause',
6471 '20': 'CapsLock',
6472 '27': 'Escape',
6473 '32': ' ',
6474 '33': 'PageUp',
6475 '34': 'PageDown',
6476 '35': 'End',
6477 '36': 'Home',
6478 '37': 'ArrowLeft',
6479 '38': 'ArrowUp',
6480 '39': 'ArrowRight',
6481 '40': 'ArrowDown',
6482 '45': 'Insert',
6483 '46': 'Delete',
6484 '112': 'F1',
6485 '113': 'F2',
6486 '114': 'F3',
6487 '115': 'F4',
6488 '116': 'F5',
6489 '117': 'F6',
6490 '118': 'F7',
6491 '119': 'F8',
6492 '120': 'F9',
6493 '121': 'F10',
6494 '122': 'F11',
6495 '123': 'F12',
6496 '144': 'NumLock',
6497 '145': 'ScrollLock',
6498 '224': 'Meta'
6499};
6500
6501/**
6502 * @param {object} nativeEvent Native browser event.
6503 * @return {string} Normalized `key` property.
6504 */
6505function getEventKey(nativeEvent) {
6506 if (nativeEvent.key) {
6507 // Normalize inconsistent values reported by browsers due to
6508 // implementations of a working draft specification.
6509
6510 // FireFox implements `key` but returns `MozPrintableKey` for all
6511 // printable characters (normalized to `Unidentified`), ignore it.
6512 var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
6513 if (key !== 'Unidentified') {
6514 return key;
6515 }
6516 }
6517
6518 // Browser does not implement `key`, polyfill as much of it as we can.
6519 if (nativeEvent.type === 'keypress') {
6520 var charCode = getEventCharCode(nativeEvent);
6521
6522 // The enter-key is technically both printable and non-printable and can
6523 // thus be captured by `keypress`, no other non-printable key should.
6524 return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
6525 }
6526 if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
6527 // While user keyboard layout determines the actual meaning of each
6528 // `keyCode` value, almost all function keys have a universal value.
6529 return translateToKey[nativeEvent.keyCode] || 'Unidentified';
6530 }
6531 return '';
6532}
6533
6534/**
6535 * @interface KeyboardEvent
6536 * @see http://www.w3.org/TR/DOM-Level-3-Events/
6537 */
6538var SyntheticKeyboardEvent = SyntheticUIEvent.extend({
6539 key: getEventKey,
6540 location: null,
6541 ctrlKey: null,
6542 shiftKey: null,
6543 altKey: null,
6544 metaKey: null,
6545 repeat: null,
6546 locale: null,
6547 getModifierState: getEventModifierState,
6548 // Legacy Interface
6549 charCode: function (event) {
6550 // `charCode` is the result of a KeyPress event and represents the value of
6551 // the actual printable character.
6552
6553 // KeyPress is deprecated, but its replacement is not yet final and not
6554 // implemented in any major browser. Only KeyPress has charCode.
6555 if (event.type === 'keypress') {
6556 return getEventCharCode(event);
6557 }
6558 return 0;
6559 },
6560 keyCode: function (event) {
6561 // `keyCode` is the result of a KeyDown/Up event and represents the value of
6562 // physical keyboard key.
6563
6564 // The actual meaning of the value depends on the users' keyboard layout
6565 // which cannot be detected. Assuming that it is a US keyboard layout
6566 // provides a surprisingly accurate mapping for US and European users.
6567 // Due to this, it is left to the user to implement at this time.
6568 if (event.type === 'keydown' || event.type === 'keyup') {
6569 return event.keyCode;
6570 }
6571 return 0;
6572 },
6573 which: function (event) {
6574 // `which` is an alias for either `keyCode` or `charCode` depending on the
6575 // type of the event.
6576 if (event.type === 'keypress') {
6577 return getEventCharCode(event);
6578 }
6579 if (event.type === 'keydown' || event.type === 'keyup') {
6580 return event.keyCode;
6581 }
6582 return 0;
6583 }
6584});
6585
6586/**
6587 * @interface DragEvent
6588 * @see http://www.w3.org/TR/DOM-Level-3-Events/
6589 */
6590var SyntheticDragEvent = SyntheticMouseEvent.extend({
6591 dataTransfer: null
6592});
6593
6594/**
6595 * @interface TouchEvent
6596 * @see http://www.w3.org/TR/touch-events/
6597 */
6598var SyntheticTouchEvent = SyntheticUIEvent.extend({
6599 touches: null,
6600 targetTouches: null,
6601 changedTouches: null,
6602 altKey: null,
6603 metaKey: null,
6604 ctrlKey: null,
6605 shiftKey: null,
6606 getModifierState: getEventModifierState
6607});
6608
6609/**
6610 * @interface Event
6611 * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
6612 * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
6613 */
6614var SyntheticTransitionEvent = SyntheticEvent.extend({
6615 propertyName: null,
6616 elapsedTime: null,
6617 pseudoElement: null
6618});
6619
6620/**
6621 * @interface WheelEvent
6622 * @see http://www.w3.org/TR/DOM-Level-3-Events/
6623 */
6624var SyntheticWheelEvent = SyntheticMouseEvent.extend({
6625 deltaX: function (event) {
6626 return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
6627 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
6628 },
6629 deltaY: function (event) {
6630 return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
6631 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
6632 'wheelDelta' in event ? -event.wheelDelta : 0;
6633 },
6634
6635 deltaZ: null,
6636
6637 // Browsers without "deltaMode" is reporting in raw wheel delta where one
6638 // notch on the scroll is always +/- 120, roughly equivalent to pixels.
6639 // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
6640 // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
6641 deltaMode: null
6642});
6643
6644/**
6645 * Turns
6646 * ['abort', ...]
6647 * into
6648 * eventTypes = {
6649 * 'abort': {
6650 * phasedRegistrationNames: {
6651 * bubbled: 'onAbort',
6652 * captured: 'onAbortCapture',
6653 * },
6654 * dependencies: [TOP_ABORT],
6655 * },
6656 * ...
6657 * };
6658 * topLevelEventsToDispatchConfig = new Map([
6659 * [TOP_ABORT, { sameConfig }],
6660 * ]);
6661 */
6662
6663var interactiveEventTypeNames = [[TOP_BLUR, 'blur'], [TOP_CANCEL, 'cancel'], [TOP_CLICK, 'click'], [TOP_CLOSE, 'close'], [TOP_CONTEXT_MENU, 'contextMenu'], [TOP_COPY, 'copy'], [TOP_CUT, 'cut'], [TOP_AUX_CLICK, 'auxClick'], [TOP_DOUBLE_CLICK, 'doubleClick'], [TOP_DRAG_END, 'dragEnd'], [TOP_DRAG_START, 'dragStart'], [TOP_DROP, 'drop'], [TOP_FOCUS, 'focus'], [TOP_INPUT, 'input'], [TOP_INVALID, 'invalid'], [TOP_KEY_DOWN, 'keyDown'], [TOP_KEY_PRESS, 'keyPress'], [TOP_KEY_UP, 'keyUp'], [TOP_MOUSE_DOWN, 'mouseDown'], [TOP_MOUSE_UP, 'mouseUp'], [TOP_PASTE, 'paste'], [TOP_PAUSE, 'pause'], [TOP_PLAY, 'play'], [TOP_POINTER_CANCEL, 'pointerCancel'], [TOP_POINTER_DOWN, 'pointerDown'], [TOP_POINTER_UP, 'pointerUp'], [TOP_RATE_CHANGE, 'rateChange'], [TOP_RESET, 'reset'], [TOP_SEEKED, 'seeked'], [TOP_SUBMIT, 'submit'], [TOP_TOUCH_CANCEL, 'touchCancel'], [TOP_TOUCH_END, 'touchEnd'], [TOP_TOUCH_START, 'touchStart'], [TOP_VOLUME_CHANGE, 'volumeChange']];
6664var nonInteractiveEventTypeNames = [[TOP_ABORT, 'abort'], [TOP_ANIMATION_END, 'animationEnd'], [TOP_ANIMATION_ITERATION, 'animationIteration'], [TOP_ANIMATION_START, 'animationStart'], [TOP_CAN_PLAY, 'canPlay'], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough'], [TOP_DRAG, 'drag'], [TOP_DRAG_ENTER, 'dragEnter'], [TOP_DRAG_EXIT, 'dragExit'], [TOP_DRAG_LEAVE, 'dragLeave'], [TOP_DRAG_OVER, 'dragOver'], [TOP_DURATION_CHANGE, 'durationChange'], [TOP_EMPTIED, 'emptied'], [TOP_ENCRYPTED, 'encrypted'], [TOP_ENDED, 'ended'], [TOP_ERROR, 'error'], [TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture'], [TOP_LOAD, 'load'], [TOP_LOADED_DATA, 'loadedData'], [TOP_LOADED_METADATA, 'loadedMetadata'], [TOP_LOAD_START, 'loadStart'], [TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture'], [TOP_MOUSE_MOVE, 'mouseMove'], [TOP_MOUSE_OUT, 'mouseOut'], [TOP_MOUSE_OVER, 'mouseOver'], [TOP_PLAYING, 'playing'], [TOP_POINTER_MOVE, 'pointerMove'], [TOP_POINTER_OUT, 'pointerOut'], [TOP_POINTER_OVER, 'pointerOver'], [TOP_PROGRESS, 'progress'], [TOP_SCROLL, 'scroll'], [TOP_SEEKING, 'seeking'], [TOP_STALLED, 'stalled'], [TOP_SUSPEND, 'suspend'], [TOP_TIME_UPDATE, 'timeUpdate'], [TOP_TOGGLE, 'toggle'], [TOP_TOUCH_MOVE, 'touchMove'], [TOP_TRANSITION_END, 'transitionEnd'], [TOP_WAITING, 'waiting'], [TOP_WHEEL, 'wheel']];
6665
6666var eventTypes$4 = {};
6667var topLevelEventsToDispatchConfig = {};
6668
6669function addEventTypeNameToConfig(_ref, isInteractive) {
6670 var topEvent = _ref[0],
6671 event = _ref[1];
6672
6673 var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
6674 var onEvent = 'on' + capitalizedEvent;
6675
6676 var type = {
6677 phasedRegistrationNames: {
6678 bubbled: onEvent,
6679 captured: onEvent + 'Capture'
6680 },
6681 dependencies: [topEvent],
6682 isInteractive: isInteractive
6683 };
6684 eventTypes$4[event] = type;
6685 topLevelEventsToDispatchConfig[topEvent] = type;
6686}
6687
6688interactiveEventTypeNames.forEach(function (eventTuple) {
6689 addEventTypeNameToConfig(eventTuple, true);
6690});
6691nonInteractiveEventTypeNames.forEach(function (eventTuple) {
6692 addEventTypeNameToConfig(eventTuple, false);
6693});
6694
6695// Only used in DEV for exhaustiveness validation.
6696var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING];
6697
6698var SimpleEventPlugin = {
6699 eventTypes: eventTypes$4,
6700
6701 isInteractiveTopLevelEventType: function (topLevelType) {
6702 var config = topLevelEventsToDispatchConfig[topLevelType];
6703 return config !== undefined && config.isInteractive === true;
6704 },
6705
6706
6707 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
6708 var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
6709 if (!dispatchConfig) {
6710 return null;
6711 }
6712 var EventConstructor = void 0;
6713 switch (topLevelType) {
6714 case TOP_KEY_PRESS:
6715 // Firefox creates a keypress event for function keys too. This removes
6716 // the unwanted keypress events. Enter is however both printable and
6717 // non-printable. One would expect Tab to be as well (but it isn't).
6718 if (getEventCharCode(nativeEvent) === 0) {
6719 return null;
6720 }
6721 /* falls through */
6722 case TOP_KEY_DOWN:
6723 case TOP_KEY_UP:
6724 EventConstructor = SyntheticKeyboardEvent;
6725 break;
6726 case TOP_BLUR:
6727 case TOP_FOCUS:
6728 EventConstructor = SyntheticFocusEvent;
6729 break;
6730 case TOP_CLICK:
6731 // Firefox creates a click event on right mouse clicks. This removes the
6732 // unwanted click events.
6733 if (nativeEvent.button === 2) {
6734 return null;
6735 }
6736 /* falls through */
6737 case TOP_AUX_CLICK:
6738 case TOP_DOUBLE_CLICK:
6739 case TOP_MOUSE_DOWN:
6740 case TOP_MOUSE_MOVE:
6741 case TOP_MOUSE_UP:
6742 // TODO: Disabled elements should not respond to mouse events
6743 /* falls through */
6744 case TOP_MOUSE_OUT:
6745 case TOP_MOUSE_OVER:
6746 case TOP_CONTEXT_MENU:
6747 EventConstructor = SyntheticMouseEvent;
6748 break;
6749 case TOP_DRAG:
6750 case TOP_DRAG_END:
6751 case TOP_DRAG_ENTER:
6752 case TOP_DRAG_EXIT:
6753 case TOP_DRAG_LEAVE:
6754 case TOP_DRAG_OVER:
6755 case TOP_DRAG_START:
6756 case TOP_DROP:
6757 EventConstructor = SyntheticDragEvent;
6758 break;
6759 case TOP_TOUCH_CANCEL:
6760 case TOP_TOUCH_END:
6761 case TOP_TOUCH_MOVE:
6762 case TOP_TOUCH_START:
6763 EventConstructor = SyntheticTouchEvent;
6764 break;
6765 case TOP_ANIMATION_END:
6766 case TOP_ANIMATION_ITERATION:
6767 case TOP_ANIMATION_START:
6768 EventConstructor = SyntheticAnimationEvent;
6769 break;
6770 case TOP_TRANSITION_END:
6771 EventConstructor = SyntheticTransitionEvent;
6772 break;
6773 case TOP_SCROLL:
6774 EventConstructor = SyntheticUIEvent;
6775 break;
6776 case TOP_WHEEL:
6777 EventConstructor = SyntheticWheelEvent;
6778 break;
6779 case TOP_COPY:
6780 case TOP_CUT:
6781 case TOP_PASTE:
6782 EventConstructor = SyntheticClipboardEvent;
6783 break;
6784 case TOP_GOT_POINTER_CAPTURE:
6785 case TOP_LOST_POINTER_CAPTURE:
6786 case TOP_POINTER_CANCEL:
6787 case TOP_POINTER_DOWN:
6788 case TOP_POINTER_MOVE:
6789 case TOP_POINTER_OUT:
6790 case TOP_POINTER_OVER:
6791 case TOP_POINTER_UP:
6792 EventConstructor = SyntheticPointerEvent;
6793 break;
6794 default:
6795 {
6796 if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
6797 warningWithoutStack$1(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
6798 }
6799 }
6800 // HTML Events
6801 // @see http://www.w3.org/TR/html5/index.html#events-0
6802 EventConstructor = SyntheticEvent;
6803 break;
6804 }
6805 var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
6806 accumulateTwoPhaseDispatches(event);
6807 return event;
6808 }
6809};
6810
6811var isInteractiveTopLevelEventType = SimpleEventPlugin.isInteractiveTopLevelEventType;
6812
6813
6814var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
6815var callbackBookkeepingPool = [];
6816
6817/**
6818 * Find the deepest React component completely containing the root of the
6819 * passed-in instance (for use when entire React trees are nested within each
6820 * other). If React trees are not nested, returns null.
6821 */
6822function findRootContainerNode(inst) {
6823 // TODO: It may be a good idea to cache this to prevent unnecessary DOM
6824 // traversal, but caching is difficult to do correctly without using a
6825 // mutation observer to listen for all DOM changes.
6826 while (inst.return) {
6827 inst = inst.return;
6828 }
6829 if (inst.tag !== HostRoot) {
6830 // This can happen if we're in a detached tree.
6831 return null;
6832 }
6833 return inst.stateNode.containerInfo;
6834}
6835
6836// Used to store ancestor hierarchy in top level callback
6837function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) {
6838 if (callbackBookkeepingPool.length) {
6839 var instance = callbackBookkeepingPool.pop();
6840 instance.topLevelType = topLevelType;
6841 instance.nativeEvent = nativeEvent;
6842 instance.targetInst = targetInst;
6843 return instance;
6844 }
6845 return {
6846 topLevelType: topLevelType,
6847 nativeEvent: nativeEvent,
6848 targetInst: targetInst,
6849 ancestors: []
6850 };
6851}
6852
6853function releaseTopLevelCallbackBookKeeping(instance) {
6854 instance.topLevelType = null;
6855 instance.nativeEvent = null;
6856 instance.targetInst = null;
6857 instance.ancestors.length = 0;
6858 if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
6859 callbackBookkeepingPool.push(instance);
6860 }
6861}
6862
6863function handleTopLevel(bookKeeping) {
6864 var targetInst = bookKeeping.targetInst;
6865
6866 // Loop through the hierarchy, in case there's any nested components.
6867 // It's important that we build the array of ancestors before calling any
6868 // event handlers, because event handlers can modify the DOM, leading to
6869 // inconsistencies with ReactMount's node cache. See #1105.
6870 var ancestor = targetInst;
6871 do {
6872 if (!ancestor) {
6873 bookKeeping.ancestors.push(ancestor);
6874 break;
6875 }
6876 var root = findRootContainerNode(ancestor);
6877 if (!root) {
6878 break;
6879 }
6880 bookKeeping.ancestors.push(ancestor);
6881 ancestor = getClosestInstanceFromNode(root);
6882 } while (ancestor);
6883
6884 for (var i = 0; i < bookKeeping.ancestors.length; i++) {
6885 targetInst = bookKeeping.ancestors[i];
6886 runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
6887 }
6888}
6889
6890// TODO: can we stop exporting these?
6891var _enabled = true;
6892
6893function setEnabled(enabled) {
6894 _enabled = !!enabled;
6895}
6896
6897function isEnabled() {
6898 return _enabled;
6899}
6900
6901/**
6902 * Traps top-level events by using event bubbling.
6903 *
6904 * @param {number} topLevelType Number from `TopLevelEventTypes`.
6905 * @param {object} element Element on which to attach listener.
6906 * @return {?object} An object with a remove function which will forcefully
6907 * remove the listener.
6908 * @internal
6909 */
6910function trapBubbledEvent(topLevelType, element) {
6911 if (!element) {
6912 return null;
6913 }
6914 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
6915
6916 addEventBubbleListener(element, getRawEventName(topLevelType),
6917 // Check if interactive and wrap in interactiveUpdates
6918 dispatch.bind(null, topLevelType));
6919}
6920
6921/**
6922 * Traps a top-level event by using event capturing.
6923 *
6924 * @param {number} topLevelType Number from `TopLevelEventTypes`.
6925 * @param {object} element Element on which to attach listener.
6926 * @return {?object} An object with a remove function which will forcefully
6927 * remove the listener.
6928 * @internal
6929 */
6930function trapCapturedEvent(topLevelType, element) {
6931 if (!element) {
6932 return null;
6933 }
6934 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
6935
6936 addEventCaptureListener(element, getRawEventName(topLevelType),
6937 // Check if interactive and wrap in interactiveUpdates
6938 dispatch.bind(null, topLevelType));
6939}
6940
6941function dispatchInteractiveEvent(topLevelType, nativeEvent) {
6942 interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);
6943}
6944
6945function dispatchEvent(topLevelType, nativeEvent) {
6946 if (!_enabled) {
6947 return;
6948 }
6949
6950 var nativeEventTarget = getEventTarget(nativeEvent);
6951 var targetInst = getClosestInstanceFromNode(nativeEventTarget);
6952 if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) {
6953 // If we get an event (ex: img onload) before committing that
6954 // component's mount, ignore it for now (that is, treat it as if it was an
6955 // event on a non-React tree). We might also consider queueing events and
6956 // dispatching them after the mount.
6957 targetInst = null;
6958 }
6959
6960 var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst);
6961
6962 try {
6963 // Event queue being processed in the same cycle allows
6964 // `preventDefault`.
6965 batchedUpdates(handleTopLevel, bookKeeping);
6966 } finally {
6967 releaseTopLevelCallbackBookKeeping(bookKeeping);
6968 }
6969}
6970
6971/**
6972 * Summary of `ReactBrowserEventEmitter` event handling:
6973 *
6974 * - Top-level delegation is used to trap most native browser events. This
6975 * may only occur in the main thread and is the responsibility of
6976 * ReactDOMEventListener, which is injected and can therefore support
6977 * pluggable event sources. This is the only work that occurs in the main
6978 * thread.
6979 *
6980 * - We normalize and de-duplicate events to account for browser quirks. This
6981 * may be done in the worker thread.
6982 *
6983 * - Forward these native events (with the associated top-level type used to
6984 * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
6985 * to extract any synthetic events.
6986 *
6987 * - The `EventPluginHub` will then process each event by annotating them with
6988 * "dispatches", a sequence of listeners and IDs that care about that event.
6989 *
6990 * - The `EventPluginHub` then dispatches the events.
6991 *
6992 * Overview of React and the event system:
6993 *
6994 * +------------+ .
6995 * | DOM | .
6996 * +------------+ .
6997 * | .
6998 * v .
6999 * +------------+ .
7000 * | ReactEvent | .
7001 * | Listener | .
7002 * +------------+ . +-----------+
7003 * | . +--------+|SimpleEvent|
7004 * | . | |Plugin |
7005 * +-----|------+ . v +-----------+
7006 * | | | . +--------------+ +------------+
7007 * | +-----------.--->|EventPluginHub| | Event |
7008 * | | . | | +-----------+ | Propagators|
7009 * | ReactEvent | . | | |TapEvent | |------------|
7010 * | Emitter | . | |<---+|Plugin | |other plugin|
7011 * | | . | | +-----------+ | utilities |
7012 * | +-----------.--->| | +------------+
7013 * | | | . +--------------+
7014 * +-----|------+ . ^ +-----------+
7015 * | . | |Enter/Leave|
7016 * + . +-------+|Plugin |
7017 * +-------------+ . +-----------+
7018 * | application | .
7019 * |-------------| .
7020 * | | .
7021 * | | .
7022 * +-------------+ .
7023 * .
7024 * React Core . General Purpose Event Plugin System
7025 */
7026
7027var alreadyListeningTo = {};
7028var reactTopListenersCounter = 0;
7029
7030/**
7031 * To ensure no conflicts with other potential React instances on the page
7032 */
7033var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2);
7034
7035function getListeningForDocument(mountAt) {
7036 // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
7037 // directly.
7038 if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
7039 mountAt[topListenersIDKey] = reactTopListenersCounter++;
7040 alreadyListeningTo[mountAt[topListenersIDKey]] = {};
7041 }
7042 return alreadyListeningTo[mountAt[topListenersIDKey]];
7043}
7044
7045/**
7046 * We listen for bubbled touch events on the document object.
7047 *
7048 * Firefox v8.01 (and possibly others) exhibited strange behavior when
7049 * mounting `onmousemove` events at some node that was not the document
7050 * element. The symptoms were that if your mouse is not moving over something
7051 * contained within that mount point (for example on the background) the
7052 * top-level listeners for `onmousemove` won't be called. However, if you
7053 * register the `mousemove` on the document object, then it will of course
7054 * catch all `mousemove`s. This along with iOS quirks, justifies restricting
7055 * top-level listeners to the document object only, at least for these
7056 * movement types of events and possibly all events.
7057 *
7058 * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
7059 *
7060 * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
7061 * they bubble to document.
7062 *
7063 * @param {string} registrationName Name of listener (e.g. `onClick`).
7064 * @param {object} mountAt Container where to mount the listener
7065 */
7066function listenTo(registrationName, mountAt) {
7067 var isListening = getListeningForDocument(mountAt);
7068 var dependencies = registrationNameDependencies[registrationName];
7069
7070 for (var i = 0; i < dependencies.length; i++) {
7071 var dependency = dependencies[i];
7072 if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
7073 switch (dependency) {
7074 case TOP_SCROLL:
7075 trapCapturedEvent(TOP_SCROLL, mountAt);
7076 break;
7077 case TOP_FOCUS:
7078 case TOP_BLUR:
7079 trapCapturedEvent(TOP_FOCUS, mountAt);
7080 trapCapturedEvent(TOP_BLUR, mountAt);
7081 // We set the flag for a single dependency later in this function,
7082 // but this ensures we mark both as attached rather than just one.
7083 isListening[TOP_BLUR] = true;
7084 isListening[TOP_FOCUS] = true;
7085 break;
7086 case TOP_CANCEL:
7087 case TOP_CLOSE:
7088 if (isEventSupported(getRawEventName(dependency))) {
7089 trapCapturedEvent(dependency, mountAt);
7090 }
7091 break;
7092 case TOP_INVALID:
7093 case TOP_SUBMIT:
7094 case TOP_RESET:
7095 // We listen to them on the target DOM elements.
7096 // Some of them bubble so we don't want them to fire twice.
7097 break;
7098 default:
7099 // By default, listen on the top level to all non-media events.
7100 // Media events don't bubble so adding the listener wouldn't do anything.
7101 var isMediaEvent = mediaEventTypes.indexOf(dependency) !== -1;
7102 if (!isMediaEvent) {
7103 trapBubbledEvent(dependency, mountAt);
7104 }
7105 break;
7106 }
7107 isListening[dependency] = true;
7108 }
7109 }
7110}
7111
7112function isListeningToAllDependencies(registrationName, mountAt) {
7113 var isListening = getListeningForDocument(mountAt);
7114 var dependencies = registrationNameDependencies[registrationName];
7115 for (var i = 0; i < dependencies.length; i++) {
7116 var dependency = dependencies[i];
7117 if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
7118 return false;
7119 }
7120 }
7121 return true;
7122}
7123
7124function getActiveElement(doc) {
7125 doc = doc || (typeof document !== 'undefined' ? document : undefined);
7126 if (typeof doc === 'undefined') {
7127 return null;
7128 }
7129 try {
7130 return doc.activeElement || doc.body;
7131 } catch (e) {
7132 return doc.body;
7133 }
7134}
7135
7136/**
7137 * Given any node return the first leaf node without children.
7138 *
7139 * @param {DOMElement|DOMTextNode} node
7140 * @return {DOMElement|DOMTextNode}
7141 */
7142function getLeafNode(node) {
7143 while (node && node.firstChild) {
7144 node = node.firstChild;
7145 }
7146 return node;
7147}
7148
7149/**
7150 * Get the next sibling within a container. This will walk up the
7151 * DOM if a node's siblings have been exhausted.
7152 *
7153 * @param {DOMElement|DOMTextNode} node
7154 * @return {?DOMElement|DOMTextNode}
7155 */
7156function getSiblingNode(node) {
7157 while (node) {
7158 if (node.nextSibling) {
7159 return node.nextSibling;
7160 }
7161 node = node.parentNode;
7162 }
7163}
7164
7165/**
7166 * Get object describing the nodes which contain characters at offset.
7167 *
7168 * @param {DOMElement|DOMTextNode} root
7169 * @param {number} offset
7170 * @return {?object}
7171 */
7172function getNodeForCharacterOffset(root, offset) {
7173 var node = getLeafNode(root);
7174 var nodeStart = 0;
7175 var nodeEnd = 0;
7176
7177 while (node) {
7178 if (node.nodeType === TEXT_NODE) {
7179 nodeEnd = nodeStart + node.textContent.length;
7180
7181 if (nodeStart <= offset && nodeEnd >= offset) {
7182 return {
7183 node: node,
7184 offset: offset - nodeStart
7185 };
7186 }
7187
7188 nodeStart = nodeEnd;
7189 }
7190
7191 node = getLeafNode(getSiblingNode(node));
7192 }
7193}
7194
7195/**
7196 * @param {DOMElement} outerNode
7197 * @return {?object}
7198 */
7199function getOffsets(outerNode) {
7200 var ownerDocument = outerNode.ownerDocument;
7201
7202 var win = ownerDocument && ownerDocument.defaultView || window;
7203 var selection = win.getSelection && win.getSelection();
7204
7205 if (!selection || selection.rangeCount === 0) {
7206 return null;
7207 }
7208
7209 var anchorNode = selection.anchorNode,
7210 anchorOffset = selection.anchorOffset,
7211 focusNode = selection.focusNode,
7212 focusOffset = selection.focusOffset;
7213
7214 // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the
7215 // up/down buttons on an <input type="number">. Anonymous divs do not seem to
7216 // expose properties, triggering a "Permission denied error" if any of its
7217 // properties are accessed. The only seemingly possible way to avoid erroring
7218 // is to access a property that typically works for non-anonymous divs and
7219 // catch any error that may otherwise arise. See
7220 // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
7221
7222 try {
7223 /* eslint-disable no-unused-expressions */
7224 anchorNode.nodeType;
7225 focusNode.nodeType;
7226 /* eslint-enable no-unused-expressions */
7227 } catch (e) {
7228 return null;
7229 }
7230
7231 return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
7232}
7233
7234/**
7235 * Returns {start, end} where `start` is the character/codepoint index of
7236 * (anchorNode, anchorOffset) within the textContent of `outerNode`, and
7237 * `end` is the index of (focusNode, focusOffset).
7238 *
7239 * Returns null if you pass in garbage input but we should probably just crash.
7240 *
7241 * Exported only for testing.
7242 */
7243function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
7244 var length = 0;
7245 var start = -1;
7246 var end = -1;
7247 var indexWithinAnchor = 0;
7248 var indexWithinFocus = 0;
7249 var node = outerNode;
7250 var parentNode = null;
7251
7252 outer: while (true) {
7253 var next = null;
7254
7255 while (true) {
7256 if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
7257 start = length + anchorOffset;
7258 }
7259 if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
7260 end = length + focusOffset;
7261 }
7262
7263 if (node.nodeType === TEXT_NODE) {
7264 length += node.nodeValue.length;
7265 }
7266
7267 if ((next = node.firstChild) === null) {
7268 break;
7269 }
7270 // Moving from `node` to its first child `next`.
7271 parentNode = node;
7272 node = next;
7273 }
7274
7275 while (true) {
7276 if (node === outerNode) {
7277 // If `outerNode` has children, this is always the second time visiting
7278 // it. If it has no children, this is still the first loop, and the only
7279 // valid selection is anchorNode and focusNode both equal to this node
7280 // and both offsets 0, in which case we will have handled above.
7281 break outer;
7282 }
7283 if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
7284 start = length;
7285 }
7286 if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
7287 end = length;
7288 }
7289 if ((next = node.nextSibling) !== null) {
7290 break;
7291 }
7292 node = parentNode;
7293 parentNode = node.parentNode;
7294 }
7295
7296 // Moving from `node` to its next sibling `next`.
7297 node = next;
7298 }
7299
7300 if (start === -1 || end === -1) {
7301 // This should never happen. (Would happen if the anchor/focus nodes aren't
7302 // actually inside the passed-in node.)
7303 return null;
7304 }
7305
7306 return {
7307 start: start,
7308 end: end
7309 };
7310}
7311
7312/**
7313 * In modern non-IE browsers, we can support both forward and backward
7314 * selections.
7315 *
7316 * Note: IE10+ supports the Selection object, but it does not support
7317 * the `extend` method, which means that even in modern IE, it's not possible
7318 * to programmatically create a backward selection. Thus, for all IE
7319 * versions, we use the old IE API to create our selections.
7320 *
7321 * @param {DOMElement|DOMTextNode} node
7322 * @param {object} offsets
7323 */
7324function setOffsets(node, offsets) {
7325 var doc = node.ownerDocument || document;
7326 var win = doc && doc.defaultView || window;
7327
7328 // Edge fails with "Object expected" in some scenarios.
7329 // (For instance: TinyMCE editor used in a list component that supports pasting to add more,
7330 // fails when pasting 100+ items)
7331 if (!win.getSelection) {
7332 return;
7333 }
7334
7335 var selection = win.getSelection();
7336 var length = node.textContent.length;
7337 var start = Math.min(offsets.start, length);
7338 var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
7339
7340 // IE 11 uses modern selection, but doesn't support the extend method.
7341 // Flip backward selections, so we can set with a single range.
7342 if (!selection.extend && start > end) {
7343 var temp = end;
7344 end = start;
7345 start = temp;
7346 }
7347
7348 var startMarker = getNodeForCharacterOffset(node, start);
7349 var endMarker = getNodeForCharacterOffset(node, end);
7350
7351 if (startMarker && endMarker) {
7352 if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
7353 return;
7354 }
7355 var range = doc.createRange();
7356 range.setStart(startMarker.node, startMarker.offset);
7357 selection.removeAllRanges();
7358
7359 if (start > end) {
7360 selection.addRange(range);
7361 selection.extend(endMarker.node, endMarker.offset);
7362 } else {
7363 range.setEnd(endMarker.node, endMarker.offset);
7364 selection.addRange(range);
7365 }
7366 }
7367}
7368
7369function isTextNode(node) {
7370 return node && node.nodeType === TEXT_NODE;
7371}
7372
7373function containsNode(outerNode, innerNode) {
7374 if (!outerNode || !innerNode) {
7375 return false;
7376 } else if (outerNode === innerNode) {
7377 return true;
7378 } else if (isTextNode(outerNode)) {
7379 return false;
7380 } else if (isTextNode(innerNode)) {
7381 return containsNode(outerNode, innerNode.parentNode);
7382 } else if ('contains' in outerNode) {
7383 return outerNode.contains(innerNode);
7384 } else if (outerNode.compareDocumentPosition) {
7385 return !!(outerNode.compareDocumentPosition(innerNode) & 16);
7386 } else {
7387 return false;
7388 }
7389}
7390
7391function isInDocument(node) {
7392 return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
7393}
7394
7395function getActiveElementDeep() {
7396 var win = window;
7397 var element = getActiveElement();
7398 while (element instanceof win.HTMLIFrameElement) {
7399 // Accessing the contentDocument of a HTMLIframeElement can cause the browser
7400 // to throw, e.g. if it has a cross-origin src attribute
7401 try {
7402 win = element.contentDocument.defaultView;
7403 } catch (e) {
7404 return element;
7405 }
7406 element = getActiveElement(win.document);
7407 }
7408 return element;
7409}
7410
7411/**
7412 * @ReactInputSelection: React input selection module. Based on Selection.js,
7413 * but modified to be suitable for react and has a couple of bug fixes (doesn't
7414 * assume buttons have range selections allowed).
7415 * Input selection module for React.
7416 */
7417
7418/**
7419 * @hasSelectionCapabilities: we get the element types that support selection
7420 * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart`
7421 * and `selectionEnd` rows.
7422 */
7423function hasSelectionCapabilities(elem) {
7424 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
7425 return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true');
7426}
7427
7428function getSelectionInformation() {
7429 var focusedElem = getActiveElementDeep();
7430 return {
7431 focusedElem: focusedElem,
7432 selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null
7433 };
7434}
7435
7436/**
7437 * @restoreSelection: If any selection information was potentially lost,
7438 * restore it. This is useful when performing operations that could remove dom
7439 * nodes and place them back in, resulting in focus being lost.
7440 */
7441function restoreSelection(priorSelectionInformation) {
7442 var curFocusedElem = getActiveElementDeep();
7443 var priorFocusedElem = priorSelectionInformation.focusedElem;
7444 var priorSelectionRange = priorSelectionInformation.selectionRange;
7445 if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
7446 if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
7447 setSelection(priorFocusedElem, priorSelectionRange);
7448 }
7449
7450 // Focusing a node can change the scroll position, which is undesirable
7451 var ancestors = [];
7452 var ancestor = priorFocusedElem;
7453 while (ancestor = ancestor.parentNode) {
7454 if (ancestor.nodeType === ELEMENT_NODE) {
7455 ancestors.push({
7456 element: ancestor,
7457 left: ancestor.scrollLeft,
7458 top: ancestor.scrollTop
7459 });
7460 }
7461 }
7462
7463 if (typeof priorFocusedElem.focus === 'function') {
7464 priorFocusedElem.focus();
7465 }
7466
7467 for (var i = 0; i < ancestors.length; i++) {
7468 var info = ancestors[i];
7469 info.element.scrollLeft = info.left;
7470 info.element.scrollTop = info.top;
7471 }
7472 }
7473}
7474
7475/**
7476 * @getSelection: Gets the selection bounds of a focused textarea, input or
7477 * contentEditable node.
7478 * -@input: Look up selection bounds of this input
7479 * -@return {start: selectionStart, end: selectionEnd}
7480 */
7481function getSelection$1(input) {
7482 var selection = void 0;
7483
7484 if ('selectionStart' in input) {
7485 // Modern browser with input or textarea.
7486 selection = {
7487 start: input.selectionStart,
7488 end: input.selectionEnd
7489 };
7490 } else {
7491 // Content editable or old IE textarea.
7492 selection = getOffsets(input);
7493 }
7494
7495 return selection || { start: 0, end: 0 };
7496}
7497
7498/**
7499 * @setSelection: Sets the selection bounds of a textarea or input and focuses
7500 * the input.
7501 * -@input Set selection bounds of this input or textarea
7502 * -@offsets Object of same form that is returned from get*
7503 */
7504function setSelection(input, offsets) {
7505 var start = offsets.start,
7506 end = offsets.end;
7507
7508 if (end === undefined) {
7509 end = start;
7510 }
7511
7512 if ('selectionStart' in input) {
7513 input.selectionStart = start;
7514 input.selectionEnd = Math.min(end, input.value.length);
7515 } else {
7516 setOffsets(input, offsets);
7517 }
7518}
7519
7520var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11;
7521
7522var eventTypes$3 = {
7523 select: {
7524 phasedRegistrationNames: {
7525 bubbled: 'onSelect',
7526 captured: 'onSelectCapture'
7527 },
7528 dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE]
7529 }
7530};
7531
7532var activeElement$1 = null;
7533var activeElementInst$1 = null;
7534var lastSelection = null;
7535var mouseDown = false;
7536
7537/**
7538 * Get an object which is a unique representation of the current selection.
7539 *
7540 * The return value will not be consistent across nodes or browsers, but
7541 * two identical selections on the same node will return identical objects.
7542 *
7543 * @param {DOMElement} node
7544 * @return {object}
7545 */
7546function getSelection(node) {
7547 if ('selectionStart' in node && hasSelectionCapabilities(node)) {
7548 return {
7549 start: node.selectionStart,
7550 end: node.selectionEnd
7551 };
7552 } else {
7553 var win = node.ownerDocument && node.ownerDocument.defaultView || window;
7554 var selection = win.getSelection();
7555 return {
7556 anchorNode: selection.anchorNode,
7557 anchorOffset: selection.anchorOffset,
7558 focusNode: selection.focusNode,
7559 focusOffset: selection.focusOffset
7560 };
7561 }
7562}
7563
7564/**
7565 * Get document associated with the event target.
7566 *
7567 * @param {object} nativeEventTarget
7568 * @return {Document}
7569 */
7570function getEventTargetDocument(eventTarget) {
7571 return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
7572}
7573
7574/**
7575 * Poll selection to see whether it's changed.
7576 *
7577 * @param {object} nativeEvent
7578 * @param {object} nativeEventTarget
7579 * @return {?SyntheticEvent}
7580 */
7581function constructSelectEvent(nativeEvent, nativeEventTarget) {
7582 // Ensure we have the right element, and that the user is not dragging a
7583 // selection (this matches native `select` event behavior). In HTML5, select
7584 // fires only on input and textarea thus if there's no focused element we
7585 // won't dispatch.
7586 var doc = getEventTargetDocument(nativeEventTarget);
7587
7588 if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
7589 return null;
7590 }
7591
7592 // Only fire when selection has actually changed.
7593 var currentSelection = getSelection(activeElement$1);
7594 if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
7595 lastSelection = currentSelection;
7596
7597 var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget);
7598
7599 syntheticEvent.type = 'select';
7600 syntheticEvent.target = activeElement$1;
7601
7602 accumulateTwoPhaseDispatches(syntheticEvent);
7603
7604 return syntheticEvent;
7605 }
7606
7607 return null;
7608}
7609
7610/**
7611 * This plugin creates an `onSelect` event that normalizes select events
7612 * across form elements.
7613 *
7614 * Supported elements are:
7615 * - input (see `isTextInputElement`)
7616 * - textarea
7617 * - contentEditable
7618 *
7619 * This differs from native browser implementations in the following ways:
7620 * - Fires on contentEditable fields as well as inputs.
7621 * - Fires for collapsed selection.
7622 * - Fires after user input.
7623 */
7624var SelectEventPlugin = {
7625 eventTypes: eventTypes$3,
7626
7627 extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
7628 var doc = getEventTargetDocument(nativeEventTarget);
7629 // Track whether all listeners exists for this plugin. If none exist, we do
7630 // not extract events. See #3639.
7631 if (!doc || !isListeningToAllDependencies('onSelect', doc)) {
7632 return null;
7633 }
7634
7635 var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
7636
7637 switch (topLevelType) {
7638 // Track the input node that has focus.
7639 case TOP_FOCUS:
7640 if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
7641 activeElement$1 = targetNode;
7642 activeElementInst$1 = targetInst;
7643 lastSelection = null;
7644 }
7645 break;
7646 case TOP_BLUR:
7647 activeElement$1 = null;
7648 activeElementInst$1 = null;
7649 lastSelection = null;
7650 break;
7651 // Don't fire the event while the user is dragging. This matches the
7652 // semantics of the native select event.
7653 case TOP_MOUSE_DOWN:
7654 mouseDown = true;
7655 break;
7656 case TOP_CONTEXT_MENU:
7657 case TOP_MOUSE_UP:
7658 case TOP_DRAG_END:
7659 mouseDown = false;
7660 return constructSelectEvent(nativeEvent, nativeEventTarget);
7661 // Chrome and IE fire non-standard event when selection is changed (and
7662 // sometimes when it hasn't). IE's event fires out of order with respect
7663 // to key and input events on deletion, so we discard it.
7664 //
7665 // Firefox doesn't support selectionchange, so check selection status
7666 // after each key entry. The selection changes after keydown and before
7667 // keyup, but we check on keydown as well in the case of holding down a
7668 // key, when multiple keydown events are fired but only one keyup is.
7669 // This is also our approach for IE handling, for the reason above.
7670 case TOP_SELECTION_CHANGE:
7671 if (skipSelectionChangeEvent) {
7672 break;
7673 }
7674 // falls through
7675 case TOP_KEY_DOWN:
7676 case TOP_KEY_UP:
7677 return constructSelectEvent(nativeEvent, nativeEventTarget);
7678 }
7679
7680 return null;
7681 }
7682};
7683
7684/**
7685 * Inject modules for resolving DOM hierarchy and plugin ordering.
7686 */
7687injection.injectEventPluginOrder(DOMEventPluginOrder);
7688setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
7689
7690/**
7691 * Some important event plugins included by default (without having to require
7692 * them).
7693 */
7694injection.injectEventPluginsByName({
7695 SimpleEventPlugin: SimpleEventPlugin,
7696 EnterLeaveEventPlugin: EnterLeaveEventPlugin,
7697 ChangeEventPlugin: ChangeEventPlugin,
7698 SelectEventPlugin: SelectEventPlugin,
7699 BeforeInputEventPlugin: BeforeInputEventPlugin
7700});
7701
7702var didWarnSelectedSetOnOption = false;
7703var didWarnInvalidChild = false;
7704
7705function flattenChildren(children) {
7706 var content = '';
7707
7708 // Flatten children. We'll warn if they are invalid
7709 // during validateProps() which runs for hydration too.
7710 // Note that this would throw on non-element objects.
7711 // Elements are stringified (which is normally irrelevant
7712 // but matters for <fbt>).
7713 React.Children.forEach(children, function (child) {
7714 if (child == null) {
7715 return;
7716 }
7717 content += child;
7718 // Note: we don't warn about invalid children here.
7719 // Instead, this is done separately below so that
7720 // it happens during the hydration codepath too.
7721 });
7722
7723 return content;
7724}
7725
7726/**
7727 * Implements an <option> host component that warns when `selected` is set.
7728 */
7729
7730function validateProps(element, props) {
7731 {
7732 // This mirrors the codepath above, but runs for hydration too.
7733 // Warn about invalid children here so that client and hydration are consistent.
7734 // TODO: this seems like it could cause a DEV-only throw for hydration
7735 // if children contains a non-element object. We should try to avoid that.
7736 if (typeof props.children === 'object' && props.children !== null) {
7737 React.Children.forEach(props.children, function (child) {
7738 if (child == null) {
7739 return;
7740 }
7741 if (typeof child === 'string' || typeof child === 'number') {
7742 return;
7743 }
7744 if (typeof child.type !== 'string') {
7745 return;
7746 }
7747 if (!didWarnInvalidChild) {
7748 didWarnInvalidChild = true;
7749 warning$1(false, 'Only strings and numbers are supported as <option> children.');
7750 }
7751 });
7752 }
7753
7754 // TODO: Remove support for `selected` in <option>.
7755 if (props.selected != null && !didWarnSelectedSetOnOption) {
7756 warning$1(false, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
7757 didWarnSelectedSetOnOption = true;
7758 }
7759 }
7760}
7761
7762function postMountWrapper$1(element, props) {
7763 // value="" should make a value attribute (#6219)
7764 if (props.value != null) {
7765 element.setAttribute('value', toString(getToStringValue(props.value)));
7766 }
7767}
7768
7769function getHostProps$1(element, props) {
7770 var hostProps = _assign({ children: undefined }, props);
7771 var content = flattenChildren(props.children);
7772
7773 if (content) {
7774 hostProps.children = content;
7775 }
7776
7777 return hostProps;
7778}
7779
7780// TODO: direct imports like some-package/src/* are bad. Fix me.
7781var didWarnValueDefaultValue$1 = void 0;
7782
7783{
7784 didWarnValueDefaultValue$1 = false;
7785}
7786
7787function getDeclarationErrorAddendum() {
7788 var ownerName = getCurrentFiberOwnerNameInDevOrNull();
7789 if (ownerName) {
7790 return '\n\nCheck the render method of `' + ownerName + '`.';
7791 }
7792 return '';
7793}
7794
7795var valuePropNames = ['value', 'defaultValue'];
7796
7797/**
7798 * Validation function for `value` and `defaultValue`.
7799 */
7800function checkSelectPropTypes(props) {
7801 ReactControlledValuePropTypes.checkPropTypes('select', props);
7802
7803 for (var i = 0; i < valuePropNames.length; i++) {
7804 var propName = valuePropNames[i];
7805 if (props[propName] == null) {
7806 continue;
7807 }
7808 var isArray = Array.isArray(props[propName]);
7809 if (props.multiple && !isArray) {
7810 warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
7811 } else if (!props.multiple && isArray) {
7812 warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
7813 }
7814 }
7815}
7816
7817function updateOptions(node, multiple, propValue, setDefaultSelected) {
7818 var options = node.options;
7819
7820 if (multiple) {
7821 var selectedValues = propValue;
7822 var selectedValue = {};
7823 for (var i = 0; i < selectedValues.length; i++) {
7824 // Prefix to avoid chaos with special keys.
7825 selectedValue['$' + selectedValues[i]] = true;
7826 }
7827 for (var _i = 0; _i < options.length; _i++) {
7828 var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
7829 if (options[_i].selected !== selected) {
7830 options[_i].selected = selected;
7831 }
7832 if (selected && setDefaultSelected) {
7833 options[_i].defaultSelected = true;
7834 }
7835 }
7836 } else {
7837 // Do not set `select.value` as exact behavior isn't consistent across all
7838 // browsers for all cases.
7839 var _selectedValue = toString(getToStringValue(propValue));
7840 var defaultSelected = null;
7841 for (var _i2 = 0; _i2 < options.length; _i2++) {
7842 if (options[_i2].value === _selectedValue) {
7843 options[_i2].selected = true;
7844 if (setDefaultSelected) {
7845 options[_i2].defaultSelected = true;
7846 }
7847 return;
7848 }
7849 if (defaultSelected === null && !options[_i2].disabled) {
7850 defaultSelected = options[_i2];
7851 }
7852 }
7853 if (defaultSelected !== null) {
7854 defaultSelected.selected = true;
7855 }
7856 }
7857}
7858
7859/**
7860 * Implements a <select> host component that allows optionally setting the
7861 * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
7862 * stringable. If `multiple` is true, the prop must be an array of stringables.
7863 *
7864 * If `value` is not supplied (or null/undefined), user actions that change the
7865 * selected option will trigger updates to the rendered options.
7866 *
7867 * If it is supplied (and not null/undefined), the rendered options will not
7868 * update in response to user actions. Instead, the `value` prop must change in
7869 * order for the rendered options to update.
7870 *
7871 * If `defaultValue` is provided, any options with the supplied values will be
7872 * selected.
7873 */
7874
7875function getHostProps$2(element, props) {
7876 return _assign({}, props, {
7877 value: undefined
7878 });
7879}
7880
7881function initWrapperState$1(element, props) {
7882 var node = element;
7883 {
7884 checkSelectPropTypes(props);
7885 }
7886
7887 node._wrapperState = {
7888 wasMultiple: !!props.multiple
7889 };
7890
7891 {
7892 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
7893 warning$1(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');
7894 didWarnValueDefaultValue$1 = true;
7895 }
7896 }
7897}
7898
7899function postMountWrapper$2(element, props) {
7900 var node = element;
7901 node.multiple = !!props.multiple;
7902 var value = props.value;
7903 if (value != null) {
7904 updateOptions(node, !!props.multiple, value, false);
7905 } else if (props.defaultValue != null) {
7906 updateOptions(node, !!props.multiple, props.defaultValue, true);
7907 }
7908}
7909
7910function postUpdateWrapper(element, props) {
7911 var node = element;
7912 var wasMultiple = node._wrapperState.wasMultiple;
7913 node._wrapperState.wasMultiple = !!props.multiple;
7914
7915 var value = props.value;
7916 if (value != null) {
7917 updateOptions(node, !!props.multiple, value, false);
7918 } else if (wasMultiple !== !!props.multiple) {
7919 // For simplicity, reapply `defaultValue` if `multiple` is toggled.
7920 if (props.defaultValue != null) {
7921 updateOptions(node, !!props.multiple, props.defaultValue, true);
7922 } else {
7923 // Revert the select back to its default unselected state.
7924 updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
7925 }
7926 }
7927}
7928
7929function restoreControlledState$2(element, props) {
7930 var node = element;
7931 var value = props.value;
7932
7933 if (value != null) {
7934 updateOptions(node, !!props.multiple, value, false);
7935 }
7936}
7937
7938var didWarnValDefaultVal = false;
7939
7940/**
7941 * Implements a <textarea> host component that allows setting `value`, and
7942 * `defaultValue`. This differs from the traditional DOM API because value is
7943 * usually set as PCDATA children.
7944 *
7945 * If `value` is not supplied (or null/undefined), user actions that affect the
7946 * value will trigger updates to the element.
7947 *
7948 * If `value` is supplied (and not null/undefined), the rendered element will
7949 * not trigger updates to the element. Instead, the `value` prop must change in
7950 * order for the rendered element to be updated.
7951 *
7952 * The rendered element will be initialized with an empty value, the prop
7953 * `defaultValue` if specified, or the children content (deprecated).
7954 */
7955
7956function getHostProps$3(element, props) {
7957 var node = element;
7958 !(props.dangerouslySetInnerHTML == null) ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : void 0;
7959
7960 // Always set children to the same thing. In IE9, the selection range will
7961 // get reset if `textContent` is mutated. We could add a check in setTextContent
7962 // to only set the value if/when the value differs from the node value (which would
7963 // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
7964 // solution. The value can be a boolean or object so that's why it's forced
7965 // to be a string.
7966 var hostProps = _assign({}, props, {
7967 value: undefined,
7968 defaultValue: undefined,
7969 children: toString(node._wrapperState.initialValue)
7970 });
7971
7972 return hostProps;
7973}
7974
7975function initWrapperState$2(element, props) {
7976 var node = element;
7977 {
7978 ReactControlledValuePropTypes.checkPropTypes('textarea', props);
7979 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
7980 warning$1(false, '%s contains a textarea with both value and defaultValue props. ' + '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', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
7981 didWarnValDefaultVal = true;
7982 }
7983 }
7984
7985 var initialValue = props.value;
7986
7987 // Only bother fetching default value if we're going to use it
7988 if (initialValue == null) {
7989 var defaultValue = props.defaultValue;
7990 // TODO (yungsters): Remove support for children content in <textarea>.
7991 var children = props.children;
7992 if (children != null) {
7993 {
7994 warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
7995 }
7996 !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
7997 if (Array.isArray(children)) {
7998 !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
7999 children = children[0];
8000 }
8001
8002 defaultValue = children;
8003 }
8004 if (defaultValue == null) {
8005 defaultValue = '';
8006 }
8007 initialValue = defaultValue;
8008 }
8009
8010 node._wrapperState = {
8011 initialValue: getToStringValue(initialValue)
8012 };
8013}
8014
8015function updateWrapper$1(element, props) {
8016 var node = element;
8017 var value = getToStringValue(props.value);
8018 var defaultValue = getToStringValue(props.defaultValue);
8019 if (value != null) {
8020 // Cast `value` to a string to ensure the value is set correctly. While
8021 // browsers typically do this as necessary, jsdom doesn't.
8022 var newValue = toString(value);
8023 // To avoid side effects (such as losing text selection), only set value if changed
8024 if (newValue !== node.value) {
8025 node.value = newValue;
8026 }
8027 if (props.defaultValue == null && node.defaultValue !== newValue) {
8028 node.defaultValue = newValue;
8029 }
8030 }
8031 if (defaultValue != null) {
8032 node.defaultValue = toString(defaultValue);
8033 }
8034}
8035
8036function postMountWrapper$3(element, props) {
8037 var node = element;
8038 // This is in postMount because we need access to the DOM node, which is not
8039 // available until after the component has mounted.
8040 var textContent = node.textContent;
8041
8042 // Only set node.value if textContent is equal to the expected
8043 // initial value. In IE10/IE11 there is a bug where the placeholder attribute
8044 // will populate textContent as well.
8045 // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
8046 if (textContent === node._wrapperState.initialValue) {
8047 node.value = textContent;
8048 }
8049}
8050
8051function restoreControlledState$3(element, props) {
8052 // DOM component is still mounted; update
8053 updateWrapper$1(element, props);
8054}
8055
8056var HTML_NAMESPACE$1 = 'http://www.w3.org/1999/xhtml';
8057var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
8058var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
8059
8060var Namespaces = {
8061 html: HTML_NAMESPACE$1,
8062 mathml: MATH_NAMESPACE,
8063 svg: SVG_NAMESPACE
8064};
8065
8066// Assumes there is no parent namespace.
8067function getIntrinsicNamespace(type) {
8068 switch (type) {
8069 case 'svg':
8070 return SVG_NAMESPACE;
8071 case 'math':
8072 return MATH_NAMESPACE;
8073 default:
8074 return HTML_NAMESPACE$1;
8075 }
8076}
8077
8078function getChildNamespace(parentNamespace, type) {
8079 if (parentNamespace == null || parentNamespace === HTML_NAMESPACE$1) {
8080 // No (or default) parent namespace: potential entry point.
8081 return getIntrinsicNamespace(type);
8082 }
8083 if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
8084 // We're leaving SVG.
8085 return HTML_NAMESPACE$1;
8086 }
8087 // By default, pass namespace below.
8088 return parentNamespace;
8089}
8090
8091/* globals MSApp */
8092
8093/**
8094 * Create a function which has 'unsafe' privileges (required by windows8 apps)
8095 */
8096var createMicrosoftUnsafeLocalFunction = function (func) {
8097 if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
8098 return function (arg0, arg1, arg2, arg3) {
8099 MSApp.execUnsafeLocalFunction(function () {
8100 return func(arg0, arg1, arg2, arg3);
8101 });
8102 };
8103 } else {
8104 return func;
8105 }
8106};
8107
8108// SVG temp container for IE lacking innerHTML
8109var reusableSVGContainer = void 0;
8110
8111/**
8112 * Set the innerHTML property of a node
8113 *
8114 * @param {DOMElement} node
8115 * @param {string} html
8116 * @internal
8117 */
8118var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
8119 // IE does not have innerHTML for SVG nodes, so instead we inject the
8120 // new markup in a temp node and then move the child nodes across into
8121 // the target node
8122
8123 if (node.namespaceURI === Namespaces.svg && !('innerHTML' in node)) {
8124 reusableSVGContainer = reusableSVGContainer || document.createElement('div');
8125 reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
8126 var svgNode = reusableSVGContainer.firstChild;
8127 while (node.firstChild) {
8128 node.removeChild(node.firstChild);
8129 }
8130 while (svgNode.firstChild) {
8131 node.appendChild(svgNode.firstChild);
8132 }
8133 } else {
8134 node.innerHTML = html;
8135 }
8136});
8137
8138/**
8139 * Set the textContent property of a node. For text updates, it's faster
8140 * to set the `nodeValue` of the Text node directly instead of using
8141 * `.textContent` which will remove the existing node and create a new one.
8142 *
8143 * @param {DOMElement} node
8144 * @param {string} text
8145 * @internal
8146 */
8147var setTextContent = function (node, text) {
8148 if (text) {
8149 var firstChild = node.firstChild;
8150
8151 if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
8152 firstChild.nodeValue = text;
8153 return;
8154 }
8155 }
8156 node.textContent = text;
8157};
8158
8159// List derived from Gecko source code:
8160// https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js
8161var shorthandToLonghand = {
8162 animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'],
8163 background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'],
8164 backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
8165 border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'],
8166 borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'],
8167 borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'],
8168 borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'],
8169 borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'],
8170 borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'],
8171 borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'],
8172 borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'],
8173 borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'],
8174 borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'],
8175 borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'],
8176 borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'],
8177 borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'],
8178 borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'],
8179 columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'],
8180 columns: ['columnCount', 'columnWidth'],
8181 flex: ['flexBasis', 'flexGrow', 'flexShrink'],
8182 flexFlow: ['flexDirection', 'flexWrap'],
8183 font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'],
8184 fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'],
8185 gap: ['columnGap', 'rowGap'],
8186 grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
8187 gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'],
8188 gridColumn: ['gridColumnEnd', 'gridColumnStart'],
8189 gridColumnGap: ['columnGap'],
8190 gridGap: ['columnGap', 'rowGap'],
8191 gridRow: ['gridRowEnd', 'gridRowStart'],
8192 gridRowGap: ['rowGap'],
8193 gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
8194 listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'],
8195 margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'],
8196 marker: ['markerEnd', 'markerMid', 'markerStart'],
8197 mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'],
8198 maskPosition: ['maskPositionX', 'maskPositionY'],
8199 outline: ['outlineColor', 'outlineStyle', 'outlineWidth'],
8200 overflow: ['overflowX', 'overflowY'],
8201 padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'],
8202 placeContent: ['alignContent', 'justifyContent'],
8203 placeItems: ['alignItems', 'justifyItems'],
8204 placeSelf: ['alignSelf', 'justifySelf'],
8205 textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'],
8206 textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'],
8207 transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'],
8208 wordWrap: ['overflowWrap']
8209};
8210
8211/**
8212 * CSS properties which accept numbers but are not in units of "px".
8213 */
8214var isUnitlessNumber = {
8215 animationIterationCount: true,
8216 borderImageOutset: true,
8217 borderImageSlice: true,
8218 borderImageWidth: true,
8219 boxFlex: true,
8220 boxFlexGroup: true,
8221 boxOrdinalGroup: true,
8222 columnCount: true,
8223 columns: true,
8224 flex: true,
8225 flexGrow: true,
8226 flexPositive: true,
8227 flexShrink: true,
8228 flexNegative: true,
8229 flexOrder: true,
8230 gridArea: true,
8231 gridRow: true,
8232 gridRowEnd: true,
8233 gridRowSpan: true,
8234 gridRowStart: true,
8235 gridColumn: true,
8236 gridColumnEnd: true,
8237 gridColumnSpan: true,
8238 gridColumnStart: true,
8239 fontWeight: true,
8240 lineClamp: true,
8241 lineHeight: true,
8242 opacity: true,
8243 order: true,
8244 orphans: true,
8245 tabSize: true,
8246 widows: true,
8247 zIndex: true,
8248 zoom: true,
8249
8250 // SVG-related properties
8251 fillOpacity: true,
8252 floodOpacity: true,
8253 stopOpacity: true,
8254 strokeDasharray: true,
8255 strokeDashoffset: true,
8256 strokeMiterlimit: true,
8257 strokeOpacity: true,
8258 strokeWidth: true
8259};
8260
8261/**
8262 * @param {string} prefix vendor-specific prefix, eg: Webkit
8263 * @param {string} key style name, eg: transitionDuration
8264 * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
8265 * WebkitTransitionDuration
8266 */
8267function prefixKey(prefix, key) {
8268 return prefix + key.charAt(0).toUpperCase() + key.substring(1);
8269}
8270
8271/**
8272 * Support style names that may come passed in prefixed by adding permutations
8273 * of vendor prefixes.
8274 */
8275var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
8276
8277// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
8278// infinite loop, because it iterates over the newly added props too.
8279Object.keys(isUnitlessNumber).forEach(function (prop) {
8280 prefixes.forEach(function (prefix) {
8281 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
8282 });
8283});
8284
8285/**
8286 * Convert a value into the proper css writable value. The style name `name`
8287 * should be logical (no hyphens), as specified
8288 * in `CSSProperty.isUnitlessNumber`.
8289 *
8290 * @param {string} name CSS property name such as `topMargin`.
8291 * @param {*} value CSS property value such as `10px`.
8292 * @return {string} Normalized style value with dimensions applied.
8293 */
8294function dangerousStyleValue(name, value, isCustomProperty) {
8295 // Note that we've removed escapeTextForBrowser() calls here since the
8296 // whole string will be escaped when the attribute is injected into
8297 // the markup. If you provide unsafe user data here they can inject
8298 // arbitrary CSS which may be problematic (I couldn't repro this):
8299 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
8300 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
8301 // This is not an XSS hole but instead a potential CSS injection issue
8302 // which has lead to a greater discussion about how we're going to
8303 // trust URLs moving forward. See #2115901
8304
8305 var isEmpty = value == null || typeof value === 'boolean' || value === '';
8306 if (isEmpty) {
8307 return '';
8308 }
8309
8310 if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
8311 return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
8312 }
8313
8314 return ('' + value).trim();
8315}
8316
8317var uppercasePattern = /([A-Z])/g;
8318var msPattern = /^ms-/;
8319
8320/**
8321 * Hyphenates a camelcased CSS property name, for example:
8322 *
8323 * > hyphenateStyleName('backgroundColor')
8324 * < "background-color"
8325 * > hyphenateStyleName('MozTransition')
8326 * < "-moz-transition"
8327 * > hyphenateStyleName('msTransition')
8328 * < "-ms-transition"
8329 *
8330 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
8331 * is converted to `-ms-`.
8332 */
8333function hyphenateStyleName(name) {
8334 return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
8335}
8336
8337var warnValidStyle = function () {};
8338
8339{
8340 // 'msTransform' is correct, but the other prefixes should be capitalized
8341 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
8342 var msPattern$1 = /^-ms-/;
8343 var hyphenPattern = /-(.)/g;
8344
8345 // style values shouldn't contain a semicolon
8346 var badStyleValueWithSemicolonPattern = /;\s*$/;
8347
8348 var warnedStyleNames = {};
8349 var warnedStyleValues = {};
8350 var warnedForNaNValue = false;
8351 var warnedForInfinityValue = false;
8352
8353 var camelize = function (string) {
8354 return string.replace(hyphenPattern, function (_, character) {
8355 return character.toUpperCase();
8356 });
8357 };
8358
8359 var warnHyphenatedStyleName = function (name) {
8360 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
8361 return;
8362 }
8363
8364 warnedStyleNames[name] = true;
8365 warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
8366 // As Andi Smith suggests
8367 // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
8368 // is converted to lowercase `ms`.
8369 camelize(name.replace(msPattern$1, 'ms-')));
8370 };
8371
8372 var warnBadVendoredStyleName = function (name) {
8373 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
8374 return;
8375 }
8376
8377 warnedStyleNames[name] = true;
8378 warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
8379 };
8380
8381 var warnStyleValueWithSemicolon = function (name, value) {
8382 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
8383 return;
8384 }
8385
8386 warnedStyleValues[value] = true;
8387 warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
8388 };
8389
8390 var warnStyleValueIsNaN = function (name, value) {
8391 if (warnedForNaNValue) {
8392 return;
8393 }
8394
8395 warnedForNaNValue = true;
8396 warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
8397 };
8398
8399 var warnStyleValueIsInfinity = function (name, value) {
8400 if (warnedForInfinityValue) {
8401 return;
8402 }
8403
8404 warnedForInfinityValue = true;
8405 warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
8406 };
8407
8408 warnValidStyle = function (name, value) {
8409 if (name.indexOf('-') > -1) {
8410 warnHyphenatedStyleName(name);
8411 } else if (badVendoredStyleNamePattern.test(name)) {
8412 warnBadVendoredStyleName(name);
8413 } else if (badStyleValueWithSemicolonPattern.test(value)) {
8414 warnStyleValueWithSemicolon(name, value);
8415 }
8416
8417 if (typeof value === 'number') {
8418 if (isNaN(value)) {
8419 warnStyleValueIsNaN(name, value);
8420 } else if (!isFinite(value)) {
8421 warnStyleValueIsInfinity(name, value);
8422 }
8423 }
8424 };
8425}
8426
8427var warnValidStyle$1 = warnValidStyle;
8428
8429/**
8430 * Operations for dealing with CSS properties.
8431 */
8432
8433/**
8434 * This creates a string that is expected to be equivalent to the style
8435 * attribute generated by server-side rendering. It by-passes warnings and
8436 * security checks so it's not safe to use this value for anything other than
8437 * comparison. It is only used in DEV for SSR validation.
8438 */
8439function createDangerousStringForStyles(styles) {
8440 {
8441 var serialized = '';
8442 var delimiter = '';
8443 for (var styleName in styles) {
8444 if (!styles.hasOwnProperty(styleName)) {
8445 continue;
8446 }
8447 var styleValue = styles[styleName];
8448 if (styleValue != null) {
8449 var isCustomProperty = styleName.indexOf('--') === 0;
8450 serialized += delimiter + hyphenateStyleName(styleName) + ':';
8451 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
8452
8453 delimiter = ';';
8454 }
8455 }
8456 return serialized || null;
8457 }
8458}
8459
8460/**
8461 * Sets the value for multiple styles on a node. If a value is specified as
8462 * '' (empty string), the corresponding style property will be unset.
8463 *
8464 * @param {DOMElement} node
8465 * @param {object} styles
8466 */
8467function setValueForStyles(node, styles) {
8468 var style = node.style;
8469 for (var styleName in styles) {
8470 if (!styles.hasOwnProperty(styleName)) {
8471 continue;
8472 }
8473 var isCustomProperty = styleName.indexOf('--') === 0;
8474 {
8475 if (!isCustomProperty) {
8476 warnValidStyle$1(styleName, styles[styleName]);
8477 }
8478 }
8479 var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
8480 if (styleName === 'float') {
8481 styleName = 'cssFloat';
8482 }
8483 if (isCustomProperty) {
8484 style.setProperty(styleName, styleValue);
8485 } else {
8486 style[styleName] = styleValue;
8487 }
8488 }
8489}
8490
8491function isValueEmpty(value) {
8492 return value == null || typeof value === 'boolean' || value === '';
8493}
8494
8495/**
8496 * Given {color: 'red', overflow: 'hidden'} returns {
8497 * color: 'color',
8498 * overflowX: 'overflow',
8499 * overflowY: 'overflow',
8500 * }. This can be read as "the overflowY property was set by the overflow
8501 * shorthand". That is, the values are the property that each was derived from.
8502 */
8503function expandShorthandMap(styles) {
8504 var expanded = {};
8505 for (var key in styles) {
8506 var longhands = shorthandToLonghand[key] || [key];
8507 for (var i = 0; i < longhands.length; i++) {
8508 expanded[longhands[i]] = key;
8509 }
8510 }
8511 return expanded;
8512}
8513
8514/**
8515 * When mixing shorthand and longhand property names, we warn during updates if
8516 * we expect an incorrect result to occur. In particular, we warn for:
8517 *
8518 * Updating a shorthand property (longhand gets overwritten):
8519 * {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
8520 * becomes .style.font = 'baz'
8521 * Removing a shorthand property (longhand gets lost too):
8522 * {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
8523 * becomes .style.font = ''
8524 * Removing a longhand property (should revert to shorthand; doesn't):
8525 * {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
8526 * becomes .style.fontVariant = ''
8527 */
8528function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
8529 if (!warnAboutShorthandPropertyCollision) {
8530 return;
8531 }
8532
8533 if (!nextStyles) {
8534 return;
8535 }
8536
8537 var expandedUpdates = expandShorthandMap(styleUpdates);
8538 var expandedStyles = expandShorthandMap(nextStyles);
8539 var warnedAbout = {};
8540 for (var key in expandedUpdates) {
8541 var originalKey = expandedUpdates[key];
8542 var correctOriginalKey = expandedStyles[key];
8543 if (correctOriginalKey && originalKey !== correctOriginalKey) {
8544 var warningKey = originalKey + ',' + correctOriginalKey;
8545 if (warnedAbout[warningKey]) {
8546 continue;
8547 }
8548 warnedAbout[warningKey] = true;
8549 warning$1(false, '%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey);
8550 }
8551 }
8552}
8553
8554// For HTML, certain tags should omit their close tag. We keep a whitelist for
8555// those special-case tags.
8556
8557var omittedCloseTags = {
8558 area: true,
8559 base: true,
8560 br: true,
8561 col: true,
8562 embed: true,
8563 hr: true,
8564 img: true,
8565 input: true,
8566 keygen: true,
8567 link: true,
8568 meta: true,
8569 param: true,
8570 source: true,
8571 track: true,
8572 wbr: true
8573 // NOTE: menuitem's close tag should be omitted, but that causes problems.
8574};
8575
8576// For HTML, certain tags cannot have children. This has the same purpose as
8577// `omittedCloseTags` except that `menuitem` should still have its closing tag.
8578
8579var voidElementTags = _assign({
8580 menuitem: true
8581}, omittedCloseTags);
8582
8583// TODO: We can remove this if we add invariantWithStack()
8584// or add stack by default to invariants where possible.
8585var HTML$1 = '__html';
8586
8587var ReactDebugCurrentFrame$2 = null;
8588{
8589 ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
8590}
8591
8592function assertValidProps(tag, props) {
8593 if (!props) {
8594 return;
8595 }
8596 // Note the use of `==` which checks for null or undefined.
8597 if (voidElementTags[tag]) {
8598 !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
8599 }
8600 if (props.dangerouslySetInnerHTML != null) {
8601 !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
8602 !(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;
8603 }
8604 {
8605 !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(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.') : void 0;
8606 }
8607 !(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', ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
8608}
8609
8610function isCustomComponent(tagName, props) {
8611 if (tagName.indexOf('-') === -1) {
8612 return typeof props.is === 'string';
8613 }
8614 switch (tagName) {
8615 // These are reserved SVG and MathML elements.
8616 // We don't mind this whitelist too much because we expect it to never grow.
8617 // The alternative is to track the namespace in a few places which is convoluted.
8618 // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
8619 case 'annotation-xml':
8620 case 'color-profile':
8621 case 'font-face':
8622 case 'font-face-src':
8623 case 'font-face-uri':
8624 case 'font-face-format':
8625 case 'font-face-name':
8626 case 'missing-glyph':
8627 return false;
8628 default:
8629 return true;
8630 }
8631}
8632
8633// When adding attributes to the HTML or SVG whitelist, be sure to
8634// also add them to this module to ensure casing and incorrect name
8635// warnings.
8636var possibleStandardNames = {
8637 // HTML
8638 accept: 'accept',
8639 acceptcharset: 'acceptCharset',
8640 'accept-charset': 'acceptCharset',
8641 accesskey: 'accessKey',
8642 action: 'action',
8643 allowfullscreen: 'allowFullScreen',
8644 alt: 'alt',
8645 as: 'as',
8646 async: 'async',
8647 autocapitalize: 'autoCapitalize',
8648 autocomplete: 'autoComplete',
8649 autocorrect: 'autoCorrect',
8650 autofocus: 'autoFocus',
8651 autoplay: 'autoPlay',
8652 autosave: 'autoSave',
8653 capture: 'capture',
8654 cellpadding: 'cellPadding',
8655 cellspacing: 'cellSpacing',
8656 challenge: 'challenge',
8657 charset: 'charSet',
8658 checked: 'checked',
8659 children: 'children',
8660 cite: 'cite',
8661 class: 'className',
8662 classid: 'classID',
8663 classname: 'className',
8664 cols: 'cols',
8665 colspan: 'colSpan',
8666 content: 'content',
8667 contenteditable: 'contentEditable',
8668 contextmenu: 'contextMenu',
8669 controls: 'controls',
8670 controlslist: 'controlsList',
8671 coords: 'coords',
8672 crossorigin: 'crossOrigin',
8673 dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
8674 data: 'data',
8675 datetime: 'dateTime',
8676 default: 'default',
8677 defaultchecked: 'defaultChecked',
8678 defaultvalue: 'defaultValue',
8679 defer: 'defer',
8680 dir: 'dir',
8681 disabled: 'disabled',
8682 download: 'download',
8683 draggable: 'draggable',
8684 enctype: 'encType',
8685 for: 'htmlFor',
8686 form: 'form',
8687 formmethod: 'formMethod',
8688 formaction: 'formAction',
8689 formenctype: 'formEncType',
8690 formnovalidate: 'formNoValidate',
8691 formtarget: 'formTarget',
8692 frameborder: 'frameBorder',
8693 headers: 'headers',
8694 height: 'height',
8695 hidden: 'hidden',
8696 high: 'high',
8697 href: 'href',
8698 hreflang: 'hrefLang',
8699 htmlfor: 'htmlFor',
8700 httpequiv: 'httpEquiv',
8701 'http-equiv': 'httpEquiv',
8702 icon: 'icon',
8703 id: 'id',
8704 innerhtml: 'innerHTML',
8705 inputmode: 'inputMode',
8706 integrity: 'integrity',
8707 is: 'is',
8708 itemid: 'itemID',
8709 itemprop: 'itemProp',
8710 itemref: 'itemRef',
8711 itemscope: 'itemScope',
8712 itemtype: 'itemType',
8713 keyparams: 'keyParams',
8714 keytype: 'keyType',
8715 kind: 'kind',
8716 label: 'label',
8717 lang: 'lang',
8718 list: 'list',
8719 loop: 'loop',
8720 low: 'low',
8721 manifest: 'manifest',
8722 marginwidth: 'marginWidth',
8723 marginheight: 'marginHeight',
8724 max: 'max',
8725 maxlength: 'maxLength',
8726 media: 'media',
8727 mediagroup: 'mediaGroup',
8728 method: 'method',
8729 min: 'min',
8730 minlength: 'minLength',
8731 multiple: 'multiple',
8732 muted: 'muted',
8733 name: 'name',
8734 nomodule: 'noModule',
8735 nonce: 'nonce',
8736 novalidate: 'noValidate',
8737 open: 'open',
8738 optimum: 'optimum',
8739 pattern: 'pattern',
8740 placeholder: 'placeholder',
8741 playsinline: 'playsInline',
8742 poster: 'poster',
8743 preload: 'preload',
8744 profile: 'profile',
8745 radiogroup: 'radioGroup',
8746 readonly: 'readOnly',
8747 referrerpolicy: 'referrerPolicy',
8748 rel: 'rel',
8749 required: 'required',
8750 reversed: 'reversed',
8751 role: 'role',
8752 rows: 'rows',
8753 rowspan: 'rowSpan',
8754 sandbox: 'sandbox',
8755 scope: 'scope',
8756 scoped: 'scoped',
8757 scrolling: 'scrolling',
8758 seamless: 'seamless',
8759 selected: 'selected',
8760 shape: 'shape',
8761 size: 'size',
8762 sizes: 'sizes',
8763 span: 'span',
8764 spellcheck: 'spellCheck',
8765 src: 'src',
8766 srcdoc: 'srcDoc',
8767 srclang: 'srcLang',
8768 srcset: 'srcSet',
8769 start: 'start',
8770 step: 'step',
8771 style: 'style',
8772 summary: 'summary',
8773 tabindex: 'tabIndex',
8774 target: 'target',
8775 title: 'title',
8776 type: 'type',
8777 usemap: 'useMap',
8778 value: 'value',
8779 width: 'width',
8780 wmode: 'wmode',
8781 wrap: 'wrap',
8782
8783 // SVG
8784 about: 'about',
8785 accentheight: 'accentHeight',
8786 'accent-height': 'accentHeight',
8787 accumulate: 'accumulate',
8788 additive: 'additive',
8789 alignmentbaseline: 'alignmentBaseline',
8790 'alignment-baseline': 'alignmentBaseline',
8791 allowreorder: 'allowReorder',
8792 alphabetic: 'alphabetic',
8793 amplitude: 'amplitude',
8794 arabicform: 'arabicForm',
8795 'arabic-form': 'arabicForm',
8796 ascent: 'ascent',
8797 attributename: 'attributeName',
8798 attributetype: 'attributeType',
8799 autoreverse: 'autoReverse',
8800 azimuth: 'azimuth',
8801 basefrequency: 'baseFrequency',
8802 baselineshift: 'baselineShift',
8803 'baseline-shift': 'baselineShift',
8804 baseprofile: 'baseProfile',
8805 bbox: 'bbox',
8806 begin: 'begin',
8807 bias: 'bias',
8808 by: 'by',
8809 calcmode: 'calcMode',
8810 capheight: 'capHeight',
8811 'cap-height': 'capHeight',
8812 clip: 'clip',
8813 clippath: 'clipPath',
8814 'clip-path': 'clipPath',
8815 clippathunits: 'clipPathUnits',
8816 cliprule: 'clipRule',
8817 'clip-rule': 'clipRule',
8818 color: 'color',
8819 colorinterpolation: 'colorInterpolation',
8820 'color-interpolation': 'colorInterpolation',
8821 colorinterpolationfilters: 'colorInterpolationFilters',
8822 'color-interpolation-filters': 'colorInterpolationFilters',
8823 colorprofile: 'colorProfile',
8824 'color-profile': 'colorProfile',
8825 colorrendering: 'colorRendering',
8826 'color-rendering': 'colorRendering',
8827 contentscripttype: 'contentScriptType',
8828 contentstyletype: 'contentStyleType',
8829 cursor: 'cursor',
8830 cx: 'cx',
8831 cy: 'cy',
8832 d: 'd',
8833 datatype: 'datatype',
8834 decelerate: 'decelerate',
8835 descent: 'descent',
8836 diffuseconstant: 'diffuseConstant',
8837 direction: 'direction',
8838 display: 'display',
8839 divisor: 'divisor',
8840 dominantbaseline: 'dominantBaseline',
8841 'dominant-baseline': 'dominantBaseline',
8842 dur: 'dur',
8843 dx: 'dx',
8844 dy: 'dy',
8845 edgemode: 'edgeMode',
8846 elevation: 'elevation',
8847 enablebackground: 'enableBackground',
8848 'enable-background': 'enableBackground',
8849 end: 'end',
8850 exponent: 'exponent',
8851 externalresourcesrequired: 'externalResourcesRequired',
8852 fill: 'fill',
8853 fillopacity: 'fillOpacity',
8854 'fill-opacity': 'fillOpacity',
8855 fillrule: 'fillRule',
8856 'fill-rule': 'fillRule',
8857 filter: 'filter',
8858 filterres: 'filterRes',
8859 filterunits: 'filterUnits',
8860 floodopacity: 'floodOpacity',
8861 'flood-opacity': 'floodOpacity',
8862 floodcolor: 'floodColor',
8863 'flood-color': 'floodColor',
8864 focusable: 'focusable',
8865 fontfamily: 'fontFamily',
8866 'font-family': 'fontFamily',
8867 fontsize: 'fontSize',
8868 'font-size': 'fontSize',
8869 fontsizeadjust: 'fontSizeAdjust',
8870 'font-size-adjust': 'fontSizeAdjust',
8871 fontstretch: 'fontStretch',
8872 'font-stretch': 'fontStretch',
8873 fontstyle: 'fontStyle',
8874 'font-style': 'fontStyle',
8875 fontvariant: 'fontVariant',
8876 'font-variant': 'fontVariant',
8877 fontweight: 'fontWeight',
8878 'font-weight': 'fontWeight',
8879 format: 'format',
8880 from: 'from',
8881 fx: 'fx',
8882 fy: 'fy',
8883 g1: 'g1',
8884 g2: 'g2',
8885 glyphname: 'glyphName',
8886 'glyph-name': 'glyphName',
8887 glyphorientationhorizontal: 'glyphOrientationHorizontal',
8888 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
8889 glyphorientationvertical: 'glyphOrientationVertical',
8890 'glyph-orientation-vertical': 'glyphOrientationVertical',
8891 glyphref: 'glyphRef',
8892 gradienttransform: 'gradientTransform',
8893 gradientunits: 'gradientUnits',
8894 hanging: 'hanging',
8895 horizadvx: 'horizAdvX',
8896 'horiz-adv-x': 'horizAdvX',
8897 horizoriginx: 'horizOriginX',
8898 'horiz-origin-x': 'horizOriginX',
8899 ideographic: 'ideographic',
8900 imagerendering: 'imageRendering',
8901 'image-rendering': 'imageRendering',
8902 in2: 'in2',
8903 in: 'in',
8904 inlist: 'inlist',
8905 intercept: 'intercept',
8906 k1: 'k1',
8907 k2: 'k2',
8908 k3: 'k3',
8909 k4: 'k4',
8910 k: 'k',
8911 kernelmatrix: 'kernelMatrix',
8912 kernelunitlength: 'kernelUnitLength',
8913 kerning: 'kerning',
8914 keypoints: 'keyPoints',
8915 keysplines: 'keySplines',
8916 keytimes: 'keyTimes',
8917 lengthadjust: 'lengthAdjust',
8918 letterspacing: 'letterSpacing',
8919 'letter-spacing': 'letterSpacing',
8920 lightingcolor: 'lightingColor',
8921 'lighting-color': 'lightingColor',
8922 limitingconeangle: 'limitingConeAngle',
8923 local: 'local',
8924 markerend: 'markerEnd',
8925 'marker-end': 'markerEnd',
8926 markerheight: 'markerHeight',
8927 markermid: 'markerMid',
8928 'marker-mid': 'markerMid',
8929 markerstart: 'markerStart',
8930 'marker-start': 'markerStart',
8931 markerunits: 'markerUnits',
8932 markerwidth: 'markerWidth',
8933 mask: 'mask',
8934 maskcontentunits: 'maskContentUnits',
8935 maskunits: 'maskUnits',
8936 mathematical: 'mathematical',
8937 mode: 'mode',
8938 numoctaves: 'numOctaves',
8939 offset: 'offset',
8940 opacity: 'opacity',
8941 operator: 'operator',
8942 order: 'order',
8943 orient: 'orient',
8944 orientation: 'orientation',
8945 origin: 'origin',
8946 overflow: 'overflow',
8947 overlineposition: 'overlinePosition',
8948 'overline-position': 'overlinePosition',
8949 overlinethickness: 'overlineThickness',
8950 'overline-thickness': 'overlineThickness',
8951 paintorder: 'paintOrder',
8952 'paint-order': 'paintOrder',
8953 panose1: 'panose1',
8954 'panose-1': 'panose1',
8955 pathlength: 'pathLength',
8956 patterncontentunits: 'patternContentUnits',
8957 patterntransform: 'patternTransform',
8958 patternunits: 'patternUnits',
8959 pointerevents: 'pointerEvents',
8960 'pointer-events': 'pointerEvents',
8961 points: 'points',
8962 pointsatx: 'pointsAtX',
8963 pointsaty: 'pointsAtY',
8964 pointsatz: 'pointsAtZ',
8965 prefix: 'prefix',
8966 preservealpha: 'preserveAlpha',
8967 preserveaspectratio: 'preserveAspectRatio',
8968 primitiveunits: 'primitiveUnits',
8969 property: 'property',
8970 r: 'r',
8971 radius: 'radius',
8972 refx: 'refX',
8973 refy: 'refY',
8974 renderingintent: 'renderingIntent',
8975 'rendering-intent': 'renderingIntent',
8976 repeatcount: 'repeatCount',
8977 repeatdur: 'repeatDur',
8978 requiredextensions: 'requiredExtensions',
8979 requiredfeatures: 'requiredFeatures',
8980 resource: 'resource',
8981 restart: 'restart',
8982 result: 'result',
8983 results: 'results',
8984 rotate: 'rotate',
8985 rx: 'rx',
8986 ry: 'ry',
8987 scale: 'scale',
8988 security: 'security',
8989 seed: 'seed',
8990 shaperendering: 'shapeRendering',
8991 'shape-rendering': 'shapeRendering',
8992 slope: 'slope',
8993 spacing: 'spacing',
8994 specularconstant: 'specularConstant',
8995 specularexponent: 'specularExponent',
8996 speed: 'speed',
8997 spreadmethod: 'spreadMethod',
8998 startoffset: 'startOffset',
8999 stddeviation: 'stdDeviation',
9000 stemh: 'stemh',
9001 stemv: 'stemv',
9002 stitchtiles: 'stitchTiles',
9003 stopcolor: 'stopColor',
9004 'stop-color': 'stopColor',
9005 stopopacity: 'stopOpacity',
9006 'stop-opacity': 'stopOpacity',
9007 strikethroughposition: 'strikethroughPosition',
9008 'strikethrough-position': 'strikethroughPosition',
9009 strikethroughthickness: 'strikethroughThickness',
9010 'strikethrough-thickness': 'strikethroughThickness',
9011 string: 'string',
9012 stroke: 'stroke',
9013 strokedasharray: 'strokeDasharray',
9014 'stroke-dasharray': 'strokeDasharray',
9015 strokedashoffset: 'strokeDashoffset',
9016 'stroke-dashoffset': 'strokeDashoffset',
9017 strokelinecap: 'strokeLinecap',
9018 'stroke-linecap': 'strokeLinecap',
9019 strokelinejoin: 'strokeLinejoin',
9020 'stroke-linejoin': 'strokeLinejoin',
9021 strokemiterlimit: 'strokeMiterlimit',
9022 'stroke-miterlimit': 'strokeMiterlimit',
9023 strokewidth: 'strokeWidth',
9024 'stroke-width': 'strokeWidth',
9025 strokeopacity: 'strokeOpacity',
9026 'stroke-opacity': 'strokeOpacity',
9027 suppresscontenteditablewarning: 'suppressContentEditableWarning',
9028 suppresshydrationwarning: 'suppressHydrationWarning',
9029 surfacescale: 'surfaceScale',
9030 systemlanguage: 'systemLanguage',
9031 tablevalues: 'tableValues',
9032 targetx: 'targetX',
9033 targety: 'targetY',
9034 textanchor: 'textAnchor',
9035 'text-anchor': 'textAnchor',
9036 textdecoration: 'textDecoration',
9037 'text-decoration': 'textDecoration',
9038 textlength: 'textLength',
9039 textrendering: 'textRendering',
9040 'text-rendering': 'textRendering',
9041 to: 'to',
9042 transform: 'transform',
9043 typeof: 'typeof',
9044 u1: 'u1',
9045 u2: 'u2',
9046 underlineposition: 'underlinePosition',
9047 'underline-position': 'underlinePosition',
9048 underlinethickness: 'underlineThickness',
9049 'underline-thickness': 'underlineThickness',
9050 unicode: 'unicode',
9051 unicodebidi: 'unicodeBidi',
9052 'unicode-bidi': 'unicodeBidi',
9053 unicoderange: 'unicodeRange',
9054 'unicode-range': 'unicodeRange',
9055 unitsperem: 'unitsPerEm',
9056 'units-per-em': 'unitsPerEm',
9057 unselectable: 'unselectable',
9058 valphabetic: 'vAlphabetic',
9059 'v-alphabetic': 'vAlphabetic',
9060 values: 'values',
9061 vectoreffect: 'vectorEffect',
9062 'vector-effect': 'vectorEffect',
9063 version: 'version',
9064 vertadvy: 'vertAdvY',
9065 'vert-adv-y': 'vertAdvY',
9066 vertoriginx: 'vertOriginX',
9067 'vert-origin-x': 'vertOriginX',
9068 vertoriginy: 'vertOriginY',
9069 'vert-origin-y': 'vertOriginY',
9070 vhanging: 'vHanging',
9071 'v-hanging': 'vHanging',
9072 videographic: 'vIdeographic',
9073 'v-ideographic': 'vIdeographic',
9074 viewbox: 'viewBox',
9075 viewtarget: 'viewTarget',
9076 visibility: 'visibility',
9077 vmathematical: 'vMathematical',
9078 'v-mathematical': 'vMathematical',
9079 vocab: 'vocab',
9080 widths: 'widths',
9081 wordspacing: 'wordSpacing',
9082 'word-spacing': 'wordSpacing',
9083 writingmode: 'writingMode',
9084 'writing-mode': 'writingMode',
9085 x1: 'x1',
9086 x2: 'x2',
9087 x: 'x',
9088 xchannelselector: 'xChannelSelector',
9089 xheight: 'xHeight',
9090 'x-height': 'xHeight',
9091 xlinkactuate: 'xlinkActuate',
9092 'xlink:actuate': 'xlinkActuate',
9093 xlinkarcrole: 'xlinkArcrole',
9094 'xlink:arcrole': 'xlinkArcrole',
9095 xlinkhref: 'xlinkHref',
9096 'xlink:href': 'xlinkHref',
9097 xlinkrole: 'xlinkRole',
9098 'xlink:role': 'xlinkRole',
9099 xlinkshow: 'xlinkShow',
9100 'xlink:show': 'xlinkShow',
9101 xlinktitle: 'xlinkTitle',
9102 'xlink:title': 'xlinkTitle',
9103 xlinktype: 'xlinkType',
9104 'xlink:type': 'xlinkType',
9105 xmlbase: 'xmlBase',
9106 'xml:base': 'xmlBase',
9107 xmllang: 'xmlLang',
9108 'xml:lang': 'xmlLang',
9109 xmlns: 'xmlns',
9110 'xml:space': 'xmlSpace',
9111 xmlnsxlink: 'xmlnsXlink',
9112 'xmlns:xlink': 'xmlnsXlink',
9113 xmlspace: 'xmlSpace',
9114 y1: 'y1',
9115 y2: 'y2',
9116 y: 'y',
9117 ychannelselector: 'yChannelSelector',
9118 z: 'z',
9119 zoomandpan: 'zoomAndPan'
9120};
9121
9122var ariaProperties = {
9123 'aria-current': 0, // state
9124 'aria-details': 0,
9125 'aria-disabled': 0, // state
9126 'aria-hidden': 0, // state
9127 'aria-invalid': 0, // state
9128 'aria-keyshortcuts': 0,
9129 'aria-label': 0,
9130 'aria-roledescription': 0,
9131 // Widget Attributes
9132 'aria-autocomplete': 0,
9133 'aria-checked': 0,
9134 'aria-expanded': 0,
9135 'aria-haspopup': 0,
9136 'aria-level': 0,
9137 'aria-modal': 0,
9138 'aria-multiline': 0,
9139 'aria-multiselectable': 0,
9140 'aria-orientation': 0,
9141 'aria-placeholder': 0,
9142 'aria-pressed': 0,
9143 'aria-readonly': 0,
9144 'aria-required': 0,
9145 'aria-selected': 0,
9146 'aria-sort': 0,
9147 'aria-valuemax': 0,
9148 'aria-valuemin': 0,
9149 'aria-valuenow': 0,
9150 'aria-valuetext': 0,
9151 // Live Region Attributes
9152 'aria-atomic': 0,
9153 'aria-busy': 0,
9154 'aria-live': 0,
9155 'aria-relevant': 0,
9156 // Drag-and-Drop Attributes
9157 'aria-dropeffect': 0,
9158 'aria-grabbed': 0,
9159 // Relationship Attributes
9160 'aria-activedescendant': 0,
9161 'aria-colcount': 0,
9162 'aria-colindex': 0,
9163 'aria-colspan': 0,
9164 'aria-controls': 0,
9165 'aria-describedby': 0,
9166 'aria-errormessage': 0,
9167 'aria-flowto': 0,
9168 'aria-labelledby': 0,
9169 'aria-owns': 0,
9170 'aria-posinset': 0,
9171 'aria-rowcount': 0,
9172 'aria-rowindex': 0,
9173 'aria-rowspan': 0,
9174 'aria-setsize': 0
9175};
9176
9177var warnedProperties = {};
9178var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
9179var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
9180
9181var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
9182
9183function validateProperty(tagName, name) {
9184 if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
9185 return true;
9186 }
9187
9188 if (rARIACamel.test(name)) {
9189 var ariaName = 'aria-' + name.slice(4).toLowerCase();
9190 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
9191
9192 // If this is an aria-* attribute, but is not listed in the known DOM
9193 // DOM properties, then it is an invalid aria-* attribute.
9194 if (correctName == null) {
9195 warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
9196 warnedProperties[name] = true;
9197 return true;
9198 }
9199 // aria-* attributes should be lowercase; suggest the lowercase version.
9200 if (name !== correctName) {
9201 warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
9202 warnedProperties[name] = true;
9203 return true;
9204 }
9205 }
9206
9207 if (rARIA.test(name)) {
9208 var lowerCasedName = name.toLowerCase();
9209 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
9210
9211 // If this is an aria-* attribute, but is not listed in the known DOM
9212 // DOM properties, then it is an invalid aria-* attribute.
9213 if (standardName == null) {
9214 warnedProperties[name] = true;
9215 return false;
9216 }
9217 // aria-* attributes should be lowercase; suggest the lowercase version.
9218 if (name !== standardName) {
9219 warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
9220 warnedProperties[name] = true;
9221 return true;
9222 }
9223 }
9224
9225 return true;
9226}
9227
9228function warnInvalidARIAProps(type, props) {
9229 var invalidProps = [];
9230
9231 for (var key in props) {
9232 var isValid = validateProperty(type, key);
9233 if (!isValid) {
9234 invalidProps.push(key);
9235 }
9236 }
9237
9238 var unknownPropString = invalidProps.map(function (prop) {
9239 return '`' + prop + '`';
9240 }).join(', ');
9241
9242 if (invalidProps.length === 1) {
9243 warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
9244 } else if (invalidProps.length > 1) {
9245 warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
9246 }
9247}
9248
9249function validateProperties(type, props) {
9250 if (isCustomComponent(type, props)) {
9251 return;
9252 }
9253 warnInvalidARIAProps(type, props);
9254}
9255
9256var didWarnValueNull = false;
9257
9258function validateProperties$1(type, props) {
9259 if (type !== 'input' && type !== 'textarea' && type !== 'select') {
9260 return;
9261 }
9262
9263 if (props != null && props.value === null && !didWarnValueNull) {
9264 didWarnValueNull = true;
9265 if (type === 'select' && props.multiple) {
9266 warning$1(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.', type);
9267 } else {
9268 warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
9269 }
9270 }
9271}
9272
9273var validateProperty$1 = function () {};
9274
9275{
9276 var warnedProperties$1 = {};
9277 var _hasOwnProperty = Object.prototype.hasOwnProperty;
9278 var EVENT_NAME_REGEX = /^on./;
9279 var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
9280 var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
9281 var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
9282
9283 validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
9284 if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
9285 return true;
9286 }
9287
9288 var lowerCasedName = name.toLowerCase();
9289 if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
9290 warning$1(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.');
9291 warnedProperties$1[name] = true;
9292 return true;
9293 }
9294
9295 // We can't rely on the event system being injected on the server.
9296 if (canUseEventSystem) {
9297 if (registrationNameModules.hasOwnProperty(name)) {
9298 return true;
9299 }
9300 var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
9301 if (registrationName != null) {
9302 warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
9303 warnedProperties$1[name] = true;
9304 return true;
9305 }
9306 if (EVENT_NAME_REGEX.test(name)) {
9307 warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
9308 warnedProperties$1[name] = true;
9309 return true;
9310 }
9311 } else if (EVENT_NAME_REGEX.test(name)) {
9312 // If no event plugins have been injected, we are in a server environment.
9313 // So we can't tell if the event name is correct for sure, but we can filter
9314 // out known bad ones like `onclick`. We can't suggest a specific replacement though.
9315 if (INVALID_EVENT_NAME_REGEX.test(name)) {
9316 warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
9317 }
9318 warnedProperties$1[name] = true;
9319 return true;
9320 }
9321
9322 // Let the ARIA attribute hook validate ARIA attributes
9323 if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
9324 return true;
9325 }
9326
9327 if (lowerCasedName === 'innerhtml') {
9328 warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
9329 warnedProperties$1[name] = true;
9330 return true;
9331 }
9332
9333 if (lowerCasedName === 'aria') {
9334 warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
9335 warnedProperties$1[name] = true;
9336 return true;
9337 }
9338
9339 if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
9340 warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
9341 warnedProperties$1[name] = true;
9342 return true;
9343 }
9344
9345 if (typeof value === 'number' && isNaN(value)) {
9346 warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
9347 warnedProperties$1[name] = true;
9348 return true;
9349 }
9350
9351 var propertyInfo = getPropertyInfo(name);
9352 var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
9353
9354 // Known attributes should match the casing specified in the property config.
9355 if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
9356 var standardName = possibleStandardNames[lowerCasedName];
9357 if (standardName !== name) {
9358 warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
9359 warnedProperties$1[name] = true;
9360 return true;
9361 }
9362 } else if (!isReserved && name !== lowerCasedName) {
9363 // Unknown attributes should have lowercase casing since that's how they
9364 // will be cased anyway with server rendering.
9365 warning$1(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.', name, lowerCasedName);
9366 warnedProperties$1[name] = true;
9367 return true;
9368 }
9369
9370 if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
9371 if (value) {
9372 warning$1(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()}.', value, name, name, value, name);
9373 } else {
9374 warning$1(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.', value, name, name, value, name, name, name);
9375 }
9376 warnedProperties$1[name] = true;
9377 return true;
9378 }
9379
9380 // Now that we've validated casing, do not validate
9381 // data types for reserved props
9382 if (isReserved) {
9383 return true;
9384 }
9385
9386 // Warn when a known attribute is a bad type
9387 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
9388 warnedProperties$1[name] = true;
9389 return false;
9390 }
9391
9392 // Warn when passing the strings 'false' or 'true' into a boolean prop
9393 if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
9394 warning$1(false, 'Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
9395 warnedProperties$1[name] = true;
9396 return true;
9397 }
9398
9399 return true;
9400 };
9401}
9402
9403var warnUnknownProperties = function (type, props, canUseEventSystem) {
9404 var unknownProps = [];
9405 for (var key in props) {
9406 var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
9407 if (!isValid) {
9408 unknownProps.push(key);
9409 }
9410 }
9411
9412 var unknownPropString = unknownProps.map(function (prop) {
9413 return '`' + prop + '`';
9414 }).join(', ');
9415 if (unknownProps.length === 1) {
9416 warning$1(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', unknownPropString, type);
9417 } else if (unknownProps.length > 1) {
9418 warning$1(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', unknownPropString, type);
9419 }
9420};
9421
9422function validateProperties$2(type, props, canUseEventSystem) {
9423 if (isCustomComponent(type, props)) {
9424 return;
9425 }
9426 warnUnknownProperties(type, props, canUseEventSystem);
9427}
9428
9429// TODO: direct imports like some-package/src/* are bad. Fix me.
9430var didWarnInvalidHydration = false;
9431var didWarnShadyDOM = false;
9432
9433var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
9434var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
9435var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
9436var AUTOFOCUS = 'autoFocus';
9437var CHILDREN = 'children';
9438var STYLE$1 = 'style';
9439var HTML = '__html';
9440
9441var HTML_NAMESPACE = Namespaces.html;
9442
9443
9444var warnedUnknownTags = void 0;
9445var suppressHydrationWarning = void 0;
9446
9447var validatePropertiesInDevelopment = void 0;
9448var warnForTextDifference = void 0;
9449var warnForPropDifference = void 0;
9450var warnForExtraAttributes = void 0;
9451var warnForInvalidEventListener = void 0;
9452var canDiffStyleForHydrationWarning = void 0;
9453
9454var normalizeMarkupForTextOrAttribute = void 0;
9455var normalizeHTML = void 0;
9456
9457{
9458 warnedUnknownTags = {
9459 // Chrome is the only major browser not shipping <time>. But as of July
9460 // 2017 it intends to ship it due to widespread usage. We intentionally
9461 // *don't* warn for <time> even if it's unrecognized by Chrome because
9462 // it soon will be, and many apps have been using it anyway.
9463 time: true,
9464 // There are working polyfills for <dialog>. Let people use it.
9465 dialog: true,
9466 // Electron ships a custom <webview> tag to display external web content in
9467 // an isolated frame and process.
9468 // This tag is not present in non Electron environments such as JSDom which
9469 // is often used for testing purposes.
9470 // @see https://electronjs.org/docs/api/webview-tag
9471 webview: true
9472 };
9473
9474 validatePropertiesInDevelopment = function (type, props) {
9475 validateProperties(type, props);
9476 validateProperties$1(type, props);
9477 validateProperties$2(type, props, /* canUseEventSystem */true);
9478 };
9479
9480 // IE 11 parses & normalizes the style attribute as opposed to other
9481 // browsers. It adds spaces and sorts the properties in some
9482 // non-alphabetical order. Handling that would require sorting CSS
9483 // properties in the client & server versions or applying
9484 // `expectedStyle` to a temporary DOM node to read its `style` attribute
9485 // normalized. Since it only affects IE, we're skipping style warnings
9486 // in that browser completely in favor of doing all that work.
9487 // See https://github.com/facebook/react/issues/11807
9488 canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode;
9489
9490 // HTML parsing normalizes CR and CRLF to LF.
9491 // It also can turn \u0000 into \uFFFD inside attributes.
9492 // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream
9493 // If we have a mismatch, it might be caused by that.
9494 // We will still patch up in this case but not fire the warning.
9495 var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
9496 var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
9497
9498 normalizeMarkupForTextOrAttribute = function (markup) {
9499 var markupString = typeof markup === 'string' ? markup : '' + markup;
9500 return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
9501 };
9502
9503 warnForTextDifference = function (serverText, clientText) {
9504 if (didWarnInvalidHydration) {
9505 return;
9506 }
9507 var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
9508 var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
9509 if (normalizedServerText === normalizedClientText) {
9510 return;
9511 }
9512 didWarnInvalidHydration = true;
9513 warningWithoutStack$1(false, 'Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
9514 };
9515
9516 warnForPropDifference = function (propName, serverValue, clientValue) {
9517 if (didWarnInvalidHydration) {
9518 return;
9519 }
9520 var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
9521 var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
9522 if (normalizedServerValue === normalizedClientValue) {
9523 return;
9524 }
9525 didWarnInvalidHydration = true;
9526 warningWithoutStack$1(false, 'Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
9527 };
9528
9529 warnForExtraAttributes = function (attributeNames) {
9530 if (didWarnInvalidHydration) {
9531 return;
9532 }
9533 didWarnInvalidHydration = true;
9534 var names = [];
9535 attributeNames.forEach(function (name) {
9536 names.push(name);
9537 });
9538 warningWithoutStack$1(false, 'Extra attributes from the server: %s', names);
9539 };
9540
9541 warnForInvalidEventListener = function (registrationName, listener) {
9542 if (listener === false) {
9543 warning$1(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.', registrationName, registrationName, registrationName);
9544 } else {
9545 warning$1(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener);
9546 }
9547 };
9548
9549 // Parse the HTML and read it back to normalize the HTML string so that it
9550 // can be used for comparison.
9551 normalizeHTML = function (parent, html) {
9552 // We could have created a separate document here to avoid
9553 // re-initializing custom elements if they exist. But this breaks
9554 // how <noscript> is being handled. So we use the same document.
9555 // See the discussion in https://github.com/facebook/react/pull/11157.
9556 var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
9557 testElement.innerHTML = html;
9558 return testElement.innerHTML;
9559 };
9560}
9561
9562function ensureListeningTo(rootContainerElement, registrationName) {
9563 var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE;
9564 var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument;
9565 listenTo(registrationName, doc);
9566}
9567
9568function getOwnerDocumentFromRootContainer(rootContainerElement) {
9569 return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
9570}
9571
9572function noop() {}
9573
9574function trapClickOnNonInteractiveElement(node) {
9575 // Mobile Safari does not fire properly bubble click events on
9576 // non-interactive elements, which means delegated click listeners do not
9577 // fire. The workaround for this bug involves attaching an empty click
9578 // listener on the target node.
9579 // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
9580 // Just set it using the onclick property so that we don't have to manage any
9581 // bookkeeping for it. Not sure if we need to clear it when the listener is
9582 // removed.
9583 // TODO: Only do this for the relevant Safaris maybe?
9584 node.onclick = noop;
9585}
9586
9587function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
9588 for (var propKey in nextProps) {
9589 if (!nextProps.hasOwnProperty(propKey)) {
9590 continue;
9591 }
9592 var nextProp = nextProps[propKey];
9593 if (propKey === STYLE$1) {
9594 {
9595 if (nextProp) {
9596 // Freeze the next style object so that we can assume it won't be
9597 // mutated. We have already warned for this in the past.
9598 Object.freeze(nextProp);
9599 }
9600 }
9601 // Relies on `updateStylesByID` not mutating `styleUpdates`.
9602 setValueForStyles(domElement, nextProp);
9603 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
9604 var nextHtml = nextProp ? nextProp[HTML] : undefined;
9605 if (nextHtml != null) {
9606 setInnerHTML(domElement, nextHtml);
9607 }
9608 } else if (propKey === CHILDREN) {
9609 if (typeof nextProp === 'string') {
9610 // Avoid setting initial textContent when the text is empty. In IE11 setting
9611 // textContent on a <textarea> will cause the placeholder to not
9612 // show within the <textarea> until it has been focused and blurred again.
9613 // https://github.com/facebook/react/issues/6731#issuecomment-254874553
9614 var canSetTextContent = tag !== 'textarea' || nextProp !== '';
9615 if (canSetTextContent) {
9616 setTextContent(domElement, nextProp);
9617 }
9618 } else if (typeof nextProp === 'number') {
9619 setTextContent(domElement, '' + nextProp);
9620 }
9621 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
9622 // Noop
9623 } else if (propKey === AUTOFOCUS) {
9624 // We polyfill it separately on the client during commit.
9625 // We could have excluded it in the property list instead of
9626 // adding a special case here, but then it wouldn't be emitted
9627 // on server rendering (but we *do* want to emit it in SSR).
9628 } else if (registrationNameModules.hasOwnProperty(propKey)) {
9629 if (nextProp != null) {
9630 if (true && typeof nextProp !== 'function') {
9631 warnForInvalidEventListener(propKey, nextProp);
9632 }
9633 ensureListeningTo(rootContainerElement, propKey);
9634 }
9635 } else if (nextProp != null) {
9636 setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
9637 }
9638 }
9639}
9640
9641function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
9642 // TODO: Handle wasCustomComponentTag
9643 for (var i = 0; i < updatePayload.length; i += 2) {
9644 var propKey = updatePayload[i];
9645 var propValue = updatePayload[i + 1];
9646 if (propKey === STYLE$1) {
9647 setValueForStyles(domElement, propValue);
9648 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
9649 setInnerHTML(domElement, propValue);
9650 } else if (propKey === CHILDREN) {
9651 setTextContent(domElement, propValue);
9652 } else {
9653 setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
9654 }
9655 }
9656}
9657
9658function createElement(type, props, rootContainerElement, parentNamespace) {
9659 var isCustomComponentTag = void 0;
9660
9661 // We create tags in the namespace of their parent container, except HTML
9662 // tags get no namespace.
9663 var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
9664 var domElement = void 0;
9665 var namespaceURI = parentNamespace;
9666 if (namespaceURI === HTML_NAMESPACE) {
9667 namespaceURI = getIntrinsicNamespace(type);
9668 }
9669 if (namespaceURI === HTML_NAMESPACE) {
9670 {
9671 isCustomComponentTag = isCustomComponent(type, props);
9672 // Should this check be gated by parent namespace? Not sure we want to
9673 // allow <SVG> or <mATH>.
9674 !(isCustomComponentTag || type === type.toLowerCase()) ? warning$1(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type) : void 0;
9675 }
9676
9677 if (type === 'script') {
9678 // Create the script via .innerHTML so its "parser-inserted" flag is
9679 // set to true and it does not execute
9680 var div = ownerDocument.createElement('div');
9681 div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
9682 // This is guaranteed to yield a script element.
9683 var firstChild = div.firstChild;
9684 domElement = div.removeChild(firstChild);
9685 } else if (typeof props.is === 'string') {
9686 // $FlowIssue `createElement` should be updated for Web Components
9687 domElement = ownerDocument.createElement(type, { is: props.is });
9688 } else {
9689 // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
9690 // See discussion in https://github.com/facebook/react/pull/6896
9691 // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
9692 domElement = ownerDocument.createElement(type);
9693 // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple`
9694 // attribute on `select`s needs to be added before `option`s are inserted. This prevents
9695 // a bug where the `select` does not scroll to the correct option because singular
9696 // `select` elements automatically pick the first item.
9697 // See https://github.com/facebook/react/issues/13222
9698 if (type === 'select' && props.multiple) {
9699 var node = domElement;
9700 node.multiple = true;
9701 }
9702 }
9703 } else {
9704 domElement = ownerDocument.createElementNS(namespaceURI, type);
9705 }
9706
9707 {
9708 if (namespaceURI === HTML_NAMESPACE) {
9709 if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
9710 warnedUnknownTags[type] = true;
9711 warning$1(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);
9712 }
9713 }
9714 }
9715
9716 return domElement;
9717}
9718
9719function createTextNode(text, rootContainerElement) {
9720 return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
9721}
9722
9723function setInitialProperties(domElement, tag, rawProps, rootContainerElement) {
9724 var isCustomComponentTag = isCustomComponent(tag, rawProps);
9725 {
9726 validatePropertiesInDevelopment(tag, rawProps);
9727 if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
9728 warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
9729 didWarnShadyDOM = true;
9730 }
9731 }
9732
9733 // TODO: Make sure that we check isMounted before firing any of these events.
9734 var props = void 0;
9735 switch (tag) {
9736 case 'iframe':
9737 case 'object':
9738 trapBubbledEvent(TOP_LOAD, domElement);
9739 props = rawProps;
9740 break;
9741 case 'video':
9742 case 'audio':
9743 // Create listener for each media event
9744 for (var i = 0; i < mediaEventTypes.length; i++) {
9745 trapBubbledEvent(mediaEventTypes[i], domElement);
9746 }
9747 props = rawProps;
9748 break;
9749 case 'source':
9750 trapBubbledEvent(TOP_ERROR, domElement);
9751 props = rawProps;
9752 break;
9753 case 'img':
9754 case 'image':
9755 case 'link':
9756 trapBubbledEvent(TOP_ERROR, domElement);
9757 trapBubbledEvent(TOP_LOAD, domElement);
9758 props = rawProps;
9759 break;
9760 case 'form':
9761 trapBubbledEvent(TOP_RESET, domElement);
9762 trapBubbledEvent(TOP_SUBMIT, domElement);
9763 props = rawProps;
9764 break;
9765 case 'details':
9766 trapBubbledEvent(TOP_TOGGLE, domElement);
9767 props = rawProps;
9768 break;
9769 case 'input':
9770 initWrapperState(domElement, rawProps);
9771 props = getHostProps(domElement, rawProps);
9772 trapBubbledEvent(TOP_INVALID, domElement);
9773 // For controlled components we always need to ensure we're listening
9774 // to onChange. Even if there is no listener.
9775 ensureListeningTo(rootContainerElement, 'onChange');
9776 break;
9777 case 'option':
9778 validateProps(domElement, rawProps);
9779 props = getHostProps$1(domElement, rawProps);
9780 break;
9781 case 'select':
9782 initWrapperState$1(domElement, rawProps);
9783 props = getHostProps$2(domElement, rawProps);
9784 trapBubbledEvent(TOP_INVALID, domElement);
9785 // For controlled components we always need to ensure we're listening
9786 // to onChange. Even if there is no listener.
9787 ensureListeningTo(rootContainerElement, 'onChange');
9788 break;
9789 case 'textarea':
9790 initWrapperState$2(domElement, rawProps);
9791 props = getHostProps$3(domElement, rawProps);
9792 trapBubbledEvent(TOP_INVALID, domElement);
9793 // For controlled components we always need to ensure we're listening
9794 // to onChange. Even if there is no listener.
9795 ensureListeningTo(rootContainerElement, 'onChange');
9796 break;
9797 default:
9798 props = rawProps;
9799 }
9800
9801 assertValidProps(tag, props);
9802
9803 setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
9804
9805 switch (tag) {
9806 case 'input':
9807 // TODO: Make sure we check if this is still unmounted or do any clean
9808 // up necessary since we never stop tracking anymore.
9809 track(domElement);
9810 postMountWrapper(domElement, rawProps, false);
9811 break;
9812 case 'textarea':
9813 // TODO: Make sure we check if this is still unmounted or do any clean
9814 // up necessary since we never stop tracking anymore.
9815 track(domElement);
9816 postMountWrapper$3(domElement, rawProps);
9817 break;
9818 case 'option':
9819 postMountWrapper$1(domElement, rawProps);
9820 break;
9821 case 'select':
9822 postMountWrapper$2(domElement, rawProps);
9823 break;
9824 default:
9825 if (typeof props.onClick === 'function') {
9826 // TODO: This cast may not be sound for SVG, MathML or custom elements.
9827 trapClickOnNonInteractiveElement(domElement);
9828 }
9829 break;
9830 }
9831}
9832
9833// Calculate the diff between the two objects.
9834function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
9835 {
9836 validatePropertiesInDevelopment(tag, nextRawProps);
9837 }
9838
9839 var updatePayload = null;
9840
9841 var lastProps = void 0;
9842 var nextProps = void 0;
9843 switch (tag) {
9844 case 'input':
9845 lastProps = getHostProps(domElement, lastRawProps);
9846 nextProps = getHostProps(domElement, nextRawProps);
9847 updatePayload = [];
9848 break;
9849 case 'option':
9850 lastProps = getHostProps$1(domElement, lastRawProps);
9851 nextProps = getHostProps$1(domElement, nextRawProps);
9852 updatePayload = [];
9853 break;
9854 case 'select':
9855 lastProps = getHostProps$2(domElement, lastRawProps);
9856 nextProps = getHostProps$2(domElement, nextRawProps);
9857 updatePayload = [];
9858 break;
9859 case 'textarea':
9860 lastProps = getHostProps$3(domElement, lastRawProps);
9861 nextProps = getHostProps$3(domElement, nextRawProps);
9862 updatePayload = [];
9863 break;
9864 default:
9865 lastProps = lastRawProps;
9866 nextProps = nextRawProps;
9867 if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
9868 // TODO: This cast may not be sound for SVG, MathML or custom elements.
9869 trapClickOnNonInteractiveElement(domElement);
9870 }
9871 break;
9872 }
9873
9874 assertValidProps(tag, nextProps);
9875
9876 var propKey = void 0;
9877 var styleName = void 0;
9878 var styleUpdates = null;
9879 for (propKey in lastProps) {
9880 if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
9881 continue;
9882 }
9883 if (propKey === STYLE$1) {
9884 var lastStyle = lastProps[propKey];
9885 for (styleName in lastStyle) {
9886 if (lastStyle.hasOwnProperty(styleName)) {
9887 if (!styleUpdates) {
9888 styleUpdates = {};
9889 }
9890 styleUpdates[styleName] = '';
9891 }
9892 }
9893 } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) {
9894 // Noop. This is handled by the clear text mechanism.
9895 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
9896 // Noop
9897 } else if (propKey === AUTOFOCUS) {
9898 // Noop. It doesn't work on updates anyway.
9899 } else if (registrationNameModules.hasOwnProperty(propKey)) {
9900 // This is a special case. If any listener updates we need to ensure
9901 // that the "current" fiber pointer gets updated so we need a commit
9902 // to update this element.
9903 if (!updatePayload) {
9904 updatePayload = [];
9905 }
9906 } else {
9907 // For all other deleted properties we add it to the queue. We use
9908 // the whitelist in the commit phase instead.
9909 (updatePayload = updatePayload || []).push(propKey, null);
9910 }
9911 }
9912 for (propKey in nextProps) {
9913 var nextProp = nextProps[propKey];
9914 var lastProp = lastProps != null ? lastProps[propKey] : undefined;
9915 if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
9916 continue;
9917 }
9918 if (propKey === STYLE$1) {
9919 {
9920 if (nextProp) {
9921 // Freeze the next style object so that we can assume it won't be
9922 // mutated. We have already warned for this in the past.
9923 Object.freeze(nextProp);
9924 }
9925 }
9926 if (lastProp) {
9927 // Unset styles on `lastProp` but not on `nextProp`.
9928 for (styleName in lastProp) {
9929 if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
9930 if (!styleUpdates) {
9931 styleUpdates = {};
9932 }
9933 styleUpdates[styleName] = '';
9934 }
9935 }
9936 // Update styles that changed since `lastProp`.
9937 for (styleName in nextProp) {
9938 if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
9939 if (!styleUpdates) {
9940 styleUpdates = {};
9941 }
9942 styleUpdates[styleName] = nextProp[styleName];
9943 }
9944 }
9945 } else {
9946 // Relies on `updateStylesByID` not mutating `styleUpdates`.
9947 if (!styleUpdates) {
9948 if (!updatePayload) {
9949 updatePayload = [];
9950 }
9951 updatePayload.push(propKey, styleUpdates);
9952 }
9953 styleUpdates = nextProp;
9954 }
9955 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
9956 var nextHtml = nextProp ? nextProp[HTML] : undefined;
9957 var lastHtml = lastProp ? lastProp[HTML] : undefined;
9958 if (nextHtml != null) {
9959 if (lastHtml !== nextHtml) {
9960 (updatePayload = updatePayload || []).push(propKey, '' + nextHtml);
9961 }
9962 } else {
9963 // TODO: It might be too late to clear this if we have children
9964 // inserted already.
9965 }
9966 } else if (propKey === CHILDREN) {
9967 if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
9968 (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
9969 }
9970 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
9971 // Noop
9972 } else if (registrationNameModules.hasOwnProperty(propKey)) {
9973 if (nextProp != null) {
9974 // We eagerly listen to this even though we haven't committed yet.
9975 if (true && typeof nextProp !== 'function') {
9976 warnForInvalidEventListener(propKey, nextProp);
9977 }
9978 ensureListeningTo(rootContainerElement, propKey);
9979 }
9980 if (!updatePayload && lastProp !== nextProp) {
9981 // This is a special case. If any listener updates we need to ensure
9982 // that the "current" props pointer gets updated so we need a commit
9983 // to update this element.
9984 updatePayload = [];
9985 }
9986 } else {
9987 // For any other property we always add it to the queue and then we
9988 // filter it out using the whitelist during the commit.
9989 (updatePayload = updatePayload || []).push(propKey, nextProp);
9990 }
9991 }
9992 if (styleUpdates) {
9993 {
9994 validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE$1]);
9995 }
9996 (updatePayload = updatePayload || []).push(STYLE$1, styleUpdates);
9997 }
9998 return updatePayload;
9999}
10000
10001// Apply the diff.
10002function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
10003 // Update checked *before* name.
10004 // In the middle of an update, it is possible to have multiple checked.
10005 // When a checked radio tries to change name, browser makes another radio's checked false.
10006 if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) {
10007 updateChecked(domElement, nextRawProps);
10008 }
10009
10010 var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
10011 var isCustomComponentTag = isCustomComponent(tag, nextRawProps);
10012 // Apply the diff.
10013 updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag);
10014
10015 // TODO: Ensure that an update gets scheduled if any of the special props
10016 // changed.
10017 switch (tag) {
10018 case 'input':
10019 // Update the wrapper around inputs *after* updating props. This has to
10020 // happen after `updateDOMProperties`. Otherwise HTML5 input validations
10021 // raise warnings and prevent the new value from being assigned.
10022 updateWrapper(domElement, nextRawProps);
10023 break;
10024 case 'textarea':
10025 updateWrapper$1(domElement, nextRawProps);
10026 break;
10027 case 'select':
10028 // <select> value update needs to occur after <option> children
10029 // reconciliation
10030 postUpdateWrapper(domElement, nextRawProps);
10031 break;
10032 }
10033}
10034
10035function getPossibleStandardName(propName) {
10036 {
10037 var lowerCasedName = propName.toLowerCase();
10038 if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
10039 return null;
10040 }
10041 return possibleStandardNames[lowerCasedName] || null;
10042 }
10043 return null;
10044}
10045
10046function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
10047 var isCustomComponentTag = void 0;
10048 var extraAttributeNames = void 0;
10049
10050 {
10051 suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING$1] === true;
10052 isCustomComponentTag = isCustomComponent(tag, rawProps);
10053 validatePropertiesInDevelopment(tag, rawProps);
10054 if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
10055 warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
10056 didWarnShadyDOM = true;
10057 }
10058 }
10059
10060 // TODO: Make sure that we check isMounted before firing any of these events.
10061 switch (tag) {
10062 case 'iframe':
10063 case 'object':
10064 trapBubbledEvent(TOP_LOAD, domElement);
10065 break;
10066 case 'video':
10067 case 'audio':
10068 // Create listener for each media event
10069 for (var i = 0; i < mediaEventTypes.length; i++) {
10070 trapBubbledEvent(mediaEventTypes[i], domElement);
10071 }
10072 break;
10073 case 'source':
10074 trapBubbledEvent(TOP_ERROR, domElement);
10075 break;
10076 case 'img':
10077 case 'image':
10078 case 'link':
10079 trapBubbledEvent(TOP_ERROR, domElement);
10080 trapBubbledEvent(TOP_LOAD, domElement);
10081 break;
10082 case 'form':
10083 trapBubbledEvent(TOP_RESET, domElement);
10084 trapBubbledEvent(TOP_SUBMIT, domElement);
10085 break;
10086 case 'details':
10087 trapBubbledEvent(TOP_TOGGLE, domElement);
10088 break;
10089 case 'input':
10090 initWrapperState(domElement, rawProps);
10091 trapBubbledEvent(TOP_INVALID, domElement);
10092 // For controlled components we always need to ensure we're listening
10093 // to onChange. Even if there is no listener.
10094 ensureListeningTo(rootContainerElement, 'onChange');
10095 break;
10096 case 'option':
10097 validateProps(domElement, rawProps);
10098 break;
10099 case 'select':
10100 initWrapperState$1(domElement, rawProps);
10101 trapBubbledEvent(TOP_INVALID, domElement);
10102 // For controlled components we always need to ensure we're listening
10103 // to onChange. Even if there is no listener.
10104 ensureListeningTo(rootContainerElement, 'onChange');
10105 break;
10106 case 'textarea':
10107 initWrapperState$2(domElement, rawProps);
10108 trapBubbledEvent(TOP_INVALID, domElement);
10109 // For controlled components we always need to ensure we're listening
10110 // to onChange. Even if there is no listener.
10111 ensureListeningTo(rootContainerElement, 'onChange');
10112 break;
10113 }
10114
10115 assertValidProps(tag, rawProps);
10116
10117 {
10118 extraAttributeNames = new Set();
10119 var attributes = domElement.attributes;
10120 for (var _i = 0; _i < attributes.length; _i++) {
10121 var name = attributes[_i].name.toLowerCase();
10122 switch (name) {
10123 // Built-in SSR attribute is whitelisted
10124 case 'data-reactroot':
10125 break;
10126 // Controlled attributes are not validated
10127 // TODO: Only ignore them on controlled tags.
10128 case 'value':
10129 break;
10130 case 'checked':
10131 break;
10132 case 'selected':
10133 break;
10134 default:
10135 // Intentionally use the original name.
10136 // See discussion in https://github.com/facebook/react/pull/10676.
10137 extraAttributeNames.add(attributes[_i].name);
10138 }
10139 }
10140 }
10141
10142 var updatePayload = null;
10143 for (var propKey in rawProps) {
10144 if (!rawProps.hasOwnProperty(propKey)) {
10145 continue;
10146 }
10147 var nextProp = rawProps[propKey];
10148 if (propKey === CHILDREN) {
10149 // For text content children we compare against textContent. This
10150 // might match additional HTML that is hidden when we read it using
10151 // textContent. E.g. "foo" will match "f<span>oo</span>" but that still
10152 // satisfies our requirement. Our requirement is not to produce perfect
10153 // HTML and attributes. Ideally we should preserve structure but it's
10154 // ok not to if the visible content is still enough to indicate what
10155 // even listeners these nodes might be wired up to.
10156 // TODO: Warn if there is more than a single textNode as a child.
10157 // TODO: Should we use domElement.firstChild.nodeValue to compare?
10158 if (typeof nextProp === 'string') {
10159 if (domElement.textContent !== nextProp) {
10160 if (true && !suppressHydrationWarning) {
10161 warnForTextDifference(domElement.textContent, nextProp);
10162 }
10163 updatePayload = [CHILDREN, nextProp];
10164 }
10165 } else if (typeof nextProp === 'number') {
10166 if (domElement.textContent !== '' + nextProp) {
10167 if (true && !suppressHydrationWarning) {
10168 warnForTextDifference(domElement.textContent, nextProp);
10169 }
10170 updatePayload = [CHILDREN, '' + nextProp];
10171 }
10172 }
10173 } else if (registrationNameModules.hasOwnProperty(propKey)) {
10174 if (nextProp != null) {
10175 if (true && typeof nextProp !== 'function') {
10176 warnForInvalidEventListener(propKey, nextProp);
10177 }
10178 ensureListeningTo(rootContainerElement, propKey);
10179 }
10180 } else if (true &&
10181 // Convince Flow we've calculated it (it's DEV-only in this method.)
10182 typeof isCustomComponentTag === 'boolean') {
10183 // Validate that the properties correspond to their expected values.
10184 var serverValue = void 0;
10185 var propertyInfo = getPropertyInfo(propKey);
10186 if (suppressHydrationWarning) {
10187 // Don't bother comparing. We're ignoring all these warnings.
10188 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1 ||
10189 // Controlled attributes are not validated
10190 // TODO: Only ignore them on controlled tags.
10191 propKey === 'value' || propKey === 'checked' || propKey === 'selected') {
10192 // Noop
10193 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
10194 var serverHTML = domElement.innerHTML;
10195 var nextHtml = nextProp ? nextProp[HTML] : undefined;
10196 var expectedHTML = normalizeHTML(domElement, nextHtml != null ? nextHtml : '');
10197 if (expectedHTML !== serverHTML) {
10198 warnForPropDifference(propKey, serverHTML, expectedHTML);
10199 }
10200 } else if (propKey === STYLE$1) {
10201 // $FlowFixMe - Should be inferred as not undefined.
10202 extraAttributeNames.delete(propKey);
10203
10204 if (canDiffStyleForHydrationWarning) {
10205 var expectedStyle = createDangerousStringForStyles(nextProp);
10206 serverValue = domElement.getAttribute('style');
10207 if (expectedStyle !== serverValue) {
10208 warnForPropDifference(propKey, serverValue, expectedStyle);
10209 }
10210 }
10211 } else if (isCustomComponentTag) {
10212 // $FlowFixMe - Should be inferred as not undefined.
10213 extraAttributeNames.delete(propKey.toLowerCase());
10214 serverValue = getValueForAttribute(domElement, propKey, nextProp);
10215
10216 if (nextProp !== serverValue) {
10217 warnForPropDifference(propKey, serverValue, nextProp);
10218 }
10219 } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
10220 var isMismatchDueToBadCasing = false;
10221 if (propertyInfo !== null) {
10222 // $FlowFixMe - Should be inferred as not undefined.
10223 extraAttributeNames.delete(propertyInfo.attributeName);
10224 serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
10225 } else {
10226 var ownNamespace = parentNamespace;
10227 if (ownNamespace === HTML_NAMESPACE) {
10228 ownNamespace = getIntrinsicNamespace(tag);
10229 }
10230 if (ownNamespace === HTML_NAMESPACE) {
10231 // $FlowFixMe - Should be inferred as not undefined.
10232 extraAttributeNames.delete(propKey.toLowerCase());
10233 } else {
10234 var standardName = getPossibleStandardName(propKey);
10235 if (standardName !== null && standardName !== propKey) {
10236 // If an SVG prop is supplied with bad casing, it will
10237 // be successfully parsed from HTML, but will produce a mismatch
10238 // (and would be incorrectly rendered on the client).
10239 // However, we already warn about bad casing elsewhere.
10240 // So we'll skip the misleading extra mismatch warning in this case.
10241 isMismatchDueToBadCasing = true;
10242 // $FlowFixMe - Should be inferred as not undefined.
10243 extraAttributeNames.delete(standardName);
10244 }
10245 // $FlowFixMe - Should be inferred as not undefined.
10246 extraAttributeNames.delete(propKey);
10247 }
10248 serverValue = getValueForAttribute(domElement, propKey, nextProp);
10249 }
10250
10251 if (nextProp !== serverValue && !isMismatchDueToBadCasing) {
10252 warnForPropDifference(propKey, serverValue, nextProp);
10253 }
10254 }
10255 }
10256 }
10257
10258 {
10259 // $FlowFixMe - Should be inferred as not undefined.
10260 if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
10261 // $FlowFixMe - Should be inferred as not undefined.
10262 warnForExtraAttributes(extraAttributeNames);
10263 }
10264 }
10265
10266 switch (tag) {
10267 case 'input':
10268 // TODO: Make sure we check if this is still unmounted or do any clean
10269 // up necessary since we never stop tracking anymore.
10270 track(domElement);
10271 postMountWrapper(domElement, rawProps, true);
10272 break;
10273 case 'textarea':
10274 // TODO: Make sure we check if this is still unmounted or do any clean
10275 // up necessary since we never stop tracking anymore.
10276 track(domElement);
10277 postMountWrapper$3(domElement, rawProps);
10278 break;
10279 case 'select':
10280 case 'option':
10281 // For input and textarea we current always set the value property at
10282 // post mount to force it to diverge from attributes. However, for
10283 // option and select we don't quite do the same thing and select
10284 // is not resilient to the DOM state changing so we don't do that here.
10285 // TODO: Consider not doing this for input and textarea.
10286 break;
10287 default:
10288 if (typeof rawProps.onClick === 'function') {
10289 // TODO: This cast may not be sound for SVG, MathML or custom elements.
10290 trapClickOnNonInteractiveElement(domElement);
10291 }
10292 break;
10293 }
10294
10295 return updatePayload;
10296}
10297
10298function diffHydratedText(textNode, text) {
10299 var isDifferent = textNode.nodeValue !== text;
10300 return isDifferent;
10301}
10302
10303function warnForUnmatchedText(textNode, text) {
10304 {
10305 warnForTextDifference(textNode.nodeValue, text);
10306 }
10307}
10308
10309function warnForDeletedHydratableElement(parentNode, child) {
10310 {
10311 if (didWarnInvalidHydration) {
10312 return;
10313 }
10314 didWarnInvalidHydration = true;
10315 warningWithoutStack$1(false, 'Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
10316 }
10317}
10318
10319function warnForDeletedHydratableText(parentNode, child) {
10320 {
10321 if (didWarnInvalidHydration) {
10322 return;
10323 }
10324 didWarnInvalidHydration = true;
10325 warningWithoutStack$1(false, 'Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
10326 }
10327}
10328
10329function warnForInsertedHydratedElement(parentNode, tag, props) {
10330 {
10331 if (didWarnInvalidHydration) {
10332 return;
10333 }
10334 didWarnInvalidHydration = true;
10335 warningWithoutStack$1(false, 'Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase());
10336 }
10337}
10338
10339function warnForInsertedHydratedText(parentNode, text) {
10340 {
10341 if (text === '') {
10342 // We expect to insert empty text nodes since they're not represented in
10343 // the HTML.
10344 // TODO: Remove this special case if we can just avoid inserting empty
10345 // text nodes.
10346 return;
10347 }
10348 if (didWarnInvalidHydration) {
10349 return;
10350 }
10351 didWarnInvalidHydration = true;
10352 warningWithoutStack$1(false, 'Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
10353 }
10354}
10355
10356function restoreControlledState$1(domElement, tag, props) {
10357 switch (tag) {
10358 case 'input':
10359 restoreControlledState(domElement, props);
10360 return;
10361 case 'textarea':
10362 restoreControlledState$3(domElement, props);
10363 return;
10364 case 'select':
10365 restoreControlledState$2(domElement, props);
10366 return;
10367 }
10368}
10369
10370// TODO: direct imports like some-package/src/* are bad. Fix me.
10371var validateDOMNesting = function () {};
10372var updatedAncestorInfo = function () {};
10373
10374{
10375 // This validation code was written based on the HTML5 parsing spec:
10376 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
10377 //
10378 // Note: this does not catch all invalid nesting, nor does it try to (as it's
10379 // not clear what practical benefit doing so provides); instead, we warn only
10380 // for cases where the parser will give a parse tree differing from what React
10381 // intended. For example, <b><div></div></b> is invalid but we don't warn
10382 // because it still parses correctly; we do warn for other cases like nested
10383 // <p> tags where the beginning of the second element implicitly closes the
10384 // first, causing a confusing mess.
10385
10386 // https://html.spec.whatwg.org/multipage/syntax.html#special
10387 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'];
10388
10389 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
10390 var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
10391
10392 // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
10393 // TODO: Distinguish by namespace here -- for <title>, including it here
10394 // errs on the side of fewer warnings
10395 'foreignObject', 'desc', 'title'];
10396
10397 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
10398 var buttonScopeTags = inScopeTags.concat(['button']);
10399
10400 // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
10401 var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
10402
10403 var emptyAncestorInfo = {
10404 current: null,
10405
10406 formTag: null,
10407 aTagInScope: null,
10408 buttonTagInScope: null,
10409 nobrTagInScope: null,
10410 pTagInButtonScope: null,
10411
10412 listItemTagAutoclosing: null,
10413 dlItemTagAutoclosing: null
10414 };
10415
10416 updatedAncestorInfo = function (oldInfo, tag) {
10417 var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
10418 var info = { tag: tag };
10419
10420 if (inScopeTags.indexOf(tag) !== -1) {
10421 ancestorInfo.aTagInScope = null;
10422 ancestorInfo.buttonTagInScope = null;
10423 ancestorInfo.nobrTagInScope = null;
10424 }
10425 if (buttonScopeTags.indexOf(tag) !== -1) {
10426 ancestorInfo.pTagInButtonScope = null;
10427 }
10428
10429 // See rules for 'li', 'dd', 'dt' start tags in
10430 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
10431 if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
10432 ancestorInfo.listItemTagAutoclosing = null;
10433 ancestorInfo.dlItemTagAutoclosing = null;
10434 }
10435
10436 ancestorInfo.current = info;
10437
10438 if (tag === 'form') {
10439 ancestorInfo.formTag = info;
10440 }
10441 if (tag === 'a') {
10442 ancestorInfo.aTagInScope = info;
10443 }
10444 if (tag === 'button') {
10445 ancestorInfo.buttonTagInScope = info;
10446 }
10447 if (tag === 'nobr') {
10448 ancestorInfo.nobrTagInScope = info;
10449 }
10450 if (tag === 'p') {
10451 ancestorInfo.pTagInButtonScope = info;
10452 }
10453 if (tag === 'li') {
10454 ancestorInfo.listItemTagAutoclosing = info;
10455 }
10456 if (tag === 'dd' || tag === 'dt') {
10457 ancestorInfo.dlItemTagAutoclosing = info;
10458 }
10459
10460 return ancestorInfo;
10461 };
10462
10463 /**
10464 * Returns whether
10465 */
10466 var isTagValidWithParent = function (tag, parentTag) {
10467 // First, let's check if we're in an unusual parsing mode...
10468 switch (parentTag) {
10469 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
10470 case 'select':
10471 return tag === 'option' || tag === 'optgroup' || tag === '#text';
10472 case 'optgroup':
10473 return tag === 'option' || tag === '#text';
10474 // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
10475 // but
10476 case 'option':
10477 return tag === '#text';
10478 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
10479 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
10480 // No special behavior since these rules fall back to "in body" mode for
10481 // all except special table nodes which cause bad parsing behavior anyway.
10482
10483 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
10484 case 'tr':
10485 return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
10486 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
10487 case 'tbody':
10488 case 'thead':
10489 case 'tfoot':
10490 return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
10491 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
10492 case 'colgroup':
10493 return tag === 'col' || tag === 'template';
10494 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
10495 case 'table':
10496 return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
10497 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
10498 case 'head':
10499 return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
10500 // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
10501 case 'html':
10502 return tag === 'head' || tag === 'body';
10503 case '#document':
10504 return tag === 'html';
10505 }
10506
10507 // Probably in the "in body" parsing mode, so we outlaw only tag combos
10508 // where the parsing rules cause implicit opens or closes to be added.
10509 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
10510 switch (tag) {
10511 case 'h1':
10512 case 'h2':
10513 case 'h3':
10514 case 'h4':
10515 case 'h5':
10516 case 'h6':
10517 return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
10518
10519 case 'rp':
10520 case 'rt':
10521 return impliedEndTags.indexOf(parentTag) === -1;
10522
10523 case 'body':
10524 case 'caption':
10525 case 'col':
10526 case 'colgroup':
10527 case 'frame':
10528 case 'head':
10529 case 'html':
10530 case 'tbody':
10531 case 'td':
10532 case 'tfoot':
10533 case 'th':
10534 case 'thead':
10535 case 'tr':
10536 // These tags are only valid with a few parents that have special child
10537 // parsing rules -- if we're down here, then none of those matched and
10538 // so we allow it only if we don't know what the parent is, as all other
10539 // cases are invalid.
10540 return parentTag == null;
10541 }
10542
10543 return true;
10544 };
10545
10546 /**
10547 * Returns whether
10548 */
10549 var findInvalidAncestorForTag = function (tag, ancestorInfo) {
10550 switch (tag) {
10551 case 'address':
10552 case 'article':
10553 case 'aside':
10554 case 'blockquote':
10555 case 'center':
10556 case 'details':
10557 case 'dialog':
10558 case 'dir':
10559 case 'div':
10560 case 'dl':
10561 case 'fieldset':
10562 case 'figcaption':
10563 case 'figure':
10564 case 'footer':
10565 case 'header':
10566 case 'hgroup':
10567 case 'main':
10568 case 'menu':
10569 case 'nav':
10570 case 'ol':
10571 case 'p':
10572 case 'section':
10573 case 'summary':
10574 case 'ul':
10575 case 'pre':
10576 case 'listing':
10577 case 'table':
10578 case 'hr':
10579 case 'xmp':
10580 case 'h1':
10581 case 'h2':
10582 case 'h3':
10583 case 'h4':
10584 case 'h5':
10585 case 'h6':
10586 return ancestorInfo.pTagInButtonScope;
10587
10588 case 'form':
10589 return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
10590
10591 case 'li':
10592 return ancestorInfo.listItemTagAutoclosing;
10593
10594 case 'dd':
10595 case 'dt':
10596 return ancestorInfo.dlItemTagAutoclosing;
10597
10598 case 'button':
10599 return ancestorInfo.buttonTagInScope;
10600
10601 case 'a':
10602 // Spec says something about storing a list of markers, but it sounds
10603 // equivalent to this check.
10604 return ancestorInfo.aTagInScope;
10605
10606 case 'nobr':
10607 return ancestorInfo.nobrTagInScope;
10608 }
10609
10610 return null;
10611 };
10612
10613 var didWarn = {};
10614
10615 validateDOMNesting = function (childTag, childText, ancestorInfo) {
10616 ancestorInfo = ancestorInfo || emptyAncestorInfo;
10617 var parentInfo = ancestorInfo.current;
10618 var parentTag = parentInfo && parentInfo.tag;
10619
10620 if (childText != null) {
10621 !(childTag == null) ? warningWithoutStack$1(false, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
10622 childTag = '#text';
10623 }
10624
10625 var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
10626 var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
10627 var invalidParentOrAncestor = invalidParent || invalidAncestor;
10628 if (!invalidParentOrAncestor) {
10629 return;
10630 }
10631
10632 var ancestorTag = invalidParentOrAncestor.tag;
10633 var addendum = getCurrentFiberStackInDev();
10634
10635 var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
10636 if (didWarn[warnKey]) {
10637 return;
10638 }
10639 didWarn[warnKey] = true;
10640
10641 var tagDisplayName = childTag;
10642 var whitespaceInfo = '';
10643 if (childTag === '#text') {
10644 if (/\S/.test(childText)) {
10645 tagDisplayName = 'Text nodes';
10646 } else {
10647 tagDisplayName = 'Whitespace text nodes';
10648 whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
10649 }
10650 } else {
10651 tagDisplayName = '<' + childTag + '>';
10652 }
10653
10654 if (invalidParent) {
10655 var info = '';
10656 if (ancestorTag === 'table' && childTag === 'tr') {
10657 info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
10658 }
10659 warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info, addendum);
10660 } else {
10661 warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.%s', tagDisplayName, ancestorTag, addendum);
10662 }
10663 };
10664}
10665
10666// Renderers that don't support persistence
10667// can re-export everything from this module.
10668
10669function shim() {
10670 invariant(false, 'The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.');
10671}
10672
10673// Persistence (when unsupported)
10674var supportsPersistence = false;
10675var cloneInstance = shim;
10676var createContainerChildSet = shim;
10677var appendChildToContainerChildSet = shim;
10678var finalizeContainerChildren = shim;
10679var replaceContainerChildren = shim;
10680var cloneHiddenInstance = shim;
10681var cloneUnhiddenInstance = shim;
10682var createHiddenTextInstance = shim;
10683
10684var SUPPRESS_HYDRATION_WARNING = void 0;
10685{
10686 SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
10687}
10688
10689var STYLE = 'style';
10690
10691var eventsEnabled = null;
10692var selectionInformation = null;
10693
10694function shouldAutoFocusHostComponent(type, props) {
10695 switch (type) {
10696 case 'button':
10697 case 'input':
10698 case 'select':
10699 case 'textarea':
10700 return !!props.autoFocus;
10701 }
10702 return false;
10703}
10704
10705function getRootHostContext(rootContainerInstance) {
10706 var type = void 0;
10707 var namespace = void 0;
10708 var nodeType = rootContainerInstance.nodeType;
10709 switch (nodeType) {
10710 case DOCUMENT_NODE:
10711 case DOCUMENT_FRAGMENT_NODE:
10712 {
10713 type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment';
10714 var root = rootContainerInstance.documentElement;
10715 namespace = root ? root.namespaceURI : getChildNamespace(null, '');
10716 break;
10717 }
10718 default:
10719 {
10720 var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
10721 var ownNamespace = container.namespaceURI || null;
10722 type = container.tagName;
10723 namespace = getChildNamespace(ownNamespace, type);
10724 break;
10725 }
10726 }
10727 {
10728 var validatedTag = type.toLowerCase();
10729 var _ancestorInfo = updatedAncestorInfo(null, validatedTag);
10730 return { namespace: namespace, ancestorInfo: _ancestorInfo };
10731 }
10732 return namespace;
10733}
10734
10735function getChildHostContext(parentHostContext, type, rootContainerInstance) {
10736 {
10737 var parentHostContextDev = parentHostContext;
10738 var _namespace = getChildNamespace(parentHostContextDev.namespace, type);
10739 var _ancestorInfo2 = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type);
10740 return { namespace: _namespace, ancestorInfo: _ancestorInfo2 };
10741 }
10742 var parentNamespace = parentHostContext;
10743 return getChildNamespace(parentNamespace, type);
10744}
10745
10746function getPublicInstance(instance) {
10747 return instance;
10748}
10749
10750function prepareForCommit(containerInfo) {
10751 eventsEnabled = isEnabled();
10752 selectionInformation = getSelectionInformation();
10753 setEnabled(false);
10754}
10755
10756function resetAfterCommit(containerInfo) {
10757 restoreSelection(selectionInformation);
10758 selectionInformation = null;
10759 setEnabled(eventsEnabled);
10760 eventsEnabled = null;
10761}
10762
10763function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
10764 var parentNamespace = void 0;
10765 {
10766 // TODO: take namespace into account when validating.
10767 var hostContextDev = hostContext;
10768 validateDOMNesting(type, null, hostContextDev.ancestorInfo);
10769 if (typeof props.children === 'string' || typeof props.children === 'number') {
10770 var string = '' + props.children;
10771 var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
10772 validateDOMNesting(null, string, ownAncestorInfo);
10773 }
10774 parentNamespace = hostContextDev.namespace;
10775 }
10776 var domElement = createElement(type, props, rootContainerInstance, parentNamespace);
10777 precacheFiberNode(internalInstanceHandle, domElement);
10778 updateFiberProps(domElement, props);
10779 return domElement;
10780}
10781
10782function appendInitialChild(parentInstance, child) {
10783 parentInstance.appendChild(child);
10784}
10785
10786function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
10787 setInitialProperties(domElement, type, props, rootContainerInstance);
10788 return shouldAutoFocusHostComponent(type, props);
10789}
10790
10791function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
10792 {
10793 var hostContextDev = hostContext;
10794 if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) {
10795 var string = '' + newProps.children;
10796 var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
10797 validateDOMNesting(null, string, ownAncestorInfo);
10798 }
10799 }
10800 return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance);
10801}
10802
10803function shouldSetTextContent(type, props) {
10804 return type === 'textarea' || type === 'option' || type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
10805}
10806
10807function shouldDeprioritizeSubtree(type, props) {
10808 return !!props.hidden;
10809}
10810
10811function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
10812 {
10813 var hostContextDev = hostContext;
10814 validateDOMNesting(null, text, hostContextDev.ancestorInfo);
10815 }
10816 var textNode = createTextNode(text, rootContainerInstance);
10817 precacheFiberNode(internalInstanceHandle, textNode);
10818 return textNode;
10819}
10820
10821var isPrimaryRenderer = true;
10822// This initialization code may run even on server environments
10823// if a component just imports ReactDOM (e.g. for findDOMNode).
10824// Some environments might not have setTimeout or clearTimeout.
10825var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
10826var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
10827var noTimeout = -1;
10828
10829// -------------------
10830// Mutation
10831// -------------------
10832
10833var supportsMutation = true;
10834
10835function commitMount(domElement, type, newProps, internalInstanceHandle) {
10836 // Despite the naming that might imply otherwise, this method only
10837 // fires if there is an `Update` effect scheduled during mounting.
10838 // This happens if `finalizeInitialChildren` returns `true` (which it
10839 // does to implement the `autoFocus` attribute on the client). But
10840 // there are also other cases when this might happen (such as patching
10841 // up text content during hydration mismatch). So we'll check this again.
10842 if (shouldAutoFocusHostComponent(type, newProps)) {
10843 domElement.focus();
10844 }
10845}
10846
10847function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
10848 // Update the props handle so that we know which props are the ones with
10849 // with current event handlers.
10850 updateFiberProps(domElement, newProps);
10851 // Apply the diff to the DOM node.
10852 updateProperties(domElement, updatePayload, type, oldProps, newProps);
10853}
10854
10855function resetTextContent(domElement) {
10856 setTextContent(domElement, '');
10857}
10858
10859function commitTextUpdate(textInstance, oldText, newText) {
10860 textInstance.nodeValue = newText;
10861}
10862
10863function appendChild(parentInstance, child) {
10864 parentInstance.appendChild(child);
10865}
10866
10867function appendChildToContainer(container, child) {
10868 var parentNode = void 0;
10869 if (container.nodeType === COMMENT_NODE) {
10870 parentNode = container.parentNode;
10871 parentNode.insertBefore(child, container);
10872 } else {
10873 parentNode = container;
10874 parentNode.appendChild(child);
10875 }
10876 // This container might be used for a portal.
10877 // If something inside a portal is clicked, that click should bubble
10878 // through the React tree. However, on Mobile Safari the click would
10879 // never bubble through the *DOM* tree unless an ancestor with onclick
10880 // event exists. So we wouldn't see it and dispatch it.
10881 // This is why we ensure that non React root containers have inline onclick
10882 // defined.
10883 // https://github.com/facebook/react/issues/11918
10884 var reactRootContainer = container._reactRootContainer;
10885 if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) {
10886 // TODO: This cast may not be sound for SVG, MathML or custom elements.
10887 trapClickOnNonInteractiveElement(parentNode);
10888 }
10889}
10890
10891function insertBefore(parentInstance, child, beforeChild) {
10892 parentInstance.insertBefore(child, beforeChild);
10893}
10894
10895function insertInContainerBefore(container, child, beforeChild) {
10896 if (container.nodeType === COMMENT_NODE) {
10897 container.parentNode.insertBefore(child, beforeChild);
10898 } else {
10899 container.insertBefore(child, beforeChild);
10900 }
10901}
10902
10903function removeChild(parentInstance, child) {
10904 parentInstance.removeChild(child);
10905}
10906
10907function removeChildFromContainer(container, child) {
10908 if (container.nodeType === COMMENT_NODE) {
10909 container.parentNode.removeChild(child);
10910 } else {
10911 container.removeChild(child);
10912 }
10913}
10914
10915function hideInstance(instance) {
10916 // TODO: Does this work for all element types? What about MathML? Should we
10917 // pass host context to this method?
10918 instance = instance;
10919 instance.style.display = 'none';
10920}
10921
10922function hideTextInstance(textInstance) {
10923 textInstance.nodeValue = '';
10924}
10925
10926function unhideInstance(instance, props) {
10927 instance = instance;
10928 var styleProp = props[STYLE];
10929 var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null;
10930 instance.style.display = dangerousStyleValue('display', display);
10931}
10932
10933function unhideTextInstance(textInstance, text) {
10934 textInstance.nodeValue = text;
10935}
10936
10937// -------------------
10938// Hydration
10939// -------------------
10940
10941var supportsHydration = true;
10942
10943function canHydrateInstance(instance, type, props) {
10944 if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
10945 return null;
10946 }
10947 // This has now been refined to an element node.
10948 return instance;
10949}
10950
10951function canHydrateTextInstance(instance, text) {
10952 if (text === '' || instance.nodeType !== TEXT_NODE) {
10953 // Empty strings are not parsed by HTML so there won't be a correct match here.
10954 return null;
10955 }
10956 // This has now been refined to a text node.
10957 return instance;
10958}
10959
10960function getNextHydratableSibling(instance) {
10961 var node = instance.nextSibling;
10962 // Skip non-hydratable nodes.
10963 while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE) {
10964 node = node.nextSibling;
10965 }
10966 return node;
10967}
10968
10969function getFirstHydratableChild(parentInstance) {
10970 var next = parentInstance.firstChild;
10971 // Skip non-hydratable nodes.
10972 while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE) {
10973 next = next.nextSibling;
10974 }
10975 return next;
10976}
10977
10978function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
10979 precacheFiberNode(internalInstanceHandle, instance);
10980 // TODO: Possibly defer this until the commit phase where all the events
10981 // get attached.
10982 updateFiberProps(instance, props);
10983 var parentNamespace = void 0;
10984 {
10985 var hostContextDev = hostContext;
10986 parentNamespace = hostContextDev.namespace;
10987 }
10988 return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance);
10989}
10990
10991function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
10992 precacheFiberNode(internalInstanceHandle, textInstance);
10993 return diffHydratedText(textInstance, text);
10994}
10995
10996function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
10997 {
10998 warnForUnmatchedText(textInstance, text);
10999 }
11000}
11001
11002function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) {
11003 if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
11004 warnForUnmatchedText(textInstance, text);
11005 }
11006}
11007
11008function didNotHydrateContainerInstance(parentContainer, instance) {
11009 {
11010 if (instance.nodeType === ELEMENT_NODE) {
11011 warnForDeletedHydratableElement(parentContainer, instance);
11012 } else {
11013 warnForDeletedHydratableText(parentContainer, instance);
11014 }
11015 }
11016}
11017
11018function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) {
11019 if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
11020 if (instance.nodeType === ELEMENT_NODE) {
11021 warnForDeletedHydratableElement(parentInstance, instance);
11022 } else {
11023 warnForDeletedHydratableText(parentInstance, instance);
11024 }
11025 }
11026}
11027
11028function didNotFindHydratableContainerInstance(parentContainer, type, props) {
11029 {
11030 warnForInsertedHydratedElement(parentContainer, type, props);
11031 }
11032}
11033
11034function didNotFindHydratableContainerTextInstance(parentContainer, text) {
11035 {
11036 warnForInsertedHydratedText(parentContainer, text);
11037 }
11038}
11039
11040function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
11041 if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
11042 warnForInsertedHydratedElement(parentInstance, type, props);
11043 }
11044}
11045
11046function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) {
11047 if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
11048 warnForInsertedHydratedText(parentInstance, text);
11049 }
11050}
11051
11052// Prefix measurements so that it's possible to filter them.
11053// Longer prefixes are hard to read in DevTools.
11054var reactEmoji = '\u269B';
11055var warningEmoji = '\u26D4';
11056var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
11057
11058// Keep track of current fiber so that we know the path to unwind on pause.
11059// TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them?
11060var currentFiber = null;
11061// If we're in the middle of user code, which fiber and method is it?
11062// Reusing `currentFiber` would be confusing for this because user code fiber
11063// can change during commit phase too, but we don't need to unwind it (since
11064// lifecycles in the commit phase don't resemble a tree).
11065var currentPhase = null;
11066var currentPhaseFiber = null;
11067// Did lifecycle hook schedule an update? This is often a performance problem,
11068// so we will keep track of it, and include it in the report.
11069// Track commits caused by cascading updates.
11070var isCommitting = false;
11071var hasScheduledUpdateInCurrentCommit = false;
11072var hasScheduledUpdateInCurrentPhase = false;
11073var commitCountInCurrentWorkLoop = 0;
11074var effectCountInCurrentCommit = 0;
11075var isWaitingForCallback = false;
11076// During commits, we only show a measurement once per method name
11077// to avoid stretch the commit phase with measurement overhead.
11078var labelsInCurrentCommit = new Set();
11079
11080var formatMarkName = function (markName) {
11081 return reactEmoji + ' ' + markName;
11082};
11083
11084var formatLabel = function (label, warning) {
11085 var prefix = warning ? warningEmoji + ' ' : reactEmoji + ' ';
11086 var suffix = warning ? ' Warning: ' + warning : '';
11087 return '' + prefix + label + suffix;
11088};
11089
11090var beginMark = function (markName) {
11091 performance.mark(formatMarkName(markName));
11092};
11093
11094var clearMark = function (markName) {
11095 performance.clearMarks(formatMarkName(markName));
11096};
11097
11098var endMark = function (label, markName, warning) {
11099 var formattedMarkName = formatMarkName(markName);
11100 var formattedLabel = formatLabel(label, warning);
11101 try {
11102 performance.measure(formattedLabel, formattedMarkName);
11103 } catch (err) {}
11104 // If previous mark was missing for some reason, this will throw.
11105 // This could only happen if React crashed in an unexpected place earlier.
11106 // Don't pile on with more errors.
11107
11108 // Clear marks immediately to avoid growing buffer.
11109 performance.clearMarks(formattedMarkName);
11110 performance.clearMeasures(formattedLabel);
11111};
11112
11113var getFiberMarkName = function (label, debugID) {
11114 return label + ' (#' + debugID + ')';
11115};
11116
11117var getFiberLabel = function (componentName, isMounted, phase) {
11118 if (phase === null) {
11119 // These are composite component total time measurements.
11120 return componentName + ' [' + (isMounted ? 'update' : 'mount') + ']';
11121 } else {
11122 // Composite component methods.
11123 return componentName + '.' + phase;
11124 }
11125};
11126
11127var beginFiberMark = function (fiber, phase) {
11128 var componentName = getComponentName(fiber.type) || 'Unknown';
11129 var debugID = fiber._debugID;
11130 var isMounted = fiber.alternate !== null;
11131 var label = getFiberLabel(componentName, isMounted, phase);
11132
11133 if (isCommitting && labelsInCurrentCommit.has(label)) {
11134 // During the commit phase, we don't show duplicate labels because
11135 // there is a fixed overhead for every measurement, and we don't
11136 // want to stretch the commit phase beyond necessary.
11137 return false;
11138 }
11139 labelsInCurrentCommit.add(label);
11140
11141 var markName = getFiberMarkName(label, debugID);
11142 beginMark(markName);
11143 return true;
11144};
11145
11146var clearFiberMark = function (fiber, phase) {
11147 var componentName = getComponentName(fiber.type) || 'Unknown';
11148 var debugID = fiber._debugID;
11149 var isMounted = fiber.alternate !== null;
11150 var label = getFiberLabel(componentName, isMounted, phase);
11151 var markName = getFiberMarkName(label, debugID);
11152 clearMark(markName);
11153};
11154
11155var endFiberMark = function (fiber, phase, warning) {
11156 var componentName = getComponentName(fiber.type) || 'Unknown';
11157 var debugID = fiber._debugID;
11158 var isMounted = fiber.alternate !== null;
11159 var label = getFiberLabel(componentName, isMounted, phase);
11160 var markName = getFiberMarkName(label, debugID);
11161 endMark(label, markName, warning);
11162};
11163
11164var shouldIgnoreFiber = function (fiber) {
11165 // Host components should be skipped in the timeline.
11166 // We could check typeof fiber.type, but does this work with RN?
11167 switch (fiber.tag) {
11168 case HostRoot:
11169 case HostComponent:
11170 case HostText:
11171 case HostPortal:
11172 case Fragment:
11173 case ContextProvider:
11174 case ContextConsumer:
11175 case Mode:
11176 return true;
11177 default:
11178 return false;
11179 }
11180};
11181
11182var clearPendingPhaseMeasurement = function () {
11183 if (currentPhase !== null && currentPhaseFiber !== null) {
11184 clearFiberMark(currentPhaseFiber, currentPhase);
11185 }
11186 currentPhaseFiber = null;
11187 currentPhase = null;
11188 hasScheduledUpdateInCurrentPhase = false;
11189};
11190
11191var pauseTimers = function () {
11192 // Stops all currently active measurements so that they can be resumed
11193 // if we continue in a later deferred loop from the same unit of work.
11194 var fiber = currentFiber;
11195 while (fiber) {
11196 if (fiber._debugIsCurrentlyTiming) {
11197 endFiberMark(fiber, null, null);
11198 }
11199 fiber = fiber.return;
11200 }
11201};
11202
11203var resumeTimersRecursively = function (fiber) {
11204 if (fiber.return !== null) {
11205 resumeTimersRecursively(fiber.return);
11206 }
11207 if (fiber._debugIsCurrentlyTiming) {
11208 beginFiberMark(fiber, null);
11209 }
11210};
11211
11212var resumeTimers = function () {
11213 // Resumes all measurements that were active during the last deferred loop.
11214 if (currentFiber !== null) {
11215 resumeTimersRecursively(currentFiber);
11216 }
11217};
11218
11219function recordEffect() {
11220 if (enableUserTimingAPI) {
11221 effectCountInCurrentCommit++;
11222 }
11223}
11224
11225function recordScheduleUpdate() {
11226 if (enableUserTimingAPI) {
11227 if (isCommitting) {
11228 hasScheduledUpdateInCurrentCommit = true;
11229 }
11230 if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') {
11231 hasScheduledUpdateInCurrentPhase = true;
11232 }
11233 }
11234}
11235
11236function startRequestCallbackTimer() {
11237 if (enableUserTimingAPI) {
11238 if (supportsUserTiming && !isWaitingForCallback) {
11239 isWaitingForCallback = true;
11240 beginMark('(Waiting for async callback...)');
11241 }
11242 }
11243}
11244
11245function stopRequestCallbackTimer(didExpire, expirationTime) {
11246 if (enableUserTimingAPI) {
11247 if (supportsUserTiming) {
11248 isWaitingForCallback = false;
11249 var warning = didExpire ? 'React was blocked by main thread' : null;
11250 endMark('(Waiting for async callback... will force flush in ' + expirationTime + ' ms)', '(Waiting for async callback...)', warning);
11251 }
11252 }
11253}
11254
11255function startWorkTimer(fiber) {
11256 if (enableUserTimingAPI) {
11257 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
11258 return;
11259 }
11260 // If we pause, this is the fiber to unwind from.
11261 currentFiber = fiber;
11262 if (!beginFiberMark(fiber, null)) {
11263 return;
11264 }
11265 fiber._debugIsCurrentlyTiming = true;
11266 }
11267}
11268
11269function cancelWorkTimer(fiber) {
11270 if (enableUserTimingAPI) {
11271 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
11272 return;
11273 }
11274 // Remember we shouldn't complete measurement for this fiber.
11275 // Otherwise flamechart will be deep even for small updates.
11276 fiber._debugIsCurrentlyTiming = false;
11277 clearFiberMark(fiber, null);
11278 }
11279}
11280
11281function stopWorkTimer(fiber) {
11282 if (enableUserTimingAPI) {
11283 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
11284 return;
11285 }
11286 // If we pause, its parent is the fiber to unwind from.
11287 currentFiber = fiber.return;
11288 if (!fiber._debugIsCurrentlyTiming) {
11289 return;
11290 }
11291 fiber._debugIsCurrentlyTiming = false;
11292 endFiberMark(fiber, null, null);
11293 }
11294}
11295
11296function stopFailedWorkTimer(fiber) {
11297 if (enableUserTimingAPI) {
11298 if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
11299 return;
11300 }
11301 // If we pause, its parent is the fiber to unwind from.
11302 currentFiber = fiber.return;
11303 if (!fiber._debugIsCurrentlyTiming) {
11304 return;
11305 }
11306 fiber._debugIsCurrentlyTiming = false;
11307 var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
11308 endFiberMark(fiber, null, warning);
11309 }
11310}
11311
11312function startPhaseTimer(fiber, phase) {
11313 if (enableUserTimingAPI) {
11314 if (!supportsUserTiming) {
11315 return;
11316 }
11317 clearPendingPhaseMeasurement();
11318 if (!beginFiberMark(fiber, phase)) {
11319 return;
11320 }
11321 currentPhaseFiber = fiber;
11322 currentPhase = phase;
11323 }
11324}
11325
11326function stopPhaseTimer() {
11327 if (enableUserTimingAPI) {
11328 if (!supportsUserTiming) {
11329 return;
11330 }
11331 if (currentPhase !== null && currentPhaseFiber !== null) {
11332 var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
11333 endFiberMark(currentPhaseFiber, currentPhase, warning);
11334 }
11335 currentPhase = null;
11336 currentPhaseFiber = null;
11337 }
11338}
11339
11340function startWorkLoopTimer(nextUnitOfWork) {
11341 if (enableUserTimingAPI) {
11342 currentFiber = nextUnitOfWork;
11343 if (!supportsUserTiming) {
11344 return;
11345 }
11346 commitCountInCurrentWorkLoop = 0;
11347 // This is top level call.
11348 // Any other measurements are performed within.
11349 beginMark('(React Tree Reconciliation)');
11350 // Resume any measurements that were in progress during the last loop.
11351 resumeTimers();
11352 }
11353}
11354
11355function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
11356 if (enableUserTimingAPI) {
11357 if (!supportsUserTiming) {
11358 return;
11359 }
11360 var warning = null;
11361 if (interruptedBy !== null) {
11362 if (interruptedBy.tag === HostRoot) {
11363 warning = 'A top-level update interrupted the previous render';
11364 } else {
11365 var componentName = getComponentName(interruptedBy.type) || 'Unknown';
11366 warning = 'An update to ' + componentName + ' interrupted the previous render';
11367 }
11368 } else if (commitCountInCurrentWorkLoop > 1) {
11369 warning = 'There were cascading updates';
11370 }
11371 commitCountInCurrentWorkLoop = 0;
11372 var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)';
11373 // Pause any measurements until the next loop.
11374 pauseTimers();
11375 endMark(label, '(React Tree Reconciliation)', warning);
11376 }
11377}
11378
11379function startCommitTimer() {
11380 if (enableUserTimingAPI) {
11381 if (!supportsUserTiming) {
11382 return;
11383 }
11384 isCommitting = true;
11385 hasScheduledUpdateInCurrentCommit = false;
11386 labelsInCurrentCommit.clear();
11387 beginMark('(Committing Changes)');
11388 }
11389}
11390
11391function stopCommitTimer() {
11392 if (enableUserTimingAPI) {
11393 if (!supportsUserTiming) {
11394 return;
11395 }
11396
11397 var warning = null;
11398 if (hasScheduledUpdateInCurrentCommit) {
11399 warning = 'Lifecycle hook scheduled a cascading update';
11400 } else if (commitCountInCurrentWorkLoop > 0) {
11401 warning = 'Caused by a cascading update in earlier commit';
11402 }
11403 hasScheduledUpdateInCurrentCommit = false;
11404 commitCountInCurrentWorkLoop++;
11405 isCommitting = false;
11406 labelsInCurrentCommit.clear();
11407
11408 endMark('(Committing Changes)', '(Committing Changes)', warning);
11409 }
11410}
11411
11412function startCommitSnapshotEffectsTimer() {
11413 if (enableUserTimingAPI) {
11414 if (!supportsUserTiming) {
11415 return;
11416 }
11417 effectCountInCurrentCommit = 0;
11418 beginMark('(Committing Snapshot Effects)');
11419 }
11420}
11421
11422function stopCommitSnapshotEffectsTimer() {
11423 if (enableUserTimingAPI) {
11424 if (!supportsUserTiming) {
11425 return;
11426 }
11427 var count = effectCountInCurrentCommit;
11428 effectCountInCurrentCommit = 0;
11429 endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null);
11430 }
11431}
11432
11433function startCommitHostEffectsTimer() {
11434 if (enableUserTimingAPI) {
11435 if (!supportsUserTiming) {
11436 return;
11437 }
11438 effectCountInCurrentCommit = 0;
11439 beginMark('(Committing Host Effects)');
11440 }
11441}
11442
11443function stopCommitHostEffectsTimer() {
11444 if (enableUserTimingAPI) {
11445 if (!supportsUserTiming) {
11446 return;
11447 }
11448 var count = effectCountInCurrentCommit;
11449 effectCountInCurrentCommit = 0;
11450 endMark('(Committing Host Effects: ' + count + ' Total)', '(Committing Host Effects)', null);
11451 }
11452}
11453
11454function startCommitLifeCyclesTimer() {
11455 if (enableUserTimingAPI) {
11456 if (!supportsUserTiming) {
11457 return;
11458 }
11459 effectCountInCurrentCommit = 0;
11460 beginMark('(Calling Lifecycle Methods)');
11461 }
11462}
11463
11464function stopCommitLifeCyclesTimer() {
11465 if (enableUserTimingAPI) {
11466 if (!supportsUserTiming) {
11467 return;
11468 }
11469 var count = effectCountInCurrentCommit;
11470 effectCountInCurrentCommit = 0;
11471 endMark('(Calling Lifecycle Methods: ' + count + ' Total)', '(Calling Lifecycle Methods)', null);
11472 }
11473}
11474
11475var valueStack = [];
11476
11477var fiberStack = void 0;
11478
11479{
11480 fiberStack = [];
11481}
11482
11483var index = -1;
11484
11485function createCursor(defaultValue) {
11486 return {
11487 current: defaultValue
11488 };
11489}
11490
11491function pop(cursor, fiber) {
11492 if (index < 0) {
11493 {
11494 warningWithoutStack$1(false, 'Unexpected pop.');
11495 }
11496 return;
11497 }
11498
11499 {
11500 if (fiber !== fiberStack[index]) {
11501 warningWithoutStack$1(false, 'Unexpected Fiber popped.');
11502 }
11503 }
11504
11505 cursor.current = valueStack[index];
11506
11507 valueStack[index] = null;
11508
11509 {
11510 fiberStack[index] = null;
11511 }
11512
11513 index--;
11514}
11515
11516function push(cursor, value, fiber) {
11517 index++;
11518
11519 valueStack[index] = cursor.current;
11520
11521 {
11522 fiberStack[index] = fiber;
11523 }
11524
11525 cursor.current = value;
11526}
11527
11528function checkThatStackIsEmpty() {
11529 {
11530 if (index !== -1) {
11531 warningWithoutStack$1(false, 'Expected an empty stack. Something was not reset properly.');
11532 }
11533 }
11534}
11535
11536function resetStackAfterFatalErrorInDev() {
11537 {
11538 index = -1;
11539 valueStack.length = 0;
11540 fiberStack.length = 0;
11541 }
11542}
11543
11544var warnedAboutMissingGetChildContext = void 0;
11545
11546{
11547 warnedAboutMissingGetChildContext = {};
11548}
11549
11550var emptyContextObject = {};
11551{
11552 Object.freeze(emptyContextObject);
11553}
11554
11555// A cursor to the current merged context object on the stack.
11556var contextStackCursor = createCursor(emptyContextObject);
11557// A cursor to a boolean indicating whether the context has changed.
11558var didPerformWorkStackCursor = createCursor(false);
11559// Keep track of the previous context object that was on the stack.
11560// We use this to get access to the parent context after we have already
11561// pushed the next context provider, and now need to merge their contexts.
11562var previousContext = emptyContextObject;
11563
11564function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
11565 if (didPushOwnContextIfProvider && isContextProvider(Component)) {
11566 // If the fiber is a context provider itself, when we read its context
11567 // we may have already pushed its own child context on the stack. A context
11568 // provider should not "see" its own child context. Therefore we read the
11569 // previous (parent) context instead for a context provider.
11570 return previousContext;
11571 }
11572 return contextStackCursor.current;
11573}
11574
11575function cacheContext(workInProgress, unmaskedContext, maskedContext) {
11576 var instance = workInProgress.stateNode;
11577 instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
11578 instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
11579}
11580
11581function getMaskedContext(workInProgress, unmaskedContext) {
11582 var type = workInProgress.type;
11583 var contextTypes = type.contextTypes;
11584 if (!contextTypes) {
11585 return emptyContextObject;
11586 }
11587
11588 // Avoid recreating masked context unless unmasked context has changed.
11589 // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
11590 // This may trigger infinite loops if componentWillReceiveProps calls setState.
11591 var instance = workInProgress.stateNode;
11592 if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
11593 return instance.__reactInternalMemoizedMaskedChildContext;
11594 }
11595
11596 var context = {};
11597 for (var key in contextTypes) {
11598 context[key] = unmaskedContext[key];
11599 }
11600
11601 {
11602 var name = getComponentName(type) || 'Unknown';
11603 checkPropTypes(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
11604 }
11605
11606 // Cache unmasked context so we can avoid recreating masked context unless necessary.
11607 // Context is created before the class component is instantiated so check for instance.
11608 if (instance) {
11609 cacheContext(workInProgress, unmaskedContext, context);
11610 }
11611
11612 return context;
11613}
11614
11615function hasContextChanged() {
11616 return didPerformWorkStackCursor.current;
11617}
11618
11619function isContextProvider(type) {
11620 var childContextTypes = type.childContextTypes;
11621 return childContextTypes !== null && childContextTypes !== undefined;
11622}
11623
11624function popContext(fiber) {
11625 pop(didPerformWorkStackCursor, fiber);
11626 pop(contextStackCursor, fiber);
11627}
11628
11629function popTopLevelContextObject(fiber) {
11630 pop(didPerformWorkStackCursor, fiber);
11631 pop(contextStackCursor, fiber);
11632}
11633
11634function pushTopLevelContextObject(fiber, context, didChange) {
11635 !(contextStackCursor.current === emptyContextObject) ? invariant(false, 'Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.') : void 0;
11636
11637 push(contextStackCursor, context, fiber);
11638 push(didPerformWorkStackCursor, didChange, fiber);
11639}
11640
11641function processChildContext(fiber, type, parentContext) {
11642 var instance = fiber.stateNode;
11643 var childContextTypes = type.childContextTypes;
11644
11645 // TODO (bvaughn) Replace this behavior with an invariant() in the future.
11646 // It has only been added in Fiber to match the (unintentional) behavior in Stack.
11647 if (typeof instance.getChildContext !== 'function') {
11648 {
11649 var componentName = getComponentName(type) || 'Unknown';
11650
11651 if (!warnedAboutMissingGetChildContext[componentName]) {
11652 warnedAboutMissingGetChildContext[componentName] = true;
11653 warningWithoutStack$1(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);
11654 }
11655 }
11656 return parentContext;
11657 }
11658
11659 var childContext = void 0;
11660 {
11661 setCurrentPhase('getChildContext');
11662 }
11663 startPhaseTimer(fiber, 'getChildContext');
11664 childContext = instance.getChildContext();
11665 stopPhaseTimer();
11666 {
11667 setCurrentPhase(null);
11668 }
11669 for (var contextKey in childContext) {
11670 !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(type) || 'Unknown', contextKey) : void 0;
11671 }
11672 {
11673 var name = getComponentName(type) || 'Unknown';
11674 checkPropTypes(childContextTypes, childContext, 'child context', name,
11675 // In practice, there is one case in which we won't get a stack. It's when
11676 // somebody calls unstable_renderSubtreeIntoContainer() and we process
11677 // context from the parent component instance. The stack will be missing
11678 // because it's outside of the reconciliation, and so the pointer has not
11679 // been set. This is rare and doesn't matter. We'll also remove that API.
11680 getCurrentFiberStackInDev);
11681 }
11682
11683 return _assign({}, parentContext, childContext);
11684}
11685
11686function pushContextProvider(workInProgress) {
11687 var instance = workInProgress.stateNode;
11688 // We push the context as early as possible to ensure stack integrity.
11689 // If the instance does not exist yet, we will push null at first,
11690 // and replace it on the stack later when invalidating the context.
11691 var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
11692
11693 // Remember the parent context so we can merge with it later.
11694 // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
11695 previousContext = contextStackCursor.current;
11696 push(contextStackCursor, memoizedMergedChildContext, workInProgress);
11697 push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
11698
11699 return true;
11700}
11701
11702function invalidateContextProvider(workInProgress, type, didChange) {
11703 var instance = workInProgress.stateNode;
11704 !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;
11705
11706 if (didChange) {
11707 // Merge parent and own context.
11708 // Skip this if we're not updating due to sCU.
11709 // This avoids unnecessarily recomputing memoized values.
11710 var mergedContext = processChildContext(workInProgress, type, previousContext);
11711 instance.__reactInternalMemoizedMergedChildContext = mergedContext;
11712
11713 // Replace the old (or empty) context with the new one.
11714 // It is important to unwind the context in the reverse order.
11715 pop(didPerformWorkStackCursor, workInProgress);
11716 pop(contextStackCursor, workInProgress);
11717 // Now push the new context and mark that it has changed.
11718 push(contextStackCursor, mergedContext, workInProgress);
11719 push(didPerformWorkStackCursor, didChange, workInProgress);
11720 } else {
11721 pop(didPerformWorkStackCursor, workInProgress);
11722 push(didPerformWorkStackCursor, didChange, workInProgress);
11723 }
11724}
11725
11726function findCurrentUnmaskedContext(fiber) {
11727 // Currently this is only used with renderSubtreeIntoContainer; not sure if it
11728 // makes sense elsewhere
11729 !(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;
11730
11731 var node = fiber;
11732 do {
11733 switch (node.tag) {
11734 case HostRoot:
11735 return node.stateNode.context;
11736 case ClassComponent:
11737 {
11738 var Component = node.type;
11739 if (isContextProvider(Component)) {
11740 return node.stateNode.__reactInternalMemoizedMergedChildContext;
11741 }
11742 break;
11743 }
11744 }
11745 node = node.return;
11746 } while (node !== null);
11747 invariant(false, 'Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.');
11748}
11749
11750var onCommitFiberRoot = null;
11751var onCommitFiberUnmount = null;
11752var hasLoggedError = false;
11753
11754function catchErrors(fn) {
11755 return function (arg) {
11756 try {
11757 return fn(arg);
11758 } catch (err) {
11759 if (true && !hasLoggedError) {
11760 hasLoggedError = true;
11761 warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
11762 }
11763 }
11764 };
11765}
11766
11767var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
11768
11769function injectInternals(internals) {
11770 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
11771 // No DevTools
11772 return false;
11773 }
11774 var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
11775 if (hook.isDisabled) {
11776 // This isn't a real property on the hook, but it can be set to opt out
11777 // of DevTools integration and associated warnings and logs.
11778 // https://github.com/facebook/react/issues/3877
11779 return true;
11780 }
11781 if (!hook.supportsFiber) {
11782 {
11783 warningWithoutStack$1(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');
11784 }
11785 // DevTools exists, even though it doesn't support Fiber.
11786 return true;
11787 }
11788 try {
11789 var rendererID = hook.inject(internals);
11790 // We have successfully injected, so now it is safe to set up hooks.
11791 onCommitFiberRoot = catchErrors(function (root) {
11792 return hook.onCommitFiberRoot(rendererID, root);
11793 });
11794 onCommitFiberUnmount = catchErrors(function (fiber) {
11795 return hook.onCommitFiberUnmount(rendererID, fiber);
11796 });
11797 } catch (err) {
11798 // Catch all errors because it is unsafe to throw during initialization.
11799 {
11800 warningWithoutStack$1(false, 'React DevTools encountered an error: %s.', err);
11801 }
11802 }
11803 // DevTools exists
11804 return true;
11805}
11806
11807function onCommitRoot(root) {
11808 if (typeof onCommitFiberRoot === 'function') {
11809 onCommitFiberRoot(root);
11810 }
11811}
11812
11813function onCommitUnmount(fiber) {
11814 if (typeof onCommitFiberUnmount === 'function') {
11815 onCommitFiberUnmount(fiber);
11816 }
11817}
11818
11819// Max 31 bit integer. The max integer size in V8 for 32-bit systems.
11820// Math.pow(2, 30) - 1
11821// 0b111111111111111111111111111111
11822var maxSigned31BitInt = 1073741823;
11823
11824var NoWork = 0;
11825var Never = 1;
11826var Sync = maxSigned31BitInt;
11827
11828var UNIT_SIZE = 10;
11829var MAGIC_NUMBER_OFFSET = maxSigned31BitInt - 1;
11830
11831// 1 unit of expiration time represents 10ms.
11832function msToExpirationTime(ms) {
11833 // Always add an offset so that we don't clash with the magic number for NoWork.
11834 return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
11835}
11836
11837function expirationTimeToMs(expirationTime) {
11838 return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE;
11839}
11840
11841function ceiling(num, precision) {
11842 return ((num / precision | 0) + 1) * precision;
11843}
11844
11845function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
11846 return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
11847}
11848
11849var LOW_PRIORITY_EXPIRATION = 5000;
11850var LOW_PRIORITY_BATCH_SIZE = 250;
11851
11852function computeAsyncExpiration(currentTime) {
11853 return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
11854}
11855
11856// We intentionally set a higher expiration time for interactive updates in
11857// dev than in production.
11858//
11859// If the main thread is being blocked so long that you hit the expiration,
11860// it's a problem that could be solved with better scheduling.
11861//
11862// People will be more likely to notice this and fix it with the long
11863// expiration time in development.
11864//
11865// In production we opt for better UX at the risk of masking scheduling
11866// problems, by expiring fast.
11867var HIGH_PRIORITY_EXPIRATION = 500;
11868var HIGH_PRIORITY_BATCH_SIZE = 100;
11869
11870function computeInteractiveExpiration(currentTime) {
11871 return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
11872}
11873
11874var NoContext = 0;
11875var ConcurrentMode = 1;
11876var StrictMode = 2;
11877var ProfileMode = 4;
11878
11879var hasBadMapPolyfill = void 0;
11880
11881{
11882 hasBadMapPolyfill = false;
11883 try {
11884 var nonExtensibleObject = Object.preventExtensions({});
11885 var testMap = new Map([[nonExtensibleObject, null]]);
11886 var testSet = new Set([nonExtensibleObject]);
11887 // This is necessary for Rollup to not consider these unused.
11888 // https://github.com/rollup/rollup/issues/1771
11889 // TODO: we can remove these if Rollup fixes the bug.
11890 testMap.set(0, 0);
11891 testSet.add(0);
11892 } catch (e) {
11893 // TODO: Consider warning about bad polyfills
11894 hasBadMapPolyfill = true;
11895 }
11896}
11897
11898// A Fiber is work on a Component that needs to be done or was done. There can
11899// be more than one per component.
11900
11901
11902var debugCounter = void 0;
11903
11904{
11905 debugCounter = 1;
11906}
11907
11908function FiberNode(tag, pendingProps, key, mode) {
11909 // Instance
11910 this.tag = tag;
11911 this.key = key;
11912 this.elementType = null;
11913 this.type = null;
11914 this.stateNode = null;
11915
11916 // Fiber
11917 this.return = null;
11918 this.child = null;
11919 this.sibling = null;
11920 this.index = 0;
11921
11922 this.ref = null;
11923
11924 this.pendingProps = pendingProps;
11925 this.memoizedProps = null;
11926 this.updateQueue = null;
11927 this.memoizedState = null;
11928 this.firstContextDependency = null;
11929
11930 this.mode = mode;
11931
11932 // Effects
11933 this.effectTag = NoEffect;
11934 this.nextEffect = null;
11935
11936 this.firstEffect = null;
11937 this.lastEffect = null;
11938
11939 this.expirationTime = NoWork;
11940 this.childExpirationTime = NoWork;
11941
11942 this.alternate = null;
11943
11944 if (enableProfilerTimer) {
11945 // Note: The following is done to avoid a v8 performance cliff.
11946 //
11947 // Initializing the fields below to smis and later updating them with
11948 // double values will cause Fibers to end up having separate shapes.
11949 // This behavior/bug has something to do with Object.preventExtension().
11950 // Fortunately this only impacts DEV builds.
11951 // Unfortunately it makes React unusably slow for some applications.
11952 // To work around this, initialize the fields below with doubles.
11953 //
11954 // Learn more about this here:
11955 // https://github.com/facebook/react/issues/14365
11956 // https://bugs.chromium.org/p/v8/issues/detail?id=8538
11957 this.actualDuration = Number.NaN;
11958 this.actualStartTime = Number.NaN;
11959 this.selfBaseDuration = Number.NaN;
11960 this.treeBaseDuration = Number.NaN;
11961
11962 // It's okay to replace the initial doubles with smis after initialization.
11963 // This won't trigger the performance cliff mentioned above,
11964 // and it simplifies other profiler code (including DevTools).
11965 this.actualDuration = 0;
11966 this.actualStartTime = -1;
11967 this.selfBaseDuration = 0;
11968 this.treeBaseDuration = 0;
11969 }
11970
11971 {
11972 this._debugID = debugCounter++;
11973 this._debugSource = null;
11974 this._debugOwner = null;
11975 this._debugIsCurrentlyTiming = false;
11976 if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
11977 Object.preventExtensions(this);
11978 }
11979 }
11980}
11981
11982// This is a constructor function, rather than a POJO constructor, still
11983// please ensure we do the following:
11984// 1) Nobody should add any instance methods on this. Instance methods can be
11985// more difficult to predict when they get optimized and they are almost
11986// never inlined properly in static compilers.
11987// 2) Nobody should rely on `instanceof Fiber` for type testing. We should
11988// always know when it is a fiber.
11989// 3) We might want to experiment with using numeric keys since they are easier
11990// to optimize in a non-JIT environment.
11991// 4) We can easily go from a constructor to a createFiber object literal if that
11992// is faster.
11993// 5) It should be easy to port this to a C struct and keep a C implementation
11994// compatible.
11995var createFiber = function (tag, pendingProps, key, mode) {
11996 // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
11997 return new FiberNode(tag, pendingProps, key, mode);
11998};
11999
12000function shouldConstruct(Component) {
12001 var prototype = Component.prototype;
12002 return !!(prototype && prototype.isReactComponent);
12003}
12004
12005function isSimpleFunctionComponent(type) {
12006 return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
12007}
12008
12009function resolveLazyComponentTag(Component) {
12010 if (typeof Component === 'function') {
12011 return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
12012 } else if (Component !== undefined && Component !== null) {
12013 var $$typeof = Component.$$typeof;
12014 if ($$typeof === REACT_FORWARD_REF_TYPE) {
12015 return ForwardRef;
12016 }
12017 if ($$typeof === REACT_MEMO_TYPE) {
12018 return MemoComponent;
12019 }
12020 }
12021 return IndeterminateComponent;
12022}
12023
12024// This is used to create an alternate fiber to do work on.
12025function createWorkInProgress(current, pendingProps, expirationTime) {
12026 var workInProgress = current.alternate;
12027 if (workInProgress === null) {
12028 // We use a double buffering pooling technique because we know that we'll
12029 // only ever need at most two versions of a tree. We pool the "other" unused
12030 // node that we're free to reuse. This is lazily created to avoid allocating
12031 // extra objects for things that are never updated. It also allow us to
12032 // reclaim the extra memory if needed.
12033 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
12034 workInProgress.elementType = current.elementType;
12035 workInProgress.type = current.type;
12036 workInProgress.stateNode = current.stateNode;
12037
12038 {
12039 // DEV-only fields
12040 workInProgress._debugID = current._debugID;
12041 workInProgress._debugSource = current._debugSource;
12042 workInProgress._debugOwner = current._debugOwner;
12043 }
12044
12045 workInProgress.alternate = current;
12046 current.alternate = workInProgress;
12047 } else {
12048 workInProgress.pendingProps = pendingProps;
12049
12050 // We already have an alternate.
12051 // Reset the effect tag.
12052 workInProgress.effectTag = NoEffect;
12053
12054 // The effect list is no longer valid.
12055 workInProgress.nextEffect = null;
12056 workInProgress.firstEffect = null;
12057 workInProgress.lastEffect = null;
12058
12059 if (enableProfilerTimer) {
12060 // We intentionally reset, rather than copy, actualDuration & actualStartTime.
12061 // This prevents time from endlessly accumulating in new commits.
12062 // This has the downside of resetting values for different priority renders,
12063 // But works for yielding (the common case) and should support resuming.
12064 workInProgress.actualDuration = 0;
12065 workInProgress.actualStartTime = -1;
12066 }
12067 }
12068
12069 workInProgress.childExpirationTime = current.childExpirationTime;
12070 workInProgress.expirationTime = current.expirationTime;
12071
12072 workInProgress.child = current.child;
12073 workInProgress.memoizedProps = current.memoizedProps;
12074 workInProgress.memoizedState = current.memoizedState;
12075 workInProgress.updateQueue = current.updateQueue;
12076 workInProgress.firstContextDependency = current.firstContextDependency;
12077
12078 // These will be overridden during the parent's reconciliation
12079 workInProgress.sibling = current.sibling;
12080 workInProgress.index = current.index;
12081 workInProgress.ref = current.ref;
12082
12083 if (enableProfilerTimer) {
12084 workInProgress.selfBaseDuration = current.selfBaseDuration;
12085 workInProgress.treeBaseDuration = current.treeBaseDuration;
12086 }
12087
12088 return workInProgress;
12089}
12090
12091function createHostRootFiber(isConcurrent) {
12092 var mode = isConcurrent ? ConcurrentMode | StrictMode : NoContext;
12093
12094 if (enableProfilerTimer && isDevToolsPresent) {
12095 // Always collect profile timings when DevTools are present.
12096 // This enables DevTools to start capturing timing at any point–
12097 // Without some nodes in the tree having empty base times.
12098 mode |= ProfileMode;
12099 }
12100
12101 return createFiber(HostRoot, null, null, mode);
12102}
12103
12104function createFiberFromTypeAndProps(type, // React$ElementType
12105key, pendingProps, owner, mode, expirationTime) {
12106 var fiber = void 0;
12107
12108 var fiberTag = IndeterminateComponent;
12109 // The resolved type is set if we know what the final type will be. I.e. it's not lazy.
12110 var resolvedType = type;
12111 if (typeof type === 'function') {
12112 if (shouldConstruct(type)) {
12113 fiberTag = ClassComponent;
12114 }
12115 } else if (typeof type === 'string') {
12116 fiberTag = HostComponent;
12117 } else {
12118 getTag: switch (type) {
12119 case REACT_FRAGMENT_TYPE:
12120 return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
12121 case REACT_CONCURRENT_MODE_TYPE:
12122 return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
12123 case REACT_STRICT_MODE_TYPE:
12124 return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
12125 case REACT_PROFILER_TYPE:
12126 return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
12127 case REACT_SUSPENSE_TYPE:
12128 return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
12129 default:
12130 {
12131 if (typeof type === 'object' && type !== null) {
12132 switch (type.$$typeof) {
12133 case REACT_PROVIDER_TYPE:
12134 fiberTag = ContextProvider;
12135 break getTag;
12136 case REACT_CONTEXT_TYPE:
12137 // This is a consumer
12138 fiberTag = ContextConsumer;
12139 break getTag;
12140 case REACT_FORWARD_REF_TYPE:
12141 fiberTag = ForwardRef;
12142 break getTag;
12143 case REACT_MEMO_TYPE:
12144 fiberTag = MemoComponent;
12145 break getTag;
12146 case REACT_LAZY_TYPE:
12147 fiberTag = LazyComponent;
12148 resolvedType = null;
12149 break getTag;
12150 }
12151 }
12152 var info = '';
12153 {
12154 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
12155 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.';
12156 }
12157 var ownerName = owner ? getComponentName(owner.type) : null;
12158 if (ownerName) {
12159 info += '\n\nCheck the render method of `' + ownerName + '`.';
12160 }
12161 }
12162 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);
12163 }
12164 }
12165 }
12166
12167 fiber = createFiber(fiberTag, pendingProps, key, mode);
12168 fiber.elementType = type;
12169 fiber.type = resolvedType;
12170 fiber.expirationTime = expirationTime;
12171
12172 return fiber;
12173}
12174
12175function createFiberFromElement(element, mode, expirationTime) {
12176 var owner = null;
12177 {
12178 owner = element._owner;
12179 }
12180 var type = element.type;
12181 var key = element.key;
12182 var pendingProps = element.props;
12183 var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
12184 {
12185 fiber._debugSource = element._source;
12186 fiber._debugOwner = element._owner;
12187 }
12188 return fiber;
12189}
12190
12191function createFiberFromFragment(elements, mode, expirationTime, key) {
12192 var fiber = createFiber(Fragment, elements, key, mode);
12193 fiber.expirationTime = expirationTime;
12194 return fiber;
12195}
12196
12197function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
12198 {
12199 if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
12200 warningWithoutStack$1(false, 'Profiler must specify an "id" string and "onRender" function as props');
12201 }
12202 }
12203
12204 var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
12205 // TODO: The Profiler fiber shouldn't have a type. It has a tag.
12206 fiber.elementType = REACT_PROFILER_TYPE;
12207 fiber.type = REACT_PROFILER_TYPE;
12208 fiber.expirationTime = expirationTime;
12209
12210 return fiber;
12211}
12212
12213function createFiberFromMode(pendingProps, mode, expirationTime, key) {
12214 var fiber = createFiber(Mode, pendingProps, key, mode);
12215
12216 // TODO: The Mode fiber shouldn't have a type. It has a tag.
12217 var type = (mode & ConcurrentMode) === NoContext ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE;
12218 fiber.elementType = type;
12219 fiber.type = type;
12220
12221 fiber.expirationTime = expirationTime;
12222 return fiber;
12223}
12224
12225function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
12226 var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
12227
12228 // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
12229 var type = REACT_SUSPENSE_TYPE;
12230 fiber.elementType = type;
12231 fiber.type = type;
12232
12233 fiber.expirationTime = expirationTime;
12234 return fiber;
12235}
12236
12237function createFiberFromText(content, mode, expirationTime) {
12238 var fiber = createFiber(HostText, content, null, mode);
12239 fiber.expirationTime = expirationTime;
12240 return fiber;
12241}
12242
12243function createFiberFromHostInstanceForDeletion() {
12244 var fiber = createFiber(HostComponent, null, null, NoContext);
12245 // TODO: These should not need a type.
12246 fiber.elementType = 'DELETED';
12247 fiber.type = 'DELETED';
12248 return fiber;
12249}
12250
12251function createFiberFromPortal(portal, mode, expirationTime) {
12252 var pendingProps = portal.children !== null ? portal.children : [];
12253 var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
12254 fiber.expirationTime = expirationTime;
12255 fiber.stateNode = {
12256 containerInfo: portal.containerInfo,
12257 pendingChildren: null, // Used by persistent updates
12258 implementation: portal.implementation
12259 };
12260 return fiber;
12261}
12262
12263// Used for stashing WIP properties to replay failed work in DEV.
12264function assignFiberPropertiesInDEV(target, source) {
12265 if (target === null) {
12266 // This Fiber's initial properties will always be overwritten.
12267 // We only use a Fiber to ensure the same hidden class so DEV isn't slow.
12268 target = createFiber(IndeterminateComponent, null, null, NoContext);
12269 }
12270
12271 // This is intentionally written as a list of all properties.
12272 // We tried to use Object.assign() instead but this is called in
12273 // the hottest path, and Object.assign() was too slow:
12274 // https://github.com/facebook/react/issues/12502
12275 // This code is DEV-only so size is not a concern.
12276
12277 target.tag = source.tag;
12278 target.key = source.key;
12279 target.elementType = source.elementType;
12280 target.type = source.type;
12281 target.stateNode = source.stateNode;
12282 target.return = source.return;
12283 target.child = source.child;
12284 target.sibling = source.sibling;
12285 target.index = source.index;
12286 target.ref = source.ref;
12287 target.pendingProps = source.pendingProps;
12288 target.memoizedProps = source.memoizedProps;
12289 target.updateQueue = source.updateQueue;
12290 target.memoizedState = source.memoizedState;
12291 target.firstContextDependency = source.firstContextDependency;
12292 target.mode = source.mode;
12293 target.effectTag = source.effectTag;
12294 target.nextEffect = source.nextEffect;
12295 target.firstEffect = source.firstEffect;
12296 target.lastEffect = source.lastEffect;
12297 target.expirationTime = source.expirationTime;
12298 target.childExpirationTime = source.childExpirationTime;
12299 target.alternate = source.alternate;
12300 if (enableProfilerTimer) {
12301 target.actualDuration = source.actualDuration;
12302 target.actualStartTime = source.actualStartTime;
12303 target.selfBaseDuration = source.selfBaseDuration;
12304 target.treeBaseDuration = source.treeBaseDuration;
12305 }
12306 target._debugID = source._debugID;
12307 target._debugSource = source._debugSource;
12308 target._debugOwner = source._debugOwner;
12309 target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
12310 return target;
12311}
12312
12313// TODO: This should be lifted into the renderer.
12314
12315
12316// The following attributes are only used by interaction tracing builds.
12317// They enable interactions to be associated with their async work,
12318// And expose interaction metadata to the React DevTools Profiler plugin.
12319// Note that these attributes are only defined when the enableSchedulerTracing flag is enabled.
12320
12321
12322// Exported FiberRoot type includes all properties,
12323// To avoid requiring potentially error-prone :any casts throughout the project.
12324// Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
12325// The types are defined separately within this file to ensure they stay in sync.
12326// (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
12327
12328
12329function createFiberRoot(containerInfo, isConcurrent, hydrate) {
12330 // Cyclic construction. This cheats the type system right now because
12331 // stateNode is any.
12332 var uninitializedFiber = createHostRootFiber(isConcurrent);
12333
12334 var root = void 0;
12335 if (enableSchedulerTracing) {
12336 root = {
12337 current: uninitializedFiber,
12338 containerInfo: containerInfo,
12339 pendingChildren: null,
12340
12341 earliestPendingTime: NoWork,
12342 latestPendingTime: NoWork,
12343 earliestSuspendedTime: NoWork,
12344 latestSuspendedTime: NoWork,
12345 latestPingedTime: NoWork,
12346
12347 pingCache: null,
12348
12349 didError: false,
12350
12351 pendingCommitExpirationTime: NoWork,
12352 finishedWork: null,
12353 timeoutHandle: noTimeout,
12354 context: null,
12355 pendingContext: null,
12356 hydrate: hydrate,
12357 nextExpirationTimeToWorkOn: NoWork,
12358 expirationTime: NoWork,
12359 firstBatch: null,
12360 nextScheduledRoot: null,
12361
12362 interactionThreadID: tracing.unstable_getThreadID(),
12363 memoizedInteractions: new Set(),
12364 pendingInteractionMap: new Map()
12365 };
12366 } else {
12367 root = {
12368 current: uninitializedFiber,
12369 containerInfo: containerInfo,
12370 pendingChildren: null,
12371
12372 pingCache: null,
12373
12374 earliestPendingTime: NoWork,
12375 latestPendingTime: NoWork,
12376 earliestSuspendedTime: NoWork,
12377 latestSuspendedTime: NoWork,
12378 latestPingedTime: NoWork,
12379
12380 didError: false,
12381
12382 pendingCommitExpirationTime: NoWork,
12383 finishedWork: null,
12384 timeoutHandle: noTimeout,
12385 context: null,
12386 pendingContext: null,
12387 hydrate: hydrate,
12388 nextExpirationTimeToWorkOn: NoWork,
12389 expirationTime: NoWork,
12390 firstBatch: null,
12391 nextScheduledRoot: null
12392 };
12393 }
12394
12395 uninitializedFiber.stateNode = root;
12396
12397 // The reason for the way the Flow types are structured in this file,
12398 // Is to avoid needing :any casts everywhere interaction tracing fields are used.
12399 // Unfortunately that requires an :any cast for non-interaction tracing capable builds.
12400 // $FlowFixMe Remove this :any cast and replace it with something better.
12401 return root;
12402}
12403
12404/**
12405 * Forked from fbjs/warning:
12406 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
12407 *
12408 * Only change is we use console.warn instead of console.error,
12409 * and do nothing when 'console' is not supported.
12410 * This really simplifies the code.
12411 * ---
12412 * Similar to invariant but only logs a warning if the condition is not met.
12413 * This can be used to log issues in development environments in critical
12414 * paths. Removing the logging code for production environments will keep the
12415 * same logic and follow the same code paths.
12416 */
12417
12418var lowPriorityWarning = function () {};
12419
12420{
12421 var printWarning = function (format) {
12422 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
12423 args[_key - 1] = arguments[_key];
12424 }
12425
12426 var argIndex = 0;
12427 var message = 'Warning: ' + format.replace(/%s/g, function () {
12428 return args[argIndex++];
12429 });
12430 if (typeof console !== 'undefined') {
12431 console.warn(message);
12432 }
12433 try {
12434 // --- Welcome to debugging React ---
12435 // This error was thrown as a convenience so that you can use this stack
12436 // to find the callsite that caused this warning to fire.
12437 throw new Error(message);
12438 } catch (x) {}
12439 };
12440
12441 lowPriorityWarning = function (condition, format) {
12442 if (format === undefined) {
12443 throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
12444 }
12445 if (!condition) {
12446 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
12447 args[_key2 - 2] = arguments[_key2];
12448 }
12449
12450 printWarning.apply(undefined, [format].concat(args));
12451 }
12452 };
12453}
12454
12455var lowPriorityWarning$1 = lowPriorityWarning;
12456
12457var ReactStrictModeWarnings = {
12458 discardPendingWarnings: function () {},
12459 flushPendingDeprecationWarnings: function () {},
12460 flushPendingUnsafeLifecycleWarnings: function () {},
12461 recordDeprecationWarnings: function (fiber, instance) {},
12462 recordUnsafeLifecycleWarnings: function (fiber, instance) {},
12463 recordLegacyContextWarning: function (fiber, instance) {},
12464 flushLegacyContextWarning: function () {}
12465};
12466
12467{
12468 var LIFECYCLE_SUGGESTIONS = {
12469 UNSAFE_componentWillMount: 'componentDidMount',
12470 UNSAFE_componentWillReceiveProps: 'static getDerivedStateFromProps',
12471 UNSAFE_componentWillUpdate: 'componentDidUpdate'
12472 };
12473
12474 var pendingComponentWillMountWarnings = [];
12475 var pendingComponentWillReceivePropsWarnings = [];
12476 var pendingComponentWillUpdateWarnings = [];
12477 var pendingUnsafeLifecycleWarnings = new Map();
12478 var pendingLegacyContextWarning = new Map();
12479
12480 // Tracks components we have already warned about.
12481 var didWarnAboutDeprecatedLifecycles = new Set();
12482 var didWarnAboutUnsafeLifecycles = new Set();
12483 var didWarnAboutLegacyContext = new Set();
12484
12485 var setToSortedString = function (set) {
12486 var array = [];
12487 set.forEach(function (value) {
12488 array.push(value);
12489 });
12490 return array.sort().join(', ');
12491 };
12492
12493 ReactStrictModeWarnings.discardPendingWarnings = function () {
12494 pendingComponentWillMountWarnings = [];
12495 pendingComponentWillReceivePropsWarnings = [];
12496 pendingComponentWillUpdateWarnings = [];
12497 pendingUnsafeLifecycleWarnings = new Map();
12498 pendingLegacyContextWarning = new Map();
12499 };
12500
12501 ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
12502 pendingUnsafeLifecycleWarnings.forEach(function (lifecycleWarningsMap, strictRoot) {
12503 var lifecyclesWarningMesages = [];
12504
12505 Object.keys(lifecycleWarningsMap).forEach(function (lifecycle) {
12506 var lifecycleWarnings = lifecycleWarningsMap[lifecycle];
12507 if (lifecycleWarnings.length > 0) {
12508 var componentNames = new Set();
12509 lifecycleWarnings.forEach(function (fiber) {
12510 componentNames.add(getComponentName(fiber.type) || 'Component');
12511 didWarnAboutUnsafeLifecycles.add(fiber.type);
12512 });
12513
12514 var formatted = lifecycle.replace('UNSAFE_', '');
12515 var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle];
12516 var sortedComponentNames = setToSortedString(componentNames);
12517
12518 lifecyclesWarningMesages.push(formatted + ': Please update the following components to use ' + (suggestion + ' instead: ' + sortedComponentNames));
12519 }
12520 });
12521
12522 if (lifecyclesWarningMesages.length > 0) {
12523 var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
12524
12525 warningWithoutStack$1(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'));
12526 }
12527 });
12528
12529 pendingUnsafeLifecycleWarnings = new Map();
12530 };
12531
12532 var findStrictRoot = function (fiber) {
12533 var maybeStrictRoot = null;
12534
12535 var node = fiber;
12536 while (node !== null) {
12537 if (node.mode & StrictMode) {
12538 maybeStrictRoot = node;
12539 }
12540 node = node.return;
12541 }
12542
12543 return maybeStrictRoot;
12544 };
12545
12546 ReactStrictModeWarnings.flushPendingDeprecationWarnings = function () {
12547 if (pendingComponentWillMountWarnings.length > 0) {
12548 var uniqueNames = new Set();
12549 pendingComponentWillMountWarnings.forEach(function (fiber) {
12550 uniqueNames.add(getComponentName(fiber.type) || 'Component');
12551 didWarnAboutDeprecatedLifecycles.add(fiber.type);
12552 });
12553
12554 var sortedNames = setToSortedString(uniqueNames);
12555
12556 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);
12557
12558 pendingComponentWillMountWarnings = [];
12559 }
12560
12561 if (pendingComponentWillReceivePropsWarnings.length > 0) {
12562 var _uniqueNames = new Set();
12563 pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
12564 _uniqueNames.add(getComponentName(fiber.type) || 'Component');
12565 didWarnAboutDeprecatedLifecycles.add(fiber.type);
12566 });
12567
12568 var _sortedNames = setToSortedString(_uniqueNames);
12569
12570 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);
12571
12572 pendingComponentWillReceivePropsWarnings = [];
12573 }
12574
12575 if (pendingComponentWillUpdateWarnings.length > 0) {
12576 var _uniqueNames2 = new Set();
12577 pendingComponentWillUpdateWarnings.forEach(function (fiber) {
12578 _uniqueNames2.add(getComponentName(fiber.type) || 'Component');
12579 didWarnAboutDeprecatedLifecycles.add(fiber.type);
12580 });
12581
12582 var _sortedNames2 = setToSortedString(_uniqueNames2);
12583
12584 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);
12585
12586 pendingComponentWillUpdateWarnings = [];
12587 }
12588 };
12589
12590 ReactStrictModeWarnings.recordDeprecationWarnings = function (fiber, instance) {
12591 // Dedup strategy: Warn once per component.
12592 if (didWarnAboutDeprecatedLifecycles.has(fiber.type)) {
12593 return;
12594 }
12595
12596 // Don't warn about react-lifecycles-compat polyfilled components.
12597 if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
12598 pendingComponentWillMountWarnings.push(fiber);
12599 }
12600 if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
12601 pendingComponentWillReceivePropsWarnings.push(fiber);
12602 }
12603 if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
12604 pendingComponentWillUpdateWarnings.push(fiber);
12605 }
12606 };
12607
12608 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
12609 var strictRoot = findStrictRoot(fiber);
12610 if (strictRoot === null) {
12611 warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
12612 return;
12613 }
12614
12615 // Dedup strategy: Warn once per component.
12616 // This is difficult to track any other way since component names
12617 // are often vague and are likely to collide between 3rd party libraries.
12618 // An expand property is probably okay to use here since it's DEV-only,
12619 // and will only be set in the event of serious warnings.
12620 if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
12621 return;
12622 }
12623
12624 var warningsForRoot = void 0;
12625 if (!pendingUnsafeLifecycleWarnings.has(strictRoot)) {
12626 warningsForRoot = {
12627 UNSAFE_componentWillMount: [],
12628 UNSAFE_componentWillReceiveProps: [],
12629 UNSAFE_componentWillUpdate: []
12630 };
12631
12632 pendingUnsafeLifecycleWarnings.set(strictRoot, warningsForRoot);
12633 } else {
12634 warningsForRoot = pendingUnsafeLifecycleWarnings.get(strictRoot);
12635 }
12636
12637 var unsafeLifecycles = [];
12638 if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillMount === 'function') {
12639 unsafeLifecycles.push('UNSAFE_componentWillMount');
12640 }
12641 if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
12642 unsafeLifecycles.push('UNSAFE_componentWillReceiveProps');
12643 }
12644 if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillUpdate === 'function') {
12645 unsafeLifecycles.push('UNSAFE_componentWillUpdate');
12646 }
12647
12648 if (unsafeLifecycles.length > 0) {
12649 unsafeLifecycles.forEach(function (lifecycle) {
12650 warningsForRoot[lifecycle].push(fiber);
12651 });
12652 }
12653 };
12654
12655 ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
12656 var strictRoot = findStrictRoot(fiber);
12657 if (strictRoot === null) {
12658 warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
12659 return;
12660 }
12661
12662 // Dedup strategy: Warn once per component.
12663 if (didWarnAboutLegacyContext.has(fiber.type)) {
12664 return;
12665 }
12666
12667 var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
12668
12669 if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') {
12670 if (warningsForRoot === undefined) {
12671 warningsForRoot = [];
12672 pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
12673 }
12674 warningsForRoot.push(fiber);
12675 }
12676 };
12677
12678 ReactStrictModeWarnings.flushLegacyContextWarning = function () {
12679 pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) {
12680 var uniqueNames = new Set();
12681 fiberArray.forEach(function (fiber) {
12682 uniqueNames.add(getComponentName(fiber.type) || 'Component');
12683 didWarnAboutLegacyContext.add(fiber.type);
12684 });
12685
12686 var sortedNames = setToSortedString(uniqueNames);
12687 var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
12688
12689 warningWithoutStack$1(false, 'Legacy context API has been detected within a strict-mode tree: %s' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, sortedNames);
12690 });
12691 };
12692}
12693
12694// This lets us hook into Fiber to debug what it's doing.
12695// See https://github.com/facebook/react/pull/8033.
12696// This is not part of the public API, not even for React DevTools.
12697// You may only inject a debugTool if you work on React Fiber itself.
12698var ReactFiberInstrumentation = {
12699 debugTool: null
12700};
12701
12702var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
12703
12704// TODO: Offscreen updates should never suspend. However, a promise that
12705// suspended inside an offscreen subtree should be able to ping at the priority
12706// of the outer render.
12707
12708function markPendingPriorityLevel(root, expirationTime) {
12709 // If there's a gap between completing a failed root and retrying it,
12710 // additional updates may be scheduled. Clear `didError`, in case the update
12711 // is sufficient to fix the error.
12712 root.didError = false;
12713
12714 // Update the latest and earliest pending times
12715 var earliestPendingTime = root.earliestPendingTime;
12716 if (earliestPendingTime === NoWork) {
12717 // No other pending updates.
12718 root.earliestPendingTime = root.latestPendingTime = expirationTime;
12719 } else {
12720 if (earliestPendingTime < expirationTime) {
12721 // This is the earliest pending update.
12722 root.earliestPendingTime = expirationTime;
12723 } else {
12724 var latestPendingTime = root.latestPendingTime;
12725 if (latestPendingTime > expirationTime) {
12726 // This is the latest pending update
12727 root.latestPendingTime = expirationTime;
12728 }
12729 }
12730 }
12731 findNextExpirationTimeToWorkOn(expirationTime, root);
12732}
12733
12734function markCommittedPriorityLevels(root, earliestRemainingTime) {
12735 root.didError = false;
12736
12737 if (earliestRemainingTime === NoWork) {
12738 // Fast path. There's no remaining work. Clear everything.
12739 root.earliestPendingTime = NoWork;
12740 root.latestPendingTime = NoWork;
12741 root.earliestSuspendedTime = NoWork;
12742 root.latestSuspendedTime = NoWork;
12743 root.latestPingedTime = NoWork;
12744 findNextExpirationTimeToWorkOn(NoWork, root);
12745 return;
12746 }
12747
12748 if (earliestRemainingTime < root.latestPingedTime) {
12749 root.latestPingedTime = NoWork;
12750 }
12751
12752 // Let's see if the previous latest known pending level was just flushed.
12753 var latestPendingTime = root.latestPendingTime;
12754 if (latestPendingTime !== NoWork) {
12755 if (latestPendingTime > earliestRemainingTime) {
12756 // We've flushed all the known pending levels.
12757 root.earliestPendingTime = root.latestPendingTime = NoWork;
12758 } else {
12759 var earliestPendingTime = root.earliestPendingTime;
12760 if (earliestPendingTime > earliestRemainingTime) {
12761 // We've flushed the earliest known pending level. Set this to the
12762 // latest pending time.
12763 root.earliestPendingTime = root.latestPendingTime;
12764 }
12765 }
12766 }
12767
12768 // Now let's handle the earliest remaining level in the whole tree. We need to
12769 // decide whether to treat it as a pending level or as suspended. Check
12770 // it falls within the range of known suspended levels.
12771
12772 var earliestSuspendedTime = root.earliestSuspendedTime;
12773 if (earliestSuspendedTime === NoWork) {
12774 // There's no suspended work. Treat the earliest remaining level as a
12775 // pending level.
12776 markPendingPriorityLevel(root, earliestRemainingTime);
12777 findNextExpirationTimeToWorkOn(NoWork, root);
12778 return;
12779 }
12780
12781 var latestSuspendedTime = root.latestSuspendedTime;
12782 if (earliestRemainingTime < latestSuspendedTime) {
12783 // The earliest remaining level is later than all the suspended work. That
12784 // means we've flushed all the suspended work.
12785 root.earliestSuspendedTime = NoWork;
12786 root.latestSuspendedTime = NoWork;
12787 root.latestPingedTime = NoWork;
12788
12789 // There's no suspended work. Treat the earliest remaining level as a
12790 // pending level.
12791 markPendingPriorityLevel(root, earliestRemainingTime);
12792 findNextExpirationTimeToWorkOn(NoWork, root);
12793 return;
12794 }
12795
12796 if (earliestRemainingTime > earliestSuspendedTime) {
12797 // The earliest remaining time is earlier than all the suspended work.
12798 // Treat it as a pending update.
12799 markPendingPriorityLevel(root, earliestRemainingTime);
12800 findNextExpirationTimeToWorkOn(NoWork, root);
12801 return;
12802 }
12803
12804 // The earliest remaining time falls within the range of known suspended
12805 // levels. We should treat this as suspended work.
12806 findNextExpirationTimeToWorkOn(NoWork, root);
12807}
12808
12809function hasLowerPriorityWork(root, erroredExpirationTime) {
12810 var latestPendingTime = root.latestPendingTime;
12811 var latestSuspendedTime = root.latestSuspendedTime;
12812 var latestPingedTime = root.latestPingedTime;
12813 return latestPendingTime !== NoWork && latestPendingTime < erroredExpirationTime || latestSuspendedTime !== NoWork && latestSuspendedTime < erroredExpirationTime || latestPingedTime !== NoWork && latestPingedTime < erroredExpirationTime;
12814}
12815
12816function isPriorityLevelSuspended(root, expirationTime) {
12817 var earliestSuspendedTime = root.earliestSuspendedTime;
12818 var latestSuspendedTime = root.latestSuspendedTime;
12819 return earliestSuspendedTime !== NoWork && expirationTime <= earliestSuspendedTime && expirationTime >= latestSuspendedTime;
12820}
12821
12822function markSuspendedPriorityLevel(root, suspendedTime) {
12823 root.didError = false;
12824 clearPing(root, suspendedTime);
12825
12826 // First, check the known pending levels and update them if needed.
12827 var earliestPendingTime = root.earliestPendingTime;
12828 var latestPendingTime = root.latestPendingTime;
12829 if (earliestPendingTime === suspendedTime) {
12830 if (latestPendingTime === suspendedTime) {
12831 // Both known pending levels were suspended. Clear them.
12832 root.earliestPendingTime = root.latestPendingTime = NoWork;
12833 } else {
12834 // The earliest pending level was suspended. Clear by setting it to the
12835 // latest pending level.
12836 root.earliestPendingTime = latestPendingTime;
12837 }
12838 } else if (latestPendingTime === suspendedTime) {
12839 // The latest pending level was suspended. Clear by setting it to the
12840 // latest pending level.
12841 root.latestPendingTime = earliestPendingTime;
12842 }
12843
12844 // Finally, update the known suspended levels.
12845 var earliestSuspendedTime = root.earliestSuspendedTime;
12846 var latestSuspendedTime = root.latestSuspendedTime;
12847 if (earliestSuspendedTime === NoWork) {
12848 // No other suspended levels.
12849 root.earliestSuspendedTime = root.latestSuspendedTime = suspendedTime;
12850 } else {
12851 if (earliestSuspendedTime < suspendedTime) {
12852 // This is the earliest suspended level.
12853 root.earliestSuspendedTime = suspendedTime;
12854 } else if (latestSuspendedTime > suspendedTime) {
12855 // This is the latest suspended level
12856 root.latestSuspendedTime = suspendedTime;
12857 }
12858 }
12859
12860 findNextExpirationTimeToWorkOn(suspendedTime, root);
12861}
12862
12863function markPingedPriorityLevel(root, pingedTime) {
12864 root.didError = false;
12865
12866 // TODO: When we add back resuming, we need to ensure the progressed work
12867 // is thrown out and not reused during the restarted render. One way to
12868 // invalidate the progressed work is to restart at expirationTime + 1.
12869 var latestPingedTime = root.latestPingedTime;
12870 if (latestPingedTime === NoWork || latestPingedTime > pingedTime) {
12871 root.latestPingedTime = pingedTime;
12872 }
12873 findNextExpirationTimeToWorkOn(pingedTime, root);
12874}
12875
12876function clearPing(root, completedTime) {
12877 var latestPingedTime = root.latestPingedTime;
12878 if (latestPingedTime >= completedTime) {
12879 root.latestPingedTime = NoWork;
12880 }
12881}
12882
12883function findEarliestOutstandingPriorityLevel(root, renderExpirationTime) {
12884 var earliestExpirationTime = renderExpirationTime;
12885
12886 var earliestPendingTime = root.earliestPendingTime;
12887 var earliestSuspendedTime = root.earliestSuspendedTime;
12888 if (earliestPendingTime > earliestExpirationTime) {
12889 earliestExpirationTime = earliestPendingTime;
12890 }
12891 if (earliestSuspendedTime > earliestExpirationTime) {
12892 earliestExpirationTime = earliestSuspendedTime;
12893 }
12894 return earliestExpirationTime;
12895}
12896
12897function didExpireAtExpirationTime(root, currentTime) {
12898 var expirationTime = root.expirationTime;
12899 if (expirationTime !== NoWork && currentTime <= expirationTime) {
12900 // The root has expired. Flush all work up to the current time.
12901 root.nextExpirationTimeToWorkOn = currentTime;
12902 }
12903}
12904
12905function findNextExpirationTimeToWorkOn(completedExpirationTime, root) {
12906 var earliestSuspendedTime = root.earliestSuspendedTime;
12907 var latestSuspendedTime = root.latestSuspendedTime;
12908 var earliestPendingTime = root.earliestPendingTime;
12909 var latestPingedTime = root.latestPingedTime;
12910
12911 // Work on the earliest pending time. Failing that, work on the latest
12912 // pinged time.
12913 var nextExpirationTimeToWorkOn = earliestPendingTime !== NoWork ? earliestPendingTime : latestPingedTime;
12914
12915 // If there is no pending or pinged work, check if there's suspended work
12916 // that's lower priority than what we just completed.
12917 if (nextExpirationTimeToWorkOn === NoWork && (completedExpirationTime === NoWork || latestSuspendedTime < completedExpirationTime)) {
12918 // The lowest priority suspended work is the work most likely to be
12919 // committed next. Let's start rendering it again, so that if it times out,
12920 // it's ready to commit.
12921 nextExpirationTimeToWorkOn = latestSuspendedTime;
12922 }
12923
12924 var expirationTime = nextExpirationTimeToWorkOn;
12925 if (expirationTime !== NoWork && earliestSuspendedTime > expirationTime) {
12926 // Expire using the earliest known expiration time.
12927 expirationTime = earliestSuspendedTime;
12928 }
12929
12930 root.nextExpirationTimeToWorkOn = nextExpirationTimeToWorkOn;
12931 root.expirationTime = expirationTime;
12932}
12933
12934// UpdateQueue is a linked list of prioritized updates.
12935//
12936// Like fibers, update queues come in pairs: a current queue, which represents
12937// the visible state of the screen, and a work-in-progress queue, which is
12938// can be mutated and processed asynchronously before it is committed — a form
12939// of double buffering. If a work-in-progress render is discarded before
12940// finishing, we create a new work-in-progress by cloning the current queue.
12941//
12942// Both queues share a persistent, singly-linked list structure. To schedule an
12943// update, we append it to the end of both queues. Each queue maintains a
12944// pointer to first update in the persistent list that hasn't been processed.
12945// The work-in-progress pointer always has a position equal to or greater than
12946// the current queue, since we always work on that one. The current queue's
12947// pointer is only updated during the commit phase, when we swap in the
12948// work-in-progress.
12949//
12950// For example:
12951//
12952// Current pointer: A - B - C - D - E - F
12953// Work-in-progress pointer: D - E - F
12954// ^
12955// The work-in-progress queue has
12956// processed more updates than current.
12957//
12958// The reason we append to both queues is because otherwise we might drop
12959// updates without ever processing them. For example, if we only add updates to
12960// the work-in-progress queue, some updates could be lost whenever a work-in
12961// -progress render restarts by cloning from current. Similarly, if we only add
12962// updates to the current queue, the updates will be lost whenever an already
12963// in-progress queue commits and swaps with the current queue. However, by
12964// adding to both queues, we guarantee that the update will be part of the next
12965// work-in-progress. (And because the work-in-progress queue becomes the
12966// current queue once it commits, there's no danger of applying the same
12967// update twice.)
12968//
12969// Prioritization
12970// --------------
12971//
12972// Updates are not sorted by priority, but by insertion; new updates are always
12973// appended to the end of the list.
12974//
12975// The priority is still important, though. When processing the update queue
12976// during the render phase, only the updates with sufficient priority are
12977// included in the result. If we skip an update because it has insufficient
12978// priority, it remains in the queue to be processed later, during a lower
12979// priority render. Crucially, all updates subsequent to a skipped update also
12980// remain in the queue *regardless of their priority*. That means high priority
12981// updates are sometimes processed twice, at two separate priorities. We also
12982// keep track of a base state, that represents the state before the first
12983// update in the queue is applied.
12984//
12985// For example:
12986//
12987// Given a base state of '', and the following queue of updates
12988//
12989// A1 - B2 - C1 - D2
12990//
12991// where the number indicates the priority, and the update is applied to the
12992// previous state by appending a letter, React will process these updates as
12993// two separate renders, one per distinct priority level:
12994//
12995// First render, at priority 1:
12996// Base state: ''
12997// Updates: [A1, C1]
12998// Result state: 'AC'
12999//
13000// Second render, at priority 2:
13001// Base state: 'A' <- The base state does not include C1,
13002// because B2 was skipped.
13003// Updates: [B2, C1, D2] <- C1 was rebased on top of B2
13004// Result state: 'ABCD'
13005//
13006// Because we process updates in insertion order, and rebase high priority
13007// updates when preceding updates are skipped, the final result is deterministic
13008// regardless of priority. Intermediate state may vary according to system
13009// resources, but the final state is always the same.
13010
13011var UpdateState = 0;
13012var ReplaceState = 1;
13013var ForceUpdate = 2;
13014var CaptureUpdate = 3;
13015
13016// Global state that is reset at the beginning of calling `processUpdateQueue`.
13017// It should only be read right after calling `processUpdateQueue`, via
13018// `checkHasForceUpdateAfterProcessing`.
13019var hasForceUpdate = false;
13020
13021var didWarnUpdateInsideUpdate = void 0;
13022var currentlyProcessingQueue = void 0;
13023var resetCurrentlyProcessingQueue = void 0;
13024{
13025 didWarnUpdateInsideUpdate = false;
13026 currentlyProcessingQueue = null;
13027 resetCurrentlyProcessingQueue = function () {
13028 currentlyProcessingQueue = null;
13029 };
13030}
13031
13032function createUpdateQueue(baseState) {
13033 var queue = {
13034 baseState: baseState,
13035 firstUpdate: null,
13036 lastUpdate: null,
13037 firstCapturedUpdate: null,
13038 lastCapturedUpdate: null,
13039 firstEffect: null,
13040 lastEffect: null,
13041 firstCapturedEffect: null,
13042 lastCapturedEffect: null
13043 };
13044 return queue;
13045}
13046
13047function cloneUpdateQueue(currentQueue) {
13048 var queue = {
13049 baseState: currentQueue.baseState,
13050 firstUpdate: currentQueue.firstUpdate,
13051 lastUpdate: currentQueue.lastUpdate,
13052
13053 // TODO: With resuming, if we bail out and resuse the child tree, we should
13054 // keep these effects.
13055 firstCapturedUpdate: null,
13056 lastCapturedUpdate: null,
13057
13058 firstEffect: null,
13059 lastEffect: null,
13060
13061 firstCapturedEffect: null,
13062 lastCapturedEffect: null
13063 };
13064 return queue;
13065}
13066
13067function createUpdate(expirationTime) {
13068 return {
13069 expirationTime: expirationTime,
13070
13071 tag: UpdateState,
13072 payload: null,
13073 callback: null,
13074
13075 next: null,
13076 nextEffect: null
13077 };
13078}
13079
13080function appendUpdateToQueue(queue, update) {
13081 // Append the update to the end of the list.
13082 if (queue.lastUpdate === null) {
13083 // Queue is empty
13084 queue.firstUpdate = queue.lastUpdate = update;
13085 } else {
13086 queue.lastUpdate.next = update;
13087 queue.lastUpdate = update;
13088 }
13089}
13090
13091function enqueueUpdate(fiber, update) {
13092 // Update queues are created lazily.
13093 var alternate = fiber.alternate;
13094 var queue1 = void 0;
13095 var queue2 = void 0;
13096 if (alternate === null) {
13097 // There's only one fiber.
13098 queue1 = fiber.updateQueue;
13099 queue2 = null;
13100 if (queue1 === null) {
13101 queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
13102 }
13103 } else {
13104 // There are two owners.
13105 queue1 = fiber.updateQueue;
13106 queue2 = alternate.updateQueue;
13107 if (queue1 === null) {
13108 if (queue2 === null) {
13109 // Neither fiber has an update queue. Create new ones.
13110 queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
13111 queue2 = alternate.updateQueue = createUpdateQueue(alternate.memoizedState);
13112 } else {
13113 // Only one fiber has an update queue. Clone to create a new one.
13114 queue1 = fiber.updateQueue = cloneUpdateQueue(queue2);
13115 }
13116 } else {
13117 if (queue2 === null) {
13118 // Only one fiber has an update queue. Clone to create a new one.
13119 queue2 = alternate.updateQueue = cloneUpdateQueue(queue1);
13120 } else {
13121 // Both owners have an update queue.
13122 }
13123 }
13124 }
13125 if (queue2 === null || queue1 === queue2) {
13126 // There's only a single queue.
13127 appendUpdateToQueue(queue1, update);
13128 } else {
13129 // There are two queues. We need to append the update to both queues,
13130 // while accounting for the persistent structure of the list — we don't
13131 // want the same update to be added multiple times.
13132 if (queue1.lastUpdate === null || queue2.lastUpdate === null) {
13133 // One of the queues is not empty. We must add the update to both queues.
13134 appendUpdateToQueue(queue1, update);
13135 appendUpdateToQueue(queue2, update);
13136 } else {
13137 // Both queues are non-empty. The last update is the same in both lists,
13138 // because of structural sharing. So, only append to one of the lists.
13139 appendUpdateToQueue(queue1, update);
13140 // But we still need to update the `lastUpdate` pointer of queue2.
13141 queue2.lastUpdate = update;
13142 }
13143 }
13144
13145 {
13146 if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
13147 warningWithoutStack$1(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.');
13148 didWarnUpdateInsideUpdate = true;
13149 }
13150 }
13151}
13152
13153function enqueueCapturedUpdate(workInProgress, update) {
13154 // Captured updates go into a separate list, and only on the work-in-
13155 // progress queue.
13156 var workInProgressQueue = workInProgress.updateQueue;
13157 if (workInProgressQueue === null) {
13158 workInProgressQueue = workInProgress.updateQueue = createUpdateQueue(workInProgress.memoizedState);
13159 } else {
13160 // TODO: I put this here rather than createWorkInProgress so that we don't
13161 // clone the queue unnecessarily. There's probably a better way to
13162 // structure this.
13163 workInProgressQueue = ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue);
13164 }
13165
13166 // Append the update to the end of the list.
13167 if (workInProgressQueue.lastCapturedUpdate === null) {
13168 // This is the first render phase update
13169 workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update;
13170 } else {
13171 workInProgressQueue.lastCapturedUpdate.next = update;
13172 workInProgressQueue.lastCapturedUpdate = update;
13173 }
13174}
13175
13176function ensureWorkInProgressQueueIsAClone(workInProgress, queue) {
13177 var current = workInProgress.alternate;
13178 if (current !== null) {
13179 // If the work-in-progress queue is equal to the current queue,
13180 // we need to clone it first.
13181 if (queue === current.updateQueue) {
13182 queue = workInProgress.updateQueue = cloneUpdateQueue(queue);
13183 }
13184 }
13185 return queue;
13186}
13187
13188function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) {
13189 switch (update.tag) {
13190 case ReplaceState:
13191 {
13192 var _payload = update.payload;
13193 if (typeof _payload === 'function') {
13194 // Updater function
13195 {
13196 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
13197 _payload.call(instance, prevState, nextProps);
13198 }
13199 }
13200 return _payload.call(instance, prevState, nextProps);
13201 }
13202 // State object
13203 return _payload;
13204 }
13205 case CaptureUpdate:
13206 {
13207 workInProgress.effectTag = workInProgress.effectTag & ~ShouldCapture | DidCapture;
13208 }
13209 // Intentional fallthrough
13210 case UpdateState:
13211 {
13212 var _payload2 = update.payload;
13213 var partialState = void 0;
13214 if (typeof _payload2 === 'function') {
13215 // Updater function
13216 {
13217 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
13218 _payload2.call(instance, prevState, nextProps);
13219 }
13220 }
13221 partialState = _payload2.call(instance, prevState, nextProps);
13222 } else {
13223 // Partial state object
13224 partialState = _payload2;
13225 }
13226 if (partialState === null || partialState === undefined) {
13227 // Null and undefined are treated as no-ops.
13228 return prevState;
13229 }
13230 // Merge the partial state and the previous state.
13231 return _assign({}, prevState, partialState);
13232 }
13233 case ForceUpdate:
13234 {
13235 hasForceUpdate = true;
13236 return prevState;
13237 }
13238 }
13239 return prevState;
13240}
13241
13242function processUpdateQueue(workInProgress, queue, props, instance, renderExpirationTime) {
13243 hasForceUpdate = false;
13244
13245 queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue);
13246
13247 {
13248 currentlyProcessingQueue = queue;
13249 }
13250
13251 // These values may change as we process the queue.
13252 var newBaseState = queue.baseState;
13253 var newFirstUpdate = null;
13254 var newExpirationTime = NoWork;
13255
13256 // Iterate through the list of updates to compute the result.
13257 var update = queue.firstUpdate;
13258 var resultState = newBaseState;
13259 while (update !== null) {
13260 var updateExpirationTime = update.expirationTime;
13261 if (updateExpirationTime < renderExpirationTime) {
13262 // This update does not have sufficient priority. Skip it.
13263 if (newFirstUpdate === null) {
13264 // This is the first skipped update. It will be the first update in
13265 // the new list.
13266 newFirstUpdate = update;
13267 // Since this is the first update that was skipped, the current result
13268 // is the new base state.
13269 newBaseState = resultState;
13270 }
13271 // Since this update will remain in the list, update the remaining
13272 // expiration time.
13273 if (newExpirationTime < updateExpirationTime) {
13274 newExpirationTime = updateExpirationTime;
13275 }
13276 } else {
13277 // This update does have sufficient priority. Process it and compute
13278 // a new result.
13279 resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
13280 var _callback = update.callback;
13281 if (_callback !== null) {
13282 workInProgress.effectTag |= Callback;
13283 // Set this to null, in case it was mutated during an aborted render.
13284 update.nextEffect = null;
13285 if (queue.lastEffect === null) {
13286 queue.firstEffect = queue.lastEffect = update;
13287 } else {
13288 queue.lastEffect.nextEffect = update;
13289 queue.lastEffect = update;
13290 }
13291 }
13292 }
13293 // Continue to the next update.
13294 update = update.next;
13295 }
13296
13297 // Separately, iterate though the list of captured updates.
13298 var newFirstCapturedUpdate = null;
13299 update = queue.firstCapturedUpdate;
13300 while (update !== null) {
13301 var _updateExpirationTime = update.expirationTime;
13302 if (_updateExpirationTime < renderExpirationTime) {
13303 // This update does not have sufficient priority. Skip it.
13304 if (newFirstCapturedUpdate === null) {
13305 // This is the first skipped captured update. It will be the first
13306 // update in the new list.
13307 newFirstCapturedUpdate = update;
13308 // If this is the first update that was skipped, the current result is
13309 // the new base state.
13310 if (newFirstUpdate === null) {
13311 newBaseState = resultState;
13312 }
13313 }
13314 // Since this update will remain in the list, update the remaining
13315 // expiration time.
13316 if (newExpirationTime < _updateExpirationTime) {
13317 newExpirationTime = _updateExpirationTime;
13318 }
13319 } else {
13320 // This update does have sufficient priority. Process it and compute
13321 // a new result.
13322 resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
13323 var _callback2 = update.callback;
13324 if (_callback2 !== null) {
13325 workInProgress.effectTag |= Callback;
13326 // Set this to null, in case it was mutated during an aborted render.
13327 update.nextEffect = null;
13328 if (queue.lastCapturedEffect === null) {
13329 queue.firstCapturedEffect = queue.lastCapturedEffect = update;
13330 } else {
13331 queue.lastCapturedEffect.nextEffect = update;
13332 queue.lastCapturedEffect = update;
13333 }
13334 }
13335 }
13336 update = update.next;
13337 }
13338
13339 if (newFirstUpdate === null) {
13340 queue.lastUpdate = null;
13341 }
13342 if (newFirstCapturedUpdate === null) {
13343 queue.lastCapturedUpdate = null;
13344 } else {
13345 workInProgress.effectTag |= Callback;
13346 }
13347 if (newFirstUpdate === null && newFirstCapturedUpdate === null) {
13348 // We processed every update, without skipping. That means the new base
13349 // state is the same as the result state.
13350 newBaseState = resultState;
13351 }
13352
13353 queue.baseState = newBaseState;
13354 queue.firstUpdate = newFirstUpdate;
13355 queue.firstCapturedUpdate = newFirstCapturedUpdate;
13356
13357 // Set the remaining expiration time to be whatever is remaining in the queue.
13358 // This should be fine because the only two other things that contribute to
13359 // expiration time are props and context. We're already in the middle of the
13360 // begin phase by the time we start processing the queue, so we've already
13361 // dealt with the props. Context in components that specify
13362 // shouldComponentUpdate is tricky; but we'll have to account for
13363 // that regardless.
13364 workInProgress.expirationTime = newExpirationTime;
13365 workInProgress.memoizedState = resultState;
13366
13367 {
13368 currentlyProcessingQueue = null;
13369 }
13370}
13371
13372function callCallback(callback, context) {
13373 !(typeof callback === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', callback) : void 0;
13374 callback.call(context);
13375}
13376
13377function resetHasForceUpdateBeforeProcessing() {
13378 hasForceUpdate = false;
13379}
13380
13381function checkHasForceUpdateAfterProcessing() {
13382 return hasForceUpdate;
13383}
13384
13385function commitUpdateQueue(finishedWork, finishedQueue, instance, renderExpirationTime) {
13386 // If the finished render included captured updates, and there are still
13387 // lower priority updates left over, we need to keep the captured updates
13388 // in the queue so that they are rebased and not dropped once we process the
13389 // queue again at the lower priority.
13390 if (finishedQueue.firstCapturedUpdate !== null) {
13391 // Join the captured update list to the end of the normal list.
13392 if (finishedQueue.lastUpdate !== null) {
13393 finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate;
13394 finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate;
13395 }
13396 // Clear the list of captured updates.
13397 finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null;
13398 }
13399
13400 // Commit the effects
13401 commitUpdateEffects(finishedQueue.firstEffect, instance);
13402 finishedQueue.firstEffect = finishedQueue.lastEffect = null;
13403
13404 commitUpdateEffects(finishedQueue.firstCapturedEffect, instance);
13405 finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null;
13406}
13407
13408function commitUpdateEffects(effect, instance) {
13409 while (effect !== null) {
13410 var _callback3 = effect.callback;
13411 if (_callback3 !== null) {
13412 effect.callback = null;
13413 callCallback(_callback3, instance);
13414 }
13415 effect = effect.nextEffect;
13416 }
13417}
13418
13419function createCapturedValue(value, source) {
13420 // If the value is an error, call this function immediately after it is thrown
13421 // so the stack is accurate.
13422 return {
13423 value: value,
13424 source: source,
13425 stack: getStackByFiberInDevAndProd(source)
13426 };
13427}
13428
13429var valueCursor = createCursor(null);
13430
13431var rendererSigil = void 0;
13432{
13433 // Use this to detect multiple renderers using the same context
13434 rendererSigil = {};
13435}
13436
13437var currentlyRenderingFiber = null;
13438var lastContextDependency = null;
13439var lastContextWithAllBitsObserved = null;
13440
13441function resetContextDependences() {
13442 // This is called right before React yields execution, to ensure `readContext`
13443 // cannot be called outside the render phase.
13444 currentlyRenderingFiber = null;
13445 lastContextDependency = null;
13446 lastContextWithAllBitsObserved = null;
13447}
13448
13449function pushProvider(providerFiber, nextValue) {
13450 var context = providerFiber.type._context;
13451
13452 if (isPrimaryRenderer) {
13453 push(valueCursor, context._currentValue, providerFiber);
13454
13455 context._currentValue = nextValue;
13456 {
13457 !(context._currentRenderer === undefined || context._currentRenderer === null || context._currentRenderer === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
13458 context._currentRenderer = rendererSigil;
13459 }
13460 } else {
13461 push(valueCursor, context._currentValue2, providerFiber);
13462
13463 context._currentValue2 = nextValue;
13464 {
13465 !(context._currentRenderer2 === undefined || context._currentRenderer2 === null || context._currentRenderer2 === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
13466 context._currentRenderer2 = rendererSigil;
13467 }
13468 }
13469}
13470
13471function popProvider(providerFiber) {
13472 var currentValue = valueCursor.current;
13473
13474 pop(valueCursor, providerFiber);
13475
13476 var context = providerFiber.type._context;
13477 if (isPrimaryRenderer) {
13478 context._currentValue = currentValue;
13479 } else {
13480 context._currentValue2 = currentValue;
13481 }
13482}
13483
13484function calculateChangedBits(context, newValue, oldValue) {
13485 // Use Object.is to compare the new context value to the old value. Inlined
13486 // Object.is polyfill.
13487 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
13488 if (oldValue === newValue && (oldValue !== 0 || 1 / oldValue === 1 / newValue) || oldValue !== oldValue && newValue !== newValue // eslint-disable-line no-self-compare
13489 ) {
13490 // No change
13491 return 0;
13492 } else {
13493 var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : maxSigned31BitInt;
13494
13495 {
13496 !((changedBits & maxSigned31BitInt) === changedBits) ? warning$1(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
13497 }
13498 return changedBits | 0;
13499 }
13500}
13501
13502function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
13503 var fiber = workInProgress.child;
13504 if (fiber !== null) {
13505 // Set the return pointer of the child to the work-in-progress fiber.
13506 fiber.return = workInProgress;
13507 }
13508 while (fiber !== null) {
13509 var nextFiber = void 0;
13510
13511 // Visit this fiber.
13512 var dependency = fiber.firstContextDependency;
13513 if (dependency !== null) {
13514 do {
13515 // Check if the context matches.
13516 if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
13517 // Match! Schedule an update on this fiber.
13518
13519 if (fiber.tag === ClassComponent) {
13520 // Schedule a force update on the work-in-progress.
13521 var update = createUpdate(renderExpirationTime);
13522 update.tag = ForceUpdate;
13523 // TODO: Because we don't have a work-in-progress, this will add the
13524 // update to the current fiber, too, which means it will persist even if
13525 // this render is thrown away. Since it's a race condition, not sure it's
13526 // worth fixing.
13527 enqueueUpdate(fiber, update);
13528 }
13529
13530 if (fiber.expirationTime < renderExpirationTime) {
13531 fiber.expirationTime = renderExpirationTime;
13532 }
13533 var alternate = fiber.alternate;
13534 if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
13535 alternate.expirationTime = renderExpirationTime;
13536 }
13537 // Update the child expiration time of all the ancestors, including
13538 // the alternates.
13539 var node = fiber.return;
13540 while (node !== null) {
13541 alternate = node.alternate;
13542 if (node.childExpirationTime < renderExpirationTime) {
13543 node.childExpirationTime = renderExpirationTime;
13544 if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
13545 alternate.childExpirationTime = renderExpirationTime;
13546 }
13547 } else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
13548 alternate.childExpirationTime = renderExpirationTime;
13549 } else {
13550 // Neither alternate was updated, which means the rest of the
13551 // ancestor path already has sufficient priority.
13552 break;
13553 }
13554 node = node.return;
13555 }
13556 }
13557 nextFiber = fiber.child;
13558 dependency = dependency.next;
13559 } while (dependency !== null);
13560 } else if (fiber.tag === ContextProvider) {
13561 // Don't scan deeper if this is a matching provider
13562 nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
13563 } else {
13564 // Traverse down.
13565 nextFiber = fiber.child;
13566 }
13567
13568 if (nextFiber !== null) {
13569 // Set the return pointer of the child to the work-in-progress fiber.
13570 nextFiber.return = fiber;
13571 } else {
13572 // No child. Traverse to next sibling.
13573 nextFiber = fiber;
13574 while (nextFiber !== null) {
13575 if (nextFiber === workInProgress) {
13576 // We're back to the root of this subtree. Exit.
13577 nextFiber = null;
13578 break;
13579 }
13580 var sibling = nextFiber.sibling;
13581 if (sibling !== null) {
13582 // Set the return pointer of the sibling to the work-in-progress fiber.
13583 sibling.return = nextFiber.return;
13584 nextFiber = sibling;
13585 break;
13586 }
13587 // No more siblings. Traverse up.
13588 nextFiber = nextFiber.return;
13589 }
13590 }
13591 fiber = nextFiber;
13592 }
13593}
13594
13595function prepareToReadContext(workInProgress, renderExpirationTime) {
13596 currentlyRenderingFiber = workInProgress;
13597 lastContextDependency = null;
13598 lastContextWithAllBitsObserved = null;
13599
13600 // Reset the work-in-progress list
13601 workInProgress.firstContextDependency = null;
13602}
13603
13604function readContext(context, observedBits) {
13605 if (lastContextWithAllBitsObserved === context) {
13606 // Nothing to do. We already observe everything in this context.
13607 } else if (observedBits === false || observedBits === 0) {
13608 // Do not observe any updates.
13609 } else {
13610 var resolvedObservedBits = void 0; // Avoid deopting on observable arguments or heterogeneous types.
13611 if (typeof observedBits !== 'number' || observedBits === maxSigned31BitInt) {
13612 // Observe all updates.
13613 lastContextWithAllBitsObserved = context;
13614 resolvedObservedBits = maxSigned31BitInt;
13615 } else {
13616 resolvedObservedBits = observedBits;
13617 }
13618
13619 var contextItem = {
13620 context: context,
13621 observedBits: resolvedObservedBits,
13622 next: null
13623 };
13624
13625 if (lastContextDependency === null) {
13626 !(currentlyRenderingFiber !== null) ? invariant(false, 'Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
13627 // This is the first dependency in the list
13628 currentlyRenderingFiber.firstContextDependency = lastContextDependency = contextItem;
13629 } else {
13630 // Append a new context item.
13631 lastContextDependency = lastContextDependency.next = contextItem;
13632 }
13633 }
13634 return isPrimaryRenderer ? context._currentValue : context._currentValue2;
13635}
13636
13637var NoEffect$1 = /* */0;
13638var UnmountSnapshot = /* */2;
13639var UnmountMutation = /* */4;
13640var MountMutation = /* */8;
13641var UnmountLayout = /* */16;
13642var MountLayout = /* */32;
13643var MountPassive = /* */64;
13644var UnmountPassive = /* */128;
13645
13646function areHookInputsEqual(arr1, arr2) {
13647 // Don't bother comparing lengths in prod because these arrays should be
13648 // passed inline.
13649 {
13650 !(arr1.length === arr2.length) ? warning$1(false, 'Detected a variable number of hook dependencies. The length of the ' + 'dependencies array should be constant between renders.\n\n' + 'Previous: %s\n' + 'Incoming: %s', arr1.join(', '), arr2.join(', ')) : void 0;
13651 }
13652 for (var i = 0; i < arr1.length; i++) {
13653 // Inlined Object.is polyfill.
13654 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
13655 var val1 = arr1[i];
13656 var val2 = arr2[i];
13657 if (val1 === val2 && (val1 !== 0 || 1 / val1 === 1 / val2) || val1 !== val1 && val2 !== val2 // eslint-disable-line no-self-compare
13658 ) {
13659 continue;
13660 }
13661 return false;
13662 }
13663 return true;
13664}
13665
13666// These are set right before calling the component.
13667var renderExpirationTime = NoWork;
13668// The work-in-progress fiber. I've named it differently to distinguish it from
13669// the work-in-progress hook.
13670var currentlyRenderingFiber$1 = null;
13671
13672// Hooks are stored as a linked list on the fiber's memoizedState field. The
13673// current hook list is the list that belongs to the current fiber. The
13674// work-in-progress hook list is a new list that will be added to the
13675// work-in-progress fiber.
13676var firstCurrentHook = null;
13677var currentHook = null;
13678var firstWorkInProgressHook = null;
13679var workInProgressHook = null;
13680
13681var remainingExpirationTime = NoWork;
13682var componentUpdateQueue = null;
13683
13684// Updates scheduled during render will trigger an immediate re-render at the
13685// end of the current pass. We can't store these updates on the normal queue,
13686// because if the work is aborted, they should be discarded. Because this is
13687// a relatively rare case, we also don't want to add an additional field to
13688// either the hook or queue object types. So we store them in a lazily create
13689// map of queue -> render-phase updates, which are discarded once the component
13690// completes without re-rendering.
13691
13692// Whether the work-in-progress hook is a re-rendered hook
13693var isReRender = false;
13694// Whether an update was scheduled during the currently executing render pass.
13695var didScheduleRenderPhaseUpdate = false;
13696// Lazily created map of render-phase updates
13697var renderPhaseUpdates = null;
13698// Counter to prevent infinite loops.
13699var numberOfReRenders = 0;
13700var RE_RENDER_LIMIT = 25;
13701
13702function resolveCurrentlyRenderingFiber() {
13703 !(currentlyRenderingFiber$1 !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
13704 return currentlyRenderingFiber$1;
13705}
13706
13707function prepareToUseHooks(current, workInProgress, nextRenderExpirationTime) {
13708 if (!enableHooks) {
13709 return;
13710 }
13711 renderExpirationTime = nextRenderExpirationTime;
13712 currentlyRenderingFiber$1 = workInProgress;
13713 firstCurrentHook = current !== null ? current.memoizedState : null;
13714
13715 // The following should have already been reset
13716 // currentHook = null;
13717 // workInProgressHook = null;
13718
13719 // remainingExpirationTime = NoWork;
13720 // componentUpdateQueue = null;
13721
13722 // isReRender = false;
13723 // didScheduleRenderPhaseUpdate = false;
13724 // renderPhaseUpdates = null;
13725 // numberOfReRenders = 0;
13726}
13727
13728function finishHooks(Component, props, children, refOrContext) {
13729 if (!enableHooks) {
13730 return children;
13731 }
13732
13733 // This must be called after every function component to prevent hooks from
13734 // being used in classes.
13735
13736 while (didScheduleRenderPhaseUpdate) {
13737 // Updates were scheduled during the render phase. They are stored in
13738 // the `renderPhaseUpdates` map. Call the component again, reusing the
13739 // work-in-progress hooks and applying the additional updates on top. Keep
13740 // restarting until no more updates are scheduled.
13741 didScheduleRenderPhaseUpdate = false;
13742 numberOfReRenders += 1;
13743
13744 // Start over from the beginning of the list
13745 currentHook = null;
13746 workInProgressHook = null;
13747 componentUpdateQueue = null;
13748
13749 children = Component(props, refOrContext);
13750 }
13751 renderPhaseUpdates = null;
13752 numberOfReRenders = 0;
13753
13754 var renderedWork = currentlyRenderingFiber$1;
13755
13756 renderedWork.memoizedState = firstWorkInProgressHook;
13757 renderedWork.expirationTime = remainingExpirationTime;
13758 renderedWork.updateQueue = componentUpdateQueue;
13759
13760 var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
13761
13762 renderExpirationTime = NoWork;
13763 currentlyRenderingFiber$1 = null;
13764
13765 firstCurrentHook = null;
13766 currentHook = null;
13767 firstWorkInProgressHook = null;
13768 workInProgressHook = null;
13769
13770 remainingExpirationTime = NoWork;
13771 componentUpdateQueue = null;
13772
13773 // Always set during createWorkInProgress
13774 // isReRender = false;
13775
13776 // These were reset above
13777 // didScheduleRenderPhaseUpdate = false;
13778 // renderPhaseUpdates = null;
13779 // numberOfReRenders = 0;
13780
13781 !!didRenderTooFewHooks ? invariant(false, 'Rendered fewer hooks than expected. This may be caused by an accidental early return statement.') : void 0;
13782
13783 return children;
13784}
13785
13786function resetHooks() {
13787 if (!enableHooks) {
13788 return;
13789 }
13790
13791 // This is called instead of `finishHooks` if the component throws. It's also
13792 // called inside mountIndeterminateComponent if we determine the component
13793 // is a module-style component.
13794 renderExpirationTime = NoWork;
13795 currentlyRenderingFiber$1 = null;
13796
13797 firstCurrentHook = null;
13798 currentHook = null;
13799 firstWorkInProgressHook = null;
13800 workInProgressHook = null;
13801
13802 remainingExpirationTime = NoWork;
13803 componentUpdateQueue = null;
13804
13805 // Always set during createWorkInProgress
13806 // isReRender = false;
13807
13808 didScheduleRenderPhaseUpdate = false;
13809 renderPhaseUpdates = null;
13810 numberOfReRenders = 0;
13811}
13812
13813function createHook() {
13814 return {
13815 memoizedState: null,
13816
13817 baseState: null,
13818 queue: null,
13819 baseUpdate: null,
13820
13821 next: null
13822 };
13823}
13824
13825function cloneHook(hook) {
13826 return {
13827 memoizedState: hook.memoizedState,
13828
13829 baseState: hook.baseState,
13830 queue: hook.queue,
13831 baseUpdate: hook.baseUpdate,
13832
13833 next: null
13834 };
13835}
13836
13837function createWorkInProgressHook() {
13838 if (workInProgressHook === null) {
13839 // This is the first hook in the list
13840 if (firstWorkInProgressHook === null) {
13841 isReRender = false;
13842 currentHook = firstCurrentHook;
13843 if (currentHook === null) {
13844 // This is a newly mounted hook
13845 workInProgressHook = createHook();
13846 } else {
13847 // Clone the current hook.
13848 workInProgressHook = cloneHook(currentHook);
13849 }
13850 firstWorkInProgressHook = workInProgressHook;
13851 } else {
13852 // There's already a work-in-progress. Reuse it.
13853 isReRender = true;
13854 currentHook = firstCurrentHook;
13855 workInProgressHook = firstWorkInProgressHook;
13856 }
13857 } else {
13858 if (workInProgressHook.next === null) {
13859 isReRender = false;
13860 var hook = void 0;
13861 if (currentHook === null) {
13862 // This is a newly mounted hook
13863 hook = createHook();
13864 } else {
13865 currentHook = currentHook.next;
13866 if (currentHook === null) {
13867 // This is a newly mounted hook
13868 hook = createHook();
13869 } else {
13870 // Clone the current hook.
13871 hook = cloneHook(currentHook);
13872 }
13873 }
13874 // Append to the end of the list
13875 workInProgressHook = workInProgressHook.next = hook;
13876 } else {
13877 // There's already a work-in-progress. Reuse it.
13878 isReRender = true;
13879 workInProgressHook = workInProgressHook.next;
13880 currentHook = currentHook !== null ? currentHook.next : null;
13881 }
13882 }
13883 return workInProgressHook;
13884}
13885
13886function createFunctionComponentUpdateQueue() {
13887 return {
13888 lastEffect: null
13889 };
13890}
13891
13892function basicStateReducer(state, action) {
13893 return typeof action === 'function' ? action(state) : action;
13894}
13895
13896function useContext(context, observedBits) {
13897 // Ensure we're in a function component (class components support only the
13898 // .unstable_read() form)
13899 resolveCurrentlyRenderingFiber();
13900 return readContext(context, observedBits);
13901}
13902
13903function useState(initialState) {
13904 return useReducer(basicStateReducer,
13905 // useReducer has a special case to support lazy useState initializers
13906 initialState);
13907}
13908
13909function useReducer(reducer, initialState, initialAction) {
13910 currentlyRenderingFiber$1 = resolveCurrentlyRenderingFiber();
13911 workInProgressHook = createWorkInProgressHook();
13912 var queue = workInProgressHook.queue;
13913 if (queue !== null) {
13914 // Already have a queue, so this is an update.
13915 if (isReRender) {
13916 // This is a re-render. Apply the new render phase updates to the previous
13917 var _dispatch2 = queue.dispatch;
13918 if (renderPhaseUpdates !== null) {
13919 // Render phase updates are stored in a map of queue -> linked list
13920 var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
13921 if (firstRenderPhaseUpdate !== undefined) {
13922 renderPhaseUpdates.delete(queue);
13923 var newState = workInProgressHook.memoizedState;
13924 var update = firstRenderPhaseUpdate;
13925 do {
13926 // Process this render phase update. We don't have to check the
13927 // priority because it will always be the same as the current
13928 // render's.
13929 var _action = update.action;
13930 newState = reducer(newState, _action);
13931 update = update.next;
13932 } while (update !== null);
13933
13934 workInProgressHook.memoizedState = newState;
13935
13936 // Don't persist the state accumlated from the render phase updates to
13937 // the base state unless the queue is empty.
13938 // TODO: Not sure if this is the desired semantics, but it's what we
13939 // do for gDSFP. I can't remember why.
13940 if (workInProgressHook.baseUpdate === queue.last) {
13941 workInProgressHook.baseState = newState;
13942 }
13943
13944 return [newState, _dispatch2];
13945 }
13946 }
13947 return [workInProgressHook.memoizedState, _dispatch2];
13948 }
13949
13950 // The last update in the entire queue
13951 var _last = queue.last;
13952 // The last update that is part of the base state.
13953 var _baseUpdate = workInProgressHook.baseUpdate;
13954
13955 // Find the first unprocessed update.
13956 var first = void 0;
13957 if (_baseUpdate !== null) {
13958 if (_last !== null) {
13959 // For the first update, the queue is a circular linked list where
13960 // `queue.last.next = queue.first`. Once the first update commits, and
13961 // the `baseUpdate` is no longer empty, we can unravel the list.
13962 _last.next = null;
13963 }
13964 first = _baseUpdate.next;
13965 } else {
13966 first = _last !== null ? _last.next : null;
13967 }
13968 if (first !== null) {
13969 var _newState = workInProgressHook.baseState;
13970 var newBaseState = null;
13971 var newBaseUpdate = null;
13972 var prevUpdate = _baseUpdate;
13973 var _update = first;
13974 var didSkip = false;
13975 do {
13976 var updateExpirationTime = _update.expirationTime;
13977 if (updateExpirationTime < renderExpirationTime) {
13978 // Priority is insufficient. Skip this update. If this is the first
13979 // skipped update, the previous update/state is the new base
13980 // update/state.
13981 if (!didSkip) {
13982 didSkip = true;
13983 newBaseUpdate = prevUpdate;
13984 newBaseState = _newState;
13985 }
13986 // Update the remaining priority in the queue.
13987 if (updateExpirationTime > remainingExpirationTime) {
13988 remainingExpirationTime = updateExpirationTime;
13989 }
13990 } else {
13991 // Process this update.
13992 var _action2 = _update.action;
13993 _newState = reducer(_newState, _action2);
13994 }
13995 prevUpdate = _update;
13996 _update = _update.next;
13997 } while (_update !== null && _update !== first);
13998
13999 if (!didSkip) {
14000 newBaseUpdate = prevUpdate;
14001 newBaseState = _newState;
14002 }
14003
14004 workInProgressHook.memoizedState = _newState;
14005 workInProgressHook.baseUpdate = newBaseUpdate;
14006 workInProgressHook.baseState = newBaseState;
14007 }
14008
14009 var _dispatch = queue.dispatch;
14010 return [workInProgressHook.memoizedState, _dispatch];
14011 }
14012
14013 // There's no existing queue, so this is the initial render.
14014 if (reducer === basicStateReducer) {
14015 // Special case for `useState`.
14016 if (typeof initialState === 'function') {
14017 initialState = initialState();
14018 }
14019 } else if (initialAction !== undefined && initialAction !== null) {
14020 initialState = reducer(initialState, initialAction);
14021 }
14022 workInProgressHook.memoizedState = workInProgressHook.baseState = initialState;
14023 queue = workInProgressHook.queue = {
14024 last: null,
14025 dispatch: null
14026 };
14027 var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue);
14028 return [workInProgressHook.memoizedState, dispatch];
14029}
14030
14031function pushEffect(tag, create, destroy, inputs) {
14032 var effect = {
14033 tag: tag,
14034 create: create,
14035 destroy: destroy,
14036 inputs: inputs,
14037 // Circular
14038 next: null
14039 };
14040 if (componentUpdateQueue === null) {
14041 componentUpdateQueue = createFunctionComponentUpdateQueue();
14042 componentUpdateQueue.lastEffect = effect.next = effect;
14043 } else {
14044 var _lastEffect = componentUpdateQueue.lastEffect;
14045 if (_lastEffect === null) {
14046 componentUpdateQueue.lastEffect = effect.next = effect;
14047 } else {
14048 var firstEffect = _lastEffect.next;
14049 _lastEffect.next = effect;
14050 effect.next = firstEffect;
14051 componentUpdateQueue.lastEffect = effect;
14052 }
14053 }
14054 return effect;
14055}
14056
14057function useRef(initialValue) {
14058 currentlyRenderingFiber$1 = resolveCurrentlyRenderingFiber();
14059 workInProgressHook = createWorkInProgressHook();
14060 var ref = void 0;
14061
14062 if (workInProgressHook.memoizedState === null) {
14063 ref = { current: initialValue };
14064 {
14065 Object.seal(ref);
14066 }
14067 workInProgressHook.memoizedState = ref;
14068 } else {
14069 ref = workInProgressHook.memoizedState;
14070 }
14071 return ref;
14072}
14073
14074function useLayoutEffect(create, inputs) {
14075 useEffectImpl(Update, UnmountMutation | MountLayout, create, inputs);
14076}
14077
14078function useEffect(create, inputs) {
14079 useEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, inputs);
14080}
14081
14082function useEffectImpl(fiberEffectTag, hookEffectTag, create, inputs) {
14083 currentlyRenderingFiber$1 = resolveCurrentlyRenderingFiber();
14084 workInProgressHook = createWorkInProgressHook();
14085
14086 var nextInputs = inputs !== undefined && inputs !== null ? inputs : [create];
14087 var destroy = null;
14088 if (currentHook !== null) {
14089 var prevEffect = currentHook.memoizedState;
14090 destroy = prevEffect.destroy;
14091 if (areHookInputsEqual(nextInputs, prevEffect.inputs)) {
14092 pushEffect(NoEffect$1, create, destroy, nextInputs);
14093 return;
14094 }
14095 }
14096
14097 currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
14098 workInProgressHook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextInputs);
14099}
14100
14101function useImperativeMethods(ref, create, inputs) {
14102 // TODO: If inputs are provided, should we skip comparing the ref itself?
14103 var nextInputs = inputs !== null && inputs !== undefined ? inputs.concat([ref]) : [ref, create];
14104
14105 // TODO: I've implemented this on top of useEffect because it's almost the
14106 // same thing, and it would require an equal amount of code. It doesn't seem
14107 // like a common enough use case to justify the additional size.
14108 useLayoutEffect(function () {
14109 if (typeof ref === 'function') {
14110 var refCallback = ref;
14111 var _inst = create();
14112 refCallback(_inst);
14113 return function () {
14114 return refCallback(null);
14115 };
14116 } else if (ref !== null && ref !== undefined) {
14117 var refObject = ref;
14118 var _inst2 = create();
14119 refObject.current = _inst2;
14120 return function () {
14121 refObject.current = null;
14122 };
14123 }
14124 }, nextInputs);
14125}
14126
14127function useCallback(callback, inputs) {
14128 currentlyRenderingFiber$1 = resolveCurrentlyRenderingFiber();
14129 workInProgressHook = createWorkInProgressHook();
14130
14131 var nextInputs = inputs !== undefined && inputs !== null ? inputs : [callback];
14132
14133 var prevState = workInProgressHook.memoizedState;
14134 if (prevState !== null) {
14135 var prevInputs = prevState[1];
14136 if (areHookInputsEqual(nextInputs, prevInputs)) {
14137 return prevState[0];
14138 }
14139 }
14140 workInProgressHook.memoizedState = [callback, nextInputs];
14141 return callback;
14142}
14143
14144function useMemo(nextCreate, inputs) {
14145 currentlyRenderingFiber$1 = resolveCurrentlyRenderingFiber();
14146 workInProgressHook = createWorkInProgressHook();
14147
14148 var nextInputs = inputs !== undefined && inputs !== null ? inputs : [nextCreate];
14149
14150 var prevState = workInProgressHook.memoizedState;
14151 if (prevState !== null) {
14152 var prevInputs = prevState[1];
14153 if (areHookInputsEqual(nextInputs, prevInputs)) {
14154 return prevState[0];
14155 }
14156 }
14157
14158 var nextValue = nextCreate();
14159 workInProgressHook.memoizedState = [nextValue, nextInputs];
14160 return nextValue;
14161}
14162
14163function dispatchAction(fiber, queue, action) {
14164 !(numberOfReRenders < RE_RENDER_LIMIT) ? invariant(false, 'Too many re-renders. React limits the number of renders to prevent an infinite loop.') : void 0;
14165
14166 var alternate = fiber.alternate;
14167 if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
14168 // This is a render phase update. Stash it in a lazily-created map of
14169 // queue -> linked list of updates. After this render pass, we'll restart
14170 // and apply the stashed updates on top of the work-in-progress hook.
14171 didScheduleRenderPhaseUpdate = true;
14172 var update = {
14173 expirationTime: renderExpirationTime,
14174 action: action,
14175 next: null
14176 };
14177 if (renderPhaseUpdates === null) {
14178 renderPhaseUpdates = new Map();
14179 }
14180 var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
14181 if (firstRenderPhaseUpdate === undefined) {
14182 renderPhaseUpdates.set(queue, update);
14183 } else {
14184 // Append the update to the end of the list.
14185 var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
14186 while (lastRenderPhaseUpdate.next !== null) {
14187 lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
14188 }
14189 lastRenderPhaseUpdate.next = update;
14190 }
14191 } else {
14192 var currentTime = requestCurrentTime();
14193 var _expirationTime = computeExpirationForFiber(currentTime, fiber);
14194 var _update2 = {
14195 expirationTime: _expirationTime,
14196 action: action,
14197 next: null
14198 };
14199 flushPassiveEffects();
14200 // Append the update to the end of the list.
14201 var _last2 = queue.last;
14202 if (_last2 === null) {
14203 // This is the first update. Create a circular list.
14204 _update2.next = _update2;
14205 } else {
14206 var first = _last2.next;
14207 if (first !== null) {
14208 // Still circular.
14209 _update2.next = first;
14210 }
14211 _last2.next = _update2;
14212 }
14213 queue.last = _update2;
14214 scheduleWork(fiber, _expirationTime);
14215 }
14216}
14217
14218var NO_CONTEXT = {};
14219
14220var contextStackCursor$1 = createCursor(NO_CONTEXT);
14221var contextFiberStackCursor = createCursor(NO_CONTEXT);
14222var rootInstanceStackCursor = createCursor(NO_CONTEXT);
14223
14224function requiredContext(c) {
14225 !(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;
14226 return c;
14227}
14228
14229function getRootHostContainer() {
14230 var rootInstance = requiredContext(rootInstanceStackCursor.current);
14231 return rootInstance;
14232}
14233
14234function pushHostContainer(fiber, nextRootInstance) {
14235 // Push current root instance onto the stack;
14236 // This allows us to reset root when portals are popped.
14237 push(rootInstanceStackCursor, nextRootInstance, fiber);
14238 // Track the context and the Fiber that provided it.
14239 // This enables us to pop only Fibers that provide unique contexts.
14240 push(contextFiberStackCursor, fiber, fiber);
14241
14242 // Finally, we need to push the host context to the stack.
14243 // However, we can't just call getRootHostContext() and push it because
14244 // we'd have a different number of entries on the stack depending on
14245 // whether getRootHostContext() throws somewhere in renderer code or not.
14246 // So we push an empty value first. This lets us safely unwind on errors.
14247 push(contextStackCursor$1, NO_CONTEXT, fiber);
14248 var nextRootContext = getRootHostContext(nextRootInstance);
14249 // Now that we know this function doesn't throw, replace it.
14250 pop(contextStackCursor$1, fiber);
14251 push(contextStackCursor$1, nextRootContext, fiber);
14252}
14253
14254function popHostContainer(fiber) {
14255 pop(contextStackCursor$1, fiber);
14256 pop(contextFiberStackCursor, fiber);
14257 pop(rootInstanceStackCursor, fiber);
14258}
14259
14260function getHostContext() {
14261 var context = requiredContext(contextStackCursor$1.current);
14262 return context;
14263}
14264
14265function pushHostContext(fiber) {
14266 var rootInstance = requiredContext(rootInstanceStackCursor.current);
14267 var context = requiredContext(contextStackCursor$1.current);
14268 var nextContext = getChildHostContext(context, fiber.type, rootInstance);
14269
14270 // Don't push this Fiber's context unless it's unique.
14271 if (context === nextContext) {
14272 return;
14273 }
14274
14275 // Track the context and the Fiber that provided it.
14276 // This enables us to pop only Fibers that provide unique contexts.
14277 push(contextFiberStackCursor, fiber, fiber);
14278 push(contextStackCursor$1, nextContext, fiber);
14279}
14280
14281function popHostContext(fiber) {
14282 // Do not pop unless this Fiber provided the current context.
14283 // pushHostContext() only pushes Fibers that provide unique contexts.
14284 if (contextFiberStackCursor.current !== fiber) {
14285 return;
14286 }
14287
14288 pop(contextStackCursor$1, fiber);
14289 pop(contextFiberStackCursor, fiber);
14290}
14291
14292var commitTime = 0;
14293var profilerStartTime = -1;
14294
14295function getCommitTime() {
14296 return commitTime;
14297}
14298
14299function recordCommitTime() {
14300 if (!enableProfilerTimer) {
14301 return;
14302 }
14303 commitTime = scheduler.unstable_now();
14304}
14305
14306function startProfilerTimer(fiber) {
14307 if (!enableProfilerTimer) {
14308 return;
14309 }
14310
14311 profilerStartTime = scheduler.unstable_now();
14312
14313 if (fiber.actualStartTime < 0) {
14314 fiber.actualStartTime = scheduler.unstable_now();
14315 }
14316}
14317
14318function stopProfilerTimerIfRunning(fiber) {
14319 if (!enableProfilerTimer) {
14320 return;
14321 }
14322 profilerStartTime = -1;
14323}
14324
14325function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
14326 if (!enableProfilerTimer) {
14327 return;
14328 }
14329
14330 if (profilerStartTime >= 0) {
14331 var elapsedTime = scheduler.unstable_now() - profilerStartTime;
14332 fiber.actualDuration += elapsedTime;
14333 if (overrideBaseTime) {
14334 fiber.selfBaseDuration = elapsedTime;
14335 }
14336 profilerStartTime = -1;
14337 }
14338}
14339
14340function resolveDefaultProps(Component, baseProps) {
14341 if (Component && Component.defaultProps) {
14342 // Resolve default props. Taken from ReactElement
14343 var props = _assign({}, baseProps);
14344 var defaultProps = Component.defaultProps;
14345 for (var propName in defaultProps) {
14346 if (props[propName] === undefined) {
14347 props[propName] = defaultProps[propName];
14348 }
14349 }
14350 return props;
14351 }
14352 return baseProps;
14353}
14354
14355function readLazyComponentType(lazyComponent) {
14356 var status = lazyComponent._status;
14357 var result = lazyComponent._result;
14358 switch (status) {
14359 case Resolved:
14360 {
14361 var Component = result;
14362 return Component;
14363 }
14364 case Rejected:
14365 {
14366 var error = result;
14367 throw error;
14368 }
14369 case Pending:
14370 {
14371 var thenable = result;
14372 throw thenable;
14373 }
14374 default:
14375 {
14376 lazyComponent._status = Pending;
14377 var ctor = lazyComponent._ctor;
14378 var _thenable = ctor();
14379 _thenable.then(function (moduleObject) {
14380 if (lazyComponent._status === Pending) {
14381 var defaultExport = moduleObject.default;
14382 {
14383 if (defaultExport === undefined) {
14384 warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
14385 }
14386 }
14387 lazyComponent._status = Resolved;
14388 lazyComponent._result = defaultExport;
14389 }
14390 }, function (error) {
14391 if (lazyComponent._status === Pending) {
14392 lazyComponent._status = Rejected;
14393 lazyComponent._result = error;
14394 }
14395 });
14396 lazyComponent._result = _thenable;
14397 throw _thenable;
14398 }
14399 }
14400}
14401
14402var ReactCurrentOwner$4 = ReactSharedInternals.ReactCurrentOwner;
14403
14404function readContext$1(contextType) {
14405 var dispatcher = ReactCurrentOwner$4.currentDispatcher;
14406 return dispatcher.readContext(contextType);
14407}
14408
14409var fakeInternalInstance = {};
14410var isArray$1 = Array.isArray;
14411
14412// React.Component uses a shared frozen object by default.
14413// We'll use it to determine whether we need to initialize legacy refs.
14414var emptyRefsObject = new React.Component().refs;
14415
14416var didWarnAboutStateAssignmentForComponent = void 0;
14417var didWarnAboutUninitializedState = void 0;
14418var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0;
14419var didWarnAboutLegacyLifecyclesAndDerivedState = void 0;
14420var didWarnAboutUndefinedDerivedState = void 0;
14421var warnOnUndefinedDerivedState = void 0;
14422var warnOnInvalidCallback$1 = void 0;
14423var didWarnAboutDirectlyAssigningPropsToState = void 0;
14424var didWarnAboutContextTypeAndContextTypes = void 0;
14425var didWarnAboutInvalidateContextType = void 0;
14426
14427{
14428 didWarnAboutStateAssignmentForComponent = new Set();
14429 didWarnAboutUninitializedState = new Set();
14430 didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
14431 didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
14432 didWarnAboutDirectlyAssigningPropsToState = new Set();
14433 didWarnAboutUndefinedDerivedState = new Set();
14434 didWarnAboutContextTypeAndContextTypes = new Set();
14435 didWarnAboutInvalidateContextType = new Set();
14436
14437 var didWarnOnInvalidCallback = new Set();
14438
14439 warnOnInvalidCallback$1 = function (callback, callerName) {
14440 if (callback === null || typeof callback === 'function') {
14441 return;
14442 }
14443 var key = callerName + '_' + callback;
14444 if (!didWarnOnInvalidCallback.has(key)) {
14445 didWarnOnInvalidCallback.add(key);
14446 warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
14447 }
14448 };
14449
14450 warnOnUndefinedDerivedState = function (type, partialState) {
14451 if (partialState === undefined) {
14452 var componentName = getComponentName(type) || 'Component';
14453 if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
14454 didWarnAboutUndefinedDerivedState.add(componentName);
14455 warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
14456 }
14457 }
14458 };
14459
14460 // This is so gross but it's at least non-critical and can be removed if
14461 // it causes problems. This is meant to give a nicer error message for
14462 // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,
14463 // ...)) which otherwise throws a "_processChildContext is not a function"
14464 // exception.
14465 Object.defineProperty(fakeInternalInstance, '_processChildContext', {
14466 enumerable: false,
14467 value: function () {
14468 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).');
14469 }
14470 });
14471 Object.freeze(fakeInternalInstance);
14472}
14473
14474function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
14475 var prevState = workInProgress.memoizedState;
14476
14477 {
14478 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
14479 // Invoke the function an extra time to help detect side-effects.
14480 getDerivedStateFromProps(nextProps, prevState);
14481 }
14482 }
14483
14484 var partialState = getDerivedStateFromProps(nextProps, prevState);
14485
14486 {
14487 warnOnUndefinedDerivedState(ctor, partialState);
14488 }
14489 // Merge the partial state and the previous state.
14490 var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
14491 workInProgress.memoizedState = memoizedState;
14492
14493 // Once the update queue is empty, persist the derived state onto the
14494 // base state.
14495 var updateQueue = workInProgress.updateQueue;
14496 if (updateQueue !== null && workInProgress.expirationTime === NoWork) {
14497 updateQueue.baseState = memoizedState;
14498 }
14499}
14500
14501var classComponentUpdater = {
14502 isMounted: isMounted,
14503 enqueueSetState: function (inst, payload, callback) {
14504 var fiber = get(inst);
14505 var currentTime = requestCurrentTime();
14506 var expirationTime = computeExpirationForFiber(currentTime, fiber);
14507
14508 var update = createUpdate(expirationTime);
14509 update.payload = payload;
14510 if (callback !== undefined && callback !== null) {
14511 {
14512 warnOnInvalidCallback$1(callback, 'setState');
14513 }
14514 update.callback = callback;
14515 }
14516
14517 flushPassiveEffects();
14518 enqueueUpdate(fiber, update);
14519 scheduleWork(fiber, expirationTime);
14520 },
14521 enqueueReplaceState: function (inst, payload, callback) {
14522 var fiber = get(inst);
14523 var currentTime = requestCurrentTime();
14524 var expirationTime = computeExpirationForFiber(currentTime, fiber);
14525
14526 var update = createUpdate(expirationTime);
14527 update.tag = ReplaceState;
14528 update.payload = payload;
14529
14530 if (callback !== undefined && callback !== null) {
14531 {
14532 warnOnInvalidCallback$1(callback, 'replaceState');
14533 }
14534 update.callback = callback;
14535 }
14536
14537 flushPassiveEffects();
14538 enqueueUpdate(fiber, update);
14539 scheduleWork(fiber, expirationTime);
14540 },
14541 enqueueForceUpdate: function (inst, callback) {
14542 var fiber = get(inst);
14543 var currentTime = requestCurrentTime();
14544 var expirationTime = computeExpirationForFiber(currentTime, fiber);
14545
14546 var update = createUpdate(expirationTime);
14547 update.tag = ForceUpdate;
14548
14549 if (callback !== undefined && callback !== null) {
14550 {
14551 warnOnInvalidCallback$1(callback, 'forceUpdate');
14552 }
14553 update.callback = callback;
14554 }
14555
14556 flushPassiveEffects();
14557 enqueueUpdate(fiber, update);
14558 scheduleWork(fiber, expirationTime);
14559 }
14560};
14561
14562function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
14563 var instance = workInProgress.stateNode;
14564 if (typeof instance.shouldComponentUpdate === 'function') {
14565 startPhaseTimer(workInProgress, 'shouldComponentUpdate');
14566 var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
14567 stopPhaseTimer();
14568
14569 {
14570 !(shouldUpdate !== undefined) ? warningWithoutStack$1(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component') : void 0;
14571 }
14572
14573 return shouldUpdate;
14574 }
14575
14576 if (ctor.prototype && ctor.prototype.isPureReactComponent) {
14577 return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
14578 }
14579
14580 return true;
14581}
14582
14583function checkClassInstance(workInProgress, ctor, newProps) {
14584 var instance = workInProgress.stateNode;
14585 {
14586 var name = getComponentName(ctor) || 'Component';
14587 var renderPresent = instance.render;
14588
14589 if (!renderPresent) {
14590 if (ctor.prototype && typeof ctor.prototype.render === 'function') {
14591 warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
14592 } else {
14593 warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
14594 }
14595 }
14596
14597 var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
14598 !noGetInitialStateOnES6 ? warningWithoutStack$1(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;
14599 var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
14600 !noGetDefaultPropsOnES6 ? warningWithoutStack$1(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;
14601 var noInstancePropTypes = !instance.propTypes;
14602 !noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
14603 var noInstanceContextType = !instance.contextType;
14604 !noInstanceContextType ? warningWithoutStack$1(false, 'contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name) : void 0;
14605 var noInstanceContextTypes = !instance.contextTypes;
14606 !noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
14607
14608 if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
14609 didWarnAboutContextTypeAndContextTypes.add(ctor);
14610 warningWithoutStack$1(false, '%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
14611 }
14612
14613 var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
14614 !noComponentShouldUpdate ? warningWithoutStack$1(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;
14615 if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
14616 warningWithoutStack$1(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(ctor) || 'A pure component');
14617 }
14618 var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
14619 !noComponentDidUnmount ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
14620 var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
14621 !noComponentDidReceiveProps ? warningWithoutStack$1(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;
14622 var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
14623 !noComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
14624 var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
14625 !noUnsafeComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
14626 var hasMutatedProps = instance.props !== newProps;
14627 !(instance.props === undefined || !hasMutatedProps) ? warningWithoutStack$1(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;
14628 var noInstanceDefaultProps = !instance.defaultProps;
14629 !noInstanceDefaultProps ? warningWithoutStack$1(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;
14630
14631 if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
14632 didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
14633 warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
14634 }
14635
14636 var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
14637 !noInstanceGetDerivedStateFromProps ? warningWithoutStack$1(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
14638 var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromError !== 'function';
14639 !noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
14640 var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
14641 !noStaticGetSnapshotBeforeUpdate ? warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
14642 var _state = instance.state;
14643 if (_state && (typeof _state !== 'object' || isArray$1(_state))) {
14644 warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
14645 }
14646 if (typeof instance.getChildContext === 'function') {
14647 !(typeof ctor.childContextTypes === 'object') ? warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
14648 }
14649 }
14650}
14651
14652function adoptClassInstance(workInProgress, instance) {
14653 instance.updater = classComponentUpdater;
14654 workInProgress.stateNode = instance;
14655 // The instance needs access to the fiber so that it can schedule updates
14656 set(instance, workInProgress);
14657 {
14658 instance._reactInternalInstance = fakeInternalInstance;
14659 }
14660}
14661
14662function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
14663 var isLegacyContextConsumer = false;
14664 var unmaskedContext = emptyContextObject;
14665 var context = null;
14666 var contextType = ctor.contextType;
14667 if (typeof contextType === 'object' && contextType !== null) {
14668 {
14669 if (contextType.$$typeof !== REACT_CONTEXT_TYPE && !didWarnAboutInvalidateContextType.has(ctor)) {
14670 didWarnAboutInvalidateContextType.add(ctor);
14671 warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext(). ' + 'Did you accidentally pass the Context.Provider instead?', getComponentName(ctor) || 'Component');
14672 }
14673 }
14674
14675 context = readContext$1(contextType);
14676 } else {
14677 unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
14678 var contextTypes = ctor.contextTypes;
14679 isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
14680 context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
14681 }
14682
14683 // Instantiate twice to help detect side-effects.
14684 {
14685 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
14686 new ctor(props, context); // eslint-disable-line no-new
14687 }
14688 }
14689
14690 var instance = new ctor(props, context);
14691 var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
14692 adoptClassInstance(workInProgress, instance);
14693
14694 {
14695 if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
14696 var componentName = getComponentName(ctor) || 'Component';
14697 if (!didWarnAboutUninitializedState.has(componentName)) {
14698 didWarnAboutUninitializedState.add(componentName);
14699 warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
14700 }
14701 }
14702
14703 // If new component APIs are defined, "unsafe" lifecycles won't be called.
14704 // Warn about these lifecycles if they are present.
14705 // Don't warn about react-lifecycles-compat polyfilled methods though.
14706 if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
14707 var foundWillMountName = null;
14708 var foundWillReceivePropsName = null;
14709 var foundWillUpdateName = null;
14710 if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
14711 foundWillMountName = 'componentWillMount';
14712 } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
14713 foundWillMountName = 'UNSAFE_componentWillMount';
14714 }
14715 if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
14716 foundWillReceivePropsName = 'componentWillReceiveProps';
14717 } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
14718 foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
14719 }
14720 if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
14721 foundWillUpdateName = 'componentWillUpdate';
14722 } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
14723 foundWillUpdateName = 'UNSAFE_componentWillUpdate';
14724 }
14725 if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
14726 var _componentName = getComponentName(ctor) || 'Component';
14727 var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
14728 if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
14729 didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
14730 warningWithoutStack$1(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 : '');
14731 }
14732 }
14733 }
14734 }
14735
14736 // Cache unmasked context so we can avoid recreating masked context unless necessary.
14737 // ReactFiberContext usually updates this cache but can't for newly-created instances.
14738 if (isLegacyContextConsumer) {
14739 cacheContext(workInProgress, unmaskedContext, context);
14740 }
14741
14742 return instance;
14743}
14744
14745function callComponentWillMount(workInProgress, instance) {
14746 startPhaseTimer(workInProgress, 'componentWillMount');
14747 var oldState = instance.state;
14748
14749 if (typeof instance.componentWillMount === 'function') {
14750 instance.componentWillMount();
14751 }
14752 if (typeof instance.UNSAFE_componentWillMount === 'function') {
14753 instance.UNSAFE_componentWillMount();
14754 }
14755
14756 stopPhaseTimer();
14757
14758 if (oldState !== instance.state) {
14759 {
14760 warningWithoutStack$1(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component');
14761 }
14762 classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
14763 }
14764}
14765
14766function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
14767 var oldState = instance.state;
14768 startPhaseTimer(workInProgress, 'componentWillReceiveProps');
14769 if (typeof instance.componentWillReceiveProps === 'function') {
14770 instance.componentWillReceiveProps(newProps, nextContext);
14771 }
14772 if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
14773 instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
14774 }
14775 stopPhaseTimer();
14776
14777 if (instance.state !== oldState) {
14778 {
14779 var componentName = getComponentName(workInProgress.type) || 'Component';
14780 if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
14781 didWarnAboutStateAssignmentForComponent.add(componentName);
14782 warningWithoutStack$1(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
14783 }
14784 }
14785 classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
14786 }
14787}
14788
14789// Invokes the mount life-cycles on a previously never rendered instance.
14790function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
14791 {
14792 checkClassInstance(workInProgress, ctor, newProps);
14793 }
14794
14795 var instance = workInProgress.stateNode;
14796 instance.props = newProps;
14797 instance.state = workInProgress.memoizedState;
14798 instance.refs = emptyRefsObject;
14799
14800 var contextType = ctor.contextType;
14801 if (typeof contextType === 'object' && contextType !== null) {
14802 instance.context = readContext$1(contextType);
14803 } else {
14804 var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
14805 instance.context = getMaskedContext(workInProgress, unmaskedContext);
14806 }
14807
14808 {
14809 if (instance.state === newProps) {
14810 var componentName = getComponentName(ctor) || 'Component';
14811 if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
14812 didWarnAboutDirectlyAssigningPropsToState.add(componentName);
14813 warningWithoutStack$1(false, '%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
14814 }
14815 }
14816
14817 if (workInProgress.mode & StrictMode) {
14818 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
14819
14820 ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
14821 }
14822
14823 if (warnAboutDeprecatedLifecycles) {
14824 ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance);
14825 }
14826 }
14827
14828 var updateQueue = workInProgress.updateQueue;
14829 if (updateQueue !== null) {
14830 processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
14831 instance.state = workInProgress.memoizedState;
14832 }
14833
14834 var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
14835 if (typeof getDerivedStateFromProps === 'function') {
14836 applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
14837 instance.state = workInProgress.memoizedState;
14838 }
14839
14840 // In order to support react-lifecycles-compat polyfilled components,
14841 // Unsafe lifecycles should not be invoked for components using the new APIs.
14842 if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
14843 callComponentWillMount(workInProgress, instance);
14844 // If we had additional state updates during this life-cycle, let's
14845 // process them now.
14846 updateQueue = workInProgress.updateQueue;
14847 if (updateQueue !== null) {
14848 processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
14849 instance.state = workInProgress.memoizedState;
14850 }
14851 }
14852
14853 if (typeof instance.componentDidMount === 'function') {
14854 workInProgress.effectTag |= Update;
14855 }
14856}
14857
14858function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
14859 var instance = workInProgress.stateNode;
14860
14861 var oldProps = workInProgress.memoizedProps;
14862 instance.props = oldProps;
14863
14864 var oldContext = instance.context;
14865 var contextType = ctor.contextType;
14866 var nextContext = void 0;
14867 if (typeof contextType === 'object' && contextType !== null) {
14868 nextContext = readContext$1(contextType);
14869 } else {
14870 var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
14871 nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
14872 }
14873
14874 var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
14875 var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
14876
14877 // Note: During these life-cycles, instance.props/instance.state are what
14878 // ever the previously attempted to render - not the "current". However,
14879 // during componentDidUpdate we pass the "current" props.
14880
14881 // In order to support react-lifecycles-compat polyfilled components,
14882 // Unsafe lifecycles should not be invoked for components using the new APIs.
14883 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
14884 if (oldProps !== newProps || oldContext !== nextContext) {
14885 callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
14886 }
14887 }
14888
14889 resetHasForceUpdateBeforeProcessing();
14890
14891 var oldState = workInProgress.memoizedState;
14892 var newState = instance.state = oldState;
14893 var updateQueue = workInProgress.updateQueue;
14894 if (updateQueue !== null) {
14895 processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
14896 newState = workInProgress.memoizedState;
14897 }
14898 if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
14899 // If an update was already in progress, we should schedule an Update
14900 // effect even though we're bailing out, so that cWU/cDU are called.
14901 if (typeof instance.componentDidMount === 'function') {
14902 workInProgress.effectTag |= Update;
14903 }
14904 return false;
14905 }
14906
14907 if (typeof getDerivedStateFromProps === 'function') {
14908 applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
14909 newState = workInProgress.memoizedState;
14910 }
14911
14912 var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
14913
14914 if (shouldUpdate) {
14915 // In order to support react-lifecycles-compat polyfilled components,
14916 // Unsafe lifecycles should not be invoked for components using the new APIs.
14917 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
14918 startPhaseTimer(workInProgress, 'componentWillMount');
14919 if (typeof instance.componentWillMount === 'function') {
14920 instance.componentWillMount();
14921 }
14922 if (typeof instance.UNSAFE_componentWillMount === 'function') {
14923 instance.UNSAFE_componentWillMount();
14924 }
14925 stopPhaseTimer();
14926 }
14927 if (typeof instance.componentDidMount === 'function') {
14928 workInProgress.effectTag |= Update;
14929 }
14930 } else {
14931 // If an update was already in progress, we should schedule an Update
14932 // effect even though we're bailing out, so that cWU/cDU are called.
14933 if (typeof instance.componentDidMount === 'function') {
14934 workInProgress.effectTag |= Update;
14935 }
14936
14937 // If shouldComponentUpdate returned false, we should still update the
14938 // memoized state to indicate that this work can be reused.
14939 workInProgress.memoizedProps = newProps;
14940 workInProgress.memoizedState = newState;
14941 }
14942
14943 // Update the existing instance's state, props, and context pointers even
14944 // if shouldComponentUpdate returns false.
14945 instance.props = newProps;
14946 instance.state = newState;
14947 instance.context = nextContext;
14948
14949 return shouldUpdate;
14950}
14951
14952// Invokes the update life-cycles and returns false if it shouldn't rerender.
14953function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
14954 var instance = workInProgress.stateNode;
14955
14956 var oldProps = workInProgress.memoizedProps;
14957 instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps);
14958
14959 var oldContext = instance.context;
14960 var contextType = ctor.contextType;
14961 var nextContext = void 0;
14962 if (typeof contextType === 'object' && contextType !== null) {
14963 nextContext = readContext$1(contextType);
14964 } else {
14965 var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
14966 nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
14967 }
14968
14969 var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
14970 var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
14971
14972 // Note: During these life-cycles, instance.props/instance.state are what
14973 // ever the previously attempted to render - not the "current". However,
14974 // during componentDidUpdate we pass the "current" props.
14975
14976 // In order to support react-lifecycles-compat polyfilled components,
14977 // Unsafe lifecycles should not be invoked for components using the new APIs.
14978 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
14979 if (oldProps !== newProps || oldContext !== nextContext) {
14980 callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
14981 }
14982 }
14983
14984 resetHasForceUpdateBeforeProcessing();
14985
14986 var oldState = workInProgress.memoizedState;
14987 var newState = instance.state = oldState;
14988 var updateQueue = workInProgress.updateQueue;
14989 if (updateQueue !== null) {
14990 processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
14991 newState = workInProgress.memoizedState;
14992 }
14993
14994 if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
14995 // If an update was already in progress, we should schedule an Update
14996 // effect even though we're bailing out, so that cWU/cDU are called.
14997 if (typeof instance.componentDidUpdate === 'function') {
14998 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
14999 workInProgress.effectTag |= Update;
15000 }
15001 }
15002 if (typeof instance.getSnapshotBeforeUpdate === 'function') {
15003 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
15004 workInProgress.effectTag |= Snapshot;
15005 }
15006 }
15007 return false;
15008 }
15009
15010 if (typeof getDerivedStateFromProps === 'function') {
15011 applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
15012 newState = workInProgress.memoizedState;
15013 }
15014
15015 var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
15016
15017 if (shouldUpdate) {
15018 // In order to support react-lifecycles-compat polyfilled components,
15019 // Unsafe lifecycles should not be invoked for components using the new APIs.
15020 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
15021 startPhaseTimer(workInProgress, 'componentWillUpdate');
15022 if (typeof instance.componentWillUpdate === 'function') {
15023 instance.componentWillUpdate(newProps, newState, nextContext);
15024 }
15025 if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
15026 instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
15027 }
15028 stopPhaseTimer();
15029 }
15030 if (typeof instance.componentDidUpdate === 'function') {
15031 workInProgress.effectTag |= Update;
15032 }
15033 if (typeof instance.getSnapshotBeforeUpdate === 'function') {
15034 workInProgress.effectTag |= Snapshot;
15035 }
15036 } else {
15037 // If an update was already in progress, we should schedule an Update
15038 // effect even though we're bailing out, so that cWU/cDU are called.
15039 if (typeof instance.componentDidUpdate === 'function') {
15040 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
15041 workInProgress.effectTag |= Update;
15042 }
15043 }
15044 if (typeof instance.getSnapshotBeforeUpdate === 'function') {
15045 if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
15046 workInProgress.effectTag |= Snapshot;
15047 }
15048 }
15049
15050 // If shouldComponentUpdate returned false, we should still update the
15051 // memoized props/state to indicate that this work can be reused.
15052 workInProgress.memoizedProps = newProps;
15053 workInProgress.memoizedState = newState;
15054 }
15055
15056 // Update the existing instance's state, props, and context pointers even
15057 // if shouldComponentUpdate returns false.
15058 instance.props = newProps;
15059 instance.state = newState;
15060 instance.context = nextContext;
15061
15062 return shouldUpdate;
15063}
15064
15065var didWarnAboutMaps = void 0;
15066var didWarnAboutGenerators = void 0;
15067var didWarnAboutStringRefInStrictMode = void 0;
15068var ownerHasKeyUseWarning = void 0;
15069var ownerHasFunctionTypeWarning = void 0;
15070var warnForMissingKey = function (child) {};
15071
15072{
15073 didWarnAboutMaps = false;
15074 didWarnAboutGenerators = false;
15075 didWarnAboutStringRefInStrictMode = {};
15076
15077 /**
15078 * Warn if there's no key explicitly set on dynamic arrays of children or
15079 * object keys are not valid. This allows us to keep track of children between
15080 * updates.
15081 */
15082 ownerHasKeyUseWarning = {};
15083 ownerHasFunctionTypeWarning = {};
15084
15085 warnForMissingKey = function (child) {
15086 if (child === null || typeof child !== 'object') {
15087 return;
15088 }
15089 if (!child._store || child._store.validated || child.key != null) {
15090 return;
15091 }
15092 !(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;
15093 child._store.validated = true;
15094
15095 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.' + getCurrentFiberStackInDev();
15096 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
15097 return;
15098 }
15099 ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
15100
15101 warning$1(false, 'Each child in an array or iterator should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
15102 };
15103}
15104
15105var isArray = Array.isArray;
15106
15107function coerceRef(returnFiber, current$$1, element) {
15108 var mixedRef = element.ref;
15109 if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
15110 {
15111 if (returnFiber.mode & StrictMode) {
15112 var componentName = getComponentName(returnFiber.type) || 'Component';
15113 if (!didWarnAboutStringRefInStrictMode[componentName]) {
15114 warningWithoutStack$1(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, getStackByFiberInDevAndProd(returnFiber));
15115 didWarnAboutStringRefInStrictMode[componentName] = true;
15116 }
15117 }
15118 }
15119
15120 if (element._owner) {
15121 var owner = element._owner;
15122 var inst = void 0;
15123 if (owner) {
15124 var ownerFiber = owner;
15125 !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Function components cannot have refs.') : void 0;
15126 inst = ownerFiber.stateNode;
15127 }
15128 !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;
15129 var stringRef = '' + mixedRef;
15130 // Check if previous string ref matches new string ref
15131 if (current$$1 !== null && current$$1.ref !== null && typeof current$$1.ref === 'function' && current$$1.ref._stringRef === stringRef) {
15132 return current$$1.ref;
15133 }
15134 var ref = function (value) {
15135 var refs = inst.refs;
15136 if (refs === emptyRefsObject) {
15137 // This is a lazy pooled frozen object, so we need to initialize.
15138 refs = inst.refs = {};
15139 }
15140 if (value === null) {
15141 delete refs[stringRef];
15142 } else {
15143 refs[stringRef] = value;
15144 }
15145 };
15146 ref._stringRef = stringRef;
15147 return ref;
15148 } else {
15149 !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function, a string, an object returned by React.createRef(), or null.') : void 0;
15150 !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 function 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;
15151 }
15152 }
15153 return mixedRef;
15154}
15155
15156function throwOnInvalidObjectType(returnFiber, newChild) {
15157 if (returnFiber.type !== 'textarea') {
15158 var addendum = '';
15159 {
15160 addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
15161 }
15162 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);
15163 }
15164}
15165
15166function warnOnFunctionType() {
15167 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.' + getCurrentFiberStackInDev();
15168
15169 if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
15170 return;
15171 }
15172 ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
15173
15174 warning$1(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.');
15175}
15176
15177// This wrapper function exists because I expect to clone the code in each path
15178// to be able to optimize each path individually by branching early. This needs
15179// a compiler or we can do it manually. Helpers that don't need this branching
15180// live outside of this function.
15181function ChildReconciler(shouldTrackSideEffects) {
15182 function deleteChild(returnFiber, childToDelete) {
15183 if (!shouldTrackSideEffects) {
15184 // Noop.
15185 return;
15186 }
15187 // Deletions are added in reversed order so we add it to the front.
15188 // At this point, the return fiber's effect list is empty except for
15189 // deletions, so we can just append the deletion to the list. The remaining
15190 // effects aren't added until the complete phase. Once we implement
15191 // resuming, this may not be true.
15192 var last = returnFiber.lastEffect;
15193 if (last !== null) {
15194 last.nextEffect = childToDelete;
15195 returnFiber.lastEffect = childToDelete;
15196 } else {
15197 returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
15198 }
15199 childToDelete.nextEffect = null;
15200 childToDelete.effectTag = Deletion;
15201 }
15202
15203 function deleteRemainingChildren(returnFiber, currentFirstChild) {
15204 if (!shouldTrackSideEffects) {
15205 // Noop.
15206 return null;
15207 }
15208
15209 // TODO: For the shouldClone case, this could be micro-optimized a bit by
15210 // assuming that after the first child we've already added everything.
15211 var childToDelete = currentFirstChild;
15212 while (childToDelete !== null) {
15213 deleteChild(returnFiber, childToDelete);
15214 childToDelete = childToDelete.sibling;
15215 }
15216 return null;
15217 }
15218
15219 function mapRemainingChildren(returnFiber, currentFirstChild) {
15220 // Add the remaining children to a temporary map so that we can find them by
15221 // keys quickly. Implicit (null) keys get added to this set with their index
15222 var existingChildren = new Map();
15223
15224 var existingChild = currentFirstChild;
15225 while (existingChild !== null) {
15226 if (existingChild.key !== null) {
15227 existingChildren.set(existingChild.key, existingChild);
15228 } else {
15229 existingChildren.set(existingChild.index, existingChild);
15230 }
15231 existingChild = existingChild.sibling;
15232 }
15233 return existingChildren;
15234 }
15235
15236 function useFiber(fiber, pendingProps, expirationTime) {
15237 // We currently set sibling to null and index to 0 here because it is easy
15238 // to forget to do before returning it. E.g. for the single child case.
15239 var clone = createWorkInProgress(fiber, pendingProps, expirationTime);
15240 clone.index = 0;
15241 clone.sibling = null;
15242 return clone;
15243 }
15244
15245 function placeChild(newFiber, lastPlacedIndex, newIndex) {
15246 newFiber.index = newIndex;
15247 if (!shouldTrackSideEffects) {
15248 // Noop.
15249 return lastPlacedIndex;
15250 }
15251 var current$$1 = newFiber.alternate;
15252 if (current$$1 !== null) {
15253 var oldIndex = current$$1.index;
15254 if (oldIndex < lastPlacedIndex) {
15255 // This is a move.
15256 newFiber.effectTag = Placement;
15257 return lastPlacedIndex;
15258 } else {
15259 // This item can stay in place.
15260 return oldIndex;
15261 }
15262 } else {
15263 // This is an insertion.
15264 newFiber.effectTag = Placement;
15265 return lastPlacedIndex;
15266 }
15267 }
15268
15269 function placeSingleChild(newFiber) {
15270 // This is simpler for the single child case. We only need to do a
15271 // placement for inserting new children.
15272 if (shouldTrackSideEffects && newFiber.alternate === null) {
15273 newFiber.effectTag = Placement;
15274 }
15275 return newFiber;
15276 }
15277
15278 function updateTextNode(returnFiber, current$$1, textContent, expirationTime) {
15279 if (current$$1 === null || current$$1.tag !== HostText) {
15280 // Insert
15281 var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
15282 created.return = returnFiber;
15283 return created;
15284 } else {
15285 // Update
15286 var existing = useFiber(current$$1, textContent, expirationTime);
15287 existing.return = returnFiber;
15288 return existing;
15289 }
15290 }
15291
15292 function updateElement(returnFiber, current$$1, element, expirationTime) {
15293 if (current$$1 !== null && current$$1.elementType === element.type) {
15294 // Move based on index
15295 var existing = useFiber(current$$1, element.props, expirationTime);
15296 existing.ref = coerceRef(returnFiber, current$$1, element);
15297 existing.return = returnFiber;
15298 {
15299 existing._debugSource = element._source;
15300 existing._debugOwner = element._owner;
15301 }
15302 return existing;
15303 } else {
15304 // Insert
15305 var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
15306 created.ref = coerceRef(returnFiber, current$$1, element);
15307 created.return = returnFiber;
15308 return created;
15309 }
15310 }
15311
15312 function updatePortal(returnFiber, current$$1, portal, expirationTime) {
15313 if (current$$1 === null || current$$1.tag !== HostPortal || current$$1.stateNode.containerInfo !== portal.containerInfo || current$$1.stateNode.implementation !== portal.implementation) {
15314 // Insert
15315 var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
15316 created.return = returnFiber;
15317 return created;
15318 } else {
15319 // Update
15320 var existing = useFiber(current$$1, portal.children || [], expirationTime);
15321 existing.return = returnFiber;
15322 return existing;
15323 }
15324 }
15325
15326 function updateFragment(returnFiber, current$$1, fragment, expirationTime, key) {
15327 if (current$$1 === null || current$$1.tag !== Fragment) {
15328 // Insert
15329 var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
15330 created.return = returnFiber;
15331 return created;
15332 } else {
15333 // Update
15334 var existing = useFiber(current$$1, fragment, expirationTime);
15335 existing.return = returnFiber;
15336 return existing;
15337 }
15338 }
15339
15340 function createChild(returnFiber, newChild, expirationTime) {
15341 if (typeof newChild === 'string' || typeof newChild === 'number') {
15342 // Text nodes don't have keys. If the previous node is implicitly keyed
15343 // we can continue to replace it without aborting even if it is not a text
15344 // node.
15345 var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
15346 created.return = returnFiber;
15347 return created;
15348 }
15349
15350 if (typeof newChild === 'object' && newChild !== null) {
15351 switch (newChild.$$typeof) {
15352 case REACT_ELEMENT_TYPE:
15353 {
15354 var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
15355 _created.ref = coerceRef(returnFiber, null, newChild);
15356 _created.return = returnFiber;
15357 return _created;
15358 }
15359 case REACT_PORTAL_TYPE:
15360 {
15361 var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
15362 _created2.return = returnFiber;
15363 return _created2;
15364 }
15365 }
15366
15367 if (isArray(newChild) || getIteratorFn(newChild)) {
15368 var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
15369 _created3.return = returnFiber;
15370 return _created3;
15371 }
15372
15373 throwOnInvalidObjectType(returnFiber, newChild);
15374 }
15375
15376 {
15377 if (typeof newChild === 'function') {
15378 warnOnFunctionType();
15379 }
15380 }
15381
15382 return null;
15383 }
15384
15385 function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
15386 // Update the fiber if the keys match, otherwise return null.
15387
15388 var key = oldFiber !== null ? oldFiber.key : null;
15389
15390 if (typeof newChild === 'string' || typeof newChild === 'number') {
15391 // Text nodes don't have keys. If the previous node is implicitly keyed
15392 // we can continue to replace it without aborting even if it is not a text
15393 // node.
15394 if (key !== null) {
15395 return null;
15396 }
15397 return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
15398 }
15399
15400 if (typeof newChild === 'object' && newChild !== null) {
15401 switch (newChild.$$typeof) {
15402 case REACT_ELEMENT_TYPE:
15403 {
15404 if (newChild.key === key) {
15405 if (newChild.type === REACT_FRAGMENT_TYPE) {
15406 return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
15407 }
15408 return updateElement(returnFiber, oldFiber, newChild, expirationTime);
15409 } else {
15410 return null;
15411 }
15412 }
15413 case REACT_PORTAL_TYPE:
15414 {
15415 if (newChild.key === key) {
15416 return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
15417 } else {
15418 return null;
15419 }
15420 }
15421 }
15422
15423 if (isArray(newChild) || getIteratorFn(newChild)) {
15424 if (key !== null) {
15425 return null;
15426 }
15427
15428 return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
15429 }
15430
15431 throwOnInvalidObjectType(returnFiber, newChild);
15432 }
15433
15434 {
15435 if (typeof newChild === 'function') {
15436 warnOnFunctionType();
15437 }
15438 }
15439
15440 return null;
15441 }
15442
15443 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
15444 if (typeof newChild === 'string' || typeof newChild === 'number') {
15445 // Text nodes don't have keys, so we neither have to check the old nor
15446 // new node for the key. If both are text nodes, they match.
15447 var matchedFiber = existingChildren.get(newIdx) || null;
15448 return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
15449 }
15450
15451 if (typeof newChild === 'object' && newChild !== null) {
15452 switch (newChild.$$typeof) {
15453 case REACT_ELEMENT_TYPE:
15454 {
15455 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
15456 if (newChild.type === REACT_FRAGMENT_TYPE) {
15457 return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
15458 }
15459 return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
15460 }
15461 case REACT_PORTAL_TYPE:
15462 {
15463 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
15464 return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
15465 }
15466 }
15467
15468 if (isArray(newChild) || getIteratorFn(newChild)) {
15469 var _matchedFiber3 = existingChildren.get(newIdx) || null;
15470 return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
15471 }
15472
15473 throwOnInvalidObjectType(returnFiber, newChild);
15474 }
15475
15476 {
15477 if (typeof newChild === 'function') {
15478 warnOnFunctionType();
15479 }
15480 }
15481
15482 return null;
15483 }
15484
15485 /**
15486 * Warns if there is a duplicate or missing key
15487 */
15488 function warnOnInvalidKey(child, knownKeys) {
15489 {
15490 if (typeof child !== 'object' || child === null) {
15491 return knownKeys;
15492 }
15493 switch (child.$$typeof) {
15494 case REACT_ELEMENT_TYPE:
15495 case REACT_PORTAL_TYPE:
15496 warnForMissingKey(child);
15497 var key = child.key;
15498 if (typeof key !== 'string') {
15499 break;
15500 }
15501 if (knownKeys === null) {
15502 knownKeys = new Set();
15503 knownKeys.add(key);
15504 break;
15505 }
15506 if (!knownKeys.has(key)) {
15507 knownKeys.add(key);
15508 break;
15509 }
15510 warning$1(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.', key);
15511 break;
15512 default:
15513 break;
15514 }
15515 }
15516 return knownKeys;
15517 }
15518
15519 function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
15520 // This algorithm can't optimize by searching from boths ends since we
15521 // don't have backpointers on fibers. I'm trying to see how far we can get
15522 // with that model. If it ends up not being worth the tradeoffs, we can
15523 // add it later.
15524
15525 // Even with a two ended optimization, we'd want to optimize for the case
15526 // where there are few changes and brute force the comparison instead of
15527 // going for the Map. It'd like to explore hitting that path first in
15528 // forward-only mode and only go for the Map once we notice that we need
15529 // lots of look ahead. This doesn't handle reversal as well as two ended
15530 // search but that's unusual. Besides, for the two ended optimization to
15531 // work on Iterables, we'd need to copy the whole set.
15532
15533 // In this first iteration, we'll just live with hitting the bad case
15534 // (adding everything to a Map) in for every insert/move.
15535
15536 // If you change this code, also update reconcileChildrenIterator() which
15537 // uses the same algorithm.
15538
15539 {
15540 // First, validate keys.
15541 var knownKeys = null;
15542 for (var i = 0; i < newChildren.length; i++) {
15543 var child = newChildren[i];
15544 knownKeys = warnOnInvalidKey(child, knownKeys);
15545 }
15546 }
15547
15548 var resultingFirstChild = null;
15549 var previousNewFiber = null;
15550
15551 var oldFiber = currentFirstChild;
15552 var lastPlacedIndex = 0;
15553 var newIdx = 0;
15554 var nextOldFiber = null;
15555 for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
15556 if (oldFiber.index > newIdx) {
15557 nextOldFiber = oldFiber;
15558 oldFiber = null;
15559 } else {
15560 nextOldFiber = oldFiber.sibling;
15561 }
15562 var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
15563 if (newFiber === null) {
15564 // TODO: This breaks on empty slots like null children. That's
15565 // unfortunate because it triggers the slow path all the time. We need
15566 // a better way to communicate whether this was a miss or null,
15567 // boolean, undefined, etc.
15568 if (oldFiber === null) {
15569 oldFiber = nextOldFiber;
15570 }
15571 break;
15572 }
15573 if (shouldTrackSideEffects) {
15574 if (oldFiber && newFiber.alternate === null) {
15575 // We matched the slot, but we didn't reuse the existing fiber, so we
15576 // need to delete the existing child.
15577 deleteChild(returnFiber, oldFiber);
15578 }
15579 }
15580 lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
15581 if (previousNewFiber === null) {
15582 // TODO: Move out of the loop. This only happens for the first run.
15583 resultingFirstChild = newFiber;
15584 } else {
15585 // TODO: Defer siblings if we're not at the right index for this slot.
15586 // I.e. if we had null values before, then we want to defer this
15587 // for each null value. However, we also don't want to call updateSlot
15588 // with the previous one.
15589 previousNewFiber.sibling = newFiber;
15590 }
15591 previousNewFiber = newFiber;
15592 oldFiber = nextOldFiber;
15593 }
15594
15595 if (newIdx === newChildren.length) {
15596 // We've reached the end of the new children. We can delete the rest.
15597 deleteRemainingChildren(returnFiber, oldFiber);
15598 return resultingFirstChild;
15599 }
15600
15601 if (oldFiber === null) {
15602 // If we don't have any more existing children we can choose a fast path
15603 // since the rest will all be insertions.
15604 for (; newIdx < newChildren.length; newIdx++) {
15605 var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
15606 if (!_newFiber) {
15607 continue;
15608 }
15609 lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
15610 if (previousNewFiber === null) {
15611 // TODO: Move out of the loop. This only happens for the first run.
15612 resultingFirstChild = _newFiber;
15613 } else {
15614 previousNewFiber.sibling = _newFiber;
15615 }
15616 previousNewFiber = _newFiber;
15617 }
15618 return resultingFirstChild;
15619 }
15620
15621 // Add all children to a key map for quick lookups.
15622 var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
15623
15624 // Keep scanning and use the map to restore deleted items as moves.
15625 for (; newIdx < newChildren.length; newIdx++) {
15626 var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
15627 if (_newFiber2) {
15628 if (shouldTrackSideEffects) {
15629 if (_newFiber2.alternate !== null) {
15630 // The new fiber is a work in progress, but if there exists a
15631 // current, that means that we reused the fiber. We need to delete
15632 // it from the child list so that we don't add it to the deletion
15633 // list.
15634 existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
15635 }
15636 }
15637 lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
15638 if (previousNewFiber === null) {
15639 resultingFirstChild = _newFiber2;
15640 } else {
15641 previousNewFiber.sibling = _newFiber2;
15642 }
15643 previousNewFiber = _newFiber2;
15644 }
15645 }
15646
15647 if (shouldTrackSideEffects) {
15648 // Any existing children that weren't consumed above were deleted. We need
15649 // to add them to the deletion list.
15650 existingChildren.forEach(function (child) {
15651 return deleteChild(returnFiber, child);
15652 });
15653 }
15654
15655 return resultingFirstChild;
15656 }
15657
15658 function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
15659 // This is the same implementation as reconcileChildrenArray(),
15660 // but using the iterator instead.
15661
15662 var iteratorFn = getIteratorFn(newChildrenIterable);
15663 !(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;
15664
15665 {
15666 // We don't support rendering Generators because it's a mutation.
15667 // See https://github.com/facebook/react/issues/12995
15668 if (typeof Symbol === 'function' &&
15669 // $FlowFixMe Flow doesn't know about toStringTag
15670 newChildrenIterable[Symbol.toStringTag] === 'Generator') {
15671 !didWarnAboutGenerators ? warning$1(false, 'Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.') : void 0;
15672 didWarnAboutGenerators = true;
15673 }
15674
15675 // Warn about using Maps as children
15676 if (newChildrenIterable.entries === iteratorFn) {
15677 !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
15678 didWarnAboutMaps = true;
15679 }
15680
15681 // First, validate keys.
15682 // We'll get a different iterator later for the main pass.
15683 var _newChildren = iteratorFn.call(newChildrenIterable);
15684 if (_newChildren) {
15685 var knownKeys = null;
15686 var _step = _newChildren.next();
15687 for (; !_step.done; _step = _newChildren.next()) {
15688 var child = _step.value;
15689 knownKeys = warnOnInvalidKey(child, knownKeys);
15690 }
15691 }
15692 }
15693
15694 var newChildren = iteratorFn.call(newChildrenIterable);
15695 !(newChildren != null) ? invariant(false, 'An iterable object provided no iterator.') : void 0;
15696
15697 var resultingFirstChild = null;
15698 var previousNewFiber = null;
15699
15700 var oldFiber = currentFirstChild;
15701 var lastPlacedIndex = 0;
15702 var newIdx = 0;
15703 var nextOldFiber = null;
15704
15705 var step = newChildren.next();
15706 for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
15707 if (oldFiber.index > newIdx) {
15708 nextOldFiber = oldFiber;
15709 oldFiber = null;
15710 } else {
15711 nextOldFiber = oldFiber.sibling;
15712 }
15713 var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
15714 if (newFiber === null) {
15715 // TODO: This breaks on empty slots like null children. That's
15716 // unfortunate because it triggers the slow path all the time. We need
15717 // a better way to communicate whether this was a miss or null,
15718 // boolean, undefined, etc.
15719 if (!oldFiber) {
15720 oldFiber = nextOldFiber;
15721 }
15722 break;
15723 }
15724 if (shouldTrackSideEffects) {
15725 if (oldFiber && newFiber.alternate === null) {
15726 // We matched the slot, but we didn't reuse the existing fiber, so we
15727 // need to delete the existing child.
15728 deleteChild(returnFiber, oldFiber);
15729 }
15730 }
15731 lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
15732 if (previousNewFiber === null) {
15733 // TODO: Move out of the loop. This only happens for the first run.
15734 resultingFirstChild = newFiber;
15735 } else {
15736 // TODO: Defer siblings if we're not at the right index for this slot.
15737 // I.e. if we had null values before, then we want to defer this
15738 // for each null value. However, we also don't want to call updateSlot
15739 // with the previous one.
15740 previousNewFiber.sibling = newFiber;
15741 }
15742 previousNewFiber = newFiber;
15743 oldFiber = nextOldFiber;
15744 }
15745
15746 if (step.done) {
15747 // We've reached the end of the new children. We can delete the rest.
15748 deleteRemainingChildren(returnFiber, oldFiber);
15749 return resultingFirstChild;
15750 }
15751
15752 if (oldFiber === null) {
15753 // If we don't have any more existing children we can choose a fast path
15754 // since the rest will all be insertions.
15755 for (; !step.done; newIdx++, step = newChildren.next()) {
15756 var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
15757 if (_newFiber3 === null) {
15758 continue;
15759 }
15760 lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
15761 if (previousNewFiber === null) {
15762 // TODO: Move out of the loop. This only happens for the first run.
15763 resultingFirstChild = _newFiber3;
15764 } else {
15765 previousNewFiber.sibling = _newFiber3;
15766 }
15767 previousNewFiber = _newFiber3;
15768 }
15769 return resultingFirstChild;
15770 }
15771
15772 // Add all children to a key map for quick lookups.
15773 var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
15774
15775 // Keep scanning and use the map to restore deleted items as moves.
15776 for (; !step.done; newIdx++, step = newChildren.next()) {
15777 var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
15778 if (_newFiber4 !== null) {
15779 if (shouldTrackSideEffects) {
15780 if (_newFiber4.alternate !== null) {
15781 // The new fiber is a work in progress, but if there exists a
15782 // current, that means that we reused the fiber. We need to delete
15783 // it from the child list so that we don't add it to the deletion
15784 // list.
15785 existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
15786 }
15787 }
15788 lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
15789 if (previousNewFiber === null) {
15790 resultingFirstChild = _newFiber4;
15791 } else {
15792 previousNewFiber.sibling = _newFiber4;
15793 }
15794 previousNewFiber = _newFiber4;
15795 }
15796 }
15797
15798 if (shouldTrackSideEffects) {
15799 // Any existing children that weren't consumed above were deleted. We need
15800 // to add them to the deletion list.
15801 existingChildren.forEach(function (child) {
15802 return deleteChild(returnFiber, child);
15803 });
15804 }
15805
15806 return resultingFirstChild;
15807 }
15808
15809 function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
15810 // There's no need to check for keys on text nodes since we don't have a
15811 // way to define them.
15812 if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
15813 // We already have an existing node so let's just update it and delete
15814 // the rest.
15815 deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
15816 var existing = useFiber(currentFirstChild, textContent, expirationTime);
15817 existing.return = returnFiber;
15818 return existing;
15819 }
15820 // The existing first child is not a text node so we need to create one
15821 // and delete the existing ones.
15822 deleteRemainingChildren(returnFiber, currentFirstChild);
15823 var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
15824 created.return = returnFiber;
15825 return created;
15826 }
15827
15828 function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
15829 var key = element.key;
15830 var child = currentFirstChild;
15831 while (child !== null) {
15832 // TODO: If key === null and child.key === null, then this only applies to
15833 // the first item in the list.
15834 if (child.key === key) {
15835 if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type) {
15836 deleteRemainingChildren(returnFiber, child.sibling);
15837 var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
15838 existing.ref = coerceRef(returnFiber, child, element);
15839 existing.return = returnFiber;
15840 {
15841 existing._debugSource = element._source;
15842 existing._debugOwner = element._owner;
15843 }
15844 return existing;
15845 } else {
15846 deleteRemainingChildren(returnFiber, child);
15847 break;
15848 }
15849 } else {
15850 deleteChild(returnFiber, child);
15851 }
15852 child = child.sibling;
15853 }
15854
15855 if (element.type === REACT_FRAGMENT_TYPE) {
15856 var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
15857 created.return = returnFiber;
15858 return created;
15859 } else {
15860 var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
15861 _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
15862 _created4.return = returnFiber;
15863 return _created4;
15864 }
15865 }
15866
15867 function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
15868 var key = portal.key;
15869 var child = currentFirstChild;
15870 while (child !== null) {
15871 // TODO: If key === null and child.key === null, then this only applies to
15872 // the first item in the list.
15873 if (child.key === key) {
15874 if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
15875 deleteRemainingChildren(returnFiber, child.sibling);
15876 var existing = useFiber(child, portal.children || [], expirationTime);
15877 existing.return = returnFiber;
15878 return existing;
15879 } else {
15880 deleteRemainingChildren(returnFiber, child);
15881 break;
15882 }
15883 } else {
15884 deleteChild(returnFiber, child);
15885 }
15886 child = child.sibling;
15887 }
15888
15889 var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
15890 created.return = returnFiber;
15891 return created;
15892 }
15893
15894 // This API will tag the children with the side-effect of the reconciliation
15895 // itself. They will be added to the side-effect list as we pass through the
15896 // children and the parent.
15897 function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
15898 // This function is not recursive.
15899 // If the top level item is an array, we treat it as a set of children,
15900 // not as a fragment. Nested arrays on the other hand will be treated as
15901 // fragment nodes. Recursion happens at the normal flow.
15902
15903 // Handle top level unkeyed fragments as if they were arrays.
15904 // This leads to an ambiguity between <>{[...]}</> and <>...</>.
15905 // We treat the ambiguous cases above the same.
15906 var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
15907 if (isUnkeyedTopLevelFragment) {
15908 newChild = newChild.props.children;
15909 }
15910
15911 // Handle object types
15912 var isObject = typeof newChild === 'object' && newChild !== null;
15913
15914 if (isObject) {
15915 switch (newChild.$$typeof) {
15916 case REACT_ELEMENT_TYPE:
15917 return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
15918 case REACT_PORTAL_TYPE:
15919 return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
15920 }
15921 }
15922
15923 if (typeof newChild === 'string' || typeof newChild === 'number') {
15924 return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
15925 }
15926
15927 if (isArray(newChild)) {
15928 return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
15929 }
15930
15931 if (getIteratorFn(newChild)) {
15932 return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
15933 }
15934
15935 if (isObject) {
15936 throwOnInvalidObjectType(returnFiber, newChild);
15937 }
15938
15939 {
15940 if (typeof newChild === 'function') {
15941 warnOnFunctionType();
15942 }
15943 }
15944 if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
15945 // If the new child is undefined, and the return fiber is a composite
15946 // component, throw an error. If Fiber return types are disabled,
15947 // we already threw above.
15948 switch (returnFiber.tag) {
15949 case ClassComponent:
15950 {
15951 {
15952 var instance = returnFiber.stateNode;
15953 if (instance.render._isMockFunction) {
15954 // We allow auto-mocks to proceed as if they're returning null.
15955 break;
15956 }
15957 }
15958 }
15959 // Intentionally fall through to the next case, which handles both
15960 // functions and classes
15961 // eslint-disable-next-lined no-fallthrough
15962 case FunctionComponent:
15963 {
15964 var Component = returnFiber.type;
15965 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');
15966 }
15967 }
15968 }
15969
15970 // Remaining cases are all treated as empty.
15971 return deleteRemainingChildren(returnFiber, currentFirstChild);
15972 }
15973
15974 return reconcileChildFibers;
15975}
15976
15977var reconcileChildFibers = ChildReconciler(true);
15978var mountChildFibers = ChildReconciler(false);
15979
15980function cloneChildFibers(current$$1, workInProgress) {
15981 !(current$$1 === null || workInProgress.child === current$$1.child) ? invariant(false, 'Resuming work not yet implemented.') : void 0;
15982
15983 if (workInProgress.child === null) {
15984 return;
15985 }
15986
15987 var currentChild = workInProgress.child;
15988 var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
15989 workInProgress.child = newChild;
15990
15991 newChild.return = workInProgress;
15992 while (currentChild.sibling !== null) {
15993 currentChild = currentChild.sibling;
15994 newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
15995 newChild.return = workInProgress;
15996 }
15997 newChild.sibling = null;
15998}
15999
16000// The deepest Fiber on the stack involved in a hydration context.
16001// This may have been an insertion or a hydration.
16002var hydrationParentFiber = null;
16003var nextHydratableInstance = null;
16004var isHydrating = false;
16005
16006function enterHydrationState(fiber) {
16007 if (!supportsHydration) {
16008 return false;
16009 }
16010
16011 var parentInstance = fiber.stateNode.containerInfo;
16012 nextHydratableInstance = getFirstHydratableChild(parentInstance);
16013 hydrationParentFiber = fiber;
16014 isHydrating = true;
16015 return true;
16016}
16017
16018function deleteHydratableInstance(returnFiber, instance) {
16019 {
16020 switch (returnFiber.tag) {
16021 case HostRoot:
16022 didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
16023 break;
16024 case HostComponent:
16025 didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
16026 break;
16027 }
16028 }
16029
16030 var childToDelete = createFiberFromHostInstanceForDeletion();
16031 childToDelete.stateNode = instance;
16032 childToDelete.return = returnFiber;
16033 childToDelete.effectTag = Deletion;
16034
16035 // This might seem like it belongs on progressedFirstDeletion. However,
16036 // these children are not part of the reconciliation list of children.
16037 // Even if we abort and rereconcile the children, that will try to hydrate
16038 // again and the nodes are still in the host tree so these will be
16039 // recreated.
16040 if (returnFiber.lastEffect !== null) {
16041 returnFiber.lastEffect.nextEffect = childToDelete;
16042 returnFiber.lastEffect = childToDelete;
16043 } else {
16044 returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
16045 }
16046}
16047
16048function insertNonHydratedInstance(returnFiber, fiber) {
16049 fiber.effectTag |= Placement;
16050 {
16051 switch (returnFiber.tag) {
16052 case HostRoot:
16053 {
16054 var parentContainer = returnFiber.stateNode.containerInfo;
16055 switch (fiber.tag) {
16056 case HostComponent:
16057 var type = fiber.type;
16058 var props = fiber.pendingProps;
16059 didNotFindHydratableContainerInstance(parentContainer, type, props);
16060 break;
16061 case HostText:
16062 var text = fiber.pendingProps;
16063 didNotFindHydratableContainerTextInstance(parentContainer, text);
16064 break;
16065 }
16066 break;
16067 }
16068 case HostComponent:
16069 {
16070 var parentType = returnFiber.type;
16071 var parentProps = returnFiber.memoizedProps;
16072 var parentInstance = returnFiber.stateNode;
16073 switch (fiber.tag) {
16074 case HostComponent:
16075 var _type = fiber.type;
16076 var _props = fiber.pendingProps;
16077 didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
16078 break;
16079 case HostText:
16080 var _text = fiber.pendingProps;
16081 didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
16082 break;
16083 }
16084 break;
16085 }
16086 default:
16087 return;
16088 }
16089 }
16090}
16091
16092function tryHydrate(fiber, nextInstance) {
16093 switch (fiber.tag) {
16094 case HostComponent:
16095 {
16096 var type = fiber.type;
16097 var props = fiber.pendingProps;
16098 var instance = canHydrateInstance(nextInstance, type, props);
16099 if (instance !== null) {
16100 fiber.stateNode = instance;
16101 return true;
16102 }
16103 return false;
16104 }
16105 case HostText:
16106 {
16107 var text = fiber.pendingProps;
16108 var textInstance = canHydrateTextInstance(nextInstance, text);
16109 if (textInstance !== null) {
16110 fiber.stateNode = textInstance;
16111 return true;
16112 }
16113 return false;
16114 }
16115 default:
16116 return false;
16117 }
16118}
16119
16120function tryToClaimNextHydratableInstance(fiber) {
16121 if (!isHydrating) {
16122 return;
16123 }
16124 var nextInstance = nextHydratableInstance;
16125 if (!nextInstance) {
16126 // Nothing to hydrate. Make it an insertion.
16127 insertNonHydratedInstance(hydrationParentFiber, fiber);
16128 isHydrating = false;
16129 hydrationParentFiber = fiber;
16130 return;
16131 }
16132 var firstAttemptedInstance = nextInstance;
16133 if (!tryHydrate(fiber, nextInstance)) {
16134 // If we can't hydrate this instance let's try the next one.
16135 // We use this as a heuristic. It's based on intuition and not data so it
16136 // might be flawed or unnecessary.
16137 nextInstance = getNextHydratableSibling(firstAttemptedInstance);
16138 if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
16139 // Nothing to hydrate. Make it an insertion.
16140 insertNonHydratedInstance(hydrationParentFiber, fiber);
16141 isHydrating = false;
16142 hydrationParentFiber = fiber;
16143 return;
16144 }
16145 // We matched the next one, we'll now assume that the first one was
16146 // superfluous and we'll delete it. Since we can't eagerly delete it
16147 // we'll have to schedule a deletion. To do that, this node needs a dummy
16148 // fiber associated with it.
16149 deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
16150 }
16151 hydrationParentFiber = fiber;
16152 nextHydratableInstance = getFirstHydratableChild(nextInstance);
16153}
16154
16155function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
16156 if (!supportsHydration) {
16157 invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
16158 }
16159
16160 var instance = fiber.stateNode;
16161 var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
16162 // TODO: Type this specific to this type of component.
16163 fiber.updateQueue = updatePayload;
16164 // If the update payload indicates that there is a change or if there
16165 // is a new ref we mark this as an update.
16166 if (updatePayload !== null) {
16167 return true;
16168 }
16169 return false;
16170}
16171
16172function prepareToHydrateHostTextInstance(fiber) {
16173 if (!supportsHydration) {
16174 invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
16175 }
16176
16177 var textInstance = fiber.stateNode;
16178 var textContent = fiber.memoizedProps;
16179 var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
16180 {
16181 if (shouldUpdate) {
16182 // We assume that prepareToHydrateHostTextInstance is called in a context where the
16183 // hydration parent is the parent host component of this host text.
16184 var returnFiber = hydrationParentFiber;
16185 if (returnFiber !== null) {
16186 switch (returnFiber.tag) {
16187 case HostRoot:
16188 {
16189 var parentContainer = returnFiber.stateNode.containerInfo;
16190 didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
16191 break;
16192 }
16193 case HostComponent:
16194 {
16195 var parentType = returnFiber.type;
16196 var parentProps = returnFiber.memoizedProps;
16197 var parentInstance = returnFiber.stateNode;
16198 didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
16199 break;
16200 }
16201 }
16202 }
16203 }
16204 }
16205 return shouldUpdate;
16206}
16207
16208function popToNextHostParent(fiber) {
16209 var parent = fiber.return;
16210 while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot) {
16211 parent = parent.return;
16212 }
16213 hydrationParentFiber = parent;
16214}
16215
16216function popHydrationState(fiber) {
16217 if (!supportsHydration) {
16218 return false;
16219 }
16220 if (fiber !== hydrationParentFiber) {
16221 // We're deeper than the current hydration context, inside an inserted
16222 // tree.
16223 return false;
16224 }
16225 if (!isHydrating) {
16226 // If we're not currently hydrating but we're in a hydration context, then
16227 // we were an insertion and now need to pop up reenter hydration of our
16228 // siblings.
16229 popToNextHostParent(fiber);
16230 isHydrating = true;
16231 return false;
16232 }
16233
16234 var type = fiber.type;
16235
16236 // If we have any remaining hydratable nodes, we need to delete them now.
16237 // We only do this deeper than head and body since they tend to have random
16238 // other nodes in them. We also ignore components with pure text content in
16239 // side of them.
16240 // TODO: Better heuristic.
16241 if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
16242 var nextInstance = nextHydratableInstance;
16243 while (nextInstance) {
16244 deleteHydratableInstance(fiber, nextInstance);
16245 nextInstance = getNextHydratableSibling(nextInstance);
16246 }
16247 }
16248
16249 popToNextHostParent(fiber);
16250 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
16251 return true;
16252}
16253
16254function resetHydrationState() {
16255 if (!supportsHydration) {
16256 return;
16257 }
16258
16259 hydrationParentFiber = null;
16260 nextHydratableInstance = null;
16261 isHydrating = false;
16262}
16263
16264var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
16265
16266var didWarnAboutBadClass = void 0;
16267var didWarnAboutContextTypeOnFunctionComponent = void 0;
16268var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
16269var didWarnAboutFunctionRefs = void 0;
16270var didWarnAboutReassigningProps = void 0;
16271
16272{
16273 didWarnAboutBadClass = {};
16274 didWarnAboutContextTypeOnFunctionComponent = {};
16275 didWarnAboutGetDerivedStateOnFunctionComponent = {};
16276 didWarnAboutFunctionRefs = {};
16277 didWarnAboutReassigningProps = false;
16278}
16279
16280function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
16281 if (current$$1 === null) {
16282 // If this is a fresh new component that hasn't been rendered yet, we
16283 // won't update its child set by applying minimal side-effects. Instead,
16284 // we will add them all to the child before it gets rendered. That means
16285 // we can optimize this reconciliation pass by not tracking side-effects.
16286 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
16287 } else {
16288 // If the current child is the same as the work in progress, it means that
16289 // we haven't yet started any work on these children. Therefore, we use
16290 // the clone algorithm to create a copy of all the current children.
16291
16292 // If we had any progressed work already, that is invalid at this point so
16293 // let's throw it out.
16294 workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, nextChildren, renderExpirationTime);
16295 }
16296}
16297
16298function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime) {
16299 // This function is fork of reconcileChildren. It's used in cases where we
16300 // want to reconcile without matching against the existing set. This has the
16301 // effect of all current children being unmounted; even if the type and key
16302 // are the same, the old child is unmounted and a new child is created.
16303 //
16304 // To do this, we're going to go through the reconcile algorithm twice. In
16305 // the first pass, we schedule a deletion for all the current children by
16306 // passing null.
16307 workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
16308 // In the second pass, we mount the new children. The trick here is that we
16309 // pass null in place of where we usually pass the current child set. This has
16310 // the effect of remounting all children regardless of whether their their
16311 // identity matches.
16312 workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
16313}
16314
16315function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
16316 {
16317 if (workInProgress.type !== workInProgress.elementType) {
16318 // Lazy component props can't be validated in createElement
16319 // because they're only guaranteed to be resolved here.
16320 var innerPropTypes = Component.propTypes;
16321 if (innerPropTypes) {
16322 checkPropTypes(innerPropTypes, nextProps, // Resolved props
16323 'prop', getComponentName(Component), getCurrentFiberStackInDev);
16324 }
16325 }
16326 }
16327
16328 var render = Component.render;
16329 var ref = workInProgress.ref;
16330
16331 // The rest is a fork of updateFunctionComponent
16332 var nextChildren = void 0;
16333 prepareToReadContext(workInProgress, renderExpirationTime);
16334 prepareToUseHooks(current$$1, workInProgress, renderExpirationTime);
16335 {
16336 ReactCurrentOwner$3.current = workInProgress;
16337 setCurrentPhase('render');
16338 nextChildren = render(nextProps, ref);
16339 setCurrentPhase(null);
16340 }
16341 nextChildren = finishHooks(render, nextProps, nextChildren, ref);
16342
16343 // React DevTools reads this flag.
16344 workInProgress.effectTag |= PerformedWork;
16345 reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
16346 return workInProgress.child;
16347}
16348
16349function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
16350 if (current$$1 === null) {
16351 var type = Component.type;
16352 if (isSimpleFunctionComponent(type) && Component.compare === null &&
16353 // SimpleMemoComponent codepath doesn't resolve outer props either.
16354 Component.defaultProps === undefined) {
16355 // If this is a plain function component without default props,
16356 // and with only the default shallow comparison, we upgrade it
16357 // to a SimpleMemoComponent to allow fast path updates.
16358 workInProgress.tag = SimpleMemoComponent;
16359 workInProgress.type = type;
16360 {
16361 validateFunctionComponentInDev(workInProgress, type);
16362 }
16363 return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
16364 }
16365 {
16366 var innerPropTypes = type.propTypes;
16367 if (innerPropTypes) {
16368 // Inner memo component props aren't currently validated in createElement.
16369 // We could move it there, but we'd still need this for lazy code path.
16370 checkPropTypes(innerPropTypes, nextProps, // Resolved props
16371 'prop', getComponentName(type), getCurrentFiberStackInDev);
16372 }
16373 }
16374 var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
16375 child.ref = workInProgress.ref;
16376 child.return = workInProgress;
16377 workInProgress.child = child;
16378 return child;
16379 }
16380 {
16381 var _type = Component.type;
16382 var _innerPropTypes = _type.propTypes;
16383 if (_innerPropTypes) {
16384 // Inner memo component props aren't currently validated in createElement.
16385 // We could move it there, but we'd still need this for lazy code path.
16386 checkPropTypes(_innerPropTypes, nextProps, // Resolved props
16387 'prop', getComponentName(_type), getCurrentFiberStackInDev);
16388 }
16389 }
16390 var currentChild = current$$1.child; // This is always exactly one child
16391 if (updateExpirationTime < renderExpirationTime) {
16392 // This will be the props with resolved defaultProps,
16393 // unlike current.memoizedProps which will be the unresolved ones.
16394 var prevProps = currentChild.memoizedProps;
16395 // Default to shallow comparison
16396 var compare = Component.compare;
16397 compare = compare !== null ? compare : shallowEqual;
16398 if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
16399 return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
16400 }
16401 }
16402 // React DevTools reads this flag.
16403 workInProgress.effectTag |= PerformedWork;
16404 var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
16405 newChild.ref = workInProgress.ref;
16406 newChild.return = workInProgress;
16407 workInProgress.child = newChild;
16408 return newChild;
16409}
16410
16411function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
16412 {
16413 if (workInProgress.type !== workInProgress.elementType) {
16414 // Lazy component props can't be validated in createElement
16415 // because they're only guaranteed to be resolved here.
16416 var outerMemoType = workInProgress.elementType;
16417 if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
16418 // We warn when you define propTypes on lazy()
16419 // so let's just skip over it to find memo() outer wrapper.
16420 // Inner props for memo are validated later.
16421 outerMemoType = refineResolvedLazyComponent(outerMemoType);
16422 }
16423 var outerPropTypes = outerMemoType && outerMemoType.propTypes;
16424 if (outerPropTypes) {
16425 checkPropTypes(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
16426 'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
16427 }
16428 // Inner propTypes will be validated in the function component path.
16429 }
16430 }
16431 if (current$$1 !== null && updateExpirationTime < renderExpirationTime) {
16432 var prevProps = current$$1.memoizedProps;
16433 if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
16434 return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
16435 }
16436 }
16437 return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
16438}
16439
16440function updateFragment(current$$1, workInProgress, renderExpirationTime) {
16441 var nextChildren = workInProgress.pendingProps;
16442 reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
16443 return workInProgress.child;
16444}
16445
16446function updateMode(current$$1, workInProgress, renderExpirationTime) {
16447 var nextChildren = workInProgress.pendingProps.children;
16448 reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
16449 return workInProgress.child;
16450}
16451
16452function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
16453 if (enableProfilerTimer) {
16454 workInProgress.effectTag |= Update;
16455 }
16456 var nextProps = workInProgress.pendingProps;
16457 var nextChildren = nextProps.children;
16458 reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
16459 return workInProgress.child;
16460}
16461
16462function markRef(current$$1, workInProgress) {
16463 var ref = workInProgress.ref;
16464 if (current$$1 === null && ref !== null || current$$1 !== null && current$$1.ref !== ref) {
16465 // Schedule a Ref effect
16466 workInProgress.effectTag |= Ref;
16467 }
16468}
16469
16470function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
16471 {
16472 if (workInProgress.type !== workInProgress.elementType) {
16473 // Lazy component props can't be validated in createElement
16474 // because they're only guaranteed to be resolved here.
16475 var innerPropTypes = Component.propTypes;
16476 if (innerPropTypes) {
16477 checkPropTypes(innerPropTypes, nextProps, // Resolved props
16478 'prop', getComponentName(Component), getCurrentFiberStackInDev);
16479 }
16480 }
16481 }
16482
16483 var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
16484 var context = getMaskedContext(workInProgress, unmaskedContext);
16485
16486 var nextChildren = void 0;
16487 prepareToReadContext(workInProgress, renderExpirationTime);
16488 prepareToUseHooks(current$$1, workInProgress, renderExpirationTime);
16489 {
16490 ReactCurrentOwner$3.current = workInProgress;
16491 setCurrentPhase('render');
16492 nextChildren = Component(nextProps, context);
16493 setCurrentPhase(null);
16494 }
16495 nextChildren = finishHooks(Component, nextProps, nextChildren, context);
16496
16497 // React DevTools reads this flag.
16498 workInProgress.effectTag |= PerformedWork;
16499 reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
16500 return workInProgress.child;
16501}
16502
16503function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
16504 {
16505 if (workInProgress.type !== workInProgress.elementType) {
16506 // Lazy component props can't be validated in createElement
16507 // because they're only guaranteed to be resolved here.
16508 var innerPropTypes = Component.propTypes;
16509 if (innerPropTypes) {
16510 checkPropTypes(innerPropTypes, nextProps, // Resolved props
16511 'prop', getComponentName(Component), getCurrentFiberStackInDev);
16512 }
16513 }
16514 }
16515
16516 // Push context providers early to prevent context stack mismatches.
16517 // During mounting we don't know the child context yet as the instance doesn't exist.
16518 // We will invalidate the child context in finishClassComponent() right after rendering.
16519 var hasContext = void 0;
16520 if (isContextProvider(Component)) {
16521 hasContext = true;
16522 pushContextProvider(workInProgress);
16523 } else {
16524 hasContext = false;
16525 }
16526 prepareToReadContext(workInProgress, renderExpirationTime);
16527
16528 var instance = workInProgress.stateNode;
16529 var shouldUpdate = void 0;
16530 if (instance === null) {
16531 if (current$$1 !== null) {
16532 // An class component without an instance only mounts if it suspended
16533 // inside a non- concurrent tree, in an inconsistent state. We want to
16534 // tree it like a new mount, even though an empty version of it already
16535 // committed. Disconnect the alternate pointers.
16536 current$$1.alternate = null;
16537 workInProgress.alternate = null;
16538 // Since this is conceptually a new fiber, schedule a Placement effect
16539 workInProgress.effectTag |= Placement;
16540 }
16541 // In the initial pass we might need to construct the instance.
16542 constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
16543 mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
16544 shouldUpdate = true;
16545 } else if (current$$1 === null) {
16546 // In a resume, we'll already have an instance we can reuse.
16547 shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
16548 } else {
16549 shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
16550 }
16551 var nextUnitOfWork = finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
16552 {
16553 var inst = workInProgress.stateNode;
16554 if (inst.props !== nextProps) {
16555 !didWarnAboutReassigningProps ? warning$1(false, 'It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component') : void 0;
16556 didWarnAboutReassigningProps = true;
16557 }
16558 }
16559 return nextUnitOfWork;
16560}
16561
16562function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
16563 // Refs should update even if shouldComponentUpdate returns false
16564 markRef(current$$1, workInProgress);
16565
16566 var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
16567
16568 if (!shouldUpdate && !didCaptureError) {
16569 // Context providers should defer to sCU for rendering
16570 if (hasContext) {
16571 invalidateContextProvider(workInProgress, Component, false);
16572 }
16573
16574 return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
16575 }
16576
16577 var instance = workInProgress.stateNode;
16578
16579 // Rerender
16580 ReactCurrentOwner$3.current = workInProgress;
16581 var nextChildren = void 0;
16582 if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
16583 // If we captured an error, but getDerivedStateFrom catch is not defined,
16584 // unmount all the children. componentDidCatch will schedule an update to
16585 // re-render a fallback. This is temporary until we migrate everyone to
16586 // the new API.
16587 // TODO: Warn in a future release.
16588 nextChildren = null;
16589
16590 if (enableProfilerTimer) {
16591 stopProfilerTimerIfRunning(workInProgress);
16592 }
16593 } else {
16594 {
16595 setCurrentPhase('render');
16596 nextChildren = instance.render();
16597 if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
16598 instance.render();
16599 }
16600 setCurrentPhase(null);
16601 }
16602 }
16603
16604 // React DevTools reads this flag.
16605 workInProgress.effectTag |= PerformedWork;
16606 if (current$$1 !== null && didCaptureError) {
16607 // If we're recovering from an error, reconcile without reusing any of
16608 // the existing children. Conceptually, the normal children and the children
16609 // that are shown on error are two different sets, so we shouldn't reuse
16610 // normal children even if their identities match.
16611 forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
16612 } else {
16613 reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
16614 }
16615
16616 // Memoize state using the values we just used to render.
16617 // TODO: Restructure so we never read values from the instance.
16618 workInProgress.memoizedState = instance.state;
16619
16620 // The context might have changed so we need to recalculate it.
16621 if (hasContext) {
16622 invalidateContextProvider(workInProgress, Component, true);
16623 }
16624
16625 return workInProgress.child;
16626}
16627
16628function pushHostRootContext(workInProgress) {
16629 var root = workInProgress.stateNode;
16630 if (root.pendingContext) {
16631 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
16632 } else if (root.context) {
16633 // Should always be set
16634 pushTopLevelContextObject(workInProgress, root.context, false);
16635 }
16636 pushHostContainer(workInProgress, root.containerInfo);
16637}
16638
16639function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
16640 pushHostRootContext(workInProgress);
16641 var updateQueue = workInProgress.updateQueue;
16642 !(updateQueue !== null) ? invariant(false, 'If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue.') : void 0;
16643 var nextProps = workInProgress.pendingProps;
16644 var prevState = workInProgress.memoizedState;
16645 var prevChildren = prevState !== null ? prevState.element : null;
16646 processUpdateQueue(workInProgress, updateQueue, nextProps, null, renderExpirationTime);
16647 var nextState = workInProgress.memoizedState;
16648 // Caution: React DevTools currently depends on this property
16649 // being called "element".
16650 var nextChildren = nextState.element;
16651 if (nextChildren === prevChildren) {
16652 // If the state is the same as before, that's a bailout because we had
16653 // no work that expires at this time.
16654 resetHydrationState();
16655 return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
16656 }
16657 var root = workInProgress.stateNode;
16658 if ((current$$1 === null || current$$1.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
16659 // If we don't have any current children this might be the first pass.
16660 // We always try to hydrate. If this isn't a hydration pass there won't
16661 // be any children to hydrate which is effectively the same thing as
16662 // not hydrating.
16663
16664 // This is a bit of a hack. We track the host root as a placement to
16665 // know that we're currently in a mounting state. That way isMounted
16666 // works as expected. We must reset this before committing.
16667 // TODO: Delete this when we delete isMounted and findDOMNode.
16668 workInProgress.effectTag |= Placement;
16669
16670 // Ensure that children mount into this root without tracking
16671 // side-effects. This ensures that we don't store Placement effects on
16672 // nodes that will be hydrated.
16673 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
16674 } else {
16675 // Otherwise reset hydration state in case we aborted and resumed another
16676 // root.
16677 reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
16678 resetHydrationState();
16679 }
16680 return workInProgress.child;
16681}
16682
16683function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
16684 pushHostContext(workInProgress);
16685
16686 if (current$$1 === null) {
16687 tryToClaimNextHydratableInstance(workInProgress);
16688 }
16689
16690 var type = workInProgress.type;
16691 var nextProps = workInProgress.pendingProps;
16692 var prevProps = current$$1 !== null ? current$$1.memoizedProps : null;
16693
16694 var nextChildren = nextProps.children;
16695 var isDirectTextChild = shouldSetTextContent(type, nextProps);
16696
16697 if (isDirectTextChild) {
16698 // We special case a direct text child of a host node. This is a common
16699 // case. We won't handle it as a reified child. We will instead handle
16700 // this in the host environment that also have access to this prop. That
16701 // avoids allocating another HostText fiber and traversing it.
16702 nextChildren = null;
16703 } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
16704 // If we're switching from a direct text child to a normal child, or to
16705 // empty, we need to schedule the text content to be reset.
16706 workInProgress.effectTag |= ContentReset;
16707 }
16708
16709 markRef(current$$1, workInProgress);
16710
16711 // Check the host config to see if the children are offscreen/hidden.
16712 if (renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && shouldDeprioritizeSubtree(type, nextProps)) {
16713 // Schedule this fiber to re-render at offscreen priority. Then bailout.
16714 workInProgress.expirationTime = Never;
16715 return null;
16716 }
16717
16718 reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
16719 return workInProgress.child;
16720}
16721
16722function updateHostText(current$$1, workInProgress) {
16723 if (current$$1 === null) {
16724 tryToClaimNextHydratableInstance(workInProgress);
16725 }
16726 // Nothing to do here. This is terminal. We'll do the completion step
16727 // immediately after.
16728 return null;
16729}
16730
16731function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
16732 if (_current !== null) {
16733 // An lazy component only mounts if it suspended inside a non-
16734 // concurrent tree, in an inconsistent state. We want to treat it like
16735 // a new mount, even though an empty version of it already committed.
16736 // Disconnect the alternate pointers.
16737 _current.alternate = null;
16738 workInProgress.alternate = null;
16739 // Since this is conceptually a new fiber, schedule a Placement effect
16740 workInProgress.effectTag |= Placement;
16741 }
16742
16743 var props = workInProgress.pendingProps;
16744 // We can't start a User Timing measurement with correct label yet.
16745 // Cancel and resume right after we know the tag.
16746 cancelWorkTimer(workInProgress);
16747 var Component = readLazyComponentType(elementType);
16748 // Store the unwrapped component in the type.
16749 workInProgress.type = Component;
16750 var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
16751 startWorkTimer(workInProgress);
16752 var resolvedProps = resolveDefaultProps(Component, props);
16753 var child = void 0;
16754 switch (resolvedTag) {
16755 case FunctionComponent:
16756 {
16757 child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
16758 break;
16759 }
16760 case ClassComponent:
16761 {
16762 child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
16763 break;
16764 }
16765 case ForwardRef:
16766 {
16767 child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
16768 break;
16769 }
16770 case MemoComponent:
16771 {
16772 {
16773 if (workInProgress.type !== workInProgress.elementType) {
16774 var outerPropTypes = Component.propTypes;
16775 if (outerPropTypes) {
16776 checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only
16777 'prop', getComponentName(Component), getCurrentFiberStackInDev);
16778 }
16779 }
16780 }
16781 child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
16782 updateExpirationTime, renderExpirationTime);
16783 break;
16784 }
16785 default:
16786 {
16787 var hint = '';
16788 {
16789 if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
16790 hint = ' Did you wrap a component in React.lazy() more than once?';
16791 }
16792 }
16793 // This message intentionally doesn't mention ForwardRef or MemoComponent
16794 // because the fact that it's a separate type of work is an
16795 // implementation detail.
16796 invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Lazy element type must resolve to a class or function.%s', Component, hint);
16797 }
16798 }
16799 return child;
16800}
16801
16802function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
16803 if (_current !== null) {
16804 // An incomplete component only mounts if it suspended inside a non-
16805 // concurrent tree, in an inconsistent state. We want to treat it like
16806 // a new mount, even though an empty version of it already committed.
16807 // Disconnect the alternate pointers.
16808 _current.alternate = null;
16809 workInProgress.alternate = null;
16810 // Since this is conceptually a new fiber, schedule a Placement effect
16811 workInProgress.effectTag |= Placement;
16812 }
16813
16814 // Promote the fiber to a class and try rendering again.
16815 workInProgress.tag = ClassComponent;
16816
16817 // The rest of this function is a fork of `updateClassComponent`
16818
16819 // Push context providers early to prevent context stack mismatches.
16820 // During mounting we don't know the child context yet as the instance doesn't exist.
16821 // We will invalidate the child context in finishClassComponent() right after rendering.
16822 var hasContext = void 0;
16823 if (isContextProvider(Component)) {
16824 hasContext = true;
16825 pushContextProvider(workInProgress);
16826 } else {
16827 hasContext = false;
16828 }
16829 prepareToReadContext(workInProgress, renderExpirationTime);
16830
16831 constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
16832 mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
16833
16834 return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
16835}
16836
16837function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
16838 if (_current !== null) {
16839 // An indeterminate component only mounts if it suspended inside a non-
16840 // concurrent tree, in an inconsistent state. We want to treat it like
16841 // a new mount, even though an empty version of it already committed.
16842 // Disconnect the alternate pointers.
16843 _current.alternate = null;
16844 workInProgress.alternate = null;
16845 // Since this is conceptually a new fiber, schedule a Placement effect
16846 workInProgress.effectTag |= Placement;
16847 }
16848
16849 var props = workInProgress.pendingProps;
16850 var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
16851 var context = getMaskedContext(workInProgress, unmaskedContext);
16852
16853 prepareToReadContext(workInProgress, renderExpirationTime);
16854 prepareToUseHooks(null, workInProgress, renderExpirationTime);
16855
16856 var value = void 0;
16857
16858 {
16859 if (Component.prototype && typeof Component.prototype.render === 'function') {
16860 var componentName = getComponentName(Component) || 'Unknown';
16861
16862 if (!didWarnAboutBadClass[componentName]) {
16863 warningWithoutStack$1(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);
16864 didWarnAboutBadClass[componentName] = true;
16865 }
16866 }
16867
16868 if (workInProgress.mode & StrictMode) {
16869 ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
16870 }
16871
16872 ReactCurrentOwner$3.current = workInProgress;
16873 value = Component(props, context);
16874 }
16875 // React DevTools reads this flag.
16876 workInProgress.effectTag |= PerformedWork;
16877
16878 if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
16879 // Proceed under the assumption that this is a class instance
16880 workInProgress.tag = ClassComponent;
16881
16882 // Throw out any hooks that were used.
16883 resetHooks();
16884
16885 // Push context providers early to prevent context stack mismatches.
16886 // During mounting we don't know the child context yet as the instance doesn't exist.
16887 // We will invalidate the child context in finishClassComponent() right after rendering.
16888 var hasContext = false;
16889 if (isContextProvider(Component)) {
16890 hasContext = true;
16891 pushContextProvider(workInProgress);
16892 } else {
16893 hasContext = false;
16894 }
16895
16896 workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
16897
16898 var getDerivedStateFromProps = Component.getDerivedStateFromProps;
16899 if (typeof getDerivedStateFromProps === 'function') {
16900 applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
16901 }
16902
16903 adoptClassInstance(workInProgress, value);
16904 mountClassInstance(workInProgress, Component, props, renderExpirationTime);
16905 return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
16906 } else {
16907 // Proceed under the assumption that this is a function component
16908 workInProgress.tag = FunctionComponent;
16909 value = finishHooks(Component, props, value, context);
16910 reconcileChildren(null, workInProgress, value, renderExpirationTime);
16911 {
16912 validateFunctionComponentInDev(workInProgress, Component);
16913 }
16914 return workInProgress.child;
16915 }
16916}
16917
16918function validateFunctionComponentInDev(workInProgress, Component) {
16919 if (Component) {
16920 !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
16921 }
16922 if (workInProgress.ref !== null) {
16923 var info = '';
16924 var ownerName = getCurrentFiberOwnerNameInDevOrNull();
16925 if (ownerName) {
16926 info += '\n\nCheck the render method of `' + ownerName + '`.';
16927 }
16928
16929 var warningKey = ownerName || workInProgress._debugID || '';
16930 var debugSource = workInProgress._debugSource;
16931 if (debugSource) {
16932 warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
16933 }
16934 if (!didWarnAboutFunctionRefs[warningKey]) {
16935 didWarnAboutFunctionRefs[warningKey] = true;
16936 warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail.%s', info);
16937 }
16938 }
16939
16940 if (typeof Component.getDerivedStateFromProps === 'function') {
16941 var componentName = getComponentName(Component) || 'Unknown';
16942
16943 if (!didWarnAboutGetDerivedStateOnFunctionComponent[componentName]) {
16944 warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', componentName);
16945 didWarnAboutGetDerivedStateOnFunctionComponent[componentName] = true;
16946 }
16947 }
16948
16949 if (typeof Component.contextType === 'object' && Component.contextType !== null) {
16950 var _componentName = getComponentName(Component) || 'Unknown';
16951
16952 if (!didWarnAboutContextTypeOnFunctionComponent[_componentName]) {
16953 warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName);
16954 didWarnAboutContextTypeOnFunctionComponent[_componentName] = true;
16955 }
16956 }
16957}
16958
16959function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
16960 var mode = workInProgress.mode;
16961 var nextProps = workInProgress.pendingProps;
16962
16963 // We should attempt to render the primary children unless this boundary
16964 // already suspended during this render (`alreadyCaptured` is true).
16965 var nextState = workInProgress.memoizedState;
16966
16967 var nextDidTimeout = void 0;
16968 if ((workInProgress.effectTag & DidCapture) === NoEffect) {
16969 // This is the first attempt.
16970 nextState = null;
16971 nextDidTimeout = false;
16972 } else {
16973 // Something in this boundary's subtree already suspended. Switch to
16974 // rendering the fallback children.
16975 nextState = {
16976 timedOutAt: nextState !== null ? nextState.timedOutAt : NoWork
16977 };
16978 nextDidTimeout = true;
16979 workInProgress.effectTag &= ~DidCapture;
16980 }
16981
16982 // This next part is a bit confusing. If the children timeout, we switch to
16983 // showing the fallback children in place of the "primary" children.
16984 // However, we don't want to delete the primary children because then their
16985 // state will be lost (both the React state and the host state, e.g.
16986 // uncontrolled form inputs). Instead we keep them mounted and hide them.
16987 // Both the fallback children AND the primary children are rendered at the
16988 // same time. Once the primary children are un-suspended, we can delete
16989 // the fallback children — don't need to preserve their state.
16990 //
16991 // The two sets of children are siblings in the host environment, but
16992 // semantically, for purposes of reconciliation, they are two separate sets.
16993 // So we store them using two fragment fibers.
16994 //
16995 // However, we want to avoid allocating extra fibers for every placeholder.
16996 // They're only necessary when the children time out, because that's the
16997 // only time when both sets are mounted.
16998 //
16999 // So, the extra fragment fibers are only used if the children time out.
17000 // Otherwise, we render the primary children directly. This requires some
17001 // custom reconciliation logic to preserve the state of the primary
17002 // children. It's essentially a very basic form of re-parenting.
17003
17004 // `child` points to the child fiber. In the normal case, this is the first
17005 // fiber of the primary children set. In the timed-out case, it's a
17006 // a fragment fiber containing the primary children.
17007 var child = void 0;
17008 // `next` points to the next fiber React should render. In the normal case,
17009 // it's the same as `child`: the first fiber of the primary children set.
17010 // In the timed-out case, it's a fragment fiber containing the *fallback*
17011 // children -- we skip over the primary children entirely.
17012 var next = void 0;
17013 if (current$$1 === null) {
17014 // This is the initial mount. This branch is pretty simple because there's
17015 // no previous state that needs to be preserved.
17016 if (nextDidTimeout) {
17017 // Mount separate fragments for primary and fallback children.
17018 var nextFallbackChildren = nextProps.fallback;
17019 var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
17020
17021 if ((workInProgress.mode & ConcurrentMode) === NoContext) {
17022 // Outside of concurrent mode, we commit the effects from the
17023 var progressedState = workInProgress.memoizedState;
17024 var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
17025 primaryChildFragment.child = progressedPrimaryChild;
17026 }
17027
17028 var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
17029 primaryChildFragment.sibling = fallbackChildFragment;
17030 child = primaryChildFragment;
17031 // Skip the primary children, and continue working on the
17032 // fallback children.
17033 next = fallbackChildFragment;
17034 child.return = next.return = workInProgress;
17035 } else {
17036 // Mount the primary children without an intermediate fragment fiber.
17037 var nextPrimaryChildren = nextProps.children;
17038 child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
17039 }
17040 } else {
17041 // This is an update. This branch is more complicated because we need to
17042 // ensure the state of the primary children is preserved.
17043 var prevState = current$$1.memoizedState;
17044 var prevDidTimeout = prevState !== null;
17045 if (prevDidTimeout) {
17046 // The current tree already timed out. That means each child set is
17047 var currentPrimaryChildFragment = current$$1.child;
17048 var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
17049 if (nextDidTimeout) {
17050 // Still timed out. Reuse the current primary children by cloning
17051 // its fragment. We're going to skip over these entirely.
17052 var _nextFallbackChildren = nextProps.fallback;
17053 var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
17054
17055 if ((workInProgress.mode & ConcurrentMode) === NoContext) {
17056 // Outside of concurrent mode, we commit the effects from the
17057 var _progressedState = workInProgress.memoizedState;
17058 var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child;
17059 if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) {
17060 _primaryChildFragment.child = _progressedPrimaryChild;
17061 }
17062 }
17063
17064 // Because primaryChildFragment is a new fiber that we're inserting as the
17065 // parent of a new tree, we need to set its treeBaseDuration.
17066 if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
17067 // treeBaseDuration is the sum of all the child tree base durations.
17068 var treeBaseDuration = 0;
17069 var hiddenChild = _primaryChildFragment.child;
17070 while (hiddenChild !== null) {
17071 treeBaseDuration += hiddenChild.treeBaseDuration;
17072 hiddenChild = hiddenChild.sibling;
17073 }
17074 _primaryChildFragment.treeBaseDuration = treeBaseDuration;
17075 }
17076
17077 // Clone the fallback child fragment, too. These we'll continue
17078 // working on.
17079 var _fallbackChildFragment = _primaryChildFragment.sibling = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
17080 child = _primaryChildFragment;
17081 _primaryChildFragment.childExpirationTime = NoWork;
17082 // Skip the primary children, and continue working on the
17083 // fallback children.
17084 next = _fallbackChildFragment;
17085 child.return = next.return = workInProgress;
17086 } else {
17087 // No longer suspended. Switch back to showing the primary children,
17088 // and remove the intermediate fragment fiber.
17089 var _nextPrimaryChildren = nextProps.children;
17090 var currentPrimaryChild = currentPrimaryChildFragment.child;
17091 var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
17092
17093 // If this render doesn't suspend, we need to delete the fallback
17094 // children. Wait until the complete phase, after we've confirmed the
17095 // fallback is no longer needed.
17096 // TODO: Would it be better to store the fallback fragment on
17097 // the stateNode?
17098
17099 // Continue rendering the children, like we normally do.
17100 child = next = primaryChild;
17101 }
17102 } else {
17103 // The current tree has not already timed out. That means the primary
17104 // children are not wrapped in a fragment fiber.
17105 var _currentPrimaryChild = current$$1.child;
17106 if (nextDidTimeout) {
17107 // Timed out. Wrap the children in a fragment fiber to keep them
17108 // separate from the fallback children.
17109 var _nextFallbackChildren2 = nextProps.fallback;
17110 var _primaryChildFragment2 = createFiberFromFragment(
17111 // It shouldn't matter what the pending props are because we aren't
17112 // going to render this fragment.
17113 null, mode, NoWork, null);
17114 _primaryChildFragment2.child = _currentPrimaryChild;
17115
17116 // Even though we're creating a new fiber, there are no new children,
17117 // because we're reusing an already mounted tree. So we don't need to
17118 // schedule a placement.
17119 // primaryChildFragment.effectTag |= Placement;
17120
17121 if ((workInProgress.mode & ConcurrentMode) === NoContext) {
17122 // Outside of concurrent mode, we commit the effects from the
17123 var _progressedState2 = workInProgress.memoizedState;
17124 var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child;
17125 _primaryChildFragment2.child = _progressedPrimaryChild2;
17126 }
17127
17128 // Because primaryChildFragment is a new fiber that we're inserting as the
17129 // parent of a new tree, we need to set its treeBaseDuration.
17130 if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
17131 // treeBaseDuration is the sum of all the child tree base durations.
17132 var _treeBaseDuration = 0;
17133 var _hiddenChild = _primaryChildFragment2.child;
17134 while (_hiddenChild !== null) {
17135 _treeBaseDuration += _hiddenChild.treeBaseDuration;
17136 _hiddenChild = _hiddenChild.sibling;
17137 }
17138 _primaryChildFragment2.treeBaseDuration = _treeBaseDuration;
17139 }
17140
17141 // Create a fragment from the fallback children, too.
17142 var _fallbackChildFragment2 = _primaryChildFragment2.sibling = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
17143 _fallbackChildFragment2.effectTag |= Placement;
17144 child = _primaryChildFragment2;
17145 _primaryChildFragment2.childExpirationTime = NoWork;
17146 // Skip the primary children, and continue working on the
17147 // fallback children.
17148 next = _fallbackChildFragment2;
17149 child.return = next.return = workInProgress;
17150 } else {
17151 // Still haven't timed out. Continue rendering the children, like we
17152 // normally do.
17153 var _nextPrimaryChildren2 = nextProps.children;
17154 next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
17155 }
17156 }
17157 workInProgress.stateNode = current$$1.stateNode;
17158 }
17159
17160 workInProgress.memoizedState = nextState;
17161 workInProgress.child = child;
17162 return next;
17163}
17164
17165function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
17166 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
17167 var nextChildren = workInProgress.pendingProps;
17168 if (current$$1 === null) {
17169 // Portals are special because we don't append the children during mount
17170 // but at commit. Therefore we need to track insertions which the normal
17171 // flow doesn't do during mount. This doesn't happen at the root because
17172 // the root always starts with a "current" with a null child.
17173 // TODO: Consider unifying this with how the root works.
17174 workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
17175 } else {
17176 reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
17177 }
17178 return workInProgress.child;
17179}
17180
17181function updateContextProvider(current$$1, workInProgress, renderExpirationTime) {
17182 var providerType = workInProgress.type;
17183 var context = providerType._context;
17184
17185 var newProps = workInProgress.pendingProps;
17186 var oldProps = workInProgress.memoizedProps;
17187
17188 var newValue = newProps.value;
17189
17190 {
17191 var providerPropTypes = workInProgress.type.propTypes;
17192
17193 if (providerPropTypes) {
17194 checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
17195 }
17196 }
17197
17198 pushProvider(workInProgress, newValue);
17199
17200 if (oldProps !== null) {
17201 var oldValue = oldProps.value;
17202 var changedBits = calculateChangedBits(context, newValue, oldValue);
17203 if (changedBits === 0) {
17204 // No change. Bailout early if children are the same.
17205 if (oldProps.children === newProps.children && !hasContextChanged()) {
17206 return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
17207 }
17208 } else {
17209 // The context value changed. Search for matching consumers and schedule
17210 // them to update.
17211 propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
17212 }
17213 }
17214
17215 var newChildren = newProps.children;
17216 reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
17217 return workInProgress.child;
17218}
17219
17220var hasWarnedAboutUsingContextAsConsumer = false;
17221
17222function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
17223 var context = workInProgress.type;
17224 // The logic below for Context differs depending on PROD or DEV mode. In
17225 // DEV mode, we create a separate object for Context.Consumer that acts
17226 // like a proxy to Context. This proxy object adds unnecessary code in PROD
17227 // so we use the old behaviour (Context.Consumer references Context) to
17228 // reduce size and overhead. The separate object references context via
17229 // a property called "_context", which also gives us the ability to check
17230 // in DEV mode if this property exists or not and warn if it does not.
17231 {
17232 if (context._context === undefined) {
17233 // This may be because it's a Context (rather than a Consumer).
17234 // Or it may be because it's older React where they're the same thing.
17235 // We only want to warn if we're sure it's a new React.
17236 if (context !== context.Consumer) {
17237 if (!hasWarnedAboutUsingContextAsConsumer) {
17238 hasWarnedAboutUsingContextAsConsumer = true;
17239 warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
17240 }
17241 }
17242 } else {
17243 context = context._context;
17244 }
17245 }
17246 var newProps = workInProgress.pendingProps;
17247 var render = newProps.children;
17248
17249 {
17250 !(typeof render === 'function') ? warningWithoutStack$1(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;
17251 }
17252
17253 prepareToReadContext(workInProgress, renderExpirationTime);
17254 var newValue = readContext(context, newProps.unstable_observedBits);
17255 var newChildren = void 0;
17256 {
17257 ReactCurrentOwner$3.current = workInProgress;
17258 setCurrentPhase('render');
17259 newChildren = render(newValue);
17260 setCurrentPhase(null);
17261 }
17262
17263 // React DevTools reads this flag.
17264 workInProgress.effectTag |= PerformedWork;
17265 reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
17266 return workInProgress.child;
17267}
17268
17269function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime) {
17270 cancelWorkTimer(workInProgress);
17271
17272 if (current$$1 !== null) {
17273 // Reuse previous context list
17274 workInProgress.firstContextDependency = current$$1.firstContextDependency;
17275 }
17276
17277 if (enableProfilerTimer) {
17278 // Don't update "base" render times for bailouts.
17279 stopProfilerTimerIfRunning(workInProgress);
17280 }
17281
17282 // Check if the children have any pending work.
17283 var childExpirationTime = workInProgress.childExpirationTime;
17284 if (childExpirationTime < renderExpirationTime) {
17285 // The children don't have any work either. We can skip them.
17286 // TODO: Once we add back resuming, we should check if the children are
17287 // a work-in-progress set. If so, we need to transfer their effects.
17288 return null;
17289 } else {
17290 // This fiber doesn't have work, but its subtree does. Clone the child
17291 // fibers and continue.
17292 cloneChildFibers(current$$1, workInProgress);
17293 return workInProgress.child;
17294 }
17295}
17296
17297function beginWork(current$$1, workInProgress, renderExpirationTime) {
17298 var updateExpirationTime = workInProgress.expirationTime;
17299
17300 if (current$$1 !== null) {
17301 var oldProps = current$$1.memoizedProps;
17302 var newProps = workInProgress.pendingProps;
17303 if (oldProps === newProps && !hasContextChanged() && updateExpirationTime < renderExpirationTime) {
17304 // This fiber does not have any pending work. Bailout without entering
17305 // the begin phase. There's still some bookkeeping we that needs to be done
17306 // in this optimized path, mostly pushing stuff onto the stack.
17307 switch (workInProgress.tag) {
17308 case HostRoot:
17309 pushHostRootContext(workInProgress);
17310 resetHydrationState();
17311 break;
17312 case HostComponent:
17313 pushHostContext(workInProgress);
17314 break;
17315 case ClassComponent:
17316 {
17317 var Component = workInProgress.type;
17318 if (isContextProvider(Component)) {
17319 pushContextProvider(workInProgress);
17320 }
17321 break;
17322 }
17323 case HostPortal:
17324 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
17325 break;
17326 case ContextProvider:
17327 {
17328 var newValue = workInProgress.memoizedProps.value;
17329 pushProvider(workInProgress, newValue);
17330 break;
17331 }
17332 case Profiler:
17333 if (enableProfilerTimer) {
17334 workInProgress.effectTag |= Update;
17335 }
17336 break;
17337 case SuspenseComponent:
17338 {
17339 var state = workInProgress.memoizedState;
17340 var didTimeout = state !== null;
17341 if (didTimeout) {
17342 // If this boundary is currently timed out, we need to decide
17343 // whether to retry the primary children, or to skip over it and
17344 // go straight to the fallback. Check the priority of the primary
17345 var primaryChildFragment = workInProgress.child;
17346 var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
17347 if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) {
17348 // The primary children have pending work. Use the normal path
17349 // to attempt to render the primary children again.
17350 return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
17351 } else {
17352 // The primary children do not have pending work with sufficient
17353 // priority. Bailout.
17354 var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
17355 if (child !== null) {
17356 // The fallback children have pending work. Skip over the
17357 // primary children and work on the fallback.
17358 return child.sibling;
17359 } else {
17360 return null;
17361 }
17362 }
17363 }
17364 break;
17365 }
17366 }
17367 return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
17368 }
17369 }
17370
17371 // Before entering the begin phase, clear the expiration time.
17372 workInProgress.expirationTime = NoWork;
17373
17374 switch (workInProgress.tag) {
17375 case IndeterminateComponent:
17376 {
17377 var elementType = workInProgress.elementType;
17378 return mountIndeterminateComponent(current$$1, workInProgress, elementType, renderExpirationTime);
17379 }
17380 case LazyComponent:
17381 {
17382 var _elementType = workInProgress.elementType;
17383 return mountLazyComponent(current$$1, workInProgress, _elementType, updateExpirationTime, renderExpirationTime);
17384 }
17385 case FunctionComponent:
17386 {
17387 var _Component = workInProgress.type;
17388 var unresolvedProps = workInProgress.pendingProps;
17389 var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
17390 return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
17391 }
17392 case ClassComponent:
17393 {
17394 var _Component2 = workInProgress.type;
17395 var _unresolvedProps = workInProgress.pendingProps;
17396 var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
17397 return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
17398 }
17399 case HostRoot:
17400 return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
17401 case HostComponent:
17402 return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
17403 case HostText:
17404 return updateHostText(current$$1, workInProgress);
17405 case SuspenseComponent:
17406 return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
17407 case HostPortal:
17408 return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
17409 case ForwardRef:
17410 {
17411 var type = workInProgress.type;
17412 var _unresolvedProps2 = workInProgress.pendingProps;
17413 var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
17414 return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
17415 }
17416 case Fragment:
17417 return updateFragment(current$$1, workInProgress, renderExpirationTime);
17418 case Mode:
17419 return updateMode(current$$1, workInProgress, renderExpirationTime);
17420 case Profiler:
17421 return updateProfiler(current$$1, workInProgress, renderExpirationTime);
17422 case ContextProvider:
17423 return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
17424 case ContextConsumer:
17425 return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
17426 case MemoComponent:
17427 {
17428 var _type2 = workInProgress.type;
17429 var _unresolvedProps3 = workInProgress.pendingProps;
17430 // Resolve outer props first, then resolve inner props.
17431 var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
17432 {
17433 if (workInProgress.type !== workInProgress.elementType) {
17434 var outerPropTypes = _type2.propTypes;
17435 if (outerPropTypes) {
17436 checkPropTypes(outerPropTypes, _resolvedProps3, // Resolved for outer only
17437 'prop', getComponentName(_type2), getCurrentFiberStackInDev);
17438 }
17439 }
17440 }
17441 _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
17442 return updateMemoComponent(current$$1, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
17443 }
17444 case SimpleMemoComponent:
17445 {
17446 return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
17447 }
17448 case IncompleteClassComponent:
17449 {
17450 var _Component3 = workInProgress.type;
17451 var _unresolvedProps4 = workInProgress.pendingProps;
17452 var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
17453 return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
17454 }
17455 default:
17456 invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
17457 }
17458}
17459
17460function markUpdate(workInProgress) {
17461 // Tag the fiber with an update effect. This turns a Placement into
17462 // a PlacementAndUpdate.
17463 workInProgress.effectTag |= Update;
17464}
17465
17466function markRef$1(workInProgress) {
17467 workInProgress.effectTag |= Ref;
17468}
17469
17470var appendAllChildren = void 0;
17471var updateHostContainer = void 0;
17472var updateHostComponent$1 = void 0;
17473var updateHostText$1 = void 0;
17474if (supportsMutation) {
17475 // Mutation mode
17476
17477 appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
17478 // We only have the top Fiber that was created but we need recurse down its
17479 // children to find all the terminal nodes.
17480 var node = workInProgress.child;
17481 while (node !== null) {
17482 if (node.tag === HostComponent || node.tag === HostText) {
17483 appendInitialChild(parent, node.stateNode);
17484 } else if (node.tag === HostPortal) {
17485 // If we have a portal child, then we don't want to traverse
17486 // down its children. Instead, we'll get insertions from each child in
17487 // the portal directly.
17488 } else if (node.child !== null) {
17489 node.child.return = node;
17490 node = node.child;
17491 continue;
17492 }
17493 if (node === workInProgress) {
17494 return;
17495 }
17496 while (node.sibling === null) {
17497 if (node.return === null || node.return === workInProgress) {
17498 return;
17499 }
17500 node = node.return;
17501 }
17502 node.sibling.return = node.return;
17503 node = node.sibling;
17504 }
17505 };
17506
17507 updateHostContainer = function (workInProgress) {
17508 // Noop
17509 };
17510 updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
17511 // If we have an alternate, that means this is an update and we need to
17512 // schedule a side-effect to do the updates.
17513 var oldProps = current.memoizedProps;
17514 if (oldProps === newProps) {
17515 // In mutation mode, this is sufficient for a bailout because
17516 // we won't touch this node even if children changed.
17517 return;
17518 }
17519
17520 // If we get updated because one of our children updated, we don't
17521 // have newProps so we'll have to reuse them.
17522 // TODO: Split the update API as separate for the props vs. children.
17523 // Even better would be if children weren't special cased at all tho.
17524 var instance = workInProgress.stateNode;
17525 var currentHostContext = getHostContext();
17526 // TODO: Experiencing an error where oldProps is null. Suggests a host
17527 // component is hitting the resume path. Figure out why. Possibly
17528 // related to `hidden`.
17529 var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
17530 // TODO: Type this specific to this type of component.
17531 workInProgress.updateQueue = updatePayload;
17532 // If the update payload indicates that there is a change or if there
17533 // is a new ref we mark this as an update. All the work is done in commitWork.
17534 if (updatePayload) {
17535 markUpdate(workInProgress);
17536 }
17537 };
17538 updateHostText$1 = function (current, workInProgress, oldText, newText) {
17539 // If the text differs, mark it as an update. All the work in done in commitWork.
17540 if (oldText !== newText) {
17541 markUpdate(workInProgress);
17542 }
17543 };
17544} else if (supportsPersistence) {
17545 // Persistent host tree mode
17546
17547 appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
17548 // We only have the top Fiber that was created but we need recurse down its
17549 // children to find all the terminal nodes.
17550 var node = workInProgress.child;
17551 while (node !== null) {
17552 // eslint-disable-next-line no-labels
17553 branches: if (node.tag === HostComponent) {
17554 var instance = node.stateNode;
17555 if (needsVisibilityToggle) {
17556 var props = node.memoizedProps;
17557 var type = node.type;
17558 if (isHidden) {
17559 // This child is inside a timed out tree. Hide it.
17560 instance = cloneHiddenInstance(instance, type, props, node);
17561 } else {
17562 // This child was previously inside a timed out tree. If it was not
17563 // updated during this render, it may need to be unhidden. Clone
17564 // again to be sure.
17565 instance = cloneUnhiddenInstance(instance, type, props, node);
17566 }
17567 node.stateNode = instance;
17568 }
17569 appendInitialChild(parent, instance);
17570 } else if (node.tag === HostText) {
17571 var _instance = node.stateNode;
17572 if (needsVisibilityToggle) {
17573 var text = node.memoizedProps;
17574 var rootContainerInstance = getRootHostContainer();
17575 var currentHostContext = getHostContext();
17576 if (isHidden) {
17577 _instance = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
17578 } else {
17579 _instance = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
17580 }
17581 node.stateNode = _instance;
17582 }
17583 appendInitialChild(parent, _instance);
17584 } else if (node.tag === HostPortal) {
17585 // If we have a portal child, then we don't want to traverse
17586 // down its children. Instead, we'll get insertions from each child in
17587 // the portal directly.
17588 } else if (node.tag === SuspenseComponent) {
17589 var current = node.alternate;
17590 if (current !== null) {
17591 var oldState = current.memoizedState;
17592 var newState = node.memoizedState;
17593 var oldIsHidden = oldState !== null;
17594 var newIsHidden = newState !== null;
17595 if (oldIsHidden !== newIsHidden) {
17596 // The placeholder either just timed out or switched back to the normal
17597 // children after having previously timed out. Toggle the visibility of
17598 // the direct host children.
17599 var primaryChildParent = newIsHidden ? node.child : node;
17600 if (primaryChildParent !== null) {
17601 appendAllChildren(parent, primaryChildParent, true, newIsHidden);
17602 }
17603 // eslint-disable-next-line no-labels
17604 break branches;
17605 }
17606 }
17607 if (node.child !== null) {
17608 // Continue traversing like normal
17609 node.child.return = node;
17610 node = node.child;
17611 continue;
17612 }
17613 } else if (node.child !== null) {
17614 node.child.return = node;
17615 node = node.child;
17616 continue;
17617 }
17618 // $FlowFixMe This is correct but Flow is confused by the labeled break.
17619 node = node;
17620 if (node === workInProgress) {
17621 return;
17622 }
17623 while (node.sibling === null) {
17624 if (node.return === null || node.return === workInProgress) {
17625 return;
17626 }
17627 node = node.return;
17628 }
17629 node.sibling.return = node.return;
17630 node = node.sibling;
17631 }
17632 };
17633
17634 // An unfortunate fork of appendAllChildren because we have two different parent types.
17635 var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
17636 // We only have the top Fiber that was created but we need recurse down its
17637 // children to find all the terminal nodes.
17638 var node = workInProgress.child;
17639 while (node !== null) {
17640 // eslint-disable-next-line no-labels
17641 branches: if (node.tag === HostComponent) {
17642 var instance = node.stateNode;
17643 if (needsVisibilityToggle) {
17644 var props = node.memoizedProps;
17645 var type = node.type;
17646 if (isHidden) {
17647 // This child is inside a timed out tree. Hide it.
17648 instance = cloneHiddenInstance(instance, type, props, node);
17649 } else {
17650 // This child was previously inside a timed out tree. If it was not
17651 // updated during this render, it may need to be unhidden. Clone
17652 // again to be sure.
17653 instance = cloneUnhiddenInstance(instance, type, props, node);
17654 }
17655 node.stateNode = instance;
17656 }
17657 appendChildToContainerChildSet(containerChildSet, instance);
17658 } else if (node.tag === HostText) {
17659 var _instance2 = node.stateNode;
17660 if (needsVisibilityToggle) {
17661 var text = node.memoizedProps;
17662 var rootContainerInstance = getRootHostContainer();
17663 var currentHostContext = getHostContext();
17664 if (isHidden) {
17665 _instance2 = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
17666 } else {
17667 _instance2 = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
17668 }
17669 node.stateNode = _instance2;
17670 }
17671 appendChildToContainerChildSet(containerChildSet, _instance2);
17672 } else if (node.tag === HostPortal) {
17673 // If we have a portal child, then we don't want to traverse
17674 // down its children. Instead, we'll get insertions from each child in
17675 // the portal directly.
17676 } else if (node.tag === SuspenseComponent) {
17677 var current = node.alternate;
17678 if (current !== null) {
17679 var oldState = current.memoizedState;
17680 var newState = node.memoizedState;
17681 var oldIsHidden = oldState !== null;
17682 var newIsHidden = newState !== null;
17683 if (oldIsHidden !== newIsHidden) {
17684 // The placeholder either just timed out or switched back to the normal
17685 // children after having previously timed out. Toggle the visibility of
17686 // the direct host children.
17687 var primaryChildParent = newIsHidden ? node.child : node;
17688 if (primaryChildParent !== null) {
17689 appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
17690 }
17691 // eslint-disable-next-line no-labels
17692 break branches;
17693 }
17694 }
17695 if (node.child !== null) {
17696 // Continue traversing like normal
17697 node.child.return = node;
17698 node = node.child;
17699 continue;
17700 }
17701 } else if (node.child !== null) {
17702 node.child.return = node;
17703 node = node.child;
17704 continue;
17705 }
17706 // $FlowFixMe This is correct but Flow is confused by the labeled break.
17707 node = node;
17708 if (node === workInProgress) {
17709 return;
17710 }
17711 while (node.sibling === null) {
17712 if (node.return === null || node.return === workInProgress) {
17713 return;
17714 }
17715 node = node.return;
17716 }
17717 node.sibling.return = node.return;
17718 node = node.sibling;
17719 }
17720 };
17721 updateHostContainer = function (workInProgress) {
17722 var portalOrRoot = workInProgress.stateNode;
17723 var childrenUnchanged = workInProgress.firstEffect === null;
17724 if (childrenUnchanged) {
17725 // No changes, just reuse the existing instance.
17726 } else {
17727 var container = portalOrRoot.containerInfo;
17728 var newChildSet = createContainerChildSet(container);
17729 // If children might have changed, we have to add them all to the set.
17730 appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
17731 portalOrRoot.pendingChildren = newChildSet;
17732 // Schedule an update on the container to swap out the container.
17733 markUpdate(workInProgress);
17734 finalizeContainerChildren(container, newChildSet);
17735 }
17736 };
17737 updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
17738 var currentInstance = current.stateNode;
17739 var oldProps = current.memoizedProps;
17740 // If there are no effects associated with this node, then none of our children had any updates.
17741 // This guarantees that we can reuse all of them.
17742 var childrenUnchanged = workInProgress.firstEffect === null;
17743 if (childrenUnchanged && oldProps === newProps) {
17744 // No changes, just reuse the existing instance.
17745 // Note that this might release a previous clone.
17746 workInProgress.stateNode = currentInstance;
17747 return;
17748 }
17749 var recyclableInstance = workInProgress.stateNode;
17750 var currentHostContext = getHostContext();
17751 var updatePayload = null;
17752 if (oldProps !== newProps) {
17753 updatePayload = prepareUpdate(recyclableInstance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
17754 }
17755 if (childrenUnchanged && updatePayload === null) {
17756 // No changes, just reuse the existing instance.
17757 // Note that this might release a previous clone.
17758 workInProgress.stateNode = currentInstance;
17759 return;
17760 }
17761 var newInstance = cloneInstance(currentInstance, updatePayload, type, oldProps, newProps, workInProgress, childrenUnchanged, recyclableInstance);
17762 if (finalizeInitialChildren(newInstance, type, newProps, rootContainerInstance, currentHostContext)) {
17763 markUpdate(workInProgress);
17764 }
17765 workInProgress.stateNode = newInstance;
17766 if (childrenUnchanged) {
17767 // If there are no other effects in this tree, we need to flag this node as having one.
17768 // Even though we're not going to use it for anything.
17769 // Otherwise parents won't know that there are new children to propagate upwards.
17770 markUpdate(workInProgress);
17771 } else {
17772 // If children might have changed, we have to add them all to the set.
17773 appendAllChildren(newInstance, workInProgress, false, false);
17774 }
17775 };
17776 updateHostText$1 = function (current, workInProgress, oldText, newText) {
17777 if (oldText !== newText) {
17778 // If the text content differs, we'll create a new text instance for it.
17779 var rootContainerInstance = getRootHostContainer();
17780 var currentHostContext = getHostContext();
17781 workInProgress.stateNode = createTextInstance(newText, rootContainerInstance, currentHostContext, workInProgress);
17782 // We'll have to mark it as having an effect, even though we won't use the effect for anything.
17783 // This lets the parents know that at least one of their children has changed.
17784 markUpdate(workInProgress);
17785 }
17786 };
17787} else {
17788 // No host operations
17789 updateHostContainer = function (workInProgress) {
17790 // Noop
17791 };
17792 updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
17793 // Noop
17794 };
17795 updateHostText$1 = function (current, workInProgress, oldText, newText) {
17796 // Noop
17797 };
17798}
17799
17800function completeWork(current, workInProgress, renderExpirationTime) {
17801 var newProps = workInProgress.pendingProps;
17802
17803 switch (workInProgress.tag) {
17804 case IndeterminateComponent:
17805 break;
17806 case LazyComponent:
17807 break;
17808 case SimpleMemoComponent:
17809 case FunctionComponent:
17810 break;
17811 case ClassComponent:
17812 {
17813 var Component = workInProgress.type;
17814 if (isContextProvider(Component)) {
17815 popContext(workInProgress);
17816 }
17817 break;
17818 }
17819 case HostRoot:
17820 {
17821 popHostContainer(workInProgress);
17822 popTopLevelContextObject(workInProgress);
17823 var fiberRoot = workInProgress.stateNode;
17824 if (fiberRoot.pendingContext) {
17825 fiberRoot.context = fiberRoot.pendingContext;
17826 fiberRoot.pendingContext = null;
17827 }
17828 if (current === null || current.child === null) {
17829 // If we hydrated, pop so that we can delete any remaining children
17830 // that weren't hydrated.
17831 popHydrationState(workInProgress);
17832 // This resets the hacky state to fix isMounted before committing.
17833 // TODO: Delete this when we delete isMounted and findDOMNode.
17834 workInProgress.effectTag &= ~Placement;
17835 }
17836 updateHostContainer(workInProgress);
17837 break;
17838 }
17839 case HostComponent:
17840 {
17841 popHostContext(workInProgress);
17842 var rootContainerInstance = getRootHostContainer();
17843 var type = workInProgress.type;
17844 if (current !== null && workInProgress.stateNode != null) {
17845 updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
17846
17847 if (current.ref !== workInProgress.ref) {
17848 markRef$1(workInProgress);
17849 }
17850 } else {
17851 if (!newProps) {
17852 !(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;
17853 // This can happen when we abort work.
17854 break;
17855 }
17856
17857 var currentHostContext = getHostContext();
17858 // TODO: Move createInstance to beginWork and keep it on a context
17859 // "stack" as the parent. Then append children as we go in beginWork
17860 // or completeWork depending on we want to add then top->down or
17861 // bottom->up. Top->down is faster in IE11.
17862 var wasHydrated = popHydrationState(workInProgress);
17863 if (wasHydrated) {
17864 // TODO: Move this and createInstance step into the beginPhase
17865 // to consolidate.
17866 if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) {
17867 // If changes to the hydrated node needs to be applied at the
17868 // commit-phase we mark this as such.
17869 markUpdate(workInProgress);
17870 }
17871 } else {
17872 var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
17873
17874 appendAllChildren(instance, workInProgress, false, false);
17875
17876 // Certain renderers require commit-time effects for initial mount.
17877 // (eg DOM renderer supports auto-focus for certain elements).
17878 // Make sure such renderers get scheduled for later work.
17879 if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance, currentHostContext)) {
17880 markUpdate(workInProgress);
17881 }
17882 workInProgress.stateNode = instance;
17883 }
17884
17885 if (workInProgress.ref !== null) {
17886 // If there is a ref on a host node we need to schedule a callback
17887 markRef$1(workInProgress);
17888 }
17889 }
17890 break;
17891 }
17892 case HostText:
17893 {
17894 var newText = newProps;
17895 if (current && workInProgress.stateNode != null) {
17896 var oldText = current.memoizedProps;
17897 // If we have an alternate, that means this is an update and we need
17898 // to schedule a side-effect to do the updates.
17899 updateHostText$1(current, workInProgress, oldText, newText);
17900 } else {
17901 if (typeof newText !== 'string') {
17902 !(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;
17903 // This can happen when we abort work.
17904 }
17905 var _rootContainerInstance = getRootHostContainer();
17906 var _currentHostContext = getHostContext();
17907 var _wasHydrated = popHydrationState(workInProgress);
17908 if (_wasHydrated) {
17909 if (prepareToHydrateHostTextInstance(workInProgress)) {
17910 markUpdate(workInProgress);
17911 }
17912 } else {
17913 workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
17914 }
17915 }
17916 break;
17917 }
17918 case ForwardRef:
17919 break;
17920 case SuspenseComponent:
17921 {
17922 var nextState = workInProgress.memoizedState;
17923 if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
17924 // Something suspended. Re-render with the fallback children.
17925 workInProgress.expirationTime = renderExpirationTime;
17926 // Do not reset the effect list.
17927 return workInProgress;
17928 }
17929
17930 var nextDidTimeout = nextState !== null;
17931 var prevDidTimeout = current !== null && current.memoizedState !== null;
17932
17933 if (current !== null && !nextDidTimeout && prevDidTimeout) {
17934 // We just switched from the fallback to the normal children. Delete
17935 // the fallback.
17936 // TODO: Would it be better to store the fallback fragment on
17937 var currentFallbackChild = current.child.sibling;
17938 if (currentFallbackChild !== null) {
17939 // Deletions go at the beginning of the return fiber's effect list
17940 var first = workInProgress.firstEffect;
17941 if (first !== null) {
17942 workInProgress.firstEffect = currentFallbackChild;
17943 currentFallbackChild.nextEffect = first;
17944 } else {
17945 workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild;
17946 currentFallbackChild.nextEffect = null;
17947 }
17948 currentFallbackChild.effectTag = Deletion;
17949 }
17950 }
17951
17952 // The children either timed out after previously being visible, or
17953 // were restored after previously being hidden. Schedule an effect
17954 // to update their visiblity.
17955 if (
17956 //
17957 nextDidTimeout !== prevDidTimeout ||
17958 // Outside concurrent mode, the primary children commit in an
17959 // inconsistent state, even if they are hidden. So if they are hidden,
17960 // we need to schedule an effect to re-hide them, just in case.
17961 (workInProgress.effectTag & ConcurrentMode) === NoContext && nextDidTimeout) {
17962 workInProgress.effectTag |= Update;
17963 }
17964 break;
17965 }
17966 case Fragment:
17967 break;
17968 case Mode:
17969 break;
17970 case Profiler:
17971 break;
17972 case HostPortal:
17973 popHostContainer(workInProgress);
17974 updateHostContainer(workInProgress);
17975 break;
17976 case ContextProvider:
17977 // Pop provider fiber
17978 popProvider(workInProgress);
17979 break;
17980 case ContextConsumer:
17981 break;
17982 case MemoComponent:
17983 break;
17984 case IncompleteClassComponent:
17985 {
17986 // Same as class component case. I put it down here so that the tags are
17987 // sequential to ensure this switch is compiled to a jump table.
17988 var _Component = workInProgress.type;
17989 if (isContextProvider(_Component)) {
17990 popContext(workInProgress);
17991 }
17992 break;
17993 }
17994 default:
17995 invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
17996 }
17997
17998 return null;
17999}
18000
18001function shouldCaptureSuspense(workInProgress) {
18002 // In order to capture, the Suspense component must have a fallback prop.
18003 if (workInProgress.memoizedProps.fallback === undefined) {
18004 return false;
18005 }
18006 // If it was the primary children that just suspended, capture and render the
18007 // fallback. Otherwise, don't capture and bubble to the next boundary.
18008 var nextState = workInProgress.memoizedState;
18009 return nextState === null;
18010}
18011
18012// This module is forked in different environments.
18013// By default, return `true` to log errors to the console.
18014// Forks can return `false` if this isn't desirable.
18015function showErrorDialog(capturedError) {
18016 return true;
18017}
18018
18019function logCapturedError(capturedError) {
18020 var logError = showErrorDialog(capturedError);
18021
18022 // Allow injected showErrorDialog() to prevent default console.error logging.
18023 // This enables renderers like ReactNative to better manage redbox behavior.
18024 if (logError === false) {
18025 return;
18026 }
18027
18028 var error = capturedError.error;
18029 {
18030 var componentName = capturedError.componentName,
18031 componentStack = capturedError.componentStack,
18032 errorBoundaryName = capturedError.errorBoundaryName,
18033 errorBoundaryFound = capturedError.errorBoundaryFound,
18034 willRetry = capturedError.willRetry;
18035
18036 // Browsers support silencing uncaught errors by calling
18037 // `preventDefault()` in window `error` handler.
18038 // We record this information as an expando on the error.
18039
18040 if (error != null && error._suppressLogging) {
18041 if (errorBoundaryFound && willRetry) {
18042 // The error is recoverable and was silenced.
18043 // Ignore it and don't print the stack addendum.
18044 // This is handy for testing error boundaries without noise.
18045 return;
18046 }
18047 // The error is fatal. Since the silencing might have
18048 // been accidental, we'll surface it anyway.
18049 // However, the browser would have silenced the original error
18050 // so we'll print it first, and then print the stack addendum.
18051 console.error(error);
18052 // For a more detailed description of this block, see:
18053 // https://github.com/facebook/react/pull/13384
18054 }
18055
18056 var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
18057
18058 var errorBoundaryMessage = void 0;
18059 // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
18060 if (errorBoundaryFound && errorBoundaryName) {
18061 if (willRetry) {
18062 errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
18063 } else {
18064 errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
18065 }
18066 } else {
18067 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.';
18068 }
18069 var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
18070
18071 // In development, we provide our own message with just the component stack.
18072 // We don't include the original error message and JS stack because the browser
18073 // has already printed it. Even if the application swallows the error, it is still
18074 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
18075 console.error(combinedMessage);
18076 }
18077}
18078
18079var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
18080{
18081 didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
18082}
18083
18084var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
18085
18086function logError(boundary, errorInfo) {
18087 var source = errorInfo.source;
18088 var stack = errorInfo.stack;
18089 if (stack === null && source !== null) {
18090 stack = getStackByFiberInDevAndProd(source);
18091 }
18092
18093 var capturedError = {
18094 componentName: source !== null ? getComponentName(source.type) : null,
18095 componentStack: stack !== null ? stack : '',
18096 error: errorInfo.value,
18097 errorBoundary: null,
18098 errorBoundaryName: null,
18099 errorBoundaryFound: false,
18100 willRetry: false
18101 };
18102
18103 if (boundary !== null && boundary.tag === ClassComponent) {
18104 capturedError.errorBoundary = boundary.stateNode;
18105 capturedError.errorBoundaryName = getComponentName(boundary.type);
18106 capturedError.errorBoundaryFound = true;
18107 capturedError.willRetry = true;
18108 }
18109
18110 try {
18111 logCapturedError(capturedError);
18112 } catch (e) {
18113 // This method must not throw, or React internal state will get messed up.
18114 // If console.error is overridden, or logCapturedError() shows a dialog that throws,
18115 // we want to report this error outside of the normal stack as a last resort.
18116 // https://github.com/facebook/react/issues/13188
18117 setTimeout(function () {
18118 throw e;
18119 });
18120 }
18121}
18122
18123var callComponentWillUnmountWithTimer = function (current$$1, instance) {
18124 startPhaseTimer(current$$1, 'componentWillUnmount');
18125 instance.props = current$$1.memoizedProps;
18126 instance.state = current$$1.memoizedState;
18127 instance.componentWillUnmount();
18128 stopPhaseTimer();
18129};
18130
18131// Capture errors so they don't interrupt unmounting.
18132function safelyCallComponentWillUnmount(current$$1, instance) {
18133 {
18134 invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current$$1, instance);
18135 if (hasCaughtError()) {
18136 var unmountError = clearCaughtError();
18137 captureCommitPhaseError(current$$1, unmountError);
18138 }
18139 }
18140}
18141
18142function safelyDetachRef(current$$1) {
18143 var ref = current$$1.ref;
18144 if (ref !== null) {
18145 if (typeof ref === 'function') {
18146 {
18147 invokeGuardedCallback(null, ref, null, null);
18148 if (hasCaughtError()) {
18149 var refError = clearCaughtError();
18150 captureCommitPhaseError(current$$1, refError);
18151 }
18152 }
18153 } else {
18154 ref.current = null;
18155 }
18156 }
18157}
18158
18159function safelyCallDestroy(current$$1, destroy) {
18160 {
18161 invokeGuardedCallback(null, destroy, null);
18162 if (hasCaughtError()) {
18163 var error = clearCaughtError();
18164 captureCommitPhaseError(current$$1, error);
18165 }
18166 }
18167}
18168
18169function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
18170 switch (finishedWork.tag) {
18171 case FunctionComponent:
18172 case ForwardRef:
18173 case SimpleMemoComponent:
18174 {
18175 commitHookEffectList(UnmountSnapshot, NoEffect$1, finishedWork);
18176 return;
18177 }
18178 case ClassComponent:
18179 {
18180 if (finishedWork.effectTag & Snapshot) {
18181 if (current$$1 !== null) {
18182 var prevProps = current$$1.memoizedProps;
18183 var prevState = current$$1.memoizedState;
18184 startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
18185 var instance = finishedWork.stateNode;
18186 // We could update instance props and state here,
18187 // but instead we rely on them being set during last render.
18188 // TODO: revisit this when we implement resuming.
18189 {
18190 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
18191 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
18192 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
18193 }
18194 }
18195 var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
18196 {
18197 var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
18198 if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
18199 didWarnSet.add(finishedWork.type);
18200 warningWithoutStack$1(false, '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type));
18201 }
18202 }
18203 instance.__reactInternalSnapshotBeforeUpdate = snapshot;
18204 stopPhaseTimer();
18205 }
18206 }
18207 return;
18208 }
18209 case HostRoot:
18210 case HostComponent:
18211 case HostText:
18212 case HostPortal:
18213 case IncompleteClassComponent:
18214 // Nothing to do for these component types
18215 return;
18216 default:
18217 {
18218 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.');
18219 }
18220 }
18221}
18222
18223function commitHookEffectList(unmountTag, mountTag, finishedWork) {
18224 if (!enableHooks) {
18225 return;
18226 }
18227 var updateQueue = finishedWork.updateQueue;
18228 var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
18229 if (lastEffect !== null) {
18230 var firstEffect = lastEffect.next;
18231 var effect = firstEffect;
18232 do {
18233 if ((effect.tag & unmountTag) !== NoEffect$1) {
18234 // Unmount
18235 var destroy = effect.destroy;
18236 effect.destroy = null;
18237 if (destroy !== null) {
18238 destroy();
18239 }
18240 }
18241 if ((effect.tag & mountTag) !== NoEffect$1) {
18242 // Mount
18243 var create = effect.create;
18244 var _destroy = create();
18245 if (typeof _destroy !== 'function') {
18246 {
18247 if (_destroy !== null && _destroy !== undefined) {
18248 warningWithoutStack$1(false, 'useEffect function must return a cleanup function or ' + 'nothing.%s%s', typeof _destroy.then === 'function' ? '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, you may write an async function separately ' + 'and then call it from inside the effect:\n\n' + 'async function fetchComment(commentId) {\n' + ' // You can await here\n' + '}\n\n' + 'useEffect(() => {\n' + ' fetchComment(commentId);\n' + '}, [commentId]);\n\n' + 'In the future, React will provide a more idiomatic solution for data fetching ' + "that doesn't involve writing effects manually." : '', getStackByFiberInDevAndProd(finishedWork));
18249 }
18250 }
18251 _destroy = null;
18252 }
18253 effect.destroy = _destroy;
18254 }
18255 effect = effect.next;
18256 } while (effect !== firstEffect);
18257 }
18258}
18259
18260function commitPassiveHookEffects(finishedWork) {
18261 commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork);
18262 commitHookEffectList(NoEffect$1, MountPassive, finishedWork);
18263}
18264
18265function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
18266 switch (finishedWork.tag) {
18267 case FunctionComponent:
18268 case ForwardRef:
18269 case SimpleMemoComponent:
18270 {
18271 commitHookEffectList(UnmountLayout, MountLayout, finishedWork);
18272 break;
18273 }
18274 case ClassComponent:
18275 {
18276 var instance = finishedWork.stateNode;
18277 if (finishedWork.effectTag & Update) {
18278 if (current$$1 === null) {
18279 startPhaseTimer(finishedWork, 'componentDidMount');
18280 // We could update instance props and state here,
18281 // but instead we rely on them being set during last render.
18282 // TODO: revisit this when we implement resuming.
18283 {
18284 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
18285 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
18286 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
18287 }
18288 }
18289 instance.componentDidMount();
18290 stopPhaseTimer();
18291 } else {
18292 var prevProps = finishedWork.elementType === finishedWork.type ? current$$1.memoizedProps : resolveDefaultProps(finishedWork.type, current$$1.memoizedProps);
18293 var prevState = current$$1.memoizedState;
18294 startPhaseTimer(finishedWork, 'componentDidUpdate');
18295 // We could update instance props and state here,
18296 // but instead we rely on them being set during last render.
18297 // TODO: revisit this when we implement resuming.
18298 {
18299 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
18300 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
18301 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
18302 }
18303 }
18304 instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
18305 stopPhaseTimer();
18306 }
18307 }
18308 var updateQueue = finishedWork.updateQueue;
18309 if (updateQueue !== null) {
18310 {
18311 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
18312 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
18313 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
18314 }
18315 }
18316 // We could update instance props and state here,
18317 // but instead we rely on them being set during last render.
18318 // TODO: revisit this when we implement resuming.
18319 commitUpdateQueue(finishedWork, updateQueue, instance, committedExpirationTime);
18320 }
18321 return;
18322 }
18323 case HostRoot:
18324 {
18325 var _updateQueue = finishedWork.updateQueue;
18326 if (_updateQueue !== null) {
18327 var _instance = null;
18328 if (finishedWork.child !== null) {
18329 switch (finishedWork.child.tag) {
18330 case HostComponent:
18331 _instance = getPublicInstance(finishedWork.child.stateNode);
18332 break;
18333 case ClassComponent:
18334 _instance = finishedWork.child.stateNode;
18335 break;
18336 }
18337 }
18338 commitUpdateQueue(finishedWork, _updateQueue, _instance, committedExpirationTime);
18339 }
18340 return;
18341 }
18342 case HostComponent:
18343 {
18344 var _instance2 = finishedWork.stateNode;
18345
18346 // Renderers may schedule work to be done after host components are mounted
18347 // (eg DOM renderer may schedule auto-focus for inputs and form controls).
18348 // These effects should only be committed when components are first mounted,
18349 // aka when there is no current/alternate.
18350 if (current$$1 === null && finishedWork.effectTag & Update) {
18351 var type = finishedWork.type;
18352 var props = finishedWork.memoizedProps;
18353 commitMount(_instance2, type, props, finishedWork);
18354 }
18355
18356 return;
18357 }
18358 case HostText:
18359 {
18360 // We have no life-cycles associated with text.
18361 return;
18362 }
18363 case HostPortal:
18364 {
18365 // We have no life-cycles associated with portals.
18366 return;
18367 }
18368 case Profiler:
18369 {
18370 if (enableProfilerTimer) {
18371 var onRender = finishedWork.memoizedProps.onRender;
18372
18373 if (enableSchedulerTracing) {
18374 onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
18375 } else {
18376 onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime());
18377 }
18378 }
18379 return;
18380 }
18381 case SuspenseComponent:
18382 break;
18383 case IncompleteClassComponent:
18384 break;
18385 default:
18386 {
18387 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.');
18388 }
18389 }
18390}
18391
18392function hideOrUnhideAllChildren(finishedWork, isHidden) {
18393 if (supportsMutation) {
18394 // We only have the top Fiber that was inserted but we need recurse down its
18395 var node = finishedWork;
18396 while (true) {
18397 if (node.tag === HostComponent) {
18398 var instance = node.stateNode;
18399 if (isHidden) {
18400 hideInstance(instance);
18401 } else {
18402 unhideInstance(node.stateNode, node.memoizedProps);
18403 }
18404 } else if (node.tag === HostText) {
18405 var _instance3 = node.stateNode;
18406 if (isHidden) {
18407 hideTextInstance(_instance3);
18408 } else {
18409 unhideTextInstance(_instance3, node.memoizedProps);
18410 }
18411 } else if (node.tag === SuspenseComponent && node.memoizedState !== null) {
18412 // Found a nested Suspense component that timed out. Skip over the
18413 var fallbackChildFragment = node.child.sibling;
18414 fallbackChildFragment.return = node;
18415 node = fallbackChildFragment;
18416 continue;
18417 } else if (node.child !== null) {
18418 node.child.return = node;
18419 node = node.child;
18420 continue;
18421 }
18422 if (node === finishedWork) {
18423 return;
18424 }
18425 while (node.sibling === null) {
18426 if (node.return === null || node.return === finishedWork) {
18427 return;
18428 }
18429 node = node.return;
18430 }
18431 node.sibling.return = node.return;
18432 node = node.sibling;
18433 }
18434 }
18435}
18436
18437function commitAttachRef(finishedWork) {
18438 var ref = finishedWork.ref;
18439 if (ref !== null) {
18440 var instance = finishedWork.stateNode;
18441 var instanceToUse = void 0;
18442 switch (finishedWork.tag) {
18443 case HostComponent:
18444 instanceToUse = getPublicInstance(instance);
18445 break;
18446 default:
18447 instanceToUse = instance;
18448 }
18449 if (typeof ref === 'function') {
18450 ref(instanceToUse);
18451 } else {
18452 {
18453 if (!ref.hasOwnProperty('current')) {
18454 warningWithoutStack$1(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
18455 }
18456 }
18457
18458 ref.current = instanceToUse;
18459 }
18460 }
18461}
18462
18463function commitDetachRef(current$$1) {
18464 var currentRef = current$$1.ref;
18465 if (currentRef !== null) {
18466 if (typeof currentRef === 'function') {
18467 currentRef(null);
18468 } else {
18469 currentRef.current = null;
18470 }
18471 }
18472}
18473
18474// User-originating errors (lifecycles and refs) should not interrupt
18475// deletion, so don't let them throw. Host-originating errors should
18476// interrupt deletion, so it's okay
18477function commitUnmount(current$$1) {
18478 onCommitUnmount(current$$1);
18479
18480 switch (current$$1.tag) {
18481 case FunctionComponent:
18482 case ForwardRef:
18483 case MemoComponent:
18484 case SimpleMemoComponent:
18485 {
18486 var updateQueue = current$$1.updateQueue;
18487 if (updateQueue !== null) {
18488 var lastEffect = updateQueue.lastEffect;
18489 if (lastEffect !== null) {
18490 var firstEffect = lastEffect.next;
18491 var effect = firstEffect;
18492 do {
18493 var destroy = effect.destroy;
18494 if (destroy !== null) {
18495 safelyCallDestroy(current$$1, destroy);
18496 }
18497 effect = effect.next;
18498 } while (effect !== firstEffect);
18499 }
18500 }
18501 break;
18502 }
18503 case ClassComponent:
18504 {
18505 safelyDetachRef(current$$1);
18506 var instance = current$$1.stateNode;
18507 if (typeof instance.componentWillUnmount === 'function') {
18508 safelyCallComponentWillUnmount(current$$1, instance);
18509 }
18510 return;
18511 }
18512 case HostComponent:
18513 {
18514 safelyDetachRef(current$$1);
18515 return;
18516 }
18517 case HostPortal:
18518 {
18519 // TODO: this is recursive.
18520 // We are also not using this parent because
18521 // the portal will get pushed immediately.
18522 if (supportsMutation) {
18523 unmountHostComponents(current$$1);
18524 } else if (supportsPersistence) {
18525 emptyPortalContainer(current$$1);
18526 }
18527 return;
18528 }
18529 }
18530}
18531
18532function commitNestedUnmounts(root) {
18533 // While we're inside a removed host node we don't want to call
18534 // removeChild on the inner nodes because they're removed by the top
18535 // call anyway. We also want to call componentWillUnmount on all
18536 // composites before this host node is removed from the tree. Therefore
18537 var node = root;
18538 while (true) {
18539 commitUnmount(node);
18540 // Visit children because they may contain more composite or host nodes.
18541 // Skip portals because commitUnmount() currently visits them recursively.
18542 if (node.child !== null && (
18543 // If we use mutation we drill down into portals using commitUnmount above.
18544 // If we don't use mutation we drill down into portals here instead.
18545 !supportsMutation || node.tag !== HostPortal)) {
18546 node.child.return = node;
18547 node = node.child;
18548 continue;
18549 }
18550 if (node === root) {
18551 return;
18552 }
18553 while (node.sibling === null) {
18554 if (node.return === null || node.return === root) {
18555 return;
18556 }
18557 node = node.return;
18558 }
18559 node.sibling.return = node.return;
18560 node = node.sibling;
18561 }
18562}
18563
18564function detachFiber(current$$1) {
18565 // Cut off the return pointers to disconnect it from the tree. Ideally, we
18566 // should clear the child pointer of the parent alternate to let this
18567 // get GC:ed but we don't know which for sure which parent is the current
18568 // one so we'll settle for GC:ing the subtree of this child. This child
18569 // itself will be GC:ed when the parent updates the next time.
18570 current$$1.return = null;
18571 current$$1.child = null;
18572 current$$1.memoizedState = null;
18573 current$$1.updateQueue = null;
18574 var alternate = current$$1.alternate;
18575 if (alternate !== null) {
18576 alternate.return = null;
18577 alternate.child = null;
18578 alternate.memoizedState = null;
18579 alternate.updateQueue = null;
18580 }
18581}
18582
18583function emptyPortalContainer(current$$1) {
18584 if (!supportsPersistence) {
18585 return;
18586 }
18587
18588 var portal = current$$1.stateNode;
18589 var containerInfo = portal.containerInfo;
18590
18591 var emptyChildSet = createContainerChildSet(containerInfo);
18592 replaceContainerChildren(containerInfo, emptyChildSet);
18593}
18594
18595function commitContainer(finishedWork) {
18596 if (!supportsPersistence) {
18597 return;
18598 }
18599
18600 switch (finishedWork.tag) {
18601 case ClassComponent:
18602 {
18603 return;
18604 }
18605 case HostComponent:
18606 {
18607 return;
18608 }
18609 case HostText:
18610 {
18611 return;
18612 }
18613 case HostRoot:
18614 case HostPortal:
18615 {
18616 var portalOrRoot = finishedWork.stateNode;
18617 var containerInfo = portalOrRoot.containerInfo,
18618 _pendingChildren = portalOrRoot.pendingChildren;
18619
18620 replaceContainerChildren(containerInfo, _pendingChildren);
18621 return;
18622 }
18623 default:
18624 {
18625 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.');
18626 }
18627 }
18628}
18629
18630function getHostParentFiber(fiber) {
18631 var parent = fiber.return;
18632 while (parent !== null) {
18633 if (isHostParent(parent)) {
18634 return parent;
18635 }
18636 parent = parent.return;
18637 }
18638 invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.');
18639}
18640
18641function isHostParent(fiber) {
18642 return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
18643}
18644
18645function getHostSibling(fiber) {
18646 // We're going to search forward into the tree until we find a sibling host
18647 // node. Unfortunately, if multiple insertions are done in a row we have to
18648 // search past them. This leads to exponential search for the next sibling.
18649 var node = fiber;
18650 siblings: while (true) {
18651 // If we didn't find anything, let's try the next sibling.
18652 while (node.sibling === null) {
18653 if (node.return === null || isHostParent(node.return)) {
18654 // If we pop out of the root or hit the parent the fiber we are the
18655 // last sibling.
18656 return null;
18657 }
18658 node = node.return;
18659 }
18660 node.sibling.return = node.return;
18661 node = node.sibling;
18662 while (node.tag !== HostComponent && node.tag !== HostText) {
18663 // If it is not host node and, we might have a host node inside it.
18664 // Try to search down until we find one.
18665 if (node.effectTag & Placement) {
18666 // If we don't have a child, try the siblings instead.
18667 continue siblings;
18668 }
18669 // If we don't have a child, try the siblings instead.
18670 // We also skip portals because they are not part of this host tree.
18671 if (node.child === null || node.tag === HostPortal) {
18672 continue siblings;
18673 } else {
18674 node.child.return = node;
18675 node = node.child;
18676 }
18677 }
18678 // Check if this host node is stable or about to be placed.
18679 if (!(node.effectTag & Placement)) {
18680 // Found it!
18681 return node.stateNode;
18682 }
18683 }
18684}
18685
18686function commitPlacement(finishedWork) {
18687 if (!supportsMutation) {
18688 return;
18689 }
18690
18691 // Recursively insert all host nodes into the parent.
18692 var parentFiber = getHostParentFiber(finishedWork);
18693
18694 // Note: these two variables *must* always be updated together.
18695 var parent = void 0;
18696 var isContainer = void 0;
18697
18698 switch (parentFiber.tag) {
18699 case HostComponent:
18700 parent = parentFiber.stateNode;
18701 isContainer = false;
18702 break;
18703 case HostRoot:
18704 parent = parentFiber.stateNode.containerInfo;
18705 isContainer = true;
18706 break;
18707 case HostPortal:
18708 parent = parentFiber.stateNode.containerInfo;
18709 isContainer = true;
18710 break;
18711 default:
18712 invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.');
18713 }
18714 if (parentFiber.effectTag & ContentReset) {
18715 // Reset the text content of the parent before doing any insertions
18716 resetTextContent(parent);
18717 // Clear ContentReset from the effect tag
18718 parentFiber.effectTag &= ~ContentReset;
18719 }
18720
18721 var before = getHostSibling(finishedWork);
18722 // We only have the top Fiber that was inserted but we need recurse down its
18723 // children to find all the terminal nodes.
18724 var node = finishedWork;
18725 while (true) {
18726 if (node.tag === HostComponent || node.tag === HostText) {
18727 if (before) {
18728 if (isContainer) {
18729 insertInContainerBefore(parent, node.stateNode, before);
18730 } else {
18731 insertBefore(parent, node.stateNode, before);
18732 }
18733 } else {
18734 if (isContainer) {
18735 appendChildToContainer(parent, node.stateNode);
18736 } else {
18737 appendChild(parent, node.stateNode);
18738 }
18739 }
18740 } else if (node.tag === HostPortal) {
18741 // If the insertion itself is a portal, then we don't want to traverse
18742 // down its children. Instead, we'll get insertions from each child in
18743 // the portal directly.
18744 } else if (node.child !== null) {
18745 node.child.return = node;
18746 node = node.child;
18747 continue;
18748 }
18749 if (node === finishedWork) {
18750 return;
18751 }
18752 while (node.sibling === null) {
18753 if (node.return === null || node.return === finishedWork) {
18754 return;
18755 }
18756 node = node.return;
18757 }
18758 node.sibling.return = node.return;
18759 node = node.sibling;
18760 }
18761}
18762
18763function unmountHostComponents(current$$1) {
18764 // We only have the top Fiber that was deleted but we need recurse down its
18765 var node = current$$1;
18766
18767 // Each iteration, currentParent is populated with node's host parent if not
18768 // currentParentIsValid.
18769 var currentParentIsValid = false;
18770
18771 // Note: these two variables *must* always be updated together.
18772 var currentParent = void 0;
18773 var currentParentIsContainer = void 0;
18774
18775 while (true) {
18776 if (!currentParentIsValid) {
18777 var parent = node.return;
18778 findParent: while (true) {
18779 !(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;
18780 switch (parent.tag) {
18781 case HostComponent:
18782 currentParent = parent.stateNode;
18783 currentParentIsContainer = false;
18784 break findParent;
18785 case HostRoot:
18786 currentParent = parent.stateNode.containerInfo;
18787 currentParentIsContainer = true;
18788 break findParent;
18789 case HostPortal:
18790 currentParent = parent.stateNode.containerInfo;
18791 currentParentIsContainer = true;
18792 break findParent;
18793 }
18794 parent = parent.return;
18795 }
18796 currentParentIsValid = true;
18797 }
18798
18799 if (node.tag === HostComponent || node.tag === HostText) {
18800 commitNestedUnmounts(node);
18801 // After all the children have unmounted, it is now safe to remove the
18802 // node from the tree.
18803 if (currentParentIsContainer) {
18804 removeChildFromContainer(currentParent, node.stateNode);
18805 } else {
18806 removeChild(currentParent, node.stateNode);
18807 }
18808 // Don't visit children because we already visited them.
18809 } else if (node.tag === HostPortal) {
18810 // When we go into a portal, it becomes the parent to remove from.
18811 // We will reassign it back when we pop the portal on the way up.
18812 currentParent = node.stateNode.containerInfo;
18813 currentParentIsContainer = true;
18814 // Visit children because portals might contain host components.
18815 if (node.child !== null) {
18816 node.child.return = node;
18817 node = node.child;
18818 continue;
18819 }
18820 } else {
18821 commitUnmount(node);
18822 // Visit children because we may find more host components below.
18823 if (node.child !== null) {
18824 node.child.return = node;
18825 node = node.child;
18826 continue;
18827 }
18828 }
18829 if (node === current$$1) {
18830 return;
18831 }
18832 while (node.sibling === null) {
18833 if (node.return === null || node.return === current$$1) {
18834 return;
18835 }
18836 node = node.return;
18837 if (node.tag === HostPortal) {
18838 // When we go out of the portal, we need to restore the parent.
18839 // Since we don't keep a stack of them, we will search for it.
18840 currentParentIsValid = false;
18841 }
18842 }
18843 node.sibling.return = node.return;
18844 node = node.sibling;
18845 }
18846}
18847
18848function commitDeletion(current$$1) {
18849 if (supportsMutation) {
18850 // Recursively delete all host nodes from the parent.
18851 // Detach refs and call componentWillUnmount() on the whole subtree.
18852 unmountHostComponents(current$$1);
18853 } else {
18854 // Detach refs and call componentWillUnmount() on the whole subtree.
18855 commitNestedUnmounts(current$$1);
18856 }
18857 detachFiber(current$$1);
18858}
18859
18860function commitWork(current$$1, finishedWork) {
18861 if (!supportsMutation) {
18862 switch (finishedWork.tag) {
18863 case FunctionComponent:
18864 case ForwardRef:
18865 case MemoComponent:
18866 case SimpleMemoComponent:
18867 {
18868 // Note: We currently never use MountMutation, but useLayout uses
18869 // UnmountMutation.
18870 commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
18871 return;
18872 }
18873 }
18874
18875 commitContainer(finishedWork);
18876 return;
18877 }
18878
18879 switch (finishedWork.tag) {
18880 case FunctionComponent:
18881 case ForwardRef:
18882 case MemoComponent:
18883 case SimpleMemoComponent:
18884 {
18885 // Note: We currently never use MountMutation, but useLayout uses
18886 // UnmountMutation.
18887 commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
18888 return;
18889 }
18890 case ClassComponent:
18891 {
18892 return;
18893 }
18894 case HostComponent:
18895 {
18896 var instance = finishedWork.stateNode;
18897 if (instance != null) {
18898 // Commit the work prepared earlier.
18899 var newProps = finishedWork.memoizedProps;
18900 // For hydration we reuse the update path but we treat the oldProps
18901 // as the newProps. The updatePayload will contain the real change in
18902 // this case.
18903 var oldProps = current$$1 !== null ? current$$1.memoizedProps : newProps;
18904 var type = finishedWork.type;
18905 // TODO: Type the updateQueue to be specific to host components.
18906 var updatePayload = finishedWork.updateQueue;
18907 finishedWork.updateQueue = null;
18908 if (updatePayload !== null) {
18909 commitUpdate(instance, updatePayload, type, oldProps, newProps, finishedWork);
18910 }
18911 }
18912 return;
18913 }
18914 case HostText:
18915 {
18916 !(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;
18917 var textInstance = finishedWork.stateNode;
18918 var newText = finishedWork.memoizedProps;
18919 // For hydration we reuse the update path but we treat the oldProps
18920 // as the newProps. The updatePayload will contain the real change in
18921 // this case.
18922 var oldText = current$$1 !== null ? current$$1.memoizedProps : newText;
18923 commitTextUpdate(textInstance, oldText, newText);
18924 return;
18925 }
18926 case HostRoot:
18927 {
18928 return;
18929 }
18930 case Profiler:
18931 {
18932 return;
18933 }
18934 case SuspenseComponent:
18935 {
18936 var newState = finishedWork.memoizedState;
18937
18938 var newDidTimeout = void 0;
18939 var primaryChildParent = finishedWork;
18940 if (newState === null) {
18941 newDidTimeout = false;
18942 } else {
18943 newDidTimeout = true;
18944 primaryChildParent = finishedWork.child;
18945 if (newState.timedOutAt === NoWork) {
18946 // If the children had not already timed out, record the time.
18947 // This is used to compute the elapsed time during subsequent
18948 // attempts to render the children.
18949 newState.timedOutAt = requestCurrentTime();
18950 }
18951 }
18952
18953 if (primaryChildParent !== null) {
18954 hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
18955 }
18956
18957 // If this boundary just timed out, then it will have a set of thenables.
18958 // For each thenable, attach a listener so that when it resolves, React
18959 // attempts to re-render the boundary in the primary (pre-timeout) state.
18960 var thenables = finishedWork.updateQueue;
18961 if (thenables !== null) {
18962 finishedWork.updateQueue = null;
18963 var retryCache = finishedWork.stateNode;
18964 if (retryCache === null) {
18965 retryCache = finishedWork.stateNode = new PossiblyWeakSet();
18966 }
18967 thenables.forEach(function (thenable) {
18968 // Memoize using the boundary fiber to prevent redundant listeners.
18969 var retry = retryTimedOutBoundary.bind(null, finishedWork, thenable);
18970 if (enableSchedulerTracing) {
18971 retry = tracing.unstable_wrap(retry);
18972 }
18973 if (!retryCache.has(thenable)) {
18974 retryCache.add(thenable);
18975 thenable.then(retry, retry);
18976 }
18977 });
18978 }
18979
18980 return;
18981 }
18982 case IncompleteClassComponent:
18983 {
18984 return;
18985 }
18986 default:
18987 {
18988 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.');
18989 }
18990 }
18991}
18992
18993function commitResetTextContent(current$$1) {
18994 if (!supportsMutation) {
18995 return;
18996 }
18997 resetTextContent(current$$1.stateNode);
18998}
18999
19000var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
19001
19002function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
19003 var update = createUpdate(expirationTime);
19004 // Unmount the root by rendering null.
19005 update.tag = CaptureUpdate;
19006 // Caution: React DevTools currently depends on this property
19007 // being called "element".
19008 update.payload = { element: null };
19009 var error = errorInfo.value;
19010 update.callback = function () {
19011 onUncaughtError(error);
19012 logError(fiber, errorInfo);
19013 };
19014 return update;
19015}
19016
19017function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
19018 var update = createUpdate(expirationTime);
19019 update.tag = CaptureUpdate;
19020 var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
19021 if (typeof getDerivedStateFromError === 'function') {
19022 var error = errorInfo.value;
19023 update.payload = function () {
19024 return getDerivedStateFromError(error);
19025 };
19026 }
19027
19028 var inst = fiber.stateNode;
19029 if (inst !== null && typeof inst.componentDidCatch === 'function') {
19030 update.callback = function callback() {
19031 if (typeof getDerivedStateFromError !== 'function') {
19032 // To preserve the preexisting retry behavior of error boundaries,
19033 // we keep track of which ones already failed during this batch.
19034 // This gets reset before we yield back to the browser.
19035 // TODO: Warn in strict mode if getDerivedStateFromError is
19036 // not defined.
19037 markLegacyErrorBoundaryAsFailed(this);
19038 }
19039 var error = errorInfo.value;
19040 var stack = errorInfo.stack;
19041 logError(fiber, errorInfo);
19042 this.componentDidCatch(error, {
19043 componentStack: stack !== null ? stack : ''
19044 });
19045 {
19046 if (typeof getDerivedStateFromError !== 'function') {
19047 // If componentDidCatch is the only error boundary method defined,
19048 // then it needs to call setState to recover from errors.
19049 // If no state update is scheduled then the boundary will swallow the error.
19050 !(fiber.expirationTime === Sync) ? warningWithoutStack$1(false, '%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown') : void 0;
19051 }
19052 }
19053 };
19054 }
19055 return update;
19056}
19057
19058function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
19059 // The source fiber did not complete.
19060 sourceFiber.effectTag |= Incomplete;
19061 // Its effect list is no longer valid.
19062 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
19063
19064 if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
19065 // This is a thenable.
19066 var thenable = value;
19067
19068 // Find the earliest timeout threshold of all the placeholders in the
19069 // ancestor path. We could avoid this traversal by storing the thresholds on
19070 // the stack, but we choose not to because we only hit this path if we're
19071 // IO-bound (i.e. if something suspends). Whereas the stack is used even in
19072 // the non-IO- bound case.
19073 var _workInProgress = returnFiber;
19074 var earliestTimeoutMs = -1;
19075 var startTimeMs = -1;
19076 do {
19077 if (_workInProgress.tag === SuspenseComponent) {
19078 var current$$1 = _workInProgress.alternate;
19079 if (current$$1 !== null) {
19080 var currentState = current$$1.memoizedState;
19081 if (currentState !== null) {
19082 // Reached a boundary that already timed out. Do not search
19083 // any further.
19084 var timedOutAt = currentState.timedOutAt;
19085 startTimeMs = expirationTimeToMs(timedOutAt);
19086 // Do not search any further.
19087 break;
19088 }
19089 }
19090 var timeoutPropMs = _workInProgress.pendingProps.maxDuration;
19091 if (typeof timeoutPropMs === 'number') {
19092 if (timeoutPropMs <= 0) {
19093 earliestTimeoutMs = 0;
19094 } else if (earliestTimeoutMs === -1 || timeoutPropMs < earliestTimeoutMs) {
19095 earliestTimeoutMs = timeoutPropMs;
19096 }
19097 }
19098 }
19099 _workInProgress = _workInProgress.return;
19100 } while (_workInProgress !== null);
19101
19102 // Schedule the nearest Suspense to re-render the timed out view.
19103 _workInProgress = returnFiber;
19104 do {
19105 if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress)) {
19106 // Found the nearest boundary.
19107
19108 // Stash the promise on the boundary fiber. If the boundary times out, we'll
19109 var thenables = _workInProgress.updateQueue;
19110 if (thenables === null) {
19111 _workInProgress.updateQueue = new Set([thenable]);
19112 } else {
19113 thenables.add(thenable);
19114 }
19115
19116 // If the boundary is outside of concurrent mode, we should *not*
19117 // suspend the commit. Pretend as if the suspended component rendered
19118 // null and keep rendering. In the commit phase, we'll schedule a
19119 // subsequent synchronous update to re-render the Suspense.
19120 //
19121 // Note: It doesn't matter whether the component that suspended was
19122 // inside a concurrent mode tree. If the Suspense is outside of it, we
19123 // should *not* suspend the commit.
19124 if ((_workInProgress.mode & ConcurrentMode) === NoEffect) {
19125 _workInProgress.effectTag |= DidCapture;
19126
19127 // We're going to commit this fiber even though it didn't complete.
19128 // But we shouldn't call any lifecycle methods or callbacks. Remove
19129 // all lifecycle effect tags.
19130 sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
19131
19132 if (sourceFiber.tag === ClassComponent) {
19133 var currentSourceFiber = sourceFiber.alternate;
19134 if (currentSourceFiber === null) {
19135 // This is a new mount. Change the tag so it's not mistaken for a
19136 // completed class component. For example, we should not call
19137 // componentWillUnmount if it is deleted.
19138 sourceFiber.tag = IncompleteClassComponent;
19139 } else {
19140 // When we try rendering again, we should not reuse the current fiber,
19141 // since it's known to be in an inconsistent state. Use a force updte to
19142 // prevent a bail out.
19143 var update = createUpdate(Sync);
19144 update.tag = ForceUpdate;
19145 enqueueUpdate(sourceFiber, update);
19146 }
19147 }
19148
19149 // The source fiber did not complete. Mark it with Sync priority to
19150 // indicate that it still has pending work.
19151 sourceFiber.expirationTime = Sync;
19152
19153 // Exit without suspending.
19154 return;
19155 }
19156
19157 // Confirmed that the boundary is in a concurrent mode tree. Continue
19158 // with the normal suspend path.
19159
19160 // Attach a listener to the promise to "ping" the root and retry. But
19161 // only if one does not already exist for the current render expiration
19162 // time (which acts like a "thread ID" here).
19163 var pingCache = root.pingCache;
19164 var threadIDs = void 0;
19165 if (pingCache === null) {
19166 pingCache = root.pingCache = new PossiblyWeakMap();
19167 threadIDs = new Set();
19168 pingCache.set(thenable, threadIDs);
19169 } else {
19170 threadIDs = pingCache.get(thenable);
19171 if (threadIDs === undefined) {
19172 threadIDs = new Set();
19173 pingCache.set(thenable, threadIDs);
19174 }
19175 }
19176 if (!threadIDs.has(renderExpirationTime)) {
19177 // Memoize using the thread ID to prevent redundant listeners.
19178 threadIDs.add(renderExpirationTime);
19179 var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
19180 if (enableSchedulerTracing) {
19181 ping = tracing.unstable_wrap(ping);
19182 }
19183 thenable.then(ping, ping);
19184 }
19185
19186 var absoluteTimeoutMs = void 0;
19187 if (earliestTimeoutMs === -1) {
19188 // If no explicit threshold is given, default to an abitrarily large
19189 // value. The actual size doesn't matter because the threshold for the
19190 // whole tree will be clamped to the expiration time.
19191 absoluteTimeoutMs = maxSigned31BitInt;
19192 } else {
19193 if (startTimeMs === -1) {
19194 // This suspend happened outside of any already timed-out
19195 // placeholders. We don't know exactly when the update was
19196 // scheduled, but we can infer an approximate start time from the
19197 // expiration time. First, find the earliest uncommitted expiration
19198 // time in the tree, including work that is suspended. Then subtract
19199 // the offset used to compute an async update's expiration time.
19200 // This will cause high priority (interactive) work to expire
19201 // earlier than necessary, but we can account for this by adjusting
19202 // for the Just Noticeable Difference.
19203 var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
19204 var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
19205 startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
19206 }
19207 absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
19208 }
19209
19210 // Mark the earliest timeout in the suspended fiber's ancestor path.
19211 // After completing the root, we'll take the largest of all the
19212 // suspended fiber's timeouts and use it to compute a timeout for the
19213 // whole tree.
19214 renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
19215
19216 _workInProgress.effectTag |= ShouldCapture;
19217 _workInProgress.expirationTime = renderExpirationTime;
19218 return;
19219 }
19220 // This boundary already captured during this render. Continue to the next
19221 // boundary.
19222 _workInProgress = _workInProgress.return;
19223 } while (_workInProgress !== null);
19224 // No boundary was found. Fallthrough to error mode.
19225 // TODO: Use invariant so the message is stripped in prod?
19226 value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a <Suspense fallback=...> component higher in the tree to ' + 'provide a loading indicator or placeholder to display.' + getStackByFiberInDevAndProd(sourceFiber));
19227 }
19228
19229 // We didn't find a boundary that could handle this type of exception. Start
19230 // over and traverse parent path again, this time treating the exception
19231 // as an error.
19232 renderDidError();
19233 value = createCapturedValue(value, sourceFiber);
19234 var workInProgress = returnFiber;
19235 do {
19236 switch (workInProgress.tag) {
19237 case HostRoot:
19238 {
19239 var _errorInfo = value;
19240 workInProgress.effectTag |= ShouldCapture;
19241 workInProgress.expirationTime = renderExpirationTime;
19242 var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
19243 enqueueCapturedUpdate(workInProgress, _update);
19244 return;
19245 }
19246 case ClassComponent:
19247 // Capture and retry
19248 var errorInfo = value;
19249 var ctor = workInProgress.type;
19250 var instance = workInProgress.stateNode;
19251 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
19252 workInProgress.effectTag |= ShouldCapture;
19253 workInProgress.expirationTime = renderExpirationTime;
19254 // Schedule the error boundary to re-render using updated state
19255 var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
19256 enqueueCapturedUpdate(workInProgress, _update2);
19257 return;
19258 }
19259 break;
19260 default:
19261 break;
19262 }
19263 workInProgress = workInProgress.return;
19264 } while (workInProgress !== null);
19265}
19266
19267function unwindWork(workInProgress, renderExpirationTime) {
19268 switch (workInProgress.tag) {
19269 case ClassComponent:
19270 {
19271 var Component = workInProgress.type;
19272 if (isContextProvider(Component)) {
19273 popContext(workInProgress);
19274 }
19275 var effectTag = workInProgress.effectTag;
19276 if (effectTag & ShouldCapture) {
19277 workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
19278 return workInProgress;
19279 }
19280 return null;
19281 }
19282 case HostRoot:
19283 {
19284 popHostContainer(workInProgress);
19285 popTopLevelContextObject(workInProgress);
19286 var _effectTag = workInProgress.effectTag;
19287 !((_effectTag & DidCapture) === NoEffect) ? invariant(false, 'The root failed to unmount after an error. This is likely a bug in React. Please file an issue.') : void 0;
19288 workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
19289 return workInProgress;
19290 }
19291 case HostComponent:
19292 {
19293 popHostContext(workInProgress);
19294 return null;
19295 }
19296 case SuspenseComponent:
19297 {
19298 var _effectTag2 = workInProgress.effectTag;
19299 if (_effectTag2 & ShouldCapture) {
19300 workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
19301 // Captured a suspense effect. Re-render the boundary.
19302 return workInProgress;
19303 }
19304 return null;
19305 }
19306 case HostPortal:
19307 popHostContainer(workInProgress);
19308 return null;
19309 case ContextProvider:
19310 popProvider(workInProgress);
19311 return null;
19312 default:
19313 return null;
19314 }
19315}
19316
19317function unwindInterruptedWork(interruptedWork) {
19318 switch (interruptedWork.tag) {
19319 case ClassComponent:
19320 {
19321 var childContextTypes = interruptedWork.type.childContextTypes;
19322 if (childContextTypes !== null && childContextTypes !== undefined) {
19323 popContext(interruptedWork);
19324 }
19325 break;
19326 }
19327 case HostRoot:
19328 {
19329 popHostContainer(interruptedWork);
19330 popTopLevelContextObject(interruptedWork);
19331 break;
19332 }
19333 case HostComponent:
19334 {
19335 popHostContext(interruptedWork);
19336 break;
19337 }
19338 case HostPortal:
19339 popHostContainer(interruptedWork);
19340 break;
19341 case ContextProvider:
19342 popProvider(interruptedWork);
19343 break;
19344 default:
19345 break;
19346 }
19347}
19348
19349var Dispatcher = {
19350 readContext: readContext,
19351 useCallback: useCallback,
19352 useContext: useContext,
19353 useEffect: useEffect,
19354 useImperativeMethods: useImperativeMethods,
19355 useLayoutEffect: useLayoutEffect,
19356 useMemo: useMemo,
19357 useReducer: useReducer,
19358 useRef: useRef,
19359 useState: useState
19360};
19361var DispatcherWithoutHooks = {
19362 readContext: readContext
19363};
19364
19365var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
19366
19367
19368var didWarnAboutStateTransition = void 0;
19369var didWarnSetStateChildContext = void 0;
19370var warnAboutUpdateOnUnmounted = void 0;
19371var warnAboutInvalidUpdates = void 0;
19372
19373if (enableSchedulerTracing) {
19374 // Provide explicit error message when production+profiling bundle of e.g. react-dom
19375 // is used with production (non-profiling) bundle of scheduler/tracing
19376 !(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null) ? invariant(false, 'It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling') : void 0;
19377}
19378
19379{
19380 didWarnAboutStateTransition = false;
19381 didWarnSetStateChildContext = false;
19382 var didWarnStateUpdateForUnmountedComponent = {};
19383
19384 warnAboutUpdateOnUnmounted = function (fiber, isClass) {
19385 // We show the whole stack but dedupe on the top component's name because
19386 // the problematic code almost always lies inside that component.
19387 var componentName = getComponentName(fiber.type) || 'ReactComponent';
19388 if (didWarnStateUpdateForUnmountedComponent[componentName]) {
19389 return;
19390 }
19391 warningWithoutStack$1(false, "Can't perform a React state update 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 %s.%s', isClass ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber));
19392 didWarnStateUpdateForUnmountedComponent[componentName] = true;
19393 };
19394
19395 warnAboutInvalidUpdates = function (instance) {
19396 switch (phase) {
19397 case 'getChildContext':
19398 if (didWarnSetStateChildContext) {
19399 return;
19400 }
19401 warningWithoutStack$1(false, 'setState(...): Cannot call setState() inside getChildContext()');
19402 didWarnSetStateChildContext = true;
19403 break;
19404 case 'render':
19405 if (didWarnAboutStateTransition) {
19406 return;
19407 }
19408 warningWithoutStack$1(false, 'Cannot update during an existing state transition (such as within ' + '`render`). Render methods should be a pure function of props and state.');
19409 didWarnAboutStateTransition = true;
19410 break;
19411 }
19412 };
19413}
19414
19415// Used to ensure computeUniqueAsyncExpiration is monotonically decreasing.
19416var lastUniqueAsyncExpiration = Sync - 1;
19417
19418// Represents the expiration time that incoming updates should use. (If this
19419// is NoWork, use the default strategy: async updates in async mode, sync
19420// updates in sync mode.)
19421var expirationContext = NoWork;
19422
19423var isWorking = false;
19424
19425// The next work in progress fiber that we're currently working on.
19426var nextUnitOfWork = null;
19427var nextRoot = null;
19428// The time at which we're currently rendering work.
19429var nextRenderExpirationTime = NoWork;
19430var nextLatestAbsoluteTimeoutMs = -1;
19431var nextRenderDidError = false;
19432
19433// The next fiber with an effect that we're currently committing.
19434var nextEffect = null;
19435
19436var isCommitting$1 = false;
19437var rootWithPendingPassiveEffects = null;
19438var passiveEffectCallbackHandle = null;
19439var passiveEffectCallback = null;
19440
19441var legacyErrorBoundariesThatAlreadyFailed = null;
19442
19443// Used for performance tracking.
19444var interruptedBy = null;
19445
19446var stashedWorkInProgressProperties = void 0;
19447var replayUnitOfWork = void 0;
19448var mayReplayFailedUnitOfWork = void 0;
19449var isReplayingFailedUnitOfWork = void 0;
19450var originalReplayError = void 0;
19451var rethrowOriginalError = void 0;
19452if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
19453 stashedWorkInProgressProperties = null;
19454 mayReplayFailedUnitOfWork = true;
19455 isReplayingFailedUnitOfWork = false;
19456 originalReplayError = null;
19457 replayUnitOfWork = function (failedUnitOfWork, thrownValue, isYieldy) {
19458 if (thrownValue !== null && typeof thrownValue === 'object' && typeof thrownValue.then === 'function') {
19459 // Don't replay promises. Treat everything else like an error.
19460 // TODO: Need to figure out a different strategy if/when we add
19461 // support for catching other types.
19462 return;
19463 }
19464
19465 // Restore the original state of the work-in-progress
19466 if (stashedWorkInProgressProperties === null) {
19467 // This should never happen. Don't throw because this code is DEV-only.
19468 warningWithoutStack$1(false, 'Could not replay rendering after an error. This is likely a bug in React. ' + 'Please file an issue.');
19469 return;
19470 }
19471 assignFiberPropertiesInDEV(failedUnitOfWork, stashedWorkInProgressProperties);
19472
19473 switch (failedUnitOfWork.tag) {
19474 case HostRoot:
19475 popHostContainer(failedUnitOfWork);
19476 popTopLevelContextObject(failedUnitOfWork);
19477 break;
19478 case HostComponent:
19479 popHostContext(failedUnitOfWork);
19480 break;
19481 case ClassComponent:
19482 {
19483 var Component = failedUnitOfWork.type;
19484 if (isContextProvider(Component)) {
19485 popContext(failedUnitOfWork);
19486 }
19487 break;
19488 }
19489 case HostPortal:
19490 popHostContainer(failedUnitOfWork);
19491 break;
19492 case ContextProvider:
19493 popProvider(failedUnitOfWork);
19494 break;
19495 }
19496 // Replay the begin phase.
19497 isReplayingFailedUnitOfWork = true;
19498 originalReplayError = thrownValue;
19499 invokeGuardedCallback(null, workLoop, null, isYieldy);
19500 isReplayingFailedUnitOfWork = false;
19501 originalReplayError = null;
19502 if (hasCaughtError()) {
19503 var replayError = clearCaughtError();
19504 if (replayError != null && thrownValue != null) {
19505 try {
19506 // Reading the expando property is intentionally
19507 // inside `try` because it might be a getter or Proxy.
19508 if (replayError._suppressLogging) {
19509 // Also suppress logging for the original error.
19510 thrownValue._suppressLogging = true;
19511 }
19512 } catch (inner) {
19513 // Ignore.
19514 }
19515 }
19516 } else {
19517 // If the begin phase did not fail the second time, set this pointer
19518 // back to the original value.
19519 nextUnitOfWork = failedUnitOfWork;
19520 }
19521 };
19522 rethrowOriginalError = function () {
19523 throw originalReplayError;
19524 };
19525}
19526
19527function resetStack() {
19528 if (nextUnitOfWork !== null) {
19529 var interruptedWork = nextUnitOfWork.return;
19530 while (interruptedWork !== null) {
19531 unwindInterruptedWork(interruptedWork);
19532 interruptedWork = interruptedWork.return;
19533 }
19534 }
19535
19536 {
19537 ReactStrictModeWarnings.discardPendingWarnings();
19538 checkThatStackIsEmpty();
19539 }
19540
19541 nextRoot = null;
19542 nextRenderExpirationTime = NoWork;
19543 nextLatestAbsoluteTimeoutMs = -1;
19544 nextRenderDidError = false;
19545 nextUnitOfWork = null;
19546}
19547
19548function commitAllHostEffects() {
19549 while (nextEffect !== null) {
19550 {
19551 setCurrentFiber(nextEffect);
19552 }
19553 recordEffect();
19554
19555 var effectTag = nextEffect.effectTag;
19556
19557 if (effectTag & ContentReset) {
19558 commitResetTextContent(nextEffect);
19559 }
19560
19561 if (effectTag & Ref) {
19562 var current$$1 = nextEffect.alternate;
19563 if (current$$1 !== null) {
19564 commitDetachRef(current$$1);
19565 }
19566 }
19567
19568 // The following switch statement is only concerned about placement,
19569 // updates, and deletions. To avoid needing to add a case for every
19570 // possible bitmap value, we remove the secondary effects from the
19571 // effect tag and switch on that value.
19572 var primaryEffectTag = effectTag & (Placement | Update | Deletion);
19573 switch (primaryEffectTag) {
19574 case Placement:
19575 {
19576 commitPlacement(nextEffect);
19577 // Clear the "placement" from effect tag so that we know that this is inserted, before
19578 // any life-cycles like componentDidMount gets called.
19579 // TODO: findDOMNode doesn't rely on this any more but isMounted
19580 // does and isMounted is deprecated anyway so we should be able
19581 // to kill this.
19582 nextEffect.effectTag &= ~Placement;
19583 break;
19584 }
19585 case PlacementAndUpdate:
19586 {
19587 // Placement
19588 commitPlacement(nextEffect);
19589 // Clear the "placement" from effect tag so that we know that this is inserted, before
19590 // any life-cycles like componentDidMount gets called.
19591 nextEffect.effectTag &= ~Placement;
19592
19593 // Update
19594 var _current = nextEffect.alternate;
19595 commitWork(_current, nextEffect);
19596 break;
19597 }
19598 case Update:
19599 {
19600 var _current2 = nextEffect.alternate;
19601 commitWork(_current2, nextEffect);
19602 break;
19603 }
19604 case Deletion:
19605 {
19606 commitDeletion(nextEffect);
19607 break;
19608 }
19609 }
19610 nextEffect = nextEffect.nextEffect;
19611 }
19612
19613 {
19614 resetCurrentFiber();
19615 }
19616}
19617
19618function commitBeforeMutationLifecycles() {
19619 while (nextEffect !== null) {
19620 {
19621 setCurrentFiber(nextEffect);
19622 }
19623
19624 var effectTag = nextEffect.effectTag;
19625 if (effectTag & Snapshot) {
19626 recordEffect();
19627 var current$$1 = nextEffect.alternate;
19628 commitBeforeMutationLifeCycles(current$$1, nextEffect);
19629 }
19630
19631 nextEffect = nextEffect.nextEffect;
19632 }
19633
19634 {
19635 resetCurrentFiber();
19636 }
19637}
19638
19639function commitAllLifeCycles(finishedRoot, committedExpirationTime) {
19640 {
19641 ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
19642 ReactStrictModeWarnings.flushLegacyContextWarning();
19643
19644 if (warnAboutDeprecatedLifecycles) {
19645 ReactStrictModeWarnings.flushPendingDeprecationWarnings();
19646 }
19647 }
19648 while (nextEffect !== null) {
19649 var effectTag = nextEffect.effectTag;
19650
19651 if (effectTag & (Update | Callback)) {
19652 recordEffect();
19653 var current$$1 = nextEffect.alternate;
19654 commitLifeCycles(finishedRoot, current$$1, nextEffect, committedExpirationTime);
19655 }
19656
19657 if (effectTag & Ref) {
19658 recordEffect();
19659 commitAttachRef(nextEffect);
19660 }
19661
19662 if (enableHooks && effectTag & Passive) {
19663 rootWithPendingPassiveEffects = finishedRoot;
19664 }
19665
19666 nextEffect = nextEffect.nextEffect;
19667 }
19668}
19669
19670function commitPassiveEffects(root, firstEffect) {
19671 rootWithPendingPassiveEffects = null;
19672 passiveEffectCallbackHandle = null;
19673 passiveEffectCallback = null;
19674
19675 // Set this to true to prevent re-entrancy
19676 var previousIsRendering = isRendering;
19677 isRendering = true;
19678
19679 var effect = firstEffect;
19680 do {
19681 if (effect.effectTag & Passive) {
19682 var didError = false;
19683 var error = void 0;
19684 {
19685 invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
19686 if (hasCaughtError()) {
19687 didError = true;
19688 error = clearCaughtError();
19689 }
19690 }
19691 if (didError) {
19692 captureCommitPhaseError(effect, error);
19693 }
19694 }
19695 effect = effect.nextEffect;
19696 } while (effect !== null);
19697
19698 isRendering = previousIsRendering;
19699
19700 // Check if work was scheduled by one of the effects
19701 var rootExpirationTime = root.expirationTime;
19702 if (rootExpirationTime !== NoWork) {
19703 requestWork(root, rootExpirationTime);
19704 }
19705}
19706
19707function isAlreadyFailedLegacyErrorBoundary(instance) {
19708 return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
19709}
19710
19711function markLegacyErrorBoundaryAsFailed(instance) {
19712 if (legacyErrorBoundariesThatAlreadyFailed === null) {
19713 legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
19714 } else {
19715 legacyErrorBoundariesThatAlreadyFailed.add(instance);
19716 }
19717}
19718
19719function flushPassiveEffects() {
19720 if (passiveEffectCallback !== null) {
19721 scheduler.unstable_cancelCallback(passiveEffectCallbackHandle);
19722 // We call the scheduled callback instead of commitPassiveEffects directly
19723 // to ensure tracing works correctly.
19724 passiveEffectCallback();
19725 }
19726}
19727
19728function commitRoot(root, finishedWork) {
19729 isWorking = true;
19730 isCommitting$1 = true;
19731 startCommitTimer();
19732
19733 !(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;
19734 var committedExpirationTime = root.pendingCommitExpirationTime;
19735 !(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;
19736 root.pendingCommitExpirationTime = NoWork;
19737
19738 // Update the pending priority levels to account for the work that we are
19739 // about to commit. This needs to happen before calling the lifecycles, since
19740 // they may schedule additional updates.
19741 var updateExpirationTimeBeforeCommit = finishedWork.expirationTime;
19742 var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime;
19743 var earliestRemainingTimeBeforeCommit = childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit ? childExpirationTimeBeforeCommit : updateExpirationTimeBeforeCommit;
19744 markCommittedPriorityLevels(root, earliestRemainingTimeBeforeCommit);
19745
19746 var prevInteractions = null;
19747 if (enableSchedulerTracing) {
19748 // Restore any pending interactions at this point,
19749 // So that cascading work triggered during the render phase will be accounted for.
19750 prevInteractions = tracing.__interactionsRef.current;
19751 tracing.__interactionsRef.current = root.memoizedInteractions;
19752 }
19753
19754 // Reset this to null before calling lifecycles
19755 ReactCurrentOwner$2.current = null;
19756
19757 var firstEffect = void 0;
19758 if (finishedWork.effectTag > PerformedWork) {
19759 // A fiber's effect list consists only of its children, not itself. So if
19760 // the root has an effect, we need to add it to the end of the list. The
19761 // resulting list is the set that would belong to the root's parent, if
19762 // it had one; that is, all the effects in the tree including the root.
19763 if (finishedWork.lastEffect !== null) {
19764 finishedWork.lastEffect.nextEffect = finishedWork;
19765 firstEffect = finishedWork.firstEffect;
19766 } else {
19767 firstEffect = finishedWork;
19768 }
19769 } else {
19770 // There is no effect on the root.
19771 firstEffect = finishedWork.firstEffect;
19772 }
19773
19774 prepareForCommit(root.containerInfo);
19775
19776 // Invoke instances of getSnapshotBeforeUpdate before mutation.
19777 nextEffect = firstEffect;
19778 startCommitSnapshotEffectsTimer();
19779 while (nextEffect !== null) {
19780 var didError = false;
19781 var error = void 0;
19782 {
19783 invokeGuardedCallback(null, commitBeforeMutationLifecycles, null);
19784 if (hasCaughtError()) {
19785 didError = true;
19786 error = clearCaughtError();
19787 }
19788 }
19789 if (didError) {
19790 !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
19791 captureCommitPhaseError(nextEffect, error);
19792 // Clean-up
19793 if (nextEffect !== null) {
19794 nextEffect = nextEffect.nextEffect;
19795 }
19796 }
19797 }
19798 stopCommitSnapshotEffectsTimer();
19799
19800 if (enableProfilerTimer) {
19801 // Mark the current commit time to be shared by all Profilers in this batch.
19802 // This enables them to be grouped later.
19803 recordCommitTime();
19804 }
19805
19806 // Commit all the side-effects within a tree. We'll do this in two passes.
19807 // The first pass performs all the host insertions, updates, deletions and
19808 // ref unmounts.
19809 nextEffect = firstEffect;
19810 startCommitHostEffectsTimer();
19811 while (nextEffect !== null) {
19812 var _didError = false;
19813 var _error = void 0;
19814 {
19815 invokeGuardedCallback(null, commitAllHostEffects, null);
19816 if (hasCaughtError()) {
19817 _didError = true;
19818 _error = clearCaughtError();
19819 }
19820 }
19821 if (_didError) {
19822 !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
19823 captureCommitPhaseError(nextEffect, _error);
19824 // Clean-up
19825 if (nextEffect !== null) {
19826 nextEffect = nextEffect.nextEffect;
19827 }
19828 }
19829 }
19830 stopCommitHostEffectsTimer();
19831
19832 resetAfterCommit(root.containerInfo);
19833
19834 // The work-in-progress tree is now the current tree. This must come after
19835 // the first pass of the commit phase, so that the previous tree is still
19836 // current during componentWillUnmount, but before the second pass, so that
19837 // the finished work is current during componentDidMount/Update.
19838 root.current = finishedWork;
19839
19840 // In the second pass we'll perform all life-cycles and ref callbacks.
19841 // Life-cycles happen as a separate pass so that all placements, updates,
19842 // and deletions in the entire tree have already been invoked.
19843 // This pass also triggers any renderer-specific initial effects.
19844 nextEffect = firstEffect;
19845 startCommitLifeCyclesTimer();
19846 while (nextEffect !== null) {
19847 var _didError2 = false;
19848 var _error2 = void 0;
19849 {
19850 invokeGuardedCallback(null, commitAllLifeCycles, null, root, committedExpirationTime);
19851 if (hasCaughtError()) {
19852 _didError2 = true;
19853 _error2 = clearCaughtError();
19854 }
19855 }
19856 if (_didError2) {
19857 !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
19858 captureCommitPhaseError(nextEffect, _error2);
19859 if (nextEffect !== null) {
19860 nextEffect = nextEffect.nextEffect;
19861 }
19862 }
19863 }
19864
19865 if (enableHooks && firstEffect !== null && rootWithPendingPassiveEffects !== null) {
19866 // This commit included a passive effect. These do not need to fire until
19867 // after the next paint. Schedule an callback to fire them in an async
19868 // event. To ensure serial execution, the callback will be flushed early if
19869 // we enter rootWithPendingPassiveEffects commit phase before then.
19870 var callback = commitPassiveEffects.bind(null, root, firstEffect);
19871 if (enableSchedulerTracing) {
19872 // TODO: Avoid this extra callback by mutating the tracing ref directly,
19873 // like we do at the beginning of commitRoot. I've opted not to do that
19874 // here because that code is still in flux.
19875 callback = tracing.unstable_wrap(callback);
19876 }
19877 passiveEffectCallbackHandle = scheduler.unstable_scheduleCallback(callback);
19878 passiveEffectCallback = callback;
19879 }
19880
19881 isCommitting$1 = false;
19882 isWorking = false;
19883 stopCommitLifeCyclesTimer();
19884 stopCommitTimer();
19885 onCommitRoot(finishedWork.stateNode);
19886 if (true && ReactFiberInstrumentation_1.debugTool) {
19887 ReactFiberInstrumentation_1.debugTool.onCommitWork(finishedWork);
19888 }
19889
19890 var updateExpirationTimeAfterCommit = finishedWork.expirationTime;
19891 var childExpirationTimeAfterCommit = finishedWork.childExpirationTime;
19892 var earliestRemainingTimeAfterCommit = childExpirationTimeAfterCommit > updateExpirationTimeAfterCommit ? childExpirationTimeAfterCommit : updateExpirationTimeAfterCommit;
19893 if (earliestRemainingTimeAfterCommit === NoWork) {
19894 // If there's no remaining work, we can clear the set of already failed
19895 // error boundaries.
19896 legacyErrorBoundariesThatAlreadyFailed = null;
19897 }
19898 onCommit(root, earliestRemainingTimeAfterCommit);
19899
19900 if (enableSchedulerTracing) {
19901 tracing.__interactionsRef.current = prevInteractions;
19902
19903 var subscriber = void 0;
19904
19905 try {
19906 subscriber = tracing.__subscriberRef.current;
19907 if (subscriber !== null && root.memoizedInteractions.size > 0) {
19908 var threadID = computeThreadID(committedExpirationTime, root.interactionThreadID);
19909 subscriber.onWorkStopped(root.memoizedInteractions, threadID);
19910 }
19911 } catch (error) {
19912 // It's not safe for commitRoot() to throw.
19913 // Store the error for now and we'll re-throw in finishRendering().
19914 if (!hasUnhandledError) {
19915 hasUnhandledError = true;
19916 unhandledError = error;
19917 }
19918 } finally {
19919 // Clear completed interactions from the pending Map.
19920 // Unless the render was suspended or cascading work was scheduled,
19921 // In which case– leave pending interactions until the subsequent render.
19922 var pendingInteractionMap = root.pendingInteractionMap;
19923 pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
19924 // Only decrement the pending interaction count if we're done.
19925 // If there's still work at the current priority,
19926 // That indicates that we are waiting for suspense data.
19927 if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) {
19928 pendingInteractionMap.delete(scheduledExpirationTime);
19929
19930 scheduledInteractions.forEach(function (interaction) {
19931 interaction.__count--;
19932
19933 if (subscriber !== null && interaction.__count === 0) {
19934 try {
19935 subscriber.onInteractionScheduledWorkCompleted(interaction);
19936 } catch (error) {
19937 // It's not safe for commitRoot() to throw.
19938 // Store the error for now and we'll re-throw in finishRendering().
19939 if (!hasUnhandledError) {
19940 hasUnhandledError = true;
19941 unhandledError = error;
19942 }
19943 }
19944 }
19945 });
19946 }
19947 });
19948 }
19949 }
19950}
19951
19952function resetChildExpirationTime(workInProgress, renderTime) {
19953 if (renderTime !== Never && workInProgress.childExpirationTime === Never) {
19954 // The children of this component are hidden. Don't bubble their
19955 // expiration times.
19956 return;
19957 }
19958
19959 var newChildExpirationTime = NoWork;
19960
19961 // Bubble up the earliest expiration time.
19962 if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
19963 // We're in profiling mode.
19964 // Let's use this same traversal to update the render durations.
19965 var actualDuration = workInProgress.actualDuration;
19966 var treeBaseDuration = workInProgress.selfBaseDuration;
19967
19968 // When a fiber is cloned, its actualDuration is reset to 0.
19969 // This value will only be updated if work is done on the fiber (i.e. it doesn't bailout).
19970 // When work is done, it should bubble to the parent's actualDuration.
19971 // If the fiber has not been cloned though, (meaning no work was done),
19972 // Then this value will reflect the amount of time spent working on a previous render.
19973 // In that case it should not bubble.
19974 // We determine whether it was cloned by comparing the child pointer.
19975 var shouldBubbleActualDurations = workInProgress.alternate === null || workInProgress.child !== workInProgress.alternate.child;
19976
19977 var child = workInProgress.child;
19978 while (child !== null) {
19979 var childUpdateExpirationTime = child.expirationTime;
19980 var childChildExpirationTime = child.childExpirationTime;
19981 if (childUpdateExpirationTime > newChildExpirationTime) {
19982 newChildExpirationTime = childUpdateExpirationTime;
19983 }
19984 if (childChildExpirationTime > newChildExpirationTime) {
19985 newChildExpirationTime = childChildExpirationTime;
19986 }
19987 if (shouldBubbleActualDurations) {
19988 actualDuration += child.actualDuration;
19989 }
19990 treeBaseDuration += child.treeBaseDuration;
19991 child = child.sibling;
19992 }
19993 workInProgress.actualDuration = actualDuration;
19994 workInProgress.treeBaseDuration = treeBaseDuration;
19995 } else {
19996 var _child = workInProgress.child;
19997 while (_child !== null) {
19998 var _childUpdateExpirationTime = _child.expirationTime;
19999 var _childChildExpirationTime = _child.childExpirationTime;
20000 if (_childUpdateExpirationTime > newChildExpirationTime) {
20001 newChildExpirationTime = _childUpdateExpirationTime;
20002 }
20003 if (_childChildExpirationTime > newChildExpirationTime) {
20004 newChildExpirationTime = _childChildExpirationTime;
20005 }
20006 _child = _child.sibling;
20007 }
20008 }
20009
20010 workInProgress.childExpirationTime = newChildExpirationTime;
20011}
20012
20013function completeUnitOfWork(workInProgress) {
20014 // Attempt to complete the current unit of work, then move to the
20015 // next sibling. If there are no more siblings, return to the
20016 // parent fiber.
20017 while (true) {
20018 // The current, flushed, state of this fiber is the alternate.
20019 // Ideally nothing should rely on this, but relying on it here
20020 // means that we don't need an additional field on the work in
20021 // progress.
20022 var current$$1 = workInProgress.alternate;
20023 {
20024 setCurrentFiber(workInProgress);
20025 }
20026
20027 var returnFiber = workInProgress.return;
20028 var siblingFiber = workInProgress.sibling;
20029
20030 if ((workInProgress.effectTag & Incomplete) === NoEffect) {
20031 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
20032 // Don't replay if it fails during completion phase.
20033 mayReplayFailedUnitOfWork = false;
20034 }
20035 // This fiber completed.
20036 // Remember we're completing this unit so we can find a boundary if it fails.
20037 nextUnitOfWork = workInProgress;
20038 if (enableProfilerTimer) {
20039 if (workInProgress.mode & ProfileMode) {
20040 startProfilerTimer(workInProgress);
20041 }
20042 nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
20043 if (workInProgress.mode & ProfileMode) {
20044 // Update render duration assuming we didn't error.
20045 stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
20046 }
20047 } else {
20048 nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
20049 }
20050 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
20051 // We're out of completion phase so replaying is fine now.
20052 mayReplayFailedUnitOfWork = true;
20053 }
20054 stopWorkTimer(workInProgress);
20055 resetChildExpirationTime(workInProgress, nextRenderExpirationTime);
20056 {
20057 resetCurrentFiber();
20058 }
20059
20060 if (nextUnitOfWork !== null) {
20061 // Completing this fiber spawned new work. Work on that next.
20062 return nextUnitOfWork;
20063 }
20064
20065 if (returnFiber !== null &&
20066 // Do not append effects to parents if a sibling failed to complete
20067 (returnFiber.effectTag & Incomplete) === NoEffect) {
20068 // Append all the effects of the subtree and this fiber onto the effect
20069 // list of the parent. The completion order of the children affects the
20070 // side-effect order.
20071 if (returnFiber.firstEffect === null) {
20072 returnFiber.firstEffect = workInProgress.firstEffect;
20073 }
20074 if (workInProgress.lastEffect !== null) {
20075 if (returnFiber.lastEffect !== null) {
20076 returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
20077 }
20078 returnFiber.lastEffect = workInProgress.lastEffect;
20079 }
20080
20081 // If this fiber had side-effects, we append it AFTER the children's
20082 // side-effects. We can perform certain side-effects earlier if
20083 // needed, by doing multiple passes over the effect list. We don't want
20084 // to schedule our own side-effect on our own list because if end up
20085 // reusing children we'll schedule this effect onto itself since we're
20086 // at the end.
20087 var effectTag = workInProgress.effectTag;
20088 // Skip both NoWork and PerformedWork tags when creating the effect list.
20089 // PerformedWork effect is read by React DevTools but shouldn't be committed.
20090 if (effectTag > PerformedWork) {
20091 if (returnFiber.lastEffect !== null) {
20092 returnFiber.lastEffect.nextEffect = workInProgress;
20093 } else {
20094 returnFiber.firstEffect = workInProgress;
20095 }
20096 returnFiber.lastEffect = workInProgress;
20097 }
20098 }
20099
20100 if (true && ReactFiberInstrumentation_1.debugTool) {
20101 ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
20102 }
20103
20104 if (siblingFiber !== null) {
20105 // If there is more work to do in this returnFiber, do that next.
20106 return siblingFiber;
20107 } else if (returnFiber !== null) {
20108 // If there's no more work in this returnFiber. Complete the returnFiber.
20109 workInProgress = returnFiber;
20110 continue;
20111 } else {
20112 // We've reached the root.
20113 return null;
20114 }
20115 } else {
20116 if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
20117 // Record the render duration for the fiber that errored.
20118 stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
20119
20120 // Include the time spent working on failed children before continuing.
20121 var actualDuration = workInProgress.actualDuration;
20122 var child = workInProgress.child;
20123 while (child !== null) {
20124 actualDuration += child.actualDuration;
20125 child = child.sibling;
20126 }
20127 workInProgress.actualDuration = actualDuration;
20128 }
20129
20130 // This fiber did not complete because something threw. Pop values off
20131 // the stack without entering the complete phase. If this is a boundary,
20132 // capture values if possible.
20133 var next = unwindWork(workInProgress, nextRenderExpirationTime);
20134 // Because this fiber did not complete, don't reset its expiration time.
20135 if (workInProgress.effectTag & DidCapture) {
20136 // Restarting an error boundary
20137 stopFailedWorkTimer(workInProgress);
20138 } else {
20139 stopWorkTimer(workInProgress);
20140 }
20141
20142 {
20143 resetCurrentFiber();
20144 }
20145
20146 if (next !== null) {
20147 stopWorkTimer(workInProgress);
20148 if (true && ReactFiberInstrumentation_1.debugTool) {
20149 ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
20150 }
20151
20152 // If completing this work spawned new work, do that next. We'll come
20153 // back here again.
20154 // Since we're restarting, remove anything that is not a host effect
20155 // from the effect tag.
20156 next.effectTag &= HostEffectMask;
20157 return next;
20158 }
20159
20160 if (returnFiber !== null) {
20161 // Mark the parent fiber as incomplete and clear its effect list.
20162 returnFiber.firstEffect = returnFiber.lastEffect = null;
20163 returnFiber.effectTag |= Incomplete;
20164 }
20165
20166 if (true && ReactFiberInstrumentation_1.debugTool) {
20167 ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
20168 }
20169
20170 if (siblingFiber !== null) {
20171 // If there is more work to do in this returnFiber, do that next.
20172 return siblingFiber;
20173 } else if (returnFiber !== null) {
20174 // If there's no more work in this returnFiber. Complete the returnFiber.
20175 workInProgress = returnFiber;
20176 continue;
20177 } else {
20178 return null;
20179 }
20180 }
20181 }
20182
20183 // Without this explicit null return Flow complains of invalid return type
20184 // TODO Remove the above while(true) loop
20185 // eslint-disable-next-line no-unreachable
20186 return null;
20187}
20188
20189function performUnitOfWork(workInProgress) {
20190 // The current, flushed, state of this fiber is the alternate.
20191 // Ideally nothing should rely on this, but relying on it here
20192 // means that we don't need an additional field on the work in
20193 // progress.
20194 var current$$1 = workInProgress.alternate;
20195
20196 // See if beginning this work spawns more work.
20197 startWorkTimer(workInProgress);
20198 {
20199 setCurrentFiber(workInProgress);
20200 }
20201
20202 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
20203 stashedWorkInProgressProperties = assignFiberPropertiesInDEV(stashedWorkInProgressProperties, workInProgress);
20204 }
20205
20206 var next = void 0;
20207 if (enableProfilerTimer) {
20208 if (workInProgress.mode & ProfileMode) {
20209 startProfilerTimer(workInProgress);
20210 }
20211
20212 next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
20213 workInProgress.memoizedProps = workInProgress.pendingProps;
20214
20215 if (workInProgress.mode & ProfileMode) {
20216 // Record the render duration assuming we didn't bailout (or error).
20217 stopProfilerTimerIfRunningAndRecordDelta(workInProgress, true);
20218 }
20219 } else {
20220 next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
20221 workInProgress.memoizedProps = workInProgress.pendingProps;
20222 }
20223
20224 {
20225 resetCurrentFiber();
20226 if (isReplayingFailedUnitOfWork) {
20227 // Currently replaying a failed unit of work. This should be unreachable,
20228 // because the render phase is meant to be idempotent, and it should
20229 // have thrown again. Since it didn't, rethrow the original error, so
20230 // React's internal stack is not misaligned.
20231 rethrowOriginalError();
20232 }
20233 }
20234 if (true && ReactFiberInstrumentation_1.debugTool) {
20235 ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress);
20236 }
20237
20238 if (next === null) {
20239 // If this doesn't spawn new work, complete the current work.
20240 next = completeUnitOfWork(workInProgress);
20241 }
20242
20243 ReactCurrentOwner$2.current = null;
20244
20245 return next;
20246}
20247
20248function workLoop(isYieldy) {
20249 if (!isYieldy) {
20250 // Flush work without yielding
20251 while (nextUnitOfWork !== null) {
20252 nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
20253 }
20254 } else {
20255 // Flush asynchronous work until there's a higher priority event
20256 while (nextUnitOfWork !== null && !shouldYieldToRenderer()) {
20257 nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
20258 }
20259 }
20260}
20261
20262function renderRoot(root, isYieldy) {
20263 !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
20264
20265 flushPassiveEffects();
20266
20267 isWorking = true;
20268 if (enableHooks) {
20269 ReactCurrentOwner$2.currentDispatcher = Dispatcher;
20270 } else {
20271 ReactCurrentOwner$2.currentDispatcher = DispatcherWithoutHooks;
20272 }
20273
20274 var expirationTime = root.nextExpirationTimeToWorkOn;
20275
20276 // Check if we're starting from a fresh stack, or if we're resuming from
20277 // previously yielded work.
20278 if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
20279 // Reset the stack and start working from the root.
20280 resetStack();
20281 nextRoot = root;
20282 nextRenderExpirationTime = expirationTime;
20283 nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime);
20284 root.pendingCommitExpirationTime = NoWork;
20285
20286 if (enableSchedulerTracing) {
20287 // Determine which interactions this batch of work currently includes,
20288 // So that we can accurately attribute time spent working on it,
20289 var interactions = new Set();
20290 root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
20291 if (scheduledExpirationTime >= expirationTime) {
20292 scheduledInteractions.forEach(function (interaction) {
20293 return interactions.add(interaction);
20294 });
20295 }
20296 });
20297
20298 // Store the current set of interactions on the FiberRoot for a few reasons:
20299 // We can re-use it in hot functions like renderRoot() without having to recalculate it.
20300 // We will also use it in commitWork() to pass to any Profiler onRender() hooks.
20301 // This also provides DevTools with a way to access it when the onCommitRoot() hook is called.
20302 root.memoizedInteractions = interactions;
20303
20304 if (interactions.size > 0) {
20305 var subscriber = tracing.__subscriberRef.current;
20306 if (subscriber !== null) {
20307 var threadID = computeThreadID(expirationTime, root.interactionThreadID);
20308 try {
20309 subscriber.onWorkStarted(interactions, threadID);
20310 } catch (error) {
20311 // Work thrown by an interaction tracing subscriber should be rethrown,
20312 // But only once it's safe (to avoid leaveing the scheduler in an invalid state).
20313 // Store the error for now and we'll re-throw in finishRendering().
20314 if (!hasUnhandledError) {
20315 hasUnhandledError = true;
20316 unhandledError = error;
20317 }
20318 }
20319 }
20320 }
20321 }
20322 }
20323
20324 var prevInteractions = null;
20325 if (enableSchedulerTracing) {
20326 // We're about to start new traced work.
20327 // Restore pending interactions so cascading work triggered during the render phase will be accounted for.
20328 prevInteractions = tracing.__interactionsRef.current;
20329 tracing.__interactionsRef.current = root.memoizedInteractions;
20330 }
20331
20332 var didFatal = false;
20333
20334 startWorkLoopTimer(nextUnitOfWork);
20335
20336 do {
20337 try {
20338 workLoop(isYieldy);
20339 } catch (thrownValue) {
20340 resetContextDependences();
20341 resetHooks();
20342
20343 // Reset in case completion throws.
20344 // This is only used in DEV and when replaying is on.
20345 var mayReplay = void 0;
20346 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
20347 mayReplay = mayReplayFailedUnitOfWork;
20348 mayReplayFailedUnitOfWork = true;
20349 }
20350
20351 if (nextUnitOfWork === null) {
20352 // This is a fatal error.
20353 didFatal = true;
20354 onUncaughtError(thrownValue);
20355 } else {
20356 if (enableProfilerTimer && nextUnitOfWork.mode & ProfileMode) {
20357 // Record the time spent rendering before an error was thrown.
20358 // This avoids inaccurate Profiler durations in the case of a suspended render.
20359 stopProfilerTimerIfRunningAndRecordDelta(nextUnitOfWork, true);
20360 }
20361
20362 {
20363 // Reset global debug state
20364 // We assume this is defined in DEV
20365 resetCurrentlyProcessingQueue();
20366 }
20367
20368 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
20369 if (mayReplay) {
20370 var failedUnitOfWork = nextUnitOfWork;
20371 replayUnitOfWork(failedUnitOfWork, thrownValue, isYieldy);
20372 }
20373 }
20374
20375 // TODO: we already know this isn't true in some cases.
20376 // At least this shows a nicer error message until we figure out the cause.
20377 // https://github.com/facebook/react/issues/12449#issuecomment-386727431
20378 !(nextUnitOfWork !== null) ? invariant(false, 'Failed to replay rendering after an error. This is likely caused by a bug in React. Please file an issue with a reproducing case to help us find it.') : void 0;
20379
20380 var sourceFiber = nextUnitOfWork;
20381 var returnFiber = sourceFiber.return;
20382 if (returnFiber === null) {
20383 // This is the root. The root could capture its own errors. However,
20384 // we don't know if it errors before or after we pushed the host
20385 // context. This information is needed to avoid a stack mismatch.
20386 // Because we're not sure, treat this as a fatal error. We could track
20387 // which phase it fails in, but doesn't seem worth it. At least
20388 // for now.
20389 didFatal = true;
20390 onUncaughtError(thrownValue);
20391 } else {
20392 throwException(root, returnFiber, sourceFiber, thrownValue, nextRenderExpirationTime);
20393 nextUnitOfWork = completeUnitOfWork(sourceFiber);
20394 continue;
20395 }
20396 }
20397 }
20398 break;
20399 } while (true);
20400
20401 if (enableSchedulerTracing) {
20402 // Traced work is done for now; restore the previous interactions.
20403 tracing.__interactionsRef.current = prevInteractions;
20404 }
20405
20406 // We're done performing work. Time to clean up.
20407 isWorking = false;
20408 ReactCurrentOwner$2.currentDispatcher = null;
20409 resetContextDependences();
20410 resetHooks();
20411
20412 // Yield back to main thread.
20413 if (didFatal) {
20414 var _didCompleteRoot = false;
20415 stopWorkLoopTimer(interruptedBy, _didCompleteRoot);
20416 interruptedBy = null;
20417 // There was a fatal error.
20418 {
20419 resetStackAfterFatalErrorInDev();
20420 }
20421 // `nextRoot` points to the in-progress root. A non-null value indicates
20422 // that we're in the middle of an async render. Set it to null to indicate
20423 // there's no more work to be done in the current batch.
20424 nextRoot = null;
20425 onFatal(root);
20426 return;
20427 }
20428
20429 if (nextUnitOfWork !== null) {
20430 // There's still remaining async work in this tree, but we ran out of time
20431 // in the current frame. Yield back to the renderer. Unless we're
20432 // interrupted by a higher priority update, we'll continue later from where
20433 // we left off.
20434 var _didCompleteRoot2 = false;
20435 stopWorkLoopTimer(interruptedBy, _didCompleteRoot2);
20436 interruptedBy = null;
20437 onYield(root);
20438 return;
20439 }
20440
20441 // We completed the whole tree.
20442 var didCompleteRoot = true;
20443 stopWorkLoopTimer(interruptedBy, didCompleteRoot);
20444 var rootWorkInProgress = root.current.alternate;
20445 !(rootWorkInProgress !== null) ? invariant(false, 'Finished root should have a work-in-progress. This error is likely caused by a bug in React. Please file an issue.') : void 0;
20446
20447 // `nextRoot` points to the in-progress root. A non-null value indicates
20448 // that we're in the middle of an async render. Set it to null to indicate
20449 // there's no more work to be done in the current batch.
20450 nextRoot = null;
20451 interruptedBy = null;
20452
20453 if (nextRenderDidError) {
20454 // There was an error
20455 if (hasLowerPriorityWork(root, expirationTime)) {
20456 // There's lower priority work. If so, it may have the effect of fixing
20457 // the exception that was just thrown. Exit without committing. This is
20458 // similar to a suspend, but without a timeout because we're not waiting
20459 // for a promise to resolve. React will restart at the lower
20460 // priority level.
20461 markSuspendedPriorityLevel(root, expirationTime);
20462 var suspendedExpirationTime = expirationTime;
20463 var rootExpirationTime = root.expirationTime;
20464 onSuspend(root, rootWorkInProgress, suspendedExpirationTime, rootExpirationTime, -1 // Indicates no timeout
20465 );
20466 return;
20467 } else if (
20468 // There's no lower priority work, but we're rendering asynchronously.
20469 // Synchronsouly attempt to render the same level one more time. This is
20470 // similar to a suspend, but without a timeout because we're not waiting
20471 // for a promise to resolve.
20472 !root.didError && isYieldy) {
20473 root.didError = true;
20474 var _suspendedExpirationTime = root.nextExpirationTimeToWorkOn = expirationTime;
20475 var _rootExpirationTime = root.expirationTime = Sync;
20476 onSuspend(root, rootWorkInProgress, _suspendedExpirationTime, _rootExpirationTime, -1 // Indicates no timeout
20477 );
20478 return;
20479 }
20480 }
20481
20482 if (isYieldy && nextLatestAbsoluteTimeoutMs !== -1) {
20483 // The tree was suspended.
20484 var _suspendedExpirationTime2 = expirationTime;
20485 markSuspendedPriorityLevel(root, _suspendedExpirationTime2);
20486
20487 // Find the earliest uncommitted expiration time in the tree, including
20488 // work that is suspended. The timeout threshold cannot be longer than
20489 // the overall expiration.
20490 var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, expirationTime);
20491 var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
20492 if (earliestExpirationTimeMs < nextLatestAbsoluteTimeoutMs) {
20493 nextLatestAbsoluteTimeoutMs = earliestExpirationTimeMs;
20494 }
20495
20496 // Subtract the current time from the absolute timeout to get the number
20497 // of milliseconds until the timeout. In other words, convert an absolute
20498 // timestamp to a relative time. This is the value that is passed
20499 // to `setTimeout`.
20500 var currentTimeMs = expirationTimeToMs(requestCurrentTime());
20501 var msUntilTimeout = nextLatestAbsoluteTimeoutMs - currentTimeMs;
20502 msUntilTimeout = msUntilTimeout < 0 ? 0 : msUntilTimeout;
20503
20504 // TODO: Account for the Just Noticeable Difference
20505
20506 var _rootExpirationTime2 = root.expirationTime;
20507 onSuspend(root, rootWorkInProgress, _suspendedExpirationTime2, _rootExpirationTime2, msUntilTimeout);
20508 return;
20509 }
20510
20511 // Ready to commit.
20512 onComplete(root, rootWorkInProgress, expirationTime);
20513}
20514
20515function captureCommitPhaseError(sourceFiber, value) {
20516 var expirationTime = Sync;
20517 var fiber = sourceFiber.return;
20518 while (fiber !== null) {
20519 switch (fiber.tag) {
20520 case ClassComponent:
20521 var ctor = fiber.type;
20522 var instance = fiber.stateNode;
20523 if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
20524 var errorInfo = createCapturedValue(value, sourceFiber);
20525 var update = createClassErrorUpdate(fiber, errorInfo, expirationTime);
20526 enqueueUpdate(fiber, update);
20527 scheduleWork(fiber, expirationTime);
20528 return;
20529 }
20530 break;
20531 case HostRoot:
20532 {
20533 var _errorInfo = createCapturedValue(value, sourceFiber);
20534 var _update = createRootErrorUpdate(fiber, _errorInfo, expirationTime);
20535 enqueueUpdate(fiber, _update);
20536 scheduleWork(fiber, expirationTime);
20537 return;
20538 }
20539 }
20540 fiber = fiber.return;
20541 }
20542
20543 if (sourceFiber.tag === HostRoot) {
20544 // Error was thrown at the root. There is no parent, so the root
20545 // itself should capture it.
20546 var rootFiber = sourceFiber;
20547 var _errorInfo2 = createCapturedValue(value, rootFiber);
20548 var _update2 = createRootErrorUpdate(rootFiber, _errorInfo2, expirationTime);
20549 enqueueUpdate(rootFiber, _update2);
20550 scheduleWork(rootFiber, expirationTime);
20551 }
20552}
20553
20554function computeThreadID(expirationTime, interactionThreadID) {
20555 // Interaction threads are unique per root and expiration time.
20556 return expirationTime * 1000 + interactionThreadID;
20557}
20558
20559// Creates a unique async expiration time.
20560function computeUniqueAsyncExpiration() {
20561 var currentTime = requestCurrentTime();
20562 var result = computeAsyncExpiration(currentTime);
20563 if (result >= lastUniqueAsyncExpiration) {
20564 // Since we assume the current time monotonically increases, we only hit
20565 // this branch when computeUniqueAsyncExpiration is fired multiple times
20566 // within a 200ms window (or whatever the async bucket size is).
20567 result = lastUniqueAsyncExpiration - 1;
20568 }
20569 lastUniqueAsyncExpiration = result;
20570 return lastUniqueAsyncExpiration;
20571}
20572
20573function computeExpirationForFiber(currentTime, fiber) {
20574 var expirationTime = void 0;
20575 if (expirationContext !== NoWork) {
20576 // An explicit expiration context was set;
20577 expirationTime = expirationContext;
20578 } else if (isWorking) {
20579 if (isCommitting$1) {
20580 // Updates that occur during the commit phase should have sync priority
20581 // by default.
20582 expirationTime = Sync;
20583 } else {
20584 // Updates during the render phase should expire at the same time as
20585 // the work that is being rendered.
20586 expirationTime = nextRenderExpirationTime;
20587 }
20588 } else {
20589 // No explicit expiration context was set, and we're not currently
20590 // performing work. Calculate a new expiration time.
20591 if (fiber.mode & ConcurrentMode) {
20592 if (isBatchingInteractiveUpdates) {
20593 // This is an interactive update
20594 expirationTime = computeInteractiveExpiration(currentTime);
20595 } else {
20596 // This is an async update
20597 expirationTime = computeAsyncExpiration(currentTime);
20598 }
20599 // If we're in the middle of rendering a tree, do not update at the same
20600 // expiration time that is already rendering.
20601 if (nextRoot !== null && expirationTime === nextRenderExpirationTime) {
20602 expirationTime -= 1;
20603 }
20604 } else {
20605 // This is a sync update
20606 expirationTime = Sync;
20607 }
20608 }
20609 if (isBatchingInteractiveUpdates) {
20610 // This is an interactive update. Keep track of the lowest pending
20611 // interactive expiration time. This allows us to synchronously flush
20612 // all interactive updates when needed.
20613 if (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime) {
20614 lowestPriorityPendingInteractiveExpirationTime = expirationTime;
20615 }
20616 }
20617 return expirationTime;
20618}
20619
20620function renderDidSuspend(root, absoluteTimeoutMs, suspendedTime) {
20621 // Schedule the timeout.
20622 if (absoluteTimeoutMs >= 0 && nextLatestAbsoluteTimeoutMs < absoluteTimeoutMs) {
20623 nextLatestAbsoluteTimeoutMs = absoluteTimeoutMs;
20624 }
20625}
20626
20627function renderDidError() {
20628 nextRenderDidError = true;
20629}
20630
20631function pingSuspendedRoot(root, thenable, pingTime) {
20632 // A promise that previously suspended React from committing has resolved.
20633 // If React is still suspended, try again at the previous level (pingTime).
20634
20635 var pingCache = root.pingCache;
20636 if (pingCache !== null) {
20637 // The thenable resolved, so we no longer need to memoize, because it will
20638 // never be thrown again.
20639 pingCache.delete(thenable);
20640 }
20641
20642 if (nextRoot !== null && nextRenderExpirationTime === pingTime) {
20643 // Received a ping at the same priority level at which we're currently
20644 // rendering. Restart from the root.
20645 nextRoot = null;
20646 } else {
20647 // Confirm that the root is still suspended at this level. Otherwise exit.
20648 if (isPriorityLevelSuspended(root, pingTime)) {
20649 // Ping at the original level
20650 markPingedPriorityLevel(root, pingTime);
20651 var rootExpirationTime = root.expirationTime;
20652 if (rootExpirationTime !== NoWork) {
20653 requestWork(root, rootExpirationTime);
20654 }
20655 }
20656 }
20657}
20658
20659function retryTimedOutBoundary(boundaryFiber, thenable) {
20660 // The boundary fiber (a Suspense component) previously timed out and was
20661 // rendered in its fallback state. One of the promises that suspended it has
20662 // resolved, which means at least part of the tree was likely unblocked. Try
20663 var retryCache = boundaryFiber.stateNode;
20664 if (retryCache !== null) {
20665 // The thenable resolved, so we no longer need to memoize, because it will
20666 // never be thrown again.
20667 retryCache.delete(thenable);
20668 }
20669
20670 var currentTime = requestCurrentTime();
20671 var retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
20672 var root = scheduleWorkToRoot(boundaryFiber, retryTime);
20673 if (root !== null) {
20674 markPendingPriorityLevel(root, retryTime);
20675 var rootExpirationTime = root.expirationTime;
20676 if (rootExpirationTime !== NoWork) {
20677 requestWork(root, rootExpirationTime);
20678 }
20679 }
20680}
20681
20682function scheduleWorkToRoot(fiber, expirationTime) {
20683 recordScheduleUpdate();
20684
20685 {
20686 if (fiber.tag === ClassComponent) {
20687 var instance = fiber.stateNode;
20688 warnAboutInvalidUpdates(instance);
20689 }
20690 }
20691
20692 // Update the source fiber's expiration time
20693 if (fiber.expirationTime < expirationTime) {
20694 fiber.expirationTime = expirationTime;
20695 }
20696 var alternate = fiber.alternate;
20697 if (alternate !== null && alternate.expirationTime < expirationTime) {
20698 alternate.expirationTime = expirationTime;
20699 }
20700 // Walk the parent path to the root and update the child expiration time.
20701 var node = fiber.return;
20702 var root = null;
20703 if (node === null && fiber.tag === HostRoot) {
20704 root = fiber.stateNode;
20705 } else {
20706 while (node !== null) {
20707 alternate = node.alternate;
20708 if (node.childExpirationTime < expirationTime) {
20709 node.childExpirationTime = expirationTime;
20710 if (alternate !== null && alternate.childExpirationTime < expirationTime) {
20711 alternate.childExpirationTime = expirationTime;
20712 }
20713 } else if (alternate !== null && alternate.childExpirationTime < expirationTime) {
20714 alternate.childExpirationTime = expirationTime;
20715 }
20716 if (node.return === null && node.tag === HostRoot) {
20717 root = node.stateNode;
20718 break;
20719 }
20720 node = node.return;
20721 }
20722 }
20723
20724 if (enableSchedulerTracing) {
20725 if (root !== null) {
20726 var interactions = tracing.__interactionsRef.current;
20727 if (interactions.size > 0) {
20728 var pendingInteractionMap = root.pendingInteractionMap;
20729 var pendingInteractions = pendingInteractionMap.get(expirationTime);
20730 if (pendingInteractions != null) {
20731 interactions.forEach(function (interaction) {
20732 if (!pendingInteractions.has(interaction)) {
20733 // Update the pending async work count for previously unscheduled interaction.
20734 interaction.__count++;
20735 }
20736
20737 pendingInteractions.add(interaction);
20738 });
20739 } else {
20740 pendingInteractionMap.set(expirationTime, new Set(interactions));
20741
20742 // Update the pending async work count for the current interactions.
20743 interactions.forEach(function (interaction) {
20744 interaction.__count++;
20745 });
20746 }
20747
20748 var subscriber = tracing.__subscriberRef.current;
20749 if (subscriber !== null) {
20750 var threadID = computeThreadID(expirationTime, root.interactionThreadID);
20751 subscriber.onWorkScheduled(interactions, threadID);
20752 }
20753 }
20754 }
20755 }
20756 return root;
20757}
20758
20759function scheduleWork(fiber, expirationTime) {
20760 var root = scheduleWorkToRoot(fiber, expirationTime);
20761 if (root === null) {
20762 {
20763 switch (fiber.tag) {
20764 case ClassComponent:
20765 warnAboutUpdateOnUnmounted(fiber, true);
20766 break;
20767 case FunctionComponent:
20768 case ForwardRef:
20769 case MemoComponent:
20770 case SimpleMemoComponent:
20771 warnAboutUpdateOnUnmounted(fiber, false);
20772 break;
20773 }
20774 }
20775 return;
20776 }
20777
20778 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime > nextRenderExpirationTime) {
20779 // This is an interruption. (Used for performance tracking.)
20780 interruptedBy = fiber;
20781 resetStack();
20782 }
20783 markPendingPriorityLevel(root, expirationTime);
20784 if (
20785 // If we're in the render phase, we don't need to schedule this root
20786 // for an update, because we'll do it before we exit...
20787 !isWorking || isCommitting$1 ||
20788 // ...unless this is a different root than the one we're rendering.
20789 nextRoot !== root) {
20790 var rootExpirationTime = root.expirationTime;
20791 requestWork(root, rootExpirationTime);
20792 }
20793 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
20794 // Reset this back to zero so subsequent updates don't throw.
20795 nestedUpdateCount = 0;
20796 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.');
20797 }
20798}
20799
20800function syncUpdates(fn, a, b, c, d) {
20801 var previousExpirationContext = expirationContext;
20802 expirationContext = Sync;
20803 try {
20804 return fn(a, b, c, d);
20805 } finally {
20806 expirationContext = previousExpirationContext;
20807 }
20808}
20809
20810// TODO: Everything below this is written as if it has been lifted to the
20811// renderers. I'll do this in a follow-up.
20812
20813// Linked-list of roots
20814var firstScheduledRoot = null;
20815var lastScheduledRoot = null;
20816
20817var callbackExpirationTime = NoWork;
20818var callbackID = void 0;
20819var isRendering = false;
20820var nextFlushedRoot = null;
20821var nextFlushedExpirationTime = NoWork;
20822var lowestPriorityPendingInteractiveExpirationTime = NoWork;
20823var hasUnhandledError = false;
20824var unhandledError = null;
20825
20826var isBatchingUpdates = false;
20827var isUnbatchingUpdates = false;
20828var isBatchingInteractiveUpdates = false;
20829
20830var completedBatches = null;
20831
20832var originalStartTimeMs = scheduler.unstable_now();
20833var currentRendererTime = msToExpirationTime(originalStartTimeMs);
20834var currentSchedulerTime = currentRendererTime;
20835
20836// Use these to prevent an infinite loop of nested updates
20837var NESTED_UPDATE_LIMIT = 50;
20838var nestedUpdateCount = 0;
20839var lastCommittedRootDuringThisBatch = null;
20840
20841function recomputeCurrentRendererTime() {
20842 var currentTimeMs = scheduler.unstable_now() - originalStartTimeMs;
20843 currentRendererTime = msToExpirationTime(currentTimeMs);
20844}
20845
20846function scheduleCallbackWithExpirationTime(root, expirationTime) {
20847 if (callbackExpirationTime !== NoWork) {
20848 // A callback is already scheduled. Check its expiration time (timeout).
20849 if (expirationTime < callbackExpirationTime) {
20850 // Existing callback has sufficient timeout. Exit.
20851 return;
20852 } else {
20853 if (callbackID !== null) {
20854 // Existing callback has insufficient timeout. Cancel and schedule a
20855 // new one.
20856 scheduler.unstable_cancelCallback(callbackID);
20857 }
20858 }
20859 // The request callback timer is already running. Don't start a new one.
20860 } else {
20861 startRequestCallbackTimer();
20862 }
20863
20864 callbackExpirationTime = expirationTime;
20865 var currentMs = scheduler.unstable_now() - originalStartTimeMs;
20866 var expirationTimeMs = expirationTimeToMs(expirationTime);
20867 var timeout = expirationTimeMs - currentMs;
20868 callbackID = scheduler.unstable_scheduleCallback(performAsyncWork, { timeout: timeout });
20869}
20870
20871// For every call to renderRoot, one of onFatal, onComplete, onSuspend, and
20872// onYield is called upon exiting. We use these in lieu of returning a tuple.
20873// I've also chosen not to inline them into renderRoot because these will
20874// eventually be lifted into the renderer.
20875function onFatal(root) {
20876 root.finishedWork = null;
20877}
20878
20879function onComplete(root, finishedWork, expirationTime) {
20880 root.pendingCommitExpirationTime = expirationTime;
20881 root.finishedWork = finishedWork;
20882}
20883
20884function onSuspend(root, finishedWork, suspendedExpirationTime, rootExpirationTime, msUntilTimeout) {
20885 root.expirationTime = rootExpirationTime;
20886 if (msUntilTimeout === 0 && !shouldYieldToRenderer()) {
20887 // Don't wait an additional tick. Commit the tree immediately.
20888 root.pendingCommitExpirationTime = suspendedExpirationTime;
20889 root.finishedWork = finishedWork;
20890 } else if (msUntilTimeout > 0) {
20891 // Wait `msUntilTimeout` milliseconds before committing.
20892 root.timeoutHandle = scheduleTimeout(onTimeout.bind(null, root, finishedWork, suspendedExpirationTime), msUntilTimeout);
20893 }
20894}
20895
20896function onYield(root) {
20897 root.finishedWork = null;
20898}
20899
20900function onTimeout(root, finishedWork, suspendedExpirationTime) {
20901 // The root timed out. Commit it.
20902 root.pendingCommitExpirationTime = suspendedExpirationTime;
20903 root.finishedWork = finishedWork;
20904 // Read the current time before entering the commit phase. We can be
20905 // certain this won't cause tearing related to batching of event updates
20906 // because we're at the top of a timer event.
20907 recomputeCurrentRendererTime();
20908 currentSchedulerTime = currentRendererTime;
20909 flushRoot(root, suspendedExpirationTime);
20910}
20911
20912function onCommit(root, expirationTime) {
20913 root.expirationTime = expirationTime;
20914 root.finishedWork = null;
20915}
20916
20917function requestCurrentTime() {
20918 // requestCurrentTime is called by the scheduler to compute an expiration
20919 // time.
20920 //
20921 // Expiration times are computed by adding to the current time (the start
20922 // time). However, if two updates are scheduled within the same event, we
20923 // should treat their start times as simultaneous, even if the actual clock
20924 // time has advanced between the first and second call.
20925
20926 // In other words, because expiration times determine how updates are batched,
20927 // we want all updates of like priority that occur within the same event to
20928 // receive the same expiration time. Otherwise we get tearing.
20929 //
20930 // We keep track of two separate times: the current "renderer" time and the
20931 // current "scheduler" time. The renderer time can be updated whenever; it
20932 // only exists to minimize the calls performance.now.
20933 //
20934 // But the scheduler time can only be updated if there's no pending work, or
20935 // if we know for certain that we're not in the middle of an event.
20936
20937 if (isRendering) {
20938 // We're already rendering. Return the most recently read time.
20939 return currentSchedulerTime;
20940 }
20941 // Check if there's pending work.
20942 findHighestPriorityRoot();
20943 if (nextFlushedExpirationTime === NoWork || nextFlushedExpirationTime === Never) {
20944 // If there's no pending work, or if the pending work is offscreen, we can
20945 // read the current time without risk of tearing.
20946 recomputeCurrentRendererTime();
20947 currentSchedulerTime = currentRendererTime;
20948 return currentSchedulerTime;
20949 }
20950 // There's already pending work. We might be in the middle of a browser
20951 // event. If we were to read the current time, it could cause multiple updates
20952 // within the same event to receive different expiration times, leading to
20953 // tearing. Return the last read time. During the next idle callback, the
20954 // time will be updated.
20955 return currentSchedulerTime;
20956}
20957
20958// requestWork is called by the scheduler whenever a root receives an update.
20959// It's up to the renderer to call renderRoot at some point in the future.
20960function requestWork(root, expirationTime) {
20961 addRootToSchedule(root, expirationTime);
20962 if (isRendering) {
20963 // Prevent reentrancy. Remaining work will be scheduled at the end of
20964 // the currently rendering batch.
20965 return;
20966 }
20967
20968 if (isBatchingUpdates) {
20969 // Flush work at the end of the batch.
20970 if (isUnbatchingUpdates) {
20971 // ...unless we're inside unbatchedUpdates, in which case we should
20972 // flush it now.
20973 nextFlushedRoot = root;
20974 nextFlushedExpirationTime = Sync;
20975 performWorkOnRoot(root, Sync, false);
20976 }
20977 return;
20978 }
20979
20980 // TODO: Get rid of Sync and use current time?
20981 if (expirationTime === Sync) {
20982 performSyncWork();
20983 } else {
20984 scheduleCallbackWithExpirationTime(root, expirationTime);
20985 }
20986}
20987
20988function addRootToSchedule(root, expirationTime) {
20989 // Add the root to the schedule.
20990 // Check if this root is already part of the schedule.
20991 if (root.nextScheduledRoot === null) {
20992 // This root is not already scheduled. Add it.
20993 root.expirationTime = expirationTime;
20994 if (lastScheduledRoot === null) {
20995 firstScheduledRoot = lastScheduledRoot = root;
20996 root.nextScheduledRoot = root;
20997 } else {
20998 lastScheduledRoot.nextScheduledRoot = root;
20999 lastScheduledRoot = root;
21000 lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
21001 }
21002 } else {
21003 // This root is already scheduled, but its priority may have increased.
21004 var remainingExpirationTime = root.expirationTime;
21005 if (expirationTime > remainingExpirationTime) {
21006 // Update the priority.
21007 root.expirationTime = expirationTime;
21008 }
21009 }
21010}
21011
21012function findHighestPriorityRoot() {
21013 var highestPriorityWork = NoWork;
21014 var highestPriorityRoot = null;
21015 if (lastScheduledRoot !== null) {
21016 var previousScheduledRoot = lastScheduledRoot;
21017 var root = firstScheduledRoot;
21018 while (root !== null) {
21019 var remainingExpirationTime = root.expirationTime;
21020 if (remainingExpirationTime === NoWork) {
21021 // This root no longer has work. Remove it from the scheduler.
21022
21023 // TODO: This check is redudant, but Flow is confused by the branch
21024 // below where we set lastScheduledRoot to null, even though we break
21025 // from the loop right after.
21026 !(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;
21027 if (root === root.nextScheduledRoot) {
21028 // This is the only root in the list.
21029 root.nextScheduledRoot = null;
21030 firstScheduledRoot = lastScheduledRoot = null;
21031 break;
21032 } else if (root === firstScheduledRoot) {
21033 // This is the first root in the list.
21034 var next = root.nextScheduledRoot;
21035 firstScheduledRoot = next;
21036 lastScheduledRoot.nextScheduledRoot = next;
21037 root.nextScheduledRoot = null;
21038 } else if (root === lastScheduledRoot) {
21039 // This is the last root in the list.
21040 lastScheduledRoot = previousScheduledRoot;
21041 lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
21042 root.nextScheduledRoot = null;
21043 break;
21044 } else {
21045 previousScheduledRoot.nextScheduledRoot = root.nextScheduledRoot;
21046 root.nextScheduledRoot = null;
21047 }
21048 root = previousScheduledRoot.nextScheduledRoot;
21049 } else {
21050 if (remainingExpirationTime > highestPriorityWork) {
21051 // Update the priority, if it's higher
21052 highestPriorityWork = remainingExpirationTime;
21053 highestPriorityRoot = root;
21054 }
21055 if (root === lastScheduledRoot) {
21056 break;
21057 }
21058 if (highestPriorityWork === Sync) {
21059 // Sync is highest priority by definition so
21060 // we can stop searching.
21061 break;
21062 }
21063 previousScheduledRoot = root;
21064 root = root.nextScheduledRoot;
21065 }
21066 }
21067 }
21068
21069 nextFlushedRoot = highestPriorityRoot;
21070 nextFlushedExpirationTime = highestPriorityWork;
21071}
21072
21073// TODO: This wrapper exists because many of the older tests (the ones that use
21074// flushDeferredPri) rely on the number of times `shouldYield` is called. We
21075// should get rid of it.
21076var didYield = false;
21077function shouldYieldToRenderer() {
21078 if (didYield) {
21079 return true;
21080 }
21081 if (scheduler.unstable_shouldYield()) {
21082 didYield = true;
21083 return true;
21084 }
21085 return false;
21086}
21087
21088function performAsyncWork() {
21089 try {
21090 if (!shouldYieldToRenderer()) {
21091 // The callback timed out. That means at least one update has expired.
21092 // Iterate through the root schedule. If they contain expired work, set
21093 // the next render expiration time to the current time. This has the effect
21094 // of flushing all expired work in a single batch, instead of flushing each
21095 // level one at a time.
21096 if (firstScheduledRoot !== null) {
21097 recomputeCurrentRendererTime();
21098 var root = firstScheduledRoot;
21099 do {
21100 didExpireAtExpirationTime(root, currentRendererTime);
21101 // The root schedule is circular, so this is never null.
21102 root = root.nextScheduledRoot;
21103 } while (root !== firstScheduledRoot);
21104 }
21105 }
21106 performWork(NoWork, true);
21107 } finally {
21108 didYield = false;
21109 }
21110}
21111
21112function performSyncWork() {
21113 performWork(Sync, false);
21114}
21115
21116function performWork(minExpirationTime, isYieldy) {
21117 // Keep working on roots until there's no more work, or until there's a higher
21118 // priority event.
21119 findHighestPriorityRoot();
21120
21121 if (isYieldy) {
21122 recomputeCurrentRendererTime();
21123 currentSchedulerTime = currentRendererTime;
21124
21125 if (enableUserTimingAPI) {
21126 var didExpire = nextFlushedExpirationTime > currentRendererTime;
21127 var timeout = expirationTimeToMs(nextFlushedExpirationTime);
21128 stopRequestCallbackTimer(didExpire, timeout);
21129 }
21130
21131 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && minExpirationTime <= nextFlushedExpirationTime && !(didYield && currentRendererTime > nextFlushedExpirationTime)) {
21132 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, currentRendererTime > nextFlushedExpirationTime);
21133 findHighestPriorityRoot();
21134 recomputeCurrentRendererTime();
21135 currentSchedulerTime = currentRendererTime;
21136 }
21137 } else {
21138 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && minExpirationTime <= nextFlushedExpirationTime) {
21139 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false);
21140 findHighestPriorityRoot();
21141 }
21142 }
21143
21144 // We're done flushing work. Either we ran out of time in this callback,
21145 // or there's no more work left with sufficient priority.
21146
21147 // If we're inside a callback, set this to false since we just completed it.
21148 if (isYieldy) {
21149 callbackExpirationTime = NoWork;
21150 callbackID = null;
21151 }
21152 // If there's work left over, schedule a new callback.
21153 if (nextFlushedExpirationTime !== NoWork) {
21154 scheduleCallbackWithExpirationTime(nextFlushedRoot, nextFlushedExpirationTime);
21155 }
21156
21157 // Clean-up.
21158 finishRendering();
21159}
21160
21161function flushRoot(root, expirationTime) {
21162 !!isRendering ? invariant(false, 'work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.') : void 0;
21163 // Perform work on root as if the given expiration time is the current time.
21164 // This has the effect of synchronously flushing all work up to and
21165 // including the given time.
21166 nextFlushedRoot = root;
21167 nextFlushedExpirationTime = expirationTime;
21168 performWorkOnRoot(root, expirationTime, false);
21169 // Flush any sync work that was scheduled by lifecycles
21170 performSyncWork();
21171}
21172
21173function finishRendering() {
21174 nestedUpdateCount = 0;
21175 lastCommittedRootDuringThisBatch = null;
21176
21177 if (completedBatches !== null) {
21178 var batches = completedBatches;
21179 completedBatches = null;
21180 for (var i = 0; i < batches.length; i++) {
21181 var batch = batches[i];
21182 try {
21183 batch._onComplete();
21184 } catch (error) {
21185 if (!hasUnhandledError) {
21186 hasUnhandledError = true;
21187 unhandledError = error;
21188 }
21189 }
21190 }
21191 }
21192
21193 if (hasUnhandledError) {
21194 var error = unhandledError;
21195 unhandledError = null;
21196 hasUnhandledError = false;
21197 throw error;
21198 }
21199}
21200
21201function performWorkOnRoot(root, expirationTime, isYieldy) {
21202 !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
21203
21204 isRendering = true;
21205
21206 // Check if this is async work or sync/expired work.
21207 if (!isYieldy) {
21208 // Flush work without yielding.
21209 // TODO: Non-yieldy work does not necessarily imply expired work. A renderer
21210 // may want to perform some work without yielding, but also without
21211 // requiring the root to complete (by triggering placeholders).
21212
21213 var finishedWork = root.finishedWork;
21214 if (finishedWork !== null) {
21215 // This root is already complete. We can commit it.
21216 completeRoot(root, finishedWork, expirationTime);
21217 } else {
21218 root.finishedWork = null;
21219 // If this root previously suspended, clear its existing timeout, since
21220 // we're about to try rendering again.
21221 var timeoutHandle = root.timeoutHandle;
21222 if (timeoutHandle !== noTimeout) {
21223 root.timeoutHandle = noTimeout;
21224 // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
21225 cancelTimeout(timeoutHandle);
21226 }
21227 renderRoot(root, isYieldy);
21228 finishedWork = root.finishedWork;
21229 if (finishedWork !== null) {
21230 // We've completed the root. Commit it.
21231 completeRoot(root, finishedWork, expirationTime);
21232 }
21233 }
21234 } else {
21235 // Flush async work.
21236 var _finishedWork = root.finishedWork;
21237 if (_finishedWork !== null) {
21238 // This root is already complete. We can commit it.
21239 completeRoot(root, _finishedWork, expirationTime);
21240 } else {
21241 root.finishedWork = null;
21242 // If this root previously suspended, clear its existing timeout, since
21243 // we're about to try rendering again.
21244 var _timeoutHandle = root.timeoutHandle;
21245 if (_timeoutHandle !== noTimeout) {
21246 root.timeoutHandle = noTimeout;
21247 // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
21248 cancelTimeout(_timeoutHandle);
21249 }
21250 renderRoot(root, isYieldy);
21251 _finishedWork = root.finishedWork;
21252 if (_finishedWork !== null) {
21253 // We've completed the root. Check the if we should yield one more time
21254 // before committing.
21255 if (!shouldYieldToRenderer()) {
21256 // Still time left. Commit the root.
21257 completeRoot(root, _finishedWork, expirationTime);
21258 } else {
21259 // There's no time left. Mark this root as complete. We'll come
21260 // back and commit it later.
21261 root.finishedWork = _finishedWork;
21262 }
21263 }
21264 }
21265 }
21266
21267 isRendering = false;
21268}
21269
21270function completeRoot(root, finishedWork, expirationTime) {
21271 // Check if there's a batch that matches this expiration time.
21272 var firstBatch = root.firstBatch;
21273 if (firstBatch !== null && firstBatch._expirationTime >= expirationTime) {
21274 if (completedBatches === null) {
21275 completedBatches = [firstBatch];
21276 } else {
21277 completedBatches.push(firstBatch);
21278 }
21279 if (firstBatch._defer) {
21280 // This root is blocked from committing by a batch. Unschedule it until
21281 // we receive another update.
21282 root.finishedWork = finishedWork;
21283 root.expirationTime = NoWork;
21284 return;
21285 }
21286 }
21287
21288 // Commit the root.
21289 root.finishedWork = null;
21290
21291 // Check if this is a nested update (a sync update scheduled during the
21292 // commit phase).
21293 if (root === lastCommittedRootDuringThisBatch) {
21294 // If the next root is the same as the previous root, this is a nested
21295 // update. To prevent an infinite loop, increment the nested update count.
21296 nestedUpdateCount++;
21297 } else {
21298 // Reset whenever we switch roots.
21299 lastCommittedRootDuringThisBatch = root;
21300 nestedUpdateCount = 0;
21301 }
21302 commitRoot(root, finishedWork);
21303}
21304
21305function onUncaughtError(error) {
21306 !(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;
21307 // Unschedule this root so we don't work on it again until there's
21308 // another update.
21309 nextFlushedRoot.expirationTime = NoWork;
21310 if (!hasUnhandledError) {
21311 hasUnhandledError = true;
21312 unhandledError = error;
21313 }
21314}
21315
21316// TODO: Batching should be implemented at the renderer level, not inside
21317// the reconciler.
21318function batchedUpdates$1(fn, a) {
21319 var previousIsBatchingUpdates = isBatchingUpdates;
21320 isBatchingUpdates = true;
21321 try {
21322 return fn(a);
21323 } finally {
21324 isBatchingUpdates = previousIsBatchingUpdates;
21325 if (!isBatchingUpdates && !isRendering) {
21326 performSyncWork();
21327 }
21328 }
21329}
21330
21331// TODO: Batching should be implemented at the renderer level, not inside
21332// the reconciler.
21333function unbatchedUpdates(fn, a) {
21334 if (isBatchingUpdates && !isUnbatchingUpdates) {
21335 isUnbatchingUpdates = true;
21336 try {
21337 return fn(a);
21338 } finally {
21339 isUnbatchingUpdates = false;
21340 }
21341 }
21342 return fn(a);
21343}
21344
21345// TODO: Batching should be implemented at the renderer level, not within
21346// the reconciler.
21347function flushSync(fn, a) {
21348 !!isRendering ? invariant(false, 'flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.') : void 0;
21349 var previousIsBatchingUpdates = isBatchingUpdates;
21350 isBatchingUpdates = true;
21351 try {
21352 return syncUpdates(fn, a);
21353 } finally {
21354 isBatchingUpdates = previousIsBatchingUpdates;
21355 performSyncWork();
21356 }
21357}
21358
21359function interactiveUpdates$1(fn, a, b) {
21360 if (isBatchingInteractiveUpdates) {
21361 return fn(a, b);
21362 }
21363 // If there are any pending interactive updates, synchronously flush them.
21364 // This needs to happen before we read any handlers, because the effect of
21365 // the previous event may influence which handlers are called during
21366 // this event.
21367 if (!isBatchingUpdates && !isRendering && lowestPriorityPendingInteractiveExpirationTime !== NoWork) {
21368 // Synchronously flush pending interactive updates.
21369 performWork(lowestPriorityPendingInteractiveExpirationTime, false);
21370 lowestPriorityPendingInteractiveExpirationTime = NoWork;
21371 }
21372 var previousIsBatchingInteractiveUpdates = isBatchingInteractiveUpdates;
21373 var previousIsBatchingUpdates = isBatchingUpdates;
21374 isBatchingInteractiveUpdates = true;
21375 isBatchingUpdates = true;
21376 try {
21377 return fn(a, b);
21378 } finally {
21379 isBatchingInteractiveUpdates = previousIsBatchingInteractiveUpdates;
21380 isBatchingUpdates = previousIsBatchingUpdates;
21381 if (!isBatchingUpdates && !isRendering) {
21382 performSyncWork();
21383 }
21384 }
21385}
21386
21387function flushInteractiveUpdates$1() {
21388 if (!isRendering && lowestPriorityPendingInteractiveExpirationTime !== NoWork) {
21389 // Synchronously flush pending interactive updates.
21390 performWork(lowestPriorityPendingInteractiveExpirationTime, false);
21391 lowestPriorityPendingInteractiveExpirationTime = NoWork;
21392 }
21393}
21394
21395function flushControlled(fn) {
21396 var previousIsBatchingUpdates = isBatchingUpdates;
21397 isBatchingUpdates = true;
21398 try {
21399 syncUpdates(fn);
21400 } finally {
21401 isBatchingUpdates = previousIsBatchingUpdates;
21402 if (!isBatchingUpdates && !isRendering) {
21403 performSyncWork();
21404 }
21405 }
21406}
21407
21408// 0 is PROD, 1 is DEV.
21409// Might add PROFILE later.
21410
21411
21412var didWarnAboutNestedUpdates = void 0;
21413var didWarnAboutFindNodeInStrictMode = void 0;
21414
21415{
21416 didWarnAboutNestedUpdates = false;
21417 didWarnAboutFindNodeInStrictMode = {};
21418}
21419
21420function getContextForSubtree(parentComponent) {
21421 if (!parentComponent) {
21422 return emptyContextObject;
21423 }
21424
21425 var fiber = get(parentComponent);
21426 var parentContext = findCurrentUnmaskedContext(fiber);
21427
21428 if (fiber.tag === ClassComponent) {
21429 var Component = fiber.type;
21430 if (isContextProvider(Component)) {
21431 return processChildContext(fiber, Component, parentContext);
21432 }
21433 }
21434
21435 return parentContext;
21436}
21437
21438function scheduleRootUpdate(current$$1, element, expirationTime, callback) {
21439 {
21440 if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
21441 didWarnAboutNestedUpdates = true;
21442 warningWithoutStack$1(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(current.type) || 'Unknown');
21443 }
21444 }
21445
21446 var update = createUpdate(expirationTime);
21447 // Caution: React DevTools currently depends on this property
21448 // being called "element".
21449 update.payload = { element: element };
21450
21451 callback = callback === undefined ? null : callback;
21452 if (callback !== null) {
21453 !(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
21454 update.callback = callback;
21455 }
21456
21457 flushPassiveEffects();
21458 enqueueUpdate(current$$1, update);
21459 scheduleWork(current$$1, expirationTime);
21460
21461 return expirationTime;
21462}
21463
21464function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, callback) {
21465 // TODO: If this is a nested container, this won't be the root.
21466 var current$$1 = container.current;
21467
21468 {
21469 if (ReactFiberInstrumentation_1.debugTool) {
21470 if (current$$1.alternate === null) {
21471 ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
21472 } else if (element === null) {
21473 ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
21474 } else {
21475 ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
21476 }
21477 }
21478 }
21479
21480 var context = getContextForSubtree(parentComponent);
21481 if (container.context === null) {
21482 container.context = context;
21483 } else {
21484 container.pendingContext = context;
21485 }
21486
21487 return scheduleRootUpdate(current$$1, element, expirationTime, callback);
21488}
21489
21490function findHostInstance(component) {
21491 var fiber = get(component);
21492 if (fiber === undefined) {
21493 if (typeof component.render === 'function') {
21494 invariant(false, 'Unable to find node on an unmounted component.');
21495 } else {
21496 invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
21497 }
21498 }
21499 var hostFiber = findCurrentHostFiber(fiber);
21500 if (hostFiber === null) {
21501 return null;
21502 }
21503 return hostFiber.stateNode;
21504}
21505
21506function findHostInstanceWithWarning(component, methodName) {
21507 {
21508 var fiber = get(component);
21509 if (fiber === undefined) {
21510 if (typeof component.render === 'function') {
21511 invariant(false, 'Unable to find node on an unmounted component.');
21512 } else {
21513 invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
21514 }
21515 }
21516 var hostFiber = findCurrentHostFiber(fiber);
21517 if (hostFiber === null) {
21518 return null;
21519 }
21520 if (hostFiber.mode & StrictMode) {
21521 var componentName = getComponentName(fiber.type) || 'Component';
21522 if (!didWarnAboutFindNodeInStrictMode[componentName]) {
21523 didWarnAboutFindNodeInStrictMode[componentName] = true;
21524 if (fiber.mode & StrictMode) {
21525 warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
21526 } else {
21527 warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
21528 }
21529 }
21530 }
21531 return hostFiber.stateNode;
21532 }
21533 return findHostInstance(component);
21534}
21535
21536function createContainer(containerInfo, isConcurrent, hydrate) {
21537 return createFiberRoot(containerInfo, isConcurrent, hydrate);
21538}
21539
21540function updateContainer(element, container, parentComponent, callback) {
21541 var current$$1 = container.current;
21542 var currentTime = requestCurrentTime();
21543 var expirationTime = computeExpirationForFiber(currentTime, current$$1);
21544 return updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, callback);
21545}
21546
21547function getPublicRootInstance(container) {
21548 var containerFiber = container.current;
21549 if (!containerFiber.child) {
21550 return null;
21551 }
21552 switch (containerFiber.child.tag) {
21553 case HostComponent:
21554 return getPublicInstance(containerFiber.child.stateNode);
21555 default:
21556 return containerFiber.child.stateNode;
21557 }
21558}
21559
21560function findHostInstanceWithNoPortals(fiber) {
21561 var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
21562 if (hostFiber === null) {
21563 return null;
21564 }
21565 return hostFiber.stateNode;
21566}
21567
21568var overrideProps = null;
21569
21570{
21571 var copyWithSetImpl = function (obj, path, idx, value) {
21572 if (idx >= path.length) {
21573 return value;
21574 }
21575 var key = path[idx];
21576 var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
21577 // $FlowFixMe number or string is fine here
21578 updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
21579 return updated;
21580 };
21581
21582 var copyWithSet = function (obj, path, value) {
21583 return copyWithSetImpl(obj, path, 0, value);
21584 };
21585
21586 // Support DevTools props for function components, forwardRef, memo, host components, etc.
21587 overrideProps = function (fiber, path, value) {
21588 flushPassiveEffects();
21589 fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
21590 if (fiber.alternate) {
21591 fiber.alternate.pendingProps = fiber.pendingProps;
21592 }
21593 scheduleWork(fiber, Sync);
21594 };
21595}
21596
21597function injectIntoDevTools(devToolsConfig) {
21598 var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
21599
21600 return injectInternals(_assign({}, devToolsConfig, {
21601 overrideProps: overrideProps,
21602 findHostInstanceByFiber: function (fiber) {
21603 var hostFiber = findCurrentHostFiber(fiber);
21604 if (hostFiber === null) {
21605 return null;
21606 }
21607 return hostFiber.stateNode;
21608 },
21609 findFiberByHostInstance: function (instance) {
21610 if (!findFiberByHostInstance) {
21611 // Might not be implemented by the renderer.
21612 return null;
21613 }
21614 return findFiberByHostInstance(instance);
21615 }
21616 }));
21617}
21618
21619// This file intentionally does *not* have the Flow annotation.
21620// Don't add it. See `./inline-typed.js` for an explanation.
21621
21622function createPortal$1(children, containerInfo,
21623// TODO: figure out the API for cross-renderer implementation.
21624implementation) {
21625 var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
21626
21627 return {
21628 // This tag allow us to uniquely identify this as a React Portal
21629 $$typeof: REACT_PORTAL_TYPE,
21630 key: key == null ? null : '' + key,
21631 children: children,
21632 containerInfo: containerInfo,
21633 implementation: implementation
21634 };
21635}
21636
21637// TODO: this is special because it gets imported during build.
21638
21639var ReactVersion = '16.7.0';
21640
21641// TODO: This type is shared between the reconciler and ReactDOM, but will
21642// eventually be lifted out to the renderer.
21643var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
21644
21645var topLevelUpdateWarnings = void 0;
21646var warnOnInvalidCallback = void 0;
21647var didWarnAboutUnstableCreatePortal = false;
21648
21649{
21650 if (typeof Map !== 'function' ||
21651 // $FlowIssue Flow incorrectly thinks Map has no prototype
21652 Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' ||
21653 // $FlowIssue Flow incorrectly thinks Set has no prototype
21654 Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
21655 warningWithoutStack$1(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');
21656 }
21657
21658 topLevelUpdateWarnings = function (container) {
21659 if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
21660 var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
21661 if (hostInstance) {
21662 !(hostInstance.parentNode === container) ? warningWithoutStack$1(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;
21663 }
21664 }
21665
21666 var isRootRenderedBySomeReact = !!container._reactRootContainer;
21667 var rootEl = getReactRootElementInContainer(container);
21668 var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
21669
21670 !(!hasNonRootReactChild || isRootRenderedBySomeReact) ? warningWithoutStack$1(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;
21671
21672 !(container.nodeType !== ELEMENT_NODE || !container.tagName || container.tagName.toUpperCase() !== 'BODY') ? warningWithoutStack$1(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;
21673 };
21674
21675 warnOnInvalidCallback = function (callback, callerName) {
21676 !(callback === null || typeof callback === 'function') ? warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback) : void 0;
21677 };
21678}
21679
21680setRestoreImplementation(restoreControlledState$1);
21681
21682function ReactBatch(root) {
21683 var expirationTime = computeUniqueAsyncExpiration();
21684 this._expirationTime = expirationTime;
21685 this._root = root;
21686 this._next = null;
21687 this._callbacks = null;
21688 this._didComplete = false;
21689 this._hasChildren = false;
21690 this._children = null;
21691 this._defer = true;
21692}
21693ReactBatch.prototype.render = function (children) {
21694 !this._defer ? invariant(false, 'batch.render: Cannot render a batch that already committed.') : void 0;
21695 this._hasChildren = true;
21696 this._children = children;
21697 var internalRoot = this._root._internalRoot;
21698 var expirationTime = this._expirationTime;
21699 var work = new ReactWork();
21700 updateContainerAtExpirationTime(children, internalRoot, null, expirationTime, work._onCommit);
21701 return work;
21702};
21703ReactBatch.prototype.then = function (onComplete) {
21704 if (this._didComplete) {
21705 onComplete();
21706 return;
21707 }
21708 var callbacks = this._callbacks;
21709 if (callbacks === null) {
21710 callbacks = this._callbacks = [];
21711 }
21712 callbacks.push(onComplete);
21713};
21714ReactBatch.prototype.commit = function () {
21715 var internalRoot = this._root._internalRoot;
21716 var firstBatch = internalRoot.firstBatch;
21717 !(this._defer && firstBatch !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
21718
21719 if (!this._hasChildren) {
21720 // This batch is empty. Return.
21721 this._next = null;
21722 this._defer = false;
21723 return;
21724 }
21725
21726 var expirationTime = this._expirationTime;
21727
21728 // Ensure this is the first batch in the list.
21729 if (firstBatch !== this) {
21730 // This batch is not the earliest batch. We need to move it to the front.
21731 // Update its expiration time to be the expiration time of the earliest
21732 // batch, so that we can flush it without flushing the other batches.
21733 if (this._hasChildren) {
21734 expirationTime = this._expirationTime = firstBatch._expirationTime;
21735 // Rendering this batch again ensures its children will be the final state
21736 // when we flush (updates are processed in insertion order: last
21737 // update wins).
21738 // TODO: This forces a restart. Should we print a warning?
21739 this.render(this._children);
21740 }
21741
21742 // Remove the batch from the list.
21743 var previous = null;
21744 var batch = firstBatch;
21745 while (batch !== this) {
21746 previous = batch;
21747 batch = batch._next;
21748 }
21749 !(previous !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
21750 previous._next = batch._next;
21751
21752 // Add it to the front.
21753 this._next = firstBatch;
21754 firstBatch = internalRoot.firstBatch = this;
21755 }
21756
21757 // Synchronously flush all the work up to this batch's expiration time.
21758 this._defer = false;
21759 flushRoot(internalRoot, expirationTime);
21760
21761 // Pop the batch from the list.
21762 var next = this._next;
21763 this._next = null;
21764 firstBatch = internalRoot.firstBatch = next;
21765
21766 // Append the next earliest batch's children to the update queue.
21767 if (firstBatch !== null && firstBatch._hasChildren) {
21768 firstBatch.render(firstBatch._children);
21769 }
21770};
21771ReactBatch.prototype._onComplete = function () {
21772 if (this._didComplete) {
21773 return;
21774 }
21775 this._didComplete = true;
21776 var callbacks = this._callbacks;
21777 if (callbacks === null) {
21778 return;
21779 }
21780 // TODO: Error handling.
21781 for (var i = 0; i < callbacks.length; i++) {
21782 var _callback = callbacks[i];
21783 _callback();
21784 }
21785};
21786
21787function ReactWork() {
21788 this._callbacks = null;
21789 this._didCommit = false;
21790 // TODO: Avoid need to bind by replacing callbacks in the update queue with
21791 // list of Work objects.
21792 this._onCommit = this._onCommit.bind(this);
21793}
21794ReactWork.prototype.then = function (onCommit) {
21795 if (this._didCommit) {
21796 onCommit();
21797 return;
21798 }
21799 var callbacks = this._callbacks;
21800 if (callbacks === null) {
21801 callbacks = this._callbacks = [];
21802 }
21803 callbacks.push(onCommit);
21804};
21805ReactWork.prototype._onCommit = function () {
21806 if (this._didCommit) {
21807 return;
21808 }
21809 this._didCommit = true;
21810 var callbacks = this._callbacks;
21811 if (callbacks === null) {
21812 return;
21813 }
21814 // TODO: Error handling.
21815 for (var i = 0; i < callbacks.length; i++) {
21816 var _callback2 = callbacks[i];
21817 !(typeof _callback2 === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', _callback2) : void 0;
21818 _callback2();
21819 }
21820};
21821
21822function ReactRoot(container, isConcurrent, hydrate) {
21823 var root = createContainer(container, isConcurrent, hydrate);
21824 this._internalRoot = root;
21825}
21826ReactRoot.prototype.render = function (children, callback) {
21827 var root = this._internalRoot;
21828 var work = new ReactWork();
21829 callback = callback === undefined ? null : callback;
21830 {
21831 warnOnInvalidCallback(callback, 'render');
21832 }
21833 if (callback !== null) {
21834 work.then(callback);
21835 }
21836 updateContainer(children, root, null, work._onCommit);
21837 return work;
21838};
21839ReactRoot.prototype.unmount = function (callback) {
21840 var root = this._internalRoot;
21841 var work = new ReactWork();
21842 callback = callback === undefined ? null : callback;
21843 {
21844 warnOnInvalidCallback(callback, 'render');
21845 }
21846 if (callback !== null) {
21847 work.then(callback);
21848 }
21849 updateContainer(null, root, null, work._onCommit);
21850 return work;
21851};
21852ReactRoot.prototype.legacy_renderSubtreeIntoContainer = function (parentComponent, children, callback) {
21853 var root = this._internalRoot;
21854 var work = new ReactWork();
21855 callback = callback === undefined ? null : callback;
21856 {
21857 warnOnInvalidCallback(callback, 'render');
21858 }
21859 if (callback !== null) {
21860 work.then(callback);
21861 }
21862 updateContainer(children, root, parentComponent, work._onCommit);
21863 return work;
21864};
21865ReactRoot.prototype.createBatch = function () {
21866 var batch = new ReactBatch(this);
21867 var expirationTime = batch._expirationTime;
21868
21869 var internalRoot = this._internalRoot;
21870 var firstBatch = internalRoot.firstBatch;
21871 if (firstBatch === null) {
21872 internalRoot.firstBatch = batch;
21873 batch._next = null;
21874 } else {
21875 // Insert sorted by expiration time then insertion order
21876 var insertAfter = null;
21877 var insertBefore = firstBatch;
21878 while (insertBefore !== null && insertBefore._expirationTime >= expirationTime) {
21879 insertAfter = insertBefore;
21880 insertBefore = insertBefore._next;
21881 }
21882 batch._next = insertBefore;
21883 if (insertAfter !== null) {
21884 insertAfter._next = batch;
21885 }
21886 }
21887
21888 return batch;
21889};
21890
21891/**
21892 * True if the supplied DOM node is a valid node element.
21893 *
21894 * @param {?DOMElement} node The candidate DOM node.
21895 * @return {boolean} True if the DOM is a valid DOM node.
21896 * @internal
21897 */
21898function isValidContainer(node) {
21899 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 '));
21900}
21901
21902function getReactRootElementInContainer(container) {
21903 if (!container) {
21904 return null;
21905 }
21906
21907 if (container.nodeType === DOCUMENT_NODE) {
21908 return container.documentElement;
21909 } else {
21910 return container.firstChild;
21911 }
21912}
21913
21914function shouldHydrateDueToLegacyHeuristic(container) {
21915 var rootElement = getReactRootElementInContainer(container);
21916 return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
21917}
21918
21919setBatchingImplementation(batchedUpdates$1, interactiveUpdates$1, flushInteractiveUpdates$1);
21920
21921var warnedAboutHydrateAPI = false;
21922
21923function legacyCreateRootFromDOMContainer(container, forceHydrate) {
21924 var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
21925 // First clear any existing content.
21926 if (!shouldHydrate) {
21927 var warned = false;
21928 var rootSibling = void 0;
21929 while (rootSibling = container.lastChild) {
21930 {
21931 if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
21932 warned = true;
21933 warningWithoutStack$1(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.');
21934 }
21935 }
21936 container.removeChild(rootSibling);
21937 }
21938 }
21939 {
21940 if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
21941 warnedAboutHydrateAPI = true;
21942 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.');
21943 }
21944 }
21945 // Legacy roots are not async by default.
21946 var isConcurrent = false;
21947 return new ReactRoot(container, isConcurrent, shouldHydrate);
21948}
21949
21950function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
21951 // TODO: Ensure all entry points contain this check
21952 !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
21953
21954 {
21955 topLevelUpdateWarnings(container);
21956 }
21957
21958 // TODO: Without `any` type, Flow says "Property cannot be accessed on any
21959 // member of intersection type." Whyyyyyy.
21960 var root = container._reactRootContainer;
21961 if (!root) {
21962 // Initial mount
21963 root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
21964 if (typeof callback === 'function') {
21965 var originalCallback = callback;
21966 callback = function () {
21967 var instance = getPublicRootInstance(root._internalRoot);
21968 originalCallback.call(instance);
21969 };
21970 }
21971 // Initial mount should not be batched.
21972 unbatchedUpdates(function () {
21973 if (parentComponent != null) {
21974 root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
21975 } else {
21976 root.render(children, callback);
21977 }
21978 });
21979 } else {
21980 if (typeof callback === 'function') {
21981 var _originalCallback = callback;
21982 callback = function () {
21983 var instance = getPublicRootInstance(root._internalRoot);
21984 _originalCallback.call(instance);
21985 };
21986 }
21987 // Update
21988 if (parentComponent != null) {
21989 root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
21990 } else {
21991 root.render(children, callback);
21992 }
21993 }
21994 return getPublicRootInstance(root._internalRoot);
21995}
21996
21997function createPortal$$1(children, container) {
21998 var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
21999
22000 !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
22001 // TODO: pass ReactDOM portal implementation as third argument
22002 return createPortal$1(children, container, null, key);
22003}
22004
22005var ReactDOM = {
22006 createPortal: createPortal$$1,
22007
22008 findDOMNode: function (componentOrElement) {
22009 {
22010 var owner = ReactCurrentOwner.current;
22011 if (owner !== null && owner.stateNode !== null) {
22012 var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
22013 !warnedAboutRefsInRender ? warningWithoutStack$1(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.type) || 'A component') : void 0;
22014 owner.stateNode._warnedAboutRefsInRender = true;
22015 }
22016 }
22017 if (componentOrElement == null) {
22018 return null;
22019 }
22020 if (componentOrElement.nodeType === ELEMENT_NODE) {
22021 return componentOrElement;
22022 }
22023 {
22024 return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
22025 }
22026 return findHostInstance(componentOrElement);
22027 },
22028 hydrate: function (element, container, callback) {
22029 // TODO: throw or warn if we couldn't hydrate?
22030 return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
22031 },
22032 render: function (element, container, callback) {
22033 return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
22034 },
22035 unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
22036 !(parentComponent != null && has(parentComponent)) ? invariant(false, 'parentComponent must be a valid React Component') : void 0;
22037 return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
22038 },
22039 unmountComponentAtNode: function (container) {
22040 !isValidContainer(container) ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : void 0;
22041
22042 if (container._reactRootContainer) {
22043 {
22044 var rootEl = getReactRootElementInContainer(container);
22045 var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
22046 !!renderedByDifferentReact ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
22047 }
22048
22049 // Unmount should not be batched.
22050 unbatchedUpdates(function () {
22051 legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
22052 container._reactRootContainer = null;
22053 });
22054 });
22055 // If you call unmountComponentAtNode twice in quick succession, you'll
22056 // get `true` twice. That's probably fine?
22057 return true;
22058 } else {
22059 {
22060 var _rootEl = getReactRootElementInContainer(container);
22061 var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl));
22062
22063 // Check if the container itself is a React root node.
22064 var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
22065
22066 !!hasNonRootReactChild ? warningWithoutStack$1(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;
22067 }
22068
22069 return false;
22070 }
22071 },
22072
22073
22074 // Temporary alias since we already shipped React 16 RC with it.
22075 // TODO: remove in React 17.
22076 unstable_createPortal: function () {
22077 if (!didWarnAboutUnstableCreatePortal) {
22078 didWarnAboutUnstableCreatePortal = true;
22079 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.');
22080 }
22081 return createPortal$$1.apply(undefined, arguments);
22082 },
22083
22084
22085 unstable_batchedUpdates: batchedUpdates$1,
22086
22087 unstable_interactiveUpdates: interactiveUpdates$1,
22088
22089 flushSync: flushSync,
22090
22091 unstable_createRoot: createRoot,
22092 unstable_flushControlled: flushControlled,
22093
22094 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
22095 // Keep in sync with ReactDOMUnstableNativeDependencies.js
22096 // and ReactTestUtils.js. This is an array for better minification.
22097 Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injection.injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch]
22098 }
22099};
22100
22101function createRoot(container, options) {
22102 var functionName = enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot';
22103 !isValidContainer(container) ? invariant(false, '%s(...): Target container is not a DOM element.', functionName) : void 0;
22104 var hydrate = options != null && options.hydrate === true;
22105 return new ReactRoot(container, true, hydrate);
22106}
22107
22108if (enableStableConcurrentModeAPIs) {
22109 ReactDOM.createRoot = createRoot;
22110 ReactDOM.unstable_createRoot = undefined;
22111}
22112
22113var foundDevTools = injectIntoDevTools({
22114 findFiberByHostInstance: getClosestInstanceFromNode,
22115 bundleType: 1,
22116 version: ReactVersion,
22117 rendererPackageName: 'react-dom'
22118});
22119
22120{
22121 if (!foundDevTools && canUseDOM && window.top === window.self) {
22122 // If we're in Chrome or Firefox, provide a download link if not installed.
22123 if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
22124 var protocol = window.location.protocol;
22125 // Don't warn in exotic cases like chrome-extension://.
22126 if (/^(https?|file):$/.test(protocol)) {
22127 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');
22128 }
22129 }
22130 }
22131}
22132
22133
22134
22135var ReactDOM$2 = Object.freeze({
22136 default: ReactDOM
22137});
22138
22139var ReactDOM$3 = ( ReactDOM$2 && ReactDOM ) || ReactDOM$2;
22140
22141// TODO: decide on the top-level export form.
22142// This is hacky but makes it work with both Rollup and Jest.
22143var reactDom = ReactDOM$3.default || ReactDOM$3;
22144
22145module.exports = reactDom;
22146 })();
22147}
22148
22149},{"object-assign":23,"prop-types/checkPropTypes":25,"react":"react","scheduler":71,"scheduler/tracing":72}],30:[function(require,module,exports){
22150/** @license React v16.7.0
22151 * react-dom.production.min.js
22152 *
22153 * Copyright (c) Facebook, Inc. and its affiliates.
22154 *
22155 * This source code is licensed under the MIT license found in the
22156 * LICENSE file in the root directory of this source tree.
22157 */
22158
22159/*
22160 Modernizr 3.0.0pre (Custom Build) | MIT
22161*/
22162'use strict';var aa=require("react"),n=require("object-assign"),ba=require("scheduler");function ca(a,b,c,d,e,f,g,h){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var k=[c,d,e,f,g,h],l=0;a=Error(b.replace(/%s/g,function(){return k[l++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
22163function t(a){for(var b=arguments.length-1,c="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=0;d<b;d++)c+="&args[]="+encodeURIComponent(arguments[d+1]);ca(!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)}aa?void 0:t("227");function da(a,b,c,d,e,f,g,h,k){var l=Array.prototype.slice.call(arguments,3);try{b.apply(c,l)}catch(m){this.onError(m)}}
22164var ea=!1,fa=null,ha=!1,ia=null,ja={onError:function(a){ea=!0;fa=a}};function ka(a,b,c,d,e,f,g,h,k){ea=!1;fa=null;da.apply(ja,arguments)}function la(a,b,c,d,e,f,g,h,k){ka.apply(this,arguments);if(ea){if(ea){var l=fa;ea=!1;fa=null}else t("198"),l=void 0;ha||(ha=!0,ia=l)}}var ma=null,na={};
22165function oa(){if(ma)for(var a in na){var b=na[a],c=ma.indexOf(a);-1<c?void 0:t("96",a);if(!pa[c]){b.extractEvents?void 0:t("97",a);pa[c]=b;c=b.eventTypes;for(var d in c){var e=void 0;var f=c[d],g=b,h=d;qa.hasOwnProperty(h)?t("99",h):void 0;qa[h]=f;var k=f.phasedRegistrationNames;if(k){for(e in k)k.hasOwnProperty(e)&&ra(k[e],g,h);e=!0}else f.registrationName?(ra(f.registrationName,g,h),e=!0):e=!1;e?void 0:t("98",d,a)}}}}
22166function ra(a,b,c){sa[a]?t("100",a):void 0;sa[a]=b;ta[a]=b.eventTypes[c].dependencies}var pa=[],qa={},sa={},ta={},ua=null,va=null,wa=null;function xa(a,b,c){var d=a.type||"unknown-event";a.currentTarget=wa(c);la(d,b,void 0,a);a.currentTarget=null}function ya(a,b){null==b?t("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]}
22167function za(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)}var Aa=null;function Ba(a){if(a){var b=a._dispatchListeners,c=a._dispatchInstances;if(Array.isArray(b))for(var d=0;d<b.length&&!a.isPropagationStopped();d++)xa(a,b[d],c[d]);else b&&xa(a,b,c);a._dispatchListeners=null;a._dispatchInstances=null;a.isPersistent()||a.constructor.release(a)}}
22168var Ca={injectEventPluginOrder:function(a){ma?t("101"):void 0;ma=Array.prototype.slice.call(a);oa()},injectEventPluginsByName:function(a){var b=!1,c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];na.hasOwnProperty(c)&&na[c]===d||(na[c]?t("102",c):void 0,na[c]=d,b=!0)}b&&oa()}};
22169function Da(a,b){var c=a.stateNode;if(!c)return null;var d=ua(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?t("231",b,typeof c):void 0;
22170return c}function Ea(a){null!==a&&(Aa=ya(Aa,a));a=Aa;Aa=null;if(a&&(za(a,Ba),Aa?t("95"):void 0,ha))throw a=ia,ha=!1,ia=null,a;}var Fa=Math.random().toString(36).slice(2),Ga="__reactInternalInstance$"+Fa,Ha="__reactEventHandlers$"+Fa;function Ia(a){if(a[Ga])return a[Ga];for(;!a[Ga];)if(a.parentNode)a=a.parentNode;else return null;a=a[Ga];return 5===a.tag||6===a.tag?a:null}function Ja(a){a=a[Ga];return!a||5!==a.tag&&6!==a.tag?null:a}
22171function Ka(a){if(5===a.tag||6===a.tag)return a.stateNode;t("33")}function La(a){return a[Ha]||null}function Ma(a){do a=a.return;while(a&&5!==a.tag);return a?a:null}function Na(a,b,c){if(b=Da(a,c.dispatchConfig.phasedRegistrationNames[b]))c._dispatchListeners=ya(c._dispatchListeners,b),c._dispatchInstances=ya(c._dispatchInstances,a)}
22172function Oa(a){if(a&&a.dispatchConfig.phasedRegistrationNames){for(var b=a._targetInst,c=[];b;)c.push(b),b=Ma(b);for(b=c.length;0<b--;)Na(c[b],"captured",a);for(b=0;b<c.length;b++)Na(c[b],"bubbled",a)}}function Pa(a,b,c){a&&c&&c.dispatchConfig.registrationName&&(b=Da(a,c.dispatchConfig.registrationName))&&(c._dispatchListeners=ya(c._dispatchListeners,b),c._dispatchInstances=ya(c._dispatchInstances,a))}function Qa(a){a&&a.dispatchConfig.registrationName&&Pa(a._targetInst,null,a)}
22173function Ra(a){za(a,Oa)}var Sa=!("undefined"===typeof window||!window.document||!window.document.createElement);function Ta(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}var Ua={animationend:Ta("Animation","AnimationEnd"),animationiteration:Ta("Animation","AnimationIteration"),animationstart:Ta("Animation","AnimationStart"),transitionend:Ta("Transition","TransitionEnd")},Va={},Wa={};
22174Sa&&(Wa=document.createElement("div").style,"AnimationEvent"in window||(delete Ua.animationend.animation,delete Ua.animationiteration.animation,delete Ua.animationstart.animation),"TransitionEvent"in window||delete Ua.transitionend.transition);function Xa(a){if(Va[a])return Va[a];if(!Ua[a])return a;var b=Ua[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in Wa)return Va[a]=b[c];return a}
22175var Ya=Xa("animationend"),Za=Xa("animationiteration"),$a=Xa("animationstart"),ab=Xa("transitionend"),bb="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),cb=null,eb=null,fb=null;
22176function gb(){if(fb)return fb;var a,b=eb,c=b.length,d,e="value"in cb?cb.value:cb.textContent,f=e.length;for(a=0;a<c&&b[a]===e[a];a++);var g=c-a;for(d=1;d<=g&&b[c-d]===e[f-d];d++);return fb=e.slice(a,1<d?1-d:void 0)}function hb(){return!0}function ib(){return!1}
22177function z(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)?hb:ib;this.isPropagationStopped=ib;return this}
22178n(z.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=hb)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=hb)},persist:function(){this.isPersistent=hb},isPersistent:ib,destructor:function(){var a=this.constructor.Interface,
22179b;for(b in a)this[b]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null;this.isPropagationStopped=this.isDefaultPrevented=ib;this._dispatchInstances=this._dispatchListeners=null}});z.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
22180z.extend=function(a){function b(){}function c(){return d.apply(this,arguments)}var d=this;b.prototype=d.prototype;var e=new b;n(e,c.prototype);c.prototype=e;c.prototype.constructor=c;c.Interface=n({},d.Interface,a);c.extend=d.extend;jb(c);return c};jb(z);function kb(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 lb(a){a instanceof this?void 0:t("279");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}
22181function jb(a){a.eventPool=[];a.getPooled=kb;a.release=lb}var mb=z.extend({data:null}),nb=z.extend({data:null}),ob=[9,13,27,32],pb=Sa&&"CompositionEvent"in window,qb=null;Sa&&"documentMode"in document&&(qb=document.documentMode);
22182var rb=Sa&&"TextEvent"in window&&!qb,sb=Sa&&(!pb||qb&&8<qb&&11>=qb),tb=String.fromCharCode(32),ub={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",
22183captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},vb=!1;
22184function wb(a,b){switch(a){case "keyup":return-1!==ob.indexOf(b.keyCode);case "keydown":return 229!==b.keyCode;case "keypress":case "mousedown":case "blur":return!0;default:return!1}}function xb(a){a=a.detail;return"object"===typeof a&&"data"in a?a.data:null}var yb=!1;function zb(a,b){switch(a){case "compositionend":return xb(b);case "keypress":if(32!==b.which)return null;vb=!0;return tb;case "textInput":return a=b.data,a===tb&&vb?null:a;default:return null}}
22185function Ab(a,b){if(yb)return"compositionend"===a||!pb&&wb(a,b)?(a=gb(),fb=eb=cb=null,yb=!1,a):null;switch(a){case "paste":return null;case "keypress":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 "compositionend":return sb&&"ko"!==b.locale?null:b.data;default:return null}}
22186var Bb={eventTypes:ub,extractEvents:function(a,b,c,d){var e=void 0;var f=void 0;if(pb)b:{switch(a){case "compositionstart":e=ub.compositionStart;break b;case "compositionend":e=ub.compositionEnd;break b;case "compositionupdate":e=ub.compositionUpdate;break b}e=void 0}else yb?wb(a,c)&&(e=ub.compositionEnd):"keydown"===a&&229===c.keyCode&&(e=ub.compositionStart);e?(sb&&"ko"!==c.locale&&(yb||e!==ub.compositionStart?e===ub.compositionEnd&&yb&&(f=gb()):(cb=d,eb="value"in cb?cb.value:cb.textContent,yb=
22187!0)),e=mb.getPooled(e,b,c,d),f?e.data=f:(f=xb(c),null!==f&&(e.data=f)),Ra(e),f=e):f=null;(a=rb?zb(a,c):Ab(a,c))?(b=nb.getPooled(ub.beforeInput,b,c,d),b.data=a,Ra(b)):b=null;return null===f?b:null===b?f:[f,b]}},Cb=null,Db=null,Eb=null;function Hb(a){if(a=va(a)){"function"!==typeof Cb?t("280"):void 0;var b=ua(a.stateNode);Cb(a.stateNode,a.type,b)}}function Ib(a){Db?Eb?Eb.push(a):Eb=[a]:Db=a}function Jb(){if(Db){var a=Db,b=Eb;Eb=Db=null;Hb(a);if(b)for(a=0;a<b.length;a++)Hb(b[a])}}
22188function Kb(a,b){return a(b)}function Lb(a,b,c){return a(b,c)}function Mb(){}var Nb=!1;function Ob(a,b){if(Nb)return a(b);Nb=!0;try{return Kb(a,b)}finally{if(Nb=!1,null!==Db||null!==Eb)Mb(),Jb()}}var Pb={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 Qb(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return"input"===b?!!Pb[a.type]:"textarea"===b?!0:!1}
22189function Rb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}function Sb(a){if(!Sa)return!1;a="on"+a;var b=a in document;b||(b=document.createElement("div"),b.setAttribute(a,"return;"),b="function"===typeof b[a]);return b}function Tb(a){var b=a.type;return(a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===b)}
22190function Ub(a){var b=Tb(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"undefined"!==typeof c&&"function"===typeof c.get&&"function"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=""+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=""+a},stopTracking:function(){a._valueTracker=
22191null;delete a[b]}}}}function Vb(a){a._valueTracker||(a._valueTracker=Ub(a))}function Wb(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d="";a&&(d=Tb(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}
22192var Xb=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Yb=/^(.*)[\\\/]/,D="function"===typeof Symbol&&Symbol.for,Zb=D?Symbol.for("react.element"):60103,$b=D?Symbol.for("react.portal"):60106,ac=D?Symbol.for("react.fragment"):60107,bc=D?Symbol.for("react.strict_mode"):60108,cc=D?Symbol.for("react.profiler"):60114,dc=D?Symbol.for("react.provider"):60109,ec=D?Symbol.for("react.context"):60110,fc=D?Symbol.for("react.concurrent_mode"):60111,gc=D?Symbol.for("react.forward_ref"):60112,hc=D?Symbol.for("react.suspense"):
2219360113,ic=D?Symbol.for("react.memo"):60115,jc=D?Symbol.for("react.lazy"):60116,kc="function"===typeof Symbol&&Symbol.iterator;function lc(a){if(null===a||"object"!==typeof a)return null;a=kc&&a[kc]||a["@@iterator"];return"function"===typeof a?a:null}
22194function mc(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case fc:return"ConcurrentMode";case ac:return"Fragment";case $b:return"Portal";case cc:return"Profiler";case bc:return"StrictMode";case hc:return"Suspense"}if("object"===typeof a)switch(a.$$typeof){case ec:return"Context.Consumer";case dc:return"Context.Provider";case gc:var b=a.render;b=b.displayName||b.name||"";return a.displayName||(""!==b?"ForwardRef("+b+
22195")":"ForwardRef");case ic:return mc(a.type);case jc:if(a=1===a._status?a._result:null)return mc(a)}return null}function nc(a){var b="";do{a:switch(a.tag){case 3:case 4:case 6:case 7:case 10:case 9:var c="";break a;default:var d=a._debugOwner,e=a._debugSource,f=mc(a.type);c=null;d&&(c=mc(d.type));d=f;f="";e?f=" (at "+e.fileName.replace(Yb,"")+":"+e.lineNumber+")":c&&(f=" (created by "+c+")");c="\n in "+(d||"Unknown")+f}b+=c;a=a.return}while(a);return b}
22196var oc=/^[: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]*$/,pc=Object.prototype.hasOwnProperty,qc={},rc={};
22197function sc(a){if(pc.call(rc,a))return!0;if(pc.call(qc,a))return!1;if(oc.test(a))return rc[a]=!0;qc[a]=!0;return!1}function tc(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}}
22198function uc(a,b,c,d){if(null===b||"undefined"===typeof b||tc(a,b,c,d))return!0;if(d)return!1;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}function E(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 F={};
22199"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){F[a]=new E(a,0,!1,a,null)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];F[b]=new E(b,1,!1,a[1],null)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){F[a]=new E(a,2,!1,a.toLowerCase(),null)});
22200["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){F[a]=new E(a,2,!1,a,null)});"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){F[a]=new E(a,3,!1,a.toLowerCase(),null)});["checked","multiple","muted","selected"].forEach(function(a){F[a]=new E(a,3,!0,a,null)});
22201["capture","download"].forEach(function(a){F[a]=new E(a,4,!1,a,null)});["cols","rows","size","span"].forEach(function(a){F[a]=new E(a,6,!1,a,null)});["rowSpan","start"].forEach(function(a){F[a]=new E(a,5,!1,a.toLowerCase(),null)});var vc=/[\-:]([a-z])/g;function wc(a){return a[1].toUpperCase()}
22202"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(vc,
22203wc);F[b]=new E(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(vc,wc);F[b]=new E(b,1,!1,a,"http://www.w3.org/1999/xlink")});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(vc,wc);F[b]=new E(b,1,!1,a,"http://www.w3.org/XML/1998/namespace")});F.tabIndex=new E("tabIndex",1,!1,"tabindex",null);
22204function xc(a,b,c,d){var e=F.hasOwnProperty(b)?F[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||(uc(b,c,e,d)&&(c=null),d||null===e?sc(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))))}
22205function yc(a){switch(typeof a){case "boolean":case "number":case "object":case "string":case "undefined":return a;default:return""}}function zc(a,b){var c=b.checked;return n({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}
22206function Ac(a,b){var c=null==b.defaultValue?"":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=yc(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 Bc(a,b){b=b.checked;null!=b&&xc(a,"checked",b,!1)}
22207function Cc(a,b){Bc(a,b);var c=yc(b.value),d=b.type;if(null!=c)if("number"===d){if(0===c&&""===a.value||a.value!=c)a.value=""+c}else a.value!==""+c&&(a.value=""+c);else if("submit"===d||"reset"===d){a.removeAttribute("value");return}b.hasOwnProperty("value")?Dc(a,b.type,c):b.hasOwnProperty("defaultValue")&&Dc(a,b.type,yc(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}
22208function Ec(a,b,c){if(b.hasOwnProperty("value")||b.hasOwnProperty("defaultValue")){var d=b.type;if(!("submit"!==d&&"reset"!==d||void 0!==b.value&&null!==b.value))return;b=""+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;""!==c&&(a.name="");a.defaultChecked=!a.defaultChecked;a.defaultChecked=!!a._wrapperState.initialChecked;""!==c&&(a.name=c)}
22209function Dc(a,b,c){if("number"!==b||a.ownerDocument.activeElement!==a)null==c?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c)}var Fc={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Gc(a,b,c){a=z.getPooled(Fc.change,a,b,c);a.type="change";Ib(c);Ra(a);return a}var Jc=null,Kc=null;function Lc(a){Ea(a)}
22210function Mc(a){var b=Ka(a);if(Wb(b))return a}function Nc(a,b){if("change"===a)return b}var Oc=!1;Sa&&(Oc=Sb("input")&&(!document.documentMode||9<document.documentMode));function Pc(){Jc&&(Jc.detachEvent("onpropertychange",Qc),Kc=Jc=null)}function Qc(a){"value"===a.propertyName&&Mc(Kc)&&(a=Gc(Kc,a,Rb(a)),Ob(Lc,a))}function Rc(a,b,c){"focus"===a?(Pc(),Jc=b,Kc=c,Jc.attachEvent("onpropertychange",Qc)):"blur"===a&&Pc()}function Sc(a){if("selectionchange"===a||"keyup"===a||"keydown"===a)return Mc(Kc)}
22211function Tc(a,b){if("click"===a)return Mc(b)}function Uc(a,b){if("input"===a||"change"===a)return Mc(b)}
22212var Vc={eventTypes:Fc,_isInputEventSupported:Oc,extractEvents:function(a,b,c,d){var e=b?Ka(b):window,f=void 0,g=void 0,h=e.nodeName&&e.nodeName.toLowerCase();"select"===h||"input"===h&&"file"===e.type?f=Nc:Qb(e)?Oc?f=Uc:(f=Sc,g=Rc):(h=e.nodeName)&&"input"===h.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)&&(f=Tc);if(f&&(f=f(a,b)))return Gc(f,c,d);g&&g(a,e,b);"blur"===a&&(a=e._wrapperState)&&a.controlled&&"number"===e.type&&Dc(e,"number",e.value)}},Wc=z.extend({view:null,detail:null}),Xc={Alt:"altKey",
22213Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yc(a){var b=this.nativeEvent;return b.getModifierState?b.getModifierState(a):(a=Xc[a])?!!b[a]:!1}function Zc(){return Yc}
22214var $c=0,ad=0,bd=!1,cd=!1,dd=Wc.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Zc,button:null,buttons:null,relatedTarget:function(a){return a.relatedTarget||(a.fromElement===a.srcElement?a.toElement:a.fromElement)},movementX:function(a){if("movementX"in a)return a.movementX;var b=$c;$c=a.screenX;return bd?"mousemove"===a.type?a.screenX-b:0:(bd=!0,0)},movementY:function(a){if("movementY"in a)return a.movementY;
22215var b=ad;ad=a.screenY;return cd?"mousemove"===a.type?a.screenY-b:0:(cd=!0,0)}}),ed=dd.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),fd={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",
22216dependencies:["pointerout","pointerover"]}},gd={eventTypes:fd,extractEvents:function(a,b,c,d){var e="mouseover"===a||"pointerover"===a,f="mouseout"===a||"pointerout"===a;if(e&&(c.relatedTarget||c.fromElement)||!f&&!e)return null;e=d.window===d?d:(e=d.ownerDocument)?e.defaultView||e.parentWindow:window;f?(f=b,b=(b=c.relatedTarget||c.toElement)?Ia(b):null):f=null;if(f===b)return null;var g=void 0,h=void 0,k=void 0,l=void 0;if("mouseout"===a||"mouseover"===a)g=dd,h=fd.mouseLeave,k=fd.mouseEnter,l="mouse";
22217else if("pointerout"===a||"pointerover"===a)g=ed,h=fd.pointerLeave,k=fd.pointerEnter,l="pointer";var m=null==f?e:Ka(f);e=null==b?e:Ka(b);a=g.getPooled(h,f,c,d);a.type=l+"leave";a.target=m;a.relatedTarget=e;c=g.getPooled(k,b,c,d);c.type=l+"enter";c.target=e;c.relatedTarget=m;d=b;if(f&&d)a:{b=f;e=d;l=0;for(g=b;g;g=Ma(g))l++;g=0;for(k=e;k;k=Ma(k))g++;for(;0<l-g;)b=Ma(b),l--;for(;0<g-l;)e=Ma(e),g--;for(;l--;){if(b===e||b===e.alternate)break a;b=Ma(b);e=Ma(e)}b=null}else b=null;e=b;for(b=[];f&&f!==e;){l=
22218f.alternate;if(null!==l&&l===e)break;b.push(f);f=Ma(f)}for(f=[];d&&d!==e;){l=d.alternate;if(null!==l&&l===e)break;f.push(d);d=Ma(d)}for(d=0;d<b.length;d++)Pa(b[d],"bubbled",a);for(d=f.length;0<d--;)Pa(f[d],"captured",c);return[a,c]}},hd=Object.prototype.hasOwnProperty;function id(a,b){return a===b?0!==a||0!==b||1/a===1/b:a!==a&&b!==b}
22219function jd(a,b){if(id(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++)if(!hd.call(b,c[d])||!id(a[c[d]],b[c[d]]))return!1;return!0}function kd(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 ld(a){2!==kd(a)?t("188"):void 0}
22220function md(a){var b=a.alternate;if(!b)return b=kd(a),3===b?t("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 g=e.child;g;){if(g===c)return ld(e),a;if(g===d)return ld(e),b;g=g.sibling}t("188")}if(c.return!==d.return)c=e,d=f;else{g=!1;for(var h=e.child;h;){if(h===c){g=!0;c=e;d=f;break}if(h===d){g=!0;d=e;c=f;break}h=h.sibling}if(!g){for(h=f.child;h;){if(h===c){g=!0;c=f;d=e;break}if(h===d){g=!0;d=f;c=e;break}h=h.sibling}g?
22221void 0:t("189")}}c.alternate!==d?t("190"):void 0}3!==c.tag?t("188"):void 0;return c.stateNode.current===c?a:b}function nd(a){a=md(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}
22222var od=z.extend({animationName:null,elapsedTime:null,pseudoElement:null}),pd=z.extend({clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),qd=Wc.extend({relatedTarget:null});function rd(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}
22223var sd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},td={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",
22224116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ud=Wc.extend({key:function(a){if(a.key){var b=sd[a.key]||a.key;if("Unidentified"!==b)return b}return"keypress"===a.type?(a=rd(a),13===a?"Enter":String.fromCharCode(a)):"keydown"===a.type||"keyup"===a.type?td[a.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Zc,charCode:function(a){return"keypress"===
22225a.type?rd(a):0},keyCode:function(a){return"keydown"===a.type||"keyup"===a.type?a.keyCode:0},which:function(a){return"keypress"===a.type?rd(a):"keydown"===a.type||"keyup"===a.type?a.keyCode:0}}),vd=dd.extend({dataTransfer:null}),wd=Wc.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Zc}),xd=z.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),yd=dd.extend({deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in
22226a?-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}),zd=[["abort","abort"],[Ya,"animationEnd"],[Za,"animationIteration"],[$a,"animationStart"],["canplay","canPlay"],["canplaythrough","canPlayThrough"],["drag","drag"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],
22227["ended","ended"],["error","error"],["gotpointercapture","gotPointerCapture"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["loadstart","loadStart"],["lostpointercapture","lostPointerCapture"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["playing","playing"],["pointermove","pointerMove"],["pointerout","pointerOut"],["pointerover","pointerOver"],["progress","progress"],["scroll","scroll"],["seeking","seeking"],["stalled","stalled"],
22228["suspend","suspend"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchmove","touchMove"],[ab,"transitionEnd"],["waiting","waiting"],["wheel","wheel"]],Ad={},Bd={};function Cd(a,b){var c=a[0];a=a[1];var d="on"+(a[0].toUpperCase()+a.slice(1));b={phasedRegistrationNames:{bubbled:d,captured:d+"Capture"},dependencies:[c],isInteractive:b};Ad[a]=b;Bd[c]=b}
22229[["blur","blur"],["cancel","cancel"],["click","click"],["close","close"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["auxclick","auxClick"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragstart","dragStart"],["drop","drop"],["focus","focus"],["input","input"],["invalid","invalid"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["mousedown","mouseDown"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["pointercancel","pointerCancel"],
22230["pointerdown","pointerDown"],["pointerup","pointerUp"],["ratechange","rateChange"],["reset","reset"],["seeked","seeked"],["submit","submit"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchstart","touchStart"],["volumechange","volumeChange"]].forEach(function(a){Cd(a,!0)});zd.forEach(function(a){Cd(a,!1)});
22231var Dd={eventTypes:Ad,isInteractiveTopLevelEventType:function(a){a=Bd[a];return void 0!==a&&!0===a.isInteractive},extractEvents:function(a,b,c,d){var e=Bd[a];if(!e)return null;switch(a){case "keypress":if(0===rd(c))return null;case "keydown":case "keyup":a=ud;break;case "blur":case "focus":a=qd;break;case "click":if(2===c.button)return null;case "auxclick":case "dblclick":case "mousedown":case "mousemove":case "mouseup":case "mouseout":case "mouseover":case "contextmenu":a=dd;break;case "drag":case "dragend":case "dragenter":case "dragexit":case "dragleave":case "dragover":case "dragstart":case "drop":a=
22232vd;break;case "touchcancel":case "touchend":case "touchmove":case "touchstart":a=wd;break;case Ya:case Za:case $a:a=od;break;case ab:a=xd;break;case "scroll":a=Wc;break;case "wheel":a=yd;break;case "copy":case "cut":case "paste":a=pd;break;case "gotpointercapture":case "lostpointercapture":case "pointercancel":case "pointerdown":case "pointermove":case "pointerout":case "pointerover":case "pointerup":a=ed;break;default:a=z}b=a.getPooled(e,b,c,d);Ra(b);return b}},Ed=Dd.isInteractiveTopLevelEventType,
22233Fd=[];function Gd(a){var b=a.targetInst,c=b;do{if(!c){a.ancestors.push(c);break}var d;for(d=c;d.return;)d=d.return;d=3!==d.tag?null:d.stateNode.containerInfo;if(!d)break;a.ancestors.push(c);c=Ia(d)}while(c);for(c=0;c<a.ancestors.length;c++){b=a.ancestors[c];var e=Rb(a.nativeEvent);d=a.topLevelType;for(var f=a.nativeEvent,g=null,h=0;h<pa.length;h++){var k=pa[h];k&&(k=k.extractEvents(d,b,f,e))&&(g=ya(g,k))}Ea(g)}}var Hd=!0;
22234function H(a,b){if(!b)return null;var c=(Ed(a)?Id:Jd).bind(null,a);b.addEventListener(a,c,!1)}function Kd(a,b){if(!b)return null;var c=(Ed(a)?Id:Jd).bind(null,a);b.addEventListener(a,c,!0)}function Id(a,b){Lb(Jd,a,b)}
22235function Jd(a,b){if(Hd){var c=Rb(b);c=Ia(c);null===c||"number"!==typeof c.tag||2===kd(c)||(c=null);if(Fd.length){var d=Fd.pop();d.topLevelType=a;d.nativeEvent=b;d.targetInst=c;a=d}else a={topLevelType:a,nativeEvent:b,targetInst:c,ancestors:[]};try{Ob(Gd,a)}finally{a.topLevelType=null,a.nativeEvent=null,a.targetInst=null,a.ancestors.length=0,10>Fd.length&&Fd.push(a)}}}var Ld={},Md=0,Nd="_reactListenersID"+(""+Math.random()).slice(2);
22236function Od(a){Object.prototype.hasOwnProperty.call(a,Nd)||(a[Nd]=Md++,Ld[a[Nd]]={});return Ld[a[Nd]]}function Pd(a){a=a||("undefined"!==typeof document?document:void 0);if("undefined"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}function Qd(a){for(;a&&a.firstChild;)a=a.firstChild;return a}
22237function Rd(a,b){var c=Qd(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=Qd(c)}}function Sd(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Sd(a,b.parentNode):"contains"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}
22238function Td(){for(var a=window,b=Pd();b instanceof a.HTMLIFrameElement;){try{a=b.contentDocument.defaultView}catch(c){break}b=Pd(a.document)}return b}function Ud(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&("text"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type||"password"===a.type)||"textarea"===b||"true"===a.contentEditable)}
22239var Vd=Sa&&"documentMode"in document&&11>=document.documentMode,Wd={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Xd=null,Yd=null,Zd=null,$d=!1;
22240function ae(a,b){var c=b.window===b?b.document:9===b.nodeType?b:b.ownerDocument;if($d||null==Xd||Xd!==Pd(c))return null;c=Xd;"selectionStart"in c&&Ud(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset});return Zd&&jd(Zd,c)?null:(Zd=c,a=z.getPooled(Wd.select,Yd,a,b),a.type="select",a.target=Xd,Ra(a),a)}
22241var be={eventTypes:Wd,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=Od(e);f=ta.onSelect;for(var g=0;g<f.length;g++){var h=f[g];if(!e.hasOwnProperty(h)||!e[h]){e=!1;break a}}e=!0}f=!e}if(f)return null;e=b?Ka(b):window;switch(a){case "focus":if(Qb(e)||"true"===e.contentEditable)Xd=e,Yd=b,Zd=null;break;case "blur":Zd=Yd=Xd=null;break;case "mousedown":$d=!0;break;case "contextmenu":case "mouseup":case "dragend":return $d=!1,ae(c,d);case "selectionchange":if(Vd)break;
22242case "keydown":case "keyup":return ae(c,d)}return null}};Ca.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" "));ua=La;va=Ja;wa=Ka;Ca.injectEventPluginsByName({SimpleEventPlugin:Dd,EnterLeaveEventPlugin:gd,ChangeEventPlugin:Vc,SelectEventPlugin:be,BeforeInputEventPlugin:Bb});function de(a){var b="";aa.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}
22243function ee(a,b){a=n({children:void 0},b);if(b=de(b.children))a.children=b;return a}function fe(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=""+yc(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)}}
22244function ge(a,b){null!=b.dangerouslySetInnerHTML?t("91"):void 0;return n({},b,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function he(a,b){var c=b.value;null==c&&(c=b.defaultValue,b=b.children,null!=b&&(null!=c?t("92"):void 0,Array.isArray(b)&&(1>=b.length?void 0:t("93"),b=b[0]),c=b),null==c&&(c=""));a._wrapperState={initialValue:yc(c)}}
22245function ie(a,b){var c=yc(b.value),d=yc(b.defaultValue);null!=c&&(c=""+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=""+d)}function je(a){var b=a.textContent;b===a._wrapperState.initialValue&&(a.value=b)}var ke={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};
22246function le(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 me(a,b){return null==a||"http://www.w3.org/1999/xhtml"===a?le(b):"http://www.w3.org/2000/svg"===a&&"foreignObject"===b?"http://www.w3.org/1999/xhtml":a}
22247var ne=void 0,oe=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!==ke.svg||"innerHTML"in a)a.innerHTML=b;else{ne=ne||document.createElement("div");ne.innerHTML="<svg>"+b+"</svg>";for(b=ne.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});
22248function pe(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}
22249var qe={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,gridArea:!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,
22250floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},re=["Webkit","ms","Moz","O"];Object.keys(qe).forEach(function(a){re.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);qe[b]=qe[a]})});function se(a,b,c){return null==b||"boolean"===typeof b||""===b?"":c||"number"!==typeof b||0===b||qe.hasOwnProperty(a)&&qe[a]?(""+b).trim():b+"px"}
22251function te(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf("--"),e=se(c,b[c],d);"float"===c&&(c="cssFloat");d?a.setProperty(c,e):a[c]=e}}var ue=n({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});
22252function ve(a,b){b&&(ue[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML?t("137",a,""):void 0),null!=b.dangerouslySetInnerHTML&&(null!=b.children?t("60"):void 0,"object"===typeof b.dangerouslySetInnerHTML&&"__html"in b.dangerouslySetInnerHTML?void 0:t("61")),null!=b.style&&"object"!==typeof b.style?t("62",""):void 0)}
22253function we(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}}
22254function xe(a,b){a=9===a.nodeType||11===a.nodeType?a:a.ownerDocument;var c=Od(a);b=ta[b];for(var d=0;d<b.length;d++){var e=b[d];if(!c.hasOwnProperty(e)||!c[e]){switch(e){case "scroll":Kd("scroll",a);break;case "focus":case "blur":Kd("focus",a);Kd("blur",a);c.blur=!0;c.focus=!0;break;case "cancel":case "close":Sb(e)&&Kd(e,a);break;case "invalid":case "submit":case "reset":break;default:-1===bb.indexOf(e)&&H(e,a)}c[e]=!0}}}function ye(){}var ze=null,Ae=null;
22255function Be(a,b){switch(a){case "button":case "input":case "select":case "textarea":return!!b.autoFocus}return!1}function Ce(a,b){return"textarea"===a||"option"===a||"noscript"===a||"string"===typeof b.children||"number"===typeof b.children||"object"===typeof b.dangerouslySetInnerHTML&&null!==b.dangerouslySetInnerHTML&&null!=b.dangerouslySetInnerHTML.__html}var De="function"===typeof setTimeout?setTimeout:void 0,Ee="function"===typeof clearTimeout?clearTimeout:void 0;
22256function Fe(a,b,c,d,e){a[Ha]=e;"input"===c&&"radio"===e.type&&null!=e.name&&Bc(a,e);we(c,d);d=we(c,e);for(var f=0;f<b.length;f+=2){var g=b[f],h=b[f+1];"style"===g?te(a,h):"dangerouslySetInnerHTML"===g?oe(a,h):"children"===g?pe(a,h):xc(a,g,h,d)}switch(c){case "input":Cc(a,e);break;case "textarea":ie(a,e);break;case "select":b=a._wrapperState.wasMultiple,a._wrapperState.wasMultiple=!!e.multiple,c=e.value,null!=c?fe(a,!!e.multiple,c,!1):b!==!!e.multiple&&(null!=e.defaultValue?fe(a,!!e.multiple,e.defaultValue,
22257!0):fe(a,!!e.multiple,e.multiple?[]:"",!1))}}function Ge(a){for(a=a.nextSibling;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a}function He(a){for(a=a.firstChild;a&&1!==a.nodeType&&3!==a.nodeType;)a=a.nextSibling;return a}new Set;var Ie=[],Je=-1;function I(a){0>Je||(a.current=Ie[Je],Ie[Je]=null,Je--)}function J(a,b){Je++;Ie[Je]=a.current;a.current=b}var Ke={},K={current:Ke},L={current:!1},Le=Ke;
22258function Me(a,b){var c=a.type.contextTypes;if(!c)return Ke;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function M(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Ne(a){I(L,a);I(K,a)}function Oe(a){I(L,a);I(K,a)}
22259function Pe(a,b,c){K.current!==Ke?t("168"):void 0;J(K,b,a);J(L,c,a)}function Qe(a,b,c){var d=a.stateNode;a=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)e in a?void 0:t("108",mc(b)||"Unknown",e);return n({},c,d)}function Re(a){var b=a.stateNode;b=b&&b.__reactInternalMemoizedMergedChildContext||Ke;Le=K.current;J(K,b,a);J(L,L.current,a);return!0}
22260function Se(a,b,c){var d=a.stateNode;d?void 0:t("169");c?(b=Qe(a,b,Le),d.__reactInternalMemoizedMergedChildContext=b,I(L,a),I(K,a),J(K,b,a)):I(L,a);J(L,c,a)}var Te=null,Ue=null;function Ve(a){return function(b){try{return a(b)}catch(c){}}}
22261function We(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);Te=Ve(function(a){return b.onCommitFiberRoot(c,a)});Ue=Ve(function(a){return b.onCommitFiberUnmount(c,a)})}catch(d){}return!0}
22262function Xe(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.firstContextDependency=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.effectTag=0;this.lastEffect=this.firstEffect=this.nextEffect=null;this.childExpirationTime=this.expirationTime=0;this.alternate=null}function N(a,b,c,d){return new Xe(a,b,c,d)}
22263function Ye(a){a=a.prototype;return!(!a||!a.isReactComponent)}function Ze(a){if("function"===typeof a)return Ye(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===gc)return 11;if(a===ic)return 14}return 2}
22264function $e(a,b){var c=a.alternate;null===c?(c=N(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.effectTag=0,c.nextEffect=null,c.firstEffect=null,c.lastEffect=null);c.childExpirationTime=a.childExpirationTime;c.expirationTime=a.expirationTime;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;c.firstContextDependency=a.firstContextDependency;c.sibling=a.sibling;
22265c.index=a.index;c.ref=a.ref;return c}
22266function af(a,b,c,d,e,f){var g=2;d=a;if("function"===typeof a)Ye(a)&&(g=1);else if("string"===typeof a)g=5;else a:switch(a){case ac:return bf(c.children,e,f,b);case fc:return cf(c,e|3,f,b);case bc:return cf(c,e|2,f,b);case cc:return a=N(12,c,b,e|4),a.elementType=cc,a.type=cc,a.expirationTime=f,a;case hc:return a=N(13,c,b,e),a.elementType=hc,a.type=hc,a.expirationTime=f,a;default:if("object"===typeof a&&null!==a)switch(a.$$typeof){case dc:g=10;break a;case ec:g=9;break a;case gc:g=11;break a;case ic:g=
2226714;break a;case jc:g=16;d=null;break a}t("130",null==a?a:typeof a,"")}b=N(g,c,b,e);b.elementType=a;b.type=d;b.expirationTime=f;return b}function bf(a,b,c,d){a=N(7,a,d,b);a.expirationTime=c;return a}function cf(a,b,c,d){a=N(8,a,d,b);b=0===(b&1)?bc:fc;a.elementType=b;a.type=b;a.expirationTime=c;return a}function df(a,b,c){a=N(6,a,null,b);a.expirationTime=c;return a}
22268function ef(a,b,c){b=N(4,null!==a.children?a.children:[],a.key,b);b.expirationTime=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}function ff(a,b){a.didError=!1;var c=a.earliestPendingTime;0===c?a.earliestPendingTime=a.latestPendingTime=b:c<b?a.earliestPendingTime=b:a.latestPendingTime>b&&(a.latestPendingTime=b);gf(b,a)}
22269function hf(a,b){a.didError=!1;a.latestPingedTime>=b&&(a.latestPingedTime=0);var c=a.earliestPendingTime,d=a.latestPendingTime;c===b?a.earliestPendingTime=d===b?a.latestPendingTime=0:d:d===b&&(a.latestPendingTime=c);c=a.earliestSuspendedTime;d=a.latestSuspendedTime;0===c?a.earliestSuspendedTime=a.latestSuspendedTime=b:c<b?a.earliestSuspendedTime=b:d>b&&(a.latestSuspendedTime=b);gf(b,a)}function jf(a,b){var c=a.earliestPendingTime;a=a.earliestSuspendedTime;c>b&&(b=c);a>b&&(b=a);return b}
22270function gf(a,b){var c=b.earliestSuspendedTime,d=b.latestSuspendedTime,e=b.earliestPendingTime,f=b.latestPingedTime;e=0!==e?e:f;0===e&&(0===a||d<a)&&(e=d);a=e;0!==a&&c>a&&(a=c);b.nextExpirationTimeToWorkOn=e;b.expirationTime=a}var kf=!1;function lf(a){return{baseState:a,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}
22271function mf(a){return{baseState:a.baseState,firstUpdate:a.firstUpdate,lastUpdate:a.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function nf(a){return{expirationTime:a,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function of(a,b){null===a.lastUpdate?a.firstUpdate=a.lastUpdate=b:(a.lastUpdate.next=b,a.lastUpdate=b)}
22272function pf(a,b){var c=a.alternate;if(null===c){var d=a.updateQueue;var e=null;null===d&&(d=a.updateQueue=lf(a.memoizedState))}else d=a.updateQueue,e=c.updateQueue,null===d?null===e?(d=a.updateQueue=lf(a.memoizedState),e=c.updateQueue=lf(c.memoizedState)):d=a.updateQueue=mf(e):null===e&&(e=c.updateQueue=mf(d));null===e||d===e?of(d,b):null===d.lastUpdate||null===e.lastUpdate?(of(d,b),of(e,b)):(of(d,b),e.lastUpdate=b)}
22273function qf(a,b){var c=a.updateQueue;c=null===c?a.updateQueue=lf(a.memoizedState):rf(a,c);null===c.lastCapturedUpdate?c.firstCapturedUpdate=c.lastCapturedUpdate=b:(c.lastCapturedUpdate.next=b,c.lastCapturedUpdate=b)}function rf(a,b){var c=a.alternate;null!==c&&b===c.updateQueue&&(b=a.updateQueue=mf(b));return b}
22274function sf(a,b,c,d,e,f){switch(c.tag){case 1:return a=c.payload,"function"===typeof a?a.call(f,d,e):a;case 3:a.effectTag=a.effectTag&-2049|64;case 0:a=c.payload;e="function"===typeof a?a.call(f,d,e):a;if(null===e||void 0===e)break;return n({},d,e);case 2:kf=!0}return d}
22275function tf(a,b,c,d,e){kf=!1;b=rf(a,b);for(var f=b.baseState,g=null,h=0,k=b.firstUpdate,l=f;null!==k;){var m=k.expirationTime;m<e?(null===g&&(g=k,f=l),h<m&&(h=m)):(l=sf(a,b,k,l,c,d),null!==k.callback&&(a.effectTag|=32,k.nextEffect=null,null===b.lastEffect?b.firstEffect=b.lastEffect=k:(b.lastEffect.nextEffect=k,b.lastEffect=k)));k=k.next}m=null;for(k=b.firstCapturedUpdate;null!==k;){var r=k.expirationTime;r<e?(null===m&&(m=k,null===g&&(f=l)),h<r&&(h=r)):(l=sf(a,b,k,l,c,d),null!==k.callback&&(a.effectTag|=
2227632,k.nextEffect=null,null===b.lastCapturedEffect?b.firstCapturedEffect=b.lastCapturedEffect=k:(b.lastCapturedEffect.nextEffect=k,b.lastCapturedEffect=k)));k=k.next}null===g&&(b.lastUpdate=null);null===m?b.lastCapturedUpdate=null:a.effectTag|=32;null===g&&null===m&&(f=l);b.baseState=f;b.firstUpdate=g;b.firstCapturedUpdate=m;a.expirationTime=h;a.memoizedState=l}
22277function uf(a,b,c){null!==b.firstCapturedUpdate&&(null!==b.lastUpdate&&(b.lastUpdate.next=b.firstCapturedUpdate,b.lastUpdate=b.lastCapturedUpdate),b.firstCapturedUpdate=b.lastCapturedUpdate=null);vf(b.firstEffect,c);b.firstEffect=b.lastEffect=null;vf(b.firstCapturedEffect,c);b.firstCapturedEffect=b.lastCapturedEffect=null}function vf(a,b){for(;null!==a;){var c=a.callback;if(null!==c){a.callback=null;var d=b;"function"!==typeof c?t("191",c):void 0;c.call(d)}a=a.nextEffect}}
22278function wf(a,b){return{value:a,source:b,stack:nc(b)}}var xf={current:null},yf=null,zf=null,Af=null;function Bf(a,b){var c=a.type._context;J(xf,c._currentValue,a);c._currentValue=b}function Cf(a){var b=xf.current;I(xf,a);a.type._context._currentValue=b}function Df(a){yf=a;Af=zf=null;a.firstContextDependency=null}
22279function Ef(a,b){if(Af!==a&&!1!==b&&0!==b){if("number"!==typeof b||1073741823===b)Af=a,b=1073741823;b={context:a,observedBits:b,next:null};null===zf?(null===yf?t("293"):void 0,yf.firstContextDependency=zf=b):zf=zf.next=b}return a._currentValue}var Ff={},O={current:Ff},Gf={current:Ff},Hf={current:Ff};function If(a){a===Ff?t("174"):void 0;return a}
22280function Jf(a,b){J(Hf,b,a);J(Gf,a,a);J(O,Ff,a);var c=b.nodeType;switch(c){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:me(null,"");break;default:c=8===c?b.parentNode:b,b=c.namespaceURI||null,c=c.tagName,b=me(b,c)}I(O,a);J(O,b,a)}function Kf(a){I(O,a);I(Gf,a);I(Hf,a)}function Lf(a){If(Hf.current);var b=If(O.current);var c=me(b,a.type);b!==c&&(J(Gf,a,a),J(O,c,a))}function Mf(a){Gf.current===a&&(I(O,a),I(Gf,a))}
22281function P(a,b){if(a&&a.defaultProps){b=n({},b);a=a.defaultProps;for(var c in a)void 0===b[c]&&(b[c]=a[c])}return b}function Nf(a){var b=a._result;switch(a._status){case 1:return b;case 2:throw b;case 0:throw b;default:throw a._status=0,b=a._ctor,b=b(),b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b)},function(b){0===a._status&&(a._status=2,a._result=b)}),a._result=b,b;}}var Of=Xb.ReactCurrentOwner,Pf=(new aa.Component).refs;
22282function Qf(a,b,c,d){b=a.memoizedState;c=c(d,b);c=null===c||void 0===c?b:n({},b,c);a.memoizedState=c;d=a.updateQueue;null!==d&&0===a.expirationTime&&(d.baseState=c)}
22283var Vf={isMounted:function(a){return(a=a._reactInternalFiber)?2===kd(a):!1},enqueueSetState:function(a,b,c){a=a._reactInternalFiber;var d=Rf();d=Sf(d,a);var e=nf(d);e.payload=b;void 0!==c&&null!==c&&(e.callback=c);Tf();pf(a,e);Uf(a,d)},enqueueReplaceState:function(a,b,c){a=a._reactInternalFiber;var d=Rf();d=Sf(d,a);var e=nf(d);e.tag=1;e.payload=b;void 0!==c&&null!==c&&(e.callback=c);Tf();pf(a,e);Uf(a,d)},enqueueForceUpdate:function(a,b){a=a._reactInternalFiber;var c=Rf();c=Sf(c,a);var d=nf(c);d.tag=
222842;void 0!==b&&null!==b&&(d.callback=b);Tf();pf(a,d);Uf(a,c)}};function Wf(a,b,c,d,e,f,g){a=a.stateNode;return"function"===typeof a.shouldComponentUpdate?a.shouldComponentUpdate(d,f,g):b.prototype&&b.prototype.isPureReactComponent?!jd(c,d)||!jd(e,f):!0}
22285function Xf(a,b,c){var d=!1,e=Ke;var f=b.contextType;"object"===typeof f&&null!==f?f=Of.currentDispatcher.readContext(f):(e=M(b)?Le:K.current,d=b.contextTypes,f=(d=null!==d&&void 0!==d)?Me(a,e):Ke);b=new b(c,f);a.memoizedState=null!==b.state&&void 0!==b.state?b.state:null;b.updater=Vf;a.stateNode=b;b._reactInternalFiber=a;d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=e,a.__reactInternalMemoizedMaskedChildContext=f);return b}
22286function Zf(a,b,c,d){a=b.state;"function"===typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d);"function"===typeof b.UNSAFE_componentWillReceiveProps&&b.UNSAFE_componentWillReceiveProps(c,d);b.state!==a&&Vf.enqueueReplaceState(b,b.state,null)}
22287function $f(a,b,c,d){var e=a.stateNode;e.props=c;e.state=a.memoizedState;e.refs=Pf;var f=b.contextType;"object"===typeof f&&null!==f?e.context=Of.currentDispatcher.readContext(f):(f=M(b)?Le:K.current,e.context=Me(a,f));f=a.updateQueue;null!==f&&(tf(a,f,c,e,d),e.state=a.memoizedState);f=b.getDerivedStateFromProps;"function"===typeof f&&(Qf(a,b,f,c),e.state=a.memoizedState);"function"===typeof b.getDerivedStateFromProps||"function"===typeof e.getSnapshotBeforeUpdate||"function"!==typeof e.UNSAFE_componentWillMount&&
22288"function"!==typeof e.componentWillMount||(b=e.state,"function"===typeof e.componentWillMount&&e.componentWillMount(),"function"===typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),b!==e.state&&Vf.enqueueReplaceState(e,e.state,null),f=a.updateQueue,null!==f&&(tf(a,f,c,e,d),e.state=a.memoizedState));"function"===typeof e.componentDidMount&&(a.effectTag|=4)}var ag=Array.isArray;
22289function bg(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&&(1!==c.tag?t("289"):void 0,d=c.stateNode);d?void 0:t("147",a);var e=""+a;if(null!==b&&null!==b.ref&&"function"===typeof b.ref&&b.ref._stringRef===e)return b.ref;b=function(a){var b=d.refs;b===Pf&&(b=d.refs={});null===a?delete b[e]:b[e]=a};b._stringRef=e;return b}"string"!==typeof a?t("284"):void 0;c._owner?void 0:t("290",a)}return a}
22290function cg(a,b){"textarea"!==a.type&&t("31","[object Object]"===Object.prototype.toString.call(b)?"object with keys {"+Object.keys(b).join(", ")+"}":b,"")}
22291function dg(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=$e(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=
222922,c):d;b.effectTag=2;return c}function g(b){a&&null===b.alternate&&(b.effectTag=2);return b}function h(a,b,c,d){if(null===b||6!==b.tag)return b=df(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.elementType===c.type)return d=e(b,c.props,d),d.ref=bg(a,b,c),d.return=a,d;d=af(c.type,c.key,c.props,null,a.mode,d);d.ref=bg(a,b,c);d.return=a;return d}function l(a,b,c,d){if(null===b||4!==b.tag||b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==
22293c.implementation)return b=ef(c,a.mode,d),b.return=a,b;b=e(b,c.children||[],d);b.return=a;return b}function m(a,b,c,d,g){if(null===b||7!==b.tag)return b=bf(c,a.mode,d,g),b.return=a,b;b=e(b,c,d);b.return=a;return b}function r(a,b,c){if("string"===typeof b||"number"===typeof b)return b=df(""+b,a.mode,c),b.return=a,b;if("object"===typeof b&&null!==b){switch(b.$$typeof){case Zb:return c=af(b.type,b.key,b.props,null,a.mode,c),c.ref=bg(a,null,b),c.return=a,c;case $b:return b=ef(b,a.mode,c),b.return=a,b}if(ag(b)||
22294lc(b))return b=bf(b,a.mode,c,null),b.return=a,b;cg(a,b)}return null}function w(a,b,c,d){var e=null!==b?b.key:null;if("string"===typeof c||"number"===typeof c)return null!==e?null:h(a,b,""+c,d);if("object"===typeof c&&null!==c){switch(c.$$typeof){case Zb:return c.key===e?c.type===ac?m(a,b,c.props.children,d,e):k(a,b,c,d):null;case $b:return c.key===e?l(a,b,c,d):null}if(ag(c)||lc(c))return null!==e?null:m(a,b,c,d,null);cg(a,c)}return null}function y(a,b,c,d,e){if("string"===typeof d||"number"===typeof d)return a=
22295a.get(c)||null,h(b,a,""+d,e);if("object"===typeof d&&null!==d){switch(d.$$typeof){case Zb:return a=a.get(null===d.key?c:d.key)||null,d.type===ac?m(b,a,d.props.children,e,d.key):k(b,a,d,e);case $b:return a=a.get(null===d.key?c:d.key)||null,l(b,a,d,e)}if(ag(d)||lc(d))return a=a.get(c)||null,m(b,a,d,e,null);cg(b,d)}return null}function B(e,g,h,k){for(var l=null,q=null,m=g,u=g=0,p=null;null!==m&&u<h.length;u++){m.index>u?(p=m,m=null):p=m.sibling;var v=w(e,m,h[u],k);if(null===v){null===m&&(m=p);break}a&&
22296m&&null===v.alternate&&b(e,m);g=f(v,g,u);null===q?l=v:q.sibling=v;q=v;m=p}if(u===h.length)return c(e,m),l;if(null===m){for(;u<h.length;u++)if(m=r(e,h[u],k))g=f(m,g,u),null===q?l=m:q.sibling=m,q=m;return l}for(m=d(e,m);u<h.length;u++)if(p=y(m,e,u,h[u],k))a&&null!==p.alternate&&m.delete(null===p.key?u:p.key),g=f(p,g,u),null===q?l=p:q.sibling=p,q=p;a&&m.forEach(function(a){return b(e,a)});return l}function R(e,g,h,k){var l=lc(h);"function"!==typeof l?t("150"):void 0;h=l.call(h);null==h?t("151"):void 0;
22297for(var m=l=null,q=g,u=g=0,p=null,v=h.next();null!==q&&!v.done;u++,v=h.next()){q.index>u?(p=q,q=null):p=q.sibling;var A=w(e,q,v.value,k);if(null===A){q||(q=p);break}a&&q&&null===A.alternate&&b(e,q);g=f(A,g,u);null===m?l=A:m.sibling=A;m=A;q=p}if(v.done)return c(e,q),l;if(null===q){for(;!v.done;u++,v=h.next())v=r(e,v.value,k),null!==v&&(g=f(v,g,u),null===m?l=v:m.sibling=v,m=v);return l}for(q=d(e,q);!v.done;u++,v=h.next())v=y(q,e,u,v.value,k),null!==v&&(a&&null!==v.alternate&&q.delete(null===v.key?u:
22298v.key),g=f(v,g,u),null===m?l=v:m.sibling=v,m=v);a&&q.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k="object"===typeof f&&null!==f&&f.type===ac&&null===f.key;k&&(f=f.props.children);var l="object"===typeof f&&null!==f;if(l)switch(f.$$typeof){case Zb:a:{l=f.key;for(k=d;null!==k;){if(k.key===l)if(7===k.tag?f.type===ac:k.elementType===f.type){c(a,k.sibling);d=e(k,f.type===ac?f.props.children:f.props,h);d.ref=bg(a,k,f);d.return=a;a=d;break a}else{c(a,k);break}else b(a,k);k=
22299k.sibling}f.type===ac?(d=bf(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=af(f.type,f.key,f.props,null,a.mode,h),h.ref=bg(a,d,f),h.return=a,a=h)}return g(a);case $b:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[],h);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=ef(f,a.mode,h);d.return=a;a=d}return g(a)}if("string"===typeof f||"number"===typeof f)return f=
22300""+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f,h),d.return=a,a=d):(c(a,d),d=df(f,a.mode,h),d.return=a,a=d),g(a);if(ag(f))return B(a,d,f,h);if(lc(f))return R(a,d,f,h);l&&cg(a,f);if("undefined"===typeof f&&!k)switch(a.tag){case 1:case 0:h=a.type,t("152",h.displayName||h.name||"Component")}return c(a,d)}}var eg=dg(!0),fg=dg(!1),gg=null,hg=null,ig=!1;
22301function jg(a,b){var c=N(5,null,null,0);c.elementType="DELETED";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 kg(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 6:return b=""===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;default:return!1}}
22302function lg(a){if(ig){var b=hg;if(b){var c=b;if(!kg(a,b)){b=Ge(c);if(!b||!kg(a,b)){a.effectTag|=2;ig=!1;gg=a;return}jg(gg,c)}gg=a;hg=He(b)}else a.effectTag|=2,ig=!1,gg=a}}function mg(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag;)a=a.return;gg=a}function ng(a){if(a!==gg)return!1;if(!ig)return mg(a),ig=!0,!1;var b=a.type;if(5!==a.tag||"head"!==b&&"body"!==b&&!Ce(b,a.memoizedProps))for(b=hg;b;)jg(a,b),b=Ge(b);mg(a);hg=gg?Ge(a.stateNode):null;return!0}function og(){hg=gg=null;ig=!1}var pg=Xb.ReactCurrentOwner;
22303function Q(a,b,c,d){b.child=null===a?fg(b,null,c,d):eg(b,a.child,c,d)}function qg(a,b,c,d,e){c=c.render;var f=b.ref;Df(b,e);d=c(d,f);b.effectTag|=1;Q(a,b,d,e);return b.child}
22304function rg(a,b,c,d,e,f){if(null===a){var g=c.type;if("function"===typeof g&&!Ye(g)&&void 0===g.defaultProps&&null===c.compare&&void 0===c.defaultProps)return b.tag=15,b.type=g,sg(a,b,g,d,e,f);a=af(c.type,null,d,null,b.mode,f);a.ref=b.ref;a.return=b;return b.child=a}g=a.child;if(e<f&&(e=g.memoizedProps,c=c.compare,c=null!==c?c:jd,c(e,d)&&a.ref===b.ref))return tg(a,b,f);b.effectTag|=1;a=$e(g,d,f);a.ref=b.ref;a.return=b;return b.child=a}
22305function sg(a,b,c,d,e,f){return null!==a&&e<f&&jd(a.memoizedProps,d)&&a.ref===b.ref?tg(a,b,f):ug(a,b,c,d,f)}function vg(a,b){var c=b.ref;if(null===a&&null!==c||null!==a&&a.ref!==c)b.effectTag|=128}function ug(a,b,c,d,e){var f=M(c)?Le:K.current;f=Me(b,f);Df(b,e);c=c(d,f);b.effectTag|=1;Q(a,b,c,e);return b.child}
22306function wg(a,b,c,d,e){if(M(c)){var f=!0;Re(b)}else f=!1;Df(b,e);if(null===b.stateNode)null!==a&&(a.alternate=null,b.alternate=null,b.effectTag|=2),Xf(b,c,d,e),$f(b,c,d,e),d=!0;else if(null===a){var g=b.stateNode,h=b.memoizedProps;g.props=h;var k=g.context,l=c.contextType;"object"===typeof l&&null!==l?l=Of.currentDispatcher.readContext(l):(l=M(c)?Le:K.current,l=Me(b,l));var m=c.getDerivedStateFromProps,r="function"===typeof m||"function"===typeof g.getSnapshotBeforeUpdate;r||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&
22307"function"!==typeof g.componentWillReceiveProps||(h!==d||k!==l)&&Zf(b,g,d,l);kf=!1;var w=b.memoizedState;k=g.state=w;var y=b.updateQueue;null!==y&&(tf(b,y,d,g,e),k=b.memoizedState);h!==d||w!==k||L.current||kf?("function"===typeof m&&(Qf(b,c,m,d),k=b.memoizedState),(h=kf||Wf(b,c,h,d,w,k,l))?(r||"function"!==typeof g.UNSAFE_componentWillMount&&"function"!==typeof g.componentWillMount||("function"===typeof g.componentWillMount&&g.componentWillMount(),"function"===typeof g.UNSAFE_componentWillMount&&
22308g.UNSAFE_componentWillMount()),"function"===typeof g.componentDidMount&&(b.effectTag|=4)):("function"===typeof g.componentDidMount&&(b.effectTag|=4),b.memoizedProps=d,b.memoizedState=k),g.props=d,g.state=k,g.context=l,d=h):("function"===typeof g.componentDidMount&&(b.effectTag|=4),d=!1)}else g=b.stateNode,h=b.memoizedProps,g.props=b.type===b.elementType?h:P(b.type,h),k=g.context,l=c.contextType,"object"===typeof l&&null!==l?l=Of.currentDispatcher.readContext(l):(l=M(c)?Le:K.current,l=Me(b,l)),m=c.getDerivedStateFromProps,
22309(r="function"===typeof m||"function"===typeof g.getSnapshotBeforeUpdate)||"function"!==typeof g.UNSAFE_componentWillReceiveProps&&"function"!==typeof g.componentWillReceiveProps||(h!==d||k!==l)&&Zf(b,g,d,l),kf=!1,k=b.memoizedState,w=g.state=k,y=b.updateQueue,null!==y&&(tf(b,y,d,g,e),w=b.memoizedState),h!==d||k!==w||L.current||kf?("function"===typeof m&&(Qf(b,c,m,d),w=b.memoizedState),(m=kf||Wf(b,c,h,d,k,w,l))?(r||"function"!==typeof g.UNSAFE_componentWillUpdate&&"function"!==typeof g.componentWillUpdate||
22310("function"===typeof g.componentWillUpdate&&g.componentWillUpdate(d,w,l),"function"===typeof g.UNSAFE_componentWillUpdate&&g.UNSAFE_componentWillUpdate(d,w,l)),"function"===typeof g.componentDidUpdate&&(b.effectTag|=4),"function"===typeof g.getSnapshotBeforeUpdate&&(b.effectTag|=256)):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&k===a.memoizedState||(b.effectTag|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&k===a.memoizedState||(b.effectTag|=256),b.memoizedProps=
22311d,b.memoizedState=w),g.props=d,g.state=w,g.context=l,d=m):("function"!==typeof g.componentDidUpdate||h===a.memoizedProps&&k===a.memoizedState||(b.effectTag|=4),"function"!==typeof g.getSnapshotBeforeUpdate||h===a.memoizedProps&&k===a.memoizedState||(b.effectTag|=256),d=!1);return xg(a,b,c,d,f,e)}
22312function xg(a,b,c,d,e,f){vg(a,b);var g=0!==(b.effectTag&64);if(!d&&!g)return e&&Se(b,c,!1),tg(a,b,f);d=b.stateNode;pg.current=b;var h=g&&"function"!==typeof c.getDerivedStateFromError?null:d.render();b.effectTag|=1;null!==a&&g?(b.child=eg(b,a.child,null,f),b.child=eg(b,null,h,f)):Q(a,b,h,f);b.memoizedState=d.state;e&&Se(b,c,!0);return b.child}function yg(a){var b=a.stateNode;b.pendingContext?Pe(a,b.pendingContext,b.pendingContext!==b.context):b.context&&Pe(a,b.context,!1);Jf(a,b.containerInfo)}
22313function zg(a,b,c){var d=b.mode,e=b.pendingProps,f=b.memoizedState;if(0===(b.effectTag&64)){f=null;var g=!1}else f={timedOutAt:null!==f?f.timedOutAt:0},g=!0,b.effectTag&=-65;if(null===a)if(g){var h=e.fallback;a=bf(null,d,0,null);0===(b.mode&1)&&(a.child=null!==b.memoizedState?b.child.child:b.child);d=bf(h,d,c,null);a.sibling=d;c=a;c.return=d.return=b}else c=d=fg(b,null,e.children,c);else null!==a.memoizedState?(d=a.child,h=d.sibling,g?(c=e.fallback,e=$e(d,d.pendingProps,0),0===(b.mode&1)&&(g=null!==
22314b.memoizedState?b.child.child:b.child,g!==d.child&&(e.child=g)),d=e.sibling=$e(h,c,h.expirationTime),c=e,e.childExpirationTime=0,c.return=d.return=b):c=d=eg(b,d.child,e.children,c)):(h=a.child,g?(g=e.fallback,e=bf(null,d,0,null),e.child=h,0===(b.mode&1)&&(e.child=null!==b.memoizedState?b.child.child:b.child),d=e.sibling=bf(g,d,c,null),d.effectTag|=2,c=e,e.childExpirationTime=0,c.return=d.return=b):d=c=eg(b,h,e.children,c)),b.stateNode=a.stateNode;b.memoizedState=f;b.child=c;return d}
22315function tg(a,b,c){null!==a&&(b.firstContextDependency=a.firstContextDependency);if(b.childExpirationTime<c)return null;null!==a&&b.child!==a.child?t("153"):void 0;if(null!==b.child){a=b.child;c=$e(a,a.pendingProps,a.expirationTime);b.child=c;for(c.return=b;null!==a.sibling;)a=a.sibling,c=c.sibling=$e(a,a.pendingProps,a.expirationTime),c.return=b;c.sibling=null}return b.child}
22316function Ag(a,b,c){var d=b.expirationTime;if(null!==a&&a.memoizedProps===b.pendingProps&&!L.current&&d<c){switch(b.tag){case 3:yg(b);og();break;case 5:Lf(b);break;case 1:M(b.type)&&Re(b);break;case 4:Jf(b,b.stateNode.containerInfo);break;case 10:Bf(b,b.memoizedProps.value);break;case 13:if(null!==b.memoizedState){d=b.child.childExpirationTime;if(0!==d&&d>=c)return zg(a,b,c);b=tg(a,b,c);return null!==b?b.sibling:null}}return tg(a,b,c)}b.expirationTime=0;switch(b.tag){case 2:d=b.elementType;null!==
22317a&&(a.alternate=null,b.alternate=null,b.effectTag|=2);a=b.pendingProps;var e=Me(b,K.current);Df(b,c);e=d(a,e);b.effectTag|=1;if("object"===typeof e&&null!==e&&"function"===typeof e.render&&void 0===e.$$typeof){b.tag=1;if(M(d)){var f=!0;Re(b)}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;var g=d.getDerivedStateFromProps;"function"===typeof g&&Qf(b,d,g,a);e.updater=Vf;b.stateNode=e;e._reactInternalFiber=b;$f(b,d,a,c);b=xg(null,b,d,!0,f,c)}else b.tag=0,Q(null,b,e,c),b=b.child;
22318return b;case 16:e=b.elementType;null!==a&&(a.alternate=null,b.alternate=null,b.effectTag|=2);f=b.pendingProps;a=Nf(e);b.type=a;e=b.tag=Ze(a);f=P(a,f);g=void 0;switch(e){case 0:g=ug(null,b,a,f,c);break;case 1:g=wg(null,b,a,f,c);break;case 11:g=qg(null,b,a,f,c);break;case 14:g=rg(null,b,a,P(a.type,f),d,c);break;default:t("306",a,"")}return g;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:P(d,e),ug(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:P(d,e),wg(a,b,
22319d,e,c);case 3:yg(b);d=b.updateQueue;null===d?t("282"):void 0;e=b.memoizedState;e=null!==e?e.element:null;tf(b,d,b.pendingProps,null,c);d=b.memoizedState.element;if(d===e)og(),b=tg(a,b,c);else{e=b.stateNode;if(e=(null===a||null===a.child)&&e.hydrate)hg=He(b.stateNode.containerInfo),gg=b,e=ig=!0;e?(b.effectTag|=2,b.child=fg(b,null,d,c)):(Q(a,b,d,c),og());b=b.child}return b;case 5:return Lf(b),null===a&&lg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ce(d,e)?g=null:null!==
22320f&&Ce(d,f)&&(b.effectTag|=16),vg(a,b),1!==c&&b.mode&1&&e.hidden?(b.expirationTime=1,b=null):(Q(a,b,g,c),b=b.child),b;case 6:return null===a&&lg(b),null;case 13:return zg(a,b,c);case 4:return Jf(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=eg(b,null,d,c):Q(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:P(d,e),qg(a,b,d,e,c);case 7:return Q(a,b,b.pendingProps,c),b.child;case 8:return Q(a,b,b.pendingProps.children,c),b.child;case 12:return Q(a,b,b.pendingProps.children,
22321c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;g=b.memoizedProps;f=e.value;Bf(b,f);if(null!==g){var h=g.value;f=h===f&&(0!==h||1/h===1/f)||h!==h&&f!==f?0:("function"===typeof d._calculateChangedBits?d._calculateChangedBits(h,f):1073741823)|0;if(0===f){if(g.children===e.children&&!L.current){b=tg(a,b,c);break a}}else for(g=b.child,null!==g&&(g.return=b);null!==g;){h=g.firstContextDependency;if(null!==h){do{if(h.context===d&&0!==(h.observedBits&f)){if(1===g.tag){var k=nf(c);k.tag=2;pf(g,k)}g.expirationTime<
22322c&&(g.expirationTime=c);k=g.alternate;null!==k&&k.expirationTime<c&&(k.expirationTime=c);for(var l=g.return;null!==l;){k=l.alternate;if(l.childExpirationTime<c)l.childExpirationTime=c,null!==k&&k.childExpirationTime<c&&(k.childExpirationTime=c);else if(null!==k&&k.childExpirationTime<c)k.childExpirationTime=c;else break;l=l.return}}k=g.child;h=h.next}while(null!==h)}else k=10===g.tag?g.type===b.type?null:g.child:g.child;if(null!==k)k.return=g;else for(k=g;null!==k;){if(k===b){k=null;break}g=k.sibling;
22323if(null!==g){g.return=k.return;k=g;break}k=k.return}g=k}}Q(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,f=b.pendingProps,d=f.children,Df(b,c),e=Ef(e,f.unstable_observedBits),d=d(e),b.effectTag|=1,Q(a,b,d,c),b.child;case 14:return e=b.type,f=P(e,b.pendingProps),f=P(e.type,f),rg(a,b,e,f,d,c);case 15:return sg(a,b,b.type,b.pendingProps,d,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:P(d,e),null!==a&&(a.alternate=null,b.alternate=null,b.effectTag|=2),b.tag=1,M(d)?(a=
22324!0,Re(b)):a=!1,Df(b,c),Xf(b,d,e,c),$f(b,d,e,c),xg(null,b,d,!0,a,c);default:t("156")}}function Bg(a){a.effectTag|=4}var Cg=void 0,Gg=void 0,Hg=void 0,Ig=void 0;Cg=function(a,b){for(var c=b.child;null!==c;){if(5===c.tag||6===c.tag)a.appendChild(c.stateNode);else if(4!==c.tag&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return}c.sibling.return=c.return;c=c.sibling}};Gg=function(){};
22325Hg=function(a,b,c,d,e){var f=a.memoizedProps;if(f!==d){var g=b.stateNode;If(O.current);a=null;switch(c){case "input":f=zc(g,f);d=zc(g,d);a=[];break;case "option":f=ee(g,f);d=ee(g,d);a=[];break;case "select":f=n({},f,{value:void 0});d=n({},d,{value:void 0});a=[];break;case "textarea":f=ge(g,f);d=ge(g,d);a=[];break;default:"function"!==typeof f.onClick&&"function"===typeof d.onClick&&(g.onclick=ye)}ve(c,d);g=c=void 0;var h=null;for(c in f)if(!d.hasOwnProperty(c)&&f.hasOwnProperty(c)&&null!=f[c])if("style"===
22326c){var k=f[c];for(g in k)k.hasOwnProperty(g)&&(h||(h={}),h[g]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(sa.hasOwnProperty(c)?a||(a=[]):(a=a||[]).push(c,null));for(c in d){var l=d[c];k=null!=f?f[c]:void 0;if(d.hasOwnProperty(c)&&l!==k&&(null!=l||null!=k))if("style"===c)if(k){for(g in k)!k.hasOwnProperty(g)||l&&l.hasOwnProperty(g)||(h||(h={}),h[g]="");for(g in l)l.hasOwnProperty(g)&&k[g]!==l[g]&&(h||
22327(h={}),h[g]=l[g])}else h||(a||(a=[]),a.push(c,h)),h=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,k=k?k.__html:void 0,null!=l&&k!==l&&(a=a||[]).push(c,""+l)):"children"===c?k===l||"string"!==typeof l&&"number"!==typeof l||(a=a||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(sa.hasOwnProperty(c)?(null!=l&&xe(e,c),a||k===l||(a=[])):(a=a||[]).push(c,l))}h&&(a=a||[]).push("style",h);e=a;(b.updateQueue=e)&&Bg(b)}};Ig=function(a,b,c,d){c!==d&&Bg(b)};
22328var Jg="function"===typeof WeakSet?WeakSet:Set;function Kg(a,b){var c=b.source,d=b.stack;null===d&&null!==c&&(d=nc(c));null!==c&&mc(c.type);b=b.value;null!==a&&1===a.tag&&mc(a.type);try{console.error(b)}catch(e){setTimeout(function(){throw e;})}}function Lg(a){var b=a.ref;if(null!==b)if("function"===typeof b)try{b(null)}catch(c){Mg(a,c)}else b.current=null}
22329function Ng(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;if(b)d.style.display="none";else{d=c.stateNode;var e=c.memoizedProps.style;e=void 0!==e&&null!==e&&e.hasOwnProperty("display")?e.display:null;d.style.display=se("display",e)}}else if(6===c.tag)c.stateNode.nodeValue=b?"":c.memoizedProps;else if(13===c.tag&&null!==c.memoizedState){d=c.child.sibling;d.return=c;c=d;continue}else if(null!==c.child){c.child.return=c;c=c.child;continue}if(c===a)break;for(;null===c.sibling;){if(null===c.return||
22330c.return===a)return;c=c.return}c.sibling.return=c.return;c=c.sibling}}
22331function Og(a){"function"===typeof Ue&&Ue(a);switch(a.tag){case 0:case 11:case 14:case 15:var b=a.updateQueue;if(null!==b&&(b=b.lastEffect,null!==b)){var c=b=b.next;do{var d=c.destroy;if(null!==d){var e=a;try{d()}catch(f){Mg(e,f)}}c=c.next}while(c!==b)}break;case 1:Lg(a);b=a.stateNode;if("function"===typeof b.componentWillUnmount)try{b.props=a.memoizedProps,b.state=a.memoizedState,b.componentWillUnmount()}catch(f){Mg(a,f)}break;case 5:Lg(a);break;case 4:Pg(a)}}
22332function Qg(a){return 5===a.tag||3===a.tag||4===a.tag}
22333function Rg(a){a:{for(var b=a.return;null!==b;){if(Qg(b)){var c=b;break a}b=b.return}t("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:t("161")}c.effectTag&16&&(pe(b,""),c.effectTag&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||Qg(c.return)){c=null;break a}c=c.return}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag;){if(c.effectTag&2)continue b;
22334if(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)if(c)if(d){var f=b,g=e.stateNode,h=c;8===f.nodeType?f.parentNode.insertBefore(g,h):f.insertBefore(g,h)}else b.insertBefore(e.stateNode,c);else d?(g=b,h=e.stateNode,8===g.nodeType?(f=g.parentNode,f.insertBefore(h,g)):(f=g,f.appendChild(h)),g=g._reactRootContainer,null!==g&&void 0!==g||null!==f.onclick||(f.onclick=ye)):b.appendChild(e.stateNode);
22335else 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}}
22336function Pg(a){for(var b=a,c=!1,d=void 0,e=void 0;;){if(!c){c=b.return;a:for(;;){null===c?t("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===b.tag||6===b.tag){a:for(var f=b,g=f;;)if(Og(g),null!==g.child&&4!==g.tag)g.child.return=g,g=g.child;else{if(g===f)break;for(;null===g.sibling;){if(null===g.return||g.return===f)break a;g=g.return}g.sibling.return=g.return;g=g.sibling}e?
22337(f=d,g=b.stateNode,8===f.nodeType?f.parentNode.removeChild(g):f.removeChild(g)):d.removeChild(b.stateNode)}else if(4===b.tag?(d=b.stateNode.containerInfo,e=!0):Og(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}}
22338function Sg(a,b){switch(b.tag){case 0:case 11:case 14:case 15:break;case 1: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&&Fe(c,f,e,a,d,b)}break;case 6:null===b.stateNode?t("162"):void 0;b.stateNode.nodeValue=b.memoizedProps;break;case 3:break;case 12:break;case 13:c=b.memoizedState;d=void 0;a=b;null===c?d=!1:(d=!0,a=b.child,0===c.timedOutAt&&(c.timedOutAt=Rf()));null!==a&&Ng(a,d);c=b.updateQueue;
22339if(null!==c){b.updateQueue=null;var g=b.stateNode;null===g&&(g=b.stateNode=new Jg);c.forEach(function(a){var c=Tg.bind(null,b,a);g.has(a)||(g.add(a),a.then(c,c))})}break;case 17:break;default:t("163")}}var Ug="function"===typeof WeakMap?WeakMap:Map;function Vg(a,b,c){c=nf(c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Wg(d);Kg(a,b)};return c}
22340function Xg(a,b,c){c=nf(c);c.tag=3;var d=a.type.getDerivedStateFromError;if("function"===typeof d){var e=b.value;c.payload=function(){return d(e)}}var f=a.stateNode;null!==f&&"function"===typeof f.componentDidCatch&&(c.callback=function(){"function"!==typeof d&&(null===Yg?Yg=new Set([this]):Yg.add(this));var c=b.value,e=b.stack;Kg(a,b);this.componentDidCatch(c,{componentStack:null!==e?e:""})});return c}
22341function Zg(a){switch(a.tag){case 1:M(a.type)&&Ne(a);var b=a.effectTag;return b&2048?(a.effectTag=b&-2049|64,a):null;case 3:return Kf(a),Oe(a),b=a.effectTag,0!==(b&64)?t("285"):void 0,a.effectTag=b&-2049|64,a;case 5:return Mf(a),null;case 13:return b=a.effectTag,b&2048?(a.effectTag=b&-2049|64,a):null;case 4:return Kf(a),null;case 10:return Cf(a),null;default:return null}}
22342var $g={readContext:Ef},ah=Xb.ReactCurrentOwner,bh=1073741822,ch=0,dh=!1,S=null,T=null,U=0,eh=-1,fh=!1,V=null,gh=!1,hh=null,ih=null,Yg=null;function jh(){if(null!==S)for(var a=S.return;null!==a;){var b=a;switch(b.tag){case 1:var c=b.type.childContextTypes;null!==c&&void 0!==c&&Ne(b);break;case 3:Kf(b);Oe(b);break;case 5:Mf(b);break;case 4:Kf(b);break;case 10:Cf(b)}a=a.return}T=null;U=0;eh=-1;fh=!1;S=null}function Tf(){null!==ih&&(ba.unstable_cancelCallback(hh),ih())}
22343function kh(a){for(;;){var b=a.alternate,c=a.return,d=a.sibling;if(0===(a.effectTag&1024)){S=a;a:{var e=b;b=a;var f=U;var g=b.pendingProps;switch(b.tag){case 2:break;case 16:break;case 15:case 0:break;case 1:M(b.type)&&Ne(b);break;case 3:Kf(b);Oe(b);g=b.stateNode;g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null);if(null===e||null===e.child)ng(b),b.effectTag&=-3;Gg(b);break;case 5:Mf(b);var h=If(Hf.current);f=b.type;if(null!==e&&null!=b.stateNode)Hg(e,b,f,g,h),e.ref!==b.ref&&(b.effectTag|=
22344128);else if(g){var k=If(O.current);if(ng(b)){g=b;e=g.stateNode;var l=g.type,m=g.memoizedProps,r=h;e[Ga]=g;e[Ha]=m;f=void 0;h=l;switch(h){case "iframe":case "object":H("load",e);break;case "video":case "audio":for(l=0;l<bb.length;l++)H(bb[l],e);break;case "source":H("error",e);break;case "img":case "image":case "link":H("error",e);H("load",e);break;case "form":H("reset",e);H("submit",e);break;case "details":H("toggle",e);break;case "input":Ac(e,m);H("invalid",e);xe(r,"onChange");break;case "select":e._wrapperState=
22345{wasMultiple:!!m.multiple};H("invalid",e);xe(r,"onChange");break;case "textarea":he(e,m),H("invalid",e),xe(r,"onChange")}ve(h,m);l=null;for(f in m)m.hasOwnProperty(f)&&(k=m[f],"children"===f?"string"===typeof k?e.textContent!==k&&(l=["children",k]):"number"===typeof k&&e.textContent!==""+k&&(l=["children",""+k]):sa.hasOwnProperty(f)&&null!=k&&xe(r,f));switch(h){case "input":Vb(e);Ec(e,m,!0);break;case "textarea":Vb(e);je(e,m);break;case "select":case "option":break;default:"function"===typeof m.onClick&&
22346(e.onclick=ye)}f=l;g.updateQueue=f;g=null!==f?!0:!1;g&&Bg(b)}else{m=b;e=f;r=g;l=9===h.nodeType?h:h.ownerDocument;k===ke.html&&(k=le(e));k===ke.html?"script"===e?(e=l.createElement("div"),e.innerHTML="<script>\x3c/script>",l=e.removeChild(e.firstChild)):"string"===typeof r.is?l=l.createElement(e,{is:r.is}):(l=l.createElement(e),"select"===e&&r.multiple&&(l.multiple=!0)):l=l.createElementNS(k,e);e=l;e[Ga]=m;e[Ha]=g;Cg(e,b,!1,!1);r=e;l=f;m=g;var w=h,y=we(l,m);switch(l){case "iframe":case "object":H("load",
22347r);h=m;break;case "video":case "audio":for(h=0;h<bb.length;h++)H(bb[h],r);h=m;break;case "source":H("error",r);h=m;break;case "img":case "image":case "link":H("error",r);H("load",r);h=m;break;case "form":H("reset",r);H("submit",r);h=m;break;case "details":H("toggle",r);h=m;break;case "input":Ac(r,m);h=zc(r,m);H("invalid",r);xe(w,"onChange");break;case "option":h=ee(r,m);break;case "select":r._wrapperState={wasMultiple:!!m.multiple};h=n({},m,{value:void 0});H("invalid",r);xe(w,"onChange");break;case "textarea":he(r,
22348m);h=ge(r,m);H("invalid",r);xe(w,"onChange");break;default:h=m}ve(l,h);k=void 0;var B=l,R=r,v=h;for(k in v)if(v.hasOwnProperty(k)){var q=v[k];"style"===k?te(R,q):"dangerouslySetInnerHTML"===k?(q=q?q.__html:void 0,null!=q&&oe(R,q)):"children"===k?"string"===typeof q?("textarea"!==B||""!==q)&&pe(R,q):"number"===typeof q&&pe(R,""+q):"suppressContentEditableWarning"!==k&&"suppressHydrationWarning"!==k&&"autoFocus"!==k&&(sa.hasOwnProperty(k)?null!=q&&xe(w,k):null!=q&&xc(R,k,q,y))}switch(l){case "input":Vb(r);
22349Ec(r,m,!1);break;case "textarea":Vb(r);je(r,m);break;case "option":null!=m.value&&r.setAttribute("value",""+yc(m.value));break;case "select":h=r;h.multiple=!!m.multiple;r=m.value;null!=r?fe(h,!!m.multiple,r,!1):null!=m.defaultValue&&fe(h,!!m.multiple,m.defaultValue,!0);break;default:"function"===typeof h.onClick&&(r.onclick=ye)}(g=Be(f,g))&&Bg(b);b.stateNode=e}null!==b.ref&&(b.effectTag|=128)}else null===b.stateNode?t("166"):void 0;break;case 6:e&&null!=b.stateNode?Ig(e,b,e.memoizedProps,g):("string"!==
22350typeof g&&(null===b.stateNode?t("166"):void 0),e=If(Hf.current),If(O.current),ng(b)?(g=b,f=g.stateNode,e=g.memoizedProps,f[Ga]=g,(g=f.nodeValue!==e)&&Bg(b)):(f=b,g=(9===e.nodeType?e:e.ownerDocument).createTextNode(g),g[Ga]=b,f.stateNode=g));break;case 11:break;case 13:g=b.memoizedState;if(0!==(b.effectTag&64)){b.expirationTime=f;S=b;break a}g=null!==g;f=null!==e&&null!==e.memoizedState;null!==e&&!g&&f&&(e=e.child.sibling,null!==e&&(h=b.firstEffect,null!==h?(b.firstEffect=e,e.nextEffect=h):(b.firstEffect=
22351b.lastEffect=e,e.nextEffect=null),e.effectTag=8));if(g!==f||0===(b.effectTag&1)&&g)b.effectTag|=4;break;case 7:break;case 8:break;case 12:break;case 4:Kf(b);Gg(b);break;case 10:Cf(b);break;case 9:break;case 14:break;case 17:M(b.type)&&Ne(b);break;default:t("156")}S=null}b=a;if(1===U||1!==b.childExpirationTime){g=0;for(f=b.child;null!==f;)e=f.expirationTime,h=f.childExpirationTime,e>g&&(g=e),h>g&&(g=h),f=f.sibling;b.childExpirationTime=g}if(null!==S)return S;null!==c&&0===(c.effectTag&1024)&&(null===
22352c.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))}else{a=Zg(a,U);if(null!==a)return a.effectTag&=1023,a;null!==c&&(c.firstEffect=c.lastEffect=null,c.effectTag|=1024)}if(null!==d)return d;if(null!==c)a=c;else break}return null}
22353function lh(a){var b=Ag(a.alternate,a,U);a.memoizedProps=a.pendingProps;null===b&&(b=kh(a));ah.current=null;return b}
22354function mh(a,b){dh?t("243"):void 0;Tf();dh=!0;ah.currentDispatcher=$g;var c=a.nextExpirationTimeToWorkOn;if(c!==U||a!==T||null===S)jh(),T=a,U=c,S=$e(T.current,null,U),a.pendingCommitExpirationTime=0;var d=!1;do{try{if(b)for(;null!==S&&!nh();)S=lh(S);else for(;null!==S;)S=lh(S)}catch(B){if(Af=zf=yf=null,null===S)d=!0,Wg(B);else{null===S?t("271"):void 0;var e=S,f=e.return;if(null===f)d=!0,Wg(B);else{a:{var g=a,h=f,k=e,l=B;f=U;k.effectTag|=1024;k.firstEffect=k.lastEffect=null;if(null!==l&&"object"===
22355typeof l&&"function"===typeof l.then){var m=l;l=h;var r=-1,w=-1;do{if(13===l.tag){var y=l.alternate;if(null!==y&&(y=y.memoizedState,null!==y)){w=10*(1073741822-y.timedOutAt);break}y=l.pendingProps.maxDuration;if("number"===typeof y)if(0>=y)r=0;else if(-1===r||y<r)r=y}l=l.return}while(null!==l);l=h;do{if(y=13===l.tag)y=void 0===l.memoizedProps.fallback?!1:null===l.memoizedState;if(y){h=l.updateQueue;null===h?l.updateQueue=new Set([m]):h.add(m);if(0===(l.mode&1)){l.effectTag|=64;k.effectTag&=-1957;
223561===k.tag&&(null===k.alternate?k.tag=17:(f=nf(1073741823),f.tag=2,pf(k,f)));k.expirationTime=1073741823;break a}k=g.pingCache;null===k?(k=g.pingCache=new Ug,h=new Set,k.set(m,h)):(h=k.get(m),void 0===h&&(h=new Set,k.set(m,h)));h.has(f)||(h.add(f),k=oh.bind(null,g,m,f),m.then(k,k));-1===r?g=1073741823:(-1===w&&(w=10*(1073741822-jf(g,f))-5E3),g=w+r);0<=g&&eh<g&&(eh=g);l.effectTag|=2048;l.expirationTime=f;break a}l=l.return}while(null!==l);l=Error((mc(k.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."+
22357nc(k))}fh=!0;l=wf(l,k);g=h;do{switch(g.tag){case 3:g.effectTag|=2048;g.expirationTime=f;f=Vg(g,l,f);qf(g,f);break a;case 1:if(m=l,r=g.type,w=g.stateNode,0===(g.effectTag&64)&&("function"===typeof r.getDerivedStateFromError||null!==w&&"function"===typeof w.componentDidCatch&&(null===Yg||!Yg.has(w)))){g.effectTag|=2048;g.expirationTime=f;f=Xg(g,m,f);qf(g,f);break a}}g=g.return}while(null!==g)}S=kh(e);continue}}}break}while(1);dh=!1;Af=zf=yf=ah.currentDispatcher=null;if(d)T=null,a.finishedWork=null;
22358else if(null!==S)a.finishedWork=null;else{d=a.current.alternate;null===d?t("281"):void 0;T=null;if(fh){e=a.latestPendingTime;f=a.latestSuspendedTime;g=a.latestPingedTime;if(0!==e&&e<c||0!==f&&f<c||0!==g&&g<c){hf(a,c);ph(a,d,c,a.expirationTime,-1);return}if(!a.didError&&b){a.didError=!0;c=a.nextExpirationTimeToWorkOn=c;b=a.expirationTime=1073741823;ph(a,d,c,b,-1);return}}b&&-1!==eh?(hf(a,c),b=10*(1073741822-jf(a,c)),b<eh&&(eh=b),b=10*(1073741822-Rf()),b=eh-b,ph(a,d,c,a.expirationTime,0>b?0:b)):(a.pendingCommitExpirationTime=
22359c,a.finishedWork=d)}}function Mg(a,b){for(var c=a.return;null!==c;){switch(c.tag){case 1:var d=c.stateNode;if("function"===typeof c.type.getDerivedStateFromError||"function"===typeof d.componentDidCatch&&(null===Yg||!Yg.has(d))){a=wf(b,a);a=Xg(c,a,1073741823);pf(c,a);Uf(c,1073741823);return}break;case 3:a=wf(b,a);a=Vg(c,a,1073741823);pf(c,a);Uf(c,1073741823);return}c=c.return}3===a.tag&&(c=wf(b,a),c=Vg(a,c,1073741823),pf(a,c),Uf(a,1073741823))}
22360function Sf(a,b){0!==ch?a=ch:dh?a=gh?1073741823:U:b.mode&1?(a=qh?1073741822-10*(((1073741822-a+15)/10|0)+1):1073741822-25*(((1073741822-a+500)/25|0)+1),null!==T&&a===U&&--a):a=1073741823;qh&&(0===rh||a<rh)&&(rh=a);return a}function oh(a,b,c){var d=a.pingCache;null!==d&&d.delete(b);if(null!==T&&U===c)T=null;else if(b=a.earliestSuspendedTime,d=a.latestSuspendedTime,0!==b&&c<=b&&c>=d){a.didError=!1;b=a.latestPingedTime;if(0===b||b>c)a.latestPingedTime=c;gf(c,a);c=a.expirationTime;0!==c&&sh(a,c)}}
22361function Tg(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=Rf();b=Sf(b,a);a=th(a,b);null!==a&&(ff(a,b),b=a.expirationTime,0!==b&&sh(a,b))}
22362function th(a,b){a.expirationTime<b&&(a.expirationTime=b);var c=a.alternate;null!==c&&c.expirationTime<b&&(c.expirationTime=b);var d=a.return,e=null;if(null===d&&3===a.tag)e=a.stateNode;else for(;null!==d;){c=d.alternate;d.childExpirationTime<b&&(d.childExpirationTime=b);null!==c&&c.childExpirationTime<b&&(c.childExpirationTime=b);if(null===d.return&&3===d.tag){e=d.stateNode;break}d=d.return}return e}
22363function Uf(a,b){a=th(a,b);null!==a&&(!dh&&0!==U&&b>U&&jh(),ff(a,b),dh&&!gh&&T===a||sh(a,a.expirationTime),uh>vh&&(uh=0,t("185")))}function wh(a,b,c,d,e){var f=ch;ch=1073741823;try{return a(b,c,d,e)}finally{ch=f}}var xh=null,W=null,yh=0,zh=void 0,X=!1,Ah=null,Y=0,rh=0,Bh=!1,Ch=null,Z=!1,Dh=!1,qh=!1,Eh=null,Fh=ba.unstable_now(),Gh=1073741822-(Fh/10|0),Hh=Gh,vh=50,uh=0,Ih=null;function Jh(){Gh=1073741822-((ba.unstable_now()-Fh)/10|0)}
22364function Kh(a,b){if(0!==yh){if(b<yh)return;null!==zh&&ba.unstable_cancelCallback(zh)}yh=b;a=ba.unstable_now()-Fh;zh=ba.unstable_scheduleCallback(Lh,{timeout:10*(1073741822-b)-a})}function ph(a,b,c,d,e){a.expirationTime=d;0!==e||nh()?0<e&&(a.timeoutHandle=De(Mh.bind(null,a,b,c),e)):(a.pendingCommitExpirationTime=c,a.finishedWork=b)}function Mh(a,b,c){a.pendingCommitExpirationTime=c;a.finishedWork=b;Jh();Hh=Gh;Nh(a,c)}function Rf(){if(X)return Hh;Oh();if(0===Y||1===Y)Jh(),Hh=Gh;return Hh}
22365function sh(a,b){null===a.nextScheduledRoot?(a.expirationTime=b,null===W?(xh=W=a,a.nextScheduledRoot=a):(W=W.nextScheduledRoot=a,W.nextScheduledRoot=xh)):b>a.expirationTime&&(a.expirationTime=b);X||(Z?Dh&&(Ah=a,Y=1073741823,Ph(a,1073741823,!1)):1073741823===b?Qh(1073741823,!1):Kh(a,b))}
22366function Oh(){var a=0,b=null;if(null!==W)for(var c=W,d=xh;null!==d;){var e=d.expirationTime;if(0===e){null===c||null===W?t("244"):void 0;if(d===d.nextScheduledRoot){xh=W=d.nextScheduledRoot=null;break}else if(d===xh)xh=e=d.nextScheduledRoot,W.nextScheduledRoot=e,d.nextScheduledRoot=null;else if(d===W){W=c;W.nextScheduledRoot=xh;d.nextScheduledRoot=null;break}else c.nextScheduledRoot=d.nextScheduledRoot,d.nextScheduledRoot=null;d=c.nextScheduledRoot}else{e>a&&(a=e,b=d);if(d===W)break;if(1073741823===
22367a)break;c=d;d=d.nextScheduledRoot}}Ah=b;Y=a}var Rh=!1;function nh(){return Rh?!0:ba.unstable_shouldYield()?Rh=!0:!1}function Lh(){try{if(!nh()&&null!==xh){Jh();var a=xh;do{var b=a.expirationTime;0!==b&&Gh<=b&&(a.nextExpirationTimeToWorkOn=Gh);a=a.nextScheduledRoot}while(a!==xh)}Qh(0,!0)}finally{Rh=!1}}
22368function Qh(a,b){Oh();if(b)for(Jh(),Hh=Gh;null!==Ah&&0!==Y&&a<=Y&&!(Rh&&Gh>Y);)Ph(Ah,Y,Gh>Y),Oh(),Jh(),Hh=Gh;else for(;null!==Ah&&0!==Y&&a<=Y;)Ph(Ah,Y,!1),Oh();b&&(yh=0,zh=null);0!==Y&&Kh(Ah,Y);uh=0;Ih=null;if(null!==Eh)for(a=Eh,Eh=null,b=0;b<a.length;b++){var c=a[b];try{c._onComplete()}catch(d){Bh||(Bh=!0,Ch=d)}}if(Bh)throw a=Ch,Ch=null,Bh=!1,a;}function Nh(a,b){X?t("253"):void 0;Ah=a;Y=b;Ph(a,b,!1);Qh(1073741823,!1)}
22369function Ph(a,b,c){X?t("245"):void 0;X=!0;if(c){var d=a.finishedWork;null!==d?Sh(a,d,b):(a.finishedWork=null,d=a.timeoutHandle,-1!==d&&(a.timeoutHandle=-1,Ee(d)),mh(a,c),d=a.finishedWork,null!==d&&(nh()?a.finishedWork=d:Sh(a,d,b)))}else d=a.finishedWork,null!==d?Sh(a,d,b):(a.finishedWork=null,d=a.timeoutHandle,-1!==d&&(a.timeoutHandle=-1,Ee(d)),mh(a,c),d=a.finishedWork,null!==d&&Sh(a,d,b));X=!1}
22370function Sh(a,b,c){var d=a.firstBatch;if(null!==d&&d._expirationTime>=c&&(null===Eh?Eh=[d]:Eh.push(d),d._defer)){a.finishedWork=b;a.expirationTime=0;return}a.finishedWork=null;a===Ih?uh++:(Ih=a,uh=0);gh=dh=!0;a.current===b?t("177"):void 0;c=a.pendingCommitExpirationTime;0===c?t("261"):void 0;a.pendingCommitExpirationTime=0;d=b.expirationTime;var e=b.childExpirationTime;d=e>d?e:d;a.didError=!1;0===d?(a.earliestPendingTime=0,a.latestPendingTime=0,a.earliestSuspendedTime=0,a.latestSuspendedTime=0,a.latestPingedTime=
223710):(d<a.latestPingedTime&&(a.latestPingedTime=0),e=a.latestPendingTime,0!==e&&(e>d?a.earliestPendingTime=a.latestPendingTime=0:a.earliestPendingTime>d&&(a.earliestPendingTime=a.latestPendingTime)),e=a.earliestSuspendedTime,0===e?ff(a,d):d<a.latestSuspendedTime?(a.earliestSuspendedTime=0,a.latestSuspendedTime=0,a.latestPingedTime=0,ff(a,d)):d>e&&ff(a,d));gf(0,a);ah.current=null;1<b.effectTag?null!==b.lastEffect?(b.lastEffect.nextEffect=b,d=b.firstEffect):d=b:d=b.firstEffect;ze=Hd;e=Td();if(Ud(e)){if("selectionStart"in
22372e)var f={start:e.selectionStart,end:e.selectionEnd};else a:{f=(f=e.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&0!==g.rangeCount){f=g.anchorNode;var h=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{f.nodeType,k.nodeType}catch(db){f=null;break a}var l=0,m=-1,r=-1,w=0,y=0,B=e,R=null;b:for(;;){for(var v;;){B!==f||0!==h&&3!==B.nodeType||(m=l+h);B!==k||0!==g&&3!==B.nodeType||(r=l+g);3===B.nodeType&&(l+=B.nodeValue.length);if(null===(v=B.firstChild))break;R=B;B=v}for(;;){if(B===
22373e)break b;R===f&&++w===h&&(m=l);R===k&&++y===g&&(r=l);if(null!==(v=B.nextSibling))break;B=R;R=B.parentNode}B=v}f=-1===m||-1===r?null:{start:m,end:r}}else f=null}f=f||{start:0,end:0}}else f=null;Ae={focusedElem:e,selectionRange:f};Hd=!1;for(V=d;null!==V;){e=!1;f=void 0;try{for(;null!==V;){if(V.effectTag&256)a:{var q=V.alternate;h=V;switch(h.tag){case 0:case 11:case 15:break a;case 1:if(h.effectTag&256&&null!==q){var u=q.memoizedProps,A=q.memoizedState,Yf=h.stateNode,Vh=Yf.getSnapshotBeforeUpdate(h.elementType===
22374h.type?u:P(h.type,u),A);Yf.__reactInternalSnapshotBeforeUpdate=Vh}break a;case 3:case 5:case 6:case 4:case 17:break a;default:t("163")}}V=V.nextEffect}}catch(db){e=!0,f=db}e&&(null===V?t("178"):void 0,Mg(V,f),null!==V&&(V=V.nextEffect))}for(V=d;null!==V;){q=!1;u=void 0;try{for(;null!==V;){var x=V.effectTag;x&16&&pe(V.stateNode,"");if(x&128){var C=V.alternate;if(null!==C){var p=C.ref;null!==p&&("function"===typeof p?p(null):p.current=null)}}switch(x&14){case 2:Rg(V);V.effectTag&=-3;break;case 6:Rg(V);
22375V.effectTag&=-3;Sg(V.alternate,V);break;case 4:Sg(V.alternate,V);break;case 8:A=V;Pg(A);A.return=null;A.child=null;A.memoizedState=null;A.updateQueue=null;var G=A.alternate;null!==G&&(G.return=null,G.child=null,G.memoizedState=null,G.updateQueue=null)}V=V.nextEffect}}catch(db){q=!0,u=db}q&&(null===V?t("178"):void 0,Mg(V,u),null!==V&&(V=V.nextEffect))}p=Ae;C=Td();x=p.focusedElem;q=p.selectionRange;if(C!==x&&x&&x.ownerDocument&&Sd(x.ownerDocument.documentElement,x)){null!==q&&Ud(x)&&(C=q.start,p=q.end,
22376void 0===p&&(p=C),"selectionStart"in x?(x.selectionStart=C,x.selectionEnd=Math.min(p,x.value.length)):(p=(C=x.ownerDocument||document)&&C.defaultView||window,p.getSelection&&(p=p.getSelection(),u=x.textContent.length,G=Math.min(q.start,u),q=void 0===q.end?G:Math.min(q.end,u),!p.extend&&G>q&&(u=q,q=G,G=u),u=Rd(x,G),A=Rd(x,q),u&&A&&(1!==p.rangeCount||p.anchorNode!==u.node||p.anchorOffset!==u.offset||p.focusNode!==A.node||p.focusOffset!==A.offset)&&(C=C.createRange(),C.setStart(u.node,u.offset),p.removeAllRanges(),
22377G>q?(p.addRange(C),p.extend(A.node,A.offset)):(C.setEnd(A.node,A.offset),p.addRange(C))))));C=[];for(p=x;p=p.parentNode;)1===p.nodeType&&C.push({element:p,left:p.scrollLeft,top:p.scrollTop});"function"===typeof x.focus&&x.focus();for(x=0;x<C.length;x++)p=C[x],p.element.scrollLeft=p.left,p.element.scrollTop=p.top}Ae=null;Hd=!!ze;ze=null;a.current=b;for(V=d;null!==V;){d=!1;x=void 0;try{for(C=c;null!==V;){var Fb=V.effectTag;if(Fb&36){var Gb=V.alternate;p=V;G=C;switch(p.tag){case 0:case 11:case 15:break;
22378case 1:var Hc=p.stateNode;if(p.effectTag&4)if(null===Gb)Hc.componentDidMount();else{var ii=p.elementType===p.type?Gb.memoizedProps:P(p.type,Gb.memoizedProps);Hc.componentDidUpdate(ii,Gb.memoizedState,Hc.__reactInternalSnapshotBeforeUpdate)}var Dg=p.updateQueue;null!==Dg&&uf(p,Dg,Hc,G);break;case 3:var Eg=p.updateQueue;if(null!==Eg){q=null;if(null!==p.child)switch(p.child.tag){case 5:q=p.child.stateNode;break;case 1:q=p.child.stateNode}uf(p,Eg,q,G)}break;case 5:var ji=p.stateNode;null===Gb&&p.effectTag&
223794&&Be(p.type,p.memoizedProps)&&ji.focus();break;case 6:break;case 4:break;case 12:break;case 13:break;case 17:break;default:t("163")}}if(Fb&128){var Ic=V.ref;if(null!==Ic){var Fg=V.stateNode;switch(V.tag){case 5:var ce=Fg;break;default:ce=Fg}"function"===typeof Ic?Ic(ce):Ic.current=ce}}V=V.nextEffect}}catch(db){d=!0,x=db}d&&(null===V?t("178"):void 0,Mg(V,x),null!==V&&(V=V.nextEffect))}dh=gh=!1;"function"===typeof Te&&Te(b.stateNode);Fb=b.expirationTime;b=b.childExpirationTime;b=b>Fb?b:Fb;0===b&&(Yg=
22380null);a.expirationTime=b;a.finishedWork=null}function Wg(a){null===Ah?t("246"):void 0;Ah.expirationTime=0;Bh||(Bh=!0,Ch=a)}function Th(a,b){var c=Z;Z=!0;try{return a(b)}finally{(Z=c)||X||Qh(1073741823,!1)}}function Uh(a,b){if(Z&&!Dh){Dh=!0;try{return a(b)}finally{Dh=!1}}return a(b)}function Wh(a,b,c){if(qh)return a(b,c);Z||X||0===rh||(Qh(rh,!1),rh=0);var d=qh,e=Z;Z=qh=!0;try{return a(b,c)}finally{qh=d,(Z=e)||X||Qh(1073741823,!1)}}
22381function Xh(a,b,c,d,e){var f=b.current;a:if(c){c=c._reactInternalFiber;b:{2===kd(c)&&1===c.tag?void 0:t("170");var g=c;do{switch(g.tag){case 3:g=g.stateNode.context;break b;case 1:if(M(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break b}}g=g.return}while(null!==g);t("171");g=void 0}if(1===c.tag){var h=c.type;if(M(h)){c=Qe(c,h,g);break a}}c=g}else c=Ke;null===b.context?b.context=c:b.pendingContext=c;b=e;e=nf(d);e.payload={element:a};b=void 0===b?null:b;null!==b&&(e.callback=b);
22382Tf();pf(f,e);Uf(f,d);return d}function Yh(a,b,c,d){var e=b.current,f=Rf();e=Sf(f,e);return Xh(a,b,c,e,d)}function Zh(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return a.child.stateNode;default:return a.child.stateNode}}function $h(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:$b,key:null==d?null:""+d,children:a,containerInfo:b,implementation:c}}
22383Cb=function(a,b,c){switch(b){case "input":Cc(a,c);b=c.name;if("radio"===c.type&&null!=b){for(c=a;c.parentNode;)c=c.parentNode;c=c.querySelectorAll("input[name="+JSON.stringify(""+b)+'][type="radio"]');for(b=0;b<c.length;b++){var d=c[b];if(d!==a&&d.form===a.form){var e=La(d);e?void 0:t("90");Wb(d);Cc(d,e)}}}break;case "textarea":ie(a,c);break;case "select":b=c.value,null!=b&&fe(a,!!c.multiple,b,!1)}};
22384function ai(a){var b=1073741822-25*(((1073741822-Rf()+500)/25|0)+1);b>=bh&&(b=bh-1);this._expirationTime=bh=b;this._root=a;this._callbacks=this._next=null;this._hasChildren=this._didComplete=!1;this._children=null;this._defer=!0}ai.prototype.render=function(a){this._defer?void 0:t("250");this._hasChildren=!0;this._children=a;var b=this._root._internalRoot,c=this._expirationTime,d=new bi;Xh(a,b,null,c,d._onCommit);return d};
22385ai.prototype.then=function(a){if(this._didComplete)a();else{var b=this._callbacks;null===b&&(b=this._callbacks=[]);b.push(a)}};
22386ai.prototype.commit=function(){var a=this._root._internalRoot,b=a.firstBatch;this._defer&&null!==b?void 0:t("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?t("251"):void 0;d._next=e._next;this._next=b;a.firstBatch=this}this._defer=!1;Nh(a,c);b=this._next;this._next=null;b=a.firstBatch=b;null!==b&&b._hasChildren&&b.render(b._children)}else this._next=
22387null,this._defer=!1};ai.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 bi(){this._callbacks=null;this._didCommit=!1;this._onCommit=this._onCommit.bind(this)}bi.prototype.then=function(a){if(this._didCommit)a();else{var b=this._callbacks;null===b&&(b=this._callbacks=[]);b.push(a)}};
22388bi.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?t("191",c):void 0;c()}}};
22389function ci(a,b,c){b=N(3,null,null,b?3:0);a={current:b,containerInfo:a,pendingChildren:null,pingCache:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,didError:!1,pendingCommitExpirationTime:0,finishedWork:null,timeoutHandle:-1,context:null,pendingContext:null,hydrate:c,nextExpirationTimeToWorkOn:0,expirationTime:0,firstBatch:null,nextScheduledRoot:null};this._internalRoot=b.stateNode=a}
22390ci.prototype.render=function(a,b){var c=this._internalRoot,d=new bi;b=void 0===b?null:b;null!==b&&d.then(b);Yh(a,c,null,d._onCommit);return d};ci.prototype.unmount=function(a){var b=this._internalRoot,c=new bi;a=void 0===a?null:a;null!==a&&c.then(a);Yh(null,b,null,c._onCommit);return c};ci.prototype.legacy_renderSubtreeIntoContainer=function(a,b,c){var d=this._internalRoot,e=new bi;c=void 0===c?null:c;null!==c&&e.then(c);Yh(b,d,a,e._onCommit);return e};
22391ci.prototype.createBatch=function(){var a=new ai(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 di(a){return!(!a||1!==a.nodeType&&9!==a.nodeType&&11!==a.nodeType&&(8!==a.nodeType||" react-mount-point-unstable "!==a.nodeValue))}Kb=Th;Lb=Wh;Mb=function(){X||0===rh||(Qh(rh,!1),rh=0)};
22392function ei(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 ci(a,!1,b)}
22393function fi(a,b,c,d,e){di(c)?void 0:t("200");var f=c._reactRootContainer;if(f){if("function"===typeof e){var g=e;e=function(){var a=Zh(f._internalRoot);g.call(a)}}null!=a?f.legacy_renderSubtreeIntoContainer(a,b,e):f.render(b,e)}else{f=c._reactRootContainer=ei(c,d);if("function"===typeof e){var h=e;e=function(){var a=Zh(f._internalRoot);h.call(a)}}Uh(function(){null!=a?f.legacy_renderSubtreeIntoContainer(a,b,e):f.render(b,e)})}return Zh(f._internalRoot)}
22394function gi(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;di(b)?void 0:t("200");return $h(a,b,null,c)}
22395var ki={createPortal:gi,findDOMNode:function(a){if(null==a)return null;if(1===a.nodeType)return a;var b=a._reactInternalFiber;void 0===b&&("function"===typeof a.render?t("188"):t("268",Object.keys(a)));a=nd(b);a=null===a?null:a.stateNode;return a},hydrate:function(a,b,c){return fi(null,a,b,!0,c)},render:function(a,b,c){return fi(null,a,b,!1,c)},unstable_renderSubtreeIntoContainer:function(a,b,c,d){null==a||void 0===a._reactInternalFiber?t("38"):void 0;return fi(a,b,c,!1,d)},unmountComponentAtNode:function(a){di(a)?
22396void 0:t("40");return a._reactRootContainer?(Uh(function(){fi(null,null,a,!1,function(){a._reactRootContainer=null})}),!0):!1},unstable_createPortal:function(){return gi.apply(void 0,arguments)},unstable_batchedUpdates:Th,unstable_interactiveUpdates:Wh,flushSync:function(a,b){X?t("187"):void 0;var c=Z;Z=!0;try{return wh(a,b)}finally{Z=c,Qh(1073741823,!1)}},unstable_createRoot:hi,unstable_flushControlled:function(a){var b=Z;Z=!0;try{wh(a)}finally{(Z=b)||X||Qh(1073741823,!1)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[Ja,
22397Ka,La,Ca.injectEventPluginsByName,qa,Ra,function(a){za(a,Qa)},Ib,Jb,Jd,Ea]}};function hi(a,b){di(a)?void 0:t("299","unstable_createRoot");return new ci(a,!0,null!=b&&!0===b.hydrate)}(function(a){var b=a.findFiberByHostInstance;return We(n({},a,{overrideProps:null,findHostInstanceByFiber:function(a){a=nd(a);return null===a?null:a.stateNode},findFiberByHostInstance:function(a){return b?b(a):null}}))})({findFiberByHostInstance:Ia,bundleType:0,version:"16.7.0",rendererPackageName:"react-dom"});
22398var li={default:ki},mi=li&&ki||li;module.exports=mi.default||mi;
22399
22400},{"object-assign":23,"react":"react","scheduler":71}],31:[function(require,module,exports){
22401(function (process){
22402/** @license React v16.7.0
22403 * react-is.development.js
22404 *
22405 * Copyright (c) Facebook, Inc. and its affiliates.
22406 *
22407 * This source code is licensed under the MIT license found in the
22408 * LICENSE file in the root directory of this source tree.
22409 */
22410
22411'use strict';
22412
22413
22414
22415if (process.env.NODE_ENV !== "production") {
22416 (function() {
22417'use strict';
22418
22419Object.defineProperty(exports, '__esModule', { value: true });
22420
22421// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
22422// nor polyfill, then a plain number is used for performance.
22423var hasSymbol = typeof Symbol === 'function' && Symbol.for;
22424
22425var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
22426var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
22427var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
22428var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
22429var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
22430var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
22431var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
22432var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
22433var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
22434var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
22435var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
22436var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
22437var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
22438
22439function isValidElementType(type) {
22440 return typeof type === 'string' || typeof type === 'function' ||
22441 // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
22442 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
22443}
22444
22445/**
22446 * Forked from fbjs/warning:
22447 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
22448 *
22449 * Only change is we use console.warn instead of console.error,
22450 * and do nothing when 'console' is not supported.
22451 * This really simplifies the code.
22452 * ---
22453 * Similar to invariant but only logs a warning if the condition is not met.
22454 * This can be used to log issues in development environments in critical
22455 * paths. Removing the logging code for production environments will keep the
22456 * same logic and follow the same code paths.
22457 */
22458
22459var lowPriorityWarning = function () {};
22460
22461{
22462 var printWarning = function (format) {
22463 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
22464 args[_key - 1] = arguments[_key];
22465 }
22466
22467 var argIndex = 0;
22468 var message = 'Warning: ' + format.replace(/%s/g, function () {
22469 return args[argIndex++];
22470 });
22471 if (typeof console !== 'undefined') {
22472 console.warn(message);
22473 }
22474 try {
22475 // --- Welcome to debugging React ---
22476 // This error was thrown as a convenience so that you can use this stack
22477 // to find the callsite that caused this warning to fire.
22478 throw new Error(message);
22479 } catch (x) {}
22480 };
22481
22482 lowPriorityWarning = function (condition, format) {
22483 if (format === undefined) {
22484 throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
22485 }
22486 if (!condition) {
22487 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
22488 args[_key2 - 2] = arguments[_key2];
22489 }
22490
22491 printWarning.apply(undefined, [format].concat(args));
22492 }
22493 };
22494}
22495
22496var lowPriorityWarning$1 = lowPriorityWarning;
22497
22498function typeOf(object) {
22499 if (typeof object === 'object' && object !== null) {
22500 var $$typeof = object.$$typeof;
22501 switch ($$typeof) {
22502 case REACT_ELEMENT_TYPE:
22503 var type = object.type;
22504
22505 switch (type) {
22506 case REACT_ASYNC_MODE_TYPE:
22507 case REACT_CONCURRENT_MODE_TYPE:
22508 case REACT_FRAGMENT_TYPE:
22509 case REACT_PROFILER_TYPE:
22510 case REACT_STRICT_MODE_TYPE:
22511 case REACT_SUSPENSE_TYPE:
22512 return type;
22513 default:
22514 var $$typeofType = type && type.$$typeof;
22515
22516 switch ($$typeofType) {
22517 case REACT_CONTEXT_TYPE:
22518 case REACT_FORWARD_REF_TYPE:
22519 case REACT_PROVIDER_TYPE:
22520 return $$typeofType;
22521 default:
22522 return $$typeof;
22523 }
22524 }
22525 case REACT_LAZY_TYPE:
22526 case REACT_MEMO_TYPE:
22527 case REACT_PORTAL_TYPE:
22528 return $$typeof;
22529 }
22530 }
22531
22532 return undefined;
22533}
22534
22535// AsyncMode is deprecated along with isAsyncMode
22536var AsyncMode = REACT_ASYNC_MODE_TYPE;
22537var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
22538var ContextConsumer = REACT_CONTEXT_TYPE;
22539var ContextProvider = REACT_PROVIDER_TYPE;
22540var Element = REACT_ELEMENT_TYPE;
22541var ForwardRef = REACT_FORWARD_REF_TYPE;
22542var Fragment = REACT_FRAGMENT_TYPE;
22543var Lazy = REACT_LAZY_TYPE;
22544var Memo = REACT_MEMO_TYPE;
22545var Portal = REACT_PORTAL_TYPE;
22546var Profiler = REACT_PROFILER_TYPE;
22547var StrictMode = REACT_STRICT_MODE_TYPE;
22548var Suspense = REACT_SUSPENSE_TYPE;
22549
22550var hasWarnedAboutDeprecatedIsAsyncMode = false;
22551
22552// AsyncMode should be deprecated
22553function isAsyncMode(object) {
22554 {
22555 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
22556 hasWarnedAboutDeprecatedIsAsyncMode = true;
22557 lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
22558 }
22559 }
22560 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
22561}
22562function isConcurrentMode(object) {
22563 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
22564}
22565function isContextConsumer(object) {
22566 return typeOf(object) === REACT_CONTEXT_TYPE;
22567}
22568function isContextProvider(object) {
22569 return typeOf(object) === REACT_PROVIDER_TYPE;
22570}
22571function isElement(object) {
22572 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
22573}
22574function isForwardRef(object) {
22575 return typeOf(object) === REACT_FORWARD_REF_TYPE;
22576}
22577function isFragment(object) {
22578 return typeOf(object) === REACT_FRAGMENT_TYPE;
22579}
22580function isLazy(object) {
22581 return typeOf(object) === REACT_LAZY_TYPE;
22582}
22583function isMemo(object) {
22584 return typeOf(object) === REACT_MEMO_TYPE;
22585}
22586function isPortal(object) {
22587 return typeOf(object) === REACT_PORTAL_TYPE;
22588}
22589function isProfiler(object) {
22590 return typeOf(object) === REACT_PROFILER_TYPE;
22591}
22592function isStrictMode(object) {
22593 return typeOf(object) === REACT_STRICT_MODE_TYPE;
22594}
22595function isSuspense(object) {
22596 return typeOf(object) === REACT_SUSPENSE_TYPE;
22597}
22598
22599exports.typeOf = typeOf;
22600exports.AsyncMode = AsyncMode;
22601exports.ConcurrentMode = ConcurrentMode;
22602exports.ContextConsumer = ContextConsumer;
22603exports.ContextProvider = ContextProvider;
22604exports.Element = Element;
22605exports.ForwardRef = ForwardRef;
22606exports.Fragment = Fragment;
22607exports.Lazy = Lazy;
22608exports.Memo = Memo;
22609exports.Portal = Portal;
22610exports.Profiler = Profiler;
22611exports.StrictMode = StrictMode;
22612exports.Suspense = Suspense;
22613exports.isValidElementType = isValidElementType;
22614exports.isAsyncMode = isAsyncMode;
22615exports.isConcurrentMode = isConcurrentMode;
22616exports.isContextConsumer = isContextConsumer;
22617exports.isContextProvider = isContextProvider;
22618exports.isElement = isElement;
22619exports.isForwardRef = isForwardRef;
22620exports.isFragment = isFragment;
22621exports.isLazy = isLazy;
22622exports.isMemo = isMemo;
22623exports.isPortal = isPortal;
22624exports.isProfiler = isProfiler;
22625exports.isStrictMode = isStrictMode;
22626exports.isSuspense = isSuspense;
22627 })();
22628}
22629
22630}).call(this,require('_process'))
22631
22632},{"_process":24}],32:[function(require,module,exports){
22633/** @license React v16.7.0
22634 * react-is.production.min.js
22635 *
22636 * Copyright (c) Facebook, Inc. and its affiliates.
22637 *
22638 * This source code is licensed under the MIT license found in the
22639 * LICENSE file in the root directory of this source tree.
22640 */
22641
22642'use strict';Object.defineProperty(exports,"__esModule",{value:!0});
22643var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"):
2264460115,r=b?Symbol.for("react.lazy"):60116;function t(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case r:case q:case d:return u}}}function v(a){return t(a)===m}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;
22645exports.Fragment=e;exports.Lazy=r;exports.Memo=q;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};exports.isAsyncMode=function(a){return v(a)||t(a)===l};exports.isConcurrentMode=v;exports.isContextConsumer=function(a){return t(a)===k};
22646exports.isContextProvider=function(a){return t(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===n};exports.isFragment=function(a){return t(a)===e};exports.isLazy=function(a){return t(a)===r};exports.isMemo=function(a){return t(a)===q};exports.isPortal=function(a){return t(a)===d};exports.isProfiler=function(a){return t(a)===g};exports.isStrictMode=function(a){return t(a)===f};
22647exports.isSuspense=function(a){return t(a)===p};
22648
22649},{}],33:[function(require,module,exports){
22650(function (process){
22651'use strict';
22652
22653if (process.env.NODE_ENV === 'production') {
22654 module.exports = require('./cjs/react-is.production.min.js');
22655} else {
22656 module.exports = require('./cjs/react-is.development.js');
22657}
22658
22659}).call(this,require('_process'))
22660
22661},{"./cjs/react-is.development.js":31,"./cjs/react-is.production.min.js":32,"_process":24}],34:[function(require,module,exports){
22662"use strict";
22663
22664var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
22665
22666exports.__esModule = true;
22667exports.createProvider = createProvider;
22668exports.default = void 0;
22669
22670var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
22671
22672var _react = require("react");
22673
22674var _propTypes = _interopRequireDefault(require("prop-types"));
22675
22676var _PropTypes = require("../utils/PropTypes");
22677
22678var _warning = _interopRequireDefault(require("../utils/warning"));
22679
22680var didWarnAboutReceivingStore = false;
22681
22682function warnAboutReceivingStore() {
22683 if (didWarnAboutReceivingStore) {
22684 return;
22685 }
22686
22687 didWarnAboutReceivingStore = true;
22688 (0, _warning.default)('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reduxjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
22689}
22690
22691function createProvider(storeKey) {
22692 var _Provider$childContex;
22693
22694 if (storeKey === void 0) {
22695 storeKey = 'store';
22696 }
22697
22698 var subscriptionKey = storeKey + "Subscription";
22699
22700 var Provider =
22701 /*#__PURE__*/
22702 function (_Component) {
22703 (0, _inheritsLoose2.default)(Provider, _Component);
22704 var _proto = Provider.prototype;
22705
22706 _proto.getChildContext = function getChildContext() {
22707 var _ref;
22708
22709 return _ref = {}, _ref[storeKey] = this[storeKey], _ref[subscriptionKey] = null, _ref;
22710 };
22711
22712 function Provider(props, context) {
22713 var _this;
22714
22715 _this = _Component.call(this, props, context) || this;
22716 _this[storeKey] = props.store;
22717 return _this;
22718 }
22719
22720 _proto.render = function render() {
22721 return _react.Children.only(this.props.children);
22722 };
22723
22724 return Provider;
22725 }(_react.Component);
22726
22727 if ("development" !== 'production') {
22728 Provider.prototype.componentWillReceiveProps = function (nextProps) {
22729 if (this[storeKey] !== nextProps.store) {
22730 warnAboutReceivingStore();
22731 }
22732 };
22733 }
22734
22735 Provider.propTypes = {
22736 store: _PropTypes.storeShape.isRequired,
22737 children: _propTypes.default.element.isRequired
22738 };
22739 Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[storeKey] = _PropTypes.storeShape.isRequired, _Provider$childContex[subscriptionKey] = _PropTypes.subscriptionShape, _Provider$childContex);
22740 return Provider;
22741}
22742
22743var _default = createProvider();
22744
22745exports.default = _default;
22746},{"../utils/PropTypes":44,"../utils/warning":49,"@babel/runtime/helpers/inheritsLoose":3,"@babel/runtime/helpers/interopRequireDefault":4,"prop-types":"prop-types","react":"react"}],35:[function(require,module,exports){
22747"use strict";
22748
22749var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
22750
22751exports.__esModule = true;
22752exports.default = connectAdvanced;
22753
22754var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
22755
22756var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
22757
22758var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
22759
22760var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
22761
22762var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
22763
22764var _invariant = _interopRequireDefault(require("invariant"));
22765
22766var _react = require("react");
22767
22768var _reactIs = require("react-is");
22769
22770var _Subscription = _interopRequireDefault(require("../utils/Subscription"));
22771
22772var _PropTypes = require("../utils/PropTypes");
22773
22774var hotReloadingVersion = 0;
22775var dummyState = {};
22776
22777function noop() {}
22778
22779function makeSelectorStateful(sourceSelector, store) {
22780 // wrap the selector in an object that tracks its results between runs.
22781 var selector = {
22782 run: function runComponentSelector(props) {
22783 try {
22784 var nextProps = sourceSelector(store.getState(), props);
22785
22786 if (nextProps !== selector.props || selector.error) {
22787 selector.shouldComponentUpdate = true;
22788 selector.props = nextProps;
22789 selector.error = null;
22790 }
22791 } catch (error) {
22792 selector.shouldComponentUpdate = true;
22793 selector.error = error;
22794 }
22795 }
22796 };
22797 return selector;
22798}
22799
22800function connectAdvanced(
22801/*
22802 selectorFactory is a func that is responsible for returning the selector function used to
22803 compute new props from state, props, and dispatch. For example:
22804 export default connectAdvanced((dispatch, options) => (state, props) => ({
22805 thing: state.things[props.thingId],
22806 saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
22807 }))(YourComponent)
22808 Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
22809 outside of their selector as an optimization. Options passed to connectAdvanced are passed to
22810 the selectorFactory, along with displayName and WrappedComponent, as the second argument.
22811 Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
22812 props. Do not use connectAdvanced directly without memoizing results between calls to your
22813 selector, otherwise the Connect component will re-render on every state or props change.
22814*/
22815selectorFactory, // options object:
22816_ref) {
22817 var _contextTypes, _childContextTypes;
22818
22819 if (_ref === void 0) {
22820 _ref = {};
22821 }
22822
22823 var _ref2 = _ref,
22824 _ref2$getDisplayName = _ref2.getDisplayName,
22825 getDisplayName = _ref2$getDisplayName === void 0 ? function (name) {
22826 return "ConnectAdvanced(" + name + ")";
22827 } : _ref2$getDisplayName,
22828 _ref2$methodName = _ref2.methodName,
22829 methodName = _ref2$methodName === void 0 ? 'connectAdvanced' : _ref2$methodName,
22830 _ref2$renderCountProp = _ref2.renderCountProp,
22831 renderCountProp = _ref2$renderCountProp === void 0 ? undefined : _ref2$renderCountProp,
22832 _ref2$shouldHandleSta = _ref2.shouldHandleStateChanges,
22833 shouldHandleStateChanges = _ref2$shouldHandleSta === void 0 ? true : _ref2$shouldHandleSta,
22834 _ref2$storeKey = _ref2.storeKey,
22835 storeKey = _ref2$storeKey === void 0 ? 'store' : _ref2$storeKey,
22836 _ref2$withRef = _ref2.withRef,
22837 withRef = _ref2$withRef === void 0 ? false : _ref2$withRef,
22838 connectOptions = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef"]);
22839 var subscriptionKey = storeKey + 'Subscription';
22840 var version = hotReloadingVersion++;
22841 var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = _PropTypes.storeShape, _contextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _contextTypes);
22842 var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _childContextTypes);
22843 return function wrapWithConnect(WrappedComponent) {
22844 (0, _invariant.default)((0, _reactIs.isValidElementType)(WrappedComponent), "You must pass a component to the function returned by " + (methodName + ". Instead received " + JSON.stringify(WrappedComponent)));
22845 var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
22846 var displayName = getDisplayName(wrappedComponentName);
22847 var selectorFactoryOptions = (0, _extends2.default)({}, connectOptions, {
22848 getDisplayName: getDisplayName,
22849 methodName: methodName,
22850 renderCountProp: renderCountProp,
22851 shouldHandleStateChanges: shouldHandleStateChanges,
22852 storeKey: storeKey,
22853 withRef: withRef,
22854 displayName: displayName,
22855 wrappedComponentName: wrappedComponentName,
22856 WrappedComponent: WrappedComponent // TODO Actually fix our use of componentWillReceiveProps
22857
22858 /* eslint-disable react/no-deprecated */
22859
22860 });
22861
22862 var Connect =
22863 /*#__PURE__*/
22864 function (_Component) {
22865 (0, _inheritsLoose2.default)(Connect, _Component);
22866
22867 function Connect(props, context) {
22868 var _this;
22869
22870 _this = _Component.call(this, props, context) || this;
22871 _this.version = version;
22872 _this.state = {};
22873 _this.renderCount = 0;
22874 _this.store = props[storeKey] || context[storeKey];
22875 _this.propsMode = Boolean(props[storeKey]);
22876 _this.setWrappedInstance = _this.setWrappedInstance.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
22877 (0, _invariant.default)(_this.store, "Could not find \"" + storeKey + "\" in either the context or props of " + ("\"" + displayName + "\". Either wrap the root component in a <Provider>, ") + ("or explicitly pass \"" + storeKey + "\" as a prop to \"" + displayName + "\"."));
22878
22879 _this.initSelector();
22880
22881 _this.initSubscription();
22882
22883 return _this;
22884 }
22885
22886 var _proto = Connect.prototype;
22887
22888 _proto.getChildContext = function getChildContext() {
22889 var _ref3;
22890
22891 // If this component received store from props, its subscription should be transparent
22892 // to any descendants receiving store+subscription from context; it passes along
22893 // subscription passed to it. Otherwise, it shadows the parent subscription, which allows
22894 // Connect to control ordering of notifications to flow top-down.
22895 var subscription = this.propsMode ? null : this.subscription;
22896 return _ref3 = {}, _ref3[subscriptionKey] = subscription || this.context[subscriptionKey], _ref3;
22897 };
22898
22899 _proto.componentDidMount = function componentDidMount() {
22900 if (!shouldHandleStateChanges) return; // componentWillMount fires during server side rendering, but componentDidMount and
22901 // componentWillUnmount do not. Because of this, trySubscribe happens during ...didMount.
22902 // Otherwise, unsubscription would never take place during SSR, causing a memory leak.
22903 // To handle the case where a child component may have triggered a state change by
22904 // dispatching an action in its componentWillMount, we have to re-run the select and maybe
22905 // re-render.
22906
22907 this.subscription.trySubscribe();
22908 this.selector.run(this.props);
22909 if (this.selector.shouldComponentUpdate) this.forceUpdate();
22910 };
22911
22912 _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
22913 this.selector.run(nextProps);
22914 };
22915
22916 _proto.shouldComponentUpdate = function shouldComponentUpdate() {
22917 return this.selector.shouldComponentUpdate;
22918 };
22919
22920 _proto.componentWillUnmount = function componentWillUnmount() {
22921 if (this.subscription) this.subscription.tryUnsubscribe();
22922 this.subscription = null;
22923 this.notifyNestedSubs = noop;
22924 this.store = null;
22925 this.selector.run = noop;
22926 this.selector.shouldComponentUpdate = false;
22927 };
22928
22929 _proto.getWrappedInstance = function getWrappedInstance() {
22930 (0, _invariant.default)(withRef, "To access the wrapped instance, you need to specify " + ("{ withRef: true } in the options argument of the " + methodName + "() call."));
22931 return this.wrappedInstance;
22932 };
22933
22934 _proto.setWrappedInstance = function setWrappedInstance(ref) {
22935 this.wrappedInstance = ref;
22936 };
22937
22938 _proto.initSelector = function initSelector() {
22939 var sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions);
22940 this.selector = makeSelectorStateful(sourceSelector, this.store);
22941 this.selector.run(this.props);
22942 };
22943
22944 _proto.initSubscription = function initSubscription() {
22945 if (!shouldHandleStateChanges) return; // parentSub's source should match where store came from: props vs. context. A component
22946 // connected to the store via props shouldn't use subscription from context, or vice versa.
22947
22948 var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey];
22949 this.subscription = new _Subscription.default(this.store, parentSub, this.onStateChange.bind(this)); // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
22950 // the middle of the notification loop, where `this.subscription` will then be null. An
22951 // extra null check every change can be avoided by copying the method onto `this` and then
22952 // replacing it with a no-op on unmount. This can probably be avoided if Subscription's
22953 // listeners logic is changed to not call listeners that have been unsubscribed in the
22954 // middle of the notification loop.
22955
22956 this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription);
22957 };
22958
22959 _proto.onStateChange = function onStateChange() {
22960 this.selector.run(this.props);
22961
22962 if (!this.selector.shouldComponentUpdate) {
22963 this.notifyNestedSubs();
22964 } else {
22965 this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate;
22966 this.setState(dummyState);
22967 }
22968 };
22969
22970 _proto.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() {
22971 // `componentDidUpdate` is conditionally implemented when `onStateChange` determines it
22972 // needs to notify nested subs. Once called, it unimplements itself until further state
22973 // changes occur. Doing it this way vs having a permanent `componentDidUpdate` that does
22974 // a boolean check every time avoids an extra method call most of the time, resulting
22975 // in some perf boost.
22976 this.componentDidUpdate = undefined;
22977 this.notifyNestedSubs();
22978 };
22979
22980 _proto.isSubscribed = function isSubscribed() {
22981 return Boolean(this.subscription) && this.subscription.isSubscribed();
22982 };
22983
22984 _proto.addExtraProps = function addExtraProps(props) {
22985 if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) return props; // make a shallow copy so that fields added don't leak to the original selector.
22986 // this is especially important for 'ref' since that's a reference back to the component
22987 // instance. a singleton memoized selector would then be holding a reference to the
22988 // instance, preventing the instance from being garbage collected, and that would be bad
22989
22990 var withExtras = (0, _extends2.default)({}, props);
22991 if (withRef) withExtras.ref = this.setWrappedInstance;
22992 if (renderCountProp) withExtras[renderCountProp] = this.renderCount++;
22993 if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription;
22994 return withExtras;
22995 };
22996
22997 _proto.render = function render() {
22998 var selector = this.selector;
22999 selector.shouldComponentUpdate = false;
23000
23001 if (selector.error) {
23002 throw selector.error;
23003 } else {
23004 return (0, _react.createElement)(WrappedComponent, this.addExtraProps(selector.props));
23005 }
23006 };
23007
23008 return Connect;
23009 }(_react.Component);
23010 /* eslint-enable react/no-deprecated */
23011
23012
23013 Connect.WrappedComponent = WrappedComponent;
23014 Connect.displayName = displayName;
23015 Connect.childContextTypes = childContextTypes;
23016 Connect.contextTypes = contextTypes;
23017 Connect.propTypes = contextTypes;
23018
23019 if ("development" !== 'production') {
23020 Connect.prototype.componentWillUpdate = function componentWillUpdate() {
23021 var _this2 = this;
23022
23023 // We are hot reloading!
23024 if (this.version !== version) {
23025 this.version = version;
23026 this.initSelector(); // If any connected descendants don't hot reload (and resubscribe in the process), their
23027 // listeners will be lost when we unsubscribe. Unfortunately, by copying over all
23028 // listeners, this does mean that the old versions of connected descendants will still be
23029 // notified of state changes; however, their onStateChange function is a no-op so this
23030 // isn't a huge deal.
23031
23032 var oldListeners = [];
23033
23034 if (this.subscription) {
23035 oldListeners = this.subscription.listeners.get();
23036 this.subscription.tryUnsubscribe();
23037 }
23038
23039 this.initSubscription();
23040
23041 if (shouldHandleStateChanges) {
23042 this.subscription.trySubscribe();
23043 oldListeners.forEach(function (listener) {
23044 return _this2.subscription.listeners.subscribe(listener);
23045 });
23046 }
23047 }
23048 };
23049 }
23050
23051 return (0, _hoistNonReactStatics.default)(Connect, WrappedComponent);
23052 };
23053}
23054},{"../utils/PropTypes":44,"../utils/Subscription":45,"@babel/runtime/helpers/assertThisInitialized":1,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/inheritsLoose":3,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6,"hoist-non-react-statics":9,"invariant":11,"react":"react","react-is":33}],36:[function(require,module,exports){
23055"use strict";
23056
23057var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23058
23059exports.__esModule = true;
23060exports.createConnect = createConnect;
23061exports.default = void 0;
23062
23063var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
23064
23065var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
23066
23067var _connectAdvanced = _interopRequireDefault(require("../components/connectAdvanced"));
23068
23069var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual"));
23070
23071var _mapDispatchToProps = _interopRequireDefault(require("./mapDispatchToProps"));
23072
23073var _mapStateToProps = _interopRequireDefault(require("./mapStateToProps"));
23074
23075var _mergeProps = _interopRequireDefault(require("./mergeProps"));
23076
23077var _selectorFactory = _interopRequireDefault(require("./selectorFactory"));
23078
23079/*
23080 connect is a facade over connectAdvanced. It turns its args into a compatible
23081 selectorFactory, which has the signature:
23082
23083 (dispatch, options) => (nextState, nextOwnProps) => nextFinalProps
23084
23085 connect passes its args to connectAdvanced as options, which will in turn pass them to
23086 selectorFactory each time a Connect component instance is instantiated or hot reloaded.
23087
23088 selectorFactory returns a final props selector from its mapStateToProps,
23089 mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps,
23090 mergePropsFactories, and pure args.
23091
23092 The resulting final props selector is called by the Connect component instance whenever
23093 it receives new props or store state.
23094 */
23095function match(arg, factories, name) {
23096 for (var i = factories.length - 1; i >= 0; i--) {
23097 var result = factories[i](arg);
23098 if (result) return result;
23099 }
23100
23101 return function (dispatch, options) {
23102 throw new Error("Invalid value of type " + typeof arg + " for " + name + " argument when connecting component " + options.wrappedComponentName + ".");
23103 };
23104}
23105
23106function strictEqual(a, b) {
23107 return a === b;
23108} // createConnect with default args builds the 'official' connect behavior. Calling it with
23109// different options opens up some testing and extensibility scenarios
23110
23111
23112function createConnect(_temp) {
23113 var _ref = _temp === void 0 ? {} : _temp,
23114 _ref$connectHOC = _ref.connectHOC,
23115 connectHOC = _ref$connectHOC === void 0 ? _connectAdvanced.default : _ref$connectHOC,
23116 _ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
23117 mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? _mapStateToProps.default : _ref$mapStateToPropsF,
23118 _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
23119 mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? _mapDispatchToProps.default : _ref$mapDispatchToPro,
23120 _ref$mergePropsFactor = _ref.mergePropsFactories,
23121 mergePropsFactories = _ref$mergePropsFactor === void 0 ? _mergeProps.default : _ref$mergePropsFactor,
23122 _ref$selectorFactory = _ref.selectorFactory,
23123 selectorFactory = _ref$selectorFactory === void 0 ? _selectorFactory.default : _ref$selectorFactory;
23124
23125 return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) {
23126 if (_ref2 === void 0) {
23127 _ref2 = {};
23128 }
23129
23130 var _ref3 = _ref2,
23131 _ref3$pure = _ref3.pure,
23132 pure = _ref3$pure === void 0 ? true : _ref3$pure,
23133 _ref3$areStatesEqual = _ref3.areStatesEqual,
23134 areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual,
23135 _ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual,
23136 areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? _shallowEqual.default : _ref3$areOwnPropsEqua,
23137 _ref3$areStatePropsEq = _ref3.areStatePropsEqual,
23138 areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? _shallowEqual.default : _ref3$areStatePropsEq,
23139 _ref3$areMergedPropsE = _ref3.areMergedPropsEqual,
23140 areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? _shallowEqual.default : _ref3$areMergedPropsE,
23141 extraOptions = (0, _objectWithoutPropertiesLoose2.default)(_ref3, ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"]);
23142 var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
23143 var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
23144 var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');
23145 return connectHOC(selectorFactory, (0, _extends2.default)({
23146 // used in error messages
23147 methodName: 'connect',
23148 // used to compute Connect's displayName from the wrapped component's displayName.
23149 getDisplayName: function getDisplayName(name) {
23150 return "Connect(" + name + ")";
23151 },
23152 // if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes
23153 shouldHandleStateChanges: Boolean(mapStateToProps),
23154 // passed through to selectorFactory
23155 initMapStateToProps: initMapStateToProps,
23156 initMapDispatchToProps: initMapDispatchToProps,
23157 initMergeProps: initMergeProps,
23158 pure: pure,
23159 areStatesEqual: areStatesEqual,
23160 areOwnPropsEqual: areOwnPropsEqual,
23161 areStatePropsEqual: areStatePropsEqual,
23162 areMergedPropsEqual: areMergedPropsEqual
23163 }, extraOptions));
23164 };
23165}
23166
23167var _default = createConnect();
23168
23169exports.default = _default;
23170},{"../components/connectAdvanced":35,"../utils/shallowEqual":47,"./mapDispatchToProps":37,"./mapStateToProps":38,"./mergeProps":39,"./selectorFactory":40,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6}],37:[function(require,module,exports){
23171"use strict";
23172
23173exports.__esModule = true;
23174exports.whenMapDispatchToPropsIsFunction = whenMapDispatchToPropsIsFunction;
23175exports.whenMapDispatchToPropsIsMissing = whenMapDispatchToPropsIsMissing;
23176exports.whenMapDispatchToPropsIsObject = whenMapDispatchToPropsIsObject;
23177exports.default = void 0;
23178
23179var _redux = require("redux");
23180
23181var _wrapMapToProps = require("./wrapMapToProps");
23182
23183function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
23184 return typeof mapDispatchToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapDispatchToProps, 'mapDispatchToProps') : undefined;
23185}
23186
23187function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
23188 return !mapDispatchToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
23189 return {
23190 dispatch: dispatch
23191 };
23192 }) : undefined;
23193}
23194
23195function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
23196 return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
23197 return (0, _redux.bindActionCreators)(mapDispatchToProps, dispatch);
23198 }) : undefined;
23199}
23200
23201var _default = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
23202exports.default = _default;
23203},{"./wrapMapToProps":42,"redux":63}],38:[function(require,module,exports){
23204"use strict";
23205
23206exports.__esModule = true;
23207exports.whenMapStateToPropsIsFunction = whenMapStateToPropsIsFunction;
23208exports.whenMapStateToPropsIsMissing = whenMapStateToPropsIsMissing;
23209exports.default = void 0;
23210
23211var _wrapMapToProps = require("./wrapMapToProps");
23212
23213function whenMapStateToPropsIsFunction(mapStateToProps) {
23214 return typeof mapStateToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapStateToProps, 'mapStateToProps') : undefined;
23215}
23216
23217function whenMapStateToPropsIsMissing(mapStateToProps) {
23218 return !mapStateToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function () {
23219 return {};
23220 }) : undefined;
23221}
23222
23223var _default = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];
23224exports.default = _default;
23225},{"./wrapMapToProps":42}],39:[function(require,module,exports){
23226"use strict";
23227
23228var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23229
23230exports.__esModule = true;
23231exports.defaultMergeProps = defaultMergeProps;
23232exports.wrapMergePropsFunc = wrapMergePropsFunc;
23233exports.whenMergePropsIsFunction = whenMergePropsIsFunction;
23234exports.whenMergePropsIsOmitted = whenMergePropsIsOmitted;
23235exports.default = void 0;
23236
23237var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
23238
23239var _verifyPlainObject = _interopRequireDefault(require("../utils/verifyPlainObject"));
23240
23241function defaultMergeProps(stateProps, dispatchProps, ownProps) {
23242 return (0, _extends2.default)({}, ownProps, stateProps, dispatchProps);
23243}
23244
23245function wrapMergePropsFunc(mergeProps) {
23246 return function initMergePropsProxy(dispatch, _ref) {
23247 var displayName = _ref.displayName,
23248 pure = _ref.pure,
23249 areMergedPropsEqual = _ref.areMergedPropsEqual;
23250 var hasRunOnce = false;
23251 var mergedProps;
23252 return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
23253 var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
23254
23255 if (hasRunOnce) {
23256 if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;
23257 } else {
23258 hasRunOnce = true;
23259 mergedProps = nextMergedProps;
23260 if ("development" !== 'production') (0, _verifyPlainObject.default)(mergedProps, displayName, 'mergeProps');
23261 }
23262
23263 return mergedProps;
23264 };
23265 };
23266}
23267
23268function whenMergePropsIsFunction(mergeProps) {
23269 return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
23270}
23271
23272function whenMergePropsIsOmitted(mergeProps) {
23273 return !mergeProps ? function () {
23274 return defaultMergeProps;
23275 } : undefined;
23276}
23277
23278var _default = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
23279exports.default = _default;
23280},{"../utils/verifyPlainObject":48,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/interopRequireDefault":4}],40:[function(require,module,exports){
23281"use strict";
23282
23283var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23284
23285exports.__esModule = true;
23286exports.impureFinalPropsSelectorFactory = impureFinalPropsSelectorFactory;
23287exports.pureFinalPropsSelectorFactory = pureFinalPropsSelectorFactory;
23288exports.default = finalPropsSelectorFactory;
23289
23290var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
23291
23292var _verifySubselectors = _interopRequireDefault(require("./verifySubselectors"));
23293
23294function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
23295 return function impureFinalPropsSelector(state, ownProps) {
23296 return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
23297 };
23298}
23299
23300function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {
23301 var areStatesEqual = _ref.areStatesEqual,
23302 areOwnPropsEqual = _ref.areOwnPropsEqual,
23303 areStatePropsEqual = _ref.areStatePropsEqual;
23304 var hasRunAtLeastOnce = false;
23305 var state;
23306 var ownProps;
23307 var stateProps;
23308 var dispatchProps;
23309 var mergedProps;
23310
23311 function handleFirstCall(firstState, firstOwnProps) {
23312 state = firstState;
23313 ownProps = firstOwnProps;
23314 stateProps = mapStateToProps(state, ownProps);
23315 dispatchProps = mapDispatchToProps(dispatch, ownProps);
23316 mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
23317 hasRunAtLeastOnce = true;
23318 return mergedProps;
23319 }
23320
23321 function handleNewPropsAndNewState() {
23322 stateProps = mapStateToProps(state, ownProps);
23323 if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
23324 mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
23325 return mergedProps;
23326 }
23327
23328 function handleNewProps() {
23329 if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);
23330 if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
23331 mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
23332 return mergedProps;
23333 }
23334
23335 function handleNewState() {
23336 var nextStateProps = mapStateToProps(state, ownProps);
23337 var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
23338 stateProps = nextStateProps;
23339 if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
23340 return mergedProps;
23341 }
23342
23343 function handleSubsequentCalls(nextState, nextOwnProps) {
23344 var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);
23345 var stateChanged = !areStatesEqual(nextState, state);
23346 state = nextState;
23347 ownProps = nextOwnProps;
23348 if (propsChanged && stateChanged) return handleNewPropsAndNewState();
23349 if (propsChanged) return handleNewProps();
23350 if (stateChanged) return handleNewState();
23351 return mergedProps;
23352 }
23353
23354 return function pureFinalPropsSelector(nextState, nextOwnProps) {
23355 return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);
23356 };
23357} // TODO: Add more comments
23358// If pure is true, the selector returned by selectorFactory will memoize its results,
23359// allowing connectAdvanced's shouldComponentUpdate to return false if final
23360// props have not changed. If false, the selector will always return a new
23361// object and shouldComponentUpdate will always return true.
23362
23363
23364function finalPropsSelectorFactory(dispatch, _ref2) {
23365 var initMapStateToProps = _ref2.initMapStateToProps,
23366 initMapDispatchToProps = _ref2.initMapDispatchToProps,
23367 initMergeProps = _ref2.initMergeProps,
23368 options = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]);
23369 var mapStateToProps = initMapStateToProps(dispatch, options);
23370 var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
23371 var mergeProps = initMergeProps(dispatch, options);
23372
23373 if ("development" !== 'production') {
23374 (0, _verifySubselectors.default)(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);
23375 }
23376
23377 var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
23378 return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
23379}
23380},{"./verifySubselectors":41,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6}],41:[function(require,module,exports){
23381"use strict";
23382
23383var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23384
23385exports.__esModule = true;
23386exports.default = verifySubselectors;
23387
23388var _warning = _interopRequireDefault(require("../utils/warning"));
23389
23390function verify(selector, methodName, displayName) {
23391 if (!selector) {
23392 throw new Error("Unexpected value for " + methodName + " in " + displayName + ".");
23393 } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
23394 if (!selector.hasOwnProperty('dependsOnOwnProps')) {
23395 (0, _warning.default)("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps.");
23396 }
23397 }
23398}
23399
23400function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
23401 verify(mapStateToProps, 'mapStateToProps', displayName);
23402 verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
23403 verify(mergeProps, 'mergeProps', displayName);
23404}
23405},{"../utils/warning":49,"@babel/runtime/helpers/interopRequireDefault":4}],42:[function(require,module,exports){
23406"use strict";
23407
23408var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23409
23410exports.__esModule = true;
23411exports.wrapMapToPropsConstant = wrapMapToPropsConstant;
23412exports.getDependsOnOwnProps = getDependsOnOwnProps;
23413exports.wrapMapToPropsFunc = wrapMapToPropsFunc;
23414
23415var _verifyPlainObject = _interopRequireDefault(require("../utils/verifyPlainObject"));
23416
23417function wrapMapToPropsConstant(getConstant) {
23418 return function initConstantSelector(dispatch, options) {
23419 var constant = getConstant(dispatch, options);
23420
23421 function constantSelector() {
23422 return constant;
23423 }
23424
23425 constantSelector.dependsOnOwnProps = false;
23426 return constantSelector;
23427 };
23428} // dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args
23429// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine
23430// whether mapToProps needs to be invoked when props have changed.
23431//
23432// A length of one signals that mapToProps does not depend on props from the parent component.
23433// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and
23434// therefore not reporting its length accurately..
23435
23436
23437function getDependsOnOwnProps(mapToProps) {
23438 return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
23439} // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,
23440// this function wraps mapToProps in a proxy function which does several things:
23441//
23442// * Detects whether the mapToProps function being called depends on props, which
23443// is used by selectorFactory to decide if it should reinvoke on props changes.
23444//
23445// * On first call, handles mapToProps if returns another function, and treats that
23446// new function as the true mapToProps for subsequent calls.
23447//
23448// * On first call, verifies the first result is a plain object, in order to warn
23449// the developer that their mapToProps function is not returning a valid result.
23450//
23451
23452
23453function wrapMapToPropsFunc(mapToProps, methodName) {
23454 return function initProxySelector(dispatch, _ref) {
23455 var displayName = _ref.displayName;
23456
23457 var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
23458 return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch);
23459 }; // allow detectFactoryAndVerify to get ownProps
23460
23461
23462 proxy.dependsOnOwnProps = true;
23463
23464 proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
23465 proxy.mapToProps = mapToProps;
23466 proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
23467 var props = proxy(stateOrDispatch, ownProps);
23468
23469 if (typeof props === 'function') {
23470 proxy.mapToProps = props;
23471 proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
23472 props = proxy(stateOrDispatch, ownProps);
23473 }
23474
23475 if ("development" !== 'production') (0, _verifyPlainObject.default)(props, displayName, methodName);
23476 return props;
23477 };
23478
23479 return proxy;
23480 };
23481}
23482},{"../utils/verifyPlainObject":48,"@babel/runtime/helpers/interopRequireDefault":4}],43:[function(require,module,exports){
23483"use strict";
23484
23485var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23486
23487var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
23488
23489exports.__esModule = true;
23490
23491var _Provider = _interopRequireWildcard(require("./components/Provider"));
23492
23493exports.Provider = _Provider.default;
23494exports.createProvider = _Provider.createProvider;
23495
23496var _connectAdvanced = _interopRequireDefault(require("./components/connectAdvanced"));
23497
23498exports.connectAdvanced = _connectAdvanced.default;
23499
23500var _connect = _interopRequireDefault(require("./connect/connect"));
23501
23502exports.connect = _connect.default;
23503},{"./components/Provider":34,"./components/connectAdvanced":35,"./connect/connect":36,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/interopRequireWildcard":5}],44:[function(require,module,exports){
23504"use strict";
23505
23506var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23507
23508exports.__esModule = true;
23509exports.storeShape = exports.subscriptionShape = void 0;
23510
23511var _propTypes = _interopRequireDefault(require("prop-types"));
23512
23513var subscriptionShape = _propTypes.default.shape({
23514 trySubscribe: _propTypes.default.func.isRequired,
23515 tryUnsubscribe: _propTypes.default.func.isRequired,
23516 notifyNestedSubs: _propTypes.default.func.isRequired,
23517 isSubscribed: _propTypes.default.func.isRequired
23518});
23519
23520exports.subscriptionShape = subscriptionShape;
23521
23522var storeShape = _propTypes.default.shape({
23523 subscribe: _propTypes.default.func.isRequired,
23524 dispatch: _propTypes.default.func.isRequired,
23525 getState: _propTypes.default.func.isRequired
23526});
23527
23528exports.storeShape = storeShape;
23529},{"@babel/runtime/helpers/interopRequireDefault":4,"prop-types":"prop-types"}],45:[function(require,module,exports){
23530"use strict";
23531
23532exports.__esModule = true;
23533exports.default = void 0;
23534// encapsulates the subscription logic for connecting a component to the redux store, as
23535// well as nesting subscriptions of descendant components, so that we can ensure the
23536// ancestor components re-render before descendants
23537var CLEARED = null;
23538var nullListeners = {
23539 notify: function notify() {}
23540};
23541
23542function createListenerCollection() {
23543 // the current/next pattern is copied from redux's createStore code.
23544 // TODO: refactor+expose that code to be reusable here?
23545 var current = [];
23546 var next = [];
23547 return {
23548 clear: function clear() {
23549 next = CLEARED;
23550 current = CLEARED;
23551 },
23552 notify: function notify() {
23553 var listeners = current = next;
23554
23555 for (var i = 0; i < listeners.length; i++) {
23556 listeners[i]();
23557 }
23558 },
23559 get: function get() {
23560 return next;
23561 },
23562 subscribe: function subscribe(listener) {
23563 var isSubscribed = true;
23564 if (next === current) next = current.slice();
23565 next.push(listener);
23566 return function unsubscribe() {
23567 if (!isSubscribed || current === CLEARED) return;
23568 isSubscribed = false;
23569 if (next === current) next = current.slice();
23570 next.splice(next.indexOf(listener), 1);
23571 };
23572 }
23573 };
23574}
23575
23576var Subscription =
23577/*#__PURE__*/
23578function () {
23579 function Subscription(store, parentSub, onStateChange) {
23580 this.store = store;
23581 this.parentSub = parentSub;
23582 this.onStateChange = onStateChange;
23583 this.unsubscribe = null;
23584 this.listeners = nullListeners;
23585 }
23586
23587 var _proto = Subscription.prototype;
23588
23589 _proto.addNestedSub = function addNestedSub(listener) {
23590 this.trySubscribe();
23591 return this.listeners.subscribe(listener);
23592 };
23593
23594 _proto.notifyNestedSubs = function notifyNestedSubs() {
23595 this.listeners.notify();
23596 };
23597
23598 _proto.isSubscribed = function isSubscribed() {
23599 return Boolean(this.unsubscribe);
23600 };
23601
23602 _proto.trySubscribe = function trySubscribe() {
23603 if (!this.unsubscribe) {
23604 this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
23605 this.listeners = createListenerCollection();
23606 }
23607 };
23608
23609 _proto.tryUnsubscribe = function tryUnsubscribe() {
23610 if (this.unsubscribe) {
23611 this.unsubscribe();
23612 this.unsubscribe = null;
23613 this.listeners.clear();
23614 this.listeners = nullListeners;
23615 }
23616 };
23617
23618 return Subscription;
23619}();
23620
23621exports.default = Subscription;
23622},{}],46:[function(require,module,exports){
23623"use strict";
23624
23625exports.__esModule = true;
23626exports.default = isPlainObject;
23627
23628/**
23629 * @param {any} obj The object to inspect.
23630 * @returns {boolean} True if the argument appears to be a plain object.
23631 */
23632function isPlainObject(obj) {
23633 if (typeof obj !== 'object' || obj === null) return false;
23634 var proto = Object.getPrototypeOf(obj);
23635 if (proto === null) return true;
23636 var baseProto = proto;
23637
23638 while (Object.getPrototypeOf(baseProto) !== null) {
23639 baseProto = Object.getPrototypeOf(baseProto);
23640 }
23641
23642 return proto === baseProto;
23643}
23644},{}],47:[function(require,module,exports){
23645"use strict";
23646
23647exports.__esModule = true;
23648exports.default = shallowEqual;
23649var hasOwn = Object.prototype.hasOwnProperty;
23650
23651function is(x, y) {
23652 if (x === y) {
23653 return x !== 0 || y !== 0 || 1 / x === 1 / y;
23654 } else {
23655 return x !== x && y !== y;
23656 }
23657}
23658
23659function shallowEqual(objA, objB) {
23660 if (is(objA, objB)) return true;
23661
23662 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
23663 return false;
23664 }
23665
23666 var keysA = Object.keys(objA);
23667 var keysB = Object.keys(objB);
23668 if (keysA.length !== keysB.length) return false;
23669
23670 for (var i = 0; i < keysA.length; i++) {
23671 if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
23672 return false;
23673 }
23674 }
23675
23676 return true;
23677}
23678},{}],48:[function(require,module,exports){
23679"use strict";
23680
23681var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
23682
23683exports.__esModule = true;
23684exports.default = verifyPlainObject;
23685
23686var _isPlainObject = _interopRequireDefault(require("./isPlainObject"));
23687
23688var _warning = _interopRequireDefault(require("./warning"));
23689
23690function verifyPlainObject(value, displayName, methodName) {
23691 if (!(0, _isPlainObject.default)(value)) {
23692 (0, _warning.default)(methodName + "() in " + displayName + " must return a plain object. Instead received " + value + ".");
23693 }
23694}
23695},{"./isPlainObject":46,"./warning":49,"@babel/runtime/helpers/interopRequireDefault":4}],49:[function(require,module,exports){
23696"use strict";
23697
23698exports.__esModule = true;
23699exports.default = warning;
23700
23701/**
23702 * Prints a warning in the console if it exists.
23703 *
23704 * @param {String} message The warning message.
23705 * @returns {void}
23706 */
23707function warning(message) {
23708 /* eslint-disable no-console */
23709 if (typeof console !== 'undefined' && typeof console.error === 'function') {
23710 console.error(message);
23711 }
23712 /* eslint-enable no-console */
23713
23714
23715 try {
23716 // This error was thrown as a convenience so that if you enable
23717 // "break on all exceptions" in your console,
23718 // it would pause the execution at this line.
23719 throw new Error(message);
23720 /* eslint-disable no-empty */
23721 } catch (e) {}
23722 /* eslint-enable no-empty */
23723
23724}
23725},{}],50:[function(require,module,exports){
23726/** @license React v16.7.0
23727 * react.development.js
23728 *
23729 * Copyright (c) Facebook, Inc. and its affiliates.
23730 *
23731 * This source code is licensed under the MIT license found in the
23732 * LICENSE file in the root directory of this source tree.
23733 */
23734
23735'use strict';
23736
23737
23738
23739if ("development" !== "production") {
23740 (function() {
23741'use strict';
23742
23743var _assign = require('object-assign');
23744var checkPropTypes = require('prop-types/checkPropTypes');
23745
23746// TODO: this is special because it gets imported during build.
23747
23748var ReactVersion = '16.7.0';
23749
23750// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
23751// nor polyfill, then a plain number is used for performance.
23752var hasSymbol = typeof Symbol === 'function' && Symbol.for;
23753
23754var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
23755var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
23756var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
23757var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
23758var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
23759var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
23760var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
23761
23762var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
23763var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
23764var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
23765var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
23766var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
23767
23768var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
23769var FAUX_ITERATOR_SYMBOL = '@@iterator';
23770
23771function getIteratorFn(maybeIterable) {
23772 if (maybeIterable === null || typeof maybeIterable !== 'object') {
23773 return null;
23774 }
23775 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
23776 if (typeof maybeIterator === 'function') {
23777 return maybeIterator;
23778 }
23779 return null;
23780}
23781
23782var enableHooks = false;
23783// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
23784
23785
23786// In some cases, StrictMode should also double-render lifecycles.
23787// This can be confusing for tests though,
23788// And it can be bad for performance in production.
23789// This feature flag can be used to control the behavior:
23790
23791
23792// To preserve the "Pause on caught exceptions" behavior of the debugger, we
23793// replay the begin phase of a failed component inside invokeGuardedCallback.
23794
23795
23796// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
23797
23798
23799// Gather advanced timing metrics for Profiler subtrees.
23800
23801
23802// Trace which interactions trigger each commit.
23803
23804
23805// Only used in www builds.
23806 // TODO: true? Here it might just be false.
23807
23808// Only used in www builds.
23809
23810
23811// Only used in www builds.
23812
23813
23814// React Fire: prevent the value and checked attributes from syncing
23815// with their related DOM properties
23816
23817
23818// These APIs will no longer be "unstable" in the upcoming 16.7 release,
23819// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
23820var enableStableConcurrentModeAPIs = false;
23821
23822/**
23823 * Use invariant() to assert state which your program assumes to be true.
23824 *
23825 * Provide sprintf-style format (only %s is supported) and arguments
23826 * to provide information about what broke and what you were
23827 * expecting.
23828 *
23829 * The invariant message will be stripped in production, but the invariant
23830 * will remain to ensure logic does not differ in production.
23831 */
23832
23833var validateFormat = function () {};
23834
23835{
23836 validateFormat = function (format) {
23837 if (format === undefined) {
23838 throw new Error('invariant requires an error message argument');
23839 }
23840 };
23841}
23842
23843function invariant(condition, format, a, b, c, d, e, f) {
23844 validateFormat(format);
23845
23846 if (!condition) {
23847 var error = void 0;
23848 if (format === undefined) {
23849 error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
23850 } else {
23851 var args = [a, b, c, d, e, f];
23852 var argIndex = 0;
23853 error = new Error(format.replace(/%s/g, function () {
23854 return args[argIndex++];
23855 }));
23856 error.name = 'Invariant Violation';
23857 }
23858
23859 error.framesToPop = 1; // we don't care about invariant's own frame
23860 throw error;
23861 }
23862}
23863
23864// Relying on the `invariant()` implementation lets us
23865// preserve the format and params in the www builds.
23866
23867/**
23868 * Forked from fbjs/warning:
23869 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
23870 *
23871 * Only change is we use console.warn instead of console.error,
23872 * and do nothing when 'console' is not supported.
23873 * This really simplifies the code.
23874 * ---
23875 * Similar to invariant but only logs a warning if the condition is not met.
23876 * This can be used to log issues in development environments in critical
23877 * paths. Removing the logging code for production environments will keep the
23878 * same logic and follow the same code paths.
23879 */
23880
23881var lowPriorityWarning = function () {};
23882
23883{
23884 var printWarning = function (format) {
23885 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
23886 args[_key - 1] = arguments[_key];
23887 }
23888
23889 var argIndex = 0;
23890 var message = 'Warning: ' + format.replace(/%s/g, function () {
23891 return args[argIndex++];
23892 });
23893 if (typeof console !== 'undefined') {
23894 console.warn(message);
23895 }
23896 try {
23897 // --- Welcome to debugging React ---
23898 // This error was thrown as a convenience so that you can use this stack
23899 // to find the callsite that caused this warning to fire.
23900 throw new Error(message);
23901 } catch (x) {}
23902 };
23903
23904 lowPriorityWarning = function (condition, format) {
23905 if (format === undefined) {
23906 throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
23907 }
23908 if (!condition) {
23909 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
23910 args[_key2 - 2] = arguments[_key2];
23911 }
23912
23913 printWarning.apply(undefined, [format].concat(args));
23914 }
23915 };
23916}
23917
23918var lowPriorityWarning$1 = lowPriorityWarning;
23919
23920/**
23921 * Similar to invariant but only logs a warning if the condition is not met.
23922 * This can be used to log issues in development environments in critical
23923 * paths. Removing the logging code for production environments will keep the
23924 * same logic and follow the same code paths.
23925 */
23926
23927var warningWithoutStack = function () {};
23928
23929{
23930 warningWithoutStack = function (condition, format) {
23931 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
23932 args[_key - 2] = arguments[_key];
23933 }
23934
23935 if (format === undefined) {
23936 throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
23937 }
23938 if (args.length > 8) {
23939 // Check before the condition to catch violations early.
23940 throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
23941 }
23942 if (condition) {
23943 return;
23944 }
23945 if (typeof console !== 'undefined') {
23946 var argsWithFormat = args.map(function (item) {
23947 return '' + item;
23948 });
23949 argsWithFormat.unshift('Warning: ' + format);
23950
23951 // We intentionally don't use spread (or .apply) directly because it
23952 // breaks IE9: https://github.com/facebook/react/issues/13610
23953 Function.prototype.apply.call(console.error, console, argsWithFormat);
23954 }
23955 try {
23956 // --- Welcome to debugging React ---
23957 // This error was thrown as a convenience so that you can use this stack
23958 // to find the callsite that caused this warning to fire.
23959 var argIndex = 0;
23960 var message = 'Warning: ' + format.replace(/%s/g, function () {
23961 return args[argIndex++];
23962 });
23963 throw new Error(message);
23964 } catch (x) {}
23965 };
23966}
23967
23968var warningWithoutStack$1 = warningWithoutStack;
23969
23970var didWarnStateUpdateForUnmountedComponent = {};
23971
23972function warnNoop(publicInstance, callerName) {
23973 {
23974 var _constructor = publicInstance.constructor;
23975 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
23976 var warningKey = componentName + '.' + callerName;
23977 if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
23978 return;
23979 }
23980 warningWithoutStack$1(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);
23981 didWarnStateUpdateForUnmountedComponent[warningKey] = true;
23982 }
23983}
23984
23985/**
23986 * This is the abstract API for an update queue.
23987 */
23988var ReactNoopUpdateQueue = {
23989 /**
23990 * Checks whether or not this composite component is mounted.
23991 * @param {ReactClass} publicInstance The instance we want to test.
23992 * @return {boolean} True if mounted, false otherwise.
23993 * @protected
23994 * @final
23995 */
23996 isMounted: function (publicInstance) {
23997 return false;
23998 },
23999
24000 /**
24001 * Forces an update. This should only be invoked when it is known with
24002 * certainty that we are **not** in a DOM transaction.
24003 *
24004 * You may want to call this when you know that some deeper aspect of the
24005 * component's state has changed but `setState` was not called.
24006 *
24007 * This will not invoke `shouldComponentUpdate`, but it will invoke
24008 * `componentWillUpdate` and `componentDidUpdate`.
24009 *
24010 * @param {ReactClass} publicInstance The instance that should rerender.
24011 * @param {?function} callback Called after component is updated.
24012 * @param {?string} callerName name of the calling function in the public API.
24013 * @internal
24014 */
24015 enqueueForceUpdate: function (publicInstance, callback, callerName) {
24016 warnNoop(publicInstance, 'forceUpdate');
24017 },
24018
24019 /**
24020 * Replaces all of the state. Always use this or `setState` to mutate state.
24021 * You should treat `this.state` as immutable.
24022 *
24023 * There is no guarantee that `this.state` will be immediately updated, so
24024 * accessing `this.state` after calling this method may return the old value.
24025 *
24026 * @param {ReactClass} publicInstance The instance that should rerender.
24027 * @param {object} completeState Next state.
24028 * @param {?function} callback Called after component is updated.
24029 * @param {?string} callerName name of the calling function in the public API.
24030 * @internal
24031 */
24032 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
24033 warnNoop(publicInstance, 'replaceState');
24034 },
24035
24036 /**
24037 * Sets a subset of the state. This only exists because _pendingState is
24038 * internal. This provides a merging strategy that is not available to deep
24039 * properties which is confusing. TODO: Expose pendingState or don't use it
24040 * during the merge.
24041 *
24042 * @param {ReactClass} publicInstance The instance that should rerender.
24043 * @param {object} partialState Next partial state to be merged with state.
24044 * @param {?function} callback Called after component is updated.
24045 * @param {?string} Name of the calling function in the public API.
24046 * @internal
24047 */
24048 enqueueSetState: function (publicInstance, partialState, callback, callerName) {
24049 warnNoop(publicInstance, 'setState');
24050 }
24051};
24052
24053var emptyObject = {};
24054{
24055 Object.freeze(emptyObject);
24056}
24057
24058/**
24059 * Base class helpers for the updating state of a component.
24060 */
24061function Component(props, context, updater) {
24062 this.props = props;
24063 this.context = context;
24064 // If a component has string refs, we will assign a different object later.
24065 this.refs = emptyObject;
24066 // We initialize the default updater but the real one gets injected by the
24067 // renderer.
24068 this.updater = updater || ReactNoopUpdateQueue;
24069}
24070
24071Component.prototype.isReactComponent = {};
24072
24073/**
24074 * Sets a subset of the state. Always use this to mutate
24075 * state. You should treat `this.state` as immutable.
24076 *
24077 * There is no guarantee that `this.state` will be immediately updated, so
24078 * accessing `this.state` after calling this method may return the old value.
24079 *
24080 * There is no guarantee that calls to `setState` will run synchronously,
24081 * as they may eventually be batched together. You can provide an optional
24082 * callback that will be executed when the call to setState is actually
24083 * completed.
24084 *
24085 * When a function is provided to setState, it will be called at some point in
24086 * the future (not synchronously). It will be called with the up to date
24087 * component arguments (state, props, context). These values can be different
24088 * from this.* because your function may be called after receiveProps but before
24089 * shouldComponentUpdate, and this new state, props, and context will not yet be
24090 * assigned to this.
24091 *
24092 * @param {object|function} partialState Next partial state or function to
24093 * produce next partial state to be merged with current state.
24094 * @param {?function} callback Called after state is updated.
24095 * @final
24096 * @protected
24097 */
24098Component.prototype.setState = function (partialState, callback) {
24099 !(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;
24100 this.updater.enqueueSetState(this, partialState, callback, 'setState');
24101};
24102
24103/**
24104 * Forces an update. This should only be invoked when it is known with
24105 * certainty that we are **not** in a DOM transaction.
24106 *
24107 * You may want to call this when you know that some deeper aspect of the
24108 * component's state has changed but `setState` was not called.
24109 *
24110 * This will not invoke `shouldComponentUpdate`, but it will invoke
24111 * `componentWillUpdate` and `componentDidUpdate`.
24112 *
24113 * @param {?function} callback Called after update is complete.
24114 * @final
24115 * @protected
24116 */
24117Component.prototype.forceUpdate = function (callback) {
24118 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
24119};
24120
24121/**
24122 * Deprecated APIs. These APIs used to exist on classic React classes but since
24123 * we would like to deprecate them, we're not going to move them over to this
24124 * modern base class. Instead, we define a getter that warns if it's accessed.
24125 */
24126{
24127 var deprecatedAPIs = {
24128 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
24129 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
24130 };
24131 var defineDeprecationWarning = function (methodName, info) {
24132 Object.defineProperty(Component.prototype, methodName, {
24133 get: function () {
24134 lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
24135 return undefined;
24136 }
24137 });
24138 };
24139 for (var fnName in deprecatedAPIs) {
24140 if (deprecatedAPIs.hasOwnProperty(fnName)) {
24141 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
24142 }
24143 }
24144}
24145
24146function ComponentDummy() {}
24147ComponentDummy.prototype = Component.prototype;
24148
24149/**
24150 * Convenience component with default shallow equality check for sCU.
24151 */
24152function PureComponent(props, context, updater) {
24153 this.props = props;
24154 this.context = context;
24155 // If a component has string refs, we will assign a different object later.
24156 this.refs = emptyObject;
24157 this.updater = updater || ReactNoopUpdateQueue;
24158}
24159
24160var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
24161pureComponentPrototype.constructor = PureComponent;
24162// Avoid an extra prototype jump for these methods.
24163_assign(pureComponentPrototype, Component.prototype);
24164pureComponentPrototype.isPureReactComponent = true;
24165
24166// an immutable object with a single mutable value
24167function createRef() {
24168 var refObject = {
24169 current: null
24170 };
24171 {
24172 Object.seal(refObject);
24173 }
24174 return refObject;
24175}
24176
24177/**
24178 * Keeps track of the current owner.
24179 *
24180 * The current owner is the component who should own any components that are
24181 * currently being constructed.
24182 */
24183var ReactCurrentOwner = {
24184 /**
24185 * @internal
24186 * @type {ReactComponent}
24187 */
24188 current: null,
24189 currentDispatcher: null
24190};
24191
24192var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
24193
24194var describeComponentFrame = function (name, source, ownerName) {
24195 var sourceInfo = '';
24196 if (source) {
24197 var path = source.fileName;
24198 var fileName = path.replace(BEFORE_SLASH_RE, '');
24199 {
24200 // In DEV, include code for a common special case:
24201 // prefer "folder/index.js" instead of just "index.js".
24202 if (/^index\./.test(fileName)) {
24203 var match = path.match(BEFORE_SLASH_RE);
24204 if (match) {
24205 var pathBeforeSlash = match[1];
24206 if (pathBeforeSlash) {
24207 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
24208 fileName = folderName + '/' + fileName;
24209 }
24210 }
24211 }
24212 }
24213 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
24214 } else if (ownerName) {
24215 sourceInfo = ' (created by ' + ownerName + ')';
24216 }
24217 return '\n in ' + (name || 'Unknown') + sourceInfo;
24218};
24219
24220var Resolved = 1;
24221
24222
24223function refineResolvedLazyComponent(lazyComponent) {
24224 return lazyComponent._status === Resolved ? lazyComponent._result : null;
24225}
24226
24227function getWrappedName(outerType, innerType, wrapperName) {
24228 var functionName = innerType.displayName || innerType.name || '';
24229 return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
24230}
24231
24232function getComponentName(type) {
24233 if (type == null) {
24234 // Host root, text node or just invalid type.
24235 return null;
24236 }
24237 {
24238 if (typeof type.tag === 'number') {
24239 warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
24240 }
24241 }
24242 if (typeof type === 'function') {
24243 return type.displayName || type.name || null;
24244 }
24245 if (typeof type === 'string') {
24246 return type;
24247 }
24248 switch (type) {
24249 case REACT_CONCURRENT_MODE_TYPE:
24250 return 'ConcurrentMode';
24251 case REACT_FRAGMENT_TYPE:
24252 return 'Fragment';
24253 case REACT_PORTAL_TYPE:
24254 return 'Portal';
24255 case REACT_PROFILER_TYPE:
24256 return 'Profiler';
24257 case REACT_STRICT_MODE_TYPE:
24258 return 'StrictMode';
24259 case REACT_SUSPENSE_TYPE:
24260 return 'Suspense';
24261 }
24262 if (typeof type === 'object') {
24263 switch (type.$$typeof) {
24264 case REACT_CONTEXT_TYPE:
24265 return 'Context.Consumer';
24266 case REACT_PROVIDER_TYPE:
24267 return 'Context.Provider';
24268 case REACT_FORWARD_REF_TYPE:
24269 return getWrappedName(type, type.render, 'ForwardRef');
24270 case REACT_MEMO_TYPE:
24271 return getComponentName(type.type);
24272 case REACT_LAZY_TYPE:
24273 {
24274 var thenable = type;
24275 var resolvedThenable = refineResolvedLazyComponent(thenable);
24276 if (resolvedThenable) {
24277 return getComponentName(resolvedThenable);
24278 }
24279 }
24280 }
24281 }
24282 return null;
24283}
24284
24285var ReactDebugCurrentFrame = {};
24286
24287var currentlyValidatingElement = null;
24288
24289function setCurrentlyValidatingElement(element) {
24290 {
24291 currentlyValidatingElement = element;
24292 }
24293}
24294
24295{
24296 // Stack implementation injected by the current renderer.
24297 ReactDebugCurrentFrame.getCurrentStack = null;
24298
24299 ReactDebugCurrentFrame.getStackAddendum = function () {
24300 var stack = '';
24301
24302 // Add an extra top frame while an element is being validated
24303 if (currentlyValidatingElement) {
24304 var name = getComponentName(currentlyValidatingElement.type);
24305 var owner = currentlyValidatingElement._owner;
24306 stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
24307 }
24308
24309 // Delegate to the injected renderer-specific implementation
24310 var impl = ReactDebugCurrentFrame.getCurrentStack;
24311 if (impl) {
24312 stack += impl() || '';
24313 }
24314
24315 return stack;
24316 };
24317}
24318
24319var ReactSharedInternals = {
24320 ReactCurrentOwner: ReactCurrentOwner,
24321 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
24322 assign: _assign
24323};
24324
24325{
24326 _assign(ReactSharedInternals, {
24327 // These should not be included in production.
24328 ReactDebugCurrentFrame: ReactDebugCurrentFrame,
24329 // Shim for React DOM 16.0.0 which still destructured (but not used) this.
24330 // TODO: remove in React 17.0.
24331 ReactComponentTreeHook: {}
24332 });
24333}
24334
24335/**
24336 * Similar to invariant but only logs a warning if the condition is not met.
24337 * This can be used to log issues in development environments in critical
24338 * paths. Removing the logging code for production environments will keep the
24339 * same logic and follow the same code paths.
24340 */
24341
24342var warning = warningWithoutStack$1;
24343
24344{
24345 warning = function (condition, format) {
24346 if (condition) {
24347 return;
24348 }
24349 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
24350 var stack = ReactDebugCurrentFrame.getStackAddendum();
24351 // eslint-disable-next-line react-internal/warning-and-invariant-args
24352
24353 for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
24354 args[_key - 2] = arguments[_key];
24355 }
24356
24357 warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
24358 };
24359}
24360
24361var warning$1 = warning;
24362
24363var hasOwnProperty = Object.prototype.hasOwnProperty;
24364
24365var RESERVED_PROPS = {
24366 key: true,
24367 ref: true,
24368 __self: true,
24369 __source: true
24370};
24371
24372var specialPropKeyWarningShown = void 0;
24373var specialPropRefWarningShown = void 0;
24374
24375function hasValidRef(config) {
24376 {
24377 if (hasOwnProperty.call(config, 'ref')) {
24378 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
24379 if (getter && getter.isReactWarning) {
24380 return false;
24381 }
24382 }
24383 }
24384 return config.ref !== undefined;
24385}
24386
24387function hasValidKey(config) {
24388 {
24389 if (hasOwnProperty.call(config, 'key')) {
24390 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
24391 if (getter && getter.isReactWarning) {
24392 return false;
24393 }
24394 }
24395 }
24396 return config.key !== undefined;
24397}
24398
24399function defineKeyPropWarningGetter(props, displayName) {
24400 var warnAboutAccessingKey = function () {
24401 if (!specialPropKeyWarningShown) {
24402 specialPropKeyWarningShown = true;
24403 warningWithoutStack$1(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);
24404 }
24405 };
24406 warnAboutAccessingKey.isReactWarning = true;
24407 Object.defineProperty(props, 'key', {
24408 get: warnAboutAccessingKey,
24409 configurable: true
24410 });
24411}
24412
24413function defineRefPropWarningGetter(props, displayName) {
24414 var warnAboutAccessingRef = function () {
24415 if (!specialPropRefWarningShown) {
24416 specialPropRefWarningShown = true;
24417 warningWithoutStack$1(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);
24418 }
24419 };
24420 warnAboutAccessingRef.isReactWarning = true;
24421 Object.defineProperty(props, 'ref', {
24422 get: warnAboutAccessingRef,
24423 configurable: true
24424 });
24425}
24426
24427/**
24428 * Factory method to create a new React element. This no longer adheres to
24429 * the class pattern, so do not use new to call it. Also, no instanceof check
24430 * will work. Instead test $$typeof field against Symbol.for('react.element') to check
24431 * if something is a React Element.
24432 *
24433 * @param {*} type
24434 * @param {*} key
24435 * @param {string|object} ref
24436 * @param {*} self A *temporary* helper to detect places where `this` is
24437 * different from the `owner` when React.createElement is called, so that we
24438 * can warn. We want to get rid of owner and replace string `ref`s with arrow
24439 * functions, and as long as `this` and owner are the same, there will be no
24440 * change in behavior.
24441 * @param {*} source An annotation object (added by a transpiler or otherwise)
24442 * indicating filename, line number, and/or other information.
24443 * @param {*} owner
24444 * @param {*} props
24445 * @internal
24446 */
24447var ReactElement = function (type, key, ref, self, source, owner, props) {
24448 var element = {
24449 // This tag allows us to uniquely identify this as a React Element
24450 $$typeof: REACT_ELEMENT_TYPE,
24451
24452 // Built-in properties that belong on the element
24453 type: type,
24454 key: key,
24455 ref: ref,
24456 props: props,
24457
24458 // Record the component responsible for creating this element.
24459 _owner: owner
24460 };
24461
24462 {
24463 // The validation flag is currently mutative. We put it on
24464 // an external backing store so that we can freeze the whole object.
24465 // This can be replaced with a WeakMap once they are implemented in
24466 // commonly used development environments.
24467 element._store = {};
24468
24469 // To make comparing ReactElements easier for testing purposes, we make
24470 // the validation flag non-enumerable (where possible, which should
24471 // include every environment we run tests in), so the test framework
24472 // ignores it.
24473 Object.defineProperty(element._store, 'validated', {
24474 configurable: false,
24475 enumerable: false,
24476 writable: true,
24477 value: false
24478 });
24479 // self and source are DEV only properties.
24480 Object.defineProperty(element, '_self', {
24481 configurable: false,
24482 enumerable: false,
24483 writable: false,
24484 value: self
24485 });
24486 // Two elements created in two different places should be considered
24487 // equal for testing purposes and therefore we hide it from enumeration.
24488 Object.defineProperty(element, '_source', {
24489 configurable: false,
24490 enumerable: false,
24491 writable: false,
24492 value: source
24493 });
24494 if (Object.freeze) {
24495 Object.freeze(element.props);
24496 Object.freeze(element);
24497 }
24498 }
24499
24500 return element;
24501};
24502
24503/**
24504 * Create and return a new ReactElement of the given type.
24505 * See https://reactjs.org/docs/react-api.html#createelement
24506 */
24507function createElement(type, config, children) {
24508 var propName = void 0;
24509
24510 // Reserved names are extracted
24511 var props = {};
24512
24513 var key = null;
24514 var ref = null;
24515 var self = null;
24516 var source = null;
24517
24518 if (config != null) {
24519 if (hasValidRef(config)) {
24520 ref = config.ref;
24521 }
24522 if (hasValidKey(config)) {
24523 key = '' + config.key;
24524 }
24525
24526 self = config.__self === undefined ? null : config.__self;
24527 source = config.__source === undefined ? null : config.__source;
24528 // Remaining properties are added to a new props object
24529 for (propName in config) {
24530 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
24531 props[propName] = config[propName];
24532 }
24533 }
24534 }
24535
24536 // Children can be more than one argument, and those are transferred onto
24537 // the newly allocated props object.
24538 var childrenLength = arguments.length - 2;
24539 if (childrenLength === 1) {
24540 props.children = children;
24541 } else if (childrenLength > 1) {
24542 var childArray = Array(childrenLength);
24543 for (var i = 0; i < childrenLength; i++) {
24544 childArray[i] = arguments[i + 2];
24545 }
24546 {
24547 if (Object.freeze) {
24548 Object.freeze(childArray);
24549 }
24550 }
24551 props.children = childArray;
24552 }
24553
24554 // Resolve default props
24555 if (type && type.defaultProps) {
24556 var defaultProps = type.defaultProps;
24557 for (propName in defaultProps) {
24558 if (props[propName] === undefined) {
24559 props[propName] = defaultProps[propName];
24560 }
24561 }
24562 }
24563 {
24564 if (key || ref) {
24565 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
24566 if (key) {
24567 defineKeyPropWarningGetter(props, displayName);
24568 }
24569 if (ref) {
24570 defineRefPropWarningGetter(props, displayName);
24571 }
24572 }
24573 }
24574 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
24575}
24576
24577/**
24578 * Return a function that produces ReactElements of a given type.
24579 * See https://reactjs.org/docs/react-api.html#createfactory
24580 */
24581
24582
24583function cloneAndReplaceKey(oldElement, newKey) {
24584 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
24585
24586 return newElement;
24587}
24588
24589/**
24590 * Clone and return a new ReactElement using element as the starting point.
24591 * See https://reactjs.org/docs/react-api.html#cloneelement
24592 */
24593function cloneElement(element, config, children) {
24594 !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
24595
24596 var propName = void 0;
24597
24598 // Original props are copied
24599 var props = _assign({}, element.props);
24600
24601 // Reserved names are extracted
24602 var key = element.key;
24603 var ref = element.ref;
24604 // Self is preserved since the owner is preserved.
24605 var self = element._self;
24606 // Source is preserved since cloneElement is unlikely to be targeted by a
24607 // transpiler, and the original source is probably a better indicator of the
24608 // true owner.
24609 var source = element._source;
24610
24611 // Owner will be preserved, unless ref is overridden
24612 var owner = element._owner;
24613
24614 if (config != null) {
24615 if (hasValidRef(config)) {
24616 // Silently steal the ref from the parent.
24617 ref = config.ref;
24618 owner = ReactCurrentOwner.current;
24619 }
24620 if (hasValidKey(config)) {
24621 key = '' + config.key;
24622 }
24623
24624 // Remaining properties override existing props
24625 var defaultProps = void 0;
24626 if (element.type && element.type.defaultProps) {
24627 defaultProps = element.type.defaultProps;
24628 }
24629 for (propName in config) {
24630 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
24631 if (config[propName] === undefined && defaultProps !== undefined) {
24632 // Resolve default props
24633 props[propName] = defaultProps[propName];
24634 } else {
24635 props[propName] = config[propName];
24636 }
24637 }
24638 }
24639 }
24640
24641 // Children can be more than one argument, and those are transferred onto
24642 // the newly allocated props object.
24643 var childrenLength = arguments.length - 2;
24644 if (childrenLength === 1) {
24645 props.children = children;
24646 } else if (childrenLength > 1) {
24647 var childArray = Array(childrenLength);
24648 for (var i = 0; i < childrenLength; i++) {
24649 childArray[i] = arguments[i + 2];
24650 }
24651 props.children = childArray;
24652 }
24653
24654 return ReactElement(element.type, key, ref, self, source, owner, props);
24655}
24656
24657/**
24658 * Verifies the object is a ReactElement.
24659 * See https://reactjs.org/docs/react-api.html#isvalidelement
24660 * @param {?object} object
24661 * @return {boolean} True if `object` is a ReactElement.
24662 * @final
24663 */
24664function isValidElement(object) {
24665 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
24666}
24667
24668var SEPARATOR = '.';
24669var SUBSEPARATOR = ':';
24670
24671/**
24672 * Escape and wrap key so it is safe to use as a reactid
24673 *
24674 * @param {string} key to be escaped.
24675 * @return {string} the escaped key.
24676 */
24677function escape(key) {
24678 var escapeRegex = /[=:]/g;
24679 var escaperLookup = {
24680 '=': '=0',
24681 ':': '=2'
24682 };
24683 var escapedString = ('' + key).replace(escapeRegex, function (match) {
24684 return escaperLookup[match];
24685 });
24686
24687 return '$' + escapedString;
24688}
24689
24690/**
24691 * TODO: Test that a single child and an array with one item have the same key
24692 * pattern.
24693 */
24694
24695var didWarnAboutMaps = false;
24696
24697var userProvidedKeyEscapeRegex = /\/+/g;
24698function escapeUserProvidedKey(text) {
24699 return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
24700}
24701
24702var POOL_SIZE = 10;
24703var traverseContextPool = [];
24704function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
24705 if (traverseContextPool.length) {
24706 var traverseContext = traverseContextPool.pop();
24707 traverseContext.result = mapResult;
24708 traverseContext.keyPrefix = keyPrefix;
24709 traverseContext.func = mapFunction;
24710 traverseContext.context = mapContext;
24711 traverseContext.count = 0;
24712 return traverseContext;
24713 } else {
24714 return {
24715 result: mapResult,
24716 keyPrefix: keyPrefix,
24717 func: mapFunction,
24718 context: mapContext,
24719 count: 0
24720 };
24721 }
24722}
24723
24724function releaseTraverseContext(traverseContext) {
24725 traverseContext.result = null;
24726 traverseContext.keyPrefix = null;
24727 traverseContext.func = null;
24728 traverseContext.context = null;
24729 traverseContext.count = 0;
24730 if (traverseContextPool.length < POOL_SIZE) {
24731 traverseContextPool.push(traverseContext);
24732 }
24733}
24734
24735/**
24736 * @param {?*} children Children tree container.
24737 * @param {!string} nameSoFar Name of the key path so far.
24738 * @param {!function} callback Callback to invoke with each child found.
24739 * @param {?*} traverseContext Used to pass information throughout the traversal
24740 * process.
24741 * @return {!number} The number of children in this subtree.
24742 */
24743function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
24744 var type = typeof children;
24745
24746 if (type === 'undefined' || type === 'boolean') {
24747 // All of the above are perceived as null.
24748 children = null;
24749 }
24750
24751 var invokeCallback = false;
24752
24753 if (children === null) {
24754 invokeCallback = true;
24755 } else {
24756 switch (type) {
24757 case 'string':
24758 case 'number':
24759 invokeCallback = true;
24760 break;
24761 case 'object':
24762 switch (children.$$typeof) {
24763 case REACT_ELEMENT_TYPE:
24764 case REACT_PORTAL_TYPE:
24765 invokeCallback = true;
24766 }
24767 }
24768 }
24769
24770 if (invokeCallback) {
24771 callback(traverseContext, children,
24772 // If it's the only child, treat the name as if it was wrapped in an array
24773 // so that it's consistent if the number of children grows.
24774 nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
24775 return 1;
24776 }
24777
24778 var child = void 0;
24779 var nextName = void 0;
24780 var subtreeCount = 0; // Count of children found in the current subtree.
24781 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
24782
24783 if (Array.isArray(children)) {
24784 for (var i = 0; i < children.length; i++) {
24785 child = children[i];
24786 nextName = nextNamePrefix + getComponentKey(child, i);
24787 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
24788 }
24789 } else {
24790 var iteratorFn = getIteratorFn(children);
24791 if (typeof iteratorFn === 'function') {
24792 {
24793 // Warn about using Maps as children
24794 if (iteratorFn === children.entries) {
24795 !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
24796 didWarnAboutMaps = true;
24797 }
24798 }
24799
24800 var iterator = iteratorFn.call(children);
24801 var step = void 0;
24802 var ii = 0;
24803 while (!(step = iterator.next()).done) {
24804 child = step.value;
24805 nextName = nextNamePrefix + getComponentKey(child, ii++);
24806 subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
24807 }
24808 } else if (type === 'object') {
24809 var addendum = '';
24810 {
24811 addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
24812 }
24813 var childrenString = '' + children;
24814 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);
24815 }
24816 }
24817
24818 return subtreeCount;
24819}
24820
24821/**
24822 * Traverses children that are typically specified as `props.children`, but
24823 * might also be specified through attributes:
24824 *
24825 * - `traverseAllChildren(this.props.children, ...)`
24826 * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
24827 *
24828 * The `traverseContext` is an optional argument that is passed through the
24829 * entire traversal. It can be used to store accumulations or anything else that
24830 * the callback might find relevant.
24831 *
24832 * @param {?*} children Children tree object.
24833 * @param {!function} callback To invoke upon traversing each child.
24834 * @param {?*} traverseContext Context for traversal.
24835 * @return {!number} The number of children in this subtree.
24836 */
24837function traverseAllChildren(children, callback, traverseContext) {
24838 if (children == null) {
24839 return 0;
24840 }
24841
24842 return traverseAllChildrenImpl(children, '', callback, traverseContext);
24843}
24844
24845/**
24846 * Generate a key string that identifies a component within a set.
24847 *
24848 * @param {*} component A component that could contain a manual key.
24849 * @param {number} index Index that is used if a manual key is not provided.
24850 * @return {string}
24851 */
24852function getComponentKey(component, index) {
24853 // Do some typechecking here since we call this blindly. We want to ensure
24854 // that we don't block potential future ES APIs.
24855 if (typeof component === 'object' && component !== null && component.key != null) {
24856 // Explicit key
24857 return escape(component.key);
24858 }
24859 // Implicit key determined by the index in the set
24860 return index.toString(36);
24861}
24862
24863function forEachSingleChild(bookKeeping, child, name) {
24864 var func = bookKeeping.func,
24865 context = bookKeeping.context;
24866
24867 func.call(context, child, bookKeeping.count++);
24868}
24869
24870/**
24871 * Iterates through children that are typically specified as `props.children`.
24872 *
24873 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
24874 *
24875 * The provided forEachFunc(child, index) will be called for each
24876 * leaf child.
24877 *
24878 * @param {?*} children Children tree container.
24879 * @param {function(*, int)} forEachFunc
24880 * @param {*} forEachContext Context for forEachContext.
24881 */
24882function forEachChildren(children, forEachFunc, forEachContext) {
24883 if (children == null) {
24884 return children;
24885 }
24886 var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
24887 traverseAllChildren(children, forEachSingleChild, traverseContext);
24888 releaseTraverseContext(traverseContext);
24889}
24890
24891function mapSingleChildIntoContext(bookKeeping, child, childKey) {
24892 var result = bookKeeping.result,
24893 keyPrefix = bookKeeping.keyPrefix,
24894 func = bookKeeping.func,
24895 context = bookKeeping.context;
24896
24897
24898 var mappedChild = func.call(context, child, bookKeeping.count++);
24899 if (Array.isArray(mappedChild)) {
24900 mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
24901 return c;
24902 });
24903 } else if (mappedChild != null) {
24904 if (isValidElement(mappedChild)) {
24905 mappedChild = cloneAndReplaceKey(mappedChild,
24906 // Keep both the (mapped) and old keys if they differ, just as
24907 // traverseAllChildren used to do for objects as children
24908 keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
24909 }
24910 result.push(mappedChild);
24911 }
24912}
24913
24914function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
24915 var escapedPrefix = '';
24916 if (prefix != null) {
24917 escapedPrefix = escapeUserProvidedKey(prefix) + '/';
24918 }
24919 var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
24920 traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
24921 releaseTraverseContext(traverseContext);
24922}
24923
24924/**
24925 * Maps children that are typically specified as `props.children`.
24926 *
24927 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
24928 *
24929 * The provided mapFunction(child, key, index) will be called for each
24930 * leaf child.
24931 *
24932 * @param {?*} children Children tree container.
24933 * @param {function(*, int)} func The map function.
24934 * @param {*} context Context for mapFunction.
24935 * @return {object} Object containing the ordered map of results.
24936 */
24937function mapChildren(children, func, context) {
24938 if (children == null) {
24939 return children;
24940 }
24941 var result = [];
24942 mapIntoWithKeyPrefixInternal(children, result, null, func, context);
24943 return result;
24944}
24945
24946/**
24947 * Count the number of children that are typically specified as
24948 * `props.children`.
24949 *
24950 * See https://reactjs.org/docs/react-api.html#reactchildrencount
24951 *
24952 * @param {?*} children Children tree container.
24953 * @return {number} The number of children.
24954 */
24955function countChildren(children) {
24956 return traverseAllChildren(children, function () {
24957 return null;
24958 }, null);
24959}
24960
24961/**
24962 * Flatten a children object (typically specified as `props.children`) and
24963 * return an array with appropriately re-keyed children.
24964 *
24965 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
24966 */
24967function toArray(children) {
24968 var result = [];
24969 mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
24970 return child;
24971 });
24972 return result;
24973}
24974
24975/**
24976 * Returns the first child in a collection of children and verifies that there
24977 * is only one child in the collection.
24978 *
24979 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
24980 *
24981 * The current implementation of this function assumes that a single child gets
24982 * passed without a wrapper, but the purpose of this helper function is to
24983 * abstract away the particular structure of children.
24984 *
24985 * @param {?object} children Child collection structure.
24986 * @return {ReactElement} The first and only `ReactElement` contained in the
24987 * structure.
24988 */
24989function onlyChild(children) {
24990 !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
24991 return children;
24992}
24993
24994function createContext(defaultValue, calculateChangedBits) {
24995 if (calculateChangedBits === undefined) {
24996 calculateChangedBits = null;
24997 } else {
24998 {
24999 !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
25000 }
25001 }
25002
25003 var context = {
25004 $$typeof: REACT_CONTEXT_TYPE,
25005 _calculateChangedBits: calculateChangedBits,
25006 // As a workaround to support multiple concurrent renderers, we categorize
25007 // some renderers as primary and others as secondary. We only expect
25008 // there to be two concurrent renderers at most: React Native (primary) and
25009 // Fabric (secondary); React DOM (primary) and React ART (secondary).
25010 // Secondary renderers store their context values on separate fields.
25011 _currentValue: defaultValue,
25012 _currentValue2: defaultValue,
25013 // Used to track how many concurrent renderers this context currently
25014 // supports within in a single renderer. Such as parallel server rendering.
25015 _threadCount: 0,
25016 // These are circular
25017 Provider: null,
25018 Consumer: null
25019 };
25020
25021 context.Provider = {
25022 $$typeof: REACT_PROVIDER_TYPE,
25023 _context: context
25024 };
25025
25026 var hasWarnedAboutUsingNestedContextConsumers = false;
25027 var hasWarnedAboutUsingConsumerProvider = false;
25028
25029 {
25030 // A separate object, but proxies back to the original context object for
25031 // backwards compatibility. It has a different $$typeof, so we can properly
25032 // warn for the incorrect usage of Context as a Consumer.
25033 var Consumer = {
25034 $$typeof: REACT_CONTEXT_TYPE,
25035 _context: context,
25036 _calculateChangedBits: context._calculateChangedBits
25037 };
25038 // $FlowFixMe: Flow complains about not setting a value, which is intentional here
25039 Object.defineProperties(Consumer, {
25040 Provider: {
25041 get: function () {
25042 if (!hasWarnedAboutUsingConsumerProvider) {
25043 hasWarnedAboutUsingConsumerProvider = true;
25044 warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
25045 }
25046 return context.Provider;
25047 },
25048 set: function (_Provider) {
25049 context.Provider = _Provider;
25050 }
25051 },
25052 _currentValue: {
25053 get: function () {
25054 return context._currentValue;
25055 },
25056 set: function (_currentValue) {
25057 context._currentValue = _currentValue;
25058 }
25059 },
25060 _currentValue2: {
25061 get: function () {
25062 return context._currentValue2;
25063 },
25064 set: function (_currentValue2) {
25065 context._currentValue2 = _currentValue2;
25066 }
25067 },
25068 _threadCount: {
25069 get: function () {
25070 return context._threadCount;
25071 },
25072 set: function (_threadCount) {
25073 context._threadCount = _threadCount;
25074 }
25075 },
25076 Consumer: {
25077 get: function () {
25078 if (!hasWarnedAboutUsingNestedContextConsumers) {
25079 hasWarnedAboutUsingNestedContextConsumers = true;
25080 warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
25081 }
25082 return context.Consumer;
25083 }
25084 }
25085 });
25086 // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
25087 context.Consumer = Consumer;
25088 }
25089
25090 {
25091 context._currentRenderer = null;
25092 context._currentRenderer2 = null;
25093 }
25094
25095 return context;
25096}
25097
25098function lazy(ctor) {
25099 var lazyType = {
25100 $$typeof: REACT_LAZY_TYPE,
25101 _ctor: ctor,
25102 // React uses these fields to store the result.
25103 _status: -1,
25104 _result: null
25105 };
25106
25107 {
25108 // In production, this would just set it on the object.
25109 var defaultProps = void 0;
25110 var propTypes = void 0;
25111 Object.defineProperties(lazyType, {
25112 defaultProps: {
25113 configurable: true,
25114 get: function () {
25115 return defaultProps;
25116 },
25117 set: function (newDefaultProps) {
25118 warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
25119 defaultProps = newDefaultProps;
25120 // Match production behavior more closely:
25121 Object.defineProperty(lazyType, 'defaultProps', {
25122 enumerable: true
25123 });
25124 }
25125 },
25126 propTypes: {
25127 configurable: true,
25128 get: function () {
25129 return propTypes;
25130 },
25131 set: function (newPropTypes) {
25132 warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
25133 propTypes = newPropTypes;
25134 // Match production behavior more closely:
25135 Object.defineProperty(lazyType, 'propTypes', {
25136 enumerable: true
25137 });
25138 }
25139 }
25140 });
25141 }
25142
25143 return lazyType;
25144}
25145
25146function forwardRef(render) {
25147 {
25148 if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
25149 warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
25150 } else if (typeof render !== 'function') {
25151 warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
25152 } else {
25153 !(
25154 // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
25155 render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.') : void 0;
25156 }
25157
25158 if (render != null) {
25159 !(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
25160 }
25161 }
25162
25163 return {
25164 $$typeof: REACT_FORWARD_REF_TYPE,
25165 render: render
25166 };
25167}
25168
25169function isValidElementType(type) {
25170 return typeof type === 'string' || typeof type === 'function' ||
25171 // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
25172 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
25173}
25174
25175function memo(type, compare) {
25176 {
25177 if (!isValidElementType(type)) {
25178 warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
25179 }
25180 }
25181 return {
25182 $$typeof: REACT_MEMO_TYPE,
25183 type: type,
25184 compare: compare === undefined ? null : compare
25185 };
25186}
25187
25188function resolveDispatcher() {
25189 var dispatcher = ReactCurrentOwner.currentDispatcher;
25190 !(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
25191 return dispatcher;
25192}
25193
25194function useContext(Context, observedBits) {
25195 var dispatcher = resolveDispatcher();
25196 {
25197 // TODO: add a more generic warning for invalid values.
25198 if (Context._context !== undefined) {
25199 var realContext = Context._context;
25200 // Don't deduplicate because this legitimately causes bugs
25201 // and nobody should be using this in existing code.
25202 if (realContext.Consumer === Context) {
25203 warning$1(false, 'Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
25204 } else if (realContext.Provider === Context) {
25205 warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
25206 }
25207 }
25208 }
25209 return dispatcher.useContext(Context, observedBits);
25210}
25211
25212function useState(initialState) {
25213 var dispatcher = resolveDispatcher();
25214 return dispatcher.useState(initialState);
25215}
25216
25217function useReducer(reducer, initialState, initialAction) {
25218 var dispatcher = resolveDispatcher();
25219 return dispatcher.useReducer(reducer, initialState, initialAction);
25220}
25221
25222function useRef(initialValue) {
25223 var dispatcher = resolveDispatcher();
25224 return dispatcher.useRef(initialValue);
25225}
25226
25227function useEffect(create, inputs) {
25228 var dispatcher = resolveDispatcher();
25229 return dispatcher.useEffect(create, inputs);
25230}
25231
25232function useLayoutEffect(create, inputs) {
25233 var dispatcher = resolveDispatcher();
25234 return dispatcher.useLayoutEffect(create, inputs);
25235}
25236
25237function useCallback(callback, inputs) {
25238 var dispatcher = resolveDispatcher();
25239 return dispatcher.useCallback(callback, inputs);
25240}
25241
25242function useMemo(create, inputs) {
25243 var dispatcher = resolveDispatcher();
25244 return dispatcher.useMemo(create, inputs);
25245}
25246
25247function useImperativeMethods(ref, create, inputs) {
25248 var dispatcher = resolveDispatcher();
25249 return dispatcher.useImperativeMethods(ref, create, inputs);
25250}
25251
25252/**
25253 * ReactElementValidator provides a wrapper around a element factory
25254 * which validates the props passed to the element. This is intended to be
25255 * used only in DEV and could be replaced by a static type checker for languages
25256 * that support it.
25257 */
25258
25259var propTypesMisspellWarningShown = void 0;
25260
25261{
25262 propTypesMisspellWarningShown = false;
25263}
25264
25265function getDeclarationErrorAddendum() {
25266 if (ReactCurrentOwner.current) {
25267 var name = getComponentName(ReactCurrentOwner.current.type);
25268 if (name) {
25269 return '\n\nCheck the render method of `' + name + '`.';
25270 }
25271 }
25272 return '';
25273}
25274
25275function getSourceInfoErrorAddendum(elementProps) {
25276 if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
25277 var source = elementProps.__source;
25278 var fileName = source.fileName.replace(/^.*[\\\/]/, '');
25279 var lineNumber = source.lineNumber;
25280 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
25281 }
25282 return '';
25283}
25284
25285/**
25286 * Warn if there's no key explicitly set on dynamic arrays of children or
25287 * object keys are not valid. This allows us to keep track of children between
25288 * updates.
25289 */
25290var ownerHasKeyUseWarning = {};
25291
25292function getCurrentComponentErrorInfo(parentType) {
25293 var info = getDeclarationErrorAddendum();
25294
25295 if (!info) {
25296 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
25297 if (parentName) {
25298 info = '\n\nCheck the top-level render call using <' + parentName + '>.';
25299 }
25300 }
25301 return info;
25302}
25303
25304/**
25305 * Warn if the element doesn't have an explicit key assigned to it.
25306 * This element is in an array. The array could grow and shrink or be
25307 * reordered. All children that haven't already been validated are required to
25308 * have a "key" property assigned to it. Error statuses are cached so a warning
25309 * will only be shown once.
25310 *
25311 * @internal
25312 * @param {ReactElement} element Element that requires a key.
25313 * @param {*} parentType element's parent's type.
25314 */
25315function validateExplicitKey(element, parentType) {
25316 if (!element._store || element._store.validated || element.key != null) {
25317 return;
25318 }
25319 element._store.validated = true;
25320
25321 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
25322 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
25323 return;
25324 }
25325 ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
25326
25327 // Usually the current owner is the offender, but if it accepts children as a
25328 // property, it may be the creator of the child that's responsible for
25329 // assigning it a key.
25330 var childOwner = '';
25331 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
25332 // Give the component that originally created this child.
25333 childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
25334 }
25335
25336 setCurrentlyValidatingElement(element);
25337 {
25338 warning$1(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.', currentComponentErrorInfo, childOwner);
25339 }
25340 setCurrentlyValidatingElement(null);
25341}
25342
25343/**
25344 * Ensure that every element either is passed in a static location, in an
25345 * array with an explicit keys property defined, or in an object literal
25346 * with valid key property.
25347 *
25348 * @internal
25349 * @param {ReactNode} node Statically passed child of any type.
25350 * @param {*} parentType node's parent's type.
25351 */
25352function validateChildKeys(node, parentType) {
25353 if (typeof node !== 'object') {
25354 return;
25355 }
25356 if (Array.isArray(node)) {
25357 for (var i = 0; i < node.length; i++) {
25358 var child = node[i];
25359 if (isValidElement(child)) {
25360 validateExplicitKey(child, parentType);
25361 }
25362 }
25363 } else if (isValidElement(node)) {
25364 // This element was passed in a valid location.
25365 if (node._store) {
25366 node._store.validated = true;
25367 }
25368 } else if (node) {
25369 var iteratorFn = getIteratorFn(node);
25370 if (typeof iteratorFn === 'function') {
25371 // Entry iterators used to provide implicit keys,
25372 // but now we print a separate warning for them later.
25373 if (iteratorFn !== node.entries) {
25374 var iterator = iteratorFn.call(node);
25375 var step = void 0;
25376 while (!(step = iterator.next()).done) {
25377 if (isValidElement(step.value)) {
25378 validateExplicitKey(step.value, parentType);
25379 }
25380 }
25381 }
25382 }
25383 }
25384}
25385
25386/**
25387 * Given an element, validate that its props follow the propTypes definition,
25388 * provided by the type.
25389 *
25390 * @param {ReactElement} element
25391 */
25392function validatePropTypes(element) {
25393 var type = element.type;
25394 if (type === null || type === undefined || typeof type === 'string') {
25395 return;
25396 }
25397 var name = getComponentName(type);
25398 var propTypes = void 0;
25399 if (typeof type === 'function') {
25400 propTypes = type.propTypes;
25401 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
25402 // Note: Memo only checks outer props here.
25403 // Inner props are checked in the reconciler.
25404 type.$$typeof === REACT_MEMO_TYPE)) {
25405 propTypes = type.propTypes;
25406 } else {
25407 return;
25408 }
25409 if (propTypes) {
25410 setCurrentlyValidatingElement(element);
25411 checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
25412 setCurrentlyValidatingElement(null);
25413 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
25414 propTypesMisspellWarningShown = true;
25415 warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
25416 }
25417 if (typeof type.getDefaultProps === 'function') {
25418 !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
25419 }
25420}
25421
25422/**
25423 * Given a fragment, validate that it can only be provided with fragment props
25424 * @param {ReactElement} fragment
25425 */
25426function validateFragmentProps(fragment) {
25427 setCurrentlyValidatingElement(fragment);
25428
25429 var keys = Object.keys(fragment.props);
25430 for (var i = 0; i < keys.length; i++) {
25431 var key = keys[i];
25432 if (key !== 'children' && key !== 'key') {
25433 warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
25434 break;
25435 }
25436 }
25437
25438 if (fragment.ref !== null) {
25439 warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
25440 }
25441
25442 setCurrentlyValidatingElement(null);
25443}
25444
25445function createElementWithValidation(type, props, children) {
25446 var validType = isValidElementType(type);
25447
25448 // We warn in this case but don't throw. We expect the element creation to
25449 // succeed and there will likely be errors in render.
25450 if (!validType) {
25451 var info = '';
25452 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
25453 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.";
25454 }
25455
25456 var sourceInfo = getSourceInfoErrorAddendum(props);
25457 if (sourceInfo) {
25458 info += sourceInfo;
25459 } else {
25460 info += getDeclarationErrorAddendum();
25461 }
25462
25463 var typeString = void 0;
25464 if (type === null) {
25465 typeString = 'null';
25466 } else if (Array.isArray(type)) {
25467 typeString = 'array';
25468 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
25469 typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
25470 info = ' Did you accidentally export a JSX literal instead of a component?';
25471 } else {
25472 typeString = typeof type;
25473 }
25474
25475 warning$1(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);
25476 }
25477
25478 var element = createElement.apply(this, arguments);
25479
25480 // The result can be nullish if a mock or a custom function is used.
25481 // TODO: Drop this when these are no longer allowed as the type argument.
25482 if (element == null) {
25483 return element;
25484 }
25485
25486 // Skip key warning if the type isn't valid since our key validation logic
25487 // doesn't expect a non-string/function type and can throw confusing errors.
25488 // We don't want exception behavior to differ between dev and prod.
25489 // (Rendering will throw with a helpful message and as soon as the type is
25490 // fixed, the key warnings will appear.)
25491 if (validType) {
25492 for (var i = 2; i < arguments.length; i++) {
25493 validateChildKeys(arguments[i], type);
25494 }
25495 }
25496
25497 if (type === REACT_FRAGMENT_TYPE) {
25498 validateFragmentProps(element);
25499 } else {
25500 validatePropTypes(element);
25501 }
25502
25503 return element;
25504}
25505
25506function createFactoryWithValidation(type) {
25507 var validatedFactory = createElementWithValidation.bind(null, type);
25508 validatedFactory.type = type;
25509 // Legacy hook: remove it
25510 {
25511 Object.defineProperty(validatedFactory, 'type', {
25512 enumerable: false,
25513 get: function () {
25514 lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
25515 Object.defineProperty(this, 'type', {
25516 value: type
25517 });
25518 return type;
25519 }
25520 });
25521 }
25522
25523 return validatedFactory;
25524}
25525
25526function cloneElementWithValidation(element, props, children) {
25527 var newElement = cloneElement.apply(this, arguments);
25528 for (var i = 2; i < arguments.length; i++) {
25529 validateChildKeys(arguments[i], newElement.type);
25530 }
25531 validatePropTypes(newElement);
25532 return newElement;
25533}
25534
25535var React = {
25536 Children: {
25537 map: mapChildren,
25538 forEach: forEachChildren,
25539 count: countChildren,
25540 toArray: toArray,
25541 only: onlyChild
25542 },
25543
25544 createRef: createRef,
25545 Component: Component,
25546 PureComponent: PureComponent,
25547
25548 createContext: createContext,
25549 forwardRef: forwardRef,
25550 lazy: lazy,
25551 memo: memo,
25552
25553 Fragment: REACT_FRAGMENT_TYPE,
25554 StrictMode: REACT_STRICT_MODE_TYPE,
25555 Suspense: REACT_SUSPENSE_TYPE,
25556
25557 createElement: createElementWithValidation,
25558 cloneElement: cloneElementWithValidation,
25559 createFactory: createFactoryWithValidation,
25560 isValidElement: isValidElement,
25561
25562 version: ReactVersion,
25563
25564 unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
25565 unstable_Profiler: REACT_PROFILER_TYPE,
25566
25567 __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
25568};
25569
25570// Note: some APIs are added with feature flags.
25571// Make sure that stable builds for open source
25572// don't modify the React object to avoid deopts.
25573// Also let's not expose their names in stable builds.
25574
25575if (enableStableConcurrentModeAPIs) {
25576 React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
25577 React.Profiler = REACT_PROFILER_TYPE;
25578 React.unstable_ConcurrentMode = undefined;
25579 React.unstable_Profiler = undefined;
25580}
25581
25582if (enableHooks) {
25583 React.useCallback = useCallback;
25584 React.useContext = useContext;
25585 React.useEffect = useEffect;
25586 React.useImperativeMethods = useImperativeMethods;
25587 React.useLayoutEffect = useLayoutEffect;
25588 React.useMemo = useMemo;
25589 React.useReducer = useReducer;
25590 React.useRef = useRef;
25591 React.useState = useState;
25592}
25593
25594
25595
25596var React$2 = Object.freeze({
25597 default: React
25598});
25599
25600var React$3 = ( React$2 && React ) || React$2;
25601
25602// TODO: decide on the top-level export form.
25603// This is hacky but makes it work with both Rollup and Jest.
25604var react = React$3.default || React$3;
25605
25606module.exports = react;
25607 })();
25608}
25609
25610},{"object-assign":23,"prop-types/checkPropTypes":25}],51:[function(require,module,exports){
25611/** @license React v16.7.0
25612 * react.production.min.js
25613 *
25614 * Copyright (c) Facebook, Inc. and its affiliates.
25615 *
25616 * This source code is licensed under the MIT license found in the
25617 * LICENSE file in the root directory of this source tree.
25618 */
25619
25620'use strict';var k=require("object-assign"),n="function"===typeof Symbol&&Symbol.for,p=n?Symbol.for("react.element"):60103,q=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,t=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,v=n?Symbol.for("react.provider"):60109,w=n?Symbol.for("react.context"):60110,x=n?Symbol.for("react.concurrent_mode"):60111,y=n?Symbol.for("react.forward_ref"):60112,z=n?Symbol.for("react.suspense"):60113,A=n?Symbol.for("react.memo"):
2562160115,B=n?Symbol.for("react.lazy"):60116,C="function"===typeof Symbol&&Symbol.iterator;function aa(a,b,e,c,d,g,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[e,c,d,g,h,f],m=0;a=Error(b.replace(/%s/g,function(){return l[m++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
25622function D(a){for(var b=arguments.length-1,e="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)e+="&args[]="+encodeURIComponent(arguments[c+1]);aa(!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 E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F={};
25623function G(a,b,e){this.props=a;this.context=b;this.refs=F;this.updater=e||E}G.prototype.isReactComponent={};G.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?D("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};G.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function H(){}H.prototype=G.prototype;function I(a,b,e){this.props=a;this.context=b;this.refs=F;this.updater=e||E}var J=I.prototype=new H;
25624J.constructor=I;k(J,G.prototype);J.isPureReactComponent=!0;var K={current:null,currentDispatcher:null},L=Object.prototype.hasOwnProperty,M={key:!0,ref:!0,__self:!0,__source:!0};
25625function N(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)L.call(b,c)&&!M.hasOwnProperty(c)&&(d[c]=b[c]);var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){for(var l=Array(f),m=0;m<f;m++)l[m]=arguments[m+2];d.children=l}if(a&&a.defaultProps)for(c in f=a.defaultProps,f)void 0===d[c]&&(d[c]=f[c]);return{$$typeof:p,type:a,key:g,ref:h,props:d,_owner:K.current}}
25626function ba(a,b){return{$$typeof:p,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return"object"===typeof a&&null!==a&&a.$$typeof===p}function escape(a){var b={"=":"=0",":":"=2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var P=/\/+/g,Q=[];function R(a,b,e,c){if(Q.length){var d=Q.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}}
25627function S(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>Q.length&&Q.push(a)}
25628function T(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 p:case q:g=!0}}if(g)return e(c,a,""===b?"."+U(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+U(d,h);g+=T(d,f,e,c)}else if(null===a||"object"!==typeof a?f=null:(f=C&&a[C]||a["@@iterator"],f="function"===typeof f?f:null),"function"===typeof f)for(a=f.call(a),h=
256290;!(d=a.next()).done;)d=d.value,f=b+U(d,h++),g+=T(d,f,e,c);else"object"===d&&(e=""+a,D("31","[object Object]"===e?"object with keys {"+Object.keys(a).join(", ")+"}":e,""));return g}function V(a,b,e){return null==a?0:T(a,"",b,e)}function U(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function ca(a,b){a.func.call(a.context,b,a.count++)}
25630function da(a,b,e){var c=a.result,d=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?W(a,c,e,function(a){return a}):null!=a&&(O(a)&&(a=ba(a,d+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(P,"$&/")+"/")+e)),c.push(a))}function W(a,b,e,c,d){var g="";null!=e&&(g=(""+e).replace(P,"$&/")+"/");b=R(b,g,c,d);V(a,da,b);S(b)}
25631var X={Children:{map:function(a,b,e){if(null==a)return a;var c=[];W(a,c,null,b,e);return c},forEach:function(a,b,e){if(null==a)return a;b=R(null,null,b,e);V(a,ca,b);S(b)},count:function(a){return V(a,function(){return null},null)},toArray:function(a){var b=[];W(a,b,null,function(a){return a});return b},only:function(a){O(a)?void 0:D("143");return a}},createRef:function(){return{current:null}},Component:G,PureComponent:I,createContext:function(a,b){void 0===b&&(b=null);a={$$typeof:w,_calculateChangedBits:b,
25632_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:v,_context:a};return a.Consumer=a},forwardRef:function(a){return{$$typeof:y,render:a}},lazy:function(a){return{$$typeof:B,_ctor:a,_status:-1,_result:null}},memo:function(a,b){return{$$typeof:A,type:a,compare:void 0===b?null:b}},Fragment:r,StrictMode:t,Suspense:z,createElement:N,cloneElement:function(a,b,e){null===a||void 0===a?D("267",a):void 0;var c=void 0,d=k({},a.props),g=a.key,h=a.ref,f=a._owner;
25633if(null!=b){void 0!==b.ref&&(h=b.ref,f=K.current);void 0!==b.key&&(g=""+b.key);var l=void 0;a.type&&a.type.defaultProps&&(l=a.type.defaultProps);for(c in b)L.call(b,c)&&!M.hasOwnProperty(c)&&(d[c]=void 0===b[c]&&void 0!==l?l[c]:b[c])}c=arguments.length-2;if(1===c)d.children=e;else if(1<c){l=Array(c);for(var m=0;m<c;m++)l[m]=arguments[m+2];d.children=l}return{$$typeof:p,type:a.type,key:g,ref:h,props:d,_owner:f}},createFactory:function(a){var b=N.bind(null,a);b.type=a;return b},isValidElement:O,version:"16.7.0",
25634unstable_ConcurrentMode:x,unstable_Profiler:u,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:K,assign:k}},Y={default:X},Z=Y&&X||Y;module.exports=Z.default||Z;
25635
25636},{"object-assign":23}],52:[function(require,module,exports){
25637'use strict';
25638
25639Object.defineProperty(exports, "__esModule", {
25640 value: true
25641});
25642
25643var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
25644
25645exports.printBuffer = printBuffer;
25646
25647var _helpers = require('./helpers');
25648
25649var _diff = require('./diff');
25650
25651var _diff2 = _interopRequireDefault(_diff);
25652
25653function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25654
25655function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
25656
25657/**
25658 * Get log level string based on supplied params
25659 *
25660 * @param {string | function | object} level - console[level]
25661 * @param {object} action - selected action
25662 * @param {array} payload - selected payload
25663 * @param {string} type - log entry type
25664 *
25665 * @returns {string} level
25666 */
25667function getLogLevel(level, action, payload, type) {
25668 switch (typeof level === 'undefined' ? 'undefined' : _typeof(level)) {
25669 case 'object':
25670 return typeof level[type] === 'function' ? level[type].apply(level, _toConsumableArray(payload)) : level[type];
25671 case 'function':
25672 return level(action);
25673 default:
25674 return level;
25675 }
25676}
25677
25678function defaultTitleFormatter(options) {
25679 var timestamp = options.timestamp,
25680 duration = options.duration;
25681
25682
25683 return function (action, time, took) {
25684 var parts = ['action'];
25685
25686 parts.push('%c' + String(action.type));
25687 if (timestamp) parts.push('%c@ ' + time);
25688 if (duration) parts.push('%c(in ' + took.toFixed(2) + ' ms)');
25689
25690 return parts.join(' ');
25691 };
25692}
25693
25694function printBuffer(buffer, options) {
25695 var logger = options.logger,
25696 actionTransformer = options.actionTransformer,
25697 _options$titleFormatt = options.titleFormatter,
25698 titleFormatter = _options$titleFormatt === undefined ? defaultTitleFormatter(options) : _options$titleFormatt,
25699 collapsed = options.collapsed,
25700 colors = options.colors,
25701 level = options.level,
25702 diff = options.diff;
25703
25704
25705 buffer.forEach(function (logEntry, key) {
25706 var started = logEntry.started,
25707 startedTime = logEntry.startedTime,
25708 action = logEntry.action,
25709 prevState = logEntry.prevState,
25710 error = logEntry.error;
25711 var took = logEntry.took,
25712 nextState = logEntry.nextState;
25713
25714 var nextEntry = buffer[key + 1];
25715
25716 if (nextEntry) {
25717 nextState = nextEntry.prevState;
25718 took = nextEntry.started - started;
25719 }
25720
25721 // Message
25722 var formattedAction = actionTransformer(action);
25723 var isCollapsed = typeof collapsed === 'function' ? collapsed(function () {
25724 return nextState;
25725 }, action, logEntry) : collapsed;
25726
25727 var formattedTime = (0, _helpers.formatTime)(startedTime);
25728 var titleCSS = colors.title ? 'color: ' + colors.title(formattedAction) + ';' : '';
25729 var headerCSS = ['color: gray; font-weight: lighter;'];
25730 headerCSS.push(titleCSS);
25731 if (options.timestamp) headerCSS.push('color: gray; font-weight: lighter;');
25732 if (options.duration) headerCSS.push('color: gray; font-weight: lighter;');
25733 var title = titleFormatter(formattedAction, formattedTime, took);
25734
25735 // Render
25736 try {
25737 if (isCollapsed) {
25738 if (colors.title) logger.groupCollapsed.apply(logger, ['%c ' + title].concat(headerCSS));else logger.groupCollapsed(title);
25739 } else {
25740 if (colors.title) logger.group.apply(logger, ['%c ' + title].concat(headerCSS));else logger.group(title);
25741 }
25742 } catch (e) {
25743 logger.log(title);
25744 }
25745
25746 var prevStateLevel = getLogLevel(level, formattedAction, [prevState], 'prevState');
25747 var actionLevel = getLogLevel(level, formattedAction, [formattedAction], 'action');
25748 var errorLevel = getLogLevel(level, formattedAction, [error, prevState], 'error');
25749 var nextStateLevel = getLogLevel(level, formattedAction, [nextState], 'nextState');
25750
25751 if (prevStateLevel) {
25752 if (colors.prevState) logger[prevStateLevel]('%c prev state', 'color: ' + colors.prevState(prevState) + '; font-weight: bold', prevState);else logger[prevStateLevel]('prev state', prevState);
25753 }
25754
25755 if (actionLevel) {
25756 if (colors.action) logger[actionLevel]('%c action ', 'color: ' + colors.action(formattedAction) + '; font-weight: bold', formattedAction);else logger[actionLevel]('action ', formattedAction);
25757 }
25758
25759 if (error && errorLevel) {
25760 if (colors.error) logger[errorLevel]('%c error ', 'color: ' + colors.error(error, prevState) + '; font-weight: bold;', error);else logger[errorLevel]('error ', error);
25761 }
25762
25763 if (nextStateLevel) {
25764 if (colors.nextState) logger[nextStateLevel]('%c next state', 'color: ' + colors.nextState(nextState) + '; font-weight: bold', nextState);else logger[nextStateLevel]('next state', nextState);
25765 }
25766
25767 if (diff) {
25768 (0, _diff2.default)(prevState, nextState, logger, isCollapsed);
25769 }
25770
25771 try {
25772 logger.groupEnd();
25773 } catch (e) {
25774 logger.log('\u2014\u2014 log end \u2014\u2014');
25775 }
25776 });
25777}
25778},{"./diff":54,"./helpers":55}],53:[function(require,module,exports){
25779"use strict";
25780
25781Object.defineProperty(exports, "__esModule", {
25782 value: true
25783});
25784exports.default = {
25785 level: "log",
25786 logger: console,
25787 logErrors: true,
25788 collapsed: undefined,
25789 predicate: undefined,
25790 duration: false,
25791 timestamp: true,
25792 stateTransformer: function stateTransformer(state) {
25793 return state;
25794 },
25795 actionTransformer: function actionTransformer(action) {
25796 return action;
25797 },
25798 errorTransformer: function errorTransformer(error) {
25799 return error;
25800 },
25801 colors: {
25802 title: function title() {
25803 return "inherit";
25804 },
25805 prevState: function prevState() {
25806 return "#9E9E9E";
25807 },
25808 action: function action() {
25809 return "#03A9F4";
25810 },
25811 nextState: function nextState() {
25812 return "#4CAF50";
25813 },
25814 error: function error() {
25815 return "#F20404";
25816 }
25817 },
25818 diff: false,
25819 diffPredicate: undefined,
25820
25821 // Deprecated options
25822 transformer: undefined
25823};
25824module.exports = exports["default"];
25825},{}],54:[function(require,module,exports){
25826'use strict';
25827
25828Object.defineProperty(exports, "__esModule", {
25829 value: true
25830});
25831exports.default = diffLogger;
25832
25833var _deepDiff = require('deep-diff');
25834
25835var _deepDiff2 = _interopRequireDefault(_deepDiff);
25836
25837function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25838
25839function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
25840
25841// https://github.com/flitbit/diff#differences
25842var dictionary = {
25843 'E': {
25844 color: '#2196F3',
25845 text: 'CHANGED:'
25846 },
25847 'N': {
25848 color: '#4CAF50',
25849 text: 'ADDED:'
25850 },
25851 'D': {
25852 color: '#F44336',
25853 text: 'DELETED:'
25854 },
25855 'A': {
25856 color: '#2196F3',
25857 text: 'ARRAY:'
25858 }
25859};
25860
25861function style(kind) {
25862 return 'color: ' + dictionary[kind].color + '; font-weight: bold';
25863}
25864
25865function render(diff) {
25866 var kind = diff.kind,
25867 path = diff.path,
25868 lhs = diff.lhs,
25869 rhs = diff.rhs,
25870 index = diff.index,
25871 item = diff.item;
25872
25873
25874 switch (kind) {
25875 case 'E':
25876 return [path.join('.'), lhs, '\u2192', rhs];
25877 case 'N':
25878 return [path.join('.'), rhs];
25879 case 'D':
25880 return [path.join('.')];
25881 case 'A':
25882 return [path.join('.') + '[' + index + ']', item];
25883 default:
25884 return [];
25885 }
25886}
25887
25888function diffLogger(prevState, newState, logger, isCollapsed) {
25889 var diff = (0, _deepDiff2.default)(prevState, newState);
25890
25891 try {
25892 if (isCollapsed) {
25893 logger.groupCollapsed('diff');
25894 } else {
25895 logger.group('diff');
25896 }
25897 } catch (e) {
25898 logger.log('diff');
25899 }
25900
25901 if (diff) {
25902 diff.forEach(function (elem) {
25903 var kind = elem.kind;
25904
25905 var output = render(elem);
25906
25907 logger.log.apply(logger, ['%c ' + dictionary[kind].text, style(kind)].concat(_toConsumableArray(output)));
25908 });
25909 } else {
25910 logger.log('\u2014\u2014 no diff \u2014\u2014');
25911 }
25912
25913 try {
25914 logger.groupEnd();
25915 } catch (e) {
25916 logger.log('\u2014\u2014 diff end \u2014\u2014 ');
25917 }
25918}
25919module.exports = exports['default'];
25920},{"deep-diff":8}],55:[function(require,module,exports){
25921"use strict";
25922
25923Object.defineProperty(exports, "__esModule", {
25924 value: true
25925});
25926var repeat = exports.repeat = function repeat(str, times) {
25927 return new Array(times + 1).join(str);
25928};
25929
25930var pad = exports.pad = function pad(num, maxLength) {
25931 return repeat("0", maxLength - num.toString().length) + num;
25932};
25933
25934var formatTime = exports.formatTime = function formatTime(time) {
25935 return pad(time.getHours(), 2) + ":" + pad(time.getMinutes(), 2) + ":" + pad(time.getSeconds(), 2) + "." + pad(time.getMilliseconds(), 3);
25936};
25937
25938// Use performance API if it's available in order to get better precision
25939var timer = exports.timer = typeof performance !== "undefined" && performance !== null && typeof performance.now === "function" ? performance : Date;
25940},{}],56:[function(require,module,exports){
25941'use strict';
25942
25943Object.defineProperty(exports, "__esModule", {
25944 value: true
25945});
25946exports.logger = exports.defaults = undefined;
25947
25948var _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; };
25949
25950var _core = require('./core');
25951
25952var _helpers = require('./helpers');
25953
25954var _defaults = require('./defaults');
25955
25956var _defaults2 = _interopRequireDefault(_defaults);
25957
25958function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25959
25960/**
25961 * Creates logger with following options
25962 *
25963 * @namespace
25964 * @param {object} options - options for logger
25965 * @param {string | function | object} options.level - console[level]
25966 * @param {boolean} options.duration - print duration of each action?
25967 * @param {boolean} options.timestamp - print timestamp with each action?
25968 * @param {object} options.colors - custom colors
25969 * @param {object} options.logger - implementation of the `console` API
25970 * @param {boolean} options.logErrors - should errors in action execution be caught, logged, and re-thrown?
25971 * @param {boolean} options.collapsed - is group collapsed?
25972 * @param {boolean} options.predicate - condition which resolves logger behavior
25973 * @param {function} options.stateTransformer - transform state before print
25974 * @param {function} options.actionTransformer - transform action before print
25975 * @param {function} options.errorTransformer - transform error before print
25976 *
25977 * @returns {function} logger middleware
25978 */
25979function createLogger() {
25980 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25981
25982 var loggerOptions = _extends({}, _defaults2.default, options);
25983
25984 var logger = loggerOptions.logger,
25985 transformer = loggerOptions.transformer,
25986 stateTransformer = loggerOptions.stateTransformer,
25987 errorTransformer = loggerOptions.errorTransformer,
25988 predicate = loggerOptions.predicate,
25989 logErrors = loggerOptions.logErrors,
25990 diffPredicate = loggerOptions.diffPredicate;
25991
25992 // Return if 'console' object is not defined
25993
25994 if (typeof logger === 'undefined') {
25995 return function () {
25996 return function (next) {
25997 return function (action) {
25998 return next(action);
25999 };
26000 };
26001 };
26002 }
26003
26004 if (transformer) {
26005 console.error('Option \'transformer\' is deprecated, use \'stateTransformer\' instead!'); // eslint-disable-line no-console
26006 }
26007
26008 // Detect if 'createLogger' was passed directly to 'applyMiddleware'.
26009 if (options.getState && options.dispatch) {
26010 // eslint-disable-next-line no-console
26011 console.error('[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware:\n\n// Logger with default options\nimport { logger } from \'redux-logger\'\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n\n\n// Or you can create your own logger with custom options http://bit.ly/redux-logger-options\nimport createLogger from \'redux-logger\'\n\nconst logger = createLogger({\n // ...options\n});\n\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n');
26012
26013 return function () {
26014 return function (next) {
26015 return function (action) {
26016 return next(action);
26017 };
26018 };
26019 };
26020 }
26021
26022 var logBuffer = [];
26023
26024 return function (_ref) {
26025 var getState = _ref.getState;
26026 return function (next) {
26027 return function (action) {
26028 // Exit early if predicate function returns 'false'
26029 if (typeof predicate === 'function' && !predicate(getState, action)) {
26030 return next(action);
26031 }
26032
26033 var logEntry = {};
26034 logBuffer.push(logEntry);
26035
26036 logEntry.started = _helpers.timer.now();
26037 logEntry.startedTime = new Date();
26038 logEntry.prevState = stateTransformer(getState());
26039 logEntry.action = action;
26040
26041 var returnedValue = void 0;
26042 if (logErrors) {
26043 try {
26044 returnedValue = next(action);
26045 } catch (e) {
26046 logEntry.error = errorTransformer(e);
26047 }
26048 } else {
26049 returnedValue = next(action);
26050 }
26051
26052 logEntry.took = _helpers.timer.now() - logEntry.started;
26053 logEntry.nextState = stateTransformer(getState());
26054
26055 var diff = loggerOptions.diff && typeof diffPredicate === 'function' ? diffPredicate(getState, action) : loggerOptions.diff;
26056
26057 (0, _core.printBuffer)(logBuffer, _extends({}, loggerOptions, { diff: diff }));
26058 logBuffer.length = 0;
26059
26060 if (logEntry.error) throw logEntry.error;
26061 return returnedValue;
26062 };
26063 };
26064 };
26065}
26066
26067var defaultLogger = createLogger();
26068
26069exports.defaults = _defaults2.default;
26070exports.logger = defaultLogger;
26071exports.default = createLogger;
26072module.exports = exports['default'];
26073
26074},{"./core":52,"./defaults":53,"./helpers":55}],57:[function(require,module,exports){
26075'use strict';
26076
26077exports.__esModule = true;
26078function createThunkMiddleware(extraArgument) {
26079 return function (_ref) {
26080 var dispatch = _ref.dispatch,
26081 getState = _ref.getState;
26082 return function (next) {
26083 return function (action) {
26084 if (typeof action === 'function') {
26085 return action(dispatch, getState, extraArgument);
26086 }
26087
26088 return next(action);
26089 };
26090 };
26091 };
26092}
26093
26094var thunk = createThunkMiddleware();
26095thunk.withExtraArgument = createThunkMiddleware;
26096
26097exports['default'] = thunk;
26098},{}],58:[function(require,module,exports){
26099'use strict';
26100
26101exports.__esModule = true;
26102
26103var _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; };
26104
26105exports['default'] = applyMiddleware;
26106
26107var _compose = require('./compose');
26108
26109var _compose2 = _interopRequireDefault(_compose);
26110
26111function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
26112
26113/**
26114 * Creates a store enhancer that applies middleware to the dispatch method
26115 * of the Redux store. This is handy for a variety of tasks, such as expressing
26116 * asynchronous actions in a concise manner, or logging every action payload.
26117 *
26118 * See `redux-thunk` package as an example of the Redux middleware.
26119 *
26120 * Because middleware is potentially asynchronous, this should be the first
26121 * store enhancer in the composition chain.
26122 *
26123 * Note that each middleware will be given the `dispatch` and `getState` functions
26124 * as named arguments.
26125 *
26126 * @param {...Function} middlewares The middleware chain to be applied.
26127 * @returns {Function} A store enhancer applying the middleware.
26128 */
26129function applyMiddleware() {
26130 for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
26131 middlewares[_key] = arguments[_key];
26132 }
26133
26134 return function (createStore) {
26135 return function (reducer, preloadedState, enhancer) {
26136 var store = createStore(reducer, preloadedState, enhancer);
26137 var _dispatch = store.dispatch;
26138 var chain = [];
26139
26140 var middlewareAPI = {
26141 getState: store.getState,
26142 dispatch: function dispatch(action) {
26143 return _dispatch(action);
26144 }
26145 };
26146 chain = middlewares.map(function (middleware) {
26147 return middleware(middlewareAPI);
26148 });
26149 _dispatch = _compose2['default'].apply(undefined, chain)(store.dispatch);
26150
26151 return _extends({}, store, {
26152 dispatch: _dispatch
26153 });
26154 };
26155 };
26156}
26157},{"./compose":61}],59:[function(require,module,exports){
26158'use strict';
26159
26160exports.__esModule = true;
26161exports['default'] = bindActionCreators;
26162function bindActionCreator(actionCreator, dispatch) {
26163 return function () {
26164 return dispatch(actionCreator.apply(undefined, arguments));
26165 };
26166}
26167
26168/**
26169 * Turns an object whose values are action creators, into an object with the
26170 * same keys, but with every function wrapped into a `dispatch` call so they
26171 * may be invoked directly. This is just a convenience method, as you can call
26172 * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
26173 *
26174 * For convenience, you can also pass a single function as the first argument,
26175 * and get a function in return.
26176 *
26177 * @param {Function|Object} actionCreators An object whose values are action
26178 * creator functions. One handy way to obtain it is to use ES6 `import * as`
26179 * syntax. You may also pass a single function.
26180 *
26181 * @param {Function} dispatch The `dispatch` function available on your Redux
26182 * store.
26183 *
26184 * @returns {Function|Object} The object mimicking the original object, but with
26185 * every action creator wrapped into the `dispatch` call. If you passed a
26186 * function as `actionCreators`, the return value will also be a single
26187 * function.
26188 */
26189function bindActionCreators(actionCreators, dispatch) {
26190 if (typeof actionCreators === 'function') {
26191 return bindActionCreator(actionCreators, dispatch);
26192 }
26193
26194 if (typeof actionCreators !== 'object' || actionCreators === null) {
26195 throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');
26196 }
26197
26198 var keys = Object.keys(actionCreators);
26199 var boundActionCreators = {};
26200 for (var i = 0; i < keys.length; i++) {
26201 var key = keys[i];
26202 var actionCreator = actionCreators[key];
26203 if (typeof actionCreator === 'function') {
26204 boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
26205 }
26206 }
26207 return boundActionCreators;
26208}
26209},{}],60:[function(require,module,exports){
26210'use strict';
26211
26212exports.__esModule = true;
26213exports['default'] = combineReducers;
26214
26215var _createStore = require('./createStore');
26216
26217var _isPlainObject = require('lodash/isPlainObject');
26218
26219var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
26220
26221var _warning = require('./utils/warning');
26222
26223var _warning2 = _interopRequireDefault(_warning);
26224
26225function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
26226
26227function getUndefinedStateErrorMessage(key, action) {
26228 var actionType = action && action.type;
26229 var actionName = actionType && '"' + actionType.toString() + '"' || 'an action';
26230
26231 return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state. ' + 'If you want this reducer to hold no value, you can return null instead of undefined.';
26232}
26233
26234function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
26235 var reducerKeys = Object.keys(reducers);
26236 var argumentName = action && action.type === _createStore.ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
26237
26238 if (reducerKeys.length === 0) {
26239 return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
26240 }
26241
26242 if (!(0, _isPlainObject2['default'])(inputState)) {
26243 return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
26244 }
26245
26246 var unexpectedKeys = Object.keys(inputState).filter(function (key) {
26247 return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
26248 });
26249
26250 unexpectedKeys.forEach(function (key) {
26251 unexpectedKeyCache[key] = true;
26252 });
26253
26254 if (unexpectedKeys.length > 0) {
26255 return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
26256 }
26257}
26258
26259function assertReducerShape(reducers) {
26260 Object.keys(reducers).forEach(function (key) {
26261 var reducer = reducers[key];
26262 var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT });
26263
26264 if (typeof initialState === 'undefined') {
26265 throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined. If you don\'t want to set a value for this reducer, ' + 'you can use null instead of undefined.');
26266 }
26267
26268 var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
26269 if (typeof reducer(undefined, { type: type }) === 'undefined') {
26270 throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined, but can be null.');
26271 }
26272 });
26273}
26274
26275/**
26276 * Turns an object whose values are different reducer functions, into a single
26277 * reducer function. It will call every child reducer, and gather their results
26278 * into a single state object, whose keys correspond to the keys of the passed
26279 * reducer functions.
26280 *
26281 * @param {Object} reducers An object whose values correspond to different
26282 * reducer functions that need to be combined into one. One handy way to obtain
26283 * it is to use ES6 `import * as reducers` syntax. The reducers may never return
26284 * undefined for any action. Instead, they should return their initial state
26285 * if the state passed to them was undefined, and the current state for any
26286 * unrecognized action.
26287 *
26288 * @returns {Function} A reducer function that invokes every reducer inside the
26289 * passed object, and builds a state object with the same shape.
26290 */
26291function combineReducers(reducers) {
26292 var reducerKeys = Object.keys(reducers);
26293 var finalReducers = {};
26294 for (var i = 0; i < reducerKeys.length; i++) {
26295 var key = reducerKeys[i];
26296
26297 if ("development" !== 'production') {
26298 if (typeof reducers[key] === 'undefined') {
26299 (0, _warning2['default'])('No reducer provided for key "' + key + '"');
26300 }
26301 }
26302
26303 if (typeof reducers[key] === 'function') {
26304 finalReducers[key] = reducers[key];
26305 }
26306 }
26307 var finalReducerKeys = Object.keys(finalReducers);
26308
26309 var unexpectedKeyCache = void 0;
26310 if ("development" !== 'production') {
26311 unexpectedKeyCache = {};
26312 }
26313
26314 var shapeAssertionError = void 0;
26315 try {
26316 assertReducerShape(finalReducers);
26317 } catch (e) {
26318 shapeAssertionError = e;
26319 }
26320
26321 return function combination() {
26322 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26323 var action = arguments[1];
26324
26325 if (shapeAssertionError) {
26326 throw shapeAssertionError;
26327 }
26328
26329 if ("development" !== 'production') {
26330 var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
26331 if (warningMessage) {
26332 (0, _warning2['default'])(warningMessage);
26333 }
26334 }
26335
26336 var hasChanged = false;
26337 var nextState = {};
26338 for (var _i = 0; _i < finalReducerKeys.length; _i++) {
26339 var _key = finalReducerKeys[_i];
26340 var reducer = finalReducers[_key];
26341 var previousStateForKey = state[_key];
26342 var nextStateForKey = reducer(previousStateForKey, action);
26343 if (typeof nextStateForKey === 'undefined') {
26344 var errorMessage = getUndefinedStateErrorMessage(_key, action);
26345 throw new Error(errorMessage);
26346 }
26347 nextState[_key] = nextStateForKey;
26348 hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
26349 }
26350 return hasChanged ? nextState : state;
26351 };
26352}
26353},{"./createStore":62,"./utils/warning":64,"lodash/isPlainObject":21}],61:[function(require,module,exports){
26354"use strict";
26355
26356exports.__esModule = true;
26357exports["default"] = compose;
26358/**
26359 * Composes single-argument functions from right to left. The rightmost
26360 * function can take multiple arguments as it provides the signature for
26361 * the resulting composite function.
26362 *
26363 * @param {...Function} funcs The functions to compose.
26364 * @returns {Function} A function obtained by composing the argument functions
26365 * from right to left. For example, compose(f, g, h) is identical to doing
26366 * (...args) => f(g(h(...args))).
26367 */
26368
26369function compose() {
26370 for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
26371 funcs[_key] = arguments[_key];
26372 }
26373
26374 if (funcs.length === 0) {
26375 return function (arg) {
26376 return arg;
26377 };
26378 }
26379
26380 if (funcs.length === 1) {
26381 return funcs[0];
26382 }
26383
26384 return funcs.reduce(function (a, b) {
26385 return function () {
26386 return a(b.apply(undefined, arguments));
26387 };
26388 });
26389}
26390},{}],62:[function(require,module,exports){
26391'use strict';
26392
26393exports.__esModule = true;
26394exports.ActionTypes = undefined;
26395exports['default'] = createStore;
26396
26397var _isPlainObject = require('lodash/isPlainObject');
26398
26399var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
26400
26401var _symbolObservable = require('symbol-observable');
26402
26403var _symbolObservable2 = _interopRequireDefault(_symbolObservable);
26404
26405function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
26406
26407/**
26408 * These are private action types reserved by Redux.
26409 * For any unknown actions, you must return the current state.
26410 * If the current state is undefined, you must return the initial state.
26411 * Do not reference these action types directly in your code.
26412 */
26413var ActionTypes = exports.ActionTypes = {
26414 INIT: '@@redux/INIT'
26415
26416 /**
26417 * Creates a Redux store that holds the state tree.
26418 * The only way to change the data in the store is to call `dispatch()` on it.
26419 *
26420 * There should only be a single store in your app. To specify how different
26421 * parts of the state tree respond to actions, you may combine several reducers
26422 * into a single reducer function by using `combineReducers`.
26423 *
26424 * @param {Function} reducer A function that returns the next state tree, given
26425 * the current state tree and the action to handle.
26426 *
26427 * @param {any} [preloadedState] The initial state. You may optionally specify it
26428 * to hydrate the state from the server in universal apps, or to restore a
26429 * previously serialized user session.
26430 * If you use `combineReducers` to produce the root reducer function, this must be
26431 * an object with the same shape as `combineReducers` keys.
26432 *
26433 * @param {Function} [enhancer] The store enhancer. You may optionally specify it
26434 * to enhance the store with third-party capabilities such as middleware,
26435 * time travel, persistence, etc. The only store enhancer that ships with Redux
26436 * is `applyMiddleware()`.
26437 *
26438 * @returns {Store} A Redux store that lets you read the state, dispatch actions
26439 * and subscribe to changes.
26440 */
26441};function createStore(reducer, preloadedState, enhancer) {
26442 var _ref2;
26443
26444 if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
26445 enhancer = preloadedState;
26446 preloadedState = undefined;
26447 }
26448
26449 if (typeof enhancer !== 'undefined') {
26450 if (typeof enhancer !== 'function') {
26451 throw new Error('Expected the enhancer to be a function.');
26452 }
26453
26454 return enhancer(createStore)(reducer, preloadedState);
26455 }
26456
26457 if (typeof reducer !== 'function') {
26458 throw new Error('Expected the reducer to be a function.');
26459 }
26460
26461 var currentReducer = reducer;
26462 var currentState = preloadedState;
26463 var currentListeners = [];
26464 var nextListeners = currentListeners;
26465 var isDispatching = false;
26466
26467 function ensureCanMutateNextListeners() {
26468 if (nextListeners === currentListeners) {
26469 nextListeners = currentListeners.slice();
26470 }
26471 }
26472
26473 /**
26474 * Reads the state tree managed by the store.
26475 *
26476 * @returns {any} The current state tree of your application.
26477 */
26478 function getState() {
26479 return currentState;
26480 }
26481
26482 /**
26483 * Adds a change listener. It will be called any time an action is dispatched,
26484 * and some part of the state tree may potentially have changed. You may then
26485 * call `getState()` to read the current state tree inside the callback.
26486 *
26487 * You may call `dispatch()` from a change listener, with the following
26488 * caveats:
26489 *
26490 * 1. The subscriptions are snapshotted just before every `dispatch()` call.
26491 * If you subscribe or unsubscribe while the listeners are being invoked, this
26492 * will not have any effect on the `dispatch()` that is currently in progress.
26493 * However, the next `dispatch()` call, whether nested or not, will use a more
26494 * recent snapshot of the subscription list.
26495 *
26496 * 2. The listener should not expect to see all state changes, as the state
26497 * might have been updated multiple times during a nested `dispatch()` before
26498 * the listener is called. It is, however, guaranteed that all subscribers
26499 * registered before the `dispatch()` started will be called with the latest
26500 * state by the time it exits.
26501 *
26502 * @param {Function} listener A callback to be invoked on every dispatch.
26503 * @returns {Function} A function to remove this change listener.
26504 */
26505 function subscribe(listener) {
26506 if (typeof listener !== 'function') {
26507 throw new Error('Expected listener to be a function.');
26508 }
26509
26510 var isSubscribed = true;
26511
26512 ensureCanMutateNextListeners();
26513 nextListeners.push(listener);
26514
26515 return function unsubscribe() {
26516 if (!isSubscribed) {
26517 return;
26518 }
26519
26520 isSubscribed = false;
26521
26522 ensureCanMutateNextListeners();
26523 var index = nextListeners.indexOf(listener);
26524 nextListeners.splice(index, 1);
26525 };
26526 }
26527
26528 /**
26529 * Dispatches an action. It is the only way to trigger a state change.
26530 *
26531 * The `reducer` function, used to create the store, will be called with the
26532 * current state tree and the given `action`. Its return value will
26533 * be considered the **next** state of the tree, and the change listeners
26534 * will be notified.
26535 *
26536 * The base implementation only supports plain object actions. If you want to
26537 * dispatch a Promise, an Observable, a thunk, or something else, you need to
26538 * wrap your store creating function into the corresponding middleware. For
26539 * example, see the documentation for the `redux-thunk` package. Even the
26540 * middleware will eventually dispatch plain object actions using this method.
26541 *
26542 * @param {Object} action A plain object representing “what changed”. It is
26543 * a good idea to keep actions serializable so you can record and replay user
26544 * sessions, or use the time travelling `redux-devtools`. An action must have
26545 * a `type` property which may not be `undefined`. It is a good idea to use
26546 * string constants for action types.
26547 *
26548 * @returns {Object} For convenience, the same action object you dispatched.
26549 *
26550 * Note that, if you use a custom middleware, it may wrap `dispatch()` to
26551 * return something else (for example, a Promise you can await).
26552 */
26553 function dispatch(action) {
26554 if (!(0, _isPlainObject2['default'])(action)) {
26555 throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
26556 }
26557
26558 if (typeof action.type === 'undefined') {
26559 throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
26560 }
26561
26562 if (isDispatching) {
26563 throw new Error('Reducers may not dispatch actions.');
26564 }
26565
26566 try {
26567 isDispatching = true;
26568 currentState = currentReducer(currentState, action);
26569 } finally {
26570 isDispatching = false;
26571 }
26572
26573 var listeners = currentListeners = nextListeners;
26574 for (var i = 0; i < listeners.length; i++) {
26575 var listener = listeners[i];
26576 listener();
26577 }
26578
26579 return action;
26580 }
26581
26582 /**
26583 * Replaces the reducer currently used by the store to calculate the state.
26584 *
26585 * You might need this if your app implements code splitting and you want to
26586 * load some of the reducers dynamically. You might also need this if you
26587 * implement a hot reloading mechanism for Redux.
26588 *
26589 * @param {Function} nextReducer The reducer for the store to use instead.
26590 * @returns {void}
26591 */
26592 function replaceReducer(nextReducer) {
26593 if (typeof nextReducer !== 'function') {
26594 throw new Error('Expected the nextReducer to be a function.');
26595 }
26596
26597 currentReducer = nextReducer;
26598 dispatch({ type: ActionTypes.INIT });
26599 }
26600
26601 /**
26602 * Interoperability point for observable/reactive libraries.
26603 * @returns {observable} A minimal observable of state changes.
26604 * For more information, see the observable proposal:
26605 * https://github.com/tc39/proposal-observable
26606 */
26607 function observable() {
26608 var _ref;
26609
26610 var outerSubscribe = subscribe;
26611 return _ref = {
26612 /**
26613 * The minimal observable subscription method.
26614 * @param {Object} observer Any object that can be used as an observer.
26615 * The observer object should have a `next` method.
26616 * @returns {subscription} An object with an `unsubscribe` method that can
26617 * be used to unsubscribe the observable from the store, and prevent further
26618 * emission of values from the observable.
26619 */
26620 subscribe: function subscribe(observer) {
26621 if (typeof observer !== 'object') {
26622 throw new TypeError('Expected the observer to be an object.');
26623 }
26624
26625 function observeState() {
26626 if (observer.next) {
26627 observer.next(getState());
26628 }
26629 }
26630
26631 observeState();
26632 var unsubscribe = outerSubscribe(observeState);
26633 return { unsubscribe: unsubscribe };
26634 }
26635 }, _ref[_symbolObservable2['default']] = function () {
26636 return this;
26637 }, _ref;
26638 }
26639
26640 // When a store is created, an "INIT" action is dispatched so that every
26641 // reducer returns their initial state. This effectively populates
26642 // the initial state tree.
26643 dispatch({ type: ActionTypes.INIT });
26644
26645 return _ref2 = {
26646 dispatch: dispatch,
26647 subscribe: subscribe,
26648 getState: getState,
26649 replaceReducer: replaceReducer
26650 }, _ref2[_symbolObservable2['default']] = observable, _ref2;
26651}
26652},{"lodash/isPlainObject":21,"symbol-observable":74}],63:[function(require,module,exports){
26653'use strict';
26654
26655exports.__esModule = true;
26656exports.compose = exports.applyMiddleware = exports.bindActionCreators = exports.combineReducers = exports.createStore = undefined;
26657
26658var _createStore = require('./createStore');
26659
26660var _createStore2 = _interopRequireDefault(_createStore);
26661
26662var _combineReducers = require('./combineReducers');
26663
26664var _combineReducers2 = _interopRequireDefault(_combineReducers);
26665
26666var _bindActionCreators = require('./bindActionCreators');
26667
26668var _bindActionCreators2 = _interopRequireDefault(_bindActionCreators);
26669
26670var _applyMiddleware = require('./applyMiddleware');
26671
26672var _applyMiddleware2 = _interopRequireDefault(_applyMiddleware);
26673
26674var _compose = require('./compose');
26675
26676var _compose2 = _interopRequireDefault(_compose);
26677
26678var _warning = require('./utils/warning');
26679
26680var _warning2 = _interopRequireDefault(_warning);
26681
26682function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
26683
26684/*
26685* This is a dummy function to check if the function name has been altered by minification.
26686* If the function has been minified and NODE_ENV !== 'production', warn the user.
26687*/
26688function isCrushed() {}
26689
26690if ("development" !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
26691 (0, _warning2['default'])('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
26692}
26693
26694exports.createStore = _createStore2['default'];
26695exports.combineReducers = _combineReducers2['default'];
26696exports.bindActionCreators = _bindActionCreators2['default'];
26697exports.applyMiddleware = _applyMiddleware2['default'];
26698exports.compose = _compose2['default'];
26699},{"./applyMiddleware":58,"./bindActionCreators":59,"./combineReducers":60,"./compose":61,"./createStore":62,"./utils/warning":64}],64:[function(require,module,exports){
26700'use strict';
26701
26702exports.__esModule = true;
26703exports['default'] = warning;
26704/**
26705 * Prints a warning in the console if it exists.
26706 *
26707 * @param {String} message The warning message.
26708 * @returns {void}
26709 */
26710function warning(message) {
26711 /* eslint-disable no-console */
26712 if (typeof console !== 'undefined' && typeof console.error === 'function') {
26713 console.error(message);
26714 }
26715 /* eslint-enable no-console */
26716 try {
26717 // This error was thrown as a convenience so that if you enable
26718 // "break on all exceptions" in your console,
26719 // it would pause the execution at this line.
26720 throw new Error(message);
26721 /* eslint-disable no-empty */
26722 } catch (e) {}
26723 /* eslint-enable no-empty */
26724}
26725},{}],65:[function(require,module,exports){
26726(function (global){
26727// This method of obtaining a reference to the global object needs to be
26728// kept identical to the way it is obtained in runtime.js
26729var g =
26730 typeof global === "object" ? global :
26731 typeof window === "object" ? window :
26732 typeof self === "object" ? self : this;
26733
26734// Use `getOwnPropertyNames` because not all browsers support calling
26735// `hasOwnProperty` on the global `self` object in a worker. See #183.
26736var hadRuntime = g.regeneratorRuntime &&
26737 Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
26738
26739// Save the old regeneratorRuntime in case it needs to be restored later.
26740var oldRuntime = hadRuntime && g.regeneratorRuntime;
26741
26742// Force reevalutation of runtime.js.
26743g.regeneratorRuntime = undefined;
26744
26745module.exports = require("./runtime");
26746
26747if (hadRuntime) {
26748 // Restore the original runtime.
26749 g.regeneratorRuntime = oldRuntime;
26750} else {
26751 // Remove the global property added by runtime.js.
26752 try {
26753 delete g.regeneratorRuntime;
26754 } catch(e) {
26755 g.regeneratorRuntime = undefined;
26756 }
26757}
26758
26759}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
26760
26761},{"./runtime":66}],66:[function(require,module,exports){
26762(function (global){
26763/**
26764 * Copyright (c) 2014, Facebook, Inc.
26765 * All rights reserved.
26766 *
26767 * This source code is licensed under the BSD-style license found in the
26768 * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
26769 * additional grant of patent rights can be found in the PATENTS file in
26770 * the same directory.
26771 */
26772
26773!(function(global) {
26774 "use strict";
26775
26776 var Op = Object.prototype;
26777 var hasOwn = Op.hasOwnProperty;
26778 var undefined; // More compressible than void 0.
26779 var $Symbol = typeof Symbol === "function" ? Symbol : {};
26780 var iteratorSymbol = $Symbol.iterator || "@@iterator";
26781 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
26782 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
26783
26784 var inModule = typeof module === "object";
26785 var runtime = global.regeneratorRuntime;
26786 if (runtime) {
26787 if (inModule) {
26788 // If regeneratorRuntime is defined globally and we're in a module,
26789 // make the exports object identical to regeneratorRuntime.
26790 module.exports = runtime;
26791 }
26792 // Don't bother evaluating the rest of this file if the runtime was
26793 // already defined globally.
26794 return;
26795 }
26796
26797 // Define the runtime globally (as expected by generated code) as either
26798 // module.exports (if we're in a module) or a new, empty object.
26799 runtime = global.regeneratorRuntime = inModule ? module.exports : {};
26800
26801 function wrap(innerFn, outerFn, self, tryLocsList) {
26802 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
26803 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
26804 var generator = Object.create(protoGenerator.prototype);
26805 var context = new Context(tryLocsList || []);
26806
26807 // The ._invoke method unifies the implementations of the .next,
26808 // .throw, and .return methods.
26809 generator._invoke = makeInvokeMethod(innerFn, self, context);
26810
26811 return generator;
26812 }
26813 runtime.wrap = wrap;
26814
26815 // Try/catch helper to minimize deoptimizations. Returns a completion
26816 // record like context.tryEntries[i].completion. This interface could
26817 // have been (and was previously) designed to take a closure to be
26818 // invoked without arguments, but in all the cases we care about we
26819 // already have an existing method we want to call, so there's no need
26820 // to create a new function object. We can even get away with assuming
26821 // the method takes exactly one argument, since that happens to be true
26822 // in every case, so we don't have to touch the arguments object. The
26823 // only additional allocation required is the completion record, which
26824 // has a stable shape and so hopefully should be cheap to allocate.
26825 function tryCatch(fn, obj, arg) {
26826 try {
26827 return { type: "normal", arg: fn.call(obj, arg) };
26828 } catch (err) {
26829 return { type: "throw", arg: err };
26830 }
26831 }
26832
26833 var GenStateSuspendedStart = "suspendedStart";
26834 var GenStateSuspendedYield = "suspendedYield";
26835 var GenStateExecuting = "executing";
26836 var GenStateCompleted = "completed";
26837
26838 // Returning this object from the innerFn has the same effect as
26839 // breaking out of the dispatch switch statement.
26840 var ContinueSentinel = {};
26841
26842 // Dummy constructor functions that we use as the .constructor and
26843 // .constructor.prototype properties for functions that return Generator
26844 // objects. For full spec compliance, you may wish to configure your
26845 // minifier not to mangle the names of these two functions.
26846 function Generator() {}
26847 function GeneratorFunction() {}
26848 function GeneratorFunctionPrototype() {}
26849
26850 // This is a polyfill for %IteratorPrototype% for environments that
26851 // don't natively support it.
26852 var IteratorPrototype = {};
26853 IteratorPrototype[iteratorSymbol] = function () {
26854 return this;
26855 };
26856
26857 var getProto = Object.getPrototypeOf;
26858 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
26859 if (NativeIteratorPrototype &&
26860 NativeIteratorPrototype !== Op &&
26861 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
26862 // This environment has a native %IteratorPrototype%; use it instead
26863 // of the polyfill.
26864 IteratorPrototype = NativeIteratorPrototype;
26865 }
26866
26867 var Gp = GeneratorFunctionPrototype.prototype =
26868 Generator.prototype = Object.create(IteratorPrototype);
26869 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
26870 GeneratorFunctionPrototype.constructor = GeneratorFunction;
26871 GeneratorFunctionPrototype[toStringTagSymbol] =
26872 GeneratorFunction.displayName = "GeneratorFunction";
26873
26874 // Helper for defining the .next, .throw, and .return methods of the
26875 // Iterator interface in terms of a single ._invoke method.
26876 function defineIteratorMethods(prototype) {
26877 ["next", "throw", "return"].forEach(function(method) {
26878 prototype[method] = function(arg) {
26879 return this._invoke(method, arg);
26880 };
26881 });
26882 }
26883
26884 runtime.isGeneratorFunction = function(genFun) {
26885 var ctor = typeof genFun === "function" && genFun.constructor;
26886 return ctor
26887 ? ctor === GeneratorFunction ||
26888 // For the native GeneratorFunction constructor, the best we can
26889 // do is to check its .name property.
26890 (ctor.displayName || ctor.name) === "GeneratorFunction"
26891 : false;
26892 };
26893
26894 runtime.mark = function(genFun) {
26895 if (Object.setPrototypeOf) {
26896 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
26897 } else {
26898 genFun.__proto__ = GeneratorFunctionPrototype;
26899 if (!(toStringTagSymbol in genFun)) {
26900 genFun[toStringTagSymbol] = "GeneratorFunction";
26901 }
26902 }
26903 genFun.prototype = Object.create(Gp);
26904 return genFun;
26905 };
26906
26907 // Within the body of any async function, `await x` is transformed to
26908 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
26909 // `hasOwn.call(value, "__await")` to determine if the yielded value is
26910 // meant to be awaited.
26911 runtime.awrap = function(arg) {
26912 return { __await: arg };
26913 };
26914
26915 function AsyncIterator(generator) {
26916 function invoke(method, arg, resolve, reject) {
26917 var record = tryCatch(generator[method], generator, arg);
26918 if (record.type === "throw") {
26919 reject(record.arg);
26920 } else {
26921 var result = record.arg;
26922 var value = result.value;
26923 if (value &&
26924 typeof value === "object" &&
26925 hasOwn.call(value, "__await")) {
26926 return Promise.resolve(value.__await).then(function(value) {
26927 invoke("next", value, resolve, reject);
26928 }, function(err) {
26929 invoke("throw", err, resolve, reject);
26930 });
26931 }
26932
26933 return Promise.resolve(value).then(function(unwrapped) {
26934 // When a yielded Promise is resolved, its final value becomes
26935 // the .value of the Promise<{value,done}> result for the
26936 // current iteration. If the Promise is rejected, however, the
26937 // result for this iteration will be rejected with the same
26938 // reason. Note that rejections of yielded Promises are not
26939 // thrown back into the generator function, as is the case
26940 // when an awaited Promise is rejected. This difference in
26941 // behavior between yield and await is important, because it
26942 // allows the consumer to decide what to do with the yielded
26943 // rejection (swallow it and continue, manually .throw it back
26944 // into the generator, abandon iteration, whatever). With
26945 // await, by contrast, there is no opportunity to examine the
26946 // rejection reason outside the generator function, so the
26947 // only option is to throw it from the await expression, and
26948 // let the generator function handle the exception.
26949 result.value = unwrapped;
26950 resolve(result);
26951 }, reject);
26952 }
26953 }
26954
26955 if (typeof global.process === "object" && global.process.domain) {
26956 invoke = global.process.domain.bind(invoke);
26957 }
26958
26959 var previousPromise;
26960
26961 function enqueue(method, arg) {
26962 function callInvokeWithMethodAndArg() {
26963 return new Promise(function(resolve, reject) {
26964 invoke(method, arg, resolve, reject);
26965 });
26966 }
26967
26968 return previousPromise =
26969 // If enqueue has been called before, then we want to wait until
26970 // all previous Promises have been resolved before calling invoke,
26971 // so that results are always delivered in the correct order. If
26972 // enqueue has not been called before, then it is important to
26973 // call invoke immediately, without waiting on a callback to fire,
26974 // so that the async generator function has the opportunity to do
26975 // any necessary setup in a predictable way. This predictability
26976 // is why the Promise constructor synchronously invokes its
26977 // executor callback, and why async functions synchronously
26978 // execute code before the first await. Since we implement simple
26979 // async functions in terms of async generators, it is especially
26980 // important to get this right, even though it requires care.
26981 previousPromise ? previousPromise.then(
26982 callInvokeWithMethodAndArg,
26983 // Avoid propagating failures to Promises returned by later
26984 // invocations of the iterator.
26985 callInvokeWithMethodAndArg
26986 ) : callInvokeWithMethodAndArg();
26987 }
26988
26989 // Define the unified helper method that is used to implement .next,
26990 // .throw, and .return (see defineIteratorMethods).
26991 this._invoke = enqueue;
26992 }
26993
26994 defineIteratorMethods(AsyncIterator.prototype);
26995 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
26996 return this;
26997 };
26998 runtime.AsyncIterator = AsyncIterator;
26999
27000 // Note that simple async functions are implemented on top of
27001 // AsyncIterator objects; they just return a Promise for the value of
27002 // the final result produced by the iterator.
27003 runtime.async = function(innerFn, outerFn, self, tryLocsList) {
27004 var iter = new AsyncIterator(
27005 wrap(innerFn, outerFn, self, tryLocsList)
27006 );
27007
27008 return runtime.isGeneratorFunction(outerFn)
27009 ? iter // If outerFn is a generator, return the full iterator.
27010 : iter.next().then(function(result) {
27011 return result.done ? result.value : iter.next();
27012 });
27013 };
27014
27015 function makeInvokeMethod(innerFn, self, context) {
27016 var state = GenStateSuspendedStart;
27017
27018 return function invoke(method, arg) {
27019 if (state === GenStateExecuting) {
27020 throw new Error("Generator is already running");
27021 }
27022
27023 if (state === GenStateCompleted) {
27024 if (method === "throw") {
27025 throw arg;
27026 }
27027
27028 // Be forgiving, per 25.3.3.3.3 of the spec:
27029 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
27030 return doneResult();
27031 }
27032
27033 context.method = method;
27034 context.arg = arg;
27035
27036 while (true) {
27037 var delegate = context.delegate;
27038 if (delegate) {
27039 var delegateResult = maybeInvokeDelegate(delegate, context);
27040 if (delegateResult) {
27041 if (delegateResult === ContinueSentinel) continue;
27042 return delegateResult;
27043 }
27044 }
27045
27046 if (context.method === "next") {
27047 // Setting context._sent for legacy support of Babel's
27048 // function.sent implementation.
27049 context.sent = context._sent = context.arg;
27050
27051 } else if (context.method === "throw") {
27052 if (state === GenStateSuspendedStart) {
27053 state = GenStateCompleted;
27054 throw context.arg;
27055 }
27056
27057 context.dispatchException(context.arg);
27058
27059 } else if (context.method === "return") {
27060 context.abrupt("return", context.arg);
27061 }
27062
27063 state = GenStateExecuting;
27064
27065 var record = tryCatch(innerFn, self, context);
27066 if (record.type === "normal") {
27067 // If an exception is thrown from innerFn, we leave state ===
27068 // GenStateExecuting and loop back for another invocation.
27069 state = context.done
27070 ? GenStateCompleted
27071 : GenStateSuspendedYield;
27072
27073 if (record.arg === ContinueSentinel) {
27074 continue;
27075 }
27076
27077 return {
27078 value: record.arg,
27079 done: context.done
27080 };
27081
27082 } else if (record.type === "throw") {
27083 state = GenStateCompleted;
27084 // Dispatch the exception by looping back around to the
27085 // context.dispatchException(context.arg) call above.
27086 context.method = "throw";
27087 context.arg = record.arg;
27088 }
27089 }
27090 };
27091 }
27092
27093 // Call delegate.iterator[context.method](context.arg) and handle the
27094 // result, either by returning a { value, done } result from the
27095 // delegate iterator, or by modifying context.method and context.arg,
27096 // setting context.delegate to null, and returning the ContinueSentinel.
27097 function maybeInvokeDelegate(delegate, context) {
27098 var method = delegate.iterator[context.method];
27099 if (method === undefined) {
27100 // A .throw or .return when the delegate iterator has no .throw
27101 // method always terminates the yield* loop.
27102 context.delegate = null;
27103
27104 if (context.method === "throw") {
27105 if (delegate.iterator.return) {
27106 // If the delegate iterator has a return method, give it a
27107 // chance to clean up.
27108 context.method = "return";
27109 context.arg = undefined;
27110 maybeInvokeDelegate(delegate, context);
27111
27112 if (context.method === "throw") {
27113 // If maybeInvokeDelegate(context) changed context.method from
27114 // "return" to "throw", let that override the TypeError below.
27115 return ContinueSentinel;
27116 }
27117 }
27118
27119 context.method = "throw";
27120 context.arg = new TypeError(
27121 "The iterator does not provide a 'throw' method");
27122 }
27123
27124 return ContinueSentinel;
27125 }
27126
27127 var record = tryCatch(method, delegate.iterator, context.arg);
27128
27129 if (record.type === "throw") {
27130 context.method = "throw";
27131 context.arg = record.arg;
27132 context.delegate = null;
27133 return ContinueSentinel;
27134 }
27135
27136 var info = record.arg;
27137
27138 if (! info) {
27139 context.method = "throw";
27140 context.arg = new TypeError("iterator result is not an object");
27141 context.delegate = null;
27142 return ContinueSentinel;
27143 }
27144
27145 if (info.done) {
27146 // Assign the result of the finished delegate to the temporary
27147 // variable specified by delegate.resultName (see delegateYield).
27148 context[delegate.resultName] = info.value;
27149
27150 // Resume execution at the desired location (see delegateYield).
27151 context.next = delegate.nextLoc;
27152
27153 // If context.method was "throw" but the delegate handled the
27154 // exception, let the outer generator proceed normally. If
27155 // context.method was "next", forget context.arg since it has been
27156 // "consumed" by the delegate iterator. If context.method was
27157 // "return", allow the original .return call to continue in the
27158 // outer generator.
27159 if (context.method !== "return") {
27160 context.method = "next";
27161 context.arg = undefined;
27162 }
27163
27164 } else {
27165 // Re-yield the result returned by the delegate method.
27166 return info;
27167 }
27168
27169 // The delegate iterator is finished, so forget it and continue with
27170 // the outer generator.
27171 context.delegate = null;
27172 return ContinueSentinel;
27173 }
27174
27175 // Define Generator.prototype.{next,throw,return} in terms of the
27176 // unified ._invoke helper method.
27177 defineIteratorMethods(Gp);
27178
27179 Gp[toStringTagSymbol] = "Generator";
27180
27181 // A Generator should always return itself as the iterator object when the
27182 // @@iterator function is called on it. Some browsers' implementations of the
27183 // iterator prototype chain incorrectly implement this, causing the Generator
27184 // object to not be returned from this call. This ensures that doesn't happen.
27185 // See https://github.com/facebook/regenerator/issues/274 for more details.
27186 Gp[iteratorSymbol] = function() {
27187 return this;
27188 };
27189
27190 Gp.toString = function() {
27191 return "[object Generator]";
27192 };
27193
27194 function pushTryEntry(locs) {
27195 var entry = { tryLoc: locs[0] };
27196
27197 if (1 in locs) {
27198 entry.catchLoc = locs[1];
27199 }
27200
27201 if (2 in locs) {
27202 entry.finallyLoc = locs[2];
27203 entry.afterLoc = locs[3];
27204 }
27205
27206 this.tryEntries.push(entry);
27207 }
27208
27209 function resetTryEntry(entry) {
27210 var record = entry.completion || {};
27211 record.type = "normal";
27212 delete record.arg;
27213 entry.completion = record;
27214 }
27215
27216 function Context(tryLocsList) {
27217 // The root entry object (effectively a try statement without a catch
27218 // or a finally block) gives us a place to store values thrown from
27219 // locations where there is no enclosing try statement.
27220 this.tryEntries = [{ tryLoc: "root" }];
27221 tryLocsList.forEach(pushTryEntry, this);
27222 this.reset(true);
27223 }
27224
27225 runtime.keys = function(object) {
27226 var keys = [];
27227 for (var key in object) {
27228 keys.push(key);
27229 }
27230 keys.reverse();
27231
27232 // Rather than returning an object with a next method, we keep
27233 // things simple and return the next function itself.
27234 return function next() {
27235 while (keys.length) {
27236 var key = keys.pop();
27237 if (key in object) {
27238 next.value = key;
27239 next.done = false;
27240 return next;
27241 }
27242 }
27243
27244 // To avoid creating an additional object, we just hang the .value
27245 // and .done properties off the next function object itself. This
27246 // also ensures that the minifier will not anonymize the function.
27247 next.done = true;
27248 return next;
27249 };
27250 };
27251
27252 function values(iterable) {
27253 if (iterable) {
27254 var iteratorMethod = iterable[iteratorSymbol];
27255 if (iteratorMethod) {
27256 return iteratorMethod.call(iterable);
27257 }
27258
27259 if (typeof iterable.next === "function") {
27260 return iterable;
27261 }
27262
27263 if (!isNaN(iterable.length)) {
27264 var i = -1, next = function next() {
27265 while (++i < iterable.length) {
27266 if (hasOwn.call(iterable, i)) {
27267 next.value = iterable[i];
27268 next.done = false;
27269 return next;
27270 }
27271 }
27272
27273 next.value = undefined;
27274 next.done = true;
27275
27276 return next;
27277 };
27278
27279 return next.next = next;
27280 }
27281 }
27282
27283 // Return an iterator with no values.
27284 return { next: doneResult };
27285 }
27286 runtime.values = values;
27287
27288 function doneResult() {
27289 return { value: undefined, done: true };
27290 }
27291
27292 Context.prototype = {
27293 constructor: Context,
27294
27295 reset: function(skipTempReset) {
27296 this.prev = 0;
27297 this.next = 0;
27298 // Resetting context._sent for legacy support of Babel's
27299 // function.sent implementation.
27300 this.sent = this._sent = undefined;
27301 this.done = false;
27302 this.delegate = null;
27303
27304 this.method = "next";
27305 this.arg = undefined;
27306
27307 this.tryEntries.forEach(resetTryEntry);
27308
27309 if (!skipTempReset) {
27310 for (var name in this) {
27311 // Not sure about the optimal order of these conditions:
27312 if (name.charAt(0) === "t" &&
27313 hasOwn.call(this, name) &&
27314 !isNaN(+name.slice(1))) {
27315 this[name] = undefined;
27316 }
27317 }
27318 }
27319 },
27320
27321 stop: function() {
27322 this.done = true;
27323
27324 var rootEntry = this.tryEntries[0];
27325 var rootRecord = rootEntry.completion;
27326 if (rootRecord.type === "throw") {
27327 throw rootRecord.arg;
27328 }
27329
27330 return this.rval;
27331 },
27332
27333 dispatchException: function(exception) {
27334 if (this.done) {
27335 throw exception;
27336 }
27337
27338 var context = this;
27339 function handle(loc, caught) {
27340 record.type = "throw";
27341 record.arg = exception;
27342 context.next = loc;
27343
27344 if (caught) {
27345 // If the dispatched exception was caught by a catch block,
27346 // then let that catch block handle the exception normally.
27347 context.method = "next";
27348 context.arg = undefined;
27349 }
27350
27351 return !! caught;
27352 }
27353
27354 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
27355 var entry = this.tryEntries[i];
27356 var record = entry.completion;
27357
27358 if (entry.tryLoc === "root") {
27359 // Exception thrown outside of any try block that could handle
27360 // it, so set the completion value of the entire function to
27361 // throw the exception.
27362 return handle("end");
27363 }
27364
27365 if (entry.tryLoc <= this.prev) {
27366 var hasCatch = hasOwn.call(entry, "catchLoc");
27367 var hasFinally = hasOwn.call(entry, "finallyLoc");
27368
27369 if (hasCatch && hasFinally) {
27370 if (this.prev < entry.catchLoc) {
27371 return handle(entry.catchLoc, true);
27372 } else if (this.prev < entry.finallyLoc) {
27373 return handle(entry.finallyLoc);
27374 }
27375
27376 } else if (hasCatch) {
27377 if (this.prev < entry.catchLoc) {
27378 return handle(entry.catchLoc, true);
27379 }
27380
27381 } else if (hasFinally) {
27382 if (this.prev < entry.finallyLoc) {
27383 return handle(entry.finallyLoc);
27384 }
27385
27386 } else {
27387 throw new Error("try statement without catch or finally");
27388 }
27389 }
27390 }
27391 },
27392
27393 abrupt: function(type, arg) {
27394 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
27395 var entry = this.tryEntries[i];
27396 if (entry.tryLoc <= this.prev &&
27397 hasOwn.call(entry, "finallyLoc") &&
27398 this.prev < entry.finallyLoc) {
27399 var finallyEntry = entry;
27400 break;
27401 }
27402 }
27403
27404 if (finallyEntry &&
27405 (type === "break" ||
27406 type === "continue") &&
27407 finallyEntry.tryLoc <= arg &&
27408 arg <= finallyEntry.finallyLoc) {
27409 // Ignore the finally entry if control is not jumping to a
27410 // location outside the try/catch block.
27411 finallyEntry = null;
27412 }
27413
27414 var record = finallyEntry ? finallyEntry.completion : {};
27415 record.type = type;
27416 record.arg = arg;
27417
27418 if (finallyEntry) {
27419 this.method = "next";
27420 this.next = finallyEntry.finallyLoc;
27421 return ContinueSentinel;
27422 }
27423
27424 return this.complete(record);
27425 },
27426
27427 complete: function(record, afterLoc) {
27428 if (record.type === "throw") {
27429 throw record.arg;
27430 }
27431
27432 if (record.type === "break" ||
27433 record.type === "continue") {
27434 this.next = record.arg;
27435 } else if (record.type === "return") {
27436 this.rval = this.arg = record.arg;
27437 this.method = "return";
27438 this.next = "end";
27439 } else if (record.type === "normal" && afterLoc) {
27440 this.next = afterLoc;
27441 }
27442
27443 return ContinueSentinel;
27444 },
27445
27446 finish: function(finallyLoc) {
27447 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
27448 var entry = this.tryEntries[i];
27449 if (entry.finallyLoc === finallyLoc) {
27450 this.complete(entry.completion, entry.afterLoc);
27451 resetTryEntry(entry);
27452 return ContinueSentinel;
27453 }
27454 }
27455 },
27456
27457 "catch": function(tryLoc) {
27458 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
27459 var entry = this.tryEntries[i];
27460 if (entry.tryLoc === tryLoc) {
27461 var record = entry.completion;
27462 if (record.type === "throw") {
27463 var thrown = record.arg;
27464 resetTryEntry(entry);
27465 }
27466 return thrown;
27467 }
27468 }
27469
27470 // The context.catch method must only be called with a location
27471 // argument that corresponds to a known catch block.
27472 throw new Error("illegal catch attempt");
27473 },
27474
27475 delegateYield: function(iterable, resultName, nextLoc) {
27476 this.delegate = {
27477 iterator: values(iterable),
27478 resultName: resultName,
27479 nextLoc: nextLoc
27480 };
27481
27482 if (this.method === "next") {
27483 // Deliberately forget the last sent value so that we don't
27484 // accidentally pass it on to the delegate.
27485 this.arg = undefined;
27486 }
27487
27488 return ContinueSentinel;
27489 }
27490 };
27491})(
27492 // Among the various tricks for obtaining a reference to the global
27493 // object, this seems to be the most reliable technique that does not
27494 // use indirect eval (which violates Content Security Policy).
27495 typeof global === "object" ? global :
27496 typeof window === "object" ? window :
27497 typeof self === "object" ? self : this
27498);
27499
27500}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27501
27502},{}],67:[function(require,module,exports){
27503/** @license React v0.12.0
27504 * scheduler-tracing.development.js
27505 *
27506 * Copyright (c) Facebook, Inc. and its affiliates.
27507 *
27508 * This source code is licensed under the MIT license found in the
27509 * LICENSE file in the root directory of this source tree.
27510 */
27511
27512'use strict';
27513
27514
27515
27516if ("development" !== "production") {
27517 (function() {
27518'use strict';
27519
27520Object.defineProperty(exports, '__esModule', { value: true });
27521
27522// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
27523
27524
27525// In some cases, StrictMode should also double-render lifecycles.
27526// This can be confusing for tests though,
27527// And it can be bad for performance in production.
27528// This feature flag can be used to control the behavior:
27529
27530
27531// To preserve the "Pause on caught exceptions" behavior of the debugger, we
27532// replay the begin phase of a failed component inside invokeGuardedCallback.
27533
27534
27535// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
27536
27537
27538// Gather advanced timing metrics for Profiler subtrees.
27539
27540
27541// Trace which interactions trigger each commit.
27542var enableSchedulerTracing = true;
27543
27544// Only used in www builds.
27545 // TODO: true? Here it might just be false.
27546
27547// Only used in www builds.
27548
27549
27550// Only used in www builds.
27551
27552
27553// React Fire: prevent the value and checked attributes from syncing
27554// with their related DOM properties
27555
27556
27557// These APIs will no longer be "unstable" in the upcoming 16.7 release,
27558// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
27559
27560var DEFAULT_THREAD_ID = 0;
27561
27562// Counters used to generate unique IDs.
27563var interactionIDCounter = 0;
27564var threadIDCounter = 0;
27565
27566// Set of currently traced interactions.
27567// Interactions "stack"–
27568// Meaning that newly traced interactions are appended to the previously active set.
27569// When an interaction goes out of scope, the previous set (if any) is restored.
27570exports.__interactionsRef = null;
27571
27572// Listener(s) to notify when interactions begin and end.
27573exports.__subscriberRef = null;
27574
27575if (enableSchedulerTracing) {
27576 exports.__interactionsRef = {
27577 current: new Set()
27578 };
27579 exports.__subscriberRef = {
27580 current: null
27581 };
27582}
27583
27584function unstable_clear(callback) {
27585 if (!enableSchedulerTracing) {
27586 return callback();
27587 }
27588
27589 var prevInteractions = exports.__interactionsRef.current;
27590 exports.__interactionsRef.current = new Set();
27591
27592 try {
27593 return callback();
27594 } finally {
27595 exports.__interactionsRef.current = prevInteractions;
27596 }
27597}
27598
27599function unstable_getCurrent() {
27600 if (!enableSchedulerTracing) {
27601 return null;
27602 } else {
27603 return exports.__interactionsRef.current;
27604 }
27605}
27606
27607function unstable_getThreadID() {
27608 return ++threadIDCounter;
27609}
27610
27611function unstable_trace(name, timestamp, callback) {
27612 var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
27613
27614 if (!enableSchedulerTracing) {
27615 return callback();
27616 }
27617
27618 var interaction = {
27619 __count: 1,
27620 id: interactionIDCounter++,
27621 name: name,
27622 timestamp: timestamp
27623 };
27624
27625 var prevInteractions = exports.__interactionsRef.current;
27626
27627 // Traced interactions should stack/accumulate.
27628 // To do that, clone the current interactions.
27629 // The previous set will be restored upon completion.
27630 var interactions = new Set(prevInteractions);
27631 interactions.add(interaction);
27632 exports.__interactionsRef.current = interactions;
27633
27634 var subscriber = exports.__subscriberRef.current;
27635 var returnValue = void 0;
27636
27637 try {
27638 if (subscriber !== null) {
27639 subscriber.onInteractionTraced(interaction);
27640 }
27641 } finally {
27642 try {
27643 if (subscriber !== null) {
27644 subscriber.onWorkStarted(interactions, threadID);
27645 }
27646 } finally {
27647 try {
27648 returnValue = callback();
27649 } finally {
27650 exports.__interactionsRef.current = prevInteractions;
27651
27652 try {
27653 if (subscriber !== null) {
27654 subscriber.onWorkStopped(interactions, threadID);
27655 }
27656 } finally {
27657 interaction.__count--;
27658
27659 // If no async work was scheduled for this interaction,
27660 // Notify subscribers that it's completed.
27661 if (subscriber !== null && interaction.__count === 0) {
27662 subscriber.onInteractionScheduledWorkCompleted(interaction);
27663 }
27664 }
27665 }
27666 }
27667 }
27668
27669 return returnValue;
27670}
27671
27672function unstable_wrap(callback) {
27673 var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
27674
27675 if (!enableSchedulerTracing) {
27676 return callback;
27677 }
27678
27679 var wrappedInteractions = exports.__interactionsRef.current;
27680
27681 var subscriber = exports.__subscriberRef.current;
27682 if (subscriber !== null) {
27683 subscriber.onWorkScheduled(wrappedInteractions, threadID);
27684 }
27685
27686 // Update the pending async work count for the current interactions.
27687 // Update after calling subscribers in case of error.
27688 wrappedInteractions.forEach(function (interaction) {
27689 interaction.__count++;
27690 });
27691
27692 var hasRun = false;
27693
27694 function wrapped() {
27695 var prevInteractions = exports.__interactionsRef.current;
27696 exports.__interactionsRef.current = wrappedInteractions;
27697
27698 subscriber = exports.__subscriberRef.current;
27699
27700 try {
27701 var returnValue = void 0;
27702
27703 try {
27704 if (subscriber !== null) {
27705 subscriber.onWorkStarted(wrappedInteractions, threadID);
27706 }
27707 } finally {
27708 try {
27709 returnValue = callback.apply(undefined, arguments);
27710 } finally {
27711 exports.__interactionsRef.current = prevInteractions;
27712
27713 if (subscriber !== null) {
27714 subscriber.onWorkStopped(wrappedInteractions, threadID);
27715 }
27716 }
27717 }
27718
27719 return returnValue;
27720 } finally {
27721 if (!hasRun) {
27722 // We only expect a wrapped function to be executed once,
27723 // But in the event that it's executed more than once–
27724 // Only decrement the outstanding interaction counts once.
27725 hasRun = true;
27726
27727 // Update pending async counts for all wrapped interactions.
27728 // If this was the last scheduled async work for any of them,
27729 // Mark them as completed.
27730 wrappedInteractions.forEach(function (interaction) {
27731 interaction.__count--;
27732
27733 if (subscriber !== null && interaction.__count === 0) {
27734 subscriber.onInteractionScheduledWorkCompleted(interaction);
27735 }
27736 });
27737 }
27738 }
27739 }
27740
27741 wrapped.cancel = function cancel() {
27742 subscriber = exports.__subscriberRef.current;
27743
27744 try {
27745 if (subscriber !== null) {
27746 subscriber.onWorkCanceled(wrappedInteractions, threadID);
27747 }
27748 } finally {
27749 // Update pending async counts for all wrapped interactions.
27750 // If this was the last scheduled async work for any of them,
27751 // Mark them as completed.
27752 wrappedInteractions.forEach(function (interaction) {
27753 interaction.__count--;
27754
27755 if (subscriber && interaction.__count === 0) {
27756 subscriber.onInteractionScheduledWorkCompleted(interaction);
27757 }
27758 });
27759 }
27760 };
27761
27762 return wrapped;
27763}
27764
27765var subscribers = null;
27766if (enableSchedulerTracing) {
27767 subscribers = new Set();
27768}
27769
27770function unstable_subscribe(subscriber) {
27771 if (enableSchedulerTracing) {
27772 subscribers.add(subscriber);
27773
27774 if (subscribers.size === 1) {
27775 exports.__subscriberRef.current = {
27776 onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
27777 onInteractionTraced: onInteractionTraced,
27778 onWorkCanceled: onWorkCanceled,
27779 onWorkScheduled: onWorkScheduled,
27780 onWorkStarted: onWorkStarted,
27781 onWorkStopped: onWorkStopped
27782 };
27783 }
27784 }
27785}
27786
27787function unstable_unsubscribe(subscriber) {
27788 if (enableSchedulerTracing) {
27789 subscribers.delete(subscriber);
27790
27791 if (subscribers.size === 0) {
27792 exports.__subscriberRef.current = null;
27793 }
27794 }
27795}
27796
27797function onInteractionTraced(interaction) {
27798 var didCatchError = false;
27799 var caughtError = null;
27800
27801 subscribers.forEach(function (subscriber) {
27802 try {
27803 subscriber.onInteractionTraced(interaction);
27804 } catch (error) {
27805 if (!didCatchError) {
27806 didCatchError = true;
27807 caughtError = error;
27808 }
27809 }
27810 });
27811
27812 if (didCatchError) {
27813 throw caughtError;
27814 }
27815}
27816
27817function onInteractionScheduledWorkCompleted(interaction) {
27818 var didCatchError = false;
27819 var caughtError = null;
27820
27821 subscribers.forEach(function (subscriber) {
27822 try {
27823 subscriber.onInteractionScheduledWorkCompleted(interaction);
27824 } catch (error) {
27825 if (!didCatchError) {
27826 didCatchError = true;
27827 caughtError = error;
27828 }
27829 }
27830 });
27831
27832 if (didCatchError) {
27833 throw caughtError;
27834 }
27835}
27836
27837function onWorkScheduled(interactions, threadID) {
27838 var didCatchError = false;
27839 var caughtError = null;
27840
27841 subscribers.forEach(function (subscriber) {
27842 try {
27843 subscriber.onWorkScheduled(interactions, threadID);
27844 } catch (error) {
27845 if (!didCatchError) {
27846 didCatchError = true;
27847 caughtError = error;
27848 }
27849 }
27850 });
27851
27852 if (didCatchError) {
27853 throw caughtError;
27854 }
27855}
27856
27857function onWorkStarted(interactions, threadID) {
27858 var didCatchError = false;
27859 var caughtError = null;
27860
27861 subscribers.forEach(function (subscriber) {
27862 try {
27863 subscriber.onWorkStarted(interactions, threadID);
27864 } catch (error) {
27865 if (!didCatchError) {
27866 didCatchError = true;
27867 caughtError = error;
27868 }
27869 }
27870 });
27871
27872 if (didCatchError) {
27873 throw caughtError;
27874 }
27875}
27876
27877function onWorkStopped(interactions, threadID) {
27878 var didCatchError = false;
27879 var caughtError = null;
27880
27881 subscribers.forEach(function (subscriber) {
27882 try {
27883 subscriber.onWorkStopped(interactions, threadID);
27884 } catch (error) {
27885 if (!didCatchError) {
27886 didCatchError = true;
27887 caughtError = error;
27888 }
27889 }
27890 });
27891
27892 if (didCatchError) {
27893 throw caughtError;
27894 }
27895}
27896
27897function onWorkCanceled(interactions, threadID) {
27898 var didCatchError = false;
27899 var caughtError = null;
27900
27901 subscribers.forEach(function (subscriber) {
27902 try {
27903 subscriber.onWorkCanceled(interactions, threadID);
27904 } catch (error) {
27905 if (!didCatchError) {
27906 didCatchError = true;
27907 caughtError = error;
27908 }
27909 }
27910 });
27911
27912 if (didCatchError) {
27913 throw caughtError;
27914 }
27915}
27916
27917exports.unstable_clear = unstable_clear;
27918exports.unstable_getCurrent = unstable_getCurrent;
27919exports.unstable_getThreadID = unstable_getThreadID;
27920exports.unstable_trace = unstable_trace;
27921exports.unstable_wrap = unstable_wrap;
27922exports.unstable_subscribe = unstable_subscribe;
27923exports.unstable_unsubscribe = unstable_unsubscribe;
27924 })();
27925}
27926
27927},{}],68:[function(require,module,exports){
27928/** @license React v0.12.0
27929 * scheduler-tracing.production.min.js
27930 *
27931 * Copyright (c) Facebook, Inc. and its affiliates.
27932 *
27933 * This source code is licensed under the MIT license found in the
27934 * LICENSE file in the root directory of this source tree.
27935 */
27936
27937'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var b=0;exports.__interactionsRef=null;exports.__subscriberRef=null;exports.unstable_clear=function(a){return a()};exports.unstable_getCurrent=function(){return null};exports.unstable_getThreadID=function(){return++b};exports.unstable_trace=function(a,d,c){return c()};exports.unstable_wrap=function(a){return a};exports.unstable_subscribe=function(){};exports.unstable_unsubscribe=function(){};
27938
27939},{}],69:[function(require,module,exports){
27940(function (global){
27941/** @license React v0.12.0
27942 * scheduler.development.js
27943 *
27944 * Copyright (c) Facebook, Inc. and its affiliates.
27945 *
27946 * This source code is licensed under the MIT license found in the
27947 * LICENSE file in the root directory of this source tree.
27948 */
27949
27950'use strict';
27951
27952
27953
27954if ("development" !== "production") {
27955 (function() {
27956'use strict';
27957
27958Object.defineProperty(exports, '__esModule', { value: true });
27959
27960// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
27961
27962
27963// In some cases, StrictMode should also double-render lifecycles.
27964// This can be confusing for tests though,
27965// And it can be bad for performance in production.
27966// This feature flag can be used to control the behavior:
27967
27968
27969// To preserve the "Pause on caught exceptions" behavior of the debugger, we
27970// replay the begin phase of a failed component inside invokeGuardedCallback.
27971
27972
27973// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
27974
27975
27976// Gather advanced timing metrics for Profiler subtrees.
27977
27978
27979// Trace which interactions trigger each commit.
27980
27981
27982// Only used in www builds.
27983 // TODO: true? Here it might just be false.
27984
27985// Only used in www builds.
27986var enableSchedulerDebugging = true;
27987
27988// Only used in www builds.
27989
27990
27991// React Fire: prevent the value and checked attributes from syncing
27992// with their related DOM properties
27993
27994
27995// These APIs will no longer be "unstable" in the upcoming 16.7 release,
27996// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
27997
27998/* eslint-disable no-var */
27999
28000// TODO: Use symbols?
28001var ImmediatePriority = 1;
28002var UserBlockingPriority = 2;
28003var NormalPriority = 3;
28004var LowPriority = 4;
28005var IdlePriority = 5;
28006
28007// Max 31 bit integer. The max integer size in V8 for 32-bit systems.
28008// Math.pow(2, 30) - 1
28009// 0b111111111111111111111111111111
28010var maxSigned31BitInt = 1073741823;
28011
28012// Times out immediately
28013var IMMEDIATE_PRIORITY_TIMEOUT = -1;
28014// Eventually times out
28015var USER_BLOCKING_PRIORITY = 250;
28016var NORMAL_PRIORITY_TIMEOUT = 5000;
28017var LOW_PRIORITY_TIMEOUT = 10000;
28018// Never times out
28019var IDLE_PRIORITY = maxSigned31BitInt;
28020
28021// Callbacks are stored as a circular, doubly linked list.
28022var firstCallbackNode = null;
28023
28024var currentDidTimeout = false;
28025// Pausing the scheduler is useful for debugging.
28026var isSchedulerPaused = false;
28027
28028var currentPriorityLevel = NormalPriority;
28029var currentEventStartTime = -1;
28030var currentExpirationTime = -1;
28031
28032// This is set when a callback is being executed, to prevent re-entrancy.
28033var isExecutingCallback = false;
28034
28035var isHostCallbackScheduled = false;
28036
28037var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
28038
28039function ensureHostCallbackIsScheduled() {
28040 if (isExecutingCallback) {
28041 // Don't schedule work yet; wait until the next time we yield.
28042 return;
28043 }
28044 // Schedule the host callback using the earliest expiration in the list.
28045 var expirationTime = firstCallbackNode.expirationTime;
28046 if (!isHostCallbackScheduled) {
28047 isHostCallbackScheduled = true;
28048 } else {
28049 // Cancel the existing host callback.
28050 cancelHostCallback();
28051 }
28052 requestHostCallback(flushWork, expirationTime);
28053}
28054
28055function flushFirstCallback() {
28056 var flushedNode = firstCallbackNode;
28057
28058 // Remove the node from the list before calling the callback. That way the
28059 // list is in a consistent state even if the callback throws.
28060 var next = firstCallbackNode.next;
28061 if (firstCallbackNode === next) {
28062 // This is the last callback in the list.
28063 firstCallbackNode = null;
28064 next = null;
28065 } else {
28066 var lastCallbackNode = firstCallbackNode.previous;
28067 firstCallbackNode = lastCallbackNode.next = next;
28068 next.previous = lastCallbackNode;
28069 }
28070
28071 flushedNode.next = flushedNode.previous = null;
28072
28073 // Now it's safe to call the callback.
28074 var callback = flushedNode.callback;
28075 var expirationTime = flushedNode.expirationTime;
28076 var priorityLevel = flushedNode.priorityLevel;
28077 var previousPriorityLevel = currentPriorityLevel;
28078 var previousExpirationTime = currentExpirationTime;
28079 currentPriorityLevel = priorityLevel;
28080 currentExpirationTime = expirationTime;
28081 var continuationCallback;
28082 try {
28083 continuationCallback = callback();
28084 } finally {
28085 currentPriorityLevel = previousPriorityLevel;
28086 currentExpirationTime = previousExpirationTime;
28087 }
28088
28089 // A callback may return a continuation. The continuation should be scheduled
28090 // with the same priority and expiration as the just-finished callback.
28091 if (typeof continuationCallback === 'function') {
28092 var continuationNode = {
28093 callback: continuationCallback,
28094 priorityLevel: priorityLevel,
28095 expirationTime: expirationTime,
28096 next: null,
28097 previous: null
28098 };
28099
28100 // Insert the new callback into the list, sorted by its expiration. This is
28101 // almost the same as the code in `scheduleCallback`, except the callback
28102 // is inserted into the list *before* callbacks of equal expiration instead
28103 // of after.
28104 if (firstCallbackNode === null) {
28105 // This is the first callback in the list.
28106 firstCallbackNode = continuationNode.next = continuationNode.previous = continuationNode;
28107 } else {
28108 var nextAfterContinuation = null;
28109 var node = firstCallbackNode;
28110 do {
28111 if (node.expirationTime >= expirationTime) {
28112 // This callback expires at or after the continuation. We will insert
28113 // the continuation *before* this callback.
28114 nextAfterContinuation = node;
28115 break;
28116 }
28117 node = node.next;
28118 } while (node !== firstCallbackNode);
28119
28120 if (nextAfterContinuation === null) {
28121 // No equal or lower priority callback was found, which means the new
28122 // callback is the lowest priority callback in the list.
28123 nextAfterContinuation = firstCallbackNode;
28124 } else if (nextAfterContinuation === firstCallbackNode) {
28125 // The new callback is the highest priority callback in the list.
28126 firstCallbackNode = continuationNode;
28127 ensureHostCallbackIsScheduled();
28128 }
28129
28130 var previous = nextAfterContinuation.previous;
28131 previous.next = nextAfterContinuation.previous = continuationNode;
28132 continuationNode.next = nextAfterContinuation;
28133 continuationNode.previous = previous;
28134 }
28135 }
28136}
28137
28138function flushImmediateWork() {
28139 if (
28140 // Confirm we've exited the outer most event handler
28141 currentEventStartTime === -1 && firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority) {
28142 isExecutingCallback = true;
28143 try {
28144 do {
28145 flushFirstCallback();
28146 } while (
28147 // Keep flushing until there are no more immediate callbacks
28148 firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority);
28149 } finally {
28150 isExecutingCallback = false;
28151 if (firstCallbackNode !== null) {
28152 // There's still work remaining. Request another callback.
28153 ensureHostCallbackIsScheduled();
28154 } else {
28155 isHostCallbackScheduled = false;
28156 }
28157 }
28158 }
28159}
28160
28161function flushWork(didTimeout) {
28162 // Exit right away if we're currently paused
28163
28164 if (enableSchedulerDebugging && isSchedulerPaused) {
28165 return;
28166 }
28167
28168 isExecutingCallback = true;
28169 var previousDidTimeout = currentDidTimeout;
28170 currentDidTimeout = didTimeout;
28171 try {
28172 if (didTimeout) {
28173 // Flush all the expired callbacks without yielding.
28174 while (firstCallbackNode !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
28175 // TODO Wrap i nfeature flag
28176 // Read the current time. Flush all the callbacks that expire at or
28177 // earlier than that time. Then read the current time again and repeat.
28178 // This optimizes for as few performance.now calls as possible.
28179 var currentTime = exports.unstable_now();
28180 if (firstCallbackNode.expirationTime <= currentTime) {
28181 do {
28182 flushFirstCallback();
28183 } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime && !(enableSchedulerDebugging && isSchedulerPaused));
28184 continue;
28185 }
28186 break;
28187 }
28188 } else {
28189 // Keep flushing callbacks until we run out of time in the frame.
28190 if (firstCallbackNode !== null) {
28191 do {
28192 if (enableSchedulerDebugging && isSchedulerPaused) {
28193 break;
28194 }
28195 flushFirstCallback();
28196 } while (firstCallbackNode !== null && !shouldYieldToHost());
28197 }
28198 }
28199 } finally {
28200 isExecutingCallback = false;
28201 currentDidTimeout = previousDidTimeout;
28202 if (firstCallbackNode !== null) {
28203 // There's still work remaining. Request another callback.
28204 ensureHostCallbackIsScheduled();
28205 } else {
28206 isHostCallbackScheduled = false;
28207 }
28208 // Before exiting, flush all the immediate work that was scheduled.
28209 flushImmediateWork();
28210 }
28211}
28212
28213function unstable_runWithPriority(priorityLevel, eventHandler) {
28214 switch (priorityLevel) {
28215 case ImmediatePriority:
28216 case UserBlockingPriority:
28217 case NormalPriority:
28218 case LowPriority:
28219 case IdlePriority:
28220 break;
28221 default:
28222 priorityLevel = NormalPriority;
28223 }
28224
28225 var previousPriorityLevel = currentPriorityLevel;
28226 var previousEventStartTime = currentEventStartTime;
28227 currentPriorityLevel = priorityLevel;
28228 currentEventStartTime = exports.unstable_now();
28229
28230 try {
28231 return eventHandler();
28232 } finally {
28233 currentPriorityLevel = previousPriorityLevel;
28234 currentEventStartTime = previousEventStartTime;
28235
28236 // Before exiting, flush all the immediate work that was scheduled.
28237 flushImmediateWork();
28238 }
28239}
28240
28241function unstable_wrapCallback(callback) {
28242 var parentPriorityLevel = currentPriorityLevel;
28243 return function () {
28244 // This is a fork of runWithPriority, inlined for performance.
28245 var previousPriorityLevel = currentPriorityLevel;
28246 var previousEventStartTime = currentEventStartTime;
28247 currentPriorityLevel = parentPriorityLevel;
28248 currentEventStartTime = exports.unstable_now();
28249
28250 try {
28251 return callback.apply(this, arguments);
28252 } finally {
28253 currentPriorityLevel = previousPriorityLevel;
28254 currentEventStartTime = previousEventStartTime;
28255 flushImmediateWork();
28256 }
28257 };
28258}
28259
28260function unstable_scheduleCallback(callback, deprecated_options) {
28261 var startTime = currentEventStartTime !== -1 ? currentEventStartTime : exports.unstable_now();
28262
28263 var expirationTime;
28264 if (typeof deprecated_options === 'object' && deprecated_options !== null && typeof deprecated_options.timeout === 'number') {
28265 // FIXME: Remove this branch once we lift expiration times out of React.
28266 expirationTime = startTime + deprecated_options.timeout;
28267 } else {
28268 switch (currentPriorityLevel) {
28269 case ImmediatePriority:
28270 expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
28271 break;
28272 case UserBlockingPriority:
28273 expirationTime = startTime + USER_BLOCKING_PRIORITY;
28274 break;
28275 case IdlePriority:
28276 expirationTime = startTime + IDLE_PRIORITY;
28277 break;
28278 case LowPriority:
28279 expirationTime = startTime + LOW_PRIORITY_TIMEOUT;
28280 break;
28281 case NormalPriority:
28282 default:
28283 expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
28284 }
28285 }
28286
28287 var newNode = {
28288 callback: callback,
28289 priorityLevel: currentPriorityLevel,
28290 expirationTime: expirationTime,
28291 next: null,
28292 previous: null
28293 };
28294
28295 // Insert the new callback into the list, ordered first by expiration, then
28296 // by insertion. So the new callback is inserted any other callback with
28297 // equal expiration.
28298 if (firstCallbackNode === null) {
28299 // This is the first callback in the list.
28300 firstCallbackNode = newNode.next = newNode.previous = newNode;
28301 ensureHostCallbackIsScheduled();
28302 } else {
28303 var next = null;
28304 var node = firstCallbackNode;
28305 do {
28306 if (node.expirationTime > expirationTime) {
28307 // The new callback expires before this one.
28308 next = node;
28309 break;
28310 }
28311 node = node.next;
28312 } while (node !== firstCallbackNode);
28313
28314 if (next === null) {
28315 // No callback with a later expiration was found, which means the new
28316 // callback has the latest expiration in the list.
28317 next = firstCallbackNode;
28318 } else if (next === firstCallbackNode) {
28319 // The new callback has the earliest expiration in the entire list.
28320 firstCallbackNode = newNode;
28321 ensureHostCallbackIsScheduled();
28322 }
28323
28324 var previous = next.previous;
28325 previous.next = next.previous = newNode;
28326 newNode.next = next;
28327 newNode.previous = previous;
28328 }
28329
28330 return newNode;
28331}
28332
28333function unstable_pauseExecution() {
28334 isSchedulerPaused = true;
28335}
28336
28337function unstable_continueExecution() {
28338 isSchedulerPaused = false;
28339 if (firstCallbackNode !== null) {
28340 ensureHostCallbackIsScheduled();
28341 }
28342}
28343
28344function unstable_getFirstCallbackNode() {
28345 return firstCallbackNode;
28346}
28347
28348function unstable_cancelCallback(callbackNode) {
28349 var next = callbackNode.next;
28350 if (next === null) {
28351 // Already cancelled.
28352 return;
28353 }
28354
28355 if (next === callbackNode) {
28356 // This is the only scheduled callback. Clear the list.
28357 firstCallbackNode = null;
28358 } else {
28359 // Remove the callback from its position in the list.
28360 if (callbackNode === firstCallbackNode) {
28361 firstCallbackNode = next;
28362 }
28363 var previous = callbackNode.previous;
28364 previous.next = next;
28365 next.previous = previous;
28366 }
28367
28368 callbackNode.next = callbackNode.previous = null;
28369}
28370
28371function unstable_getCurrentPriorityLevel() {
28372 return currentPriorityLevel;
28373}
28374
28375function unstable_shouldYield() {
28376 return !currentDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost());
28377}
28378
28379// The remaining code is essentially a polyfill for requestIdleCallback. It
28380// works by scheduling a requestAnimationFrame, storing the time for the start
28381// of the frame, then scheduling a postMessage which gets scheduled after paint.
28382// Within the postMessage handler do as much work as possible until time + frame
28383// rate. By separating the idle call into a separate event tick we ensure that
28384// layout, paint and other browser work is counted against the available time.
28385// The frame rate is dynamically adjusted.
28386
28387// We capture a local reference to any global, in case it gets polyfilled after
28388// this module is initially evaluated. We want to be using a
28389// consistent implementation.
28390var localDate = Date;
28391
28392// This initialization code may run even on server environments if a component
28393// just imports ReactDOM (e.g. for findDOMNode). Some environments might not
28394// have setTimeout or clearTimeout. However, we always expect them to be defined
28395// on the client. https://github.com/facebook/react/pull/13088
28396var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
28397var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
28398
28399// We don't expect either of these to necessarily be defined, but we will error
28400// later if they are missing on the client.
28401var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
28402var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
28403
28404// requestAnimationFrame does not run when the tab is in the background. If
28405// we're backgrounded we prefer for that work to happen so that the page
28406// continues to load in the background. So we also schedule a 'setTimeout' as
28407// a fallback.
28408// TODO: Need a better heuristic for backgrounded work.
28409var ANIMATION_FRAME_TIMEOUT = 100;
28410var rAFID;
28411var rAFTimeoutID;
28412var requestAnimationFrameWithTimeout = function (callback) {
28413 // schedule rAF and also a setTimeout
28414 rAFID = localRequestAnimationFrame(function (timestamp) {
28415 // cancel the setTimeout
28416 localClearTimeout(rAFTimeoutID);
28417 callback(timestamp);
28418 });
28419 rAFTimeoutID = localSetTimeout(function () {
28420 // cancel the requestAnimationFrame
28421 localCancelAnimationFrame(rAFID);
28422 callback(exports.unstable_now());
28423 }, ANIMATION_FRAME_TIMEOUT);
28424};
28425
28426if (hasNativePerformanceNow) {
28427 var Performance = performance;
28428 exports.unstable_now = function () {
28429 return Performance.now();
28430 };
28431} else {
28432 exports.unstable_now = function () {
28433 return localDate.now();
28434 };
28435}
28436
28437var requestHostCallback;
28438var cancelHostCallback;
28439var shouldYieldToHost;
28440
28441var globalValue = null;
28442if (typeof window !== 'undefined') {
28443 globalValue = window;
28444} else if (typeof global !== 'undefined') {
28445 globalValue = global;
28446}
28447
28448if (globalValue && globalValue._schedMock) {
28449 // Dynamic injection, only for testing purposes.
28450 var globalImpl = globalValue._schedMock;
28451 requestHostCallback = globalImpl[0];
28452 cancelHostCallback = globalImpl[1];
28453 shouldYieldToHost = globalImpl[2];
28454 exports.unstable_now = globalImpl[3];
28455} else if (
28456// If Scheduler runs in a non-DOM environment, it falls back to a naive
28457// implementation using setTimeout.
28458typeof window === 'undefined' ||
28459// Check if MessageChannel is supported, too.
28460typeof MessageChannel !== 'function') {
28461 // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
28462 // fallback to a naive implementation.
28463 var _callback = null;
28464 var _flushCallback = function (didTimeout) {
28465 if (_callback !== null) {
28466 try {
28467 _callback(didTimeout);
28468 } finally {
28469 _callback = null;
28470 }
28471 }
28472 };
28473 requestHostCallback = function (cb, ms) {
28474 if (_callback !== null) {
28475 // Protect against re-entrancy.
28476 setTimeout(requestHostCallback, 0, cb);
28477 } else {
28478 _callback = cb;
28479 setTimeout(_flushCallback, 0, false);
28480 }
28481 };
28482 cancelHostCallback = function () {
28483 _callback = null;
28484 };
28485 shouldYieldToHost = function () {
28486 return false;
28487 };
28488} else {
28489 if (typeof console !== 'undefined') {
28490 // TODO: Remove fb.me link
28491 if (typeof localRequestAnimationFrame !== 'function') {
28492 console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
28493 }
28494 if (typeof localCancelAnimationFrame !== 'function') {
28495 console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
28496 }
28497 }
28498
28499 var scheduledHostCallback = null;
28500 var isMessageEventScheduled = false;
28501 var timeoutTime = -1;
28502
28503 var isAnimationFrameScheduled = false;
28504
28505 var isFlushingHostCallback = false;
28506
28507 var frameDeadline = 0;
28508 // We start out assuming that we run at 30fps but then the heuristic tracking
28509 // will adjust this value to a faster fps if we get more frequent animation
28510 // frames.
28511 var previousFrameTime = 33;
28512 var activeFrameTime = 33;
28513
28514 shouldYieldToHost = function () {
28515 return frameDeadline <= exports.unstable_now();
28516 };
28517
28518 // We use the postMessage trick to defer idle work until after the repaint.
28519 var channel = new MessageChannel();
28520 var port = channel.port2;
28521 channel.port1.onmessage = function (event) {
28522 isMessageEventScheduled = false;
28523
28524 var prevScheduledCallback = scheduledHostCallback;
28525 var prevTimeoutTime = timeoutTime;
28526 scheduledHostCallback = null;
28527 timeoutTime = -1;
28528
28529 var currentTime = exports.unstable_now();
28530
28531 var didTimeout = false;
28532 if (frameDeadline - currentTime <= 0) {
28533 // There's no time left in this idle period. Check if the callback has
28534 // a timeout and whether it's been exceeded.
28535 if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) {
28536 // Exceeded the timeout. Invoke the callback even though there's no
28537 // time left.
28538 didTimeout = true;
28539 } else {
28540 // No timeout.
28541 if (!isAnimationFrameScheduled) {
28542 // Schedule another animation callback so we retry later.
28543 isAnimationFrameScheduled = true;
28544 requestAnimationFrameWithTimeout(animationTick);
28545 }
28546 // Exit without invoking the callback.
28547 scheduledHostCallback = prevScheduledCallback;
28548 timeoutTime = prevTimeoutTime;
28549 return;
28550 }
28551 }
28552
28553 if (prevScheduledCallback !== null) {
28554 isFlushingHostCallback = true;
28555 try {
28556 prevScheduledCallback(didTimeout);
28557 } finally {
28558 isFlushingHostCallback = false;
28559 }
28560 }
28561 };
28562
28563 var animationTick = function (rafTime) {
28564 if (scheduledHostCallback !== null) {
28565 // Eagerly schedule the next animation callback at the beginning of the
28566 // frame. If the scheduler queue is not empty at the end of the frame, it
28567 // will continue flushing inside that callback. If the queue *is* empty,
28568 // then it will exit immediately. Posting the callback at the start of the
28569 // frame ensures it's fired within the earliest possible frame. If we
28570 // waited until the end of the frame to post the callback, we risk the
28571 // browser skipping a frame and not firing the callback until the frame
28572 // after that.
28573 requestAnimationFrameWithTimeout(animationTick);
28574 } else {
28575 // No pending work. Exit.
28576 isAnimationFrameScheduled = false;
28577 return;
28578 }
28579
28580 var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
28581 if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
28582 if (nextFrameTime < 8) {
28583 // Defensive coding. We don't support higher frame rates than 120hz.
28584 // If the calculated frame time gets lower than 8, it is probably a bug.
28585 nextFrameTime = 8;
28586 }
28587 // If one frame goes long, then the next one can be short to catch up.
28588 // If two frames are short in a row, then that's an indication that we
28589 // actually have a higher frame rate than what we're currently optimizing.
28590 // We adjust our heuristic dynamically accordingly. For example, if we're
28591 // running on 120hz display or 90hz VR display.
28592 // Take the max of the two in case one of them was an anomaly due to
28593 // missed frame deadlines.
28594 activeFrameTime = nextFrameTime < previousFrameTime ? previousFrameTime : nextFrameTime;
28595 } else {
28596 previousFrameTime = nextFrameTime;
28597 }
28598 frameDeadline = rafTime + activeFrameTime;
28599 if (!isMessageEventScheduled) {
28600 isMessageEventScheduled = true;
28601 port.postMessage(undefined);
28602 }
28603 };
28604
28605 requestHostCallback = function (callback, absoluteTimeout) {
28606 scheduledHostCallback = callback;
28607 timeoutTime = absoluteTimeout;
28608 if (isFlushingHostCallback || absoluteTimeout < 0) {
28609 // Don't wait for the next frame. Continue working ASAP, in a new event.
28610 port.postMessage(undefined);
28611 } else if (!isAnimationFrameScheduled) {
28612 // If rAF didn't already schedule one, we need to schedule a frame.
28613 // TODO: If this rAF doesn't materialize because the browser throttles, we
28614 // might want to still have setTimeout trigger rIC as a backup to ensure
28615 // that we keep performing work.
28616 isAnimationFrameScheduled = true;
28617 requestAnimationFrameWithTimeout(animationTick);
28618 }
28619 };
28620
28621 cancelHostCallback = function () {
28622 scheduledHostCallback = null;
28623 isMessageEventScheduled = false;
28624 timeoutTime = -1;
28625 };
28626}
28627
28628exports.unstable_ImmediatePriority = ImmediatePriority;
28629exports.unstable_UserBlockingPriority = UserBlockingPriority;
28630exports.unstable_NormalPriority = NormalPriority;
28631exports.unstable_IdlePriority = IdlePriority;
28632exports.unstable_LowPriority = LowPriority;
28633exports.unstable_runWithPriority = unstable_runWithPriority;
28634exports.unstable_scheduleCallback = unstable_scheduleCallback;
28635exports.unstable_cancelCallback = unstable_cancelCallback;
28636exports.unstable_wrapCallback = unstable_wrapCallback;
28637exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
28638exports.unstable_shouldYield = unstable_shouldYield;
28639exports.unstable_continueExecution = unstable_continueExecution;
28640exports.unstable_pauseExecution = unstable_pauseExecution;
28641exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
28642 })();
28643}
28644
28645}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28646
28647},{}],70:[function(require,module,exports){
28648(function (global){
28649/** @license React v0.12.0
28650 * scheduler.production.min.js
28651 *
28652 * Copyright (c) Facebook, Inc. and its affiliates.
28653 *
28654 * This source code is licensed under the MIT license found in the
28655 * LICENSE file in the root directory of this source tree.
28656 */
28657
28658'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var c=null,f=!1,h=3,k=-1,l=-1,m=!1,n=!1;function p(){if(!m){var a=c.expirationTime;n?q():n=!0;r(t,a)}}
28659function u(){var a=c,b=c.next;if(c===b)c=null;else{var d=c.previous;c=d.next=b;b.previous=d}a.next=a.previous=null;d=a.callback;b=a.expirationTime;a=a.priorityLevel;var e=h,Q=l;h=a;l=b;try{var g=d()}finally{h=e,l=Q}if("function"===typeof g)if(g={callback:g,priorityLevel:a,expirationTime:b,next:null,previous:null},null===c)c=g.next=g.previous=g;else{d=null;a=c;do{if(a.expirationTime>=b){d=a;break}a=a.next}while(a!==c);null===d?d=c:d===c&&(c=g,p());b=d.previous;b.next=d.previous=g;g.next=d;g.previous=
28660b}}function v(){if(-1===k&&null!==c&&1===c.priorityLevel){m=!0;try{do u();while(null!==c&&1===c.priorityLevel)}finally{m=!1,null!==c?p():n=!1}}}function t(a){m=!0;var b=f;f=a;try{if(a)for(;null!==c;){var d=exports.unstable_now();if(c.expirationTime<=d){do u();while(null!==c&&c.expirationTime<=d)}else break}else if(null!==c){do u();while(null!==c&&!w())}}finally{m=!1,f=b,null!==c?p():n=!1,v()}}
28661var x=Date,y="function"===typeof setTimeout?setTimeout:void 0,z="function"===typeof clearTimeout?clearTimeout:void 0,A="function"===typeof requestAnimationFrame?requestAnimationFrame:void 0,B="function"===typeof cancelAnimationFrame?cancelAnimationFrame:void 0,C,D;function E(a){C=A(function(b){z(D);a(b)});D=y(function(){B(C);a(exports.unstable_now())},100)}
28662if("object"===typeof performance&&"function"===typeof performance.now){var F=performance;exports.unstable_now=function(){return F.now()}}else exports.unstable_now=function(){return x.now()};var r,q,w,G=null;"undefined"!==typeof window?G=window:"undefined"!==typeof global&&(G=global);
28663if(G&&G._schedMock){var H=G._schedMock;r=H[0];q=H[1];w=H[2];exports.unstable_now=H[3]}else if("undefined"===typeof window||"function"!==typeof MessageChannel){var I=null,J=function(a){if(null!==I)try{I(a)}finally{I=null}};r=function(a){null!==I?setTimeout(r,0,a):(I=a,setTimeout(J,0,!1))};q=function(){I=null};w=function(){return!1}}else{"undefined"!==typeof console&&("function"!==typeof A&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),
28664"function"!==typeof B&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var K=null,L=!1,M=-1,N=!1,O=!1,P=0,R=33,S=33;w=function(){return P<=exports.unstable_now()};var T=new MessageChannel,U=T.port2;T.port1.onmessage=function(){L=!1;var a=K,b=M;K=null;M=-1;var d=exports.unstable_now(),e=!1;if(0>=P-d)if(-1!==b&&b<=d)e=!0;else{N||(N=!0,E(V));K=a;M=b;return}if(null!==a){O=!0;try{a(e)}finally{O=!1}}};
28665var V=function(a){if(null!==K){E(V);var b=a-P+S;b<S&&R<S?(8>b&&(b=8),S=b<R?R:b):R=b;P=a+S;L||(L=!0,U.postMessage(void 0))}else N=!1};r=function(a,b){K=a;M=b;O||0>b?U.postMessage(void 0):N||(N=!0,E(V))};q=function(){K=null;L=!1;M=-1}}exports.unstable_ImmediatePriority=1;exports.unstable_UserBlockingPriority=2;exports.unstable_NormalPriority=3;exports.unstable_IdlePriority=5;exports.unstable_LowPriority=4;
28666exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var d=h,e=k;h=a;k=exports.unstable_now();try{return b()}finally{h=d,k=e,v()}};
28667exports.unstable_scheduleCallback=function(a,b){var d=-1!==k?k:exports.unstable_now();if("object"===typeof b&&null!==b&&"number"===typeof b.timeout)b=d+b.timeout;else switch(h){case 1:b=d+-1;break;case 2:b=d+250;break;case 5:b=d+1073741823;break;case 4:b=d+1E4;break;default:b=d+5E3}a={callback:a,priorityLevel:h,expirationTime:b,next:null,previous:null};if(null===c)c=a.next=a.previous=a,p();else{d=null;var e=c;do{if(e.expirationTime>b){d=e;break}e=e.next}while(e!==c);null===d?d=c:d===c&&(c=a,p());
28668b=d.previous;b.next=d.previous=a;a.next=d;a.previous=b}return a};exports.unstable_cancelCallback=function(a){var b=a.next;if(null!==b){if(b===a)c=null;else{a===c&&(c=b);var d=a.previous;d.next=b;b.previous=d}a.next=a.previous=null}};exports.unstable_wrapCallback=function(a){var b=h;return function(){var d=h,e=k;h=b;k=exports.unstable_now();try{return a.apply(this,arguments)}finally{h=d,k=e,v()}}};exports.unstable_getCurrentPriorityLevel=function(){return h};
28669exports.unstable_shouldYield=function(){return!f&&(null!==c&&c.expirationTime<l||w())};exports.unstable_continueExecution=function(){null!==c&&p()};exports.unstable_pauseExecution=function(){};exports.unstable_getFirstCallbackNode=function(){return c};
28670
28671}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28672
28673},{}],71:[function(require,module,exports){
28674'use strict';
28675
28676if ("development" === 'production') {
28677 module.exports = require('./cjs/scheduler.production.min.js');
28678} else {
28679 module.exports = require('./cjs/scheduler.development.js');
28680}
28681
28682},{"./cjs/scheduler.development.js":69,"./cjs/scheduler.production.min.js":70}],72:[function(require,module,exports){
28683'use strict';
28684
28685if ("development" === 'production') {
28686 module.exports = require('./cjs/scheduler-tracing.production.min.js');
28687} else {
28688 module.exports = require('./cjs/scheduler-tracing.development.js');
28689}
28690
28691},{"./cjs/scheduler-tracing.development.js":67,"./cjs/scheduler-tracing.production.min.js":68}],73:[function(require,module,exports){
28692'use strict';
28693
28694function _interopDefault (ex) { return 'default' in ex ? ex['default'] : ex; }
28695
28696var toSlugCase = _interopDefault(require('to-slug-case'));
28697
28698/**
28699 * Copyright 2013-present, Facebook, Inc.
28700 * All rights reserved.
28701 *
28702 * This source code is licensed under the BSD-style license found in the
28703 * LICENSE file in the root directory of this source tree. An additional grant
28704 * of patent rights can be found in the PATENTS file in the same directory.
28705 *
28706 * @providesModule CSSProperty
28707 */
28708
28709// https://raw.githubusercontent.com/facebook/react/3b96650e39ddda5ba49245713ef16dbc52d25e9e/src/renderers/dom/shared/CSSProperty.js
28710
28711/**
28712 * CSS properties which accept numbers but are not in units of "px".
28713 */
28714var isUnitlessNumber = {
28715 animationIterationCount: true,
28716 boxFlex: true,
28717 boxFlexGroup: true,
28718 boxOrdinalGroup: true,
28719 columnCount: true,
28720 flex: true,
28721 flexGrow: true,
28722 flexPositive: true,
28723 flexShrink: true,
28724 flexNegative: true,
28725 flexOrder: true,
28726 gridRow: true,
28727 gridColumn: true,
28728 fontWeight: true,
28729 lineClamp: true,
28730 lineHeight: true,
28731 opacity: true,
28732 order: true,
28733 orphans: true,
28734 tabSize: true,
28735 widows: true,
28736 zIndex: true,
28737 zoom: true,
28738
28739 // SVG-related properties
28740 fillOpacity: true,
28741 stopOpacity: true,
28742 strokeDashoffset: true,
28743 strokeOpacity: true,
28744 strokeWidth: true
28745};
28746
28747/**
28748 * @param {string} prefix vendor-specific prefix, eg: Webkit
28749 * @param {string} key style name, eg: transitionDuration
28750 * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
28751 * WebkitTransitionDuration
28752 */
28753function prefixKey(prefix, key) {
28754 return prefix + key.charAt(0).toUpperCase() + key.substring(1);
28755}
28756
28757/**
28758 * Support style names that may come passed in prefixed by adding permutations
28759 * of vendor prefixes.
28760 */
28761var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
28762
28763// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
28764// infinite loop, because it iterates over the newly added props too.
28765Object.keys(isUnitlessNumber).forEach(function (prop) {
28766 prefixes.forEach(function (prefix) {
28767 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
28768 });
28769});
28770
28771var isTouch = 'ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch;
28772var important = isTouch ? '' : '!important';
28773
28774function toCSS(obj) {
28775 return Object.keys(obj).map(function (rawKey) {
28776 var key = toSlugCase(rawKey);
28777 if (/^webkit/.test(key) || /^moz/.test(key) || /^ms/.test(key)) {
28778 key = '-' + key;
28779 }
28780
28781 var value = obj[rawKey];
28782 if (typeof value === 'number' && !(isUnitlessNumber.hasOwnProperty(key) && isUnitlessNumber[key])) {
28783 value = value + 'px';
28784 }
28785
28786 return key + ':' + value + ' ' + important + ';';
28787 }).join('');
28788}
28789
28790module.exports = toCSS;
28791},{"to-slug-case":77}],74:[function(require,module,exports){
28792(function (global){
28793'use strict';
28794
28795Object.defineProperty(exports, "__esModule", {
28796 value: true
28797});
28798
28799var _ponyfill = require('./ponyfill.js');
28800
28801var _ponyfill2 = _interopRequireDefault(_ponyfill);
28802
28803function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
28804
28805var root; /* global window */
28806
28807
28808if (typeof self !== 'undefined') {
28809 root = self;
28810} else if (typeof window !== 'undefined') {
28811 root = window;
28812} else if (typeof global !== 'undefined') {
28813 root = global;
28814} else if (typeof module !== 'undefined') {
28815 root = module;
28816} else {
28817 root = Function('return this')();
28818}
28819
28820var result = (0, _ponyfill2['default'])(root);
28821exports['default'] = result;
28822}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28823
28824},{"./ponyfill.js":75}],75:[function(require,module,exports){
28825'use strict';
28826
28827Object.defineProperty(exports, "__esModule", {
28828 value: true
28829});
28830exports['default'] = symbolObservablePonyfill;
28831function symbolObservablePonyfill(root) {
28832 var result;
28833 var _Symbol = root.Symbol;
28834
28835 if (typeof _Symbol === 'function') {
28836 if (_Symbol.observable) {
28837 result = _Symbol.observable;
28838 } else {
28839 result = _Symbol('observable');
28840 _Symbol.observable = result;
28841 }
28842 } else {
28843 result = '@@observable';
28844 }
28845
28846 return result;
28847};
28848},{}],76:[function(require,module,exports){
28849
28850/**
28851 * Export.
28852 */
28853
28854module.exports = toNoCase
28855
28856/**
28857 * Test whether a string is camel-case.
28858 */
28859
28860var hasSpace = /\s/
28861var hasSeparator = /(_|-|\.|:)/
28862var hasCamel = /([a-z][A-Z]|[A-Z][a-z])/
28863
28864/**
28865 * Remove any starting case from a `string`, like camel or snake, but keep
28866 * spaces and punctuation that may be important otherwise.
28867 *
28868 * @param {String} string
28869 * @return {String}
28870 */
28871
28872function toNoCase(string) {
28873 if (hasSpace.test(string)) return string.toLowerCase()
28874 if (hasSeparator.test(string)) return (unseparate(string) || string).toLowerCase()
28875 if (hasCamel.test(string)) return uncamelize(string).toLowerCase()
28876 return string.toLowerCase()
28877}
28878
28879/**
28880 * Separator splitter.
28881 */
28882
28883var separatorSplitter = /[\W_]+(.|$)/g
28884
28885/**
28886 * Un-separate a `string`.
28887 *
28888 * @param {String} string
28889 * @return {String}
28890 */
28891
28892function unseparate(string) {
28893 return string.replace(separatorSplitter, function (m, next) {
28894 return next ? ' ' + next : ''
28895 })
28896}
28897
28898/**
28899 * Camelcase splitter.
28900 */
28901
28902var camelSplitter = /(.)([A-Z]+)/g
28903
28904/**
28905 * Un-camelcase a `string`.
28906 *
28907 * @param {String} string
28908 * @return {String}
28909 */
28910
28911function uncamelize(string) {
28912 return string.replace(camelSplitter, function (m, previous, uppers) {
28913 return previous + ' ' + uppers.toLowerCase().split('').join(' ')
28914 })
28915}
28916
28917},{}],77:[function(require,module,exports){
28918
28919var toSpace = require('to-space-case')
28920
28921/**
28922 * Export.
28923 */
28924
28925module.exports = toSlugCase
28926
28927/**
28928 * Convert a `string` to slug case.
28929 *
28930 * @param {String} string
28931 * @return {String}
28932 */
28933
28934function toSlugCase(string) {
28935 return toSpace(string).replace(/\s/g, '-')
28936}
28937
28938},{"to-space-case":78}],78:[function(require,module,exports){
28939
28940var clean = require('to-no-case')
28941
28942/**
28943 * Export.
28944 */
28945
28946module.exports = toSpaceCase
28947
28948/**
28949 * Convert a `string` to space case.
28950 *
28951 * @param {String} string
28952 * @return {String}
28953 */
28954
28955function toSpaceCase(string) {
28956 return clean(string).replace(/[\W_]+(.|$)/g, function (matches, match) {
28957 return match ? ' ' + match : ''
28958 }).trim()
28959}
28960
28961},{"to-no-case":76}],79:[function(require,module,exports){
28962/* Web Font Loader v1.6.28 - (c) Adobe Systems, Google. License: Apache 2.0 */(function(){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function p(a,b,c){p=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return p.apply(null,arguments)}var q=Date.now||function(){return+new Date};function ca(a,b){this.a=a;this.o=b||a;this.c=this.o.document}var da=!!window.FontFace;function t(a,b,c,d){b=a.c.createElement(b);if(c)for(var e in c)c.hasOwnProperty(e)&&("style"==e?b.style.cssText=c[e]:b.setAttribute(e,c[e]));d&&b.appendChild(a.c.createTextNode(d));return b}function u(a,b,c){a=a.c.getElementsByTagName(b)[0];a||(a=document.documentElement);a.insertBefore(c,a.lastChild)}function v(a){a.parentNode&&a.parentNode.removeChild(a)}
28963function w(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),e=0;e<b.length;e+=1){for(var f=!1,g=0;g<d.length;g+=1)if(b[e]===d[g]){f=!0;break}f||d.push(b[e])}b=[];for(e=0;e<d.length;e+=1){f=!1;for(g=0;g<c.length;g+=1)if(d[e]===c[g]){f=!0;break}f||b.push(d[e])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function y(a,b){for(var c=a.className.split(/\s+/),d=0,e=c.length;d<e;d++)if(c[d]==b)return!0;return!1}
28964function ea(a){return a.o.location.hostname||a.a.location.hostname}function z(a,b,c){function d(){m&&e&&f&&(m(g),m=null)}b=t(a,"link",{rel:"stylesheet",href:b,media:"all"});var e=!1,f=!0,g=null,m=c||null;da?(b.onload=function(){e=!0;d()},b.onerror=function(){e=!0;g=Error("Stylesheet failed to load");d()}):setTimeout(function(){e=!0;d()},0);u(a,"head",b)}
28965function A(a,b,c,d){var e=a.c.getElementsByTagName("head")[0];if(e){var f=t(a,"script",{src:b}),g=!1;f.onload=f.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,c&&c(null),f.onload=f.onreadystatechange=null,"HEAD"==f.parentNode.tagName&&e.removeChild(f))};e.appendChild(f);setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return f}return null};function B(){this.a=0;this.c=null}function C(a){a.a++;return function(){a.a--;D(a)}}function E(a,b){a.c=b;D(a)}function D(a){0==a.a&&a.c&&(a.c(),a.c=null)};function F(a){this.a=a||"-"}F.prototype.c=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.a)};function G(a,b){this.c=a;this.f=4;this.a="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.a=c[1],this.f=parseInt(c[2],10))}function fa(a){return H(a)+" "+(a.f+"00")+" 300px "+I(a.c)}function I(a){var b=[];a=a.split(/,\s*/);for(var c=0;c<a.length;c++){var d=a[c].replace(/['"]/g,"");-1!=d.indexOf(" ")||/^\d/.test(d)?b.push("'"+d+"'"):b.push(d)}return b.join(",")}function J(a){return a.a+a.f}function H(a){var b="normal";"o"===a.a?b="oblique":"i"===a.a&&(b="italic");return b}
28966function ga(a){var b=4,c="n",d=null;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function ha(a,b){this.c=a;this.f=a.o.document.documentElement;this.h=b;this.a=new F("-");this.j=!1!==b.events;this.g=!1!==b.classes}function ia(a){a.g&&w(a.f,[a.a.c("wf","loading")]);K(a,"loading")}function L(a){if(a.g){var b=y(a.f,a.a.c("wf","active")),c=[],d=[a.a.c("wf","loading")];b||c.push(a.a.c("wf","inactive"));w(a.f,c,d)}K(a,"inactive")}function K(a,b,c){if(a.j&&a.h[b])if(c)a.h[b](c.c,J(c));else a.h[b]()};function ja(){this.c={}}function ka(a,b,c){var d=[],e;for(e in b)if(b.hasOwnProperty(e)){var f=a.c[e];f&&d.push(f(b[e],c))}return d};function M(a,b){this.c=a;this.f=b;this.a=t(this.c,"span",{"aria-hidden":"true"},this.f)}function N(a){u(a.c,"body",a.a)}function O(a){return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+I(a.c)+";"+("font-style:"+H(a)+";font-weight:"+(a.f+"00")+";")};function P(a,b,c,d,e,f){this.g=a;this.j=b;this.a=d;this.c=c;this.f=e||3E3;this.h=f||void 0}P.prototype.start=function(){var a=this.c.o.document,b=this,c=q(),d=new Promise(function(d,e){function f(){q()-c>=b.f?e():a.fonts.load(fa(b.a),b.h).then(function(a){1<=a.length?d():setTimeout(f,25)},function(){e()})}f()}),e=null,f=new Promise(function(a,d){e=setTimeout(d,b.f)});Promise.race([f,d]).then(function(){e&&(clearTimeout(e),e=null);b.g(b.a)},function(){b.j(b.a)})};function Q(a,b,c,d,e,f,g){this.v=a;this.B=b;this.c=c;this.a=d;this.s=g||"BESbswy";this.f={};this.w=e||3E3;this.u=f||null;this.m=this.j=this.h=this.g=null;this.g=new M(this.c,this.s);this.h=new M(this.c,this.s);this.j=new M(this.c,this.s);this.m=new M(this.c,this.s);a=new G(this.a.c+",serif",J(this.a));a=O(a);this.g.a.style.cssText=a;a=new G(this.a.c+",sans-serif",J(this.a));a=O(a);this.h.a.style.cssText=a;a=new G("serif",J(this.a));a=O(a);this.j.a.style.cssText=a;a=new G("sans-serif",J(this.a));a=
28967O(a);this.m.a.style.cssText=a;N(this.g);N(this.h);N(this.j);N(this.m)}var R={D:"serif",C:"sans-serif"},S=null;function T(){if(null===S){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);S=!!a&&(536>parseInt(a[1],10)||536===parseInt(a[1],10)&&11>=parseInt(a[2],10))}return S}Q.prototype.start=function(){this.f.serif=this.j.a.offsetWidth;this.f["sans-serif"]=this.m.a.offsetWidth;this.A=q();U(this)};
28968function la(a,b,c){for(var d in R)if(R.hasOwnProperty(d)&&b===a.f[R[d]]&&c===a.f[R[d]])return!0;return!1}function U(a){var b=a.g.a.offsetWidth,c=a.h.a.offsetWidth,d;(d=b===a.f.serif&&c===a.f["sans-serif"])||(d=T()&&la(a,b,c));d?q()-a.A>=a.w?T()&&la(a,b,c)&&(null===a.u||a.u.hasOwnProperty(a.a.c))?V(a,a.v):V(a,a.B):ma(a):V(a,a.v)}function ma(a){setTimeout(p(function(){U(this)},a),50)}function V(a,b){setTimeout(p(function(){v(this.g.a);v(this.h.a);v(this.j.a);v(this.m.a);b(this.a)},a),0)};function W(a,b,c){this.c=a;this.a=b;this.f=0;this.m=this.j=!1;this.s=c}var X=null;W.prototype.g=function(a){var b=this.a;b.g&&w(b.f,[b.a.c("wf",a.c,J(a).toString(),"active")],[b.a.c("wf",a.c,J(a).toString(),"loading"),b.a.c("wf",a.c,J(a).toString(),"inactive")]);K(b,"fontactive",a);this.m=!0;na(this)};
28969W.prototype.h=function(a){var b=this.a;if(b.g){var c=y(b.f,b.a.c("wf",a.c,J(a).toString(),"active")),d=[],e=[b.a.c("wf",a.c,J(a).toString(),"loading")];c||d.push(b.a.c("wf",a.c,J(a).toString(),"inactive"));w(b.f,d,e)}K(b,"fontinactive",a);na(this)};function na(a){0==--a.f&&a.j&&(a.m?(a=a.a,a.g&&w(a.f,[a.a.c("wf","active")],[a.a.c("wf","loading"),a.a.c("wf","inactive")]),K(a,"active")):L(a.a))};function oa(a){this.j=a;this.a=new ja;this.h=0;this.f=this.g=!0}oa.prototype.load=function(a){this.c=new ca(this.j,a.context||this.j);this.g=!1!==a.events;this.f=!1!==a.classes;pa(this,new ha(this.c,a),a)};
28970function qa(a,b,c,d,e){var f=0==--a.h;(a.f||a.g)&&setTimeout(function(){var a=e||null,m=d||null||{};if(0===c.length&&f)L(b.a);else{b.f+=c.length;f&&(b.j=f);var h,l=[];for(h=0;h<c.length;h++){var k=c[h],n=m[k.c],r=b.a,x=k;r.g&&w(r.f,[r.a.c("wf",x.c,J(x).toString(),"loading")]);K(r,"fontloading",x);r=null;if(null===X)if(window.FontFace){var x=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),xa=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);
28971X=x?42<parseInt(x[1],10):xa?!1:!0}else X=!1;X?r=new P(p(b.g,b),p(b.h,b),b.c,k,b.s,n):r=new Q(p(b.g,b),p(b.h,b),b.c,k,b.s,a,n);l.push(r)}for(h=0;h<l.length;h++)l[h].start()}},0)}function pa(a,b,c){var d=[],e=c.timeout;ia(b);var d=ka(a.a,c,a.c),f=new W(a.c,b,e);a.h=d.length;b=0;for(c=d.length;b<c;b++)d[b].load(function(b,d,c){qa(a,f,b,d,c)})};function ra(a,b){this.c=a;this.a=b}
28972ra.prototype.load=function(a){function b(){if(f["__mti_fntLst"+d]){var c=f["__mti_fntLst"+d](),e=[],h;if(c)for(var l=0;l<c.length;l++){var k=c[l].fontfamily;void 0!=c[l].fontStyle&&void 0!=c[l].fontWeight?(h=c[l].fontStyle+c[l].fontWeight,e.push(new G(k,h))):e.push(new G(k))}a(e)}else setTimeout(function(){b()},50)}var c=this,d=c.a.projectId,e=c.a.version;if(d){var f=c.c.o;A(this.c,(c.a.api||"https://fast.fonts.net/jsapi")+"/"+d+".js"+(e?"?v="+e:""),function(e){e?a([]):(f["__MonotypeConfiguration__"+
28973d]=function(){return c.a},b())}).id="__MonotypeAPIScript__"+d}else a([])};function sa(a,b){this.c=a;this.a=b}sa.prototype.load=function(a){var b,c,d=this.a.urls||[],e=this.a.families||[],f=this.a.testStrings||{},g=new B;b=0;for(c=d.length;b<c;b++)z(this.c,d[b],C(g));var m=[];b=0;for(c=e.length;b<c;b++)if(d=e[b].split(":"),d[1])for(var h=d[1].split(","),l=0;l<h.length;l+=1)m.push(new G(d[0],h[l]));else m.push(new G(d[0]));E(g,function(){a(m,f)})};function ta(a,b){a?this.c=a:this.c=ua;this.a=[];this.f=[];this.g=b||""}var ua="https://fonts.googleapis.com/css";function va(a,b){for(var c=b.length,d=0;d<c;d++){var e=b[d].split(":");3==e.length&&a.f.push(e.pop());var f="";2==e.length&&""!=e[1]&&(f=":");a.a.push(e.join(f))}}
28974function wa(a){if(0==a.a.length)throw Error("No fonts to load!");if(-1!=a.c.indexOf("kit="))return a.c;for(var b=a.a.length,c=[],d=0;d<b;d++)c.push(a.a[d].replace(/ /g,"+"));b=a.c+"?family="+c.join("%7C");0<a.f.length&&(b+="&subset="+a.f.join(","));0<a.g.length&&(b+="&text="+encodeURIComponent(a.g));return b};function ya(a){this.f=a;this.a=[];this.c={}}
28975var za={latin:"BESbswy","latin-ext":"\u00e7\u00f6\u00fc\u011f\u015f",cyrillic:"\u0439\u044f\u0416",greek:"\u03b1\u03b2\u03a3",khmer:"\u1780\u1781\u1782",Hanuman:"\u1780\u1781\u1782"},Aa={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},Ba={i:"i",italic:"i",n:"n",normal:"n"},
28976Ca=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
28977function Da(a){for(var b=a.f.length,c=0;c<b;c++){var d=a.f[c].split(":"),e=d[0].replace(/\+/g," "),f=["n4"];if(2<=d.length){var g;var m=d[1];g=[];if(m)for(var m=m.split(","),h=m.length,l=0;l<h;l++){var k;k=m[l];if(k.match(/^[\w-]+$/)){var n=Ca.exec(k.toLowerCase());if(null==n)k="";else{k=n[2];k=null==k||""==k?"n":Ba[k];n=n[1];if(null==n||""==n)n="4";else var r=Aa[n],n=r?r:isNaN(n)?"4":n.substr(0,1);k=[k,n].join("")}}else k="";k&&g.push(k)}0<g.length&&(f=g);3==d.length&&(d=d[2],g=[],d=d?d.split(","):
28978g,0<d.length&&(d=za[d[0]])&&(a.c[e]=d))}a.c[e]||(d=za[e])&&(a.c[e]=d);for(d=0;d<f.length;d+=1)a.a.push(new G(e,f[d]))}};function Ea(a,b){this.c=a;this.a=b}var Fa={Arimo:!0,Cousine:!0,Tinos:!0};Ea.prototype.load=function(a){var b=new B,c=this.c,d=new ta(this.a.api,this.a.text),e=this.a.families;va(d,e);var f=new ya(e);Da(f);z(c,wa(d),C(b));E(b,function(){a(f.a,f.c,Fa)})};function Ga(a,b){this.c=a;this.a=b}Ga.prototype.load=function(a){var b=this.a.id,c=this.c.o;b?A(this.c,(this.a.api||"https://use.typekit.net")+"/"+b+".js",function(b){if(b)a([]);else if(c.Typekit&&c.Typekit.config&&c.Typekit.config.fn){b=c.Typekit.config.fn;for(var e=[],f=0;f<b.length;f+=2)for(var g=b[f],m=b[f+1],h=0;h<m.length;h++)e.push(new G(g,m[h]));try{c.Typekit.load({events:!1,classes:!1,async:!0})}catch(l){}a(e)}},2E3):a([])};function Ha(a,b){this.c=a;this.f=b;this.a=[]}Ha.prototype.load=function(a){var b=this.f.id,c=this.c.o,d=this;b?(c.__webfontfontdeckmodule__||(c.__webfontfontdeckmodule__={}),c.__webfontfontdeckmodule__[b]=function(b,c){for(var g=0,m=c.fonts.length;g<m;++g){var h=c.fonts[g];d.a.push(new G(h.name,ga("font-weight:"+h.weight+";font-style:"+h.style)))}a(d.a)},A(this.c,(this.f.api||"https://f.fontdeck.com/s/css/js/")+ea(this.c)+"/"+b+".js",function(b){b&&a([])})):a([])};var Y=new oa(window);Y.a.c.custom=function(a,b){return new sa(b,a)};Y.a.c.fontdeck=function(a,b){return new Ha(b,a)};Y.a.c.monotype=function(a,b){return new ra(b,a)};Y.a.c.typekit=function(a,b){return new Ga(b,a)};Y.a.c.google=function(a,b){return new Ea(b,a)};var Z={load:p(Y.load,Y)};"function"===typeof define&&define.amd?define(function(){return Z}):"undefined"!==typeof module&&module.exports?module.exports=Z:(window.WebFont=Z,window.WebFontConfig&&Y.load(window.WebFontConfig));}());
28979
28980},{}],"panels-ui":[function(require,module,exports){
28981'use strict';
28982
28983Object.defineProperty(exports, '__esModule', { value: true });
28984
28985function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
28986
28987var React = _interopDefault(require('react'));
28988
28989function easeOutCubic(currentIteration, startValue, changeInValue, totalIterations) {
28990 return changeInValue * (Math.pow(currentIteration / totalIterations - 1, 3) + 1) + startValue;
28991}
28992
28993var FUNCTIONS = Object.freeze({
28994 easeOutCubic: easeOutCubic
28995});
28996
28997function snap($el, to, scroll, _ref) {
28998 var _ref$delay = _ref.delay,
28999 delay = _ref$delay === undefined ? 10 : _ref$delay,
29000 _ref$duration = _ref.duration,
29001 duration = _ref$duration === undefined ? 75 : _ref$duration,
29002 _ref$fn = _ref.fn,
29003 fn = _ref$fn === undefined ? 'easeOutCubic' : _ref$fn,
29004 _ref$step = _ref.step,
29005 step = _ref$step === undefined ? 5 : _ref$step;
29006
29007 var currentTime = 0;
29008 var next = FUNCTIONS[fn] || easeOutCubic;
29009 var start = $el[scroll];
29010 var change = to - start;
29011
29012 var animate = function animate() {
29013 currentTime += step;
29014
29015 $el[scroll] = next(currentTime, start, change, duration);
29016
29017 if (currentTime < duration) {
29018 requestAnimationFrame(animate);
29019 }
29020 };
29021
29022 setTimeout(animate, delay);
29023}
29024
29025function snapY($el, to) {
29026 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
29027
29028 snap($el, to, 'scrollTop', options);
29029}
29030
29031function snapX($el, to) {
29032 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
29033
29034 snap($el, to, 'scrollLeft', options);
29035}
29036
29037var asyncGenerator = function () {
29038 function AwaitValue(value) {
29039 this.value = value;
29040 }
29041
29042 function AsyncGenerator(gen) {
29043 var front, back;
29044
29045 function send(key, arg) {
29046 return new Promise(function (resolve, reject) {
29047 var request = {
29048 key: key,
29049 arg: arg,
29050 resolve: resolve,
29051 reject: reject,
29052 next: null
29053 };
29054
29055 if (back) {
29056 back = back.next = request;
29057 } else {
29058 front = back = request;
29059 resume(key, arg);
29060 }
29061 });
29062 }
29063
29064 function resume(key, arg) {
29065 try {
29066 var result = gen[key](arg);
29067 var value = result.value;
29068
29069 if (value instanceof AwaitValue) {
29070 Promise.resolve(value.value).then(function (arg) {
29071 resume("next", arg);
29072 }, function (arg) {
29073 resume("throw", arg);
29074 });
29075 } else {
29076 settle(result.done ? "return" : "normal", result.value);
29077 }
29078 } catch (err) {
29079 settle("throw", err);
29080 }
29081 }
29082
29083 function settle(type, value) {
29084 switch (type) {
29085 case "return":
29086 front.resolve({
29087 value: value,
29088 done: true
29089 });
29090 break;
29091
29092 case "throw":
29093 front.reject(value);
29094 break;
29095
29096 default:
29097 front.resolve({
29098 value: value,
29099 done: false
29100 });
29101 break;
29102 }
29103
29104 front = front.next;
29105
29106 if (front) {
29107 resume(front.key, front.arg);
29108 } else {
29109 back = null;
29110 }
29111 }
29112
29113 this._invoke = send;
29114
29115 if (typeof gen.return !== "function") {
29116 this.return = undefined;
29117 }
29118 }
29119
29120 if (typeof Symbol === "function" && Symbol.asyncIterator) {
29121 AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
29122 return this;
29123 };
29124 }
29125
29126 AsyncGenerator.prototype.next = function (arg) {
29127 return this._invoke("next", arg);
29128 };
29129
29130 AsyncGenerator.prototype.throw = function (arg) {
29131 return this._invoke("throw", arg);
29132 };
29133
29134 AsyncGenerator.prototype.return = function (arg) {
29135 return this._invoke("return", arg);
29136 };
29137
29138 return {
29139 wrap: function (fn) {
29140 return function () {
29141 return new AsyncGenerator(fn.apply(this, arguments));
29142 };
29143 },
29144 await: function (value) {
29145 return new AwaitValue(value);
29146 }
29147 };
29148}();
29149
29150var classCallCheck = function (instance, Constructor) {
29151 if (!(instance instanceof Constructor)) {
29152 throw new TypeError("Cannot call a class as a function");
29153 }
29154};
29155
29156var createClass = function () {
29157 function defineProperties(target, props) {
29158 for (var i = 0; i < props.length; i++) {
29159 var descriptor = props[i];
29160 descriptor.enumerable = descriptor.enumerable || false;
29161 descriptor.configurable = true;
29162 if ("value" in descriptor) descriptor.writable = true;
29163 Object.defineProperty(target, descriptor.key, descriptor);
29164 }
29165 }
29166
29167 return function (Constructor, protoProps, staticProps) {
29168 if (protoProps) defineProperties(Constructor.prototype, protoProps);
29169 if (staticProps) defineProperties(Constructor, staticProps);
29170 return Constructor;
29171 };
29172}();
29173
29174var _extends = Object.assign || function (target) {
29175 for (var i = 1; i < arguments.length; i++) {
29176 var source = arguments[i];
29177
29178 for (var key in source) {
29179 if (Object.prototype.hasOwnProperty.call(source, key)) {
29180 target[key] = source[key];
29181 }
29182 }
29183 }
29184
29185 return target;
29186};
29187
29188var inherits = function (subClass, superClass) {
29189 if (typeof superClass !== "function" && superClass !== null) {
29190 throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
29191 }
29192
29193 subClass.prototype = Object.create(superClass && superClass.prototype, {
29194 constructor: {
29195 value: subClass,
29196 enumerable: false,
29197 writable: true,
29198 configurable: true
29199 }
29200 });
29201 if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
29202};
29203
29204var possibleConstructorReturn = function (self, call) {
29205 if (!self) {
29206 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
29207 }
29208
29209 return call && (typeof call === "object" || typeof call === "function") ? call : self;
29210};
29211
29212var _jsxFileName = '/Users/dario/opensource/panels/panels-ui-compat.js.tmp';
29213var Panel = function (_React$Component) {
29214 inherits(Panel, _React$Component);
29215
29216 function Panel() {
29217 classCallCheck(this, Panel);
29218 return possibleConstructorReturn(this, (Panel.__proto__ || Object.getPrototypeOf(Panel)).apply(this, arguments));
29219 }
29220
29221 createClass(Panel, [{
29222 key: 'render',
29223 value: function render() {
29224 var props = this.props;
29225
29226
29227 return React.createElement(
29228 'div',
29229 {
29230 'aria-labelledby': props['aria-labelledby'],
29231 role: props.role,
29232 ref: props._ref,
29233 style: _extends({
29234 height: '100%',
29235 overflowY: 'auto'
29236 }, props.style),
29237 __source: {
29238 fileName: _jsxFileName,
29239 lineNumber: 8
29240 },
29241 __self: this
29242 },
29243 props.children
29244 );
29245 }
29246 }]);
29247 return Panel;
29248}(React.Component);
29249
29250var wrap = function wrap(i) {
29251 return i;
29252};
29253
29254exports.Panel = Panel;
29255exports.wrap = wrap;
29256exports.snapX = snapX;
29257exports.snapY = snapY;
29258},{"react":"react"}],"panels/blocks":[function(require,module,exports){
29259'use strict';
29260
29261Object.defineProperty(exports, '__esModule', { value: true });
29262
29263function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
29264
29265var React = require('react');
29266var React__default = _interopDefault(React);
29267var webfontloader = require('webfontloader');
29268var PropTypes = _interopDefault(require('prop-types'));
29269var toCSS = _interopDefault(require('style-to-css'));
29270var uniqueId = _interopDefault(require('mini-unique-id'));
29271
29272var _jsxFileName = '/Users/dario/opensource/panels/blocks/dangerously-set-inner-html.js';
29273var _this = undefined;
29274var DangerouslySetInnerHTML = function DangerouslySetInnerHTML(props) {
29275 return React__default.createElement('div', {
29276 dangerouslySetInnerHTML: {
29277 __html: props.html
29278 },
29279 'data-block': props['data-block'],
29280 ref: props._ref,
29281 style: props.style,
29282 __source: {
29283 fileName: _jsxFileName,
29284 lineNumber: 4
29285 },
29286 __self: _this
29287 });
29288};
29289
29290var asyncGenerator = function () {
29291 function AwaitValue(value) {
29292 this.value = value;
29293 }
29294
29295 function AsyncGenerator(gen) {
29296 var front, back;
29297
29298 function send(key, arg) {
29299 return new Promise(function (resolve, reject) {
29300 var request = {
29301 key: key,
29302 arg: arg,
29303 resolve: resolve,
29304 reject: reject,
29305 next: null
29306 };
29307
29308 if (back) {
29309 back = back.next = request;
29310 } else {
29311 front = back = request;
29312 resume(key, arg);
29313 }
29314 });
29315 }
29316
29317 function resume(key, arg) {
29318 try {
29319 var result = gen[key](arg);
29320 var value = result.value;
29321
29322 if (value instanceof AwaitValue) {
29323 Promise.resolve(value.value).then(function (arg) {
29324 resume("next", arg);
29325 }, function (arg) {
29326 resume("throw", arg);
29327 });
29328 } else {
29329 settle(result.done ? "return" : "normal", result.value);
29330 }
29331 } catch (err) {
29332 settle("throw", err);
29333 }
29334 }
29335
29336 function settle(type, value) {
29337 switch (type) {
29338 case "return":
29339 front.resolve({
29340 value: value,
29341 done: true
29342 });
29343 break;
29344
29345 case "throw":
29346 front.reject(value);
29347 break;
29348
29349 default:
29350 front.resolve({
29351 value: value,
29352 done: false
29353 });
29354 break;
29355 }
29356
29357 front = front.next;
29358
29359 if (front) {
29360 resume(front.key, front.arg);
29361 } else {
29362 back = null;
29363 }
29364 }
29365
29366 this._invoke = send;
29367
29368 if (typeof gen.return !== "function") {
29369 this.return = undefined;
29370 }
29371 }
29372
29373 if (typeof Symbol === "function" && Symbol.asyncIterator) {
29374 AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
29375 return this;
29376 };
29377 }
29378
29379 AsyncGenerator.prototype.next = function (arg) {
29380 return this._invoke("next", arg);
29381 };
29382
29383 AsyncGenerator.prototype.throw = function (arg) {
29384 return this._invoke("throw", arg);
29385 };
29386
29387 AsyncGenerator.prototype.return = function (arg) {
29388 return this._invoke("return", arg);
29389 };
29390
29391 return {
29392 wrap: function (fn) {
29393 return function () {
29394 return new AsyncGenerator(fn.apply(this, arguments));
29395 };
29396 },
29397 await: function (value) {
29398 return new AwaitValue(value);
29399 }
29400 };
29401}();
29402
29403var classCallCheck = function (instance, Constructor) {
29404 if (!(instance instanceof Constructor)) {
29405 throw new TypeError("Cannot call a class as a function");
29406 }
29407};
29408
29409var createClass = function () {
29410 function defineProperties(target, props) {
29411 for (var i = 0; i < props.length; i++) {
29412 var descriptor = props[i];
29413 descriptor.enumerable = descriptor.enumerable || false;
29414 descriptor.configurable = true;
29415 if ("value" in descriptor) descriptor.writable = true;
29416 Object.defineProperty(target, descriptor.key, descriptor);
29417 }
29418 }
29419
29420 return function (Constructor, protoProps, staticProps) {
29421 if (protoProps) defineProperties(Constructor.prototype, protoProps);
29422 if (staticProps) defineProperties(Constructor, staticProps);
29423 return Constructor;
29424 };
29425}();
29426
29427var defineProperty = function (obj, key, value) {
29428 if (key in obj) {
29429 Object.defineProperty(obj, key, {
29430 value: value,
29431 enumerable: true,
29432 configurable: true,
29433 writable: true
29434 });
29435 } else {
29436 obj[key] = value;
29437 }
29438
29439 return obj;
29440};
29441
29442var _extends = Object.assign || function (target) {
29443 for (var i = 1; i < arguments.length; i++) {
29444 var source = arguments[i];
29445
29446 for (var key in source) {
29447 if (Object.prototype.hasOwnProperty.call(source, key)) {
29448 target[key] = source[key];
29449 }
29450 }
29451 }
29452
29453 return target;
29454};
29455
29456var inherits = function (subClass, superClass) {
29457 if (typeof superClass !== "function" && superClass !== null) {
29458 throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
29459 }
29460
29461 subClass.prototype = Object.create(superClass && superClass.prototype, {
29462 constructor: {
29463 value: subClass,
29464 enumerable: false,
29465 writable: true,
29466 configurable: true
29467 }
29468 });
29469 if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
29470};
29471
29472var objectWithoutProperties = function (obj, keys) {
29473 var target = {};
29474
29475 for (var i in obj) {
29476 if (keys.indexOf(i) >= 0) continue;
29477 if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
29478 target[i] = obj[i];
29479 }
29480
29481 return target;
29482};
29483
29484var possibleConstructorReturn = function (self, call) {
29485 if (!self) {
29486 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
29487 }
29488
29489 return call && (typeof call === "object" || typeof call === "function") ? call : self;
29490};
29491
29492var loaded = [];
29493
29494var Font = function (_React$Component) {
29495 inherits(Font, _React$Component);
29496
29497 function Font() {
29498 classCallCheck(this, Font);
29499 return possibleConstructorReturn(this, (Font.__proto__ || Object.getPrototypeOf(Font)).apply(this, arguments));
29500 }
29501
29502 createClass(Font, [{
29503 key: 'componentDidMount',
29504 value: function componentDidMount() {
29505 this.load();
29506 }
29507 }, {
29508 key: 'componentDidUpdate',
29509 value: function componentDidUpdate() {
29510 this.load();
29511 }
29512 }, {
29513 key: 'load',
29514 value: function load() {
29515 var props = this.props;
29516
29517
29518 var family = props.family;
29519 var source = props.source;
29520
29521 var urls = void 0;
29522 if (props.family === 'FontAwesome') {
29523 source = 'custom';
29524 urls = ['https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css'];
29525 } else if (typeof props.weight === 'string') {
29526 family = family + ':' + props.weight;
29527 }
29528
29529 if (loaded.includes(family)) return;
29530 loaded.push(family);
29531
29532 webfontloader.load(defineProperty({}, source, {
29533 families: [family],
29534 urls: urls
29535 }));
29536 }
29537 }, {
29538 key: 'render',
29539 value: function render() {
29540 return null;
29541 }
29542 }]);
29543 return Font;
29544}(React__default.Component);
29545
29546Font.defaultProps = {
29547 source: 'google'
29548};
29549
29550// original src: https://github.com/substack/path-browserify
29551function normaliseArray(parts, allowAboveRoot) {
29552 // if the path tries to go above the root, `up` ends up > 0
29553 var up = 0;
29554 for (var i = parts.length - 1; i >= 0; i--) {
29555 var last = parts[i];
29556 if (last === '.') {
29557 parts.splice(i, 1);
29558 } else if (last === '..') {
29559 parts.splice(i, 1);
29560 up++;
29561 } else if (up) {
29562 parts.splice(i, 1);
29563 up--;
29564 }
29565 }
29566
29567 // if the path is allowed to go above the root, restore leading ..s
29568 if (allowAboveRoot) {
29569 for (; up--; up) {
29570 parts.unshift('..');
29571 }
29572 }
29573
29574 return parts;
29575}
29576
29577// original src: https://github.com/substack/path-browserify
29578function normalisePath(rawPath) {
29579 var isAbsolute = rawPath.charAt(0) === '/';
29580 var trailingSlash = rawPath.substr(-1) === '/';
29581
29582 // normalise the path
29583 var path = normaliseArray(rawPath.split('/').filter(function (p) {
29584 return !!p;
29585 }), !isAbsolute).join('/');
29586
29587 if (!path && !isAbsolute) {
29588 path = '.';
29589 }
29590 if (path && trailingSlash) {
29591 path += '/';
29592 }
29593
29594 return (isAbsolute ? '/' : '') + path;
29595}
29596
29597var TRAILING_SLASH_REGEX = /\/$/;
29598
29599function withTrailingSlash(uri) {
29600 return TRAILING_SLASH_REGEX.test(uri) ? uri : uri + "/";
29601}
29602
29603var decodeSchema = function decodeSchema(s) {
29604 return s.replace(/<<HTTP>>/g, 'http://').replace(/<<HTTPS>>/g, 'https://');
29605};
29606var encodeSchema = function encodeSchema(s) {
29607 return s.replace(/http:\/\//g, '<<HTTP>>').replace(/https:\/\//g, '<<HTTPS>>');
29608};
29609
29610var normaliseUri = (function (uri) {
29611 return decodeSchema(normalisePath(withTrailingSlash(encodeSchema(uri))));
29612});
29613
29614var _jsxFileName$2 = '/Users/dario/opensource/panels/blocks/teleport.js';
29615var Teleport = function (_React$Component) {
29616 inherits(Teleport, _React$Component);
29617
29618 function Teleport(props, context) {
29619 classCallCheck(this, Teleport);
29620
29621 var _this = possibleConstructorReturn(this, (Teleport.__proto__ || Object.getPrototypeOf(Teleport)).call(this, props, context));
29622
29623 _this.className = 'Teleport-' + uniqueId();
29624 return _this;
29625 }
29626
29627 createClass(Teleport, [{
29628 key: 'render',
29629 value: function render() {
29630 var className = this.className;
29631 var _props = this.props,
29632 context = _props.context,
29633 children = _props.children,
29634 focus = _props.focus,
29635 loose = _props.loose,
29636 onClick = _props.onClick,
29637 _ref = _props._ref,
29638 style = _props.style,
29639 styleActive = _props.styleActive,
29640 styleActiveHover = _props.styleActiveHover,
29641 styleHover = _props.styleHover,
29642 title = _props.title,
29643 to = _props.to,
29644 rest = objectWithoutProperties(_props, ['context', 'children', 'focus', 'loose', 'onClick', '_ref', 'style', 'styleActive', 'styleActiveHover', 'styleHover', 'title', 'to']);
29645 var _context = this.context,
29646 isActive = _context.isActive,
29647 navigate = _context.navigate,
29648 route = _context.route;
29649
29650 var active = isActive(to, loose);
29651 var href = normaliseUri('' + route.context + to);
29652
29653 var inlineStyle = '';
29654 if (!active && styleHover) {
29655 inlineStyle = '.' + className + ':hover {' + toCSS(styleHover) + '}';
29656 }
29657 if (active && styleActiveHover) {
29658 inlineStyle = '.' + className + ':hover {' + toCSS(styleActiveHover) + '}';
29659 }
29660 var finalStyle = active ? _extends({}, style, styleActive) : style;
29661
29662 var finalOnClick = function finalOnClick(event) {
29663 event.preventDefault();
29664 var preventNavigate = false;
29665
29666 if (typeof onClick === 'function') {
29667 preventNavigate = onClick(event);
29668 }
29669
29670 if (preventNavigate !== true) {
29671 navigate(to, focus, context);
29672 }
29673 };
29674
29675 if (_ref) {
29676 rest.ref = _ref;
29677 }
29678
29679 return React__default.createElement(
29680 'a',
29681 _extends({}, rest, {
29682 className: className,
29683 href: href,
29684 onClick: finalOnClick,
29685 style: finalStyle,
29686 title: title,
29687 __source: {
29688 fileName: _jsxFileName$2,
29689 lineNumber: 61
29690 },
29691 __self: this
29692 }),
29693 React__default.createElement(
29694 'style',
29695 {
29696 __source: {
29697 fileName: _jsxFileName$2,
29698 lineNumber: 69
29699 },
29700 __self: this
29701 },
29702 inlineStyle
29703 ),
29704 children
29705 );
29706 }
29707 }]);
29708 return Teleport;
29709}(React__default.Component);
29710
29711Teleport.contextTypes = {
29712 isActive: PropTypes.func.isRequired,
29713 navigate: PropTypes.func.isRequired,
29714 route: PropTypes.shape({
29715 context: PropTypes.string.isRequired
29716 }).isRequired
29717};
29718
29719var _jsxFileName$3 = '/Users/dario/opensource/panels/blocks/go-to.js';
29720var GoTo = function (_React$Component) {
29721 inherits(GoTo, _React$Component);
29722
29723 function GoTo() {
29724 classCallCheck(this, GoTo);
29725 return possibleConstructorReturn(this, (GoTo.__proto__ || Object.getPrototypeOf(GoTo)).apply(this, arguments));
29726 }
29727
29728 createClass(GoTo, [{
29729 key: 'render',
29730 value: function render() {
29731 var _props = this.props,
29732 children = _props.children,
29733 className = _props.className,
29734 _ref = _props._ref,
29735 styleActive = _props.styleActive,
29736 styleHover = _props.styleHover,
29737 props = objectWithoutProperties(_props, ['children', 'className', '_ref', 'styleActive', 'styleHover']);
29738
29739
29740 var inlineStyle = null;
29741 if (Object.keys(styleHover).length) {
29742 inlineStyle = React__default.createElement(
29743 'style',
29744 {
29745 __source: {
29746 fileName: _jsxFileName$3,
29747 lineNumber: 19
29748 },
29749 __self: this
29750 },
29751 '.' + className + ':hover {' + toCSS(styleHover) + '}'
29752 );
29753 }
29754
29755 if (_ref) {
29756 props.ref = _ref;
29757 }
29758
29759 return React__default.createElement(
29760 'a',
29761 _extends({}, props, { className: className, target: '_blank', __source: {
29762 fileName: _jsxFileName$3,
29763 lineNumber: 28
29764 },
29765 __self: this
29766 }),
29767 inlineStyle,
29768 children
29769 );
29770 }
29771 }]);
29772 return GoTo;
29773}(React__default.Component);
29774
29775var _jsxFileName$4 = '/Users/dario/opensource/panels/blocks/on-click.js';
29776var OnClick = function (_React$Component) {
29777 inherits(OnClick, _React$Component);
29778
29779 function OnClick() {
29780 var _ref2;
29781
29782 var _temp, _this, _ret;
29783
29784 classCallCheck(this, OnClick);
29785
29786 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
29787 args[_key] = arguments[_key];
29788 }
29789
29790 return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref2 = OnClick.__proto__ || Object.getPrototypeOf(OnClick)).call.apply(_ref2, [this].concat(args))), _this), _this.state = {}, _temp), possibleConstructorReturn(_this, _ret);
29791 }
29792
29793 createClass(OnClick, [{
29794 key: 'componentWillMount',
29795 value: function componentWillMount() {
29796 var props = this.props;
29797
29798
29799 var manualActive = typeof props.isActive === 'boolean';
29800 this.setState({
29801 isActive: manualActive ? props.isActive : false,
29802 manualActive: manualActive
29803 });
29804
29805 this.bindOnClick(props.onClick);
29806 }
29807 }, {
29808 key: 'componentWillReceiveProps',
29809 value: function componentWillReceiveProps(nextProps) {
29810 this.bindOnClick(nextProps.onClick);
29811
29812 var manualActive = typeof nextProps.isActive === 'boolean';
29813
29814 if (manualActive) {
29815 this.setState({
29816 isActive: nextProps.isActive,
29817 manualActive: manualActive
29818 });
29819 }
29820 }
29821 }, {
29822 key: 'componentWillUnmount',
29823 value: function componentWillUnmount() {
29824 if (this.onClickTimeout) {
29825 clearTimeout(this.onClickTimeout);
29826 }
29827 }
29828 }, {
29829 key: 'bindOnClick',
29830 value: function bindOnClick(onClick) {
29831 var _this2 = this;
29832
29833 var context = this.context;
29834
29835 /* eslint-disable no-console */
29836
29837 var finalOnClick = void 0;
29838 if (typeof onClick === 'function') {
29839 finalOnClick = function finalOnClick() {
29840 try {
29841 onClick();
29842 } catch (err) {
29843 var match = err.message.match(/props\.(.+) is not a function/);
29844 if (match) {
29845 context.transitionTo(match[1].trim(), true);
29846 }
29847 }
29848 };
29849 } else {
29850 var match = void 0;
29851 if (typeof onClick === 'string') {
29852 match = onClick.match(/transitionTo\((.+)\)/);
29853 }
29854 if (match && typeof context.transitionTo === 'function') {
29855 finalOnClick = function finalOnClick() {
29856 return context.transitionTo(match[1].trim());
29857 };
29858 } else {
29859 finalOnClick = function finalOnClick() {
29860 return console.log(onClick);
29861 };
29862 }
29863 }
29864
29865 this.onClick = function (event) {
29866 finalOnClick(event);
29867
29868 event.stopPropagation();
29869
29870 if (!_this2.state.manualActive) {
29871 _this2.setState({
29872 isActive: true
29873 });
29874
29875 _this2.onClickTimeout = setTimeout(function () {
29876 _this2.setState({
29877 isActive: false
29878 });
29879 _this2.onClickTimeout = null;
29880 }, _this2.props.styleActiveTimeout);
29881 }
29882 };
29883 }
29884 }, {
29885 key: 'render',
29886 value: function render() {
29887 var context = this.context;
29888 var isActive = this.state.isActive;
29889 /* eslint-disable no-unused-vars */
29890
29891 var _props = this.props,
29892 ariaLabel = _props['aria-label'],
29893 children = _props.children,
29894 className = _props.className,
29895 _isActive = _props.isActive,
29896 isDisabled = _props.isDisabled,
29897 _ref = _props._ref,
29898 style = _props.style,
29899 styleActive = _props.styleActive,
29900 styleActiveHover = _props.styleActiveHover,
29901 styleActiveTimeout = _props.styleActiveTimeout,
29902 styleDisabled = _props.styleDisabled,
29903 styleHover = _props.styleHover,
29904 rest = objectWithoutProperties(_props, ['aria-label', 'children', 'className', 'isActive', 'isDisabled', '_ref', 'style', 'styleActive', 'styleActiveHover', 'styleActiveTimeout', 'styleDisabled', 'styleHover']);
29905
29906
29907 var inlineStyle = null;
29908 if (!isDisabled) {
29909 rest.onClick = this.onClick;
29910
29911 var fClass = className.split(' ')[0];
29912 if (!isActive && styleHover) {
29913 inlineStyle = React__default.createElement(
29914 'style',
29915 {
29916 __source: {
29917 fileName: _jsxFileName$4,
29918 lineNumber: 114
29919 },
29920 __self: this
29921 },
29922 '.' + fClass + ':hover {' + toCSS(styleHover) + '}'
29923 );
29924 }
29925 if (isActive && styleActiveHover) {
29926 inlineStyle = React__default.createElement(
29927 'style',
29928 {
29929 __source: {
29930 fileName: _jsxFileName$4,
29931 lineNumber: 119
29932 },
29933 __self: this
29934 },
29935 '.' + fClass + ':hover {' + toCSS(styleActiveHover) + '}'
29936 );
29937 }
29938 }
29939
29940 var finalStyle = _extends({
29941 cursor: 'pointer'
29942 }, style);
29943 if (isDisabled) {
29944 finalStyle = _extends({}, finalStyle, {
29945 cursor: 'default'
29946 }, styleDisabled);
29947 } else if (isActive) {
29948 finalStyle = _extends({}, finalStyle, styleActive);
29949 }
29950
29951 if (_ref) {
29952 rest.ref = _ref;
29953 }
29954
29955 return React__default.createElement(
29956 'button',
29957 _extends({}, rest, {
29958 'aria-label': ariaLabel ? context.i18n ? context.i18n.t(ariaLabel) : ariaLabel : undefined,
29959 className: className,
29960 style: finalStyle, __source: {
29961 fileName: _jsxFileName$4,
29962 lineNumber: 146
29963 },
29964 __self: this
29965 }),
29966 inlineStyle,
29967 children
29968 );
29969 }
29970 }]);
29971 return OnClick;
29972}(React__default.Component);
29973
29974OnClick.contextTypes = {
29975 i18n: PropTypes.shape({
29976 t: PropTypes.func.isRequired
29977 }),
29978 transitionTo: PropTypes.func
29979};
29980OnClick.defaultProps = {
29981 styleActiveTimeout: 1000
29982};
29983
29984var _jsxFileName$1 = '/Users/dario/opensource/panels/blocks/create-group.js';
29985function createGroup(name, groupStyle) {
29986 var Group = function (_React$Component) {
29987 inherits(Group, _React$Component);
29988
29989 function Group(props, context) {
29990 classCallCheck(this, Group);
29991
29992 var _this = possibleConstructorReturn(this, (Group.__proto__ || Object.getPrototypeOf(Group)).call(this, props, context));
29993
29994 _this.localClassName = name + '-' + uniqueId();
29995 return _this;
29996 }
29997
29998 createClass(Group, [{
29999 key: 'render',
30000 value: function render() {
30001 var _props = this.props,
30002 children = _props.children,
30003 moreClassName = _props.className,
30004 goTo = _props.goTo,
30005 style = _props.style,
30006 teleportTo = _props.teleportTo,
30007 props = objectWithoutProperties(_props, ['children', 'className', 'goTo', 'style', 'teleportTo']);
30008 var localClassName = this.localClassName;
30009 var pages = this.context.pages;
30010
30011
30012 var finalStyle = _extends({}, groupStyle, style);
30013
30014 var className = localClassName;
30015 if (typeof moreClassName === 'string') {
30016 className += ' ' + moreClassName;
30017 }
30018
30019 var Base = void 0;
30020 if (teleportTo) {
30021 Base = Teleport;
30022 props.to = teleportTo;
30023 } else if (goTo) {
30024 Base = GoTo;
30025 props.href = goTo;
30026 } else if ((props.onClick || props.onMouseDown || props.onMouseUp) && !props.noButton) {
30027 Base = OnClick;
30028 } else {
30029 var isDisabled = props.isDisabled,
30030 noButton = props.noButton,
30031 _ref = props._ref,
30032 styleDisabled = props.styleDisabled,
30033 styleActive = props.styleActive,
30034 styleActiveHover = props.styleActiveHover,
30035 styleActiveTimeout = props.styleActiveTimeout,
30036 styleHover = props.styleHover,
30037 rest = objectWithoutProperties(props, ['isDisabled', 'noButton', '_ref', 'styleDisabled', 'styleActive', 'styleActiveHover', 'styleActiveTimeout', 'styleHover']);
30038
30039
30040 var inlineStyle = null;
30041 if (isDisabled) {
30042 if (styleDisabled) {
30043 finalStyle = _extends({}, finalStyle, styleDisabled);
30044 }
30045 } else {
30046 if (Object.keys(styleHover).length) {
30047 inlineStyle = React__default.createElement(
30048 'style',
30049 {
30050 __source: {
30051 fileName: _jsxFileName$1,
30052 lineNumber: 75
30053 },
30054 __self: this
30055 },
30056 '.' + localClassName + ':hover {' + toCSS(styleHover) + '}'
30057 );
30058 }
30059 }
30060
30061 return React__default.createElement(
30062 'div',
30063 _extends({}, rest, { className: className, ref: _ref, style: finalStyle, __source: {
30064 fileName: _jsxFileName$1,
30065 lineNumber: 81
30066 },
30067 __self: this
30068 }),
30069 inlineStyle,
30070 children
30071 );
30072 }
30073
30074 if (pages && pages.isSelecting) {
30075 props.onClick = function (event) {
30076 if (event) {
30077 event.preventDefault();
30078 }
30079 return true;
30080 };
30081 }
30082
30083 return React__default.createElement(
30084 Base,
30085 _extends({}, props, { className: className, style: finalStyle, __source: {
30086 fileName: _jsxFileName$1,
30087 lineNumber: 98
30088 },
30089 __self: this
30090 }),
30091 children
30092 );
30093 }
30094 }]);
30095 return Group;
30096 }(React__default.Component);
30097
30098 Group.contextTypes = {
30099 pages: PropTypes.shape({
30100 isSelecting: PropTypes.bool
30101 })
30102 };
30103
30104 Group.defaultProps = {
30105 className: '',
30106 style: {},
30107 styleActive: {},
30108 styleHover: {}
30109 };
30110
30111 Group.displayName = name;
30112
30113 return Group;
30114}
30115
30116var Horizontal = createGroup('Horizontal', { flexDirection: 'row' });
30117
30118var _jsxFileName$6 = '/Users/dario/opensource/panels/blocks/knocking.js';
30119var _this$1 = undefined;
30120var animation = '@keyframes scaleout {\n 0% {\n transform: scale(0.0);\n -webkit-transform: scale(0.0);\n } 100% {\n transform: scale(1.0);\n -webkit-transform: scale(1.0);\n opacity: 0;\n }\n}';
30121
30122var Knocking = function Knocking(_ref) {
30123 var dataBlock = _ref['data-block'],
30124 size = _ref.size,
30125 _ref$style = _ref.style,
30126 style = _ref$style === undefined ? {} : _ref$style;
30127
30128 var finalStyle = _extends({
30129 animation: 'scaleout 1.0s infinite linear',
30130 backgroundColor: style.color,
30131 borderRadius: size,
30132 height: size,
30133 WebkitAnimation: 'scaleout 1.0s infinite linear',
30134 width: size
30135 }, style);
30136
30137 return React__default.createElement(
30138 Horizontal,
30139 { 'data-block': dataBlock, style: finalStyle, __source: {
30140 fileName: _jsxFileName$6,
30141 lineNumber: 27
30142 },
30143 __self: _this$1
30144 },
30145 React__default.createElement(
30146 'style',
30147 {
30148 __source: {
30149 fileName: _jsxFileName$6,
30150 lineNumber: 28
30151 },
30152 __self: _this$1
30153 },
30154 animation
30155 )
30156 );
30157};
30158
30159Knocking.defaultProps = {
30160 style: {
30161 color: '#323232'
30162 },
30163 size: 32
30164};
30165
30166var _jsxFileName$5 = '/Users/dario/opensource/panels/blocks/image.js';
30167var Image = function (_React$Component) {
30168 inherits(Image, _React$Component);
30169
30170 function Image(props) {
30171 classCallCheck(this, Image);
30172
30173 var _this = possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).call(this, props));
30174
30175 _this.onLoad = _this.onLoad.bind(_this);
30176 _this.state = {
30177 isLoading: true
30178 };
30179 return _this;
30180 }
30181
30182 createClass(Image, [{
30183 key: 'componentWillReceiveProps',
30184 value: function componentWillReceiveProps(nextProps) {
30185 if (this.props.src !== nextProps.src) {
30186 this.setState({
30187 isLoading: true
30188 });
30189 }
30190 }
30191 }, {
30192 key: 'onLoad',
30193 value: function onLoad() {
30194 this.setState({
30195 isLoading: false
30196 });
30197 }
30198 }, {
30199 key: 'render',
30200 value: function render() {
30201 var isLoading = this.state.isLoading;
30202 var _props = this.props,
30203 text = _props.text,
30204 src = _props.src,
30205 style = _props.style,
30206 styleLoading = _props.styleLoading,
30207 styleWrapper = _props.styleWrapper;
30208
30209
30210 return React__default.createElement(
30211 'div',
30212 { style: styleWrapper, __source: {
30213 fileName: _jsxFileName$5,
30214 lineNumber: 32
30215 },
30216 __self: this
30217 },
30218 isLoading && React__default.createElement(Knocking, { style: styleLoading, __source: {
30219 fileName: _jsxFileName$5,
30220 lineNumber: 33
30221 },
30222 __self: this
30223 }),
30224 React__default.createElement('img', {
30225 alt: text,
30226 onLoad: this.onLoad,
30227 src: src,
30228 style: style,
30229 title: text,
30230 __source: {
30231 fileName: _jsxFileName$5,
30232 lineNumber: 34
30233 },
30234 __self: this
30235 })
30236 );
30237 }
30238 }]);
30239 return Image;
30240}(React__default.Component);
30241
30242Image.defaultProps = {
30243 src: 'https://files.usepages.today/usepages.today/image-placeholder.svg',
30244 style: {},
30245 styleLoading: {
30246 position: 'absolute'
30247 },
30248 styleWrapper: {},
30249 text: 'Alternative text'
30250};
30251
30252var _jsxFileName$7 = '/Users/dario/opensource/panels/blocks/input.js';
30253var PLACEHOLDER_PREFIXES = ['::-webkit-input-placeholder', '::-moz-placeholder', ':-ms-input-placeholder', ':placeholder-shown'];
30254
30255var Input = function (_React$Component) {
30256 inherits(Input, _React$Component);
30257
30258 function Input(props) {
30259 classCallCheck(this, Input);
30260
30261 var _this = possibleConstructorReturn(this, (Input.__proto__ || Object.getPrototypeOf(Input)).call(this, props));
30262
30263 _this.id = 'Input-' + uniqueId();
30264 return _this;
30265 }
30266
30267 createClass(Input, [{
30268 key: 'render',
30269 value: function render() {
30270 var context = this.context,
30271 id = this.id;
30272 var _props = this.props,
30273 disabled = _props.disabled,
30274 onEnter = _props.onEnter,
30275 placeholder = _props.placeholder,
30276 _ref = _props._ref,
30277 style = _props.style,
30278 styleDisabled = _props.styleDisabled,
30279 styleFocus = _props.styleFocus,
30280 styleHover = _props.styleHover,
30281 stylePlaceholder = _props.stylePlaceholder,
30282 styleWrapper = _props.styleWrapper,
30283 rest = objectWithoutProperties(_props, ['disabled', 'onEnter', 'placeholder', '_ref', 'style', 'styleDisabled', 'styleFocus', 'styleHover', 'stylePlaceholder', 'styleWrapper']);
30284
30285
30286 var finalStyle = style;
30287
30288 var backgroundColor = style && style.backgroundColor || 'transparent';
30289 var color = style && style.color || 'black';
30290 var inlineStyle = ['#' + id + ':-webkit-autofill {\n background-color: ' + backgroundColor + ' !important;\n box-shadow: 0 0 0px 1000px ' + backgroundColor + ' inset;\n color: ' + color + ' !important;\n }'];
30291
30292 if (stylePlaceholder) {
30293 PLACEHOLDER_PREFIXES.forEach(function (prefix) {
30294 inlineStyle.push('#' + id + prefix + ' {' + toCSS(stylePlaceholder) + '}');
30295 });
30296 }
30297
30298 if (styleDisabled && disabled) {
30299 finalStyle = _extends({}, style, styleDisabled);
30300 } else {
30301 if (styleHover) {
30302 inlineStyle.push(inlineStyle + ' #' + id + ':hover {' + toCSS(styleHover) + '}');
30303 }
30304 if (styleFocus) {
30305 inlineStyle.push('#' + id + ':focus {' + toCSS(styleFocus) + '}');
30306 }
30307 }
30308
30309 var onKeyUp = void 0;
30310 if (typeof onEnter !== 'undefined') {
30311 /* eslint-disable no-console */
30312 var finalOnEnter = typeof onEnter === 'function' ? onEnter : function () {
30313 return console.log(onEnter);
30314 };
30315 onKeyUp = function onKeyUp(event) {
30316 return event.key === 'Enter' && finalOnEnter(event);
30317 };
30318 }
30319
30320 return React__default.createElement(
30321 'div',
30322 { style: styleWrapper, __source: {
30323 fileName: _jsxFileName$7,
30324 lineNumber: 76
30325 },
30326 __self: this
30327 },
30328 React__default.createElement(
30329 'style',
30330 {
30331 __source: {
30332 fileName: _jsxFileName$7,
30333 lineNumber: 77
30334 },
30335 __self: this
30336 },
30337 inlineStyle.join('\n')
30338 ),
30339 React__default.createElement('input', _extends({}, rest, {
30340 autoComplete: 'off',
30341 id: id,
30342 onKeyUp: onKeyUp,
30343 ref: _ref,
30344 placeholder: placeholder ? context.i18n ? context.i18n.t(placeholder) : placeholder : undefined,
30345 style: finalStyle,
30346 __source: {
30347 fileName: _jsxFileName$7,
30348 lineNumber: 78
30349 },
30350 __self: this
30351 }))
30352 );
30353 }
30354 }]);
30355 return Input;
30356}(React__default.Component);
30357
30358Input.defaultProps = {
30359 placeholder: '',
30360 style: {},
30361 styleHover: {},
30362 styleWrapper: {},
30363 type: 'text'
30364};
30365
30366Input.contextTypes = {
30367 i18n: PropTypes.shape({
30368 t: PropTypes.func.isRequired
30369 })
30370};
30371
30372var List = function List() {
30373 return null;
30374};
30375
30376var _jsxFileName$8 = '/Users/dario/opensource/panels/blocks/style.js';
30377var _this$2 = undefined;
30378var Style = function Style(props) {
30379 return React__default.createElement(
30380 'style',
30381 {
30382 __source: {
30383 fileName: _jsxFileName$8,
30384 lineNumber: 4
30385 },
30386 __self: _this$2
30387 },
30388 props.css
30389 );
30390};
30391
30392var _jsxFileName$9 = '/Users/dario/opensource/panels/blocks/text.js';
30393var _this$3 = undefined;
30394var Text = function Text(_ref, context) {
30395 var style = _ref.style,
30396 text = _ref.text,
30397 props = objectWithoutProperties(_ref, ['style', 'text']);
30398
30399 var finalStyle = _extends({
30400 whiteSpace: 'pre-line'
30401 }, style);
30402 return React__default.createElement(
30403 'div',
30404 _extends({}, props, { style: finalStyle, __source: {
30405 fileName: _jsxFileName$9,
30406 lineNumber: 10
30407 },
30408 __self: _this$3
30409 }),
30410 context.i18n ? context.i18n.t(text) : text
30411 );
30412};
30413Text.contextTypes = {
30414 i18n: PropTypes.shape({
30415 t: PropTypes.func.isRequired
30416 })
30417};
30418
30419Text.defaultProps = {
30420 style: {},
30421 text: ''
30422};
30423
30424var _jsxFileName$10 = '/Users/dario/opensource/panels/blocks/textarea.js';
30425var PLACEHOLDER_PREFIXES$1 = ['::-webkit-input-placeholder', '::-moz-placeholder', ':-ms-input-placeholder', ':placeholder-shown'];
30426
30427var Textarea = function (_Component) {
30428 inherits(Textarea, _Component);
30429
30430 function Textarea() {
30431 var _ref2;
30432
30433 classCallCheck(this, Textarea);
30434
30435 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
30436 args[_key] = arguments[_key];
30437 }
30438
30439 var _this = possibleConstructorReturn(this, (_ref2 = Textarea.__proto__ || Object.getPrototypeOf(Textarea)).call.apply(_ref2, [this].concat(args)));
30440
30441 _this.id = 'Textarea-' + uniqueId();
30442 return _this;
30443 }
30444
30445 createClass(Textarea, [{
30446 key: 'render',
30447 value: function render() {
30448 var context = this.context,
30449 id = this.id;
30450 var _props = this.props,
30451 _ref = _props._ref,
30452 placeholder = _props.placeholder,
30453 stylePlaceholder = _props.stylePlaceholder,
30454 styleHover = _props.styleHover,
30455 styleFocus = _props.styleFocus,
30456 styleDisabled = _props.styleDisabled,
30457 text = _props.text,
30458 rest = objectWithoutProperties(_props, ['_ref', 'placeholder', 'stylePlaceholder', 'styleHover', 'styleFocus', 'styleDisabled', 'text']);
30459
30460
30461 var inlineStyle = [];
30462 if (stylePlaceholder) {
30463 PLACEHOLDER_PREFIXES$1.forEach(function (prefix) {
30464 inlineStyle.push('#' + id + prefix + ' {' + toCSS(stylePlaceholder) + '}');
30465 });
30466 }
30467 if (styleHover) {
30468 inlineStyle.push(inlineStyle + ' #' + id + ':hover {' + toCSS(styleHover) + '}');
30469 }
30470 if (styleFocus) {
30471 inlineStyle.push('#' + id + ':focus {' + toCSS(styleFocus) + '}');
30472 }
30473 if (styleDisabled) {
30474 inlineStyle.push('#' + id + ':disabled {' + toCSS(styleDisabled) + '}');
30475 }
30476 // TODO remove when we normalise this
30477 if (!rest.value) {
30478 rest.defaultValue = text;
30479 }
30480
30481 return React__default.createElement(
30482 'div',
30483 {
30484 __source: {
30485 fileName: _jsxFileName$10,
30486 lineNumber: 54
30487 },
30488 __self: this
30489 },
30490 React__default.createElement(
30491 'style',
30492 {
30493 __source: {
30494 fileName: _jsxFileName$10,
30495 lineNumber: 55
30496 },
30497 __self: this
30498 },
30499 inlineStyle.join('\n')
30500 ),
30501 React__default.createElement('textarea', _extends({}, rest, {
30502 id: id,
30503 ref: _ref,
30504 placeholder: placeholder ? context.i18n ? context.i18n.t(placeholder) : placeholder : undefined,
30505 __source: {
30506 fileName: _jsxFileName$10,
30507 lineNumber: 57
30508 },
30509 __self: this
30510 }))
30511 );
30512 }
30513 }]);
30514 return Textarea;
30515}(React.Component);
30516
30517Textarea.defaultProps = {
30518 style: {},
30519 styleDisabled: {},
30520 styleFocus: {},
30521 stylePlaceholder: {},
30522 text: ''
30523};
30524
30525Textarea.contextTypes = {
30526 i18n: PropTypes.shape({
30527 t: PropTypes.func.isRequired
30528 })
30529};
30530
30531var _Vertical = createGroup('Vertical', { flexDirection: 'column' });
30532
30533var _jsxFileName$11 = '/Users/dario/opensource/panels/blocks/circle.js';
30534var _this$4 = undefined;
30535var Circle = function Circle(props) {
30536 return React__default.createElement('circle', _extends({}, props, {
30537 __source: {
30538 fileName: _jsxFileName$11,
30539 lineNumber: 3
30540 },
30541 __self: _this$4
30542 }));
30543};
30544
30545var _jsxFileName$12 = '/Users/dario/opensource/panels/blocks/clip-path.js';
30546var _this$5 = undefined;
30547var ClipPath = function ClipPath(props) {
30548 return React__default.createElement('clip-path', _extends({}, props, {
30549 __source: {
30550 fileName: _jsxFileName$12,
30551 lineNumber: 3
30552 },
30553 __self: _this$5
30554 }));
30555};
30556
30557var _jsxFileName$13 = '/Users/dario/opensource/panels/blocks/ellipse.js';
30558var _this$6 = undefined;
30559var Ellipse = function Ellipse(props) {
30560 return React__default.createElement('ellipse', _extends({}, props, {
30561 __source: {
30562 fileName: _jsxFileName$13,
30563 lineNumber: 3
30564 },
30565 __self: _this$6
30566 }));
30567};
30568
30569var _jsxFileName$14 = '/Users/dario/opensource/panels/blocks/g.js';
30570var _this$7 = undefined;
30571var G = function G(_ref) {
30572 var children = _ref.children,
30573 props = objectWithoutProperties(_ref, ['children']);
30574 return React__default.createElement(
30575 'g',
30576 _extends({}, props, {
30577 __source: {
30578 fileName: _jsxFileName$14,
30579 lineNumber: 4
30580 },
30581 __self: _this$7
30582 }),
30583 children
30584 );
30585};
30586
30587var _jsxFileName$15 = '/Users/dario/opensource/panels/blocks/line.js';
30588var _this$8 = undefined;
30589var Line = function Line(props) {
30590 return React__default.createElement('line', _extends({}, props, {
30591 __source: {
30592 fileName: _jsxFileName$15,
30593 lineNumber: 3
30594 },
30595 __self: _this$8
30596 }));
30597};
30598
30599var _jsxFileName$16 = '/Users/dario/opensource/panels/blocks/rect.js';
30600var _this$9 = undefined;
30601var Rect = function Rect(props) {
30602 return React__default.createElement('rect', _extends({}, props, {
30603 __source: {
30604 fileName: _jsxFileName$16,
30605 lineNumber: 3
30606 },
30607 __self: _this$9
30608 }));
30609};
30610
30611var _jsxFileName$17 = '/Users/dario/opensource/panels/blocks/svg.js';
30612var _this$10 = undefined;
30613var Svg = function Svg(_ref) {
30614 var children = _ref.children,
30615 props = objectWithoutProperties(_ref, ['children']);
30616 return React__default.createElement(
30617 'svg',
30618 _extends({}, props, {
30619 __source: {
30620 fileName: _jsxFileName$17,
30621 lineNumber: 4
30622 },
30623 __self: _this$10
30624 }),
30625 children
30626 );
30627};
30628
30629var _jsxFileName$18 = '/Users/dario/opensource/panels/blocks/path.js';
30630var _this$11 = undefined;
30631var Path = function Path(props) {
30632 return React__default.createElement('path', _extends({}, props, {
30633 __source: {
30634 fileName: _jsxFileName$18,
30635 lineNumber: 3
30636 },
30637 __self: _this$11
30638 }));
30639};
30640
30641var _jsxFileName$19 = '/Users/dario/opensource/panels/blocks/polygon.js';
30642var _this$12 = undefined;
30643var Polygon = function Polygon(props) {
30644 return React__default.createElement('polygon', _extends({}, props, {
30645 __source: {
30646 fileName: _jsxFileName$19,
30647 lineNumber: 3
30648 },
30649 __self: _this$12
30650 }));
30651};
30652
30653var _jsxFileName$20 = '/Users/dario/opensource/panels/blocks/polyline.js';
30654var _this$13 = undefined;
30655var Polyline = function Polyline(props) {
30656 return React__default.createElement('polyline', _extends({}, props, {
30657 __source: {
30658 fileName: _jsxFileName$20,
30659 lineNumber: 3
30660 },
30661 __self: _this$13
30662 }));
30663};
30664
30665exports.DangerouslySetInnerHTML = DangerouslySetInnerHTML;
30666exports.Font = Font;
30667exports.Horizontal = Horizontal;
30668exports.Image = Image;
30669exports.Input = Input;
30670exports.Knocking = Knocking;
30671exports.List = List;
30672exports.Style = Style;
30673exports.Text = Text;
30674exports.Textarea = Textarea;
30675exports.Vertical = _Vertical;
30676exports.Circle = Circle;
30677exports.ClipPath = ClipPath;
30678exports.Ellipse = Ellipse;
30679exports.G = G;
30680exports.Line = Line;
30681exports.Rect = Rect;
30682exports.Svg = Svg;
30683exports.Path = Path;
30684exports.Polygon = Polygon;
30685exports.Polyline = Polyline;
30686},{"mini-unique-id":22,"prop-types":"prop-types","react":"react","style-to-css":73,"webfontloader":79}],"panels/normalise-uri":[function(require,module,exports){
30687'use strict';
30688
30689// original src: https://github.com/substack/path-browserify
30690function normaliseArray(parts, allowAboveRoot) {
30691 // if the path tries to go above the root, `up` ends up > 0
30692 var up = 0;
30693 for (var i = parts.length - 1; i >= 0; i--) {
30694 var last = parts[i];
30695 if (last === '.') {
30696 parts.splice(i, 1);
30697 } else if (last === '..') {
30698 parts.splice(i, 1);
30699 up++;
30700 } else if (up) {
30701 parts.splice(i, 1);
30702 up--;
30703 }
30704 }
30705
30706 // if the path is allowed to go above the root, restore leading ..s
30707 if (allowAboveRoot) {
30708 for (; up--; up) {
30709 parts.unshift('..');
30710 }
30711 }
30712
30713 return parts;
30714}
30715
30716// original src: https://github.com/substack/path-browserify
30717function normalisePath(rawPath) {
30718 var isAbsolute = rawPath.charAt(0) === '/';
30719 var trailingSlash = rawPath.substr(-1) === '/';
30720
30721 // normalise the path
30722 var path = normaliseArray(rawPath.split('/').filter(function (p) {
30723 return !!p;
30724 }), !isAbsolute).join('/');
30725
30726 if (!path && !isAbsolute) {
30727 path = '.';
30728 }
30729 if (path && trailingSlash) {
30730 path += '/';
30731 }
30732
30733 return (isAbsolute ? '/' : '') + path;
30734}
30735
30736var TRAILING_SLASH_REGEX = /\/$/;
30737
30738function withTrailingSlash(uri) {
30739 return TRAILING_SLASH_REGEX.test(uri) ? uri : uri + "/";
30740}
30741
30742var decodeSchema = function decodeSchema(s) {
30743 return s.replace(/<<HTTP>>/g, 'http://').replace(/<<HTTPS>>/g, 'https://');
30744};
30745var encodeSchema = function encodeSchema(s) {
30746 return s.replace(/http:\/\//g, '<<HTTP>>').replace(/https:\/\//g, '<<HTTPS>>');
30747};
30748
30749var index_js = (function (uri) {
30750 return decodeSchema(normalisePath(withTrailingSlash(encodeSchema(uri))));
30751});
30752
30753module.exports = index_js;
30754},{}],"panels/snap":[function(require,module,exports){
30755'use strict';
30756
30757Object.defineProperty(exports, '__esModule', { value: true });
30758
30759function easeOutCubic(currentIteration, startValue, changeInValue, totalIterations) {
30760 return changeInValue * (Math.pow(currentIteration / totalIterations - 1, 3) + 1) + startValue;
30761}
30762
30763var FUNCTIONS = Object.freeze({
30764 easeOutCubic: easeOutCubic
30765});
30766
30767function snap($el, to, scroll, _ref) {
30768 var _ref$delay = _ref.delay,
30769 delay = _ref$delay === undefined ? 10 : _ref$delay,
30770 _ref$duration = _ref.duration,
30771 duration = _ref$duration === undefined ? 75 : _ref$duration,
30772 _ref$fn = _ref.fn,
30773 fn = _ref$fn === undefined ? 'easeOutCubic' : _ref$fn,
30774 _ref$step = _ref.step,
30775 step = _ref$step === undefined ? 5 : _ref$step;
30776
30777 var currentTime = 0;
30778 var next = FUNCTIONS[fn] || easeOutCubic;
30779 var start = $el[scroll];
30780 var change = to - start;
30781
30782 var animate = function animate() {
30783 currentTime += step;
30784
30785 $el[scroll] = next(currentTime, start, change, duration);
30786
30787 if (currentTime < duration) {
30788 requestAnimationFrame(animate);
30789 }
30790 };
30791
30792 setTimeout(animate, delay);
30793}
30794
30795function snapY($el, to) {
30796 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
30797
30798 snap($el, to, 'scrollTop', options);
30799}
30800
30801function snapX($el, to) {
30802 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
30803
30804 snap($el, to, 'scrollLeft', options);
30805}
30806
30807exports.snapY = snapY;
30808exports.snapX = snapX;
30809},{}],"panels":[function(require,module,exports){
30810'use strict';
30811
30812Object.defineProperty(exports, '__esModule', { value: true });
30813
30814function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
30815
30816var redux = require('redux');
30817var createLogger = _interopDefault(require('redux-logger'));
30818var _regeneratorRuntime = _interopDefault(require('regenerator-runtime'));
30819var Route = _interopDefault(require('houkou'));
30820var uniqueId = _interopDefault(require('mini-unique-id'));
30821var thunkMiddleware = _interopDefault(require('redux-thunk'));
30822var reactDom = require('react-dom');
30823var reactRedux = require('react-redux');
30824var React = require('react');
30825var React__default = _interopDefault(React);
30826var debounce = _interopDefault(require('debounce'));
30827var PropTypes = _interopDefault(require('prop-types'));
30828var toCSS = _interopDefault(require('style-to-css'));
30829
30830var asyncGenerator = function () {
30831 function AwaitValue(value) {
30832 this.value = value;
30833 }
30834
30835 function AsyncGenerator(gen) {
30836 var front, back;
30837
30838 function send(key, arg) {
30839 return new Promise(function (resolve, reject) {
30840 var request = {
30841 key: key,
30842 arg: arg,
30843 resolve: resolve,
30844 reject: reject,
30845 next: null
30846 };
30847
30848 if (back) {
30849 back = back.next = request;
30850 } else {
30851 front = back = request;
30852 resume(key, arg);
30853 }
30854 });
30855 }
30856
30857 function resume(key, arg) {
30858 try {
30859 var result = gen[key](arg);
30860 var value = result.value;
30861
30862 if (value instanceof AwaitValue) {
30863 Promise.resolve(value.value).then(function (arg) {
30864 resume("next", arg);
30865 }, function (arg) {
30866 resume("throw", arg);
30867 });
30868 } else {
30869 settle(result.done ? "return" : "normal", result.value);
30870 }
30871 } catch (err) {
30872 settle("throw", err);
30873 }
30874 }
30875
30876 function settle(type, value) {
30877 switch (type) {
30878 case "return":
30879 front.resolve({
30880 value: value,
30881 done: true
30882 });
30883 break;
30884
30885 case "throw":
30886 front.reject(value);
30887 break;
30888
30889 default:
30890 front.resolve({
30891 value: value,
30892 done: false
30893 });
30894 break;
30895 }
30896
30897 front = front.next;
30898
30899 if (front) {
30900 resume(front.key, front.arg);
30901 } else {
30902 back = null;
30903 }
30904 }
30905
30906 this._invoke = send;
30907
30908 if (typeof gen.return !== "function") {
30909 this.return = undefined;
30910 }
30911 }
30912
30913 if (typeof Symbol === "function" && Symbol.asyncIterator) {
30914 AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
30915 return this;
30916 };
30917 }
30918
30919 AsyncGenerator.prototype.next = function (arg) {
30920 return this._invoke("next", arg);
30921 };
30922
30923 AsyncGenerator.prototype.throw = function (arg) {
30924 return this._invoke("throw", arg);
30925 };
30926
30927 AsyncGenerator.prototype.return = function (arg) {
30928 return this._invoke("return", arg);
30929 };
30930
30931 return {
30932 wrap: function (fn) {
30933 return function () {
30934 return new AsyncGenerator(fn.apply(this, arguments));
30935 };
30936 },
30937 await: function (value) {
30938 return new AwaitValue(value);
30939 }
30940 };
30941}();
30942
30943var asyncToGenerator = function (fn) {
30944 return function () {
30945 var gen = fn.apply(this, arguments);
30946 return new Promise(function (resolve, reject) {
30947 function step(key, arg) {
30948 try {
30949 var info = gen[key](arg);
30950 var value = info.value;
30951 } catch (error) {
30952 reject(error);
30953 return;
30954 }
30955
30956 if (info.done) {
30957 resolve(value);
30958 } else {
30959 return Promise.resolve(value).then(function (value) {
30960 step("next", value);
30961 }, function (err) {
30962 step("throw", err);
30963 });
30964 }
30965 }
30966
30967 return step("next");
30968 });
30969 };
30970};
30971
30972var classCallCheck = function (instance, Constructor) {
30973 if (!(instance instanceof Constructor)) {
30974 throw new TypeError("Cannot call a class as a function");
30975 }
30976};
30977
30978var createClass = function () {
30979 function defineProperties(target, props) {
30980 for (var i = 0; i < props.length; i++) {
30981 var descriptor = props[i];
30982 descriptor.enumerable = descriptor.enumerable || false;
30983 descriptor.configurable = true;
30984 if ("value" in descriptor) descriptor.writable = true;
30985 Object.defineProperty(target, descriptor.key, descriptor);
30986 }
30987 }
30988
30989 return function (Constructor, protoProps, staticProps) {
30990 if (protoProps) defineProperties(Constructor.prototype, protoProps);
30991 if (staticProps) defineProperties(Constructor, staticProps);
30992 return Constructor;
30993 };
30994}();
30995
30996var defineProperty = function (obj, key, value) {
30997 if (key in obj) {
30998 Object.defineProperty(obj, key, {
30999 value: value,
31000 enumerable: true,
31001 configurable: true,
31002 writable: true
31003 });
31004 } else {
31005 obj[key] = value;
31006 }
31007
31008 return obj;
31009};
31010
31011var _extends = Object.assign || function (target) {
31012 for (var i = 1; i < arguments.length; i++) {
31013 var source = arguments[i];
31014
31015 for (var key in source) {
31016 if (Object.prototype.hasOwnProperty.call(source, key)) {
31017 target[key] = source[key];
31018 }
31019 }
31020 }
31021
31022 return target;
31023};
31024
31025var inherits = function (subClass, superClass) {
31026 if (typeof superClass !== "function" && superClass !== null) {
31027 throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
31028 }
31029
31030 subClass.prototype = Object.create(superClass && superClass.prototype, {
31031 constructor: {
31032 value: subClass,
31033 enumerable: false,
31034 writable: true,
31035 configurable: true
31036 }
31037 });
31038 if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
31039};
31040
31041var objectWithoutProperties = function (obj, keys) {
31042 var target = {};
31043
31044 for (var i in obj) {
31045 if (keys.indexOf(i) >= 0) continue;
31046 if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
31047 target[i] = obj[i];
31048 }
31049
31050 return target;
31051};
31052
31053var possibleConstructorReturn = function (self, call) {
31054 if (!self) {
31055 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
31056 }
31057
31058 return call && (typeof call === "object" || typeof call === "function") ? call : self;
31059};
31060
31061var slicedToArray = function () {
31062 function sliceIterator(arr, i) {
31063 var _arr = [];
31064 var _n = true;
31065 var _d = false;
31066 var _e = undefined;
31067
31068 try {
31069 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
31070 _arr.push(_s.value);
31071
31072 if (i && _arr.length === i) break;
31073 }
31074 } catch (err) {
31075 _d = true;
31076 _e = err;
31077 } finally {
31078 try {
31079 if (!_n && _i["return"]) _i["return"]();
31080 } finally {
31081 if (_d) throw _e;
31082 }
31083 }
31084
31085 return _arr;
31086 }
31087
31088 return function (arr, i) {
31089 if (Array.isArray(arr)) {
31090 return arr;
31091 } else if (Symbol.iterator in Object(arr)) {
31092 return sliceIterator(arr, i);
31093 } else {
31094 throw new TypeError("Invalid attempt to destructure non-iterable instance");
31095 }
31096 };
31097}();
31098
31099var toConsumableArray = function (arr) {
31100 if (Array.isArray(arr)) {
31101 for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
31102
31103 return arr2;
31104 } else {
31105 return Array.from(arr);
31106 }
31107};
31108
31109// sorting mechanism for matched candidates
31110var FORWARD_SLASHES_REGEX = /\//g;
31111var complexity = function complexity(pattern) {
31112 return pattern.match(FORWARD_SLASHES_REGEX).length;
31113};
31114function compare(a, b) {
31115 return complexity(b.pattern) - complexity(a.pattern);
31116}
31117
31118// cache the app's patterns as routes ready to be matched
31119var getPatterns = function getPatterns(lookup) {
31120 return lookup.map(function (def) {
31121 var _ref = typeof def === 'string' ? { pattern: def } : def,
31122 pattern = _ref.pattern,
31123 config = objectWithoutProperties(_ref, ['pattern']);
31124
31125 return {
31126 pattern: pattern,
31127 route: new Route(pattern, config)
31128 };
31129 });
31130};
31131
31132// define a matcher in case we need to work with a dynamic panel
31133var match = function match(path, lookup) {
31134 return getPatterns(lookup).map(function (_ref2) {
31135 var pattern = _ref2.pattern,
31136 route = _ref2.route;
31137
31138 var params = route.match(path);
31139
31140 if (params) {
31141 return {
31142 params: params,
31143 pattern: pattern
31144 };
31145 } else {
31146 return false;
31147 }
31148 }).filter(Boolean).sort(compare)[0];
31149};
31150
31151function createFindPanel(panels) {
31152 var lookup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
31153
31154 // return our grand matcher
31155 return function findPanel(path) {
31156 // the panel might be static...
31157 var panel = panels[path];
31158 var props = void 0;
31159
31160 // TODO is there any case in which the panel's function should always be called if it's a
31161 // dynamic match?
31162 if (typeof panel === 'undefined') {
31163 // ...or dynamic
31164 var matchedPath = match(path, lookup);
31165
31166 if (matchedPath) {
31167 panel = panels[matchedPath.pattern];
31168 props = matchedPath.params;
31169 }
31170 } else {
31171 props = panel.props || {};
31172 }
31173
31174 return {
31175 panel: panel,
31176 props: props
31177 };
31178 };
31179}
31180
31181function isRequireable(dep) {
31182 var is = false;
31183
31184 try {
31185 require(dep);
31186 is = true;
31187 } catch (err) {}
31188
31189 return is;
31190}
31191
31192// Original source [partition-bundle](https://github.com/arian/partition-bundle/blob/master/lib/loadScript.js)
31193function load(file) {
31194 var _this = this;
31195
31196 return new Promise(function (resolve, reject) {
31197 if (typeof file === 'undefined') {
31198 return resolve();
31199 }
31200
31201 var resource = document.createElement('script');
31202 var done = false;
31203
31204 function ready(err) {
31205 done = true;
31206 resource.onload = resource.onerror = resource.onreadystatechange = null;
31207 clearTimeout(timer);
31208 err ? reject(err) : resolve();
31209 }
31210
31211 resource.onload = resource.onreadystatechange = function (e) {
31212 if (!(done && (!_this.readyState || _this.readyState === 'complete' || _this.readyState === 'loaded'))) {
31213 ready(null);
31214 }
31215 };
31216
31217 resource.onerror = function (error) {
31218 if (!done) {
31219 ready(error || new Error('Could not load file'));
31220 }
31221 };
31222
31223 var timer = setTimeout(function () {
31224 ready(new Error('Resource ' + file + ' loading timed-out'));
31225 }, 3e4);
31226
31227 resource.src = file;
31228 document.getElementsByTagName('head')[0].appendChild(resource);
31229 });
31230}
31231
31232var loadModule = function () {
31233 var _ref = asyncToGenerator(_regeneratorRuntime.mark(function _callee(app) {
31234 var module, response, data;
31235 return _regeneratorRuntime.wrap(function _callee$(_context) {
31236 while (1) {
31237 switch (_context.prev = _context.next) {
31238 case 0:
31239 module = {};
31240 _context.prev = 1;
31241 _context.next = 4;
31242 return fetch('//' + app + '/panels.json');
31243
31244 case 4:
31245 response = _context.sent;
31246 _context.next = 7;
31247 return response.json();
31248
31249 case 7:
31250 data = _context.sent;
31251
31252
31253 if (data.module) {
31254 module = data.module;
31255 }
31256
31257 _context.next = 11;
31258 return load(data.logic);
31259
31260 case 11:
31261 _context.next = 18;
31262 break;
31263
31264 case 13:
31265 _context.prev = 13;
31266 _context.t0 = _context['catch'](1);
31267
31268 console.error(_context.t0);
31269
31270 if (!(_context.t0 instanceof SyntaxError)) {
31271 _context.next = 18;
31272 break;
31273 }
31274
31275 throw new Error('We can\'t load ' + app + '.\n We can\'t find your app\'s logic source.\n\n If you\'re inlining your app with Panels, make sure the script tag is inserted after panels\n and that the required export matches ' + app + '.\n\n If your app is expected to be fetched from a remote source, make sure that\n \'//' + app + '/panels.json\' in place and that it at least includes the logic key pointing to\n your application\'s JS logic URI.\n\n {\n "logic": "https://panels.com/my-application-logic.js"\n }');
31276
31277 case 18:
31278 return _context.abrupt('return', module);
31279
31280 case 19:
31281 case 'end':
31282 return _context.stop();
31283 }
31284 }
31285 }, _callee, this, [[1, 13]]);
31286 }));
31287
31288 return function loadModule(_x) {
31289 return _ref.apply(this, arguments);
31290 };
31291}();
31292
31293var DENY = function DENY() {
31294 return false;
31295};
31296
31297var getApp = (function () {
31298 var _ref2 = asyncToGenerator(_regeneratorRuntime.mark(function _callee2(app, createContext) {
31299 var data, name, props, inline, _require, _require$access, access, notify, lookup, panels, setup, types, context;
31300
31301 return _regeneratorRuntime.wrap(function _callee2$(_context2) {
31302 while (1) {
31303 switch (_context2.prev = _context2.next) {
31304 case 0:
31305 data = void 0;
31306 name = app;
31307 props = {};
31308
31309 if (isRequireable(name)) {
31310 _context2.next = 12;
31311 break;
31312 }
31313
31314 inline = window.panelsJson && window.panelsJson[name];
31315
31316 if (inline) {
31317 data = inline.module;
31318
31319 if (!isRequireable(data.name)) {
31320 console.error('You should embed your app\'s panels bundle script tag');
31321 }
31322 }
31323
31324 if (data) {
31325 _context2.next = 10;
31326 break;
31327 }
31328
31329 _context2.next = 9;
31330 return loadModule(app);
31331
31332 case 9:
31333 data = _context2.sent;
31334
31335 case 10:
31336
31337 if (data.name) {
31338 name = data.name;
31339 }
31340 if (data.props) {
31341 props = data.props;
31342 }
31343
31344 case 12:
31345
31346 /* eslint-disable global-require */
31347 _require = require(name), _require$access = _require.access, access = _require$access === undefined ? DENY : _require$access, notify = _require.notify, lookup = _require.lookup, panels = _require.panels, setup = _require.setup, types = _require.types;
31348 context = createContext(app, name);
31349 _context2.t0 = access;
31350 _context2.t1 = createFindPanel(panels, lookup);
31351 _context2.t2 = name;
31352 _context2.t3 = notify;
31353 _context2.t4 = typeof setup === 'function';
31354
31355 if (!_context2.t4) {
31356 _context2.next = 23;
31357 break;
31358 }
31359
31360 _context2.next = 22;
31361 return setup(app, props, context);
31362
31363 case 22:
31364 _context2.t4 = _context2.sent;
31365
31366 case 23:
31367 _context2.t5 = _context2.t4;
31368 _context2.t6 = types;
31369 return _context2.abrupt('return', {
31370 access: _context2.t0,
31371 findPanel: _context2.t1,
31372 name: _context2.t2,
31373 notify: _context2.t3,
31374 store: _context2.t5,
31375 types: _context2.t6
31376 });
31377
31378 case 26:
31379 case 'end':
31380 return _context2.stop();
31381 }
31382 }
31383 }, _callee2, this);
31384 }));
31385
31386 function get(_x2, _x3) {
31387 return _ref2.apply(this, arguments);
31388 }
31389
31390 return get;
31391})();
31392
31393function getContextAndFocus(_ref) {
31394 var currentFocus = _ref.currentFocus,
31395 next = _ref.next,
31396 last = _ref.last;
31397
31398 // focus works in relation to the currentFocus, so try to do what the user wants
31399 var focus = currentFocus + next.focus;
31400 if (focus < 0 || focus > last) {
31401 // however, they may go out of boundaries in such cases we default to the last route
31402 focus = last;
31403 }
31404
31405 // context works in relation to the new focus, so try to do what the user wants,
31406 // it tells how many panels we should preferably show before the focus.
31407 // we say preferably because it might be the case that it isn't possible to fit them all in the
31408 // current viewport
31409 var context = 0;
31410 if (typeof next.context === 'number') {
31411 context = focus - next.context;
31412
31413 if (context < 0 || context > focus) {
31414 // if the value is out of boundaries, default to showing all
31415 context = 0;
31416 }
31417 }
31418
31419 return {
31420 context: context,
31421 focus: focus
31422 };
31423}
31424
31425function getIndexOfPanelToShow(at, regions) {
31426 var index = regions.findIndex(function (region) {
31427 return at < region;
31428 });
31429 return index === -1 ? regions.length - 1 : index;
31430}
31431
31432function getNextPosition(_ref) {
31433 var context = _ref.context,
31434 focus = _ref.focus,
31435 maxFullPanelWidth = _ref.maxFullPanelWidth,
31436 routes = _ref.routes,
31437 panels = _ref.panels,
31438 shouldGoMobile = _ref.shouldGoMobile,
31439 viewportWidth = _ref.viewportWidth;
31440
31441 var nextRoutesByContext = routes.byContext;
31442
31443 var widths = routes.items.map(function (routeContext) {
31444 var route = routes.byContext[routeContext];
31445 var panel = panels.byId[route.panelId];
31446
31447 var width = void 0;
31448 if (route.isVisible) {
31449 if (shouldGoMobile) {
31450 width = viewportWidth;
31451 } else {
31452 width = route.isExpanded ? panel.maxWidth : panel.width;
31453
31454 var percentageMatch = typeof width === 'string' && width.match(/([0-9]+)%/);
31455 if (percentageMatch) {
31456 width = maxFullPanelWidth * parseInt(percentageMatch, 10) / 100;
31457 }
31458 }
31459 } else {
31460 width = 0;
31461 }
31462
31463 if (width !== route.width) {
31464 nextRoutesByContext = _extends({}, nextRoutesByContext, defineProperty({}, routeContext, _extends({}, route, {
31465 width: width
31466 })));
31467 }
31468
31469 return width;
31470 });
31471
31472 // get how large our focus panel is
31473 var focusWidth = widths[focus]; // >> 500
31474 // get the focus panel's x real position in our runtime if it were flat
31475 var x = widths.slice(0, focus).reduce(function (a, b) {
31476 return a + b;
31477 }, 0); // >> 860
31478 // get how much space we have left for context panels
31479 var leftForContext = maxFullPanelWidth - focusWidth; // >> 1089
31480 // assess how many context panels we should try to show
31481 var contextsLeft = focus - context - 1;
31482
31483 // try to fit those context panels within that space that's left
31484 while (contextsLeft >= 0 && leftForContext >= widths[contextsLeft]) {
31485 // get the context's width
31486 var contextWidth = widths[contextsLeft];
31487 // remove it from the space left for context
31488 leftForContext -= contextWidth;
31489 // shift x to include that panel
31490 x -= contextWidth;
31491 // decrease the amount of contexts left
31492 contextsLeft--;
31493 }
31494
31495 return {
31496 routesByContext: nextRoutesByContext,
31497 x: x,
31498 width: maxFullPanelWidth + widths.reduce(function (a, b) {
31499 return a + b;
31500 }, 0),
31501 widths: widths
31502 };
31503}
31504
31505function getHalves(widths) {
31506 var halves = [];
31507
31508 widths.forEach(function (width) {
31509 var half = width / 2;
31510
31511 halves.push(half);
31512 halves.push(half);
31513 });
31514
31515 return halves;
31516}
31517
31518var sum = (function (a, b) {
31519 return a + b;
31520});
31521
31522function getRegions(widths) {
31523 var halves = getHalves(widths);
31524
31525 return widths.map(function (_, i) {
31526 var to = i * 2 + 1;
31527 return halves.slice(0, to).reduce(sum, 0);
31528 });
31529}
31530
31531// original src: https://github.com/substack/path-browserify
31532function normaliseArray(parts, allowAboveRoot) {
31533 // if the path tries to go above the root, `up` ends up > 0
31534 var up = 0;
31535 for (var i = parts.length - 1; i >= 0; i--) {
31536 var last = parts[i];
31537 if (last === '.') {
31538 parts.splice(i, 1);
31539 } else if (last === '..') {
31540 parts.splice(i, 1);
31541 up++;
31542 } else if (up) {
31543 parts.splice(i, 1);
31544 up--;
31545 }
31546 }
31547
31548 // if the path is allowed to go above the root, restore leading ..s
31549 if (allowAboveRoot) {
31550 for (; up--; up) {
31551 parts.unshift('..');
31552 }
31553 }
31554
31555 return parts;
31556}
31557
31558// original src: https://github.com/substack/path-browserify
31559function normalisePath(rawPath) {
31560 var isAbsolute = rawPath.charAt(0) === '/';
31561 var trailingSlash = rawPath.substr(-1) === '/';
31562
31563 // normalise the path
31564 var path = normaliseArray(rawPath.split('/').filter(function (p) {
31565 return !!p;
31566 }), !isAbsolute).join('/');
31567
31568 if (!path && !isAbsolute) {
31569 path = '.';
31570 }
31571 if (path && trailingSlash) {
31572 path += '/';
31573 }
31574
31575 return (isAbsolute ? '/' : '') + path;
31576}
31577
31578var TRAILING_SLASH_REGEX = /\/$/;
31579
31580function withTrailingSlash(uri) {
31581 return TRAILING_SLASH_REGEX.test(uri) ? uri : uri + "/";
31582}
31583
31584var decodeSchema = function decodeSchema(s) {
31585 return s.replace(/<<HTTP>>/g, 'http://').replace(/<<HTTPS>>/g, 'https://');
31586};
31587var encodeSchema = function encodeSchema(s) {
31588 return s.replace(/http:\/\//g, '<<HTTP>>').replace(/https:\/\//g, '<<HTTPS>>');
31589};
31590
31591var normaliseUri = (function (uri) {
31592 return decodeSchema(normalisePath(withTrailingSlash(encodeSchema(uri))));
31593});
31594
31595var TRAILING_SLASH_REGEX$1 = /\/$/;
31596
31597var withTrailingSlash$1 = (function (uri) {
31598 return TRAILING_SLASH_REGEX$1.test(uri) ? uri : uri + "/";
31599});
31600
31601var DEFAULT_PARSER = /^https?:\/\/([a-zA-Z0-9\-_.]+)()(\/.*)/;
31602var PROTOCOL = /(https?):\/\//;
31603var SLICE_END = ')';
31604var SLICE_START = '(';
31605var SLICE_MARKERS = new RegExp('[' + SLICE_START + SLICE_END + ']', 'g');
31606
31607// TODO review this, instead of discarding the query string perhaps we can pass it down to
31608// the last panel?
31609var withoutQueryString = function withoutQueryString(s) {
31610 return (/\?/.test(s) ? s.match(/(.*?)\?/)[1] : s
31611 );
31612};
31613
31614var MANY_APPS = /^(https?:\/\/.+?\/)(https?:\/\/.+)/;
31615
31616var appSplit = function appSplit(s) {
31617 var currentUri = s;
31618 var nextUri = false;
31619
31620 var manyAppsMatch = s.match(MANY_APPS);
31621 if (manyAppsMatch) {
31622 currentUri = manyAppsMatch[1];
31623 nextUri = manyAppsMatch[2];
31624 }
31625
31626 return {
31627 currentUri: currentUri,
31628 nextUri: nextUri
31629 };
31630};
31631
31632function parse(uri) {
31633 var parsers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
31634
31635 var apps = {
31636 byName: {},
31637 items: []
31638 };
31639 var routes = {
31640 byContext: {},
31641 items: []
31642
31643 // Make sure we always have a trailing slash on the URI
31644 };var protocol = uri.match(PROTOCOL)[1];
31645 var nextUri = withoutQueryString(withTrailingSlash$1(uri));
31646
31647 var _loop = function _loop() {
31648 var split = appSplit(nextUri);
31649 var currentUri = split.currentUri;
31650 nextUri = split.nextUri;
31651
31652 var parser = parsers.find(function (p) {
31653 return p.test(currentUri);
31654 }) || DEFAULT_PARSER;
31655
31656 var _currentUri$match = currentUri.match(parser),
31657 _currentUri$match2 = slicedToArray(_currentUri$match, 4),
31658 _0 = _currentUri$match2[0],
31659 app = _currentUri$match2[1],
31660 _1 = _currentUri$match2[2],
31661 path = _currentUri$match2[3];
31662
31663 var base = protocol + '://' + app;
31664 var context = routes.items.length > 0 ? routes.items[routes.items.length - 1] : '';
31665
31666 // Get every path 'bit' which is indeed every panel we need to load
31667 var pathRoute = [];
31668 var isVisible = true;
31669 do {
31670 path = path.split('/');
31671 var lastBit = path.length > 1 ? path[path.length - 2] : '';
31672 path = path.slice(0, path.length - 1).join('/');
31673 var hasSliceEndMarkerForRoot = lastBit.indexOf(SLICE_END) === 0;
31674 var hasSliceEndMarker = !hasSliceEndMarkerForRoot && lastBit.indexOf(SLICE_END) > -1;
31675 var hasSliceStartMarker = lastBit.indexOf(SLICE_START) > -1;
31676
31677 if (hasSliceEndMarker || hasSliceStartMarker) {
31678 isVisible = false;
31679 }
31680
31681 var panelPath = path.replace(SLICE_MARKERS, '') || '/';
31682
31683 var panelId = '' + app + panelPath;
31684
31685 pathRoute.push({
31686 app: app,
31687 context: '' + context + base + withTrailingSlash$1(path),
31688 isVisible: isVisible,
31689 panelId: panelId,
31690 path: panelPath
31691 });
31692
31693 isVisible = hasSliceEndMarkerForRoot ? false : hasSliceStartMarker ? true : isVisible;
31694 } while (path.length);
31695
31696 if (apps.items.indexOf(app) === -1) {
31697 apps.items.push(app);
31698 apps.byName[app] = {
31699 app: app,
31700 panels: []
31701 };
31702 }
31703
31704 pathRoute.reverse().forEach(function (route) {
31705 routes.byContext[route.context] = route;
31706 routes.items.push(route.context);
31707
31708 if (apps.byName[app].panels.indexOf(route.path) === -1) {
31709 apps.byName[app].panels.push(route.path);
31710 }
31711 });
31712 };
31713
31714 do {
31715 _loop();
31716 } while (nextUri);
31717
31718 return {
31719 apps: apps,
31720 routes: routes
31721 };
31722}
31723
31724function ensurePanelShape(panel) {
31725 if (typeof panel.width === 'undefined') {
31726 panel.width = 360;
31727 }
31728}
31729
31730var NAVIGATE = 'panels/NAVIGATE';
31731function navigate(rawUri) {
31732 var nextFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
31733 var nextContext = arguments[2];
31734
31735 return function () {
31736 var _ref = asyncToGenerator(_regeneratorRuntime.mark(function _callee3(dispatch, getState) {
31737 var _this = this;
31738
31739 var _getState, apps, panels, router, runtime, uri, parsed, routes, createAppContext, nextApps, nextPanels, maxFullPanelWidth, isFirstLoad, last, opts, focusRoute, focusPanel, _getContextAndFocus, context, focus, widths, focusWidth, x, leftForContext, contextsLeft, contextWidth, regions, snappedAt;
31740
31741 return _regeneratorRuntime.wrap(function _callee3$(_context3) {
31742 while (1) {
31743 switch (_context3.prev = _context3.next) {
31744 case 0:
31745 _getState = getState(), apps = _getState.apps, panels = _getState.panels, router = _getState.router, runtime = _getState.runtime;
31746 uri = normaliseUri(rawUri);
31747
31748 if (!(uri === router.uri)) {
31749 _context3.next = 4;
31750 break;
31751 }
31752
31753 return _context3.abrupt('return');
31754
31755 case 4:
31756 parsed = parse(uri, router.parsers);
31757 routes = {
31758 byContext: parsed.routes.byContext,
31759 items: parsed.routes.items
31760 };
31761
31762 createAppContext = function createAppContext(appName, appModule) {
31763 var access = function () {
31764 var _ref2 = asyncToGenerator(_regeneratorRuntime.mark(function _callee(name) {
31765 var app;
31766 return _regeneratorRuntime.wrap(function _callee$(_context) {
31767 while (1) {
31768 switch (_context.prev = _context.next) {
31769 case 0:
31770 app = getState().apps.byName[name];
31771
31772 if (!app) {
31773 _context.next = 9;
31774 break;
31775 }
31776
31777 if (!app.access(appName, appModule)) {
31778 _context.next = 6;
31779 break;
31780 }
31781
31782 return _context.abrupt('return', app.store);
31783
31784 case 6:
31785 throw Error('Access to ' + name + ' denied.');
31786
31787 case 7:
31788 _context.next = 10;
31789 break;
31790
31791 case 9:
31792 throw Error('App ' + name + ' doesn\'t exist or it doesn\'t have a store.');
31793
31794 case 10:
31795 case 'end':
31796 return _context.stop();
31797 }
31798 }
31799 }, _callee, _this);
31800 }));
31801
31802 return function access(_x4) {
31803 return _ref2.apply(this, arguments);
31804 };
31805 }();
31806
31807 return {
31808 access: access,
31809 navigate: function navigate$$() {
31810 return dispatch(navigate.apply(undefined, arguments));
31811 },
31812 routes: routes
31813 };
31814 };
31815
31816 // get the next apps
31817
31818
31819 nextApps = {
31820 byName: {},
31821 items: parsed.apps.items.filter(function (name) {
31822 return apps.items.indexOf(name) === -1;
31823 })
31824 };
31825
31826
31827 if (nextApps.items.length) {
31828 dispatch({
31829 type: NAVIGATE,
31830 sequence: {
31831 type: 'start'
31832 },
31833 meta: {
31834 uri: uri
31835 }
31836 });
31837 }
31838
31839 _context3.next = 11;
31840 return Promise.all(nextApps.items.map(function () {
31841 var _ref3 = asyncToGenerator(_regeneratorRuntime.mark(function _callee2(name) {
31842 return _regeneratorRuntime.wrap(function _callee2$(_context2) {
31843 while (1) {
31844 switch (_context2.prev = _context2.next) {
31845 case 0:
31846 _context2.prev = 0;
31847 _context2.next = 3;
31848 return getApp(name, createAppContext);
31849
31850 case 3:
31851 nextApps.byName[name] = _context2.sent;
31852 _context2.next = 9;
31853 break;
31854
31855 case 6:
31856 _context2.prev = 6;
31857 _context2.t0 = _context2['catch'](0);
31858
31859 // TODO
31860 console.error('Can\'t load app ' + name, _context2.t0);
31861
31862 case 9:
31863 case 'end':
31864 return _context2.stop();
31865 }
31866 }
31867 }, _callee2, _this, [[0, 6]]);
31868 }));
31869
31870 return function (_x5) {
31871 return _ref3.apply(this, arguments);
31872 };
31873 }()));
31874
31875 case 11:
31876 nextPanels = {
31877 byId: {},
31878 items: []
31879
31880 // we still need to go through all the apps
31881 };
31882 parsed.apps.items.forEach(function (name) {
31883 // get the list of panels to load
31884 var panelsToLoad = parsed.apps.byName[name].panels;
31885 // get the app
31886 var app = nextApps.byName[name] || apps.byName[name];
31887
31888 panelsToLoad.forEach(function (path) {
31889 var panelId = '' + name + path;
31890 // exit early if the panel is already loaded
31891 if (panels.byId[panelId]) {
31892 return;
31893 }
31894
31895 try {
31896 // find the panel within the app
31897 var _app$findPanel = app.findPanel(path),
31898 panel = _app$findPanel.panel,
31899 props = _app$findPanel.props;
31900
31901 if (typeof panel === 'function') {
31902 panel = panel(props, app.store);
31903 } else {
31904 panel = _extends({}, panel, {
31905 props: props
31906 });
31907 }
31908
31909 // ensure that the panel has a valid shape and defaults
31910 ensurePanelShape(panel);
31911
31912 nextPanels.byId[panelId] = panel;
31913 nextPanels.items.push(panelId);
31914 } catch (error) {
31915 // TODO
31916 console.error('Can\'t load panel ' + panelId, error);
31917 }
31918 });
31919 });
31920
31921 maxFullPanelWidth = runtime.viewportWidth - runtime.snapPoint;
31922 isFirstLoad = typeof router.focus === 'undefined';
31923 last = parsed.routes.items.length - 1;
31924 // determine the context and focus panel
31925
31926 opts = {
31927 currentFocus: router.focus,
31928 next: {
31929 context: nextContext,
31930 focus: nextFocus
31931 },
31932 uri: uri,
31933 last: last
31934 };
31935
31936 if (isFirstLoad) {
31937 focusRoute = parsed.routes.byContext[parsed.routes.items[last]];
31938 focusPanel = nextPanels.byId[focusRoute.panelId];
31939
31940 opts.currentFocus = last;
31941 opts.next.focus = 0;
31942 if (typeof focusPanel.context !== 'undefined') {
31943 opts.next.context = focusPanel.context;
31944 }
31945 }
31946 _getContextAndFocus = getContextAndFocus(opts), context = _getContextAndFocus.context, focus = _getContextAndFocus.focus;
31947 widths = routes.items.map(function (routeContext) {
31948 // if (routes.byContext[routeContext]) {
31949 // return routes.byContext[routeContext].width
31950 // }
31951
31952 var route = routes.byContext[routeContext];
31953 var panel = panels.byId[route.panelId] || nextPanels.byId[route.panelId];
31954
31955 var width = void 0;
31956 if (route.isVisible) {
31957 if (runtime.shouldGoMobile) {
31958 width = runtime.viewportWidth;
31959 } else {
31960 var prevRoute = router.routes.byContext[routeContext];
31961 width = route.isExpanded ? panel.maxWidth : prevRoute && prevRoute.width || panel.width;
31962
31963 var percentageMatch = typeof width === 'string' && width.match(/([0-9]+)%/);
31964 if (percentageMatch) {
31965 width = maxFullPanelWidth * parseInt(percentageMatch, 10) / 100;
31966 }
31967 }
31968 } else {
31969 width = 0;
31970 }
31971
31972 route.width = width;
31973 return width;
31974 });
31975
31976 // get how large our focus panel is
31977
31978 focusWidth = widths[focus]; // >> 500
31979 // get the focus panel's x real position in our runtime if it were flat
31980
31981 x = widths.slice(0, focus).reduce(function (a, b) {
31982 return a + b;
31983 }, 0); // >> 860
31984 // get how much space we have left for context panels
31985
31986 leftForContext = maxFullPanelWidth - focusWidth; // >> 1089
31987 // assess how many context panels we should try to show
31988
31989 contextsLeft = focus - context;
31990
31991 // try to fit those context panels within that space that's left
31992
31993 case 24:
31994 if (!(contextsLeft > 0)) {
31995 _context3.next = 33;
31996 break;
31997 }
31998
31999 // decrease the amount of contexts left
32000 contextsLeft--;
32001
32002 // get the context's width
32003 contextWidth = widths[contextsLeft];
32004
32005 // check if we have space left for this panel to be a visible context panel
32006
32007 if (!(leftForContext < contextWidth)) {
32008 _context3.next = 29;
32009 break;
32010 }
32011
32012 return _context3.abrupt('break', 33);
32013
32014 case 29:
32015
32016 // if we do, remove it from the space left for context
32017 leftForContext -= contextWidth;
32018 // shift x to include that panel
32019 x -= contextWidth;
32020 _context3.next = 24;
32021 break;
32022
32023 case 33:
32024 regions = getRegions(widths);
32025 snappedAt = getIndexOfPanelToShow(x, regions);
32026
32027
32028 dispatch({
32029 type: NAVIGATE,
32030 sequence: {
32031 type: 'next'
32032 },
32033 payload: {
32034 apps: nextApps,
32035 panels: nextPanels,
32036 router: {
32037 context: context,
32038 focus: focus,
32039 routes: routes,
32040 uri: uri
32041 },
32042 runtime: {
32043 maxFullPanelWidth: maxFullPanelWidth,
32044 regions: regions,
32045 snappedAt: snappedAt,
32046 width: maxFullPanelWidth + widths.reduce(function (a, b) {
32047 return a + b;
32048 }, 0),
32049 widths: widths,
32050 x: x
32051 }
32052 },
32053 meta: {
32054 uri: uri
32055 }
32056 });
32057
32058 case 36:
32059 case 'end':
32060 return _context3.stop();
32061 }
32062 }
32063 }, _callee3, this);
32064 }));
32065
32066 function navigateThunk(_x2, _x3) {
32067 return _ref.apply(this, arguments);
32068 }
32069
32070 return navigateThunk;
32071 }();
32072}
32073
32074var TOGGLE_EXPAND = 'panels/panels/TOGGLE_EXPAND';
32075function toggleExpand(routeContext) {
32076 return function toggleExpandThunk(dispatch, getState) {
32077 var _getState2 = getState(),
32078 panels = _getState2.panels,
32079 router = _getState2.router,
32080 runtime = _getState2.runtime;
32081
32082 var routes = router.routes;
32083 var route = routes.byContext[routeContext];
32084
32085 routes.byContext = _extends({}, routes.byContext, defineProperty({}, routeContext, _extends({}, route, {
32086 isExpanded: !route.isExpanded
32087 })));
32088
32089 var nextPosition = getNextPosition({
32090 // snap at the expanded position!
32091 context: router.context, // routeIndex - runtime.snappedAt,
32092 focus: router.focus, // routeIndex,
32093 maxFullPanelWidth: runtime.maxFullPanelWidth,
32094 routes: routes,
32095 panels: panels,
32096 shouldGoMobile: runtime.shouldGoMobile,
32097 viewportWidth: runtime.viewportWidth
32098 });
32099
32100 dispatch({
32101 type: TOGGLE_EXPAND,
32102 payload: nextPosition
32103 });
32104 };
32105}
32106
32107var UPDATE_SETTINGS = 'panels/panels/UPDATE_SETTINGS';
32108function updateSettings(routeContext, _ref4) {
32109 var maxWidth = _ref4.maxWidth,
32110 title = _ref4.title,
32111 styleBackground = _ref4.styleBackground,
32112 width = _ref4.width;
32113
32114 return function updateSettingsThunk(dispatch, getState) {
32115 var _getState3 = getState(),
32116 panels = _getState3.panels,
32117 router = _getState3.router,
32118 runtime = _getState3.runtime;
32119
32120 var nextPanels = {
32121 byId: panels.byId,
32122 items: panels.items
32123 };
32124
32125 var route = router.routes.byContext[routeContext];
32126
32127 if (!route.isVisible) return;
32128
32129 var panel = _extends({}, nextPanels.byId[route.panelId]);
32130
32131 if (maxWidth) {
32132 panel.maxWidth = maxWidth;
32133 }
32134 if (title) {
32135 panel.title = title;
32136 }
32137 if (styleBackground) {
32138 panel.styleBackground = styleBackground;
32139 }
32140 if (width) {
32141 panel.width = width;
32142 }
32143
32144 nextPanels.byId = _extends({}, nextPanels.byId, defineProperty({}, route.panelId, panel));
32145
32146 var nextPosition = void 0;
32147 if (maxWidth || width) {
32148 nextPosition = getNextPosition({
32149 context: router.context,
32150 focus: router.focus,
32151 maxFullPanelWidth: runtime.maxFullPanelWidth,
32152 routes: router.routes,
32153 panels: nextPanels,
32154 shouldGoMobile: runtime.shouldGoMobile,
32155 viewportWidth: runtime.viewportWidth
32156 });
32157 }
32158
32159 dispatch({
32160 type: UPDATE_SETTINGS,
32161 payload: {
32162 nextPanelsById: nextPanels.byId,
32163 nextPosition: nextPosition
32164 }
32165 });
32166 };
32167}
32168
32169var notify = (function (store) {
32170 return function (next) {
32171 return function (action) {
32172 if (action.type === NAVIGATE) {
32173 var _store$getState = store.getState(),
32174 apps = _store$getState.apps;
32175
32176 apps.items.forEach(function (name) {
32177 var app = apps.byName[name];
32178
32179 if (typeof app.notify === 'function') {
32180 app.notify({
32181 type: 'NAVIGATE',
32182 payload: {
32183 uri: action.meta.uri
32184 }
32185 });
32186 }
32187 });
32188 }
32189
32190 return next(action);
32191 };
32192 };
32193});
32194
32195// redux-promise sequence branch without FSA and with mini-unique-id instead
32196// of lodash's version
32197//
32198// https://github.com/acdlite/redux-promise/blob/sequence/src/index.js
32199function isPromise(val) {
32200 return val && typeof val.then === 'function';
32201}
32202
32203function promiseMiddleware(_ref) {
32204 var dispatch = _ref.dispatch;
32205
32206 return function (next) {
32207 return function (action) {
32208 if (isPromise(action.payload)) {
32209 var sequenceId = uniqueId();
32210
32211 dispatch(_extends({}, action, {
32212 payload: undefined,
32213 sequence: {
32214 type: 'start',
32215 id: sequenceId
32216 }
32217 }));
32218
32219 return action.payload.then(function (result) {
32220 return dispatch(_extends({}, action, {
32221 payload: result,
32222 sequence: {
32223 type: 'next',
32224 id: sequenceId
32225 }
32226 }));
32227 }, function (error) {
32228 return dispatch(_extends({}, action, {
32229 payload: error,
32230 error: true,
32231 sequence: {
32232 type: 'next',
32233 id: sequenceId
32234 }
32235 }));
32236 });
32237 }
32238
32239 return next(action);
32240 };
32241 };
32242}
32243
32244var MOVE_LEFT = 'panels/runtime/MOVE_LEFT';
32245function moveLeft() {
32246 return function moveLeftThunk(dispatch, getState) {
32247 var _getState = getState(),
32248 runtime = _getState.runtime;
32249
32250 if (runtime.snappedAt > 0) {
32251 var nextSnappedAt = runtime.snappedAt - 1;
32252
32253 dispatch({
32254 type: MOVE_LEFT,
32255 payload: {
32256 snappedAt: nextSnappedAt,
32257 x: runtime.x - runtime.widths[nextSnappedAt]
32258 }
32259 });
32260 }
32261 };
32262}
32263
32264var MOVE_TO = 'panels/runtime/MOVE_TO';
32265var MOBILE_THRESHOLD$1 = 720;
32266
32267var SET_VIEWPORT_WIDTH = 'panels/runtime/SET_VIEWPORT_WIDTH';
32268function setViewportWidth(viewportWidth) {
32269 return function setViewportWidthThunk(dispatch, getState) {
32270 var _getState3 = getState(),
32271 panels = _getState3.panels,
32272 router = _getState3.router,
32273 runtime = _getState3.runtime;
32274
32275 var shouldGoMobile = viewportWidth <= MOBILE_THRESHOLD$1;
32276 var snapPoint = shouldGoMobile ? 0 : runtime.preferredSnapPoint;
32277 var maxFullPanelWidth = viewportWidth - snapPoint;
32278
32279 var nextPosition = getNextPosition({
32280 context: router.context,
32281 focus: router.focus,
32282 maxFullPanelWidth: maxFullPanelWidth,
32283 routes: router.routes,
32284 panels: panels,
32285 shouldGoMobile: shouldGoMobile,
32286 viewportWidth: viewportWidth
32287 });
32288
32289 dispatch({
32290 type: SET_VIEWPORT_WIDTH,
32291 payload: _extends({
32292 maxFullPanelWidth: maxFullPanelWidth,
32293 shouldGoMobile: shouldGoMobile,
32294 snapPoint: snapPoint,
32295 viewportWidth: viewportWidth
32296 }, nextPosition)
32297 });
32298 };
32299}
32300
32301var SET_X = 'panels/runtime/SET_X';
32302function setX(fromX) {
32303 return function setXThunk(dispatch, getState) {
32304 var _getState4 = getState(),
32305 runtime = _getState4.runtime;
32306
32307 var snappedAt = getIndexOfPanelToShow(fromX, runtime.regions);
32308 var x = runtime.widths.slice(0, snappedAt).reduce(function (a, b) {
32309 return a + b;
32310 }, 0);
32311
32312 if (x === fromX) {
32313 if (runtime.x !== x) {
32314 dispatch({
32315 type: SET_X,
32316 payload: {
32317 snappedAt: snappedAt,
32318 x: x
32319 }
32320 });
32321 }
32322 } else {
32323 // TODO fix this horrible hack :) we're using it to snap at the edges
32324 // we should ideally only be dispatching the second one not x: fromX
32325 dispatch({
32326 type: SET_X,
32327 payload: {
32328 snappedAt: snappedAt,
32329 x: fromX
32330 }
32331 });
32332
32333 dispatch({
32334 type: SET_X,
32335 payload: {
32336 snappedAt: snappedAt,
32337 x: x
32338 }
32339 });
32340 }
32341 };
32342}
32343
32344function getViewportWidth() {
32345 return Math.max(window.document.documentElement.clientWidth, window.innerWidth || 0);
32346}
32347
32348function apps() {
32349 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { byName: {}, items: [] };
32350 var action = arguments[1];
32351
32352 if (action.type === NAVIGATE && action.sequence.type === 'next' && action.payload.apps.items.length) {
32353 return {
32354 byName: _extends({}, state.byName, action.payload.apps.byName),
32355 items: [].concat(toConsumableArray(state.items), toConsumableArray(action.payload.apps.items))
32356 };
32357 } else {
32358 return state;
32359 }
32360}
32361
32362function panels() {
32363 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { byId: {}, items: [] };
32364 var action = arguments[1];
32365
32366 if (action.type === NAVIGATE && action.sequence.type === 'next' && action.payload.panels.items.length) {
32367 return {
32368 byId: _extends({}, state.byId, action.payload.panels.byId),
32369 items: [].concat(toConsumableArray(state.items), toConsumableArray(action.payload.panels.items))
32370 };
32371 } else if (action.type === UPDATE_SETTINGS) {
32372 return _extends({}, state, {
32373 byId: action.payload.nextPanelsById
32374 });
32375 } else {
32376 return state;
32377 }
32378}
32379
32380function router() {
32381 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { isLoading: true, routes: { byContext: {}, items: [] } };
32382 var action = arguments[1];
32383
32384 switch (action.type) {
32385 case NAVIGATE:
32386 if (action.sequence.type === 'start') {
32387 return _extends({}, state, {
32388 isLoading: true,
32389 uri: action.meta.uri
32390 });
32391 } else if (action.sequence.type === 'next') {
32392 return _extends({}, state, action.payload.router, {
32393 isLoading: false
32394 });
32395 }
32396 break;
32397
32398 case SET_VIEWPORT_WIDTH:
32399 case TOGGLE_EXPAND:
32400 return _extends({}, state, {
32401 routes: {
32402 items: state.routes.items,
32403 byContext: action.payload.routesByContext
32404 }
32405 });
32406 break;
32407
32408 case UPDATE_SETTINGS:
32409 if (action.payload.nextPosition) {
32410 return _extends({}, state, {
32411 routes: {
32412 items: state.routes.items,
32413 byContext: action.payload.nextPosition.routesByContext
32414 }
32415 });
32416 } else {
32417 return state;
32418 }
32419 break;
32420
32421 default:
32422 return state;
32423 }
32424}
32425
32426var MOBILE_THRESHOLD = 720;
32427
32428// TODO REVERT!
32429var preferredSnapPoint = window.panels && typeof window.panels.preferredSnapPoint === 'number' ? window.panels.preferredSnapPoint : 90;
32430var viewportWidth = getViewportWidth();
32431var shouldGoMobile = viewportWidth < MOBILE_THRESHOLD;
32432var snapPoint = shouldGoMobile ? 0 : preferredSnapPoint;
32433
32434var RUNTIME_DEFAULT_STATE = {
32435 maxFullPanelWidth: viewportWidth - snapPoint,
32436 preferredSnapPoint: preferredSnapPoint,
32437 snappedAt: 0,
32438 snapPoint: snapPoint,
32439 shouldGoMobile: shouldGoMobile,
32440 x: 0,
32441 viewportWidth: viewportWidth,
32442 width: viewportWidth,
32443 widths: []
32444};
32445
32446function runtime() {
32447 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : RUNTIME_DEFAULT_STATE;
32448 var action = arguments[1];
32449
32450 switch (action.type) {
32451 // TODO normalise
32452 case MOVE_LEFT:
32453 case MOVE_TO:
32454 case SET_X:
32455 return _extends({}, state, {
32456 snappedAt: action.payload.snappedAt,
32457 x: action.payload.x
32458 });
32459 break;
32460
32461 case NAVIGATE:
32462 if (action.sequence.type === 'next') {
32463 return _extends({}, state, {
32464 maxFullPanelWidth: action.payload.runtime.maxFullPanelWidth,
32465 regions: action.payload.runtime.regions,
32466 snappedAt: action.payload.runtime.snappedAt,
32467 width: action.payload.runtime.width,
32468 widths: action.payload.runtime.widths,
32469 x: action.payload.runtime.x
32470 });
32471 } else {
32472 return state;
32473 }
32474 break;
32475
32476 case SET_VIEWPORT_WIDTH:
32477 return _extends({}, state, {
32478 maxFullPanelWidth: action.payload.maxFullPanelWidth,
32479 shouldGoMobile: action.payload.shouldGoMobile,
32480 snapPoint: action.payload.snapPoint,
32481 viewportWidth: action.payload.viewportWidth,
32482 width: action.payload.width,
32483 widths: action.payload.widths,
32484 x: action.payload.x
32485 });
32486 break;
32487
32488 case TOGGLE_EXPAND:
32489 return _extends({}, state, {
32490 width: action.payload.width,
32491 widths: action.payload.widths,
32492 x: action.payload.x
32493 });
32494 break;
32495
32496 case UPDATE_SETTINGS:
32497 if (action.payload.nextPosition) {
32498 return _extends({}, state, {
32499 width: action.payload.nextPosition.width,
32500 widths: action.payload.nextPosition.widths,
32501 x: action.payload.nextPosition.x
32502 });
32503 } else {
32504 return state;
32505 }
32506 break;
32507
32508 default:
32509 return state;
32510 }
32511}
32512
32513var rootReducer = redux.combineReducers({
32514 apps: apps,
32515 panels: panels,
32516 router: router,
32517 runtime: runtime
32518});
32519
32520var loggerMiddleware = createLogger({
32521 collapsed: true,
32522 duration: true
32523});
32524
32525var middleware = redux.applyMiddleware(thunkMiddleware, promiseMiddleware, loggerMiddleware, notify);
32526
32527function configureStore(state) {
32528 return redux.createStore(rootReducer, state, middleware);
32529}
32530
32531var _jsxFileName$2 = '/Users/dario/opensource/panels/runtime/base-style.js';
32532var _this = undefined;
32533var BaseStyle = (function (props) {
32534 return React__default.createElement(
32535 'style',
32536 {
32537 __source: {
32538 fileName: _jsxFileName$2,
32539 lineNumber: 4
32540 },
32541 __self: _this
32542 },
32543 '\n * {\n -webkit-overflow-scrolling: touch;\n }\n html,body,#root {\n height:100%;\n margin:0;\n }\n a,button,div,img,input,form,h1,h2,h3,h4,h5,h6,h7,nav,label,li,ol,p,span,svg,ul {\n box-sizing: border-box;\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-align: stretch;\n -ms-flex-align: stretch;\n align-items: stretch;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n margin: 0;\n padding: 0;\n }\n button,a {\n background-color: transparent;\n border: 0;\n margin: 0;\n padding: 0;\n white-space: normal;\n line-height: inherit;\n text-align: left;\n font-family: inherit;\n font-size: inherit;\n }\n button::-moz-focus-inner {\n border: 0;\n margin: 0;\n padding: 0;\n }\n '
32544 );
32545});
32546
32547var _jsxFileName$5 = '/Users/dario/opensource/panels/blocks/teleport.js';
32548var Teleport = function (_React$Component) {
32549 inherits(Teleport, _React$Component);
32550
32551 function Teleport(props, context) {
32552 classCallCheck(this, Teleport);
32553
32554 var _this = possibleConstructorReturn(this, (Teleport.__proto__ || Object.getPrototypeOf(Teleport)).call(this, props, context));
32555
32556 _this.className = 'Teleport-' + uniqueId();
32557 return _this;
32558 }
32559
32560 createClass(Teleport, [{
32561 key: 'render',
32562 value: function render() {
32563 var className = this.className;
32564 var _props = this.props,
32565 context = _props.context,
32566 children = _props.children,
32567 focus = _props.focus,
32568 loose = _props.loose,
32569 onClick = _props.onClick,
32570 _ref = _props._ref,
32571 style = _props.style,
32572 styleActive = _props.styleActive,
32573 styleActiveHover = _props.styleActiveHover,
32574 styleHover = _props.styleHover,
32575 title = _props.title,
32576 to = _props.to,
32577 rest = objectWithoutProperties(_props, ['context', 'children', 'focus', 'loose', 'onClick', '_ref', 'style', 'styleActive', 'styleActiveHover', 'styleHover', 'title', 'to']);
32578 var _context = this.context,
32579 isActive = _context.isActive,
32580 navigate = _context.navigate,
32581 route = _context.route;
32582
32583 var active = isActive(to, loose);
32584 var href = normaliseUri('' + route.context + to);
32585
32586 var inlineStyle = '';
32587 if (!active && styleHover) {
32588 inlineStyle = '.' + className + ':hover {' + toCSS(styleHover) + '}';
32589 }
32590 if (active && styleActiveHover) {
32591 inlineStyle = '.' + className + ':hover {' + toCSS(styleActiveHover) + '}';
32592 }
32593 var finalStyle = active ? _extends({}, style, styleActive) : style;
32594
32595 var finalOnClick = function finalOnClick(event) {
32596 event.preventDefault();
32597 var preventNavigate = false;
32598
32599 if (typeof onClick === 'function') {
32600 preventNavigate = onClick(event);
32601 }
32602
32603 if (preventNavigate !== true) {
32604 navigate(to, focus, context);
32605 }
32606 };
32607
32608 if (_ref) {
32609 rest.ref = _ref;
32610 }
32611
32612 return React__default.createElement(
32613 'a',
32614 _extends({}, rest, {
32615 className: className,
32616 href: href,
32617 onClick: finalOnClick,
32618 style: finalStyle,
32619 title: title,
32620 __source: {
32621 fileName: _jsxFileName$5,
32622 lineNumber: 61
32623 },
32624 __self: this
32625 }),
32626 React__default.createElement(
32627 'style',
32628 {
32629 __source: {
32630 fileName: _jsxFileName$5,
32631 lineNumber: 69
32632 },
32633 __self: this
32634 },
32635 inlineStyle
32636 ),
32637 children
32638 );
32639 }
32640 }]);
32641 return Teleport;
32642}(React__default.Component);
32643
32644Teleport.contextTypes = {
32645 isActive: PropTypes.func.isRequired,
32646 navigate: PropTypes.func.isRequired,
32647 route: PropTypes.shape({
32648 context: PropTypes.string.isRequired
32649 }).isRequired
32650};
32651
32652var _jsxFileName$6 = '/Users/dario/opensource/panels/blocks/go-to.js';
32653var GoTo = function (_React$Component) {
32654 inherits(GoTo, _React$Component);
32655
32656 function GoTo() {
32657 classCallCheck(this, GoTo);
32658 return possibleConstructorReturn(this, (GoTo.__proto__ || Object.getPrototypeOf(GoTo)).apply(this, arguments));
32659 }
32660
32661 createClass(GoTo, [{
32662 key: 'render',
32663 value: function render() {
32664 var _props = this.props,
32665 children = _props.children,
32666 className = _props.className,
32667 _ref = _props._ref,
32668 styleActive = _props.styleActive,
32669 styleHover = _props.styleHover,
32670 props = objectWithoutProperties(_props, ['children', 'className', '_ref', 'styleActive', 'styleHover']);
32671
32672
32673 var inlineStyle = null;
32674 if (Object.keys(styleHover).length) {
32675 inlineStyle = React__default.createElement(
32676 'style',
32677 {
32678 __source: {
32679 fileName: _jsxFileName$6,
32680 lineNumber: 19
32681 },
32682 __self: this
32683 },
32684 '.' + className + ':hover {' + toCSS(styleHover) + '}'
32685 );
32686 }
32687
32688 if (_ref) {
32689 props.ref = _ref;
32690 }
32691
32692 return React__default.createElement(
32693 'a',
32694 _extends({}, props, { className: className, target: '_blank', __source: {
32695 fileName: _jsxFileName$6,
32696 lineNumber: 28
32697 },
32698 __self: this
32699 }),
32700 inlineStyle,
32701 children
32702 );
32703 }
32704 }]);
32705 return GoTo;
32706}(React__default.Component);
32707
32708var _jsxFileName$7 = '/Users/dario/opensource/panels/blocks/on-click.js';
32709var OnClick = function (_React$Component) {
32710 inherits(OnClick, _React$Component);
32711
32712 function OnClick() {
32713 var _ref2;
32714
32715 var _temp, _this, _ret;
32716
32717 classCallCheck(this, OnClick);
32718
32719 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
32720 args[_key] = arguments[_key];
32721 }
32722
32723 return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref2 = OnClick.__proto__ || Object.getPrototypeOf(OnClick)).call.apply(_ref2, [this].concat(args))), _this), _this.state = {}, _temp), possibleConstructorReturn(_this, _ret);
32724 }
32725
32726 createClass(OnClick, [{
32727 key: 'componentWillMount',
32728 value: function componentWillMount() {
32729 var props = this.props;
32730
32731
32732 var manualActive = typeof props.isActive === 'boolean';
32733 this.setState({
32734 isActive: manualActive ? props.isActive : false,
32735 manualActive: manualActive
32736 });
32737
32738 this.bindOnClick(props.onClick);
32739 }
32740 }, {
32741 key: 'componentWillReceiveProps',
32742 value: function componentWillReceiveProps(nextProps) {
32743 this.bindOnClick(nextProps.onClick);
32744
32745 var manualActive = typeof nextProps.isActive === 'boolean';
32746
32747 if (manualActive) {
32748 this.setState({
32749 isActive: nextProps.isActive,
32750 manualActive: manualActive
32751 });
32752 }
32753 }
32754 }, {
32755 key: 'componentWillUnmount',
32756 value: function componentWillUnmount() {
32757 if (this.onClickTimeout) {
32758 clearTimeout(this.onClickTimeout);
32759 }
32760 }
32761 }, {
32762 key: 'bindOnClick',
32763 value: function bindOnClick(onClick) {
32764 var _this2 = this;
32765
32766 var context = this.context;
32767
32768 /* eslint-disable no-console */
32769
32770 var finalOnClick = void 0;
32771 if (typeof onClick === 'function') {
32772 finalOnClick = function finalOnClick() {
32773 try {
32774 onClick();
32775 } catch (err) {
32776 var match = err.message.match(/props\.(.+) is not a function/);
32777 if (match) {
32778 context.transitionTo(match[1].trim(), true);
32779 }
32780 }
32781 };
32782 } else {
32783 var match = void 0;
32784 if (typeof onClick === 'string') {
32785 match = onClick.match(/transitionTo\((.+)\)/);
32786 }
32787 if (match && typeof context.transitionTo === 'function') {
32788 finalOnClick = function finalOnClick() {
32789 return context.transitionTo(match[1].trim());
32790 };
32791 } else {
32792 finalOnClick = function finalOnClick() {
32793 return console.log(onClick);
32794 };
32795 }
32796 }
32797
32798 this.onClick = function (event) {
32799 finalOnClick(event);
32800
32801 event.stopPropagation();
32802
32803 if (!_this2.state.manualActive) {
32804 _this2.setState({
32805 isActive: true
32806 });
32807
32808 _this2.onClickTimeout = setTimeout(function () {
32809 _this2.setState({
32810 isActive: false
32811 });
32812 _this2.onClickTimeout = null;
32813 }, _this2.props.styleActiveTimeout);
32814 }
32815 };
32816 }
32817 }, {
32818 key: 'render',
32819 value: function render() {
32820 var context = this.context;
32821 var isActive = this.state.isActive;
32822 /* eslint-disable no-unused-vars */
32823
32824 var _props = this.props,
32825 ariaLabel = _props['aria-label'],
32826 children = _props.children,
32827 className = _props.className,
32828 _isActive = _props.isActive,
32829 isDisabled = _props.isDisabled,
32830 _ref = _props._ref,
32831 style = _props.style,
32832 styleActive = _props.styleActive,
32833 styleActiveHover = _props.styleActiveHover,
32834 styleActiveTimeout = _props.styleActiveTimeout,
32835 styleDisabled = _props.styleDisabled,
32836 styleHover = _props.styleHover,
32837 rest = objectWithoutProperties(_props, ['aria-label', 'children', 'className', 'isActive', 'isDisabled', '_ref', 'style', 'styleActive', 'styleActiveHover', 'styleActiveTimeout', 'styleDisabled', 'styleHover']);
32838
32839
32840 var inlineStyle = null;
32841 if (!isDisabled) {
32842 rest.onClick = this.onClick;
32843
32844 var fClass = className.split(' ')[0];
32845 if (!isActive && styleHover) {
32846 inlineStyle = React__default.createElement(
32847 'style',
32848 {
32849 __source: {
32850 fileName: _jsxFileName$7,
32851 lineNumber: 114
32852 },
32853 __self: this
32854 },
32855 '.' + fClass + ':hover {' + toCSS(styleHover) + '}'
32856 );
32857 }
32858 if (isActive && styleActiveHover) {
32859 inlineStyle = React__default.createElement(
32860 'style',
32861 {
32862 __source: {
32863 fileName: _jsxFileName$7,
32864 lineNumber: 119
32865 },
32866 __self: this
32867 },
32868 '.' + fClass + ':hover {' + toCSS(styleActiveHover) + '}'
32869 );
32870 }
32871 }
32872
32873 var finalStyle = _extends({
32874 cursor: 'pointer'
32875 }, style);
32876 if (isDisabled) {
32877 finalStyle = _extends({}, finalStyle, {
32878 cursor: 'default'
32879 }, styleDisabled);
32880 } else if (isActive) {
32881 finalStyle = _extends({}, finalStyle, styleActive);
32882 }
32883
32884 if (_ref) {
32885 rest.ref = _ref;
32886 }
32887
32888 return React__default.createElement(
32889 'button',
32890 _extends({}, rest, {
32891 'aria-label': ariaLabel ? context.i18n ? context.i18n.t(ariaLabel) : ariaLabel : undefined,
32892 className: className,
32893 style: finalStyle, __source: {
32894 fileName: _jsxFileName$7,
32895 lineNumber: 146
32896 },
32897 __self: this
32898 }),
32899 inlineStyle,
32900 children
32901 );
32902 }
32903 }]);
32904 return OnClick;
32905}(React__default.Component);
32906
32907OnClick.contextTypes = {
32908 i18n: PropTypes.shape({
32909 t: PropTypes.func.isRequired
32910 }),
32911 transitionTo: PropTypes.func
32912};
32913OnClick.defaultProps = {
32914 styleActiveTimeout: 1000
32915};
32916
32917var _jsxFileName$4 = '/Users/dario/opensource/panels/blocks/create-group.js';
32918function createGroup(name, groupStyle) {
32919 var Group = function (_React$Component) {
32920 inherits(Group, _React$Component);
32921
32922 function Group(props, context) {
32923 classCallCheck(this, Group);
32924
32925 var _this = possibleConstructorReturn(this, (Group.__proto__ || Object.getPrototypeOf(Group)).call(this, props, context));
32926
32927 _this.localClassName = name + '-' + uniqueId();
32928 return _this;
32929 }
32930
32931 createClass(Group, [{
32932 key: 'render',
32933 value: function render() {
32934 var _props = this.props,
32935 children = _props.children,
32936 moreClassName = _props.className,
32937 goTo = _props.goTo,
32938 style = _props.style,
32939 teleportTo = _props.teleportTo,
32940 props = objectWithoutProperties(_props, ['children', 'className', 'goTo', 'style', 'teleportTo']);
32941 var localClassName = this.localClassName;
32942 var pages = this.context.pages;
32943
32944
32945 var finalStyle = _extends({}, groupStyle, style);
32946
32947 var className = localClassName;
32948 if (typeof moreClassName === 'string') {
32949 className += ' ' + moreClassName;
32950 }
32951
32952 var Base = void 0;
32953 if (teleportTo) {
32954 Base = Teleport;
32955 props.to = teleportTo;
32956 } else if (goTo) {
32957 Base = GoTo;
32958 props.href = goTo;
32959 } else if ((props.onClick || props.onMouseDown || props.onMouseUp) && !props.noButton) {
32960 Base = OnClick;
32961 } else {
32962 var isDisabled = props.isDisabled,
32963 noButton = props.noButton,
32964 _ref = props._ref,
32965 styleDisabled = props.styleDisabled,
32966 styleActive = props.styleActive,
32967 styleActiveHover = props.styleActiveHover,
32968 styleActiveTimeout = props.styleActiveTimeout,
32969 styleHover = props.styleHover,
32970 rest = objectWithoutProperties(props, ['isDisabled', 'noButton', '_ref', 'styleDisabled', 'styleActive', 'styleActiveHover', 'styleActiveTimeout', 'styleHover']);
32971
32972
32973 var inlineStyle = null;
32974 if (isDisabled) {
32975 if (styleDisabled) {
32976 finalStyle = _extends({}, finalStyle, styleDisabled);
32977 }
32978 } else {
32979 if (Object.keys(styleHover).length) {
32980 inlineStyle = React__default.createElement(
32981 'style',
32982 {
32983 __source: {
32984 fileName: _jsxFileName$4,
32985 lineNumber: 75
32986 },
32987 __self: this
32988 },
32989 '.' + localClassName + ':hover {' + toCSS(styleHover) + '}'
32990 );
32991 }
32992 }
32993
32994 return React__default.createElement(
32995 'div',
32996 _extends({}, rest, { className: className, ref: _ref, style: finalStyle, __source: {
32997 fileName: _jsxFileName$4,
32998 lineNumber: 81
32999 },
33000 __self: this
33001 }),
33002 inlineStyle,
33003 children
33004 );
33005 }
33006
33007 if (pages && pages.isSelecting) {
33008 props.onClick = function (event) {
33009 if (event) {
33010 event.preventDefault();
33011 }
33012 return true;
33013 };
33014 }
33015
33016 return React__default.createElement(
33017 Base,
33018 _extends({}, props, { className: className, style: finalStyle, __source: {
33019 fileName: _jsxFileName$4,
33020 lineNumber: 98
33021 },
33022 __self: this
33023 }),
33024 children
33025 );
33026 }
33027 }]);
33028 return Group;
33029 }(React__default.Component);
33030
33031 Group.contextTypes = {
33032 pages: PropTypes.shape({
33033 isSelecting: PropTypes.bool
33034 })
33035 };
33036
33037 Group.defaultProps = {
33038 className: '',
33039 style: {},
33040 styleActive: {},
33041 styleHover: {}
33042 };
33043
33044 Group.displayName = name;
33045
33046 return Group;
33047}
33048
33049var Horizontal = createGroup('Horizontal', { flexDirection: 'row' });
33050
33051var _jsxFileName$3 = '/Users/dario/opensource/panels/blocks/knocking.js';
33052var _this$1 = undefined;
33053var animation = '@keyframes scaleout {\n 0% {\n transform: scale(0.0);\n -webkit-transform: scale(0.0);\n } 100% {\n transform: scale(1.0);\n -webkit-transform: scale(1.0);\n opacity: 0;\n }\n}';
33054
33055var Knocking = function Knocking(_ref) {
33056 var dataBlock = _ref['data-block'],
33057 size = _ref.size,
33058 _ref$style = _ref.style,
33059 style = _ref$style === undefined ? {} : _ref$style;
33060
33061 var finalStyle = _extends({
33062 animation: 'scaleout 1.0s infinite linear',
33063 backgroundColor: style.color,
33064 borderRadius: size,
33065 height: size,
33066 WebkitAnimation: 'scaleout 1.0s infinite linear',
33067 width: size
33068 }, style);
33069
33070 return React__default.createElement(
33071 Horizontal,
33072 { 'data-block': dataBlock, style: finalStyle, __source: {
33073 fileName: _jsxFileName$3,
33074 lineNumber: 27
33075 },
33076 __self: _this$1
33077 },
33078 React__default.createElement(
33079 'style',
33080 {
33081 __source: {
33082 fileName: _jsxFileName$3,
33083 lineNumber: 28
33084 },
33085 __self: _this$1
33086 },
33087 animation
33088 )
33089 );
33090};
33091
33092Knocking.defaultProps = {
33093 style: {
33094 color: '#323232'
33095 },
33096 size: 32
33097};
33098
33099var _jsxFileName$9 = '/Users/dario/opensource/panels/error-boundary.js';
33100var ErrorBoundary = function (_React$Component) {
33101 inherits(ErrorBoundary, _React$Component);
33102
33103 function ErrorBoundary() {
33104 var _ref;
33105
33106 var _temp, _this, _ret;
33107
33108 classCallCheck(this, ErrorBoundary);
33109
33110 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
33111 args[_key] = arguments[_key];
33112 }
33113
33114 return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = ErrorBoundary.__proto__ || Object.getPrototypeOf(ErrorBoundary)).call.apply(_ref, [this].concat(args))), _this), _this.state = { hasError: false }, _temp), possibleConstructorReturn(_this, _ret);
33115 }
33116
33117 createClass(ErrorBoundary, [{
33118 key: 'componentDidCatch',
33119 value: function componentDidCatch(error, info) {
33120 // Display fallback UI
33121 this.setState({ hasError: true });
33122 }
33123 }, {
33124 key: 'render',
33125 value: function render() {
33126 if (this.state.hasError) {
33127 return React__default.createElement(
33128 'div',
33129 {
33130 __source: {
33131 fileName: _jsxFileName$9,
33132 lineNumber: 13
33133 },
33134 __self: this
33135 },
33136 ':/'
33137 );
33138 }
33139
33140 return this.props.children;
33141 }
33142 }]);
33143 return ErrorBoundary;
33144}(React__default.Component);
33145
33146var _jsxFileName$8 = '/Users/dario/opensource/panels/route.js';
33147var Route$1 = function (_React$Component) {
33148 inherits(Route, _React$Component);
33149
33150 function Route() {
33151 var _ref;
33152
33153 var _temp, _this, _ret;
33154
33155 classCallCheck(this, Route);
33156
33157 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
33158 args[_key] = arguments[_key];
33159 }
33160
33161 return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = Route.__proto__ || Object.getPrototypeOf(Route)).call.apply(_ref, [this].concat(args))), _this), _this.isActive = function (path) {
33162 var _this$props = _this.props,
33163 route = _this$props.route,
33164 router = _this$props.router,
33165 routeIndex = _this$props.routeIndex;
33166
33167
33168 var routeAfterContext = router.routes.items[routeIndex + 1];
33169 return routeAfterContext && normaliseUri('' + route.context + path) === routeAfterContext;
33170 }, _this.navigate = function (toUri, focus, context) {
33171 var raw = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
33172 return _this.props.navigate(raw ? toUri : '' + _this.props.route.context + toUri, focus, context);
33173 }, _this.toggleExpand = function () {
33174 return _this.props.toggleExpand(_this.props.route.context);
33175 }, _this.updateSettings = function (settings) {
33176 return _this.props.updateSettings(_this.props.route.context, settings);
33177 }, _temp), possibleConstructorReturn(_this, _ret);
33178 }
33179
33180 createClass(Route, [{
33181 key: 'getChildContext',
33182 value: function getChildContext() {
33183 var isActive = this.isActive,
33184 navigate = this.navigate,
33185 toggleExpand = this.toggleExpand,
33186 updateSettings = this.updateSettings;
33187 var _props = this.props,
33188 isContext = _props.isContext,
33189 isFocus = _props.isFocus,
33190 panel = _props.panel,
33191 route = _props.route,
33192 routeIndex = _props.routeIndex,
33193 router = _props.router;
33194
33195
33196 return {
33197 isActive: isActive,
33198 isContext: isContext,
33199 isFocus: isFocus,
33200 navigate: navigate,
33201 panel: panel,
33202 route: route,
33203 routeIndex: routeIndex,
33204 router: router,
33205 toggleExpand: toggleExpand,
33206 updateSettings: updateSettings
33207 };
33208 }
33209 }, {
33210 key: 'render',
33211 value: function render() {
33212 var isActive = this.isActive,
33213 navigate = this.navigate,
33214 props = this.props,
33215 toggleExpand = this.toggleExpand,
33216 updateSettings = this.updateSettings;
33217
33218
33219 var res = void 0;
33220
33221 if (props.panel.isCustom) {
33222 res = React__default.createElement(CustomRoute, _extends({}, props, {
33223 __source: {
33224 fileName: _jsxFileName$8,
33225 lineNumber: 53
33226 },
33227 __self: this
33228 }));
33229 } else {
33230 var Type = props.Type,
33231 width = props.width,
33232 rest = objectWithoutProperties(props, ['Type', 'width']);
33233
33234 // the order below is correct, width can be overwritten but panels shouldn't be
33235
33236 res = React__default.createElement(Type, _extends({
33237 width: width
33238 }, props.panel.props, {
33239 panels: _extends({}, rest, {
33240 isActive: isActive,
33241 navigate: navigate,
33242 toggleExpand: toggleExpand,
33243 updateSettings: updateSettings
33244 }),
33245 __source: {
33246 fileName: _jsxFileName$8,
33247 lineNumber: 59
33248 },
33249 __self: this
33250 }));
33251 }
33252
33253 return React__default.createElement(
33254 ErrorBoundary,
33255 {
33256 __source: {
33257 fileName: _jsxFileName$8,
33258 lineNumber: 73
33259 },
33260 __self: this
33261 },
33262 res
33263 );
33264 }
33265 }]);
33266 return Route;
33267}(React__default.Component);
33268
33269var routeShape = PropTypes.shape({
33270 app: PropTypes.string.isRequired,
33271 context: PropTypes.string.isRequired,
33272 panelId: PropTypes.string.isRequired,
33273 path: PropTypes.string.isRequired,
33274 isVisible: PropTypes.bool.isRequired,
33275 width: PropTypes.number.isRequired
33276});
33277
33278Route$1.childContextTypes = {
33279 isActive: PropTypes.func.isRequired,
33280 isContext: PropTypes.bool,
33281 isFocus: PropTypes.bool,
33282 navigate: PropTypes.func.isRequired,
33283 panel: PropTypes.object.isRequired,
33284 route: routeShape.isRequired,
33285 routeIndex: PropTypes.number.isRequired,
33286 router: PropTypes.shape({
33287 routes: PropTypes.shape({
33288 byContext: PropTypes.objectOf(routeShape),
33289 items: PropTypes.arrayOf(PropTypes.string)
33290 }),
33291 uri: PropTypes.string.isRequired
33292 }),
33293 toggleExpand: PropTypes.func.isRequired,
33294 updateSettings: PropTypes.func.isRequired
33295};
33296
33297var CustomRoute = function (_React$Component2) {
33298 inherits(CustomRoute, _React$Component2);
33299
33300 function CustomRoute() {
33301 var _ref2;
33302
33303 var _temp2, _this2, _ret2;
33304
33305 classCallCheck(this, CustomRoute);
33306
33307 for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
33308 args[_key2] = arguments[_key2];
33309 }
33310
33311 return _ret2 = (_temp2 = (_this2 = possibleConstructorReturn(this, (_ref2 = CustomRoute.__proto__ || Object.getPrototypeOf(CustomRoute)).call.apply(_ref2, [this].concat(args))), _this2), _this2.state = {}, _this2.subscribe = function (onChange) {
33312 return _this2.onChange = onChange;
33313 }, _temp2), possibleConstructorReturn(_this2, _ret2);
33314 }
33315
33316 createClass(CustomRoute, [{
33317 key: 'componentDidMount',
33318 value: function componentDidMount() {
33319 var isActive = this.isActive,
33320 navigate = this.navigate,
33321 toggleExpand = this.toggleExpand,
33322 updateSettings = this.updateSettings;
33323 var _props2 = this.props,
33324 isContext = _props2.isContext,
33325 isFocus = _props2.isFocus,
33326 panel = _props2.panel,
33327 route = _props2.route,
33328 routeIndex = _props2.routeIndex,
33329 router = _props2.router,
33330 store = _props2.store,
33331 Type = _props2.Type;
33332
33333
33334 var typeProps = {
33335 isActive: isActive,
33336 isContext: isContext,
33337 isFocus: isFocus,
33338 navigate: navigate,
33339 panel: panel,
33340 route: route,
33341 routeIndex: routeIndex,
33342 router: router,
33343 store: store,
33344 toggleExpand: toggleExpand,
33345 updateSettings: updateSettings
33346 };
33347
33348 try {
33349 this.onDestroy = Type(this.$el, typeProps, this.subscribe);
33350 } catch (error) {
33351 console.error('panels:route', error);
33352 }
33353 }
33354 }, {
33355 key: 'componentDidUpdate',
33356 value: function componentDidUpdate(prevProps) {
33357 var _props3 = this.props,
33358 panel = _props3.panel,
33359 route = _props3.route,
33360 routeIndex = _props3.routeIndex,
33361 router = _props3.router,
33362 type = _props3.type;
33363
33364
33365 if (prevProps.type !== type) {
33366 this.componentWillUnmount();
33367 this.componentDidMount();
33368 } else if (typeof this.onChange === 'function' && (prevProps.panel !== panel || prevProps.route !== route || prevProps.routeIndex !== routeIndex || prevProps.router !== router)) {
33369 this.onChange({
33370 panel: panel,
33371 route: route,
33372 routeIndex: routeIndex,
33373 router: router
33374 });
33375 }
33376 }
33377 }, {
33378 key: 'componentWillUnmount',
33379 value: function componentWillUnmount() {
33380 if (typeof this.onDestroy === 'function') {
33381 this.onDestroy();
33382 }
33383 }
33384 }, {
33385 key: 'render',
33386 value: function render() {
33387 var _this3 = this;
33388
33389 var props = this.props,
33390 state = this.state;
33391
33392
33393 return React__default.createElement(
33394 'div',
33395 {
33396 ref: function ref($el) {
33397 _this3.$el = $el;
33398 },
33399 style: _extends({
33400 backgroundColor: state.error && '#ff5959',
33401 height: '100%',
33402 overflowY: 'auto',
33403 width: props.width,
33404 zIndex: props.zIndex
33405 }, props.style),
33406 __source: {
33407 fileName: _jsxFileName$8,
33408 lineNumber: 176
33409 },
33410 __self: this
33411 },
33412 state.error && React__default.createElement(
33413 'pre',
33414 { style: { color: '#ffffff', overflowX: 'scroll', padding: 10 }, __source: {
33415 fileName: _jsxFileName$8,
33416 lineNumber: 190
33417 },
33418 __self: this
33419 },
33420 state.error.stack
33421 )
33422 );
33423 }
33424 }]);
33425 return CustomRoute;
33426}(React__default.Component);
33427
33428var _jsxFileName$1 = '/Users/dario/opensource/panels/runtime/launchpad/index.js';
33429var DEBOUNCE = 250;
33430var LOADING_SIZE = 100;
33431var LOADING_OFFSET = LOADING_SIZE / -2;
33432var REBOUND = 500;
33433
33434var LaunchpadRuntime = function (_Component) {
33435 inherits(LaunchpadRuntime, _Component);
33436
33437 function LaunchpadRuntime() {
33438 var _ref;
33439
33440 var _temp, _this, _ret;
33441
33442 classCallCheck(this, LaunchpadRuntime);
33443
33444 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
33445 args[_key] = arguments[_key];
33446 }
33447
33448 return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = LaunchpadRuntime.__proto__ || Object.getPrototypeOf(LaunchpadRuntime)).call.apply(_ref, [this].concat(args))), _this), _this.onVisibilityChange = function () {
33449 if (document.visibilityState === 'hidden') {
33450 window.removeEventListener('resize', _this.setViewportWidth);
33451 window.removeEventListener('orientationchange', _this.setViewportWidth);
33452 } else {
33453 setTimeout(function () {
33454 _this.setViewportWidth();
33455 window.addEventListener('resize', _this.setViewportWidth, false);
33456 window.addEventListener('orientationchange', _this.setViewportWidth, false);
33457 }, REBOUND);
33458 }
33459 }, _this.setViewportWidth = debounce(function () {
33460 return _this.props.setViewportWidth(getViewportWidth());
33461 }, DEBOUNCE), _temp), possibleConstructorReturn(_this, _ret);
33462 }
33463
33464 createClass(LaunchpadRuntime, [{
33465 key: 'componentDidMount',
33466 value: function componentDidMount() {
33467 window.addEventListener('resize', this.setViewportWidth, false);
33468 window.addEventListener('orientationchange', this.setViewportWidth, false);
33469 document.addEventListener('visibilitychange', this.onVisibilityChange);
33470
33471 this.ensureDefault();
33472 }
33473 }, {
33474 key: 'componentDidUpdate',
33475 value: function componentDidUpdate(prevProps) {
33476 var props = this.props;
33477
33478
33479 if (props.mainPanel && props.mainPanel.title) {
33480 window.document.title = props.mainPanel.title;
33481 }
33482
33483 this.ensureDefault();
33484 }
33485 }, {
33486 key: 'componentWillUnmount',
33487 value: function componentWillUnmount() {
33488 window.removeEventListener('resize', this.setViewportWidth);
33489 window.removeEventListener('orientationchange', this.setViewportWidth);
33490 }
33491 }, {
33492 key: 'ensureDefault',
33493 value: function ensureDefault() {
33494 var props = this.props;
33495
33496 if (props.launchpadPanel && !props.mainPanel) {
33497 props.navigate(props.launchpadRoute.context + '/' + props.launchpadPanel.default);
33498 }
33499 }
33500 }, {
33501 key: 'render',
33502 value: function render() {
33503 var _this2 = this;
33504
33505 var _props = this.props,
33506 dockedApp = _props.dockedApp,
33507 dockedPanel = _props.dockedPanel,
33508 dockedRoute = _props.dockedRoute,
33509 dockedRouteIndex = _props.dockedRouteIndex,
33510 mainApp = _props.mainApp,
33511 mainPanel = _props.mainPanel,
33512 mainRoute = _props.mainRoute,
33513 launchpadApp = _props.launchpadApp,
33514 launchpadPanel = _props.launchpadPanel,
33515 launchpadRoute = _props.launchpadRoute,
33516 navigate = _props.navigate,
33517 router = _props.router,
33518 runtime = _props.runtime,
33519 updateSettings = _props.updateSettings;
33520
33521
33522 var docked = dockedPanel && React__default.createElement(Route$1, {
33523 key: 'docked-' + (dockedPanel.dockLeft ? 'left' : 'right'),
33524 navigate: navigate,
33525 panel: dockedPanel,
33526 route: dockedRoute,
33527 routeIndex: dockedRouteIndex,
33528 router: router,
33529 store: dockedApp.store,
33530 Type: dockedApp.types[dockedPanel.type],
33531 updateSettings: updateSettings,
33532 width: dockedRoute.width,
33533 __source: {
33534 fileName: _jsxFileName$1,
33535 lineNumber: 86
33536 },
33537 __self: this
33538 });
33539
33540 var mainWidth = runtime.viewportWidth - (dockedRoute && dockedRoute.width || 0);
33541
33542 return React__default.createElement(
33543 'div',
33544 {
33545 ref: function ref($e) {
33546 return _this2.$runtime = $e;
33547 },
33548 style: {
33549 flexDirection: 'column',
33550 height: '100%',
33551 overflow: 'hidden',
33552 width: '100%'
33553 },
33554 __source: {
33555 fileName: _jsxFileName$1,
33556 lineNumber: 103
33557 },
33558 __self: this
33559 },
33560 React__default.createElement(BaseStyle, {
33561 __source: {
33562 fileName: _jsxFileName$1,
33563 lineNumber: 112
33564 },
33565 __self: this
33566 }),
33567 launchpadPanel && React__default.createElement(Route$1, {
33568 navigate: navigate,
33569 panel: launchpadPanel,
33570 route: launchpadRoute,
33571 routeIndex: 0,
33572 router: router,
33573 store: launchpadApp.store,
33574 style: _extends({
33575 height: launchpadPanel.height || 0
33576 }, launchpadPanel.style),
33577 Type: launchpadApp.types[launchpadPanel.type],
33578 updateSettings: updateSettings,
33579 width: runtime.viewportWidth,
33580 __source: {
33581 fileName: _jsxFileName$1,
33582 lineNumber: 115
33583 },
33584 __self: this
33585 }),
33586 React__default.createElement(
33587 'div',
33588 {
33589 style: {
33590 flexDirection: 'row',
33591 height: 'calc(100% - ' + (launchpadPanel && launchpadPanel.height || 0) + 'px)',
33592 overflow: 'hidden',
33593 width: '100vw'
33594 },
33595 __source: {
33596 fileName: _jsxFileName$1,
33597 lineNumber: 131
33598 },
33599 __self: this
33600 },
33601 dockedPanel && dockedPanel.dockLeft && docked,
33602 mainPanel && React__default.createElement(Route$1, {
33603 key: 'main',
33604 navigate: navigate,
33605 panel: mainPanel,
33606 route: mainRoute,
33607 routeIndex: 1,
33608 router: router,
33609 store: mainApp.store,
33610 Type: mainApp.types[mainPanel.type],
33611 updateSettings: updateSettings,
33612 width: mainWidth,
33613 __source: {
33614 fileName: _jsxFileName$1,
33615 lineNumber: 143
33616 },
33617 __self: this
33618 }),
33619 dockedPanel && !dockedPanel.dockLeft && docked
33620 ),
33621 router.isLoading ? React__default.createElement(
33622 'div',
33623 {
33624 style: {
33625 flexDirection: 'column',
33626 justifyContent: 'center',
33627 position: 'absolute',
33628 left: LOADING_OFFSET,
33629 top: LOADING_OFFSET
33630 },
33631 __source: {
33632 fileName: _jsxFileName$1,
33633 lineNumber: 160
33634 },
33635 __self: this
33636 },
33637 React__default.createElement(Knocking, { size: LOADING_SIZE, __source: {
33638 fileName: _jsxFileName$1,
33639 lineNumber: 169
33640 },
33641 __self: this
33642 })
33643 ) : null
33644 );
33645 }
33646 }]);
33647 return LaunchpadRuntime;
33648}(React.Component);
33649
33650function mapStateToProps(_ref2, props) {
33651 var apps = _ref2.apps,
33652 panels = _ref2.panels,
33653 runtime = _ref2.runtime,
33654 router = _ref2.router;
33655
33656 var launchpadRoute = router.routes.byContext[router.routes.items[0]];
33657 var mainRoute = router.routes.byContext[router.routes.items[1]];
33658 var dockedRoute = void 0;
33659 var dockedRouteIndex = void 0;
33660 if (router.routes.items.length > 2) {
33661 dockedRouteIndex = router.routes.items.length - 1;
33662 dockedRoute = router.routes.byContext[router.routes.items[dockedRouteIndex]];
33663 }
33664
33665 var dockedPanel = dockedRoute && panels.byId[dockedRoute.panelId];
33666 var mainPanel = mainRoute && panels.byId[mainRoute.panelId];
33667
33668 return {
33669 dockedApp: dockedRoute && apps.byName[dockedRoute.app],
33670 dockedPanel: dockedPanel,
33671 dockedRoute: dockedRoute,
33672 dockedRouteIndex: dockedRouteIndex,
33673
33674 focusPanel: dockedPanel || mainPanel, // <-- TODO will change with what's open & focused, e.g. TOC
33675
33676 mainApp: mainRoute && apps.byName[mainRoute.app],
33677 mainPanel: mainPanel,
33678 mainRoute: mainRoute,
33679
33680 launchpadApp: launchpadRoute && apps.byName[launchpadRoute.app],
33681 launchpadPanel: launchpadRoute && panels.byId[launchpadRoute.panelId],
33682 launchpadRoute: launchpadRoute,
33683
33684 router: router,
33685 runtime: runtime
33686 };
33687}
33688
33689var mapDispatchToProps = {
33690 navigate: navigate,
33691 setViewportWidth: setViewportWidth,
33692 updateSettings: updateSettings
33693};
33694var Launchpad = reactRedux.connect(mapStateToProps, mapDispatchToProps)(LaunchpadRuntime);
33695
33696function easeOutCubic(currentIteration, startValue, changeInValue, totalIterations) {
33697 return changeInValue * (Math.pow(currentIteration / totalIterations - 1, 3) + 1) + startValue;
33698}
33699
33700var FUNCTIONS = Object.freeze({
33701 easeOutCubic: easeOutCubic
33702});
33703
33704function snap($el, to, scroll, _ref) {
33705 var _ref$delay = _ref.delay,
33706 delay = _ref$delay === undefined ? 10 : _ref$delay,
33707 _ref$duration = _ref.duration,
33708 duration = _ref$duration === undefined ? 75 : _ref$duration,
33709 _ref$fn = _ref.fn,
33710 fn = _ref$fn === undefined ? 'easeOutCubic' : _ref$fn,
33711 _ref$step = _ref.step,
33712 step = _ref$step === undefined ? 5 : _ref$step;
33713
33714 var currentTime = 0;
33715 var next = FUNCTIONS[fn] || easeOutCubic;
33716 var start = $el[scroll];
33717 var change = to - start;
33718
33719 var animate = function animate() {
33720 currentTime += step;
33721
33722 $el[scroll] = next(currentTime, start, change, duration);
33723
33724 if (currentTime < duration) {
33725 requestAnimationFrame(animate);
33726 }
33727 };
33728
33729 setTimeout(animate, delay);
33730}
33731
33732function snapX($el, to) {
33733 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
33734
33735 snap($el, to, 'scrollLeft', options);
33736}
33737
33738var _jsxFileName$12 = "/Users/dario/opensource/panels/playground/arrow-left.js";
33739var _this$3 = undefined;
33740var ArrowLeft = function ArrowLeft(props) {
33741 return React__default.createElement(
33742 "svg",
33743 { height: "10px", viewBox: "0 0 10 10", width: "10px", __source: {
33744 fileName: _jsxFileName$12,
33745 lineNumber: 4
33746 },
33747 __self: _this$3
33748 },
33749 React__default.createElement("path", { fill: props.fill, d: "M6.826,10.011c0.236,0,0.473-0.083,0.664-0.252C7.903,9.392,7.941,8.76,7.574,8.347L4.603,5l2.971-3.347 C7.94,1.24,7.903,0.608,7.49,0.241C7.076-0.125,6.444-0.087,6.078,0.325L2.517,4.336c-0.336,0.379-0.336,0.949,0,1.328 l3.561,4.011C6.276,9.897,6.55,10.011,6.826,10.011z", __source: {
33750 fileName: _jsxFileName$12,
33751 lineNumber: 5
33752 },
33753 __self: _this$3
33754 })
33755 );
33756};
33757ArrowLeft.defaultProps = {
33758 fill: '#FFFFFF'
33759};
33760
33761var _jsxFileName$11 = '/Users/dario/opensource/panels/runtime/trails/move-left.js';
33762var _this$2 = undefined;
33763var DIAMETER = 40;
33764
33765var MoveLeft = function MoveLeft(_ref) {
33766 var onClick = _ref.onClick,
33767 snapPoint = _ref.snapPoint;
33768 return React__default.createElement(
33769 'div',
33770 {
33771 onClick: onClick,
33772 style: {
33773 alignItems: 'center',
33774 backgroundColor: '#00ADEE',
33775 borderRadius: DIAMETER,
33776 bottom: 32,
33777 cursor: 'pointer',
33778 height: DIAMETER,
33779 justifyContent: 'center',
33780 left: snapPoint - DIAMETER / 2,
33781 position: 'fixed',
33782 width: DIAMETER,
33783 zIndex: 100000
33784 },
33785 __source: {
33786 fileName: _jsxFileName$11,
33787 lineNumber: 7
33788 },
33789 __self: _this$2
33790 },
33791 React__default.createElement(ArrowLeft, {
33792 __source: {
33793 fileName: _jsxFileName$11,
33794 lineNumber: 23
33795 },
33796 __self: _this$2
33797 })
33798 );
33799};
33800
33801var supports = false;
33802try {
33803 var opts = Object.defineProperty({}, 'passive', {
33804 get: function get() {
33805 supports = true;
33806 }
33807 });
33808 window.addEventListener('test', null, opts);
33809} catch (e) {}
33810
33811var supportsPassiveEvents = supports;
33812
33813var _jsxFileName$10 = '/Users/dario/opensource/panels/runtime/trails/index.js';
33814var DEBOUNCE$1 = 250;
33815var LOADING_SIZE$1 = 100;
33816var LOADING_OFFSET$1 = LOADING_SIZE$1 / -2;
33817var REBOUND$1 = 500;
33818
33819var scrollEventOptions = supportsPassiveEvents ? { passive: true } : false;
33820
33821var style = {
33822 height: '100%',
33823 overflowX: 'auto',
33824 overflowY: 'hidden',
33825 width: '100vw'
33826};
33827
33828var Runtime = function (_React$Component) {
33829 inherits(Runtime, _React$Component);
33830
33831 function Runtime() {
33832 var _ref;
33833
33834 var _temp, _this, _ret;
33835
33836 classCallCheck(this, Runtime);
33837
33838 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
33839 args[_key] = arguments[_key];
33840 }
33841
33842 return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = Runtime.__proto__ || Object.getPrototypeOf(Runtime)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
33843 autoScroll: null
33844 }, _this.onVisibilityChange = function () {
33845 if (document.visibilityState === 'hidden') {
33846 if (_this.props.snap) {
33847 _this.$runtime.removeEventListener('scroll', _this.setX);
33848 }
33849 window.removeEventListener('resize', _this.setViewportWidth);
33850 window.removeEventListener('orientationchange', _this.setViewportWidth);
33851 } else {
33852 setTimeout(function () {
33853 if (_this.props.snap) {
33854 _this.$runtime.addEventListener('scroll', _this.setX, scrollEventOptions);
33855 }
33856 window.addEventListener('resize', _this.setViewportWidth, false);
33857 window.addEventListener('orientationchange', _this.setViewportWidth, false);
33858 }, REBOUND$1);
33859 }
33860 }, _this.scrollRuntime = function (_ref2) {
33861 var x = _ref2.x;
33862 var autoScroll = _this.state.autoScroll;
33863
33864
33865 if (_this.$runtime && autoScroll) {
33866 _this.$runtime.scrollLeft = autoScroll.from + x;
33867 }
33868 return null;
33869 }, _this.setViewportWidth = debounce(function () {
33870 _this.props.setViewportWidth(getViewportWidth());
33871 }, DEBOUNCE$1), _this.setX = debounce(function (event) {
33872 if (!_this.props.snap) return;
33873
33874 if (_this.state.autoScroll) {
33875 _this.setState({
33876 autoScroll: null
33877 });
33878 }
33879
33880 var nextX = _this.$runtime.scrollLeft;
33881 if (Math.abs(_this.props.runtime.x - nextX) > 5) {
33882 _this.props.setX(nextX);
33883 }
33884 }, DEBOUNCE$1), _temp), possibleConstructorReturn(_this, _ret);
33885 }
33886
33887 createClass(Runtime, [{
33888 key: 'componentDidMount',
33889 value: function componentDidMount() {
33890 if (this.props.snap) {
33891 this.$runtime.addEventListener('scroll', this.setX, scrollEventOptions);
33892 }
33893 window.addEventListener('resize', this.setViewportWidth, false);
33894 window.addEventListener('orientationchange', this.setViewportWidth, false);
33895 document.addEventListener('visibilitychange', this.onVisibilityChange);
33896 }
33897 }, {
33898 key: 'componentDidUpdate',
33899 value: function componentDidUpdate(prevProps) {
33900 var props = this.props;
33901
33902
33903 if (props.focusPanel) {
33904 window.document.title = props.focusPanel.title || props.focusPanel.type;
33905 }
33906
33907 if (props.snap && prevProps.runtime.x !== props.runtime.x) {
33908 snapX(this.$runtime, props.runtime.x);
33909 }
33910 }
33911 }, {
33912 key: 'componentWillUnmount',
33913 value: function componentWillUnmount() {
33914 if (this.props.snap) {
33915 this.$runtime.removeEventListener('scroll', this.setX);
33916 }
33917 window.removeEventListener('resize', this.setViewportWidth);
33918 window.removeEventListener('orientationchange', this.setViewportWidth);
33919 }
33920 }, {
33921 key: 'render',
33922 value: function render() {
33923 var _this2 = this;
33924
33925 var _props = this.props,
33926 apps = _props.apps,
33927 canMoveLeft = _props.canMoveLeft,
33928 focusPanel = _props.focusPanel,
33929 moveLeft = _props.moveLeft,
33930 navigate = _props.navigate,
33931 panels = _props.panels,
33932 router = _props.router,
33933 runtime = _props.runtime,
33934 snap = _props.snap,
33935 toggleExpand = _props.toggleExpand,
33936 updateSettings = _props.updateSettings,
33937 visibleRoutes = _props.visibleRoutes;
33938
33939
33940 var runtimeStyle = focusPanel ? _extends({}, style, focusPanel.styleBackground) : style;
33941
33942 return React__default.createElement(
33943 Horizontal,
33944 { _ref: function _ref($e) {
33945 return _this2.$runtime = $e;
33946 }, style: runtimeStyle, __source: {
33947 fileName: _jsxFileName$10,
33948 lineNumber: 113
33949 },
33950 __self: this
33951 },
33952 React__default.createElement(BaseStyle, {
33953 __source: {
33954 fileName: _jsxFileName$10,
33955 lineNumber: 114
33956 },
33957 __self: this
33958 }),
33959 canMoveLeft && snap && React__default.createElement(MoveLeft, { onClick: moveLeft, snapPoint: runtime.snapPoint, __source: {
33960 fileName: _jsxFileName$10,
33961 lineNumber: 118
33962 },
33963 __self: this
33964 }),
33965 React__default.createElement(
33966 Horizontal,
33967 {
33968 style: {
33969 flexDirection: 'row',
33970 height: '100%',
33971 overflowY: 'hidden',
33972 paddingLeft: runtime.snapPoint,
33973 width: runtime.width,
33974 willChange: 'scroll-position'
33975 },
33976 __source: {
33977 fileName: _jsxFileName$10,
33978 lineNumber: 120
33979 },
33980 __self: this
33981 },
33982 visibleRoutes.map(function (context, i) {
33983 var route = router.routes.byContext[context];
33984 var app = apps[route.app];
33985 var panel = panels[route.panelId];
33986
33987 return React__default.createElement(Route$1, {
33988 isContext: i >= router.context,
33989 isFocus: i === router.focus,
33990 key: i + '-' + app.name + '-' + panel.type,
33991 navigate: navigate,
33992 panel: panel,
33993 route: route,
33994 routeIndex: i,
33995 router: router,
33996 store: app.store,
33997 toggleExpand: toggleExpand,
33998 Type: app.types[panel.type],
33999 updateSettings: updateSettings,
34000 width: route.width,
34001 zIndex: router.routes.items.length - i,
34002 __source: {
34003 fileName: _jsxFileName$10,
34004 lineNumber: 136
34005 },
34006 __self: _this2
34007 });
34008 })
34009 ),
34010 router.isLoading ? React__default.createElement(
34011 Horizontal,
34012 {
34013 style: {
34014 justifyContent: 'center',
34015 left: router.routes.items.length ? LOADING_OFFSET$1 : LOADING_OFFSET$1 - runtime.snapPoint,
34016 marginTop: LOADING_OFFSET$1
34017 },
34018 __source: {
34019 fileName: _jsxFileName$10,
34020 lineNumber: 157
34021 },
34022 __self: this
34023 },
34024 React__default.createElement(Knocking, { size: LOADING_SIZE$1, __source: {
34025 fileName: _jsxFileName$10,
34026 lineNumber: 166
34027 },
34028 __self: this
34029 })
34030 ) : null
34031 );
34032 }
34033 }]);
34034 return Runtime;
34035}(React__default.Component);
34036
34037var getFocusPanel = function getFocusPanel(_ref3) {
34038 var panels = _ref3.panels,
34039 router = _ref3.router;
34040
34041 var focusRoute = router.routes.byContext[router.routes.items[router.focus]];
34042 return focusRoute && panels.byId[focusRoute.panelId];
34043};
34044
34045var getCanMoveLeft = function getCanMoveLeft(_ref4) {
34046 var runtime = _ref4.runtime;
34047 return !runtime.shouldGoMobile && runtime.x > 0;
34048};
34049
34050function mapStateToProps$1(state, props) {
34051 return {
34052 apps: state.apps.byName,
34053 canMoveLeft: getCanMoveLeft(state),
34054 focusPanel: getFocusPanel(state),
34055 panels: state.panels.byId,
34056 router: state.router,
34057 runtime: state.runtime,
34058 visibleRoutes: state.router.routes.items.filter(function (r) {
34059 return state.router.routes.byContext[r].isVisible;
34060 })
34061 };
34062}
34063
34064var mapDispatchToProps$1 = {
34065 moveLeft: moveLeft,
34066 navigate: navigate,
34067 setViewportWidth: setViewportWidth,
34068 setX: setX,
34069 toggleExpand: toggleExpand,
34070 updateSettings: updateSettings
34071};
34072var Trails = reactRedux.connect(mapStateToProps$1, mapDispatchToProps$1)(Runtime);
34073
34074
34075
34076var runtimes = Object.freeze({
34077 Launchpad: Launchpad,
34078 Trails: Trails
34079});
34080
34081function history(store) {
34082 var navigateHandler = function navigateHandler() {
34083 return store.dispatch(navigate(location.href));
34084 };
34085
34086 window.addEventListener('popstate', navigateHandler);
34087
34088 var unsubscribe = store.subscribe(function () {
34089 var uri = store.getState().router.uri;
34090
34091
34092 if (uri !== location.href) {
34093 window.history.pushState(null, null, uri);
34094 }
34095 });
34096
34097 return function historyOff() {
34098 window.removeEventListener('popstate', navigateHandler);
34099 unsubscribe();
34100 };
34101}
34102
34103var _jsxFileName = '/Users/dario/opensource/panels/render.js';
34104function runtimeRender(configureStore) {
34105 var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
34106 _ref$snap = _ref.snap,
34107 snap = _ref$snap === undefined ? true : _ref$snap,
34108 _ref$runtime = _ref.runtime,
34109 runtime = _ref$runtime === undefined ? 'Trails' : _ref$runtime,
34110 initialState = objectWithoutProperties(_ref, ['snap', 'runtime']);
34111
34112 var store = configureStore({
34113 router: {
34114 routes: {
34115 byContext: {},
34116 items: []
34117 },
34118 parsers: initialState.router && initialState.router.parsers
34119 }
34120 });
34121 store.dispatch(navigate(location.href));
34122
34123 history(store);
34124
34125 var Runtime = runtimes[runtime];
34126
34127 reactDom.render(React__default.createElement(
34128 reactRedux.Provider,
34129 { store: store, __source: {
34130 fileName: _jsxFileName,
34131 lineNumber: 33
34132 },
34133 __self: this
34134 },
34135 React__default.createElement(Runtime, { snap: snap, __source: {
34136 fileName: _jsxFileName,
34137 lineNumber: 34
34138 },
34139 __self: this
34140 })
34141 ), document.getElementById('root'));
34142
34143 return store;
34144}
34145
34146var render$1 = function render(props) {
34147 return runtimeRender(configureStore, props);
34148};
34149
34150if (!window.panelsDontAutoLoad) {
34151 window.addEventListener('load', function () {
34152 window._store = render$1(window.panels);
34153 });
34154}
34155
34156exports.render = render$1;
34157},{"debounce":7,"houkou":10,"mini-unique-id":22,"prop-types":"prop-types","react":"react","react-dom":"react-dom","react-redux":43,"redux":63,"redux-logger":56,"redux-thunk":57,"regenerator-runtime":65,"style-to-css":73}],"prop-types":[function(require,module,exports){
34158/**
34159 * Copyright (c) 2013-present, Facebook, Inc.
34160 *
34161 * This source code is licensed under the MIT license found in the
34162 * LICENSE file in the root directory of this source tree.
34163 */
34164
34165if ("development" !== 'production') {
34166 var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
34167 Symbol.for &&
34168 Symbol.for('react.element')) ||
34169 0xeac7;
34170
34171 var isValidElement = function(object) {
34172 return typeof object === 'object' &&
34173 object !== null &&
34174 object.$$typeof === REACT_ELEMENT_TYPE;
34175 };
34176
34177 // By explicitly using `prop-types` you are opting into new development behavior.
34178 // http://fb.me/prop-types-in-prod
34179 var throwOnDirectAccess = true;
34180 module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);
34181} else {
34182 // By explicitly using `prop-types` you are opting into new production behavior.
34183 // http://fb.me/prop-types-in-prod
34184 module.exports = require('./factoryWithThrowingShims')();
34185}
34186
34187},{"./factoryWithThrowingShims":26,"./factoryWithTypeCheckers":27}],"react-dom":[function(require,module,exports){
34188'use strict';
34189
34190function checkDCE() {
34191 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
34192 if (
34193 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||
34194 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'
34195 ) {
34196 return;
34197 }
34198 if ("development" !== 'production') {
34199 // This branch is unreachable because this function is only called
34200 // in production, but the condition is true only in development.
34201 // Therefore if the branch is still here, dead code elimination wasn't
34202 // properly applied.
34203 // Don't change the message. React DevTools relies on it. Also make sure
34204 // this message doesn't occur elsewhere in this function, or it will cause
34205 // a false positive.
34206 throw new Error('^_^');
34207 }
34208 try {
34209 // Verify that the code above has been dead code eliminated (DCE'd).
34210 __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
34211 } catch (err) {
34212 // DevTools shouldn't crash React, no matter what.
34213 // We should still report in case we break this code.
34214 console.error(err);
34215 }
34216}
34217
34218if ("development" === 'production') {
34219 // DCE check should happen before ReactDOM bundle executes so that
34220 // DevTools can report bad minification during injection.
34221 checkDCE();
34222 module.exports = require('./cjs/react-dom.production.min.js');
34223} else {
34224 module.exports = require('./cjs/react-dom.development.js');
34225}
34226
34227},{"./cjs/react-dom.development.js":29,"./cjs/react-dom.production.min.js":30}],"react":[function(require,module,exports){
34228'use strict';
34229
34230if ("development" === 'production') {
34231 module.exports = require('./cjs/react.production.min.js');
34232} else {
34233 module.exports = require('./cjs/react.development.js');
34234}
34235
34236},{"./cjs/react.development.js":50,"./cjs/react.production.min.js":51}]},{},["panels"])
34237//# sourceMappingURL=panels-10.1.1.js.map