/** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @noflow * @providesModule ReactNativeStack-dev */ "use strict"; __DEV__ && function() { var invariant = require("fbjs/lib/invariant"), React = require("react"), warning = require("fbjs/lib/warning"), ExecutionEnvironment = require("fbjs/lib/ExecutionEnvironment"), performanceNow = require("fbjs/lib/performanceNow"), emptyObject = require("fbjs/lib/emptyObject"), UIManager = require("UIManager"), checkPropTypes = require("prop-types/checkPropTypes"), shallowEqual = require("fbjs/lib/shallowEqual"); require("InitializeCore"); var RCTEventEmitter = require("RCTEventEmitter"), emptyFunction = require("fbjs/lib/emptyFunction"), deepDiffer = require("deepDiffer"), flattenStyle = require("flattenStyle"), TextInputState = require("TextInputState"), deepFreezeAndThrowOnMutationInDev = require("deepFreezeAndThrowOnMutationInDev"), instanceCache = {}, instanceProps = {}; function getRenderedHostOrTextFromComponent(component) { for (var rendered; rendered = component._renderedComponent; ) component = rendered; return component; } function precacheNode(inst, tag) { var nativeInst = getRenderedHostOrTextFromComponent(inst); instanceCache[tag] = nativeInst; } function precacheFiberNode(hostInst, tag) { instanceCache[tag] = hostInst; } function uncacheNode(inst) { var tag = inst._rootNodeID; tag && delete instanceCache[tag]; } function uncacheFiberNode(tag) { delete instanceCache[tag], delete instanceProps[tag]; } function getInstanceFromTag(tag) { return instanceCache[tag] || null; } function getTagFromInstance(inst) { var tag = "number" != typeof inst.tag ? inst._rootNodeID : inst.stateNode._nativeTag; return invariant(tag, "All native instances should have a tag."), tag; } function getFiberCurrentPropsFromNode(stateNode) { return instanceProps[stateNode._nativeTag] || null; } function updateFiberProps(tag, props) { instanceProps[tag] = props; } var ReactNativeComponentTree = { getClosestInstanceFromNode: getInstanceFromTag, getInstanceFromNode: getInstanceFromTag, getNodeFromInstance: getTagFromInstance, precacheFiberNode: precacheFiberNode, precacheNode: precacheNode, uncacheFiberNode: uncacheFiberNode, uncacheNode: uncacheNode, getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode, updateFiberProps: updateFiberProps }, ReactNativeComponentTree_1 = ReactNativeComponentTree, ReactInvalidSetStateWarningHook = {}, warning$2 = warning, processingChildContext = !1, warnInvalidSetState = function() { warning$2(!processingChildContext, "setState(...): Cannot call setState() inside getChildContext()"); }; ReactInvalidSetStateWarningHook = { onBeginProcessingChildContext: function() { processingChildContext = !0; }, onEndProcessingChildContext: function() { processingChildContext = !1; }, onSetState: function() { warnInvalidSetState(); } }; var ReactInvalidSetStateWarningHook_1 = ReactInvalidSetStateWarningHook, ReactHostOperationHistoryHook = null, history = []; ReactHostOperationHistoryHook = { onHostOperation: function(operation) { history.push(operation); }, clearHistory: function() { ReactHostOperationHistoryHook._preventClearing || (history = []); }, getHistory: function() { return history; } }; var ReactHostOperationHistoryHook_1 = ReactHostOperationHistoryHook, ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, ReactGlobalSharedState = { ReactCurrentOwner: ReactInternals.ReactCurrentOwner }; Object.assign(ReactGlobalSharedState, { ReactComponentTreeHook: ReactInternals.ReactComponentTreeHook, ReactDebugCurrentFrame: ReactInternals.ReactDebugCurrentFrame }); var ReactGlobalSharedState_1 = ReactGlobalSharedState, ReactComponentTreeHook = ReactGlobalSharedState_1.ReactComponentTreeHook, warning$1 = warning, ReactDebugTool$1 = null, hooks = [], didHookThrowForEvent = {}, callHook = function(event, fn, context, arg1, arg2, arg3, arg4, arg5) { try { fn.call(context, arg1, arg2, arg3, arg4, arg5); } catch (e) { warning$1(didHookThrowForEvent[event], "Exception thrown by hook while handling %s: %s", event, e + "\n" + e.stack), didHookThrowForEvent[event] = !0; } }, emitEvent = function(event, arg1, arg2, arg3, arg4, arg5) { for (var i = 0; i < hooks.length; i++) { var hook = hooks[i], fn = hook[event]; fn && callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5); } }, isProfiling = !1, flushHistory = [], lifeCycleTimerStack = [], currentFlushNesting = 0, currentFlushMeasurements = [], currentFlushStartTime = 0, currentTimerDebugID = null, currentTimerStartTime = 0, currentTimerNestedFlushDuration = 0, currentTimerType = null, lifeCycleTimerHasWarned = !1, clearHistory = function() { ReactComponentTreeHook.purgeUnmountedComponents(), ReactHostOperationHistoryHook_1.clearHistory(); }, getTreeSnapshot = function(registeredIDs) { return registeredIDs.reduce(function(tree, id) { var ownerID = ReactComponentTreeHook.getOwnerID(id), parentID = ReactComponentTreeHook.getParentID(id); return tree[id] = { displayName: ReactComponentTreeHook.getDisplayName(id), text: ReactComponentTreeHook.getText(id), updateCount: ReactComponentTreeHook.getUpdateCount(id), childIDs: ReactComponentTreeHook.getChildIDs(id), ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0, parentID: parentID }, tree; }, {}); }, resetMeasurements = function() { var previousStartTime = currentFlushStartTime, previousMeasurements = currentFlushMeasurements, previousOperations = ReactHostOperationHistoryHook_1.getHistory(); if (0 === currentFlushNesting) return currentFlushStartTime = 0, currentFlushMeasurements = [], void clearHistory(); if (previousMeasurements.length || previousOperations.length) { var registeredIDs = ReactComponentTreeHook.getRegisteredIDs(); flushHistory.push({ duration: performanceNow() - previousStartTime, measurements: previousMeasurements || [], operations: previousOperations || [], treeSnapshot: getTreeSnapshot(registeredIDs) }); } clearHistory(), currentFlushStartTime = performanceNow(), currentFlushMeasurements = []; }, checkDebugID = function(debugID) { arguments.length > 1 && void 0 !== arguments[1] && arguments[1] && 0 === debugID || debugID || warning$1(!1, "ReactDebugTool: debugID may not be empty."); }, beginLifeCycleTimer = function(debugID, timerType) { 0 !== currentFlushNesting && (currentTimerType && !lifeCycleTimerHasWarned && (warning$1(!1, "There is an internal error in the React performance measurement code." + "\n\nDid not expect %s timer to start while %s timer is still in " + "progress for %s instance.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"), lifeCycleTimerHasWarned = !0), currentTimerStartTime = performanceNow(), currentTimerNestedFlushDuration = 0, currentTimerDebugID = debugID, currentTimerType = timerType); }, endLifeCycleTimer = function(debugID, timerType) { 0 !== currentFlushNesting && (currentTimerType === timerType || lifeCycleTimerHasWarned || (warning$1(!1, "There is an internal error in the React performance measurement code. " + "We did not expect %s timer to stop while %s timer is still in " + "progress for %s instance. Please report this as a bug in React.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"), lifeCycleTimerHasWarned = !0), isProfiling && currentFlushMeasurements.push({ timerType: timerType, instanceID: debugID, duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration }), currentTimerStartTime = 0, currentTimerNestedFlushDuration = 0, currentTimerDebugID = null, currentTimerType = null); }, pauseCurrentLifeCycleTimer = function() { var currentTimer = { startTime: currentTimerStartTime, nestedFlushStartTime: performanceNow(), debugID: currentTimerDebugID, timerType: currentTimerType }; lifeCycleTimerStack.push(currentTimer), currentTimerStartTime = 0, currentTimerNestedFlushDuration = 0, currentTimerDebugID = null, currentTimerType = null; }, resumeCurrentLifeCycleTimer = function() { var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(), startTime = _lifeCycleTimerStack$.startTime, nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime, debugID = _lifeCycleTimerStack$.debugID, timerType = _lifeCycleTimerStack$.timerType, nestedFlushDuration = performanceNow() - nestedFlushStartTime; currentTimerStartTime = startTime, currentTimerNestedFlushDuration += nestedFlushDuration, currentTimerDebugID = debugID, currentTimerType = timerType; }, lastMarkTimeStamp = 0, canUsePerformanceMeasure = "undefined" != typeof performance && "function" == typeof performance.mark && "function" == typeof performance.clearMarks && "function" == typeof performance.measure && "function" == typeof performance.clearMeasures, shouldMark = function(debugID) { if (!isProfiling || !canUsePerformanceMeasure) return !1; var element = ReactComponentTreeHook.getElement(debugID); return null != element && "object" == typeof element && !("string" == typeof element.type); }, markBegin = function(debugID, markType) { if (shouldMark(debugID)) { var markName = debugID + "::" + markType; lastMarkTimeStamp = performanceNow(), performance.mark(markName); } }, markEnd = function(debugID, markType) { if (shouldMark(debugID)) { var markName = debugID + "::" + markType, displayName = ReactComponentTreeHook.getDisplayName(debugID) || "Unknown"; if (performanceNow() - lastMarkTimeStamp > .1) { var measurementName = displayName + " [" + markType + "]"; performance.measure(measurementName, markName); } performance.clearMarks(markName), measurementName && performance.clearMeasures(measurementName); } }; ReactDebugTool$1 = { addHook: function(hook) { hooks.push(hook); }, removeHook: function(hook) { for (var i = 0; i < hooks.length; i++) hooks[i] === hook && (hooks.splice(i, 1), i--); }, isProfiling: function() { return isProfiling; }, beginProfiling: function() { isProfiling || (isProfiling = !0, flushHistory.length = 0, resetMeasurements(), ReactDebugTool$1.addHook(ReactHostOperationHistoryHook_1)); }, endProfiling: function() { isProfiling && (isProfiling = !1, resetMeasurements(), ReactDebugTool$1.removeHook(ReactHostOperationHistoryHook_1)); }, getFlushHistory: function() { return flushHistory; }, onBeginFlush: function() { currentFlushNesting++, resetMeasurements(), pauseCurrentLifeCycleTimer(), emitEvent("onBeginFlush"); }, onEndFlush: function() { resetMeasurements(), currentFlushNesting--, resumeCurrentLifeCycleTimer(), emitEvent("onEndFlush"); }, onBeginLifeCycleTimer: function(debugID, timerType) { checkDebugID(debugID), emitEvent("onBeginLifeCycleTimer", debugID, timerType), markBegin(debugID, timerType), beginLifeCycleTimer(debugID, timerType); }, onEndLifeCycleTimer: function(debugID, timerType) { checkDebugID(debugID), endLifeCycleTimer(debugID, timerType), markEnd(debugID, timerType), emitEvent("onEndLifeCycleTimer", debugID, timerType); }, onBeginProcessingChildContext: function() { emitEvent("onBeginProcessingChildContext"); }, onEndProcessingChildContext: function() { emitEvent("onEndProcessingChildContext"); }, onHostOperation: function(operation) { checkDebugID(operation.instanceID), emitEvent("onHostOperation", operation); }, onSetState: function() { emitEvent("onSetState"); }, onSetChildren: function(debugID, childDebugIDs) { checkDebugID(debugID), childDebugIDs.forEach(checkDebugID), emitEvent("onSetChildren", debugID, childDebugIDs); }, onBeforeMountComponent: function(debugID, element, parentDebugID) { checkDebugID(debugID), checkDebugID(parentDebugID, !0), emitEvent("onBeforeMountComponent", debugID, element, parentDebugID), markBegin(debugID, "mount"); }, onMountComponent: function(debugID) { checkDebugID(debugID), markEnd(debugID, "mount"), emitEvent("onMountComponent", debugID); }, onBeforeUpdateComponent: function(debugID, element) { checkDebugID(debugID), emitEvent("onBeforeUpdateComponent", debugID, element), markBegin(debugID, "update"); }, onUpdateComponent: function(debugID) { checkDebugID(debugID), markEnd(debugID, "update"), emitEvent("onUpdateComponent", debugID); }, onBeforeUnmountComponent: function(debugID) { checkDebugID(debugID), emitEvent("onBeforeUnmountComponent", debugID), markBegin(debugID, "unmount"); }, onUnmountComponent: function(debugID) { checkDebugID(debugID), markEnd(debugID, "unmount"), emitEvent("onUnmountComponent", debugID); }, onTestEvent: function() { emitEvent("onTestEvent"); } }, ReactDebugTool$1.addHook(ReactInvalidSetStateWarningHook_1), ReactDebugTool$1.addHook(ReactComponentTreeHook), /[?&]react_perf\b/.test(ExecutionEnvironment.canUseDOM && window.location.href || "") && ReactDebugTool$1.beginProfiling(); var ReactDebugTool_1 = ReactDebugTool$1, debugTool = null; debugTool = ReactDebugTool_1; var ReactInstrumentation = { debugTool: debugTool }; function ReactNativeContainerInfo(tag) { return { _tag: tag }; } var ReactNativeContainerInfo_1 = ReactNativeContainerInfo, INITIAL_TAG_COUNT = 1, ReactNativeTagHandles = { tagsStartAt: INITIAL_TAG_COUNT, tagCount: INITIAL_TAG_COUNT, allocateTag: function() { for (;this.reactTagIsNativeTopRootID(ReactNativeTagHandles.tagCount); ) ReactNativeTagHandles.tagCount++; var tag = ReactNativeTagHandles.tagCount; return ReactNativeTagHandles.tagCount++, tag; }, assertRootTag: function(tag) { invariant(this.reactTagIsNativeTopRootID(tag), "Expect a native root tag, instead got %s", tag); }, reactTagIsNativeTopRootID: function(reactTag) { return reactTag % 10 == 1; } }, ReactNativeTagHandles_1 = ReactNativeTagHandles, ReactTypeOfWork = { IndeterminateComponent: 0, FunctionalComponent: 1, ClassComponent: 2, HostRoot: 3, HostPortal: 4, HostComponent: 5, HostText: 6, CoroutineComponent: 7, CoroutineHandlerPhase: 8, YieldComponent: 9, Fragment: 10 }, ClassComponent = ReactTypeOfWork.ClassComponent; function isValidOwner(object) { return !(!object || "function" != typeof object.attachRef || "function" != typeof object.detachRef); } var ReactOwner = { addComponentAsRefTo: function(component, ref, owner) { if (owner && owner.tag === ClassComponent) { var inst = owner.stateNode; (inst.refs === emptyObject ? inst.refs = {} : inst.refs)[ref] = component.getPublicInstance(); } else invariant(isValidOwner(owner), "addComponentAsRefTo(...): Only a ReactOwner can have refs. You might " + "be adding a ref to a component that was not created inside a component's " + "`render` method, or you have multiple copies of React loaded " + "(details: https://fb.me/react-refs-must-have-owner)."), owner.attachRef(ref, component); }, removeComponentAsRefFrom: function(component, ref, owner) { if (owner && owner.tag === ClassComponent) { var inst = owner.stateNode; inst && inst.refs[ref] === component.getPublicInstance() && delete inst.refs[ref]; } else { invariant(isValidOwner(owner), "removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might " + "be removing a ref to a component that was not created inside a component's " + "`render` method, or you have multiple copies of React loaded " + "(details: https://fb.me/react-refs-must-have-owner)."); var ownerPublicInstance = owner.getPublicInstance(); ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance() && owner.detachRef(ref); } } }, ReactOwner_1 = ReactOwner, ReactCompositeComponentTypes$1 = { ImpureClass: 0, PureClass: 1, StatelessFunctional: 2 }, ReactRef = {}, ReactCompositeComponentTypes = ReactCompositeComponentTypes$1, _require = ReactGlobalSharedState_1, ReactComponentTreeHook$1 = _require.ReactComponentTreeHook, warning$4 = warning, warnedAboutStatelessRefs = {}; function attachRef(ref, component, owner) { if (component._compositeType === ReactCompositeComponentTypes.StatelessFunctional) { var info = "", ownerName = void 0; owner && ("function" == typeof owner.getName && (ownerName = owner.getName()), ownerName && (info += "\n\nCheck the render method of `" + ownerName + "`.")); var warningKey = ownerName || component._debugID, element = component._currentElement; element && element._source && (warningKey = element._source.fileName + ":" + element._source.lineNumber), warnedAboutStatelessRefs[warningKey] || (warnedAboutStatelessRefs[warningKey] = !0, warning$4(!1, "Stateless function components cannot be given refs. " + "Attempts to access this ref will fail.%s%s", info, ReactComponentTreeHook$1.getStackAddendumByID(component._debugID))); } "function" == typeof ref ? ref(component.getPublicInstance()) : ReactOwner_1.addComponentAsRefTo(component, ref, owner); } function detachRef(ref, component, owner) { "function" == typeof ref ? ref(null) : ReactOwner_1.removeComponentAsRefFrom(component, ref, owner); } ReactRef.attachRefs = function(instance, element) { if (null !== element && "object" == typeof element) { var ref = element.ref; null != ref && attachRef(ref, instance, element._owner); } }, ReactRef.shouldUpdateRefs = function(prevElement, nextElement) { var prevRef = null, prevOwner = null; null !== prevElement && "object" == typeof prevElement && (prevRef = prevElement.ref, prevOwner = prevElement._owner); var nextRef = null, nextOwner = null; return null !== nextElement && "object" == typeof nextElement && (nextRef = nextElement.ref, nextOwner = nextElement._owner), prevRef !== nextRef || "string" == typeof nextRef && nextOwner !== prevOwner; }, ReactRef.detachRefs = function(instance, element) { if (null !== element && "object" == typeof element) { var ref = element.ref; null != ref && detachRef(ref, instance, element._owner); } }; var ReactRef_1 = ReactRef; function attachRefs() { ReactRef_1.attachRefs(this, this._currentElement); } var ReactReconciler = { mountComponent: function(internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID) { 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID); var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID); return internalInstance._currentElement && null != internalInstance._currentElement.ref && transaction.getReactMountReady().enqueue(attachRefs, internalInstance), 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID), markup; }, getHostNode: function(internalInstance) { return internalInstance.getHostNode(); }, unmountComponent: function(internalInstance, safely, skipLifecycle) { 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID), ReactRef_1.detachRefs(internalInstance, internalInstance._currentElement), internalInstance.unmountComponent(safely, skipLifecycle), 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); }, receiveComponent: function(internalInstance, nextElement, transaction, context) { var prevElement = internalInstance._currentElement; if (nextElement !== prevElement || context !== internalInstance._context) { 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); var refsChanged = ReactRef_1.shouldUpdateRefs(prevElement, nextElement); refsChanged && ReactRef_1.detachRefs(internalInstance, prevElement), internalInstance.receiveComponent(nextElement, transaction, context), refsChanged && internalInstance._currentElement && null != internalInstance._currentElement.ref && transaction.getReactMountReady().enqueue(attachRefs, internalInstance), 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); } }, performUpdateIfNecessary: function(internalInstance, transaction, updateBatchNumber) { if (internalInstance._updateBatchNumber !== updateBatchNumber) return void warning(null == internalInstance._updateBatchNumber || internalInstance._updateBatchNumber === updateBatchNumber + 1, "performUpdateIfNecessary: Unexpected batch number (current %s, " + "pending %s)", updateBatchNumber, internalInstance._updateBatchNumber); 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement), internalInstance.performUpdateIfNecessary(transaction), 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); } }, ReactReconciler_1 = ReactReconciler, ReactInstanceMap = { remove: function(key) { key._reactInternalInstance = void 0; }, get: function(key) { return key._reactInternalInstance; }, has: function(key) { return void 0 !== key._reactInternalInstance; }, set: function(key, value) { key._reactInternalInstance = value; } }, ReactInstanceMap_1 = ReactInstanceMap, oneArgumentPooler = function(copyFieldsFrom) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); return Klass.call(instance, copyFieldsFrom), instance; } return new Klass(copyFieldsFrom); }, twoArgumentPooler = function(a1, a2) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); return Klass.call(instance, a1, a2), instance; } return new Klass(a1, a2); }, threeArgumentPooler = function(a1, a2, a3) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); return Klass.call(instance, a1, a2, a3), instance; } return new Klass(a1, a2, a3); }, fourArgumentPooler = function(a1, a2, a3, a4) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); return Klass.call(instance, a1, a2, a3, a4), instance; } return new Klass(a1, a2, a3, a4); }, standardReleaser = function(instance) { var Klass = this; invariant(instance instanceof Klass, "Trying to release an instance into a pool of a different type."), instance.destructor(), Klass.instancePool.length < Klass.poolSize && Klass.instancePool.push(instance); }, DEFAULT_POOL_SIZE = 10, DEFAULT_POOLER = oneArgumentPooler, addPoolingTo = function(CopyConstructor, pooler) { var NewKlass = CopyConstructor; return NewKlass.instancePool = [], NewKlass.getPooled = pooler || DEFAULT_POOLER, NewKlass.poolSize || (NewKlass.poolSize = DEFAULT_POOL_SIZE), NewKlass.release = standardReleaser, NewKlass; }, PooledClass = { addPoolingTo: addPoolingTo, oneArgumentPooler: oneArgumentPooler, twoArgumentPooler: twoArgumentPooler, threeArgumentPooler: threeArgumentPooler, fourArgumentPooler: fourArgumentPooler }, PooledClass_1 = PooledClass, OBSERVED_ERROR = {}, TransactionImpl = { reinitializeTransaction: function() { this.transactionWrappers = this.getTransactionWrappers(), this.wrapperInitData ? this.wrapperInitData.length = 0 : this.wrapperInitData = [], this._isInTransaction = !1; }, _isInTransaction: !1, getTransactionWrappers: null, isInTransaction: function() { return !!this._isInTransaction; }, perform: function(method, scope, a, b, c, d, e, f) { invariant(!this.isInTransaction(), "Transaction.perform(...): Cannot initialize a transaction when there " + "is already an outstanding transaction."); var errorThrown, ret; try { this._isInTransaction = !0, errorThrown = !0, this.initializeAll(0), ret = method.call(scope, a, b, c, d, e, f), errorThrown = !1; } finally { try { if (errorThrown) try { this.closeAll(0); } catch (err) {} else this.closeAll(0); } finally { this._isInTransaction = !1; } } return ret; }, initializeAll: function(startIndex) { for (var transactionWrappers = this.transactionWrappers, i = startIndex; i < transactionWrappers.length; i++) { var wrapper = transactionWrappers[i]; try { this.wrapperInitData[i] = OBSERVED_ERROR, this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; } finally { if (this.wrapperInitData[i] === OBSERVED_ERROR) try { this.initializeAll(i + 1); } catch (err) {} } } }, closeAll: function(startIndex) { invariant(this.isInTransaction(), "Transaction.closeAll(): Cannot close transaction when none are open."); for (var transactionWrappers = this.transactionWrappers, i = startIndex; i < transactionWrappers.length; i++) { var errorThrown, wrapper = transactionWrappers[i], initData = this.wrapperInitData[i]; try { errorThrown = !0, initData !== OBSERVED_ERROR && wrapper.close && wrapper.close.call(this, initData), errorThrown = !1; } finally { if (errorThrown) try { this.closeAll(i + 1); } catch (e) {} } } this.wrapperInitData.length = 0; } }, Transaction = TransactionImpl, dirtyComponents = [], updateBatchNumber = 0, batchingStrategy = null; function ensureInjected() { invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy, "ReactUpdates: must inject a reconcile transaction class and batching " + "strategy"); } var NESTED_UPDATES = { initialize: function() { this.dirtyComponentsLength = dirtyComponents.length; }, close: function() { this.dirtyComponentsLength !== dirtyComponents.length ? (dirtyComponents.splice(0, this.dirtyComponentsLength), flushBatchedUpdates()) : dirtyComponents.length = 0; } }, TRANSACTION_WRAPPERS = [ NESTED_UPDATES ]; function ReactUpdatesFlushTransaction() { this.reinitializeTransaction(), this.dirtyComponentsLength = null, this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(!0); } Object.assign(ReactUpdatesFlushTransaction.prototype, Transaction, { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; }, destructor: function() { this.dirtyComponentsLength = null, ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction), this.reconcileTransaction = null; }, perform: function(method, scope, a) { return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); } }), PooledClass_1.addPoolingTo(ReactUpdatesFlushTransaction); function batchedUpdates(callback, a, b, c, d, e) { return ensureInjected(), batchingStrategy.batchedUpdates(callback, a, b, c, d, e); } function mountOrderComparator(c1, c2) { return c1._mountOrder - c2._mountOrder; } function runBatchedUpdates(transaction) { var len = transaction.dirtyComponentsLength; invariant(len === dirtyComponents.length, "Expected flush transaction's stored dirty-components length (%s) to " + "match dirty-components array length (%s).", len, dirtyComponents.length), dirtyComponents.sort(mountOrderComparator), updateBatchNumber++; for (var i = 0; i < len; i++) { var component = dirtyComponents[i]; ReactReconciler_1.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); } } var flushBatchedUpdates = function() { for (;dirtyComponents.length; ) { var transaction = ReactUpdatesFlushTransaction.getPooled(); transaction.perform(runBatchedUpdates, null, transaction), ReactUpdatesFlushTransaction.release(transaction); } }; function enqueueUpdate$1(component) { if (ensureInjected(), !batchingStrategy.isBatchingUpdates) return void batchingStrategy.batchedUpdates(enqueueUpdate$1, component); dirtyComponents.push(component), null == component._updateBatchNumber && (component._updateBatchNumber = updateBatchNumber + 1); } var ReactUpdatesInjection = { injectReconcileTransaction: function(ReconcileTransaction) { invariant(ReconcileTransaction, "ReactUpdates: must provide a reconcile transaction class"), ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; }, injectBatchingStrategy: function(_batchingStrategy) { invariant(_batchingStrategy, "ReactUpdates: must provide a batching strategy"), invariant("function" == typeof _batchingStrategy.batchedUpdates, "ReactUpdates: must provide a batchedUpdates() function"), invariant("boolean" == typeof _batchingStrategy.isBatchingUpdates, "ReactUpdates: must provide an isBatchingUpdates boolean attribute"), batchingStrategy = _batchingStrategy; }, getBatchingStrategy: function() { return batchingStrategy; } }, ReactUpdates = { ReactReconcileTransaction: null, batchedUpdates: batchedUpdates, enqueueUpdate: enqueueUpdate$1, flushBatchedUpdates: flushBatchedUpdates, injection: ReactUpdatesInjection }, ReactUpdates_1 = ReactUpdates, ReactCurrentOwner = ReactGlobalSharedState_1.ReactCurrentOwner, warning$5 = warning, warnOnInvalidCallback = function(callback, callerName) { warning$5(null === callback || "function" == typeof callback, "%s(...): Expected the last optional `callback` argument to be a " + "function. Instead received: %s.", callerName, "" + callback); }; function enqueueUpdate(internalInstance) { ReactUpdates_1.enqueueUpdate(internalInstance); } function getInternalInstanceReadyForUpdate(publicInstance, callerName) { var internalInstance = ReactInstanceMap_1.get(publicInstance); if (!internalInstance) { var ctor = publicInstance.constructor; return warning$5(!1, "Can only update a mounted or mounting component. This usually means " + "you called setState, replaceState, or forceUpdate on an unmounted " + "component. This is a no-op.\n\nPlease check the code for the " + "%s component.", ctor && (ctor.displayName || ctor.name) || "ReactClass"), null; } return warning$5(null == ReactCurrentOwner.current, "Cannot update during an existing state transition (such as within " + "`render` or another component's constructor). Render methods should " + "be a pure function of props and state; constructor side-effects are " + "an anti-pattern, but can be moved to `componentWillMount`."), internalInstance; } var ReactUpdateQueue = { isMounted: function(publicInstance) { var owner = ReactCurrentOwner.current; null !== owner && (warning$5(owner._warnedAboutRefsInRender, "%s is accessing isMounted inside its render() function. " + "render() should be a pure function of props and state. It should " + "never access something that requires stale data from the previous " + "render, such as refs. Move this logic to componentDidMount and " + "componentDidUpdate instead.", owner.getName() || "A component"), owner._warnedAboutRefsInRender = !0); var internalInstance = ReactInstanceMap_1.get(publicInstance); return !!internalInstance && !!internalInstance._renderedComponent; }, enqueueCallbackInternal: function(internalInstance, callback) { internalInstance._pendingCallbacks ? internalInstance._pendingCallbacks.push(callback) : internalInstance._pendingCallbacks = [ callback ], enqueueUpdate(internalInstance); }, enqueueForceUpdate: function(publicInstance, callback, callerName) { var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); internalInstance && (callback = void 0 === callback ? null : callback, null !== callback && (warnOnInvalidCallback(callback, callerName), internalInstance._pendingCallbacks ? internalInstance._pendingCallbacks.push(callback) : internalInstance._pendingCallbacks = [ callback ]), internalInstance._pendingForceUpdate = !0, enqueueUpdate(internalInstance)); }, enqueueReplaceState: function(publicInstance, completeState, callback, callerName) { var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); internalInstance && (internalInstance._pendingStateQueue = [ completeState ], internalInstance._pendingReplaceState = !0, callback = void 0 === callback ? null : callback, null !== callback && (warnOnInvalidCallback(callback, callerName), internalInstance._pendingCallbacks ? internalInstance._pendingCallbacks.push(callback) : internalInstance._pendingCallbacks = [ callback ]), enqueueUpdate(internalInstance)); }, enqueueSetState: function(publicInstance, partialState, callback, callerName) { ReactInstrumentation.debugTool.onSetState(), warning$5(null != partialState, "setState(...): You passed an undefined or null state object; " + "instead, use forceUpdate()."); var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); if (internalInstance) { (internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = [])).push(partialState), callback = void 0 === callback ? null : callback, null !== callback && (warnOnInvalidCallback(callback, callerName), internalInstance._pendingCallbacks ? internalInstance._pendingCallbacks.push(callback) : internalInstance._pendingCallbacks = [ callback ]), enqueueUpdate(internalInstance); } }, enqueueElementInternal: function(internalInstance, nextElement, nextContext) { internalInstance._pendingElement = nextElement, internalInstance._context = nextContext, enqueueUpdate(internalInstance); } }, ReactUpdateQueue_1 = ReactUpdateQueue, injected = !1, ReactComponentEnvironment = { replaceNodeWithMarkup: null, processChildrenUpdates: null, injection: { injectEnvironment: function(environment) { invariant(!injected, "ReactCompositeComponent: injectEnvironment() can only be called once."), ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup, ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates, injected = !0; } } }, ReactComponentEnvironment_1 = ReactComponentEnvironment, ReactErrorUtils = { _caughtError: null, _hasCaughtError: !1, _rethrowError: null, _hasRethrowError: !1, injection: { injectErrorUtils: function(injectedErrorUtils) { invariant("function" == typeof injectedErrorUtils.invokeGuardedCallback, "Injected invokeGuardedCallback() must be a function."), invokeGuardedCallback = injectedErrorUtils.invokeGuardedCallback; } }, invokeGuardedCallback: function(name, func, context, a, b, c, d, e, f) { invokeGuardedCallback.apply(ReactErrorUtils, arguments); }, invokeGuardedCallbackAndCatchFirstError: function(name, func, context, a, b, c, d, e, f) { if (ReactErrorUtils.invokeGuardedCallback.apply(this, arguments), ReactErrorUtils.hasCaughtError()) { var error = ReactErrorUtils.clearCaughtError(); ReactErrorUtils._hasRethrowError || (ReactErrorUtils._hasRethrowError = !0, ReactErrorUtils._rethrowError = error); } }, rethrowCaughtError: function() { return rethrowCaughtError.apply(ReactErrorUtils, arguments); }, hasCaughtError: function() { return ReactErrorUtils._hasCaughtError; }, clearCaughtError: function() { if (ReactErrorUtils._hasCaughtError) { var error = ReactErrorUtils._caughtError; return ReactErrorUtils._caughtError = null, ReactErrorUtils._hasCaughtError = !1, error; } invariant(!1, "clearCaughtError was called but no error was captured. This error " + "is likely caused by a bug in React. Please file an issue."); } }, invokeGuardedCallback = function(name, func, context, a, b, c, d, e, f) { ReactErrorUtils._hasCaughtError = !1, ReactErrorUtils._caughtError = null; var funcArgs = Array.prototype.slice.call(arguments, 3); try { func.apply(context, funcArgs); } catch (error) { ReactErrorUtils._caughtError = error, ReactErrorUtils._hasCaughtError = !0; } }; if ("undefined" != typeof window && "function" == typeof window.dispatchEvent && "undefined" != typeof document && "function" == typeof document.createEvent) { var fakeNode = document.createElement("react"); invokeGuardedCallback = function(name, func, context, a, b, c, d, e, f) { var didError = !0, funcArgs = Array.prototype.slice.call(arguments, 3); function callCallback() { fakeNode.removeEventListener(evtType, callCallback, !1), func.apply(context, funcArgs), didError = !1; } var error = void 0, didSetError = !1, isCrossOriginError = !1; function onError(event) { error = event.error, didSetError = !0, null === error && 0 === event.colno && 0 === event.lineno && (isCrossOriginError = !0); } var evtType = "react-" + (name || "invokeguardedcallback"); window.addEventListener("error", onError), fakeNode.addEventListener(evtType, callCallback, !1); var evt = document.createEvent("Event"); evt.initEvent(evtType, !1, !1), fakeNode.dispatchEvent(evt), didError ? (didSetError ? isCrossOriginError && (error = new Error("A cross-origin error was thrown. React doesn't have access to " + "the actual error because it catches errors using a global " + 'error handler, in order to preserve the "Pause on exceptions" ' + "behavior of the DevTools. This is only an issue in DEV-mode; " + "in production, React uses a normal try-catch statement.\n\n" + "If you are using React from a CDN, ensure that the