UNPKG

react-reconciler

Version:

React package for creating custom renderers.

1,490 lines (1,481 loc) • 408 kB
/** * @license React * react-reconciler.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ "use strict"; module.exports = function ($$$config) { function createFiber(tag, pendingProps, key, mode) { return new FiberNode(tag, pendingProps, key, mode); } function noop() {} function formatProdErrorMessage(code) { var url = "https://react.dev/errors/" + code; if (1 < arguments.length) { url += "?args[]=" + encodeURIComponent(arguments[1]); for (var i = 2; i < arguments.length; i++) url += "&args[]=" + encodeURIComponent(arguments[i]); } return ( "Minified React error #" + code + "; visit " + url + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." ); } function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; if (fiber.alternate) for (; node.return; ) node = node.return; else { fiber = node; do (node = fiber), 0 !== (node.flags & 4098) && (nearestMounted = node.return), (fiber = node.return); while (fiber); } return 3 === node.tag ? nearestMounted : null; } function assertIsMounted(fiber) { if (getNearestMountedFiber(fiber) !== fiber) throw Error(formatProdErrorMessage(188)); } function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { alternate = getNearestMountedFiber(fiber); if (null === alternate) throw Error(formatProdErrorMessage(188)); return alternate !== fiber ? null : fiber; } for (var a = fiber, b = alternate; ; ) { var parentA = a.return; if (null === parentA) break; var parentB = parentA.alternate; if (null === parentB) { b = parentA.return; if (null !== b) { a = b; continue; } break; } if (parentA.child === parentB.child) { for (parentB = parentA.child; parentB; ) { if (parentB === a) return assertIsMounted(parentA), fiber; if (parentB === b) return assertIsMounted(parentA), alternate; parentB = parentB.sibling; } throw Error(formatProdErrorMessage(188)); } if (a.return !== b.return) (a = parentA), (b = parentB); else { for (var didFindChild = !1, child$0 = parentA.child; child$0; ) { if (child$0 === a) { didFindChild = !0; a = parentA; b = parentB; break; } if (child$0 === b) { didFindChild = !0; b = parentA; a = parentB; break; } child$0 = child$0.sibling; } if (!didFindChild) { for (child$0 = parentB.child; child$0; ) { if (child$0 === a) { didFindChild = !0; a = parentB; b = parentA; break; } if (child$0 === b) { didFindChild = !0; b = parentB; a = parentA; break; } child$0 = child$0.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } } if (a.alternate !== b) throw Error(formatProdErrorMessage(190)); } if (3 !== a.tag) throw Error(formatProdErrorMessage(188)); return a.stateNode.current === a ? fiber : alternate; } function findCurrentHostFiberImpl(node) { var tag = node.tag; if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node; for (node = node.child; null !== node; ) { tag = findCurrentHostFiberImpl(node); if (null !== tag) return tag; node = node.sibling; } return null; } function findCurrentHostFiberWithNoPortalsImpl(node) { var tag = node.tag; if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node; for (node = node.child; null !== node; ) { if ( 4 !== node.tag && ((tag = findCurrentHostFiberWithNoPortalsImpl(node)), null !== tag) ) return tag; node = node.sibling; } return null; } function getIteratorFn(maybeIterable) { if (null === maybeIterable || "object" !== typeof maybeIterable) return null; maybeIterable = (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || maybeIterable["@@iterator"]; return "function" === typeof maybeIterable ? maybeIterable : null; } function getComponentNameFromType(type) { if (null == type) return null; if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null; if ("string" === typeof type) return type; switch (type) { case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; case REACT_ACTIVITY_TYPE: return "Activity"; } if ("object" === typeof type) switch (type.$$typeof) { case REACT_PORTAL_TYPE: return "Portal"; case REACT_CONTEXT_TYPE: return type.displayName || "Context"; case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer"; case REACT_FORWARD_REF_TYPE: var innerType = type.render; type = type.displayName; type || ((type = innerType.displayName || innerType.name || ""), (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); return type; case REACT_MEMO_TYPE: return ( (innerType = type.displayName || null), null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo" ); case REACT_LAZY_TYPE: innerType = type._payload; type = type._init; try { return getComponentNameFromType(type(innerType)); } catch (x) {} } return null; } function createCursor(defaultValue) { return { current: defaultValue }; } function pop(cursor) { 0 > index$jscomp$0 || ((cursor.current = valueStack[index$jscomp$0]), (valueStack[index$jscomp$0] = null), index$jscomp$0--); } function push(cursor, value) { index$jscomp$0++; valueStack[index$jscomp$0] = cursor.current; cursor.current = value; } function clz32Fallback(x) { x >>>= 0; return 0 === x ? 32 : (31 - ((log$1(x) / LN2) | 0)) | 0; } function getHighestPriorityLanes(lanes) { var pendingSyncLanes = lanes & 42; if (0 !== pendingSyncLanes) return pendingSyncLanes; switch (lanes & -lanes) { case 1: return 1; case 2: return 2; case 4: return 4; case 8: return 8; case 16: return 16; case 32: return 32; case 64: return 64; case 128: return 128; case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: return lanes & 261888; case 262144: case 524288: case 1048576: case 2097152: return lanes & 3932160; case 4194304: case 8388608: case 16777216: case 33554432: return lanes & 62914560; case 67108864: return 67108864; case 134217728: return 134217728; case 268435456: return 268435456; case 536870912: return 536870912; case 1073741824: return 0; default: return lanes; } } function getNextLanes(root, wipLanes, rootHasPendingCommit) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; root = root.warmLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) : ((pingedLanes &= nonIdlePendingLanes), 0 !== pingedLanes ? (nextLanes = getHighestPriorityLanes(pingedLanes)) : rootHasPendingCommit || ((rootHasPendingCommit = nonIdlePendingLanes & ~root), 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit))))) : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), 0 !== nonIdlePendingLanes ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) : 0 !== pingedLanes ? (nextLanes = getHighestPriorityLanes(pingedLanes)) : rootHasPendingCommit || ((rootHasPendingCommit = pendingLanes & ~root), 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), (rootHasPendingCommit = wipLanes & -wipLanes), suspendedLanes >= rootHasPendingCommit || (32 === suspendedLanes && 0 !== (rootHasPendingCommit & 4194048))) ? wipLanes : nextLanes; } function checkIfRootIsPrerendering(root, renderLanes) { return ( 0 === (root.pendingLanes & ~(root.suspendedLanes & ~root.pingedLanes) & renderLanes) ); } function computeExpirationTime(lane, currentTime) { switch (lane) { case 1: case 2: case 4: case 8: case 64: return currentTime + 250; case 16: case 32: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return currentTime + 5e3; case 4194304: case 8388608: case 16777216: case 33554432: return -1; case 67108864: case 134217728: case 268435456: case 536870912: case 1073741824: return -1; default: return -1; } } function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } function markRootUpdated$1(root, updateLane) { root.pendingLanes |= updateLane; 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); } function markRootFinished( root, finishedLanes, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes ) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; root.pingedLanes = 0; root.warmLanes = 0; root.expiredLanes &= remainingLanes; root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; var entanglements = root.entanglements, expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { var index$5 = 31 - clz32(remainingLanes), lane = 1 << index$5; entanglements[index$5] = 0; expirationTimes[index$5] = -1; var hiddenUpdatesForLane = hiddenUpdates[index$5]; if (null !== hiddenUpdatesForLane) for ( hiddenUpdates[index$5] = null, index$5 = 0; index$5 < hiddenUpdatesForLane.length; index$5++ ) { var update = hiddenUpdatesForLane[index$5]; null !== update && (update.lane &= -536870913); } remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); 0 !== suspendedRetryLanes && 0 === updatedLanes && 0 !== root.tag && (root.suspendedLanes |= suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; root.suspendedLanes &= ~spawnedLane; var spawnedLaneIndex = 31 - clz32(spawnedLane); root.entangledLanes |= spawnedLane; root.entanglements[spawnedLaneIndex] = root.entanglements[spawnedLaneIndex] | 1073741824 | (entangledLanes & 261930); } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { var index$6 = 31 - clz32(rootEntangledLanes), lane = 1 << index$6; (lane & entangledLanes) | (root[index$6] & entangledLanes) && (root[index$6] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getBumpedLaneForHydration(root, renderLanes) { var renderLane = renderLanes & -renderLanes; renderLane = 0 !== (renderLane & 42) ? 1 : getBumpedLaneForHydrationByLane(renderLane); return 0 !== (renderLane & (root.suspendedLanes | renderLanes)) ? 0 : renderLane; } function getBumpedLaneForHydrationByLane(lane) { switch (lane) { case 2: lane = 1; break; case 8: lane = 4; break; case 32: lane = 16; break; case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: case 4194304: case 8388608: case 16777216: case 33554432: lane = 128; break; case 268435456: lane = 134217728; break; default: lane = 0; } return lane; } function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes ? 0 !== (lanes & 134217727) ? 32 : 268435456 : 8 : 2; } function setIsStrictModeForDevtools(newIsStrictMode) { "function" === typeof log && unstable_setDisableYieldValue(newIsStrictMode); if (injectedHook && "function" === typeof injectedHook.setStrictMode) try { injectedHook.setStrictMode(rendererID, newIsStrictMode); } catch (err) {} } function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } function describeBuiltInComponentFrame(name) { if (void 0 === prefix) try { throw Error(); } catch (x) { var match = x.stack.trim().match(/\n( *(at )?)/); prefix = (match && match[1]) || ""; suffix = -1 < x.stack.indexOf("\n at") ? " (<anonymous>)" : -1 < x.stack.indexOf("@") ? "@unknown:0:0" : ""; } return "\n" + prefix + name + suffix; } function describeNativeComponentFrame(fn, construct) { if (!fn || reentry) return ""; reentry = !0; var previousPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = void 0; try { var RunInRootFrame = { DetermineComponentFrameRoot: function () { try { if (construct) { var Fake = function () { throw Error(); }; Object.defineProperty(Fake.prototype, "props", { set: function () { throw Error(); } }); if ("object" === typeof Reflect && Reflect.construct) { try { Reflect.construct(Fake, []); } catch (x) { var control = x; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x$8) { control = x$8; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x$9) { control = x$9; } (Fake = fn()) && "function" === typeof Fake.catch && Fake.catch(function () {}); } } catch (sample) { if (sample && control && "string" === typeof sample.stack) return [sample.stack, control.stack]; } return [null, null]; } }; RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot"; var namePropDescriptor = Object.getOwnPropertyDescriptor( RunInRootFrame.DetermineComponentFrameRoot, "name" ); namePropDescriptor && namePropDescriptor.configurable && Object.defineProperty( RunInRootFrame.DetermineComponentFrameRoot, "name", { value: "DetermineComponentFrameRoot" } ); var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), sampleStack = _RunInRootFrame$Deter[0], controlStack = _RunInRootFrame$Deter[1]; if (sampleStack && controlStack) { var sampleLines = sampleStack.split("\n"), controlLines = controlStack.split("\n"); for ( namePropDescriptor = RunInRootFrame = 0; RunInRootFrame < sampleLines.length && !sampleLines[RunInRootFrame].includes("DetermineComponentFrameRoot"); ) RunInRootFrame++; for ( ; namePropDescriptor < controlLines.length && !controlLines[namePropDescriptor].includes( "DetermineComponentFrameRoot" ); ) namePropDescriptor++; if ( RunInRootFrame === sampleLines.length || namePropDescriptor === controlLines.length ) for ( RunInRootFrame = sampleLines.length - 1, namePropDescriptor = controlLines.length - 1; 1 <= RunInRootFrame && 0 <= namePropDescriptor && sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]; ) namePropDescriptor--; for ( ; 1 <= RunInRootFrame && 0 <= namePropDescriptor; RunInRootFrame--, namePropDescriptor-- ) if ( sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor] ) { if (1 !== RunInRootFrame || 1 !== namePropDescriptor) { do if ( (RunInRootFrame--, namePropDescriptor--, 0 > namePropDescriptor || sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]) ) { var frame = "\n" + sampleLines[RunInRootFrame].replace(" at new ", " at "); fn.displayName && frame.includes("<anonymous>") && (frame = frame.replace("<anonymous>", fn.displayName)); return frame; } while (1 <= RunInRootFrame && 0 <= namePropDescriptor); } break; } } } finally { (reentry = !1), (Error.prepareStackTrace = previousPrepareStackTrace); } return (previousPrepareStackTrace = fn ? fn.displayName || fn.name : "") ? describeBuiltInComponentFrame(previousPrepareStackTrace) : ""; } function describeFiber(fiber, childFiber) { switch (fiber.tag) { case 26: case 27: case 5: return describeBuiltInComponentFrame(fiber.type); case 16: return describeBuiltInComponentFrame("Lazy"); case 13: return fiber.child !== childFiber && null !== childFiber ? describeBuiltInComponentFrame("Suspense Fallback") : describeBuiltInComponentFrame("Suspense"); case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: case 15: return describeNativeComponentFrame(fiber.type, !1); case 11: return describeNativeComponentFrame(fiber.type.render, !1); case 1: return describeNativeComponentFrame(fiber.type, !0); case 31: return describeBuiltInComponentFrame("Activity"); default: return ""; } } function getStackByFiberInDevAndProd(workInProgress) { try { var info = "", previous = null; do (info += describeFiber(workInProgress, previous)), (previous = workInProgress), (workInProgress = workInProgress.return); while (workInProgress); return info; } catch (x) { return "\nError generating stack: " + x.message + "\n" + x.stack; } } function createCapturedValueAtFiber(value, source) { if ("object" === typeof value && null !== value) { var existing = CapturedStacks.get(value); if (void 0 !== existing) return existing; source = { value: value, source: source, stack: getStackByFiberInDevAndProd(source) }; CapturedStacks.set(value, source); return source; } return { value: value, source: source, stack: getStackByFiberInDevAndProd(source) }; } function pushTreeFork(workInProgress, totalChildren) { forkStack[forkStackIndex++] = treeForkCount; forkStack[forkStackIndex++] = treeForkProvider; treeForkProvider = workInProgress; treeForkCount = totalChildren; } function pushTreeId(workInProgress, totalChildren, index) { idStack[idStackIndex++] = treeContextId; idStack[idStackIndex++] = treeContextOverflow; idStack[idStackIndex++] = treeContextProvider; treeContextProvider = workInProgress; var baseIdWithLeadingBit = treeContextId; workInProgress = treeContextOverflow; var baseLength = 32 - clz32(baseIdWithLeadingBit) - 1; baseIdWithLeadingBit &= ~(1 << baseLength); index += 1; var length = 32 - clz32(totalChildren) + baseLength; if (30 < length) { var numberOfOverflowBits = baseLength - (baseLength % 5); length = ( baseIdWithLeadingBit & ((1 << numberOfOverflowBits) - 1) ).toString(32); baseIdWithLeadingBit >>= numberOfOverflowBits; baseLength -= numberOfOverflowBits; treeContextId = (1 << (32 - clz32(totalChildren) + baseLength)) | (index << baseLength) | baseIdWithLeadingBit; treeContextOverflow = length + workInProgress; } else (treeContextId = (1 << length) | (index << baseLength) | baseIdWithLeadingBit), (treeContextOverflow = workInProgress); } function pushMaterializedTreeId(workInProgress) { null !== workInProgress.return && (pushTreeFork(workInProgress, 1), pushTreeId(workInProgress, 1, 0)); } function popTreeContext(workInProgress) { for (; workInProgress === treeForkProvider; ) (treeForkProvider = forkStack[--forkStackIndex]), (forkStack[forkStackIndex] = null), (treeForkCount = forkStack[--forkStackIndex]), (forkStack[forkStackIndex] = null); for (; workInProgress === treeContextProvider; ) (treeContextProvider = idStack[--idStackIndex]), (idStack[idStackIndex] = null), (treeContextOverflow = idStack[--idStackIndex]), (idStack[idStackIndex] = null), (treeContextId = idStack[--idStackIndex]), (idStack[idStackIndex] = null); } function restoreSuspendedTreeContext(workInProgress, suspendedContext) { idStack[idStackIndex++] = treeContextId; idStack[idStackIndex++] = treeContextOverflow; idStack[idStackIndex++] = treeContextProvider; treeContextId = suspendedContext.id; treeContextOverflow = suspendedContext.overflow; treeContextProvider = workInProgress; } function pushHostContainer(fiber, nextRootInstance) { push(rootInstanceStackCursor, nextRootInstance); push(contextFiberStackCursor, fiber); push(contextStackCursor, null); fiber = getRootHostContext(nextRootInstance); pop(contextStackCursor); push(contextStackCursor, fiber); } function popHostContainer() { pop(contextStackCursor); pop(contextFiberStackCursor); pop(rootInstanceStackCursor); } function pushHostContext(fiber) { null !== fiber.memoizedState && push(hostTransitionProviderCursor, fiber); var context = contextStackCursor.current, nextContext = getChildHostContext(context, fiber.type); context !== nextContext && (push(contextFiberStackCursor, fiber), push(contextStackCursor, nextContext)); } function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor), pop(contextFiberStackCursor)); hostTransitionProviderCursor.current === fiber && (pop(hostTransitionProviderCursor), isPrimaryRenderer ? (HostTransitionContext._currentValue = NotPendingTransition) : (HostTransitionContext._currentValue2 = NotPendingTransition)); } function throwOnHydrationMismatch(fiber) { var error = Error( formatProdErrorMessage( 418, 1 < arguments.length && void 0 !== arguments[1] && arguments[1] ? "text" : "HTML", "" ) ); queueHydrationError(createCapturedValueAtFiber(error, fiber)); throw HydrationMismatchException; } function prepareToHydrateHostInstance(fiber, hostContext) { if (!supportsHydration) throw Error(formatProdErrorMessage(175)); hydrateInstance( fiber.stateNode, fiber.type, fiber.memoizedProps, hostContext, fiber ) || throwOnHydrationMismatch(fiber, !0); } function popToNextHostParent(fiber) { for (hydrationParentFiber = fiber.return; hydrationParentFiber; ) switch (hydrationParentFiber.tag) { case 5: case 31: case 13: rootOrSingletonContext = !1; return; case 27: case 3: rootOrSingletonContext = !0; return; default: hydrationParentFiber = hydrationParentFiber.return; } } function popHydrationState(fiber) { if (!supportsHydration || fiber !== hydrationParentFiber) return !1; if (!isHydrating) return popToNextHostParent(fiber), (isHydrating = !0), !1; var tag = fiber.tag; supportsSingletons ? 3 !== tag && 27 !== tag && (5 !== tag || (shouldDeleteUnhydratedTailInstances(fiber.type) && !shouldSetTextContent(fiber.type, fiber.memoizedProps))) && nextHydratableInstance && throwOnHydrationMismatch(fiber) : 3 !== tag && (5 !== tag || (shouldDeleteUnhydratedTailInstances(fiber.type) && !shouldSetTextContent(fiber.type, fiber.memoizedProps))) && nextHydratableInstance && throwOnHydrationMismatch(fiber); popToNextHostParent(fiber); if (13 === tag) { if (!supportsHydration) throw Error(formatProdErrorMessage(316)); fiber = fiber.memoizedState; fiber = null !== fiber ? fiber.dehydrated : null; if (!fiber) throw Error(formatProdErrorMessage(317)); nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(fiber); } else if (31 === tag) { fiber = fiber.memoizedState; fiber = null !== fiber ? fiber.dehydrated : null; if (!fiber) throw Error(formatProdErrorMessage(317)); nextHydratableInstance = getNextHydratableInstanceAfterActivityInstance(fiber); } else nextHydratableInstance = supportsSingletons && 27 === tag ? getNextHydratableSiblingAfterSingleton( fiber.type, nextHydratableInstance ) : hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null; return !0; } function resetHydrationState() { supportsHydration && ((nextHydratableInstance = hydrationParentFiber = null), (isHydrating = !1)); } function upgradeHydrationErrorsToRecoverable() { var queuedErrors = hydrationErrors; null !== queuedErrors && (null === workInProgressRootRecoverableErrors ? (workInProgressRootRecoverableErrors = queuedErrors) : workInProgressRootRecoverableErrors.push.apply( workInProgressRootRecoverableErrors, queuedErrors ), (hydrationErrors = null)); return queuedErrors; } function queueHydrationError(error) { null === hydrationErrors ? (hydrationErrors = [error]) : hydrationErrors.push(error); } function pushProvider(providerFiber, context, nextValue) { isPrimaryRenderer ? (push(valueCursor, context._currentValue), (context._currentValue = nextValue)) : (push(valueCursor, context._currentValue2), (context._currentValue2 = nextValue)); } function popProvider(context) { var currentValue = valueCursor.current; isPrimaryRenderer ? (context._currentValue = currentValue) : (context._currentValue2 = currentValue); pop(valueCursor); } function scheduleContextWorkOnParentPath( parent, renderLanes, propagationRoot ) { for (; null !== parent; ) { var alternate = parent.alternate; (parent.childLanes & renderLanes) !== renderLanes ? ((parent.childLanes |= renderLanes), null !== alternate && (alternate.childLanes |= renderLanes)) : null !== alternate && (alternate.childLanes & renderLanes) !== renderLanes && (alternate.childLanes |= renderLanes); if (parent === propagationRoot) break; parent = parent.return; } } function propagateContextChanges( workInProgress, contexts, renderLanes, forcePropagateEntireTree ) { var fiber = workInProgress.child; null !== fiber && (fiber.return = workInProgress); for (; null !== fiber; ) { var list = fiber.dependencies; if (null !== list) { var nextFiber = fiber.child; list = list.firstContext; a: for (; null !== list; ) { var dependency = list; list = fiber; for (var i = 0; i < contexts.length; i++) if (dependency.context === contexts[i]) { list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); scheduleContextWorkOnParentPath( list.return, renderLanes, workInProgress ); forcePropagateEntireTree || (nextFiber = null); break a; } list = dependency.next; } } else if (18 === fiber.tag) { nextFiber = fiber.return; if (null === nextFiber) throw Error(formatProdErrorMessage(341)); nextFiber.lanes |= renderLanes; list = nextFiber.alternate; null !== list && (list.lanes |= renderLanes); scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); nextFiber = null; } else nextFiber = fiber.child; if (null !== nextFiber) nextFiber.return = fiber; else for (nextFiber = fiber; null !== nextFiber; ) { if (nextFiber === workInProgress) { nextFiber = null; break; } fiber = nextFiber.sibling; if (null !== fiber) { fiber.return = nextFiber.return; nextFiber = fiber; break; } nextFiber = nextFiber.return; } fiber = nextFiber; } } function propagateParentContextChanges( current, workInProgress, renderLanes, forcePropagateEntireTree ) { current = null; for ( var parent = workInProgress, isInsidePropagationBailout = !1; null !== parent; ) { if (!isInsidePropagationBailout) if (0 !== (parent.flags & 524288)) isInsidePropagationBailout = !0; else if (0 !== (parent.flags & 262144)) break; if (10 === parent.tag) { var currentParent = parent.alternate; if (null === currentParent) throw Error(formatProdErrorMessage(387)); currentParent = currentParent.memoizedProps; if (null !== currentParent) { var context = parent.type; objectIs(parent.pendingProps.value, currentParent.value) || (null !== current ? current.push(context) : (current = [context])); } } else if (parent === hostTransitionProviderCursor.current) { currentParent = parent.alternate; if (null === currentParent) throw Error(formatProdErrorMessage(387)); currentParent.memoizedState.memoizedState !== parent.memoizedState.memoizedState && (null !== current ? current.push(HostTransitionContext) : (current = [HostTransitionContext])); } parent = parent.return; } null !== current && propagateContextChanges( workInProgress, current, renderLanes, forcePropagateEntireTree ); workInProgress.flags |= 262144; } function checkIfContextChanged(currentDependencies) { for ( currentDependencies = currentDependencies.firstContext; null !== currentDependencies; ) { var context = currentDependencies.context; if ( !objectIs( isPrimaryRenderer ? context._currentValue : context._currentValue2, currentDependencies.memoizedValue ) ) return !0; currentDependencies = currentDependencies.next; } return !1; } function prepareToReadContext(workInProgress) { currentlyRenderingFiber$1 = workInProgress; lastContextDependency = null; workInProgress = workInProgress.dependencies; null !== workInProgress && (workInProgress.firstContext = null); } function readContext(context) { return readContextForConsumer(currentlyRenderingFiber$1, context); } function readContextDuringReconciliation(consumer, context) { null === currentlyRenderingFiber$1 && prepareToReadContext(consumer); return readContextForConsumer(consumer, context); } function readContextForConsumer(consumer, context) { var value = isPrimaryRenderer ? context._currentValue : context._currentValue2; context = { context: context, memoizedValue: value, next: null }; if (null === lastContextDependency) { if (null === consumer) throw Error(formatProdErrorMessage(308)); lastContextDependency = context; consumer.dependencies = { lanes: 0, firstContext: context }; consumer.flags |= 524288; } else lastContextDependency = lastContextDependency.next = context; return value; } function createCache() { return { controller: new AbortControllerLocal(), data: new Map(), refCount: 0 }; } function releaseCache(cache) { cache.refCount--; 0 === cache.refCount && scheduleCallback$2(NormalPriority, function () { cache.controller.abort(); }); } function noop$1() {} function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && (null === lastScheduledRoot ? (firstScheduledRoot = lastScheduledRoot = root) : (lastScheduledRoot = lastScheduledRoot.next = root)); mightHavePendingSyncWork = !0; didScheduleMicrotask || ((didScheduleMicrotask = !0), scheduleImmediateRootScheduleTask()); } function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root; ) { if (!onlyLegacy) if (0 !== syncTransitionLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) var JSCompiler_inline_result = 0; else { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; JSCompiler_inline_result = (1 << (31 - clz32(42 | syncTransitionLanes) + 1)) - 1; JSCompiler_inline_result &= pendingLanes & ~(suspendedLanes & ~pingedLanes); JSCompiler_inline_result = JSCompiler_inline_result & 201326741 ? (JSCompiler_inline_result & 201326741) | 1 : JSCompiler_inline_result ? JSCompiler_inline_result | 2 : 0; } 0 !== JSCompiler_inline_result && ((didPerformSomeWork = !0), performSyncWorkOnRoot(root, JSCompiler_inline_result)); } else (JSCompiler_inline_result = workInProgressRootRenderLanes), (JSCompiler_inline_result = getNextLanes( root, root === workInProgressRoot ? JSCompiler_inline_result : 0, null !== root.cancelPendingCommit || root.timeoutHandle !== noTimeout )), 0 === (JSCompiler_inline_result & 3) || checkIfRootIsPrerendering(root, JSCompiler_inline_result) || ((didPerformSomeWork = !0), performSyncWorkOnRoot(root, JSCompiler_inline_result)); root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; } } function processRootScheduleInImmediateTask() { processRootScheduleInMicrotask(); } function processRootScheduleInMicrotask() { mightHavePendingSyncWork = didScheduleMicrotask = !1; var syncTransitionLanes = 0; 0 !== currentEventTransitionLane && shouldAttemptEagerTransition() && (syncTransitionLanes = currentEventTransitionLane); for ( var currentTime = now(), prev = null, root = firstScheduledRoot; null !== root; ) { var next = root.next, nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); if (0 === nextLanes) (root.next = null), null === prev ? (firstScheduledRoot = next) : (prev.next = next), null === next && (lastScheduledRoot = prev); else if ( ((prev = root), 0 !== syncTransitionLanes || 0 !== (nextLanes & 3)) ) mightHavePendingSyncWork = !0; root = next; } (0 !== pendingEffectsStatus && 5 !== pendingEffectsStatus) || flushSyncWorkAcrossRoots_impl(syncTransitionLanes, !1); 0 !== currentEventTransitionLane && (currentEventTransitionLane = 0); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { for ( var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, lanes = root.pendingLanes & -62914561; 0 < lanes; ) { var index$3 = 31 - clz32(lanes), lane = 1 << index$3, expirationTime = expirationTimes[index$3]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) expirationTimes[index$3] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } currentTime = workInProgressRoot; suspendedLanes = workInProgressRootRenderLanes; suspendedLanes = getNextLanes( root, root === currentTime ? suspendedLanes : 0, null !== root.cancelPendingCommit || root.timeoutHandle !== noTimeout ); pingedLanes = root.callbackNode; if ( 0 === suspendedLanes || (root === currentTime && (2 === workInProgressSuspendedReason || 9 === workInProgressSuspendedReason)) || null !== root.cancelPendingCommit ) return ( null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes), (root.callbackNode = null), (root.callbackPriority = 0) ); if ( 0 === (suspendedLanes & 3) || checkIfRootIsPrerendering(root, suspendedLanes) ) { currentTime = suspendedLanes & -suspendedLanes; if (currentTime === root.callbackPriority) return currentTime; null !== pingedLanes && cancelCallback$1(pingedLanes); switch (lanesToEventPriority(suspendedLanes)) { case 2: case 8: suspendedLanes = UserBlockingPriority; break; case 32: suspendedLanes = NormalPriority$1; break; case 268435456: suspendedLanes = IdlePriority; break; default: suspendedLanes = NormalPriority$1; } pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); root.callbackPriority = currentTime; root.callbackNode = suspendedLanes; return currentTime; } null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes); root.callbackPriority = 2; root.callbackNode = null; return 2; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { if (0 !== pendingEffectsStatus && 5 !== pendingEffectsStatus) return (root.callbackNode = null), (root.callbackPriority = 0), null; var originalCallbackNode = root.callbackNode; if (flushPendingEffects() && root.callbackNode !== originalCallbackNode) return null; var workInProgressRootRenderLanes$jscomp$0 = workInProgressRootRenderLanes; workInProgressRootRenderLanes$jscomp$0 = getNextLanes( root, root === workInProgressRoot ? workInProgressRootRenderLanes$jscomp$0 : 0, null !== root.cancelPendingCommit || root.timeoutHandle !== noTimeout ); if (0 === workInProgressRootRenderLanes$jscomp$0) return null; performWorkOnRoot(root, workInProgressRootRenderLanes$jscomp$0, didTimeout); scheduleTaskForRootDuringMicrotask(root, now()); return null != root.callbackNode && root.callbackNode === originalCallbackNode ? performWorkOnRootViaSchedulerTask.bind(null, root) : null; } function performSyncWorkOnRoot(root, lanes) { if (flushPendingEffects()) return null; performWorkOnRoot(root, lanes, !0); } function scheduleImmediateRootScheduleTask() { supportsMicrotasks ? scheduleMicrotask(function () { 0 !== (executionContext & 6) ? scheduleCallback$3( ImmediatePriority, processRootScheduleInImmediateTask ) : processRootScheduleInMicrotask(); }) : scheduleCallback$3( ImmediatePriority, processRootScheduleInImmediateTask ); } function requestTransitionLane() { if (0 === currentEventTransitionLane) { var actionScopeLane = currentEntangledLane; 0 === actionScopeLane && ((actionScopeLane = nextTransitionUpdateLane), (nextTransitionUpdateLane <<= 1), 0 === (nextTransitionUpdateLane & 261888) && (nextTransitionUpdateLane = 256)); currentEventTransitionLane = actionScopeLane; } return currentEventTransitionLane; } function entangleAsyncAction(transition, thenable) { if (null === currentEntangledListeners) { var entangledListeners = (currentEntangledListeners = []); currentEntangledPendingCount = 0; currentEntangledLane = requestTransitionLane(); currentEntangledActionThenable = { status: "pending", value: void 0, then: function (resolve) { entangledListeners.push(resolve); } }; } currentEntangledPendingCount++; thenable.then(pingEngtangledActionScope, pingEngtangledActionScope); return thenable; } function pingEngtangledActionScope() { if ( 0 === --currentEntangledPendingCount && null !== currentEntangledListeners ) { null !== currentEntangledActionThenable && (currentEntangledActionThenable.status = "fulfilled"); var listeners = currentEntangledListeners; currentEntangledListeners = null; currentEntangledLane = 0; currentEntangledActionThenable = null; for (var i = 0; i < listeners.length; i++) (0, listeners[i])(); } } function chainThenableValue(thenable, result) { var listeners = [], thenableWithOverride = { status: "pending", value: null, reason: null, then: function (resolve) { listeners.push(resolve); } }; thenable.then( function () { thenableWithOverride.status = "fulfilled"; thenableWithOverride.value = result; for (var i = 0; i < listeners.length; i++) (0, listeners[i])(result); }, function (error) { thenableWithOverride.status = "rejected"; thenableWithOverride.reason = error; for (error = 0; error < listeners.length; error++) (0, listeners[error])(void 0); } ); return thenableWithOverride; } function peekCacheFromPool() { var cacheResumedFromPreviousRender = resumedCache.current; return null !== cacheResumedFromPreviousRender ? cacheResumedFromPreviousRender : workInProgressRoot.pooledCache; } function pushTransition(offscreenWorkInProgress, prevCachePool) { null === prevCachePool ? push(resumedCache, resumedCache.current) : push(resumedCache, prevCachePool.pool); } function getSuspendedCache() { var cacheFromPool = peekCacheFromPool(); return null === cacheFromPool ? null : { parent: isPrimaryRenderer ? CacheContext._currentValue : CacheContext._currentValue2, pool: cacheFromPool }; } function shallowEqual(objA, objB) { if (objectIs(objA, objB)) return !0; if ( "object" !== typeof objA || null === objA || "object" !== typeof objB || null === objB ) return !1; var keysA = Object.keys(objA), keysB = Object.keys(objB); if (keysA.length !== keysB.length) return !1; for (keysB = 0; keysB < keysA.length; keysB++) { var currentKey = keysA[keysB]; if ( !hasOwnProperty.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey]) ) return !1; } return !0; } function isThenableResolved(thenable) { thenable = thenable.status; return "fulfilled" === thenable || "rejected" === thenable; } function trackUsedThenable(thenableState, thenable, index) { index = thenableState[index]; void 0 === index ? thenableState.push(thenable) : index !== thenable && (thenable.then(noop$1, noop$1), (thenable = index)); switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": throw ( ((thenableState = thenable.reason), checkIfUseWrappedInAsyncCatch(thenableState), thenableState) ); default: if ("string" === typeof thenable.status) thenable.then(noop$1, noop$1); else { thenableState = workInProgressRoot; if (null !== thenableState && 100 < thenableState.shellSuspendCounter) throw Error(formatProdErrorMessage(482)); thenableState = thenable; thenableState.status = "pending"; thenableState.then( function (fulfilledValue) { if ("pending" === thenable.status) { var fulfilledThenable = thenable; fulfilledThenable.status = "fulfilled"; fulfilledThenable.value = fulfilledValue; } }, function (error) { if ("pending" === thenable.status) { var rejectedThenable = thenable; rejectedThenable.status = "rejected"; rejectedThenable.reason = error; } } ); } switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": throw ( ((thenableState = thenable.reason), checkIfUseWrappedInAsyncCatch(thenableState), thenableState) ); } suspendedThenable = thenable; throw SuspenseException; } } function resolveLazy(lazyType) { try { var init = lazyType._init; return init(lazyType._payload); } catch (x) { if (null !== x && "object" === typeof x && "function" === typeof x.then) throw ((suspendedThenable = x), SuspenseException); throw x; } } function getSuspendedThenable() { if (null === suspendedThenable) throw Error(formatProdErrorMessage(459)