UNPKG

react-native

Version:

A framework for building native apps using React

1,508 lines (1,506 loc) • 311 kB
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @noflow * @nolint * @providesModule ReactFabric-prod * @preventMunge * @generated SignedSource<<9a40170807089a671035525b144e9dcd>> */ "use strict"; require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), React = require("react"), Scheduler = require("scheduler"), isArrayImpl = Array.isArray, hasError = !1, caughtError = null, getFiberCurrentPropsFromNode$1 = null, getInstanceFromNode$1 = null, getNodeFromInstance$1 = null; function executeDispatch(event, listener, inst) { event.currentTarget = getNodeFromInstance$1(inst); try { listener(event); } catch (error) { hasError || ((hasError = !0), (caughtError = error)); } event.currentTarget = null; } function executeDirectDispatch(event) { var dispatchListener = event._dispatchListeners, dispatchInstance = event._dispatchInstances; if (isArrayImpl(dispatchListener)) throw Error("Invalid `event`."); event.currentTarget = dispatchListener ? getNodeFromInstance$1(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("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("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$1(inst) { do inst = inst.return; while (inst && 5 !== inst.tag); return inst ? inst : null; } function traverseTwoPhase$1(inst, fn, arg) { for (var path = []; inst; ) path.push(inst), (inst = getParent$1(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$1(inst, registrationName) { inst = inst.stateNode; if (null === inst) return null; inst = getFiberCurrentPropsFromNode$1(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$1(inst, phase, event) { if ( (phase = getListener$1( inst, event.dispatchConfig.phasedRegistrationNames[phase] )) ) (event._dispatchListeners = accumulateInto( event._dispatchListeners, phase )), (event._dispatchInstances = accumulateInto( event._dispatchInstances, inst )); } function accumulateDirectDispatchesSingle$1(event) { if (event && event.dispatchConfig.registrationName) { var inst = event._targetInst; if (inst && event && event.dispatchConfig.registrationName) { var listener = getListener$1(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$1(targetInst) : null; traverseTwoPhase$1(targetInst, accumulateDirectionalDispatches$1, event); } } function accumulateTwoPhaseDispatchesSingle$1(event) { event && event.dispatchConfig.phasedRegistrationNames && traverseTwoPhase$1( event._targetInst, accumulateDirectionalDispatches$1, 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$1(tempA) ) depthA++; tempA = 0; for (var tempB = targetInst; tempB; tempB = getParent$1(tempB)) tempA++; for (; 0 < depthA - tempA; ) (JSCompiler_temp = getParent$1(JSCompiler_temp)), depthA--; for (; 0 < tempA - depthA; ) (targetInst = getParent$1(targetInst)), tempA--; for (; depthA--; ) { if ( JSCompiler_temp === targetInst || JSCompiler_temp === targetInst.alternate ) break b; JSCompiler_temp = getParent$1(JSCompiler_temp); targetInst = getParent$1(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$1 ); 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$1 ), (targetInst = !0 === executeDirectDispatch(shouldSetEventType)), responderInst) ) if ( ((depthA = ResponderSyntheticEvent.getPooled( eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget )), (depthA.touchHistory = ResponderTouchHistoryStore.touchHistory), forEachAccumulated(depthA, accumulateDirectDispatchesSingle$1), (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$1); 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$1 ), (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$1 ), (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$1(targetInst); b: { for (targetInst = responderInst; depthA; ) { if ( targetInst === depthA || targetInst === depthA.alternate ) { targetInst = !0; break b; } depthA = getParent$1(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$1), (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]; if (eventNameDispatchConfigs.hasOwnProperty(eventName)) throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + (eventName + "`.") ); eventNameDispatchConfigs[eventName] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; if (phasedRegistrationNames) { for (JSCompiler_inline_result in phasedRegistrationNames) phasedRegistrationNames.hasOwnProperty( JSCompiler_inline_result ) && publishRegistrationName( phasedRegistrationNames[JSCompiler_inline_result], pluginModule ); JSCompiler_inline_result = !0; } else dispatchConfig.registrationName ? (publishRegistrationName( dispatchConfig.registrationName, pluginModule ), (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 getListener(inst, registrationName) { inst = inst.stateNode; if (null === inst) return null; inst = getFiberCurrentPropsFromNode$1(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; } var customBubblingEventTypes = ReactNativePrivateInterface.ReactNativeViewConfigRegistry .customBubblingEventTypes, customDirectEventTypes = ReactNativePrivateInterface.ReactNativeViewConfigRegistry .customDirectEventTypes; 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 traverseTwoPhase(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(event) { event && event.dispatchConfig.phasedRegistrationNames && traverseTwoPhase( event._targetInst, accumulateDirectionalDispatches, event, !1 ); } 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 ))); } } } 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_227 = { 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( topLevelType._targetInst, accumulateDirectionalDispatches, topLevelType, !0 ) : forEachAccumulated( topLevelType, accumulateTwoPhaseDispatchesSingle ); else if (directDispatchConfig) forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle); else return null; return topLevelType; } } }, isOrderingDirty$jscomp$inline_228 = !1, pluginName$jscomp$inline_229; for (pluginName$jscomp$inline_229 in injectedNamesToPlugins$jscomp$inline_227) if ( injectedNamesToPlugins$jscomp$inline_227.hasOwnProperty( pluginName$jscomp$inline_229 ) ) { var pluginModule$jscomp$inline_230 = injectedNamesToPlugins$jscomp$inline_227[pluginName$jscomp$inline_229]; if ( !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_229) || namesToPlugins[pluginName$jscomp$inline_229] !== pluginModule$jscomp$inline_230 ) { if (namesToPlugins[pluginName$jscomp$inline_229]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + (pluginName$jscomp$inline_229 + "`.") ); namesToPlugins[pluginName$jscomp$inline_229] = pluginModule$jscomp$inline_230; isOrderingDirty$jscomp$inline_228 = !0; } } isOrderingDirty$jscomp$inline_228 && recomputePluginOrdering(); 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$1 in prevProps) void 0 === nextProps[propKey$1] && (!(attributeConfig = validAttributes[propKey$1]) || (updatePayload && void 0 !== updatePayload[propKey$1]) || ((prevProp = prevProps[propKey$1]), void 0 !== prevProp && ("object" !== typeof attributeConfig || "function" === typeof attributeConfig.diff || "function" === typeof attributeConfig.process ? (((updatePayload || (updatePayload = {}))[propKey$1] = null), removedKeys || (removedKeys = {}), removedKeys[propKey$1] || ((removedKeys[propKey$1] = !0), removedKeyCount++)) : (updatePayload = clearNestedProperty( updatePayload, prevProp, attributeConfig ))))); return updatePayload; } function batchedUpdatesImpl(fn, bookkeeping) { return fn(bookkeeping); } var isInsideEventHandler = !1; function batchedUpdates$1(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); } } function dispatchEvent(target, topLevelType, nativeEvent) { var eventTarget = null; if (null != target) { var stateNode = target.stateNode; null != stateNode && (eventTarget = getPublicInstance(stateNode)); } batchedUpdates$1(function () { var event = { eventName: topLevelType, nativeEvent: nativeEvent }; ReactNativePrivateInterface.RawEventEmitter.emit(topLevelType, event); ReactNativePrivateInterface.RawEventEmitter.emit("*", event); event = eventTarget; for ( var events = null, legacyPlugins = plugins, i = 0; i < legacyPlugins.length; i++ ) { var possiblePlugin = legacyPlugins[i]; possiblePlugin && (possiblePlugin = possiblePlugin.extractEvents( topLevelType, target, nativeEvent, event )) && (events = accumulateInto(events, possiblePlugin)); } event = events; null !== event && (eventQueue = accumulateInto(eventQueue, event)); event = eventQueue; eventQueue = null; if (event) { forEachAccumulated(event, executeDispatchesAndReleaseTopLevel); if (eventQueue) throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." ); if (hasError) throw ( ((event = caughtError), (hasError = !1), (caughtError = null), event) ); } }); } var scheduleCallback$2 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = 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, ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, rendererID = null, injectedHook = null; function onCommitRoot(root) { if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot) try { injectedHook.onCommitFiberRoot( rendererID, root, void 0, 128 === (root.current.flags & 128) ); } 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 = 128, nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { var pendingSyncLanes = lanes & 42; if (0 !== pendingSyncLanes) return pendingSyncLanes; switch (lanes & -lanes) { case 1: return 1; case 2: return 2; case 4: return 4; case 8: return 8; case 16: return 16; case 32: return 32; case 64: return 64; case 128: 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 & 4194176; case 4194304: case 8388608: case 16777216: case 33554432: return lanes & 62914560; case 67108864: return 67108864; case 134217728: return 134217728; case 268435456: return 268435456; case 536870912: return 536870912; case 1073741824: return 0; default: return lanes; } } function getNextLanes(root, wipLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, suspendedLanes = root.suspendedLanes; root = root.pingedLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) : ((root &= nonIdlePendingLanes), 0 !== root && (nextLanes = getHighestPriorityLanes(root)))) : ((pendingLanes &= ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) : 0 !== root && (nextLanes = getHighestPriorityLanes(root))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), (root = wipLanes & -wipLanes), suspendedLanes >= root || (32 === suspendedLanes && 0 !== (root & 4194176))) ? wipLanes : nextLanes; } function computeExpirationTime(lane, currentTime) { switch (lane) { case 1: case 2: case 4: case 8: return currentTime + 250; 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: return -1; case 67108864: case 134217728: case 268435456: case 536870912: case 1073741824: return -1; default: return -1; } } function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; root = root.pendingLanes & -536870913; return 0 !== root ? root : root & 536870912 ? 536870912 : 0; } function claimNextTransitionLane() { var lane = nextTransitionLane; nextTransitionLane <<= 1; 0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128); return lane; } function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } function markRootUpdated$1(root, updateLane) { root.pendingLanes |= updateLane; 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0)); } function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; root.pingedLanes = 0; root.expiredLanes &= remainingLanes; root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; remainingLanes = root.entanglements; for ( var expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; 0 < noLongerPendingLanes; ) { var index$5 = 31 - clz32(noLongerPendingLanes), lane = 1 << index$5; remainingLanes[index$5] = 0; expirationTimes[index$5] = -1; var hiddenUpdatesForLane = hiddenUpdates[index$5]; if (null !== hiddenUpdatesForLane) for ( hiddenUpdates[index$5] = null, index$5 = 0; index$5 < hiddenUpdatesForLane.length; index$5++ ) { var update = hiddenUpdatesForLane[index$5]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; root.suspendedLanes &= ~spawnedLane; var spawnedLaneIndex = 31 - clz32(spawnedLane); root.entangledLanes |= spawnedLane; root.entanglements[spawnedLaneIndex] = root.entanglements[spawnedLaneIndex] | 1073741824 | (entangledLanes & 4194218); } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { var index$6 = 31 - clz32(rootEntangledLanes), lane = 1 << index$6; (lane & entangledLanes) | (root[index$6] & entangledLanes) && (root[index$6] |= entangledLanes); rootEntangledLanes &= ~lane; } } var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes ? 0 !== (lanes & 13421