react 0.0.0-experimental-241485a2c-20210708 → 0.0.0-fec00a869

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.
@@ -1,10 +0,0 @@
1
- /** @license React vundefined
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=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,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)m.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:n.current}}exports.jsx=q;exports.jsxs=q;
@@ -1,10 +0,0 @@
1
- /** @license React vundefined
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=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,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)m.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:n.current}}exports.jsx=q;exports.jsxs=q;
@@ -1,2249 +0,0 @@
1
- /** @license React vundefined
2
- * react-unstable-shared-subset.development.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
-
10
- 'use strict';
11
-
12
- if (process.env.NODE_ENV !== "production") {
13
- (function() {
14
- 'use strict';
15
-
16
- var _assign = require('object-assign');
17
-
18
- var ReactVersion = '18.0.0-experimental-241485a2c-20210708';
19
-
20
- // ATTENTION
21
- // When adding new symbols to this file,
22
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
23
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
24
- // nor polyfill, then a plain number is used for performance.
25
- var REACT_ELEMENT_TYPE = 0xeac7;
26
- var REACT_PORTAL_TYPE = 0xeaca;
27
- exports.Fragment = 0xeacb;
28
- exports.StrictMode = 0xeacc;
29
- exports.Profiler = 0xead2;
30
- var REACT_PROVIDER_TYPE = 0xeacd;
31
- var REACT_CONTEXT_TYPE = 0xeace;
32
- var REACT_FORWARD_REF_TYPE = 0xead0;
33
- exports.Suspense = 0xead1;
34
- exports.SuspenseList = 0xead8;
35
- var REACT_MEMO_TYPE = 0xead3;
36
- var REACT_LAZY_TYPE = 0xead4;
37
- var REACT_SCOPE_TYPE = 0xead7;
38
- var REACT_OPAQUE_ID_TYPE = 0xeae0;
39
- exports.unstable_DebugTracingMode = 0xeae1;
40
- var REACT_OFFSCREEN_TYPE = 0xeae2;
41
- var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
42
- var REACT_CACHE_TYPE = 0xeae4;
43
-
44
- if (typeof Symbol === 'function' && Symbol.for) {
45
- var symbolFor = Symbol.for;
46
- REACT_ELEMENT_TYPE = symbolFor('react.element');
47
- REACT_PORTAL_TYPE = symbolFor('react.portal');
48
- exports.Fragment = symbolFor('react.fragment');
49
- exports.StrictMode = symbolFor('react.strict_mode');
50
- exports.Profiler = symbolFor('react.profiler');
51
- REACT_PROVIDER_TYPE = symbolFor('react.provider');
52
- REACT_CONTEXT_TYPE = symbolFor('react.context');
53
- REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
54
- exports.Suspense = symbolFor('react.suspense');
55
- exports.SuspenseList = symbolFor('react.suspense_list');
56
- REACT_MEMO_TYPE = symbolFor('react.memo');
57
- REACT_LAZY_TYPE = symbolFor('react.lazy');
58
- REACT_SCOPE_TYPE = symbolFor('react.scope');
59
- REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
60
- exports.unstable_DebugTracingMode = symbolFor('react.debug_trace_mode');
61
- REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
62
- REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
63
- REACT_CACHE_TYPE = symbolFor('react.cache');
64
- }
65
-
66
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
67
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
68
- function getIteratorFn(maybeIterable) {
69
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
70
- return null;
71
- }
72
-
73
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
74
-
75
- if (typeof maybeIterator === 'function') {
76
- return maybeIterator;
77
- }
78
-
79
- return null;
80
- }
81
-
82
- /**
83
- * Keeps track of the current dispatcher.
84
- */
85
- var ReactCurrentDispatcher = {
86
- /**
87
- * @internal
88
- * @type {ReactComponent}
89
- */
90
- current: null
91
- };
92
-
93
- /**
94
- * Keeps track of the current batch's configuration such as how long an update
95
- * should suspend for if it needs to.
96
- */
97
- var ReactCurrentBatchConfig = {
98
- transition: 0
99
- };
100
-
101
- var ReactCurrentActQueue = {
102
- current: null,
103
- // Our internal tests use a custom implementation of `act` that works by
104
- // mocking the Scheduler package. Use this field to disable the `act` warning.
105
- // TODO: Maybe the warning should be disabled by default, and then turned
106
- // on at the testing frameworks layer? Instead of what we do now, which
107
- // is check if a `jest` global is defined.
108
- disableActWarning: false
109
- };
110
-
111
- /**
112
- * Keeps track of the current owner.
113
- *
114
- * The current owner is the component who should own any components that are
115
- * currently being constructed.
116
- */
117
- var ReactCurrentOwner = {
118
- /**
119
- * @internal
120
- * @type {ReactComponent}
121
- */
122
- current: null
123
- };
124
-
125
- var ReactDebugCurrentFrame = {};
126
- var currentExtraStackFrame = null;
127
- function setExtraStackFrame(stack) {
128
- {
129
- currentExtraStackFrame = stack;
130
- }
131
- }
132
-
133
- {
134
- ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
135
- {
136
- currentExtraStackFrame = stack;
137
- }
138
- }; // Stack implementation injected by the current renderer.
139
-
140
-
141
- ReactDebugCurrentFrame.getCurrentStack = null;
142
-
143
- ReactDebugCurrentFrame.getStackAddendum = function () {
144
- var stack = ''; // Add an extra top frame while an element is being validated
145
-
146
- if (currentExtraStackFrame) {
147
- stack += currentExtraStackFrame;
148
- } // Delegate to the injected renderer-specific implementation
149
-
150
-
151
- var impl = ReactDebugCurrentFrame.getCurrentStack;
152
-
153
- if (impl) {
154
- stack += impl() || '';
155
- }
156
-
157
- return stack;
158
- };
159
- }
160
-
161
- var ReactSharedInternals = {
162
- ReactCurrentDispatcher: ReactCurrentDispatcher,
163
- ReactCurrentBatchConfig: ReactCurrentBatchConfig,
164
- ReactCurrentOwner: ReactCurrentOwner,
165
- // Used by renderers to avoid bundling object-assign twice in UMD bundles:
166
- assign: _assign
167
- };
168
-
169
- {
170
- ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
171
- ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
172
- }
173
-
174
- // by calls to these methods by a Babel plugin.
175
- //
176
- // In PROD (or in packages without access to React internals),
177
- // they are left as they are instead.
178
-
179
- function warn(format) {
180
- {
181
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
182
- args[_key - 1] = arguments[_key];
183
- }
184
-
185
- printWarning('warn', format, args);
186
- }
187
- }
188
- function error(format) {
189
- {
190
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
191
- args[_key2 - 1] = arguments[_key2];
192
- }
193
-
194
- printWarning('error', format, args);
195
- }
196
- }
197
-
198
- function printWarning(level, format, args) {
199
- // When changing this logic, you might want to also
200
- // update consoleWithStackDev.www.js as well.
201
- {
202
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
203
- var stack = ReactDebugCurrentFrame.getStackAddendum();
204
-
205
- if (stack !== '') {
206
- format += '%s';
207
- args = args.concat([stack]);
208
- }
209
-
210
- var argsWithFormat = args.map(function (item) {
211
- return '' + item;
212
- }); // Careful: RN currently depends on this prefix
213
-
214
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
215
- // breaks IE9: https://github.com/facebook/react/issues/13610
216
- // eslint-disable-next-line react-internal/no-production-logging
217
-
218
- Function.prototype.apply.call(console[level], console, argsWithFormat);
219
- }
220
- }
221
-
222
- var didWarnStateUpdateForUnmountedComponent = {};
223
-
224
- function warnNoop(publicInstance, callerName) {
225
- {
226
- var _constructor = publicInstance.constructor;
227
- var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
228
- var warningKey = componentName + "." + callerName;
229
-
230
- if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
231
- return;
232
- }
233
-
234
- error("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);
235
-
236
- didWarnStateUpdateForUnmountedComponent[warningKey] = true;
237
- }
238
- }
239
- /**
240
- * This is the abstract API for an update queue.
241
- */
242
-
243
-
244
- var ReactNoopUpdateQueue = {
245
- /**
246
- * Checks whether or not this composite component is mounted.
247
- * @param {ReactClass} publicInstance The instance we want to test.
248
- * @return {boolean} True if mounted, false otherwise.
249
- * @protected
250
- * @final
251
- */
252
- isMounted: function (publicInstance) {
253
- return false;
254
- },
255
-
256
- /**
257
- * Forces an update. This should only be invoked when it is known with
258
- * certainty that we are **not** in a DOM transaction.
259
- *
260
- * You may want to call this when you know that some deeper aspect of the
261
- * component's state has changed but `setState` was not called.
262
- *
263
- * This will not invoke `shouldComponentUpdate`, but it will invoke
264
- * `componentWillUpdate` and `componentDidUpdate`.
265
- *
266
- * @param {ReactClass} publicInstance The instance that should rerender.
267
- * @param {?function} callback Called after component is updated.
268
- * @param {?string} callerName name of the calling function in the public API.
269
- * @internal
270
- */
271
- enqueueForceUpdate: function (publicInstance, callback, callerName) {
272
- warnNoop(publicInstance, 'forceUpdate');
273
- },
274
-
275
- /**
276
- * Replaces all of the state. Always use this or `setState` to mutate state.
277
- * You should treat `this.state` as immutable.
278
- *
279
- * There is no guarantee that `this.state` will be immediately updated, so
280
- * accessing `this.state` after calling this method may return the old value.
281
- *
282
- * @param {ReactClass} publicInstance The instance that should rerender.
283
- * @param {object} completeState Next state.
284
- * @param {?function} callback Called after component is updated.
285
- * @param {?string} callerName name of the calling function in the public API.
286
- * @internal
287
- */
288
- enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
289
- warnNoop(publicInstance, 'replaceState');
290
- },
291
-
292
- /**
293
- * Sets a subset of the state. This only exists because _pendingState is
294
- * internal. This provides a merging strategy that is not available to deep
295
- * properties which is confusing. TODO: Expose pendingState or don't use it
296
- * during the merge.
297
- *
298
- * @param {ReactClass} publicInstance The instance that should rerender.
299
- * @param {object} partialState Next partial state to be merged with state.
300
- * @param {?function} callback Called after component is updated.
301
- * @param {?string} Name of the calling function in the public API.
302
- * @internal
303
- */
304
- enqueueSetState: function (publicInstance, partialState, callback, callerName) {
305
- warnNoop(publicInstance, 'setState');
306
- }
307
- };
308
-
309
- var emptyObject = {};
310
-
311
- {
312
- Object.freeze(emptyObject);
313
- }
314
- /**
315
- * Base class helpers for the updating state of a component.
316
- */
317
-
318
-
319
- function Component(props, context, updater) {
320
- this.props = props;
321
- this.context = context; // If a component has string refs, we will assign a different object later.
322
-
323
- this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
324
- // renderer.
325
-
326
- this.updater = updater || ReactNoopUpdateQueue;
327
- }
328
-
329
- Component.prototype.isReactComponent = {};
330
- /**
331
- * Sets a subset of the state. Always use this to mutate
332
- * state. You should treat `this.state` as immutable.
333
- *
334
- * There is no guarantee that `this.state` will be immediately updated, so
335
- * accessing `this.state` after calling this method may return the old value.
336
- *
337
- * There is no guarantee that calls to `setState` will run synchronously,
338
- * as they may eventually be batched together. You can provide an optional
339
- * callback that will be executed when the call to setState is actually
340
- * completed.
341
- *
342
- * When a function is provided to setState, it will be called at some point in
343
- * the future (not synchronously). It will be called with the up to date
344
- * component arguments (state, props, context). These values can be different
345
- * from this.* because your function may be called after receiveProps but before
346
- * shouldComponentUpdate, and this new state, props, and context will not yet be
347
- * assigned to this.
348
- *
349
- * @param {object|function} partialState Next partial state or function to
350
- * produce next partial state to be merged with current state.
351
- * @param {?function} callback Called after state is updated.
352
- * @final
353
- * @protected
354
- */
355
-
356
- Component.prototype.setState = function (partialState, callback) {
357
- if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
358
- {
359
- throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
360
- }
361
- }
362
-
363
- this.updater.enqueueSetState(this, partialState, callback, 'setState');
364
- };
365
- /**
366
- * Forces an update. This should only be invoked when it is known with
367
- * certainty that we are **not** in a DOM transaction.
368
- *
369
- * You may want to call this when you know that some deeper aspect of the
370
- * component's state has changed but `setState` was not called.
371
- *
372
- * This will not invoke `shouldComponentUpdate`, but it will invoke
373
- * `componentWillUpdate` and `componentDidUpdate`.
374
- *
375
- * @param {?function} callback Called after update is complete.
376
- * @final
377
- * @protected
378
- */
379
-
380
-
381
- Component.prototype.forceUpdate = function (callback) {
382
- this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
383
- };
384
- /**
385
- * Deprecated APIs. These APIs used to exist on classic React classes but since
386
- * we would like to deprecate them, we're not going to move them over to this
387
- * modern base class. Instead, we define a getter that warns if it's accessed.
388
- */
389
-
390
-
391
- {
392
- var deprecatedAPIs = {
393
- isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
394
- replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
395
- };
396
-
397
- var defineDeprecationWarning = function (methodName, info) {
398
- Object.defineProperty(Component.prototype, methodName, {
399
- get: function () {
400
- warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
401
-
402
- return undefined;
403
- }
404
- });
405
- };
406
-
407
- for (var fnName in deprecatedAPIs) {
408
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
409
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
410
- }
411
- }
412
- }
413
-
414
- function ComponentDummy() {}
415
-
416
- ComponentDummy.prototype = Component.prototype;
417
- /**
418
- * Convenience component with default shallow equality check for sCU.
419
- */
420
-
421
- function PureComponent(props, context, updater) {
422
- this.props = props;
423
- this.context = context; // If a component has string refs, we will assign a different object later.
424
-
425
- this.refs = emptyObject;
426
- this.updater = updater || ReactNoopUpdateQueue;
427
- }
428
-
429
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
430
- pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
431
-
432
- _assign(pureComponentPrototype, Component.prototype);
433
-
434
- pureComponentPrototype.isPureReactComponent = true;
435
-
436
- // an immutable object with a single mutable value
437
- function createRef() {
438
- var refObject = {
439
- current: null
440
- };
441
-
442
- {
443
- Object.seal(refObject);
444
- }
445
-
446
- return refObject;
447
- }
448
-
449
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
450
-
451
- function isArray(a) {
452
- return isArrayImpl(a);
453
- }
454
-
455
- function getWrappedName(outerType, innerType, wrapperName) {
456
- var displayName = outerType.displayName;
457
-
458
- if (displayName) {
459
- return displayName;
460
- }
461
-
462
- var functionName = innerType.displayName || innerType.name || '';
463
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
464
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
465
-
466
-
467
- function getContextName(type) {
468
- return type.displayName || 'Context';
469
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
470
-
471
-
472
- function getComponentNameFromType(type) {
473
- if (type == null) {
474
- // Host root, text node or just invalid type.
475
- return null;
476
- }
477
-
478
- {
479
- if (typeof type.tag === 'number') {
480
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
481
- }
482
- }
483
-
484
- if (typeof type === 'function') {
485
- return type.displayName || type.name || null;
486
- }
487
-
488
- if (typeof type === 'string') {
489
- return type;
490
- }
491
-
492
- switch (type) {
493
- case exports.Fragment:
494
- return 'Fragment';
495
-
496
- case REACT_PORTAL_TYPE:
497
- return 'Portal';
498
-
499
- case exports.Profiler:
500
- return 'Profiler';
501
-
502
- case exports.StrictMode:
503
- return 'StrictMode';
504
-
505
- case exports.Suspense:
506
- return 'Suspense';
507
-
508
- case exports.SuspenseList:
509
- return 'SuspenseList';
510
-
511
- case REACT_CACHE_TYPE:
512
- return 'Cache';
513
- }
514
-
515
- if (typeof type === 'object') {
516
- switch (type.$$typeof) {
517
- case REACT_CONTEXT_TYPE:
518
- var context = type;
519
- return getContextName(context) + '.Consumer';
520
-
521
- case REACT_PROVIDER_TYPE:
522
- var provider = type;
523
- return getContextName(provider._context) + '.Provider';
524
-
525
- case REACT_FORWARD_REF_TYPE:
526
- return getWrappedName(type, type.render, 'ForwardRef');
527
-
528
- case REACT_MEMO_TYPE:
529
- var outerName = type.displayName || null;
530
-
531
- if (outerName !== null) {
532
- return outerName;
533
- }
534
-
535
- return getComponentNameFromType(type.type) || 'Memo';
536
-
537
- case REACT_LAZY_TYPE:
538
- {
539
- var lazyComponent = type;
540
- var payload = lazyComponent._payload;
541
- var init = lazyComponent._init;
542
-
543
- try {
544
- return getComponentNameFromType(init(payload));
545
- } catch (x) {
546
- return null;
547
- }
548
- }
549
- }
550
- }
551
-
552
- return null;
553
- }
554
-
555
- var hasOwnProperty = Object.prototype.hasOwnProperty;
556
-
557
- var RESERVED_PROPS = {
558
- key: true,
559
- ref: true,
560
- __self: true,
561
- __source: true
562
- };
563
- var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
564
-
565
- {
566
- didWarnAboutStringRefs = {};
567
- }
568
-
569
- function hasValidRef(config) {
570
- {
571
- if (hasOwnProperty.call(config, 'ref')) {
572
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
573
-
574
- if (getter && getter.isReactWarning) {
575
- return false;
576
- }
577
- }
578
- }
579
-
580
- return config.ref !== undefined;
581
- }
582
-
583
- function hasValidKey(config) {
584
- {
585
- if (hasOwnProperty.call(config, 'key')) {
586
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
587
-
588
- if (getter && getter.isReactWarning) {
589
- return false;
590
- }
591
- }
592
- }
593
-
594
- return config.key !== undefined;
595
- }
596
-
597
- function defineKeyPropWarningGetter(props, displayName) {
598
- var warnAboutAccessingKey = function () {
599
- {
600
- if (!specialPropKeyWarningShown) {
601
- specialPropKeyWarningShown = true;
602
-
603
- 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);
604
- }
605
- }
606
- };
607
-
608
- warnAboutAccessingKey.isReactWarning = true;
609
- Object.defineProperty(props, 'key', {
610
- get: warnAboutAccessingKey,
611
- configurable: true
612
- });
613
- }
614
-
615
- function defineRefPropWarningGetter(props, displayName) {
616
- var warnAboutAccessingRef = function () {
617
- {
618
- if (!specialPropRefWarningShown) {
619
- specialPropRefWarningShown = true;
620
-
621
- 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);
622
- }
623
- }
624
- };
625
-
626
- warnAboutAccessingRef.isReactWarning = true;
627
- Object.defineProperty(props, 'ref', {
628
- get: warnAboutAccessingRef,
629
- configurable: true
630
- });
631
- }
632
-
633
- function warnIfStringRefCannotBeAutoConverted(config) {
634
- {
635
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
636
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
637
-
638
- if (!didWarnAboutStringRefs[componentName]) {
639
- 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);
640
-
641
- didWarnAboutStringRefs[componentName] = true;
642
- }
643
- }
644
- }
645
- }
646
- /**
647
- * Factory method to create a new React element. This no longer adheres to
648
- * the class pattern, so do not use new to call it. Also, instanceof check
649
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
650
- * if something is a React Element.
651
- *
652
- * @param {*} type
653
- * @param {*} props
654
- * @param {*} key
655
- * @param {string|object} ref
656
- * @param {*} owner
657
- * @param {*} self A *temporary* helper to detect places where `this` is
658
- * different from the `owner` when React.createElement is called, so that we
659
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
660
- * functions, and as long as `this` and owner are the same, there will be no
661
- * change in behavior.
662
- * @param {*} source An annotation object (added by a transpiler or otherwise)
663
- * indicating filename, line number, and/or other information.
664
- * @internal
665
- */
666
-
667
-
668
- var ReactElement = function (type, key, ref, self, source, owner, props) {
669
- var element = {
670
- // This tag allows us to uniquely identify this as a React Element
671
- $$typeof: REACT_ELEMENT_TYPE,
672
- // Built-in properties that belong on the element
673
- type: type,
674
- key: key,
675
- ref: ref,
676
- props: props,
677
- // Record the component responsible for creating this element.
678
- _owner: owner
679
- };
680
-
681
- {
682
- // The validation flag is currently mutative. We put it on
683
- // an external backing store so that we can freeze the whole object.
684
- // This can be replaced with a WeakMap once they are implemented in
685
- // commonly used development environments.
686
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
687
- // the validation flag non-enumerable (where possible, which should
688
- // include every environment we run tests in), so the test framework
689
- // ignores it.
690
-
691
- Object.defineProperty(element._store, 'validated', {
692
- configurable: false,
693
- enumerable: false,
694
- writable: true,
695
- value: false
696
- }); // self and source are DEV only properties.
697
-
698
- Object.defineProperty(element, '_self', {
699
- configurable: false,
700
- enumerable: false,
701
- writable: false,
702
- value: self
703
- }); // Two elements created in two different places should be considered
704
- // equal for testing purposes and therefore we hide it from enumeration.
705
-
706
- Object.defineProperty(element, '_source', {
707
- configurable: false,
708
- enumerable: false,
709
- writable: false,
710
- value: source
711
- });
712
-
713
- if (Object.freeze) {
714
- Object.freeze(element.props);
715
- Object.freeze(element);
716
- }
717
- }
718
-
719
- return element;
720
- };
721
- /**
722
- * Create and return a new ReactElement of the given type.
723
- * See https://reactjs.org/docs/react-api.html#createelement
724
- */
725
-
726
- function createElement(type, config, children) {
727
- var propName; // Reserved names are extracted
728
-
729
- var props = {};
730
- var key = null;
731
- var ref = null;
732
- var self = null;
733
- var source = null;
734
-
735
- if (config != null) {
736
- if (hasValidRef(config)) {
737
- ref = config.ref;
738
-
739
- {
740
- warnIfStringRefCannotBeAutoConverted(config);
741
- }
742
- }
743
-
744
- if (hasValidKey(config)) {
745
- key = '' + config.key;
746
- }
747
-
748
- self = config.__self === undefined ? null : config.__self;
749
- source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
750
-
751
- for (propName in config) {
752
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
753
- props[propName] = config[propName];
754
- }
755
- }
756
- } // Children can be more than one argument, and those are transferred onto
757
- // the newly allocated props object.
758
-
759
-
760
- var childrenLength = arguments.length - 2;
761
-
762
- if (childrenLength === 1) {
763
- props.children = children;
764
- } else if (childrenLength > 1) {
765
- var childArray = Array(childrenLength);
766
-
767
- for (var i = 0; i < childrenLength; i++) {
768
- childArray[i] = arguments[i + 2];
769
- }
770
-
771
- {
772
- if (Object.freeze) {
773
- Object.freeze(childArray);
774
- }
775
- }
776
-
777
- props.children = childArray;
778
- } // Resolve default props
779
-
780
-
781
- if (type && type.defaultProps) {
782
- var defaultProps = type.defaultProps;
783
-
784
- for (propName in defaultProps) {
785
- if (props[propName] === undefined) {
786
- props[propName] = defaultProps[propName];
787
- }
788
- }
789
- }
790
-
791
- {
792
- if (key || ref) {
793
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
794
-
795
- if (key) {
796
- defineKeyPropWarningGetter(props, displayName);
797
- }
798
-
799
- if (ref) {
800
- defineRefPropWarningGetter(props, displayName);
801
- }
802
- }
803
- }
804
-
805
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
806
- }
807
- function cloneAndReplaceKey(oldElement, newKey) {
808
- var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
809
- return newElement;
810
- }
811
- /**
812
- * Clone and return a new ReactElement using element as the starting point.
813
- * See https://reactjs.org/docs/react-api.html#cloneelement
814
- */
815
-
816
- function cloneElement(element, config, children) {
817
- if (!!(element === null || element === undefined)) {
818
- {
819
- throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
820
- }
821
- }
822
-
823
- var propName; // Original props are copied
824
-
825
- var props = _assign({}, element.props); // Reserved names are extracted
826
-
827
-
828
- var key = element.key;
829
- var ref = element.ref; // Self is preserved since the owner is preserved.
830
-
831
- var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
832
- // transpiler, and the original source is probably a better indicator of the
833
- // true owner.
834
-
835
- var source = element._source; // Owner will be preserved, unless ref is overridden
836
-
837
- var owner = element._owner;
838
-
839
- if (config != null) {
840
- if (hasValidRef(config)) {
841
- // Silently steal the ref from the parent.
842
- ref = config.ref;
843
- owner = ReactCurrentOwner.current;
844
- }
845
-
846
- if (hasValidKey(config)) {
847
- key = '' + config.key;
848
- } // Remaining properties override existing props
849
-
850
-
851
- var defaultProps;
852
-
853
- if (element.type && element.type.defaultProps) {
854
- defaultProps = element.type.defaultProps;
855
- }
856
-
857
- for (propName in config) {
858
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
859
- if (config[propName] === undefined && defaultProps !== undefined) {
860
- // Resolve default props
861
- props[propName] = defaultProps[propName];
862
- } else {
863
- props[propName] = config[propName];
864
- }
865
- }
866
- }
867
- } // Children can be more than one argument, and those are transferred onto
868
- // the newly allocated props object.
869
-
870
-
871
- var childrenLength = arguments.length - 2;
872
-
873
- if (childrenLength === 1) {
874
- props.children = children;
875
- } else if (childrenLength > 1) {
876
- var childArray = Array(childrenLength);
877
-
878
- for (var i = 0; i < childrenLength; i++) {
879
- childArray[i] = arguments[i + 2];
880
- }
881
-
882
- props.children = childArray;
883
- }
884
-
885
- return ReactElement(element.type, key, ref, self, source, owner, props);
886
- }
887
- /**
888
- * Verifies the object is a ReactElement.
889
- * See https://reactjs.org/docs/react-api.html#isvalidelement
890
- * @param {?object} object
891
- * @return {boolean} True if `object` is a ReactElement.
892
- * @final
893
- */
894
-
895
- function isValidElement(object) {
896
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
897
- }
898
-
899
- var SEPARATOR = '.';
900
- var SUBSEPARATOR = ':';
901
- /**
902
- * Escape and wrap key so it is safe to use as a reactid
903
- *
904
- * @param {string} key to be escaped.
905
- * @return {string} the escaped key.
906
- */
907
-
908
- function escape(key) {
909
- var escapeRegex = /[=:]/g;
910
- var escaperLookup = {
911
- '=': '=0',
912
- ':': '=2'
913
- };
914
- var escapedString = key.replace(escapeRegex, function (match) {
915
- return escaperLookup[match];
916
- });
917
- return '$' + escapedString;
918
- }
919
- /**
920
- * TODO: Test that a single child and an array with one item have the same key
921
- * pattern.
922
- */
923
-
924
-
925
- var didWarnAboutMaps = false;
926
- var userProvidedKeyEscapeRegex = /\/+/g;
927
-
928
- function escapeUserProvidedKey(text) {
929
- return text.replace(userProvidedKeyEscapeRegex, '$&/');
930
- }
931
- /**
932
- * Generate a key string that identifies a element within a set.
933
- *
934
- * @param {*} element A element that could contain a manual key.
935
- * @param {number} index Index that is used if a manual key is not provided.
936
- * @return {string}
937
- */
938
-
939
-
940
- function getElementKey(element, index) {
941
- // Do some typechecking here since we call this blindly. We want to ensure
942
- // that we don't block potential future ES APIs.
943
- if (typeof element === 'object' && element !== null && element.key != null) {
944
- // Explicit key
945
- return escape('' + element.key);
946
- } // Implicit key determined by the index in the set
947
-
948
-
949
- return index.toString(36);
950
- }
951
-
952
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
953
- var type = typeof children;
954
-
955
- if (type === 'undefined' || type === 'boolean') {
956
- // All of the above are perceived as null.
957
- children = null;
958
- }
959
-
960
- var invokeCallback = false;
961
-
962
- if (children === null) {
963
- invokeCallback = true;
964
- } else {
965
- switch (type) {
966
- case 'string':
967
- case 'number':
968
- invokeCallback = true;
969
- break;
970
-
971
- case 'object':
972
- switch (children.$$typeof) {
973
- case REACT_ELEMENT_TYPE:
974
- case REACT_PORTAL_TYPE:
975
- invokeCallback = true;
976
- }
977
-
978
- }
979
- }
980
-
981
- if (invokeCallback) {
982
- var _child = children;
983
- var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
984
- // so that it's consistent if the number of children grows:
985
-
986
- var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
987
-
988
- if (isArray(mappedChild)) {
989
- var escapedChildKey = '';
990
-
991
- if (childKey != null) {
992
- escapedChildKey = escapeUserProvidedKey(childKey) + '/';
993
- }
994
-
995
- mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
996
- return c;
997
- });
998
- } else if (mappedChild != null) {
999
- if (isValidElement(mappedChild)) {
1000
- mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1001
- // traverseAllChildren used to do for objects as children
1002
- escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1003
- mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
1004
- escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
1005
- }
1006
-
1007
- array.push(mappedChild);
1008
- }
1009
-
1010
- return 1;
1011
- }
1012
-
1013
- var child;
1014
- var nextName;
1015
- var subtreeCount = 0; // Count of children found in the current subtree.
1016
-
1017
- var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1018
-
1019
- if (isArray(children)) {
1020
- for (var i = 0; i < children.length; i++) {
1021
- child = children[i];
1022
- nextName = nextNamePrefix + getElementKey(child, i);
1023
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1024
- }
1025
- } else {
1026
- var iteratorFn = getIteratorFn(children);
1027
-
1028
- if (typeof iteratorFn === 'function') {
1029
- var iterableChildren = children;
1030
-
1031
- {
1032
- // Warn about using Maps as children
1033
- if (iteratorFn === iterableChildren.entries) {
1034
- if (!didWarnAboutMaps) {
1035
- warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1036
- }
1037
-
1038
- didWarnAboutMaps = true;
1039
- }
1040
- }
1041
-
1042
- var iterator = iteratorFn.call(iterableChildren);
1043
- var step;
1044
- var ii = 0;
1045
-
1046
- while (!(step = iterator.next()).done) {
1047
- child = step.value;
1048
- nextName = nextNamePrefix + getElementKey(child, ii++);
1049
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1050
- }
1051
- } else if (type === 'object') {
1052
- var childrenString = '' + children;
1053
-
1054
- {
1055
- {
1056
- 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." );
1057
- }
1058
- }
1059
- }
1060
- }
1061
-
1062
- return subtreeCount;
1063
- }
1064
-
1065
- /**
1066
- * Maps children that are typically specified as `props.children`.
1067
- *
1068
- * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1069
- *
1070
- * The provided mapFunction(child, index) will be called for each
1071
- * leaf child.
1072
- *
1073
- * @param {?*} children Children tree container.
1074
- * @param {function(*, int)} func The map function.
1075
- * @param {*} context Context for mapFunction.
1076
- * @return {object} Object containing the ordered map of results.
1077
- */
1078
- function mapChildren(children, func, context) {
1079
- if (children == null) {
1080
- return children;
1081
- }
1082
-
1083
- var result = [];
1084
- var count = 0;
1085
- mapIntoArray(children, result, '', '', function (child) {
1086
- return func.call(context, child, count++);
1087
- });
1088
- return result;
1089
- }
1090
- /**
1091
- * Count the number of children that are typically specified as
1092
- * `props.children`.
1093
- *
1094
- * See https://reactjs.org/docs/react-api.html#reactchildrencount
1095
- *
1096
- * @param {?*} children Children tree container.
1097
- * @return {number} The number of children.
1098
- */
1099
-
1100
-
1101
- function countChildren(children) {
1102
- var n = 0;
1103
- mapChildren(children, function () {
1104
- n++; // Don't return anything
1105
- });
1106
- return n;
1107
- }
1108
-
1109
- /**
1110
- * Iterates through children that are typically specified as `props.children`.
1111
- *
1112
- * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1113
- *
1114
- * The provided forEachFunc(child, index) will be called for each
1115
- * leaf child.
1116
- *
1117
- * @param {?*} children Children tree container.
1118
- * @param {function(*, int)} forEachFunc
1119
- * @param {*} forEachContext Context for forEachContext.
1120
- */
1121
- function forEachChildren(children, forEachFunc, forEachContext) {
1122
- mapChildren(children, function () {
1123
- forEachFunc.apply(this, arguments); // Don't return anything.
1124
- }, forEachContext);
1125
- }
1126
- /**
1127
- * Flatten a children object (typically specified as `props.children`) and
1128
- * return an array with appropriately re-keyed children.
1129
- *
1130
- * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1131
- */
1132
-
1133
-
1134
- function toArray(children) {
1135
- return mapChildren(children, function (child) {
1136
- return child;
1137
- }) || [];
1138
- }
1139
- /**
1140
- * Returns the first child in a collection of children and verifies that there
1141
- * is only one child in the collection.
1142
- *
1143
- * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1144
- *
1145
- * The current implementation of this function assumes that a single child gets
1146
- * passed without a wrapper, but the purpose of this helper function is to
1147
- * abstract away the particular structure of children.
1148
- *
1149
- * @param {?object} children Child collection structure.
1150
- * @return {ReactElement} The first and only `ReactElement` contained in the
1151
- * structure.
1152
- */
1153
-
1154
-
1155
- function onlyChild(children) {
1156
- if (!isValidElement(children)) {
1157
- {
1158
- throw Error( "React.Children.only expected to receive a single React element child." );
1159
- }
1160
- }
1161
-
1162
- return children;
1163
- }
1164
-
1165
- var Uninitialized = -1;
1166
- var Pending = 0;
1167
- var Resolved = 1;
1168
- var Rejected = 2;
1169
-
1170
- function lazyInitializer(payload) {
1171
- if (payload._status === Uninitialized) {
1172
- var ctor = payload._result;
1173
- var thenable = ctor(); // Transition to the next state.
1174
- // This might throw either because it's missing or throws. If so, we treat it
1175
- // as still uninitialized and try again next time. Which is the same as what
1176
- // happens if the ctor or any wrappers processing the ctor throws. This might
1177
- // end up fixing it if the resolution was a concurrency bug.
1178
-
1179
- thenable.then(function (moduleObject) {
1180
- if (payload._status === Pending || payload._status === Uninitialized) {
1181
- // Transition to the next state.
1182
- var resolved = payload;
1183
- resolved._status = Resolved;
1184
- resolved._result = moduleObject;
1185
- }
1186
- }, function (error) {
1187
- if (payload._status === Pending || payload._status === Uninitialized) {
1188
- // Transition to the next state.
1189
- var rejected = payload;
1190
- rejected._status = Rejected;
1191
- rejected._result = error;
1192
- }
1193
- });
1194
-
1195
- if (payload._status === Uninitialized) {
1196
- // In case, we're still uninitialized, then we're waiting for the thenable
1197
- // to resolve. Set it as pending in the meantime.
1198
- var pending = payload;
1199
- pending._status = Pending;
1200
- pending._result = thenable;
1201
- }
1202
- }
1203
-
1204
- if (payload._status === Resolved) {
1205
- var moduleObject = payload._result;
1206
-
1207
- {
1208
- if (moduleObject === undefined) {
1209
- 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.
1210
- 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
1211
- }
1212
- }
1213
-
1214
- {
1215
- if (!('default' in moduleObject)) {
1216
- 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.
1217
- 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1218
- }
1219
- }
1220
-
1221
- return moduleObject.default;
1222
- } else {
1223
- throw payload._result;
1224
- }
1225
- }
1226
-
1227
- function lazy(ctor) {
1228
- var payload = {
1229
- // We use these fields to store the result.
1230
- _status: -1,
1231
- _result: ctor
1232
- };
1233
- var lazyType = {
1234
- $$typeof: REACT_LAZY_TYPE,
1235
- _payload: payload,
1236
- _init: lazyInitializer
1237
- };
1238
-
1239
- {
1240
- // In production, this would just set it on the object.
1241
- var defaultProps;
1242
- var propTypes; // $FlowFixMe
1243
-
1244
- Object.defineProperties(lazyType, {
1245
- defaultProps: {
1246
- configurable: true,
1247
- get: function () {
1248
- return defaultProps;
1249
- },
1250
- set: function (newDefaultProps) {
1251
- 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.');
1252
-
1253
- defaultProps = newDefaultProps; // Match production behavior more closely:
1254
- // $FlowFixMe
1255
-
1256
- Object.defineProperty(lazyType, 'defaultProps', {
1257
- enumerable: true
1258
- });
1259
- }
1260
- },
1261
- propTypes: {
1262
- configurable: true,
1263
- get: function () {
1264
- return propTypes;
1265
- },
1266
- set: function (newPropTypes) {
1267
- 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.');
1268
-
1269
- propTypes = newPropTypes; // Match production behavior more closely:
1270
- // $FlowFixMe
1271
-
1272
- Object.defineProperty(lazyType, 'propTypes', {
1273
- enumerable: true
1274
- });
1275
- }
1276
- }
1277
- });
1278
- }
1279
-
1280
- return lazyType;
1281
- }
1282
-
1283
- function forwardRef(render) {
1284
- {
1285
- if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1286
- error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1287
- } else if (typeof render !== 'function') {
1288
- error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1289
- } else {
1290
- if (render.length !== 0 && render.length !== 2) {
1291
- error('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.');
1292
- }
1293
- }
1294
-
1295
- if (render != null) {
1296
- if (render.defaultProps != null || render.propTypes != null) {
1297
- error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1298
- }
1299
- }
1300
- }
1301
-
1302
- var elementType = {
1303
- $$typeof: REACT_FORWARD_REF_TYPE,
1304
- render: render
1305
- };
1306
-
1307
- {
1308
- var ownName;
1309
- Object.defineProperty(elementType, 'displayName', {
1310
- enumerable: false,
1311
- configurable: true,
1312
- get: function () {
1313
- return ownName;
1314
- },
1315
- set: function (name) {
1316
- ownName = name; // The inner component shouldn't inherit this display name in most cases,
1317
- // because the component may be used elsewhere.
1318
- // But it's nice for anonymous functions to inherit the name,
1319
- // so that our component-stack generation logic will display their frames.
1320
- // An anonymous function generally suggests a pattern like:
1321
- // React.forwardRef((props, ref) => {...});
1322
- // This kind of inner function is not used elsewhere so the side effect is okay.
1323
-
1324
- if (!render.name && !render.displayName) {
1325
- render.displayName = name;
1326
- }
1327
- }
1328
- });
1329
- }
1330
-
1331
- return elementType;
1332
- }
1333
-
1334
- // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1335
-
1336
- var enableScopeAPI = false; // Experimental Create Event Handle API.
1337
-
1338
- var REACT_MODULE_REFERENCE = 0;
1339
-
1340
- if (typeof Symbol === 'function') {
1341
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
1342
- }
1343
-
1344
- function isValidElementType(type) {
1345
- if (typeof type === 'string' || typeof type === 'function') {
1346
- return true;
1347
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1348
-
1349
-
1350
- if (type === exports.Fragment || type === exports.Profiler || type === exports.unstable_DebugTracingMode || type === exports.StrictMode || type === exports.Suspense || type === exports.SuspenseList || type === REACT_LEGACY_HIDDEN_TYPE || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || type === REACT_CACHE_TYPE) {
1351
- return true;
1352
- }
1353
-
1354
- if (typeof type === 'object' && type !== null) {
1355
- 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 || // This needs to include all possible module reference object
1356
- // types supported by any Flight configuration anywhere since
1357
- // we don't know which Flight build this will end up being used
1358
- // with.
1359
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
1360
- return true;
1361
- }
1362
- }
1363
-
1364
- return false;
1365
- }
1366
-
1367
- function memo(type, compare) {
1368
- {
1369
- if (!isValidElementType(type)) {
1370
- error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1371
- }
1372
- }
1373
-
1374
- var elementType = {
1375
- $$typeof: REACT_MEMO_TYPE,
1376
- type: type,
1377
- compare: compare === undefined ? null : compare
1378
- };
1379
-
1380
- {
1381
- var ownName;
1382
- Object.defineProperty(elementType, 'displayName', {
1383
- enumerable: false,
1384
- configurable: true,
1385
- get: function () {
1386
- return ownName;
1387
- },
1388
- set: function (name) {
1389
- ownName = name; // The inner component shouldn't inherit this display name in most cases,
1390
- // because the component may be used elsewhere.
1391
- // But it's nice for anonymous functions to inherit the name,
1392
- // so that our component-stack generation logic will display their frames.
1393
- // An anonymous function generally suggests a pattern like:
1394
- // React.memo((props) => {...});
1395
- // This kind of inner function is not used elsewhere so the side effect is okay.
1396
-
1397
- if (!type.name && !type.displayName) {
1398
- type.displayName = name;
1399
- }
1400
- }
1401
- });
1402
- }
1403
-
1404
- return elementType;
1405
- }
1406
-
1407
- function resolveDispatcher() {
1408
- var dispatcher = ReactCurrentDispatcher.current;
1409
-
1410
- {
1411
- if (dispatcher === null) {
1412
- 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:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
1413
- }
1414
- } // Will result in a null access error if accessed outside render phase. We
1415
- // intentionally don't throw our own error because this is in a hot path.
1416
- // Also helps ensure this is inlined.
1417
-
1418
-
1419
- return dispatcher;
1420
- }
1421
-
1422
- function getCacheForType(resourceType) {
1423
- var dispatcher = resolveDispatcher(); // $FlowFixMe This is unstable, thus optional
1424
-
1425
- return dispatcher.getCacheForType(resourceType);
1426
- }
1427
- function useContext(Context) {
1428
- var dispatcher = resolveDispatcher();
1429
-
1430
- {
1431
- // TODO: add a more generic warning for invalid values.
1432
- if (Context._context !== undefined) {
1433
- var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1434
- // and nobody should be using this in existing code.
1435
-
1436
- if (realContext.Consumer === Context) {
1437
- error('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?');
1438
- } else if (realContext.Provider === Context) {
1439
- error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1440
- }
1441
- }
1442
- }
1443
-
1444
- return dispatcher.useContext(Context);
1445
- }
1446
- function useCallback(callback, deps) {
1447
- var dispatcher = resolveDispatcher();
1448
- return dispatcher.useCallback(callback, deps);
1449
- }
1450
- function useMemo(create, deps) {
1451
- var dispatcher = resolveDispatcher();
1452
- return dispatcher.useMemo(create, deps);
1453
- }
1454
- function useDebugValue(value, formatterFn) {
1455
- {
1456
- var dispatcher = resolveDispatcher();
1457
- return dispatcher.useDebugValue(value, formatterFn);
1458
- }
1459
- }
1460
- function useTransition() {
1461
- var dispatcher = resolveDispatcher();
1462
- return dispatcher.useTransition();
1463
- }
1464
- function useDeferredValue(value) {
1465
- var dispatcher = resolveDispatcher();
1466
- return dispatcher.useDeferredValue(value);
1467
- }
1468
- function useOpaqueIdentifier() {
1469
- var dispatcher = resolveDispatcher();
1470
- return dispatcher.useOpaqueIdentifier();
1471
- }
1472
- function useMutableSource(source, getSnapshot, subscribe) {
1473
- var dispatcher = resolveDispatcher();
1474
- return dispatcher.useMutableSource(source, getSnapshot, subscribe);
1475
- }
1476
-
1477
- // Helpers to patch console.logs to avoid logging during side-effect free
1478
- // replaying on render function. This currently only patches the object
1479
- // lazily which won't cover if the log function was extracted eagerly.
1480
- // We could also eagerly patch the method.
1481
- var disabledDepth = 0;
1482
- var prevLog;
1483
- var prevInfo;
1484
- var prevWarn;
1485
- var prevError;
1486
- var prevGroup;
1487
- var prevGroupCollapsed;
1488
- var prevGroupEnd;
1489
-
1490
- function disabledLog() {}
1491
-
1492
- disabledLog.__reactDisabledLog = true;
1493
- function disableLogs() {
1494
- {
1495
- if (disabledDepth === 0) {
1496
- /* eslint-disable react-internal/no-production-logging */
1497
- prevLog = console.log;
1498
- prevInfo = console.info;
1499
- prevWarn = console.warn;
1500
- prevError = console.error;
1501
- prevGroup = console.group;
1502
- prevGroupCollapsed = console.groupCollapsed;
1503
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
1504
-
1505
- var props = {
1506
- configurable: true,
1507
- enumerable: true,
1508
- value: disabledLog,
1509
- writable: true
1510
- }; // $FlowFixMe Flow thinks console is immutable.
1511
-
1512
- Object.defineProperties(console, {
1513
- info: props,
1514
- log: props,
1515
- warn: props,
1516
- error: props,
1517
- group: props,
1518
- groupCollapsed: props,
1519
- groupEnd: props
1520
- });
1521
- /* eslint-enable react-internal/no-production-logging */
1522
- }
1523
-
1524
- disabledDepth++;
1525
- }
1526
- }
1527
- function reenableLogs() {
1528
- {
1529
- disabledDepth--;
1530
-
1531
- if (disabledDepth === 0) {
1532
- /* eslint-disable react-internal/no-production-logging */
1533
- var props = {
1534
- configurable: true,
1535
- enumerable: true,
1536
- writable: true
1537
- }; // $FlowFixMe Flow thinks console is immutable.
1538
-
1539
- Object.defineProperties(console, {
1540
- log: _assign({}, props, {
1541
- value: prevLog
1542
- }),
1543
- info: _assign({}, props, {
1544
- value: prevInfo
1545
- }),
1546
- warn: _assign({}, props, {
1547
- value: prevWarn
1548
- }),
1549
- error: _assign({}, props, {
1550
- value: prevError
1551
- }),
1552
- group: _assign({}, props, {
1553
- value: prevGroup
1554
- }),
1555
- groupCollapsed: _assign({}, props, {
1556
- value: prevGroupCollapsed
1557
- }),
1558
- groupEnd: _assign({}, props, {
1559
- value: prevGroupEnd
1560
- })
1561
- });
1562
- /* eslint-enable react-internal/no-production-logging */
1563
- }
1564
-
1565
- if (disabledDepth < 0) {
1566
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
1567
- }
1568
- }
1569
- }
1570
-
1571
- var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1572
- var prefix;
1573
- function describeBuiltInComponentFrame(name, source, ownerFn) {
1574
- {
1575
- if (prefix === undefined) {
1576
- // Extract the VM specific prefix used by each line.
1577
- try {
1578
- throw Error();
1579
- } catch (x) {
1580
- var match = x.stack.trim().match(/\n( *(at )?)/);
1581
- prefix = match && match[1] || '';
1582
- }
1583
- } // We use the prefix to ensure our stacks line up with native stack frames.
1584
-
1585
-
1586
- return '\n' + prefix + name;
1587
- }
1588
- }
1589
- var reentry = false;
1590
- var componentFrameCache;
1591
-
1592
- {
1593
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
1594
- componentFrameCache = new PossiblyWeakMap();
1595
- }
1596
-
1597
- function describeNativeComponentFrame(fn, construct) {
1598
- // If something asked for a stack inside a fake render, it should get ignored.
1599
- if ( !fn || reentry) {
1600
- return '';
1601
- }
1602
-
1603
- {
1604
- var frame = componentFrameCache.get(fn);
1605
-
1606
- if (frame !== undefined) {
1607
- return frame;
1608
- }
1609
- }
1610
-
1611
- var control;
1612
- reentry = true;
1613
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1614
-
1615
- Error.prepareStackTrace = undefined;
1616
- var previousDispatcher;
1617
-
1618
- {
1619
- previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1620
- // for warnings.
1621
-
1622
- ReactCurrentDispatcher$1.current = null;
1623
- disableLogs();
1624
- }
1625
-
1626
- try {
1627
- // This should throw.
1628
- if (construct) {
1629
- // Something should be setting the props in the constructor.
1630
- var Fake = function () {
1631
- throw Error();
1632
- }; // $FlowFixMe
1633
-
1634
-
1635
- Object.defineProperty(Fake.prototype, 'props', {
1636
- set: function () {
1637
- // We use a throwing setter instead of frozen or non-writable props
1638
- // because that won't throw in a non-strict mode function.
1639
- throw Error();
1640
- }
1641
- });
1642
-
1643
- if (typeof Reflect === 'object' && Reflect.construct) {
1644
- // We construct a different control for this case to include any extra
1645
- // frames added by the construct call.
1646
- try {
1647
- Reflect.construct(Fake, []);
1648
- } catch (x) {
1649
- control = x;
1650
- }
1651
-
1652
- Reflect.construct(fn, [], Fake);
1653
- } else {
1654
- try {
1655
- Fake.call();
1656
- } catch (x) {
1657
- control = x;
1658
- }
1659
-
1660
- fn.call(Fake.prototype);
1661
- }
1662
- } else {
1663
- try {
1664
- throw Error();
1665
- } catch (x) {
1666
- control = x;
1667
- }
1668
-
1669
- fn();
1670
- }
1671
- } catch (sample) {
1672
- // This is inlined manually because closure doesn't do it for us.
1673
- if (sample && control && typeof sample.stack === 'string') {
1674
- // This extracts the first frame from the sample that isn't also in the control.
1675
- // Skipping one frame that we assume is the frame that calls the two.
1676
- var sampleLines = sample.stack.split('\n');
1677
- var controlLines = control.stack.split('\n');
1678
- var s = sampleLines.length - 1;
1679
- var c = controlLines.length - 1;
1680
-
1681
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1682
- // We expect at least one stack frame to be shared.
1683
- // Typically this will be the root most one. However, stack frames may be
1684
- // cut off due to maximum stack limits. In this case, one maybe cut off
1685
- // earlier than the other. We assume that the sample is longer or the same
1686
- // and there for cut off earlier. So we should find the root most frame in
1687
- // the sample somewhere in the control.
1688
- c--;
1689
- }
1690
-
1691
- for (; s >= 1 && c >= 0; s--, c--) {
1692
- // Next we find the first one that isn't the same which should be the
1693
- // frame that called our sample function and the control.
1694
- if (sampleLines[s] !== controlLines[c]) {
1695
- // In V8, the first line is describing the message but other VMs don't.
1696
- // If we're about to return the first line, and the control is also on the same
1697
- // line, that's a pretty good indicator that our sample threw at same line as
1698
- // the control. I.e. before we entered the sample frame. So we ignore this result.
1699
- // This can happen if you passed a class to function component, or non-function.
1700
- if (s !== 1 || c !== 1) {
1701
- do {
1702
- s--;
1703
- c--; // We may still have similar intermediate frames from the construct call.
1704
- // The next one that isn't the same should be our match though.
1705
-
1706
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
1707
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
1708
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
1709
-
1710
- {
1711
- if (typeof fn === 'function') {
1712
- componentFrameCache.set(fn, _frame);
1713
- }
1714
- } // Return the line we found.
1715
-
1716
-
1717
- return _frame;
1718
- }
1719
- } while (s >= 1 && c >= 0);
1720
- }
1721
-
1722
- break;
1723
- }
1724
- }
1725
- }
1726
- } finally {
1727
- reentry = false;
1728
-
1729
- {
1730
- ReactCurrentDispatcher$1.current = previousDispatcher;
1731
- reenableLogs();
1732
- }
1733
-
1734
- Error.prepareStackTrace = previousPrepareStackTrace;
1735
- } // Fallback to just using the name if we couldn't make it throw.
1736
-
1737
-
1738
- var name = fn ? fn.displayName || fn.name : '';
1739
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
1740
-
1741
- {
1742
- if (typeof fn === 'function') {
1743
- componentFrameCache.set(fn, syntheticFrame);
1744
- }
1745
- }
1746
-
1747
- return syntheticFrame;
1748
- }
1749
- function describeFunctionComponentFrame(fn, source, ownerFn) {
1750
- {
1751
- return describeNativeComponentFrame(fn, false);
1752
- }
1753
- }
1754
-
1755
- function shouldConstruct(Component) {
1756
- var prototype = Component.prototype;
1757
- return !!(prototype && prototype.isReactComponent);
1758
- }
1759
-
1760
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1761
-
1762
- if (type == null) {
1763
- return '';
1764
- }
1765
-
1766
- if (typeof type === 'function') {
1767
- {
1768
- return describeNativeComponentFrame(type, shouldConstruct(type));
1769
- }
1770
- }
1771
-
1772
- if (typeof type === 'string') {
1773
- return describeBuiltInComponentFrame(type);
1774
- }
1775
-
1776
- switch (type) {
1777
- case exports.Suspense:
1778
- return describeBuiltInComponentFrame('Suspense');
1779
-
1780
- case exports.SuspenseList:
1781
- return describeBuiltInComponentFrame('SuspenseList');
1782
- }
1783
-
1784
- if (typeof type === 'object') {
1785
- switch (type.$$typeof) {
1786
- case REACT_FORWARD_REF_TYPE:
1787
- return describeFunctionComponentFrame(type.render);
1788
-
1789
- case REACT_MEMO_TYPE:
1790
- // Memo may contain any component type so we recursively resolve it.
1791
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
1792
-
1793
- case REACT_LAZY_TYPE:
1794
- {
1795
- var lazyComponent = type;
1796
- var payload = lazyComponent._payload;
1797
- var init = lazyComponent._init;
1798
-
1799
- try {
1800
- // Lazy may contain any component type so we recursively resolve it.
1801
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
1802
- } catch (x) {}
1803
- }
1804
- }
1805
- }
1806
-
1807
- return '';
1808
- }
1809
-
1810
- var loggedTypeFailures = {};
1811
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1812
-
1813
- function setCurrentlyValidatingElement(element) {
1814
- {
1815
- if (element) {
1816
- var owner = element._owner;
1817
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1818
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1819
- } else {
1820
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1821
- }
1822
- }
1823
- }
1824
-
1825
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
1826
- {
1827
- // $FlowFixMe This is okay but Flow doesn't know it.
1828
- var has = Function.call.bind(hasOwnProperty);
1829
-
1830
- for (var typeSpecName in typeSpecs) {
1831
- if (has(typeSpecs, typeSpecName)) {
1832
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
1833
- // fail the render phase where it didn't fail before. So we log it.
1834
- // After these have been cleaned up, we'll let them throw.
1835
-
1836
- try {
1837
- // This is intentionally an invariant that gets caught. It's the same
1838
- // behavior as without this statement except with a better message.
1839
- if (typeof typeSpecs[typeSpecName] !== 'function') {
1840
- 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`.');
1841
- err.name = 'Invariant Violation';
1842
- throw err;
1843
- }
1844
-
1845
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
1846
- } catch (ex) {
1847
- error$1 = ex;
1848
- }
1849
-
1850
- if (error$1 && !(error$1 instanceof Error)) {
1851
- setCurrentlyValidatingElement(element);
1852
-
1853
- 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);
1854
-
1855
- setCurrentlyValidatingElement(null);
1856
- }
1857
-
1858
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1859
- // Only monitor this failure once because there tends to be a lot of the
1860
- // same error.
1861
- loggedTypeFailures[error$1.message] = true;
1862
- setCurrentlyValidatingElement(element);
1863
-
1864
- error('Failed %s type: %s', location, error$1.message);
1865
-
1866
- setCurrentlyValidatingElement(null);
1867
- }
1868
- }
1869
- }
1870
- }
1871
- }
1872
-
1873
- function setCurrentlyValidatingElement$1(element) {
1874
- {
1875
- if (element) {
1876
- var owner = element._owner;
1877
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1878
- setExtraStackFrame(stack);
1879
- } else {
1880
- setExtraStackFrame(null);
1881
- }
1882
- }
1883
- }
1884
-
1885
- var propTypesMisspellWarningShown;
1886
-
1887
- {
1888
- propTypesMisspellWarningShown = false;
1889
- }
1890
-
1891
- function getDeclarationErrorAddendum() {
1892
- if (ReactCurrentOwner.current) {
1893
- var name = getComponentNameFromType(ReactCurrentOwner.current.type);
1894
-
1895
- if (name) {
1896
- return '\n\nCheck the render method of `' + name + '`.';
1897
- }
1898
- }
1899
-
1900
- return '';
1901
- }
1902
-
1903
- function getSourceInfoErrorAddendum(source) {
1904
- if (source !== undefined) {
1905
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1906
- var lineNumber = source.lineNumber;
1907
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1908
- }
1909
-
1910
- return '';
1911
- }
1912
-
1913
- function getSourceInfoErrorAddendumForProps(elementProps) {
1914
- if (elementProps !== null && elementProps !== undefined) {
1915
- return getSourceInfoErrorAddendum(elementProps.__source);
1916
- }
1917
-
1918
- return '';
1919
- }
1920
- /**
1921
- * Warn if there's no key explicitly set on dynamic arrays of children or
1922
- * object keys are not valid. This allows us to keep track of children between
1923
- * updates.
1924
- */
1925
-
1926
-
1927
- var ownerHasKeyUseWarning = {};
1928
-
1929
- function getCurrentComponentErrorInfo(parentType) {
1930
- var info = getDeclarationErrorAddendum();
1931
-
1932
- if (!info) {
1933
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1934
-
1935
- if (parentName) {
1936
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1937
- }
1938
- }
1939
-
1940
- return info;
1941
- }
1942
- /**
1943
- * Warn if the element doesn't have an explicit key assigned to it.
1944
- * This element is in an array. The array could grow and shrink or be
1945
- * reordered. All children that haven't already been validated are required to
1946
- * have a "key" property assigned to it. Error statuses are cached so a warning
1947
- * will only be shown once.
1948
- *
1949
- * @internal
1950
- * @param {ReactElement} element Element that requires a key.
1951
- * @param {*} parentType element's parent's type.
1952
- */
1953
-
1954
-
1955
- function validateExplicitKey(element, parentType) {
1956
- if (!element._store || element._store.validated || element.key != null) {
1957
- return;
1958
- }
1959
-
1960
- element._store.validated = true;
1961
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1962
-
1963
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1964
- return;
1965
- }
1966
-
1967
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1968
- // property, it may be the creator of the child that's responsible for
1969
- // assigning it a key.
1970
-
1971
- var childOwner = '';
1972
-
1973
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1974
- // Give the component that originally created this child.
1975
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1976
- }
1977
-
1978
- {
1979
- setCurrentlyValidatingElement$1(element);
1980
-
1981
- 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);
1982
-
1983
- setCurrentlyValidatingElement$1(null);
1984
- }
1985
- }
1986
- /**
1987
- * Ensure that every element either is passed in a static location, in an
1988
- * array with an explicit keys property defined, or in an object literal
1989
- * with valid key property.
1990
- *
1991
- * @internal
1992
- * @param {ReactNode} node Statically passed child of any type.
1993
- * @param {*} parentType node's parent's type.
1994
- */
1995
-
1996
-
1997
- function validateChildKeys(node, parentType) {
1998
- if (typeof node !== 'object') {
1999
- return;
2000
- }
2001
-
2002
- if (isArray(node)) {
2003
- for (var i = 0; i < node.length; i++) {
2004
- var child = node[i];
2005
-
2006
- if (isValidElement(child)) {
2007
- validateExplicitKey(child, parentType);
2008
- }
2009
- }
2010
- } else if (isValidElement(node)) {
2011
- // This element was passed in a valid location.
2012
- if (node._store) {
2013
- node._store.validated = true;
2014
- }
2015
- } else if (node) {
2016
- var iteratorFn = getIteratorFn(node);
2017
-
2018
- if (typeof iteratorFn === 'function') {
2019
- // Entry iterators used to provide implicit keys,
2020
- // but now we print a separate warning for them later.
2021
- if (iteratorFn !== node.entries) {
2022
- var iterator = iteratorFn.call(node);
2023
- var step;
2024
-
2025
- while (!(step = iterator.next()).done) {
2026
- if (isValidElement(step.value)) {
2027
- validateExplicitKey(step.value, parentType);
2028
- }
2029
- }
2030
- }
2031
- }
2032
- }
2033
- }
2034
- /**
2035
- * Given an element, validate that its props follow the propTypes definition,
2036
- * provided by the type.
2037
- *
2038
- * @param {ReactElement} element
2039
- */
2040
-
2041
-
2042
- function validatePropTypes(element) {
2043
- {
2044
- var type = element.type;
2045
-
2046
- if (type === null || type === undefined || typeof type === 'string') {
2047
- return;
2048
- }
2049
-
2050
- var propTypes;
2051
-
2052
- if (typeof type === 'function') {
2053
- propTypes = type.propTypes;
2054
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2055
- // Inner props are checked in the reconciler.
2056
- type.$$typeof === REACT_MEMO_TYPE)) {
2057
- propTypes = type.propTypes;
2058
- } else {
2059
- return;
2060
- }
2061
-
2062
- if (propTypes) {
2063
- // Intentionally inside to avoid triggering lazy initializers:
2064
- var name = getComponentNameFromType(type);
2065
- checkPropTypes(propTypes, element.props, 'prop', name, element);
2066
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2067
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2068
-
2069
- var _name = getComponentNameFromType(type);
2070
-
2071
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2072
- }
2073
-
2074
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2075
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2076
- }
2077
- }
2078
- }
2079
- /**
2080
- * Given a fragment, validate that it can only be provided with fragment props
2081
- * @param {ReactElement} fragment
2082
- */
2083
-
2084
-
2085
- function validateFragmentProps(fragment) {
2086
- {
2087
- var keys = Object.keys(fragment.props);
2088
-
2089
- for (var i = 0; i < keys.length; i++) {
2090
- var key = keys[i];
2091
-
2092
- if (key !== 'children' && key !== 'key') {
2093
- setCurrentlyValidatingElement$1(fragment);
2094
-
2095
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2096
-
2097
- setCurrentlyValidatingElement$1(null);
2098
- break;
2099
- }
2100
- }
2101
-
2102
- if (fragment.ref !== null) {
2103
- setCurrentlyValidatingElement$1(fragment);
2104
-
2105
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
2106
-
2107
- setCurrentlyValidatingElement$1(null);
2108
- }
2109
- }
2110
- }
2111
- function createElementWithValidation(type, props, children) {
2112
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2113
- // succeed and there will likely be errors in render.
2114
-
2115
- if (!validType) {
2116
- var info = '';
2117
-
2118
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2119
- 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.";
2120
- }
2121
-
2122
- var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2123
-
2124
- if (sourceInfo) {
2125
- info += sourceInfo;
2126
- } else {
2127
- info += getDeclarationErrorAddendum();
2128
- }
2129
-
2130
- var typeString;
2131
-
2132
- if (type === null) {
2133
- typeString = 'null';
2134
- } else if (isArray(type)) {
2135
- typeString = 'array';
2136
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2137
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
2138
- info = ' Did you accidentally export a JSX literal instead of a component?';
2139
- } else {
2140
- typeString = typeof type;
2141
- }
2142
-
2143
- {
2144
- error('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);
2145
- }
2146
- }
2147
-
2148
- var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2149
- // TODO: Drop this when these are no longer allowed as the type argument.
2150
-
2151
- if (element == null) {
2152
- return element;
2153
- } // Skip key warning if the type isn't valid since our key validation logic
2154
- // doesn't expect a non-string/function type and can throw confusing errors.
2155
- // We don't want exception behavior to differ between dev and prod.
2156
- // (Rendering will throw with a helpful message and as soon as the type is
2157
- // fixed, the key warnings will appear.)
2158
-
2159
-
2160
- if (validType) {
2161
- for (var i = 2; i < arguments.length; i++) {
2162
- validateChildKeys(arguments[i], type);
2163
- }
2164
- }
2165
-
2166
- if (type === exports.Fragment) {
2167
- validateFragmentProps(element);
2168
- } else {
2169
- validatePropTypes(element);
2170
- }
2171
-
2172
- return element;
2173
- }
2174
- function cloneElementWithValidation(element, props, children) {
2175
- var newElement = cloneElement.apply(this, arguments);
2176
-
2177
- for (var i = 2; i < arguments.length; i++) {
2178
- validateChildKeys(arguments[i], newElement.type);
2179
- }
2180
-
2181
- validatePropTypes(newElement);
2182
- return newElement;
2183
- }
2184
-
2185
- function createMutableSource(source, getVersion) {
2186
- var mutableSource = {
2187
- _getVersion: getVersion,
2188
- _source: source,
2189
- _workInProgressVersionPrimary: null,
2190
- _workInProgressVersionSecondary: null
2191
- };
2192
-
2193
- {
2194
- mutableSource._currentPrimaryRenderer = null;
2195
- mutableSource._currentSecondaryRenderer = null; // Used to detect side effects that update a mutable source during render.
2196
- // See https://github.com/facebook/react/issues/19948
2197
-
2198
- mutableSource._currentlyRenderingFiber = null;
2199
- mutableSource._initialVersionAsOfFirstRender = null;
2200
- }
2201
-
2202
- return mutableSource;
2203
- }
2204
-
2205
- function startTransition(scope) {
2206
- var prevTransition = ReactCurrentBatchConfig.transition;
2207
- ReactCurrentBatchConfig.transition = 1;
2208
-
2209
- try {
2210
- scope();
2211
- } finally {
2212
- ReactCurrentBatchConfig.transition = prevTransition;
2213
- }
2214
- }
2215
-
2216
- var createElement$1 = createElementWithValidation ;
2217
- var cloneElement$1 = cloneElementWithValidation ;
2218
- var Children = {
2219
- map: mapChildren,
2220
- forEach: forEachChildren,
2221
- count: countChildren,
2222
- toArray: toArray,
2223
- only: onlyChild
2224
- };
2225
-
2226
- exports.Children = Children;
2227
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2228
- exports.cloneElement = cloneElement$1;
2229
- exports.createElement = createElement$1;
2230
- exports.createRef = createRef;
2231
- exports.forwardRef = forwardRef;
2232
- exports.isValidElement = isValidElement;
2233
- exports.lazy = lazy;
2234
- exports.memo = memo;
2235
- exports.startTransition = startTransition;
2236
- exports.unstable_createMutableSource = createMutableSource;
2237
- exports.unstable_getCacheForType = getCacheForType;
2238
- exports.unstable_useDeferredValue = useDeferredValue;
2239
- exports.unstable_useMutableSource = useMutableSource;
2240
- exports.unstable_useOpaqueIdentifier = useOpaqueIdentifier;
2241
- exports.useCallback = useCallback;
2242
- exports.useContext = useContext;
2243
- exports.useDebugValue = useDebugValue;
2244
- exports.useDeferredValue = useDeferredValue;
2245
- exports.useMemo = useMemo;
2246
- exports.useTransition = useTransition;
2247
- exports.version = ReactVersion;
2248
- })();
2249
- }