react 16.13.1 → 17.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ /** @license React v17.0.0-rc.2
2
+ * react-jsx-runtime.production.min.js
3
+ *
4
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ 'use strict';require("object-assign");var f=require("react"),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};
10
+ function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;
@@ -0,0 +1,10 @@
1
+ /** @license React v17.0.0-rc.2
2
+ * react-jsx-runtime.profiling.min.js
3
+ *
4
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ 'use strict';require("object-assign");var f=require("react"),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};
10
+ function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;
@@ -1,4 +1,4 @@
1
- /** @license React v16.13.1
1
+ /** @license React v17.0.0-rc.2
2
2
  * react.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -9,37 +9,65 @@
9
9
 
10
10
  'use strict';
11
11
 
12
-
13
-
14
12
  if (process.env.NODE_ENV !== "production") {
15
13
  (function() {
16
14
  'use strict';
17
15
 
18
16
  var _assign = require('object-assign');
19
- var checkPropTypes = require('prop-types/checkPropTypes');
20
17
 
21
- var ReactVersion = '16.13.1';
18
+ // TODO: this is special because it gets imported during build.
19
+ var ReactVersion = '17.0.0-rc.2';
22
20
 
21
+ // ATTENTION
22
+ // When adding new symbols to this file,
23
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
23
24
  // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
24
25
  // nor polyfill, then a plain number is used for performance.
25
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
26
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
27
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
28
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
29
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
30
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
31
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
32
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
33
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
34
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
35
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
36
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
37
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
38
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
39
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
40
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
41
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
42
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
26
+ var REACT_ELEMENT_TYPE = 0xeac7;
27
+ var REACT_PORTAL_TYPE = 0xeaca;
28
+ exports.Fragment = 0xeacb;
29
+ exports.StrictMode = 0xeacc;
30
+ exports.Profiler = 0xead2;
31
+ var REACT_PROVIDER_TYPE = 0xeacd;
32
+ var REACT_CONTEXT_TYPE = 0xeace;
33
+ var REACT_FORWARD_REF_TYPE = 0xead0;
34
+ exports.Suspense = 0xead1;
35
+ var REACT_SUSPENSE_LIST_TYPE = 0xead8;
36
+ var REACT_MEMO_TYPE = 0xead3;
37
+ var REACT_LAZY_TYPE = 0xead4;
38
+ var REACT_BLOCK_TYPE = 0xead9;
39
+ var REACT_SERVER_BLOCK_TYPE = 0xeada;
40
+ var REACT_FUNDAMENTAL_TYPE = 0xead5;
41
+ var REACT_SCOPE_TYPE = 0xead7;
42
+ var REACT_OPAQUE_ID_TYPE = 0xeae0;
43
+ var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
44
+ var REACT_OFFSCREEN_TYPE = 0xeae2;
45
+ var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
46
+
47
+ if (typeof Symbol === 'function' && Symbol.for) {
48
+ var symbolFor = Symbol.for;
49
+ REACT_ELEMENT_TYPE = symbolFor('react.element');
50
+ REACT_PORTAL_TYPE = symbolFor('react.portal');
51
+ exports.Fragment = symbolFor('react.fragment');
52
+ exports.StrictMode = symbolFor('react.strict_mode');
53
+ exports.Profiler = symbolFor('react.profiler');
54
+ REACT_PROVIDER_TYPE = symbolFor('react.provider');
55
+ REACT_CONTEXT_TYPE = symbolFor('react.context');
56
+ REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
57
+ exports.Suspense = symbolFor('react.suspense');
58
+ REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
59
+ REACT_MEMO_TYPE = symbolFor('react.memo');
60
+ REACT_LAZY_TYPE = symbolFor('react.lazy');
61
+ REACT_BLOCK_TYPE = symbolFor('react.block');
62
+ REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
63
+ REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
64
+ REACT_SCOPE_TYPE = symbolFor('react.scope');
65
+ REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
66
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
67
+ REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
68
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
69
+ }
70
+
43
71
  var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
44
72
  var FAUX_ITERATOR_SYMBOL = '@@iterator';
45
73
  function getIteratorFn(maybeIterable) {
@@ -72,7 +100,7 @@ var ReactCurrentDispatcher = {
72
100
  * should suspend for if it needs to.
73
101
  */
74
102
  var ReactCurrentBatchConfig = {
75
- suspense: null
103
+ transition: 0
76
104
  };
77
105
 
78
106
  /**
@@ -89,142 +117,29 @@ var ReactCurrentOwner = {
89
117
  current: null
90
118
  };
91
119
 
92
- var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
93
- function describeComponentFrame (name, source, ownerName) {
94
- var sourceInfo = '';
95
-
96
- if (source) {
97
- var path = source.fileName;
98
- var fileName = path.replace(BEFORE_SLASH_RE, '');
99
-
100
- {
101
- // In DEV, include code for a common special case:
102
- // prefer "folder/index.js" instead of just "index.js".
103
- if (/^index\./.test(fileName)) {
104
- var match = path.match(BEFORE_SLASH_RE);
105
-
106
- if (match) {
107
- var pathBeforeSlash = match[1];
108
-
109
- if (pathBeforeSlash) {
110
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
111
- fileName = folderName + '/' + fileName;
112
- }
113
- }
114
- }
115
- }
116
-
117
- sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
118
- } else if (ownerName) {
119
- sourceInfo = ' (created by ' + ownerName + ')';
120
- }
121
-
122
- return '\n in ' + (name || 'Unknown') + sourceInfo;
123
- }
124
-
125
- var Resolved = 1;
126
- function refineResolvedLazyComponent(lazyComponent) {
127
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
128
- }
129
-
130
- function getWrappedName(outerType, innerType, wrapperName) {
131
- var functionName = innerType.displayName || innerType.name || '';
132
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
133
- }
134
-
135
- function getComponentName(type) {
136
- if (type == null) {
137
- // Host root, text node or just invalid type.
138
- return null;
139
- }
140
-
141
- {
142
- if (typeof type.tag === 'number') {
143
- error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
144
- }
145
- }
146
-
147
- if (typeof type === 'function') {
148
- return type.displayName || type.name || null;
149
- }
150
-
151
- if (typeof type === 'string') {
152
- return type;
153
- }
154
-
155
- switch (type) {
156
- case REACT_FRAGMENT_TYPE:
157
- return 'Fragment';
158
-
159
- case REACT_PORTAL_TYPE:
160
- return 'Portal';
161
-
162
- case REACT_PROFILER_TYPE:
163
- return "Profiler";
164
-
165
- case REACT_STRICT_MODE_TYPE:
166
- return 'StrictMode';
167
-
168
- case REACT_SUSPENSE_TYPE:
169
- return 'Suspense';
170
-
171
- case REACT_SUSPENSE_LIST_TYPE:
172
- return 'SuspenseList';
173
- }
174
-
175
- if (typeof type === 'object') {
176
- switch (type.$$typeof) {
177
- case REACT_CONTEXT_TYPE:
178
- return 'Context.Consumer';
179
-
180
- case REACT_PROVIDER_TYPE:
181
- return 'Context.Provider';
182
-
183
- case REACT_FORWARD_REF_TYPE:
184
- return getWrappedName(type, type.render, 'ForwardRef');
185
-
186
- case REACT_MEMO_TYPE:
187
- return getComponentName(type.type);
188
-
189
- case REACT_BLOCK_TYPE:
190
- return getComponentName(type.render);
191
-
192
- case REACT_LAZY_TYPE:
193
- {
194
- var thenable = type;
195
- var resolvedThenable = refineResolvedLazyComponent(thenable);
196
-
197
- if (resolvedThenable) {
198
- return getComponentName(resolvedThenable);
199
- }
200
-
201
- break;
202
- }
203
- }
204
- }
205
-
206
- return null;
207
- }
208
-
209
120
  var ReactDebugCurrentFrame = {};
210
- var currentlyValidatingElement = null;
211
- function setCurrentlyValidatingElement(element) {
121
+ var currentExtraStackFrame = null;
122
+ function setExtraStackFrame(stack) {
212
123
  {
213
- currentlyValidatingElement = element;
124
+ currentExtraStackFrame = stack;
214
125
  }
215
126
  }
216
127
 
217
128
  {
218
- // Stack implementation injected by the current renderer.
129
+ ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
130
+ {
131
+ currentExtraStackFrame = stack;
132
+ }
133
+ }; // Stack implementation injected by the current renderer.
134
+
135
+
219
136
  ReactDebugCurrentFrame.getCurrentStack = null;
220
137
 
221
138
  ReactDebugCurrentFrame.getStackAddendum = function () {
222
139
  var stack = ''; // Add an extra top frame while an element is being validated
223
140
 
224
- if (currentlyValidatingElement) {
225
- var name = getComponentName(currentlyValidatingElement.type);
226
- var owner = currentlyValidatingElement._owner;
227
- stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
141
+ if (currentExtraStackFrame) {
142
+ stack += currentExtraStackFrame;
228
143
  } // Delegate to the injected renderer-specific implementation
229
144
 
230
145
 
@@ -255,13 +170,7 @@ var ReactSharedInternals = {
255
170
  };
256
171
 
257
172
  {
258
- _assign(ReactSharedInternals, {
259
- // These should not be included in production.
260
- ReactDebugCurrentFrame: ReactDebugCurrentFrame,
261
- // Shim for React DOM 16.0.0 which still destructured (but not used) this.
262
- // TODO: remove in React 17.0.
263
- ReactComponentTreeHook: {}
264
- });
173
+ ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
265
174
  }
266
175
 
267
176
  // by calls to these methods by a Babel plugin.
@@ -292,16 +201,12 @@ function printWarning(level, format, args) {
292
201
  // When changing this logic, you might want to also
293
202
  // update consoleWithStackDev.www.js as well.
294
203
  {
295
- var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
296
-
297
- if (!hasExistingStack) {
298
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
299
- var stack = ReactDebugCurrentFrame.getStackAddendum();
204
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
205
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
300
206
 
301
- if (stack !== '') {
302
- format += '%s';
303
- args = args.concat([stack]);
304
- }
207
+ if (stack !== '') {
208
+ format += '%s';
209
+ args = args.concat([stack]);
305
210
  }
306
211
 
307
212
  var argsWithFormat = args.map(function (item) {
@@ -313,17 +218,6 @@ function printWarning(level, format, args) {
313
218
  // eslint-disable-next-line react-internal/no-production-logging
314
219
 
315
220
  Function.prototype.apply.call(console[level], console, argsWithFormat);
316
-
317
- try {
318
- // --- Welcome to debugging React ---
319
- // This error was thrown as a convenience so that you can use this stack
320
- // to find the callsite that caused this warning to fire.
321
- var argIndex = 0;
322
- var message = 'Warning: ' + format.replace(/%s/g, function () {
323
- return args[argIndex++];
324
- });
325
- throw new Error(message);
326
- } catch (x) {}
327
221
  }
328
222
  }
329
223
 
@@ -554,6 +448,92 @@ function createRef() {
554
448
  return refObject;
555
449
  }
556
450
 
451
+ function getWrappedName(outerType, innerType, wrapperName) {
452
+ var functionName = innerType.displayName || innerType.name || '';
453
+ return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
454
+ }
455
+
456
+ function getContextName(type) {
457
+ return type.displayName || 'Context';
458
+ }
459
+
460
+ function getComponentName(type) {
461
+ if (type == null) {
462
+ // Host root, text node or just invalid type.
463
+ return null;
464
+ }
465
+
466
+ {
467
+ if (typeof type.tag === 'number') {
468
+ error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
469
+ }
470
+ }
471
+
472
+ if (typeof type === 'function') {
473
+ return type.displayName || type.name || null;
474
+ }
475
+
476
+ if (typeof type === 'string') {
477
+ return type;
478
+ }
479
+
480
+ switch (type) {
481
+ case exports.Fragment:
482
+ return 'Fragment';
483
+
484
+ case REACT_PORTAL_TYPE:
485
+ return 'Portal';
486
+
487
+ case exports.Profiler:
488
+ return 'Profiler';
489
+
490
+ case exports.StrictMode:
491
+ return 'StrictMode';
492
+
493
+ case exports.Suspense:
494
+ return 'Suspense';
495
+
496
+ case REACT_SUSPENSE_LIST_TYPE:
497
+ return 'SuspenseList';
498
+ }
499
+
500
+ if (typeof type === 'object') {
501
+ switch (type.$$typeof) {
502
+ case REACT_CONTEXT_TYPE:
503
+ var context = type;
504
+ return getContextName(context) + '.Consumer';
505
+
506
+ case REACT_PROVIDER_TYPE:
507
+ var provider = type;
508
+ return getContextName(provider._context) + '.Provider';
509
+
510
+ case REACT_FORWARD_REF_TYPE:
511
+ return getWrappedName(type, type.render, 'ForwardRef');
512
+
513
+ case REACT_MEMO_TYPE:
514
+ return getComponentName(type.type);
515
+
516
+ case REACT_BLOCK_TYPE:
517
+ return getComponentName(type._render);
518
+
519
+ case REACT_LAZY_TYPE:
520
+ {
521
+ var lazyComponent = type;
522
+ var payload = lazyComponent._payload;
523
+ var init = lazyComponent._init;
524
+
525
+ try {
526
+ return getComponentName(init(payload));
527
+ } catch (x) {
528
+ return null;
529
+ }
530
+ }
531
+ }
532
+ }
533
+
534
+ return null;
535
+ }
536
+
557
537
  var hasOwnProperty = Object.prototype.hasOwnProperty;
558
538
  var RESERVED_PROPS = {
559
539
  key: true,
@@ -601,7 +581,7 @@ function defineKeyPropWarningGetter(props, displayName) {
601
581
  if (!specialPropKeyWarningShown) {
602
582
  specialPropKeyWarningShown = true;
603
583
 
604
- error('%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);
584
+ error('%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://reactjs.org/link/special-props)', displayName);
605
585
  }
606
586
  }
607
587
  };
@@ -619,7 +599,7 @@ function defineRefPropWarningGetter(props, displayName) {
619
599
  if (!specialPropRefWarningShown) {
620
600
  specialPropRefWarningShown = true;
621
601
 
622
- error('%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);
602
+ error('%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://reactjs.org/link/special-props)', displayName);
623
603
  }
624
604
  }
625
605
  };
@@ -637,7 +617,7 @@ function warnIfStringRefCannotBeAutoConverted(config) {
637
617
  var componentName = getComponentName(ReactCurrentOwner.current.type);
638
618
 
639
619
  if (!didWarnAboutStringRefs[componentName]) {
640
- error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
620
+ error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
641
621
 
642
622
  didWarnAboutStringRefs[componentName] = true;
643
623
  }
@@ -912,7 +892,7 @@ function escape(key) {
912
892
  '=': '=0',
913
893
  ':': '=2'
914
894
  };
915
- var escapedString = ('' + key).replace(escapeRegex, function (match) {
895
+ var escapedString = key.replace(escapeRegex, function (match) {
916
896
  return escaperLookup[match];
917
897
  });
918
898
  return '$' + escapedString;
@@ -927,54 +907,30 @@ var didWarnAboutMaps = false;
927
907
  var userProvidedKeyEscapeRegex = /\/+/g;
928
908
 
929
909
  function escapeUserProvidedKey(text) {
930
- return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
910
+ return text.replace(userProvidedKeyEscapeRegex, '$&/');
931
911
  }
912
+ /**
913
+ * Generate a key string that identifies a element within a set.
914
+ *
915
+ * @param {*} element A element that could contain a manual key.
916
+ * @param {number} index Index that is used if a manual key is not provided.
917
+ * @return {string}
918
+ */
932
919
 
933
- var POOL_SIZE = 10;
934
- var traverseContextPool = [];
935
920
 
936
- function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
937
- if (traverseContextPool.length) {
938
- var traverseContext = traverseContextPool.pop();
939
- traverseContext.result = mapResult;
940
- traverseContext.keyPrefix = keyPrefix;
941
- traverseContext.func = mapFunction;
942
- traverseContext.context = mapContext;
943
- traverseContext.count = 0;
944
- return traverseContext;
945
- } else {
946
- return {
947
- result: mapResult,
948
- keyPrefix: keyPrefix,
949
- func: mapFunction,
950
- context: mapContext,
951
- count: 0
952
- };
953
- }
954
- }
921
+ function getElementKey(element, index) {
922
+ // Do some typechecking here since we call this blindly. We want to ensure
923
+ // that we don't block potential future ES APIs.
924
+ if (typeof element === 'object' && element !== null && element.key != null) {
925
+ // Explicit key
926
+ return escape('' + element.key);
927
+ } // Implicit key determined by the index in the set
955
928
 
956
- function releaseTraverseContext(traverseContext) {
957
- traverseContext.result = null;
958
- traverseContext.keyPrefix = null;
959
- traverseContext.func = null;
960
- traverseContext.context = null;
961
- traverseContext.count = 0;
962
929
 
963
- if (traverseContextPool.length < POOL_SIZE) {
964
- traverseContextPool.push(traverseContext);
965
- }
930
+ return index.toString(36);
966
931
  }
967
- /**
968
- * @param {?*} children Children tree container.
969
- * @param {!string} nameSoFar Name of the key path so far.
970
- * @param {!function} callback Callback to invoke with each child found.
971
- * @param {?*} traverseContext Used to pass information throughout the traversal
972
- * process.
973
- * @return {!number} The number of children in this subtree.
974
- */
975
-
976
932
 
977
- function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
933
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
978
934
  var type = typeof children;
979
935
 
980
936
  if (type === 'undefined' || type === 'boolean') {
@@ -1004,9 +960,34 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
1004
960
  }
1005
961
 
1006
962
  if (invokeCallback) {
1007
- callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array
1008
- // so that it's consistent if the number of children grows.
1009
- nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
963
+ var _child = children;
964
+ var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
965
+ // so that it's consistent if the number of children grows:
966
+
967
+ var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
968
+
969
+ if (Array.isArray(mappedChild)) {
970
+ var escapedChildKey = '';
971
+
972
+ if (childKey != null) {
973
+ escapedChildKey = escapeUserProvidedKey(childKey) + '/';
974
+ }
975
+
976
+ mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
977
+ return c;
978
+ });
979
+ } else if (mappedChild != null) {
980
+ if (isValidElement(mappedChild)) {
981
+ mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
982
+ // traverseAllChildren used to do for objects as children
983
+ escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
984
+ mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
985
+ escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
986
+ }
987
+
988
+ array.push(mappedChild);
989
+ }
990
+
1010
991
  return 1;
1011
992
  }
1012
993
 
@@ -1019,46 +1000,41 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
1019
1000
  if (Array.isArray(children)) {
1020
1001
  for (var i = 0; i < children.length; i++) {
1021
1002
  child = children[i];
1022
- nextName = nextNamePrefix + getComponentKey(child, i);
1023
- subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1003
+ nextName = nextNamePrefix + getElementKey(child, i);
1004
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1024
1005
  }
1025
1006
  } else {
1026
1007
  var iteratorFn = getIteratorFn(children);
1027
1008
 
1028
1009
  if (typeof iteratorFn === 'function') {
1010
+ var iterableChildren = children;
1029
1011
 
1030
1012
  {
1031
1013
  // Warn about using Maps as children
1032
- if (iteratorFn === children.entries) {
1014
+ if (iteratorFn === iterableChildren.entries) {
1033
1015
  if (!didWarnAboutMaps) {
1034
- warn('Using Maps as children is deprecated and will be removed in ' + 'a future major release. Consider converting children to ' + 'an array of keyed ReactElements instead.');
1016
+ warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1035
1017
  }
1036
1018
 
1037
1019
  didWarnAboutMaps = true;
1038
1020
  }
1039
1021
  }
1040
1022
 
1041
- var iterator = iteratorFn.call(children);
1023
+ var iterator = iteratorFn.call(iterableChildren);
1042
1024
  var step;
1043
1025
  var ii = 0;
1044
1026
 
1045
1027
  while (!(step = iterator.next()).done) {
1046
1028
  child = step.value;
1047
- nextName = nextNamePrefix + getComponentKey(child, ii++);
1048
- subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1029
+ nextName = nextNamePrefix + getElementKey(child, ii++);
1030
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1049
1031
  }
1050
1032
  } else if (type === 'object') {
1051
- var addendum = '';
1052
-
1053
- {
1054
- addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
1055
- }
1056
-
1057
1033
  var childrenString = '' + children;
1058
1034
 
1059
1035
  {
1060
1036
  {
1061
- throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum );
1037
+ throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
1062
1038
  }
1063
1039
  }
1064
1040
  }
@@ -1066,120 +1042,13 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
1066
1042
 
1067
1043
  return subtreeCount;
1068
1044
  }
1069
- /**
1070
- * Traverses children that are typically specified as `props.children`, but
1071
- * might also be specified through attributes:
1072
- *
1073
- * - `traverseAllChildren(this.props.children, ...)`
1074
- * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
1075
- *
1076
- * The `traverseContext` is an optional argument that is passed through the
1077
- * entire traversal. It can be used to store accumulations or anything else that
1078
- * the callback might find relevant.
1079
- *
1080
- * @param {?*} children Children tree object.
1081
- * @param {!function} callback To invoke upon traversing each child.
1082
- * @param {?*} traverseContext Context for traversal.
1083
- * @return {!number} The number of children in this subtree.
1084
- */
1085
-
1086
-
1087
- function traverseAllChildren(children, callback, traverseContext) {
1088
- if (children == null) {
1089
- return 0;
1090
- }
1091
-
1092
- return traverseAllChildrenImpl(children, '', callback, traverseContext);
1093
- }
1094
- /**
1095
- * Generate a key string that identifies a component within a set.
1096
- *
1097
- * @param {*} component A component that could contain a manual key.
1098
- * @param {number} index Index that is used if a manual key is not provided.
1099
- * @return {string}
1100
- */
1101
-
1102
-
1103
- function getComponentKey(component, index) {
1104
- // Do some typechecking here since we call this blindly. We want to ensure
1105
- // that we don't block potential future ES APIs.
1106
- if (typeof component === 'object' && component !== null && component.key != null) {
1107
- // Explicit key
1108
- return escape(component.key);
1109
- } // Implicit key determined by the index in the set
1110
-
1111
-
1112
- return index.toString(36);
1113
- }
1114
-
1115
- function forEachSingleChild(bookKeeping, child, name) {
1116
- var func = bookKeeping.func,
1117
- context = bookKeeping.context;
1118
- func.call(context, child, bookKeeping.count++);
1119
- }
1120
- /**
1121
- * Iterates through children that are typically specified as `props.children`.
1122
- *
1123
- * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1124
- *
1125
- * The provided forEachFunc(child, index) will be called for each
1126
- * leaf child.
1127
- *
1128
- * @param {?*} children Children tree container.
1129
- * @param {function(*, int)} forEachFunc
1130
- * @param {*} forEachContext Context for forEachContext.
1131
- */
1132
-
1133
-
1134
- function forEachChildren(children, forEachFunc, forEachContext) {
1135
- if (children == null) {
1136
- return children;
1137
- }
1138
-
1139
- var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
1140
- traverseAllChildren(children, forEachSingleChild, traverseContext);
1141
- releaseTraverseContext(traverseContext);
1142
- }
1143
-
1144
- function mapSingleChildIntoContext(bookKeeping, child, childKey) {
1145
- var result = bookKeeping.result,
1146
- keyPrefix = bookKeeping.keyPrefix,
1147
- func = bookKeeping.func,
1148
- context = bookKeeping.context;
1149
- var mappedChild = func.call(context, child, bookKeeping.count++);
1150
-
1151
- if (Array.isArray(mappedChild)) {
1152
- mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
1153
- return c;
1154
- });
1155
- } else if (mappedChild != null) {
1156
- if (isValidElement(mappedChild)) {
1157
- mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1158
- // traverseAllChildren used to do for objects as children
1159
- keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
1160
- }
1161
-
1162
- result.push(mappedChild);
1163
- }
1164
- }
1165
-
1166
- function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
1167
- var escapedPrefix = '';
1168
-
1169
- if (prefix != null) {
1170
- escapedPrefix = escapeUserProvidedKey(prefix) + '/';
1171
- }
1172
1045
 
1173
- var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
1174
- traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
1175
- releaseTraverseContext(traverseContext);
1176
- }
1177
1046
  /**
1178
1047
  * Maps children that are typically specified as `props.children`.
1179
1048
  *
1180
1049
  * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1181
1050
  *
1182
- * The provided mapFunction(child, key, index) will be called for each
1051
+ * The provided mapFunction(child, index) will be called for each
1183
1052
  * leaf child.
1184
1053
  *
1185
1054
  * @param {?*} children Children tree container.
@@ -1187,15 +1056,16 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
1187
1056
  * @param {*} context Context for mapFunction.
1188
1057
  * @return {object} Object containing the ordered map of results.
1189
1058
  */
1190
-
1191
-
1192
1059
  function mapChildren(children, func, context) {
1193
1060
  if (children == null) {
1194
1061
  return children;
1195
1062
  }
1196
1063
 
1197
1064
  var result = [];
1198
- mapIntoWithKeyPrefixInternal(children, result, null, func, context);
1065
+ var count = 0;
1066
+ mapIntoArray(children, result, '', '', function (child) {
1067
+ return func.call(context, child, count++);
1068
+ });
1199
1069
  return result;
1200
1070
  }
1201
1071
  /**
@@ -1210,9 +1080,29 @@ function mapChildren(children, func, context) {
1210
1080
 
1211
1081
 
1212
1082
  function countChildren(children) {
1213
- return traverseAllChildren(children, function () {
1214
- return null;
1215
- }, null);
1083
+ var n = 0;
1084
+ mapChildren(children, function () {
1085
+ n++; // Don't return anything
1086
+ });
1087
+ return n;
1088
+ }
1089
+
1090
+ /**
1091
+ * Iterates through children that are typically specified as `props.children`.
1092
+ *
1093
+ * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1094
+ *
1095
+ * The provided forEachFunc(child, index) will be called for each
1096
+ * leaf child.
1097
+ *
1098
+ * @param {?*} children Children tree container.
1099
+ * @param {function(*, int)} forEachFunc
1100
+ * @param {*} forEachContext Context for forEachContext.
1101
+ */
1102
+ function forEachChildren(children, forEachFunc, forEachContext) {
1103
+ mapChildren(children, function () {
1104
+ forEachFunc.apply(this, arguments); // Don't return anything.
1105
+ }, forEachContext);
1216
1106
  }
1217
1107
  /**
1218
1108
  * Flatten a children object (typically specified as `props.children`) and
@@ -1223,11 +1113,9 @@ function countChildren(children) {
1223
1113
 
1224
1114
 
1225
1115
  function toArray(children) {
1226
- var result = [];
1227
- mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
1116
+ return mapChildren(children, function (child) {
1228
1117
  return child;
1229
- });
1230
- return result;
1118
+ }) || [];
1231
1119
  }
1232
1120
  /**
1233
1121
  * Returns the first child in a collection of children and verifies that there
@@ -1289,6 +1177,7 @@ function createContext(defaultValue, calculateChangedBits) {
1289
1177
  };
1290
1178
  var hasWarnedAboutUsingNestedContextConsumers = false;
1291
1179
  var hasWarnedAboutUsingConsumerProvider = false;
1180
+ var hasWarnedAboutDisplayNameOnConsumer = false;
1292
1181
 
1293
1182
  {
1294
1183
  // A separate object, but proxies back to the original context object for
@@ -1349,6 +1238,18 @@ function createContext(defaultValue, calculateChangedBits) {
1349
1238
 
1350
1239
  return context.Consumer;
1351
1240
  }
1241
+ },
1242
+ displayName: {
1243
+ get: function () {
1244
+ return context.displayName;
1245
+ },
1246
+ set: function (displayName) {
1247
+ if (!hasWarnedAboutDisplayNameOnConsumer) {
1248
+ warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1249
+
1250
+ hasWarnedAboutDisplayNameOnConsumer = true;
1251
+ }
1252
+ }
1352
1253
  }
1353
1254
  }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1354
1255
 
@@ -1363,19 +1264,69 @@ function createContext(defaultValue, calculateChangedBits) {
1363
1264
  return context;
1364
1265
  }
1365
1266
 
1267
+ var Uninitialized = -1;
1268
+ var Pending = 0;
1269
+ var Resolved = 1;
1270
+ var Rejected = 2;
1271
+
1272
+ function lazyInitializer(payload) {
1273
+ if (payload._status === Uninitialized) {
1274
+ var ctor = payload._result;
1275
+ var thenable = ctor(); // Transition to the next state.
1276
+
1277
+ var pending = payload;
1278
+ pending._status = Pending;
1279
+ pending._result = thenable;
1280
+ thenable.then(function (moduleObject) {
1281
+ if (payload._status === Pending) {
1282
+ var defaultExport = moduleObject.default;
1283
+
1284
+ {
1285
+ if (defaultExport === undefined) {
1286
+ error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1287
+ 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1288
+ }
1289
+ } // Transition to the next state.
1290
+
1291
+
1292
+ var resolved = payload;
1293
+ resolved._status = Resolved;
1294
+ resolved._result = defaultExport;
1295
+ }
1296
+ }, function (error) {
1297
+ if (payload._status === Pending) {
1298
+ // Transition to the next state.
1299
+ var rejected = payload;
1300
+ rejected._status = Rejected;
1301
+ rejected._result = error;
1302
+ }
1303
+ });
1304
+ }
1305
+
1306
+ if (payload._status === Resolved) {
1307
+ return payload._result;
1308
+ } else {
1309
+ throw payload._result;
1310
+ }
1311
+ }
1312
+
1366
1313
  function lazy(ctor) {
1314
+ var payload = {
1315
+ // We use these fields to store the result.
1316
+ _status: -1,
1317
+ _result: ctor
1318
+ };
1367
1319
  var lazyType = {
1368
1320
  $$typeof: REACT_LAZY_TYPE,
1369
- _ctor: ctor,
1370
- // React uses these fields to store the result.
1371
- _status: -1,
1372
- _result: null
1321
+ _payload: payload,
1322
+ _init: lazyInitializer
1373
1323
  };
1374
1324
 
1375
1325
  {
1376
1326
  // In production, this would just set it on the object.
1377
1327
  var defaultProps;
1378
- var propTypes;
1328
+ var propTypes; // $FlowFixMe
1329
+
1379
1330
  Object.defineProperties(lazyType, {
1380
1331
  defaultProps: {
1381
1332
  configurable: true,
@@ -1386,6 +1337,7 @@ function lazy(ctor) {
1386
1337
  error('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.');
1387
1338
 
1388
1339
  defaultProps = newDefaultProps; // Match production behavior more closely:
1340
+ // $FlowFixMe
1389
1341
 
1390
1342
  Object.defineProperty(lazyType, 'defaultProps', {
1391
1343
  enumerable: true
@@ -1401,6 +1353,7 @@ function lazy(ctor) {
1401
1353
  error('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.');
1402
1354
 
1403
1355
  propTypes = newPropTypes; // Match production behavior more closely:
1356
+ // $FlowFixMe
1404
1357
 
1405
1358
  Object.defineProperty(lazyType, 'propTypes', {
1406
1359
  enumerable: true
@@ -1432,15 +1385,53 @@ function forwardRef(render) {
1432
1385
  }
1433
1386
  }
1434
1387
 
1435
- return {
1388
+ var elementType = {
1436
1389
  $$typeof: REACT_FORWARD_REF_TYPE,
1437
1390
  render: render
1438
1391
  };
1392
+
1393
+ {
1394
+ var ownName;
1395
+ Object.defineProperty(elementType, 'displayName', {
1396
+ enumerable: false,
1397
+ configurable: true,
1398
+ get: function () {
1399
+ return ownName;
1400
+ },
1401
+ set: function (name) {
1402
+ ownName = name;
1403
+
1404
+ if (render.displayName == null) {
1405
+ render.displayName = name;
1406
+ }
1407
+ }
1408
+ });
1409
+ }
1410
+
1411
+ return elementType;
1439
1412
  }
1440
1413
 
1414
+ // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1415
+
1416
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
1417
+
1441
1418
  function isValidElementType(type) {
1442
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1443
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
1419
+ if (typeof type === 'string' || typeof type === 'function') {
1420
+ return true;
1421
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1422
+
1423
+
1424
+ if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1425
+ return true;
1426
+ }
1427
+
1428
+ if (typeof type === 'object' && type !== null) {
1429
+ if (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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1430
+ return true;
1431
+ }
1432
+ }
1433
+
1434
+ return false;
1444
1435
  }
1445
1436
 
1446
1437
  function memo(type, compare) {
@@ -1450,11 +1441,31 @@ function memo(type, compare) {
1450
1441
  }
1451
1442
  }
1452
1443
 
1453
- return {
1444
+ var elementType = {
1454
1445
  $$typeof: REACT_MEMO_TYPE,
1455
1446
  type: type,
1456
1447
  compare: compare === undefined ? null : compare
1457
1448
  };
1449
+
1450
+ {
1451
+ var ownName;
1452
+ Object.defineProperty(elementType, 'displayName', {
1453
+ enumerable: false,
1454
+ configurable: true,
1455
+ get: function () {
1456
+ return ownName;
1457
+ },
1458
+ set: function (name) {
1459
+ ownName = name;
1460
+
1461
+ if (type.displayName == null) {
1462
+ type.displayName = name;
1463
+ }
1464
+ }
1465
+ });
1466
+ }
1467
+
1468
+ return elementType;
1458
1469
  }
1459
1470
 
1460
1471
  function resolveDispatcher() {
@@ -1462,7 +1473,7 @@ function resolveDispatcher() {
1462
1473
 
1463
1474
  if (!(dispatcher !== null)) {
1464
1475
  {
1465
- throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." );
1476
+ throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
1466
1477
  }
1467
1478
  }
1468
1479
 
@@ -1474,7 +1485,7 @@ function useContext(Context, unstable_observedBits) {
1474
1485
 
1475
1486
  {
1476
1487
  if (unstable_observedBits !== undefined) {
1477
- error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '');
1488
+ error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
1478
1489
  } // TODO: add a more generic warning for invalid values.
1479
1490
 
1480
1491
 
@@ -1531,6 +1542,417 @@ function useDebugValue(value, formatterFn) {
1531
1542
  }
1532
1543
  }
1533
1544
 
1545
+ // Helpers to patch console.logs to avoid logging during side-effect free
1546
+ // replaying on render function. This currently only patches the object
1547
+ // lazily which won't cover if the log function was extracted eagerly.
1548
+ // We could also eagerly patch the method.
1549
+ var disabledDepth = 0;
1550
+ var prevLog;
1551
+ var prevInfo;
1552
+ var prevWarn;
1553
+ var prevError;
1554
+ var prevGroup;
1555
+ var prevGroupCollapsed;
1556
+ var prevGroupEnd;
1557
+
1558
+ function disabledLog() {}
1559
+
1560
+ disabledLog.__reactDisabledLog = true;
1561
+ function disableLogs() {
1562
+ {
1563
+ if (disabledDepth === 0) {
1564
+ /* eslint-disable react-internal/no-production-logging */
1565
+ prevLog = console.log;
1566
+ prevInfo = console.info;
1567
+ prevWarn = console.warn;
1568
+ prevError = console.error;
1569
+ prevGroup = console.group;
1570
+ prevGroupCollapsed = console.groupCollapsed;
1571
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
1572
+
1573
+ var props = {
1574
+ configurable: true,
1575
+ enumerable: true,
1576
+ value: disabledLog,
1577
+ writable: true
1578
+ }; // $FlowFixMe Flow thinks console is immutable.
1579
+
1580
+ Object.defineProperties(console, {
1581
+ info: props,
1582
+ log: props,
1583
+ warn: props,
1584
+ error: props,
1585
+ group: props,
1586
+ groupCollapsed: props,
1587
+ groupEnd: props
1588
+ });
1589
+ /* eslint-enable react-internal/no-production-logging */
1590
+ }
1591
+
1592
+ disabledDepth++;
1593
+ }
1594
+ }
1595
+ function reenableLogs() {
1596
+ {
1597
+ disabledDepth--;
1598
+
1599
+ if (disabledDepth === 0) {
1600
+ /* eslint-disable react-internal/no-production-logging */
1601
+ var props = {
1602
+ configurable: true,
1603
+ enumerable: true,
1604
+ writable: true
1605
+ }; // $FlowFixMe Flow thinks console is immutable.
1606
+
1607
+ Object.defineProperties(console, {
1608
+ log: _assign({}, props, {
1609
+ value: prevLog
1610
+ }),
1611
+ info: _assign({}, props, {
1612
+ value: prevInfo
1613
+ }),
1614
+ warn: _assign({}, props, {
1615
+ value: prevWarn
1616
+ }),
1617
+ error: _assign({}, props, {
1618
+ value: prevError
1619
+ }),
1620
+ group: _assign({}, props, {
1621
+ value: prevGroup
1622
+ }),
1623
+ groupCollapsed: _assign({}, props, {
1624
+ value: prevGroupCollapsed
1625
+ }),
1626
+ groupEnd: _assign({}, props, {
1627
+ value: prevGroupEnd
1628
+ })
1629
+ });
1630
+ /* eslint-enable react-internal/no-production-logging */
1631
+ }
1632
+
1633
+ if (disabledDepth < 0) {
1634
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
1635
+ }
1636
+ }
1637
+ }
1638
+
1639
+ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1640
+ var prefix;
1641
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
1642
+ {
1643
+ if (prefix === undefined) {
1644
+ // Extract the VM specific prefix used by each line.
1645
+ try {
1646
+ throw Error();
1647
+ } catch (x) {
1648
+ var match = x.stack.trim().match(/\n( *(at )?)/);
1649
+ prefix = match && match[1] || '';
1650
+ }
1651
+ } // We use the prefix to ensure our stacks line up with native stack frames.
1652
+
1653
+
1654
+ return '\n' + prefix + name;
1655
+ }
1656
+ }
1657
+ var reentry = false;
1658
+ var componentFrameCache;
1659
+
1660
+ {
1661
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
1662
+ componentFrameCache = new PossiblyWeakMap();
1663
+ }
1664
+
1665
+ function describeNativeComponentFrame(fn, construct) {
1666
+ // If something asked for a stack inside a fake render, it should get ignored.
1667
+ if (!fn || reentry) {
1668
+ return '';
1669
+ }
1670
+
1671
+ {
1672
+ var frame = componentFrameCache.get(fn);
1673
+
1674
+ if (frame !== undefined) {
1675
+ return frame;
1676
+ }
1677
+ }
1678
+
1679
+ var control;
1680
+ reentry = true;
1681
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1682
+
1683
+ Error.prepareStackTrace = undefined;
1684
+ var previousDispatcher;
1685
+
1686
+ {
1687
+ previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1688
+ // for warnings.
1689
+
1690
+ ReactCurrentDispatcher$1.current = null;
1691
+ disableLogs();
1692
+ }
1693
+
1694
+ try {
1695
+ // This should throw.
1696
+ if (construct) {
1697
+ // Something should be setting the props in the constructor.
1698
+ var Fake = function () {
1699
+ throw Error();
1700
+ }; // $FlowFixMe
1701
+
1702
+
1703
+ Object.defineProperty(Fake.prototype, 'props', {
1704
+ set: function () {
1705
+ // We use a throwing setter instead of frozen or non-writable props
1706
+ // because that won't throw in a non-strict mode function.
1707
+ throw Error();
1708
+ }
1709
+ });
1710
+
1711
+ if (typeof Reflect === 'object' && Reflect.construct) {
1712
+ // We construct a different control for this case to include any extra
1713
+ // frames added by the construct call.
1714
+ try {
1715
+ Reflect.construct(Fake, []);
1716
+ } catch (x) {
1717
+ control = x;
1718
+ }
1719
+
1720
+ Reflect.construct(fn, [], Fake);
1721
+ } else {
1722
+ try {
1723
+ Fake.call();
1724
+ } catch (x) {
1725
+ control = x;
1726
+ }
1727
+
1728
+ fn.call(Fake.prototype);
1729
+ }
1730
+ } else {
1731
+ try {
1732
+ throw Error();
1733
+ } catch (x) {
1734
+ control = x;
1735
+ }
1736
+
1737
+ fn();
1738
+ }
1739
+ } catch (sample) {
1740
+ // This is inlined manually because closure doesn't do it for us.
1741
+ if (sample && control && typeof sample.stack === 'string') {
1742
+ // This extracts the first frame from the sample that isn't also in the control.
1743
+ // Skipping one frame that we assume is the frame that calls the two.
1744
+ var sampleLines = sample.stack.split('\n');
1745
+ var controlLines = control.stack.split('\n');
1746
+ var s = sampleLines.length - 1;
1747
+ var c = controlLines.length - 1;
1748
+
1749
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1750
+ // We expect at least one stack frame to be shared.
1751
+ // Typically this will be the root most one. However, stack frames may be
1752
+ // cut off due to maximum stack limits. In this case, one maybe cut off
1753
+ // earlier than the other. We assume that the sample is longer or the same
1754
+ // and there for cut off earlier. So we should find the root most frame in
1755
+ // the sample somewhere in the control.
1756
+ c--;
1757
+ }
1758
+
1759
+ for (; s >= 1 && c >= 0; s--, c--) {
1760
+ // Next we find the first one that isn't the same which should be the
1761
+ // frame that called our sample function and the control.
1762
+ if (sampleLines[s] !== controlLines[c]) {
1763
+ // In V8, the first line is describing the message but other VMs don't.
1764
+ // If we're about to return the first line, and the control is also on the same
1765
+ // line, that's a pretty good indicator that our sample threw at same line as
1766
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
1767
+ // This can happen if you passed a class to function component, or non-function.
1768
+ if (s !== 1 || c !== 1) {
1769
+ do {
1770
+ s--;
1771
+ c--; // We may still have similar intermediate frames from the construct call.
1772
+ // The next one that isn't the same should be our match though.
1773
+
1774
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
1775
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
1776
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
1777
+
1778
+ {
1779
+ if (typeof fn === 'function') {
1780
+ componentFrameCache.set(fn, _frame);
1781
+ }
1782
+ } // Return the line we found.
1783
+
1784
+
1785
+ return _frame;
1786
+ }
1787
+ } while (s >= 1 && c >= 0);
1788
+ }
1789
+
1790
+ break;
1791
+ }
1792
+ }
1793
+ }
1794
+ } finally {
1795
+ reentry = false;
1796
+
1797
+ {
1798
+ ReactCurrentDispatcher$1.current = previousDispatcher;
1799
+ reenableLogs();
1800
+ }
1801
+
1802
+ Error.prepareStackTrace = previousPrepareStackTrace;
1803
+ } // Fallback to just using the name if we couldn't make it throw.
1804
+
1805
+
1806
+ var name = fn ? fn.displayName || fn.name : '';
1807
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
1808
+
1809
+ {
1810
+ if (typeof fn === 'function') {
1811
+ componentFrameCache.set(fn, syntheticFrame);
1812
+ }
1813
+ }
1814
+
1815
+ return syntheticFrame;
1816
+ }
1817
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
1818
+ {
1819
+ return describeNativeComponentFrame(fn, false);
1820
+ }
1821
+ }
1822
+
1823
+ function shouldConstruct(Component) {
1824
+ var prototype = Component.prototype;
1825
+ return !!(prototype && prototype.isReactComponent);
1826
+ }
1827
+
1828
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1829
+
1830
+ if (type == null) {
1831
+ return '';
1832
+ }
1833
+
1834
+ if (typeof type === 'function') {
1835
+ {
1836
+ return describeNativeComponentFrame(type, shouldConstruct(type));
1837
+ }
1838
+ }
1839
+
1840
+ if (typeof type === 'string') {
1841
+ return describeBuiltInComponentFrame(type);
1842
+ }
1843
+
1844
+ switch (type) {
1845
+ case exports.Suspense:
1846
+ return describeBuiltInComponentFrame('Suspense');
1847
+
1848
+ case REACT_SUSPENSE_LIST_TYPE:
1849
+ return describeBuiltInComponentFrame('SuspenseList');
1850
+ }
1851
+
1852
+ if (typeof type === 'object') {
1853
+ switch (type.$$typeof) {
1854
+ case REACT_FORWARD_REF_TYPE:
1855
+ return describeFunctionComponentFrame(type.render);
1856
+
1857
+ case REACT_MEMO_TYPE:
1858
+ // Memo may contain any component type so we recursively resolve it.
1859
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
1860
+
1861
+ case REACT_BLOCK_TYPE:
1862
+ return describeFunctionComponentFrame(type._render);
1863
+
1864
+ case REACT_LAZY_TYPE:
1865
+ {
1866
+ var lazyComponent = type;
1867
+ var payload = lazyComponent._payload;
1868
+ var init = lazyComponent._init;
1869
+
1870
+ try {
1871
+ // Lazy may contain any component type so we recursively resolve it.
1872
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
1873
+ } catch (x) {}
1874
+ }
1875
+ }
1876
+ }
1877
+
1878
+ return '';
1879
+ }
1880
+
1881
+ var loggedTypeFailures = {};
1882
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1883
+
1884
+ function setCurrentlyValidatingElement(element) {
1885
+ {
1886
+ if (element) {
1887
+ var owner = element._owner;
1888
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1889
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1890
+ } else {
1891
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1892
+ }
1893
+ }
1894
+ }
1895
+
1896
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
1897
+ {
1898
+ // $FlowFixMe This is okay but Flow doesn't know it.
1899
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
1900
+
1901
+ for (var typeSpecName in typeSpecs) {
1902
+ if (has(typeSpecs, typeSpecName)) {
1903
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
1904
+ // fail the render phase where it didn't fail before. So we log it.
1905
+ // After these have been cleaned up, we'll let them throw.
1906
+
1907
+ try {
1908
+ // This is intentionally an invariant that gets caught. It's the same
1909
+ // behavior as without this statement except with a better message.
1910
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
1911
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
1912
+ err.name = 'Invariant Violation';
1913
+ throw err;
1914
+ }
1915
+
1916
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
1917
+ } catch (ex) {
1918
+ error$1 = ex;
1919
+ }
1920
+
1921
+ if (error$1 && !(error$1 instanceof Error)) {
1922
+ setCurrentlyValidatingElement(element);
1923
+
1924
+ error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
1925
+
1926
+ setCurrentlyValidatingElement(null);
1927
+ }
1928
+
1929
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1930
+ // Only monitor this failure once because there tends to be a lot of the
1931
+ // same error.
1932
+ loggedTypeFailures[error$1.message] = true;
1933
+ setCurrentlyValidatingElement(element);
1934
+
1935
+ error('Failed %s type: %s', location, error$1.message);
1936
+
1937
+ setCurrentlyValidatingElement(null);
1938
+ }
1939
+ }
1940
+ }
1941
+ }
1942
+ }
1943
+
1944
+ function setCurrentlyValidatingElement$1(element) {
1945
+ {
1946
+ if (element) {
1947
+ var owner = element._owner;
1948
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1949
+ setExtraStackFrame(stack);
1950
+ } else {
1951
+ setExtraStackFrame(null);
1952
+ }
1953
+ }
1954
+ }
1955
+
1534
1956
  var propTypesMisspellWarningShown;
1535
1957
 
1536
1958
  {
@@ -1624,13 +2046,13 @@ function validateExplicitKey(element, parentType) {
1624
2046
  childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
1625
2047
  }
1626
2048
 
1627
- setCurrentlyValidatingElement(element);
1628
-
1629
2049
  {
1630
- error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
1631
- }
2050
+ setCurrentlyValidatingElement$1(element);
1632
2051
 
1633
- setCurrentlyValidatingElement(null);
2052
+ error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
2053
+
2054
+ setCurrentlyValidatingElement$1(null);
2055
+ }
1634
2056
  }
1635
2057
  /**
1636
2058
  * Ensure that every element either is passed in a static location, in an
@@ -1696,7 +2118,6 @@ function validatePropTypes(element) {
1696
2118
  return;
1697
2119
  }
1698
2120
 
1699
- var name = getComponentName(type);
1700
2121
  var propTypes;
1701
2122
 
1702
2123
  if (typeof type === 'function') {
@@ -1710,13 +2131,15 @@ function validatePropTypes(element) {
1710
2131
  }
1711
2132
 
1712
2133
  if (propTypes) {
1713
- setCurrentlyValidatingElement(element);
1714
- checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1715
- setCurrentlyValidatingElement(null);
2134
+ // Intentionally inside to avoid triggering lazy initializers:
2135
+ var name = getComponentName(type);
2136
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
1716
2137
  } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1717
- propTypesMisspellWarningShown = true;
2138
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1718
2139
 
1719
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
2140
+ var _name = getComponentName(type);
2141
+
2142
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1720
2143
  }
1721
2144
 
1722
2145
  if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
@@ -1732,24 +2155,28 @@ function validatePropTypes(element) {
1732
2155
 
1733
2156
  function validateFragmentProps(fragment) {
1734
2157
  {
1735
- setCurrentlyValidatingElement(fragment);
1736
2158
  var keys = Object.keys(fragment.props);
1737
2159
 
1738
2160
  for (var i = 0; i < keys.length; i++) {
1739
2161
  var key = keys[i];
1740
2162
 
1741
2163
  if (key !== 'children' && key !== 'key') {
2164
+ setCurrentlyValidatingElement$1(fragment);
2165
+
1742
2166
  error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1743
2167
 
2168
+ setCurrentlyValidatingElement$1(null);
1744
2169
  break;
1745
2170
  }
1746
2171
  }
1747
2172
 
1748
2173
  if (fragment.ref !== null) {
2174
+ setCurrentlyValidatingElement$1(fragment);
2175
+
1749
2176
  error('Invalid attribute `ref` supplied to `React.Fragment`.');
1750
- }
1751
2177
 
1752
- setCurrentlyValidatingElement(null);
2178
+ setCurrentlyValidatingElement$1(null);
2179
+ }
1753
2180
  }
1754
2181
  }
1755
2182
  function createElementWithValidation(type, props, children) {
@@ -1807,7 +2234,7 @@ function createElementWithValidation(type, props, children) {
1807
2234
  }
1808
2235
  }
1809
2236
 
1810
- if (type === REACT_FRAGMENT_TYPE) {
2237
+ if (type === exports.Fragment) {
1811
2238
  validateFragmentProps(element);
1812
2239
  } else {
1813
2240
  validatePropTypes(element);
@@ -1858,13 +2285,11 @@ function cloneElementWithValidation(element, props, children) {
1858
2285
 
1859
2286
  try {
1860
2287
  var frozenObject = Object.freeze({});
1861
- var testMap = new Map([[frozenObject, null]]);
1862
- var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
1863
- // https://github.com/rollup/rollup/issues/1771
1864
- // TODO: we can remove these if Rollup fixes the bug.
2288
+ /* eslint-disable no-new */
1865
2289
 
1866
- testMap.set(0, 0);
1867
- testSet.add(0);
2290
+ new Map([[frozenObject, null]]);
2291
+ new Set([frozenObject]);
2292
+ /* eslint-enable no-new */
1868
2293
  } catch (e) {
1869
2294
  }
1870
2295
  }
@@ -1882,11 +2307,7 @@ var Children = {
1882
2307
 
1883
2308
  exports.Children = Children;
1884
2309
  exports.Component = Component;
1885
- exports.Fragment = REACT_FRAGMENT_TYPE;
1886
- exports.Profiler = REACT_PROFILER_TYPE;
1887
2310
  exports.PureComponent = PureComponent;
1888
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
1889
- exports.Suspense = REACT_SUSPENSE_TYPE;
1890
2311
  exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
1891
2312
  exports.cloneElement = cloneElement$1;
1892
2313
  exports.createContext = createContext;