Untitled diff

Created Diff never expires
/**
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Facebook, Inc. and its affiliates.
*
*
* This source code is licensed under the MIT license found in the
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* LICENSE file in the root directory of this source tree.
*
*
* @noflow
* @noflow
* @preventMunge
* @preventMunge
* @preserve-invariant-messages
* @preserve-invariant-messages
*/
*/
'use strict';
'use strict';
if (__DEV__) {
if (__DEV__) {
(function() {
(function() {
"use strict";
"use strict";
var React = require("react");
var React = require("react");
var checkPropTypes = require("prop-types/checkPropTypes");
var checkPropTypes = require("prop-types/checkPropTypes");
var Scheduler = require("scheduler");
var Scheduler = require("scheduler");
var tracing = require("scheduler/tracing");
var tracing = require("scheduler/tracing");
// Do not require this module directly! Use normal `invariant` calls with
// Do not require this module directly! Use normal `invariant` calls with
// template literal strings. The messages will be converted to ReactError during
// template literal strings. The messages will be converted to ReactError during
// build, and in production they will be minified.
// build, and in production they will be minified.
// Do not require this module directly! Use normal `invariant` calls with
// Do not require this module directly! Use normal `invariant` calls with
// template literal strings. The messages will be converted to ReactError during
// template literal strings. The messages will be converted to ReactError during
// build, and in production they will be minified.
// build, and in production they will be minified.
function ReactError(error) {
function ReactError(error) {
error.name = "Invariant Violation";
error.name = "Invariant Violation";
return error;
return error;
}
}
/**
/**
* Use invariant() to assert state which your program assumes to be true.
* Use invariant() to assert state which your program assumes to be true.
*
*
* Provide sprintf-style format (only %s is supported) and arguments
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* to provide information about what broke and what you were
* expecting.
* expecting.
*
*
* The invariant message will be stripped in production, but the invariant
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
* will remain to ensure logic does not differ in production.
*/
*/
var warningWithoutStack = require("warning");
var warningWithoutStack = require("warning");
/**
/**
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* instance (key) and the internal representation (value). This allows public
* instance (key) and the internal representation (value). This allows public
* methods to accept the user facing instance as an argument and map them back
* methods to accept the user facing instance as an argument and map them back
* to internal methods.
* to internal methods.
*
*
* Note that this module is currently shared and assumed to be stateless.
* Note that this module is currently shared and assumed to be stateless.
* If this becomes an actual Map, that will break.
* If this becomes an actual Map, that will break.
*/
*/
/**
/**
* This API should be called `delete` but we'd have to make sure to always
* This API should be called `delete` but we'd have to make sure to always
* transform these to strings for IE support. When this transform is fully
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
* supported we can rename it.
*/
*/
function get(key) {
function get(key) {
return key._reactInternalFiber;
return key._reactInternalFiber;
}
}
function has(key) {
function has(key) {
return key._reactInternalFiber !== undefined;
return key._reactInternalFiber !== undefined;
}
}
function set(key, value) {
function set(key, value) {
key._reactInternalFiber = value;
key._reactInternalFiber = value;
}
}
var ReactSharedInternals =
var ReactSharedInternals =
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
// Prevent newer renderers from RTE when used with older react package versions.
// Current owner and dispatcher used to share the same ref,
// Current owner and dispatcher used to share the same ref,
// but PR #14548 split them out to better support the react-debug-tools package.
// but PR #14548 split them out to better support the react-debug-tools package.
if (!ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher")) {
if (!ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher")) {
ReactSharedInternals.ReactCurrentDispatcher = {
ReactSharedInternals.ReactCurrentDispatcher = {
current: null
current: null
};
};
}
}
if (!ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig")) {
if (!ReactSharedInternals.hasOwnProperty("ReactCurrentBatchConfig")) {
ReactSharedInternals.ReactCurrentBatchConfig = {
ReactSharedInternals.ReactCurrentBatchConfig = {
suspense: null
suspense: null
};
};
}
}
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
// nor polyfill, then a plain number is used for performance.
var hasSymbol = typeof Symbol === "function" && Symbol.for;
var hasSymbol = typeof Symbol === "function" && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 0xeaca;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 0xeacb;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 0xeacb;
var REACT_STRICT_MODE_TYPE = hasSymbol
var REACT_STRICT_MODE_TYPE = hasSymbol
? Symbol.for("react.strict_mode")
? Symbol.for("react.strict_mode")
: 0xeacc;
: 0xeacc;
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 0xead2;
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 0xead2;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 0xeacd;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 0xeacd;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 0xeace;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
// (unstable) APIs that have been removed. Can we remove the symbols?
// (unstable) APIs that have been removed. Can we remove the symbols?
var REACT_CONCURRENT_MODE_TYPE = hasSymbol
var REACT_CONCURRENT_MODE_TYPE = hasSymbol
? Symbol.for("react.concurrent_mode")
? Symbol.for("react.concurrent_mode")
: 0xeacf;
: 0xeacf;
var REACT_FORWARD_REF_TYPE = hasSymbol
var REACT_FORWARD_REF_TYPE = hasSymbol
? Symbol.for("react.forward_ref")
? Symbol.for("react.forward_ref")
: 0xead0;
: 0xead0;
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 0xead1;
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 0xead1;
var REACT_SUSPENSE_LIST_TYPE = hasSymbol
var REACT_SUSPENSE_LIST_TYPE = hasSymbol
? Symbol.for("react.suspense_list")
? Symbol.for("react.suspense_list")
: 0xead8;
: 0xead8;
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 0xead3;
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 0xead3;
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 0xead4;
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 0xead4;
var REACT_FUNDAMENTAL_TYPE = hasSymbol
var REACT_FUNDAMENTAL_TYPE = hasSymbol
? Symbol.for("react.fundamental")
? Symbol.for("react.fundamental")
: 0xead5;
: 0xead5;
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 0xead6;
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 0xead6;
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = "@@iterator";
var FAUX_ITERATOR_SYMBOL = "@@iterator";
function getIteratorFn(maybeIterable) {
function getIteratorFn(maybeIterable) {
if (maybeIterable === null || typeof maybeIterable !== "object") {
if (maybeIterable === null || typeof maybeIterable !== "object") {
return null;
return null;
}
}
var maybeIterator =
var maybeIterator =
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
maybeIterable[FAUX_ITERATOR_SYMBOL];
maybeIterable[FAUX_ITERATOR_SYMBOL];
if (typeof maybeIterator === "function") {
if (typeof maybeIterator === "function") {
return maybeIterator;
return maybeIterator;
}
}
return null;
return null;
}
}
var Pending = 0;
var Pending = 0;
var Resolved = 1;
var Resolved = 1;
var Rejected = 2;
var Rejected = 2;
function refineResolvedLazyComponent(lazyComponent) {
function refineResolvedLazyComponent(lazyComponent) {
return lazyComponent._status === Resolved ? lazyComponent._result : null;
return lazyComponent._status === Resolved ? lazyComponent._result : null;
}
}
function getWrappedName(outerType, innerType, wrapperName) {
function getWrappedName(outerType, innerType, wrapperName) {
var functionName = innerType.displayName || innerType.name || "";
var functionName = innerType.displayName || innerType.name || "";
return (
return (
outerType.displayName ||
outerType.displayName ||
(functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName)
(functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName)
);
);
}
}
function getComponentName(type) {
function getComponentName(type) {
if (type == null) {
if (type == null) {
// Host root, text node or just invalid type.
// Host root, text node or just invalid type.
return null;
return null;
}
}
{
{
if (typeof type.tag === "number") {
if (typeof type.tag === "number") {
warningWithoutStack(
warningWithoutStack(
false,
false,
"Received an unexpected object in getComponentName(). " +
"Received an unexpected object in getComponentName(). " +
"This is likely a bug in React. Please file an issue."
"This is likely a bug in React. Please file an issue."
);
);
}
}
}
}
if (typeof type === "function") {
if (typeof type === "function") {
return type.displayName || type.name || null;
return type.displayName || type.name || null;
}
}
if (typeof type === "string") {
if (typeof type === "string") {
return type;
return type;
}
}
switch (type) {
switch (type) {
case REACT_FRAGMENT_TYPE:
case REACT_FRAGMENT_TYPE:
return "Fragment";
return "Fragment";
case REACT_PORTAL_TYPE:
case REACT_PORTAL_TYPE:
return "Portal";
return "Portal";
case REACT_PROFILER_TYPE:
case REACT_PROFILER_TYPE:
return "Profiler";
return "Profiler";
case REACT_STRICT_MODE_TYPE:
case REACT_STRICT_MODE_TYPE:
return "StrictMode";
return "StrictMode";
case REACT_SUSPENSE_TYPE:
case REACT_SUSPENSE_TYPE:
return "Suspense";
return "Suspense";
case REACT_SUSPENSE_LIST_TYPE:
case REACT_SUSPENSE_LIST_TYPE:
return "SuspenseList";
return "SuspenseList";
}
}
if (typeof type === "object") {
if (typeof type === "object") {
switch (type.$$typeof) {
switch (type.$$typeof) {
case REACT_CONTEXT_TYPE:
case REACT_CONTEXT_TYPE:
return "Context.Consumer";
return "Context.Consumer";
case REACT_PROVIDER_TYPE:
case REACT_PROVIDER_TYPE:
return "Context.Provider";
return "Context.Provider";
case REACT_FORWARD_REF_TYPE:
case REACT_FORWARD_REF_TYPE:
return getWrappedName(type, type.render, "ForwardRef");
return getWrappedName(type, type.render, "ForwardRef");
case REACT_MEMO_TYPE:
case REACT_MEMO_TYPE:
return getComponentName(type.type);
return getComponentName(type.type);
case REACT_LAZY_TYPE: {
case REACT_LAZY_TYPE: {
var thenable = type;
var thenable = type;
var resolvedThenable = refineResolvedLazyComponent(thenable);
var resolvedThenable = refineResolvedLazyComponent(thenable);
if (resolvedThenable) {
if (resolvedThenable) {
return getComponentName(resolvedThenable);
return getComponentName(resolvedThenable);
}
}
break;
break;
}
}
}
}
}
}
return null;
return null;
}
}
var FunctionComponent = 0;
var FunctionComponent = 0;
var ClassComponent = 1;
var ClassComponent = 1;
var IndeterminateComponent = 2; // Before we know whether it is function or class
var IndeterminateComponent = 2; // Before we know whether it is function or class
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
var HostComponent = 5;
var HostComponent = 5;
var HostText = 6;
var HostText = 6;
var Fragment = 7;
var Fragment = 7;
var Mode = 8;
var Mode = 8;
var ContextConsumer = 9;
var ContextConsumer = 9;
var ContextProvider = 10;
var ContextProvider = 10;
var ForwardRef = 11;
var ForwardRef = 11;
var Profiler = 12;
var Profiler = 12;
var SuspenseComponent = 13;
var SuspenseComponent = 13;
var MemoComponent = 14;
var MemoComponent = 14;
var SimpleMemoComponent = 15;
var SimpleMemoComponent = 15;
var LazyComponent = 16;
var LazyComponent = 16;
var IncompleteClassComponent = 17;
var IncompleteClassComponent = 17;
var DehydratedSuspenseComponent = 18;
var DehydratedSuspenseComponent = 18;
var SuspenseListComponent = 19;
var SuspenseListComponent = 19;
var FundamentalComponent = 20;
var FundamentalComponent = 20;
// Don't change these two values. They're used by React Dev Tools.
// Don't change these two values. They're used by React Dev Tools.
var NoEffect = /* */ 0;
var NoEffect =
var PerformedWork = /* */ 1;
/* */
// You can change the rest (and add more).
0;
var Placement = /* */ 2;
var PerformedWork =
var Update = /* */ 4;
/* */
var PlacementAndUpdate = /* */ 6;
1; // You can change the rest (and add more).
var Deletion = /* */ 8;
var Placement =
var ContentReset = /* */ 16;
/* */
var Callback = /* */ 32;
2;
var DidCapture = /* */ 64;
var Update =
var Ref = /* */ 128;
/* */
var Snapshot = /* */ 256;
4;
var Passive = /* */ 512;
var PlacementAndUpdate =
// Passive & Update & Callback & Ref & Snapshot
/* */
var LifecycleEffectMask = /* */ 932;
6;
// Union of all host effects
var Deletion =
var HostEffectMask = /* */ 1023;
/* */
var Incomplete = /* */ 1024;
8;
var ShouldCapture = /* */ 2048;
var ContentReset =
/* */
16;
var Callback =
/* */
32;
var DidCapture =
/* */
64;
var Ref =
/* */
128;
var Snapshot =
/* */
256;
var Passive =
/* */
512; // Passive & Update & Callback & Ref & Snapshot
var LifecycleEffectMask =
/* */
932; // Union of all host effects
var HostEffectMask =
/* */
1023;
var Incomplete =
/* */
1024;
var ShouldCapture =
/* */
2048;
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
var MOUNTING = 1;
var MOUNTING = 1;
var MOUNTED = 2;
var MOUNTED = 2;
var UNMOUNTED = 3;
var UNMOUNTED = 3;
function isFiberMountedImpl(fiber) {
function isFiberMountedImpl(fiber) {
var node = fiber;
var node = fiber;
if (!fiber.alternate) {
if (!fiber.alternate) {
// If there is no alternate, this might be a new tree that isn't inserted
// If there is no alternate, this might be a new tree that isn't inserted
// yet. If it is, then it will have a pending insertion effect on it.
// yet. If it is, then it will have a pending insertion effect on it.
if ((node.effectTag & Placement) !== NoEffect) {
if ((node.effectTag & Placement) !== NoEffect) {
return MOUNTING;
return MOUNTING;
}
}
while (node.return) {
while (node.return) {
node = node.return;
node = node.return;
if ((node.effectTag & Placement) !== NoEffect) {
if ((node.effectTag & Placement) !== NoEffect) {
return MOUNTING;
return MOUNTING;
}
}
}
}
} else {
} else {
while (node.return) {
while (node.return) {
node = node.return;
node = node.return;
}
}
}
}
if (node.tag === HostRoot) {
if (node.tag === HostRoot) {
// TODO: Check if this was a nested HostRoot when used with
// TODO: Check if this was a nested HostRoot when used with
// renderContainerIntoSubtree.
// renderContainerIntoSubtree.
return MOUNTED;
return MOUNTED;
}
} // If we didn't hit the root, that means that we're in an disconnected tree
// If we didn't hit the root, that means that we're in an disconnected tree
// that has been unmounted.
// that has been unmounted.
return UNMOUNTED;
return UNMOUNTED;
}
}
function isFiberMounted(fiber) {
function isFiberMounted(fiber) {
return isFiberMountedImpl(fiber) === MOUNTED;
return isFiberMountedImpl(fiber) === MOUNTED;
}
}
function isMounted(component) {
function isMounted(component) {
{
{
var owner = ReactCurrentOwner.current;
var owner = ReactCurrentOwner.current;
if (owner !== null && owner.tag === ClassComponent) {
if (owner !== null && owner.tag === ClassComponent) {
var ownerFiber = owner;
var ownerFiber = owner;
var instance = ownerFiber.stateNode;
var instance = ownerFiber.stateNode;
!instance._warnedAboutRefsInRender
!instance._warnedAboutRefsInRender
? warningWithoutStack(
? warningWithoutStack(
false,
false,
"%s is accessing isMounted inside its render() function. " +
"%s is accessing isMounted inside its render() function. " +
"render() should be a pure function of props and state. It should " +
"render() should be a pure function of props and state. It should " +
"never access something that requires stale data from the previous " +
"never access something that requires stale data from the previous " +
"render, such as refs. Move this logic to componentDidMount and " +
"render, such as refs. Move this logic to componentDidMount and " +
"componentDidUpdate instead.",
"componentDidUpdate instead.",
getComponentName(ownerFiber.type) || "A component"
getComponentName(ownerFiber.type) || "A component"
)
)
: void 0;
: void 0;
instance._warnedAboutRefsInRender = true;
instance._warnedAboutRefsInRender = true;
}
}
}
}
var fiber = get(component);
var fiber = get(component);
if (!fiber) {
if (!fiber) {
return false;
return false;
}
}
return isFiberMountedImpl(fiber) === MOUNTED;
return isFiberMountedImpl(fiber) === MOUNTED;
}
}
function assertIsMounted(fiber) {
function assertIsMounted(fiber) {
(function() {
(function() {
if (!(isFiberMountedImpl(fiber) === MOUNTED)) {
if (!(isFiberMountedImpl(fiber) === MOUNTED)) {
{
{
throw ReactError(
throw ReactError(
Error("Unable to find node on an unmounted component.")
Error("Unable to find node on an unmounted component.")
);
);
}
}
}
}
})();
})();
}
}
function findCurrentFiberUsingSlowPath(fiber) {
function findCurrentFiberUsingSlowPath(fiber) {
var alternate = fiber.alternate;
var alternate = fiber.alternate;
if (!alternate) {
if (!alternate) {
// If there is no alternate, then we only need to check if it is mounted.
// If there is no alternate, then we only need to check if it is mounted.
var state = isFiberMountedImpl(fiber);
var state = isFiberMountedImpl(fiber);
(function() {
(function() {
if (!(state !== UNMOUNTED)) {
if (!(state !== UNMOUNTED)) {
{
{
throw ReactError(
throw ReactError(
Error("Unable to find node on an unmounted component.")
Error("Unable to find node on an unmounted component.")
);
);
}
}
}
}
})();
})();
if (state === MOUNTING) {
if (state === MOUNTING) {
return null;
return null;
}
}
return fiber;
return fiber;
}
} // If we have two possible branches, we'll walk backwards up to the root
// If we have two possible branches, we'll walk backwards up to the root
// to see what path the root points to. On the way we may hit one of the
// to see what path the root points to. On the way we may hit one of the
// special cases and we'll deal with them.
// special cases and we'll deal with them.
var a = fiber;
var a = fiber;
var b = alternate;
var b = alternate;
while (true) {
while (true) {
var parentA = a.return;
var parentA = a.return;
if (parentA === null) {
if (parentA === null) {
// We're at the root.
// We're at the root.
break;
break;
}
}
var parentB = parentA.alternate;
var parentB = parentA.alternate;
if (parentB === null) {
if (parentB === null) {
// There is no alternate. This is an unusual case. Currently, it only
// There is no alternate. This is an unusual case. Currently, it only
// happens when a Suspense component is hidden. An extra fragment fiber
// happens when a Suspense component is hidden. An extra fragment fiber
// is inserted in between the Suspense fiber and its children. Skip
// is inserted in between the Suspense fiber and its children. Skip
// over this extra fragment fiber and proceed to the next parent.
// over this extra fragment fiber and proceed to the next parent.
var nextParent = parentA.return;
var nextParent = parentA.return;
if (nextParent !== null) {
if (nextParent !== null) {
a = b = nextParent;
a = b = nextParent;
continue;
continue;
}
} // If there's no parent, we're at the root.
// If there's no parent, we're at the root.
break;
break;
}
} // If both copies of the parent fiber point to the same child, we can
// If both copies of the parent fiber point to the same child, we can
// assume that the child is current. This happens when we bailout on low
// assume that the child is current. This happens when we bailout on low
// priority: the bailed out fiber's child reuses the current child.
// priority: the bailed out fiber's child reuses the current child.
if (parentA.child === parentB.child) {
if (parentA.child === parentB.child) {
var child = parentA.child;
var child = parentA.child;
while (child) {
while (child) {
if (child === a) {
if (child === a) {
// We've determined that A is the current branch.
// We've determined that A is the current branch.
assertIsMounted(parentA);
assertIsMounted(parentA);
return fiber;
return fiber;
}
}
if (child === b) {
if (child === b) {
// We've determined that B is the current branch.
// We've determined that B is the current branch.
assertIsMounted(parentA);
assertIsMounted(parentA);
return alternate;
return alternate;
}
}
child = child.sibling;
child = child.sibling;
}
} // We should never have an alternate for any mounting node. So the only
// We should never have an alternate for any mounting node. So the only
// way this could possibly happen is if this was unmounted, if at all.
// way this could possibly happen is if this was unmounted, if at all.
(function() {
(function() {
{
{
{
{
throw ReactError(
throw ReactError(
Error("Unable to find node on an unmounted component.")
Error("Unable to find node on an unmounted component.")
);
);
}
}
}
}
})();
})();
}
}
if (a.return !== b.return) {
if (a.return !== b.return) {
// The return pointer of A and the return pointer of B point to different
// The return pointer of A and the return pointer of B point to different
// fibers. We assume that return pointers never criss-cross, so A must
// fibers. We assume that return pointers never criss-cross, so A must
// belong to the child set of A.return, and B must belong to the child
// belong to the child set of A.return, and B must belong to the child
// set of B.return.
// set of B.return.
a = parentA;
a = parentA;
b = parentB;
b = parentB;
} else {
} else {
// The return pointers point to the same fiber. We'll have to use the
// The return pointers point to the same fiber. We'll have to use the
// default, slow path: scan the child sets of each parent alternate to see
// default, slow path: scan the child sets of each parent alternate to see
// which child belongs to which set.
// which child belongs to which set.
//
//
// Search parent A's child set
// Search parent A's child set
var didFindChild = false;
var didFindChild = false;
var _child = parentA.child;
var _child = parentA.child;
while (_child) {
while (_child) {
if (_child === a) {
if (_child === a) {
didFindChild = true;
didFindChild = true;
a = parentA;
a = parentA;
b = parentB;
b = parentB;
break;
break;
}
}
if (_child === b) {
if (_child === b) {
didFindChild = true;
didFindChild = true;
b = parentA;
b = parentA;
a = parentB;
a = parentB;
break;
break;
}
}
_child = _child.sibling;
_child = _child.sibling;
}
}
if (!didFindChild) {
if (!didFindChild) {
// Search parent B's child set
// Search parent B's child set
_child = parentB.child;
_child = parentB.child;
while (_child) {
while (_child) {
if (_child === a) {
if (_child === a) {
didFindChild = true;
didFindChild = true;
a = parentB;
a = parentB;
b = parentA;
b = parentA;
break;
break;
}
}
if (_child === b) {
if (_child === b) {
didFindChild = true;
didFindChild = true;
b = parentB;
b = parentB;
a = parentA;
a = parentA;
break;
break;
}
}
_child = _child.sibling;
_child = _child.sibling;
}
}
(function() {
(function() {
if (!didFindChild) {
if (!didFindChild) {
{
{
throw ReactError(
throw ReactError(
Error(
Error(
"Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."
"Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."
)
)
);
);
}
}
}
}
})();
})();
}
}
}
}
(function() {
(function() {
if (!(a.alternate === b)) {
if (!(a.alternate === b)) {
{
{
throw ReactError(
throw ReactError(
Error(
Error(
"Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."
"Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."
)
)
);
);
}
}
}
}
})();
})();
}
} // If the root is not a host container, we're in a disconnected tree. I.e.
// If the root is not a host container, we're in a disconnected tree. I.e.
// unmounted.
// unmounted.
(function() {
(function() {
if (!(a.tag === HostRoot)) {
if (!(a.tag === HostRoot)) {
{
{
throw ReactError(
throw ReactError(
Error("Unable to find node on an unmounted component.")
Error("Unable to find node on an unmounted component.")
);
);
}
}
}
}
})();
})();
if (a.stateNode.current === a) {
if (a.stateNode.current === a) {
// We've determined that A is the current branch.
// We've determined that A is the current branch.
return fiber;
return fiber;
}
} // Otherwise B has to be current branch.
// Otherwise B has to be current branch.
return alternate;
return alternate;
}
}
function findCurrentHostFiber(parent) {
function findCurrentHostFiber(parent) {
var currentParent = findCurrentFiberUsingSlowPath(parent);
var currentParent = findCurrentFiberUsingSlowPath(parent);
if (!currentParent) {
if (!currentParent) {
return null;
return null;
}
} // Next we'll drill down this component to find the first HostComponent/Text.
// Next we'll drill down this component to find the first HostComponent/Text.
var node = currentParent;
var node = currentParent;
while (true) {
while (true) {
if (node.tag === HostComponent || node.tag === HostText) {
if (node.tag === HostComponent || node.tag === HostText) {
return node;
return node;
} else if (node.child) {
} else if (node.child) {
node.child.return = node;
node.child.return = node;
node = node.child;
node = node.child;
continue;
continue;
}
}
if (node === currentParent) {
if (node === currentParent) {
return null;
return null;
}
}
while (!node.sibling) {
while (!node.sibling) {
if (!node.return || node.return === currentParent) {
if (!node.return || node.return === currentParent) {
return null;
return null;
}
}
node = node.return;
node = node.return;
}
}
node.sibling.return = node.return;
node.sibling.return = node.return;
node = node.sibling;
node = node.sibling;
}
} // Flow needs the return null here, but ESLint complains about it.
// Flow needs the return null here, but ESLint complains about it.
// eslint-disable-next-line no-unreachable
// eslint-disable-next-line no-unreachable
return null;
return null;
}
}
function findCurrentHostFiberWithNoPortals(parent) {
function findCurrentHostFiberWithNoPortals(parent) {
var currentParent = findCurrentFiberUsingSlowPath(parent);
var currentParent = findCurrentFiberUsingSlowPath(parent);
if (!currentParent) {
if (!currentParent) {
return null;
return null;
}
} // Next we'll drill down this component to find the first HostComponent/Text.
// Next we'll drill down this component to find the first HostComponent/Text.
var node = currentParent;
var node = currentParent;
while (true) {
while (true) {
if (
if (
node.tag === HostComponent ||
node.tag === HostComponent ||
node.tag === HostText ||
node.tag === HostText ||
node.tag === FundamentalComponent
node.tag === FundamentalComponent
) {
) {
return node;
return node;
} else if (node.child && node.tag !== HostPortal) {
} else if (node.child && node.tag !== HostPortal) {
node.child.return = node;
node.child.return = node;
node = node.child;
node = node.child;
continue;
continue;
}
}
if (node === currentParent) {
if (node === currentParent) {
return null;
return null;
}
}
while (!node.sibling) {
while (!node.sibling) {
if (!node.return || node.return === currentParent) {
if (!node.return || node.return === currentParent) {
return null;
return null;
}
}
node = node.return;
node = node.return;
}
}
node.sibling.return = node.return;
node.sibling.return = node.return;
node = node.sibling;
node = node.sibling;
}
} // Flow needs the return null here, but ESLint complains about it.
// Flow needs the return null here, but ESLint complains about it.
// eslint-disable-next-line no-unreachable
// eslint-disable-next-line no-unreachable
return null;
return null;
}
}
// Re-export dynamic flags from the www version.
// Re-export dynamic flags from the www version.
var _require = require("ReactFeatureFlags");
var _require = require("ReactFeatureFlags");
var debugRenderPhaseSideEffects = _require.debugRenderPhaseSideEffects;
var debugRenderPhaseSideEffects = _require.debugRenderPhaseSideEffects;
var debugRenderPhaseSideEffectsForStrictMode =
var debugRenderPhaseSideEffectsForStrictMode =
_require.debugRenderPhaseSideEffectsForStrictMode;
_require.debugRenderPhaseSideEffectsForStrictMode;
var replayFailedUnitOfWorkWithInvokeGuardedCallback =
var replayFailedUnitOfWorkWithInvokeGuardedCallback =
_require.replayFailedUnitOfWorkWithInvokeGuardedCallback;
_require.replayFailedUnitOfWorkWithInvokeGuardedCallback;
var warnAboutDeprecatedLifecycles = _require.warnAboutDeprecatedLifecycles;
var warnAboutDeprecatedLifecycles = _require.warnAboutDeprecatedLifecycles;
var disableInputAttributeSyncing = _require.disableInputAttributeSyncing;
var disableInputAttributeSyncing = _require.disableInputAttributeSyncing;
var warnAboutShorthandPropertyCollision =
var warnAboutShorthandPropertyCollision =
_require.warnAboutShorthandPropertyCollision;
_require.warnAboutShorthandPropertyCollision;
var warnAboutDeprecatedSetNativeProps =
var warnAboutDeprecatedSetNativeProps =
_require.warnAboutDeprecatedSetNativeProps;
_require.warnAboutDeprecatedSetNativeProps;
var revertPassiveEffectsChange = _require.revertPassiveEffectsChange;
var revertPassiveEffectsChange = _require.revertPassiveEffectsChange;
var enableUserBlockingEvents = _require.enableUserBlockingEvents;
var enableUserBlockingEvents = _require.enableUserBlockingEvents;
var disableLegacyContext = _require.disableLegacyContext;
var disableLegacyContext = _require.disableLegacyContext;
var disableSchedulerTimeoutBasedOnReactExpirationTime =
var disableSchedulerTimeoutBasedOnReactExpirationTime =
_require.disableSchedulerTimeoutBasedOnReactExpirationTime;
_require.disableSchedulerTimeoutBasedOnReactExpirationTime; // In www, we have experimental support for gathering data
var enableUserTimingAPI = true;
var enableUserTimingAPI = true;
var enableProfilerTimer = true;
var enableProfilerTimer = true;
var enableSchedulerTracing = true;
var enableSchedulerTracing = true;
var enableStableConcurrentModeAPIs = false;
var enableStableConcurrentModeAPIs = false;
var enableSuspenseServerRenderer = true;
var enableSuspenseServerRenderer = true;
var disableJavaScriptURLs = true;
var disableJavaScriptURLs = true;
var refCount = 0;
var refCount = 0;
function addUserTimingListener() {
function addUserTimingListener() {
{
{
// Noop.
// Noop.
return function() {};
return function() {};
}
}
refCount++;
refCount++;
updateFlagOutsideOfReactCallStack();
updateFlagOutsideOfReactCallStack();
return function() {
return function() {
refCount--;
refCount--;
updateFlagOutsideOfReactCallStack();
updateFlagOutsideOfReactCallStack();
};
};
}
} // The flag is intentionally updated in a timeout.
// The flag is intentionally updated in a timeout.
// We don't support toggling it during reconciliation or
// We don't support toggling it during reconciliation or
// commit since that would cause mismatching user timing API calls.
// commit since that would cause mismatching user timing API calls.
var timeout = null;
var timeout = null;
function updateFlagOutsideOfReactCallStack() {
function updateFlagOutsideOfReactCallStack() {
if (!timeout) {
if (!timeout) {
timeout = setTimeout(function() {
timeout = setTimeout(function() {
timeout = null;
timeout = null;
enableUserTimingAPI = refCount > 0;
enableUserTimingAPI = refCount > 0;
});
});
}
}
}
}
var enableFlareAPI = true;
var enableFlareAPI = true;
var enableFundamentalAPI = false;
var enableFundamentalAPI = false;
var warnAboutUnmockedScheduler = true;
var warnAboutUnmockedScheduler = true;
var enableSuspenseCallback = true;
var enableSuspenseCallback = true;
var warnAboutDefaultPropsOnFunctionComponents = false;
var warnAboutDefaultPropsOnFunctionComponents = false;
var flushSuspenseFallbacksInTests = true;
var flushSuspenseFallbacksInTests = true; // Flow magic to verify the exports of this file match the original version.
(function() {
(function() {
if (!React) {
if (!React) {
{
{
throw ReactError(
throw ReactError(
Error(
Error(
"ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM."
"ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM."
)
)
);
);
}
}
}
}
})();
})();
/**
/**
* Injectable ordering of event plugins.
* Injectable ordering of event plugins.
*/
*/
var eventPluginOrder = null;
var eventPluginOrder = null;
/**
/**
* Injectable mapping from names to event plugin modules.
* Injectable mapping from names to event plugin modules.
*/
*/
var namesToPlugins = {};
var namesToPlugins = {};
/**
/**
* Recomputes the plugin list using the injected plugins and plugin ordering.
* Recomputes the plugin list using the injected plugins and plugin ordering.
*
*
* @private
* @private
*/
*/
function recomputePluginOrdering() {
function recomputePluginOrdering() {
if (!eventPluginOrder) {
if (!eventPluginOrder) {
// Wait until an `eventPluginOrder` is injected.
// Wait until an `eventPluginOrder` is injected.
return;
return;
}
}
for (var pluginName in namesToPlugins) {
for (var pluginName in namesToPlugins) {
var pluginModule = namesToPlugins[pluginName];
var pluginModule = namesToPlugins[pluginName];
var pluginIndex = eventPluginOrder.indexOf(pluginName);
var pluginIndex = eventPluginOrder.indexOf(pluginName);
(function() {
(function() {
if (!(pluginIndex > -1)) {
if (!(pluginIndex > -1)) {
{
{
throw ReactError(
throw ReactError(
Error(
Error(
"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" +
"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" +
pluginName +
pluginName +
"`."
"`."
)
)
);
);
}
}
}
}
})();
})();
if (plugins[pluginIndex]) {
if (plugins[pluginIndex]) {
continue;
continue;
}
}
(function() {
(function() {
if (!pluginModule.extractEvents) {
if (!pluginModule.extractEvents) {
{
{
throw ReactError(
throw ReactError(
Error(
Error(
"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" +
"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" +
pluginName +
pluginName +
"` does not."
"` does not."
)
)
);
);
}
}
}
}
})();
})();
plugins[pluginIndex] = pluginModule;
plugins[pluginIndex] = pluginModule;
var publishedEvents = pluginModule.eventTypes;
var publishedEvents = pluginModule.eventTypes;
for (var eventName in publishedEvents) {
for (var eventName in publishedEvents) {
(function() {
(function() {
if (
if (
!publishEventForPlugin(
!publishEventForPlugin(
publishedEvents[eventName],
publishedEvents[eventName],
pluginModule,
pluginModule,
eventName
eventName
)
)
) {
) {
{
{
throw ReactError(
throw ReactError(
Error(
Error(
"EventPluginRegistry: Failed to publish event `" +
"EventPluginRegistry: Failed to publish event `" +
eventName +
eventName +
"` for plugin `" +
"` for plugin `" +
pluginName +
pluginName +
"`."
"`."
)
)
);
);
}
}
}
}
})();
})();
}
}
}
}
}
}
/**
/**
* Publishes an event so that it can be dispatched by the supplied plugin.
* Publishes an event so that it can be dispatched by the supplied plugin.
*
*
* @param {object} dispatchConfig Dispatch configuration for the event.
* @param {object} dispatchConfig Dispatch configuration for the event.
* @param {object} PluginModule Plugin publishing the event.
* @param {object} PluginModule Plugin publishing the event.
* @return {boolean} True if the event was successfully published.
* @return {boolean} True if the event was successfully published.
* @private
* @private
*/
*/
function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
(function() {
(function() {
if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) {
if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) {
{
{
throw ReactError(
throw ReactError(
Error(
Error(
"EventPluginHub: More than one plugin attempted to publish the same event name, `" +
"EventPluginHub: More than one plugin attempted to publish the same event name, `" +
eventName +
eventName +
"`."
"`."
)
)
);
);
}
}
}
}
})();
})();
eventNameDispatchConfigs[eventName] = dispatchConfig;
eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
if (phasedRegistrationNames) {
if (phasedRegistrationNames) {
for (var phaseName in phasedRegistrationNames) {
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
var phasedRegistrationName = phasedRegistrationNames[phaseName];
publishRegistrationName(
publishRegistrationName(
phasedRegistrationName,
phasedRegistrationName,
pluginModule,
pluginModule,
eventName
eventName
);
);
}
}
}
}
return true;
return true;
} else if (dispatchConfig.registrationName) {
} else if (dispatchConfig.registrationName) {
publishRegistrationName(
publishRegistrationName(
dispatchConfig.registrationName,
dispatchConfig.registrationName,
pluginModule,
pluginModule,
eventName
eventName
);
);
return true;
return true;
}
}
return false;
return false;
}
}
/**
/**
* Publishes a registration name that is used to identify dispatched events.
* Publishes a registration name that is used to identify dispatched events.
*
*
* @param {string} registrationName Registration name to add.
* @param {string} registrationName Registration name to add.
* @param {object} PluginModule Plugin publishing the event.
* @param {object} PluginModule Plugin publishing the event.
* @private
* @private
*/
*/
function publishRegistrationName(registrationName, pluginModule, eventName) {
function publishRegistrationName(registrationName, pluginModule, eventName) {
(function() {
(function() {
if (!!registrationNameModules[registrationName]) {
if (!!registrationNameModules[registrationName]) {
{
{
throw ReactError(
throw ReactError(
Error(
Error(
"EventPluginHub: More than one plugin attempted to publish the same registration name, `" +
"EventPluginHub: More than one plugin attempted to publish the same registration name, `" +
registrationName +
registrationName +
"`."
"`."
)
)
);
);
}
}
}
}
})();
})();
registrationNameModules[registrationName] = pluginModule;
registrationNameModules[registrationName] = pluginModule;
registrationNameDependencies[registrationName] =
registrationNameDependencies[registrationName] =
pluginModule.eventTypes[eventName].dependencies;
pluginModule.eventTypes[eventName].dependencies;
{
{
var lowerCasedName = registrationName.toLowerCase();
var lowerCasedName = registrationName.toLowerCase();
possibleRegistrationNames[lowerCasedName] = registrationName;
possibleRegistrationNames[lowerCasedName] = registrationName;
if (registrationName === "onDoubleClick") {
if (registrationName === "onDoubleClick") {
possibleRegistrationNames.ondblclick = registrationName;
possibleRegistrationNames.ondblclick = registrationName;
}
}
}
}
}
}
/**
/**
* Registers plugins so that they can extract and dispatch events.
* Registers plugins so that they can extract and dispatch events.
*
*
* @see {EventPluginHub}
* @see {EventPluginHub}
*/
*/
/**
/**
* Ordered list of injected plugins.
* Ordered list of injected plugins.
*/
*/
var plugins = [];
var plugins = [];
/**
/**
* Mapping from event name to dispatch config
* Mapping from event name to dispatch config
*/
*/
var eventNameDispatchConfigs = {};
var eventNameDispatchConfigs = {};
/**
/**
* Mapping from registration name to plugin module
* Mapping from registration name to plugin module
*/
*/
var registrationNameModules = {};
var registrationNameModules = {};
/**
/**
* Mapping from registration name to event name
* Mapping from registration name to event name
*/
*/
var registrationNameDependencies = {};
var registrationNameDependencies = {};
/**
/**
* Mapping from lowercase registration names to the properly cased version,
* Mapping from lowercase registration names to the properly cased version,
* used to warn in the case of missing event handlers. Available
* used to warn in the case of missing event handlers. Available
* only in true.
* only in true.
* @type {Object}
* @type {Object}
*/
*/
var possibleRegistrationNames = {};
var possibleRegistrationNames = {}; // Trust the developer to only use possibleRegistrationNames in true
// Trust the developer to only use possibleRegistrationNames in true
/**
/**
* Injects an ordering of plugins (by plugin name). This allows the ordering
* Injects an ordering of plugins (by plugin name). This allows the ordering
* to be decoupled from injection of the actual plugins so that ordering is
* to be decoupled from injection of the actual plugins so that ordering is
* always deterministic regardless of packaging, on-the-fly injection, etc.
* always deterministic rega
*
* @param {array} InjectedEventPluginOrder
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/