Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

react.development.js 73KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320
  1. /** @license React v16.12.0
  2. * react.development.js
  3. *
  4. * Copyright (c) Facebook, Inc. and its affiliates.
  5. *
  6. * This source code is licensed under the MIT license found in the
  7. * LICENSE file in the root directory of this source tree.
  8. */
  9. 'use strict';
  10. if (process.env.NODE_ENV !== "production") {
  11. (function() {
  12. 'use strict';
  13. var _assign = require('object-assign');
  14. var checkPropTypes = require('prop-types/checkPropTypes');
  15. // TODO: this is special because it gets imported during build.
  16. var ReactVersion = '16.12.0';
  17. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  18. // nor polyfill, then a plain number is used for performance.
  19. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  20. var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
  21. var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
  22. var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  23. var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  24. var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  25. var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  26. var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  27. // (unstable) APIs that have been removed. Can we remove the symbols?
  28. var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  29. var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  30. var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
  31. var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
  32. var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  33. var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
  34. var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
  35. var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
  36. var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
  37. var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  38. var FAUX_ITERATOR_SYMBOL = '@@iterator';
  39. function getIteratorFn(maybeIterable) {
  40. if (maybeIterable === null || typeof maybeIterable !== 'object') {
  41. return null;
  42. }
  43. var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
  44. if (typeof maybeIterator === 'function') {
  45. return maybeIterator;
  46. }
  47. return null;
  48. }
  49. // Do not require this module directly! Use normal `invariant` calls with
  50. // template literal strings. The messages will be replaced with error codes
  51. // during build.
  52. /**
  53. * Use invariant() to assert state which your program assumes to be true.
  54. *
  55. * Provide sprintf-style format (only %s is supported) and arguments
  56. * to provide information about what broke and what you were
  57. * expecting.
  58. *
  59. * The invariant message will be stripped in production, but the invariant
  60. * will remain to ensure logic does not differ in production.
  61. */
  62. /**
  63. * Forked from fbjs/warning:
  64. * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
  65. *
  66. * Only change is we use console.warn instead of console.error,
  67. * and do nothing when 'console' is not supported.
  68. * This really simplifies the code.
  69. * ---
  70. * Similar to invariant but only logs a warning if the condition is not met.
  71. * This can be used to log issues in development environments in critical
  72. * paths. Removing the logging code for production environments will keep the
  73. * same logic and follow the same code paths.
  74. */
  75. var lowPriorityWarningWithoutStack = function () {};
  76. {
  77. var printWarning = function (format) {
  78. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  79. args[_key - 1] = arguments[_key];
  80. }
  81. var argIndex = 0;
  82. var message = 'Warning: ' + format.replace(/%s/g, function () {
  83. return args[argIndex++];
  84. });
  85. if (typeof console !== 'undefined') {
  86. console.warn(message);
  87. }
  88. try {
  89. // --- Welcome to debugging React ---
  90. // This error was thrown as a convenience so that you can use this stack
  91. // to find the callsite that caused this warning to fire.
  92. throw new Error(message);
  93. } catch (x) {}
  94. };
  95. lowPriorityWarningWithoutStack = function (condition, format) {
  96. if (format === undefined) {
  97. throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
  98. }
  99. if (!condition) {
  100. for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  101. args[_key2 - 2] = arguments[_key2];
  102. }
  103. printWarning.apply(void 0, [format].concat(args));
  104. }
  105. };
  106. }
  107. var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
  108. /**
  109. * Similar to invariant but only logs a warning if the condition is not met.
  110. * This can be used to log issues in development environments in critical
  111. * paths. Removing the logging code for production environments will keep the
  112. * same logic and follow the same code paths.
  113. */
  114. var warningWithoutStack = function () {};
  115. {
  116. warningWithoutStack = function (condition, format) {
  117. for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  118. args[_key - 2] = arguments[_key];
  119. }
  120. if (format === undefined) {
  121. throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
  122. }
  123. if (args.length > 8) {
  124. // Check before the condition to catch violations early.
  125. throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
  126. }
  127. if (condition) {
  128. return;
  129. }
  130. if (typeof console !== 'undefined') {
  131. var argsWithFormat = args.map(function (item) {
  132. return '' + item;
  133. });
  134. argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
  135. // breaks IE9: https://github.com/facebook/react/issues/13610
  136. Function.prototype.apply.call(console.error, console, argsWithFormat);
  137. }
  138. try {
  139. // --- Welcome to debugging React ---
  140. // This error was thrown as a convenience so that you can use this stack
  141. // to find the callsite that caused this warning to fire.
  142. var argIndex = 0;
  143. var message = 'Warning: ' + format.replace(/%s/g, function () {
  144. return args[argIndex++];
  145. });
  146. throw new Error(message);
  147. } catch (x) {}
  148. };
  149. }
  150. var warningWithoutStack$1 = warningWithoutStack;
  151. var didWarnStateUpdateForUnmountedComponent = {};
  152. function warnNoop(publicInstance, callerName) {
  153. {
  154. var _constructor = publicInstance.constructor;
  155. var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
  156. var warningKey = componentName + "." + callerName;
  157. if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
  158. return;
  159. }
  160. warningWithoutStack$1(false, "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);
  161. didWarnStateUpdateForUnmountedComponent[warningKey] = true;
  162. }
  163. }
  164. /**
  165. * This is the abstract API for an update queue.
  166. */
  167. var ReactNoopUpdateQueue = {
  168. /**
  169. * Checks whether or not this composite component is mounted.
  170. * @param {ReactClass} publicInstance The instance we want to test.
  171. * @return {boolean} True if mounted, false otherwise.
  172. * @protected
  173. * @final
  174. */
  175. isMounted: function (publicInstance) {
  176. return false;
  177. },
  178. /**
  179. * Forces an update. This should only be invoked when it is known with
  180. * certainty that we are **not** in a DOM transaction.
  181. *
  182. * You may want to call this when you know that some deeper aspect of the
  183. * component's state has changed but `setState` was not called.
  184. *
  185. * This will not invoke `shouldComponentUpdate`, but it will invoke
  186. * `componentWillUpdate` and `componentDidUpdate`.
  187. *
  188. * @param {ReactClass} publicInstance The instance that should rerender.
  189. * @param {?function} callback Called after component is updated.
  190. * @param {?string} callerName name of the calling function in the public API.
  191. * @internal
  192. */
  193. enqueueForceUpdate: function (publicInstance, callback, callerName) {
  194. warnNoop(publicInstance, 'forceUpdate');
  195. },
  196. /**
  197. * Replaces all of the state. Always use this or `setState` to mutate state.
  198. * You should treat `this.state` as immutable.
  199. *
  200. * There is no guarantee that `this.state` will be immediately updated, so
  201. * accessing `this.state` after calling this method may return the old value.
  202. *
  203. * @param {ReactClass} publicInstance The instance that should rerender.
  204. * @param {object} completeState Next state.
  205. * @param {?function} callback Called after component is updated.
  206. * @param {?string} callerName name of the calling function in the public API.
  207. * @internal
  208. */
  209. enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
  210. warnNoop(publicInstance, 'replaceState');
  211. },
  212. /**
  213. * Sets a subset of the state. This only exists because _pendingState is
  214. * internal. This provides a merging strategy that is not available to deep
  215. * properties which is confusing. TODO: Expose pendingState or don't use it
  216. * during the merge.
  217. *
  218. * @param {ReactClass} publicInstance The instance that should rerender.
  219. * @param {object} partialState Next partial state to be merged with state.
  220. * @param {?function} callback Called after component is updated.
  221. * @param {?string} Name of the calling function in the public API.
  222. * @internal
  223. */
  224. enqueueSetState: function (publicInstance, partialState, callback, callerName) {
  225. warnNoop(publicInstance, 'setState');
  226. }
  227. };
  228. var emptyObject = {};
  229. {
  230. Object.freeze(emptyObject);
  231. }
  232. /**
  233. * Base class helpers for the updating state of a component.
  234. */
  235. function Component(props, context, updater) {
  236. this.props = props;
  237. this.context = context; // If a component has string refs, we will assign a different object later.
  238. this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
  239. // renderer.
  240. this.updater = updater || ReactNoopUpdateQueue;
  241. }
  242. Component.prototype.isReactComponent = {};
  243. /**
  244. * Sets a subset of the state. Always use this to mutate
  245. * state. You should treat `this.state` as immutable.
  246. *
  247. * There is no guarantee that `this.state` will be immediately updated, so
  248. * accessing `this.state` after calling this method may return the old value.
  249. *
  250. * There is no guarantee that calls to `setState` will run synchronously,
  251. * as they may eventually be batched together. You can provide an optional
  252. * callback that will be executed when the call to setState is actually
  253. * completed.
  254. *
  255. * When a function is provided to setState, it will be called at some point in
  256. * the future (not synchronously). It will be called with the up to date
  257. * component arguments (state, props, context). These values can be different
  258. * from this.* because your function may be called after receiveProps but before
  259. * shouldComponentUpdate, and this new state, props, and context will not yet be
  260. * assigned to this.
  261. *
  262. * @param {object|function} partialState Next partial state or function to
  263. * produce next partial state to be merged with current state.
  264. * @param {?function} callback Called after state is updated.
  265. * @final
  266. * @protected
  267. */
  268. Component.prototype.setState = function (partialState, callback) {
  269. if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
  270. {
  271. throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
  272. }
  273. }
  274. this.updater.enqueueSetState(this, partialState, callback, 'setState');
  275. };
  276. /**
  277. * Forces an update. This should only be invoked when it is known with
  278. * certainty that we are **not** in a DOM transaction.
  279. *
  280. * You may want to call this when you know that some deeper aspect of the
  281. * component's state has changed but `setState` was not called.
  282. *
  283. * This will not invoke `shouldComponentUpdate`, but it will invoke
  284. * `componentWillUpdate` and `componentDidUpdate`.
  285. *
  286. * @param {?function} callback Called after update is complete.
  287. * @final
  288. * @protected
  289. */
  290. Component.prototype.forceUpdate = function (callback) {
  291. this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
  292. };
  293. /**
  294. * Deprecated APIs. These APIs used to exist on classic React classes but since
  295. * we would like to deprecate them, we're not going to move them over to this
  296. * modern base class. Instead, we define a getter that warns if it's accessed.
  297. */
  298. {
  299. var deprecatedAPIs = {
  300. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  301. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
  302. };
  303. var defineDeprecationWarning = function (methodName, info) {
  304. Object.defineProperty(Component.prototype, methodName, {
  305. get: function () {
  306. lowPriorityWarningWithoutStack$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
  307. return undefined;
  308. }
  309. });
  310. };
  311. for (var fnName in deprecatedAPIs) {
  312. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  313. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  314. }
  315. }
  316. }
  317. function ComponentDummy() {}
  318. ComponentDummy.prototype = Component.prototype;
  319. /**
  320. * Convenience component with default shallow equality check for sCU.
  321. */
  322. function PureComponent(props, context, updater) {
  323. this.props = props;
  324. this.context = context; // If a component has string refs, we will assign a different object later.
  325. this.refs = emptyObject;
  326. this.updater = updater || ReactNoopUpdateQueue;
  327. }
  328. var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
  329. pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
  330. _assign(pureComponentPrototype, Component.prototype);
  331. pureComponentPrototype.isPureReactComponent = true;
  332. // an immutable object with a single mutable value
  333. function createRef() {
  334. var refObject = {
  335. current: null
  336. };
  337. {
  338. Object.seal(refObject);
  339. }
  340. return refObject;
  341. }
  342. /**
  343. * Keeps track of the current dispatcher.
  344. */
  345. var ReactCurrentDispatcher = {
  346. /**
  347. * @internal
  348. * @type {ReactComponent}
  349. */
  350. current: null
  351. };
  352. /**
  353. * Keeps track of the current batch's configuration such as how long an update
  354. * should suspend for if it needs to.
  355. */
  356. var ReactCurrentBatchConfig = {
  357. suspense: null
  358. };
  359. /**
  360. * Keeps track of the current owner.
  361. *
  362. * The current owner is the component who should own any components that are
  363. * currently being constructed.
  364. */
  365. var ReactCurrentOwner = {
  366. /**
  367. * @internal
  368. * @type {ReactComponent}
  369. */
  370. current: null
  371. };
  372. var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
  373. var describeComponentFrame = function (name, source, ownerName) {
  374. var sourceInfo = '';
  375. if (source) {
  376. var path = source.fileName;
  377. var fileName = path.replace(BEFORE_SLASH_RE, '');
  378. {
  379. // In DEV, include code for a common special case:
  380. // prefer "folder/index.js" instead of just "index.js".
  381. if (/^index\./.test(fileName)) {
  382. var match = path.match(BEFORE_SLASH_RE);
  383. if (match) {
  384. var pathBeforeSlash = match[1];
  385. if (pathBeforeSlash) {
  386. var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
  387. fileName = folderName + '/' + fileName;
  388. }
  389. }
  390. }
  391. }
  392. sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
  393. } else if (ownerName) {
  394. sourceInfo = ' (created by ' + ownerName + ')';
  395. }
  396. return '\n in ' + (name || 'Unknown') + sourceInfo;
  397. };
  398. var Resolved = 1;
  399. function refineResolvedLazyComponent(lazyComponent) {
  400. return lazyComponent._status === Resolved ? lazyComponent._result : null;
  401. }
  402. function getWrappedName(outerType, innerType, wrapperName) {
  403. var functionName = innerType.displayName || innerType.name || '';
  404. return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
  405. }
  406. function getComponentName(type) {
  407. if (type == null) {
  408. // Host root, text node or just invalid type.
  409. return null;
  410. }
  411. {
  412. if (typeof type.tag === 'number') {
  413. warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
  414. }
  415. }
  416. if (typeof type === 'function') {
  417. return type.displayName || type.name || null;
  418. }
  419. if (typeof type === 'string') {
  420. return type;
  421. }
  422. switch (type) {
  423. case REACT_FRAGMENT_TYPE:
  424. return 'Fragment';
  425. case REACT_PORTAL_TYPE:
  426. return 'Portal';
  427. case REACT_PROFILER_TYPE:
  428. return "Profiler";
  429. case REACT_STRICT_MODE_TYPE:
  430. return 'StrictMode';
  431. case REACT_SUSPENSE_TYPE:
  432. return 'Suspense';
  433. case REACT_SUSPENSE_LIST_TYPE:
  434. return 'SuspenseList';
  435. }
  436. if (typeof type === 'object') {
  437. switch (type.$$typeof) {
  438. case REACT_CONTEXT_TYPE:
  439. return 'Context.Consumer';
  440. case REACT_PROVIDER_TYPE:
  441. return 'Context.Provider';
  442. case REACT_FORWARD_REF_TYPE:
  443. return getWrappedName(type, type.render, 'ForwardRef');
  444. case REACT_MEMO_TYPE:
  445. return getComponentName(type.type);
  446. case REACT_LAZY_TYPE:
  447. {
  448. var thenable = type;
  449. var resolvedThenable = refineResolvedLazyComponent(thenable);
  450. if (resolvedThenable) {
  451. return getComponentName(resolvedThenable);
  452. }
  453. break;
  454. }
  455. }
  456. }
  457. return null;
  458. }
  459. var ReactDebugCurrentFrame = {};
  460. var currentlyValidatingElement = null;
  461. function setCurrentlyValidatingElement(element) {
  462. {
  463. currentlyValidatingElement = element;
  464. }
  465. }
  466. {
  467. // Stack implementation injected by the current renderer.
  468. ReactDebugCurrentFrame.getCurrentStack = null;
  469. ReactDebugCurrentFrame.getStackAddendum = function () {
  470. var stack = ''; // Add an extra top frame while an element is being validated
  471. if (currentlyValidatingElement) {
  472. var name = getComponentName(currentlyValidatingElement.type);
  473. var owner = currentlyValidatingElement._owner;
  474. stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
  475. } // Delegate to the injected renderer-specific implementation
  476. var impl = ReactDebugCurrentFrame.getCurrentStack;
  477. if (impl) {
  478. stack += impl() || '';
  479. }
  480. return stack;
  481. };
  482. }
  483. /**
  484. * Used by act() to track whether you're inside an act() scope.
  485. */
  486. var IsSomeRendererActing = {
  487. current: false
  488. };
  489. var ReactSharedInternals = {
  490. ReactCurrentDispatcher: ReactCurrentDispatcher,
  491. ReactCurrentBatchConfig: ReactCurrentBatchConfig,
  492. ReactCurrentOwner: ReactCurrentOwner,
  493. IsSomeRendererActing: IsSomeRendererActing,
  494. // Used by renderers to avoid bundling object-assign twice in UMD bundles:
  495. assign: _assign
  496. };
  497. {
  498. _assign(ReactSharedInternals, {
  499. // These should not be included in production.
  500. ReactDebugCurrentFrame: ReactDebugCurrentFrame,
  501. // Shim for React DOM 16.0.0 which still destructured (but not used) this.
  502. // TODO: remove in React 17.0.
  503. ReactComponentTreeHook: {}
  504. });
  505. }
  506. /**
  507. * Similar to invariant but only logs a warning if the condition is not met.
  508. * This can be used to log issues in development environments in critical
  509. * paths. Removing the logging code for production environments will keep the
  510. * same logic and follow the same code paths.
  511. */
  512. var warning = warningWithoutStack$1;
  513. {
  514. warning = function (condition, format) {
  515. if (condition) {
  516. return;
  517. }
  518. var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  519. var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
  520. for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  521. args[_key - 2] = arguments[_key];
  522. }
  523. warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
  524. };
  525. }
  526. var warning$1 = warning;
  527. var hasOwnProperty = Object.prototype.hasOwnProperty;
  528. var RESERVED_PROPS = {
  529. key: true,
  530. ref: true,
  531. __self: true,
  532. __source: true
  533. };
  534. var specialPropKeyWarningShown;
  535. var specialPropRefWarningShown;
  536. function hasValidRef(config) {
  537. {
  538. if (hasOwnProperty.call(config, 'ref')) {
  539. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  540. if (getter && getter.isReactWarning) {
  541. return false;
  542. }
  543. }
  544. }
  545. return config.ref !== undefined;
  546. }
  547. function hasValidKey(config) {
  548. {
  549. if (hasOwnProperty.call(config, 'key')) {
  550. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  551. if (getter && getter.isReactWarning) {
  552. return false;
  553. }
  554. }
  555. }
  556. return config.key !== undefined;
  557. }
  558. function defineKeyPropWarningGetter(props, displayName) {
  559. var warnAboutAccessingKey = function () {
  560. if (!specialPropKeyWarningShown) {
  561. specialPropKeyWarningShown = true;
  562. warningWithoutStack$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
  563. }
  564. };
  565. warnAboutAccessingKey.isReactWarning = true;
  566. Object.defineProperty(props, 'key', {
  567. get: warnAboutAccessingKey,
  568. configurable: true
  569. });
  570. }
  571. function defineRefPropWarningGetter(props, displayName) {
  572. var warnAboutAccessingRef = function () {
  573. if (!specialPropRefWarningShown) {
  574. specialPropRefWarningShown = true;
  575. warningWithoutStack$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
  576. }
  577. };
  578. warnAboutAccessingRef.isReactWarning = true;
  579. Object.defineProperty(props, 'ref', {
  580. get: warnAboutAccessingRef,
  581. configurable: true
  582. });
  583. }
  584. /**
  585. * Factory method to create a new React element. This no longer adheres to
  586. * the class pattern, so do not use new to call it. Also, instanceof check
  587. * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
  588. * if something is a React Element.
  589. *
  590. * @param {*} type
  591. * @param {*} props
  592. * @param {*} key
  593. * @param {string|object} ref
  594. * @param {*} owner
  595. * @param {*} self A *temporary* helper to detect places where `this` is
  596. * different from the `owner` when React.createElement is called, so that we
  597. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  598. * functions, and as long as `this` and owner are the same, there will be no
  599. * change in behavior.
  600. * @param {*} source An annotation object (added by a transpiler or otherwise)
  601. * indicating filename, line number, and/or other information.
  602. * @internal
  603. */
  604. var ReactElement = function (type, key, ref, self, source, owner, props) {
  605. var element = {
  606. // This tag allows us to uniquely identify this as a React Element
  607. $$typeof: REACT_ELEMENT_TYPE,
  608. // Built-in properties that belong on the element
  609. type: type,
  610. key: key,
  611. ref: ref,
  612. props: props,
  613. // Record the component responsible for creating this element.
  614. _owner: owner
  615. };
  616. {
  617. // The validation flag is currently mutative. We put it on
  618. // an external backing store so that we can freeze the whole object.
  619. // This can be replaced with a WeakMap once they are implemented in
  620. // commonly used development environments.
  621. element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
  622. // the validation flag non-enumerable (where possible, which should
  623. // include every environment we run tests in), so the test framework
  624. // ignores it.
  625. Object.defineProperty(element._store, 'validated', {
  626. configurable: false,
  627. enumerable: false,
  628. writable: true,
  629. value: false
  630. }); // self and source are DEV only properties.
  631. Object.defineProperty(element, '_self', {
  632. configurable: false,
  633. enumerable: false,
  634. writable: false,
  635. value: self
  636. }); // Two elements created in two different places should be considered
  637. // equal for testing purposes and therefore we hide it from enumeration.
  638. Object.defineProperty(element, '_source', {
  639. configurable: false,
  640. enumerable: false,
  641. writable: false,
  642. value: source
  643. });
  644. if (Object.freeze) {
  645. Object.freeze(element.props);
  646. Object.freeze(element);
  647. }
  648. }
  649. return element;
  650. };
  651. /**
  652. * https://github.com/reactjs/rfcs/pull/107
  653. * @param {*} type
  654. * @param {object} props
  655. * @param {string} key
  656. */
  657. /**
  658. * https://github.com/reactjs/rfcs/pull/107
  659. * @param {*} type
  660. * @param {object} props
  661. * @param {string} key
  662. */
  663. function jsxDEV(type, config, maybeKey, source, self) {
  664. var propName; // Reserved names are extracted
  665. var props = {};
  666. var key = null;
  667. var ref = null; // Currently, key can be spread in as a prop. This causes a potential
  668. // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
  669. // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
  670. // but as an intermediary step, we will use jsxDEV for everything except
  671. // <div {...props} key="Hi" />, because we aren't currently able to tell if
  672. // key is explicitly declared to be undefined or not.
  673. if (maybeKey !== undefined) {
  674. key = '' + maybeKey;
  675. }
  676. if (hasValidKey(config)) {
  677. key = '' + config.key;
  678. }
  679. if (hasValidRef(config)) {
  680. ref = config.ref;
  681. } // Remaining properties are added to a new props object
  682. for (propName in config) {
  683. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  684. props[propName] = config[propName];
  685. }
  686. } // Resolve default props
  687. if (type && type.defaultProps) {
  688. var defaultProps = type.defaultProps;
  689. for (propName in defaultProps) {
  690. if (props[propName] === undefined) {
  691. props[propName] = defaultProps[propName];
  692. }
  693. }
  694. }
  695. if (key || ref) {
  696. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  697. if (key) {
  698. defineKeyPropWarningGetter(props, displayName);
  699. }
  700. if (ref) {
  701. defineRefPropWarningGetter(props, displayName);
  702. }
  703. }
  704. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  705. }
  706. /**
  707. * Create and return a new ReactElement of the given type.
  708. * See https://reactjs.org/docs/react-api.html#createelement
  709. */
  710. function createElement(type, config, children) {
  711. var propName; // Reserved names are extracted
  712. var props = {};
  713. var key = null;
  714. var ref = null;
  715. var self = null;
  716. var source = null;
  717. if (config != null) {
  718. if (hasValidRef(config)) {
  719. ref = config.ref;
  720. }
  721. if (hasValidKey(config)) {
  722. key = '' + config.key;
  723. }
  724. self = config.__self === undefined ? null : config.__self;
  725. source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
  726. for (propName in config) {
  727. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  728. props[propName] = config[propName];
  729. }
  730. }
  731. } // Children can be more than one argument, and those are transferred onto
  732. // the newly allocated props object.
  733. var childrenLength = arguments.length - 2;
  734. if (childrenLength === 1) {
  735. props.children = children;
  736. } else if (childrenLength > 1) {
  737. var childArray = Array(childrenLength);
  738. for (var i = 0; i < childrenLength; i++) {
  739. childArray[i] = arguments[i + 2];
  740. }
  741. {
  742. if (Object.freeze) {
  743. Object.freeze(childArray);
  744. }
  745. }
  746. props.children = childArray;
  747. } // Resolve default props
  748. if (type && type.defaultProps) {
  749. var defaultProps = type.defaultProps;
  750. for (propName in defaultProps) {
  751. if (props[propName] === undefined) {
  752. props[propName] = defaultProps[propName];
  753. }
  754. }
  755. }
  756. {
  757. if (key || ref) {
  758. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  759. if (key) {
  760. defineKeyPropWarningGetter(props, displayName);
  761. }
  762. if (ref) {
  763. defineRefPropWarningGetter(props, displayName);
  764. }
  765. }
  766. }
  767. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  768. }
  769. /**
  770. * Return a function that produces ReactElements of a given type.
  771. * See https://reactjs.org/docs/react-api.html#createfactory
  772. */
  773. function cloneAndReplaceKey(oldElement, newKey) {
  774. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  775. return newElement;
  776. }
  777. /**
  778. * Clone and return a new ReactElement using element as the starting point.
  779. * See https://reactjs.org/docs/react-api.html#cloneelement
  780. */
  781. function cloneElement(element, config, children) {
  782. if (!!(element === null || element === undefined)) {
  783. {
  784. throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
  785. }
  786. }
  787. var propName; // Original props are copied
  788. var props = _assign({}, element.props); // Reserved names are extracted
  789. var key = element.key;
  790. var ref = element.ref; // Self is preserved since the owner is preserved.
  791. var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
  792. // transpiler, and the original source is probably a better indicator of the
  793. // true owner.
  794. var source = element._source; // Owner will be preserved, unless ref is overridden
  795. var owner = element._owner;
  796. if (config != null) {
  797. if (hasValidRef(config)) {
  798. // Silently steal the ref from the parent.
  799. ref = config.ref;
  800. owner = ReactCurrentOwner.current;
  801. }
  802. if (hasValidKey(config)) {
  803. key = '' + config.key;
  804. } // Remaining properties override existing props
  805. var defaultProps;
  806. if (element.type && element.type.defaultProps) {
  807. defaultProps = element.type.defaultProps;
  808. }
  809. for (propName in config) {
  810. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  811. if (config[propName] === undefined && defaultProps !== undefined) {
  812. // Resolve default props
  813. props[propName] = defaultProps[propName];
  814. } else {
  815. props[propName] = config[propName];
  816. }
  817. }
  818. }
  819. } // Children can be more than one argument, and those are transferred onto
  820. // the newly allocated props object.
  821. var childrenLength = arguments.length - 2;
  822. if (childrenLength === 1) {
  823. props.children = children;
  824. } else if (childrenLength > 1) {
  825. var childArray = Array(childrenLength);
  826. for (var i = 0; i < childrenLength; i++) {
  827. childArray[i] = arguments[i + 2];
  828. }
  829. props.children = childArray;
  830. }
  831. return ReactElement(element.type, key, ref, self, source, owner, props);
  832. }
  833. /**
  834. * Verifies the object is a ReactElement.
  835. * See https://reactjs.org/docs/react-api.html#isvalidelement
  836. * @param {?object} object
  837. * @return {boolean} True if `object` is a ReactElement.
  838. * @final
  839. */
  840. function isValidElement(object) {
  841. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  842. }
  843. var SEPARATOR = '.';
  844. var SUBSEPARATOR = ':';
  845. /**
  846. * Escape and wrap key so it is safe to use as a reactid
  847. *
  848. * @param {string} key to be escaped.
  849. * @return {string} the escaped key.
  850. */
  851. function escape(key) {
  852. var escapeRegex = /[=:]/g;
  853. var escaperLookup = {
  854. '=': '=0',
  855. ':': '=2'
  856. };
  857. var escapedString = ('' + key).replace(escapeRegex, function (match) {
  858. return escaperLookup[match];
  859. });
  860. return '$' + escapedString;
  861. }
  862. /**
  863. * TODO: Test that a single child and an array with one item have the same key
  864. * pattern.
  865. */
  866. var didWarnAboutMaps = false;
  867. var userProvidedKeyEscapeRegex = /\/+/g;
  868. function escapeUserProvidedKey(text) {
  869. return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
  870. }
  871. var POOL_SIZE = 10;
  872. var traverseContextPool = [];
  873. function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
  874. if (traverseContextPool.length) {
  875. var traverseContext = traverseContextPool.pop();
  876. traverseContext.result = mapResult;
  877. traverseContext.keyPrefix = keyPrefix;
  878. traverseContext.func = mapFunction;
  879. traverseContext.context = mapContext;
  880. traverseContext.count = 0;
  881. return traverseContext;
  882. } else {
  883. return {
  884. result: mapResult,
  885. keyPrefix: keyPrefix,
  886. func: mapFunction,
  887. context: mapContext,
  888. count: 0
  889. };
  890. }
  891. }
  892. function releaseTraverseContext(traverseContext) {
  893. traverseContext.result = null;
  894. traverseContext.keyPrefix = null;
  895. traverseContext.func = null;
  896. traverseContext.context = null;
  897. traverseContext.count = 0;
  898. if (traverseContextPool.length < POOL_SIZE) {
  899. traverseContextPool.push(traverseContext);
  900. }
  901. }
  902. /**
  903. * @param {?*} children Children tree container.
  904. * @param {!string} nameSoFar Name of the key path so far.
  905. * @param {!function} callback Callback to invoke with each child found.
  906. * @param {?*} traverseContext Used to pass information throughout the traversal
  907. * process.
  908. * @return {!number} The number of children in this subtree.
  909. */
  910. function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
  911. var type = typeof children;
  912. if (type === 'undefined' || type === 'boolean') {
  913. // All of the above are perceived as null.
  914. children = null;
  915. }
  916. var invokeCallback = false;
  917. if (children === null) {
  918. invokeCallback = true;
  919. } else {
  920. switch (type) {
  921. case 'string':
  922. case 'number':
  923. invokeCallback = true;
  924. break;
  925. case 'object':
  926. switch (children.$$typeof) {
  927. case REACT_ELEMENT_TYPE:
  928. case REACT_PORTAL_TYPE:
  929. invokeCallback = true;
  930. }
  931. }
  932. }
  933. if (invokeCallback) {
  934. callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array
  935. // so that it's consistent if the number of children grows.
  936. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
  937. return 1;
  938. }
  939. var child;
  940. var nextName;
  941. var subtreeCount = 0; // Count of children found in the current subtree.
  942. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  943. if (Array.isArray(children)) {
  944. for (var i = 0; i < children.length; i++) {
  945. child = children[i];
  946. nextName = nextNamePrefix + getComponentKey(child, i);
  947. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  948. }
  949. } else {
  950. var iteratorFn = getIteratorFn(children);
  951. if (typeof iteratorFn === 'function') {
  952. {
  953. // Warn about using Maps as children
  954. if (iteratorFn === children.entries) {
  955. !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
  956. didWarnAboutMaps = true;
  957. }
  958. }
  959. var iterator = iteratorFn.call(children);
  960. var step;
  961. var ii = 0;
  962. while (!(step = iterator.next()).done) {
  963. child = step.value;
  964. nextName = nextNamePrefix + getComponentKey(child, ii++);
  965. subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
  966. }
  967. } else if (type === 'object') {
  968. var addendum = '';
  969. {
  970. addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
  971. }
  972. var childrenString = '' + children;
  973. {
  974. {
  975. throw Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum);
  976. }
  977. }
  978. }
  979. }
  980. return subtreeCount;
  981. }
  982. /**
  983. * Traverses children that are typically specified as `props.children`, but
  984. * might also be specified through attributes:
  985. *
  986. * - `traverseAllChildren(this.props.children, ...)`
  987. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  988. *
  989. * The `traverseContext` is an optional argument that is passed through the
  990. * entire traversal. It can be used to store accumulations or anything else that
  991. * the callback might find relevant.
  992. *
  993. * @param {?*} children Children tree object.
  994. * @param {!function} callback To invoke upon traversing each child.
  995. * @param {?*} traverseContext Context for traversal.
  996. * @return {!number} The number of children in this subtree.
  997. */
  998. function traverseAllChildren(children, callback, traverseContext) {
  999. if (children == null) {
  1000. return 0;
  1001. }
  1002. return traverseAllChildrenImpl(children, '', callback, traverseContext);
  1003. }
  1004. /**
  1005. * Generate a key string that identifies a component within a set.
  1006. *
  1007. * @param {*} component A component that could contain a manual key.
  1008. * @param {number} index Index that is used if a manual key is not provided.
  1009. * @return {string}
  1010. */
  1011. function getComponentKey(component, index) {
  1012. // Do some typechecking here since we call this blindly. We want to ensure
  1013. // that we don't block potential future ES APIs.
  1014. if (typeof component === 'object' && component !== null && component.key != null) {
  1015. // Explicit key
  1016. return escape(component.key);
  1017. } // Implicit key determined by the index in the set
  1018. return index.toString(36);
  1019. }
  1020. function forEachSingleChild(bookKeeping, child, name) {
  1021. var func = bookKeeping.func,
  1022. context = bookKeeping.context;
  1023. func.call(context, child, bookKeeping.count++);
  1024. }
  1025. /**
  1026. * Iterates through children that are typically specified as `props.children`.
  1027. *
  1028. * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
  1029. *
  1030. * The provided forEachFunc(child, index) will be called for each
  1031. * leaf child.
  1032. *
  1033. * @param {?*} children Children tree container.
  1034. * @param {function(*, int)} forEachFunc
  1035. * @param {*} forEachContext Context for forEachContext.
  1036. */
  1037. function forEachChildren(children, forEachFunc, forEachContext) {
  1038. if (children == null) {
  1039. return children;
  1040. }
  1041. var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
  1042. traverseAllChildren(children, forEachSingleChild, traverseContext);
  1043. releaseTraverseContext(traverseContext);
  1044. }
  1045. function mapSingleChildIntoContext(bookKeeping, child, childKey) {
  1046. var result = bookKeeping.result,
  1047. keyPrefix = bookKeeping.keyPrefix,
  1048. func = bookKeeping.func,
  1049. context = bookKeeping.context;
  1050. var mappedChild = func.call(context, child, bookKeeping.count++);
  1051. if (Array.isArray(mappedChild)) {
  1052. mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
  1053. return c;
  1054. });
  1055. } else if (mappedChild != null) {
  1056. if (isValidElement(mappedChild)) {
  1057. mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
  1058. // traverseAllChildren used to do for objects as children
  1059. keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
  1060. }
  1061. result.push(mappedChild);
  1062. }
  1063. }
  1064. function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
  1065. var escapedPrefix = '';
  1066. if (prefix != null) {
  1067. escapedPrefix = escapeUserProvidedKey(prefix) + '/';
  1068. }
  1069. var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
  1070. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  1071. releaseTraverseContext(traverseContext);
  1072. }
  1073. /**
  1074. * Maps children that are typically specified as `props.children`.
  1075. *
  1076. * See https://reactjs.org/docs/react-api.html#reactchildrenmap
  1077. *
  1078. * The provided mapFunction(child, key, index) will be called for each
  1079. * leaf child.
  1080. *
  1081. * @param {?*} children Children tree container.
  1082. * @param {function(*, int)} func The map function.
  1083. * @param {*} context Context for mapFunction.
  1084. * @return {object} Object containing the ordered map of results.
  1085. */
  1086. function mapChildren(children, func, context) {
  1087. if (children == null) {
  1088. return children;
  1089. }
  1090. var result = [];
  1091. mapIntoWithKeyPrefixInternal(children, result, null, func, context);
  1092. return result;
  1093. }
  1094. /**
  1095. * Count the number of children that are typically specified as
  1096. * `props.children`.
  1097. *
  1098. * See https://reactjs.org/docs/react-api.html#reactchildrencount
  1099. *
  1100. * @param {?*} children Children tree container.
  1101. * @return {number} The number of children.
  1102. */
  1103. function countChildren(children) {
  1104. return traverseAllChildren(children, function () {
  1105. return null;
  1106. }, null);
  1107. }
  1108. /**
  1109. * Flatten a children object (typically specified as `props.children`) and
  1110. * return an array with appropriately re-keyed children.
  1111. *
  1112. * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
  1113. */
  1114. function toArray(children) {
  1115. var result = [];
  1116. mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
  1117. return child;
  1118. });
  1119. return result;
  1120. }
  1121. /**
  1122. * Returns the first child in a collection of children and verifies that there
  1123. * is only one child in the collection.
  1124. *
  1125. * See https://reactjs.org/docs/react-api.html#reactchildrenonly
  1126. *
  1127. * The current implementation of this function assumes that a single child gets
  1128. * passed without a wrapper, but the purpose of this helper function is to
  1129. * abstract away the particular structure of children.
  1130. *
  1131. * @param {?object} children Child collection structure.
  1132. * @return {ReactElement} The first and only `ReactElement` contained in the
  1133. * structure.
  1134. */
  1135. function onlyChild(children) {
  1136. if (!isValidElement(children)) {
  1137. {
  1138. throw Error("React.Children.only expected to receive a single React element child.");
  1139. }
  1140. }
  1141. return children;
  1142. }
  1143. function createContext(defaultValue, calculateChangedBits) {
  1144. if (calculateChangedBits === undefined) {
  1145. calculateChangedBits = null;
  1146. } else {
  1147. {
  1148. !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
  1149. }
  1150. }
  1151. var context = {
  1152. $$typeof: REACT_CONTEXT_TYPE,
  1153. _calculateChangedBits: calculateChangedBits,
  1154. // As a workaround to support multiple concurrent renderers, we categorize
  1155. // some renderers as primary and others as secondary. We only expect
  1156. // there to be two concurrent renderers at most: React Native (primary) and
  1157. // Fabric (secondary); React DOM (primary) and React ART (secondary).
  1158. // Secondary renderers store their context values on separate fields.
  1159. _currentValue: defaultValue,
  1160. _currentValue2: defaultValue,
  1161. // Used to track how many concurrent renderers this context currently
  1162. // supports within in a single renderer. Such as parallel server rendering.
  1163. _threadCount: 0,
  1164. // These are circular
  1165. Provider: null,
  1166. Consumer: null
  1167. };
  1168. context.Provider = {
  1169. $$typeof: REACT_PROVIDER_TYPE,
  1170. _context: context
  1171. };
  1172. var hasWarnedAboutUsingNestedContextConsumers = false;
  1173. var hasWarnedAboutUsingConsumerProvider = false;
  1174. {
  1175. // A separate object, but proxies back to the original context object for
  1176. // backwards compatibility. It has a different $$typeof, so we can properly
  1177. // warn for the incorrect usage of Context as a Consumer.
  1178. var Consumer = {
  1179. $$typeof: REACT_CONTEXT_TYPE,
  1180. _context: context,
  1181. _calculateChangedBits: context._calculateChangedBits
  1182. }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
  1183. Object.defineProperties(Consumer, {
  1184. Provider: {
  1185. get: function () {
  1186. if (!hasWarnedAboutUsingConsumerProvider) {
  1187. hasWarnedAboutUsingConsumerProvider = true;
  1188. warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
  1189. }
  1190. return context.Provider;
  1191. },
  1192. set: function (_Provider) {
  1193. context.Provider = _Provider;
  1194. }
  1195. },
  1196. _currentValue: {
  1197. get: function () {
  1198. return context._currentValue;
  1199. },
  1200. set: function (_currentValue) {
  1201. context._currentValue = _currentValue;
  1202. }
  1203. },
  1204. _currentValue2: {
  1205. get: function () {
  1206. return context._currentValue2;
  1207. },
  1208. set: function (_currentValue2) {
  1209. context._currentValue2 = _currentValue2;
  1210. }
  1211. },
  1212. _threadCount: {
  1213. get: function () {
  1214. return context._threadCount;
  1215. },
  1216. set: function (_threadCount) {
  1217. context._threadCount = _threadCount;
  1218. }
  1219. },
  1220. Consumer: {
  1221. get: function () {
  1222. if (!hasWarnedAboutUsingNestedContextConsumers) {
  1223. hasWarnedAboutUsingNestedContextConsumers = true;
  1224. warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
  1225. }
  1226. return context.Consumer;
  1227. }
  1228. }
  1229. }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
  1230. context.Consumer = Consumer;
  1231. }
  1232. {
  1233. context._currentRenderer = null;
  1234. context._currentRenderer2 = null;
  1235. }
  1236. return context;
  1237. }
  1238. function lazy(ctor) {
  1239. var lazyType = {
  1240. $$typeof: REACT_LAZY_TYPE,
  1241. _ctor: ctor,
  1242. // React uses these fields to store the result.
  1243. _status: -1,
  1244. _result: null
  1245. };
  1246. {
  1247. // In production, this would just set it on the object.
  1248. var defaultProps;
  1249. var propTypes;
  1250. Object.defineProperties(lazyType, {
  1251. defaultProps: {
  1252. configurable: true,
  1253. get: function () {
  1254. return defaultProps;
  1255. },
  1256. set: function (newDefaultProps) {
  1257. warning$1(false, '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.');
  1258. defaultProps = newDefaultProps; // Match production behavior more closely:
  1259. Object.defineProperty(lazyType, 'defaultProps', {
  1260. enumerable: true
  1261. });
  1262. }
  1263. },
  1264. propTypes: {
  1265. configurable: true,
  1266. get: function () {
  1267. return propTypes;
  1268. },
  1269. set: function (newPropTypes) {
  1270. warning$1(false, '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.');
  1271. propTypes = newPropTypes; // Match production behavior more closely:
  1272. Object.defineProperty(lazyType, 'propTypes', {
  1273. enumerable: true
  1274. });
  1275. }
  1276. }
  1277. });
  1278. }
  1279. return lazyType;
  1280. }
  1281. function forwardRef(render) {
  1282. {
  1283. if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
  1284. warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
  1285. } else if (typeof render !== 'function') {
  1286. warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
  1287. } else {
  1288. !( // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
  1289. render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, '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.') : void 0;
  1290. }
  1291. if (render != null) {
  1292. !(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
  1293. }
  1294. }
  1295. return {
  1296. $$typeof: REACT_FORWARD_REF_TYPE,
  1297. render: render
  1298. };
  1299. }
  1300. function isValidElementType(type) {
  1301. return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
  1302. type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE);
  1303. }
  1304. function memo(type, compare) {
  1305. {
  1306. if (!isValidElementType(type)) {
  1307. warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
  1308. }
  1309. }
  1310. return {
  1311. $$typeof: REACT_MEMO_TYPE,
  1312. type: type,
  1313. compare: compare === undefined ? null : compare
  1314. };
  1315. }
  1316. function resolveDispatcher() {
  1317. var dispatcher = ReactCurrentDispatcher.current;
  1318. if (!(dispatcher !== null)) {
  1319. {
  1320. throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.");
  1321. }
  1322. }
  1323. return dispatcher;
  1324. }
  1325. function useContext(Context, unstable_observedBits) {
  1326. var dispatcher = resolveDispatcher();
  1327. {
  1328. !(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0; // TODO: add a more generic warning for invalid values.
  1329. if (Context._context !== undefined) {
  1330. var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
  1331. // and nobody should be using this in existing code.
  1332. if (realContext.Consumer === Context) {
  1333. warning$1(false, '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?');
  1334. } else if (realContext.Provider === Context) {
  1335. warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
  1336. }
  1337. }
  1338. }
  1339. return dispatcher.useContext(Context, unstable_observedBits);
  1340. }
  1341. function useState(initialState) {
  1342. var dispatcher = resolveDispatcher();
  1343. return dispatcher.useState(initialState);
  1344. }
  1345. function useReducer(reducer, initialArg, init) {
  1346. var dispatcher = resolveDispatcher();
  1347. return dispatcher.useReducer(reducer, initialArg, init);
  1348. }
  1349. function useRef(initialValue) {
  1350. var dispatcher = resolveDispatcher();
  1351. return dispatcher.useRef(initialValue);
  1352. }
  1353. function useEffect(create, inputs) {
  1354. var dispatcher = resolveDispatcher();
  1355. return dispatcher.useEffect(create, inputs);
  1356. }
  1357. function useLayoutEffect(create, inputs) {
  1358. var dispatcher = resolveDispatcher();
  1359. return dispatcher.useLayoutEffect(create, inputs);
  1360. }
  1361. function useCallback(callback, inputs) {
  1362. var dispatcher = resolveDispatcher();
  1363. return dispatcher.useCallback(callback, inputs);
  1364. }
  1365. function useMemo(create, inputs) {
  1366. var dispatcher = resolveDispatcher();
  1367. return dispatcher.useMemo(create, inputs);
  1368. }
  1369. function useImperativeHandle(ref, create, inputs) {
  1370. var dispatcher = resolveDispatcher();
  1371. return dispatcher.useImperativeHandle(ref, create, inputs);
  1372. }
  1373. function useDebugValue(value, formatterFn) {
  1374. {
  1375. var dispatcher = resolveDispatcher();
  1376. return dispatcher.useDebugValue(value, formatterFn);
  1377. }
  1378. }
  1379. var emptyObject$1 = {};
  1380. function useResponder(responder, listenerProps) {
  1381. var dispatcher = resolveDispatcher();
  1382. {
  1383. if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
  1384. warning$1(false, 'useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
  1385. return;
  1386. }
  1387. }
  1388. return dispatcher.useResponder(responder, listenerProps || emptyObject$1);
  1389. }
  1390. function useTransition(config) {
  1391. var dispatcher = resolveDispatcher();
  1392. return dispatcher.useTransition(config);
  1393. }
  1394. function useDeferredValue(value, config) {
  1395. var dispatcher = resolveDispatcher();
  1396. return dispatcher.useDeferredValue(value, config);
  1397. }
  1398. function withSuspenseConfig(scope, config) {
  1399. var previousConfig = ReactCurrentBatchConfig.suspense;
  1400. ReactCurrentBatchConfig.suspense = config === undefined ? null : config;
  1401. try {
  1402. scope();
  1403. } finally {
  1404. ReactCurrentBatchConfig.suspense = previousConfig;
  1405. }
  1406. }
  1407. /**
  1408. * ReactElementValidator provides a wrapper around a element factory
  1409. * which validates the props passed to the element. This is intended to be
  1410. * used only in DEV and could be replaced by a static type checker for languages
  1411. * that support it.
  1412. */
  1413. var propTypesMisspellWarningShown;
  1414. {
  1415. propTypesMisspellWarningShown = false;
  1416. }
  1417. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  1418. function getDeclarationErrorAddendum() {
  1419. if (ReactCurrentOwner.current) {
  1420. var name = getComponentName(ReactCurrentOwner.current.type);
  1421. if (name) {
  1422. return '\n\nCheck the render method of `' + name + '`.';
  1423. }
  1424. }
  1425. return '';
  1426. }
  1427. function getSourceInfoErrorAddendum(source) {
  1428. if (source !== undefined) {
  1429. var fileName = source.fileName.replace(/^.*[\\\/]/, '');
  1430. var lineNumber = source.lineNumber;
  1431. return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
  1432. }
  1433. return '';
  1434. }
  1435. function getSourceInfoErrorAddendumForProps(elementProps) {
  1436. if (elementProps !== null && elementProps !== undefined) {
  1437. return getSourceInfoErrorAddendum(elementProps.__source);
  1438. }
  1439. return '';
  1440. }
  1441. /**
  1442. * Warn if there's no key explicitly set on dynamic arrays of children or
  1443. * object keys are not valid. This allows us to keep track of children between
  1444. * updates.
  1445. */
  1446. var ownerHasKeyUseWarning = {};
  1447. function getCurrentComponentErrorInfo(parentType) {
  1448. var info = getDeclarationErrorAddendum();
  1449. if (!info) {
  1450. var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
  1451. if (parentName) {
  1452. info = "\n\nCheck the top-level render call using <" + parentName + ">.";
  1453. }
  1454. }
  1455. return info;
  1456. }
  1457. /**
  1458. * Warn if the element doesn't have an explicit key assigned to it.
  1459. * This element is in an array. The array could grow and shrink or be
  1460. * reordered. All children that haven't already been validated are required to
  1461. * have a "key" property assigned to it. Error statuses are cached so a warning
  1462. * will only be shown once.
  1463. *
  1464. * @internal
  1465. * @param {ReactElement} element Element that requires a key.
  1466. * @param {*} parentType element's parent's type.
  1467. */
  1468. function validateExplicitKey(element, parentType) {
  1469. if (!element._store || element._store.validated || element.key != null) {
  1470. return;
  1471. }
  1472. element._store.validated = true;
  1473. var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
  1474. if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
  1475. return;
  1476. }
  1477. ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
  1478. // property, it may be the creator of the child that's responsible for
  1479. // assigning it a key.
  1480. var childOwner = '';
  1481. if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
  1482. // Give the component that originally created this child.
  1483. childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
  1484. }
  1485. setCurrentlyValidatingElement(element);
  1486. {
  1487. warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
  1488. }
  1489. setCurrentlyValidatingElement(null);
  1490. }
  1491. /**
  1492. * Ensure that every element either is passed in a static location, in an
  1493. * array with an explicit keys property defined, or in an object literal
  1494. * with valid key property.
  1495. *
  1496. * @internal
  1497. * @param {ReactNode} node Statically passed child of any type.
  1498. * @param {*} parentType node's parent's type.
  1499. */
  1500. function validateChildKeys(node, parentType) {
  1501. if (typeof node !== 'object') {
  1502. return;
  1503. }
  1504. if (Array.isArray(node)) {
  1505. for (var i = 0; i < node.length; i++) {
  1506. var child = node[i];
  1507. if (isValidElement(child)) {
  1508. validateExplicitKey(child, parentType);
  1509. }
  1510. }
  1511. } else if (isValidElement(node)) {
  1512. // This element was passed in a valid location.
  1513. if (node._store) {
  1514. node._store.validated = true;
  1515. }
  1516. } else if (node) {
  1517. var iteratorFn = getIteratorFn(node);
  1518. if (typeof iteratorFn === 'function') {
  1519. // Entry iterators used to provide implicit keys,
  1520. // but now we print a separate warning for them later.
  1521. if (iteratorFn !== node.entries) {
  1522. var iterator = iteratorFn.call(node);
  1523. var step;
  1524. while (!(step = iterator.next()).done) {
  1525. if (isValidElement(step.value)) {
  1526. validateExplicitKey(step.value, parentType);
  1527. }
  1528. }
  1529. }
  1530. }
  1531. }
  1532. }
  1533. /**
  1534. * Given an element, validate that its props follow the propTypes definition,
  1535. * provided by the type.
  1536. *
  1537. * @param {ReactElement} element
  1538. */
  1539. function validatePropTypes(element) {
  1540. var type = element.type;
  1541. if (type === null || type === undefined || typeof type === 'string') {
  1542. return;
  1543. }
  1544. var name = getComponentName(type);
  1545. var propTypes;
  1546. if (typeof type === 'function') {
  1547. propTypes = type.propTypes;
  1548. } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
  1549. // Inner props are checked in the reconciler.
  1550. type.$$typeof === REACT_MEMO_TYPE)) {
  1551. propTypes = type.propTypes;
  1552. } else {
  1553. return;
  1554. }
  1555. if (propTypes) {
  1556. setCurrentlyValidatingElement(element);
  1557. checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
  1558. setCurrentlyValidatingElement(null);
  1559. } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
  1560. propTypesMisspellWarningShown = true;
  1561. warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
  1562. }
  1563. if (typeof type.getDefaultProps === 'function') {
  1564. !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
  1565. }
  1566. }
  1567. /**
  1568. * Given a fragment, validate that it can only be provided with fragment props
  1569. * @param {ReactElement} fragment
  1570. */
  1571. function validateFragmentProps(fragment) {
  1572. setCurrentlyValidatingElement(fragment);
  1573. var keys = Object.keys(fragment.props);
  1574. for (var i = 0; i < keys.length; i++) {
  1575. var key = keys[i];
  1576. if (key !== 'children' && key !== 'key') {
  1577. warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
  1578. break;
  1579. }
  1580. }
  1581. if (fragment.ref !== null) {
  1582. warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
  1583. }
  1584. setCurrentlyValidatingElement(null);
  1585. }
  1586. function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
  1587. var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
  1588. // succeed and there will likely be errors in render.
  1589. if (!validType) {
  1590. var info = '';
  1591. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  1592. 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.";
  1593. }
  1594. var sourceInfo = getSourceInfoErrorAddendum(source);
  1595. if (sourceInfo) {
  1596. info += sourceInfo;
  1597. } else {
  1598. info += getDeclarationErrorAddendum();
  1599. }
  1600. var typeString;
  1601. if (type === null) {
  1602. typeString = 'null';
  1603. } else if (Array.isArray(type)) {
  1604. typeString = 'array';
  1605. } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
  1606. typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
  1607. info = ' Did you accidentally export a JSX literal instead of a component?';
  1608. } else {
  1609. typeString = typeof type;
  1610. }
  1611. warning$1(false, 'React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
  1612. }
  1613. var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
  1614. // TODO: Drop this when these are no longer allowed as the type argument.
  1615. if (element == null) {
  1616. return element;
  1617. } // Skip key warning if the type isn't valid since our key validation logic
  1618. // doesn't expect a non-string/function type and can throw confusing errors.
  1619. // We don't want exception behavior to differ between dev and prod.
  1620. // (Rendering will throw with a helpful message and as soon as the type is
  1621. // fixed, the key warnings will appear.)
  1622. if (validType) {
  1623. var children = props.children;
  1624. if (children !== undefined) {
  1625. if (isStaticChildren) {
  1626. if (Array.isArray(children)) {
  1627. for (var i = 0; i < children.length; i++) {
  1628. validateChildKeys(children[i], type);
  1629. }
  1630. if (Object.freeze) {
  1631. Object.freeze(children);
  1632. }
  1633. } else {
  1634. warning$1(false, 'React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
  1635. }
  1636. } else {
  1637. validateChildKeys(children, type);
  1638. }
  1639. }
  1640. }
  1641. if (hasOwnProperty$1.call(props, 'key')) {
  1642. warning$1(false, 'React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. <ComponentName {...props} key={key} />');
  1643. }
  1644. if (type === REACT_FRAGMENT_TYPE) {
  1645. validateFragmentProps(element);
  1646. } else {
  1647. validatePropTypes(element);
  1648. }
  1649. return element;
  1650. } // These two functions exist to still get child warnings in dev
  1651. // even with the prod transform. This means that jsxDEV is purely
  1652. // opt-in behavior for better messages but that we won't stop
  1653. // giving you warnings if you use production apis.
  1654. function jsxWithValidationStatic(type, props, key) {
  1655. return jsxWithValidation(type, props, key, true);
  1656. }
  1657. function jsxWithValidationDynamic(type, props, key) {
  1658. return jsxWithValidation(type, props, key, false);
  1659. }
  1660. function createElementWithValidation(type, props, children) {
  1661. var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
  1662. // succeed and there will likely be errors in render.
  1663. if (!validType) {
  1664. var info = '';
  1665. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  1666. 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.";
  1667. }
  1668. var sourceInfo = getSourceInfoErrorAddendumForProps(props);
  1669. if (sourceInfo) {
  1670. info += sourceInfo;
  1671. } else {
  1672. info += getDeclarationErrorAddendum();
  1673. }
  1674. var typeString;
  1675. if (type === null) {
  1676. typeString = 'null';
  1677. } else if (Array.isArray(type)) {
  1678. typeString = 'array';
  1679. } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
  1680. typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
  1681. info = ' Did you accidentally export a JSX literal instead of a component?';
  1682. } else {
  1683. typeString = typeof type;
  1684. }
  1685. warning$1(false, '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);
  1686. }
  1687. var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
  1688. // TODO: Drop this when these are no longer allowed as the type argument.
  1689. if (element == null) {
  1690. return element;
  1691. } // Skip key warning if the type isn't valid since our key validation logic
  1692. // doesn't expect a non-string/function type and can throw confusing errors.
  1693. // We don't want exception behavior to differ between dev and prod.
  1694. // (Rendering will throw with a helpful message and as soon as the type is
  1695. // fixed, the key warnings will appear.)
  1696. if (validType) {
  1697. for (var i = 2; i < arguments.length; i++) {
  1698. validateChildKeys(arguments[i], type);
  1699. }
  1700. }
  1701. if (type === REACT_FRAGMENT_TYPE) {
  1702. validateFragmentProps(element);
  1703. } else {
  1704. validatePropTypes(element);
  1705. }
  1706. return element;
  1707. }
  1708. function createFactoryWithValidation(type) {
  1709. var validatedFactory = createElementWithValidation.bind(null, type);
  1710. validatedFactory.type = type; // Legacy hook: remove it
  1711. {
  1712. Object.defineProperty(validatedFactory, 'type', {
  1713. enumerable: false,
  1714. get: function () {
  1715. lowPriorityWarningWithoutStack$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
  1716. Object.defineProperty(this, 'type', {
  1717. value: type
  1718. });
  1719. return type;
  1720. }
  1721. });
  1722. }
  1723. return validatedFactory;
  1724. }
  1725. function cloneElementWithValidation(element, props, children) {
  1726. var newElement = cloneElement.apply(this, arguments);
  1727. for (var i = 2; i < arguments.length; i++) {
  1728. validateChildKeys(arguments[i], newElement.type);
  1729. }
  1730. validatePropTypes(newElement);
  1731. return newElement;
  1732. }
  1733. var hasBadMapPolyfill;
  1734. {
  1735. hasBadMapPolyfill = false;
  1736. try {
  1737. var frozenObject = Object.freeze({});
  1738. var testMap = new Map([[frozenObject, null]]);
  1739. var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
  1740. // https://github.com/rollup/rollup/issues/1771
  1741. // TODO: we can remove these if Rollup fixes the bug.
  1742. testMap.set(0, 0);
  1743. testSet.add(0);
  1744. } catch (e) {
  1745. // TODO: Consider warning about bad polyfills
  1746. hasBadMapPolyfill = true;
  1747. }
  1748. }
  1749. function createFundamentalComponent(impl) {
  1750. // We use responder as a Map key later on. When we have a bad
  1751. // polyfill, then we can't use it as a key as the polyfill tries
  1752. // to add a property to the object.
  1753. if (true && !hasBadMapPolyfill) {
  1754. Object.freeze(impl);
  1755. }
  1756. var fundamantalComponent = {
  1757. $$typeof: REACT_FUNDAMENTAL_TYPE,
  1758. impl: impl
  1759. };
  1760. {
  1761. Object.freeze(fundamantalComponent);
  1762. }
  1763. return fundamantalComponent;
  1764. }
  1765. function createEventResponder(displayName, responderConfig) {
  1766. var getInitialState = responderConfig.getInitialState,
  1767. onEvent = responderConfig.onEvent,
  1768. onMount = responderConfig.onMount,
  1769. onUnmount = responderConfig.onUnmount,
  1770. onRootEvent = responderConfig.onRootEvent,
  1771. rootEventTypes = responderConfig.rootEventTypes,
  1772. targetEventTypes = responderConfig.targetEventTypes,
  1773. targetPortalPropagation = responderConfig.targetPortalPropagation;
  1774. var eventResponder = {
  1775. $$typeof: REACT_RESPONDER_TYPE,
  1776. displayName: displayName,
  1777. getInitialState: getInitialState || null,
  1778. onEvent: onEvent || null,
  1779. onMount: onMount || null,
  1780. onRootEvent: onRootEvent || null,
  1781. onUnmount: onUnmount || null,
  1782. rootEventTypes: rootEventTypes || null,
  1783. targetEventTypes: targetEventTypes || null,
  1784. targetPortalPropagation: targetPortalPropagation || false
  1785. }; // We use responder as a Map key later on. When we have a bad
  1786. // polyfill, then we can't use it as a key as the polyfill tries
  1787. // to add a property to the object.
  1788. if (true && !hasBadMapPolyfill) {
  1789. Object.freeze(eventResponder);
  1790. }
  1791. return eventResponder;
  1792. }
  1793. function createScope() {
  1794. var scopeComponent = {
  1795. $$typeof: REACT_SCOPE_TYPE
  1796. };
  1797. {
  1798. Object.freeze(scopeComponent);
  1799. }
  1800. return scopeComponent;
  1801. }
  1802. // Helps identify side effects in render-phase lifecycle hooks and setState
  1803. // reducers by double invoking them in Strict Mode.
  1804. // To preserve the "Pause on caught exceptions" behavior of the debugger, we
  1805. // replay the begin phase of a failed component inside invokeGuardedCallback.
  1806. // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
  1807. // Gather advanced timing metrics for Profiler subtrees.
  1808. // Trace which interactions trigger each commit.
  1809. // SSR experiments
  1810. // Only used in www builds.
  1811. // Only used in www builds.
  1812. // Disable javascript: URL strings in href for XSS protection.
  1813. // React Fire: prevent the value and checked attributes from syncing
  1814. // with their related DOM properties
  1815. // These APIs will no longer be "unstable" in the upcoming 16.7 release,
  1816. // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
  1817. var exposeConcurrentModeAPIs = false;
  1818. // Experimental React Flare event system and event components support.
  1819. var enableFlareAPI = false; // Experimental Host Component support.
  1820. var enableFundamentalAPI = false; // Experimental Scope support.
  1821. var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
  1822. var enableJSXTransformAPI = false; // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
  1823. // Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
  1824. // For tests, we flush suspense fallbacks in an act scope;
  1825. // *except* in some of our own tests, where we test incremental loading states.
  1826. // Add a callback property to suspense to notify which promises are currently
  1827. // in the update queue. This allows reporting and tracing of what is causing
  1828. // the user to see a loading state.
  1829. // Also allows hydration callbacks to fire when a dehydrated boundary gets
  1830. // hydrated or deleted.
  1831. // Part of the simplification of React.createElement so we can eventually move
  1832. // from React.createElement to React.jsx
  1833. // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
  1834. // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
  1835. var React = {
  1836. Children: {
  1837. map: mapChildren,
  1838. forEach: forEachChildren,
  1839. count: countChildren,
  1840. toArray: toArray,
  1841. only: onlyChild
  1842. },
  1843. createRef: createRef,
  1844. Component: Component,
  1845. PureComponent: PureComponent,
  1846. createContext: createContext,
  1847. forwardRef: forwardRef,
  1848. lazy: lazy,
  1849. memo: memo,
  1850. useCallback: useCallback,
  1851. useContext: useContext,
  1852. useEffect: useEffect,
  1853. useImperativeHandle: useImperativeHandle,
  1854. useDebugValue: useDebugValue,
  1855. useLayoutEffect: useLayoutEffect,
  1856. useMemo: useMemo,
  1857. useReducer: useReducer,
  1858. useRef: useRef,
  1859. useState: useState,
  1860. Fragment: REACT_FRAGMENT_TYPE,
  1861. Profiler: REACT_PROFILER_TYPE,
  1862. StrictMode: REACT_STRICT_MODE_TYPE,
  1863. Suspense: REACT_SUSPENSE_TYPE,
  1864. createElement: createElementWithValidation,
  1865. cloneElement: cloneElementWithValidation,
  1866. createFactory: createFactoryWithValidation,
  1867. isValidElement: isValidElement,
  1868. version: ReactVersion,
  1869. __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
  1870. };
  1871. if (exposeConcurrentModeAPIs) {
  1872. React.useTransition = useTransition;
  1873. React.useDeferredValue = useDeferredValue;
  1874. React.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
  1875. React.unstable_withSuspenseConfig = withSuspenseConfig;
  1876. }
  1877. if (enableFlareAPI) {
  1878. React.unstable_useResponder = useResponder;
  1879. React.unstable_createResponder = createEventResponder;
  1880. }
  1881. if (enableFundamentalAPI) {
  1882. React.unstable_createFundamental = createFundamentalComponent;
  1883. }
  1884. if (enableScopeAPI) {
  1885. React.unstable_createScope = createScope;
  1886. } // Note: some APIs are added with feature flags.
  1887. // Make sure that stable builds for open source
  1888. // don't modify the React object to avoid deopts.
  1889. // Also let's not expose their names in stable builds.
  1890. if (enableJSXTransformAPI) {
  1891. {
  1892. React.jsxDEV = jsxWithValidation;
  1893. React.jsx = jsxWithValidationDynamic;
  1894. React.jsxs = jsxWithValidationStatic;
  1895. }
  1896. }
  1897. var React$2 = Object.freeze({
  1898. default: React
  1899. });
  1900. var React$3 = ( React$2 && React ) || React$2;
  1901. // TODO: decide on the top-level export form.
  1902. // This is hacky but makes it work with both Rollup and Jest.
  1903. var react = React$3.default || React$3;
  1904. module.exports = react;
  1905. })();
  1906. }