react.development.js 86 KB

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