@xelto.npm/xc2-lib 0.0.8 → 0.0.10
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/cjs/index.js +81 -2865
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +58 -2860
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,2812 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { createContext, useContext, createElement, Fragment, forwardRef, useRef } from 'react';
|
|
3
|
+
|
|
1
4
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
5
|
|
|
3
6
|
var jsxRuntime = {exports: {}};
|
|
4
7
|
|
|
5
8
|
var reactJsxRuntime_production_min = {};
|
|
6
9
|
|
|
7
|
-
var react = {exports: {}};
|
|
8
|
-
|
|
9
|
-
var react_production_min = {};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @license React
|
|
13
|
-
* react.production.min.js
|
|
14
|
-
*
|
|
15
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the MIT license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
var hasRequiredReact_production_min;
|
|
22
|
-
|
|
23
|
-
function requireReact_production_min () {
|
|
24
|
-
if (hasRequiredReact_production_min) return react_production_min;
|
|
25
|
-
hasRequiredReact_production_min = 1;
|
|
26
|
-
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}
|
|
27
|
-
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={};
|
|
28
|
-
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;
|
|
29
|
-
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};
|
|
30
|
-
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}}
|
|
31
|
-
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)}
|
|
32
|
-
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=
|
|
33
|
-
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}
|
|
34
|
-
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;}
|
|
35
|
-
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;
|
|
36
|
-
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;
|
|
37
|
-
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);
|
|
38
|
-
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}};
|
|
39
|
-
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.");};
|
|
40
|
-
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)};
|
|
41
|
-
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)};
|
|
42
|
-
react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.2.0";
|
|
43
|
-
return react_production_min;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
var react_development = {exports: {}};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @license React
|
|
50
|
-
* react.development.js
|
|
51
|
-
*
|
|
52
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the MIT license found in the
|
|
55
|
-
* LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
var hasRequiredReact_development;
|
|
59
|
-
|
|
60
|
-
function requireReact_development () {
|
|
61
|
-
if (hasRequiredReact_development) return react_development.exports;
|
|
62
|
-
hasRequiredReact_development = 1;
|
|
63
|
-
(function (module, exports) {
|
|
64
|
-
|
|
65
|
-
if (process.env.NODE_ENV !== "production") {
|
|
66
|
-
(function() {
|
|
67
|
-
|
|
68
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
69
|
-
if (
|
|
70
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
71
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
72
|
-
'function'
|
|
73
|
-
) {
|
|
74
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
75
|
-
}
|
|
76
|
-
var ReactVersion = '18.2.0';
|
|
77
|
-
|
|
78
|
-
// ATTENTION
|
|
79
|
-
// When adding new symbols to this file,
|
|
80
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
81
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
82
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
83
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
84
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
85
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
86
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
87
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
88
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
89
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
90
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
91
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
92
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
93
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
94
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
95
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
96
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
97
|
-
function getIteratorFn(maybeIterable) {
|
|
98
|
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
103
|
-
|
|
104
|
-
if (typeof maybeIterator === 'function') {
|
|
105
|
-
return maybeIterator;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Keeps track of the current dispatcher.
|
|
113
|
-
*/
|
|
114
|
-
var ReactCurrentDispatcher = {
|
|
115
|
-
/**
|
|
116
|
-
* @internal
|
|
117
|
-
* @type {ReactComponent}
|
|
118
|
-
*/
|
|
119
|
-
current: null
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
124
|
-
* should suspend for if it needs to.
|
|
125
|
-
*/
|
|
126
|
-
var ReactCurrentBatchConfig = {
|
|
127
|
-
transition: null
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
var ReactCurrentActQueue = {
|
|
131
|
-
current: null,
|
|
132
|
-
// Used to reproduce behavior of `batchedUpdates` in legacy mode.
|
|
133
|
-
isBatchingLegacy: false,
|
|
134
|
-
didScheduleLegacyUpdate: false
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Keeps track of the current owner.
|
|
139
|
-
*
|
|
140
|
-
* The current owner is the component who should own any components that are
|
|
141
|
-
* currently being constructed.
|
|
142
|
-
*/
|
|
143
|
-
var ReactCurrentOwner = {
|
|
144
|
-
/**
|
|
145
|
-
* @internal
|
|
146
|
-
* @type {ReactComponent}
|
|
147
|
-
*/
|
|
148
|
-
current: null
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
var ReactDebugCurrentFrame = {};
|
|
152
|
-
var currentExtraStackFrame = null;
|
|
153
|
-
function setExtraStackFrame(stack) {
|
|
154
|
-
{
|
|
155
|
-
currentExtraStackFrame = stack;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
{
|
|
160
|
-
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
|
161
|
-
{
|
|
162
|
-
currentExtraStackFrame = stack;
|
|
163
|
-
}
|
|
164
|
-
}; // Stack implementation injected by the current renderer.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
168
|
-
|
|
169
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
170
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
|
171
|
-
|
|
172
|
-
if (currentExtraStackFrame) {
|
|
173
|
-
stack += currentExtraStackFrame;
|
|
174
|
-
} // Delegate to the injected renderer-specific implementation
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
178
|
-
|
|
179
|
-
if (impl) {
|
|
180
|
-
stack += impl() || '';
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return stack;
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// -----------------------------------------------------------------------------
|
|
188
|
-
|
|
189
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
190
|
-
var enableCacheElement = false;
|
|
191
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
192
|
-
|
|
193
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
194
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
195
|
-
// issues in DEV builds.
|
|
196
|
-
|
|
197
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
198
|
-
|
|
199
|
-
var ReactSharedInternals = {
|
|
200
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
201
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
202
|
-
ReactCurrentOwner: ReactCurrentOwner
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
{
|
|
206
|
-
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
207
|
-
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// by calls to these methods by a Babel plugin.
|
|
211
|
-
//
|
|
212
|
-
// In PROD (or in packages without access to React internals),
|
|
213
|
-
// they are left as they are instead.
|
|
214
|
-
|
|
215
|
-
function warn(format) {
|
|
216
|
-
{
|
|
217
|
-
{
|
|
218
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
219
|
-
args[_key - 1] = arguments[_key];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
printWarning('warn', format, args);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function error(format) {
|
|
227
|
-
{
|
|
228
|
-
{
|
|
229
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
230
|
-
args[_key2 - 1] = arguments[_key2];
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
printWarning('error', format, args);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function printWarning(level, format, args) {
|
|
239
|
-
// When changing this logic, you might want to also
|
|
240
|
-
// update consoleWithStackDev.www.js as well.
|
|
241
|
-
{
|
|
242
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
243
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
244
|
-
|
|
245
|
-
if (stack !== '') {
|
|
246
|
-
format += '%s';
|
|
247
|
-
args = args.concat([stack]);
|
|
248
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
var argsWithFormat = args.map(function (item) {
|
|
252
|
-
return String(item);
|
|
253
|
-
}); // Careful: RN currently depends on this prefix
|
|
254
|
-
|
|
255
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
256
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
257
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
258
|
-
|
|
259
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
var didWarnStateUpdateForUnmountedComponent = {};
|
|
264
|
-
|
|
265
|
-
function warnNoop(publicInstance, callerName) {
|
|
266
|
-
{
|
|
267
|
-
var _constructor = publicInstance.constructor;
|
|
268
|
-
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
269
|
-
var warningKey = componentName + "." + callerName;
|
|
270
|
-
|
|
271
|
-
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
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);
|
|
276
|
-
|
|
277
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* This is the abstract API for an update queue.
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
var ReactNoopUpdateQueue = {
|
|
286
|
-
/**
|
|
287
|
-
* Checks whether or not this composite component is mounted.
|
|
288
|
-
* @param {ReactClass} publicInstance The instance we want to test.
|
|
289
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
290
|
-
* @protected
|
|
291
|
-
* @final
|
|
292
|
-
*/
|
|
293
|
-
isMounted: function (publicInstance) {
|
|
294
|
-
return false;
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Forces an update. This should only be invoked when it is known with
|
|
299
|
-
* certainty that we are **not** in a DOM transaction.
|
|
300
|
-
*
|
|
301
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
302
|
-
* component's state has changed but `setState` was not called.
|
|
303
|
-
*
|
|
304
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
305
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
306
|
-
*
|
|
307
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
308
|
-
* @param {?function} callback Called after component is updated.
|
|
309
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
310
|
-
* @internal
|
|
311
|
-
*/
|
|
312
|
-
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
313
|
-
warnNoop(publicInstance, 'forceUpdate');
|
|
314
|
-
},
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
318
|
-
* You should treat `this.state` as immutable.
|
|
319
|
-
*
|
|
320
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
321
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
322
|
-
*
|
|
323
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
324
|
-
* @param {object} completeState Next state.
|
|
325
|
-
* @param {?function} callback Called after component is updated.
|
|
326
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
327
|
-
* @internal
|
|
328
|
-
*/
|
|
329
|
-
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
330
|
-
warnNoop(publicInstance, 'replaceState');
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
|
335
|
-
* internal. This provides a merging strategy that is not available to deep
|
|
336
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
337
|
-
* during the merge.
|
|
338
|
-
*
|
|
339
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
340
|
-
* @param {object} partialState Next partial state to be merged with state.
|
|
341
|
-
* @param {?function} callback Called after component is updated.
|
|
342
|
-
* @param {?string} Name of the calling function in the public API.
|
|
343
|
-
* @internal
|
|
344
|
-
*/
|
|
345
|
-
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
346
|
-
warnNoop(publicInstance, 'setState');
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
var assign = Object.assign;
|
|
351
|
-
|
|
352
|
-
var emptyObject = {};
|
|
353
|
-
|
|
354
|
-
{
|
|
355
|
-
Object.freeze(emptyObject);
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Base class helpers for the updating state of a component.
|
|
359
|
-
*/
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
function Component(props, context, updater) {
|
|
363
|
-
this.props = props;
|
|
364
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
365
|
-
|
|
366
|
-
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
367
|
-
// renderer.
|
|
368
|
-
|
|
369
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
Component.prototype.isReactComponent = {};
|
|
373
|
-
/**
|
|
374
|
-
* Sets a subset of the state. Always use this to mutate
|
|
375
|
-
* state. You should treat `this.state` as immutable.
|
|
376
|
-
*
|
|
377
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
378
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
379
|
-
*
|
|
380
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
|
381
|
-
* as they may eventually be batched together. You can provide an optional
|
|
382
|
-
* callback that will be executed when the call to setState is actually
|
|
383
|
-
* completed.
|
|
384
|
-
*
|
|
385
|
-
* When a function is provided to setState, it will be called at some point in
|
|
386
|
-
* the future (not synchronously). It will be called with the up to date
|
|
387
|
-
* component arguments (state, props, context). These values can be different
|
|
388
|
-
* from this.* because your function may be called after receiveProps but before
|
|
389
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
390
|
-
* assigned to this.
|
|
391
|
-
*
|
|
392
|
-
* @param {object|function} partialState Next partial state or function to
|
|
393
|
-
* produce next partial state to be merged with current state.
|
|
394
|
-
* @param {?function} callback Called after state is updated.
|
|
395
|
-
* @final
|
|
396
|
-
* @protected
|
|
397
|
-
*/
|
|
398
|
-
|
|
399
|
-
Component.prototype.setState = function (partialState, callback) {
|
|
400
|
-
if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) {
|
|
401
|
-
throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
405
|
-
};
|
|
406
|
-
/**
|
|
407
|
-
* Forces an update. This should only be invoked when it is known with
|
|
408
|
-
* certainty that we are **not** in a DOM transaction.
|
|
409
|
-
*
|
|
410
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
411
|
-
* component's state has changed but `setState` was not called.
|
|
412
|
-
*
|
|
413
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
414
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
415
|
-
*
|
|
416
|
-
* @param {?function} callback Called after update is complete.
|
|
417
|
-
* @final
|
|
418
|
-
* @protected
|
|
419
|
-
*/
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
Component.prototype.forceUpdate = function (callback) {
|
|
423
|
-
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
424
|
-
};
|
|
425
|
-
/**
|
|
426
|
-
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
427
|
-
* we would like to deprecate them, we're not going to move them over to this
|
|
428
|
-
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
429
|
-
*/
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
{
|
|
433
|
-
var deprecatedAPIs = {
|
|
434
|
-
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
435
|
-
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
var defineDeprecationWarning = function (methodName, info) {
|
|
439
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
440
|
-
get: function () {
|
|
441
|
-
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
442
|
-
|
|
443
|
-
return undefined;
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
for (var fnName in deprecatedAPIs) {
|
|
449
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
450
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
function ComponentDummy() {}
|
|
456
|
-
|
|
457
|
-
ComponentDummy.prototype = Component.prototype;
|
|
458
|
-
/**
|
|
459
|
-
* Convenience component with default shallow equality check for sCU.
|
|
460
|
-
*/
|
|
461
|
-
|
|
462
|
-
function PureComponent(props, context, updater) {
|
|
463
|
-
this.props = props;
|
|
464
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
465
|
-
|
|
466
|
-
this.refs = emptyObject;
|
|
467
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
471
|
-
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
472
|
-
|
|
473
|
-
assign(pureComponentPrototype, Component.prototype);
|
|
474
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
475
|
-
|
|
476
|
-
// an immutable object with a single mutable value
|
|
477
|
-
function createRef() {
|
|
478
|
-
var refObject = {
|
|
479
|
-
current: null
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
{
|
|
483
|
-
Object.seal(refObject);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
return refObject;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
490
|
-
|
|
491
|
-
function isArray(a) {
|
|
492
|
-
return isArrayImpl(a);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/*
|
|
496
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
497
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
498
|
-
*
|
|
499
|
-
* The functions in this module will throw an easier-to-understand,
|
|
500
|
-
* easier-to-debug exception with a clear errors message message explaining the
|
|
501
|
-
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
502
|
-
* of the `value` object).
|
|
503
|
-
*/
|
|
504
|
-
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
505
|
-
function typeName(value) {
|
|
506
|
-
{
|
|
507
|
-
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
508
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
509
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
510
|
-
return type;
|
|
511
|
-
}
|
|
512
|
-
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
function willCoercionThrow(value) {
|
|
516
|
-
{
|
|
517
|
-
try {
|
|
518
|
-
testStringCoercion(value);
|
|
519
|
-
return false;
|
|
520
|
-
} catch (e) {
|
|
521
|
-
return true;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
function testStringCoercion(value) {
|
|
527
|
-
// If you ended up here by following an exception call stack, here's what's
|
|
528
|
-
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
529
|
-
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
530
|
-
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
531
|
-
//
|
|
532
|
-
// The most common types that will cause this exception are `Symbol` instances
|
|
533
|
-
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
534
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
535
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
536
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
537
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
538
|
-
//
|
|
539
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
540
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
541
|
-
//
|
|
542
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
543
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
544
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
545
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
546
|
-
// In most cases, this console output also shows the component and its
|
|
547
|
-
// ancestor components where the exception happened.
|
|
548
|
-
//
|
|
549
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
550
|
-
return '' + value;
|
|
551
|
-
}
|
|
552
|
-
function checkKeyStringCoercion(value) {
|
|
553
|
-
{
|
|
554
|
-
if (willCoercionThrow(value)) {
|
|
555
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
556
|
-
|
|
557
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
563
|
-
var displayName = outerType.displayName;
|
|
564
|
-
|
|
565
|
-
if (displayName) {
|
|
566
|
-
return displayName;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
var functionName = innerType.displayName || innerType.name || '';
|
|
570
|
-
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
571
|
-
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
function getContextName(type) {
|
|
575
|
-
return type.displayName || 'Context';
|
|
576
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
function getComponentNameFromType(type) {
|
|
580
|
-
if (type == null) {
|
|
581
|
-
// Host root, text node or just invalid type.
|
|
582
|
-
return null;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
{
|
|
586
|
-
if (typeof type.tag === 'number') {
|
|
587
|
-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
if (typeof type === 'function') {
|
|
592
|
-
return type.displayName || type.name || null;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
if (typeof type === 'string') {
|
|
596
|
-
return type;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
switch (type) {
|
|
600
|
-
case REACT_FRAGMENT_TYPE:
|
|
601
|
-
return 'Fragment';
|
|
602
|
-
|
|
603
|
-
case REACT_PORTAL_TYPE:
|
|
604
|
-
return 'Portal';
|
|
605
|
-
|
|
606
|
-
case REACT_PROFILER_TYPE:
|
|
607
|
-
return 'Profiler';
|
|
608
|
-
|
|
609
|
-
case REACT_STRICT_MODE_TYPE:
|
|
610
|
-
return 'StrictMode';
|
|
611
|
-
|
|
612
|
-
case REACT_SUSPENSE_TYPE:
|
|
613
|
-
return 'Suspense';
|
|
614
|
-
|
|
615
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
616
|
-
return 'SuspenseList';
|
|
617
|
-
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
if (typeof type === 'object') {
|
|
621
|
-
switch (type.$$typeof) {
|
|
622
|
-
case REACT_CONTEXT_TYPE:
|
|
623
|
-
var context = type;
|
|
624
|
-
return getContextName(context) + '.Consumer';
|
|
625
|
-
|
|
626
|
-
case REACT_PROVIDER_TYPE:
|
|
627
|
-
var provider = type;
|
|
628
|
-
return getContextName(provider._context) + '.Provider';
|
|
629
|
-
|
|
630
|
-
case REACT_FORWARD_REF_TYPE:
|
|
631
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
632
|
-
|
|
633
|
-
case REACT_MEMO_TYPE:
|
|
634
|
-
var outerName = type.displayName || null;
|
|
635
|
-
|
|
636
|
-
if (outerName !== null) {
|
|
637
|
-
return outerName;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
641
|
-
|
|
642
|
-
case REACT_LAZY_TYPE:
|
|
643
|
-
{
|
|
644
|
-
var lazyComponent = type;
|
|
645
|
-
var payload = lazyComponent._payload;
|
|
646
|
-
var init = lazyComponent._init;
|
|
647
|
-
|
|
648
|
-
try {
|
|
649
|
-
return getComponentNameFromType(init(payload));
|
|
650
|
-
} catch (x) {
|
|
651
|
-
return null;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
// eslint-disable-next-line no-fallthrough
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
return null;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
663
|
-
|
|
664
|
-
var RESERVED_PROPS = {
|
|
665
|
-
key: true,
|
|
666
|
-
ref: true,
|
|
667
|
-
__self: true,
|
|
668
|
-
__source: true
|
|
669
|
-
};
|
|
670
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
671
|
-
|
|
672
|
-
{
|
|
673
|
-
didWarnAboutStringRefs = {};
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
function hasValidRef(config) {
|
|
677
|
-
{
|
|
678
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
|
679
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
680
|
-
|
|
681
|
-
if (getter && getter.isReactWarning) {
|
|
682
|
-
return false;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
return config.ref !== undefined;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
function hasValidKey(config) {
|
|
691
|
-
{
|
|
692
|
-
if (hasOwnProperty.call(config, 'key')) {
|
|
693
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
694
|
-
|
|
695
|
-
if (getter && getter.isReactWarning) {
|
|
696
|
-
return false;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
return config.key !== undefined;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
705
|
-
var warnAboutAccessingKey = function () {
|
|
706
|
-
{
|
|
707
|
-
if (!specialPropKeyWarningShown) {
|
|
708
|
-
specialPropKeyWarningShown = true;
|
|
709
|
-
|
|
710
|
-
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);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
|
|
715
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
716
|
-
Object.defineProperty(props, 'key', {
|
|
717
|
-
get: warnAboutAccessingKey,
|
|
718
|
-
configurable: true
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
723
|
-
var warnAboutAccessingRef = function () {
|
|
724
|
-
{
|
|
725
|
-
if (!specialPropRefWarningShown) {
|
|
726
|
-
specialPropRefWarningShown = true;
|
|
727
|
-
|
|
728
|
-
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);
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
|
|
733
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
734
|
-
Object.defineProperty(props, 'ref', {
|
|
735
|
-
get: warnAboutAccessingRef,
|
|
736
|
-
configurable: true
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
741
|
-
{
|
|
742
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
743
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
744
|
-
|
|
745
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
746
|
-
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);
|
|
747
|
-
|
|
748
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
/**
|
|
754
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
755
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
756
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
757
|
-
* if something is a React Element.
|
|
758
|
-
*
|
|
759
|
-
* @param {*} type
|
|
760
|
-
* @param {*} props
|
|
761
|
-
* @param {*} key
|
|
762
|
-
* @param {string|object} ref
|
|
763
|
-
* @param {*} owner
|
|
764
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
765
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
766
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
767
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
768
|
-
* change in behavior.
|
|
769
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
770
|
-
* indicating filename, line number, and/or other information.
|
|
771
|
-
* @internal
|
|
772
|
-
*/
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
776
|
-
var element = {
|
|
777
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
778
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
779
|
-
// Built-in properties that belong on the element
|
|
780
|
-
type: type,
|
|
781
|
-
key: key,
|
|
782
|
-
ref: ref,
|
|
783
|
-
props: props,
|
|
784
|
-
// Record the component responsible for creating this element.
|
|
785
|
-
_owner: owner
|
|
786
|
-
};
|
|
787
|
-
|
|
788
|
-
{
|
|
789
|
-
// The validation flag is currently mutative. We put it on
|
|
790
|
-
// an external backing store so that we can freeze the whole object.
|
|
791
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
792
|
-
// commonly used development environments.
|
|
793
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
794
|
-
// the validation flag non-enumerable (where possible, which should
|
|
795
|
-
// include every environment we run tests in), so the test framework
|
|
796
|
-
// ignores it.
|
|
797
|
-
|
|
798
|
-
Object.defineProperty(element._store, 'validated', {
|
|
799
|
-
configurable: false,
|
|
800
|
-
enumerable: false,
|
|
801
|
-
writable: true,
|
|
802
|
-
value: false
|
|
803
|
-
}); // self and source are DEV only properties.
|
|
804
|
-
|
|
805
|
-
Object.defineProperty(element, '_self', {
|
|
806
|
-
configurable: false,
|
|
807
|
-
enumerable: false,
|
|
808
|
-
writable: false,
|
|
809
|
-
value: self
|
|
810
|
-
}); // Two elements created in two different places should be considered
|
|
811
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
812
|
-
|
|
813
|
-
Object.defineProperty(element, '_source', {
|
|
814
|
-
configurable: false,
|
|
815
|
-
enumerable: false,
|
|
816
|
-
writable: false,
|
|
817
|
-
value: source
|
|
818
|
-
});
|
|
819
|
-
|
|
820
|
-
if (Object.freeze) {
|
|
821
|
-
Object.freeze(element.props);
|
|
822
|
-
Object.freeze(element);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
return element;
|
|
827
|
-
};
|
|
828
|
-
/**
|
|
829
|
-
* Create and return a new ReactElement of the given type.
|
|
830
|
-
* See https://reactjs.org/docs/react-api.html#createelement
|
|
831
|
-
*/
|
|
832
|
-
|
|
833
|
-
function createElement(type, config, children) {
|
|
834
|
-
var propName; // Reserved names are extracted
|
|
835
|
-
|
|
836
|
-
var props = {};
|
|
837
|
-
var key = null;
|
|
838
|
-
var ref = null;
|
|
839
|
-
var self = null;
|
|
840
|
-
var source = null;
|
|
841
|
-
|
|
842
|
-
if (config != null) {
|
|
843
|
-
if (hasValidRef(config)) {
|
|
844
|
-
ref = config.ref;
|
|
845
|
-
|
|
846
|
-
{
|
|
847
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
if (hasValidKey(config)) {
|
|
852
|
-
{
|
|
853
|
-
checkKeyStringCoercion(config.key);
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
key = '' + config.key;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
self = config.__self === undefined ? null : config.__self;
|
|
860
|
-
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
861
|
-
|
|
862
|
-
for (propName in config) {
|
|
863
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
864
|
-
props[propName] = config[propName];
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
} // Children can be more than one argument, and those are transferred onto
|
|
868
|
-
// the newly allocated props object.
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
var childrenLength = arguments.length - 2;
|
|
872
|
-
|
|
873
|
-
if (childrenLength === 1) {
|
|
874
|
-
props.children = children;
|
|
875
|
-
} else if (childrenLength > 1) {
|
|
876
|
-
var childArray = Array(childrenLength);
|
|
877
|
-
|
|
878
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
879
|
-
childArray[i] = arguments[i + 2];
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
{
|
|
883
|
-
if (Object.freeze) {
|
|
884
|
-
Object.freeze(childArray);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
props.children = childArray;
|
|
889
|
-
} // Resolve default props
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
if (type && type.defaultProps) {
|
|
893
|
-
var defaultProps = type.defaultProps;
|
|
894
|
-
|
|
895
|
-
for (propName in defaultProps) {
|
|
896
|
-
if (props[propName] === undefined) {
|
|
897
|
-
props[propName] = defaultProps[propName];
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
{
|
|
903
|
-
if (key || ref) {
|
|
904
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
905
|
-
|
|
906
|
-
if (key) {
|
|
907
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
if (ref) {
|
|
911
|
-
defineRefPropWarningGetter(props, displayName);
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
917
|
-
}
|
|
918
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
|
919
|
-
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
920
|
-
return newElement;
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
|
-
* Clone and return a new ReactElement using element as the starting point.
|
|
924
|
-
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
925
|
-
*/
|
|
926
|
-
|
|
927
|
-
function cloneElement(element, config, children) {
|
|
928
|
-
if (element === null || element === undefined) {
|
|
929
|
-
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
var propName; // Original props are copied
|
|
933
|
-
|
|
934
|
-
var props = assign({}, element.props); // Reserved names are extracted
|
|
935
|
-
|
|
936
|
-
var key = element.key;
|
|
937
|
-
var ref = element.ref; // Self is preserved since the owner is preserved.
|
|
938
|
-
|
|
939
|
-
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
940
|
-
// transpiler, and the original source is probably a better indicator of the
|
|
941
|
-
// true owner.
|
|
942
|
-
|
|
943
|
-
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
944
|
-
|
|
945
|
-
var owner = element._owner;
|
|
946
|
-
|
|
947
|
-
if (config != null) {
|
|
948
|
-
if (hasValidRef(config)) {
|
|
949
|
-
// Silently steal the ref from the parent.
|
|
950
|
-
ref = config.ref;
|
|
951
|
-
owner = ReactCurrentOwner.current;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
if (hasValidKey(config)) {
|
|
955
|
-
{
|
|
956
|
-
checkKeyStringCoercion(config.key);
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
key = '' + config.key;
|
|
960
|
-
} // Remaining properties override existing props
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
var defaultProps;
|
|
964
|
-
|
|
965
|
-
if (element.type && element.type.defaultProps) {
|
|
966
|
-
defaultProps = element.type.defaultProps;
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
for (propName in config) {
|
|
970
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
971
|
-
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
972
|
-
// Resolve default props
|
|
973
|
-
props[propName] = defaultProps[propName];
|
|
974
|
-
} else {
|
|
975
|
-
props[propName] = config[propName];
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
} // Children can be more than one argument, and those are transferred onto
|
|
980
|
-
// the newly allocated props object.
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
var childrenLength = arguments.length - 2;
|
|
984
|
-
|
|
985
|
-
if (childrenLength === 1) {
|
|
986
|
-
props.children = children;
|
|
987
|
-
} else if (childrenLength > 1) {
|
|
988
|
-
var childArray = Array(childrenLength);
|
|
989
|
-
|
|
990
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
991
|
-
childArray[i] = arguments[i + 2];
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
props.children = childArray;
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
998
|
-
}
|
|
999
|
-
/**
|
|
1000
|
-
* Verifies the object is a ReactElement.
|
|
1001
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1002
|
-
* @param {?object} object
|
|
1003
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1004
|
-
* @final
|
|
1005
|
-
*/
|
|
1006
|
-
|
|
1007
|
-
function isValidElement(object) {
|
|
1008
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
var SEPARATOR = '.';
|
|
1012
|
-
var SUBSEPARATOR = ':';
|
|
1013
|
-
/**
|
|
1014
|
-
* Escape and wrap key so it is safe to use as a reactid
|
|
1015
|
-
*
|
|
1016
|
-
* @param {string} key to be escaped.
|
|
1017
|
-
* @return {string} the escaped key.
|
|
1018
|
-
*/
|
|
1019
|
-
|
|
1020
|
-
function escape(key) {
|
|
1021
|
-
var escapeRegex = /[=:]/g;
|
|
1022
|
-
var escaperLookup = {
|
|
1023
|
-
'=': '=0',
|
|
1024
|
-
':': '=2'
|
|
1025
|
-
};
|
|
1026
|
-
var escapedString = key.replace(escapeRegex, function (match) {
|
|
1027
|
-
return escaperLookup[match];
|
|
1028
|
-
});
|
|
1029
|
-
return '$' + escapedString;
|
|
1030
|
-
}
|
|
1031
|
-
/**
|
|
1032
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
1033
|
-
* pattern.
|
|
1034
|
-
*/
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
var didWarnAboutMaps = false;
|
|
1038
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1039
|
-
|
|
1040
|
-
function escapeUserProvidedKey(text) {
|
|
1041
|
-
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1042
|
-
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Generate a key string that identifies a element within a set.
|
|
1045
|
-
*
|
|
1046
|
-
* @param {*} element A element that could contain a manual key.
|
|
1047
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
1048
|
-
* @return {string}
|
|
1049
|
-
*/
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
function getElementKey(element, index) {
|
|
1053
|
-
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1054
|
-
// that we don't block potential future ES APIs.
|
|
1055
|
-
if (typeof element === 'object' && element !== null && element.key != null) {
|
|
1056
|
-
// Explicit key
|
|
1057
|
-
{
|
|
1058
|
-
checkKeyStringCoercion(element.key);
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
return escape('' + element.key);
|
|
1062
|
-
} // Implicit key determined by the index in the set
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
return index.toString(36);
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1069
|
-
var type = typeof children;
|
|
1070
|
-
|
|
1071
|
-
if (type === 'undefined' || type === 'boolean') {
|
|
1072
|
-
// All of the above are perceived as null.
|
|
1073
|
-
children = null;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
var invokeCallback = false;
|
|
1077
|
-
|
|
1078
|
-
if (children === null) {
|
|
1079
|
-
invokeCallback = true;
|
|
1080
|
-
} else {
|
|
1081
|
-
switch (type) {
|
|
1082
|
-
case 'string':
|
|
1083
|
-
case 'number':
|
|
1084
|
-
invokeCallback = true;
|
|
1085
|
-
break;
|
|
1086
|
-
|
|
1087
|
-
case 'object':
|
|
1088
|
-
switch (children.$$typeof) {
|
|
1089
|
-
case REACT_ELEMENT_TYPE:
|
|
1090
|
-
case REACT_PORTAL_TYPE:
|
|
1091
|
-
invokeCallback = true;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
if (invokeCallback) {
|
|
1098
|
-
var _child = children;
|
|
1099
|
-
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
|
1100
|
-
// so that it's consistent if the number of children grows:
|
|
1101
|
-
|
|
1102
|
-
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
1103
|
-
|
|
1104
|
-
if (isArray(mappedChild)) {
|
|
1105
|
-
var escapedChildKey = '';
|
|
1106
|
-
|
|
1107
|
-
if (childKey != null) {
|
|
1108
|
-
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
1112
|
-
return c;
|
|
1113
|
-
});
|
|
1114
|
-
} else if (mappedChild != null) {
|
|
1115
|
-
if (isValidElement(mappedChild)) {
|
|
1116
|
-
{
|
|
1117
|
-
// The `if` statement here prevents auto-disabling of the safe
|
|
1118
|
-
// coercion ESLint rule, so we must manually disable it below.
|
|
1119
|
-
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1120
|
-
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
|
1121
|
-
checkKeyStringCoercion(mappedChild.key);
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1126
|
-
// traverseAllChildren used to do for objects as children
|
|
1127
|
-
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1128
|
-
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
1129
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1130
|
-
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
array.push(mappedChild);
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
return 1;
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
var child;
|
|
1140
|
-
var nextName;
|
|
1141
|
-
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1142
|
-
|
|
1143
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1144
|
-
|
|
1145
|
-
if (isArray(children)) {
|
|
1146
|
-
for (var i = 0; i < children.length; i++) {
|
|
1147
|
-
child = children[i];
|
|
1148
|
-
nextName = nextNamePrefix + getElementKey(child, i);
|
|
1149
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1150
|
-
}
|
|
1151
|
-
} else {
|
|
1152
|
-
var iteratorFn = getIteratorFn(children);
|
|
1153
|
-
|
|
1154
|
-
if (typeof iteratorFn === 'function') {
|
|
1155
|
-
var iterableChildren = children;
|
|
1156
|
-
|
|
1157
|
-
{
|
|
1158
|
-
// Warn about using Maps as children
|
|
1159
|
-
if (iteratorFn === iterableChildren.entries) {
|
|
1160
|
-
if (!didWarnAboutMaps) {
|
|
1161
|
-
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
didWarnAboutMaps = true;
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
var iterator = iteratorFn.call(iterableChildren);
|
|
1169
|
-
var step;
|
|
1170
|
-
var ii = 0;
|
|
1171
|
-
|
|
1172
|
-
while (!(step = iterator.next()).done) {
|
|
1173
|
-
child = step.value;
|
|
1174
|
-
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
1175
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1176
|
-
}
|
|
1177
|
-
} else if (type === 'object') {
|
|
1178
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1179
|
-
var childrenString = String(children);
|
|
1180
|
-
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.');
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
return subtreeCount;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* Maps children that are typically specified as `props.children`.
|
|
1189
|
-
*
|
|
1190
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1191
|
-
*
|
|
1192
|
-
* The provided mapFunction(child, index) will be called for each
|
|
1193
|
-
* leaf child.
|
|
1194
|
-
*
|
|
1195
|
-
* @param {?*} children Children tree container.
|
|
1196
|
-
* @param {function(*, int)} func The map function.
|
|
1197
|
-
* @param {*} context Context for mapFunction.
|
|
1198
|
-
* @return {object} Object containing the ordered map of results.
|
|
1199
|
-
*/
|
|
1200
|
-
function mapChildren(children, func, context) {
|
|
1201
|
-
if (children == null) {
|
|
1202
|
-
return children;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
var result = [];
|
|
1206
|
-
var count = 0;
|
|
1207
|
-
mapIntoArray(children, result, '', '', function (child) {
|
|
1208
|
-
return func.call(context, child, count++);
|
|
1209
|
-
});
|
|
1210
|
-
return result;
|
|
1211
|
-
}
|
|
1212
|
-
/**
|
|
1213
|
-
* Count the number of children that are typically specified as
|
|
1214
|
-
* `props.children`.
|
|
1215
|
-
*
|
|
1216
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1217
|
-
*
|
|
1218
|
-
* @param {?*} children Children tree container.
|
|
1219
|
-
* @return {number} The number of children.
|
|
1220
|
-
*/
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
function countChildren(children) {
|
|
1224
|
-
var n = 0;
|
|
1225
|
-
mapChildren(children, function () {
|
|
1226
|
-
n++; // Don't return anything
|
|
1227
|
-
});
|
|
1228
|
-
return n;
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
/**
|
|
1232
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
1233
|
-
*
|
|
1234
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1235
|
-
*
|
|
1236
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
1237
|
-
* leaf child.
|
|
1238
|
-
*
|
|
1239
|
-
* @param {?*} children Children tree container.
|
|
1240
|
-
* @param {function(*, int)} forEachFunc
|
|
1241
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
1242
|
-
*/
|
|
1243
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1244
|
-
mapChildren(children, function () {
|
|
1245
|
-
forEachFunc.apply(this, arguments); // Don't return anything.
|
|
1246
|
-
}, forEachContext);
|
|
1247
|
-
}
|
|
1248
|
-
/**
|
|
1249
|
-
* Flatten a children object (typically specified as `props.children`) and
|
|
1250
|
-
* return an array with appropriately re-keyed children.
|
|
1251
|
-
*
|
|
1252
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1253
|
-
*/
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
function toArray(children) {
|
|
1257
|
-
return mapChildren(children, function (child) {
|
|
1258
|
-
return child;
|
|
1259
|
-
}) || [];
|
|
1260
|
-
}
|
|
1261
|
-
/**
|
|
1262
|
-
* Returns the first child in a collection of children and verifies that there
|
|
1263
|
-
* is only one child in the collection.
|
|
1264
|
-
*
|
|
1265
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1266
|
-
*
|
|
1267
|
-
* The current implementation of this function assumes that a single child gets
|
|
1268
|
-
* passed without a wrapper, but the purpose of this helper function is to
|
|
1269
|
-
* abstract away the particular structure of children.
|
|
1270
|
-
*
|
|
1271
|
-
* @param {?object} children Child collection structure.
|
|
1272
|
-
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1273
|
-
* structure.
|
|
1274
|
-
*/
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
function onlyChild(children) {
|
|
1278
|
-
if (!isValidElement(children)) {
|
|
1279
|
-
throw new Error('React.Children.only expected to receive a single React element child.');
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
return children;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
function createContext(defaultValue) {
|
|
1286
|
-
// TODO: Second argument used to be an optional `calculateChangedBits`
|
|
1287
|
-
// function. Warn to reserve for future use?
|
|
1288
|
-
var context = {
|
|
1289
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
1290
|
-
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1291
|
-
// some renderers as primary and others as secondary. We only expect
|
|
1292
|
-
// there to be two concurrent renderers at most: React Native (primary) and
|
|
1293
|
-
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
1294
|
-
// Secondary renderers store their context values on separate fields.
|
|
1295
|
-
_currentValue: defaultValue,
|
|
1296
|
-
_currentValue2: defaultValue,
|
|
1297
|
-
// Used to track how many concurrent renderers this context currently
|
|
1298
|
-
// supports within in a single renderer. Such as parallel server rendering.
|
|
1299
|
-
_threadCount: 0,
|
|
1300
|
-
// These are circular
|
|
1301
|
-
Provider: null,
|
|
1302
|
-
Consumer: null,
|
|
1303
|
-
// Add these to use same hidden class in VM as ServerContext
|
|
1304
|
-
_defaultValue: null,
|
|
1305
|
-
_globalName: null
|
|
1306
|
-
};
|
|
1307
|
-
context.Provider = {
|
|
1308
|
-
$$typeof: REACT_PROVIDER_TYPE,
|
|
1309
|
-
_context: context
|
|
1310
|
-
};
|
|
1311
|
-
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1312
|
-
var hasWarnedAboutUsingConsumerProvider = false;
|
|
1313
|
-
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
1314
|
-
|
|
1315
|
-
{
|
|
1316
|
-
// A separate object, but proxies back to the original context object for
|
|
1317
|
-
// backwards compatibility. It has a different $$typeof, so we can properly
|
|
1318
|
-
// warn for the incorrect usage of Context as a Consumer.
|
|
1319
|
-
var Consumer = {
|
|
1320
|
-
$$typeof: REACT_CONTEXT_TYPE,
|
|
1321
|
-
_context: context
|
|
1322
|
-
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1323
|
-
|
|
1324
|
-
Object.defineProperties(Consumer, {
|
|
1325
|
-
Provider: {
|
|
1326
|
-
get: function () {
|
|
1327
|
-
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1328
|
-
hasWarnedAboutUsingConsumerProvider = true;
|
|
1329
|
-
|
|
1330
|
-
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?');
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
return context.Provider;
|
|
1334
|
-
},
|
|
1335
|
-
set: function (_Provider) {
|
|
1336
|
-
context.Provider = _Provider;
|
|
1337
|
-
}
|
|
1338
|
-
},
|
|
1339
|
-
_currentValue: {
|
|
1340
|
-
get: function () {
|
|
1341
|
-
return context._currentValue;
|
|
1342
|
-
},
|
|
1343
|
-
set: function (_currentValue) {
|
|
1344
|
-
context._currentValue = _currentValue;
|
|
1345
|
-
}
|
|
1346
|
-
},
|
|
1347
|
-
_currentValue2: {
|
|
1348
|
-
get: function () {
|
|
1349
|
-
return context._currentValue2;
|
|
1350
|
-
},
|
|
1351
|
-
set: function (_currentValue2) {
|
|
1352
|
-
context._currentValue2 = _currentValue2;
|
|
1353
|
-
}
|
|
1354
|
-
},
|
|
1355
|
-
_threadCount: {
|
|
1356
|
-
get: function () {
|
|
1357
|
-
return context._threadCount;
|
|
1358
|
-
},
|
|
1359
|
-
set: function (_threadCount) {
|
|
1360
|
-
context._threadCount = _threadCount;
|
|
1361
|
-
}
|
|
1362
|
-
},
|
|
1363
|
-
Consumer: {
|
|
1364
|
-
get: function () {
|
|
1365
|
-
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1366
|
-
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1367
|
-
|
|
1368
|
-
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?');
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
return context.Consumer;
|
|
1372
|
-
}
|
|
1373
|
-
},
|
|
1374
|
-
displayName: {
|
|
1375
|
-
get: function () {
|
|
1376
|
-
return context.displayName;
|
|
1377
|
-
},
|
|
1378
|
-
set: function (displayName) {
|
|
1379
|
-
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
1380
|
-
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
1381
|
-
|
|
1382
|
-
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1387
|
-
|
|
1388
|
-
context.Consumer = Consumer;
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
{
|
|
1392
|
-
context._currentRenderer = null;
|
|
1393
|
-
context._currentRenderer2 = null;
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
return context;
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
var Uninitialized = -1;
|
|
1400
|
-
var Pending = 0;
|
|
1401
|
-
var Resolved = 1;
|
|
1402
|
-
var Rejected = 2;
|
|
1403
|
-
|
|
1404
|
-
function lazyInitializer(payload) {
|
|
1405
|
-
if (payload._status === Uninitialized) {
|
|
1406
|
-
var ctor = payload._result;
|
|
1407
|
-
var thenable = ctor(); // Transition to the next state.
|
|
1408
|
-
// This might throw either because it's missing or throws. If so, we treat it
|
|
1409
|
-
// as still uninitialized and try again next time. Which is the same as what
|
|
1410
|
-
// happens if the ctor or any wrappers processing the ctor throws. This might
|
|
1411
|
-
// end up fixing it if the resolution was a concurrency bug.
|
|
1412
|
-
|
|
1413
|
-
thenable.then(function (moduleObject) {
|
|
1414
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1415
|
-
// Transition to the next state.
|
|
1416
|
-
var resolved = payload;
|
|
1417
|
-
resolved._status = Resolved;
|
|
1418
|
-
resolved._result = moduleObject;
|
|
1419
|
-
}
|
|
1420
|
-
}, function (error) {
|
|
1421
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1422
|
-
// Transition to the next state.
|
|
1423
|
-
var rejected = payload;
|
|
1424
|
-
rejected._status = Rejected;
|
|
1425
|
-
rejected._result = error;
|
|
1426
|
-
}
|
|
1427
|
-
});
|
|
1428
|
-
|
|
1429
|
-
if (payload._status === Uninitialized) {
|
|
1430
|
-
// In case, we're still uninitialized, then we're waiting for the thenable
|
|
1431
|
-
// to resolve. Set it as pending in the meantime.
|
|
1432
|
-
var pending = payload;
|
|
1433
|
-
pending._status = Pending;
|
|
1434
|
-
pending._result = thenable;
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
if (payload._status === Resolved) {
|
|
1439
|
-
var moduleObject = payload._result;
|
|
1440
|
-
|
|
1441
|
-
{
|
|
1442
|
-
if (moduleObject === undefined) {
|
|
1443
|
-
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.
|
|
1444
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
{
|
|
1449
|
-
if (!('default' in moduleObject)) {
|
|
1450
|
-
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.
|
|
1451
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
return moduleObject.default;
|
|
1456
|
-
} else {
|
|
1457
|
-
throw payload._result;
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
function lazy(ctor) {
|
|
1462
|
-
var payload = {
|
|
1463
|
-
// We use these fields to store the result.
|
|
1464
|
-
_status: Uninitialized,
|
|
1465
|
-
_result: ctor
|
|
1466
|
-
};
|
|
1467
|
-
var lazyType = {
|
|
1468
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
1469
|
-
_payload: payload,
|
|
1470
|
-
_init: lazyInitializer
|
|
1471
|
-
};
|
|
1472
|
-
|
|
1473
|
-
{
|
|
1474
|
-
// In production, this would just set it on the object.
|
|
1475
|
-
var defaultProps;
|
|
1476
|
-
var propTypes; // $FlowFixMe
|
|
1477
|
-
|
|
1478
|
-
Object.defineProperties(lazyType, {
|
|
1479
|
-
defaultProps: {
|
|
1480
|
-
configurable: true,
|
|
1481
|
-
get: function () {
|
|
1482
|
-
return defaultProps;
|
|
1483
|
-
},
|
|
1484
|
-
set: function (newDefaultProps) {
|
|
1485
|
-
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.');
|
|
1486
|
-
|
|
1487
|
-
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1488
|
-
// $FlowFixMe
|
|
1489
|
-
|
|
1490
|
-
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1491
|
-
enumerable: true
|
|
1492
|
-
});
|
|
1493
|
-
}
|
|
1494
|
-
},
|
|
1495
|
-
propTypes: {
|
|
1496
|
-
configurable: true,
|
|
1497
|
-
get: function () {
|
|
1498
|
-
return propTypes;
|
|
1499
|
-
},
|
|
1500
|
-
set: function (newPropTypes) {
|
|
1501
|
-
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.');
|
|
1502
|
-
|
|
1503
|
-
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1504
|
-
// $FlowFixMe
|
|
1505
|
-
|
|
1506
|
-
Object.defineProperty(lazyType, 'propTypes', {
|
|
1507
|
-
enumerable: true
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
return lazyType;
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
function forwardRef(render) {
|
|
1518
|
-
{
|
|
1519
|
-
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1520
|
-
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1521
|
-
} else if (typeof render !== 'function') {
|
|
1522
|
-
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1523
|
-
} else {
|
|
1524
|
-
if (render.length !== 0 && render.length !== 2) {
|
|
1525
|
-
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.');
|
|
1526
|
-
}
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
if (render != null) {
|
|
1530
|
-
if (render.defaultProps != null || render.propTypes != null) {
|
|
1531
|
-
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
var elementType = {
|
|
1537
|
-
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1538
|
-
render: render
|
|
1539
|
-
};
|
|
1540
|
-
|
|
1541
|
-
{
|
|
1542
|
-
var ownName;
|
|
1543
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
1544
|
-
enumerable: false,
|
|
1545
|
-
configurable: true,
|
|
1546
|
-
get: function () {
|
|
1547
|
-
return ownName;
|
|
1548
|
-
},
|
|
1549
|
-
set: function (name) {
|
|
1550
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1551
|
-
// because the component may be used elsewhere.
|
|
1552
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
1553
|
-
// so that our component-stack generation logic will display their frames.
|
|
1554
|
-
// An anonymous function generally suggests a pattern like:
|
|
1555
|
-
// React.forwardRef((props, ref) => {...});
|
|
1556
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1557
|
-
|
|
1558
|
-
if (!render.name && !render.displayName) {
|
|
1559
|
-
render.displayName = name;
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
});
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
return elementType;
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
|
-
var REACT_MODULE_REFERENCE;
|
|
1569
|
-
|
|
1570
|
-
{
|
|
1571
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
function isValidElementType(type) {
|
|
1575
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
1576
|
-
return true;
|
|
1577
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
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 ) {
|
|
1581
|
-
return true;
|
|
1582
|
-
}
|
|
1583
|
-
|
|
1584
|
-
if (typeof type === 'object' && type !== null) {
|
|
1585
|
-
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
|
|
1586
|
-
// types supported by any Flight configuration anywhere since
|
|
1587
|
-
// we don't know which Flight build this will end up being used
|
|
1588
|
-
// with.
|
|
1589
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
1590
|
-
return true;
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
return false;
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
function memo(type, compare) {
|
|
1598
|
-
{
|
|
1599
|
-
if (!isValidElementType(type)) {
|
|
1600
|
-
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
var elementType = {
|
|
1605
|
-
$$typeof: REACT_MEMO_TYPE,
|
|
1606
|
-
type: type,
|
|
1607
|
-
compare: compare === undefined ? null : compare
|
|
1608
|
-
};
|
|
1609
|
-
|
|
1610
|
-
{
|
|
1611
|
-
var ownName;
|
|
1612
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
1613
|
-
enumerable: false,
|
|
1614
|
-
configurable: true,
|
|
1615
|
-
get: function () {
|
|
1616
|
-
return ownName;
|
|
1617
|
-
},
|
|
1618
|
-
set: function (name) {
|
|
1619
|
-
ownName = name; // The inner component shouldn't inherit this display name in most cases,
|
|
1620
|
-
// because the component may be used elsewhere.
|
|
1621
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
1622
|
-
// so that our component-stack generation logic will display their frames.
|
|
1623
|
-
// An anonymous function generally suggests a pattern like:
|
|
1624
|
-
// React.memo((props) => {...});
|
|
1625
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1626
|
-
|
|
1627
|
-
if (!type.name && !type.displayName) {
|
|
1628
|
-
type.displayName = name;
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
});
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
return elementType;
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
function resolveDispatcher() {
|
|
1638
|
-
var dispatcher = ReactCurrentDispatcher.current;
|
|
1639
|
-
|
|
1640
|
-
{
|
|
1641
|
-
if (dispatcher === null) {
|
|
1642
|
-
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.');
|
|
1643
|
-
}
|
|
1644
|
-
} // Will result in a null access error if accessed outside render phase. We
|
|
1645
|
-
// intentionally don't throw our own error because this is in a hot path.
|
|
1646
|
-
// Also helps ensure this is inlined.
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
return dispatcher;
|
|
1650
|
-
}
|
|
1651
|
-
function useContext(Context) {
|
|
1652
|
-
var dispatcher = resolveDispatcher();
|
|
1653
|
-
|
|
1654
|
-
{
|
|
1655
|
-
// TODO: add a more generic warning for invalid values.
|
|
1656
|
-
if (Context._context !== undefined) {
|
|
1657
|
-
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1658
|
-
// and nobody should be using this in existing code.
|
|
1659
|
-
|
|
1660
|
-
if (realContext.Consumer === Context) {
|
|
1661
|
-
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?');
|
|
1662
|
-
} else if (realContext.Provider === Context) {
|
|
1663
|
-
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
return dispatcher.useContext(Context);
|
|
1669
|
-
}
|
|
1670
|
-
function useState(initialState) {
|
|
1671
|
-
var dispatcher = resolveDispatcher();
|
|
1672
|
-
return dispatcher.useState(initialState);
|
|
1673
|
-
}
|
|
1674
|
-
function useReducer(reducer, initialArg, init) {
|
|
1675
|
-
var dispatcher = resolveDispatcher();
|
|
1676
|
-
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1677
|
-
}
|
|
1678
|
-
function useRef(initialValue) {
|
|
1679
|
-
var dispatcher = resolveDispatcher();
|
|
1680
|
-
return dispatcher.useRef(initialValue);
|
|
1681
|
-
}
|
|
1682
|
-
function useEffect(create, deps) {
|
|
1683
|
-
var dispatcher = resolveDispatcher();
|
|
1684
|
-
return dispatcher.useEffect(create, deps);
|
|
1685
|
-
}
|
|
1686
|
-
function useInsertionEffect(create, deps) {
|
|
1687
|
-
var dispatcher = resolveDispatcher();
|
|
1688
|
-
return dispatcher.useInsertionEffect(create, deps);
|
|
1689
|
-
}
|
|
1690
|
-
function useLayoutEffect(create, deps) {
|
|
1691
|
-
var dispatcher = resolveDispatcher();
|
|
1692
|
-
return dispatcher.useLayoutEffect(create, deps);
|
|
1693
|
-
}
|
|
1694
|
-
function useCallback(callback, deps) {
|
|
1695
|
-
var dispatcher = resolveDispatcher();
|
|
1696
|
-
return dispatcher.useCallback(callback, deps);
|
|
1697
|
-
}
|
|
1698
|
-
function useMemo(create, deps) {
|
|
1699
|
-
var dispatcher = resolveDispatcher();
|
|
1700
|
-
return dispatcher.useMemo(create, deps);
|
|
1701
|
-
}
|
|
1702
|
-
function useImperativeHandle(ref, create, deps) {
|
|
1703
|
-
var dispatcher = resolveDispatcher();
|
|
1704
|
-
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1705
|
-
}
|
|
1706
|
-
function useDebugValue(value, formatterFn) {
|
|
1707
|
-
{
|
|
1708
|
-
var dispatcher = resolveDispatcher();
|
|
1709
|
-
return dispatcher.useDebugValue(value, formatterFn);
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
function useTransition() {
|
|
1713
|
-
var dispatcher = resolveDispatcher();
|
|
1714
|
-
return dispatcher.useTransition();
|
|
1715
|
-
}
|
|
1716
|
-
function useDeferredValue(value) {
|
|
1717
|
-
var dispatcher = resolveDispatcher();
|
|
1718
|
-
return dispatcher.useDeferredValue(value);
|
|
1719
|
-
}
|
|
1720
|
-
function useId() {
|
|
1721
|
-
var dispatcher = resolveDispatcher();
|
|
1722
|
-
return dispatcher.useId();
|
|
1723
|
-
}
|
|
1724
|
-
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1725
|
-
var dispatcher = resolveDispatcher();
|
|
1726
|
-
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
1730
|
-
// replaying on render function. This currently only patches the object
|
|
1731
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
1732
|
-
// We could also eagerly patch the method.
|
|
1733
|
-
var disabledDepth = 0;
|
|
1734
|
-
var prevLog;
|
|
1735
|
-
var prevInfo;
|
|
1736
|
-
var prevWarn;
|
|
1737
|
-
var prevError;
|
|
1738
|
-
var prevGroup;
|
|
1739
|
-
var prevGroupCollapsed;
|
|
1740
|
-
var prevGroupEnd;
|
|
1741
|
-
|
|
1742
|
-
function disabledLog() {}
|
|
1743
|
-
|
|
1744
|
-
disabledLog.__reactDisabledLog = true;
|
|
1745
|
-
function disableLogs() {
|
|
1746
|
-
{
|
|
1747
|
-
if (disabledDepth === 0) {
|
|
1748
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1749
|
-
prevLog = console.log;
|
|
1750
|
-
prevInfo = console.info;
|
|
1751
|
-
prevWarn = console.warn;
|
|
1752
|
-
prevError = console.error;
|
|
1753
|
-
prevGroup = console.group;
|
|
1754
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
1755
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
1756
|
-
|
|
1757
|
-
var props = {
|
|
1758
|
-
configurable: true,
|
|
1759
|
-
enumerable: true,
|
|
1760
|
-
value: disabledLog,
|
|
1761
|
-
writable: true
|
|
1762
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1763
|
-
|
|
1764
|
-
Object.defineProperties(console, {
|
|
1765
|
-
info: props,
|
|
1766
|
-
log: props,
|
|
1767
|
-
warn: props,
|
|
1768
|
-
error: props,
|
|
1769
|
-
group: props,
|
|
1770
|
-
groupCollapsed: props,
|
|
1771
|
-
groupEnd: props
|
|
1772
|
-
});
|
|
1773
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
disabledDepth++;
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
function reenableLogs() {
|
|
1780
|
-
{
|
|
1781
|
-
disabledDepth--;
|
|
1782
|
-
|
|
1783
|
-
if (disabledDepth === 0) {
|
|
1784
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1785
|
-
var props = {
|
|
1786
|
-
configurable: true,
|
|
1787
|
-
enumerable: true,
|
|
1788
|
-
writable: true
|
|
1789
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1790
|
-
|
|
1791
|
-
Object.defineProperties(console, {
|
|
1792
|
-
log: assign({}, props, {
|
|
1793
|
-
value: prevLog
|
|
1794
|
-
}),
|
|
1795
|
-
info: assign({}, props, {
|
|
1796
|
-
value: prevInfo
|
|
1797
|
-
}),
|
|
1798
|
-
warn: assign({}, props, {
|
|
1799
|
-
value: prevWarn
|
|
1800
|
-
}),
|
|
1801
|
-
error: assign({}, props, {
|
|
1802
|
-
value: prevError
|
|
1803
|
-
}),
|
|
1804
|
-
group: assign({}, props, {
|
|
1805
|
-
value: prevGroup
|
|
1806
|
-
}),
|
|
1807
|
-
groupCollapsed: assign({}, props, {
|
|
1808
|
-
value: prevGroupCollapsed
|
|
1809
|
-
}),
|
|
1810
|
-
groupEnd: assign({}, props, {
|
|
1811
|
-
value: prevGroupEnd
|
|
1812
|
-
})
|
|
1813
|
-
});
|
|
1814
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
if (disabledDepth < 0) {
|
|
1818
|
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1824
|
-
var prefix;
|
|
1825
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1826
|
-
{
|
|
1827
|
-
if (prefix === undefined) {
|
|
1828
|
-
// Extract the VM specific prefix used by each line.
|
|
1829
|
-
try {
|
|
1830
|
-
throw Error();
|
|
1831
|
-
} catch (x) {
|
|
1832
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
1833
|
-
prefix = match && match[1] || '';
|
|
1834
|
-
}
|
|
1835
|
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
return '\n' + prefix + name;
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
var reentry = false;
|
|
1842
|
-
var componentFrameCache;
|
|
1843
|
-
|
|
1844
|
-
{
|
|
1845
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
1846
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
1850
|
-
// If something asked for a stack inside a fake render, it should get ignored.
|
|
1851
|
-
if ( !fn || reentry) {
|
|
1852
|
-
return '';
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
{
|
|
1856
|
-
var frame = componentFrameCache.get(fn);
|
|
1857
|
-
|
|
1858
|
-
if (frame !== undefined) {
|
|
1859
|
-
return frame;
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
|
|
1863
|
-
var control;
|
|
1864
|
-
reentry = true;
|
|
1865
|
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
1866
|
-
|
|
1867
|
-
Error.prepareStackTrace = undefined;
|
|
1868
|
-
var previousDispatcher;
|
|
1869
|
-
|
|
1870
|
-
{
|
|
1871
|
-
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
1872
|
-
// for warnings.
|
|
1873
|
-
|
|
1874
|
-
ReactCurrentDispatcher$1.current = null;
|
|
1875
|
-
disableLogs();
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
try {
|
|
1879
|
-
// This should throw.
|
|
1880
|
-
if (construct) {
|
|
1881
|
-
// Something should be setting the props in the constructor.
|
|
1882
|
-
var Fake = function () {
|
|
1883
|
-
throw Error();
|
|
1884
|
-
}; // $FlowFixMe
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
1888
|
-
set: function () {
|
|
1889
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
1890
|
-
// because that won't throw in a non-strict mode function.
|
|
1891
|
-
throw Error();
|
|
1892
|
-
}
|
|
1893
|
-
});
|
|
1894
|
-
|
|
1895
|
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
1896
|
-
// We construct a different control for this case to include any extra
|
|
1897
|
-
// frames added by the construct call.
|
|
1898
|
-
try {
|
|
1899
|
-
Reflect.construct(Fake, []);
|
|
1900
|
-
} catch (x) {
|
|
1901
|
-
control = x;
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
Reflect.construct(fn, [], Fake);
|
|
1905
|
-
} else {
|
|
1906
|
-
try {
|
|
1907
|
-
Fake.call();
|
|
1908
|
-
} catch (x) {
|
|
1909
|
-
control = x;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
fn.call(Fake.prototype);
|
|
1913
|
-
}
|
|
1914
|
-
} else {
|
|
1915
|
-
try {
|
|
1916
|
-
throw Error();
|
|
1917
|
-
} catch (x) {
|
|
1918
|
-
control = x;
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
|
-
fn();
|
|
1922
|
-
}
|
|
1923
|
-
} catch (sample) {
|
|
1924
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
1925
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
1926
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
1927
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
1928
|
-
var sampleLines = sample.stack.split('\n');
|
|
1929
|
-
var controlLines = control.stack.split('\n');
|
|
1930
|
-
var s = sampleLines.length - 1;
|
|
1931
|
-
var c = controlLines.length - 1;
|
|
1932
|
-
|
|
1933
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
1934
|
-
// We expect at least one stack frame to be shared.
|
|
1935
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
1936
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
1937
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
1938
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
1939
|
-
// the sample somewhere in the control.
|
|
1940
|
-
c--;
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
1944
|
-
// Next we find the first one that isn't the same which should be the
|
|
1945
|
-
// frame that called our sample function and the control.
|
|
1946
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
1947
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
1948
|
-
// If we're about to return the first line, and the control is also on the same
|
|
1949
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
1950
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
1951
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
1952
|
-
if (s !== 1 || c !== 1) {
|
|
1953
|
-
do {
|
|
1954
|
-
s--;
|
|
1955
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
1956
|
-
// The next one that isn't the same should be our match though.
|
|
1957
|
-
|
|
1958
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
1959
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
1960
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
1961
|
-
// but we have a user-provided "displayName"
|
|
1962
|
-
// splice it in to make the stack more readable.
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
1966
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
{
|
|
1970
|
-
if (typeof fn === 'function') {
|
|
1971
|
-
componentFrameCache.set(fn, _frame);
|
|
1972
|
-
}
|
|
1973
|
-
} // Return the line we found.
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
return _frame;
|
|
1977
|
-
}
|
|
1978
|
-
} while (s >= 1 && c >= 0);
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
break;
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1985
|
-
} finally {
|
|
1986
|
-
reentry = false;
|
|
1987
|
-
|
|
1988
|
-
{
|
|
1989
|
-
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
1990
|
-
reenableLogs();
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
1994
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
1998
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
1999
|
-
|
|
2000
|
-
{
|
|
2001
|
-
if (typeof fn === 'function') {
|
|
2002
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
return syntheticFrame;
|
|
2007
|
-
}
|
|
2008
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
2009
|
-
{
|
|
2010
|
-
return describeNativeComponentFrame(fn, false);
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
|
-
function shouldConstruct(Component) {
|
|
2015
|
-
var prototype = Component.prototype;
|
|
2016
|
-
return !!(prototype && prototype.isReactComponent);
|
|
2017
|
-
}
|
|
2018
|
-
|
|
2019
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
2020
|
-
|
|
2021
|
-
if (type == null) {
|
|
2022
|
-
return '';
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
if (typeof type === 'function') {
|
|
2026
|
-
{
|
|
2027
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
if (typeof type === 'string') {
|
|
2032
|
-
return describeBuiltInComponentFrame(type);
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
switch (type) {
|
|
2036
|
-
case REACT_SUSPENSE_TYPE:
|
|
2037
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
2038
|
-
|
|
2039
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
2040
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
if (typeof type === 'object') {
|
|
2044
|
-
switch (type.$$typeof) {
|
|
2045
|
-
case REACT_FORWARD_REF_TYPE:
|
|
2046
|
-
return describeFunctionComponentFrame(type.render);
|
|
2047
|
-
|
|
2048
|
-
case REACT_MEMO_TYPE:
|
|
2049
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
2050
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
2051
|
-
|
|
2052
|
-
case REACT_LAZY_TYPE:
|
|
2053
|
-
{
|
|
2054
|
-
var lazyComponent = type;
|
|
2055
|
-
var payload = lazyComponent._payload;
|
|
2056
|
-
var init = lazyComponent._init;
|
|
2057
|
-
|
|
2058
|
-
try {
|
|
2059
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
2060
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
2061
|
-
} catch (x) {}
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
return '';
|
|
2067
|
-
}
|
|
2068
|
-
|
|
2069
|
-
var loggedTypeFailures = {};
|
|
2070
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
2071
|
-
|
|
2072
|
-
function setCurrentlyValidatingElement(element) {
|
|
2073
|
-
{
|
|
2074
|
-
if (element) {
|
|
2075
|
-
var owner = element._owner;
|
|
2076
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2077
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
2078
|
-
} else {
|
|
2079
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
2085
|
-
{
|
|
2086
|
-
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
2087
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
2088
|
-
|
|
2089
|
-
for (var typeSpecName in typeSpecs) {
|
|
2090
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
2091
|
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
2092
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
2093
|
-
// After these have been cleaned up, we'll let them throw.
|
|
2094
|
-
|
|
2095
|
-
try {
|
|
2096
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
2097
|
-
// behavior as without this statement except with a better message.
|
|
2098
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
2099
|
-
// eslint-disable-next-line react-internal/prod-error-codes
|
|
2100
|
-
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`.');
|
|
2101
|
-
err.name = 'Invariant Violation';
|
|
2102
|
-
throw err;
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
2106
|
-
} catch (ex) {
|
|
2107
|
-
error$1 = ex;
|
|
2108
|
-
}
|
|
2109
|
-
|
|
2110
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
2111
|
-
setCurrentlyValidatingElement(element);
|
|
2112
|
-
|
|
2113
|
-
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);
|
|
2114
|
-
|
|
2115
|
-
setCurrentlyValidatingElement(null);
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
2119
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
2120
|
-
// same error.
|
|
2121
|
-
loggedTypeFailures[error$1.message] = true;
|
|
2122
|
-
setCurrentlyValidatingElement(element);
|
|
2123
|
-
|
|
2124
|
-
error('Failed %s type: %s', location, error$1.message);
|
|
2125
|
-
|
|
2126
|
-
setCurrentlyValidatingElement(null);
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
}
|
|
2132
|
-
|
|
2133
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
2134
|
-
{
|
|
2135
|
-
if (element) {
|
|
2136
|
-
var owner = element._owner;
|
|
2137
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2138
|
-
setExtraStackFrame(stack);
|
|
2139
|
-
} else {
|
|
2140
|
-
setExtraStackFrame(null);
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
|
|
2145
|
-
var propTypesMisspellWarningShown;
|
|
2146
|
-
|
|
2147
|
-
{
|
|
2148
|
-
propTypesMisspellWarningShown = false;
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
function getDeclarationErrorAddendum() {
|
|
2152
|
-
if (ReactCurrentOwner.current) {
|
|
2153
|
-
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
2154
|
-
|
|
2155
|
-
if (name) {
|
|
2156
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
return '';
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
function getSourceInfoErrorAddendum(source) {
|
|
2164
|
-
if (source !== undefined) {
|
|
2165
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
2166
|
-
var lineNumber = source.lineNumber;
|
|
2167
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
2168
|
-
}
|
|
2169
|
-
|
|
2170
|
-
return '';
|
|
2171
|
-
}
|
|
2172
|
-
|
|
2173
|
-
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
2174
|
-
if (elementProps !== null && elementProps !== undefined) {
|
|
2175
|
-
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
return '';
|
|
2179
|
-
}
|
|
2180
|
-
/**
|
|
2181
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
2182
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
2183
|
-
* updates.
|
|
2184
|
-
*/
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
var ownerHasKeyUseWarning = {};
|
|
2188
|
-
|
|
2189
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
2190
|
-
var info = getDeclarationErrorAddendum();
|
|
2191
|
-
|
|
2192
|
-
if (!info) {
|
|
2193
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
2194
|
-
|
|
2195
|
-
if (parentName) {
|
|
2196
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
|
|
2200
|
-
return info;
|
|
2201
|
-
}
|
|
2202
|
-
/**
|
|
2203
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
2204
|
-
* This element is in an array. The array could grow and shrink or be
|
|
2205
|
-
* reordered. All children that haven't already been validated are required to
|
|
2206
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
2207
|
-
* will only be shown once.
|
|
2208
|
-
*
|
|
2209
|
-
* @internal
|
|
2210
|
-
* @param {ReactElement} element Element that requires a key.
|
|
2211
|
-
* @param {*} parentType element's parent's type.
|
|
2212
|
-
*/
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
function validateExplicitKey(element, parentType) {
|
|
2216
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
2217
|
-
return;
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
|
-
element._store.validated = true;
|
|
2221
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2222
|
-
|
|
2223
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2224
|
-
return;
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
2228
|
-
// property, it may be the creator of the child that's responsible for
|
|
2229
|
-
// assigning it a key.
|
|
2230
|
-
|
|
2231
|
-
var childOwner = '';
|
|
2232
|
-
|
|
2233
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
2234
|
-
// Give the component that originally created this child.
|
|
2235
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
|
-
{
|
|
2239
|
-
setCurrentlyValidatingElement$1(element);
|
|
2240
|
-
|
|
2241
|
-
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);
|
|
2242
|
-
|
|
2243
|
-
setCurrentlyValidatingElement$1(null);
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
/**
|
|
2247
|
-
* Ensure that every element either is passed in a static location, in an
|
|
2248
|
-
* array with an explicit keys property defined, or in an object literal
|
|
2249
|
-
* with valid key property.
|
|
2250
|
-
*
|
|
2251
|
-
* @internal
|
|
2252
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
2253
|
-
* @param {*} parentType node's parent's type.
|
|
2254
|
-
*/
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
function validateChildKeys(node, parentType) {
|
|
2258
|
-
if (typeof node !== 'object') {
|
|
2259
|
-
return;
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
if (isArray(node)) {
|
|
2263
|
-
for (var i = 0; i < node.length; i++) {
|
|
2264
|
-
var child = node[i];
|
|
2265
|
-
|
|
2266
|
-
if (isValidElement(child)) {
|
|
2267
|
-
validateExplicitKey(child, parentType);
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
} else if (isValidElement(node)) {
|
|
2271
|
-
// This element was passed in a valid location.
|
|
2272
|
-
if (node._store) {
|
|
2273
|
-
node._store.validated = true;
|
|
2274
|
-
}
|
|
2275
|
-
} else if (node) {
|
|
2276
|
-
var iteratorFn = getIteratorFn(node);
|
|
2277
|
-
|
|
2278
|
-
if (typeof iteratorFn === 'function') {
|
|
2279
|
-
// Entry iterators used to provide implicit keys,
|
|
2280
|
-
// but now we print a separate warning for them later.
|
|
2281
|
-
if (iteratorFn !== node.entries) {
|
|
2282
|
-
var iterator = iteratorFn.call(node);
|
|
2283
|
-
var step;
|
|
2284
|
-
|
|
2285
|
-
while (!(step = iterator.next()).done) {
|
|
2286
|
-
if (isValidElement(step.value)) {
|
|
2287
|
-
validateExplicitKey(step.value, parentType);
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
}
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
}
|
|
2294
|
-
/**
|
|
2295
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
2296
|
-
* provided by the type.
|
|
2297
|
-
*
|
|
2298
|
-
* @param {ReactElement} element
|
|
2299
|
-
*/
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
function validatePropTypes(element) {
|
|
2303
|
-
{
|
|
2304
|
-
var type = element.type;
|
|
2305
|
-
|
|
2306
|
-
if (type === null || type === undefined || typeof type === 'string') {
|
|
2307
|
-
return;
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
var propTypes;
|
|
2311
|
-
|
|
2312
|
-
if (typeof type === 'function') {
|
|
2313
|
-
propTypes = type.propTypes;
|
|
2314
|
-
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
2315
|
-
// Inner props are checked in the reconciler.
|
|
2316
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2317
|
-
propTypes = type.propTypes;
|
|
2318
|
-
} else {
|
|
2319
|
-
return;
|
|
2320
|
-
}
|
|
2321
|
-
|
|
2322
|
-
if (propTypes) {
|
|
2323
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
2324
|
-
var name = getComponentNameFromType(type);
|
|
2325
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
2326
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2327
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
2328
|
-
|
|
2329
|
-
var _name = getComponentNameFromType(type);
|
|
2330
|
-
|
|
2331
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2335
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
/**
|
|
2340
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
2341
|
-
* @param {ReactElement} fragment
|
|
2342
|
-
*/
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
function validateFragmentProps(fragment) {
|
|
2346
|
-
{
|
|
2347
|
-
var keys = Object.keys(fragment.props);
|
|
2348
|
-
|
|
2349
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2350
|
-
var key = keys[i];
|
|
2351
|
-
|
|
2352
|
-
if (key !== 'children' && key !== 'key') {
|
|
2353
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2354
|
-
|
|
2355
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2356
|
-
|
|
2357
|
-
setCurrentlyValidatingElement$1(null);
|
|
2358
|
-
break;
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
if (fragment.ref !== null) {
|
|
2363
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2364
|
-
|
|
2365
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2366
|
-
|
|
2367
|
-
setCurrentlyValidatingElement$1(null);
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
function createElementWithValidation(type, props, children) {
|
|
2372
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
2373
|
-
// succeed and there will likely be errors in render.
|
|
2374
|
-
|
|
2375
|
-
if (!validType) {
|
|
2376
|
-
var info = '';
|
|
2377
|
-
|
|
2378
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2379
|
-
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.";
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
|
-
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
2383
|
-
|
|
2384
|
-
if (sourceInfo) {
|
|
2385
|
-
info += sourceInfo;
|
|
2386
|
-
} else {
|
|
2387
|
-
info += getDeclarationErrorAddendum();
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
|
-
var typeString;
|
|
2391
|
-
|
|
2392
|
-
if (type === null) {
|
|
2393
|
-
typeString = 'null';
|
|
2394
|
-
} else if (isArray(type)) {
|
|
2395
|
-
typeString = 'array';
|
|
2396
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2397
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
2398
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2399
|
-
} else {
|
|
2400
|
-
typeString = typeof type;
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
{
|
|
2404
|
-
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);
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
|
|
2408
|
-
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
2409
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2410
|
-
|
|
2411
|
-
if (element == null) {
|
|
2412
|
-
return element;
|
|
2413
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2414
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2415
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
2416
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2417
|
-
// fixed, the key warnings will appear.)
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
if (validType) {
|
|
2421
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
2422
|
-
validateChildKeys(arguments[i], type);
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
|
|
2426
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
2427
|
-
validateFragmentProps(element);
|
|
2428
|
-
} else {
|
|
2429
|
-
validatePropTypes(element);
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2432
|
-
return element;
|
|
2433
|
-
}
|
|
2434
|
-
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2435
|
-
function createFactoryWithValidation(type) {
|
|
2436
|
-
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2437
|
-
validatedFactory.type = type;
|
|
2438
|
-
|
|
2439
|
-
{
|
|
2440
|
-
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2441
|
-
didWarnAboutDeprecatedCreateFactory = true;
|
|
2442
|
-
|
|
2443
|
-
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2444
|
-
} // Legacy hook: remove it
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
Object.defineProperty(validatedFactory, 'type', {
|
|
2448
|
-
enumerable: false,
|
|
2449
|
-
get: function () {
|
|
2450
|
-
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2451
|
-
|
|
2452
|
-
Object.defineProperty(this, 'type', {
|
|
2453
|
-
value: type
|
|
2454
|
-
});
|
|
2455
|
-
return type;
|
|
2456
|
-
}
|
|
2457
|
-
});
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
|
-
return validatedFactory;
|
|
2461
|
-
}
|
|
2462
|
-
function cloneElementWithValidation(element, props, children) {
|
|
2463
|
-
var newElement = cloneElement.apply(this, arguments);
|
|
2464
|
-
|
|
2465
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
2466
|
-
validateChildKeys(arguments[i], newElement.type);
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
validatePropTypes(newElement);
|
|
2470
|
-
return newElement;
|
|
2471
|
-
}
|
|
2472
|
-
|
|
2473
|
-
function startTransition(scope, options) {
|
|
2474
|
-
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
2475
|
-
ReactCurrentBatchConfig.transition = {};
|
|
2476
|
-
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
2477
|
-
|
|
2478
|
-
{
|
|
2479
|
-
ReactCurrentBatchConfig.transition._updatedFibers = new Set();
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
try {
|
|
2483
|
-
scope();
|
|
2484
|
-
} finally {
|
|
2485
|
-
ReactCurrentBatchConfig.transition = prevTransition;
|
|
2486
|
-
|
|
2487
|
-
{
|
|
2488
|
-
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
2489
|
-
var updatedFibersCount = currentTransition._updatedFibers.size;
|
|
2490
|
-
|
|
2491
|
-
if (updatedFibersCount > 10) {
|
|
2492
|
-
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.');
|
|
2493
|
-
}
|
|
2494
|
-
|
|
2495
|
-
currentTransition._updatedFibers.clear();
|
|
2496
|
-
}
|
|
2497
|
-
}
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
|
|
2501
|
-
var didWarnAboutMessageChannel = false;
|
|
2502
|
-
var enqueueTaskImpl = null;
|
|
2503
|
-
function enqueueTask(task) {
|
|
2504
|
-
if (enqueueTaskImpl === null) {
|
|
2505
|
-
try {
|
|
2506
|
-
// read require off the module object to get around the bundlers.
|
|
2507
|
-
// we don't want them to detect a require and bundle a Node polyfill.
|
|
2508
|
-
var requireString = ('require' + Math.random()).slice(0, 7);
|
|
2509
|
-
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
|
2510
|
-
// version of setImmediate, bypassing fake timers if any.
|
|
2511
|
-
|
|
2512
|
-
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
|
2513
|
-
} catch (_err) {
|
|
2514
|
-
// we're in a browser
|
|
2515
|
-
// we can't use regular timers because they may still be faked
|
|
2516
|
-
// so we try MessageChannel+postMessage instead
|
|
2517
|
-
enqueueTaskImpl = function (callback) {
|
|
2518
|
-
{
|
|
2519
|
-
if (didWarnAboutMessageChannel === false) {
|
|
2520
|
-
didWarnAboutMessageChannel = true;
|
|
2521
|
-
|
|
2522
|
-
if (typeof MessageChannel === 'undefined') {
|
|
2523
|
-
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.');
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
|
|
2528
|
-
var channel = new MessageChannel();
|
|
2529
|
-
channel.port1.onmessage = callback;
|
|
2530
|
-
channel.port2.postMessage(undefined);
|
|
2531
|
-
};
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
return enqueueTaskImpl(task);
|
|
2536
|
-
}
|
|
2537
|
-
|
|
2538
|
-
var actScopeDepth = 0;
|
|
2539
|
-
var didWarnNoAwaitAct = false;
|
|
2540
|
-
function act(callback) {
|
|
2541
|
-
{
|
|
2542
|
-
// `act` calls can be nested, so we track the depth. This represents the
|
|
2543
|
-
// number of `act` scopes on the stack.
|
|
2544
|
-
var prevActScopeDepth = actScopeDepth;
|
|
2545
|
-
actScopeDepth++;
|
|
2546
|
-
|
|
2547
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2548
|
-
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
|
2549
|
-
// will detect the queue and use it instead of Scheduler.
|
|
2550
|
-
ReactCurrentActQueue.current = [];
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2553
|
-
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
2554
|
-
var result;
|
|
2555
|
-
|
|
2556
|
-
try {
|
|
2557
|
-
// Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
|
2558
|
-
// set to `true` while the given callback is executed, not for updates
|
|
2559
|
-
// triggered during an async event, because this is how the legacy
|
|
2560
|
-
// implementation of `act` behaved.
|
|
2561
|
-
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
2562
|
-
result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
|
|
2563
|
-
// which flushed updates immediately after the scope function exits, even
|
|
2564
|
-
// if it's an async function.
|
|
2565
|
-
|
|
2566
|
-
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
2567
|
-
var queue = ReactCurrentActQueue.current;
|
|
2568
|
-
|
|
2569
|
-
if (queue !== null) {
|
|
2570
|
-
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
2571
|
-
flushActQueue(queue);
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
} catch (error) {
|
|
2575
|
-
popActScope(prevActScopeDepth);
|
|
2576
|
-
throw error;
|
|
2577
|
-
} finally {
|
|
2578
|
-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
|
-
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
|
2582
|
-
var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
|
|
2583
|
-
// for it to resolve before exiting the current scope.
|
|
2584
|
-
|
|
2585
|
-
var wasAwaited = false;
|
|
2586
|
-
var thenable = {
|
|
2587
|
-
then: function (resolve, reject) {
|
|
2588
|
-
wasAwaited = true;
|
|
2589
|
-
thenableResult.then(function (returnValue) {
|
|
2590
|
-
popActScope(prevActScopeDepth);
|
|
2591
|
-
|
|
2592
|
-
if (actScopeDepth === 0) {
|
|
2593
|
-
// We've exited the outermost act scope. Recursively flush the
|
|
2594
|
-
// queue until there's no remaining work.
|
|
2595
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2596
|
-
} else {
|
|
2597
|
-
resolve(returnValue);
|
|
2598
|
-
}
|
|
2599
|
-
}, function (error) {
|
|
2600
|
-
// The callback threw an error.
|
|
2601
|
-
popActScope(prevActScopeDepth);
|
|
2602
|
-
reject(error);
|
|
2603
|
-
});
|
|
2604
|
-
}
|
|
2605
|
-
};
|
|
2606
|
-
|
|
2607
|
-
{
|
|
2608
|
-
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
|
2609
|
-
// eslint-disable-next-line no-undef
|
|
2610
|
-
Promise.resolve().then(function () {}).then(function () {
|
|
2611
|
-
if (!wasAwaited) {
|
|
2612
|
-
didWarnNoAwaitAct = true;
|
|
2613
|
-
|
|
2614
|
-
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 () => ...);');
|
|
2615
|
-
}
|
|
2616
|
-
});
|
|
2617
|
-
}
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
return thenable;
|
|
2621
|
-
} else {
|
|
2622
|
-
var returnValue = result; // The callback is not an async function. Exit the current scope
|
|
2623
|
-
// immediately, without awaiting.
|
|
2624
|
-
|
|
2625
|
-
popActScope(prevActScopeDepth);
|
|
2626
|
-
|
|
2627
|
-
if (actScopeDepth === 0) {
|
|
2628
|
-
// Exiting the outermost act scope. Flush the queue.
|
|
2629
|
-
var _queue = ReactCurrentActQueue.current;
|
|
2630
|
-
|
|
2631
|
-
if (_queue !== null) {
|
|
2632
|
-
flushActQueue(_queue);
|
|
2633
|
-
ReactCurrentActQueue.current = null;
|
|
2634
|
-
} // Return a thenable. If the user awaits it, we'll flush again in
|
|
2635
|
-
// case additional work was scheduled by a microtask.
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
var _thenable = {
|
|
2639
|
-
then: function (resolve, reject) {
|
|
2640
|
-
// Confirm we haven't re-entered another `act` scope, in case
|
|
2641
|
-
// the user does something weird like await the thenable
|
|
2642
|
-
// multiple times.
|
|
2643
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2644
|
-
// Recursively flush the queue until there's no remaining work.
|
|
2645
|
-
ReactCurrentActQueue.current = [];
|
|
2646
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2647
|
-
} else {
|
|
2648
|
-
resolve(returnValue);
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2651
|
-
};
|
|
2652
|
-
return _thenable;
|
|
2653
|
-
} else {
|
|
2654
|
-
// Since we're inside a nested `act` scope, the returned thenable
|
|
2655
|
-
// immediately resolves. The outer scope will flush the queue.
|
|
2656
|
-
var _thenable2 = {
|
|
2657
|
-
then: function (resolve, reject) {
|
|
2658
|
-
resolve(returnValue);
|
|
2659
|
-
}
|
|
2660
|
-
};
|
|
2661
|
-
return _thenable2;
|
|
2662
|
-
}
|
|
2663
|
-
}
|
|
2664
|
-
}
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
function popActScope(prevActScopeDepth) {
|
|
2668
|
-
{
|
|
2669
|
-
if (prevActScopeDepth !== actScopeDepth - 1) {
|
|
2670
|
-
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
2671
|
-
}
|
|
2672
|
-
|
|
2673
|
-
actScopeDepth = prevActScopeDepth;
|
|
2674
|
-
}
|
|
2675
|
-
}
|
|
2676
|
-
|
|
2677
|
-
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
2678
|
-
{
|
|
2679
|
-
var queue = ReactCurrentActQueue.current;
|
|
2680
|
-
|
|
2681
|
-
if (queue !== null) {
|
|
2682
|
-
try {
|
|
2683
|
-
flushActQueue(queue);
|
|
2684
|
-
enqueueTask(function () {
|
|
2685
|
-
if (queue.length === 0) {
|
|
2686
|
-
// No additional work was scheduled. Finish.
|
|
2687
|
-
ReactCurrentActQueue.current = null;
|
|
2688
|
-
resolve(returnValue);
|
|
2689
|
-
} else {
|
|
2690
|
-
// Keep flushing work until there's none left.
|
|
2691
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2692
|
-
}
|
|
2693
|
-
});
|
|
2694
|
-
} catch (error) {
|
|
2695
|
-
reject(error);
|
|
2696
|
-
}
|
|
2697
|
-
} else {
|
|
2698
|
-
resolve(returnValue);
|
|
2699
|
-
}
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
var isFlushing = false;
|
|
2704
|
-
|
|
2705
|
-
function flushActQueue(queue) {
|
|
2706
|
-
{
|
|
2707
|
-
if (!isFlushing) {
|
|
2708
|
-
// Prevent re-entrance.
|
|
2709
|
-
isFlushing = true;
|
|
2710
|
-
var i = 0;
|
|
2711
|
-
|
|
2712
|
-
try {
|
|
2713
|
-
for (; i < queue.length; i++) {
|
|
2714
|
-
var callback = queue[i];
|
|
2715
|
-
|
|
2716
|
-
do {
|
|
2717
|
-
callback = callback(true);
|
|
2718
|
-
} while (callback !== null);
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
queue.length = 0;
|
|
2722
|
-
} catch (error) {
|
|
2723
|
-
// If something throws, leave the remaining callbacks on the queue.
|
|
2724
|
-
queue = queue.slice(i + 1);
|
|
2725
|
-
throw error;
|
|
2726
|
-
} finally {
|
|
2727
|
-
isFlushing = false;
|
|
2728
|
-
}
|
|
2729
|
-
}
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
|
|
2733
|
-
var createElement$1 = createElementWithValidation ;
|
|
2734
|
-
var cloneElement$1 = cloneElementWithValidation ;
|
|
2735
|
-
var createFactory = createFactoryWithValidation ;
|
|
2736
|
-
var Children = {
|
|
2737
|
-
map: mapChildren,
|
|
2738
|
-
forEach: forEachChildren,
|
|
2739
|
-
count: countChildren,
|
|
2740
|
-
toArray: toArray,
|
|
2741
|
-
only: onlyChild
|
|
2742
|
-
};
|
|
2743
|
-
|
|
2744
|
-
exports.Children = Children;
|
|
2745
|
-
exports.Component = Component;
|
|
2746
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
2747
|
-
exports.Profiler = REACT_PROFILER_TYPE;
|
|
2748
|
-
exports.PureComponent = PureComponent;
|
|
2749
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2750
|
-
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
2751
|
-
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
2752
|
-
exports.cloneElement = cloneElement$1;
|
|
2753
|
-
exports.createContext = createContext;
|
|
2754
|
-
exports.createElement = createElement$1;
|
|
2755
|
-
exports.createFactory = createFactory;
|
|
2756
|
-
exports.createRef = createRef;
|
|
2757
|
-
exports.forwardRef = forwardRef;
|
|
2758
|
-
exports.isValidElement = isValidElement;
|
|
2759
|
-
exports.lazy = lazy;
|
|
2760
|
-
exports.memo = memo;
|
|
2761
|
-
exports.startTransition = startTransition;
|
|
2762
|
-
exports.unstable_act = act;
|
|
2763
|
-
exports.useCallback = useCallback;
|
|
2764
|
-
exports.useContext = useContext;
|
|
2765
|
-
exports.useDebugValue = useDebugValue;
|
|
2766
|
-
exports.useDeferredValue = useDeferredValue;
|
|
2767
|
-
exports.useEffect = useEffect;
|
|
2768
|
-
exports.useId = useId;
|
|
2769
|
-
exports.useImperativeHandle = useImperativeHandle;
|
|
2770
|
-
exports.useInsertionEffect = useInsertionEffect;
|
|
2771
|
-
exports.useLayoutEffect = useLayoutEffect;
|
|
2772
|
-
exports.useMemo = useMemo;
|
|
2773
|
-
exports.useReducer = useReducer;
|
|
2774
|
-
exports.useRef = useRef;
|
|
2775
|
-
exports.useState = useState;
|
|
2776
|
-
exports.useSyncExternalStore = useSyncExternalStore;
|
|
2777
|
-
exports.useTransition = useTransition;
|
|
2778
|
-
exports.version = ReactVersion;
|
|
2779
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
2780
|
-
if (
|
|
2781
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
2782
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
2783
|
-
'function'
|
|
2784
|
-
) {
|
|
2785
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
|
-
})();
|
|
2789
|
-
}
|
|
2790
|
-
} (react_development, react_development.exports));
|
|
2791
|
-
return react_development.exports;
|
|
2792
|
-
}
|
|
2793
|
-
|
|
2794
|
-
var hasRequiredReact;
|
|
2795
|
-
|
|
2796
|
-
function requireReact () {
|
|
2797
|
-
if (hasRequiredReact) return react.exports;
|
|
2798
|
-
hasRequiredReact = 1;
|
|
2799
|
-
(function (module) {
|
|
2800
|
-
|
|
2801
|
-
if (process.env.NODE_ENV === 'production') {
|
|
2802
|
-
module.exports = requireReact_production_min();
|
|
2803
|
-
} else {
|
|
2804
|
-
module.exports = requireReact_development();
|
|
2805
|
-
}
|
|
2806
|
-
} (react));
|
|
2807
|
-
return react.exports;
|
|
2808
|
-
}
|
|
2809
|
-
|
|
2810
10
|
/**
|
|
2811
11
|
* @license React
|
|
2812
12
|
* react-jsx-runtime.production.min.js
|
|
@@ -2822,7 +22,7 @@ var hasRequiredReactJsxRuntime_production_min;
|
|
|
2822
22
|
function requireReactJsxRuntime_production_min () {
|
|
2823
23
|
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
2824
24
|
hasRequiredReactJsxRuntime_production_min = 1;
|
|
2825
|
-
var f=
|
|
25
|
+
var f=React__default,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
|
|
2826
26
|
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
|
|
2827
27
|
return reactJsxRuntime_production_min;
|
|
2828
28
|
}
|
|
@@ -2848,7 +48,7 @@ function requireReactJsxRuntime_development () {
|
|
|
2848
48
|
if (process.env.NODE_ENV !== "production") {
|
|
2849
49
|
(function() {
|
|
2850
50
|
|
|
2851
|
-
var React =
|
|
51
|
+
var React = React__default;
|
|
2852
52
|
|
|
2853
53
|
// ATTENTION
|
|
2854
54
|
// When adding new symbols to this file,
|
|
@@ -4206,8 +1406,6 @@ var _extends = {exports: {}};
|
|
|
4206
1406
|
module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
4207
1407
|
} (_extends));
|
|
4208
1408
|
|
|
4209
|
-
var reactExports = requireReact();
|
|
4210
|
-
|
|
4211
1409
|
function memoize$1(fn) {
|
|
4212
1410
|
var cache = Object.create(null);
|
|
4213
1411
|
return function (arg) {
|
|
@@ -5775,7 +2973,7 @@ function requireEmotionUseInsertionEffectWithFallbacks_cjs_prod () {
|
|
|
5775
2973
|
|
|
5776
2974
|
Object.defineProperty(emotionUseInsertionEffectWithFallbacks_cjs_prod, '__esModule', { value: true });
|
|
5777
2975
|
|
|
5778
|
-
var React =
|
|
2976
|
+
var React = React__default;
|
|
5779
2977
|
|
|
5780
2978
|
function _interopNamespace(e) {
|
|
5781
2979
|
if (e && e.__esModule) return e;
|
|
@@ -5824,7 +3022,7 @@ function requireEmotionUseInsertionEffectWithFallbacks_cjs_dev () {
|
|
|
5824
3022
|
|
|
5825
3023
|
Object.defineProperty(emotionUseInsertionEffectWithFallbacks_cjs_dev, '__esModule', { value: true });
|
|
5826
3024
|
|
|
5827
|
-
var React =
|
|
3025
|
+
var React = React__default;
|
|
5828
3026
|
|
|
5829
3027
|
function _interopNamespace(e) {
|
|
5830
3028
|
if (e && e.__esModule) return e;
|
|
@@ -5875,7 +3073,7 @@ function requireEmotionUseInsertionEffectWithFallbacks_cjs_dev () {
|
|
|
5875
3073
|
var isBrowser$2 = typeof document !== 'undefined';
|
|
5876
3074
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
5877
3075
|
|
|
5878
|
-
var EmotionCacheContext = /* #__PURE__ */
|
|
3076
|
+
var EmotionCacheContext = /* #__PURE__ */createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
|
|
5879
3077
|
// because this module is primarily intended for the browser and node
|
|
5880
3078
|
// but it's also required in react native and similar environments sometimes
|
|
5881
3079
|
// and we could have a special build just for that
|
|
@@ -5893,9 +3091,9 @@ EmotionCacheContext.Provider;
|
|
|
5893
3091
|
|
|
5894
3092
|
var withEmotionCache = function withEmotionCache(func) {
|
|
5895
3093
|
// $FlowFixMe
|
|
5896
|
-
return /*#__PURE__*/
|
|
3094
|
+
return /*#__PURE__*/forwardRef(function (props, ref) {
|
|
5897
3095
|
// the cache will never be null in the browser
|
|
5898
|
-
var cache =
|
|
3096
|
+
var cache = useContext(EmotionCacheContext);
|
|
5899
3097
|
return func(props, cache, ref);
|
|
5900
3098
|
});
|
|
5901
3099
|
};
|
|
@@ -5903,7 +3101,7 @@ var withEmotionCache = function withEmotionCache(func) {
|
|
|
5903
3101
|
if (!isBrowser$2) {
|
|
5904
3102
|
withEmotionCache = function withEmotionCache(func) {
|
|
5905
3103
|
return function (props) {
|
|
5906
|
-
var cache =
|
|
3104
|
+
var cache = useContext(EmotionCacheContext);
|
|
5907
3105
|
|
|
5908
3106
|
if (cache === null) {
|
|
5909
3107
|
// yes, we're potentially creating this on every render
|
|
@@ -5914,7 +3112,7 @@ if (!isBrowser$2) {
|
|
|
5914
3112
|
cache = createCache({
|
|
5915
3113
|
key: 'css'
|
|
5916
3114
|
});
|
|
5917
|
-
return /*#__PURE__*/
|
|
3115
|
+
return /*#__PURE__*/createElement(EmotionCacheContext.Provider, {
|
|
5918
3116
|
value: cache
|
|
5919
3117
|
}, func(props, cache));
|
|
5920
3118
|
} else {
|
|
@@ -5924,7 +3122,7 @@ if (!isBrowser$2) {
|
|
|
5924
3122
|
};
|
|
5925
3123
|
}
|
|
5926
3124
|
|
|
5927
|
-
var ThemeContext$2 = /* #__PURE__ */
|
|
3125
|
+
var ThemeContext$2 = /* #__PURE__ */createContext({});
|
|
5928
3126
|
|
|
5929
3127
|
if (process.env.NODE_ENV !== 'production') {
|
|
5930
3128
|
ThemeContext$2.displayName = 'EmotionThemeContext';
|
|
@@ -5953,7 +3151,7 @@ var Insertion$2 = function Insertion(_ref) {
|
|
|
5953
3151
|
next = next.next;
|
|
5954
3152
|
}
|
|
5955
3153
|
|
|
5956
|
-
return /*#__PURE__*/
|
|
3154
|
+
return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
|
|
5957
3155
|
__html: rules
|
|
5958
3156
|
}, _ref2.nonce = cache.sheet.nonce, _ref2));
|
|
5959
3157
|
}
|
|
@@ -5980,7 +3178,7 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
5980
3178
|
className = props.className + " ";
|
|
5981
3179
|
}
|
|
5982
3180
|
|
|
5983
|
-
var serialized = serializeStyles(registeredStyles, undefined,
|
|
3181
|
+
var serialized = serializeStyles(registeredStyles, undefined, useContext(ThemeContext$2));
|
|
5984
3182
|
|
|
5985
3183
|
if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
|
|
5986
3184
|
var labelFromStack = props[labelPropName];
|
|
@@ -6001,11 +3199,11 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
6001
3199
|
|
|
6002
3200
|
newProps.ref = ref;
|
|
6003
3201
|
newProps.className = className;
|
|
6004
|
-
return /*#__PURE__*/
|
|
3202
|
+
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion$2, {
|
|
6005
3203
|
cache: cache,
|
|
6006
3204
|
serialized: serialized,
|
|
6007
3205
|
isStringTag: typeof WrappedComponent === 'string'
|
|
6008
|
-
}), /*#__PURE__*/
|
|
3206
|
+
}), /*#__PURE__*/createElement(WrappedComponent, newProps));
|
|
6009
3207
|
});
|
|
6010
3208
|
|
|
6011
3209
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -6150,7 +3348,7 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
6150
3348
|
}
|
|
6151
3349
|
|
|
6152
3350
|
var styles = props.styles;
|
|
6153
|
-
var serialized = serializeStyles([styles], undefined,
|
|
3351
|
+
var serialized = serializeStyles([styles], undefined, useContext(ThemeContext$2));
|
|
6154
3352
|
|
|
6155
3353
|
if (!isBrowser$2) {
|
|
6156
3354
|
var _ref;
|
|
@@ -6175,7 +3373,7 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
6175
3373
|
return null;
|
|
6176
3374
|
}
|
|
6177
3375
|
|
|
6178
|
-
return /*#__PURE__*/
|
|
3376
|
+
return /*#__PURE__*/createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + "-global " + serializedNames, _ref.dangerouslySetInnerHTML = {
|
|
6179
3377
|
__html: rules
|
|
6180
3378
|
}, _ref.nonce = cache.sheet.nonce, _ref));
|
|
6181
3379
|
} // yes, i know these hooks are used conditionally
|
|
@@ -6184,7 +3382,7 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
6184
3382
|
// so it's not actually breaking anything
|
|
6185
3383
|
|
|
6186
3384
|
|
|
6187
|
-
var sheetRef =
|
|
3385
|
+
var sheetRef = useRef();
|
|
6188
3386
|
emotionUseInsertionEffectWithFallbacks_cjs.exports.useInsertionEffectWithLayoutFallback(function () {
|
|
6189
3387
|
var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675
|
|
6190
3388
|
|
|
@@ -6329,7 +3527,7 @@ var Insertion$1 = function Insertion(_ref) {
|
|
|
6329
3527
|
if (!isBrowser$2 && rules.length !== 0) {
|
|
6330
3528
|
var _ref2;
|
|
6331
3529
|
|
|
6332
|
-
return /*#__PURE__*/
|
|
3530
|
+
return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedArr.map(function (serialized) {
|
|
6333
3531
|
return serialized.name;
|
|
6334
3532
|
}).join(' '), _ref2.dangerouslySetInnerHTML = {
|
|
6335
3533
|
__html: rules
|
|
@@ -6374,11 +3572,11 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
6374
3572
|
var content = {
|
|
6375
3573
|
css: css,
|
|
6376
3574
|
cx: cx,
|
|
6377
|
-
theme:
|
|
3575
|
+
theme: useContext(ThemeContext$2)
|
|
6378
3576
|
};
|
|
6379
3577
|
var ele = props.children(content);
|
|
6380
3578
|
hasRendered = true;
|
|
6381
|
-
return /*#__PURE__*/
|
|
3579
|
+
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion$1, {
|
|
6382
3580
|
cache: cache,
|
|
6383
3581
|
serializedArr: serializedArr
|
|
6384
3582
|
}), ele);
|
|
@@ -6460,7 +3658,7 @@ var Insertion = function Insertion(_ref) {
|
|
|
6460
3658
|
next = next.next;
|
|
6461
3659
|
}
|
|
6462
3660
|
|
|
6463
|
-
return /*#__PURE__*/
|
|
3661
|
+
return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
|
|
6464
3662
|
__html: rules
|
|
6465
3663
|
}, _ref2.nonce = cache.sheet.nonce, _ref2));
|
|
6466
3664
|
}
|
|
@@ -6530,7 +3728,7 @@ var createStyled$1 = function createStyled(tag, options) {
|
|
|
6530
3728
|
mergedProps[key] = props[key];
|
|
6531
3729
|
}
|
|
6532
3730
|
|
|
6533
|
-
mergedProps.theme =
|
|
3731
|
+
mergedProps.theme = useContext(ThemeContext$2);
|
|
6534
3732
|
}
|
|
6535
3733
|
|
|
6536
3734
|
if (typeof props.className === 'string') {
|
|
@@ -6560,11 +3758,11 @@ var createStyled$1 = function createStyled(tag, options) {
|
|
|
6560
3758
|
|
|
6561
3759
|
newProps.className = className;
|
|
6562
3760
|
newProps.ref = ref;
|
|
6563
|
-
return /*#__PURE__*/
|
|
3761
|
+
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
|
|
6564
3762
|
cache: cache,
|
|
6565
3763
|
serialized: serialized,
|
|
6566
3764
|
isStringTag: typeof FinalTag === 'string'
|
|
6567
|
-
}), /*#__PURE__*/
|
|
3765
|
+
}), /*#__PURE__*/createElement(FinalTag, newProps));
|
|
6568
3766
|
});
|
|
6569
3767
|
Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
|
|
6570
3768
|
Styled.defaultProps = tag.defaultProps;
|
|
@@ -9222,17 +6420,17 @@ function createTheme$1(options = {}, ...args) {
|
|
|
9222
6420
|
return muiTheme;
|
|
9223
6421
|
}
|
|
9224
6422
|
|
|
9225
|
-
const ThemeContext = /*#__PURE__*/
|
|
6423
|
+
const ThemeContext = /*#__PURE__*/React.createContext(null);
|
|
9226
6424
|
if (process.env.NODE_ENV !== 'production') {
|
|
9227
6425
|
ThemeContext.displayName = 'ThemeContext';
|
|
9228
6426
|
}
|
|
9229
6427
|
var ThemeContext$1 = ThemeContext;
|
|
9230
6428
|
|
|
9231
6429
|
function useTheme$2() {
|
|
9232
|
-
const theme =
|
|
6430
|
+
const theme = React.useContext(ThemeContext$1);
|
|
9233
6431
|
if (process.env.NODE_ENV !== 'production') {
|
|
9234
6432
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
9235
|
-
|
|
6433
|
+
React.useDebugValue(theme);
|
|
9236
6434
|
}
|
|
9237
6435
|
return theme;
|
|
9238
6436
|
}
|
|
@@ -9269,7 +6467,7 @@ function ThemeProvider$1(props) {
|
|
|
9269
6467
|
console.error(['MUI: You are providing a theme function prop to the ThemeProvider component:', '<ThemeProvider theme={outerTheme => outerTheme} />', '', 'However, no outer theme is present.', 'Make sure a theme is already injected higher in the React tree ' + 'or provide a theme object.'].join('\n'));
|
|
9270
6468
|
}
|
|
9271
6469
|
}
|
|
9272
|
-
const theme =
|
|
6470
|
+
const theme = React.useMemo(() => {
|
|
9273
6471
|
const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
|
|
9274
6472
|
if (output != null) {
|
|
9275
6473
|
output[nested] = outerTheme !== null;
|
|
@@ -9319,7 +6517,7 @@ function createBox(options = {}) {
|
|
|
9319
6517
|
const BoxRoot = styled$2('div', {
|
|
9320
6518
|
shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
|
|
9321
6519
|
})(styleFunctionSx$1);
|
|
9322
|
-
const Box = /*#__PURE__*/
|
|
6520
|
+
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
|
9323
6521
|
const theme = useTheme(defaultTheme);
|
|
9324
6522
|
const _extendSxProp = extendSxProp(inProps),
|
|
9325
6523
|
{
|
|
@@ -10180,7 +7378,7 @@ function useCurrentColorScheme(options) {
|
|
|
10180
7378
|
storageWindow = typeof window === 'undefined' ? undefined : window
|
|
10181
7379
|
} = options;
|
|
10182
7380
|
const joinedColorSchemes = supportedColorSchemes.join(',');
|
|
10183
|
-
const [state, setState] =
|
|
7381
|
+
const [state, setState] = React.useState(() => {
|
|
10184
7382
|
const initialMode = initializeValue(modeStorageKey, defaultMode);
|
|
10185
7383
|
const lightColorScheme = initializeValue(`${colorSchemeStorageKey}-light`, defaultLightColorScheme);
|
|
10186
7384
|
const darkColorScheme = initializeValue(`${colorSchemeStorageKey}-dark`, defaultDarkColorScheme);
|
|
@@ -10192,7 +7390,7 @@ function useCurrentColorScheme(options) {
|
|
|
10192
7390
|
};
|
|
10193
7391
|
});
|
|
10194
7392
|
const colorScheme = getColorScheme(state);
|
|
10195
|
-
const setMode =
|
|
7393
|
+
const setMode = React.useCallback(mode => {
|
|
10196
7394
|
setState(currentState => {
|
|
10197
7395
|
if (mode === currentState.mode) {
|
|
10198
7396
|
// do nothing if mode does not change
|
|
@@ -10210,7 +7408,7 @@ function useCurrentColorScheme(options) {
|
|
|
10210
7408
|
});
|
|
10211
7409
|
});
|
|
10212
7410
|
}, [modeStorageKey, defaultMode]);
|
|
10213
|
-
const setColorScheme =
|
|
7411
|
+
const setColorScheme = React.useCallback(value => {
|
|
10214
7412
|
if (!value) {
|
|
10215
7413
|
setState(currentState => {
|
|
10216
7414
|
try {
|
|
@@ -10279,7 +7477,7 @@ function useCurrentColorScheme(options) {
|
|
|
10279
7477
|
});
|
|
10280
7478
|
}
|
|
10281
7479
|
}, [joinedColorSchemes, colorSchemeStorageKey, defaultLightColorScheme, defaultDarkColorScheme]);
|
|
10282
|
-
const handleMediaQuery =
|
|
7480
|
+
const handleMediaQuery = React.useCallback(e => {
|
|
10283
7481
|
if (state.mode === 'system') {
|
|
10284
7482
|
setState(currentState => _extends$1({}, currentState, {
|
|
10285
7483
|
systemMode: e != null && e.matches ? 'dark' : 'light'
|
|
@@ -10288,9 +7486,9 @@ function useCurrentColorScheme(options) {
|
|
|
10288
7486
|
}, [state.mode]);
|
|
10289
7487
|
|
|
10290
7488
|
// Ref hack to avoid adding handleMediaQuery as a dep
|
|
10291
|
-
const mediaListener =
|
|
7489
|
+
const mediaListener = React.useRef(handleMediaQuery);
|
|
10292
7490
|
mediaListener.current = handleMediaQuery;
|
|
10293
|
-
|
|
7491
|
+
React.useEffect(() => {
|
|
10294
7492
|
const handler = (...args) => mediaListener.current(...args);
|
|
10295
7493
|
|
|
10296
7494
|
// Always listen to System preference
|
|
@@ -10303,7 +7501,7 @@ function useCurrentColorScheme(options) {
|
|
|
10303
7501
|
}, []);
|
|
10304
7502
|
|
|
10305
7503
|
// Handle when localStorage has changed
|
|
10306
|
-
|
|
7504
|
+
React.useEffect(() => {
|
|
10307
7505
|
const handleStorage = event => {
|
|
10308
7506
|
const value = event.newValue;
|
|
10309
7507
|
if (typeof event.key === 'string' && event.key.startsWith(colorSchemeStorageKey) && (!value || joinedColorSchemes.match(value))) {
|
|
@@ -10355,9 +7553,9 @@ function createCssVarsProvider(options) {
|
|
|
10355
7553
|
if (!defaultTheme.colorSchemes || typeof designSystemColorScheme === 'string' && !defaultTheme.colorSchemes[designSystemColorScheme] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.light] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.dark]) {
|
|
10356
7554
|
console.error(`MUI: \`${designSystemColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
|
|
10357
7555
|
}
|
|
10358
|
-
const ColorSchemeContext = /*#__PURE__*/
|
|
7556
|
+
const ColorSchemeContext = /*#__PURE__*/React.createContext(undefined);
|
|
10359
7557
|
const useColorScheme = () => {
|
|
10360
|
-
const value =
|
|
7558
|
+
const value = React.useContext(ColorSchemeContext);
|
|
10361
7559
|
if (!value) {
|
|
10362
7560
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`useColorScheme\` must be called under <CssVarsProvider />` : formatMuiErrorMessage(19));
|
|
10363
7561
|
}
|
|
@@ -10380,9 +7578,9 @@ function createCssVarsProvider(options) {
|
|
|
10380
7578
|
disableNestedContext = false,
|
|
10381
7579
|
disableStyleSheetGeneration = false
|
|
10382
7580
|
}) {
|
|
10383
|
-
const hasMounted =
|
|
7581
|
+
const hasMounted = React.useRef(false);
|
|
10384
7582
|
const upperTheme = useTheme$2();
|
|
10385
|
-
const ctx =
|
|
7583
|
+
const ctx = React.useContext(ColorSchemeContext);
|
|
10386
7584
|
const nested = !!ctx && !disableNestedContext;
|
|
10387
7585
|
const {
|
|
10388
7586
|
colorSchemes = {},
|
|
@@ -10512,7 +7710,7 @@ function createCssVarsProvider(options) {
|
|
|
10512
7710
|
|
|
10513
7711
|
// 5. Declaring effects
|
|
10514
7712
|
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
|
10515
|
-
|
|
7713
|
+
React.useEffect(() => {
|
|
10516
7714
|
if (colorScheme && colorSchemeNode) {
|
|
10517
7715
|
// attaches attribute to <html> because the css variables are attached to :root (html)
|
|
10518
7716
|
colorSchemeNode.setAttribute(attribute, colorScheme);
|
|
@@ -10521,7 +7719,7 @@ function createCssVarsProvider(options) {
|
|
|
10521
7719
|
|
|
10522
7720
|
// 5.2 Remove the CSS transition when color scheme changes to create instant experience.
|
|
10523
7721
|
// credit: https://github.com/pacocoursey/next-themes/blob/b5c2bad50de2d61ad7b52a9c5cdc801a78507d7a/index.tsx#L313
|
|
10524
|
-
|
|
7722
|
+
React.useEffect(() => {
|
|
10525
7723
|
let timer;
|
|
10526
7724
|
if (disableTransitionOnChange && hasMounted.current && documentNode) {
|
|
10527
7725
|
const css = documentNode.createElement('style');
|
|
@@ -10538,13 +7736,13 @@ function createCssVarsProvider(options) {
|
|
|
10538
7736
|
clearTimeout(timer);
|
|
10539
7737
|
};
|
|
10540
7738
|
}, [colorScheme, disableTransitionOnChange, documentNode]);
|
|
10541
|
-
|
|
7739
|
+
React.useEffect(() => {
|
|
10542
7740
|
hasMounted.current = true;
|
|
10543
7741
|
return () => {
|
|
10544
7742
|
hasMounted.current = false;
|
|
10545
7743
|
};
|
|
10546
7744
|
}, []);
|
|
10547
|
-
const contextValue =
|
|
7745
|
+
const contextValue = React.useMemo(() => ({
|
|
10548
7746
|
mode,
|
|
10549
7747
|
systemMode,
|
|
10550
7748
|
setMode,
|
|
@@ -10558,8 +7756,8 @@ function createCssVarsProvider(options) {
|
|
|
10558
7756
|
if (disableStyleSheetGeneration || nested && (upperTheme == null ? void 0 : upperTheme.cssVarPrefix) === cssVarPrefix) {
|
|
10559
7757
|
shouldGenerateStyleSheet = false;
|
|
10560
7758
|
}
|
|
10561
|
-
const element = /*#__PURE__*/jsxRuntime.exports.jsxs(
|
|
10562
|
-
children: [shouldGenerateStyleSheet && /*#__PURE__*/jsxRuntime.exports.jsxs(
|
|
7759
|
+
const element = /*#__PURE__*/jsxRuntime.exports.jsxs(React.Fragment, {
|
|
7760
|
+
children: [shouldGenerateStyleSheet && /*#__PURE__*/jsxRuntime.exports.jsxs(React.Fragment, {
|
|
10563
7761
|
children: [/*#__PURE__*/jsxRuntime.exports.jsx(GlobalStyles, {
|
|
10564
7762
|
styles: {
|
|
10565
7763
|
[colorSchemeSelector]: rootCss
|
|
@@ -10774,7 +7972,7 @@ function createContainer(options = {}) {
|
|
|
10774
7972
|
maxWidth: `${theme.breakpoints.values[ownerState.maxWidth]}${theme.breakpoints.unit}`
|
|
10775
7973
|
}
|
|
10776
7974
|
}));
|
|
10777
|
-
const Container = /*#__PURE__*/
|
|
7975
|
+
const Container = /*#__PURE__*/React.forwardRef(function Container(inProps, ref) {
|
|
10778
7976
|
const props = useThemeProps(inProps);
|
|
10779
7977
|
const {
|
|
10780
7978
|
className,
|
|
@@ -11129,8 +8327,8 @@ function createGrid(options = {}) {
|
|
|
11129
8327
|
useThemeProps = useThemePropsDefault$1,
|
|
11130
8328
|
componentName = 'MuiGrid'
|
|
11131
8329
|
} = options;
|
|
11132
|
-
const NestedContext = /*#__PURE__*/
|
|
11133
|
-
const OverflowContext = /*#__PURE__*/
|
|
8330
|
+
const NestedContext = /*#__PURE__*/React.createContext(false);
|
|
8331
|
+
const OverflowContext = /*#__PURE__*/React.createContext(undefined);
|
|
11134
8332
|
const useUtilityClasses = (ownerState, theme) => {
|
|
11135
8333
|
const {
|
|
11136
8334
|
container,
|
|
@@ -11145,13 +8343,13 @@ function createGrid(options = {}) {
|
|
|
11145
8343
|
return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});
|
|
11146
8344
|
};
|
|
11147
8345
|
const GridRoot = createStyledComponent(generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridSizeStyles, generateGridDirectionStyles, generateGridStyles, generateGridOffsetStyles);
|
|
11148
|
-
const Grid = /*#__PURE__*/
|
|
8346
|
+
const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
|
11149
8347
|
var _inProps$columns, _inProps$spacing, _ref, _inProps$rowSpacing, _ref2, _inProps$columnSpacin, _ref3, _disableEqualOverflow;
|
|
11150
8348
|
const theme = useTheme();
|
|
11151
8349
|
const themeProps = useThemeProps(inProps);
|
|
11152
8350
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
11153
|
-
const nested =
|
|
11154
|
-
const overflow =
|
|
8351
|
+
const nested = React.useContext(NestedContext);
|
|
8352
|
+
const overflow = React.useContext(OverflowContext);
|
|
11155
8353
|
const {
|
|
11156
8354
|
className,
|
|
11157
8355
|
columns: columnsProp = 12,
|
|
@@ -11441,11 +8639,11 @@ function useThemePropsDefault(props) {
|
|
|
11441
8639
|
* [1,0,2,0,3]
|
|
11442
8640
|
*/
|
|
11443
8641
|
function joinChildren(children, separator) {
|
|
11444
|
-
const childrenArray =
|
|
8642
|
+
const childrenArray = React.Children.toArray(children).filter(Boolean);
|
|
11445
8643
|
return childrenArray.reduce((output, child, index) => {
|
|
11446
8644
|
output.push(child);
|
|
11447
8645
|
if (index < childrenArray.length - 1) {
|
|
11448
|
-
output.push( /*#__PURE__*/
|
|
8646
|
+
output.push( /*#__PURE__*/React.cloneElement(separator, {
|
|
11449
8647
|
key: `separator-${index}`
|
|
11450
8648
|
}));
|
|
11451
8649
|
}
|
|
@@ -11529,7 +8727,7 @@ function createStack(options = {}) {
|
|
|
11529
8727
|
return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});
|
|
11530
8728
|
};
|
|
11531
8729
|
const StackRoot = createStyledComponent(style);
|
|
11532
|
-
const Stack = /*#__PURE__*/
|
|
8730
|
+
const Stack = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
|
11533
8731
|
const themeProps = useThemeProps(inProps);
|
|
11534
8732
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
11535
8733
|
const {
|