UNPKG

react-reconciler

Version:

React package for creating custom renderers.

1,535 lines (1,526 loc) • 476 kB
/** * @license React * react-reconciler.profiling.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 getComponentNameFromFiber(fiber) { var type = fiber.type; switch (fiber.tag) { case 31: return "Activity"; case 24: return "Cache"; case 9: return (type._context.displayName || "Context") + ".Consumer"; case 10: return type.displayName || "Context"; case 18: return "DehydratedFragment"; case 11: return ( (fiber = type.render), (fiber = fiber.displayName || fiber.name || ""), type.displayName || ("" !== fiber ? "ForwardRef(" + fiber + ")" : "ForwardRef") ); case 7: return "Fragment"; case 26: case 27: case 5: return type; case 4: return "Portal"; case 3: return "Root"; case 6: return "Text"; case 16: return getComponentNameFromType(type); case 8: return type === REACT_STRICT_MODE_TYPE ? "StrictMode" : "Mode"; case 22: return "Offscreen"; case 12: return "Profiler"; case 21: return "Scope"; case 13: return "Suspense"; case 19: return "SuspenseList"; case 25: return "TracingMarker"; case 1: case 0: case 14: case 15: if ("function" === typeof type) return type.displayName || type.name || null; if ("string" === typeof type) return type; } 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 addFiberToLanesMap(root, fiber, lanes) { if (isDevToolsPresent) for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) { var index$8 = 31 - clz32(lanes), lane = 1 << index$8; root[index$8].add(fiber); lanes &= ~lane; } } function movePendingFibersToMemoized(root, lanes) { if (isDevToolsPresent) for ( var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap, memoizedUpdaters = root.memoizedUpdaters; 0 < lanes; ) { var index$9 = 31 - clz32(lanes); root = 1 << index$9; index$9 = pendingUpdatersLaneMap[index$9]; 0 < index$9.size && (index$9.forEach(function (fiber) { var alternate = fiber.alternate; (null !== alternate && memoizedUpdaters.has(alternate)) || memoizedUpdaters.add(fiber); }), index$9.clear()); lanes &= ~root; } } 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 setCurrentTrackFromLanes(lanes) { currentTrack = lanes & 63 ? "Blocking" : lanes & 64 ? "Gesture" : lanes & 4194176 ? "Transition" : lanes & 62914560 ? "Suspense" : lanes & 2080374784 ? "Idle" : "Other"; } function logComponentTrigger(fiber, startTime, endTime, trigger) { supportsUserTiming && ((reusableComponentOptions.start = startTime), (reusableComponentOptions.end = endTime), (reusableComponentDevToolDetails.color = "warning"), (reusableComponentDevToolDetails.tooltipText = trigger), (reusableComponentDevToolDetails.properties = null), performance.measure(trigger, reusableComponentOptions)); } function logComponentReappeared(fiber, startTime, endTime) { logComponentTrigger(fiber, startTime, endTime, "Reconnect"); } function logComponentRender(fiber, startTime, endTime, wasHydrated) { var name = getComponentNameFromFiber(fiber); if (null !== name && supportsUserTiming) { var alternate = fiber.alternate, selfTime = fiber.actualDuration; if (null === alternate || alternate.child !== fiber.child) for (fiber = fiber.child; null !== fiber; fiber = fiber.sibling) selfTime -= fiber.actualDuration; console.timeStamp( name, startTime, endTime, "Components \u269b", void 0, 0.5 > selfTime ? wasHydrated ? "tertiary-light" : "primary-light" : 10 > selfTime ? wasHydrated ? "tertiary" : "primary" : 100 > selfTime ? wasHydrated ? "tertiary-dark" : "primary-dark" : "error" ); } } function logComponentErrored(fiber, startTime, endTime) { supportsUserTiming && ((fiber = getComponentNameFromFiber(fiber)), null !== fiber && console.timeStamp( fiber, startTime, endTime, "Components \u269b", void 0, "error" )); } function logComponentEffect(fiber, startTime, endTime, selfTime, errors) { null !== errors ? supportsUserTiming && ((selfTime = getComponentNameFromFiber(fiber)), null !== selfTime && console.timeStamp( selfTime, startTime, endTime, "Components \u269b", void 0, "error" )) : ((fiber = getComponentNameFromFiber(fiber)), null !== fiber && supportsUserTiming && console.timeStamp( fiber, startTime, endTime, "Components \u269b", void 0, 1 > selfTime ? "secondary-light" : 100 > selfTime ? "secondary" : 500 > selfTime ? "secondary-dark" : "error" )); } function logSuspendedRenderPhase(startTime, endTime, lanes) { !supportsUserTiming || endTime <= startTime || console.timeStamp( "Prewarm", startTime, endTime, currentTrack, "Scheduler \u269b", (lanes & 738197653) === lanes ? "tertiary-dark" : "primary-dark" ); } function logSuspendedWithDelayPhase(startTime, endTime, lanes) { !supportsUserTiming || endTime <= startTime || console.timeStamp( "Suspended", startTime, endTime, currentTrack, "Scheduler \u269b", (lanes & 738197653) === lanes ? "tertiary-dark" : "primary-dark" ); } function logErroredRenderPhase(startTime, endTime) { !supportsUserTiming || endTime <= startTime || console.timeStamp( "Errored", startTime, endTime, currentTrack, "Scheduler \u269b", "error" ); } function logCommitErrored(startTime, endTime) { !supportsUserTiming || endTime <= startTime || console.timeStamp( "Errored", startTime, endTime, currentTrack, "Scheduler \u269b", "error" ); } 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$11) { control = x$11; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x$12) { control = x$12; } (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 startUpdateTimerByLane(lane) { if (0 !== (lane & 127)) { if (0 > blockingUpdateTime) { blockingUpdateTime = now(); isAlreadyRendering() && ((componentEffectSpawnedUpdate = !0), (blockingUpdateType = 1)); lane = resolveEventTimeStamp(); var newEventType$19 = resolveEventType(); lane !== blockingEventRepeatTime || newEventType$19 !== blockingEventType ? (blockingEventRepeatTime = -1.1) : null !== newEventType$19 && (blockingUpdateType = 1); blockingEventTime = lane; blockingEventType = newEventType$19; } } else if ( 0 !== (lane & 4194048) && 0 > transitionUpdateTime && ((transitionUpdateTime = now()), 0 > transitionStartTime) ) { lane = resolveEventTimeStamp(); newEventType$19 = resolveEventType(); if ( lane !== transitionEventRepeatTime || newEventType$19 !== transitionEventType ) transitionEventRepeatTime = -1.1; transitionEventTime = lane; transitionEventType = newEventType$19; } } function startHostActionTimer() { if (0 > blockingUpdateTime) { blockingUpdateTime = now(); isAlreadyRendering() && (blockingUpdateType = 1); var newEventTime = resolveEventTimeStamp(), newEventType = resolveEventType(); newEventTime !== blockingEventRepeatTime || newEventType !== blockingEventType ? (blockingEventRepeatTime = -1.1) : null !== newEventType && (blockingUpdateType = 1); blockingEventTime = newEventTime; blockingEventType = newEventType; } if ( 0 > transitionUpdateTime && ((transitionUpdateTime = now()), 0 > transitionStartTime) ) { newEventTime = resolveEventTimeStamp(); newEventType = resolveEventType(); if ( newEventTime !== transitionEventRepeatTime || newEventType !== transitionEventType ) transitionEventRepeatTime = -1.1; transitionEventTime = newEventTime; transitionEventType = newEventType; } } function pushNestedEffectDurations() { var prevEffectDuration = profilerEffectDuration; profilerEffectDuration = 0; return prevEffectDuration; } function popNestedEffectDurations(prevEffectDuration) { var elapsedTime = profilerEffectDuration; profilerEffectDuration = prevEffectDuration; return elapsedTime; } function bubbleNestedEffectDurations(prevEffectDuration) { var elapsedTime = profilerEffectDuration; profilerEffectDuration += prevEffectDuration; return elapsedTime; } function resetComponentEffectTimers() { componentEffectEndTime = componentEffectStartTime = -1.1; } function pushComponentEffectStart() { var prevEffectStart = componentEffectStartTime; componentEffectStartTime = -1.1; return prevEffectStart; } function popComponentEffectStart(prevEffectStart) { 0 <= prevEffectStart && (componentEffectStartTime = prevEffectStart); } function pushComponentEffectDuration() { var prevEffectDuration = componentEffectDuration; componentEffectDuration = -0; return prevEffectDuration; } function popComponentEffectDuration(prevEffectDuration) { 0 <= prevEffectDuration && (componentEffectDuration = prevEffectDuration); } function pushComponentEffectErrors() { var prevErrors = componentEffectErrors; componentEffectErrors = null; return prevErrors; } function pushComponentEffectDidSpawnUpdate() { var prev = componentEffectSpawnedUpdate; componentEffectSpawnedUpdate = !1; return prev; } function startProfilerTimer(fiber) { profilerStartTime = now(); 0 > fiber.actualStartTime && (fiber.actualStartTime = profilerStartTime); } function stopProfilerTimerIfRunningAndRecordDuration(fiber) { if (0 <= profilerStartTime) { var elapsedTime = now() - profilerStartTime; fiber.actualDuration += elapsedTime; fiber.selfBaseDuration = elapsedTime; profilerStartTime = -1; } } function stopProfilerTimerIfRunningAndRecordIncompleteDuration(fiber) { if (0 <= profilerStartTime) { var elapsedTime = now() - profilerStartTime; fiber.actualDuration += elapsedTime; profilerStartTime = -1; } } function recordEffectDuration() { if (0 <= profilerStartTime) { var endTime = now(), elapsedTime = endTime - profilerStartTime; profilerStartTime = -1; profilerEffectDuration += elapsedTime; componentEffectDuration += elapsedTime; componentEffectEndTime = endTime; } } function recordEffectError(errorInfo) { null === componentEffectErrors && (componentEffectErrors = []); componentEffectErrors.push(errorInfo); null === commitErrors && (commitErrors = []); commitErrors.push(errorInfo); } function startEffectTimer() { profilerStartTime = now(); 0 > componentEffectStartTime && (componentEffectStartTime = profilerStartTime); } function transferActualDuration(fiber) { for (var child = fiber.child; child; ) (fiber.actualDuration += child.actualDuration), (child = child.sibling); } 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,