@visactor/react-vrender 0.12.22-alpha.14 → 0.14.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1887 -2428
- package/dist/index.min.js +2 -2
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -63,28 +63,115 @@
|
|
|
63
63
|
|
|
64
64
|
var react_production_min = {};
|
|
65
65
|
|
|
66
|
+
/*
|
|
67
|
+
object-assign
|
|
68
|
+
(c) Sindre Sorhus
|
|
69
|
+
@license MIT
|
|
70
|
+
*/
|
|
71
|
+
var objectAssign;
|
|
72
|
+
var hasRequiredObjectAssign;
|
|
73
|
+
function requireObjectAssign() {
|
|
74
|
+
if (hasRequiredObjectAssign) return objectAssign;
|
|
75
|
+
hasRequiredObjectAssign = 1;
|
|
76
|
+
/* eslint-disable no-unused-vars */
|
|
77
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
78
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
79
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
80
|
+
function toObject(val) {
|
|
81
|
+
if (val === null || val === undefined) {
|
|
82
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
83
|
+
}
|
|
84
|
+
return Object(val);
|
|
85
|
+
}
|
|
86
|
+
function shouldUseNative() {
|
|
87
|
+
try {
|
|
88
|
+
if (!Object.assign) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
93
|
+
|
|
94
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
95
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
96
|
+
test1[5] = 'de';
|
|
97
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
102
|
+
var test2 = {};
|
|
103
|
+
for (var i = 0; i < 10; i++) {
|
|
104
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
105
|
+
}
|
|
106
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
107
|
+
return test2[n];
|
|
108
|
+
});
|
|
109
|
+
if (order2.join('') !== '0123456789') {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
114
|
+
var test3 = {};
|
|
115
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
116
|
+
test3[letter] = letter;
|
|
117
|
+
});
|
|
118
|
+
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
} catch (err) {
|
|
123
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
128
|
+
var from;
|
|
129
|
+
var to = toObject(target);
|
|
130
|
+
var symbols;
|
|
131
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
132
|
+
from = Object(arguments[s]);
|
|
133
|
+
for (var key in from) {
|
|
134
|
+
if (hasOwnProperty.call(from, key)) {
|
|
135
|
+
to[key] = from[key];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (getOwnPropertySymbols) {
|
|
139
|
+
symbols = getOwnPropertySymbols(from);
|
|
140
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
141
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
142
|
+
to[symbols[i]] = from[symbols[i]];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return to;
|
|
148
|
+
};
|
|
149
|
+
return objectAssign;
|
|
150
|
+
}
|
|
151
|
+
|
|
66
152
|
var hasRequiredReact_production_min;
|
|
67
153
|
function requireReact_production_min() {
|
|
68
154
|
if (hasRequiredReact_production_min) return react_production_min;
|
|
69
155
|
hasRequiredReact_production_min = 1;
|
|
70
|
-
var l =
|
|
71
|
-
n = Symbol["for"]
|
|
72
|
-
p = Symbol["for"]("react.
|
|
73
|
-
q = Symbol["for"]("react.
|
|
74
|
-
r = Symbol["for"]("react.
|
|
75
|
-
t = Symbol["for"]("react.
|
|
76
|
-
u = Symbol["for"]("react.
|
|
77
|
-
v = Symbol["for"]("react.
|
|
78
|
-
w = Symbol["for"]("react.
|
|
79
|
-
x = Symbol["for"]("react.
|
|
80
|
-
y = Symbol["for"]("react.
|
|
81
|
-
z = Symbol.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
156
|
+
var l = requireObjectAssign(),
|
|
157
|
+
n = "function" === typeof Symbol && Symbol["for"],
|
|
158
|
+
p = n ? Symbol["for"]("react.element") : 60103,
|
|
159
|
+
q = n ? Symbol["for"]("react.portal") : 60106,
|
|
160
|
+
r = n ? Symbol["for"]("react.fragment") : 60107,
|
|
161
|
+
t = n ? Symbol["for"]("react.strict_mode") : 60108,
|
|
162
|
+
u = n ? Symbol["for"]("react.profiler") : 60114,
|
|
163
|
+
v = n ? Symbol["for"]("react.provider") : 60109,
|
|
164
|
+
w = n ? Symbol["for"]("react.context") : 60110,
|
|
165
|
+
x = n ? Symbol["for"]("react.forward_ref") : 60112,
|
|
166
|
+
y = n ? Symbol["for"]("react.suspense") : 60113,
|
|
167
|
+
z = n ? Symbol["for"]("react.memo") : 60115,
|
|
168
|
+
A = n ? Symbol["for"]("react.lazy") : 60116,
|
|
169
|
+
B = "function" === typeof Symbol && Symbol.iterator;
|
|
170
|
+
function C(a) {
|
|
171
|
+
for (var b = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, c = 1; c < arguments.length; c++) b += "&args[]=" + encodeURIComponent(arguments[c]);
|
|
172
|
+
return "Minified React error #" + a + "; visit " + b + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
|
|
86
173
|
}
|
|
87
|
-
var
|
|
174
|
+
var D = {
|
|
88
175
|
isMounted: function isMounted() {
|
|
89
176
|
return !1;
|
|
90
177
|
},
|
|
@@ -92,69 +179,67 @@
|
|
|
92
179
|
enqueueReplaceState: function enqueueReplaceState() {},
|
|
93
180
|
enqueueSetState: function enqueueSetState() {}
|
|
94
181
|
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
function E(a, b, e) {
|
|
182
|
+
E = {};
|
|
183
|
+
function F(a, b, c) {
|
|
98
184
|
this.props = a;
|
|
99
185
|
this.context = b;
|
|
100
|
-
this.refs =
|
|
101
|
-
this.updater =
|
|
186
|
+
this.refs = E;
|
|
187
|
+
this.updater = c || D;
|
|
102
188
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if ("object" !== _typeof(a) && "function" !== typeof a && null != a) throw Error(
|
|
189
|
+
F.prototype.isReactComponent = {};
|
|
190
|
+
F.prototype.setState = function (a, b) {
|
|
191
|
+
if ("object" !== _typeof(a) && "function" !== typeof a && null != a) throw Error(C(85));
|
|
106
192
|
this.updater.enqueueSetState(this, a, b, "setState");
|
|
107
193
|
};
|
|
108
|
-
|
|
194
|
+
F.prototype.forceUpdate = function (a) {
|
|
109
195
|
this.updater.enqueueForceUpdate(this, a, "forceUpdate");
|
|
110
196
|
};
|
|
111
|
-
function
|
|
112
|
-
|
|
113
|
-
function
|
|
197
|
+
function G() {}
|
|
198
|
+
G.prototype = F.prototype;
|
|
199
|
+
function H(a, b, c) {
|
|
114
200
|
this.props = a;
|
|
115
201
|
this.context = b;
|
|
116
|
-
this.refs =
|
|
117
|
-
this.updater =
|
|
202
|
+
this.refs = E;
|
|
203
|
+
this.updater = c || D;
|
|
118
204
|
}
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
var
|
|
124
|
-
J = Object.prototype.hasOwnProperty,
|
|
125
|
-
K = {
|
|
205
|
+
var I = H.prototype = new G();
|
|
206
|
+
I.constructor = H;
|
|
207
|
+
l(I, F.prototype);
|
|
208
|
+
I.isPureReactComponent = !0;
|
|
209
|
+
var J = {
|
|
126
210
|
current: null
|
|
127
211
|
},
|
|
212
|
+
K = Object.prototype.hasOwnProperty,
|
|
128
213
|
L = {
|
|
129
214
|
key: !0,
|
|
130
215
|
ref: !0,
|
|
131
216
|
__self: !0,
|
|
132
217
|
__source: !0
|
|
133
218
|
};
|
|
134
|
-
function M(a, b,
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (null != b) for (
|
|
140
|
-
var
|
|
141
|
-
if (1 ===
|
|
142
|
-
for (var
|
|
143
|
-
|
|
219
|
+
function M(a, b, c) {
|
|
220
|
+
var e,
|
|
221
|
+
d = {},
|
|
222
|
+
g = null,
|
|
223
|
+
k = null;
|
|
224
|
+
if (null != b) for (e in void 0 !== b.ref && (k = b.ref), void 0 !== b.key && (g = "" + b.key), b) K.call(b, e) && !L.hasOwnProperty(e) && (d[e] = b[e]);
|
|
225
|
+
var f = arguments.length - 2;
|
|
226
|
+
if (1 === f) d.children = c;else if (1 < f) {
|
|
227
|
+
for (var h = Array(f), m = 0; m < f; m++) h[m] = arguments[m + 2];
|
|
228
|
+
d.children = h;
|
|
144
229
|
}
|
|
145
|
-
if (a && a.defaultProps) for (
|
|
230
|
+
if (a && a.defaultProps) for (e in f = a.defaultProps, f) void 0 === d[e] && (d[e] = f[e]);
|
|
146
231
|
return {
|
|
147
|
-
$$typeof:
|
|
232
|
+
$$typeof: p,
|
|
148
233
|
type: a,
|
|
149
|
-
key:
|
|
150
|
-
ref:
|
|
151
|
-
props:
|
|
152
|
-
_owner:
|
|
234
|
+
key: g,
|
|
235
|
+
ref: k,
|
|
236
|
+
props: d,
|
|
237
|
+
_owner: J.current
|
|
153
238
|
};
|
|
154
239
|
}
|
|
155
240
|
function N(a, b) {
|
|
156
241
|
return {
|
|
157
|
-
$$typeof:
|
|
242
|
+
$$typeof: p,
|
|
158
243
|
type: a.type,
|
|
159
244
|
key: b,
|
|
160
245
|
ref: a.ref,
|
|
@@ -163,154 +248,191 @@
|
|
|
163
248
|
};
|
|
164
249
|
}
|
|
165
250
|
function O(a) {
|
|
166
|
-
return "object" === _typeof(a) && null !== a && a.$$typeof ===
|
|
251
|
+
return "object" === _typeof(a) && null !== a && a.$$typeof === p;
|
|
167
252
|
}
|
|
168
253
|
function escape(a) {
|
|
169
254
|
var b = {
|
|
170
255
|
"=": "=0",
|
|
171
256
|
":": "=2"
|
|
172
257
|
};
|
|
173
|
-
return "$" + a.replace(/[=:]/g, function (a) {
|
|
258
|
+
return "$" + ("" + a).replace(/[=:]/g, function (a) {
|
|
174
259
|
return b[a];
|
|
175
260
|
});
|
|
176
261
|
}
|
|
177
|
-
var P = /\/+/g
|
|
178
|
-
|
|
179
|
-
|
|
262
|
+
var P = /\/+/g,
|
|
263
|
+
Q = [];
|
|
264
|
+
function R(a, b, c, e) {
|
|
265
|
+
if (Q.length) {
|
|
266
|
+
var d = Q.pop();
|
|
267
|
+
d.result = a;
|
|
268
|
+
d.keyPrefix = b;
|
|
269
|
+
d.func = c;
|
|
270
|
+
d.context = e;
|
|
271
|
+
d.count = 0;
|
|
272
|
+
return d;
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
result: a,
|
|
276
|
+
keyPrefix: b,
|
|
277
|
+
func: c,
|
|
278
|
+
context: e,
|
|
279
|
+
count: 0
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function S(a) {
|
|
283
|
+
a.result = null;
|
|
284
|
+
a.keyPrefix = null;
|
|
285
|
+
a.func = null;
|
|
286
|
+
a.context = null;
|
|
287
|
+
a.count = 0;
|
|
288
|
+
10 > Q.length && Q.push(a);
|
|
180
289
|
}
|
|
181
|
-
function
|
|
182
|
-
var
|
|
183
|
-
if ("undefined" ===
|
|
184
|
-
var
|
|
185
|
-
if (null === a)
|
|
290
|
+
function T(a, b, c, e) {
|
|
291
|
+
var d = _typeof(a);
|
|
292
|
+
if ("undefined" === d || "boolean" === d) a = null;
|
|
293
|
+
var g = !1;
|
|
294
|
+
if (null === a) g = !0;else switch (d) {
|
|
186
295
|
case "string":
|
|
187
296
|
case "number":
|
|
188
|
-
|
|
297
|
+
g = !0;
|
|
189
298
|
break;
|
|
190
299
|
case "object":
|
|
191
300
|
switch (a.$$typeof) {
|
|
192
|
-
case
|
|
193
|
-
case
|
|
194
|
-
|
|
301
|
+
case p:
|
|
302
|
+
case q:
|
|
303
|
+
g = !0;
|
|
195
304
|
}
|
|
196
305
|
}
|
|
197
|
-
if (
|
|
306
|
+
if (g) return c(e, a, "" === b ? "." + U(a, 0) : b), 1;
|
|
307
|
+
g = 0;
|
|
308
|
+
b = "" === b ? "." : b + ":";
|
|
309
|
+
if (Array.isArray(a)) for (var k = 0; k < a.length; k++) {
|
|
310
|
+
d = a[k];
|
|
311
|
+
var f = b + U(d, k);
|
|
312
|
+
g += T(d, f, c, e);
|
|
313
|
+
} else if (null === a || "object" !== _typeof(a) ? f = null : (f = B && a[B] || a["@@iterator"], f = "function" === typeof f ? f : null), "function" === typeof f) for (a = f.call(a), k = 0; !(d = a.next()).done;) d = d.value, f = b + U(d, k++), g += T(d, f, c, e);else if ("object" === d) throw c = "" + a, Error(C(31, "[object Object]" === c ? "object with keys {" + Object.keys(a).join(", ") + "}" : c, ""));
|
|
314
|
+
return g;
|
|
315
|
+
}
|
|
316
|
+
function V(a, b, c) {
|
|
317
|
+
return null == a ? 0 : T(a, "", b, c);
|
|
318
|
+
}
|
|
319
|
+
function U(a, b) {
|
|
320
|
+
return "object" === _typeof(a) && null !== a && null != a.key ? escape(a.key) : b.toString(36);
|
|
321
|
+
}
|
|
322
|
+
function W(a, b) {
|
|
323
|
+
a.func.call(a.context, b, a.count++);
|
|
324
|
+
}
|
|
325
|
+
function aa(a, b, c) {
|
|
326
|
+
var e = a.result,
|
|
327
|
+
d = a.keyPrefix;
|
|
328
|
+
a = a.func.call(a.context, b, a.count++);
|
|
329
|
+
Array.isArray(a) ? X(a, e, c, function (a) {
|
|
198
330
|
return a;
|
|
199
|
-
})
|
|
200
|
-
h = 0;
|
|
201
|
-
d = "" === d ? "." : d + ":";
|
|
202
|
-
if (I(a)) for (var g = 0; g < a.length; g++) {
|
|
203
|
-
k = a[g];
|
|
204
|
-
var f = d + Q(k, g);
|
|
205
|
-
h += R(k, b, e, f, c);
|
|
206
|
-
} 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.");
|
|
207
|
-
return h;
|
|
331
|
+
}) : null != a && (O(a) && (a = N(a, d + (!a.key || b && b.key === a.key ? "" : ("" + a.key).replace(P, "$&/") + "/") + c)), e.push(a));
|
|
208
332
|
}
|
|
209
|
-
function
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
});
|
|
216
|
-
return d;
|
|
333
|
+
function X(a, b, c, e, d) {
|
|
334
|
+
var g = "";
|
|
335
|
+
null != c && (g = ("" + c).replace(P, "$&/") + "/");
|
|
336
|
+
b = R(b, g, e, d);
|
|
337
|
+
V(a, aa, b);
|
|
338
|
+
S(b);
|
|
217
339
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (0 === a._status || -1 === a._status) a._status = 2, a._result = b;
|
|
226
|
-
});
|
|
227
|
-
-1 === a._status && (a._status = 0, a._result = b);
|
|
228
|
-
}
|
|
229
|
-
if (1 === a._status) return a._result["default"];
|
|
230
|
-
throw a._result;
|
|
340
|
+
var Y = {
|
|
341
|
+
current: null
|
|
342
|
+
};
|
|
343
|
+
function Z() {
|
|
344
|
+
var a = Y.current;
|
|
345
|
+
if (null === a) throw Error(C(321));
|
|
346
|
+
return a;
|
|
231
347
|
}
|
|
232
|
-
var
|
|
233
|
-
|
|
348
|
+
var ba = {
|
|
349
|
+
ReactCurrentDispatcher: Y,
|
|
350
|
+
ReactCurrentBatchConfig: {
|
|
351
|
+
suspense: null
|
|
234
352
|
},
|
|
235
|
-
|
|
236
|
-
|
|
353
|
+
ReactCurrentOwner: J,
|
|
354
|
+
IsSomeRendererActing: {
|
|
355
|
+
current: !1
|
|
237
356
|
},
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
ReactCurrentBatchConfig: V,
|
|
241
|
-
ReactCurrentOwner: K
|
|
242
|
-
};
|
|
357
|
+
assign: l
|
|
358
|
+
};
|
|
243
359
|
react_production_min.Children = {
|
|
244
|
-
map:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
360
|
+
map: function map(a, b, c) {
|
|
361
|
+
if (null == a) return a;
|
|
362
|
+
var e = [];
|
|
363
|
+
X(a, e, null, b, c);
|
|
364
|
+
return e;
|
|
365
|
+
},
|
|
366
|
+
forEach: function forEach(a, b, c) {
|
|
367
|
+
if (null == a) return a;
|
|
368
|
+
b = R(null, null, b, c);
|
|
369
|
+
V(a, W, b);
|
|
370
|
+
S(b);
|
|
249
371
|
},
|
|
250
372
|
count: function count(a) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
});
|
|
255
|
-
return b;
|
|
373
|
+
return V(a, function () {
|
|
374
|
+
return null;
|
|
375
|
+
}, null);
|
|
256
376
|
},
|
|
257
377
|
toArray: function toArray(a) {
|
|
258
|
-
|
|
378
|
+
var b = [];
|
|
379
|
+
X(a, b, null, function (a) {
|
|
259
380
|
return a;
|
|
260
|
-
})
|
|
381
|
+
});
|
|
382
|
+
return b;
|
|
261
383
|
},
|
|
262
384
|
only: function only(a) {
|
|
263
|
-
if (!O(a)) throw Error(
|
|
385
|
+
if (!O(a)) throw Error(C(143));
|
|
264
386
|
return a;
|
|
265
387
|
}
|
|
266
388
|
};
|
|
267
|
-
react_production_min.Component =
|
|
268
|
-
react_production_min.Fragment =
|
|
269
|
-
react_production_min.Profiler =
|
|
270
|
-
react_production_min.PureComponent =
|
|
271
|
-
react_production_min.StrictMode =
|
|
272
|
-
react_production_min.Suspense =
|
|
273
|
-
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED =
|
|
274
|
-
react_production_min.cloneElement = function (a, b,
|
|
275
|
-
if (null === a || void 0 === a) throw Error(
|
|
276
|
-
var
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
389
|
+
react_production_min.Component = F;
|
|
390
|
+
react_production_min.Fragment = r;
|
|
391
|
+
react_production_min.Profiler = u;
|
|
392
|
+
react_production_min.PureComponent = H;
|
|
393
|
+
react_production_min.StrictMode = t;
|
|
394
|
+
react_production_min.Suspense = y;
|
|
395
|
+
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ba;
|
|
396
|
+
react_production_min.cloneElement = function (a, b, c) {
|
|
397
|
+
if (null === a || void 0 === a) throw Error(C(267, a));
|
|
398
|
+
var e = l({}, a.props),
|
|
399
|
+
d = a.key,
|
|
400
|
+
g = a.ref,
|
|
401
|
+
k = a._owner;
|
|
280
402
|
if (null != b) {
|
|
281
|
-
void 0 !== b.ref && (
|
|
282
|
-
void 0 !== b.key && (
|
|
283
|
-
if (a.type && a.type.defaultProps) var
|
|
284
|
-
for (
|
|
403
|
+
void 0 !== b.ref && (g = b.ref, k = J.current);
|
|
404
|
+
void 0 !== b.key && (d = "" + b.key);
|
|
405
|
+
if (a.type && a.type.defaultProps) var f = a.type.defaultProps;
|
|
406
|
+
for (h in b) K.call(b, h) && !L.hasOwnProperty(h) && (e[h] = void 0 === b[h] && void 0 !== f ? f[h] : b[h]);
|
|
285
407
|
}
|
|
286
|
-
var
|
|
287
|
-
if (1 ===
|
|
288
|
-
|
|
289
|
-
for (var m = 0; m <
|
|
290
|
-
|
|
408
|
+
var h = arguments.length - 2;
|
|
409
|
+
if (1 === h) e.children = c;else if (1 < h) {
|
|
410
|
+
f = Array(h);
|
|
411
|
+
for (var m = 0; m < h; m++) f[m] = arguments[m + 2];
|
|
412
|
+
e.children = f;
|
|
291
413
|
}
|
|
292
414
|
return {
|
|
293
|
-
$$typeof:
|
|
415
|
+
$$typeof: p,
|
|
294
416
|
type: a.type,
|
|
295
|
-
key:
|
|
296
|
-
ref:
|
|
297
|
-
props:
|
|
298
|
-
_owner:
|
|
417
|
+
key: d,
|
|
418
|
+
ref: g,
|
|
419
|
+
props: e,
|
|
420
|
+
_owner: k
|
|
299
421
|
};
|
|
300
422
|
};
|
|
301
|
-
react_production_min.createContext = function (a) {
|
|
423
|
+
react_production_min.createContext = function (a, b) {
|
|
424
|
+
void 0 === b && (b = null);
|
|
302
425
|
a = {
|
|
303
|
-
$$typeof:
|
|
426
|
+
$$typeof: w,
|
|
427
|
+
_calculateChangedBits: b,
|
|
304
428
|
_currentValue: a,
|
|
305
429
|
_currentValue2: a,
|
|
306
430
|
_threadCount: 0,
|
|
307
431
|
Provider: null,
|
|
308
|
-
Consumer: null
|
|
309
|
-
_defaultValue: null,
|
|
310
|
-
_globalName: null
|
|
432
|
+
Consumer: null
|
|
311
433
|
};
|
|
312
434
|
a.Provider = {
|
|
313
|
-
$$typeof:
|
|
435
|
+
$$typeof: v,
|
|
314
436
|
_context: a
|
|
315
437
|
};
|
|
316
438
|
return a.Consumer = a;
|
|
@@ -328,401 +450,468 @@
|
|
|
328
450
|
};
|
|
329
451
|
react_production_min.forwardRef = function (a) {
|
|
330
452
|
return {
|
|
331
|
-
$$typeof:
|
|
453
|
+
$$typeof: x,
|
|
332
454
|
render: a
|
|
333
455
|
};
|
|
334
456
|
};
|
|
335
457
|
react_production_min.isValidElement = O;
|
|
336
458
|
react_production_min.lazy = function (a) {
|
|
337
459
|
return {
|
|
338
|
-
$$typeof:
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
},
|
|
343
|
-
_init: T
|
|
460
|
+
$$typeof: A,
|
|
461
|
+
_ctor: a,
|
|
462
|
+
_status: -1,
|
|
463
|
+
_result: null
|
|
344
464
|
};
|
|
345
465
|
};
|
|
346
466
|
react_production_min.memo = function (a, b) {
|
|
347
467
|
return {
|
|
348
|
-
$$typeof:
|
|
468
|
+
$$typeof: z,
|
|
349
469
|
type: a,
|
|
350
470
|
compare: void 0 === b ? null : b
|
|
351
471
|
};
|
|
352
472
|
};
|
|
353
|
-
react_production_min.startTransition = function (a) {
|
|
354
|
-
var b = V.transition;
|
|
355
|
-
V.transition = {};
|
|
356
|
-
try {
|
|
357
|
-
a();
|
|
358
|
-
} finally {
|
|
359
|
-
V.transition = b;
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
react_production_min.unstable_act = function () {
|
|
363
|
-
throw Error("act(...) is not supported in production builds of React.");
|
|
364
|
-
};
|
|
365
473
|
react_production_min.useCallback = function (a, b) {
|
|
366
|
-
return
|
|
474
|
+
return Z().useCallback(a, b);
|
|
367
475
|
};
|
|
368
|
-
react_production_min.useContext = function (a) {
|
|
369
|
-
return
|
|
476
|
+
react_production_min.useContext = function (a, b) {
|
|
477
|
+
return Z().useContext(a, b);
|
|
370
478
|
};
|
|
371
479
|
react_production_min.useDebugValue = function () {};
|
|
372
|
-
react_production_min.useDeferredValue = function (a) {
|
|
373
|
-
return U.current.useDeferredValue(a);
|
|
374
|
-
};
|
|
375
480
|
react_production_min.useEffect = function (a, b) {
|
|
376
|
-
return
|
|
377
|
-
};
|
|
378
|
-
react_production_min.useId = function () {
|
|
379
|
-
return U.current.useId();
|
|
481
|
+
return Z().useEffect(a, b);
|
|
380
482
|
};
|
|
381
|
-
react_production_min.useImperativeHandle = function (a, b,
|
|
382
|
-
return
|
|
383
|
-
};
|
|
384
|
-
react_production_min.useInsertionEffect = function (a, b) {
|
|
385
|
-
return U.current.useInsertionEffect(a, b);
|
|
483
|
+
react_production_min.useImperativeHandle = function (a, b, c) {
|
|
484
|
+
return Z().useImperativeHandle(a, b, c);
|
|
386
485
|
};
|
|
387
486
|
react_production_min.useLayoutEffect = function (a, b) {
|
|
388
|
-
return
|
|
487
|
+
return Z().useLayoutEffect(a, b);
|
|
389
488
|
};
|
|
390
489
|
react_production_min.useMemo = function (a, b) {
|
|
391
|
-
return
|
|
490
|
+
return Z().useMemo(a, b);
|
|
392
491
|
};
|
|
393
|
-
react_production_min.useReducer = function (a, b,
|
|
394
|
-
return
|
|
492
|
+
react_production_min.useReducer = function (a, b, c) {
|
|
493
|
+
return Z().useReducer(a, b, c);
|
|
395
494
|
};
|
|
396
495
|
react_production_min.useRef = function (a) {
|
|
397
|
-
return
|
|
496
|
+
return Z().useRef(a);
|
|
398
497
|
};
|
|
399
498
|
react_production_min.useState = function (a) {
|
|
400
|
-
return
|
|
401
|
-
};
|
|
402
|
-
react_production_min.useSyncExternalStore = function (a, b, e) {
|
|
403
|
-
return U.current.useSyncExternalStore(a, b, e);
|
|
499
|
+
return Z().useState(a);
|
|
404
500
|
};
|
|
405
|
-
react_production_min.
|
|
406
|
-
return U.current.useTransition();
|
|
407
|
-
};
|
|
408
|
-
react_production_min.version = "18.2.0";
|
|
501
|
+
react_production_min.version = "16.13.0";
|
|
409
502
|
return react_production_min;
|
|
410
503
|
}
|
|
411
504
|
|
|
412
|
-
var react_development = {
|
|
505
|
+
var react_development = {};
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
509
|
+
*
|
|
510
|
+
* This source code is licensed under the MIT license found in the
|
|
511
|
+
* LICENSE file in the root directory of this source tree.
|
|
512
|
+
*/
|
|
513
|
+
var ReactPropTypesSecret_1;
|
|
514
|
+
var hasRequiredReactPropTypesSecret;
|
|
515
|
+
function requireReactPropTypesSecret() {
|
|
516
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
517
|
+
hasRequiredReactPropTypesSecret = 1;
|
|
518
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
519
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
520
|
+
return ReactPropTypesSecret_1;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
var has;
|
|
524
|
+
var hasRequiredHas;
|
|
525
|
+
function requireHas() {
|
|
526
|
+
if (hasRequiredHas) return has;
|
|
527
|
+
hasRequiredHas = 1;
|
|
528
|
+
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
529
|
+
return has;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
var checkPropTypes_1;
|
|
533
|
+
var hasRequiredCheckPropTypes;
|
|
534
|
+
function requireCheckPropTypes() {
|
|
535
|
+
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
536
|
+
hasRequiredCheckPropTypes = 1;
|
|
537
|
+
var printWarning = function printWarning() {};
|
|
538
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
539
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
540
|
+
var loggedTypeFailures = {};
|
|
541
|
+
var has = requireHas();
|
|
542
|
+
printWarning = function printWarning(text) {
|
|
543
|
+
var message = 'Warning: ' + text;
|
|
544
|
+
if (typeof console !== 'undefined') {
|
|
545
|
+
console.error(message);
|
|
546
|
+
}
|
|
547
|
+
try {
|
|
548
|
+
// --- Welcome to debugging React ---
|
|
549
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
550
|
+
// to find the callsite that caused this warning to fire.
|
|
551
|
+
throw new Error(message);
|
|
552
|
+
} catch (x) {/**/}
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Assert that the values match with the type specs.
|
|
558
|
+
* Error messages are memorized and will only be shown once.
|
|
559
|
+
*
|
|
560
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
561
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
562
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
563
|
+
* @param {string} componentName Name of the component for error messages.
|
|
564
|
+
* @param {?Function} getStack Returns the component stack.
|
|
565
|
+
* @private
|
|
566
|
+
*/
|
|
567
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
568
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
569
|
+
for (var typeSpecName in typeSpecs) {
|
|
570
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
571
|
+
var error;
|
|
572
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
573
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
574
|
+
// After these have been cleaned up, we'll let them throw.
|
|
575
|
+
try {
|
|
576
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
577
|
+
// behavior as without this statement except with a better message.
|
|
578
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
579
|
+
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`.');
|
|
580
|
+
err.name = 'Invariant Violation';
|
|
581
|
+
throw err;
|
|
582
|
+
}
|
|
583
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
584
|
+
} catch (ex) {
|
|
585
|
+
error = ex;
|
|
586
|
+
}
|
|
587
|
+
if (error && !(error instanceof Error)) {
|
|
588
|
+
printWarning((componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + _typeof(error) + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).');
|
|
589
|
+
}
|
|
590
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
591
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
592
|
+
// same error.
|
|
593
|
+
loggedTypeFailures[error.message] = true;
|
|
594
|
+
var stack = getStack ? getStack() : '';
|
|
595
|
+
printWarning('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Resets warning cache when testing.
|
|
604
|
+
*
|
|
605
|
+
* @private
|
|
606
|
+
*/
|
|
607
|
+
checkPropTypes.resetWarningCache = function () {
|
|
608
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
609
|
+
loggedTypeFailures = {};
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
checkPropTypes_1 = checkPropTypes;
|
|
613
|
+
return checkPropTypes_1;
|
|
614
|
+
}
|
|
413
615
|
|
|
414
|
-
react_development.exports;
|
|
415
616
|
var hasRequiredReact_development;
|
|
416
617
|
function requireReact_development() {
|
|
417
|
-
if (hasRequiredReact_development) return react_development
|
|
618
|
+
if (hasRequiredReact_development) return react_development;
|
|
418
619
|
hasRequiredReact_development = 1;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
if (maybeIterable === null || _typeof(maybeIterable) !== 'object') {
|
|
451
|
-
return null;
|
|
452
|
-
}
|
|
453
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
454
|
-
if (typeof maybeIterator === 'function') {
|
|
455
|
-
return maybeIterator;
|
|
456
|
-
}
|
|
620
|
+
if (process.env.NODE_ENV !== "production") {
|
|
621
|
+
(function () {
|
|
622
|
+
|
|
623
|
+
var _assign = requireObjectAssign();
|
|
624
|
+
var checkPropTypes = requireCheckPropTypes();
|
|
625
|
+
var ReactVersion = '16.13.0';
|
|
626
|
+
|
|
627
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
628
|
+
// nor polyfill, then a plain number is used for performance.
|
|
629
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol["for"];
|
|
630
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol["for"]('react.element') : 0xeac7;
|
|
631
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol["for"]('react.portal') : 0xeaca;
|
|
632
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol["for"]('react.fragment') : 0xeacb;
|
|
633
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.strict_mode') : 0xeacc;
|
|
634
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol["for"]('react.profiler') : 0xead2;
|
|
635
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol["for"]('react.provider') : 0xeacd;
|
|
636
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol["for"]('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
637
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.concurrent_mode') : 0xeacf;
|
|
638
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol["for"]('react.forward_ref') : 0xead0;
|
|
639
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol["for"]('react.suspense') : 0xead1;
|
|
640
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol["for"]('react.suspense_list') : 0xead8;
|
|
641
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol["for"]('react.memo') : 0xead3;
|
|
642
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol["for"]('react.lazy') : 0xead4;
|
|
643
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol["for"]('react.block') : 0xead9;
|
|
644
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol["for"]('react.fundamental') : 0xead5;
|
|
645
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol["for"]('react.responder') : 0xead6;
|
|
646
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol["for"]('react.scope') : 0xead7;
|
|
647
|
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
648
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
649
|
+
function getIteratorFn(maybeIterable) {
|
|
650
|
+
if (maybeIterable === null || _typeof(maybeIterable) !== 'object') {
|
|
457
651
|
return null;
|
|
458
652
|
}
|
|
653
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
654
|
+
if (typeof maybeIterator === 'function') {
|
|
655
|
+
return maybeIterator;
|
|
656
|
+
}
|
|
657
|
+
return null;
|
|
658
|
+
}
|
|
459
659
|
|
|
660
|
+
/**
|
|
661
|
+
* Keeps track of the current dispatcher.
|
|
662
|
+
*/
|
|
663
|
+
var ReactCurrentDispatcher = {
|
|
460
664
|
/**
|
|
461
|
-
*
|
|
462
|
-
|
|
463
|
-
var ReactCurrentDispatcher = {
|
|
464
|
-
/**
|
|
465
|
-
* @internal
|
|
466
|
-
* @type {ReactComponent}
|
|
467
|
-
*/
|
|
468
|
-
current: null
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* Keeps track of the current batch's configuration such as how long an update
|
|
473
|
-
* should suspend for if it needs to.
|
|
665
|
+
* @internal
|
|
666
|
+
* @type {ReactComponent}
|
|
474
667
|
*/
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
668
|
+
current: null
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Keeps track of the current batch's configuration such as how long an update
|
|
673
|
+
* should suspend for if it needs to.
|
|
674
|
+
*/
|
|
675
|
+
var ReactCurrentBatchConfig = {
|
|
676
|
+
suspense: null
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Keeps track of the current owner.
|
|
681
|
+
*
|
|
682
|
+
* The current owner is the component who should own any components that are
|
|
683
|
+
* currently being constructed.
|
|
684
|
+
*/
|
|
685
|
+
var ReactCurrentOwner = {
|
|
485
686
|
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
* The current owner is the component who should own any components that are
|
|
489
|
-
* currently being constructed.
|
|
687
|
+
* @internal
|
|
688
|
+
* @type {ReactComponent}
|
|
490
689
|
*/
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
var currentExtraStackFrame = null;
|
|
500
|
-
function setExtraStackFrame(stack) {
|
|
690
|
+
current: null
|
|
691
|
+
};
|
|
692
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
693
|
+
function describeComponentFrame(name, source, ownerName) {
|
|
694
|
+
var sourceInfo = '';
|
|
695
|
+
if (source) {
|
|
696
|
+
var path = source.fileName;
|
|
697
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
501
698
|
{
|
|
502
|
-
|
|
699
|
+
// In DEV, include code for a common special case:
|
|
700
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
701
|
+
if (/^index\./.test(fileName)) {
|
|
702
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
703
|
+
if (match) {
|
|
704
|
+
var pathBeforeSlash = match[1];
|
|
705
|
+
if (pathBeforeSlash) {
|
|
706
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
707
|
+
fileName = folderName + '/' + fileName;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
503
711
|
}
|
|
712
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
713
|
+
} else if (ownerName) {
|
|
714
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
715
|
+
}
|
|
716
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
717
|
+
}
|
|
718
|
+
var Resolved = 1;
|
|
719
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
720
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
721
|
+
}
|
|
722
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
723
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
724
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
725
|
+
}
|
|
726
|
+
function getComponentName(type) {
|
|
727
|
+
if (type == null) {
|
|
728
|
+
// Host root, text node or just invalid type.
|
|
729
|
+
return null;
|
|
504
730
|
}
|
|
505
731
|
{
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
return
|
|
525
|
-
|
|
732
|
+
if (typeof type.tag === 'number') {
|
|
733
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
if (typeof type === 'function') {
|
|
737
|
+
return type.displayName || type.name || null;
|
|
738
|
+
}
|
|
739
|
+
if (typeof type === 'string') {
|
|
740
|
+
return type;
|
|
741
|
+
}
|
|
742
|
+
switch (type) {
|
|
743
|
+
case REACT_FRAGMENT_TYPE:
|
|
744
|
+
return 'Fragment';
|
|
745
|
+
case REACT_PORTAL_TYPE:
|
|
746
|
+
return 'Portal';
|
|
747
|
+
case REACT_PROFILER_TYPE:
|
|
748
|
+
return "Profiler";
|
|
749
|
+
case REACT_STRICT_MODE_TYPE:
|
|
750
|
+
return 'StrictMode';
|
|
751
|
+
case REACT_SUSPENSE_TYPE:
|
|
752
|
+
return 'Suspense';
|
|
753
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
754
|
+
return 'SuspenseList';
|
|
755
|
+
}
|
|
756
|
+
if (_typeof(type) === 'object') {
|
|
757
|
+
switch (type.$$typeof) {
|
|
758
|
+
case REACT_CONTEXT_TYPE:
|
|
759
|
+
return 'Context.Consumer';
|
|
760
|
+
case REACT_PROVIDER_TYPE:
|
|
761
|
+
return 'Context.Provider';
|
|
762
|
+
case REACT_FORWARD_REF_TYPE:
|
|
763
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
764
|
+
case REACT_MEMO_TYPE:
|
|
765
|
+
return getComponentName(type.type);
|
|
766
|
+
case REACT_BLOCK_TYPE:
|
|
767
|
+
return getComponentName(type.render);
|
|
768
|
+
case REACT_LAZY_TYPE:
|
|
769
|
+
{
|
|
770
|
+
var thenable = type;
|
|
771
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
772
|
+
if (resolvedThenable) {
|
|
773
|
+
return getComponentName(resolvedThenable);
|
|
774
|
+
}
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
526
778
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
533
|
-
|
|
534
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
535
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
536
|
-
// issues in DEV builds.
|
|
537
|
-
|
|
538
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
539
|
-
|
|
540
|
-
var ReactSharedInternals = {
|
|
541
|
-
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
542
|
-
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
543
|
-
ReactCurrentOwner: ReactCurrentOwner
|
|
544
|
-
};
|
|
779
|
+
return null;
|
|
780
|
+
}
|
|
781
|
+
var ReactDebugCurrentFrame = {};
|
|
782
|
+
var currentlyValidatingElement = null;
|
|
783
|
+
function setCurrentlyValidatingElement(element) {
|
|
545
784
|
{
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
785
|
+
currentlyValidatingElement = element;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
{
|
|
789
|
+
// Stack implementation injected by the current renderer.
|
|
790
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
791
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
792
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
|
793
|
+
|
|
794
|
+
if (currentlyValidatingElement) {
|
|
795
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
796
|
+
var owner = currentlyValidatingElement._owner;
|
|
797
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
798
|
+
} // Delegate to the injected renderer-specific implementation
|
|
799
|
+
|
|
800
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
801
|
+
if (impl) {
|
|
802
|
+
stack += impl() || '';
|
|
803
|
+
}
|
|
804
|
+
return stack;
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Used by act() to track whether you're inside an act() scope.
|
|
810
|
+
*/
|
|
811
|
+
var IsSomeRendererActing = {
|
|
812
|
+
current: false
|
|
813
|
+
};
|
|
814
|
+
var ReactSharedInternals = {
|
|
815
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
816
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
817
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
818
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
|
819
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
820
|
+
assign: _assign
|
|
821
|
+
};
|
|
822
|
+
{
|
|
823
|
+
_assign(ReactSharedInternals, {
|
|
824
|
+
// These should not be included in production.
|
|
825
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
826
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
827
|
+
// TODO: remove in React 17.0.
|
|
828
|
+
ReactComponentTreeHook: {}
|
|
829
|
+
});
|
|
830
|
+
}
|
|
549
831
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
832
|
+
// by calls to these methods by a Babel plugin.
|
|
833
|
+
//
|
|
834
|
+
// In PROD (or in packages without access to React internals),
|
|
835
|
+
// they are left as they are instead.
|
|
554
836
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
args[_key - 1] = arguments[_key];
|
|
560
|
-
}
|
|
561
|
-
printWarning('warn', format, args);
|
|
562
|
-
}
|
|
837
|
+
function warn(format) {
|
|
838
|
+
{
|
|
839
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
840
|
+
args[_key - 1] = arguments[_key];
|
|
563
841
|
}
|
|
842
|
+
printWarning('warn', format, args);
|
|
564
843
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
printWarning('error', format, args);
|
|
572
|
-
}
|
|
844
|
+
}
|
|
845
|
+
function error(format) {
|
|
846
|
+
{
|
|
847
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
848
|
+
args[_key2 - 1] = arguments[_key2];
|
|
573
849
|
}
|
|
850
|
+
printWarning('error', format, args);
|
|
574
851
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
852
|
+
}
|
|
853
|
+
function printWarning(level, format, args) {
|
|
854
|
+
// When changing this logic, you might want to also
|
|
855
|
+
// update consoleWithStackDev.www.js as well.
|
|
856
|
+
{
|
|
857
|
+
var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
|
|
858
|
+
if (!hasExistingStack) {
|
|
579
859
|
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
580
860
|
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
581
861
|
if (stack !== '') {
|
|
582
862
|
format += '%s';
|
|
583
863
|
args = args.concat([stack]);
|
|
584
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
585
|
-
|
|
586
|
-
var argsWithFormat = args.map(function (item) {
|
|
587
|
-
return String(item);
|
|
588
|
-
}); // Careful: RN currently depends on this prefix
|
|
589
|
-
|
|
590
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
591
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
592
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
593
|
-
|
|
594
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
var didWarnStateUpdateForUnmountedComponent = {};
|
|
598
|
-
function warnNoop(publicInstance, callerName) {
|
|
599
|
-
{
|
|
600
|
-
var _constructor = publicInstance.constructor;
|
|
601
|
-
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
602
|
-
var warningKey = componentName + "." + callerName;
|
|
603
|
-
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
604
|
-
return;
|
|
605
864
|
}
|
|
606
|
-
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);
|
|
607
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
608
865
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
*/
|
|
866
|
+
var argsWithFormat = args.map(function (item) {
|
|
867
|
+
return '' + item;
|
|
868
|
+
}); // Careful: RN currently depends on this prefix
|
|
613
869
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
634
|
-
*
|
|
635
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
636
|
-
* @param {?function} callback Called after component is updated.
|
|
637
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
638
|
-
* @internal
|
|
639
|
-
*/
|
|
640
|
-
enqueueForceUpdate: function enqueueForceUpdate(publicInstance, callback, callerName) {
|
|
641
|
-
warnNoop(publicInstance, 'forceUpdate');
|
|
642
|
-
},
|
|
643
|
-
/**
|
|
644
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
645
|
-
* You should treat `this.state` as immutable.
|
|
646
|
-
*
|
|
647
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
648
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
649
|
-
*
|
|
650
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
651
|
-
* @param {object} completeState Next state.
|
|
652
|
-
* @param {?function} callback Called after component is updated.
|
|
653
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
654
|
-
* @internal
|
|
655
|
-
*/
|
|
656
|
-
enqueueReplaceState: function enqueueReplaceState(publicInstance, completeState, callback, callerName) {
|
|
657
|
-
warnNoop(publicInstance, 'replaceState');
|
|
658
|
-
},
|
|
659
|
-
/**
|
|
660
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
|
661
|
-
* internal. This provides a merging strategy that is not available to deep
|
|
662
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
663
|
-
* during the merge.
|
|
664
|
-
*
|
|
665
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
666
|
-
* @param {object} partialState Next partial state to be merged with state.
|
|
667
|
-
* @param {?function} callback Called after component is updated.
|
|
668
|
-
* @param {?string} Name of the calling function in the public API.
|
|
669
|
-
* @internal
|
|
670
|
-
*/
|
|
671
|
-
enqueueSetState: function enqueueSetState(publicInstance, partialState, callback, callerName) {
|
|
672
|
-
warnNoop(publicInstance, 'setState');
|
|
673
|
-
}
|
|
674
|
-
};
|
|
675
|
-
var assign = Object.assign;
|
|
676
|
-
var emptyObject = {};
|
|
870
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
871
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
872
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
873
|
+
|
|
874
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
875
|
+
try {
|
|
876
|
+
// --- Welcome to debugging React ---
|
|
877
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
878
|
+
// to find the callsite that caused this warning to fire.
|
|
879
|
+
var argIndex = 0;
|
|
880
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
881
|
+
return args[argIndex++];
|
|
882
|
+
});
|
|
883
|
+
throw new Error(message);
|
|
884
|
+
} catch (x) {}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
|
888
|
+
function warnNoop(publicInstance, callerName) {
|
|
677
889
|
{
|
|
678
|
-
|
|
890
|
+
var _constructor = publicInstance.constructor;
|
|
891
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
892
|
+
var warningKey = componentName + "." + callerName;
|
|
893
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
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);
|
|
897
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
679
898
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
function Component(props, context, updater) {
|
|
685
|
-
this.props = props;
|
|
686
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* This is the abstract API for an update queue.
|
|
902
|
+
*/
|
|
687
903
|
|
|
688
|
-
|
|
689
|
-
// renderer.
|
|
690
|
-
|
|
691
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
692
|
-
}
|
|
693
|
-
Component.prototype.isReactComponent = {};
|
|
904
|
+
var ReactNoopUpdateQueue = {
|
|
694
905
|
/**
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
698
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
699
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
700
|
-
*
|
|
701
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
|
702
|
-
* as they may eventually be batched together. You can provide an optional
|
|
703
|
-
* callback that will be executed when the call to setState is actually
|
|
704
|
-
* completed.
|
|
705
|
-
*
|
|
706
|
-
* When a function is provided to setState, it will be called at some point in
|
|
707
|
-
* the future (not synchronously). It will be called with the up to date
|
|
708
|
-
* component arguments (state, props, context). These values can be different
|
|
709
|
-
* from this.* because your function may be called after receiveProps but before
|
|
710
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
711
|
-
* assigned to this.
|
|
712
|
-
*
|
|
713
|
-
* @param {object|function} partialState Next partial state or function to
|
|
714
|
-
* produce next partial state to be merged with current state.
|
|
715
|
-
* @param {?function} callback Called after state is updated.
|
|
716
|
-
* @final
|
|
906
|
+
* Checks whether or not this composite component is mounted.
|
|
907
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
|
908
|
+
* @return {boolean} True if mounted, false otherwise.
|
|
717
909
|
* @protected
|
|
910
|
+
* @final
|
|
718
911
|
*/
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
|
|
723
|
-
}
|
|
724
|
-
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
725
|
-
};
|
|
912
|
+
isMounted: function isMounted(publicInstance) {
|
|
913
|
+
return false;
|
|
914
|
+
},
|
|
726
915
|
/**
|
|
727
916
|
* Forces an update. This should only be invoked when it is known with
|
|
728
917
|
* certainty that we are **not** in a DOM transaction.
|
|
@@ -733,2081 +922,1351 @@
|
|
|
733
922
|
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
734
923
|
* `componentWillUpdate` and `componentDidUpdate`.
|
|
735
924
|
*
|
|
736
|
-
* @param {
|
|
737
|
-
* @
|
|
738
|
-
* @
|
|
925
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
926
|
+
* @param {?function} callback Called after component is updated.
|
|
927
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
928
|
+
* @internal
|
|
739
929
|
*/
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
};
|
|
930
|
+
enqueueForceUpdate: function enqueueForceUpdate(publicInstance, callback, callerName) {
|
|
931
|
+
warnNoop(publicInstance, 'forceUpdate');
|
|
932
|
+
},
|
|
744
933
|
/**
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
934
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
935
|
+
* You should treat `this.state` as immutable.
|
|
936
|
+
*
|
|
937
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
938
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
939
|
+
*
|
|
940
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
941
|
+
* @param {object} completeState Next state.
|
|
942
|
+
* @param {?function} callback Called after component is updated.
|
|
943
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
944
|
+
* @internal
|
|
748
945
|
*/
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
753
|
-
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
754
|
-
};
|
|
755
|
-
var defineDeprecationWarning = function defineDeprecationWarning(methodName, info) {
|
|
756
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
757
|
-
get: function get() {
|
|
758
|
-
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
759
|
-
return undefined;
|
|
760
|
-
}
|
|
761
|
-
});
|
|
762
|
-
};
|
|
763
|
-
for (var fnName in deprecatedAPIs) {
|
|
764
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
765
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
function ComponentDummy() {}
|
|
770
|
-
ComponentDummy.prototype = Component.prototype;
|
|
946
|
+
enqueueReplaceState: function enqueueReplaceState(publicInstance, completeState, callback, callerName) {
|
|
947
|
+
warnNoop(publicInstance, 'replaceState');
|
|
948
|
+
},
|
|
771
949
|
/**
|
|
772
|
-
*
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
this.props = props;
|
|
777
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
778
|
-
|
|
779
|
-
this.refs = emptyObject;
|
|
780
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
781
|
-
}
|
|
782
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
783
|
-
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
784
|
-
|
|
785
|
-
assign(pureComponentPrototype, Component.prototype);
|
|
786
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
787
|
-
|
|
788
|
-
// an immutable object with a single mutable value
|
|
789
|
-
function createRef() {
|
|
790
|
-
var refObject = {
|
|
791
|
-
current: null
|
|
792
|
-
};
|
|
793
|
-
{
|
|
794
|
-
Object.seal(refObject);
|
|
795
|
-
}
|
|
796
|
-
return refObject;
|
|
797
|
-
}
|
|
798
|
-
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
799
|
-
|
|
800
|
-
function isArray(a) {
|
|
801
|
-
return isArrayImpl(a);
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
/*
|
|
805
|
-
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
806
|
-
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
950
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
|
951
|
+
* internal. This provides a merging strategy that is not available to deep
|
|
952
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
953
|
+
* during the merge.
|
|
807
954
|
*
|
|
808
|
-
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
* of the
|
|
955
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
956
|
+
* @param {object} partialState Next partial state to be merged with state.
|
|
957
|
+
* @param {?function} callback Called after component is updated.
|
|
958
|
+
* @param {?string} Name of the calling function in the public API.
|
|
959
|
+
* @internal
|
|
812
960
|
*/
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
961
|
+
enqueueSetState: function enqueueSetState(publicInstance, partialState, callback, callerName) {
|
|
962
|
+
warnNoop(publicInstance, 'setState');
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
var emptyObject = {};
|
|
966
|
+
{
|
|
967
|
+
Object.freeze(emptyObject);
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Base class helpers for the updating state of a component.
|
|
971
|
+
*/
|
|
972
|
+
|
|
973
|
+
function Component(props, context, updater) {
|
|
974
|
+
this.props = props;
|
|
975
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
976
|
+
|
|
977
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
978
|
+
// renderer.
|
|
979
|
+
|
|
980
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
981
|
+
}
|
|
982
|
+
Component.prototype.isReactComponent = {};
|
|
983
|
+
/**
|
|
984
|
+
* Sets a subset of the state. Always use this to mutate
|
|
985
|
+
* state. You should treat `this.state` as immutable.
|
|
986
|
+
*
|
|
987
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
988
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
989
|
+
*
|
|
990
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
|
991
|
+
* as they may eventually be batched together. You can provide an optional
|
|
992
|
+
* callback that will be executed when the call to setState is actually
|
|
993
|
+
* completed.
|
|
994
|
+
*
|
|
995
|
+
* When a function is provided to setState, it will be called at some point in
|
|
996
|
+
* the future (not synchronously). It will be called with the up to date
|
|
997
|
+
* component arguments (state, props, context). These values can be different
|
|
998
|
+
* from this.* because your function may be called after receiveProps but before
|
|
999
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
1000
|
+
* assigned to this.
|
|
1001
|
+
*
|
|
1002
|
+
* @param {object|function} partialState Next partial state or function to
|
|
1003
|
+
* produce next partial state to be merged with current state.
|
|
1004
|
+
* @param {?function} callback Called after state is updated.
|
|
1005
|
+
* @final
|
|
1006
|
+
* @protected
|
|
1007
|
+
*/
|
|
1008
|
+
|
|
1009
|
+
Component.prototype.setState = function (partialState, callback) {
|
|
1010
|
+
if (!(_typeof(partialState) === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
824
1011
|
{
|
|
825
|
-
|
|
826
|
-
|
|
1012
|
+
throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
1016
|
+
};
|
|
1017
|
+
/**
|
|
1018
|
+
* Forces an update. This should only be invoked when it is known with
|
|
1019
|
+
* certainty that we are **not** in a DOM transaction.
|
|
1020
|
+
*
|
|
1021
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
1022
|
+
* component's state has changed but `setState` was not called.
|
|
1023
|
+
*
|
|
1024
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
1025
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
1026
|
+
*
|
|
1027
|
+
* @param {?function} callback Called after update is complete.
|
|
1028
|
+
* @final
|
|
1029
|
+
* @protected
|
|
1030
|
+
*/
|
|
1031
|
+
|
|
1032
|
+
Component.prototype.forceUpdate = function (callback) {
|
|
1033
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
1034
|
+
};
|
|
1035
|
+
/**
|
|
1036
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
1037
|
+
* we would like to deprecate them, we're not going to move them over to this
|
|
1038
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
1039
|
+
*/
|
|
1040
|
+
|
|
1041
|
+
{
|
|
1042
|
+
var deprecatedAPIs = {
|
|
1043
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
1044
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
1045
|
+
};
|
|
1046
|
+
var defineDeprecationWarning = function defineDeprecationWarning(methodName, info) {
|
|
1047
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
1048
|
+
get: function get() {
|
|
1049
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
1050
|
+
return undefined;
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
};
|
|
1054
|
+
for (var fnName in deprecatedAPIs) {
|
|
1055
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
1056
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
function ComponentDummy() {}
|
|
1061
|
+
ComponentDummy.prototype = Component.prototype;
|
|
1062
|
+
/**
|
|
1063
|
+
* Convenience component with default shallow equality check for sCU.
|
|
1064
|
+
*/
|
|
1065
|
+
|
|
1066
|
+
function PureComponent(props, context, updater) {
|
|
1067
|
+
this.props = props;
|
|
1068
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
1069
|
+
|
|
1070
|
+
this.refs = emptyObject;
|
|
1071
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
1072
|
+
}
|
|
1073
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
1074
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
1075
|
+
|
|
1076
|
+
_assign(pureComponentPrototype, Component.prototype);
|
|
1077
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
1078
|
+
|
|
1079
|
+
// an immutable object with a single mutable value
|
|
1080
|
+
function createRef() {
|
|
1081
|
+
var refObject = {
|
|
1082
|
+
current: null
|
|
1083
|
+
};
|
|
1084
|
+
{
|
|
1085
|
+
Object.seal(refObject);
|
|
1086
|
+
}
|
|
1087
|
+
return refObject;
|
|
1088
|
+
}
|
|
1089
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1090
|
+
var RESERVED_PROPS = {
|
|
1091
|
+
key: true,
|
|
1092
|
+
ref: true,
|
|
1093
|
+
__self: true,
|
|
1094
|
+
__source: true
|
|
1095
|
+
};
|
|
1096
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
1097
|
+
{
|
|
1098
|
+
didWarnAboutStringRefs = {};
|
|
1099
|
+
}
|
|
1100
|
+
function hasValidRef(config) {
|
|
1101
|
+
{
|
|
1102
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
1103
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
1104
|
+
if (getter && getter.isReactWarning) {
|
|
827
1105
|
return false;
|
|
828
|
-
} catch (e) {
|
|
829
|
-
return true;
|
|
830
1106
|
}
|
|
831
1107
|
}
|
|
832
1108
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
842
|
-
// exception. (Library authors do this to prevent users from using built-in
|
|
843
|
-
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
844
|
-
// methods are needed to perform accurate arithmetic or comparison.)
|
|
845
|
-
//
|
|
846
|
-
// To fix the problem, coerce this object or symbol value to a string before
|
|
847
|
-
// passing it to React. The most reliable way is usually `String(value)`.
|
|
848
|
-
//
|
|
849
|
-
// To find which value is throwing, check the browser or debugger console.
|
|
850
|
-
// Before this exception was thrown, there should be `console.error` output
|
|
851
|
-
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
852
|
-
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
853
|
-
// In most cases, this console output also shows the component and its
|
|
854
|
-
// ancestor components where the exception happened.
|
|
855
|
-
//
|
|
856
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
857
|
-
return '' + value;
|
|
858
|
-
}
|
|
859
|
-
function checkKeyStringCoercion(value) {
|
|
860
|
-
{
|
|
861
|
-
if (willCoercionThrow(value)) {
|
|
862
|
-
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
863
|
-
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
1109
|
+
return config.ref !== undefined;
|
|
1110
|
+
}
|
|
1111
|
+
function hasValidKey(config) {
|
|
1112
|
+
{
|
|
1113
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
1114
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
1115
|
+
if (getter && getter.isReactWarning) {
|
|
1116
|
+
return false;
|
|
864
1117
|
}
|
|
865
1118
|
}
|
|
866
1119
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
function getContextName(type) {
|
|
878
|
-
return type.displayName || 'Context';
|
|
879
|
-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
880
|
-
|
|
881
|
-
function getComponentNameFromType(type) {
|
|
882
|
-
if (type == null) {
|
|
883
|
-
// Host root, text node or just invalid type.
|
|
884
|
-
return null;
|
|
1120
|
+
return config.key !== undefined;
|
|
1121
|
+
}
|
|
1122
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
1123
|
+
var warnAboutAccessingKey = function warnAboutAccessingKey() {
|
|
1124
|
+
{
|
|
1125
|
+
if (!specialPropKeyWarningShown) {
|
|
1126
|
+
specialPropKeyWarningShown = true;
|
|
1127
|
+
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
1128
|
+
}
|
|
885
1129
|
}
|
|
1130
|
+
};
|
|
1131
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
1132
|
+
Object.defineProperty(props, 'key', {
|
|
1133
|
+
get: warnAboutAccessingKey,
|
|
1134
|
+
configurable: true
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
1138
|
+
var warnAboutAccessingRef = function warnAboutAccessingRef() {
|
|
886
1139
|
{
|
|
887
|
-
if (
|
|
888
|
-
|
|
1140
|
+
if (!specialPropRefWarningShown) {
|
|
1141
|
+
specialPropRefWarningShown = true;
|
|
1142
|
+
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
889
1143
|
}
|
|
890
1144
|
}
|
|
891
|
-
|
|
892
|
-
|
|
1145
|
+
};
|
|
1146
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
1147
|
+
Object.defineProperty(props, 'ref', {
|
|
1148
|
+
get: warnAboutAccessingRef,
|
|
1149
|
+
configurable: true
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
1153
|
+
{
|
|
1154
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
1155
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
1156
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
1157
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
|
|
1158
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
1165
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
1166
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
1167
|
+
* if something is a React Element.
|
|
1168
|
+
*
|
|
1169
|
+
* @param {*} type
|
|
1170
|
+
* @param {*} props
|
|
1171
|
+
* @param {*} key
|
|
1172
|
+
* @param {string|object} ref
|
|
1173
|
+
* @param {*} owner
|
|
1174
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
1175
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
1176
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
1177
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
1178
|
+
* change in behavior.
|
|
1179
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
1180
|
+
* indicating filename, line number, and/or other information.
|
|
1181
|
+
* @internal
|
|
1182
|
+
*/
|
|
1183
|
+
|
|
1184
|
+
var ReactElement = function ReactElement(type, key, ref, self, source, owner, props) {
|
|
1185
|
+
var element = {
|
|
1186
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
1187
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
1188
|
+
// Built-in properties that belong on the element
|
|
1189
|
+
type: type,
|
|
1190
|
+
key: key,
|
|
1191
|
+
ref: ref,
|
|
1192
|
+
props: props,
|
|
1193
|
+
// Record the component responsible for creating this element.
|
|
1194
|
+
_owner: owner
|
|
1195
|
+
};
|
|
1196
|
+
{
|
|
1197
|
+
// The validation flag is currently mutative. We put it on
|
|
1198
|
+
// an external backing store so that we can freeze the whole object.
|
|
1199
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
1200
|
+
// commonly used development environments.
|
|
1201
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
1202
|
+
// the validation flag non-enumerable (where possible, which should
|
|
1203
|
+
// include every environment we run tests in), so the test framework
|
|
1204
|
+
// ignores it.
|
|
1205
|
+
|
|
1206
|
+
Object.defineProperty(element._store, 'validated', {
|
|
1207
|
+
configurable: false,
|
|
1208
|
+
enumerable: false,
|
|
1209
|
+
writable: true,
|
|
1210
|
+
value: false
|
|
1211
|
+
}); // self and source are DEV only properties.
|
|
1212
|
+
|
|
1213
|
+
Object.defineProperty(element, '_self', {
|
|
1214
|
+
configurable: false,
|
|
1215
|
+
enumerable: false,
|
|
1216
|
+
writable: false,
|
|
1217
|
+
value: self
|
|
1218
|
+
}); // Two elements created in two different places should be considered
|
|
1219
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
1220
|
+
|
|
1221
|
+
Object.defineProperty(element, '_source', {
|
|
1222
|
+
configurable: false,
|
|
1223
|
+
enumerable: false,
|
|
1224
|
+
writable: false,
|
|
1225
|
+
value: source
|
|
1226
|
+
});
|
|
1227
|
+
if (Object.freeze) {
|
|
1228
|
+
Object.freeze(element.props);
|
|
1229
|
+
Object.freeze(element);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
return element;
|
|
1233
|
+
};
|
|
1234
|
+
/**
|
|
1235
|
+
* Create and return a new ReactElement of the given type.
|
|
1236
|
+
* See https://reactjs.org/docs/react-api.html#createelement
|
|
1237
|
+
*/
|
|
1238
|
+
|
|
1239
|
+
function createElement(type, config, children) {
|
|
1240
|
+
var propName; // Reserved names are extracted
|
|
1241
|
+
|
|
1242
|
+
var props = {};
|
|
1243
|
+
var key = null;
|
|
1244
|
+
var ref = null;
|
|
1245
|
+
var self = null;
|
|
1246
|
+
var source = null;
|
|
1247
|
+
if (config != null) {
|
|
1248
|
+
if (hasValidRef(config)) {
|
|
1249
|
+
ref = config.ref;
|
|
1250
|
+
{
|
|
1251
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
1252
|
+
}
|
|
893
1253
|
}
|
|
894
|
-
if (
|
|
895
|
-
|
|
1254
|
+
if (hasValidKey(config)) {
|
|
1255
|
+
key = '' + config.key;
|
|
896
1256
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
case REACT_STRICT_MODE_TYPE:
|
|
905
|
-
return 'StrictMode';
|
|
906
|
-
case REACT_SUSPENSE_TYPE:
|
|
907
|
-
return 'Suspense';
|
|
908
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
909
|
-
return 'SuspenseList';
|
|
1257
|
+
self = config.__self === undefined ? null : config.__self;
|
|
1258
|
+
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
1259
|
+
|
|
1260
|
+
for (propName in config) {
|
|
1261
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
1262
|
+
props[propName] = config[propName];
|
|
1263
|
+
}
|
|
910
1264
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
case REACT_CONTEXT_TYPE:
|
|
914
|
-
var context = type;
|
|
915
|
-
return getContextName(context) + '.Consumer';
|
|
916
|
-
case REACT_PROVIDER_TYPE:
|
|
917
|
-
var provider = type;
|
|
918
|
-
return getContextName(provider._context) + '.Provider';
|
|
919
|
-
case REACT_FORWARD_REF_TYPE:
|
|
920
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
921
|
-
case REACT_MEMO_TYPE:
|
|
922
|
-
var outerName = type.displayName || null;
|
|
923
|
-
if (outerName !== null) {
|
|
924
|
-
return outerName;
|
|
925
|
-
}
|
|
926
|
-
return getComponentNameFromType(type.type) || 'Memo';
|
|
927
|
-
case REACT_LAZY_TYPE:
|
|
928
|
-
{
|
|
929
|
-
var lazyComponent = type;
|
|
930
|
-
var payload = lazyComponent._payload;
|
|
931
|
-
var init = lazyComponent._init;
|
|
932
|
-
try {
|
|
933
|
-
return getComponentNameFromType(init(payload));
|
|
934
|
-
} catch (x) {
|
|
935
|
-
return null;
|
|
936
|
-
}
|
|
937
|
-
}
|
|
1265
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
1266
|
+
// the newly allocated props object.
|
|
938
1267
|
|
|
939
|
-
|
|
1268
|
+
var childrenLength = arguments.length - 2;
|
|
1269
|
+
if (childrenLength === 1) {
|
|
1270
|
+
props.children = children;
|
|
1271
|
+
} else if (childrenLength > 1) {
|
|
1272
|
+
var childArray = Array(childrenLength);
|
|
1273
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
1274
|
+
childArray[i] = arguments[i + 2];
|
|
1275
|
+
}
|
|
1276
|
+
{
|
|
1277
|
+
if (Object.freeze) {
|
|
1278
|
+
Object.freeze(childArray);
|
|
940
1279
|
}
|
|
941
1280
|
}
|
|
1281
|
+
props.children = childArray;
|
|
1282
|
+
} // Resolve default props
|
|
942
1283
|
|
|
943
|
-
|
|
1284
|
+
if (type && type.defaultProps) {
|
|
1285
|
+
var defaultProps = type.defaultProps;
|
|
1286
|
+
for (propName in defaultProps) {
|
|
1287
|
+
if (props[propName] === undefined) {
|
|
1288
|
+
props[propName] = defaultProps[propName];
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
944
1291
|
}
|
|
945
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
946
|
-
var RESERVED_PROPS = {
|
|
947
|
-
key: true,
|
|
948
|
-
ref: true,
|
|
949
|
-
__self: true,
|
|
950
|
-
__source: true
|
|
951
|
-
};
|
|
952
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
953
1292
|
{
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
return false;
|
|
962
|
-
}
|
|
1293
|
+
if (key || ref) {
|
|
1294
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
1295
|
+
if (key) {
|
|
1296
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
1297
|
+
}
|
|
1298
|
+
if (ref) {
|
|
1299
|
+
defineRefPropWarningGetter(props, displayName);
|
|
963
1300
|
}
|
|
964
1301
|
}
|
|
965
|
-
return config.ref !== undefined;
|
|
966
1302
|
}
|
|
967
|
-
|
|
1303
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
1304
|
+
}
|
|
1305
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
|
1306
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
1307
|
+
return newElement;
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Clone and return a new ReactElement using element as the starting point.
|
|
1311
|
+
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
1312
|
+
*/
|
|
1313
|
+
|
|
1314
|
+
function cloneElement(element, config, children) {
|
|
1315
|
+
if (!!(element === null || element === undefined)) {
|
|
968
1316
|
{
|
|
969
|
-
|
|
970
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
971
|
-
if (getter && getter.isReactWarning) {
|
|
972
|
-
return false;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
return config.key !== undefined;
|
|
977
|
-
}
|
|
978
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
979
|
-
var warnAboutAccessingKey = function warnAboutAccessingKey() {
|
|
980
|
-
{
|
|
981
|
-
if (!specialPropKeyWarningShown) {
|
|
982
|
-
specialPropKeyWarningShown = true;
|
|
983
|
-
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);
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
};
|
|
987
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
988
|
-
Object.defineProperty(props, 'key', {
|
|
989
|
-
get: warnAboutAccessingKey,
|
|
990
|
-
configurable: true
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
994
|
-
var warnAboutAccessingRef = function warnAboutAccessingRef() {
|
|
995
|
-
{
|
|
996
|
-
if (!specialPropRefWarningShown) {
|
|
997
|
-
specialPropRefWarningShown = true;
|
|
998
|
-
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);
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
};
|
|
1002
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
1003
|
-
Object.defineProperty(props, 'ref', {
|
|
1004
|
-
get: warnAboutAccessingRef,
|
|
1005
|
-
configurable: true
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
1009
|
-
{
|
|
1010
|
-
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
1011
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
1012
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
1013
|
-
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);
|
|
1014
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1317
|
+
throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
1017
1318
|
}
|
|
1018
1319
|
}
|
|
1019
|
-
|
|
1020
|
-
* Factory method to create a new React element. This no longer adheres to
|
|
1021
|
-
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
1022
|
-
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
1023
|
-
* if something is a React Element.
|
|
1024
|
-
*
|
|
1025
|
-
* @param {*} type
|
|
1026
|
-
* @param {*} props
|
|
1027
|
-
* @param {*} key
|
|
1028
|
-
* @param {string|object} ref
|
|
1029
|
-
* @param {*} owner
|
|
1030
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
1031
|
-
* different from the `owner` when React.createElement is called, so that we
|
|
1032
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
1033
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
|
1034
|
-
* change in behavior.
|
|
1035
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
1036
|
-
* indicating filename, line number, and/or other information.
|
|
1037
|
-
* @internal
|
|
1038
|
-
*/
|
|
1320
|
+
var propName; // Original props are copied
|
|
1039
1321
|
|
|
1040
|
-
var
|
|
1041
|
-
var element = {
|
|
1042
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
1043
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
1044
|
-
// Built-in properties that belong on the element
|
|
1045
|
-
type: type,
|
|
1046
|
-
key: key,
|
|
1047
|
-
ref: ref,
|
|
1048
|
-
props: props,
|
|
1049
|
-
// Record the component responsible for creating this element.
|
|
1050
|
-
_owner: owner
|
|
1051
|
-
};
|
|
1052
|
-
{
|
|
1053
|
-
// The validation flag is currently mutative. We put it on
|
|
1054
|
-
// an external backing store so that we can freeze the whole object.
|
|
1055
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
1056
|
-
// commonly used development environments.
|
|
1057
|
-
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
1058
|
-
// the validation flag non-enumerable (where possible, which should
|
|
1059
|
-
// include every environment we run tests in), so the test framework
|
|
1060
|
-
// ignores it.
|
|
1061
|
-
|
|
1062
|
-
Object.defineProperty(element._store, 'validated', {
|
|
1063
|
-
configurable: false,
|
|
1064
|
-
enumerable: false,
|
|
1065
|
-
writable: true,
|
|
1066
|
-
value: false
|
|
1067
|
-
}); // self and source are DEV only properties.
|
|
1068
|
-
|
|
1069
|
-
Object.defineProperty(element, '_self', {
|
|
1070
|
-
configurable: false,
|
|
1071
|
-
enumerable: false,
|
|
1072
|
-
writable: false,
|
|
1073
|
-
value: self
|
|
1074
|
-
}); // Two elements created in two different places should be considered
|
|
1075
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
|
1076
|
-
|
|
1077
|
-
Object.defineProperty(element, '_source', {
|
|
1078
|
-
configurable: false,
|
|
1079
|
-
enumerable: false,
|
|
1080
|
-
writable: false,
|
|
1081
|
-
value: source
|
|
1082
|
-
});
|
|
1083
|
-
if (Object.freeze) {
|
|
1084
|
-
Object.freeze(element.props);
|
|
1085
|
-
Object.freeze(element);
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
return element;
|
|
1089
|
-
};
|
|
1090
|
-
/**
|
|
1091
|
-
* Create and return a new ReactElement of the given type.
|
|
1092
|
-
* See https://reactjs.org/docs/react-api.html#createelement
|
|
1093
|
-
*/
|
|
1322
|
+
var props = _assign({}, element.props); // Reserved names are extracted
|
|
1094
1323
|
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
var props = {};
|
|
1099
|
-
var key = null;
|
|
1100
|
-
var ref = null;
|
|
1101
|
-
var self = null;
|
|
1102
|
-
var source = null;
|
|
1103
|
-
if (config != null) {
|
|
1104
|
-
if (hasValidRef(config)) {
|
|
1105
|
-
ref = config.ref;
|
|
1106
|
-
{
|
|
1107
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
if (hasValidKey(config)) {
|
|
1111
|
-
{
|
|
1112
|
-
checkKeyStringCoercion(config.key);
|
|
1113
|
-
}
|
|
1114
|
-
key = '' + config.key;
|
|
1115
|
-
}
|
|
1116
|
-
self = config.__self === undefined ? null : config.__self;
|
|
1117
|
-
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
1324
|
+
var key = element.key;
|
|
1325
|
+
var ref = element.ref; // Self is preserved since the owner is preserved.
|
|
1118
1326
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
{
|
|
1136
|
-
if (Object.freeze) {
|
|
1137
|
-
Object.freeze(childArray);
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
props.children = childArray;
|
|
1141
|
-
} // Resolve default props
|
|
1327
|
+
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
1328
|
+
// transpiler, and the original source is probably a better indicator of the
|
|
1329
|
+
// true owner.
|
|
1330
|
+
|
|
1331
|
+
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
1332
|
+
|
|
1333
|
+
var owner = element._owner;
|
|
1334
|
+
if (config != null) {
|
|
1335
|
+
if (hasValidRef(config)) {
|
|
1336
|
+
// Silently steal the ref from the parent.
|
|
1337
|
+
ref = config.ref;
|
|
1338
|
+
owner = ReactCurrentOwner.current;
|
|
1339
|
+
}
|
|
1340
|
+
if (hasValidKey(config)) {
|
|
1341
|
+
key = '' + config.key;
|
|
1342
|
+
} // Remaining properties override existing props
|
|
1142
1343
|
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1344
|
+
var defaultProps;
|
|
1345
|
+
if (element.type && element.type.defaultProps) {
|
|
1346
|
+
defaultProps = element.type.defaultProps;
|
|
1347
|
+
}
|
|
1348
|
+
for (propName in config) {
|
|
1349
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
1350
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
1351
|
+
// Resolve default props
|
|
1147
1352
|
props[propName] = defaultProps[propName];
|
|
1353
|
+
} else {
|
|
1354
|
+
props[propName] = config[propName];
|
|
1148
1355
|
}
|
|
1149
1356
|
}
|
|
1150
1357
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1358
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
1359
|
+
// the newly allocated props object.
|
|
1360
|
+
|
|
1361
|
+
var childrenLength = arguments.length - 2;
|
|
1362
|
+
if (childrenLength === 1) {
|
|
1363
|
+
props.children = children;
|
|
1364
|
+
} else if (childrenLength > 1) {
|
|
1365
|
+
var childArray = Array(childrenLength);
|
|
1366
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
1367
|
+
childArray[i] = arguments[i + 2];
|
|
1368
|
+
}
|
|
1369
|
+
props.children = childArray;
|
|
1370
|
+
}
|
|
1371
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Verifies the object is a ReactElement.
|
|
1375
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1376
|
+
* @param {?object} object
|
|
1377
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
1378
|
+
* @final
|
|
1379
|
+
*/
|
|
1380
|
+
|
|
1381
|
+
function isValidElement(object) {
|
|
1382
|
+
return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1383
|
+
}
|
|
1384
|
+
var SEPARATOR = '.';
|
|
1385
|
+
var SUBSEPARATOR = ':';
|
|
1386
|
+
/**
|
|
1387
|
+
* Escape and wrap key so it is safe to use as a reactid
|
|
1388
|
+
*
|
|
1389
|
+
* @param {string} key to be escaped.
|
|
1390
|
+
* @return {string} the escaped key.
|
|
1391
|
+
*/
|
|
1392
|
+
|
|
1393
|
+
function escape(key) {
|
|
1394
|
+
var escapeRegex = /[=:]/g;
|
|
1395
|
+
var escaperLookup = {
|
|
1396
|
+
'=': '=0',
|
|
1397
|
+
':': '=2'
|
|
1398
|
+
};
|
|
1399
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
1400
|
+
return escaperLookup[match];
|
|
1401
|
+
});
|
|
1402
|
+
return '$' + escapedString;
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* TODO: Test that a single child and an array with one item have the same key
|
|
1406
|
+
* pattern.
|
|
1407
|
+
*/
|
|
1408
|
+
|
|
1409
|
+
var didWarnAboutMaps = false;
|
|
1410
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1411
|
+
function escapeUserProvidedKey(text) {
|
|
1412
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1413
|
+
}
|
|
1414
|
+
var POOL_SIZE = 10;
|
|
1415
|
+
var traverseContextPool = [];
|
|
1416
|
+
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1417
|
+
if (traverseContextPool.length) {
|
|
1418
|
+
var traverseContext = traverseContextPool.pop();
|
|
1419
|
+
traverseContext.result = mapResult;
|
|
1420
|
+
traverseContext.keyPrefix = keyPrefix;
|
|
1421
|
+
traverseContext.func = mapFunction;
|
|
1422
|
+
traverseContext.context = mapContext;
|
|
1423
|
+
traverseContext.count = 0;
|
|
1424
|
+
return traverseContext;
|
|
1425
|
+
} else {
|
|
1426
|
+
return {
|
|
1427
|
+
result: mapResult,
|
|
1428
|
+
keyPrefix: keyPrefix,
|
|
1429
|
+
func: mapFunction,
|
|
1430
|
+
context: mapContext,
|
|
1431
|
+
count: 0
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
function releaseTraverseContext(traverseContext) {
|
|
1436
|
+
traverseContext.result = null;
|
|
1437
|
+
traverseContext.keyPrefix = null;
|
|
1438
|
+
traverseContext.func = null;
|
|
1439
|
+
traverseContext.context = null;
|
|
1440
|
+
traverseContext.count = 0;
|
|
1441
|
+
if (traverseContextPool.length < POOL_SIZE) {
|
|
1442
|
+
traverseContextPool.push(traverseContext);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* @param {?*} children Children tree container.
|
|
1447
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
|
1448
|
+
* @param {!function} callback Callback to invoke with each child found.
|
|
1449
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
1450
|
+
* process.
|
|
1451
|
+
* @return {!number} The number of children in this subtree.
|
|
1452
|
+
*/
|
|
1453
|
+
|
|
1454
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
1455
|
+
var type = _typeof(children);
|
|
1456
|
+
if (type === 'undefined' || type === 'boolean') {
|
|
1457
|
+
// All of the above are perceived as null.
|
|
1458
|
+
children = null;
|
|
1459
|
+
}
|
|
1460
|
+
var invokeCallback = false;
|
|
1461
|
+
if (children === null) {
|
|
1462
|
+
invokeCallback = true;
|
|
1463
|
+
} else {
|
|
1464
|
+
switch (type) {
|
|
1465
|
+
case 'string':
|
|
1466
|
+
case 'number':
|
|
1467
|
+
invokeCallback = true;
|
|
1468
|
+
break;
|
|
1469
|
+
case 'object':
|
|
1470
|
+
switch (children.$$typeof) {
|
|
1471
|
+
case REACT_ELEMENT_TYPE:
|
|
1472
|
+
case REACT_PORTAL_TYPE:
|
|
1473
|
+
invokeCallback = true;
|
|
1159
1474
|
}
|
|
1160
|
-
}
|
|
1161
1475
|
}
|
|
1162
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
1163
1476
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1477
|
+
if (invokeCallback) {
|
|
1478
|
+
callback(traverseContext, children,
|
|
1479
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1480
|
+
// so that it's consistent if the number of children grows.
|
|
1481
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1482
|
+
return 1;
|
|
1167
1483
|
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
*/
|
|
1484
|
+
var child;
|
|
1485
|
+
var nextName;
|
|
1486
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1172
1487
|
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1488
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1489
|
+
if (Array.isArray(children)) {
|
|
1490
|
+
for (var i = 0; i < children.length; i++) {
|
|
1491
|
+
child = children[i];
|
|
1492
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
1493
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1176
1494
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
// transpiler, and the original source is probably a better indicator of the
|
|
1186
|
-
// true owner.
|
|
1187
|
-
|
|
1188
|
-
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
1189
|
-
|
|
1190
|
-
var owner = element._owner;
|
|
1191
|
-
if (config != null) {
|
|
1192
|
-
if (hasValidRef(config)) {
|
|
1193
|
-
// Silently steal the ref from the parent.
|
|
1194
|
-
ref = config.ref;
|
|
1195
|
-
owner = ReactCurrentOwner.current;
|
|
1196
|
-
}
|
|
1197
|
-
if (hasValidKey(config)) {
|
|
1198
|
-
{
|
|
1199
|
-
checkKeyStringCoercion(config.key);
|
|
1200
|
-
}
|
|
1201
|
-
key = '' + config.key;
|
|
1202
|
-
} // Remaining properties override existing props
|
|
1203
|
-
|
|
1204
|
-
var defaultProps;
|
|
1205
|
-
if (element.type && element.type.defaultProps) {
|
|
1206
|
-
defaultProps = element.type.defaultProps;
|
|
1207
|
-
}
|
|
1208
|
-
for (propName in config) {
|
|
1209
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
1210
|
-
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
1211
|
-
// Resolve default props
|
|
1212
|
-
props[propName] = defaultProps[propName];
|
|
1213
|
-
} else {
|
|
1214
|
-
props[propName] = config[propName];
|
|
1495
|
+
} else {
|
|
1496
|
+
var iteratorFn = getIteratorFn(children);
|
|
1497
|
+
if (typeof iteratorFn === 'function') {
|
|
1498
|
+
{
|
|
1499
|
+
// Warn about using Maps as children
|
|
1500
|
+
if (iteratorFn === children.entries) {
|
|
1501
|
+
if (!didWarnAboutMaps) {
|
|
1502
|
+
warn('Using Maps as children is deprecated and will be removed in ' + 'a future major release. Consider converting children to ' + 'an array of keyed ReactElements instead.');
|
|
1215
1503
|
}
|
|
1504
|
+
didWarnAboutMaps = true;
|
|
1216
1505
|
}
|
|
1217
1506
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
var childArray = Array(childrenLength);
|
|
1226
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
1227
|
-
childArray[i] = arguments[i + 2];
|
|
1507
|
+
var iterator = iteratorFn.call(children);
|
|
1508
|
+
var step;
|
|
1509
|
+
var ii = 0;
|
|
1510
|
+
while (!(step = iterator.next()).done) {
|
|
1511
|
+
child = step.value;
|
|
1512
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
1513
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1228
1514
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
1232
|
-
}
|
|
1233
|
-
/**
|
|
1234
|
-
* Verifies the object is a ReactElement.
|
|
1235
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1236
|
-
* @param {?object} object
|
|
1237
|
-
* @return {boolean} True if `object` is a ReactElement.
|
|
1238
|
-
* @final
|
|
1239
|
-
*/
|
|
1240
|
-
|
|
1241
|
-
function isValidElement(object) {
|
|
1242
|
-
return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1243
|
-
}
|
|
1244
|
-
var SEPARATOR = '.';
|
|
1245
|
-
var SUBSEPARATOR = ':';
|
|
1246
|
-
/**
|
|
1247
|
-
* Escape and wrap key so it is safe to use as a reactid
|
|
1248
|
-
*
|
|
1249
|
-
* @param {string} key to be escaped.
|
|
1250
|
-
* @return {string} the escaped key.
|
|
1251
|
-
*/
|
|
1252
|
-
|
|
1253
|
-
function escape(key) {
|
|
1254
|
-
var escapeRegex = /[=:]/g;
|
|
1255
|
-
var escaperLookup = {
|
|
1256
|
-
'=': '=0',
|
|
1257
|
-
':': '=2'
|
|
1258
|
-
};
|
|
1259
|
-
var escapedString = key.replace(escapeRegex, function (match) {
|
|
1260
|
-
return escaperLookup[match];
|
|
1261
|
-
});
|
|
1262
|
-
return '$' + escapedString;
|
|
1263
|
-
}
|
|
1264
|
-
/**
|
|
1265
|
-
* TODO: Test that a single child and an array with one item have the same key
|
|
1266
|
-
* pattern.
|
|
1267
|
-
*/
|
|
1268
|
-
|
|
1269
|
-
var didWarnAboutMaps = false;
|
|
1270
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1271
|
-
function escapeUserProvidedKey(text) {
|
|
1272
|
-
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1273
|
-
}
|
|
1274
|
-
/**
|
|
1275
|
-
* Generate a key string that identifies a element within a set.
|
|
1276
|
-
*
|
|
1277
|
-
* @param {*} element A element that could contain a manual key.
|
|
1278
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
1279
|
-
* @return {string}
|
|
1280
|
-
*/
|
|
1281
|
-
|
|
1282
|
-
function getElementKey(element, index) {
|
|
1283
|
-
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1284
|
-
// that we don't block potential future ES APIs.
|
|
1285
|
-
if (_typeof(element) === 'object' && element !== null && element.key != null) {
|
|
1286
|
-
// Explicit key
|
|
1515
|
+
} else if (type === 'object') {
|
|
1516
|
+
var addendum = '';
|
|
1287
1517
|
{
|
|
1288
|
-
|
|
1518
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1289
1519
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
return index.toString(36);
|
|
1294
|
-
}
|
|
1295
|
-
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1296
|
-
var type = _typeof(children);
|
|
1297
|
-
if (type === 'undefined' || type === 'boolean') {
|
|
1298
|
-
// All of the above are perceived as null.
|
|
1299
|
-
children = null;
|
|
1300
|
-
}
|
|
1301
|
-
var invokeCallback = false;
|
|
1302
|
-
if (children === null) {
|
|
1303
|
-
invokeCallback = true;
|
|
1304
|
-
} else {
|
|
1305
|
-
switch (type) {
|
|
1306
|
-
case 'string':
|
|
1307
|
-
case 'number':
|
|
1308
|
-
invokeCallback = true;
|
|
1309
|
-
break;
|
|
1310
|
-
case 'object':
|
|
1311
|
-
switch (children.$$typeof) {
|
|
1312
|
-
case REACT_ELEMENT_TYPE:
|
|
1313
|
-
case REACT_PORTAL_TYPE:
|
|
1314
|
-
invokeCallback = true;
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
if (invokeCallback) {
|
|
1319
|
-
var _child = children;
|
|
1320
|
-
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
|
1321
|
-
// so that it's consistent if the number of children grows:
|
|
1322
|
-
|
|
1323
|
-
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
1324
|
-
if (isArray(mappedChild)) {
|
|
1325
|
-
var escapedChildKey = '';
|
|
1326
|
-
if (childKey != null) {
|
|
1327
|
-
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
|
1328
|
-
}
|
|
1329
|
-
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
1330
|
-
return c;
|
|
1331
|
-
});
|
|
1332
|
-
} else if (mappedChild != null) {
|
|
1333
|
-
if (isValidElement(mappedChild)) {
|
|
1334
|
-
{
|
|
1335
|
-
// The `if` statement here prevents auto-disabling of the safe
|
|
1336
|
-
// coercion ESLint rule, so we must manually disable it below.
|
|
1337
|
-
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1338
|
-
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
|
1339
|
-
checkKeyStringCoercion(mappedChild.key);
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
1343
|
-
// Keep both the (mapped) and old keys if they differ, just as
|
|
1344
|
-
// traverseAllChildren used to do for objects as children
|
|
1345
|
-
escapedPrefix + (
|
|
1346
|
-
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1347
|
-
mappedChild.key && (!_child || _child.key !== mappedChild.key) ?
|
|
1348
|
-
// $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
1349
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1350
|
-
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
|
1351
|
-
}
|
|
1352
|
-
array.push(mappedChild);
|
|
1353
|
-
}
|
|
1354
|
-
return 1;
|
|
1355
|
-
}
|
|
1356
|
-
var child;
|
|
1357
|
-
var nextName;
|
|
1358
|
-
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1359
|
-
|
|
1360
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1361
|
-
if (isArray(children)) {
|
|
1362
|
-
for (var i = 0; i < children.length; i++) {
|
|
1363
|
-
child = children[i];
|
|
1364
|
-
nextName = nextNamePrefix + getElementKey(child, i);
|
|
1365
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1366
|
-
}
|
|
1367
|
-
} else {
|
|
1368
|
-
var iteratorFn = getIteratorFn(children);
|
|
1369
|
-
if (typeof iteratorFn === 'function') {
|
|
1370
|
-
var iterableChildren = children;
|
|
1520
|
+
var childrenString = '' + children;
|
|
1521
|
+
{
|
|
1371
1522
|
{
|
|
1372
|
-
|
|
1373
|
-
if (iteratorFn === iterableChildren.entries) {
|
|
1374
|
-
if (!didWarnAboutMaps) {
|
|
1375
|
-
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
|
1376
|
-
}
|
|
1377
|
-
didWarnAboutMaps = true;
|
|
1378
|
-
}
|
|
1523
|
+
throw Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum);
|
|
1379
1524
|
}
|
|
1380
|
-
var iterator = iteratorFn.call(iterableChildren);
|
|
1381
|
-
var step;
|
|
1382
|
-
var ii = 0;
|
|
1383
|
-
while (!(step = iterator.next()).done) {
|
|
1384
|
-
child = step.value;
|
|
1385
|
-
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
1386
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1387
|
-
}
|
|
1388
|
-
} else if (type === 'object') {
|
|
1389
|
-
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1390
|
-
var childrenString = String(children);
|
|
1391
|
-
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.');
|
|
1392
1525
|
}
|
|
1393
1526
|
}
|
|
1394
|
-
return subtreeCount;
|
|
1395
1527
|
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1528
|
+
return subtreeCount;
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Traverses children that are typically specified as `props.children`, but
|
|
1532
|
+
* might also be specified through attributes:
|
|
1533
|
+
*
|
|
1534
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
|
1535
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1536
|
+
*
|
|
1537
|
+
* The `traverseContext` is an optional argument that is passed through the
|
|
1538
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
|
1539
|
+
* the callback might find relevant.
|
|
1540
|
+
*
|
|
1541
|
+
* @param {?*} children Children tree object.
|
|
1542
|
+
* @param {!function} callback To invoke upon traversing each child.
|
|
1543
|
+
* @param {?*} traverseContext Context for traversal.
|
|
1544
|
+
* @return {!number} The number of children in this subtree.
|
|
1545
|
+
*/
|
|
1546
|
+
|
|
1547
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
|
1548
|
+
if (children == null) {
|
|
1549
|
+
return 0;
|
|
1550
|
+
}
|
|
1551
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Generate a key string that identifies a component within a set.
|
|
1555
|
+
*
|
|
1556
|
+
* @param {*} component A component that could contain a manual key.
|
|
1557
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1558
|
+
* @return {string}
|
|
1559
|
+
*/
|
|
1560
|
+
|
|
1561
|
+
function getComponentKey(component, index) {
|
|
1562
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1563
|
+
// that we don't block potential future ES APIs.
|
|
1564
|
+
if (_typeof(component) === 'object' && component !== null && component.key != null) {
|
|
1565
|
+
// Explicit key
|
|
1566
|
+
return escape(component.key);
|
|
1567
|
+
} // Implicit key determined by the index in the set
|
|
1568
|
+
|
|
1569
|
+
return index.toString(36);
|
|
1570
|
+
}
|
|
1571
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
|
1572
|
+
var func = bookKeeping.func,
|
|
1573
|
+
context = bookKeeping.context;
|
|
1574
|
+
func.call(context, child, bookKeeping.count++);
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
1578
|
+
*
|
|
1579
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1580
|
+
*
|
|
1581
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
1582
|
+
* leaf child.
|
|
1583
|
+
*
|
|
1584
|
+
* @param {?*} children Children tree container.
|
|
1585
|
+
* @param {function(*, int)} forEachFunc
|
|
1586
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
1587
|
+
*/
|
|
1588
|
+
|
|
1589
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1590
|
+
if (children == null) {
|
|
1591
|
+
return children;
|
|
1420
1592
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
n++; // Don't return anything
|
|
1593
|
+
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
|
1594
|
+
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
|
1595
|
+
releaseTraverseContext(traverseContext);
|
|
1596
|
+
}
|
|
1597
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1598
|
+
var result = bookKeeping.result,
|
|
1599
|
+
keyPrefix = bookKeeping.keyPrefix,
|
|
1600
|
+
func = bookKeeping.func,
|
|
1601
|
+
context = bookKeeping.context;
|
|
1602
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1603
|
+
if (Array.isArray(mappedChild)) {
|
|
1604
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
|
1605
|
+
return c;
|
|
1435
1606
|
});
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
* is only one child in the collection.
|
|
1472
|
-
*
|
|
1473
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1474
|
-
*
|
|
1475
|
-
* The current implementation of this function assumes that a single child gets
|
|
1476
|
-
* passed without a wrapper, but the purpose of this helper function is to
|
|
1477
|
-
* abstract away the particular structure of children.
|
|
1478
|
-
*
|
|
1479
|
-
* @param {?object} children Child collection structure.
|
|
1480
|
-
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1481
|
-
* structure.
|
|
1482
|
-
*/
|
|
1483
|
-
|
|
1484
|
-
function onlyChild(children) {
|
|
1485
|
-
if (!isValidElement(children)) {
|
|
1486
|
-
throw new Error('React.Children.only expected to receive a single React element child.');
|
|
1487
|
-
}
|
|
1607
|
+
} else if (mappedChild != null) {
|
|
1608
|
+
if (isValidElement(mappedChild)) {
|
|
1609
|
+
mappedChild = cloneAndReplaceKey(mappedChild,
|
|
1610
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
|
1611
|
+
// traverseAllChildren used to do for objects as children
|
|
1612
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1613
|
+
}
|
|
1614
|
+
result.push(mappedChild);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1618
|
+
var escapedPrefix = '';
|
|
1619
|
+
if (prefix != null) {
|
|
1620
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1621
|
+
}
|
|
1622
|
+
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
|
1623
|
+
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
|
1624
|
+
releaseTraverseContext(traverseContext);
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Maps children that are typically specified as `props.children`.
|
|
1628
|
+
*
|
|
1629
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1630
|
+
*
|
|
1631
|
+
* The provided mapFunction(child, key, index) will be called for each
|
|
1632
|
+
* leaf child.
|
|
1633
|
+
*
|
|
1634
|
+
* @param {?*} children Children tree container.
|
|
1635
|
+
* @param {function(*, int)} func The map function.
|
|
1636
|
+
* @param {*} context Context for mapFunction.
|
|
1637
|
+
* @return {object} Object containing the ordered map of results.
|
|
1638
|
+
*/
|
|
1639
|
+
|
|
1640
|
+
function mapChildren(children, func, context) {
|
|
1641
|
+
if (children == null) {
|
|
1488
1642
|
return children;
|
|
1489
1643
|
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
},
|
|
1541
|
-
_currentValue: {
|
|
1542
|
-
get: function get() {
|
|
1543
|
-
return context._currentValue;
|
|
1544
|
-
},
|
|
1545
|
-
set: function set(_currentValue) {
|
|
1546
|
-
context._currentValue = _currentValue;
|
|
1547
|
-
}
|
|
1548
|
-
},
|
|
1549
|
-
_currentValue2: {
|
|
1550
|
-
get: function get() {
|
|
1551
|
-
return context._currentValue2;
|
|
1552
|
-
},
|
|
1553
|
-
set: function set(_currentValue2) {
|
|
1554
|
-
context._currentValue2 = _currentValue2;
|
|
1555
|
-
}
|
|
1556
|
-
},
|
|
1557
|
-
_threadCount: {
|
|
1558
|
-
get: function get() {
|
|
1559
|
-
return context._threadCount;
|
|
1560
|
-
},
|
|
1561
|
-
set: function set(_threadCount) {
|
|
1562
|
-
context._threadCount = _threadCount;
|
|
1563
|
-
}
|
|
1564
|
-
},
|
|
1565
|
-
Consumer: {
|
|
1566
|
-
get: function get() {
|
|
1567
|
-
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1568
|
-
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1569
|
-
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?');
|
|
1570
|
-
}
|
|
1571
|
-
return context.Consumer;
|
|
1572
|
-
}
|
|
1573
|
-
},
|
|
1574
|
-
displayName: {
|
|
1575
|
-
get: function get() {
|
|
1576
|
-
return context.displayName;
|
|
1577
|
-
},
|
|
1578
|
-
set: function set(displayName) {
|
|
1579
|
-
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
1580
|
-
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
1581
|
-
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1586
|
-
|
|
1587
|
-
context.Consumer = Consumer;
|
|
1588
|
-
}
|
|
1644
|
+
var result = [];
|
|
1645
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1646
|
+
return result;
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* Count the number of children that are typically specified as
|
|
1650
|
+
* `props.children`.
|
|
1651
|
+
*
|
|
1652
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1653
|
+
*
|
|
1654
|
+
* @param {?*} children Children tree container.
|
|
1655
|
+
* @return {number} The number of children.
|
|
1656
|
+
*/
|
|
1657
|
+
|
|
1658
|
+
function countChildren(children) {
|
|
1659
|
+
return traverseAllChildren(children, function () {
|
|
1660
|
+
return null;
|
|
1661
|
+
}, null);
|
|
1662
|
+
}
|
|
1663
|
+
/**
|
|
1664
|
+
* Flatten a children object (typically specified as `props.children`) and
|
|
1665
|
+
* return an array with appropriately re-keyed children.
|
|
1666
|
+
*
|
|
1667
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1668
|
+
*/
|
|
1669
|
+
|
|
1670
|
+
function toArray(children) {
|
|
1671
|
+
var result = [];
|
|
1672
|
+
mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
|
1673
|
+
return child;
|
|
1674
|
+
});
|
|
1675
|
+
return result;
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Returns the first child in a collection of children and verifies that there
|
|
1679
|
+
* is only one child in the collection.
|
|
1680
|
+
*
|
|
1681
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1682
|
+
*
|
|
1683
|
+
* The current implementation of this function assumes that a single child gets
|
|
1684
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
|
1685
|
+
* abstract away the particular structure of children.
|
|
1686
|
+
*
|
|
1687
|
+
* @param {?object} children Child collection structure.
|
|
1688
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1689
|
+
* structure.
|
|
1690
|
+
*/
|
|
1691
|
+
|
|
1692
|
+
function onlyChild(children) {
|
|
1693
|
+
if (!isValidElement(children)) {
|
|
1589
1694
|
{
|
|
1590
|
-
|
|
1591
|
-
context._currentRenderer2 = null;
|
|
1592
|
-
}
|
|
1593
|
-
return context;
|
|
1594
|
-
}
|
|
1595
|
-
var Uninitialized = -1;
|
|
1596
|
-
var Pending = 0;
|
|
1597
|
-
var Resolved = 1;
|
|
1598
|
-
var Rejected = 2;
|
|
1599
|
-
function lazyInitializer(payload) {
|
|
1600
|
-
if (payload._status === Uninitialized) {
|
|
1601
|
-
var ctor = payload._result;
|
|
1602
|
-
var thenable = ctor(); // Transition to the next state.
|
|
1603
|
-
// This might throw either because it's missing or throws. If so, we treat it
|
|
1604
|
-
// as still uninitialized and try again next time. Which is the same as what
|
|
1605
|
-
// happens if the ctor or any wrappers processing the ctor throws. This might
|
|
1606
|
-
// end up fixing it if the resolution was a concurrency bug.
|
|
1607
|
-
|
|
1608
|
-
thenable.then(function (moduleObject) {
|
|
1609
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1610
|
-
// Transition to the next state.
|
|
1611
|
-
var resolved = payload;
|
|
1612
|
-
resolved._status = Resolved;
|
|
1613
|
-
resolved._result = moduleObject;
|
|
1614
|
-
}
|
|
1615
|
-
}, function (error) {
|
|
1616
|
-
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1617
|
-
// Transition to the next state.
|
|
1618
|
-
var rejected = payload;
|
|
1619
|
-
rejected._status = Rejected;
|
|
1620
|
-
rejected._result = error;
|
|
1621
|
-
}
|
|
1622
|
-
});
|
|
1623
|
-
if (payload._status === Uninitialized) {
|
|
1624
|
-
// In case, we're still uninitialized, then we're waiting for the thenable
|
|
1625
|
-
// to resolve. Set it as pending in the meantime.
|
|
1626
|
-
var pending = payload;
|
|
1627
|
-
pending._status = Pending;
|
|
1628
|
-
pending._result = thenable;
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
if (payload._status === Resolved) {
|
|
1632
|
-
var moduleObject = payload._result;
|
|
1633
|
-
{
|
|
1634
|
-
if (moduleObject === undefined) {
|
|
1635
|
-
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' +
|
|
1636
|
-
// Break up imports to avoid accidentally parsing them as dependencies.
|
|
1637
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
{
|
|
1641
|
-
if (!('default' in moduleObject)) {
|
|
1642
|
-
error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' +
|
|
1643
|
-
// Break up imports to avoid accidentally parsing them as dependencies.
|
|
1644
|
-
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
return moduleObject["default"];
|
|
1648
|
-
} else {
|
|
1649
|
-
throw payload._result;
|
|
1695
|
+
throw Error("React.Children.only expected to receive a single React element child.");
|
|
1650
1696
|
}
|
|
1651
1697
|
}
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
var lazyType = {
|
|
1659
|
-
$$typeof: REACT_LAZY_TYPE,
|
|
1660
|
-
_payload: payload,
|
|
1661
|
-
_init: lazyInitializer
|
|
1662
|
-
};
|
|
1698
|
+
return children;
|
|
1699
|
+
}
|
|
1700
|
+
function createContext(defaultValue, calculateChangedBits) {
|
|
1701
|
+
if (calculateChangedBits === undefined) {
|
|
1702
|
+
calculateChangedBits = null;
|
|
1703
|
+
} else {
|
|
1663
1704
|
{
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1705
|
+
if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
|
|
1706
|
+
error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
var context = {
|
|
1711
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
1712
|
+
_calculateChangedBits: calculateChangedBits,
|
|
1713
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1714
|
+
// some renderers as primary and others as secondary. We only expect
|
|
1715
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
|
1716
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
1717
|
+
// Secondary renderers store their context values on separate fields.
|
|
1718
|
+
_currentValue: defaultValue,
|
|
1719
|
+
_currentValue2: defaultValue,
|
|
1720
|
+
// Used to track how many concurrent renderers this context currently
|
|
1721
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
|
1722
|
+
_threadCount: 0,
|
|
1723
|
+
// These are circular
|
|
1724
|
+
Provider: null,
|
|
1725
|
+
Consumer: null
|
|
1726
|
+
};
|
|
1727
|
+
context.Provider = {
|
|
1728
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
|
1729
|
+
_context: context
|
|
1730
|
+
};
|
|
1731
|
+
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1732
|
+
var hasWarnedAboutUsingConsumerProvider = false;
|
|
1733
|
+
{
|
|
1734
|
+
// A separate object, but proxies back to the original context object for
|
|
1735
|
+
// backwards compatibility. It has a different $$typeof, so we can properly
|
|
1736
|
+
// warn for the incorrect usage of Context as a Consumer.
|
|
1737
|
+
var Consumer = {
|
|
1738
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
1739
|
+
_context: context,
|
|
1740
|
+
_calculateChangedBits: context._calculateChangedBits
|
|
1741
|
+
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1742
|
+
|
|
1743
|
+
Object.defineProperties(Consumer, {
|
|
1744
|
+
Provider: {
|
|
1745
|
+
get: function get() {
|
|
1746
|
+
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1747
|
+
hasWarnedAboutUsingConsumerProvider = true;
|
|
1748
|
+
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?');
|
|
1682
1749
|
}
|
|
1750
|
+
return context.Provider;
|
|
1683
1751
|
},
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
get: function get() {
|
|
1687
|
-
return propTypes;
|
|
1688
|
-
},
|
|
1689
|
-
set: function set(newPropTypes) {
|
|
1690
|
-
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.');
|
|
1691
|
-
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1692
|
-
// $FlowFixMe
|
|
1693
|
-
|
|
1694
|
-
Object.defineProperty(lazyType, 'propTypes', {
|
|
1695
|
-
enumerable: true
|
|
1696
|
-
});
|
|
1697
|
-
}
|
|
1752
|
+
set: function set(_Provider) {
|
|
1753
|
+
context.Provider = _Provider;
|
|
1698
1754
|
}
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1707
|
-
} else if (typeof render !== 'function') {
|
|
1708
|
-
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : _typeof(render));
|
|
1709
|
-
} else {
|
|
1710
|
-
if (render.length !== 0 && render.length !== 2) {
|
|
1711
|
-
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.');
|
|
1755
|
+
},
|
|
1756
|
+
_currentValue: {
|
|
1757
|
+
get: function get() {
|
|
1758
|
+
return context._currentValue;
|
|
1759
|
+
},
|
|
1760
|
+
set: function set(_currentValue) {
|
|
1761
|
+
context._currentValue = _currentValue;
|
|
1712
1762
|
}
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1763
|
+
},
|
|
1764
|
+
_currentValue2: {
|
|
1765
|
+
get: function get() {
|
|
1766
|
+
return context._currentValue2;
|
|
1767
|
+
},
|
|
1768
|
+
set: function set(_currentValue2) {
|
|
1769
|
+
context._currentValue2 = _currentValue2;
|
|
1717
1770
|
}
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
var elementType = {
|
|
1721
|
-
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1722
|
-
render: render
|
|
1723
|
-
};
|
|
1724
|
-
{
|
|
1725
|
-
var ownName;
|
|
1726
|
-
Object.defineProperty(elementType, 'displayName', {
|
|
1727
|
-
enumerable: false,
|
|
1728
|
-
configurable: true,
|
|
1771
|
+
},
|
|
1772
|
+
_threadCount: {
|
|
1729
1773
|
get: function get() {
|
|
1730
|
-
return
|
|
1774
|
+
return context._threadCount;
|
|
1731
1775
|
},
|
|
1732
|
-
set: function set(
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
if (!render.name && !render.displayName) {
|
|
1742
|
-
render.displayName = name;
|
|
1776
|
+
set: function set(_threadCount) {
|
|
1777
|
+
context._threadCount = _threadCount;
|
|
1778
|
+
}
|
|
1779
|
+
},
|
|
1780
|
+
Consumer: {
|
|
1781
|
+
get: function get() {
|
|
1782
|
+
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1783
|
+
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1784
|
+
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?');
|
|
1743
1785
|
}
|
|
1786
|
+
return context.Consumer;
|
|
1744
1787
|
}
|
|
1745
|
-
});
|
|
1746
|
-
}
|
|
1747
|
-
return elementType;
|
|
1748
|
-
}
|
|
1749
|
-
var REACT_MODULE_REFERENCE;
|
|
1750
|
-
{
|
|
1751
|
-
REACT_MODULE_REFERENCE = Symbol["for"]('react.module.reference');
|
|
1752
|
-
}
|
|
1753
|
-
function isValidElementType(type) {
|
|
1754
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
1755
|
-
return true;
|
|
1756
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
1757
|
-
|
|
1758
|
-
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) {
|
|
1759
|
-
return true;
|
|
1760
|
-
}
|
|
1761
|
-
if (_typeof(type) === 'object' && type !== null) {
|
|
1762
|
-
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 ||
|
|
1763
|
-
// This needs to include all possible module reference object
|
|
1764
|
-
// types supported by any Flight configuration anywhere since
|
|
1765
|
-
// we don't know which Flight build this will end up being used
|
|
1766
|
-
// with.
|
|
1767
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
1768
|
-
return true;
|
|
1769
1788
|
}
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1789
|
+
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1790
|
+
|
|
1791
|
+
context.Consumer = Consumer;
|
|
1772
1792
|
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1793
|
+
{
|
|
1794
|
+
context._currentRenderer = null;
|
|
1795
|
+
context._currentRenderer2 = null;
|
|
1796
|
+
}
|
|
1797
|
+
return context;
|
|
1798
|
+
}
|
|
1799
|
+
function lazy(ctor) {
|
|
1800
|
+
var lazyType = {
|
|
1801
|
+
$$typeof: REACT_LAZY_TYPE,
|
|
1802
|
+
_ctor: ctor,
|
|
1803
|
+
// React uses these fields to store the result.
|
|
1804
|
+
_status: -1,
|
|
1805
|
+
_result: null
|
|
1806
|
+
};
|
|
1807
|
+
{
|
|
1808
|
+
// In production, this would just set it on the object.
|
|
1809
|
+
var defaultProps;
|
|
1810
|
+
var propTypes;
|
|
1811
|
+
Object.defineProperties(lazyType, {
|
|
1812
|
+
defaultProps: {
|
|
1788
1813
|
configurable: true,
|
|
1789
1814
|
get: function get() {
|
|
1790
|
-
return
|
|
1815
|
+
return defaultProps;
|
|
1791
1816
|
},
|
|
1792
|
-
set: function set(
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
// But it's nice for anonymous functions to inherit the name,
|
|
1796
|
-
// so that our component-stack generation logic will display their frames.
|
|
1797
|
-
// An anonymous function generally suggests a pattern like:
|
|
1798
|
-
// React.memo((props) => {...});
|
|
1799
|
-
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1800
|
-
|
|
1801
|
-
if (!type.name && !type.displayName) {
|
|
1802
|
-
type.displayName = name;
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
});
|
|
1806
|
-
}
|
|
1807
|
-
return elementType;
|
|
1808
|
-
}
|
|
1809
|
-
function resolveDispatcher() {
|
|
1810
|
-
var dispatcher = ReactCurrentDispatcher.current;
|
|
1811
|
-
{
|
|
1812
|
-
if (dispatcher === null) {
|
|
1813
|
-
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.');
|
|
1814
|
-
}
|
|
1815
|
-
} // Will result in a null access error if accessed outside render phase. We
|
|
1816
|
-
// intentionally don't throw our own error because this is in a hot path.
|
|
1817
|
-
// Also helps ensure this is inlined.
|
|
1817
|
+
set: function set(newDefaultProps) {
|
|
1818
|
+
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.');
|
|
1819
|
+
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1818
1820
|
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
var dispatcher = resolveDispatcher();
|
|
1823
|
-
{
|
|
1824
|
-
// TODO: add a more generic warning for invalid values.
|
|
1825
|
-
if (Context._context !== undefined) {
|
|
1826
|
-
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1827
|
-
// and nobody should be using this in existing code.
|
|
1828
|
-
|
|
1829
|
-
if (realContext.Consumer === Context) {
|
|
1830
|
-
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?');
|
|
1831
|
-
} else if (realContext.Provider === Context) {
|
|
1832
|
-
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1821
|
+
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1822
|
+
enumerable: true
|
|
1823
|
+
});
|
|
1833
1824
|
}
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
var dispatcher = resolveDispatcher();
|
|
1844
|
-
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1845
|
-
}
|
|
1846
|
-
function useRef(initialValue) {
|
|
1847
|
-
var dispatcher = resolveDispatcher();
|
|
1848
|
-
return dispatcher.useRef(initialValue);
|
|
1849
|
-
}
|
|
1850
|
-
function useEffect(create, deps) {
|
|
1851
|
-
var dispatcher = resolveDispatcher();
|
|
1852
|
-
return dispatcher.useEffect(create, deps);
|
|
1853
|
-
}
|
|
1854
|
-
function useInsertionEffect(create, deps) {
|
|
1855
|
-
var dispatcher = resolveDispatcher();
|
|
1856
|
-
return dispatcher.useInsertionEffect(create, deps);
|
|
1857
|
-
}
|
|
1858
|
-
function useLayoutEffect(create, deps) {
|
|
1859
|
-
var dispatcher = resolveDispatcher();
|
|
1860
|
-
return dispatcher.useLayoutEffect(create, deps);
|
|
1861
|
-
}
|
|
1862
|
-
function useCallback(callback, deps) {
|
|
1863
|
-
var dispatcher = resolveDispatcher();
|
|
1864
|
-
return dispatcher.useCallback(callback, deps);
|
|
1865
|
-
}
|
|
1866
|
-
function useMemo(create, deps) {
|
|
1867
|
-
var dispatcher = resolveDispatcher();
|
|
1868
|
-
return dispatcher.useMemo(create, deps);
|
|
1869
|
-
}
|
|
1870
|
-
function useImperativeHandle(ref, create, deps) {
|
|
1871
|
-
var dispatcher = resolveDispatcher();
|
|
1872
|
-
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1873
|
-
}
|
|
1874
|
-
function useDebugValue(value, formatterFn) {
|
|
1875
|
-
{
|
|
1876
|
-
var dispatcher = resolveDispatcher();
|
|
1877
|
-
return dispatcher.useDebugValue(value, formatterFn);
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
function useTransition() {
|
|
1881
|
-
var dispatcher = resolveDispatcher();
|
|
1882
|
-
return dispatcher.useTransition();
|
|
1883
|
-
}
|
|
1884
|
-
function useDeferredValue(value) {
|
|
1885
|
-
var dispatcher = resolveDispatcher();
|
|
1886
|
-
return dispatcher.useDeferredValue(value);
|
|
1887
|
-
}
|
|
1888
|
-
function useId() {
|
|
1889
|
-
var dispatcher = resolveDispatcher();
|
|
1890
|
-
return dispatcher.useId();
|
|
1891
|
-
}
|
|
1892
|
-
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1893
|
-
var dispatcher = resolveDispatcher();
|
|
1894
|
-
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
1898
|
-
// replaying on render function. This currently only patches the object
|
|
1899
|
-
// lazily which won't cover if the log function was extracted eagerly.
|
|
1900
|
-
// We could also eagerly patch the method.
|
|
1901
|
-
var disabledDepth = 0;
|
|
1902
|
-
var prevLog;
|
|
1903
|
-
var prevInfo;
|
|
1904
|
-
var prevWarn;
|
|
1905
|
-
var prevError;
|
|
1906
|
-
var prevGroup;
|
|
1907
|
-
var prevGroupCollapsed;
|
|
1908
|
-
var prevGroupEnd;
|
|
1909
|
-
function disabledLog() {}
|
|
1910
|
-
disabledLog.__reactDisabledLog = true;
|
|
1911
|
-
function disableLogs() {
|
|
1912
|
-
{
|
|
1913
|
-
if (disabledDepth === 0) {
|
|
1914
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1915
|
-
prevLog = console.log;
|
|
1916
|
-
prevInfo = console.info;
|
|
1917
|
-
prevWarn = console.warn;
|
|
1918
|
-
prevError = console.error;
|
|
1919
|
-
prevGroup = console.group;
|
|
1920
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
1921
|
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
1922
|
-
|
|
1923
|
-
var props = {
|
|
1924
|
-
configurable: true,
|
|
1925
|
-
enumerable: true,
|
|
1926
|
-
value: disabledLog,
|
|
1927
|
-
writable: true
|
|
1928
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1929
|
-
|
|
1930
|
-
Object.defineProperties(console, {
|
|
1931
|
-
info: props,
|
|
1932
|
-
log: props,
|
|
1933
|
-
warn: props,
|
|
1934
|
-
error: props,
|
|
1935
|
-
group: props,
|
|
1936
|
-
groupCollapsed: props,
|
|
1937
|
-
groupEnd: props
|
|
1938
|
-
});
|
|
1939
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
disabledDepth++;
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
function reenableLogs() {
|
|
1946
|
-
{
|
|
1947
|
-
disabledDepth--;
|
|
1948
|
-
if (disabledDepth === 0) {
|
|
1949
|
-
/* eslint-disable react-internal/no-production-logging */
|
|
1950
|
-
var props = {
|
|
1951
|
-
configurable: true,
|
|
1952
|
-
enumerable: true,
|
|
1953
|
-
writable: true
|
|
1954
|
-
}; // $FlowFixMe Flow thinks console is immutable.
|
|
1955
|
-
|
|
1956
|
-
Object.defineProperties(console, {
|
|
1957
|
-
log: assign({}, props, {
|
|
1958
|
-
value: prevLog
|
|
1959
|
-
}),
|
|
1960
|
-
info: assign({}, props, {
|
|
1961
|
-
value: prevInfo
|
|
1962
|
-
}),
|
|
1963
|
-
warn: assign({}, props, {
|
|
1964
|
-
value: prevWarn
|
|
1965
|
-
}),
|
|
1966
|
-
error: assign({}, props, {
|
|
1967
|
-
value: prevError
|
|
1968
|
-
}),
|
|
1969
|
-
group: assign({}, props, {
|
|
1970
|
-
value: prevGroup
|
|
1971
|
-
}),
|
|
1972
|
-
groupCollapsed: assign({}, props, {
|
|
1973
|
-
value: prevGroupCollapsed
|
|
1974
|
-
}),
|
|
1975
|
-
groupEnd: assign({}, props, {
|
|
1976
|
-
value: prevGroupEnd
|
|
1977
|
-
})
|
|
1978
|
-
});
|
|
1979
|
-
/* eslint-enable react-internal/no-production-logging */
|
|
1980
|
-
}
|
|
1825
|
+
},
|
|
1826
|
+
propTypes: {
|
|
1827
|
+
configurable: true,
|
|
1828
|
+
get: function get() {
|
|
1829
|
+
return propTypes;
|
|
1830
|
+
},
|
|
1831
|
+
set: function set(newPropTypes) {
|
|
1832
|
+
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.');
|
|
1833
|
+
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1981
1834
|
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
1988
|
-
var prefix;
|
|
1989
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1990
|
-
{
|
|
1991
|
-
if (prefix === undefined) {
|
|
1992
|
-
// Extract the VM specific prefix used by each line.
|
|
1993
|
-
try {
|
|
1994
|
-
throw Error();
|
|
1995
|
-
} catch (x) {
|
|
1996
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
1997
|
-
prefix = match && match[1] || '';
|
|
1835
|
+
Object.defineProperty(lazyType, 'propTypes', {
|
|
1836
|
+
enumerable: true
|
|
1837
|
+
});
|
|
1998
1838
|
}
|
|
1999
|
-
}
|
|
2000
|
-
|
|
2001
|
-
return '\n' + prefix + name;
|
|
2002
|
-
}
|
|
1839
|
+
}
|
|
1840
|
+
});
|
|
2003
1841
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
1842
|
+
return lazyType;
|
|
1843
|
+
}
|
|
1844
|
+
function forwardRef(render) {
|
|
2006
1845
|
{
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
}
|
|
2015
|
-
{
|
|
2016
|
-
var frame = componentFrameCache.get(fn);
|
|
2017
|
-
if (frame !== undefined) {
|
|
2018
|
-
return frame;
|
|
1846
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1847
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1848
|
+
} else if (typeof render !== 'function') {
|
|
1849
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : _typeof(render));
|
|
1850
|
+
} else {
|
|
1851
|
+
if (render.length !== 0 && render.length !== 2) {
|
|
1852
|
+
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.');
|
|
2019
1853
|
}
|
|
2020
1854
|
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
Error.prepareStackTrace = undefined;
|
|
2026
|
-
var previousDispatcher;
|
|
2027
|
-
{
|
|
2028
|
-
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
2029
|
-
// for warnings.
|
|
2030
|
-
|
|
2031
|
-
ReactCurrentDispatcher$1.current = null;
|
|
2032
|
-
disableLogs();
|
|
2033
|
-
}
|
|
2034
|
-
try {
|
|
2035
|
-
// This should throw.
|
|
2036
|
-
if (construct) {
|
|
2037
|
-
// Something should be setting the props in the constructor.
|
|
2038
|
-
var Fake = function Fake() {
|
|
2039
|
-
throw Error();
|
|
2040
|
-
}; // $FlowFixMe
|
|
2041
|
-
|
|
2042
|
-
Object.defineProperty(Fake.prototype, 'props', {
|
|
2043
|
-
set: function set() {
|
|
2044
|
-
// We use a throwing setter instead of frozen or non-writable props
|
|
2045
|
-
// because that won't throw in a non-strict mode function.
|
|
2046
|
-
throw Error();
|
|
2047
|
-
}
|
|
2048
|
-
});
|
|
2049
|
-
if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === 'object' && Reflect.construct) {
|
|
2050
|
-
// We construct a different control for this case to include any extra
|
|
2051
|
-
// frames added by the construct call.
|
|
2052
|
-
try {
|
|
2053
|
-
Reflect.construct(Fake, []);
|
|
2054
|
-
} catch (x) {
|
|
2055
|
-
control = x;
|
|
2056
|
-
}
|
|
2057
|
-
Reflect.construct(fn, [], Fake);
|
|
2058
|
-
} else {
|
|
2059
|
-
try {
|
|
2060
|
-
Fake.call();
|
|
2061
|
-
} catch (x) {
|
|
2062
|
-
control = x;
|
|
2063
|
-
}
|
|
2064
|
-
fn.call(Fake.prototype);
|
|
2065
|
-
}
|
|
2066
|
-
} else {
|
|
2067
|
-
try {
|
|
2068
|
-
throw Error();
|
|
2069
|
-
} catch (x) {
|
|
2070
|
-
control = x;
|
|
2071
|
-
}
|
|
2072
|
-
fn();
|
|
1855
|
+
if (render != null) {
|
|
1856
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
|
1857
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
2073
1858
|
}
|
|
2074
|
-
} catch (sample) {
|
|
2075
|
-
// This is inlined manually because closure doesn't do it for us.
|
|
2076
|
-
if (sample && control && typeof sample.stack === 'string') {
|
|
2077
|
-
// This extracts the first frame from the sample that isn't also in the control.
|
|
2078
|
-
// Skipping one frame that we assume is the frame that calls the two.
|
|
2079
|
-
var sampleLines = sample.stack.split('\n');
|
|
2080
|
-
var controlLines = control.stack.split('\n');
|
|
2081
|
-
var s = sampleLines.length - 1;
|
|
2082
|
-
var c = controlLines.length - 1;
|
|
2083
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
2084
|
-
// We expect at least one stack frame to be shared.
|
|
2085
|
-
// Typically this will be the root most one. However, stack frames may be
|
|
2086
|
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
2087
|
-
// earlier than the other. We assume that the sample is longer or the same
|
|
2088
|
-
// and there for cut off earlier. So we should find the root most frame in
|
|
2089
|
-
// the sample somewhere in the control.
|
|
2090
|
-
c--;
|
|
2091
|
-
}
|
|
2092
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
2093
|
-
// Next we find the first one that isn't the same which should be the
|
|
2094
|
-
// frame that called our sample function and the control.
|
|
2095
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
2096
|
-
// In V8, the first line is describing the message but other VMs don't.
|
|
2097
|
-
// If we're about to return the first line, and the control is also on the same
|
|
2098
|
-
// line, that's a pretty good indicator that our sample threw at same line as
|
|
2099
|
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
2100
|
-
// This can happen if you passed a class to function component, or non-function.
|
|
2101
|
-
if (s !== 1 || c !== 1) {
|
|
2102
|
-
do {
|
|
2103
|
-
s--;
|
|
2104
|
-
c--; // We may still have similar intermediate frames from the construct call.
|
|
2105
|
-
// The next one that isn't the same should be our match though.
|
|
2106
|
-
|
|
2107
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
2108
|
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
2109
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
2110
|
-
// but we have a user-provided "displayName"
|
|
2111
|
-
// splice it in to make the stack more readable.
|
|
2112
|
-
|
|
2113
|
-
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
2114
|
-
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
2115
|
-
}
|
|
2116
|
-
{
|
|
2117
|
-
if (typeof fn === 'function') {
|
|
2118
|
-
componentFrameCache.set(fn, _frame);
|
|
2119
|
-
}
|
|
2120
|
-
} // Return the line we found.
|
|
2121
|
-
|
|
2122
|
-
return _frame;
|
|
2123
|
-
}
|
|
2124
|
-
} while (s >= 1 && c >= 0);
|
|
2125
|
-
}
|
|
2126
|
-
break;
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
} finally {
|
|
2131
|
-
reentry = false;
|
|
2132
|
-
{
|
|
2133
|
-
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
2134
|
-
reenableLogs();
|
|
2135
|
-
}
|
|
2136
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
2137
|
-
} // Fallback to just using the name if we couldn't make it throw.
|
|
2138
|
-
|
|
2139
|
-
var name = fn ? fn.displayName || fn.name : '';
|
|
2140
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
2141
|
-
{
|
|
2142
|
-
if (typeof fn === 'function') {
|
|
2143
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
return syntheticFrame;
|
|
2147
|
-
}
|
|
2148
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
2149
|
-
{
|
|
2150
|
-
return describeNativeComponentFrame(fn, false);
|
|
2151
1859
|
}
|
|
2152
1860
|
}
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
return describeBuiltInComponentFrame(type);
|
|
2168
|
-
}
|
|
2169
|
-
switch (type) {
|
|
2170
|
-
case REACT_SUSPENSE_TYPE:
|
|
2171
|
-
return describeBuiltInComponentFrame('Suspense');
|
|
2172
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
2173
|
-
return describeBuiltInComponentFrame('SuspenseList');
|
|
2174
|
-
}
|
|
2175
|
-
if (_typeof(type) === 'object') {
|
|
2176
|
-
switch (type.$$typeof) {
|
|
2177
|
-
case REACT_FORWARD_REF_TYPE:
|
|
2178
|
-
return describeFunctionComponentFrame(type.render);
|
|
2179
|
-
case REACT_MEMO_TYPE:
|
|
2180
|
-
// Memo may contain any component type so we recursively resolve it.
|
|
2181
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
2182
|
-
case REACT_LAZY_TYPE:
|
|
2183
|
-
{
|
|
2184
|
-
var lazyComponent = type;
|
|
2185
|
-
var payload = lazyComponent._payload;
|
|
2186
|
-
var init = lazyComponent._init;
|
|
2187
|
-
try {
|
|
2188
|
-
// Lazy may contain any component type so we recursively resolve it.
|
|
2189
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
2190
|
-
} catch (x) {}
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
1861
|
+
return {
|
|
1862
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1863
|
+
render: render
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
function isValidElementType(type) {
|
|
1867
|
+
return typeof type === 'string' || typeof type === 'function' ||
|
|
1868
|
+
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1869
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || _typeof(type) === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
1870
|
+
}
|
|
1871
|
+
function memo(type, compare) {
|
|
1872
|
+
{
|
|
1873
|
+
if (!isValidElementType(type)) {
|
|
1874
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : _typeof(type));
|
|
2193
1875
|
}
|
|
2194
|
-
return '';
|
|
2195
1876
|
}
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
1877
|
+
return {
|
|
1878
|
+
$$typeof: REACT_MEMO_TYPE,
|
|
1879
|
+
type: type,
|
|
1880
|
+
compare: compare === undefined ? null : compare
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
function resolveDispatcher() {
|
|
1884
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
|
1885
|
+
if (!(dispatcher !== null)) {
|
|
2199
1886
|
{
|
|
2200
|
-
|
|
2201
|
-
var owner = element._owner;
|
|
2202
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
2203
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
2204
|
-
} else {
|
|
2205
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
2206
|
-
}
|
|
1887
|
+
throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.");
|
|
2207
1888
|
}
|
|
2208
1889
|
}
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
1890
|
+
return dispatcher;
|
|
1891
|
+
}
|
|
1892
|
+
function useContext(Context, unstable_observedBits) {
|
|
1893
|
+
var dispatcher = resolveDispatcher();
|
|
1894
|
+
{
|
|
1895
|
+
if (unstable_observedBits !== undefined) {
|
|
1896
|
+
error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '');
|
|
1897
|
+
} // TODO: add a more generic warning for invalid values.
|
|
1898
|
+
|
|
1899
|
+
if (Context._context !== undefined) {
|
|
1900
|
+
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1901
|
+
// and nobody should be using this in existing code.
|
|
1902
|
+
|
|
1903
|
+
if (realContext.Consumer === Context) {
|
|
1904
|
+
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?');
|
|
1905
|
+
} else if (realContext.Provider === Context) {
|
|
1906
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
return dispatcher.useContext(Context, unstable_observedBits);
|
|
1911
|
+
}
|
|
1912
|
+
function useState(initialState) {
|
|
1913
|
+
var dispatcher = resolveDispatcher();
|
|
1914
|
+
return dispatcher.useState(initialState);
|
|
1915
|
+
}
|
|
1916
|
+
function useReducer(reducer, initialArg, init) {
|
|
1917
|
+
var dispatcher = resolveDispatcher();
|
|
1918
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1919
|
+
}
|
|
1920
|
+
function useRef(initialValue) {
|
|
1921
|
+
var dispatcher = resolveDispatcher();
|
|
1922
|
+
return dispatcher.useRef(initialValue);
|
|
1923
|
+
}
|
|
1924
|
+
function useEffect(create, deps) {
|
|
1925
|
+
var dispatcher = resolveDispatcher();
|
|
1926
|
+
return dispatcher.useEffect(create, deps);
|
|
1927
|
+
}
|
|
1928
|
+
function useLayoutEffect(create, deps) {
|
|
1929
|
+
var dispatcher = resolveDispatcher();
|
|
1930
|
+
return dispatcher.useLayoutEffect(create, deps);
|
|
1931
|
+
}
|
|
1932
|
+
function useCallback(callback, deps) {
|
|
1933
|
+
var dispatcher = resolveDispatcher();
|
|
1934
|
+
return dispatcher.useCallback(callback, deps);
|
|
1935
|
+
}
|
|
1936
|
+
function useMemo(create, deps) {
|
|
1937
|
+
var dispatcher = resolveDispatcher();
|
|
1938
|
+
return dispatcher.useMemo(create, deps);
|
|
1939
|
+
}
|
|
1940
|
+
function useImperativeHandle(ref, create, deps) {
|
|
1941
|
+
var dispatcher = resolveDispatcher();
|
|
1942
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1943
|
+
}
|
|
1944
|
+
function useDebugValue(value, formatterFn) {
|
|
1945
|
+
{
|
|
1946
|
+
var dispatcher = resolveDispatcher();
|
|
1947
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
var propTypesMisspellWarningShown;
|
|
1951
|
+
{
|
|
1952
|
+
propTypesMisspellWarningShown = false;
|
|
1953
|
+
}
|
|
1954
|
+
function getDeclarationErrorAddendum() {
|
|
1955
|
+
if (ReactCurrentOwner.current) {
|
|
1956
|
+
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
1957
|
+
if (name) {
|
|
1958
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
return '';
|
|
1962
|
+
}
|
|
1963
|
+
function getSourceInfoErrorAddendum(source) {
|
|
1964
|
+
if (source !== undefined) {
|
|
1965
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
1966
|
+
var lineNumber = source.lineNumber;
|
|
1967
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
1968
|
+
}
|
|
1969
|
+
return '';
|
|
1970
|
+
}
|
|
1971
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
1972
|
+
if (elementProps !== null && elementProps !== undefined) {
|
|
1973
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
1974
|
+
}
|
|
1975
|
+
return '';
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1979
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
1980
|
+
* updates.
|
|
1981
|
+
*/
|
|
1982
|
+
|
|
1983
|
+
var ownerHasKeyUseWarning = {};
|
|
1984
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
1985
|
+
var info = getDeclarationErrorAddendum();
|
|
1986
|
+
if (!info) {
|
|
1987
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1988
|
+
if (parentName) {
|
|
1989
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
return info;
|
|
1993
|
+
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1996
|
+
* This element is in an array. The array could grow and shrink or be
|
|
1997
|
+
* reordered. All children that haven't already been validated are required to
|
|
1998
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1999
|
+
* will only be shown once.
|
|
2000
|
+
*
|
|
2001
|
+
* @internal
|
|
2002
|
+
* @param {ReactElement} element Element that requires a key.
|
|
2003
|
+
* @param {*} parentType element's parent's type.
|
|
2004
|
+
*/
|
|
2005
|
+
|
|
2006
|
+
function validateExplicitKey(element, parentType) {
|
|
2007
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
2008
|
+
return;
|
|
2009
|
+
}
|
|
2010
|
+
element._store.validated = true;
|
|
2011
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
2012
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
2016
|
+
// property, it may be the creator of the child that's responsible for
|
|
2017
|
+
// assigning it a key.
|
|
2018
|
+
|
|
2019
|
+
var childOwner = '';
|
|
2020
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
2021
|
+
// Give the component that originally created this child.
|
|
2022
|
+
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
|
2023
|
+
}
|
|
2024
|
+
setCurrentlyValidatingElement(element);
|
|
2025
|
+
{
|
|
2026
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
2027
|
+
}
|
|
2028
|
+
setCurrentlyValidatingElement(null);
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Ensure that every element either is passed in a static location, in an
|
|
2032
|
+
* array with an explicit keys property defined, or in an object literal
|
|
2033
|
+
* with valid key property.
|
|
2034
|
+
*
|
|
2035
|
+
* @internal
|
|
2036
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
2037
|
+
* @param {*} parentType node's parent's type.
|
|
2038
|
+
*/
|
|
2039
|
+
|
|
2040
|
+
function validateChildKeys(node, parentType) {
|
|
2041
|
+
if (_typeof(node) !== 'object') {
|
|
2042
|
+
return;
|
|
2043
|
+
}
|
|
2044
|
+
if (Array.isArray(node)) {
|
|
2045
|
+
for (var i = 0; i < node.length; i++) {
|
|
2046
|
+
var child = node[i];
|
|
2047
|
+
if (isValidElement(child)) {
|
|
2048
|
+
validateExplicitKey(child, parentType);
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
} else if (isValidElement(node)) {
|
|
2052
|
+
// This element was passed in a valid location.
|
|
2053
|
+
if (node._store) {
|
|
2054
|
+
node._store.validated = true;
|
|
2055
|
+
}
|
|
2056
|
+
} else if (node) {
|
|
2057
|
+
var iteratorFn = getIteratorFn(node);
|
|
2058
|
+
if (typeof iteratorFn === 'function') {
|
|
2059
|
+
// Entry iterators used to provide implicit keys,
|
|
2060
|
+
// but now we print a separate warning for them later.
|
|
2061
|
+
if (iteratorFn !== node.entries) {
|
|
2062
|
+
var iterator = iteratorFn.call(node);
|
|
2063
|
+
var step;
|
|
2064
|
+
while (!(step = iterator.next()).done) {
|
|
2065
|
+
if (isValidElement(step.value)) {
|
|
2066
|
+
validateExplicitKey(step.value, parentType);
|
|
2244
2067
|
}
|
|
2245
2068
|
}
|
|
2246
2069
|
}
|
|
2247
2070
|
}
|
|
2248
2071
|
}
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
setExtraStackFrame(null);
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
var propTypesMisspellWarningShown;
|
|
2261
|
-
{
|
|
2262
|
-
propTypesMisspellWarningShown = false;
|
|
2263
|
-
}
|
|
2264
|
-
function getDeclarationErrorAddendum() {
|
|
2265
|
-
if (ReactCurrentOwner.current) {
|
|
2266
|
-
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
2267
|
-
if (name) {
|
|
2268
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
return '';
|
|
2272
|
-
}
|
|
2273
|
-
function getSourceInfoErrorAddendum(source) {
|
|
2274
|
-
if (source !== undefined) {
|
|
2275
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
2276
|
-
var lineNumber = source.lineNumber;
|
|
2277
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
2278
|
-
}
|
|
2279
|
-
return '';
|
|
2280
|
-
}
|
|
2281
|
-
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
2282
|
-
if (elementProps !== null && elementProps !== undefined) {
|
|
2283
|
-
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
2284
|
-
}
|
|
2285
|
-
return '';
|
|
2286
|
-
}
|
|
2287
|
-
/**
|
|
2288
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
2289
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
2290
|
-
* updates.
|
|
2291
|
-
*/
|
|
2292
|
-
|
|
2293
|
-
var ownerHasKeyUseWarning = {};
|
|
2294
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
2295
|
-
var info = getDeclarationErrorAddendum();
|
|
2296
|
-
if (!info) {
|
|
2297
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
2298
|
-
if (parentName) {
|
|
2299
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
|
-
return info;
|
|
2303
|
-
}
|
|
2304
|
-
/**
|
|
2305
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
2306
|
-
* This element is in an array. The array could grow and shrink or be
|
|
2307
|
-
* reordered. All children that haven't already been validated are required to
|
|
2308
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
2309
|
-
* will only be shown once.
|
|
2310
|
-
*
|
|
2311
|
-
* @internal
|
|
2312
|
-
* @param {ReactElement} element Element that requires a key.
|
|
2313
|
-
* @param {*} parentType element's parent's type.
|
|
2314
|
-
*/
|
|
2072
|
+
}
|
|
2073
|
+
/**
|
|
2074
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
2075
|
+
* provided by the type.
|
|
2076
|
+
*
|
|
2077
|
+
* @param {ReactElement} element
|
|
2078
|
+
*/
|
|
2315
2079
|
|
|
2316
|
-
|
|
2317
|
-
|
|
2080
|
+
function validatePropTypes(element) {
|
|
2081
|
+
{
|
|
2082
|
+
var type = element.type;
|
|
2083
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
2318
2084
|
return;
|
|
2319
2085
|
}
|
|
2320
|
-
|
|
2321
|
-
var
|
|
2322
|
-
if (
|
|
2086
|
+
var name = getComponentName(type);
|
|
2087
|
+
var propTypes;
|
|
2088
|
+
if (typeof type === 'function') {
|
|
2089
|
+
propTypes = type.propTypes;
|
|
2090
|
+
} else if (_typeof(type) === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
2091
|
+
// Note: Memo only checks outer props here.
|
|
2092
|
+
// Inner props are checked in the reconciler.
|
|
2093
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2094
|
+
propTypes = type.propTypes;
|
|
2095
|
+
} else {
|
|
2323
2096
|
return;
|
|
2324
2097
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
2333
|
-
}
|
|
2334
|
-
{
|
|
2335
|
-
setCurrentlyValidatingElement$1(element);
|
|
2336
|
-
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);
|
|
2337
|
-
setCurrentlyValidatingElement$1(null);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
/**
|
|
2341
|
-
* Ensure that every element either is passed in a static location, in an
|
|
2342
|
-
* array with an explicit keys property defined, or in an object literal
|
|
2343
|
-
* with valid key property.
|
|
2344
|
-
*
|
|
2345
|
-
* @internal
|
|
2346
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
2347
|
-
* @param {*} parentType node's parent's type.
|
|
2348
|
-
*/
|
|
2349
|
-
|
|
2350
|
-
function validateChildKeys(node, parentType) {
|
|
2351
|
-
if (_typeof(node) !== 'object') {
|
|
2352
|
-
return;
|
|
2098
|
+
if (propTypes) {
|
|
2099
|
+
setCurrentlyValidatingElement(element);
|
|
2100
|
+
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
2101
|
+
setCurrentlyValidatingElement(null);
|
|
2102
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2103
|
+
propTypesMisspellWarningShown = true;
|
|
2104
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
2353
2105
|
}
|
|
2354
|
-
if (
|
|
2355
|
-
|
|
2356
|
-
var child = node[i];
|
|
2357
|
-
if (isValidElement(child)) {
|
|
2358
|
-
validateExplicitKey(child, parentType);
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
} else if (isValidElement(node)) {
|
|
2362
|
-
// This element was passed in a valid location.
|
|
2363
|
-
if (node._store) {
|
|
2364
|
-
node._store.validated = true;
|
|
2365
|
-
}
|
|
2366
|
-
} else if (node) {
|
|
2367
|
-
var iteratorFn = getIteratorFn(node);
|
|
2368
|
-
if (typeof iteratorFn === 'function') {
|
|
2369
|
-
// Entry iterators used to provide implicit keys,
|
|
2370
|
-
// but now we print a separate warning for them later.
|
|
2371
|
-
if (iteratorFn !== node.entries) {
|
|
2372
|
-
var iterator = iteratorFn.call(node);
|
|
2373
|
-
var step;
|
|
2374
|
-
while (!(step = iterator.next()).done) {
|
|
2375
|
-
if (isValidElement(step.value)) {
|
|
2376
|
-
validateExplicitKey(step.value, parentType);
|
|
2377
|
-
}
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2106
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2107
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2381
2108
|
}
|
|
2382
2109
|
}
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
*/
|
|
2110
|
+
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
2113
|
+
* @param {ReactElement} fragment
|
|
2114
|
+
*/
|
|
2389
2115
|
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
} else if (_typeof(type) === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
2400
|
-
// Note: Memo only checks outer props here.
|
|
2401
|
-
// Inner props are checked in the reconciler.
|
|
2402
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2403
|
-
propTypes = type.propTypes;
|
|
2404
|
-
} else {
|
|
2405
|
-
return;
|
|
2406
|
-
}
|
|
2407
|
-
if (propTypes) {
|
|
2408
|
-
// Intentionally inside to avoid triggering lazy initializers:
|
|
2409
|
-
var name = getComponentNameFromType(type);
|
|
2410
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
2411
|
-
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2412
|
-
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
2413
|
-
|
|
2414
|
-
var _name = getComponentNameFromType(type);
|
|
2415
|
-
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
2416
|
-
}
|
|
2417
|
-
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2418
|
-
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2116
|
+
function validateFragmentProps(fragment) {
|
|
2117
|
+
{
|
|
2118
|
+
setCurrentlyValidatingElement(fragment);
|
|
2119
|
+
var keys = Object.keys(fragment.props);
|
|
2120
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2121
|
+
var key = keys[i];
|
|
2122
|
+
if (key !== 'children' && key !== 'key') {
|
|
2123
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2124
|
+
break;
|
|
2419
2125
|
}
|
|
2420
2126
|
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
|
2424
|
-
* @param {ReactElement} fragment
|
|
2425
|
-
*/
|
|
2426
|
-
|
|
2427
|
-
function validateFragmentProps(fragment) {
|
|
2428
|
-
{
|
|
2429
|
-
var keys = Object.keys(fragment.props);
|
|
2430
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2431
|
-
var key = keys[i];
|
|
2432
|
-
if (key !== 'children' && key !== 'key') {
|
|
2433
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2434
|
-
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2435
|
-
setCurrentlyValidatingElement$1(null);
|
|
2436
|
-
break;
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
if (fragment.ref !== null) {
|
|
2440
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
2441
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2442
|
-
setCurrentlyValidatingElement$1(null);
|
|
2443
|
-
}
|
|
2127
|
+
if (fragment.ref !== null) {
|
|
2128
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2444
2129
|
}
|
|
2130
|
+
setCurrentlyValidatingElement(null);
|
|
2445
2131
|
}
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2132
|
+
}
|
|
2133
|
+
function createElementWithValidation(type, props, children) {
|
|
2134
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
2135
|
+
// succeed and there will likely be errors in render.
|
|
2449
2136
|
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
}
|
|
2455
|
-
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
2456
|
-
if (sourceInfo) {
|
|
2457
|
-
info += sourceInfo;
|
|
2458
|
-
} else {
|
|
2459
|
-
info += getDeclarationErrorAddendum();
|
|
2460
|
-
}
|
|
2461
|
-
var typeString;
|
|
2462
|
-
if (type === null) {
|
|
2463
|
-
typeString = 'null';
|
|
2464
|
-
} else if (isArray(type)) {
|
|
2465
|
-
typeString = 'array';
|
|
2466
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2467
|
-
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
2468
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2469
|
-
} else {
|
|
2470
|
-
typeString = _typeof(type);
|
|
2471
|
-
}
|
|
2472
|
-
{
|
|
2473
|
-
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);
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
2477
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2478
|
-
|
|
2479
|
-
if (element == null) {
|
|
2480
|
-
return element;
|
|
2481
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2482
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2483
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
2484
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2485
|
-
// fixed, the key warnings will appear.)
|
|
2486
|
-
|
|
2487
|
-
if (validType) {
|
|
2488
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
2489
|
-
validateChildKeys(arguments[i], type);
|
|
2490
|
-
}
|
|
2137
|
+
if (!validType) {
|
|
2138
|
+
var info = '';
|
|
2139
|
+
if (type === undefined || _typeof(type) === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2140
|
+
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.";
|
|
2491
2141
|
}
|
|
2492
|
-
|
|
2493
|
-
|
|
2142
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
2143
|
+
if (sourceInfo) {
|
|
2144
|
+
info += sourceInfo;
|
|
2494
2145
|
} else {
|
|
2495
|
-
|
|
2146
|
+
info += getDeclarationErrorAddendum();
|
|
2147
|
+
}
|
|
2148
|
+
var typeString;
|
|
2149
|
+
if (type === null) {
|
|
2150
|
+
typeString = 'null';
|
|
2151
|
+
} else if (Array.isArray(type)) {
|
|
2152
|
+
typeString = 'array';
|
|
2153
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2154
|
+
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
2155
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2156
|
+
} else {
|
|
2157
|
+
typeString = _typeof(type);
|
|
2496
2158
|
}
|
|
2497
|
-
return element;
|
|
2498
|
-
}
|
|
2499
|
-
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2500
|
-
function createFactoryWithValidation(type) {
|
|
2501
|
-
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2502
|
-
validatedFactory.type = type;
|
|
2503
2159
|
{
|
|
2504
|
-
|
|
2505
|
-
didWarnAboutDeprecatedCreateFactory = true;
|
|
2506
|
-
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2507
|
-
} // Legacy hook: remove it
|
|
2508
|
-
|
|
2509
|
-
Object.defineProperty(validatedFactory, 'type', {
|
|
2510
|
-
enumerable: false,
|
|
2511
|
-
get: function get() {
|
|
2512
|
-
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2513
|
-
Object.defineProperty(this, 'type', {
|
|
2514
|
-
value: type
|
|
2515
|
-
});
|
|
2516
|
-
return type;
|
|
2517
|
-
}
|
|
2518
|
-
});
|
|
2160
|
+
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);
|
|
2519
2161
|
}
|
|
2520
|
-
return validatedFactory;
|
|
2521
2162
|
}
|
|
2522
|
-
|
|
2523
|
-
|
|
2163
|
+
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
2164
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2165
|
+
|
|
2166
|
+
if (element == null) {
|
|
2167
|
+
return element;
|
|
2168
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2169
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2170
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
2171
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2172
|
+
// fixed, the key warnings will appear.)
|
|
2173
|
+
|
|
2174
|
+
if (validType) {
|
|
2524
2175
|
for (var i = 2; i < arguments.length; i++) {
|
|
2525
|
-
validateChildKeys(arguments[i],
|
|
2526
|
-
}
|
|
2527
|
-
validatePropTypes(newElement);
|
|
2528
|
-
return newElement;
|
|
2529
|
-
}
|
|
2530
|
-
function startTransition(scope, options) {
|
|
2531
|
-
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
2532
|
-
ReactCurrentBatchConfig.transition = {};
|
|
2533
|
-
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
2534
|
-
{
|
|
2535
|
-
ReactCurrentBatchConfig.transition._updatedFibers = new Set();
|
|
2536
|
-
}
|
|
2537
|
-
try {
|
|
2538
|
-
scope();
|
|
2539
|
-
} finally {
|
|
2540
|
-
ReactCurrentBatchConfig.transition = prevTransition;
|
|
2541
|
-
{
|
|
2542
|
-
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
2543
|
-
var updatedFibersCount = currentTransition._updatedFibers.size;
|
|
2544
|
-
if (updatedFibersCount > 10) {
|
|
2545
|
-
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.');
|
|
2546
|
-
}
|
|
2547
|
-
currentTransition._updatedFibers.clear();
|
|
2548
|
-
}
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2551
|
-
}
|
|
2552
|
-
var didWarnAboutMessageChannel = false;
|
|
2553
|
-
var enqueueTaskImpl = null;
|
|
2554
|
-
function enqueueTask(task) {
|
|
2555
|
-
if (enqueueTaskImpl === null) {
|
|
2556
|
-
try {
|
|
2557
|
-
// read require off the module object to get around the bundlers.
|
|
2558
|
-
// we don't want them to detect a require and bundle a Node polyfill.
|
|
2559
|
-
var requireString = ('require' + Math.random()).slice(0, 7);
|
|
2560
|
-
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
|
2561
|
-
// version of setImmediate, bypassing fake timers if any.
|
|
2562
|
-
|
|
2563
|
-
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
|
|
2564
|
-
} catch (_err) {
|
|
2565
|
-
// we're in a browser
|
|
2566
|
-
// we can't use regular timers because they may still be faked
|
|
2567
|
-
// so we try MessageChannel+postMessage instead
|
|
2568
|
-
enqueueTaskImpl = function enqueueTaskImpl(callback) {
|
|
2569
|
-
{
|
|
2570
|
-
if (didWarnAboutMessageChannel === false) {
|
|
2571
|
-
didWarnAboutMessageChannel = true;
|
|
2572
|
-
if (typeof MessageChannel === 'undefined') {
|
|
2573
|
-
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.');
|
|
2574
|
-
}
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
var channel = new MessageChannel();
|
|
2578
|
-
channel.port1.onmessage = callback;
|
|
2579
|
-
channel.port2.postMessage(undefined);
|
|
2580
|
-
};
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
return enqueueTaskImpl(task);
|
|
2584
|
-
}
|
|
2585
|
-
var actScopeDepth = 0;
|
|
2586
|
-
var didWarnNoAwaitAct = false;
|
|
2587
|
-
function act(callback) {
|
|
2588
|
-
{
|
|
2589
|
-
// `act` calls can be nested, so we track the depth. This represents the
|
|
2590
|
-
// number of `act` scopes on the stack.
|
|
2591
|
-
var prevActScopeDepth = actScopeDepth;
|
|
2592
|
-
actScopeDepth++;
|
|
2593
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2594
|
-
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
|
2595
|
-
// will detect the queue and use it instead of Scheduler.
|
|
2596
|
-
ReactCurrentActQueue.current = [];
|
|
2597
|
-
}
|
|
2598
|
-
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
2599
|
-
var result;
|
|
2600
|
-
try {
|
|
2601
|
-
// Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
|
2602
|
-
// set to `true` while the given callback is executed, not for updates
|
|
2603
|
-
// triggered during an async event, because this is how the legacy
|
|
2604
|
-
// implementation of `act` behaved.
|
|
2605
|
-
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
2606
|
-
result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
|
|
2607
|
-
// which flushed updates immediately after the scope function exits, even
|
|
2608
|
-
// if it's an async function.
|
|
2609
|
-
|
|
2610
|
-
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
2611
|
-
var queue = ReactCurrentActQueue.current;
|
|
2612
|
-
if (queue !== null) {
|
|
2613
|
-
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
2614
|
-
flushActQueue(queue);
|
|
2615
|
-
}
|
|
2616
|
-
}
|
|
2617
|
-
} catch (error) {
|
|
2618
|
-
popActScope(prevActScopeDepth);
|
|
2619
|
-
throw error;
|
|
2620
|
-
} finally {
|
|
2621
|
-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
2622
|
-
}
|
|
2623
|
-
if (result !== null && _typeof(result) === 'object' && typeof result.then === 'function') {
|
|
2624
|
-
var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
|
|
2625
|
-
// for it to resolve before exiting the current scope.
|
|
2626
|
-
|
|
2627
|
-
var wasAwaited = false;
|
|
2628
|
-
var thenable = {
|
|
2629
|
-
then: function then(resolve, reject) {
|
|
2630
|
-
wasAwaited = true;
|
|
2631
|
-
thenableResult.then(function (returnValue) {
|
|
2632
|
-
popActScope(prevActScopeDepth);
|
|
2633
|
-
if (actScopeDepth === 0) {
|
|
2634
|
-
// We've exited the outermost act scope. Recursively flush the
|
|
2635
|
-
// queue until there's no remaining work.
|
|
2636
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2637
|
-
} else {
|
|
2638
|
-
resolve(returnValue);
|
|
2639
|
-
}
|
|
2640
|
-
}, function (error) {
|
|
2641
|
-
// The callback threw an error.
|
|
2642
|
-
popActScope(prevActScopeDepth);
|
|
2643
|
-
reject(error);
|
|
2644
|
-
});
|
|
2645
|
-
}
|
|
2646
|
-
};
|
|
2647
|
-
{
|
|
2648
|
-
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
|
2649
|
-
// eslint-disable-next-line no-undef
|
|
2650
|
-
Promise.resolve().then(function () {}).then(function () {
|
|
2651
|
-
if (!wasAwaited) {
|
|
2652
|
-
didWarnNoAwaitAct = true;
|
|
2653
|
-
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 () => ...);');
|
|
2654
|
-
}
|
|
2655
|
-
});
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
return thenable;
|
|
2659
|
-
} else {
|
|
2660
|
-
var returnValue = result; // The callback is not an async function. Exit the current scope
|
|
2661
|
-
// immediately, without awaiting.
|
|
2662
|
-
|
|
2663
|
-
popActScope(prevActScopeDepth);
|
|
2664
|
-
if (actScopeDepth === 0) {
|
|
2665
|
-
// Exiting the outermost act scope. Flush the queue.
|
|
2666
|
-
var _queue = ReactCurrentActQueue.current;
|
|
2667
|
-
if (_queue !== null) {
|
|
2668
|
-
flushActQueue(_queue);
|
|
2669
|
-
ReactCurrentActQueue.current = null;
|
|
2670
|
-
} // Return a thenable. If the user awaits it, we'll flush again in
|
|
2671
|
-
// case additional work was scheduled by a microtask.
|
|
2672
|
-
|
|
2673
|
-
var _thenable = {
|
|
2674
|
-
then: function then(resolve, reject) {
|
|
2675
|
-
// Confirm we haven't re-entered another `act` scope, in case
|
|
2676
|
-
// the user does something weird like await the thenable
|
|
2677
|
-
// multiple times.
|
|
2678
|
-
if (ReactCurrentActQueue.current === null) {
|
|
2679
|
-
// Recursively flush the queue until there's no remaining work.
|
|
2680
|
-
ReactCurrentActQueue.current = [];
|
|
2681
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
2682
|
-
} else {
|
|
2683
|
-
resolve(returnValue);
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
};
|
|
2687
|
-
return _thenable;
|
|
2688
|
-
} else {
|
|
2689
|
-
// Since we're inside a nested `act` scope, the returned thenable
|
|
2690
|
-
// immediately resolves. The outer scope will flush the queue.
|
|
2691
|
-
var _thenable2 = {
|
|
2692
|
-
then: function then(resolve, reject) {
|
|
2693
|
-
resolve(returnValue);
|
|
2694
|
-
}
|
|
2695
|
-
};
|
|
2696
|
-
return _thenable2;
|
|
2697
|
-
}
|
|
2698
|
-
}
|
|
2176
|
+
validateChildKeys(arguments[i], type);
|
|
2699
2177
|
}
|
|
2700
2178
|
}
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
}
|
|
2706
|
-
actScopeDepth = prevActScopeDepth;
|
|
2707
|
-
}
|
|
2179
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
2180
|
+
validateFragmentProps(element);
|
|
2181
|
+
} else {
|
|
2182
|
+
validatePropTypes(element);
|
|
2708
2183
|
}
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
}
|
|
2728
|
-
|
|
2729
|
-
resolve(returnValue);
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
}
|
|
2733
|
-
var isFlushing = false;
|
|
2734
|
-
function flushActQueue(queue) {
|
|
2735
|
-
{
|
|
2736
|
-
if (!isFlushing) {
|
|
2737
|
-
// Prevent re-entrance.
|
|
2738
|
-
isFlushing = true;
|
|
2739
|
-
var i = 0;
|
|
2740
|
-
try {
|
|
2741
|
-
for (; i < queue.length; i++) {
|
|
2742
|
-
var callback = queue[i];
|
|
2743
|
-
do {
|
|
2744
|
-
callback = callback(true);
|
|
2745
|
-
} while (callback !== null);
|
|
2746
|
-
}
|
|
2747
|
-
queue.length = 0;
|
|
2748
|
-
} catch (error) {
|
|
2749
|
-
// If something throws, leave the remaining callbacks on the queue.
|
|
2750
|
-
queue = queue.slice(i + 1);
|
|
2751
|
-
throw error;
|
|
2752
|
-
} finally {
|
|
2753
|
-
isFlushing = false;
|
|
2754
|
-
}
|
|
2184
|
+
return element;
|
|
2185
|
+
}
|
|
2186
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2187
|
+
function createFactoryWithValidation(type) {
|
|
2188
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2189
|
+
validatedFactory.type = type;
|
|
2190
|
+
{
|
|
2191
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2192
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
|
2193
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2194
|
+
} // Legacy hook: remove it
|
|
2195
|
+
|
|
2196
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
2197
|
+
enumerable: false,
|
|
2198
|
+
get: function get() {
|
|
2199
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2200
|
+
Object.defineProperty(this, 'type', {
|
|
2201
|
+
value: type
|
|
2202
|
+
});
|
|
2203
|
+
return type;
|
|
2755
2204
|
}
|
|
2756
|
-
}
|
|
2205
|
+
});
|
|
2757
2206
|
}
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
var
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2207
|
+
return validatedFactory;
|
|
2208
|
+
}
|
|
2209
|
+
function cloneElementWithValidation(element, props, children) {
|
|
2210
|
+
var newElement = cloneElement.apply(this, arguments);
|
|
2211
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
2212
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
2213
|
+
}
|
|
2214
|
+
validatePropTypes(newElement);
|
|
2215
|
+
return newElement;
|
|
2216
|
+
}
|
|
2217
|
+
{
|
|
2218
|
+
try {
|
|
2219
|
+
var frozenObject = Object.freeze({});
|
|
2220
|
+
var testMap = new Map([[frozenObject, null]]);
|
|
2221
|
+
var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
|
|
2222
|
+
// https://github.com/rollup/rollup/issues/1771
|
|
2223
|
+
// TODO: we can remove these if Rollup fixes the bug.
|
|
2224
|
+
|
|
2225
|
+
testMap.set(0, 0);
|
|
2226
|
+
testSet.add(0);
|
|
2227
|
+
} catch (e) {}
|
|
2228
|
+
}
|
|
2229
|
+
var createElement$1 = createElementWithValidation;
|
|
2230
|
+
var cloneElement$1 = cloneElementWithValidation;
|
|
2231
|
+
var createFactory = createFactoryWithValidation;
|
|
2232
|
+
var Children = {
|
|
2233
|
+
map: mapChildren,
|
|
2234
|
+
forEach: forEachChildren,
|
|
2235
|
+
count: countChildren,
|
|
2236
|
+
toArray: toArray,
|
|
2237
|
+
only: onlyChild
|
|
2238
|
+
};
|
|
2239
|
+
react_development.Children = Children;
|
|
2240
|
+
react_development.Component = Component;
|
|
2241
|
+
react_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
2242
|
+
react_development.Profiler = REACT_PROFILER_TYPE;
|
|
2243
|
+
react_development.PureComponent = PureComponent;
|
|
2244
|
+
react_development.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2245
|
+
react_development.Suspense = REACT_SUSPENSE_TYPE;
|
|
2246
|
+
react_development.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
2247
|
+
react_development.cloneElement = cloneElement$1;
|
|
2248
|
+
react_development.createContext = createContext;
|
|
2249
|
+
react_development.createElement = createElement$1;
|
|
2250
|
+
react_development.createFactory = createFactory;
|
|
2251
|
+
react_development.createRef = createRef;
|
|
2252
|
+
react_development.forwardRef = forwardRef;
|
|
2253
|
+
react_development.isValidElement = isValidElement;
|
|
2254
|
+
react_development.lazy = lazy;
|
|
2255
|
+
react_development.memo = memo;
|
|
2256
|
+
react_development.useCallback = useCallback;
|
|
2257
|
+
react_development.useContext = useContext;
|
|
2258
|
+
react_development.useDebugValue = useDebugValue;
|
|
2259
|
+
react_development.useEffect = useEffect;
|
|
2260
|
+
react_development.useImperativeHandle = useImperativeHandle;
|
|
2261
|
+
react_development.useLayoutEffect = useLayoutEffect;
|
|
2262
|
+
react_development.useMemo = useMemo;
|
|
2263
|
+
react_development.useReducer = useReducer;
|
|
2264
|
+
react_development.useRef = useRef;
|
|
2265
|
+
react_development.useState = useState;
|
|
2266
|
+
react_development.version = ReactVersion;
|
|
2267
|
+
})();
|
|
2268
|
+
}
|
|
2269
|
+
return react_development;
|
|
2811
2270
|
}
|
|
2812
2271
|
|
|
2813
2272
|
if (process.env.NODE_ENV === 'production') {
|