From 81f40d0dad152563043d4d56d1d8dfba4dc201d8 Mon Sep 17 00:00:00 2001 From: sebmarkbage Date: Tue, 12 Mar 2024 00:20:40 +0000 Subject: [PATCH] Remove invokeGuardedCallback and replay trick (#28515) We broke the ability to "break on uncaught exceptions" by adding a try/catch higher up in the scheduling. We're giving up on fixing that so we can remove the replay trick inside an event handler. The issue with that approach is that we end up double logging a lot of errors in DEV since they get reported to the page. It's also a lot of complexity around this feature. DiffTrain build for commit https://github.com/facebook/react/commit/89021fb4ec9aa82194b0788566e736a4cedfc0e4. --- .../cjs/ReactTestRenderer-dev.js | 302 +- .../cjs/ReactTestRenderer-prod.js | 6697 +++++++------- .../cjs/ReactTestRenderer-profiling.js | 7327 ++++++++------- .../RKJSModules/vendor/react/cjs/React-dev.js | 2 +- .../vendor/react/cjs/React-prod.js | 2 +- .../vendor/react/cjs/React-profiling.js | 2 +- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 500 +- .../implementations/ReactFabric-prod.fb.js | 6870 +++++++------- .../ReactFabric-profiling.fb.js | 5168 ++++++----- .../ReactNativeRenderer-dev.fb.js | 500 +- .../ReactNativeRenderer-prod.fb.js | 7051 +++++++-------- .../ReactNativeRenderer-profiling.fb.js | 8013 ++++++++--------- 13 files changed, 20566 insertions(+), 21870 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index 6139c312c565c..6301be2484512 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<5567992397ed27615daacd939e3142d0>> + * @generated SignedSource<> */ "use strict"; @@ -12086,25 +12086,8 @@ if (__DEV__) { if (true) { var source = errorInfo.source; var stack = errorInfo.stack; - var componentStack = stack !== null ? stack : ""; // Browsers support silencing uncaught errors by calling - // `preventDefault()` in window `error` handler. - // We record this information as an expando on the error. - - if (error != null && error._suppressLogging) { - if (boundary.tag === ClassComponent) { - // The error is recoverable and was silenced. - // Ignore it and don't print the stack addendum. - // This is handy for testing error boundaries without noise. - return; - } // The error is fatal. Since the silencing might have - // been accidental, we'll surface it anyway. - // However, the browser would have silenced the original error - // so we'll print it first, and then print the stack addendum. - - console["error"](error); // Don't transform to our wrapper - // For a more detailed description of this block, see: - // https://github.com/facebook/react/pull/13384 - } + var componentStack = stack !== null ? stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. + // See https://github.com/facebook/react/pull/13384 var componentName = source ? getComponentNameFromFiber(source) : null; var componentNameMessage = componentName @@ -12126,19 +12109,17 @@ if (__DEV__) { ("using the error boundary you provided, " + errorBoundaryName + "."); - } - - var combinedMessage = - componentNameMessage + - "\n" + - componentStack + - "\n\n" + - ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. - // We don't include the original error message and JS stack because the browser - // has already printed it. Even if the application swallows the error, it is still - // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. - - console["error"](combinedMessage); // Don't transform to our wrapper + } // In development, we provide our own message which includes the component stack + // in addition to the error. + + console["error"]( + // Don't transform to our wrapper + "%o\n\n%s\n%s\n\n%s", + error, + componentNameMessage, + componentStack, + errorBoundaryMessage + ); } } catch (e) { // This method must not throw, or React internal state will get messed up. @@ -15598,7 +15579,7 @@ if (__DEV__) { return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } - function beginWork$1(current, workInProgress, renderLanes) { + function beginWork(current, workInProgress, renderLanes) { { if (workInProgress._debugNeedsRemount && current !== null) { // This will restart the begin phase with a new fiber. @@ -17700,234 +17681,6 @@ if (__DEV__) { } } - var fakeNode = null; - - { - if ( - typeof window !== "undefined" && - typeof window.dispatchEvent === "function" && - typeof document !== "undefined" && // $FlowFixMe[method-unbinding] - typeof document.createEvent === "function" - ) { - fakeNode = document.createElement("react"); - } - } - - function invokeGuardedCallbackImpl(name, func, context) { - { - // In DEV mode, we use a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // unintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - // fakeNode signifies we are in an environment with a document and window object - if (fakeNode) { - var evt = document.createEvent("Event"); - var didCall = false; // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - - var didError = true; // Keeps track of the value of window.event so that we can reset it - // during the callback to let user code access window.event in the - // browsers that support it. - - var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event - // dispatching: https://github.com/facebook/react/issues/13688 - - var windowEventDescriptor = Object.getOwnPropertyDescriptor( - window, - "event" - ); - - var restoreAfterDispatch = function () { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the - // window.event assignment in both IE <= 10 as they throw an error - // "Member not found" in strict mode, and in Firefox which does not - // support window.event. - - if ( - typeof window.event !== "undefined" && - window.hasOwnProperty("event") - ) { - window.event = windowEvent; - } - }; // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - // $FlowFixMe[method-unbinding] - - var _funcArgs = Array.prototype.slice.call(arguments, 3); - - var callCallback = function () { - didCall = true; - restoreAfterDispatch(); // $FlowFixMe[incompatible-call] Flow doesn't understand the arguments splicing. - - func.apply(context, _funcArgs); - didError = false; - }; // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - - var error; // Use this to track whether the error event is ever called. - - var didSetError = false; - var isCrossOriginError = false; - - var handleWindowError = function (event) { - error = event.error; - didSetError = true; - - if (error === null && event.colno === 0 && event.lineno === 0) { - isCrossOriginError = true; - } - - if (event.defaultPrevented) { - // Some other error handler has prevented default. - // Browsers silence the error report if this happens. - // We'll remember this to later decide whether to log it or not. - if (error != null && typeof error === "object") { - try { - error._suppressLogging = true; - } catch (inner) { - // Ignore. - } - } - } - }; // Create a fake event type. - - var evtType = "react-" + (name ? name : "invokeguardedcallback"); // Attach our event handlers - - window.addEventListener("error", handleWindowError); - fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); - - if (windowEventDescriptor) { - Object.defineProperty(window, "event", windowEventDescriptor); - } - - if (didCall && didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - // eslint-disable-next-line react-internal/prod-error-codes - error = new Error( - "An error was thrown inside one of your components, but React " + - "doesn't know what it was. This is likely due to browser " + - 'flakiness. React does its best to preserve the "Pause on ' + - 'exceptions" behavior of the DevTools, which requires some ' + - "DEV-mode only tricks. It's possible that these don't work in " + - "your browser. Try triggering the error in production mode, " + - "or switching to a modern browser. If you suspect that this is " + - "actually an issue with React, please file an issue." - ); - } else if (isCrossOriginError) { - // eslint-disable-next-line react-internal/prod-error-codes - error = new Error( - "A cross-origin error was thrown. React doesn't have access to " + - "the actual error object in development. " + - "See https://react.dev/link/crossorigin-error for more information." - ); - } - - this.onError(error); - } // Remove our event listeners - - window.removeEventListener("error", handleWindowError); - - if (didCall) { - return; - } else { - // Something went really wrong, and our event was not dispatched. - // https://github.com/facebook/react/issues/16734 - // https://github.com/facebook/react/issues/16585 - // Fall back to the production implementation. - restoreAfterDispatch(); // we fall through and call the prod version instead - } - } // We only get here if we are in an environment that either does not support the browser - // variant or we had trouble getting the browser to emit the error. - // $FlowFixMe[method-unbinding] - - var funcArgs = Array.prototype.slice.call(arguments, 3); - - try { - // $FlowFixMe[incompatible-call] Flow doesn't understand the arguments splicing. - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } - } - } - - var hasError = false; - var caughtError = null; // Used by event system to capture/rethrow the first error. - var reporter = { - onError: function (error) { - hasError = true; - caughtError = error; - } - }; - /** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - - function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = false; - caughtError = null; - invokeGuardedCallbackImpl.apply(reporter, arguments); - } - function clearCaughtError() { - if (hasError) { - var error = caughtError; - hasError = false; - caughtError = null; - return error; - } else { - throw new Error( - "clearCaughtError was called but no error was captured. This error " + - "is likely caused by a bug in React. Please file an issue." - ); - } - } - var didWarnAboutUndefinedSnapshotBeforeUpdate = null; { @@ -17947,20 +17700,6 @@ if (__DEV__) { ); } - function reportUncaughtErrorInDEV(error) { - // Wrapping each small part of the commit phase into a guarded - // callback is a bit too slow (https://github.com/facebook/react/pull/21666). - // But we rely on it to surface errors to DEV tools like overlays - // (https://github.com/facebook/react/issues/21712). - // As a compromise, rethrow only caught errors in a guard. - { - invokeGuardedCallback(null, function () { - throw error; - }); - clearCaughtError(); - } - } - function callComponentWillUnmountWithTimer(current, instance) { instance.props = current.memoizedProps; instance.state = current.memoizedState; @@ -23946,7 +23685,6 @@ if (__DEV__) { error$1 ) { { - reportUncaughtErrorInDEV(error$1); setIsRunningInsertionEffect(false); } @@ -24318,12 +24056,6 @@ if (__DEV__) { } } } - var beginWork; - - { - beginWork = beginWork$1; - } - var didWarnAboutUpdateInRender = false; var didWarnAboutUpdateInRenderForAnotherComponent; @@ -25555,7 +25287,7 @@ if (__DEV__) { implementation: portal.implementation }; return fiber; - } // Used for stashing WIP properties to replay failed work in DEV. + } function FiberRootNode( containerInfo, // $FlowFixMe[missing-local-annot] @@ -25677,7 +25409,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-canary-9c48fb25e-20240311"; + var ReactVersion = "18.3.0-canary-89021fb4e-20240311"; // Might add PROFILE later. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index 26c5be01bd22b..0ffdb09019b92 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<0327ee67e8b4e0b45068a1c519910784>> + * @generated SignedSource<<7a4a0e01c19fcba3d9dc6072d968f4ab>> */ "use strict"; @@ -4879,3564 +4879,3563 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } -var valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = - lastContextDependency = - currentlyRenderingFiber = - null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue2); - context._currentValue2 = nextValue; -} -function popProvider(context) { - context._currentValue2 = valueCursor.current; - 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 propagateContextChange(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) - throw Error( - "We just came from a parent so we must have had a parent. This is a bug in React." +function beginWork(current, workInProgress, renderLanes) { + if (null !== current) + if ( + current.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if ( + 0 === (current.lanes & renderLanes) && + 0 === (workInProgress.flags & 128) + ) + return ( + (didReceiveUpdate = !1), + attemptEarlyBailoutIfNoScheduledUpdate( + current, + workInProgress, + renderLanes + ) ); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } 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; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; + } + else didReceiveUpdate = !1; + workInProgress.lanes = 0; + switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor$1.current + ); + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + workInProgress.flags |= 1; + workInProgress.tag = 0; + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; + case 16: + Component = workInProgress.elementType; + a: { + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null)); -} -function readContext(context) { - return readContextForConsumer(currentlyRenderingFiber, context); -} -function readContextDuringReconcilation(consumer, context, renderLanes) { - null === currentlyRenderingFiber && - prepareToReadContext(consumer, renderLanes); - return readContextForConsumer(consumer, context); -} -function readContextForConsumer(consumer, context) { - var value = context._currentValue2; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === consumer) throw Error( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." ); - lastContextDependency = context; - consumer.dependencies = { lanes: 0, firstContext: context }; - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function () { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function (type, listener) { - listeners.push(listener); - } - }); - this.abort = function () { - signal.aborted = !0; - listeners.forEach(function (listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler$1.unstable_scheduleCallback, - NormalPriority = Scheduler$1.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0 - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority, function () { - cache.controller.abort(); - }); -} -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; - null !== transition && transition._callbacks.add(handleAsyncAction); - return transition; -} -function handleAsyncAction(transition, thenable) { - entangleAsyncAction(transition, thenable); -} -function notifyTransitionCallbacks(transition, returnValue) { - transition._callbacks.forEach(function (callback) { - return callback(transition, returnValue); - }); -} -var resumedCache = createCursor(null); -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: CacheContext._currentValue2, pool: cacheFromPool }; -} -function scheduleRetryEffect(workInProgress, retryQueue) { - null !== retryQueue - ? (workInProgress.flags |= 4) - : workInProgress.flags & 16384 && - ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); -} -function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { - switch (renderState.tailMode) { - case "hidden": - hasRenderedATailFallback = renderState.tail; - for (var lastTailNode = null; null !== hasRenderedATailFallback; ) - null !== hasRenderedATailFallback.alternate && - (lastTailNode = hasRenderedATailFallback), - (hasRenderedATailFallback = hasRenderedATailFallback.sibling); - null === lastTailNode - ? (renderState.tail = null) - : (lastTailNode.sibling = null); - break; - case "collapsed": - lastTailNode = renderState.tail; - for (var lastTailNode$62 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$62 = lastTailNode), - (lastTailNode = lastTailNode.sibling); - null === lastTailNode$62 - ? hasRenderedATailFallback || null === renderState.tail - ? (renderState.tail = null) - : (renderState.tail.sibling = null) - : (lastTailNode$62.sibling = null); - } -} -function bubbleProperties(completedWork) { - var didBailout = - null !== completedWork.alternate && - completedWork.alternate.child === completedWork.child, - newChildLanes = 0, - subtreeFlags = 0; - if (didBailout) - for (var child$63 = completedWork.child; null !== child$63; ) - (newChildLanes |= child$63.lanes | child$63.childLanes), - (subtreeFlags |= child$63.subtreeFlags & 31457280), - (subtreeFlags |= child$63.flags & 31457280), - (child$63.return = completedWork), - (child$63 = child$63.sibling); - else - for (child$63 = completedWork.child; null !== child$63; ) - (newChildLanes |= child$63.lanes | child$63.childLanes), - (subtreeFlags |= child$63.subtreeFlags), - (subtreeFlags |= child$63.flags), - (child$63.return = completedWork), - (child$63 = child$63.sibling); - completedWork.subtreeFlags |= subtreeFlags; - completedWork.childLanes = newChildLanes; - return didBailout; -} -function completeWork(current, workInProgress, renderLanes) { - var newProps = workInProgress.pendingProps; - switch (workInProgress.tag) { - case 2: - case 16: - case 15: + } + return workInProgress; case 0: - case 11: - case 7: - case 8: - case 12: - case 9: - case 14: - return bubbleProperties(workInProgress), null; - case 1: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateFunctionComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 3: + case 1: return ( - (renderLanes = workInProgress.stateNode), - (newProps = null), - null !== current && (newProps = current.memoizedState.cache), - workInProgress.memoizedState.cache !== newProps && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - renderLanes.pendingContext && - ((renderLanes.context = renderLanes.pendingContext), - (renderLanes.pendingContext = null)), - (null !== current && null !== current.child) || - null === current || - (current.memoizedState.isDehydrated && - 0 === (workInProgress.flags & 256)) || - ((workInProgress.flags |= 1024), - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), - (hydrationErrors = null))), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateClassComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); + case 3: + pushHostRootContext(workInProgress); + if (null === current) + throw Error("Should have a current fiber. This is a bug in React."); + var nextProps = workInProgress.pendingProps; + context = workInProgress.memoizedState; + Component = context.element; + cloneUpdateQueue(current, workInProgress); + processUpdateQueue(workInProgress, nextProps, null, renderLanes); + nextProps = workInProgress.memoizedState; + var nextCache = nextProps.cache; + pushProvider(workInProgress, CacheContext, nextCache); + nextCache !== context.cache && + propagateContextChange(workInProgress, CacheContext, renderLanes); + suspendIfUpdateReadFromEntangledAsyncAction(); + context = nextProps.element; + context === Component + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + )) + : (reconcileChildren(current, workInProgress, context, renderLanes), + (workInProgress = workInProgress.child)); + return workInProgress; case 26: case 27: case 5: - popHostContext(workInProgress); - renderLanes = workInProgress.type; - if (null !== current && null != workInProgress.stateNode) - current.memoizedProps !== newProps && (workInProgress.flags |= 4); - else { - if (!newProps) { - if (null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." - ); - bubbleProperties(workInProgress); - return null; - } - current = { - type: renderLanes, - props: newProps, - isHidden: !1, - children: [], - internalInstanceHandle: workInProgress, - rootContainerInstance: rootInstanceStackCursor.current, - tag: "INSTANCE" - }; - a: for (renderLanes = workInProgress.child; null !== renderLanes; ) { - if (5 === renderLanes.tag || 6 === renderLanes.tag) { - newProps = renderLanes.stateNode; - var index = current.children.indexOf(newProps); - -1 !== index && current.children.splice(index, 1); - current.children.push(newProps); - } else if (4 !== renderLanes.tag && null !== renderLanes.child) { - renderLanes.child.return = renderLanes; - renderLanes = renderLanes.child; - continue; - } - if (renderLanes === workInProgress) break a; - for (; null === renderLanes.sibling; ) { - if ( - null === renderLanes.return || - renderLanes.return === workInProgress - ) - break a; - renderLanes = renderLanes.return; - } - renderLanes.sibling.return = renderLanes.return; - renderLanes = renderLanes.sibling; - } - workInProgress.stateNode = current; - } - bubbleProperties(workInProgress); - workInProgress.flags &= -16777217; - return null; - case 6: - if (current && null != workInProgress.stateNode) - current.memoizedProps !== newProps && (workInProgress.flags |= 4); - else { - if ("string" !== typeof newProps && null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." - ); - workInProgress.stateNode = { - text: newProps, - isHidden: !1, - tag: "TEXT" - }; - } - bubbleProperties(workInProgress); + return ( + pushHostContext(workInProgress), + (Component = workInProgress.pendingProps.children), + null !== workInProgress.memoizedState && + ((context = renderWithHooks( + current, + workInProgress, + TransitionAwareHostComponent, + null, + null, + renderLanes + )), + (HostTransitionContext._currentValue2 = context), + didReceiveUpdate && + null !== current && + current.memoizedState.memoizedState !== context && + propagateContextChange( + workInProgress, + HostTransitionContext, + renderLanes + )), + markRef(current, workInProgress), + reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child + ); + case 6: return null; case 13: - newProps = workInProgress.memoizedState; - if ( - null === current || - (null !== current.memoizedState && - null !== current.memoizedState.dehydrated) - ) { - if (null !== newProps && null !== newProps.dehydrated) { - if (null === current) { - throw Error( - "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." - ); - throw Error( - "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." - ); - } - 0 === (workInProgress.flags & 128) && - (workInProgress.memoizedState = null); - workInProgress.flags |= 4; - bubbleProperties(workInProgress); - index = !1; - } else - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), - (index = !0); - if (!index) { - if (workInProgress.flags & 256) - return popSuspenseHandler(workInProgress), workInProgress; - popSuspenseHandler(workInProgress); - return null; - } - } - popSuspenseHandler(workInProgress); - if (0 !== (workInProgress.flags & 128)) - return (workInProgress.lanes = renderLanes), workInProgress; - renderLanes = null !== newProps; - current = null !== current && null !== current.memoizedState; - if (renderLanes) { - newProps = workInProgress.child; - index = null; - null !== newProps.alternate && - null !== newProps.alternate.memoizedState && - null !== newProps.alternate.memoizedState.cachePool && - (index = newProps.alternate.memoizedState.cachePool.pool); - var cache$67 = null; - null !== newProps.memoizedState && - null !== newProps.memoizedState.cachePool && - (cache$67 = newProps.memoizedState.cachePool.pool); - cache$67 !== index && (newProps.flags |= 2048); - } - renderLanes !== current && - renderLanes && - (workInProgress.child.flags |= 8192); - scheduleRetryEffect(workInProgress, workInProgress.updateQueue); - bubbleProperties(workInProgress); - return null; + return updateSuspenseComponent(current, workInProgress, renderLanes); case 4: - return popHostContainer(), bubbleProperties(workInProgress), null; - case 10: return ( - popProvider(workInProgress.type._context), - bubbleProperties(workInProgress), - null + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ), + (Component = workInProgress.pendingProps), + null === current + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + Component, + renderLanes + )) + : reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child ); - case 17: + case 11: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateForwardRef( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 19: - pop(suspenseStackCursor); - index = workInProgress.memoizedState; - if (null === index) return bubbleProperties(workInProgress), null; - newProps = 0 !== (workInProgress.flags & 128); - cache$67 = index.rendering; - if (null === cache$67) - if (newProps) cutOffTailIfNeeded(index, !1); - else { - if ( - 0 !== workInProgressRootExitStatus || - (null !== current && 0 !== (current.flags & 128)) - ) - for (current = workInProgress.child; null !== current; ) { - cache$67 = findFirstSuspended(current); - if (null !== cache$67) { - workInProgress.flags |= 128; - cutOffTailIfNeeded(index, !1); - current = cache$67.updateQueue; - workInProgress.updateQueue = current; - scheduleRetryEffect(workInProgress, current); - workInProgress.subtreeFlags = 0; - current = renderLanes; - for (renderLanes = workInProgress.child; null !== renderLanes; ) - resetWorkInProgress(renderLanes, current), - (renderLanes = renderLanes.sibling); - push( - suspenseStackCursor, - (suspenseStackCursor.current & 1) | 2 - ); - return workInProgress.child; - } - current = current.sibling; - } - null !== index.tail && - now() > workInProgressRootRenderTargetTime && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(index, !1), - (workInProgress.lanes = 4194304)); - } - else { - if (!newProps) - if (((current = findFirstSuspended(cache$67)), null !== current)) { - if ( - ((workInProgress.flags |= 128), - (newProps = !0), - (current = current.updateQueue), - (workInProgress.updateQueue = current), - scheduleRetryEffect(workInProgress, current), - cutOffTailIfNeeded(index, !0), - null === index.tail && - "hidden" === index.tailMode && - !cache$67.alternate) - ) - return bubbleProperties(workInProgress), null; - } else - 2 * now() - index.renderingStartTime > - workInProgressRootRenderTargetTime && - 536870912 !== renderLanes && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(index, !1), - (workInProgress.lanes = 4194304)); - index.isBackwards - ? ((cache$67.sibling = workInProgress.child), - (workInProgress.child = cache$67)) - : ((current = index.last), - null !== current - ? (current.sibling = cache$67) - : (workInProgress.child = cache$67), - (index.last = cache$67)); - } - if (null !== index.tail) - return ( - (workInProgress = index.tail), - (index.rendering = workInProgress), - (index.tail = workInProgress.sibling), - (index.renderingStartTime = now()), - (workInProgress.sibling = null), - (current = suspenseStackCursor.current), - push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), - workInProgress - ); - bubbleProperties(workInProgress); - return null; - case 22: - case 23: + case 7: return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - (newProps = null !== workInProgress.memoizedState), - null !== current - ? (null !== current.memoizedState) !== newProps && - (workInProgress.flags |= 8192) - : newProps && (workInProgress.flags |= 8192), - newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 536870912) && - 0 === (workInProgress.flags & 128) && - (bubbleProperties(workInProgress), - workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) - : bubbleProperties(workInProgress), - (renderLanes = workInProgress.updateQueue), - null !== renderLanes && - scheduleRetryEffect(workInProgress, renderLanes.retryQueue), - (renderLanes = null), - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (renderLanes = current.memoizedState.cachePool.pool), - (newProps = null), - null !== workInProgress.memoizedState && - null !== workInProgress.memoizedState.cachePool && - (newProps = workInProgress.memoizedState.cachePool.pool), - newProps !== renderLanes && (workInProgress.flags |= 2048), - null !== current && pop(resumedCache), - null + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps, + renderLanes + ), + workInProgress.child ); - case 24: + case 8: return ( - (renderLanes = null), - null !== current && (renderLanes = current.memoizedState.cache), - workInProgress.memoizedState.cache !== renderLanes && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - bubbleProperties(workInProgress), - null - ); - case 25: - return null; - } - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); -} -function unwindWork(current, workInProgress) { - switch (workInProgress.tag) { - case 1: - return ( - isContextProvider(workInProgress.type) && popContext(), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child ); - case 3: + case 12: return ( - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - (current = workInProgress.flags), - 0 !== (current & 65536) && 0 === (current & 128) - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child ); - case 26: - case 27: - case 5: - return popHostContext(workInProgress), null; - case 13: - popSuspenseHandler(workInProgress); - current = workInProgress.memoizedState; - if ( - null !== current && - null !== current.dehydrated && - null === workInProgress.alternate - ) - throw Error( - "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." - ); - current = workInProgress.flags; - return current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null; - case 19: - return pop(suspenseStackCursor), null; - case 4: - return popHostContainer(), null; case 10: - return popProvider(workInProgress.type._context), null; - case 22: - case 23: + a: { + Component = workInProgress.type._context; + context = workInProgress.pendingProps; + nextProps = workInProgress.memoizedProps; + nextCache = context.value; + pushProvider(workInProgress, Component, nextCache); + if (null !== nextProps) + if (objectIs(nextProps.value, nextCache)) { + if ( + nextProps.children === context.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + ); + break a; + } + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes + ); + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - null !== current && pop(resumedCache), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null + (context = workInProgress.type), + (Component = workInProgress.pendingProps.children), + prepareToReadContext(workInProgress, renderLanes), + (context = readContext(context)), + (Component = Component(context)), + (workInProgress.flags |= 1), + reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child + ); + case 14: + return ( + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), + updateMemoComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) + ); + case 15: + return updateSimpleMemoComponent( + current, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + renderLanes + ); + case 17: + return ( + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), + (workInProgress.tag = 1), + isContextProvider(Component) + ? ((current = !0), pushContextProvider(workInProgress)) + : (current = !1), + prepareToReadContext(workInProgress, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), + finishClassComponent( + null, + workInProgress, + Component, + !0, + current, + renderLanes + ) ); - case 24: - return popProvider(CacheContext), null; - case 25: - return null; - default: - return null; - } -} -function unwindInterruptedWork(current, interruptedWork) { - switch (interruptedWork.tag) { - case 1: - current = interruptedWork.type.childContextTypes; - null !== current && void 0 !== current && popContext(); - break; - case 3: - popProvider(CacheContext); - popHostContainer(); - pop(didPerformWorkStackCursor); - pop(contextStackCursor$1); - break; - case 26: - case 27: - case 5: - popHostContext(interruptedWork); - break; - case 4: - popHostContainer(); - break; - case 13: - popSuspenseHandler(interruptedWork); - break; case 19: - pop(suspenseStackCursor); - break; - case 10: - popProvider(interruptedWork.type._context); - break; + return updateSuspenseListComponent(current, workInProgress, renderLanes); case 22: - case 23: - popSuspenseHandler(interruptedWork); - popHiddenContext(); - null !== current && pop(resumedCache); - break; + return updateOffscreenComponent(current, workInProgress, renderLanes); case 24: - popProvider(CacheContext); + return ( + prepareToReadContext(workInProgress, renderLanes), + (Component = readContext(CacheContext)), + null === current + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), + (nextProps = createCache()), + (context.pooledCache = nextProps), + nextProps.refCount++, + null !== nextProps && (context.pooledCacheLanes |= renderLanes), + (context = nextProps)), + (workInProgress.memoizedState = { + parent: Component, + cache: context + }), + initializeUpdateQueue(workInProgress), + pushProvider(workInProgress, CacheContext, context)) + : (0 !== (current.lanes & renderLanes) && + (cloneUpdateQueue(current, workInProgress), + processUpdateQueue(workInProgress, null, null, renderLanes), + suspendIfUpdateReadFromEntangledAsyncAction()), + (context = current.memoizedState), + (nextProps = workInProgress.memoizedState), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), + 0 === workInProgress.lanes && + (workInProgress.memoizedState = + workInProgress.updateQueue.baseState = + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = nextProps.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && + propagateContextChange( + workInProgress, + CacheContext, + renderLanes + ))), + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); } + throw Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in React. Please file an issue." + ); } -var offscreenSubtreeIsHidden = !1, - offscreenSubtreeWasHidden = !1, - PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, - nextEffect = null; -function safelyAttachRef(current, nearestMountedAncestor) { - try { - var ref = current.ref; - if (null !== ref) { - var instance = current.stateNode; - switch (current.tag) { - case 26: - case 27: - case 5: - var instanceToUse = getPublicInstance(instance); - break; - default: - instanceToUse = instance; - } - "function" === typeof ref - ? (current.refCleanup = ref(instanceToUse)) - : (ref.current = instanceToUse); - } - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } +var valueCursor = createCursor(null), + currentlyRenderingFiber = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = + lastContextDependency = + currentlyRenderingFiber = + null; } -function safelyDetachRef(current, nearestMountedAncestor) { - var ref = current.ref, - refCleanup = current.refCleanup; - if (null !== ref) - if ("function" === typeof refCleanup) - try { - refCleanup(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } finally { - (current.refCleanup = null), - (current = current.alternate), - null != current && (current.refCleanup = null); - } - else if ("function" === typeof ref) - try { - ref(null); - } catch (error$83) { - captureCommitPhaseError(current, nearestMountedAncestor, error$83); - } - else ref.current = null; +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue2); + context._currentValue2 = nextValue; } -function safelyCallDestroy(current, nearestMountedAncestor, destroy) { - try { - destroy(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); +function popProvider(context) { + context._currentValue2 = valueCursor.current; + 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; } } -var shouldFireAfterActiveInstanceBlur = !1; -function commitBeforeMutationEffects(root, firstChild) { - for (nextEffect = firstChild; null !== nextEffect; ) - if ( - ((root = nextEffect), - (firstChild = root.child), - 0 !== (root.subtreeFlags & 1028) && null !== firstChild) - ) - (firstChild.return = root), (nextEffect = firstChild); - else - for (; null !== nextEffect; ) { - root = nextEffect; - try { - var current = root.alternate, - flags = root.flags; - switch (root.tag) { - case 0: - break; - case 11: - case 15: - break; - case 1: - if (0 !== (flags & 1024) && null !== current) { - var prevProps = current.memoizedProps, - prevState = current.memoizedState, - instance = root.stateNode, - snapshot = instance.getSnapshotBeforeUpdate( - root.elementType === root.type - ? prevProps - : resolveDefaultProps(root.type, prevProps), - prevState - ); - instance.__reactInternalSnapshotBeforeUpdate = snapshot; - } - break; - case 3: - 0 !== (flags & 1024) && - root.stateNode.containerInfo.children.splice(0); - break; - case 5: - case 26: - case 27: - case 6: - case 4: - case 17: - break; - default: - if (0 !== (flags & 1024)) - throw Error( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." - ); +function propagateContextChange(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } } - } catch (error) { - captureCommitPhaseError(root, root.return, error); - } - firstChild = root.sibling; - if (null !== firstChild) { - firstChild.return = root.return; - nextEffect = firstChild; + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; break; } - nextEffect = root.return; + dependency = dependency.next; } - current = shouldFireAfterActiveInstanceBlur; - shouldFireAfterActiveInstanceBlur = !1; - return current; -} -function commitHookEffectListUnmount( - flags, - finishedWork, - nearestMountedAncestor -) { - var updateQueue = finishedWork.updateQueue; - updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; - if (null !== updateQueue) { - var effect = (updateQueue = updateQueue.next); - do { - if ((effect.tag & flags) === flags) { - var inst = effect.inst, - destroy = inst.destroy; - void 0 !== destroy && - ((inst.destroy = void 0), - safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy)); + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) + throw Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } 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; } - effect = effect.next; - } while (effect !== updateQueue); + fiber = nextFiber; } } -function commitHookEffectListMount(flags, finishedWork) { - finishedWork = finishedWork.updateQueue; - finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; - if (null !== finishedWork) { - var effect = (finishedWork = finishedWork.next); - do { - if ((effect.tag & flags) === flags) { - var create$84 = effect.create, - inst = effect.inst; - create$84 = create$84(); - inst.destroy = create$84; - } - effect = effect.next; - } while (effect !== finishedWork); - } +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); } -function commitHookLayoutEffects(finishedWork, hookFlags) { - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } +function readContext(context) { + return readContextForConsumer(currentlyRenderingFiber, context); } -function commitClassCallbacks(finishedWork) { - var updateQueue = finishedWork.updateQueue; - if (null !== updateQueue) { - var instance = finishedWork.stateNode; - try { - commitCallbacks(updateQueue, instance); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } +function readContextDuringReconcilation(consumer, context, renderLanes) { + null === currentlyRenderingFiber && + prepareToReadContext(consumer, renderLanes); + return readContextForConsumer(consumer, context); +} +function readContextForConsumer(consumer, context) { + var value = context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function () { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function (type, listener) { + listeners.push(listener); + } + }); + this.abort = function () { + signal.aborted = !0; + listeners.forEach(function (listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler$1.unstable_scheduleCallback, + NormalPriority = Scheduler$1.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0 + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority, function () { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +function requestCurrentTransition() { + var transition = ReactCurrentBatchConfig$1.transition; + null !== transition && transition._callbacks.add(handleAsyncAction); + return transition; +} +function handleAsyncAction(transition, thenable) { + entangleAsyncAction(transition, thenable); +} +function notifyTransitionCallbacks(transition, returnValue) { + transition._callbacks.forEach(function (callback) { + return callback(transition, returnValue); + }); +} +var resumedCache = createCursor(null); +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: CacheContext._currentValue2, pool: cacheFromPool }; +} +function scheduleRetryEffect(workInProgress, retryQueue) { + null !== retryQueue + ? (workInProgress.flags |= 4) + : workInProgress.flags & 16384 && + ((retryQueue = + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), + (workInProgress.lanes |= retryQueue)); +} +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var lastTailNode$62 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$62 = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === lastTailNode$62 + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (lastTailNode$62.sibling = null); } } -function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { - var flags = finishedWork.flags; - switch (finishedWork.tag) { +function bubbleProperties(completedWork) { + var didBailout = + null !== completedWork.alternate && + completedWork.alternate.child === completedWork.child, + newChildLanes = 0, + subtreeFlags = 0; + if (didBailout) + for (var child$63 = completedWork.child; null !== child$63; ) + (newChildLanes |= child$63.lanes | child$63.childLanes), + (subtreeFlags |= child$63.subtreeFlags & 31457280), + (subtreeFlags |= child$63.flags & 31457280), + (child$63.return = completedWork), + (child$63 = child$63.sibling); + else + for (child$63 = completedWork.child; null !== child$63; ) + (newChildLanes |= child$63.lanes | child$63.childLanes), + (subtreeFlags |= child$63.subtreeFlags), + (subtreeFlags |= child$63.flags), + (child$63.return = completedWork), + (child$63 = child$63.sibling); + completedWork.subtreeFlags |= subtreeFlags; + completedWork.childLanes = newChildLanes; + return didBailout; +} +function completeWork(current, workInProgress, renderLanes) { + var newProps = workInProgress.pendingProps; + switch (workInProgress.tag) { + case 2: + case 16: + case 15: case 0: case 11: - case 15: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 4 && commitHookLayoutEffects(finishedWork, 5); - break; + case 7: + case 8: + case 12: + case 9: + case 14: + return bubbleProperties(workInProgress), null; case 1: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 4) - if (((finishedRoot = finishedWork.stateNode), null === current)) - try { - finishedRoot.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - else { - var prevProps = - finishedWork.elementType === finishedWork.type - ? current.memoizedProps - : resolveDefaultProps(finishedWork.type, current.memoizedProps); - current = current.memoizedState; - try { - finishedRoot.componentDidUpdate( - prevProps, - current, - finishedRoot.__reactInternalSnapshotBeforeUpdate - ); - } catch (error$85) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$85 - ); - } - } - flags & 64 && commitClassCallbacks(finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; + return ( + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null + ); case 3: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { - finishedRoot = null; - if (null !== finishedWork.child) - switch (finishedWork.child.tag) { - case 27: - case 5: - finishedRoot = getPublicInstance(finishedWork.child.stateNode); - break; - case 1: - finishedRoot = finishedWork.child.stateNode; - } - try { - commitCallbacks(flags, finishedRoot); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - } - break; + return ( + (renderLanes = workInProgress.stateNode), + (newProps = null), + null !== current && (newProps = current.memoizedState.cache), + workInProgress.memoizedState.cache !== newProps && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + renderLanes.pendingContext && + ((renderLanes.context = renderLanes.pendingContext), + (renderLanes.pendingContext = null)), + (null !== current && null !== current.child) || + null === current || + (current.memoizedState.isDehydrated && + 0 === (workInProgress.flags & 256)) || + ((workInProgress.flags |= 1024), + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), + (hydrationErrors = null))), + bubbleProperties(workInProgress), + null + ); case 26: case 27: case 5: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - break; - case 13: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - break; - case 22: - if (0 !== (finishedWork.mode & 1)) { - if ( - ((prevProps = - null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), - !prevProps) - ) { - current = - (null !== current && null !== current.memoizedState) || - offscreenSubtreeWasHidden; - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevProps; - (offscreenSubtreeWasHidden = current) && - !prevOffscreenSubtreeWasHidden - ? recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - 0 !== (finishedWork.subtreeFlags & 8772) - ) - : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + popHostContext(workInProgress); + renderLanes = workInProgress.type; + if (null !== current && null != workInProgress.stateNode) + current.memoizedProps !== newProps && (workInProgress.flags |= 4); + else { + if (!newProps) { + if (null === workInProgress.stateNode) + throw Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ); + bubbleProperties(workInProgress); + return null; } - } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 512 && - ("manual" === finishedWork.memoizedProps.mode - ? safelyAttachRef(finishedWork, finishedWork.return) - : safelyDetachRef(finishedWork, finishedWork.return)); - break; - default: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - } -} -function detachFiberAfterEffects(fiber) { - var alternate = fiber.alternate; - null !== alternate && - ((fiber.alternate = null), detachFiberAfterEffects(alternate)); - fiber.child = null; - fiber.deletions = null; - fiber.sibling = null; - fiber.stateNode = null; - fiber.return = null; - fiber.dependencies = null; - fiber.memoizedProps = null; - fiber.memoizedState = null; - fiber.pendingProps = null; - fiber.stateNode = null; - fiber.updateQueue = null; -} -function isHostParent(fiber) { - return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; -} -function getHostSibling(fiber) { - a: for (;;) { - for (; null === fiber.sibling; ) { - if (null === fiber.return || isHostParent(fiber.return)) return null; - fiber = fiber.return; - } - fiber.sibling.return = fiber.return; - for ( - fiber = fiber.sibling; - 5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag; - - ) { - if (fiber.flags & 2) continue a; - if (null === fiber.child || 4 === fiber.tag) continue a; - else (fiber.child.return = fiber), (fiber = fiber.child); - } - if (!(fiber.flags & 2)) return fiber.stateNode; - } -} -function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { - var tag = node.tag; - if (5 === tag || 6 === tag) - (node = node.stateNode), - before ? insertBefore(parent, node, before) : appendChild(parent, node); - else if (4 !== tag && ((node = node.child), null !== node)) - for ( - insertOrAppendPlacementNodeIntoContainer(node, before, parent), - node = node.sibling; - null !== node; - - ) - insertOrAppendPlacementNodeIntoContainer(node, before, parent), - (node = node.sibling); -} -function insertOrAppendPlacementNode(node, before, parent) { - var tag = node.tag; - if (5 === tag || 6 === tag) - (node = node.stateNode), - before ? insertBefore(parent, node, before) : appendChild(parent, node); - else if (4 !== tag && ((node = node.child), null !== node)) - for ( - insertOrAppendPlacementNode(node, before, parent), node = node.sibling; - null !== node; - - ) - insertOrAppendPlacementNode(node, before, parent), (node = node.sibling); -} -var hostParent = null; -function recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - parent -) { - for (parent = parent.child; null !== parent; ) - commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), - (parent = parent.sibling); -} -function commitDeletionEffectsOnFiber( - finishedRoot, - nearestMountedAncestor, - deletedFiber -) { - if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) - try { - injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); - } catch (err) {} - switch (deletedFiber.tag) { - case 26: - case 27: - case 5: - offscreenSubtreeWasHidden || - safelyDetachRef(deletedFiber, nearestMountedAncestor); + current = { + type: renderLanes, + props: newProps, + isHidden: !1, + children: [], + internalInstanceHandle: workInProgress, + rootContainerInstance: rootInstanceStackCursor.current, + tag: "INSTANCE" + }; + a: for (renderLanes = workInProgress.child; null !== renderLanes; ) { + if (5 === renderLanes.tag || 6 === renderLanes.tag) { + newProps = renderLanes.stateNode; + var index = current.children.indexOf(newProps); + -1 !== index && current.children.splice(index, 1); + current.children.push(newProps); + } else if (4 !== renderLanes.tag && null !== renderLanes.child) { + renderLanes.child.return = renderLanes; + renderLanes = renderLanes.child; + continue; + } + if (renderLanes === workInProgress) break a; + for (; null === renderLanes.sibling; ) { + if ( + null === renderLanes.return || + renderLanes.return === workInProgress + ) + break a; + renderLanes = renderLanes.return; + } + renderLanes.sibling.return = renderLanes.return; + renderLanes = renderLanes.sibling; + } + workInProgress.stateNode = current; + } + bubbleProperties(workInProgress); + workInProgress.flags &= -16777217; + return null; case 6: - var prevHostParent = hostParent; - hostParent = null; - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - hostParent = prevHostParent; - null !== hostParent && - ((finishedRoot = hostParent), - (deletedFiber = finishedRoot.children.indexOf(deletedFiber.stateNode)), - finishedRoot.children.splice(deletedFiber, 1)); - break; - case 18: - null !== hostParent && shim$1(); - break; - case 4: - prevHostParent = hostParent; - hostParent = deletedFiber.stateNode.containerInfo; - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - hostParent = prevHostParent; - break; - case 0: - case 11: - case 14: - case 15: - if ( - !offscreenSubtreeWasHidden && - ((prevHostParent = deletedFiber.updateQueue), - null !== prevHostParent && - ((prevHostParent = prevHostParent.lastEffect), - null !== prevHostParent)) - ) { - var effect = (prevHostParent = prevHostParent.next); - do { - var tag = effect.tag, - inst = effect.inst, - destroy = inst.destroy; - void 0 !== destroy && - (0 !== (tag & 2) - ? ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - )) - : 0 !== (tag & 4) && - ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - ))); - effect = effect.next; - } while (effect !== prevHostParent); + if (current && null != workInProgress.stateNode) + current.memoizedProps !== newProps && (workInProgress.flags |= 4); + else { + if ("string" !== typeof newProps && null === workInProgress.stateNode) + throw Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ); + workInProgress.stateNode = { + text: newProps, + isHidden: !1, + tag: "TEXT" + }; } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 1: + bubbleProperties(workInProgress); + return null; + case 13: + newProps = workInProgress.memoizedState; if ( - !offscreenSubtreeWasHidden && - (safelyDetachRef(deletedFiber, nearestMountedAncestor), - (prevHostParent = deletedFiber.stateNode), - "function" === typeof prevHostParent.componentWillUnmount) - ) - try { - (prevHostParent.props = deletedFiber.memoizedProps), - (prevHostParent.state = deletedFiber.memoizedState), - prevHostParent.componentWillUnmount(); - } catch (error) { - captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); + null === current || + (null !== current.memoizedState && + null !== current.memoizedState.dehydrated) + ) { + if (null !== newProps && null !== newProps.dehydrated) { + if (null === current) { + throw Error( + "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + ); + throw Error( + "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ); + } + 0 === (workInProgress.flags & 128) && + (workInProgress.memoizedState = null); + workInProgress.flags |= 4; + bubbleProperties(workInProgress); + index = !1; + } else + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), + (index = !0); + if (!index) { + if (workInProgress.flags & 256) + return popSuspenseHandler(workInProgress), workInProgress; + popSuspenseHandler(workInProgress); + return null; } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 21: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber + } + popSuspenseHandler(workInProgress); + if (0 !== (workInProgress.flags & 128)) + return (workInProgress.lanes = renderLanes), workInProgress; + renderLanes = null !== newProps; + current = null !== current && null !== current.memoizedState; + if (renderLanes) { + newProps = workInProgress.child; + index = null; + null !== newProps.alternate && + null !== newProps.alternate.memoizedState && + null !== newProps.alternate.memoizedState.cachePool && + (index = newProps.alternate.memoizedState.cachePool.pool); + var cache$67 = null; + null !== newProps.memoizedState && + null !== newProps.memoizedState.cachePool && + (cache$67 = newProps.memoizedState.cachePool.pool); + cache$67 !== index && (newProps.flags |= 2048); + } + renderLanes !== current && + renderLanes && + (workInProgress.child.flags |= 8192); + scheduleRetryEffect(workInProgress, workInProgress.updateQueue); + bubbleProperties(workInProgress); + return null; + case 4: + return popHostContainer(), bubbleProperties(workInProgress), null; + case 10: + return ( + popProvider(workInProgress.type._context), + bubbleProperties(workInProgress), + null ); - break; - case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); - deletedFiber.mode & 1 - ? ((offscreenSubtreeWasHidden = - (prevHostParent = offscreenSubtreeWasHidden) || - null !== deletedFiber.memoizedState), - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ), - (offscreenSubtreeWasHidden = prevHostParent)) - : recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - default: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber + case 17: + return ( + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null ); - } -} -function getRetryCache(finishedWork) { - switch (finishedWork.tag) { - case 13: case 19: - var retryCache = finishedWork.stateNode; - null === retryCache && - (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); - return retryCache; + pop(suspenseStackCursor); + index = workInProgress.memoizedState; + if (null === index) return bubbleProperties(workInProgress), null; + newProps = 0 !== (workInProgress.flags & 128); + cache$67 = index.rendering; + if (null === cache$67) + if (newProps) cutOffTailIfNeeded(index, !1); + else { + if ( + 0 !== workInProgressRootExitStatus || + (null !== current && 0 !== (current.flags & 128)) + ) + for (current = workInProgress.child; null !== current; ) { + cache$67 = findFirstSuspended(current); + if (null !== cache$67) { + workInProgress.flags |= 128; + cutOffTailIfNeeded(index, !1); + current = cache$67.updateQueue; + workInProgress.updateQueue = current; + scheduleRetryEffect(workInProgress, current); + workInProgress.subtreeFlags = 0; + current = renderLanes; + for (renderLanes = workInProgress.child; null !== renderLanes; ) + resetWorkInProgress(renderLanes, current), + (renderLanes = renderLanes.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & 1) | 2 + ); + return workInProgress.child; + } + current = current.sibling; + } + null !== index.tail && + now() > workInProgressRootRenderTargetTime && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(index, !1), + (workInProgress.lanes = 4194304)); + } + else { + if (!newProps) + if (((current = findFirstSuspended(cache$67)), null !== current)) { + if ( + ((workInProgress.flags |= 128), + (newProps = !0), + (current = current.updateQueue), + (workInProgress.updateQueue = current), + scheduleRetryEffect(workInProgress, current), + cutOffTailIfNeeded(index, !0), + null === index.tail && + "hidden" === index.tailMode && + !cache$67.alternate) + ) + return bubbleProperties(workInProgress), null; + } else + 2 * now() - index.renderingStartTime > + workInProgressRootRenderTargetTime && + 536870912 !== renderLanes && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(index, !1), + (workInProgress.lanes = 4194304)); + index.isBackwards + ? ((cache$67.sibling = workInProgress.child), + (workInProgress.child = cache$67)) + : ((current = index.last), + null !== current + ? (current.sibling = cache$67) + : (workInProgress.child = cache$67), + (index.last = cache$67)); + } + if (null !== index.tail) + return ( + (workInProgress = index.tail), + (index.rendering = workInProgress), + (index.tail = workInProgress.sibling), + (index.renderingStartTime = now()), + (workInProgress.sibling = null), + (current = suspenseStackCursor.current), + push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), + workInProgress + ); + bubbleProperties(workInProgress); + return null; case 22: + case 23: return ( - (finishedWork = finishedWork.stateNode), - (retryCache = finishedWork._retryCache), - null === retryCache && - (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), - retryCache + popSuspenseHandler(workInProgress), + popHiddenContext(), + (newProps = null !== workInProgress.memoizedState), + null !== current + ? (null !== current.memoizedState) !== newProps && + (workInProgress.flags |= 8192) + : newProps && (workInProgress.flags |= 8192), + newProps && 0 !== (workInProgress.mode & 1) + ? 0 !== (renderLanes & 536870912) && + 0 === (workInProgress.flags & 128) && + (bubbleProperties(workInProgress), + workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) + : bubbleProperties(workInProgress), + (renderLanes = workInProgress.updateQueue), + null !== renderLanes && + scheduleRetryEffect(workInProgress, renderLanes.retryQueue), + (renderLanes = null), + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (renderLanes = current.memoizedState.cachePool.pool), + (newProps = null), + null !== workInProgress.memoizedState && + null !== workInProgress.memoizedState.cachePool && + (newProps = workInProgress.memoizedState.cachePool.pool), + newProps !== renderLanes && (workInProgress.flags |= 2048), + null !== current && pop(resumedCache), + null ); - default: - throw Error( - "Unexpected Suspense handler tag (" + - finishedWork.tag + - "). This is a bug in React." + case 24: + return ( + (renderLanes = null), + null !== current && (renderLanes = current.memoizedState.cache), + workInProgress.memoizedState.cache !== renderLanes && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + bubbleProperties(workInProgress), + null ); + case 25: + return null; } + throw Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in React. Please file an issue." + ); } -function attachSuspenseRetryListeners(finishedWork, wakeables) { - var retryCache = getRetryCache(finishedWork); - wakeables.forEach(function (wakeable) { - var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); - retryCache.has(wakeable) || - (retryCache.add(wakeable), wakeable.then(retry, retry)); - }); -} -function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { - var deletions = parentFiber.deletions; - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - try { - var root = root$jscomp$0, - returnFiber = parentFiber, - parent = returnFiber; - a: for (; null !== parent; ) { - switch (parent.tag) { - case 27: - case 5: - hostParent = parent.stateNode; - break a; - case 3: - hostParent = parent.stateNode.containerInfo; - break a; - case 4: - hostParent = parent.stateNode.containerInfo; - break a; - } - parent = parent.return; - } - if (null === hostParent) - throw Error( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." - ); - commitDeletionEffectsOnFiber(root, returnFiber, childToDelete); - hostParent = null; - var alternate = childToDelete.alternate; - null !== alternate && (alternate.return = null); - childToDelete.return = null; - } catch (error) { - captureCommitPhaseError(childToDelete, parentFiber, error); - } - } - if (parentFiber.subtreeFlags & 12854) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), - (parentFiber = parentFiber.sibling); -} -function commitMutationEffectsOnFiber(finishedWork, root) { - var current = finishedWork.alternate, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - try { - commitHookEffectListUnmount(3, finishedWork, finishedWork.return), - commitHookEffectListMount(3, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - try { - commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$93) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$93); - } - } - break; +function unwindWork(current, workInProgress) { + switch (workInProgress.tag) { case 1: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - if ( - flags & 64 && - offscreenSubtreeIsHidden && - ((finishedWork = finishedWork.updateQueue), - null !== finishedWork && - ((flags = finishedWork.callbacks), null !== flags)) - ) { - var existingHiddenCallbacks = finishedWork.shared.hiddenCallbacks; - finishedWork.shared.hiddenCallbacks = - null === existingHiddenCallbacks - ? flags - : existingHiddenCallbacks.concat(flags); - } - break; + return ( + isContextProvider(workInProgress.type) && popContext(), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null + ); + case 3: + return ( + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + (current = workInProgress.flags), + 0 !== (current & 65536) && 0 === (current & 128) + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null + ); case 26: case 27: case 5: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && + return popHostContext(workInProgress), null; + case 13: + popSuspenseHandler(workInProgress); + current = workInProgress.memoizedState; + if ( null !== current && - safelyDetachRef(current, current.return); - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - existingHiddenCallbacks = finishedWork.memoizedProps; - var type = finishedWork.type; - finishedWork.updateQueue = null; - try { - (flags.type = type), (flags.props = existingHiddenCallbacks); - } catch (error$96) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$96); - } - } - break; - case 6: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - if (null === finishedWork.stateNode) - throw Error( - "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." - ); - flags = finishedWork.stateNode; - existingHiddenCallbacks = finishedWork.memoizedProps; - try { - flags.text = existingHiddenCallbacks; - } catch (error$97) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$97); - } - } + null !== current.dehydrated && + null === workInProgress.alternate + ) + throw Error( + "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." + ); + current = workInProgress.flags; + return current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null; + case 19: + return pop(suspenseStackCursor), null; + case 4: + return popHostContainer(), null; + case 10: + return popProvider(workInProgress.type._context), null; + case 22: + case 23: + return ( + popSuspenseHandler(workInProgress), + popHiddenContext(), + null !== current && pop(resumedCache), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null + ); + case 24: + return popProvider(CacheContext), null; + case 25: + return null; + default: + return null; + } +} +function unwindInterruptedWork(current, interruptedWork) { + switch (interruptedWork.tag) { + case 1: + current = interruptedWork.type.childContextTypes; + null !== current && void 0 !== current && popContext(); break; case 3: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); + popProvider(CacheContext); + popHostContainer(); + pop(didPerformWorkStackCursor); + pop(contextStackCursor$1); + break; + case 26: + case 27: + case 5: + popHostContext(interruptedWork); break; case 4: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); + popHostContainer(); break; case 13: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - finishedWork.child.flags & 8192 && - (null !== finishedWork.memoizedState) !== - (null !== current && null !== current.memoizedState) && - (globalMostRecentFallbackTime = now()); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); + popSuspenseHandler(interruptedWork); + break; + case 19: + pop(suspenseStackCursor); + break; + case 10: + popProvider(interruptedWork.type._context); break; case 22: - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - existingHiddenCallbacks = null !== finishedWork.memoizedState; - var wasHidden = null !== current && null !== current.memoizedState; - if (finishedWork.mode & 1) { - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = - prevOffscreenSubtreeIsHidden || existingHiddenCallbacks; - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || wasHidden; - recursivelyTraverseMutationEffects(root, finishedWork); - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - } else recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - root = finishedWork.stateNode; - root._current = finishedWork; - root._visibility &= -3; - root._visibility |= root._pendingVisibility & 2; - if ( - flags & 8192 && - ((root._visibility = existingHiddenCallbacks - ? root._visibility & -2 - : root._visibility | 1), - existingHiddenCallbacks && - ((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), - null === current || - wasHidden || - root || - (0 !== (finishedWork.mode & 1) && - recursivelyTraverseDisappearLayoutEffects(finishedWork))), - null === finishedWork.memoizedProps || - "manual" !== finishedWork.memoizedProps.mode) - ) - a: for (current = null, wasHidden = finishedWork; ; ) { - if (5 === wasHidden.tag) { - if (null === current) { - current = wasHidden; - try { - (type = wasHidden.stateNode), - existingHiddenCallbacks - ? (type.isHidden = !0) - : (wasHidden.stateNode.isHidden = !1); - } catch (error) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error - ); - } - } - } else if (6 === wasHidden.tag) { - if (null === current) - try { - wasHidden.stateNode.isHidden = existingHiddenCallbacks - ? !0 - : !1; - } catch (error$87) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$87 - ); - } - } else if ( - ((22 !== wasHidden.tag && 23 !== wasHidden.tag) || - null === wasHidden.memoizedState || - wasHidden === finishedWork) && - null !== wasHidden.child - ) { - wasHidden.child.return = wasHidden; - wasHidden = wasHidden.child; - continue; - } - if (wasHidden === finishedWork) break a; - for (; null === wasHidden.sibling; ) { - if (null === wasHidden.return || wasHidden.return === finishedWork) - break a; - current === wasHidden && (current = null); - wasHidden = wasHidden.return; - } - current === wasHidden && (current = null); - wasHidden.sibling.return = wasHidden.return; - wasHidden = wasHidden.sibling; - } - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((existingHiddenCallbacks = flags.retryQueue), - null !== existingHiddenCallbacks && - ((flags.retryQueue = null), - attachSuspenseRetryListeners( - finishedWork, - existingHiddenCallbacks - )))); - break; - case 19: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); - break; - case 21: + case 23: + popSuspenseHandler(interruptedWork); + popHiddenContext(); + null !== current && pop(resumedCache); break; - default: - recursivelyTraverseMutationEffects(root, finishedWork), - commitReconciliationEffects(finishedWork); + case 24: + popProvider(CacheContext); } } -function commitReconciliationEffects(finishedWork) { - var flags = finishedWork.flags; - if (flags & 2) { - try { - a: { - for (var parent = finishedWork.return; null !== parent; ) { - if (isHostParent(parent)) { - var JSCompiler_inline_result = parent; - break a; - } - parent = parent.return; - } - throw Error( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." - ); - } - switch (JSCompiler_inline_result.tag) { +var offscreenSubtreeIsHidden = !1, + offscreenSubtreeWasHidden = !1, + PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, + nextEffect = null; +function safelyAttachRef(current, nearestMountedAncestor) { + try { + var ref = current.ref; + if (null !== ref) { + var instance = current.stateNode; + switch (current.tag) { + case 26: case 27: case 5: - var parent$jscomp$0 = JSCompiler_inline_result.stateNode; - JSCompiler_inline_result.flags & 32 && - (JSCompiler_inline_result.flags &= -33); - var before = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); - break; - case 3: - case 4: - var parent$88 = JSCompiler_inline_result.stateNode.containerInfo, - before$89 = getHostSibling(finishedWork); - insertOrAppendPlacementNodeIntoContainer( - finishedWork, - before$89, - parent$88 - ); + var instanceToUse = getPublicInstance(instance); break; default: - throw Error( - "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." - ); + instanceToUse = instance; } - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); + "function" === typeof ref + ? (current.refCleanup = ref(instanceToUse)) + : (ref.current = instanceToUse); } - finishedWork.flags &= -3; + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); } - flags & 4096 && (finishedWork.flags &= -4097); } -function recursivelyTraverseLayoutEffects(root, parentFiber) { - if (parentFiber.subtreeFlags & 8772) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), - (parentFiber = parentFiber.sibling); +function safelyDetachRef(current, nearestMountedAncestor) { + var ref = current.ref, + refCleanup = current.refCleanup; + if (null !== ref) + if ("function" === typeof refCleanup) + try { + refCleanup(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } finally { + (current.refCleanup = null), + (current = current.alternate), + null != current && (current.refCleanup = null); + } + else if ("function" === typeof ref) + try { + ref(null); + } catch (error$83) { + captureCommitPhaseError(current, nearestMountedAncestor, error$83); + } + else ref.current = null; } -function recursivelyTraverseDisappearLayoutEffects(parentFiber) { - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedWork = parentFiber; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - commitHookEffectListUnmount(4, finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 1: - safelyDetachRef(finishedWork, finishedWork.return); - var instance = finishedWork.stateNode; - if ("function" === typeof instance.componentWillUnmount) { - var current = finishedWork, - nearestMountedAncestor = finishedWork.return; - try { - var current$jscomp$0 = current; - instance.props = current$jscomp$0.memoizedProps; - instance.state = current$jscomp$0.memoizedState; - instance.componentWillUnmount(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } - } - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 26: - case 27: - case 5: - safelyDetachRef(finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 22: - safelyDetachRef(finishedWork, finishedWork.return); - null === finishedWork.memoizedState && - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - default: - recursivelyTraverseDisappearLayoutEffects(finishedWork); - } - parentFiber = parentFiber.sibling; +function safelyCallDestroy(current, nearestMountedAncestor, destroy) { + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); } } -function recursivelyTraverseReappearLayoutEffects( - finishedRoot$jscomp$0, - parentFiber, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - commitHookLayoutEffects(finishedWork, 4); - break; - case 1: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - var instance = finishedWork.stateNode; - if ("function" === typeof instance.componentDidMount) - try { - instance.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - finishedRoot = finishedWork.updateQueue; - if (null !== finishedRoot) { - var hiddenCallbacks = finishedRoot.shared.hiddenCallbacks; - if (null !== hiddenCallbacks) - for ( - finishedRoot.shared.hiddenCallbacks = null, finishedRoot = 0; - finishedRoot < hiddenCallbacks.length; - finishedRoot++ - ) - callCallback(hiddenCallbacks[finishedRoot], instance); +var shouldFireAfterActiveInstanceBlur = !1; +function commitBeforeMutationEffects(root, firstChild) { + for (nextEffect = firstChild; null !== nextEffect; ) + if ( + ((root = nextEffect), + (firstChild = root.child), + 0 !== (root.subtreeFlags & 1028) && null !== firstChild) + ) + (firstChild.return = root), (nextEffect = firstChild); + else + for (; null !== nextEffect; ) { + root = nextEffect; + try { + var current = root.alternate, + flags = root.flags; + switch (root.tag) { + case 0: + break; + case 11: + case 15: + break; + case 1: + if (0 !== (flags & 1024) && null !== current) { + var prevProps = current.memoizedProps, + prevState = current.memoizedState, + instance = root.stateNode, + snapshot = instance.getSnapshotBeforeUpdate( + root.elementType === root.type + ? prevProps + : resolveDefaultProps(root.type, prevProps), + prevState + ); + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + } + break; + case 3: + 0 !== (flags & 1024) && + root.stateNode.containerInfo.children.splice(0); + break; + case 5: + case 26: + case 27: + case 6: + case 4: + case 17: + break; + default: + if (0 !== (flags & 1024)) + throw Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ); + } + } catch (error) { + captureCommitPhaseError(root, root.return, error); } - includeWorkInProgressEffects && - flags & 64 && - commitClassCallbacks(finishedWork); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 26: - case 27: - case 5: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - break; - case 13: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - break; - case 22: - null === finishedWork.memoizedState && - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - default: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - } - parentFiber = parentFiber.sibling; + firstChild = root.sibling; + if (null !== firstChild) { + firstChild.return = root.return; + nextEffect = firstChild; + break; + } + nextEffect = root.return; + } + current = shouldFireAfterActiveInstanceBlur; + shouldFireAfterActiveInstanceBlur = !1; + return current; +} +function commitHookEffectListUnmount( + flags, + finishedWork, + nearestMountedAncestor +) { + var updateQueue = finishedWork.updateQueue; + updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; + if (null !== updateQueue) { + var effect = (updateQueue = updateQueue.next); + do { + if ((effect.tag & flags) === flags) { + var inst = effect.inst, + destroy = inst.destroy; + void 0 !== destroy && + ((inst.destroy = void 0), + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy)); + } + effect = effect.next; + } while (effect !== updateQueue); } } -function commitHookPassiveMountEffects(finishedWork, hookFlags) { +function commitHookEffectListMount(flags, finishedWork) { + finishedWork = finishedWork.updateQueue; + finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; + if (null !== finishedWork) { + var effect = (finishedWork = finishedWork.next); + do { + if ((effect.tag & flags) === flags) { + var create$84 = effect.create, + inst = effect.inst; + create$84 = create$84(); + inst.destroy = create$84; + } + effect = effect.next; + } while (effect !== finishedWork); + } +} +function commitHookLayoutEffects(finishedWork, hookFlags) { try { commitHookEffectListMount(hookFlags, finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } } -function commitOffscreenPassiveMountEffects(current, finishedWork) { - var previousCache = null; - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (previousCache = current.memoizedState.cachePool.pool); - current = null; - null !== finishedWork.memoizedState && - null !== finishedWork.memoizedState.cachePool && - (current = finishedWork.memoizedState.cachePool.pool); - current !== previousCache && - (null != current && current.refCount++, - null != previousCache && releaseCache(previousCache)); -} -function commitCachePassiveMountEffect(current, finishedWork) { - current = null; - null !== finishedWork.alternate && - (current = finishedWork.alternate.memoizedState.cache); - finishedWork = finishedWork.memoizedState.cache; - finishedWork !== current && - (finishedWork.refCount++, null != current && releaseCache(current)); -} -function recursivelyTraversePassiveMountEffects( - root, - parentFiber, - committedLanes, - committedTransitions -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveMountOnFiber( - root, - parentFiber, - committedLanes, - committedTransitions - ), - (parentFiber = parentFiber.sibling); +function commitClassCallbacks(finishedWork) { + var updateQueue = finishedWork.updateQueue; + if (null !== updateQueue) { + var instance = finishedWork.stateNode; + try { + commitCallbacks(updateQueue, instance); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + } } -function commitPassiveMountOnFiber( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions -) { +function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { var flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 4 && commitHookLayoutEffects(finishedWork, 5); + break; + case 1: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 4) + if (((finishedRoot = finishedWork.stateNode), null === current)) + try { + finishedRoot.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + else { + var prevProps = + finishedWork.elementType === finishedWork.type + ? current.memoizedProps + : resolveDefaultProps(finishedWork.type, current.memoizedProps); + current = current.memoizedState; + try { + finishedRoot.componentDidUpdate( + prevProps, + current, + finishedRoot.__reactInternalSnapshotBeforeUpdate + ); + } catch (error$85) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$85 + ); + } + } + flags & 64 && commitClassCallbacks(finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; case 3: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - ((finishedRoot = null), - null !== finishedWork.alternate && - (finishedRoot = finishedWork.alternate.memoizedState.cache), - (finishedWork = finishedWork.memoizedState.cache), - finishedWork !== finishedRoot && - (finishedWork.refCount++, - null != finishedRoot && releaseCache(finishedRoot))); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { + finishedRoot = null; + if (null !== finishedWork.child) + switch (finishedWork.child.tag) { + case 27: + case 5: + finishedRoot = getPublicInstance(finishedWork.child.stateNode); + break; + case 1: + finishedRoot = finishedWork.child.stateNode; + } + try { + commitCallbacks(flags, finishedRoot); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + } break; - case 23: + case 26: + case 27: + case 5: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) - : ((instance._visibility |= 4), - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - )) - : instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - 0 !== (finishedWork.subtreeFlags & 10256) - )); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); + case 12: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); break; - case 24: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + case 13: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); break; - default: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - } -} -function recursivelyTraverseReconnectPassiveEffects( - finishedRoot$jscomp$0, - parentFiber, - committedLanes$jscomp$0, - committedTransitions$jscomp$0, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - committedLanes = committedLanes$jscomp$0, - committedTransitions = committedTransitions$jscomp$0, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - commitHookPassiveMountEffects(finishedWork, 8); - break; - case 23: - break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraverseReconnectPassiveEffects( + case 22: + if (0 !== (finishedWork.mode & 1)) { + if ( + ((prevProps = + null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), + !prevProps) + ) { + current = + (null !== current && null !== current.memoizedState) || + offscreenSubtreeWasHidden; + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevProps; + (offscreenSubtreeWasHidden = current) && + !prevOffscreenSubtreeWasHidden + ? recursivelyTraverseReappearLayoutEffects( finishedRoot, finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects( - finishedRoot, - finishedWork + 0 !== (finishedWork.subtreeFlags & 8772) ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )); - includeWorkInProgressEffects && - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - } - parentFiber = parentFiber.sibling; + : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + } + } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 512 && + ("manual" === finishedWork.memoizedProps.mode + ? safelyAttachRef(finishedWork, finishedWork.return) + : safelyDetachRef(finishedWork, finishedWork.return)); + break; + default: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); } } -function recursivelyTraverseAtomicPassiveEffects( - finishedRoot$jscomp$0, - parentFiber -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 22: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - } - parentFiber = parentFiber.sibling; - } +function detachFiberAfterEffects(fiber) { + var alternate = fiber.alternate; + null !== alternate && + ((fiber.alternate = null), detachFiberAfterEffects(alternate)); + fiber.child = null; + fiber.deletions = null; + fiber.sibling = null; + fiber.stateNode = null; + fiber.return = null; + fiber.dependencies = null; + fiber.memoizedProps = null; + fiber.memoizedState = null; + fiber.pendingProps = null; + fiber.stateNode = null; + fiber.updateQueue = null; } -var suspenseyCommitFlag = 8192; -function recursivelyAccumulateSuspenseyCommit(parentFiber) { - if (parentFiber.subtreeFlags & suspenseyCommitFlag) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - accumulateSuspenseyCommitOnFiber(parentFiber), - (parentFiber = parentFiber.sibling); +function isHostParent(fiber) { + return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; } -function accumulateSuspenseyCommitOnFiber(fiber) { - switch (fiber.tag) { +function getHostSibling(fiber) { + a: for (;;) { + for (; null === fiber.sibling; ) { + if (null === fiber.return || isHostParent(fiber.return)) return null; + fiber = fiber.return; + } + fiber.sibling.return = fiber.return; + for ( + fiber = fiber.sibling; + 5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag; + + ) { + if (fiber.flags & 2) continue a; + if (null === fiber.child || 4 === fiber.tag) continue a; + else (fiber.child.return = fiber), (fiber = fiber.child); + } + if (!(fiber.flags & 2)) return fiber.stateNode; + } +} +function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { + var tag = node.tag; + if (5 === tag || 6 === tag) + (node = node.stateNode), + before ? insertBefore(parent, node, before) : appendChild(parent, node); + else if (4 !== tag && ((node = node.child), null !== node)) + for ( + insertOrAppendPlacementNodeIntoContainer(node, before, parent), + node = node.sibling; + null !== node; + + ) + insertOrAppendPlacementNodeIntoContainer(node, before, parent), + (node = node.sibling); +} +function insertOrAppendPlacementNode(node, before, parent) { + var tag = node.tag; + if (5 === tag || 6 === tag) + (node = node.stateNode), + before ? insertBefore(parent, node, before) : appendChild(parent, node); + else if (4 !== tag && ((node = node.child), null !== node)) + for ( + insertOrAppendPlacementNode(node, before, parent), node = node.sibling; + null !== node; + + ) + insertOrAppendPlacementNode(node, before, parent), (node = node.sibling); +} +var hostParent = null; +function recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + parent +) { + for (parent = parent.child; null !== parent; ) + commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), + (parent = parent.sibling); +} +function commitDeletionEffectsOnFiber( + finishedRoot, + nearestMountedAncestor, + deletedFiber +) { + if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) + try { + injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); + } catch (err) {} + switch (deletedFiber.tag) { case 26: - recursivelyAccumulateSuspenseyCommit(fiber); - if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) - throw Error( - "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." - ); - break; + case 27: case 5: - recursivelyAccumulateSuspenseyCommit(fiber); + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); + case 6: + var prevHostParent = hostParent; + hostParent = null; + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + hostParent = prevHostParent; + null !== hostParent && + ((finishedRoot = hostParent), + (deletedFiber = finishedRoot.children.indexOf(deletedFiber.stateNode)), + finishedRoot.children.splice(deletedFiber, 1)); break; - case 3: - case 4: - recursivelyAccumulateSuspenseyCommit(fiber); + case 18: + null !== hostParent && shim$1(); break; - case 22: - if (null === fiber.memoizedState) { - var current = fiber.alternate; - null !== current && null !== current.memoizedState - ? ((current = suspenseyCommitFlag), - (suspenseyCommitFlag = 16777216), - recursivelyAccumulateSuspenseyCommit(fiber), - (suspenseyCommitFlag = current)) - : recursivelyAccumulateSuspenseyCommit(fiber); - } + case 4: + prevHostParent = hostParent; + hostParent = deletedFiber.stateNode.containerInfo; + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + hostParent = prevHostParent; break; - default: - recursivelyAccumulateSuspenseyCommit(fiber); - } -} -function detachAlternateSiblings(parentFiber) { - var previousFiber = parentFiber.alternate; - if ( - null !== previousFiber && - ((parentFiber = previousFiber.child), null !== parentFiber) - ) { - previousFiber.child = null; - do - (previousFiber = parentFiber.sibling), - (parentFiber.sibling = null), - (parentFiber = previousFiber); - while (null !== parentFiber); - } -} -function recursivelyTraversePassiveUnmountEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); - } - detachAlternateSiblings(parentFiber); - } - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveUnmountOnFiber(parentFiber), - (parentFiber = parentFiber.sibling); -} -function commitPassiveUnmountOnFiber(finishedWork) { - switch (finishedWork.tag) { case 0: case 11: + case 14: case 15: - recursivelyTraversePassiveUnmountEffects(finishedWork); - finishedWork.flags & 2048 && - commitHookEffectListUnmount(9, finishedWork, finishedWork.return); + if ( + !offscreenSubtreeWasHidden && + ((prevHostParent = deletedFiber.updateQueue), + null !== prevHostParent && + ((prevHostParent = prevHostParent.lastEffect), + null !== prevHostParent)) + ) { + var effect = (prevHostParent = prevHostParent.next); + do { + var tag = effect.tag, + inst = effect.inst, + destroy = inst.destroy; + void 0 !== destroy && + (0 !== (tag & 2) + ? ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + )) + : 0 !== (tag & 4) && + ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + ))); + effect = effect.next; + } while (effect !== prevHostParent); + } + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + case 1: + if ( + !offscreenSubtreeWasHidden && + (safelyDetachRef(deletedFiber, nearestMountedAncestor), + (prevHostParent = deletedFiber.stateNode), + "function" === typeof prevHostParent.componentWillUnmount) + ) + try { + (prevHostParent.props = deletedFiber.memoizedProps), + (prevHostParent.state = deletedFiber.memoizedState), + prevHostParent.componentWillUnmount(); + } catch (error) { + captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); + } + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + case 21: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); break; case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState && - instance._visibility & 4 && - (null === finishedWork.return || 13 !== finishedWork.return.tag) - ? ((instance._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(finishedWork)) - : recursivelyTraversePassiveUnmountEffects(finishedWork); + safelyDetachRef(deletedFiber, nearestMountedAncestor); + deletedFiber.mode & 1 + ? ((offscreenSubtreeWasHidden = + (prevHostParent = offscreenSubtreeWasHidden) || + null !== deletedFiber.memoizedState), + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ), + (offscreenSubtreeWasHidden = prevHostParent)) + : recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); break; default: - recursivelyTraversePassiveUnmountEffects(finishedWork); + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); } } -function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); - } - detachAlternateSiblings(parentFiber); - } - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - deletions = parentFiber; - switch (deletions.tag) { - case 0: - case 11: - case 15: - commitHookEffectListUnmount(8, deletions, deletions.return); - recursivelyTraverseDisconnectPassiveEffects(deletions); - break; - case 22: - i = deletions.stateNode; - i._visibility & 4 && - ((i._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(deletions)); - break; - default: - recursivelyTraverseDisconnectPassiveEffects(deletions); - } - parentFiber = parentFiber.sibling; +function getRetryCache(finishedWork) { + switch (finishedWork.tag) { + case 13: + case 19: + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); + return retryCache; + case 22: + return ( + (finishedWork = finishedWork.stateNode), + (retryCache = finishedWork._retryCache), + null === retryCache && + (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), + retryCache + ); + default: + throw Error( + "Unexpected Suspense handler tag (" + + finishedWork.tag + + "). This is a bug in React." + ); } } -function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - deletedSubtreeRoot, - nearestMountedAncestor -) { - for (; null !== nextEffect; ) { - var fiber = nextEffect; - switch (fiber.tag) { - case 0: - case 11: - case 15: - commitHookEffectListUnmount(8, fiber, nearestMountedAncestor); - break; - case 23: - case 22: - if ( - null !== fiber.memoizedState && - null !== fiber.memoizedState.cachePool - ) { - var cache = fiber.memoizedState.cachePool.pool; - null != cache && cache.refCount++; +function attachSuspenseRetryListeners(finishedWork, wakeables) { + var retryCache = getRetryCache(finishedWork); + wakeables.forEach(function (wakeable) { + var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); + retryCache.has(wakeable) || + (retryCache.add(wakeable), wakeable.then(retry, retry)); + }); +} +function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { + var deletions = parentFiber.deletions; + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + try { + var root = root$jscomp$0, + returnFiber = parentFiber, + parent = returnFiber; + a: for (; null !== parent; ) { + switch (parent.tag) { + case 27: + case 5: + hostParent = parent.stateNode; + break a; + case 3: + hostParent = parent.stateNode.containerInfo; + break a; + case 4: + hostParent = parent.stateNode.containerInfo; + break a; + } + parent = parent.return; } - break; - case 24: - releaseCache(fiber.memoizedState.cache); + if (null === hostParent) + throw Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ); + commitDeletionEffectsOnFiber(root, returnFiber, childToDelete); + hostParent = null; + var alternate = childToDelete.alternate; + null !== alternate && (alternate.return = null); + childToDelete.return = null; + } catch (error) { + captureCommitPhaseError(childToDelete, parentFiber, error); + } } - cache = fiber.child; - if (null !== cache) (cache.return = fiber), (nextEffect = cache); - else - a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { - cache = nextEffect; - var sibling = cache.sibling, - returnFiber = cache.return; - detachFiberAfterEffects(cache); - if (cache === fiber) { - nextEffect = null; - break a; + if (parentFiber.subtreeFlags & 12854) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), + (parentFiber = parentFiber.sibling); +} +function commitMutationEffectsOnFiber(finishedWork, root) { + var current = finishedWork.alternate, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + try { + commitHookEffectListUnmount(3, finishedWork, finishedWork.return), + commitHookEffectListMount(3, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); } - if (null !== sibling) { - sibling.return = returnFiber; - nextEffect = sibling; - break a; + try { + commitHookEffectListUnmount(5, finishedWork, finishedWork.return); + } catch (error$93) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$93); } - nextEffect = returnFiber; } - } -} -var DefaultCacheDispatcher = { - getCacheSignal: function () { - return readContext(CacheContext).controller.signal; - }, - getCacheForType: function (resourceType) { - var cache = readContext(CacheContext), - cacheForType = cache.data.get(resourceType); - void 0 === cacheForType && - ((cacheForType = resourceType()), - cache.data.set(resourceType, cacheForType)); - return cacheForType; - } - }, - PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, - executionContext = 0, - workInProgressRoot = null, - workInProgress = null, - workInProgressRootRenderLanes = 0, - workInProgressSuspendedReason = 0, - workInProgressThrownValue = null, - workInProgressRootDidAttachPingListener = !1, - entangledRenderLanes = 0, - workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, - workInProgressRootSkippedLanes = 0, - workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootPingedLanes = 0, - workInProgressDeferredLane = 0, - workInProgressRootConcurrentErrors = null, - workInProgressRootRecoverableErrors = null, - workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - globalMostRecentFallbackTime = 0, - workInProgressRootRenderTargetTime = Infinity, - workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, - legacyErrorBoundariesThatAlreadyFailed = null, - rootDoesHavePassiveEffects = !1, - rootWithPendingPassiveEffects = null, - pendingPassiveEffectsLanes = 0, - pendingPassiveEffectsRemainingLanes = 0, - pendingPassiveTransitions = null, - nestedUpdateCount = 0, - rootWithNestedUpdates = null; -function requestUpdateLane(fiber) { - if (0 === (fiber.mode & 1)) return 2; - if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) - return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== requestCurrentTransition()) - return ( - (fiber = currentEntangledLane), - 0 !== fiber ? fiber : requestTransitionLane() - ); - fiber = currentUpdatePriority; - return 0 !== fiber ? fiber : 32; -} -function requestDeferredLane() { - 0 === workInProgressDeferredLane && - (workInProgressDeferredLane = - 0 !== (workInProgressRootRenderLanes & 536870912) - ? 536870912 - : claimNextTransitionLane()); - var suspenseHandler = suspenseHandlerStackCursor.current; - null !== suspenseHandler && (suspenseHandler.flags |= 32); - return workInProgressDeferredLane; -} -function scheduleUpdateOnFiber(root, fiber, lane) { - if ( - (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || - null !== root.cancelPendingCommit - ) - prepareFreshStack(root, 0), - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); - markRootUpdated$1(root, lane); - if (0 === (executionContext & 2) || root !== workInProgressRoot) - root === workInProgressRoot && - (0 === (executionContext & 2) && - (workInProgressRootInterleavedUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - )), - ensureRootIsScheduled(root), - 2 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now() + 500), - flushSyncWorkAcrossRoots_impl(!0)); -} -function performConcurrentWorkOnRoot(root, didTimeout) { - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var originalCallbackNode = root.callbackNode; - if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) - return null; - var lanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes : 0 - ); - if (0 === lanes) return null; - var shouldTimeSlice = - !includesBlockingLane(root, lanes) && - 0 === (lanes & root.expiredLanes) && - !didTimeout; - didTimeout = shouldTimeSlice - ? renderRootConcurrent(root, lanes) - : renderRootSync(root, lanes); - if (0 !== didTimeout) { - var renderWasConcurrent = shouldTimeSlice; - do { - if (6 === didTimeout) markRootSuspended(root, lanes, 0); - else { - shouldTimeSlice = root.current.alternate; - if ( - renderWasConcurrent && - !isRenderConsistentWithExternalStores(shouldTimeSlice) - ) { - didTimeout = renderRootSync(root, lanes); - renderWasConcurrent = !1; - continue; + break; + case 1: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + if ( + flags & 64 && + offscreenSubtreeIsHidden && + ((finishedWork = finishedWork.updateQueue), + null !== finishedWork && + ((flags = finishedWork.callbacks), null !== flags)) + ) { + var existingHiddenCallbacks = finishedWork.shared.hiddenCallbacks; + finishedWork.shared.hiddenCallbacks = + null === existingHiddenCallbacks + ? flags + : existingHiddenCallbacks.concat(flags); + } + break; + case 26: + case 27: + case 5: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { + existingHiddenCallbacks = finishedWork.memoizedProps; + var type = finishedWork.type; + finishedWork.updateQueue = null; + try { + (flags.type = type), (flags.props = existingHiddenCallbacks); + } catch (error$96) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$96); } - if (2 === didTimeout) { - renderWasConcurrent = lanes; - var errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - renderWasConcurrent + } + break; + case 6: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + if (null === finishedWork.stateNode) + throw Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." ); - 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), - (didTimeout = recoverFromConcurrentError( - root, - renderWasConcurrent, - errorRetryLanes - ))); + flags = finishedWork.stateNode; + existingHiddenCallbacks = finishedWork.memoizedProps; + try { + flags.text = existingHiddenCallbacks; + } catch (error$97) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$97); } - if (1 === didTimeout) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); - root.finishedWork = shouldTimeSlice; - root.finishedLanes = lanes; - a: { - renderWasConcurrent = root; - switch (didTimeout) { - case 0: - case 1: - throw Error("Root did not complete. This is a bug in React."); - case 4: - if ((lanes & 4194176) === lanes) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane + } + break; + case 3: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 4: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 13: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + finishedWork.child.flags & 8192 && + (null !== finishedWork.memoizedState) !== + (null !== current && null !== current.memoizedState) && + (globalMostRecentFallbackTime = now()); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); + break; + case 22: + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + existingHiddenCallbacks = null !== finishedWork.memoizedState; + var wasHidden = null !== current && null !== current.memoizedState; + if (finishedWork.mode & 1) { + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = + prevOffscreenSubtreeIsHidden || existingHiddenCallbacks; + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || wasHidden; + recursivelyTraverseMutationEffects(root, finishedWork); + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + } else recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + root = finishedWork.stateNode; + root._current = finishedWork; + root._visibility &= -3; + root._visibility |= root._pendingVisibility & 2; + if ( + flags & 8192 && + ((root._visibility = existingHiddenCallbacks + ? root._visibility & -2 + : root._visibility | 1), + existingHiddenCallbacks && + ((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), + null === current || + wasHidden || + root || + (0 !== (finishedWork.mode & 1) && + recursivelyTraverseDisappearLayoutEffects(finishedWork))), + null === finishedWork.memoizedProps || + "manual" !== finishedWork.memoizedProps.mode) + ) + a: for (current = null, wasHidden = finishedWork; ; ) { + if (5 === wasHidden.tag) { + if (null === current) { + current = wasHidden; + try { + (type = wasHidden.stateNode), + existingHiddenCallbacks + ? (type.isHidden = !0) + : (wasHidden.stateNode.isHidden = !1); + } catch (error) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error ); - break a; } - break; - case 2: - case 3: - case 5: - break; - default: - throw Error("Unknown root exit status."); - } - if ( - (lanes & 62914560) === lanes && - ((didTimeout = globalMostRecentFallbackTime + 300 - now()), - 10 < didTimeout) + } + } else if (6 === wasHidden.tag) { + if (null === current) + try { + wasHidden.stateNode.isHidden = existingHiddenCallbacks + ? !0 + : !1; + } catch (error$87) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$87 + ); + } + } else if ( + ((22 !== wasHidden.tag && 23 !== wasHidden.tag) || + null === wasHidden.memoizedState || + wasHidden === finishedWork) && + null !== wasHidden.child ) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( - commitRootWhenReady.bind( - null, - renderWasConcurrent, - shouldTimeSlice, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane - ), - didTimeout - ); - break a; + wasHidden.child.return = wasHidden; + wasHidden = wasHidden.child; + continue; } - commitRootWhenReady( - renderWasConcurrent, - shouldTimeSlice, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane - ); + if (wasHidden === finishedWork) break a; + for (; null === wasHidden.sibling; ) { + if (null === wasHidden.return || wasHidden.return === finishedWork) + break a; + current === wasHidden && (current = null); + wasHidden = wasHidden.return; + } + current === wasHidden && (current = null); + wasHidden.sibling.return = wasHidden.return; + wasHidden = wasHidden.sibling; } - } + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((existingHiddenCallbacks = flags.retryQueue), + null !== existingHiddenCallbacks && + ((flags.retryQueue = null), + attachSuspenseRetryListeners( + finishedWork, + existingHiddenCallbacks + )))); break; - } while (1); + case 19: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); + break; + case 21: + break; + default: + recursivelyTraverseMutationEffects(root, finishedWork), + commitReconciliationEffects(finishedWork); } - ensureRootIsScheduled(root); - scheduleTaskForRootDuringMicrotask(root, now()); - root = - root.callbackNode === originalCallbackNode - ? performConcurrentWorkOnRoot.bind(null, root) - : null; - return root; } -function recoverFromConcurrentError( - root, - originallyAttemptedLanes, - errorRetryLanes -) { - var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, - JSCompiler_inline_result; - (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && - (prepareFreshStack(root, errorRetryLanes).flags |= 256); - errorRetryLanes = renderRootSync(root, errorRetryLanes); - if (2 !== errorRetryLanes) { - if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) - return ( - (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), - (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), - 4 - ); - root = workInProgressRootRecoverableErrors; - workInProgressRootRecoverableErrors = errorsFromFirstAttempt; - null !== root && queueRecoverableErrors(root); +function commitReconciliationEffects(finishedWork) { + var flags = finishedWork.flags; + if (flags & 2) { + try { + a: { + for (var parent = finishedWork.return; null !== parent; ) { + if (isHostParent(parent)) { + var JSCompiler_inline_result = parent; + break a; + } + parent = parent.return; + } + throw Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ); + } + switch (JSCompiler_inline_result.tag) { + case 27: + case 5: + var parent$jscomp$0 = JSCompiler_inline_result.stateNode; + JSCompiler_inline_result.flags & 32 && + (JSCompiler_inline_result.flags &= -33); + var before = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); + break; + case 3: + case 4: + var parent$88 = JSCompiler_inline_result.stateNode.containerInfo, + before$89 = getHostSibling(finishedWork); + insertOrAppendPlacementNodeIntoContainer( + finishedWork, + before$89, + parent$88 + ); + break; + default: + throw Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ); + } + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + finishedWork.flags &= -3; } - return errorRetryLanes; -} -function queueRecoverableErrors(errors) { - null === workInProgressRootRecoverableErrors - ? (workInProgressRootRecoverableErrors = errors) - : workInProgressRootRecoverableErrors.push.apply( - workInProgressRootRecoverableErrors, - errors - ); + flags & 4096 && (finishedWork.flags &= -4097); } -function commitRootWhenReady( - root, - finishedWork, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - lanes, - spawnedLane -) { - 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); - commitRoot( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane - ); +function recursivelyTraverseLayoutEffects(root, parentFiber) { + if (parentFiber.subtreeFlags & 8772) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), + (parentFiber = parentFiber.sibling); } -function isRenderConsistentWithExternalStores(finishedWork) { - for (var node = finishedWork; ; ) { - if (node.flags & 16384) { - var updateQueue = node.updateQueue; - if ( - null !== updateQueue && - ((updateQueue = updateQueue.stores), null !== updateQueue) - ) - for (var i = 0; i < updateQueue.length; i++) { - var check = updateQueue[i], - getSnapshot = check.getSnapshot; - check = check.value; +function recursivelyTraverseDisappearLayoutEffects(parentFiber) { + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedWork = parentFiber; + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + commitHookEffectListUnmount(4, finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 1: + safelyDetachRef(finishedWork, finishedWork.return); + var instance = finishedWork.stateNode; + if ("function" === typeof instance.componentWillUnmount) { + var current = finishedWork, + nearestMountedAncestor = finishedWork.return; try { - if (!objectIs(getSnapshot(), check)) return !1; + var current$jscomp$0 = current; + instance.props = current$jscomp$0.memoizedProps; + instance.state = current$jscomp$0.memoizedState; + instance.componentWillUnmount(); } catch (error) { - return !1; + captureCommitPhaseError(current, nearestMountedAncestor, error); } } + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 26: + case 27: + case 5: + safelyDetachRef(finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 22: + safelyDetachRef(finishedWork, finishedWork.return); + null === finishedWork.memoizedState && + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + default: + recursivelyTraverseDisappearLayoutEffects(finishedWork); } - updateQueue = node.child; - if (node.subtreeFlags & 16384 && null !== updateQueue) - (updateQueue.return = node), (node = updateQueue); - else { - if (node === finishedWork) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === finishedWork) return !0; - node = node.return; - } - node.sibling.return = node.return; - node = node.sibling; - } - } - return !0; -} -function markRootSuspended(root, suspendedLanes, spawnedLane) { - suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { - var index$3 = 31 - clz32(lanes), - lane = 1 << index$3; - expirationTimes[index$3] = -1; - lanes &= ~lane; - } - 0 !== spawnedLane && - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); -} -function flushSync(fn) { - null !== rootWithPendingPassiveEffects && - 0 === rootWithPendingPassiveEffects.tag && - 0 === (executionContext & 6) && - flushPassiveEffects(); - var prevExecutionContext = executionContext; - executionContext |= 1; - var prevTransition = ReactCurrentBatchConfig.transition, - previousPriority = currentUpdatePriority; - try { - if ( - ((ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - fn) - ) - return fn(); - } finally { - (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = prevTransition), - (executionContext = prevExecutionContext), - 0 === (executionContext & 6) && flushSyncWorkAcrossRoots_impl(!1); + parentFiber = parentFiber.sibling; } } -function resetWorkInProgressStack() { - if (null !== workInProgress) { - if (0 === workInProgressSuspendedReason) - var interruptedWork = workInProgress.return; - else - (interruptedWork = workInProgress), - resetContextDependencies(), - resetHooksOnUnwind(interruptedWork), - (thenableState$1 = null), - (thenableIndexCounter$1 = 0), - (interruptedWork = workInProgress); - for (; null !== interruptedWork; ) - unwindInterruptedWork(interruptedWork.alternate, interruptedWork), - (interruptedWork = interruptedWork.return); - workInProgress = null; - } -} -function prepareFreshStack(root, lanes) { - root.finishedWork = null; - root.finishedLanes = 0; - var timeoutHandle = root.timeoutHandle; - -1 !== timeoutHandle && - ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); - timeoutHandle = root.cancelPendingCommit; - null !== timeoutHandle && - ((root.cancelPendingCommit = null), timeoutHandle()); - resetWorkInProgressStack(); - workInProgressRoot = root; - workInProgress = timeoutHandle = createWorkInProgress(root.current, null); - workInProgressRootRenderLanes = lanes; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; - workInProgressDeferredLane = - workInProgressRootPingedLanes = - workInProgressRootInterleavedUpdatedLanes = - workInProgressRootSkippedLanes = - 0; - workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = - null; - workInProgressRootDidIncludeRecursiveRenderUpdate = !1; - 0 === (root.current.mode & 32) && 0 !== (lanes & 8) && (lanes |= lanes & 32); - var allEntangledLanes = root.entangledLanes; - if (0 !== allEntangledLanes) - for ( - root = root.entanglements, allEntangledLanes &= lanes; - 0 < allEntangledLanes; - - ) { - var index$1 = 31 - clz32(allEntangledLanes), - lane = 1 << index$1; - lanes |= root[index$1]; - allEntangledLanes &= ~lane; +function recursivelyTraverseReappearLayoutEffects( + finishedRoot$jscomp$0, + parentFiber, + includeWorkInProgressEffects +) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + commitHookLayoutEffects(finishedWork, 4); + break; + case 1: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + var instance = finishedWork.stateNode; + if ("function" === typeof instance.componentDidMount) + try { + instance.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + finishedRoot = finishedWork.updateQueue; + if (null !== finishedRoot) { + var hiddenCallbacks = finishedRoot.shared.hiddenCallbacks; + if (null !== hiddenCallbacks) + for ( + finishedRoot.shared.hiddenCallbacks = null, finishedRoot = 0; + finishedRoot < hiddenCallbacks.length; + finishedRoot++ + ) + callCallback(hiddenCallbacks[finishedRoot], instance); + } + includeWorkInProgressEffects && + flags & 64 && + commitClassCallbacks(finishedWork); + safelyAttachRef(finishedWork, finishedWork.return); + break; + case 26: + case 27: + case 5: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + case 12: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + break; + case 13: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + break; + case 22: + null === finishedWork.memoizedState && + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + default: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); } - entangledRenderLanes = lanes; - finishQueueingConcurrentUpdates(); - return timeoutHandle; + parentFiber = parentFiber.sibling; + } } -function handleThrow(root, thrownValue) { - currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); - workInProgressThrownValue = thrownValue; - null === workInProgress && - ((workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue)); +function commitHookPassiveMountEffects(finishedWork, hookFlags) { + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } } -function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; - return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; +function commitOffscreenPassiveMountEffects(current, finishedWork) { + var previousCache = null; + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (previousCache = current.memoizedState.cachePool.pool); + current = null; + null !== finishedWork.memoizedState && + null !== finishedWork.memoizedState.cachePool && + (current = finishedWork.memoizedState.cachePool.pool); + current !== previousCache && + (null != current && current.refCount++, + null != previousCache && releaseCache(previousCache)); } -function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; - return prevCacheDispatcher; +function commitCachePassiveMountEffect(current, finishedWork) { + current = null; + null !== finishedWork.alternate && + (current = finishedWork.alternate.memoizedState.cache); + finishedWork = finishedWork.memoizedState.cache; + finishedWork !== current && + (finishedWork.refCount++, null != current && releaseCache(current)); } -function renderDidSuspendDelayIfPossible() { - workInProgressRootExitStatus = 4; - (0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || - null === workInProgressRoot || - markRootSuspended( - workInProgressRoot, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); +function recursivelyTraversePassiveMountEffects( + root, + parentFiber, + committedLanes, + committedTransitions +) { + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveMountOnFiber( + root, + parentFiber, + committedLanes, + committedTransitions + ), + (parentFiber = parentFiber.sibling); } -function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) - (workInProgressTransitions = null), prepareFreshStack(root, lanes); - lanes = !1; - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - var unitOfWork = workInProgress, - thrownValue = workInProgressThrownValue; - switch (workInProgressSuspendedReason) { - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; - break a; - case 3: - case 2: - lanes || - null !== suspenseHandlerStackCursor.current || - (lanes = !0); - default: - (workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, unitOfWork, thrownValue); - } - } - workLoopSync(); - break; - } catch (thrownValue$105) { - handleThrow(root, thrownValue$105); - } - while (1); - lanes && root.shellSuspendCounter++; - resetContextDependencies(); - executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - if (null !== workInProgress) - throw Error( - "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." - ); - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; -} -function workLoopSync() { - for (; null !== workInProgress; ) performUnitOfWork(workInProgress); -} -function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) - (workInProgressTransitions = null), - (workInProgressRootRenderTargetTime = now() + 500), - prepareFreshStack(root, lanes); - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - lanes = workInProgress; - var thrownValue = workInProgressThrownValue; - b: switch (workInProgressSuspendedReason) { - case 1: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 2: - if (isThenableResolved(thrownValue)) { - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - replaySuspendedUnitOfWork(lanes); - break; - } - lanes = function () { - 2 === workInProgressSuspendedReason && - workInProgressRoot === root && - (workInProgressSuspendedReason = 7); - ensureRootIsScheduled(root); - }; - thrownValue.then(lanes, lanes); - break a; - case 3: - workInProgressSuspendedReason = 7; - break a; - case 4: - workInProgressSuspendedReason = 5; - break a; - case 7: - isThenableResolved(thrownValue) - ? ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - replaySuspendedUnitOfWork(lanes)) - : ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, lanes, thrownValue)); - break; - case 5: - switch (workInProgress.tag) { - case 5: - case 26: - case 27: - lanes = workInProgress; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - var sibling = lanes.sibling; - if (null !== sibling) workInProgress = sibling; - else { - var returnFiber = lanes.return; - null !== returnFiber - ? ((workInProgress = returnFiber), - completeUnitOfWork(returnFiber)) - : (workInProgress = null); - } - break b; - } - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 6: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; - break a; - default: - throw Error("Unexpected SuspendedReason. This is a bug in React."); - } - } - workLoopConcurrent(); - break; - } catch (thrownValue$107) { - handleThrow(root, thrownValue$107); - } - while (1); - resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - executionContext = prevExecutionContext; - if (null !== workInProgress) return 0; - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; -} -function workLoopConcurrent() { - for (; null !== workInProgress && !shouldYield(); ) - performUnitOfWork(workInProgress); -} -function performUnitOfWork(unitOfWork) { - var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - ReactCurrentOwner.current = null; -} -function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; - switch (unitOfWork.tag) { - case 2: - unitOfWork.tag = 0; - case 15: +function commitPassiveMountOnFiber( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions +) { + var flags = finishedWork.flags; + switch (finishedWork.tag) { case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - var context = isContextProvider(Component) - ? previousContext - : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - context, - workInProgressRootRenderLanes + case 11: + case 15: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions ); + flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); break; - case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - unitOfWork.ref, - workInProgressRootRenderLanes + case 3: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions ); + flags & 2048 && + ((finishedRoot = null), + null !== finishedWork.alternate && + (finishedRoot = finishedWork.alternate.memoizedState.cache), + (finishedWork = finishedWork.memoizedState.cache), + finishedWork !== finishedRoot && + (finishedWork.refCount++, + null != finishedRoot && releaseCache(finishedRoot))); break; - case 5: - resetHooksOnUnwind(unitOfWork); - default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); - } - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - ReactCurrentOwner.current = null; -} -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { - resetContextDependencies(); - resetHooksOnUnwind(unitOfWork); - thenableState$1 = null; - thenableIndexCounter$1 = 0; - var returnFiber = unitOfWork.return; - try { - if ( - throwException( - root, - returnFiber, - unitOfWork, - thrownValue, - workInProgressRootRenderLanes - ) - ) { - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; - } - } catch (error) { - if (null !== returnFiber) throw ((workInProgress = returnFiber), error); - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; - } - if (unitOfWork.flags & 32768) - a: { - root = unitOfWork; - do { - unitOfWork = unwindWork(root.alternate, root); - if (null !== unitOfWork) { - unitOfWork.flags &= 32767; - workInProgress = unitOfWork; - break a; - } - root = root.return; - null !== root && - ((root.flags |= 32768), - (root.subtreeFlags = 0), - (root.deletions = null)); - workInProgress = root; - } while (null !== root); - workInProgressRootExitStatus = 6; - workInProgress = null; - } - else completeUnitOfWork(unitOfWork); -} -function completeUnitOfWork(unitOfWork) { - var completedWork = unitOfWork; - do { - unitOfWork = completedWork.return; - var next = completeWork( - completedWork.alternate, - completedWork, - entangledRenderLanes - ); - if (null !== next) { - workInProgress = next; - return; - } - completedWork = completedWork.sibling; - if (null !== completedWork) { - workInProgress = completedWork; - return; - } - workInProgress = completedWork = unitOfWork; - } while (null !== completedWork); - 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) + : ((instance._visibility |= 4), + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + )) + : instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + 0 !== (finishedWork.subtreeFlags & 10256) + )); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + } } -function commitRoot( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane +function recursivelyTraverseReconnectPassiveEffects( + finishedRoot$jscomp$0, + parentFiber, + committedLanes$jscomp$0, + committedTransitions$jscomp$0, + includeWorkInProgressEffects ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; - try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - previousUpdateLanePriority, - spawnedLane - ); - } finally { - (ReactCurrentBatchConfig.transition = prevTransition), - (currentUpdatePriority = previousUpdateLanePriority); + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + committedLanes = committedLanes$jscomp$0, + committedTransitions = committedTransitions$jscomp$0, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + commitHookPassiveMountEffects(finishedWork, 8); + break; + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects( + finishedRoot, + finishedWork + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )); + includeWorkInProgressEffects && + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + includeWorkInProgressEffects && + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + } + parentFiber = parentFiber.sibling; } - return null; } -function commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - renderPriorityLevel, - spawnedLane +function recursivelyTraverseAtomicPassiveEffects( + finishedRoot$jscomp$0, + parentFiber ) { - do flushPassiveEffects(); - while (null !== rootWithPendingPassiveEffects); - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var finishedWork = root.finishedWork; - didIncludeRenderPhaseUpdate = root.finishedLanes; - if (null === finishedWork) return null; - root.finishedWork = null; - root.finishedLanes = 0; - if (finishedWork === root.current) - throw Error( - "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." - ); - root.callbackNode = null; - root.callbackPriority = 0; - root.cancelPendingCommit = null; - var remainingLanes = finishedWork.lanes | finishedWork.childLanes; - remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes, spawnedLane); - root === workInProgressRoot && - ((workInProgress = workInProgressRoot = null), - (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 10256) && - 0 === (finishedWork.flags & 10256)) || - rootDoesHavePassiveEffects || - ((rootDoesHavePassiveEffects = !0), - (pendingPassiveEffectsRemainingLanes = remainingLanes), - (pendingPassiveTransitions = transitions), - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - })); - transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; - spawnedLane = currentUpdatePriority; - currentUpdatePriority = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - ReactCurrentOwner.current = null; - commitBeforeMutationEffects(root, finishedWork); - commitMutationEffectsOnFiber(finishedWork, root); - root.current = finishedWork; - commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); - requestPaint(); - executionContext = prevExecutionContext; - currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; - } else root.current = finishedWork; - rootDoesHavePassiveEffects - ? ((rootDoesHavePassiveEffects = !1), - (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) - : releaseRootPooledCache(root, remainingLanes); - remainingLanes = root.pendingLanes; - 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); - onCommitRoot(finishedWork.stateNode, renderPriorityLevel); - ensureRootIsScheduled(root); - if (null !== recoverableErrors) - for ( - renderPriorityLevel = root.onRecoverableError, finishedWork = 0; - finishedWork < recoverableErrors.length; - finishedWork++ - ) - (remainingLanes = recoverableErrors[finishedWork]), - (transitions = { - digest: remainingLanes.digest, - componentStack: remainingLanes.stack - }), - renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); - 0 !== (pendingPassiveEffectsLanes & 3) && - 0 !== root.tag && - flushPassiveEffects(); - remainingLanes = root.pendingLanes; - 0 !== (didIncludeRenderPhaseUpdate & 4194218) && 0 !== (remainingLanes & 42) - ? root === rootWithNestedUpdates - ? nestedUpdateCount++ - : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) - : (nestedUpdateCount = 0); - flushSyncWorkAcrossRoots_impl(!1); - return null; + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 22: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + } + parentFiber = parentFiber.sibling; + } } -function releaseRootPooledCache(root, remainingLanes) { - 0 === (root.pooledCacheLanes &= remainingLanes) && - ((remainingLanes = root.pooledCache), - null != remainingLanes && - ((root.pooledCache = null), releaseCache(remainingLanes))); +var suspenseyCommitFlag = 8192; +function recursivelyAccumulateSuspenseyCommit(parentFiber) { + if (parentFiber.subtreeFlags & suspenseyCommitFlag) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + accumulateSuspenseyCommitOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); } -function flushPassiveEffects() { - if (null !== rootWithPendingPassiveEffects) { - var root = rootWithPendingPassiveEffects, - remainingLanes = pendingPassiveEffectsRemainingLanes; - pendingPassiveEffectsRemainingLanes = 0; - var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; - try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; - if (null === rootWithPendingPassiveEffects) - var JSCompiler_inline_result = !1; - else { - priority = pendingPassiveTransitions; - pendingPassiveTransitions = null; - var root$jscomp$0 = rootWithPendingPassiveEffects, - lanes = pendingPassiveEffectsLanes; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsLanes = 0; - if (0 !== (executionContext & 6)) - throw Error("Cannot flush passive effects while already rendering."); - var prevExecutionContext = executionContext; - executionContext |= 4; - commitPassiveUnmountOnFiber(root$jscomp$0.current); - commitPassiveMountOnFiber( - root$jscomp$0, - root$jscomp$0.current, - lanes, - priority +function accumulateSuspenseyCommitOnFiber(fiber) { + switch (fiber.tag) { + case 26: + recursivelyAccumulateSuspenseyCommit(fiber); + if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) + throw Error( + "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." ); - executionContext = prevExecutionContext; - flushSyncWorkAcrossRoots_impl(!1); - if ( - injectedHook && - "function" === typeof injectedHook.onPostCommitFiberRoot - ) - try { - injectedHook.onPostCommitFiberRoot(rendererID, root$jscomp$0); - } catch (err) {} - JSCompiler_inline_result = !0; + break; + case 5: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 3: + case 4: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 22: + if (null === fiber.memoizedState) { + var current = fiber.alternate; + null !== current && null !== current.memoizedState + ? ((current = suspenseyCommitFlag), + (suspenseyCommitFlag = 16777216), + recursivelyAccumulateSuspenseyCommit(fiber), + (suspenseyCommitFlag = current)) + : recursivelyAccumulateSuspenseyCommit(fiber); } - return JSCompiler_inline_result; - } finally { - (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), - releaseRootPooledCache(root, remainingLanes); - } + break; + default: + recursivelyAccumulateSuspenseyCommit(fiber); } - return !1; } -function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); - rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); - null !== rootFiber && - (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); +function detachAlternateSiblings(parentFiber) { + var previousFiber = parentFiber.alternate; + if ( + null !== previousFiber && + ((parentFiber = previousFiber.child), null !== parentFiber) + ) { + previousFiber.child = null; + do + (previousFiber = parentFiber.sibling), + (parentFiber.sibling = null), + (parentFiber = previousFiber); + while (null !== parentFiber); + } } -function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { - if (3 === sourceFiber.tag) - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - else - for (; null !== nearestMountedAncestor; ) { - if (3 === nearestMountedAncestor.tag) { - captureCommitPhaseErrorOnRoot( - nearestMountedAncestor, - sourceFiber, - error +function recursivelyTraversePassiveUnmountEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber ); - break; - } else if (1 === nearestMountedAncestor.tag) { - var instance = nearestMountedAncestor.stateNode; - if ( - "function" === - typeof nearestMountedAncestor.type.getDerivedStateFromError || - ("function" === typeof instance.componentDidCatch && - (null === legacyErrorBoundariesThatAlreadyFailed || - !legacyErrorBoundariesThatAlreadyFailed.has(instance))) - ) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createClassErrorUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - nearestMountedAncestor = enqueueUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - null !== nearestMountedAncestor && - (markRootUpdated$1(nearestMountedAncestor, 2), - ensureRootIsScheduled(nearestMountedAncestor)); - break; - } } - nearestMountedAncestor = nearestMountedAncestor.return; - } -} -function attachPingListener(root, wakeable, lanes) { - var pingCache = root.pingCache; - if (null === pingCache) { - pingCache = root.pingCache = new PossiblyWeakMap(); - var threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else - (threadIDs = pingCache.get(wakeable)), - void 0 === threadIDs && - ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); - threadIDs.has(lanes) || - ((workInProgressRootDidAttachPingListener = !0), - threadIDs.add(lanes), - (root = pingSuspendedRoot.bind(null, root, wakeable, lanes)), - wakeable.then(root, root)); + detachAlternateSiblings(parentFiber); + } + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveUnmountOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); } -function pingSuspendedRoot(root, wakeable, pingedLanes) { - var pingCache = root.pingCache; - null !== pingCache && pingCache.delete(wakeable); - root.pingedLanes |= root.suspendedLanes & pingedLanes; - workInProgressRoot === root && - (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && - (4 === workInProgressRootExitStatus || - (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes && - 300 > now() - globalMostRecentFallbackTime) - ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) - : (workInProgressRootPingedLanes |= pingedLanes)); - ensureRootIsScheduled(root); -} -function retryTimedOutBoundary(boundaryFiber, retryLane) { - 0 === retryLane && - (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); - boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); - null !== boundaryFiber && - (markRootUpdated$1(boundaryFiber, retryLane), - ensureRootIsScheduled(boundaryFiber)); -} -function retryDehydratedSuspenseBoundary(boundaryFiber) { - var suspenseState = boundaryFiber.memoizedState, - retryLane = 0; - null !== suspenseState && (retryLane = suspenseState.retryLane); - retryTimedOutBoundary(boundaryFiber, retryLane); -} -function resolveRetryWakeable(boundaryFiber, wakeable) { - var retryLane = 0; - switch (boundaryFiber.tag) { - case 13: - var retryCache = boundaryFiber.stateNode; - var suspenseState = boundaryFiber.memoizedState; - null !== suspenseState && (retryLane = suspenseState.retryLane); - break; - case 19: - retryCache = boundaryFiber.stateNode; +function commitPassiveUnmountOnFiber(finishedWork) { + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraversePassiveUnmountEffects(finishedWork); + finishedWork.flags & 2048 && + commitHookEffectListUnmount(9, finishedWork, finishedWork.return); break; case 22: - retryCache = boundaryFiber.stateNode._retryCache; + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState && + instance._visibility & 4 && + (null === finishedWork.return || 13 !== finishedWork.return.tag) + ? ((instance._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(finishedWork)) + : recursivelyTraversePassiveUnmountEffects(finishedWork); break; default: - throw Error( - "Pinged unknown suspense boundary type. This is probably a bug in React." - ); + recursivelyTraversePassiveUnmountEffects(finishedWork); } - null !== retryCache && retryCache.delete(wakeable); - retryTimedOutBoundary(boundaryFiber, retryLane); } -var beginWork; -beginWork = function (current, workInProgress, renderLanes) { - if (null !== current) - if ( - current.memoizedProps !== workInProgress.pendingProps || - didPerformWorkStackCursor.current - ) - didReceiveUpdate = !0; - else { - if ( - 0 === (current.lanes & renderLanes) && - 0 === (workInProgress.flags & 128) - ) - return ( - (didReceiveUpdate = !1), - attemptEarlyBailoutIfNoScheduledUpdate( - current, - workInProgress, - renderLanes - ) +function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber ); - didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; + } + detachAlternateSiblings(parentFiber); + } + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + deletions = parentFiber; + switch (deletions.tag) { + case 0: + case 11: + case 15: + commitHookEffectListUnmount(8, deletions, deletions.return); + recursivelyTraverseDisconnectPassiveEffects(deletions); + break; + case 22: + i = deletions.stateNode; + i._visibility & 4 && + ((i._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(deletions)); + break; + default: + recursivelyTraverseDisconnectPassiveEffects(deletions); } - else didReceiveUpdate = !1; - workInProgress.lanes = 0; - switch (workInProgress.tag) { - case 2: - var Component = workInProgress.type; - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - var context = getMaskedContext( - workInProgress, - contextStackCursor$1.current - ); - prepareToReadContext(workInProgress, renderLanes); - current = renderWithHooks( - null, - workInProgress, - Component, - current, - context, - renderLanes - ); - workInProgress.flags |= 1; - workInProgress.tag = 0; - reconcileChildren(null, workInProgress, current, renderLanes); - workInProgress = workInProgress.child; - return workInProgress; - case 16: - Component = workInProgress.elementType; - a: { - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - context = Component._init; - Component = context(Component._payload); - workInProgress.type = Component; - context = workInProgress.tag = resolveLazyComponentTag(Component); - current = resolveDefaultProps(Component, current); - switch (context) { - case 0: - workInProgress = updateFunctionComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 1: - workInProgress = updateClassComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 11: - workInProgress = updateForwardRef( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 14: - workInProgress = updateMemoComponent( - null, - workInProgress, - Component, - resolveDefaultProps(Component.type, current), - renderLanes - ); - break a; + parentFiber = parentFiber.sibling; + } +} +function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + deletedSubtreeRoot, + nearestMountedAncestor +) { + for (; null !== nextEffect; ) { + var fiber = nextEffect; + switch (fiber.tag) { + case 0: + case 11: + case 15: + commitHookEffectListUnmount(8, fiber, nearestMountedAncestor); + break; + case 23: + case 22: + if ( + null !== fiber.memoizedState && + null !== fiber.memoizedState.cachePool + ) { + var cache = fiber.memoizedState.cachePool.pool; + null != cache && cache.refCount++; } - throw Error( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." - ); + break; + case 24: + releaseCache(fiber.memoizedState.cache); + } + cache = fiber.child; + if (null !== cache) (cache.return = fiber), (nextEffect = cache); + else + a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { + cache = nextEffect; + var sibling = cache.sibling, + returnFiber = cache.return; + detachFiberAfterEffects(cache); + if (cache === fiber) { + nextEffect = null; + break a; + } + if (null !== sibling) { + sibling.return = returnFiber; + nextEffect = sibling; + break a; + } + nextEffect = returnFiber; } - return workInProgress; - case 0: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateFunctionComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 1: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateClassComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) + } +} +var DefaultCacheDispatcher = { + getCacheSignal: function () { + return readContext(CacheContext).controller.signal; + }, + getCacheForType: function (resourceType) { + var cache = readContext(CacheContext), + cacheForType = cache.data.get(resourceType); + void 0 === cacheForType && + ((cacheForType = resourceType()), + cache.data.set(resourceType, cacheForType)); + return cacheForType; + } + }, + PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + executionContext = 0, + workInProgressRoot = null, + workInProgress = null, + workInProgressRootRenderLanes = 0, + workInProgressSuspendedReason = 0, + workInProgressThrownValue = null, + workInProgressRootDidAttachPingListener = !1, + entangledRenderLanes = 0, + workInProgressRootExitStatus = 0, + workInProgressRootFatalError = null, + workInProgressRootSkippedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, + workInProgressRootDidIncludeRecursiveRenderUpdate = !1, + globalMostRecentFallbackTime = 0, + workInProgressRootRenderTargetTime = Infinity, + workInProgressTransitions = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsLanes = 0, + pendingPassiveEffectsRemainingLanes = 0, + pendingPassiveTransitions = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null; +function requestUpdateLane(fiber) { + if (0 === (fiber.mode & 1)) return 2; + if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) + return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; + if (null !== requestCurrentTransition()) + return ( + (fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane() + ); + fiber = currentUpdatePriority; + return 0 !== fiber ? fiber : 32; +} +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : claimNextTransitionLane()); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); + return workInProgressDeferredLane; +} +function scheduleUpdateOnFiber(root, fiber, lane) { + if ( + (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || + null !== root.cancelPendingCommit + ) + prepareFreshStack(root, 0), + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); + markRootUpdated$1(root, lane); + if (0 === (executionContext & 2) || root !== workInProgressRoot) + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )), + ensureRootIsScheduled(root), + 2 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now() + 500), + flushSyncWorkAcrossRoots_impl(!0)); +} +function performConcurrentWorkOnRoot(root, didTimeout) { + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var originalCallbackNode = root.callbackNode; + if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) + return null; + var lanes = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes : 0 + ); + if (0 === lanes) return null; + var shouldTimeSlice = + !includesBlockingLane(root, lanes) && + 0 === (lanes & root.expiredLanes) && + !didTimeout; + didTimeout = shouldTimeSlice + ? renderRootConcurrent(root, lanes) + : renderRootSync(root, lanes); + if (0 !== didTimeout) { + var renderWasConcurrent = shouldTimeSlice; + do { + if (6 === didTimeout) markRootSuspended(root, lanes, 0); + else { + shouldTimeSlice = root.current.alternate; + if ( + renderWasConcurrent && + !isRenderConsistentWithExternalStores(shouldTimeSlice) + ) { + didTimeout = renderRootSync(root, lanes); + renderWasConcurrent = !1; + continue; + } + if (2 === didTimeout) { + renderWasConcurrent = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + renderWasConcurrent + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (didTimeout = recoverFromConcurrentError( + root, + renderWasConcurrent, + errorRetryLanes + ))); + } + if (1 === didTimeout) + throw ( + ((originalCallbackNode = workInProgressRootFatalError), + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + originalCallbackNode) + ); + root.finishedWork = shouldTimeSlice; + root.finishedLanes = lanes; + a: { + renderWasConcurrent = root; + switch (didTimeout) { + case 0: + case 1: + throw Error("Root did not complete. This is a bug in React."); + case 4: + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + break a; + } + break; + case 2: + case 3: + case 5: + break; + default: + throw Error("Unknown root exit status."); + } + if ( + (lanes & 62914560) === lanes && + ((didTimeout = globalMostRecentFallbackTime + 300 - now()), + 10 < didTimeout) + ) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; + renderWasConcurrent.timeoutHandle = scheduleTimeout( + commitRootWhenReady.bind( + null, + renderWasConcurrent, + shouldTimeSlice, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ), + didTimeout + ); + break a; + } + commitRootWhenReady( + renderWasConcurrent, + shouldTimeSlice, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ); + } + } + break; + } while (1); + } + ensureRootIsScheduled(root); + scheduleTaskForRootDuringMicrotask(root, now()); + root = + root.callbackNode === originalCallbackNode + ? performConcurrentWorkOnRoot.bind(null, root) + : null; + return root; +} +function recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes +) { + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, + JSCompiler_inline_result; + (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && + (prepareFreshStack(root, errorRetryLanes).flags |= 256); + errorRetryLanes = renderRootSync(root, errorRetryLanes); + if (2 !== errorRetryLanes) { + if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) + return ( + (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), + (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), + 4 + ); + root = workInProgressRootRecoverableErrors; + workInProgressRootRecoverableErrors = errorsFromFirstAttempt; + null !== root && queueRecoverableErrors(root); + } + return errorRetryLanes; +} +function queueRecoverableErrors(errors) { + null === workInProgressRootRecoverableErrors + ? (workInProgressRootRecoverableErrors = errors) + : workInProgressRootRecoverableErrors.push.apply( + workInProgressRootRecoverableErrors, + errors + ); +} +function commitRootWhenReady( + root, + finishedWork, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + lanes, + spawnedLane +) { + 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); + commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane + ); +} +function isRenderConsistentWithExternalStores(finishedWork) { + for (var node = finishedWork; ; ) { + if (node.flags & 16384) { + var updateQueue = node.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.stores), null !== updateQueue) + ) + for (var i = 0; i < updateQueue.length; i++) { + var check = updateQueue[i], + getSnapshot = check.getSnapshot; + check = check.value; + try { + if (!objectIs(getSnapshot(), check)) return !1; + } catch (error) { + return !1; + } + } + } + updateQueue = node.child; + if (node.subtreeFlags & 16384 && null !== updateQueue) + (updateQueue.return = node), (node = updateQueue); + else { + if (node === finishedWork) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === finishedWork) return !0; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return !0; +} +function markRootSuspended(root, suspendedLanes, spawnedLane) { + suspendedLanes &= ~workInProgressRootPingedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$3 = 31 - clz32(lanes), + lane = 1 << index$3; + expirationTimes[index$3] = -1; + lanes &= ~lane; + } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); +} +function flushSync(fn) { + null !== rootWithPendingPassiveEffects && + 0 === rootWithPendingPassiveEffects.tag && + 0 === (executionContext & 6) && + flushPassiveEffects(); + var prevExecutionContext = executionContext; + executionContext |= 1; + var prevTransition = ReactCurrentBatchConfig.transition, + previousPriority = currentUpdatePriority; + try { + if ( + ((ReactCurrentBatchConfig.transition = null), + (currentUpdatePriority = 2), + fn) + ) + return fn(); + } finally { + (currentUpdatePriority = previousPriority), + (ReactCurrentBatchConfig.transition = prevTransition), + (executionContext = prevExecutionContext), + 0 === (executionContext & 6) && flushSyncWorkAcrossRoots_impl(!1); + } +} +function resetWorkInProgressStack() { + if (null !== workInProgress) { + if (0 === workInProgressSuspendedReason) + var interruptedWork = workInProgress.return; + else + (interruptedWork = workInProgress), + resetContextDependencies(), + resetHooksOnUnwind(interruptedWork), + (thenableState$1 = null), + (thenableIndexCounter$1 = 0), + (interruptedWork = workInProgress); + for (; null !== interruptedWork; ) + unwindInterruptedWork(interruptedWork.alternate, interruptedWork), + (interruptedWork = interruptedWork.return); + workInProgress = null; + } +} +function prepareFreshStack(root, lanes) { + root.finishedWork = null; + root.finishedLanes = 0; + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + timeoutHandle = root.cancelPendingCommit; + null !== timeoutHandle && + ((root.cancelPendingCommit = null), timeoutHandle()); + resetWorkInProgressStack(); + workInProgressRoot = root; + workInProgress = timeoutHandle = createWorkInProgress(root.current, null); + workInProgressRootRenderLanes = lanes; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + workInProgressRootDidAttachPingListener = !1; + workInProgressRootExitStatus = 0; + workInProgressRootFatalError = null; + workInProgressDeferredLane = + workInProgressRootPingedLanes = + workInProgressRootInterleavedUpdatedLanes = + workInProgressRootSkippedLanes = + 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = + null; + workInProgressRootDidIncludeRecursiveRenderUpdate = !1; + 0 === (root.current.mode & 32) && 0 !== (lanes & 8) && (lanes |= lanes & 32); + var allEntangledLanes = root.entangledLanes; + if (0 !== allEntangledLanes) + for ( + root = root.entanglements, allEntangledLanes &= lanes; + 0 < allEntangledLanes; + + ) { + var index$1 = 31 - clz32(allEntangledLanes), + lane = 1 << index$1; + lanes |= root[index$1]; + allEntangledLanes &= ~lane; + } + entangledRenderLanes = lanes; + finishQueueingConcurrentUpdates(); + return timeoutHandle; +} +function handleThrow(root, thrownValue) { + currentlyRenderingFiber$1 = null; + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactCurrentOwner.current = null; + thrownValue === SuspenseException + ? ((thrownValue = getSuspendedThenable()), + (root = suspenseHandlerStackCursor.current), + (workInProgressSuspendedReason = + (null !== root && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + root !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2)) + : thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); + workInProgressThrownValue = thrownValue; + null === workInProgress && + ((workInProgressRootExitStatus = 1), + (workInProgressRootFatalError = thrownValue)); +} +function pushDispatcher() { + var prevDispatcher = ReactCurrentDispatcher.current; + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; +} +function pushCacheDispatcher() { + var prevCacheDispatcher = ReactCurrentCache.current; + ReactCurrentCache.current = DefaultCacheDispatcher; + return prevCacheDispatcher; +} +function renderDidSuspendDelayIfPossible() { + workInProgressRootExitStatus = 4; + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); +} +function renderRootSync(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) + (workInProgressTransitions = null), prepareFreshStack(root, lanes); + lanes = !1; + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + var unitOfWork = workInProgress, + thrownValue = workInProgressThrownValue; + switch (workInProgressSuspendedReason) { + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + case 3: + case 2: + lanes || + null !== suspenseHandlerStackCursor.current || + (lanes = !0); + default: + (workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, unitOfWork, thrownValue); + } + } + workLoopSync(); + break; + } catch (thrownValue$105) { + handleThrow(root, thrownValue$105); + } + while (1); + lanes && root.shellSuspendCounter++; + resetContextDependencies(); + executionContext = prevExecutionContext; + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + if (null !== workInProgress) + throw Error( + "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." + ); + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; +} +function workLoopSync() { + for (; null !== workInProgress; ) performUnitOfWork(workInProgress); +} +function renderRootConcurrent(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) + (workInProgressTransitions = null), + (workInProgressRootRenderTargetTime = now() + 500), + prepareFreshStack(root, lanes); + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + lanes = workInProgress; + var thrownValue = workInProgressThrownValue; + b: switch (workInProgressSuspendedReason) { + case 1: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 2: + if (isThenableResolved(thrownValue)) { + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + replaySuspendedUnitOfWork(lanes); + break; + } + lanes = function () { + 2 === workInProgressSuspendedReason && + workInProgressRoot === root && + (workInProgressSuspendedReason = 7); + ensureRootIsScheduled(root); + }; + thrownValue.then(lanes, lanes); + break a; + case 3: + workInProgressSuspendedReason = 7; + break a; + case 4: + workInProgressSuspendedReason = 5; + break a; + case 7: + isThenableResolved(thrownValue) + ? ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + replaySuspendedUnitOfWork(lanes)) + : ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, lanes, thrownValue)); + break; + case 5: + switch (workInProgress.tag) { + case 5: + case 26: + case 27: + lanes = workInProgress; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + var sibling = lanes.sibling; + if (null !== sibling) workInProgress = sibling; + else { + var returnFiber = lanes.return; + null !== returnFiber + ? ((workInProgress = returnFiber), + completeUnitOfWork(returnFiber)) + : (workInProgress = null); + } + break b; + } + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 6: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + default: + throw Error("Unexpected SuspendedReason. This is a bug in React."); + } + } + workLoopConcurrent(); + break; + } catch (thrownValue$107) { + handleThrow(root, thrownValue$107); + } + while (1); + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + executionContext = prevExecutionContext; + if (null !== workInProgress) return 0; + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; +} +function workLoopConcurrent() { + for (; null !== workInProgress && !shouldYield(); ) + performUnitOfWork(workInProgress); +} +function performUnitOfWork(unitOfWork) { + var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); + ReactCurrentOwner.current = null; +} +function replaySuspendedUnitOfWork(unitOfWork) { + var current = unitOfWork.alternate; + switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; + case 15: + case 0: + var Component = unitOfWork.type, + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor$1.current; + context = getMaskedContext(unitOfWork, context); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + context, + workInProgressRootRenderLanes ); - case 3: - pushHostRootContext(workInProgress); - if (null === current) - throw Error("Should have a current fiber. This is a bug in React."); - var nextProps = workInProgress.pendingProps; - context = workInProgress.memoizedState; - Component = context.element; - cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, nextProps, null, renderLanes); - nextProps = workInProgress.memoizedState; - var nextCache = nextProps.cache; - pushProvider(workInProgress, CacheContext, nextCache); - nextCache !== context.cache && - propagateContextChange(workInProgress, CacheContext, renderLanes); - suspendIfUpdateReadFromEntangledAsyncAction(); - context = nextProps.element; - context === Component - ? (workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - )) - : (reconcileChildren(current, workInProgress, context, renderLanes), - (workInProgress = workInProgress.child)); - return workInProgress; - case 26: - case 27: + break; + case 11: + Component = unitOfWork.type.render; + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + unitOfWork.ref, + workInProgressRootRenderLanes + ); + break; case 5: - return ( - pushHostContext(workInProgress), - (Component = workInProgress.pendingProps.children), - null !== workInProgress.memoizedState && - ((context = renderWithHooks( - current, - workInProgress, - TransitionAwareHostComponent, - null, - null, - renderLanes - )), - (HostTransitionContext._currentValue2 = context), - didReceiveUpdate && - null !== current && - current.memoizedState.memoizedState !== context && - propagateContextChange( - workInProgress, - HostTransitionContext, - renderLanes - )), - markRef(current, workInProgress), - reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child + resetHooksOnUnwind(unitOfWork); + default: + unwindInterruptedWork(current, unitOfWork), + (unitOfWork = workInProgress = + resetWorkInProgress(unitOfWork, entangledRenderLanes)), + (current = beginWork(current, unitOfWork, entangledRenderLanes)); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current + ? completeUnitOfWork(unitOfWork) + : (workInProgress = current); + ReactCurrentOwner.current = null; +} +function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + resetContextDependencies(); + resetHooksOnUnwind(unitOfWork); + thenableState$1 = null; + thenableIndexCounter$1 = 0; + var returnFiber = unitOfWork.return; + try { + if ( + throwException( + root, + returnFiber, + unitOfWork, + thrownValue, + workInProgressRootRenderLanes + ) + ) { + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + } catch (error) { + if (null !== returnFiber) throw ((workInProgress = returnFiber), error); + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + if (unitOfWork.flags & 32768) + a: { + root = unitOfWork; + do { + unitOfWork = unwindWork(root.alternate, root); + if (null !== unitOfWork) { + unitOfWork.flags &= 32767; + workInProgress = unitOfWork; + break a; + } + root = root.return; + null !== root && + ((root.flags |= 32768), + (root.subtreeFlags = 0), + (root.deletions = null)); + workInProgress = root; + } while (null !== root); + workInProgressRootExitStatus = 6; + workInProgress = null; + } + else completeUnitOfWork(unitOfWork); +} +function completeUnitOfWork(unitOfWork) { + var completedWork = unitOfWork; + do { + unitOfWork = completedWork.return; + var next = completeWork( + completedWork.alternate, + completedWork, + entangledRenderLanes + ); + if (null !== next) { + workInProgress = next; + return; + } + completedWork = completedWork.sibling; + if (null !== completedWork) { + workInProgress = completedWork; + return; + } + workInProgress = completedWork = unitOfWork; + } while (null !== completedWork); + 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); +} +function commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane +) { + var previousUpdateLanePriority = currentUpdatePriority, + prevTransition = ReactCurrentBatchConfig.transition; + try { + (ReactCurrentBatchConfig.transition = null), + (currentUpdatePriority = 2), + commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + previousUpdateLanePriority, + spawnedLane ); - case 6: + } finally { + (ReactCurrentBatchConfig.transition = prevTransition), + (currentUpdatePriority = previousUpdateLanePriority); + } + return null; +} +function commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + renderPriorityLevel, + spawnedLane +) { + do flushPassiveEffects(); + while (null !== rootWithPendingPassiveEffects); + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedLanes = 0; + if (finishedWork === root.current) + throw Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ); + root.callbackNode = null; + root.callbackPriority = 0; + root.cancelPendingCommit = null; + var remainingLanes = finishedWork.lanes | finishedWork.childLanes; + remainingLanes |= concurrentlyUpdatedLanes; + markRootFinished(root, remainingLanes, spawnedLane); + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), + (workInProgressRootRenderLanes = 0)); + (0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || + rootDoesHavePassiveEffects || + ((rootDoesHavePassiveEffects = !0), + (pendingPassiveEffectsRemainingLanes = remainingLanes), + (pendingPassiveTransitions = transitions), + scheduleCallback(NormalPriority$1, function () { + flushPassiveEffects(); return null; - case 13: - return updateSuspenseComponent(current, workInProgress, renderLanes); - case 4: - return ( - pushHostContainer( - workInProgress, - workInProgress.stateNode.containerInfo - ), - (Component = workInProgress.pendingProps), - null === current - ? (workInProgress.child = reconcileChildFibers( - workInProgress, - null, - Component, - renderLanes - )) - : reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 11: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateForwardRef( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 7: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps, - renderLanes - ), - workInProgress.child - ); - case 8: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 12: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 10: - a: { - Component = workInProgress.type._context; - context = workInProgress.pendingProps; - nextProps = workInProgress.memoizedProps; - nextCache = context.value; - pushProvider(workInProgress, Component, nextCache); - if (null !== nextProps) - if (objectIs(nextProps.value, nextCache)) { - if ( - nextProps.children === context.children && - !didPerformWorkStackCursor.current - ) { - workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - ); - break a; - } - } else propagateContextChange(workInProgress, Component, renderLanes); - reconcileChildren( - current, - workInProgress, - context.children, - renderLanes + })); + transitions = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { + transitions = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = null; + spawnedLane = currentUpdatePriority; + currentUpdatePriority = 2; + var prevExecutionContext = executionContext; + executionContext |= 4; + ReactCurrentOwner.current = null; + commitBeforeMutationEffects(root, finishedWork); + commitMutationEffectsOnFiber(finishedWork, root); + root.current = finishedWork; + commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); + requestPaint(); + executionContext = prevExecutionContext; + currentUpdatePriority = spawnedLane; + ReactCurrentBatchConfig.transition = transitions; + } else root.current = finishedWork; + rootDoesHavePassiveEffects + ? ((rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) + : releaseRootPooledCache(root, remainingLanes); + remainingLanes = root.pendingLanes; + 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); + onCommitRoot(finishedWork.stateNode, renderPriorityLevel); + ensureRootIsScheduled(root); + if (null !== recoverableErrors) + for ( + renderPriorityLevel = root.onRecoverableError, finishedWork = 0; + finishedWork < recoverableErrors.length; + finishedWork++ + ) + (remainingLanes = recoverableErrors[finishedWork]), + (transitions = { + digest: remainingLanes.digest, + componentStack: remainingLanes.stack + }), + renderPriorityLevel(remainingLanes.value, transitions); + if (hasUncaughtError) + throw ( + ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root) + ); + 0 !== (pendingPassiveEffectsLanes & 3) && + 0 !== root.tag && + flushPassiveEffects(); + remainingLanes = root.pendingLanes; + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && 0 !== (remainingLanes & 42) + ? root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) + : (nestedUpdateCount = 0); + flushSyncWorkAcrossRoots_impl(!1); + return null; +} +function releaseRootPooledCache(root, remainingLanes) { + 0 === (root.pooledCacheLanes &= remainingLanes) && + ((remainingLanes = root.pooledCache), + null != remainingLanes && + ((root.pooledCache = null), releaseCache(remainingLanes))); +} +function flushPassiveEffects() { + if (null !== rootWithPendingPassiveEffects) { + var root = rootWithPendingPassiveEffects, + remainingLanes = pendingPassiveEffectsRemainingLanes; + pendingPassiveEffectsRemainingLanes = 0; + var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), + priority = 32 > renderPriority ? 32 : renderPriority; + renderPriority = ReactCurrentBatchConfig.transition; + var previousPriority = currentUpdatePriority; + try { + ReactCurrentBatchConfig.transition = null; + currentUpdatePriority = priority; + if (null === rootWithPendingPassiveEffects) + var JSCompiler_inline_result = !1; + else { + priority = pendingPassiveTransitions; + pendingPassiveTransitions = null; + var root$jscomp$0 = rootWithPendingPassiveEffects, + lanes = pendingPassiveEffectsLanes; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsLanes = 0; + if (0 !== (executionContext & 6)) + throw Error("Cannot flush passive effects while already rendering."); + var prevExecutionContext = executionContext; + executionContext |= 4; + commitPassiveUnmountOnFiber(root$jscomp$0.current); + commitPassiveMountOnFiber( + root$jscomp$0, + root$jscomp$0.current, + lanes, + priority ); - workInProgress = workInProgress.child; - } - return workInProgress; - case 9: - return ( - (context = workInProgress.type), - (Component = workInProgress.pendingProps.children), - prepareToReadContext(workInProgress, renderLanes), - (context = readContext(context)), - (Component = Component(context)), - (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 14: - return ( - (Component = workInProgress.type), - (context = resolveDefaultProps(Component, workInProgress.pendingProps)), - (context = resolveDefaultProps(Component.type, context)), - updateMemoComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 15: - return updateSimpleMemoComponent( - current, - workInProgress, - workInProgress.type, - workInProgress.pendingProps, - renderLanes - ); - case 17: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), - (workInProgress.tag = 1), - isContextProvider(Component) - ? ((current = !0), pushContextProvider(workInProgress)) - : (current = !1), - prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, Component, context), - mountClassInstance(workInProgress, Component, context, renderLanes), - finishClassComponent( - null, - workInProgress, - Component, - !0, - current, - renderLanes + executionContext = prevExecutionContext; + flushSyncWorkAcrossRoots_impl(!1); + if ( + injectedHook && + "function" === typeof injectedHook.onPostCommitFiberRoot ) - ); + try { + injectedHook.onPostCommitFiberRoot(rendererID, root$jscomp$0); + } catch (err) {} + JSCompiler_inline_result = !0; + } + return JSCompiler_inline_result; + } finally { + (currentUpdatePriority = previousPriority), + (ReactCurrentBatchConfig.transition = renderPriority), + releaseRootPooledCache(root, remainingLanes); + } + } + return !1; +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); + null !== rootFiber && + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); +} +function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (; null !== nearestMountedAncestor; ) { + if (3 === nearestMountedAncestor.tag) { + captureCommitPhaseErrorOnRoot( + nearestMountedAncestor, + sourceFiber, + error + ); + break; + } else if (1 === nearestMountedAncestor.tag) { + var instance = nearestMountedAncestor.stateNode; + if ( + "function" === + typeof nearestMountedAncestor.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createClassErrorUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + nearestMountedAncestor = enqueueUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + null !== nearestMountedAncestor && + (markRootUpdated$1(nearestMountedAncestor, 2), + ensureRootIsScheduled(nearestMountedAncestor)); + break; + } + } + nearestMountedAncestor = nearestMountedAncestor.return; + } +} +function attachPingListener(root, wakeable, lanes) { + var pingCache = root.pingCache; + if (null === pingCache) { + pingCache = root.pingCache = new PossiblyWeakMap(); + var threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } else + (threadIDs = pingCache.get(wakeable)), + void 0 === threadIDs && + ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); + threadIDs.has(lanes) || + ((workInProgressRootDidAttachPingListener = !0), + threadIDs.add(lanes), + (root = pingSuspendedRoot.bind(null, root, wakeable, lanes)), + wakeable.then(root, root)); +} +function pingSuspendedRoot(root, wakeable, pingedLanes) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(wakeable); + root.pingedLanes |= root.suspendedLanes & pingedLanes; + workInProgressRoot === root && + (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && + (4 === workInProgressRootExitStatus || + (3 === workInProgressRootExitStatus && + (workInProgressRootRenderLanes & 62914560) === + workInProgressRootRenderLanes && + 300 > now() - globalMostRecentFallbackTime) + ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) + : (workInProgressRootPingedLanes |= pingedLanes)); + ensureRootIsScheduled(root); +} +function retryTimedOutBoundary(boundaryFiber, retryLane) { + 0 === retryLane && + (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); + boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); + null !== boundaryFiber && + (markRootUpdated$1(boundaryFiber, retryLane), + ensureRootIsScheduled(boundaryFiber)); +} +function retryDehydratedSuspenseBoundary(boundaryFiber) { + var suspenseState = boundaryFiber.memoizedState, + retryLane = 0; + null !== suspenseState && (retryLane = suspenseState.retryLane); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function resolveRetryWakeable(boundaryFiber, wakeable) { + var retryLane = 0; + switch (boundaryFiber.tag) { + case 13: + var retryCache = boundaryFiber.stateNode; + var suspenseState = boundaryFiber.memoizedState; + null !== suspenseState && (retryLane = suspenseState.retryLane); + break; case 19: - return updateSuspenseListComponent(current, workInProgress, renderLanes); + retryCache = boundaryFiber.stateNode; + break; case 22: - return updateOffscreenComponent(current, workInProgress, renderLanes); - case 24: - return ( - prepareToReadContext(workInProgress, renderLanes), - (Component = readContext(CacheContext)), - null === current - ? ((context = peekCacheFromPool()), - null === context && - ((context = workInProgressRoot), - (nextProps = createCache()), - (context.pooledCache = nextProps), - nextProps.refCount++, - null !== nextProps && (context.pooledCacheLanes |= renderLanes), - (context = nextProps)), - (workInProgress.memoizedState = { - parent: Component, - cache: context - }), - initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, context)) - : (0 !== (current.lanes & renderLanes) && - (cloneUpdateQueue(current, workInProgress), - processUpdateQueue(workInProgress, null, null, renderLanes), - suspendIfUpdateReadFromEntangledAsyncAction()), - (context = current.memoizedState), - (nextProps = workInProgress.memoizedState), - context.parent !== Component - ? ((context = { parent: Component, cache: Component }), - (workInProgress.memoizedState = context), - 0 === workInProgress.lanes && - (workInProgress.memoizedState = - workInProgress.updateQueue.baseState = - context), - pushProvider(workInProgress, CacheContext, Component)) - : ((Component = nextProps.cache), - pushProvider(workInProgress, CacheContext, Component), - Component !== context.cache && - propagateContextChange( - workInProgress, - CacheContext, - renderLanes - ))), - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child + retryCache = boundaryFiber.stateNode._retryCache; + break; + default: + throw Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." ); } - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); -}; + null !== retryCache && retryCache.delete(wakeable); + retryTimedOutBoundary(boundaryFiber, retryLane); +} function scheduleCallback(priorityLevel, callback) { return scheduleCallback$3(priorityLevel, callback); } @@ -9147,7 +9146,7 @@ var devToolsConfig$jscomp$inline_1016 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-9c48fb25e-20240311", + version: "18.3.0-canary-89021fb4e-20240311", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1194 = { @@ -9178,7 +9177,7 @@ var internals$jscomp$inline_1194 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-9c48fb25e-20240311" + reconcilerVersion: "18.3.0-canary-89021fb4e-20240311" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1195 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 2e177f42449c3..76e46f1bc50df 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<3db6478b58a13804134a4a829ee19a5c>> + * @generated SignedSource<> */ "use strict"; @@ -4985,633 +4985,404 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } -var valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = - lastContextDependency = - currentlyRenderingFiber = - null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue2); - context._currentValue2 = nextValue; -} -function popProvider(context) { - context._currentValue2 = valueCursor.current; - 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 propagateContextChange(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) - throw Error( - "We just came from a parent so we must have had a parent. This is a bug in React." +function beginWork(current, workInProgress, renderLanes) { + if (null !== current) + if ( + current.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if ( + 0 === (current.lanes & renderLanes) && + 0 === (workInProgress.flags & 128) + ) + return ( + (didReceiveUpdate = !1), + attemptEarlyBailoutIfNoScheduledUpdate( + current, + workInProgress, + renderLanes + ) ); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } 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; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; + } + else didReceiveUpdate = !1; + workInProgress.lanes = 0; + switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor$1.current + ); + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + workInProgress.flags |= 1; + workInProgress.tag = 0; + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; + case 16: + Component = workInProgress.elementType; + a: { + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null)); -} -function readContext(context) { - return readContextForConsumer(currentlyRenderingFiber, context); -} -function readContextDuringReconcilation(consumer, context, renderLanes) { - null === currentlyRenderingFiber && - prepareToReadContext(consumer, renderLanes); - return readContextForConsumer(consumer, context); -} -function readContextForConsumer(consumer, context) { - var value = context._currentValue2; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === consumer) throw Error( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." ); - lastContextDependency = context; - consumer.dependencies = { lanes: 0, firstContext: context }; - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function () { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function (type, listener) { - listeners.push(listener); - } - }); - this.abort = function () { - signal.aborted = !0; - listeners.forEach(function (listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler$1.unstable_scheduleCallback, - NormalPriority = Scheduler$1.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0 - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority, function () { - cache.controller.abort(); - }); -} -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; - null !== transition && transition._callbacks.add(handleAsyncAction); - return transition; -} -function handleAsyncAction(transition, thenable) { - entangleAsyncAction(transition, thenable); -} -function notifyTransitionCallbacks(transition, returnValue) { - transition._callbacks.forEach(function (callback) { - return callback(transition, returnValue); - }); -} -var resumedCache = createCursor(null); -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: CacheContext._currentValue2, pool: cacheFromPool }; -} -function scheduleRetryEffect(workInProgress, retryQueue) { - null !== retryQueue - ? (workInProgress.flags |= 4) - : workInProgress.flags & 16384 && - ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); -} -function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { - switch (renderState.tailMode) { - case "hidden": - hasRenderedATailFallback = renderState.tail; - for (var lastTailNode = null; null !== hasRenderedATailFallback; ) - null !== hasRenderedATailFallback.alternate && - (lastTailNode = hasRenderedATailFallback), - (hasRenderedATailFallback = hasRenderedATailFallback.sibling); - null === lastTailNode - ? (renderState.tail = null) - : (lastTailNode.sibling = null); - break; - case "collapsed": - lastTailNode = renderState.tail; - for (var lastTailNode$63 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$63 = lastTailNode), - (lastTailNode = lastTailNode.sibling); - null === lastTailNode$63 - ? hasRenderedATailFallback || null === renderState.tail - ? (renderState.tail = null) - : (renderState.tail.sibling = null) - : (lastTailNode$63.sibling = null); - } -} -function bubbleProperties(completedWork) { - var didBailout = - null !== completedWork.alternate && - completedWork.alternate.child === completedWork.child, - newChildLanes = 0, - subtreeFlags = 0; - if (didBailout) - if (0 !== (completedWork.mode & 2)) { - for ( - var treeBaseDuration$65 = completedWork.selfBaseDuration, - child$66 = completedWork.child; - null !== child$66; - - ) - (newChildLanes |= child$66.lanes | child$66.childLanes), - (subtreeFlags |= child$66.subtreeFlags & 31457280), - (subtreeFlags |= child$66.flags & 31457280), - (treeBaseDuration$65 += child$66.treeBaseDuration), - (child$66 = child$66.sibling); - completedWork.treeBaseDuration = treeBaseDuration$65; - } else - for ( - treeBaseDuration$65 = completedWork.child; - null !== treeBaseDuration$65; - - ) - (newChildLanes |= - treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), - (subtreeFlags |= treeBaseDuration$65.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$65.flags & 31457280), - (treeBaseDuration$65.return = completedWork), - (treeBaseDuration$65 = treeBaseDuration$65.sibling); - else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$65 = completedWork.actualDuration; - child$66 = completedWork.selfBaseDuration; - for (var child = completedWork.child; null !== child; ) - (newChildLanes |= child.lanes | child.childLanes), - (subtreeFlags |= child.subtreeFlags), - (subtreeFlags |= child.flags), - (treeBaseDuration$65 += child.actualDuration), - (child$66 += child.treeBaseDuration), - (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$65; - completedWork.treeBaseDuration = child$66; - } else - for ( - treeBaseDuration$65 = completedWork.child; - null !== treeBaseDuration$65; - - ) - (newChildLanes |= - treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), - (subtreeFlags |= treeBaseDuration$65.subtreeFlags), - (subtreeFlags |= treeBaseDuration$65.flags), - (treeBaseDuration$65.return = completedWork), - (treeBaseDuration$65 = treeBaseDuration$65.sibling); - completedWork.subtreeFlags |= subtreeFlags; - completedWork.childLanes = newChildLanes; - return didBailout; -} -function completeWork(current, workInProgress, renderLanes) { - var newProps = workInProgress.pendingProps; - switch (workInProgress.tag) { - case 2: - case 16: - case 15: + } + return workInProgress; case 0: - case 11: - case 7: - case 8: - case 12: - case 9: - case 14: - return bubbleProperties(workInProgress), null; - case 1: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateFunctionComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 3: + case 1: return ( - (renderLanes = workInProgress.stateNode), - (newProps = null), - null !== current && (newProps = current.memoizedState.cache), - workInProgress.memoizedState.cache !== newProps && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - renderLanes.pendingContext && - ((renderLanes.context = renderLanes.pendingContext), - (renderLanes.pendingContext = null)), - (null !== current && null !== current.child) || - null === current || - (current.memoizedState.isDehydrated && - 0 === (workInProgress.flags & 256)) || - ((workInProgress.flags |= 1024), - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), - (hydrationErrors = null))), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateClassComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); + case 3: + pushHostRootContext(workInProgress); + if (null === current) + throw Error("Should have a current fiber. This is a bug in React."); + var nextProps = workInProgress.pendingProps; + context = workInProgress.memoizedState; + Component = context.element; + cloneUpdateQueue(current, workInProgress); + processUpdateQueue(workInProgress, nextProps, null, renderLanes); + nextProps = workInProgress.memoizedState; + var nextCache = nextProps.cache; + pushProvider(workInProgress, CacheContext, nextCache); + nextCache !== context.cache && + propagateContextChange(workInProgress, CacheContext, renderLanes); + suspendIfUpdateReadFromEntangledAsyncAction(); + context = nextProps.element; + context === Component + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + )) + : (reconcileChildren(current, workInProgress, context, renderLanes), + (workInProgress = workInProgress.child)); + return workInProgress; case 26: case 27: case 5: - popHostContext(workInProgress); - renderLanes = workInProgress.type; - if (null !== current && null != workInProgress.stateNode) - current.memoizedProps !== newProps && (workInProgress.flags |= 4); - else { - if (!newProps) { - if (null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." - ); - bubbleProperties(workInProgress); - return null; - } - current = { - type: renderLanes, - props: newProps, - isHidden: !1, - children: [], - internalInstanceHandle: workInProgress, - rootContainerInstance: rootInstanceStackCursor.current, - tag: "INSTANCE" - }; - a: for (renderLanes = workInProgress.child; null !== renderLanes; ) { - if (5 === renderLanes.tag || 6 === renderLanes.tag) { - newProps = renderLanes.stateNode; - var index = current.children.indexOf(newProps); - -1 !== index && current.children.splice(index, 1); - current.children.push(newProps); - } else if (4 !== renderLanes.tag && null !== renderLanes.child) { - renderLanes.child.return = renderLanes; - renderLanes = renderLanes.child; - continue; - } - if (renderLanes === workInProgress) break a; - for (; null === renderLanes.sibling; ) { - if ( - null === renderLanes.return || - renderLanes.return === workInProgress - ) - break a; - renderLanes = renderLanes.return; - } - renderLanes.sibling.return = renderLanes.return; - renderLanes = renderLanes.sibling; - } - workInProgress.stateNode = current; - } - bubbleProperties(workInProgress); - workInProgress.flags &= -16777217; - return null; + return ( + pushHostContext(workInProgress), + (Component = workInProgress.pendingProps.children), + null !== workInProgress.memoizedState && + ((context = renderWithHooks( + current, + workInProgress, + TransitionAwareHostComponent, + null, + null, + renderLanes + )), + (HostTransitionContext._currentValue2 = context), + didReceiveUpdate && + null !== current && + current.memoizedState.memoizedState !== context && + propagateContextChange( + workInProgress, + HostTransitionContext, + renderLanes + )), + markRef(current, workInProgress), + reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child + ); case 6: - if (current && null != workInProgress.stateNode) - current.memoizedProps !== newProps && (workInProgress.flags |= 4); - else { - if ("string" !== typeof newProps && null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." - ); - workInProgress.stateNode = { - text: newProps, - isHidden: !1, - tag: "TEXT" - }; - } - bubbleProperties(workInProgress); return null; case 13: - newProps = workInProgress.memoizedState; - if ( - null === current || - (null !== current.memoizedState && - null !== current.memoizedState.dehydrated) - ) { - if (null !== newProps && null !== newProps.dehydrated) { - if (null === current) { - throw Error( - "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." - ); - throw Error( - "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." - ); - } - 0 === (workInProgress.flags & 128) && - (workInProgress.memoizedState = null); - workInProgress.flags |= 4; - bubbleProperties(workInProgress); - 0 !== (workInProgress.mode & 2) && - null !== newProps && - ((index = workInProgress.child), - null !== index && - (workInProgress.treeBaseDuration -= index.treeBaseDuration)); - index = !1; - } else - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), - (index = !0); - if (!index) { - if (workInProgress.flags & 256) - return popSuspenseHandler(workInProgress), workInProgress; - popSuspenseHandler(workInProgress); - return null; - } - } - popSuspenseHandler(workInProgress); - if (0 !== (workInProgress.flags & 128)) - return ( - (workInProgress.lanes = renderLanes), - 0 !== (workInProgress.mode & 2) && - transferActualDuration(workInProgress), - workInProgress - ); - renderLanes = null !== newProps; - current = null !== current && null !== current.memoizedState; - if (renderLanes) { - newProps = workInProgress.child; - index = null; - null !== newProps.alternate && - null !== newProps.alternate.memoizedState && - null !== newProps.alternate.memoizedState.cachePool && - (index = newProps.alternate.memoizedState.cachePool.pool); - var cache$73 = null; - null !== newProps.memoizedState && - null !== newProps.memoizedState.cachePool && - (cache$73 = newProps.memoizedState.cachePool.pool); - cache$73 !== index && (newProps.flags |= 2048); - } - renderLanes !== current && - renderLanes && - (workInProgress.child.flags |= 8192); - scheduleRetryEffect(workInProgress, workInProgress.updateQueue); - bubbleProperties(workInProgress); - 0 !== (workInProgress.mode & 2) && - renderLanes && - ((current = workInProgress.child), - null !== current && - (workInProgress.treeBaseDuration -= current.treeBaseDuration)); - return null; + return updateSuspenseComponent(current, workInProgress, renderLanes); case 4: - return popHostContainer(), bubbleProperties(workInProgress), null; - case 10: return ( - popProvider(workInProgress.type._context), - bubbleProperties(workInProgress), - null + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ), + (Component = workInProgress.pendingProps), + null === current + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + Component, + renderLanes + )) + : reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child ); - case 17: + case 11: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateForwardRef( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 19: - pop(suspenseStackCursor); - index = workInProgress.memoizedState; - if (null === index) return bubbleProperties(workInProgress), null; - newProps = 0 !== (workInProgress.flags & 128); - cache$73 = index.rendering; - if (null === cache$73) - if (newProps) cutOffTailIfNeeded(index, !1); - else { - if ( - 0 !== workInProgressRootExitStatus || - (null !== current && 0 !== (current.flags & 128)) - ) - for (current = workInProgress.child; null !== current; ) { - cache$73 = findFirstSuspended(current); - if (null !== cache$73) { - workInProgress.flags |= 128; - cutOffTailIfNeeded(index, !1); - current = cache$73.updateQueue; - workInProgress.updateQueue = current; - scheduleRetryEffect(workInProgress, current); - workInProgress.subtreeFlags = 0; - current = renderLanes; - for (renderLanes = workInProgress.child; null !== renderLanes; ) - resetWorkInProgress(renderLanes, current), - (renderLanes = renderLanes.sibling); - push( - suspenseStackCursor, - (suspenseStackCursor.current & 1) | 2 - ); - return workInProgress.child; - } - current = current.sibling; - } - null !== index.tail && - now$1() > workInProgressRootRenderTargetTime && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(index, !1), - (workInProgress.lanes = 4194304)); - } - else { - if (!newProps) - if (((current = findFirstSuspended(cache$73)), null !== current)) { + case 7: + return ( + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps, + renderLanes + ), + workInProgress.child + ); + case 8: + return ( + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); + case 12: + return ( + (workInProgress.flags |= 4), + (Component = workInProgress.stateNode), + (Component.effectDuration = 0), + (Component.passiveEffectDuration = 0), + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); + case 10: + a: { + Component = workInProgress.type._context; + context = workInProgress.pendingProps; + nextProps = workInProgress.memoizedProps; + nextCache = context.value; + pushProvider(workInProgress, Component, nextCache); + if (null !== nextProps) + if (objectIs(nextProps.value, nextCache)) { if ( - ((workInProgress.flags |= 128), - (newProps = !0), - (current = current.updateQueue), - (workInProgress.updateQueue = current), - scheduleRetryEffect(workInProgress, current), - cutOffTailIfNeeded(index, !0), - null === index.tail && - "hidden" === index.tailMode && - !cache$73.alternate) - ) - return bubbleProperties(workInProgress), null; - } else - 2 * now$1() - index.renderingStartTime > - workInProgressRootRenderTargetTime && - 536870912 !== renderLanes && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(index, !1), - (workInProgress.lanes = 4194304)); - index.isBackwards - ? ((cache$73.sibling = workInProgress.child), - (workInProgress.child = cache$73)) - : ((current = index.last), - null !== current - ? (current.sibling = cache$73) - : (workInProgress.child = cache$73), - (index.last = cache$73)); - } - if (null !== index.tail) - return ( - (workInProgress = index.tail), - (index.rendering = workInProgress), - (index.tail = workInProgress.sibling), - (index.renderingStartTime = now$1()), - (workInProgress.sibling = null), - (current = suspenseStackCursor.current), - push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), - workInProgress + nextProps.children === context.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + ); + break a; + } + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes ); - bubbleProperties(workInProgress); - return null; - case 22: - case 23: + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - (newProps = null !== workInProgress.memoizedState), - null !== current - ? (null !== current.memoizedState) !== newProps && - (workInProgress.flags |= 8192) - : newProps && (workInProgress.flags |= 8192), - newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 536870912) && - 0 === (workInProgress.flags & 128) && - (bubbleProperties(workInProgress), - workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) - : bubbleProperties(workInProgress), - (renderLanes = workInProgress.updateQueue), - null !== renderLanes && - scheduleRetryEffect(workInProgress, renderLanes.retryQueue), - (renderLanes = null), - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (renderLanes = current.memoizedState.cachePool.pool), - (newProps = null), - null !== workInProgress.memoizedState && - null !== workInProgress.memoizedState.cachePool && - (newProps = workInProgress.memoizedState.cachePool.pool), - newProps !== renderLanes && (workInProgress.flags |= 2048), - null !== current && pop(resumedCache), - null + (context = workInProgress.type), + (Component = workInProgress.pendingProps.children), + prepareToReadContext(workInProgress, renderLanes), + (context = readContext(context)), + (Component = Component(context)), + (workInProgress.flags |= 1), + reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child + ); + case 14: + return ( + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), + updateMemoComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) + ); + case 15: + return updateSimpleMemoComponent( + current, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + renderLanes + ); + case 17: + return ( + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), + (workInProgress.tag = 1), + isContextProvider(Component) + ? ((current = !0), pushContextProvider(workInProgress)) + : (current = !1), + prepareToReadContext(workInProgress, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), + finishClassComponent( + null, + workInProgress, + Component, + !0, + current, + renderLanes + ) ); + case 19: + return updateSuspenseListComponent(current, workInProgress, renderLanes); + case 22: + return updateOffscreenComponent(current, workInProgress, renderLanes); case 24: return ( - (renderLanes = null), - null !== current && (renderLanes = current.memoizedState.cache), - workInProgress.memoizedState.cache !== renderLanes && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - bubbleProperties(workInProgress), - null + prepareToReadContext(workInProgress, renderLanes), + (Component = readContext(CacheContext)), + null === current + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), + (nextProps = createCache()), + (context.pooledCache = nextProps), + nextProps.refCount++, + null !== nextProps && (context.pooledCacheLanes |= renderLanes), + (context = nextProps)), + (workInProgress.memoizedState = { + parent: Component, + cache: context + }), + initializeUpdateQueue(workInProgress), + pushProvider(workInProgress, CacheContext, context)) + : (0 !== (current.lanes & renderLanes) && + (cloneUpdateQueue(current, workInProgress), + processUpdateQueue(workInProgress, null, null, renderLanes), + suspendIfUpdateReadFromEntangledAsyncAction()), + (context = current.memoizedState), + (nextProps = workInProgress.memoizedState), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), + 0 === workInProgress.lanes && + (workInProgress.memoizedState = + workInProgress.updateQueue.baseState = + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = nextProps.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && + propagateContextChange( + workInProgress, + CacheContext, + renderLanes + ))), + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child ); - case 25: - return null; } throw Error( "Unknown unit of work tag (" + @@ -5619,3238 +5390,3466 @@ function completeWork(current, workInProgress, renderLanes) { "). This error is likely caused by a bug in React. Please file an issue." ); } -function unwindWork(current, workInProgress) { - switch (workInProgress.tag) { - case 1: - return ( - isContextProvider(workInProgress.type) && popContext(), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), - 0 !== (workInProgress.mode & 2) && - transferActualDuration(workInProgress), - workInProgress) - : null - ); - case 3: - return ( - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - (current = workInProgress.flags), - 0 !== (current & 65536) && 0 === (current & 128) - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null - ); - case 26: - case 27: - case 5: - return popHostContext(workInProgress), null; - case 13: - popSuspenseHandler(workInProgress); - current = workInProgress.memoizedState; - if ( - null !== current && - null !== current.dehydrated && - null === workInProgress.alternate - ) - throw Error( - "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." - ); - current = workInProgress.flags; - return current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), - 0 !== (workInProgress.mode & 2) && - transferActualDuration(workInProgress), - workInProgress) - : null; - case 19: - return pop(suspenseStackCursor), null; - case 4: - return popHostContainer(), null; - case 10: - return popProvider(workInProgress.type._context), null; - case 22: - case 23: - return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - null !== current && pop(resumedCache), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), - 0 !== (workInProgress.mode & 2) && - transferActualDuration(workInProgress), - workInProgress) - : null - ); - case 24: - return popProvider(CacheContext), null; - case 25: - return null; - default: - return null; - } -} -function unwindInterruptedWork(current, interruptedWork) { - switch (interruptedWork.tag) { - case 1: - current = interruptedWork.type.childContextTypes; - null !== current && void 0 !== current && popContext(); - break; - case 3: - popProvider(CacheContext); - popHostContainer(); - pop(didPerformWorkStackCursor); - pop(contextStackCursor$1); - break; - case 26: - case 27: - case 5: - popHostContext(interruptedWork); - break; - case 4: - popHostContainer(); - break; - case 13: - popSuspenseHandler(interruptedWork); - break; - case 19: - pop(suspenseStackCursor); - break; - case 10: - popProvider(interruptedWork.type._context); - break; - case 22: - case 23: - popSuspenseHandler(interruptedWork); - popHiddenContext(); - null !== current && pop(resumedCache); - break; - case 24: - popProvider(CacheContext); - } +var valueCursor = createCursor(null), + currentlyRenderingFiber = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = + lastContextDependency = + currentlyRenderingFiber = + null; } -var offscreenSubtreeIsHidden = !1, - offscreenSubtreeWasHidden = !1, - PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, - nextEffect = null; -function shouldProfile(current) { - return 0 !== (current.mode & 2) && 0 !== (executionContext & 4); +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue2); + context._currentValue2 = nextValue; } -function callComponentWillUnmountWithTimer(current, instance) { - instance.props = current.memoizedProps; - instance.state = current.memoizedState; - if (shouldProfile(current)) - try { - startLayoutEffectTimer(), instance.componentWillUnmount(); - } finally { - recordLayoutEffectDuration(current); - } - else instance.componentWillUnmount(); +function popProvider(context) { + context._currentValue2 = valueCursor.current; + pop(valueCursor); } -function safelyAttachRef(current, nearestMountedAncestor) { - try { - var ref = current.ref; - if (null !== ref) { - var instance = current.stateNode; - switch (current.tag) { - case 26: - case 27: - case 5: - var instanceToUse = getPublicInstance(instance); - break; - default: - instanceToUse = instance; - } - if ("function" === typeof ref) - if (shouldProfile(current)) - try { - startLayoutEffectTimer(), (current.refCleanup = ref(instanceToUse)); - } finally { - recordLayoutEffectDuration(current); - } - else current.refCleanup = ref(instanceToUse); - else ref.current = instanceToUse; - } - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); +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 safelyDetachRef(current, nearestMountedAncestor) { - var ref = current.ref, - refCleanup = current.refCleanup; - if (null !== ref) - if ("function" === typeof refCleanup) - try { - if (shouldProfile(current)) - try { - startLayoutEffectTimer(), refCleanup(); - } finally { - recordLayoutEffectDuration(current); +function propagateContextChange(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } } - else refCleanup(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } finally { - (current.refCleanup = null), - (current = current.alternate), - null != current && (current.refCleanup = null); + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; } - else if ("function" === typeof ref) - try { - if (shouldProfile(current)) - try { - startLayoutEffectTimer(), ref(null); - } finally { - recordLayoutEffectDuration(current); - } - else ref(null); - } catch (error$89) { - captureCommitPhaseError(current, nearestMountedAncestor, error$89); + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) + throw Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } 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; } - else ref.current = null; -} -function safelyCallDestroy(current, nearestMountedAncestor, destroy) { - try { - destroy(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); + fiber = nextFiber; } } -var shouldFireAfterActiveInstanceBlur = !1; -function commitBeforeMutationEffects(root, firstChild) { - for (nextEffect = firstChild; null !== nextEffect; ) +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); +} +function readContext(context) { + return readContextForConsumer(currentlyRenderingFiber, context); +} +function readContextDuringReconcilation(consumer, context, renderLanes) { + null === currentlyRenderingFiber && + prepareToReadContext(consumer, renderLanes); + return readContextForConsumer(consumer, context); +} +function readContextForConsumer(consumer, context) { + var value = context._currentValue2; + if (lastFullyObservedContext !== context) if ( - ((root = nextEffect), - (firstChild = root.child), - 0 !== (root.subtreeFlags & 1028) && null !== firstChild) - ) - (firstChild.return = root), (nextEffect = firstChild); - else - for (; null !== nextEffect; ) { - root = nextEffect; - try { - var current = root.alternate, - flags = root.flags; - switch (root.tag) { - case 0: - break; - case 11: - case 15: - break; - case 1: - if (0 !== (flags & 1024) && null !== current) { - var prevProps = current.memoizedProps, - prevState = current.memoizedState, - instance = root.stateNode, - snapshot = instance.getSnapshotBeforeUpdate( - root.elementType === root.type - ? prevProps - : resolveDefaultProps(root.type, prevProps), - prevState - ); - instance.__reactInternalSnapshotBeforeUpdate = snapshot; + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function () { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function (type, listener) { + listeners.push(listener); } - break; - case 3: - 0 !== (flags & 1024) && - root.stateNode.containerInfo.children.splice(0); - break; - case 5: - case 26: - case 27: - case 6: - case 4: - case 17: - break; - default: - if (0 !== (flags & 1024)) - throw Error( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." - ); - } - } catch (error) { - captureCommitPhaseError(root, root.return, error); - } - firstChild = root.sibling; - if (null !== firstChild) { - firstChild.return = root.return; - nextEffect = firstChild; - break; - } - nextEffect = root.return; - } - current = shouldFireAfterActiveInstanceBlur; - shouldFireAfterActiveInstanceBlur = !1; - return current; + }); + this.abort = function () { + signal.aborted = !0; + listeners.forEach(function (listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler$1.unstable_scheduleCallback, + NormalPriority = Scheduler$1.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0 + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; } -function commitHookEffectListUnmount( - flags, - finishedWork, - nearestMountedAncestor -) { - var updateQueue = finishedWork.updateQueue; - updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; - if (null !== updateQueue) { - var effect = (updateQueue = updateQueue.next); - do { - if ((effect.tag & flags) === flags) { - var inst = effect.inst, - destroy = inst.destroy; - void 0 !== destroy && - ((inst.destroy = void 0), - safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy)); - } - effect = effect.next; - } while (effect !== updateQueue); - } +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority, function () { + cache.controller.abort(); + }); } -function commitHookEffectListMount(flags, finishedWork) { - finishedWork = finishedWork.updateQueue; - finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; - if (null !== finishedWork) { - var effect = (finishedWork = finishedWork.next); - do { - if ((effect.tag & flags) === flags) { - var create$90 = effect.create, - inst = effect.inst; - create$90 = create$90(); - inst.destroy = create$90; - } - effect = effect.next; - } while (effect !== finishedWork); - } +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +function requestCurrentTransition() { + var transition = ReactCurrentBatchConfig$1.transition; + null !== transition && transition._callbacks.add(handleAsyncAction); + return transition; } -function commitHookLayoutEffects(finishedWork, hookFlags) { - if (shouldProfile(finishedWork)) { - try { - startLayoutEffectTimer(), - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - recordLayoutEffectDuration(finishedWork); - } else - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$92) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$92); - } +function handleAsyncAction(transition, thenable) { + entangleAsyncAction(transition, thenable); } -function commitClassCallbacks(finishedWork) { - var updateQueue = finishedWork.updateQueue; - if (null !== updateQueue) { - var instance = finishedWork.stateNode; - try { - commitCallbacks(updateQueue, instance); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - } +function notifyTransitionCallbacks(transition, returnValue) { + transition._callbacks.forEach(function (callback) { + return callback(transition, returnValue); + }); } -function commitProfilerUpdate(finishedWork, current) { - if (executionContext & 4) - try { - var _finishedWork$memoize2 = finishedWork.memoizedProps, - onCommit = _finishedWork$memoize2.onCommit, - onRender = _finishedWork$memoize2.onRender, - effectDuration = finishedWork.stateNode.effectDuration; - _finishedWork$memoize2 = commitTime; - current = null === current ? "mount" : "update"; - currentUpdateIsNested && (current = "nested-update"); - "function" === typeof onRender && - onRender( - finishedWork.memoizedProps.id, - current, - finishedWork.actualDuration, - finishedWork.treeBaseDuration, - finishedWork.actualStartTime, - _finishedWork$memoize2 - ); - "function" === typeof onCommit && - onCommit( - finishedWork.memoizedProps.id, - current, - effectDuration, - _finishedWork$memoize2 - ); - enqueuePendingPassiveProfilerEffect(finishedWork); - var parentFiber = finishedWork.return; - a: for (; null !== parentFiber; ) { - switch (parentFiber.tag) { - case 3: - parentFiber.stateNode.effectDuration += effectDuration; - break a; - case 12: - parentFiber.stateNode.effectDuration += effectDuration; - break a; - } - parentFiber = parentFiber.return; - } - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } +var resumedCache = createCursor(null); +function peekCacheFromPool() { + var cacheResumedFromPreviousRender = resumedCache.current; + return null !== cacheResumedFromPreviousRender + ? cacheResumedFromPreviousRender + : workInProgressRoot.pooledCache; } -function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { - var flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 4 && commitHookLayoutEffects(finishedWork, 5); - break; - case 1: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 4) - if (((finishedRoot = finishedWork.stateNode), null === current)) - if (shouldProfile(finishedWork)) { - try { - startLayoutEffectTimer(), finishedRoot.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - recordLayoutEffectDuration(finishedWork); - } else - try { - finishedRoot.componentDidMount(); - } catch (error$93) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$93 - ); - } - else { - var prevProps = - finishedWork.elementType === finishedWork.type - ? current.memoizedProps - : resolveDefaultProps(finishedWork.type, current.memoizedProps); - current = current.memoizedState; - if (shouldProfile(finishedWork)) { - try { - startLayoutEffectTimer(), - finishedRoot.componentDidUpdate( - prevProps, - current, - finishedRoot.__reactInternalSnapshotBeforeUpdate - ); - } catch (error$94) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$94 - ); - } - recordLayoutEffectDuration(finishedWork); - } else - try { - finishedRoot.componentDidUpdate( - prevProps, - current, - finishedRoot.__reactInternalSnapshotBeforeUpdate - ); - } catch (error$95) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$95 - ); - } - } - flags & 64 && commitClassCallbacks(finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; - case 3: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { - finishedRoot = null; - if (null !== finishedWork.child) - switch (finishedWork.child.tag) { - case 27: - case 5: - finishedRoot = getPublicInstance(finishedWork.child.stateNode); - break; - case 1: - finishedRoot = finishedWork.child.stateNode; - } - try { - commitCallbacks(flags, finishedRoot); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - } - break; - case 26: - case 27: - case 5: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 4 && commitProfilerUpdate(finishedWork, current); - break; - case 13: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - break; - case 22: - if (0 !== (finishedWork.mode & 1)) { - if ( - ((prevProps = - null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), - !prevProps) - ) { - current = - (null !== current && null !== current.memoizedState) || - offscreenSubtreeWasHidden; - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevProps; - (offscreenSubtreeWasHidden = current) && - !prevOffscreenSubtreeWasHidden - ? recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - 0 !== (finishedWork.subtreeFlags & 8772) - ) - : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; - } - } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 512 && - ("manual" === finishedWork.memoizedProps.mode - ? safelyAttachRef(finishedWork, finishedWork.return) - : safelyDetachRef(finishedWork, finishedWork.return)); - break; - default: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - } +function pushTransition(offscreenWorkInProgress, prevCachePool) { + null === prevCachePool + ? push(resumedCache, resumedCache.current) + : push(resumedCache, prevCachePool.pool); } -function detachFiberAfterEffects(fiber) { - var alternate = fiber.alternate; - null !== alternate && - ((fiber.alternate = null), detachFiberAfterEffects(alternate)); - fiber.child = null; - fiber.deletions = null; - fiber.sibling = null; - fiber.stateNode = null; - fiber.return = null; - fiber.dependencies = null; - fiber.memoizedProps = null; - fiber.memoizedState = null; - fiber.pendingProps = null; - fiber.stateNode = null; - fiber.updateQueue = null; +function getSuspendedCache() { + var cacheFromPool = peekCacheFromPool(); + return null === cacheFromPool + ? null + : { parent: CacheContext._currentValue2, pool: cacheFromPool }; } -function isHostParent(fiber) { - return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; +function scheduleRetryEffect(workInProgress, retryQueue) { + null !== retryQueue + ? (workInProgress.flags |= 4) + : workInProgress.flags & 16384 && + ((retryQueue = + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), + (workInProgress.lanes |= retryQueue)); } -function getHostSibling(fiber) { - a: for (;;) { - for (; null === fiber.sibling; ) { - if (null === fiber.return || isHostParent(fiber.return)) return null; - fiber = fiber.return; - } - fiber.sibling.return = fiber.return; - for ( - fiber = fiber.sibling; - 5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag; - - ) { - if (fiber.flags & 2) continue a; - if (null === fiber.child || 4 === fiber.tag) continue a; - else (fiber.child.return = fiber), (fiber = fiber.child); - } - if (!(fiber.flags & 2)) return fiber.stateNode; +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var lastTailNode$63 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$63 = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === lastTailNode$63 + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (lastTailNode$63.sibling = null); } } -function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { - var tag = node.tag; - if (5 === tag || 6 === tag) - (node = node.stateNode), - before ? insertBefore(parent, node, before) : appendChild(parent, node); - else if (4 !== tag && ((node = node.child), null !== node)) - for ( - insertOrAppendPlacementNodeIntoContainer(node, before, parent), - node = node.sibling; - null !== node; +function bubbleProperties(completedWork) { + var didBailout = + null !== completedWork.alternate && + completedWork.alternate.child === completedWork.child, + newChildLanes = 0, + subtreeFlags = 0; + if (didBailout) + if (0 !== (completedWork.mode & 2)) { + for ( + var treeBaseDuration$65 = completedWork.selfBaseDuration, + child$66 = completedWork.child; + null !== child$66; - ) - insertOrAppendPlacementNodeIntoContainer(node, before, parent), - (node = node.sibling); -} -function insertOrAppendPlacementNode(node, before, parent) { - var tag = node.tag; - if (5 === tag || 6 === tag) - (node = node.stateNode), - before ? insertBefore(parent, node, before) : appendChild(parent, node); - else if (4 !== tag && ((node = node.child), null !== node)) + ) + (newChildLanes |= child$66.lanes | child$66.childLanes), + (subtreeFlags |= child$66.subtreeFlags & 31457280), + (subtreeFlags |= child$66.flags & 31457280), + (treeBaseDuration$65 += child$66.treeBaseDuration), + (child$66 = child$66.sibling); + completedWork.treeBaseDuration = treeBaseDuration$65; + } else + for ( + treeBaseDuration$65 = completedWork.child; + null !== treeBaseDuration$65; + + ) + (newChildLanes |= + treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), + (subtreeFlags |= treeBaseDuration$65.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$65.flags & 31457280), + (treeBaseDuration$65.return = completedWork), + (treeBaseDuration$65 = treeBaseDuration$65.sibling); + else if (0 !== (completedWork.mode & 2)) { + treeBaseDuration$65 = completedWork.actualDuration; + child$66 = completedWork.selfBaseDuration; + for (var child = completedWork.child; null !== child; ) + (newChildLanes |= child.lanes | child.childLanes), + (subtreeFlags |= child.subtreeFlags), + (subtreeFlags |= child.flags), + (treeBaseDuration$65 += child.actualDuration), + (child$66 += child.treeBaseDuration), + (child = child.sibling); + completedWork.actualDuration = treeBaseDuration$65; + completedWork.treeBaseDuration = child$66; + } else for ( - insertOrAppendPlacementNode(node, before, parent), node = node.sibling; - null !== node; + treeBaseDuration$65 = completedWork.child; + null !== treeBaseDuration$65; ) - insertOrAppendPlacementNode(node, before, parent), (node = node.sibling); + (newChildLanes |= + treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), + (subtreeFlags |= treeBaseDuration$65.subtreeFlags), + (subtreeFlags |= treeBaseDuration$65.flags), + (treeBaseDuration$65.return = completedWork), + (treeBaseDuration$65 = treeBaseDuration$65.sibling); + completedWork.subtreeFlags |= subtreeFlags; + completedWork.childLanes = newChildLanes; + return didBailout; } -var hostParent = null; -function recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - parent -) { - for (parent = parent.child; null !== parent; ) - commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), - (parent = parent.sibling); -} -function commitDeletionEffectsOnFiber( - finishedRoot, - nearestMountedAncestor, - deletedFiber -) { - if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) - try { - injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); - } catch (err) {} - switch (deletedFiber.tag) { - case 26: - case 27: - case 5: - offscreenSubtreeWasHidden || - safelyDetachRef(deletedFiber, nearestMountedAncestor); - case 6: - var prevHostParent = hostParent; - hostParent = null; - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - hostParent = prevHostParent; - null !== hostParent && - ((finishedRoot = hostParent), - (deletedFiber = finishedRoot.children.indexOf(deletedFiber.stateNode)), - finishedRoot.children.splice(deletedFiber, 1)); - break; - case 18: - null !== hostParent && shim$1(); - break; - case 4: - prevHostParent = hostParent; - hostParent = deletedFiber.stateNode.containerInfo; - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - hostParent = prevHostParent; - break; +function completeWork(current, workInProgress, renderLanes) { + var newProps = workInProgress.pendingProps; + switch (workInProgress.tag) { + case 2: + case 16: + case 15: case 0: case 11: + case 7: + case 8: + case 12: + case 9: case 14: - case 15: - if ( - !offscreenSubtreeWasHidden && - ((prevHostParent = deletedFiber.updateQueue), - null !== prevHostParent && - ((prevHostParent = prevHostParent.lastEffect), - null !== prevHostParent)) - ) { - var effect = (prevHostParent = prevHostParent.next); - do { - var tag = effect.tag, - inst = effect.inst, - destroy = inst.destroy; - void 0 !== destroy && - (0 !== (tag & 2) - ? ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - )) - : 0 !== (tag & 4) && - (shouldProfile(deletedFiber) - ? (startLayoutEffectTimer(), - (inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - ), - recordLayoutEffectDuration(deletedFiber)) - : ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - )))); - effect = effect.next; - } while (effect !== prevHostParent); - } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; + return bubbleProperties(workInProgress), null; case 1: - if ( - !offscreenSubtreeWasHidden && - (safelyDetachRef(deletedFiber, nearestMountedAncestor), - (prevHostParent = deletedFiber.stateNode), - "function" === typeof prevHostParent.componentWillUnmount) - ) - try { - callComponentWillUnmountWithTimer(deletedFiber, prevHostParent); - } catch (error) { - captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); - } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 21: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); - deletedFiber.mode & 1 - ? ((offscreenSubtreeWasHidden = - (prevHostParent = offscreenSubtreeWasHidden) || - null !== deletedFiber.memoizedState), - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ), - (offscreenSubtreeWasHidden = prevHostParent)) - : recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - default: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - } -} -function getRetryCache(finishedWork) { - switch (finishedWork.tag) { - case 13: - case 19: - var retryCache = finishedWork.stateNode; - null === retryCache && - (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); - return retryCache; - case 22: return ( - (finishedWork = finishedWork.stateNode), - (retryCache = finishedWork._retryCache), - null === retryCache && - (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), - retryCache + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null ); - default: - throw Error( - "Unexpected Suspense handler tag (" + - finishedWork.tag + - "). This is a bug in React." + case 3: + return ( + (renderLanes = workInProgress.stateNode), + (newProps = null), + null !== current && (newProps = current.memoizedState.cache), + workInProgress.memoizedState.cache !== newProps && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + renderLanes.pendingContext && + ((renderLanes.context = renderLanes.pendingContext), + (renderLanes.pendingContext = null)), + (null !== current && null !== current.child) || + null === current || + (current.memoizedState.isDehydrated && + 0 === (workInProgress.flags & 256)) || + ((workInProgress.flags |= 1024), + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), + (hydrationErrors = null))), + bubbleProperties(workInProgress), + null ); - } -} -function attachSuspenseRetryListeners(finishedWork, wakeables) { - var retryCache = getRetryCache(finishedWork); - wakeables.forEach(function (wakeable) { - var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); - retryCache.has(wakeable) || - (retryCache.add(wakeable), wakeable.then(retry, retry)); - }); -} -function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { - var deletions = parentFiber.deletions; - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - try { - var root = root$jscomp$0, - returnFiber = parentFiber, - parent = returnFiber; - a: for (; null !== parent; ) { - switch (parent.tag) { - case 27: - case 5: - hostParent = parent.stateNode; - break a; - case 3: - hostParent = parent.stateNode.containerInfo; - break a; - case 4: - hostParent = parent.stateNode.containerInfo; - break a; - } - parent = parent.return; + case 26: + case 27: + case 5: + popHostContext(workInProgress); + renderLanes = workInProgress.type; + if (null !== current && null != workInProgress.stateNode) + current.memoizedProps !== newProps && (workInProgress.flags |= 4); + else { + if (!newProps) { + if (null === workInProgress.stateNode) + throw Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ); + bubbleProperties(workInProgress); + return null; } - if (null === hostParent) - throw Error( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." - ); - commitDeletionEffectsOnFiber(root, returnFiber, childToDelete); - hostParent = null; - var alternate = childToDelete.alternate; - null !== alternate && (alternate.return = null); - childToDelete.return = null; - } catch (error) { - captureCommitPhaseError(childToDelete, parentFiber, error); - } - } - if (parentFiber.subtreeFlags & 12854) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), - (parentFiber = parentFiber.sibling); -} -function commitMutationEffectsOnFiber(finishedWork, root) { - var current = finishedWork.alternate, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - try { - commitHookEffectListUnmount(3, finishedWork, finishedWork.return), - commitHookEffectListMount(3, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - if (shouldProfile(finishedWork)) { - try { - startLayoutEffectTimer(), - commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$104) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$104 - ); + current = { + type: renderLanes, + props: newProps, + isHidden: !1, + children: [], + internalInstanceHandle: workInProgress, + rootContainerInstance: rootInstanceStackCursor.current, + tag: "INSTANCE" + }; + a: for (renderLanes = workInProgress.child; null !== renderLanes; ) { + if (5 === renderLanes.tag || 6 === renderLanes.tag) { + newProps = renderLanes.stateNode; + var index = current.children.indexOf(newProps); + -1 !== index && current.children.splice(index, 1); + current.children.push(newProps); + } else if (4 !== renderLanes.tag && null !== renderLanes.child) { + renderLanes.child.return = renderLanes; + renderLanes = renderLanes.child; + continue; } - recordLayoutEffectDuration(finishedWork); - } else - try { - commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$105) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$105 - ); + if (renderLanes === workInProgress) break a; + for (; null === renderLanes.sibling; ) { + if ( + null === renderLanes.return || + renderLanes.return === workInProgress + ) + break a; + renderLanes = renderLanes.return; } - } - break; - case 1: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - if ( - flags & 64 && - offscreenSubtreeIsHidden && - ((finishedWork = finishedWork.updateQueue), - null !== finishedWork && - ((flags = finishedWork.callbacks), null !== flags)) - ) { - var existingHiddenCallbacks = finishedWork.shared.hiddenCallbacks; - finishedWork.shared.hiddenCallbacks = - null === existingHiddenCallbacks - ? flags - : existingHiddenCallbacks.concat(flags); - } - break; - case 26: - case 27: - case 5: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - existingHiddenCallbacks = finishedWork.memoizedProps; - var type = finishedWork.type; - finishedWork.updateQueue = null; - try { - (flags.type = type), (flags.props = existingHiddenCallbacks); - } catch (error$108) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$108); + renderLanes.sibling.return = renderLanes.return; + renderLanes = renderLanes.sibling; } + workInProgress.stateNode = current; } - break; + bubbleProperties(workInProgress); + workInProgress.flags &= -16777217; + return null; case 6: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - if (null === finishedWork.stateNode) + if (current && null != workInProgress.stateNode) + current.memoizedProps !== newProps && (workInProgress.flags |= 4); + else { + if ("string" !== typeof newProps && null === workInProgress.stateNode) throw Error( - "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." ); - flags = finishedWork.stateNode; - existingHiddenCallbacks = finishedWork.memoizedProps; - try { - flags.text = existingHiddenCallbacks; - } catch (error$109) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$109); - } + workInProgress.stateNode = { + text: newProps, + isHidden: !1, + tag: "TEXT" + }; } - break; - case 3: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; - case 4: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; + bubbleProperties(workInProgress); + return null; case 13: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - finishedWork.child.flags & 8192 && - (null !== finishedWork.memoizedState) !== - (null !== current && null !== current.memoizedState) && - (globalMostRecentFallbackTime = now$1()); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); - break; - case 22: - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - existingHiddenCallbacks = null !== finishedWork.memoizedState; - var wasHidden = null !== current && null !== current.memoizedState; - if (finishedWork.mode & 1) { - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = - prevOffscreenSubtreeIsHidden || existingHiddenCallbacks; - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || wasHidden; - recursivelyTraverseMutationEffects(root, finishedWork); - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - } else recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - root = finishedWork.stateNode; - root._current = finishedWork; - root._visibility &= -3; - root._visibility |= root._pendingVisibility & 2; + newProps = workInProgress.memoizedState; if ( - flags & 8192 && - ((root._visibility = existingHiddenCallbacks - ? root._visibility & -2 - : root._visibility | 1), - existingHiddenCallbacks && - ((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), - null === current || - wasHidden || - root || - (0 !== (finishedWork.mode & 1) && - recursivelyTraverseDisappearLayoutEffects(finishedWork))), - null === finishedWork.memoizedProps || - "manual" !== finishedWork.memoizedProps.mode) - ) - a: for (current = null, wasHidden = finishedWork; ; ) { - if (5 === wasHidden.tag) { - if (null === current) { - current = wasHidden; - try { - (type = wasHidden.stateNode), - existingHiddenCallbacks - ? (type.isHidden = !0) - : (wasHidden.stateNode.isHidden = !1); - } catch (error) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error - ); - } - } - } else if (6 === wasHidden.tag) { - if (null === current) - try { - wasHidden.stateNode.isHidden = existingHiddenCallbacks - ? !0 - : !1; - } catch (error$98) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$98 - ); - } - } else if ( - ((22 !== wasHidden.tag && 23 !== wasHidden.tag) || - null === wasHidden.memoizedState || - wasHidden === finishedWork) && - null !== wasHidden.child - ) { - wasHidden.child.return = wasHidden; - wasHidden = wasHidden.child; - continue; + null === current || + (null !== current.memoizedState && + null !== current.memoizedState.dehydrated) + ) { + if (null !== newProps && null !== newProps.dehydrated) { + if (null === current) { + throw Error( + "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + ); + throw Error( + "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ); } - if (wasHidden === finishedWork) break a; - for (; null === wasHidden.sibling; ) { - if (null === wasHidden.return || wasHidden.return === finishedWork) - break a; - current === wasHidden && (current = null); - wasHidden = wasHidden.return; - } - current === wasHidden && (current = null); - wasHidden.sibling.return = wasHidden.return; - wasHidden = wasHidden.sibling; - } - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((existingHiddenCallbacks = flags.retryQueue), - null !== existingHiddenCallbacks && - ((flags.retryQueue = null), - attachSuspenseRetryListeners( - finishedWork, - existingHiddenCallbacks - )))); - break; - case 19: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); - break; - case 21: - break; - default: - recursivelyTraverseMutationEffects(root, finishedWork), - commitReconciliationEffects(finishedWork); - } -} -function commitReconciliationEffects(finishedWork) { - var flags = finishedWork.flags; - if (flags & 2) { - try { - a: { - for (var parent = finishedWork.return; null !== parent; ) { - if (isHostParent(parent)) { - var JSCompiler_inline_result = parent; - break a; - } - parent = parent.return; + 0 === (workInProgress.flags & 128) && + (workInProgress.memoizedState = null); + workInProgress.flags |= 4; + bubbleProperties(workInProgress); + 0 !== (workInProgress.mode & 2) && + null !== newProps && + ((index = workInProgress.child), + null !== index && + (workInProgress.treeBaseDuration -= index.treeBaseDuration)); + index = !1; + } else + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), + (index = !0); + if (!index) { + if (workInProgress.flags & 256) + return popSuspenseHandler(workInProgress), workInProgress; + popSuspenseHandler(workInProgress); + return null; } - throw Error( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." - ); } - switch (JSCompiler_inline_result.tag) { - case 27: - case 5: - var parent$jscomp$0 = JSCompiler_inline_result.stateNode; - JSCompiler_inline_result.flags & 32 && - (JSCompiler_inline_result.flags &= -33); - var before = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); - break; - case 3: - case 4: - var parent$99 = JSCompiler_inline_result.stateNode.containerInfo, - before$100 = getHostSibling(finishedWork); - insertOrAppendPlacementNodeIntoContainer( - finishedWork, - before$100, - parent$99 - ); - break; - default: - throw Error( - "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." - ); + popSuspenseHandler(workInProgress); + if (0 !== (workInProgress.flags & 128)) + return ( + (workInProgress.lanes = renderLanes), + 0 !== (workInProgress.mode & 2) && + transferActualDuration(workInProgress), + workInProgress + ); + renderLanes = null !== newProps; + current = null !== current && null !== current.memoizedState; + if (renderLanes) { + newProps = workInProgress.child; + index = null; + null !== newProps.alternate && + null !== newProps.alternate.memoizedState && + null !== newProps.alternate.memoizedState.cachePool && + (index = newProps.alternate.memoizedState.cachePool.pool); + var cache$73 = null; + null !== newProps.memoizedState && + null !== newProps.memoizedState.cachePool && + (cache$73 = newProps.memoizedState.cachePool.pool); + cache$73 !== index && (newProps.flags |= 2048); } - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - finishedWork.flags &= -3; - } - flags & 4096 && (finishedWork.flags &= -4097); -} -function recursivelyTraverseLayoutEffects(root, parentFiber) { - if (parentFiber.subtreeFlags & 8772) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), - (parentFiber = parentFiber.sibling); -} -function recursivelyTraverseDisappearLayoutEffects(parentFiber) { - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedWork = parentFiber; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - if (shouldProfile(finishedWork)) - try { - startLayoutEffectTimer(), - commitHookEffectListUnmount(4, finishedWork, finishedWork.return); - } finally { - recordLayoutEffectDuration(finishedWork); - } - else commitHookEffectListUnmount(4, finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 1: - safelyDetachRef(finishedWork, finishedWork.return); - var instance = finishedWork.stateNode; - if ("function" === typeof instance.componentWillUnmount) { - var current = finishedWork, - nearestMountedAncestor = finishedWork.return; - try { - callComponentWillUnmountWithTimer(current, instance); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } + renderLanes !== current && + renderLanes && + (workInProgress.child.flags |= 8192); + scheduleRetryEffect(workInProgress, workInProgress.updateQueue); + bubbleProperties(workInProgress); + 0 !== (workInProgress.mode & 2) && + renderLanes && + ((current = workInProgress.child), + null !== current && + (workInProgress.treeBaseDuration -= current.treeBaseDuration)); + return null; + case 4: + return popHostContainer(), bubbleProperties(workInProgress), null; + case 10: + return ( + popProvider(workInProgress.type._context), + bubbleProperties(workInProgress), + null + ); + case 17: + return ( + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null + ); + case 19: + pop(suspenseStackCursor); + index = workInProgress.memoizedState; + if (null === index) return bubbleProperties(workInProgress), null; + newProps = 0 !== (workInProgress.flags & 128); + cache$73 = index.rendering; + if (null === cache$73) + if (newProps) cutOffTailIfNeeded(index, !1); + else { + if ( + 0 !== workInProgressRootExitStatus || + (null !== current && 0 !== (current.flags & 128)) + ) + for (current = workInProgress.child; null !== current; ) { + cache$73 = findFirstSuspended(current); + if (null !== cache$73) { + workInProgress.flags |= 128; + cutOffTailIfNeeded(index, !1); + current = cache$73.updateQueue; + workInProgress.updateQueue = current; + scheduleRetryEffect(workInProgress, current); + workInProgress.subtreeFlags = 0; + current = renderLanes; + for (renderLanes = workInProgress.child; null !== renderLanes; ) + resetWorkInProgress(renderLanes, current), + (renderLanes = renderLanes.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & 1) | 2 + ); + return workInProgress.child; + } + current = current.sibling; + } + null !== index.tail && + now$1() > workInProgressRootRenderTargetTime && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(index, !1), + (workInProgress.lanes = 4194304)); } - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 26: - case 27: - case 5: - safelyDetachRef(finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 22: - safelyDetachRef(finishedWork, finishedWork.return); - null === finishedWork.memoizedState && - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - default: - recursivelyTraverseDisappearLayoutEffects(finishedWork); - } - parentFiber = parentFiber.sibling; - } -} -function recursivelyTraverseReappearLayoutEffects( - finishedRoot$jscomp$0, - parentFiber, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, - finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - commitHookLayoutEffects(finishedWork, 4); - break; - case 1: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - finishedRoot = finishedWork.stateNode; - if ("function" === typeof finishedRoot.componentDidMount) - try { - finishedRoot.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; - if (null !== hiddenCallbacks) - for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + else { + if (!newProps) + if (((current = findFirstSuspended(cache$73)), null !== current)) { + if ( + ((workInProgress.flags |= 128), + (newProps = !0), + (current = current.updateQueue), + (workInProgress.updateQueue = current), + scheduleRetryEffect(workInProgress, current), + cutOffTailIfNeeded(index, !0), + null === index.tail && + "hidden" === index.tailMode && + !cache$73.alternate) ) - callCallback(hiddenCallbacks[current], finishedRoot); - } - includeWorkInProgressEffects && - flags & 64 && - commitClassCallbacks(finishedWork); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 26: - case 27: - case 5: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - flags & 4 && - commitProfilerUpdate(finishedWork, current); - break; - case 13: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - break; - case 22: - null === finishedWork.memoizedState && - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - default: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects + return bubbleProperties(workInProgress), null; + } else + 2 * now$1() - index.renderingStartTime > + workInProgressRootRenderTargetTime && + 536870912 !== renderLanes && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(index, !1), + (workInProgress.lanes = 4194304)); + index.isBackwards + ? ((cache$73.sibling = workInProgress.child), + (workInProgress.child = cache$73)) + : ((current = index.last), + null !== current + ? (current.sibling = cache$73) + : (workInProgress.child = cache$73), + (index.last = cache$73)); + } + if (null !== index.tail) + return ( + (workInProgress = index.tail), + (index.rendering = workInProgress), + (index.tail = workInProgress.sibling), + (index.renderingStartTime = now$1()), + (workInProgress.sibling = null), + (current = suspenseStackCursor.current), + push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), + workInProgress ); - } - parentFiber = parentFiber.sibling; + bubbleProperties(workInProgress); + return null; + case 22: + case 23: + return ( + popSuspenseHandler(workInProgress), + popHiddenContext(), + (newProps = null !== workInProgress.memoizedState), + null !== current + ? (null !== current.memoizedState) !== newProps && + (workInProgress.flags |= 8192) + : newProps && (workInProgress.flags |= 8192), + newProps && 0 !== (workInProgress.mode & 1) + ? 0 !== (renderLanes & 536870912) && + 0 === (workInProgress.flags & 128) && + (bubbleProperties(workInProgress), + workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) + : bubbleProperties(workInProgress), + (renderLanes = workInProgress.updateQueue), + null !== renderLanes && + scheduleRetryEffect(workInProgress, renderLanes.retryQueue), + (renderLanes = null), + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (renderLanes = current.memoizedState.cachePool.pool), + (newProps = null), + null !== workInProgress.memoizedState && + null !== workInProgress.memoizedState.cachePool && + (newProps = workInProgress.memoizedState.cachePool.pool), + newProps !== renderLanes && (workInProgress.flags |= 2048), + null !== current && pop(resumedCache), + null + ); + case 24: + return ( + (renderLanes = null), + null !== current && (renderLanes = current.memoizedState.cache), + workInProgress.memoizedState.cache !== renderLanes && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + bubbleProperties(workInProgress), + null + ); + case 25: + return null; } + throw Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in React. Please file an issue." + ); } -function commitHookPassiveMountEffects(finishedWork, hookFlags) { - if (shouldProfile(finishedWork)) { - passiveEffectStartTime = now(); - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - recordPassiveEffectDuration(finishedWork); - } else - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$113) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$113); - } -} -function commitOffscreenPassiveMountEffects(current, finishedWork) { - var previousCache = null; - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (previousCache = current.memoizedState.cachePool.pool); - current = null; - null !== finishedWork.memoizedState && - null !== finishedWork.memoizedState.cachePool && - (current = finishedWork.memoizedState.cachePool.pool); - current !== previousCache && - (null != current && current.refCount++, - null != previousCache && releaseCache(previousCache)); -} -function commitCachePassiveMountEffect(current, finishedWork) { - current = null; - null !== finishedWork.alternate && - (current = finishedWork.alternate.memoizedState.cache); - finishedWork = finishedWork.memoizedState.cache; - finishedWork !== current && - (finishedWork.refCount++, null != current && releaseCache(current)); -} -function recursivelyTraversePassiveMountEffects( - root, - parentFiber, - committedLanes, - committedTransitions -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveMountOnFiber( - root, - parentFiber, - committedLanes, - committedTransitions - ), - (parentFiber = parentFiber.sibling); -} -function commitPassiveMountOnFiber( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions -) { - var flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions +function unwindWork(current, workInProgress) { + switch (workInProgress.tag) { + case 1: + return ( + isContextProvider(workInProgress.type) && popContext(), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), + 0 !== (workInProgress.mode & 2) && + transferActualDuration(workInProgress), + workInProgress) + : null ); - flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); - break; case 3: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions + return ( + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + (current = workInProgress.flags), + 0 !== (current & 65536) && 0 === (current & 128) + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null ); - flags & 2048 && - ((finishedRoot = null), - null !== finishedWork.alternate && - (finishedRoot = finishedWork.alternate.memoizedState.cache), - (finishedWork = finishedWork.memoizedState.cache), - finishedWork !== finishedRoot && - (finishedWork.refCount++, - null != finishedRoot && releaseCache(finishedRoot))); - break; + case 26: + case 27: + case 5: + return popHostContext(workInProgress), null; + case 13: + popSuspenseHandler(workInProgress); + current = workInProgress.memoizedState; + if ( + null !== current && + null !== current.dehydrated && + null === workInProgress.alternate + ) + throw Error( + "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." + ); + current = workInProgress.flags; + return current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), + 0 !== (workInProgress.mode & 2) && + transferActualDuration(workInProgress), + workInProgress) + : null; + case 19: + return pop(suspenseStackCursor), null; + case 4: + return popHostContainer(), null; + case 10: + return popProvider(workInProgress.type._context), null; + case 22: case 23: + return ( + popSuspenseHandler(workInProgress), + popHiddenContext(), + null !== current && pop(resumedCache), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), + 0 !== (workInProgress.mode & 2) && + transferActualDuration(workInProgress), + workInProgress) + : null + ); + case 24: + return popProvider(CacheContext), null; + case 25: + return null; + default: + return null; + } +} +function unwindInterruptedWork(current, interruptedWork) { + switch (interruptedWork.tag) { + case 1: + current = interruptedWork.type.childContextTypes; + null !== current && void 0 !== current && popContext(); + break; + case 3: + popProvider(CacheContext); + popHostContainer(); + pop(didPerformWorkStackCursor); + pop(contextStackCursor$1); + break; + case 26: + case 27: + case 5: + popHostContext(interruptedWork); + break; + case 4: + popHostContainer(); + break; + case 13: + popSuspenseHandler(interruptedWork); + break; + case 19: + pop(suspenseStackCursor); + break; + case 10: + popProvider(interruptedWork.type._context); break; case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) - : ((instance._visibility |= 4), - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - )) - : instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - 0 !== (finishedWork.subtreeFlags & 10256) - )); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); + case 23: + popSuspenseHandler(interruptedWork); + popHiddenContext(); + null !== current && pop(resumedCache); break; case 24: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); + popProvider(CacheContext); } } -function recursivelyTraverseReconnectPassiveEffects( - finishedRoot$jscomp$0, - parentFiber, - committedLanes$jscomp$0, - committedTransitions$jscomp$0, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - committedLanes = committedLanes$jscomp$0, - committedTransitions = committedTransitions$jscomp$0, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - commitHookPassiveMountEffects(finishedWork, 8); - break; - case 23: - break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects( - finishedRoot, - finishedWork - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )); - includeWorkInProgressEffects && - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - } - parentFiber = parentFiber.sibling; - } +var offscreenSubtreeIsHidden = !1, + offscreenSubtreeWasHidden = !1, + PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, + nextEffect = null; +function shouldProfile(current) { + return 0 !== (current.mode & 2) && 0 !== (executionContext & 4); } -function recursivelyTraverseAtomicPassiveEffects( - finishedRoot$jscomp$0, - parentFiber -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 22: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); +function callComponentWillUnmountWithTimer(current, instance) { + instance.props = current.memoizedProps; + instance.state = current.memoizedState; + if (shouldProfile(current)) + try { + startLayoutEffectTimer(), instance.componentWillUnmount(); + } finally { + recordLayoutEffectDuration(current); + } + else instance.componentWillUnmount(); +} +function safelyAttachRef(current, nearestMountedAncestor) { + try { + var ref = current.ref; + if (null !== ref) { + var instance = current.stateNode; + switch (current.tag) { + case 26: + case 27: + case 5: + var instanceToUse = getPublicInstance(instance); break; default: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + instanceToUse = instance; } - parentFiber = parentFiber.sibling; + if ("function" === typeof ref) + if (shouldProfile(current)) + try { + startLayoutEffectTimer(), (current.refCleanup = ref(instanceToUse)); + } finally { + recordLayoutEffectDuration(current); + } + else current.refCleanup = ref(instanceToUse); + else ref.current = instanceToUse; } + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } } -var suspenseyCommitFlag = 8192; -function recursivelyAccumulateSuspenseyCommit(parentFiber) { - if (parentFiber.subtreeFlags & suspenseyCommitFlag) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - accumulateSuspenseyCommitOnFiber(parentFiber), - (parentFiber = parentFiber.sibling); -} -function accumulateSuspenseyCommitOnFiber(fiber) { - switch (fiber.tag) { - case 26: - recursivelyAccumulateSuspenseyCommit(fiber); - if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) - throw Error( - "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." - ); - break; - case 5: - recursivelyAccumulateSuspenseyCommit(fiber); - break; - case 3: - case 4: - recursivelyAccumulateSuspenseyCommit(fiber); - break; - case 22: - if (null === fiber.memoizedState) { - var current = fiber.alternate; - null !== current && null !== current.memoizedState - ? ((current = suspenseyCommitFlag), - (suspenseyCommitFlag = 16777216), - recursivelyAccumulateSuspenseyCommit(fiber), - (suspenseyCommitFlag = current)) - : recursivelyAccumulateSuspenseyCommit(fiber); +function safelyDetachRef(current, nearestMountedAncestor) { + var ref = current.ref, + refCleanup = current.refCleanup; + if (null !== ref) + if ("function" === typeof refCleanup) + try { + if (shouldProfile(current)) + try { + startLayoutEffectTimer(), refCleanup(); + } finally { + recordLayoutEffectDuration(current); + } + else refCleanup(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } finally { + (current.refCleanup = null), + (current = current.alternate), + null != current && (current.refCleanup = null); } - break; - default: - recursivelyAccumulateSuspenseyCommit(fiber); - } + else if ("function" === typeof ref) + try { + if (shouldProfile(current)) + try { + startLayoutEffectTimer(), ref(null); + } finally { + recordLayoutEffectDuration(current); + } + else ref(null); + } catch (error$89) { + captureCommitPhaseError(current, nearestMountedAncestor, error$89); + } + else ref.current = null; } -function detachAlternateSiblings(parentFiber) { - var previousFiber = parentFiber.alternate; - if ( - null !== previousFiber && - ((parentFiber = previousFiber.child), null !== parentFiber) - ) { - previousFiber.child = null; - do - (previousFiber = parentFiber.sibling), - (parentFiber.sibling = null), - (parentFiber = previousFiber); - while (null !== parentFiber); +function safelyCallDestroy(current, nearestMountedAncestor, destroy) { + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); } } -function commitHookPassiveUnmountEffects( +var shouldFireAfterActiveInstanceBlur = !1; +function commitBeforeMutationEffects(root, firstChild) { + for (nextEffect = firstChild; null !== nextEffect; ) + if ( + ((root = nextEffect), + (firstChild = root.child), + 0 !== (root.subtreeFlags & 1028) && null !== firstChild) + ) + (firstChild.return = root), (nextEffect = firstChild); + else + for (; null !== nextEffect; ) { + root = nextEffect; + try { + var current = root.alternate, + flags = root.flags; + switch (root.tag) { + case 0: + break; + case 11: + case 15: + break; + case 1: + if (0 !== (flags & 1024) && null !== current) { + var prevProps = current.memoizedProps, + prevState = current.memoizedState, + instance = root.stateNode, + snapshot = instance.getSnapshotBeforeUpdate( + root.elementType === root.type + ? prevProps + : resolveDefaultProps(root.type, prevProps), + prevState + ); + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + } + break; + case 3: + 0 !== (flags & 1024) && + root.stateNode.containerInfo.children.splice(0); + break; + case 5: + case 26: + case 27: + case 6: + case 4: + case 17: + break; + default: + if (0 !== (flags & 1024)) + throw Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ); + } + } catch (error) { + captureCommitPhaseError(root, root.return, error); + } + firstChild = root.sibling; + if (null !== firstChild) { + firstChild.return = root.return; + nextEffect = firstChild; + break; + } + nextEffect = root.return; + } + current = shouldFireAfterActiveInstanceBlur; + shouldFireAfterActiveInstanceBlur = !1; + return current; +} +function commitHookEffectListUnmount( + flags, finishedWork, - nearestMountedAncestor, - hookFlags + nearestMountedAncestor ) { - shouldProfile(finishedWork) - ? ((passiveEffectStartTime = now()), - commitHookEffectListUnmount( - hookFlags, - finishedWork, - nearestMountedAncestor - ), - recordPassiveEffectDuration(finishedWork)) - : commitHookEffectListUnmount( - hookFlags, - finishedWork, - nearestMountedAncestor - ); -} -function recursivelyTraversePassiveUnmountEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); + var updateQueue = finishedWork.updateQueue; + updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; + if (null !== updateQueue) { + var effect = (updateQueue = updateQueue.next); + do { + if ((effect.tag & flags) === flags) { + var inst = effect.inst, + destroy = inst.destroy; + void 0 !== destroy && + ((inst.destroy = void 0), + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy)); } - detachAlternateSiblings(parentFiber); + effect = effect.next; + } while (effect !== updateQueue); } - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveUnmountOnFiber(parentFiber), - (parentFiber = parentFiber.sibling); } -function commitPassiveUnmountOnFiber(finishedWork) { +function commitHookEffectListMount(flags, finishedWork) { + finishedWork = finishedWork.updateQueue; + finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; + if (null !== finishedWork) { + var effect = (finishedWork = finishedWork.next); + do { + if ((effect.tag & flags) === flags) { + var create$90 = effect.create, + inst = effect.inst; + create$90 = create$90(); + inst.destroy = create$90; + } + effect = effect.next; + } while (effect !== finishedWork); + } +} +function commitHookLayoutEffects(finishedWork, hookFlags) { + if (shouldProfile(finishedWork)) { + try { + startLayoutEffectTimer(), + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + recordLayoutEffectDuration(finishedWork); + } else + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error$92) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$92); + } +} +function commitClassCallbacks(finishedWork) { + var updateQueue = finishedWork.updateQueue; + if (null !== updateQueue) { + var instance = finishedWork.stateNode; + try { + commitCallbacks(updateQueue, instance); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + } +} +function commitProfilerUpdate(finishedWork, current) { + if (executionContext & 4) + try { + var _finishedWork$memoize2 = finishedWork.memoizedProps, + onCommit = _finishedWork$memoize2.onCommit, + onRender = _finishedWork$memoize2.onRender, + effectDuration = finishedWork.stateNode.effectDuration; + _finishedWork$memoize2 = commitTime; + current = null === current ? "mount" : "update"; + currentUpdateIsNested && (current = "nested-update"); + "function" === typeof onRender && + onRender( + finishedWork.memoizedProps.id, + current, + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + _finishedWork$memoize2 + ); + "function" === typeof onCommit && + onCommit( + finishedWork.memoizedProps.id, + current, + effectDuration, + _finishedWork$memoize2 + ); + enqueuePendingPassiveProfilerEffect(finishedWork); + var parentFiber = finishedWork.return; + a: for (; null !== parentFiber; ) { + switch (parentFiber.tag) { + case 3: + parentFiber.stateNode.effectDuration += effectDuration; + break a; + case 12: + parentFiber.stateNode.effectDuration += effectDuration; + break a; + } + parentFiber = parentFiber.return; + } + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } +} +function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { + var flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: - recursivelyTraversePassiveUnmountEffects(finishedWork); - finishedWork.flags & 2048 && - commitHookPassiveUnmountEffects(finishedWork, finishedWork.return, 9); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 4 && commitHookLayoutEffects(finishedWork, 5); + break; + case 1: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 4) + if (((finishedRoot = finishedWork.stateNode), null === current)) + if (shouldProfile(finishedWork)) { + try { + startLayoutEffectTimer(), finishedRoot.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + recordLayoutEffectDuration(finishedWork); + } else + try { + finishedRoot.componentDidMount(); + } catch (error$93) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$93 + ); + } + else { + var prevProps = + finishedWork.elementType === finishedWork.type + ? current.memoizedProps + : resolveDefaultProps(finishedWork.type, current.memoizedProps); + current = current.memoizedState; + if (shouldProfile(finishedWork)) { + try { + startLayoutEffectTimer(), + finishedRoot.componentDidUpdate( + prevProps, + current, + finishedRoot.__reactInternalSnapshotBeforeUpdate + ); + } catch (error$94) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$94 + ); + } + recordLayoutEffectDuration(finishedWork); + } else + try { + finishedRoot.componentDidUpdate( + prevProps, + current, + finishedRoot.__reactInternalSnapshotBeforeUpdate + ); + } catch (error$95) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$95 + ); + } + } + flags & 64 && commitClassCallbacks(finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); + break; + case 3: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { + finishedRoot = null; + if (null !== finishedWork.child) + switch (finishedWork.child.tag) { + case 27: + case 5: + finishedRoot = getPublicInstance(finishedWork.child.stateNode); + break; + case 1: + finishedRoot = finishedWork.child.stateNode; + } + try { + commitCallbacks(flags, finishedRoot); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + } + break; + case 26: + case 27: + case 5: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); + break; + case 12: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 4 && commitProfilerUpdate(finishedWork, current); + break; + case 13: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); break; case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState && - instance._visibility & 4 && - (null === finishedWork.return || 13 !== finishedWork.return.tag) - ? ((instance._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(finishedWork)) - : recursivelyTraversePassiveUnmountEffects(finishedWork); + if (0 !== (finishedWork.mode & 1)) { + if ( + ((prevProps = + null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), + !prevProps) + ) { + current = + (null !== current && null !== current.memoizedState) || + offscreenSubtreeWasHidden; + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevProps; + (offscreenSubtreeWasHidden = current) && + !prevOffscreenSubtreeWasHidden + ? recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + 0 !== (finishedWork.subtreeFlags & 8772) + ) + : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + } + } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 512 && + ("manual" === finishedWork.memoizedProps.mode + ? safelyAttachRef(finishedWork, finishedWork.return) + : safelyDetachRef(finishedWork, finishedWork.return)); break; default: - recursivelyTraversePassiveUnmountEffects(finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); } } -function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); - } - detachAlternateSiblings(parentFiber); - } - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - deletions = parentFiber; - switch (deletions.tag) { - case 0: - case 11: - case 15: - commitHookPassiveUnmountEffects(deletions, deletions.return, 8); - recursivelyTraverseDisconnectPassiveEffects(deletions); - break; - case 22: - i = deletions.stateNode; - i._visibility & 4 && - ((i._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(deletions)); - break; - default: - recursivelyTraverseDisconnectPassiveEffects(deletions); - } - parentFiber = parentFiber.sibling; - } +function detachFiberAfterEffects(fiber) { + var alternate = fiber.alternate; + null !== alternate && + ((fiber.alternate = null), detachFiberAfterEffects(alternate)); + fiber.child = null; + fiber.deletions = null; + fiber.sibling = null; + fiber.stateNode = null; + fiber.return = null; + fiber.dependencies = null; + fiber.memoizedProps = null; + fiber.memoizedState = null; + fiber.pendingProps = null; + fiber.stateNode = null; + fiber.updateQueue = null; } -function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - deletedSubtreeRoot, - nearestMountedAncestor -) { - for (; null !== nextEffect; ) { - var fiber = nextEffect; - switch (fiber.tag) { - case 0: - case 11: - case 15: - commitHookPassiveUnmountEffects(fiber, nearestMountedAncestor, 8); - break; - case 23: - case 22: - if ( - null !== fiber.memoizedState && - null !== fiber.memoizedState.cachePool - ) { - var cache = fiber.memoizedState.cachePool.pool; - null != cache && cache.refCount++; - } - break; - case 24: - releaseCache(fiber.memoizedState.cache); +function isHostParent(fiber) { + return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; +} +function getHostSibling(fiber) { + a: for (;;) { + for (; null === fiber.sibling; ) { + if (null === fiber.return || isHostParent(fiber.return)) return null; + fiber = fiber.return; } - cache = fiber.child; - if (null !== cache) (cache.return = fiber), (nextEffect = cache); - else - a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { - cache = nextEffect; - var sibling = cache.sibling, - returnFiber = cache.return; - detachFiberAfterEffects(cache); - if (cache === fiber) { - nextEffect = null; - break a; - } - if (null !== sibling) { - sibling.return = returnFiber; - nextEffect = sibling; - break a; - } - nextEffect = returnFiber; - } + fiber.sibling.return = fiber.return; + for ( + fiber = fiber.sibling; + 5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag; + + ) { + if (fiber.flags & 2) continue a; + if (null === fiber.child || 4 === fiber.tag) continue a; + else (fiber.child.return = fiber), (fiber = fiber.child); + } + if (!(fiber.flags & 2)) return fiber.stateNode; } } -var DefaultCacheDispatcher = { - getCacheSignal: function () { - return readContext(CacheContext).controller.signal; - }, - getCacheForType: function (resourceType) { - var cache = readContext(CacheContext), - cacheForType = cache.data.get(resourceType); - void 0 === cacheForType && - ((cacheForType = resourceType()), - cache.data.set(resourceType, cacheForType)); - return cacheForType; - } - }, - PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, - executionContext = 0, - workInProgressRoot = null, - workInProgress = null, - workInProgressRootRenderLanes = 0, - workInProgressSuspendedReason = 0, - workInProgressThrownValue = null, - workInProgressRootDidAttachPingListener = !1, - entangledRenderLanes = 0, - workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, - workInProgressRootSkippedLanes = 0, - workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootPingedLanes = 0, - workInProgressDeferredLane = 0, - workInProgressRootConcurrentErrors = null, - workInProgressRootRecoverableErrors = null, - workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - globalMostRecentFallbackTime = 0, - workInProgressRootRenderTargetTime = Infinity, - workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, - legacyErrorBoundariesThatAlreadyFailed = null, - rootDoesHavePassiveEffects = !1, - rootWithPendingPassiveEffects = null, - pendingPassiveEffectsLanes = 0, - pendingPassiveProfilerEffects = [], - pendingPassiveEffectsRemainingLanes = 0, - pendingPassiveTransitions = null, - nestedUpdateCount = 0, - rootWithNestedUpdates = null; -function requestUpdateLane(fiber) { - if (0 === (fiber.mode & 1)) return 2; - if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) - return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== requestCurrentTransition()) - return ( - (fiber = currentEntangledLane), - 0 !== fiber ? fiber : requestTransitionLane() - ); - fiber = currentUpdatePriority; - return 0 !== fiber ? fiber : 32; +function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { + var tag = node.tag; + if (5 === tag || 6 === tag) + (node = node.stateNode), + before ? insertBefore(parent, node, before) : appendChild(parent, node); + else if (4 !== tag && ((node = node.child), null !== node)) + for ( + insertOrAppendPlacementNodeIntoContainer(node, before, parent), + node = node.sibling; + null !== node; + + ) + insertOrAppendPlacementNodeIntoContainer(node, before, parent), + (node = node.sibling); } -function requestDeferredLane() { - 0 === workInProgressDeferredLane && - (workInProgressDeferredLane = - 0 !== (workInProgressRootRenderLanes & 536870912) - ? 536870912 - : claimNextTransitionLane()); - var suspenseHandler = suspenseHandlerStackCursor.current; - null !== suspenseHandler && (suspenseHandler.flags |= 32); - return workInProgressDeferredLane; +function insertOrAppendPlacementNode(node, before, parent) { + var tag = node.tag; + if (5 === tag || 6 === tag) + (node = node.stateNode), + before ? insertBefore(parent, node, before) : appendChild(parent, node); + else if (4 !== tag && ((node = node.child), null !== node)) + for ( + insertOrAppendPlacementNode(node, before, parent), node = node.sibling; + null !== node; + + ) + insertOrAppendPlacementNode(node, before, parent), (node = node.sibling); } -function scheduleUpdateOnFiber(root, fiber, lane) { - if ( - (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || - null !== root.cancelPendingCommit - ) - prepareFreshStack(root, 0), - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); - markRootUpdated$1(root, lane); - if (0 === (executionContext & 2) || root !== workInProgressRoot) - root === workInProgressRoot && - (0 === (executionContext & 2) && - (workInProgressRootInterleavedUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - )), - ensureRootIsScheduled(root), - 2 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now$1() + 500), - flushSyncWorkAcrossRoots_impl(!0)); +var hostParent = null; +function recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + parent +) { + for (parent = parent.child; null !== parent; ) + commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), + (parent = parent.sibling); } -function performConcurrentWorkOnRoot(root, didTimeout) { - nestedUpdateScheduled = currentUpdateIsNested = !1; - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var originalCallbackNode = root.callbackNode; - if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) - return null; - var lanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes : 0 - ); - if (0 === lanes) return null; - var shouldTimeSlice = - !includesBlockingLane(root, lanes) && - 0 === (lanes & root.expiredLanes) && - !didTimeout; - didTimeout = shouldTimeSlice - ? renderRootConcurrent(root, lanes) - : renderRootSync(root, lanes); - if (0 !== didTimeout) { - var renderWasConcurrent = shouldTimeSlice; - do { - if (6 === didTimeout) markRootSuspended(root, lanes, 0); - else { - shouldTimeSlice = root.current.alternate; - if ( - renderWasConcurrent && - !isRenderConsistentWithExternalStores(shouldTimeSlice) - ) { - didTimeout = renderRootSync(root, lanes); - renderWasConcurrent = !1; - continue; - } - if (2 === didTimeout) { - renderWasConcurrent = lanes; - var errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - renderWasConcurrent - ); - 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), - (didTimeout = recoverFromConcurrentError( - root, - renderWasConcurrent, - errorRetryLanes - ))); +function commitDeletionEffectsOnFiber( + finishedRoot, + nearestMountedAncestor, + deletedFiber +) { + if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) + try { + injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); + } catch (err) {} + switch (deletedFiber.tag) { + case 26: + case 27: + case 5: + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); + case 6: + var prevHostParent = hostParent; + hostParent = null; + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + hostParent = prevHostParent; + null !== hostParent && + ((finishedRoot = hostParent), + (deletedFiber = finishedRoot.children.indexOf(deletedFiber.stateNode)), + finishedRoot.children.splice(deletedFiber, 1)); + break; + case 18: + null !== hostParent && shim$1(); + break; + case 4: + prevHostParent = hostParent; + hostParent = deletedFiber.stateNode.containerInfo; + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + hostParent = prevHostParent; + break; + case 0: + case 11: + case 14: + case 15: + if ( + !offscreenSubtreeWasHidden && + ((prevHostParent = deletedFiber.updateQueue), + null !== prevHostParent && + ((prevHostParent = prevHostParent.lastEffect), + null !== prevHostParent)) + ) { + var effect = (prevHostParent = prevHostParent.next); + do { + var tag = effect.tag, + inst = effect.inst, + destroy = inst.destroy; + void 0 !== destroy && + (0 !== (tag & 2) + ? ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + )) + : 0 !== (tag & 4) && + (shouldProfile(deletedFiber) + ? (startLayoutEffectTimer(), + (inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + ), + recordLayoutEffectDuration(deletedFiber)) + : ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + )))); + effect = effect.next; + } while (effect !== prevHostParent); + } + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + case 1: + if ( + !offscreenSubtreeWasHidden && + (safelyDetachRef(deletedFiber, nearestMountedAncestor), + (prevHostParent = deletedFiber.stateNode), + "function" === typeof prevHostParent.componentWillUnmount) + ) + try { + callComponentWillUnmountWithTimer(deletedFiber, prevHostParent); + } catch (error) { + captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); } - if (1 === didTimeout) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); - root.finishedWork = shouldTimeSlice; - root.finishedLanes = lanes; - a: { - renderWasConcurrent = root; - switch (didTimeout) { - case 0: - case 1: - throw Error("Root did not complete. This is a bug in React."); - case 4: - if ((lanes & 4194176) === lanes) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - break a; - } - break; - case 2: - case 3: - case 5: - break; - default: - throw Error("Unknown root exit status."); - } - if ( - (lanes & 62914560) === lanes && - ((didTimeout = globalMostRecentFallbackTime + 300 - now$1()), - 10 < didTimeout) - ) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( - commitRootWhenReady.bind( - null, - renderWasConcurrent, - shouldTimeSlice, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane - ), - didTimeout - ); - break a; - } - commitRootWhenReady( - renderWasConcurrent, - shouldTimeSlice, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + case 21: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + case 22: + safelyDetachRef(deletedFiber, nearestMountedAncestor); + deletedFiber.mode & 1 + ? ((offscreenSubtreeWasHidden = + (prevHostParent = offscreenSubtreeWasHidden) || + null !== deletedFiber.memoizedState), + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ), + (offscreenSubtreeWasHidden = prevHostParent)) + : recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber ); - } - } break; - } while (1); + default: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); } - ensureRootIsScheduled(root); - scheduleTaskForRootDuringMicrotask(root, now$1()); - root = - root.callbackNode === originalCallbackNode - ? performConcurrentWorkOnRoot.bind(null, root) - : null; - return root; } -function recoverFromConcurrentError( - root, - originallyAttemptedLanes, - errorRetryLanes -) { - var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, - JSCompiler_inline_result; - (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && - (prepareFreshStack(root, errorRetryLanes).flags |= 256); - errorRetryLanes = renderRootSync(root, errorRetryLanes); - if (2 !== errorRetryLanes) { - if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) +function getRetryCache(finishedWork) { + switch (finishedWork.tag) { + case 13: + case 19: + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); + return retryCache; + case 22: return ( - (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), - (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), - 4 + (finishedWork = finishedWork.stateNode), + (retryCache = finishedWork._retryCache), + null === retryCache && + (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), + retryCache + ); + default: + throw Error( + "Unexpected Suspense handler tag (" + + finishedWork.tag + + "). This is a bug in React." ); - root = workInProgressRootRecoverableErrors; - workInProgressRootRecoverableErrors = errorsFromFirstAttempt; - null !== root && queueRecoverableErrors(root); } - return errorRetryLanes; } -function queueRecoverableErrors(errors) { - null === workInProgressRootRecoverableErrors - ? (workInProgressRootRecoverableErrors = errors) - : workInProgressRootRecoverableErrors.push.apply( - workInProgressRootRecoverableErrors, - errors - ); -} -function commitRootWhenReady( - root, - finishedWork, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - lanes, - spawnedLane -) { - 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); - commitRoot( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane - ); +function attachSuspenseRetryListeners(finishedWork, wakeables) { + var retryCache = getRetryCache(finishedWork); + wakeables.forEach(function (wakeable) { + var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); + retryCache.has(wakeable) || + (retryCache.add(wakeable), wakeable.then(retry, retry)); + }); } -function isRenderConsistentWithExternalStores(finishedWork) { - for (var node = finishedWork; ; ) { - if (node.flags & 16384) { - var updateQueue = node.updateQueue; - if ( - null !== updateQueue && - ((updateQueue = updateQueue.stores), null !== updateQueue) - ) - for (var i = 0; i < updateQueue.length; i++) { - var check = updateQueue[i], - getSnapshot = check.getSnapshot; - check = check.value; - try { - if (!objectIs(getSnapshot(), check)) return !1; - } catch (error) { - return !1; +function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { + var deletions = parentFiber.deletions; + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + try { + var root = root$jscomp$0, + returnFiber = parentFiber, + parent = returnFiber; + a: for (; null !== parent; ) { + switch (parent.tag) { + case 27: + case 5: + hostParent = parent.stateNode; + break a; + case 3: + hostParent = parent.stateNode.containerInfo; + break a; + case 4: + hostParent = parent.stateNode.containerInfo; + break a; } + parent = parent.return; } - } - updateQueue = node.child; - if (node.subtreeFlags & 16384 && null !== updateQueue) - (updateQueue.return = node), (node = updateQueue); - else { - if (node === finishedWork) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === finishedWork) return !0; - node = node.return; + if (null === hostParent) + throw Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ); + commitDeletionEffectsOnFiber(root, returnFiber, childToDelete); + hostParent = null; + var alternate = childToDelete.alternate; + null !== alternate && (alternate.return = null); + childToDelete.return = null; + } catch (error) { + captureCommitPhaseError(childToDelete, parentFiber, error); } - node.sibling.return = node.return; - node = node.sibling; - } - } - return !0; -} -function markRootSuspended(root, suspendedLanes, spawnedLane) { - suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { - var index$3 = 31 - clz32(lanes), - lane = 1 << index$3; - expirationTimes[index$3] = -1; - lanes &= ~lane; - } - 0 !== spawnedLane && - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); -} -function flushSync(fn) { - null !== rootWithPendingPassiveEffects && - 0 === rootWithPendingPassiveEffects.tag && - 0 === (executionContext & 6) && - flushPassiveEffects(); - var prevExecutionContext = executionContext; - executionContext |= 1; - var prevTransition = ReactCurrentBatchConfig.transition, - previousPriority = currentUpdatePriority; - try { - if ( - ((ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - fn) - ) - return fn(); - } finally { - (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = prevTransition), - (executionContext = prevExecutionContext), - 0 === (executionContext & 6) && flushSyncWorkAcrossRoots_impl(!1); - } -} -function resetWorkInProgressStack() { - if (null !== workInProgress) { - if (0 === workInProgressSuspendedReason) - var interruptedWork = workInProgress.return; - else - (interruptedWork = workInProgress), - resetContextDependencies(), - resetHooksOnUnwind(interruptedWork), - (thenableState$1 = null), - (thenableIndexCounter$1 = 0), - (interruptedWork = workInProgress); - for (; null !== interruptedWork; ) - unwindInterruptedWork(interruptedWork.alternate, interruptedWork), - (interruptedWork = interruptedWork.return); - workInProgress = null; - } -} -function prepareFreshStack(root, lanes) { - root.finishedWork = null; - root.finishedLanes = 0; - var timeoutHandle = root.timeoutHandle; - -1 !== timeoutHandle && - ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); - timeoutHandle = root.cancelPendingCommit; - null !== timeoutHandle && - ((root.cancelPendingCommit = null), timeoutHandle()); - resetWorkInProgressStack(); - workInProgressRoot = root; - workInProgress = timeoutHandle = createWorkInProgress(root.current, null); - workInProgressRootRenderLanes = lanes; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; - workInProgressDeferredLane = - workInProgressRootPingedLanes = - workInProgressRootInterleavedUpdatedLanes = - workInProgressRootSkippedLanes = - 0; - workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = - null; - workInProgressRootDidIncludeRecursiveRenderUpdate = !1; - 0 === (root.current.mode & 32) && 0 !== (lanes & 8) && (lanes |= lanes & 32); - var allEntangledLanes = root.entangledLanes; - if (0 !== allEntangledLanes) - for ( - root = root.entanglements, allEntangledLanes &= lanes; - 0 < allEntangledLanes; - - ) { - var index$1 = 31 - clz32(allEntangledLanes), - lane = 1 << index$1; - lanes |= root[index$1]; - allEntangledLanes &= ~lane; } - entangledRenderLanes = lanes; - finishQueueingConcurrentUpdates(); - return timeoutHandle; -} -function handleThrow(root, thrownValue) { - currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); - workInProgressThrownValue = thrownValue; - root = workInProgress; - null === root - ? ((workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue)) - : root.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(root, !0); -} -function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; - return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; -} -function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; - return prevCacheDispatcher; + if (parentFiber.subtreeFlags & 12854) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), + (parentFiber = parentFiber.sibling); } -function renderDidSuspendDelayIfPossible() { - workInProgressRootExitStatus = 4; - (0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || - null === workInProgressRoot || - markRootSuspended( - workInProgressRoot, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); -} -function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) - (workInProgressTransitions = null), prepareFreshStack(root, lanes); - lanes = !1; - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - var unitOfWork = workInProgress, - thrownValue = workInProgressThrownValue; - switch (workInProgressSuspendedReason) { - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; - break a; - case 3: - case 2: - lanes || - null !== suspenseHandlerStackCursor.current || - (lanes = !0); - default: - (workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, unitOfWork, thrownValue); +function commitMutationEffectsOnFiber(finishedWork, root) { + var current = finishedWork.alternate, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + try { + commitHookEffectListUnmount(3, finishedWork, finishedWork.return), + commitHookEffectListMount(3, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); } + if (shouldProfile(finishedWork)) { + try { + startLayoutEffectTimer(), + commitHookEffectListUnmount(5, finishedWork, finishedWork.return); + } catch (error$104) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$104 + ); + } + recordLayoutEffectDuration(finishedWork); + } else + try { + commitHookEffectListUnmount(5, finishedWork, finishedWork.return); + } catch (error$105) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$105 + ); + } } - workLoopSync(); break; - } catch (thrownValue$118) { - handleThrow(root, thrownValue$118); - } - while (1); - lanes && root.shellSuspendCounter++; - resetContextDependencies(); - executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - if (null !== workInProgress) - throw Error( - "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." - ); - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; -} -function workLoopSync() { - for (; null !== workInProgress; ) performUnitOfWork(workInProgress); -} -function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) - (workInProgressTransitions = null), - (workInProgressRootRenderTargetTime = now$1() + 500), - prepareFreshStack(root, lanes); - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - lanes = workInProgress; - var thrownValue = workInProgressThrownValue; - b: switch (workInProgressSuspendedReason) { - case 1: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 2: - if (isThenableResolved(thrownValue)) { - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - replaySuspendedUnitOfWork(lanes); - break; - } - lanes = function () { - 2 === workInProgressSuspendedReason && - workInProgressRoot === root && - (workInProgressSuspendedReason = 7); - ensureRootIsScheduled(root); - }; - thrownValue.then(lanes, lanes); - break a; - case 3: - workInProgressSuspendedReason = 7; - break a; - case 4: - workInProgressSuspendedReason = 5; - break a; - case 7: - isThenableResolved(thrownValue) - ? ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - replaySuspendedUnitOfWork(lanes)) - : ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, lanes, thrownValue)); - break; - case 5: - switch (workInProgress.tag) { - case 5: - case 26: - case 27: - lanes = workInProgress; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - var sibling = lanes.sibling; - if (null !== sibling) workInProgress = sibling; - else { - var returnFiber = lanes.return; - null !== returnFiber - ? ((workInProgress = returnFiber), - completeUnitOfWork(returnFiber)) - : (workInProgress = null); - } - break b; - } - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 6: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; - break a; - default: - throw Error("Unexpected SuspendedReason. This is a bug in React."); + case 1: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + if ( + flags & 64 && + offscreenSubtreeIsHidden && + ((finishedWork = finishedWork.updateQueue), + null !== finishedWork && + ((flags = finishedWork.callbacks), null !== flags)) + ) { + var existingHiddenCallbacks = finishedWork.shared.hiddenCallbacks; + finishedWork.shared.hiddenCallbacks = + null === existingHiddenCallbacks + ? flags + : existingHiddenCallbacks.concat(flags); + } + break; + case 26: + case 27: + case 5: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { + existingHiddenCallbacks = finishedWork.memoizedProps; + var type = finishedWork.type; + finishedWork.updateQueue = null; + try { + (flags.type = type), (flags.props = existingHiddenCallbacks); + } catch (error$108) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$108); } } - workLoopConcurrent(); break; - } catch (thrownValue$120) { - handleThrow(root, thrownValue$120); - } - while (1); - resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - executionContext = prevExecutionContext; - if (null !== workInProgress) return 0; - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; -} -function workLoopConcurrent() { - for (; null !== workInProgress && !shouldYield(); ) - performUnitOfWork(workInProgress); -} -function performUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; - 0 !== (unitOfWork.mode & 2) - ? (startProfilerTimer(unitOfWork), - (current = beginWork(current, unitOfWork, entangledRenderLanes)), - stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) - : (current = beginWork(current, unitOfWork, entangledRenderLanes)); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - ReactCurrentOwner.current = null; -} -function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate, - isProfilingMode = 0 !== (unitOfWork.mode & 2); - isProfilingMode && startProfilerTimer(unitOfWork); - switch (unitOfWork.tag) { - case 2: - unitOfWork.tag = 0; - case 15: - case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - var context = isContextProvider(Component) - ? previousContext - : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - context, - workInProgressRootRenderLanes - ); + case 6: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + if (null === finishedWork.stateNode) + throw Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ); + flags = finishedWork.stateNode; + existingHiddenCallbacks = finishedWork.memoizedProps; + try { + flags.text = existingHiddenCallbacks; + } catch (error$109) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$109); + } + } break; - case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - unitOfWork.ref, - workInProgressRootRenderLanes - ); + case 3: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 4: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 13: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + finishedWork.child.flags & 8192 && + (null !== finishedWork.memoizedState) !== + (null !== current && null !== current.memoizedState) && + (globalMostRecentFallbackTime = now$1()); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); + break; + case 22: + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + existingHiddenCallbacks = null !== finishedWork.memoizedState; + var wasHidden = null !== current && null !== current.memoizedState; + if (finishedWork.mode & 1) { + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = + prevOffscreenSubtreeIsHidden || existingHiddenCallbacks; + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || wasHidden; + recursivelyTraverseMutationEffects(root, finishedWork); + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + } else recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + root = finishedWork.stateNode; + root._current = finishedWork; + root._visibility &= -3; + root._visibility |= root._pendingVisibility & 2; + if ( + flags & 8192 && + ((root._visibility = existingHiddenCallbacks + ? root._visibility & -2 + : root._visibility | 1), + existingHiddenCallbacks && + ((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), + null === current || + wasHidden || + root || + (0 !== (finishedWork.mode & 1) && + recursivelyTraverseDisappearLayoutEffects(finishedWork))), + null === finishedWork.memoizedProps || + "manual" !== finishedWork.memoizedProps.mode) + ) + a: for (current = null, wasHidden = finishedWork; ; ) { + if (5 === wasHidden.tag) { + if (null === current) { + current = wasHidden; + try { + (type = wasHidden.stateNode), + existingHiddenCallbacks + ? (type.isHidden = !0) + : (wasHidden.stateNode.isHidden = !1); + } catch (error) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error + ); + } + } + } else if (6 === wasHidden.tag) { + if (null === current) + try { + wasHidden.stateNode.isHidden = existingHiddenCallbacks + ? !0 + : !1; + } catch (error$98) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$98 + ); + } + } else if ( + ((22 !== wasHidden.tag && 23 !== wasHidden.tag) || + null === wasHidden.memoizedState || + wasHidden === finishedWork) && + null !== wasHidden.child + ) { + wasHidden.child.return = wasHidden; + wasHidden = wasHidden.child; + continue; + } + if (wasHidden === finishedWork) break a; + for (; null === wasHidden.sibling; ) { + if (null === wasHidden.return || wasHidden.return === finishedWork) + break a; + current === wasHidden && (current = null); + wasHidden = wasHidden.return; + } + current === wasHidden && (current = null); + wasHidden.sibling.return = wasHidden.return; + wasHidden = wasHidden.sibling; + } + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((existingHiddenCallbacks = flags.retryQueue), + null !== existingHiddenCallbacks && + ((flags.retryQueue = null), + attachSuspenseRetryListeners( + finishedWork, + existingHiddenCallbacks + )))); + break; + case 19: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); + break; + case 21: break; - case 5: - resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + recursivelyTraverseMutationEffects(root, finishedWork), + commitReconciliationEffects(finishedWork); } - isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - ReactCurrentOwner.current = null; } -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { - resetContextDependencies(); - resetHooksOnUnwind(unitOfWork); - thenableState$1 = null; - thenableIndexCounter$1 = 0; - var returnFiber = unitOfWork.return; - try { - if ( - throwException( - root, - returnFiber, - unitOfWork, - thrownValue, - workInProgressRootRenderLanes - ) - ) { - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; +function commitReconciliationEffects(finishedWork) { + var flags = finishedWork.flags; + if (flags & 2) { + try { + a: { + for (var parent = finishedWork.return; null !== parent; ) { + if (isHostParent(parent)) { + var JSCompiler_inline_result = parent; + break a; + } + parent = parent.return; + } + throw Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ); + } + switch (JSCompiler_inline_result.tag) { + case 27: + case 5: + var parent$jscomp$0 = JSCompiler_inline_result.stateNode; + JSCompiler_inline_result.flags & 32 && + (JSCompiler_inline_result.flags &= -33); + var before = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); + break; + case 3: + case 4: + var parent$99 = JSCompiler_inline_result.stateNode.containerInfo, + before$100 = getHostSibling(finishedWork); + insertOrAppendPlacementNodeIntoContainer( + finishedWork, + before$100, + parent$99 + ); + break; + default: + throw Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ); + } + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); } - } catch (error) { - if (null !== returnFiber) throw ((workInProgress = returnFiber), error); - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; + finishedWork.flags &= -3; } - if (unitOfWork.flags & 32768) - a: { - root = unitOfWork; - do { - unitOfWork = unwindWork(root.alternate, root); - if (null !== unitOfWork) { - unitOfWork.flags &= 32767; - workInProgress = unitOfWork; - break a; + flags & 4096 && (finishedWork.flags &= -4097); +} +function recursivelyTraverseLayoutEffects(root, parentFiber) { + if (parentFiber.subtreeFlags & 8772) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), + (parentFiber = parentFiber.sibling); +} +function recursivelyTraverseDisappearLayoutEffects(parentFiber) { + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedWork = parentFiber; + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + if (shouldProfile(finishedWork)) + try { + startLayoutEffectTimer(), + commitHookEffectListUnmount(4, finishedWork, finishedWork.return); + } finally { + recordLayoutEffectDuration(finishedWork); + } + else commitHookEffectListUnmount(4, finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 1: + safelyDetachRef(finishedWork, finishedWork.return); + var instance = finishedWork.stateNode; + if ("function" === typeof instance.componentWillUnmount) { + var current = finishedWork, + nearestMountedAncestor = finishedWork.return; + try { + callComponentWillUnmountWithTimer(current, instance); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } } - if (0 !== (root.mode & 2)) { - stopProfilerTimerIfRunningAndRecordDelta(root, !1); - unitOfWork = root.actualDuration; - for (thrownValue = root.child; null !== thrownValue; ) - (unitOfWork += thrownValue.actualDuration), - (thrownValue = thrownValue.sibling); - root.actualDuration = unitOfWork; + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 26: + case 27: + case 5: + safelyDetachRef(finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 22: + safelyDetachRef(finishedWork, finishedWork.return); + null === finishedWork.memoizedState && + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + default: + recursivelyTraverseDisappearLayoutEffects(finishedWork); + } + parentFiber = parentFiber.sibling; + } +} +function recursivelyTraverseReappearLayoutEffects( + finishedRoot$jscomp$0, + parentFiber, + includeWorkInProgressEffects +) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var current = parentFiber.alternate, + finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + commitHookLayoutEffects(finishedWork, 4); + break; + case 1: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + finishedRoot = finishedWork.stateNode; + if ("function" === typeof finishedRoot.componentDidMount) + try { + finishedRoot.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + current = finishedWork.updateQueue; + if (null !== current) { + var hiddenCallbacks = current.shared.hiddenCallbacks; + if (null !== hiddenCallbacks) + for ( + current.shared.hiddenCallbacks = null, current = 0; + current < hiddenCallbacks.length; + current++ + ) + callCallback(hiddenCallbacks[current], finishedRoot); } - root = root.return; - null !== root && - ((root.flags |= 32768), - (root.subtreeFlags = 0), - (root.deletions = null)); - workInProgress = root; - } while (null !== root); - workInProgressRootExitStatus = 6; - workInProgress = null; + includeWorkInProgressEffects && + flags & 64 && + commitClassCallbacks(finishedWork); + safelyAttachRef(finishedWork, finishedWork.return); + break; + case 26: + case 27: + case 5: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + case 12: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + includeWorkInProgressEffects && + flags & 4 && + commitProfilerUpdate(finishedWork, current); + break; + case 13: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + break; + case 22: + null === finishedWork.memoizedState && + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + default: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); } - else completeUnitOfWork(unitOfWork); + parentFiber = parentFiber.sibling; + } } -function completeUnitOfWork(unitOfWork) { - var completedWork = unitOfWork; - do { - var current = completedWork.alternate; - unitOfWork = completedWork.return; - 0 === (completedWork.mode & 2) - ? (current = completeWork(current, completedWork, entangledRenderLanes)) - : (startProfilerTimer(completedWork), - (current = completeWork(current, completedWork, entangledRenderLanes)), - stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); - if (null !== current) { - workInProgress = current; - return; +function commitHookPassiveMountEffects(finishedWork, hookFlags) { + if (shouldProfile(finishedWork)) { + passiveEffectStartTime = now(); + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); } - completedWork = completedWork.sibling; - if (null !== completedWork) { - workInProgress = completedWork; - return; + recordPassiveEffectDuration(finishedWork); + } else + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error$113) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$113); } - workInProgress = completedWork = unitOfWork; - } while (null !== completedWork); - 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot( +function commitOffscreenPassiveMountEffects(current, finishedWork) { + var previousCache = null; + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (previousCache = current.memoizedState.cachePool.pool); + current = null; + null !== finishedWork.memoizedState && + null !== finishedWork.memoizedState.cachePool && + (current = finishedWork.memoizedState.cachePool.pool); + current !== previousCache && + (null != current && current.refCount++, + null != previousCache && releaseCache(previousCache)); +} +function commitCachePassiveMountEffect(current, finishedWork) { + current = null; + null !== finishedWork.alternate && + (current = finishedWork.alternate.memoizedState.cache); + finishedWork = finishedWork.memoizedState.cache; + finishedWork !== current && + (finishedWork.refCount++, null != current && releaseCache(current)); +} +function recursivelyTraversePassiveMountEffects( root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane + parentFiber, + committedLanes, + committedTransitions ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; - try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - commitRootImpl( + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveMountOnFiber( root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - previousUpdateLanePriority, - spawnedLane - ); - } finally { - (ReactCurrentBatchConfig.transition = prevTransition), - (currentUpdatePriority = previousUpdateLanePriority); - } - return null; + parentFiber, + committedLanes, + committedTransitions + ), + (parentFiber = parentFiber.sibling); } -function commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - renderPriorityLevel, - spawnedLane +function commitPassiveMountOnFiber( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions ) { - do flushPassiveEffects(); - while (null !== rootWithPendingPassiveEffects); - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var finishedWork = root.finishedWork; - didIncludeRenderPhaseUpdate = root.finishedLanes; - if (null === finishedWork) return null; - root.finishedWork = null; - root.finishedLanes = 0; - if (finishedWork === root.current) - throw Error( - "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." - ); - root.callbackNode = null; - root.callbackPriority = 0; - root.cancelPendingCommit = null; - var remainingLanes = finishedWork.lanes | finishedWork.childLanes; - remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes, spawnedLane); - root === workInProgressRoot && - ((workInProgress = workInProgressRoot = null), - (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 10256) && - 0 === (finishedWork.flags & 10256)) || - rootDoesHavePassiveEffects || - ((rootDoesHavePassiveEffects = !0), - (pendingPassiveEffectsRemainingLanes = remainingLanes), - (pendingPassiveTransitions = transitions), - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - })); - transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; - spawnedLane = currentUpdatePriority; - currentUpdatePriority = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - ReactCurrentOwner.current = null; - commitBeforeMutationEffects(root, finishedWork); - commitTime = now(); - commitMutationEffectsOnFiber(finishedWork, root); - root.current = finishedWork; - commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); - requestPaint(); - executionContext = prevExecutionContext; - currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; - } else (root.current = finishedWork), (commitTime = now()); - rootDoesHavePassiveEffects - ? ((rootDoesHavePassiveEffects = !1), - (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) - : releaseRootPooledCache(root, remainingLanes); - remainingLanes = root.pendingLanes; - 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); - onCommitRoot(finishedWork.stateNode, renderPriorityLevel); - ensureRootIsScheduled(root); - if (null !== recoverableErrors) - for ( - renderPriorityLevel = root.onRecoverableError, finishedWork = 0; - finishedWork < recoverableErrors.length; - finishedWork++ - ) - (remainingLanes = recoverableErrors[finishedWork]), - (transitions = { - digest: remainingLanes.digest, - componentStack: remainingLanes.stack - }), - renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); - 0 !== (pendingPassiveEffectsLanes & 3) && - 0 !== root.tag && - flushPassiveEffects(); - remainingLanes = root.pendingLanes; - 0 !== (didIncludeRenderPhaseUpdate & 4194218) && 0 !== (remainingLanes & 42) - ? ((nestedUpdateScheduled = !0), - root === rootWithNestedUpdates - ? nestedUpdateCount++ - : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) - : (nestedUpdateCount = 0); - flushSyncWorkAcrossRoots_impl(!1); - return null; -} -function releaseRootPooledCache(root, remainingLanes) { - 0 === (root.pooledCacheLanes &= remainingLanes) && - ((remainingLanes = root.pooledCache), - null != remainingLanes && - ((root.pooledCache = null), releaseCache(remainingLanes))); -} -function flushPassiveEffects() { - if (null !== rootWithPendingPassiveEffects) { - var root = rootWithPendingPassiveEffects, - remainingLanes = pendingPassiveEffectsRemainingLanes; - pendingPassiveEffectsRemainingLanes = 0; - var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; - try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; - if (null === rootWithPendingPassiveEffects) - var JSCompiler_inline_result = !1; - else { - var transitions = pendingPassiveTransitions; - pendingPassiveTransitions = null; - priority = rootWithPendingPassiveEffects; - var lanes = pendingPassiveEffectsLanes; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsLanes = 0; - if (0 !== (executionContext & 6)) - throw Error("Cannot flush passive effects while already rendering."); - var prevExecutionContext = executionContext; - executionContext |= 4; - commitPassiveUnmountOnFiber(priority.current); - commitPassiveMountOnFiber( - priority, - priority.current, - lanes, - transitions + var flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); + break; + case 3: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + ((finishedRoot = null), + null !== finishedWork.alternate && + (finishedRoot = finishedWork.alternate.memoizedState.cache), + (finishedWork = finishedWork.memoizedState.cache), + finishedWork !== finishedRoot && + (finishedWork.refCount++, + null != finishedRoot && releaseCache(finishedRoot))); + break; + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) + : ((instance._visibility |= 4), + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + )) + : instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + 0 !== (finishedWork.subtreeFlags & 10256) + )); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork ); - transitions = pendingPassiveProfilerEffects; - pendingPassiveProfilerEffects = []; - for (lanes = 0; lanes < transitions.length; lanes++) { - var finishedWork = transitions[lanes]; - if (executionContext & 4 && 0 !== (finishedWork.flags & 4)) - switch (finishedWork.tag) { - case 12: - var passiveEffectDuration = - finishedWork.stateNode.passiveEffectDuration, - _finishedWork$memoize = finishedWork.memoizedProps, - id = _finishedWork$memoize.id, - onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$91 = commitTime, - phase = null === finishedWork.alternate ? "mount" : "update"; - currentUpdateIsNested && (phase = "nested-update"); - "function" === typeof onPostCommit && - onPostCommit(id, phase, passiveEffectDuration, commitTime$91); - var parentFiber = finishedWork.return; - b: for (; null !== parentFiber; ) { - switch (parentFiber.tag) { - case 3: - parentFiber.stateNode.passiveEffectDuration += - passiveEffectDuration; - break b; - case 12: - parentFiber.stateNode.passiveEffectDuration += - passiveEffectDuration; - break b; - } - parentFiber = parentFiber.return; - } - } - } - executionContext = prevExecutionContext; - flushSyncWorkAcrossRoots_impl(!1); - if ( - injectedHook && - "function" === typeof injectedHook.onPostCommitFiberRoot - ) - try { - injectedHook.onPostCommitFiberRoot(rendererID, priority); - } catch (err) {} - var stateNode = priority.current.stateNode; - stateNode.effectDuration = 0; - stateNode.passiveEffectDuration = 0; - JSCompiler_inline_result = !0; - } - return JSCompiler_inline_result; - } finally { - (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), - releaseRootPooledCache(root, remainingLanes); - } + break; + case 24: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); } - return !1; -} -function enqueuePendingPassiveProfilerEffect(fiber) { - pendingPassiveProfilerEffects.push(fiber); - rootDoesHavePassiveEffects || - ((rootDoesHavePassiveEffects = !0), - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - })); -} -function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); - rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); - null !== rootFiber && - (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } -function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { - if (3 === sourceFiber.tag) - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - else - for (; null !== nearestMountedAncestor; ) { - if (3 === nearestMountedAncestor.tag) { - captureCommitPhaseErrorOnRoot( - nearestMountedAncestor, - sourceFiber, - error +function recursivelyTraverseReconnectPassiveEffects( + finishedRoot$jscomp$0, + parentFiber, + committedLanes$jscomp$0, + committedTransitions$jscomp$0, + includeWorkInProgressEffects +) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + committedLanes = committedLanes$jscomp$0, + committedTransitions = committedTransitions$jscomp$0, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects ); + commitHookPassiveMountEffects(finishedWork, 8); break; - } else if (1 === nearestMountedAncestor.tag) { - var instance = nearestMountedAncestor.stateNode; - if ( - "function" === - typeof nearestMountedAncestor.type.getDerivedStateFromError || - ("function" === typeof instance.componentDidCatch && - (null === legacyErrorBoundariesThatAlreadyFailed || - !legacyErrorBoundariesThatAlreadyFailed.has(instance))) - ) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createClassErrorUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - nearestMountedAncestor = enqueueUpdate( - nearestMountedAncestor, - sourceFiber, - 2 + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects( + finishedRoot, + finishedWork + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )); + includeWorkInProgressEffects && + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork ); - null !== nearestMountedAncestor && - (markRootUpdated$1(nearestMountedAncestor, 2), - ensureRootIsScheduled(nearestMountedAncestor)); + break; + case 24: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + includeWorkInProgressEffects && + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + } + parentFiber = parentFiber.sibling; + } +} +function recursivelyTraverseAtomicPassiveEffects( + finishedRoot$jscomp$0, + parentFiber +) { + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 22: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); break; - } + case 24: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); } - nearestMountedAncestor = nearestMountedAncestor.return; + parentFiber = parentFiber.sibling; } } -function attachPingListener(root, wakeable, lanes) { - var pingCache = root.pingCache; - if (null === pingCache) { - pingCache = root.pingCache = new PossiblyWeakMap(); - var threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else - (threadIDs = pingCache.get(wakeable)), - void 0 === threadIDs && - ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); - threadIDs.has(lanes) || - ((workInProgressRootDidAttachPingListener = !0), - threadIDs.add(lanes), - (root = pingSuspendedRoot.bind(null, root, wakeable, lanes)), - wakeable.then(root, root)); -} -function pingSuspendedRoot(root, wakeable, pingedLanes) { - var pingCache = root.pingCache; - null !== pingCache && pingCache.delete(wakeable); - root.pingedLanes |= root.suspendedLanes & pingedLanes; - workInProgressRoot === root && - (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && - (4 === workInProgressRootExitStatus || - (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes && - 300 > now$1() - globalMostRecentFallbackTime) - ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) - : (workInProgressRootPingedLanes |= pingedLanes)); - ensureRootIsScheduled(root); -} -function retryTimedOutBoundary(boundaryFiber, retryLane) { - 0 === retryLane && - (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); - boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); - null !== boundaryFiber && - (markRootUpdated$1(boundaryFiber, retryLane), - ensureRootIsScheduled(boundaryFiber)); -} -function retryDehydratedSuspenseBoundary(boundaryFiber) { - var suspenseState = boundaryFiber.memoizedState, - retryLane = 0; - null !== suspenseState && (retryLane = suspenseState.retryLane); - retryTimedOutBoundary(boundaryFiber, retryLane); +var suspenseyCommitFlag = 8192; +function recursivelyAccumulateSuspenseyCommit(parentFiber) { + if (parentFiber.subtreeFlags & suspenseyCommitFlag) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + accumulateSuspenseyCommitOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); } -function resolveRetryWakeable(boundaryFiber, wakeable) { - var retryLane = 0; - switch (boundaryFiber.tag) { - case 13: - var retryCache = boundaryFiber.stateNode; - var suspenseState = boundaryFiber.memoizedState; - null !== suspenseState && (retryLane = suspenseState.retryLane); +function accumulateSuspenseyCommitOnFiber(fiber) { + switch (fiber.tag) { + case 26: + recursivelyAccumulateSuspenseyCommit(fiber); + if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) + throw Error( + "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." + ); break; - case 19: - retryCache = boundaryFiber.stateNode; + case 5: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 3: + case 4: + recursivelyAccumulateSuspenseyCommit(fiber); break; case 22: - retryCache = boundaryFiber.stateNode._retryCache; + if (null === fiber.memoizedState) { + var current = fiber.alternate; + null !== current && null !== current.memoizedState + ? ((current = suspenseyCommitFlag), + (suspenseyCommitFlag = 16777216), + recursivelyAccumulateSuspenseyCommit(fiber), + (suspenseyCommitFlag = current)) + : recursivelyAccumulateSuspenseyCommit(fiber); + } break; default: - throw Error( - "Pinged unknown suspense boundary type. This is probably a bug in React." - ); + recursivelyAccumulateSuspenseyCommit(fiber); } - null !== retryCache && retryCache.delete(wakeable); - retryTimedOutBoundary(boundaryFiber, retryLane); } -var beginWork; -beginWork = function (current, workInProgress, renderLanes) { - if (null !== current) - if ( - current.memoizedProps !== workInProgress.pendingProps || - didPerformWorkStackCursor.current - ) - didReceiveUpdate = !0; - else { - if ( - 0 === (current.lanes & renderLanes) && - 0 === (workInProgress.flags & 128) - ) - return ( - (didReceiveUpdate = !1), - attemptEarlyBailoutIfNoScheduledUpdate( - current, - workInProgress, - renderLanes - ) - ); - didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; - } - else didReceiveUpdate = !1; - workInProgress.lanes = 0; - switch (workInProgress.tag) { - case 2: - var Component = workInProgress.type; - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - var context = getMaskedContext( - workInProgress, - contextStackCursor$1.current - ); - prepareToReadContext(workInProgress, renderLanes); - current = renderWithHooks( - null, - workInProgress, - Component, - current, - context, - renderLanes +function detachAlternateSiblings(parentFiber) { + var previousFiber = parentFiber.alternate; + if ( + null !== previousFiber && + ((parentFiber = previousFiber.child), null !== parentFiber) + ) { + previousFiber.child = null; + do + (previousFiber = parentFiber.sibling), + (parentFiber.sibling = null), + (parentFiber = previousFiber); + while (null !== parentFiber); + } +} +function commitHookPassiveUnmountEffects( + finishedWork, + nearestMountedAncestor, + hookFlags +) { + shouldProfile(finishedWork) + ? ((passiveEffectStartTime = now()), + commitHookEffectListUnmount( + hookFlags, + finishedWork, + nearestMountedAncestor + ), + recordPassiveEffectDuration(finishedWork)) + : commitHookEffectListUnmount( + hookFlags, + finishedWork, + nearestMountedAncestor ); - workInProgress.flags |= 1; - workInProgress.tag = 0; - reconcileChildren(null, workInProgress, current, renderLanes); - workInProgress = workInProgress.child; - return workInProgress; - case 16: - Component = workInProgress.elementType; - a: { - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - context = Component._init; - Component = context(Component._payload); - workInProgress.type = Component; - context = workInProgress.tag = resolveLazyComponentTag(Component); - current = resolveDefaultProps(Component, current); - switch (context) { - case 0: - workInProgress = updateFunctionComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 1: - workInProgress = updateClassComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 11: - workInProgress = updateForwardRef( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 14: - workInProgress = updateMemoComponent( - null, - workInProgress, - Component, - resolveDefaultProps(Component.type, current), - renderLanes - ); - break a; - } - throw Error( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." +} +function recursivelyTraversePassiveUnmountEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber ); } - return workInProgress; + detachAlternateSiblings(parentFiber); + } + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveUnmountOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); +} +function commitPassiveUnmountOnFiber(finishedWork) { + switch (finishedWork.tag) { case 0: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateFunctionComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 1: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateClassComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 3: - pushHostRootContext(workInProgress); - if (null === current) - throw Error("Should have a current fiber. This is a bug in React."); - var nextProps = workInProgress.pendingProps; - context = workInProgress.memoizedState; - Component = context.element; - cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, nextProps, null, renderLanes); - nextProps = workInProgress.memoizedState; - var nextCache = nextProps.cache; - pushProvider(workInProgress, CacheContext, nextCache); - nextCache !== context.cache && - propagateContextChange(workInProgress, CacheContext, renderLanes); - suspendIfUpdateReadFromEntangledAsyncAction(); - context = nextProps.element; - context === Component - ? (workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - )) - : (reconcileChildren(current, workInProgress, context, renderLanes), - (workInProgress = workInProgress.child)); - return workInProgress; - case 26: - case 27: - case 5: - return ( - pushHostContext(workInProgress), - (Component = workInProgress.pendingProps.children), - null !== workInProgress.memoizedState && - ((context = renderWithHooks( - current, - workInProgress, - TransitionAwareHostComponent, - null, - null, - renderLanes - )), - (HostTransitionContext._currentValue2 = context), - didReceiveUpdate && - null !== current && - current.memoizedState.memoizedState !== context && - propagateContextChange( - workInProgress, - HostTransitionContext, - renderLanes - )), - markRef(current, workInProgress), - reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child + case 11: + case 15: + recursivelyTraversePassiveUnmountEffects(finishedWork); + finishedWork.flags & 2048 && + commitHookPassiveUnmountEffects(finishedWork, finishedWork.return, 9); + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState && + instance._visibility & 4 && + (null === finishedWork.return || 13 !== finishedWork.return.tag) + ? ((instance._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(finishedWork)) + : recursivelyTraversePassiveUnmountEffects(finishedWork); + break; + default: + recursivelyTraversePassiveUnmountEffects(finishedWork); + } +} +function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber + ); + } + detachAlternateSiblings(parentFiber); + } + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + deletions = parentFiber; + switch (deletions.tag) { + case 0: + case 11: + case 15: + commitHookPassiveUnmountEffects(deletions, deletions.return, 8); + recursivelyTraverseDisconnectPassiveEffects(deletions); + break; + case 22: + i = deletions.stateNode; + i._visibility & 4 && + ((i._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(deletions)); + break; + default: + recursivelyTraverseDisconnectPassiveEffects(deletions); + } + parentFiber = parentFiber.sibling; + } +} +function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + deletedSubtreeRoot, + nearestMountedAncestor +) { + for (; null !== nextEffect; ) { + var fiber = nextEffect; + switch (fiber.tag) { + case 0: + case 11: + case 15: + commitHookPassiveUnmountEffects(fiber, nearestMountedAncestor, 8); + break; + case 23: + case 22: + if ( + null !== fiber.memoizedState && + null !== fiber.memoizedState.cachePool + ) { + var cache = fiber.memoizedState.cachePool.pool; + null != cache && cache.refCount++; + } + break; + case 24: + releaseCache(fiber.memoizedState.cache); + } + cache = fiber.child; + if (null !== cache) (cache.return = fiber), (nextEffect = cache); + else + a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { + cache = nextEffect; + var sibling = cache.sibling, + returnFiber = cache.return; + detachFiberAfterEffects(cache); + if (cache === fiber) { + nextEffect = null; + break a; + } + if (null !== sibling) { + sibling.return = returnFiber; + nextEffect = sibling; + break a; + } + nextEffect = returnFiber; + } + } +} +var DefaultCacheDispatcher = { + getCacheSignal: function () { + return readContext(CacheContext).controller.signal; + }, + getCacheForType: function (resourceType) { + var cache = readContext(CacheContext), + cacheForType = cache.data.get(resourceType); + void 0 === cacheForType && + ((cacheForType = resourceType()), + cache.data.set(resourceType, cacheForType)); + return cacheForType; + } + }, + PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + executionContext = 0, + workInProgressRoot = null, + workInProgress = null, + workInProgressRootRenderLanes = 0, + workInProgressSuspendedReason = 0, + workInProgressThrownValue = null, + workInProgressRootDidAttachPingListener = !1, + entangledRenderLanes = 0, + workInProgressRootExitStatus = 0, + workInProgressRootFatalError = null, + workInProgressRootSkippedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, + workInProgressRootDidIncludeRecursiveRenderUpdate = !1, + globalMostRecentFallbackTime = 0, + workInProgressRootRenderTargetTime = Infinity, + workInProgressTransitions = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsLanes = 0, + pendingPassiveProfilerEffects = [], + pendingPassiveEffectsRemainingLanes = 0, + pendingPassiveTransitions = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null; +function requestUpdateLane(fiber) { + if (0 === (fiber.mode & 1)) return 2; + if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) + return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; + if (null !== requestCurrentTransition()) + return ( + (fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane() + ); + fiber = currentUpdatePriority; + return 0 !== fiber ? fiber : 32; +} +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : claimNextTransitionLane()); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); + return workInProgressDeferredLane; +} +function scheduleUpdateOnFiber(root, fiber, lane) { + if ( + (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || + null !== root.cancelPendingCommit + ) + prepareFreshStack(root, 0), + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane ); - case 6: - return null; - case 13: - return updateSuspenseComponent(current, workInProgress, renderLanes); - case 4: - return ( - pushHostContainer( - workInProgress, - workInProgress.stateNode.containerInfo - ), - (Component = workInProgress.pendingProps), - null === current - ? (workInProgress.child = reconcileChildFibers( - workInProgress, - null, - Component, - renderLanes - )) - : reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child + markRootUpdated$1(root, lane); + if (0 === (executionContext & 2) || root !== workInProgressRoot) + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )), + ensureRootIsScheduled(root), + 2 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now$1() + 500), + flushSyncWorkAcrossRoots_impl(!0)); +} +function performConcurrentWorkOnRoot(root, didTimeout) { + nestedUpdateScheduled = currentUpdateIsNested = !1; + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var originalCallbackNode = root.callbackNode; + if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) + return null; + var lanes = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes : 0 + ); + if (0 === lanes) return null; + var shouldTimeSlice = + !includesBlockingLane(root, lanes) && + 0 === (lanes & root.expiredLanes) && + !didTimeout; + didTimeout = shouldTimeSlice + ? renderRootConcurrent(root, lanes) + : renderRootSync(root, lanes); + if (0 !== didTimeout) { + var renderWasConcurrent = shouldTimeSlice; + do { + if (6 === didTimeout) markRootSuspended(root, lanes, 0); + else { + shouldTimeSlice = root.current.alternate; + if ( + renderWasConcurrent && + !isRenderConsistentWithExternalStores(shouldTimeSlice) + ) { + didTimeout = renderRootSync(root, lanes); + renderWasConcurrent = !1; + continue; + } + if (2 === didTimeout) { + renderWasConcurrent = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + renderWasConcurrent + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (didTimeout = recoverFromConcurrentError( + root, + renderWasConcurrent, + errorRetryLanes + ))); + } + if (1 === didTimeout) + throw ( + ((originalCallbackNode = workInProgressRootFatalError), + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + originalCallbackNode) + ); + root.finishedWork = shouldTimeSlice; + root.finishedLanes = lanes; + a: { + renderWasConcurrent = root; + switch (didTimeout) { + case 0: + case 1: + throw Error("Root did not complete. This is a bug in React."); + case 4: + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + break a; + } + break; + case 2: + case 3: + case 5: + break; + default: + throw Error("Unknown root exit status."); + } + if ( + (lanes & 62914560) === lanes && + ((didTimeout = globalMostRecentFallbackTime + 300 - now$1()), + 10 < didTimeout) + ) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; + renderWasConcurrent.timeoutHandle = scheduleTimeout( + commitRootWhenReady.bind( + null, + renderWasConcurrent, + shouldTimeSlice, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ), + didTimeout + ); + break a; + } + commitRootWhenReady( + renderWasConcurrent, + shouldTimeSlice, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ); + } + } + break; + } while (1); + } + ensureRootIsScheduled(root); + scheduleTaskForRootDuringMicrotask(root, now$1()); + root = + root.callbackNode === originalCallbackNode + ? performConcurrentWorkOnRoot.bind(null, root) + : null; + return root; +} +function recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes +) { + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, + JSCompiler_inline_result; + (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && + (prepareFreshStack(root, errorRetryLanes).flags |= 256); + errorRetryLanes = renderRootSync(root, errorRetryLanes); + if (2 !== errorRetryLanes) { + if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) + return ( + (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), + (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), + 4 + ); + root = workInProgressRootRecoverableErrors; + workInProgressRootRecoverableErrors = errorsFromFirstAttempt; + null !== root && queueRecoverableErrors(root); + } + return errorRetryLanes; +} +function queueRecoverableErrors(errors) { + null === workInProgressRootRecoverableErrors + ? (workInProgressRootRecoverableErrors = errors) + : workInProgressRootRecoverableErrors.push.apply( + workInProgressRootRecoverableErrors, + errors + ); +} +function commitRootWhenReady( + root, + finishedWork, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + lanes, + spawnedLane +) { + 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); + commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane + ); +} +function isRenderConsistentWithExternalStores(finishedWork) { + for (var node = finishedWork; ; ) { + if (node.flags & 16384) { + var updateQueue = node.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.stores), null !== updateQueue) + ) + for (var i = 0; i < updateQueue.length; i++) { + var check = updateQueue[i], + getSnapshot = check.getSnapshot; + check = check.value; + try { + if (!objectIs(getSnapshot(), check)) return !1; + } catch (error) { + return !1; + } + } + } + updateQueue = node.child; + if (node.subtreeFlags & 16384 && null !== updateQueue) + (updateQueue.return = node), (node = updateQueue); + else { + if (node === finishedWork) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === finishedWork) return !0; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return !0; +} +function markRootSuspended(root, suspendedLanes, spawnedLane) { + suspendedLanes &= ~workInProgressRootPingedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$3 = 31 - clz32(lanes), + lane = 1 << index$3; + expirationTimes[index$3] = -1; + lanes &= ~lane; + } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); +} +function flushSync(fn) { + null !== rootWithPendingPassiveEffects && + 0 === rootWithPendingPassiveEffects.tag && + 0 === (executionContext & 6) && + flushPassiveEffects(); + var prevExecutionContext = executionContext; + executionContext |= 1; + var prevTransition = ReactCurrentBatchConfig.transition, + previousPriority = currentUpdatePriority; + try { + if ( + ((ReactCurrentBatchConfig.transition = null), + (currentUpdatePriority = 2), + fn) + ) + return fn(); + } finally { + (currentUpdatePriority = previousPriority), + (ReactCurrentBatchConfig.transition = prevTransition), + (executionContext = prevExecutionContext), + 0 === (executionContext & 6) && flushSyncWorkAcrossRoots_impl(!1); + } +} +function resetWorkInProgressStack() { + if (null !== workInProgress) { + if (0 === workInProgressSuspendedReason) + var interruptedWork = workInProgress.return; + else + (interruptedWork = workInProgress), + resetContextDependencies(), + resetHooksOnUnwind(interruptedWork), + (thenableState$1 = null), + (thenableIndexCounter$1 = 0), + (interruptedWork = workInProgress); + for (; null !== interruptedWork; ) + unwindInterruptedWork(interruptedWork.alternate, interruptedWork), + (interruptedWork = interruptedWork.return); + workInProgress = null; + } +} +function prepareFreshStack(root, lanes) { + root.finishedWork = null; + root.finishedLanes = 0; + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + timeoutHandle = root.cancelPendingCommit; + null !== timeoutHandle && + ((root.cancelPendingCommit = null), timeoutHandle()); + resetWorkInProgressStack(); + workInProgressRoot = root; + workInProgress = timeoutHandle = createWorkInProgress(root.current, null); + workInProgressRootRenderLanes = lanes; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + workInProgressRootDidAttachPingListener = !1; + workInProgressRootExitStatus = 0; + workInProgressRootFatalError = null; + workInProgressDeferredLane = + workInProgressRootPingedLanes = + workInProgressRootInterleavedUpdatedLanes = + workInProgressRootSkippedLanes = + 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = + null; + workInProgressRootDidIncludeRecursiveRenderUpdate = !1; + 0 === (root.current.mode & 32) && 0 !== (lanes & 8) && (lanes |= lanes & 32); + var allEntangledLanes = root.entangledLanes; + if (0 !== allEntangledLanes) + for ( + root = root.entanglements, allEntangledLanes &= lanes; + 0 < allEntangledLanes; + + ) { + var index$1 = 31 - clz32(allEntangledLanes), + lane = 1 << index$1; + lanes |= root[index$1]; + allEntangledLanes &= ~lane; + } + entangledRenderLanes = lanes; + finishQueueingConcurrentUpdates(); + return timeoutHandle; +} +function handleThrow(root, thrownValue) { + currentlyRenderingFiber$1 = null; + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactCurrentOwner.current = null; + thrownValue === SuspenseException + ? ((thrownValue = getSuspendedThenable()), + (root = suspenseHandlerStackCursor.current), + (workInProgressSuspendedReason = + (null !== root && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + root !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2)) + : thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); + workInProgressThrownValue = thrownValue; + root = workInProgress; + null === root + ? ((workInProgressRootExitStatus = 1), + (workInProgressRootFatalError = thrownValue)) + : root.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(root, !0); +} +function pushDispatcher() { + var prevDispatcher = ReactCurrentDispatcher.current; + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; +} +function pushCacheDispatcher() { + var prevCacheDispatcher = ReactCurrentCache.current; + ReactCurrentCache.current = DefaultCacheDispatcher; + return prevCacheDispatcher; +} +function renderDidSuspendDelayIfPossible() { + workInProgressRootExitStatus = 4; + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); +} +function renderRootSync(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) + (workInProgressTransitions = null), prepareFreshStack(root, lanes); + lanes = !1; + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + var unitOfWork = workInProgress, + thrownValue = workInProgressThrownValue; + switch (workInProgressSuspendedReason) { + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + case 3: + case 2: + lanes || + null !== suspenseHandlerStackCursor.current || + (lanes = !0); + default: + (workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, unitOfWork, thrownValue); + } + } + workLoopSync(); + break; + } catch (thrownValue$118) { + handleThrow(root, thrownValue$118); + } + while (1); + lanes && root.shellSuspendCounter++; + resetContextDependencies(); + executionContext = prevExecutionContext; + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + if (null !== workInProgress) + throw Error( + "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." + ); + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; +} +function workLoopSync() { + for (; null !== workInProgress; ) performUnitOfWork(workInProgress); +} +function renderRootConcurrent(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) + (workInProgressTransitions = null), + (workInProgressRootRenderTargetTime = now$1() + 500), + prepareFreshStack(root, lanes); + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + lanes = workInProgress; + var thrownValue = workInProgressThrownValue; + b: switch (workInProgressSuspendedReason) { + case 1: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 2: + if (isThenableResolved(thrownValue)) { + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + replaySuspendedUnitOfWork(lanes); + break; + } + lanes = function () { + 2 === workInProgressSuspendedReason && + workInProgressRoot === root && + (workInProgressSuspendedReason = 7); + ensureRootIsScheduled(root); + }; + thrownValue.then(lanes, lanes); + break a; + case 3: + workInProgressSuspendedReason = 7; + break a; + case 4: + workInProgressSuspendedReason = 5; + break a; + case 7: + isThenableResolved(thrownValue) + ? ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + replaySuspendedUnitOfWork(lanes)) + : ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, lanes, thrownValue)); + break; + case 5: + switch (workInProgress.tag) { + case 5: + case 26: + case 27: + lanes = workInProgress; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + var sibling = lanes.sibling; + if (null !== sibling) workInProgress = sibling; + else { + var returnFiber = lanes.return; + null !== returnFiber + ? ((workInProgress = returnFiber), + completeUnitOfWork(returnFiber)) + : (workInProgress = null); + } + break b; + } + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 6: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + default: + throw Error("Unexpected SuspendedReason. This is a bug in React."); + } + } + workLoopConcurrent(); + break; + } catch (thrownValue$120) { + handleThrow(root, thrownValue$120); + } + while (1); + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + executionContext = prevExecutionContext; + if (null !== workInProgress) return 0; + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; +} +function workLoopConcurrent() { + for (; null !== workInProgress && !shouldYield(); ) + performUnitOfWork(workInProgress); +} +function performUnitOfWork(unitOfWork) { + var current = unitOfWork.alternate; + 0 !== (unitOfWork.mode & 2) + ? (startProfilerTimer(unitOfWork), + (current = beginWork(current, unitOfWork, entangledRenderLanes)), + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) + : (current = beginWork(current, unitOfWork, entangledRenderLanes)); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current + ? completeUnitOfWork(unitOfWork) + : (workInProgress = current); + ReactCurrentOwner.current = null; +} +function replaySuspendedUnitOfWork(unitOfWork) { + var current = unitOfWork.alternate, + isProfilingMode = 0 !== (unitOfWork.mode & 2); + isProfilingMode && startProfilerTimer(unitOfWork); + switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; + case 15: + case 0: + var Component = unitOfWork.type, + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor$1.current; + context = getMaskedContext(unitOfWork, context); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + context, + workInProgressRootRenderLanes ); + break; case 11: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateForwardRef( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 7: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps, - renderLanes - ), - workInProgress.child - ); - case 8: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child + Component = unitOfWork.type.render; + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + unitOfWork.ref, + workInProgressRootRenderLanes ); - case 12: - return ( - (workInProgress.flags |= 4), - (Component = workInProgress.stateNode), - (Component.effectDuration = 0), - (Component.passiveEffectDuration = 0), - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child + break; + case 5: + resetHooksOnUnwind(unitOfWork); + default: + unwindInterruptedWork(current, unitOfWork), + (unitOfWork = workInProgress = + resetWorkInProgress(unitOfWork, entangledRenderLanes)), + (current = beginWork(current, unitOfWork, entangledRenderLanes)); + } + isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current + ? completeUnitOfWork(unitOfWork) + : (workInProgress = current); + ReactCurrentOwner.current = null; +} +function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + resetContextDependencies(); + resetHooksOnUnwind(unitOfWork); + thenableState$1 = null; + thenableIndexCounter$1 = 0; + var returnFiber = unitOfWork.return; + try { + if ( + throwException( + root, + returnFiber, + unitOfWork, + thrownValue, + workInProgressRootRenderLanes + ) + ) { + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + } catch (error) { + if (null !== returnFiber) throw ((workInProgress = returnFiber), error); + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + if (unitOfWork.flags & 32768) + a: { + root = unitOfWork; + do { + unitOfWork = unwindWork(root.alternate, root); + if (null !== unitOfWork) { + unitOfWork.flags &= 32767; + workInProgress = unitOfWork; + break a; + } + if (0 !== (root.mode & 2)) { + stopProfilerTimerIfRunningAndRecordDelta(root, !1); + unitOfWork = root.actualDuration; + for (thrownValue = root.child; null !== thrownValue; ) + (unitOfWork += thrownValue.actualDuration), + (thrownValue = thrownValue.sibling); + root.actualDuration = unitOfWork; + } + root = root.return; + null !== root && + ((root.flags |= 32768), + (root.subtreeFlags = 0), + (root.deletions = null)); + workInProgress = root; + } while (null !== root); + workInProgressRootExitStatus = 6; + workInProgress = null; + } + else completeUnitOfWork(unitOfWork); +} +function completeUnitOfWork(unitOfWork) { + var completedWork = unitOfWork; + do { + var current = completedWork.alternate; + unitOfWork = completedWork.return; + 0 === (completedWork.mode & 2) + ? (current = completeWork(current, completedWork, entangledRenderLanes)) + : (startProfilerTimer(completedWork), + (current = completeWork(current, completedWork, entangledRenderLanes)), + stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); + if (null !== current) { + workInProgress = current; + return; + } + completedWork = completedWork.sibling; + if (null !== completedWork) { + workInProgress = completedWork; + return; + } + workInProgress = completedWork = unitOfWork; + } while (null !== completedWork); + 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); +} +function commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane +) { + var previousUpdateLanePriority = currentUpdatePriority, + prevTransition = ReactCurrentBatchConfig.transition; + try { + (ReactCurrentBatchConfig.transition = null), + (currentUpdatePriority = 2), + commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + previousUpdateLanePriority, + spawnedLane ); - case 10: - a: { - Component = workInProgress.type._context; - context = workInProgress.pendingProps; - nextProps = workInProgress.memoizedProps; - nextCache = context.value; - pushProvider(workInProgress, Component, nextCache); - if (null !== nextProps) - if (objectIs(nextProps.value, nextCache)) { - if ( - nextProps.children === context.children && - !didPerformWorkStackCursor.current - ) { - workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - ); - break a; + } finally { + (ReactCurrentBatchConfig.transition = prevTransition), + (currentUpdatePriority = previousUpdateLanePriority); + } + return null; +} +function commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + renderPriorityLevel, + spawnedLane +) { + do flushPassiveEffects(); + while (null !== rootWithPendingPassiveEffects); + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedLanes = 0; + if (finishedWork === root.current) + throw Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ); + root.callbackNode = null; + root.callbackPriority = 0; + root.cancelPendingCommit = null; + var remainingLanes = finishedWork.lanes | finishedWork.childLanes; + remainingLanes |= concurrentlyUpdatedLanes; + markRootFinished(root, remainingLanes, spawnedLane); + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), + (workInProgressRootRenderLanes = 0)); + (0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || + rootDoesHavePassiveEffects || + ((rootDoesHavePassiveEffects = !0), + (pendingPassiveEffectsRemainingLanes = remainingLanes), + (pendingPassiveTransitions = transitions), + scheduleCallback(NormalPriority$1, function () { + flushPassiveEffects(); + return null; + })); + transitions = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { + transitions = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = null; + spawnedLane = currentUpdatePriority; + currentUpdatePriority = 2; + var prevExecutionContext = executionContext; + executionContext |= 4; + ReactCurrentOwner.current = null; + commitBeforeMutationEffects(root, finishedWork); + commitTime = now(); + commitMutationEffectsOnFiber(finishedWork, root); + root.current = finishedWork; + commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); + requestPaint(); + executionContext = prevExecutionContext; + currentUpdatePriority = spawnedLane; + ReactCurrentBatchConfig.transition = transitions; + } else (root.current = finishedWork), (commitTime = now()); + rootDoesHavePassiveEffects + ? ((rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) + : releaseRootPooledCache(root, remainingLanes); + remainingLanes = root.pendingLanes; + 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); + onCommitRoot(finishedWork.stateNode, renderPriorityLevel); + ensureRootIsScheduled(root); + if (null !== recoverableErrors) + for ( + renderPriorityLevel = root.onRecoverableError, finishedWork = 0; + finishedWork < recoverableErrors.length; + finishedWork++ + ) + (remainingLanes = recoverableErrors[finishedWork]), + (transitions = { + digest: remainingLanes.digest, + componentStack: remainingLanes.stack + }), + renderPriorityLevel(remainingLanes.value, transitions); + if (hasUncaughtError) + throw ( + ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root) + ); + 0 !== (pendingPassiveEffectsLanes & 3) && + 0 !== root.tag && + flushPassiveEffects(); + remainingLanes = root.pendingLanes; + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && 0 !== (remainingLanes & 42) + ? ((nestedUpdateScheduled = !0), + root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) + : (nestedUpdateCount = 0); + flushSyncWorkAcrossRoots_impl(!1); + return null; +} +function releaseRootPooledCache(root, remainingLanes) { + 0 === (root.pooledCacheLanes &= remainingLanes) && + ((remainingLanes = root.pooledCache), + null != remainingLanes && + ((root.pooledCache = null), releaseCache(remainingLanes))); +} +function flushPassiveEffects() { + if (null !== rootWithPendingPassiveEffects) { + var root = rootWithPendingPassiveEffects, + remainingLanes = pendingPassiveEffectsRemainingLanes; + pendingPassiveEffectsRemainingLanes = 0; + var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), + priority = 32 > renderPriority ? 32 : renderPriority; + renderPriority = ReactCurrentBatchConfig.transition; + var previousPriority = currentUpdatePriority; + try { + ReactCurrentBatchConfig.transition = null; + currentUpdatePriority = priority; + if (null === rootWithPendingPassiveEffects) + var JSCompiler_inline_result = !1; + else { + var transitions = pendingPassiveTransitions; + pendingPassiveTransitions = null; + priority = rootWithPendingPassiveEffects; + var lanes = pendingPassiveEffectsLanes; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsLanes = 0; + if (0 !== (executionContext & 6)) + throw Error("Cannot flush passive effects while already rendering."); + var prevExecutionContext = executionContext; + executionContext |= 4; + commitPassiveUnmountOnFiber(priority.current); + commitPassiveMountOnFiber( + priority, + priority.current, + lanes, + transitions + ); + transitions = pendingPassiveProfilerEffects; + pendingPassiveProfilerEffects = []; + for (lanes = 0; lanes < transitions.length; lanes++) { + var finishedWork = transitions[lanes]; + if (executionContext & 4 && 0 !== (finishedWork.flags & 4)) + switch (finishedWork.tag) { + case 12: + var passiveEffectDuration = + finishedWork.stateNode.passiveEffectDuration, + _finishedWork$memoize = finishedWork.memoizedProps, + id = _finishedWork$memoize.id, + onPostCommit = _finishedWork$memoize.onPostCommit, + commitTime$91 = commitTime, + phase = null === finishedWork.alternate ? "mount" : "update"; + currentUpdateIsNested && (phase = "nested-update"); + "function" === typeof onPostCommit && + onPostCommit(id, phase, passiveEffectDuration, commitTime$91); + var parentFiber = finishedWork.return; + b: for (; null !== parentFiber; ) { + switch (parentFiber.tag) { + case 3: + parentFiber.stateNode.passiveEffectDuration += + passiveEffectDuration; + break b; + case 12: + parentFiber.stateNode.passiveEffectDuration += + passiveEffectDuration; + break b; + } + parentFiber = parentFiber.return; + } } - } else propagateContextChange(workInProgress, Component, renderLanes); - reconcileChildren( - current, - workInProgress, - context.children, - renderLanes + } + executionContext = prevExecutionContext; + flushSyncWorkAcrossRoots_impl(!1); + if ( + injectedHook && + "function" === typeof injectedHook.onPostCommitFiberRoot + ) + try { + injectedHook.onPostCommitFiberRoot(rendererID, priority); + } catch (err) {} + var stateNode = priority.current.stateNode; + stateNode.effectDuration = 0; + stateNode.passiveEffectDuration = 0; + JSCompiler_inline_result = !0; + } + return JSCompiler_inline_result; + } finally { + (currentUpdatePriority = previousPriority), + (ReactCurrentBatchConfig.transition = renderPriority), + releaseRootPooledCache(root, remainingLanes); + } + } + return !1; +} +function enqueuePendingPassiveProfilerEffect(fiber) { + pendingPassiveProfilerEffects.push(fiber); + rootDoesHavePassiveEffects || + ((rootDoesHavePassiveEffects = !0), + scheduleCallback(NormalPriority$1, function () { + flushPassiveEffects(); + return null; + })); +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); + null !== rootFiber && + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); +} +function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (; null !== nearestMountedAncestor; ) { + if (3 === nearestMountedAncestor.tag) { + captureCommitPhaseErrorOnRoot( + nearestMountedAncestor, + sourceFiber, + error ); - workInProgress = workInProgress.child; + break; + } else if (1 === nearestMountedAncestor.tag) { + var instance = nearestMountedAncestor.stateNode; + if ( + "function" === + typeof nearestMountedAncestor.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createClassErrorUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + nearestMountedAncestor = enqueueUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + null !== nearestMountedAncestor && + (markRootUpdated$1(nearestMountedAncestor, 2), + ensureRootIsScheduled(nearestMountedAncestor)); + break; + } } - return workInProgress; - case 9: - return ( - (context = workInProgress.type), - (Component = workInProgress.pendingProps.children), - prepareToReadContext(workInProgress, renderLanes), - (context = readContext(context)), - (Component = Component(context)), - (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 14: - return ( - (Component = workInProgress.type), - (context = resolveDefaultProps(Component, workInProgress.pendingProps)), - (context = resolveDefaultProps(Component.type, context)), - updateMemoComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 15: - return updateSimpleMemoComponent( - current, - workInProgress, - workInProgress.type, - workInProgress.pendingProps, - renderLanes - ); - case 17: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), - (workInProgress.tag = 1), - isContextProvider(Component) - ? ((current = !0), pushContextProvider(workInProgress)) - : (current = !1), - prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, Component, context), - mountClassInstance(workInProgress, Component, context, renderLanes), - finishClassComponent( - null, - workInProgress, - Component, - !0, - current, - renderLanes - ) - ); + nearestMountedAncestor = nearestMountedAncestor.return; + } +} +function attachPingListener(root, wakeable, lanes) { + var pingCache = root.pingCache; + if (null === pingCache) { + pingCache = root.pingCache = new PossiblyWeakMap(); + var threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } else + (threadIDs = pingCache.get(wakeable)), + void 0 === threadIDs && + ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); + threadIDs.has(lanes) || + ((workInProgressRootDidAttachPingListener = !0), + threadIDs.add(lanes), + (root = pingSuspendedRoot.bind(null, root, wakeable, lanes)), + wakeable.then(root, root)); +} +function pingSuspendedRoot(root, wakeable, pingedLanes) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(wakeable); + root.pingedLanes |= root.suspendedLanes & pingedLanes; + workInProgressRoot === root && + (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && + (4 === workInProgressRootExitStatus || + (3 === workInProgressRootExitStatus && + (workInProgressRootRenderLanes & 62914560) === + workInProgressRootRenderLanes && + 300 > now$1() - globalMostRecentFallbackTime) + ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) + : (workInProgressRootPingedLanes |= pingedLanes)); + ensureRootIsScheduled(root); +} +function retryTimedOutBoundary(boundaryFiber, retryLane) { + 0 === retryLane && + (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); + boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); + null !== boundaryFiber && + (markRootUpdated$1(boundaryFiber, retryLane), + ensureRootIsScheduled(boundaryFiber)); +} +function retryDehydratedSuspenseBoundary(boundaryFiber) { + var suspenseState = boundaryFiber.memoizedState, + retryLane = 0; + null !== suspenseState && (retryLane = suspenseState.retryLane); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function resolveRetryWakeable(boundaryFiber, wakeable) { + var retryLane = 0; + switch (boundaryFiber.tag) { + case 13: + var retryCache = boundaryFiber.stateNode; + var suspenseState = boundaryFiber.memoizedState; + null !== suspenseState && (retryLane = suspenseState.retryLane); + break; case 19: - return updateSuspenseListComponent(current, workInProgress, renderLanes); + retryCache = boundaryFiber.stateNode; + break; case 22: - return updateOffscreenComponent(current, workInProgress, renderLanes); - case 24: - return ( - prepareToReadContext(workInProgress, renderLanes), - (Component = readContext(CacheContext)), - null === current - ? ((context = peekCacheFromPool()), - null === context && - ((context = workInProgressRoot), - (nextProps = createCache()), - (context.pooledCache = nextProps), - nextProps.refCount++, - null !== nextProps && (context.pooledCacheLanes |= renderLanes), - (context = nextProps)), - (workInProgress.memoizedState = { - parent: Component, - cache: context - }), - initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, context)) - : (0 !== (current.lanes & renderLanes) && - (cloneUpdateQueue(current, workInProgress), - processUpdateQueue(workInProgress, null, null, renderLanes), - suspendIfUpdateReadFromEntangledAsyncAction()), - (context = current.memoizedState), - (nextProps = workInProgress.memoizedState), - context.parent !== Component - ? ((context = { parent: Component, cache: Component }), - (workInProgress.memoizedState = context), - 0 === workInProgress.lanes && - (workInProgress.memoizedState = - workInProgress.updateQueue.baseState = - context), - pushProvider(workInProgress, CacheContext, Component)) - : ((Component = nextProps.cache), - pushProvider(workInProgress, CacheContext, Component), - Component !== context.cache && - propagateContextChange( - workInProgress, - CacheContext, - renderLanes - ))), - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child + retryCache = boundaryFiber.stateNode._retryCache; + break; + default: + throw Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." ); } - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); -}; + null !== retryCache && retryCache.delete(wakeable); + retryTimedOutBoundary(boundaryFiber, retryLane); +} function scheduleCallback(priorityLevel, callback) { return scheduleCallback$3(priorityLevel, callback); } @@ -9575,7 +9574,7 @@ var devToolsConfig$jscomp$inline_1058 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-9c48fb25e-20240311", + version: "18.3.0-canary-89021fb4e-20240311", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1235 = { @@ -9606,7 +9605,7 @@ var internals$jscomp$inline_1235 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-9c48fb25e-20240311" + reconcilerVersion: "18.3.0-canary-89021fb4e-20240311" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1236 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index b0bb4803c103c..9e2eaad701c05 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -26,7 +26,7 @@ if (__DEV__) { } var dynamicFlags = require("ReactNativeInternalFeatureFlags"); - var ReactVersion = "18.3.0-canary-9c48fb25e-20240311"; + var ReactVersion = "18.3.0-canary-89021fb4e-20240311"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index 17ab0731b15c8..559581185474b 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -628,4 +628,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-9c48fb25e-20240311"; +exports.version = "18.3.0-canary-89021fb4e-20240311"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index 01a1d5403d123..037a91d799194 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -624,7 +624,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-9c48fb25e-20240311"; +exports.version = "18.3.0-canary-89021fb4e-20240311"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 14d26e1eafbf7..a4770c10b2b53 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -9c48fb25ecc467b37abb3e145c6e25e311dcdde5 +89021fb4ec9aa82194b0788566e736a4cedfc0e4 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index af07c1631e506..16f1c96e5dac5 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<2cdd07c219807a7aa7c60e7298609102>> + * @generated SignedSource<<8f10777b98503bfd96c32ebc9c31ea5e>> */ "use strict"; @@ -104,292 +104,14 @@ if (__DEV__) { } } - var fakeNode = null; - - { - if ( - typeof window !== "undefined" && - typeof window.dispatchEvent === "function" && - typeof document !== "undefined" && // $FlowFixMe[method-unbinding] - typeof document.createEvent === "function" - ) { - fakeNode = document.createElement("react"); - } - } - - function invokeGuardedCallbackImpl(name, func, context) { - { - // In DEV mode, we use a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // unintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - // fakeNode signifies we are in an environment with a document and window object - if (fakeNode) { - var evt = document.createEvent("Event"); - var didCall = false; // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - - var didError = true; // Keeps track of the value of window.event so that we can reset it - // during the callback to let user code access window.event in the - // browsers that support it. - - var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event - // dispatching: https://github.com/facebook/react/issues/13688 - - var windowEventDescriptor = Object.getOwnPropertyDescriptor( - window, - "event" - ); - - var restoreAfterDispatch = function () { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the - // window.event assignment in both IE <= 10 as they throw an error - // "Member not found" in strict mode, and in Firefox which does not - // support window.event. - - if ( - typeof window.event !== "undefined" && - window.hasOwnProperty("event") - ) { - window.event = windowEvent; - } - }; // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - // $FlowFixMe[method-unbinding] - - var _funcArgs = Array.prototype.slice.call(arguments, 3); - - var callCallback = function () { - didCall = true; - restoreAfterDispatch(); // $FlowFixMe[incompatible-call] Flow doesn't understand the arguments splicing. - - func.apply(context, _funcArgs); - didError = false; - }; // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - - var error; // Use this to track whether the error event is ever called. - - var didSetError = false; - var isCrossOriginError = false; - - var handleWindowError = function (event) { - error = event.error; - didSetError = true; - - if (error === null && event.colno === 0 && event.lineno === 0) { - isCrossOriginError = true; - } - - if (event.defaultPrevented) { - // Some other error handler has prevented default. - // Browsers silence the error report if this happens. - // We'll remember this to later decide whether to log it or not. - if (error != null && typeof error === "object") { - try { - error._suppressLogging = true; - } catch (inner) { - // Ignore. - } - } - } - }; // Create a fake event type. - - var evtType = "react-" + (name ? name : "invokeguardedcallback"); // Attach our event handlers - - window.addEventListener("error", handleWindowError); - fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); - - if (windowEventDescriptor) { - Object.defineProperty(window, "event", windowEventDescriptor); - } - - if (didCall && didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - // eslint-disable-next-line react-internal/prod-error-codes - error = new Error( - "An error was thrown inside one of your components, but React " + - "doesn't know what it was. This is likely due to browser " + - 'flakiness. React does its best to preserve the "Pause on ' + - 'exceptions" behavior of the DevTools, which requires some ' + - "DEV-mode only tricks. It's possible that these don't work in " + - "your browser. Try triggering the error in production mode, " + - "or switching to a modern browser. If you suspect that this is " + - "actually an issue with React, please file an issue." - ); - } else if (isCrossOriginError) { - // eslint-disable-next-line react-internal/prod-error-codes - error = new Error( - "A cross-origin error was thrown. React doesn't have access to " + - "the actual error object in development. " + - "See https://react.dev/link/crossorigin-error for more information." - ); - } - - this.onError(error); - } // Remove our event listeners - - window.removeEventListener("error", handleWindowError); - - if (didCall) { - return; - } else { - // Something went really wrong, and our event was not dispatched. - // https://github.com/facebook/react/issues/16734 - // https://github.com/facebook/react/issues/16585 - // Fall back to the production implementation. - restoreAfterDispatch(); // we fall through and call the prod version instead - } - } // We only get here if we are in an environment that either does not support the browser - // variant or we had trouble getting the browser to emit the error. - // $FlowFixMe[method-unbinding] - - var funcArgs = Array.prototype.slice.call(arguments, 3); - - try { - // $FlowFixMe[incompatible-call] Flow doesn't understand the arguments splicing. - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } - } - } - - var hasError = false; - var caughtError = null; // Used by event system to capture/rethrow the first error. - - var hasRethrowError = false; - var rethrowError = null; - var reporter = { - onError: function (error) { - hasError = true; - caughtError = error; - } - }; - /** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - - function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = false; - caughtError = null; - invokeGuardedCallbackImpl.apply(reporter, arguments); - } - /** - * Same as invokeGuardedCallback, but instead of returning an error, it stores - * it in a global so it can be rethrown by `rethrowCaughtError` later. - * TODO: See if caughtError and rethrowError can be unified. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - - function invokeGuardedCallbackAndCatchFirstError( - name, - func, - context, - a, - b, - c, - d, - e, - f - ) { - invokeGuardedCallback.apply(this, arguments); - - if (hasError) { - var error = clearCaughtError(); - - if (!hasRethrowError) { - hasRethrowError = true; - rethrowError = error; - } - } - } - /** - * During execution of guarded functions we will capture the first error which - * we will rethrow to be handled by the top level error handler. - */ - - function rethrowCaughtError() { - if (hasRethrowError) { - var error = rethrowError; - hasRethrowError = false; - rethrowError = null; - throw error; - } - } - function hasCaughtError() { - return hasError; - } - function clearCaughtError() { - if (hasError) { - var error = caughtError; - hasError = false; - caughtError = null; - return error; - } else { - throw new Error( - "clearCaughtError was called but no error was captured. This error " + - "is likely caused by a bug in React. Please file an issue." - ); - } - } - var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare function isArray(a) { return isArrayImpl(a); } + var hasError = false; + var caughtError = null; var getFiberCurrentPropsFromNode$1 = null; var getInstanceFromNode$1 = null; var getNodeFromInstance$1 = null; @@ -445,9 +167,17 @@ if (__DEV__) { */ function executeDispatch(event, listener, inst) { - var type = event.type || "unknown-event"; event.currentTarget = getNodeFromInstance$1(inst); - invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); + + try { + listener(event); + } catch (error) { + if (!hasError) { + hasError = true; + caughtError = error; + } + } + event.currentTarget = null; } /** @@ -560,6 +290,14 @@ if (__DEV__) { function hasDispatches(event) { return !!event._dispatchListeners; } + function rethrowCaughtError() { + if (hasError) { + var error = caughtError; + hasError = false; + caughtError = null; + throw error; + } + } var assign = Object.assign; @@ -6418,16 +6156,8 @@ to return true:wantsResponderID| | } var isHydrating = false; // This flag allows for warning supression when we expect there to be mismatches - // due to earlier mismatches or a suspended fiber. - - var didSuspendOrErrorDEV = false; // Hydration errors that were thrown inside this boundary var hydrationErrors = null; - function didSuspendOrErrorWhileHydratingDEV() { - { - return didSuspendOrErrorDEV; - } - } function prepareToHydrateHostInstance(fiber, hostContext) { { @@ -16376,25 +16106,8 @@ to return true:wantsResponderID| | if (true) { var source = errorInfo.source; var stack = errorInfo.stack; - var componentStack = stack !== null ? stack : ""; // Browsers support silencing uncaught errors by calling - // `preventDefault()` in window `error` handler. - // We record this information as an expando on the error. - - if (error != null && error._suppressLogging) { - if (boundary.tag === ClassComponent) { - // The error is recoverable and was silenced. - // Ignore it and don't print the stack addendum. - // This is handy for testing error boundaries without noise. - return; - } // The error is fatal. Since the silencing might have - // been accidental, we'll surface it anyway. - // However, the browser would have silenced the original error - // so we'll print it first, and then print the stack addendum. - - console["error"](error); // Don't transform to our wrapper - // For a more detailed description of this block, see: - // https://github.com/facebook/react/pull/13384 - } + var componentStack = stack !== null ? stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. + // See https://github.com/facebook/react/pull/13384 var componentName = source ? getComponentNameFromFiber(source) : null; var componentNameMessage = componentName @@ -16416,19 +16129,17 @@ to return true:wantsResponderID| | ("using the error boundary you provided, " + errorBoundaryName + "."); - } - - var combinedMessage = - componentNameMessage + - "\n" + - componentStack + - "\n\n" + - ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. - // We don't include the original error message and JS stack because the browser - // has already printed it. Even if the application swallows the error, it is still - // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. - - console["error"](combinedMessage); // Don't transform to our wrapper + } // In development, we provide our own message which includes the component stack + // in addition to the error. + + console["error"]( + // Don't transform to our wrapper + "%o\n\n%s\n%s\n\n%s", + error, + componentNameMessage, + componentStack, + errorBoundaryMessage + ); } } catch (e) { // This method must not throw, or React internal state will get messed up. @@ -19993,7 +19704,7 @@ to return true:wantsResponderID| | return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } - function beginWork$1(current, workInProgress, renderLanes) { + function beginWork(current, workInProgress, renderLanes) { { if (workInProgress._debugNeedsRemount && current !== null) { // This will restart the begin phase with a new fiber. @@ -22363,20 +22074,6 @@ to return true:wantsResponderID| | ); } - function reportUncaughtErrorInDEV(error) { - // Wrapping each small part of the commit phase into a guarded - // callback is a bit too slow (https://github.com/facebook/react/pull/21666). - // But we rely on it to surface errors to DEV tools like overlays - // (https://github.com/facebook/react/issues/21712). - // As a compromise, rethrow only caught errors in a guard. - { - invokeGuardedCallback(null, function () { - throw error; - }); - clearCaughtError(); - } - } - function callComponentWillUnmountWithTimer(current, instance) { instance.props = current.memoizedProps; instance.state = current.memoizedState; @@ -28183,7 +27880,6 @@ to return true:wantsResponderID| | error$1 ) { { - reportUncaughtErrorInDEV(error$1); setIsRunningInsertionEffect(false); } @@ -28687,81 +28383,6 @@ to return true:wantsResponderID| | } } } - var beginWork; - - { - var dummyFiber = null; - - beginWork = function (current, unitOfWork, lanes) { - // If a component throws an error, we replay it again in a synchronously - // dispatched event, so that the debugger will treat it as an uncaught - // error See ReactErrorUtils for more information. - // Before entering the begin phase, copy the work-in-progress onto a dummy - // fiber. If beginWork throws, we'll use this to reset the state. - var originalWorkInProgressCopy = assignFiberPropertiesInDEV( - dummyFiber, - unitOfWork - ); - - try { - return beginWork$1(current, unitOfWork, lanes); - } catch (originalError) { - if ( - didSuspendOrErrorWhileHydratingDEV() || - originalError === SuspenseException || - originalError === SelectiveHydrationException || - (originalError !== null && - typeof originalError === "object" && - typeof originalError.then === "function") - ) { - // Don't replay promises. - // Don't replay errors if we are hydrating and have already suspended or handled an error - throw originalError; - } // Don't reset current debug fiber, since we're about to work on the - // same fiber again. - // Unwind the failed stack frame - - resetSuspendedWorkLoopOnUnwind(unitOfWork); - unwindInterruptedWork(current, unitOfWork); // Restore the original properties of the fiber. - - assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); - - if (unitOfWork.mode & ProfileMode) { - // Reset the profiler timer. - startProfilerTimer(unitOfWork); - } // Run beginWork again. - - invokeGuardedCallback( - null, - beginWork$1, - null, - current, - unitOfWork, - lanes - ); - - if (hasCaughtError()) { - var replayError = clearCaughtError(); - - if ( - typeof replayError === "object" && - replayError !== null && - replayError._suppressLogging && - typeof originalError === "object" && - originalError !== null && - !originalError._suppressLogging - ) { - // If suppressed, let the flag carry over to the original error which is the one we'll rethrow. - originalError._suppressLogging = true; - } - } // We always throw the original error in case the second render pass is not idempotent. - // This can happen if a memoized function or CommonJS module doesn't throw after first invocation. - - throw originalError; - } - }; - } - var didWarnAboutUpdateInRender = false; var didWarnAboutUpdateInRenderForAnotherComponent; @@ -30008,55 +29629,6 @@ to return true:wantsResponderID| | implementation: portal.implementation }; return fiber; - } // Used for stashing WIP properties to replay failed work in DEV. - - function assignFiberPropertiesInDEV(target, source) { - if (target === null) { - // This Fiber's initial properties will always be overwritten. - // We only use a Fiber to ensure the same hidden class so DEV isn't slow. - target = createFiber(IndeterminateComponent, null, null, NoMode); - } // This is intentionally written as a list of all properties. - // We tried to use Object.assign() instead but this is called in - // the hottest path, and Object.assign() was too slow: - // https://github.com/facebook/react/issues/12502 - // This code is DEV-only so size is not a concern. - - target.tag = source.tag; - target.key = source.key; - target.elementType = source.elementType; - target.type = source.type; - target.stateNode = source.stateNode; - target.return = source.return; - target.child = source.child; - target.sibling = source.sibling; - target.index = source.index; - target.ref = source.ref; - target.refCleanup = source.refCleanup; - target.pendingProps = source.pendingProps; - target.memoizedProps = source.memoizedProps; - target.updateQueue = source.updateQueue; - target.memoizedState = source.memoizedState; - target.dependencies = source.dependencies; - target.mode = source.mode; - target.flags = source.flags; - target.subtreeFlags = source.subtreeFlags; - target.deletions = source.deletions; - target.lanes = source.lanes; - target.childLanes = source.childLanes; - target.alternate = source.alternate; - - { - target.actualDuration = source.actualDuration; - target.actualStartTime = source.actualStartTime; - target.selfBaseDuration = source.selfBaseDuration; - target.treeBaseDuration = source.treeBaseDuration; - } - - target._debugInfo = source._debugInfo; - target._debugOwner = source._debugOwner; - target._debugNeedsRemount = source._debugNeedsRemount; - target._debugHookTypes = source._debugHookTypes; - return target; } function FiberRootNode( @@ -30184,7 +29756,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-625ba3e2"; + var ReactVersion = "18.3.0-canary-1259eab4"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 4b00aefac2994..4cdd1841dd09d 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<8a5881687c738ab974934de5b7cde1fc>> + * @generated SignedSource<<8bbc17c2ae837acd09635e8900bd214b>> */ "use strict"; @@ -15,62 +15,20 @@ require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), dynamicFlags = require("ReactNativeInternalFeatureFlags"), React = require("react"), - Scheduler = require("scheduler"); -function invokeGuardedCallbackImpl(name, func, context) { - var funcArgs = Array.prototype.slice.call(arguments, 3); - try { - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } -} -var hasError = !1, + Scheduler = require("scheduler"), + isArrayImpl = Array.isArray, + hasError = !1, caughtError = null, - hasRethrowError = !1, - rethrowError = null, - reporter = { - onError: function (error) { - hasError = !0; - caughtError = error; - } - }; -function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = !1; - caughtError = null; - invokeGuardedCallbackImpl.apply(reporter, arguments); -} -function invokeGuardedCallbackAndCatchFirstError( - name, - func, - context, - a, - b, - c, - d, - e, - f -) { - invokeGuardedCallback.apply(this, arguments); - if (hasError) { - if (hasError) { - var error = caughtError; - hasError = !1; - caughtError = null; - } else - throw Error( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." - ); - hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); - } -} -var isArrayImpl = Array.isArray, getFiberCurrentPropsFromNode$1 = null, getInstanceFromNode$1 = null, getNodeFromInstance$1 = null; function executeDispatch(event, listener, inst) { - var type = event.type || "unknown-event"; event.currentTarget = getNodeFromInstance$1(inst); - invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event); + try { + listener(event); + } catch (error) { + hasError || ((hasError = !0), (caughtError = error)); + } event.currentTarget = null; } function executeDirectDispatch(event) { @@ -935,7 +893,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_254 = { +var injectedNamesToPlugins$jscomp$inline_251 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -981,32 +939,32 @@ var injectedNamesToPlugins$jscomp$inline_254 = { } } }, - isOrderingDirty$jscomp$inline_255 = !1, - pluginName$jscomp$inline_256; -for (pluginName$jscomp$inline_256 in injectedNamesToPlugins$jscomp$inline_254) + isOrderingDirty$jscomp$inline_252 = !1, + pluginName$jscomp$inline_253; +for (pluginName$jscomp$inline_253 in injectedNamesToPlugins$jscomp$inline_251) if ( - injectedNamesToPlugins$jscomp$inline_254.hasOwnProperty( - pluginName$jscomp$inline_256 + injectedNamesToPlugins$jscomp$inline_251.hasOwnProperty( + pluginName$jscomp$inline_253 ) ) { - var pluginModule$jscomp$inline_257 = - injectedNamesToPlugins$jscomp$inline_254[pluginName$jscomp$inline_256]; + var pluginModule$jscomp$inline_254 = + injectedNamesToPlugins$jscomp$inline_251[pluginName$jscomp$inline_253]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_256) || - namesToPlugins[pluginName$jscomp$inline_256] !== - pluginModule$jscomp$inline_257 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_253) || + namesToPlugins[pluginName$jscomp$inline_253] !== + pluginModule$jscomp$inline_254 ) { - if (namesToPlugins[pluginName$jscomp$inline_256]) + if (namesToPlugins[pluginName$jscomp$inline_253]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_256 + "`.") + (pluginName$jscomp$inline_253 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_256] = - pluginModule$jscomp$inline_257; - isOrderingDirty$jscomp$inline_255 = !0; + namesToPlugins[pluginName$jscomp$inline_253] = + pluginModule$jscomp$inline_254; + isOrderingDirty$jscomp$inline_252 = !0; } } -isOrderingDirty$jscomp$inline_255 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_252 && recomputePluginOrdering(); var emptyObject$1 = {}, removedKeys = null, removedKeyCount = 0, @@ -1299,12 +1257,9 @@ function dispatchEvent(target, topLevelType, nativeEvent) { throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." ); - if (hasRethrowError) + if (hasError) throw ( - ((event = rethrowError), - (hasRethrowError = !1), - (rethrowError = null), - event) + ((event = caughtError), (hasError = !1), (caughtError = null), event) ); } }); @@ -6524,3587 +6479,3586 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } -var valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = - lastContextDependency = - currentlyRenderingFiber = - null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue2); - context._currentValue2 = nextValue; -} -function popProvider(context) { - context._currentValue2 = valueCursor.current; - 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 propagateContextChange(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) - throw Error( - "We just came from a parent so we must have had a parent. This is a bug in React." +function beginWork(current, workInProgress, renderLanes) { + if (null !== current) + if ( + current.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if ( + 0 === (current.lanes & renderLanes) && + 0 === (workInProgress.flags & 128) + ) + return ( + (didReceiveUpdate = !1), + attemptEarlyBailoutIfNoScheduledUpdate( + current, + workInProgress, + renderLanes + ) ); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } 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; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; + } + else didReceiveUpdate = !1; + workInProgress.lanes = 0; + switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor$1.current + ); + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + workInProgress.flags |= 1; + workInProgress.tag = 0; + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; + case 16: + Component = workInProgress.elementType; + a: { + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null)); -} -function readContext(context) { - return readContextForConsumer(currentlyRenderingFiber, context); -} -function readContextDuringReconcilation(consumer, context, renderLanes) { - null === currentlyRenderingFiber && - prepareToReadContext(consumer, renderLanes); - return readContextForConsumer(consumer, context); -} -function readContextForConsumer(consumer, context) { - var value = context._currentValue2; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === consumer) throw Error( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." ); - lastContextDependency = context; - consumer.dependencies = { lanes: 0, firstContext: context }; - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function () { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function (type, listener) { - listeners.push(listener); - } - }); - this.abort = function () { - signal.aborted = !0; - listeners.forEach(function (listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0 - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority, function () { - cache.controller.abort(); - }); -} -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; - null !== transition && transition._callbacks.add(handleAsyncAction); - return transition; -} -function handleAsyncAction(transition, thenable) { - enableAsyncActions && entangleAsyncAction(transition, thenable); -} -function notifyTransitionCallbacks(transition, returnValue) { - transition._callbacks.forEach(function (callback) { - return callback(transition, returnValue); - }); -} -var resumedCache = createCursor(null); -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: CacheContext._currentValue2, pool: cacheFromPool }; -} -function doesRequireClone(current, completedWork) { - if (null !== current && current.child === completedWork.child) return !1; - if (0 !== (completedWork.flags & 16)) return !0; - for (current = completedWork.child; null !== current; ) { - if (0 !== (current.flags & 12854) || 0 !== (current.subtreeFlags & 12854)) - return !0; - current = current.sibling; - } - return !1; -} -function appendAllChildren( - parent, - workInProgress, - needsVisibilityToggle, - isHidden -) { - for (var node = workInProgress.child; null !== node; ) { - if (5 === node.tag) { - var instance = node.stateNode; - needsVisibilityToggle && - isHidden && - (instance = cloneHiddenInstance(instance)); - appendChildNode(parent.node, instance.node); - } else if (6 === node.tag) { - instance = node.stateNode; - if (needsVisibilityToggle && isHidden) - throw Error("Not yet implemented."); - appendChildNode(parent.node, instance.node); - } else if (4 !== node.tag) - if (22 === node.tag && null !== node.memoizedState) - (instance = node.child), - null !== instance && (instance.return = node), - appendAllChildren(parent, node, !0, !0); - else if (null !== node.child) { - node.child.return = node; - node = node.child; - continue; - } - if (node === workInProgress) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === workInProgress) return; - node = node.return; - } - node.sibling.return = node.return; - node = node.sibling; - } -} -function appendAllChildrenToContainer( - containerChildSet, - workInProgress, - needsVisibilityToggle, - isHidden -) { - for (var node = workInProgress.child; null !== node; ) { - if (5 === node.tag) { - var instance = node.stateNode; - needsVisibilityToggle && - isHidden && - (instance = cloneHiddenInstance(instance)); - var childSet = containerChildSet; - passChildrenWhenCloningPersistedNodes - ? childSet.push(instance.node) - : appendChildNodeToSet(childSet, instance.node); - } else if (6 === node.tag) { - instance = node.stateNode; - if (needsVisibilityToggle && isHidden) - throw Error("Not yet implemented."); - childSet = containerChildSet; - passChildrenWhenCloningPersistedNodes - ? childSet.push(instance.node) - : appendChildNodeToSet(childSet, instance.node); - } else if (4 !== node.tag) - if (22 === node.tag && null !== node.memoizedState) - (childSet = node.child), - null !== childSet && (childSet.return = node), - appendAllChildrenToContainer( - containerChildSet, - node, - !( - null !== node.memoizedProps && - "manual" === node.memoizedProps.mode - ), - !0 - ); - else if (null !== node.child) { - node.child.return = node; - node = node.child; - continue; } - if (node === workInProgress) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === workInProgress) return; - node = node.return; - } - node.sibling.return = node.return; - node = node.sibling; - } -} -function updateHostContainer(current, workInProgress) { - if (doesRequireClone(current, workInProgress)) { - current = workInProgress.stateNode; - var container = current.containerInfo, - newChildSet = passChildrenWhenCloningPersistedNodes - ? [] - : createChildNodeSet(); - appendAllChildrenToContainer(newChildSet, workInProgress, !1, !1); - current.pendingChildren = newChildSet; - workInProgress.flags |= 4; - completeRoot(container, newChildSet); - } -} -function scheduleRetryEffect(workInProgress, retryQueue) { - null !== retryQueue - ? (workInProgress.flags |= 4) - : workInProgress.flags & 16384 && - ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); -} -function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { - switch (renderState.tailMode) { - case "hidden": - hasRenderedATailFallback = renderState.tail; - for (var lastTailNode = null; null !== hasRenderedATailFallback; ) - null !== hasRenderedATailFallback.alternate && - (lastTailNode = hasRenderedATailFallback), - (hasRenderedATailFallback = hasRenderedATailFallback.sibling); - null === lastTailNode - ? (renderState.tail = null) - : (lastTailNode.sibling = null); - break; - case "collapsed": - lastTailNode = renderState.tail; - for (var lastTailNode$72 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$72 = lastTailNode), - (lastTailNode = lastTailNode.sibling); - null === lastTailNode$72 - ? hasRenderedATailFallback || null === renderState.tail - ? (renderState.tail = null) - : (renderState.tail.sibling = null) - : (lastTailNode$72.sibling = null); - } -} -function bubbleProperties(completedWork) { - var didBailout = - null !== completedWork.alternate && - completedWork.alternate.child === completedWork.child, - newChildLanes = 0, - subtreeFlags = 0; - if (didBailout) - for (var child$73 = completedWork.child; null !== child$73; ) - (newChildLanes |= child$73.lanes | child$73.childLanes), - (subtreeFlags |= child$73.subtreeFlags & 31457280), - (subtreeFlags |= child$73.flags & 31457280), - (child$73.return = completedWork), - (child$73 = child$73.sibling); - else - for (child$73 = completedWork.child; null !== child$73; ) - (newChildLanes |= child$73.lanes | child$73.childLanes), - (subtreeFlags |= child$73.subtreeFlags), - (subtreeFlags |= child$73.flags), - (child$73.return = completedWork), - (child$73 = child$73.sibling); - completedWork.subtreeFlags |= subtreeFlags; - completedWork.childLanes = newChildLanes; - return didBailout; -} -function completeWork(current, workInProgress, renderLanes) { - var newProps = workInProgress.pendingProps; - switch (workInProgress.tag) { - case 2: - case 16: - case 15: + return workInProgress; case 0: - case 11: - case 7: - case 8: - case 12: - case 9: - case 14: - return bubbleProperties(workInProgress), null; - case 1: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateFunctionComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 3: + case 1: return ( - (newProps = workInProgress.stateNode), - (renderLanes = null), - null !== current && (renderLanes = current.memoizedState.cache), - workInProgress.memoizedState.cache !== renderLanes && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - newProps.pendingContext && - ((newProps.context = newProps.pendingContext), - (newProps.pendingContext = null)), - (null !== current && null !== current.child) || - null === current || - (current.memoizedState.isDehydrated && - 0 === (workInProgress.flags & 256)) || - ((workInProgress.flags |= 1024), - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), - (hydrationErrors = null))), - updateHostContainer(current, workInProgress), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateClassComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); + case 3: + pushHostRootContext(workInProgress); + if (null === current) + throw Error("Should have a current fiber. This is a bug in React."); + var nextProps = workInProgress.pendingProps; + context = workInProgress.memoizedState; + Component = context.element; + cloneUpdateQueue(current, workInProgress); + processUpdateQueue(workInProgress, nextProps, null, renderLanes); + nextProps = workInProgress.memoizedState; + var nextCache = nextProps.cache; + pushProvider(workInProgress, CacheContext, nextCache); + nextCache !== context.cache && + propagateContextChange(workInProgress, CacheContext, renderLanes); + suspendIfUpdateReadFromEntangledAsyncAction(); + context = nextProps.element; + context === Component + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + )) + : (reconcileChildren(current, workInProgress, context, renderLanes), + (workInProgress = workInProgress.child)); + return workInProgress; case 26: case 27: case 5: - popHostContext(workInProgress); - renderLanes = workInProgress.type; - if (null !== current && null != workInProgress.stateNode) { - renderLanes = current.stateNode; - var oldProps = current.memoizedProps; - if ( - (current = doesRequireClone(current, workInProgress)) || - oldProps !== newProps - ) { - var newChildSet = null; - current && - passChildrenWhenCloningPersistedNodes && - ((newChildSet = passChildrenWhenCloningPersistedNodes - ? [] - : createChildNodeSet()), - appendAllChildrenToContainer(newChildSet, workInProgress, !1, !1)); - b: { - oldProps = diffProperties( - null, - oldProps, - newProps, - renderLanes.canonical.viewConfig.validAttributes - ); - renderLanes.canonical.currentProps = newProps; - newProps = renderLanes.node; - if (current) - newProps = - null != newChildSet - ? null !== oldProps - ? cloneNodeWithNewChildrenAndProps( - newProps, - newChildSet, - oldProps - ) - : cloneNodeWithNewChildren(newProps, newChildSet) - : null !== oldProps - ? cloneNodeWithNewChildrenAndProps(newProps, oldProps) - : cloneNodeWithNewChildren(newProps); - else if (null !== oldProps) - newProps = cloneNodeWithNewProps(newProps, oldProps); - else { - newProps = renderLanes; - break b; - } - newProps = { node: newProps, canonical: renderLanes.canonical }; - } - newProps === renderLanes - ? (workInProgress.stateNode = renderLanes) - : ((workInProgress.stateNode = newProps), - current - ? passChildrenWhenCloningPersistedNodes || - appendAllChildren(newProps, workInProgress, !1, !1) - : (workInProgress.flags |= 4)); - } else workInProgress.stateNode = renderLanes; - } else { - if (!newProps) { - if (null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." - ); - bubbleProperties(workInProgress); - return null; - } - oldProps = rootInstanceStackCursor.current; - current = nextReactTag; - nextReactTag += 2; - renderLanes = getViewConfigForType(renderLanes); - newChildSet = diffProperties( - null, - emptyObject$1, - newProps, - renderLanes.validAttributes - ); - oldProps = createNode( - current, - renderLanes.uiViewClassName, - oldProps, - newChildSet, - workInProgress - ); - newChildSet = ReactNativePrivateInterface.createPublicInstance( + pushHostContext(workInProgress); + Component = workInProgress.pendingProps.children; + if (enableAsyncActions && null !== workInProgress.memoizedState) { + if (!enableAsyncActions) throw Error("Not implemented."); + context = renderWithHooks( current, - renderLanes, - workInProgress + workInProgress, + TransitionAwareHostComponent, + null, + null, + renderLanes ); - current = { - node: oldProps, - canonical: { - nativeTag: current, - viewConfig: renderLanes, - currentProps: newProps, - internalInstanceHandle: workInProgress, - publicInstance: newChildSet - } - }; - appendAllChildren(current, workInProgress, !1, !1); - workInProgress.stateNode = current; - } - bubbleProperties(workInProgress); - workInProgress.flags &= -16777217; - return null; - case 6: - if (current && null != workInProgress.stateNode) - current.memoizedProps !== newProps - ? ((workInProgress.stateNode = createTextInstance( - newProps, - rootInstanceStackCursor.current, - contextStackCursor.current, - workInProgress - )), - (workInProgress.flags |= 4)) - : (workInProgress.stateNode = current.stateNode); - else { - if ("string" !== typeof newProps && null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + HostTransitionContext._currentValue2 = context; + didReceiveUpdate && + null !== current && + current.memoizedState.memoizedState !== context && + propagateContextChange( + workInProgress, + HostTransitionContext, + renderLanes ); - workInProgress.stateNode = createTextInstance( - newProps, - rootInstanceStackCursor.current, - contextStackCursor.current, - workInProgress - ); } - bubbleProperties(workInProgress); + markRef(current, workInProgress); + reconcileChildren(current, workInProgress, Component, renderLanes); + return workInProgress.child; + case 6: return null; case 13: - newProps = workInProgress.memoizedState; - if ( - null === current || - (null !== current.memoizedState && - null !== current.memoizedState.dehydrated) - ) { - if (null !== newProps && null !== newProps.dehydrated) { - if (null === current) { - throw Error( - "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." - ); - throw Error( - "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." - ); - } - 0 === (workInProgress.flags & 128) && - (workInProgress.memoizedState = null); - workInProgress.flags |= 4; - bubbleProperties(workInProgress); - oldProps = !1; - } else - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), - (oldProps = !0); - if (!oldProps) { - if (workInProgress.flags & 256) - return popSuspenseHandler(workInProgress), workInProgress; - popSuspenseHandler(workInProgress); - return null; - } - } - popSuspenseHandler(workInProgress); - if (0 !== (workInProgress.flags & 128)) - return (workInProgress.lanes = renderLanes), workInProgress; - newProps = null !== newProps; - current = null !== current && null !== current.memoizedState; - newProps && - ((renderLanes = workInProgress.child), - (oldProps = null), - null !== renderLanes.alternate && - null !== renderLanes.alternate.memoizedState && - null !== renderLanes.alternate.memoizedState.cachePool && - (oldProps = renderLanes.alternate.memoizedState.cachePool.pool), - (newChildSet = null), - null !== renderLanes.memoizedState && - null !== renderLanes.memoizedState.cachePool && - (newChildSet = renderLanes.memoizedState.cachePool.pool), - newChildSet !== oldProps && (renderLanes.flags |= 2048)); - newProps !== current && newProps && (workInProgress.child.flags |= 8192); - scheduleRetryEffect(workInProgress, workInProgress.updateQueue); - bubbleProperties(workInProgress); - return null; + return updateSuspenseComponent(current, workInProgress, renderLanes); case 4: return ( - popHostContainer(), - updateHostContainer(current, workInProgress), - bubbleProperties(workInProgress), - null + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ), + (Component = workInProgress.pendingProps), + null === current + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + Component, + renderLanes + )) + : reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child ); - case 10: + case 11: return ( - popProvider( - enableRenderableContext - ? workInProgress.type - : workInProgress.type._context - ), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateForwardRef( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 17: + case 7: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps, + renderLanes + ), + workInProgress.child ); - case 19: - pop(suspenseStackCursor); - oldProps = workInProgress.memoizedState; - if (null === oldProps) return bubbleProperties(workInProgress), null; - newProps = 0 !== (workInProgress.flags & 128); - newChildSet = oldProps.rendering; - if (null === newChildSet) - if (newProps) cutOffTailIfNeeded(oldProps, !1); - else { - if ( - 0 !== workInProgressRootExitStatus || - (null !== current && 0 !== (current.flags & 128)) - ) - for (current = workInProgress.child; null !== current; ) { - newChildSet = findFirstSuspended(current); - if (null !== newChildSet) { - workInProgress.flags |= 128; - cutOffTailIfNeeded(oldProps, !1); - current = newChildSet.updateQueue; - workInProgress.updateQueue = current; - scheduleRetryEffect(workInProgress, current); - workInProgress.subtreeFlags = 0; - current = renderLanes; - for (newProps = workInProgress.child; null !== newProps; ) - resetWorkInProgress(newProps, current), - (newProps = newProps.sibling); - push( - suspenseStackCursor, - (suspenseStackCursor.current & 1) | 2 - ); - return workInProgress.child; - } - current = current.sibling; - } - null !== oldProps.tail && - now() > workInProgressRootRenderTargetTime && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(oldProps, !1), - (workInProgress.lanes = 4194304)); - } - else { - if (!newProps) - if (((current = findFirstSuspended(newChildSet)), null !== current)) { - if ( - ((workInProgress.flags |= 128), - (newProps = !0), - (current = current.updateQueue), - (workInProgress.updateQueue = current), - scheduleRetryEffect(workInProgress, current), - cutOffTailIfNeeded(oldProps, !0), - null === oldProps.tail && - "hidden" === oldProps.tailMode && - !newChildSet.alternate) - ) - return bubbleProperties(workInProgress), null; - } else - 2 * now() - oldProps.renderingStartTime > - workInProgressRootRenderTargetTime && - 536870912 !== renderLanes && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(oldProps, !1), - (workInProgress.lanes = 4194304)); - oldProps.isBackwards - ? ((newChildSet.sibling = workInProgress.child), - (workInProgress.child = newChildSet)) - : ((current = oldProps.last), - null !== current - ? (current.sibling = newChildSet) - : (workInProgress.child = newChildSet), - (oldProps.last = newChildSet)); - } - if (null !== oldProps.tail) - return ( - (workInProgress = oldProps.tail), - (oldProps.rendering = workInProgress), - (oldProps.tail = workInProgress.sibling), - (oldProps.renderingStartTime = now()), - (workInProgress.sibling = null), - (current = suspenseStackCursor.current), - push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), - workInProgress - ); - bubbleProperties(workInProgress); - return null; - case 22: - case 23: + case 8: return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - (newProps = null !== workInProgress.memoizedState), - null !== current - ? (null !== current.memoizedState) !== newProps && - (workInProgress.flags |= 8192) - : newProps && (workInProgress.flags |= 8192), - newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 536870912) && - 0 === (workInProgress.flags & 128) && - (bubbleProperties(workInProgress), - workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) - : bubbleProperties(workInProgress), - (newProps = workInProgress.updateQueue), - null !== newProps && - scheduleRetryEffect(workInProgress, newProps.retryQueue), - (newProps = null), - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (newProps = current.memoizedState.cachePool.pool), - (renderLanes = null), - null !== workInProgress.memoizedState && - null !== workInProgress.memoizedState.cachePool && - (renderLanes = workInProgress.memoizedState.cachePool.pool), - renderLanes !== newProps && (workInProgress.flags |= 2048), - null !== current && pop(resumedCache), - null + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child ); - case 24: + case 12: return ( - (newProps = null), - null !== current && (newProps = current.memoizedState.cache), - workInProgress.memoizedState.cache !== newProps && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - bubbleProperties(workInProgress), - null + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child ); - case 25: - return null; - } - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); -} -function unwindWork(current, workInProgress) { - switch (workInProgress.tag) { - case 1: + case 10: + a: { + Component = enableRenderableContext + ? workInProgress.type + : workInProgress.type._context; + context = workInProgress.pendingProps; + nextProps = workInProgress.memoizedProps; + nextCache = context.value; + pushProvider(workInProgress, Component, nextCache); + if (null !== nextProps) + if (objectIs(nextProps.value, nextCache)) { + if ( + nextProps.children === context.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + ); + break a; + } + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes + ); + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: return ( - isContextProvider(workInProgress.type) && popContext(), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null + (context = enableRenderableContext + ? workInProgress.type._context + : workInProgress.type), + (Component = workInProgress.pendingProps.children), + prepareToReadContext(workInProgress, renderLanes), + (context = readContext(context)), + (Component = Component(context)), + (workInProgress.flags |= 1), + reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child ); - case 3: + case 14: return ( - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - (current = workInProgress.flags), - 0 !== (current & 65536) && 0 === (current & 128) - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), + updateMemoComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 26: - case 27: - case 5: - return popHostContext(workInProgress), null; - case 13: - popSuspenseHandler(workInProgress); - current = workInProgress.memoizedState; - if ( - null !== current && - null !== current.dehydrated && - null === workInProgress.alternate - ) - throw Error( - "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." - ); - current = workInProgress.flags; - return current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null; - case 19: - return pop(suspenseStackCursor), null; - case 4: - return popHostContainer(), null; - case 10: - return ( - popProvider( - enableRenderableContext - ? workInProgress.type - : workInProgress.type._context - ), - null + case 15: + return updateSimpleMemoComponent( + current, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + renderLanes ); - case 22: - case 23: + case 17: return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - null !== current && pop(resumedCache), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), + (workInProgress.tag = 1), + isContextProvider(Component) + ? ((current = !0), pushContextProvider(workInProgress)) + : (current = !1), + prepareToReadContext(workInProgress, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), + finishClassComponent( + null, + workInProgress, + Component, + !0, + current, + renderLanes + ) ); - case 24: - return popProvider(CacheContext), null; - case 25: - return null; - default: - return null; - } -} -function unwindInterruptedWork(current, interruptedWork) { - switch (interruptedWork.tag) { - case 1: - current = interruptedWork.type.childContextTypes; - null !== current && void 0 !== current && popContext(); - break; - case 3: - popProvider(CacheContext); - popHostContainer(); - pop(didPerformWorkStackCursor); - pop(contextStackCursor$1); - break; - case 26: - case 27: - case 5: - popHostContext(interruptedWork); - break; - case 4: - popHostContainer(); - break; - case 13: - popSuspenseHandler(interruptedWork); - break; case 19: - pop(suspenseStackCursor); - break; - case 10: - popProvider( - enableRenderableContext - ? interruptedWork.type - : interruptedWork.type._context - ); - break; + return updateSuspenseListComponent(current, workInProgress, renderLanes); case 22: - case 23: - popSuspenseHandler(interruptedWork); - popHiddenContext(); - null !== current && pop(resumedCache); - break; + return updateOffscreenComponent(current, workInProgress, renderLanes); case 24: - popProvider(CacheContext); + return ( + prepareToReadContext(workInProgress, renderLanes), + (Component = readContext(CacheContext)), + null === current + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), + (nextProps = createCache()), + (context.pooledCache = nextProps), + nextProps.refCount++, + null !== nextProps && (context.pooledCacheLanes |= renderLanes), + (context = nextProps)), + (workInProgress.memoizedState = { + parent: Component, + cache: context + }), + initializeUpdateQueue(workInProgress), + pushProvider(workInProgress, CacheContext, context)) + : (0 !== (current.lanes & renderLanes) && + (cloneUpdateQueue(current, workInProgress), + processUpdateQueue(workInProgress, null, null, renderLanes), + suspendIfUpdateReadFromEntangledAsyncAction()), + (context = current.memoizedState), + (nextProps = workInProgress.memoizedState), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), + 0 === workInProgress.lanes && + (workInProgress.memoizedState = + workInProgress.updateQueue.baseState = + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = nextProps.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && + propagateContextChange( + workInProgress, + CacheContext, + renderLanes + ))), + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); } + throw Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in React. Please file an issue." + ); } -var offscreenSubtreeIsHidden = !1, - offscreenSubtreeWasHidden = !1, - PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, - nextEffect = null; -function safelyAttachRef(current, nearestMountedAncestor) { - try { - var ref = current.ref; - if (null !== ref) { - var instance = current.stateNode; - switch (current.tag) { - case 26: - case 27: - case 5: - var instanceToUse = getPublicInstance(instance); - break; - default: - instanceToUse = instance; - } - "function" === typeof ref - ? (current.refCleanup = ref(instanceToUse)) - : (ref.current = instanceToUse); - } - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } +var valueCursor = createCursor(null), + currentlyRenderingFiber = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = + lastContextDependency = + currentlyRenderingFiber = + null; } -function safelyDetachRef(current, nearestMountedAncestor) { - var ref = current.ref, - refCleanup = current.refCleanup; - if (null !== ref) - if ("function" === typeof refCleanup) - try { - refCleanup(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } finally { - (current.refCleanup = null), - (current = current.alternate), - null != current && (current.refCleanup = null); - } - else if ("function" === typeof ref) - try { - ref(null); - } catch (error$95) { - captureCommitPhaseError(current, nearestMountedAncestor, error$95); - } - else ref.current = null; +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue2); + context._currentValue2 = nextValue; } -function safelyCallDestroy(current, nearestMountedAncestor, destroy) { - try { - destroy(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } +function popProvider(context) { + context._currentValue2 = valueCursor.current; + pop(valueCursor); } -var shouldFireAfterActiveInstanceBlur = !1; -function commitBeforeMutationEffects(root, firstChild) { - for (nextEffect = firstChild; null !== nextEffect; ) - if ( - ((root = nextEffect), - (firstChild = root.child), - 0 !== (root.subtreeFlags & 1028) && null !== firstChild) - ) - (firstChild.return = root), (nextEffect = firstChild); - else - for (; null !== nextEffect; ) { - root = nextEffect; - try { - var current = root.alternate, - flags = root.flags; - switch (root.tag) { - case 0: - break; - case 11: - case 15: - break; - case 1: - if (0 !== (flags & 1024) && null !== current) { - var prevProps = current.memoizedProps, - prevState = current.memoizedState, - instance = root.stateNode, - snapshot = instance.getSnapshotBeforeUpdate( - root.elementType === root.type - ? prevProps - : resolveDefaultProps(root.type, prevProps), - prevState - ); - instance.__reactInternalSnapshotBeforeUpdate = snapshot; - } - break; - case 3: - break; - case 5: - case 26: - case 27: - case 6: - case 4: - case 17: - break; - default: - if (0 !== (flags & 1024)) - throw Error( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." - ); +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 propagateContextChange(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } } - } catch (error) { - captureCommitPhaseError(root, root.return, error); - } - firstChild = root.sibling; - if (null !== firstChild) { - firstChild.return = root.return; - nextEffect = firstChild; + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; break; } - nextEffect = root.return; + dependency = dependency.next; } - current = shouldFireAfterActiveInstanceBlur; - shouldFireAfterActiveInstanceBlur = !1; - return current; -} -function commitHookEffectListUnmount( - flags, - finishedWork, - nearestMountedAncestor -) { - var updateQueue = finishedWork.updateQueue; - updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; - if (null !== updateQueue) { - var effect = (updateQueue = updateQueue.next); - do { - if ((effect.tag & flags) === flags) { - var inst = effect.inst, - destroy = inst.destroy; - void 0 !== destroy && - ((inst.destroy = void 0), - safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy)); + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) + throw Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } 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; } - effect = effect.next; - } while (effect !== updateQueue); + fiber = nextFiber; } } -function commitHookEffectListMount(flags, finishedWork) { - finishedWork = finishedWork.updateQueue; - finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; - if (null !== finishedWork) { - var effect = (finishedWork = finishedWork.next); - do { - if ((effect.tag & flags) === flags) { - var create$96 = effect.create, - inst = effect.inst; - create$96 = create$96(); - inst.destroy = create$96; - } - effect = effect.next; - } while (effect !== finishedWork); - } +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); } -function commitHookLayoutEffects(finishedWork, hookFlags) { - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } +function readContext(context) { + return readContextForConsumer(currentlyRenderingFiber, context); } -function commitClassCallbacks(finishedWork) { - var updateQueue = finishedWork.updateQueue; - if (null !== updateQueue) { - var instance = finishedWork.stateNode; - try { - commitCallbacks(updateQueue, instance); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - } +function readContextDuringReconcilation(consumer, context, renderLanes) { + null === currentlyRenderingFiber && + prepareToReadContext(consumer, renderLanes); + return readContextForConsumer(consumer, context); } -function commitHostComponentMount(finishedWork) { - try { - throw Error( - "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." - ); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } +function readContextForConsumer(consumer, context) { + var value = context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + } else lastContextDependency = lastContextDependency.next = context; + return value; } -function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { - var flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 4 && commitHookLayoutEffects(finishedWork, 5); - break; - case 1: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 4) - if (((finishedRoot = finishedWork.stateNode), null === current)) - try { - finishedRoot.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - else { - var prevProps = - finishedWork.elementType === finishedWork.type - ? current.memoizedProps - : resolveDefaultProps(finishedWork.type, current.memoizedProps); - current = current.memoizedState; - try { - finishedRoot.componentDidUpdate( - prevProps, - current, - finishedRoot.__reactInternalSnapshotBeforeUpdate - ); - } catch (error$97) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$97 - ); - } - } - flags & 64 && commitClassCallbacks(finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; - case 3: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { - finishedRoot = null; - if (null !== finishedWork.child) - switch (finishedWork.child.tag) { - case 27: - case 5: - finishedRoot = getPublicInstance(finishedWork.child.stateNode); - break; - case 1: - finishedRoot = finishedWork.child.stateNode; - } - try { - commitCallbacks(flags, finishedRoot); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - } - break; - case 26: - case 27: - case 5: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - null === current && flags & 4 && commitHostComponentMount(finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - break; - case 13: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - break; - case 22: - if (0 !== (finishedWork.mode & 1)) { - if ( - ((prevProps = - null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), - !prevProps) - ) { - current = - (null !== current && null !== current.memoizedState) || - offscreenSubtreeWasHidden; - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevProps; - (offscreenSubtreeWasHidden = current) && - !prevOffscreenSubtreeWasHidden - ? recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - 0 !== (finishedWork.subtreeFlags & 8772) - ) - : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; - } - } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 512 && - ("manual" === finishedWork.memoizedProps.mode - ? safelyAttachRef(finishedWork, finishedWork.return) - : safelyDetachRef(finishedWork, finishedWork.return)); - break; - default: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - } +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function () { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function (type, listener) { + listeners.push(listener); + } + }); + this.abort = function () { + signal.aborted = !0; + listeners.forEach(function (listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0 + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; } -function detachFiberAfterEffects(fiber) { - var alternate = fiber.alternate; - null !== alternate && - ((fiber.alternate = null), detachFiberAfterEffects(alternate)); - fiber.child = null; - fiber.deletions = null; - fiber.sibling = null; - fiber.stateNode = null; - fiber.return = null; - fiber.dependencies = null; - fiber.memoizedProps = null; - fiber.memoizedState = null; - fiber.pendingProps = null; - fiber.stateNode = null; - fiber.updateQueue = null; +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority, function () { + cache.controller.abort(); + }); } -function recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - parent +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +function requestCurrentTransition() { + var transition = ReactCurrentBatchConfig$1.transition; + null !== transition && transition._callbacks.add(handleAsyncAction); + return transition; +} +function handleAsyncAction(transition, thenable) { + enableAsyncActions && entangleAsyncAction(transition, thenable); +} +function notifyTransitionCallbacks(transition, returnValue) { + transition._callbacks.forEach(function (callback) { + return callback(transition, returnValue); + }); +} +var resumedCache = createCursor(null); +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: CacheContext._currentValue2, pool: cacheFromPool }; +} +function doesRequireClone(current, completedWork) { + if (null !== current && current.child === completedWork.child) return !1; + if (0 !== (completedWork.flags & 16)) return !0; + for (current = completedWork.child; null !== current; ) { + if (0 !== (current.flags & 12854) || 0 !== (current.subtreeFlags & 12854)) + return !0; + current = current.sibling; + } + return !1; +} +function appendAllChildren( + parent, + workInProgress, + needsVisibilityToggle, + isHidden ) { - for (parent = parent.child; null !== parent; ) - commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), - (parent = parent.sibling); + for (var node = workInProgress.child; null !== node; ) { + if (5 === node.tag) { + var instance = node.stateNode; + needsVisibilityToggle && + isHidden && + (instance = cloneHiddenInstance(instance)); + appendChildNode(parent.node, instance.node); + } else if (6 === node.tag) { + instance = node.stateNode; + if (needsVisibilityToggle && isHidden) + throw Error("Not yet implemented."); + appendChildNode(parent.node, instance.node); + } else if (4 !== node.tag) + if (22 === node.tag && null !== node.memoizedState) + (instance = node.child), + null !== instance && (instance.return = node), + appendAllChildren(parent, node, !0, !0); + else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } } -function commitDeletionEffectsOnFiber( - finishedRoot, - nearestMountedAncestor, - deletedFiber +function appendAllChildrenToContainer( + containerChildSet, + workInProgress, + needsVisibilityToggle, + isHidden ) { - if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) - try { - injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); - } catch (err) {} - switch (deletedFiber.tag) { - case 26: - case 27: - case 5: - offscreenSubtreeWasHidden || - safelyDetachRef(deletedFiber, nearestMountedAncestor); - case 6: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 18: - break; - case 4: - passChildrenWhenCloningPersistedNodes || createChildNodeSet(); - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 0: - case 11: - case 14: - case 15: - if (!offscreenSubtreeWasHidden) { - var updateQueue = deletedFiber.updateQueue; - if ( - null !== updateQueue && - ((updateQueue = updateQueue.lastEffect), null !== updateQueue) - ) { - var effect = (updateQueue = updateQueue.next); - do { - var tag = effect.tag, - inst = effect.inst, - destroy = inst.destroy; - void 0 !== destroy && - (0 !== (tag & 2) - ? ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - )) - : 0 !== (tag & 4) && - ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - ))); - effect = effect.next; - } while (effect !== updateQueue); - } - } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 1: - if ( - !offscreenSubtreeWasHidden && - (safelyDetachRef(deletedFiber, nearestMountedAncestor), - (updateQueue = deletedFiber.stateNode), - "function" === typeof updateQueue.componentWillUnmount) - ) - try { - (updateQueue.props = deletedFiber.memoizedProps), - (updateQueue.state = deletedFiber.memoizedState), - updateQueue.componentWillUnmount(); - } catch (error) { - captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); - } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 21: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); - deletedFiber.mode & 1 - ? ((offscreenSubtreeWasHidden = - (updateQueue = offscreenSubtreeWasHidden) || - null !== deletedFiber.memoizedState), - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ), - (offscreenSubtreeWasHidden = updateQueue)) - : recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber + for (var node = workInProgress.child; null !== node; ) { + if (5 === node.tag) { + var instance = node.stateNode; + needsVisibilityToggle && + isHidden && + (instance = cloneHiddenInstance(instance)); + var childSet = containerChildSet; + passChildrenWhenCloningPersistedNodes + ? childSet.push(instance.node) + : appendChildNodeToSet(childSet, instance.node); + } else if (6 === node.tag) { + instance = node.stateNode; + if (needsVisibilityToggle && isHidden) + throw Error("Not yet implemented."); + childSet = containerChildSet; + passChildrenWhenCloningPersistedNodes + ? childSet.push(instance.node) + : appendChildNodeToSet(childSet, instance.node); + } else if (4 !== node.tag) + if (22 === node.tag && null !== node.memoizedState) + (childSet = node.child), + null !== childSet && (childSet.return = node), + appendAllChildrenToContainer( + containerChildSet, + node, + !( + null !== node.memoizedProps && + "manual" === node.memoizedProps.mode + ), + !0 ); - break; - default: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); + else if (null !== node.child) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; } } -function getRetryCache(finishedWork) { - switch (finishedWork.tag) { - case 13: - case 19: - var retryCache = finishedWork.stateNode; - null === retryCache && - (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); - return retryCache; - case 22: - return ( - (finishedWork = finishedWork.stateNode), - (retryCache = finishedWork._retryCache), - null === retryCache && - (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), - retryCache - ); - default: - throw Error( - "Unexpected Suspense handler tag (" + - finishedWork.tag + - "). This is a bug in React." - ); +function updateHostContainer(current, workInProgress) { + if (doesRequireClone(current, workInProgress)) { + current = workInProgress.stateNode; + var container = current.containerInfo, + newChildSet = passChildrenWhenCloningPersistedNodes + ? [] + : createChildNodeSet(); + appendAllChildrenToContainer(newChildSet, workInProgress, !1, !1); + current.pendingChildren = newChildSet; + workInProgress.flags |= 4; + completeRoot(container, newChildSet); } } -function attachSuspenseRetryListeners(finishedWork, wakeables) { - var retryCache = getRetryCache(finishedWork); - wakeables.forEach(function (wakeable) { - var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); - retryCache.has(wakeable) || - (retryCache.add(wakeable), wakeable.then(retry, retry)); - }); +function scheduleRetryEffect(workInProgress, retryQueue) { + null !== retryQueue + ? (workInProgress.flags |= 4) + : workInProgress.flags & 16384 && + ((retryQueue = + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), + (workInProgress.lanes |= retryQueue)); } -function recursivelyTraverseMutationEffects(root, parentFiber) { - var deletions = parentFiber.deletions; - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - try { - commitDeletionEffectsOnFiber(root, parentFiber, childToDelete); - var alternate = childToDelete.alternate; - null !== alternate && (alternate.return = null); - childToDelete.return = null; - } catch (error) { - captureCommitPhaseError(childToDelete, parentFiber, error); - } - } - if (parentFiber.subtreeFlags & 12854) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitMutationEffectsOnFiber(parentFiber, root), - (parentFiber = parentFiber.sibling); +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var lastTailNode$72 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$72 = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === lastTailNode$72 + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (lastTailNode$72.sibling = null); + } } -function commitMutationEffectsOnFiber(finishedWork, root) { - var current = finishedWork.alternate, - flags = finishedWork.flags; - switch (finishedWork.tag) { +function bubbleProperties(completedWork) { + var didBailout = + null !== completedWork.alternate && + completedWork.alternate.child === completedWork.child, + newChildLanes = 0, + subtreeFlags = 0; + if (didBailout) + for (var child$73 = completedWork.child; null !== child$73; ) + (newChildLanes |= child$73.lanes | child$73.childLanes), + (subtreeFlags |= child$73.subtreeFlags & 31457280), + (subtreeFlags |= child$73.flags & 31457280), + (child$73.return = completedWork), + (child$73 = child$73.sibling); + else + for (child$73 = completedWork.child; null !== child$73; ) + (newChildLanes |= child$73.lanes | child$73.childLanes), + (subtreeFlags |= child$73.subtreeFlags), + (subtreeFlags |= child$73.flags), + (child$73.return = completedWork), + (child$73 = child$73.sibling); + completedWork.subtreeFlags |= subtreeFlags; + completedWork.childLanes = newChildLanes; + return didBailout; +} +function completeWork(current, workInProgress, renderLanes) { + var newProps = workInProgress.pendingProps; + switch (workInProgress.tag) { + case 2: + case 16: + case 15: case 0: case 11: + case 7: + case 8: + case 12: + case 9: case 14: - case 15: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - try { - commitHookEffectListUnmount(3, finishedWork, finishedWork.return), - commitHookEffectListMount(3, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - try { - commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$99) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$99); - } - } - break; + return bubbleProperties(workInProgress), null; case 1: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - flags & 64 && - offscreenSubtreeIsHidden && - ((finishedWork = finishedWork.updateQueue), - null !== finishedWork && - ((flags = finishedWork.callbacks), - null !== flags && - ((current = finishedWork.shared.hiddenCallbacks), - (finishedWork.shared.hiddenCallbacks = - null === current ? flags : current.concat(flags))))); - break; + return ( + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null + ); + case 3: + return ( + (newProps = workInProgress.stateNode), + (renderLanes = null), + null !== current && (renderLanes = current.memoizedState.cache), + workInProgress.memoizedState.cache !== renderLanes && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + newProps.pendingContext && + ((newProps.context = newProps.pendingContext), + (newProps.pendingContext = null)), + (null !== current && null !== current.child) || + null === current || + (current.memoizedState.isDehydrated && + 0 === (workInProgress.flags & 256)) || + ((workInProgress.flags |= 1024), + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), + (hydrationErrors = null))), + updateHostContainer(current, workInProgress), + bubbleProperties(workInProgress), + null + ); case 26: case 27: case 5: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - break; + popHostContext(workInProgress); + renderLanes = workInProgress.type; + if (null !== current && null != workInProgress.stateNode) { + renderLanes = current.stateNode; + var oldProps = current.memoizedProps; + if ( + (current = doesRequireClone(current, workInProgress)) || + oldProps !== newProps + ) { + var newChildSet = null; + current && + passChildrenWhenCloningPersistedNodes && + ((newChildSet = passChildrenWhenCloningPersistedNodes + ? [] + : createChildNodeSet()), + appendAllChildrenToContainer(newChildSet, workInProgress, !1, !1)); + b: { + oldProps = diffProperties( + null, + oldProps, + newProps, + renderLanes.canonical.viewConfig.validAttributes + ); + renderLanes.canonical.currentProps = newProps; + newProps = renderLanes.node; + if (current) + newProps = + null != newChildSet + ? null !== oldProps + ? cloneNodeWithNewChildrenAndProps( + newProps, + newChildSet, + oldProps + ) + : cloneNodeWithNewChildren(newProps, newChildSet) + : null !== oldProps + ? cloneNodeWithNewChildrenAndProps(newProps, oldProps) + : cloneNodeWithNewChildren(newProps); + else if (null !== oldProps) + newProps = cloneNodeWithNewProps(newProps, oldProps); + else { + newProps = renderLanes; + break b; + } + newProps = { node: newProps, canonical: renderLanes.canonical }; + } + newProps === renderLanes + ? (workInProgress.stateNode = renderLanes) + : ((workInProgress.stateNode = newProps), + current + ? passChildrenWhenCloningPersistedNodes || + appendAllChildren(newProps, workInProgress, !1, !1) + : (workInProgress.flags |= 4)); + } else workInProgress.stateNode = renderLanes; + } else { + if (!newProps) { + if (null === workInProgress.stateNode) + throw Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ); + bubbleProperties(workInProgress); + return null; + } + oldProps = rootInstanceStackCursor.current; + current = nextReactTag; + nextReactTag += 2; + renderLanes = getViewConfigForType(renderLanes); + newChildSet = diffProperties( + null, + emptyObject$1, + newProps, + renderLanes.validAttributes + ); + oldProps = createNode( + current, + renderLanes.uiViewClassName, + oldProps, + newChildSet, + workInProgress + ); + newChildSet = ReactNativePrivateInterface.createPublicInstance( + current, + renderLanes, + workInProgress + ); + current = { + node: oldProps, + canonical: { + nativeTag: current, + viewConfig: renderLanes, + currentProps: newProps, + internalInstanceHandle: workInProgress, + publicInstance: newChildSet + } + }; + appendAllChildren(current, workInProgress, !1, !1); + workInProgress.stateNode = current; + } + bubbleProperties(workInProgress); + workInProgress.flags &= -16777217; + return null; case 6: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; - case 3: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; - case 4: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; + if (current && null != workInProgress.stateNode) + current.memoizedProps !== newProps + ? ((workInProgress.stateNode = createTextInstance( + newProps, + rootInstanceStackCursor.current, + contextStackCursor.current, + workInProgress + )), + (workInProgress.flags |= 4)) + : (workInProgress.stateNode = current.stateNode); + else { + if ("string" !== typeof newProps && null === workInProgress.stateNode) + throw Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ); + workInProgress.stateNode = createTextInstance( + newProps, + rootInstanceStackCursor.current, + contextStackCursor.current, + workInProgress + ); + } + bubbleProperties(workInProgress); + return null; case 13: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (finishedWork.child.flags & 8192) { - var isShowingFallback = null !== finishedWork.memoizedState; - current = null !== current && null !== current.memoizedState; - alwaysThrottleRetries - ? isShowingFallback !== current && - (globalMostRecentFallbackTime = now()) - : isShowingFallback && - !current && - (globalMostRecentFallbackTime = now()); + newProps = workInProgress.memoizedState; + if ( + null === current || + (null !== current.memoizedState && + null !== current.memoizedState.dehydrated) + ) { + if (null !== newProps && null !== newProps.dehydrated) { + if (null === current) { + throw Error( + "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + ); + throw Error( + "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ); + } + 0 === (workInProgress.flags & 128) && + (workInProgress.memoizedState = null); + workInProgress.flags |= 4; + bubbleProperties(workInProgress); + oldProps = !1; + } else + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), + (oldProps = !0); + if (!oldProps) { + if (workInProgress.flags & 256) + return popSuspenseHandler(workInProgress), workInProgress; + popSuspenseHandler(workInProgress); + return null; + } } - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); - break; - case 22: - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - var isHidden = null !== finishedWork.memoizedState; - isShowingFallback = null !== current && null !== current.memoizedState; - if (finishedWork.mode & 1) { - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || isHidden; - offscreenSubtreeWasHidden = - prevOffscreenSubtreeWasHidden || isShowingFallback; - recursivelyTraverseMutationEffects(root, finishedWork); - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - } else recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - root = finishedWork.stateNode; - root._current = finishedWork; - root._visibility &= -3; - root._visibility |= root._pendingVisibility & 2; - flags & 8192 && - ((root._visibility = isHidden - ? root._visibility & -2 - : root._visibility | 1), - isHidden && - ((isHidden = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), - null === current || - isShowingFallback || - isHidden || - (0 !== (finishedWork.mode & 1) && - recursivelyTraverseDisappearLayoutEffects(finishedWork)))); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((current = flags.retryQueue), - null !== current && - ((flags.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, current)))); - break; + popSuspenseHandler(workInProgress); + if (0 !== (workInProgress.flags & 128)) + return (workInProgress.lanes = renderLanes), workInProgress; + newProps = null !== newProps; + current = null !== current && null !== current.memoizedState; + newProps && + ((renderLanes = workInProgress.child), + (oldProps = null), + null !== renderLanes.alternate && + null !== renderLanes.alternate.memoizedState && + null !== renderLanes.alternate.memoizedState.cachePool && + (oldProps = renderLanes.alternate.memoizedState.cachePool.pool), + (newChildSet = null), + null !== renderLanes.memoizedState && + null !== renderLanes.memoizedState.cachePool && + (newChildSet = renderLanes.memoizedState.cachePool.pool), + newChildSet !== oldProps && (renderLanes.flags |= 2048)); + newProps !== current && newProps && (workInProgress.child.flags |= 8192); + scheduleRetryEffect(workInProgress, workInProgress.updateQueue); + bubbleProperties(workInProgress); + return null; + case 4: + return ( + popHostContainer(), + updateHostContainer(current, workInProgress), + bubbleProperties(workInProgress), + null + ); + case 10: + return ( + popProvider( + enableRenderableContext + ? workInProgress.type + : workInProgress.type._context + ), + bubbleProperties(workInProgress), + null + ); + case 17: + return ( + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null + ); case 19: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); - break; - case 21: - break; - default: - recursivelyTraverseMutationEffects(root, finishedWork), - commitReconciliationEffects(finishedWork); - } -} -function commitReconciliationEffects(finishedWork) { - var flags = finishedWork.flags; - flags & 2 && (finishedWork.flags &= -3); - flags & 4096 && (finishedWork.flags &= -4097); -} -function recursivelyTraverseLayoutEffects(root, parentFiber) { - if (parentFiber.subtreeFlags & 8772) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), - (parentFiber = parentFiber.sibling); -} -function recursivelyTraverseDisappearLayoutEffects(parentFiber) { - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedWork = parentFiber; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - commitHookEffectListUnmount(4, finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 1: - safelyDetachRef(finishedWork, finishedWork.return); - var instance = finishedWork.stateNode; - if ("function" === typeof instance.componentWillUnmount) { - var current = finishedWork, - nearestMountedAncestor = finishedWork.return; - try { - var current$jscomp$0 = current; - instance.props = current$jscomp$0.memoizedProps; - instance.state = current$jscomp$0.memoizedState; - instance.componentWillUnmount(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } + pop(suspenseStackCursor); + oldProps = workInProgress.memoizedState; + if (null === oldProps) return bubbleProperties(workInProgress), null; + newProps = 0 !== (workInProgress.flags & 128); + newChildSet = oldProps.rendering; + if (null === newChildSet) + if (newProps) cutOffTailIfNeeded(oldProps, !1); + else { + if ( + 0 !== workInProgressRootExitStatus || + (null !== current && 0 !== (current.flags & 128)) + ) + for (current = workInProgress.child; null !== current; ) { + newChildSet = findFirstSuspended(current); + if (null !== newChildSet) { + workInProgress.flags |= 128; + cutOffTailIfNeeded(oldProps, !1); + current = newChildSet.updateQueue; + workInProgress.updateQueue = current; + scheduleRetryEffect(workInProgress, current); + workInProgress.subtreeFlags = 0; + current = renderLanes; + for (newProps = workInProgress.child; null !== newProps; ) + resetWorkInProgress(newProps, current), + (newProps = newProps.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & 1) | 2 + ); + return workInProgress.child; + } + current = current.sibling; + } + null !== oldProps.tail && + now() > workInProgressRootRenderTargetTime && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(oldProps, !1), + (workInProgress.lanes = 4194304)); } - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 26: - case 27: - case 5: - safelyDetachRef(finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 22: - safelyDetachRef(finishedWork, finishedWork.return); - null === finishedWork.memoizedState && - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - default: - recursivelyTraverseDisappearLayoutEffects(finishedWork); - } - parentFiber = parentFiber.sibling; - } -} -function recursivelyTraverseReappearLayoutEffects( - finishedRoot$jscomp$0, - parentFiber, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, - finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - commitHookLayoutEffects(finishedWork, 4); - break; - case 1: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - finishedRoot = finishedWork.stateNode; - if ("function" === typeof finishedRoot.componentDidMount) - try { - finishedRoot.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; - if (null !== hiddenCallbacks) - for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + else { + if (!newProps) + if (((current = findFirstSuspended(newChildSet)), null !== current)) { + if ( + ((workInProgress.flags |= 128), + (newProps = !0), + (current = current.updateQueue), + (workInProgress.updateQueue = current), + scheduleRetryEffect(workInProgress, current), + cutOffTailIfNeeded(oldProps, !0), + null === oldProps.tail && + "hidden" === oldProps.tailMode && + !newChildSet.alternate) ) - callCallback(hiddenCallbacks[current], finishedRoot); - } - includeWorkInProgressEffects && - flags & 64 && - commitClassCallbacks(finishedWork); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 26: - case 27: - case 5: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - null === current && - flags & 4 && - commitHostComponentMount(finishedWork); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - break; - case 13: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects + return bubbleProperties(workInProgress), null; + } else + 2 * now() - oldProps.renderingStartTime > + workInProgressRootRenderTargetTime && + 536870912 !== renderLanes && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(oldProps, !1), + (workInProgress.lanes = 4194304)); + oldProps.isBackwards + ? ((newChildSet.sibling = workInProgress.child), + (workInProgress.child = newChildSet)) + : ((current = oldProps.last), + null !== current + ? (current.sibling = newChildSet) + : (workInProgress.child = newChildSet), + (oldProps.last = newChildSet)); + } + if (null !== oldProps.tail) + return ( + (workInProgress = oldProps.tail), + (oldProps.rendering = workInProgress), + (oldProps.tail = workInProgress.sibling), + (oldProps.renderingStartTime = now()), + (workInProgress.sibling = null), + (current = suspenseStackCursor.current), + push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), + workInProgress ); - break; - case 22: - null === finishedWork.memoizedState && - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - default: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects + bubbleProperties(workInProgress); + return null; + case 22: + case 23: + return ( + popSuspenseHandler(workInProgress), + popHiddenContext(), + (newProps = null !== workInProgress.memoizedState), + null !== current + ? (null !== current.memoizedState) !== newProps && + (workInProgress.flags |= 8192) + : newProps && (workInProgress.flags |= 8192), + newProps && 0 !== (workInProgress.mode & 1) + ? 0 !== (renderLanes & 536870912) && + 0 === (workInProgress.flags & 128) && + (bubbleProperties(workInProgress), + workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) + : bubbleProperties(workInProgress), + (newProps = workInProgress.updateQueue), + null !== newProps && + scheduleRetryEffect(workInProgress, newProps.retryQueue), + (newProps = null), + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (newProps = current.memoizedState.cachePool.pool), + (renderLanes = null), + null !== workInProgress.memoizedState && + null !== workInProgress.memoizedState.cachePool && + (renderLanes = workInProgress.memoizedState.cachePool.pool), + renderLanes !== newProps && (workInProgress.flags |= 2048), + null !== current && pop(resumedCache), + null + ); + case 24: + return ( + (newProps = null), + null !== current && (newProps = current.memoizedState.cache), + workInProgress.memoizedState.cache !== newProps && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + bubbleProperties(workInProgress), + null + ); + case 25: + return null; + } + throw Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in React. Please file an issue." + ); +} +function unwindWork(current, workInProgress) { + switch (workInProgress.tag) { + case 1: + return ( + isContextProvider(workInProgress.type) && popContext(), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null + ); + case 3: + return ( + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + (current = workInProgress.flags), + 0 !== (current & 65536) && 0 === (current & 128) + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null + ); + case 26: + case 27: + case 5: + return popHostContext(workInProgress), null; + case 13: + popSuspenseHandler(workInProgress); + current = workInProgress.memoizedState; + if ( + null !== current && + null !== current.dehydrated && + null === workInProgress.alternate + ) + throw Error( + "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." ); - } - parentFiber = parentFiber.sibling; + current = workInProgress.flags; + return current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null; + case 19: + return pop(suspenseStackCursor), null; + case 4: + return popHostContainer(), null; + case 10: + return ( + popProvider( + enableRenderableContext + ? workInProgress.type + : workInProgress.type._context + ), + null + ); + case 22: + case 23: + return ( + popSuspenseHandler(workInProgress), + popHiddenContext(), + null !== current && pop(resumedCache), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null + ); + case 24: + return popProvider(CacheContext), null; + case 25: + return null; + default: + return null; } } -function commitHookPassiveMountEffects(finishedWork, hookFlags) { +function unwindInterruptedWork(current, interruptedWork) { + switch (interruptedWork.tag) { + case 1: + current = interruptedWork.type.childContextTypes; + null !== current && void 0 !== current && popContext(); + break; + case 3: + popProvider(CacheContext); + popHostContainer(); + pop(didPerformWorkStackCursor); + pop(contextStackCursor$1); + break; + case 26: + case 27: + case 5: + popHostContext(interruptedWork); + break; + case 4: + popHostContainer(); + break; + case 13: + popSuspenseHandler(interruptedWork); + break; + case 19: + pop(suspenseStackCursor); + break; + case 10: + popProvider( + enableRenderableContext + ? interruptedWork.type + : interruptedWork.type._context + ); + break; + case 22: + case 23: + popSuspenseHandler(interruptedWork); + popHiddenContext(); + null !== current && pop(resumedCache); + break; + case 24: + popProvider(CacheContext); + } +} +var offscreenSubtreeIsHidden = !1, + offscreenSubtreeWasHidden = !1, + PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, + nextEffect = null; +function safelyAttachRef(current, nearestMountedAncestor) { try { - commitHookEffectListMount(hookFlags, finishedWork); + var ref = current.ref; + if (null !== ref) { + var instance = current.stateNode; + switch (current.tag) { + case 26: + case 27: + case 5: + var instanceToUse = getPublicInstance(instance); + break; + default: + instanceToUse = instance; + } + "function" === typeof ref + ? (current.refCleanup = ref(instanceToUse)) + : (ref.current = instanceToUse); + } } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); + captureCommitPhaseError(current, nearestMountedAncestor, error); } } -function commitOffscreenPassiveMountEffects(current, finishedWork) { - var previousCache = null; - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (previousCache = current.memoizedState.cachePool.pool); - current = null; - null !== finishedWork.memoizedState && - null !== finishedWork.memoizedState.cachePool && - (current = finishedWork.memoizedState.cachePool.pool); - current !== previousCache && - (null != current && current.refCount++, - null != previousCache && releaseCache(previousCache)); +function safelyDetachRef(current, nearestMountedAncestor) { + var ref = current.ref, + refCleanup = current.refCleanup; + if (null !== ref) + if ("function" === typeof refCleanup) + try { + refCleanup(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } finally { + (current.refCleanup = null), + (current = current.alternate), + null != current && (current.refCleanup = null); + } + else if ("function" === typeof ref) + try { + ref(null); + } catch (error$95) { + captureCommitPhaseError(current, nearestMountedAncestor, error$95); + } + else ref.current = null; } -function commitCachePassiveMountEffect(current, finishedWork) { - current = null; - null !== finishedWork.alternate && - (current = finishedWork.alternate.memoizedState.cache); - finishedWork = finishedWork.memoizedState.cache; - finishedWork !== current && - (finishedWork.refCount++, null != current && releaseCache(current)); +function safelyCallDestroy(current, nearestMountedAncestor, destroy) { + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } } -function recursivelyTraversePassiveMountEffects( - root, - parentFiber, - committedLanes, - committedTransitions -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveMountOnFiber( - root, - parentFiber, - committedLanes, - committedTransitions - ), - (parentFiber = parentFiber.sibling); +var shouldFireAfterActiveInstanceBlur = !1; +function commitBeforeMutationEffects(root, firstChild) { + for (nextEffect = firstChild; null !== nextEffect; ) + if ( + ((root = nextEffect), + (firstChild = root.child), + 0 !== (root.subtreeFlags & 1028) && null !== firstChild) + ) + (firstChild.return = root), (nextEffect = firstChild); + else + for (; null !== nextEffect; ) { + root = nextEffect; + try { + var current = root.alternate, + flags = root.flags; + switch (root.tag) { + case 0: + break; + case 11: + case 15: + break; + case 1: + if (0 !== (flags & 1024) && null !== current) { + var prevProps = current.memoizedProps, + prevState = current.memoizedState, + instance = root.stateNode, + snapshot = instance.getSnapshotBeforeUpdate( + root.elementType === root.type + ? prevProps + : resolveDefaultProps(root.type, prevProps), + prevState + ); + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + } + break; + case 3: + break; + case 5: + case 26: + case 27: + case 6: + case 4: + case 17: + break; + default: + if (0 !== (flags & 1024)) + throw Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ); + } + } catch (error) { + captureCommitPhaseError(root, root.return, error); + } + firstChild = root.sibling; + if (null !== firstChild) { + firstChild.return = root.return; + nextEffect = firstChild; + break; + } + nextEffect = root.return; + } + current = shouldFireAfterActiveInstanceBlur; + shouldFireAfterActiveInstanceBlur = !1; + return current; } -function commitPassiveMountOnFiber( - finishedRoot, +function commitHookEffectListUnmount( + flags, finishedWork, - committedLanes, - committedTransitions + nearestMountedAncestor ) { + var updateQueue = finishedWork.updateQueue; + updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; + if (null !== updateQueue) { + var effect = (updateQueue = updateQueue.next); + do { + if ((effect.tag & flags) === flags) { + var inst = effect.inst, + destroy = inst.destroy; + void 0 !== destroy && + ((inst.destroy = void 0), + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy)); + } + effect = effect.next; + } while (effect !== updateQueue); + } +} +function commitHookEffectListMount(flags, finishedWork) { + finishedWork = finishedWork.updateQueue; + finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; + if (null !== finishedWork) { + var effect = (finishedWork = finishedWork.next); + do { + if ((effect.tag & flags) === flags) { + var create$96 = effect.create, + inst = effect.inst; + create$96 = create$96(); + inst.destroy = create$96; + } + effect = effect.next; + } while (effect !== finishedWork); + } +} +function commitHookLayoutEffects(finishedWork, hookFlags) { + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } +} +function commitClassCallbacks(finishedWork) { + var updateQueue = finishedWork.updateQueue; + if (null !== updateQueue) { + var instance = finishedWork.stateNode; + try { + commitCallbacks(updateQueue, instance); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + } +} +function commitHostComponentMount(finishedWork) { + try { + throw Error( + "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + ); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } +} +function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { var flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); - break; - case 3: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - ((finishedRoot = null), - null !== finishedWork.alternate && - (finishedRoot = finishedWork.alternate.memoizedState.cache), - (finishedWork = finishedWork.memoizedState.cache), - finishedWork !== finishedRoot && - (finishedWork.refCount++, - null != finishedRoot && releaseCache(finishedRoot))); - break; - case 23: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 4 && commitHookLayoutEffects(finishedWork, 5); break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) - : ((instance._visibility |= 4), - recursivelyTraversePassiveMountEffects( - finishedRoot, + case 1: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 4) + if (((finishedRoot = finishedWork.stateNode), null === current)) + try { + finishedRoot.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + else { + var prevProps = + finishedWork.elementType === finishedWork.type + ? current.memoizedProps + : resolveDefaultProps(finishedWork.type, current.memoizedProps); + current = current.memoizedState; + try { + finishedRoot.componentDidUpdate( + prevProps, + current, + finishedRoot.__reactInternalSnapshotBeforeUpdate + ); + } catch (error$97) { + captureCommitPhaseError( finishedWork, - committedLanes, - committedTransitions - )) - : instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - 0 !== (finishedWork.subtreeFlags & 10256) - )); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - } -} -function recursivelyTraverseReconnectPassiveEffects( - finishedRoot$jscomp$0, - parentFiber, - committedLanes$jscomp$0, - committedTransitions$jscomp$0, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - committedLanes = committedLanes$jscomp$0, - committedTransitions = committedTransitions$jscomp$0, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - commitHookPassiveMountEffects(finishedWork, 8); - break; - case 23: - break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects( - finishedRoot, - finishedWork - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )); - includeWorkInProgressEffects && - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - } - parentFiber = parentFiber.sibling; - } -} -function recursivelyTraverseAtomicPassiveEffects( - finishedRoot$jscomp$0, - parentFiber -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 22: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork + finishedWork.return, + error$97 ); - break; - case 24: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + } + } + flags & 64 && commitClassCallbacks(finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); + break; + case 3: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { + finishedRoot = null; + if (null !== finishedWork.child) + switch (finishedWork.child.tag) { + case 27: + case 5: + finishedRoot = getPublicInstance(finishedWork.child.stateNode); + break; + case 1: + finishedRoot = finishedWork.child.stateNode; + } + try { + commitCallbacks(flags, finishedRoot); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } } - parentFiber = parentFiber.sibling; - } -} -var suspenseyCommitFlag = 8192; -function recursivelyAccumulateSuspenseyCommit(parentFiber) { - if (parentFiber.subtreeFlags & suspenseyCommitFlag) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - accumulateSuspenseyCommitOnFiber(parentFiber), - (parentFiber = parentFiber.sibling); -} -function accumulateSuspenseyCommitOnFiber(fiber) { - switch (fiber.tag) { - case 26: - recursivelyAccumulateSuspenseyCommit(fiber); - if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) - throw Error( - "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." - ); break; + case 26: + case 27: case 5: - recursivelyAccumulateSuspenseyCommit(fiber); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + null === current && flags & 4 && commitHostComponentMount(finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; - case 3: - case 4: - recursivelyAccumulateSuspenseyCommit(fiber); + case 12: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + break; + case 13: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); break; case 22: - if (null === fiber.memoizedState) { - var current = fiber.alternate; - null !== current && null !== current.memoizedState - ? ((current = suspenseyCommitFlag), - (suspenseyCommitFlag = 16777216), - recursivelyAccumulateSuspenseyCommit(fiber), - (suspenseyCommitFlag = current)) - : recursivelyAccumulateSuspenseyCommit(fiber); - } + if (0 !== (finishedWork.mode & 1)) { + if ( + ((prevProps = + null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), + !prevProps) + ) { + current = + (null !== current && null !== current.memoizedState) || + offscreenSubtreeWasHidden; + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevProps; + (offscreenSubtreeWasHidden = current) && + !prevOffscreenSubtreeWasHidden + ? recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + 0 !== (finishedWork.subtreeFlags & 8772) + ) + : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + } + } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 512 && + ("manual" === finishedWork.memoizedProps.mode + ? safelyAttachRef(finishedWork, finishedWork.return) + : safelyDetachRef(finishedWork, finishedWork.return)); break; default: - recursivelyAccumulateSuspenseyCommit(fiber); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); } } -function detachAlternateSiblings(parentFiber) { - var previousFiber = parentFiber.alternate; - if ( - null !== previousFiber && - ((parentFiber = previousFiber.child), null !== parentFiber) - ) { - previousFiber.child = null; - do - (previousFiber = parentFiber.sibling), - (parentFiber.sibling = null), - (parentFiber = previousFiber); - while (null !== parentFiber); - } +function detachFiberAfterEffects(fiber) { + var alternate = fiber.alternate; + null !== alternate && + ((fiber.alternate = null), detachFiberAfterEffects(alternate)); + fiber.child = null; + fiber.deletions = null; + fiber.sibling = null; + fiber.stateNode = null; + fiber.return = null; + fiber.dependencies = null; + fiber.memoizedProps = null; + fiber.memoizedState = null; + fiber.pendingProps = null; + fiber.stateNode = null; + fiber.updateQueue = null; } -function recursivelyTraversePassiveUnmountEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); - } - detachAlternateSiblings(parentFiber); - } - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveUnmountOnFiber(parentFiber), - (parentFiber = parentFiber.sibling); +function recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + parent +) { + for (parent = parent.child; null !== parent; ) + commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), + (parent = parent.sibling); } -function commitPassiveUnmountOnFiber(finishedWork) { - switch (finishedWork.tag) { +function commitDeletionEffectsOnFiber( + finishedRoot, + nearestMountedAncestor, + deletedFiber +) { + if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) + try { + injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); + } catch (err) {} + switch (deletedFiber.tag) { + case 26: + case 27: + case 5: + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); + case 6: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + case 18: + break; + case 4: + passChildrenWhenCloningPersistedNodes || createChildNodeSet(); + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; case 0: case 11: + case 14: case 15: - recursivelyTraversePassiveUnmountEffects(finishedWork); - finishedWork.flags & 2048 && - commitHookEffectListUnmount(9, finishedWork, finishedWork.return); + if (!offscreenSubtreeWasHidden) { + var updateQueue = deletedFiber.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.lastEffect), null !== updateQueue) + ) { + var effect = (updateQueue = updateQueue.next); + do { + var tag = effect.tag, + inst = effect.inst, + destroy = inst.destroy; + void 0 !== destroy && + (0 !== (tag & 2) + ? ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + )) + : 0 !== (tag & 4) && + ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + ))); + effect = effect.next; + } while (effect !== updateQueue); + } + } + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + case 1: + if ( + !offscreenSubtreeWasHidden && + (safelyDetachRef(deletedFiber, nearestMountedAncestor), + (updateQueue = deletedFiber.stateNode), + "function" === typeof updateQueue.componentWillUnmount) + ) + try { + (updateQueue.props = deletedFiber.memoizedProps), + (updateQueue.state = deletedFiber.memoizedState), + updateQueue.componentWillUnmount(); + } catch (error) { + captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); + } + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + case 21: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); break; case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState && - instance._visibility & 4 && - (null === finishedWork.return || 13 !== finishedWork.return.tag) - ? ((instance._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(finishedWork)) - : recursivelyTraversePassiveUnmountEffects(finishedWork); + safelyDetachRef(deletedFiber, nearestMountedAncestor); + deletedFiber.mode & 1 + ? ((offscreenSubtreeWasHidden = + (updateQueue = offscreenSubtreeWasHidden) || + null !== deletedFiber.memoizedState), + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ), + (offscreenSubtreeWasHidden = updateQueue)) + : recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); break; default: - recursivelyTraversePassiveUnmountEffects(finishedWork); + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); } } -function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { +function getRetryCache(finishedWork) { + switch (finishedWork.tag) { + case 13: + case 19: + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); + return retryCache; + case 22: + return ( + (finishedWork = finishedWork.stateNode), + (retryCache = finishedWork._retryCache), + null === retryCache && + (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), + retryCache + ); + default: + throw Error( + "Unexpected Suspense handler tag (" + + finishedWork.tag + + "). This is a bug in React." + ); + } +} +function attachSuspenseRetryListeners(finishedWork, wakeables) { + var retryCache = getRetryCache(finishedWork); + wakeables.forEach(function (wakeable) { + var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); + retryCache.has(wakeable) || + (retryCache.add(wakeable), wakeable.then(retry, retry)); + }); +} +function recursivelyTraverseMutationEffects(root, parentFiber) { var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + try { + commitDeletionEffectsOnFiber(root, parentFiber, childToDelete); + var alternate = childToDelete.alternate; + null !== alternate && (alternate.return = null); + childToDelete.return = null; + } catch (error) { + captureCommitPhaseError(childToDelete, parentFiber, error); } - detachAlternateSiblings(parentFiber); - } - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - deletions = parentFiber; - switch (deletions.tag) { - case 0: - case 11: - case 15: - commitHookEffectListUnmount(8, deletions, deletions.return); - recursivelyTraverseDisconnectPassiveEffects(deletions); - break; - case 22: - i = deletions.stateNode; - i._visibility & 4 && - ((i._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(deletions)); - break; - default: - recursivelyTraverseDisconnectPassiveEffects(deletions); } - parentFiber = parentFiber.sibling; - } + if (parentFiber.subtreeFlags & 12854) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitMutationEffectsOnFiber(parentFiber, root), + (parentFiber = parentFiber.sibling); } -function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - deletedSubtreeRoot, - nearestMountedAncestor -) { - for (; null !== nextEffect; ) { - var fiber = nextEffect; - switch (fiber.tag) { +function commitMutationEffectsOnFiber(finishedWork, root) { + var current = finishedWork.alternate, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + try { + commitHookEffectListUnmount(3, finishedWork, finishedWork.return), + commitHookEffectListMount(3, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + try { + commitHookEffectListUnmount(5, finishedWork, finishedWork.return); + } catch (error$99) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$99); + } + } + break; + case 1: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + flags & 64 && + offscreenSubtreeIsHidden && + ((finishedWork = finishedWork.updateQueue), + null !== finishedWork && + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), + (finishedWork.shared.hiddenCallbacks = + null === current ? flags : current.concat(flags))))); + break; + case 26: + case 27: + case 5: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + break; + case 6: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 3: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 4: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 13: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (finishedWork.child.flags & 8192) { + var isShowingFallback = null !== finishedWork.memoizedState; + current = null !== current && null !== current.memoizedState; + alwaysThrottleRetries + ? isShowingFallback !== current && + (globalMostRecentFallbackTime = now()) + : isShowingFallback && + !current && + (globalMostRecentFallbackTime = now()); + } + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); + break; + case 22: + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + var isHidden = null !== finishedWork.memoizedState; + isShowingFallback = null !== current && null !== current.memoizedState; + if (finishedWork.mode & 1) { + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || isHidden; + offscreenSubtreeWasHidden = + prevOffscreenSubtreeWasHidden || isShowingFallback; + recursivelyTraverseMutationEffects(root, finishedWork); + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + } else recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + root = finishedWork.stateNode; + root._current = finishedWork; + root._visibility &= -3; + root._visibility |= root._pendingVisibility & 2; + flags & 8192 && + ((root._visibility = isHidden + ? root._visibility & -2 + : root._visibility | 1), + isHidden && + ((isHidden = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), + null === current || + isShowingFallback || + isHidden || + (0 !== (finishedWork.mode & 1) && + recursivelyTraverseDisappearLayoutEffects(finishedWork)))); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); + break; + case 19: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); + break; + case 21: + break; + default: + recursivelyTraverseMutationEffects(root, finishedWork), + commitReconciliationEffects(finishedWork); + } +} +function commitReconciliationEffects(finishedWork) { + var flags = finishedWork.flags; + flags & 2 && (finishedWork.flags &= -3); + flags & 4096 && (finishedWork.flags &= -4097); +} +function recursivelyTraverseLayoutEffects(root, parentFiber) { + if (parentFiber.subtreeFlags & 8772) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), + (parentFiber = parentFiber.sibling); +} +function recursivelyTraverseDisappearLayoutEffects(parentFiber) { + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedWork = parentFiber; + switch (finishedWork.tag) { case 0: case 11: + case 14: case 15: - commitHookEffectListUnmount(8, fiber, nearestMountedAncestor); + commitHookEffectListUnmount(4, finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); break; - case 23: - case 22: - if ( - null !== fiber.memoizedState && - null !== fiber.memoizedState.cachePool - ) { - var cache = fiber.memoizedState.cachePool.pool; - null != cache && cache.refCount++; + case 1: + safelyDetachRef(finishedWork, finishedWork.return); + var instance = finishedWork.stateNode; + if ("function" === typeof instance.componentWillUnmount) { + var current = finishedWork, + nearestMountedAncestor = finishedWork.return; + try { + var current$jscomp$0 = current; + instance.props = current$jscomp$0.memoizedProps; + instance.state = current$jscomp$0.memoizedState; + instance.componentWillUnmount(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } } + recursivelyTraverseDisappearLayoutEffects(finishedWork); break; - case 24: - releaseCache(fiber.memoizedState.cache); + case 26: + case 27: + case 5: + safelyDetachRef(finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 22: + safelyDetachRef(finishedWork, finishedWork.return); + null === finishedWork.memoizedState && + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + default: + recursivelyTraverseDisappearLayoutEffects(finishedWork); } - cache = fiber.child; - if (null !== cache) (cache.return = fiber), (nextEffect = cache); - else - a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { - cache = nextEffect; - var sibling = cache.sibling, - returnFiber = cache.return; - detachFiberAfterEffects(cache); - if (cache === fiber) { - nextEffect = null; - break a; - } - if (null !== sibling) { - sibling.return = returnFiber; - nextEffect = sibling; - break a; - } - nextEffect = returnFiber; - } + parentFiber = parentFiber.sibling; } } -var DefaultCacheDispatcher = { - getCacheSignal: function () { - return readContext(CacheContext).controller.signal; - }, - getCacheForType: function (resourceType) { - var cache = readContext(CacheContext), - cacheForType = cache.data.get(resourceType); - void 0 === cacheForType && - ((cacheForType = resourceType()), - cache.data.set(resourceType, cacheForType)); - return cacheForType; - } - }, - PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, - executionContext = 0, - workInProgressRoot = null, - workInProgress = null, - workInProgressRootRenderLanes = 0, - workInProgressSuspendedReason = 0, - workInProgressThrownValue = null, - workInProgressRootDidAttachPingListener = !1, - entangledRenderLanes = 0, - workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, - workInProgressRootSkippedLanes = 0, - workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootPingedLanes = 0, - workInProgressDeferredLane = 0, - workInProgressRootConcurrentErrors = null, - workInProgressRootRecoverableErrors = null, - workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, - globalMostRecentFallbackTime = 0, - workInProgressRootRenderTargetTime = Infinity, - workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, - legacyErrorBoundariesThatAlreadyFailed = null, - rootDoesHavePassiveEffects = !1, - rootWithPendingPassiveEffects = null, - pendingPassiveEffectsLanes = 0, - pendingPassiveEffectsRemainingLanes = 0, - pendingPassiveTransitions = null, - nestedUpdateCount = 0, - rootWithNestedUpdates = null; -function requestUpdateLane(fiber) { - if (0 === (fiber.mode & 1)) return 2; - if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) - return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== requestCurrentTransition()) - return ( - (fiber = currentEntangledLane), - 0 !== fiber ? fiber : requestTransitionLane() - ); - fiber = currentUpdatePriority; - if (0 === fiber) - a: { - fiber = fabricGetCurrentEventPriority - ? fabricGetCurrentEventPriority() - : null; - if (null != fiber) - switch (fiber) { - case FabricDiscretePriority: - fiber = 2; - break a; +function recursivelyTraverseReappearLayoutEffects( + finishedRoot$jscomp$0, + parentFiber, + includeWorkInProgressEffects +) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var current = parentFiber.alternate, + finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + commitHookLayoutEffects(finishedWork, 4); + break; + case 1: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + finishedRoot = finishedWork.stateNode; + if ("function" === typeof finishedRoot.componentDidMount) + try { + finishedRoot.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + current = finishedWork.updateQueue; + if (null !== current) { + var hiddenCallbacks = current.shared.hiddenCallbacks; + if (null !== hiddenCallbacks) + for ( + current.shared.hiddenCallbacks = null, current = 0; + current < hiddenCallbacks.length; + current++ + ) + callCallback(hiddenCallbacks[current], finishedRoot); } - fiber = 32; + includeWorkInProgressEffects && + flags & 64 && + commitClassCallbacks(finishedWork); + safelyAttachRef(finishedWork, finishedWork.return); + break; + case 26: + case 27: + case 5: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + includeWorkInProgressEffects && + null === current && + flags & 4 && + commitHostComponentMount(finishedWork); + safelyAttachRef(finishedWork, finishedWork.return); + break; + case 12: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + break; + case 13: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + break; + case 22: + null === finishedWork.memoizedState && + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + default: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); } - return fiber; + parentFiber = parentFiber.sibling; + } } -function requestDeferredLane() { - 0 === workInProgressDeferredLane && - (workInProgressDeferredLane = - 0 !== (workInProgressRootRenderLanes & 536870912) - ? 536870912 - : claimNextTransitionLane()); - var suspenseHandler = suspenseHandlerStackCursor.current; - null !== suspenseHandler && (suspenseHandler.flags |= 32); - return workInProgressDeferredLane; +function commitHookPassiveMountEffects(finishedWork, hookFlags) { + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } } -function scheduleUpdateOnFiber(root, fiber, lane) { - if ( - (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || - null !== root.cancelPendingCommit - ) - prepareFreshStack(root, 0), - markRootSuspended( +function commitOffscreenPassiveMountEffects(current, finishedWork) { + var previousCache = null; + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (previousCache = current.memoizedState.cachePool.pool); + current = null; + null !== finishedWork.memoizedState && + null !== finishedWork.memoizedState.cachePool && + (current = finishedWork.memoizedState.cachePool.pool); + current !== previousCache && + (null != current && current.refCount++, + null != previousCache && releaseCache(previousCache)); +} +function commitCachePassiveMountEffect(current, finishedWork) { + current = null; + null !== finishedWork.alternate && + (current = finishedWork.alternate.memoizedState.cache); + finishedWork = finishedWork.memoizedState.cache; + finishedWork !== current && + (finishedWork.refCount++, null != current && releaseCache(current)); +} +function recursivelyTraversePassiveMountEffects( + root, + parentFiber, + committedLanes, + committedTransitions +) { + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveMountOnFiber( root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); - markRootUpdated(root, lane); - if (0 === (executionContext & 2) || root !== workInProgressRoot) - root === workInProgressRoot && - (0 === (executionContext & 2) && - (workInProgressRootInterleavedUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - )), - ensureRootIsScheduled(root), - 2 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now() + 500), - flushSyncWorkAcrossRoots_impl(!0)); + parentFiber, + committedLanes, + committedTransitions + ), + (parentFiber = parentFiber.sibling); } -function performConcurrentWorkOnRoot(root, didTimeout) { - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var originalCallbackNode = root.callbackNode; - if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) - return null; - var lanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes : 0 - ); - if (0 === lanes) return null; - var exitStatus = (didTimeout = - 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes) && !didTimeout) - ? renderRootConcurrent(root, lanes) - : renderRootSync(root, lanes); - if (0 !== exitStatus) { - var renderWasConcurrent = didTimeout; - do { - if (6 === exitStatus) markRootSuspended(root, lanes, 0); - else { - didTimeout = root.current.alternate; - if ( - renderWasConcurrent && - !isRenderConsistentWithExternalStores(didTimeout) - ) { - exitStatus = renderRootSync(root, lanes); - renderWasConcurrent = !1; - continue; - } - if (2 === exitStatus) { - renderWasConcurrent = lanes; - var errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - renderWasConcurrent - ); - 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - root, - renderWasConcurrent, - errorRetryLanes - ))); - } - if (1 === exitStatus) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); - root.finishedWork = didTimeout; - root.finishedLanes = lanes; - a: { - renderWasConcurrent = root; - switch (exitStatus) { - case 0: - case 1: - throw Error("Root did not complete. This is a bug in React."); - case 4: - if ((lanes & 4194176) === lanes) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - break a; - } - break; - case 2: - case 3: - case 5: - break; - default: - throw Error("Unknown root exit status."); - } - if ( - (lanes & 62914560) === lanes && - (alwaysThrottleRetries || 3 === exitStatus) && - ((exitStatus = globalMostRecentFallbackTime + 300 - now()), - 10 < exitStatus) - ) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( - commitRootWhenReady.bind( - null, - renderWasConcurrent, - didTimeout, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane - ), - exitStatus - ); - break a; - } - commitRootWhenReady( - renderWasConcurrent, - didTimeout, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane - ); - } - } - break; - } while (1); - } - ensureRootIsScheduled(root); - scheduleTaskForRootDuringMicrotask(root, now()); - root = - root.callbackNode === originalCallbackNode - ? performConcurrentWorkOnRoot.bind(null, root) - : null; - return root; -} -function recoverFromConcurrentError( - root, - originallyAttemptedLanes, - errorRetryLanes +function commitPassiveMountOnFiber( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions ) { - var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, - JSCompiler_inline_result; - (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && - (prepareFreshStack(root, errorRetryLanes).flags |= 256); - errorRetryLanes = renderRootSync(root, errorRetryLanes); - if (2 !== errorRetryLanes) { - if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) - return ( - (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), - (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), - 4 + var flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions ); - root = workInProgressRootRecoverableErrors; - workInProgressRootRecoverableErrors = errorsFromFirstAttempt; - null !== root && queueRecoverableErrors(root); - } - return errorRetryLanes; -} -function queueRecoverableErrors(errors) { - null === workInProgressRootRecoverableErrors - ? (workInProgressRootRecoverableErrors = errors) - : workInProgressRootRecoverableErrors.push.apply( - workInProgressRootRecoverableErrors, - errors + flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); + break; + case 3: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + ((finishedRoot = null), + null !== finishedWork.alternate && + (finishedRoot = finishedWork.alternate.memoizedState.cache), + (finishedWork = finishedWork.memoizedState.cache), + finishedWork !== finishedRoot && + (finishedWork.refCount++, + null != finishedRoot && releaseCache(finishedRoot))); + break; + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) + : ((instance._visibility |= 4), + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + )) + : instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + 0 !== (finishedWork.subtreeFlags & 10256) + )); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions ); -} -function commitRootWhenReady( - root, - finishedWork, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - lanes, - spawnedLane -) { - 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); - commitRoot( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane - ); -} -function isRenderConsistentWithExternalStores(finishedWork) { - for (var node = finishedWork; ; ) { - if (node.flags & 16384) { - var updateQueue = node.updateQueue; - if ( - null !== updateQueue && - ((updateQueue = updateQueue.stores), null !== updateQueue) - ) - for (var i = 0; i < updateQueue.length; i++) { - var check = updateQueue[i], - getSnapshot = check.getSnapshot; - check = check.value; - try { - if (!objectIs(getSnapshot(), check)) return !1; - } catch (error) { - return !1; - } - } - } - updateQueue = node.child; - if (node.subtreeFlags & 16384 && null !== updateQueue) - (updateQueue.return = node), (node = updateQueue); - else { - if (node === finishedWork) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === finishedWork) return !0; - node = node.return; - } - node.sibling.return = node.return; - node = node.sibling; - } } - return !0; } -function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), (root.pingedLanes = 0)); - enableInfiniteRenderLoopDetection && - (executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), - throwIfInfiniteUpdateLoopDetected()); +function recursivelyTraverseReconnectPassiveEffects( + finishedRoot$jscomp$0, + parentFiber, + committedLanes$jscomp$0, + committedTransitions$jscomp$0, + includeWorkInProgressEffects +) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + committedLanes = committedLanes$jscomp$0, + committedTransitions = committedTransitions$jscomp$0, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + commitHookPassiveMountEffects(finishedWork, 8); + break; + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects( + finishedRoot, + finishedWork + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )); + includeWorkInProgressEffects && + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + includeWorkInProgressEffects && + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + } + parentFiber = parentFiber.sibling; + } } -function markRootSuspended(root, suspendedLanes, spawnedLane) { - suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - +function recursivelyTraverseAtomicPassiveEffects( + finishedRoot$jscomp$0, + parentFiber +) { + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 22: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + } + parentFiber = parentFiber.sibling; + } +} +var suspenseyCommitFlag = 8192; +function recursivelyAccumulateSuspenseyCommit(parentFiber) { + if (parentFiber.subtreeFlags & suspenseyCommitFlag) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + accumulateSuspenseyCommitOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); +} +function accumulateSuspenseyCommitOnFiber(fiber) { + switch (fiber.tag) { + case 26: + recursivelyAccumulateSuspenseyCommit(fiber); + if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) + throw Error( + "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." + ); + break; + case 5: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 3: + case 4: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 22: + if (null === fiber.memoizedState) { + var current = fiber.alternate; + null !== current && null !== current.memoizedState + ? ((current = suspenseyCommitFlag), + (suspenseyCommitFlag = 16777216), + recursivelyAccumulateSuspenseyCommit(fiber), + (suspenseyCommitFlag = current)) + : recursivelyAccumulateSuspenseyCommit(fiber); + } + break; + default: + recursivelyAccumulateSuspenseyCommit(fiber); + } +} +function detachAlternateSiblings(parentFiber) { + var previousFiber = parentFiber.alternate; + if ( + null !== previousFiber && + ((parentFiber = previousFiber.child), null !== parentFiber) ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4; - expirationTimes[index$4] = -1; - lanes &= ~lane; + previousFiber.child = null; + do + (previousFiber = parentFiber.sibling), + (parentFiber.sibling = null), + (parentFiber = previousFiber); + while (null !== parentFiber); } - 0 !== spawnedLane && - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } -function resetWorkInProgressStack() { - if (null !== workInProgress) { - if (0 === workInProgressSuspendedReason) - var interruptedWork = workInProgress.return; - else - (interruptedWork = workInProgress), - resetContextDependencies(), - resetHooksOnUnwind(interruptedWork), - (thenableState$1 = null), - (thenableIndexCounter$1 = 0), - (interruptedWork = workInProgress); - for (; null !== interruptedWork; ) - unwindInterruptedWork(interruptedWork.alternate, interruptedWork), - (interruptedWork = interruptedWork.return); - workInProgress = null; +function recursivelyTraversePassiveUnmountEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber + ); + } + detachAlternateSiblings(parentFiber); } + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveUnmountOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); } -function prepareFreshStack(root, lanes) { - root.finishedWork = null; - root.finishedLanes = 0; - var timeoutHandle = root.timeoutHandle; - -1 !== timeoutHandle && - ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); - timeoutHandle = root.cancelPendingCommit; - null !== timeoutHandle && - ((root.cancelPendingCommit = null), timeoutHandle()); - resetWorkInProgressStack(); - workInProgressRoot = root; - workInProgress = timeoutHandle = createWorkInProgress(root.current, null); - workInProgressRootRenderLanes = lanes; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; - workInProgressDeferredLane = - workInProgressRootPingedLanes = - workInProgressRootInterleavedUpdatedLanes = - workInProgressRootSkippedLanes = - 0; - workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = - null; - workInProgressRootDidIncludeRecursiveRenderUpdate = !1; - 0 !== (lanes & 8) && (lanes |= lanes & 32); - var allEntangledLanes = root.entangledLanes; - if (0 !== allEntangledLanes) - for ( - root = root.entanglements, allEntangledLanes &= lanes; - 0 < allEntangledLanes; - - ) { - var index$2 = 31 - clz32(allEntangledLanes), - lane = 1 << index$2; - lanes |= root[index$2]; - allEntangledLanes &= ~lane; - } - entangledRenderLanes = lanes; - finishQueueingConcurrentUpdates(); - return timeoutHandle; -} -function handleThrow(root, thrownValue) { - currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); - workInProgressThrownValue = thrownValue; - null === workInProgress && - ((workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue)); +function commitPassiveUnmountOnFiber(finishedWork) { + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraversePassiveUnmountEffects(finishedWork); + finishedWork.flags & 2048 && + commitHookEffectListUnmount(9, finishedWork, finishedWork.return); + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState && + instance._visibility & 4 && + (null === finishedWork.return || 13 !== finishedWork.return.tag) + ? ((instance._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(finishedWork)) + : recursivelyTraversePassiveUnmountEffects(finishedWork); + break; + default: + recursivelyTraversePassiveUnmountEffects(finishedWork); + } } -function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; - return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; +function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber + ); + } + detachAlternateSiblings(parentFiber); + } + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + deletions = parentFiber; + switch (deletions.tag) { + case 0: + case 11: + case 15: + commitHookEffectListUnmount(8, deletions, deletions.return); + recursivelyTraverseDisconnectPassiveEffects(deletions); + break; + case 22: + i = deletions.stateNode; + i._visibility & 4 && + ((i._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(deletions)); + break; + default: + recursivelyTraverseDisconnectPassiveEffects(deletions); + } + parentFiber = parentFiber.sibling; + } } -function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; - return prevCacheDispatcher; +function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + deletedSubtreeRoot, + nearestMountedAncestor +) { + for (; null !== nextEffect; ) { + var fiber = nextEffect; + switch (fiber.tag) { + case 0: + case 11: + case 15: + commitHookEffectListUnmount(8, fiber, nearestMountedAncestor); + break; + case 23: + case 22: + if ( + null !== fiber.memoizedState && + null !== fiber.memoizedState.cachePool + ) { + var cache = fiber.memoizedState.cachePool.pool; + null != cache && cache.refCount++; + } + break; + case 24: + releaseCache(fiber.memoizedState.cache); + } + cache = fiber.child; + if (null !== cache) (cache.return = fiber), (nextEffect = cache); + else + a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { + cache = nextEffect; + var sibling = cache.sibling, + returnFiber = cache.return; + detachFiberAfterEffects(cache); + if (cache === fiber) { + nextEffect = null; + break a; + } + if (null !== sibling) { + sibling.return = returnFiber; + nextEffect = sibling; + break a; + } + nextEffect = returnFiber; + } + } } -function renderDidSuspendDelayIfPossible() { - workInProgressRootExitStatus = 4; - (0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || - null === workInProgressRoot || - markRootSuspended( - workInProgressRoot, - workInProgressRootRenderLanes, - workInProgressDeferredLane +var DefaultCacheDispatcher = { + getCacheSignal: function () { + return readContext(CacheContext).controller.signal; + }, + getCacheForType: function (resourceType) { + var cache = readContext(CacheContext), + cacheForType = cache.data.get(resourceType); + void 0 === cacheForType && + ((cacheForType = resourceType()), + cache.data.set(resourceType, cacheForType)); + return cacheForType; + } + }, + PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + executionContext = 0, + workInProgressRoot = null, + workInProgress = null, + workInProgressRootRenderLanes = 0, + workInProgressSuspendedReason = 0, + workInProgressThrownValue = null, + workInProgressRootDidAttachPingListener = !1, + entangledRenderLanes = 0, + workInProgressRootExitStatus = 0, + workInProgressRootFatalError = null, + workInProgressRootSkippedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, + workInProgressRootDidIncludeRecursiveRenderUpdate = !1, + didIncludeCommitPhaseUpdate = !1, + globalMostRecentFallbackTime = 0, + workInProgressRootRenderTargetTime = Infinity, + workInProgressTransitions = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsLanes = 0, + pendingPassiveEffectsRemainingLanes = 0, + pendingPassiveTransitions = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null; +function requestUpdateLane(fiber) { + if (0 === (fiber.mode & 1)) return 2; + if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) + return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; + if (null !== requestCurrentTransition()) + return ( + (fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane() ); -} -function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) - (workInProgressTransitions = null), prepareFreshStack(root, lanes); - lanes = !1; - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - var unitOfWork = workInProgress, - thrownValue = workInProgressThrownValue; - switch (workInProgressSuspendedReason) { - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; + fiber = currentUpdatePriority; + if (0 === fiber) + a: { + fiber = fabricGetCurrentEventPriority + ? fabricGetCurrentEventPriority() + : null; + if (null != fiber) + switch (fiber) { + case FabricDiscretePriority: + fiber = 2; break a; - case 3: - case 2: - lanes || - null !== suspenseHandlerStackCursor.current || - (lanes = !0); - default: - (workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, unitOfWork, thrownValue); } - } - workLoopSync(); - break; - } catch (thrownValue$111) { - handleThrow(root, thrownValue$111); + fiber = 32; } - while (1); - lanes && root.shellSuspendCounter++; - resetContextDependencies(); - executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - if (null !== workInProgress) - throw Error( - "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." - ); - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; + return fiber; } -function workLoopSync() { - for (; null !== workInProgress; ) performUnitOfWork(workInProgress); +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : claimNextTransitionLane()); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); + return workInProgressDeferredLane; } -function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) - (workInProgressTransitions = null), - (workInProgressRootRenderTargetTime = now() + 500), - prepareFreshStack(root, lanes); - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - lanes = workInProgress; - var thrownValue = workInProgressThrownValue; - b: switch (workInProgressSuspendedReason) { - case 1: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 2: - if (isThenableResolved(thrownValue)) { - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - replaySuspendedUnitOfWork(lanes); +function scheduleUpdateOnFiber(root, fiber, lane) { + if ( + (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || + null !== root.cancelPendingCommit + ) + prepareFreshStack(root, 0), + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); + markRootUpdated(root, lane); + if (0 === (executionContext & 2) || root !== workInProgressRoot) + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )), + ensureRootIsScheduled(root), + 2 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now() + 500), + flushSyncWorkAcrossRoots_impl(!0)); +} +function performConcurrentWorkOnRoot(root, didTimeout) { + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var originalCallbackNode = root.callbackNode; + if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) + return null; + var lanes = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes : 0 + ); + if (0 === lanes) return null; + var exitStatus = (didTimeout = + 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes) && !didTimeout) + ? renderRootConcurrent(root, lanes) + : renderRootSync(root, lanes); + if (0 !== exitStatus) { + var renderWasConcurrent = didTimeout; + do { + if (6 === exitStatus) markRootSuspended(root, lanes, 0); + else { + didTimeout = root.current.alternate; + if ( + renderWasConcurrent && + !isRenderConsistentWithExternalStores(didTimeout) + ) { + exitStatus = renderRootSync(root, lanes); + renderWasConcurrent = !1; + continue; + } + if (2 === exitStatus) { + renderWasConcurrent = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + renderWasConcurrent + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + renderWasConcurrent, + errorRetryLanes + ))); + } + if (1 === exitStatus) + throw ( + ((originalCallbackNode = workInProgressRootFatalError), + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + originalCallbackNode) + ); + root.finishedWork = didTimeout; + root.finishedLanes = lanes; + a: { + renderWasConcurrent = root; + switch (exitStatus) { + case 0: + case 1: + throw Error("Root did not complete. This is a bug in React."); + case 4: + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + break a; + } break; - } - lanes = function () { - 2 === workInProgressSuspendedReason && - workInProgressRoot === root && - (workInProgressSuspendedReason = 7); - ensureRootIsScheduled(root); - }; - thrownValue.then(lanes, lanes); - break a; - case 3: - workInProgressSuspendedReason = 7; - break a; - case 4: - workInProgressSuspendedReason = 5; - break a; - case 7: - isThenableResolved(thrownValue) - ? ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - replaySuspendedUnitOfWork(lanes)) - : ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, lanes, thrownValue)); - break; - case 5: - switch (workInProgress.tag) { - case 5: - case 26: - case 27: - lanes = workInProgress; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - var sibling = lanes.sibling; - if (null !== sibling) workInProgress = sibling; - else { - var returnFiber = lanes.return; - null !== returnFiber - ? ((workInProgress = returnFiber), - completeUnitOfWork(returnFiber)) - : (workInProgress = null); - } - break b; - } - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 6: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; + case 2: + case 3: + case 5: + break; + default: + throw Error("Unknown root exit status."); + } + if ( + (lanes & 62914560) === lanes && + (alwaysThrottleRetries || 3 === exitStatus) && + ((exitStatus = globalMostRecentFallbackTime + 300 - now()), + 10 < exitStatus) + ) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; + renderWasConcurrent.timeoutHandle = scheduleTimeout( + commitRootWhenReady.bind( + null, + renderWasConcurrent, + didTimeout, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ), + exitStatus + ); break a; - default: - throw Error("Unexpected SuspendedReason. This is a bug in React."); + } + commitRootWhenReady( + renderWasConcurrent, + didTimeout, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ); } } - workLoopConcurrent(); break; - } catch (thrownValue$113) { - handleThrow(root, thrownValue$113); - } - while (1); - resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - executionContext = prevExecutionContext; - if (null !== workInProgress) return 0; - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; -} -function workLoopConcurrent() { - for (; null !== workInProgress && !shouldYield(); ) - performUnitOfWork(workInProgress); -} -function performUnitOfWork(unitOfWork) { - var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - ReactCurrentOwner.current = null; -} -function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; - switch (unitOfWork.tag) { - case 2: - unitOfWork.tag = 0; - case 15: - case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - var context = isContextProvider(Component) - ? previousContext - : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - context, - workInProgressRootRenderLanes - ); - break; - case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - unitOfWork.ref, - workInProgressRootRenderLanes - ); - break; - case 5: - resetHooksOnUnwind(unitOfWork); - default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); - } - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - ReactCurrentOwner.current = null; -} -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { - resetContextDependencies(); - resetHooksOnUnwind(unitOfWork); - thenableState$1 = null; - thenableIndexCounter$1 = 0; - var returnFiber = unitOfWork.return; - try { - if ( - throwException( - root, - returnFiber, - unitOfWork, - thrownValue, - workInProgressRootRenderLanes - ) - ) { - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; - } - } catch (error) { - if (null !== returnFiber) throw ((workInProgress = returnFiber), error); - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; + } while (1); } - if (unitOfWork.flags & 32768) - a: { - root = unitOfWork; - do { - unitOfWork = unwindWork(root.alternate, root); - if (null !== unitOfWork) { - unitOfWork.flags &= 32767; - workInProgress = unitOfWork; - break a; - } - root = root.return; - null !== root && - ((root.flags |= 32768), - (root.subtreeFlags = 0), - (root.deletions = null)); - workInProgress = root; - } while (null !== root); - workInProgressRootExitStatus = 6; - workInProgress = null; - } - else completeUnitOfWork(unitOfWork); -} -function completeUnitOfWork(unitOfWork) { - var completedWork = unitOfWork; - do { - unitOfWork = completedWork.return; - var next = completeWork( - completedWork.alternate, - completedWork, - entangledRenderLanes - ); - if (null !== next) { - workInProgress = next; - return; - } - completedWork = completedWork.sibling; - if (null !== completedWork) { - workInProgress = completedWork; - return; - } - workInProgress = completedWork = unitOfWork; - } while (null !== completedWork); - 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); + ensureRootIsScheduled(root); + scheduleTaskForRootDuringMicrotask(root, now()); + root = + root.callbackNode === originalCallbackNode + ? performConcurrentWorkOnRoot.bind(null, root) + : null; + return root; } -function commitRoot( +function recoverFromConcurrentError( root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane + originallyAttemptedLanes, + errorRetryLanes ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; - try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - previousUpdateLanePriority, - spawnedLane + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, + JSCompiler_inline_result; + (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && + (prepareFreshStack(root, errorRetryLanes).flags |= 256); + errorRetryLanes = renderRootSync(root, errorRetryLanes); + if (2 !== errorRetryLanes) { + if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) + return ( + (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), + (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), + 4 ); - } finally { - (ReactCurrentBatchConfig.transition = prevTransition), - (currentUpdatePriority = previousUpdateLanePriority); + root = workInProgressRootRecoverableErrors; + workInProgressRootRecoverableErrors = errorsFromFirstAttempt; + null !== root && queueRecoverableErrors(root); } - return null; + return errorRetryLanes; } -function commitRootImpl( +function queueRecoverableErrors(errors) { + null === workInProgressRootRecoverableErrors + ? (workInProgressRootRecoverableErrors = errors) + : workInProgressRootRecoverableErrors.push.apply( + workInProgressRootRecoverableErrors, + errors + ); +} +function commitRootWhenReady( root, + finishedWork, recoverableErrors, transitions, didIncludeRenderPhaseUpdate, - renderPriorityLevel, + lanes, spawnedLane ) { - do flushPassiveEffects(); - while (null !== rootWithPendingPassiveEffects); - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; - if (null === finishedWork) return null; - root.finishedWork = null; - root.finishedLanes = 0; - if (finishedWork === root.current) - throw Error( - "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." - ); - root.callbackNode = null; - root.callbackPriority = 0; - root.cancelPendingCommit = null; - var remainingLanes = finishedWork.lanes | finishedWork.childLanes; - remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes, spawnedLane); - didIncludeCommitPhaseUpdate = !1; - root === workInProgressRoot && - ((workInProgress = workInProgressRoot = null), - (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 10256) && - 0 === (finishedWork.flags & 10256)) || - rootDoesHavePassiveEffects || - ((rootDoesHavePassiveEffects = !0), - (pendingPassiveEffectsRemainingLanes = remainingLanes), - (pendingPassiveTransitions = transitions), - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - })); - transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; - spawnedLane = currentUpdatePriority; - currentUpdatePriority = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - ReactCurrentOwner.current = null; - commitBeforeMutationEffects(root, finishedWork); - commitMutationEffectsOnFiber(finishedWork, root); - root.current = finishedWork; - commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); - requestPaint(); - executionContext = prevExecutionContext; - currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; - } else root.current = finishedWork; - rootDoesHavePassiveEffects - ? ((rootDoesHavePassiveEffects = !1), - (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) - : releaseRootPooledCache(root, remainingLanes); - remainingLanes = root.pendingLanes; - 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); - onCommitRoot(finishedWork.stateNode, renderPriorityLevel); - ensureRootIsScheduled(root); - if (null !== recoverableErrors) - for ( - renderPriorityLevel = root.onRecoverableError, finishedWork = 0; - finishedWork < recoverableErrors.length; - finishedWork++ - ) - (remainingLanes = recoverableErrors[finishedWork]), - (transitions = { - digest: remainingLanes.digest, - componentStack: remainingLanes.stack - }), - renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); - 0 !== (pendingPassiveEffectsLanes & 3) && - 0 !== root.tag && - flushPassiveEffects(); - remainingLanes = root.pendingLanes; - (enableInfiniteRenderLoopDetection && - (didIncludeRenderPhaseUpdate || didIncludeCommitPhaseUpdate)) || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes)) - ? root === rootWithNestedUpdates - ? nestedUpdateCount++ - : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) - : (nestedUpdateCount = 0); - flushSyncWorkAcrossRoots_impl(!1); - return null; -} -function releaseRootPooledCache(root, remainingLanes) { - 0 === (root.pooledCacheLanes &= remainingLanes) && - ((remainingLanes = root.pooledCache), - null != remainingLanes && - ((root.pooledCache = null), releaseCache(remainingLanes))); + 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); + commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane + ); } -function flushPassiveEffects() { - if (null !== rootWithPendingPassiveEffects) { - var root = rootWithPendingPassiveEffects, - remainingLanes = pendingPassiveEffectsRemainingLanes; - pendingPassiveEffectsRemainingLanes = 0; - var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; - try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; - if (null === rootWithPendingPassiveEffects) - var JSCompiler_inline_result = !1; - else { - priority = pendingPassiveTransitions; - pendingPassiveTransitions = null; - var root$jscomp$0 = rootWithPendingPassiveEffects, - lanes = pendingPassiveEffectsLanes; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsLanes = 0; - if (0 !== (executionContext & 6)) - throw Error("Cannot flush passive effects while already rendering."); - var prevExecutionContext = executionContext; - executionContext |= 4; - commitPassiveUnmountOnFiber(root$jscomp$0.current); - commitPassiveMountOnFiber( - root$jscomp$0, - root$jscomp$0.current, - lanes, - priority - ); - executionContext = prevExecutionContext; - flushSyncWorkAcrossRoots_impl(!1); - if ( - injectedHook && - "function" === typeof injectedHook.onPostCommitFiberRoot - ) +function isRenderConsistentWithExternalStores(finishedWork) { + for (var node = finishedWork; ; ) { + if (node.flags & 16384) { + var updateQueue = node.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.stores), null !== updateQueue) + ) + for (var i = 0; i < updateQueue.length; i++) { + var check = updateQueue[i], + getSnapshot = check.getSnapshot; + check = check.value; try { - injectedHook.onPostCommitFiberRoot(rendererID, root$jscomp$0); - } catch (err) {} - JSCompiler_inline_result = !0; - } - return JSCompiler_inline_result; - } finally { - (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), - releaseRootPooledCache(root, remainingLanes); - } - } - return !1; -} -function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); - rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); - null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); -} -function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { - if (3 === sourceFiber.tag) - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - else - for (; null !== nearestMountedAncestor; ) { - if (3 === nearestMountedAncestor.tag) { - captureCommitPhaseErrorOnRoot( - nearestMountedAncestor, - sourceFiber, - error - ); - break; - } else if (1 === nearestMountedAncestor.tag) { - var instance = nearestMountedAncestor.stateNode; - if ( - "function" === - typeof nearestMountedAncestor.type.getDerivedStateFromError || - ("function" === typeof instance.componentDidCatch && - (null === legacyErrorBoundariesThatAlreadyFailed || - !legacyErrorBoundariesThatAlreadyFailed.has(instance))) - ) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createClassErrorUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - nearestMountedAncestor = enqueueUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - null !== nearestMountedAncestor && - (markRootUpdated(nearestMountedAncestor, 2), - ensureRootIsScheduled(nearestMountedAncestor)); - break; + if (!objectIs(getSnapshot(), check)) return !1; + } catch (error) { + return !1; + } } + } + updateQueue = node.child; + if (node.subtreeFlags & 16384 && null !== updateQueue) + (updateQueue.return = node), (node = updateQueue); + else { + if (node === finishedWork) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === finishedWork) return !0; + node = node.return; } - nearestMountedAncestor = nearestMountedAncestor.return; + node.sibling.return = node.return; + node = node.sibling; } + } + return !0; } -function attachPingListener(root, wakeable, lanes) { - var pingCache = root.pingCache; - if (null === pingCache) { - pingCache = root.pingCache = new PossiblyWeakMap(); - var threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else - (threadIDs = pingCache.get(wakeable)), - void 0 === threadIDs && - ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); - threadIDs.has(lanes) || - ((workInProgressRootDidAttachPingListener = !0), - threadIDs.add(lanes), - (root = pingSuspendedRoot.bind(null, root, wakeable, lanes)), - wakeable.then(root, root)); -} -function pingSuspendedRoot(root, wakeable, pingedLanes) { - var pingCache = root.pingCache; - null !== pingCache && pingCache.delete(wakeable); - root.pingedLanes |= root.suspendedLanes & pingedLanes; +function markRootUpdated(root, updatedLanes) { + root.pendingLanes |= updatedLanes; + 268435456 !== updatedLanes && + ((root.suspendedLanes = 0), (root.pingedLanes = 0)); enableInfiniteRenderLoopDetection && (executionContext & 2 ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), throwIfInfiniteUpdateLoopDetected()); - workInProgressRoot === root && - (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && - (4 === workInProgressRootExitStatus || - (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes && - 300 > now() - globalMostRecentFallbackTime) - ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) - : (workInProgressRootPingedLanes |= pingedLanes)); - ensureRootIsScheduled(root); } -function retryTimedOutBoundary(boundaryFiber, retryLane) { - 0 === retryLane && - (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); - boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); - null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), - ensureRootIsScheduled(boundaryFiber)); +function markRootSuspended(root, suspendedLanes, spawnedLane) { + suspendedLanes &= ~workInProgressRootPingedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$4 = 31 - clz32(lanes), + lane = 1 << index$4; + expirationTimes[index$4] = -1; + lanes &= ~lane; + } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } -function retryDehydratedSuspenseBoundary(boundaryFiber) { - var suspenseState = boundaryFiber.memoizedState, - retryLane = 0; - null !== suspenseState && (retryLane = suspenseState.retryLane); - retryTimedOutBoundary(boundaryFiber, retryLane); +function resetWorkInProgressStack() { + if (null !== workInProgress) { + if (0 === workInProgressSuspendedReason) + var interruptedWork = workInProgress.return; + else + (interruptedWork = workInProgress), + resetContextDependencies(), + resetHooksOnUnwind(interruptedWork), + (thenableState$1 = null), + (thenableIndexCounter$1 = 0), + (interruptedWork = workInProgress); + for (; null !== interruptedWork; ) + unwindInterruptedWork(interruptedWork.alternate, interruptedWork), + (interruptedWork = interruptedWork.return); + workInProgress = null; + } } -function resolveRetryWakeable(boundaryFiber, wakeable) { - var retryLane = 0; - switch (boundaryFiber.tag) { - case 13: - var retryCache = boundaryFiber.stateNode; - var suspenseState = boundaryFiber.memoizedState; - null !== suspenseState && (retryLane = suspenseState.retryLane); - break; - case 19: - retryCache = boundaryFiber.stateNode; - break; - case 22: - retryCache = boundaryFiber.stateNode._retryCache; - break; - default: - throw Error( - "Pinged unknown suspense boundary type. This is probably a bug in React." - ); - } - null !== retryCache && retryCache.delete(wakeable); - retryTimedOutBoundary(boundaryFiber, retryLane); +function prepareFreshStack(root, lanes) { + root.finishedWork = null; + root.finishedLanes = 0; + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + timeoutHandle = root.cancelPendingCommit; + null !== timeoutHandle && + ((root.cancelPendingCommit = null), timeoutHandle()); + resetWorkInProgressStack(); + workInProgressRoot = root; + workInProgress = timeoutHandle = createWorkInProgress(root.current, null); + workInProgressRootRenderLanes = lanes; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + workInProgressRootDidAttachPingListener = !1; + workInProgressRootExitStatus = 0; + workInProgressRootFatalError = null; + workInProgressDeferredLane = + workInProgressRootPingedLanes = + workInProgressRootInterleavedUpdatedLanes = + workInProgressRootSkippedLanes = + 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = + null; + workInProgressRootDidIncludeRecursiveRenderUpdate = !1; + 0 !== (lanes & 8) && (lanes |= lanes & 32); + var allEntangledLanes = root.entangledLanes; + if (0 !== allEntangledLanes) + for ( + root = root.entanglements, allEntangledLanes &= lanes; + 0 < allEntangledLanes; + + ) { + var index$2 = 31 - clz32(allEntangledLanes), + lane = 1 << index$2; + lanes |= root[index$2]; + allEntangledLanes &= ~lane; + } + entangledRenderLanes = lanes; + finishQueueingConcurrentUpdates(); + return timeoutHandle; } -function throwIfInfiniteUpdateLoopDetected() { - if (50 < nestedUpdateCount) - throw ( - ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - enableInfiniteRenderLoopDetection && - executionContext & 2 && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - )) +function handleThrow(root, thrownValue) { + currentlyRenderingFiber$1 = null; + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactCurrentOwner.current = null; + thrownValue === SuspenseException + ? ((thrownValue = getSuspendedThenable()), + (root = suspenseHandlerStackCursor.current), + (workInProgressSuspendedReason = + (null !== root && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + root !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2)) + : thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); + workInProgressThrownValue = thrownValue; + null === workInProgress && + ((workInProgressRootExitStatus = 1), + (workInProgressRootFatalError = thrownValue)); +} +function pushDispatcher() { + var prevDispatcher = ReactCurrentDispatcher.current; + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; +} +function pushCacheDispatcher() { + var prevCacheDispatcher = ReactCurrentCache.current; + ReactCurrentCache.current = DefaultCacheDispatcher; + return prevCacheDispatcher; +} +function renderDidSuspendDelayIfPossible() { + workInProgressRootExitStatus = 4; + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane ); } -var beginWork; -beginWork = function (current, workInProgress, renderLanes) { - if (null !== current) - if ( - current.memoizedProps !== workInProgress.pendingProps || - didPerformWorkStackCursor.current - ) - didReceiveUpdate = !0; - else { - if ( - 0 === (current.lanes & renderLanes) && - 0 === (workInProgress.flags & 128) - ) - return ( - (didReceiveUpdate = !1), - attemptEarlyBailoutIfNoScheduledUpdate( - current, - workInProgress, - renderLanes - ) - ); - didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; - } - else didReceiveUpdate = !1; - workInProgress.lanes = 0; - switch (workInProgress.tag) { - case 2: - var Component = workInProgress.type; - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - var context = getMaskedContext( - workInProgress, - contextStackCursor$1.current - ); - prepareToReadContext(workInProgress, renderLanes); - current = renderWithHooks( - null, - workInProgress, - Component, - current, - context, - renderLanes - ); - workInProgress.flags |= 1; - workInProgress.tag = 0; - reconcileChildren(null, workInProgress, current, renderLanes); - workInProgress = workInProgress.child; - return workInProgress; - case 16: - Component = workInProgress.elementType; - a: { - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - context = Component._init; - Component = context(Component._payload); - workInProgress.type = Component; - context = workInProgress.tag = resolveLazyComponentTag(Component); - current = resolveDefaultProps(Component, current); - switch (context) { - case 0: - workInProgress = updateFunctionComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 1: - workInProgress = updateClassComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 11: - workInProgress = updateForwardRef( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 14: - workInProgress = updateMemoComponent( - null, - workInProgress, - Component, - resolveDefaultProps(Component.type, current), - renderLanes - ); +function renderRootSync(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) + (workInProgressTransitions = null), prepareFreshStack(root, lanes); + lanes = !1; + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + var unitOfWork = workInProgress, + thrownValue = workInProgressThrownValue; + switch (workInProgressSuspendedReason) { + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; break a; + case 3: + case 2: + lanes || + null !== suspenseHandlerStackCursor.current || + (lanes = !0); + default: + (workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, unitOfWork, thrownValue); } - throw Error( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." - ); } - return workInProgress; - case 0: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateFunctionComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) + workLoopSync(); + break; + } catch (thrownValue$111) { + handleThrow(root, thrownValue$111); + } + while (1); + lanes && root.shellSuspendCounter++; + resetContextDependencies(); + executionContext = prevExecutionContext; + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + if (null !== workInProgress) + throw Error( + "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." + ); + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; +} +function workLoopSync() { + for (; null !== workInProgress; ) performUnitOfWork(workInProgress); +} +function renderRootConcurrent(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) + (workInProgressTransitions = null), + (workInProgressRootRenderTargetTime = now() + 500), + prepareFreshStack(root, lanes); + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + lanes = workInProgress; + var thrownValue = workInProgressThrownValue; + b: switch (workInProgressSuspendedReason) { + case 1: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 2: + if (isThenableResolved(thrownValue)) { + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + replaySuspendedUnitOfWork(lanes); + break; + } + lanes = function () { + 2 === workInProgressSuspendedReason && + workInProgressRoot === root && + (workInProgressSuspendedReason = 7); + ensureRootIsScheduled(root); + }; + thrownValue.then(lanes, lanes); + break a; + case 3: + workInProgressSuspendedReason = 7; + break a; + case 4: + workInProgressSuspendedReason = 5; + break a; + case 7: + isThenableResolved(thrownValue) + ? ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + replaySuspendedUnitOfWork(lanes)) + : ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, lanes, thrownValue)); + break; + case 5: + switch (workInProgress.tag) { + case 5: + case 26: + case 27: + lanes = workInProgress; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + var sibling = lanes.sibling; + if (null !== sibling) workInProgress = sibling; + else { + var returnFiber = lanes.return; + null !== returnFiber + ? ((workInProgress = returnFiber), + completeUnitOfWork(returnFiber)) + : (workInProgress = null); + } + break b; + } + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 6: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + default: + throw Error("Unexpected SuspendedReason. This is a bug in React."); + } + } + workLoopConcurrent(); + break; + } catch (thrownValue$113) { + handleThrow(root, thrownValue$113); + } + while (1); + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + executionContext = prevExecutionContext; + if (null !== workInProgress) return 0; + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; +} +function workLoopConcurrent() { + for (; null !== workInProgress && !shouldYield(); ) + performUnitOfWork(workInProgress); +} +function performUnitOfWork(unitOfWork) { + var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); + ReactCurrentOwner.current = null; +} +function replaySuspendedUnitOfWork(unitOfWork) { + var current = unitOfWork.alternate; + switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; + case 15: + case 0: + var Component = unitOfWork.type, + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor$1.current; + context = getMaskedContext(unitOfWork, context); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + context, + workInProgressRootRenderLanes ); - case 1: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateClassComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) + break; + case 11: + Component = unitOfWork.type.render; + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + unitOfWork.ref, + workInProgressRootRenderLanes ); - case 3: - pushHostRootContext(workInProgress); - if (null === current) - throw Error("Should have a current fiber. This is a bug in React."); - var nextProps = workInProgress.pendingProps; - context = workInProgress.memoizedState; - Component = context.element; - cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, nextProps, null, renderLanes); - nextProps = workInProgress.memoizedState; - var nextCache = nextProps.cache; - pushProvider(workInProgress, CacheContext, nextCache); - nextCache !== context.cache && - propagateContextChange(workInProgress, CacheContext, renderLanes); - suspendIfUpdateReadFromEntangledAsyncAction(); - context = nextProps.element; - context === Component - ? (workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - )) - : (reconcileChildren(current, workInProgress, context, renderLanes), - (workInProgress = workInProgress.child)); - return workInProgress; - case 26: - case 27: + break; case 5: - pushHostContext(workInProgress); - Component = workInProgress.pendingProps.children; - if (enableAsyncActions && null !== workInProgress.memoizedState) { - if (!enableAsyncActions) throw Error("Not implemented."); - context = renderWithHooks( - current, - workInProgress, - TransitionAwareHostComponent, - null, - null, - renderLanes - ); - HostTransitionContext._currentValue2 = context; - didReceiveUpdate && - null !== current && - current.memoizedState.memoizedState !== context && - propagateContextChange( - workInProgress, - HostTransitionContext, - renderLanes - ); - } - markRef(current, workInProgress); - reconcileChildren(current, workInProgress, Component, renderLanes); - return workInProgress.child; - case 6: - return null; - case 13: - return updateSuspenseComponent(current, workInProgress, renderLanes); - case 4: - return ( - pushHostContainer( - workInProgress, - workInProgress.stateNode.containerInfo - ), - (Component = workInProgress.pendingProps), - null === current - ? (workInProgress.child = reconcileChildFibers( - workInProgress, - null, - Component, - renderLanes - )) - : reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child + resetHooksOnUnwind(unitOfWork); + default: + unwindInterruptedWork(current, unitOfWork), + (unitOfWork = workInProgress = + resetWorkInProgress(unitOfWork, entangledRenderLanes)), + (current = beginWork(current, unitOfWork, entangledRenderLanes)); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current + ? completeUnitOfWork(unitOfWork) + : (workInProgress = current); + ReactCurrentOwner.current = null; +} +function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + resetContextDependencies(); + resetHooksOnUnwind(unitOfWork); + thenableState$1 = null; + thenableIndexCounter$1 = 0; + var returnFiber = unitOfWork.return; + try { + if ( + throwException( + root, + returnFiber, + unitOfWork, + thrownValue, + workInProgressRootRenderLanes + ) + ) { + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + } catch (error) { + if (null !== returnFiber) throw ((workInProgress = returnFiber), error); + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + if (unitOfWork.flags & 32768) + a: { + root = unitOfWork; + do { + unitOfWork = unwindWork(root.alternate, root); + if (null !== unitOfWork) { + unitOfWork.flags &= 32767; + workInProgress = unitOfWork; + break a; + } + root = root.return; + null !== root && + ((root.flags |= 32768), + (root.subtreeFlags = 0), + (root.deletions = null)); + workInProgress = root; + } while (null !== root); + workInProgressRootExitStatus = 6; + workInProgress = null; + } + else completeUnitOfWork(unitOfWork); +} +function completeUnitOfWork(unitOfWork) { + var completedWork = unitOfWork; + do { + unitOfWork = completedWork.return; + var next = completeWork( + completedWork.alternate, + completedWork, + entangledRenderLanes + ); + if (null !== next) { + workInProgress = next; + return; + } + completedWork = completedWork.sibling; + if (null !== completedWork) { + workInProgress = completedWork; + return; + } + workInProgress = completedWork = unitOfWork; + } while (null !== completedWork); + 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); +} +function commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane +) { + var previousUpdateLanePriority = currentUpdatePriority, + prevTransition = ReactCurrentBatchConfig.transition; + try { + (ReactCurrentBatchConfig.transition = null), + (currentUpdatePriority = 2), + commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + previousUpdateLanePriority, + spawnedLane ); - case 11: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateForwardRef( - current, - workInProgress, - Component, - context, - renderLanes + } finally { + (ReactCurrentBatchConfig.transition = prevTransition), + (currentUpdatePriority = previousUpdateLanePriority); + } + return null; +} +function commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + renderPriorityLevel, + spawnedLane +) { + do flushPassiveEffects(); + while (null !== rootWithPendingPassiveEffects); + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var finishedWork = root.finishedWork, + lanes = root.finishedLanes; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedLanes = 0; + if (finishedWork === root.current) + throw Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ); + root.callbackNode = null; + root.callbackPriority = 0; + root.cancelPendingCommit = null; + var remainingLanes = finishedWork.lanes | finishedWork.childLanes; + remainingLanes |= concurrentlyUpdatedLanes; + markRootFinished(root, remainingLanes, spawnedLane); + didIncludeCommitPhaseUpdate = !1; + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), + (workInProgressRootRenderLanes = 0)); + (0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || + rootDoesHavePassiveEffects || + ((rootDoesHavePassiveEffects = !0), + (pendingPassiveEffectsRemainingLanes = remainingLanes), + (pendingPassiveTransitions = transitions), + scheduleCallback(NormalPriority$1, function () { + flushPassiveEffects(); + return null; + })); + transitions = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { + transitions = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = null; + spawnedLane = currentUpdatePriority; + currentUpdatePriority = 2; + var prevExecutionContext = executionContext; + executionContext |= 4; + ReactCurrentOwner.current = null; + commitBeforeMutationEffects(root, finishedWork); + commitMutationEffectsOnFiber(finishedWork, root); + root.current = finishedWork; + commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); + requestPaint(); + executionContext = prevExecutionContext; + currentUpdatePriority = spawnedLane; + ReactCurrentBatchConfig.transition = transitions; + } else root.current = finishedWork; + rootDoesHavePassiveEffects + ? ((rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsLanes = lanes)) + : releaseRootPooledCache(root, remainingLanes); + remainingLanes = root.pendingLanes; + 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); + onCommitRoot(finishedWork.stateNode, renderPriorityLevel); + ensureRootIsScheduled(root); + if (null !== recoverableErrors) + for ( + renderPriorityLevel = root.onRecoverableError, finishedWork = 0; + finishedWork < recoverableErrors.length; + finishedWork++ + ) + (remainingLanes = recoverableErrors[finishedWork]), + (transitions = { + digest: remainingLanes.digest, + componentStack: remainingLanes.stack + }), + renderPriorityLevel(remainingLanes.value, transitions); + if (hasUncaughtError) + throw ( + ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root) + ); + 0 !== (pendingPassiveEffectsLanes & 3) && + 0 !== root.tag && + flushPassiveEffects(); + remainingLanes = root.pendingLanes; + (enableInfiniteRenderLoopDetection && + (didIncludeRenderPhaseUpdate || didIncludeCommitPhaseUpdate)) || + (0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes)) + ? root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) + : (nestedUpdateCount = 0); + flushSyncWorkAcrossRoots_impl(!1); + return null; +} +function releaseRootPooledCache(root, remainingLanes) { + 0 === (root.pooledCacheLanes &= remainingLanes) && + ((remainingLanes = root.pooledCache), + null != remainingLanes && + ((root.pooledCache = null), releaseCache(remainingLanes))); +} +function flushPassiveEffects() { + if (null !== rootWithPendingPassiveEffects) { + var root = rootWithPendingPassiveEffects, + remainingLanes = pendingPassiveEffectsRemainingLanes; + pendingPassiveEffectsRemainingLanes = 0; + var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), + priority = 32 > renderPriority ? 32 : renderPriority; + renderPriority = ReactCurrentBatchConfig.transition; + var previousPriority = currentUpdatePriority; + try { + ReactCurrentBatchConfig.transition = null; + currentUpdatePriority = priority; + if (null === rootWithPendingPassiveEffects) + var JSCompiler_inline_result = !1; + else { + priority = pendingPassiveTransitions; + pendingPassiveTransitions = null; + var root$jscomp$0 = rootWithPendingPassiveEffects, + lanes = pendingPassiveEffectsLanes; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsLanes = 0; + if (0 !== (executionContext & 6)) + throw Error("Cannot flush passive effects while already rendering."); + var prevExecutionContext = executionContext; + executionContext |= 4; + commitPassiveUnmountOnFiber(root$jscomp$0.current); + commitPassiveMountOnFiber( + root$jscomp$0, + root$jscomp$0.current, + lanes, + priority + ); + executionContext = prevExecutionContext; + flushSyncWorkAcrossRoots_impl(!1); + if ( + injectedHook && + "function" === typeof injectedHook.onPostCommitFiberRoot ) - ); - case 7: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps, - renderLanes - ), - workInProgress.child - ); - case 8: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 12: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 10: - a: { - Component = enableRenderableContext - ? workInProgress.type - : workInProgress.type._context; - context = workInProgress.pendingProps; - nextProps = workInProgress.memoizedProps; - nextCache = context.value; - pushProvider(workInProgress, Component, nextCache); - if (null !== nextProps) - if (objectIs(nextProps.value, nextCache)) { - if ( - nextProps.children === context.children && - !didPerformWorkStackCursor.current - ) { - workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - ); - break a; - } - } else propagateContextChange(workInProgress, Component, renderLanes); - reconcileChildren( - current, - workInProgress, - context.children, - renderLanes + try { + injectedHook.onPostCommitFiberRoot(rendererID, root$jscomp$0); + } catch (err) {} + JSCompiler_inline_result = !0; + } + return JSCompiler_inline_result; + } finally { + (currentUpdatePriority = previousPriority), + (ReactCurrentBatchConfig.transition = renderPriority), + releaseRootPooledCache(root, remainingLanes); + } + } + return !1; +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); + null !== rootFiber && + (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); +} +function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (; null !== nearestMountedAncestor; ) { + if (3 === nearestMountedAncestor.tag) { + captureCommitPhaseErrorOnRoot( + nearestMountedAncestor, + sourceFiber, + error ); - workInProgress = workInProgress.child; + break; + } else if (1 === nearestMountedAncestor.tag) { + var instance = nearestMountedAncestor.stateNode; + if ( + "function" === + typeof nearestMountedAncestor.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createClassErrorUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + nearestMountedAncestor = enqueueUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + null !== nearestMountedAncestor && + (markRootUpdated(nearestMountedAncestor, 2), + ensureRootIsScheduled(nearestMountedAncestor)); + break; + } } - return workInProgress; - case 9: - return ( - (context = enableRenderableContext - ? workInProgress.type._context - : workInProgress.type), - (Component = workInProgress.pendingProps.children), - prepareToReadContext(workInProgress, renderLanes), - (context = readContext(context)), - (Component = Component(context)), - (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 14: - return ( - (Component = workInProgress.type), - (context = resolveDefaultProps(Component, workInProgress.pendingProps)), - (context = resolveDefaultProps(Component.type, context)), - updateMemoComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 15: - return updateSimpleMemoComponent( - current, - workInProgress, - workInProgress.type, - workInProgress.pendingProps, - renderLanes - ); - case 17: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), - (workInProgress.tag = 1), - isContextProvider(Component) - ? ((current = !0), pushContextProvider(workInProgress)) - : (current = !1), - prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, Component, context), - mountClassInstance(workInProgress, Component, context, renderLanes), - finishClassComponent( - null, - workInProgress, - Component, - !0, - current, - renderLanes - ) - ); + nearestMountedAncestor = nearestMountedAncestor.return; + } +} +function attachPingListener(root, wakeable, lanes) { + var pingCache = root.pingCache; + if (null === pingCache) { + pingCache = root.pingCache = new PossiblyWeakMap(); + var threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } else + (threadIDs = pingCache.get(wakeable)), + void 0 === threadIDs && + ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); + threadIDs.has(lanes) || + ((workInProgressRootDidAttachPingListener = !0), + threadIDs.add(lanes), + (root = pingSuspendedRoot.bind(null, root, wakeable, lanes)), + wakeable.then(root, root)); +} +function pingSuspendedRoot(root, wakeable, pingedLanes) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(wakeable); + root.pingedLanes |= root.suspendedLanes & pingedLanes; + enableInfiniteRenderLoopDetection && + (executionContext & 2 + ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) + : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), + throwIfInfiniteUpdateLoopDetected()); + workInProgressRoot === root && + (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && + (4 === workInProgressRootExitStatus || + (3 === workInProgressRootExitStatus && + (workInProgressRootRenderLanes & 62914560) === + workInProgressRootRenderLanes && + 300 > now() - globalMostRecentFallbackTime) + ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) + : (workInProgressRootPingedLanes |= pingedLanes)); + ensureRootIsScheduled(root); +} +function retryTimedOutBoundary(boundaryFiber, retryLane) { + 0 === retryLane && + (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); + boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); + null !== boundaryFiber && + (markRootUpdated(boundaryFiber, retryLane), + ensureRootIsScheduled(boundaryFiber)); +} +function retryDehydratedSuspenseBoundary(boundaryFiber) { + var suspenseState = boundaryFiber.memoizedState, + retryLane = 0; + null !== suspenseState && (retryLane = suspenseState.retryLane); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function resolveRetryWakeable(boundaryFiber, wakeable) { + var retryLane = 0; + switch (boundaryFiber.tag) { + case 13: + var retryCache = boundaryFiber.stateNode; + var suspenseState = boundaryFiber.memoizedState; + null !== suspenseState && (retryLane = suspenseState.retryLane); + break; case 19: - return updateSuspenseListComponent(current, workInProgress, renderLanes); + retryCache = boundaryFiber.stateNode; + break; case 22: - return updateOffscreenComponent(current, workInProgress, renderLanes); - case 24: - return ( - prepareToReadContext(workInProgress, renderLanes), - (Component = readContext(CacheContext)), - null === current - ? ((context = peekCacheFromPool()), - null === context && - ((context = workInProgressRoot), - (nextProps = createCache()), - (context.pooledCache = nextProps), - nextProps.refCount++, - null !== nextProps && (context.pooledCacheLanes |= renderLanes), - (context = nextProps)), - (workInProgress.memoizedState = { - parent: Component, - cache: context - }), - initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, context)) - : (0 !== (current.lanes & renderLanes) && - (cloneUpdateQueue(current, workInProgress), - processUpdateQueue(workInProgress, null, null, renderLanes), - suspendIfUpdateReadFromEntangledAsyncAction()), - (context = current.memoizedState), - (nextProps = workInProgress.memoizedState), - context.parent !== Component - ? ((context = { parent: Component, cache: Component }), - (workInProgress.memoizedState = context), - 0 === workInProgress.lanes && - (workInProgress.memoizedState = - workInProgress.updateQueue.baseState = - context), - pushProvider(workInProgress, CacheContext, Component)) - : ((Component = nextProps.cache), - pushProvider(workInProgress, CacheContext, Component), - Component !== context.cache && - propagateContextChange( - workInProgress, - CacheContext, - renderLanes - ))), - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child + retryCache = boundaryFiber.stateNode._retryCache; + break; + default: + throw Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." ); } - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); -}; + null !== retryCache && retryCache.delete(wakeable); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function throwIfInfiniteUpdateLoopDetected() { + if (50 < nestedUpdateCount) + throw ( + ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + enableInfiniteRenderLoopDetection && + executionContext & 2 && + null !== workInProgressRoot && + (workInProgressRoot.errorRecoveryDisabledLanes |= + workInProgressRootRenderLanes), + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + )) + ); +} function scheduleCallback(priorityLevel, callback) { return scheduleCallback$3(priorityLevel, callback); } @@ -10639,10 +10593,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1106 = { + devToolsConfig$jscomp$inline_1103 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-canary-0c0f95bf", + version: "18.3.0-canary-2485667c", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10658,11 +10612,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1333 = { - bundleType: devToolsConfig$jscomp$inline_1106.bundleType, - version: devToolsConfig$jscomp$inline_1106.version, - rendererPackageName: devToolsConfig$jscomp$inline_1106.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1106.rendererConfig, +var internals$jscomp$inline_1330 = { + bundleType: devToolsConfig$jscomp$inline_1103.bundleType, + version: devToolsConfig$jscomp$inline_1103.version, + rendererPackageName: devToolsConfig$jscomp$inline_1103.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1103.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10678,26 +10632,26 @@ var internals$jscomp$inline_1333 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1106.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1103.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-0c0f95bf" + reconcilerVersion: "18.3.0-canary-2485667c" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1334 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1331 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1334.isDisabled && - hook$jscomp$inline_1334.supportsFiber + !hook$jscomp$inline_1331.isDisabled && + hook$jscomp$inline_1331.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1334.inject( - internals$jscomp$inline_1333 + (rendererID = hook$jscomp$inline_1331.inject( + internals$jscomp$inline_1330 )), - (injectedHook = hook$jscomp$inline_1334); + (injectedHook = hook$jscomp$inline_1331); } catch (err) {} } exports.createPortal = function (children, containerTag) { diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index ae1145681bc28..39b7d5e68ddb0 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -19,62 +19,20 @@ require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), dynamicFlags = require("ReactNativeInternalFeatureFlags"), Scheduler = require("scheduler"), - React = require("react"); -function invokeGuardedCallbackImpl(name, func, context) { - var funcArgs = Array.prototype.slice.call(arguments, 3); - try { - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } -} -var hasError = !1, + React = require("react"), + isArrayImpl = Array.isArray, + hasError = !1, caughtError = null, - hasRethrowError = !1, - rethrowError = null, - reporter = { - onError: function (error) { - hasError = !0; - caughtError = error; - } - }; -function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = !1; - caughtError = null; - invokeGuardedCallbackImpl.apply(reporter, arguments); -} -function invokeGuardedCallbackAndCatchFirstError( - name, - func, - context, - a, - b, - c, - d, - e, - f -) { - invokeGuardedCallback.apply(this, arguments); - if (hasError) { - if (hasError) { - var error = caughtError; - hasError = !1; - caughtError = null; - } else - throw Error( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." - ); - hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); - } -} -var isArrayImpl = Array.isArray, getFiberCurrentPropsFromNode$1 = null, getInstanceFromNode$1 = null, getNodeFromInstance$1 = null; function executeDispatch(event, listener, inst) { - var type = event.type || "unknown-event"; event.currentTarget = getNodeFromInstance$1(inst); - invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event); + try { + listener(event); + } catch (error) { + hasError || ((hasError = !0), (caughtError = error)); + } event.currentTarget = null; } function executeDirectDispatch(event) { @@ -939,7 +897,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_270 = { +var injectedNamesToPlugins$jscomp$inline_267 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -985,32 +943,32 @@ var injectedNamesToPlugins$jscomp$inline_270 = { } } }, - isOrderingDirty$jscomp$inline_271 = !1, - pluginName$jscomp$inline_272; -for (pluginName$jscomp$inline_272 in injectedNamesToPlugins$jscomp$inline_270) + isOrderingDirty$jscomp$inline_268 = !1, + pluginName$jscomp$inline_269; +for (pluginName$jscomp$inline_269 in injectedNamesToPlugins$jscomp$inline_267) if ( - injectedNamesToPlugins$jscomp$inline_270.hasOwnProperty( - pluginName$jscomp$inline_272 + injectedNamesToPlugins$jscomp$inline_267.hasOwnProperty( + pluginName$jscomp$inline_269 ) ) { - var pluginModule$jscomp$inline_273 = - injectedNamesToPlugins$jscomp$inline_270[pluginName$jscomp$inline_272]; + var pluginModule$jscomp$inline_270 = + injectedNamesToPlugins$jscomp$inline_267[pluginName$jscomp$inline_269]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_272) || - namesToPlugins[pluginName$jscomp$inline_272] !== - pluginModule$jscomp$inline_273 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_269) || + namesToPlugins[pluginName$jscomp$inline_269] !== + pluginModule$jscomp$inline_270 ) { - if (namesToPlugins[pluginName$jscomp$inline_272]) + if (namesToPlugins[pluginName$jscomp$inline_269]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_272 + "`.") + (pluginName$jscomp$inline_269 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_272] = - pluginModule$jscomp$inline_273; - isOrderingDirty$jscomp$inline_271 = !0; + namesToPlugins[pluginName$jscomp$inline_269] = + pluginModule$jscomp$inline_270; + isOrderingDirty$jscomp$inline_268 = !0; } } -isOrderingDirty$jscomp$inline_271 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_268 && recomputePluginOrdering(); var emptyObject$1 = {}, removedKeys = null, removedKeyCount = 0, @@ -1303,12 +1261,9 @@ function dispatchEvent(target, topLevelType, nativeEvent) { throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." ); - if (hasRethrowError) + if (hasError) throw ( - ((event = rethrowError), - (hasRethrowError = !1), - (rethrowError = null), - event) + ((event = caughtError), (hasError = !1), (caughtError = null), event) ); } }); @@ -6750,154 +6705,567 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } -var valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = - lastContextDependency = - currentlyRenderingFiber = - null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue2); - context._currentValue2 = nextValue; -} -function popProvider(context) { - context._currentValue2 = valueCursor.current; - 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 propagateContextChange(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) - throw Error( - "We just came from a parent so we must have had a parent. This is a bug in React." +function beginWork(current, workInProgress, renderLanes) { + if (null !== current) + if ( + current.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if ( + 0 === (current.lanes & renderLanes) && + 0 === (workInProgress.flags & 128) + ) + return ( + (didReceiveUpdate = !1), + attemptEarlyBailoutIfNoScheduledUpdate( + current, + workInProgress, + renderLanes + ) ); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } 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; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; + } + else didReceiveUpdate = !1; + workInProgress.lanes = 0; + switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor$1.current + ); + prepareToReadContext(workInProgress, renderLanes); + markComponentRenderStarted(workInProgress); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + markComponentRenderStopped(); + workInProgress.flags |= 1; + workInProgress.tag = 0; + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; + case 16: + Component = workInProgress.elementType; + a: { + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null)); -} -function readContext(context) { - return readContextForConsumer(currentlyRenderingFiber, context); -} -function readContextDuringReconcilation(consumer, context, renderLanes) { - null === currentlyRenderingFiber && - prepareToReadContext(consumer, renderLanes); - return readContextForConsumer(consumer, context); -} -function readContextForConsumer(consumer, context) { - var value = context._currentValue2; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === consumer) throw Error( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." ); - lastContextDependency = context; - consumer.dependencies = { lanes: 0, firstContext: context }; - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function () { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function (type, listener) { - listeners.push(listener); - } - }); - this.abort = function () { - signal.aborted = !0; - listeners.forEach(function (listener) { - return listener(); - }); + } + return workInProgress; + case 0: + return ( + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateFunctionComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) + ); + case 1: + return ( + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateClassComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) + ); + case 3: + pushHostRootContext(workInProgress); + if (null === current) + throw Error("Should have a current fiber. This is a bug in React."); + var nextProps = workInProgress.pendingProps; + context = workInProgress.memoizedState; + Component = context.element; + cloneUpdateQueue(current, workInProgress); + processUpdateQueue(workInProgress, nextProps, null, renderLanes); + nextProps = workInProgress.memoizedState; + var nextCache = nextProps.cache; + pushProvider(workInProgress, CacheContext, nextCache); + nextCache !== context.cache && + propagateContextChange(workInProgress, CacheContext, renderLanes); + suspendIfUpdateReadFromEntangledAsyncAction(); + context = nextProps.element; + context === Component + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + )) + : (reconcileChildren(current, workInProgress, context, renderLanes), + (workInProgress = workInProgress.child)); + return workInProgress; + case 26: + case 27: + case 5: + pushHostContext(workInProgress); + Component = workInProgress.pendingProps.children; + if (enableAsyncActions && null !== workInProgress.memoizedState) { + if (!enableAsyncActions) throw Error("Not implemented."); + context = renderWithHooks( + current, + workInProgress, + TransitionAwareHostComponent, + null, + null, + renderLanes + ); + HostTransitionContext._currentValue2 = context; + didReceiveUpdate && + null !== current && + current.memoizedState.memoizedState !== context && + propagateContextChange( + workInProgress, + HostTransitionContext, + renderLanes + ); + } + markRef(current, workInProgress); + reconcileChildren(current, workInProgress, Component, renderLanes); + return workInProgress.child; + case 6: + return null; + case 13: + return updateSuspenseComponent(current, workInProgress, renderLanes); + case 4: + return ( + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo + ), + (Component = workInProgress.pendingProps), + null === current + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + Component, + renderLanes + )) + : reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child + ); + case 11: + return ( + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateForwardRef( + current, + workInProgress, + Component, + context, + renderLanes + ) + ); + case 7: + return ( + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps, + renderLanes + ), + workInProgress.child + ); + case 8: + return ( + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); + case 12: + return ( + (workInProgress.flags |= 4), + (Component = workInProgress.stateNode), + (Component.effectDuration = 0), + (Component.passiveEffectDuration = 0), + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); + case 10: + a: { + Component = enableRenderableContext + ? workInProgress.type + : workInProgress.type._context; + context = workInProgress.pendingProps; + nextProps = workInProgress.memoizedProps; + nextCache = context.value; + pushProvider(workInProgress, Component, nextCache); + if (null !== nextProps) + if (objectIs(nextProps.value, nextCache)) { + if ( + nextProps.children === context.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + ); + break a; + } + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes + ); + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: + return ( + (context = enableRenderableContext + ? workInProgress.type._context + : workInProgress.type), + (Component = workInProgress.pendingProps.children), + prepareToReadContext(workInProgress, renderLanes), + (context = readContext(context)), + markComponentRenderStarted(workInProgress), + (Component = Component(context)), + markComponentRenderStopped(), + (workInProgress.flags |= 1), + reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child + ); + case 14: + return ( + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), + updateMemoComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) + ); + case 15: + return updateSimpleMemoComponent( + current, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + renderLanes + ); + case 17: + return ( + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), + (workInProgress.tag = 1), + isContextProvider(Component) + ? ((current = !0), pushContextProvider(workInProgress)) + : (current = !1), + prepareToReadContext(workInProgress, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), + finishClassComponent( + null, + workInProgress, + Component, + !0, + current, + renderLanes + ) + ); + case 19: + return updateSuspenseListComponent(current, workInProgress, renderLanes); + case 22: + return updateOffscreenComponent(current, workInProgress, renderLanes); + case 24: + return ( + prepareToReadContext(workInProgress, renderLanes), + (Component = readContext(CacheContext)), + null === current + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), + (nextProps = createCache()), + (context.pooledCache = nextProps), + nextProps.refCount++, + null !== nextProps && (context.pooledCacheLanes |= renderLanes), + (context = nextProps)), + (workInProgress.memoizedState = { + parent: Component, + cache: context + }), + initializeUpdateQueue(workInProgress), + pushProvider(workInProgress, CacheContext, context)) + : (0 !== (current.lanes & renderLanes) && + (cloneUpdateQueue(current, workInProgress), + processUpdateQueue(workInProgress, null, null, renderLanes), + suspendIfUpdateReadFromEntangledAsyncAction()), + (context = current.memoizedState), + (nextProps = workInProgress.memoizedState), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), + 0 === workInProgress.lanes && + (workInProgress.memoizedState = + workInProgress.updateQueue.baseState = + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = nextProps.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && + propagateContextChange( + workInProgress, + CacheContext, + renderLanes + ))), + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); + } + throw Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in React. Please file an issue." + ); +} +var valueCursor = createCursor(null), + currentlyRenderingFiber = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = + lastContextDependency = + currentlyRenderingFiber = + null; +} +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue2); + context._currentValue2 = nextValue; +} +function popProvider(context) { + context._currentValue2 = valueCursor.current; + 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 propagateContextChange(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; + break; + } + dependency = dependency.next; + } + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) + throw Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } 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 prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); +} +function readContext(context) { + return readContextForConsumer(currentlyRenderingFiber, context); +} +function readContextDuringReconcilation(consumer, context, renderLanes) { + null === currentlyRenderingFiber && + prepareToReadContext(consumer, renderLanes); + return readContextForConsumer(consumer, context); +} +function readContextForConsumer(consumer, context) { + var value = context._currentValue2; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function () { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function (type, listener) { + listeners.push(listener); + } + }); + this.abort = function () { + signal.aborted = !0; + listeners.forEach(function (listener) { + return listener(); + }); }; }, scheduleCallback$1 = Scheduler.unstable_scheduleCallback, @@ -8251,2541 +8619,2127 @@ function commitDeletionEffectsOnFiber( try { callComponentWillUnmountWithTimer(deletedFiber, updateQueue); } catch (error) { - captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); - } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 21: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); - deletedFiber.mode & 1 - ? ((offscreenSubtreeWasHidden = - (updateQueue = offscreenSubtreeWasHidden) || - null !== deletedFiber.memoizedState), - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ), - (offscreenSubtreeWasHidden = updateQueue)) - : recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - default: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - } -} -function getRetryCache(finishedWork) { - switch (finishedWork.tag) { - case 13: - case 19: - var retryCache = finishedWork.stateNode; - null === retryCache && - (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); - return retryCache; - case 22: - return ( - (finishedWork = finishedWork.stateNode), - (retryCache = finishedWork._retryCache), - null === retryCache && - (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), - retryCache - ); - default: - throw Error( - "Unexpected Suspense handler tag (" + - finishedWork.tag + - "). This is a bug in React." - ); - } -} -function attachSuspenseRetryListeners(finishedWork, wakeables) { - var retryCache = getRetryCache(finishedWork); - wakeables.forEach(function (wakeable) { - var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); - if (!retryCache.has(wakeable)) { - retryCache.add(wakeable); - if (isDevToolsPresent) - if (null !== inProgressLanes && null !== inProgressRoot) - restorePendingUpdaters(inProgressRoot, inProgressLanes); - else - throw Error( - "Expected finished root and lanes to be set. This is a bug in React." - ); - wakeable.then(retry, retry); - } - }); -} -function commitMutationEffects(root, finishedWork, committedLanes) { - inProgressLanes = committedLanes; - inProgressRoot = root; - commitMutationEffectsOnFiber(finishedWork, root); - inProgressRoot = inProgressLanes = null; -} -function recursivelyTraverseMutationEffects(root, parentFiber) { - var deletions = parentFiber.deletions; - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - try { - commitDeletionEffectsOnFiber(root, parentFiber, childToDelete); - var alternate = childToDelete.alternate; - null !== alternate && (alternate.return = null); - childToDelete.return = null; - } catch (error) { - captureCommitPhaseError(childToDelete, parentFiber, error); - } - } - if (parentFiber.subtreeFlags & 12854) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitMutationEffectsOnFiber(parentFiber, root), - (parentFiber = parentFiber.sibling); -} -function commitMutationEffectsOnFiber(finishedWork, root) { - var current = finishedWork.alternate, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - try { - commitHookEffectListUnmount(3, finishedWork, finishedWork.return), - commitHookEffectListMount(3, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - if (shouldProfile(finishedWork)) { - try { - startLayoutEffectTimer(), - commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$113) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$113 - ); - } - recordLayoutEffectDuration(finishedWork); - } else - try { - commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$114) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$114 - ); - } - } - break; - case 1: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - flags & 64 && - offscreenSubtreeIsHidden && - ((finishedWork = finishedWork.updateQueue), - null !== finishedWork && - ((flags = finishedWork.callbacks), - null !== flags && - ((current = finishedWork.shared.hiddenCallbacks), - (finishedWork.shared.hiddenCallbacks = - null === current ? flags : current.concat(flags))))); - break; - case 26: - case 27: - case 5: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - break; - case 6: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; - case 3: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; - case 4: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; - case 13: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (finishedWork.child.flags & 8192) { - var isShowingFallback = null !== finishedWork.memoizedState; - current = null !== current && null !== current.memoizedState; - alwaysThrottleRetries - ? isShowingFallback !== current && - (globalMostRecentFallbackTime = now$1()) - : isShowingFallback && - !current && - (globalMostRecentFallbackTime = now$1()); - } - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); - break; - case 22: - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - var isHidden = null !== finishedWork.memoizedState; - isShowingFallback = null !== current && null !== current.memoizedState; - if (finishedWork.mode & 1) { - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || isHidden; - offscreenSubtreeWasHidden = - prevOffscreenSubtreeWasHidden || isShowingFallback; - recursivelyTraverseMutationEffects(root, finishedWork); - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - } else recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - root = finishedWork.stateNode; - root._current = finishedWork; - root._visibility &= -3; - root._visibility |= root._pendingVisibility & 2; - flags & 8192 && - ((root._visibility = isHidden - ? root._visibility & -2 - : root._visibility | 1), - isHidden && - ((isHidden = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), - null === current || - isShowingFallback || - isHidden || - (0 !== (finishedWork.mode & 1) && - recursivelyTraverseDisappearLayoutEffects(finishedWork)))); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((current = flags.retryQueue), - null !== current && - ((flags.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, current)))); - break; - case 19: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); + captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); + } + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); break; case 21: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); break; - default: - recursivelyTraverseMutationEffects(root, finishedWork), - commitReconciliationEffects(finishedWork); - } -} -function commitReconciliationEffects(finishedWork) { - var flags = finishedWork.flags; - flags & 2 && (finishedWork.flags &= -3); - flags & 4096 && (finishedWork.flags &= -4097); -} -function commitLayoutEffects(finishedWork, root, committedLanes) { - inProgressLanes = committedLanes; - inProgressRoot = root; - commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); - inProgressRoot = inProgressLanes = null; -} -function recursivelyTraverseLayoutEffects(root, parentFiber) { - if (parentFiber.subtreeFlags & 8772) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), - (parentFiber = parentFiber.sibling); -} -function recursivelyTraverseDisappearLayoutEffects(parentFiber) { - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedWork = parentFiber; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - if (shouldProfile(finishedWork)) - try { - startLayoutEffectTimer(), - commitHookEffectListUnmount(4, finishedWork, finishedWork.return); - } finally { - recordLayoutEffectDuration(finishedWork); - } - else commitHookEffectListUnmount(4, finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 1: - safelyDetachRef(finishedWork, finishedWork.return); - var instance = finishedWork.stateNode; - if ("function" === typeof instance.componentWillUnmount) { - var current = finishedWork, - nearestMountedAncestor = finishedWork.return; - try { - callComponentWillUnmountWithTimer(current, instance); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } - } - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 26: - case 27: - case 5: - safelyDetachRef(finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 22: - safelyDetachRef(finishedWork, finishedWork.return); - null === finishedWork.memoizedState && - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - default: - recursivelyTraverseDisappearLayoutEffects(finishedWork); - } - parentFiber = parentFiber.sibling; - } -} -function recursivelyTraverseReappearLayoutEffects( - finishedRoot$jscomp$0, - parentFiber, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, - finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - commitHookLayoutEffects(finishedWork, 4); - break; - case 1: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - finishedRoot = finishedWork.stateNode; - if ("function" === typeof finishedRoot.componentDidMount) - try { - finishedRoot.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; - if (null !== hiddenCallbacks) - for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ - ) - callCallback(hiddenCallbacks[current], finishedRoot); - } - includeWorkInProgressEffects && - flags & 64 && - commitClassCallbacks(finishedWork); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 26: - case 27: - case 5: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - null === current && - flags & 4 && - commitHostComponentMount(finishedWork); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - flags & 4 && - commitProfilerUpdate(finishedWork, current); - break; - case 13: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - break; - case 22: - null === finishedWork.memoizedState && - recursivelyTraverseReappearLayoutEffects( + case 22: + safelyDetachRef(deletedFiber, nearestMountedAncestor); + deletedFiber.mode & 1 + ? ((offscreenSubtreeWasHidden = + (updateQueue = offscreenSubtreeWasHidden) || + null !== deletedFiber.memoizedState), + recursivelyTraverseDeletionEffects( finishedRoot, - finishedWork, - includeWorkInProgressEffects + nearestMountedAncestor, + deletedFiber + ), + (offscreenSubtreeWasHidden = updateQueue)) + : recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - default: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - } - parentFiber = parentFiber.sibling; + break; + default: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); } } -function commitHookPassiveMountEffects(finishedWork, hookFlags) { - if (shouldProfile(finishedWork)) { - passiveEffectStartTime = now(); - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - recordPassiveEffectDuration(finishedWork); - } else - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$122) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$122); - } +function getRetryCache(finishedWork) { + switch (finishedWork.tag) { + case 13: + case 19: + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); + return retryCache; + case 22: + return ( + (finishedWork = finishedWork.stateNode), + (retryCache = finishedWork._retryCache), + null === retryCache && + (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), + retryCache + ); + default: + throw Error( + "Unexpected Suspense handler tag (" + + finishedWork.tag + + "). This is a bug in React." + ); + } } -function commitOffscreenPassiveMountEffects(current, finishedWork) { - var previousCache = null; - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (previousCache = current.memoizedState.cachePool.pool); - current = null; - null !== finishedWork.memoizedState && - null !== finishedWork.memoizedState.cachePool && - (current = finishedWork.memoizedState.cachePool.pool); - current !== previousCache && - (null != current && current.refCount++, - null != previousCache && releaseCache(previousCache)); +function attachSuspenseRetryListeners(finishedWork, wakeables) { + var retryCache = getRetryCache(finishedWork); + wakeables.forEach(function (wakeable) { + var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); + if (!retryCache.has(wakeable)) { + retryCache.add(wakeable); + if (isDevToolsPresent) + if (null !== inProgressLanes && null !== inProgressRoot) + restorePendingUpdaters(inProgressRoot, inProgressLanes); + else + throw Error( + "Expected finished root and lanes to be set. This is a bug in React." + ); + wakeable.then(retry, retry); + } + }); } -function commitCachePassiveMountEffect(current, finishedWork) { - current = null; - null !== finishedWork.alternate && - (current = finishedWork.alternate.memoizedState.cache); - finishedWork = finishedWork.memoizedState.cache; - finishedWork !== current && - (finishedWork.refCount++, null != current && releaseCache(current)); +function commitMutationEffects(root, finishedWork, committedLanes) { + inProgressLanes = committedLanes; + inProgressRoot = root; + commitMutationEffectsOnFiber(finishedWork, root); + inProgressRoot = inProgressLanes = null; } -function recursivelyTraversePassiveMountEffects( - root, - parentFiber, - committedLanes, - committedTransitions -) { - if (parentFiber.subtreeFlags & 10256) +function recursivelyTraverseMutationEffects(root, parentFiber) { + var deletions = parentFiber.deletions; + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + try { + commitDeletionEffectsOnFiber(root, parentFiber, childToDelete); + var alternate = childToDelete.alternate; + null !== alternate && (alternate.return = null); + childToDelete.return = null; + } catch (error) { + captureCommitPhaseError(childToDelete, parentFiber, error); + } + } + if (parentFiber.subtreeFlags & 12854) for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveMountOnFiber( - root, - parentFiber, - committedLanes, - committedTransitions - ), + commitMutationEffectsOnFiber(parentFiber, root), (parentFiber = parentFiber.sibling); } -function commitPassiveMountOnFiber( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions -) { - var flags = finishedWork.flags; +function commitMutationEffectsOnFiber(finishedWork, root) { + var current = finishedWork.alternate, + flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: + case 14: case 15: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + try { + commitHookEffectListUnmount(3, finishedWork, finishedWork.return), + commitHookEffectListMount(3, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + if (shouldProfile(finishedWork)) { + try { + startLayoutEffectTimer(), + commitHookEffectListUnmount(5, finishedWork, finishedWork.return); + } catch (error$113) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$113 + ); + } + recordLayoutEffectDuration(finishedWork); + } else + try { + commitHookEffectListUnmount(5, finishedWork, finishedWork.return); + } catch (error$114) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$114 + ); + } + } + break; + case 1: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + flags & 64 && + offscreenSubtreeIsHidden && + ((finishedWork = finishedWork.updateQueue), + null !== finishedWork && + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), + (finishedWork.shared.hiddenCallbacks = + null === current ? flags : current.concat(flags))))); + break; + case 26: + case 27: + case 5: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + break; + case 6: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); break; case 3: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - ((finishedRoot = null), - null !== finishedWork.alternate && - (finishedRoot = finishedWork.alternate.memoizedState.cache), - (finishedWork = finishedWork.memoizedState.cache), - finishedWork !== finishedRoot && - (finishedWork.refCount++, - null != finishedRoot && releaseCache(finishedRoot))); + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); break; - case 23: + case 4: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 13: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (finishedWork.child.flags & 8192) { + var isShowingFallback = null !== finishedWork.memoizedState; + current = null !== current && null !== current.memoizedState; + alwaysThrottleRetries + ? isShowingFallback !== current && + (globalMostRecentFallbackTime = now$1()) + : isShowingFallback && + !current && + (globalMostRecentFallbackTime = now$1()); + } + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); break; case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) - : ((instance._visibility |= 4), - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - )) - : instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - 0 !== (finishedWork.subtreeFlags & 10256) - )); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + var isHidden = null !== finishedWork.memoizedState; + isShowingFallback = null !== current && null !== current.memoizedState; + if (finishedWork.mode & 1) { + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || isHidden; + offscreenSubtreeWasHidden = + prevOffscreenSubtreeWasHidden || isShowingFallback; + recursivelyTraverseMutationEffects(root, finishedWork); + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + } else recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + root = finishedWork.stateNode; + root._current = finishedWork; + root._visibility &= -3; + root._visibility |= root._pendingVisibility & 2; + flags & 8192 && + ((root._visibility = isHidden + ? root._visibility & -2 + : root._visibility | 1), + isHidden && + ((isHidden = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), + null === current || + isShowingFallback || + isHidden || + (0 !== (finishedWork.mode & 1) && + recursivelyTraverseDisappearLayoutEffects(finishedWork)))); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); + break; + case 19: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); break; - case 24: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + case 21: break; default: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); + recursivelyTraverseMutationEffects(root, finishedWork), + commitReconciliationEffects(finishedWork); } } -function recursivelyTraverseReconnectPassiveEffects( +function commitReconciliationEffects(finishedWork) { + var flags = finishedWork.flags; + flags & 2 && (finishedWork.flags &= -3); + flags & 4096 && (finishedWork.flags &= -4097); +} +function commitLayoutEffects(finishedWork, root, committedLanes) { + inProgressLanes = committedLanes; + inProgressRoot = root; + commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); + inProgressRoot = inProgressLanes = null; +} +function recursivelyTraverseLayoutEffects(root, parentFiber) { + if (parentFiber.subtreeFlags & 8772) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), + (parentFiber = parentFiber.sibling); +} +function recursivelyTraverseDisappearLayoutEffects(parentFiber) { + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedWork = parentFiber; + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + if (shouldProfile(finishedWork)) + try { + startLayoutEffectTimer(), + commitHookEffectListUnmount(4, finishedWork, finishedWork.return); + } finally { + recordLayoutEffectDuration(finishedWork); + } + else commitHookEffectListUnmount(4, finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 1: + safelyDetachRef(finishedWork, finishedWork.return); + var instance = finishedWork.stateNode; + if ("function" === typeof instance.componentWillUnmount) { + var current = finishedWork, + nearestMountedAncestor = finishedWork.return; + try { + callComponentWillUnmountWithTimer(current, instance); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } + } + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 26: + case 27: + case 5: + safelyDetachRef(finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 22: + safelyDetachRef(finishedWork, finishedWork.return); + null === finishedWork.memoizedState && + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + default: + recursivelyTraverseDisappearLayoutEffects(finishedWork); + } + parentFiber = parentFiber.sibling; + } +} +function recursivelyTraverseReappearLayoutEffects( finishedRoot$jscomp$0, parentFiber, - committedLanes$jscomp$0, - committedTransitions$jscomp$0, includeWorkInProgressEffects ) { includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, + var current = parentFiber.alternate, + finishedRoot = finishedRoot$jscomp$0, finishedWork = parentFiber, - committedLanes = committedLanes$jscomp$0, - committedTransitions = committedTransitions$jscomp$0, flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: - recursivelyTraverseReconnectPassiveEffects( + recursivelyTraverseReappearLayoutEffects( finishedRoot, finishedWork, - committedLanes, - committedTransitions, includeWorkInProgressEffects ); - commitHookPassiveMountEffects(finishedWork, 8); + commitHookLayoutEffects(finishedWork, 4); break; - case 23: + case 1: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + finishedRoot = finishedWork.stateNode; + if ("function" === typeof finishedRoot.componentDidMount) + try { + finishedRoot.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + current = finishedWork.updateQueue; + if (null !== current) { + var hiddenCallbacks = current.shared.hiddenCallbacks; + if (null !== hiddenCallbacks) + for ( + current.shared.hiddenCallbacks = null, current = 0; + current < hiddenCallbacks.length; + current++ + ) + callCallback(hiddenCallbacks[current], finishedRoot); + } + includeWorkInProgressEffects && + flags & 64 && + commitClassCallbacks(finishedWork); + safelyAttachRef(finishedWork, finishedWork.return); break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects( - finishedRoot, - finishedWork - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )); + case 26: + case 27: + case 5: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); includeWorkInProgressEffects && - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); + null === current && + flags & 4 && + commitHostComponentMount(finishedWork); + safelyAttachRef(finishedWork, finishedWork.return); break; - case 24: - recursivelyTraverseReconnectPassiveEffects( + case 12: + recursivelyTraverseReappearLayoutEffects( finishedRoot, finishedWork, - committedLanes, - committedTransitions, includeWorkInProgressEffects ); includeWorkInProgressEffects && - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + flags & 4 && + commitProfilerUpdate(finishedWork, current); break; - default: - recursivelyTraverseReconnectPassiveEffects( + case 13: + recursivelyTraverseReappearLayoutEffects( finishedRoot, finishedWork, - committedLanes, - committedTransitions, includeWorkInProgressEffects ); - } - parentFiber = parentFiber.sibling; - } -} -function recursivelyTraverseAtomicPassiveEffects( - finishedRoot$jscomp$0, - parentFiber -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 22: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - } - parentFiber = parentFiber.sibling; - } -} -var suspenseyCommitFlag = 8192; -function recursivelyAccumulateSuspenseyCommit(parentFiber) { - if (parentFiber.subtreeFlags & suspenseyCommitFlag) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - accumulateSuspenseyCommitOnFiber(parentFiber), - (parentFiber = parentFiber.sibling); -} -function accumulateSuspenseyCommitOnFiber(fiber) { - switch (fiber.tag) { - case 26: - recursivelyAccumulateSuspenseyCommit(fiber); - if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) - throw Error( - "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." + break; + case 22: + null === finishedWork.memoizedState && + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + default: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects ); - break; - case 5: - recursivelyAccumulateSuspenseyCommit(fiber); - break; - case 3: - case 4: - recursivelyAccumulateSuspenseyCommit(fiber); - break; - case 22: - if (null === fiber.memoizedState) { - var current = fiber.alternate; - null !== current && null !== current.memoizedState - ? ((current = suspenseyCommitFlag), - (suspenseyCommitFlag = 16777216), - recursivelyAccumulateSuspenseyCommit(fiber), - (suspenseyCommitFlag = current)) - : recursivelyAccumulateSuspenseyCommit(fiber); - } - break; - default: - recursivelyAccumulateSuspenseyCommit(fiber); + } + parentFiber = parentFiber.sibling; } } -function detachAlternateSiblings(parentFiber) { - var previousFiber = parentFiber.alternate; - if ( - null !== previousFiber && - ((parentFiber = previousFiber.child), null !== parentFiber) - ) { - previousFiber.child = null; - do - (previousFiber = parentFiber.sibling), - (parentFiber.sibling = null), - (parentFiber = previousFiber); - while (null !== parentFiber); - } +function commitHookPassiveMountEffects(finishedWork, hookFlags) { + if (shouldProfile(finishedWork)) { + passiveEffectStartTime = now(); + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + recordPassiveEffectDuration(finishedWork); + } else + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error$122) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$122); + } } -function commitHookPassiveUnmountEffects( - finishedWork, - nearestMountedAncestor, - hookFlags -) { - shouldProfile(finishedWork) - ? ((passiveEffectStartTime = now()), - commitHookEffectListUnmount( - hookFlags, - finishedWork, - nearestMountedAncestor - ), - recordPassiveEffectDuration(finishedWork)) - : commitHookEffectListUnmount( - hookFlags, - finishedWork, - nearestMountedAncestor - ); +function commitOffscreenPassiveMountEffects(current, finishedWork) { + var previousCache = null; + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (previousCache = current.memoizedState.cachePool.pool); + current = null; + null !== finishedWork.memoizedState && + null !== finishedWork.memoizedState.cachePool && + (current = finishedWork.memoizedState.cachePool.pool); + current !== previousCache && + (null != current && current.refCount++, + null != previousCache && releaseCache(previousCache)); } -function recursivelyTraversePassiveUnmountEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); - } - detachAlternateSiblings(parentFiber); - } +function commitCachePassiveMountEffect(current, finishedWork) { + current = null; + null !== finishedWork.alternate && + (current = finishedWork.alternate.memoizedState.cache); + finishedWork = finishedWork.memoizedState.cache; + finishedWork !== current && + (finishedWork.refCount++, null != current && releaseCache(current)); +} +function recursivelyTraversePassiveMountEffects( + root, + parentFiber, + committedLanes, + committedTransitions +) { if (parentFiber.subtreeFlags & 10256) for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveUnmountOnFiber(parentFiber), + commitPassiveMountOnFiber( + root, + parentFiber, + committedLanes, + committedTransitions + ), (parentFiber = parentFiber.sibling); } -function commitPassiveUnmountOnFiber(finishedWork) { +function commitPassiveMountOnFiber( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions +) { + var flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: - recursivelyTraversePassiveUnmountEffects(finishedWork); - finishedWork.flags & 2048 && - commitHookPassiveUnmountEffects(finishedWork, finishedWork.return, 9); + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); + break; + case 3: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + ((finishedRoot = null), + null !== finishedWork.alternate && + (finishedRoot = finishedWork.alternate.memoizedState.cache), + (finishedWork = finishedWork.memoizedState.cache), + finishedWork !== finishedRoot && + (finishedWork.refCount++, + null != finishedRoot && releaseCache(finishedRoot))); + break; + case 23: break; case 22: var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState && - instance._visibility & 4 && - (null === finishedWork.return || 13 !== finishedWork.return.tag) - ? ((instance._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(finishedWork)) - : recursivelyTraversePassiveUnmountEffects(finishedWork); + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) + : ((instance._visibility |= 4), + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + )) + : instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + 0 !== (finishedWork.subtreeFlags & 10256) + )); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); break; default: - recursivelyTraversePassiveUnmountEffects(finishedWork); - } -} -function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); - } - detachAlternateSiblings(parentFiber); - } - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - deletions = parentFiber; - switch (deletions.tag) { - case 0: - case 11: - case 15: - commitHookPassiveUnmountEffects(deletions, deletions.return, 8); - recursivelyTraverseDisconnectPassiveEffects(deletions); - break; - case 22: - i = deletions.stateNode; - i._visibility & 4 && - ((i._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(deletions)); - break; - default: - recursivelyTraverseDisconnectPassiveEffects(deletions); - } - parentFiber = parentFiber.sibling; - } -} -function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - deletedSubtreeRoot, - nearestMountedAncestor + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + } +} +function recursivelyTraverseReconnectPassiveEffects( + finishedRoot$jscomp$0, + parentFiber, + committedLanes$jscomp$0, + committedTransitions$jscomp$0, + includeWorkInProgressEffects ) { - for (; null !== nextEffect; ) { - var fiber = nextEffect; - switch (fiber.tag) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + committedLanes = committedLanes$jscomp$0, + committedTransitions = committedTransitions$jscomp$0, + flags = finishedWork.flags; + switch (finishedWork.tag) { case 0: case 11: case 15: - commitHookPassiveUnmountEffects(fiber, nearestMountedAncestor, 8); + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + commitHookPassiveMountEffects(finishedWork, 8); break; case 23: - case 22: - if ( - null !== fiber.memoizedState && - null !== fiber.memoizedState.cachePool - ) { - var cache = fiber.memoizedState.cachePool.pool; - null != cache && cache.refCount++; - } break; - case 24: - releaseCache(fiber.memoizedState.cache); - } - cache = fiber.child; - if (null !== cache) (cache.return = fiber), (nextEffect = cache); - else - a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { - cache = nextEffect; - var sibling = cache.sibling, - returnFiber = cache.return; - detachFiberAfterEffects(cache); - if (cache === fiber) { - nextEffect = null; - break a; - } - if (null !== sibling) { - sibling.return = returnFiber; - nextEffect = sibling; - break a; - } - nextEffect = returnFiber; - } - } -} -var DefaultCacheDispatcher = { - getCacheSignal: function () { - return readContext(CacheContext).controller.signal; - }, - getCacheForType: function (resourceType) { - var cache = readContext(CacheContext), - cacheForType = cache.data.get(resourceType); - void 0 === cacheForType && - ((cacheForType = resourceType()), - cache.data.set(resourceType, cacheForType)); - return cacheForType; - } - }, - PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, - executionContext = 0, - workInProgressRoot = null, - workInProgress = null, - workInProgressRootRenderLanes = 0, - workInProgressSuspendedReason = 0, - workInProgressThrownValue = null, - workInProgressRootDidAttachPingListener = !1, - entangledRenderLanes = 0, - workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, - workInProgressRootSkippedLanes = 0, - workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootPingedLanes = 0, - workInProgressDeferredLane = 0, - workInProgressRootConcurrentErrors = null, - workInProgressRootRecoverableErrors = null, - workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, - globalMostRecentFallbackTime = 0, - workInProgressRootRenderTargetTime = Infinity, - workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, - legacyErrorBoundariesThatAlreadyFailed = null, - rootDoesHavePassiveEffects = !1, - rootWithPendingPassiveEffects = null, - pendingPassiveEffectsLanes = 0, - pendingPassiveProfilerEffects = [], - pendingPassiveEffectsRemainingLanes = 0, - pendingPassiveTransitions = null, - nestedUpdateCount = 0, - rootWithNestedUpdates = null; -function requestUpdateLane(fiber) { - if (0 === (fiber.mode & 1)) return 2; - if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) - return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== requestCurrentTransition()) - return ( - (fiber = currentEntangledLane), - 0 !== fiber ? fiber : requestTransitionLane() - ); - fiber = currentUpdatePriority; - if (0 === fiber) - a: { - fiber = fabricGetCurrentEventPriority - ? fabricGetCurrentEventPriority() - : null; - if (null != fiber) - switch (fiber) { - case FabricDiscretePriority: - fiber = 2; - break a; - } - fiber = 32; - } - return fiber; -} -function requestDeferredLane() { - 0 === workInProgressDeferredLane && - (workInProgressDeferredLane = - 0 !== (workInProgressRootRenderLanes & 536870912) - ? 536870912 - : claimNextTransitionLane()); - var suspenseHandler = suspenseHandlerStackCursor.current; - null !== suspenseHandler && (suspenseHandler.flags |= 32); - return workInProgressDeferredLane; -} -function scheduleUpdateOnFiber(root, fiber, lane) { - if ( - (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || - null !== root.cancelPendingCommit - ) - prepareFreshStack(root, 0), - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); - markRootUpdated(root, lane); - if (0 === (executionContext & 2) || root !== workInProgressRoot) - isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), - root === workInProgressRoot && - (0 === (executionContext & 2) && - (workInProgressRootInterleavedUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - )), - ensureRootIsScheduled(root), - 2 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now$1() + 500), - flushSyncWorkAcrossRoots_impl(!0)); -} -function performConcurrentWorkOnRoot(root, didTimeout) { - nestedUpdateScheduled = currentUpdateIsNested = !1; - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var originalCallbackNode = root.callbackNode; - if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) - return null; - var lanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes : 0 - ); - if (0 === lanes) return null; - var exitStatus = (didTimeout = - 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes) && !didTimeout) - ? renderRootConcurrent(root, lanes) - : renderRootSync(root, lanes); - if (0 !== exitStatus) { - var renderWasConcurrent = didTimeout; - do { - if (6 === exitStatus) markRootSuspended(root, lanes, 0); - else { - didTimeout = root.current.alternate; - if ( - renderWasConcurrent && - !isRenderConsistentWithExternalStores(didTimeout) - ) { - exitStatus = renderRootSync(root, lanes); - renderWasConcurrent = !1; - continue; - } - if (2 === exitStatus) { - renderWasConcurrent = lanes; - var errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - renderWasConcurrent - ); - 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - root, - renderWasConcurrent, - errorRetryLanes - ))); - } - if (1 === exitStatus) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects( + finishedRoot, + finishedWork + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )); + includeWorkInProgressEffects && + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork ); - root.finishedWork = didTimeout; - root.finishedLanes = lanes; - a: { - renderWasConcurrent = root; - switch (exitStatus) { - case 0: - case 1: - throw Error("Root did not complete. This is a bug in React."); - case 4: - if ((lanes & 4194176) === lanes) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - break a; - } - break; - case 2: - case 3: - case 5: - break; - default: - throw Error("Unknown root exit status."); - } - if ( - (lanes & 62914560) === lanes && - (alwaysThrottleRetries || 3 === exitStatus) && - ((exitStatus = globalMostRecentFallbackTime + 300 - now$1()), - 10 < exitStatus) - ) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( - commitRootWhenReady.bind( - null, - renderWasConcurrent, - didTimeout, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane - ), - exitStatus + break; + case 24: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + includeWorkInProgressEffects && + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + } + parentFiber = parentFiber.sibling; + } +} +function recursivelyTraverseAtomicPassiveEffects( + finishedRoot$jscomp$0, + parentFiber +) { + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 22: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork ); - break a; - } - commitRootWhenReady( - renderWasConcurrent, - didTimeout, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane - ); - } + break; + case 24: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + } + parentFiber = parentFiber.sibling; + } +} +var suspenseyCommitFlag = 8192; +function recursivelyAccumulateSuspenseyCommit(parentFiber) { + if (parentFiber.subtreeFlags & suspenseyCommitFlag) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + accumulateSuspenseyCommitOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); +} +function accumulateSuspenseyCommitOnFiber(fiber) { + switch (fiber.tag) { + case 26: + recursivelyAccumulateSuspenseyCommit(fiber); + if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) + throw Error( + "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." + ); + break; + case 5: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 3: + case 4: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 22: + if (null === fiber.memoizedState) { + var current = fiber.alternate; + null !== current && null !== current.memoizedState + ? ((current = suspenseyCommitFlag), + (suspenseyCommitFlag = 16777216), + recursivelyAccumulateSuspenseyCommit(fiber), + (suspenseyCommitFlag = current)) + : recursivelyAccumulateSuspenseyCommit(fiber); } break; - } while (1); + default: + recursivelyAccumulateSuspenseyCommit(fiber); } - ensureRootIsScheduled(root); - scheduleTaskForRootDuringMicrotask(root, now$1()); - root = - root.callbackNode === originalCallbackNode - ? performConcurrentWorkOnRoot.bind(null, root) - : null; - return root; } -function recoverFromConcurrentError( - root, - originallyAttemptedLanes, - errorRetryLanes -) { - var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, - JSCompiler_inline_result; - (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && - (prepareFreshStack(root, errorRetryLanes).flags |= 256); - errorRetryLanes = renderRootSync(root, errorRetryLanes); - if (2 !== errorRetryLanes) { - if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) - return ( - (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), - (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), - 4 - ); - root = workInProgressRootRecoverableErrors; - workInProgressRootRecoverableErrors = errorsFromFirstAttempt; - null !== root && queueRecoverableErrors(root); +function detachAlternateSiblings(parentFiber) { + var previousFiber = parentFiber.alternate; + if ( + null !== previousFiber && + ((parentFiber = previousFiber.child), null !== parentFiber) + ) { + previousFiber.child = null; + do + (previousFiber = parentFiber.sibling), + (parentFiber.sibling = null), + (parentFiber = previousFiber); + while (null !== parentFiber); } - return errorRetryLanes; -} -function queueRecoverableErrors(errors) { - null === workInProgressRootRecoverableErrors - ? (workInProgressRootRecoverableErrors = errors) - : workInProgressRootRecoverableErrors.push.apply( - workInProgressRootRecoverableErrors, - errors - ); } -function commitRootWhenReady( - root, +function commitHookPassiveUnmountEffects( finishedWork, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - lanes, - spawnedLane + nearestMountedAncestor, + hookFlags ) { - 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); - commitRoot( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane - ); -} -function isRenderConsistentWithExternalStores(finishedWork) { - for (var node = finishedWork; ; ) { - if (node.flags & 16384) { - var updateQueue = node.updateQueue; - if ( - null !== updateQueue && - ((updateQueue = updateQueue.stores), null !== updateQueue) - ) - for (var i = 0; i < updateQueue.length; i++) { - var check = updateQueue[i], - getSnapshot = check.getSnapshot; - check = check.value; - try { - if (!objectIs(getSnapshot(), check)) return !1; - } catch (error) { - return !1; - } - } - } - updateQueue = node.child; - if (node.subtreeFlags & 16384 && null !== updateQueue) - (updateQueue.return = node), (node = updateQueue); - else { - if (node === finishedWork) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === finishedWork) return !0; - node = node.return; + shouldProfile(finishedWork) + ? ((passiveEffectStartTime = now()), + commitHookEffectListUnmount( + hookFlags, + finishedWork, + nearestMountedAncestor + ), + recordPassiveEffectDuration(finishedWork)) + : commitHookEffectListUnmount( + hookFlags, + finishedWork, + nearestMountedAncestor + ); +} +function recursivelyTraversePassiveUnmountEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber + ); } - node.sibling.return = node.return; - node = node.sibling; - } + detachAlternateSiblings(parentFiber); } - return !0; + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveUnmountOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); } -function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), (root.pingedLanes = 0)); - enableInfiniteRenderLoopDetection && - (executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), - throwIfInfiniteUpdateLoopDetected()); +function commitPassiveUnmountOnFiber(finishedWork) { + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraversePassiveUnmountEffects(finishedWork); + finishedWork.flags & 2048 && + commitHookPassiveUnmountEffects(finishedWork, finishedWork.return, 9); + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState && + instance._visibility & 4 && + (null === finishedWork.return || 13 !== finishedWork.return.tag) + ? ((instance._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(finishedWork)) + : recursivelyTraversePassiveUnmountEffects(finishedWork); + break; + default: + recursivelyTraversePassiveUnmountEffects(finishedWork); + } } -function markRootSuspended(root, suspendedLanes, spawnedLane) { - suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5; - expirationTimes[index$5] = -1; - lanes &= ~lane; +function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber + ); + } + detachAlternateSiblings(parentFiber); + } + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + deletions = parentFiber; + switch (deletions.tag) { + case 0: + case 11: + case 15: + commitHookPassiveUnmountEffects(deletions, deletions.return, 8); + recursivelyTraverseDisconnectPassiveEffects(deletions); + break; + case 22: + i = deletions.stateNode; + i._visibility & 4 && + ((i._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(deletions)); + break; + default: + recursivelyTraverseDisconnectPassiveEffects(deletions); + } + parentFiber = parentFiber.sibling; } - 0 !== spawnedLane && - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } -function resetWorkInProgressStack() { - if (null !== workInProgress) { - if (0 === workInProgressSuspendedReason) - var interruptedWork = workInProgress.return; +function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + deletedSubtreeRoot, + nearestMountedAncestor +) { + for (; null !== nextEffect; ) { + var fiber = nextEffect; + switch (fiber.tag) { + case 0: + case 11: + case 15: + commitHookPassiveUnmountEffects(fiber, nearestMountedAncestor, 8); + break; + case 23: + case 22: + if ( + null !== fiber.memoizedState && + null !== fiber.memoizedState.cachePool + ) { + var cache = fiber.memoizedState.cachePool.pool; + null != cache && cache.refCount++; + } + break; + case 24: + releaseCache(fiber.memoizedState.cache); + } + cache = fiber.child; + if (null !== cache) (cache.return = fiber), (nextEffect = cache); else - (interruptedWork = workInProgress), - resetContextDependencies(), - resetHooksOnUnwind(interruptedWork), - (thenableState$1 = null), - (thenableIndexCounter$1 = 0), - (interruptedWork = workInProgress); - for (; null !== interruptedWork; ) - unwindInterruptedWork(interruptedWork.alternate, interruptedWork), - (interruptedWork = interruptedWork.return); - workInProgress = null; + a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { + cache = nextEffect; + var sibling = cache.sibling, + returnFiber = cache.return; + detachFiberAfterEffects(cache); + if (cache === fiber) { + nextEffect = null; + break a; + } + if (null !== sibling) { + sibling.return = returnFiber; + nextEffect = sibling; + break a; + } + nextEffect = returnFiber; + } } } -function prepareFreshStack(root, lanes) { - root.finishedWork = null; - root.finishedLanes = 0; - var timeoutHandle = root.timeoutHandle; - -1 !== timeoutHandle && - ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); - timeoutHandle = root.cancelPendingCommit; - null !== timeoutHandle && - ((root.cancelPendingCommit = null), timeoutHandle()); - resetWorkInProgressStack(); - workInProgressRoot = root; - workInProgress = timeoutHandle = createWorkInProgress(root.current, null); - workInProgressRootRenderLanes = lanes; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; - workInProgressDeferredLane = - workInProgressRootPingedLanes = - workInProgressRootInterleavedUpdatedLanes = - workInProgressRootSkippedLanes = - 0; - workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = - null; - workInProgressRootDidIncludeRecursiveRenderUpdate = !1; - 0 !== (lanes & 8) && (lanes |= lanes & 32); - var allEntangledLanes = root.entangledLanes; - if (0 !== allEntangledLanes) - for ( - root = root.entanglements, allEntangledLanes &= lanes; - 0 < allEntangledLanes; - - ) { - var index$3 = 31 - clz32(allEntangledLanes), - lane = 1 << index$3; - lanes |= root[index$3]; - allEntangledLanes &= ~lane; +var DefaultCacheDispatcher = { + getCacheSignal: function () { + return readContext(CacheContext).controller.signal; + }, + getCacheForType: function (resourceType) { + var cache = readContext(CacheContext), + cacheForType = cache.data.get(resourceType); + void 0 === cacheForType && + ((cacheForType = resourceType()), + cache.data.set(resourceType, cacheForType)); + return cacheForType; + } + }, + PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + executionContext = 0, + workInProgressRoot = null, + workInProgress = null, + workInProgressRootRenderLanes = 0, + workInProgressSuspendedReason = 0, + workInProgressThrownValue = null, + workInProgressRootDidAttachPingListener = !1, + entangledRenderLanes = 0, + workInProgressRootExitStatus = 0, + workInProgressRootFatalError = null, + workInProgressRootSkippedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, + workInProgressRootDidIncludeRecursiveRenderUpdate = !1, + didIncludeCommitPhaseUpdate = !1, + globalMostRecentFallbackTime = 0, + workInProgressRootRenderTargetTime = Infinity, + workInProgressTransitions = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsLanes = 0, + pendingPassiveProfilerEffects = [], + pendingPassiveEffectsRemainingLanes = 0, + pendingPassiveTransitions = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null; +function requestUpdateLane(fiber) { + if (0 === (fiber.mode & 1)) return 2; + if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) + return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; + if (null !== requestCurrentTransition()) + return ( + (fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane() + ); + fiber = currentUpdatePriority; + if (0 === fiber) + a: { + fiber = fabricGetCurrentEventPriority + ? fabricGetCurrentEventPriority() + : null; + if (null != fiber) + switch (fiber) { + case FabricDiscretePriority: + fiber = 2; + break a; + } + fiber = 32; } - entangledRenderLanes = lanes; - finishQueueingConcurrentUpdates(); - return timeoutHandle; + return fiber; } -function handleThrow(root, thrownValue) { - currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); - workInProgressThrownValue = thrownValue; - root = workInProgress; - if (null === root) - (workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue); - else - switch ( - (root.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(root, !0), - markComponentRenderStopped(), - workInProgressSuspendedReason) - ) { - case 1: - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markComponentErrored && - injectedProfilingHooks.markComponentErrored( +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : claimNextTransitionLane()); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); + return workInProgressDeferredLane; +} +function scheduleUpdateOnFiber(root, fiber, lane) { + if ( + (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || + null !== root.cancelPendingCommit + ) + prepareFreshStack(root, 0), + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); + markRootUpdated(root, lane); + if (0 === (executionContext & 2) || root !== workInProgressRoot) + isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended( root, - thrownValue, - workInProgressRootRenderLanes - ); - break; - case 2: - case 3: - case 6: - case 7: - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markComponentSuspended && - injectedProfilingHooks.markComponentSuspended( + workInProgressRootRenderLanes, + workInProgressDeferredLane + )), + ensureRootIsScheduled(root), + 2 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now$1() + 500), + flushSyncWorkAcrossRoots_impl(!0)); +} +function performConcurrentWorkOnRoot(root, didTimeout) { + nestedUpdateScheduled = currentUpdateIsNested = !1; + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var originalCallbackNode = root.callbackNode; + if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) + return null; + var lanes = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes : 0 + ); + if (0 === lanes) return null; + var exitStatus = (didTimeout = + 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes) && !didTimeout) + ? renderRootConcurrent(root, lanes) + : renderRootSync(root, lanes); + if (0 !== exitStatus) { + var renderWasConcurrent = didTimeout; + do { + if (6 === exitStatus) markRootSuspended(root, lanes, 0); + else { + didTimeout = root.current.alternate; + if ( + renderWasConcurrent && + !isRenderConsistentWithExternalStores(didTimeout) + ) { + exitStatus = renderRootSync(root, lanes); + renderWasConcurrent = !1; + continue; + } + if (2 === exitStatus) { + renderWasConcurrent = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( root, - thrownValue, - workInProgressRootRenderLanes + renderWasConcurrent ); - } -} -function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; - return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; -} -function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; - return prevCacheDispatcher; -} -function renderDidSuspendDelayIfPossible() { - workInProgressRootExitStatus = 4; - (0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || - null === workInProgressRoot || - markRootSuspended( - workInProgressRoot, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); -} -function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - if (isDevToolsPresent) { - var memoizedUpdaters = root.memoizedUpdaters; - 0 < memoizedUpdaters.size && - (restorePendingUpdaters(root, workInProgressRootRenderLanes), - memoizedUpdaters.clear()); - movePendingFibersToMemoized(root, lanes); - } - workInProgressTransitions = null; - prepareFreshStack(root, lanes); - } - markRenderStarted(lanes); - lanes = !1; - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - memoizedUpdaters = workInProgress; - var thrownValue = workInProgressThrownValue; - switch (workInProgressSuspendedReason) { - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + renderWasConcurrent, + errorRetryLanes + ))); + } + if (1 === exitStatus) + throw ( + ((originalCallbackNode = workInProgressRootFatalError), + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + originalCallbackNode) + ); + root.finishedWork = didTimeout; + root.finishedLanes = lanes; + a: { + renderWasConcurrent = root; + switch (exitStatus) { + case 0: + case 1: + throw Error("Root did not complete. This is a bug in React."); + case 4: + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + break a; + } + break; + case 2: + case 3: + case 5: + break; + default: + throw Error("Unknown root exit status."); + } + if ( + (lanes & 62914560) === lanes && + (alwaysThrottleRetries || 3 === exitStatus) && + ((exitStatus = globalMostRecentFallbackTime + 300 - now$1()), + 10 < exitStatus) + ) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; + renderWasConcurrent.timeoutHandle = scheduleTimeout( + commitRootWhenReady.bind( + null, + renderWasConcurrent, + didTimeout, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ), + exitStatus + ); break a; - case 3: - case 2: - lanes || - null !== suspenseHandlerStackCursor.current || - (lanes = !0); - default: - (workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, memoizedUpdaters, thrownValue); + } + commitRootWhenReady( + renderWasConcurrent, + didTimeout, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ); } } - workLoopSync(); break; - } catch (thrownValue$127) { - handleThrow(root, thrownValue$127); - } - while (1); - lanes && root.shellSuspendCounter++; - resetContextDependencies(); - executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - if (null !== workInProgress) - throw Error( - "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." - ); - markRenderStopped(); - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; -} -function workLoopSync() { - for (; null !== workInProgress; ) performUnitOfWork(workInProgress); + } while (1); + } + ensureRootIsScheduled(root); + scheduleTaskForRootDuringMicrotask(root, now$1()); + root = + root.callbackNode === originalCallbackNode + ? performConcurrentWorkOnRoot.bind(null, root) + : null; + return root; } -function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - if (isDevToolsPresent) { - var memoizedUpdaters = root.memoizedUpdaters; - 0 < memoizedUpdaters.size && - (restorePendingUpdaters(root, workInProgressRootRenderLanes), - memoizedUpdaters.clear()); - movePendingFibersToMemoized(root, lanes); - } - workInProgressTransitions = null; - workInProgressRootRenderTargetTime = now$1() + 500; - prepareFreshStack(root, lanes); +function recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes +) { + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, + JSCompiler_inline_result; + (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && + (prepareFreshStack(root, errorRetryLanes).flags |= 256); + errorRetryLanes = renderRootSync(root, errorRetryLanes); + if (2 !== errorRetryLanes) { + if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) + return ( + (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), + (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), + 4 + ); + root = workInProgressRootRecoverableErrors; + workInProgressRootRecoverableErrors = errorsFromFirstAttempt; + null !== root && queueRecoverableErrors(root); } - markRenderStarted(lanes); - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) - b: switch ( - ((lanes = workInProgress), - (memoizedUpdaters = workInProgressThrownValue), - workInProgressSuspendedReason) - ) { - case 1: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); - break; - case 2: - if (isThenableResolved(memoizedUpdaters)) { - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - replaySuspendedUnitOfWork(lanes); - break; - } - lanes = function () { - 2 === workInProgressSuspendedReason && - workInProgressRoot === root && - (workInProgressSuspendedReason = 7); - ensureRootIsScheduled(root); - }; - memoizedUpdaters.then(lanes, lanes); - break a; - case 3: - workInProgressSuspendedReason = 7; - break a; - case 4: - workInProgressSuspendedReason = 5; - break a; - case 7: - isThenableResolved(memoizedUpdaters) - ? ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - replaySuspendedUnitOfWork(lanes)) - : ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters)); - break; - case 5: - switch (workInProgress.tag) { - case 5: - case 26: - case 27: - lanes = workInProgress; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - var sibling = lanes.sibling; - if (null !== sibling) workInProgress = sibling; - else { - var returnFiber = lanes.return; - null !== returnFiber - ? ((workInProgress = returnFiber), - completeUnitOfWork(returnFiber)) - : (workInProgress = null); - } - break b; - } - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); - break; - case 6: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); - break; - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; - break a; - default: - throw Error("Unexpected SuspendedReason. This is a bug in React."); + return errorRetryLanes; +} +function queueRecoverableErrors(errors) { + null === workInProgressRootRecoverableErrors + ? (workInProgressRootRecoverableErrors = errors) + : workInProgressRootRecoverableErrors.push.apply( + workInProgressRootRecoverableErrors, + errors + ); +} +function commitRootWhenReady( + root, + finishedWork, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + lanes, + spawnedLane +) { + 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); + commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane + ); +} +function isRenderConsistentWithExternalStores(finishedWork) { + for (var node = finishedWork; ; ) { + if (node.flags & 16384) { + var updateQueue = node.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.stores), null !== updateQueue) + ) + for (var i = 0; i < updateQueue.length; i++) { + var check = updateQueue[i], + getSnapshot = check.getSnapshot; + check = check.value; + try { + if (!objectIs(getSnapshot(), check)) return !1; + } catch (error) { + return !1; + } } - workLoopConcurrent(); - break; - } catch (thrownValue$129) { - handleThrow(root, thrownValue$129); } - while (1); - resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - executionContext = prevExecutionContext; - if (null !== workInProgress) - return ( - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markRenderYielded && - injectedProfilingHooks.markRenderYielded(), - 0 - ); - markRenderStopped(); - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; + updateQueue = node.child; + if (node.subtreeFlags & 16384 && null !== updateQueue) + (updateQueue.return = node), (node = updateQueue); + else { + if (node === finishedWork) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === finishedWork) return !0; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + return !0; } -function workLoopConcurrent() { - for (; null !== workInProgress && !shouldYield(); ) - performUnitOfWork(workInProgress); +function markRootUpdated(root, updatedLanes) { + root.pendingLanes |= updatedLanes; + 268435456 !== updatedLanes && + ((root.suspendedLanes = 0), (root.pingedLanes = 0)); + enableInfiniteRenderLoopDetection && + (executionContext & 2 + ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) + : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), + throwIfInfiniteUpdateLoopDetected()); } -function performUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; - 0 !== (unitOfWork.mode & 2) - ? (startProfilerTimer(unitOfWork), - (current = beginWork(current, unitOfWork, entangledRenderLanes)), - stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) - : (current = beginWork(current, unitOfWork, entangledRenderLanes)); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - ReactCurrentOwner.current = null; +function markRootSuspended(root, suspendedLanes, spawnedLane) { + suspendedLanes &= ~workInProgressRootPingedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$5 = 31 - clz32(lanes), + lane = 1 << index$5; + expirationTimes[index$5] = -1; + lanes &= ~lane; + } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } -function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate, - isProfilingMode = 0 !== (unitOfWork.mode & 2); - isProfilingMode && startProfilerTimer(unitOfWork); - switch (unitOfWork.tag) { - case 2: - unitOfWork.tag = 0; - case 15: - case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - var context = isContextProvider(Component) - ? previousContext - : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - context, - workInProgressRootRenderLanes - ); - break; - case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - unitOfWork.ref, - workInProgressRootRenderLanes - ); - break; - case 5: - resetHooksOnUnwind(unitOfWork); - default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); +function resetWorkInProgressStack() { + if (null !== workInProgress) { + if (0 === workInProgressSuspendedReason) + var interruptedWork = workInProgress.return; + else + (interruptedWork = workInProgress), + resetContextDependencies(), + resetHooksOnUnwind(interruptedWork), + (thenableState$1 = null), + (thenableIndexCounter$1 = 0), + (interruptedWork = workInProgress); + for (; null !== interruptedWork; ) + unwindInterruptedWork(interruptedWork.alternate, interruptedWork), + (interruptedWork = interruptedWork.return); + workInProgress = null; } - isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - ReactCurrentOwner.current = null; } -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { - resetContextDependencies(); - resetHooksOnUnwind(unitOfWork); - thenableState$1 = null; - thenableIndexCounter$1 = 0; - var returnFiber = unitOfWork.return; - try { - if ( - throwException( - root, - returnFiber, - unitOfWork, - thrownValue, - workInProgressRootRenderLanes - ) +function prepareFreshStack(root, lanes) { + root.finishedWork = null; + root.finishedLanes = 0; + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + timeoutHandle = root.cancelPendingCommit; + null !== timeoutHandle && + ((root.cancelPendingCommit = null), timeoutHandle()); + resetWorkInProgressStack(); + workInProgressRoot = root; + workInProgress = timeoutHandle = createWorkInProgress(root.current, null); + workInProgressRootRenderLanes = lanes; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + workInProgressRootDidAttachPingListener = !1; + workInProgressRootExitStatus = 0; + workInProgressRootFatalError = null; + workInProgressDeferredLane = + workInProgressRootPingedLanes = + workInProgressRootInterleavedUpdatedLanes = + workInProgressRootSkippedLanes = + 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = + null; + workInProgressRootDidIncludeRecursiveRenderUpdate = !1; + 0 !== (lanes & 8) && (lanes |= lanes & 32); + var allEntangledLanes = root.entangledLanes; + if (0 !== allEntangledLanes) + for ( + root = root.entanglements, allEntangledLanes &= lanes; + 0 < allEntangledLanes; + ) { - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; + var index$3 = 31 - clz32(allEntangledLanes), + lane = 1 << index$3; + lanes |= root[index$3]; + allEntangledLanes &= ~lane; } - } catch (error) { - if (null !== returnFiber) throw ((workInProgress = returnFiber), error); - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; - } - if (unitOfWork.flags & 32768) - a: { - root = unitOfWork; - do { - unitOfWork = unwindWork(root.alternate, root); - if (null !== unitOfWork) { - unitOfWork.flags &= 32767; - workInProgress = unitOfWork; - break a; - } - if (0 !== (root.mode & 2)) { - stopProfilerTimerIfRunningAndRecordDelta(root, !1); - unitOfWork = root.actualDuration; - for (thrownValue = root.child; null !== thrownValue; ) - (unitOfWork += thrownValue.actualDuration), - (thrownValue = thrownValue.sibling); - root.actualDuration = unitOfWork; - } - root = root.return; - null !== root && - ((root.flags |= 32768), - (root.subtreeFlags = 0), - (root.deletions = null)); - workInProgress = root; - } while (null !== root); - workInProgressRootExitStatus = 6; - workInProgress = null; + entangledRenderLanes = lanes; + finishQueueingConcurrentUpdates(); + return timeoutHandle; +} +function handleThrow(root, thrownValue) { + currentlyRenderingFiber$1 = null; + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactCurrentOwner.current = null; + thrownValue === SuspenseException + ? ((thrownValue = getSuspendedThenable()), + (root = suspenseHandlerStackCursor.current), + (workInProgressSuspendedReason = + (null !== root && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + root !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2)) + : thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); + workInProgressThrownValue = thrownValue; + root = workInProgress; + if (null === root) + (workInProgressRootExitStatus = 1), + (workInProgressRootFatalError = thrownValue); + else + switch ( + (root.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(root, !0), + markComponentRenderStopped(), + workInProgressSuspendedReason) + ) { + case 1: + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentErrored && + injectedProfilingHooks.markComponentErrored( + root, + thrownValue, + workInProgressRootRenderLanes + ); + break; + case 2: + case 3: + case 6: + case 7: + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentSuspended && + injectedProfilingHooks.markComponentSuspended( + root, + thrownValue, + workInProgressRootRenderLanes + ); } - else completeUnitOfWork(unitOfWork); } -function completeUnitOfWork(unitOfWork) { - var completedWork = unitOfWork; - do { - var current = completedWork.alternate; - unitOfWork = completedWork.return; - 0 === (completedWork.mode & 2) - ? (current = completeWork(current, completedWork, entangledRenderLanes)) - : (startProfilerTimer(completedWork), - (current = completeWork(current, completedWork, entangledRenderLanes)), - stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); - if (null !== current) { - workInProgress = current; - return; - } - completedWork = completedWork.sibling; - if (null !== completedWork) { - workInProgress = completedWork; - return; - } - workInProgress = completedWork = unitOfWork; - } while (null !== completedWork); - 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); +function pushDispatcher() { + var prevDispatcher = ReactCurrentDispatcher.current; + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; } -function commitRoot( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane -) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; - try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - previousUpdateLanePriority, - spawnedLane - ); - } finally { - (ReactCurrentBatchConfig.transition = prevTransition), - (currentUpdatePriority = previousUpdateLanePriority); - } - return null; +function pushCacheDispatcher() { + var prevCacheDispatcher = ReactCurrentCache.current; + ReactCurrentCache.current = DefaultCacheDispatcher; + return prevCacheDispatcher; } -function commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - renderPriorityLevel, - spawnedLane -) { - do flushPassiveEffects(); - while (null !== rootWithPendingPassiveEffects); - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markCommitStarted && - injectedProfilingHooks.markCommitStarted(lanes); - if (null === finishedWork) return markCommitStopped(), null; - root.finishedWork = null; - root.finishedLanes = 0; - if (finishedWork === root.current) - throw Error( - "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." +function renderDidSuspendDelayIfPossible() { + workInProgressRootExitStatus = 4; + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane ); - root.callbackNode = null; - root.callbackPriority = 0; - root.cancelPendingCommit = null; - var remainingLanes = finishedWork.lanes | finishedWork.childLanes; - remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes, spawnedLane); - didIncludeCommitPhaseUpdate = !1; - root === workInProgressRoot && - ((workInProgress = workInProgressRoot = null), - (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 10256) && - 0 === (finishedWork.flags & 10256)) || - rootDoesHavePassiveEffects || - ((rootDoesHavePassiveEffects = !0), - (pendingPassiveEffectsRemainingLanes = remainingLanes), - (pendingPassiveTransitions = transitions), - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - })); - transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; - spawnedLane = currentUpdatePriority; - currentUpdatePriority = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - ReactCurrentOwner.current = null; - commitBeforeMutationEffects(root, finishedWork); - commitTime = now(); - commitMutationEffects(root, finishedWork, lanes); - root.current = finishedWork; - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && - injectedProfilingHooks.markLayoutEffectsStarted(lanes); - commitLayoutEffects(finishedWork, root, lanes); - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && - injectedProfilingHooks.markLayoutEffectsStopped(); - requestPaint(); - executionContext = prevExecutionContext; - currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; - } else (root.current = finishedWork), (commitTime = now()); - rootDoesHavePassiveEffects - ? ((rootDoesHavePassiveEffects = !1), - (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) - : releaseRootPooledCache(root, remainingLanes); - remainingLanes = root.pendingLanes; - 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); - onCommitRoot(finishedWork.stateNode, renderPriorityLevel); - isDevToolsPresent && root.memoizedUpdaters.clear(); - ensureRootIsScheduled(root); - if (null !== recoverableErrors) - for ( - renderPriorityLevel = root.onRecoverableError, finishedWork = 0; - finishedWork < recoverableErrors.length; - finishedWork++ - ) - (remainingLanes = recoverableErrors[finishedWork]), - (transitions = { - digest: remainingLanes.digest, - componentStack: remainingLanes.stack - }), - renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) +} +function renderRootSync(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { + if (isDevToolsPresent) { + var memoizedUpdaters = root.memoizedUpdaters; + 0 < memoizedUpdaters.size && + (restorePendingUpdaters(root, workInProgressRootRenderLanes), + memoizedUpdaters.clear()); + movePendingFibersToMemoized(root, lanes); + } + workInProgressTransitions = null; + prepareFreshStack(root, lanes); + } + markRenderStarted(lanes); + lanes = !1; + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + memoizedUpdaters = workInProgress; + var thrownValue = workInProgressThrownValue; + switch (workInProgressSuspendedReason) { + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + case 3: + case 2: + lanes || + null !== suspenseHandlerStackCursor.current || + (lanes = !0); + default: + (workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, memoizedUpdaters, thrownValue); + } + } + workLoopSync(); + break; + } catch (thrownValue$127) { + handleThrow(root, thrownValue$127); + } + while (1); + lanes && root.shellSuspendCounter++; + resetContextDependencies(); + executionContext = prevExecutionContext; + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + if (null !== workInProgress) + throw Error( + "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." ); - 0 !== (pendingPassiveEffectsLanes & 3) && - 0 !== root.tag && - flushPassiveEffects(); - remainingLanes = root.pendingLanes; - (enableInfiniteRenderLoopDetection && - (didIncludeRenderPhaseUpdate || didIncludeCommitPhaseUpdate)) || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes)) - ? ((nestedUpdateScheduled = !0), - root === rootWithNestedUpdates - ? nestedUpdateCount++ - : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) - : (nestedUpdateCount = 0); - flushSyncWorkAcrossRoots_impl(!1); - markCommitStopped(); - return null; + markRenderStopped(); + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; } -function releaseRootPooledCache(root, remainingLanes) { - 0 === (root.pooledCacheLanes &= remainingLanes) && - ((remainingLanes = root.pooledCache), - null != remainingLanes && - ((root.pooledCache = null), releaseCache(remainingLanes))); +function workLoopSync() { + for (; null !== workInProgress; ) performUnitOfWork(workInProgress); } -function flushPassiveEffects() { - if (null !== rootWithPendingPassiveEffects) { - var root = rootWithPendingPassiveEffects, - remainingLanes = pendingPassiveEffectsRemainingLanes; - pendingPassiveEffectsRemainingLanes = 0; - var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; +function renderRootConcurrent(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { + if (isDevToolsPresent) { + var memoizedUpdaters = root.memoizedUpdaters; + 0 < memoizedUpdaters.size && + (restorePendingUpdaters(root, workInProgressRootRenderLanes), + memoizedUpdaters.clear()); + movePendingFibersToMemoized(root, lanes); + } + workInProgressTransitions = null; + workInProgressRootRenderTargetTime = now$1() + 500; + prepareFreshStack(root, lanes); + } + markRenderStarted(lanes); + a: do try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; - if (null === rootWithPendingPassiveEffects) - var JSCompiler_inline_result = !1; - else { - var transitions = pendingPassiveTransitions; - pendingPassiveTransitions = null; - priority = rootWithPendingPassiveEffects; - var lanes = pendingPassiveEffectsLanes; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsLanes = 0; - if (0 !== (executionContext & 6)) - throw Error("Cannot flush passive effects while already rendering."); - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markPassiveEffectsStarted && - injectedProfilingHooks.markPassiveEffectsStarted(lanes); - var prevExecutionContext = executionContext; - executionContext |= 4; - commitPassiveUnmountOnFiber(priority.current); - commitPassiveMountOnFiber( - priority, - priority.current, - lanes, - transitions - ); - transitions = pendingPassiveProfilerEffects; - pendingPassiveProfilerEffects = []; - for (lanes = 0; lanes < transitions.length; lanes++) { - var finishedWork = transitions[lanes]; - if (executionContext & 4 && 0 !== (finishedWork.flags & 4)) - switch (finishedWork.tag) { - case 12: - var passiveEffectDuration = - finishedWork.stateNode.passiveEffectDuration, - _finishedWork$memoize = finishedWork.memoizedProps, - id = _finishedWork$memoize.id, - onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$106 = commitTime, - phase = null === finishedWork.alternate ? "mount" : "update"; - currentUpdateIsNested && (phase = "nested-update"); - "function" === typeof onPostCommit && - onPostCommit( - id, - phase, - passiveEffectDuration, - commitTime$106 - ); - var parentFiber = finishedWork.return; - b: for (; null !== parentFiber; ) { - switch (parentFiber.tag) { - case 3: - parentFiber.stateNode.passiveEffectDuration += - passiveEffectDuration; - break b; - case 12: - parentFiber.stateNode.passiveEffectDuration += - passiveEffectDuration; - break b; - } - parentFiber = parentFiber.return; + if (0 !== workInProgressSuspendedReason && null !== workInProgress) + b: switch ( + ((lanes = workInProgress), + (memoizedUpdaters = workInProgressThrownValue), + workInProgressSuspendedReason) + ) { + case 1: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); + break; + case 2: + if (isThenableResolved(memoizedUpdaters)) { + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + replaySuspendedUnitOfWork(lanes); + break; + } + lanes = function () { + 2 === workInProgressSuspendedReason && + workInProgressRoot === root && + (workInProgressSuspendedReason = 7); + ensureRootIsScheduled(root); + }; + memoizedUpdaters.then(lanes, lanes); + break a; + case 3: + workInProgressSuspendedReason = 7; + break a; + case 4: + workInProgressSuspendedReason = 5; + break a; + case 7: + isThenableResolved(memoizedUpdaters) + ? ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + replaySuspendedUnitOfWork(lanes)) + : ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters)); + break; + case 5: + switch (workInProgress.tag) { + case 5: + case 26: + case 27: + lanes = workInProgress; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + var sibling = lanes.sibling; + if (null !== sibling) workInProgress = sibling; + else { + var returnFiber = lanes.return; + null !== returnFiber + ? ((workInProgress = returnFiber), + completeUnitOfWork(returnFiber)) + : (workInProgress = null); } + break b; } + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); + break; + case 6: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); + break; + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + default: + throw Error("Unexpected SuspendedReason. This is a bug in React."); } - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markPassiveEffectsStopped && - injectedProfilingHooks.markPassiveEffectsStopped(); - executionContext = prevExecutionContext; - flushSyncWorkAcrossRoots_impl(!1); - if ( - injectedHook && - "function" === typeof injectedHook.onPostCommitFiberRoot - ) - try { - injectedHook.onPostCommitFiberRoot(rendererID, priority); - } catch (err) {} - var stateNode = priority.current.stateNode; - stateNode.effectDuration = 0; - stateNode.passiveEffectDuration = 0; - JSCompiler_inline_result = !0; - } - return JSCompiler_inline_result; - } finally { - (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), - releaseRootPooledCache(root, remainingLanes); + workLoopConcurrent(); + break; + } catch (thrownValue$129) { + handleThrow(root, thrownValue$129); } + while (1); + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + executionContext = prevExecutionContext; + if (null !== workInProgress) + return ( + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderYielded && + injectedProfilingHooks.markRenderYielded(), + 0 + ); + markRenderStopped(); + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; +} +function workLoopConcurrent() { + for (; null !== workInProgress && !shouldYield(); ) + performUnitOfWork(workInProgress); +} +function performUnitOfWork(unitOfWork) { + var current = unitOfWork.alternate; + 0 !== (unitOfWork.mode & 2) + ? (startProfilerTimer(unitOfWork), + (current = beginWork(current, unitOfWork, entangledRenderLanes)), + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) + : (current = beginWork(current, unitOfWork, entangledRenderLanes)); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current + ? completeUnitOfWork(unitOfWork) + : (workInProgress = current); + ReactCurrentOwner.current = null; +} +function replaySuspendedUnitOfWork(unitOfWork) { + var current = unitOfWork.alternate, + isProfilingMode = 0 !== (unitOfWork.mode & 2); + isProfilingMode && startProfilerTimer(unitOfWork); + switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; + case 15: + case 0: + var Component = unitOfWork.type, + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor$1.current; + context = getMaskedContext(unitOfWork, context); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + context, + workInProgressRootRenderLanes + ); + break; + case 11: + Component = unitOfWork.type.render; + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + unitOfWork.ref, + workInProgressRootRenderLanes + ); + break; + case 5: + resetHooksOnUnwind(unitOfWork); + default: + unwindInterruptedWork(current, unitOfWork), + (unitOfWork = workInProgress = + resetWorkInProgress(unitOfWork, entangledRenderLanes)), + (current = beginWork(current, unitOfWork, entangledRenderLanes)); } - return !1; -} -function enqueuePendingPassiveProfilerEffect(fiber) { - pendingPassiveProfilerEffects.push(fiber); - rootDoesHavePassiveEffects || - ((rootDoesHavePassiveEffects = !0), - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - })); -} -function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); - rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); - null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current + ? completeUnitOfWork(unitOfWork) + : (workInProgress = current); + ReactCurrentOwner.current = null; } -function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { - if (3 === sourceFiber.tag) - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - else - for (; null !== nearestMountedAncestor; ) { - if (3 === nearestMountedAncestor.tag) { - captureCommitPhaseErrorOnRoot( - nearestMountedAncestor, - sourceFiber, - error - ); - break; - } else if (1 === nearestMountedAncestor.tag) { - var instance = nearestMountedAncestor.stateNode; - if ( - "function" === - typeof nearestMountedAncestor.type.getDerivedStateFromError || - ("function" === typeof instance.componentDidCatch && - (null === legacyErrorBoundariesThatAlreadyFailed || - !legacyErrorBoundariesThatAlreadyFailed.has(instance))) - ) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createClassErrorUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - nearestMountedAncestor = enqueueUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - null !== nearestMountedAncestor && - (markRootUpdated(nearestMountedAncestor, 2), - ensureRootIsScheduled(nearestMountedAncestor)); - break; +function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + resetContextDependencies(); + resetHooksOnUnwind(unitOfWork); + thenableState$1 = null; + thenableIndexCounter$1 = 0; + var returnFiber = unitOfWork.return; + try { + if ( + throwException( + root, + returnFiber, + unitOfWork, + thrownValue, + workInProgressRootRenderLanes + ) + ) { + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + } catch (error) { + if (null !== returnFiber) throw ((workInProgress = returnFiber), error); + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + if (unitOfWork.flags & 32768) + a: { + root = unitOfWork; + do { + unitOfWork = unwindWork(root.alternate, root); + if (null !== unitOfWork) { + unitOfWork.flags &= 32767; + workInProgress = unitOfWork; + break a; } - } - nearestMountedAncestor = nearestMountedAncestor.return; + if (0 !== (root.mode & 2)) { + stopProfilerTimerIfRunningAndRecordDelta(root, !1); + unitOfWork = root.actualDuration; + for (thrownValue = root.child; null !== thrownValue; ) + (unitOfWork += thrownValue.actualDuration), + (thrownValue = thrownValue.sibling); + root.actualDuration = unitOfWork; + } + root = root.return; + null !== root && + ((root.flags |= 32768), + (root.subtreeFlags = 0), + (root.deletions = null)); + workInProgress = root; + } while (null !== root); + workInProgressRootExitStatus = 6; + workInProgress = null; } + else completeUnitOfWork(unitOfWork); } -function attachPingListener(root, wakeable, lanes) { - var pingCache = root.pingCache; - if (null === pingCache) { - pingCache = root.pingCache = new PossiblyWeakMap(); - var threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else - (threadIDs = pingCache.get(wakeable)), - void 0 === threadIDs && - ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); - threadIDs.has(lanes) || - ((workInProgressRootDidAttachPingListener = !0), - threadIDs.add(lanes), - (pingCache = pingSuspendedRoot.bind(null, root, wakeable, lanes)), - isDevToolsPresent && restorePendingUpdaters(root, lanes), - wakeable.then(pingCache, pingCache)); +function completeUnitOfWork(unitOfWork) { + var completedWork = unitOfWork; + do { + var current = completedWork.alternate; + unitOfWork = completedWork.return; + 0 === (completedWork.mode & 2) + ? (current = completeWork(current, completedWork, entangledRenderLanes)) + : (startProfilerTimer(completedWork), + (current = completeWork(current, completedWork, entangledRenderLanes)), + stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); + if (null !== current) { + workInProgress = current; + return; + } + completedWork = completedWork.sibling; + if (null !== completedWork) { + workInProgress = completedWork; + return; + } + workInProgress = completedWork = unitOfWork; + } while (null !== completedWork); + 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function pingSuspendedRoot(root, wakeable, pingedLanes) { - var pingCache = root.pingCache; - null !== pingCache && pingCache.delete(wakeable); - root.pingedLanes |= root.suspendedLanes & pingedLanes; - enableInfiniteRenderLoopDetection && - (executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), - throwIfInfiniteUpdateLoopDetected()); - workInProgressRoot === root && - (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && - (4 === workInProgressRootExitStatus || - (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes && - 300 > now$1() - globalMostRecentFallbackTime) - ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) - : (workInProgressRootPingedLanes |= pingedLanes)); +function commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane +) { + var previousUpdateLanePriority = currentUpdatePriority, + prevTransition = ReactCurrentBatchConfig.transition; + try { + (ReactCurrentBatchConfig.transition = null), + (currentUpdatePriority = 2), + commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + previousUpdateLanePriority, + spawnedLane + ); + } finally { + (ReactCurrentBatchConfig.transition = prevTransition), + (currentUpdatePriority = previousUpdateLanePriority); + } + return null; +} +function commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + renderPriorityLevel, + spawnedLane +) { + do flushPassiveEffects(); + while (null !== rootWithPendingPassiveEffects); + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var finishedWork = root.finishedWork, + lanes = root.finishedLanes; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markCommitStarted && + injectedProfilingHooks.markCommitStarted(lanes); + if (null === finishedWork) return markCommitStopped(), null; + root.finishedWork = null; + root.finishedLanes = 0; + if (finishedWork === root.current) + throw Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ); + root.callbackNode = null; + root.callbackPriority = 0; + root.cancelPendingCommit = null; + var remainingLanes = finishedWork.lanes | finishedWork.childLanes; + remainingLanes |= concurrentlyUpdatedLanes; + markRootFinished(root, remainingLanes, spawnedLane); + didIncludeCommitPhaseUpdate = !1; + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), + (workInProgressRootRenderLanes = 0)); + (0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || + rootDoesHavePassiveEffects || + ((rootDoesHavePassiveEffects = !0), + (pendingPassiveEffectsRemainingLanes = remainingLanes), + (pendingPassiveTransitions = transitions), + scheduleCallback(NormalPriority$1, function () { + flushPassiveEffects(); + return null; + })); + transitions = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { + transitions = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = null; + spawnedLane = currentUpdatePriority; + currentUpdatePriority = 2; + var prevExecutionContext = executionContext; + executionContext |= 4; + ReactCurrentOwner.current = null; + commitBeforeMutationEffects(root, finishedWork); + commitTime = now(); + commitMutationEffects(root, finishedWork, lanes); + root.current = finishedWork; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && + injectedProfilingHooks.markLayoutEffectsStarted(lanes); + commitLayoutEffects(finishedWork, root, lanes); + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && + injectedProfilingHooks.markLayoutEffectsStopped(); + requestPaint(); + executionContext = prevExecutionContext; + currentUpdatePriority = spawnedLane; + ReactCurrentBatchConfig.transition = transitions; + } else (root.current = finishedWork), (commitTime = now()); + rootDoesHavePassiveEffects + ? ((rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsLanes = lanes)) + : releaseRootPooledCache(root, remainingLanes); + remainingLanes = root.pendingLanes; + 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); + onCommitRoot(finishedWork.stateNode, renderPriorityLevel); + isDevToolsPresent && root.memoizedUpdaters.clear(); ensureRootIsScheduled(root); -} -function retryTimedOutBoundary(boundaryFiber, retryLane) { - 0 === retryLane && - (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); - boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); - null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), - ensureRootIsScheduled(boundaryFiber)); -} -function retryDehydratedSuspenseBoundary(boundaryFiber) { - var suspenseState = boundaryFiber.memoizedState, - retryLane = 0; - null !== suspenseState && (retryLane = suspenseState.retryLane); - retryTimedOutBoundary(boundaryFiber, retryLane); -} -function resolveRetryWakeable(boundaryFiber, wakeable) { - var retryLane = 0; - switch (boundaryFiber.tag) { - case 13: - var retryCache = boundaryFiber.stateNode; - var suspenseState = boundaryFiber.memoizedState; - null !== suspenseState && (retryLane = suspenseState.retryLane); - break; - case 19: - retryCache = boundaryFiber.stateNode; - break; - case 22: - retryCache = boundaryFiber.stateNode._retryCache; - break; - default: - throw Error( - "Pinged unknown suspense boundary type. This is probably a bug in React." - ); - } - null !== retryCache && retryCache.delete(wakeable); - retryTimedOutBoundary(boundaryFiber, retryLane); -} -function throwIfInfiniteUpdateLoopDetected() { - if (50 < nestedUpdateCount) + if (null !== recoverableErrors) + for ( + renderPriorityLevel = root.onRecoverableError, finishedWork = 0; + finishedWork < recoverableErrors.length; + finishedWork++ + ) + (remainingLanes = recoverableErrors[finishedWork]), + (transitions = { + digest: remainingLanes.digest, + componentStack: remainingLanes.stack + }), + renderPriorityLevel(remainingLanes.value, transitions); + if (hasUncaughtError) throw ( - ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - enableInfiniteRenderLoopDetection && - executionContext & 2 && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - )) + ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root) ); + 0 !== (pendingPassiveEffectsLanes & 3) && + 0 !== root.tag && + flushPassiveEffects(); + remainingLanes = root.pendingLanes; + (enableInfiniteRenderLoopDetection && + (didIncludeRenderPhaseUpdate || didIncludeCommitPhaseUpdate)) || + (0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes)) + ? ((nestedUpdateScheduled = !0), + root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) + : (nestedUpdateCount = 0); + flushSyncWorkAcrossRoots_impl(!1); + markCommitStopped(); + return null; } -var beginWork; -beginWork = function (current, workInProgress, renderLanes) { - if (null !== current) - if ( - current.memoizedProps !== workInProgress.pendingProps || - didPerformWorkStackCursor.current - ) - didReceiveUpdate = !0; - else { - if ( - 0 === (current.lanes & renderLanes) && - 0 === (workInProgress.flags & 128) - ) - return ( - (didReceiveUpdate = !1), - attemptEarlyBailoutIfNoScheduledUpdate( - current, - workInProgress, - renderLanes - ) - ); - didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; - } - else didReceiveUpdate = !1; - workInProgress.lanes = 0; - switch (workInProgress.tag) { - case 2: - var Component = workInProgress.type; - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - var context = getMaskedContext( - workInProgress, - contextStackCursor$1.current - ); - prepareToReadContext(workInProgress, renderLanes); - markComponentRenderStarted(workInProgress); - current = renderWithHooks( - null, - workInProgress, - Component, - current, - context, - renderLanes - ); - markComponentRenderStopped(); - workInProgress.flags |= 1; - workInProgress.tag = 0; - reconcileChildren(null, workInProgress, current, renderLanes); - workInProgress = workInProgress.child; - return workInProgress; - case 16: - Component = workInProgress.elementType; - a: { - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - context = Component._init; - Component = context(Component._payload); - workInProgress.type = Component; - context = workInProgress.tag = resolveLazyComponentTag(Component); - current = resolveDefaultProps(Component, current); - switch (context) { - case 0: - workInProgress = updateFunctionComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 1: - workInProgress = updateClassComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 11: - workInProgress = updateForwardRef( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 14: - workInProgress = updateMemoComponent( - null, - workInProgress, - Component, - resolveDefaultProps(Component.type, current), - renderLanes - ); - break a; - } - throw Error( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." +function releaseRootPooledCache(root, remainingLanes) { + 0 === (root.pooledCacheLanes &= remainingLanes) && + ((remainingLanes = root.pooledCache), + null != remainingLanes && + ((root.pooledCache = null), releaseCache(remainingLanes))); +} +function flushPassiveEffects() { + if (null !== rootWithPendingPassiveEffects) { + var root = rootWithPendingPassiveEffects, + remainingLanes = pendingPassiveEffectsRemainingLanes; + pendingPassiveEffectsRemainingLanes = 0; + var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), + priority = 32 > renderPriority ? 32 : renderPriority; + renderPriority = ReactCurrentBatchConfig.transition; + var previousPriority = currentUpdatePriority; + try { + ReactCurrentBatchConfig.transition = null; + currentUpdatePriority = priority; + if (null === rootWithPendingPassiveEffects) + var JSCompiler_inline_result = !1; + else { + var transitions = pendingPassiveTransitions; + pendingPassiveTransitions = null; + priority = rootWithPendingPassiveEffects; + var lanes = pendingPassiveEffectsLanes; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsLanes = 0; + if (0 !== (executionContext & 6)) + throw Error("Cannot flush passive effects while already rendering."); + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markPassiveEffectsStarted && + injectedProfilingHooks.markPassiveEffectsStarted(lanes); + var prevExecutionContext = executionContext; + executionContext |= 4; + commitPassiveUnmountOnFiber(priority.current); + commitPassiveMountOnFiber( + priority, + priority.current, + lanes, + transitions ); - } - return workInProgress; - case 0: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateFunctionComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 1: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateClassComponent( - current, - workInProgress, - Component, - context, - renderLanes + transitions = pendingPassiveProfilerEffects; + pendingPassiveProfilerEffects = []; + for (lanes = 0; lanes < transitions.length; lanes++) { + var finishedWork = transitions[lanes]; + if (executionContext & 4 && 0 !== (finishedWork.flags & 4)) + switch (finishedWork.tag) { + case 12: + var passiveEffectDuration = + finishedWork.stateNode.passiveEffectDuration, + _finishedWork$memoize = finishedWork.memoizedProps, + id = _finishedWork$memoize.id, + onPostCommit = _finishedWork$memoize.onPostCommit, + commitTime$106 = commitTime, + phase = null === finishedWork.alternate ? "mount" : "update"; + currentUpdateIsNested && (phase = "nested-update"); + "function" === typeof onPostCommit && + onPostCommit( + id, + phase, + passiveEffectDuration, + commitTime$106 + ); + var parentFiber = finishedWork.return; + b: for (; null !== parentFiber; ) { + switch (parentFiber.tag) { + case 3: + parentFiber.stateNode.passiveEffectDuration += + passiveEffectDuration; + break b; + case 12: + parentFiber.stateNode.passiveEffectDuration += + passiveEffectDuration; + break b; + } + parentFiber = parentFiber.return; + } + } + } + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markPassiveEffectsStopped && + injectedProfilingHooks.markPassiveEffectsStopped(); + executionContext = prevExecutionContext; + flushSyncWorkAcrossRoots_impl(!1); + if ( + injectedHook && + "function" === typeof injectedHook.onPostCommitFiberRoot ) - ); - case 3: - pushHostRootContext(workInProgress); - if (null === current) - throw Error("Should have a current fiber. This is a bug in React."); - var nextProps = workInProgress.pendingProps; - context = workInProgress.memoizedState; - Component = context.element; - cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, nextProps, null, renderLanes); - nextProps = workInProgress.memoizedState; - var nextCache = nextProps.cache; - pushProvider(workInProgress, CacheContext, nextCache); - nextCache !== context.cache && - propagateContextChange(workInProgress, CacheContext, renderLanes); - suspendIfUpdateReadFromEntangledAsyncAction(); - context = nextProps.element; - context === Component - ? (workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - )) - : (reconcileChildren(current, workInProgress, context, renderLanes), - (workInProgress = workInProgress.child)); - return workInProgress; - case 26: - case 27: - case 5: - pushHostContext(workInProgress); - Component = workInProgress.pendingProps.children; - if (enableAsyncActions && null !== workInProgress.memoizedState) { - if (!enableAsyncActions) throw Error("Not implemented."); - context = renderWithHooks( - current, - workInProgress, - TransitionAwareHostComponent, - null, - null, - renderLanes - ); - HostTransitionContext._currentValue2 = context; - didReceiveUpdate && - null !== current && - current.memoizedState.memoizedState !== context && - propagateContextChange( - workInProgress, - HostTransitionContext, - renderLanes - ); + try { + injectedHook.onPostCommitFiberRoot(rendererID, priority); + } catch (err) {} + var stateNode = priority.current.stateNode; + stateNode.effectDuration = 0; + stateNode.passiveEffectDuration = 0; + JSCompiler_inline_result = !0; } - markRef(current, workInProgress); - reconcileChildren(current, workInProgress, Component, renderLanes); - return workInProgress.child; - case 6: - return null; - case 13: - return updateSuspenseComponent(current, workInProgress, renderLanes); - case 4: - return ( - pushHostContainer( - workInProgress, - workInProgress.stateNode.containerInfo - ), - (Component = workInProgress.pendingProps), - null === current - ? (workInProgress.child = reconcileChildFibers( - workInProgress, - null, - Component, - renderLanes - )) - : reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 11: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateForwardRef( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 7: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps, - renderLanes - ), - workInProgress.child - ); - case 8: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 12: - return ( - (workInProgress.flags |= 4), - (Component = workInProgress.stateNode), - (Component.effectDuration = 0), - (Component.passiveEffectDuration = 0), - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 10: - a: { - Component = enableRenderableContext - ? workInProgress.type - : workInProgress.type._context; - context = workInProgress.pendingProps; - nextProps = workInProgress.memoizedProps; - nextCache = context.value; - pushProvider(workInProgress, Component, nextCache); - if (null !== nextProps) - if (objectIs(nextProps.value, nextCache)) { - if ( - nextProps.children === context.children && - !didPerformWorkStackCursor.current - ) { - workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - ); - break a; - } - } else propagateContextChange(workInProgress, Component, renderLanes); - reconcileChildren( - current, - workInProgress, - context.children, - renderLanes + return JSCompiler_inline_result; + } finally { + (currentUpdatePriority = previousPriority), + (ReactCurrentBatchConfig.transition = renderPriority), + releaseRootPooledCache(root, remainingLanes); + } + } + return !1; +} +function enqueuePendingPassiveProfilerEffect(fiber) { + pendingPassiveProfilerEffects.push(fiber); + rootDoesHavePassiveEffects || + ((rootDoesHavePassiveEffects = !0), + scheduleCallback(NormalPriority$1, function () { + flushPassiveEffects(); + return null; + })); +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); + null !== rootFiber && + (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); +} +function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (; null !== nearestMountedAncestor; ) { + if (3 === nearestMountedAncestor.tag) { + captureCommitPhaseErrorOnRoot( + nearestMountedAncestor, + sourceFiber, + error ); - workInProgress = workInProgress.child; + break; + } else if (1 === nearestMountedAncestor.tag) { + var instance = nearestMountedAncestor.stateNode; + if ( + "function" === + typeof nearestMountedAncestor.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createClassErrorUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + nearestMountedAncestor = enqueueUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + null !== nearestMountedAncestor && + (markRootUpdated(nearestMountedAncestor, 2), + ensureRootIsScheduled(nearestMountedAncestor)); + break; + } } - return workInProgress; - case 9: - return ( - (context = enableRenderableContext - ? workInProgress.type._context - : workInProgress.type), - (Component = workInProgress.pendingProps.children), - prepareToReadContext(workInProgress, renderLanes), - (context = readContext(context)), - markComponentRenderStarted(workInProgress), - (Component = Component(context)), - markComponentRenderStopped(), - (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 14: - return ( - (Component = workInProgress.type), - (context = resolveDefaultProps(Component, workInProgress.pendingProps)), - (context = resolveDefaultProps(Component.type, context)), - updateMemoComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 15: - return updateSimpleMemoComponent( - current, - workInProgress, - workInProgress.type, - workInProgress.pendingProps, - renderLanes - ); - case 17: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), - (workInProgress.tag = 1), - isContextProvider(Component) - ? ((current = !0), pushContextProvider(workInProgress)) - : (current = !1), - prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, Component, context), - mountClassInstance(workInProgress, Component, context, renderLanes), - finishClassComponent( - null, - workInProgress, - Component, - !0, - current, - renderLanes - ) - ); + nearestMountedAncestor = nearestMountedAncestor.return; + } +} +function attachPingListener(root, wakeable, lanes) { + var pingCache = root.pingCache; + if (null === pingCache) { + pingCache = root.pingCache = new PossiblyWeakMap(); + var threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } else + (threadIDs = pingCache.get(wakeable)), + void 0 === threadIDs && + ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); + threadIDs.has(lanes) || + ((workInProgressRootDidAttachPingListener = !0), + threadIDs.add(lanes), + (pingCache = pingSuspendedRoot.bind(null, root, wakeable, lanes)), + isDevToolsPresent && restorePendingUpdaters(root, lanes), + wakeable.then(pingCache, pingCache)); +} +function pingSuspendedRoot(root, wakeable, pingedLanes) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(wakeable); + root.pingedLanes |= root.suspendedLanes & pingedLanes; + enableInfiniteRenderLoopDetection && + (executionContext & 2 + ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) + : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), + throwIfInfiniteUpdateLoopDetected()); + workInProgressRoot === root && + (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && + (4 === workInProgressRootExitStatus || + (3 === workInProgressRootExitStatus && + (workInProgressRootRenderLanes & 62914560) === + workInProgressRootRenderLanes && + 300 > now$1() - globalMostRecentFallbackTime) + ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) + : (workInProgressRootPingedLanes |= pingedLanes)); + ensureRootIsScheduled(root); +} +function retryTimedOutBoundary(boundaryFiber, retryLane) { + 0 === retryLane && + (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); + boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); + null !== boundaryFiber && + (markRootUpdated(boundaryFiber, retryLane), + ensureRootIsScheduled(boundaryFiber)); +} +function retryDehydratedSuspenseBoundary(boundaryFiber) { + var suspenseState = boundaryFiber.memoizedState, + retryLane = 0; + null !== suspenseState && (retryLane = suspenseState.retryLane); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function resolveRetryWakeable(boundaryFiber, wakeable) { + var retryLane = 0; + switch (boundaryFiber.tag) { + case 13: + var retryCache = boundaryFiber.stateNode; + var suspenseState = boundaryFiber.memoizedState; + null !== suspenseState && (retryLane = suspenseState.retryLane); + break; case 19: - return updateSuspenseListComponent(current, workInProgress, renderLanes); + retryCache = boundaryFiber.stateNode; + break; case 22: - return updateOffscreenComponent(current, workInProgress, renderLanes); - case 24: - return ( - prepareToReadContext(workInProgress, renderLanes), - (Component = readContext(CacheContext)), - null === current - ? ((context = peekCacheFromPool()), - null === context && - ((context = workInProgressRoot), - (nextProps = createCache()), - (context.pooledCache = nextProps), - nextProps.refCount++, - null !== nextProps && (context.pooledCacheLanes |= renderLanes), - (context = nextProps)), - (workInProgress.memoizedState = { - parent: Component, - cache: context - }), - initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, context)) - : (0 !== (current.lanes & renderLanes) && - (cloneUpdateQueue(current, workInProgress), - processUpdateQueue(workInProgress, null, null, renderLanes), - suspendIfUpdateReadFromEntangledAsyncAction()), - (context = current.memoizedState), - (nextProps = workInProgress.memoizedState), - context.parent !== Component - ? ((context = { parent: Component, cache: Component }), - (workInProgress.memoizedState = context), - 0 === workInProgress.lanes && - (workInProgress.memoizedState = - workInProgress.updateQueue.baseState = - context), - pushProvider(workInProgress, CacheContext, Component)) - : ((Component = nextProps.cache), - pushProvider(workInProgress, CacheContext, Component), - Component !== context.cache && - propagateContextChange( - workInProgress, - CacheContext, - renderLanes - ))), - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child + retryCache = boundaryFiber.stateNode._retryCache; + break; + default: + throw Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." ); } - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); -}; + null !== retryCache && retryCache.delete(wakeable); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function throwIfInfiniteUpdateLoopDetected() { + if (50 < nestedUpdateCount) + throw ( + ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + enableInfiniteRenderLoopDetection && + executionContext & 2 && + null !== workInProgressRoot && + (workInProgressRoot.errorRecoveryDisabledLanes |= + workInProgressRootRenderLanes), + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + )) + ); +} function restorePendingUpdaters(root, lanes) { isDevToolsPresent && root.memoizedUpdaters.forEach(function (schedulingFiber) { @@ -11345,10 +11299,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1187 = { + devToolsConfig$jscomp$inline_1184 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-canary-ad533779", + version: "18.3.0-canary-f481921d", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11378,10 +11332,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1187.bundleType, - version: devToolsConfig$jscomp$inline_1187.version, - rendererPackageName: devToolsConfig$jscomp$inline_1187.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1187.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1184.bundleType, + version: devToolsConfig$jscomp$inline_1184.version, + rendererPackageName: devToolsConfig$jscomp$inline_1184.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1184.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -11397,14 +11351,14 @@ var roots = new Map(), return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1187.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1184.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-ad533779" + reconcilerVersion: "18.3.0-canary-f481921d" }); exports.createPortal = function (children, containerTag) { return createPortal$1( diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index cfa311b6e502a..8f76dce9382e6 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<45259d00695e41735c188d9c5b2d77e3>> */ "use strict"; @@ -104,292 +104,14 @@ if (__DEV__) { } } - var fakeNode = null; - - { - if ( - typeof window !== "undefined" && - typeof window.dispatchEvent === "function" && - typeof document !== "undefined" && // $FlowFixMe[method-unbinding] - typeof document.createEvent === "function" - ) { - fakeNode = document.createElement("react"); - } - } - - function invokeGuardedCallbackImpl(name, func, context) { - { - // In DEV mode, we use a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // unintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - // fakeNode signifies we are in an environment with a document and window object - if (fakeNode) { - var evt = document.createEvent("Event"); - var didCall = false; // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - - var didError = true; // Keeps track of the value of window.event so that we can reset it - // during the callback to let user code access window.event in the - // browsers that support it. - - var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event - // dispatching: https://github.com/facebook/react/issues/13688 - - var windowEventDescriptor = Object.getOwnPropertyDescriptor( - window, - "event" - ); - - var restoreAfterDispatch = function () { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the - // window.event assignment in both IE <= 10 as they throw an error - // "Member not found" in strict mode, and in Firefox which does not - // support window.event. - - if ( - typeof window.event !== "undefined" && - window.hasOwnProperty("event") - ) { - window.event = windowEvent; - } - }; // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - // $FlowFixMe[method-unbinding] - - var _funcArgs = Array.prototype.slice.call(arguments, 3); - - var callCallback = function () { - didCall = true; - restoreAfterDispatch(); // $FlowFixMe[incompatible-call] Flow doesn't understand the arguments splicing. - - func.apply(context, _funcArgs); - didError = false; - }; // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - - var error; // Use this to track whether the error event is ever called. - - var didSetError = false; - var isCrossOriginError = false; - - var handleWindowError = function (event) { - error = event.error; - didSetError = true; - - if (error === null && event.colno === 0 && event.lineno === 0) { - isCrossOriginError = true; - } - - if (event.defaultPrevented) { - // Some other error handler has prevented default. - // Browsers silence the error report if this happens. - // We'll remember this to later decide whether to log it or not. - if (error != null && typeof error === "object") { - try { - error._suppressLogging = true; - } catch (inner) { - // Ignore. - } - } - } - }; // Create a fake event type. - - var evtType = "react-" + (name ? name : "invokeguardedcallback"); // Attach our event handlers - - window.addEventListener("error", handleWindowError); - fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); - - if (windowEventDescriptor) { - Object.defineProperty(window, "event", windowEventDescriptor); - } - - if (didCall && didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - // eslint-disable-next-line react-internal/prod-error-codes - error = new Error( - "An error was thrown inside one of your components, but React " + - "doesn't know what it was. This is likely due to browser " + - 'flakiness. React does its best to preserve the "Pause on ' + - 'exceptions" behavior of the DevTools, which requires some ' + - "DEV-mode only tricks. It's possible that these don't work in " + - "your browser. Try triggering the error in production mode, " + - "or switching to a modern browser. If you suspect that this is " + - "actually an issue with React, please file an issue." - ); - } else if (isCrossOriginError) { - // eslint-disable-next-line react-internal/prod-error-codes - error = new Error( - "A cross-origin error was thrown. React doesn't have access to " + - "the actual error object in development. " + - "See https://react.dev/link/crossorigin-error for more information." - ); - } - - this.onError(error); - } // Remove our event listeners - - window.removeEventListener("error", handleWindowError); - - if (didCall) { - return; - } else { - // Something went really wrong, and our event was not dispatched. - // https://github.com/facebook/react/issues/16734 - // https://github.com/facebook/react/issues/16585 - // Fall back to the production implementation. - restoreAfterDispatch(); // we fall through and call the prod version instead - } - } // We only get here if we are in an environment that either does not support the browser - // variant or we had trouble getting the browser to emit the error. - // $FlowFixMe[method-unbinding] - - var funcArgs = Array.prototype.slice.call(arguments, 3); - - try { - // $FlowFixMe[incompatible-call] Flow doesn't understand the arguments splicing. - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } - } - } - - var hasError = false; - var caughtError = null; // Used by event system to capture/rethrow the first error. - - var hasRethrowError = false; - var rethrowError = null; - var reporter = { - onError: function (error) { - hasError = true; - caughtError = error; - } - }; - /** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - - function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = false; - caughtError = null; - invokeGuardedCallbackImpl.apply(reporter, arguments); - } - /** - * Same as invokeGuardedCallback, but instead of returning an error, it stores - * it in a global so it can be rethrown by `rethrowCaughtError` later. - * TODO: See if caughtError and rethrowError can be unified. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - - function invokeGuardedCallbackAndCatchFirstError( - name, - func, - context, - a, - b, - c, - d, - e, - f - ) { - invokeGuardedCallback.apply(this, arguments); - - if (hasError) { - var error = clearCaughtError(); - - if (!hasRethrowError) { - hasRethrowError = true; - rethrowError = error; - } - } - } - /** - * During execution of guarded functions we will capture the first error which - * we will rethrow to be handled by the top level error handler. - */ - - function rethrowCaughtError() { - if (hasRethrowError) { - var error = rethrowError; - hasRethrowError = false; - rethrowError = null; - throw error; - } - } - function hasCaughtError() { - return hasError; - } - function clearCaughtError() { - if (hasError) { - var error = caughtError; - hasError = false; - caughtError = null; - return error; - } else { - throw new Error( - "clearCaughtError was called but no error was captured. This error " + - "is likely caused by a bug in React. Please file an issue." - ); - } - } - var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare function isArray(a) { return isArrayImpl(a); } + var hasError = false; + var caughtError = null; var getFiberCurrentPropsFromNode$1 = null; var getInstanceFromNode = null; var getNodeFromInstance = null; @@ -445,9 +167,17 @@ if (__DEV__) { */ function executeDispatch(event, listener, inst) { - var type = event.type || "unknown-event"; event.currentTarget = getNodeFromInstance(inst); - invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); + + try { + listener(event); + } catch (error) { + if (!hasError) { + hasError = true; + caughtError = error; + } + } + event.currentTarget = null; } /** @@ -560,6 +290,14 @@ if (__DEV__) { function hasDispatches(event) { return !!event._dispatchListeners; } + function rethrowCaughtError() { + if (hasError) { + var error = caughtError; + hasError = false; + caughtError = null; + throw error; + } + } var assign = Object.assign; @@ -6713,16 +6451,8 @@ to return true:wantsResponderID| | } var isHydrating = false; // This flag allows for warning supression when we expect there to be mismatches - // due to earlier mismatches or a suspended fiber. - - var didSuspendOrErrorDEV = false; // Hydration errors that were thrown inside this boundary var hydrationErrors = null; - function didSuspendOrErrorWhileHydratingDEV() { - { - return didSuspendOrErrorDEV; - } - } function prepareToHydrateHostInstance(fiber, hostContext) { { @@ -16647,25 +16377,8 @@ to return true:wantsResponderID| | if (true) { var source = errorInfo.source; var stack = errorInfo.stack; - var componentStack = stack !== null ? stack : ""; // Browsers support silencing uncaught errors by calling - // `preventDefault()` in window `error` handler. - // We record this information as an expando on the error. - - if (error != null && error._suppressLogging) { - if (boundary.tag === ClassComponent) { - // The error is recoverable and was silenced. - // Ignore it and don't print the stack addendum. - // This is handy for testing error boundaries without noise. - return; - } // The error is fatal. Since the silencing might have - // been accidental, we'll surface it anyway. - // However, the browser would have silenced the original error - // so we'll print it first, and then print the stack addendum. - - console["error"](error); // Don't transform to our wrapper - // For a more detailed description of this block, see: - // https://github.com/facebook/react/pull/13384 - } + var componentStack = stack !== null ? stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. + // See https://github.com/facebook/react/pull/13384 var componentName = source ? getComponentNameFromFiber(source) : null; var componentNameMessage = componentName @@ -16687,19 +16400,17 @@ to return true:wantsResponderID| | ("using the error boundary you provided, " + errorBoundaryName + "."); - } - - var combinedMessage = - componentNameMessage + - "\n" + - componentStack + - "\n\n" + - ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. - // We don't include the original error message and JS stack because the browser - // has already printed it. Even if the application swallows the error, it is still - // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. - - console["error"](combinedMessage); // Don't transform to our wrapper + } // In development, we provide our own message which includes the component stack + // in addition to the error. + + console["error"]( + // Don't transform to our wrapper + "%o\n\n%s\n%s\n\n%s", + error, + componentNameMessage, + componentStack, + errorBoundaryMessage + ); } } catch (e) { // This method must not throw, or React internal state will get messed up. @@ -20264,7 +19975,7 @@ to return true:wantsResponderID| | return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } - function beginWork$1(current, workInProgress, renderLanes) { + function beginWork(current, workInProgress, renderLanes) { { if (workInProgress._debugNeedsRemount && current !== null) { // This will restart the begin phase with a new fiber. @@ -22404,20 +22115,6 @@ to return true:wantsResponderID| | ); } - function reportUncaughtErrorInDEV(error) { - // Wrapping each small part of the commit phase into a guarded - // callback is a bit too slow (https://github.com/facebook/react/pull/21666). - // But we rely on it to surface errors to DEV tools like overlays - // (https://github.com/facebook/react/issues/21712). - // As a compromise, rethrow only caught errors in a guard. - { - invokeGuardedCallback(null, function () { - throw error; - }); - clearCaughtError(); - } - } - function callComponentWillUnmountWithTimer(current, instance) { instance.props = current.memoizedProps; instance.state = current.memoizedState; @@ -28623,7 +28320,6 @@ to return true:wantsResponderID| | error$1 ) { { - reportUncaughtErrorInDEV(error$1); setIsRunningInsertionEffect(false); } @@ -29127,81 +28823,6 @@ to return true:wantsResponderID| | } } } - var beginWork; - - { - var dummyFiber = null; - - beginWork = function (current, unitOfWork, lanes) { - // If a component throws an error, we replay it again in a synchronously - // dispatched event, so that the debugger will treat it as an uncaught - // error See ReactErrorUtils for more information. - // Before entering the begin phase, copy the work-in-progress onto a dummy - // fiber. If beginWork throws, we'll use this to reset the state. - var originalWorkInProgressCopy = assignFiberPropertiesInDEV( - dummyFiber, - unitOfWork - ); - - try { - return beginWork$1(current, unitOfWork, lanes); - } catch (originalError) { - if ( - didSuspendOrErrorWhileHydratingDEV() || - originalError === SuspenseException || - originalError === SelectiveHydrationException || - (originalError !== null && - typeof originalError === "object" && - typeof originalError.then === "function") - ) { - // Don't replay promises. - // Don't replay errors if we are hydrating and have already suspended or handled an error - throw originalError; - } // Don't reset current debug fiber, since we're about to work on the - // same fiber again. - // Unwind the failed stack frame - - resetSuspendedWorkLoopOnUnwind(unitOfWork); - unwindInterruptedWork(current, unitOfWork); // Restore the original properties of the fiber. - - assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); - - if (unitOfWork.mode & ProfileMode) { - // Reset the profiler timer. - startProfilerTimer(unitOfWork); - } // Run beginWork again. - - invokeGuardedCallback( - null, - beginWork$1, - null, - current, - unitOfWork, - lanes - ); - - if (hasCaughtError()) { - var replayError = clearCaughtError(); - - if ( - typeof replayError === "object" && - replayError !== null && - replayError._suppressLogging && - typeof originalError === "object" && - originalError !== null && - !originalError._suppressLogging - ) { - // If suppressed, let the flag carry over to the original error which is the one we'll rethrow. - originalError._suppressLogging = true; - } - } // We always throw the original error in case the second render pass is not idempotent. - // This can happen if a memoized function or CommonJS module doesn't throw after first invocation. - - throw originalError; - } - }; - } - var didWarnAboutUpdateInRender = false; var didWarnAboutUpdateInRenderForAnotherComponent; @@ -30448,55 +30069,6 @@ to return true:wantsResponderID| | implementation: portal.implementation }; return fiber; - } // Used for stashing WIP properties to replay failed work in DEV. - - function assignFiberPropertiesInDEV(target, source) { - if (target === null) { - // This Fiber's initial properties will always be overwritten. - // We only use a Fiber to ensure the same hidden class so DEV isn't slow. - target = createFiber(IndeterminateComponent, null, null, NoMode); - } // This is intentionally written as a list of all properties. - // We tried to use Object.assign() instead but this is called in - // the hottest path, and Object.assign() was too slow: - // https://github.com/facebook/react/issues/12502 - // This code is DEV-only so size is not a concern. - - target.tag = source.tag; - target.key = source.key; - target.elementType = source.elementType; - target.type = source.type; - target.stateNode = source.stateNode; - target.return = source.return; - target.child = source.child; - target.sibling = source.sibling; - target.index = source.index; - target.ref = source.ref; - target.refCleanup = source.refCleanup; - target.pendingProps = source.pendingProps; - target.memoizedProps = source.memoizedProps; - target.updateQueue = source.updateQueue; - target.memoizedState = source.memoizedState; - target.dependencies = source.dependencies; - target.mode = source.mode; - target.flags = source.flags; - target.subtreeFlags = source.subtreeFlags; - target.deletions = source.deletions; - target.lanes = source.lanes; - target.childLanes = source.childLanes; - target.alternate = source.alternate; - - { - target.actualDuration = source.actualDuration; - target.actualStartTime = source.actualStartTime; - target.selfBaseDuration = source.selfBaseDuration; - target.treeBaseDuration = source.treeBaseDuration; - } - - target._debugInfo = source._debugInfo; - target._debugOwner = source._debugOwner; - target._debugNeedsRemount = source._debugNeedsRemount; - target._debugHookTypes = source._debugHookTypes; - return target; } function FiberRootNode( @@ -30624,7 +30196,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-691a723b"; + var ReactVersion = "18.3.0-canary-93fa95a9"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index 1b548c4c2e763..5aff194c3c6d1 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<1d4631a2bcf4dccb86fbee6bdfbcb510>> + * @generated SignedSource<<9d687439b97b0b2fc1bf9b5fff32cc1b>> */ "use strict"; @@ -15,62 +15,20 @@ require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), React = require("react"), dynamicFlags = require("ReactNativeInternalFeatureFlags"), - Scheduler = require("scheduler"); -function invokeGuardedCallbackImpl(name, func, context) { - var funcArgs = Array.prototype.slice.call(arguments, 3); - try { - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } -} -var hasError = !1, + Scheduler = require("scheduler"), + isArrayImpl = Array.isArray, + hasError = !1, caughtError = null, - hasRethrowError = !1, - rethrowError = null, - reporter = { - onError: function (error) { - hasError = !0; - caughtError = error; - } - }; -function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = !1; - caughtError = null; - invokeGuardedCallbackImpl.apply(reporter, arguments); -} -function invokeGuardedCallbackAndCatchFirstError( - name, - func, - context, - a, - b, - c, - d, - e, - f -) { - invokeGuardedCallback.apply(this, arguments); - if (hasError) { - if (hasError) { - var error = caughtError; - hasError = !1; - caughtError = null; - } else - throw Error( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." - ); - hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); - } -} -var isArrayImpl = Array.isArray, getFiberCurrentPropsFromNode$1 = null, getInstanceFromNode = null, getNodeFromInstance = null; function executeDispatch(event, listener, inst) { - var type = event.type || "unknown-event"; event.currentTarget = getNodeFromInstance(inst); - invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event); + try { + listener(event); + } catch (error) { + hasError || ((hasError = !0), (caughtError = error)); + } event.currentTarget = null; } function executeDirectDispatch(event) { @@ -935,7 +893,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_261 = { +var injectedNamesToPlugins$jscomp$inline_258 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -981,32 +939,32 @@ var injectedNamesToPlugins$jscomp$inline_261 = { } } }, - isOrderingDirty$jscomp$inline_262 = !1, - pluginName$jscomp$inline_263; -for (pluginName$jscomp$inline_263 in injectedNamesToPlugins$jscomp$inline_261) + isOrderingDirty$jscomp$inline_259 = !1, + pluginName$jscomp$inline_260; +for (pluginName$jscomp$inline_260 in injectedNamesToPlugins$jscomp$inline_258) if ( - injectedNamesToPlugins$jscomp$inline_261.hasOwnProperty( - pluginName$jscomp$inline_263 + injectedNamesToPlugins$jscomp$inline_258.hasOwnProperty( + pluginName$jscomp$inline_260 ) ) { - var pluginModule$jscomp$inline_264 = - injectedNamesToPlugins$jscomp$inline_261[pluginName$jscomp$inline_263]; + var pluginModule$jscomp$inline_261 = + injectedNamesToPlugins$jscomp$inline_258[pluginName$jscomp$inline_260]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_263) || - namesToPlugins[pluginName$jscomp$inline_263] !== - pluginModule$jscomp$inline_264 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_260) || + namesToPlugins[pluginName$jscomp$inline_260] !== + pluginModule$jscomp$inline_261 ) { - if (namesToPlugins[pluginName$jscomp$inline_263]) + if (namesToPlugins[pluginName$jscomp$inline_260]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_263 + "`.") + (pluginName$jscomp$inline_260 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_263] = - pluginModule$jscomp$inline_264; - isOrderingDirty$jscomp$inline_262 = !0; + namesToPlugins[pluginName$jscomp$inline_260] = + pluginModule$jscomp$inline_261; + isOrderingDirty$jscomp$inline_259 = !0; } } -isOrderingDirty$jscomp$inline_262 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_259 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -1082,11 +1040,11 @@ function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." ); - if (hasRethrowError) + if (hasError) throw ( - ((JSCompiler_inline_result = rethrowError), - (hasRethrowError = !1), - (rethrowError = null), + ((JSCompiler_inline_result = caughtError), + (hasError = !1), + (caughtError = null), JSCompiler_inline_result) ); } @@ -6588,3731 +6546,3730 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } -var valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = - lastContextDependency = - currentlyRenderingFiber = - null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - context._currentValue = valueCursor.current; - 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 propagateContextChange(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) - throw Error( - "We just came from a parent so we must have had a parent. This is a bug in React." +function beginWork(current, workInProgress, renderLanes) { + if (null !== current) + if ( + current.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if ( + 0 === (current.lanes & renderLanes) && + 0 === (workInProgress.flags & 128) + ) + return ( + (didReceiveUpdate = !1), + attemptEarlyBailoutIfNoScheduledUpdate( + current, + workInProgress, + renderLanes + ) ); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } 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; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; + } + else didReceiveUpdate = !1; + workInProgress.lanes = 0; + switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor$1.current + ); + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + workInProgress.flags |= 1; + workInProgress.tag = 0; + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; + case 16: + Component = workInProgress.elementType; + a: { + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null)); -} -function readContext(context) { - return readContextForConsumer(currentlyRenderingFiber, context); -} -function readContextDuringReconcilation(consumer, context, renderLanes) { - null === currentlyRenderingFiber && - prepareToReadContext(consumer, renderLanes); - return readContextForConsumer(consumer, context); -} -function readContextForConsumer(consumer, context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === consumer) throw Error( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." ); - lastContextDependency = context; - consumer.dependencies = { lanes: 0, firstContext: context }; - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function () { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function (type, listener) { - listeners.push(listener); - } - }); - this.abort = function () { - signal.aborted = !0; - listeners.forEach(function (listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0 - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority, function () { - cache.controller.abort(); - }); -} -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; - null !== transition && transition._callbacks.add(handleAsyncAction); - return transition; -} -function handleAsyncAction(transition, thenable) { - enableAsyncActions && entangleAsyncAction(transition, thenable); -} -function notifyTransitionCallbacks(transition, returnValue) { - transition._callbacks.forEach(function (callback) { - return callback(transition, returnValue); - }); -} -var resumedCache = createCursor(null); -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: CacheContext._currentValue, pool: cacheFromPool }; -} -function scheduleRetryEffect(workInProgress, retryQueue) { - null !== retryQueue - ? (workInProgress.flags |= 4) - : workInProgress.flags & 16384 && - ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); -} -function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { - switch (renderState.tailMode) { - case "hidden": - hasRenderedATailFallback = renderState.tail; - for (var lastTailNode = null; null !== hasRenderedATailFallback; ) - null !== hasRenderedATailFallback.alternate && - (lastTailNode = hasRenderedATailFallback), - (hasRenderedATailFallback = hasRenderedATailFallback.sibling); - null === lastTailNode - ? (renderState.tail = null) - : (lastTailNode.sibling = null); - break; - case "collapsed": - lastTailNode = renderState.tail; - for (var lastTailNode$72 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$72 = lastTailNode), - (lastTailNode = lastTailNode.sibling); - null === lastTailNode$72 - ? hasRenderedATailFallback || null === renderState.tail - ? (renderState.tail = null) - : (renderState.tail.sibling = null) - : (lastTailNode$72.sibling = null); - } -} -function bubbleProperties(completedWork) { - var didBailout = - null !== completedWork.alternate && - completedWork.alternate.child === completedWork.child, - newChildLanes = 0, - subtreeFlags = 0; - if (didBailout) - for (var child$73 = completedWork.child; null !== child$73; ) - (newChildLanes |= child$73.lanes | child$73.childLanes), - (subtreeFlags |= child$73.subtreeFlags & 31457280), - (subtreeFlags |= child$73.flags & 31457280), - (child$73.return = completedWork), - (child$73 = child$73.sibling); - else - for (child$73 = completedWork.child; null !== child$73; ) - (newChildLanes |= child$73.lanes | child$73.childLanes), - (subtreeFlags |= child$73.subtreeFlags), - (subtreeFlags |= child$73.flags), - (child$73.return = completedWork), - (child$73 = child$73.sibling); - completedWork.subtreeFlags |= subtreeFlags; - completedWork.childLanes = newChildLanes; - return didBailout; -} -function completeWork(current, workInProgress, renderLanes) { - var newProps = workInProgress.pendingProps; - switch (workInProgress.tag) { - case 2: - case 16: - case 15: + } + return workInProgress; case 0: - case 11: - case 7: - case 8: - case 12: - case 9: - case 14: - return bubbleProperties(workInProgress), null; - case 1: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateFunctionComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 3: + case 1: return ( - (renderLanes = workInProgress.stateNode), - (newProps = null), - null !== current && (newProps = current.memoizedState.cache), - workInProgress.memoizedState.cache !== newProps && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - renderLanes.pendingContext && - ((renderLanes.context = renderLanes.pendingContext), - (renderLanes.pendingContext = null)), - (null !== current && null !== current.child) || - null === current || - (current.memoizedState.isDehydrated && - 0 === (workInProgress.flags & 256)) || - ((workInProgress.flags |= 1024), - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), - (hydrationErrors = null))), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateClassComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); + case 3: + pushHostRootContext(workInProgress); + if (null === current) + throw Error("Should have a current fiber. This is a bug in React."); + var nextProps = workInProgress.pendingProps; + context = workInProgress.memoizedState; + Component = context.element; + cloneUpdateQueue(current, workInProgress); + processUpdateQueue(workInProgress, nextProps, null, renderLanes); + nextProps = workInProgress.memoizedState; + var nextCache = nextProps.cache; + pushProvider(workInProgress, CacheContext, nextCache); + nextCache !== context.cache && + propagateContextChange(workInProgress, CacheContext, renderLanes); + suspendIfUpdateReadFromEntangledAsyncAction(); + context = nextProps.element; + context === Component + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + )) + : (reconcileChildren(current, workInProgress, context, renderLanes), + (workInProgress = workInProgress.child)); + return workInProgress; case 26: case 27: case 5: - popHostContext(workInProgress); - var type = workInProgress.type; - if (null !== current && null != workInProgress.stateNode) - current.memoizedProps !== newProps && (workInProgress.flags |= 4); - else { - if (!newProps) { - if (null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." - ); - bubbleProperties(workInProgress); - return null; - } - renderLanes = rootInstanceStackCursor.current; - current = allocateTag(); - type = getViewConfigForType(type); - var updatePayload = diffProperties( - null, - emptyObject$1, - newProps, - type.validAttributes - ); - ReactNativePrivateInterface.UIManager.createView( - current, - type.uiViewClassName, - renderLanes, - updatePayload - ); - renderLanes = new ReactNativeFiberHostComponent( + pushHostContext(workInProgress); + Component = workInProgress.pendingProps.children; + if (enableAsyncActions && null !== workInProgress.memoizedState) { + if (!enableAsyncActions) throw Error("Not implemented."); + context = renderWithHooks( current, - type, - workInProgress + workInProgress, + TransitionAwareHostComponent, + null, + null, + renderLanes ); - instanceCache.set(current, workInProgress); - instanceProps.set(current, newProps); - a: for (current = workInProgress.child; null !== current; ) { - if (5 === current.tag || 6 === current.tag) - renderLanes._children.push(current.stateNode); - else if (4 !== current.tag && null !== current.child) { - current.child.return = current; - current = current.child; - continue; - } - if (current === workInProgress) break a; - for (; null === current.sibling; ) { - if (null === current.return || current.return === workInProgress) - break a; - current = current.return; - } - current.sibling.return = current.return; - current = current.sibling; - } - workInProgress.stateNode = renderLanes; - finalizeInitialChildren(renderLanes) && (workInProgress.flags |= 4); - } - bubbleProperties(workInProgress); - workInProgress.flags &= -16777217; - return null; - case 6: - if (current && null != workInProgress.stateNode) - current.memoizedProps !== newProps && (workInProgress.flags |= 4); - else { - if ("string" !== typeof newProps && null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." - ); - current = rootInstanceStackCursor.current; - if (!contextStackCursor.current.isInAParentText) - throw Error( - "Text strings must be rendered within a component." + HostTransitionContext._currentValue = context; + didReceiveUpdate && + null !== current && + current.memoizedState.memoizedState !== context && + propagateContextChange( + workInProgress, + HostTransitionContext, + renderLanes ); - renderLanes = allocateTag(); - ReactNativePrivateInterface.UIManager.createView( - renderLanes, - "RCTRawText", - current, - { text: newProps } - ); - instanceCache.set(renderLanes, workInProgress); - workInProgress.stateNode = renderLanes; } - bubbleProperties(workInProgress); + markRef(current, workInProgress); + reconcileChildren(current, workInProgress, Component, renderLanes); + return workInProgress.child; + case 6: return null; case 13: - newProps = workInProgress.memoizedState; - if ( - null === current || - (null !== current.memoizedState && - null !== current.memoizedState.dehydrated) - ) { - if (null !== newProps && null !== newProps.dehydrated) { - if (null === current) { - throw Error( - "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." - ); - throw Error( - "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." - ); - } - 0 === (workInProgress.flags & 128) && - (workInProgress.memoizedState = null); - workInProgress.flags |= 4; - bubbleProperties(workInProgress); - type = !1; - } else - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), - (type = !0); - if (!type) { - if (workInProgress.flags & 256) - return popSuspenseHandler(workInProgress), workInProgress; - popSuspenseHandler(workInProgress); - return null; - } - } - popSuspenseHandler(workInProgress); - if (0 !== (workInProgress.flags & 128)) - return (workInProgress.lanes = renderLanes), workInProgress; - renderLanes = null !== newProps; - current = null !== current && null !== current.memoizedState; - renderLanes && - ((newProps = workInProgress.child), - (type = null), - null !== newProps.alternate && - null !== newProps.alternate.memoizedState && - null !== newProps.alternate.memoizedState.cachePool && - (type = newProps.alternate.memoizedState.cachePool.pool), - (updatePayload = null), - null !== newProps.memoizedState && - null !== newProps.memoizedState.cachePool && - (updatePayload = newProps.memoizedState.cachePool.pool), - updatePayload !== type && (newProps.flags |= 2048)); - renderLanes !== current && - renderLanes && - (workInProgress.child.flags |= 8192); - scheduleRetryEffect(workInProgress, workInProgress.updateQueue); - bubbleProperties(workInProgress); - return null; + return updateSuspenseComponent(current, workInProgress, renderLanes); case 4: - return popHostContainer(), bubbleProperties(workInProgress), null; - case 10: return ( - popProvider( - enableRenderableContext - ? workInProgress.type - : workInProgress.type._context + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo ), - bubbleProperties(workInProgress), - null + (Component = workInProgress.pendingProps), + null === current + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + Component, + renderLanes + )) + : reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child ); - case 17: + case 11: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateForwardRef( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 19: - pop(suspenseStackCursor); - type = workInProgress.memoizedState; - if (null === type) return bubbleProperties(workInProgress), null; - newProps = 0 !== (workInProgress.flags & 128); - updatePayload = type.rendering; - if (null === updatePayload) - if (newProps) cutOffTailIfNeeded(type, !1); - else { - if ( - 0 !== workInProgressRootExitStatus || - (null !== current && 0 !== (current.flags & 128)) - ) - for (current = workInProgress.child; null !== current; ) { - updatePayload = findFirstSuspended(current); - if (null !== updatePayload) { - workInProgress.flags |= 128; - cutOffTailIfNeeded(type, !1); - current = updatePayload.updateQueue; - workInProgress.updateQueue = current; - scheduleRetryEffect(workInProgress, current); - workInProgress.subtreeFlags = 0; - current = renderLanes; - for (renderLanes = workInProgress.child; null !== renderLanes; ) - resetWorkInProgress(renderLanes, current), - (renderLanes = renderLanes.sibling); - push( - suspenseStackCursor, - (suspenseStackCursor.current & 1) | 2 - ); - return workInProgress.child; - } - current = current.sibling; - } - null !== type.tail && - now() > workInProgressRootRenderTargetTime && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 4194304)); - } - else { - if (!newProps) - if ( - ((current = findFirstSuspended(updatePayload)), null !== current) - ) { - if ( - ((workInProgress.flags |= 128), - (newProps = !0), - (current = current.updateQueue), - (workInProgress.updateQueue = current), - scheduleRetryEffect(workInProgress, current), - cutOffTailIfNeeded(type, !0), - null === type.tail && - "hidden" === type.tailMode && - !updatePayload.alternate) - ) - return bubbleProperties(workInProgress), null; - } else - 2 * now() - type.renderingStartTime > - workInProgressRootRenderTargetTime && - 536870912 !== renderLanes && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 4194304)); - type.isBackwards - ? ((updatePayload.sibling = workInProgress.child), - (workInProgress.child = updatePayload)) - : ((current = type.last), - null !== current - ? (current.sibling = updatePayload) - : (workInProgress.child = updatePayload), - (type.last = updatePayload)); - } - if (null !== type.tail) - return ( - (workInProgress = type.tail), - (type.rendering = workInProgress), - (type.tail = workInProgress.sibling), - (type.renderingStartTime = now()), - (workInProgress.sibling = null), - (current = suspenseStackCursor.current), - push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), - workInProgress - ); - bubbleProperties(workInProgress); - return null; - case 22: - case 23: + case 7: return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - (newProps = null !== workInProgress.memoizedState), - null !== current - ? (null !== current.memoizedState) !== newProps && - (workInProgress.flags |= 8192) - : newProps && (workInProgress.flags |= 8192), - newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 536870912) && - 0 === (workInProgress.flags & 128) && - (bubbleProperties(workInProgress), - workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) - : bubbleProperties(workInProgress), - (renderLanes = workInProgress.updateQueue), - null !== renderLanes && - scheduleRetryEffect(workInProgress, renderLanes.retryQueue), - (renderLanes = null), - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (renderLanes = current.memoizedState.cachePool.pool), - (newProps = null), - null !== workInProgress.memoizedState && - null !== workInProgress.memoizedState.cachePool && - (newProps = workInProgress.memoizedState.cachePool.pool), - newProps !== renderLanes && (workInProgress.flags |= 2048), - null !== current && pop(resumedCache), - null + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps, + renderLanes + ), + workInProgress.child ); - case 24: + case 8: return ( - (renderLanes = null), - null !== current && (renderLanes = current.memoizedState.cache), - workInProgress.memoizedState.cache !== renderLanes && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - bubbleProperties(workInProgress), - null + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child ); - case 25: - return null; - } - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); -} -function unwindWork(current, workInProgress) { - switch (workInProgress.tag) { - case 1: + case 12: return ( - isContextProvider(workInProgress.type) && popContext(), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child ); - case 3: + case 10: + a: { + Component = enableRenderableContext + ? workInProgress.type + : workInProgress.type._context; + context = workInProgress.pendingProps; + nextProps = workInProgress.memoizedProps; + nextCache = context.value; + pushProvider(workInProgress, Component, nextCache); + if (null !== nextProps) + if (objectIs(nextProps.value, nextCache)) { + if ( + nextProps.children === context.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + ); + break a; + } + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes + ); + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: return ( - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - (current = workInProgress.flags), - 0 !== (current & 65536) && 0 === (current & 128) - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null + (context = enableRenderableContext + ? workInProgress.type._context + : workInProgress.type), + (Component = workInProgress.pendingProps.children), + prepareToReadContext(workInProgress, renderLanes), + (context = readContext(context)), + (Component = Component(context)), + (workInProgress.flags |= 1), + reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child ); - case 26: - case 27: - case 5: - return popHostContext(workInProgress), null; - case 13: - popSuspenseHandler(workInProgress); - current = workInProgress.memoizedState; - if ( - null !== current && - null !== current.dehydrated && - null === workInProgress.alternate - ) - throw Error( - "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." - ); - current = workInProgress.flags; - return current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null; - case 19: - return pop(suspenseStackCursor), null; - case 4: - return popHostContainer(), null; - case 10: + case 14: return ( - popProvider( - enableRenderableContext - ? workInProgress.type - : workInProgress.type._context - ), - null + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), + updateMemoComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 22: - case 23: + case 15: + return updateSimpleMemoComponent( + current, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + renderLanes + ); + case 17: return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - null !== current && pop(resumedCache), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), + (workInProgress.tag = 1), + isContextProvider(Component) + ? ((current = !0), pushContextProvider(workInProgress)) + : (current = !1), + prepareToReadContext(workInProgress, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), + finishClassComponent( + null, + workInProgress, + Component, + !0, + current, + renderLanes + ) ); - case 24: - return popProvider(CacheContext), null; - case 25: - return null; - default: - return null; - } -} -function unwindInterruptedWork(current, interruptedWork) { - switch (interruptedWork.tag) { - case 1: - current = interruptedWork.type.childContextTypes; - null !== current && void 0 !== current && popContext(); - break; - case 3: - popProvider(CacheContext); - popHostContainer(); - pop(didPerformWorkStackCursor); - pop(contextStackCursor$1); - break; - case 26: - case 27: - case 5: - popHostContext(interruptedWork); - break; - case 4: - popHostContainer(); - break; - case 13: - popSuspenseHandler(interruptedWork); - break; case 19: - pop(suspenseStackCursor); - break; - case 10: - popProvider( - enableRenderableContext - ? interruptedWork.type - : interruptedWork.type._context - ); - break; + return updateSuspenseListComponent(current, workInProgress, renderLanes); case 22: - case 23: - popSuspenseHandler(interruptedWork); - popHiddenContext(); - null !== current && pop(resumedCache); - break; + return updateOffscreenComponent(current, workInProgress, renderLanes); case 24: - popProvider(CacheContext); - } -} -var offscreenSubtreeIsHidden = !1, - offscreenSubtreeWasHidden = !1, - PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, - nextEffect = null; -function safelyAttachRef(current, nearestMountedAncestor) { - try { - var ref = current.ref; - if (null !== ref) { - var instance = current.stateNode; - switch (current.tag) { - case 26: - case 27: - case 5: - var instanceToUse = getPublicInstance(instance); - break; - default: - instanceToUse = instance; - } - "function" === typeof ref - ? (current.refCleanup = ref(instanceToUse)) - : (ref.current = instanceToUse); - } - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); + return ( + prepareToReadContext(workInProgress, renderLanes), + (Component = readContext(CacheContext)), + null === current + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), + (nextProps = createCache()), + (context.pooledCache = nextProps), + nextProps.refCount++, + null !== nextProps && (context.pooledCacheLanes |= renderLanes), + (context = nextProps)), + (workInProgress.memoizedState = { + parent: Component, + cache: context + }), + initializeUpdateQueue(workInProgress), + pushProvider(workInProgress, CacheContext, context)) + : (0 !== (current.lanes & renderLanes) && + (cloneUpdateQueue(current, workInProgress), + processUpdateQueue(workInProgress, null, null, renderLanes), + suspendIfUpdateReadFromEntangledAsyncAction()), + (context = current.memoizedState), + (nextProps = workInProgress.memoizedState), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), + 0 === workInProgress.lanes && + (workInProgress.memoizedState = + workInProgress.updateQueue.baseState = + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = nextProps.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && + propagateContextChange( + workInProgress, + CacheContext, + renderLanes + ))), + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); } + throw Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in React. Please file an issue." + ); } -function safelyDetachRef(current, nearestMountedAncestor) { - var ref = current.ref, - refCleanup = current.refCleanup; - if (null !== ref) - if ("function" === typeof refCleanup) - try { - refCleanup(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } finally { - (current.refCleanup = null), - (current = current.alternate), - null != current && (current.refCleanup = null); - } - else if ("function" === typeof ref) - try { - ref(null); - } catch (error$95) { - captureCommitPhaseError(current, nearestMountedAncestor, error$95); - } - else ref.current = null; +var valueCursor = createCursor(null), + currentlyRenderingFiber = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = + lastContextDependency = + currentlyRenderingFiber = + null; } -function safelyCallDestroy(current, nearestMountedAncestor, destroy) { - try { - destroy(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; +} +function popProvider(context) { + context._currentValue = valueCursor.current; + 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; } } -var shouldFireAfterActiveInstanceBlur = !1; -function commitBeforeMutationEffects(root, firstChild) { - for (nextEffect = firstChild; null !== nextEffect; ) - if ( - ((root = nextEffect), - (firstChild = root.child), - 0 !== (root.subtreeFlags & 1028) && null !== firstChild) - ) - (firstChild.return = root), (nextEffect = firstChild); - else - for (; null !== nextEffect; ) { - root = nextEffect; - try { - var current = root.alternate, - flags = root.flags; - switch (root.tag) { - case 0: - break; - case 11: - case 15: - break; - case 1: - if (0 !== (flags & 1024) && null !== current) { - var prevProps = current.memoizedProps, - prevState = current.memoizedState, - instance = root.stateNode, - snapshot = instance.getSnapshotBeforeUpdate( - root.elementType === root.type - ? prevProps - : resolveDefaultProps(root.type, prevProps), - prevState - ); - instance.__reactInternalSnapshotBeforeUpdate = snapshot; - } - break; - case 3: - break; - case 5: - case 26: - case 27: - case 6: - case 4: - case 17: - break; - default: - if (0 !== (flags & 1024)) - throw Error( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." - ); +function propagateContextChange(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } } - } catch (error) { - captureCommitPhaseError(root, root.return, error); - } - firstChild = root.sibling; - if (null !== firstChild) { - firstChild.return = root.return; - nextEffect = firstChild; + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; break; } - nextEffect = root.return; + dependency = dependency.next; } - current = shouldFireAfterActiveInstanceBlur; - shouldFireAfterActiveInstanceBlur = !1; - return current; -} -function commitHookEffectListUnmount( - flags, - finishedWork, - nearestMountedAncestor -) { - var updateQueue = finishedWork.updateQueue; - updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; - if (null !== updateQueue) { - var effect = (updateQueue = updateQueue.next); - do { - if ((effect.tag & flags) === flags) { - var inst = effect.inst, - destroy = inst.destroy; - void 0 !== destroy && - ((inst.destroy = void 0), - safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy)); + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) + throw Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } 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; } - effect = effect.next; - } while (effect !== updateQueue); + fiber = nextFiber; } } -function commitHookEffectListMount(flags, finishedWork) { - finishedWork = finishedWork.updateQueue; - finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; - if (null !== finishedWork) { - var effect = (finishedWork = finishedWork.next); - do { - if ((effect.tag & flags) === flags) { - var create$96 = effect.create, - inst = effect.inst; - create$96 = create$96(); - inst.destroy = create$96; - } - effect = effect.next; - } while (effect !== finishedWork); - } +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); } -function commitHookLayoutEffects(finishedWork, hookFlags) { - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } +function readContext(context) { + return readContextForConsumer(currentlyRenderingFiber, context); } -function commitClassCallbacks(finishedWork) { - var updateQueue = finishedWork.updateQueue; - if (null !== updateQueue) { - var instance = finishedWork.stateNode; - try { - commitCallbacks(updateQueue, instance); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } +function readContextDuringReconcilation(consumer, context, renderLanes) { + null === currentlyRenderingFiber && + prepareToReadContext(consumer, renderLanes); + return readContextForConsumer(consumer, context); +} +function readContextForConsumer(consumer, context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) + if ( + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function () { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function (type, listener) { + listeners.push(listener); + } + }); + this.abort = function () { + signal.aborted = !0; + listeners.forEach(function (listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0 + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; +} +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority, function () { + cache.controller.abort(); + }); +} +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +function requestCurrentTransition() { + var transition = ReactCurrentBatchConfig$1.transition; + null !== transition && transition._callbacks.add(handleAsyncAction); + return transition; +} +function handleAsyncAction(transition, thenable) { + enableAsyncActions && entangleAsyncAction(transition, thenable); +} +function notifyTransitionCallbacks(transition, returnValue) { + transition._callbacks.forEach(function (callback) { + return callback(transition, returnValue); + }); +} +var resumedCache = createCursor(null); +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: CacheContext._currentValue, pool: cacheFromPool }; +} +function scheduleRetryEffect(workInProgress, retryQueue) { + null !== retryQueue + ? (workInProgress.flags |= 4) + : workInProgress.flags & 16384 && + ((retryQueue = + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), + (workInProgress.lanes |= retryQueue)); +} +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var lastTailNode$72 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$72 = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === lastTailNode$72 + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (lastTailNode$72.sibling = null); } } -function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { - var flags = finishedWork.flags; - switch (finishedWork.tag) { +function bubbleProperties(completedWork) { + var didBailout = + null !== completedWork.alternate && + completedWork.alternate.child === completedWork.child, + newChildLanes = 0, + subtreeFlags = 0; + if (didBailout) + for (var child$73 = completedWork.child; null !== child$73; ) + (newChildLanes |= child$73.lanes | child$73.childLanes), + (subtreeFlags |= child$73.subtreeFlags & 31457280), + (subtreeFlags |= child$73.flags & 31457280), + (child$73.return = completedWork), + (child$73 = child$73.sibling); + else + for (child$73 = completedWork.child; null !== child$73; ) + (newChildLanes |= child$73.lanes | child$73.childLanes), + (subtreeFlags |= child$73.subtreeFlags), + (subtreeFlags |= child$73.flags), + (child$73.return = completedWork), + (child$73 = child$73.sibling); + completedWork.subtreeFlags |= subtreeFlags; + completedWork.childLanes = newChildLanes; + return didBailout; +} +function completeWork(current, workInProgress, renderLanes) { + var newProps = workInProgress.pendingProps; + switch (workInProgress.tag) { + case 2: + case 16: + case 15: case 0: case 11: - case 15: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 4 && commitHookLayoutEffects(finishedWork, 5); - break; + case 7: + case 8: + case 12: + case 9: + case 14: + return bubbleProperties(workInProgress), null; case 1: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 4) - if (((finishedRoot = finishedWork.stateNode), null === current)) - try { - finishedRoot.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - else { - var prevProps = - finishedWork.elementType === finishedWork.type - ? current.memoizedProps - : resolveDefaultProps(finishedWork.type, current.memoizedProps); - current = current.memoizedState; - try { - finishedRoot.componentDidUpdate( - prevProps, - current, - finishedRoot.__reactInternalSnapshotBeforeUpdate - ); - } catch (error$97) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$97 - ); - } - } - flags & 64 && commitClassCallbacks(finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; + return ( + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null + ); case 3: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { - finishedRoot = null; - if (null !== finishedWork.child) - switch (finishedWork.child.tag) { - case 27: - case 5: - finishedRoot = getPublicInstance(finishedWork.child.stateNode); - break; - case 1: - finishedRoot = finishedWork.child.stateNode; - } - try { - commitCallbacks(flags, finishedRoot); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - } - break; + return ( + (renderLanes = workInProgress.stateNode), + (newProps = null), + null !== current && (newProps = current.memoizedState.cache), + workInProgress.memoizedState.cache !== newProps && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + renderLanes.pendingContext && + ((renderLanes.context = renderLanes.pendingContext), + (renderLanes.pendingContext = null)), + (null !== current && null !== current.child) || + null === current || + (current.memoizedState.isDehydrated && + 0 === (workInProgress.flags & 256)) || + ((workInProgress.flags |= 1024), + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), + (hydrationErrors = null))), + bubbleProperties(workInProgress), + null + ); case 26: case 27: case 5: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - break; + popHostContext(workInProgress); + var type = workInProgress.type; + if (null !== current && null != workInProgress.stateNode) + current.memoizedProps !== newProps && (workInProgress.flags |= 4); + else { + if (!newProps) { + if (null === workInProgress.stateNode) + throw Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ); + bubbleProperties(workInProgress); + return null; + } + renderLanes = rootInstanceStackCursor.current; + current = allocateTag(); + type = getViewConfigForType(type); + var updatePayload = diffProperties( + null, + emptyObject$1, + newProps, + type.validAttributes + ); + ReactNativePrivateInterface.UIManager.createView( + current, + type.uiViewClassName, + renderLanes, + updatePayload + ); + renderLanes = new ReactNativeFiberHostComponent( + current, + type, + workInProgress + ); + instanceCache.set(current, workInProgress); + instanceProps.set(current, newProps); + a: for (current = workInProgress.child; null !== current; ) { + if (5 === current.tag || 6 === current.tag) + renderLanes._children.push(current.stateNode); + else if (4 !== current.tag && null !== current.child) { + current.child.return = current; + current = current.child; + continue; + } + if (current === workInProgress) break a; + for (; null === current.sibling; ) { + if (null === current.return || current.return === workInProgress) + break a; + current = current.return; + } + current.sibling.return = current.return; + current = current.sibling; + } + workInProgress.stateNode = renderLanes; + finalizeInitialChildren(renderLanes) && (workInProgress.flags |= 4); + } + bubbleProperties(workInProgress); + workInProgress.flags &= -16777217; + return null; + case 6: + if (current && null != workInProgress.stateNode) + current.memoizedProps !== newProps && (workInProgress.flags |= 4); + else { + if ("string" !== typeof newProps && null === workInProgress.stateNode) + throw Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ); + current = rootInstanceStackCursor.current; + if (!contextStackCursor.current.isInAParentText) + throw Error( + "Text strings must be rendered within a component." + ); + renderLanes = allocateTag(); + ReactNativePrivateInterface.UIManager.createView( + renderLanes, + "RCTRawText", + current, + { text: newProps } + ); + instanceCache.set(renderLanes, workInProgress); + workInProgress.stateNode = renderLanes; + } + bubbleProperties(workInProgress); + return null; case 13: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - break; - case 22: - if (0 !== (finishedWork.mode & 1)) { - if ( - ((prevProps = - null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), - !prevProps) - ) { - current = - (null !== current && null !== current.memoizedState) || - offscreenSubtreeWasHidden; - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevProps; - (offscreenSubtreeWasHidden = current) && - !prevOffscreenSubtreeWasHidden - ? recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - 0 !== (finishedWork.subtreeFlags & 8772) - ) - : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + newProps = workInProgress.memoizedState; + if ( + null === current || + (null !== current.memoizedState && + null !== current.memoizedState.dehydrated) + ) { + if (null !== newProps && null !== newProps.dehydrated) { + if (null === current) { + throw Error( + "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + ); + throw Error( + "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ); + } + 0 === (workInProgress.flags & 128) && + (workInProgress.memoizedState = null); + workInProgress.flags |= 4; + bubbleProperties(workInProgress); + type = !1; + } else + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), + (type = !0); + if (!type) { + if (workInProgress.flags & 256) + return popSuspenseHandler(workInProgress), workInProgress; + popSuspenseHandler(workInProgress); + return null; } - } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 512 && - ("manual" === finishedWork.memoizedProps.mode - ? safelyAttachRef(finishedWork, finishedWork.return) - : safelyDetachRef(finishedWork, finishedWork.return)); - break; - default: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - } -} -function detachFiberAfterEffects(fiber) { - var alternate = fiber.alternate; - null !== alternate && - ((fiber.alternate = null), detachFiberAfterEffects(alternate)); - fiber.child = null; - fiber.deletions = null; - fiber.sibling = null; - fiber.stateNode = null; - fiber.return = null; - fiber.dependencies = null; - fiber.memoizedProps = null; - fiber.memoizedState = null; - fiber.pendingProps = null; - fiber.stateNode = null; - fiber.updateQueue = null; -} -function isHostParent(fiber) { - return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; -} -function getHostSibling(fiber) { - a: for (;;) { - for (; null === fiber.sibling; ) { - if (null === fiber.return || isHostParent(fiber.return)) return null; - fiber = fiber.return; - } - fiber.sibling.return = fiber.return; - for ( - fiber = fiber.sibling; - 5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag; - - ) { - if (fiber.flags & 2) continue a; - if (null === fiber.child || 4 === fiber.tag) continue a; - else (fiber.child.return = fiber), (fiber = fiber.child); - } - if (!(fiber.flags & 2)) return fiber.stateNode; - } -} -function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { - var tag = node.tag; - if (5 === tag || 6 === tag) - if (((node = node.stateNode), before)) { - if ("number" === typeof parent) - throw Error("Container does not support insertBefore operation"); - } else - ReactNativePrivateInterface.UIManager.setChildren(parent, [ - "number" === typeof node ? node : node._nativeTag - ]); - else if (4 !== tag && ((node = node.child), null !== node)) - for ( - insertOrAppendPlacementNodeIntoContainer(node, before, parent), - node = node.sibling; - null !== node; - - ) - insertOrAppendPlacementNodeIntoContainer(node, before, parent), - (node = node.sibling); -} -function insertOrAppendPlacementNode(node, before, parent) { - var tag = node.tag; - if (5 === tag || 6 === tag) - if (((node = node.stateNode), before)) { - tag = parent._children; - var index = tag.indexOf(node); - 0 <= index - ? (tag.splice(index, 1), - (before = tag.indexOf(before)), - tag.splice(before, 0, node), - ReactNativePrivateInterface.UIManager.manageChildren( - parent._nativeTag, - [index], - [before], - [], - [], - [] - )) - : ((before = tag.indexOf(before)), - tag.splice(before, 0, node), - ReactNativePrivateInterface.UIManager.manageChildren( - parent._nativeTag, - [], - [], - ["number" === typeof node ? node : node._nativeTag], - [before], - [] - )); - } else - (before = "number" === typeof node ? node : node._nativeTag), - (tag = parent._children), - (index = tag.indexOf(node)), - 0 <= index - ? (tag.splice(index, 1), - tag.push(node), - ReactNativePrivateInterface.UIManager.manageChildren( - parent._nativeTag, - [index], - [tag.length - 1], - [], - [], - [] - )) - : (tag.push(node), - ReactNativePrivateInterface.UIManager.manageChildren( - parent._nativeTag, - [], - [], - [before], - [tag.length - 1], - [] - )); - else if (4 !== tag && ((node = node.child), null !== node)) - for ( - insertOrAppendPlacementNode(node, before, parent), node = node.sibling; - null !== node; - - ) - insertOrAppendPlacementNode(node, before, parent), (node = node.sibling); -} -var hostParent = null, - hostParentIsContainer = !1; -function recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - parent -) { - for (parent = parent.child; null !== parent; ) - commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), - (parent = parent.sibling); -} -function commitDeletionEffectsOnFiber( - finishedRoot, - nearestMountedAncestor, - deletedFiber -) { - if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) - try { - injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); - } catch (err) {} - switch (deletedFiber.tag) { - case 26: - case 27: - case 5: - offscreenSubtreeWasHidden || - safelyDetachRef(deletedFiber, nearestMountedAncestor); - case 6: - var prevHostParent = hostParent, - prevHostParentIsContainer = hostParentIsContainer; - hostParent = null; - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - hostParent = prevHostParent; - hostParentIsContainer = prevHostParentIsContainer; - null !== hostParent && - (hostParentIsContainer - ? ((finishedRoot = hostParent), - recursivelyUncacheFiberNode(deletedFiber.stateNode), - ReactNativePrivateInterface.UIManager.manageChildren( - finishedRoot, - [], - [], - [], - [], - [0] - )) - : ((finishedRoot = hostParent), - (nearestMountedAncestor = deletedFiber.stateNode), - recursivelyUncacheFiberNode(nearestMountedAncestor), - (deletedFiber = finishedRoot._children), - (nearestMountedAncestor = deletedFiber.indexOf( - nearestMountedAncestor - )), - deletedFiber.splice(nearestMountedAncestor, 1), - ReactNativePrivateInterface.UIManager.manageChildren( - finishedRoot._nativeTag, - [], - [], - [], - [], - [nearestMountedAncestor] - ))); - break; - case 18: - null !== hostParent && shim$1(); - break; + } + popSuspenseHandler(workInProgress); + if (0 !== (workInProgress.flags & 128)) + return (workInProgress.lanes = renderLanes), workInProgress; + renderLanes = null !== newProps; + current = null !== current && null !== current.memoizedState; + renderLanes && + ((newProps = workInProgress.child), + (type = null), + null !== newProps.alternate && + null !== newProps.alternate.memoizedState && + null !== newProps.alternate.memoizedState.cachePool && + (type = newProps.alternate.memoizedState.cachePool.pool), + (updatePayload = null), + null !== newProps.memoizedState && + null !== newProps.memoizedState.cachePool && + (updatePayload = newProps.memoizedState.cachePool.pool), + updatePayload !== type && (newProps.flags |= 2048)); + renderLanes !== current && + renderLanes && + (workInProgress.child.flags |= 8192); + scheduleRetryEffect(workInProgress, workInProgress.updateQueue); + bubbleProperties(workInProgress); + return null; case 4: - prevHostParent = hostParent; - prevHostParentIsContainer = hostParentIsContainer; - hostParent = deletedFiber.stateNode.containerInfo; - hostParentIsContainer = !0; - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber + return popHostContainer(), bubbleProperties(workInProgress), null; + case 10: + return ( + popProvider( + enableRenderableContext + ? workInProgress.type + : workInProgress.type._context + ), + bubbleProperties(workInProgress), + null ); - hostParent = prevHostParent; - hostParentIsContainer = prevHostParentIsContainer; - break; - case 0: - case 11: - case 14: - case 15: - if ( - !offscreenSubtreeWasHidden && - ((prevHostParent = deletedFiber.updateQueue), - null !== prevHostParent && - ((prevHostParent = prevHostParent.lastEffect), - null !== prevHostParent)) - ) { - prevHostParentIsContainer = prevHostParent = prevHostParent.next; - do { - var tag = prevHostParentIsContainer.tag, - inst = prevHostParentIsContainer.inst, - destroy = inst.destroy; - void 0 !== destroy && - (0 !== (tag & 2) - ? ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - )) - : 0 !== (tag & 4) && - ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - ))); - prevHostParentIsContainer = prevHostParentIsContainer.next; - } while (prevHostParentIsContainer !== prevHostParent); - } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber + case 17: + return ( + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null ); - break; - case 1: - if ( - !offscreenSubtreeWasHidden && - (safelyDetachRef(deletedFiber, nearestMountedAncestor), - (prevHostParent = deletedFiber.stateNode), - "function" === typeof prevHostParent.componentWillUnmount) - ) - try { - (prevHostParent.props = deletedFiber.memoizedProps), - (prevHostParent.state = deletedFiber.memoizedState), - prevHostParent.componentWillUnmount(); - } catch (error) { - captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); + case 19: + pop(suspenseStackCursor); + type = workInProgress.memoizedState; + if (null === type) return bubbleProperties(workInProgress), null; + newProps = 0 !== (workInProgress.flags & 128); + updatePayload = type.rendering; + if (null === updatePayload) + if (newProps) cutOffTailIfNeeded(type, !1); + else { + if ( + 0 !== workInProgressRootExitStatus || + (null !== current && 0 !== (current.flags & 128)) + ) + for (current = workInProgress.child; null !== current; ) { + updatePayload = findFirstSuspended(current); + if (null !== updatePayload) { + workInProgress.flags |= 128; + cutOffTailIfNeeded(type, !1); + current = updatePayload.updateQueue; + workInProgress.updateQueue = current; + scheduleRetryEffect(workInProgress, current); + workInProgress.subtreeFlags = 0; + current = renderLanes; + for (renderLanes = workInProgress.child; null !== renderLanes; ) + resetWorkInProgress(renderLanes, current), + (renderLanes = renderLanes.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & 1) | 2 + ); + return workInProgress.child; + } + current = current.sibling; + } + null !== type.tail && + now() > workInProgressRootRenderTargetTime && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(type, !1), + (workInProgress.lanes = 4194304)); } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - case 21: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; + else { + if (!newProps) + if ( + ((current = findFirstSuspended(updatePayload)), null !== current) + ) { + if ( + ((workInProgress.flags |= 128), + (newProps = !0), + (current = current.updateQueue), + (workInProgress.updateQueue = current), + scheduleRetryEffect(workInProgress, current), + cutOffTailIfNeeded(type, !0), + null === type.tail && + "hidden" === type.tailMode && + !updatePayload.alternate) + ) + return bubbleProperties(workInProgress), null; + } else + 2 * now() - type.renderingStartTime > + workInProgressRootRenderTargetTime && + 536870912 !== renderLanes && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(type, !1), + (workInProgress.lanes = 4194304)); + type.isBackwards + ? ((updatePayload.sibling = workInProgress.child), + (workInProgress.child = updatePayload)) + : ((current = type.last), + null !== current + ? (current.sibling = updatePayload) + : (workInProgress.child = updatePayload), + (type.last = updatePayload)); + } + if (null !== type.tail) + return ( + (workInProgress = type.tail), + (type.rendering = workInProgress), + (type.tail = workInProgress.sibling), + (type.renderingStartTime = now()), + (workInProgress.sibling = null), + (current = suspenseStackCursor.current), + push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), + workInProgress + ); + bubbleProperties(workInProgress); + return null; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); - deletedFiber.mode & 1 - ? ((offscreenSubtreeWasHidden = - (prevHostParent = offscreenSubtreeWasHidden) || - null !== deletedFiber.memoizedState), - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ), - (offscreenSubtreeWasHidden = prevHostParent)) - : recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - break; - default: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber + case 23: + return ( + popSuspenseHandler(workInProgress), + popHiddenContext(), + (newProps = null !== workInProgress.memoizedState), + null !== current + ? (null !== current.memoizedState) !== newProps && + (workInProgress.flags |= 8192) + : newProps && (workInProgress.flags |= 8192), + newProps && 0 !== (workInProgress.mode & 1) + ? 0 !== (renderLanes & 536870912) && + 0 === (workInProgress.flags & 128) && + (bubbleProperties(workInProgress), + workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) + : bubbleProperties(workInProgress), + (renderLanes = workInProgress.updateQueue), + null !== renderLanes && + scheduleRetryEffect(workInProgress, renderLanes.retryQueue), + (renderLanes = null), + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (renderLanes = current.memoizedState.cachePool.pool), + (newProps = null), + null !== workInProgress.memoizedState && + null !== workInProgress.memoizedState.cachePool && + (newProps = workInProgress.memoizedState.cachePool.pool), + newProps !== renderLanes && (workInProgress.flags |= 2048), + null !== current && pop(resumedCache), + null + ); + case 24: + return ( + (renderLanes = null), + null !== current && (renderLanes = current.memoizedState.cache), + workInProgress.memoizedState.cache !== renderLanes && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + bubbleProperties(workInProgress), + null ); + case 25: + return null; } + throw Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in React. Please file an issue." + ); } -function getRetryCache(finishedWork) { - switch (finishedWork.tag) { +function unwindWork(current, workInProgress) { + switch (workInProgress.tag) { + case 1: + return ( + isContextProvider(workInProgress.type) && popContext(), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null + ); + case 3: + return ( + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + (current = workInProgress.flags), + 0 !== (current & 65536) && 0 === (current & 128) + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null + ); + case 26: + case 27: + case 5: + return popHostContext(workInProgress), null; case 13: + popSuspenseHandler(workInProgress); + current = workInProgress.memoizedState; + if ( + null !== current && + null !== current.dehydrated && + null === workInProgress.alternate + ) + throw Error( + "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." + ); + current = workInProgress.flags; + return current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null; case 19: - var retryCache = finishedWork.stateNode; - null === retryCache && - (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); - return retryCache; + return pop(suspenseStackCursor), null; + case 4: + return popHostContainer(), null; + case 10: + return ( + popProvider( + enableRenderableContext + ? workInProgress.type + : workInProgress.type._context + ), + null + ); case 22: + case 23: return ( - (finishedWork = finishedWork.stateNode), - (retryCache = finishedWork._retryCache), - null === retryCache && - (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), - retryCache + popSuspenseHandler(workInProgress), + popHiddenContext(), + null !== current && pop(resumedCache), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null ); + case 24: + return popProvider(CacheContext), null; + case 25: + return null; default: - throw Error( - "Unexpected Suspense handler tag (" + - finishedWork.tag + - "). This is a bug in React." - ); + return null; } } -function attachSuspenseRetryListeners(finishedWork, wakeables) { - var retryCache = getRetryCache(finishedWork); - wakeables.forEach(function (wakeable) { - var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); - retryCache.has(wakeable) || - (retryCache.add(wakeable), wakeable.then(retry, retry)); - }); +function unwindInterruptedWork(current, interruptedWork) { + switch (interruptedWork.tag) { + case 1: + current = interruptedWork.type.childContextTypes; + null !== current && void 0 !== current && popContext(); + break; + case 3: + popProvider(CacheContext); + popHostContainer(); + pop(didPerformWorkStackCursor); + pop(contextStackCursor$1); + break; + case 26: + case 27: + case 5: + popHostContext(interruptedWork); + break; + case 4: + popHostContainer(); + break; + case 13: + popSuspenseHandler(interruptedWork); + break; + case 19: + pop(suspenseStackCursor); + break; + case 10: + popProvider( + enableRenderableContext + ? interruptedWork.type + : interruptedWork.type._context + ); + break; + case 22: + case 23: + popSuspenseHandler(interruptedWork); + popHiddenContext(); + null !== current && pop(resumedCache); + break; + case 24: + popProvider(CacheContext); + } } -function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { - var deletions = parentFiber.deletions; - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; +var offscreenSubtreeIsHidden = !1, + offscreenSubtreeWasHidden = !1, + PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, + nextEffect = null; +function safelyAttachRef(current, nearestMountedAncestor) { + try { + var ref = current.ref; + if (null !== ref) { + var instance = current.stateNode; + switch (current.tag) { + case 26: + case 27: + case 5: + var instanceToUse = getPublicInstance(instance); + break; + default: + instanceToUse = instance; + } + "function" === typeof ref + ? (current.refCleanup = ref(instanceToUse)) + : (ref.current = instanceToUse); + } + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } +} +function safelyDetachRef(current, nearestMountedAncestor) { + var ref = current.ref, + refCleanup = current.refCleanup; + if (null !== ref) + if ("function" === typeof refCleanup) try { - var root = root$jscomp$0, - returnFiber = parentFiber, - parent = returnFiber; - a: for (; null !== parent; ) { - switch (parent.tag) { - case 27: - case 5: - hostParent = parent.stateNode; - hostParentIsContainer = !1; - break a; + refCleanup(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } finally { + (current.refCleanup = null), + (current = current.alternate), + null != current && (current.refCleanup = null); + } + else if ("function" === typeof ref) + try { + ref(null); + } catch (error$95) { + captureCommitPhaseError(current, nearestMountedAncestor, error$95); + } + else ref.current = null; +} +function safelyCallDestroy(current, nearestMountedAncestor, destroy) { + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } +} +var shouldFireAfterActiveInstanceBlur = !1; +function commitBeforeMutationEffects(root, firstChild) { + for (nextEffect = firstChild; null !== nextEffect; ) + if ( + ((root = nextEffect), + (firstChild = root.child), + 0 !== (root.subtreeFlags & 1028) && null !== firstChild) + ) + (firstChild.return = root), (nextEffect = firstChild); + else + for (; null !== nextEffect; ) { + root = nextEffect; + try { + var current = root.alternate, + flags = root.flags; + switch (root.tag) { + case 0: + break; + case 11: + case 15: + break; + case 1: + if (0 !== (flags & 1024) && null !== current) { + var prevProps = current.memoizedProps, + prevState = current.memoizedState, + instance = root.stateNode, + snapshot = instance.getSnapshotBeforeUpdate( + root.elementType === root.type + ? prevProps + : resolveDefaultProps(root.type, prevProps), + prevState + ); + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + } + break; case 3: - hostParent = parent.stateNode.containerInfo; - hostParentIsContainer = !0; - break a; + break; + case 5: + case 26: + case 27: + case 6: case 4: - hostParent = parent.stateNode.containerInfo; - hostParentIsContainer = !0; - break a; + case 17: + break; + default: + if (0 !== (flags & 1024)) + throw Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." + ); } - parent = parent.return; + } catch (error) { + captureCommitPhaseError(root, root.return, error); } - if (null === hostParent) - throw Error( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." - ); - commitDeletionEffectsOnFiber(root, returnFiber, childToDelete); - hostParent = null; - hostParentIsContainer = !1; - var alternate = childToDelete.alternate; - null !== alternate && (alternate.return = null); - childToDelete.return = null; - } catch (error) { - captureCommitPhaseError(childToDelete, parentFiber, error); + firstChild = root.sibling; + if (null !== firstChild) { + firstChild.return = root.return; + nextEffect = firstChild; + break; + } + nextEffect = root.return; + } + current = shouldFireAfterActiveInstanceBlur; + shouldFireAfterActiveInstanceBlur = !1; + return current; +} +function commitHookEffectListUnmount( + flags, + finishedWork, + nearestMountedAncestor +) { + var updateQueue = finishedWork.updateQueue; + updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; + if (null !== updateQueue) { + var effect = (updateQueue = updateQueue.next); + do { + if ((effect.tag & flags) === flags) { + var inst = effect.inst, + destroy = inst.destroy; + void 0 !== destroy && + ((inst.destroy = void 0), + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy)); + } + effect = effect.next; + } while (effect !== updateQueue); + } +} +function commitHookEffectListMount(flags, finishedWork) { + finishedWork = finishedWork.updateQueue; + finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; + if (null !== finishedWork) { + var effect = (finishedWork = finishedWork.next); + do { + if ((effect.tag & flags) === flags) { + var create$96 = effect.create, + inst = effect.inst; + create$96 = create$96(); + inst.destroy = create$96; } + effect = effect.next; + } while (effect !== finishedWork); + } +} +function commitHookLayoutEffects(finishedWork, hookFlags) { + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } +} +function commitClassCallbacks(finishedWork) { + var updateQueue = finishedWork.updateQueue; + if (null !== updateQueue) { + var instance = finishedWork.stateNode; + try { + commitCallbacks(updateQueue, instance); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); } - if (parentFiber.subtreeFlags & 12854) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), - (parentFiber = parentFiber.sibling); + } } -function commitMutationEffectsOnFiber(finishedWork, root) { - var current = finishedWork.alternate, - flags = finishedWork.flags; +function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { + var flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: - case 14: case 15: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - try { - commitHookEffectListUnmount(3, finishedWork, finishedWork.return), - commitHookEffectListMount(3, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - try { - commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$105) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$105); - } - } + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 4 && commitHookLayoutEffects(finishedWork, 5); break; case 1: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - flags & 64 && - offscreenSubtreeIsHidden && - ((finishedWork = finishedWork.updateQueue), - null !== finishedWork && - ((flags = finishedWork.callbacks), - null !== flags && - ((current = finishedWork.shared.hiddenCallbacks), - (finishedWork.shared.hiddenCallbacks = - null === current ? flags : current.concat(flags))))); - break; - case 26: - case 27: - case 5: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - var newProps = finishedWork.memoizedProps; - current = null !== current ? current.memoizedProps : newProps; - finishedWork.updateQueue = null; - try { - var viewConfig = flags.viewConfig; - instanceProps.set(flags._nativeTag, newProps); - var updatePayload = diffProperties( - null, - current, - newProps, - viewConfig.validAttributes - ); - null != updatePayload && - ReactNativePrivateInterface.UIManager.updateView( - flags._nativeTag, - viewConfig.uiViewClassName, - updatePayload + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 4) + if (((finishedRoot = finishedWork.stateNode), null === current)) + try { + finishedRoot.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + else { + var prevProps = + finishedWork.elementType === finishedWork.type + ? current.memoizedProps + : resolveDefaultProps(finishedWork.type, current.memoizedProps); + current = current.memoizedState; + try { + finishedRoot.componentDidUpdate( + prevProps, + current, + finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$108) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$108); + } catch (error$97) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$97 + ); + } } - } + flags & 64 && commitClassCallbacks(finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; - case 6: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - if (null === finishedWork.stateNode) - throw Error( - "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." - ); - flags = finishedWork.stateNode; - current = finishedWork.memoizedProps; + case 3: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { + finishedRoot = null; + if (null !== finishedWork.child) + switch (finishedWork.child.tag) { + case 27: + case 5: + finishedRoot = getPublicInstance(finishedWork.child.stateNode); + break; + case 1: + finishedRoot = finishedWork.child.stateNode; + } try { - ReactNativePrivateInterface.UIManager.updateView( - flags, - "RCTRawText", - { text: current } - ); - } catch (error$109) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$109); + commitCallbacks(flags, finishedRoot); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); } } break; - case 3: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); + case 26: + case 27: + case 5: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; - case 4: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); + case 12: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); break; case 13: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - finishedWork.child.flags & 8192 && - ((newProps = null !== finishedWork.memoizedState), - (current = null !== current && null !== current.memoizedState), - alwaysThrottleRetries - ? newProps !== current && (globalMostRecentFallbackTime = now()) - : newProps && !current && (globalMostRecentFallbackTime = now())); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); break; case 22: - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - viewConfig = null !== finishedWork.memoizedState; - updatePayload = null !== current && null !== current.memoizedState; - if (finishedWork.mode & 1) { - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || viewConfig; - offscreenSubtreeWasHidden = - prevOffscreenSubtreeWasHidden || updatePayload; - recursivelyTraverseMutationEffects(root, finishedWork); - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - } else recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - root = finishedWork.stateNode; - root._current = finishedWork; - root._visibility &= -3; - root._visibility |= root._pendingVisibility & 2; - if ( - flags & 8192 && - ((root._visibility = viewConfig - ? root._visibility & -2 - : root._visibility | 1), - viewConfig && - ((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), - null === current || - updatePayload || - root || - (0 !== (finishedWork.mode & 1) && - recursivelyTraverseDisappearLayoutEffects(finishedWork))), - null === finishedWork.memoizedProps || - "manual" !== finishedWork.memoizedProps.mode) - ) - a: for (current = null, root = finishedWork; ; ) { - if (5 === root.tag) { - if (null === current) { - current = root; - try { - if (((newProps = root.stateNode), viewConfig)) { - var viewConfig$jscomp$0 = newProps.viewConfig; - var updatePayload$jscomp$0 = diffProperties( - null, - emptyObject$1, - { style: { display: "none" } }, - viewConfig$jscomp$0.validAttributes - ); - ReactNativePrivateInterface.UIManager.updateView( - newProps._nativeTag, - viewConfig$jscomp$0.uiViewClassName, - updatePayload$jscomp$0 - ); - } else { - var instance = root.stateNode, - props = root.memoizedProps, - viewConfig$jscomp$1 = instance.viewConfig, - prevProps = assign({}, props, { - style: [props.style, { display: "none" }] - }); - var updatePayload$jscomp$1 = diffProperties( - null, - prevProps, - props, - viewConfig$jscomp$1.validAttributes - ); - ReactNativePrivateInterface.UIManager.updateView( - instance._nativeTag, - viewConfig$jscomp$1.uiViewClassName, - updatePayload$jscomp$1 - ); - } - } catch (error) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error - ); - } - } - } else if (6 === root.tag) { - if (null === current) - try { - throw Error("Not yet implemented."); - } catch (error$99) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$99 - ); - } - } else if ( - ((22 !== root.tag && 23 !== root.tag) || - null === root.memoizedState || - root === finishedWork) && - null !== root.child - ) { - root.child.return = root; - root = root.child; - continue; - } - if (root === finishedWork) break a; - for (; null === root.sibling; ) { - if (null === root.return || root.return === finishedWork) break a; - current === root && (current = null); - root = root.return; - } - current === root && (current = null); - root.sibling.return = root.return; - root = root.sibling; + if (0 !== (finishedWork.mode & 1)) { + if ( + ((prevProps = + null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), + !prevProps) + ) { + current = + (null !== current && null !== current.memoizedState) || + offscreenSubtreeWasHidden; + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevProps; + (offscreenSubtreeWasHidden = current) && + !prevOffscreenSubtreeWasHidden + ? recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + 0 !== (finishedWork.subtreeFlags & 8772) + ) + : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; } - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((current = flags.retryQueue), - null !== current && - ((flags.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, current)))); - break; - case 19: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); - break; - case 21: + } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 512 && + ("manual" === finishedWork.memoizedProps.mode + ? safelyAttachRef(finishedWork, finishedWork.return) + : safelyDetachRef(finishedWork, finishedWork.return)); break; default: - recursivelyTraverseMutationEffects(root, finishedWork), - commitReconciliationEffects(finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); } } -function commitReconciliationEffects(finishedWork) { - var flags = finishedWork.flags; - if (flags & 2) { - try { - a: { - for (var parent = finishedWork.return; null !== parent; ) { - if (isHostParent(parent)) { - var JSCompiler_inline_result = parent; - break a; - } - parent = parent.return; - } - throw Error( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." - ); - } - switch (JSCompiler_inline_result.tag) { - case 27: - case 5: - var parent$jscomp$0 = JSCompiler_inline_result.stateNode; - JSCompiler_inline_result.flags & 32 && - (JSCompiler_inline_result.flags &= -33); - var before = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); - break; - case 3: - case 4: - var parent$100 = JSCompiler_inline_result.stateNode.containerInfo, - before$101 = getHostSibling(finishedWork); - insertOrAppendPlacementNodeIntoContainer( - finishedWork, - before$101, - parent$100 - ); - break; - default: - throw Error( - "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." - ); - } - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - finishedWork.flags &= -3; - } - flags & 4096 && (finishedWork.flags &= -4097); +function detachFiberAfterEffects(fiber) { + var alternate = fiber.alternate; + null !== alternate && + ((fiber.alternate = null), detachFiberAfterEffects(alternate)); + fiber.child = null; + fiber.deletions = null; + fiber.sibling = null; + fiber.stateNode = null; + fiber.return = null; + fiber.dependencies = null; + fiber.memoizedProps = null; + fiber.memoizedState = null; + fiber.pendingProps = null; + fiber.stateNode = null; + fiber.updateQueue = null; } -function recursivelyTraverseLayoutEffects(root, parentFiber) { - if (parentFiber.subtreeFlags & 8772) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), - (parentFiber = parentFiber.sibling); +function isHostParent(fiber) { + return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; } -function recursivelyTraverseDisappearLayoutEffects(parentFiber) { - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedWork = parentFiber; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - commitHookEffectListUnmount(4, finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 1: - safelyDetachRef(finishedWork, finishedWork.return); - var instance = finishedWork.stateNode; - if ("function" === typeof instance.componentWillUnmount) { - var current = finishedWork, - nearestMountedAncestor = finishedWork.return; - try { - var current$jscomp$0 = current; - instance.props = current$jscomp$0.memoizedProps; - instance.state = current$jscomp$0.memoizedState; - instance.componentWillUnmount(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } - } - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 26: - case 27: - case 5: - safelyDetachRef(finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 22: - safelyDetachRef(finishedWork, finishedWork.return); - null === finishedWork.memoizedState && - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - default: - recursivelyTraverseDisappearLayoutEffects(finishedWork); +function getHostSibling(fiber) { + a: for (;;) { + for (; null === fiber.sibling; ) { + if (null === fiber.return || isHostParent(fiber.return)) return null; + fiber = fiber.return; } - parentFiber = parentFiber.sibling; - } -} -function recursivelyTraverseReappearLayoutEffects( - finishedRoot$jscomp$0, - parentFiber, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - commitHookLayoutEffects(finishedWork, 4); - break; - case 1: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - var instance = finishedWork.stateNode; - if ("function" === typeof instance.componentDidMount) - try { - instance.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - finishedRoot = finishedWork.updateQueue; - if (null !== finishedRoot) { - var hiddenCallbacks = finishedRoot.shared.hiddenCallbacks; - if (null !== hiddenCallbacks) - for ( - finishedRoot.shared.hiddenCallbacks = null, finishedRoot = 0; - finishedRoot < hiddenCallbacks.length; - finishedRoot++ - ) - callCallback(hiddenCallbacks[finishedRoot], instance); - } - includeWorkInProgressEffects && - flags & 64 && - commitClassCallbacks(finishedWork); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 26: - case 27: - case 5: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - break; - case 13: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - break; - case 22: - null === finishedWork.memoizedState && - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - default: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); + fiber.sibling.return = fiber.return; + for ( + fiber = fiber.sibling; + 5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag; + + ) { + if (fiber.flags & 2) continue a; + if (null === fiber.child || 4 === fiber.tag) continue a; + else (fiber.child.return = fiber), (fiber = fiber.child); } - parentFiber = parentFiber.sibling; + if (!(fiber.flags & 2)) return fiber.stateNode; } } -function commitHookPassiveMountEffects(finishedWork, hookFlags) { - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } +function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { + var tag = node.tag; + if (5 === tag || 6 === tag) + if (((node = node.stateNode), before)) { + if ("number" === typeof parent) + throw Error("Container does not support insertBefore operation"); + } else + ReactNativePrivateInterface.UIManager.setChildren(parent, [ + "number" === typeof node ? node : node._nativeTag + ]); + else if (4 !== tag && ((node = node.child), null !== node)) + for ( + insertOrAppendPlacementNodeIntoContainer(node, before, parent), + node = node.sibling; + null !== node; + + ) + insertOrAppendPlacementNodeIntoContainer(node, before, parent), + (node = node.sibling); } -function commitOffscreenPassiveMountEffects(current, finishedWork) { - var previousCache = null; - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (previousCache = current.memoizedState.cachePool.pool); - current = null; - null !== finishedWork.memoizedState && - null !== finishedWork.memoizedState.cachePool && - (current = finishedWork.memoizedState.cachePool.pool); - current !== previousCache && - (null != current && current.refCount++, - null != previousCache && releaseCache(previousCache)); -} -function commitCachePassiveMountEffect(current, finishedWork) { - current = null; - null !== finishedWork.alternate && - (current = finishedWork.alternate.memoizedState.cache); - finishedWork = finishedWork.memoizedState.cache; - finishedWork !== current && - (finishedWork.refCount++, null != current && releaseCache(current)); +function insertOrAppendPlacementNode(node, before, parent) { + var tag = node.tag; + if (5 === tag || 6 === tag) + if (((node = node.stateNode), before)) { + tag = parent._children; + var index = tag.indexOf(node); + 0 <= index + ? (tag.splice(index, 1), + (before = tag.indexOf(before)), + tag.splice(before, 0, node), + ReactNativePrivateInterface.UIManager.manageChildren( + parent._nativeTag, + [index], + [before], + [], + [], + [] + )) + : ((before = tag.indexOf(before)), + tag.splice(before, 0, node), + ReactNativePrivateInterface.UIManager.manageChildren( + parent._nativeTag, + [], + [], + ["number" === typeof node ? node : node._nativeTag], + [before], + [] + )); + } else + (before = "number" === typeof node ? node : node._nativeTag), + (tag = parent._children), + (index = tag.indexOf(node)), + 0 <= index + ? (tag.splice(index, 1), + tag.push(node), + ReactNativePrivateInterface.UIManager.manageChildren( + parent._nativeTag, + [index], + [tag.length - 1], + [], + [], + [] + )) + : (tag.push(node), + ReactNativePrivateInterface.UIManager.manageChildren( + parent._nativeTag, + [], + [], + [before], + [tag.length - 1], + [] + )); + else if (4 !== tag && ((node = node.child), null !== node)) + for ( + insertOrAppendPlacementNode(node, before, parent), node = node.sibling; + null !== node; + + ) + insertOrAppendPlacementNode(node, before, parent), (node = node.sibling); } -function recursivelyTraversePassiveMountEffects( - root, - parentFiber, - committedLanes, - committedTransitions +var hostParent = null, + hostParentIsContainer = !1; +function recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + parent ) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveMountOnFiber( - root, - parentFiber, - committedLanes, - committedTransitions - ), - (parentFiber = parentFiber.sibling); + for (parent = parent.child; null !== parent; ) + commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), + (parent = parent.sibling); } -function commitPassiveMountOnFiber( +function commitDeletionEffectsOnFiber( finishedRoot, - finishedWork, - committedLanes, - committedTransitions + nearestMountedAncestor, + deletedFiber ) { - var flags = finishedWork.flags; - switch (finishedWork.tag) { + if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) + try { + injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); + } catch (err) {} + switch (deletedFiber.tag) { + case 26: + case 27: + case 5: + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); + case 6: + var prevHostParent = hostParent, + prevHostParentIsContainer = hostParentIsContainer; + hostParent = null; + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + hostParent = prevHostParent; + hostParentIsContainer = prevHostParentIsContainer; + null !== hostParent && + (hostParentIsContainer + ? ((finishedRoot = hostParent), + recursivelyUncacheFiberNode(deletedFiber.stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + finishedRoot, + [], + [], + [], + [], + [0] + )) + : ((finishedRoot = hostParent), + (nearestMountedAncestor = deletedFiber.stateNode), + recursivelyUncacheFiberNode(nearestMountedAncestor), + (deletedFiber = finishedRoot._children), + (nearestMountedAncestor = deletedFiber.indexOf( + nearestMountedAncestor + )), + deletedFiber.splice(nearestMountedAncestor, 1), + ReactNativePrivateInterface.UIManager.manageChildren( + finishedRoot._nativeTag, + [], + [], + [], + [], + [nearestMountedAncestor] + ))); + break; + case 18: + null !== hostParent && shim$1(); + break; + case 4: + prevHostParent = hostParent; + prevHostParentIsContainer = hostParentIsContainer; + hostParent = deletedFiber.stateNode.containerInfo; + hostParentIsContainer = !0; + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + hostParent = prevHostParent; + hostParentIsContainer = prevHostParentIsContainer; + break; case 0: case 11: + case 14: case 15: - recursivelyTraversePassiveMountEffects( + if ( + !offscreenSubtreeWasHidden && + ((prevHostParent = deletedFiber.updateQueue), + null !== prevHostParent && + ((prevHostParent = prevHostParent.lastEffect), + null !== prevHostParent)) + ) { + prevHostParentIsContainer = prevHostParent = prevHostParent.next; + do { + var tag = prevHostParentIsContainer.tag, + inst = prevHostParentIsContainer.inst, + destroy = inst.destroy; + void 0 !== destroy && + (0 !== (tag & 2) + ? ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + )) + : 0 !== (tag & 4) && + ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + ))); + prevHostParentIsContainer = prevHostParentIsContainer.next; + } while (prevHostParentIsContainer !== prevHostParent); + } + recursivelyTraverseDeletionEffects( finishedRoot, - finishedWork, - committedLanes, - committedTransitions + nearestMountedAncestor, + deletedFiber ); - flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); break; - case 3: - recursivelyTraversePassiveMountEffects( + case 1: + if ( + !offscreenSubtreeWasHidden && + (safelyDetachRef(deletedFiber, nearestMountedAncestor), + (prevHostParent = deletedFiber.stateNode), + "function" === typeof prevHostParent.componentWillUnmount) + ) + try { + (prevHostParent.props = deletedFiber.memoizedProps), + (prevHostParent.state = deletedFiber.memoizedState), + prevHostParent.componentWillUnmount(); + } catch (error) { + captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); + } + recursivelyTraverseDeletionEffects( finishedRoot, - finishedWork, - committedLanes, - committedTransitions + nearestMountedAncestor, + deletedFiber ); - flags & 2048 && - ((finishedRoot = null), - null !== finishedWork.alternate && - (finishedRoot = finishedWork.alternate.memoizedState.cache), - (finishedWork = finishedWork.memoizedState.cache), - finishedWork !== finishedRoot && - (finishedWork.refCount++, - null != finishedRoot && releaseCache(finishedRoot))); break; - case 23: + case 21: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); break; case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) - : ((instance._visibility |= 4), - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - )) - : instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( + safelyDetachRef(deletedFiber, nearestMountedAncestor); + deletedFiber.mode & 1 + ? ((offscreenSubtreeWasHidden = + (prevHostParent = offscreenSubtreeWasHidden) || + null !== deletedFiber.memoizedState), + recursivelyTraverseDeletionEffects( finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( + nearestMountedAncestor, + deletedFiber + ), + (offscreenSubtreeWasHidden = prevHostParent)) + : recursivelyTraverseDeletionEffects( finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - 0 !== (finishedWork.subtreeFlags & 10256) - )); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + nearestMountedAncestor, + deletedFiber + ); break; default: - recursivelyTraversePassiveMountEffects( + recursivelyTraverseDeletionEffects( finishedRoot, - finishedWork, - committedLanes, - committedTransitions + nearestMountedAncestor, + deletedFiber ); } } -function recursivelyTraverseReconnectPassiveEffects( - finishedRoot$jscomp$0, - parentFiber, - committedLanes$jscomp$0, - committedTransitions$jscomp$0, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - committedLanes = committedLanes$jscomp$0, - committedTransitions = committedTransitions$jscomp$0, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - commitHookPassiveMountEffects(finishedWork, 8); - break; - case 23: - break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects( - finishedRoot, - finishedWork - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )); - includeWorkInProgressEffects && - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - } - parentFiber = parentFiber.sibling; +function getRetryCache(finishedWork) { + switch (finishedWork.tag) { + case 13: + case 19: + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); + return retryCache; + case 22: + return ( + (finishedWork = finishedWork.stateNode), + (retryCache = finishedWork._retryCache), + null === retryCache && + (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), + retryCache + ); + default: + throw Error( + "Unexpected Suspense handler tag (" + + finishedWork.tag + + "). This is a bug in React." + ); } } -function recursivelyTraverseAtomicPassiveEffects( - finishedRoot$jscomp$0, - parentFiber -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 22: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); +function attachSuspenseRetryListeners(finishedWork, wakeables) { + var retryCache = getRetryCache(finishedWork); + wakeables.forEach(function (wakeable) { + var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); + retryCache.has(wakeable) || + (retryCache.add(wakeable), wakeable.then(retry, retry)); + }); +} +function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { + var deletions = parentFiber.deletions; + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + try { + var root = root$jscomp$0, + returnFiber = parentFiber, + parent = returnFiber; + a: for (; null !== parent; ) { + switch (parent.tag) { + case 27: + case 5: + hostParent = parent.stateNode; + hostParentIsContainer = !1; + break a; + case 3: + hostParent = parent.stateNode.containerInfo; + hostParentIsContainer = !0; + break a; + case 4: + hostParent = parent.stateNode.containerInfo; + hostParentIsContainer = !0; + break a; + } + parent = parent.return; + } + if (null === hostParent) + throw Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ); + commitDeletionEffectsOnFiber(root, returnFiber, childToDelete); + hostParent = null; + hostParentIsContainer = !1; + var alternate = childToDelete.alternate; + null !== alternate && (alternate.return = null); + childToDelete.return = null; + } catch (error) { + captureCommitPhaseError(childToDelete, parentFiber, error); } - parentFiber = parentFiber.sibling; } -} -var suspenseyCommitFlag = 8192; -function recursivelyAccumulateSuspenseyCommit(parentFiber) { - if (parentFiber.subtreeFlags & suspenseyCommitFlag) + if (parentFiber.subtreeFlags & 12854) for (parentFiber = parentFiber.child; null !== parentFiber; ) - accumulateSuspenseyCommitOnFiber(parentFiber), + commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); } -function accumulateSuspenseyCommitOnFiber(fiber) { - switch (fiber.tag) { - case 26: - recursivelyAccumulateSuspenseyCommit(fiber); - if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) - throw Error( - "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." - ); +function commitMutationEffectsOnFiber(finishedWork, root) { + var current = finishedWork.alternate, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + try { + commitHookEffectListUnmount(3, finishedWork, finishedWork.return), + commitHookEffectListMount(3, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + try { + commitHookEffectListUnmount(5, finishedWork, finishedWork.return); + } catch (error$105) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$105); + } + } + break; + case 1: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + flags & 64 && + offscreenSubtreeIsHidden && + ((finishedWork = finishedWork.updateQueue), + null !== finishedWork && + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), + (finishedWork.shared.hiddenCallbacks = + null === current ? flags : current.concat(flags))))); break; + case 26: + case 27: case 5: - recursivelyAccumulateSuspenseyCommit(fiber); + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { + var newProps = finishedWork.memoizedProps; + current = null !== current ? current.memoizedProps : newProps; + finishedWork.updateQueue = null; + try { + var viewConfig = flags.viewConfig; + instanceProps.set(flags._nativeTag, newProps); + var updatePayload = diffProperties( + null, + current, + newProps, + viewConfig.validAttributes + ); + null != updatePayload && + ReactNativePrivateInterface.UIManager.updateView( + flags._nativeTag, + viewConfig.uiViewClassName, + updatePayload + ); + } catch (error$108) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$108); + } + } + break; + case 6: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + if (null === finishedWork.stateNode) + throw Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ); + flags = finishedWork.stateNode; + current = finishedWork.memoizedProps; + try { + ReactNativePrivateInterface.UIManager.updateView( + flags, + "RCTRawText", + { text: current } + ); + } catch (error$109) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$109); + } + } break; case 3: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; case 4: - recursivelyAccumulateSuspenseyCommit(fiber); + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 13: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + finishedWork.child.flags & 8192 && + ((newProps = null !== finishedWork.memoizedState), + (current = null !== current && null !== current.memoizedState), + alwaysThrottleRetries + ? newProps !== current && (globalMostRecentFallbackTime = now()) + : newProps && !current && (globalMostRecentFallbackTime = now())); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); break; case 22: - if (null === fiber.memoizedState) { - var current = fiber.alternate; - null !== current && null !== current.memoizedState - ? ((current = suspenseyCommitFlag), - (suspenseyCommitFlag = 16777216), - recursivelyAccumulateSuspenseyCommit(fiber), - (suspenseyCommitFlag = current)) - : recursivelyAccumulateSuspenseyCommit(fiber); - } + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + viewConfig = null !== finishedWork.memoizedState; + updatePayload = null !== current && null !== current.memoizedState; + if (finishedWork.mode & 1) { + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || viewConfig; + offscreenSubtreeWasHidden = + prevOffscreenSubtreeWasHidden || updatePayload; + recursivelyTraverseMutationEffects(root, finishedWork); + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + } else recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + root = finishedWork.stateNode; + root._current = finishedWork; + root._visibility &= -3; + root._visibility |= root._pendingVisibility & 2; + if ( + flags & 8192 && + ((root._visibility = viewConfig + ? root._visibility & -2 + : root._visibility | 1), + viewConfig && + ((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), + null === current || + updatePayload || + root || + (0 !== (finishedWork.mode & 1) && + recursivelyTraverseDisappearLayoutEffects(finishedWork))), + null === finishedWork.memoizedProps || + "manual" !== finishedWork.memoizedProps.mode) + ) + a: for (current = null, root = finishedWork; ; ) { + if (5 === root.tag) { + if (null === current) { + current = root; + try { + if (((newProps = root.stateNode), viewConfig)) { + var viewConfig$jscomp$0 = newProps.viewConfig; + var updatePayload$jscomp$0 = diffProperties( + null, + emptyObject$1, + { style: { display: "none" } }, + viewConfig$jscomp$0.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + newProps._nativeTag, + viewConfig$jscomp$0.uiViewClassName, + updatePayload$jscomp$0 + ); + } else { + var instance = root.stateNode, + props = root.memoizedProps, + viewConfig$jscomp$1 = instance.viewConfig, + prevProps = assign({}, props, { + style: [props.style, { display: "none" }] + }); + var updatePayload$jscomp$1 = diffProperties( + null, + prevProps, + props, + viewConfig$jscomp$1.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + instance._nativeTag, + viewConfig$jscomp$1.uiViewClassName, + updatePayload$jscomp$1 + ); + } + } catch (error) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error + ); + } + } + } else if (6 === root.tag) { + if (null === current) + try { + throw Error("Not yet implemented."); + } catch (error$99) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$99 + ); + } + } else if ( + ((22 !== root.tag && 23 !== root.tag) || + null === root.memoizedState || + root === finishedWork) && + null !== root.child + ) { + root.child.return = root; + root = root.child; + continue; + } + if (root === finishedWork) break a; + for (; null === root.sibling; ) { + if (null === root.return || root.return === finishedWork) break a; + current === root && (current = null); + root = root.return; + } + current === root && (current = null); + root.sibling.return = root.return; + root = root.sibling; + } + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); + break; + case 19: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); + break; + case 21: break; default: - recursivelyAccumulateSuspenseyCommit(fiber); + recursivelyTraverseMutationEffects(root, finishedWork), + commitReconciliationEffects(finishedWork); } } -function detachAlternateSiblings(parentFiber) { - var previousFiber = parentFiber.alternate; - if ( - null !== previousFiber && - ((parentFiber = previousFiber.child), null !== parentFiber) - ) { - previousFiber.child = null; - do - (previousFiber = parentFiber.sibling), - (parentFiber.sibling = null), - (parentFiber = previousFiber); - while (null !== parentFiber); - } -} -function recursivelyTraversePassiveUnmountEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber +function commitReconciliationEffects(finishedWork) { + var flags = finishedWork.flags; + if (flags & 2) { + try { + a: { + for (var parent = finishedWork.return; null !== parent; ) { + if (isHostParent(parent)) { + var JSCompiler_inline_result = parent; + break a; + } + parent = parent.return; + } + throw Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." ); } - detachAlternateSiblings(parentFiber); + switch (JSCompiler_inline_result.tag) { + case 27: + case 5: + var parent$jscomp$0 = JSCompiler_inline_result.stateNode; + JSCompiler_inline_result.flags & 32 && + (JSCompiler_inline_result.flags &= -33); + var before = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); + break; + case 3: + case 4: + var parent$100 = JSCompiler_inline_result.stateNode.containerInfo, + before$101 = getHostSibling(finishedWork); + insertOrAppendPlacementNodeIntoContainer( + finishedWork, + before$101, + parent$100 + ); + break; + default: + throw Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." + ); + } + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + finishedWork.flags &= -3; } - if (parentFiber.subtreeFlags & 10256) + flags & 4096 && (finishedWork.flags &= -4097); +} +function recursivelyTraverseLayoutEffects(root, parentFiber) { + if (parentFiber.subtreeFlags & 8772) for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveUnmountOnFiber(parentFiber), + commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), (parentFiber = parentFiber.sibling); } -function commitPassiveUnmountOnFiber(finishedWork) { - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraversePassiveUnmountEffects(finishedWork); - finishedWork.flags & 2048 && - commitHookEffectListUnmount(9, finishedWork, finishedWork.return); - break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState && - instance._visibility & 4 && - (null === finishedWork.return || 13 !== finishedWork.return.tag) - ? ((instance._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(finishedWork)) - : recursivelyTraversePassiveUnmountEffects(finishedWork); - break; - default: - recursivelyTraversePassiveUnmountEffects(finishedWork); - } -} -function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); - } - detachAlternateSiblings(parentFiber); - } +function recursivelyTraverseDisappearLayoutEffects(parentFiber) { for (parentFiber = parentFiber.child; null !== parentFiber; ) { - deletions = parentFiber; - switch (deletions.tag) { + var finishedWork = parentFiber; + switch (finishedWork.tag) { case 0: case 11: + case 14: case 15: - commitHookEffectListUnmount(8, deletions, deletions.return); - recursivelyTraverseDisconnectPassiveEffects(deletions); + commitHookEffectListUnmount(4, finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 1: + safelyDetachRef(finishedWork, finishedWork.return); + var instance = finishedWork.stateNode; + if ("function" === typeof instance.componentWillUnmount) { + var current = finishedWork, + nearestMountedAncestor = finishedWork.return; + try { + var current$jscomp$0 = current; + instance.props = current$jscomp$0.memoizedProps; + instance.state = current$jscomp$0.memoizedState; + instance.componentWillUnmount(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } + } + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 26: + case 27: + case 5: + safelyDetachRef(finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); break; case 22: - i = deletions.stateNode; - i._visibility & 4 && - ((i._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(deletions)); + safelyDetachRef(finishedWork, finishedWork.return); + null === finishedWork.memoizedState && + recursivelyTraverseDisappearLayoutEffects(finishedWork); break; default: - recursivelyTraverseDisconnectPassiveEffects(deletions); + recursivelyTraverseDisappearLayoutEffects(finishedWork); } parentFiber = parentFiber.sibling; } } -function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - deletedSubtreeRoot, - nearestMountedAncestor +function recursivelyTraverseReappearLayoutEffects( + finishedRoot$jscomp$0, + parentFiber, + includeWorkInProgressEffects ) { - for (; null !== nextEffect; ) { - var fiber = nextEffect; - switch (fiber.tag) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { case 0: case 11: case 15: - commitHookEffectListUnmount(8, fiber, nearestMountedAncestor); + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + commitHookLayoutEffects(finishedWork, 4); break; - case 23: - case 22: - if ( - null !== fiber.memoizedState && - null !== fiber.memoizedState.cachePool - ) { - var cache = fiber.memoizedState.cachePool.pool; - null != cache && cache.refCount++; + case 1: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + var instance = finishedWork.stateNode; + if ("function" === typeof instance.componentDidMount) + try { + instance.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + finishedRoot = finishedWork.updateQueue; + if (null !== finishedRoot) { + var hiddenCallbacks = finishedRoot.shared.hiddenCallbacks; + if (null !== hiddenCallbacks) + for ( + finishedRoot.shared.hiddenCallbacks = null, finishedRoot = 0; + finishedRoot < hiddenCallbacks.length; + finishedRoot++ + ) + callCallback(hiddenCallbacks[finishedRoot], instance); } + includeWorkInProgressEffects && + flags & 64 && + commitClassCallbacks(finishedWork); + safelyAttachRef(finishedWork, finishedWork.return); break; - case 24: - releaseCache(fiber.memoizedState.cache); + case 26: + case 27: + case 5: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + case 12: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + break; + case 13: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + break; + case 22: + null === finishedWork.memoizedState && + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + default: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); } - cache = fiber.child; - if (null !== cache) (cache.return = fiber), (nextEffect = cache); - else - a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { - cache = nextEffect; - var sibling = cache.sibling, - returnFiber = cache.return; - detachFiberAfterEffects(cache); - if (cache === fiber) { - nextEffect = null; - break a; - } - if (null !== sibling) { - sibling.return = returnFiber; - nextEffect = sibling; - break a; - } - nextEffect = returnFiber; - } + parentFiber = parentFiber.sibling; } } -var DefaultCacheDispatcher = { - getCacheSignal: function () { - return readContext(CacheContext).controller.signal; - }, - getCacheForType: function (resourceType) { - var cache = readContext(CacheContext), - cacheForType = cache.data.get(resourceType); - void 0 === cacheForType && - ((cacheForType = resourceType()), - cache.data.set(resourceType, cacheForType)); - return cacheForType; - } - }, - PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, - executionContext = 0, - workInProgressRoot = null, - workInProgress = null, - workInProgressRootRenderLanes = 0, - workInProgressSuspendedReason = 0, - workInProgressThrownValue = null, - workInProgressRootDidAttachPingListener = !1, - entangledRenderLanes = 0, - workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, - workInProgressRootSkippedLanes = 0, - workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootPingedLanes = 0, - workInProgressDeferredLane = 0, - workInProgressRootConcurrentErrors = null, - workInProgressRootRecoverableErrors = null, - workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, - globalMostRecentFallbackTime = 0, - workInProgressRootRenderTargetTime = Infinity, - workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, - legacyErrorBoundariesThatAlreadyFailed = null, - rootDoesHavePassiveEffects = !1, - rootWithPendingPassiveEffects = null, - pendingPassiveEffectsLanes = 0, - pendingPassiveEffectsRemainingLanes = 0, - pendingPassiveTransitions = null, - nestedUpdateCount = 0, - rootWithNestedUpdates = null; -function requestUpdateLane(fiber) { - if (0 === (fiber.mode & 1)) return 2; - if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) - return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== requestCurrentTransition()) - return ( - (fiber = currentEntangledLane), - 0 !== fiber ? fiber : requestTransitionLane() - ); - fiber = currentUpdatePriority; - return 0 !== fiber ? fiber : 32; +function commitHookPassiveMountEffects(finishedWork, hookFlags) { + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } } -function requestDeferredLane() { - 0 === workInProgressDeferredLane && - (workInProgressDeferredLane = - 0 !== (workInProgressRootRenderLanes & 536870912) - ? 536870912 - : claimNextTransitionLane()); - var suspenseHandler = suspenseHandlerStackCursor.current; - null !== suspenseHandler && (suspenseHandler.flags |= 32); - return workInProgressDeferredLane; +function commitOffscreenPassiveMountEffects(current, finishedWork) { + var previousCache = null; + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (previousCache = current.memoizedState.cachePool.pool); + current = null; + null !== finishedWork.memoizedState && + null !== finishedWork.memoizedState.cachePool && + (current = finishedWork.memoizedState.cachePool.pool); + current !== previousCache && + (null != current && current.refCount++, + null != previousCache && releaseCache(previousCache)); } -function scheduleUpdateOnFiber(root, fiber, lane) { - if ( - (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || - null !== root.cancelPendingCommit - ) - prepareFreshStack(root, 0), - markRootSuspended( +function commitCachePassiveMountEffect(current, finishedWork) { + current = null; + null !== finishedWork.alternate && + (current = finishedWork.alternate.memoizedState.cache); + finishedWork = finishedWork.memoizedState.cache; + finishedWork !== current && + (finishedWork.refCount++, null != current && releaseCache(current)); +} +function recursivelyTraversePassiveMountEffects( + root, + parentFiber, + committedLanes, + committedTransitions +) { + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveMountOnFiber( root, - workInProgressRootRenderLanes, - workInProgressDeferredLane + parentFiber, + committedLanes, + committedTransitions + ), + (parentFiber = parentFiber.sibling); +} +function commitPassiveMountOnFiber( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions +) { + var flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions ); - markRootUpdated(root, lane); - if (0 === (executionContext & 2) || root !== workInProgressRoot) - root === workInProgressRoot && - (0 === (executionContext & 2) && - (workInProgressRootInterleavedUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - )), - ensureRootIsScheduled(root), - 2 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now() + 500), - flushSyncWorkAcrossRoots_impl(!0)); + flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); + break; + case 3: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + ((finishedRoot = null), + null !== finishedWork.alternate && + (finishedRoot = finishedWork.alternate.memoizedState.cache), + (finishedWork = finishedWork.memoizedState.cache), + finishedWork !== finishedRoot && + (finishedWork.refCount++, + null != finishedRoot && releaseCache(finishedRoot))); + break; + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) + : ((instance._visibility |= 4), + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + )) + : instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + 0 !== (finishedWork.subtreeFlags & 10256) + )); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + } } -function performConcurrentWorkOnRoot(root, didTimeout) { - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var originalCallbackNode = root.callbackNode; - if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) - return null; - var lanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes : 0 - ); - if (0 === lanes) return null; - var exitStatus = (didTimeout = - 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes) && !didTimeout) - ? renderRootConcurrent(root, lanes) - : renderRootSync(root, lanes); - if (0 !== exitStatus) { - var renderWasConcurrent = didTimeout; - do { - if (6 === exitStatus) markRootSuspended(root, lanes, 0); - else { - didTimeout = root.current.alternate; - if ( - renderWasConcurrent && - !isRenderConsistentWithExternalStores(didTimeout) - ) { - exitStatus = renderRootSync(root, lanes); - renderWasConcurrent = !1; - continue; - } - if (2 === exitStatus) { - renderWasConcurrent = lanes; - var errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - renderWasConcurrent - ); - 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - root, - renderWasConcurrent, - errorRetryLanes - ))); - } - if (1 === exitStatus) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); - root.finishedWork = didTimeout; - root.finishedLanes = lanes; - a: { - renderWasConcurrent = root; - switch (exitStatus) { - case 0: - case 1: - throw Error("Root did not complete. This is a bug in React."); - case 4: - if ((lanes & 4194176) === lanes) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - break a; - } - break; - case 2: - case 3: - case 5: - break; - default: - throw Error("Unknown root exit status."); - } - if ( - (lanes & 62914560) === lanes && - (alwaysThrottleRetries || 3 === exitStatus) && - ((exitStatus = globalMostRecentFallbackTime + 300 - now()), - 10 < exitStatus) - ) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( - commitRootWhenReady.bind( - null, - renderWasConcurrent, - didTimeout, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane - ), - exitStatus - ); - break a; - } - commitRootWhenReady( - renderWasConcurrent, - didTimeout, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane +function recursivelyTraverseReconnectPassiveEffects( + finishedRoot$jscomp$0, + parentFiber, + committedLanes$jscomp$0, + committedTransitions$jscomp$0, + includeWorkInProgressEffects +) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + committedLanes = committedLanes$jscomp$0, + committedTransitions = committedTransitions$jscomp$0, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + commitHookPassiveMountEffects(finishedWork, 8); + break; + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects( + finishedRoot, + finishedWork + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )); + includeWorkInProgressEffects && + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork ); - } - } - break; - } while (1); + break; + case 24: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + includeWorkInProgressEffects && + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + } + parentFiber = parentFiber.sibling; } - ensureRootIsScheduled(root); - scheduleTaskForRootDuringMicrotask(root, now()); - root = - root.callbackNode === originalCallbackNode - ? performConcurrentWorkOnRoot.bind(null, root) - : null; - return root; } -function recoverFromConcurrentError( - root, - originallyAttemptedLanes, - errorRetryLanes +function recursivelyTraverseAtomicPassiveEffects( + finishedRoot$jscomp$0, + parentFiber ) { - var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, - JSCompiler_inline_result; - (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && - (prepareFreshStack(root, errorRetryLanes).flags |= 256); - errorRetryLanes = renderRootSync(root, errorRetryLanes); - if (2 !== errorRetryLanes) { - if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) - return ( - (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), - (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), - 4 - ); - root = workInProgressRootRecoverableErrors; - workInProgressRootRecoverableErrors = errorsFromFirstAttempt; - null !== root && queueRecoverableErrors(root); - } - return errorRetryLanes; + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 22: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + } + parentFiber = parentFiber.sibling; + } } -function queueRecoverableErrors(errors) { - null === workInProgressRootRecoverableErrors - ? (workInProgressRootRecoverableErrors = errors) - : workInProgressRootRecoverableErrors.push.apply( - workInProgressRootRecoverableErrors, - errors - ); -} -function commitRootWhenReady( - root, - finishedWork, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - lanes, - spawnedLane -) { - 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); - commitRoot( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane - ); +var suspenseyCommitFlag = 8192; +function recursivelyAccumulateSuspenseyCommit(parentFiber) { + if (parentFiber.subtreeFlags & suspenseyCommitFlag) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + accumulateSuspenseyCommitOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); } -function isRenderConsistentWithExternalStores(finishedWork) { - for (var node = finishedWork; ; ) { - if (node.flags & 16384) { - var updateQueue = node.updateQueue; - if ( - null !== updateQueue && - ((updateQueue = updateQueue.stores), null !== updateQueue) - ) - for (var i = 0; i < updateQueue.length; i++) { - var check = updateQueue[i], - getSnapshot = check.getSnapshot; - check = check.value; - try { - if (!objectIs(getSnapshot(), check)) return !1; - } catch (error) { - return !1; - } - } - } - updateQueue = node.child; - if (node.subtreeFlags & 16384 && null !== updateQueue) - (updateQueue.return = node), (node = updateQueue); - else { - if (node === finishedWork) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === finishedWork) return !0; - node = node.return; +function accumulateSuspenseyCommitOnFiber(fiber) { + switch (fiber.tag) { + case 26: + recursivelyAccumulateSuspenseyCommit(fiber); + if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) + throw Error( + "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." + ); + break; + case 5: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 3: + case 4: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 22: + if (null === fiber.memoizedState) { + var current = fiber.alternate; + null !== current && null !== current.memoizedState + ? ((current = suspenseyCommitFlag), + (suspenseyCommitFlag = 16777216), + recursivelyAccumulateSuspenseyCommit(fiber), + (suspenseyCommitFlag = current)) + : recursivelyAccumulateSuspenseyCommit(fiber); } - node.sibling.return = node.return; - node = node.sibling; - } + break; + default: + recursivelyAccumulateSuspenseyCommit(fiber); } - return !0; -} -function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), (root.pingedLanes = 0)); - enableInfiniteRenderLoopDetection && - (executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), - throwIfInfiniteUpdateLoopDetected()); } -function markRootSuspended(root, suspendedLanes, spawnedLane) { - suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - +function detachAlternateSiblings(parentFiber) { + var previousFiber = parentFiber.alternate; + if ( + null !== previousFiber && + ((parentFiber = previousFiber.child), null !== parentFiber) ) { - var index$7 = 31 - clz32(lanes), - lane = 1 << index$7; - expirationTimes[index$7] = -1; - lanes &= ~lane; + previousFiber.child = null; + do + (previousFiber = parentFiber.sibling), + (parentFiber.sibling = null), + (parentFiber = previousFiber); + while (null !== parentFiber); } - 0 !== spawnedLane && - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } -function resetWorkInProgressStack() { - if (null !== workInProgress) { - if (0 === workInProgressSuspendedReason) - var interruptedWork = workInProgress.return; - else - (interruptedWork = workInProgress), - resetContextDependencies(), - resetHooksOnUnwind(interruptedWork), - (thenableState$1 = null), - (thenableIndexCounter$1 = 0), - (interruptedWork = workInProgress); - for (; null !== interruptedWork; ) - unwindInterruptedWork(interruptedWork.alternate, interruptedWork), - (interruptedWork = interruptedWork.return); - workInProgress = null; +function recursivelyTraversePassiveUnmountEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber + ); + } + detachAlternateSiblings(parentFiber); } + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveUnmountOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); } -function prepareFreshStack(root, lanes) { - root.finishedWork = null; - root.finishedLanes = 0; - var timeoutHandle = root.timeoutHandle; - -1 !== timeoutHandle && - ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); - timeoutHandle = root.cancelPendingCommit; - null !== timeoutHandle && - ((root.cancelPendingCommit = null), timeoutHandle()); - resetWorkInProgressStack(); - workInProgressRoot = root; - workInProgress = timeoutHandle = createWorkInProgress(root.current, null); - workInProgressRootRenderLanes = lanes; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; - workInProgressDeferredLane = - workInProgressRootPingedLanes = - workInProgressRootInterleavedUpdatedLanes = - workInProgressRootSkippedLanes = - 0; - workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = - null; - workInProgressRootDidIncludeRecursiveRenderUpdate = !1; - 0 !== (lanes & 8) && (lanes |= lanes & 32); - var allEntangledLanes = root.entangledLanes; - if (0 !== allEntangledLanes) - for ( - root = root.entanglements, allEntangledLanes &= lanes; - 0 < allEntangledLanes; - - ) { - var index$5 = 31 - clz32(allEntangledLanes), - lane = 1 << index$5; - lanes |= root[index$5]; - allEntangledLanes &= ~lane; +function commitPassiveUnmountOnFiber(finishedWork) { + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraversePassiveUnmountEffects(finishedWork); + finishedWork.flags & 2048 && + commitHookEffectListUnmount(9, finishedWork, finishedWork.return); + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState && + instance._visibility & 4 && + (null === finishedWork.return || 13 !== finishedWork.return.tag) + ? ((instance._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(finishedWork)) + : recursivelyTraversePassiveUnmountEffects(finishedWork); + break; + default: + recursivelyTraversePassiveUnmountEffects(finishedWork); + } +} +function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber + ); + } + detachAlternateSiblings(parentFiber); + } + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + deletions = parentFiber; + switch (deletions.tag) { + case 0: + case 11: + case 15: + commitHookEffectListUnmount(8, deletions, deletions.return); + recursivelyTraverseDisconnectPassiveEffects(deletions); + break; + case 22: + i = deletions.stateNode; + i._visibility & 4 && + ((i._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(deletions)); + break; + default: + recursivelyTraverseDisconnectPassiveEffects(deletions); } - entangledRenderLanes = lanes; - finishQueueingConcurrentUpdates(); - return timeoutHandle; + parentFiber = parentFiber.sibling; + } } -function handleThrow(root, thrownValue) { - currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); - workInProgressThrownValue = thrownValue; - null === workInProgress && - ((workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue)); -} -function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; - return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; -} -function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; - return prevCacheDispatcher; -} -function renderDidSuspendDelayIfPossible() { - workInProgressRootExitStatus = 4; - (0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || - null === workInProgressRoot || - markRootSuspended( - workInProgressRoot, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); -} -function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) - (workInProgressTransitions = null), prepareFreshStack(root, lanes); - lanes = !1; - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - var unitOfWork = workInProgress, - thrownValue = workInProgressThrownValue; - switch (workInProgressSuspendedReason) { - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; - break a; - case 3: - case 2: - lanes || - null !== suspenseHandlerStackCursor.current || - (lanes = !0); - default: - (workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, unitOfWork, thrownValue); +function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + deletedSubtreeRoot, + nearestMountedAncestor +) { + for (; null !== nextEffect; ) { + var fiber = nextEffect; + switch (fiber.tag) { + case 0: + case 11: + case 15: + commitHookEffectListUnmount(8, fiber, nearestMountedAncestor); + break; + case 23: + case 22: + if ( + null !== fiber.memoizedState && + null !== fiber.memoizedState.cachePool + ) { + var cache = fiber.memoizedState.cachePool.pool; + null != cache && cache.refCount++; + } + break; + case 24: + releaseCache(fiber.memoizedState.cache); + } + cache = fiber.child; + if (null !== cache) (cache.return = fiber), (nextEffect = cache); + else + a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { + cache = nextEffect; + var sibling = cache.sibling, + returnFiber = cache.return; + detachFiberAfterEffects(cache); + if (cache === fiber) { + nextEffect = null; + break a; + } + if (null !== sibling) { + sibling.return = returnFiber; + nextEffect = sibling; + break a; } + nextEffect = returnFiber; } - workLoopSync(); - break; - } catch (thrownValue$117) { - handleThrow(root, thrownValue$117); + } +} +var DefaultCacheDispatcher = { + getCacheSignal: function () { + return readContext(CacheContext).controller.signal; + }, + getCacheForType: function (resourceType) { + var cache = readContext(CacheContext), + cacheForType = cache.data.get(resourceType); + void 0 === cacheForType && + ((cacheForType = resourceType()), + cache.data.set(resourceType, cacheForType)); + return cacheForType; } - while (1); - lanes && root.shellSuspendCounter++; - resetContextDependencies(); - executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - if (null !== workInProgress) - throw Error( - "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." + }, + PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + executionContext = 0, + workInProgressRoot = null, + workInProgress = null, + workInProgressRootRenderLanes = 0, + workInProgressSuspendedReason = 0, + workInProgressThrownValue = null, + workInProgressRootDidAttachPingListener = !1, + entangledRenderLanes = 0, + workInProgressRootExitStatus = 0, + workInProgressRootFatalError = null, + workInProgressRootSkippedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, + workInProgressRootDidIncludeRecursiveRenderUpdate = !1, + didIncludeCommitPhaseUpdate = !1, + globalMostRecentFallbackTime = 0, + workInProgressRootRenderTargetTime = Infinity, + workInProgressTransitions = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsLanes = 0, + pendingPassiveEffectsRemainingLanes = 0, + pendingPassiveTransitions = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null; +function requestUpdateLane(fiber) { + if (0 === (fiber.mode & 1)) return 2; + if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) + return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; + if (null !== requestCurrentTransition()) + return ( + (fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane() ); - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; + fiber = currentUpdatePriority; + return 0 !== fiber ? fiber : 32; } -function workLoopSync() { - for (; null !== workInProgress; ) performUnitOfWork(workInProgress); +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : claimNextTransitionLane()); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); + return workInProgressDeferredLane; } -function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) - (workInProgressTransitions = null), - (workInProgressRootRenderTargetTime = now() + 500), - prepareFreshStack(root, lanes); - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - lanes = workInProgress; - var thrownValue = workInProgressThrownValue; - b: switch (workInProgressSuspendedReason) { - case 1: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 2: - if (isThenableResolved(thrownValue)) { - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - replaySuspendedUnitOfWork(lanes); - break; - } - lanes = function () { - 2 === workInProgressSuspendedReason && - workInProgressRoot === root && - (workInProgressSuspendedReason = 7); - ensureRootIsScheduled(root); - }; - thrownValue.then(lanes, lanes); - break a; - case 3: - workInProgressSuspendedReason = 7; - break a; - case 4: - workInProgressSuspendedReason = 5; - break a; - case 7: - isThenableResolved(thrownValue) - ? ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - replaySuspendedUnitOfWork(lanes)) - : ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, lanes, thrownValue)); - break; - case 5: - switch (workInProgress.tag) { - case 5: - case 26: - case 27: - lanes = workInProgress; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - var sibling = lanes.sibling; - if (null !== sibling) workInProgress = sibling; - else { - var returnFiber = lanes.return; - null !== returnFiber - ? ((workInProgress = returnFiber), - completeUnitOfWork(returnFiber)) - : (workInProgress = null); - } - break b; - } - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 6: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, thrownValue); - break; - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; +function scheduleUpdateOnFiber(root, fiber, lane) { + if ( + (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || + null !== root.cancelPendingCommit + ) + prepareFreshStack(root, 0), + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); + markRootUpdated(root, lane); + if (0 === (executionContext & 2) || root !== workInProgressRoot) + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )), + ensureRootIsScheduled(root), + 2 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now() + 500), + flushSyncWorkAcrossRoots_impl(!0)); +} +function performConcurrentWorkOnRoot(root, didTimeout) { + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var originalCallbackNode = root.callbackNode; + if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) + return null; + var lanes = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes : 0 + ); + if (0 === lanes) return null; + var exitStatus = (didTimeout = + 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes) && !didTimeout) + ? renderRootConcurrent(root, lanes) + : renderRootSync(root, lanes); + if (0 !== exitStatus) { + var renderWasConcurrent = didTimeout; + do { + if (6 === exitStatus) markRootSuspended(root, lanes, 0); + else { + didTimeout = root.current.alternate; + if ( + renderWasConcurrent && + !isRenderConsistentWithExternalStores(didTimeout) + ) { + exitStatus = renderRootSync(root, lanes); + renderWasConcurrent = !1; + continue; + } + if (2 === exitStatus) { + renderWasConcurrent = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + renderWasConcurrent + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + renderWasConcurrent, + errorRetryLanes + ))); + } + if (1 === exitStatus) + throw ( + ((originalCallbackNode = workInProgressRootFatalError), + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + originalCallbackNode) + ); + root.finishedWork = didTimeout; + root.finishedLanes = lanes; + a: { + renderWasConcurrent = root; + switch (exitStatus) { + case 0: + case 1: + throw Error("Root did not complete. This is a bug in React."); + case 4: + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + break a; + } + break; + case 2: + case 3: + case 5: + break; + default: + throw Error("Unknown root exit status."); + } + if ( + (lanes & 62914560) === lanes && + (alwaysThrottleRetries || 3 === exitStatus) && + ((exitStatus = globalMostRecentFallbackTime + 300 - now()), + 10 < exitStatus) + ) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; + renderWasConcurrent.timeoutHandle = scheduleTimeout( + commitRootWhenReady.bind( + null, + renderWasConcurrent, + didTimeout, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ), + exitStatus + ); break a; - default: - throw Error("Unexpected SuspendedReason. This is a bug in React."); + } + commitRootWhenReady( + renderWasConcurrent, + didTimeout, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ); } } - workLoopConcurrent(); break; - } catch (thrownValue$119) { - handleThrow(root, thrownValue$119); - } - while (1); - resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - executionContext = prevExecutionContext; - if (null !== workInProgress) return 0; - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; + } while (1); + } + ensureRootIsScheduled(root); + scheduleTaskForRootDuringMicrotask(root, now()); + root = + root.callbackNode === originalCallbackNode + ? performConcurrentWorkOnRoot.bind(null, root) + : null; + return root; } -function workLoopConcurrent() { - for (; null !== workInProgress && !shouldYield(); ) - performUnitOfWork(workInProgress); +function recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes +) { + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, + JSCompiler_inline_result; + (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && + (prepareFreshStack(root, errorRetryLanes).flags |= 256); + errorRetryLanes = renderRootSync(root, errorRetryLanes); + if (2 !== errorRetryLanes) { + if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) + return ( + (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), + (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), + 4 + ); + root = workInProgressRootRecoverableErrors; + workInProgressRootRecoverableErrors = errorsFromFirstAttempt; + null !== root && queueRecoverableErrors(root); + } + return errorRetryLanes; } -function performUnitOfWork(unitOfWork) { - var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - ReactCurrentOwner.current = null; +function queueRecoverableErrors(errors) { + null === workInProgressRootRecoverableErrors + ? (workInProgressRootRecoverableErrors = errors) + : workInProgressRootRecoverableErrors.push.apply( + workInProgressRootRecoverableErrors, + errors + ); } -function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; - switch (unitOfWork.tag) { - case 2: - unitOfWork.tag = 0; - case 15: - case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - var context = isContextProvider(Component) - ? previousContext - : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - context, - workInProgressRootRenderLanes - ); - break; - case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - unitOfWork.ref, - workInProgressRootRenderLanes - ); - break; - case 5: - resetHooksOnUnwind(unitOfWork); - default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); - } - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - ReactCurrentOwner.current = null; -} -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { - resetContextDependencies(); - resetHooksOnUnwind(unitOfWork); - thenableState$1 = null; - thenableIndexCounter$1 = 0; - var returnFiber = unitOfWork.return; - try { - if ( - throwException( - root, - returnFiber, - unitOfWork, - thrownValue, - workInProgressRootRenderLanes - ) - ) { - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; - } - } catch (error) { - if (null !== returnFiber) throw ((workInProgress = returnFiber), error); - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; - } - if (unitOfWork.flags & 32768) - a: { - root = unitOfWork; - do { - unitOfWork = unwindWork(root.alternate, root); - if (null !== unitOfWork) { - unitOfWork.flags &= 32767; - workInProgress = unitOfWork; - break a; - } - root = root.return; - null !== root && - ((root.flags |= 32768), - (root.subtreeFlags = 0), - (root.deletions = null)); - workInProgress = root; - } while (null !== root); - workInProgressRootExitStatus = 6; - workInProgress = null; - } - else completeUnitOfWork(unitOfWork); -} -function completeUnitOfWork(unitOfWork) { - var completedWork = unitOfWork; - do { - unitOfWork = completedWork.return; - var next = completeWork( - completedWork.alternate, - completedWork, - entangledRenderLanes - ); - if (null !== next) { - workInProgress = next; - return; - } - completedWork = completedWork.sibling; - if (null !== completedWork) { - workInProgress = completedWork; - return; - } - workInProgress = completedWork = unitOfWork; - } while (null !== completedWork); - 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); -} -function commitRoot( +function commitRootWhenReady( root, + finishedWork, recoverableErrors, transitions, didIncludeRenderPhaseUpdate, + lanes, spawnedLane ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; - try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - previousUpdateLanePriority, - spawnedLane - ); - } finally { - (ReactCurrentBatchConfig.transition = prevTransition), - (currentUpdatePriority = previousUpdateLanePriority); + 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); + commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane + ); +} +function isRenderConsistentWithExternalStores(finishedWork) { + for (var node = finishedWork; ; ) { + if (node.flags & 16384) { + var updateQueue = node.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.stores), null !== updateQueue) + ) + for (var i = 0; i < updateQueue.length; i++) { + var check = updateQueue[i], + getSnapshot = check.getSnapshot; + check = check.value; + try { + if (!objectIs(getSnapshot(), check)) return !1; + } catch (error) { + return !1; + } + } + } + updateQueue = node.child; + if (node.subtreeFlags & 16384 && null !== updateQueue) + (updateQueue.return = node), (node = updateQueue); + else { + if (node === finishedWork) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === finishedWork) return !0; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } } - return null; + return !0; } -function commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - renderPriorityLevel, - spawnedLane -) { - do flushPassiveEffects(); - while (null !== rootWithPendingPassiveEffects); - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; - if (null === finishedWork) return null; +function markRootUpdated(root, updatedLanes) { + root.pendingLanes |= updatedLanes; + 268435456 !== updatedLanes && + ((root.suspendedLanes = 0), (root.pingedLanes = 0)); + enableInfiniteRenderLoopDetection && + (executionContext & 2 + ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) + : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), + throwIfInfiniteUpdateLoopDetected()); +} +function markRootSuspended(root, suspendedLanes, spawnedLane) { + suspendedLanes &= ~workInProgressRootPingedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$7 = 31 - clz32(lanes), + lane = 1 << index$7; + expirationTimes[index$7] = -1; + lanes &= ~lane; + } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); +} +function resetWorkInProgressStack() { + if (null !== workInProgress) { + if (0 === workInProgressSuspendedReason) + var interruptedWork = workInProgress.return; + else + (interruptedWork = workInProgress), + resetContextDependencies(), + resetHooksOnUnwind(interruptedWork), + (thenableState$1 = null), + (thenableIndexCounter$1 = 0), + (interruptedWork = workInProgress); + for (; null !== interruptedWork; ) + unwindInterruptedWork(interruptedWork.alternate, interruptedWork), + (interruptedWork = interruptedWork.return); + workInProgress = null; + } +} +function prepareFreshStack(root, lanes) { root.finishedWork = null; root.finishedLanes = 0; - if (finishedWork === root.current) - throw Error( - "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." - ); - root.callbackNode = null; - root.callbackPriority = 0; - root.cancelPendingCommit = null; - var remainingLanes = finishedWork.lanes | finishedWork.childLanes; - remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes, spawnedLane); - didIncludeCommitPhaseUpdate = !1; - root === workInProgressRoot && - ((workInProgress = workInProgressRoot = null), - (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 10256) && - 0 === (finishedWork.flags & 10256)) || - rootDoesHavePassiveEffects || - ((rootDoesHavePassiveEffects = !0), - (pendingPassiveEffectsRemainingLanes = remainingLanes), - (pendingPassiveTransitions = transitions), - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - })); - transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; - spawnedLane = currentUpdatePriority; - currentUpdatePriority = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - ReactCurrentOwner.current = null; - commitBeforeMutationEffects(root, finishedWork); - commitMutationEffectsOnFiber(finishedWork, root); - root.current = finishedWork; - commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); - requestPaint(); - executionContext = prevExecutionContext; - currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; - } else root.current = finishedWork; - rootDoesHavePassiveEffects - ? ((rootDoesHavePassiveEffects = !1), - (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) - : releaseRootPooledCache(root, remainingLanes); - remainingLanes = root.pendingLanes; - 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); - onCommitRoot(finishedWork.stateNode, renderPriorityLevel); - ensureRootIsScheduled(root); - if (null !== recoverableErrors) + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + timeoutHandle = root.cancelPendingCommit; + null !== timeoutHandle && + ((root.cancelPendingCommit = null), timeoutHandle()); + resetWorkInProgressStack(); + workInProgressRoot = root; + workInProgress = timeoutHandle = createWorkInProgress(root.current, null); + workInProgressRootRenderLanes = lanes; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + workInProgressRootDidAttachPingListener = !1; + workInProgressRootExitStatus = 0; + workInProgressRootFatalError = null; + workInProgressDeferredLane = + workInProgressRootPingedLanes = + workInProgressRootInterleavedUpdatedLanes = + workInProgressRootSkippedLanes = + 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = + null; + workInProgressRootDidIncludeRecursiveRenderUpdate = !1; + 0 !== (lanes & 8) && (lanes |= lanes & 32); + var allEntangledLanes = root.entangledLanes; + if (0 !== allEntangledLanes) for ( - renderPriorityLevel = root.onRecoverableError, finishedWork = 0; - finishedWork < recoverableErrors.length; - finishedWork++ - ) - (remainingLanes = recoverableErrors[finishedWork]), - (transitions = { - digest: remainingLanes.digest, - componentStack: remainingLanes.stack - }), - renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); - 0 !== (pendingPassiveEffectsLanes & 3) && - 0 !== root.tag && - flushPassiveEffects(); - remainingLanes = root.pendingLanes; - (enableInfiniteRenderLoopDetection && - (didIncludeRenderPhaseUpdate || didIncludeCommitPhaseUpdate)) || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes)) - ? root === rootWithNestedUpdates - ? nestedUpdateCount++ - : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) - : (nestedUpdateCount = 0); - flushSyncWorkAcrossRoots_impl(!1); - return null; + root = root.entanglements, allEntangledLanes &= lanes; + 0 < allEntangledLanes; + + ) { + var index$5 = 31 - clz32(allEntangledLanes), + lane = 1 << index$5; + lanes |= root[index$5]; + allEntangledLanes &= ~lane; + } + entangledRenderLanes = lanes; + finishQueueingConcurrentUpdates(); + return timeoutHandle; } -function releaseRootPooledCache(root, remainingLanes) { - 0 === (root.pooledCacheLanes &= remainingLanes) && - ((remainingLanes = root.pooledCache), - null != remainingLanes && - ((root.pooledCache = null), releaseCache(remainingLanes))); +function handleThrow(root, thrownValue) { + currentlyRenderingFiber$1 = null; + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactCurrentOwner.current = null; + thrownValue === SuspenseException + ? ((thrownValue = getSuspendedThenable()), + (root = suspenseHandlerStackCursor.current), + (workInProgressSuspendedReason = + (null !== root && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + root !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2)) + : thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); + workInProgressThrownValue = thrownValue; + null === workInProgress && + ((workInProgressRootExitStatus = 1), + (workInProgressRootFatalError = thrownValue)); } -function flushPassiveEffects() { - if (null !== rootWithPendingPassiveEffects) { - var root = rootWithPendingPassiveEffects, - remainingLanes = pendingPassiveEffectsRemainingLanes; - pendingPassiveEffectsRemainingLanes = 0; - var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; +function pushDispatcher() { + var prevDispatcher = ReactCurrentDispatcher.current; + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; +} +function pushCacheDispatcher() { + var prevCacheDispatcher = ReactCurrentCache.current; + ReactCurrentCache.current = DefaultCacheDispatcher; + return prevCacheDispatcher; +} +function renderDidSuspendDelayIfPossible() { + workInProgressRootExitStatus = 4; + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); +} +function renderRootSync(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) + (workInProgressTransitions = null), prepareFreshStack(root, lanes); + lanes = !1; + a: do try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; - if (null === rootWithPendingPassiveEffects) - var JSCompiler_inline_result = !1; - else { - priority = pendingPassiveTransitions; - pendingPassiveTransitions = null; - var root$jscomp$0 = rootWithPendingPassiveEffects, - lanes = pendingPassiveEffectsLanes; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsLanes = 0; - if (0 !== (executionContext & 6)) - throw Error("Cannot flush passive effects while already rendering."); - var prevExecutionContext = executionContext; - executionContext |= 4; - commitPassiveUnmountOnFiber(root$jscomp$0.current); - commitPassiveMountOnFiber( - root$jscomp$0, - root$jscomp$0.current, - lanes, - priority - ); - executionContext = prevExecutionContext; - flushSyncWorkAcrossRoots_impl(!1); - if ( - injectedHook && - "function" === typeof injectedHook.onPostCommitFiberRoot - ) - try { - injectedHook.onPostCommitFiberRoot(rendererID, root$jscomp$0); - } catch (err) {} - JSCompiler_inline_result = !0; + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + var unitOfWork = workInProgress, + thrownValue = workInProgressThrownValue; + switch (workInProgressSuspendedReason) { + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + case 3: + case 2: + lanes || + null !== suspenseHandlerStackCursor.current || + (lanes = !0); + default: + (workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, unitOfWork, thrownValue); + } } - return JSCompiler_inline_result; - } finally { - (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), - releaseRootPooledCache(root, remainingLanes); + workLoopSync(); + break; + } catch (thrownValue$117) { + handleThrow(root, thrownValue$117); } - } - return !1; + while (1); + lanes && root.shellSuspendCounter++; + resetContextDependencies(); + executionContext = prevExecutionContext; + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + if (null !== workInProgress) + throw Error( + "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." + ); + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; } -function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); - rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); - null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); +function workLoopSync() { + for (; null !== workInProgress; ) performUnitOfWork(workInProgress); } -function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { - if (3 === sourceFiber.tag) - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - else - for (; null !== nearestMountedAncestor; ) { - if (3 === nearestMountedAncestor.tag) { - captureCommitPhaseErrorOnRoot( - nearestMountedAncestor, - sourceFiber, - error - ); - break; - } else if (1 === nearestMountedAncestor.tag) { - var instance = nearestMountedAncestor.stateNode; - if ( - "function" === - typeof nearestMountedAncestor.type.getDerivedStateFromError || - ("function" === typeof instance.componentDidCatch && - (null === legacyErrorBoundariesThatAlreadyFailed || - !legacyErrorBoundariesThatAlreadyFailed.has(instance))) - ) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createClassErrorUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - nearestMountedAncestor = enqueueUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - null !== nearestMountedAncestor && - (markRootUpdated(nearestMountedAncestor, 2), - ensureRootIsScheduled(nearestMountedAncestor)); - break; +function renderRootConcurrent(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) + (workInProgressTransitions = null), + (workInProgressRootRenderTargetTime = now() + 500), + prepareFreshStack(root, lanes); + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + lanes = workInProgress; + var thrownValue = workInProgressThrownValue; + b: switch (workInProgressSuspendedReason) { + case 1: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 2: + if (isThenableResolved(thrownValue)) { + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + replaySuspendedUnitOfWork(lanes); + break; + } + lanes = function () { + 2 === workInProgressSuspendedReason && + workInProgressRoot === root && + (workInProgressSuspendedReason = 7); + ensureRootIsScheduled(root); + }; + thrownValue.then(lanes, lanes); + break a; + case 3: + workInProgressSuspendedReason = 7; + break a; + case 4: + workInProgressSuspendedReason = 5; + break a; + case 7: + isThenableResolved(thrownValue) + ? ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + replaySuspendedUnitOfWork(lanes)) + : ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, lanes, thrownValue)); + break; + case 5: + switch (workInProgress.tag) { + case 5: + case 26: + case 27: + lanes = workInProgress; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + var sibling = lanes.sibling; + if (null !== sibling) workInProgress = sibling; + else { + var returnFiber = lanes.return; + null !== returnFiber + ? ((workInProgress = returnFiber), + completeUnitOfWork(returnFiber)) + : (workInProgress = null); + } + break b; + } + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 6: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, thrownValue); + break; + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + default: + throw Error("Unexpected SuspendedReason. This is a bug in React."); } } - nearestMountedAncestor = nearestMountedAncestor.return; + workLoopConcurrent(); + break; + } catch (thrownValue$119) { + handleThrow(root, thrownValue$119); } + while (1); + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + executionContext = prevExecutionContext; + if (null !== workInProgress) return 0; + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; } -function attachPingListener(root, wakeable, lanes) { - var pingCache = root.pingCache; - if (null === pingCache) { - pingCache = root.pingCache = new PossiblyWeakMap(); - var threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else - (threadIDs = pingCache.get(wakeable)), - void 0 === threadIDs && - ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); - threadIDs.has(lanes) || - ((workInProgressRootDidAttachPingListener = !0), - threadIDs.add(lanes), - (root = pingSuspendedRoot.bind(null, root, wakeable, lanes)), - wakeable.then(root, root)); -} -function pingSuspendedRoot(root, wakeable, pingedLanes) { - var pingCache = root.pingCache; - null !== pingCache && pingCache.delete(wakeable); - root.pingedLanes |= root.suspendedLanes & pingedLanes; - enableInfiniteRenderLoopDetection && - (executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), - throwIfInfiniteUpdateLoopDetected()); - workInProgressRoot === root && - (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && - (4 === workInProgressRootExitStatus || - (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes && - 300 > now() - globalMostRecentFallbackTime) - ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) - : (workInProgressRootPingedLanes |= pingedLanes)); - ensureRootIsScheduled(root); -} -function retryTimedOutBoundary(boundaryFiber, retryLane) { - 0 === retryLane && - (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); - boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); - null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), - ensureRootIsScheduled(boundaryFiber)); +function workLoopConcurrent() { + for (; null !== workInProgress && !shouldYield(); ) + performUnitOfWork(workInProgress); } -function retryDehydratedSuspenseBoundary(boundaryFiber) { - var suspenseState = boundaryFiber.memoizedState, - retryLane = 0; - null !== suspenseState && (retryLane = suspenseState.retryLane); - retryTimedOutBoundary(boundaryFiber, retryLane); +function performUnitOfWork(unitOfWork) { + var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); + ReactCurrentOwner.current = null; } -function resolveRetryWakeable(boundaryFiber, wakeable) { - var retryLane = 0; - switch (boundaryFiber.tag) { - case 13: - var retryCache = boundaryFiber.stateNode; - var suspenseState = boundaryFiber.memoizedState; - null !== suspenseState && (retryLane = suspenseState.retryLane); - break; - case 19: - retryCache = boundaryFiber.stateNode; +function replaySuspendedUnitOfWork(unitOfWork) { + var current = unitOfWork.alternate; + switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; + case 15: + case 0: + var Component = unitOfWork.type, + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor$1.current; + context = getMaskedContext(unitOfWork, context); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + context, + workInProgressRootRenderLanes + ); break; - case 22: - retryCache = boundaryFiber.stateNode._retryCache; + case 11: + Component = unitOfWork.type.render; + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + unitOfWork.ref, + workInProgressRootRenderLanes + ); break; + case 5: + resetHooksOnUnwind(unitOfWork); default: - throw Error( - "Pinged unknown suspense boundary type. This is probably a bug in React." - ); + unwindInterruptedWork(current, unitOfWork), + (unitOfWork = workInProgress = + resetWorkInProgress(unitOfWork, entangledRenderLanes)), + (current = beginWork(current, unitOfWork, entangledRenderLanes)); } - null !== retryCache && retryCache.delete(wakeable); - retryTimedOutBoundary(boundaryFiber, retryLane); -} -function throwIfInfiniteUpdateLoopDetected() { - if (50 < nestedUpdateCount) - throw ( - ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - enableInfiniteRenderLoopDetection && - executionContext & 2 && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - )) - ); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current + ? completeUnitOfWork(unitOfWork) + : (workInProgress = current); + ReactCurrentOwner.current = null; } -var beginWork; -beginWork = function (current, workInProgress, renderLanes) { - if (null !== current) +function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + resetContextDependencies(); + resetHooksOnUnwind(unitOfWork); + thenableState$1 = null; + thenableIndexCounter$1 = 0; + var returnFiber = unitOfWork.return; + try { if ( - current.memoizedProps !== workInProgress.pendingProps || - didPerformWorkStackCursor.current - ) - didReceiveUpdate = !0; - else { - if ( - 0 === (current.lanes & renderLanes) && - 0 === (workInProgress.flags & 128) + throwException( + root, + returnFiber, + unitOfWork, + thrownValue, + workInProgressRootRenderLanes ) - return ( - (didReceiveUpdate = !1), - attemptEarlyBailoutIfNoScheduledUpdate( - current, - workInProgress, - renderLanes - ) - ); - didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; + ) { + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; } - else didReceiveUpdate = !1; - workInProgress.lanes = 0; - switch (workInProgress.tag) { - case 2: - var Component = workInProgress.type; - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - var context = getMaskedContext( - workInProgress, - contextStackCursor$1.current - ); - prepareToReadContext(workInProgress, renderLanes); - current = renderWithHooks( - null, - workInProgress, - Component, - current, - context, - renderLanes - ); - workInProgress.flags |= 1; - workInProgress.tag = 0; - reconcileChildren(null, workInProgress, current, renderLanes); - workInProgress = workInProgress.child; - return workInProgress; - case 16: - Component = workInProgress.elementType; - a: { - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - context = Component._init; - Component = context(Component._payload); - workInProgress.type = Component; - context = workInProgress.tag = resolveLazyComponentTag(Component); - current = resolveDefaultProps(Component, current); - switch (context) { - case 0: - workInProgress = updateFunctionComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 1: - workInProgress = updateClassComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 11: - workInProgress = updateForwardRef( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 14: - workInProgress = updateMemoComponent( - null, - workInProgress, - Component, - resolveDefaultProps(Component.type, current), - renderLanes - ); - break a; + } catch (error) { + if (null !== returnFiber) throw ((workInProgress = returnFiber), error); + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + if (unitOfWork.flags & 32768) + a: { + root = unitOfWork; + do { + unitOfWork = unwindWork(root.alternate, root); + if (null !== unitOfWork) { + unitOfWork.flags &= 32767; + workInProgress = unitOfWork; + break a; } - throw Error( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." - ); - } - return workInProgress; - case 0: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateFunctionComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 1: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateClassComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) + root = root.return; + null !== root && + ((root.flags |= 32768), + (root.subtreeFlags = 0), + (root.deletions = null)); + workInProgress = root; + } while (null !== root); + workInProgressRootExitStatus = 6; + workInProgress = null; + } + else completeUnitOfWork(unitOfWork); +} +function completeUnitOfWork(unitOfWork) { + var completedWork = unitOfWork; + do { + unitOfWork = completedWork.return; + var next = completeWork( + completedWork.alternate, + completedWork, + entangledRenderLanes + ); + if (null !== next) { + workInProgress = next; + return; + } + completedWork = completedWork.sibling; + if (null !== completedWork) { + workInProgress = completedWork; + return; + } + workInProgress = completedWork = unitOfWork; + } while (null !== completedWork); + 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); +} +function commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane +) { + var previousUpdateLanePriority = currentUpdatePriority, + prevTransition = ReactCurrentBatchConfig.transition; + try { + (ReactCurrentBatchConfig.transition = null), + (currentUpdatePriority = 2), + commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + previousUpdateLanePriority, + spawnedLane ); - case 3: - pushHostRootContext(workInProgress); - if (null === current) - throw Error("Should have a current fiber. This is a bug in React."); - var nextProps = workInProgress.pendingProps; - context = workInProgress.memoizedState; - Component = context.element; - cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, nextProps, null, renderLanes); - nextProps = workInProgress.memoizedState; - var nextCache = nextProps.cache; - pushProvider(workInProgress, CacheContext, nextCache); - nextCache !== context.cache && - propagateContextChange(workInProgress, CacheContext, renderLanes); - suspendIfUpdateReadFromEntangledAsyncAction(); - context = nextProps.element; - context === Component - ? (workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - )) - : (reconcileChildren(current, workInProgress, context, renderLanes), - (workInProgress = workInProgress.child)); - return workInProgress; - case 26: - case 27: - case 5: - pushHostContext(workInProgress); - Component = workInProgress.pendingProps.children; - if (enableAsyncActions && null !== workInProgress.memoizedState) { - if (!enableAsyncActions) throw Error("Not implemented."); - context = renderWithHooks( - current, - workInProgress, - TransitionAwareHostComponent, - null, - null, - renderLanes - ); - HostTransitionContext._currentValue = context; - didReceiveUpdate && - null !== current && - current.memoizedState.memoizedState !== context && - propagateContextChange( - workInProgress, - HostTransitionContext, - renderLanes - ); - } - markRef(current, workInProgress); - reconcileChildren(current, workInProgress, Component, renderLanes); - return workInProgress.child; - case 6: + } finally { + (ReactCurrentBatchConfig.transition = prevTransition), + (currentUpdatePriority = previousUpdateLanePriority); + } + return null; +} +function commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + renderPriorityLevel, + spawnedLane +) { + do flushPassiveEffects(); + while (null !== rootWithPendingPassiveEffects); + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var finishedWork = root.finishedWork, + lanes = root.finishedLanes; + if (null === finishedWork) return null; + root.finishedWork = null; + root.finishedLanes = 0; + if (finishedWork === root.current) + throw Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ); + root.callbackNode = null; + root.callbackPriority = 0; + root.cancelPendingCommit = null; + var remainingLanes = finishedWork.lanes | finishedWork.childLanes; + remainingLanes |= concurrentlyUpdatedLanes; + markRootFinished(root, remainingLanes, spawnedLane); + didIncludeCommitPhaseUpdate = !1; + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), + (workInProgressRootRenderLanes = 0)); + (0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || + rootDoesHavePassiveEffects || + ((rootDoesHavePassiveEffects = !0), + (pendingPassiveEffectsRemainingLanes = remainingLanes), + (pendingPassiveTransitions = transitions), + scheduleCallback(NormalPriority$1, function () { + flushPassiveEffects(); return null; - case 13: - return updateSuspenseComponent(current, workInProgress, renderLanes); - case 4: - return ( - pushHostContainer( - workInProgress, - workInProgress.stateNode.containerInfo - ), - (Component = workInProgress.pendingProps), - null === current - ? (workInProgress.child = reconcileChildFibers( - workInProgress, - null, - Component, - renderLanes - )) - : reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 11: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateForwardRef( - current, - workInProgress, - Component, - context, - renderLanes + })); + transitions = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { + transitions = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = null; + spawnedLane = currentUpdatePriority; + currentUpdatePriority = 2; + var prevExecutionContext = executionContext; + executionContext |= 4; + ReactCurrentOwner.current = null; + commitBeforeMutationEffects(root, finishedWork); + commitMutationEffectsOnFiber(finishedWork, root); + root.current = finishedWork; + commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); + requestPaint(); + executionContext = prevExecutionContext; + currentUpdatePriority = spawnedLane; + ReactCurrentBatchConfig.transition = transitions; + } else root.current = finishedWork; + rootDoesHavePassiveEffects + ? ((rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsLanes = lanes)) + : releaseRootPooledCache(root, remainingLanes); + remainingLanes = root.pendingLanes; + 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); + onCommitRoot(finishedWork.stateNode, renderPriorityLevel); + ensureRootIsScheduled(root); + if (null !== recoverableErrors) + for ( + renderPriorityLevel = root.onRecoverableError, finishedWork = 0; + finishedWork < recoverableErrors.length; + finishedWork++ + ) + (remainingLanes = recoverableErrors[finishedWork]), + (transitions = { + digest: remainingLanes.digest, + componentStack: remainingLanes.stack + }), + renderPriorityLevel(remainingLanes.value, transitions); + if (hasUncaughtError) + throw ( + ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root) + ); + 0 !== (pendingPassiveEffectsLanes & 3) && + 0 !== root.tag && + flushPassiveEffects(); + remainingLanes = root.pendingLanes; + (enableInfiniteRenderLoopDetection && + (didIncludeRenderPhaseUpdate || didIncludeCommitPhaseUpdate)) || + (0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes)) + ? root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) + : (nestedUpdateCount = 0); + flushSyncWorkAcrossRoots_impl(!1); + return null; +} +function releaseRootPooledCache(root, remainingLanes) { + 0 === (root.pooledCacheLanes &= remainingLanes) && + ((remainingLanes = root.pooledCache), + null != remainingLanes && + ((root.pooledCache = null), releaseCache(remainingLanes))); +} +function flushPassiveEffects() { + if (null !== rootWithPendingPassiveEffects) { + var root = rootWithPendingPassiveEffects, + remainingLanes = pendingPassiveEffectsRemainingLanes; + pendingPassiveEffectsRemainingLanes = 0; + var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), + priority = 32 > renderPriority ? 32 : renderPriority; + renderPriority = ReactCurrentBatchConfig.transition; + var previousPriority = currentUpdatePriority; + try { + ReactCurrentBatchConfig.transition = null; + currentUpdatePriority = priority; + if (null === rootWithPendingPassiveEffects) + var JSCompiler_inline_result = !1; + else { + priority = pendingPassiveTransitions; + pendingPassiveTransitions = null; + var root$jscomp$0 = rootWithPendingPassiveEffects, + lanes = pendingPassiveEffectsLanes; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsLanes = 0; + if (0 !== (executionContext & 6)) + throw Error("Cannot flush passive effects while already rendering."); + var prevExecutionContext = executionContext; + executionContext |= 4; + commitPassiveUnmountOnFiber(root$jscomp$0.current); + commitPassiveMountOnFiber( + root$jscomp$0, + root$jscomp$0.current, + lanes, + priority + ); + executionContext = prevExecutionContext; + flushSyncWorkAcrossRoots_impl(!1); + if ( + injectedHook && + "function" === typeof injectedHook.onPostCommitFiberRoot ) - ); - case 7: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps, - renderLanes - ), - workInProgress.child - ); - case 8: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 12: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 10: - a: { - Component = enableRenderableContext - ? workInProgress.type - : workInProgress.type._context; - context = workInProgress.pendingProps; - nextProps = workInProgress.memoizedProps; - nextCache = context.value; - pushProvider(workInProgress, Component, nextCache); - if (null !== nextProps) - if (objectIs(nextProps.value, nextCache)) { - if ( - nextProps.children === context.children && - !didPerformWorkStackCursor.current - ) { - workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - ); - break a; - } - } else propagateContextChange(workInProgress, Component, renderLanes); - reconcileChildren( - current, - workInProgress, - context.children, - renderLanes + try { + injectedHook.onPostCommitFiberRoot(rendererID, root$jscomp$0); + } catch (err) {} + JSCompiler_inline_result = !0; + } + return JSCompiler_inline_result; + } finally { + (currentUpdatePriority = previousPriority), + (ReactCurrentBatchConfig.transition = renderPriority), + releaseRootPooledCache(root, remainingLanes); + } + } + return !1; +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); + null !== rootFiber && + (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); +} +function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (; null !== nearestMountedAncestor; ) { + if (3 === nearestMountedAncestor.tag) { + captureCommitPhaseErrorOnRoot( + nearestMountedAncestor, + sourceFiber, + error ); - workInProgress = workInProgress.child; + break; + } else if (1 === nearestMountedAncestor.tag) { + var instance = nearestMountedAncestor.stateNode; + if ( + "function" === + typeof nearestMountedAncestor.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createClassErrorUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + nearestMountedAncestor = enqueueUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + null !== nearestMountedAncestor && + (markRootUpdated(nearestMountedAncestor, 2), + ensureRootIsScheduled(nearestMountedAncestor)); + break; + } } - return workInProgress; - case 9: - return ( - (context = enableRenderableContext - ? workInProgress.type._context - : workInProgress.type), - (Component = workInProgress.pendingProps.children), - prepareToReadContext(workInProgress, renderLanes), - (context = readContext(context)), - (Component = Component(context)), - (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 14: - return ( - (Component = workInProgress.type), - (context = resolveDefaultProps(Component, workInProgress.pendingProps)), - (context = resolveDefaultProps(Component.type, context)), - updateMemoComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 15: - return updateSimpleMemoComponent( - current, - workInProgress, - workInProgress.type, - workInProgress.pendingProps, - renderLanes - ); - case 17: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), - (workInProgress.tag = 1), - isContextProvider(Component) - ? ((current = !0), pushContextProvider(workInProgress)) - : (current = !1), - prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, Component, context), - mountClassInstance(workInProgress, Component, context, renderLanes), - finishClassComponent( - null, - workInProgress, - Component, - !0, - current, - renderLanes - ) - ); + nearestMountedAncestor = nearestMountedAncestor.return; + } +} +function attachPingListener(root, wakeable, lanes) { + var pingCache = root.pingCache; + if (null === pingCache) { + pingCache = root.pingCache = new PossiblyWeakMap(); + var threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } else + (threadIDs = pingCache.get(wakeable)), + void 0 === threadIDs && + ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); + threadIDs.has(lanes) || + ((workInProgressRootDidAttachPingListener = !0), + threadIDs.add(lanes), + (root = pingSuspendedRoot.bind(null, root, wakeable, lanes)), + wakeable.then(root, root)); +} +function pingSuspendedRoot(root, wakeable, pingedLanes) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(wakeable); + root.pingedLanes |= root.suspendedLanes & pingedLanes; + enableInfiniteRenderLoopDetection && + (executionContext & 2 + ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) + : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), + throwIfInfiniteUpdateLoopDetected()); + workInProgressRoot === root && + (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && + (4 === workInProgressRootExitStatus || + (3 === workInProgressRootExitStatus && + (workInProgressRootRenderLanes & 62914560) === + workInProgressRootRenderLanes && + 300 > now() - globalMostRecentFallbackTime) + ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) + : (workInProgressRootPingedLanes |= pingedLanes)); + ensureRootIsScheduled(root); +} +function retryTimedOutBoundary(boundaryFiber, retryLane) { + 0 === retryLane && + (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); + boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); + null !== boundaryFiber && + (markRootUpdated(boundaryFiber, retryLane), + ensureRootIsScheduled(boundaryFiber)); +} +function retryDehydratedSuspenseBoundary(boundaryFiber) { + var suspenseState = boundaryFiber.memoizedState, + retryLane = 0; + null !== suspenseState && (retryLane = suspenseState.retryLane); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function resolveRetryWakeable(boundaryFiber, wakeable) { + var retryLane = 0; + switch (boundaryFiber.tag) { + case 13: + var retryCache = boundaryFiber.stateNode; + var suspenseState = boundaryFiber.memoizedState; + null !== suspenseState && (retryLane = suspenseState.retryLane); + break; case 19: - return updateSuspenseListComponent(current, workInProgress, renderLanes); + retryCache = boundaryFiber.stateNode; + break; case 22: - return updateOffscreenComponent(current, workInProgress, renderLanes); - case 24: - return ( - prepareToReadContext(workInProgress, renderLanes), - (Component = readContext(CacheContext)), - null === current - ? ((context = peekCacheFromPool()), - null === context && - ((context = workInProgressRoot), - (nextProps = createCache()), - (context.pooledCache = nextProps), - nextProps.refCount++, - null !== nextProps && (context.pooledCacheLanes |= renderLanes), - (context = nextProps)), - (workInProgress.memoizedState = { - parent: Component, - cache: context - }), - initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, context)) - : (0 !== (current.lanes & renderLanes) && - (cloneUpdateQueue(current, workInProgress), - processUpdateQueue(workInProgress, null, null, renderLanes), - suspendIfUpdateReadFromEntangledAsyncAction()), - (context = current.memoizedState), - (nextProps = workInProgress.memoizedState), - context.parent !== Component - ? ((context = { parent: Component, cache: Component }), - (workInProgress.memoizedState = context), - 0 === workInProgress.lanes && - (workInProgress.memoizedState = - workInProgress.updateQueue.baseState = - context), - pushProvider(workInProgress, CacheContext, Component)) - : ((Component = nextProps.cache), - pushProvider(workInProgress, CacheContext, Component), - Component !== context.cache && - propagateContextChange( - workInProgress, - CacheContext, - renderLanes - ))), - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child + retryCache = boundaryFiber.stateNode._retryCache; + break; + default: + throw Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." ); } - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); -}; + null !== retryCache && retryCache.delete(wakeable); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function throwIfInfiniteUpdateLoopDetected() { + if (50 < nestedUpdateCount) + throw ( + ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + enableInfiniteRenderLoopDetection && + executionContext & 2 && + null !== workInProgressRoot && + (workInProgressRoot.errorRecoveryDisabledLanes |= + workInProgressRootRenderLanes), + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + )) + ); +} function scheduleCallback(priorityLevel, callback) { return scheduleCallback$3(priorityLevel, callback); } @@ -10854,10 +10811,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1175 = { + devToolsConfig$jscomp$inline_1172 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-canary-3ee67a63", + version: "18.3.0-canary-37861bfd", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10873,11 +10830,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1416 = { - bundleType: devToolsConfig$jscomp$inline_1175.bundleType, - version: devToolsConfig$jscomp$inline_1175.version, - rendererPackageName: devToolsConfig$jscomp$inline_1175.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1175.rendererConfig, +var internals$jscomp$inline_1413 = { + bundleType: devToolsConfig$jscomp$inline_1172.bundleType, + version: devToolsConfig$jscomp$inline_1172.version, + rendererPackageName: devToolsConfig$jscomp$inline_1172.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1172.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10893,26 +10850,26 @@ var internals$jscomp$inline_1416 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1175.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1172.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-3ee67a63" + reconcilerVersion: "18.3.0-canary-37861bfd" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1417 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1414 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1417.isDisabled && - hook$jscomp$inline_1417.supportsFiber + !hook$jscomp$inline_1414.isDisabled && + hook$jscomp$inline_1414.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1417.inject( - internals$jscomp$inline_1416 + (rendererID = hook$jscomp$inline_1414.inject( + internals$jscomp$inline_1413 )), - (injectedHook = hook$jscomp$inline_1417); + (injectedHook = hook$jscomp$inline_1414); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 1d5b50c440fe6..9115e2107479c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<40cce64c667942ad2417fd8c5505f8c3>> + * @generated SignedSource<<878b40dd229cc170345d5ba63c7e6666>> */ "use strict"; @@ -19,62 +19,20 @@ require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), React = require("react"), dynamicFlags = require("ReactNativeInternalFeatureFlags"), - Scheduler = require("scheduler"); -function invokeGuardedCallbackImpl(name, func, context) { - var funcArgs = Array.prototype.slice.call(arguments, 3); - try { - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } -} -var hasError = !1, + Scheduler = require("scheduler"), + isArrayImpl = Array.isArray, + hasError = !1, caughtError = null, - hasRethrowError = !1, - rethrowError = null, - reporter = { - onError: function (error) { - hasError = !0; - caughtError = error; - } - }; -function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = !1; - caughtError = null; - invokeGuardedCallbackImpl.apply(reporter, arguments); -} -function invokeGuardedCallbackAndCatchFirstError( - name, - func, - context, - a, - b, - c, - d, - e, - f -) { - invokeGuardedCallback.apply(this, arguments); - if (hasError) { - if (hasError) { - var error = caughtError; - hasError = !1; - caughtError = null; - } else - throw Error( - "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." - ); - hasRethrowError || ((hasRethrowError = !0), (rethrowError = error)); - } -} -var isArrayImpl = Array.isArray, getFiberCurrentPropsFromNode$1 = null, getInstanceFromNode = null, getNodeFromInstance = null; function executeDispatch(event, listener, inst) { - var type = event.type || "unknown-event"; event.currentTarget = getNodeFromInstance(inst); - invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event); + try { + listener(event); + } catch (error) { + hasError || ((hasError = !0), (caughtError = error)); + } event.currentTarget = null; } function executeDirectDispatch(event) { @@ -939,7 +897,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_277 = { +var injectedNamesToPlugins$jscomp$inline_274 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -985,32 +943,32 @@ var injectedNamesToPlugins$jscomp$inline_277 = { } } }, - isOrderingDirty$jscomp$inline_278 = !1, - pluginName$jscomp$inline_279; -for (pluginName$jscomp$inline_279 in injectedNamesToPlugins$jscomp$inline_277) + isOrderingDirty$jscomp$inline_275 = !1, + pluginName$jscomp$inline_276; +for (pluginName$jscomp$inline_276 in injectedNamesToPlugins$jscomp$inline_274) if ( - injectedNamesToPlugins$jscomp$inline_277.hasOwnProperty( - pluginName$jscomp$inline_279 + injectedNamesToPlugins$jscomp$inline_274.hasOwnProperty( + pluginName$jscomp$inline_276 ) ) { - var pluginModule$jscomp$inline_280 = - injectedNamesToPlugins$jscomp$inline_277[pluginName$jscomp$inline_279]; + var pluginModule$jscomp$inline_277 = + injectedNamesToPlugins$jscomp$inline_274[pluginName$jscomp$inline_276]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_279) || - namesToPlugins[pluginName$jscomp$inline_279] !== - pluginModule$jscomp$inline_280 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_276) || + namesToPlugins[pluginName$jscomp$inline_276] !== + pluginModule$jscomp$inline_277 ) { - if (namesToPlugins[pluginName$jscomp$inline_279]) + if (namesToPlugins[pluginName$jscomp$inline_276]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_279 + "`.") + (pluginName$jscomp$inline_276 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_279] = - pluginModule$jscomp$inline_280; - isOrderingDirty$jscomp$inline_278 = !0; + namesToPlugins[pluginName$jscomp$inline_276] = + pluginModule$jscomp$inline_277; + isOrderingDirty$jscomp$inline_275 = !0; } } -isOrderingDirty$jscomp$inline_278 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_275 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -1086,11 +1044,11 @@ function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." ); - if (hasRethrowError) + if (hasError) throw ( - ((JSCompiler_inline_result = rethrowError), - (hasRethrowError = !1), - (rethrowError = null), + ((JSCompiler_inline_result = caughtError), + (hasError = !1), + (caughtError = null), JSCompiler_inline_result) ); } @@ -6814,655 +6772,412 @@ function attemptEarlyBailoutIfNoScheduledUpdate( } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } -var valueCursor = createCursor(null), - currentlyRenderingFiber = null, - lastContextDependency = null, - lastFullyObservedContext = null; -function resetContextDependencies() { - lastFullyObservedContext = - lastContextDependency = - currentlyRenderingFiber = - null; -} -function pushProvider(providerFiber, context, nextValue) { - push(valueCursor, context._currentValue); - context._currentValue = nextValue; -} -function popProvider(context) { - context._currentValue = valueCursor.current; - 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 propagateContextChange(workInProgress, context, renderLanes) { - var fiber = workInProgress.child; - null !== fiber && (fiber.return = workInProgress); - for (; null !== fiber; ) { - var list = fiber.dependencies; - if (null !== list) { - var nextFiber = fiber.child; - for (var dependency = list.firstContext; null !== dependency; ) { - if (dependency.context === context) { - if (1 === fiber.tag) { - dependency = createUpdate(renderLanes & -renderLanes); - dependency.tag = 2; - var updateQueue = fiber.updateQueue; - if (null !== updateQueue) { - updateQueue = updateQueue.shared; - var pending = updateQueue.pending; - null === pending - ? (dependency.next = dependency) - : ((dependency.next = pending.next), - (pending.next = dependency)); - updateQueue.pending = dependency; - } - } - fiber.lanes |= renderLanes; - dependency = fiber.alternate; - null !== dependency && (dependency.lanes |= renderLanes); - scheduleContextWorkOnParentPath( - fiber.return, - renderLanes, - workInProgress - ); - list.lanes |= renderLanes; - break; - } - dependency = dependency.next; - } - } else if (10 === fiber.tag) - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - else if (18 === fiber.tag) { - nextFiber = fiber.return; - if (null === nextFiber) - throw Error( - "We just came from a parent so we must have had a parent. This is a bug in React." +function beginWork(current, workInProgress, renderLanes) { + if (null !== current) + if ( + current.memoizedProps !== workInProgress.pendingProps || + didPerformWorkStackCursor.current + ) + didReceiveUpdate = !0; + else { + if ( + 0 === (current.lanes & renderLanes) && + 0 === (workInProgress.flags & 128) + ) + return ( + (didReceiveUpdate = !1), + attemptEarlyBailoutIfNoScheduledUpdate( + current, + workInProgress, + renderLanes + ) ); - nextFiber.lanes |= renderLanes; - list = nextFiber.alternate; - null !== list && (list.lanes |= renderLanes); - scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); - nextFiber = fiber.sibling; - } 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; + didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; + } + else didReceiveUpdate = !1; + workInProgress.lanes = 0; + switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor$1.current + ); + prepareToReadContext(workInProgress, renderLanes); + markComponentRenderStarted(workInProgress); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + markComponentRenderStopped(); + workInProgress.flags |= 1; + workInProgress.tag = 0; + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; + case 16: + Component = workInProgress.elementType; + a: { + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } - nextFiber = nextFiber.return; - } - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastFullyObservedContext = lastContextDependency = null; - workInProgress = workInProgress.dependencies; - null !== workInProgress && - null !== workInProgress.firstContext && - (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), - (workInProgress.firstContext = null)); -} -function readContext(context) { - return readContextForConsumer(currentlyRenderingFiber, context); -} -function readContextDuringReconcilation(consumer, context, renderLanes) { - null === currentlyRenderingFiber && - prepareToReadContext(consumer, renderLanes); - return readContextForConsumer(consumer, context); -} -function readContextForConsumer(consumer, context) { - var value = context._currentValue; - if (lastFullyObservedContext !== context) - if ( - ((context = { context: context, memoizedValue: value, next: null }), - null === lastContextDependency) - ) { - if (null === consumer) throw Error( - "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + "Element type is invalid. Received a promise that resolves to: " + + Component + + ". Lazy element type must resolve to a class or function." ); - lastContextDependency = context; - consumer.dependencies = { lanes: 0, firstContext: context }; - } else lastContextDependency = lastContextDependency.next = context; - return value; -} -var AbortControllerLocal = - "undefined" !== typeof AbortController - ? AbortController - : function () { - var listeners = [], - signal = (this.signal = { - aborted: !1, - addEventListener: function (type, listener) { - listeners.push(listener); - } - }); - this.abort = function () { - signal.aborted = !0; - listeners.forEach(function (listener) { - return listener(); - }); - }; - }, - scheduleCallback$1 = Scheduler.unstable_scheduleCallback, - NormalPriority = Scheduler.unstable_NormalPriority, - CacheContext = { - $$typeof: REACT_CONTEXT_TYPE, - Consumer: null, - Provider: null, - _currentValue: null, - _currentValue2: null, - _threadCount: 0 - }; -function createCache() { - return { - controller: new AbortControllerLocal(), - data: new Map(), - refCount: 0 - }; -} -function releaseCache(cache) { - cache.refCount--; - 0 === cache.refCount && - scheduleCallback$1(NormalPriority, function () { - cache.controller.abort(); - }); -} -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; - null !== transition && transition._callbacks.add(handleAsyncAction); - return transition; -} -function handleAsyncAction(transition, thenable) { - enableAsyncActions && entangleAsyncAction(transition, thenable); -} -function notifyTransitionCallbacks(transition, returnValue) { - transition._callbacks.forEach(function (callback) { - return callback(transition, returnValue); - }); -} -var resumedCache = createCursor(null); -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: CacheContext._currentValue, pool: cacheFromPool }; -} -function scheduleRetryEffect(workInProgress, retryQueue) { - null !== retryQueue - ? (workInProgress.flags |= 4) - : workInProgress.flags & 16384 && - ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), - (workInProgress.lanes |= retryQueue)); -} -function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { - switch (renderState.tailMode) { - case "hidden": - hasRenderedATailFallback = renderState.tail; - for (var lastTailNode = null; null !== hasRenderedATailFallback; ) - null !== hasRenderedATailFallback.alternate && - (lastTailNode = hasRenderedATailFallback), - (hasRenderedATailFallback = hasRenderedATailFallback.sibling); - null === lastTailNode - ? (renderState.tail = null) - : (lastTailNode.sibling = null); - break; - case "collapsed": - lastTailNode = renderState.tail; - for (var lastTailNode$76 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$76 = lastTailNode), - (lastTailNode = lastTailNode.sibling); - null === lastTailNode$76 - ? hasRenderedATailFallback || null === renderState.tail - ? (renderState.tail = null) - : (renderState.tail.sibling = null) - : (lastTailNode$76.sibling = null); - } -} -function bubbleProperties(completedWork) { - var didBailout = - null !== completedWork.alternate && - completedWork.alternate.child === completedWork.child, - newChildLanes = 0, - subtreeFlags = 0; - if (didBailout) - if (0 !== (completedWork.mode & 2)) { - for ( - var treeBaseDuration$78 = completedWork.selfBaseDuration, - child$79 = completedWork.child; - null !== child$79; - - ) - (newChildLanes |= child$79.lanes | child$79.childLanes), - (subtreeFlags |= child$79.subtreeFlags & 31457280), - (subtreeFlags |= child$79.flags & 31457280), - (treeBaseDuration$78 += child$79.treeBaseDuration), - (child$79 = child$79.sibling); - completedWork.treeBaseDuration = treeBaseDuration$78; - } else - for ( - treeBaseDuration$78 = completedWork.child; - null !== treeBaseDuration$78; - - ) - (newChildLanes |= - treeBaseDuration$78.lanes | treeBaseDuration$78.childLanes), - (subtreeFlags |= treeBaseDuration$78.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$78.flags & 31457280), - (treeBaseDuration$78.return = completedWork), - (treeBaseDuration$78 = treeBaseDuration$78.sibling); - else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$78 = completedWork.actualDuration; - child$79 = completedWork.selfBaseDuration; - for (var child = completedWork.child; null !== child; ) - (newChildLanes |= child.lanes | child.childLanes), - (subtreeFlags |= child.subtreeFlags), - (subtreeFlags |= child.flags), - (treeBaseDuration$78 += child.actualDuration), - (child$79 += child.treeBaseDuration), - (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$78; - completedWork.treeBaseDuration = child$79; - } else - for ( - treeBaseDuration$78 = completedWork.child; - null !== treeBaseDuration$78; - - ) - (newChildLanes |= - treeBaseDuration$78.lanes | treeBaseDuration$78.childLanes), - (subtreeFlags |= treeBaseDuration$78.subtreeFlags), - (subtreeFlags |= treeBaseDuration$78.flags), - (treeBaseDuration$78.return = completedWork), - (treeBaseDuration$78 = treeBaseDuration$78.sibling); - completedWork.subtreeFlags |= subtreeFlags; - completedWork.childLanes = newChildLanes; - return didBailout; -} -function completeWork(current, workInProgress, renderLanes) { - var newProps = workInProgress.pendingProps; - switch (workInProgress.tag) { - case 2: - case 16: - case 15: + } + return workInProgress; case 0: - case 11: - case 7: - case 8: - case 12: - case 9: - case 14: - return bubbleProperties(workInProgress), null; - case 1: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateFunctionComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 3: + case 1: return ( - (renderLanes = workInProgress.stateNode), - (newProps = null), - null !== current && (newProps = current.memoizedState.cache), - workInProgress.memoizedState.cache !== newProps && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - renderLanes.pendingContext && - ((renderLanes.context = renderLanes.pendingContext), - (renderLanes.pendingContext = null)), - (null !== current && null !== current.child) || - null === current || - (current.memoizedState.isDehydrated && - 0 === (workInProgress.flags & 256)) || - ((workInProgress.flags |= 1024), - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), - (hydrationErrors = null))), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateClassComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) ); + case 3: + pushHostRootContext(workInProgress); + if (null === current) + throw Error("Should have a current fiber. This is a bug in React."); + var nextProps = workInProgress.pendingProps; + context = workInProgress.memoizedState; + Component = context.element; + cloneUpdateQueue(current, workInProgress); + processUpdateQueue(workInProgress, nextProps, null, renderLanes); + nextProps = workInProgress.memoizedState; + var nextCache = nextProps.cache; + pushProvider(workInProgress, CacheContext, nextCache); + nextCache !== context.cache && + propagateContextChange(workInProgress, CacheContext, renderLanes); + suspendIfUpdateReadFromEntangledAsyncAction(); + context = nextProps.element; + context === Component + ? (workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + )) + : (reconcileChildren(current, workInProgress, context, renderLanes), + (workInProgress = workInProgress.child)); + return workInProgress; case 26: case 27: case 5: - popHostContext(workInProgress); - var type = workInProgress.type; - if (null !== current && null != workInProgress.stateNode) - current.memoizedProps !== newProps && (workInProgress.flags |= 4); - else { - if (!newProps) { - if (null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." - ); - bubbleProperties(workInProgress); - return null; - } - renderLanes = rootInstanceStackCursor.current; - current = allocateTag(); - type = getViewConfigForType(type); - var updatePayload = diffProperties( - null, - emptyObject$1, - newProps, - type.validAttributes - ); - ReactNativePrivateInterface.UIManager.createView( - current, - type.uiViewClassName, - renderLanes, - updatePayload - ); - renderLanes = new ReactNativeFiberHostComponent( + pushHostContext(workInProgress); + Component = workInProgress.pendingProps.children; + if (enableAsyncActions && null !== workInProgress.memoizedState) { + if (!enableAsyncActions) throw Error("Not implemented."); + context = renderWithHooks( current, - type, - workInProgress + workInProgress, + TransitionAwareHostComponent, + null, + null, + renderLanes ); - instanceCache.set(current, workInProgress); - instanceProps.set(current, newProps); - a: for (current = workInProgress.child; null !== current; ) { - if (5 === current.tag || 6 === current.tag) - renderLanes._children.push(current.stateNode); - else if (4 !== current.tag && null !== current.child) { - current.child.return = current; - current = current.child; - continue; - } - if (current === workInProgress) break a; - for (; null === current.sibling; ) { - if (null === current.return || current.return === workInProgress) - break a; - current = current.return; - } - current.sibling.return = current.return; - current = current.sibling; - } - workInProgress.stateNode = renderLanes; - finalizeInitialChildren(renderLanes) && (workInProgress.flags |= 4); - } - bubbleProperties(workInProgress); - workInProgress.flags &= -16777217; - return null; - case 6: - if (current && null != workInProgress.stateNode) - current.memoizedProps !== newProps && (workInProgress.flags |= 4); - else { - if ("string" !== typeof newProps && null === workInProgress.stateNode) - throw Error( - "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." - ); - current = rootInstanceStackCursor.current; - if (!contextStackCursor.current.isInAParentText) - throw Error( - "Text strings must be rendered within a component." + HostTransitionContext._currentValue = context; + didReceiveUpdate && + null !== current && + current.memoizedState.memoizedState !== context && + propagateContextChange( + workInProgress, + HostTransitionContext, + renderLanes ); - renderLanes = allocateTag(); - ReactNativePrivateInterface.UIManager.createView( - renderLanes, - "RCTRawText", - current, - { text: newProps } - ); - instanceCache.set(renderLanes, workInProgress); - workInProgress.stateNode = renderLanes; } - bubbleProperties(workInProgress); + markRef(current, workInProgress); + reconcileChildren(current, workInProgress, Component, renderLanes); + return workInProgress.child; + case 6: return null; case 13: - newProps = workInProgress.memoizedState; - if ( - null === current || - (null !== current.memoizedState && - null !== current.memoizedState.dehydrated) - ) { - if (null !== newProps && null !== newProps.dehydrated) { - if (null === current) { - throw Error( - "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." - ); - throw Error( - "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." - ); - } - 0 === (workInProgress.flags & 128) && - (workInProgress.memoizedState = null); - workInProgress.flags |= 4; - bubbleProperties(workInProgress); - 0 !== (workInProgress.mode & 2) && - null !== newProps && - ((type = workInProgress.child), - null !== type && - (workInProgress.treeBaseDuration -= type.treeBaseDuration)); - type = !1; - } else - null !== hydrationErrors && - (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), - (type = !0); - if (!type) { - if (workInProgress.flags & 256) - return popSuspenseHandler(workInProgress), workInProgress; - popSuspenseHandler(workInProgress); - return null; - } - } - popSuspenseHandler(workInProgress); - if (0 !== (workInProgress.flags & 128)) - return ( - (workInProgress.lanes = renderLanes), - 0 !== (workInProgress.mode & 2) && - transferActualDuration(workInProgress), - workInProgress - ); - renderLanes = null !== newProps; - current = null !== current && null !== current.memoizedState; - renderLanes && - ((newProps = workInProgress.child), - (type = null), - null !== newProps.alternate && - null !== newProps.alternate.memoizedState && - null !== newProps.alternate.memoizedState.cachePool && - (type = newProps.alternate.memoizedState.cachePool.pool), - (updatePayload = null), - null !== newProps.memoizedState && - null !== newProps.memoizedState.cachePool && - (updatePayload = newProps.memoizedState.cachePool.pool), - updatePayload !== type && (newProps.flags |= 2048)); - renderLanes !== current && - renderLanes && - (workInProgress.child.flags |= 8192); - scheduleRetryEffect(workInProgress, workInProgress.updateQueue); - bubbleProperties(workInProgress); - 0 !== (workInProgress.mode & 2) && - renderLanes && - ((current = workInProgress.child), - null !== current && - (workInProgress.treeBaseDuration -= current.treeBaseDuration)); - return null; + return updateSuspenseComponent(current, workInProgress, renderLanes); case 4: - return popHostContainer(), bubbleProperties(workInProgress), null; - case 10: return ( - popProvider( - enableRenderableContext - ? workInProgress.type - : workInProgress.type._context + pushHostContainer( + workInProgress, + workInProgress.stateNode.containerInfo ), - bubbleProperties(workInProgress), - null + (Component = workInProgress.pendingProps), + null === current + ? (workInProgress.child = reconcileChildFibers( + workInProgress, + null, + Component, + renderLanes + )) + : reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child ); - case 17: + case 11: return ( - isContextProvider(workInProgress.type) && popContext(), - bubbleProperties(workInProgress), - null + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + updateForwardRef( + current, + workInProgress, + Component, + context, + renderLanes + ) ); - case 19: - pop(suspenseStackCursor); - type = workInProgress.memoizedState; - if (null === type) return bubbleProperties(workInProgress), null; - newProps = 0 !== (workInProgress.flags & 128); - updatePayload = type.rendering; - if (null === updatePayload) - if (newProps) cutOffTailIfNeeded(type, !1); - else { - if ( - 0 !== workInProgressRootExitStatus || - (null !== current && 0 !== (current.flags & 128)) - ) - for (current = workInProgress.child; null !== current; ) { - updatePayload = findFirstSuspended(current); - if (null !== updatePayload) { - workInProgress.flags |= 128; - cutOffTailIfNeeded(type, !1); - current = updatePayload.updateQueue; - workInProgress.updateQueue = current; - scheduleRetryEffect(workInProgress, current); - workInProgress.subtreeFlags = 0; - current = renderLanes; - for (renderLanes = workInProgress.child; null !== renderLanes; ) - resetWorkInProgress(renderLanes, current), - (renderLanes = renderLanes.sibling); - push( - suspenseStackCursor, - (suspenseStackCursor.current & 1) | 2 - ); - return workInProgress.child; - } - current = current.sibling; - } - null !== type.tail && - now$1() > workInProgressRootRenderTargetTime && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 4194304)); - } - else { - if (!newProps) - if ( - ((current = findFirstSuspended(updatePayload)), null !== current) - ) { - if ( - ((workInProgress.flags |= 128), - (newProps = !0), - (current = current.updateQueue), - (workInProgress.updateQueue = current), - scheduleRetryEffect(workInProgress, current), - cutOffTailIfNeeded(type, !0), - null === type.tail && - "hidden" === type.tailMode && - !updatePayload.alternate) - ) - return bubbleProperties(workInProgress), null; - } else - 2 * now$1() - type.renderingStartTime > - workInProgressRootRenderTargetTime && - 536870912 !== renderLanes && - ((workInProgress.flags |= 128), - (newProps = !0), - cutOffTailIfNeeded(type, !1), - (workInProgress.lanes = 4194304)); - type.isBackwards - ? ((updatePayload.sibling = workInProgress.child), - (workInProgress.child = updatePayload)) - : ((current = type.last), - null !== current - ? (current.sibling = updatePayload) - : (workInProgress.child = updatePayload), - (type.last = updatePayload)); - } - if (null !== type.tail) - return ( - (workInProgress = type.tail), - (type.rendering = workInProgress), - (type.tail = workInProgress.sibling), - (type.renderingStartTime = now$1()), - (workInProgress.sibling = null), - (current = suspenseStackCursor.current), - push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), - workInProgress + case 7: + return ( + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps, + renderLanes + ), + workInProgress.child + ); + case 8: + return ( + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); + case 12: + return ( + (workInProgress.flags |= 4), + (Component = workInProgress.stateNode), + (Component.effectDuration = 0), + (Component.passiveEffectDuration = 0), + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child + ); + case 10: + a: { + Component = enableRenderableContext + ? workInProgress.type + : workInProgress.type._context; + context = workInProgress.pendingProps; + nextProps = workInProgress.memoizedProps; + nextCache = context.value; + pushProvider(workInProgress, Component, nextCache); + if (null !== nextProps) + if (objectIs(nextProps.value, nextCache)) { + if ( + nextProps.children === context.children && + !didPerformWorkStackCursor.current + ) { + workInProgress = bailoutOnAlreadyFinishedWork( + current, + workInProgress, + renderLanes + ); + break a; + } + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes ); - bubbleProperties(workInProgress); - return null; - case 22: - case 23: + workInProgress = workInProgress.child; + } + return workInProgress; + case 9: return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - (newProps = null !== workInProgress.memoizedState), - null !== current - ? (null !== current.memoizedState) !== newProps && - (workInProgress.flags |= 8192) - : newProps && (workInProgress.flags |= 8192), - newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 536870912) && - 0 === (workInProgress.flags & 128) && - (bubbleProperties(workInProgress), - workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) - : bubbleProperties(workInProgress), - (renderLanes = workInProgress.updateQueue), - null !== renderLanes && - scheduleRetryEffect(workInProgress, renderLanes.retryQueue), - (renderLanes = null), - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (renderLanes = current.memoizedState.cachePool.pool), - (newProps = null), - null !== workInProgress.memoizedState && - null !== workInProgress.memoizedState.cachePool && - (newProps = workInProgress.memoizedState.cachePool.pool), - newProps !== renderLanes && (workInProgress.flags |= 2048), - null !== current && pop(resumedCache), - null + (context = enableRenderableContext + ? workInProgress.type._context + : workInProgress.type), + (Component = workInProgress.pendingProps.children), + prepareToReadContext(workInProgress, renderLanes), + (context = readContext(context)), + markComponentRenderStarted(workInProgress), + (Component = Component(context)), + markComponentRenderStopped(), + (workInProgress.flags |= 1), + reconcileChildren(current, workInProgress, Component, renderLanes), + workInProgress.child + ); + case 14: + return ( + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), + updateMemoComponent( + current, + workInProgress, + Component, + context, + renderLanes + ) + ); + case 15: + return updateSimpleMemoComponent( + current, + workInProgress, + workInProgress.type, + workInProgress.pendingProps, + renderLanes + ); + case 17: + return ( + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), + (workInProgress.tag = 1), + isContextProvider(Component) + ? ((current = !0), pushContextProvider(workInProgress)) + : (current = !1), + prepareToReadContext(workInProgress, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), + finishClassComponent( + null, + workInProgress, + Component, + !0, + current, + renderLanes + ) ); + case 19: + return updateSuspenseListComponent(current, workInProgress, renderLanes); + case 22: + return updateOffscreenComponent(current, workInProgress, renderLanes); case 24: return ( - (renderLanes = null), - null !== current && (renderLanes = current.memoizedState.cache), - workInProgress.memoizedState.cache !== renderLanes && - (workInProgress.flags |= 2048), - popProvider(CacheContext), - bubbleProperties(workInProgress), - null + prepareToReadContext(workInProgress, renderLanes), + (Component = readContext(CacheContext)), + null === current + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), + (nextProps = createCache()), + (context.pooledCache = nextProps), + nextProps.refCount++, + null !== nextProps && (context.pooledCacheLanes |= renderLanes), + (context = nextProps)), + (workInProgress.memoizedState = { + parent: Component, + cache: context + }), + initializeUpdateQueue(workInProgress), + pushProvider(workInProgress, CacheContext, context)) + : (0 !== (current.lanes & renderLanes) && + (cloneUpdateQueue(current, workInProgress), + processUpdateQueue(workInProgress, null, null, renderLanes), + suspendIfUpdateReadFromEntangledAsyncAction()), + (context = current.memoizedState), + (nextProps = workInProgress.memoizedState), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), + 0 === workInProgress.lanes && + (workInProgress.memoizedState = + workInProgress.updateQueue.baseState = + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = nextProps.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && + propagateContextChange( + workInProgress, + CacheContext, + renderLanes + ))), + reconcileChildren( + current, + workInProgress, + workInProgress.pendingProps.children, + renderLanes + ), + workInProgress.child ); - case 25: - return null; } throw Error( "Unknown unit of work tag (" + @@ -7470,3531 +7185,3773 @@ function completeWork(current, workInProgress, renderLanes) { "). This error is likely caused by a bug in React. Please file an issue." ); } -function unwindWork(current, workInProgress) { - switch (workInProgress.tag) { - case 1: - return ( - isContextProvider(workInProgress.type) && popContext(), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), - 0 !== (workInProgress.mode & 2) && - transferActualDuration(workInProgress), - workInProgress) - : null - ); - case 3: - return ( - popProvider(CacheContext), - popHostContainer(), - pop(didPerformWorkStackCursor), - pop(contextStackCursor$1), - (current = workInProgress.flags), - 0 !== (current & 65536) && 0 === (current & 128) - ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) - : null - ); - case 26: - case 27: - case 5: - return popHostContext(workInProgress), null; - case 13: - popSuspenseHandler(workInProgress); - current = workInProgress.memoizedState; - if ( - null !== current && - null !== current.dehydrated && - null === workInProgress.alternate - ) - throw Error( - "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." - ); - current = workInProgress.flags; - return current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), - 0 !== (workInProgress.mode & 2) && - transferActualDuration(workInProgress), - workInProgress) - : null; - case 19: - return pop(suspenseStackCursor), null; - case 4: - return popHostContainer(), null; - case 10: - return ( - popProvider( - enableRenderableContext - ? workInProgress.type - : workInProgress.type._context - ), - null - ); - case 22: - case 23: - return ( - popSuspenseHandler(workInProgress), - popHiddenContext(), - null !== current && pop(resumedCache), - (current = workInProgress.flags), - current & 65536 - ? ((workInProgress.flags = (current & -65537) | 128), - 0 !== (workInProgress.mode & 2) && - transferActualDuration(workInProgress), - workInProgress) - : null - ); - case 24: - return popProvider(CacheContext), null; - case 25: - return null; - default: - return null; - } +var valueCursor = createCursor(null), + currentlyRenderingFiber = null, + lastContextDependency = null, + lastFullyObservedContext = null; +function resetContextDependencies() { + lastFullyObservedContext = + lastContextDependency = + currentlyRenderingFiber = + null; } -function unwindInterruptedWork(current, interruptedWork) { - switch (interruptedWork.tag) { - case 1: - current = interruptedWork.type.childContextTypes; - null !== current && void 0 !== current && popContext(); - break; - case 3: - popProvider(CacheContext); - popHostContainer(); - pop(didPerformWorkStackCursor); - pop(contextStackCursor$1); - break; - case 26: - case 27: - case 5: - popHostContext(interruptedWork); - break; - case 4: - popHostContainer(); - break; - case 13: - popSuspenseHandler(interruptedWork); - break; - case 19: - pop(suspenseStackCursor); - break; - case 10: - popProvider( - enableRenderableContext - ? interruptedWork.type - : interruptedWork.type._context - ); - break; - case 22: - case 23: - popSuspenseHandler(interruptedWork); - popHiddenContext(); - null !== current && pop(resumedCache); - break; - case 24: - popProvider(CacheContext); - } +function pushProvider(providerFiber, context, nextValue) { + push(valueCursor, context._currentValue); + context._currentValue = nextValue; } -var offscreenSubtreeIsHidden = !1, - offscreenSubtreeWasHidden = !1, - PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, - nextEffect = null, - inProgressLanes = null, - inProgressRoot = null; -function shouldProfile(current) { - return 0 !== (current.mode & 2) && 0 !== (executionContext & 4); +function popProvider(context) { + context._currentValue = valueCursor.current; + pop(valueCursor); } -function callComponentWillUnmountWithTimer(current, instance) { - instance.props = current.memoizedProps; - instance.state = current.memoizedState; - if (shouldProfile(current)) - try { - startLayoutEffectTimer(), instance.componentWillUnmount(); - } finally { - recordLayoutEffectDuration(current); - } - else instance.componentWillUnmount(); +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 safelyAttachRef(current, nearestMountedAncestor) { - try { - var ref = current.ref; - if (null !== ref) { - var instance = current.stateNode; - switch (current.tag) { - case 26: - case 27: - case 5: - var instanceToUse = getPublicInstance(instance); +function propagateContextChange(workInProgress, context, renderLanes) { + var fiber = workInProgress.child; + null !== fiber && (fiber.return = workInProgress); + for (; null !== fiber; ) { + var list = fiber.dependencies; + if (null !== list) { + var nextFiber = fiber.child; + for (var dependency = list.firstContext; null !== dependency; ) { + if (dependency.context === context) { + if (1 === fiber.tag) { + dependency = createUpdate(renderLanes & -renderLanes); + dependency.tag = 2; + var updateQueue = fiber.updateQueue; + if (null !== updateQueue) { + updateQueue = updateQueue.shared; + var pending = updateQueue.pending; + null === pending + ? (dependency.next = dependency) + : ((dependency.next = pending.next), + (pending.next = dependency)); + updateQueue.pending = dependency; + } + } + fiber.lanes |= renderLanes; + dependency = fiber.alternate; + null !== dependency && (dependency.lanes |= renderLanes); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + workInProgress + ); + list.lanes |= renderLanes; break; - default: - instanceToUse = instance; + } + dependency = dependency.next; } - if ("function" === typeof ref) - if (shouldProfile(current)) - try { - startLayoutEffectTimer(), (current.refCleanup = ref(instanceToUse)); - } finally { - recordLayoutEffectDuration(current); - } - else current.refCleanup = ref(instanceToUse); - else ref.current = instanceToUse; - } - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); + } else if (10 === fiber.tag) + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else if (18 === fiber.tag) { + nextFiber = fiber.return; + if (null === nextFiber) + throw Error( + "We just came from a parent so we must have had a parent. This is a bug in React." + ); + nextFiber.lanes |= renderLanes; + list = nextFiber.alternate; + null !== list && (list.lanes |= renderLanes); + scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); + nextFiber = fiber.sibling; + } 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 safelyDetachRef(current, nearestMountedAncestor) { - var ref = current.ref, - refCleanup = current.refCleanup; - if (null !== ref) - if ("function" === typeof refCleanup) - try { - if (shouldProfile(current)) - try { - startLayoutEffectTimer(), refCleanup(); - } finally { - recordLayoutEffectDuration(current); - } - else refCleanup(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } finally { - (current.refCleanup = null), - (current = current.alternate), - null != current && (current.refCleanup = null); - } - else if ("function" === typeof ref) - try { - if (shouldProfile(current)) - try { - startLayoutEffectTimer(), ref(null); - } finally { - recordLayoutEffectDuration(current); - } - else ref(null); - } catch (error$104) { - captureCommitPhaseError(current, nearestMountedAncestor, error$104); - } - else ref.current = null; +function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber = workInProgress; + lastFullyObservedContext = lastContextDependency = null; + workInProgress = workInProgress.dependencies; + null !== workInProgress && + null !== workInProgress.firstContext && + (0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0), + (workInProgress.firstContext = null)); } -function safelyCallDestroy(current, nearestMountedAncestor, destroy) { - try { - destroy(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } +function readContext(context) { + return readContextForConsumer(currentlyRenderingFiber, context); } -var shouldFireAfterActiveInstanceBlur = !1; -function commitBeforeMutationEffects(root, firstChild) { - for (nextEffect = firstChild; null !== nextEffect; ) +function readContextDuringReconcilation(consumer, context, renderLanes) { + null === currentlyRenderingFiber && + prepareToReadContext(consumer, renderLanes); + return readContextForConsumer(consumer, context); +} +function readContextForConsumer(consumer, context) { + var value = context._currentValue; + if (lastFullyObservedContext !== context) if ( - ((root = nextEffect), - (firstChild = root.child), - 0 !== (root.subtreeFlags & 1028) && null !== firstChild) - ) - (firstChild.return = root), (nextEffect = firstChild); - else - for (; null !== nextEffect; ) { - root = nextEffect; - try { - var current = root.alternate, - flags = root.flags; - switch (root.tag) { - case 0: - break; - case 11: - case 15: - break; - case 1: - if (0 !== (flags & 1024) && null !== current) { - var prevProps = current.memoizedProps, - prevState = current.memoizedState, - instance = root.stateNode, - snapshot = instance.getSnapshotBeforeUpdate( - root.elementType === root.type - ? prevProps - : resolveDefaultProps(root.type, prevProps), - prevState - ); - instance.__reactInternalSnapshotBeforeUpdate = snapshot; + ((context = { context: context, memoizedValue: value, next: null }), + null === lastContextDependency) + ) { + if (null === consumer) + throw Error( + "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." + ); + lastContextDependency = context; + consumer.dependencies = { lanes: 0, firstContext: context }; + } else lastContextDependency = lastContextDependency.next = context; + return value; +} +var AbortControllerLocal = + "undefined" !== typeof AbortController + ? AbortController + : function () { + var listeners = [], + signal = (this.signal = { + aborted: !1, + addEventListener: function (type, listener) { + listeners.push(listener); } - break; - case 3: - break; - case 5: - case 26: - case 27: - case 6: - case 4: - case 17: - break; - default: - if (0 !== (flags & 1024)) - throw Error( - "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." - ); - } - } catch (error) { - captureCommitPhaseError(root, root.return, error); - } - firstChild = root.sibling; - if (null !== firstChild) { - firstChild.return = root.return; - nextEffect = firstChild; - break; - } - nextEffect = root.return; - } - current = shouldFireAfterActiveInstanceBlur; - shouldFireAfterActiveInstanceBlur = !1; - return current; + }); + this.abort = function () { + signal.aborted = !0; + listeners.forEach(function (listener) { + return listener(); + }); + }; + }, + scheduleCallback$1 = Scheduler.unstable_scheduleCallback, + NormalPriority = Scheduler.unstable_NormalPriority, + CacheContext = { + $$typeof: REACT_CONTEXT_TYPE, + Consumer: null, + Provider: null, + _currentValue: null, + _currentValue2: null, + _threadCount: 0 + }; +function createCache() { + return { + controller: new AbortControllerLocal(), + data: new Map(), + refCount: 0 + }; } -function commitHookEffectListUnmount( - flags, - finishedWork, - nearestMountedAncestor -) { - var updateQueue = finishedWork.updateQueue; - updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; - if (null !== updateQueue) { - var effect = (updateQueue = updateQueue.next); - do { - if ((effect.tag & flags) === flags) { - var inst = effect.inst, - destroy = inst.destroy; - void 0 !== destroy && - ((inst.destroy = void 0), - 0 !== (flags & 8) - ? null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted && - injectedProfilingHooks.markComponentPassiveEffectUnmountStarted( - finishedWork - ) - : 0 !== (flags & 4) && - markComponentLayoutEffectUnmountStarted(finishedWork), - safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy), - 0 !== (flags & 8) - ? null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped && - injectedProfilingHooks.markComponentPassiveEffectUnmountStopped() - : 0 !== (flags & 4) && markComponentLayoutEffectUnmountStopped()); - } - effect = effect.next; - } while (effect !== updateQueue); - } +function releaseCache(cache) { + cache.refCount--; + 0 === cache.refCount && + scheduleCallback$1(NormalPriority, function () { + cache.controller.abort(); + }); } -function commitHookEffectListMount(flags, finishedWork) { - var updateQueue = finishedWork.updateQueue; - updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; - if (null !== updateQueue) { - var effect = (updateQueue = updateQueue.next); - do { - if ((effect.tag & flags) === flags) { - 0 !== (flags & 8) - ? null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted && - injectedProfilingHooks.markComponentPassiveEffectMountStarted( - finishedWork - ) - : 0 !== (flags & 4) && - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted && - injectedProfilingHooks.markComponentLayoutEffectMountStarted( - finishedWork - ); - var create$105 = effect.create, - inst = effect.inst; - create$105 = create$105(); - inst.destroy = create$105; - 0 !== (flags & 8) - ? null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped && - injectedProfilingHooks.markComponentPassiveEffectMountStopped() - : 0 !== (flags & 4) && - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped && - injectedProfilingHooks.markComponentLayoutEffectMountStopped(); - } - effect = effect.next; - } while (effect !== updateQueue); - } +var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; +function requestCurrentTransition() { + var transition = ReactCurrentBatchConfig$1.transition; + null !== transition && transition._callbacks.add(handleAsyncAction); + return transition; } -function commitHookLayoutEffects(finishedWork, hookFlags) { - if (shouldProfile(finishedWork)) { - try { - startLayoutEffectTimer(), - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - recordLayoutEffectDuration(finishedWork); - } else - try { - commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$107) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$107); - } +function handleAsyncAction(transition, thenable) { + enableAsyncActions && entangleAsyncAction(transition, thenable); } -function commitClassCallbacks(finishedWork) { - var updateQueue = finishedWork.updateQueue; - if (null !== updateQueue) { - var instance = finishedWork.stateNode; - try { - commitCallbacks(updateQueue, instance); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } +function notifyTransitionCallbacks(transition, returnValue) { + transition._callbacks.forEach(function (callback) { + return callback(transition, returnValue); + }); +} +var resumedCache = createCursor(null); +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: CacheContext._currentValue, pool: cacheFromPool }; +} +function scheduleRetryEffect(workInProgress, retryQueue) { + null !== retryQueue + ? (workInProgress.flags |= 4) + : workInProgress.flags & 16384 && + ((retryQueue = + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), + (workInProgress.lanes |= retryQueue)); +} +function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + switch (renderState.tailMode) { + case "hidden": + hasRenderedATailFallback = renderState.tail; + for (var lastTailNode = null; null !== hasRenderedATailFallback; ) + null !== hasRenderedATailFallback.alternate && + (lastTailNode = hasRenderedATailFallback), + (hasRenderedATailFallback = hasRenderedATailFallback.sibling); + null === lastTailNode + ? (renderState.tail = null) + : (lastTailNode.sibling = null); + break; + case "collapsed": + lastTailNode = renderState.tail; + for (var lastTailNode$76 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$76 = lastTailNode), + (lastTailNode = lastTailNode.sibling); + null === lastTailNode$76 + ? hasRenderedATailFallback || null === renderState.tail + ? (renderState.tail = null) + : (renderState.tail.sibling = null) + : (lastTailNode$76.sibling = null); } } -function commitProfilerUpdate(finishedWork, current) { - if (executionContext & 4) - try { - var _finishedWork$memoize2 = finishedWork.memoizedProps, - onCommit = _finishedWork$memoize2.onCommit, - onRender = _finishedWork$memoize2.onRender, - effectDuration = finishedWork.stateNode.effectDuration; - _finishedWork$memoize2 = commitTime; - current = null === current ? "mount" : "update"; - currentUpdateIsNested && (current = "nested-update"); - "function" === typeof onRender && - onRender( - finishedWork.memoizedProps.id, +function bubbleProperties(completedWork) { + var didBailout = + null !== completedWork.alternate && + completedWork.alternate.child === completedWork.child, + newChildLanes = 0, + subtreeFlags = 0; + if (didBailout) + if (0 !== (completedWork.mode & 2)) { + for ( + var treeBaseDuration$78 = completedWork.selfBaseDuration, + child$79 = completedWork.child; + null !== child$79; + + ) + (newChildLanes |= child$79.lanes | child$79.childLanes), + (subtreeFlags |= child$79.subtreeFlags & 31457280), + (subtreeFlags |= child$79.flags & 31457280), + (treeBaseDuration$78 += child$79.treeBaseDuration), + (child$79 = child$79.sibling); + completedWork.treeBaseDuration = treeBaseDuration$78; + } else + for ( + treeBaseDuration$78 = completedWork.child; + null !== treeBaseDuration$78; + + ) + (newChildLanes |= + treeBaseDuration$78.lanes | treeBaseDuration$78.childLanes), + (subtreeFlags |= treeBaseDuration$78.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$78.flags & 31457280), + (treeBaseDuration$78.return = completedWork), + (treeBaseDuration$78 = treeBaseDuration$78.sibling); + else if (0 !== (completedWork.mode & 2)) { + treeBaseDuration$78 = completedWork.actualDuration; + child$79 = completedWork.selfBaseDuration; + for (var child = completedWork.child; null !== child; ) + (newChildLanes |= child.lanes | child.childLanes), + (subtreeFlags |= child.subtreeFlags), + (subtreeFlags |= child.flags), + (treeBaseDuration$78 += child.actualDuration), + (child$79 += child.treeBaseDuration), + (child = child.sibling); + completedWork.actualDuration = treeBaseDuration$78; + completedWork.treeBaseDuration = child$79; + } else + for ( + treeBaseDuration$78 = completedWork.child; + null !== treeBaseDuration$78; + + ) + (newChildLanes |= + treeBaseDuration$78.lanes | treeBaseDuration$78.childLanes), + (subtreeFlags |= treeBaseDuration$78.subtreeFlags), + (subtreeFlags |= treeBaseDuration$78.flags), + (treeBaseDuration$78.return = completedWork), + (treeBaseDuration$78 = treeBaseDuration$78.sibling); + completedWork.subtreeFlags |= subtreeFlags; + completedWork.childLanes = newChildLanes; + return didBailout; +} +function completeWork(current, workInProgress, renderLanes) { + var newProps = workInProgress.pendingProps; + switch (workInProgress.tag) { + case 2: + case 16: + case 15: + case 0: + case 11: + case 7: + case 8: + case 12: + case 9: + case 14: + return bubbleProperties(workInProgress), null; + case 1: + return ( + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null + ); + case 3: + return ( + (renderLanes = workInProgress.stateNode), + (newProps = null), + null !== current && (newProps = current.memoizedState.cache), + workInProgress.memoizedState.cache !== newProps && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + renderLanes.pendingContext && + ((renderLanes.context = renderLanes.pendingContext), + (renderLanes.pendingContext = null)), + (null !== current && null !== current.child) || + null === current || + (current.memoizedState.isDehydrated && + 0 === (workInProgress.flags & 256)) || + ((workInProgress.flags |= 1024), + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), + (hydrationErrors = null))), + bubbleProperties(workInProgress), + null + ); + case 26: + case 27: + case 5: + popHostContext(workInProgress); + var type = workInProgress.type; + if (null !== current && null != workInProgress.stateNode) + current.memoizedProps !== newProps && (workInProgress.flags |= 4); + else { + if (!newProps) { + if (null === workInProgress.stateNode) + throw Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ); + bubbleProperties(workInProgress); + return null; + } + renderLanes = rootInstanceStackCursor.current; + current = allocateTag(); + type = getViewConfigForType(type); + var updatePayload = diffProperties( + null, + emptyObject$1, + newProps, + type.validAttributes + ); + ReactNativePrivateInterface.UIManager.createView( current, - finishedWork.actualDuration, - finishedWork.treeBaseDuration, - finishedWork.actualStartTime, - _finishedWork$memoize2 + type.uiViewClassName, + renderLanes, + updatePayload ); - "function" === typeof onCommit && - onCommit( - finishedWork.memoizedProps.id, + renderLanes = new ReactNativeFiberHostComponent( current, - effectDuration, - _finishedWork$memoize2 + type, + workInProgress ); - enqueuePendingPassiveProfilerEffect(finishedWork); - var parentFiber = finishedWork.return; - a: for (; null !== parentFiber; ) { - switch (parentFiber.tag) { - case 3: - parentFiber.stateNode.effectDuration += effectDuration; - break a; - case 12: - parentFiber.stateNode.effectDuration += effectDuration; - break a; + instanceCache.set(current, workInProgress); + instanceProps.set(current, newProps); + a: for (current = workInProgress.child; null !== current; ) { + if (5 === current.tag || 6 === current.tag) + renderLanes._children.push(current.stateNode); + else if (4 !== current.tag && null !== current.child) { + current.child.return = current; + current = current.child; + continue; + } + if (current === workInProgress) break a; + for (; null === current.sibling; ) { + if (null === current.return || current.return === workInProgress) + break a; + current = current.return; + } + current.sibling.return = current.return; + current = current.sibling; } - parentFiber = parentFiber.return; + workInProgress.stateNode = renderLanes; + finalizeInitialChildren(renderLanes) && (workInProgress.flags |= 4); } - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } -} -function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { - var flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 4 && commitHookLayoutEffects(finishedWork, 5); - break; - case 1: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 4) - if (((finishedRoot = finishedWork.stateNode), null === current)) - if (shouldProfile(finishedWork)) { - try { - startLayoutEffectTimer(), finishedRoot.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - recordLayoutEffectDuration(finishedWork); - } else - try { - finishedRoot.componentDidMount(); - } catch (error$108) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$108 - ); - } + bubbleProperties(workInProgress); + workInProgress.flags &= -16777217; + return null; + case 6: + if (current && null != workInProgress.stateNode) + current.memoizedProps !== newProps && (workInProgress.flags |= 4); + else { + if ("string" !== typeof newProps && null === workInProgress.stateNode) + throw Error( + "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." + ); + current = rootInstanceStackCursor.current; + if (!contextStackCursor.current.isInAParentText) + throw Error( + "Text strings must be rendered within a component." + ); + renderLanes = allocateTag(); + ReactNativePrivateInterface.UIManager.createView( + renderLanes, + "RCTRawText", + current, + { text: newProps } + ); + instanceCache.set(renderLanes, workInProgress); + workInProgress.stateNode = renderLanes; + } + bubbleProperties(workInProgress); + return null; + case 13: + newProps = workInProgress.memoizedState; + if ( + null === current || + (null !== current.memoizedState && + null !== current.memoizedState.dehydrated) + ) { + if (null !== newProps && null !== newProps.dehydrated) { + if (null === current) { + throw Error( + "A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React." + ); + throw Error( + "Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." + ); + } + 0 === (workInProgress.flags & 128) && + (workInProgress.memoizedState = null); + workInProgress.flags |= 4; + bubbleProperties(workInProgress); + 0 !== (workInProgress.mode & 2) && + null !== newProps && + ((type = workInProgress.child), + null !== type && + (workInProgress.treeBaseDuration -= type.treeBaseDuration)); + type = !1; + } else + null !== hydrationErrors && + (queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)), + (type = !0); + if (!type) { + if (workInProgress.flags & 256) + return popSuspenseHandler(workInProgress), workInProgress; + popSuspenseHandler(workInProgress); + return null; + } + } + popSuspenseHandler(workInProgress); + if (0 !== (workInProgress.flags & 128)) + return ( + (workInProgress.lanes = renderLanes), + 0 !== (workInProgress.mode & 2) && + transferActualDuration(workInProgress), + workInProgress + ); + renderLanes = null !== newProps; + current = null !== current && null !== current.memoizedState; + renderLanes && + ((newProps = workInProgress.child), + (type = null), + null !== newProps.alternate && + null !== newProps.alternate.memoizedState && + null !== newProps.alternate.memoizedState.cachePool && + (type = newProps.alternate.memoizedState.cachePool.pool), + (updatePayload = null), + null !== newProps.memoizedState && + null !== newProps.memoizedState.cachePool && + (updatePayload = newProps.memoizedState.cachePool.pool), + updatePayload !== type && (newProps.flags |= 2048)); + renderLanes !== current && + renderLanes && + (workInProgress.child.flags |= 8192); + scheduleRetryEffect(workInProgress, workInProgress.updateQueue); + bubbleProperties(workInProgress); + 0 !== (workInProgress.mode & 2) && + renderLanes && + ((current = workInProgress.child), + null !== current && + (workInProgress.treeBaseDuration -= current.treeBaseDuration)); + return null; + case 4: + return popHostContainer(), bubbleProperties(workInProgress), null; + case 10: + return ( + popProvider( + enableRenderableContext + ? workInProgress.type + : workInProgress.type._context + ), + bubbleProperties(workInProgress), + null + ); + case 17: + return ( + isContextProvider(workInProgress.type) && popContext(), + bubbleProperties(workInProgress), + null + ); + case 19: + pop(suspenseStackCursor); + type = workInProgress.memoizedState; + if (null === type) return bubbleProperties(workInProgress), null; + newProps = 0 !== (workInProgress.flags & 128); + updatePayload = type.rendering; + if (null === updatePayload) + if (newProps) cutOffTailIfNeeded(type, !1); else { - var prevProps = - finishedWork.elementType === finishedWork.type - ? current.memoizedProps - : resolveDefaultProps(finishedWork.type, current.memoizedProps); - current = current.memoizedState; - if (shouldProfile(finishedWork)) { - try { - startLayoutEffectTimer(), - finishedRoot.componentDidUpdate( - prevProps, - current, - finishedRoot.__reactInternalSnapshotBeforeUpdate + if ( + 0 !== workInProgressRootExitStatus || + (null !== current && 0 !== (current.flags & 128)) + ) + for (current = workInProgress.child; null !== current; ) { + updatePayload = findFirstSuspended(current); + if (null !== updatePayload) { + workInProgress.flags |= 128; + cutOffTailIfNeeded(type, !1); + current = updatePayload.updateQueue; + workInProgress.updateQueue = current; + scheduleRetryEffect(workInProgress, current); + workInProgress.subtreeFlags = 0; + current = renderLanes; + for (renderLanes = workInProgress.child; null !== renderLanes; ) + resetWorkInProgress(renderLanes, current), + (renderLanes = renderLanes.sibling); + push( + suspenseStackCursor, + (suspenseStackCursor.current & 1) | 2 ); - } catch (error$109) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$109 - ); - } - recordLayoutEffectDuration(finishedWork); - } else - try { - finishedRoot.componentDidUpdate( - prevProps, - current, - finishedRoot.__reactInternalSnapshotBeforeUpdate - ); - } catch (error$110) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$110 - ); + return workInProgress.child; + } + current = current.sibling; } + null !== type.tail && + now$1() > workInProgressRootRenderTargetTime && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(type, !1), + (workInProgress.lanes = 4194304)); } - flags & 64 && commitClassCallbacks(finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; - case 3: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { - finishedRoot = null; - if (null !== finishedWork.child) - switch (finishedWork.child.tag) { - case 27: - case 5: - finishedRoot = getPublicInstance(finishedWork.child.stateNode); - break; - case 1: - finishedRoot = finishedWork.child.stateNode; - } - try { - commitCallbacks(flags, finishedRoot); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - } - break; - case 26: - case 27: - case 5: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 4 && commitProfilerUpdate(finishedWork, current); - break; - case 13: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - break; - case 22: - if (0 !== (finishedWork.mode & 1)) { - if ( - ((prevProps = - null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), - !prevProps) - ) { - current = - (null !== current && null !== current.memoizedState) || - offscreenSubtreeWasHidden; - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevProps; - (offscreenSubtreeWasHidden = current) && - !prevOffscreenSubtreeWasHidden - ? recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - 0 !== (finishedWork.subtreeFlags & 8772) - ) - : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; - } - } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); - flags & 512 && - ("manual" === finishedWork.memoizedProps.mode - ? safelyAttachRef(finishedWork, finishedWork.return) - : safelyDetachRef(finishedWork, finishedWork.return)); - break; - default: - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + else { + if (!newProps) + if ( + ((current = findFirstSuspended(updatePayload)), null !== current) + ) { + if ( + ((workInProgress.flags |= 128), + (newProps = !0), + (current = current.updateQueue), + (workInProgress.updateQueue = current), + scheduleRetryEffect(workInProgress, current), + cutOffTailIfNeeded(type, !0), + null === type.tail && + "hidden" === type.tailMode && + !updatePayload.alternate) + ) + return bubbleProperties(workInProgress), null; + } else + 2 * now$1() - type.renderingStartTime > + workInProgressRootRenderTargetTime && + 536870912 !== renderLanes && + ((workInProgress.flags |= 128), + (newProps = !0), + cutOffTailIfNeeded(type, !1), + (workInProgress.lanes = 4194304)); + type.isBackwards + ? ((updatePayload.sibling = workInProgress.child), + (workInProgress.child = updatePayload)) + : ((current = type.last), + null !== current + ? (current.sibling = updatePayload) + : (workInProgress.child = updatePayload), + (type.last = updatePayload)); + } + if (null !== type.tail) + return ( + (workInProgress = type.tail), + (type.rendering = workInProgress), + (type.tail = workInProgress.sibling), + (type.renderingStartTime = now$1()), + (workInProgress.sibling = null), + (current = suspenseStackCursor.current), + push(suspenseStackCursor, newProps ? (current & 1) | 2 : current & 1), + workInProgress + ); + bubbleProperties(workInProgress); + return null; + case 22: + case 23: + return ( + popSuspenseHandler(workInProgress), + popHiddenContext(), + (newProps = null !== workInProgress.memoizedState), + null !== current + ? (null !== current.memoizedState) !== newProps && + (workInProgress.flags |= 8192) + : newProps && (workInProgress.flags |= 8192), + newProps && 0 !== (workInProgress.mode & 1) + ? 0 !== (renderLanes & 536870912) && + 0 === (workInProgress.flags & 128) && + (bubbleProperties(workInProgress), + workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192)) + : bubbleProperties(workInProgress), + (renderLanes = workInProgress.updateQueue), + null !== renderLanes && + scheduleRetryEffect(workInProgress, renderLanes.retryQueue), + (renderLanes = null), + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (renderLanes = current.memoizedState.cachePool.pool), + (newProps = null), + null !== workInProgress.memoizedState && + null !== workInProgress.memoizedState.cachePool && + (newProps = workInProgress.memoizedState.cachePool.pool), + newProps !== renderLanes && (workInProgress.flags |= 2048), + null !== current && pop(resumedCache), + null + ); + case 24: + return ( + (renderLanes = null), + null !== current && (renderLanes = current.memoizedState.cache), + workInProgress.memoizedState.cache !== renderLanes && + (workInProgress.flags |= 2048), + popProvider(CacheContext), + bubbleProperties(workInProgress), + null + ); + case 25: + return null; } + throw Error( + "Unknown unit of work tag (" + + workInProgress.tag + + "). This error is likely caused by a bug in React. Please file an issue." + ); } -function detachFiberAfterEffects(fiber) { - var alternate = fiber.alternate; - null !== alternate && - ((fiber.alternate = null), detachFiberAfterEffects(alternate)); - fiber.child = null; - fiber.deletions = null; - fiber.sibling = null; - fiber.stateNode = null; - fiber.return = null; - fiber.dependencies = null; - fiber.memoizedProps = null; - fiber.memoizedState = null; - fiber.pendingProps = null; - fiber.stateNode = null; - fiber.updateQueue = null; -} -function isHostParent(fiber) { - return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; -} -function getHostSibling(fiber) { - a: for (;;) { - for (; null === fiber.sibling; ) { - if (null === fiber.return || isHostParent(fiber.return)) return null; - fiber = fiber.return; - } - fiber.sibling.return = fiber.return; - for ( - fiber = fiber.sibling; - 5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag; - - ) { - if (fiber.flags & 2) continue a; - if (null === fiber.child || 4 === fiber.tag) continue a; - else (fiber.child.return = fiber), (fiber = fiber.child); - } - if (!(fiber.flags & 2)) return fiber.stateNode; +function unwindWork(current, workInProgress) { + switch (workInProgress.tag) { + case 1: + return ( + isContextProvider(workInProgress.type) && popContext(), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), + 0 !== (workInProgress.mode & 2) && + transferActualDuration(workInProgress), + workInProgress) + : null + ); + case 3: + return ( + popProvider(CacheContext), + popHostContainer(), + pop(didPerformWorkStackCursor), + pop(contextStackCursor$1), + (current = workInProgress.flags), + 0 !== (current & 65536) && 0 === (current & 128) + ? ((workInProgress.flags = (current & -65537) | 128), workInProgress) + : null + ); + case 26: + case 27: + case 5: + return popHostContext(workInProgress), null; + case 13: + popSuspenseHandler(workInProgress); + current = workInProgress.memoizedState; + if ( + null !== current && + null !== current.dehydrated && + null === workInProgress.alternate + ) + throw Error( + "Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue." + ); + current = workInProgress.flags; + return current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), + 0 !== (workInProgress.mode & 2) && + transferActualDuration(workInProgress), + workInProgress) + : null; + case 19: + return pop(suspenseStackCursor), null; + case 4: + return popHostContainer(), null; + case 10: + return ( + popProvider( + enableRenderableContext + ? workInProgress.type + : workInProgress.type._context + ), + null + ); + case 22: + case 23: + return ( + popSuspenseHandler(workInProgress), + popHiddenContext(), + null !== current && pop(resumedCache), + (current = workInProgress.flags), + current & 65536 + ? ((workInProgress.flags = (current & -65537) | 128), + 0 !== (workInProgress.mode & 2) && + transferActualDuration(workInProgress), + workInProgress) + : null + ); + case 24: + return popProvider(CacheContext), null; + case 25: + return null; + default: + return null; } } -function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { - var tag = node.tag; - if (5 === tag || 6 === tag) - if (((node = node.stateNode), before)) { - if ("number" === typeof parent) - throw Error("Container does not support insertBefore operation"); - } else - ReactNativePrivateInterface.UIManager.setChildren(parent, [ - "number" === typeof node ? node : node._nativeTag - ]); - else if (4 !== tag && ((node = node.child), null !== node)) - for ( - insertOrAppendPlacementNodeIntoContainer(node, before, parent), - node = node.sibling; - null !== node; - - ) - insertOrAppendPlacementNodeIntoContainer(node, before, parent), - (node = node.sibling); -} -function insertOrAppendPlacementNode(node, before, parent) { - var tag = node.tag; - if (5 === tag || 6 === tag) - if (((node = node.stateNode), before)) { - tag = parent._children; - var index = tag.indexOf(node); - 0 <= index - ? (tag.splice(index, 1), - (before = tag.indexOf(before)), - tag.splice(before, 0, node), - ReactNativePrivateInterface.UIManager.manageChildren( - parent._nativeTag, - [index], - [before], - [], - [], - [] - )) - : ((before = tag.indexOf(before)), - tag.splice(before, 0, node), - ReactNativePrivateInterface.UIManager.manageChildren( - parent._nativeTag, - [], - [], - ["number" === typeof node ? node : node._nativeTag], - [before], - [] - )); - } else - (before = "number" === typeof node ? node : node._nativeTag), - (tag = parent._children), - (index = tag.indexOf(node)), - 0 <= index - ? (tag.splice(index, 1), - tag.push(node), - ReactNativePrivateInterface.UIManager.manageChildren( - parent._nativeTag, - [index], - [tag.length - 1], - [], - [], - [] - )) - : (tag.push(node), - ReactNativePrivateInterface.UIManager.manageChildren( - parent._nativeTag, - [], - [], - [before], - [tag.length - 1], - [] - )); - else if (4 !== tag && ((node = node.child), null !== node)) - for ( - insertOrAppendPlacementNode(node, before, parent), node = node.sibling; - null !== node; - - ) - insertOrAppendPlacementNode(node, before, parent), (node = node.sibling); -} -var hostParent = null, - hostParentIsContainer = !1; -function recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - parent -) { - for (parent = parent.child; null !== parent; ) - commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), - (parent = parent.sibling); -} -function commitDeletionEffectsOnFiber( - finishedRoot, - nearestMountedAncestor, - deletedFiber -) { - if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) - try { - injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); - } catch (err) {} - switch (deletedFiber.tag) { +function unwindInterruptedWork(current, interruptedWork) { + switch (interruptedWork.tag) { + case 1: + current = interruptedWork.type.childContextTypes; + null !== current && void 0 !== current && popContext(); + break; + case 3: + popProvider(CacheContext); + popHostContainer(); + pop(didPerformWorkStackCursor); + pop(contextStackCursor$1); + break; case 26: case 27: case 5: - offscreenSubtreeWasHidden || - safelyDetachRef(deletedFiber, nearestMountedAncestor); - case 6: - var prevHostParent = hostParent, - prevHostParentIsContainer = hostParentIsContainer; - hostParent = null; - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - hostParent = prevHostParent; - hostParentIsContainer = prevHostParentIsContainer; - null !== hostParent && - (hostParentIsContainer - ? ((finishedRoot = hostParent), - recursivelyUncacheFiberNode(deletedFiber.stateNode), - ReactNativePrivateInterface.UIManager.manageChildren( - finishedRoot, - [], - [], - [], - [], - [0] - )) - : ((finishedRoot = hostParent), - (nearestMountedAncestor = deletedFiber.stateNode), - recursivelyUncacheFiberNode(nearestMountedAncestor), - (deletedFiber = finishedRoot._children), - (nearestMountedAncestor = deletedFiber.indexOf( - nearestMountedAncestor - )), - deletedFiber.splice(nearestMountedAncestor, 1), - ReactNativePrivateInterface.UIManager.manageChildren( - finishedRoot._nativeTag, - [], - [], - [], - [], - [nearestMountedAncestor] - ))); - break; - case 18: - null !== hostParent && shim$1(); + popHostContext(interruptedWork); break; case 4: - prevHostParent = hostParent; - prevHostParentIsContainer = hostParentIsContainer; - hostParent = deletedFiber.stateNode.containerInfo; - hostParentIsContainer = !0; - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); - hostParent = prevHostParent; - hostParentIsContainer = prevHostParentIsContainer; + popHostContainer(); break; - case 0: - case 11: - case 14: - case 15: - if ( - !offscreenSubtreeWasHidden && - ((prevHostParent = deletedFiber.updateQueue), - null !== prevHostParent && - ((prevHostParent = prevHostParent.lastEffect), - null !== prevHostParent)) - ) { - prevHostParentIsContainer = prevHostParent = prevHostParent.next; - do { - var tag = prevHostParentIsContainer.tag, - inst = prevHostParentIsContainer.inst, - destroy = inst.destroy; - void 0 !== destroy && - (0 !== (tag & 2) - ? ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - )) - : 0 !== (tag & 4) && - (markComponentLayoutEffectUnmountStarted(deletedFiber), - shouldProfile(deletedFiber) - ? (startLayoutEffectTimer(), - (inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - ), - recordLayoutEffectDuration(deletedFiber)) - : ((inst.destroy = void 0), - safelyCallDestroy( - deletedFiber, - nearestMountedAncestor, - destroy - )), - markComponentLayoutEffectUnmountStopped())); - prevHostParentIsContainer = prevHostParentIsContainer.next; - } while (prevHostParentIsContainer !== prevHostParent); - } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); + case 13: + popSuspenseHandler(interruptedWork); break; - case 1: - if ( - !offscreenSubtreeWasHidden && - (safelyDetachRef(deletedFiber, nearestMountedAncestor), - (prevHostParent = deletedFiber.stateNode), - "function" === typeof prevHostParent.componentWillUnmount) - ) - try { - callComponentWillUnmountWithTimer(deletedFiber, prevHostParent); - } catch (error) { - captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); - } - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); + case 19: + pop(suspenseStackCursor); break; - case 21: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber + case 10: + popProvider( + enableRenderableContext + ? interruptedWork.type + : interruptedWork.type._context ); break; case 22: - safelyDetachRef(deletedFiber, nearestMountedAncestor); - deletedFiber.mode & 1 - ? ((offscreenSubtreeWasHidden = - (prevHostParent = offscreenSubtreeWasHidden) || - null !== deletedFiber.memoizedState), - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ), - (offscreenSubtreeWasHidden = prevHostParent)) - : recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); + case 23: + popSuspenseHandler(interruptedWork); + popHiddenContext(); + null !== current && pop(resumedCache); break; - default: - recursivelyTraverseDeletionEffects( - finishedRoot, - nearestMountedAncestor, - deletedFiber - ); + case 24: + popProvider(CacheContext); } } -function getRetryCache(finishedWork) { - switch (finishedWork.tag) { - case 13: - case 19: - var retryCache = finishedWork.stateNode; - null === retryCache && - (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); - return retryCache; - case 22: - return ( - (finishedWork = finishedWork.stateNode), - (retryCache = finishedWork._retryCache), - null === retryCache && - (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), - retryCache - ); - default: - throw Error( - "Unexpected Suspense handler tag (" + - finishedWork.tag + - "). This is a bug in React." - ); - } +var offscreenSubtreeIsHidden = !1, + offscreenSubtreeWasHidden = !1, + PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set, + nextEffect = null, + inProgressLanes = null, + inProgressRoot = null; +function shouldProfile(current) { + return 0 !== (current.mode & 2) && 0 !== (executionContext & 4); } -function attachSuspenseRetryListeners(finishedWork, wakeables) { - var retryCache = getRetryCache(finishedWork); - wakeables.forEach(function (wakeable) { - var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); - if (!retryCache.has(wakeable)) { - retryCache.add(wakeable); - if (isDevToolsPresent) - if (null !== inProgressLanes && null !== inProgressRoot) - restorePendingUpdaters(inProgressRoot, inProgressLanes); - else - throw Error( - "Expected finished root and lanes to be set. This is a bug in React." - ); - wakeable.then(retry, retry); +function callComponentWillUnmountWithTimer(current, instance) { + instance.props = current.memoizedProps; + instance.state = current.memoizedState; + if (shouldProfile(current)) + try { + startLayoutEffectTimer(), instance.componentWillUnmount(); + } finally { + recordLayoutEffectDuration(current); } - }); -} -function commitMutationEffects(root, finishedWork, committedLanes) { - inProgressLanes = committedLanes; - inProgressRoot = root; - commitMutationEffectsOnFiber(finishedWork, root); - inProgressRoot = inProgressLanes = null; + else instance.componentWillUnmount(); } -function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { - var deletions = parentFiber.deletions; - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - try { - var root = root$jscomp$0, - returnFiber = parentFiber, - parent = returnFiber; - a: for (; null !== parent; ) { - switch (parent.tag) { - case 27: - case 5: - hostParent = parent.stateNode; - hostParentIsContainer = !1; - break a; - case 3: - hostParent = parent.stateNode.containerInfo; - hostParentIsContainer = !0; - break a; - case 4: - hostParent = parent.stateNode.containerInfo; - hostParentIsContainer = !0; - break a; - } - parent = parent.return; - } - if (null === hostParent) - throw Error( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." - ); - commitDeletionEffectsOnFiber(root, returnFiber, childToDelete); - hostParent = null; - hostParentIsContainer = !1; - var alternate = childToDelete.alternate; - null !== alternate && (alternate.return = null); - childToDelete.return = null; - } catch (error) { - captureCommitPhaseError(childToDelete, parentFiber, error); +function safelyAttachRef(current, nearestMountedAncestor) { + try { + var ref = current.ref; + if (null !== ref) { + var instance = current.stateNode; + switch (current.tag) { + case 26: + case 27: + case 5: + var instanceToUse = getPublicInstance(instance); + break; + default: + instanceToUse = instance; } + if ("function" === typeof ref) + if (shouldProfile(current)) + try { + startLayoutEffectTimer(), (current.refCleanup = ref(instanceToUse)); + } finally { + recordLayoutEffectDuration(current); + } + else current.refCleanup = ref(instanceToUse); + else ref.current = instanceToUse; } - if (parentFiber.subtreeFlags & 12854) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), - (parentFiber = parentFiber.sibling); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } } -function commitMutationEffectsOnFiber(finishedWork, root) { - var current = finishedWork.alternate, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - try { - commitHookEffectListUnmount(3, finishedWork, finishedWork.return), - commitHookEffectListMount(3, finishedWork); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - if (shouldProfile(finishedWork)) { +function safelyDetachRef(current, nearestMountedAncestor) { + var ref = current.ref, + refCleanup = current.refCleanup; + if (null !== ref) + if ("function" === typeof refCleanup) + try { + if (shouldProfile(current)) try { - startLayoutEffectTimer(), - commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$119) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$119 - ); + startLayoutEffectTimer(), refCleanup(); + } finally { + recordLayoutEffectDuration(current); } - recordLayoutEffectDuration(finishedWork); - } else + else refCleanup(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } finally { + (current.refCleanup = null), + (current = current.alternate), + null != current && (current.refCleanup = null); + } + else if ("function" === typeof ref) + try { + if (shouldProfile(current)) try { - commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$120) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$120 - ); + startLayoutEffectTimer(), ref(null); + } finally { + recordLayoutEffectDuration(current); } + else ref(null); + } catch (error$104) { + captureCommitPhaseError(current, nearestMountedAncestor, error$104); } - break; - case 1: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - flags & 64 && - offscreenSubtreeIsHidden && - ((finishedWork = finishedWork.updateQueue), - null !== finishedWork && - ((flags = finishedWork.callbacks), - null !== flags && - ((current = finishedWork.shared.hiddenCallbacks), - (finishedWork.shared.hiddenCallbacks = - null === current ? flags : current.concat(flags))))); - break; - case 26: - case 27: - case 5: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { - var newProps = finishedWork.memoizedProps; - current = null !== current ? current.memoizedProps : newProps; - finishedWork.updateQueue = null; + else ref.current = null; +} +function safelyCallDestroy(current, nearestMountedAncestor, destroy) { + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } +} +var shouldFireAfterActiveInstanceBlur = !1; +function commitBeforeMutationEffects(root, firstChild) { + for (nextEffect = firstChild; null !== nextEffect; ) + if ( + ((root = nextEffect), + (firstChild = root.child), + 0 !== (root.subtreeFlags & 1028) && null !== firstChild) + ) + (firstChild.return = root), (nextEffect = firstChild); + else + for (; null !== nextEffect; ) { + root = nextEffect; try { - var viewConfig = flags.viewConfig; - instanceProps.set(flags._nativeTag, newProps); - var updatePayload = diffProperties( - null, - current, - newProps, - viewConfig.validAttributes - ); - null != updatePayload && - ReactNativePrivateInterface.UIManager.updateView( - flags._nativeTag, - viewConfig.uiViewClassName, - updatePayload - ); - } catch (error$123) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$123); - } - } - break; - case 6: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - if (flags & 4) { - if (null === finishedWork.stateNode) - throw Error( - "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." - ); - flags = finishedWork.stateNode; - current = finishedWork.memoizedProps; - try { - ReactNativePrivateInterface.UIManager.updateView( - flags, - "RCTRawText", - { text: current } - ); - } catch (error$124) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$124); - } - } - break; - case 3: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; - case 4: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - break; - case 13: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - finishedWork.child.flags & 8192 && - ((newProps = null !== finishedWork.memoizedState), - (current = null !== current && null !== current.memoizedState), - alwaysThrottleRetries - ? newProps !== current && (globalMostRecentFallbackTime = now$1()) - : newProps && !current && (globalMostRecentFallbackTime = now$1())); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); - break; - case 22: - flags & 512 && - null !== current && - safelyDetachRef(current, current.return); - viewConfig = null !== finishedWork.memoizedState; - updatePayload = null !== current && null !== current.memoizedState; - if (finishedWork.mode & 1) { - var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, - prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || viewConfig; - offscreenSubtreeWasHidden = - prevOffscreenSubtreeWasHidden || updatePayload; - recursivelyTraverseMutationEffects(root, finishedWork); - offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; - offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; - } else recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - root = finishedWork.stateNode; - root._current = finishedWork; - root._visibility &= -3; - root._visibility |= root._pendingVisibility & 2; - if ( - flags & 8192 && - ((root._visibility = viewConfig - ? root._visibility & -2 - : root._visibility | 1), - viewConfig && - ((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), - null === current || - updatePayload || - root || - (0 !== (finishedWork.mode & 1) && - recursivelyTraverseDisappearLayoutEffects(finishedWork))), - null === finishedWork.memoizedProps || - "manual" !== finishedWork.memoizedProps.mode) - ) - a: for (current = null, root = finishedWork; ; ) { - if (5 === root.tag) { - if (null === current) { - current = root; - try { - if (((newProps = root.stateNode), viewConfig)) { - var viewConfig$jscomp$0 = newProps.viewConfig; - var updatePayload$jscomp$0 = diffProperties( - null, - emptyObject$1, - { style: { display: "none" } }, - viewConfig$jscomp$0.validAttributes - ); - ReactNativePrivateInterface.UIManager.updateView( - newProps._nativeTag, - viewConfig$jscomp$0.uiViewClassName, - updatePayload$jscomp$0 - ); - } else { - var instance = root.stateNode, - props = root.memoizedProps, - viewConfig$jscomp$1 = instance.viewConfig, - prevProps = assign({}, props, { - style: [props.style, { display: "none" }] - }); - var updatePayload$jscomp$1 = diffProperties( - null, - prevProps, - props, - viewConfig$jscomp$1.validAttributes - ); - ReactNativePrivateInterface.UIManager.updateView( - instance._nativeTag, - viewConfig$jscomp$1.uiViewClassName, - updatePayload$jscomp$1 + var current = root.alternate, + flags = root.flags; + switch (root.tag) { + case 0: + break; + case 11: + case 15: + break; + case 1: + if (0 !== (flags & 1024) && null !== current) { + var prevProps = current.memoizedProps, + prevState = current.memoizedState, + instance = root.stateNode, + snapshot = instance.getSnapshotBeforeUpdate( + root.elementType === root.type + ? prevProps + : resolveDefaultProps(root.type, prevProps), + prevState ); - } - } catch (error) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error - ); + instance.__reactInternalSnapshotBeforeUpdate = snapshot; } - } - } else if (6 === root.tag) { - if (null === current) - try { - throw Error("Not yet implemented."); - } catch (error$113) { - captureCommitPhaseError( - finishedWork, - finishedWork.return, - error$113 + break; + case 3: + break; + case 5: + case 26: + case 27: + case 6: + case 4: + case 17: + break; + default: + if (0 !== (flags & 1024)) + throw Error( + "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); - } - } else if ( - ((22 !== root.tag && 23 !== root.tag) || - null === root.memoizedState || - root === finishedWork) && - null !== root.child - ) { - root.child.return = root; - root = root.child; - continue; - } - if (root === finishedWork) break a; - for (; null === root.sibling; ) { - if (null === root.return || root.return === finishedWork) break a; - current === root && (current = null); - root = root.return; } - current === root && (current = null); - root.sibling.return = root.return; - root = root.sibling; + } catch (error) { + captureCommitPhaseError(root, root.return, error); } - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((current = flags.retryQueue), - null !== current && - ((flags.retryQueue = null), - attachSuspenseRetryListeners(finishedWork, current)))); - break; - case 19: - recursivelyTraverseMutationEffects(root, finishedWork); - commitReconciliationEffects(finishedWork); - flags & 4 && - ((flags = finishedWork.updateQueue), - null !== flags && - ((finishedWork.updateQueue = null), - attachSuspenseRetryListeners(finishedWork, flags))); - break; - case 21: - break; - default: - recursivelyTraverseMutationEffects(root, finishedWork), - commitReconciliationEffects(finishedWork); - } -} -function commitReconciliationEffects(finishedWork) { - var flags = finishedWork.flags; - if (flags & 2) { - try { - a: { - for (var parent = finishedWork.return; null !== parent; ) { - if (isHostParent(parent)) { - var JSCompiler_inline_result = parent; - break a; - } - parent = parent.return; + firstChild = root.sibling; + if (null !== firstChild) { + firstChild.return = root.return; + nextEffect = firstChild; + break; } - throw Error( - "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." - ); + nextEffect = root.return; } - switch (JSCompiler_inline_result.tag) { - case 27: - case 5: - var parent$jscomp$0 = JSCompiler_inline_result.stateNode; - JSCompiler_inline_result.flags & 32 && - (JSCompiler_inline_result.flags &= -33); - var before = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); - break; - case 3: - case 4: - var parent$114 = JSCompiler_inline_result.stateNode.containerInfo, - before$115 = getHostSibling(finishedWork); - insertOrAppendPlacementNodeIntoContainer( - finishedWork, - before$115, - parent$114 - ); - break; - default: - throw Error( - "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." - ); - } - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - finishedWork.flags &= -3; - } - flags & 4096 && (finishedWork.flags &= -4097); -} -function commitLayoutEffects(finishedWork, root, committedLanes) { - inProgressLanes = committedLanes; - inProgressRoot = root; - commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); - inProgressRoot = inProgressLanes = null; -} -function recursivelyTraverseLayoutEffects(root, parentFiber) { - if (parentFiber.subtreeFlags & 8772) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), - (parentFiber = parentFiber.sibling); + current = shouldFireAfterActiveInstanceBlur; + shouldFireAfterActiveInstanceBlur = !1; + return current; } -function recursivelyTraverseDisappearLayoutEffects(parentFiber) { - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedWork = parentFiber; - switch (finishedWork.tag) { - case 0: - case 11: - case 14: - case 15: - if (shouldProfile(finishedWork)) - try { - startLayoutEffectTimer(), - commitHookEffectListUnmount(4, finishedWork, finishedWork.return); - } finally { - recordLayoutEffectDuration(finishedWork); - } - else commitHookEffectListUnmount(4, finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 1: - safelyDetachRef(finishedWork, finishedWork.return); - var instance = finishedWork.stateNode; - if ("function" === typeof instance.componentWillUnmount) { - var current = finishedWork, - nearestMountedAncestor = finishedWork.return; - try { - callComponentWillUnmountWithTimer(current, instance); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } - } - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 26: - case 27: - case 5: - safelyDetachRef(finishedWork, finishedWork.return); - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - case 22: - safelyDetachRef(finishedWork, finishedWork.return); - null === finishedWork.memoizedState && - recursivelyTraverseDisappearLayoutEffects(finishedWork); - break; - default: - recursivelyTraverseDisappearLayoutEffects(finishedWork); - } - parentFiber = parentFiber.sibling; +function commitHookEffectListUnmount( + flags, + finishedWork, + nearestMountedAncestor +) { + var updateQueue = finishedWork.updateQueue; + updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; + if (null !== updateQueue) { + var effect = (updateQueue = updateQueue.next); + do { + if ((effect.tag & flags) === flags) { + var inst = effect.inst, + destroy = inst.destroy; + void 0 !== destroy && + ((inst.destroy = void 0), + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted && + injectedProfilingHooks.markComponentPassiveEffectUnmountStarted( + finishedWork + ) + : 0 !== (flags & 4) && + markComponentLayoutEffectUnmountStarted(finishedWork), + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy), + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped && + injectedProfilingHooks.markComponentPassiveEffectUnmountStopped() + : 0 !== (flags & 4) && markComponentLayoutEffectUnmountStopped()); + } + effect = effect.next; + } while (effect !== updateQueue); } } -function recursivelyTraverseReappearLayoutEffects( - finishedRoot$jscomp$0, - parentFiber, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, - finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - commitHookLayoutEffects(finishedWork, 4); - break; - case 1: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - finishedRoot = finishedWork.stateNode; - if ("function" === typeof finishedRoot.componentDidMount) - try { - finishedRoot.componentDidMount(); - } catch (error) { - captureCommitPhaseError(finishedWork, finishedWork.return, error); - } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; - if (null !== hiddenCallbacks) - for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ +function commitHookEffectListMount(flags, finishedWork) { + var updateQueue = finishedWork.updateQueue; + updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; + if (null !== updateQueue) { + var effect = (updateQueue = updateQueue.next); + do { + if ((effect.tag & flags) === flags) { + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted && + injectedProfilingHooks.markComponentPassiveEffectMountStarted( + finishedWork ) - callCallback(hiddenCallbacks[current], finishedRoot); - } - includeWorkInProgressEffects && - flags & 64 && - commitClassCallbacks(finishedWork); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 26: - case 27: - case 5: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - case 12: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - flags & 4 && - commitProfilerUpdate(finishedWork, current); - break; - case 13: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - break; - case 22: - null === finishedWork.memoizedState && - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - safelyAttachRef(finishedWork, finishedWork.return); - break; - default: - recursivelyTraverseReappearLayoutEffects( - finishedRoot, - finishedWork, - includeWorkInProgressEffects - ); - } - parentFiber = parentFiber.sibling; + : 0 !== (flags & 4) && + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted && + injectedProfilingHooks.markComponentLayoutEffectMountStarted( + finishedWork + ); + var create$105 = effect.create, + inst = effect.inst; + create$105 = create$105(); + inst.destroy = create$105; + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped && + injectedProfilingHooks.markComponentPassiveEffectMountStopped() + : 0 !== (flags & 4) && + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped && + injectedProfilingHooks.markComponentLayoutEffectMountStopped(); + } + effect = effect.next; + } while (effect !== updateQueue); } } -function commitHookPassiveMountEffects(finishedWork, hookFlags) { +function commitHookLayoutEffects(finishedWork, hookFlags) { if (shouldProfile(finishedWork)) { - passiveEffectStartTime = now(); try { - commitHookEffectListMount(hookFlags, finishedWork); + startLayoutEffectTimer(), + commitHookEffectListMount(hookFlags, finishedWork); } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } - recordPassiveEffectDuration(finishedWork); + recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$128) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$128); + } catch (error$107) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$107); } } -function commitOffscreenPassiveMountEffects(current, finishedWork) { - var previousCache = null; - null !== current && - null !== current.memoizedState && - null !== current.memoizedState.cachePool && - (previousCache = current.memoizedState.cachePool.pool); - current = null; - null !== finishedWork.memoizedState && - null !== finishedWork.memoizedState.cachePool && - (current = finishedWork.memoizedState.cachePool.pool); - current !== previousCache && - (null != current && current.refCount++, - null != previousCache && releaseCache(previousCache)); -} -function commitCachePassiveMountEffect(current, finishedWork) { - current = null; - null !== finishedWork.alternate && - (current = finishedWork.alternate.memoizedState.cache); - finishedWork = finishedWork.memoizedState.cache; - finishedWork !== current && - (finishedWork.refCount++, null != current && releaseCache(current)); +function commitClassCallbacks(finishedWork) { + var updateQueue = finishedWork.updateQueue; + if (null !== updateQueue) { + var instance = finishedWork.stateNode; + try { + commitCallbacks(updateQueue, instance); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + } } -function recursivelyTraversePassiveMountEffects( - root, - parentFiber, - committedLanes, - committedTransitions -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveMountOnFiber( - root, - parentFiber, - committedLanes, - committedTransitions - ), - (parentFiber = parentFiber.sibling); +function commitProfilerUpdate(finishedWork, current) { + if (executionContext & 4) + try { + var _finishedWork$memoize2 = finishedWork.memoizedProps, + onCommit = _finishedWork$memoize2.onCommit, + onRender = _finishedWork$memoize2.onRender, + effectDuration = finishedWork.stateNode.effectDuration; + _finishedWork$memoize2 = commitTime; + current = null === current ? "mount" : "update"; + currentUpdateIsNested && (current = "nested-update"); + "function" === typeof onRender && + onRender( + finishedWork.memoizedProps.id, + current, + finishedWork.actualDuration, + finishedWork.treeBaseDuration, + finishedWork.actualStartTime, + _finishedWork$memoize2 + ); + "function" === typeof onCommit && + onCommit( + finishedWork.memoizedProps.id, + current, + effectDuration, + _finishedWork$memoize2 + ); + enqueuePendingPassiveProfilerEffect(finishedWork); + var parentFiber = finishedWork.return; + a: for (; null !== parentFiber; ) { + switch (parentFiber.tag) { + case 3: + parentFiber.stateNode.effectDuration += effectDuration; + break a; + case 12: + parentFiber.stateNode.effectDuration += effectDuration; + break a; + } + parentFiber = parentFiber.return; + } + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } } -function commitPassiveMountOnFiber( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions -) { +function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { var flags = finishedWork.flags; switch (finishedWork.tag) { case 0: case 11: case 15: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 4 && commitHookLayoutEffects(finishedWork, 5); + break; + case 1: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 4) + if (((finishedRoot = finishedWork.stateNode), null === current)) + if (shouldProfile(finishedWork)) { + try { + startLayoutEffectTimer(), finishedRoot.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + recordLayoutEffectDuration(finishedWork); + } else + try { + finishedRoot.componentDidMount(); + } catch (error$108) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$108 + ); + } + else { + var prevProps = + finishedWork.elementType === finishedWork.type + ? current.memoizedProps + : resolveDefaultProps(finishedWork.type, current.memoizedProps); + current = current.memoizedState; + if (shouldProfile(finishedWork)) { + try { + startLayoutEffectTimer(), + finishedRoot.componentDidUpdate( + prevProps, + current, + finishedRoot.__reactInternalSnapshotBeforeUpdate + ); + } catch (error$109) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$109 + ); + } + recordLayoutEffectDuration(finishedWork); + } else + try { + finishedRoot.componentDidUpdate( + prevProps, + current, + finishedRoot.__reactInternalSnapshotBeforeUpdate + ); + } catch (error$110) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$110 + ); + } + } + flags & 64 && commitClassCallbacks(finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; case 3: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - ((finishedRoot = null), - null !== finishedWork.alternate && - (finishedRoot = finishedWork.alternate.memoizedState.cache), - (finishedWork = finishedWork.memoizedState.cache), - finishedWork !== finishedRoot && - (finishedWork.refCount++, - null != finishedRoot && releaseCache(finishedRoot))); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) { + finishedRoot = null; + if (null !== finishedWork.child) + switch (finishedWork.child.tag) { + case 27: + case 5: + finishedRoot = getPublicInstance(finishedWork.child.stateNode); + break; + case 1: + finishedRoot = finishedWork.child.stateNode; + } + try { + commitCallbacks(flags, finishedRoot); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + } break; - case 23: + case 26: + case 27: + case 5: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 512 && safelyAttachRef(finishedWork, finishedWork.return); break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) - : ((instance._visibility |= 4), - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - )) - : instance._visibility & 4 - ? recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - 0 !== (finishedWork.subtreeFlags & 10256) - )); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); + case 12: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 4 && commitProfilerUpdate(finishedWork, current); break; - case 24: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + case 13: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); break; - default: - recursivelyTraversePassiveMountEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions - ); - } -} -function recursivelyTraverseReconnectPassiveEffects( - finishedRoot$jscomp$0, - parentFiber, - committedLanes$jscomp$0, - committedTransitions$jscomp$0, - includeWorkInProgressEffects -) { - includeWorkInProgressEffects = - includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - committedLanes = committedLanes$jscomp$0, - committedTransitions = committedTransitions$jscomp$0, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 0: - case 11: - case 15: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - commitHookPassiveMountEffects(finishedWork, 8); - break; - case 23: - break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState - ? instance._visibility & 4 - ? recursivelyTraverseReconnectPassiveEffects( + case 22: + if (0 !== (finishedWork.mode & 1)) { + if ( + ((prevProps = + null !== finishedWork.memoizedState || offscreenSubtreeIsHidden), + !prevProps) + ) { + current = + (null !== current && null !== current.memoizedState) || + offscreenSubtreeWasHidden; + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevProps; + (offscreenSubtreeWasHidden = current) && + !prevOffscreenSubtreeWasHidden + ? recursivelyTraverseReappearLayoutEffects( finishedRoot, finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ) - : finishedWork.mode & 1 - ? recursivelyTraverseAtomicPassiveEffects( - finishedRoot, - finishedWork + 0 !== (finishedWork.subtreeFlags & 8772) ) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )) - : ((instance._visibility |= 4), - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - )); - includeWorkInProgressEffects && - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - includeWorkInProgressEffects && - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseReconnectPassiveEffects( - finishedRoot, - finishedWork, - committedLanes, - committedTransitions, - includeWorkInProgressEffects - ); - } - parentFiber = parentFiber.sibling; + : recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + } + } else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + flags & 512 && + ("manual" === finishedWork.memoizedProps.mode + ? safelyAttachRef(finishedWork, finishedWork.return) + : safelyDetachRef(finishedWork, finishedWork.return)); + break; + default: + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); } } -function recursivelyTraverseAtomicPassiveEffects( - finishedRoot$jscomp$0, - parentFiber -) { - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var finishedRoot = finishedRoot$jscomp$0, - finishedWork = parentFiber, - flags = finishedWork.flags; - switch (finishedWork.tag) { - case 22: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitOffscreenPassiveMountEffects( - finishedWork.alternate, - finishedWork - ); - break; - case 24: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - flags & 2048 && - commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); - break; - default: - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); - } - parentFiber = parentFiber.sibling; - } +function detachFiberAfterEffects(fiber) { + var alternate = fiber.alternate; + null !== alternate && + ((fiber.alternate = null), detachFiberAfterEffects(alternate)); + fiber.child = null; + fiber.deletions = null; + fiber.sibling = null; + fiber.stateNode = null; + fiber.return = null; + fiber.dependencies = null; + fiber.memoizedProps = null; + fiber.memoizedState = null; + fiber.pendingProps = null; + fiber.stateNode = null; + fiber.updateQueue = null; } -var suspenseyCommitFlag = 8192; -function recursivelyAccumulateSuspenseyCommit(parentFiber) { - if (parentFiber.subtreeFlags & suspenseyCommitFlag) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - accumulateSuspenseyCommitOnFiber(parentFiber), - (parentFiber = parentFiber.sibling); +function isHostParent(fiber) { + return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; } -function accumulateSuspenseyCommitOnFiber(fiber) { - switch (fiber.tag) { - case 26: - recursivelyAccumulateSuspenseyCommit(fiber); - if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) - throw Error( - "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." - ); - break; - case 5: - recursivelyAccumulateSuspenseyCommit(fiber); - break; - case 3: - case 4: - recursivelyAccumulateSuspenseyCommit(fiber); - break; - case 22: - if (null === fiber.memoizedState) { - var current = fiber.alternate; - null !== current && null !== current.memoizedState - ? ((current = suspenseyCommitFlag), - (suspenseyCommitFlag = 16777216), - recursivelyAccumulateSuspenseyCommit(fiber), - (suspenseyCommitFlag = current)) - : recursivelyAccumulateSuspenseyCommit(fiber); - } - break; - default: - recursivelyAccumulateSuspenseyCommit(fiber); +function getHostSibling(fiber) { + a: for (;;) { + for (; null === fiber.sibling; ) { + if (null === fiber.return || isHostParent(fiber.return)) return null; + fiber = fiber.return; + } + fiber.sibling.return = fiber.return; + for ( + fiber = fiber.sibling; + 5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag; + + ) { + if (fiber.flags & 2) continue a; + if (null === fiber.child || 4 === fiber.tag) continue a; + else (fiber.child.return = fiber), (fiber = fiber.child); + } + if (!(fiber.flags & 2)) return fiber.stateNode; } } -function detachAlternateSiblings(parentFiber) { - var previousFiber = parentFiber.alternate; - if ( - null !== previousFiber && - ((parentFiber = previousFiber.child), null !== parentFiber) - ) { - previousFiber.child = null; - do - (previousFiber = parentFiber.sibling), - (parentFiber.sibling = null), - (parentFiber = previousFiber); - while (null !== parentFiber); - } +function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { + var tag = node.tag; + if (5 === tag || 6 === tag) + if (((node = node.stateNode), before)) { + if ("number" === typeof parent) + throw Error("Container does not support insertBefore operation"); + } else + ReactNativePrivateInterface.UIManager.setChildren(parent, [ + "number" === typeof node ? node : node._nativeTag + ]); + else if (4 !== tag && ((node = node.child), null !== node)) + for ( + insertOrAppendPlacementNodeIntoContainer(node, before, parent), + node = node.sibling; + null !== node; + + ) + insertOrAppendPlacementNodeIntoContainer(node, before, parent), + (node = node.sibling); } -function commitHookPassiveUnmountEffects( - finishedWork, - nearestMountedAncestor, - hookFlags -) { - shouldProfile(finishedWork) - ? ((passiveEffectStartTime = now()), - commitHookEffectListUnmount( - hookFlags, - finishedWork, - nearestMountedAncestor - ), - recordPassiveEffectDuration(finishedWork)) - : commitHookEffectListUnmount( - hookFlags, - finishedWork, - nearestMountedAncestor - ); +function insertOrAppendPlacementNode(node, before, parent) { + var tag = node.tag; + if (5 === tag || 6 === tag) + if (((node = node.stateNode), before)) { + tag = parent._children; + var index = tag.indexOf(node); + 0 <= index + ? (tag.splice(index, 1), + (before = tag.indexOf(before)), + tag.splice(before, 0, node), + ReactNativePrivateInterface.UIManager.manageChildren( + parent._nativeTag, + [index], + [before], + [], + [], + [] + )) + : ((before = tag.indexOf(before)), + tag.splice(before, 0, node), + ReactNativePrivateInterface.UIManager.manageChildren( + parent._nativeTag, + [], + [], + ["number" === typeof node ? node : node._nativeTag], + [before], + [] + )); + } else + (before = "number" === typeof node ? node : node._nativeTag), + (tag = parent._children), + (index = tag.indexOf(node)), + 0 <= index + ? (tag.splice(index, 1), + tag.push(node), + ReactNativePrivateInterface.UIManager.manageChildren( + parent._nativeTag, + [index], + [tag.length - 1], + [], + [], + [] + )) + : (tag.push(node), + ReactNativePrivateInterface.UIManager.manageChildren( + parent._nativeTag, + [], + [], + [before], + [tag.length - 1], + [] + )); + else if (4 !== tag && ((node = node.child), null !== node)) + for ( + insertOrAppendPlacementNode(node, before, parent), node = node.sibling; + null !== node; + + ) + insertOrAppendPlacementNode(node, before, parent), (node = node.sibling); } -function recursivelyTraversePassiveUnmountEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); - } - detachAlternateSiblings(parentFiber); - } - if (parentFiber.subtreeFlags & 10256) - for (parentFiber = parentFiber.child; null !== parentFiber; ) - commitPassiveUnmountOnFiber(parentFiber), - (parentFiber = parentFiber.sibling); +var hostParent = null, + hostParentIsContainer = !1; +function recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + parent +) { + for (parent = parent.child; null !== parent; ) + commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent), + (parent = parent.sibling); } -function commitPassiveUnmountOnFiber(finishedWork) { - switch (finishedWork.tag) { +function commitDeletionEffectsOnFiber( + finishedRoot, + nearestMountedAncestor, + deletedFiber +) { + if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) + try { + injectedHook.onCommitFiberUnmount(rendererID, deletedFiber); + } catch (err) {} + switch (deletedFiber.tag) { + case 26: + case 27: + case 5: + offscreenSubtreeWasHidden || + safelyDetachRef(deletedFiber, nearestMountedAncestor); + case 6: + var prevHostParent = hostParent, + prevHostParentIsContainer = hostParentIsContainer; + hostParent = null; + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + hostParent = prevHostParent; + hostParentIsContainer = prevHostParentIsContainer; + null !== hostParent && + (hostParentIsContainer + ? ((finishedRoot = hostParent), + recursivelyUncacheFiberNode(deletedFiber.stateNode), + ReactNativePrivateInterface.UIManager.manageChildren( + finishedRoot, + [], + [], + [], + [], + [0] + )) + : ((finishedRoot = hostParent), + (nearestMountedAncestor = deletedFiber.stateNode), + recursivelyUncacheFiberNode(nearestMountedAncestor), + (deletedFiber = finishedRoot._children), + (nearestMountedAncestor = deletedFiber.indexOf( + nearestMountedAncestor + )), + deletedFiber.splice(nearestMountedAncestor, 1), + ReactNativePrivateInterface.UIManager.manageChildren( + finishedRoot._nativeTag, + [], + [], + [], + [], + [nearestMountedAncestor] + ))); + break; + case 18: + null !== hostParent && shim$1(); + break; + case 4: + prevHostParent = hostParent; + prevHostParentIsContainer = hostParentIsContainer; + hostParent = deletedFiber.stateNode.containerInfo; + hostParentIsContainer = !0; + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + hostParent = prevHostParent; + hostParentIsContainer = prevHostParentIsContainer; + break; case 0: case 11: + case 14: case 15: - recursivelyTraversePassiveUnmountEffects(finishedWork); - finishedWork.flags & 2048 && - commitHookPassiveUnmountEffects(finishedWork, finishedWork.return, 9); + if ( + !offscreenSubtreeWasHidden && + ((prevHostParent = deletedFiber.updateQueue), + null !== prevHostParent && + ((prevHostParent = prevHostParent.lastEffect), + null !== prevHostParent)) + ) { + prevHostParentIsContainer = prevHostParent = prevHostParent.next; + do { + var tag = prevHostParentIsContainer.tag, + inst = prevHostParentIsContainer.inst, + destroy = inst.destroy; + void 0 !== destroy && + (0 !== (tag & 2) + ? ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + )) + : 0 !== (tag & 4) && + (markComponentLayoutEffectUnmountStarted(deletedFiber), + shouldProfile(deletedFiber) + ? (startLayoutEffectTimer(), + (inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + ), + recordLayoutEffectDuration(deletedFiber)) + : ((inst.destroy = void 0), + safelyCallDestroy( + deletedFiber, + nearestMountedAncestor, + destroy + )), + markComponentLayoutEffectUnmountStopped())); + prevHostParentIsContainer = prevHostParentIsContainer.next; + } while (prevHostParentIsContainer !== prevHostParent); + } + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); break; - case 22: - var instance = finishedWork.stateNode; - null !== finishedWork.memoizedState && - instance._visibility & 4 && - (null === finishedWork.return || 13 !== finishedWork.return.tag) - ? ((instance._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(finishedWork)) - : recursivelyTraversePassiveUnmountEffects(finishedWork); + case 1: + if ( + !offscreenSubtreeWasHidden && + (safelyDetachRef(deletedFiber, nearestMountedAncestor), + (prevHostParent = deletedFiber.stateNode), + "function" === typeof prevHostParent.componentWillUnmount) + ) + try { + callComponentWillUnmountWithTimer(deletedFiber, prevHostParent); + } catch (error) { + captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error); + } + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); break; - default: - recursivelyTraversePassiveUnmountEffects(finishedWork); - } -} -function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { - var deletions = parentFiber.deletions; - if (0 !== (parentFiber.flags & 16)) { - if (null !== deletions) - for (var i = 0; i < deletions.length; i++) { - var childToDelete = deletions[i]; - nextEffect = childToDelete; - commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - childToDelete, - parentFiber - ); - } - detachAlternateSiblings(parentFiber); + case 21: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + case 22: + safelyDetachRef(deletedFiber, nearestMountedAncestor); + deletedFiber.mode & 1 + ? ((offscreenSubtreeWasHidden = + (prevHostParent = offscreenSubtreeWasHidden) || + null !== deletedFiber.memoizedState), + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ), + (offscreenSubtreeWasHidden = prevHostParent)) + : recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); + break; + default: + recursivelyTraverseDeletionEffects( + finishedRoot, + nearestMountedAncestor, + deletedFiber + ); } - for (parentFiber = parentFiber.child; null !== parentFiber; ) { - deletions = parentFiber; - switch (deletions.tag) { - case 0: - case 11: - case 15: - commitHookPassiveUnmountEffects(deletions, deletions.return, 8); - recursivelyTraverseDisconnectPassiveEffects(deletions); - break; - case 22: - i = deletions.stateNode; - i._visibility & 4 && - ((i._visibility &= -5), - recursivelyTraverseDisconnectPassiveEffects(deletions)); - break; - default: - recursivelyTraverseDisconnectPassiveEffects(deletions); - } - parentFiber = parentFiber.sibling; +} +function getRetryCache(finishedWork) { + switch (finishedWork.tag) { + case 13: + case 19: + var retryCache = finishedWork.stateNode; + null === retryCache && + (retryCache = finishedWork.stateNode = new PossiblyWeakSet()); + return retryCache; + case 22: + return ( + (finishedWork = finishedWork.stateNode), + (retryCache = finishedWork._retryCache), + null === retryCache && + (retryCache = finishedWork._retryCache = new PossiblyWeakSet()), + retryCache + ); + default: + throw Error( + "Unexpected Suspense handler tag (" + + finishedWork.tag + + "). This is a bug in React." + ); } } -function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( - deletedSubtreeRoot, - nearestMountedAncestor -) { - for (; null !== nextEffect; ) { - var fiber = nextEffect; - switch (fiber.tag) { - case 0: - case 11: - case 15: - commitHookPassiveUnmountEffects(fiber, nearestMountedAncestor, 8); - break; - case 23: - case 22: - if ( - null !== fiber.memoizedState && - null !== fiber.memoizedState.cachePool - ) { - var cache = fiber.memoizedState.cachePool.pool; - null != cache && cache.refCount++; - } - break; - case 24: - releaseCache(fiber.memoizedState.cache); +function attachSuspenseRetryListeners(finishedWork, wakeables) { + var retryCache = getRetryCache(finishedWork); + wakeables.forEach(function (wakeable) { + var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); + if (!retryCache.has(wakeable)) { + retryCache.add(wakeable); + if (isDevToolsPresent) + if (null !== inProgressLanes && null !== inProgressRoot) + restorePendingUpdaters(inProgressRoot, inProgressLanes); + else + throw Error( + "Expected finished root and lanes to be set. This is a bug in React." + ); + wakeable.then(retry, retry); } - cache = fiber.child; - if (null !== cache) (cache.return = fiber), (nextEffect = cache); - else - a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { - cache = nextEffect; - var sibling = cache.sibling, - returnFiber = cache.return; - detachFiberAfterEffects(cache); - if (cache === fiber) { - nextEffect = null; - break a; - } - if (null !== sibling) { - sibling.return = returnFiber; - nextEffect = sibling; - break a; + }); +} +function commitMutationEffects(root, finishedWork, committedLanes) { + inProgressLanes = committedLanes; + inProgressRoot = root; + commitMutationEffectsOnFiber(finishedWork, root); + inProgressRoot = inProgressLanes = null; +} +function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { + var deletions = parentFiber.deletions; + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + try { + var root = root$jscomp$0, + returnFiber = parentFiber, + parent = returnFiber; + a: for (; null !== parent; ) { + switch (parent.tag) { + case 27: + case 5: + hostParent = parent.stateNode; + hostParentIsContainer = !1; + break a; + case 3: + hostParent = parent.stateNode.containerInfo; + hostParentIsContainer = !0; + break a; + case 4: + hostParent = parent.stateNode.containerInfo; + hostParentIsContainer = !0; + break a; + } + parent = parent.return; } - nextEffect = returnFiber; + if (null === hostParent) + throw Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ); + commitDeletionEffectsOnFiber(root, returnFiber, childToDelete); + hostParent = null; + hostParentIsContainer = !1; + var alternate = childToDelete.alternate; + null !== alternate && (alternate.return = null); + childToDelete.return = null; + } catch (error) { + captureCommitPhaseError(childToDelete, parentFiber, error); } - } -} -var DefaultCacheDispatcher = { - getCacheSignal: function () { - return readContext(CacheContext).controller.signal; - }, - getCacheForType: function (resourceType) { - var cache = readContext(CacheContext), - cacheForType = cache.data.get(resourceType); - void 0 === cacheForType && - ((cacheForType = resourceType()), - cache.data.set(resourceType, cacheForType)); - return cacheForType; } - }, - PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, - executionContext = 0, - workInProgressRoot = null, - workInProgress = null, - workInProgressRootRenderLanes = 0, - workInProgressSuspendedReason = 0, - workInProgressThrownValue = null, - workInProgressRootDidAttachPingListener = !1, - entangledRenderLanes = 0, - workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, - workInProgressRootSkippedLanes = 0, - workInProgressRootInterleavedUpdatedLanes = 0, - workInProgressRootPingedLanes = 0, - workInProgressDeferredLane = 0, - workInProgressRootConcurrentErrors = null, - workInProgressRootRecoverableErrors = null, - workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, - globalMostRecentFallbackTime = 0, - workInProgressRootRenderTargetTime = Infinity, - workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, - legacyErrorBoundariesThatAlreadyFailed = null, - rootDoesHavePassiveEffects = !1, - rootWithPendingPassiveEffects = null, - pendingPassiveEffectsLanes = 0, - pendingPassiveProfilerEffects = [], - pendingPassiveEffectsRemainingLanes = 0, - pendingPassiveTransitions = null, - nestedUpdateCount = 0, - rootWithNestedUpdates = null; -function requestUpdateLane(fiber) { - if (0 === (fiber.mode & 1)) return 2; - if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) - return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== requestCurrentTransition()) - return ( - (fiber = currentEntangledLane), - 0 !== fiber ? fiber : requestTransitionLane() - ); - fiber = currentUpdatePriority; - return 0 !== fiber ? fiber : 32; -} -function requestDeferredLane() { - 0 === workInProgressDeferredLane && - (workInProgressDeferredLane = - 0 !== (workInProgressRootRenderLanes & 536870912) - ? 536870912 - : claimNextTransitionLane()); - var suspenseHandler = suspenseHandlerStackCursor.current; - null !== suspenseHandler && (suspenseHandler.flags |= 32); - return workInProgressDeferredLane; + if (parentFiber.subtreeFlags & 12854) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), + (parentFiber = parentFiber.sibling); } -function scheduleUpdateOnFiber(root, fiber, lane) { - if ( - (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || - null !== root.cancelPendingCommit - ) - prepareFreshStack(root, 0), - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); - markRootUpdated(root, lane); - if (0 === (executionContext & 2) || root !== workInProgressRoot) - isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), - root === workInProgressRoot && - (0 === (executionContext & 2) && - (workInProgressRootInterleavedUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended( - root, - workInProgressRootRenderLanes, - workInProgressDeferredLane - )), - ensureRootIsScheduled(root), - 2 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now$1() + 500), - flushSyncWorkAcrossRoots_impl(!0)); -} -function performConcurrentWorkOnRoot(root, didTimeout) { - nestedUpdateScheduled = currentUpdateIsNested = !1; - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var originalCallbackNode = root.callbackNode; - if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) - return null; - var lanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes : 0 - ); - if (0 === lanes) return null; - var exitStatus = (didTimeout = - 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes) && !didTimeout) - ? renderRootConcurrent(root, lanes) - : renderRootSync(root, lanes); - if (0 !== exitStatus) { - var renderWasConcurrent = didTimeout; - do { - if (6 === exitStatus) markRootSuspended(root, lanes, 0); - else { - didTimeout = root.current.alternate; - if ( - renderWasConcurrent && - !isRenderConsistentWithExternalStores(didTimeout) - ) { - exitStatus = renderRootSync(root, lanes); - renderWasConcurrent = !1; - continue; - } - if (2 === exitStatus) { - renderWasConcurrent = lanes; - var errorRetryLanes = getLanesToRetrySynchronouslyOnError( - root, - renderWasConcurrent - ); - 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - root, - renderWasConcurrent, - errorRetryLanes - ))); +function commitMutationEffectsOnFiber(finishedWork, root) { + var current = finishedWork.alternate, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + try { + commitHookEffectListUnmount(3, finishedWork, finishedWork.return), + commitHookEffectListMount(3, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); } - if (1 === exitStatus) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); - root.finishedWork = didTimeout; - root.finishedLanes = lanes; - a: { - renderWasConcurrent = root; - switch (exitStatus) { - case 0: - case 1: - throw Error("Root did not complete. This is a bug in React."); - case 4: - if ((lanes & 4194176) === lanes) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane - ); - break a; - } - break; - case 2: - case 3: - case 5: - break; - default: - throw Error("Unknown root exit status."); - } - if ( - (lanes & 62914560) === lanes && - (alwaysThrottleRetries || 3 === exitStatus) && - ((exitStatus = globalMostRecentFallbackTime + 300 - now$1()), - 10 < exitStatus) - ) { - markRootSuspended( - renderWasConcurrent, - lanes, - workInProgressDeferredLane + if (shouldProfile(finishedWork)) { + try { + startLayoutEffectTimer(), + commitHookEffectListUnmount(5, finishedWork, finishedWork.return); + } catch (error$119) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$119 ); - if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; - renderWasConcurrent.timeoutHandle = scheduleTimeout( - commitRootWhenReady.bind( - null, - renderWasConcurrent, - didTimeout, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane - ), - exitStatus + } + recordLayoutEffectDuration(finishedWork); + } else + try { + commitHookEffectListUnmount(5, finishedWork, finishedWork.return); + } catch (error$120) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$120 ); - break a; } - commitRootWhenReady( - renderWasConcurrent, - didTimeout, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - lanes, - workInProgressDeferredLane + } + break; + case 1: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + flags & 64 && + offscreenSubtreeIsHidden && + ((finishedWork = finishedWork.updateQueue), + null !== finishedWork && + ((flags = finishedWork.callbacks), + null !== flags && + ((current = finishedWork.shared.hiddenCallbacks), + (finishedWork.shared.hiddenCallbacks = + null === current ? flags : current.concat(flags))))); + break; + case 26: + case 27: + case 5: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) { + var newProps = finishedWork.memoizedProps; + current = null !== current ? current.memoizedProps : newProps; + finishedWork.updateQueue = null; + try { + var viewConfig = flags.viewConfig; + instanceProps.set(flags._nativeTag, newProps); + var updatePayload = diffProperties( + null, + current, + newProps, + viewConfig.validAttributes ); + null != updatePayload && + ReactNativePrivateInterface.UIManager.updateView( + flags._nativeTag, + viewConfig.uiViewClassName, + updatePayload + ); + } catch (error$123) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$123); } } break; - } while (1); - } - ensureRootIsScheduled(root); - scheduleTaskForRootDuringMicrotask(root, now$1()); - root = - root.callbackNode === originalCallbackNode - ? performConcurrentWorkOnRoot.bind(null, root) - : null; - return root; -} -function recoverFromConcurrentError( - root, - originallyAttemptedLanes, - errorRetryLanes -) { - var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, - JSCompiler_inline_result; - (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && - (prepareFreshStack(root, errorRetryLanes).flags |= 256); - errorRetryLanes = renderRootSync(root, errorRetryLanes); - if (2 !== errorRetryLanes) { - if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) - return ( - (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), - (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), - 4 - ); - root = workInProgressRootRecoverableErrors; - workInProgressRootRecoverableErrors = errorsFromFirstAttempt; - null !== root && queueRecoverableErrors(root); - } - return errorRetryLanes; -} -function queueRecoverableErrors(errors) { - null === workInProgressRootRecoverableErrors - ? (workInProgressRootRecoverableErrors = errors) - : workInProgressRootRecoverableErrors.push.apply( - workInProgressRootRecoverableErrors, - errors - ); -} -function commitRootWhenReady( - root, - finishedWork, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - lanes, - spawnedLane -) { - 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); - commitRoot( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane - ); -} -function isRenderConsistentWithExternalStores(finishedWork) { - for (var node = finishedWork; ; ) { - if (node.flags & 16384) { - var updateQueue = node.updateQueue; + case 6: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + if (flags & 4) { + if (null === finishedWork.stateNode) + throw Error( + "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." + ); + flags = finishedWork.stateNode; + current = finishedWork.memoizedProps; + try { + ReactNativePrivateInterface.UIManager.updateView( + flags, + "RCTRawText", + { text: current } + ); + } catch (error$124) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$124); + } + } + break; + case 3: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 4: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + break; + case 13: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + finishedWork.child.flags & 8192 && + ((newProps = null !== finishedWork.memoizedState), + (current = null !== current && null !== current.memoizedState), + alwaysThrottleRetries + ? newProps !== current && (globalMostRecentFallbackTime = now$1()) + : newProps && !current && (globalMostRecentFallbackTime = now$1())); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); + break; + case 22: + flags & 512 && + null !== current && + safelyDetachRef(current, current.return); + viewConfig = null !== finishedWork.memoizedState; + updatePayload = null !== current && null !== current.memoizedState; + if (finishedWork.mode & 1) { + var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden, + prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || viewConfig; + offscreenSubtreeWasHidden = + prevOffscreenSubtreeWasHidden || updatePayload; + recursivelyTraverseMutationEffects(root, finishedWork); + offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; + offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; + } else recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + root = finishedWork.stateNode; + root._current = finishedWork; + root._visibility &= -3; + root._visibility |= root._pendingVisibility & 2; if ( - null !== updateQueue && - ((updateQueue = updateQueue.stores), null !== updateQueue) + flags & 8192 && + ((root._visibility = viewConfig + ? root._visibility & -2 + : root._visibility | 1), + viewConfig && + ((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden), + null === current || + updatePayload || + root || + (0 !== (finishedWork.mode & 1) && + recursivelyTraverseDisappearLayoutEffects(finishedWork))), + null === finishedWork.memoizedProps || + "manual" !== finishedWork.memoizedProps.mode) ) - for (var i = 0; i < updateQueue.length; i++) { - var check = updateQueue[i], - getSnapshot = check.getSnapshot; - check = check.value; - try { - if (!objectIs(getSnapshot(), check)) return !1; - } catch (error) { - return !1; + a: for (current = null, root = finishedWork; ; ) { + if (5 === root.tag) { + if (null === current) { + current = root; + try { + if (((newProps = root.stateNode), viewConfig)) { + var viewConfig$jscomp$0 = newProps.viewConfig; + var updatePayload$jscomp$0 = diffProperties( + null, + emptyObject$1, + { style: { display: "none" } }, + viewConfig$jscomp$0.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + newProps._nativeTag, + viewConfig$jscomp$0.uiViewClassName, + updatePayload$jscomp$0 + ); + } else { + var instance = root.stateNode, + props = root.memoizedProps, + viewConfig$jscomp$1 = instance.viewConfig, + prevProps = assign({}, props, { + style: [props.style, { display: "none" }] + }); + var updatePayload$jscomp$1 = diffProperties( + null, + prevProps, + props, + viewConfig$jscomp$1.validAttributes + ); + ReactNativePrivateInterface.UIManager.updateView( + instance._nativeTag, + viewConfig$jscomp$1.uiViewClassName, + updatePayload$jscomp$1 + ); + } + } catch (error) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error + ); + } + } + } else if (6 === root.tag) { + if (null === current) + try { + throw Error("Not yet implemented."); + } catch (error$113) { + captureCommitPhaseError( + finishedWork, + finishedWork.return, + error$113 + ); + } + } else if ( + ((22 !== root.tag && 23 !== root.tag) || + null === root.memoizedState || + root === finishedWork) && + null !== root.child + ) { + root.child.return = root; + root = root.child; + continue; + } + if (root === finishedWork) break a; + for (; null === root.sibling; ) { + if (null === root.return || root.return === finishedWork) break a; + current === root && (current = null); + root = root.return; } + current === root && (current = null); + root.sibling.return = root.return; + root = root.sibling; } - } - updateQueue = node.child; - if (node.subtreeFlags & 16384 && null !== updateQueue) - (updateQueue.return = node), (node = updateQueue); - else { - if (node === finishedWork) break; - for (; null === node.sibling; ) { - if (null === node.return || node.return === finishedWork) return !0; - node = node.return; - } - node.sibling.return = node.return; - node = node.sibling; - } - } - return !0; -} -function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), (root.pingedLanes = 0)); - enableInfiniteRenderLoopDetection && - (executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), - throwIfInfiniteUpdateLoopDetected()); -} -function markRootSuspended(root, suspendedLanes, spawnedLane) { - suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; - for ( - var expirationTimes = root.expirationTimes, lanes = suspendedLanes; - 0 < lanes; - - ) { - var index$8 = 31 - clz32(lanes), - lane = 1 << index$8; - expirationTimes[index$8] = -1; - lanes &= ~lane; + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((current = flags.retryQueue), + null !== current && + ((flags.retryQueue = null), + attachSuspenseRetryListeners(finishedWork, current)))); + break; + case 19: + recursivelyTraverseMutationEffects(root, finishedWork); + commitReconciliationEffects(finishedWork); + flags & 4 && + ((flags = finishedWork.updateQueue), + null !== flags && + ((finishedWork.updateQueue = null), + attachSuspenseRetryListeners(finishedWork, flags))); + break; + case 21: + break; + default: + recursivelyTraverseMutationEffects(root, finishedWork), + commitReconciliationEffects(finishedWork); } - 0 !== spawnedLane && - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } -function resetWorkInProgressStack() { - if (null !== workInProgress) { - if (0 === workInProgressSuspendedReason) - var interruptedWork = workInProgress.return; - else - (interruptedWork = workInProgress), - resetContextDependencies(), - resetHooksOnUnwind(interruptedWork), - (thenableState$1 = null), - (thenableIndexCounter$1 = 0), - (interruptedWork = workInProgress); - for (; null !== interruptedWork; ) - unwindInterruptedWork(interruptedWork.alternate, interruptedWork), - (interruptedWork = interruptedWork.return); - workInProgress = null; - } -} -function prepareFreshStack(root, lanes) { - root.finishedWork = null; - root.finishedLanes = 0; - var timeoutHandle = root.timeoutHandle; - -1 !== timeoutHandle && - ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); - timeoutHandle = root.cancelPendingCommit; - null !== timeoutHandle && - ((root.cancelPendingCommit = null), timeoutHandle()); - resetWorkInProgressStack(); - workInProgressRoot = root; - workInProgress = timeoutHandle = createWorkInProgress(root.current, null); - workInProgressRootRenderLanes = lanes; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; - workInProgressDeferredLane = - workInProgressRootPingedLanes = - workInProgressRootInterleavedUpdatedLanes = - workInProgressRootSkippedLanes = - 0; - workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = - null; - workInProgressRootDidIncludeRecursiveRenderUpdate = !1; - 0 !== (lanes & 8) && (lanes |= lanes & 32); - var allEntangledLanes = root.entangledLanes; - if (0 !== allEntangledLanes) - for ( - root = root.entanglements, allEntangledLanes &= lanes; - 0 < allEntangledLanes; - - ) { - var index$6 = 31 - clz32(allEntangledLanes), - lane = 1 << index$6; - lanes |= root[index$6]; - allEntangledLanes &= ~lane; - } - entangledRenderLanes = lanes; - finishQueueingConcurrentUpdates(); - return timeoutHandle; -} -function handleThrow(root, thrownValue) { - currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); - workInProgressThrownValue = thrownValue; - root = workInProgress; - if (null === root) - (workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue); - else - switch ( - (root.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(root, !0), - markComponentRenderStopped(), - workInProgressSuspendedReason) - ) { - case 1: - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markComponentErrored && - injectedProfilingHooks.markComponentErrored( - root, - thrownValue, - workInProgressRootRenderLanes +function commitReconciliationEffects(finishedWork) { + var flags = finishedWork.flags; + if (flags & 2) { + try { + a: { + for (var parent = finishedWork.return; null !== parent; ) { + if (isHostParent(parent)) { + var JSCompiler_inline_result = parent; + break a; + } + parent = parent.return; + } + throw Error( + "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." + ); + } + switch (JSCompiler_inline_result.tag) { + case 27: + case 5: + var parent$jscomp$0 = JSCompiler_inline_result.stateNode; + JSCompiler_inline_result.flags & 32 && + (JSCompiler_inline_result.flags &= -33); + var before = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); + break; + case 3: + case 4: + var parent$114 = JSCompiler_inline_result.stateNode.containerInfo, + before$115 = getHostSibling(finishedWork); + insertOrAppendPlacementNodeIntoContainer( + finishedWork, + before$115, + parent$114 ); - break; - case 2: - case 3: - case 6: - case 7: - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markComponentSuspended && - injectedProfilingHooks.markComponentSuspended( - root, - thrownValue, - workInProgressRootRenderLanes + break; + default: + throw Error( + "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." ); + } + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); } + finishedWork.flags &= -3; + } + flags & 4096 && (finishedWork.flags &= -4097); } -function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; - return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; -} -function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; - return prevCacheDispatcher; +function commitLayoutEffects(finishedWork, root, committedLanes) { + inProgressLanes = committedLanes; + inProgressRoot = root; + commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); + inProgressRoot = inProgressLanes = null; } -function renderDidSuspendDelayIfPossible() { - workInProgressRootExitStatus = 4; - (0 === (workInProgressRootSkippedLanes & 134217727) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || - null === workInProgressRoot || - markRootSuspended( - workInProgressRoot, - workInProgressRootRenderLanes, - workInProgressDeferredLane - ); +function recursivelyTraverseLayoutEffects(root, parentFiber) { + if (parentFiber.subtreeFlags & 8772) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber), + (parentFiber = parentFiber.sibling); } -function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - if (isDevToolsPresent) { - var memoizedUpdaters = root.memoizedUpdaters; - 0 < memoizedUpdaters.size && - (restorePendingUpdaters(root, workInProgressRootRenderLanes), - memoizedUpdaters.clear()); - movePendingFibersToMemoized(root, lanes); +function recursivelyTraverseDisappearLayoutEffects(parentFiber) { + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedWork = parentFiber; + switch (finishedWork.tag) { + case 0: + case 11: + case 14: + case 15: + if (shouldProfile(finishedWork)) + try { + startLayoutEffectTimer(), + commitHookEffectListUnmount(4, finishedWork, finishedWork.return); + } finally { + recordLayoutEffectDuration(finishedWork); + } + else commitHookEffectListUnmount(4, finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 1: + safelyDetachRef(finishedWork, finishedWork.return); + var instance = finishedWork.stateNode; + if ("function" === typeof instance.componentWillUnmount) { + var current = finishedWork, + nearestMountedAncestor = finishedWork.return; + try { + callComponentWillUnmountWithTimer(current, instance); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } + } + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 26: + case 27: + case 5: + safelyDetachRef(finishedWork, finishedWork.return); + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + case 22: + safelyDetachRef(finishedWork, finishedWork.return); + null === finishedWork.memoizedState && + recursivelyTraverseDisappearLayoutEffects(finishedWork); + break; + default: + recursivelyTraverseDisappearLayoutEffects(finishedWork); } - workInProgressTransitions = null; - prepareFreshStack(root, lanes); + parentFiber = parentFiber.sibling; } - markRenderStarted(lanes); - lanes = !1; - a: do - try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) { - memoizedUpdaters = workInProgress; - var thrownValue = workInProgressThrownValue; - switch (workInProgressSuspendedReason) { - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; - break a; - case 3: - case 2: - lanes || - null !== suspenseHandlerStackCursor.current || - (lanes = !0); - default: - (workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, memoizedUpdaters, thrownValue); +} +function recursivelyTraverseReappearLayoutEffects( + finishedRoot$jscomp$0, + parentFiber, + includeWorkInProgressEffects +) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var current = parentFiber.alternate, + finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + commitHookLayoutEffects(finishedWork, 4); + break; + case 1: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + finishedRoot = finishedWork.stateNode; + if ("function" === typeof finishedRoot.componentDidMount) + try { + finishedRoot.componentDidMount(); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); + } + current = finishedWork.updateQueue; + if (null !== current) { + var hiddenCallbacks = current.shared.hiddenCallbacks; + if (null !== hiddenCallbacks) + for ( + current.shared.hiddenCallbacks = null, current = 0; + current < hiddenCallbacks.length; + current++ + ) + callCallback(hiddenCallbacks[current], finishedRoot); } - } - workLoopSync(); - break; - } catch (thrownValue$133) { - handleThrow(root, thrownValue$133); + includeWorkInProgressEffects && + flags & 64 && + commitClassCallbacks(finishedWork); + safelyAttachRef(finishedWork, finishedWork.return); + break; + case 26: + case 27: + case 5: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + case 12: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + includeWorkInProgressEffects && + flags & 4 && + commitProfilerUpdate(finishedWork, current); + break; + case 13: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + break; + case 22: + null === finishedWork.memoizedState && + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); + safelyAttachRef(finishedWork, finishedWork.return); + break; + default: + recursivelyTraverseReappearLayoutEffects( + finishedRoot, + finishedWork, + includeWorkInProgressEffects + ); } - while (1); - lanes && root.shellSuspendCounter++; - resetContextDependencies(); - executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - if (null !== workInProgress) - throw Error( - "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." - ); - markRenderStopped(); - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; -} -function workLoopSync() { - for (; null !== workInProgress; ) performUnitOfWork(workInProgress); + parentFiber = parentFiber.sibling; + } } -function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= 2; - var prevDispatcher = pushDispatcher(), - prevCacheDispatcher = pushCacheDispatcher(); - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - if (isDevToolsPresent) { - var memoizedUpdaters = root.memoizedUpdaters; - 0 < memoizedUpdaters.size && - (restorePendingUpdaters(root, workInProgressRootRenderLanes), - memoizedUpdaters.clear()); - movePendingFibersToMemoized(root, lanes); +function commitHookPassiveMountEffects(finishedWork, hookFlags) { + if (shouldProfile(finishedWork)) { + passiveEffectStartTime = now(); + try { + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error) { + captureCommitPhaseError(finishedWork, finishedWork.return, error); } - workInProgressTransitions = null; - workInProgressRootRenderTargetTime = now$1() + 500; - prepareFreshStack(root, lanes); - } - markRenderStarted(lanes); - a: do + recordPassiveEffectDuration(finishedWork); + } else try { - if (0 !== workInProgressSuspendedReason && null !== workInProgress) - b: switch ( - ((lanes = workInProgress), - (memoizedUpdaters = workInProgressThrownValue), - workInProgressSuspendedReason) - ) { - case 1: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); - break; - case 2: - if (isThenableResolved(memoizedUpdaters)) { - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - replaySuspendedUnitOfWork(lanes); - break; - } - lanes = function () { - 2 === workInProgressSuspendedReason && - workInProgressRoot === root && - (workInProgressSuspendedReason = 7); - ensureRootIsScheduled(root); - }; - memoizedUpdaters.then(lanes, lanes); - break a; - case 3: - workInProgressSuspendedReason = 7; - break a; - case 4: - workInProgressSuspendedReason = 5; - break a; - case 7: - isThenableResolved(memoizedUpdaters) - ? ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - replaySuspendedUnitOfWork(lanes)) - : ((workInProgressSuspendedReason = 0), - (workInProgressThrownValue = null), - throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters)); - break; - case 5: - switch (workInProgress.tag) { - case 5: - case 26: - case 27: - lanes = workInProgress; - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - var sibling = lanes.sibling; - if (null !== sibling) workInProgress = sibling; - else { - var returnFiber = lanes.return; - null !== returnFiber - ? ((workInProgress = returnFiber), - completeUnitOfWork(returnFiber)) - : (workInProgress = null); - } - break b; - } - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); - break; - case 6: - workInProgressSuspendedReason = 0; - workInProgressThrownValue = null; - throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); - break; - case 8: - resetWorkInProgressStack(); - workInProgressRootExitStatus = 6; - break a; - default: - throw Error("Unexpected SuspendedReason. This is a bug in React."); - } - workLoopConcurrent(); - break; - } catch (thrownValue$135) { - handleThrow(root, thrownValue$135); + commitHookEffectListMount(hookFlags, finishedWork); + } catch (error$128) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$128); } - while (1); - resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; - executionContext = prevExecutionContext; - if (null !== workInProgress) - return ( - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markRenderYielded && - injectedProfilingHooks.markRenderYielded(), - 0 - ); - markRenderStopped(); - workInProgressRoot = null; - workInProgressRootRenderLanes = 0; - finishQueueingConcurrentUpdates(); - return workInProgressRootExitStatus; } -function workLoopConcurrent() { - for (; null !== workInProgress && !shouldYield(); ) - performUnitOfWork(workInProgress); +function commitOffscreenPassiveMountEffects(current, finishedWork) { + var previousCache = null; + null !== current && + null !== current.memoizedState && + null !== current.memoizedState.cachePool && + (previousCache = current.memoizedState.cachePool.pool); + current = null; + null !== finishedWork.memoizedState && + null !== finishedWork.memoizedState.cachePool && + (current = finishedWork.memoizedState.cachePool.pool); + current !== previousCache && + (null != current && current.refCount++, + null != previousCache && releaseCache(previousCache)); } -function performUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; - 0 !== (unitOfWork.mode & 2) - ? (startProfilerTimer(unitOfWork), - (current = beginWork(current, unitOfWork, entangledRenderLanes)), - stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) - : (current = beginWork(current, unitOfWork, entangledRenderLanes)); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - ReactCurrentOwner.current = null; +function commitCachePassiveMountEffect(current, finishedWork) { + current = null; + null !== finishedWork.alternate && + (current = finishedWork.alternate.memoizedState.cache); + finishedWork = finishedWork.memoizedState.cache; + finishedWork !== current && + (finishedWork.refCount++, null != current && releaseCache(current)); } -function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate, - isProfilingMode = 0 !== (unitOfWork.mode & 2); - isProfilingMode && startProfilerTimer(unitOfWork); - switch (unitOfWork.tag) { - case 2: - unitOfWork.tag = 0; - case 15: +function recursivelyTraversePassiveMountEffects( + root, + parentFiber, + committedLanes, + committedTransitions +) { + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveMountOnFiber( + root, + parentFiber, + committedLanes, + committedTransitions + ), + (parentFiber = parentFiber.sibling); +} +function commitPassiveMountOnFiber( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions +) { + var flags = finishedWork.flags; + switch (finishedWork.tag) { case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - var context = isContextProvider(Component) - ? previousContext - : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - context, - workInProgressRootRenderLanes + case 11: + case 15: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions ); + flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9); break; - case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; - unresolvedProps = - unitOfWork.elementType === Component - ? unresolvedProps - : resolveDefaultProps(Component, unresolvedProps); - current = replayFunctionComponent( - current, - unitOfWork, - unresolvedProps, - Component, - unitOfWork.ref, - workInProgressRootRenderLanes + case 3: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions ); + flags & 2048 && + ((finishedRoot = null), + null !== finishedWork.alternate && + (finishedRoot = finishedWork.alternate.memoizedState.cache), + (finishedWork = finishedWork.memoizedState.cache), + finishedWork !== finishedRoot && + (finishedWork.refCount++, + null != finishedRoot && releaseCache(finishedRoot))); + break; + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork) + : ((instance._visibility |= 4), + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + )) + : instance._visibility & 4 + ? recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + 0 !== (finishedWork.subtreeFlags & 10256) + )); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); break; - case 5: - resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); - } - isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - ReactCurrentOwner.current = null; -} -function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { - resetContextDependencies(); - resetHooksOnUnwind(unitOfWork); - thenableState$1 = null; - thenableIndexCounter$1 = 0; - var returnFiber = unitOfWork.return; - try { - if ( - throwException( - root, - returnFiber, - unitOfWork, - thrownValue, - workInProgressRootRenderLanes - ) - ) { - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; - } - } catch (error) { - if (null !== returnFiber) throw ((workInProgress = returnFiber), error); - workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; - workInProgress = null; - return; + recursivelyTraversePassiveMountEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions + ); } - if (unitOfWork.flags & 32768) - a: { - root = unitOfWork; - do { - unitOfWork = unwindWork(root.alternate, root); - if (null !== unitOfWork) { - unitOfWork.flags &= 32767; - workInProgress = unitOfWork; - break a; - } - if (0 !== (root.mode & 2)) { - stopProfilerTimerIfRunningAndRecordDelta(root, !1); - unitOfWork = root.actualDuration; - for (thrownValue = root.child; null !== thrownValue; ) - (unitOfWork += thrownValue.actualDuration), - (thrownValue = thrownValue.sibling); - root.actualDuration = unitOfWork; - } - root = root.return; - null !== root && - ((root.flags |= 32768), - (root.subtreeFlags = 0), - (root.deletions = null)); - workInProgress = root; - } while (null !== root); - workInProgressRootExitStatus = 6; - workInProgress = null; - } - else completeUnitOfWork(unitOfWork); } -function completeUnitOfWork(unitOfWork) { - var completedWork = unitOfWork; - do { - var current = completedWork.alternate; - unitOfWork = completedWork.return; - 0 === (completedWork.mode & 2) - ? (current = completeWork(current, completedWork, entangledRenderLanes)) - : (startProfilerTimer(completedWork), - (current = completeWork(current, completedWork, entangledRenderLanes)), - stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); - if (null !== current) { - workInProgress = current; - return; +function recursivelyTraverseReconnectPassiveEffects( + finishedRoot$jscomp$0, + parentFiber, + committedLanes$jscomp$0, + committedTransitions$jscomp$0, + includeWorkInProgressEffects +) { + includeWorkInProgressEffects = + includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 10256); + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + committedLanes = committedLanes$jscomp$0, + committedTransitions = committedTransitions$jscomp$0, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + commitHookPassiveMountEffects(finishedWork, 8); + break; + case 23: + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState + ? instance._visibility & 4 + ? recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ) + : finishedWork.mode & 1 + ? recursivelyTraverseAtomicPassiveEffects( + finishedRoot, + finishedWork + ) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )) + : ((instance._visibility |= 4), + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + )); + includeWorkInProgressEffects && + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); + includeWorkInProgressEffects && + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseReconnectPassiveEffects( + finishedRoot, + finishedWork, + committedLanes, + committedTransitions, + includeWorkInProgressEffects + ); } - completedWork = completedWork.sibling; - if (null !== completedWork) { - workInProgress = completedWork; - return; + parentFiber = parentFiber.sibling; + } +} +function recursivelyTraverseAtomicPassiveEffects( + finishedRoot$jscomp$0, + parentFiber +) { + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + var finishedRoot = finishedRoot$jscomp$0, + finishedWork = parentFiber, + flags = finishedWork.flags; + switch (finishedWork.tag) { + case 22: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitOffscreenPassiveMountEffects( + finishedWork.alternate, + finishedWork + ); + break; + case 24: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + flags & 2048 && + commitCachePassiveMountEffect(finishedWork.alternate, finishedWork); + break; + default: + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + } + parentFiber = parentFiber.sibling; } - workInProgress = completedWork = unitOfWork; - } while (null !== completedWork); - 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - spawnedLane +var suspenseyCommitFlag = 8192; +function recursivelyAccumulateSuspenseyCommit(parentFiber) { + if (parentFiber.subtreeFlags & suspenseyCommitFlag) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + accumulateSuspenseyCommitOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); +} +function accumulateSuspenseyCommitOnFiber(fiber) { + switch (fiber.tag) { + case 26: + recursivelyAccumulateSuspenseyCommit(fiber); + if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState) + throw Error( + "The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue." + ); + break; + case 5: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 3: + case 4: + recursivelyAccumulateSuspenseyCommit(fiber); + break; + case 22: + if (null === fiber.memoizedState) { + var current = fiber.alternate; + null !== current && null !== current.memoizedState + ? ((current = suspenseyCommitFlag), + (suspenseyCommitFlag = 16777216), + recursivelyAccumulateSuspenseyCommit(fiber), + (suspenseyCommitFlag = current)) + : recursivelyAccumulateSuspenseyCommit(fiber); + } + break; + default: + recursivelyAccumulateSuspenseyCommit(fiber); + } +} +function detachAlternateSiblings(parentFiber) { + var previousFiber = parentFiber.alternate; + if ( + null !== previousFiber && + ((parentFiber = previousFiber.child), null !== parentFiber) + ) { + previousFiber.child = null; + do + (previousFiber = parentFiber.sibling), + (parentFiber.sibling = null), + (parentFiber = previousFiber); + while (null !== parentFiber); + } +} +function commitHookPassiveUnmountEffects( + finishedWork, + nearestMountedAncestor, + hookFlags ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; - try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - previousUpdateLanePriority, - spawnedLane + shouldProfile(finishedWork) + ? ((passiveEffectStartTime = now()), + commitHookEffectListUnmount( + hookFlags, + finishedWork, + nearestMountedAncestor + ), + recordPassiveEffectDuration(finishedWork)) + : commitHookEffectListUnmount( + hookFlags, + finishedWork, + nearestMountedAncestor ); - } finally { - (ReactCurrentBatchConfig.transition = prevTransition), - (currentUpdatePriority = previousUpdateLanePriority); +} +function recursivelyTraversePassiveUnmountEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber + ); + } + detachAlternateSiblings(parentFiber); } - return null; + if (parentFiber.subtreeFlags & 10256) + for (parentFiber = parentFiber.child; null !== parentFiber; ) + commitPassiveUnmountOnFiber(parentFiber), + (parentFiber = parentFiber.sibling); } -function commitRootImpl( - root, - recoverableErrors, - transitions, - didIncludeRenderPhaseUpdate, - renderPriorityLevel, - spawnedLane -) { - do flushPassiveEffects(); - while (null !== rootWithPendingPassiveEffects); - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markCommitStarted && - injectedProfilingHooks.markCommitStarted(lanes); - if (null === finishedWork) return markCommitStopped(), null; - root.finishedWork = null; - root.finishedLanes = 0; - if (finishedWork === root.current) - throw Error( - "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." - ); - root.callbackNode = null; - root.callbackPriority = 0; - root.cancelPendingCommit = null; - var remainingLanes = finishedWork.lanes | finishedWork.childLanes; - remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes, spawnedLane); - didIncludeCommitPhaseUpdate = !1; - root === workInProgressRoot && - ((workInProgress = workInProgressRoot = null), - (workInProgressRootRenderLanes = 0)); - (0 === (finishedWork.subtreeFlags & 10256) && - 0 === (finishedWork.flags & 10256)) || - rootDoesHavePassiveEffects || - ((rootDoesHavePassiveEffects = !0), - (pendingPassiveEffectsRemainingLanes = remainingLanes), - (pendingPassiveTransitions = transitions), - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - })); - transitions = 0 !== (finishedWork.flags & 15990); - if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; - spawnedLane = currentUpdatePriority; - currentUpdatePriority = 2; - var prevExecutionContext = executionContext; - executionContext |= 4; - ReactCurrentOwner.current = null; - commitBeforeMutationEffects(root, finishedWork); - commitTime = now(); - commitMutationEffects(root, finishedWork, lanes); - root.current = finishedWork; - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && - injectedProfilingHooks.markLayoutEffectsStarted(lanes); - commitLayoutEffects(finishedWork, root, lanes); - null !== injectedProfilingHooks && - "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && - injectedProfilingHooks.markLayoutEffectsStopped(); - requestPaint(); - executionContext = prevExecutionContext; - currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; - } else (root.current = finishedWork), (commitTime = now()); - rootDoesHavePassiveEffects - ? ((rootDoesHavePassiveEffects = !1), - (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) - : releaseRootPooledCache(root, remainingLanes); - remainingLanes = root.pendingLanes; - 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); - onCommitRoot(finishedWork.stateNode, renderPriorityLevel); - isDevToolsPresent && root.memoizedUpdaters.clear(); - ensureRootIsScheduled(root); - if (null !== recoverableErrors) - for ( - renderPriorityLevel = root.onRecoverableError, finishedWork = 0; - finishedWork < recoverableErrors.length; - finishedWork++ - ) - (remainingLanes = recoverableErrors[finishedWork]), - (transitions = { - digest: remainingLanes.digest, - componentStack: remainingLanes.stack - }), - renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); - 0 !== (pendingPassiveEffectsLanes & 3) && - 0 !== root.tag && - flushPassiveEffects(); - remainingLanes = root.pendingLanes; - (enableInfiniteRenderLoopDetection && - (didIncludeRenderPhaseUpdate || didIncludeCommitPhaseUpdate)) || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes)) - ? ((nestedUpdateScheduled = !0), - root === rootWithNestedUpdates - ? nestedUpdateCount++ - : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) - : (nestedUpdateCount = 0); - flushSyncWorkAcrossRoots_impl(!1); - markCommitStopped(); - return null; -} -function releaseRootPooledCache(root, remainingLanes) { - 0 === (root.pooledCacheLanes &= remainingLanes) && - ((remainingLanes = root.pooledCache), - null != remainingLanes && - ((root.pooledCache = null), releaseCache(remainingLanes))); +function commitPassiveUnmountOnFiber(finishedWork) { + switch (finishedWork.tag) { + case 0: + case 11: + case 15: + recursivelyTraversePassiveUnmountEffects(finishedWork); + finishedWork.flags & 2048 && + commitHookPassiveUnmountEffects(finishedWork, finishedWork.return, 9); + break; + case 22: + var instance = finishedWork.stateNode; + null !== finishedWork.memoizedState && + instance._visibility & 4 && + (null === finishedWork.return || 13 !== finishedWork.return.tag) + ? ((instance._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(finishedWork)) + : recursivelyTraversePassiveUnmountEffects(finishedWork); + break; + default: + recursivelyTraversePassiveUnmountEffects(finishedWork); + } } -function flushPassiveEffects() { - if (null !== rootWithPendingPassiveEffects) { - var root = rootWithPendingPassiveEffects, - remainingLanes = pendingPassiveEffectsRemainingLanes; - pendingPassiveEffectsRemainingLanes = 0; - var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; - try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; - if (null === rootWithPendingPassiveEffects) - var JSCompiler_inline_result = !1; - else { - var transitions = pendingPassiveTransitions; - pendingPassiveTransitions = null; - priority = rootWithPendingPassiveEffects; - var lanes = pendingPassiveEffectsLanes; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsLanes = 0; - if (0 !== (executionContext & 6)) - throw Error("Cannot flush passive effects while already rendering."); - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markPassiveEffectsStarted && - injectedProfilingHooks.markPassiveEffectsStarted(lanes); - var prevExecutionContext = executionContext; - executionContext |= 4; - commitPassiveUnmountOnFiber(priority.current); - commitPassiveMountOnFiber( - priority, - priority.current, - lanes, - transitions +function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { + var deletions = parentFiber.deletions; + if (0 !== (parentFiber.flags & 16)) { + if (null !== deletions) + for (var i = 0; i < deletions.length; i++) { + var childToDelete = deletions[i]; + nextEffect = childToDelete; + commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + childToDelete, + parentFiber ); - transitions = pendingPassiveProfilerEffects; - pendingPassiveProfilerEffects = []; - for (lanes = 0; lanes < transitions.length; lanes++) { - var finishedWork = transitions[lanes]; - if (executionContext & 4 && 0 !== (finishedWork.flags & 4)) - switch (finishedWork.tag) { - case 12: - var passiveEffectDuration = - finishedWork.stateNode.passiveEffectDuration, - _finishedWork$memoize = finishedWork.memoizedProps, - id = _finishedWork$memoize.id, - onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$106 = commitTime, - phase = null === finishedWork.alternate ? "mount" : "update"; - currentUpdateIsNested && (phase = "nested-update"); - "function" === typeof onPostCommit && - onPostCommit( - id, - phase, - passiveEffectDuration, - commitTime$106 - ); - var parentFiber = finishedWork.return; - b: for (; null !== parentFiber; ) { - switch (parentFiber.tag) { - case 3: - parentFiber.stateNode.passiveEffectDuration += - passiveEffectDuration; - break b; - case 12: - parentFiber.stateNode.passiveEffectDuration += - passiveEffectDuration; - break b; - } - parentFiber = parentFiber.return; - } - } - } - null !== injectedProfilingHooks && - "function" === - typeof injectedProfilingHooks.markPassiveEffectsStopped && - injectedProfilingHooks.markPassiveEffectsStopped(); - executionContext = prevExecutionContext; - flushSyncWorkAcrossRoots_impl(!1); - if ( - injectedHook && - "function" === typeof injectedHook.onPostCommitFiberRoot - ) - try { - injectedHook.onPostCommitFiberRoot(rendererID, priority); - } catch (err) {} - var stateNode = priority.current.stateNode; - stateNode.effectDuration = 0; - stateNode.passiveEffectDuration = 0; - JSCompiler_inline_result = !0; } - return JSCompiler_inline_result; - } finally { - (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), - releaseRootPooledCache(root, remainingLanes); + detachAlternateSiblings(parentFiber); + } + for (parentFiber = parentFiber.child; null !== parentFiber; ) { + deletions = parentFiber; + switch (deletions.tag) { + case 0: + case 11: + case 15: + commitHookPassiveUnmountEffects(deletions, deletions.return, 8); + recursivelyTraverseDisconnectPassiveEffects(deletions); + break; + case 22: + i = deletions.stateNode; + i._visibility & 4 && + ((i._visibility &= -5), + recursivelyTraverseDisconnectPassiveEffects(deletions)); + break; + default: + recursivelyTraverseDisconnectPassiveEffects(deletions); } + parentFiber = parentFiber.sibling; } - return !1; } -function enqueuePendingPassiveProfilerEffect(fiber) { - pendingPassiveProfilerEffects.push(fiber); - rootDoesHavePassiveEffects || - ((rootDoesHavePassiveEffects = !0), - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - })); -} -function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); - rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); - null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); -} -function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { - if (3 === sourceFiber.tag) - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - else - for (; null !== nearestMountedAncestor; ) { - if (3 === nearestMountedAncestor.tag) { - captureCommitPhaseErrorOnRoot( - nearestMountedAncestor, - sourceFiber, - error - ); +function commitPassiveUnmountEffectsInsideOfDeletedTree_begin( + deletedSubtreeRoot, + nearestMountedAncestor +) { + for (; null !== nextEffect; ) { + var fiber = nextEffect; + switch (fiber.tag) { + case 0: + case 11: + case 15: + commitHookPassiveUnmountEffects(fiber, nearestMountedAncestor, 8); break; - } else if (1 === nearestMountedAncestor.tag) { - var instance = nearestMountedAncestor.stateNode; + case 23: + case 22: if ( - "function" === - typeof nearestMountedAncestor.type.getDerivedStateFromError || - ("function" === typeof instance.componentDidCatch && - (null === legacyErrorBoundariesThatAlreadyFailed || - !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + null !== fiber.memoizedState && + null !== fiber.memoizedState.cachePool ) { - sourceFiber = createCapturedValueAtFiber(error, sourceFiber); - sourceFiber = createClassErrorUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - nearestMountedAncestor = enqueueUpdate( - nearestMountedAncestor, - sourceFiber, - 2 - ); - null !== nearestMountedAncestor && - (markRootUpdated(nearestMountedAncestor, 2), - ensureRootIsScheduled(nearestMountedAncestor)); - break; + var cache = fiber.memoizedState.cachePool.pool; + null != cache && cache.refCount++; } - } - nearestMountedAncestor = nearestMountedAncestor.return; + break; + case 24: + releaseCache(fiber.memoizedState.cache); } + cache = fiber.child; + if (null !== cache) (cache.return = fiber), (nextEffect = cache); + else + a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) { + cache = nextEffect; + var sibling = cache.sibling, + returnFiber = cache.return; + detachFiberAfterEffects(cache); + if (cache === fiber) { + nextEffect = null; + break a; + } + if (null !== sibling) { + sibling.return = returnFiber; + nextEffect = sibling; + break a; + } + nextEffect = returnFiber; + } + } } -function attachPingListener(root, wakeable, lanes) { - var pingCache = root.pingCache; - if (null === pingCache) { - pingCache = root.pingCache = new PossiblyWeakMap(); - var threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else - (threadIDs = pingCache.get(wakeable)), - void 0 === threadIDs && - ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); - threadIDs.has(lanes) || - ((workInProgressRootDidAttachPingListener = !0), - threadIDs.add(lanes), - (pingCache = pingSuspendedRoot.bind(null, root, wakeable, lanes)), - isDevToolsPresent && restorePendingUpdaters(root, lanes), - wakeable.then(pingCache, pingCache)); -} -function pingSuspendedRoot(root, wakeable, pingedLanes) { - var pingCache = root.pingCache; - null !== pingCache && pingCache.delete(wakeable); - root.pingedLanes |= root.suspendedLanes & pingedLanes; - enableInfiniteRenderLoopDetection && - (executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), - throwIfInfiniteUpdateLoopDetected()); - workInProgressRoot === root && - (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && - (4 === workInProgressRootExitStatus || - (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 62914560) === - workInProgressRootRenderLanes && - 300 > now$1() - globalMostRecentFallbackTime) - ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) - : (workInProgressRootPingedLanes |= pingedLanes)); - ensureRootIsScheduled(root); -} -function retryTimedOutBoundary(boundaryFiber, retryLane) { - 0 === retryLane && - (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); - boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); - null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), - ensureRootIsScheduled(boundaryFiber)); +var DefaultCacheDispatcher = { + getCacheSignal: function () { + return readContext(CacheContext).controller.signal; + }, + getCacheForType: function (resourceType) { + var cache = readContext(CacheContext), + cacheForType = cache.data.get(resourceType); + void 0 === cacheForType && + ((cacheForType = resourceType()), + cache.data.set(resourceType, cacheForType)); + return cacheForType; + } + }, + PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, + ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, + ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, + ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, + ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, + executionContext = 0, + workInProgressRoot = null, + workInProgress = null, + workInProgressRootRenderLanes = 0, + workInProgressSuspendedReason = 0, + workInProgressThrownValue = null, + workInProgressRootDidAttachPingListener = !1, + entangledRenderLanes = 0, + workInProgressRootExitStatus = 0, + workInProgressRootFatalError = null, + workInProgressRootSkippedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, + workInProgressRootConcurrentErrors = null, + workInProgressRootRecoverableErrors = null, + workInProgressRootDidIncludeRecursiveRenderUpdate = !1, + didIncludeCommitPhaseUpdate = !1, + globalMostRecentFallbackTime = 0, + workInProgressRootRenderTargetTime = Infinity, + workInProgressTransitions = null, + hasUncaughtError = !1, + firstUncaughtError = null, + legacyErrorBoundariesThatAlreadyFailed = null, + rootDoesHavePassiveEffects = !1, + rootWithPendingPassiveEffects = null, + pendingPassiveEffectsLanes = 0, + pendingPassiveProfilerEffects = [], + pendingPassiveEffectsRemainingLanes = 0, + pendingPassiveTransitions = null, + nestedUpdateCount = 0, + rootWithNestedUpdates = null; +function requestUpdateLane(fiber) { + if (0 === (fiber.mode & 1)) return 2; + if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) + return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; + if (null !== requestCurrentTransition()) + return ( + (fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane() + ); + fiber = currentUpdatePriority; + return 0 !== fiber ? fiber : 32; } -function retryDehydratedSuspenseBoundary(boundaryFiber) { - var suspenseState = boundaryFiber.memoizedState, - retryLane = 0; - null !== suspenseState && (retryLane = suspenseState.retryLane); - retryTimedOutBoundary(boundaryFiber, retryLane); +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : claimNextTransitionLane()); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); + return workInProgressDeferredLane; } -function resolveRetryWakeable(boundaryFiber, wakeable) { - var retryLane = 0; - switch (boundaryFiber.tag) { - case 13: - var retryCache = boundaryFiber.stateNode; - var suspenseState = boundaryFiber.memoizedState; - null !== suspenseState && (retryLane = suspenseState.retryLane); - break; - case 19: - retryCache = boundaryFiber.stateNode; - break; - case 22: - retryCache = boundaryFiber.stateNode._retryCache; - break; - default: - throw Error( - "Pinged unknown suspense boundary type. This is probably a bug in React." +function scheduleUpdateOnFiber(root, fiber, lane) { + if ( + (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || + null !== root.cancelPendingCommit + ) + prepareFreshStack(root, 0), + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane ); - } - null !== retryCache && retryCache.delete(wakeable); - retryTimedOutBoundary(boundaryFiber, retryLane); + markRootUpdated(root, lane); + if (0 === (executionContext & 2) || root !== workInProgressRoot) + isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )), + ensureRootIsScheduled(root), + 2 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now$1() + 500), + flushSyncWorkAcrossRoots_impl(!0)); } -function throwIfInfiniteUpdateLoopDetected() { - if (50 < nestedUpdateCount) - throw ( - ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - enableInfiniteRenderLoopDetection && - executionContext & 2 && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - )) - ); -} -var beginWork; -beginWork = function (current, workInProgress, renderLanes) { - if (null !== current) - if ( - current.memoizedProps !== workInProgress.pendingProps || - didPerformWorkStackCursor.current - ) - didReceiveUpdate = !0; - else { - if ( - 0 === (current.lanes & renderLanes) && - 0 === (workInProgress.flags & 128) - ) - return ( - (didReceiveUpdate = !1), - attemptEarlyBailoutIfNoScheduledUpdate( - current, - workInProgress, - renderLanes - ) - ); - didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1; - } - else didReceiveUpdate = !1; - workInProgress.lanes = 0; - switch (workInProgress.tag) { - case 2: - var Component = workInProgress.type; - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - var context = getMaskedContext( - workInProgress, - contextStackCursor$1.current - ); - prepareToReadContext(workInProgress, renderLanes); - markComponentRenderStarted(workInProgress); - current = renderWithHooks( - null, - workInProgress, - Component, - current, - context, - renderLanes - ); - markComponentRenderStopped(); - workInProgress.flags |= 1; - workInProgress.tag = 0; - reconcileChildren(null, workInProgress, current, renderLanes); - workInProgress = workInProgress.child; - return workInProgress; - case 16: - Component = workInProgress.elementType; - a: { - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); - current = workInProgress.pendingProps; - context = Component._init; - Component = context(Component._payload); - workInProgress.type = Component; - context = workInProgress.tag = resolveLazyComponentTag(Component); - current = resolveDefaultProps(Component, current); - switch (context) { - case 0: - workInProgress = updateFunctionComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 1: - workInProgress = updateClassComponent( - null, - workInProgress, - Component, - current, - renderLanes - ); - break a; - case 11: - workInProgress = updateForwardRef( - null, - workInProgress, - Component, - current, - renderLanes +function performConcurrentWorkOnRoot(root, didTimeout) { + nestedUpdateScheduled = currentUpdateIsNested = !1; + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var originalCallbackNode = root.callbackNode; + if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) + return null; + var lanes = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes : 0 + ); + if (0 === lanes) return null; + var exitStatus = (didTimeout = + 0 === (lanes & 60) && 0 === (lanes & root.expiredLanes) && !didTimeout) + ? renderRootConcurrent(root, lanes) + : renderRootSync(root, lanes); + if (0 !== exitStatus) { + var renderWasConcurrent = didTimeout; + do { + if (6 === exitStatus) markRootSuspended(root, lanes, 0); + else { + didTimeout = root.current.alternate; + if ( + renderWasConcurrent && + !isRenderConsistentWithExternalStores(didTimeout) + ) { + exitStatus = renderRootSync(root, lanes); + renderWasConcurrent = !1; + continue; + } + if (2 === exitStatus) { + renderWasConcurrent = lanes; + var errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + renderWasConcurrent + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + renderWasConcurrent, + errorRetryLanes + ))); + } + if (1 === exitStatus) + throw ( + ((originalCallbackNode = workInProgressRootFatalError), + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + originalCallbackNode) + ); + root.finishedWork = didTimeout; + root.finishedLanes = lanes; + a: { + renderWasConcurrent = root; + switch (exitStatus) { + case 0: + case 1: + throw Error("Root did not complete. This is a bug in React."); + case 4: + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); + break a; + } + break; + case 2: + case 3: + case 5: + break; + default: + throw Error("Unknown root exit status."); + } + if ( + (lanes & 62914560) === lanes && + (alwaysThrottleRetries || 3 === exitStatus) && + ((exitStatus = globalMostRecentFallbackTime + 300 - now$1()), + 10 < exitStatus) + ) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane ); - break a; - case 14: - workInProgress = updateMemoComponent( - null, - workInProgress, - Component, - resolveDefaultProps(Component.type, current), - renderLanes + if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; + renderWasConcurrent.timeoutHandle = scheduleTimeout( + commitRootWhenReady.bind( + null, + renderWasConcurrent, + didTimeout, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ), + exitStatus ); break a; + } + commitRootWhenReady( + renderWasConcurrent, + didTimeout, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + lanes, + workInProgressDeferredLane + ); } - throw Error( - "Element type is invalid. Received a promise that resolves to: " + - Component + - ". Lazy element type must resolve to a class or function." - ); } - return workInProgress; - case 0: + break; + } while (1); + } + ensureRootIsScheduled(root); + scheduleTaskForRootDuringMicrotask(root, now$1()); + root = + root.callbackNode === originalCallbackNode + ? performConcurrentWorkOnRoot.bind(null, root) + : null; + return root; +} +function recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes +) { + var errorsFromFirstAttempt = workInProgressRootConcurrentErrors, + JSCompiler_inline_result; + (JSCompiler_inline_result = root.current.memoizedState.isDehydrated) && + (prepareFreshStack(root, errorRetryLanes).flags |= 256); + errorRetryLanes = renderRootSync(root, errorRetryLanes); + if (2 !== errorRetryLanes) { + if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result) return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateFunctionComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) + (root.errorRecoveryDisabledLanes |= originallyAttemptedLanes), + (workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes), + 4 ); - case 1: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateClassComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) + root = workInProgressRootRecoverableErrors; + workInProgressRootRecoverableErrors = errorsFromFirstAttempt; + null !== root && queueRecoverableErrors(root); + } + return errorRetryLanes; +} +function queueRecoverableErrors(errors) { + null === workInProgressRootRecoverableErrors + ? (workInProgressRootRecoverableErrors = errors) + : workInProgressRootRecoverableErrors.push.apply( + workInProgressRootRecoverableErrors, + errors ); - case 3: - pushHostRootContext(workInProgress); - if (null === current) - throw Error("Should have a current fiber. This is a bug in React."); - var nextProps = workInProgress.pendingProps; - context = workInProgress.memoizedState; - Component = context.element; - cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, nextProps, null, renderLanes); - nextProps = workInProgress.memoizedState; - var nextCache = nextProps.cache; - pushProvider(workInProgress, CacheContext, nextCache); - nextCache !== context.cache && - propagateContextChange(workInProgress, CacheContext, renderLanes); - suspendIfUpdateReadFromEntangledAsyncAction(); - context = nextProps.element; - context === Component - ? (workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - )) - : (reconcileChildren(current, workInProgress, context, renderLanes), - (workInProgress = workInProgress.child)); - return workInProgress; - case 26: - case 27: - case 5: - pushHostContext(workInProgress); - Component = workInProgress.pendingProps.children; - if (enableAsyncActions && null !== workInProgress.memoizedState) { - if (!enableAsyncActions) throw Error("Not implemented."); - context = renderWithHooks( - current, - workInProgress, - TransitionAwareHostComponent, - null, - null, - renderLanes - ); - HostTransitionContext._currentValue = context; - didReceiveUpdate && - null !== current && - current.memoizedState.memoizedState !== context && - propagateContextChange( - workInProgress, - HostTransitionContext, - renderLanes - ); +} +function commitRootWhenReady( + root, + finishedWork, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + lanes, + spawnedLane +) { + 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); + commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane + ); +} +function isRenderConsistentWithExternalStores(finishedWork) { + for (var node = finishedWork; ; ) { + if (node.flags & 16384) { + var updateQueue = node.updateQueue; + if ( + null !== updateQueue && + ((updateQueue = updateQueue.stores), null !== updateQueue) + ) + for (var i = 0; i < updateQueue.length; i++) { + var check = updateQueue[i], + getSnapshot = check.getSnapshot; + check = check.value; + try { + if (!objectIs(getSnapshot(), check)) return !1; + } catch (error) { + return !1; + } + } + } + updateQueue = node.child; + if (node.subtreeFlags & 16384 && null !== updateQueue) + (updateQueue.return = node), (node = updateQueue); + else { + if (node === finishedWork) break; + for (; null === node.sibling; ) { + if (null === node.return || node.return === finishedWork) return !0; + node = node.return; } - markRef(current, workInProgress); - reconcileChildren(current, workInProgress, Component, renderLanes); - return workInProgress.child; - case 6: - return null; - case 13: - return updateSuspenseComponent(current, workInProgress, renderLanes); - case 4: - return ( - pushHostContainer( - workInProgress, - workInProgress.stateNode.containerInfo - ), - (Component = workInProgress.pendingProps), - null === current - ? (workInProgress.child = reconcileChildFibers( - workInProgress, - null, - Component, - renderLanes - )) - : reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 11: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - updateForwardRef( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 7: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps, - renderLanes - ), - workInProgress.child - ); - case 8: - return ( - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 12: - return ( - (workInProgress.flags |= 4), - (Component = workInProgress.stateNode), - (Component.effectDuration = 0), - (Component.passiveEffectDuration = 0), - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child - ); - case 10: - a: { - Component = enableRenderableContext - ? workInProgress.type - : workInProgress.type._context; - context = workInProgress.pendingProps; - nextProps = workInProgress.memoizedProps; - nextCache = context.value; - pushProvider(workInProgress, Component, nextCache); - if (null !== nextProps) - if (objectIs(nextProps.value, nextCache)) { - if ( - nextProps.children === context.children && - !didPerformWorkStackCursor.current - ) { - workInProgress = bailoutOnAlreadyFinishedWork( - current, - workInProgress, - renderLanes - ); - break a; - } - } else propagateContextChange(workInProgress, Component, renderLanes); - reconcileChildren( - current, - workInProgress, - context.children, - renderLanes + node.sibling.return = node.return; + node = node.sibling; + } + } + return !0; +} +function markRootUpdated(root, updatedLanes) { + root.pendingLanes |= updatedLanes; + 268435456 !== updatedLanes && + ((root.suspendedLanes = 0), (root.pingedLanes = 0)); + enableInfiniteRenderLoopDetection && + (executionContext & 2 + ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) + : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), + throwIfInfiniteUpdateLoopDetected()); +} +function markRootSuspended(root, suspendedLanes, spawnedLane) { + suspendedLanes &= ~workInProgressRootPingedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$8 = 31 - clz32(lanes), + lane = 1 << index$8; + expirationTimes[index$8] = -1; + lanes &= ~lane; + } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); +} +function resetWorkInProgressStack() { + if (null !== workInProgress) { + if (0 === workInProgressSuspendedReason) + var interruptedWork = workInProgress.return; + else + (interruptedWork = workInProgress), + resetContextDependencies(), + resetHooksOnUnwind(interruptedWork), + (thenableState$1 = null), + (thenableIndexCounter$1 = 0), + (interruptedWork = workInProgress); + for (; null !== interruptedWork; ) + unwindInterruptedWork(interruptedWork.alternate, interruptedWork), + (interruptedWork = interruptedWork.return); + workInProgress = null; + } +} +function prepareFreshStack(root, lanes) { + root.finishedWork = null; + root.finishedLanes = 0; + var timeoutHandle = root.timeoutHandle; + -1 !== timeoutHandle && + ((root.timeoutHandle = -1), cancelTimeout(timeoutHandle)); + timeoutHandle = root.cancelPendingCommit; + null !== timeoutHandle && + ((root.cancelPendingCommit = null), timeoutHandle()); + resetWorkInProgressStack(); + workInProgressRoot = root; + workInProgress = timeoutHandle = createWorkInProgress(root.current, null); + workInProgressRootRenderLanes = lanes; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + workInProgressRootDidAttachPingListener = !1; + workInProgressRootExitStatus = 0; + workInProgressRootFatalError = null; + workInProgressDeferredLane = + workInProgressRootPingedLanes = + workInProgressRootInterleavedUpdatedLanes = + workInProgressRootSkippedLanes = + 0; + workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = + null; + workInProgressRootDidIncludeRecursiveRenderUpdate = !1; + 0 !== (lanes & 8) && (lanes |= lanes & 32); + var allEntangledLanes = root.entangledLanes; + if (0 !== allEntangledLanes) + for ( + root = root.entanglements, allEntangledLanes &= lanes; + 0 < allEntangledLanes; + + ) { + var index$6 = 31 - clz32(allEntangledLanes), + lane = 1 << index$6; + lanes |= root[index$6]; + allEntangledLanes &= ~lane; + } + entangledRenderLanes = lanes; + finishQueueingConcurrentUpdates(); + return timeoutHandle; +} +function handleThrow(root, thrownValue) { + currentlyRenderingFiber$1 = null; + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactCurrentOwner.current = null; + thrownValue === SuspenseException + ? ((thrownValue = getSuspendedThenable()), + (root = suspenseHandlerStackCursor.current), + (workInProgressSuspendedReason = + (null !== root && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + root !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2)) + : thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); + workInProgressThrownValue = thrownValue; + root = workInProgress; + if (null === root) + (workInProgressRootExitStatus = 1), + (workInProgressRootFatalError = thrownValue); + else + switch ( + (root.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(root, !0), + markComponentRenderStopped(), + workInProgressSuspendedReason) + ) { + case 1: + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentErrored && + injectedProfilingHooks.markComponentErrored( + root, + thrownValue, + workInProgressRootRenderLanes + ); + break; + case 2: + case 3: + case 6: + case 7: + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentSuspended && + injectedProfilingHooks.markComponentSuspended( + root, + thrownValue, + workInProgressRootRenderLanes + ); + } +} +function pushDispatcher() { + var prevDispatcher = ReactCurrentDispatcher.current; + ReactCurrentDispatcher.current = ContextOnlyDispatcher; + return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; +} +function pushCacheDispatcher() { + var prevCacheDispatcher = ReactCurrentCache.current; + ReactCurrentCache.current = DefaultCacheDispatcher; + return prevCacheDispatcher; +} +function renderDidSuspendDelayIfPossible() { + workInProgressRootExitStatus = 4; + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); +} +function renderRootSync(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { + if (isDevToolsPresent) { + var memoizedUpdaters = root.memoizedUpdaters; + 0 < memoizedUpdaters.size && + (restorePendingUpdaters(root, workInProgressRootRenderLanes), + memoizedUpdaters.clear()); + movePendingFibersToMemoized(root, lanes); + } + workInProgressTransitions = null; + prepareFreshStack(root, lanes); + } + markRenderStarted(lanes); + lanes = !1; + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) { + memoizedUpdaters = workInProgress; + var thrownValue = workInProgressThrownValue; + switch (workInProgressSuspendedReason) { + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + case 3: + case 2: + lanes || + null !== suspenseHandlerStackCursor.current || + (lanes = !0); + default: + (workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, memoizedUpdaters, thrownValue); + } + } + workLoopSync(); + break; + } catch (thrownValue$133) { + handleThrow(root, thrownValue$133); + } + while (1); + lanes && root.shellSuspendCounter++; + resetContextDependencies(); + executionContext = prevExecutionContext; + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + if (null !== workInProgress) + throw Error( + "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." + ); + markRenderStopped(); + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; +} +function workLoopSync() { + for (; null !== workInProgress; ) performUnitOfWork(workInProgress); +} +function renderRootConcurrent(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= 2; + var prevDispatcher = pushDispatcher(), + prevCacheDispatcher = pushCacheDispatcher(); + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { + if (isDevToolsPresent) { + var memoizedUpdaters = root.memoizedUpdaters; + 0 < memoizedUpdaters.size && + (restorePendingUpdaters(root, workInProgressRootRenderLanes), + memoizedUpdaters.clear()); + movePendingFibersToMemoized(root, lanes); + } + workInProgressTransitions = null; + workInProgressRootRenderTargetTime = now$1() + 500; + prepareFreshStack(root, lanes); + } + markRenderStarted(lanes); + a: do + try { + if (0 !== workInProgressSuspendedReason && null !== workInProgress) + b: switch ( + ((lanes = workInProgress), + (memoizedUpdaters = workInProgressThrownValue), + workInProgressSuspendedReason) + ) { + case 1: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); + break; + case 2: + if (isThenableResolved(memoizedUpdaters)) { + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + replaySuspendedUnitOfWork(lanes); + break; + } + lanes = function () { + 2 === workInProgressSuspendedReason && + workInProgressRoot === root && + (workInProgressSuspendedReason = 7); + ensureRootIsScheduled(root); + }; + memoizedUpdaters.then(lanes, lanes); + break a; + case 3: + workInProgressSuspendedReason = 7; + break a; + case 4: + workInProgressSuspendedReason = 5; + break a; + case 7: + isThenableResolved(memoizedUpdaters) + ? ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + replaySuspendedUnitOfWork(lanes)) + : ((workInProgressSuspendedReason = 0), + (workInProgressThrownValue = null), + throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters)); + break; + case 5: + switch (workInProgress.tag) { + case 5: + case 26: + case 27: + lanes = workInProgress; + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + var sibling = lanes.sibling; + if (null !== sibling) workInProgress = sibling; + else { + var returnFiber = lanes.return; + null !== returnFiber + ? ((workInProgress = returnFiber), + completeUnitOfWork(returnFiber)) + : (workInProgress = null); + } + break b; + } + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); + break; + case 6: + workInProgressSuspendedReason = 0; + workInProgressThrownValue = null; + throwAndUnwindWorkLoop(root, lanes, memoizedUpdaters); + break; + case 8: + resetWorkInProgressStack(); + workInProgressRootExitStatus = 6; + break a; + default: + throw Error("Unexpected SuspendedReason. This is a bug in React."); + } + workLoopConcurrent(); + break; + } catch (thrownValue$135) { + handleThrow(root, thrownValue$135); + } + while (1); + resetContextDependencies(); + ReactCurrentDispatcher.current = prevDispatcher; + ReactCurrentCache.current = prevCacheDispatcher; + executionContext = prevExecutionContext; + if (null !== workInProgress) + return ( + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderYielded && + injectedProfilingHooks.markRenderYielded(), + 0 + ); + markRenderStopped(); + workInProgressRoot = null; + workInProgressRootRenderLanes = 0; + finishQueueingConcurrentUpdates(); + return workInProgressRootExitStatus; +} +function workLoopConcurrent() { + for (; null !== workInProgress && !shouldYield(); ) + performUnitOfWork(workInProgress); +} +function performUnitOfWork(unitOfWork) { + var current = unitOfWork.alternate; + 0 !== (unitOfWork.mode & 2) + ? (startProfilerTimer(unitOfWork), + (current = beginWork(current, unitOfWork, entangledRenderLanes)), + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) + : (current = beginWork(current, unitOfWork, entangledRenderLanes)); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current + ? completeUnitOfWork(unitOfWork) + : (workInProgress = current); + ReactCurrentOwner.current = null; +} +function replaySuspendedUnitOfWork(unitOfWork) { + var current = unitOfWork.alternate, + isProfilingMode = 0 !== (unitOfWork.mode & 2); + isProfilingMode && startProfilerTimer(unitOfWork); + switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; + case 15: + case 0: + var Component = unitOfWork.type, + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + var context = isContextProvider(Component) + ? previousContext + : contextStackCursor$1.current; + context = getMaskedContext(unitOfWork, context); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + context, + workInProgressRootRenderLanes + ); + break; + case 11: + Component = unitOfWork.type.render; + unresolvedProps = unitOfWork.pendingProps; + unresolvedProps = + unitOfWork.elementType === Component + ? unresolvedProps + : resolveDefaultProps(Component, unresolvedProps); + current = replayFunctionComponent( + current, + unitOfWork, + unresolvedProps, + Component, + unitOfWork.ref, + workInProgressRootRenderLanes + ); + break; + case 5: + resetHooksOnUnwind(unitOfWork); + default: + unwindInterruptedWork(current, unitOfWork), + (unitOfWork = workInProgress = + resetWorkInProgress(unitOfWork, entangledRenderLanes)), + (current = beginWork(current, unitOfWork, entangledRenderLanes)); + } + isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + null === current + ? completeUnitOfWork(unitOfWork) + : (workInProgress = current); + ReactCurrentOwner.current = null; +} +function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { + resetContextDependencies(); + resetHooksOnUnwind(unitOfWork); + thenableState$1 = null; + thenableIndexCounter$1 = 0; + var returnFiber = unitOfWork.return; + try { + if ( + throwException( + root, + returnFiber, + unitOfWork, + thrownValue, + workInProgressRootRenderLanes + ) + ) { + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + } catch (error) { + if (null !== returnFiber) throw ((workInProgress = returnFiber), error); + workInProgressRootExitStatus = 1; + workInProgressRootFatalError = thrownValue; + workInProgress = null; + return; + } + if (unitOfWork.flags & 32768) + a: { + root = unitOfWork; + do { + unitOfWork = unwindWork(root.alternate, root); + if (null !== unitOfWork) { + unitOfWork.flags &= 32767; + workInProgress = unitOfWork; + break a; + } + if (0 !== (root.mode & 2)) { + stopProfilerTimerIfRunningAndRecordDelta(root, !1); + unitOfWork = root.actualDuration; + for (thrownValue = root.child; null !== thrownValue; ) + (unitOfWork += thrownValue.actualDuration), + (thrownValue = thrownValue.sibling); + root.actualDuration = unitOfWork; + } + root = root.return; + null !== root && + ((root.flags |= 32768), + (root.subtreeFlags = 0), + (root.deletions = null)); + workInProgress = root; + } while (null !== root); + workInProgressRootExitStatus = 6; + workInProgress = null; + } + else completeUnitOfWork(unitOfWork); +} +function completeUnitOfWork(unitOfWork) { + var completedWork = unitOfWork; + do { + var current = completedWork.alternate; + unitOfWork = completedWork.return; + 0 === (completedWork.mode & 2) + ? (current = completeWork(current, completedWork, entangledRenderLanes)) + : (startProfilerTimer(completedWork), + (current = completeWork(current, completedWork, entangledRenderLanes)), + stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); + if (null !== current) { + workInProgress = current; + return; + } + completedWork = completedWork.sibling; + if (null !== completedWork) { + workInProgress = completedWork; + return; + } + workInProgress = completedWork = unitOfWork; + } while (null !== completedWork); + 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); +} +function commitRoot( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + spawnedLane +) { + var previousUpdateLanePriority = currentUpdatePriority, + prevTransition = ReactCurrentBatchConfig.transition; + try { + (ReactCurrentBatchConfig.transition = null), + (currentUpdatePriority = 2), + commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + previousUpdateLanePriority, + spawnedLane + ); + } finally { + (ReactCurrentBatchConfig.transition = prevTransition), + (currentUpdatePriority = previousUpdateLanePriority); + } + return null; +} +function commitRootImpl( + root, + recoverableErrors, + transitions, + didIncludeRenderPhaseUpdate, + renderPriorityLevel, + spawnedLane +) { + do flushPassiveEffects(); + while (null !== rootWithPendingPassiveEffects); + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + var finishedWork = root.finishedWork, + lanes = root.finishedLanes; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markCommitStarted && + injectedProfilingHooks.markCommitStarted(lanes); + if (null === finishedWork) return markCommitStopped(), null; + root.finishedWork = null; + root.finishedLanes = 0; + if (finishedWork === root.current) + throw Error( + "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." + ); + root.callbackNode = null; + root.callbackPriority = 0; + root.cancelPendingCommit = null; + var remainingLanes = finishedWork.lanes | finishedWork.childLanes; + remainingLanes |= concurrentlyUpdatedLanes; + markRootFinished(root, remainingLanes, spawnedLane); + didIncludeCommitPhaseUpdate = !1; + root === workInProgressRoot && + ((workInProgress = workInProgressRoot = null), + (workInProgressRootRenderLanes = 0)); + (0 === (finishedWork.subtreeFlags & 10256) && + 0 === (finishedWork.flags & 10256)) || + rootDoesHavePassiveEffects || + ((rootDoesHavePassiveEffects = !0), + (pendingPassiveEffectsRemainingLanes = remainingLanes), + (pendingPassiveTransitions = transitions), + scheduleCallback(NormalPriority$1, function () { + flushPassiveEffects(); + return null; + })); + transitions = 0 !== (finishedWork.flags & 15990); + if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { + transitions = ReactCurrentBatchConfig.transition; + ReactCurrentBatchConfig.transition = null; + spawnedLane = currentUpdatePriority; + currentUpdatePriority = 2; + var prevExecutionContext = executionContext; + executionContext |= 4; + ReactCurrentOwner.current = null; + commitBeforeMutationEffects(root, finishedWork); + commitTime = now(); + commitMutationEffects(root, finishedWork, lanes); + root.current = finishedWork; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && + injectedProfilingHooks.markLayoutEffectsStarted(lanes); + commitLayoutEffects(finishedWork, root, lanes); + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && + injectedProfilingHooks.markLayoutEffectsStopped(); + requestPaint(); + executionContext = prevExecutionContext; + currentUpdatePriority = spawnedLane; + ReactCurrentBatchConfig.transition = transitions; + } else (root.current = finishedWork), (commitTime = now()); + rootDoesHavePassiveEffects + ? ((rootDoesHavePassiveEffects = !1), + (rootWithPendingPassiveEffects = root), + (pendingPassiveEffectsLanes = lanes)) + : releaseRootPooledCache(root, remainingLanes); + remainingLanes = root.pendingLanes; + 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); + onCommitRoot(finishedWork.stateNode, renderPriorityLevel); + isDevToolsPresent && root.memoizedUpdaters.clear(); + ensureRootIsScheduled(root); + if (null !== recoverableErrors) + for ( + renderPriorityLevel = root.onRecoverableError, finishedWork = 0; + finishedWork < recoverableErrors.length; + finishedWork++ + ) + (remainingLanes = recoverableErrors[finishedWork]), + (transitions = { + digest: remainingLanes.digest, + componentStack: remainingLanes.stack + }), + renderPriorityLevel(remainingLanes.value, transitions); + if (hasUncaughtError) + throw ( + ((hasUncaughtError = !1), + (root = firstUncaughtError), + (firstUncaughtError = null), + root) + ); + 0 !== (pendingPassiveEffectsLanes & 3) && + 0 !== root.tag && + flushPassiveEffects(); + remainingLanes = root.pendingLanes; + (enableInfiniteRenderLoopDetection && + (didIncludeRenderPhaseUpdate || didIncludeCommitPhaseUpdate)) || + (0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes)) + ? ((nestedUpdateScheduled = !0), + root === rootWithNestedUpdates + ? nestedUpdateCount++ + : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) + : (nestedUpdateCount = 0); + flushSyncWorkAcrossRoots_impl(!1); + markCommitStopped(); + return null; +} +function releaseRootPooledCache(root, remainingLanes) { + 0 === (root.pooledCacheLanes &= remainingLanes) && + ((remainingLanes = root.pooledCache), + null != remainingLanes && + ((root.pooledCache = null), releaseCache(remainingLanes))); +} +function flushPassiveEffects() { + if (null !== rootWithPendingPassiveEffects) { + var root = rootWithPendingPassiveEffects, + remainingLanes = pendingPassiveEffectsRemainingLanes; + pendingPassiveEffectsRemainingLanes = 0; + var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), + priority = 32 > renderPriority ? 32 : renderPriority; + renderPriority = ReactCurrentBatchConfig.transition; + var previousPriority = currentUpdatePriority; + try { + ReactCurrentBatchConfig.transition = null; + currentUpdatePriority = priority; + if (null === rootWithPendingPassiveEffects) + var JSCompiler_inline_result = !1; + else { + var transitions = pendingPassiveTransitions; + pendingPassiveTransitions = null; + priority = rootWithPendingPassiveEffects; + var lanes = pendingPassiveEffectsLanes; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsLanes = 0; + if (0 !== (executionContext & 6)) + throw Error("Cannot flush passive effects while already rendering."); + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markPassiveEffectsStarted && + injectedProfilingHooks.markPassiveEffectsStarted(lanes); + var prevExecutionContext = executionContext; + executionContext |= 4; + commitPassiveUnmountOnFiber(priority.current); + commitPassiveMountOnFiber( + priority, + priority.current, + lanes, + transitions + ); + transitions = pendingPassiveProfilerEffects; + pendingPassiveProfilerEffects = []; + for (lanes = 0; lanes < transitions.length; lanes++) { + var finishedWork = transitions[lanes]; + if (executionContext & 4 && 0 !== (finishedWork.flags & 4)) + switch (finishedWork.tag) { + case 12: + var passiveEffectDuration = + finishedWork.stateNode.passiveEffectDuration, + _finishedWork$memoize = finishedWork.memoizedProps, + id = _finishedWork$memoize.id, + onPostCommit = _finishedWork$memoize.onPostCommit, + commitTime$106 = commitTime, + phase = null === finishedWork.alternate ? "mount" : "update"; + currentUpdateIsNested && (phase = "nested-update"); + "function" === typeof onPostCommit && + onPostCommit( + id, + phase, + passiveEffectDuration, + commitTime$106 + ); + var parentFiber = finishedWork.return; + b: for (; null !== parentFiber; ) { + switch (parentFiber.tag) { + case 3: + parentFiber.stateNode.passiveEffectDuration += + passiveEffectDuration; + break b; + case 12: + parentFiber.stateNode.passiveEffectDuration += + passiveEffectDuration; + break b; + } + parentFiber = parentFiber.return; + } + } + } + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markPassiveEffectsStopped && + injectedProfilingHooks.markPassiveEffectsStopped(); + executionContext = prevExecutionContext; + flushSyncWorkAcrossRoots_impl(!1); + if ( + injectedHook && + "function" === typeof injectedHook.onPostCommitFiberRoot + ) + try { + injectedHook.onPostCommitFiberRoot(rendererID, priority); + } catch (err) {} + var stateNode = priority.current.stateNode; + stateNode.effectDuration = 0; + stateNode.passiveEffectDuration = 0; + JSCompiler_inline_result = !0; + } + return JSCompiler_inline_result; + } finally { + (currentUpdatePriority = previousPriority), + (ReactCurrentBatchConfig.transition = renderPriority), + releaseRootPooledCache(root, remainingLanes); + } + } + return !1; +} +function enqueuePendingPassiveProfilerEffect(fiber) { + pendingPassiveProfilerEffects.push(fiber); + rootDoesHavePassiveEffects || + ((rootDoesHavePassiveEffects = !0), + scheduleCallback(NormalPriority$1, function () { + flushPassiveEffects(); + return null; + })); +} +function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); + null !== rootFiber && + (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); +} +function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { + if (3 === sourceFiber.tag) + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + else + for (; null !== nearestMountedAncestor; ) { + if (3 === nearestMountedAncestor.tag) { + captureCommitPhaseErrorOnRoot( + nearestMountedAncestor, + sourceFiber, + error ); - workInProgress = workInProgress.child; + break; + } else if (1 === nearestMountedAncestor.tag) { + var instance = nearestMountedAncestor.stateNode; + if ( + "function" === + typeof nearestMountedAncestor.type.getDerivedStateFromError || + ("function" === typeof instance.componentDidCatch && + (null === legacyErrorBoundariesThatAlreadyFailed || + !legacyErrorBoundariesThatAlreadyFailed.has(instance))) + ) { + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); + sourceFiber = createClassErrorUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + nearestMountedAncestor = enqueueUpdate( + nearestMountedAncestor, + sourceFiber, + 2 + ); + null !== nearestMountedAncestor && + (markRootUpdated(nearestMountedAncestor, 2), + ensureRootIsScheduled(nearestMountedAncestor)); + break; + } } - return workInProgress; - case 9: - return ( - (context = enableRenderableContext - ? workInProgress.type._context - : workInProgress.type), - (Component = workInProgress.pendingProps.children), - prepareToReadContext(workInProgress, renderLanes), - (context = readContext(context)), - markComponentRenderStarted(workInProgress), - (Component = Component(context)), - markComponentRenderStopped(), - (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, Component, renderLanes), - workInProgress.child - ); - case 14: - return ( - (Component = workInProgress.type), - (context = resolveDefaultProps(Component, workInProgress.pendingProps)), - (context = resolveDefaultProps(Component.type, context)), - updateMemoComponent( - current, - workInProgress, - Component, - context, - renderLanes - ) - ); - case 15: - return updateSimpleMemoComponent( - current, - workInProgress, - workInProgress.type, - workInProgress.pendingProps, - renderLanes - ); - case 17: - return ( - (Component = workInProgress.type), - (context = workInProgress.pendingProps), - (context = - workInProgress.elementType === Component - ? context - : resolveDefaultProps(Component, context)), - resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), - (workInProgress.tag = 1), - isContextProvider(Component) - ? ((current = !0), pushContextProvider(workInProgress)) - : (current = !1), - prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, Component, context), - mountClassInstance(workInProgress, Component, context, renderLanes), - finishClassComponent( - null, - workInProgress, - Component, - !0, - current, - renderLanes - ) - ); + nearestMountedAncestor = nearestMountedAncestor.return; + } +} +function attachPingListener(root, wakeable, lanes) { + var pingCache = root.pingCache; + if (null === pingCache) { + pingCache = root.pingCache = new PossiblyWeakMap(); + var threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } else + (threadIDs = pingCache.get(wakeable)), + void 0 === threadIDs && + ((threadIDs = new Set()), pingCache.set(wakeable, threadIDs)); + threadIDs.has(lanes) || + ((workInProgressRootDidAttachPingListener = !0), + threadIDs.add(lanes), + (pingCache = pingSuspendedRoot.bind(null, root, wakeable, lanes)), + isDevToolsPresent && restorePendingUpdaters(root, lanes), + wakeable.then(pingCache, pingCache)); +} +function pingSuspendedRoot(root, wakeable, pingedLanes) { + var pingCache = root.pingCache; + null !== pingCache && pingCache.delete(wakeable); + root.pingedLanes |= root.suspendedLanes & pingedLanes; + enableInfiniteRenderLoopDetection && + (executionContext & 2 + ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) + : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0), + throwIfInfiniteUpdateLoopDetected()); + workInProgressRoot === root && + (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && + (4 === workInProgressRootExitStatus || + (3 === workInProgressRootExitStatus && + (workInProgressRootRenderLanes & 62914560) === + workInProgressRootRenderLanes && + 300 > now$1() - globalMostRecentFallbackTime) + ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) + : (workInProgressRootPingedLanes |= pingedLanes)); + ensureRootIsScheduled(root); +} +function retryTimedOutBoundary(boundaryFiber, retryLane) { + 0 === retryLane && + (retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane()); + boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); + null !== boundaryFiber && + (markRootUpdated(boundaryFiber, retryLane), + ensureRootIsScheduled(boundaryFiber)); +} +function retryDehydratedSuspenseBoundary(boundaryFiber) { + var suspenseState = boundaryFiber.memoizedState, + retryLane = 0; + null !== suspenseState && (retryLane = suspenseState.retryLane); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function resolveRetryWakeable(boundaryFiber, wakeable) { + var retryLane = 0; + switch (boundaryFiber.tag) { + case 13: + var retryCache = boundaryFiber.stateNode; + var suspenseState = boundaryFiber.memoizedState; + null !== suspenseState && (retryLane = suspenseState.retryLane); + break; case 19: - return updateSuspenseListComponent(current, workInProgress, renderLanes); + retryCache = boundaryFiber.stateNode; + break; case 22: - return updateOffscreenComponent(current, workInProgress, renderLanes); - case 24: - return ( - prepareToReadContext(workInProgress, renderLanes), - (Component = readContext(CacheContext)), - null === current - ? ((context = peekCacheFromPool()), - null === context && - ((context = workInProgressRoot), - (nextProps = createCache()), - (context.pooledCache = nextProps), - nextProps.refCount++, - null !== nextProps && (context.pooledCacheLanes |= renderLanes), - (context = nextProps)), - (workInProgress.memoizedState = { - parent: Component, - cache: context - }), - initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, context)) - : (0 !== (current.lanes & renderLanes) && - (cloneUpdateQueue(current, workInProgress), - processUpdateQueue(workInProgress, null, null, renderLanes), - suspendIfUpdateReadFromEntangledAsyncAction()), - (context = current.memoizedState), - (nextProps = workInProgress.memoizedState), - context.parent !== Component - ? ((context = { parent: Component, cache: Component }), - (workInProgress.memoizedState = context), - 0 === workInProgress.lanes && - (workInProgress.memoizedState = - workInProgress.updateQueue.baseState = - context), - pushProvider(workInProgress, CacheContext, Component)) - : ((Component = nextProps.cache), - pushProvider(workInProgress, CacheContext, Component), - Component !== context.cache && - propagateContextChange( - workInProgress, - CacheContext, - renderLanes - ))), - reconcileChildren( - current, - workInProgress, - workInProgress.pendingProps.children, - renderLanes - ), - workInProgress.child + retryCache = boundaryFiber.stateNode._retryCache; + break; + default: + throw Error( + "Pinged unknown suspense boundary type. This is probably a bug in React." ); } - throw Error( - "Unknown unit of work tag (" + - workInProgress.tag + - "). This error is likely caused by a bug in React. Please file an issue." - ); -}; + null !== retryCache && retryCache.delete(wakeable); + retryTimedOutBoundary(boundaryFiber, retryLane); +} +function throwIfInfiniteUpdateLoopDetected() { + if (50 < nestedUpdateCount) + throw ( + ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + enableInfiniteRenderLoopDetection && + executionContext & 2 && + null !== workInProgressRoot && + (workInProgressRoot.errorRecoveryDisabledLanes |= + workInProgressRootRenderLanes), + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + )) + ); +} function restorePendingUpdaters(root, lanes) { isDevToolsPresent && root.memoizedUpdaters.forEach(function (schedulingFiber) { @@ -11561,10 +11518,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1256 = { + devToolsConfig$jscomp$inline_1253 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-canary-b5d8787a", + version: "18.3.0-canary-15651b9d", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11594,10 +11551,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1256.bundleType, - version: devToolsConfig$jscomp$inline_1256.version, - rendererPackageName: devToolsConfig$jscomp$inline_1256.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1256.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1253.bundleType, + version: devToolsConfig$jscomp$inline_1253.version, + rendererPackageName: devToolsConfig$jscomp$inline_1253.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1253.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -11613,14 +11570,14 @@ var roots = new Map(), return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1256.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1253.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-b5d8787a" + reconcilerVersion: "18.3.0-canary-15651b9d" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {