react.production.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. /**
  2. * @license React
  3. * react.production.js
  4. *
  5. * Copyright (c) Meta Platforms, Inc. and affiliates.
  6. *
  7. * This source code is licensed under the MIT license found in the
  8. * LICENSE file in the root directory of this source tree.
  9. */
  10. "use strict";
  11. var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
  12. REACT_PORTAL_TYPE = Symbol.for("react.portal"),
  13. REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
  14. REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
  15. REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
  16. REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
  17. REACT_CONTEXT_TYPE = Symbol.for("react.context"),
  18. REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
  19. REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
  20. REACT_MEMO_TYPE = Symbol.for("react.memo"),
  21. REACT_LAZY_TYPE = Symbol.for("react.lazy"),
  22. REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
  23. MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
  24. function getIteratorFn(maybeIterable) {
  25. if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
  26. maybeIterable =
  27. (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
  28. maybeIterable["@@iterator"];
  29. return "function" === typeof maybeIterable ? maybeIterable : null;
  30. }
  31. var ReactNoopUpdateQueue = {
  32. isMounted: function () {
  33. return !1;
  34. },
  35. enqueueForceUpdate: function () {},
  36. enqueueReplaceState: function () {},
  37. enqueueSetState: function () {}
  38. },
  39. assign = Object.assign,
  40. emptyObject = {};
  41. function Component(props, context, updater) {
  42. this.props = props;
  43. this.context = context;
  44. this.refs = emptyObject;
  45. this.updater = updater || ReactNoopUpdateQueue;
  46. }
  47. Component.prototype.isReactComponent = {};
  48. Component.prototype.setState = function (partialState, callback) {
  49. if (
  50. "object" !== typeof partialState &&
  51. "function" !== typeof partialState &&
  52. null != partialState
  53. )
  54. throw Error(
  55. "takes an object of state variables to update or a function which returns an object of state variables."
  56. );
  57. this.updater.enqueueSetState(this, partialState, callback, "setState");
  58. };
  59. Component.prototype.forceUpdate = function (callback) {
  60. this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
  61. };
  62. function ComponentDummy() {}
  63. ComponentDummy.prototype = Component.prototype;
  64. function PureComponent(props, context, updater) {
  65. this.props = props;
  66. this.context = context;
  67. this.refs = emptyObject;
  68. this.updater = updater || ReactNoopUpdateQueue;
  69. }
  70. var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
  71. pureComponentPrototype.constructor = PureComponent;
  72. assign(pureComponentPrototype, Component.prototype);
  73. pureComponentPrototype.isPureReactComponent = !0;
  74. var isArrayImpl = Array.isArray;
  75. function noop() {}
  76. var ReactSharedInternals = { H: null, A: null, T: null, S: null },
  77. hasOwnProperty = Object.prototype.hasOwnProperty;
  78. function ReactElement(type, key, props) {
  79. var refProp = props.ref;
  80. return {
  81. $$typeof: REACT_ELEMENT_TYPE,
  82. type: type,
  83. key: key,
  84. ref: void 0 !== refProp ? refProp : null,
  85. props: props
  86. };
  87. }
  88. function cloneAndReplaceKey(oldElement, newKey) {
  89. return ReactElement(oldElement.type, newKey, oldElement.props);
  90. }
  91. function isValidElement(object) {
  92. return (
  93. "object" === typeof object &&
  94. null !== object &&
  95. object.$$typeof === REACT_ELEMENT_TYPE
  96. );
  97. }
  98. function escape(key) {
  99. var escaperLookup = { "=": "=0", ":": "=2" };
  100. return (
  101. "$" +
  102. key.replace(/[=:]/g, function (match) {
  103. return escaperLookup[match];
  104. })
  105. );
  106. }
  107. var userProvidedKeyEscapeRegex = /\/+/g;
  108. function getElementKey(element, index) {
  109. return "object" === typeof element && null !== element && null != element.key
  110. ? escape("" + element.key)
  111. : index.toString(36);
  112. }
  113. function resolveThenable(thenable) {
  114. switch (thenable.status) {
  115. case "fulfilled":
  116. return thenable.value;
  117. case "rejected":
  118. throw thenable.reason;
  119. default:
  120. switch (
  121. ("string" === typeof thenable.status
  122. ? thenable.then(noop, noop)
  123. : ((thenable.status = "pending"),
  124. thenable.then(
  125. function (fulfilledValue) {
  126. "pending" === thenable.status &&
  127. ((thenable.status = "fulfilled"),
  128. (thenable.value = fulfilledValue));
  129. },
  130. function (error) {
  131. "pending" === thenable.status &&
  132. ((thenable.status = "rejected"), (thenable.reason = error));
  133. }
  134. )),
  135. thenable.status)
  136. ) {
  137. case "fulfilled":
  138. return thenable.value;
  139. case "rejected":
  140. throw thenable.reason;
  141. }
  142. }
  143. throw thenable;
  144. }
  145. function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
  146. var type = typeof children;
  147. if ("undefined" === type || "boolean" === type) children = null;
  148. var invokeCallback = !1;
  149. if (null === children) invokeCallback = !0;
  150. else
  151. switch (type) {
  152. case "bigint":
  153. case "string":
  154. case "number":
  155. invokeCallback = !0;
  156. break;
  157. case "object":
  158. switch (children.$$typeof) {
  159. case REACT_ELEMENT_TYPE:
  160. case REACT_PORTAL_TYPE:
  161. invokeCallback = !0;
  162. break;
  163. case REACT_LAZY_TYPE:
  164. return (
  165. (invokeCallback = children._init),
  166. mapIntoArray(
  167. invokeCallback(children._payload),
  168. array,
  169. escapedPrefix,
  170. nameSoFar,
  171. callback
  172. )
  173. );
  174. }
  175. }
  176. if (invokeCallback)
  177. return (
  178. (callback = callback(children)),
  179. (invokeCallback =
  180. "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
  181. isArrayImpl(callback)
  182. ? ((escapedPrefix = ""),
  183. null != invokeCallback &&
  184. (escapedPrefix =
  185. invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
  186. mapIntoArray(callback, array, escapedPrefix, "", function (c) {
  187. return c;
  188. }))
  189. : null != callback &&
  190. (isValidElement(callback) &&
  191. (callback = cloneAndReplaceKey(
  192. callback,
  193. escapedPrefix +
  194. (null == callback.key ||
  195. (children && children.key === callback.key)
  196. ? ""
  197. : ("" + callback.key).replace(
  198. userProvidedKeyEscapeRegex,
  199. "$&/"
  200. ) + "/") +
  201. invokeCallback
  202. )),
  203. array.push(callback)),
  204. 1
  205. );
  206. invokeCallback = 0;
  207. var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
  208. if (isArrayImpl(children))
  209. for (var i = 0; i < children.length; i++)
  210. (nameSoFar = children[i]),
  211. (type = nextNamePrefix + getElementKey(nameSoFar, i)),
  212. (invokeCallback += mapIntoArray(
  213. nameSoFar,
  214. array,
  215. escapedPrefix,
  216. type,
  217. callback
  218. ));
  219. else if (((i = getIteratorFn(children)), "function" === typeof i))
  220. for (
  221. children = i.call(children), i = 0;
  222. !(nameSoFar = children.next()).done;
  223. )
  224. (nameSoFar = nameSoFar.value),
  225. (type = nextNamePrefix + getElementKey(nameSoFar, i++)),
  226. (invokeCallback += mapIntoArray(
  227. nameSoFar,
  228. array,
  229. escapedPrefix,
  230. type,
  231. callback
  232. ));
  233. else if ("object" === type) {
  234. if ("function" === typeof children.then)
  235. return mapIntoArray(
  236. resolveThenable(children),
  237. array,
  238. escapedPrefix,
  239. nameSoFar,
  240. callback
  241. );
  242. array = String(children);
  243. throw Error(
  244. "Objects are not valid as a React child (found: " +
  245. ("[object Object]" === array
  246. ? "object with keys {" + Object.keys(children).join(", ") + "}"
  247. : array) +
  248. "). If you meant to render a collection of children, use an array instead."
  249. );
  250. }
  251. return invokeCallback;
  252. }
  253. function mapChildren(children, func, context) {
  254. if (null == children) return children;
  255. var result = [],
  256. count = 0;
  257. mapIntoArray(children, result, "", "", function (child) {
  258. return func.call(context, child, count++);
  259. });
  260. return result;
  261. }
  262. function lazyInitializer(payload) {
  263. if (-1 === payload._status) {
  264. var ctor = payload._result;
  265. ctor = ctor();
  266. ctor.then(
  267. function (moduleObject) {
  268. if (0 === payload._status || -1 === payload._status)
  269. (payload._status = 1), (payload._result = moduleObject);
  270. },
  271. function (error) {
  272. if (0 === payload._status || -1 === payload._status)
  273. (payload._status = 2), (payload._result = error);
  274. }
  275. );
  276. -1 === payload._status && ((payload._status = 0), (payload._result = ctor));
  277. }
  278. if (1 === payload._status) return payload._result.default;
  279. throw payload._result;
  280. }
  281. var reportGlobalError =
  282. "function" === typeof reportError
  283. ? reportError
  284. : function (error) {
  285. if (
  286. "object" === typeof window &&
  287. "function" === typeof window.ErrorEvent
  288. ) {
  289. var event = new window.ErrorEvent("error", {
  290. bubbles: !0,
  291. cancelable: !0,
  292. message:
  293. "object" === typeof error &&
  294. null !== error &&
  295. "string" === typeof error.message
  296. ? String(error.message)
  297. : String(error),
  298. error: error
  299. });
  300. if (!window.dispatchEvent(event)) return;
  301. } else if (
  302. "object" === typeof process &&
  303. "function" === typeof process.emit
  304. ) {
  305. process.emit("uncaughtException", error);
  306. return;
  307. }
  308. console.error(error);
  309. },
  310. Children = {
  311. map: mapChildren,
  312. forEach: function (children, forEachFunc, forEachContext) {
  313. mapChildren(
  314. children,
  315. function () {
  316. forEachFunc.apply(this, arguments);
  317. },
  318. forEachContext
  319. );
  320. },
  321. count: function (children) {
  322. var n = 0;
  323. mapChildren(children, function () {
  324. n++;
  325. });
  326. return n;
  327. },
  328. toArray: function (children) {
  329. return (
  330. mapChildren(children, function (child) {
  331. return child;
  332. }) || []
  333. );
  334. },
  335. only: function (children) {
  336. if (!isValidElement(children))
  337. throw Error(
  338. "React.Children.only expected to receive a single React element child."
  339. );
  340. return children;
  341. }
  342. };
  343. exports.Activity = REACT_ACTIVITY_TYPE;
  344. exports.Children = Children;
  345. exports.Component = Component;
  346. exports.Fragment = REACT_FRAGMENT_TYPE;
  347. exports.Profiler = REACT_PROFILER_TYPE;
  348. exports.PureComponent = PureComponent;
  349. exports.StrictMode = REACT_STRICT_MODE_TYPE;
  350. exports.Suspense = REACT_SUSPENSE_TYPE;
  351. exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
  352. ReactSharedInternals;
  353. exports.__COMPILER_RUNTIME = {
  354. __proto__: null,
  355. c: function (size) {
  356. return ReactSharedInternals.H.useMemoCache(size);
  357. }
  358. };
  359. exports.cache = function (fn) {
  360. return function () {
  361. return fn.apply(null, arguments);
  362. };
  363. };
  364. exports.cacheSignal = function () {
  365. return null;
  366. };
  367. exports.cloneElement = function (element, config, children) {
  368. if (null === element || void 0 === element)
  369. throw Error(
  370. "The argument must be a React element, but you passed " + element + "."
  371. );
  372. var props = assign({}, element.props),
  373. key = element.key;
  374. if (null != config)
  375. for (propName in (void 0 !== config.key && (key = "" + config.key), config))
  376. !hasOwnProperty.call(config, propName) ||
  377. "key" === propName ||
  378. "__self" === propName ||
  379. "__source" === propName ||
  380. ("ref" === propName && void 0 === config.ref) ||
  381. (props[propName] = config[propName]);
  382. var propName = arguments.length - 2;
  383. if (1 === propName) props.children = children;
  384. else if (1 < propName) {
  385. for (var childArray = Array(propName), i = 0; i < propName; i++)
  386. childArray[i] = arguments[i + 2];
  387. props.children = childArray;
  388. }
  389. return ReactElement(element.type, key, props);
  390. };
  391. exports.createContext = function (defaultValue) {
  392. defaultValue = {
  393. $$typeof: REACT_CONTEXT_TYPE,
  394. _currentValue: defaultValue,
  395. _currentValue2: defaultValue,
  396. _threadCount: 0,
  397. Provider: null,
  398. Consumer: null
  399. };
  400. defaultValue.Provider = defaultValue;
  401. defaultValue.Consumer = {
  402. $$typeof: REACT_CONSUMER_TYPE,
  403. _context: defaultValue
  404. };
  405. return defaultValue;
  406. };
  407. exports.createElement = function (type, config, children) {
  408. var propName,
  409. props = {},
  410. key = null;
  411. if (null != config)
  412. for (propName in (void 0 !== config.key && (key = "" + config.key), config))
  413. hasOwnProperty.call(config, propName) &&
  414. "key" !== propName &&
  415. "__self" !== propName &&
  416. "__source" !== propName &&
  417. (props[propName] = config[propName]);
  418. var childrenLength = arguments.length - 2;
  419. if (1 === childrenLength) props.children = children;
  420. else if (1 < childrenLength) {
  421. for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
  422. childArray[i] = arguments[i + 2];
  423. props.children = childArray;
  424. }
  425. if (type && type.defaultProps)
  426. for (propName in ((childrenLength = type.defaultProps), childrenLength))
  427. void 0 === props[propName] &&
  428. (props[propName] = childrenLength[propName]);
  429. return ReactElement(type, key, props);
  430. };
  431. exports.createRef = function () {
  432. return { current: null };
  433. };
  434. exports.forwardRef = function (render) {
  435. return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
  436. };
  437. exports.isValidElement = isValidElement;
  438. exports.lazy = function (ctor) {
  439. return {
  440. $$typeof: REACT_LAZY_TYPE,
  441. _payload: { _status: -1, _result: ctor },
  442. _init: lazyInitializer
  443. };
  444. };
  445. exports.memo = function (type, compare) {
  446. return {
  447. $$typeof: REACT_MEMO_TYPE,
  448. type: type,
  449. compare: void 0 === compare ? null : compare
  450. };
  451. };
  452. exports.startTransition = function (scope) {
  453. var prevTransition = ReactSharedInternals.T,
  454. currentTransition = {};
  455. ReactSharedInternals.T = currentTransition;
  456. try {
  457. var returnValue = scope(),
  458. onStartTransitionFinish = ReactSharedInternals.S;
  459. null !== onStartTransitionFinish &&
  460. onStartTransitionFinish(currentTransition, returnValue);
  461. "object" === typeof returnValue &&
  462. null !== returnValue &&
  463. "function" === typeof returnValue.then &&
  464. returnValue.then(noop, reportGlobalError);
  465. } catch (error) {
  466. reportGlobalError(error);
  467. } finally {
  468. null !== prevTransition &&
  469. null !== currentTransition.types &&
  470. (prevTransition.types = currentTransition.types),
  471. (ReactSharedInternals.T = prevTransition);
  472. }
  473. };
  474. exports.unstable_useCacheRefresh = function () {
  475. return ReactSharedInternals.H.useCacheRefresh();
  476. };
  477. exports.use = function (usable) {
  478. return ReactSharedInternals.H.use(usable);
  479. };
  480. exports.useActionState = function (action, initialState, permalink) {
  481. return ReactSharedInternals.H.useActionState(action, initialState, permalink);
  482. };
  483. exports.useCallback = function (callback, deps) {
  484. return ReactSharedInternals.H.useCallback(callback, deps);
  485. };
  486. exports.useContext = function (Context) {
  487. return ReactSharedInternals.H.useContext(Context);
  488. };
  489. exports.useDebugValue = function () {};
  490. exports.useDeferredValue = function (value, initialValue) {
  491. return ReactSharedInternals.H.useDeferredValue(value, initialValue);
  492. };
  493. exports.useEffect = function (create, deps) {
  494. return ReactSharedInternals.H.useEffect(create, deps);
  495. };
  496. exports.useEffectEvent = function (callback) {
  497. return ReactSharedInternals.H.useEffectEvent(callback);
  498. };
  499. exports.useId = function () {
  500. return ReactSharedInternals.H.useId();
  501. };
  502. exports.useImperativeHandle = function (ref, create, deps) {
  503. return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
  504. };
  505. exports.useInsertionEffect = function (create, deps) {
  506. return ReactSharedInternals.H.useInsertionEffect(create, deps);
  507. };
  508. exports.useLayoutEffect = function (create, deps) {
  509. return ReactSharedInternals.H.useLayoutEffect(create, deps);
  510. };
  511. exports.useMemo = function (create, deps) {
  512. return ReactSharedInternals.H.useMemo(create, deps);
  513. };
  514. exports.useOptimistic = function (passthrough, reducer) {
  515. return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
  516. };
  517. exports.useReducer = function (reducer, initialArg, init) {
  518. return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
  519. };
  520. exports.useRef = function (initialValue) {
  521. return ReactSharedInternals.H.useRef(initialValue);
  522. };
  523. exports.useState = function (initialState) {
  524. return ReactSharedInternals.H.useState(initialState);
  525. };
  526. exports.useSyncExternalStore = function (
  527. subscribe,
  528. getSnapshot,
  529. getServerSnapshot
  530. ) {
  531. return ReactSharedInternals.H.useSyncExternalStore(
  532. subscribe,
  533. getSnapshot,
  534. getServerSnapshot
  535. );
  536. };
  537. exports.useTransition = function () {
  538. return ReactSharedInternals.H.useTransition();
  539. };
  540. exports.version = "19.2.4";