@realsee/live 0.5.2-dev.5 → 0.5.2-dev.7

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