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