@realsee/live 0.5.2-dev.7 → 0.5.2-dev.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/live/live.d.ts +7 -0
- package/dist/realsee-live.cjs.development.js +33 -12
- package/dist/realsee-live.cjs.development.js.map +1 -1
- package/dist/realsee-live.cjs.production.js +1 -1
- package/dist/realsee-live.cjs.production.js.map +1 -1
- package/dist/realsee-live.esm.js +33 -12
- package/dist/realsee-live.esm.js.map +1 -1
- package/dist/realsee-live.umd.development.js +2502 -58
- package/dist/realsee-live.umd.development.js.map +1 -1
- package/dist/realsee-live.umd.production.js +1 -1
- package/dist/realsee-live.umd.production.js.map +1 -1
- package/dist/typings/live/WebSocket.d.ts +4 -0
- package/docs/assets/search.js +1 -1
- package/docs/enums/WebSocketCloseError.html +11 -9
- package/docs/modules.html +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RealseeLive = {}
|
|
5
|
-
})(this, (function (exports
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RealseeLive = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
10
6
|
|
|
11
7
|
const EVENT_SYMBOL$1 = Symbol('$$REALSEE_LIVE_EVENT$$');
|
|
12
8
|
function __generateEventIfNotExisted$1(instance) {
|
|
@@ -10770,9 +10766,9 @@
|
|
|
10770
10766
|
: part2 < 128 ? 9 : 10;
|
|
10771
10767
|
};
|
|
10772
10768
|
|
|
10773
|
-
var require$$0$
|
|
10769
|
+
var require$$0$6 = aspromise;
|
|
10774
10770
|
|
|
10775
|
-
var require$$1$
|
|
10771
|
+
var require$$1$3 = base64_1;
|
|
10776
10772
|
|
|
10777
10773
|
var require$$2$1 = eventemitter;
|
|
10778
10774
|
|
|
@@ -10790,10 +10786,10 @@
|
|
|
10790
10786
|
var util = exports;
|
|
10791
10787
|
|
|
10792
10788
|
// used to return a Promise where callback is omitted
|
|
10793
|
-
util.asPromise = require$$0$
|
|
10789
|
+
util.asPromise = require$$0$6;
|
|
10794
10790
|
|
|
10795
10791
|
// converts to / from base64 encoded strings
|
|
10796
|
-
util.base64 = require$$1$
|
|
10792
|
+
util.base64 = require$$1$3;
|
|
10797
10793
|
|
|
10798
10794
|
// base class of rpc.Service
|
|
10799
10795
|
util.EventEmitter = require$$2$1;
|
|
@@ -11661,13 +11657,13 @@
|
|
|
11661
11657
|
BufferWriter$1 = BufferWriter_;
|
|
11662
11658
|
};
|
|
11663
11659
|
|
|
11664
|
-
var require$$0$
|
|
11660
|
+
var require$$0$5 = writer;
|
|
11665
11661
|
|
|
11666
11662
|
var writer_buffer = BufferWriter;
|
|
11667
11663
|
|
|
11668
11664
|
// extends Writer
|
|
11669
11665
|
|
|
11670
|
-
(BufferWriter.prototype = Object.create(require$$0$
|
|
11666
|
+
(BufferWriter.prototype = Object.create(require$$0$5.prototype)).constructor = BufferWriter;
|
|
11671
11667
|
|
|
11672
11668
|
|
|
11673
11669
|
|
|
@@ -11680,7 +11676,7 @@
|
|
|
11680
11676
|
* @constructor
|
|
11681
11677
|
*/
|
|
11682
11678
|
function BufferWriter() {
|
|
11683
|
-
require$$0$
|
|
11679
|
+
require$$0$5.call(this);
|
|
11684
11680
|
}
|
|
11685
11681
|
|
|
11686
11682
|
/**
|
|
@@ -12322,7 +12318,7 @@
|
|
|
12322
12318
|
return this;
|
|
12323
12319
|
};
|
|
12324
12320
|
|
|
12325
|
-
var require$$0$
|
|
12321
|
+
var require$$0$4 = service;
|
|
12326
12322
|
|
|
12327
12323
|
var rpc_1 = createCommonjsModule(function (module, exports) {
|
|
12328
12324
|
|
|
@@ -12359,12 +12355,12 @@
|
|
|
12359
12355
|
* @returns {undefined}
|
|
12360
12356
|
*/
|
|
12361
12357
|
|
|
12362
|
-
rpc.Service = require$$0$
|
|
12358
|
+
rpc.Service = require$$0$4;
|
|
12363
12359
|
});
|
|
12364
12360
|
|
|
12365
12361
|
var roots = {};
|
|
12366
12362
|
|
|
12367
|
-
var require$$1$
|
|
12363
|
+
var require$$1$2 = writer_buffer;
|
|
12368
12364
|
|
|
12369
12365
|
var require$$3 = reader_buffer;
|
|
12370
12366
|
|
|
@@ -12384,8 +12380,8 @@
|
|
|
12384
12380
|
protobuf.build = "minimal";
|
|
12385
12381
|
|
|
12386
12382
|
// Serialization
|
|
12387
|
-
protobuf.Writer = require$$0$
|
|
12388
|
-
protobuf.BufferWriter = require$$1$
|
|
12383
|
+
protobuf.Writer = require$$0$5;
|
|
12384
|
+
protobuf.BufferWriter = require$$1$2;
|
|
12389
12385
|
protobuf.Reader = require$$2;
|
|
12390
12386
|
protobuf.BufferReader = require$$3;
|
|
12391
12387
|
|
|
@@ -12410,9 +12406,9 @@
|
|
|
12410
12406
|
configure();
|
|
12411
12407
|
});
|
|
12412
12408
|
|
|
12413
|
-
var require$$0$
|
|
12409
|
+
var require$$0$3 = indexMinimal;
|
|
12414
12410
|
|
|
12415
|
-
var minimal = require$$0$
|
|
12411
|
+
var minimal = require$$0$3;
|
|
12416
12412
|
|
|
12417
12413
|
var $protobuf = minimal;
|
|
12418
12414
|
|
|
@@ -31166,7 +31162,7 @@
|
|
|
31166
31162
|
//Z_NULL: null // Use -1 or null inline, depending on var type
|
|
31167
31163
|
};
|
|
31168
31164
|
|
|
31169
|
-
var require$$0$
|
|
31165
|
+
var require$$0$2 = trees;
|
|
31170
31166
|
|
|
31171
31167
|
var adler32 = adler32_1;
|
|
31172
31168
|
|
|
@@ -31195,7 +31191,7 @@
|
|
|
31195
31191
|
// misrepresented as being the original software.
|
|
31196
31192
|
// 3. This notice may not be removed or altered from any source distribution.
|
|
31197
31193
|
|
|
31198
|
-
const { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = require$$0$
|
|
31194
|
+
const { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = require$$0$2;
|
|
31199
31195
|
|
|
31200
31196
|
|
|
31201
31197
|
|
|
@@ -36646,13 +36642,13 @@
|
|
|
36646
36642
|
constants: constants
|
|
36647
36643
|
};
|
|
36648
36644
|
|
|
36649
|
-
var require$$0 = deflate_1$1;
|
|
36645
|
+
var require$$0$1 = deflate_1$1;
|
|
36650
36646
|
|
|
36651
|
-
var require$$1 = inflate_1$1;
|
|
36647
|
+
var require$$1$1 = inflate_1$1;
|
|
36652
36648
|
|
|
36653
|
-
const { Deflate, deflate, deflateRaw, gzip } = require$$0;
|
|
36649
|
+
const { Deflate, deflate, deflateRaw, gzip } = require$$0$1;
|
|
36654
36650
|
|
|
36655
|
-
const { Inflate, inflate, inflateRaw, ungzip } = require$$1;
|
|
36651
|
+
const { Inflate, inflate, inflateRaw, ungzip } = require$$1$1;
|
|
36656
36652
|
|
|
36657
36653
|
|
|
36658
36654
|
|
|
@@ -49068,6 +49064,10 @@
|
|
|
49068
49064
|
*/
|
|
49069
49065
|
exports.WebSocketCloseError = void 0;
|
|
49070
49066
|
(function (WebSocketCloseError) {
|
|
49067
|
+
/**
|
|
49068
|
+
* 正常关闭; 无论为何目的而创建,该链接都已成功完成任务。
|
|
49069
|
+
*/
|
|
49070
|
+
WebSocketCloseError["Err_1000"] = "CLOSE_NORMAL";
|
|
49071
49071
|
/**
|
|
49072
49072
|
* 终端离开, 可能因为服务端错误, 也可能因为浏览器正从打开连接的页面跳转离开。
|
|
49073
49073
|
*/
|
|
@@ -49103,6 +49103,9 @@
|
|
|
49103
49103
|
})(exports.WebSocketCloseError || (exports.WebSocketCloseError = {}));
|
|
49104
49104
|
function parseWSClsErr(code) {
|
|
49105
49105
|
switch (code) {
|
|
49106
|
+
case 1000: {
|
|
49107
|
+
return exports.WebSocketCloseError.Err_1000;
|
|
49108
|
+
}
|
|
49106
49109
|
case 1001: {
|
|
49107
49110
|
return exports.WebSocketCloseError.Err_1001;
|
|
49108
49111
|
}
|
|
@@ -51739,13 +51742,27 @@
|
|
|
51739
51742
|
return true;
|
|
51740
51743
|
try {
|
|
51741
51744
|
/** 退出强制关闭语音 */
|
|
51742
|
-
(_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit();
|
|
51743
|
-
yield this.updateStatus(exports.BuiltinEventType.RoomChange, exports.BuiltinActionType.RoomClose, {});
|
|
51745
|
+
yield ((_l = this.$RTC) === null || _l === void 0 ? void 0 : _l.quit());
|
|
51744
51746
|
}
|
|
51745
51747
|
catch (e) {
|
|
51746
51748
|
logger$1.warn(e);
|
|
51747
51749
|
}
|
|
51748
|
-
return yield this._controller.close(
|
|
51750
|
+
return yield this._controller.close();
|
|
51751
|
+
});
|
|
51752
|
+
/**
|
|
51753
|
+
* 关闭带看房间
|
|
51754
|
+
* @param code
|
|
51755
|
+
* @param reason
|
|
51756
|
+
* @returns
|
|
51757
|
+
*/
|
|
51758
|
+
this.close = () => __awaiter$10(this, void 0, void 0, function* () {
|
|
51759
|
+
var _m, _o;
|
|
51760
|
+
if ((_o = (_m = this.selfInfo) === null || _m === void 0 ? void 0 : _m.permission) === null || _o === void 0 ? void 0 : _o.close_live_room) {
|
|
51761
|
+
return yield this.updateStatus(exports.BuiltinEventType.RoomChange, exports.BuiltinActionType.RoomClose, {});
|
|
51762
|
+
}
|
|
51763
|
+
else {
|
|
51764
|
+
return;
|
|
51765
|
+
}
|
|
51749
51766
|
});
|
|
51750
51767
|
/**
|
|
51751
51768
|
* 销毁带看
|
|
@@ -51766,10 +51783,10 @@
|
|
|
51766
51783
|
});
|
|
51767
51784
|
// 仅用于用户自己的麦克风控制
|
|
51768
51785
|
this.toggleMicro = (microStatus) => __awaiter$10(this, void 0, void 0, function* () {
|
|
51769
|
-
var
|
|
51770
|
-
if (!((
|
|
51786
|
+
var _p, _q, _r;
|
|
51787
|
+
if (!((_q = (_p = this.selfInfo) === null || _p === void 0 ? void 0 : _p.permission) === null || _q === void 0 ? void 0 : _q.control_own_micro))
|
|
51771
51788
|
return false;
|
|
51772
|
-
const result = yield ((
|
|
51789
|
+
const result = yield ((_r = this.$RTC) === null || _r === void 0 ? void 0 : _r.toggleMicro(microStatus));
|
|
51773
51790
|
if (result) {
|
|
51774
51791
|
yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserMicroStatus, {
|
|
51775
51792
|
status: microStatus ? exports.MicroStatus.OPEN : exports.MicroStatus.CLOSE,
|
|
@@ -51784,12 +51801,12 @@
|
|
|
51784
51801
|
* @returns
|
|
51785
51802
|
*/
|
|
51786
51803
|
this.forbidMicro = (microStatus, toUserIds) => __awaiter$10(this, void 0, void 0, function* () {
|
|
51787
|
-
var
|
|
51804
|
+
var _s, _t;
|
|
51788
51805
|
if (typeof this._options.canForbidUserMicro === 'function' &&
|
|
51789
51806
|
!this._options.canForbidUserMicro(toUserIds)) {
|
|
51790
51807
|
return false;
|
|
51791
51808
|
}
|
|
51792
|
-
if (!((
|
|
51809
|
+
if (!((_t = (_s = this.selfInfo) === null || _s === void 0 ? void 0 : _s.permission) === null || _t === void 0 ? void 0 : _t.control_other_micro)) {
|
|
51793
51810
|
return false;
|
|
51794
51811
|
}
|
|
51795
51812
|
return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserMicroStatus, {
|
|
@@ -51803,12 +51820,12 @@
|
|
|
51803
51820
|
* @returns
|
|
51804
51821
|
*/
|
|
51805
51822
|
this.forbidSync = (sync, toUserIds) => __awaiter$10(this, void 0, void 0, function* () {
|
|
51806
|
-
var
|
|
51823
|
+
var _u, _v;
|
|
51807
51824
|
if (typeof this._options.canForbidUserSync === 'function' &&
|
|
51808
51825
|
!this._options.canForbidUserSync(toUserIds)) {
|
|
51809
51826
|
return false;
|
|
51810
51827
|
}
|
|
51811
|
-
if (!((
|
|
51828
|
+
if (!((_v = (_u = this.selfInfo) === null || _u === void 0 ? void 0 : _u.permission) === null || _v === void 0 ? void 0 : _v.control_other_sync)) {
|
|
51812
51829
|
return false;
|
|
51813
51830
|
}
|
|
51814
51831
|
return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserPermission, { sync_frame: sync }, toUserIds);
|
|
@@ -51819,12 +51836,12 @@
|
|
|
51819
51836
|
* @returns
|
|
51820
51837
|
*/
|
|
51821
51838
|
this.kick = (toUserIds) => __awaiter$10(this, void 0, void 0, function* () {
|
|
51822
|
-
var
|
|
51839
|
+
var _w, _x;
|
|
51823
51840
|
if (typeof this._options.canForbidUserKick === 'function' &&
|
|
51824
51841
|
!this._options.canForbidUserKick(toUserIds)) {
|
|
51825
51842
|
return false;
|
|
51826
51843
|
}
|
|
51827
|
-
if (!((
|
|
51844
|
+
if (!((_x = (_w = this.selfInfo) === null || _w === void 0 ? void 0 : _w.permission) === null || _x === void 0 ? void 0 : _x.change_other_status)) {
|
|
51828
51845
|
return false;
|
|
51829
51846
|
}
|
|
51830
51847
|
return yield this.updateStatus(exports.BuiltinEventType.UserChange, exports.BuiltinActionType.UserStatus, {
|
|
@@ -52005,20 +52022,2447 @@
|
|
|
52005
52022
|
return new Live(opts);
|
|
52006
52023
|
};
|
|
52007
52024
|
|
|
52025
|
+
/*
|
|
52026
|
+
object-assign
|
|
52027
|
+
(c) Sindre Sorhus
|
|
52028
|
+
@license MIT
|
|
52029
|
+
*/
|
|
52030
|
+
/* eslint-disable no-unused-vars */
|
|
52031
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
52032
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
52033
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
52034
|
+
|
|
52035
|
+
function toObject(val) {
|
|
52036
|
+
if (val === null || val === undefined) {
|
|
52037
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
52038
|
+
}
|
|
52039
|
+
|
|
52040
|
+
return Object(val);
|
|
52041
|
+
}
|
|
52042
|
+
|
|
52043
|
+
function shouldUseNative() {
|
|
52044
|
+
try {
|
|
52045
|
+
if (!Object.assign) {
|
|
52046
|
+
return false;
|
|
52047
|
+
}
|
|
52048
|
+
|
|
52049
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
52050
|
+
|
|
52051
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
52052
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
52053
|
+
test1[5] = 'de';
|
|
52054
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
52055
|
+
return false;
|
|
52056
|
+
}
|
|
52057
|
+
|
|
52058
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
52059
|
+
var test2 = {};
|
|
52060
|
+
for (var i = 0; i < 10; i++) {
|
|
52061
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
52062
|
+
}
|
|
52063
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
52064
|
+
return test2[n];
|
|
52065
|
+
});
|
|
52066
|
+
if (order2.join('') !== '0123456789') {
|
|
52067
|
+
return false;
|
|
52068
|
+
}
|
|
52069
|
+
|
|
52070
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
52071
|
+
var test3 = {};
|
|
52072
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
52073
|
+
test3[letter] = letter;
|
|
52074
|
+
});
|
|
52075
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
52076
|
+
'abcdefghijklmnopqrst') {
|
|
52077
|
+
return false;
|
|
52078
|
+
}
|
|
52079
|
+
|
|
52080
|
+
return true;
|
|
52081
|
+
} catch (err) {
|
|
52082
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
52083
|
+
return false;
|
|
52084
|
+
}
|
|
52085
|
+
}
|
|
52086
|
+
|
|
52087
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
52088
|
+
var from;
|
|
52089
|
+
var to = toObject(target);
|
|
52090
|
+
var symbols;
|
|
52091
|
+
|
|
52092
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
52093
|
+
from = Object(arguments[s]);
|
|
52094
|
+
|
|
52095
|
+
for (var key in from) {
|
|
52096
|
+
if (hasOwnProperty.call(from, key)) {
|
|
52097
|
+
to[key] = from[key];
|
|
52098
|
+
}
|
|
52099
|
+
}
|
|
52100
|
+
|
|
52101
|
+
if (getOwnPropertySymbols) {
|
|
52102
|
+
symbols = getOwnPropertySymbols(from);
|
|
52103
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
52104
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
52105
|
+
to[symbols[i]] = from[symbols[i]];
|
|
52106
|
+
}
|
|
52107
|
+
}
|
|
52108
|
+
}
|
|
52109
|
+
}
|
|
52110
|
+
|
|
52111
|
+
return to;
|
|
52112
|
+
};
|
|
52113
|
+
|
|
52114
|
+
var require$$0 = objectAssign;
|
|
52115
|
+
|
|
52116
|
+
/** @license React v17.0.2
|
|
52117
|
+
* react.development.js
|
|
52118
|
+
*
|
|
52119
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
52120
|
+
*
|
|
52121
|
+
* This source code is licensed under the MIT license found in the
|
|
52122
|
+
* LICENSE file in the root directory of this source tree.
|
|
52123
|
+
*/
|
|
52124
|
+
|
|
52125
|
+
var react_development = createCommonjsModule(function (module, exports) {
|
|
52126
|
+
|
|
52127
|
+
{
|
|
52128
|
+
(function() {
|
|
52129
|
+
|
|
52130
|
+
var _assign = require$$0;
|
|
52131
|
+
|
|
52132
|
+
// TODO: this is special because it gets imported during build.
|
|
52133
|
+
var ReactVersion = '17.0.2';
|
|
52134
|
+
|
|
52135
|
+
// ATTENTION
|
|
52136
|
+
// When adding new symbols to this file,
|
|
52137
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
52138
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
52139
|
+
// nor polyfill, then a plain number is used for performance.
|
|
52140
|
+
var REACT_ELEMENT_TYPE = 0xeac7;
|
|
52141
|
+
var REACT_PORTAL_TYPE = 0xeaca;
|
|
52142
|
+
exports.Fragment = 0xeacb;
|
|
52143
|
+
exports.StrictMode = 0xeacc;
|
|
52144
|
+
exports.Profiler = 0xead2;
|
|
52145
|
+
var REACT_PROVIDER_TYPE = 0xeacd;
|
|
52146
|
+
var REACT_CONTEXT_TYPE = 0xeace;
|
|
52147
|
+
var REACT_FORWARD_REF_TYPE = 0xead0;
|
|
52148
|
+
exports.Suspense = 0xead1;
|
|
52149
|
+
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
|
52150
|
+
var REACT_MEMO_TYPE = 0xead3;
|
|
52151
|
+
var REACT_LAZY_TYPE = 0xead4;
|
|
52152
|
+
var REACT_BLOCK_TYPE = 0xead9;
|
|
52153
|
+
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
52154
|
+
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
52155
|
+
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
|
52156
|
+
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
|
52157
|
+
|
|
52158
|
+
if (typeof Symbol === 'function' && Symbol.for) {
|
|
52159
|
+
var symbolFor = Symbol.for;
|
|
52160
|
+
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
|
52161
|
+
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
|
52162
|
+
exports.Fragment = symbolFor('react.fragment');
|
|
52163
|
+
exports.StrictMode = symbolFor('react.strict_mode');
|
|
52164
|
+
exports.Profiler = symbolFor('react.profiler');
|
|
52165
|
+
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
|
52166
|
+
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
|
52167
|
+
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
|
52168
|
+
exports.Suspense = symbolFor('react.suspense');
|
|
52169
|
+
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
|
52170
|
+
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
52171
|
+
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
52172
|
+
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
52173
|
+
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
52174
|
+
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
52175
|
+
symbolFor('react.scope');
|
|
52176
|
+
symbolFor('react.opaque.id');
|
|
52177
|
+
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
|
52178
|
+
symbolFor('react.offscreen');
|
|
52179
|
+
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
|
52180
|
+
}
|
|
52181
|
+
|
|
52182
|
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
52183
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
52184
|
+
function getIteratorFn(maybeIterable) {
|
|
52185
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
52186
|
+
return null;
|
|
52187
|
+
}
|
|
52188
|
+
|
|
52189
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
52190
|
+
|
|
52191
|
+
if (typeof maybeIterator === 'function') {
|
|
52192
|
+
return maybeIterator;
|
|
52193
|
+
}
|
|
52194
|
+
|
|
52195
|
+
return null;
|
|
52196
|
+
}
|
|
52197
|
+
|
|
52198
|
+
/**
|
|
52199
|
+
* Keeps track of the current dispatcher.
|
|
52200
|
+
*/
|
|
52201
|
+
var ReactCurrentDispatcher = {
|
|
52202
|
+
/**
|
|
52203
|
+
* @internal
|
|
52204
|
+
* @type {ReactComponent}
|
|
52205
|
+
*/
|
|
52206
|
+
current: null
|
|
52207
|
+
};
|
|
52208
|
+
|
|
52209
|
+
/**
|
|
52210
|
+
* Keeps track of the current batch's configuration such as how long an update
|
|
52211
|
+
* should suspend for if it needs to.
|
|
52212
|
+
*/
|
|
52213
|
+
var ReactCurrentBatchConfig = {
|
|
52214
|
+
transition: 0
|
|
52215
|
+
};
|
|
52216
|
+
|
|
52217
|
+
/**
|
|
52218
|
+
* Keeps track of the current owner.
|
|
52219
|
+
*
|
|
52220
|
+
* The current owner is the component who should own any components that are
|
|
52221
|
+
* currently being constructed.
|
|
52222
|
+
*/
|
|
52223
|
+
var ReactCurrentOwner = {
|
|
52224
|
+
/**
|
|
52225
|
+
* @internal
|
|
52226
|
+
* @type {ReactComponent}
|
|
52227
|
+
*/
|
|
52228
|
+
current: null
|
|
52229
|
+
};
|
|
52230
|
+
|
|
52231
|
+
var ReactDebugCurrentFrame = {};
|
|
52232
|
+
var currentExtraStackFrame = null;
|
|
52233
|
+
function setExtraStackFrame(stack) {
|
|
52234
|
+
{
|
|
52235
|
+
currentExtraStackFrame = stack;
|
|
52236
|
+
}
|
|
52237
|
+
}
|
|
52238
|
+
|
|
52239
|
+
{
|
|
52240
|
+
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
|
52241
|
+
{
|
|
52242
|
+
currentExtraStackFrame = stack;
|
|
52243
|
+
}
|
|
52244
|
+
}; // Stack implementation injected by the current renderer.
|
|
52245
|
+
|
|
52246
|
+
|
|
52247
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
52248
|
+
|
|
52249
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
52250
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
|
52251
|
+
|
|
52252
|
+
if (currentExtraStackFrame) {
|
|
52253
|
+
stack += currentExtraStackFrame;
|
|
52254
|
+
} // Delegate to the injected renderer-specific implementation
|
|
52255
|
+
|
|
52256
|
+
|
|
52257
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
52258
|
+
|
|
52259
|
+
if (impl) {
|
|
52260
|
+
stack += impl() || '';
|
|
52261
|
+
}
|
|
52262
|
+
|
|
52263
|
+
return stack;
|
|
52264
|
+
};
|
|
52265
|
+
}
|
|
52266
|
+
|
|
52267
|
+
/**
|
|
52268
|
+
* Used by act() to track whether you're inside an act() scope.
|
|
52269
|
+
*/
|
|
52270
|
+
var IsSomeRendererActing = {
|
|
52271
|
+
current: false
|
|
52272
|
+
};
|
|
52273
|
+
|
|
52274
|
+
var ReactSharedInternals = {
|
|
52275
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
52276
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
52277
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
52278
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
|
52279
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
52280
|
+
assign: _assign
|
|
52281
|
+
};
|
|
52282
|
+
|
|
52283
|
+
{
|
|
52284
|
+
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
52285
|
+
}
|
|
52286
|
+
|
|
52287
|
+
// by calls to these methods by a Babel plugin.
|
|
52288
|
+
//
|
|
52289
|
+
// In PROD (or in packages without access to React internals),
|
|
52290
|
+
// they are left as they are instead.
|
|
52291
|
+
|
|
52292
|
+
function warn(format) {
|
|
52293
|
+
{
|
|
52294
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
52295
|
+
args[_key - 1] = arguments[_key];
|
|
52296
|
+
}
|
|
52297
|
+
|
|
52298
|
+
printWarning('warn', format, args);
|
|
52299
|
+
}
|
|
52300
|
+
}
|
|
52301
|
+
function error(format) {
|
|
52302
|
+
{
|
|
52303
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
52304
|
+
args[_key2 - 1] = arguments[_key2];
|
|
52305
|
+
}
|
|
52306
|
+
|
|
52307
|
+
printWarning('error', format, args);
|
|
52308
|
+
}
|
|
52309
|
+
}
|
|
52310
|
+
|
|
52311
|
+
function printWarning(level, format, args) {
|
|
52312
|
+
// When changing this logic, you might want to also
|
|
52313
|
+
// update consoleWithStackDev.www.js as well.
|
|
52314
|
+
{
|
|
52315
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
52316
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
52317
|
+
|
|
52318
|
+
if (stack !== '') {
|
|
52319
|
+
format += '%s';
|
|
52320
|
+
args = args.concat([stack]);
|
|
52321
|
+
}
|
|
52322
|
+
|
|
52323
|
+
var argsWithFormat = args.map(function (item) {
|
|
52324
|
+
return '' + item;
|
|
52325
|
+
}); // Careful: RN currently depends on this prefix
|
|
52326
|
+
|
|
52327
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
52328
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
52329
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
52330
|
+
|
|
52331
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
52332
|
+
}
|
|
52333
|
+
}
|
|
52334
|
+
|
|
52335
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
|
52336
|
+
|
|
52337
|
+
function warnNoop(publicInstance, callerName) {
|
|
52338
|
+
{
|
|
52339
|
+
var _constructor = publicInstance.constructor;
|
|
52340
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
52341
|
+
var warningKey = componentName + "." + callerName;
|
|
52342
|
+
|
|
52343
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
52344
|
+
return;
|
|
52345
|
+
}
|
|
52346
|
+
|
|
52347
|
+
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);
|
|
52348
|
+
|
|
52349
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
52350
|
+
}
|
|
52351
|
+
}
|
|
52352
|
+
/**
|
|
52353
|
+
* This is the abstract API for an update queue.
|
|
52354
|
+
*/
|
|
52355
|
+
|
|
52356
|
+
|
|
52357
|
+
var ReactNoopUpdateQueue = {
|
|
52358
|
+
/**
|
|
52359
|
+
* Checks whether or not this composite component is mounted.
|
|
52360
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
|
52361
|
+
* @return {boolean} True if mounted, false otherwise.
|
|
52362
|
+
* @protected
|
|
52363
|
+
* @final
|
|
52364
|
+
*/
|
|
52365
|
+
isMounted: function (publicInstance) {
|
|
52366
|
+
return false;
|
|
52367
|
+
},
|
|
52368
|
+
|
|
52369
|
+
/**
|
|
52370
|
+
* Forces an update. This should only be invoked when it is known with
|
|
52371
|
+
* certainty that we are **not** in a DOM transaction.
|
|
52372
|
+
*
|
|
52373
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
52374
|
+
* component's state has changed but `setState` was not called.
|
|
52375
|
+
*
|
|
52376
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
52377
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
52378
|
+
*
|
|
52379
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
52380
|
+
* @param {?function} callback Called after component is updated.
|
|
52381
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
52382
|
+
* @internal
|
|
52383
|
+
*/
|
|
52384
|
+
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
52385
|
+
warnNoop(publicInstance, 'forceUpdate');
|
|
52386
|
+
},
|
|
52387
|
+
|
|
52388
|
+
/**
|
|
52389
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
52390
|
+
* You should treat `this.state` as immutable.
|
|
52391
|
+
*
|
|
52392
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
52393
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
52394
|
+
*
|
|
52395
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
52396
|
+
* @param {object} completeState Next state.
|
|
52397
|
+
* @param {?function} callback Called after component is updated.
|
|
52398
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
52399
|
+
* @internal
|
|
52400
|
+
*/
|
|
52401
|
+
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
52402
|
+
warnNoop(publicInstance, 'replaceState');
|
|
52403
|
+
},
|
|
52404
|
+
|
|
52405
|
+
/**
|
|
52406
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
|
52407
|
+
* internal. This provides a merging strategy that is not available to deep
|
|
52408
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
52409
|
+
* during the merge.
|
|
52410
|
+
*
|
|
52411
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
52412
|
+
* @param {object} partialState Next partial state to be merged with state.
|
|
52413
|
+
* @param {?function} callback Called after component is updated.
|
|
52414
|
+
* @param {?string} Name of the calling function in the public API.
|
|
52415
|
+
* @internal
|
|
52416
|
+
*/
|
|
52417
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
52418
|
+
warnNoop(publicInstance, 'setState');
|
|
52419
|
+
}
|
|
52420
|
+
};
|
|
52421
|
+
|
|
52422
|
+
var emptyObject = {};
|
|
52423
|
+
|
|
52424
|
+
{
|
|
52425
|
+
Object.freeze(emptyObject);
|
|
52426
|
+
}
|
|
52427
|
+
/**
|
|
52428
|
+
* Base class helpers for the updating state of a component.
|
|
52429
|
+
*/
|
|
52430
|
+
|
|
52431
|
+
|
|
52432
|
+
function Component(props, context, updater) {
|
|
52433
|
+
this.props = props;
|
|
52434
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
52435
|
+
|
|
52436
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
52437
|
+
// renderer.
|
|
52438
|
+
|
|
52439
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
52440
|
+
}
|
|
52441
|
+
|
|
52442
|
+
Component.prototype.isReactComponent = {};
|
|
52443
|
+
/**
|
|
52444
|
+
* Sets a subset of the state. Always use this to mutate
|
|
52445
|
+
* state. You should treat `this.state` as immutable.
|
|
52446
|
+
*
|
|
52447
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
52448
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
52449
|
+
*
|
|
52450
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
|
52451
|
+
* as they may eventually be batched together. You can provide an optional
|
|
52452
|
+
* callback that will be executed when the call to setState is actually
|
|
52453
|
+
* completed.
|
|
52454
|
+
*
|
|
52455
|
+
* When a function is provided to setState, it will be called at some point in
|
|
52456
|
+
* the future (not synchronously). It will be called with the up to date
|
|
52457
|
+
* component arguments (state, props, context). These values can be different
|
|
52458
|
+
* from this.* because your function may be called after receiveProps but before
|
|
52459
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
52460
|
+
* assigned to this.
|
|
52461
|
+
*
|
|
52462
|
+
* @param {object|function} partialState Next partial state or function to
|
|
52463
|
+
* produce next partial state to be merged with current state.
|
|
52464
|
+
* @param {?function} callback Called after state is updated.
|
|
52465
|
+
* @final
|
|
52466
|
+
* @protected
|
|
52467
|
+
*/
|
|
52468
|
+
|
|
52469
|
+
Component.prototype.setState = function (partialState, callback) {
|
|
52470
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
52471
|
+
{
|
|
52472
|
+
throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
|
|
52473
|
+
}
|
|
52474
|
+
}
|
|
52475
|
+
|
|
52476
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
52477
|
+
};
|
|
52478
|
+
/**
|
|
52479
|
+
* Forces an update. This should only be invoked when it is known with
|
|
52480
|
+
* certainty that we are **not** in a DOM transaction.
|
|
52481
|
+
*
|
|
52482
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
52483
|
+
* component's state has changed but `setState` was not called.
|
|
52484
|
+
*
|
|
52485
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
52486
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
52487
|
+
*
|
|
52488
|
+
* @param {?function} callback Called after update is complete.
|
|
52489
|
+
* @final
|
|
52490
|
+
* @protected
|
|
52491
|
+
*/
|
|
52492
|
+
|
|
52493
|
+
|
|
52494
|
+
Component.prototype.forceUpdate = function (callback) {
|
|
52495
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
52496
|
+
};
|
|
52497
|
+
/**
|
|
52498
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
52499
|
+
* we would like to deprecate them, we're not going to move them over to this
|
|
52500
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
52501
|
+
*/
|
|
52502
|
+
|
|
52503
|
+
|
|
52504
|
+
{
|
|
52505
|
+
var deprecatedAPIs = {
|
|
52506
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
52507
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
52508
|
+
};
|
|
52509
|
+
|
|
52510
|
+
var defineDeprecationWarning = function (methodName, info) {
|
|
52511
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
52512
|
+
get: function () {
|
|
52513
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
52514
|
+
|
|
52515
|
+
return undefined;
|
|
52516
|
+
}
|
|
52517
|
+
});
|
|
52518
|
+
};
|
|
52519
|
+
|
|
52520
|
+
for (var fnName in deprecatedAPIs) {
|
|
52521
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
52522
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
52523
|
+
}
|
|
52524
|
+
}
|
|
52525
|
+
}
|
|
52526
|
+
|
|
52527
|
+
function ComponentDummy() {}
|
|
52528
|
+
|
|
52529
|
+
ComponentDummy.prototype = Component.prototype;
|
|
52530
|
+
/**
|
|
52531
|
+
* Convenience component with default shallow equality check for sCU.
|
|
52532
|
+
*/
|
|
52533
|
+
|
|
52534
|
+
function PureComponent(props, context, updater) {
|
|
52535
|
+
this.props = props;
|
|
52536
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
52537
|
+
|
|
52538
|
+
this.refs = emptyObject;
|
|
52539
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
52540
|
+
}
|
|
52541
|
+
|
|
52542
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
52543
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
52544
|
+
|
|
52545
|
+
_assign(pureComponentPrototype, Component.prototype);
|
|
52546
|
+
|
|
52547
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
52548
|
+
|
|
52549
|
+
// an immutable object with a single mutable value
|
|
52550
|
+
function createRef() {
|
|
52551
|
+
var refObject = {
|
|
52552
|
+
current: null
|
|
52553
|
+
};
|
|
52554
|
+
|
|
52555
|
+
{
|
|
52556
|
+
Object.seal(refObject);
|
|
52557
|
+
}
|
|
52558
|
+
|
|
52559
|
+
return refObject;
|
|
52560
|
+
}
|
|
52561
|
+
|
|
52562
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
52563
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
52564
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
52565
|
+
}
|
|
52566
|
+
|
|
52567
|
+
function getContextName(type) {
|
|
52568
|
+
return type.displayName || 'Context';
|
|
52569
|
+
}
|
|
52570
|
+
|
|
52571
|
+
function getComponentName(type) {
|
|
52572
|
+
if (type == null) {
|
|
52573
|
+
// Host root, text node or just invalid type.
|
|
52574
|
+
return null;
|
|
52575
|
+
}
|
|
52576
|
+
|
|
52577
|
+
{
|
|
52578
|
+
if (typeof type.tag === 'number') {
|
|
52579
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
52580
|
+
}
|
|
52581
|
+
}
|
|
52582
|
+
|
|
52583
|
+
if (typeof type === 'function') {
|
|
52584
|
+
return type.displayName || type.name || null;
|
|
52585
|
+
}
|
|
52586
|
+
|
|
52587
|
+
if (typeof type === 'string') {
|
|
52588
|
+
return type;
|
|
52589
|
+
}
|
|
52590
|
+
|
|
52591
|
+
switch (type) {
|
|
52592
|
+
case exports.Fragment:
|
|
52593
|
+
return 'Fragment';
|
|
52594
|
+
|
|
52595
|
+
case REACT_PORTAL_TYPE:
|
|
52596
|
+
return 'Portal';
|
|
52597
|
+
|
|
52598
|
+
case exports.Profiler:
|
|
52599
|
+
return 'Profiler';
|
|
52600
|
+
|
|
52601
|
+
case exports.StrictMode:
|
|
52602
|
+
return 'StrictMode';
|
|
52603
|
+
|
|
52604
|
+
case exports.Suspense:
|
|
52605
|
+
return 'Suspense';
|
|
52606
|
+
|
|
52607
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
52608
|
+
return 'SuspenseList';
|
|
52609
|
+
}
|
|
52610
|
+
|
|
52611
|
+
if (typeof type === 'object') {
|
|
52612
|
+
switch (type.$$typeof) {
|
|
52613
|
+
case REACT_CONTEXT_TYPE:
|
|
52614
|
+
var context = type;
|
|
52615
|
+
return getContextName(context) + '.Consumer';
|
|
52616
|
+
|
|
52617
|
+
case REACT_PROVIDER_TYPE:
|
|
52618
|
+
var provider = type;
|
|
52619
|
+
return getContextName(provider._context) + '.Provider';
|
|
52620
|
+
|
|
52621
|
+
case REACT_FORWARD_REF_TYPE:
|
|
52622
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
52623
|
+
|
|
52624
|
+
case REACT_MEMO_TYPE:
|
|
52625
|
+
return getComponentName(type.type);
|
|
52626
|
+
|
|
52627
|
+
case REACT_BLOCK_TYPE:
|
|
52628
|
+
return getComponentName(type._render);
|
|
52629
|
+
|
|
52630
|
+
case REACT_LAZY_TYPE:
|
|
52631
|
+
{
|
|
52632
|
+
var lazyComponent = type;
|
|
52633
|
+
var payload = lazyComponent._payload;
|
|
52634
|
+
var init = lazyComponent._init;
|
|
52635
|
+
|
|
52636
|
+
try {
|
|
52637
|
+
return getComponentName(init(payload));
|
|
52638
|
+
} catch (x) {
|
|
52639
|
+
return null;
|
|
52640
|
+
}
|
|
52641
|
+
}
|
|
52642
|
+
}
|
|
52643
|
+
}
|
|
52644
|
+
|
|
52645
|
+
return null;
|
|
52646
|
+
}
|
|
52647
|
+
|
|
52648
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
52649
|
+
var RESERVED_PROPS = {
|
|
52650
|
+
key: true,
|
|
52651
|
+
ref: true,
|
|
52652
|
+
__self: true,
|
|
52653
|
+
__source: true
|
|
52654
|
+
};
|
|
52655
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
52656
|
+
|
|
52657
|
+
{
|
|
52658
|
+
didWarnAboutStringRefs = {};
|
|
52659
|
+
}
|
|
52660
|
+
|
|
52661
|
+
function hasValidRef(config) {
|
|
52662
|
+
{
|
|
52663
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
52664
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
52665
|
+
|
|
52666
|
+
if (getter && getter.isReactWarning) {
|
|
52667
|
+
return false;
|
|
52668
|
+
}
|
|
52669
|
+
}
|
|
52670
|
+
}
|
|
52671
|
+
|
|
52672
|
+
return config.ref !== undefined;
|
|
52673
|
+
}
|
|
52674
|
+
|
|
52675
|
+
function hasValidKey(config) {
|
|
52676
|
+
{
|
|
52677
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
52678
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
52679
|
+
|
|
52680
|
+
if (getter && getter.isReactWarning) {
|
|
52681
|
+
return false;
|
|
52682
|
+
}
|
|
52683
|
+
}
|
|
52684
|
+
}
|
|
52685
|
+
|
|
52686
|
+
return config.key !== undefined;
|
|
52687
|
+
}
|
|
52688
|
+
|
|
52689
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
52690
|
+
var warnAboutAccessingKey = function () {
|
|
52691
|
+
{
|
|
52692
|
+
if (!specialPropKeyWarningShown) {
|
|
52693
|
+
specialPropKeyWarningShown = true;
|
|
52694
|
+
|
|
52695
|
+
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);
|
|
52696
|
+
}
|
|
52697
|
+
}
|
|
52698
|
+
};
|
|
52699
|
+
|
|
52700
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
52701
|
+
Object.defineProperty(props, 'key', {
|
|
52702
|
+
get: warnAboutAccessingKey,
|
|
52703
|
+
configurable: true
|
|
52704
|
+
});
|
|
52705
|
+
}
|
|
52706
|
+
|
|
52707
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
52708
|
+
var warnAboutAccessingRef = function () {
|
|
52709
|
+
{
|
|
52710
|
+
if (!specialPropRefWarningShown) {
|
|
52711
|
+
specialPropRefWarningShown = true;
|
|
52712
|
+
|
|
52713
|
+
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);
|
|
52714
|
+
}
|
|
52715
|
+
}
|
|
52716
|
+
};
|
|
52717
|
+
|
|
52718
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
52719
|
+
Object.defineProperty(props, 'ref', {
|
|
52720
|
+
get: warnAboutAccessingRef,
|
|
52721
|
+
configurable: true
|
|
52722
|
+
});
|
|
52723
|
+
}
|
|
52724
|
+
|
|
52725
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
52726
|
+
{
|
|
52727
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
52728
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
52729
|
+
|
|
52730
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
52731
|
+
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);
|
|
52732
|
+
|
|
52733
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
52734
|
+
}
|
|
52735
|
+
}
|
|
52736
|
+
}
|
|
52737
|
+
}
|
|
52738
|
+
/**
|
|
52739
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
52740
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
52741
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
52742
|
+
* if something is a React Element.
|
|
52743
|
+
*
|
|
52744
|
+
* @param {*} type
|
|
52745
|
+
* @param {*} props
|
|
52746
|
+
* @param {*} key
|
|
52747
|
+
* @param {string|object} ref
|
|
52748
|
+
* @param {*} owner
|
|
52749
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
52750
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
52751
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
52752
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
52753
|
+
* change in behavior.
|
|
52754
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
52755
|
+
* indicating filename, line number, and/or other information.
|
|
52756
|
+
* @internal
|
|
52757
|
+
*/
|
|
52758
|
+
|
|
52759
|
+
|
|
52760
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
52761
|
+
var element = {
|
|
52762
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
52763
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
52764
|
+
// Built-in properties that belong on the element
|
|
52765
|
+
type: type,
|
|
52766
|
+
key: key,
|
|
52767
|
+
ref: ref,
|
|
52768
|
+
props: props,
|
|
52769
|
+
// Record the component responsible for creating this element.
|
|
52770
|
+
_owner: owner
|
|
52771
|
+
};
|
|
52772
|
+
|
|
52773
|
+
{
|
|
52774
|
+
// The validation flag is currently mutative. We put it on
|
|
52775
|
+
// an external backing store so that we can freeze the whole object.
|
|
52776
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
52777
|
+
// commonly used development environments.
|
|
52778
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
52779
|
+
// the validation flag non-enumerable (where possible, which should
|
|
52780
|
+
// include every environment we run tests in), so the test framework
|
|
52781
|
+
// ignores it.
|
|
52782
|
+
|
|
52783
|
+
Object.defineProperty(element._store, 'validated', {
|
|
52784
|
+
configurable: false,
|
|
52785
|
+
enumerable: false,
|
|
52786
|
+
writable: true,
|
|
52787
|
+
value: false
|
|
52788
|
+
}); // self and source are DEV only properties.
|
|
52789
|
+
|
|
52790
|
+
Object.defineProperty(element, '_self', {
|
|
52791
|
+
configurable: false,
|
|
52792
|
+
enumerable: false,
|
|
52793
|
+
writable: false,
|
|
52794
|
+
value: self
|
|
52795
|
+
}); // Two elements created in two different places should be considered
|
|
52796
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
52797
|
+
|
|
52798
|
+
Object.defineProperty(element, '_source', {
|
|
52799
|
+
configurable: false,
|
|
52800
|
+
enumerable: false,
|
|
52801
|
+
writable: false,
|
|
52802
|
+
value: source
|
|
52803
|
+
});
|
|
52804
|
+
|
|
52805
|
+
if (Object.freeze) {
|
|
52806
|
+
Object.freeze(element.props);
|
|
52807
|
+
Object.freeze(element);
|
|
52808
|
+
}
|
|
52809
|
+
}
|
|
52810
|
+
|
|
52811
|
+
return element;
|
|
52812
|
+
};
|
|
52813
|
+
/**
|
|
52814
|
+
* Create and return a new ReactElement of the given type.
|
|
52815
|
+
* See https://reactjs.org/docs/react-api.html#createelement
|
|
52816
|
+
*/
|
|
52817
|
+
|
|
52818
|
+
function createElement(type, config, children) {
|
|
52819
|
+
var propName; // Reserved names are extracted
|
|
52820
|
+
|
|
52821
|
+
var props = {};
|
|
52822
|
+
var key = null;
|
|
52823
|
+
var ref = null;
|
|
52824
|
+
var self = null;
|
|
52825
|
+
var source = null;
|
|
52826
|
+
|
|
52827
|
+
if (config != null) {
|
|
52828
|
+
if (hasValidRef(config)) {
|
|
52829
|
+
ref = config.ref;
|
|
52830
|
+
|
|
52831
|
+
{
|
|
52832
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
52833
|
+
}
|
|
52834
|
+
}
|
|
52835
|
+
|
|
52836
|
+
if (hasValidKey(config)) {
|
|
52837
|
+
key = '' + config.key;
|
|
52838
|
+
}
|
|
52839
|
+
|
|
52840
|
+
self = config.__self === undefined ? null : config.__self;
|
|
52841
|
+
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
52842
|
+
|
|
52843
|
+
for (propName in config) {
|
|
52844
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
52845
|
+
props[propName] = config[propName];
|
|
52846
|
+
}
|
|
52847
|
+
}
|
|
52848
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
52849
|
+
// the newly allocated props object.
|
|
52850
|
+
|
|
52851
|
+
|
|
52852
|
+
var childrenLength = arguments.length - 2;
|
|
52853
|
+
|
|
52854
|
+
if (childrenLength === 1) {
|
|
52855
|
+
props.children = children;
|
|
52856
|
+
} else if (childrenLength > 1) {
|
|
52857
|
+
var childArray = Array(childrenLength);
|
|
52858
|
+
|
|
52859
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
52860
|
+
childArray[i] = arguments[i + 2];
|
|
52861
|
+
}
|
|
52862
|
+
|
|
52863
|
+
{
|
|
52864
|
+
if (Object.freeze) {
|
|
52865
|
+
Object.freeze(childArray);
|
|
52866
|
+
}
|
|
52867
|
+
}
|
|
52868
|
+
|
|
52869
|
+
props.children = childArray;
|
|
52870
|
+
} // Resolve default props
|
|
52871
|
+
|
|
52872
|
+
|
|
52873
|
+
if (type && type.defaultProps) {
|
|
52874
|
+
var defaultProps = type.defaultProps;
|
|
52875
|
+
|
|
52876
|
+
for (propName in defaultProps) {
|
|
52877
|
+
if (props[propName] === undefined) {
|
|
52878
|
+
props[propName] = defaultProps[propName];
|
|
52879
|
+
}
|
|
52880
|
+
}
|
|
52881
|
+
}
|
|
52882
|
+
|
|
52883
|
+
{
|
|
52884
|
+
if (key || ref) {
|
|
52885
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
52886
|
+
|
|
52887
|
+
if (key) {
|
|
52888
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
52889
|
+
}
|
|
52890
|
+
|
|
52891
|
+
if (ref) {
|
|
52892
|
+
defineRefPropWarningGetter(props, displayName);
|
|
52893
|
+
}
|
|
52894
|
+
}
|
|
52895
|
+
}
|
|
52896
|
+
|
|
52897
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
52898
|
+
}
|
|
52899
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
|
52900
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
52901
|
+
return newElement;
|
|
52902
|
+
}
|
|
52903
|
+
/**
|
|
52904
|
+
* Clone and return a new ReactElement using element as the starting point.
|
|
52905
|
+
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
52906
|
+
*/
|
|
52907
|
+
|
|
52908
|
+
function cloneElement(element, config, children) {
|
|
52909
|
+
if (!!(element === null || element === undefined)) {
|
|
52910
|
+
{
|
|
52911
|
+
throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
|
|
52912
|
+
}
|
|
52913
|
+
}
|
|
52914
|
+
|
|
52915
|
+
var propName; // Original props are copied
|
|
52916
|
+
|
|
52917
|
+
var props = _assign({}, element.props); // Reserved names are extracted
|
|
52918
|
+
|
|
52919
|
+
|
|
52920
|
+
var key = element.key;
|
|
52921
|
+
var ref = element.ref; // Self is preserved since the owner is preserved.
|
|
52922
|
+
|
|
52923
|
+
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
52924
|
+
// transpiler, and the original source is probably a better indicator of the
|
|
52925
|
+
// true owner.
|
|
52926
|
+
|
|
52927
|
+
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
52928
|
+
|
|
52929
|
+
var owner = element._owner;
|
|
52930
|
+
|
|
52931
|
+
if (config != null) {
|
|
52932
|
+
if (hasValidRef(config)) {
|
|
52933
|
+
// Silently steal the ref from the parent.
|
|
52934
|
+
ref = config.ref;
|
|
52935
|
+
owner = ReactCurrentOwner.current;
|
|
52936
|
+
}
|
|
52937
|
+
|
|
52938
|
+
if (hasValidKey(config)) {
|
|
52939
|
+
key = '' + config.key;
|
|
52940
|
+
} // Remaining properties override existing props
|
|
52941
|
+
|
|
52942
|
+
|
|
52943
|
+
var defaultProps;
|
|
52944
|
+
|
|
52945
|
+
if (element.type && element.type.defaultProps) {
|
|
52946
|
+
defaultProps = element.type.defaultProps;
|
|
52947
|
+
}
|
|
52948
|
+
|
|
52949
|
+
for (propName in config) {
|
|
52950
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
52951
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
52952
|
+
// Resolve default props
|
|
52953
|
+
props[propName] = defaultProps[propName];
|
|
52954
|
+
} else {
|
|
52955
|
+
props[propName] = config[propName];
|
|
52956
|
+
}
|
|
52957
|
+
}
|
|
52958
|
+
}
|
|
52959
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
52960
|
+
// the newly allocated props object.
|
|
52961
|
+
|
|
52962
|
+
|
|
52963
|
+
var childrenLength = arguments.length - 2;
|
|
52964
|
+
|
|
52965
|
+
if (childrenLength === 1) {
|
|
52966
|
+
props.children = children;
|
|
52967
|
+
} else if (childrenLength > 1) {
|
|
52968
|
+
var childArray = Array(childrenLength);
|
|
52969
|
+
|
|
52970
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
52971
|
+
childArray[i] = arguments[i + 2];
|
|
52972
|
+
}
|
|
52973
|
+
|
|
52974
|
+
props.children = childArray;
|
|
52975
|
+
}
|
|
52976
|
+
|
|
52977
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
52978
|
+
}
|
|
52979
|
+
/**
|
|
52980
|
+
* Verifies the object is a ReactElement.
|
|
52981
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
52982
|
+
* @param {?object} object
|
|
52983
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
52984
|
+
* @final
|
|
52985
|
+
*/
|
|
52986
|
+
|
|
52987
|
+
function isValidElement(object) {
|
|
52988
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
52989
|
+
}
|
|
52990
|
+
|
|
52991
|
+
var SEPARATOR = '.';
|
|
52992
|
+
var SUBSEPARATOR = ':';
|
|
52993
|
+
/**
|
|
52994
|
+
* Escape and wrap key so it is safe to use as a reactid
|
|
52995
|
+
*
|
|
52996
|
+
* @param {string} key to be escaped.
|
|
52997
|
+
* @return {string} the escaped key.
|
|
52998
|
+
*/
|
|
52999
|
+
|
|
53000
|
+
function escape(key) {
|
|
53001
|
+
var escapeRegex = /[=:]/g;
|
|
53002
|
+
var escaperLookup = {
|
|
53003
|
+
'=': '=0',
|
|
53004
|
+
':': '=2'
|
|
53005
|
+
};
|
|
53006
|
+
var escapedString = key.replace(escapeRegex, function (match) {
|
|
53007
|
+
return escaperLookup[match];
|
|
53008
|
+
});
|
|
53009
|
+
return '$' + escapedString;
|
|
53010
|
+
}
|
|
53011
|
+
/**
|
|
53012
|
+
* TODO: Test that a single child and an array with one item have the same key
|
|
53013
|
+
* pattern.
|
|
53014
|
+
*/
|
|
53015
|
+
|
|
53016
|
+
|
|
53017
|
+
var didWarnAboutMaps = false;
|
|
53018
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
53019
|
+
|
|
53020
|
+
function escapeUserProvidedKey(text) {
|
|
53021
|
+
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
53022
|
+
}
|
|
53023
|
+
/**
|
|
53024
|
+
* Generate a key string that identifies a element within a set.
|
|
53025
|
+
*
|
|
53026
|
+
* @param {*} element A element that could contain a manual key.
|
|
53027
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
53028
|
+
* @return {string}
|
|
53029
|
+
*/
|
|
53030
|
+
|
|
53031
|
+
|
|
53032
|
+
function getElementKey(element, index) {
|
|
53033
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
53034
|
+
// that we don't block potential future ES APIs.
|
|
53035
|
+
if (typeof element === 'object' && element !== null && element.key != null) {
|
|
53036
|
+
// Explicit key
|
|
53037
|
+
return escape('' + element.key);
|
|
53038
|
+
} // Implicit key determined by the index in the set
|
|
53039
|
+
|
|
53040
|
+
|
|
53041
|
+
return index.toString(36);
|
|
53042
|
+
}
|
|
53043
|
+
|
|
53044
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
53045
|
+
var type = typeof children;
|
|
53046
|
+
|
|
53047
|
+
if (type === 'undefined' || type === 'boolean') {
|
|
53048
|
+
// All of the above are perceived as null.
|
|
53049
|
+
children = null;
|
|
53050
|
+
}
|
|
53051
|
+
|
|
53052
|
+
var invokeCallback = false;
|
|
53053
|
+
|
|
53054
|
+
if (children === null) {
|
|
53055
|
+
invokeCallback = true;
|
|
53056
|
+
} else {
|
|
53057
|
+
switch (type) {
|
|
53058
|
+
case 'string':
|
|
53059
|
+
case 'number':
|
|
53060
|
+
invokeCallback = true;
|
|
53061
|
+
break;
|
|
53062
|
+
|
|
53063
|
+
case 'object':
|
|
53064
|
+
switch (children.$$typeof) {
|
|
53065
|
+
case REACT_ELEMENT_TYPE:
|
|
53066
|
+
case REACT_PORTAL_TYPE:
|
|
53067
|
+
invokeCallback = true;
|
|
53068
|
+
}
|
|
53069
|
+
|
|
53070
|
+
}
|
|
53071
|
+
}
|
|
53072
|
+
|
|
53073
|
+
if (invokeCallback) {
|
|
53074
|
+
var _child = children;
|
|
53075
|
+
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
|
53076
|
+
// so that it's consistent if the number of children grows:
|
|
53077
|
+
|
|
53078
|
+
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
53079
|
+
|
|
53080
|
+
if (Array.isArray(mappedChild)) {
|
|
53081
|
+
var escapedChildKey = '';
|
|
53082
|
+
|
|
53083
|
+
if (childKey != null) {
|
|
53084
|
+
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
|
53085
|
+
}
|
|
53086
|
+
|
|
53087
|
+
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
53088
|
+
return c;
|
|
53089
|
+
});
|
|
53090
|
+
} else if (mappedChild != null) {
|
|
53091
|
+
if (isValidElement(mappedChild)) {
|
|
53092
|
+
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
53093
|
+
// traverseAllChildren used to do for objects as children
|
|
53094
|
+
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
53095
|
+
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
53096
|
+
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
|
53097
|
+
}
|
|
53098
|
+
|
|
53099
|
+
array.push(mappedChild);
|
|
53100
|
+
}
|
|
53101
|
+
|
|
53102
|
+
return 1;
|
|
53103
|
+
}
|
|
53104
|
+
|
|
53105
|
+
var child;
|
|
53106
|
+
var nextName;
|
|
53107
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
53108
|
+
|
|
53109
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
53110
|
+
|
|
53111
|
+
if (Array.isArray(children)) {
|
|
53112
|
+
for (var i = 0; i < children.length; i++) {
|
|
53113
|
+
child = children[i];
|
|
53114
|
+
nextName = nextNamePrefix + getElementKey(child, i);
|
|
53115
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
53116
|
+
}
|
|
53117
|
+
} else {
|
|
53118
|
+
var iteratorFn = getIteratorFn(children);
|
|
53119
|
+
|
|
53120
|
+
if (typeof iteratorFn === 'function') {
|
|
53121
|
+
var iterableChildren = children;
|
|
53122
|
+
|
|
53123
|
+
{
|
|
53124
|
+
// Warn about using Maps as children
|
|
53125
|
+
if (iteratorFn === iterableChildren.entries) {
|
|
53126
|
+
if (!didWarnAboutMaps) {
|
|
53127
|
+
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
|
53128
|
+
}
|
|
53129
|
+
|
|
53130
|
+
didWarnAboutMaps = true;
|
|
53131
|
+
}
|
|
53132
|
+
}
|
|
53133
|
+
|
|
53134
|
+
var iterator = iteratorFn.call(iterableChildren);
|
|
53135
|
+
var step;
|
|
53136
|
+
var ii = 0;
|
|
53137
|
+
|
|
53138
|
+
while (!(step = iterator.next()).done) {
|
|
53139
|
+
child = step.value;
|
|
53140
|
+
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
53141
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
53142
|
+
}
|
|
53143
|
+
} else if (type === 'object') {
|
|
53144
|
+
var childrenString = '' + children;
|
|
53145
|
+
|
|
53146
|
+
{
|
|
53147
|
+
{
|
|
53148
|
+
throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
|
|
53149
|
+
}
|
|
53150
|
+
}
|
|
53151
|
+
}
|
|
53152
|
+
}
|
|
53153
|
+
|
|
53154
|
+
return subtreeCount;
|
|
53155
|
+
}
|
|
53156
|
+
|
|
53157
|
+
/**
|
|
53158
|
+
* Maps children that are typically specified as `props.children`.
|
|
53159
|
+
*
|
|
53160
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
53161
|
+
*
|
|
53162
|
+
* The provided mapFunction(child, index) will be called for each
|
|
53163
|
+
* leaf child.
|
|
53164
|
+
*
|
|
53165
|
+
* @param {?*} children Children tree container.
|
|
53166
|
+
* @param {function(*, int)} func The map function.
|
|
53167
|
+
* @param {*} context Context for mapFunction.
|
|
53168
|
+
* @return {object} Object containing the ordered map of results.
|
|
53169
|
+
*/
|
|
53170
|
+
function mapChildren(children, func, context) {
|
|
53171
|
+
if (children == null) {
|
|
53172
|
+
return children;
|
|
53173
|
+
}
|
|
53174
|
+
|
|
53175
|
+
var result = [];
|
|
53176
|
+
var count = 0;
|
|
53177
|
+
mapIntoArray(children, result, '', '', function (child) {
|
|
53178
|
+
return func.call(context, child, count++);
|
|
53179
|
+
});
|
|
53180
|
+
return result;
|
|
53181
|
+
}
|
|
53182
|
+
/**
|
|
53183
|
+
* Count the number of children that are typically specified as
|
|
53184
|
+
* `props.children`.
|
|
53185
|
+
*
|
|
53186
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
53187
|
+
*
|
|
53188
|
+
* @param {?*} children Children tree container.
|
|
53189
|
+
* @return {number} The number of children.
|
|
53190
|
+
*/
|
|
53191
|
+
|
|
53192
|
+
|
|
53193
|
+
function countChildren(children) {
|
|
53194
|
+
var n = 0;
|
|
53195
|
+
mapChildren(children, function () {
|
|
53196
|
+
n++; // Don't return anything
|
|
53197
|
+
});
|
|
53198
|
+
return n;
|
|
53199
|
+
}
|
|
53200
|
+
|
|
53201
|
+
/**
|
|
53202
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
53203
|
+
*
|
|
53204
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
53205
|
+
*
|
|
53206
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
53207
|
+
* leaf child.
|
|
53208
|
+
*
|
|
53209
|
+
* @param {?*} children Children tree container.
|
|
53210
|
+
* @param {function(*, int)} forEachFunc
|
|
53211
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
53212
|
+
*/
|
|
53213
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
53214
|
+
mapChildren(children, function () {
|
|
53215
|
+
forEachFunc.apply(this, arguments); // Don't return anything.
|
|
53216
|
+
}, forEachContext);
|
|
53217
|
+
}
|
|
53218
|
+
/**
|
|
53219
|
+
* Flatten a children object (typically specified as `props.children`) and
|
|
53220
|
+
* return an array with appropriately re-keyed children.
|
|
53221
|
+
*
|
|
53222
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
53223
|
+
*/
|
|
53224
|
+
|
|
53225
|
+
|
|
53226
|
+
function toArray(children) {
|
|
53227
|
+
return mapChildren(children, function (child) {
|
|
53228
|
+
return child;
|
|
53229
|
+
}) || [];
|
|
53230
|
+
}
|
|
53231
|
+
/**
|
|
53232
|
+
* Returns the first child in a collection of children and verifies that there
|
|
53233
|
+
* is only one child in the collection.
|
|
53234
|
+
*
|
|
53235
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
53236
|
+
*
|
|
53237
|
+
* The current implementation of this function assumes that a single child gets
|
|
53238
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
|
53239
|
+
* abstract away the particular structure of children.
|
|
53240
|
+
*
|
|
53241
|
+
* @param {?object} children Child collection structure.
|
|
53242
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
53243
|
+
* structure.
|
|
53244
|
+
*/
|
|
53245
|
+
|
|
53246
|
+
|
|
53247
|
+
function onlyChild(children) {
|
|
53248
|
+
if (!isValidElement(children)) {
|
|
53249
|
+
{
|
|
53250
|
+
throw Error( "React.Children.only expected to receive a single React element child." );
|
|
53251
|
+
}
|
|
53252
|
+
}
|
|
53253
|
+
|
|
53254
|
+
return children;
|
|
53255
|
+
}
|
|
53256
|
+
|
|
53257
|
+
function createContext(defaultValue, calculateChangedBits) {
|
|
53258
|
+
if (calculateChangedBits === undefined) {
|
|
53259
|
+
calculateChangedBits = null;
|
|
53260
|
+
} else {
|
|
53261
|
+
{
|
|
53262
|
+
if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
|
|
53263
|
+
error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
|
|
53264
|
+
}
|
|
53265
|
+
}
|
|
53266
|
+
}
|
|
53267
|
+
|
|
53268
|
+
var context = {
|
|
53269
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
53270
|
+
_calculateChangedBits: calculateChangedBits,
|
|
53271
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
|
53272
|
+
// some renderers as primary and others as secondary. We only expect
|
|
53273
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
|
53274
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
53275
|
+
// Secondary renderers store their context values on separate fields.
|
|
53276
|
+
_currentValue: defaultValue,
|
|
53277
|
+
_currentValue2: defaultValue,
|
|
53278
|
+
// Used to track how many concurrent renderers this context currently
|
|
53279
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
|
53280
|
+
_threadCount: 0,
|
|
53281
|
+
// These are circular
|
|
53282
|
+
Provider: null,
|
|
53283
|
+
Consumer: null
|
|
53284
|
+
};
|
|
53285
|
+
context.Provider = {
|
|
53286
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
|
53287
|
+
_context: context
|
|
53288
|
+
};
|
|
53289
|
+
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
53290
|
+
var hasWarnedAboutUsingConsumerProvider = false;
|
|
53291
|
+
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
53292
|
+
|
|
53293
|
+
{
|
|
53294
|
+
// A separate object, but proxies back to the original context object for
|
|
53295
|
+
// backwards compatibility. It has a different $$typeof, so we can properly
|
|
53296
|
+
// warn for the incorrect usage of Context as a Consumer.
|
|
53297
|
+
var Consumer = {
|
|
53298
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
53299
|
+
_context: context,
|
|
53300
|
+
_calculateChangedBits: context._calculateChangedBits
|
|
53301
|
+
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
53302
|
+
|
|
53303
|
+
Object.defineProperties(Consumer, {
|
|
53304
|
+
Provider: {
|
|
53305
|
+
get: function () {
|
|
53306
|
+
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
53307
|
+
hasWarnedAboutUsingConsumerProvider = true;
|
|
53308
|
+
|
|
53309
|
+
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?');
|
|
53310
|
+
}
|
|
53311
|
+
|
|
53312
|
+
return context.Provider;
|
|
53313
|
+
},
|
|
53314
|
+
set: function (_Provider) {
|
|
53315
|
+
context.Provider = _Provider;
|
|
53316
|
+
}
|
|
53317
|
+
},
|
|
53318
|
+
_currentValue: {
|
|
53319
|
+
get: function () {
|
|
53320
|
+
return context._currentValue;
|
|
53321
|
+
},
|
|
53322
|
+
set: function (_currentValue) {
|
|
53323
|
+
context._currentValue = _currentValue;
|
|
53324
|
+
}
|
|
53325
|
+
},
|
|
53326
|
+
_currentValue2: {
|
|
53327
|
+
get: function () {
|
|
53328
|
+
return context._currentValue2;
|
|
53329
|
+
},
|
|
53330
|
+
set: function (_currentValue2) {
|
|
53331
|
+
context._currentValue2 = _currentValue2;
|
|
53332
|
+
}
|
|
53333
|
+
},
|
|
53334
|
+
_threadCount: {
|
|
53335
|
+
get: function () {
|
|
53336
|
+
return context._threadCount;
|
|
53337
|
+
},
|
|
53338
|
+
set: function (_threadCount) {
|
|
53339
|
+
context._threadCount = _threadCount;
|
|
53340
|
+
}
|
|
53341
|
+
},
|
|
53342
|
+
Consumer: {
|
|
53343
|
+
get: function () {
|
|
53344
|
+
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
53345
|
+
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
53346
|
+
|
|
53347
|
+
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?');
|
|
53348
|
+
}
|
|
53349
|
+
|
|
53350
|
+
return context.Consumer;
|
|
53351
|
+
}
|
|
53352
|
+
},
|
|
53353
|
+
displayName: {
|
|
53354
|
+
get: function () {
|
|
53355
|
+
return context.displayName;
|
|
53356
|
+
},
|
|
53357
|
+
set: function (displayName) {
|
|
53358
|
+
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
53359
|
+
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
53360
|
+
|
|
53361
|
+
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
53362
|
+
}
|
|
53363
|
+
}
|
|
53364
|
+
}
|
|
53365
|
+
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
53366
|
+
|
|
53367
|
+
context.Consumer = Consumer;
|
|
53368
|
+
}
|
|
53369
|
+
|
|
53370
|
+
{
|
|
53371
|
+
context._currentRenderer = null;
|
|
53372
|
+
context._currentRenderer2 = null;
|
|
53373
|
+
}
|
|
53374
|
+
|
|
53375
|
+
return context;
|
|
53376
|
+
}
|
|
53377
|
+
|
|
53378
|
+
var Uninitialized = -1;
|
|
53379
|
+
var Pending = 0;
|
|
53380
|
+
var Resolved = 1;
|
|
53381
|
+
var Rejected = 2;
|
|
53382
|
+
|
|
53383
|
+
function lazyInitializer(payload) {
|
|
53384
|
+
if (payload._status === Uninitialized) {
|
|
53385
|
+
var ctor = payload._result;
|
|
53386
|
+
var thenable = ctor(); // Transition to the next state.
|
|
53387
|
+
|
|
53388
|
+
var pending = payload;
|
|
53389
|
+
pending._status = Pending;
|
|
53390
|
+
pending._result = thenable;
|
|
53391
|
+
thenable.then(function (moduleObject) {
|
|
53392
|
+
if (payload._status === Pending) {
|
|
53393
|
+
var defaultExport = moduleObject.default;
|
|
53394
|
+
|
|
53395
|
+
{
|
|
53396
|
+
if (defaultExport === undefined) {
|
|
53397
|
+
error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
53398
|
+
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
|
53399
|
+
}
|
|
53400
|
+
} // Transition to the next state.
|
|
53401
|
+
|
|
53402
|
+
|
|
53403
|
+
var resolved = payload;
|
|
53404
|
+
resolved._status = Resolved;
|
|
53405
|
+
resolved._result = defaultExport;
|
|
53406
|
+
}
|
|
53407
|
+
}, function (error) {
|
|
53408
|
+
if (payload._status === Pending) {
|
|
53409
|
+
// Transition to the next state.
|
|
53410
|
+
var rejected = payload;
|
|
53411
|
+
rejected._status = Rejected;
|
|
53412
|
+
rejected._result = error;
|
|
53413
|
+
}
|
|
53414
|
+
});
|
|
53415
|
+
}
|
|
53416
|
+
|
|
53417
|
+
if (payload._status === Resolved) {
|
|
53418
|
+
return payload._result;
|
|
53419
|
+
} else {
|
|
53420
|
+
throw payload._result;
|
|
53421
|
+
}
|
|
53422
|
+
}
|
|
53423
|
+
|
|
53424
|
+
function lazy(ctor) {
|
|
53425
|
+
var payload = {
|
|
53426
|
+
// We use these fields to store the result.
|
|
53427
|
+
_status: -1,
|
|
53428
|
+
_result: ctor
|
|
53429
|
+
};
|
|
53430
|
+
var lazyType = {
|
|
53431
|
+
$$typeof: REACT_LAZY_TYPE,
|
|
53432
|
+
_payload: payload,
|
|
53433
|
+
_init: lazyInitializer
|
|
53434
|
+
};
|
|
53435
|
+
|
|
53436
|
+
{
|
|
53437
|
+
// In production, this would just set it on the object.
|
|
53438
|
+
var defaultProps;
|
|
53439
|
+
var propTypes; // $FlowFixMe
|
|
53440
|
+
|
|
53441
|
+
Object.defineProperties(lazyType, {
|
|
53442
|
+
defaultProps: {
|
|
53443
|
+
configurable: true,
|
|
53444
|
+
get: function () {
|
|
53445
|
+
return defaultProps;
|
|
53446
|
+
},
|
|
53447
|
+
set: function (newDefaultProps) {
|
|
53448
|
+
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.');
|
|
53449
|
+
|
|
53450
|
+
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
53451
|
+
// $FlowFixMe
|
|
53452
|
+
|
|
53453
|
+
Object.defineProperty(lazyType, 'defaultProps', {
|
|
53454
|
+
enumerable: true
|
|
53455
|
+
});
|
|
53456
|
+
}
|
|
53457
|
+
},
|
|
53458
|
+
propTypes: {
|
|
53459
|
+
configurable: true,
|
|
53460
|
+
get: function () {
|
|
53461
|
+
return propTypes;
|
|
53462
|
+
},
|
|
53463
|
+
set: function (newPropTypes) {
|
|
53464
|
+
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.');
|
|
53465
|
+
|
|
53466
|
+
propTypes = newPropTypes; // Match production behavior more closely:
|
|
53467
|
+
// $FlowFixMe
|
|
53468
|
+
|
|
53469
|
+
Object.defineProperty(lazyType, 'propTypes', {
|
|
53470
|
+
enumerable: true
|
|
53471
|
+
});
|
|
53472
|
+
}
|
|
53473
|
+
}
|
|
53474
|
+
});
|
|
53475
|
+
}
|
|
53476
|
+
|
|
53477
|
+
return lazyType;
|
|
53478
|
+
}
|
|
53479
|
+
|
|
53480
|
+
function forwardRef(render) {
|
|
53481
|
+
{
|
|
53482
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
53483
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
53484
|
+
} else if (typeof render !== 'function') {
|
|
53485
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
53486
|
+
} else {
|
|
53487
|
+
if (render.length !== 0 && render.length !== 2) {
|
|
53488
|
+
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.');
|
|
53489
|
+
}
|
|
53490
|
+
}
|
|
53491
|
+
|
|
53492
|
+
if (render != null) {
|
|
53493
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
|
53494
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
53495
|
+
}
|
|
53496
|
+
}
|
|
53497
|
+
}
|
|
53498
|
+
|
|
53499
|
+
var elementType = {
|
|
53500
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
53501
|
+
render: render
|
|
53502
|
+
};
|
|
53503
|
+
|
|
53504
|
+
{
|
|
53505
|
+
var ownName;
|
|
53506
|
+
Object.defineProperty(elementType, 'displayName', {
|
|
53507
|
+
enumerable: false,
|
|
53508
|
+
configurable: true,
|
|
53509
|
+
get: function () {
|
|
53510
|
+
return ownName;
|
|
53511
|
+
},
|
|
53512
|
+
set: function (name) {
|
|
53513
|
+
ownName = name;
|
|
53514
|
+
|
|
53515
|
+
if (render.displayName == null) {
|
|
53516
|
+
render.displayName = name;
|
|
53517
|
+
}
|
|
53518
|
+
}
|
|
53519
|
+
});
|
|
53520
|
+
}
|
|
53521
|
+
|
|
53522
|
+
return elementType;
|
|
53523
|
+
}
|
|
53524
|
+
|
|
53525
|
+
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
53526
|
+
|
|
53527
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
53528
|
+
|
|
53529
|
+
function isValidElementType(type) {
|
|
53530
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
53531
|
+
return true;
|
|
53532
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
53533
|
+
|
|
53534
|
+
|
|
53535
|
+
if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
|
|
53536
|
+
return true;
|
|
53537
|
+
}
|
|
53538
|
+
|
|
53539
|
+
if (typeof type === 'object' && type !== null) {
|
|
53540
|
+
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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
|
|
53541
|
+
return true;
|
|
53542
|
+
}
|
|
53543
|
+
}
|
|
53544
|
+
|
|
53545
|
+
return false;
|
|
53546
|
+
}
|
|
53547
|
+
|
|
53548
|
+
function memo(type, compare) {
|
|
53549
|
+
{
|
|
53550
|
+
if (!isValidElementType(type)) {
|
|
53551
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
53552
|
+
}
|
|
53553
|
+
}
|
|
53554
|
+
|
|
53555
|
+
var elementType = {
|
|
53556
|
+
$$typeof: REACT_MEMO_TYPE,
|
|
53557
|
+
type: type,
|
|
53558
|
+
compare: compare === undefined ? null : compare
|
|
53559
|
+
};
|
|
53560
|
+
|
|
53561
|
+
{
|
|
53562
|
+
var ownName;
|
|
53563
|
+
Object.defineProperty(elementType, 'displayName', {
|
|
53564
|
+
enumerable: false,
|
|
53565
|
+
configurable: true,
|
|
53566
|
+
get: function () {
|
|
53567
|
+
return ownName;
|
|
53568
|
+
},
|
|
53569
|
+
set: function (name) {
|
|
53570
|
+
ownName = name;
|
|
53571
|
+
|
|
53572
|
+
if (type.displayName == null) {
|
|
53573
|
+
type.displayName = name;
|
|
53574
|
+
}
|
|
53575
|
+
}
|
|
53576
|
+
});
|
|
53577
|
+
}
|
|
53578
|
+
|
|
53579
|
+
return elementType;
|
|
53580
|
+
}
|
|
53581
|
+
|
|
53582
|
+
function resolveDispatcher() {
|
|
53583
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
|
53584
|
+
|
|
53585
|
+
if (!(dispatcher !== null)) {
|
|
53586
|
+
{
|
|
53587
|
+
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://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
|
|
53588
|
+
}
|
|
53589
|
+
}
|
|
53590
|
+
|
|
53591
|
+
return dispatcher;
|
|
53592
|
+
}
|
|
53593
|
+
|
|
53594
|
+
function useContext(Context, unstable_observedBits) {
|
|
53595
|
+
var dispatcher = resolveDispatcher();
|
|
53596
|
+
|
|
53597
|
+
{
|
|
53598
|
+
if (unstable_observedBits !== undefined) {
|
|
53599
|
+
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://reactjs.org/link/rules-of-hooks' : '');
|
|
53600
|
+
} // TODO: add a more generic warning for invalid values.
|
|
53601
|
+
|
|
53602
|
+
|
|
53603
|
+
if (Context._context !== undefined) {
|
|
53604
|
+
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
53605
|
+
// and nobody should be using this in existing code.
|
|
53606
|
+
|
|
53607
|
+
if (realContext.Consumer === Context) {
|
|
53608
|
+
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?');
|
|
53609
|
+
} else if (realContext.Provider === Context) {
|
|
53610
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
53611
|
+
}
|
|
53612
|
+
}
|
|
53613
|
+
}
|
|
53614
|
+
|
|
53615
|
+
return dispatcher.useContext(Context, unstable_observedBits);
|
|
53616
|
+
}
|
|
53617
|
+
function useState(initialState) {
|
|
53618
|
+
var dispatcher = resolveDispatcher();
|
|
53619
|
+
return dispatcher.useState(initialState);
|
|
53620
|
+
}
|
|
53621
|
+
function useReducer(reducer, initialArg, init) {
|
|
53622
|
+
var dispatcher = resolveDispatcher();
|
|
53623
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
|
53624
|
+
}
|
|
53625
|
+
function useRef(initialValue) {
|
|
53626
|
+
var dispatcher = resolveDispatcher();
|
|
53627
|
+
return dispatcher.useRef(initialValue);
|
|
53628
|
+
}
|
|
53629
|
+
function useEffect(create, deps) {
|
|
53630
|
+
var dispatcher = resolveDispatcher();
|
|
53631
|
+
return dispatcher.useEffect(create, deps);
|
|
53632
|
+
}
|
|
53633
|
+
function useLayoutEffect(create, deps) {
|
|
53634
|
+
var dispatcher = resolveDispatcher();
|
|
53635
|
+
return dispatcher.useLayoutEffect(create, deps);
|
|
53636
|
+
}
|
|
53637
|
+
function useCallback(callback, deps) {
|
|
53638
|
+
var dispatcher = resolveDispatcher();
|
|
53639
|
+
return dispatcher.useCallback(callback, deps);
|
|
53640
|
+
}
|
|
53641
|
+
function useMemo(create, deps) {
|
|
53642
|
+
var dispatcher = resolveDispatcher();
|
|
53643
|
+
return dispatcher.useMemo(create, deps);
|
|
53644
|
+
}
|
|
53645
|
+
function useImperativeHandle(ref, create, deps) {
|
|
53646
|
+
var dispatcher = resolveDispatcher();
|
|
53647
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
53648
|
+
}
|
|
53649
|
+
function useDebugValue(value, formatterFn) {
|
|
53650
|
+
{
|
|
53651
|
+
var dispatcher = resolveDispatcher();
|
|
53652
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
|
53653
|
+
}
|
|
53654
|
+
}
|
|
53655
|
+
|
|
53656
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
53657
|
+
// replaying on render function. This currently only patches the object
|
|
53658
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
|
53659
|
+
// We could also eagerly patch the method.
|
|
53660
|
+
var disabledDepth = 0;
|
|
53661
|
+
var prevLog;
|
|
53662
|
+
var prevInfo;
|
|
53663
|
+
var prevWarn;
|
|
53664
|
+
var prevError;
|
|
53665
|
+
var prevGroup;
|
|
53666
|
+
var prevGroupCollapsed;
|
|
53667
|
+
var prevGroupEnd;
|
|
53668
|
+
|
|
53669
|
+
function disabledLog() {}
|
|
53670
|
+
|
|
53671
|
+
disabledLog.__reactDisabledLog = true;
|
|
53672
|
+
function disableLogs() {
|
|
53673
|
+
{
|
|
53674
|
+
if (disabledDepth === 0) {
|
|
53675
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
53676
|
+
prevLog = console.log;
|
|
53677
|
+
prevInfo = console.info;
|
|
53678
|
+
prevWarn = console.warn;
|
|
53679
|
+
prevError = console.error;
|
|
53680
|
+
prevGroup = console.group;
|
|
53681
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
53682
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
53683
|
+
|
|
53684
|
+
var props = {
|
|
53685
|
+
configurable: true,
|
|
53686
|
+
enumerable: true,
|
|
53687
|
+
value: disabledLog,
|
|
53688
|
+
writable: true
|
|
53689
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
53690
|
+
|
|
53691
|
+
Object.defineProperties(console, {
|
|
53692
|
+
info: props,
|
|
53693
|
+
log: props,
|
|
53694
|
+
warn: props,
|
|
53695
|
+
error: props,
|
|
53696
|
+
group: props,
|
|
53697
|
+
groupCollapsed: props,
|
|
53698
|
+
groupEnd: props
|
|
53699
|
+
});
|
|
53700
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
53701
|
+
}
|
|
53702
|
+
|
|
53703
|
+
disabledDepth++;
|
|
53704
|
+
}
|
|
53705
|
+
}
|
|
53706
|
+
function reenableLogs() {
|
|
53707
|
+
{
|
|
53708
|
+
disabledDepth--;
|
|
53709
|
+
|
|
53710
|
+
if (disabledDepth === 0) {
|
|
53711
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
53712
|
+
var props = {
|
|
53713
|
+
configurable: true,
|
|
53714
|
+
enumerable: true,
|
|
53715
|
+
writable: true
|
|
53716
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
53717
|
+
|
|
53718
|
+
Object.defineProperties(console, {
|
|
53719
|
+
log: _assign({}, props, {
|
|
53720
|
+
value: prevLog
|
|
53721
|
+
}),
|
|
53722
|
+
info: _assign({}, props, {
|
|
53723
|
+
value: prevInfo
|
|
53724
|
+
}),
|
|
53725
|
+
warn: _assign({}, props, {
|
|
53726
|
+
value: prevWarn
|
|
53727
|
+
}),
|
|
53728
|
+
error: _assign({}, props, {
|
|
53729
|
+
value: prevError
|
|
53730
|
+
}),
|
|
53731
|
+
group: _assign({}, props, {
|
|
53732
|
+
value: prevGroup
|
|
53733
|
+
}),
|
|
53734
|
+
groupCollapsed: _assign({}, props, {
|
|
53735
|
+
value: prevGroupCollapsed
|
|
53736
|
+
}),
|
|
53737
|
+
groupEnd: _assign({}, props, {
|
|
53738
|
+
value: prevGroupEnd
|
|
53739
|
+
})
|
|
53740
|
+
});
|
|
53741
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
53742
|
+
}
|
|
53743
|
+
|
|
53744
|
+
if (disabledDepth < 0) {
|
|
53745
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
53746
|
+
}
|
|
53747
|
+
}
|
|
53748
|
+
}
|
|
53749
|
+
|
|
53750
|
+
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
53751
|
+
var prefix;
|
|
53752
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
53753
|
+
{
|
|
53754
|
+
if (prefix === undefined) {
|
|
53755
|
+
// Extract the VM specific prefix used by each line.
|
|
53756
|
+
try {
|
|
53757
|
+
throw Error();
|
|
53758
|
+
} catch (x) {
|
|
53759
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
53760
|
+
prefix = match && match[1] || '';
|
|
53761
|
+
}
|
|
53762
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
53763
|
+
|
|
53764
|
+
|
|
53765
|
+
return '\n' + prefix + name;
|
|
53766
|
+
}
|
|
53767
|
+
}
|
|
53768
|
+
var reentry = false;
|
|
53769
|
+
var componentFrameCache;
|
|
53770
|
+
|
|
53771
|
+
{
|
|
53772
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
53773
|
+
componentFrameCache = new PossiblyWeakMap();
|
|
53774
|
+
}
|
|
53775
|
+
|
|
53776
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
53777
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
|
53778
|
+
if (!fn || reentry) {
|
|
53779
|
+
return '';
|
|
53780
|
+
}
|
|
53781
|
+
|
|
53782
|
+
{
|
|
53783
|
+
var frame = componentFrameCache.get(fn);
|
|
53784
|
+
|
|
53785
|
+
if (frame !== undefined) {
|
|
53786
|
+
return frame;
|
|
53787
|
+
}
|
|
53788
|
+
}
|
|
53789
|
+
|
|
53790
|
+
var control;
|
|
53791
|
+
reentry = true;
|
|
53792
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
53793
|
+
|
|
53794
|
+
Error.prepareStackTrace = undefined;
|
|
53795
|
+
var previousDispatcher;
|
|
53796
|
+
|
|
53797
|
+
{
|
|
53798
|
+
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
53799
|
+
// for warnings.
|
|
53800
|
+
|
|
53801
|
+
ReactCurrentDispatcher$1.current = null;
|
|
53802
|
+
disableLogs();
|
|
53803
|
+
}
|
|
53804
|
+
|
|
53805
|
+
try {
|
|
53806
|
+
// This should throw.
|
|
53807
|
+
if (construct) {
|
|
53808
|
+
// Something should be setting the props in the constructor.
|
|
53809
|
+
var Fake = function () {
|
|
53810
|
+
throw Error();
|
|
53811
|
+
}; // $FlowFixMe
|
|
53812
|
+
|
|
53813
|
+
|
|
53814
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
|
53815
|
+
set: function () {
|
|
53816
|
+
// We use a throwing setter instead of frozen or non-writable props
|
|
53817
|
+
// because that won't throw in a non-strict mode function.
|
|
53818
|
+
throw Error();
|
|
53819
|
+
}
|
|
53820
|
+
});
|
|
53821
|
+
|
|
53822
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
53823
|
+
// We construct a different control for this case to include any extra
|
|
53824
|
+
// frames added by the construct call.
|
|
53825
|
+
try {
|
|
53826
|
+
Reflect.construct(Fake, []);
|
|
53827
|
+
} catch (x) {
|
|
53828
|
+
control = x;
|
|
53829
|
+
}
|
|
53830
|
+
|
|
53831
|
+
Reflect.construct(fn, [], Fake);
|
|
53832
|
+
} else {
|
|
53833
|
+
try {
|
|
53834
|
+
Fake.call();
|
|
53835
|
+
} catch (x) {
|
|
53836
|
+
control = x;
|
|
53837
|
+
}
|
|
53838
|
+
|
|
53839
|
+
fn.call(Fake.prototype);
|
|
53840
|
+
}
|
|
53841
|
+
} else {
|
|
53842
|
+
try {
|
|
53843
|
+
throw Error();
|
|
53844
|
+
} catch (x) {
|
|
53845
|
+
control = x;
|
|
53846
|
+
}
|
|
53847
|
+
|
|
53848
|
+
fn();
|
|
53849
|
+
}
|
|
53850
|
+
} catch (sample) {
|
|
53851
|
+
// This is inlined manually because closure doesn't do it for us.
|
|
53852
|
+
if (sample && control && typeof sample.stack === 'string') {
|
|
53853
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
|
53854
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
|
53855
|
+
var sampleLines = sample.stack.split('\n');
|
|
53856
|
+
var controlLines = control.stack.split('\n');
|
|
53857
|
+
var s = sampleLines.length - 1;
|
|
53858
|
+
var c = controlLines.length - 1;
|
|
53859
|
+
|
|
53860
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
53861
|
+
// We expect at least one stack frame to be shared.
|
|
53862
|
+
// Typically this will be the root most one. However, stack frames may be
|
|
53863
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
53864
|
+
// earlier than the other. We assume that the sample is longer or the same
|
|
53865
|
+
// and there for cut off earlier. So we should find the root most frame in
|
|
53866
|
+
// the sample somewhere in the control.
|
|
53867
|
+
c--;
|
|
53868
|
+
}
|
|
53869
|
+
|
|
53870
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
|
53871
|
+
// Next we find the first one that isn't the same which should be the
|
|
53872
|
+
// frame that called our sample function and the control.
|
|
53873
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
53874
|
+
// In V8, the first line is describing the message but other VMs don't.
|
|
53875
|
+
// If we're about to return the first line, and the control is also on the same
|
|
53876
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
|
53877
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
53878
|
+
// This can happen if you passed a class to function component, or non-function.
|
|
53879
|
+
if (s !== 1 || c !== 1) {
|
|
53880
|
+
do {
|
|
53881
|
+
s--;
|
|
53882
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
|
53883
|
+
// The next one that isn't the same should be our match though.
|
|
53884
|
+
|
|
53885
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
53886
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
53887
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
|
53888
|
+
|
|
53889
|
+
{
|
|
53890
|
+
if (typeof fn === 'function') {
|
|
53891
|
+
componentFrameCache.set(fn, _frame);
|
|
53892
|
+
}
|
|
53893
|
+
} // Return the line we found.
|
|
53894
|
+
|
|
53895
|
+
|
|
53896
|
+
return _frame;
|
|
53897
|
+
}
|
|
53898
|
+
} while (s >= 1 && c >= 0);
|
|
53899
|
+
}
|
|
53900
|
+
|
|
53901
|
+
break;
|
|
53902
|
+
}
|
|
53903
|
+
}
|
|
53904
|
+
}
|
|
53905
|
+
} finally {
|
|
53906
|
+
reentry = false;
|
|
53907
|
+
|
|
53908
|
+
{
|
|
53909
|
+
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
53910
|
+
reenableLogs();
|
|
53911
|
+
}
|
|
53912
|
+
|
|
53913
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
53914
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
|
53915
|
+
|
|
53916
|
+
|
|
53917
|
+
var name = fn ? fn.displayName || fn.name : '';
|
|
53918
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
53919
|
+
|
|
53920
|
+
{
|
|
53921
|
+
if (typeof fn === 'function') {
|
|
53922
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
53923
|
+
}
|
|
53924
|
+
}
|
|
53925
|
+
|
|
53926
|
+
return syntheticFrame;
|
|
53927
|
+
}
|
|
53928
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
53929
|
+
{
|
|
53930
|
+
return describeNativeComponentFrame(fn, false);
|
|
53931
|
+
}
|
|
53932
|
+
}
|
|
53933
|
+
|
|
53934
|
+
function shouldConstruct(Component) {
|
|
53935
|
+
var prototype = Component.prototype;
|
|
53936
|
+
return !!(prototype && prototype.isReactComponent);
|
|
53937
|
+
}
|
|
53938
|
+
|
|
53939
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
53940
|
+
|
|
53941
|
+
if (type == null) {
|
|
53942
|
+
return '';
|
|
53943
|
+
}
|
|
53944
|
+
|
|
53945
|
+
if (typeof type === 'function') {
|
|
53946
|
+
{
|
|
53947
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
53948
|
+
}
|
|
53949
|
+
}
|
|
53950
|
+
|
|
53951
|
+
if (typeof type === 'string') {
|
|
53952
|
+
return describeBuiltInComponentFrame(type);
|
|
53953
|
+
}
|
|
53954
|
+
|
|
53955
|
+
switch (type) {
|
|
53956
|
+
case exports.Suspense:
|
|
53957
|
+
return describeBuiltInComponentFrame('Suspense');
|
|
53958
|
+
|
|
53959
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
53960
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
|
53961
|
+
}
|
|
53962
|
+
|
|
53963
|
+
if (typeof type === 'object') {
|
|
53964
|
+
switch (type.$$typeof) {
|
|
53965
|
+
case REACT_FORWARD_REF_TYPE:
|
|
53966
|
+
return describeFunctionComponentFrame(type.render);
|
|
53967
|
+
|
|
53968
|
+
case REACT_MEMO_TYPE:
|
|
53969
|
+
// Memo may contain any component type so we recursively resolve it.
|
|
53970
|
+
return describeUnknownElementTypeFrameInDEV(type.type);
|
|
53971
|
+
|
|
53972
|
+
case REACT_BLOCK_TYPE:
|
|
53973
|
+
return describeFunctionComponentFrame(type._render);
|
|
53974
|
+
|
|
53975
|
+
case REACT_LAZY_TYPE:
|
|
53976
|
+
{
|
|
53977
|
+
var lazyComponent = type;
|
|
53978
|
+
var payload = lazyComponent._payload;
|
|
53979
|
+
var init = lazyComponent._init;
|
|
53980
|
+
|
|
53981
|
+
try {
|
|
53982
|
+
// Lazy may contain any component type so we recursively resolve it.
|
|
53983
|
+
return describeUnknownElementTypeFrameInDEV(init(payload));
|
|
53984
|
+
} catch (x) {}
|
|
53985
|
+
}
|
|
53986
|
+
}
|
|
53987
|
+
}
|
|
53988
|
+
|
|
53989
|
+
return '';
|
|
53990
|
+
}
|
|
53991
|
+
|
|
53992
|
+
var loggedTypeFailures = {};
|
|
53993
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
53994
|
+
|
|
53995
|
+
function setCurrentlyValidatingElement(element) {
|
|
53996
|
+
{
|
|
53997
|
+
if (element) {
|
|
53998
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type);
|
|
53999
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
54000
|
+
} else {
|
|
54001
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
54002
|
+
}
|
|
54003
|
+
}
|
|
54004
|
+
}
|
|
54005
|
+
|
|
54006
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
54007
|
+
{
|
|
54008
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
54009
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
54010
|
+
|
|
54011
|
+
for (var typeSpecName in typeSpecs) {
|
|
54012
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
54013
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
54014
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
54015
|
+
// After these have been cleaned up, we'll let them throw.
|
|
54016
|
+
|
|
54017
|
+
try {
|
|
54018
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
54019
|
+
// behavior as without this statement except with a better message.
|
|
54020
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
54021
|
+
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`.');
|
|
54022
|
+
err.name = 'Invariant Violation';
|
|
54023
|
+
throw err;
|
|
54024
|
+
}
|
|
54025
|
+
|
|
54026
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
54027
|
+
} catch (ex) {
|
|
54028
|
+
error$1 = ex;
|
|
54029
|
+
}
|
|
54030
|
+
|
|
54031
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
54032
|
+
setCurrentlyValidatingElement(element);
|
|
54033
|
+
|
|
54034
|
+
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
54035
|
+
|
|
54036
|
+
setCurrentlyValidatingElement(null);
|
|
54037
|
+
}
|
|
54038
|
+
|
|
54039
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
54040
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
54041
|
+
// same error.
|
|
54042
|
+
loggedTypeFailures[error$1.message] = true;
|
|
54043
|
+
setCurrentlyValidatingElement(element);
|
|
54044
|
+
|
|
54045
|
+
error('Failed %s type: %s', location, error$1.message);
|
|
54046
|
+
|
|
54047
|
+
setCurrentlyValidatingElement(null);
|
|
54048
|
+
}
|
|
54049
|
+
}
|
|
54050
|
+
}
|
|
54051
|
+
}
|
|
54052
|
+
}
|
|
54053
|
+
|
|
54054
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
54055
|
+
{
|
|
54056
|
+
if (element) {
|
|
54057
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type);
|
|
54058
|
+
setExtraStackFrame(stack);
|
|
54059
|
+
} else {
|
|
54060
|
+
setExtraStackFrame(null);
|
|
54061
|
+
}
|
|
54062
|
+
}
|
|
54063
|
+
}
|
|
54064
|
+
|
|
54065
|
+
var propTypesMisspellWarningShown;
|
|
54066
|
+
|
|
54067
|
+
{
|
|
54068
|
+
propTypesMisspellWarningShown = false;
|
|
54069
|
+
}
|
|
54070
|
+
|
|
54071
|
+
function getDeclarationErrorAddendum() {
|
|
54072
|
+
if (ReactCurrentOwner.current) {
|
|
54073
|
+
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
54074
|
+
|
|
54075
|
+
if (name) {
|
|
54076
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
54077
|
+
}
|
|
54078
|
+
}
|
|
54079
|
+
|
|
54080
|
+
return '';
|
|
54081
|
+
}
|
|
54082
|
+
|
|
54083
|
+
function getSourceInfoErrorAddendum(source) {
|
|
54084
|
+
if (source !== undefined) {
|
|
54085
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
54086
|
+
var lineNumber = source.lineNumber;
|
|
54087
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
54088
|
+
}
|
|
54089
|
+
|
|
54090
|
+
return '';
|
|
54091
|
+
}
|
|
54092
|
+
|
|
54093
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
54094
|
+
if (elementProps !== null && elementProps !== undefined) {
|
|
54095
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
54096
|
+
}
|
|
54097
|
+
|
|
54098
|
+
return '';
|
|
54099
|
+
}
|
|
54100
|
+
/**
|
|
54101
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
54102
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
54103
|
+
* updates.
|
|
54104
|
+
*/
|
|
54105
|
+
|
|
54106
|
+
|
|
54107
|
+
var ownerHasKeyUseWarning = {};
|
|
54108
|
+
|
|
54109
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
54110
|
+
var info = getDeclarationErrorAddendum();
|
|
54111
|
+
|
|
54112
|
+
if (!info) {
|
|
54113
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
54114
|
+
|
|
54115
|
+
if (parentName) {
|
|
54116
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
54117
|
+
}
|
|
54118
|
+
}
|
|
54119
|
+
|
|
54120
|
+
return info;
|
|
54121
|
+
}
|
|
54122
|
+
/**
|
|
54123
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
54124
|
+
* This element is in an array. The array could grow and shrink or be
|
|
54125
|
+
* reordered. All children that haven't already been validated are required to
|
|
54126
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
54127
|
+
* will only be shown once.
|
|
54128
|
+
*
|
|
54129
|
+
* @internal
|
|
54130
|
+
* @param {ReactElement} element Element that requires a key.
|
|
54131
|
+
* @param {*} parentType element's parent's type.
|
|
54132
|
+
*/
|
|
54133
|
+
|
|
54134
|
+
|
|
54135
|
+
function validateExplicitKey(element, parentType) {
|
|
54136
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
54137
|
+
return;
|
|
54138
|
+
}
|
|
54139
|
+
|
|
54140
|
+
element._store.validated = true;
|
|
54141
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
54142
|
+
|
|
54143
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
54144
|
+
return;
|
|
54145
|
+
}
|
|
54146
|
+
|
|
54147
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
54148
|
+
// property, it may be the creator of the child that's responsible for
|
|
54149
|
+
// assigning it a key.
|
|
54150
|
+
|
|
54151
|
+
var childOwner = '';
|
|
54152
|
+
|
|
54153
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
54154
|
+
// Give the component that originally created this child.
|
|
54155
|
+
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
|
54156
|
+
}
|
|
54157
|
+
|
|
54158
|
+
{
|
|
54159
|
+
setCurrentlyValidatingElement$1(element);
|
|
54160
|
+
|
|
54161
|
+
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);
|
|
54162
|
+
|
|
54163
|
+
setCurrentlyValidatingElement$1(null);
|
|
54164
|
+
}
|
|
54165
|
+
}
|
|
54166
|
+
/**
|
|
54167
|
+
* Ensure that every element either is passed in a static location, in an
|
|
54168
|
+
* array with an explicit keys property defined, or in an object literal
|
|
54169
|
+
* with valid key property.
|
|
54170
|
+
*
|
|
54171
|
+
* @internal
|
|
54172
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
54173
|
+
* @param {*} parentType node's parent's type.
|
|
54174
|
+
*/
|
|
54175
|
+
|
|
54176
|
+
|
|
54177
|
+
function validateChildKeys(node, parentType) {
|
|
54178
|
+
if (typeof node !== 'object') {
|
|
54179
|
+
return;
|
|
54180
|
+
}
|
|
54181
|
+
|
|
54182
|
+
if (Array.isArray(node)) {
|
|
54183
|
+
for (var i = 0; i < node.length; i++) {
|
|
54184
|
+
var child = node[i];
|
|
54185
|
+
|
|
54186
|
+
if (isValidElement(child)) {
|
|
54187
|
+
validateExplicitKey(child, parentType);
|
|
54188
|
+
}
|
|
54189
|
+
}
|
|
54190
|
+
} else if (isValidElement(node)) {
|
|
54191
|
+
// This element was passed in a valid location.
|
|
54192
|
+
if (node._store) {
|
|
54193
|
+
node._store.validated = true;
|
|
54194
|
+
}
|
|
54195
|
+
} else if (node) {
|
|
54196
|
+
var iteratorFn = getIteratorFn(node);
|
|
54197
|
+
|
|
54198
|
+
if (typeof iteratorFn === 'function') {
|
|
54199
|
+
// Entry iterators used to provide implicit keys,
|
|
54200
|
+
// but now we print a separate warning for them later.
|
|
54201
|
+
if (iteratorFn !== node.entries) {
|
|
54202
|
+
var iterator = iteratorFn.call(node);
|
|
54203
|
+
var step;
|
|
54204
|
+
|
|
54205
|
+
while (!(step = iterator.next()).done) {
|
|
54206
|
+
if (isValidElement(step.value)) {
|
|
54207
|
+
validateExplicitKey(step.value, parentType);
|
|
54208
|
+
}
|
|
54209
|
+
}
|
|
54210
|
+
}
|
|
54211
|
+
}
|
|
54212
|
+
}
|
|
54213
|
+
}
|
|
54214
|
+
/**
|
|
54215
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
54216
|
+
* provided by the type.
|
|
54217
|
+
*
|
|
54218
|
+
* @param {ReactElement} element
|
|
54219
|
+
*/
|
|
54220
|
+
|
|
54221
|
+
|
|
54222
|
+
function validatePropTypes(element) {
|
|
54223
|
+
{
|
|
54224
|
+
var type = element.type;
|
|
54225
|
+
|
|
54226
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
54227
|
+
return;
|
|
54228
|
+
}
|
|
54229
|
+
|
|
54230
|
+
var propTypes;
|
|
54231
|
+
|
|
54232
|
+
if (typeof type === 'function') {
|
|
54233
|
+
propTypes = type.propTypes;
|
|
54234
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
54235
|
+
// Inner props are checked in the reconciler.
|
|
54236
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
54237
|
+
propTypes = type.propTypes;
|
|
54238
|
+
} else {
|
|
54239
|
+
return;
|
|
54240
|
+
}
|
|
54241
|
+
|
|
54242
|
+
if (propTypes) {
|
|
54243
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
|
54244
|
+
var name = getComponentName(type);
|
|
54245
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
54246
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
54247
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
54248
|
+
|
|
54249
|
+
var _name = getComponentName(type);
|
|
54250
|
+
|
|
54251
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
54252
|
+
}
|
|
54253
|
+
|
|
54254
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
54255
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
54256
|
+
}
|
|
54257
|
+
}
|
|
54258
|
+
}
|
|
54259
|
+
/**
|
|
54260
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
54261
|
+
* @param {ReactElement} fragment
|
|
54262
|
+
*/
|
|
54263
|
+
|
|
54264
|
+
|
|
54265
|
+
function validateFragmentProps(fragment) {
|
|
54266
|
+
{
|
|
54267
|
+
var keys = Object.keys(fragment.props);
|
|
54268
|
+
|
|
54269
|
+
for (var i = 0; i < keys.length; i++) {
|
|
54270
|
+
var key = keys[i];
|
|
54271
|
+
|
|
54272
|
+
if (key !== 'children' && key !== 'key') {
|
|
54273
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
54274
|
+
|
|
54275
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
54276
|
+
|
|
54277
|
+
setCurrentlyValidatingElement$1(null);
|
|
54278
|
+
break;
|
|
54279
|
+
}
|
|
54280
|
+
}
|
|
54281
|
+
|
|
54282
|
+
if (fragment.ref !== null) {
|
|
54283
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
54284
|
+
|
|
54285
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
54286
|
+
|
|
54287
|
+
setCurrentlyValidatingElement$1(null);
|
|
54288
|
+
}
|
|
54289
|
+
}
|
|
54290
|
+
}
|
|
54291
|
+
function createElementWithValidation(type, props, children) {
|
|
54292
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
54293
|
+
// succeed and there will likely be errors in render.
|
|
54294
|
+
|
|
54295
|
+
if (!validType) {
|
|
54296
|
+
var info = '';
|
|
54297
|
+
|
|
54298
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
54299
|
+
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.";
|
|
54300
|
+
}
|
|
54301
|
+
|
|
54302
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
54303
|
+
|
|
54304
|
+
if (sourceInfo) {
|
|
54305
|
+
info += sourceInfo;
|
|
54306
|
+
} else {
|
|
54307
|
+
info += getDeclarationErrorAddendum();
|
|
54308
|
+
}
|
|
54309
|
+
|
|
54310
|
+
var typeString;
|
|
54311
|
+
|
|
54312
|
+
if (type === null) {
|
|
54313
|
+
typeString = 'null';
|
|
54314
|
+
} else if (Array.isArray(type)) {
|
|
54315
|
+
typeString = 'array';
|
|
54316
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
54317
|
+
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
54318
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
54319
|
+
} else {
|
|
54320
|
+
typeString = typeof type;
|
|
54321
|
+
}
|
|
54322
|
+
|
|
54323
|
+
{
|
|
54324
|
+
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);
|
|
54325
|
+
}
|
|
54326
|
+
}
|
|
54327
|
+
|
|
54328
|
+
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
54329
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
54330
|
+
|
|
54331
|
+
if (element == null) {
|
|
54332
|
+
return element;
|
|
54333
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
54334
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
54335
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
54336
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
54337
|
+
// fixed, the key warnings will appear.)
|
|
54338
|
+
|
|
54339
|
+
|
|
54340
|
+
if (validType) {
|
|
54341
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
54342
|
+
validateChildKeys(arguments[i], type);
|
|
54343
|
+
}
|
|
54344
|
+
}
|
|
54345
|
+
|
|
54346
|
+
if (type === exports.Fragment) {
|
|
54347
|
+
validateFragmentProps(element);
|
|
54348
|
+
} else {
|
|
54349
|
+
validatePropTypes(element);
|
|
54350
|
+
}
|
|
54351
|
+
|
|
54352
|
+
return element;
|
|
54353
|
+
}
|
|
54354
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
|
54355
|
+
function createFactoryWithValidation(type) {
|
|
54356
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
54357
|
+
validatedFactory.type = type;
|
|
54358
|
+
|
|
54359
|
+
{
|
|
54360
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
54361
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
|
54362
|
+
|
|
54363
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
54364
|
+
} // Legacy hook: remove it
|
|
54365
|
+
|
|
54366
|
+
|
|
54367
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
54368
|
+
enumerable: false,
|
|
54369
|
+
get: function () {
|
|
54370
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
54371
|
+
|
|
54372
|
+
Object.defineProperty(this, 'type', {
|
|
54373
|
+
value: type
|
|
54374
|
+
});
|
|
54375
|
+
return type;
|
|
54376
|
+
}
|
|
54377
|
+
});
|
|
54378
|
+
}
|
|
54379
|
+
|
|
54380
|
+
return validatedFactory;
|
|
54381
|
+
}
|
|
54382
|
+
function cloneElementWithValidation(element, props, children) {
|
|
54383
|
+
var newElement = cloneElement.apply(this, arguments);
|
|
54384
|
+
|
|
54385
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
54386
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
54387
|
+
}
|
|
54388
|
+
|
|
54389
|
+
validatePropTypes(newElement);
|
|
54390
|
+
return newElement;
|
|
54391
|
+
}
|
|
54392
|
+
|
|
54393
|
+
{
|
|
54394
|
+
|
|
54395
|
+
try {
|
|
54396
|
+
Object.freeze({});
|
|
54397
|
+
/* eslint-enable no-new */
|
|
54398
|
+
} catch (e) {
|
|
54399
|
+
}
|
|
54400
|
+
}
|
|
54401
|
+
|
|
54402
|
+
var createElement$1 = createElementWithValidation ;
|
|
54403
|
+
var cloneElement$1 = cloneElementWithValidation ;
|
|
54404
|
+
var createFactory = createFactoryWithValidation ;
|
|
54405
|
+
var Children = {
|
|
54406
|
+
map: mapChildren,
|
|
54407
|
+
forEach: forEachChildren,
|
|
54408
|
+
count: countChildren,
|
|
54409
|
+
toArray: toArray,
|
|
54410
|
+
only: onlyChild
|
|
54411
|
+
};
|
|
54412
|
+
|
|
54413
|
+
exports.Children = Children;
|
|
54414
|
+
exports.Component = Component;
|
|
54415
|
+
exports.PureComponent = PureComponent;
|
|
54416
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
54417
|
+
exports.cloneElement = cloneElement$1;
|
|
54418
|
+
exports.createContext = createContext;
|
|
54419
|
+
exports.createElement = createElement$1;
|
|
54420
|
+
exports.createFactory = createFactory;
|
|
54421
|
+
exports.createRef = createRef;
|
|
54422
|
+
exports.forwardRef = forwardRef;
|
|
54423
|
+
exports.isValidElement = isValidElement;
|
|
54424
|
+
exports.lazy = lazy;
|
|
54425
|
+
exports.memo = memo;
|
|
54426
|
+
exports.useCallback = useCallback;
|
|
54427
|
+
exports.useContext = useContext;
|
|
54428
|
+
exports.useDebugValue = useDebugValue;
|
|
54429
|
+
exports.useEffect = useEffect;
|
|
54430
|
+
exports.useImperativeHandle = useImperativeHandle;
|
|
54431
|
+
exports.useLayoutEffect = useLayoutEffect;
|
|
54432
|
+
exports.useMemo = useMemo;
|
|
54433
|
+
exports.useReducer = useReducer;
|
|
54434
|
+
exports.useRef = useRef;
|
|
54435
|
+
exports.useState = useState;
|
|
54436
|
+
exports.version = ReactVersion;
|
|
54437
|
+
})();
|
|
54438
|
+
}
|
|
54439
|
+
});
|
|
54440
|
+
|
|
54441
|
+
var require$$1 = react_development;
|
|
54442
|
+
|
|
54443
|
+
var react = createCommonjsModule(function (module) {
|
|
54444
|
+
|
|
54445
|
+
{
|
|
54446
|
+
module.exports = require$$1;
|
|
54447
|
+
}
|
|
54448
|
+
});
|
|
54449
|
+
|
|
54450
|
+
var React = react;
|
|
54451
|
+
|
|
52008
54452
|
/**
|
|
52009
54453
|
* 创建 {@link LiveReact} 实例,并提供 `React` 技术栈相关工具链。
|
|
52010
54454
|
*/
|
|
52011
54455
|
function createLiveReact(options) {
|
|
52012
|
-
const LiveContext =
|
|
54456
|
+
const LiveContext = react.createContext(null);
|
|
52013
54457
|
const live = createLive(options);
|
|
52014
54458
|
const jsBridge = live.jsBridge;
|
|
52015
|
-
const LiveProvider = (props) => (
|
|
54459
|
+
const LiveProvider = (props) => (React.createElement(LiveContext.Provider, { value: live }, props.children));
|
|
52016
54460
|
/**
|
|
52017
54461
|
* 使用live实例
|
|
52018
54462
|
* @returns
|
|
52019
54463
|
*/
|
|
52020
54464
|
const useLiveInstance = () => {
|
|
52021
|
-
const context =
|
|
54465
|
+
const context = React.useContext(LiveContext);
|
|
52022
54466
|
if (!context)
|
|
52023
54467
|
throw new Error('LiveProvider never found.');
|
|
52024
54468
|
return context;
|
|
@@ -52054,7 +54498,7 @@
|
|
|
52054
54498
|
const live = useLiveInstance();
|
|
52055
54499
|
const dependencyList = [live, name, ...deps];
|
|
52056
54500
|
const dispose = () => live.keyframes.off(key, callback);
|
|
52057
|
-
|
|
54501
|
+
React.useEffect(() => {
|
|
52058
54502
|
live.keyframes.on(key, callback);
|
|
52059
54503
|
return dispose;
|
|
52060
54504
|
}, dependencyList);
|
|
@@ -52093,22 +54537,22 @@
|
|
|
52093
54537
|
}
|
|
52094
54538
|
function useKeyframe(key) {
|
|
52095
54539
|
const live = useLiveInstance();
|
|
52096
|
-
const [state, updateState] =
|
|
52097
|
-
|
|
54540
|
+
const [state, updateState] = React.useState(live.getFramesByKey(key));
|
|
54541
|
+
React.useEffect(() => {
|
|
52098
54542
|
const onUpdate = (nextKeyframes) => updateState(nextKeyframes);
|
|
52099
54543
|
const evtName = key;
|
|
52100
54544
|
const callback = onUpdate;
|
|
52101
54545
|
live.keyframes.on(evtName, callback);
|
|
52102
54546
|
return () => live.keyframes.off(evtName, callback);
|
|
52103
54547
|
}, [live]);
|
|
52104
|
-
const setState =
|
|
54548
|
+
const setState = React.useCallback((frame) => live.sendKeyframe(key, frame), [live]);
|
|
52105
54549
|
return [state, setState];
|
|
52106
54550
|
}
|
|
52107
54551
|
function useLiveEventCallback(name, callback, deps = []) {
|
|
52108
54552
|
const live = useLiveInstance();
|
|
52109
54553
|
const dispose = () => live.off(name, callback);
|
|
52110
54554
|
const dependencyList = [live, name, ...deps];
|
|
52111
|
-
|
|
54555
|
+
React.useEffect(() => {
|
|
52112
54556
|
live.on(name, callback);
|
|
52113
54557
|
return dispose;
|
|
52114
54558
|
}, dependencyList);
|
|
@@ -52120,8 +54564,8 @@
|
|
|
52120
54564
|
*/
|
|
52121
54565
|
function useLiveState() {
|
|
52122
54566
|
const live = useLiveInstance();
|
|
52123
|
-
const [state, updateState] =
|
|
52124
|
-
|
|
54567
|
+
const [state, updateState] = React.useState(live.state);
|
|
54568
|
+
React.useEffect(() => {
|
|
52125
54569
|
const stateChange = (state) => updateState(state);
|
|
52126
54570
|
live.on('stateChange', stateChange);
|
|
52127
54571
|
return () => live.off('stateChange', stateChange);
|
|
@@ -52147,7 +54591,7 @@
|
|
|
52147
54591
|
const live = useLiveInstance();
|
|
52148
54592
|
const dispose = () => live.$RTC.off(name, callback);
|
|
52149
54593
|
const dependencyList = [live, name, ...deps];
|
|
52150
|
-
|
|
54594
|
+
React.useEffect(() => {
|
|
52151
54595
|
live.$RTC.on(name, callback);
|
|
52152
54596
|
return dispose;
|
|
52153
54597
|
}, dependencyList);
|
|
@@ -52155,21 +54599,21 @@
|
|
|
52155
54599
|
}
|
|
52156
54600
|
function useSelfInfo() {
|
|
52157
54601
|
const live = useLiveInstance();
|
|
52158
|
-
const [state, updateState] =
|
|
54602
|
+
const [state, updateState] = React.useState(live.selfInfo || {});
|
|
52159
54603
|
const selfInfoUpdate = (userInfo) => updateState(userInfo);
|
|
52160
|
-
|
|
54604
|
+
React.useEffect(() => {
|
|
52161
54605
|
live.on('selfInfoUpdate', selfInfoUpdate);
|
|
52162
54606
|
return () => live.off('selfInfoUpdate', selfInfoUpdate);
|
|
52163
54607
|
}, [live]);
|
|
52164
|
-
const setState =
|
|
54608
|
+
const setState = React.useCallback((userInfo) => __awaiter$10(this, void 0, void 0, function* () {
|
|
52165
54609
|
return yield live.setSelfInfo(userInfo);
|
|
52166
54610
|
}), [live]);
|
|
52167
54611
|
return [state, setState];
|
|
52168
54612
|
}
|
|
52169
54613
|
function useKeyframesSnapshot() {
|
|
52170
54614
|
const live = useLiveInstance();
|
|
52171
|
-
const [state, setState] =
|
|
52172
|
-
|
|
54615
|
+
const [state, setState] = React.useState(live.snapshot);
|
|
54616
|
+
React.useEffect(() => {
|
|
52173
54617
|
const onKeyframes = (keyframes) => setState(keyframes);
|
|
52174
54618
|
live.on('keyframes', onKeyframes);
|
|
52175
54619
|
return () => live.off('keyframes', onKeyframes);
|
|
@@ -52178,9 +54622,9 @@
|
|
|
52178
54622
|
}
|
|
52179
54623
|
function useUserList() {
|
|
52180
54624
|
const live = useLiveInstance();
|
|
52181
|
-
const [state, updateState] =
|
|
54625
|
+
const [state, updateState] = React.useState(live.userList);
|
|
52182
54626
|
const userListUpdate = (userList) => updateState(userList);
|
|
52183
|
-
|
|
54627
|
+
React.useEffect(() => {
|
|
52184
54628
|
live.on('userListUpdate', userListUpdate);
|
|
52185
54629
|
return () => live.off('userListUpdate', userListUpdate);
|
|
52186
54630
|
}, [live]);
|