UNPKG

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