9106 lines
307 KiB
JavaScript
9106 lines
307 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @noflow
|
|
* @nolint
|
|
* @providesModule ReactNativeRenderer-profiling
|
|
* @preventMunge
|
|
* @generated SignedSource<<380a53922e2dcceb4a32c98acc12f578>>
|
|
*/
|
|
|
|
|
|
'use strict';
|
|
|
|
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
if (
|
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
'function'
|
|
) {
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
}
|
|
"use strict";
|
|
require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore");
|
|
var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"),
|
|
React = require("react"),
|
|
Scheduler = require("scheduler");
|
|
function invokeGuardedCallbackImpl(name, func, context, a, b, c, d, e, f) {
|
|
var funcArgs = Array.prototype.slice.call(arguments, 3);
|
|
try {
|
|
func.apply(context, funcArgs);
|
|
} catch (error) {
|
|
this.onError(error);
|
|
}
|
|
}
|
|
var 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 = 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);
|
|
event.currentTarget = null;
|
|
}
|
|
function executeDirectDispatch(event) {
|
|
var dispatchListener = event._dispatchListeners,
|
|
dispatchInstance = event._dispatchInstances;
|
|
if (isArrayImpl(dispatchListener))
|
|
throw Error("executeDirectDispatch(...): Invalid `event`.");
|
|
event.currentTarget = dispatchListener
|
|
? getNodeFromInstance(dispatchInstance)
|
|
: null;
|
|
dispatchListener = dispatchListener ? dispatchListener(event) : null;
|
|
event.currentTarget = null;
|
|
event._dispatchListeners = null;
|
|
event._dispatchInstances = null;
|
|
return dispatchListener;
|
|
}
|
|
var assign = Object.assign;
|
|
function functionThatReturnsTrue() {
|
|
return !0;
|
|
}
|
|
function functionThatReturnsFalse() {
|
|
return !1;
|
|
}
|
|
function SyntheticEvent(
|
|
dispatchConfig,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
) {
|
|
this.dispatchConfig = dispatchConfig;
|
|
this._targetInst = targetInst;
|
|
this.nativeEvent = nativeEvent;
|
|
this._dispatchInstances = this._dispatchListeners = null;
|
|
dispatchConfig = this.constructor.Interface;
|
|
for (var propName in dispatchConfig)
|
|
dispatchConfig.hasOwnProperty(propName) &&
|
|
((targetInst = dispatchConfig[propName])
|
|
? (this[propName] = targetInst(nativeEvent))
|
|
: "target" === propName
|
|
? (this.target = nativeEventTarget)
|
|
: (this[propName] = nativeEvent[propName]));
|
|
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
|
|
? nativeEvent.defaultPrevented
|
|
: !1 === nativeEvent.returnValue)
|
|
? functionThatReturnsTrue
|
|
: functionThatReturnsFalse;
|
|
this.isPropagationStopped = functionThatReturnsFalse;
|
|
return this;
|
|
}
|
|
assign(SyntheticEvent.prototype, {
|
|
preventDefault: function() {
|
|
this.defaultPrevented = !0;
|
|
var event = this.nativeEvent;
|
|
event &&
|
|
(event.preventDefault
|
|
? event.preventDefault()
|
|
: "unknown" !== typeof event.returnValue && (event.returnValue = !1),
|
|
(this.isDefaultPrevented = functionThatReturnsTrue));
|
|
},
|
|
stopPropagation: function() {
|
|
var event = this.nativeEvent;
|
|
event &&
|
|
(event.stopPropagation
|
|
? event.stopPropagation()
|
|
: "unknown" !== typeof event.cancelBubble && (event.cancelBubble = !0),
|
|
(this.isPropagationStopped = functionThatReturnsTrue));
|
|
},
|
|
persist: function() {
|
|
this.isPersistent = functionThatReturnsTrue;
|
|
},
|
|
isPersistent: functionThatReturnsFalse,
|
|
destructor: function() {
|
|
var Interface = this.constructor.Interface,
|
|
propName;
|
|
for (propName in Interface) this[propName] = null;
|
|
this.nativeEvent = this._targetInst = this.dispatchConfig = null;
|
|
this.isPropagationStopped = this.isDefaultPrevented = functionThatReturnsFalse;
|
|
this._dispatchInstances = this._dispatchListeners = null;
|
|
}
|
|
});
|
|
SyntheticEvent.Interface = {
|
|
type: null,
|
|
target: null,
|
|
currentTarget: function() {
|
|
return null;
|
|
},
|
|
eventPhase: null,
|
|
bubbles: null,
|
|
cancelable: null,
|
|
timeStamp: function(event) {
|
|
return event.timeStamp || Date.now();
|
|
},
|
|
defaultPrevented: null,
|
|
isTrusted: null
|
|
};
|
|
SyntheticEvent.extend = function(Interface) {
|
|
function E() {}
|
|
function Class() {
|
|
return Super.apply(this, arguments);
|
|
}
|
|
var Super = this;
|
|
E.prototype = Super.prototype;
|
|
var prototype = new E();
|
|
assign(prototype, Class.prototype);
|
|
Class.prototype = prototype;
|
|
Class.prototype.constructor = Class;
|
|
Class.Interface = assign({}, Super.Interface, Interface);
|
|
Class.extend = Super.extend;
|
|
addEventPoolingTo(Class);
|
|
return Class;
|
|
};
|
|
addEventPoolingTo(SyntheticEvent);
|
|
function createOrGetPooledEvent(
|
|
dispatchConfig,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeInst
|
|
) {
|
|
if (this.eventPool.length) {
|
|
var instance = this.eventPool.pop();
|
|
this.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
|
|
return instance;
|
|
}
|
|
return new this(dispatchConfig, targetInst, nativeEvent, nativeInst);
|
|
}
|
|
function releasePooledEvent(event) {
|
|
if (!(event instanceof this))
|
|
throw Error(
|
|
"Trying to release an event instance into a pool of a different type."
|
|
);
|
|
event.destructor();
|
|
10 > this.eventPool.length && this.eventPool.push(event);
|
|
}
|
|
function addEventPoolingTo(EventConstructor) {
|
|
EventConstructor.getPooled = createOrGetPooledEvent;
|
|
EventConstructor.eventPool = [];
|
|
EventConstructor.release = releasePooledEvent;
|
|
}
|
|
var ResponderSyntheticEvent = SyntheticEvent.extend({
|
|
touchHistory: function() {
|
|
return null;
|
|
}
|
|
});
|
|
function isStartish(topLevelType) {
|
|
return "topTouchStart" === topLevelType;
|
|
}
|
|
function isMoveish(topLevelType) {
|
|
return "topTouchMove" === topLevelType;
|
|
}
|
|
var startDependencies = ["topTouchStart"],
|
|
moveDependencies = ["topTouchMove"],
|
|
endDependencies = ["topTouchCancel", "topTouchEnd"],
|
|
touchBank = [],
|
|
touchHistory = {
|
|
touchBank: touchBank,
|
|
numberActiveTouches: 0,
|
|
indexOfSingleActiveTouch: -1,
|
|
mostRecentTimeStamp: 0
|
|
};
|
|
function timestampForTouch(touch) {
|
|
return touch.timeStamp || touch.timestamp;
|
|
}
|
|
function getTouchIdentifier(_ref) {
|
|
_ref = _ref.identifier;
|
|
if (null == _ref) throw Error("Touch object is missing identifier.");
|
|
return _ref;
|
|
}
|
|
function recordTouchStart(touch) {
|
|
var identifier = getTouchIdentifier(touch),
|
|
touchRecord = touchBank[identifier];
|
|
touchRecord
|
|
? ((touchRecord.touchActive = !0),
|
|
(touchRecord.startPageX = touch.pageX),
|
|
(touchRecord.startPageY = touch.pageY),
|
|
(touchRecord.startTimeStamp = timestampForTouch(touch)),
|
|
(touchRecord.currentPageX = touch.pageX),
|
|
(touchRecord.currentPageY = touch.pageY),
|
|
(touchRecord.currentTimeStamp = timestampForTouch(touch)),
|
|
(touchRecord.previousPageX = touch.pageX),
|
|
(touchRecord.previousPageY = touch.pageY),
|
|
(touchRecord.previousTimeStamp = timestampForTouch(touch)))
|
|
: ((touchRecord = {
|
|
touchActive: !0,
|
|
startPageX: touch.pageX,
|
|
startPageY: touch.pageY,
|
|
startTimeStamp: timestampForTouch(touch),
|
|
currentPageX: touch.pageX,
|
|
currentPageY: touch.pageY,
|
|
currentTimeStamp: timestampForTouch(touch),
|
|
previousPageX: touch.pageX,
|
|
previousPageY: touch.pageY,
|
|
previousTimeStamp: timestampForTouch(touch)
|
|
}),
|
|
(touchBank[identifier] = touchRecord));
|
|
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
}
|
|
function recordTouchMove(touch) {
|
|
var touchRecord = touchBank[getTouchIdentifier(touch)];
|
|
touchRecord &&
|
|
((touchRecord.touchActive = !0),
|
|
(touchRecord.previousPageX = touchRecord.currentPageX),
|
|
(touchRecord.previousPageY = touchRecord.currentPageY),
|
|
(touchRecord.previousTimeStamp = touchRecord.currentTimeStamp),
|
|
(touchRecord.currentPageX = touch.pageX),
|
|
(touchRecord.currentPageY = touch.pageY),
|
|
(touchRecord.currentTimeStamp = timestampForTouch(touch)),
|
|
(touchHistory.mostRecentTimeStamp = timestampForTouch(touch)));
|
|
}
|
|
function recordTouchEnd(touch) {
|
|
var touchRecord = touchBank[getTouchIdentifier(touch)];
|
|
touchRecord &&
|
|
((touchRecord.touchActive = !1),
|
|
(touchRecord.previousPageX = touchRecord.currentPageX),
|
|
(touchRecord.previousPageY = touchRecord.currentPageY),
|
|
(touchRecord.previousTimeStamp = touchRecord.currentTimeStamp),
|
|
(touchRecord.currentPageX = touch.pageX),
|
|
(touchRecord.currentPageY = touch.pageY),
|
|
(touchRecord.currentTimeStamp = timestampForTouch(touch)),
|
|
(touchHistory.mostRecentTimeStamp = timestampForTouch(touch)));
|
|
}
|
|
var instrumentationCallback,
|
|
ResponderTouchHistoryStore = {
|
|
instrument: function(callback) {
|
|
instrumentationCallback = callback;
|
|
},
|
|
recordTouchTrack: function(topLevelType, nativeEvent) {
|
|
null != instrumentationCallback &&
|
|
instrumentationCallback(topLevelType, nativeEvent);
|
|
if (isMoveish(topLevelType))
|
|
nativeEvent.changedTouches.forEach(recordTouchMove);
|
|
else if (isStartish(topLevelType))
|
|
nativeEvent.changedTouches.forEach(recordTouchStart),
|
|
(touchHistory.numberActiveTouches = nativeEvent.touches.length),
|
|
1 === touchHistory.numberActiveTouches &&
|
|
(touchHistory.indexOfSingleActiveTouch =
|
|
nativeEvent.touches[0].identifier);
|
|
else if (
|
|
"topTouchEnd" === topLevelType ||
|
|
"topTouchCancel" === topLevelType
|
|
)
|
|
if (
|
|
(nativeEvent.changedTouches.forEach(recordTouchEnd),
|
|
(touchHistory.numberActiveTouches = nativeEvent.touches.length),
|
|
1 === touchHistory.numberActiveTouches)
|
|
)
|
|
for (
|
|
topLevelType = 0;
|
|
topLevelType < touchBank.length;
|
|
topLevelType++
|
|
)
|
|
if (
|
|
((nativeEvent = touchBank[topLevelType]),
|
|
null != nativeEvent && nativeEvent.touchActive)
|
|
) {
|
|
touchHistory.indexOfSingleActiveTouch = topLevelType;
|
|
break;
|
|
}
|
|
},
|
|
touchHistory: touchHistory
|
|
};
|
|
function accumulate(current, next) {
|
|
if (null == next)
|
|
throw Error(
|
|
"accumulate(...): Accumulated items must not be null or undefined."
|
|
);
|
|
return null == current
|
|
? next
|
|
: isArrayImpl(current)
|
|
? current.concat(next)
|
|
: isArrayImpl(next)
|
|
? [current].concat(next)
|
|
: [current, next];
|
|
}
|
|
function accumulateInto(current, next) {
|
|
if (null == next)
|
|
throw Error(
|
|
"accumulateInto(...): Accumulated items must not be null or undefined."
|
|
);
|
|
if (null == current) return next;
|
|
if (isArrayImpl(current)) {
|
|
if (isArrayImpl(next)) return current.push.apply(current, next), current;
|
|
current.push(next);
|
|
return current;
|
|
}
|
|
return isArrayImpl(next) ? [current].concat(next) : [current, next];
|
|
}
|
|
function forEachAccumulated(arr, cb, scope) {
|
|
Array.isArray(arr) ? arr.forEach(cb, scope) : arr && cb.call(scope, arr);
|
|
}
|
|
var responderInst = null,
|
|
trackedTouchCount = 0;
|
|
function changeResponder(nextResponderInst, blockHostResponder) {
|
|
var oldResponderInst = responderInst;
|
|
responderInst = nextResponderInst;
|
|
if (null !== ResponderEventPlugin.GlobalResponderHandler)
|
|
ResponderEventPlugin.GlobalResponderHandler.onChange(
|
|
oldResponderInst,
|
|
nextResponderInst,
|
|
blockHostResponder
|
|
);
|
|
}
|
|
var eventTypes = {
|
|
startShouldSetResponder: {
|
|
phasedRegistrationNames: {
|
|
bubbled: "onStartShouldSetResponder",
|
|
captured: "onStartShouldSetResponderCapture"
|
|
},
|
|
dependencies: startDependencies
|
|
},
|
|
scrollShouldSetResponder: {
|
|
phasedRegistrationNames: {
|
|
bubbled: "onScrollShouldSetResponder",
|
|
captured: "onScrollShouldSetResponderCapture"
|
|
},
|
|
dependencies: ["topScroll"]
|
|
},
|
|
selectionChangeShouldSetResponder: {
|
|
phasedRegistrationNames: {
|
|
bubbled: "onSelectionChangeShouldSetResponder",
|
|
captured: "onSelectionChangeShouldSetResponderCapture"
|
|
},
|
|
dependencies: ["topSelectionChange"]
|
|
},
|
|
moveShouldSetResponder: {
|
|
phasedRegistrationNames: {
|
|
bubbled: "onMoveShouldSetResponder",
|
|
captured: "onMoveShouldSetResponderCapture"
|
|
},
|
|
dependencies: moveDependencies
|
|
},
|
|
responderStart: {
|
|
registrationName: "onResponderStart",
|
|
dependencies: startDependencies
|
|
},
|
|
responderMove: {
|
|
registrationName: "onResponderMove",
|
|
dependencies: moveDependencies
|
|
},
|
|
responderEnd: {
|
|
registrationName: "onResponderEnd",
|
|
dependencies: endDependencies
|
|
},
|
|
responderRelease: {
|
|
registrationName: "onResponderRelease",
|
|
dependencies: endDependencies
|
|
},
|
|
responderTerminationRequest: {
|
|
registrationName: "onResponderTerminationRequest",
|
|
dependencies: []
|
|
},
|
|
responderGrant: { registrationName: "onResponderGrant", dependencies: [] },
|
|
responderReject: { registrationName: "onResponderReject", dependencies: [] },
|
|
responderTerminate: {
|
|
registrationName: "onResponderTerminate",
|
|
dependencies: []
|
|
}
|
|
};
|
|
function getParent(inst) {
|
|
do inst = inst.return;
|
|
while (inst && 5 !== inst.tag);
|
|
return inst ? inst : null;
|
|
}
|
|
function traverseTwoPhase(inst, fn, arg) {
|
|
for (var path = []; inst; ) path.push(inst), (inst = getParent(inst));
|
|
for (inst = path.length; 0 < inst--; ) fn(path[inst], "captured", arg);
|
|
for (inst = 0; inst < path.length; inst++) fn(path[inst], "bubbled", arg);
|
|
}
|
|
function getListener(inst, registrationName) {
|
|
inst = inst.stateNode;
|
|
if (null === inst) return null;
|
|
inst = getFiberCurrentPropsFromNode(inst);
|
|
if (null === inst) return null;
|
|
if ((inst = inst[registrationName]) && "function" !== typeof inst)
|
|
throw Error(
|
|
"Expected `" +
|
|
registrationName +
|
|
"` listener to be a function, instead got a value of `" +
|
|
typeof inst +
|
|
"` type."
|
|
);
|
|
return inst;
|
|
}
|
|
function accumulateDirectionalDispatches(inst, phase, event) {
|
|
if (
|
|
(phase = getListener(
|
|
inst,
|
|
event.dispatchConfig.phasedRegistrationNames[phase]
|
|
))
|
|
)
|
|
(event._dispatchListeners = accumulateInto(
|
|
event._dispatchListeners,
|
|
phase
|
|
)),
|
|
(event._dispatchInstances = accumulateInto(
|
|
event._dispatchInstances,
|
|
inst
|
|
));
|
|
}
|
|
function accumulateDirectDispatchesSingle(event) {
|
|
if (event && event.dispatchConfig.registrationName) {
|
|
var inst = event._targetInst;
|
|
if (inst && event && event.dispatchConfig.registrationName) {
|
|
var listener = getListener(inst, event.dispatchConfig.registrationName);
|
|
listener &&
|
|
((event._dispatchListeners = accumulateInto(
|
|
event._dispatchListeners,
|
|
listener
|
|
)),
|
|
(event._dispatchInstances = accumulateInto(
|
|
event._dispatchInstances,
|
|
inst
|
|
)));
|
|
}
|
|
}
|
|
}
|
|
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
|
|
if (event && event.dispatchConfig.phasedRegistrationNames) {
|
|
var targetInst = event._targetInst;
|
|
targetInst = targetInst ? getParent(targetInst) : null;
|
|
traverseTwoPhase(targetInst, accumulateDirectionalDispatches, event);
|
|
}
|
|
}
|
|
function accumulateTwoPhaseDispatchesSingle(event) {
|
|
event &&
|
|
event.dispatchConfig.phasedRegistrationNames &&
|
|
traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
|
|
}
|
|
var ResponderEventPlugin = {
|
|
_getResponder: function() {
|
|
return responderInst;
|
|
},
|
|
eventTypes: eventTypes,
|
|
extractEvents: function(
|
|
topLevelType,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
) {
|
|
if (isStartish(topLevelType)) trackedTouchCount += 1;
|
|
else if (
|
|
"topTouchEnd" === topLevelType ||
|
|
"topTouchCancel" === topLevelType
|
|
)
|
|
if (0 <= trackedTouchCount) --trackedTouchCount;
|
|
else return null;
|
|
ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent);
|
|
if (
|
|
targetInst &&
|
|
(("topScroll" === topLevelType && !nativeEvent.responderIgnoreScroll) ||
|
|
(0 < trackedTouchCount && "topSelectionChange" === topLevelType) ||
|
|
isStartish(topLevelType) ||
|
|
isMoveish(topLevelType))
|
|
) {
|
|
var shouldSetEventType = isStartish(topLevelType)
|
|
? eventTypes.startShouldSetResponder
|
|
: isMoveish(topLevelType)
|
|
? eventTypes.moveShouldSetResponder
|
|
: "topSelectionChange" === topLevelType
|
|
? eventTypes.selectionChangeShouldSetResponder
|
|
: eventTypes.scrollShouldSetResponder;
|
|
if (responderInst)
|
|
b: {
|
|
var JSCompiler_temp = responderInst;
|
|
for (
|
|
var depthA = 0, tempA = JSCompiler_temp;
|
|
tempA;
|
|
tempA = getParent(tempA)
|
|
)
|
|
depthA++;
|
|
tempA = 0;
|
|
for (var tempB = targetInst; tempB; tempB = getParent(tempB))
|
|
tempA++;
|
|
for (; 0 < depthA - tempA; )
|
|
(JSCompiler_temp = getParent(JSCompiler_temp)), depthA--;
|
|
for (; 0 < tempA - depthA; )
|
|
(targetInst = getParent(targetInst)), tempA--;
|
|
for (; depthA--; ) {
|
|
if (
|
|
JSCompiler_temp === targetInst ||
|
|
JSCompiler_temp === targetInst.alternate
|
|
)
|
|
break b;
|
|
JSCompiler_temp = getParent(JSCompiler_temp);
|
|
targetInst = getParent(targetInst);
|
|
}
|
|
JSCompiler_temp = null;
|
|
}
|
|
else JSCompiler_temp = targetInst;
|
|
targetInst = JSCompiler_temp;
|
|
JSCompiler_temp = targetInst === responderInst;
|
|
shouldSetEventType = ResponderSyntheticEvent.getPooled(
|
|
shouldSetEventType,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
);
|
|
shouldSetEventType.touchHistory =
|
|
ResponderTouchHistoryStore.touchHistory;
|
|
JSCompiler_temp
|
|
? forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateTwoPhaseDispatchesSingleSkipTarget
|
|
)
|
|
: forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateTwoPhaseDispatchesSingle
|
|
);
|
|
b: {
|
|
JSCompiler_temp = shouldSetEventType._dispatchListeners;
|
|
targetInst = shouldSetEventType._dispatchInstances;
|
|
if (isArrayImpl(JSCompiler_temp))
|
|
for (
|
|
depthA = 0;
|
|
depthA < JSCompiler_temp.length &&
|
|
!shouldSetEventType.isPropagationStopped();
|
|
depthA++
|
|
) {
|
|
if (
|
|
JSCompiler_temp[depthA](shouldSetEventType, targetInst[depthA])
|
|
) {
|
|
JSCompiler_temp = targetInst[depthA];
|
|
break b;
|
|
}
|
|
}
|
|
else if (
|
|
JSCompiler_temp &&
|
|
JSCompiler_temp(shouldSetEventType, targetInst)
|
|
) {
|
|
JSCompiler_temp = targetInst;
|
|
break b;
|
|
}
|
|
JSCompiler_temp = null;
|
|
}
|
|
shouldSetEventType._dispatchInstances = null;
|
|
shouldSetEventType._dispatchListeners = null;
|
|
shouldSetEventType.isPersistent() ||
|
|
shouldSetEventType.constructor.release(shouldSetEventType);
|
|
if (JSCompiler_temp && JSCompiler_temp !== responderInst)
|
|
if (
|
|
((shouldSetEventType = ResponderSyntheticEvent.getPooled(
|
|
eventTypes.responderGrant,
|
|
JSCompiler_temp,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(shouldSetEventType.touchHistory =
|
|
ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateDirectDispatchesSingle
|
|
),
|
|
(targetInst = !0 === executeDirectDispatch(shouldSetEventType)),
|
|
responderInst)
|
|
)
|
|
if (
|
|
((depthA = ResponderSyntheticEvent.getPooled(
|
|
eventTypes.responderTerminationRequest,
|
|
responderInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(depthA.touchHistory = ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(depthA, accumulateDirectDispatchesSingle),
|
|
(tempA =
|
|
!depthA._dispatchListeners || executeDirectDispatch(depthA)),
|
|
depthA.isPersistent() || depthA.constructor.release(depthA),
|
|
tempA)
|
|
) {
|
|
depthA = ResponderSyntheticEvent.getPooled(
|
|
eventTypes.responderTerminate,
|
|
responderInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
);
|
|
depthA.touchHistory = ResponderTouchHistoryStore.touchHistory;
|
|
forEachAccumulated(depthA, accumulateDirectDispatchesSingle);
|
|
var JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
[shouldSetEventType, depthA]
|
|
);
|
|
changeResponder(JSCompiler_temp, targetInst);
|
|
} else
|
|
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
|
|
eventTypes.responderReject,
|
|
JSCompiler_temp,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(shouldSetEventType.touchHistory =
|
|
ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateDirectDispatchesSingle
|
|
),
|
|
(JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
shouldSetEventType
|
|
));
|
|
else
|
|
(JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
shouldSetEventType
|
|
)),
|
|
changeResponder(JSCompiler_temp, targetInst);
|
|
else JSCompiler_temp$jscomp$0 = null;
|
|
} else JSCompiler_temp$jscomp$0 = null;
|
|
shouldSetEventType = responderInst && isStartish(topLevelType);
|
|
JSCompiler_temp = responderInst && isMoveish(topLevelType);
|
|
targetInst =
|
|
responderInst &&
|
|
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType);
|
|
if (
|
|
(shouldSetEventType = shouldSetEventType
|
|
? eventTypes.responderStart
|
|
: JSCompiler_temp
|
|
? eventTypes.responderMove
|
|
: targetInst
|
|
? eventTypes.responderEnd
|
|
: null)
|
|
)
|
|
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
|
|
shouldSetEventType,
|
|
responderInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(shouldSetEventType.touchHistory =
|
|
ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateDirectDispatchesSingle
|
|
),
|
|
(JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
shouldSetEventType
|
|
));
|
|
shouldSetEventType = responderInst && "topTouchCancel" === topLevelType;
|
|
if (
|
|
(topLevelType =
|
|
responderInst &&
|
|
!shouldSetEventType &&
|
|
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType))
|
|
)
|
|
a: {
|
|
if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length)
|
|
for (
|
|
JSCompiler_temp = 0;
|
|
JSCompiler_temp < topLevelType.length;
|
|
JSCompiler_temp++
|
|
)
|
|
if (
|
|
((targetInst = topLevelType[JSCompiler_temp].target),
|
|
null !== targetInst &&
|
|
void 0 !== targetInst &&
|
|
0 !== targetInst)
|
|
) {
|
|
depthA = getInstanceFromNode(targetInst);
|
|
b: {
|
|
for (targetInst = responderInst; depthA; ) {
|
|
if (
|
|
targetInst === depthA ||
|
|
targetInst === depthA.alternate
|
|
) {
|
|
targetInst = !0;
|
|
break b;
|
|
}
|
|
depthA = getParent(depthA);
|
|
}
|
|
targetInst = !1;
|
|
}
|
|
if (targetInst) {
|
|
topLevelType = !1;
|
|
break a;
|
|
}
|
|
}
|
|
topLevelType = !0;
|
|
}
|
|
if (
|
|
(topLevelType = shouldSetEventType
|
|
? eventTypes.responderTerminate
|
|
: topLevelType
|
|
? eventTypes.responderRelease
|
|
: null)
|
|
)
|
|
(nativeEvent = ResponderSyntheticEvent.getPooled(
|
|
topLevelType,
|
|
responderInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(nativeEvent.touchHistory = ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle),
|
|
(JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
nativeEvent
|
|
)),
|
|
changeResponder(null);
|
|
return JSCompiler_temp$jscomp$0;
|
|
},
|
|
GlobalResponderHandler: null,
|
|
injection: {
|
|
injectGlobalResponderHandler: function(GlobalResponderHandler) {
|
|
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
|
|
}
|
|
}
|
|
},
|
|
eventPluginOrder = null,
|
|
namesToPlugins = {};
|
|
function recomputePluginOrdering() {
|
|
if (eventPluginOrder)
|
|
for (var pluginName in namesToPlugins) {
|
|
var pluginModule = namesToPlugins[pluginName],
|
|
pluginIndex = eventPluginOrder.indexOf(pluginName);
|
|
if (-1 >= pluginIndex)
|
|
throw Error(
|
|
"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" +
|
|
(pluginName + "`.")
|
|
);
|
|
if (!plugins[pluginIndex]) {
|
|
if (!pluginModule.extractEvents)
|
|
throw Error(
|
|
"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" +
|
|
(pluginName + "` does not.")
|
|
);
|
|
plugins[pluginIndex] = pluginModule;
|
|
pluginIndex = pluginModule.eventTypes;
|
|
for (var eventName in pluginIndex) {
|
|
var JSCompiler_inline_result = void 0;
|
|
var dispatchConfig = pluginIndex[eventName],
|
|
eventName$jscomp$0 = eventName;
|
|
if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0))
|
|
throw Error(
|
|
"EventPluginRegistry: More than one plugin attempted to publish the same event name, `" +
|
|
(eventName$jscomp$0 + "`.")
|
|
);
|
|
eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig;
|
|
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
|
|
if (phasedRegistrationNames) {
|
|
for (JSCompiler_inline_result in phasedRegistrationNames)
|
|
phasedRegistrationNames.hasOwnProperty(
|
|
JSCompiler_inline_result
|
|
) &&
|
|
publishRegistrationName(
|
|
phasedRegistrationNames[JSCompiler_inline_result],
|
|
pluginModule,
|
|
eventName$jscomp$0
|
|
);
|
|
JSCompiler_inline_result = !0;
|
|
} else
|
|
dispatchConfig.registrationName
|
|
? (publishRegistrationName(
|
|
dispatchConfig.registrationName,
|
|
pluginModule,
|
|
eventName$jscomp$0
|
|
),
|
|
(JSCompiler_inline_result = !0))
|
|
: (JSCompiler_inline_result = !1);
|
|
if (!JSCompiler_inline_result)
|
|
throw Error(
|
|
"EventPluginRegistry: Failed to publish event `" +
|
|
eventName +
|
|
"` for plugin `" +
|
|
pluginName +
|
|
"`."
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function publishRegistrationName(registrationName, pluginModule) {
|
|
if (registrationNameModules[registrationName])
|
|
throw Error(
|
|
"EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" +
|
|
(registrationName + "`.")
|
|
);
|
|
registrationNameModules[registrationName] = pluginModule;
|
|
}
|
|
var plugins = [],
|
|
eventNameDispatchConfigs = {},
|
|
registrationNameModules = {};
|
|
function getListeners(
|
|
inst,
|
|
registrationName,
|
|
phase,
|
|
dispatchToImperativeListeners
|
|
) {
|
|
var stateNode = inst.stateNode;
|
|
if (null === stateNode) return null;
|
|
inst = getFiberCurrentPropsFromNode(stateNode);
|
|
if (null === inst) return null;
|
|
if ((inst = inst[registrationName]) && "function" !== typeof inst)
|
|
throw Error(
|
|
"Expected `" +
|
|
registrationName +
|
|
"` listener to be a function, instead got a value of `" +
|
|
typeof inst +
|
|
"` type."
|
|
);
|
|
if (
|
|
!(
|
|
dispatchToImperativeListeners &&
|
|
stateNode.canonical &&
|
|
stateNode.canonical._eventListeners
|
|
)
|
|
)
|
|
return inst;
|
|
var listeners = [];
|
|
inst && listeners.push(inst);
|
|
var requestedPhaseIsCapture = "captured" === phase,
|
|
mangledImperativeRegistrationName = requestedPhaseIsCapture
|
|
? "rn:" + registrationName.replace(/Capture$/, "")
|
|
: "rn:" + registrationName;
|
|
stateNode.canonical._eventListeners[mangledImperativeRegistrationName] &&
|
|
0 <
|
|
stateNode.canonical._eventListeners[mangledImperativeRegistrationName]
|
|
.length &&
|
|
stateNode.canonical._eventListeners[
|
|
mangledImperativeRegistrationName
|
|
].forEach(function(listenerObj) {
|
|
if (
|
|
(null != listenerObj.options.capture && listenerObj.options.capture) ===
|
|
requestedPhaseIsCapture
|
|
) {
|
|
var listenerFnWrapper = function(syntheticEvent) {
|
|
var eventInst = new ReactNativePrivateInterface.CustomEvent(
|
|
mangledImperativeRegistrationName,
|
|
{ detail: syntheticEvent.nativeEvent }
|
|
);
|
|
eventInst.isTrusted = !0;
|
|
eventInst.setSyntheticEvent(syntheticEvent);
|
|
for (
|
|
var _len = arguments.length,
|
|
args = Array(1 < _len ? _len - 1 : 0),
|
|
_key = 1;
|
|
_key < _len;
|
|
_key++
|
|
)
|
|
args[_key - 1] = arguments[_key];
|
|
listenerObj.listener.apply(listenerObj, [eventInst].concat(args));
|
|
};
|
|
listenerObj.options.once
|
|
? listeners.push(function() {
|
|
stateNode.canonical.removeEventListener_unstable(
|
|
mangledImperativeRegistrationName,
|
|
listenerObj.listener,
|
|
listenerObj.capture
|
|
);
|
|
listenerObj.invalidated ||
|
|
((listenerObj.invalidated = !0),
|
|
listenerObj.listener.apply(listenerObj, arguments));
|
|
})
|
|
: listeners.push(listenerFnWrapper);
|
|
}
|
|
});
|
|
return 0 === listeners.length
|
|
? null
|
|
: 1 === listeners.length
|
|
? listeners[0]
|
|
: listeners;
|
|
}
|
|
var customBubblingEventTypes =
|
|
ReactNativePrivateInterface.ReactNativeViewConfigRegistry
|
|
.customBubblingEventTypes,
|
|
customDirectEventTypes =
|
|
ReactNativePrivateInterface.ReactNativeViewConfigRegistry
|
|
.customDirectEventTypes;
|
|
function accumulateListenersAndInstances(inst, event, listeners) {
|
|
var listenersLength = listeners
|
|
? isArrayImpl(listeners)
|
|
? listeners.length
|
|
: 1
|
|
: 0;
|
|
if (0 < listenersLength)
|
|
if (
|
|
((event._dispatchListeners = accumulateInto(
|
|
event._dispatchListeners,
|
|
listeners
|
|
)),
|
|
null == event._dispatchInstances && 1 === listenersLength)
|
|
)
|
|
event._dispatchInstances = inst;
|
|
else
|
|
for (
|
|
event._dispatchInstances = event._dispatchInstances || [],
|
|
isArrayImpl(event._dispatchInstances) ||
|
|
(event._dispatchInstances = [event._dispatchInstances]),
|
|
listeners = 0;
|
|
listeners < listenersLength;
|
|
listeners++
|
|
)
|
|
event._dispatchInstances.push(inst);
|
|
}
|
|
function accumulateDirectionalDispatches$1(inst, phase, event) {
|
|
phase = getListeners(
|
|
inst,
|
|
event.dispatchConfig.phasedRegistrationNames[phase],
|
|
phase,
|
|
!0
|
|
);
|
|
accumulateListenersAndInstances(inst, event, phase);
|
|
}
|
|
function traverseTwoPhase$1(inst, fn, arg, skipBubbling) {
|
|
for (var path = []; inst; ) {
|
|
path.push(inst);
|
|
do inst = inst.return;
|
|
while (inst && 5 !== inst.tag);
|
|
inst = inst ? inst : null;
|
|
}
|
|
for (inst = path.length; 0 < inst--; ) fn(path[inst], "captured", arg);
|
|
if (skipBubbling) fn(path[0], "bubbled", arg);
|
|
else
|
|
for (inst = 0; inst < path.length; inst++) fn(path[inst], "bubbled", arg);
|
|
}
|
|
function accumulateTwoPhaseDispatchesSingle$1(event) {
|
|
event &&
|
|
event.dispatchConfig.phasedRegistrationNames &&
|
|
traverseTwoPhase$1(
|
|
event._targetInst,
|
|
accumulateDirectionalDispatches$1,
|
|
event,
|
|
!1
|
|
);
|
|
}
|
|
function accumulateDirectDispatchesSingle$1(event) {
|
|
if (event && event.dispatchConfig.registrationName) {
|
|
var inst = event._targetInst;
|
|
if (inst && event && event.dispatchConfig.registrationName) {
|
|
var listeners = getListeners(
|
|
inst,
|
|
event.dispatchConfig.registrationName,
|
|
"bubbled",
|
|
!1
|
|
);
|
|
accumulateListenersAndInstances(inst, event, listeners);
|
|
}
|
|
}
|
|
}
|
|
if (eventPluginOrder)
|
|
throw Error(
|
|
"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."
|
|
);
|
|
eventPluginOrder = Array.prototype.slice.call([
|
|
"ResponderEventPlugin",
|
|
"ReactNativeBridgeEventPlugin"
|
|
]);
|
|
recomputePluginOrdering();
|
|
var injectedNamesToPlugins$jscomp$inline_240 = {
|
|
ResponderEventPlugin: ResponderEventPlugin,
|
|
ReactNativeBridgeEventPlugin: {
|
|
eventTypes: {},
|
|
extractEvents: function(
|
|
topLevelType,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
) {
|
|
if (null == targetInst) return null;
|
|
var bubbleDispatchConfig = customBubblingEventTypes[topLevelType],
|
|
directDispatchConfig = customDirectEventTypes[topLevelType];
|
|
if (!bubbleDispatchConfig && !directDispatchConfig)
|
|
throw Error(
|
|
'Unsupported top level event type "' + topLevelType + '" dispatched'
|
|
);
|
|
topLevelType = SyntheticEvent.getPooled(
|
|
bubbleDispatchConfig || directDispatchConfig,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
);
|
|
if (bubbleDispatchConfig)
|
|
null != topLevelType &&
|
|
null != topLevelType.dispatchConfig.phasedRegistrationNames &&
|
|
topLevelType.dispatchConfig.phasedRegistrationNames.skipBubbling
|
|
? topLevelType &&
|
|
topLevelType.dispatchConfig.phasedRegistrationNames &&
|
|
traverseTwoPhase$1(
|
|
topLevelType._targetInst,
|
|
accumulateDirectionalDispatches$1,
|
|
topLevelType,
|
|
!0
|
|
)
|
|
: forEachAccumulated(
|
|
topLevelType,
|
|
accumulateTwoPhaseDispatchesSingle$1
|
|
);
|
|
else if (directDispatchConfig)
|
|
forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle$1);
|
|
else return null;
|
|
return topLevelType;
|
|
}
|
|
}
|
|
},
|
|
isOrderingDirty$jscomp$inline_241 = !1,
|
|
pluginName$jscomp$inline_242;
|
|
for (pluginName$jscomp$inline_242 in injectedNamesToPlugins$jscomp$inline_240)
|
|
if (
|
|
injectedNamesToPlugins$jscomp$inline_240.hasOwnProperty(
|
|
pluginName$jscomp$inline_242
|
|
)
|
|
) {
|
|
var pluginModule$jscomp$inline_243 =
|
|
injectedNamesToPlugins$jscomp$inline_240[pluginName$jscomp$inline_242];
|
|
if (
|
|
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_242) ||
|
|
namesToPlugins[pluginName$jscomp$inline_242] !==
|
|
pluginModule$jscomp$inline_243
|
|
) {
|
|
if (namesToPlugins[pluginName$jscomp$inline_242])
|
|
throw Error(
|
|
"EventPluginRegistry: Cannot inject two different event plugins using the same name, `" +
|
|
(pluginName$jscomp$inline_242 + "`.")
|
|
);
|
|
namesToPlugins[
|
|
pluginName$jscomp$inline_242
|
|
] = pluginModule$jscomp$inline_243;
|
|
isOrderingDirty$jscomp$inline_241 = !0;
|
|
}
|
|
}
|
|
isOrderingDirty$jscomp$inline_241 && recomputePluginOrdering();
|
|
var instanceCache = new Map(),
|
|
instanceProps = new Map();
|
|
function getInstanceFromTag(tag) {
|
|
return instanceCache.get(tag) || null;
|
|
}
|
|
function batchedUpdatesImpl(fn, bookkeeping) {
|
|
return fn(bookkeeping);
|
|
}
|
|
var isInsideEventHandler = !1;
|
|
function batchedUpdates(fn, bookkeeping) {
|
|
if (isInsideEventHandler) return fn(bookkeeping);
|
|
isInsideEventHandler = !0;
|
|
try {
|
|
return batchedUpdatesImpl(fn, bookkeeping);
|
|
} finally {
|
|
isInsideEventHandler = !1;
|
|
}
|
|
}
|
|
var eventQueue = null;
|
|
function executeDispatchesAndReleaseTopLevel(e) {
|
|
if (e) {
|
|
var dispatchListeners = e._dispatchListeners,
|
|
dispatchInstances = e._dispatchInstances;
|
|
if (isArrayImpl(dispatchListeners))
|
|
for (
|
|
var i = 0;
|
|
i < dispatchListeners.length && !e.isPropagationStopped();
|
|
i++
|
|
)
|
|
executeDispatch(e, dispatchListeners[i], dispatchInstances[i]);
|
|
else
|
|
dispatchListeners &&
|
|
executeDispatch(e, dispatchListeners, dispatchInstances);
|
|
e._dispatchListeners = null;
|
|
e._dispatchInstances = null;
|
|
e.isPersistent() || e.constructor.release(e);
|
|
}
|
|
}
|
|
var EMPTY_NATIVE_EVENT = {};
|
|
function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) {
|
|
var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT,
|
|
inst = getInstanceFromTag(rootNodeID),
|
|
target = null;
|
|
null != inst && (target = inst.stateNode);
|
|
batchedUpdates(function() {
|
|
var JSCompiler_inline_result = target;
|
|
for (
|
|
var events = null, legacyPlugins = plugins, i = 0;
|
|
i < legacyPlugins.length;
|
|
i++
|
|
) {
|
|
var possiblePlugin = legacyPlugins[i];
|
|
possiblePlugin &&
|
|
(possiblePlugin = possiblePlugin.extractEvents(
|
|
topLevelType,
|
|
inst,
|
|
nativeEvent,
|
|
JSCompiler_inline_result
|
|
)) &&
|
|
(events = accumulateInto(events, possiblePlugin));
|
|
}
|
|
JSCompiler_inline_result = events;
|
|
null !== JSCompiler_inline_result &&
|
|
(eventQueue = accumulateInto(eventQueue, JSCompiler_inline_result));
|
|
JSCompiler_inline_result = eventQueue;
|
|
eventQueue = null;
|
|
if (JSCompiler_inline_result) {
|
|
forEachAccumulated(
|
|
JSCompiler_inline_result,
|
|
executeDispatchesAndReleaseTopLevel
|
|
);
|
|
if (eventQueue)
|
|
throw Error(
|
|
"processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented."
|
|
);
|
|
if (hasRethrowError)
|
|
throw ((JSCompiler_inline_result = rethrowError),
|
|
(hasRethrowError = !1),
|
|
(rethrowError = null),
|
|
JSCompiler_inline_result);
|
|
}
|
|
});
|
|
}
|
|
ReactNativePrivateInterface.RCTEventEmitter.register({
|
|
receiveEvent: function(rootNodeID, topLevelType, nativeEventParam) {
|
|
_receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam);
|
|
},
|
|
receiveTouches: function(eventTopLevelType, touches, changedIndices) {
|
|
if (
|
|
"topTouchEnd" === eventTopLevelType ||
|
|
"topTouchCancel" === eventTopLevelType
|
|
) {
|
|
var JSCompiler_temp = [];
|
|
for (var i = 0; i < changedIndices.length; i++) {
|
|
var index$0 = changedIndices[i];
|
|
JSCompiler_temp.push(touches[index$0]);
|
|
touches[index$0] = null;
|
|
}
|
|
for (i = changedIndices = 0; i < touches.length; i++)
|
|
(index$0 = touches[i]),
|
|
null !== index$0 && (touches[changedIndices++] = index$0);
|
|
touches.length = changedIndices;
|
|
} else
|
|
for (JSCompiler_temp = [], i = 0; i < changedIndices.length; i++)
|
|
JSCompiler_temp.push(touches[changedIndices[i]]);
|
|
for (
|
|
changedIndices = 0;
|
|
changedIndices < JSCompiler_temp.length;
|
|
changedIndices++
|
|
) {
|
|
i = JSCompiler_temp[changedIndices];
|
|
i.changedTouches = JSCompiler_temp;
|
|
i.touches = touches;
|
|
index$0 = null;
|
|
var target = i.target;
|
|
null === target || void 0 === target || 1 > target || (index$0 = target);
|
|
_receiveRootNodeIDEvent(index$0, eventTopLevelType, i);
|
|
}
|
|
}
|
|
});
|
|
getFiberCurrentPropsFromNode = function(stateNode) {
|
|
return instanceProps.get(stateNode._nativeTag) || null;
|
|
};
|
|
getInstanceFromNode = getInstanceFromTag;
|
|
getNodeFromInstance = function(inst) {
|
|
inst = inst.stateNode;
|
|
var tag = inst._nativeTag;
|
|
void 0 === tag && ((inst = inst.canonical), (tag = inst._nativeTag));
|
|
if (!tag) throw Error("All native instances should have a tag.");
|
|
return inst;
|
|
};
|
|
ResponderEventPlugin.injection.injectGlobalResponderHandler({
|
|
onChange: function(from, to, blockNativeResponder) {
|
|
null !== to
|
|
? ReactNativePrivateInterface.UIManager.setJSResponder(
|
|
to.stateNode._nativeTag,
|
|
blockNativeResponder
|
|
)
|
|
: ReactNativePrivateInterface.UIManager.clearJSResponder();
|
|
}
|
|
});
|
|
var ReactSharedInternals =
|
|
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
REACT_ELEMENT_TYPE = Symbol.for("react.element"),
|
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
REACT_PROVIDER_TYPE = Symbol.for("react.provider"),
|
|
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
Symbol.for("react.scope");
|
|
Symbol.for("react.debug_trace_mode");
|
|
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
Symbol.for("react.legacy_hidden");
|
|
Symbol.for("react.cache");
|
|
Symbol.for("react.tracing_marker");
|
|
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
function getIteratorFn(maybeIterable) {
|
|
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
|
|
maybeIterable =
|
|
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
|
|
maybeIterable["@@iterator"];
|
|
return "function" === typeof maybeIterable ? maybeIterable : null;
|
|
}
|
|
function getComponentNameFromType(type) {
|
|
if (null == type) return null;
|
|
if ("function" === typeof type) return type.displayName || type.name || null;
|
|
if ("string" === typeof type) return type;
|
|
switch (type) {
|
|
case REACT_FRAGMENT_TYPE:
|
|
return "Fragment";
|
|
case REACT_PORTAL_TYPE:
|
|
return "Portal";
|
|
case REACT_PROFILER_TYPE:
|
|
return "Profiler";
|
|
case REACT_STRICT_MODE_TYPE:
|
|
return "StrictMode";
|
|
case REACT_SUSPENSE_TYPE:
|
|
return "Suspense";
|
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
return "SuspenseList";
|
|
}
|
|
if ("object" === typeof type)
|
|
switch (type.$$typeof) {
|
|
case REACT_CONTEXT_TYPE:
|
|
return (type.displayName || "Context") + ".Consumer";
|
|
case REACT_PROVIDER_TYPE:
|
|
return (type._context.displayName || "Context") + ".Provider";
|
|
case REACT_FORWARD_REF_TYPE:
|
|
var innerType = type.render;
|
|
type = type.displayName;
|
|
type ||
|
|
((type = innerType.displayName || innerType.name || ""),
|
|
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
|
|
return type;
|
|
case REACT_MEMO_TYPE:
|
|
return (
|
|
(innerType = type.displayName || null),
|
|
null !== innerType
|
|
? innerType
|
|
: getComponentNameFromType(type.type) || "Memo"
|
|
);
|
|
case REACT_LAZY_TYPE:
|
|
innerType = type._payload;
|
|
type = type._init;
|
|
try {
|
|
return getComponentNameFromType(type(innerType));
|
|
} catch (x) {}
|
|
}
|
|
return null;
|
|
}
|
|
function getComponentNameFromFiber(fiber) {
|
|
var type = fiber.type;
|
|
switch (fiber.tag) {
|
|
case 24:
|
|
return "Cache";
|
|
case 9:
|
|
return (type.displayName || "Context") + ".Consumer";
|
|
case 10:
|
|
return (type._context.displayName || "Context") + ".Provider";
|
|
case 18:
|
|
return "DehydratedFragment";
|
|
case 11:
|
|
return (
|
|
(fiber = type.render),
|
|
(fiber = fiber.displayName || fiber.name || ""),
|
|
type.displayName ||
|
|
("" !== fiber ? "ForwardRef(" + fiber + ")" : "ForwardRef")
|
|
);
|
|
case 7:
|
|
return "Fragment";
|
|
case 5:
|
|
return type;
|
|
case 4:
|
|
return "Portal";
|
|
case 3:
|
|
return "Root";
|
|
case 6:
|
|
return "Text";
|
|
case 16:
|
|
return getComponentNameFromType(type);
|
|
case 8:
|
|
return type === REACT_STRICT_MODE_TYPE ? "StrictMode" : "Mode";
|
|
case 22:
|
|
return "Offscreen";
|
|
case 12:
|
|
return "Profiler";
|
|
case 21:
|
|
return "Scope";
|
|
case 13:
|
|
return "Suspense";
|
|
case 19:
|
|
return "SuspenseList";
|
|
case 25:
|
|
return "TracingMarker";
|
|
case 1:
|
|
case 0:
|
|
case 17:
|
|
case 2:
|
|
case 14:
|
|
case 15:
|
|
if ("function" === typeof type)
|
|
return type.displayName || type.name || null;
|
|
if ("string" === typeof type) return type;
|
|
}
|
|
return null;
|
|
}
|
|
function getNearestMountedFiber(fiber) {
|
|
var node = fiber,
|
|
nearestMounted = fiber;
|
|
if (fiber.alternate) for (; node.return; ) node = node.return;
|
|
else {
|
|
fiber = node;
|
|
do
|
|
(node = fiber),
|
|
0 !== (node.flags & 4098) && (nearestMounted = node.return),
|
|
(fiber = node.return);
|
|
while (fiber);
|
|
}
|
|
return 3 === node.tag ? nearestMounted : null;
|
|
}
|
|
function assertIsMounted(fiber) {
|
|
if (getNearestMountedFiber(fiber) !== fiber)
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
}
|
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
var alternate = fiber.alternate;
|
|
if (!alternate) {
|
|
alternate = getNearestMountedFiber(fiber);
|
|
if (null === alternate)
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
return alternate !== fiber ? null : fiber;
|
|
}
|
|
for (var a = fiber, b = alternate; ; ) {
|
|
var parentA = a.return;
|
|
if (null === parentA) break;
|
|
var parentB = parentA.alternate;
|
|
if (null === parentB) {
|
|
b = parentA.return;
|
|
if (null !== b) {
|
|
a = b;
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (parentA.child === parentB.child) {
|
|
for (parentB = parentA.child; parentB; ) {
|
|
if (parentB === a) return assertIsMounted(parentA), fiber;
|
|
if (parentB === b) return assertIsMounted(parentA), alternate;
|
|
parentB = parentB.sibling;
|
|
}
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
}
|
|
if (a.return !== b.return) (a = parentA), (b = parentB);
|
|
else {
|
|
for (var didFindChild = !1, child$1 = parentA.child; child$1; ) {
|
|
if (child$1 === a) {
|
|
didFindChild = !0;
|
|
a = parentA;
|
|
b = parentB;
|
|
break;
|
|
}
|
|
if (child$1 === b) {
|
|
didFindChild = !0;
|
|
b = parentA;
|
|
a = parentB;
|
|
break;
|
|
}
|
|
child$1 = child$1.sibling;
|
|
}
|
|
if (!didFindChild) {
|
|
for (child$1 = parentB.child; child$1; ) {
|
|
if (child$1 === a) {
|
|
didFindChild = !0;
|
|
a = parentB;
|
|
b = parentA;
|
|
break;
|
|
}
|
|
if (child$1 === b) {
|
|
didFindChild = !0;
|
|
b = parentB;
|
|
a = parentA;
|
|
break;
|
|
}
|
|
child$1 = child$1.sibling;
|
|
}
|
|
if (!didFindChild)
|
|
throw Error(
|
|
"Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."
|
|
);
|
|
}
|
|
}
|
|
if (a.alternate !== b)
|
|
throw Error(
|
|
"Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
if (3 !== a.tag)
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
return a.stateNode.current === a ? fiber : alternate;
|
|
}
|
|
function findCurrentHostFiber(parent) {
|
|
parent = findCurrentFiberUsingSlowPath(parent);
|
|
return null !== parent ? findCurrentHostFiberImpl(parent) : null;
|
|
}
|
|
function findCurrentHostFiberImpl(node) {
|
|
if (5 === node.tag || 6 === node.tag) return node;
|
|
for (node = node.child; null !== node; ) {
|
|
var match = findCurrentHostFiberImpl(node);
|
|
if (null !== match) return match;
|
|
node = node.sibling;
|
|
}
|
|
return null;
|
|
}
|
|
var emptyObject = {},
|
|
removedKeys = null,
|
|
removedKeyCount = 0,
|
|
deepDifferOptions = { unsafelyIgnoreFunctions: !0 };
|
|
function defaultDiffer(prevProp, nextProp) {
|
|
return "object" !== typeof nextProp || null === nextProp
|
|
? !0
|
|
: ReactNativePrivateInterface.deepDiffer(
|
|
prevProp,
|
|
nextProp,
|
|
deepDifferOptions
|
|
);
|
|
}
|
|
function restoreDeletedValuesInNestedArray(
|
|
updatePayload,
|
|
node,
|
|
validAttributes
|
|
) {
|
|
if (isArrayImpl(node))
|
|
for (var i = node.length; i-- && 0 < removedKeyCount; )
|
|
restoreDeletedValuesInNestedArray(
|
|
updatePayload,
|
|
node[i],
|
|
validAttributes
|
|
);
|
|
else if (node && 0 < removedKeyCount)
|
|
for (i in removedKeys)
|
|
if (removedKeys[i]) {
|
|
var nextProp = node[i];
|
|
if (void 0 !== nextProp) {
|
|
var attributeConfig = validAttributes[i];
|
|
if (attributeConfig) {
|
|
"function" === typeof nextProp && (nextProp = !0);
|
|
"undefined" === typeof nextProp && (nextProp = null);
|
|
if ("object" !== typeof attributeConfig)
|
|
updatePayload[i] = nextProp;
|
|
else if (
|
|
"function" === typeof attributeConfig.diff ||
|
|
"function" === typeof attributeConfig.process
|
|
)
|
|
(nextProp =
|
|
"function" === typeof attributeConfig.process
|
|
? attributeConfig.process(nextProp)
|
|
: nextProp),
|
|
(updatePayload[i] = nextProp);
|
|
removedKeys[i] = !1;
|
|
removedKeyCount--;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function diffNestedProperty(
|
|
updatePayload,
|
|
prevProp,
|
|
nextProp,
|
|
validAttributes
|
|
) {
|
|
if (!updatePayload && prevProp === nextProp) return updatePayload;
|
|
if (!prevProp || !nextProp)
|
|
return nextProp
|
|
? addNestedProperty(updatePayload, nextProp, validAttributes)
|
|
: prevProp
|
|
? clearNestedProperty(updatePayload, prevProp, validAttributes)
|
|
: updatePayload;
|
|
if (!isArrayImpl(prevProp) && !isArrayImpl(nextProp))
|
|
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
|
|
if (isArrayImpl(prevProp) && isArrayImpl(nextProp)) {
|
|
var minLength =
|
|
prevProp.length < nextProp.length ? prevProp.length : nextProp.length,
|
|
i;
|
|
for (i = 0; i < minLength; i++)
|
|
updatePayload = diffNestedProperty(
|
|
updatePayload,
|
|
prevProp[i],
|
|
nextProp[i],
|
|
validAttributes
|
|
);
|
|
for (; i < prevProp.length; i++)
|
|
updatePayload = clearNestedProperty(
|
|
updatePayload,
|
|
prevProp[i],
|
|
validAttributes
|
|
);
|
|
for (; i < nextProp.length; i++)
|
|
updatePayload = addNestedProperty(
|
|
updatePayload,
|
|
nextProp[i],
|
|
validAttributes
|
|
);
|
|
return updatePayload;
|
|
}
|
|
return isArrayImpl(prevProp)
|
|
? diffProperties(
|
|
updatePayload,
|
|
ReactNativePrivateInterface.flattenStyle(prevProp),
|
|
nextProp,
|
|
validAttributes
|
|
)
|
|
: diffProperties(
|
|
updatePayload,
|
|
prevProp,
|
|
ReactNativePrivateInterface.flattenStyle(nextProp),
|
|
validAttributes
|
|
);
|
|
}
|
|
function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
|
if (!nextProp) return updatePayload;
|
|
if (!isArrayImpl(nextProp))
|
|
return diffProperties(
|
|
updatePayload,
|
|
emptyObject,
|
|
nextProp,
|
|
validAttributes
|
|
);
|
|
for (var i = 0; i < nextProp.length; i++)
|
|
updatePayload = addNestedProperty(
|
|
updatePayload,
|
|
nextProp[i],
|
|
validAttributes
|
|
);
|
|
return updatePayload;
|
|
}
|
|
function clearNestedProperty(updatePayload, prevProp, validAttributes) {
|
|
if (!prevProp) return updatePayload;
|
|
if (!isArrayImpl(prevProp))
|
|
return diffProperties(
|
|
updatePayload,
|
|
prevProp,
|
|
emptyObject,
|
|
validAttributes
|
|
);
|
|
for (var i = 0; i < prevProp.length; i++)
|
|
updatePayload = clearNestedProperty(
|
|
updatePayload,
|
|
prevProp[i],
|
|
validAttributes
|
|
);
|
|
return updatePayload;
|
|
}
|
|
function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
var attributeConfig, propKey;
|
|
for (propKey in nextProps)
|
|
if ((attributeConfig = validAttributes[propKey])) {
|
|
var prevProp = prevProps[propKey];
|
|
var nextProp = nextProps[propKey];
|
|
"function" === typeof nextProp &&
|
|
((nextProp = !0), "function" === typeof prevProp && (prevProp = !0));
|
|
"undefined" === typeof nextProp &&
|
|
((nextProp = null),
|
|
"undefined" === typeof prevProp && (prevProp = null));
|
|
removedKeys && (removedKeys[propKey] = !1);
|
|
if (updatePayload && void 0 !== updatePayload[propKey])
|
|
if ("object" !== typeof attributeConfig)
|
|
updatePayload[propKey] = nextProp;
|
|
else {
|
|
if (
|
|
"function" === typeof attributeConfig.diff ||
|
|
"function" === typeof attributeConfig.process
|
|
)
|
|
(attributeConfig =
|
|
"function" === typeof attributeConfig.process
|
|
? attributeConfig.process(nextProp)
|
|
: nextProp),
|
|
(updatePayload[propKey] = attributeConfig);
|
|
}
|
|
else if (prevProp !== nextProp)
|
|
if ("object" !== typeof attributeConfig)
|
|
defaultDiffer(prevProp, nextProp) &&
|
|
((updatePayload || (updatePayload = {}))[propKey] = nextProp);
|
|
else if (
|
|
"function" === typeof attributeConfig.diff ||
|
|
"function" === typeof attributeConfig.process
|
|
) {
|
|
if (
|
|
void 0 === prevProp ||
|
|
("function" === typeof attributeConfig.diff
|
|
? attributeConfig.diff(prevProp, nextProp)
|
|
: defaultDiffer(prevProp, nextProp))
|
|
)
|
|
(attributeConfig =
|
|
"function" === typeof attributeConfig.process
|
|
? attributeConfig.process(nextProp)
|
|
: nextProp),
|
|
((updatePayload || (updatePayload = {}))[
|
|
propKey
|
|
] = attributeConfig);
|
|
} else
|
|
(removedKeys = null),
|
|
(removedKeyCount = 0),
|
|
(updatePayload = diffNestedProperty(
|
|
updatePayload,
|
|
prevProp,
|
|
nextProp,
|
|
attributeConfig
|
|
)),
|
|
0 < removedKeyCount &&
|
|
updatePayload &&
|
|
(restoreDeletedValuesInNestedArray(
|
|
updatePayload,
|
|
nextProp,
|
|
attributeConfig
|
|
),
|
|
(removedKeys = null));
|
|
}
|
|
for (var propKey$3 in prevProps)
|
|
void 0 === nextProps[propKey$3] &&
|
|
(!(attributeConfig = validAttributes[propKey$3]) ||
|
|
(updatePayload && void 0 !== updatePayload[propKey$3]) ||
|
|
((prevProp = prevProps[propKey$3]),
|
|
void 0 !== prevProp &&
|
|
("object" !== typeof attributeConfig ||
|
|
"function" === typeof attributeConfig.diff ||
|
|
"function" === typeof attributeConfig.process
|
|
? (((updatePayload || (updatePayload = {}))[propKey$3] = null),
|
|
removedKeys || (removedKeys = {}),
|
|
removedKeys[propKey$3] ||
|
|
((removedKeys[propKey$3] = !0), removedKeyCount++))
|
|
: (updatePayload = clearNestedProperty(
|
|
updatePayload,
|
|
prevProp,
|
|
attributeConfig
|
|
)))));
|
|
return updatePayload;
|
|
}
|
|
function mountSafeCallback_NOT_REALLY_SAFE(context, callback) {
|
|
return function() {
|
|
if (
|
|
callback &&
|
|
("boolean" !== typeof context.__isMounted || context.__isMounted)
|
|
)
|
|
return callback.apply(context, arguments);
|
|
};
|
|
}
|
|
var ReactNativeFiberHostComponent = (function() {
|
|
function ReactNativeFiberHostComponent(tag, viewConfig) {
|
|
this._nativeTag = tag;
|
|
this._children = [];
|
|
this.viewConfig = viewConfig;
|
|
}
|
|
var _proto = ReactNativeFiberHostComponent.prototype;
|
|
_proto.blur = function() {
|
|
ReactNativePrivateInterface.TextInputState.blurTextInput(this);
|
|
};
|
|
_proto.focus = function() {
|
|
ReactNativePrivateInterface.TextInputState.focusTextInput(this);
|
|
};
|
|
_proto.measure = function(callback) {
|
|
ReactNativePrivateInterface.UIManager.measure(
|
|
this._nativeTag,
|
|
mountSafeCallback_NOT_REALLY_SAFE(this, callback)
|
|
);
|
|
};
|
|
_proto.measureInWindow = function(callback) {
|
|
ReactNativePrivateInterface.UIManager.measureInWindow(
|
|
this._nativeTag,
|
|
mountSafeCallback_NOT_REALLY_SAFE(this, callback)
|
|
);
|
|
};
|
|
_proto.measureLayout = function(relativeToNativeNode, onSuccess, onFail) {
|
|
if ("number" === typeof relativeToNativeNode)
|
|
var relativeNode = relativeToNativeNode;
|
|
else
|
|
relativeToNativeNode._nativeTag &&
|
|
(relativeNode = relativeToNativeNode._nativeTag);
|
|
null != relativeNode &&
|
|
ReactNativePrivateInterface.UIManager.measureLayout(
|
|
this._nativeTag,
|
|
relativeNode,
|
|
mountSafeCallback_NOT_REALLY_SAFE(this, onFail),
|
|
mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess)
|
|
);
|
|
};
|
|
_proto.setNativeProps = function(nativeProps) {
|
|
nativeProps = diffProperties(
|
|
null,
|
|
emptyObject,
|
|
nativeProps,
|
|
this.viewConfig.validAttributes
|
|
);
|
|
null != nativeProps &&
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
this._nativeTag,
|
|
this.viewConfig.uiViewClassName,
|
|
nativeProps
|
|
);
|
|
};
|
|
return ReactNativeFiberHostComponent;
|
|
})(),
|
|
scheduleCallback = Scheduler.unstable_scheduleCallback,
|
|
cancelCallback = Scheduler.unstable_cancelCallback,
|
|
shouldYield = Scheduler.unstable_shouldYield,
|
|
requestPaint = Scheduler.unstable_requestPaint,
|
|
now = Scheduler.unstable_now,
|
|
ImmediatePriority = Scheduler.unstable_ImmediatePriority,
|
|
UserBlockingPriority = Scheduler.unstable_UserBlockingPriority,
|
|
NormalPriority = Scheduler.unstable_NormalPriority,
|
|
IdlePriority = Scheduler.unstable_IdlePriority,
|
|
rendererID = null,
|
|
injectedHook = null,
|
|
isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
function onCommitRoot(root, eventPriority) {
|
|
if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot)
|
|
try {
|
|
var didError = 128 === (root.current.flags & 128);
|
|
switch (eventPriority) {
|
|
case 1:
|
|
var schedulerPriority = ImmediatePriority;
|
|
break;
|
|
case 4:
|
|
schedulerPriority = UserBlockingPriority;
|
|
break;
|
|
case 16:
|
|
schedulerPriority = NormalPriority;
|
|
break;
|
|
case 536870912:
|
|
schedulerPriority = IdlePriority;
|
|
break;
|
|
default:
|
|
schedulerPriority = NormalPriority;
|
|
}
|
|
injectedHook.onCommitFiberRoot(
|
|
rendererID,
|
|
root,
|
|
schedulerPriority,
|
|
didError
|
|
);
|
|
} catch (err) {}
|
|
}
|
|
var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback,
|
|
log = Math.log,
|
|
LN2 = Math.LN2;
|
|
function clz32Fallback(x) {
|
|
x >>>= 0;
|
|
return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0;
|
|
}
|
|
var nextTransitionLane = 64,
|
|
nextRetryLane = 4194304;
|
|
function getHighestPriorityLanes(lanes) {
|
|
switch (lanes & -lanes) {
|
|
case 1:
|
|
return 1;
|
|
case 2:
|
|
return 2;
|
|
case 4:
|
|
return 4;
|
|
case 8:
|
|
return 8;
|
|
case 16:
|
|
return 16;
|
|
case 32:
|
|
return 32;
|
|
case 64:
|
|
case 128:
|
|
case 256:
|
|
case 512:
|
|
case 1024:
|
|
case 2048:
|
|
case 4096:
|
|
case 8192:
|
|
case 16384:
|
|
case 32768:
|
|
case 65536:
|
|
case 131072:
|
|
case 262144:
|
|
case 524288:
|
|
case 1048576:
|
|
case 2097152:
|
|
return lanes & 4194240;
|
|
case 4194304:
|
|
case 8388608:
|
|
case 16777216:
|
|
case 33554432:
|
|
case 67108864:
|
|
return lanes & 130023424;
|
|
case 134217728:
|
|
return 134217728;
|
|
case 268435456:
|
|
return 268435456;
|
|
case 536870912:
|
|
return 536870912;
|
|
case 1073741824:
|
|
return 1073741824;
|
|
default:
|
|
return lanes;
|
|
}
|
|
}
|
|
function getNextLanes(root, wipLanes) {
|
|
var pendingLanes = root.pendingLanes;
|
|
if (0 === pendingLanes) return 0;
|
|
var nextLanes = 0,
|
|
suspendedLanes = root.suspendedLanes,
|
|
pingedLanes = root.pingedLanes,
|
|
nonIdlePendingLanes = pendingLanes & 268435455;
|
|
if (0 !== nonIdlePendingLanes) {
|
|
var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes;
|
|
0 !== nonIdleUnblockedLanes
|
|
? (nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes))
|
|
: ((pingedLanes &= nonIdlePendingLanes),
|
|
0 !== pingedLanes &&
|
|
(nextLanes = getHighestPriorityLanes(pingedLanes)));
|
|
} else
|
|
(nonIdlePendingLanes = pendingLanes & ~suspendedLanes),
|
|
0 !== nonIdlePendingLanes
|
|
? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes))
|
|
: 0 !== pingedLanes &&
|
|
(nextLanes = getHighestPriorityLanes(pingedLanes));
|
|
if (0 === nextLanes) return 0;
|
|
if (
|
|
0 !== wipLanes &&
|
|
wipLanes !== nextLanes &&
|
|
0 === (wipLanes & suspendedLanes) &&
|
|
((suspendedLanes = nextLanes & -nextLanes),
|
|
(pingedLanes = wipLanes & -wipLanes),
|
|
suspendedLanes >= pingedLanes ||
|
|
(16 === suspendedLanes && 0 !== (pingedLanes & 4194240)))
|
|
)
|
|
return wipLanes;
|
|
0 !== (nextLanes & 4) && (nextLanes |= pendingLanes & 16);
|
|
wipLanes = root.entangledLanes;
|
|
if (0 !== wipLanes)
|
|
for (root = root.entanglements, wipLanes &= nextLanes; 0 < wipLanes; )
|
|
(pendingLanes = 31 - clz32(wipLanes)),
|
|
(suspendedLanes = 1 << pendingLanes),
|
|
(nextLanes |= root[pendingLanes]),
|
|
(wipLanes &= ~suspendedLanes);
|
|
return nextLanes;
|
|
}
|
|
function computeExpirationTime(lane, currentTime) {
|
|
switch (lane) {
|
|
case 1:
|
|
case 2:
|
|
case 4:
|
|
return currentTime + 250;
|
|
case 8:
|
|
case 16:
|
|
case 32:
|
|
case 64:
|
|
case 128:
|
|
case 256:
|
|
case 512:
|
|
case 1024:
|
|
case 2048:
|
|
case 4096:
|
|
case 8192:
|
|
case 16384:
|
|
case 32768:
|
|
case 65536:
|
|
case 131072:
|
|
case 262144:
|
|
case 524288:
|
|
case 1048576:
|
|
case 2097152:
|
|
return currentTime + 5e3;
|
|
case 4194304:
|
|
case 8388608:
|
|
case 16777216:
|
|
case 33554432:
|
|
case 67108864:
|
|
return -1;
|
|
case 134217728:
|
|
case 268435456:
|
|
case 536870912:
|
|
case 1073741824:
|
|
return -1;
|
|
default:
|
|
return -1;
|
|
}
|
|
}
|
|
function getLanesToRetrySynchronouslyOnError(root) {
|
|
root = root.pendingLanes & -1073741825;
|
|
return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0;
|
|
}
|
|
function claimNextTransitionLane() {
|
|
var lane = nextTransitionLane;
|
|
nextTransitionLane <<= 1;
|
|
0 === (nextTransitionLane & 4194240) && (nextTransitionLane = 64);
|
|
return lane;
|
|
}
|
|
function createLaneMap(initial) {
|
|
for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial);
|
|
return laneMap;
|
|
}
|
|
function markRootUpdated(root, updateLane, eventTime) {
|
|
root.pendingLanes |= updateLane;
|
|
536870912 !== updateLane &&
|
|
((root.suspendedLanes = 0), (root.pingedLanes = 0));
|
|
root = root.eventTimes;
|
|
updateLane = 31 - clz32(updateLane);
|
|
root[updateLane] = eventTime;
|
|
}
|
|
function markRootFinished(root, remainingLanes) {
|
|
var noLongerPendingLanes = root.pendingLanes & ~remainingLanes;
|
|
root.pendingLanes = remainingLanes;
|
|
root.suspendedLanes = 0;
|
|
root.pingedLanes = 0;
|
|
root.expiredLanes &= remainingLanes;
|
|
root.mutableReadLanes &= remainingLanes;
|
|
root.entangledLanes &= remainingLanes;
|
|
remainingLanes = root.entanglements;
|
|
var eventTimes = root.eventTimes;
|
|
for (root = root.expirationTimes; 0 < noLongerPendingLanes; ) {
|
|
var index$8 = 31 - clz32(noLongerPendingLanes),
|
|
lane = 1 << index$8;
|
|
remainingLanes[index$8] = 0;
|
|
eventTimes[index$8] = -1;
|
|
root[index$8] = -1;
|
|
noLongerPendingLanes &= ~lane;
|
|
}
|
|
}
|
|
function markRootEntangled(root, entangledLanes) {
|
|
var rootEntangledLanes = (root.entangledLanes |= entangledLanes);
|
|
for (root = root.entanglements; rootEntangledLanes; ) {
|
|
var index$9 = 31 - clz32(rootEntangledLanes),
|
|
lane = 1 << index$9;
|
|
(lane & entangledLanes) | (root[index$9] & entangledLanes) &&
|
|
(root[index$9] |= entangledLanes);
|
|
rootEntangledLanes &= ~lane;
|
|
}
|
|
}
|
|
function addFiberToLanesMap(root, fiber, lanes) {
|
|
if (isDevToolsPresent)
|
|
for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) {
|
|
var index$10 = 31 - clz32(lanes),
|
|
lane = 1 << index$10;
|
|
root[index$10].add(fiber);
|
|
lanes &= ~lane;
|
|
}
|
|
}
|
|
function movePendingFibersToMemoized(root, lanes) {
|
|
if (isDevToolsPresent)
|
|
for (
|
|
var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap,
|
|
memoizedUpdaters = root.memoizedUpdaters;
|
|
0 < lanes;
|
|
|
|
) {
|
|
var index$11 = 31 - clz32(lanes);
|
|
root = 1 << index$11;
|
|
index$11 = pendingUpdatersLaneMap[index$11];
|
|
0 < index$11.size &&
|
|
(index$11.forEach(function(fiber) {
|
|
var alternate = fiber.alternate;
|
|
(null !== alternate && memoizedUpdaters.has(alternate)) ||
|
|
memoizedUpdaters.add(fiber);
|
|
}),
|
|
index$11.clear());
|
|
lanes &= ~root;
|
|
}
|
|
}
|
|
var currentUpdatePriority = 0;
|
|
function lanesToEventPriority(lanes) {
|
|
lanes &= -lanes;
|
|
return 1 < lanes
|
|
? 4 < lanes
|
|
? 0 !== (lanes & 268435455)
|
|
? 16
|
|
: 536870912
|
|
: 4
|
|
: 1;
|
|
}
|
|
function shim() {
|
|
throw Error(
|
|
"The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
var getViewConfigForType =
|
|
ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get,
|
|
UPDATE_SIGNAL = {},
|
|
nextReactTag = 3;
|
|
function allocateTag() {
|
|
var tag = nextReactTag;
|
|
1 === tag % 10 && (tag += 2);
|
|
nextReactTag = tag + 2;
|
|
return tag;
|
|
}
|
|
function recursivelyUncacheFiberNode(node) {
|
|
if ("number" === typeof node)
|
|
instanceCache.delete(node), instanceProps.delete(node);
|
|
else {
|
|
var tag = node._nativeTag;
|
|
instanceCache.delete(tag);
|
|
instanceProps.delete(tag);
|
|
node._children.forEach(recursivelyUncacheFiberNode);
|
|
}
|
|
}
|
|
function finalizeInitialChildren(parentInstance) {
|
|
if (0 === parentInstance._children.length) return !1;
|
|
var nativeTags = parentInstance._children.map(function(child) {
|
|
return "number" === typeof child ? child : child._nativeTag;
|
|
});
|
|
ReactNativePrivateInterface.UIManager.setChildren(
|
|
parentInstance._nativeTag,
|
|
nativeTags
|
|
);
|
|
return !1;
|
|
}
|
|
var scheduleTimeout = setTimeout,
|
|
cancelTimeout = clearTimeout;
|
|
function describeComponentFrame(name, source, ownerName) {
|
|
source = "";
|
|
ownerName && (source = " (created by " + ownerName + ")");
|
|
return "\n in " + (name || "Unknown") + source;
|
|
}
|
|
function describeFunctionComponentFrame(fn, source) {
|
|
return fn
|
|
? describeComponentFrame(fn.displayName || fn.name || null, source, null)
|
|
: "";
|
|
}
|
|
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
valueStack = [],
|
|
index = -1;
|
|
function createCursor(defaultValue) {
|
|
return { current: defaultValue };
|
|
}
|
|
function pop(cursor) {
|
|
0 > index ||
|
|
((cursor.current = valueStack[index]), (valueStack[index] = null), index--);
|
|
}
|
|
function push(cursor, value) {
|
|
index++;
|
|
valueStack[index] = cursor.current;
|
|
cursor.current = value;
|
|
}
|
|
var emptyContextObject = {},
|
|
contextStackCursor = createCursor(emptyContextObject),
|
|
didPerformWorkStackCursor = createCursor(!1),
|
|
previousContext = emptyContextObject;
|
|
function getMaskedContext(workInProgress, unmaskedContext) {
|
|
var contextTypes = workInProgress.type.contextTypes;
|
|
if (!contextTypes) return emptyContextObject;
|
|
var instance = workInProgress.stateNode;
|
|
if (
|
|
instance &&
|
|
instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext
|
|
)
|
|
return instance.__reactInternalMemoizedMaskedChildContext;
|
|
var context = {},
|
|
key;
|
|
for (key in contextTypes) context[key] = unmaskedContext[key];
|
|
instance &&
|
|
((workInProgress = workInProgress.stateNode),
|
|
(workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext),
|
|
(workInProgress.__reactInternalMemoizedMaskedChildContext = context));
|
|
return context;
|
|
}
|
|
function isContextProvider(type) {
|
|
type = type.childContextTypes;
|
|
return null !== type && void 0 !== type;
|
|
}
|
|
function popContext() {
|
|
pop(didPerformWorkStackCursor);
|
|
pop(contextStackCursor);
|
|
}
|
|
function pushTopLevelContextObject(fiber, context, didChange) {
|
|
if (contextStackCursor.current !== emptyContextObject)
|
|
throw Error(
|
|
"Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
push(contextStackCursor, context);
|
|
push(didPerformWorkStackCursor, didChange);
|
|
}
|
|
function processChildContext(fiber, type, parentContext) {
|
|
var instance = fiber.stateNode;
|
|
type = type.childContextTypes;
|
|
if ("function" !== typeof instance.getChildContext) return parentContext;
|
|
instance = instance.getChildContext();
|
|
for (var contextKey in instance)
|
|
if (!(contextKey in type))
|
|
throw Error(
|
|
(getComponentNameFromFiber(fiber) || "Unknown") +
|
|
'.getChildContext(): key "' +
|
|
contextKey +
|
|
'" is not defined in childContextTypes.'
|
|
);
|
|
return assign({}, parentContext, instance);
|
|
}
|
|
function pushContextProvider(workInProgress) {
|
|
workInProgress =
|
|
((workInProgress = workInProgress.stateNode) &&
|
|
workInProgress.__reactInternalMemoizedMergedChildContext) ||
|
|
emptyContextObject;
|
|
previousContext = contextStackCursor.current;
|
|
push(contextStackCursor, workInProgress);
|
|
push(didPerformWorkStackCursor, didPerformWorkStackCursor.current);
|
|
return !0;
|
|
}
|
|
function invalidateContextProvider(workInProgress, type, didChange) {
|
|
var instance = workInProgress.stateNode;
|
|
if (!instance)
|
|
throw Error(
|
|
"Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
didChange
|
|
? ((workInProgress = processChildContext(
|
|
workInProgress,
|
|
type,
|
|
previousContext
|
|
)),
|
|
(instance.__reactInternalMemoizedMergedChildContext = workInProgress),
|
|
pop(didPerformWorkStackCursor),
|
|
pop(contextStackCursor),
|
|
push(contextStackCursor, workInProgress))
|
|
: pop(didPerformWorkStackCursor);
|
|
push(didPerformWorkStackCursor, didChange);
|
|
}
|
|
function is(x, y) {
|
|
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
}
|
|
var objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
syncQueue = null,
|
|
includesLegacySyncCallbacks = !1,
|
|
isFlushingSyncQueue = !1;
|
|
function flushSyncCallbacks() {
|
|
if (!isFlushingSyncQueue && null !== syncQueue) {
|
|
isFlushingSyncQueue = !0;
|
|
var i = 0,
|
|
previousUpdatePriority = currentUpdatePriority;
|
|
try {
|
|
var queue = syncQueue;
|
|
for (currentUpdatePriority = 1; i < queue.length; i++) {
|
|
var callback = queue[i];
|
|
do callback = callback(!0);
|
|
while (null !== callback);
|
|
}
|
|
syncQueue = null;
|
|
includesLegacySyncCallbacks = !1;
|
|
} catch (error) {
|
|
throw (null !== syncQueue && (syncQueue = syncQueue.slice(i + 1)),
|
|
scheduleCallback(ImmediatePriority, flushSyncCallbacks),
|
|
error);
|
|
} finally {
|
|
(currentUpdatePriority = previousUpdatePriority),
|
|
(isFlushingSyncQueue = !1);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
var forkStack = [],
|
|
forkStackIndex = 0,
|
|
treeForkProvider = null,
|
|
idStack = [],
|
|
idStackIndex = 0,
|
|
treeContextProvider = null;
|
|
function popTreeContext(workInProgress) {
|
|
for (; workInProgress === treeForkProvider; )
|
|
(treeForkProvider = forkStack[--forkStackIndex]),
|
|
(forkStack[forkStackIndex] = null),
|
|
--forkStackIndex,
|
|
(forkStack[forkStackIndex] = null);
|
|
for (; workInProgress === treeContextProvider; )
|
|
(treeContextProvider = idStack[--idStackIndex]),
|
|
(idStack[idStackIndex] = null),
|
|
--idStackIndex,
|
|
(idStack[idStackIndex] = null),
|
|
--idStackIndex,
|
|
(idStack[idStackIndex] = null);
|
|
}
|
|
var hydrationErrors = null,
|
|
ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
function shallowEqual(objA, objB) {
|
|
if (objectIs(objA, objB)) return !0;
|
|
if (
|
|
"object" !== typeof objA ||
|
|
null === objA ||
|
|
"object" !== typeof objB ||
|
|
null === objB
|
|
)
|
|
return !1;
|
|
var keysA = Object.keys(objA),
|
|
keysB = Object.keys(objB);
|
|
if (keysA.length !== keysB.length) return !1;
|
|
for (keysB = 0; keysB < keysA.length; keysB++) {
|
|
var currentKey = keysA[keysB];
|
|
if (
|
|
!hasOwnProperty.call(objB, currentKey) ||
|
|
!objectIs(objA[currentKey], objB[currentKey])
|
|
)
|
|
return !1;
|
|
}
|
|
return !0;
|
|
}
|
|
function describeFiber(fiber) {
|
|
switch (fiber.tag) {
|
|
case 5:
|
|
return describeComponentFrame(fiber.type, null, null);
|
|
case 16:
|
|
return describeComponentFrame("Lazy", null, null);
|
|
case 13:
|
|
return describeComponentFrame("Suspense", null, null);
|
|
case 19:
|
|
return describeComponentFrame("SuspenseList", null, null);
|
|
case 0:
|
|
case 2:
|
|
case 15:
|
|
return describeFunctionComponentFrame(fiber.type, null);
|
|
case 11:
|
|
return describeFunctionComponentFrame(fiber.type.render, null);
|
|
case 1:
|
|
return (fiber = describeFunctionComponentFrame(fiber.type, null)), fiber;
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
function getStackByFiberInDevAndProd(workInProgress) {
|
|
try {
|
|
var info = "";
|
|
do
|
|
(info += describeFiber(workInProgress)),
|
|
(workInProgress = workInProgress.return);
|
|
while (workInProgress);
|
|
return info;
|
|
} catch (x) {
|
|
return "\nError generating stack: " + x.message + "\n" + x.stack;
|
|
}
|
|
}
|
|
function resolveDefaultProps(Component, baseProps) {
|
|
if (Component && Component.defaultProps) {
|
|
baseProps = assign({}, baseProps);
|
|
Component = Component.defaultProps;
|
|
for (var propName in Component)
|
|
void 0 === baseProps[propName] &&
|
|
(baseProps[propName] = Component[propName]);
|
|
return baseProps;
|
|
}
|
|
return baseProps;
|
|
}
|
|
var valueCursor = createCursor(null),
|
|
currentlyRenderingFiber = null,
|
|
lastContextDependency = null,
|
|
lastFullyObservedContext = null;
|
|
function resetContextDependencies() {
|
|
lastFullyObservedContext = lastContextDependency = currentlyRenderingFiber = null;
|
|
}
|
|
function popProvider(context) {
|
|
var currentValue = valueCursor.current;
|
|
pop(valueCursor);
|
|
context._currentValue = currentValue;
|
|
}
|
|
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 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) {
|
|
var value = context._currentValue;
|
|
if (lastFullyObservedContext !== context)
|
|
if (
|
|
((context = { context: context, memoizedValue: value, next: null }),
|
|
null === lastContextDependency)
|
|
) {
|
|
if (null === currentlyRenderingFiber)
|
|
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;
|
|
currentlyRenderingFiber.dependencies = {
|
|
lanes: 0,
|
|
firstContext: context
|
|
};
|
|
} else lastContextDependency = lastContextDependency.next = context;
|
|
return value;
|
|
}
|
|
var concurrentQueues = null;
|
|
function pushConcurrentUpdateQueue(queue) {
|
|
null === concurrentQueues
|
|
? (concurrentQueues = [queue])
|
|
: concurrentQueues.push(queue);
|
|
}
|
|
function enqueueConcurrentHookUpdate(fiber, queue, update, lane) {
|
|
var interleaved = queue.interleaved;
|
|
null === interleaved
|
|
? ((update.next = update), pushConcurrentUpdateQueue(queue))
|
|
: ((update.next = interleaved.next), (interleaved.next = update));
|
|
queue.interleaved = update;
|
|
return markUpdateLaneFromFiberToRoot(fiber, lane);
|
|
}
|
|
function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
|
sourceFiber.lanes |= lane;
|
|
var alternate = sourceFiber.alternate;
|
|
null !== alternate && (alternate.lanes |= lane);
|
|
alternate = sourceFiber;
|
|
for (sourceFiber = sourceFiber.return; null !== sourceFiber; )
|
|
(sourceFiber.childLanes |= lane),
|
|
(alternate = sourceFiber.alternate),
|
|
null !== alternate && (alternate.childLanes |= lane),
|
|
(alternate = sourceFiber),
|
|
(sourceFiber = sourceFiber.return);
|
|
return 3 === alternate.tag ? alternate.stateNode : null;
|
|
}
|
|
var hasForceUpdate = !1;
|
|
function initializeUpdateQueue(fiber) {
|
|
fiber.updateQueue = {
|
|
baseState: fiber.memoizedState,
|
|
firstBaseUpdate: null,
|
|
lastBaseUpdate: null,
|
|
shared: { pending: null, interleaved: null, lanes: 0 },
|
|
effects: null
|
|
};
|
|
}
|
|
function cloneUpdateQueue(current, workInProgress) {
|
|
current = current.updateQueue;
|
|
workInProgress.updateQueue === current &&
|
|
(workInProgress.updateQueue = {
|
|
baseState: current.baseState,
|
|
firstBaseUpdate: current.firstBaseUpdate,
|
|
lastBaseUpdate: current.lastBaseUpdate,
|
|
shared: current.shared,
|
|
effects: current.effects
|
|
});
|
|
}
|
|
function createUpdate(eventTime, lane) {
|
|
return {
|
|
eventTime: eventTime,
|
|
lane: lane,
|
|
tag: 0,
|
|
payload: null,
|
|
callback: null,
|
|
next: null
|
|
};
|
|
}
|
|
function enqueueUpdate(fiber, update, lane) {
|
|
var updateQueue = fiber.updateQueue;
|
|
if (null === updateQueue) return null;
|
|
updateQueue = updateQueue.shared;
|
|
if (0 !== (executionContext & 2)) {
|
|
var pending = updateQueue.pending;
|
|
null === pending
|
|
? (update.next = update)
|
|
: ((update.next = pending.next), (pending.next = update));
|
|
updateQueue.pending = update;
|
|
return markUpdateLaneFromFiberToRoot(fiber, lane);
|
|
}
|
|
pending = updateQueue.interleaved;
|
|
null === pending
|
|
? ((update.next = update), pushConcurrentUpdateQueue(updateQueue))
|
|
: ((update.next = pending.next), (pending.next = update));
|
|
updateQueue.interleaved = update;
|
|
return markUpdateLaneFromFiberToRoot(fiber, lane);
|
|
}
|
|
function entangleTransitions(root, fiber, lane) {
|
|
fiber = fiber.updateQueue;
|
|
if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194240))) {
|
|
var queueLanes = fiber.lanes;
|
|
queueLanes &= root.pendingLanes;
|
|
lane |= queueLanes;
|
|
fiber.lanes = lane;
|
|
markRootEntangled(root, lane);
|
|
}
|
|
}
|
|
function enqueueCapturedUpdate(workInProgress, capturedUpdate) {
|
|
var queue = workInProgress.updateQueue,
|
|
current = workInProgress.alternate;
|
|
if (
|
|
null !== current &&
|
|
((current = current.updateQueue), queue === current)
|
|
) {
|
|
var newFirst = null,
|
|
newLast = null;
|
|
queue = queue.firstBaseUpdate;
|
|
if (null !== queue) {
|
|
do {
|
|
var clone = {
|
|
eventTime: queue.eventTime,
|
|
lane: queue.lane,
|
|
tag: queue.tag,
|
|
payload: queue.payload,
|
|
callback: queue.callback,
|
|
next: null
|
|
};
|
|
null === newLast
|
|
? (newFirst = newLast = clone)
|
|
: (newLast = newLast.next = clone);
|
|
queue = queue.next;
|
|
} while (null !== queue);
|
|
null === newLast
|
|
? (newFirst = newLast = capturedUpdate)
|
|
: (newLast = newLast.next = capturedUpdate);
|
|
} else newFirst = newLast = capturedUpdate;
|
|
queue = {
|
|
baseState: current.baseState,
|
|
firstBaseUpdate: newFirst,
|
|
lastBaseUpdate: newLast,
|
|
shared: current.shared,
|
|
effects: current.effects
|
|
};
|
|
workInProgress.updateQueue = queue;
|
|
return;
|
|
}
|
|
workInProgress = queue.lastBaseUpdate;
|
|
null === workInProgress
|
|
? (queue.firstBaseUpdate = capturedUpdate)
|
|
: (workInProgress.next = capturedUpdate);
|
|
queue.lastBaseUpdate = capturedUpdate;
|
|
}
|
|
function processUpdateQueue(
|
|
workInProgress$jscomp$0,
|
|
props,
|
|
instance,
|
|
renderLanes
|
|
) {
|
|
var queue = workInProgress$jscomp$0.updateQueue;
|
|
hasForceUpdate = !1;
|
|
var firstBaseUpdate = queue.firstBaseUpdate,
|
|
lastBaseUpdate = queue.lastBaseUpdate,
|
|
pendingQueue = queue.shared.pending;
|
|
if (null !== pendingQueue) {
|
|
queue.shared.pending = null;
|
|
var lastPendingUpdate = pendingQueue,
|
|
firstPendingUpdate = lastPendingUpdate.next;
|
|
lastPendingUpdate.next = null;
|
|
null === lastBaseUpdate
|
|
? (firstBaseUpdate = firstPendingUpdate)
|
|
: (lastBaseUpdate.next = firstPendingUpdate);
|
|
lastBaseUpdate = lastPendingUpdate;
|
|
var current = workInProgress$jscomp$0.alternate;
|
|
null !== current &&
|
|
((current = current.updateQueue),
|
|
(pendingQueue = current.lastBaseUpdate),
|
|
pendingQueue !== lastBaseUpdate &&
|
|
(null === pendingQueue
|
|
? (current.firstBaseUpdate = firstPendingUpdate)
|
|
: (pendingQueue.next = firstPendingUpdate),
|
|
(current.lastBaseUpdate = lastPendingUpdate)));
|
|
}
|
|
if (null !== firstBaseUpdate) {
|
|
var newState = queue.baseState;
|
|
lastBaseUpdate = 0;
|
|
current = firstPendingUpdate = lastPendingUpdate = null;
|
|
pendingQueue = firstBaseUpdate;
|
|
do {
|
|
var updateLane = pendingQueue.lane,
|
|
updateEventTime = pendingQueue.eventTime;
|
|
if ((renderLanes & updateLane) === updateLane) {
|
|
null !== current &&
|
|
(current = current.next = {
|
|
eventTime: updateEventTime,
|
|
lane: 0,
|
|
tag: pendingQueue.tag,
|
|
payload: pendingQueue.payload,
|
|
callback: pendingQueue.callback,
|
|
next: null
|
|
});
|
|
a: {
|
|
var workInProgress = workInProgress$jscomp$0,
|
|
update = pendingQueue;
|
|
updateLane = props;
|
|
updateEventTime = instance;
|
|
switch (update.tag) {
|
|
case 1:
|
|
workInProgress = update.payload;
|
|
if ("function" === typeof workInProgress) {
|
|
newState = workInProgress.call(
|
|
updateEventTime,
|
|
newState,
|
|
updateLane
|
|
);
|
|
break a;
|
|
}
|
|
newState = workInProgress;
|
|
break a;
|
|
case 3:
|
|
workInProgress.flags = (workInProgress.flags & -65537) | 128;
|
|
case 0:
|
|
workInProgress = update.payload;
|
|
updateLane =
|
|
"function" === typeof workInProgress
|
|
? workInProgress.call(updateEventTime, newState, updateLane)
|
|
: workInProgress;
|
|
if (null === updateLane || void 0 === updateLane) break a;
|
|
newState = assign({}, newState, updateLane);
|
|
break a;
|
|
case 2:
|
|
hasForceUpdate = !0;
|
|
}
|
|
}
|
|
null !== pendingQueue.callback &&
|
|
0 !== pendingQueue.lane &&
|
|
((workInProgress$jscomp$0.flags |= 64),
|
|
(updateLane = queue.effects),
|
|
null === updateLane
|
|
? (queue.effects = [pendingQueue])
|
|
: updateLane.push(pendingQueue));
|
|
} else
|
|
(updateEventTime = {
|
|
eventTime: updateEventTime,
|
|
lane: updateLane,
|
|
tag: pendingQueue.tag,
|
|
payload: pendingQueue.payload,
|
|
callback: pendingQueue.callback,
|
|
next: null
|
|
}),
|
|
null === current
|
|
? ((firstPendingUpdate = current = updateEventTime),
|
|
(lastPendingUpdate = newState))
|
|
: (current = current.next = updateEventTime),
|
|
(lastBaseUpdate |= updateLane);
|
|
pendingQueue = pendingQueue.next;
|
|
if (null === pendingQueue)
|
|
if (((pendingQueue = queue.shared.pending), null === pendingQueue))
|
|
break;
|
|
else
|
|
(updateLane = pendingQueue),
|
|
(pendingQueue = updateLane.next),
|
|
(updateLane.next = null),
|
|
(queue.lastBaseUpdate = updateLane),
|
|
(queue.shared.pending = null);
|
|
} while (1);
|
|
null === current && (lastPendingUpdate = newState);
|
|
queue.baseState = lastPendingUpdate;
|
|
queue.firstBaseUpdate = firstPendingUpdate;
|
|
queue.lastBaseUpdate = current;
|
|
props = queue.shared.interleaved;
|
|
if (null !== props) {
|
|
queue = props;
|
|
do (lastBaseUpdate |= queue.lane), (queue = queue.next);
|
|
while (queue !== props);
|
|
} else null === firstBaseUpdate && (queue.shared.lanes = 0);
|
|
workInProgressRootSkippedLanes |= lastBaseUpdate;
|
|
workInProgress$jscomp$0.lanes = lastBaseUpdate;
|
|
workInProgress$jscomp$0.memoizedState = newState;
|
|
}
|
|
}
|
|
function commitUpdateQueue(finishedWork, finishedQueue, instance) {
|
|
finishedWork = finishedQueue.effects;
|
|
finishedQueue.effects = null;
|
|
if (null !== finishedWork)
|
|
for (
|
|
finishedQueue = 0;
|
|
finishedQueue < finishedWork.length;
|
|
finishedQueue++
|
|
) {
|
|
var effect = finishedWork[finishedQueue],
|
|
callback = effect.callback;
|
|
if (null !== callback) {
|
|
effect.callback = null;
|
|
if ("function" !== typeof callback)
|
|
throw Error(
|
|
"Invalid argument passed as callback. Expected a function. Instead received: " +
|
|
callback
|
|
);
|
|
callback.call(instance);
|
|
}
|
|
}
|
|
}
|
|
var emptyRefsObject = new React.Component().refs;
|
|
function applyDerivedStateFromProps(
|
|
workInProgress,
|
|
ctor,
|
|
getDerivedStateFromProps,
|
|
nextProps
|
|
) {
|
|
ctor = workInProgress.memoizedState;
|
|
getDerivedStateFromProps = getDerivedStateFromProps(nextProps, ctor);
|
|
getDerivedStateFromProps =
|
|
null === getDerivedStateFromProps || void 0 === getDerivedStateFromProps
|
|
? ctor
|
|
: assign({}, ctor, getDerivedStateFromProps);
|
|
workInProgress.memoizedState = getDerivedStateFromProps;
|
|
0 === workInProgress.lanes &&
|
|
(workInProgress.updateQueue.baseState = getDerivedStateFromProps);
|
|
}
|
|
var classComponentUpdater = {
|
|
isMounted: function(component) {
|
|
return (component = component._reactInternals)
|
|
? getNearestMountedFiber(component) === component
|
|
: !1;
|
|
},
|
|
enqueueSetState: function(inst, payload, callback) {
|
|
inst = inst._reactInternals;
|
|
var eventTime = requestEventTime(),
|
|
lane = requestUpdateLane(inst),
|
|
update = createUpdate(eventTime, lane);
|
|
update.payload = payload;
|
|
void 0 !== callback && null !== callback && (update.callback = callback);
|
|
payload = enqueueUpdate(inst, update, lane);
|
|
null !== payload &&
|
|
(scheduleUpdateOnFiber(payload, inst, lane, eventTime),
|
|
entangleTransitions(payload, inst, lane));
|
|
},
|
|
enqueueReplaceState: function(inst, payload, callback) {
|
|
inst = inst._reactInternals;
|
|
var eventTime = requestEventTime(),
|
|
lane = requestUpdateLane(inst),
|
|
update = createUpdate(eventTime, lane);
|
|
update.tag = 1;
|
|
update.payload = payload;
|
|
void 0 !== callback && null !== callback && (update.callback = callback);
|
|
payload = enqueueUpdate(inst, update, lane);
|
|
null !== payload &&
|
|
(scheduleUpdateOnFiber(payload, inst, lane, eventTime),
|
|
entangleTransitions(payload, inst, lane));
|
|
},
|
|
enqueueForceUpdate: function(inst, callback) {
|
|
inst = inst._reactInternals;
|
|
var eventTime = requestEventTime(),
|
|
lane = requestUpdateLane(inst),
|
|
update = createUpdate(eventTime, lane);
|
|
update.tag = 2;
|
|
void 0 !== callback && null !== callback && (update.callback = callback);
|
|
callback = enqueueUpdate(inst, update, lane);
|
|
null !== callback &&
|
|
(scheduleUpdateOnFiber(callback, inst, lane, eventTime),
|
|
entangleTransitions(callback, inst, lane));
|
|
}
|
|
};
|
|
function checkShouldComponentUpdate(
|
|
workInProgress,
|
|
ctor,
|
|
oldProps,
|
|
newProps,
|
|
oldState,
|
|
newState,
|
|
nextContext
|
|
) {
|
|
workInProgress = workInProgress.stateNode;
|
|
return "function" === typeof workInProgress.shouldComponentUpdate
|
|
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
|
|
: ctor.prototype && ctor.prototype.isPureReactComponent
|
|
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
|
|
: !0;
|
|
}
|
|
function constructClassInstance(workInProgress, ctor, props) {
|
|
var isLegacyContextConsumer = !1,
|
|
unmaskedContext = emptyContextObject;
|
|
var context = ctor.contextType;
|
|
"object" === typeof context && null !== context
|
|
? (context = readContext(context))
|
|
: ((unmaskedContext = isContextProvider(ctor)
|
|
? previousContext
|
|
: contextStackCursor.current),
|
|
(isLegacyContextConsumer = ctor.contextTypes),
|
|
(context = (isLegacyContextConsumer =
|
|
null !== isLegacyContextConsumer && void 0 !== isLegacyContextConsumer)
|
|
? getMaskedContext(workInProgress, unmaskedContext)
|
|
: emptyContextObject));
|
|
ctor = new ctor(props, context);
|
|
workInProgress.memoizedState =
|
|
null !== ctor.state && void 0 !== ctor.state ? ctor.state : null;
|
|
ctor.updater = classComponentUpdater;
|
|
workInProgress.stateNode = ctor;
|
|
ctor._reactInternals = workInProgress;
|
|
isLegacyContextConsumer &&
|
|
((workInProgress = workInProgress.stateNode),
|
|
(workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext),
|
|
(workInProgress.__reactInternalMemoizedMaskedChildContext = context));
|
|
return ctor;
|
|
}
|
|
function callComponentWillReceiveProps(
|
|
workInProgress,
|
|
instance,
|
|
newProps,
|
|
nextContext
|
|
) {
|
|
workInProgress = instance.state;
|
|
"function" === typeof instance.componentWillReceiveProps &&
|
|
instance.componentWillReceiveProps(newProps, nextContext);
|
|
"function" === typeof instance.UNSAFE_componentWillReceiveProps &&
|
|
instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
|
|
instance.state !== workInProgress &&
|
|
classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
|
}
|
|
function mountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
var instance = workInProgress.stateNode;
|
|
instance.props = newProps;
|
|
instance.state = workInProgress.memoizedState;
|
|
instance.refs = emptyRefsObject;
|
|
initializeUpdateQueue(workInProgress);
|
|
var contextType = ctor.contextType;
|
|
"object" === typeof contextType && null !== contextType
|
|
? (instance.context = readContext(contextType))
|
|
: ((contextType = isContextProvider(ctor)
|
|
? previousContext
|
|
: contextStackCursor.current),
|
|
(instance.context = getMaskedContext(workInProgress, contextType)));
|
|
instance.state = workInProgress.memoizedState;
|
|
contextType = ctor.getDerivedStateFromProps;
|
|
"function" === typeof contextType &&
|
|
(applyDerivedStateFromProps(workInProgress, ctor, contextType, newProps),
|
|
(instance.state = workInProgress.memoizedState));
|
|
"function" === typeof ctor.getDerivedStateFromProps ||
|
|
"function" === typeof instance.getSnapshotBeforeUpdate ||
|
|
("function" !== typeof instance.UNSAFE_componentWillMount &&
|
|
"function" !== typeof instance.componentWillMount) ||
|
|
((ctor = instance.state),
|
|
"function" === typeof instance.componentWillMount &&
|
|
instance.componentWillMount(),
|
|
"function" === typeof instance.UNSAFE_componentWillMount &&
|
|
instance.UNSAFE_componentWillMount(),
|
|
ctor !== instance.state &&
|
|
classComponentUpdater.enqueueReplaceState(instance, instance.state, null),
|
|
processUpdateQueue(workInProgress, newProps, instance, renderLanes),
|
|
(instance.state = workInProgress.memoizedState));
|
|
"function" === typeof instance.componentDidMount &&
|
|
(workInProgress.flags |= 4);
|
|
}
|
|
function coerceRef(returnFiber, current, element) {
|
|
returnFiber = element.ref;
|
|
if (
|
|
null !== returnFiber &&
|
|
"function" !== typeof returnFiber &&
|
|
"object" !== typeof returnFiber
|
|
) {
|
|
if (element._owner) {
|
|
element = element._owner;
|
|
if (element) {
|
|
if (1 !== element.tag)
|
|
throw Error(
|
|
"Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref"
|
|
);
|
|
var inst = element.stateNode;
|
|
}
|
|
if (!inst)
|
|
throw Error(
|
|
"Missing owner for string ref " +
|
|
returnFiber +
|
|
". This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
var resolvedInst = inst,
|
|
stringRef = "" + returnFiber;
|
|
if (
|
|
null !== current &&
|
|
null !== current.ref &&
|
|
"function" === typeof current.ref &&
|
|
current.ref._stringRef === stringRef
|
|
)
|
|
return current.ref;
|
|
current = function(value) {
|
|
var refs = resolvedInst.refs;
|
|
refs === emptyRefsObject && (refs = resolvedInst.refs = {});
|
|
null === value ? delete refs[stringRef] : (refs[stringRef] = value);
|
|
};
|
|
current._stringRef = stringRef;
|
|
return current;
|
|
}
|
|
if ("string" !== typeof returnFiber)
|
|
throw Error(
|
|
"Expected ref to be a function, a string, an object returned by React.createRef(), or null."
|
|
);
|
|
if (!element._owner)
|
|
throw Error(
|
|
"Element ref was specified as a string (" +
|
|
returnFiber +
|
|
") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information."
|
|
);
|
|
}
|
|
return returnFiber;
|
|
}
|
|
function throwOnInvalidObjectType(returnFiber, newChild) {
|
|
returnFiber = Object.prototype.toString.call(newChild);
|
|
throw Error(
|
|
"Objects are not valid as a React child (found: " +
|
|
("[object Object]" === returnFiber
|
|
? "object with keys {" + Object.keys(newChild).join(", ") + "}"
|
|
: returnFiber) +
|
|
"). If you meant to render a collection of children, use an array instead."
|
|
);
|
|
}
|
|
function resolveLazy(lazyType) {
|
|
var init = lazyType._init;
|
|
return init(lazyType._payload);
|
|
}
|
|
function ChildReconciler(shouldTrackSideEffects) {
|
|
function deleteChild(returnFiber, childToDelete) {
|
|
if (shouldTrackSideEffects) {
|
|
var deletions = returnFiber.deletions;
|
|
null === deletions
|
|
? ((returnFiber.deletions = [childToDelete]), (returnFiber.flags |= 16))
|
|
: deletions.push(childToDelete);
|
|
}
|
|
}
|
|
function deleteRemainingChildren(returnFiber, currentFirstChild) {
|
|
if (!shouldTrackSideEffects) return null;
|
|
for (; null !== currentFirstChild; )
|
|
deleteChild(returnFiber, currentFirstChild),
|
|
(currentFirstChild = currentFirstChild.sibling);
|
|
return null;
|
|
}
|
|
function mapRemainingChildren(returnFiber, currentFirstChild) {
|
|
for (returnFiber = new Map(); null !== currentFirstChild; )
|
|
null !== currentFirstChild.key
|
|
? returnFiber.set(currentFirstChild.key, currentFirstChild)
|
|
: returnFiber.set(currentFirstChild.index, currentFirstChild),
|
|
(currentFirstChild = currentFirstChild.sibling);
|
|
return returnFiber;
|
|
}
|
|
function useFiber(fiber, pendingProps) {
|
|
fiber = createWorkInProgress(fiber, pendingProps);
|
|
fiber.index = 0;
|
|
fiber.sibling = null;
|
|
return fiber;
|
|
}
|
|
function placeChild(newFiber, lastPlacedIndex, newIndex) {
|
|
newFiber.index = newIndex;
|
|
if (!shouldTrackSideEffects)
|
|
return (newFiber.flags |= 1048576), lastPlacedIndex;
|
|
newIndex = newFiber.alternate;
|
|
if (null !== newIndex)
|
|
return (
|
|
(newIndex = newIndex.index),
|
|
newIndex < lastPlacedIndex
|
|
? ((newFiber.flags |= 2), lastPlacedIndex)
|
|
: newIndex
|
|
);
|
|
newFiber.flags |= 2;
|
|
return lastPlacedIndex;
|
|
}
|
|
function placeSingleChild(newFiber) {
|
|
shouldTrackSideEffects &&
|
|
null === newFiber.alternate &&
|
|
(newFiber.flags |= 2);
|
|
return newFiber;
|
|
}
|
|
function updateTextNode(returnFiber, current, textContent, lanes) {
|
|
if (null === current || 6 !== current.tag)
|
|
return (
|
|
(current = createFiberFromText(textContent, returnFiber.mode, lanes)),
|
|
(current.return = returnFiber),
|
|
current
|
|
);
|
|
current = useFiber(current, textContent);
|
|
current.return = returnFiber;
|
|
return current;
|
|
}
|
|
function updateElement(returnFiber, current, element, lanes) {
|
|
var elementType = element.type;
|
|
if (elementType === REACT_FRAGMENT_TYPE)
|
|
return updateFragment(
|
|
returnFiber,
|
|
current,
|
|
element.props.children,
|
|
lanes,
|
|
element.key
|
|
);
|
|
if (
|
|
null !== current &&
|
|
(current.elementType === elementType ||
|
|
("object" === typeof elementType &&
|
|
null !== elementType &&
|
|
elementType.$$typeof === REACT_LAZY_TYPE &&
|
|
resolveLazy(elementType) === current.type))
|
|
)
|
|
return (
|
|
(lanes = useFiber(current, element.props)),
|
|
(lanes.ref = coerceRef(returnFiber, current, element)),
|
|
(lanes.return = returnFiber),
|
|
lanes
|
|
);
|
|
lanes = createFiberFromTypeAndProps(
|
|
element.type,
|
|
element.key,
|
|
element.props,
|
|
null,
|
|
returnFiber.mode,
|
|
lanes
|
|
);
|
|
lanes.ref = coerceRef(returnFiber, current, element);
|
|
lanes.return = returnFiber;
|
|
return lanes;
|
|
}
|
|
function updatePortal(returnFiber, current, portal, lanes) {
|
|
if (
|
|
null === current ||
|
|
4 !== current.tag ||
|
|
current.stateNode.containerInfo !== portal.containerInfo ||
|
|
current.stateNode.implementation !== portal.implementation
|
|
)
|
|
return (
|
|
(current = createFiberFromPortal(portal, returnFiber.mode, lanes)),
|
|
(current.return = returnFiber),
|
|
current
|
|
);
|
|
current = useFiber(current, portal.children || []);
|
|
current.return = returnFiber;
|
|
return current;
|
|
}
|
|
function updateFragment(returnFiber, current, fragment, lanes, key) {
|
|
if (null === current || 7 !== current.tag)
|
|
return (
|
|
(current = createFiberFromFragment(
|
|
fragment,
|
|
returnFiber.mode,
|
|
lanes,
|
|
key
|
|
)),
|
|
(current.return = returnFiber),
|
|
current
|
|
);
|
|
current = useFiber(current, fragment);
|
|
current.return = returnFiber;
|
|
return current;
|
|
}
|
|
function createChild(returnFiber, newChild, lanes) {
|
|
if (
|
|
("string" === typeof newChild && "" !== newChild) ||
|
|
"number" === typeof newChild
|
|
)
|
|
return (
|
|
(newChild = createFiberFromText(
|
|
"" + newChild,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
(newChild.return = returnFiber),
|
|
newChild
|
|
);
|
|
if ("object" === typeof newChild && null !== newChild) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
return (
|
|
(lanes = createFiberFromTypeAndProps(
|
|
newChild.type,
|
|
newChild.key,
|
|
newChild.props,
|
|
null,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
(lanes.ref = coerceRef(returnFiber, null, newChild)),
|
|
(lanes.return = returnFiber),
|
|
lanes
|
|
);
|
|
case REACT_PORTAL_TYPE:
|
|
return (
|
|
(newChild = createFiberFromPortal(
|
|
newChild,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
(newChild.return = returnFiber),
|
|
newChild
|
|
);
|
|
case REACT_LAZY_TYPE:
|
|
var init = newChild._init;
|
|
return createChild(returnFiber, init(newChild._payload), lanes);
|
|
}
|
|
if (isArrayImpl(newChild) || getIteratorFn(newChild))
|
|
return (
|
|
(newChild = createFiberFromFragment(
|
|
newChild,
|
|
returnFiber.mode,
|
|
lanes,
|
|
null
|
|
)),
|
|
(newChild.return = returnFiber),
|
|
newChild
|
|
);
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
return null;
|
|
}
|
|
function updateSlot(returnFiber, oldFiber, newChild, lanes) {
|
|
var key = null !== oldFiber ? oldFiber.key : null;
|
|
if (
|
|
("string" === typeof newChild && "" !== newChild) ||
|
|
"number" === typeof newChild
|
|
)
|
|
return null !== key
|
|
? null
|
|
: updateTextNode(returnFiber, oldFiber, "" + newChild, lanes);
|
|
if ("object" === typeof newChild && null !== newChild) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
return newChild.key === key
|
|
? updateElement(returnFiber, oldFiber, newChild, lanes)
|
|
: null;
|
|
case REACT_PORTAL_TYPE:
|
|
return newChild.key === key
|
|
? updatePortal(returnFiber, oldFiber, newChild, lanes)
|
|
: null;
|
|
case REACT_LAZY_TYPE:
|
|
return (
|
|
(key = newChild._init),
|
|
updateSlot(returnFiber, oldFiber, key(newChild._payload), lanes)
|
|
);
|
|
}
|
|
if (isArrayImpl(newChild) || getIteratorFn(newChild))
|
|
return null !== key
|
|
? null
|
|
: updateFragment(returnFiber, oldFiber, newChild, lanes, null);
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
return null;
|
|
}
|
|
function updateFromMap(
|
|
existingChildren,
|
|
returnFiber,
|
|
newIdx,
|
|
newChild,
|
|
lanes
|
|
) {
|
|
if (
|
|
("string" === typeof newChild && "" !== newChild) ||
|
|
"number" === typeof newChild
|
|
)
|
|
return (
|
|
(existingChildren = existingChildren.get(newIdx) || null),
|
|
updateTextNode(returnFiber, existingChildren, "" + newChild, lanes)
|
|
);
|
|
if ("object" === typeof newChild && null !== newChild) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
return (
|
|
(existingChildren =
|
|
existingChildren.get(
|
|
null === newChild.key ? newIdx : newChild.key
|
|
) || null),
|
|
updateElement(returnFiber, existingChildren, newChild, lanes)
|
|
);
|
|
case REACT_PORTAL_TYPE:
|
|
return (
|
|
(existingChildren =
|
|
existingChildren.get(
|
|
null === newChild.key ? newIdx : newChild.key
|
|
) || null),
|
|
updatePortal(returnFiber, existingChildren, newChild, lanes)
|
|
);
|
|
case REACT_LAZY_TYPE:
|
|
var init = newChild._init;
|
|
return updateFromMap(
|
|
existingChildren,
|
|
returnFiber,
|
|
newIdx,
|
|
init(newChild._payload),
|
|
lanes
|
|
);
|
|
}
|
|
if (isArrayImpl(newChild) || getIteratorFn(newChild))
|
|
return (
|
|
(existingChildren = existingChildren.get(newIdx) || null),
|
|
updateFragment(returnFiber, existingChildren, newChild, lanes, null)
|
|
);
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
return null;
|
|
}
|
|
function reconcileChildrenArray(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChildren,
|
|
lanes
|
|
) {
|
|
for (
|
|
var resultingFirstChild = null,
|
|
previousNewFiber = null,
|
|
oldFiber = currentFirstChild,
|
|
newIdx = (currentFirstChild = 0),
|
|
nextOldFiber = null;
|
|
null !== oldFiber && newIdx < newChildren.length;
|
|
newIdx++
|
|
) {
|
|
oldFiber.index > newIdx
|
|
? ((nextOldFiber = oldFiber), (oldFiber = null))
|
|
: (nextOldFiber = oldFiber.sibling);
|
|
var newFiber = updateSlot(
|
|
returnFiber,
|
|
oldFiber,
|
|
newChildren[newIdx],
|
|
lanes
|
|
);
|
|
if (null === newFiber) {
|
|
null === oldFiber && (oldFiber = nextOldFiber);
|
|
break;
|
|
}
|
|
shouldTrackSideEffects &&
|
|
oldFiber &&
|
|
null === newFiber.alternate &&
|
|
deleteChild(returnFiber, oldFiber);
|
|
currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx);
|
|
null === previousNewFiber
|
|
? (resultingFirstChild = newFiber)
|
|
: (previousNewFiber.sibling = newFiber);
|
|
previousNewFiber = newFiber;
|
|
oldFiber = nextOldFiber;
|
|
}
|
|
if (newIdx === newChildren.length)
|
|
return (
|
|
deleteRemainingChildren(returnFiber, oldFiber), resultingFirstChild
|
|
);
|
|
if (null === oldFiber) {
|
|
for (; newIdx < newChildren.length; newIdx++)
|
|
(oldFiber = createChild(returnFiber, newChildren[newIdx], lanes)),
|
|
null !== oldFiber &&
|
|
((currentFirstChild = placeChild(
|
|
oldFiber,
|
|
currentFirstChild,
|
|
newIdx
|
|
)),
|
|
null === previousNewFiber
|
|
? (resultingFirstChild = oldFiber)
|
|
: (previousNewFiber.sibling = oldFiber),
|
|
(previousNewFiber = oldFiber));
|
|
return resultingFirstChild;
|
|
}
|
|
for (
|
|
oldFiber = mapRemainingChildren(returnFiber, oldFiber);
|
|
newIdx < newChildren.length;
|
|
newIdx++
|
|
)
|
|
(nextOldFiber = updateFromMap(
|
|
oldFiber,
|
|
returnFiber,
|
|
newIdx,
|
|
newChildren[newIdx],
|
|
lanes
|
|
)),
|
|
null !== nextOldFiber &&
|
|
(shouldTrackSideEffects &&
|
|
null !== nextOldFiber.alternate &&
|
|
oldFiber.delete(
|
|
null === nextOldFiber.key ? newIdx : nextOldFiber.key
|
|
),
|
|
(currentFirstChild = placeChild(
|
|
nextOldFiber,
|
|
currentFirstChild,
|
|
newIdx
|
|
)),
|
|
null === previousNewFiber
|
|
? (resultingFirstChild = nextOldFiber)
|
|
: (previousNewFiber.sibling = nextOldFiber),
|
|
(previousNewFiber = nextOldFiber));
|
|
shouldTrackSideEffects &&
|
|
oldFiber.forEach(function(child) {
|
|
return deleteChild(returnFiber, child);
|
|
});
|
|
return resultingFirstChild;
|
|
}
|
|
function reconcileChildrenIterator(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChildrenIterable,
|
|
lanes
|
|
) {
|
|
var iteratorFn = getIteratorFn(newChildrenIterable);
|
|
if ("function" !== typeof iteratorFn)
|
|
throw Error(
|
|
"An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
newChildrenIterable = iteratorFn.call(newChildrenIterable);
|
|
if (null == newChildrenIterable)
|
|
throw Error("An iterable object provided no iterator.");
|
|
for (
|
|
var previousNewFiber = (iteratorFn = null),
|
|
oldFiber = currentFirstChild,
|
|
newIdx = (currentFirstChild = 0),
|
|
nextOldFiber = null,
|
|
step = newChildrenIterable.next();
|
|
null !== oldFiber && !step.done;
|
|
newIdx++, step = newChildrenIterable.next()
|
|
) {
|
|
oldFiber.index > newIdx
|
|
? ((nextOldFiber = oldFiber), (oldFiber = null))
|
|
: (nextOldFiber = oldFiber.sibling);
|
|
var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes);
|
|
if (null === newFiber) {
|
|
null === oldFiber && (oldFiber = nextOldFiber);
|
|
break;
|
|
}
|
|
shouldTrackSideEffects &&
|
|
oldFiber &&
|
|
null === newFiber.alternate &&
|
|
deleteChild(returnFiber, oldFiber);
|
|
currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx);
|
|
null === previousNewFiber
|
|
? (iteratorFn = newFiber)
|
|
: (previousNewFiber.sibling = newFiber);
|
|
previousNewFiber = newFiber;
|
|
oldFiber = nextOldFiber;
|
|
}
|
|
if (step.done)
|
|
return deleteRemainingChildren(returnFiber, oldFiber), iteratorFn;
|
|
if (null === oldFiber) {
|
|
for (; !step.done; newIdx++, step = newChildrenIterable.next())
|
|
(step = createChild(returnFiber, step.value, lanes)),
|
|
null !== step &&
|
|
((currentFirstChild = placeChild(step, currentFirstChild, newIdx)),
|
|
null === previousNewFiber
|
|
? (iteratorFn = step)
|
|
: (previousNewFiber.sibling = step),
|
|
(previousNewFiber = step));
|
|
return iteratorFn;
|
|
}
|
|
for (
|
|
oldFiber = mapRemainingChildren(returnFiber, oldFiber);
|
|
!step.done;
|
|
newIdx++, step = newChildrenIterable.next()
|
|
)
|
|
(step = updateFromMap(oldFiber, returnFiber, newIdx, step.value, lanes)),
|
|
null !== step &&
|
|
(shouldTrackSideEffects &&
|
|
null !== step.alternate &&
|
|
oldFiber.delete(null === step.key ? newIdx : step.key),
|
|
(currentFirstChild = placeChild(step, currentFirstChild, newIdx)),
|
|
null === previousNewFiber
|
|
? (iteratorFn = step)
|
|
: (previousNewFiber.sibling = step),
|
|
(previousNewFiber = step));
|
|
shouldTrackSideEffects &&
|
|
oldFiber.forEach(function(child) {
|
|
return deleteChild(returnFiber, child);
|
|
});
|
|
return iteratorFn;
|
|
}
|
|
function reconcileChildFibers(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChild,
|
|
lanes
|
|
) {
|
|
"object" === typeof newChild &&
|
|
null !== newChild &&
|
|
newChild.type === REACT_FRAGMENT_TYPE &&
|
|
null === newChild.key &&
|
|
(newChild = newChild.props.children);
|
|
if ("object" === typeof newChild && null !== newChild) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
a: {
|
|
for (
|
|
var key = newChild.key, child = currentFirstChild;
|
|
null !== child;
|
|
|
|
) {
|
|
if (child.key === key) {
|
|
key = newChild.type;
|
|
if (key === REACT_FRAGMENT_TYPE) {
|
|
if (7 === child.tag) {
|
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
currentFirstChild = useFiber(
|
|
child,
|
|
newChild.props.children
|
|
);
|
|
currentFirstChild.return = returnFiber;
|
|
returnFiber = currentFirstChild;
|
|
break a;
|
|
}
|
|
} else if (
|
|
child.elementType === key ||
|
|
("object" === typeof key &&
|
|
null !== key &&
|
|
key.$$typeof === REACT_LAZY_TYPE &&
|
|
resolveLazy(key) === child.type)
|
|
) {
|
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
currentFirstChild = useFiber(child, newChild.props);
|
|
currentFirstChild.ref = coerceRef(
|
|
returnFiber,
|
|
child,
|
|
newChild
|
|
);
|
|
currentFirstChild.return = returnFiber;
|
|
returnFiber = currentFirstChild;
|
|
break a;
|
|
}
|
|
deleteRemainingChildren(returnFiber, child);
|
|
break;
|
|
} else deleteChild(returnFiber, child);
|
|
child = child.sibling;
|
|
}
|
|
newChild.type === REACT_FRAGMENT_TYPE
|
|
? ((currentFirstChild = createFiberFromFragment(
|
|
newChild.props.children,
|
|
returnFiber.mode,
|
|
lanes,
|
|
newChild.key
|
|
)),
|
|
(currentFirstChild.return = returnFiber),
|
|
(returnFiber = currentFirstChild))
|
|
: ((lanes = createFiberFromTypeAndProps(
|
|
newChild.type,
|
|
newChild.key,
|
|
newChild.props,
|
|
null,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
(lanes.ref = coerceRef(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChild
|
|
)),
|
|
(lanes.return = returnFiber),
|
|
(returnFiber = lanes));
|
|
}
|
|
return placeSingleChild(returnFiber);
|
|
case REACT_PORTAL_TYPE:
|
|
a: {
|
|
for (child = newChild.key; null !== currentFirstChild; ) {
|
|
if (currentFirstChild.key === child)
|
|
if (
|
|
4 === currentFirstChild.tag &&
|
|
currentFirstChild.stateNode.containerInfo ===
|
|
newChild.containerInfo &&
|
|
currentFirstChild.stateNode.implementation ===
|
|
newChild.implementation
|
|
) {
|
|
deleteRemainingChildren(
|
|
returnFiber,
|
|
currentFirstChild.sibling
|
|
);
|
|
currentFirstChild = useFiber(
|
|
currentFirstChild,
|
|
newChild.children || []
|
|
);
|
|
currentFirstChild.return = returnFiber;
|
|
returnFiber = currentFirstChild;
|
|
break a;
|
|
} else {
|
|
deleteRemainingChildren(returnFiber, currentFirstChild);
|
|
break;
|
|
}
|
|
else deleteChild(returnFiber, currentFirstChild);
|
|
currentFirstChild = currentFirstChild.sibling;
|
|
}
|
|
currentFirstChild = createFiberFromPortal(
|
|
newChild,
|
|
returnFiber.mode,
|
|
lanes
|
|
);
|
|
currentFirstChild.return = returnFiber;
|
|
returnFiber = currentFirstChild;
|
|
}
|
|
return placeSingleChild(returnFiber);
|
|
case REACT_LAZY_TYPE:
|
|
return (
|
|
(child = newChild._init),
|
|
reconcileChildFibers(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
child(newChild._payload),
|
|
lanes
|
|
)
|
|
);
|
|
}
|
|
if (isArrayImpl(newChild))
|
|
return reconcileChildrenArray(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChild,
|
|
lanes
|
|
);
|
|
if (getIteratorFn(newChild))
|
|
return reconcileChildrenIterator(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChild,
|
|
lanes
|
|
);
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
return ("string" === typeof newChild && "" !== newChild) ||
|
|
"number" === typeof newChild
|
|
? ((newChild = "" + newChild),
|
|
null !== currentFirstChild && 6 === currentFirstChild.tag
|
|
? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling),
|
|
(currentFirstChild = useFiber(currentFirstChild, newChild)),
|
|
(currentFirstChild.return = returnFiber),
|
|
(returnFiber = currentFirstChild))
|
|
: (deleteRemainingChildren(returnFiber, currentFirstChild),
|
|
(currentFirstChild = createFiberFromText(
|
|
newChild,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
(currentFirstChild.return = returnFiber),
|
|
(returnFiber = currentFirstChild)),
|
|
placeSingleChild(returnFiber))
|
|
: deleteRemainingChildren(returnFiber, currentFirstChild);
|
|
}
|
|
return reconcileChildFibers;
|
|
}
|
|
var reconcileChildFibers = ChildReconciler(!0),
|
|
mountChildFibers = ChildReconciler(!1),
|
|
NO_CONTEXT = {},
|
|
contextStackCursor$1 = createCursor(NO_CONTEXT),
|
|
contextFiberStackCursor = createCursor(NO_CONTEXT),
|
|
rootInstanceStackCursor = createCursor(NO_CONTEXT);
|
|
function requiredContext(c) {
|
|
if (c === NO_CONTEXT)
|
|
throw Error(
|
|
"Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
return c;
|
|
}
|
|
function pushHostContainer(fiber, nextRootInstance) {
|
|
push(rootInstanceStackCursor, nextRootInstance);
|
|
push(contextFiberStackCursor, fiber);
|
|
push(contextStackCursor$1, NO_CONTEXT);
|
|
pop(contextStackCursor$1);
|
|
push(contextStackCursor$1, { isInAParentText: !1 });
|
|
}
|
|
function popHostContainer() {
|
|
pop(contextStackCursor$1);
|
|
pop(contextFiberStackCursor);
|
|
pop(rootInstanceStackCursor);
|
|
}
|
|
function pushHostContext(fiber) {
|
|
requiredContext(rootInstanceStackCursor.current);
|
|
var context = requiredContext(contextStackCursor$1.current);
|
|
var JSCompiler_inline_result = fiber.type;
|
|
JSCompiler_inline_result =
|
|
"AndroidTextInput" === JSCompiler_inline_result ||
|
|
"RCTMultilineTextInputView" === JSCompiler_inline_result ||
|
|
"RCTSinglelineTextInputView" === JSCompiler_inline_result ||
|
|
"RCTText" === JSCompiler_inline_result ||
|
|
"RCTVirtualText" === JSCompiler_inline_result;
|
|
JSCompiler_inline_result =
|
|
context.isInAParentText !== JSCompiler_inline_result
|
|
? { isInAParentText: JSCompiler_inline_result }
|
|
: context;
|
|
context !== JSCompiler_inline_result &&
|
|
(push(contextFiberStackCursor, fiber),
|
|
push(contextStackCursor$1, JSCompiler_inline_result));
|
|
}
|
|
function popHostContext(fiber) {
|
|
contextFiberStackCursor.current === fiber &&
|
|
(pop(contextStackCursor$1), pop(contextFiberStackCursor));
|
|
}
|
|
var suspenseStackCursor = createCursor(0);
|
|
function findFirstSuspended(row) {
|
|
for (var node = row; null !== node; ) {
|
|
if (13 === node.tag) {
|
|
var state = node.memoizedState;
|
|
if (null !== state && (null === state.dehydrated || shim() || shim()))
|
|
return node;
|
|
} else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) {
|
|
if (0 !== (node.flags & 128)) return node;
|
|
} else if (null !== node.child) {
|
|
node.child.return = node;
|
|
node = node.child;
|
|
continue;
|
|
}
|
|
if (node === row) break;
|
|
for (; null === node.sibling; ) {
|
|
if (null === node.return || node.return === row) return null;
|
|
node = node.return;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
}
|
|
return null;
|
|
}
|
|
var workInProgressSources = [];
|
|
function resetWorkInProgressVersions() {
|
|
for (var i = 0; i < workInProgressSources.length; i++)
|
|
workInProgressSources[i]._workInProgressVersionPrimary = null;
|
|
workInProgressSources.length = 0;
|
|
}
|
|
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
|
|
ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig,
|
|
renderLanes = 0,
|
|
currentlyRenderingFiber$1 = null,
|
|
currentHook = null,
|
|
workInProgressHook = null,
|
|
didScheduleRenderPhaseUpdate = !1,
|
|
didScheduleRenderPhaseUpdateDuringThisPass = !1,
|
|
globalClientIdCounter = 0;
|
|
function throwInvalidHookError() {
|
|
throw Error(
|
|
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."
|
|
);
|
|
}
|
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
if (null === prevDeps) return !1;
|
|
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
|
|
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
|
|
return !0;
|
|
}
|
|
function renderWithHooks(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
props,
|
|
secondArg,
|
|
nextRenderLanes
|
|
) {
|
|
renderLanes = nextRenderLanes;
|
|
currentlyRenderingFiber$1 = workInProgress;
|
|
workInProgress.memoizedState = null;
|
|
workInProgress.updateQueue = null;
|
|
workInProgress.lanes = 0;
|
|
ReactCurrentDispatcher$1.current =
|
|
null === current || null === current.memoizedState
|
|
? HooksDispatcherOnMount
|
|
: HooksDispatcherOnUpdate;
|
|
current = Component(props, secondArg);
|
|
if (didScheduleRenderPhaseUpdateDuringThisPass) {
|
|
nextRenderLanes = 0;
|
|
do {
|
|
didScheduleRenderPhaseUpdateDuringThisPass = !1;
|
|
if (25 <= nextRenderLanes)
|
|
throw Error(
|
|
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
|
|
);
|
|
nextRenderLanes += 1;
|
|
workInProgressHook = currentHook = null;
|
|
workInProgress.updateQueue = null;
|
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
|
|
current = Component(props, secondArg);
|
|
} while (didScheduleRenderPhaseUpdateDuringThisPass);
|
|
}
|
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
workInProgress = null !== currentHook && null !== currentHook.next;
|
|
renderLanes = 0;
|
|
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
|
|
didScheduleRenderPhaseUpdate = !1;
|
|
if (workInProgress)
|
|
throw Error(
|
|
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
|
|
);
|
|
return current;
|
|
}
|
|
function mountWorkInProgressHook() {
|
|
var hook = {
|
|
memoizedState: null,
|
|
baseState: null,
|
|
baseQueue: null,
|
|
queue: null,
|
|
next: null
|
|
};
|
|
null === workInProgressHook
|
|
? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook)
|
|
: (workInProgressHook = workInProgressHook.next = hook);
|
|
return workInProgressHook;
|
|
}
|
|
function updateWorkInProgressHook() {
|
|
if (null === currentHook) {
|
|
var nextCurrentHook = currentlyRenderingFiber$1.alternate;
|
|
nextCurrentHook =
|
|
null !== nextCurrentHook ? nextCurrentHook.memoizedState : null;
|
|
} else nextCurrentHook = currentHook.next;
|
|
var nextWorkInProgressHook =
|
|
null === workInProgressHook
|
|
? currentlyRenderingFiber$1.memoizedState
|
|
: workInProgressHook.next;
|
|
if (null !== nextWorkInProgressHook)
|
|
(workInProgressHook = nextWorkInProgressHook),
|
|
(currentHook = nextCurrentHook);
|
|
else {
|
|
if (null === nextCurrentHook)
|
|
throw Error("Rendered more hooks than during the previous render.");
|
|
currentHook = nextCurrentHook;
|
|
nextCurrentHook = {
|
|
memoizedState: currentHook.memoizedState,
|
|
baseState: currentHook.baseState,
|
|
baseQueue: currentHook.baseQueue,
|
|
queue: currentHook.queue,
|
|
next: null
|
|
};
|
|
null === workInProgressHook
|
|
? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = nextCurrentHook)
|
|
: (workInProgressHook = workInProgressHook.next = nextCurrentHook);
|
|
}
|
|
return workInProgressHook;
|
|
}
|
|
function basicStateReducer(state, action) {
|
|
return "function" === typeof action ? action(state) : action;
|
|
}
|
|
function updateReducer(reducer) {
|
|
var hook = updateWorkInProgressHook(),
|
|
queue = hook.queue;
|
|
if (null === queue)
|
|
throw Error(
|
|
"Should have a queue. This is likely a bug in React. Please file an issue."
|
|
);
|
|
queue.lastRenderedReducer = reducer;
|
|
var current = currentHook,
|
|
baseQueue = current.baseQueue,
|
|
pendingQueue = queue.pending;
|
|
if (null !== pendingQueue) {
|
|
if (null !== baseQueue) {
|
|
var baseFirst = baseQueue.next;
|
|
baseQueue.next = pendingQueue.next;
|
|
pendingQueue.next = baseFirst;
|
|
}
|
|
current.baseQueue = baseQueue = pendingQueue;
|
|
queue.pending = null;
|
|
}
|
|
if (null !== baseQueue) {
|
|
pendingQueue = baseQueue.next;
|
|
current = current.baseState;
|
|
var newBaseQueueFirst = (baseFirst = null),
|
|
newBaseQueueLast = null,
|
|
update = pendingQueue;
|
|
do {
|
|
var updateLane = update.lane;
|
|
if ((renderLanes & updateLane) === updateLane)
|
|
null !== newBaseQueueLast &&
|
|
(newBaseQueueLast = newBaseQueueLast.next = {
|
|
lane: 0,
|
|
action: update.action,
|
|
hasEagerState: update.hasEagerState,
|
|
eagerState: update.eagerState,
|
|
next: null
|
|
}),
|
|
(current = update.hasEagerState
|
|
? update.eagerState
|
|
: reducer(current, update.action));
|
|
else {
|
|
var clone = {
|
|
lane: updateLane,
|
|
action: update.action,
|
|
hasEagerState: update.hasEagerState,
|
|
eagerState: update.eagerState,
|
|
next: null
|
|
};
|
|
null === newBaseQueueLast
|
|
? ((newBaseQueueFirst = newBaseQueueLast = clone),
|
|
(baseFirst = current))
|
|
: (newBaseQueueLast = newBaseQueueLast.next = clone);
|
|
currentlyRenderingFiber$1.lanes |= updateLane;
|
|
workInProgressRootSkippedLanes |= updateLane;
|
|
}
|
|
update = update.next;
|
|
} while (null !== update && update !== pendingQueue);
|
|
null === newBaseQueueLast
|
|
? (baseFirst = current)
|
|
: (newBaseQueueLast.next = newBaseQueueFirst);
|
|
objectIs(current, hook.memoizedState) || (didReceiveUpdate = !0);
|
|
hook.memoizedState = current;
|
|
hook.baseState = baseFirst;
|
|
hook.baseQueue = newBaseQueueLast;
|
|
queue.lastRenderedState = current;
|
|
}
|
|
reducer = queue.interleaved;
|
|
if (null !== reducer) {
|
|
baseQueue = reducer;
|
|
do
|
|
(pendingQueue = baseQueue.lane),
|
|
(currentlyRenderingFiber$1.lanes |= pendingQueue),
|
|
(workInProgressRootSkippedLanes |= pendingQueue),
|
|
(baseQueue = baseQueue.next);
|
|
while (baseQueue !== reducer);
|
|
} else null === baseQueue && (queue.lanes = 0);
|
|
return [hook.memoizedState, queue.dispatch];
|
|
}
|
|
function rerenderReducer(reducer) {
|
|
var hook = updateWorkInProgressHook(),
|
|
queue = hook.queue;
|
|
if (null === queue)
|
|
throw Error(
|
|
"Should have a queue. This is likely a bug in React. Please file an issue."
|
|
);
|
|
queue.lastRenderedReducer = reducer;
|
|
var dispatch = queue.dispatch,
|
|
lastRenderPhaseUpdate = queue.pending,
|
|
newState = hook.memoizedState;
|
|
if (null !== lastRenderPhaseUpdate) {
|
|
queue.pending = null;
|
|
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
|
|
do (newState = reducer(newState, update.action)), (update = update.next);
|
|
while (update !== lastRenderPhaseUpdate);
|
|
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
|
|
hook.memoizedState = newState;
|
|
null === hook.baseQueue && (hook.baseState = newState);
|
|
queue.lastRenderedState = newState;
|
|
}
|
|
return [newState, dispatch];
|
|
}
|
|
function updateMutableSource() {}
|
|
function updateSyncExternalStore(subscribe, getSnapshot) {
|
|
var fiber = currentlyRenderingFiber$1,
|
|
hook = updateWorkInProgressHook(),
|
|
nextSnapshot = getSnapshot(),
|
|
snapshotChanged = !objectIs(hook.memoizedState, nextSnapshot);
|
|
snapshotChanged &&
|
|
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
|
hook = hook.queue;
|
|
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
|
subscribe
|
|
]);
|
|
if (
|
|
hook.getSnapshot !== getSnapshot ||
|
|
snapshotChanged ||
|
|
(null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1)
|
|
) {
|
|
fiber.flags |= 2048;
|
|
pushEffect(
|
|
9,
|
|
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
|
void 0,
|
|
null
|
|
);
|
|
if (null === workInProgressRoot)
|
|
throw Error(
|
|
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
|
);
|
|
0 !== (renderLanes & 30) ||
|
|
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
|
}
|
|
return nextSnapshot;
|
|
}
|
|
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
|
fiber.flags |= 16384;
|
|
fiber = { getSnapshot: getSnapshot, value: renderedSnapshot };
|
|
getSnapshot = currentlyRenderingFiber$1.updateQueue;
|
|
null === getSnapshot
|
|
? ((getSnapshot = { lastEffect: null, stores: null }),
|
|
(currentlyRenderingFiber$1.updateQueue = getSnapshot),
|
|
(getSnapshot.stores = [fiber]))
|
|
: ((renderedSnapshot = getSnapshot.stores),
|
|
null === renderedSnapshot
|
|
? (getSnapshot.stores = [fiber])
|
|
: renderedSnapshot.push(fiber));
|
|
}
|
|
function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) {
|
|
inst.value = nextSnapshot;
|
|
inst.getSnapshot = getSnapshot;
|
|
checkIfSnapshotChanged(inst) && forceStoreRerender(fiber);
|
|
}
|
|
function subscribeToStore(fiber, inst, subscribe) {
|
|
return subscribe(function() {
|
|
checkIfSnapshotChanged(inst) && forceStoreRerender(fiber);
|
|
});
|
|
}
|
|
function checkIfSnapshotChanged(inst) {
|
|
var latestGetSnapshot = inst.getSnapshot;
|
|
inst = inst.value;
|
|
try {
|
|
var nextValue = latestGetSnapshot();
|
|
return !objectIs(inst, nextValue);
|
|
} catch (error) {
|
|
return !0;
|
|
}
|
|
}
|
|
function forceStoreRerender(fiber) {
|
|
var root = markUpdateLaneFromFiberToRoot(fiber, 1);
|
|
null !== root && scheduleUpdateOnFiber(root, fiber, 1, -1);
|
|
}
|
|
function mountState(initialState) {
|
|
var hook = mountWorkInProgressHook();
|
|
"function" === typeof initialState && (initialState = initialState());
|
|
hook.memoizedState = hook.baseState = initialState;
|
|
initialState = {
|
|
pending: null,
|
|
interleaved: null,
|
|
lanes: 0,
|
|
dispatch: null,
|
|
lastRenderedReducer: basicStateReducer,
|
|
lastRenderedState: initialState
|
|
};
|
|
hook.queue = initialState;
|
|
initialState = initialState.dispatch = dispatchSetState.bind(
|
|
null,
|
|
currentlyRenderingFiber$1,
|
|
initialState
|
|
);
|
|
return [hook.memoizedState, initialState];
|
|
}
|
|
function pushEffect(tag, create, destroy, deps) {
|
|
tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null };
|
|
create = currentlyRenderingFiber$1.updateQueue;
|
|
null === create
|
|
? ((create = { lastEffect: null, stores: null }),
|
|
(currentlyRenderingFiber$1.updateQueue = create),
|
|
(create.lastEffect = tag.next = tag))
|
|
: ((destroy = create.lastEffect),
|
|
null === destroy
|
|
? (create.lastEffect = tag.next = tag)
|
|
: ((deps = destroy.next),
|
|
(destroy.next = tag),
|
|
(tag.next = deps),
|
|
(create.lastEffect = tag)));
|
|
return tag;
|
|
}
|
|
function updateRef() {
|
|
return updateWorkInProgressHook().memoizedState;
|
|
}
|
|
function mountEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
var hook = mountWorkInProgressHook();
|
|
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
hook.memoizedState = pushEffect(
|
|
1 | hookFlags,
|
|
create,
|
|
void 0,
|
|
void 0 === deps ? null : deps
|
|
);
|
|
}
|
|
function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
var hook = updateWorkInProgressHook();
|
|
deps = void 0 === deps ? null : deps;
|
|
var destroy = void 0;
|
|
if (null !== currentHook) {
|
|
var prevEffect = currentHook.memoizedState;
|
|
destroy = prevEffect.destroy;
|
|
if (null !== deps && areHookInputsEqual(deps, prevEffect.deps)) {
|
|
hook.memoizedState = pushEffect(hookFlags, create, destroy, deps);
|
|
return;
|
|
}
|
|
}
|
|
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps);
|
|
}
|
|
function mountEffect(create, deps) {
|
|
return mountEffectImpl(8390656, 8, create, deps);
|
|
}
|
|
function updateEffect(create, deps) {
|
|
return updateEffectImpl(2048, 8, create, deps);
|
|
}
|
|
function updateInsertionEffect(create, deps) {
|
|
return updateEffectImpl(4, 2, create, deps);
|
|
}
|
|
function updateLayoutEffect(create, deps) {
|
|
return updateEffectImpl(4, 4, create, deps);
|
|
}
|
|
function imperativeHandleEffect(create, ref) {
|
|
if ("function" === typeof ref)
|
|
return (
|
|
(create = create()),
|
|
ref(create),
|
|
function() {
|
|
ref(null);
|
|
}
|
|
);
|
|
if (null !== ref && void 0 !== ref)
|
|
return (
|
|
(create = create()),
|
|
(ref.current = create),
|
|
function() {
|
|
ref.current = null;
|
|
}
|
|
);
|
|
}
|
|
function updateImperativeHandle(ref, create, deps) {
|
|
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
|
|
return updateEffectImpl(
|
|
4,
|
|
4,
|
|
imperativeHandleEffect.bind(null, create, ref),
|
|
deps
|
|
);
|
|
}
|
|
function mountDebugValue() {}
|
|
function updateCallback(callback, deps) {
|
|
var hook = updateWorkInProgressHook();
|
|
deps = void 0 === deps ? null : deps;
|
|
var prevState = hook.memoizedState;
|
|
if (
|
|
null !== prevState &&
|
|
null !== deps &&
|
|
areHookInputsEqual(deps, prevState[1])
|
|
)
|
|
return prevState[0];
|
|
hook.memoizedState = [callback, deps];
|
|
return callback;
|
|
}
|
|
function updateMemo(nextCreate, deps) {
|
|
var hook = updateWorkInProgressHook();
|
|
deps = void 0 === deps ? null : deps;
|
|
var prevState = hook.memoizedState;
|
|
if (
|
|
null !== prevState &&
|
|
null !== deps &&
|
|
areHookInputsEqual(deps, prevState[1])
|
|
)
|
|
return prevState[0];
|
|
nextCreate = nextCreate();
|
|
hook.memoizedState = [nextCreate, deps];
|
|
return nextCreate;
|
|
}
|
|
function updateDeferredValueImpl(hook, prevValue, value) {
|
|
if (0 === (renderLanes & 21))
|
|
return (
|
|
hook.baseState && ((hook.baseState = !1), (didReceiveUpdate = !0)),
|
|
(hook.memoizedState = value)
|
|
);
|
|
objectIs(value, prevValue) ||
|
|
((value = claimNextTransitionLane()),
|
|
(currentlyRenderingFiber$1.lanes |= value),
|
|
(workInProgressRootSkippedLanes |= value),
|
|
(hook.baseState = !0));
|
|
return prevValue;
|
|
}
|
|
function startTransition(setPending, callback) {
|
|
var previousPriority = currentUpdatePriority;
|
|
currentUpdatePriority =
|
|
0 !== previousPriority && 4 > previousPriority ? previousPriority : 4;
|
|
setPending(!0);
|
|
var prevTransition = ReactCurrentBatchConfig$1.transition;
|
|
ReactCurrentBatchConfig$1.transition = {};
|
|
try {
|
|
setPending(!1), callback();
|
|
} finally {
|
|
(currentUpdatePriority = previousPriority),
|
|
(ReactCurrentBatchConfig$1.transition = prevTransition);
|
|
}
|
|
}
|
|
function updateId() {
|
|
return updateWorkInProgressHook().memoizedState;
|
|
}
|
|
function dispatchReducerAction(fiber, queue, action) {
|
|
var lane = requestUpdateLane(fiber);
|
|
action = {
|
|
lane: lane,
|
|
action: action,
|
|
hasEagerState: !1,
|
|
eagerState: null,
|
|
next: null
|
|
};
|
|
if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, action);
|
|
else if (
|
|
((action = enqueueConcurrentHookUpdate(fiber, queue, action, lane)),
|
|
null !== action)
|
|
) {
|
|
var eventTime = requestEventTime();
|
|
scheduleUpdateOnFiber(action, fiber, lane, eventTime);
|
|
entangleTransitionUpdate(action, queue, lane);
|
|
}
|
|
}
|
|
function dispatchSetState(fiber, queue, action) {
|
|
var lane = requestUpdateLane(fiber),
|
|
update = {
|
|
lane: lane,
|
|
action: action,
|
|
hasEagerState: !1,
|
|
eagerState: null,
|
|
next: null
|
|
};
|
|
if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update);
|
|
else {
|
|
var alternate = fiber.alternate;
|
|
if (
|
|
0 === fiber.lanes &&
|
|
(null === alternate || 0 === alternate.lanes) &&
|
|
((alternate = queue.lastRenderedReducer), null !== alternate)
|
|
)
|
|
try {
|
|
var currentState = queue.lastRenderedState,
|
|
eagerState = alternate(currentState, action);
|
|
update.hasEagerState = !0;
|
|
update.eagerState = eagerState;
|
|
if (objectIs(eagerState, currentState)) {
|
|
var interleaved = queue.interleaved;
|
|
null === interleaved
|
|
? ((update.next = update), pushConcurrentUpdateQueue(queue))
|
|
: ((update.next = interleaved.next), (interleaved.next = update));
|
|
queue.interleaved = update;
|
|
return;
|
|
}
|
|
} catch (error) {
|
|
} finally {
|
|
}
|
|
action = enqueueConcurrentHookUpdate(fiber, queue, update, lane);
|
|
null !== action &&
|
|
((update = requestEventTime()),
|
|
scheduleUpdateOnFiber(action, fiber, lane, update),
|
|
entangleTransitionUpdate(action, queue, lane));
|
|
}
|
|
}
|
|
function isRenderPhaseUpdate(fiber) {
|
|
var alternate = fiber.alternate;
|
|
return (
|
|
fiber === currentlyRenderingFiber$1 ||
|
|
(null !== alternate && alternate === currentlyRenderingFiber$1)
|
|
);
|
|
}
|
|
function enqueueRenderPhaseUpdate(queue, update) {
|
|
didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0;
|
|
var pending = queue.pending;
|
|
null === pending
|
|
? (update.next = update)
|
|
: ((update.next = pending.next), (pending.next = update));
|
|
queue.pending = update;
|
|
}
|
|
function entangleTransitionUpdate(root, queue, lane) {
|
|
if (0 !== (lane & 4194240)) {
|
|
var queueLanes = queue.lanes;
|
|
queueLanes &= root.pendingLanes;
|
|
lane |= queueLanes;
|
|
queue.lanes = lane;
|
|
markRootEntangled(root, lane);
|
|
}
|
|
}
|
|
var ContextOnlyDispatcher = {
|
|
readContext: readContext,
|
|
useCallback: throwInvalidHookError,
|
|
useContext: throwInvalidHookError,
|
|
useEffect: throwInvalidHookError,
|
|
useImperativeHandle: throwInvalidHookError,
|
|
useInsertionEffect: throwInvalidHookError,
|
|
useLayoutEffect: throwInvalidHookError,
|
|
useMemo: throwInvalidHookError,
|
|
useReducer: throwInvalidHookError,
|
|
useRef: throwInvalidHookError,
|
|
useState: throwInvalidHookError,
|
|
useDebugValue: throwInvalidHookError,
|
|
useDeferredValue: throwInvalidHookError,
|
|
useTransition: throwInvalidHookError,
|
|
useMutableSource: throwInvalidHookError,
|
|
useSyncExternalStore: throwInvalidHookError,
|
|
useId: throwInvalidHookError,
|
|
unstable_isNewReconciler: !1
|
|
},
|
|
HooksDispatcherOnMount = {
|
|
readContext: readContext,
|
|
useCallback: function(callback, deps) {
|
|
mountWorkInProgressHook().memoizedState = [
|
|
callback,
|
|
void 0 === deps ? null : deps
|
|
];
|
|
return callback;
|
|
},
|
|
useContext: readContext,
|
|
useEffect: mountEffect,
|
|
useImperativeHandle: function(ref, create, deps) {
|
|
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
|
|
return mountEffectImpl(
|
|
4,
|
|
4,
|
|
imperativeHandleEffect.bind(null, create, ref),
|
|
deps
|
|
);
|
|
},
|
|
useLayoutEffect: function(create, deps) {
|
|
return mountEffectImpl(4, 4, create, deps);
|
|
},
|
|
useInsertionEffect: function(create, deps) {
|
|
return mountEffectImpl(4, 2, create, deps);
|
|
},
|
|
useMemo: function(nextCreate, deps) {
|
|
var hook = mountWorkInProgressHook();
|
|
deps = void 0 === deps ? null : deps;
|
|
nextCreate = nextCreate();
|
|
hook.memoizedState = [nextCreate, deps];
|
|
return nextCreate;
|
|
},
|
|
useReducer: function(reducer, initialArg, init) {
|
|
var hook = mountWorkInProgressHook();
|
|
initialArg = void 0 !== init ? init(initialArg) : initialArg;
|
|
hook.memoizedState = hook.baseState = initialArg;
|
|
reducer = {
|
|
pending: null,
|
|
interleaved: null,
|
|
lanes: 0,
|
|
dispatch: null,
|
|
lastRenderedReducer: reducer,
|
|
lastRenderedState: initialArg
|
|
};
|
|
hook.queue = reducer;
|
|
reducer = reducer.dispatch = dispatchReducerAction.bind(
|
|
null,
|
|
currentlyRenderingFiber$1,
|
|
reducer
|
|
);
|
|
return [hook.memoizedState, reducer];
|
|
},
|
|
useRef: function(initialValue) {
|
|
var hook = mountWorkInProgressHook();
|
|
initialValue = { current: initialValue };
|
|
return (hook.memoizedState = initialValue);
|
|
},
|
|
useState: mountState,
|
|
useDebugValue: mountDebugValue,
|
|
useDeferredValue: function(value) {
|
|
return (mountWorkInProgressHook().memoizedState = value);
|
|
},
|
|
useTransition: function() {
|
|
var _mountState = mountState(!1),
|
|
isPending = _mountState[0];
|
|
_mountState = startTransition.bind(null, _mountState[1]);
|
|
mountWorkInProgressHook().memoizedState = _mountState;
|
|
return [isPending, _mountState];
|
|
},
|
|
useMutableSource: function() {},
|
|
useSyncExternalStore: function(subscribe, getSnapshot) {
|
|
var fiber = currentlyRenderingFiber$1,
|
|
hook = mountWorkInProgressHook();
|
|
var nextSnapshot = getSnapshot();
|
|
if (null === workInProgressRoot)
|
|
throw Error(
|
|
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
|
);
|
|
0 !== (renderLanes & 30) ||
|
|
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
|
hook.memoizedState = nextSnapshot;
|
|
var inst = { value: nextSnapshot, getSnapshot: getSnapshot };
|
|
hook.queue = inst;
|
|
mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [
|
|
subscribe
|
|
]);
|
|
fiber.flags |= 2048;
|
|
pushEffect(
|
|
9,
|
|
updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot),
|
|
void 0,
|
|
null
|
|
);
|
|
return nextSnapshot;
|
|
},
|
|
useId: function() {
|
|
var hook = mountWorkInProgressHook(),
|
|
identifierPrefix = workInProgressRoot.identifierPrefix,
|
|
globalClientId = globalClientIdCounter++;
|
|
identifierPrefix =
|
|
":" + identifierPrefix + "r" + globalClientId.toString(32) + ":";
|
|
return (hook.memoizedState = identifierPrefix);
|
|
},
|
|
unstable_isNewReconciler: !1
|
|
},
|
|
HooksDispatcherOnUpdate = {
|
|
readContext: readContext,
|
|
useCallback: updateCallback,
|
|
useContext: readContext,
|
|
useEffect: updateEffect,
|
|
useImperativeHandle: updateImperativeHandle,
|
|
useInsertionEffect: updateInsertionEffect,
|
|
useLayoutEffect: updateLayoutEffect,
|
|
useMemo: updateMemo,
|
|
useReducer: updateReducer,
|
|
useRef: updateRef,
|
|
useState: function() {
|
|
return updateReducer(basicStateReducer);
|
|
},
|
|
useDebugValue: mountDebugValue,
|
|
useDeferredValue: function(value) {
|
|
var hook = updateWorkInProgressHook();
|
|
return updateDeferredValueImpl(hook, currentHook.memoizedState, value);
|
|
},
|
|
useTransition: function() {
|
|
var isPending = updateReducer(basicStateReducer)[0],
|
|
start = updateWorkInProgressHook().memoizedState;
|
|
return [isPending, start];
|
|
},
|
|
useMutableSource: updateMutableSource,
|
|
useSyncExternalStore: updateSyncExternalStore,
|
|
useId: updateId,
|
|
unstable_isNewReconciler: !1
|
|
},
|
|
HooksDispatcherOnRerender = {
|
|
readContext: readContext,
|
|
useCallback: updateCallback,
|
|
useContext: readContext,
|
|
useEffect: updateEffect,
|
|
useImperativeHandle: updateImperativeHandle,
|
|
useInsertionEffect: updateInsertionEffect,
|
|
useLayoutEffect: updateLayoutEffect,
|
|
useMemo: updateMemo,
|
|
useReducer: rerenderReducer,
|
|
useRef: updateRef,
|
|
useState: function() {
|
|
return rerenderReducer(basicStateReducer);
|
|
},
|
|
useDebugValue: mountDebugValue,
|
|
useDeferredValue: function(value) {
|
|
var hook = updateWorkInProgressHook();
|
|
return null === currentHook
|
|
? (hook.memoizedState = value)
|
|
: updateDeferredValueImpl(hook, currentHook.memoizedState, value);
|
|
},
|
|
useTransition: function() {
|
|
var isPending = rerenderReducer(basicStateReducer)[0],
|
|
start = updateWorkInProgressHook().memoizedState;
|
|
return [isPending, start];
|
|
},
|
|
useMutableSource: updateMutableSource,
|
|
useSyncExternalStore: updateSyncExternalStore,
|
|
useId: updateId,
|
|
unstable_isNewReconciler: !1
|
|
},
|
|
now$1 = Scheduler.unstable_now,
|
|
commitTime = 0,
|
|
layoutEffectStartTime = -1,
|
|
profilerStartTime = -1,
|
|
passiveEffectStartTime = -1,
|
|
currentUpdateIsNested = !1,
|
|
nestedUpdateScheduled = !1;
|
|
function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
|
|
if (0 <= profilerStartTime) {
|
|
var elapsedTime = now$1() - profilerStartTime;
|
|
fiber.actualDuration += elapsedTime;
|
|
overrideBaseTime && (fiber.selfBaseDuration = elapsedTime);
|
|
profilerStartTime = -1;
|
|
}
|
|
}
|
|
function recordLayoutEffectDuration(fiber) {
|
|
if (0 <= layoutEffectStartTime) {
|
|
var elapsedTime = now$1() - layoutEffectStartTime;
|
|
layoutEffectStartTime = -1;
|
|
for (fiber = fiber.return; null !== fiber; ) {
|
|
switch (fiber.tag) {
|
|
case 3:
|
|
fiber.stateNode.effectDuration += elapsedTime;
|
|
return;
|
|
case 12:
|
|
fiber.stateNode.effectDuration += elapsedTime;
|
|
return;
|
|
}
|
|
fiber = fiber.return;
|
|
}
|
|
}
|
|
}
|
|
function recordPassiveEffectDuration(fiber) {
|
|
if (0 <= passiveEffectStartTime) {
|
|
var elapsedTime = now$1() - passiveEffectStartTime;
|
|
passiveEffectStartTime = -1;
|
|
for (fiber = fiber.return; null !== fiber; ) {
|
|
switch (fiber.tag) {
|
|
case 3:
|
|
fiber = fiber.stateNode;
|
|
null !== fiber && (fiber.passiveEffectDuration += elapsedTime);
|
|
return;
|
|
case 12:
|
|
fiber = fiber.stateNode;
|
|
null !== fiber && (fiber.passiveEffectDuration += elapsedTime);
|
|
return;
|
|
}
|
|
fiber = fiber.return;
|
|
}
|
|
}
|
|
}
|
|
function startLayoutEffectTimer() {
|
|
layoutEffectStartTime = now$1();
|
|
}
|
|
function transferActualDuration(fiber) {
|
|
for (var child = fiber.child; child; )
|
|
(fiber.actualDuration += child.actualDuration), (child = child.sibling);
|
|
}
|
|
function createCapturedValueAtFiber(value, source) {
|
|
return {
|
|
value: value,
|
|
source: source,
|
|
stack: getStackByFiberInDevAndProd(source),
|
|
digest: null
|
|
};
|
|
}
|
|
function createCapturedValue(value, digest, stack) {
|
|
return {
|
|
value: value,
|
|
source: null,
|
|
stack: null != stack ? stack : null,
|
|
digest: null != digest ? digest : null
|
|
};
|
|
}
|
|
if (
|
|
"function" !==
|
|
typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog
|
|
)
|
|
throw Error(
|
|
"Expected ReactFiberErrorDialog.showErrorDialog to be a function."
|
|
);
|
|
function logCapturedError(boundary, errorInfo) {
|
|
try {
|
|
!1 !==
|
|
ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog({
|
|
componentStack: null !== errorInfo.stack ? errorInfo.stack : "",
|
|
error: errorInfo.value,
|
|
errorBoundary:
|
|
null !== boundary && 1 === boundary.tag ? boundary.stateNode : null
|
|
}) && console.error(errorInfo.value);
|
|
} catch (e) {
|
|
setTimeout(function() {
|
|
throw e;
|
|
});
|
|
}
|
|
}
|
|
var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map;
|
|
function createRootErrorUpdate(fiber, errorInfo, lane) {
|
|
lane = createUpdate(-1, lane);
|
|
lane.tag = 3;
|
|
lane.payload = { element: null };
|
|
var error = errorInfo.value;
|
|
lane.callback = function() {
|
|
hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error));
|
|
logCapturedError(fiber, errorInfo);
|
|
};
|
|
return lane;
|
|
}
|
|
function createClassErrorUpdate(fiber, errorInfo, lane) {
|
|
lane = createUpdate(-1, lane);
|
|
lane.tag = 3;
|
|
var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
|
|
if ("function" === typeof getDerivedStateFromError) {
|
|
var error = errorInfo.value;
|
|
lane.payload = function() {
|
|
return getDerivedStateFromError(error);
|
|
};
|
|
lane.callback = function() {
|
|
logCapturedError(fiber, errorInfo);
|
|
};
|
|
}
|
|
var inst = fiber.stateNode;
|
|
null !== inst &&
|
|
"function" === typeof inst.componentDidCatch &&
|
|
(lane.callback = function() {
|
|
logCapturedError(fiber, errorInfo);
|
|
"function" !== typeof getDerivedStateFromError &&
|
|
(null === legacyErrorBoundariesThatAlreadyFailed
|
|
? (legacyErrorBoundariesThatAlreadyFailed = new Set([this]))
|
|
: legacyErrorBoundariesThatAlreadyFailed.add(this));
|
|
var stack = errorInfo.stack;
|
|
this.componentDidCatch(errorInfo.value, {
|
|
componentStack: null !== stack ? stack : ""
|
|
});
|
|
});
|
|
return lane;
|
|
}
|
|
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) ||
|
|
(threadIDs.add(lanes),
|
|
(pingCache = pingSuspendedRoot.bind(null, root, wakeable, lanes)),
|
|
isDevToolsPresent && restorePendingUpdaters(root, lanes),
|
|
wakeable.then(pingCache, pingCache));
|
|
}
|
|
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner,
|
|
didReceiveUpdate = !1;
|
|
function reconcileChildren(current, workInProgress, nextChildren, renderLanes) {
|
|
workInProgress.child =
|
|
null === current
|
|
? mountChildFibers(workInProgress, null, nextChildren, renderLanes)
|
|
: reconcileChildFibers(
|
|
workInProgress,
|
|
current.child,
|
|
nextChildren,
|
|
renderLanes
|
|
);
|
|
}
|
|
function updateForwardRef(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
Component = Component.render;
|
|
var ref = workInProgress.ref;
|
|
prepareToReadContext(workInProgress, renderLanes);
|
|
nextProps = renderWithHooks(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
ref,
|
|
renderLanes
|
|
);
|
|
if (null !== current && !didReceiveUpdate)
|
|
return (
|
|
(workInProgress.updateQueue = current.updateQueue),
|
|
(workInProgress.flags &= -2053),
|
|
(current.lanes &= ~renderLanes),
|
|
bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)
|
|
);
|
|
workInProgress.flags |= 1;
|
|
reconcileChildren(current, workInProgress, nextProps, renderLanes);
|
|
return workInProgress.child;
|
|
}
|
|
function updateMemoComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
if (null === current) {
|
|
var type = Component.type;
|
|
if (
|
|
"function" === typeof type &&
|
|
!shouldConstruct(type) &&
|
|
void 0 === type.defaultProps &&
|
|
null === Component.compare &&
|
|
void 0 === Component.defaultProps
|
|
)
|
|
return (
|
|
(workInProgress.tag = 15),
|
|
(workInProgress.type = type),
|
|
updateSimpleMemoComponent(
|
|
current,
|
|
workInProgress,
|
|
type,
|
|
nextProps,
|
|
renderLanes
|
|
)
|
|
);
|
|
current = createFiberFromTypeAndProps(
|
|
Component.type,
|
|
null,
|
|
nextProps,
|
|
workInProgress,
|
|
workInProgress.mode,
|
|
renderLanes
|
|
);
|
|
current.ref = workInProgress.ref;
|
|
current.return = workInProgress;
|
|
return (workInProgress.child = current);
|
|
}
|
|
type = current.child;
|
|
if (0 === (current.lanes & renderLanes)) {
|
|
var prevProps = type.memoizedProps;
|
|
Component = Component.compare;
|
|
Component = null !== Component ? Component : shallowEqual;
|
|
if (Component(prevProps, nextProps) && current.ref === workInProgress.ref)
|
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
}
|
|
workInProgress.flags |= 1;
|
|
current = createWorkInProgress(type, nextProps);
|
|
current.ref = workInProgress.ref;
|
|
current.return = workInProgress;
|
|
return (workInProgress.child = current);
|
|
}
|
|
function updateSimpleMemoComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
if (null !== current) {
|
|
var prevProps = current.memoizedProps;
|
|
if (
|
|
shallowEqual(prevProps, nextProps) &&
|
|
current.ref === workInProgress.ref
|
|
)
|
|
if (
|
|
((didReceiveUpdate = !1),
|
|
(workInProgress.pendingProps = nextProps = prevProps),
|
|
0 !== (current.lanes & renderLanes))
|
|
)
|
|
0 !== (current.flags & 131072) && (didReceiveUpdate = !0);
|
|
else
|
|
return (
|
|
(workInProgress.lanes = current.lanes),
|
|
bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)
|
|
);
|
|
}
|
|
return updateFunctionComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
);
|
|
}
|
|
function updateOffscreenComponent(current, workInProgress, renderLanes) {
|
|
var nextProps = workInProgress.pendingProps,
|
|
nextChildren = nextProps.children,
|
|
prevState = null !== current ? current.memoizedState : null;
|
|
if ("hidden" === nextProps.mode)
|
|
if (0 === (workInProgress.mode & 1))
|
|
(workInProgress.memoizedState = {
|
|
baseLanes: 0,
|
|
cachePool: null,
|
|
transitions: null
|
|
}),
|
|
push(subtreeRenderLanesCursor, subtreeRenderLanes),
|
|
(subtreeRenderLanes |= renderLanes);
|
|
else {
|
|
if (0 === (renderLanes & 1073741824))
|
|
return (
|
|
(current =
|
|
null !== prevState
|
|
? prevState.baseLanes | renderLanes
|
|
: renderLanes),
|
|
(workInProgress.lanes = workInProgress.childLanes = 1073741824),
|
|
(workInProgress.memoizedState = {
|
|
baseLanes: current,
|
|
cachePool: null,
|
|
transitions: null
|
|
}),
|
|
(workInProgress.updateQueue = null),
|
|
push(subtreeRenderLanesCursor, subtreeRenderLanes),
|
|
(subtreeRenderLanes |= current),
|
|
null
|
|
);
|
|
workInProgress.memoizedState = {
|
|
baseLanes: 0,
|
|
cachePool: null,
|
|
transitions: null
|
|
};
|
|
nextProps = null !== prevState ? prevState.baseLanes : renderLanes;
|
|
push(subtreeRenderLanesCursor, subtreeRenderLanes);
|
|
subtreeRenderLanes |= nextProps;
|
|
}
|
|
else
|
|
null !== prevState
|
|
? ((nextProps = prevState.baseLanes | renderLanes),
|
|
(workInProgress.memoizedState = null))
|
|
: (nextProps = renderLanes),
|
|
push(subtreeRenderLanesCursor, subtreeRenderLanes),
|
|
(subtreeRenderLanes |= nextProps);
|
|
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
|
return workInProgress.child;
|
|
}
|
|
function markRef(current, workInProgress) {
|
|
var ref = workInProgress.ref;
|
|
if (
|
|
(null === current && null !== ref) ||
|
|
(null !== current && current.ref !== ref)
|
|
)
|
|
workInProgress.flags |= 512;
|
|
}
|
|
function updateFunctionComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
var context = isContextProvider(Component)
|
|
? previousContext
|
|
: contextStackCursor.current;
|
|
context = getMaskedContext(workInProgress, context);
|
|
prepareToReadContext(workInProgress, renderLanes);
|
|
Component = renderWithHooks(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
context,
|
|
renderLanes
|
|
);
|
|
if (null !== current && !didReceiveUpdate)
|
|
return (
|
|
(workInProgress.updateQueue = current.updateQueue),
|
|
(workInProgress.flags &= -2053),
|
|
(current.lanes &= ~renderLanes),
|
|
bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)
|
|
);
|
|
workInProgress.flags |= 1;
|
|
reconcileChildren(current, workInProgress, Component, renderLanes);
|
|
return workInProgress.child;
|
|
}
|
|
function updateClassComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
if (isContextProvider(Component)) {
|
|
var hasContext = !0;
|
|
pushContextProvider(workInProgress);
|
|
} else hasContext = !1;
|
|
prepareToReadContext(workInProgress, renderLanes);
|
|
if (null === workInProgress.stateNode)
|
|
resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress),
|
|
constructClassInstance(workInProgress, Component, nextProps),
|
|
mountClassInstance(workInProgress, Component, nextProps, renderLanes),
|
|
(nextProps = !0);
|
|
else if (null === current) {
|
|
var instance = workInProgress.stateNode,
|
|
oldProps = workInProgress.memoizedProps;
|
|
instance.props = oldProps;
|
|
var oldContext = instance.context,
|
|
contextType = Component.contextType;
|
|
"object" === typeof contextType && null !== contextType
|
|
? (contextType = readContext(contextType))
|
|
: ((contextType = isContextProvider(Component)
|
|
? previousContext
|
|
: contextStackCursor.current),
|
|
(contextType = getMaskedContext(workInProgress, contextType)));
|
|
var getDerivedStateFromProps = Component.getDerivedStateFromProps,
|
|
hasNewLifecycles =
|
|
"function" === typeof getDerivedStateFromProps ||
|
|
"function" === typeof instance.getSnapshotBeforeUpdate;
|
|
hasNewLifecycles ||
|
|
("function" !== typeof instance.UNSAFE_componentWillReceiveProps &&
|
|
"function" !== typeof instance.componentWillReceiveProps) ||
|
|
((oldProps !== nextProps || oldContext !== contextType) &&
|
|
callComponentWillReceiveProps(
|
|
workInProgress,
|
|
instance,
|
|
nextProps,
|
|
contextType
|
|
));
|
|
hasForceUpdate = !1;
|
|
var oldState = workInProgress.memoizedState;
|
|
instance.state = oldState;
|
|
processUpdateQueue(workInProgress, nextProps, instance, renderLanes);
|
|
oldContext = workInProgress.memoizedState;
|
|
oldProps !== nextProps ||
|
|
oldState !== oldContext ||
|
|
didPerformWorkStackCursor.current ||
|
|
hasForceUpdate
|
|
? ("function" === typeof getDerivedStateFromProps &&
|
|
(applyDerivedStateFromProps(
|
|
workInProgress,
|
|
Component,
|
|
getDerivedStateFromProps,
|
|
nextProps
|
|
),
|
|
(oldContext = workInProgress.memoizedState)),
|
|
(oldProps =
|
|
hasForceUpdate ||
|
|
checkShouldComponentUpdate(
|
|
workInProgress,
|
|
Component,
|
|
oldProps,
|
|
nextProps,
|
|
oldState,
|
|
oldContext,
|
|
contextType
|
|
))
|
|
? (hasNewLifecycles ||
|
|
("function" !== typeof instance.UNSAFE_componentWillMount &&
|
|
"function" !== typeof instance.componentWillMount) ||
|
|
("function" === typeof instance.componentWillMount &&
|
|
instance.componentWillMount(),
|
|
"function" === typeof instance.UNSAFE_componentWillMount &&
|
|
instance.UNSAFE_componentWillMount()),
|
|
"function" === typeof instance.componentDidMount &&
|
|
(workInProgress.flags |= 4))
|
|
: ("function" === typeof instance.componentDidMount &&
|
|
(workInProgress.flags |= 4),
|
|
(workInProgress.memoizedProps = nextProps),
|
|
(workInProgress.memoizedState = oldContext)),
|
|
(instance.props = nextProps),
|
|
(instance.state = oldContext),
|
|
(instance.context = contextType),
|
|
(nextProps = oldProps))
|
|
: ("function" === typeof instance.componentDidMount &&
|
|
(workInProgress.flags |= 4),
|
|
(nextProps = !1));
|
|
} else {
|
|
instance = workInProgress.stateNode;
|
|
cloneUpdateQueue(current, workInProgress);
|
|
oldProps = workInProgress.memoizedProps;
|
|
contextType =
|
|
workInProgress.type === workInProgress.elementType
|
|
? oldProps
|
|
: resolveDefaultProps(workInProgress.type, oldProps);
|
|
instance.props = contextType;
|
|
hasNewLifecycles = workInProgress.pendingProps;
|
|
oldState = instance.context;
|
|
oldContext = Component.contextType;
|
|
"object" === typeof oldContext && null !== oldContext
|
|
? (oldContext = readContext(oldContext))
|
|
: ((oldContext = isContextProvider(Component)
|
|
? previousContext
|
|
: contextStackCursor.current),
|
|
(oldContext = getMaskedContext(workInProgress, oldContext)));
|
|
var getDerivedStateFromProps$jscomp$0 = Component.getDerivedStateFromProps;
|
|
(getDerivedStateFromProps =
|
|
"function" === typeof getDerivedStateFromProps$jscomp$0 ||
|
|
"function" === typeof instance.getSnapshotBeforeUpdate) ||
|
|
("function" !== typeof instance.UNSAFE_componentWillReceiveProps &&
|
|
"function" !== typeof instance.componentWillReceiveProps) ||
|
|
((oldProps !== hasNewLifecycles || oldState !== oldContext) &&
|
|
callComponentWillReceiveProps(
|
|
workInProgress,
|
|
instance,
|
|
nextProps,
|
|
oldContext
|
|
));
|
|
hasForceUpdate = !1;
|
|
oldState = workInProgress.memoizedState;
|
|
instance.state = oldState;
|
|
processUpdateQueue(workInProgress, nextProps, instance, renderLanes);
|
|
var newState = workInProgress.memoizedState;
|
|
oldProps !== hasNewLifecycles ||
|
|
oldState !== newState ||
|
|
didPerformWorkStackCursor.current ||
|
|
hasForceUpdate
|
|
? ("function" === typeof getDerivedStateFromProps$jscomp$0 &&
|
|
(applyDerivedStateFromProps(
|
|
workInProgress,
|
|
Component,
|
|
getDerivedStateFromProps$jscomp$0,
|
|
nextProps
|
|
),
|
|
(newState = workInProgress.memoizedState)),
|
|
(contextType =
|
|
hasForceUpdate ||
|
|
checkShouldComponentUpdate(
|
|
workInProgress,
|
|
Component,
|
|
contextType,
|
|
nextProps,
|
|
oldState,
|
|
newState,
|
|
oldContext
|
|
) ||
|
|
!1)
|
|
? (getDerivedStateFromProps ||
|
|
("function" !== typeof instance.UNSAFE_componentWillUpdate &&
|
|
"function" !== typeof instance.componentWillUpdate) ||
|
|
("function" === typeof instance.componentWillUpdate &&
|
|
instance.componentWillUpdate(nextProps, newState, oldContext),
|
|
"function" === typeof instance.UNSAFE_componentWillUpdate &&
|
|
instance.UNSAFE_componentWillUpdate(
|
|
nextProps,
|
|
newState,
|
|
oldContext
|
|
)),
|
|
"function" === typeof instance.componentDidUpdate &&
|
|
(workInProgress.flags |= 4),
|
|
"function" === typeof instance.getSnapshotBeforeUpdate &&
|
|
(workInProgress.flags |= 1024))
|
|
: ("function" !== typeof instance.componentDidUpdate ||
|
|
(oldProps === current.memoizedProps &&
|
|
oldState === current.memoizedState) ||
|
|
(workInProgress.flags |= 4),
|
|
"function" !== typeof instance.getSnapshotBeforeUpdate ||
|
|
(oldProps === current.memoizedProps &&
|
|
oldState === current.memoizedState) ||
|
|
(workInProgress.flags |= 1024),
|
|
(workInProgress.memoizedProps = nextProps),
|
|
(workInProgress.memoizedState = newState)),
|
|
(instance.props = nextProps),
|
|
(instance.state = newState),
|
|
(instance.context = oldContext),
|
|
(nextProps = contextType))
|
|
: ("function" !== typeof instance.componentDidUpdate ||
|
|
(oldProps === current.memoizedProps &&
|
|
oldState === current.memoizedState) ||
|
|
(workInProgress.flags |= 4),
|
|
"function" !== typeof instance.getSnapshotBeforeUpdate ||
|
|
(oldProps === current.memoizedProps &&
|
|
oldState === current.memoizedState) ||
|
|
(workInProgress.flags |= 1024),
|
|
(nextProps = !1));
|
|
}
|
|
return finishClassComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
hasContext,
|
|
renderLanes
|
|
);
|
|
}
|
|
function finishClassComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
shouldUpdate,
|
|
hasContext,
|
|
renderLanes
|
|
) {
|
|
markRef(current, workInProgress);
|
|
var didCaptureError = 0 !== (workInProgress.flags & 128);
|
|
if (!shouldUpdate && !didCaptureError)
|
|
return (
|
|
hasContext && invalidateContextProvider(workInProgress, Component, !1),
|
|
bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)
|
|
);
|
|
shouldUpdate = workInProgress.stateNode;
|
|
ReactCurrentOwner$1.current = workInProgress;
|
|
if (
|
|
didCaptureError &&
|
|
"function" !== typeof Component.getDerivedStateFromError
|
|
) {
|
|
var nextChildren = null;
|
|
profilerStartTime = -1;
|
|
} else nextChildren = shouldUpdate.render();
|
|
workInProgress.flags |= 1;
|
|
null !== current && didCaptureError
|
|
? ((didCaptureError = nextChildren),
|
|
(workInProgress.child = reconcileChildFibers(
|
|
workInProgress,
|
|
current.child,
|
|
null,
|
|
renderLanes
|
|
)),
|
|
(workInProgress.child = reconcileChildFibers(
|
|
workInProgress,
|
|
null,
|
|
didCaptureError,
|
|
renderLanes
|
|
)))
|
|
: reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
|
workInProgress.memoizedState = shouldUpdate.state;
|
|
hasContext && invalidateContextProvider(workInProgress, Component, !0);
|
|
return workInProgress.child;
|
|
}
|
|
function pushHostRootContext(workInProgress) {
|
|
var root = workInProgress.stateNode;
|
|
root.pendingContext
|
|
? pushTopLevelContextObject(
|
|
workInProgress,
|
|
root.pendingContext,
|
|
root.pendingContext !== root.context
|
|
)
|
|
: root.context &&
|
|
pushTopLevelContextObject(workInProgress, root.context, !1);
|
|
pushHostContainer(workInProgress, root.containerInfo);
|
|
}
|
|
var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 };
|
|
function mountSuspenseOffscreenState(renderLanes) {
|
|
return { baseLanes: renderLanes, cachePool: null, transitions: null };
|
|
}
|
|
function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
var nextProps = workInProgress.pendingProps,
|
|
suspenseContext = suspenseStackCursor.current,
|
|
showFallback = !1,
|
|
didSuspend = 0 !== (workInProgress.flags & 128),
|
|
JSCompiler_temp;
|
|
(JSCompiler_temp = didSuspend) ||
|
|
(JSCompiler_temp =
|
|
null !== current && null === current.memoizedState
|
|
? !1
|
|
: 0 !== (suspenseContext & 2));
|
|
if (JSCompiler_temp) (showFallback = !0), (workInProgress.flags &= -129);
|
|
else if (null === current || null !== current.memoizedState)
|
|
suspenseContext |= 1;
|
|
push(suspenseStackCursor, suspenseContext & 1);
|
|
if (null === current) {
|
|
current = workInProgress.memoizedState;
|
|
if (null !== current && null !== current.dehydrated)
|
|
return (
|
|
0 === (workInProgress.mode & 1)
|
|
? (workInProgress.lanes = 1)
|
|
: shim()
|
|
? (workInProgress.lanes = 8)
|
|
: (workInProgress.lanes = 1073741824),
|
|
null
|
|
);
|
|
didSuspend = nextProps.children;
|
|
current = nextProps.fallback;
|
|
return showFallback
|
|
? ((nextProps = workInProgress.mode),
|
|
(showFallback = workInProgress.child),
|
|
(didSuspend = { mode: "hidden", children: didSuspend }),
|
|
0 === (nextProps & 1) && null !== showFallback
|
|
? ((showFallback.childLanes = 0),
|
|
(showFallback.pendingProps = didSuspend),
|
|
workInProgress.mode & 2 &&
|
|
((showFallback.actualDuration = 0),
|
|
(showFallback.actualStartTime = -1),
|
|
(showFallback.selfBaseDuration = 0),
|
|
(showFallback.treeBaseDuration = 0)))
|
|
: (showFallback = createFiberFromOffscreen(
|
|
didSuspend,
|
|
nextProps,
|
|
0,
|
|
null
|
|
)),
|
|
(current = createFiberFromFragment(
|
|
current,
|
|
nextProps,
|
|
renderLanes,
|
|
null
|
|
)),
|
|
(showFallback.return = workInProgress),
|
|
(current.return = workInProgress),
|
|
(showFallback.sibling = current),
|
|
(workInProgress.child = showFallback),
|
|
(workInProgress.child.memoizedState = mountSuspenseOffscreenState(
|
|
renderLanes
|
|
)),
|
|
(workInProgress.memoizedState = SUSPENDED_MARKER),
|
|
current)
|
|
: mountSuspensePrimaryChildren(workInProgress, didSuspend);
|
|
}
|
|
suspenseContext = current.memoizedState;
|
|
if (
|
|
null !== suspenseContext &&
|
|
((JSCompiler_temp = suspenseContext.dehydrated), null !== JSCompiler_temp)
|
|
)
|
|
return updateDehydratedSuspenseComponent(
|
|
current,
|
|
workInProgress,
|
|
didSuspend,
|
|
nextProps,
|
|
JSCompiler_temp,
|
|
suspenseContext,
|
|
renderLanes
|
|
);
|
|
if (showFallback) {
|
|
showFallback = nextProps.fallback;
|
|
didSuspend = workInProgress.mode;
|
|
suspenseContext = current.child;
|
|
JSCompiler_temp = suspenseContext.sibling;
|
|
var primaryChildProps = { mode: "hidden", children: nextProps.children };
|
|
0 === (didSuspend & 1) && workInProgress.child !== suspenseContext
|
|
? ((nextProps = workInProgress.child),
|
|
(nextProps.childLanes = 0),
|
|
(nextProps.pendingProps = primaryChildProps),
|
|
workInProgress.mode & 2 &&
|
|
((nextProps.actualDuration = 0),
|
|
(nextProps.actualStartTime = -1),
|
|
(nextProps.selfBaseDuration = suspenseContext.selfBaseDuration),
|
|
(nextProps.treeBaseDuration = suspenseContext.treeBaseDuration)),
|
|
(workInProgress.deletions = null))
|
|
: ((nextProps = createWorkInProgress(suspenseContext, primaryChildProps)),
|
|
(nextProps.subtreeFlags = suspenseContext.subtreeFlags & 14680064));
|
|
null !== JSCompiler_temp
|
|
? (showFallback = createWorkInProgress(JSCompiler_temp, showFallback))
|
|
: ((showFallback = createFiberFromFragment(
|
|
showFallback,
|
|
didSuspend,
|
|
renderLanes,
|
|
null
|
|
)),
|
|
(showFallback.flags |= 2));
|
|
showFallback.return = workInProgress;
|
|
nextProps.return = workInProgress;
|
|
nextProps.sibling = showFallback;
|
|
workInProgress.child = nextProps;
|
|
nextProps = showFallback;
|
|
showFallback = workInProgress.child;
|
|
didSuspend = current.child.memoizedState;
|
|
didSuspend =
|
|
null === didSuspend
|
|
? mountSuspenseOffscreenState(renderLanes)
|
|
: {
|
|
baseLanes: didSuspend.baseLanes | renderLanes,
|
|
cachePool: null,
|
|
transitions: didSuspend.transitions
|
|
};
|
|
showFallback.memoizedState = didSuspend;
|
|
showFallback.childLanes = current.childLanes & ~renderLanes;
|
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
return nextProps;
|
|
}
|
|
showFallback = current.child;
|
|
current = showFallback.sibling;
|
|
nextProps = createWorkInProgress(showFallback, {
|
|
mode: "visible",
|
|
children: nextProps.children
|
|
});
|
|
0 === (workInProgress.mode & 1) && (nextProps.lanes = renderLanes);
|
|
nextProps.return = workInProgress;
|
|
nextProps.sibling = null;
|
|
null !== current &&
|
|
((renderLanes = workInProgress.deletions),
|
|
null === renderLanes
|
|
? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16))
|
|
: renderLanes.push(current));
|
|
workInProgress.child = nextProps;
|
|
workInProgress.memoizedState = null;
|
|
return nextProps;
|
|
}
|
|
function mountSuspensePrimaryChildren(workInProgress, primaryChildren) {
|
|
primaryChildren = createFiberFromOffscreen(
|
|
{ mode: "visible", children: primaryChildren },
|
|
workInProgress.mode,
|
|
0,
|
|
null
|
|
);
|
|
primaryChildren.return = workInProgress;
|
|
return (workInProgress.child = primaryChildren);
|
|
}
|
|
function retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
recoverableError
|
|
) {
|
|
null !== recoverableError &&
|
|
(null === hydrationErrors
|
|
? (hydrationErrors = [recoverableError])
|
|
: hydrationErrors.push(recoverableError));
|
|
reconcileChildFibers(workInProgress, current.child, null, renderLanes);
|
|
current = mountSuspensePrimaryChildren(
|
|
workInProgress,
|
|
workInProgress.pendingProps.children
|
|
);
|
|
current.flags |= 2;
|
|
workInProgress.memoizedState = null;
|
|
return current;
|
|
}
|
|
function updateDehydratedSuspenseComponent(
|
|
current,
|
|
workInProgress,
|
|
didSuspend,
|
|
nextProps,
|
|
suspenseInstance,
|
|
suspenseState,
|
|
renderLanes
|
|
) {
|
|
if (didSuspend) {
|
|
if (workInProgress.flags & 256)
|
|
return (
|
|
(workInProgress.flags &= -257),
|
|
(suspenseState = createCapturedValue(
|
|
Error(
|
|
"There was an error while hydrating this Suspense boundary. Switched to client rendering."
|
|
)
|
|
)),
|
|
retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
suspenseState
|
|
)
|
|
);
|
|
if (null !== workInProgress.memoizedState)
|
|
return (
|
|
(workInProgress.child = current.child),
|
|
(workInProgress.flags |= 128),
|
|
null
|
|
);
|
|
suspenseState = nextProps.fallback;
|
|
didSuspend = workInProgress.mode;
|
|
nextProps = createFiberFromOffscreen(
|
|
{ mode: "visible", children: nextProps.children },
|
|
didSuspend,
|
|
0,
|
|
null
|
|
);
|
|
suspenseState = createFiberFromFragment(
|
|
suspenseState,
|
|
didSuspend,
|
|
renderLanes,
|
|
null
|
|
);
|
|
suspenseState.flags |= 2;
|
|
nextProps.return = workInProgress;
|
|
suspenseState.return = workInProgress;
|
|
nextProps.sibling = suspenseState;
|
|
workInProgress.child = nextProps;
|
|
0 !== (workInProgress.mode & 1) &&
|
|
reconcileChildFibers(workInProgress, current.child, null, renderLanes);
|
|
workInProgress.child.memoizedState = mountSuspenseOffscreenState(
|
|
renderLanes
|
|
);
|
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
return suspenseState;
|
|
}
|
|
if (0 === (workInProgress.mode & 1))
|
|
return retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
null
|
|
);
|
|
if (shim())
|
|
return (
|
|
(suspenseState = shim().digest),
|
|
(suspenseState = createCapturedValue(
|
|
Error(
|
|
"The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering."
|
|
),
|
|
suspenseState,
|
|
void 0
|
|
)),
|
|
retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
suspenseState
|
|
)
|
|
);
|
|
didSuspend = 0 !== (renderLanes & current.childLanes);
|
|
if (didReceiveUpdate || didSuspend) {
|
|
nextProps = workInProgressRoot;
|
|
if (null !== nextProps) {
|
|
switch (renderLanes & -renderLanes) {
|
|
case 4:
|
|
didSuspend = 2;
|
|
break;
|
|
case 16:
|
|
didSuspend = 8;
|
|
break;
|
|
case 64:
|
|
case 128:
|
|
case 256:
|
|
case 512:
|
|
case 1024:
|
|
case 2048:
|
|
case 4096:
|
|
case 8192:
|
|
case 16384:
|
|
case 32768:
|
|
case 65536:
|
|
case 131072:
|
|
case 262144:
|
|
case 524288:
|
|
case 1048576:
|
|
case 2097152:
|
|
case 4194304:
|
|
case 8388608:
|
|
case 16777216:
|
|
case 33554432:
|
|
case 67108864:
|
|
didSuspend = 32;
|
|
break;
|
|
case 536870912:
|
|
didSuspend = 268435456;
|
|
break;
|
|
default:
|
|
didSuspend = 0;
|
|
}
|
|
didSuspend =
|
|
0 !== (didSuspend & (nextProps.suspendedLanes | renderLanes))
|
|
? 0
|
|
: didSuspend;
|
|
0 !== didSuspend &&
|
|
didSuspend !== suspenseState.retryLane &&
|
|
((suspenseState.retryLane = didSuspend),
|
|
markUpdateLaneFromFiberToRoot(current, didSuspend),
|
|
scheduleUpdateOnFiber(nextProps, current, didSuspend, -1));
|
|
}
|
|
renderDidSuspendDelayIfPossible();
|
|
suspenseState = createCapturedValue(
|
|
Error(
|
|
"This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition."
|
|
)
|
|
);
|
|
return retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
suspenseState
|
|
);
|
|
}
|
|
if (shim())
|
|
return (
|
|
(workInProgress.flags |= 128),
|
|
(workInProgress.child = current.child),
|
|
retryDehydratedSuspenseBoundary.bind(null, current),
|
|
shim(),
|
|
null
|
|
);
|
|
current = mountSuspensePrimaryChildren(workInProgress, nextProps.children);
|
|
current.flags |= 4096;
|
|
return current;
|
|
}
|
|
function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) {
|
|
fiber.lanes |= renderLanes;
|
|
var alternate = fiber.alternate;
|
|
null !== alternate && (alternate.lanes |= renderLanes);
|
|
scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot);
|
|
}
|
|
function initSuspenseListRenderState(
|
|
workInProgress,
|
|
isBackwards,
|
|
tail,
|
|
lastContentRow,
|
|
tailMode
|
|
) {
|
|
var renderState = workInProgress.memoizedState;
|
|
null === renderState
|
|
? (workInProgress.memoizedState = {
|
|
isBackwards: isBackwards,
|
|
rendering: null,
|
|
renderingStartTime: 0,
|
|
last: lastContentRow,
|
|
tail: tail,
|
|
tailMode: tailMode
|
|
})
|
|
: ((renderState.isBackwards = isBackwards),
|
|
(renderState.rendering = null),
|
|
(renderState.renderingStartTime = 0),
|
|
(renderState.last = lastContentRow),
|
|
(renderState.tail = tail),
|
|
(renderState.tailMode = tailMode));
|
|
}
|
|
function updateSuspenseListComponent(current, workInProgress, renderLanes) {
|
|
var nextProps = workInProgress.pendingProps,
|
|
revealOrder = nextProps.revealOrder,
|
|
tailMode = nextProps.tail;
|
|
reconcileChildren(current, workInProgress, nextProps.children, renderLanes);
|
|
nextProps = suspenseStackCursor.current;
|
|
if (0 !== (nextProps & 2))
|
|
(nextProps = (nextProps & 1) | 2), (workInProgress.flags |= 128);
|
|
else {
|
|
if (null !== current && 0 !== (current.flags & 128))
|
|
a: for (current = workInProgress.child; null !== current; ) {
|
|
if (13 === current.tag)
|
|
null !== current.memoizedState &&
|
|
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
|
else if (19 === current.tag)
|
|
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
|
else if (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;
|
|
}
|
|
nextProps &= 1;
|
|
}
|
|
push(suspenseStackCursor, nextProps);
|
|
if (0 === (workInProgress.mode & 1)) workInProgress.memoizedState = null;
|
|
else
|
|
switch (revealOrder) {
|
|
case "forwards":
|
|
renderLanes = workInProgress.child;
|
|
for (revealOrder = null; null !== renderLanes; )
|
|
(current = renderLanes.alternate),
|
|
null !== current &&
|
|
null === findFirstSuspended(current) &&
|
|
(revealOrder = renderLanes),
|
|
(renderLanes = renderLanes.sibling);
|
|
renderLanes = revealOrder;
|
|
null === renderLanes
|
|
? ((revealOrder = workInProgress.child),
|
|
(workInProgress.child = null))
|
|
: ((revealOrder = renderLanes.sibling), (renderLanes.sibling = null));
|
|
initSuspenseListRenderState(
|
|
workInProgress,
|
|
!1,
|
|
revealOrder,
|
|
renderLanes,
|
|
tailMode
|
|
);
|
|
break;
|
|
case "backwards":
|
|
renderLanes = null;
|
|
revealOrder = workInProgress.child;
|
|
for (workInProgress.child = null; null !== revealOrder; ) {
|
|
current = revealOrder.alternate;
|
|
if (null !== current && null === findFirstSuspended(current)) {
|
|
workInProgress.child = revealOrder;
|
|
break;
|
|
}
|
|
current = revealOrder.sibling;
|
|
revealOrder.sibling = renderLanes;
|
|
renderLanes = revealOrder;
|
|
revealOrder = current;
|
|
}
|
|
initSuspenseListRenderState(
|
|
workInProgress,
|
|
!0,
|
|
renderLanes,
|
|
null,
|
|
tailMode
|
|
);
|
|
break;
|
|
case "together":
|
|
initSuspenseListRenderState(workInProgress, !1, null, null, void 0);
|
|
break;
|
|
default:
|
|
workInProgress.memoizedState = null;
|
|
}
|
|
return workInProgress.child;
|
|
}
|
|
function resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress) {
|
|
0 === (workInProgress.mode & 1) &&
|
|
null !== current &&
|
|
((current.alternate = null),
|
|
(workInProgress.alternate = null),
|
|
(workInProgress.flags |= 2));
|
|
}
|
|
function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) {
|
|
null !== current && (workInProgress.dependencies = current.dependencies);
|
|
profilerStartTime = -1;
|
|
workInProgressRootSkippedLanes |= workInProgress.lanes;
|
|
if (0 === (renderLanes & workInProgress.childLanes)) return null;
|
|
if (null !== current && workInProgress.child !== current.child)
|
|
throw Error("Resuming work not yet implemented.");
|
|
if (null !== workInProgress.child) {
|
|
current = workInProgress.child;
|
|
renderLanes = createWorkInProgress(current, current.pendingProps);
|
|
workInProgress.child = renderLanes;
|
|
for (renderLanes.return = workInProgress; null !== current.sibling; )
|
|
(current = current.sibling),
|
|
(renderLanes = renderLanes.sibling = createWorkInProgress(
|
|
current,
|
|
current.pendingProps
|
|
)),
|
|
(renderLanes.return = workInProgress);
|
|
renderLanes.sibling = null;
|
|
}
|
|
return workInProgress.child;
|
|
}
|
|
function attemptEarlyBailoutIfNoScheduledUpdate(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
) {
|
|
switch (workInProgress.tag) {
|
|
case 3:
|
|
pushHostRootContext(workInProgress);
|
|
break;
|
|
case 5:
|
|
pushHostContext(workInProgress);
|
|
break;
|
|
case 1:
|
|
isContextProvider(workInProgress.type) &&
|
|
pushContextProvider(workInProgress);
|
|
break;
|
|
case 4:
|
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
break;
|
|
case 10:
|
|
var context = workInProgress.type._context,
|
|
nextValue = workInProgress.memoizedProps.value;
|
|
push(valueCursor, context._currentValue);
|
|
context._currentValue = nextValue;
|
|
break;
|
|
case 12:
|
|
0 !== (renderLanes & workInProgress.childLanes) &&
|
|
(workInProgress.flags |= 4);
|
|
context = workInProgress.stateNode;
|
|
context.effectDuration = 0;
|
|
context.passiveEffectDuration = 0;
|
|
break;
|
|
case 13:
|
|
context = workInProgress.memoizedState;
|
|
if (null !== context) {
|
|
if (null !== context.dehydrated)
|
|
return (
|
|
push(suspenseStackCursor, suspenseStackCursor.current & 1),
|
|
(workInProgress.flags |= 128),
|
|
null
|
|
);
|
|
if (0 !== (renderLanes & workInProgress.child.childLanes))
|
|
return updateSuspenseComponent(current, workInProgress, renderLanes);
|
|
push(suspenseStackCursor, suspenseStackCursor.current & 1);
|
|
current = bailoutOnAlreadyFinishedWork(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
);
|
|
return null !== current ? current.sibling : null;
|
|
}
|
|
push(suspenseStackCursor, suspenseStackCursor.current & 1);
|
|
break;
|
|
case 19:
|
|
context = 0 !== (renderLanes & workInProgress.childLanes);
|
|
if (0 !== (current.flags & 128)) {
|
|
if (context)
|
|
return updateSuspenseListComponent(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
);
|
|
workInProgress.flags |= 128;
|
|
}
|
|
nextValue = workInProgress.memoizedState;
|
|
null !== nextValue &&
|
|
((nextValue.rendering = null),
|
|
(nextValue.tail = null),
|
|
(nextValue.lastEffect = null));
|
|
push(suspenseStackCursor, suspenseStackCursor.current);
|
|
if (context) break;
|
|
else return null;
|
|
case 22:
|
|
case 23:
|
|
return (
|
|
(workInProgress.lanes = 0),
|
|
updateOffscreenComponent(current, workInProgress, renderLanes)
|
|
);
|
|
}
|
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
}
|
|
var appendAllChildren,
|
|
updateHostContainer,
|
|
updateHostComponent$1,
|
|
updateHostText$1;
|
|
appendAllChildren = function(parent, workInProgress) {
|
|
for (var node = workInProgress.child; null !== node; ) {
|
|
if (5 === node.tag || 6 === node.tag) parent._children.push(node.stateNode);
|
|
else if (4 !== node.tag && 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;
|
|
}
|
|
};
|
|
updateHostContainer = function() {};
|
|
updateHostComponent$1 = function(current, workInProgress, type, newProps) {
|
|
current.memoizedProps !== newProps &&
|
|
(requiredContext(contextStackCursor$1.current),
|
|
(workInProgress.updateQueue = UPDATE_SIGNAL)) &&
|
|
(workInProgress.flags |= 4);
|
|
};
|
|
updateHostText$1 = function(current, workInProgress, oldText, newText) {
|
|
oldText !== newText && (workInProgress.flags |= 4);
|
|
};
|
|
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$65 = null; null !== lastTailNode; )
|
|
null !== lastTailNode.alternate && (lastTailNode$65 = lastTailNode),
|
|
(lastTailNode = lastTailNode.sibling);
|
|
null === lastTailNode$65
|
|
? hasRenderedATailFallback || null === renderState.tail
|
|
? (renderState.tail = null)
|
|
: (renderState.tail.sibling = null)
|
|
: (lastTailNode$65.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$67 = completedWork.selfBaseDuration,
|
|
child$68 = completedWork.child;
|
|
null !== child$68;
|
|
|
|
)
|
|
(newChildLanes |= child$68.lanes | child$68.childLanes),
|
|
(subtreeFlags |= child$68.subtreeFlags & 14680064),
|
|
(subtreeFlags |= child$68.flags & 14680064),
|
|
(treeBaseDuration$67 += child$68.treeBaseDuration),
|
|
(child$68 = child$68.sibling);
|
|
completedWork.treeBaseDuration = treeBaseDuration$67;
|
|
} else
|
|
for (
|
|
treeBaseDuration$67 = completedWork.child;
|
|
null !== treeBaseDuration$67;
|
|
|
|
)
|
|
(newChildLanes |=
|
|
treeBaseDuration$67.lanes | treeBaseDuration$67.childLanes),
|
|
(subtreeFlags |= treeBaseDuration$67.subtreeFlags & 14680064),
|
|
(subtreeFlags |= treeBaseDuration$67.flags & 14680064),
|
|
(treeBaseDuration$67.return = completedWork),
|
|
(treeBaseDuration$67 = treeBaseDuration$67.sibling);
|
|
else if (0 !== (completedWork.mode & 2)) {
|
|
treeBaseDuration$67 = completedWork.actualDuration;
|
|
child$68 = completedWork.selfBaseDuration;
|
|
for (var child = completedWork.child; null !== child; )
|
|
(newChildLanes |= child.lanes | child.childLanes),
|
|
(subtreeFlags |= child.subtreeFlags),
|
|
(subtreeFlags |= child.flags),
|
|
(treeBaseDuration$67 += child.actualDuration),
|
|
(child$68 += child.treeBaseDuration),
|
|
(child = child.sibling);
|
|
completedWork.actualDuration = treeBaseDuration$67;
|
|
completedWork.treeBaseDuration = child$68;
|
|
} else
|
|
for (
|
|
treeBaseDuration$67 = completedWork.child;
|
|
null !== treeBaseDuration$67;
|
|
|
|
)
|
|
(newChildLanes |=
|
|
treeBaseDuration$67.lanes | treeBaseDuration$67.childLanes),
|
|
(subtreeFlags |= treeBaseDuration$67.subtreeFlags),
|
|
(subtreeFlags |= treeBaseDuration$67.flags),
|
|
(treeBaseDuration$67.return = completedWork),
|
|
(treeBaseDuration$67 = treeBaseDuration$67.sibling);
|
|
completedWork.subtreeFlags |= subtreeFlags;
|
|
completedWork.childLanes = newChildLanes;
|
|
return didBailout;
|
|
}
|
|
function completeWork(current, workInProgress, renderLanes) {
|
|
var newProps = workInProgress.pendingProps;
|
|
popTreeContext(workInProgress);
|
|
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),
|
|
popHostContainer(),
|
|
pop(didPerformWorkStackCursor),
|
|
pop(contextStackCursor),
|
|
resetWorkInProgressVersions(),
|
|
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))),
|
|
updateHostContainer(current, workInProgress),
|
|
bubbleProperties(workInProgress),
|
|
null
|
|
);
|
|
case 5:
|
|
popHostContext(workInProgress);
|
|
renderLanes = requiredContext(rootInstanceStackCursor.current);
|
|
var type = workInProgress.type;
|
|
if (null !== current && null != workInProgress.stateNode)
|
|
updateHostComponent$1(
|
|
current,
|
|
workInProgress,
|
|
type,
|
|
newProps,
|
|
renderLanes
|
|
),
|
|
current.ref !== workInProgress.ref && (workInProgress.flags |= 512);
|
|
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;
|
|
}
|
|
requiredContext(contextStackCursor$1.current);
|
|
current = allocateTag();
|
|
type = getViewConfigForType(type);
|
|
var updatePayload = diffProperties(
|
|
null,
|
|
emptyObject,
|
|
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);
|
|
appendAllChildren(renderLanes, workInProgress, !1, !1);
|
|
workInProgress.stateNode = renderLanes;
|
|
finalizeInitialChildren(renderLanes) && (workInProgress.flags |= 4);
|
|
null !== workInProgress.ref && (workInProgress.flags |= 512);
|
|
}
|
|
bubbleProperties(workInProgress);
|
|
return null;
|
|
case 6:
|
|
if (current && null != workInProgress.stateNode)
|
|
updateHostText$1(
|
|
current,
|
|
workInProgress,
|
|
current.memoizedProps,
|
|
newProps
|
|
);
|
|
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 = requiredContext(rootInstanceStackCursor.current);
|
|
if (!requiredContext(contextStackCursor$1.current).isInAParentText)
|
|
throw Error(
|
|
"Text strings must be rendered within a <Text> component."
|
|
);
|
|
renderLanes = allocateTag();
|
|
ReactNativePrivateInterface.UIManager.createView(
|
|
renderLanes,
|
|
"RCTRawText",
|
|
current,
|
|
{ text: newProps }
|
|
);
|
|
instanceCache.set(renderLanes, workInProgress);
|
|
workInProgress.stateNode = renderLanes;
|
|
}
|
|
bubbleProperties(workInProgress);
|
|
return null;
|
|
case 13:
|
|
pop(suspenseStackCursor);
|
|
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) return workInProgress.flags & 65536 ? workInProgress : null;
|
|
}
|
|
if (0 !== (workInProgress.flags & 128))
|
|
return (
|
|
(workInProgress.lanes = renderLanes),
|
|
0 !== (workInProgress.mode & 2) &&
|
|
transferActualDuration(workInProgress),
|
|
workInProgress
|
|
);
|
|
renderLanes = null !== newProps;
|
|
renderLanes !== (null !== current && null !== current.memoizedState) &&
|
|
renderLanes &&
|
|
((workInProgress.child.flags |= 8192),
|
|
0 !== (workInProgress.mode & 1) &&
|
|
(null === current || 0 !== (suspenseStackCursor.current & 1)
|
|
? 0 === workInProgressRootExitStatus &&
|
|
(workInProgressRootExitStatus = 3)
|
|
: renderDidSuspendDelayIfPossible()));
|
|
null !== workInProgress.updateQueue && (workInProgress.flags |= 4);
|
|
bubbleProperties(workInProgress);
|
|
0 !== (workInProgress.mode & 2) &&
|
|
renderLanes &&
|
|
((current = workInProgress.child),
|
|
null !== current &&
|
|
(workInProgress.treeBaseDuration -= current.treeBaseDuration));
|
|
return null;
|
|
case 4:
|
|
return (
|
|
popHostContainer(),
|
|
updateHostContainer(current, workInProgress),
|
|
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);
|
|
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;
|
|
null !== current &&
|
|
((workInProgress.updateQueue = current),
|
|
(workInProgress.flags |= 4));
|
|
workInProgress.subtreeFlags = 0;
|
|
current = renderLanes;
|
|
for (renderLanes = workInProgress.child; null !== renderLanes; )
|
|
(newProps = renderLanes),
|
|
(updatePayload = current),
|
|
(newProps.flags &= 14680066),
|
|
(type = newProps.alternate),
|
|
null === type
|
|
? ((newProps.childLanes = 0),
|
|
(newProps.lanes = updatePayload),
|
|
(newProps.child = null),
|
|
(newProps.subtreeFlags = 0),
|
|
(newProps.memoizedProps = null),
|
|
(newProps.memoizedState = null),
|
|
(newProps.updateQueue = null),
|
|
(newProps.dependencies = null),
|
|
(newProps.stateNode = null),
|
|
(newProps.selfBaseDuration = 0),
|
|
(newProps.treeBaseDuration = 0))
|
|
: ((newProps.childLanes = type.childLanes),
|
|
(newProps.lanes = type.lanes),
|
|
(newProps.child = type.child),
|
|
(newProps.subtreeFlags = 0),
|
|
(newProps.deletions = null),
|
|
(newProps.memoizedProps = type.memoizedProps),
|
|
(newProps.memoizedState = type.memoizedState),
|
|
(newProps.updateQueue = type.updateQueue),
|
|
(newProps.type = type.type),
|
|
(updatePayload = type.dependencies),
|
|
(newProps.dependencies =
|
|
null === updatePayload
|
|
? null
|
|
: {
|
|
lanes: updatePayload.lanes,
|
|
firstContext: updatePayload.firstContext
|
|
}),
|
|
(newProps.selfBaseDuration = type.selfBaseDuration),
|
|
(newProps.treeBaseDuration = type.treeBaseDuration)),
|
|
(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),
|
|
null !== current &&
|
|
((workInProgress.updateQueue = current),
|
|
(workInProgress.flags |= 4)),
|
|
cutOffTailIfNeeded(type, !0),
|
|
null === type.tail &&
|
|
"hidden" === type.tailMode &&
|
|
!updatePayload.alternate)
|
|
)
|
|
return bubbleProperties(workInProgress), null;
|
|
} else
|
|
2 * now() - type.renderingStartTime >
|
|
workInProgressRootRenderTargetTime &&
|
|
1073741824 !== 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:
|
|
return (
|
|
popRenderLanes(),
|
|
(renderLanes = null !== workInProgress.memoizedState),
|
|
null !== current &&
|
|
(null !== current.memoizedState) !== renderLanes &&
|
|
(workInProgress.flags |= 8192),
|
|
renderLanes && 0 !== (workInProgress.mode & 1)
|
|
? 0 !== (subtreeRenderLanes & 1073741824) &&
|
|
(bubbleProperties(workInProgress),
|
|
workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192))
|
|
: bubbleProperties(workInProgress),
|
|
null
|
|
);
|
|
case 24:
|
|
return 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) {
|
|
popTreeContext(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 (
|
|
popHostContainer(),
|
|
pop(didPerformWorkStackCursor),
|
|
pop(contextStackCursor),
|
|
resetWorkInProgressVersions(),
|
|
(current = workInProgress.flags),
|
|
0 !== (current & 65536) && 0 === (current & 128)
|
|
? ((workInProgress.flags = (current & -65537) | 128), workInProgress)
|
|
: null
|
|
);
|
|
case 5:
|
|
return popHostContext(workInProgress), null;
|
|
case 13:
|
|
pop(suspenseStackCursor);
|
|
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 popRenderLanes(), null;
|
|
case 24:
|
|
return null;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
var PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set,
|
|
nextEffect = null,
|
|
inProgressLanes = null,
|
|
inProgressRoot = null;
|
|
function safelyDetachRef(current, nearestMountedAncestor) {
|
|
var ref = current.ref;
|
|
if (null !== ref)
|
|
if ("function" === typeof ref)
|
|
try {
|
|
if (current.mode & 2)
|
|
try {
|
|
startLayoutEffectTimer(), ref(null);
|
|
} finally {
|
|
recordLayoutEffectDuration(current);
|
|
}
|
|
else ref(null);
|
|
} catch (error) {
|
|
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
|
}
|
|
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;
|
|
if (0 !== (root.flags & 1024))
|
|
switch (root.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
break;
|
|
case 1:
|
|
if (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 6:
|
|
case 4:
|
|
case 17:
|
|
break;
|
|
default:
|
|
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
|
|
) {
|
|
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 destroy = effect.destroy;
|
|
effect.destroy = void 0;
|
|
void 0 !== destroy &&
|
|
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$83 = effect.create;
|
|
effect.destroy = create$83();
|
|
}
|
|
effect = effect.next;
|
|
} while (effect !== 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 5:
|
|
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(hostParent, deletedFiber.stateNode);
|
|
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:
|
|
prevHostParent = deletedFiber.updateQueue;
|
|
if (
|
|
null !== prevHostParent &&
|
|
((prevHostParent = prevHostParent.lastEffect), null !== prevHostParent)
|
|
) {
|
|
prevHostParentIsContainer = prevHostParent = prevHostParent.next;
|
|
do {
|
|
var _effect = prevHostParentIsContainer,
|
|
destroy = _effect.destroy;
|
|
_effect = _effect.tag;
|
|
void 0 !== destroy &&
|
|
(0 !== (_effect & 2)
|
|
? safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy)
|
|
: 0 !== (_effect & 4) &&
|
|
(deletedFiber.mode & 2
|
|
? (startLayoutEffectTimer(),
|
|
safelyCallDestroy(
|
|
deletedFiber,
|
|
nearestMountedAncestor,
|
|
destroy
|
|
),
|
|
recordLayoutEffectDuration(deletedFiber))
|
|
: safelyCallDestroy(
|
|
deletedFiber,
|
|
nearestMountedAncestor,
|
|
destroy
|
|
)));
|
|
prevHostParentIsContainer = prevHostParentIsContainer.next;
|
|
} while (prevHostParentIsContainer !== prevHostParent);
|
|
}
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
break;
|
|
case 1:
|
|
safelyDetachRef(deletedFiber, nearestMountedAncestor);
|
|
prevHostParent = deletedFiber.stateNode;
|
|
if ("function" === typeof prevHostParent.componentWillUnmount)
|
|
try {
|
|
if (
|
|
((prevHostParent.props = deletedFiber.memoizedProps),
|
|
(prevHostParent.state = deletedFiber.memoizedState),
|
|
deletedFiber.mode & 2)
|
|
)
|
|
try {
|
|
startLayoutEffectTimer(), prevHostParent.componentWillUnmount();
|
|
} finally {
|
|
recordLayoutEffectDuration(deletedFiber);
|
|
}
|
|
else prevHostParent.componentWillUnmount();
|
|
} catch (error) {
|
|
captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error);
|
|
}
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
break;
|
|
case 21:
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
break;
|
|
case 22:
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
break;
|
|
default:
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
}
|
|
}
|
|
function attachSuspenseRetryListeners(finishedWork) {
|
|
var wakeables = finishedWork.updateQueue;
|
|
if (null !== wakeables) {
|
|
finishedWork.updateQueue = null;
|
|
var retryCache = finishedWork.stateNode;
|
|
null === retryCache &&
|
|
(retryCache = finishedWork.stateNode = new PossiblyWeakSet());
|
|
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$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 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);
|
|
}
|
|
}
|
|
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 (finishedWork.mode & 2) {
|
|
try {
|
|
startLayoutEffectTimer(),
|
|
commitHookEffectListUnmount(5, finishedWork, finishedWork.return);
|
|
} catch (error$95) {
|
|
captureCommitPhaseError(
|
|
finishedWork,
|
|
finishedWork.return,
|
|
error$95
|
|
);
|
|
}
|
|
recordLayoutEffectDuration(finishedWork);
|
|
} else
|
|
try {
|
|
commitHookEffectListUnmount(5, finishedWork, finishedWork.return);
|
|
} catch (error$96) {
|
|
captureCommitPhaseError(
|
|
finishedWork,
|
|
finishedWork.return,
|
|
error$96
|
|
);
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
flags & 512 &&
|
|
null !== current &&
|
|
safelyDetachRef(current, current.return);
|
|
break;
|
|
case 5:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
flags & 512 &&
|
|
null !== current &&
|
|
safelyDetachRef(current, current.return);
|
|
if (flags & 4) {
|
|
var instance$98 = finishedWork.stateNode;
|
|
if (null != instance$98) {
|
|
var newProps = finishedWork.memoizedProps,
|
|
oldProps = null !== current ? current.memoizedProps : newProps,
|
|
updatePayload = finishedWork.updateQueue;
|
|
finishedWork.updateQueue = null;
|
|
if (null !== updatePayload)
|
|
try {
|
|
var viewConfig = instance$98.viewConfig;
|
|
instanceProps.set(instance$98._nativeTag, newProps);
|
|
var updatePayload$jscomp$0 = diffProperties(
|
|
null,
|
|
oldProps,
|
|
newProps,
|
|
viewConfig.validAttributes
|
|
);
|
|
null != updatePayload$jscomp$0 &&
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
instance$98._nativeTag,
|
|
viewConfig.uiViewClassName,
|
|
updatePayload$jscomp$0
|
|
);
|
|
} catch (error$99) {
|
|
captureCommitPhaseError(
|
|
finishedWork,
|
|
finishedWork.return,
|
|
error$99
|
|
);
|
|
}
|
|
}
|
|
}
|
|
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."
|
|
);
|
|
viewConfig = finishedWork.stateNode;
|
|
updatePayload$jscomp$0 = finishedWork.memoizedProps;
|
|
try {
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
viewConfig,
|
|
"RCTRawText",
|
|
{ text: updatePayload$jscomp$0 }
|
|
);
|
|
} catch (error$100) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error$100);
|
|
}
|
|
}
|
|
break;
|
|
case 3:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
break;
|
|
case 4:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
break;
|
|
case 13:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
viewConfig = finishedWork.child;
|
|
viewConfig.flags & 8192 &&
|
|
((updatePayload$jscomp$0 = null !== viewConfig.memoizedState),
|
|
(viewConfig.stateNode.isHidden = updatePayload$jscomp$0),
|
|
!updatePayload$jscomp$0 ||
|
|
(null !== viewConfig.alternate &&
|
|
null !== viewConfig.alternate.memoizedState) ||
|
|
(globalMostRecentFallbackTime = now()));
|
|
flags & 4 && attachSuspenseRetryListeners(finishedWork);
|
|
break;
|
|
case 22:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & 8192)
|
|
a: for (
|
|
viewConfig = null !== finishedWork.memoizedState,
|
|
finishedWork.stateNode.isHidden = viewConfig,
|
|
updatePayload$jscomp$0 = null,
|
|
current = finishedWork;
|
|
;
|
|
|
|
) {
|
|
if (5 === current.tag) {
|
|
if (null === updatePayload$jscomp$0) {
|
|
updatePayload$jscomp$0 = current;
|
|
try {
|
|
if (((instance$98 = current.stateNode), viewConfig))
|
|
(newProps = instance$98.viewConfig),
|
|
(oldProps = diffProperties(
|
|
null,
|
|
emptyObject,
|
|
{ style: { display: "none" } },
|
|
newProps.validAttributes
|
|
)),
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
instance$98._nativeTag,
|
|
newProps.uiViewClassName,
|
|
oldProps
|
|
);
|
|
else {
|
|
updatePayload = current.stateNode;
|
|
var props = current.memoizedProps,
|
|
viewConfig$jscomp$0 = updatePayload.viewConfig,
|
|
prevProps = assign({}, props, {
|
|
style: [props.style, { display: "none" }]
|
|
});
|
|
var updatePayload$jscomp$1 = diffProperties(
|
|
null,
|
|
prevProps,
|
|
props,
|
|
viewConfig$jscomp$0.validAttributes
|
|
);
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
updatePayload._nativeTag,
|
|
viewConfig$jscomp$0.uiViewClassName,
|
|
updatePayload$jscomp$1
|
|
);
|
|
}
|
|
} catch (error) {
|
|
captureCommitPhaseError(
|
|
finishedWork,
|
|
finishedWork.return,
|
|
error
|
|
);
|
|
}
|
|
}
|
|
} else if (6 === current.tag) {
|
|
if (null === updatePayload$jscomp$0)
|
|
try {
|
|
throw Error("Not yet implemented.");
|
|
} catch (error$90) {
|
|
captureCommitPhaseError(
|
|
finishedWork,
|
|
finishedWork.return,
|
|
error$90
|
|
);
|
|
}
|
|
} else if (
|
|
((22 !== current.tag && 23 !== current.tag) ||
|
|
null === current.memoizedState ||
|
|
current === finishedWork) &&
|
|
null !== current.child
|
|
) {
|
|
current.child.return = current;
|
|
current = current.child;
|
|
continue;
|
|
}
|
|
if (current === finishedWork) break a;
|
|
for (; null === current.sibling; ) {
|
|
if (null === current.return || current.return === finishedWork)
|
|
break a;
|
|
updatePayload$jscomp$0 === current &&
|
|
(updatePayload$jscomp$0 = null);
|
|
current = current.return;
|
|
}
|
|
updatePayload$jscomp$0 === current && (updatePayload$jscomp$0 = null);
|
|
current.sibling.return = current.return;
|
|
current = current.sibling;
|
|
}
|
|
break;
|
|
case 19:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
flags & 4 && attachSuspenseRetryListeners(finishedWork);
|
|
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;
|
|
}
|
|
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 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$91 = JSCompiler_inline_result.stateNode.containerInfo,
|
|
before$92 = getHostSibling(finishedWork);
|
|
insertOrAppendPlacementNodeIntoContainer(
|
|
finishedWork,
|
|
before$92,
|
|
parent$91
|
|
);
|
|
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;
|
|
for (nextEffect = finishedWork; null !== nextEffect; )
|
|
if (
|
|
((root = nextEffect),
|
|
(committedLanes = root.child),
|
|
0 !== (root.subtreeFlags & 8772) && null !== committedLanes)
|
|
)
|
|
(committedLanes.return = root), (nextEffect = committedLanes);
|
|
else
|
|
for (root = finishedWork; null !== nextEffect; ) {
|
|
committedLanes = nextEffect;
|
|
if (0 !== (committedLanes.flags & 8772)) {
|
|
var current = committedLanes.alternate;
|
|
try {
|
|
if (0 !== (committedLanes.flags & 8772))
|
|
switch (committedLanes.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
if (committedLanes.mode & 2)
|
|
try {
|
|
startLayoutEffectTimer(),
|
|
commitHookEffectListMount(5, committedLanes);
|
|
} finally {
|
|
recordLayoutEffectDuration(committedLanes);
|
|
}
|
|
else commitHookEffectListMount(5, committedLanes);
|
|
break;
|
|
case 1:
|
|
var instance = committedLanes.stateNode;
|
|
if (committedLanes.flags & 4)
|
|
if (null === current)
|
|
if (committedLanes.mode & 2)
|
|
try {
|
|
startLayoutEffectTimer(),
|
|
instance.componentDidMount();
|
|
} finally {
|
|
recordLayoutEffectDuration(committedLanes);
|
|
}
|
|
else instance.componentDidMount();
|
|
else {
|
|
var prevProps =
|
|
committedLanes.elementType === committedLanes.type
|
|
? current.memoizedProps
|
|
: resolveDefaultProps(
|
|
committedLanes.type,
|
|
current.memoizedProps
|
|
),
|
|
prevState = current.memoizedState;
|
|
if (committedLanes.mode & 2)
|
|
try {
|
|
startLayoutEffectTimer(),
|
|
instance.componentDidUpdate(
|
|
prevProps,
|
|
prevState,
|
|
instance.__reactInternalSnapshotBeforeUpdate
|
|
);
|
|
} finally {
|
|
recordLayoutEffectDuration(committedLanes);
|
|
}
|
|
else
|
|
instance.componentDidUpdate(
|
|
prevProps,
|
|
prevState,
|
|
instance.__reactInternalSnapshotBeforeUpdate
|
|
);
|
|
}
|
|
var updateQueue = committedLanes.updateQueue;
|
|
null !== updateQueue &&
|
|
commitUpdateQueue(committedLanes, updateQueue, instance);
|
|
break;
|
|
case 3:
|
|
var updateQueue$85 = committedLanes.updateQueue;
|
|
if (null !== updateQueue$85) {
|
|
var instance$86 = null;
|
|
if (null !== committedLanes.child)
|
|
switch (committedLanes.child.tag) {
|
|
case 5:
|
|
instance$86 = committedLanes.child.stateNode;
|
|
break;
|
|
case 1:
|
|
instance$86 = committedLanes.child.stateNode;
|
|
}
|
|
commitUpdateQueue(
|
|
committedLanes,
|
|
updateQueue$85,
|
|
instance$86
|
|
);
|
|
}
|
|
break;
|
|
case 5:
|
|
break;
|
|
case 6:
|
|
break;
|
|
case 4:
|
|
break;
|
|
case 12:
|
|
var _finishedWork$memoize2 = committedLanes.memoizedProps,
|
|
onCommit = _finishedWork$memoize2.onCommit,
|
|
onRender = _finishedWork$memoize2.onRender,
|
|
effectDuration = committedLanes.stateNode.effectDuration;
|
|
instance$86 = commitTime;
|
|
current = null === current ? "mount" : "update";
|
|
currentUpdateIsNested && (current = "nested-update");
|
|
"function" === typeof onRender &&
|
|
onRender(
|
|
committedLanes.memoizedProps.id,
|
|
current,
|
|
committedLanes.actualDuration,
|
|
committedLanes.treeBaseDuration,
|
|
committedLanes.actualStartTime,
|
|
instance$86
|
|
);
|
|
"function" === typeof onCommit &&
|
|
onCommit(
|
|
committedLanes.memoizedProps.id,
|
|
current,
|
|
effectDuration,
|
|
instance$86
|
|
);
|
|
enqueuePendingPassiveProfilerEffect(committedLanes);
|
|
var parentFiber = committedLanes.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;
|
|
}
|
|
break;
|
|
case 13:
|
|
break;
|
|
case 19:
|
|
case 17:
|
|
case 21:
|
|
case 22:
|
|
case 23:
|
|
case 25:
|
|
break;
|
|
default:
|
|
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."
|
|
);
|
|
}
|
|
if (committedLanes.flags & 512) {
|
|
instance$86 = void 0;
|
|
current = committedLanes;
|
|
var ref = current.ref;
|
|
if (null !== ref) {
|
|
var instance$jscomp$0 = current.stateNode;
|
|
switch (current.tag) {
|
|
case 5:
|
|
instance$86 = instance$jscomp$0;
|
|
break;
|
|
default:
|
|
instance$86 = instance$jscomp$0;
|
|
}
|
|
if ("function" === typeof ref)
|
|
if (current.mode & 2)
|
|
try {
|
|
startLayoutEffectTimer(), ref(instance$86);
|
|
} finally {
|
|
recordLayoutEffectDuration(current);
|
|
}
|
|
else ref(instance$86);
|
|
else ref.current = instance$86;
|
|
}
|
|
}
|
|
} catch (error) {
|
|
captureCommitPhaseError(
|
|
committedLanes,
|
|
committedLanes.return,
|
|
error
|
|
);
|
|
}
|
|
}
|
|
if (committedLanes === root) {
|
|
nextEffect = null;
|
|
break;
|
|
}
|
|
instance$86 = committedLanes.sibling;
|
|
if (null !== instance$86) {
|
|
instance$86.return = committedLanes.return;
|
|
nextEffect = instance$86;
|
|
break;
|
|
}
|
|
nextEffect = committedLanes.return;
|
|
}
|
|
inProgressRoot = inProgressLanes = null;
|
|
}
|
|
var ceil = Math.ceil,
|
|
ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher,
|
|
ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner,
|
|
ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig,
|
|
executionContext = 0,
|
|
workInProgressRoot = null,
|
|
workInProgress = null,
|
|
workInProgressRootRenderLanes = 0,
|
|
subtreeRenderLanes = 0,
|
|
subtreeRenderLanesCursor = createCursor(0),
|
|
workInProgressRootExitStatus = 0,
|
|
workInProgressRootFatalError = null,
|
|
workInProgressRootSkippedLanes = 0,
|
|
workInProgressRootInterleavedUpdatedLanes = 0,
|
|
workInProgressRootPingedLanes = 0,
|
|
workInProgressRootConcurrentErrors = null,
|
|
workInProgressRootRecoverableErrors = null,
|
|
globalMostRecentFallbackTime = 0,
|
|
workInProgressRootRenderTargetTime = Infinity,
|
|
workInProgressTransitions = null,
|
|
hasUncaughtError = !1,
|
|
firstUncaughtError = null,
|
|
legacyErrorBoundariesThatAlreadyFailed = null,
|
|
rootDoesHavePassiveEffects = !1,
|
|
rootWithPendingPassiveEffects = null,
|
|
pendingPassiveEffectsLanes = 0,
|
|
pendingPassiveProfilerEffects = [],
|
|
nestedUpdateCount = 0,
|
|
rootWithNestedUpdates = null,
|
|
currentEventTime = -1,
|
|
currentEventTransitionLane = 0;
|
|
function requestEventTime() {
|
|
return 0 !== (executionContext & 6)
|
|
? now()
|
|
: -1 !== currentEventTime
|
|
? currentEventTime
|
|
: (currentEventTime = now());
|
|
}
|
|
function requestUpdateLane(fiber) {
|
|
if (0 === (fiber.mode & 1)) return 1;
|
|
if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes)
|
|
return workInProgressRootRenderLanes & -workInProgressRootRenderLanes;
|
|
if (null !== ReactCurrentBatchConfig.transition)
|
|
return (
|
|
0 === currentEventTransitionLane &&
|
|
(currentEventTransitionLane = claimNextTransitionLane()),
|
|
currentEventTransitionLane
|
|
);
|
|
fiber = currentUpdatePriority;
|
|
return 0 !== fiber ? fiber : 16;
|
|
}
|
|
function scheduleUpdateOnFiber(root, fiber, lane, eventTime) {
|
|
if (50 < nestedUpdateCount)
|
|
throw ((nestedUpdateCount = 0),
|
|
(rootWithNestedUpdates = null),
|
|
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."
|
|
));
|
|
markRootUpdated(root, lane, eventTime);
|
|
if (0 === (executionContext & 2) || root !== workInProgressRoot)
|
|
isDevToolsPresent && addFiberToLanesMap(root, fiber, lane),
|
|
root === workInProgressRoot &&
|
|
(0 === (executionContext & 2) &&
|
|
(workInProgressRootInterleavedUpdatedLanes |= lane),
|
|
4 === workInProgressRootExitStatus &&
|
|
markRootSuspended$1(root, workInProgressRootRenderLanes)),
|
|
ensureRootIsScheduled(root, eventTime),
|
|
1 === lane &&
|
|
0 === executionContext &&
|
|
0 === (fiber.mode & 1) &&
|
|
((workInProgressRootRenderTargetTime = now() + 500),
|
|
includesLegacySyncCallbacks && flushSyncCallbacks());
|
|
}
|
|
function ensureRootIsScheduled(root, currentTime) {
|
|
for (
|
|
var existingCallbackNode = root.callbackNode,
|
|
suspendedLanes = root.suspendedLanes,
|
|
pingedLanes = root.pingedLanes,
|
|
expirationTimes = root.expirationTimes,
|
|
lanes = root.pendingLanes;
|
|
0 < lanes;
|
|
|
|
) {
|
|
var index$6 = 31 - clz32(lanes),
|
|
lane = 1 << index$6,
|
|
expirationTime = expirationTimes[index$6];
|
|
if (-1 === expirationTime) {
|
|
if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes))
|
|
expirationTimes[index$6] = computeExpirationTime(lane, currentTime);
|
|
} else expirationTime <= currentTime && (root.expiredLanes |= lane);
|
|
lanes &= ~lane;
|
|
}
|
|
suspendedLanes = getNextLanes(
|
|
root,
|
|
root === workInProgressRoot ? workInProgressRootRenderLanes : 0
|
|
);
|
|
if (0 === suspendedLanes)
|
|
null !== existingCallbackNode && cancelCallback(existingCallbackNode),
|
|
(root.callbackNode = null),
|
|
(root.callbackPriority = 0);
|
|
else if (
|
|
((currentTime = suspendedLanes & -suspendedLanes),
|
|
root.callbackPriority !== currentTime)
|
|
) {
|
|
null != existingCallbackNode && cancelCallback(existingCallbackNode);
|
|
if (1 === currentTime)
|
|
0 === root.tag
|
|
? ((existingCallbackNode = performSyncWorkOnRoot.bind(null, root)),
|
|
(includesLegacySyncCallbacks = !0),
|
|
null === syncQueue
|
|
? (syncQueue = [existingCallbackNode])
|
|
: syncQueue.push(existingCallbackNode))
|
|
: ((existingCallbackNode = performSyncWorkOnRoot.bind(null, root)),
|
|
null === syncQueue
|
|
? (syncQueue = [existingCallbackNode])
|
|
: syncQueue.push(existingCallbackNode)),
|
|
scheduleCallback(ImmediatePriority, flushSyncCallbacks),
|
|
(existingCallbackNode = null);
|
|
else {
|
|
switch (lanesToEventPriority(suspendedLanes)) {
|
|
case 1:
|
|
existingCallbackNode = ImmediatePriority;
|
|
break;
|
|
case 4:
|
|
existingCallbackNode = UserBlockingPriority;
|
|
break;
|
|
case 16:
|
|
existingCallbackNode = NormalPriority;
|
|
break;
|
|
case 536870912:
|
|
existingCallbackNode = IdlePriority;
|
|
break;
|
|
default:
|
|
existingCallbackNode = NormalPriority;
|
|
}
|
|
existingCallbackNode = scheduleCallback$1(
|
|
existingCallbackNode,
|
|
performConcurrentWorkOnRoot.bind(null, root)
|
|
);
|
|
}
|
|
root.callbackPriority = currentTime;
|
|
root.callbackNode = existingCallbackNode;
|
|
}
|
|
}
|
|
function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
nestedUpdateScheduled = currentUpdateIsNested = !1;
|
|
currentEventTime = -1;
|
|
currentEventTransitionLane = 0;
|
|
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;
|
|
if (0 !== (lanes & 30) || 0 !== (lanes & root.expiredLanes) || didTimeout)
|
|
didTimeout = renderRootSync(root, lanes);
|
|
else {
|
|
didTimeout = lanes;
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 2;
|
|
var prevDispatcher = pushDispatcher();
|
|
if (
|
|
workInProgressRoot !== root ||
|
|
workInProgressRootRenderLanes !== didTimeout
|
|
) {
|
|
if (isDevToolsPresent) {
|
|
var memoizedUpdaters = root.memoizedUpdaters;
|
|
0 < memoizedUpdaters.size &&
|
|
(restorePendingUpdaters(root, workInProgressRootRenderLanes),
|
|
memoizedUpdaters.clear());
|
|
movePendingFibersToMemoized(root, didTimeout);
|
|
}
|
|
workInProgressTransitions = null;
|
|
workInProgressRootRenderTargetTime = now() + 500;
|
|
prepareFreshStack(root, didTimeout);
|
|
}
|
|
do
|
|
try {
|
|
workLoopConcurrent();
|
|
break;
|
|
} catch (thrownValue) {
|
|
handleError(root, thrownValue);
|
|
}
|
|
while (1);
|
|
resetContextDependencies();
|
|
ReactCurrentDispatcher$2.current = prevDispatcher;
|
|
executionContext = prevExecutionContext;
|
|
null !== workInProgress
|
|
? (didTimeout = 0)
|
|
: ((workInProgressRoot = null),
|
|
(workInProgressRootRenderLanes = 0),
|
|
(didTimeout = workInProgressRootExitStatus));
|
|
}
|
|
if (0 !== didTimeout) {
|
|
2 === didTimeout &&
|
|
((prevExecutionContext = getLanesToRetrySynchronouslyOnError(root)),
|
|
0 !== prevExecutionContext &&
|
|
((lanes = prevExecutionContext),
|
|
(didTimeout = recoverFromConcurrentError(root, prevExecutionContext))));
|
|
if (1 === didTimeout)
|
|
throw ((originalCallbackNode = workInProgressRootFatalError),
|
|
prepareFreshStack(root, 0),
|
|
markRootSuspended$1(root, lanes),
|
|
ensureRootIsScheduled(root, now()),
|
|
originalCallbackNode);
|
|
if (6 === didTimeout) markRootSuspended$1(root, lanes);
|
|
else {
|
|
prevExecutionContext = root.current.alternate;
|
|
if (
|
|
0 === (lanes & 30) &&
|
|
!isRenderConsistentWithExternalStores(prevExecutionContext) &&
|
|
((didTimeout = renderRootSync(root, lanes)),
|
|
2 === didTimeout &&
|
|
((prevDispatcher = getLanesToRetrySynchronouslyOnError(root)),
|
|
0 !== prevDispatcher &&
|
|
((lanes = prevDispatcher),
|
|
(didTimeout = recoverFromConcurrentError(root, prevDispatcher)))),
|
|
1 === didTimeout)
|
|
)
|
|
throw ((originalCallbackNode = workInProgressRootFatalError),
|
|
prepareFreshStack(root, 0),
|
|
markRootSuspended$1(root, lanes),
|
|
ensureRootIsScheduled(root, now()),
|
|
originalCallbackNode);
|
|
root.finishedWork = prevExecutionContext;
|
|
root.finishedLanes = lanes;
|
|
switch (didTimeout) {
|
|
case 0:
|
|
case 1:
|
|
throw Error("Root did not complete. This is a bug in React.");
|
|
case 2:
|
|
commitRoot(
|
|
root,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions
|
|
);
|
|
break;
|
|
case 3:
|
|
markRootSuspended$1(root, lanes);
|
|
if (
|
|
(lanes & 130023424) === lanes &&
|
|
((didTimeout = globalMostRecentFallbackTime + 500 - now()),
|
|
10 < didTimeout)
|
|
) {
|
|
if (0 !== getNextLanes(root, 0)) break;
|
|
prevExecutionContext = root.suspendedLanes;
|
|
if ((prevExecutionContext & lanes) !== lanes) {
|
|
requestEventTime();
|
|
root.pingedLanes |= root.suspendedLanes & prevExecutionContext;
|
|
break;
|
|
}
|
|
root.timeoutHandle = scheduleTimeout(
|
|
commitRoot.bind(
|
|
null,
|
|
root,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions
|
|
),
|
|
didTimeout
|
|
);
|
|
break;
|
|
}
|
|
commitRoot(
|
|
root,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions
|
|
);
|
|
break;
|
|
case 4:
|
|
markRootSuspended$1(root, lanes);
|
|
if ((lanes & 4194240) === lanes) break;
|
|
didTimeout = root.eventTimes;
|
|
for (prevExecutionContext = -1; 0 < lanes; )
|
|
(memoizedUpdaters = 31 - clz32(lanes)),
|
|
(prevDispatcher = 1 << memoizedUpdaters),
|
|
(memoizedUpdaters = didTimeout[memoizedUpdaters]),
|
|
memoizedUpdaters > prevExecutionContext &&
|
|
(prevExecutionContext = memoizedUpdaters),
|
|
(lanes &= ~prevDispatcher);
|
|
lanes = prevExecutionContext;
|
|
lanes = now() - lanes;
|
|
lanes =
|
|
(120 > lanes
|
|
? 120
|
|
: 480 > lanes
|
|
? 480
|
|
: 1080 > lanes
|
|
? 1080
|
|
: 1920 > lanes
|
|
? 1920
|
|
: 3e3 > lanes
|
|
? 3e3
|
|
: 4320 > lanes
|
|
? 4320
|
|
: 1960 * ceil(lanes / 1960)) - lanes;
|
|
if (10 < lanes) {
|
|
root.timeoutHandle = scheduleTimeout(
|
|
commitRoot.bind(
|
|
null,
|
|
root,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions
|
|
),
|
|
lanes
|
|
);
|
|
break;
|
|
}
|
|
commitRoot(
|
|
root,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions
|
|
);
|
|
break;
|
|
case 5:
|
|
commitRoot(
|
|
root,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions
|
|
);
|
|
break;
|
|
default:
|
|
throw Error("Unknown root exit status.");
|
|
}
|
|
}
|
|
}
|
|
ensureRootIsScheduled(root, now());
|
|
return root.callbackNode === originalCallbackNode
|
|
? performConcurrentWorkOnRoot.bind(null, root)
|
|
: null;
|
|
}
|
|
function recoverFromConcurrentError(root, errorRetryLanes) {
|
|
var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
|
|
root.current.memoizedState.isDehydrated &&
|
|
(prepareFreshStack(root, errorRetryLanes).flags |= 256);
|
|
root = renderRootSync(root, errorRetryLanes);
|
|
2 !== root &&
|
|
((errorRetryLanes = workInProgressRootRecoverableErrors),
|
|
(workInProgressRootRecoverableErrors = errorsFromFirstAttempt),
|
|
null !== errorRetryLanes && queueRecoverableErrors(errorRetryLanes));
|
|
return root;
|
|
}
|
|
function queueRecoverableErrors(errors) {
|
|
null === workInProgressRootRecoverableErrors
|
|
? (workInProgressRootRecoverableErrors = errors)
|
|
: workInProgressRootRecoverableErrors.push.apply(
|
|
workInProgressRootRecoverableErrors,
|
|
errors
|
|
);
|
|
}
|
|
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$1(root, suspendedLanes) {
|
|
suspendedLanes &= ~workInProgressRootPingedLanes;
|
|
suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes;
|
|
root.suspendedLanes |= suspendedLanes;
|
|
root.pingedLanes &= ~suspendedLanes;
|
|
for (root = root.expirationTimes; 0 < suspendedLanes; ) {
|
|
var index$7 = 31 - clz32(suspendedLanes),
|
|
lane = 1 << index$7;
|
|
root[index$7] = -1;
|
|
suspendedLanes &= ~lane;
|
|
}
|
|
}
|
|
function performSyncWorkOnRoot(root) {
|
|
currentUpdateIsNested = nestedUpdateScheduled;
|
|
nestedUpdateScheduled = !1;
|
|
if (0 !== (executionContext & 6))
|
|
throw Error("Should not already be working.");
|
|
flushPassiveEffects();
|
|
var lanes = getNextLanes(root, 0);
|
|
if (0 === (lanes & 1)) return ensureRootIsScheduled(root, now()), null;
|
|
var exitStatus = renderRootSync(root, lanes);
|
|
if (0 !== root.tag && 2 === exitStatus) {
|
|
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root);
|
|
0 !== errorRetryLanes &&
|
|
((lanes = errorRetryLanes),
|
|
(exitStatus = recoverFromConcurrentError(root, errorRetryLanes)));
|
|
}
|
|
if (1 === exitStatus)
|
|
throw ((exitStatus = workInProgressRootFatalError),
|
|
prepareFreshStack(root, 0),
|
|
markRootSuspended$1(root, lanes),
|
|
ensureRootIsScheduled(root, now()),
|
|
exitStatus);
|
|
if (6 === exitStatus)
|
|
throw Error("Root did not complete. This is a bug in React.");
|
|
root.finishedWork = root.current.alternate;
|
|
root.finishedLanes = lanes;
|
|
commitRoot(
|
|
root,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions
|
|
);
|
|
ensureRootIsScheduled(root, now());
|
|
return null;
|
|
}
|
|
function popRenderLanes() {
|
|
subtreeRenderLanes = subtreeRenderLanesCursor.current;
|
|
pop(subtreeRenderLanesCursor);
|
|
}
|
|
function prepareFreshStack(root, lanes) {
|
|
root.finishedWork = null;
|
|
root.finishedLanes = 0;
|
|
var timeoutHandle = root.timeoutHandle;
|
|
-1 !== timeoutHandle &&
|
|
((root.timeoutHandle = -1), cancelTimeout(timeoutHandle));
|
|
if (null !== workInProgress)
|
|
for (timeoutHandle = workInProgress.return; null !== timeoutHandle; ) {
|
|
var interruptedWork = timeoutHandle;
|
|
popTreeContext(interruptedWork);
|
|
switch (interruptedWork.tag) {
|
|
case 1:
|
|
interruptedWork = interruptedWork.type.childContextTypes;
|
|
null !== interruptedWork &&
|
|
void 0 !== interruptedWork &&
|
|
popContext();
|
|
break;
|
|
case 3:
|
|
popHostContainer();
|
|
pop(didPerformWorkStackCursor);
|
|
pop(contextStackCursor);
|
|
resetWorkInProgressVersions();
|
|
break;
|
|
case 5:
|
|
popHostContext(interruptedWork);
|
|
break;
|
|
case 4:
|
|
popHostContainer();
|
|
break;
|
|
case 13:
|
|
pop(suspenseStackCursor);
|
|
break;
|
|
case 19:
|
|
pop(suspenseStackCursor);
|
|
break;
|
|
case 10:
|
|
popProvider(interruptedWork.type._context);
|
|
break;
|
|
case 22:
|
|
case 23:
|
|
popRenderLanes();
|
|
}
|
|
timeoutHandle = timeoutHandle.return;
|
|
}
|
|
workInProgressRoot = root;
|
|
workInProgress = root = createWorkInProgress(root.current, null);
|
|
workInProgressRootRenderLanes = subtreeRenderLanes = lanes;
|
|
workInProgressRootExitStatus = 0;
|
|
workInProgressRootFatalError = null;
|
|
workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0;
|
|
workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null;
|
|
if (null !== concurrentQueues) {
|
|
for (lanes = 0; lanes < concurrentQueues.length; lanes++)
|
|
if (
|
|
((timeoutHandle = concurrentQueues[lanes]),
|
|
(interruptedWork = timeoutHandle.interleaved),
|
|
null !== interruptedWork)
|
|
) {
|
|
timeoutHandle.interleaved = null;
|
|
var firstInterleavedUpdate = interruptedWork.next,
|
|
lastPendingUpdate = timeoutHandle.pending;
|
|
if (null !== lastPendingUpdate) {
|
|
var firstPendingUpdate = lastPendingUpdate.next;
|
|
lastPendingUpdate.next = firstInterleavedUpdate;
|
|
interruptedWork.next = firstPendingUpdate;
|
|
}
|
|
timeoutHandle.pending = interruptedWork;
|
|
}
|
|
concurrentQueues = null;
|
|
}
|
|
return root;
|
|
}
|
|
function handleError(root$jscomp$0, thrownValue) {
|
|
do {
|
|
var erroredWork = workInProgress;
|
|
try {
|
|
resetContextDependencies();
|
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
if (didScheduleRenderPhaseUpdate) {
|
|
for (
|
|
var hook = currentlyRenderingFiber$1.memoizedState;
|
|
null !== hook;
|
|
|
|
) {
|
|
var queue = hook.queue;
|
|
null !== queue && (queue.pending = null);
|
|
hook = hook.next;
|
|
}
|
|
didScheduleRenderPhaseUpdate = !1;
|
|
}
|
|
renderLanes = 0;
|
|
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
|
|
didScheduleRenderPhaseUpdateDuringThisPass = !1;
|
|
ReactCurrentOwner$2.current = null;
|
|
if (null === erroredWork || null === erroredWork.return) {
|
|
workInProgressRootExitStatus = 1;
|
|
workInProgressRootFatalError = thrownValue;
|
|
workInProgress = null;
|
|
break;
|
|
}
|
|
erroredWork.mode & 2 &&
|
|
stopProfilerTimerIfRunningAndRecordDelta(erroredWork, !0);
|
|
a: {
|
|
var root = root$jscomp$0,
|
|
returnFiber = erroredWork.return,
|
|
sourceFiber = erroredWork,
|
|
value = thrownValue;
|
|
thrownValue = workInProgressRootRenderLanes;
|
|
sourceFiber.flags |= 32768;
|
|
isDevToolsPresent && restorePendingUpdaters(root, thrownValue);
|
|
if (
|
|
null !== value &&
|
|
"object" === typeof value &&
|
|
"function" === typeof value.then
|
|
) {
|
|
var wakeable = value,
|
|
sourceFiber$jscomp$0 = sourceFiber,
|
|
tag = sourceFiber$jscomp$0.tag;
|
|
if (
|
|
0 === (sourceFiber$jscomp$0.mode & 1) &&
|
|
(0 === tag || 11 === tag || 15 === tag)
|
|
) {
|
|
var currentSource = sourceFiber$jscomp$0.alternate;
|
|
currentSource
|
|
? ((sourceFiber$jscomp$0.updateQueue = currentSource.updateQueue),
|
|
(sourceFiber$jscomp$0.memoizedState =
|
|
currentSource.memoizedState),
|
|
(sourceFiber$jscomp$0.lanes = currentSource.lanes))
|
|
: ((sourceFiber$jscomp$0.updateQueue = null),
|
|
(sourceFiber$jscomp$0.memoizedState = null));
|
|
}
|
|
b: {
|
|
sourceFiber$jscomp$0 = returnFiber;
|
|
do {
|
|
var JSCompiler_temp;
|
|
if ((JSCompiler_temp = 13 === sourceFiber$jscomp$0.tag)) {
|
|
var nextState = sourceFiber$jscomp$0.memoizedState;
|
|
JSCompiler_temp =
|
|
null !== nextState
|
|
? null !== nextState.dehydrated
|
|
? !0
|
|
: !1
|
|
: !0;
|
|
}
|
|
if (JSCompiler_temp) {
|
|
var suspenseBoundary = sourceFiber$jscomp$0;
|
|
break b;
|
|
}
|
|
sourceFiber$jscomp$0 = sourceFiber$jscomp$0.return;
|
|
} while (null !== sourceFiber$jscomp$0);
|
|
suspenseBoundary = null;
|
|
}
|
|
if (null !== suspenseBoundary) {
|
|
suspenseBoundary.flags &= -257;
|
|
value = suspenseBoundary;
|
|
sourceFiber$jscomp$0 = thrownValue;
|
|
if (0 === (value.mode & 1))
|
|
if (value === returnFiber) value.flags |= 65536;
|
|
else {
|
|
value.flags |= 128;
|
|
sourceFiber.flags |= 131072;
|
|
sourceFiber.flags &= -52805;
|
|
if (1 === sourceFiber.tag)
|
|
if (null === sourceFiber.alternate) sourceFiber.tag = 17;
|
|
else {
|
|
var update = createUpdate(-1, 1);
|
|
update.tag = 2;
|
|
enqueueUpdate(sourceFiber, update, 1);
|
|
}
|
|
sourceFiber.lanes |= 1;
|
|
}
|
|
else (value.flags |= 65536), (value.lanes = sourceFiber$jscomp$0);
|
|
suspenseBoundary.mode & 1 &&
|
|
attachPingListener(root, wakeable, thrownValue);
|
|
thrownValue = suspenseBoundary;
|
|
root = wakeable;
|
|
var wakeables = thrownValue.updateQueue;
|
|
if (null === wakeables) {
|
|
var updateQueue = new Set();
|
|
updateQueue.add(root);
|
|
thrownValue.updateQueue = updateQueue;
|
|
} else wakeables.add(root);
|
|
break a;
|
|
} else {
|
|
if (0 === (thrownValue & 1)) {
|
|
attachPingListener(root, wakeable, thrownValue);
|
|
renderDidSuspendDelayIfPossible();
|
|
break a;
|
|
}
|
|
value = Error(
|
|
"A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition."
|
|
);
|
|
}
|
|
}
|
|
root = value = createCapturedValueAtFiber(value, sourceFiber);
|
|
4 !== workInProgressRootExitStatus &&
|
|
(workInProgressRootExitStatus = 2);
|
|
null === workInProgressRootConcurrentErrors
|
|
? (workInProgressRootConcurrentErrors = [root])
|
|
: workInProgressRootConcurrentErrors.push(root);
|
|
root = returnFiber;
|
|
do {
|
|
switch (root.tag) {
|
|
case 3:
|
|
wakeable = value;
|
|
root.flags |= 65536;
|
|
thrownValue &= -thrownValue;
|
|
root.lanes |= thrownValue;
|
|
var update$jscomp$0 = createRootErrorUpdate(
|
|
root,
|
|
wakeable,
|
|
thrownValue
|
|
);
|
|
enqueueCapturedUpdate(root, update$jscomp$0);
|
|
break a;
|
|
case 1:
|
|
wakeable = value;
|
|
var ctor = root.type,
|
|
instance = root.stateNode;
|
|
if (
|
|
0 === (root.flags & 128) &&
|
|
("function" === typeof ctor.getDerivedStateFromError ||
|
|
(null !== instance &&
|
|
"function" === typeof instance.componentDidCatch &&
|
|
(null === legacyErrorBoundariesThatAlreadyFailed ||
|
|
!legacyErrorBoundariesThatAlreadyFailed.has(instance))))
|
|
) {
|
|
root.flags |= 65536;
|
|
thrownValue &= -thrownValue;
|
|
root.lanes |= thrownValue;
|
|
var update$36 = createClassErrorUpdate(
|
|
root,
|
|
wakeable,
|
|
thrownValue
|
|
);
|
|
enqueueCapturedUpdate(root, update$36);
|
|
break a;
|
|
}
|
|
}
|
|
root = root.return;
|
|
} while (null !== root);
|
|
}
|
|
completeUnitOfWork(erroredWork);
|
|
} catch (yetAnotherThrownValue) {
|
|
thrownValue = yetAnotherThrownValue;
|
|
workInProgress === erroredWork &&
|
|
null !== erroredWork &&
|
|
(workInProgress = erroredWork = erroredWork.return);
|
|
continue;
|
|
}
|
|
break;
|
|
} while (1);
|
|
}
|
|
function pushDispatcher() {
|
|
var prevDispatcher = ReactCurrentDispatcher$2.current;
|
|
ReactCurrentDispatcher$2.current = ContextOnlyDispatcher;
|
|
return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher;
|
|
}
|
|
function renderDidSuspendDelayIfPossible() {
|
|
if (
|
|
0 === workInProgressRootExitStatus ||
|
|
3 === workInProgressRootExitStatus ||
|
|
2 === workInProgressRootExitStatus
|
|
)
|
|
workInProgressRootExitStatus = 4;
|
|
null === workInProgressRoot ||
|
|
(0 === (workInProgressRootSkippedLanes & 268435455) &&
|
|
0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) ||
|
|
markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes);
|
|
}
|
|
function renderRootSync(root, lanes) {
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 2;
|
|
var prevDispatcher = pushDispatcher();
|
|
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);
|
|
}
|
|
do
|
|
try {
|
|
workLoopSync();
|
|
break;
|
|
} catch (thrownValue) {
|
|
handleError(root, thrownValue);
|
|
}
|
|
while (1);
|
|
resetContextDependencies();
|
|
executionContext = prevExecutionContext;
|
|
ReactCurrentDispatcher$2.current = prevDispatcher;
|
|
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;
|
|
return workInProgressRootExitStatus;
|
|
}
|
|
function workLoopSync() {
|
|
for (; null !== workInProgress; ) performUnitOfWork(workInProgress);
|
|
}
|
|
function workLoopConcurrent() {
|
|
for (; null !== workInProgress && !shouldYield(); )
|
|
performUnitOfWork(workInProgress);
|
|
}
|
|
function performUnitOfWork(unitOfWork) {
|
|
var current = unitOfWork.alternate;
|
|
0 !== (unitOfWork.mode & 2)
|
|
? ((profilerStartTime = now$1()),
|
|
0 > unitOfWork.actualStartTime && (unitOfWork.actualStartTime = now$1()),
|
|
(current = beginWork$1(current, unitOfWork, subtreeRenderLanes)),
|
|
stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0))
|
|
: (current = beginWork$1(current, unitOfWork, subtreeRenderLanes));
|
|
unitOfWork.memoizedProps = unitOfWork.pendingProps;
|
|
null === current
|
|
? completeUnitOfWork(unitOfWork)
|
|
: (workInProgress = current);
|
|
ReactCurrentOwner$2.current = null;
|
|
}
|
|
function completeUnitOfWork(unitOfWork) {
|
|
var completedWork = unitOfWork;
|
|
do {
|
|
var current = completedWork.alternate;
|
|
unitOfWork = completedWork.return;
|
|
if (0 === (completedWork.flags & 32768)) {
|
|
if (0 === (completedWork.mode & 2))
|
|
current = completeWork(current, completedWork, subtreeRenderLanes);
|
|
else {
|
|
var fiber = completedWork;
|
|
profilerStartTime = now$1();
|
|
0 > fiber.actualStartTime && (fiber.actualStartTime = now$1());
|
|
current = completeWork(current, completedWork, subtreeRenderLanes);
|
|
stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1);
|
|
}
|
|
if (null !== current) {
|
|
workInProgress = current;
|
|
return;
|
|
}
|
|
} else {
|
|
current = unwindWork(current, completedWork);
|
|
if (null !== current) {
|
|
current.flags &= 32767;
|
|
workInProgress = current;
|
|
return;
|
|
}
|
|
if (0 !== (completedWork.mode & 2)) {
|
|
stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1);
|
|
current = completedWork.actualDuration;
|
|
for (fiber = completedWork.child; null !== fiber; )
|
|
(current += fiber.actualDuration), (fiber = fiber.sibling);
|
|
completedWork.actualDuration = current;
|
|
}
|
|
if (null !== unitOfWork)
|
|
(unitOfWork.flags |= 32768),
|
|
(unitOfWork.subtreeFlags = 0),
|
|
(unitOfWork.deletions = null);
|
|
else {
|
|
workInProgressRootExitStatus = 6;
|
|
workInProgress = null;
|
|
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) {
|
|
var previousUpdateLanePriority = currentUpdatePriority,
|
|
prevTransition = ReactCurrentBatchConfig$2.transition;
|
|
try {
|
|
(ReactCurrentBatchConfig$2.transition = null),
|
|
(currentUpdatePriority = 1),
|
|
commitRootImpl(
|
|
root,
|
|
recoverableErrors,
|
|
transitions,
|
|
previousUpdateLanePriority
|
|
);
|
|
} finally {
|
|
(ReactCurrentBatchConfig$2.transition = prevTransition),
|
|
(currentUpdatePriority = previousUpdateLanePriority);
|
|
}
|
|
return null;
|
|
}
|
|
function commitRootImpl(
|
|
root,
|
|
recoverableErrors,
|
|
transitions,
|
|
renderPriorityLevel
|
|
) {
|
|
do flushPassiveEffects();
|
|
while (null !== rootWithPendingPassiveEffects);
|
|
if (0 !== (executionContext & 6))
|
|
throw Error("Should not already be working.");
|
|
transitions = root.finishedWork;
|
|
var lanes = root.finishedLanes;
|
|
if (null === transitions) return null;
|
|
root.finishedWork = null;
|
|
root.finishedLanes = 0;
|
|
if (transitions === 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;
|
|
var remainingLanes = transitions.lanes | transitions.childLanes;
|
|
markRootFinished(root, remainingLanes);
|
|
root === workInProgressRoot &&
|
|
((workInProgress = workInProgressRoot = null),
|
|
(workInProgressRootRenderLanes = 0));
|
|
(0 === (transitions.subtreeFlags & 2064) &&
|
|
0 === (transitions.flags & 2064)) ||
|
|
rootDoesHavePassiveEffects ||
|
|
((rootDoesHavePassiveEffects = !0),
|
|
scheduleCallback$1(NormalPriority, function() {
|
|
flushPassiveEffects();
|
|
return null;
|
|
}));
|
|
remainingLanes = 0 !== (transitions.flags & 15990);
|
|
if (0 !== (transitions.subtreeFlags & 15990) || remainingLanes) {
|
|
remainingLanes = ReactCurrentBatchConfig$2.transition;
|
|
ReactCurrentBatchConfig$2.transition = null;
|
|
var previousPriority = currentUpdatePriority;
|
|
currentUpdatePriority = 1;
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 4;
|
|
ReactCurrentOwner$2.current = null;
|
|
commitBeforeMutationEffects(root, transitions);
|
|
commitTime = now$1();
|
|
commitMutationEffects(root, transitions, lanes);
|
|
root.current = transitions;
|
|
commitLayoutEffects(transitions, root, lanes);
|
|
requestPaint();
|
|
executionContext = prevExecutionContext;
|
|
currentUpdatePriority = previousPriority;
|
|
ReactCurrentBatchConfig$2.transition = remainingLanes;
|
|
} else (root.current = transitions), (commitTime = now$1());
|
|
rootDoesHavePassiveEffects &&
|
|
((rootDoesHavePassiveEffects = !1),
|
|
(rootWithPendingPassiveEffects = root),
|
|
(pendingPassiveEffectsLanes = lanes));
|
|
remainingLanes = root.pendingLanes;
|
|
0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null);
|
|
onCommitRoot(transitions.stateNode, renderPriorityLevel);
|
|
isDevToolsPresent && root.memoizedUpdaters.clear();
|
|
ensureRootIsScheduled(root, now());
|
|
if (null !== recoverableErrors)
|
|
for (
|
|
renderPriorityLevel = root.onRecoverableError, transitions = 0;
|
|
transitions < recoverableErrors.length;
|
|
transitions++
|
|
)
|
|
(lanes = recoverableErrors[transitions]),
|
|
renderPriorityLevel(lanes.value, {
|
|
componentStack: lanes.stack,
|
|
digest: lanes.digest
|
|
});
|
|
if (hasUncaughtError)
|
|
throw ((hasUncaughtError = !1),
|
|
(root = firstUncaughtError),
|
|
(firstUncaughtError = null),
|
|
root);
|
|
0 !== (pendingPassiveEffectsLanes & 1) &&
|
|
0 !== root.tag &&
|
|
flushPassiveEffects();
|
|
remainingLanes = root.pendingLanes;
|
|
0 !== (remainingLanes & 1)
|
|
? ((nestedUpdateScheduled = !0),
|
|
root === rootWithNestedUpdates
|
|
? nestedUpdateCount++
|
|
: ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)))
|
|
: (nestedUpdateCount = 0);
|
|
flushSyncCallbacks();
|
|
return null;
|
|
}
|
|
function flushPassiveEffects() {
|
|
if (null !== rootWithPendingPassiveEffects) {
|
|
var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes),
|
|
prevTransition = ReactCurrentBatchConfig$2.transition,
|
|
previousPriority = currentUpdatePriority;
|
|
try {
|
|
ReactCurrentBatchConfig$2.transition = null;
|
|
currentUpdatePriority = 16 > renderPriority ? 16 : renderPriority;
|
|
if (null === rootWithPendingPassiveEffects)
|
|
var JSCompiler_inline_result = !1;
|
|
else {
|
|
renderPriority = rootWithPendingPassiveEffects;
|
|
rootWithPendingPassiveEffects = null;
|
|
pendingPassiveEffectsLanes = 0;
|
|
if (0 !== (executionContext & 6))
|
|
throw Error("Cannot flush passive effects while already rendering.");
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 4;
|
|
for (nextEffect = renderPriority.current; null !== nextEffect; ) {
|
|
var fiber = nextEffect,
|
|
child = fiber.child;
|
|
if (0 !== (nextEffect.flags & 16)) {
|
|
var deletions = fiber.deletions;
|
|
if (null !== deletions) {
|
|
for (var i = 0; i < deletions.length; i++) {
|
|
var fiberToDelete = deletions[i];
|
|
for (nextEffect = fiberToDelete; null !== nextEffect; ) {
|
|
var fiber$jscomp$0 = nextEffect,
|
|
current = fiber$jscomp$0;
|
|
switch (current.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
current.mode & 2
|
|
? ((passiveEffectStartTime = now$1()),
|
|
commitHookEffectListUnmount(8, current, fiber),
|
|
recordPassiveEffectDuration(current))
|
|
: commitHookEffectListUnmount(8, current, fiber);
|
|
}
|
|
var child$jscomp$0 = fiber$jscomp$0.child;
|
|
if (null !== child$jscomp$0)
|
|
(child$jscomp$0.return = fiber$jscomp$0),
|
|
(nextEffect = child$jscomp$0);
|
|
else
|
|
for (; null !== nextEffect; ) {
|
|
fiber$jscomp$0 = nextEffect;
|
|
var sibling = fiber$jscomp$0.sibling,
|
|
returnFiber = fiber$jscomp$0.return;
|
|
detachFiberAfterEffects(fiber$jscomp$0);
|
|
if (fiber$jscomp$0 === fiberToDelete) {
|
|
nextEffect = null;
|
|
break;
|
|
}
|
|
if (null !== sibling) {
|
|
sibling.return = returnFiber;
|
|
nextEffect = sibling;
|
|
break;
|
|
}
|
|
nextEffect = returnFiber;
|
|
}
|
|
}
|
|
}
|
|
var previousFiber = fiber.alternate;
|
|
if (null !== previousFiber) {
|
|
var detachedChild = previousFiber.child;
|
|
if (null !== detachedChild) {
|
|
previousFiber.child = null;
|
|
do {
|
|
var detachedSibling = detachedChild.sibling;
|
|
detachedChild.sibling = null;
|
|
detachedChild = detachedSibling;
|
|
} while (null !== detachedChild);
|
|
}
|
|
}
|
|
nextEffect = fiber;
|
|
}
|
|
}
|
|
if (0 !== (fiber.subtreeFlags & 2064) && null !== child)
|
|
(child.return = fiber), (nextEffect = child);
|
|
else
|
|
b: for (; null !== nextEffect; ) {
|
|
fiber = nextEffect;
|
|
if (0 !== (fiber.flags & 2048))
|
|
switch (((i = fiber), i.tag)) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
i.mode & 2
|
|
? ((passiveEffectStartTime = now$1()),
|
|
commitHookEffectListUnmount(9, i, i.return),
|
|
recordPassiveEffectDuration(i))
|
|
: commitHookEffectListUnmount(9, i, i.return);
|
|
}
|
|
var sibling$jscomp$0 = fiber.sibling;
|
|
if (null !== sibling$jscomp$0) {
|
|
sibling$jscomp$0.return = fiber.return;
|
|
nextEffect = sibling$jscomp$0;
|
|
break b;
|
|
}
|
|
nextEffect = fiber.return;
|
|
}
|
|
}
|
|
var finishedWork = renderPriority.current;
|
|
for (nextEffect = finishedWork; null !== nextEffect; ) {
|
|
child = nextEffect;
|
|
var firstChild = child.child;
|
|
if (0 !== (child.subtreeFlags & 2064) && null !== firstChild)
|
|
(firstChild.return = child), (nextEffect = firstChild);
|
|
else
|
|
b: for (child = finishedWork; null !== nextEffect; ) {
|
|
deletions = nextEffect;
|
|
if (0 !== (deletions.flags & 2048))
|
|
try {
|
|
switch (((fiberToDelete = deletions), fiberToDelete.tag)) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
if (fiberToDelete.mode & 2) {
|
|
passiveEffectStartTime = now$1();
|
|
try {
|
|
commitHookEffectListMount(9, fiberToDelete);
|
|
} finally {
|
|
recordPassiveEffectDuration(fiberToDelete);
|
|
}
|
|
} else commitHookEffectListMount(9, fiberToDelete);
|
|
}
|
|
} catch (error) {
|
|
captureCommitPhaseError(deletions, deletions.return, error);
|
|
}
|
|
if (deletions === child) {
|
|
nextEffect = null;
|
|
break b;
|
|
}
|
|
var sibling$jscomp$1 = deletions.sibling;
|
|
if (null !== sibling$jscomp$1) {
|
|
sibling$jscomp$1.return = deletions.return;
|
|
nextEffect = sibling$jscomp$1;
|
|
break b;
|
|
}
|
|
nextEffect = deletions.return;
|
|
}
|
|
}
|
|
finishedWork = pendingPassiveProfilerEffects;
|
|
pendingPassiveProfilerEffects = [];
|
|
for (firstChild = 0; firstChild < finishedWork.length; firstChild++) {
|
|
var finishedWork$jscomp$0 = finishedWork[firstChild];
|
|
if (0 !== (finishedWork$jscomp$0.flags & 4))
|
|
switch (finishedWork$jscomp$0.tag) {
|
|
case 12:
|
|
var passiveEffectDuration =
|
|
finishedWork$jscomp$0.stateNode.passiveEffectDuration,
|
|
_finishedWork$memoize = finishedWork$jscomp$0.memoizedProps,
|
|
id = _finishedWork$memoize.id,
|
|
onPostCommit = _finishedWork$memoize.onPostCommit;
|
|
sibling$jscomp$1 = commitTime;
|
|
var phase =
|
|
null === finishedWork$jscomp$0.alternate ? "mount" : "update";
|
|
currentUpdateIsNested && (phase = "nested-update");
|
|
"function" === typeof onPostCommit &&
|
|
onPostCommit(
|
|
id,
|
|
phase,
|
|
passiveEffectDuration,
|
|
sibling$jscomp$1
|
|
);
|
|
var parentFiber = finishedWork$jscomp$0.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;
|
|
flushSyncCallbacks();
|
|
if (
|
|
injectedHook &&
|
|
"function" === typeof injectedHook.onPostCommitFiberRoot
|
|
)
|
|
try {
|
|
injectedHook.onPostCommitFiberRoot(rendererID, renderPriority);
|
|
} catch (err) {}
|
|
var stateNode = renderPriority.current.stateNode;
|
|
stateNode.effectDuration = 0;
|
|
stateNode.passiveEffectDuration = 0;
|
|
JSCompiler_inline_result = !0;
|
|
}
|
|
return JSCompiler_inline_result;
|
|
} finally {
|
|
(currentUpdatePriority = previousPriority),
|
|
(ReactCurrentBatchConfig$2.transition = prevTransition);
|
|
}
|
|
}
|
|
return !1;
|
|
}
|
|
function enqueuePendingPassiveProfilerEffect(fiber) {
|
|
pendingPassiveProfilerEffects.push(fiber);
|
|
rootDoesHavePassiveEffects ||
|
|
((rootDoesHavePassiveEffects = !0),
|
|
scheduleCallback$1(NormalPriority, function() {
|
|
flushPassiveEffects();
|
|
return null;
|
|
}));
|
|
}
|
|
function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
|
|
sourceFiber = createCapturedValueAtFiber(error, sourceFiber);
|
|
sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 1);
|
|
rootFiber = enqueueUpdate(rootFiber, sourceFiber, 1);
|
|
sourceFiber = requestEventTime();
|
|
null !== rootFiber &&
|
|
(markRootUpdated(rootFiber, 1, sourceFiber),
|
|
ensureRootIsScheduled(rootFiber, sourceFiber));
|
|
}
|
|
function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) {
|
|
if (3 === sourceFiber.tag)
|
|
captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error);
|
|
else
|
|
for (
|
|
nearestMountedAncestor = sourceFiber.return;
|
|
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,
|
|
1
|
|
);
|
|
nearestMountedAncestor = enqueueUpdate(
|
|
nearestMountedAncestor,
|
|
sourceFiber,
|
|
1
|
|
);
|
|
sourceFiber = requestEventTime();
|
|
null !== nearestMountedAncestor &&
|
|
(markRootUpdated(nearestMountedAncestor, 1, sourceFiber),
|
|
ensureRootIsScheduled(nearestMountedAncestor, sourceFiber));
|
|
break;
|
|
}
|
|
}
|
|
nearestMountedAncestor = nearestMountedAncestor.return;
|
|
}
|
|
}
|
|
function pingSuspendedRoot(root, wakeable, pingedLanes) {
|
|
var pingCache = root.pingCache;
|
|
null !== pingCache && pingCache.delete(wakeable);
|
|
wakeable = requestEventTime();
|
|
root.pingedLanes |= root.suspendedLanes & pingedLanes;
|
|
workInProgressRoot === root &&
|
|
(workInProgressRootRenderLanes & pingedLanes) === pingedLanes &&
|
|
(4 === workInProgressRootExitStatus ||
|
|
(3 === workInProgressRootExitStatus &&
|
|
(workInProgressRootRenderLanes & 130023424) ===
|
|
workInProgressRootRenderLanes &&
|
|
500 > now() - globalMostRecentFallbackTime)
|
|
? prepareFreshStack(root, 0)
|
|
: (workInProgressRootPingedLanes |= pingedLanes));
|
|
ensureRootIsScheduled(root, wakeable);
|
|
}
|
|
function retryTimedOutBoundary(boundaryFiber, retryLane) {
|
|
0 === retryLane &&
|
|
(0 === (boundaryFiber.mode & 1)
|
|
? (retryLane = 1)
|
|
: ((retryLane = nextRetryLane),
|
|
(nextRetryLane <<= 1),
|
|
0 === (nextRetryLane & 130023424) && (nextRetryLane = 4194304)));
|
|
var eventTime = requestEventTime();
|
|
boundaryFiber = markUpdateLaneFromFiberToRoot(boundaryFiber, retryLane);
|
|
null !== boundaryFiber &&
|
|
(markRootUpdated(boundaryFiber, retryLane, eventTime),
|
|
ensureRootIsScheduled(boundaryFiber, eventTime));
|
|
}
|
|
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;
|
|
default:
|
|
throw Error(
|
|
"Pinged unknown suspense boundary type. This is probably a bug in React."
|
|
);
|
|
}
|
|
null !== retryCache && retryCache.delete(wakeable);
|
|
retryTimedOutBoundary(boundaryFiber, retryLane);
|
|
}
|
|
var beginWork$1;
|
|
beginWork$1 = 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.current
|
|
);
|
|
prepareToReadContext(workInProgress, renderLanes);
|
|
context = renderWithHooks(
|
|
null,
|
|
workInProgress,
|
|
Component,
|
|
current,
|
|
context,
|
|
renderLanes
|
|
);
|
|
workInProgress.flags |= 1;
|
|
if (
|
|
"object" === typeof context &&
|
|
null !== context &&
|
|
"function" === typeof context.render &&
|
|
void 0 === context.$$typeof
|
|
) {
|
|
workInProgress.tag = 1;
|
|
workInProgress.memoizedState = null;
|
|
workInProgress.updateQueue = null;
|
|
if (isContextProvider(Component)) {
|
|
var hasContext = !0;
|
|
pushContextProvider(workInProgress);
|
|
} else hasContext = !1;
|
|
workInProgress.memoizedState =
|
|
null !== context.state && void 0 !== context.state
|
|
? context.state
|
|
: null;
|
|
initializeUpdateQueue(workInProgress);
|
|
context.updater = classComponentUpdater;
|
|
workInProgress.stateNode = context;
|
|
context._reactInternals = workInProgress;
|
|
mountClassInstance(workInProgress, Component, current, renderLanes);
|
|
workInProgress = finishClassComponent(
|
|
null,
|
|
workInProgress,
|
|
Component,
|
|
!0,
|
|
hasContext,
|
|
renderLanes
|
|
);
|
|
} else
|
|
(workInProgress.tag = 0),
|
|
reconcileChildren(null, workInProgress, context, 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."
|
|
);
|
|
}
|
|
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.");
|
|
context = workInProgress.pendingProps;
|
|
Component = workInProgress.memoizedState.element;
|
|
cloneUpdateQueue(current, workInProgress);
|
|
processUpdateQueue(workInProgress, context, null, renderLanes);
|
|
context = workInProgress.memoizedState.element;
|
|
context === Component
|
|
? (workInProgress = bailoutOnAlreadyFinishedWork(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
))
|
|
: (reconcileChildren(current, workInProgress, context, renderLanes),
|
|
(workInProgress = workInProgress.child));
|
|
return workInProgress;
|
|
case 5:
|
|
return (
|
|
pushHostContext(workInProgress),
|
|
(Component = workInProgress.pendingProps.children),
|
|
markRef(current, workInProgress),
|
|
reconcileChildren(current, workInProgress, Component, renderLanes),
|
|
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 = workInProgress.type._context;
|
|
context = workInProgress.pendingProps;
|
|
hasContext = workInProgress.memoizedProps;
|
|
var newValue = context.value;
|
|
push(valueCursor, Component._currentValue);
|
|
Component._currentValue = newValue;
|
|
if (null !== hasContext)
|
|
if (objectIs(hasContext.value, newValue)) {
|
|
if (
|
|
hasContext.children === context.children &&
|
|
!didPerformWorkStackCursor.current
|
|
) {
|
|
workInProgress = bailoutOnAlreadyFinishedWork(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
);
|
|
break a;
|
|
}
|
|
} else
|
|
for (
|
|
hasContext = workInProgress.child,
|
|
null !== hasContext && (hasContext.return = workInProgress);
|
|
null !== hasContext;
|
|
|
|
) {
|
|
var list = hasContext.dependencies;
|
|
if (null !== list) {
|
|
newValue = hasContext.child;
|
|
for (
|
|
var dependency = list.firstContext;
|
|
null !== dependency;
|
|
|
|
) {
|
|
if (dependency.context === Component) {
|
|
if (1 === hasContext.tag) {
|
|
dependency = createUpdate(-1, renderLanes & -renderLanes);
|
|
dependency.tag = 2;
|
|
var updateQueue = hasContext.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;
|
|
}
|
|
}
|
|
hasContext.lanes |= renderLanes;
|
|
dependency = hasContext.alternate;
|
|
null !== dependency && (dependency.lanes |= renderLanes);
|
|
scheduleContextWorkOnParentPath(
|
|
hasContext.return,
|
|
renderLanes,
|
|
workInProgress
|
|
);
|
|
list.lanes |= renderLanes;
|
|
break;
|
|
}
|
|
dependency = dependency.next;
|
|
}
|
|
} else if (10 === hasContext.tag)
|
|
newValue =
|
|
hasContext.type === workInProgress.type
|
|
? null
|
|
: hasContext.child;
|
|
else if (18 === hasContext.tag) {
|
|
newValue = hasContext.return;
|
|
if (null === newValue)
|
|
throw Error(
|
|
"We just came from a parent so we must have had a parent. This is a bug in React."
|
|
);
|
|
newValue.lanes |= renderLanes;
|
|
list = newValue.alternate;
|
|
null !== list && (list.lanes |= renderLanes);
|
|
scheduleContextWorkOnParentPath(
|
|
newValue,
|
|
renderLanes,
|
|
workInProgress
|
|
);
|
|
newValue = hasContext.sibling;
|
|
} else newValue = hasContext.child;
|
|
if (null !== newValue) newValue.return = hasContext;
|
|
else
|
|
for (newValue = hasContext; null !== newValue; ) {
|
|
if (newValue === workInProgress) {
|
|
newValue = null;
|
|
break;
|
|
}
|
|
hasContext = newValue.sibling;
|
|
if (null !== hasContext) {
|
|
hasContext.return = newValue.return;
|
|
newValue = hasContext;
|
|
break;
|
|
}
|
|
newValue = newValue.return;
|
|
}
|
|
hasContext = newValue;
|
|
}
|
|
reconcileChildren(
|
|
current,
|
|
workInProgress,
|
|
context.children,
|
|
renderLanes
|
|
);
|
|
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
|
|
)
|
|
);
|
|
case 19:
|
|
return updateSuspenseListComponent(current, workInProgress, renderLanes);
|
|
case 22:
|
|
return updateOffscreenComponent(current, workInProgress, renderLanes);
|
|
}
|
|
throw Error(
|
|
"Unknown unit of work tag (" +
|
|
workInProgress.tag +
|
|
"). This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
};
|
|
function restorePendingUpdaters(root, lanes) {
|
|
isDevToolsPresent &&
|
|
root.memoizedUpdaters.forEach(function(schedulingFiber) {
|
|
addFiberToLanesMap(root, schedulingFiber, lanes);
|
|
});
|
|
}
|
|
function scheduleCallback$1(priorityLevel, callback) {
|
|
return scheduleCallback(priorityLevel, callback);
|
|
}
|
|
function FiberNode(tag, pendingProps, key, mode) {
|
|
this.tag = tag;
|
|
this.key = key;
|
|
this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null;
|
|
this.index = 0;
|
|
this.ref = null;
|
|
this.pendingProps = pendingProps;
|
|
this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null;
|
|
this.mode = mode;
|
|
this.subtreeFlags = this.flags = 0;
|
|
this.deletions = null;
|
|
this.childLanes = this.lanes = 0;
|
|
this.alternate = null;
|
|
this.actualDuration = 0;
|
|
this.actualStartTime = -1;
|
|
this.treeBaseDuration = this.selfBaseDuration = 0;
|
|
}
|
|
function createFiber(tag, pendingProps, key, mode) {
|
|
return new FiberNode(tag, pendingProps, key, mode);
|
|
}
|
|
function shouldConstruct(Component) {
|
|
Component = Component.prototype;
|
|
return !(!Component || !Component.isReactComponent);
|
|
}
|
|
function resolveLazyComponentTag(Component) {
|
|
if ("function" === typeof Component)
|
|
return shouldConstruct(Component) ? 1 : 0;
|
|
if (void 0 !== Component && null !== Component) {
|
|
Component = Component.$$typeof;
|
|
if (Component === REACT_FORWARD_REF_TYPE) return 11;
|
|
if (Component === REACT_MEMO_TYPE) return 14;
|
|
}
|
|
return 2;
|
|
}
|
|
function createWorkInProgress(current, pendingProps) {
|
|
var workInProgress = current.alternate;
|
|
null === workInProgress
|
|
? ((workInProgress = createFiber(
|
|
current.tag,
|
|
pendingProps,
|
|
current.key,
|
|
current.mode
|
|
)),
|
|
(workInProgress.elementType = current.elementType),
|
|
(workInProgress.type = current.type),
|
|
(workInProgress.stateNode = current.stateNode),
|
|
(workInProgress.alternate = current),
|
|
(current.alternate = workInProgress))
|
|
: ((workInProgress.pendingProps = pendingProps),
|
|
(workInProgress.type = current.type),
|
|
(workInProgress.flags = 0),
|
|
(workInProgress.subtreeFlags = 0),
|
|
(workInProgress.deletions = null),
|
|
(workInProgress.actualDuration = 0),
|
|
(workInProgress.actualStartTime = -1));
|
|
workInProgress.flags = current.flags & 14680064;
|
|
workInProgress.childLanes = current.childLanes;
|
|
workInProgress.lanes = current.lanes;
|
|
workInProgress.child = current.child;
|
|
workInProgress.memoizedProps = current.memoizedProps;
|
|
workInProgress.memoizedState = current.memoizedState;
|
|
workInProgress.updateQueue = current.updateQueue;
|
|
pendingProps = current.dependencies;
|
|
workInProgress.dependencies =
|
|
null === pendingProps
|
|
? null
|
|
: { lanes: pendingProps.lanes, firstContext: pendingProps.firstContext };
|
|
workInProgress.sibling = current.sibling;
|
|
workInProgress.index = current.index;
|
|
workInProgress.ref = current.ref;
|
|
workInProgress.selfBaseDuration = current.selfBaseDuration;
|
|
workInProgress.treeBaseDuration = current.treeBaseDuration;
|
|
return workInProgress;
|
|
}
|
|
function createFiberFromTypeAndProps(
|
|
type,
|
|
key,
|
|
pendingProps,
|
|
owner,
|
|
mode,
|
|
lanes
|
|
) {
|
|
var fiberTag = 2;
|
|
owner = type;
|
|
if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1);
|
|
else if ("string" === typeof type) fiberTag = 5;
|
|
else
|
|
a: switch (type) {
|
|
case REACT_FRAGMENT_TYPE:
|
|
return createFiberFromFragment(pendingProps.children, mode, lanes, key);
|
|
case REACT_STRICT_MODE_TYPE:
|
|
fiberTag = 8;
|
|
mode |= 8;
|
|
break;
|
|
case REACT_PROFILER_TYPE:
|
|
return (
|
|
(type = createFiber(12, pendingProps, key, mode | 2)),
|
|
(type.elementType = REACT_PROFILER_TYPE),
|
|
(type.lanes = lanes),
|
|
(type.stateNode = { effectDuration: 0, passiveEffectDuration: 0 }),
|
|
type
|
|
);
|
|
case REACT_SUSPENSE_TYPE:
|
|
return (
|
|
(type = createFiber(13, pendingProps, key, mode)),
|
|
(type.elementType = REACT_SUSPENSE_TYPE),
|
|
(type.lanes = lanes),
|
|
type
|
|
);
|
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
return (
|
|
(type = createFiber(19, pendingProps, key, mode)),
|
|
(type.elementType = REACT_SUSPENSE_LIST_TYPE),
|
|
(type.lanes = lanes),
|
|
type
|
|
);
|
|
case REACT_OFFSCREEN_TYPE:
|
|
return createFiberFromOffscreen(pendingProps, mode, lanes, key);
|
|
default:
|
|
if ("object" === typeof type && null !== type)
|
|
switch (type.$$typeof) {
|
|
case REACT_PROVIDER_TYPE:
|
|
fiberTag = 10;
|
|
break a;
|
|
case REACT_CONTEXT_TYPE:
|
|
fiberTag = 9;
|
|
break a;
|
|
case REACT_FORWARD_REF_TYPE:
|
|
fiberTag = 11;
|
|
break a;
|
|
case REACT_MEMO_TYPE:
|
|
fiberTag = 14;
|
|
break a;
|
|
case REACT_LAZY_TYPE:
|
|
fiberTag = 16;
|
|
owner = null;
|
|
break a;
|
|
}
|
|
throw Error(
|
|
"Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " +
|
|
((null == type ? type : typeof type) + ".")
|
|
);
|
|
}
|
|
key = createFiber(fiberTag, pendingProps, key, mode);
|
|
key.elementType = type;
|
|
key.type = owner;
|
|
key.lanes = lanes;
|
|
return key;
|
|
}
|
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
|
elements = createFiber(7, elements, key, mode);
|
|
elements.lanes = lanes;
|
|
return elements;
|
|
}
|
|
function createFiberFromOffscreen(pendingProps, mode, lanes, key) {
|
|
pendingProps = createFiber(22, pendingProps, key, mode);
|
|
pendingProps.elementType = REACT_OFFSCREEN_TYPE;
|
|
pendingProps.lanes = lanes;
|
|
pendingProps.stateNode = { isHidden: !1 };
|
|
return pendingProps;
|
|
}
|
|
function createFiberFromText(content, mode, lanes) {
|
|
content = createFiber(6, content, null, mode);
|
|
content.lanes = lanes;
|
|
return content;
|
|
}
|
|
function createFiberFromPortal(portal, mode, lanes) {
|
|
mode = createFiber(
|
|
4,
|
|
null !== portal.children ? portal.children : [],
|
|
portal.key,
|
|
mode
|
|
);
|
|
mode.lanes = lanes;
|
|
mode.stateNode = {
|
|
containerInfo: portal.containerInfo,
|
|
pendingChildren: null,
|
|
implementation: portal.implementation
|
|
};
|
|
return mode;
|
|
}
|
|
function FiberRootNode(
|
|
containerInfo,
|
|
tag,
|
|
hydrate,
|
|
identifierPrefix,
|
|
onRecoverableError
|
|
) {
|
|
this.tag = tag;
|
|
this.containerInfo = containerInfo;
|
|
this.finishedWork = this.pingCache = this.current = this.pendingChildren = null;
|
|
this.timeoutHandle = -1;
|
|
this.callbackNode = this.pendingContext = this.context = null;
|
|
this.callbackPriority = 0;
|
|
this.eventTimes = createLaneMap(0);
|
|
this.expirationTimes = createLaneMap(-1);
|
|
this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0;
|
|
this.entanglements = createLaneMap(0);
|
|
this.identifierPrefix = identifierPrefix;
|
|
this.onRecoverableError = onRecoverableError;
|
|
this.passiveEffectDuration = this.effectDuration = 0;
|
|
this.memoizedUpdaters = new Set();
|
|
containerInfo = this.pendingUpdatersLaneMap = [];
|
|
for (tag = 0; 31 > tag; tag++) containerInfo.push(new Set());
|
|
}
|
|
function createPortal(children, containerInfo, implementation) {
|
|
var key =
|
|
3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
|
|
return {
|
|
$$typeof: REACT_PORTAL_TYPE,
|
|
key: null == key ? null : "" + key,
|
|
children: children,
|
|
containerInfo: containerInfo,
|
|
implementation: implementation
|
|
};
|
|
}
|
|
function findHostInstance(component) {
|
|
var fiber = component._reactInternals;
|
|
if (void 0 === fiber) {
|
|
if ("function" === typeof component.render)
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
component = Object.keys(component).join(",");
|
|
throw Error(
|
|
"Argument appears to not be a ReactComponent. Keys: " + component
|
|
);
|
|
}
|
|
component = findCurrentHostFiber(fiber);
|
|
return null === component ? null : component.stateNode;
|
|
}
|
|
function updateContainer(element, container, parentComponent, callback) {
|
|
var current = container.current,
|
|
eventTime = requestEventTime(),
|
|
lane = requestUpdateLane(current);
|
|
a: if (parentComponent) {
|
|
parentComponent = parentComponent._reactInternals;
|
|
b: {
|
|
if (
|
|
getNearestMountedFiber(parentComponent) !== parentComponent ||
|
|
1 !== parentComponent.tag
|
|
)
|
|
throw Error(
|
|
"Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
var JSCompiler_inline_result = parentComponent;
|
|
do {
|
|
switch (JSCompiler_inline_result.tag) {
|
|
case 3:
|
|
JSCompiler_inline_result =
|
|
JSCompiler_inline_result.stateNode.context;
|
|
break b;
|
|
case 1:
|
|
if (isContextProvider(JSCompiler_inline_result.type)) {
|
|
JSCompiler_inline_result =
|
|
JSCompiler_inline_result.stateNode
|
|
.__reactInternalMemoizedMergedChildContext;
|
|
break b;
|
|
}
|
|
}
|
|
JSCompiler_inline_result = JSCompiler_inline_result.return;
|
|
} while (null !== JSCompiler_inline_result);
|
|
throw Error(
|
|
"Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
if (1 === parentComponent.tag) {
|
|
var Component = parentComponent.type;
|
|
if (isContextProvider(Component)) {
|
|
parentComponent = processChildContext(
|
|
parentComponent,
|
|
Component,
|
|
JSCompiler_inline_result
|
|
);
|
|
break a;
|
|
}
|
|
}
|
|
parentComponent = JSCompiler_inline_result;
|
|
} else parentComponent = emptyContextObject;
|
|
null === container.context
|
|
? (container.context = parentComponent)
|
|
: (container.pendingContext = parentComponent);
|
|
container = createUpdate(eventTime, lane);
|
|
container.payload = { element: element };
|
|
callback = void 0 === callback ? null : callback;
|
|
null !== callback && (container.callback = callback);
|
|
element = enqueueUpdate(current, container, lane);
|
|
null !== element &&
|
|
(scheduleUpdateOnFiber(element, current, lane, eventTime),
|
|
entangleTransitions(element, current, lane));
|
|
return lane;
|
|
}
|
|
function emptyFindFiberByHostInstance() {
|
|
return null;
|
|
}
|
|
function findNodeHandle(componentOrHandle) {
|
|
if (null == componentOrHandle) return null;
|
|
if ("number" === typeof componentOrHandle) return componentOrHandle;
|
|
if (componentOrHandle._nativeTag) return componentOrHandle._nativeTag;
|
|
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
|
|
return componentOrHandle.canonical._nativeTag;
|
|
componentOrHandle = findHostInstance(componentOrHandle);
|
|
return null == componentOrHandle
|
|
? componentOrHandle
|
|
: componentOrHandle.canonical
|
|
? componentOrHandle.canonical._nativeTag
|
|
: componentOrHandle._nativeTag;
|
|
}
|
|
function onRecoverableError(error) {
|
|
console.error(error);
|
|
}
|
|
function unmountComponentAtNode(containerTag) {
|
|
var root = roots.get(containerTag);
|
|
root &&
|
|
updateContainer(null, root, null, function() {
|
|
roots.delete(containerTag);
|
|
});
|
|
}
|
|
batchedUpdatesImpl = function(fn, a) {
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 1;
|
|
try {
|
|
return fn(a);
|
|
} finally {
|
|
(executionContext = prevExecutionContext),
|
|
0 === executionContext &&
|
|
((workInProgressRootRenderTargetTime = now() + 500),
|
|
includesLegacySyncCallbacks && flushSyncCallbacks());
|
|
}
|
|
};
|
|
var roots = new Map(),
|
|
devToolsConfig$jscomp$inline_1022 = {
|
|
findFiberByHostInstance: getInstanceFromTag,
|
|
bundleType: 0,
|
|
version: "18.2.0-next-9e3b772b8-20220608",
|
|
rendererPackageName: "react-native-renderer",
|
|
rendererConfig: {
|
|
getInspectorDataForViewTag: function() {
|
|
throw Error(
|
|
"getInspectorDataForViewTag() is not available in production"
|
|
);
|
|
},
|
|
getInspectorDataForViewAtPoint: function() {
|
|
throw Error(
|
|
"getInspectorDataForViewAtPoint() is not available in production."
|
|
);
|
|
}.bind(null, findNodeHandle)
|
|
}
|
|
};
|
|
var internals$jscomp$inline_1310 = {
|
|
bundleType: devToolsConfig$jscomp$inline_1022.bundleType,
|
|
version: devToolsConfig$jscomp$inline_1022.version,
|
|
rendererPackageName: devToolsConfig$jscomp$inline_1022.rendererPackageName,
|
|
rendererConfig: devToolsConfig$jscomp$inline_1022.rendererConfig,
|
|
overrideHookState: null,
|
|
overrideHookStateDeletePath: null,
|
|
overrideHookStateRenamePath: null,
|
|
overrideProps: null,
|
|
overridePropsDeletePath: null,
|
|
overridePropsRenamePath: null,
|
|
setErrorHandler: null,
|
|
setSuspenseHandler: null,
|
|
scheduleUpdate: null,
|
|
currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher,
|
|
findHostInstanceByFiber: function(fiber) {
|
|
fiber = findCurrentHostFiber(fiber);
|
|
return null === fiber ? null : fiber.stateNode;
|
|
},
|
|
findFiberByHostInstance:
|
|
devToolsConfig$jscomp$inline_1022.findFiberByHostInstance ||
|
|
emptyFindFiberByHostInstance,
|
|
findHostInstancesForRefresh: null,
|
|
scheduleRefresh: null,
|
|
scheduleRoot: null,
|
|
setRefreshHandler: null,
|
|
getCurrentFiber: null,
|
|
reconcilerVersion: "18.2.0-next-9e3b772b8-20220608"
|
|
};
|
|
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
|
var hook$jscomp$inline_1311 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
if (
|
|
!hook$jscomp$inline_1311.isDisabled &&
|
|
hook$jscomp$inline_1311.supportsFiber
|
|
)
|
|
try {
|
|
(rendererID = hook$jscomp$inline_1311.inject(
|
|
internals$jscomp$inline_1310
|
|
)),
|
|
(injectedHook = hook$jscomp$inline_1311);
|
|
} catch (err) {}
|
|
}
|
|
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
|
computeComponentStackForErrorReporting: function(reactTag) {
|
|
return (reactTag = getInstanceFromTag(reactTag))
|
|
? getStackByFiberInDevAndProd(reactTag)
|
|
: "";
|
|
}
|
|
};
|
|
exports.createPortal = function(children, containerTag) {
|
|
return createPortal(
|
|
children,
|
|
containerTag,
|
|
null,
|
|
2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null
|
|
);
|
|
};
|
|
exports.dispatchCommand = function(handle, command, args) {
|
|
null != handle._nativeTag &&
|
|
(null != handle._internalInstanceHandle
|
|
? ((handle = handle._internalInstanceHandle.stateNode),
|
|
null != handle &&
|
|
nativeFabricUIManager.dispatchCommand(handle.node, command, args))
|
|
: ReactNativePrivateInterface.UIManager.dispatchViewManagerCommand(
|
|
handle._nativeTag,
|
|
command,
|
|
args
|
|
));
|
|
};
|
|
exports.findHostInstance_DEPRECATED = function(componentOrHandle) {
|
|
if (null == componentOrHandle) return null;
|
|
if (componentOrHandle._nativeTag) return componentOrHandle;
|
|
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
|
|
return componentOrHandle.canonical;
|
|
componentOrHandle = findHostInstance(componentOrHandle);
|
|
return null == componentOrHandle
|
|
? componentOrHandle
|
|
: componentOrHandle.canonical
|
|
? componentOrHandle.canonical
|
|
: componentOrHandle;
|
|
};
|
|
exports.findNodeHandle = findNodeHandle;
|
|
exports.getInspectorDataForInstance = void 0;
|
|
exports.render = function(element, containerTag, callback) {
|
|
var root = roots.get(containerTag);
|
|
if (!root) {
|
|
root = new FiberRootNode(containerTag, 0, !1, "", onRecoverableError);
|
|
var JSCompiler_inline_result = 0;
|
|
isDevToolsPresent && (JSCompiler_inline_result |= 2);
|
|
JSCompiler_inline_result = createFiber(
|
|
3,
|
|
null,
|
|
null,
|
|
JSCompiler_inline_result
|
|
);
|
|
root.current = JSCompiler_inline_result;
|
|
JSCompiler_inline_result.stateNode = root;
|
|
JSCompiler_inline_result.memoizedState = {
|
|
element: null,
|
|
isDehydrated: !1,
|
|
cache: null,
|
|
transitions: null,
|
|
pendingSuspenseBoundaries: null
|
|
};
|
|
initializeUpdateQueue(JSCompiler_inline_result);
|
|
roots.set(containerTag, root);
|
|
}
|
|
updateContainer(element, root, null, callback);
|
|
a: if (((element = root.current), element.child))
|
|
switch (element.child.tag) {
|
|
case 5:
|
|
element = element.child.stateNode;
|
|
break a;
|
|
default:
|
|
element = element.child.stateNode;
|
|
}
|
|
else element = null;
|
|
return element;
|
|
};
|
|
exports.sendAccessibilityEvent = function(handle, eventType) {
|
|
null != handle._nativeTag &&
|
|
(null != handle._internalInstanceHandle
|
|
? ((handle = handle._internalInstanceHandle.stateNode),
|
|
null != handle &&
|
|
nativeFabricUIManager.sendAccessibilityEvent(handle.node, eventType))
|
|
: ReactNativePrivateInterface.legacySendAccessibilityEvent(
|
|
handle._nativeTag,
|
|
eventType
|
|
));
|
|
};
|
|
exports.unmountComponentAtNode = unmountComponentAtNode;
|
|
exports.unmountComponentAtNodeAndRemoveContainer = function(containerTag) {
|
|
unmountComponentAtNode(containerTag);
|
|
ReactNativePrivateInterface.UIManager.removeRootView(containerTag);
|
|
};
|
|
exports.unstable_batchedUpdates = batchedUpdates;
|
|
|
|
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
if (
|
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
'function'
|
|
) {
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
}
|
|
|