05574022b26ff97d210d2dbe19ada2cedb14631c7cc400c3d4bdbfd24da515bd402047b2491480855fc0aa9be873f14ecb1b121e85d05320251d4b0f392383 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. /** @license React v16.14.0
  2. * react-jsx-runtime.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 React = require('react');
  14. // ATTENTION
  15. // When adding new symbols to this file,
  16. // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
  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 REACT_ELEMENT_TYPE = 0xeac7;
  20. var REACT_PORTAL_TYPE = 0xeaca;
  21. exports.Fragment = 0xeacb;
  22. var REACT_STRICT_MODE_TYPE = 0xeacc;
  23. var REACT_PROFILER_TYPE = 0xead2;
  24. var REACT_PROVIDER_TYPE = 0xeacd;
  25. var REACT_CONTEXT_TYPE = 0xeace;
  26. var REACT_FORWARD_REF_TYPE = 0xead0;
  27. var REACT_SUSPENSE_TYPE = 0xead1;
  28. var REACT_SUSPENSE_LIST_TYPE = 0xead8;
  29. var REACT_MEMO_TYPE = 0xead3;
  30. var REACT_LAZY_TYPE = 0xead4;
  31. var REACT_BLOCK_TYPE = 0xead9;
  32. var REACT_SERVER_BLOCK_TYPE = 0xeada;
  33. var REACT_FUNDAMENTAL_TYPE = 0xead5;
  34. var REACT_SCOPE_TYPE = 0xead7;
  35. var REACT_OPAQUE_ID_TYPE = 0xeae0;
  36. var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
  37. var REACT_OFFSCREEN_TYPE = 0xeae2;
  38. var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
  39. if (typeof Symbol === 'function' && Symbol.for) {
  40. var symbolFor = Symbol.for;
  41. REACT_ELEMENT_TYPE = symbolFor('react.element');
  42. REACT_PORTAL_TYPE = symbolFor('react.portal');
  43. exports.Fragment = symbolFor('react.fragment');
  44. REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
  45. REACT_PROFILER_TYPE = symbolFor('react.profiler');
  46. REACT_PROVIDER_TYPE = symbolFor('react.provider');
  47. REACT_CONTEXT_TYPE = symbolFor('react.context');
  48. REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
  49. REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
  50. REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
  51. REACT_MEMO_TYPE = symbolFor('react.memo');
  52. REACT_LAZY_TYPE = symbolFor('react.lazy');
  53. REACT_BLOCK_TYPE = symbolFor('react.block');
  54. REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
  55. REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
  56. REACT_SCOPE_TYPE = symbolFor('react.scope');
  57. REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
  58. REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
  59. REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
  60. REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
  61. }
  62. var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  63. var FAUX_ITERATOR_SYMBOL = '@@iterator';
  64. function getIteratorFn(maybeIterable) {
  65. if (maybeIterable === null || typeof maybeIterable !== 'object') {
  66. return null;
  67. }
  68. var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
  69. if (typeof maybeIterator === 'function') {
  70. return maybeIterator;
  71. }
  72. return null;
  73. }
  74. var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
  75. function error(format) {
  76. {
  77. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  78. args[_key2 - 1] = arguments[_key2];
  79. }
  80. printWarning('error', format, args);
  81. }
  82. }
  83. function printWarning(level, format, args) {
  84. // When changing this logic, you might want to also
  85. // update consoleWithStackDev.www.js as well.
  86. {
  87. var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  88. var stack = '';
  89. if (currentlyValidatingElement) {
  90. var name = getComponentName(currentlyValidatingElement.type);
  91. var owner = currentlyValidatingElement._owner;
  92. stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
  93. }
  94. stack += ReactDebugCurrentFrame.getStackAddendum();
  95. if (stack !== '') {
  96. format += '%s';
  97. args = args.concat([stack]);
  98. }
  99. var argsWithFormat = args.map(function (item) {
  100. return '' + item;
  101. }); // Careful: RN currently depends on this prefix
  102. argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
  103. // breaks IE9: https://github.com/facebook/react/issues/13610
  104. // eslint-disable-next-line react-internal/no-production-logging
  105. Function.prototype.apply.call(console[level], console, argsWithFormat);
  106. }
  107. }
  108. // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
  109. var enableScopeAPI = false; // Experimental Create Event Handle API.
  110. function isValidElementType(type) {
  111. if (typeof type === 'string' || typeof type === 'function') {
  112. return true;
  113. } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
  114. if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
  115. return true;
  116. }
  117. if (typeof type === 'object' && type !== null) {
  118. if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
  119. return true;
  120. }
  121. }
  122. return false;
  123. }
  124. var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
  125. function describeComponentFrame (name, source, ownerName) {
  126. var sourceInfo = '';
  127. if (source) {
  128. var path = source.fileName;
  129. var fileName = path.replace(BEFORE_SLASH_RE, '');
  130. {
  131. // In DEV, include code for a common special case:
  132. // prefer "folder/index.js" instead of just "index.js".
  133. if (/^index\./.test(fileName)) {
  134. var match = path.match(BEFORE_SLASH_RE);
  135. if (match) {
  136. var pathBeforeSlash = match[1];
  137. if (pathBeforeSlash) {
  138. var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
  139. fileName = folderName + '/' + fileName;
  140. }
  141. }
  142. }
  143. }
  144. sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
  145. } else if (ownerName) {
  146. sourceInfo = ' (created by ' + ownerName + ')';
  147. }
  148. return '\n in ' + (name || 'Unknown') + sourceInfo;
  149. }
  150. var Resolved = 1;
  151. function refineResolvedLazyComponent(lazyComponent) {
  152. return lazyComponent._status === Resolved ? lazyComponent._result : null;
  153. }
  154. function getWrappedName(outerType, innerType, wrapperName) {
  155. var functionName = innerType.displayName || innerType.name || '';
  156. return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
  157. }
  158. function getComponentName(type) {
  159. if (type == null) {
  160. // Host root, text node or just invalid type.
  161. return null;
  162. }
  163. {
  164. if (typeof type.tag === 'number') {
  165. error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
  166. }
  167. }
  168. if (typeof type === 'function') {
  169. return type.displayName || type.name || null;
  170. }
  171. if (typeof type === 'string') {
  172. return type;
  173. }
  174. switch (type) {
  175. case exports.Fragment:
  176. return 'Fragment';
  177. case REACT_PORTAL_TYPE:
  178. return 'Portal';
  179. case REACT_PROFILER_TYPE:
  180. return "Profiler";
  181. case REACT_STRICT_MODE_TYPE:
  182. return 'StrictMode';
  183. case REACT_SUSPENSE_TYPE:
  184. return 'Suspense';
  185. case REACT_SUSPENSE_LIST_TYPE:
  186. return 'SuspenseList';
  187. }
  188. if (typeof type === 'object') {
  189. switch (type.$$typeof) {
  190. case REACT_CONTEXT_TYPE:
  191. return 'Context.Consumer';
  192. case REACT_PROVIDER_TYPE:
  193. return 'Context.Provider';
  194. case REACT_FORWARD_REF_TYPE:
  195. return getWrappedName(type, type.render, 'ForwardRef');
  196. case REACT_MEMO_TYPE:
  197. return getComponentName(type.type);
  198. case REACT_BLOCK_TYPE:
  199. return getComponentName(type.render);
  200. case REACT_LAZY_TYPE:
  201. {
  202. var thenable = type;
  203. var resolvedThenable = refineResolvedLazyComponent(thenable);
  204. if (resolvedThenable) {
  205. return getComponentName(resolvedThenable);
  206. }
  207. break;
  208. }
  209. }
  210. }
  211. return null;
  212. }
  213. var loggedTypeFailures = {};
  214. var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  215. var currentlyValidatingElement = null;
  216. function setCurrentlyValidatingElement(element) {
  217. {
  218. currentlyValidatingElement = element;
  219. }
  220. }
  221. function checkPropTypes(typeSpecs, values, location, componentName, element) {
  222. {
  223. // $FlowFixMe This is okay but Flow doesn't know it.
  224. var has = Function.call.bind(Object.prototype.hasOwnProperty);
  225. for (var typeSpecName in typeSpecs) {
  226. if (has(typeSpecs, typeSpecName)) {
  227. var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
  228. // fail the render phase where it didn't fail before. So we log it.
  229. // After these have been cleaned up, we'll let them throw.
  230. try {
  231. // This is intentionally an invariant that gets caught. It's the same
  232. // behavior as without this statement except with a better message.
  233. if (typeof typeSpecs[typeSpecName] !== 'function') {
  234. 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`.');
  235. err.name = 'Invariant Violation';
  236. throw err;
  237. }
  238. error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
  239. } catch (ex) {
  240. error$1 = ex;
  241. }
  242. if (error$1 && !(error$1 instanceof Error)) {
  243. setCurrentlyValidatingElement(element);
  244. 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);
  245. setCurrentlyValidatingElement(null);
  246. }
  247. if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
  248. // Only monitor this failure once because there tends to be a lot of the
  249. // same error.
  250. loggedTypeFailures[error$1.message] = true;
  251. setCurrentlyValidatingElement(element);
  252. error('Failed %s type: %s', location, error$1.message);
  253. setCurrentlyValidatingElement(null);
  254. }
  255. }
  256. }
  257. }
  258. }
  259. var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
  260. var hasOwnProperty = Object.prototype.hasOwnProperty;
  261. var RESERVED_PROPS = {
  262. key: true,
  263. ref: true,
  264. __self: true,
  265. __source: true
  266. };
  267. var specialPropKeyWarningShown;
  268. var specialPropRefWarningShown;
  269. var didWarnAboutStringRefs;
  270. {
  271. didWarnAboutStringRefs = {};
  272. }
  273. function hasValidRef(config) {
  274. {
  275. if (hasOwnProperty.call(config, 'ref')) {
  276. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  277. if (getter && getter.isReactWarning) {
  278. return false;
  279. }
  280. }
  281. }
  282. return config.ref !== undefined;
  283. }
  284. function hasValidKey(config) {
  285. {
  286. if (hasOwnProperty.call(config, 'key')) {
  287. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  288. if (getter && getter.isReactWarning) {
  289. return false;
  290. }
  291. }
  292. }
  293. return config.key !== undefined;
  294. }
  295. function warnIfStringRefCannotBeAutoConverted(config, self) {
  296. {
  297. if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
  298. var componentName = getComponentName(ReactCurrentOwner.current.type);
  299. if (!didWarnAboutStringRefs[componentName]) {
  300. 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', getComponentName(ReactCurrentOwner.current.type), config.ref);
  301. didWarnAboutStringRefs[componentName] = true;
  302. }
  303. }
  304. }
  305. }
  306. function defineKeyPropWarningGetter(props, displayName) {
  307. {
  308. var warnAboutAccessingKey = function () {
  309. if (!specialPropKeyWarningShown) {
  310. specialPropKeyWarningShown = true;
  311. 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);
  312. }
  313. };
  314. warnAboutAccessingKey.isReactWarning = true;
  315. Object.defineProperty(props, 'key', {
  316. get: warnAboutAccessingKey,
  317. configurable: true
  318. });
  319. }
  320. }
  321. function defineRefPropWarningGetter(props, displayName) {
  322. {
  323. var warnAboutAccessingRef = function () {
  324. if (!specialPropRefWarningShown) {
  325. specialPropRefWarningShown = true;
  326. 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);
  327. }
  328. };
  329. warnAboutAccessingRef.isReactWarning = true;
  330. Object.defineProperty(props, 'ref', {
  331. get: warnAboutAccessingRef,
  332. configurable: true
  333. });
  334. }
  335. }
  336. /**
  337. * Factory method to create a new React element. This no longer adheres to
  338. * the class pattern, so do not use new to call it. Also, instanceof check
  339. * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
  340. * if something is a React Element.
  341. *
  342. * @param {*} type
  343. * @param {*} props
  344. * @param {*} key
  345. * @param {string|object} ref
  346. * @param {*} owner
  347. * @param {*} self A *temporary* helper to detect places where `this` is
  348. * different from the `owner` when React.createElement is called, so that we
  349. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  350. * functions, and as long as `this` and owner are the same, there will be no
  351. * change in behavior.
  352. * @param {*} source An annotation object (added by a transpiler or otherwise)
  353. * indicating filename, line number, and/or other information.
  354. * @internal
  355. */
  356. var ReactElement = function (type, key, ref, self, source, owner, props) {
  357. var element = {
  358. // This tag allows us to uniquely identify this as a React Element
  359. $$typeof: REACT_ELEMENT_TYPE,
  360. // Built-in properties that belong on the element
  361. type: type,
  362. key: key,
  363. ref: ref,
  364. props: props,
  365. // Record the component responsible for creating this element.
  366. _owner: owner
  367. };
  368. {
  369. // The validation flag is currently mutative. We put it on
  370. // an external backing store so that we can freeze the whole object.
  371. // This can be replaced with a WeakMap once they are implemented in
  372. // commonly used development environments.
  373. element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
  374. // the validation flag non-enumerable (where possible, which should
  375. // include every environment we run tests in), so the test framework
  376. // ignores it.
  377. Object.defineProperty(element._store, 'validated', {
  378. configurable: false,
  379. enumerable: false,
  380. writable: true,
  381. value: false
  382. }); // self and source are DEV only properties.
  383. Object.defineProperty(element, '_self', {
  384. configurable: false,
  385. enumerable: false,
  386. writable: false,
  387. value: self
  388. }); // Two elements created in two different places should be considered
  389. // equal for testing purposes and therefore we hide it from enumeration.
  390. Object.defineProperty(element, '_source', {
  391. configurable: false,
  392. enumerable: false,
  393. writable: false,
  394. value: source
  395. });
  396. if (Object.freeze) {
  397. Object.freeze(element.props);
  398. Object.freeze(element);
  399. }
  400. }
  401. return element;
  402. };
  403. /**
  404. * https://github.com/reactjs/rfcs/pull/107
  405. * @param {*} type
  406. * @param {object} props
  407. * @param {string} key
  408. */
  409. function jsxDEV(type, config, maybeKey, source, self) {
  410. {
  411. var propName; // Reserved names are extracted
  412. var props = {};
  413. var key = null;
  414. var ref = null; // Currently, key can be spread in as a prop. This causes a potential
  415. // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
  416. // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
  417. // but as an intermediary step, we will use jsxDEV for everything except
  418. // <div {...props} key="Hi" />, because we aren't currently able to tell if
  419. // key is explicitly declared to be undefined or not.
  420. if (maybeKey !== undefined) {
  421. key = '' + maybeKey;
  422. }
  423. if (hasValidKey(config)) {
  424. key = '' + config.key;
  425. }
  426. if (hasValidRef(config)) {
  427. ref = config.ref;
  428. warnIfStringRefCannotBeAutoConverted(config, self);
  429. } // Remaining properties are added to a new props object
  430. for (propName in config) {
  431. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  432. props[propName] = config[propName];
  433. }
  434. } // Resolve default props
  435. if (type && type.defaultProps) {
  436. var defaultProps = type.defaultProps;
  437. for (propName in defaultProps) {
  438. if (props[propName] === undefined) {
  439. props[propName] = defaultProps[propName];
  440. }
  441. }
  442. }
  443. if (key || ref) {
  444. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  445. if (key) {
  446. defineKeyPropWarningGetter(props, displayName);
  447. }
  448. if (ref) {
  449. defineRefPropWarningGetter(props, displayName);
  450. }
  451. }
  452. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  453. }
  454. }
  455. var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
  456. var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
  457. function setCurrentlyValidatingElement$1(element) {
  458. currentlyValidatingElement = element;
  459. }
  460. var propTypesMisspellWarningShown;
  461. {
  462. propTypesMisspellWarningShown = false;
  463. }
  464. /**
  465. * Verifies the object is a ReactElement.
  466. * See https://reactjs.org/docs/react-api.html#isvalidelement
  467. * @param {?object} object
  468. * @return {boolean} True if `object` is a ReactElement.
  469. * @final
  470. */
  471. function isValidElement(object) {
  472. {
  473. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  474. }
  475. }
  476. function getDeclarationErrorAddendum() {
  477. {
  478. if (ReactCurrentOwner$1.current) {
  479. var name = getComponentName(ReactCurrentOwner$1.current.type);
  480. if (name) {
  481. return '\n\nCheck the render method of `' + name + '`.';
  482. }
  483. }
  484. return '';
  485. }
  486. }
  487. function getSourceInfoErrorAddendum(source) {
  488. {
  489. if (source !== undefined) {
  490. var fileName = source.fileName.replace(/^.*[\\\/]/, '');
  491. var lineNumber = source.lineNumber;
  492. return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
  493. }
  494. return '';
  495. }
  496. }
  497. /**
  498. * Warn if there's no key explicitly set on dynamic arrays of children or
  499. * object keys are not valid. This allows us to keep track of children between
  500. * updates.
  501. */
  502. var ownerHasKeyUseWarning = {};
  503. function getCurrentComponentErrorInfo(parentType) {
  504. {
  505. var info = getDeclarationErrorAddendum();
  506. if (!info) {
  507. var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
  508. if (parentName) {
  509. info = "\n\nCheck the top-level render call using <" + parentName + ">.";
  510. }
  511. }
  512. return info;
  513. }
  514. }
  515. /**
  516. * Warn if the element doesn't have an explicit key assigned to it.
  517. * This element is in an array. The array could grow and shrink or be
  518. * reordered. All children that haven't already been validated are required to
  519. * have a "key" property assigned to it. Error statuses are cached so a warning
  520. * will only be shown once.
  521. *
  522. * @internal
  523. * @param {ReactElement} element Element that requires a key.
  524. * @param {*} parentType element's parent's type.
  525. */
  526. function validateExplicitKey(element, parentType) {
  527. {
  528. if (!element._store || element._store.validated || element.key != null) {
  529. return;
  530. }
  531. element._store.validated = true;
  532. var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
  533. if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
  534. return;
  535. }
  536. ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
  537. // property, it may be the creator of the child that's responsible for
  538. // assigning it a key.
  539. var childOwner = '';
  540. if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
  541. // Give the component that originally created this child.
  542. childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
  543. }
  544. setCurrentlyValidatingElement$1(element);
  545. 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);
  546. setCurrentlyValidatingElement$1(null);
  547. }
  548. }
  549. /**
  550. * Ensure that every element either is passed in a static location, in an
  551. * array with an explicit keys property defined, or in an object literal
  552. * with valid key property.
  553. *
  554. * @internal
  555. * @param {ReactNode} node Statically passed child of any type.
  556. * @param {*} parentType node's parent's type.
  557. */
  558. function validateChildKeys(node, parentType) {
  559. {
  560. if (typeof node !== 'object') {
  561. return;
  562. }
  563. if (Array.isArray(node)) {
  564. for (var i = 0; i < node.length; i++) {
  565. var child = node[i];
  566. if (isValidElement(child)) {
  567. validateExplicitKey(child, parentType);
  568. }
  569. }
  570. } else if (isValidElement(node)) {
  571. // This element was passed in a valid location.
  572. if (node._store) {
  573. node._store.validated = true;
  574. }
  575. } else if (node) {
  576. var iteratorFn = getIteratorFn(node);
  577. if (typeof iteratorFn === 'function') {
  578. // Entry iterators used to provide implicit keys,
  579. // but now we print a separate warning for them later.
  580. if (iteratorFn !== node.entries) {
  581. var iterator = iteratorFn.call(node);
  582. var step;
  583. while (!(step = iterator.next()).done) {
  584. if (isValidElement(step.value)) {
  585. validateExplicitKey(step.value, parentType);
  586. }
  587. }
  588. }
  589. }
  590. }
  591. }
  592. }
  593. /**
  594. * Given an element, validate that its props follow the propTypes definition,
  595. * provided by the type.
  596. *
  597. * @param {ReactElement} element
  598. */
  599. function validatePropTypes(element) {
  600. {
  601. var type = element.type;
  602. if (type === null || type === undefined || typeof type === 'string') {
  603. return;
  604. }
  605. var propTypes;
  606. if (typeof type === 'function') {
  607. propTypes = type.propTypes;
  608. } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
  609. // Inner props are checked in the reconciler.
  610. type.$$typeof === REACT_MEMO_TYPE)) {
  611. propTypes = type.propTypes;
  612. } else {
  613. return;
  614. }
  615. if (propTypes) {
  616. // Intentionally inside to avoid triggering lazy initializers:
  617. var name = getComponentName(type);
  618. checkPropTypes(propTypes, element.props, 'prop', name, element);
  619. } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
  620. propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
  621. var _name = getComponentName(type);
  622. error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
  623. }
  624. if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
  625. error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
  626. }
  627. }
  628. }
  629. /**
  630. * Given a fragment, validate that it can only be provided with fragment props
  631. * @param {ReactElement} fragment
  632. */
  633. function validateFragmentProps(fragment) {
  634. {
  635. var keys = Object.keys(fragment.props);
  636. for (var i = 0; i < keys.length; i++) {
  637. var key = keys[i];
  638. if (key !== 'children' && key !== 'key') {
  639. setCurrentlyValidatingElement$1(fragment);
  640. error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
  641. setCurrentlyValidatingElement$1(null);
  642. break;
  643. }
  644. }
  645. if (fragment.ref !== null) {
  646. setCurrentlyValidatingElement$1(fragment);
  647. error('Invalid attribute `ref` supplied to `React.Fragment`.');
  648. setCurrentlyValidatingElement$1(null);
  649. }
  650. }
  651. }
  652. function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
  653. {
  654. var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
  655. // succeed and there will likely be errors in render.
  656. if (!validType) {
  657. var info = '';
  658. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  659. 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.";
  660. }
  661. var sourceInfo = getSourceInfoErrorAddendum(source);
  662. if (sourceInfo) {
  663. info += sourceInfo;
  664. } else {
  665. info += getDeclarationErrorAddendum();
  666. }
  667. var typeString;
  668. if (type === null) {
  669. typeString = 'null';
  670. } else if (Array.isArray(type)) {
  671. typeString = 'array';
  672. } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
  673. typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
  674. info = ' Did you accidentally export a JSX literal instead of a component?';
  675. } else {
  676. typeString = typeof type;
  677. }
  678. error('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);
  679. }
  680. var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
  681. // TODO: Drop this when these are no longer allowed as the type argument.
  682. if (element == null) {
  683. return element;
  684. } // Skip key warning if the type isn't valid since our key validation logic
  685. // doesn't expect a non-string/function type and can throw confusing errors.
  686. // We don't want exception behavior to differ between dev and prod.
  687. // (Rendering will throw with a helpful message and as soon as the type is
  688. // fixed, the key warnings will appear.)
  689. if (validType) {
  690. var children = props.children;
  691. if (children !== undefined) {
  692. if (isStaticChildren) {
  693. if (Array.isArray(children)) {
  694. for (var i = 0; i < children.length; i++) {
  695. validateChildKeys(children[i], type);
  696. }
  697. if (Object.freeze) {
  698. Object.freeze(children);
  699. }
  700. } else {
  701. error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
  702. }
  703. } else {
  704. validateChildKeys(children, type);
  705. }
  706. }
  707. }
  708. if (type === exports.Fragment) {
  709. validateFragmentProps(element);
  710. } else {
  711. validatePropTypes(element);
  712. }
  713. return element;
  714. }
  715. } // These two functions exist to still get child warnings in dev
  716. // even with the prod transform. This means that jsxDEV is purely
  717. // opt-in behavior for better messages but that we won't stop
  718. // giving you warnings if you use production apis.
  719. function jsxWithValidationStatic(type, props, key) {
  720. {
  721. return jsxWithValidation(type, props, key, true);
  722. }
  723. }
  724. function jsxWithValidationDynamic(type, props, key) {
  725. {
  726. return jsxWithValidation(type, props, key, false);
  727. }
  728. }
  729. var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
  730. // for now we can ship identical prod functions
  731. var jsxs = jsxWithValidationStatic ;
  732. exports.jsx = jsx;
  733. exports.jsxs = jsxs;
  734. })();
  735. }