@smakss/react-scroll-direction 0.0.4 → 0.0.5

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.
package/dist/esm/index.js CHANGED
@@ -1,3985 +1,10 @@
1
- var react = {exports: {}};
2
-
3
- var react_production_min = {};
4
-
5
- /**
6
- * @license React
7
- * react.production.min.js
8
- *
9
- * Copyright (c) Facebook, Inc. and its affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- */
14
-
15
- var hasRequiredReact_production_min;
16
-
17
- function requireReact_production_min () {
18
- if (hasRequiredReact_production_min) return react_production_min;
19
- hasRequiredReact_production_min = 1;
20
- var l=Symbol.for("react.element"),n=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z=Symbol.iterator;function A(a){if(null===a||"object"!==typeof a)return null;a=z&&a[z]||a["@@iterator"];return "function"===typeof a?a:null}
21
- var B={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}E.prototype.isReactComponent={};
22
- E.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,b,"setState");};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}var H=G.prototype=new F;
23
- H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};
24
- function M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f;}if(a&&a.defaultProps)for(d in g=a.defaultProps,g)void 0===c[d]&&(c[d]=g[d]);return {$$typeof:l,type:a,key:k,ref:h,props:c,_owner:K.current}}
25
- function N(a,b){return {$$typeof:l,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return "object"===typeof a&&null!==a&&a.$$typeof===l}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var P=/\/+/g;function Q(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
26
- function R(a,b,e,d,c){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case l:case n:h=!0;}}if(h)return h=a,c=c(h),a=""===d?"."+Q(h,0):d,I(c)?(e="",null!=a&&(e=a.replace(P,"$&/")+"/"),R(c,b,e,"",function(a){return a})):null!=c&&(O(c)&&(c=N(c,e+(!c.key||h&&h.key===c.key?"":(""+c.key).replace(P,"$&/")+"/")+a)),b.push(c)),1;h=0;d=""===d?".":d+":";if(I(a))for(var g=0;g<a.length;g++){k=
27
- a[g];var f=d+Q(k,g);h+=R(k,b,e,f,c);}else if(f=A(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q(k,g++),h+=R(k,b,e,f,c);else if("object"===k)throw b=String(a),Error("Objects are not valid as a React child (found: "+("[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b)+"). If you meant to render a collection of children, use an array instead.");return h}
28
- function S(a,b,e){if(null==a)return a;var d=[],c=0;R(a,d,"","",function(a){return b.call(e,a,c++)});return d}function T(a){if(-1===a._status){var b=a._result;b=b();b.then(function(b){if(0===a._status||-1===a._status)a._status=1,a._result=b;},function(b){if(0===a._status||-1===a._status)a._status=2,a._result=b;});-1===a._status&&(a._status=0,a._result=b);}if(1===a._status)return a._result.default;throw a._result;}
29
- var U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};react_production_min.Children={map:S,forEach:function(a,b,e){S(a,function(){b.apply(this,arguments);},e);},count:function(a){var b=0;S(a,function(){b++;});return b},toArray:function(a){return S(a,function(a){return a})||[]},only:function(a){if(!O(a))throw Error("React.Children.only expected to receive a single React element child.");return a}};react_production_min.Component=E;react_production_min.Fragment=p;
30
- react_production_min.Profiler=r;react_production_min.PureComponent=G;react_production_min.StrictMode=q;react_production_min.Suspense=w;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W;
31
- react_production_min.cloneElement=function(a,b,e){if(null===a||void 0===a)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+a+".");var d=C({},a.props),c=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=K.current);void 0!==b.key&&(c=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)J.call(b,f)&&!L.hasOwnProperty(f)&&(d[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){g=Array(f);
32
- for(var m=0;m<f;m++)g[m]=arguments[m+2];d.children=g;}return {$$typeof:l,type:a.type,key:c,ref:k,props:d,_owner:h}};react_production_min.createContext=function(a){a={$$typeof:u,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};a.Provider={$$typeof:t,_context:a};return a.Consumer=a};react_production_min.createElement=M;react_production_min.createFactory=function(a){var b=M.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}};
33
- react_production_min.forwardRef=function(a){return {$$typeof:v,render:a}};react_production_min.isValidElement=O;react_production_min.lazy=function(a){return {$$typeof:y,_payload:{_status:-1,_result:a},_init:T}};react_production_min.memo=function(a,b){return {$$typeof:x,type:a,compare:void 0===b?null:b}};react_production_min.startTransition=function(a){var b=V.transition;V.transition={};try{a();}finally{V.transition=b;}};react_production_min.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.");};
34
- react_production_min.useCallback=function(a,b){return U.current.useCallback(a,b)};react_production_min.useContext=function(a){return U.current.useContext(a)};react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(a){return U.current.useDeferredValue(a)};react_production_min.useEffect=function(a,b){return U.current.useEffect(a,b)};react_production_min.useId=function(){return U.current.useId()};react_production_min.useImperativeHandle=function(a,b,e){return U.current.useImperativeHandle(a,b,e)};
35
- react_production_min.useInsertionEffect=function(a,b){return U.current.useInsertionEffect(a,b)};react_production_min.useLayoutEffect=function(a,b){return U.current.useLayoutEffect(a,b)};react_production_min.useMemo=function(a,b){return U.current.useMemo(a,b)};react_production_min.useReducer=function(a,b,e){return U.current.useReducer(a,b,e)};react_production_min.useRef=function(a){return U.current.useRef(a)};react_production_min.useState=function(a){return U.current.useState(a)};react_production_min.useSyncExternalStore=function(a,b,e){return U.current.useSyncExternalStore(a,b,e)};
36
- react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.2.0";
37
- return react_production_min;
38
- }
39
-
40
- var react_development = {exports: {}};
41
-
42
- /**
43
- * @license React
44
- * react.development.js
45
- *
46
- * Copyright (c) Facebook, Inc. and its affiliates.
47
- *
48
- * This source code is licensed under the MIT license found in the
49
- * LICENSE file in the root directory of this source tree.
50
- */
51
-
52
- var hasRequiredReact_development;
53
-
54
- function requireReact_development () {
55
- if (hasRequiredReact_development) return react_development.exports;
56
- hasRequiredReact_development = 1;
57
- (function (module, exports) {
58
-
59
- if (process.env.NODE_ENV !== "production") {
60
- (function() {
61
-
62
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
63
- if (
64
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
65
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
66
- 'function'
67
- ) {
68
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
69
- }
70
- var ReactVersion = '18.2.0';
71
-
72
- // ATTENTION
73
- // When adding new symbols to this file,
74
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
75
- // The Symbol used to tag the ReactElement-like types.
76
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
77
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
78
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
79
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
80
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
81
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
82
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
83
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
84
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
85
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
86
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
87
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
88
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
89
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
90
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
91
- function getIteratorFn(maybeIterable) {
92
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
93
- return null;
94
- }
95
-
96
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
97
-
98
- if (typeof maybeIterator === 'function') {
99
- return maybeIterator;
100
- }
101
-
102
- return null;
103
- }
104
-
105
- /**
106
- * Keeps track of the current dispatcher.
107
- */
108
- var ReactCurrentDispatcher = {
109
- /**
110
- * @internal
111
- * @type {ReactComponent}
112
- */
113
- current: null
114
- };
115
-
116
- /**
117
- * Keeps track of the current batch's configuration such as how long an update
118
- * should suspend for if it needs to.
119
- */
120
- var ReactCurrentBatchConfig = {
121
- transition: null
122
- };
123
-
124
- var ReactCurrentActQueue = {
125
- current: null,
126
- // Used to reproduce behavior of `batchedUpdates` in legacy mode.
127
- isBatchingLegacy: false,
128
- didScheduleLegacyUpdate: false
129
- };
130
-
131
- /**
132
- * Keeps track of the current owner.
133
- *
134
- * The current owner is the component who should own any components that are
135
- * currently being constructed.
136
- */
137
- var ReactCurrentOwner = {
138
- /**
139
- * @internal
140
- * @type {ReactComponent}
141
- */
142
- current: null
143
- };
144
-
145
- var ReactDebugCurrentFrame = {};
146
- var currentExtraStackFrame = null;
147
- function setExtraStackFrame(stack) {
148
- {
149
- currentExtraStackFrame = stack;
150
- }
151
- }
152
-
153
- {
154
- ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
155
- {
156
- currentExtraStackFrame = stack;
157
- }
158
- }; // Stack implementation injected by the current renderer.
159
-
160
-
161
- ReactDebugCurrentFrame.getCurrentStack = null;
162
-
163
- ReactDebugCurrentFrame.getStackAddendum = function () {
164
- var stack = ''; // Add an extra top frame while an element is being validated
165
-
166
- if (currentExtraStackFrame) {
167
- stack += currentExtraStackFrame;
168
- } // Delegate to the injected renderer-specific implementation
169
-
170
-
171
- var impl = ReactDebugCurrentFrame.getCurrentStack;
172
-
173
- if (impl) {
174
- stack += impl() || '';
175
- }
176
-
177
- return stack;
178
- };
179
- }
180
-
181
- // -----------------------------------------------------------------------------
182
-
183
- var enableScopeAPI = false; // Experimental Create Event Handle API.
184
- var enableCacheElement = false;
185
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
186
-
187
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
188
- // stuff. Intended to enable React core members to more easily debug scheduling
189
- // issues in DEV builds.
190
-
191
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
192
-
193
- var ReactSharedInternals = {
194
- ReactCurrentDispatcher: ReactCurrentDispatcher,
195
- ReactCurrentBatchConfig: ReactCurrentBatchConfig,
196
- ReactCurrentOwner: ReactCurrentOwner
197
- };
198
-
199
- {
200
- ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
201
- ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
202
- }
203
-
204
- // by calls to these methods by a Babel plugin.
205
- //
206
- // In PROD (or in packages without access to React internals),
207
- // they are left as they are instead.
208
-
209
- function warn(format) {
210
- {
211
- {
212
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
213
- args[_key - 1] = arguments[_key];
214
- }
215
-
216
- printWarning('warn', format, args);
217
- }
218
- }
219
- }
220
- function error(format) {
221
- {
222
- {
223
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
224
- args[_key2 - 1] = arguments[_key2];
225
- }
226
-
227
- printWarning('error', format, args);
228
- }
229
- }
230
- }
231
-
232
- function printWarning(level, format, args) {
233
- // When changing this logic, you might want to also
234
- // update consoleWithStackDev.www.js as well.
235
- {
236
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
237
- var stack = ReactDebugCurrentFrame.getStackAddendum();
238
-
239
- if (stack !== '') {
240
- format += '%s';
241
- args = args.concat([stack]);
242
- } // eslint-disable-next-line react-internal/safe-string-coercion
243
-
244
-
245
- var argsWithFormat = args.map(function (item) {
246
- return String(item);
247
- }); // Careful: RN currently depends on this prefix
248
-
249
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
250
- // breaks IE9: https://github.com/facebook/react/issues/13610
251
- // eslint-disable-next-line react-internal/no-production-logging
252
-
253
- Function.prototype.apply.call(console[level], console, argsWithFormat);
254
- }
255
- }
256
-
257
- var didWarnStateUpdateForUnmountedComponent = {};
258
-
259
- function warnNoop(publicInstance, callerName) {
260
- {
261
- var _constructor = publicInstance.constructor;
262
- var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
263
- var warningKey = componentName + "." + callerName;
264
-
265
- if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
266
- return;
267
- }
268
-
269
- 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);
270
-
271
- didWarnStateUpdateForUnmountedComponent[warningKey] = true;
272
- }
273
- }
274
- /**
275
- * This is the abstract API for an update queue.
276
- */
277
-
278
-
279
- var ReactNoopUpdateQueue = {
280
- /**
281
- * Checks whether or not this composite component is mounted.
282
- * @param {ReactClass} publicInstance The instance we want to test.
283
- * @return {boolean} True if mounted, false otherwise.
284
- * @protected
285
- * @final
286
- */
287
- isMounted: function (publicInstance) {
288
- return false;
289
- },
290
-
291
- /**
292
- * Forces an update. This should only be invoked when it is known with
293
- * certainty that we are **not** in a DOM transaction.
294
- *
295
- * You may want to call this when you know that some deeper aspect of the
296
- * component's state has changed but `setState` was not called.
297
- *
298
- * This will not invoke `shouldComponentUpdate`, but it will invoke
299
- * `componentWillUpdate` and `componentDidUpdate`.
300
- *
301
- * @param {ReactClass} publicInstance The instance that should rerender.
302
- * @param {?function} callback Called after component is updated.
303
- * @param {?string} callerName name of the calling function in the public API.
304
- * @internal
305
- */
306
- enqueueForceUpdate: function (publicInstance, callback, callerName) {
307
- warnNoop(publicInstance, 'forceUpdate');
308
- },
309
-
310
- /**
311
- * Replaces all of the state. Always use this or `setState` to mutate state.
312
- * You should treat `this.state` as immutable.
313
- *
314
- * There is no guarantee that `this.state` will be immediately updated, so
315
- * accessing `this.state` after calling this method may return the old value.
316
- *
317
- * @param {ReactClass} publicInstance The instance that should rerender.
318
- * @param {object} completeState Next state.
319
- * @param {?function} callback Called after component is updated.
320
- * @param {?string} callerName name of the calling function in the public API.
321
- * @internal
322
- */
323
- enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
324
- warnNoop(publicInstance, 'replaceState');
325
- },
326
-
327
- /**
328
- * Sets a subset of the state. This only exists because _pendingState is
329
- * internal. This provides a merging strategy that is not available to deep
330
- * properties which is confusing. TODO: Expose pendingState or don't use it
331
- * during the merge.
332
- *
333
- * @param {ReactClass} publicInstance The instance that should rerender.
334
- * @param {object} partialState Next partial state to be merged with state.
335
- * @param {?function} callback Called after component is updated.
336
- * @param {?string} Name of the calling function in the public API.
337
- * @internal
338
- */
339
- enqueueSetState: function (publicInstance, partialState, callback, callerName) {
340
- warnNoop(publicInstance, 'setState');
341
- }
342
- };
343
-
344
- var assign = Object.assign;
345
-
346
- var emptyObject = {};
347
-
348
- {
349
- Object.freeze(emptyObject);
350
- }
351
- /**
352
- * Base class helpers for the updating state of a component.
353
- */
354
-
355
-
356
- function Component(props, context, updater) {
357
- this.props = props;
358
- this.context = context; // If a component has string refs, we will assign a different object later.
359
-
360
- this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
361
- // renderer.
362
-
363
- this.updater = updater || ReactNoopUpdateQueue;
364
- }
365
-
366
- Component.prototype.isReactComponent = {};
367
- /**
368
- * Sets a subset of the state. Always use this to mutate
369
- * state. You should treat `this.state` as immutable.
370
- *
371
- * There is no guarantee that `this.state` will be immediately updated, so
372
- * accessing `this.state` after calling this method may return the old value.
373
- *
374
- * There is no guarantee that calls to `setState` will run synchronously,
375
- * as they may eventually be batched together. You can provide an optional
376
- * callback that will be executed when the call to setState is actually
377
- * completed.
378
- *
379
- * When a function is provided to setState, it will be called at some point in
380
- * the future (not synchronously). It will be called with the up to date
381
- * component arguments (state, props, context). These values can be different
382
- * from this.* because your function may be called after receiveProps but before
383
- * shouldComponentUpdate, and this new state, props, and context will not yet be
384
- * assigned to this.
385
- *
386
- * @param {object|function} partialState Next partial state or function to
387
- * produce next partial state to be merged with current state.
388
- * @param {?function} callback Called after state is updated.
389
- * @final
390
- * @protected
391
- */
392
-
393
- Component.prototype.setState = function (partialState, callback) {
394
- if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {
395
- throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
396
- }
397
-
398
- this.updater.enqueueSetState(this, partialState, callback, 'setState');
399
- };
400
- /**
401
- * Forces an update. This should only be invoked when it is known with
402
- * certainty that we are **not** in a DOM transaction.
403
- *
404
- * You may want to call this when you know that some deeper aspect of the
405
- * component's state has changed but `setState` was not called.
406
- *
407
- * This will not invoke `shouldComponentUpdate`, but it will invoke
408
- * `componentWillUpdate` and `componentDidUpdate`.
409
- *
410
- * @param {?function} callback Called after update is complete.
411
- * @final
412
- * @protected
413
- */
414
-
415
-
416
- Component.prototype.forceUpdate = function (callback) {
417
- this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
418
- };
419
- /**
420
- * Deprecated APIs. These APIs used to exist on classic React classes but since
421
- * we would like to deprecate them, we're not going to move them over to this
422
- * modern base class. Instead, we define a getter that warns if it's accessed.
423
- */
424
-
425
-
426
- {
427
- var deprecatedAPIs = {
428
- isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
429
- replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
430
- };
431
-
432
- var defineDeprecationWarning = function (methodName, info) {
433
- Object.defineProperty(Component.prototype, methodName, {
434
- get: function () {
435
- warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
436
-
437
- return undefined;
438
- }
439
- });
440
- };
441
-
442
- for (var fnName in deprecatedAPIs) {
443
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
444
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
445
- }
446
- }
447
- }
448
-
449
- function ComponentDummy() {}
450
-
451
- ComponentDummy.prototype = Component.prototype;
452
- /**
453
- * Convenience component with default shallow equality check for sCU.
454
- */
455
-
456
- function PureComponent(props, context, updater) {
457
- this.props = props;
458
- this.context = context; // If a component has string refs, we will assign a different object later.
459
-
460
- this.refs = emptyObject;
461
- this.updater = updater || ReactNoopUpdateQueue;
462
- }
463
-
464
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
465
- pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
466
-
467
- assign(pureComponentPrototype, Component.prototype);
468
- pureComponentPrototype.isPureReactComponent = true;
469
-
470
- // an immutable object with a single mutable value
471
- function createRef() {
472
- var refObject = {
473
- current: null
474
- };
475
-
476
- {
477
- Object.seal(refObject);
478
- }
479
-
480
- return refObject;
481
- }
482
-
483
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
484
-
485
- function isArray(a) {
486
- return isArrayImpl(a);
487
- }
488
-
489
- /*
490
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
491
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
492
- *
493
- * The functions in this module will throw an easier-to-understand,
494
- * easier-to-debug exception with a clear errors message message explaining the
495
- * problem. (Instead of a confusing exception thrown inside the implementation
496
- * of the `value` object).
497
- */
498
- // $FlowFixMe only called in DEV, so void return is not possible.
499
- function typeName(value) {
500
- {
501
- // toStringTag is needed for namespaced types like Temporal.Instant
502
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
503
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
504
- return type;
505
- }
506
- } // $FlowFixMe only called in DEV, so void return is not possible.
507
-
508
-
509
- function willCoercionThrow(value) {
510
- {
511
- try {
512
- testStringCoercion(value);
513
- return false;
514
- } catch (e) {
515
- return true;
516
- }
517
- }
518
- }
519
-
520
- function testStringCoercion(value) {
521
- // If you ended up here by following an exception call stack, here's what's
522
- // happened: you supplied an object or symbol value to React (as a prop, key,
523
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
524
- // coerce it to a string using `'' + value`, an exception was thrown.
525
- //
526
- // The most common types that will cause this exception are `Symbol` instances
527
- // and Temporal objects like `Temporal.Instant`. But any object that has a
528
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
529
- // exception. (Library authors do this to prevent users from using built-in
530
- // numeric operators like `+` or comparison operators like `>=` because custom
531
- // methods are needed to perform accurate arithmetic or comparison.)
532
- //
533
- // To fix the problem, coerce this object or symbol value to a string before
534
- // passing it to React. The most reliable way is usually `String(value)`.
535
- //
536
- // To find which value is throwing, check the browser or debugger console.
537
- // Before this exception was thrown, there should be `console.error` output
538
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
539
- // problem and how that type was used: key, atrribute, input value prop, etc.
540
- // In most cases, this console output also shows the component and its
541
- // ancestor components where the exception happened.
542
- //
543
- // eslint-disable-next-line react-internal/safe-string-coercion
544
- return '' + value;
545
- }
546
- function checkKeyStringCoercion(value) {
547
- {
548
- if (willCoercionThrow(value)) {
549
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
550
-
551
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
552
- }
553
- }
554
- }
555
-
556
- function getWrappedName(outerType, innerType, wrapperName) {
557
- var displayName = outerType.displayName;
558
-
559
- if (displayName) {
560
- return displayName;
561
- }
562
-
563
- var functionName = innerType.displayName || innerType.name || '';
564
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
565
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
566
-
567
-
568
- function getContextName(type) {
569
- return type.displayName || 'Context';
570
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
571
-
572
-
573
- function getComponentNameFromType(type) {
574
- if (type == null) {
575
- // Host root, text node or just invalid type.
576
- return null;
577
- }
578
-
579
- {
580
- if (typeof type.tag === 'number') {
581
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
582
- }
583
- }
584
-
585
- if (typeof type === 'function') {
586
- return type.displayName || type.name || null;
587
- }
588
-
589
- if (typeof type === 'string') {
590
- return type;
591
- }
592
-
593
- switch (type) {
594
- case REACT_FRAGMENT_TYPE:
595
- return 'Fragment';
596
-
597
- case REACT_PORTAL_TYPE:
598
- return 'Portal';
599
-
600
- case REACT_PROFILER_TYPE:
601
- return 'Profiler';
602
-
603
- case REACT_STRICT_MODE_TYPE:
604
- return 'StrictMode';
605
-
606
- case REACT_SUSPENSE_TYPE:
607
- return 'Suspense';
608
-
609
- case REACT_SUSPENSE_LIST_TYPE:
610
- return 'SuspenseList';
611
-
612
- }
613
-
614
- if (typeof type === 'object') {
615
- switch (type.$$typeof) {
616
- case REACT_CONTEXT_TYPE:
617
- var context = type;
618
- return getContextName(context) + '.Consumer';
619
-
620
- case REACT_PROVIDER_TYPE:
621
- var provider = type;
622
- return getContextName(provider._context) + '.Provider';
623
-
624
- case REACT_FORWARD_REF_TYPE:
625
- return getWrappedName(type, type.render, 'ForwardRef');
626
-
627
- case REACT_MEMO_TYPE:
628
- var outerName = type.displayName || null;
629
-
630
- if (outerName !== null) {
631
- return outerName;
632
- }
633
-
634
- return getComponentNameFromType(type.type) || 'Memo';
635
-
636
- case REACT_LAZY_TYPE:
637
- {
638
- var lazyComponent = type;
639
- var payload = lazyComponent._payload;
640
- var init = lazyComponent._init;
641
-
642
- try {
643
- return getComponentNameFromType(init(payload));
644
- } catch (x) {
645
- return null;
646
- }
647
- }
648
-
649
- // eslint-disable-next-line no-fallthrough
650
- }
651
- }
652
-
653
- return null;
654
- }
655
-
656
- var hasOwnProperty = Object.prototype.hasOwnProperty;
657
-
658
- var RESERVED_PROPS = {
659
- key: true,
660
- ref: true,
661
- __self: true,
662
- __source: true
663
- };
664
- var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
665
-
666
- {
667
- didWarnAboutStringRefs = {};
668
- }
669
-
670
- function hasValidRef(config) {
671
- {
672
- if (hasOwnProperty.call(config, 'ref')) {
673
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
674
-
675
- if (getter && getter.isReactWarning) {
676
- return false;
677
- }
678
- }
679
- }
680
-
681
- return config.ref !== undefined;
682
- }
683
-
684
- function hasValidKey(config) {
685
- {
686
- if (hasOwnProperty.call(config, 'key')) {
687
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
688
-
689
- if (getter && getter.isReactWarning) {
690
- return false;
691
- }
692
- }
693
- }
694
-
695
- return config.key !== undefined;
696
- }
697
-
698
- function defineKeyPropWarningGetter(props, displayName) {
699
- var warnAboutAccessingKey = function () {
700
- {
701
- if (!specialPropKeyWarningShown) {
702
- specialPropKeyWarningShown = true;
703
-
704
- 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);
705
- }
706
- }
707
- };
708
-
709
- warnAboutAccessingKey.isReactWarning = true;
710
- Object.defineProperty(props, 'key', {
711
- get: warnAboutAccessingKey,
712
- configurable: true
713
- });
714
- }
715
-
716
- function defineRefPropWarningGetter(props, displayName) {
717
- var warnAboutAccessingRef = function () {
718
- {
719
- if (!specialPropRefWarningShown) {
720
- specialPropRefWarningShown = true;
721
-
722
- 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);
723
- }
724
- }
725
- };
726
-
727
- warnAboutAccessingRef.isReactWarning = true;
728
- Object.defineProperty(props, 'ref', {
729
- get: warnAboutAccessingRef,
730
- configurable: true
731
- });
732
- }
733
-
734
- function warnIfStringRefCannotBeAutoConverted(config) {
735
- {
736
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
737
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
738
-
739
- if (!didWarnAboutStringRefs[componentName]) {
740
- 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);
741
-
742
- didWarnAboutStringRefs[componentName] = true;
743
- }
744
- }
745
- }
746
- }
747
- /**
748
- * Factory method to create a new React element. This no longer adheres to
749
- * the class pattern, so do not use new to call it. Also, instanceof check
750
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
751
- * if something is a React Element.
752
- *
753
- * @param {*} type
754
- * @param {*} props
755
- * @param {*} key
756
- * @param {string|object} ref
757
- * @param {*} owner
758
- * @param {*} self A *temporary* helper to detect places where `this` is
759
- * different from the `owner` when React.createElement is called, so that we
760
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
761
- * functions, and as long as `this` and owner are the same, there will be no
762
- * change in behavior.
763
- * @param {*} source An annotation object (added by a transpiler or otherwise)
764
- * indicating filename, line number, and/or other information.
765
- * @internal
766
- */
767
-
768
-
769
- var ReactElement = function (type, key, ref, self, source, owner, props) {
770
- var element = {
771
- // This tag allows us to uniquely identify this as a React Element
772
- $$typeof: REACT_ELEMENT_TYPE,
773
- // Built-in properties that belong on the element
774
- type: type,
775
- key: key,
776
- ref: ref,
777
- props: props,
778
- // Record the component responsible for creating this element.
779
- _owner: owner
780
- };
781
-
782
- {
783
- // The validation flag is currently mutative. We put it on
784
- // an external backing store so that we can freeze the whole object.
785
- // This can be replaced with a WeakMap once they are implemented in
786
- // commonly used development environments.
787
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
788
- // the validation flag non-enumerable (where possible, which should
789
- // include every environment we run tests in), so the test framework
790
- // ignores it.
791
-
792
- Object.defineProperty(element._store, 'validated', {
793
- configurable: false,
794
- enumerable: false,
795
- writable: true,
796
- value: false
797
- }); // self and source are DEV only properties.
798
-
799
- Object.defineProperty(element, '_self', {
800
- configurable: false,
801
- enumerable: false,
802
- writable: false,
803
- value: self
804
- }); // Two elements created in two different places should be considered
805
- // equal for testing purposes and therefore we hide it from enumeration.
806
-
807
- Object.defineProperty(element, '_source', {
808
- configurable: false,
809
- enumerable: false,
810
- writable: false,
811
- value: source
812
- });
813
-
814
- if (Object.freeze) {
815
- Object.freeze(element.props);
816
- Object.freeze(element);
817
- }
818
- }
819
-
820
- return element;
821
- };
822
- /**
823
- * Create and return a new ReactElement of the given type.
824
- * See https://reactjs.org/docs/react-api.html#createelement
825
- */
826
-
827
- function createElement(type, config, children) {
828
- var propName; // Reserved names are extracted
829
-
830
- var props = {};
831
- var key = null;
832
- var ref = null;
833
- var self = null;
834
- var source = null;
835
-
836
- if (config != null) {
837
- if (hasValidRef(config)) {
838
- ref = config.ref;
839
-
840
- {
841
- warnIfStringRefCannotBeAutoConverted(config);
842
- }
843
- }
844
-
845
- if (hasValidKey(config)) {
846
- {
847
- checkKeyStringCoercion(config.key);
848
- }
849
-
850
- key = '' + config.key;
851
- }
852
-
853
- self = config.__self === undefined ? null : config.__self;
854
- source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
855
-
856
- for (propName in config) {
857
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
858
- props[propName] = config[propName];
859
- }
860
- }
861
- } // Children can be more than one argument, and those are transferred onto
862
- // the newly allocated props object.
863
-
864
-
865
- var childrenLength = arguments.length - 2;
866
-
867
- if (childrenLength === 1) {
868
- props.children = children;
869
- } else if (childrenLength > 1) {
870
- var childArray = Array(childrenLength);
871
-
872
- for (var i = 0; i < childrenLength; i++) {
873
- childArray[i] = arguments[i + 2];
874
- }
875
-
876
- {
877
- if (Object.freeze) {
878
- Object.freeze(childArray);
879
- }
880
- }
881
-
882
- props.children = childArray;
883
- } // Resolve default props
884
-
885
-
886
- if (type && type.defaultProps) {
887
- var defaultProps = type.defaultProps;
888
-
889
- for (propName in defaultProps) {
890
- if (props[propName] === undefined) {
891
- props[propName] = defaultProps[propName];
892
- }
893
- }
894
- }
895
-
896
- {
897
- if (key || ref) {
898
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
899
-
900
- if (key) {
901
- defineKeyPropWarningGetter(props, displayName);
902
- }
903
-
904
- if (ref) {
905
- defineRefPropWarningGetter(props, displayName);
906
- }
907
- }
908
- }
909
-
910
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
911
- }
912
- function cloneAndReplaceKey(oldElement, newKey) {
913
- var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
914
- return newElement;
915
- }
916
- /**
917
- * Clone and return a new ReactElement using element as the starting point.
918
- * See https://reactjs.org/docs/react-api.html#cloneelement
919
- */
920
-
921
- function cloneElement(element, config, children) {
922
- if (element === null || element === undefined) {
923
- throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
924
- }
925
-
926
- var propName; // Original props are copied
927
-
928
- var props = assign({}, element.props); // Reserved names are extracted
929
-
930
- var key = element.key;
931
- var ref = element.ref; // Self is preserved since the owner is preserved.
932
-
933
- var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
934
- // transpiler, and the original source is probably a better indicator of the
935
- // true owner.
936
-
937
- var source = element._source; // Owner will be preserved, unless ref is overridden
938
-
939
- var owner = element._owner;
940
-
941
- if (config != null) {
942
- if (hasValidRef(config)) {
943
- // Silently steal the ref from the parent.
944
- ref = config.ref;
945
- owner = ReactCurrentOwner.current;
946
- }
947
-
948
- if (hasValidKey(config)) {
949
- {
950
- checkKeyStringCoercion(config.key);
951
- }
952
-
953
- key = '' + config.key;
954
- } // Remaining properties override existing props
955
-
956
-
957
- var defaultProps;
958
-
959
- if (element.type && element.type.defaultProps) {
960
- defaultProps = element.type.defaultProps;
961
- }
962
-
963
- for (propName in config) {
964
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
965
- if (config[propName] === undefined && defaultProps !== undefined) {
966
- // Resolve default props
967
- props[propName] = defaultProps[propName];
968
- } else {
969
- props[propName] = config[propName];
970
- }
971
- }
972
- }
973
- } // Children can be more than one argument, and those are transferred onto
974
- // the newly allocated props object.
975
-
976
-
977
- var childrenLength = arguments.length - 2;
978
-
979
- if (childrenLength === 1) {
980
- props.children = children;
981
- } else if (childrenLength > 1) {
982
- var childArray = Array(childrenLength);
983
-
984
- for (var i = 0; i < childrenLength; i++) {
985
- childArray[i] = arguments[i + 2];
986
- }
987
-
988
- props.children = childArray;
989
- }
990
-
991
- return ReactElement(element.type, key, ref, self, source, owner, props);
992
- }
993
- /**
994
- * Verifies the object is a ReactElement.
995
- * See https://reactjs.org/docs/react-api.html#isvalidelement
996
- * @param {?object} object
997
- * @return {boolean} True if `object` is a ReactElement.
998
- * @final
999
- */
1000
-
1001
- function isValidElement(object) {
1002
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1003
- }
1004
-
1005
- var SEPARATOR = '.';
1006
- var SUBSEPARATOR = ':';
1007
- /**
1008
- * Escape and wrap key so it is safe to use as a reactid
1009
- *
1010
- * @param {string} key to be escaped.
1011
- * @return {string} the escaped key.
1012
- */
1013
-
1014
- function escape(key) {
1015
- var escapeRegex = /[=:]/g;
1016
- var escaperLookup = {
1017
- '=': '=0',
1018
- ':': '=2'
1019
- };
1020
- var escapedString = key.replace(escapeRegex, function (match) {
1021
- return escaperLookup[match];
1022
- });
1023
- return '$' + escapedString;
1024
- }
1025
- /**
1026
- * TODO: Test that a single child and an array with one item have the same key
1027
- * pattern.
1028
- */
1029
-
1030
-
1031
- var didWarnAboutMaps = false;
1032
- var userProvidedKeyEscapeRegex = /\/+/g;
1033
-
1034
- function escapeUserProvidedKey(text) {
1035
- return text.replace(userProvidedKeyEscapeRegex, '$&/');
1036
- }
1037
- /**
1038
- * Generate a key string that identifies a element within a set.
1039
- *
1040
- * @param {*} element A element that could contain a manual key.
1041
- * @param {number} index Index that is used if a manual key is not provided.
1042
- * @return {string}
1043
- */
1044
-
1045
-
1046
- function getElementKey(element, index) {
1047
- // Do some typechecking here since we call this blindly. We want to ensure
1048
- // that we don't block potential future ES APIs.
1049
- if (typeof element === 'object' && element !== null && element.key != null) {
1050
- // Explicit key
1051
- {
1052
- checkKeyStringCoercion(element.key);
1053
- }
1054
-
1055
- return escape('' + element.key);
1056
- } // Implicit key determined by the index in the set
1057
-
1058
-
1059
- return index.toString(36);
1060
- }
1061
-
1062
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
1063
- var type = typeof children;
1064
-
1065
- if (type === 'undefined' || type === 'boolean') {
1066
- // All of the above are perceived as null.
1067
- children = null;
1068
- }
1069
-
1070
- var invokeCallback = false;
1071
-
1072
- if (children === null) {
1073
- invokeCallback = true;
1074
- } else {
1075
- switch (type) {
1076
- case 'string':
1077
- case 'number':
1078
- invokeCallback = true;
1079
- break;
1080
-
1081
- case 'object':
1082
- switch (children.$$typeof) {
1083
- case REACT_ELEMENT_TYPE:
1084
- case REACT_PORTAL_TYPE:
1085
- invokeCallback = true;
1086
- }
1087
-
1088
- }
1089
- }
1090
-
1091
- if (invokeCallback) {
1092
- var _child = children;
1093
- var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
1094
- // so that it's consistent if the number of children grows:
1095
-
1096
- var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
1097
-
1098
- if (isArray(mappedChild)) {
1099
- var escapedChildKey = '';
1100
-
1101
- if (childKey != null) {
1102
- escapedChildKey = escapeUserProvidedKey(childKey) + '/';
1103
- }
1104
-
1105
- mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
1106
- return c;
1107
- });
1108
- } else if (mappedChild != null) {
1109
- if (isValidElement(mappedChild)) {
1110
- {
1111
- // The `if` statement here prevents auto-disabling of the safe
1112
- // coercion ESLint rule, so we must manually disable it below.
1113
- // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1114
- if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
1115
- checkKeyStringCoercion(mappedChild.key);
1116
- }
1117
- }
1118
-
1119
- mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1120
- // traverseAllChildren used to do for objects as children
1121
- escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1122
- mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
1123
- // eslint-disable-next-line react-internal/safe-string-coercion
1124
- escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
1125
- }
1126
-
1127
- array.push(mappedChild);
1128
- }
1129
-
1130
- return 1;
1131
- }
1132
-
1133
- var child;
1134
- var nextName;
1135
- var subtreeCount = 0; // Count of children found in the current subtree.
1136
-
1137
- var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1138
-
1139
- if (isArray(children)) {
1140
- for (var i = 0; i < children.length; i++) {
1141
- child = children[i];
1142
- nextName = nextNamePrefix + getElementKey(child, i);
1143
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1144
- }
1145
- } else {
1146
- var iteratorFn = getIteratorFn(children);
1147
-
1148
- if (typeof iteratorFn === 'function') {
1149
- var iterableChildren = children;
1150
-
1151
- {
1152
- // Warn about using Maps as children
1153
- if (iteratorFn === iterableChildren.entries) {
1154
- if (!didWarnAboutMaps) {
1155
- warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1156
- }
1157
-
1158
- didWarnAboutMaps = true;
1159
- }
1160
- }
1161
-
1162
- var iterator = iteratorFn.call(iterableChildren);
1163
- var step;
1164
- var ii = 0;
1165
-
1166
- while (!(step = iterator.next()).done) {
1167
- child = step.value;
1168
- nextName = nextNamePrefix + getElementKey(child, ii++);
1169
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1170
- }
1171
- } else if (type === 'object') {
1172
- // eslint-disable-next-line react-internal/safe-string-coercion
1173
- var childrenString = String(children);
1174
- throw new 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.');
1175
- }
1176
- }
1177
-
1178
- return subtreeCount;
1179
- }
1180
-
1181
- /**
1182
- * Maps children that are typically specified as `props.children`.
1183
- *
1184
- * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1185
- *
1186
- * The provided mapFunction(child, index) will be called for each
1187
- * leaf child.
1188
- *
1189
- * @param {?*} children Children tree container.
1190
- * @param {function(*, int)} func The map function.
1191
- * @param {*} context Context for mapFunction.
1192
- * @return {object} Object containing the ordered map of results.
1193
- */
1194
- function mapChildren(children, func, context) {
1195
- if (children == null) {
1196
- return children;
1197
- }
1198
-
1199
- var result = [];
1200
- var count = 0;
1201
- mapIntoArray(children, result, '', '', function (child) {
1202
- return func.call(context, child, count++);
1203
- });
1204
- return result;
1205
- }
1206
- /**
1207
- * Count the number of children that are typically specified as
1208
- * `props.children`.
1209
- *
1210
- * See https://reactjs.org/docs/react-api.html#reactchildrencount
1211
- *
1212
- * @param {?*} children Children tree container.
1213
- * @return {number} The number of children.
1214
- */
1215
-
1216
-
1217
- function countChildren(children) {
1218
- var n = 0;
1219
- mapChildren(children, function () {
1220
- n++; // Don't return anything
1221
- });
1222
- return n;
1223
- }
1224
-
1225
- /**
1226
- * Iterates through children that are typically specified as `props.children`.
1227
- *
1228
- * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1229
- *
1230
- * The provided forEachFunc(child, index) will be called for each
1231
- * leaf child.
1232
- *
1233
- * @param {?*} children Children tree container.
1234
- * @param {function(*, int)} forEachFunc
1235
- * @param {*} forEachContext Context for forEachContext.
1236
- */
1237
- function forEachChildren(children, forEachFunc, forEachContext) {
1238
- mapChildren(children, function () {
1239
- forEachFunc.apply(this, arguments); // Don't return anything.
1240
- }, forEachContext);
1241
- }
1242
- /**
1243
- * Flatten a children object (typically specified as `props.children`) and
1244
- * return an array with appropriately re-keyed children.
1245
- *
1246
- * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1247
- */
1248
-
1249
-
1250
- function toArray(children) {
1251
- return mapChildren(children, function (child) {
1252
- return child;
1253
- }) || [];
1254
- }
1255
- /**
1256
- * Returns the first child in a collection of children and verifies that there
1257
- * is only one child in the collection.
1258
- *
1259
- * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1260
- *
1261
- * The current implementation of this function assumes that a single child gets
1262
- * passed without a wrapper, but the purpose of this helper function is to
1263
- * abstract away the particular structure of children.
1264
- *
1265
- * @param {?object} children Child collection structure.
1266
- * @return {ReactElement} The first and only `ReactElement` contained in the
1267
- * structure.
1268
- */
1269
-
1270
-
1271
- function onlyChild(children) {
1272
- if (!isValidElement(children)) {
1273
- throw new Error('React.Children.only expected to receive a single React element child.');
1274
- }
1275
-
1276
- return children;
1277
- }
1278
-
1279
- function createContext(defaultValue) {
1280
- // TODO: Second argument used to be an optional `calculateChangedBits`
1281
- // function. Warn to reserve for future use?
1282
- var context = {
1283
- $$typeof: REACT_CONTEXT_TYPE,
1284
- // As a workaround to support multiple concurrent renderers, we categorize
1285
- // some renderers as primary and others as secondary. We only expect
1286
- // there to be two concurrent renderers at most: React Native (primary) and
1287
- // Fabric (secondary); React DOM (primary) and React ART (secondary).
1288
- // Secondary renderers store their context values on separate fields.
1289
- _currentValue: defaultValue,
1290
- _currentValue2: defaultValue,
1291
- // Used to track how many concurrent renderers this context currently
1292
- // supports within in a single renderer. Such as parallel server rendering.
1293
- _threadCount: 0,
1294
- // These are circular
1295
- Provider: null,
1296
- Consumer: null,
1297
- // Add these to use same hidden class in VM as ServerContext
1298
- _defaultValue: null,
1299
- _globalName: null
1300
- };
1301
- context.Provider = {
1302
- $$typeof: REACT_PROVIDER_TYPE,
1303
- _context: context
1304
- };
1305
- var hasWarnedAboutUsingNestedContextConsumers = false;
1306
- var hasWarnedAboutUsingConsumerProvider = false;
1307
- var hasWarnedAboutDisplayNameOnConsumer = false;
1308
-
1309
- {
1310
- // A separate object, but proxies back to the original context object for
1311
- // backwards compatibility. It has a different $$typeof, so we can properly
1312
- // warn for the incorrect usage of Context as a Consumer.
1313
- var Consumer = {
1314
- $$typeof: REACT_CONTEXT_TYPE,
1315
- _context: context
1316
- }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1317
-
1318
- Object.defineProperties(Consumer, {
1319
- Provider: {
1320
- get: function () {
1321
- if (!hasWarnedAboutUsingConsumerProvider) {
1322
- hasWarnedAboutUsingConsumerProvider = true;
1323
-
1324
- error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
1325
- }
1326
-
1327
- return context.Provider;
1328
- },
1329
- set: function (_Provider) {
1330
- context.Provider = _Provider;
1331
- }
1332
- },
1333
- _currentValue: {
1334
- get: function () {
1335
- return context._currentValue;
1336
- },
1337
- set: function (_currentValue) {
1338
- context._currentValue = _currentValue;
1339
- }
1340
- },
1341
- _currentValue2: {
1342
- get: function () {
1343
- return context._currentValue2;
1344
- },
1345
- set: function (_currentValue2) {
1346
- context._currentValue2 = _currentValue2;
1347
- }
1348
- },
1349
- _threadCount: {
1350
- get: function () {
1351
- return context._threadCount;
1352
- },
1353
- set: function (_threadCount) {
1354
- context._threadCount = _threadCount;
1355
- }
1356
- },
1357
- Consumer: {
1358
- get: function () {
1359
- if (!hasWarnedAboutUsingNestedContextConsumers) {
1360
- hasWarnedAboutUsingNestedContextConsumers = true;
1361
-
1362
- error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
1363
- }
1364
-
1365
- return context.Consumer;
1366
- }
1367
- },
1368
- displayName: {
1369
- get: function () {
1370
- return context.displayName;
1371
- },
1372
- set: function (displayName) {
1373
- if (!hasWarnedAboutDisplayNameOnConsumer) {
1374
- warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1375
-
1376
- hasWarnedAboutDisplayNameOnConsumer = true;
1377
- }
1378
- }
1379
- }
1380
- }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1381
-
1382
- context.Consumer = Consumer;
1383
- }
1384
-
1385
- {
1386
- context._currentRenderer = null;
1387
- context._currentRenderer2 = null;
1388
- }
1389
-
1390
- return context;
1391
- }
1392
-
1393
- var Uninitialized = -1;
1394
- var Pending = 0;
1395
- var Resolved = 1;
1396
- var Rejected = 2;
1397
-
1398
- function lazyInitializer(payload) {
1399
- if (payload._status === Uninitialized) {
1400
- var ctor = payload._result;
1401
- var thenable = ctor(); // Transition to the next state.
1402
- // This might throw either because it's missing or throws. If so, we treat it
1403
- // as still uninitialized and try again next time. Which is the same as what
1404
- // happens if the ctor or any wrappers processing the ctor throws. This might
1405
- // end up fixing it if the resolution was a concurrency bug.
1406
-
1407
- thenable.then(function (moduleObject) {
1408
- if (payload._status === Pending || payload._status === Uninitialized) {
1409
- // Transition to the next state.
1410
- var resolved = payload;
1411
- resolved._status = Resolved;
1412
- resolved._result = moduleObject;
1413
- }
1414
- }, function (error) {
1415
- if (payload._status === Pending || payload._status === Uninitialized) {
1416
- // Transition to the next state.
1417
- var rejected = payload;
1418
- rejected._status = Rejected;
1419
- rejected._result = error;
1420
- }
1421
- });
1422
-
1423
- if (payload._status === Uninitialized) {
1424
- // In case, we're still uninitialized, then we're waiting for the thenable
1425
- // to resolve. Set it as pending in the meantime.
1426
- var pending = payload;
1427
- pending._status = Pending;
1428
- pending._result = thenable;
1429
- }
1430
- }
1431
-
1432
- if (payload._status === Resolved) {
1433
- var moduleObject = payload._result;
1434
-
1435
- {
1436
- if (moduleObject === undefined) {
1437
- error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1438
- 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
1439
- }
1440
- }
1441
-
1442
- {
1443
- if (!('default' in moduleObject)) {
1444
- error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1445
- 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1446
- }
1447
- }
1448
-
1449
- return moduleObject.default;
1450
- } else {
1451
- throw payload._result;
1452
- }
1453
- }
1454
-
1455
- function lazy(ctor) {
1456
- var payload = {
1457
- // We use these fields to store the result.
1458
- _status: Uninitialized,
1459
- _result: ctor
1460
- };
1461
- var lazyType = {
1462
- $$typeof: REACT_LAZY_TYPE,
1463
- _payload: payload,
1464
- _init: lazyInitializer
1465
- };
1466
-
1467
- {
1468
- // In production, this would just set it on the object.
1469
- var defaultProps;
1470
- var propTypes; // $FlowFixMe
1471
-
1472
- Object.defineProperties(lazyType, {
1473
- defaultProps: {
1474
- configurable: true,
1475
- get: function () {
1476
- return defaultProps;
1477
- },
1478
- set: function (newDefaultProps) {
1479
- 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.');
1480
-
1481
- defaultProps = newDefaultProps; // Match production behavior more closely:
1482
- // $FlowFixMe
1483
-
1484
- Object.defineProperty(lazyType, 'defaultProps', {
1485
- enumerable: true
1486
- });
1487
- }
1488
- },
1489
- propTypes: {
1490
- configurable: true,
1491
- get: function () {
1492
- return propTypes;
1493
- },
1494
- set: function (newPropTypes) {
1495
- 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.');
1496
-
1497
- propTypes = newPropTypes; // Match production behavior more closely:
1498
- // $FlowFixMe
1499
-
1500
- Object.defineProperty(lazyType, 'propTypes', {
1501
- enumerable: true
1502
- });
1503
- }
1504
- }
1505
- });
1506
- }
1507
-
1508
- return lazyType;
1509
- }
1510
-
1511
- function forwardRef(render) {
1512
- {
1513
- if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1514
- error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1515
- } else if (typeof render !== 'function') {
1516
- error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1517
- } else {
1518
- if (render.length !== 0 && render.length !== 2) {
1519
- 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.');
1520
- }
1521
- }
1522
-
1523
- if (render != null) {
1524
- if (render.defaultProps != null || render.propTypes != null) {
1525
- error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1526
- }
1527
- }
1528
- }
1529
-
1530
- var elementType = {
1531
- $$typeof: REACT_FORWARD_REF_TYPE,
1532
- render: render
1533
- };
1534
-
1535
- {
1536
- var ownName;
1537
- Object.defineProperty(elementType, 'displayName', {
1538
- enumerable: false,
1539
- configurable: true,
1540
- get: function () {
1541
- return ownName;
1542
- },
1543
- set: function (name) {
1544
- ownName = name; // The inner component shouldn't inherit this display name in most cases,
1545
- // because the component may be used elsewhere.
1546
- // But it's nice for anonymous functions to inherit the name,
1547
- // so that our component-stack generation logic will display their frames.
1548
- // An anonymous function generally suggests a pattern like:
1549
- // React.forwardRef((props, ref) => {...});
1550
- // This kind of inner function is not used elsewhere so the side effect is okay.
1551
-
1552
- if (!render.name && !render.displayName) {
1553
- render.displayName = name;
1554
- }
1555
- }
1556
- });
1557
- }
1558
-
1559
- return elementType;
1560
- }
1561
-
1562
- var REACT_MODULE_REFERENCE;
1563
-
1564
- {
1565
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
1566
- }
1567
-
1568
- function isValidElementType(type) {
1569
- if (typeof type === 'string' || typeof type === 'function') {
1570
- return true;
1571
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1572
-
1573
-
1574
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
1575
- return true;
1576
- }
1577
-
1578
- if (typeof type === 'object' && type !== null) {
1579
- 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
1580
- // types supported by any Flight configuration anywhere since
1581
- // we don't know which Flight build this will end up being used
1582
- // with.
1583
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
1584
- return true;
1585
- }
1586
- }
1587
-
1588
- return false;
1589
- }
1590
-
1591
- function memo(type, compare) {
1592
- {
1593
- if (!isValidElementType(type)) {
1594
- error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1595
- }
1596
- }
1597
-
1598
- var elementType = {
1599
- $$typeof: REACT_MEMO_TYPE,
1600
- type: type,
1601
- compare: compare === undefined ? null : compare
1602
- };
1603
-
1604
- {
1605
- var ownName;
1606
- Object.defineProperty(elementType, 'displayName', {
1607
- enumerable: false,
1608
- configurable: true,
1609
- get: function () {
1610
- return ownName;
1611
- },
1612
- set: function (name) {
1613
- ownName = name; // The inner component shouldn't inherit this display name in most cases,
1614
- // because the component may be used elsewhere.
1615
- // But it's nice for anonymous functions to inherit the name,
1616
- // so that our component-stack generation logic will display their frames.
1617
- // An anonymous function generally suggests a pattern like:
1618
- // React.memo((props) => {...});
1619
- // This kind of inner function is not used elsewhere so the side effect is okay.
1620
-
1621
- if (!type.name && !type.displayName) {
1622
- type.displayName = name;
1623
- }
1624
- }
1625
- });
1626
- }
1627
-
1628
- return elementType;
1629
- }
1630
-
1631
- function resolveDispatcher() {
1632
- var dispatcher = ReactCurrentDispatcher.current;
1633
-
1634
- {
1635
- if (dispatcher === null) {
1636
- 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.');
1637
- }
1638
- } // Will result in a null access error if accessed outside render phase. We
1639
- // intentionally don't throw our own error because this is in a hot path.
1640
- // Also helps ensure this is inlined.
1641
-
1642
-
1643
- return dispatcher;
1644
- }
1645
- function useContext(Context) {
1646
- var dispatcher = resolveDispatcher();
1647
-
1648
- {
1649
- // TODO: add a more generic warning for invalid values.
1650
- if (Context._context !== undefined) {
1651
- var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1652
- // and nobody should be using this in existing code.
1653
-
1654
- if (realContext.Consumer === Context) {
1655
- 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?');
1656
- } else if (realContext.Provider === Context) {
1657
- error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1658
- }
1659
- }
1660
- }
1661
-
1662
- return dispatcher.useContext(Context);
1663
- }
1664
- function useState(initialState) {
1665
- var dispatcher = resolveDispatcher();
1666
- return dispatcher.useState(initialState);
1667
- }
1668
- function useReducer(reducer, initialArg, init) {
1669
- var dispatcher = resolveDispatcher();
1670
- return dispatcher.useReducer(reducer, initialArg, init);
1671
- }
1672
- function useRef(initialValue) {
1673
- var dispatcher = resolveDispatcher();
1674
- return dispatcher.useRef(initialValue);
1675
- }
1676
- function useEffect(create, deps) {
1677
- var dispatcher = resolveDispatcher();
1678
- return dispatcher.useEffect(create, deps);
1679
- }
1680
- function useInsertionEffect(create, deps) {
1681
- var dispatcher = resolveDispatcher();
1682
- return dispatcher.useInsertionEffect(create, deps);
1683
- }
1684
- function useLayoutEffect(create, deps) {
1685
- var dispatcher = resolveDispatcher();
1686
- return dispatcher.useLayoutEffect(create, deps);
1687
- }
1688
- function useCallback(callback, deps) {
1689
- var dispatcher = resolveDispatcher();
1690
- return dispatcher.useCallback(callback, deps);
1691
- }
1692
- function useMemo(create, deps) {
1693
- var dispatcher = resolveDispatcher();
1694
- return dispatcher.useMemo(create, deps);
1695
- }
1696
- function useImperativeHandle(ref, create, deps) {
1697
- var dispatcher = resolveDispatcher();
1698
- return dispatcher.useImperativeHandle(ref, create, deps);
1699
- }
1700
- function useDebugValue(value, formatterFn) {
1701
- {
1702
- var dispatcher = resolveDispatcher();
1703
- return dispatcher.useDebugValue(value, formatterFn);
1704
- }
1705
- }
1706
- function useTransition() {
1707
- var dispatcher = resolveDispatcher();
1708
- return dispatcher.useTransition();
1709
- }
1710
- function useDeferredValue(value) {
1711
- var dispatcher = resolveDispatcher();
1712
- return dispatcher.useDeferredValue(value);
1713
- }
1714
- function useId() {
1715
- var dispatcher = resolveDispatcher();
1716
- return dispatcher.useId();
1717
- }
1718
- function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
1719
- var dispatcher = resolveDispatcher();
1720
- return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
1721
- }
1722
-
1723
- // Helpers to patch console.logs to avoid logging during side-effect free
1724
- // replaying on render function. This currently only patches the object
1725
- // lazily which won't cover if the log function was extracted eagerly.
1726
- // We could also eagerly patch the method.
1727
- var disabledDepth = 0;
1728
- var prevLog;
1729
- var prevInfo;
1730
- var prevWarn;
1731
- var prevError;
1732
- var prevGroup;
1733
- var prevGroupCollapsed;
1734
- var prevGroupEnd;
1735
-
1736
- function disabledLog() {}
1737
-
1738
- disabledLog.__reactDisabledLog = true;
1739
- function disableLogs() {
1740
- {
1741
- if (disabledDepth === 0) {
1742
- /* eslint-disable react-internal/no-production-logging */
1743
- prevLog = console.log;
1744
- prevInfo = console.info;
1745
- prevWarn = console.warn;
1746
- prevError = console.error;
1747
- prevGroup = console.group;
1748
- prevGroupCollapsed = console.groupCollapsed;
1749
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
1750
-
1751
- var props = {
1752
- configurable: true,
1753
- enumerable: true,
1754
- value: disabledLog,
1755
- writable: true
1756
- }; // $FlowFixMe Flow thinks console is immutable.
1757
-
1758
- Object.defineProperties(console, {
1759
- info: props,
1760
- log: props,
1761
- warn: props,
1762
- error: props,
1763
- group: props,
1764
- groupCollapsed: props,
1765
- groupEnd: props
1766
- });
1767
- /* eslint-enable react-internal/no-production-logging */
1768
- }
1769
-
1770
- disabledDepth++;
1771
- }
1772
- }
1773
- function reenableLogs() {
1774
- {
1775
- disabledDepth--;
1776
-
1777
- if (disabledDepth === 0) {
1778
- /* eslint-disable react-internal/no-production-logging */
1779
- var props = {
1780
- configurable: true,
1781
- enumerable: true,
1782
- writable: true
1783
- }; // $FlowFixMe Flow thinks console is immutable.
1784
-
1785
- Object.defineProperties(console, {
1786
- log: assign({}, props, {
1787
- value: prevLog
1788
- }),
1789
- info: assign({}, props, {
1790
- value: prevInfo
1791
- }),
1792
- warn: assign({}, props, {
1793
- value: prevWarn
1794
- }),
1795
- error: assign({}, props, {
1796
- value: prevError
1797
- }),
1798
- group: assign({}, props, {
1799
- value: prevGroup
1800
- }),
1801
- groupCollapsed: assign({}, props, {
1802
- value: prevGroupCollapsed
1803
- }),
1804
- groupEnd: assign({}, props, {
1805
- value: prevGroupEnd
1806
- })
1807
- });
1808
- /* eslint-enable react-internal/no-production-logging */
1809
- }
1810
-
1811
- if (disabledDepth < 0) {
1812
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
1813
- }
1814
- }
1815
- }
1816
-
1817
- var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1818
- var prefix;
1819
- function describeBuiltInComponentFrame(name, source, ownerFn) {
1820
- {
1821
- if (prefix === undefined) {
1822
- // Extract the VM specific prefix used by each line.
1823
- try {
1824
- throw Error();
1825
- } catch (x) {
1826
- var match = x.stack.trim().match(/\n( *(at )?)/);
1827
- prefix = match && match[1] || '';
1828
- }
1829
- } // We use the prefix to ensure our stacks line up with native stack frames.
1830
-
1831
-
1832
- return '\n' + prefix + name;
1833
- }
1834
- }
1835
- var reentry = false;
1836
- var componentFrameCache;
1837
-
1838
- {
1839
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
1840
- componentFrameCache = new PossiblyWeakMap();
1841
- }
1842
-
1843
- function describeNativeComponentFrame(fn, construct) {
1844
- // If something asked for a stack inside a fake render, it should get ignored.
1845
- if ( !fn || reentry) {
1846
- return '';
1847
- }
1848
-
1849
- {
1850
- var frame = componentFrameCache.get(fn);
1851
-
1852
- if (frame !== undefined) {
1853
- return frame;
1854
- }
1855
- }
1856
-
1857
- var control;
1858
- reentry = true;
1859
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1860
-
1861
- Error.prepareStackTrace = undefined;
1862
- var previousDispatcher;
1863
-
1864
- {
1865
- previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1866
- // for warnings.
1867
-
1868
- ReactCurrentDispatcher$1.current = null;
1869
- disableLogs();
1870
- }
1871
-
1872
- try {
1873
- // This should throw.
1874
- if (construct) {
1875
- // Something should be setting the props in the constructor.
1876
- var Fake = function () {
1877
- throw Error();
1878
- }; // $FlowFixMe
1879
-
1880
-
1881
- Object.defineProperty(Fake.prototype, 'props', {
1882
- set: function () {
1883
- // We use a throwing setter instead of frozen or non-writable props
1884
- // because that won't throw in a non-strict mode function.
1885
- throw Error();
1886
- }
1887
- });
1888
-
1889
- if (typeof Reflect === 'object' && Reflect.construct) {
1890
- // We construct a different control for this case to include any extra
1891
- // frames added by the construct call.
1892
- try {
1893
- Reflect.construct(Fake, []);
1894
- } catch (x) {
1895
- control = x;
1896
- }
1897
-
1898
- Reflect.construct(fn, [], Fake);
1899
- } else {
1900
- try {
1901
- Fake.call();
1902
- } catch (x) {
1903
- control = x;
1904
- }
1905
-
1906
- fn.call(Fake.prototype);
1907
- }
1908
- } else {
1909
- try {
1910
- throw Error();
1911
- } catch (x) {
1912
- control = x;
1913
- }
1914
-
1915
- fn();
1916
- }
1917
- } catch (sample) {
1918
- // This is inlined manually because closure doesn't do it for us.
1919
- if (sample && control && typeof sample.stack === 'string') {
1920
- // This extracts the first frame from the sample that isn't also in the control.
1921
- // Skipping one frame that we assume is the frame that calls the two.
1922
- var sampleLines = sample.stack.split('\n');
1923
- var controlLines = control.stack.split('\n');
1924
- var s = sampleLines.length - 1;
1925
- var c = controlLines.length - 1;
1926
-
1927
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1928
- // We expect at least one stack frame to be shared.
1929
- // Typically this will be the root most one. However, stack frames may be
1930
- // cut off due to maximum stack limits. In this case, one maybe cut off
1931
- // earlier than the other. We assume that the sample is longer or the same
1932
- // and there for cut off earlier. So we should find the root most frame in
1933
- // the sample somewhere in the control.
1934
- c--;
1935
- }
1936
-
1937
- for (; s >= 1 && c >= 0; s--, c--) {
1938
- // Next we find the first one that isn't the same which should be the
1939
- // frame that called our sample function and the control.
1940
- if (sampleLines[s] !== controlLines[c]) {
1941
- // In V8, the first line is describing the message but other VMs don't.
1942
- // If we're about to return the first line, and the control is also on the same
1943
- // line, that's a pretty good indicator that our sample threw at same line as
1944
- // the control. I.e. before we entered the sample frame. So we ignore this result.
1945
- // This can happen if you passed a class to function component, or non-function.
1946
- if (s !== 1 || c !== 1) {
1947
- do {
1948
- s--;
1949
- c--; // We may still have similar intermediate frames from the construct call.
1950
- // The next one that isn't the same should be our match though.
1951
-
1952
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
1953
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
1954
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
1955
- // but we have a user-provided "displayName"
1956
- // splice it in to make the stack more readable.
1957
-
1958
-
1959
- if (fn.displayName && _frame.includes('<anonymous>')) {
1960
- _frame = _frame.replace('<anonymous>', fn.displayName);
1961
- }
1962
-
1963
- {
1964
- if (typeof fn === 'function') {
1965
- componentFrameCache.set(fn, _frame);
1966
- }
1967
- } // Return the line we found.
1968
-
1969
-
1970
- return _frame;
1971
- }
1972
- } while (s >= 1 && c >= 0);
1973
- }
1974
-
1975
- break;
1976
- }
1977
- }
1978
- }
1979
- } finally {
1980
- reentry = false;
1981
-
1982
- {
1983
- ReactCurrentDispatcher$1.current = previousDispatcher;
1984
- reenableLogs();
1985
- }
1986
-
1987
- Error.prepareStackTrace = previousPrepareStackTrace;
1988
- } // Fallback to just using the name if we couldn't make it throw.
1989
-
1990
-
1991
- var name = fn ? fn.displayName || fn.name : '';
1992
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
1993
-
1994
- {
1995
- if (typeof fn === 'function') {
1996
- componentFrameCache.set(fn, syntheticFrame);
1997
- }
1998
- }
1999
-
2000
- return syntheticFrame;
2001
- }
2002
- function describeFunctionComponentFrame(fn, source, ownerFn) {
2003
- {
2004
- return describeNativeComponentFrame(fn, false);
2005
- }
2006
- }
2007
-
2008
- function shouldConstruct(Component) {
2009
- var prototype = Component.prototype;
2010
- return !!(prototype && prototype.isReactComponent);
2011
- }
2012
-
2013
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
2014
-
2015
- if (type == null) {
2016
- return '';
2017
- }
2018
-
2019
- if (typeof type === 'function') {
2020
- {
2021
- return describeNativeComponentFrame(type, shouldConstruct(type));
2022
- }
2023
- }
2024
-
2025
- if (typeof type === 'string') {
2026
- return describeBuiltInComponentFrame(type);
2027
- }
2028
-
2029
- switch (type) {
2030
- case REACT_SUSPENSE_TYPE:
2031
- return describeBuiltInComponentFrame('Suspense');
2032
-
2033
- case REACT_SUSPENSE_LIST_TYPE:
2034
- return describeBuiltInComponentFrame('SuspenseList');
2035
- }
2036
-
2037
- if (typeof type === 'object') {
2038
- switch (type.$$typeof) {
2039
- case REACT_FORWARD_REF_TYPE:
2040
- return describeFunctionComponentFrame(type.render);
2041
-
2042
- case REACT_MEMO_TYPE:
2043
- // Memo may contain any component type so we recursively resolve it.
2044
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
2045
-
2046
- case REACT_LAZY_TYPE:
2047
- {
2048
- var lazyComponent = type;
2049
- var payload = lazyComponent._payload;
2050
- var init = lazyComponent._init;
2051
-
2052
- try {
2053
- // Lazy may contain any component type so we recursively resolve it.
2054
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2055
- } catch (x) {}
2056
- }
2057
- }
2058
- }
2059
-
2060
- return '';
2061
- }
2062
-
2063
- var loggedTypeFailures = {};
2064
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2065
-
2066
- function setCurrentlyValidatingElement(element) {
2067
- {
2068
- if (element) {
2069
- var owner = element._owner;
2070
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2071
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
2072
- } else {
2073
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
2074
- }
2075
- }
2076
- }
2077
-
2078
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
2079
- {
2080
- // $FlowFixMe This is okay but Flow doesn't know it.
2081
- var has = Function.call.bind(hasOwnProperty);
2082
-
2083
- for (var typeSpecName in typeSpecs) {
2084
- if (has(typeSpecs, typeSpecName)) {
2085
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
2086
- // fail the render phase where it didn't fail before. So we log it.
2087
- // After these have been cleaned up, we'll let them throw.
2088
-
2089
- try {
2090
- // This is intentionally an invariant that gets caught. It's the same
2091
- // behavior as without this statement except with a better message.
2092
- if (typeof typeSpecs[typeSpecName] !== 'function') {
2093
- // eslint-disable-next-line react-internal/prod-error-codes
2094
- 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`.');
2095
- err.name = 'Invariant Violation';
2096
- throw err;
2097
- }
2098
-
2099
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
2100
- } catch (ex) {
2101
- error$1 = ex;
2102
- }
2103
-
2104
- if (error$1 && !(error$1 instanceof Error)) {
2105
- setCurrentlyValidatingElement(element);
2106
-
2107
- 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);
2108
-
2109
- setCurrentlyValidatingElement(null);
2110
- }
2111
-
2112
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
2113
- // Only monitor this failure once because there tends to be a lot of the
2114
- // same error.
2115
- loggedTypeFailures[error$1.message] = true;
2116
- setCurrentlyValidatingElement(element);
2117
-
2118
- error('Failed %s type: %s', location, error$1.message);
2119
-
2120
- setCurrentlyValidatingElement(null);
2121
- }
2122
- }
2123
- }
2124
- }
2125
- }
2126
-
2127
- function setCurrentlyValidatingElement$1(element) {
2128
- {
2129
- if (element) {
2130
- var owner = element._owner;
2131
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2132
- setExtraStackFrame(stack);
2133
- } else {
2134
- setExtraStackFrame(null);
2135
- }
2136
- }
2137
- }
2138
-
2139
- var propTypesMisspellWarningShown;
2140
-
2141
- {
2142
- propTypesMisspellWarningShown = false;
2143
- }
2144
-
2145
- function getDeclarationErrorAddendum() {
2146
- if (ReactCurrentOwner.current) {
2147
- var name = getComponentNameFromType(ReactCurrentOwner.current.type);
2148
-
2149
- if (name) {
2150
- return '\n\nCheck the render method of `' + name + '`.';
2151
- }
2152
- }
2153
-
2154
- return '';
2155
- }
2156
-
2157
- function getSourceInfoErrorAddendum(source) {
2158
- if (source !== undefined) {
2159
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2160
- var lineNumber = source.lineNumber;
2161
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2162
- }
2163
-
2164
- return '';
2165
- }
2166
-
2167
- function getSourceInfoErrorAddendumForProps(elementProps) {
2168
- if (elementProps !== null && elementProps !== undefined) {
2169
- return getSourceInfoErrorAddendum(elementProps.__source);
2170
- }
2171
-
2172
- return '';
2173
- }
2174
- /**
2175
- * Warn if there's no key explicitly set on dynamic arrays of children or
2176
- * object keys are not valid. This allows us to keep track of children between
2177
- * updates.
2178
- */
2179
-
2180
-
2181
- var ownerHasKeyUseWarning = {};
2182
-
2183
- function getCurrentComponentErrorInfo(parentType) {
2184
- var info = getDeclarationErrorAddendum();
2185
-
2186
- if (!info) {
2187
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2188
-
2189
- if (parentName) {
2190
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2191
- }
2192
- }
2193
-
2194
- return info;
2195
- }
2196
- /**
2197
- * Warn if the element doesn't have an explicit key assigned to it.
2198
- * This element is in an array. The array could grow and shrink or be
2199
- * reordered. All children that haven't already been validated are required to
2200
- * have a "key" property assigned to it. Error statuses are cached so a warning
2201
- * will only be shown once.
2202
- *
2203
- * @internal
2204
- * @param {ReactElement} element Element that requires a key.
2205
- * @param {*} parentType element's parent's type.
2206
- */
2207
-
2208
-
2209
- function validateExplicitKey(element, parentType) {
2210
- if (!element._store || element._store.validated || element.key != null) {
2211
- return;
2212
- }
2213
-
2214
- element._store.validated = true;
2215
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2216
-
2217
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2218
- return;
2219
- }
2220
-
2221
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2222
- // property, it may be the creator of the child that's responsible for
2223
- // assigning it a key.
2224
-
2225
- var childOwner = '';
2226
-
2227
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2228
- // Give the component that originally created this child.
2229
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
2230
- }
2231
-
2232
- {
2233
- setCurrentlyValidatingElement$1(element);
2234
-
2235
- 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);
2236
-
2237
- setCurrentlyValidatingElement$1(null);
2238
- }
2239
- }
2240
- /**
2241
- * Ensure that every element either is passed in a static location, in an
2242
- * array with an explicit keys property defined, or in an object literal
2243
- * with valid key property.
2244
- *
2245
- * @internal
2246
- * @param {ReactNode} node Statically passed child of any type.
2247
- * @param {*} parentType node's parent's type.
2248
- */
2249
-
2250
-
2251
- function validateChildKeys(node, parentType) {
2252
- if (typeof node !== 'object') {
2253
- return;
2254
- }
2255
-
2256
- if (isArray(node)) {
2257
- for (var i = 0; i < node.length; i++) {
2258
- var child = node[i];
2259
-
2260
- if (isValidElement(child)) {
2261
- validateExplicitKey(child, parentType);
2262
- }
2263
- }
2264
- } else if (isValidElement(node)) {
2265
- // This element was passed in a valid location.
2266
- if (node._store) {
2267
- node._store.validated = true;
2268
- }
2269
- } else if (node) {
2270
- var iteratorFn = getIteratorFn(node);
2271
-
2272
- if (typeof iteratorFn === 'function') {
2273
- // Entry iterators used to provide implicit keys,
2274
- // but now we print a separate warning for them later.
2275
- if (iteratorFn !== node.entries) {
2276
- var iterator = iteratorFn.call(node);
2277
- var step;
2278
-
2279
- while (!(step = iterator.next()).done) {
2280
- if (isValidElement(step.value)) {
2281
- validateExplicitKey(step.value, parentType);
2282
- }
2283
- }
2284
- }
2285
- }
2286
- }
2287
- }
2288
- /**
2289
- * Given an element, validate that its props follow the propTypes definition,
2290
- * provided by the type.
2291
- *
2292
- * @param {ReactElement} element
2293
- */
2294
-
2295
-
2296
- function validatePropTypes(element) {
2297
- {
2298
- var type = element.type;
2299
-
2300
- if (type === null || type === undefined || typeof type === 'string') {
2301
- return;
2302
- }
2303
-
2304
- var propTypes;
2305
-
2306
- if (typeof type === 'function') {
2307
- propTypes = type.propTypes;
2308
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2309
- // Inner props are checked in the reconciler.
2310
- type.$$typeof === REACT_MEMO_TYPE)) {
2311
- propTypes = type.propTypes;
2312
- } else {
2313
- return;
2314
- }
2315
-
2316
- if (propTypes) {
2317
- // Intentionally inside to avoid triggering lazy initializers:
2318
- var name = getComponentNameFromType(type);
2319
- checkPropTypes(propTypes, element.props, 'prop', name, element);
2320
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2321
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2322
-
2323
- var _name = getComponentNameFromType(type);
2324
-
2325
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2326
- }
2327
-
2328
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2329
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2330
- }
2331
- }
2332
- }
2333
- /**
2334
- * Given a fragment, validate that it can only be provided with fragment props
2335
- * @param {ReactElement} fragment
2336
- */
2337
-
2338
-
2339
- function validateFragmentProps(fragment) {
2340
- {
2341
- var keys = Object.keys(fragment.props);
2342
-
2343
- for (var i = 0; i < keys.length; i++) {
2344
- var key = keys[i];
2345
-
2346
- if (key !== 'children' && key !== 'key') {
2347
- setCurrentlyValidatingElement$1(fragment);
2348
-
2349
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2350
-
2351
- setCurrentlyValidatingElement$1(null);
2352
- break;
2353
- }
2354
- }
2355
-
2356
- if (fragment.ref !== null) {
2357
- setCurrentlyValidatingElement$1(fragment);
2358
-
2359
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
2360
-
2361
- setCurrentlyValidatingElement$1(null);
2362
- }
2363
- }
2364
- }
2365
- function createElementWithValidation(type, props, children) {
2366
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2367
- // succeed and there will likely be errors in render.
2368
-
2369
- if (!validType) {
2370
- var info = '';
2371
-
2372
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2373
- 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.";
2374
- }
2375
-
2376
- var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2377
-
2378
- if (sourceInfo) {
2379
- info += sourceInfo;
2380
- } else {
2381
- info += getDeclarationErrorAddendum();
2382
- }
2383
-
2384
- var typeString;
2385
-
2386
- if (type === null) {
2387
- typeString = 'null';
2388
- } else if (isArray(type)) {
2389
- typeString = 'array';
2390
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2391
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
2392
- info = ' Did you accidentally export a JSX literal instead of a component?';
2393
- } else {
2394
- typeString = typeof type;
2395
- }
2396
-
2397
- {
2398
- 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);
2399
- }
2400
- }
2401
-
2402
- var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2403
- // TODO: Drop this when these are no longer allowed as the type argument.
2404
-
2405
- if (element == null) {
2406
- return element;
2407
- } // Skip key warning if the type isn't valid since our key validation logic
2408
- // doesn't expect a non-string/function type and can throw confusing errors.
2409
- // We don't want exception behavior to differ between dev and prod.
2410
- // (Rendering will throw with a helpful message and as soon as the type is
2411
- // fixed, the key warnings will appear.)
2412
-
2413
-
2414
- if (validType) {
2415
- for (var i = 2; i < arguments.length; i++) {
2416
- validateChildKeys(arguments[i], type);
2417
- }
2418
- }
2419
-
2420
- if (type === REACT_FRAGMENT_TYPE) {
2421
- validateFragmentProps(element);
2422
- } else {
2423
- validatePropTypes(element);
2424
- }
2425
-
2426
- return element;
2427
- }
2428
- var didWarnAboutDeprecatedCreateFactory = false;
2429
- function createFactoryWithValidation(type) {
2430
- var validatedFactory = createElementWithValidation.bind(null, type);
2431
- validatedFactory.type = type;
2432
-
2433
- {
2434
- if (!didWarnAboutDeprecatedCreateFactory) {
2435
- didWarnAboutDeprecatedCreateFactory = true;
2436
-
2437
- warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
2438
- } // Legacy hook: remove it
2439
-
2440
-
2441
- Object.defineProperty(validatedFactory, 'type', {
2442
- enumerable: false,
2443
- get: function () {
2444
- warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2445
-
2446
- Object.defineProperty(this, 'type', {
2447
- value: type
2448
- });
2449
- return type;
2450
- }
2451
- });
2452
- }
2453
-
2454
- return validatedFactory;
2455
- }
2456
- function cloneElementWithValidation(element, props, children) {
2457
- var newElement = cloneElement.apply(this, arguments);
2458
-
2459
- for (var i = 2; i < arguments.length; i++) {
2460
- validateChildKeys(arguments[i], newElement.type);
2461
- }
2462
-
2463
- validatePropTypes(newElement);
2464
- return newElement;
2465
- }
2466
-
2467
- function startTransition(scope, options) {
2468
- var prevTransition = ReactCurrentBatchConfig.transition;
2469
- ReactCurrentBatchConfig.transition = {};
2470
- var currentTransition = ReactCurrentBatchConfig.transition;
2471
-
2472
- {
2473
- ReactCurrentBatchConfig.transition._updatedFibers = new Set();
2474
- }
2475
-
2476
- try {
2477
- scope();
2478
- } finally {
2479
- ReactCurrentBatchConfig.transition = prevTransition;
2480
-
2481
- {
2482
- if (prevTransition === null && currentTransition._updatedFibers) {
2483
- var updatedFibersCount = currentTransition._updatedFibers.size;
2484
-
2485
- if (updatedFibersCount > 10) {
2486
- warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.');
2487
- }
2488
-
2489
- currentTransition._updatedFibers.clear();
2490
- }
2491
- }
2492
- }
2493
- }
2494
-
2495
- var didWarnAboutMessageChannel = false;
2496
- var enqueueTaskImpl = null;
2497
- function enqueueTask(task) {
2498
- if (enqueueTaskImpl === null) {
2499
- try {
2500
- // read require off the module object to get around the bundlers.
2501
- // we don't want them to detect a require and bundle a Node polyfill.
2502
- var requireString = ('require' + Math.random()).slice(0, 7);
2503
- var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
2504
- // version of setImmediate, bypassing fake timers if any.
2505
-
2506
- enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
2507
- } catch (_err) {
2508
- // we're in a browser
2509
- // we can't use regular timers because they may still be faked
2510
- // so we try MessageChannel+postMessage instead
2511
- enqueueTaskImpl = function (callback) {
2512
- {
2513
- if (didWarnAboutMessageChannel === false) {
2514
- didWarnAboutMessageChannel = true;
2515
-
2516
- if (typeof MessageChannel === 'undefined') {
2517
- error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
2518
- }
2519
- }
2520
- }
2521
-
2522
- var channel = new MessageChannel();
2523
- channel.port1.onmessage = callback;
2524
- channel.port2.postMessage(undefined);
2525
- };
2526
- }
2527
- }
2528
-
2529
- return enqueueTaskImpl(task);
2530
- }
2531
-
2532
- var actScopeDepth = 0;
2533
- var didWarnNoAwaitAct = false;
2534
- function act(callback) {
2535
- {
2536
- // `act` calls can be nested, so we track the depth. This represents the
2537
- // number of `act` scopes on the stack.
2538
- var prevActScopeDepth = actScopeDepth;
2539
- actScopeDepth++;
2540
-
2541
- if (ReactCurrentActQueue.current === null) {
2542
- // This is the outermost `act` scope. Initialize the queue. The reconciler
2543
- // will detect the queue and use it instead of Scheduler.
2544
- ReactCurrentActQueue.current = [];
2545
- }
2546
-
2547
- var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
2548
- var result;
2549
-
2550
- try {
2551
- // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
2552
- // set to `true` while the given callback is executed, not for updates
2553
- // triggered during an async event, because this is how the legacy
2554
- // implementation of `act` behaved.
2555
- ReactCurrentActQueue.isBatchingLegacy = true;
2556
- result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
2557
- // which flushed updates immediately after the scope function exits, even
2558
- // if it's an async function.
2559
-
2560
- if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
2561
- var queue = ReactCurrentActQueue.current;
2562
-
2563
- if (queue !== null) {
2564
- ReactCurrentActQueue.didScheduleLegacyUpdate = false;
2565
- flushActQueue(queue);
2566
- }
2567
- }
2568
- } catch (error) {
2569
- popActScope(prevActScopeDepth);
2570
- throw error;
2571
- } finally {
2572
- ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
2573
- }
2574
-
2575
- if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
2576
- var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
2577
- // for it to resolve before exiting the current scope.
2578
-
2579
- var wasAwaited = false;
2580
- var thenable = {
2581
- then: function (resolve, reject) {
2582
- wasAwaited = true;
2583
- thenableResult.then(function (returnValue) {
2584
- popActScope(prevActScopeDepth);
2585
-
2586
- if (actScopeDepth === 0) {
2587
- // We've exited the outermost act scope. Recursively flush the
2588
- // queue until there's no remaining work.
2589
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2590
- } else {
2591
- resolve(returnValue);
2592
- }
2593
- }, function (error) {
2594
- // The callback threw an error.
2595
- popActScope(prevActScopeDepth);
2596
- reject(error);
2597
- });
2598
- }
2599
- };
2600
-
2601
- {
2602
- if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
2603
- // eslint-disable-next-line no-undef
2604
- Promise.resolve().then(function () {}).then(function () {
2605
- if (!wasAwaited) {
2606
- didWarnNoAwaitAct = true;
2607
-
2608
- error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);');
2609
- }
2610
- });
2611
- }
2612
- }
2613
-
2614
- return thenable;
2615
- } else {
2616
- var returnValue = result; // The callback is not an async function. Exit the current scope
2617
- // immediately, without awaiting.
2618
-
2619
- popActScope(prevActScopeDepth);
2620
-
2621
- if (actScopeDepth === 0) {
2622
- // Exiting the outermost act scope. Flush the queue.
2623
- var _queue = ReactCurrentActQueue.current;
2624
-
2625
- if (_queue !== null) {
2626
- flushActQueue(_queue);
2627
- ReactCurrentActQueue.current = null;
2628
- } // Return a thenable. If the user awaits it, we'll flush again in
2629
- // case additional work was scheduled by a microtask.
2630
-
2631
-
2632
- var _thenable = {
2633
- then: function (resolve, reject) {
2634
- // Confirm we haven't re-entered another `act` scope, in case
2635
- // the user does something weird like await the thenable
2636
- // multiple times.
2637
- if (ReactCurrentActQueue.current === null) {
2638
- // Recursively flush the queue until there's no remaining work.
2639
- ReactCurrentActQueue.current = [];
2640
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2641
- } else {
2642
- resolve(returnValue);
2643
- }
2644
- }
2645
- };
2646
- return _thenable;
2647
- } else {
2648
- // Since we're inside a nested `act` scope, the returned thenable
2649
- // immediately resolves. The outer scope will flush the queue.
2650
- var _thenable2 = {
2651
- then: function (resolve, reject) {
2652
- resolve(returnValue);
2653
- }
2654
- };
2655
- return _thenable2;
2656
- }
2657
- }
2658
- }
2659
- }
2660
-
2661
- function popActScope(prevActScopeDepth) {
2662
- {
2663
- if (prevActScopeDepth !== actScopeDepth - 1) {
2664
- error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
2665
- }
2666
-
2667
- actScopeDepth = prevActScopeDepth;
2668
- }
2669
- }
2670
-
2671
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
2672
- {
2673
- var queue = ReactCurrentActQueue.current;
2674
-
2675
- if (queue !== null) {
2676
- try {
2677
- flushActQueue(queue);
2678
- enqueueTask(function () {
2679
- if (queue.length === 0) {
2680
- // No additional work was scheduled. Finish.
2681
- ReactCurrentActQueue.current = null;
2682
- resolve(returnValue);
2683
- } else {
2684
- // Keep flushing work until there's none left.
2685
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2686
- }
2687
- });
2688
- } catch (error) {
2689
- reject(error);
2690
- }
2691
- } else {
2692
- resolve(returnValue);
2693
- }
2694
- }
2695
- }
2696
-
2697
- var isFlushing = false;
2698
-
2699
- function flushActQueue(queue) {
2700
- {
2701
- if (!isFlushing) {
2702
- // Prevent re-entrance.
2703
- isFlushing = true;
2704
- var i = 0;
2705
-
2706
- try {
2707
- for (; i < queue.length; i++) {
2708
- var callback = queue[i];
2709
-
2710
- do {
2711
- callback = callback(true);
2712
- } while (callback !== null);
2713
- }
2714
-
2715
- queue.length = 0;
2716
- } catch (error) {
2717
- // If something throws, leave the remaining callbacks on the queue.
2718
- queue = queue.slice(i + 1);
2719
- throw error;
2720
- } finally {
2721
- isFlushing = false;
2722
- }
2723
- }
2724
- }
2725
- }
2726
-
2727
- var createElement$1 = createElementWithValidation ;
2728
- var cloneElement$1 = cloneElementWithValidation ;
2729
- var createFactory = createFactoryWithValidation ;
2730
- var Children = {
2731
- map: mapChildren,
2732
- forEach: forEachChildren,
2733
- count: countChildren,
2734
- toArray: toArray,
2735
- only: onlyChild
2736
- };
2737
-
2738
- exports.Children = Children;
2739
- exports.Component = Component;
2740
- exports.Fragment = REACT_FRAGMENT_TYPE;
2741
- exports.Profiler = REACT_PROFILER_TYPE;
2742
- exports.PureComponent = PureComponent;
2743
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
2744
- exports.Suspense = REACT_SUSPENSE_TYPE;
2745
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2746
- exports.cloneElement = cloneElement$1;
2747
- exports.createContext = createContext;
2748
- exports.createElement = createElement$1;
2749
- exports.createFactory = createFactory;
2750
- exports.createRef = createRef;
2751
- exports.forwardRef = forwardRef;
2752
- exports.isValidElement = isValidElement;
2753
- exports.lazy = lazy;
2754
- exports.memo = memo;
2755
- exports.startTransition = startTransition;
2756
- exports.unstable_act = act;
2757
- exports.useCallback = useCallback;
2758
- exports.useContext = useContext;
2759
- exports.useDebugValue = useDebugValue;
2760
- exports.useDeferredValue = useDeferredValue;
2761
- exports.useEffect = useEffect;
2762
- exports.useId = useId;
2763
- exports.useImperativeHandle = useImperativeHandle;
2764
- exports.useInsertionEffect = useInsertionEffect;
2765
- exports.useLayoutEffect = useLayoutEffect;
2766
- exports.useMemo = useMemo;
2767
- exports.useReducer = useReducer;
2768
- exports.useRef = useRef;
2769
- exports.useState = useState;
2770
- exports.useSyncExternalStore = useSyncExternalStore;
2771
- exports.useTransition = useTransition;
2772
- exports.version = ReactVersion;
2773
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
2774
- if (
2775
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
2776
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
2777
- 'function'
2778
- ) {
2779
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2780
- }
2781
-
2782
- })();
2783
- }
2784
- } (react_development, react_development.exports));
2785
- return react_development.exports;
2786
- }
2787
-
2788
- (function (module) {
2789
-
2790
- if (process.env.NODE_ENV === 'production') {
2791
- module.exports = requireReact_production_min();
2792
- } else {
2793
- module.exports = requireReact_development();
2794
- }
2795
- } (react));
2796
-
2797
- var propTypes = {exports: {}};
2798
-
2799
- var reactIs = {exports: {}};
2800
-
2801
- var reactIs_production_min = {};
2802
-
2803
- /** @license React v16.13.1
2804
- * react-is.production.min.js
2805
- *
2806
- * Copyright (c) Facebook, Inc. and its affiliates.
2807
- *
2808
- * This source code is licensed under the MIT license found in the
2809
- * LICENSE file in the root directory of this source tree.
2810
- */
2811
-
2812
- var hasRequiredReactIs_production_min;
2813
-
2814
- function requireReactIs_production_min () {
2815
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
2816
- hasRequiredReactIs_production_min = 1;
2817
- var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
2818
- Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
2819
- function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
2820
- reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
2821
- reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
2822
- reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
2823
- return reactIs_production_min;
2824
- }
2825
-
2826
- var reactIs_development = {};
2827
-
2828
- /** @license React v16.13.1
2829
- * react-is.development.js
2830
- *
2831
- * Copyright (c) Facebook, Inc. and its affiliates.
2832
- *
2833
- * This source code is licensed under the MIT license found in the
2834
- * LICENSE file in the root directory of this source tree.
2835
- */
2836
-
2837
- var hasRequiredReactIs_development;
2838
-
2839
- function requireReactIs_development () {
2840
- if (hasRequiredReactIs_development) return reactIs_development;
2841
- hasRequiredReactIs_development = 1;
2842
-
2843
-
2844
-
2845
- if (process.env.NODE_ENV !== "production") {
2846
- (function() {
2847
-
2848
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
2849
- // nor polyfill, then a plain number is used for performance.
2850
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
2851
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
2852
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
2853
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
2854
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
2855
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
2856
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
2857
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
2858
- // (unstable) APIs that have been removed. Can we remove the symbols?
2859
-
2860
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
2861
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
2862
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
2863
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
2864
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
2865
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
2866
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
2867
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
2868
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
2869
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
2870
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
2871
-
2872
- function isValidElementType(type) {
2873
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2874
- 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);
2875
- }
2876
-
2877
- function typeOf(object) {
2878
- if (typeof object === 'object' && object !== null) {
2879
- var $$typeof = object.$$typeof;
2880
-
2881
- switch ($$typeof) {
2882
- case REACT_ELEMENT_TYPE:
2883
- var type = object.type;
2884
-
2885
- switch (type) {
2886
- case REACT_ASYNC_MODE_TYPE:
2887
- case REACT_CONCURRENT_MODE_TYPE:
2888
- case REACT_FRAGMENT_TYPE:
2889
- case REACT_PROFILER_TYPE:
2890
- case REACT_STRICT_MODE_TYPE:
2891
- case REACT_SUSPENSE_TYPE:
2892
- return type;
2893
-
2894
- default:
2895
- var $$typeofType = type && type.$$typeof;
2896
-
2897
- switch ($$typeofType) {
2898
- case REACT_CONTEXT_TYPE:
2899
- case REACT_FORWARD_REF_TYPE:
2900
- case REACT_LAZY_TYPE:
2901
- case REACT_MEMO_TYPE:
2902
- case REACT_PROVIDER_TYPE:
2903
- return $$typeofType;
2904
-
2905
- default:
2906
- return $$typeof;
2907
- }
2908
-
2909
- }
2910
-
2911
- case REACT_PORTAL_TYPE:
2912
- return $$typeof;
2913
- }
2914
- }
2915
-
2916
- return undefined;
2917
- } // AsyncMode is deprecated along with isAsyncMode
2918
-
2919
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
2920
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2921
- var ContextConsumer = REACT_CONTEXT_TYPE;
2922
- var ContextProvider = REACT_PROVIDER_TYPE;
2923
- var Element = REACT_ELEMENT_TYPE;
2924
- var ForwardRef = REACT_FORWARD_REF_TYPE;
2925
- var Fragment = REACT_FRAGMENT_TYPE;
2926
- var Lazy = REACT_LAZY_TYPE;
2927
- var Memo = REACT_MEMO_TYPE;
2928
- var Portal = REACT_PORTAL_TYPE;
2929
- var Profiler = REACT_PROFILER_TYPE;
2930
- var StrictMode = REACT_STRICT_MODE_TYPE;
2931
- var Suspense = REACT_SUSPENSE_TYPE;
2932
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
2933
-
2934
- function isAsyncMode(object) {
2935
- {
2936
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
2937
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
2938
-
2939
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
2940
- }
2941
- }
2942
-
2943
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
2944
- }
2945
- function isConcurrentMode(object) {
2946
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
2947
- }
2948
- function isContextConsumer(object) {
2949
- return typeOf(object) === REACT_CONTEXT_TYPE;
2950
- }
2951
- function isContextProvider(object) {
2952
- return typeOf(object) === REACT_PROVIDER_TYPE;
2953
- }
2954
- function isElement(object) {
2955
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2956
- }
2957
- function isForwardRef(object) {
2958
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
2959
- }
2960
- function isFragment(object) {
2961
- return typeOf(object) === REACT_FRAGMENT_TYPE;
2962
- }
2963
- function isLazy(object) {
2964
- return typeOf(object) === REACT_LAZY_TYPE;
2965
- }
2966
- function isMemo(object) {
2967
- return typeOf(object) === REACT_MEMO_TYPE;
2968
- }
2969
- function isPortal(object) {
2970
- return typeOf(object) === REACT_PORTAL_TYPE;
2971
- }
2972
- function isProfiler(object) {
2973
- return typeOf(object) === REACT_PROFILER_TYPE;
2974
- }
2975
- function isStrictMode(object) {
2976
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
2977
- }
2978
- function isSuspense(object) {
2979
- return typeOf(object) === REACT_SUSPENSE_TYPE;
2980
- }
2981
-
2982
- reactIs_development.AsyncMode = AsyncMode;
2983
- reactIs_development.ConcurrentMode = ConcurrentMode;
2984
- reactIs_development.ContextConsumer = ContextConsumer;
2985
- reactIs_development.ContextProvider = ContextProvider;
2986
- reactIs_development.Element = Element;
2987
- reactIs_development.ForwardRef = ForwardRef;
2988
- reactIs_development.Fragment = Fragment;
2989
- reactIs_development.Lazy = Lazy;
2990
- reactIs_development.Memo = Memo;
2991
- reactIs_development.Portal = Portal;
2992
- reactIs_development.Profiler = Profiler;
2993
- reactIs_development.StrictMode = StrictMode;
2994
- reactIs_development.Suspense = Suspense;
2995
- reactIs_development.isAsyncMode = isAsyncMode;
2996
- reactIs_development.isConcurrentMode = isConcurrentMode;
2997
- reactIs_development.isContextConsumer = isContextConsumer;
2998
- reactIs_development.isContextProvider = isContextProvider;
2999
- reactIs_development.isElement = isElement;
3000
- reactIs_development.isForwardRef = isForwardRef;
3001
- reactIs_development.isFragment = isFragment;
3002
- reactIs_development.isLazy = isLazy;
3003
- reactIs_development.isMemo = isMemo;
3004
- reactIs_development.isPortal = isPortal;
3005
- reactIs_development.isProfiler = isProfiler;
3006
- reactIs_development.isStrictMode = isStrictMode;
3007
- reactIs_development.isSuspense = isSuspense;
3008
- reactIs_development.isValidElementType = isValidElementType;
3009
- reactIs_development.typeOf = typeOf;
3010
- })();
3011
- }
3012
- return reactIs_development;
3013
- }
3014
-
3015
- var hasRequiredReactIs;
3016
-
3017
- function requireReactIs () {
3018
- if (hasRequiredReactIs) return reactIs.exports;
3019
- hasRequiredReactIs = 1;
3020
- (function (module) {
3021
-
3022
- if (process.env.NODE_ENV === 'production') {
3023
- module.exports = requireReactIs_production_min();
3024
- } else {
3025
- module.exports = requireReactIs_development();
3026
- }
3027
- } (reactIs));
3028
- return reactIs.exports;
3029
- }
3030
-
3031
- /*
3032
- object-assign
3033
- (c) Sindre Sorhus
3034
- @license MIT
3035
- */
3036
-
3037
- var objectAssign;
3038
- var hasRequiredObjectAssign;
3039
-
3040
- function requireObjectAssign () {
3041
- if (hasRequiredObjectAssign) return objectAssign;
3042
- hasRequiredObjectAssign = 1;
3043
- /* eslint-disable no-unused-vars */
3044
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
3045
- var hasOwnProperty = Object.prototype.hasOwnProperty;
3046
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
3047
-
3048
- function toObject(val) {
3049
- if (val === null || val === undefined) {
3050
- throw new TypeError('Object.assign cannot be called with null or undefined');
3051
- }
3052
-
3053
- return Object(val);
3054
- }
3055
-
3056
- function shouldUseNative() {
3057
- try {
3058
- if (!Object.assign) {
3059
- return false;
3060
- }
3061
-
3062
- // Detect buggy property enumeration order in older V8 versions.
3063
-
3064
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
3065
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
3066
- test1[5] = 'de';
3067
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
3068
- return false;
3069
- }
3070
-
3071
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3072
- var test2 = {};
3073
- for (var i = 0; i < 10; i++) {
3074
- test2['_' + String.fromCharCode(i)] = i;
3075
- }
3076
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
3077
- return test2[n];
3078
- });
3079
- if (order2.join('') !== '0123456789') {
3080
- return false;
3081
- }
3082
-
3083
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3084
- var test3 = {};
3085
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
3086
- test3[letter] = letter;
3087
- });
3088
- if (Object.keys(Object.assign({}, test3)).join('') !==
3089
- 'abcdefghijklmnopqrst') {
3090
- return false;
3091
- }
3092
-
3093
- return true;
3094
- } catch (err) {
3095
- // We don't expect any of the above to throw, but better to be safe.
3096
- return false;
3097
- }
3098
- }
3099
-
3100
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
3101
- var from;
3102
- var to = toObject(target);
3103
- var symbols;
3104
-
3105
- for (var s = 1; s < arguments.length; s++) {
3106
- from = Object(arguments[s]);
3107
-
3108
- for (var key in from) {
3109
- if (hasOwnProperty.call(from, key)) {
3110
- to[key] = from[key];
3111
- }
3112
- }
3113
-
3114
- if (getOwnPropertySymbols) {
3115
- symbols = getOwnPropertySymbols(from);
3116
- for (var i = 0; i < symbols.length; i++) {
3117
- if (propIsEnumerable.call(from, symbols[i])) {
3118
- to[symbols[i]] = from[symbols[i]];
3119
- }
3120
- }
3121
- }
3122
- }
3123
-
3124
- return to;
3125
- };
3126
- return objectAssign;
3127
- }
3128
-
3129
- /**
3130
- * Copyright (c) 2013-present, Facebook, Inc.
3131
- *
3132
- * This source code is licensed under the MIT license found in the
3133
- * LICENSE file in the root directory of this source tree.
3134
- */
3135
-
3136
- var ReactPropTypesSecret_1;
3137
- var hasRequiredReactPropTypesSecret;
3138
-
3139
- function requireReactPropTypesSecret () {
3140
- if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
3141
- hasRequiredReactPropTypesSecret = 1;
3142
-
3143
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
3144
-
3145
- ReactPropTypesSecret_1 = ReactPropTypesSecret;
3146
- return ReactPropTypesSecret_1;
3147
- }
3148
-
3149
- var has;
3150
- var hasRequiredHas;
3151
-
3152
- function requireHas () {
3153
- if (hasRequiredHas) return has;
3154
- hasRequiredHas = 1;
3155
- has = Function.call.bind(Object.prototype.hasOwnProperty);
3156
- return has;
3157
- }
3158
-
3159
- /**
3160
- * Copyright (c) 2013-present, Facebook, Inc.
3161
- *
3162
- * This source code is licensed under the MIT license found in the
3163
- * LICENSE file in the root directory of this source tree.
3164
- */
3165
-
3166
- var checkPropTypes_1;
3167
- var hasRequiredCheckPropTypes;
3168
-
3169
- function requireCheckPropTypes () {
3170
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
3171
- hasRequiredCheckPropTypes = 1;
3172
-
3173
- var printWarning = function() {};
3174
-
3175
- if (process.env.NODE_ENV !== 'production') {
3176
- var ReactPropTypesSecret = requireReactPropTypesSecret();
3177
- var loggedTypeFailures = {};
3178
- var has = requireHas();
3179
-
3180
- printWarning = function(text) {
3181
- var message = 'Warning: ' + text;
3182
- if (typeof console !== 'undefined') {
3183
- console.error(message);
3184
- }
3185
- try {
3186
- // --- Welcome to debugging React ---
3187
- // This error was thrown as a convenience so that you can use this stack
3188
- // to find the callsite that caused this warning to fire.
3189
- throw new Error(message);
3190
- } catch (x) { /**/ }
3191
- };
3192
- }
3193
-
3194
- /**
3195
- * Assert that the values match with the type specs.
3196
- * Error messages are memorized and will only be shown once.
3197
- *
3198
- * @param {object} typeSpecs Map of name to a ReactPropType
3199
- * @param {object} values Runtime values that need to be type-checked
3200
- * @param {string} location e.g. "prop", "context", "child context"
3201
- * @param {string} componentName Name of the component for error messages.
3202
- * @param {?Function} getStack Returns the component stack.
3203
- * @private
3204
- */
3205
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
3206
- if (process.env.NODE_ENV !== 'production') {
3207
- for (var typeSpecName in typeSpecs) {
3208
- if (has(typeSpecs, typeSpecName)) {
3209
- var error;
3210
- // Prop type validation may throw. In case they do, we don't want to
3211
- // fail the render phase where it didn't fail before. So we log it.
3212
- // After these have been cleaned up, we'll let them throw.
3213
- try {
3214
- // This is intentionally an invariant that gets caught. It's the same
3215
- // behavior as without this statement except with a better message.
3216
- if (typeof typeSpecs[typeSpecName] !== 'function') {
3217
- var err = Error(
3218
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
3219
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
3220
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
3221
- );
3222
- err.name = 'Invariant Violation';
3223
- throw err;
3224
- }
3225
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
3226
- } catch (ex) {
3227
- error = ex;
3228
- }
3229
- if (error && !(error instanceof Error)) {
3230
- printWarning(
3231
- (componentName || 'React class') + ': type specification of ' +
3232
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
3233
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
3234
- 'You may have forgotten to pass an argument to the type checker ' +
3235
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
3236
- 'shape all require an argument).'
3237
- );
3238
- }
3239
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
3240
- // Only monitor this failure once because there tends to be a lot of the
3241
- // same error.
3242
- loggedTypeFailures[error.message] = true;
3243
-
3244
- var stack = getStack ? getStack() : '';
3245
-
3246
- printWarning(
3247
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
3248
- );
3249
- }
3250
- }
3251
- }
3252
- }
3253
- }
3254
-
3255
- /**
3256
- * Resets warning cache when testing.
3257
- *
3258
- * @private
3259
- */
3260
- checkPropTypes.resetWarningCache = function() {
3261
- if (process.env.NODE_ENV !== 'production') {
3262
- loggedTypeFailures = {};
3263
- }
3264
- };
3265
-
3266
- checkPropTypes_1 = checkPropTypes;
3267
- return checkPropTypes_1;
3268
- }
3269
-
3270
- /**
3271
- * Copyright (c) 2013-present, Facebook, Inc.
3272
- *
3273
- * This source code is licensed under the MIT license found in the
3274
- * LICENSE file in the root directory of this source tree.
3275
- */
3276
-
3277
- var factoryWithTypeCheckers;
3278
- var hasRequiredFactoryWithTypeCheckers;
3279
-
3280
- function requireFactoryWithTypeCheckers () {
3281
- if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
3282
- hasRequiredFactoryWithTypeCheckers = 1;
3283
-
3284
- var ReactIs = requireReactIs();
3285
- var assign = requireObjectAssign();
3286
-
3287
- var ReactPropTypesSecret = requireReactPropTypesSecret();
3288
- var has = requireHas();
3289
- var checkPropTypes = requireCheckPropTypes();
3290
-
3291
- var printWarning = function() {};
3292
-
3293
- if (process.env.NODE_ENV !== 'production') {
3294
- printWarning = function(text) {
3295
- var message = 'Warning: ' + text;
3296
- if (typeof console !== 'undefined') {
3297
- console.error(message);
3298
- }
3299
- try {
3300
- // --- Welcome to debugging React ---
3301
- // This error was thrown as a convenience so that you can use this stack
3302
- // to find the callsite that caused this warning to fire.
3303
- throw new Error(message);
3304
- } catch (x) {}
3305
- };
3306
- }
3307
-
3308
- function emptyFunctionThatReturnsNull() {
3309
- return null;
3310
- }
3311
-
3312
- factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3313
- /* global Symbol */
3314
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
3315
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
3316
-
3317
- /**
3318
- * Returns the iterator method function contained on the iterable object.
3319
- *
3320
- * Be sure to invoke the function with the iterable as context:
3321
- *
3322
- * var iteratorFn = getIteratorFn(myIterable);
3323
- * if (iteratorFn) {
3324
- * var iterator = iteratorFn.call(myIterable);
3325
- * ...
3326
- * }
3327
- *
3328
- * @param {?object} maybeIterable
3329
- * @return {?function}
3330
- */
3331
- function getIteratorFn(maybeIterable) {
3332
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
3333
- if (typeof iteratorFn === 'function') {
3334
- return iteratorFn;
3335
- }
3336
- }
3337
-
3338
- /**
3339
- * Collection of methods that allow declaration and validation of props that are
3340
- * supplied to React components. Example usage:
3341
- *
3342
- * var Props = require('ReactPropTypes');
3343
- * var MyArticle = React.createClass({
3344
- * propTypes: {
3345
- * // An optional string prop named "description".
3346
- * description: Props.string,
3347
- *
3348
- * // A required enum prop named "category".
3349
- * category: Props.oneOf(['News','Photos']).isRequired,
3350
- *
3351
- * // A prop named "dialog" that requires an instance of Dialog.
3352
- * dialog: Props.instanceOf(Dialog).isRequired
3353
- * },
3354
- * render: function() { ... }
3355
- * });
3356
- *
3357
- * A more formal specification of how these methods are used:
3358
- *
3359
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
3360
- * decl := ReactPropTypes.{type}(.isRequired)?
3361
- *
3362
- * Each and every declaration produces a function with the same signature. This
3363
- * allows the creation of custom validation functions. For example:
3364
- *
3365
- * var MyLink = React.createClass({
3366
- * propTypes: {
3367
- * // An optional string or URI prop named "href".
3368
- * href: function(props, propName, componentName) {
3369
- * var propValue = props[propName];
3370
- * if (propValue != null && typeof propValue !== 'string' &&
3371
- * !(propValue instanceof URI)) {
3372
- * return new Error(
3373
- * 'Expected a string or an URI for ' + propName + ' in ' +
3374
- * componentName
3375
- * );
3376
- * }
3377
- * }
3378
- * },
3379
- * render: function() {...}
3380
- * });
3381
- *
3382
- * @internal
3383
- */
3384
-
3385
- var ANONYMOUS = '<<anonymous>>';
3386
-
3387
- // Important!
3388
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
3389
- var ReactPropTypes = {
3390
- array: createPrimitiveTypeChecker('array'),
3391
- bigint: createPrimitiveTypeChecker('bigint'),
3392
- bool: createPrimitiveTypeChecker('boolean'),
3393
- func: createPrimitiveTypeChecker('function'),
3394
- number: createPrimitiveTypeChecker('number'),
3395
- object: createPrimitiveTypeChecker('object'),
3396
- string: createPrimitiveTypeChecker('string'),
3397
- symbol: createPrimitiveTypeChecker('symbol'),
3398
-
3399
- any: createAnyTypeChecker(),
3400
- arrayOf: createArrayOfTypeChecker,
3401
- element: createElementTypeChecker(),
3402
- elementType: createElementTypeTypeChecker(),
3403
- instanceOf: createInstanceTypeChecker,
3404
- node: createNodeChecker(),
3405
- objectOf: createObjectOfTypeChecker,
3406
- oneOf: createEnumTypeChecker,
3407
- oneOfType: createUnionTypeChecker,
3408
- shape: createShapeTypeChecker,
3409
- exact: createStrictShapeTypeChecker,
3410
- };
3411
-
3412
- /**
3413
- * inlined Object.is polyfill to avoid requiring consumers ship their own
3414
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
3415
- */
3416
- /*eslint-disable no-self-compare*/
3417
- function is(x, y) {
3418
- // SameValue algorithm
3419
- if (x === y) {
3420
- // Steps 1-5, 7-10
3421
- // Steps 6.b-6.e: +0 != -0
3422
- return x !== 0 || 1 / x === 1 / y;
3423
- } else {
3424
- // Step 6.a: NaN == NaN
3425
- return x !== x && y !== y;
3426
- }
3427
- }
3428
- /*eslint-enable no-self-compare*/
3429
-
3430
- /**
3431
- * We use an Error-like object for backward compatibility as people may call
3432
- * PropTypes directly and inspect their output. However, we don't use real
3433
- * Errors anymore. We don't inspect their stack anyway, and creating them
3434
- * is prohibitively expensive if they are created too often, such as what
3435
- * happens in oneOfType() for any type before the one that matched.
3436
- */
3437
- function PropTypeError(message, data) {
3438
- this.message = message;
3439
- this.data = data && typeof data === 'object' ? data: {};
3440
- this.stack = '';
3441
- }
3442
- // Make `instanceof Error` still work for returned errors.
3443
- PropTypeError.prototype = Error.prototype;
3444
-
3445
- function createChainableTypeChecker(validate) {
3446
- if (process.env.NODE_ENV !== 'production') {
3447
- var manualPropTypeCallCache = {};
3448
- var manualPropTypeWarningCount = 0;
3449
- }
3450
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
3451
- componentName = componentName || ANONYMOUS;
3452
- propFullName = propFullName || propName;
3453
-
3454
- if (secret !== ReactPropTypesSecret) {
3455
- if (throwOnDirectAccess) {
3456
- // New behavior only for users of `prop-types` package
3457
- var err = new Error(
3458
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
3459
- 'Use `PropTypes.checkPropTypes()` to call them. ' +
3460
- 'Read more at http://fb.me/use-check-prop-types'
3461
- );
3462
- err.name = 'Invariant Violation';
3463
- throw err;
3464
- } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
3465
- // Old behavior for people using React.PropTypes
3466
- var cacheKey = componentName + ':' + propName;
3467
- if (
3468
- !manualPropTypeCallCache[cacheKey] &&
3469
- // Avoid spamming the console because they are often not actionable except for lib authors
3470
- manualPropTypeWarningCount < 3
3471
- ) {
3472
- printWarning(
3473
- 'You are manually calling a React.PropTypes validation ' +
3474
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
3475
- 'and will throw in the standalone `prop-types` package. ' +
3476
- 'You may be seeing this warning due to a third-party PropTypes ' +
3477
- 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
3478
- );
3479
- manualPropTypeCallCache[cacheKey] = true;
3480
- manualPropTypeWarningCount++;
3481
- }
3482
- }
3483
- }
3484
- if (props[propName] == null) {
3485
- if (isRequired) {
3486
- if (props[propName] === null) {
3487
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
3488
- }
3489
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
3490
- }
3491
- return null;
3492
- } else {
3493
- return validate(props, propName, componentName, location, propFullName);
3494
- }
3495
- }
3496
-
3497
- var chainedCheckType = checkType.bind(null, false);
3498
- chainedCheckType.isRequired = checkType.bind(null, true);
3499
-
3500
- return chainedCheckType;
3501
- }
3502
-
3503
- function createPrimitiveTypeChecker(expectedType) {
3504
- function validate(props, propName, componentName, location, propFullName, secret) {
3505
- var propValue = props[propName];
3506
- var propType = getPropType(propValue);
3507
- if (propType !== expectedType) {
3508
- // `propValue` being instance of, say, date/regexp, pass the 'object'
3509
- // check, but we can offer a more precise error message here rather than
3510
- // 'of type `object`'.
3511
- var preciseType = getPreciseType(propValue);
3512
-
3513
- return new PropTypeError(
3514
- 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
3515
- {expectedType: expectedType}
3516
- );
3517
- }
3518
- return null;
3519
- }
3520
- return createChainableTypeChecker(validate);
3521
- }
3522
-
3523
- function createAnyTypeChecker() {
3524
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
3525
- }
3526
-
3527
- function createArrayOfTypeChecker(typeChecker) {
3528
- function validate(props, propName, componentName, location, propFullName) {
3529
- if (typeof typeChecker !== 'function') {
3530
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
3531
- }
3532
- var propValue = props[propName];
3533
- if (!Array.isArray(propValue)) {
3534
- var propType = getPropType(propValue);
3535
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
3536
- }
3537
- for (var i = 0; i < propValue.length; i++) {
3538
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
3539
- if (error instanceof Error) {
3540
- return error;
3541
- }
3542
- }
3543
- return null;
3544
- }
3545
- return createChainableTypeChecker(validate);
3546
- }
3547
-
3548
- function createElementTypeChecker() {
3549
- function validate(props, propName, componentName, location, propFullName) {
3550
- var propValue = props[propName];
3551
- if (!isValidElement(propValue)) {
3552
- var propType = getPropType(propValue);
3553
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
3554
- }
3555
- return null;
3556
- }
3557
- return createChainableTypeChecker(validate);
3558
- }
3559
-
3560
- function createElementTypeTypeChecker() {
3561
- function validate(props, propName, componentName, location, propFullName) {
3562
- var propValue = props[propName];
3563
- if (!ReactIs.isValidElementType(propValue)) {
3564
- var propType = getPropType(propValue);
3565
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
3566
- }
3567
- return null;
3568
- }
3569
- return createChainableTypeChecker(validate);
3570
- }
3571
-
3572
- function createInstanceTypeChecker(expectedClass) {
3573
- function validate(props, propName, componentName, location, propFullName) {
3574
- if (!(props[propName] instanceof expectedClass)) {
3575
- var expectedClassName = expectedClass.name || ANONYMOUS;
3576
- var actualClassName = getClassName(props[propName]);
3577
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
3578
- }
3579
- return null;
3580
- }
3581
- return createChainableTypeChecker(validate);
3582
- }
3583
-
3584
- function createEnumTypeChecker(expectedValues) {
3585
- if (!Array.isArray(expectedValues)) {
3586
- if (process.env.NODE_ENV !== 'production') {
3587
- if (arguments.length > 1) {
3588
- printWarning(
3589
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
3590
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
3591
- );
3592
- } else {
3593
- printWarning('Invalid argument supplied to oneOf, expected an array.');
3594
- }
3595
- }
3596
- return emptyFunctionThatReturnsNull;
3597
- }
3598
-
3599
- function validate(props, propName, componentName, location, propFullName) {
3600
- var propValue = props[propName];
3601
- for (var i = 0; i < expectedValues.length; i++) {
3602
- if (is(propValue, expectedValues[i])) {
3603
- return null;
3604
- }
3605
- }
3606
-
3607
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
3608
- var type = getPreciseType(value);
3609
- if (type === 'symbol') {
3610
- return String(value);
3611
- }
3612
- return value;
3613
- });
3614
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
3615
- }
3616
- return createChainableTypeChecker(validate);
3617
- }
3618
-
3619
- function createObjectOfTypeChecker(typeChecker) {
3620
- function validate(props, propName, componentName, location, propFullName) {
3621
- if (typeof typeChecker !== 'function') {
3622
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
3623
- }
3624
- var propValue = props[propName];
3625
- var propType = getPropType(propValue);
3626
- if (propType !== 'object') {
3627
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
3628
- }
3629
- for (var key in propValue) {
3630
- if (has(propValue, key)) {
3631
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
3632
- if (error instanceof Error) {
3633
- return error;
3634
- }
3635
- }
3636
- }
3637
- return null;
3638
- }
3639
- return createChainableTypeChecker(validate);
3640
- }
3641
-
3642
- function createUnionTypeChecker(arrayOfTypeCheckers) {
3643
- if (!Array.isArray(arrayOfTypeCheckers)) {
3644
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
3645
- return emptyFunctionThatReturnsNull;
3646
- }
3647
-
3648
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3649
- var checker = arrayOfTypeCheckers[i];
3650
- if (typeof checker !== 'function') {
3651
- printWarning(
3652
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
3653
- 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
3654
- );
3655
- return emptyFunctionThatReturnsNull;
3656
- }
3657
- }
3658
-
3659
- function validate(props, propName, componentName, location, propFullName) {
3660
- var expectedTypes = [];
3661
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3662
- var checker = arrayOfTypeCheckers[i];
3663
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
3664
- if (checkerResult == null) {
3665
- return null;
3666
- }
3667
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
3668
- expectedTypes.push(checkerResult.data.expectedType);
3669
- }
3670
- }
3671
- var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
3672
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
3673
- }
3674
- return createChainableTypeChecker(validate);
3675
- }
3676
-
3677
- function createNodeChecker() {
3678
- function validate(props, propName, componentName, location, propFullName) {
3679
- if (!isNode(props[propName])) {
3680
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
3681
- }
3682
- return null;
3683
- }
3684
- return createChainableTypeChecker(validate);
3685
- }
3686
-
3687
- function invalidValidatorError(componentName, location, propFullName, key, type) {
3688
- return new PropTypeError(
3689
- (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
3690
- 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
3691
- );
3692
- }
3693
-
3694
- function createShapeTypeChecker(shapeTypes) {
3695
- function validate(props, propName, componentName, location, propFullName) {
3696
- var propValue = props[propName];
3697
- var propType = getPropType(propValue);
3698
- if (propType !== 'object') {
3699
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3700
- }
3701
- for (var key in shapeTypes) {
3702
- var checker = shapeTypes[key];
3703
- if (typeof checker !== 'function') {
3704
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3705
- }
3706
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
3707
- if (error) {
3708
- return error;
3709
- }
3710
- }
3711
- return null;
3712
- }
3713
- return createChainableTypeChecker(validate);
3714
- }
3715
-
3716
- function createStrictShapeTypeChecker(shapeTypes) {
3717
- function validate(props, propName, componentName, location, propFullName) {
3718
- var propValue = props[propName];
3719
- var propType = getPropType(propValue);
3720
- if (propType !== 'object') {
3721
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3722
- }
3723
- // We need to check all keys in case some are required but missing from props.
3724
- var allKeys = assign({}, props[propName], shapeTypes);
3725
- for (var key in allKeys) {
3726
- var checker = shapeTypes[key];
3727
- if (has(shapeTypes, key) && typeof checker !== 'function') {
3728
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3729
- }
3730
- if (!checker) {
3731
- return new PropTypeError(
3732
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
3733
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
3734
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
3735
- );
3736
- }
3737
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
3738
- if (error) {
3739
- return error;
3740
- }
3741
- }
3742
- return null;
3743
- }
3744
-
3745
- return createChainableTypeChecker(validate);
3746
- }
3747
-
3748
- function isNode(propValue) {
3749
- switch (typeof propValue) {
3750
- case 'number':
3751
- case 'string':
3752
- case 'undefined':
3753
- return true;
3754
- case 'boolean':
3755
- return !propValue;
3756
- case 'object':
3757
- if (Array.isArray(propValue)) {
3758
- return propValue.every(isNode);
3759
- }
3760
- if (propValue === null || isValidElement(propValue)) {
3761
- return true;
3762
- }
3763
-
3764
- var iteratorFn = getIteratorFn(propValue);
3765
- if (iteratorFn) {
3766
- var iterator = iteratorFn.call(propValue);
3767
- var step;
3768
- if (iteratorFn !== propValue.entries) {
3769
- while (!(step = iterator.next()).done) {
3770
- if (!isNode(step.value)) {
3771
- return false;
3772
- }
3773
- }
3774
- } else {
3775
- // Iterator will provide entry [k,v] tuples rather than values.
3776
- while (!(step = iterator.next()).done) {
3777
- var entry = step.value;
3778
- if (entry) {
3779
- if (!isNode(entry[1])) {
3780
- return false;
3781
- }
3782
- }
3783
- }
3784
- }
3785
- } else {
3786
- return false;
3787
- }
3788
-
3789
- return true;
3790
- default:
3791
- return false;
3792
- }
3793
- }
3794
-
3795
- function isSymbol(propType, propValue) {
3796
- // Native Symbol.
3797
- if (propType === 'symbol') {
3798
- return true;
3799
- }
3800
-
3801
- // falsy value can't be a Symbol
3802
- if (!propValue) {
3803
- return false;
3804
- }
3805
-
3806
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
3807
- if (propValue['@@toStringTag'] === 'Symbol') {
3808
- return true;
3809
- }
3810
-
3811
- // Fallback for non-spec compliant Symbols which are polyfilled.
3812
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
3813
- return true;
3814
- }
3815
-
3816
- return false;
3817
- }
3818
-
3819
- // Equivalent of `typeof` but with special handling for array and regexp.
3820
- function getPropType(propValue) {
3821
- var propType = typeof propValue;
3822
- if (Array.isArray(propValue)) {
3823
- return 'array';
3824
- }
3825
- if (propValue instanceof RegExp) {
3826
- // Old webkits (at least until Android 4.0) return 'function' rather than
3827
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
3828
- // passes PropTypes.object.
3829
- return 'object';
3830
- }
3831
- if (isSymbol(propType, propValue)) {
3832
- return 'symbol';
3833
- }
3834
- return propType;
3835
- }
3836
-
3837
- // This handles more types than `getPropType`. Only used for error messages.
3838
- // See `createPrimitiveTypeChecker`.
3839
- function getPreciseType(propValue) {
3840
- if (typeof propValue === 'undefined' || propValue === null) {
3841
- return '' + propValue;
3842
- }
3843
- var propType = getPropType(propValue);
3844
- if (propType === 'object') {
3845
- if (propValue instanceof Date) {
3846
- return 'date';
3847
- } else if (propValue instanceof RegExp) {
3848
- return 'regexp';
3849
- }
3850
- }
3851
- return propType;
3852
- }
3853
-
3854
- // Returns a string that is postfixed to a warning about an invalid type.
3855
- // For example, "undefined" or "of type array"
3856
- function getPostfixForTypeWarning(value) {
3857
- var type = getPreciseType(value);
3858
- switch (type) {
3859
- case 'array':
3860
- case 'object':
3861
- return 'an ' + type;
3862
- case 'boolean':
3863
- case 'date':
3864
- case 'regexp':
3865
- return 'a ' + type;
3866
- default:
3867
- return type;
3868
- }
3869
- }
3870
-
3871
- // Returns class name of the object, if any.
3872
- function getClassName(propValue) {
3873
- if (!propValue.constructor || !propValue.constructor.name) {
3874
- return ANONYMOUS;
3875
- }
3876
- return propValue.constructor.name;
3877
- }
3878
-
3879
- ReactPropTypes.checkPropTypes = checkPropTypes;
3880
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
3881
- ReactPropTypes.PropTypes = ReactPropTypes;
3882
-
3883
- return ReactPropTypes;
3884
- };
3885
- return factoryWithTypeCheckers;
3886
- }
3887
-
3888
- /**
3889
- * Copyright (c) 2013-present, Facebook, Inc.
3890
- *
3891
- * This source code is licensed under the MIT license found in the
3892
- * LICENSE file in the root directory of this source tree.
3893
- */
3894
-
3895
- var factoryWithThrowingShims;
3896
- var hasRequiredFactoryWithThrowingShims;
3897
-
3898
- function requireFactoryWithThrowingShims () {
3899
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
3900
- hasRequiredFactoryWithThrowingShims = 1;
3901
-
3902
- var ReactPropTypesSecret = requireReactPropTypesSecret();
3903
-
3904
- function emptyFunction() {}
3905
- function emptyFunctionWithReset() {}
3906
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
3907
-
3908
- factoryWithThrowingShims = function() {
3909
- function shim(props, propName, componentName, location, propFullName, secret) {
3910
- if (secret === ReactPropTypesSecret) {
3911
- // It is still safe when called from React.
3912
- return;
3913
- }
3914
- var err = new Error(
3915
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
3916
- 'Use PropTypes.checkPropTypes() to call them. ' +
3917
- 'Read more at http://fb.me/use-check-prop-types'
3918
- );
3919
- err.name = 'Invariant Violation';
3920
- throw err;
3921
- } shim.isRequired = shim;
3922
- function getShim() {
3923
- return shim;
3924
- } // Important!
3925
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
3926
- var ReactPropTypes = {
3927
- array: shim,
3928
- bigint: shim,
3929
- bool: shim,
3930
- func: shim,
3931
- number: shim,
3932
- object: shim,
3933
- string: shim,
3934
- symbol: shim,
3935
-
3936
- any: shim,
3937
- arrayOf: getShim,
3938
- element: shim,
3939
- elementType: shim,
3940
- instanceOf: getShim,
3941
- node: shim,
3942
- objectOf: getShim,
3943
- oneOf: getShim,
3944
- oneOfType: getShim,
3945
- shape: getShim,
3946
- exact: getShim,
3947
-
3948
- checkPropTypes: emptyFunctionWithReset,
3949
- resetWarningCache: emptyFunction
3950
- };
3951
-
3952
- ReactPropTypes.PropTypes = ReactPropTypes;
3953
-
3954
- return ReactPropTypes;
3955
- };
3956
- return factoryWithThrowingShims;
3957
- }
3958
-
3959
- /**
3960
- * Copyright (c) 2013-present, Facebook, Inc.
3961
- *
3962
- * This source code is licensed under the MIT license found in the
3963
- * LICENSE file in the root directory of this source tree.
3964
- */
3965
-
3966
- if (process.env.NODE_ENV !== 'production') {
3967
- var ReactIs = requireReactIs();
3968
-
3969
- // By explicitly using `prop-types` you are opting into new development behavior.
3970
- // http://fb.me/prop-types-in-prod
3971
- var throwOnDirectAccess = true;
3972
- propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
3973
- } else {
3974
- // By explicitly using `prop-types` you are opting into new production behavior.
3975
- // http://fb.me/prop-types-in-prod
3976
- propTypes.exports = requireFactoryWithThrowingShims()();
3977
- }
1
+ import { useState, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
3978
3
 
3979
4
  function useDetectScroll({ thr = 0, up = "up", down = "down" }) {
3980
- const [scrollDir, setScrollDir] = react.exports.useState(down);
5
+ const [scrollDir, setScrollDir] = useState(down);
3981
6
 
3982
- react.exports.useEffect(() => {
7
+ useEffect(() => {
3983
8
  const threshold = thr >= 0 ? 0 : thr;
3984
9
  let lastScrollY = window.pageYOffset;
3985
10
  let ticking = false;
@@ -4012,9 +37,9 @@ function useDetectScroll({ thr = 0, up = "up", down = "down" }) {
4012
37
  }
4013
38
 
4014
39
  useDetectScroll.propTypes = {
4015
- thr: propTypes.exports.number,
4016
- up: propTypes.exports.string,
4017
- down: propTypes.exports.string,
40
+ thr: PropTypes.number,
41
+ up: PropTypes.string,
42
+ down: PropTypes.string,
4018
43
  };
4019
44
 
4020
45
  export { useDetectScroll };