react.react-server.production.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. /**
  2. * @license React
  3. * react.react-server.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 ReactSharedInternals = { H: null, A: null };
  12. function formatProdErrorMessage(code) {
  13. var url = "https://react.dev/errors/" + code;
  14. if (1 < arguments.length) {
  15. url += "?args[]=" + encodeURIComponent(arguments[1]);
  16. for (var i = 2; i < arguments.length; i++)
  17. url += "&args[]=" + encodeURIComponent(arguments[i]);
  18. }
  19. return (
  20. "Minified React error #" +
  21. code +
  22. "; visit " +
  23. url +
  24. " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
  25. );
  26. }
  27. var isArrayImpl = Array.isArray;
  28. function noop() {}
  29. var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
  30. REACT_PORTAL_TYPE = Symbol.for("react.portal"),
  31. REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
  32. REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
  33. REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
  34. REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
  35. REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
  36. REACT_MEMO_TYPE = Symbol.for("react.memo"),
  37. REACT_LAZY_TYPE = Symbol.for("react.lazy"),
  38. MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
  39. function getIteratorFn(maybeIterable) {
  40. if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
  41. maybeIterable =
  42. (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
  43. maybeIterable["@@iterator"];
  44. return "function" === typeof maybeIterable ? maybeIterable : null;
  45. }
  46. var hasOwnProperty = Object.prototype.hasOwnProperty,
  47. assign = Object.assign;
  48. function ReactElement(type, key, props) {
  49. var refProp = props.ref;
  50. return {
  51. $$typeof: REACT_ELEMENT_TYPE,
  52. type: type,
  53. key: key,
  54. ref: void 0 !== refProp ? refProp : null,
  55. props: props
  56. };
  57. }
  58. function cloneAndReplaceKey(oldElement, newKey) {
  59. return ReactElement(oldElement.type, newKey, oldElement.props);
  60. }
  61. function isValidElement(object) {
  62. return (
  63. "object" === typeof object &&
  64. null !== object &&
  65. object.$$typeof === REACT_ELEMENT_TYPE
  66. );
  67. }
  68. function escape(key) {
  69. var escaperLookup = { "=": "=0", ":": "=2" };
  70. return (
  71. "$" +
  72. key.replace(/[=:]/g, function (match) {
  73. return escaperLookup[match];
  74. })
  75. );
  76. }
  77. var userProvidedKeyEscapeRegex = /\/+/g;
  78. function getElementKey(element, index) {
  79. return "object" === typeof element && null !== element && null != element.key
  80. ? escape("" + element.key)
  81. : index.toString(36);
  82. }
  83. function resolveThenable(thenable) {
  84. switch (thenable.status) {
  85. case "fulfilled":
  86. return thenable.value;
  87. case "rejected":
  88. throw thenable.reason;
  89. default:
  90. switch (
  91. ("string" === typeof thenable.status
  92. ? thenable.then(noop, noop)
  93. : ((thenable.status = "pending"),
  94. thenable.then(
  95. function (fulfilledValue) {
  96. "pending" === thenable.status &&
  97. ((thenable.status = "fulfilled"),
  98. (thenable.value = fulfilledValue));
  99. },
  100. function (error) {
  101. "pending" === thenable.status &&
  102. ((thenable.status = "rejected"), (thenable.reason = error));
  103. }
  104. )),
  105. thenable.status)
  106. ) {
  107. case "fulfilled":
  108. return thenable.value;
  109. case "rejected":
  110. throw thenable.reason;
  111. }
  112. }
  113. throw thenable;
  114. }
  115. function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
  116. var type = typeof children;
  117. if ("undefined" === type || "boolean" === type) children = null;
  118. var invokeCallback = !1;
  119. if (null === children) invokeCallback = !0;
  120. else
  121. switch (type) {
  122. case "bigint":
  123. case "string":
  124. case "number":
  125. invokeCallback = !0;
  126. break;
  127. case "object":
  128. switch (children.$$typeof) {
  129. case REACT_ELEMENT_TYPE:
  130. case REACT_PORTAL_TYPE:
  131. invokeCallback = !0;
  132. break;
  133. case REACT_LAZY_TYPE:
  134. return (
  135. (invokeCallback = children._init),
  136. mapIntoArray(
  137. invokeCallback(children._payload),
  138. array,
  139. escapedPrefix,
  140. nameSoFar,
  141. callback
  142. )
  143. );
  144. }
  145. }
  146. if (invokeCallback)
  147. return (
  148. (callback = callback(children)),
  149. (invokeCallback =
  150. "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
  151. isArrayImpl(callback)
  152. ? ((escapedPrefix = ""),
  153. null != invokeCallback &&
  154. (escapedPrefix =
  155. invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
  156. mapIntoArray(callback, array, escapedPrefix, "", function (c) {
  157. return c;
  158. }))
  159. : null != callback &&
  160. (isValidElement(callback) &&
  161. (callback = cloneAndReplaceKey(
  162. callback,
  163. escapedPrefix +
  164. (null == callback.key ||
  165. (children && children.key === callback.key)
  166. ? ""
  167. : ("" + callback.key).replace(
  168. userProvidedKeyEscapeRegex,
  169. "$&/"
  170. ) + "/") +
  171. invokeCallback
  172. )),
  173. array.push(callback)),
  174. 1
  175. );
  176. invokeCallback = 0;
  177. var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
  178. if (isArrayImpl(children))
  179. for (var i = 0; i < children.length; i++)
  180. (nameSoFar = children[i]),
  181. (type = nextNamePrefix + getElementKey(nameSoFar, i)),
  182. (invokeCallback += mapIntoArray(
  183. nameSoFar,
  184. array,
  185. escapedPrefix,
  186. type,
  187. callback
  188. ));
  189. else if (((i = getIteratorFn(children)), "function" === typeof i))
  190. for (
  191. children = i.call(children), i = 0;
  192. !(nameSoFar = children.next()).done;
  193. )
  194. (nameSoFar = nameSoFar.value),
  195. (type = nextNamePrefix + getElementKey(nameSoFar, i++)),
  196. (invokeCallback += mapIntoArray(
  197. nameSoFar,
  198. array,
  199. escapedPrefix,
  200. type,
  201. callback
  202. ));
  203. else if ("object" === type) {
  204. if ("function" === typeof children.then)
  205. return mapIntoArray(
  206. resolveThenable(children),
  207. array,
  208. escapedPrefix,
  209. nameSoFar,
  210. callback
  211. );
  212. array = String(children);
  213. throw Error(
  214. formatProdErrorMessage(
  215. 31,
  216. "[object Object]" === array
  217. ? "object with keys {" + Object.keys(children).join(", ") + "}"
  218. : array
  219. )
  220. );
  221. }
  222. return invokeCallback;
  223. }
  224. function mapChildren(children, func, context) {
  225. if (null == children) return children;
  226. var result = [],
  227. count = 0;
  228. mapIntoArray(children, result, "", "", function (child) {
  229. return func.call(context, child, count++);
  230. });
  231. return result;
  232. }
  233. function lazyInitializer(payload) {
  234. if (-1 === payload._status) {
  235. var ctor = payload._result;
  236. ctor = ctor();
  237. ctor.then(
  238. function (moduleObject) {
  239. if (0 === payload._status || -1 === payload._status)
  240. (payload._status = 1), (payload._result = moduleObject);
  241. },
  242. function (error) {
  243. if (0 === payload._status || -1 === payload._status)
  244. (payload._status = 2), (payload._result = error);
  245. }
  246. );
  247. -1 === payload._status && ((payload._status = 0), (payload._result = ctor));
  248. }
  249. if (1 === payload._status) return payload._result.default;
  250. throw payload._result;
  251. }
  252. function createCacheRoot() {
  253. return new WeakMap();
  254. }
  255. function createCacheNode() {
  256. return { s: 0, v: void 0, o: null, p: null };
  257. }
  258. exports.Children = {
  259. map: mapChildren,
  260. forEach: function (children, forEachFunc, forEachContext) {
  261. mapChildren(
  262. children,
  263. function () {
  264. forEachFunc.apply(this, arguments);
  265. },
  266. forEachContext
  267. );
  268. },
  269. count: function (children) {
  270. var n = 0;
  271. mapChildren(children, function () {
  272. n++;
  273. });
  274. return n;
  275. },
  276. toArray: function (children) {
  277. return (
  278. mapChildren(children, function (child) {
  279. return child;
  280. }) || []
  281. );
  282. },
  283. only: function (children) {
  284. if (!isValidElement(children)) throw Error(formatProdErrorMessage(143));
  285. return children;
  286. }
  287. };
  288. exports.Fragment = REACT_FRAGMENT_TYPE;
  289. exports.Profiler = REACT_PROFILER_TYPE;
  290. exports.StrictMode = REACT_STRICT_MODE_TYPE;
  291. exports.Suspense = REACT_SUSPENSE_TYPE;
  292. exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
  293. ReactSharedInternals;
  294. exports.cache = function (fn) {
  295. return function () {
  296. var dispatcher = ReactSharedInternals.A;
  297. if (!dispatcher) return fn.apply(null, arguments);
  298. var fnMap = dispatcher.getCacheForType(createCacheRoot);
  299. dispatcher = fnMap.get(fn);
  300. void 0 === dispatcher &&
  301. ((dispatcher = createCacheNode()), fnMap.set(fn, dispatcher));
  302. fnMap = 0;
  303. for (var l = arguments.length; fnMap < l; fnMap++) {
  304. var arg = arguments[fnMap];
  305. if (
  306. "function" === typeof arg ||
  307. ("object" === typeof arg && null !== arg)
  308. ) {
  309. var objectCache = dispatcher.o;
  310. null === objectCache && (dispatcher.o = objectCache = new WeakMap());
  311. dispatcher = objectCache.get(arg);
  312. void 0 === dispatcher &&
  313. ((dispatcher = createCacheNode()), objectCache.set(arg, dispatcher));
  314. } else
  315. (objectCache = dispatcher.p),
  316. null === objectCache && (dispatcher.p = objectCache = new Map()),
  317. (dispatcher = objectCache.get(arg)),
  318. void 0 === dispatcher &&
  319. ((dispatcher = createCacheNode()),
  320. objectCache.set(arg, dispatcher));
  321. }
  322. if (1 === dispatcher.s) return dispatcher.v;
  323. if (2 === dispatcher.s) throw dispatcher.v;
  324. try {
  325. var result = fn.apply(null, arguments);
  326. fnMap = dispatcher;
  327. fnMap.s = 1;
  328. return (fnMap.v = result);
  329. } catch (error) {
  330. throw ((result = dispatcher), (result.s = 2), (result.v = error), error);
  331. }
  332. };
  333. };
  334. exports.cacheSignal = function () {
  335. var dispatcher = ReactSharedInternals.A;
  336. return dispatcher ? dispatcher.cacheSignal() : null;
  337. };
  338. exports.captureOwnerStack = function () {
  339. return null;
  340. };
  341. exports.cloneElement = function (element, config, children) {
  342. if (null === element || void 0 === element)
  343. throw Error(formatProdErrorMessage(267, element));
  344. var props = assign({}, element.props),
  345. key = element.key;
  346. if (null != config)
  347. for (propName in (void 0 !== config.key && (key = "" + config.key), config))
  348. !hasOwnProperty.call(config, propName) ||
  349. "key" === propName ||
  350. "__self" === propName ||
  351. "__source" === propName ||
  352. ("ref" === propName && void 0 === config.ref) ||
  353. (props[propName] = config[propName]);
  354. var propName = arguments.length - 2;
  355. if (1 === propName) props.children = children;
  356. else if (1 < propName) {
  357. for (var childArray = Array(propName), i = 0; i < propName; i++)
  358. childArray[i] = arguments[i + 2];
  359. props.children = childArray;
  360. }
  361. return ReactElement(element.type, key, props);
  362. };
  363. exports.createElement = function (type, config, children) {
  364. var propName,
  365. props = {},
  366. key = null;
  367. if (null != config)
  368. for (propName in (void 0 !== config.key && (key = "" + config.key), config))
  369. hasOwnProperty.call(config, propName) &&
  370. "key" !== propName &&
  371. "__self" !== propName &&
  372. "__source" !== propName &&
  373. (props[propName] = config[propName]);
  374. var childrenLength = arguments.length - 2;
  375. if (1 === childrenLength) props.children = children;
  376. else if (1 < childrenLength) {
  377. for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
  378. childArray[i] = arguments[i + 2];
  379. props.children = childArray;
  380. }
  381. if (type && type.defaultProps)
  382. for (propName in ((childrenLength = type.defaultProps), childrenLength))
  383. void 0 === props[propName] &&
  384. (props[propName] = childrenLength[propName]);
  385. return ReactElement(type, key, props);
  386. };
  387. exports.createRef = function () {
  388. return { current: null };
  389. };
  390. exports.forwardRef = function (render) {
  391. return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
  392. };
  393. exports.isValidElement = isValidElement;
  394. exports.lazy = function (ctor) {
  395. return {
  396. $$typeof: REACT_LAZY_TYPE,
  397. _payload: { _status: -1, _result: ctor },
  398. _init: lazyInitializer
  399. };
  400. };
  401. exports.memo = function (type, compare) {
  402. return {
  403. $$typeof: REACT_MEMO_TYPE,
  404. type: type,
  405. compare: void 0 === compare ? null : compare
  406. };
  407. };
  408. exports.use = function (usable) {
  409. return ReactSharedInternals.H.use(usable);
  410. };
  411. exports.useCallback = function (callback, deps) {
  412. return ReactSharedInternals.H.useCallback(callback, deps);
  413. };
  414. exports.useDebugValue = function () {};
  415. exports.useId = function () {
  416. return ReactSharedInternals.H.useId();
  417. };
  418. exports.useMemo = function (create, deps) {
  419. return ReactSharedInternals.H.useMemo(create, deps);
  420. };
  421. exports.version = "19.2.4";