containing any provided children.
- *
- * @param {object} module the mock function object exported from a
- * module that defines the component to be mocked
- * @param {?string} mockTagName optional dummy root tag name to return
- * from render method (overrides
- * module.mockTagName if provided)
- * @return {object} the ReactTestUtils object (for chaining)
- */
- mockComponent: function (module, mockTagName) {
- {
- if (!hasWarnedAboutDeprecatedMockComponent) {
- hasWarnedAboutDeprecatedMockComponent = true;
-
- warn('ReactTestUtils.mockComponent() is deprecated. ' + 'Use shallow rendering or jest.mock() instead.\n\n' + 'See https://fb.me/test-utils-mock-component for more information.');
- }
- }
-
- mockTagName = mockTagName || module.mockTagName || 'div';
- module.prototype.render.mockImplementation(function () {
- return React.createElement(mockTagName, null, this.props.children);
- });
- return this;
- },
- nativeTouchData: function (x, y) {
- return {
- touches: [{
- pageX: x,
- pageY: y
- }]
- };
- },
- Simulate: null,
- SimulateNative: {},
- act: act
-};
-/**
- * Exports:
- *
- * - `ReactTestUtils.Simulate.click(Element)`
- * - `ReactTestUtils.Simulate.mouseMove(Element)`
- * - `ReactTestUtils.Simulate.change(Element)`
- * - ... (All keys from event plugin `eventTypes` objects)
- */
-
-function makeSimulator(eventType) {
- return function (domNode, eventData) {
- if (!!React.isValidElement(domNode)) {
- {
- throw Error( "TestUtils.Simulate expected a DOM node as the first argument but received a React element. Pass the DOM node you wish to simulate the event on instead. Note that TestUtils.Simulate will not work if you are using shallow rendering." );
- }
- }
-
- if (!!ReactTestUtils.isCompositeComponent(domNode)) {
- {
- throw Error( "TestUtils.Simulate expected a DOM node as the first argument but received a component instance. Pass the DOM node you wish to simulate the event on instead." );
- }
- }
-
- var dispatchConfig = eventNameDispatchConfigs$1[eventType];
- var fakeNativeEvent = new Event();
- fakeNativeEvent.target = domNode;
- fakeNativeEvent.type = eventType.toLowerCase(); // We don't use SyntheticEvent.getPooled in order to not have to worry about
- // properly destroying any properties assigned from `eventData` upon release
-
- var targetInst = getInstanceFromNode$1(domNode);
- var event = new SyntheticEvent(dispatchConfig, targetInst, fakeNativeEvent, domNode); // Since we aren't using pooling, always persist the event. This will make
- // sure it's marked and won't warn when setting additional properties.
-
- event.persist();
-
- _assign(event, eventData);
-
- if (dispatchConfig.phasedRegistrationNames) {
- accumulateTwoPhaseDispatches$1(event);
- } else {
- accumulateDirectDispatches$1(event);
- }
-
- ReactDOM.unstable_batchedUpdates(function () {
- // Normally extractEvent enqueues a state restore, but we'll just always
- // do that since we're by-passing it here.
- enqueueStateRestore$1(domNode);
- runEventsInBatch$1(event);
- });
- restoreStateIfNeeded$1();
- };
-}
-
-function buildSimulators() {
- ReactTestUtils.Simulate = {};
- var eventType;
-
- for (eventType in eventNameDispatchConfigs$1) {
- /**
- * @param {!Element|ReactDOMComponent} domComponentOrNode
- * @param {?object} eventData Fake event data to use in SyntheticEvent.
- */
- ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
- }
-}
-
-buildSimulators();
-/**
- * Exports:
- *
- * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
- * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
- * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
- * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
- * - ... (All keys from `BrowserEventConstants.topLevelTypes`)
- *
- * Note: Top level event types are a subset of the entire set of handler types
- * (which include a broader set of "synthetic" events). For example, onDragDone
- * is a synthetic event. Except when testing an event plugin or React's event
- * handling code specifically, you probably want to use ReactTestUtils.Simulate
- * to dispatch synthetic events.
- */
-
-function makeNativeSimulator(eventType, topLevelType) {
- return function (domComponentOrNode, nativeEventData) {
- var fakeNativeEvent = new Event(eventType);
-
- _assign(fakeNativeEvent, nativeEventData);
-
- if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- simulateNativeEventOnDOMComponent(topLevelType, domComponentOrNode, fakeNativeEvent);
- } else if (domComponentOrNode.tagName) {
- // Will allow on actual dom nodes.
- simulateNativeEventOnNode(topLevelType, domComponentOrNode, fakeNativeEvent);
- }
- };
-}
-
-[[TOP_ABORT, 'abort'], [TOP_ANIMATION_END, 'animationEnd'], [TOP_ANIMATION_ITERATION, 'animationIteration'], [TOP_ANIMATION_START, 'animationStart'], [TOP_BLUR, 'blur'], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough'], [TOP_CAN_PLAY, 'canPlay'], [TOP_CANCEL, 'cancel'], [TOP_CHANGE, 'change'], [TOP_CLICK, 'click'], [TOP_CLOSE, 'close'], [TOP_COMPOSITION_END, 'compositionEnd'], [TOP_COMPOSITION_START, 'compositionStart'], [TOP_COMPOSITION_UPDATE, 'compositionUpdate'], [TOP_CONTEXT_MENU, 'contextMenu'], [TOP_COPY, 'copy'], [TOP_CUT, 'cut'], [TOP_DOUBLE_CLICK, 'doubleClick'], [TOP_DRAG_END, 'dragEnd'], [TOP_DRAG_ENTER, 'dragEnter'], [TOP_DRAG_EXIT, 'dragExit'], [TOP_DRAG_LEAVE, 'dragLeave'], [TOP_DRAG_OVER, 'dragOver'], [TOP_DRAG_START, 'dragStart'], [TOP_DRAG, 'drag'], [TOP_DROP, 'drop'], [TOP_DURATION_CHANGE, 'durationChange'], [TOP_EMPTIED, 'emptied'], [TOP_ENCRYPTED, 'encrypted'], [TOP_ENDED, 'ended'], [TOP_ERROR, 'error'], [TOP_FOCUS, 'focus'], [TOP_INPUT, 'input'], [TOP_KEY_DOWN, 'keyDown'], [TOP_KEY_PRESS, 'keyPress'], [TOP_KEY_UP, 'keyUp'], [TOP_LOAD_START, 'loadStart'], [TOP_LOAD_START, 'loadStart'], [TOP_LOAD, 'load'], [TOP_LOADED_DATA, 'loadedData'], [TOP_LOADED_METADATA, 'loadedMetadata'], [TOP_MOUSE_DOWN, 'mouseDown'], [TOP_MOUSE_MOVE, 'mouseMove'], [TOP_MOUSE_OUT, 'mouseOut'], [TOP_MOUSE_OVER, 'mouseOver'], [TOP_MOUSE_UP, 'mouseUp'], [TOP_PASTE, 'paste'], [TOP_PAUSE, 'pause'], [TOP_PLAY, 'play'], [TOP_PLAYING, 'playing'], [TOP_PROGRESS, 'progress'], [TOP_RATE_CHANGE, 'rateChange'], [TOP_SCROLL, 'scroll'], [TOP_SEEKED, 'seeked'], [TOP_SEEKING, 'seeking'], [TOP_SELECTION_CHANGE, 'selectionChange'], [TOP_STALLED, 'stalled'], [TOP_SUSPEND, 'suspend'], [TOP_TEXT_INPUT, 'textInput'], [TOP_TIME_UPDATE, 'timeUpdate'], [TOP_TOGGLE, 'toggle'], [TOP_TOUCH_CANCEL, 'touchCancel'], [TOP_TOUCH_END, 'touchEnd'], [TOP_TOUCH_MOVE, 'touchMove'], [TOP_TOUCH_START, 'touchStart'], [TOP_TRANSITION_END, 'transitionEnd'], [TOP_VOLUME_CHANGE, 'volumeChange'], [TOP_WAITING, 'waiting'], [TOP_WHEEL, 'wheel']].forEach(function (_ref) {
- var topLevelType = _ref[0],
- eventType = _ref[1];
-
- /**
- * @param {!Element|ReactDOMComponent} domComponentOrNode
- * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
- */
- ReactTestUtils.SimulateNative[eventType] = makeNativeSimulator(eventType, topLevelType);
-});
-
-// TODO: decide on the top-level export form.
-// This is hacky but makes it work with both Rollup and Jest.
-
-
-var testUtils = ReactTestUtils.default || ReactTestUtils;
-
-module.exports = testUtils;
- })();
-}
diff --git a/healthy-hair/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js b/healthy-hair/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js
deleted file mode 100644
index 1d0027305..000000000
--- a/healthy-hair/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/** @license React v16.14.0
- * react-dom-test-utils.production.min.js
- *
- * 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.
- */
-
-'use strict';var g=require("object-assign"),k=require("react"),m=require("react-dom"),n=require("scheduler");function p(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c
this.eventPool.length&&this.eventPool.push(a)}function y(a){a.eventPool=[];a.getPooled=z;a.release=A}var B=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement);function C(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}
-var D={animationend:C("Animation","AnimationEnd"),animationiteration:C("Animation","AnimationIteration"),animationstart:C("Animation","AnimationStart"),transitionend:C("Transition","TransitionEnd")},E={},F={};B&&(F=document.createElement("div").style,"AnimationEvent"in window||(delete D.animationend.animation,delete D.animationiteration.animation,delete D.animationstart.animation),"TransitionEvent"in window||delete D.transitionend.transition);
-function G(a){if(E[a])return E[a];if(!D[a])return a;var b=D[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in F)return E[a]=b[c];return a}var H=G("animationend"),I=G("animationiteration"),J=G("animationstart"),aa=G("transitionend"),K=null;function ba(a){if(null===K)try{var b=("require"+Math.random()).slice(0,7);K=(module&&module[b])("timers").setImmediate}catch(c){K=function(a){var b=new MessageChannel;b.port1.onmessage=a;b.port2.postMessage(void 0)}}return K(a)}
-var L=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,ca=L[11],M=L[12],da=m.unstable_batchedUpdates,N=q.IsSomeRendererActing,O="function"===typeof n.unstable_flushAllWithoutAsserting,P=n.unstable_flushAllWithoutAsserting||function(){for(var a=!1;ca();)a=!0;return a};function Q(a){try{P(),ba(function(){P()?Q(a):a()})}catch(b){a(b)}}var R=0,S=!1,ea=m.findDOMNode,T=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,fa=T[0],U=T[4],ha=T[5],ia=T[6],ja=T[7],ka=T[8],V=T[9],la=T[10];
-function W(){}function ma(a,b){if(!a)return[];a=u(a);if(!a)return[];for(var c=a,e=[];;){if(5===c.tag||6===c.tag||1===c.tag||0===c.tag){var d=c.stateNode;b(d)&&e.push(d)}if(c.child)c.child.return=c,c=c.child;else{if(c===a)return e;for(;!c.sibling;){if(!c.return||c.return===a)return e;c=c.return}c.sibling.return=c.return;c=c.sibling}}}
-function X(a,b){if(a&&!a._reactInternalFiber){var c=""+a;a=Array.isArray(a)?"an array":a&&1===a.nodeType&&a.tagName?"a DOM node":"[object Object]"===c?"object with keys {"+Object.keys(a).join(", ")+"}":c;throw Error(p(286,b,a));}}
-var Y={renderIntoDocument:function(a){var b=document.createElement("div");return m.render(a,b)},isElement:function(a){return k.isValidElement(a)},isElementOfType:function(a,b){return k.isValidElement(a)&&a.type===b},isDOMComponent:function(a){return!(!a||1!==a.nodeType||!a.tagName)},isDOMComponentElement:function(a){return!!(a&&k.isValidElement(a)&&a.tagName)},isCompositeComponent:function(a){return Y.isDOMComponent(a)?!1:null!=a&&"function"===typeof a.render&&"function"===typeof a.setState},isCompositeComponentWithType:function(a,
-b){return Y.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){X(a,"findAllInRenderedTree");return a?ma(a._reactInternalFiber,b):[]},scryRenderedDOMComponentsWithClass:function(a,b){X(a,"scryRenderedDOMComponentsWithClass");return Y.findAllInRenderedTree(a,function(a){if(Y.isDOMComponent(a)){var c=a.className;"string"!==typeof c&&(c=a.getAttribute("class")||"");var d=c.split(/\s+/);if(!Array.isArray(b)){if(void 0===b)throw Error(p(11));b=b.split(/\s+/)}return b.every(function(a){return-1!==
-d.indexOf(a)})}return!1})},findRenderedDOMComponentWithClass:function(a,b){X(a,"findRenderedDOMComponentWithClass");a=Y.scryRenderedDOMComponentsWithClass(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for class:"+b);return a[0]},scryRenderedDOMComponentsWithTag:function(a,b){X(a,"scryRenderedDOMComponentsWithTag");return Y.findAllInRenderedTree(a,function(a){return Y.isDOMComponent(a)&&a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,
-b){X(a,"findRenderedDOMComponentWithTag");a=Y.scryRenderedDOMComponentsWithTag(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for tag:"+b);return a[0]},scryRenderedComponentsWithType:function(a,b){X(a,"scryRenderedComponentsWithType");return Y.findAllInRenderedTree(a,function(a){return Y.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,b){X(a,"findRenderedComponentWithType");a=Y.scryRenderedComponentsWithType(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+
-a.length+") for componentType:"+b);return a[0]},mockComponent:function(a,b){b=b||a.mockTagName||"div";a.prototype.render.mockImplementation(function(){return k.createElement(b,null,this.props.children)});return this},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{},act:function(a){function b(){R--;N.current=c;M.current=e}!1===S&&(S=!0,console.error("act(...) is not supported in production builds of React, and might not behave as expected."));R++;var c=
-N.current;var e=M.current;N.current=!0;M.current=!0;try{var d=da(a)}catch(f){throw b(),f;}if(null!==d&&"object"===typeof d&&"function"===typeof d.then)return{then:function(a,e){d.then(function(){1 0;
-}
-function close(destination) {
- destination.close();
-}
-var textEncoder = new TextEncoder();
-function convertStringToBuffer(content) {
- return textEncoder.encode(content);
-}
-
-function formatChunkAsString(type, props) {
- var str = '<' + type + '>';
-
- if (typeof props.children === 'string') {
- str += props.children;
- }
-
- str += '' + type + '>';
- return str;
-}
-function formatChunk(type, props) {
- return convertStringToBuffer(formatChunkAsString(type, props));
-}
-
-// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
-// nor polyfill, then a plain number is used for performance.
-var hasSymbol = typeof Symbol === 'function' && Symbol.for;
-var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
-
-function createRequest(children, destination) {
- return {
- destination: destination,
- children: children,
- completedChunks: [],
- flowing: false
- };
-}
-
-function performWork(request) {
- var element = request.children;
- request.children = null;
-
- if (element && element.$$typeof !== REACT_ELEMENT_TYPE) {
- return;
- }
-
- var type = element.type;
- var props = element.props;
-
- if (typeof type !== 'string') {
- return;
- }
-
- request.completedChunks.push(formatChunk(type, props));
-
- if (request.flowing) {
- flushCompletedChunks(request);
- }
-
- flushBuffered(request.destination);
-}
-
-function flushCompletedChunks(request) {
- var destination = request.destination;
- var chunks = request.completedChunks;
- request.completedChunks = [];
-
- try {
- for (var i = 0; i < chunks.length; i++) {
- var chunk = chunks[i];
- writeChunk(destination, chunk);
- }
- } finally {
- }
-
- close(destination);
-}
-
-function startWork(request) {
- request.flowing = true;
- scheduleWork(function () {
- return performWork(request);
- });
-}
-function startFlowing(request) {
- request.flowing = false;
- flushCompletedChunks(request);
-}
-
-function renderToReadableStream(children) {
- var request;
- return new ReadableStream({
- start: function (controller) {
- request = createRequest(children, controller);
- startWork(request);
- },
- pull: function (controller) {
- startFlowing(request);
- },
- cancel: function (reason) {}
- });
-}
-
-var ReactDOMFizzServerBrowser = {
- renderToReadableStream: renderToReadableStream
-};
-
-// TODO: decide on the top-level export form.
-// This is hacky but makes it work with both Rollup and Jest
-
-
-var unstableFizz_browser = ReactDOMFizzServerBrowser.default || ReactDOMFizzServerBrowser;
-
-module.exports = unstableFizz_browser;
- })();
-}
diff --git a/healthy-hair/node_modules/react-dom/cjs/react-dom-unstable-fizz.browser.production.min.js b/healthy-hair/node_modules/react-dom/cjs/react-dom-unstable-fizz.browser.production.min.js
deleted file mode 100644
index 765b8d836..000000000
--- a/healthy-hair/node_modules/react-dom/cjs/react-dom-unstable-fizz.browser.production.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/** @license React v16.13.1
- * react-dom-unstable-fizz.browser.production.min.js
- *
- * 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.
- */
-
-'use strict';var e=new TextEncoder;function g(b,c){var a="<"+b+">";"string"===typeof c.children&&(a+=c.children);return a+(""+b+">")}var h="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function k(b){var c=b.destination,a=b.completedChunks;b.completedChunks=[];for(b=0;b';
-
- if (typeof props.children === 'string') {
- str += props.children;
- }
-
- str += '' + type + '>';
- return str;
-}
-function formatChunk(type, props) {
- return convertStringToBuffer(formatChunkAsString(type, props));
-}
-
-// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
-// nor polyfill, then a plain number is used for performance.
-var hasSymbol = typeof Symbol === 'function' && Symbol.for;
-var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
-
-function createRequest(children, destination) {
- return {
- destination: destination,
- children: children,
- completedChunks: [],
- flowing: false
- };
-}
-
-function performWork(request) {
- var element = request.children;
- request.children = null;
-
- if (element && element.$$typeof !== REACT_ELEMENT_TYPE) {
- return;
- }
-
- var type = element.type;
- var props = element.props;
-
- if (typeof type !== 'string') {
- return;
- }
-
- request.completedChunks.push(formatChunk(type, props));
-
- if (request.flowing) {
- flushCompletedChunks(request);
- }
-
- flushBuffered(request.destination);
-}
-
-function flushCompletedChunks(request) {
- var destination = request.destination;
- var chunks = request.completedChunks;
- request.completedChunks = [];
- beginWriting(destination);
-
- try {
- for (var i = 0; i < chunks.length; i++) {
- var chunk = chunks[i];
- writeChunk(destination, chunk);
- }
- } finally {
- completeWriting(destination);
- }
-
- close(destination);
-}
-
-function startWork(request) {
- request.flowing = true;
- scheduleWork(function () {
- return performWork(request);
- });
-}
-function startFlowing(request) {
- request.flowing = false;
- flushCompletedChunks(request);
-}
-
-function createDrainHandler(destination, request) {
- return function () {
- return startFlowing(request);
- };
-}
-
-function pipeToNodeWritable(children, destination) {
- var request = createRequest(children, destination);
- destination.on('drain', createDrainHandler(destination, request));
- startWork(request);
-}
-
-var ReactDOMFizzServerNode = {
- pipeToNodeWritable: pipeToNodeWritable
-};
-
-// TODO: decide on the top-level export form.
-// This is hacky but makes it work with both Rollup and Jest
-
-
-var unstableFizz_node = ReactDOMFizzServerNode.default || ReactDOMFizzServerNode;
-
-module.exports = unstableFizz_node;
- })();
-}
diff --git a/healthy-hair/node_modules/react-dom/cjs/react-dom-unstable-fizz.node.production.min.js b/healthy-hair/node_modules/react-dom/cjs/react-dom-unstable-fizz.node.production.min.js
deleted file mode 100644
index d15e07543..000000000
--- a/healthy-hair/node_modules/react-dom/cjs/react-dom-unstable-fizz.node.production.min.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/** @license React v16.13.1
- * react-dom-unstable-fizz.node.production.min.js
- *
- * 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.
- */
-
-'use strict';function d(a,b){var c="<"+a+">";"string"===typeof b.children&&(c+=b.children);return c+(""+a+">")}var e="function"===typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function f(a){var b=a.destination,c=a.completedChunks;a.completedChunks=[];"function"===typeof b.cork&&b.cork();try{for(a=0;a 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
-
- printWarning('warn', format, args);
- }
-}
-function error(format) {
- {
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- args[_key2 - 1] = arguments[_key2];
- }
-
- printWarning('error', format, args);
- }
-}
-
-function printWarning(level, format, args) {
- // When changing this logic, you might want to also
- // update consoleWithStackDev.www.js as well.
- {
- var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
-
- if (!hasExistingStack) {
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
- var stack = ReactDebugCurrentFrame.getStackAddendum();
-
- if (stack !== '') {
- format += '%s';
- args = args.concat([stack]);
- }
- }
-
- var argsWithFormat = args.map(function (item) {
- return '' + item;
- }); // Careful: RN currently depends on this prefix
-
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
- // breaks IE9: https://github.com/facebook/react/issues/13610
- // eslint-disable-next-line react-internal/no-production-logging
-
- Function.prototype.apply.call(console[level], console, argsWithFormat);
-
- try {
- // --- Welcome to debugging React ---
- // This error was thrown as a convenience so that you can use this stack
- // to find the callsite that caused this warning to fire.
- var argIndex = 0;
- var message = 'Warning: ' + format.replace(/%s/g, function () {
- return args[argIndex++];
- });
- throw new Error(message);
- } catch (x) {}
- }
-}
-
-{
- // In DEV mode, we swap out invokeGuardedCallback for a special version
- // that plays more nicely with the browser's DevTools. The idea is to preserve
- // "Pause on exceptions" behavior. Because React wraps all user-provided
- // functions in invokeGuardedCallback, and the production version of
- // invokeGuardedCallback uses a try-catch, all user exceptions are treated
- // like caught exceptions, and the DevTools won't pause unless the developer
- // takes the extra step of enabling pause on caught exceptions. This is
- // unintuitive, though, because even though React has caught the error, from
- // the developer's perspective, the error is uncaught.
- //
- // To preserve the expected "Pause on exceptions" behavior, we don't use a
- // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
- // DOM node, and call the user-provided callback from inside an event handler
- // for that fake event. If the callback throws, the error is "captured" using
- // a global event handler. But because the error happens in a different
- // event loop context, it does not interrupt the normal program flow.
- // Effectively, this gives us try-catch behavior without actually using
- // try-catch. Neat!
- // Check that the browser supports the APIs we need to implement our special
- // DEV version of invokeGuardedCallback
- if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
- var fakeNode = document.createElement('react');
- }
-}
-
-var getFiberCurrentPropsFromNode = null;
-var getInstanceFromNode = null;
-var getNodeFromInstance = null;
-function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
- getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
- getInstanceFromNode = getInstanceFromNodeImpl;
- getNodeFromInstance = getNodeFromInstanceImpl;
-
- {
- if (!getNodeFromInstance || !getInstanceFromNode) {
- error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
- }
- }
-}
-var validateEventDispatches;
-
-{
- validateEventDispatches = function (event) {
- var dispatchListeners = event._dispatchListeners;
- var dispatchInstances = event._dispatchInstances;
- var listenersIsArr = Array.isArray(dispatchListeners);
- var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
- var instancesIsArr = Array.isArray(dispatchInstances);
- var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
-
- if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
- error('EventPluginUtils: Invalid `event`.');
- }
- };
-}
-/**
- * Standard/simple iteration through an event's collected dispatches, but stops
- * at the first dispatch execution returning true, and returns that id.
- *
- * @return {?string} id of the first dispatch execution who's listener returns
- * true, or null if no listener returned true.
- */
-
-function executeDispatchesInOrderStopAtTrueImpl(event) {
- var dispatchListeners = event._dispatchListeners;
- var dispatchInstances = event._dispatchInstances;
-
- {
- validateEventDispatches(event);
- }
-
- if (Array.isArray(dispatchListeners)) {
- for (var i = 0; i < dispatchListeners.length; i++) {
- if (event.isPropagationStopped()) {
- break;
- } // Listeners and Instances are two parallel arrays that are always in sync.
-
-
- if (dispatchListeners[i](event, dispatchInstances[i])) {
- return dispatchInstances[i];
- }
- }
- } else if (dispatchListeners) {
- if (dispatchListeners(event, dispatchInstances)) {
- return dispatchInstances;
- }
- }
-
- return null;
-}
-/**
- * @see executeDispatchesInOrderStopAtTrueImpl
- */
-
-
-function executeDispatchesInOrderStopAtTrue(event) {
- var ret = executeDispatchesInOrderStopAtTrueImpl(event);
- event._dispatchInstances = null;
- event._dispatchListeners = null;
- return ret;
-}
-/**
- * Execution of a "direct" dispatch - there must be at most one dispatch
- * accumulated on the event or it is considered an error. It doesn't really make
- * sense for an event with multiple dispatches (bubbled) to keep track of the
- * return values at each dispatch execution, but it does tend to make sense when
- * dealing with "direct" dispatches.
- *
- * @return {*} The return value of executing the single dispatch.
- */
-
-function executeDirectDispatch(event) {
- {
- validateEventDispatches(event);
- }
-
- var dispatchListener = event._dispatchListeners;
- var dispatchInstance = event._dispatchInstances;
-
- if (!!Array.isArray(dispatchListener)) {
- {
- throw Error( "executeDirectDispatch(...): Invalid `event`." );
- }
- }
-
- event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null;
- var res = dispatchListener ? dispatchListener(event) : null;
- event.currentTarget = null;
- event._dispatchListeners = null;
- event._dispatchInstances = null;
- return res;
-}
-/**
- * @param {SyntheticEvent} event
- * @return {boolean} True iff number of dispatches accumulated is greater than 0.
- */
-
-function hasDispatches(event) {
- return !!event._dispatchListeners;
-}
-
-var HostComponent = 5;
-
-function getParent(inst) {
- do {
- inst = inst.return; // TODO: If this is a HostRoot we might want to bail out.
- // That is depending on if we want nested subtrees (layers) to bubble
- // events to their parent. We could also go through parentNode on the
- // host node but that wouldn't work for React Native and doesn't let us
- // do the portal feature.
- } while (inst && inst.tag !== HostComponent);
-
- if (inst) {
- return inst;
- }
-
- return null;
-}
-/**
- * Return the lowest common ancestor of A and B, or null if they are in
- * different trees.
- */
-
-
-function getLowestCommonAncestor(instA, instB) {
- var depthA = 0;
-
- for (var tempA = instA; tempA; tempA = getParent(tempA)) {
- depthA++;
- }
-
- var depthB = 0;
-
- for (var tempB = instB; tempB; tempB = getParent(tempB)) {
- depthB++;
- } // If A is deeper, crawl up.
-
-
- while (depthA - depthB > 0) {
- instA = getParent(instA);
- depthA--;
- } // If B is deeper, crawl up.
-
-
- while (depthB - depthA > 0) {
- instB = getParent(instB);
- depthB--;
- } // Walk in lockstep until we find a match.
-
-
- var depth = depthA;
-
- while (depth--) {
- if (instA === instB || instA === instB.alternate) {
- return instA;
- }
-
- instA = getParent(instA);
- instB = getParent(instB);
- }
-
- return null;
-}
-/**
- * Return if A is an ancestor of B.
- */
-
-function isAncestor(instA, instB) {
- while (instB) {
- if (instA === instB || instA === instB.alternate) {
- return true;
- }
-
- instB = getParent(instB);
- }
-
- return false;
-}
-/**
- * Return the parent instance of the passed-in instance.
- */
-
-function getParentInstance(inst) {
- return getParent(inst);
-}
-/**
- * Simulates the traversal of a two-phase, capture/bubble event dispatch.
- */
-
-function traverseTwoPhase(inst, fn, arg) {
- var path = [];
-
- while (inst) {
- path.push(inst);
- inst = getParent(inst);
- }
-
- var i;
-
- for (i = path.length; i-- > 0;) {
- fn(path[i], 'captured', arg);
- }
-
- for (i = 0; i < path.length; i++) {
- fn(path[i], 'bubbled', arg);
- }
-}
-
-function isInteractive(tag) {
- return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
-}
-
-function shouldPreventMouseEvent(name, type, props) {
- switch (name) {
- case 'onClick':
- case 'onClickCapture':
- case 'onDoubleClick':
- case 'onDoubleClickCapture':
- case 'onMouseDown':
- case 'onMouseDownCapture':
- case 'onMouseMove':
- case 'onMouseMoveCapture':
- case 'onMouseUp':
- case 'onMouseUpCapture':
- case 'onMouseEnter':
- return !!(props.disabled && isInteractive(type));
-
- default:
- return false;
- }
-}
-/**
- * @param {object} inst The instance, which is the source of events.
- * @param {string} registrationName Name of listener (e.g. `onClick`).
- * @return {?function} The stored callback.
- */
-
-
-function getListener(inst, registrationName) {
- var listener; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
- // live here; needs to be moved to a better place soon
-
- var stateNode = inst.stateNode;
-
- if (!stateNode) {
- // Work in progress (ex: onload events in incremental mode).
- return null;
- }
-
- var props = getFiberCurrentPropsFromNode(stateNode);
-
- if (!props) {
- // Work in progress.
- return null;
- }
-
- listener = props[registrationName];
-
- if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
- return null;
- }
-
- if (!(!listener || typeof listener === 'function')) {
- {
- throw Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type." );
- }
- }
-
- return listener;
-}
-
-/**
- * Accumulates items that must not be null or undefined into the first one. This
- * is used to conserve memory by avoiding array allocations, and thus sacrifices
- * API cleanness. Since `current` can be null before being passed in and not
- * null after this function, make sure to assign it back to `current`:
- *
- * `a = accumulateInto(a, b);`
- *
- * This API should be sparingly used. Try `accumulate` for something cleaner.
- *
- * @return {*|array<*>} An accumulation of items.
- */
-
-function accumulateInto(current, next) {
- if (!(next != null)) {
- {
- throw Error( "accumulateInto(...): Accumulated items must not be null or undefined." );
- }
- }
-
- if (current == null) {
- return next;
- } // Both are not empty. Warning: Never call x.concat(y) when you are not
- // certain that x is an Array (x could be a string with concat method).
-
-
- if (Array.isArray(current)) {
- if (Array.isArray(next)) {
- current.push.apply(current, next);
- return current;
- }
-
- current.push(next);
- return current;
- }
-
- if (Array.isArray(next)) {
- // A bit too dangerous to mutate `next`.
- return [current].concat(next);
- }
-
- return [current, next];
-}
-
-/**
- * @param {array} arr an "accumulation" of items which is either an Array or
- * a single item. Useful when paired with the `accumulate` module. This is a
- * simple utility that allows us to reason about a collection of items, but
- * handling the case when there is exactly one item (and we do not need to
- * allocate an array).
- * @param {function} cb Callback invoked with each element or a collection.
- * @param {?} [scope] Scope used as `this` in a callback.
- */
-function forEachAccumulated(arr, cb, scope) {
- if (Array.isArray(arr)) {
- arr.forEach(cb, scope);
- } else if (arr) {
- cb.call(scope, arr);
- }
-}
-
-/**
- * Some event types have a notion of different registration names for different
- * "phases" of propagation. This finds listeners by a given phase.
- */
-function listenerAtPhase(inst, event, propagationPhase) {
- var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
- return getListener(inst, registrationName);
-}
-/**
- * A small set of propagation patterns, each of which will accept a small amount
- * of information, and generate a set of "dispatch ready event objects" - which
- * are sets of events that have already been annotated with a set of dispatched
- * listener functions/ids. The API is designed this way to discourage these
- * propagation strategies from actually executing the dispatches, since we
- * always want to collect the entire set of dispatches before executing even a
- * single one.
- */
-
-/**
- * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
- * here, allows us to not have to bind or create functions for each event.
- * Mutating the event's members allows us to not have to create a wrapping
- * "dispatch" object that pairs the event with the listener.
- */
-
-
-function accumulateDirectionalDispatches(inst, phase, event) {
- {
- if (!inst) {
- error('Dispatching inst must not be null');
- }
- }
-
- var listener = listenerAtPhase(inst, event, phase);
-
- if (listener) {
- event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
- event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
- }
-}
-/**
- * Collect dispatches (must be entirely collected before dispatching - see unit
- * tests). Lazily allocate the array to conserve memory. We must loop through
- * each event and perform the traversal for each one. We cannot perform a
- * single traversal for the entire collection of events because each event may
- * have a different target.
- */
-
-
-function accumulateTwoPhaseDispatchesSingle(event) {
- if (event && event.dispatchConfig.phasedRegistrationNames) {
- traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
- }
-}
-/**
- * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
- */
-
-
-function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
- if (event && event.dispatchConfig.phasedRegistrationNames) {
- var targetInst = event._targetInst;
- var parentInst = targetInst ? getParentInstance(targetInst) : null;
- traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event);
- }
-}
-/**
- * Accumulates without regard to direction, does not look for phased
- * registration names. Same as `accumulateDirectDispatchesSingle` but without
- * requiring that the `dispatchMarker` be the same as the dispatched ID.
- */
-
-
-function accumulateDispatches(inst, ignoredDirection, event) {
- if (inst && event && event.dispatchConfig.registrationName) {
- var registrationName = event.dispatchConfig.registrationName;
- var listener = getListener(inst, registrationName);
-
- if (listener) {
- event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
- event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
- }
- }
-}
-/**
- * Accumulates dispatches on an `SyntheticEvent`, but only for the
- * `dispatchMarker`.
- * @param {SyntheticEvent} event
- */
-
-
-function accumulateDirectDispatchesSingle(event) {
- if (event && event.dispatchConfig.registrationName) {
- accumulateDispatches(event._targetInst, null, event);
- }
-}
-
-function accumulateTwoPhaseDispatches(events) {
- forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
-}
-function accumulateTwoPhaseDispatchesSkipTarget(events) {
- forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
-}
-function accumulateDirectDispatches(events) {
- forEachAccumulated(events, accumulateDirectDispatchesSingle);
-}
-
-var EVENT_POOL_SIZE = 10;
-/**
- * @interface Event
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
- */
-
-var EventInterface = {
- type: null,
- target: null,
- // currentTarget is set when dispatching; no use in copying it here
- currentTarget: function () {
- return null;
- },
- eventPhase: null,
- bubbles: null,
- cancelable: null,
- timeStamp: function (event) {
- return event.timeStamp || Date.now();
- },
- defaultPrevented: null,
- isTrusted: null
-};
-
-function functionThatReturnsTrue() {
- return true;
-}
-
-function functionThatReturnsFalse() {
- return false;
-}
-/**
- * Synthetic events are dispatched by event plugins, typically in response to a
- * top-level event delegation handler.
- *
- * These systems should generally use pooling to reduce the frequency of garbage
- * collection. The system should check `isPersistent` to determine whether the
- * event should be released into the pool after being dispatched. Users that
- * need a persisted event should invoke `persist`.
- *
- * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
- * normalizing browser quirks. Subclasses do not necessarily have to implement a
- * DOM interface; custom application-specific events can also subclass this.
- *
- * @param {object} dispatchConfig Configuration used to dispatch this event.
- * @param {*} targetInst Marker identifying the event target.
- * @param {object} nativeEvent Native browser event.
- * @param {DOMEventTarget} nativeEventTarget Target node.
- */
-
-
-function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
- {
- // these have a getter/setter for warnings
- delete this.nativeEvent;
- delete this.preventDefault;
- delete this.stopPropagation;
- delete this.isDefaultPrevented;
- delete this.isPropagationStopped;
- }
-
- this.dispatchConfig = dispatchConfig;
- this._targetInst = targetInst;
- this.nativeEvent = nativeEvent;
- var Interface = this.constructor.Interface;
-
- for (var propName in Interface) {
- if (!Interface.hasOwnProperty(propName)) {
- continue;
- }
-
- {
- delete this[propName]; // this has a getter/setter for warnings
- }
-
- var normalize = Interface[propName];
-
- if (normalize) {
- this[propName] = normalize(nativeEvent);
- } else {
- if (propName === 'target') {
- this.target = nativeEventTarget;
- } else {
- this[propName] = nativeEvent[propName];
- }
- }
- }
-
- var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
-
- if (defaultPrevented) {
- this.isDefaultPrevented = functionThatReturnsTrue;
- } else {
- this.isDefaultPrevented = functionThatReturnsFalse;
- }
-
- this.isPropagationStopped = functionThatReturnsFalse;
- return this;
-}
-
-_assign(SyntheticEvent.prototype, {
- preventDefault: function () {
- this.defaultPrevented = true;
- var event = this.nativeEvent;
-
- if (!event) {
- return;
- }
-
- if (event.preventDefault) {
- event.preventDefault();
- } else if (typeof event.returnValue !== 'unknown') {
- event.returnValue = false;
- }
-
- this.isDefaultPrevented = functionThatReturnsTrue;
- },
- stopPropagation: function () {
- var event = this.nativeEvent;
-
- if (!event) {
- return;
- }
-
- if (event.stopPropagation) {
- event.stopPropagation();
- } else if (typeof event.cancelBubble !== 'unknown') {
- // The ChangeEventPlugin registers a "propertychange" event for
- // IE. This event does not support bubbling or cancelling, and
- // any references to cancelBubble throw "Member not found". A
- // typeof check of "unknown" circumvents this issue (and is also
- // IE specific).
- event.cancelBubble = true;
- }
-
- this.isPropagationStopped = functionThatReturnsTrue;
- },
-
- /**
- * We release all dispatched `SyntheticEvent`s after each event loop, adding
- * them back into the pool. This allows a way to hold onto a reference that
- * won't be added back into the pool.
- */
- persist: function () {
- this.isPersistent = functionThatReturnsTrue;
- },
-
- /**
- * Checks if this event should be released back into the pool.
- *
- * @return {boolean} True if this should not be released, false otherwise.
- */
- isPersistent: functionThatReturnsFalse,
-
- /**
- * `PooledClass` looks for `destructor` on each instance it releases.
- */
- destructor: function () {
- var Interface = this.constructor.Interface;
-
- for (var propName in Interface) {
- {
- Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
- }
- }
-
- this.dispatchConfig = null;
- this._targetInst = null;
- this.nativeEvent = null;
- this.isDefaultPrevented = functionThatReturnsFalse;
- this.isPropagationStopped = functionThatReturnsFalse;
- this._dispatchListeners = null;
- this._dispatchInstances = null;
-
- {
- Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
- Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
- Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
- Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
- Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
- }
- }
-});
-
-SyntheticEvent.Interface = EventInterface;
-/**
- * Helper to reduce boilerplate when creating subclasses.
- */
-
-SyntheticEvent.extend = function (Interface) {
- var Super = this;
-
- var E = function () {};
-
- E.prototype = Super.prototype;
- var prototype = new E();
-
- function Class() {
- return Super.apply(this, arguments);
- }
-
- _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);
-/**
- * Helper to nullify syntheticEvent instance properties when destructing
- *
- * @param {String} propName
- * @param {?object} getVal
- * @return {object} defineProperty object
- */
-
-function getPooledWarningPropertyDefinition(propName, getVal) {
- var isFunction = typeof getVal === 'function';
- return {
- configurable: true,
- set: set,
- get: get
- };
-
- function set(val) {
- var action = isFunction ? 'setting the method' : 'setting the property';
- warn(action, 'This is effectively a no-op');
- return val;
- }
-
- function get() {
- var action = isFunction ? 'accessing the method' : 'accessing the property';
- var result = isFunction ? 'This is a no-op function' : 'This is set to null';
- warn(action, result);
- return getVal;
- }
-
- function warn(action, result) {
- {
- error("This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
- }
- }
-}
-
-function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
- var EventConstructor = this;
-
- if (EventConstructor.eventPool.length) {
- var instance = EventConstructor.eventPool.pop();
- EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
- return instance;
- }
-
- return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
-}
-
-function releasePooledEvent(event) {
- var EventConstructor = this;
-
- if (!(event instanceof EventConstructor)) {
- {
- throw Error( "Trying to release an event instance into a pool of a different type." );
- }
- }
-
- event.destructor();
-
- if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
- EventConstructor.eventPool.push(event);
- }
-}
-
-function addEventPoolingTo(EventConstructor) {
- EventConstructor.eventPool = [];
- EventConstructor.getPooled = getPooledEvent;
- EventConstructor.release = releasePooledEvent;
-}
-
-/**
- * `touchHistory` isn't actually on the native event, but putting it in the
- * interface will ensure that it is cleaned up when pooled/destroyed. The
- * `ResponderEventPlugin` will populate it appropriately.
- */
-
-var ResponderSyntheticEvent = SyntheticEvent.extend({
- touchHistory: function (nativeEvent) {
- return null; // Actually doesn't even look at the native event.
- }
-});
-
-// Note: ideally these would be imported from DOMTopLevelEventTypes,
-// but our build system currently doesn't let us do that from a fork.
-var TOP_TOUCH_START = 'touchstart';
-var TOP_TOUCH_MOVE = 'touchmove';
-var TOP_TOUCH_END = 'touchend';
-var TOP_TOUCH_CANCEL = 'touchcancel';
-var TOP_SCROLL = 'scroll';
-var TOP_SELECTION_CHANGE = 'selectionchange';
-var TOP_MOUSE_DOWN = 'mousedown';
-var TOP_MOUSE_MOVE = 'mousemove';
-var TOP_MOUSE_UP = 'mouseup';
-function isStartish(topLevelType) {
- return topLevelType === TOP_TOUCH_START || topLevelType === TOP_MOUSE_DOWN;
-}
-function isMoveish(topLevelType) {
- return topLevelType === TOP_TOUCH_MOVE || topLevelType === TOP_MOUSE_MOVE;
-}
-function isEndish(topLevelType) {
- return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL || topLevelType === TOP_MOUSE_UP;
-}
-var startDependencies = [TOP_TOUCH_START, TOP_MOUSE_DOWN];
-var moveDependencies = [TOP_TOUCH_MOVE, TOP_MOUSE_MOVE];
-var endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_MOUSE_UP];
-
-/**
- * Tracks the position and time of each active touch by `touch.identifier`. We
- * should typically only see IDs in the range of 1-20 because IDs get recycled
- * when touches end and start again.
- */
-
-var MAX_TOUCH_BANK = 20;
-var touchBank = [];
-var touchHistory = {
- touchBank: touchBank,
- numberActiveTouches: 0,
- // If there is only one active touch, we remember its location. This prevents
- // us having to loop through all of the touches all the time in the most
- // common case.
- indexOfSingleActiveTouch: -1,
- mostRecentTimeStamp: 0
-};
-
-function timestampForTouch(touch) {
- // The legacy internal implementation provides "timeStamp", which has been
- // renamed to "timestamp". Let both work for now while we iron it out
- // TODO (evv): rename timeStamp to timestamp in internal code
- return touch.timeStamp || touch.timestamp;
-}
-/**
- * TODO: Instead of making gestures recompute filtered velocity, we could
- * include a built in velocity computation that can be reused globally.
- */
-
-
-function createTouchRecord(touch) {
- return {
- touchActive: true,
- 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)
- };
-}
-
-function resetTouchRecord(touchRecord, touch) {
- touchRecord.touchActive = true;
- 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);
-}
-
-function getTouchIdentifier(_ref) {
- var identifier = _ref.identifier;
-
- if (!(identifier != null)) {
- {
- throw Error( "Touch object is missing identifier." );
- }
- }
-
- {
- if (identifier > MAX_TOUCH_BANK) {
- error('Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK);
- }
- }
-
- return identifier;
-}
-
-function recordTouchStart(touch) {
- var identifier = getTouchIdentifier(touch);
- var touchRecord = touchBank[identifier];
-
- if (touchRecord) {
- resetTouchRecord(touchRecord, touch);
- } else {
- touchBank[identifier] = createTouchRecord(touch);
- }
-
- touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
-}
-
-function recordTouchMove(touch) {
- var touchRecord = touchBank[getTouchIdentifier(touch)];
-
- if (touchRecord) {
- touchRecord.touchActive = true;
- 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);
- } else {
- {
- warn('Cannot record touch move without a touch start.\n' + 'Touch Move: %s\n' + 'Touch Bank: %s', printTouch(touch), printTouchBank());
- }
- }
-}
-
-function recordTouchEnd(touch) {
- var touchRecord = touchBank[getTouchIdentifier(touch)];
-
- if (touchRecord) {
- touchRecord.touchActive = false;
- 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);
- } else {
- {
- warn('Cannot record touch end without a touch start.\n' + 'Touch End: %s\n' + 'Touch Bank: %s', printTouch(touch), printTouchBank());
- }
- }
-}
-
-function printTouch(touch) {
- return JSON.stringify({
- identifier: touch.identifier,
- pageX: touch.pageX,
- pageY: touch.pageY,
- timestamp: timestampForTouch(touch)
- });
-}
-
-function printTouchBank() {
- var printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK));
-
- if (touchBank.length > MAX_TOUCH_BANK) {
- printed += ' (original size: ' + touchBank.length + ')';
- }
-
- return printed;
-}
-
-var ResponderTouchHistoryStore = {
- recordTouchTrack: function (topLevelType, nativeEvent) {
- if (isMoveish(topLevelType)) {
- nativeEvent.changedTouches.forEach(recordTouchMove);
- } else if (isStartish(topLevelType)) {
- nativeEvent.changedTouches.forEach(recordTouchStart);
- touchHistory.numberActiveTouches = nativeEvent.touches.length;
-
- if (touchHistory.numberActiveTouches === 1) {
- touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier;
- }
- } else if (isEndish(topLevelType)) {
- nativeEvent.changedTouches.forEach(recordTouchEnd);
- touchHistory.numberActiveTouches = nativeEvent.touches.length;
-
- if (touchHistory.numberActiveTouches === 1) {
- for (var i = 0; i < touchBank.length; i++) {
- var touchTrackToCheck = touchBank[i];
-
- if (touchTrackToCheck != null && touchTrackToCheck.touchActive) {
- touchHistory.indexOfSingleActiveTouch = i;
- break;
- }
- }
-
- {
- var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
-
- if (activeRecord == null || !activeRecord.touchActive) {
- error('Cannot find single active touch.');
- }
- }
- }
- }
- },
- touchHistory: touchHistory
-};
-
-/**
- * Accumulates items that must not be null or undefined.
- *
- * This is used to conserve memory by avoiding array allocations.
- *
- * @return {*|array<*>} An accumulation of items.
- */
-
-function accumulate(current, next) {
- if (!(next != null)) {
- {
- throw Error( "accumulate(...): Accumulated items must not be null or undefined." );
- }
- }
-
- if (current == null) {
- return next;
- } // Both are not empty. Warning: Never call x.concat(y) when you are not
- // certain that x is an Array (x could be a string with concat method).
-
-
- if (Array.isArray(current)) {
- return current.concat(next);
- }
-
- if (Array.isArray(next)) {
- return [current].concat(next);
- }
-
- return [current, next];
-}
-
-/**
- * Instance of element that should respond to touch/move types of interactions,
- * as indicated explicitly by relevant callbacks.
- */
-
-var responderInst = null;
-/**
- * Count of current touches. A textInput should become responder iff the
- * selection changes while there is a touch on the screen.
- */
-
-var trackedTouchCount = 0;
-
-var changeResponder = function (nextResponderInst, blockHostResponder) {
- var oldResponderInst = responderInst;
- responderInst = nextResponderInst;
-
- if (ResponderEventPlugin.GlobalResponderHandler !== null) {
- ResponderEventPlugin.GlobalResponderHandler.onChange(oldResponderInst, nextResponderInst, blockHostResponder);
- }
-};
-
-var eventTypes = {
- /**
- * On a `touchStart`/`mouseDown`, is it desired that this element become the
- * responder?
- */
- startShouldSetResponder: {
- phasedRegistrationNames: {
- bubbled: 'onStartShouldSetResponder',
- captured: 'onStartShouldSetResponderCapture'
- },
- dependencies: startDependencies
- },
-
- /**
- * On a `scroll`, is it desired that this element become the responder? This
- * is usually not needed, but should be used to retroactively infer that a
- * `touchStart` had occurred during momentum scroll. During a momentum scroll,
- * a touch start will be immediately followed by a scroll event if the view is
- * currently scrolling.
- *
- * TODO: This shouldn't bubble.
- */
- scrollShouldSetResponder: {
- phasedRegistrationNames: {
- bubbled: 'onScrollShouldSetResponder',
- captured: 'onScrollShouldSetResponderCapture'
- },
- dependencies: [TOP_SCROLL]
- },
-
- /**
- * On text selection change, should this element become the responder? This
- * is needed for text inputs or other views with native selection, so the
- * JS view can claim the responder.
- *
- * TODO: This shouldn't bubble.
- */
- selectionChangeShouldSetResponder: {
- phasedRegistrationNames: {
- bubbled: 'onSelectionChangeShouldSetResponder',
- captured: 'onSelectionChangeShouldSetResponderCapture'
- },
- dependencies: [TOP_SELECTION_CHANGE]
- },
-
- /**
- * On a `touchMove`/`mouseMove`, is it desired that this element become the
- * responder?
- */
- moveShouldSetResponder: {
- phasedRegistrationNames: {
- bubbled: 'onMoveShouldSetResponder',
- captured: 'onMoveShouldSetResponderCapture'
- },
- dependencies: moveDependencies
- },
-
- /**
- * Direct responder events dispatched directly to responder. Do not bubble.
- */
- 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: []
- }
-};
-/**
- *
- * Responder System:
- * ----------------
- *
- * - A global, solitary "interaction lock" on a view.
- * - If a node becomes the responder, it should convey visual feedback
- * immediately to indicate so, either by highlighting or moving accordingly.
- * - To be the responder means, that touches are exclusively important to that
- * responder view, and no other view.
- * - While touches are still occurring, the responder lock can be transferred to
- * a new view, but only to increasingly "higher" views (meaning ancestors of
- * the current responder).
- *
- * Responder being granted:
- * ------------------------
- *
- * - Touch starts, moves, and scrolls can cause an ID to become the responder.
- * - We capture/bubble `startShouldSetResponder`/`moveShouldSetResponder` to
- * the "appropriate place".
- * - If nothing is currently the responder, the "appropriate place" is the
- * initiating event's `targetID`.
- * - If something *is* already the responder, the "appropriate place" is the
- * first common ancestor of the event target and the current `responderInst`.
- * - Some negotiation happens: See the timing diagram below.
- * - Scrolled views automatically become responder. The reasoning is that a
- * platform scroll view that isn't built on top of the responder system has
- * began scrolling, and the active responder must now be notified that the
- * interaction is no longer locked to it - the system has taken over.
- *
- * - Responder being released:
- * As soon as no more touches that *started* inside of descendants of the
- * *current* responderInst, an `onResponderRelease` event is dispatched to the
- * current responder, and the responder lock is released.
- *
- * TODO:
- * - on "end", a callback hook for `onResponderEndShouldRemainResponder` that
- * determines if the responder lock should remain.
- * - If a view shouldn't "remain" the responder, any active touches should by
- * default be considered "dead" and do not influence future negotiations or
- * bubble paths. It should be as if those touches do not exist.
- * -- For multitouch: Usually a translate-z will choose to "remain" responder
- * after one out of many touches ended. For translate-y, usually the view
- * doesn't wish to "remain" responder after one of many touches end.
- * - Consider building this on top of a `stopPropagation` model similar to
- * `W3C` events.
- * - Ensure that `onResponderTerminate` is called on touch cancels, whether or
- * not `onResponderTerminationRequest` returns `true` or `false`.
- *
- */
-
-/* Negotiation Performed
- +-----------------------+
- / \
-Process low level events to + Current Responder + wantsResponderID
-determine who to perform negot-| (if any exists at all) |
-iation/transition | Otherwise just pass through|
--------------------------------+----------------------------+------------------+
-Bubble to find first ID | |
-to return true:wantsResponderID| |
- | |
- +-------------+ | |
- | onTouchStart| | |
- +------+------+ none | |
- | return| |
-+-----------v-------------+true| +------------------------+ |
-|onStartShouldSetResponder|----->|onResponderStart (cur) |<-----------+
-+-----------+-------------+ | +------------------------+ | |
- | | | +--------+-------+
- | returned true for| false:REJECT +-------->|onResponderReject
- | wantsResponderID | | | +----------------+
- | (now attempt | +------------------+-----+ |
- | handoff) | | onResponder | |
- +------------------->| TerminationRequest| |
- | +------------------+-----+ |
- | | | +----------------+
- | true:GRANT +-------->|onResponderGrant|
- | | +--------+-------+
- | +------------------------+ | |
- | | onResponderTerminate |<-----------+
- | +------------------+-----+ |
- | | | +----------------+
- | +-------->|onResponderStart|
- | | +----------------+
-Bubble to find first ID | |
-to return true:wantsResponderID| |
- | |
- +-------------+ | |
- | onTouchMove | | |
- +------+------+ none | |
- | return| |
-+-----------v-------------+true| +------------------------+ |
-|onMoveShouldSetResponder |----->|onResponderMove (cur) |<-----------+
-+-----------+-------------+ | +------------------------+ | |
- | | | +--------+-------+
- | returned true for| false:REJECT +-------->|onResponderRejec|
- | wantsResponderID | | | +----------------+
- | (now attempt | +------------------+-----+ |
- | handoff) | | onResponder | |
- +------------------->| TerminationRequest| |
- | +------------------+-----+ |
- | | | +----------------+
- | true:GRANT +-------->|onResponderGrant|
- | | +--------+-------+
- | +------------------------+ | |
- | | onResponderTerminate |<-----------+
- | +------------------+-----+ |
- | | | +----------------+
- | +-------->|onResponderMove |
- | | +----------------+
- | |
- | |
- Some active touch started| |
- inside current responder | +------------------------+ |
- +------------------------->| onResponderEnd | |
- | | +------------------------+ |
- +---+---------+ | |
- | onTouchEnd | | |
- +---+---------+ | |
- | | +------------------------+ |
- +------------------------->| onResponderEnd | |
- No active touches started| +-----------+------------+ |
- inside current responder | | |
- | v |
- | +------------------------+ |
- | | onResponderRelease | |
- | +------------------------+ |
- | |
- + + */
-
-/**
- * A note about event ordering in the `EventPluginRegistry`.
- *
- * Suppose plugins are injected in the following order:
- *
- * `[R, S, C]`
- *
- * To help illustrate the example, assume `S` is `SimpleEventPlugin` (for
- * `onClick` etc) and `R` is `ResponderEventPlugin`.
- *
- * "Deferred-Dispatched Events":
- *
- * - The current event plugin system will traverse the list of injected plugins,
- * in order, and extract events by collecting the plugin's return value of
- * `extractEvents()`.
- * - These events that are returned from `extractEvents` are "deferred
- * dispatched events".
- * - When returned from `extractEvents`, deferred-dispatched events contain an
- * "accumulation" of deferred dispatches.
- * - These deferred dispatches are accumulated/collected before they are
- * returned, but processed at a later time by the `EventPluginRegistry` (hence the
- * name deferred).
- *
- * In the process of returning their deferred-dispatched events, event plugins
- * themselves can dispatch events on-demand without returning them from
- * `extractEvents`. Plugins might want to do this, so that they can use event
- * dispatching as a tool that helps them decide which events should be extracted
- * in the first place.
- *
- * "On-Demand-Dispatched Events":
- *
- * - On-demand-dispatched events are not returned from `extractEvents`.
- * - On-demand-dispatched events are dispatched during the process of returning
- * the deferred-dispatched events.
- * - They should not have side effects.
- * - They should be avoided, and/or eventually be replaced with another
- * abstraction that allows event plugins to perform multiple "rounds" of event
- * extraction.
- *
- * Therefore, the sequence of event dispatches becomes:
- *
- * - `R`s on-demand events (if any) (dispatched by `R` on-demand)
- * - `S`s on-demand events (if any) (dispatched by `S` on-demand)
- * - `C`s on-demand events (if any) (dispatched by `C` on-demand)
- * - `R`s extracted events (if any) (dispatched by `EventPluginRegistry`)
- * - `S`s extracted events (if any) (dispatched by `EventPluginRegistry`)
- * - `C`s extracted events (if any) (dispatched by `EventPluginRegistry`)
- *
- * In the case of `ResponderEventPlugin`: If the `startShouldSetResponder`
- * on-demand dispatch returns `true` (and some other details are satisfied) the
- * `onResponderGrant` deferred dispatched event is returned from
- * `extractEvents`. The sequence of dispatch executions in this case
- * will appear as follows:
- *
- * - `startShouldSetResponder` (`ResponderEventPlugin` dispatches on-demand)
- * - `touchStartCapture` (`EventPluginRegistry` dispatches as usual)
- * - `touchStart` (`EventPluginRegistry` dispatches as usual)
- * - `responderGrant/Reject` (`EventPluginRegistry` dispatches as usual)
- */
-
-function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
- var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType === TOP_SELECTION_CHANGE ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder; // TODO: stop one short of the current responder.
-
- var bubbleShouldSetFrom = !responderInst ? targetInst : getLowestCommonAncestor(responderInst, targetInst); // When capturing/bubbling the "shouldSet" event, we want to skip the target
- // (deepest ID) if it happens to be the current responder. The reasoning:
- // It's strange to get an `onMoveShouldSetResponder` when you're *already*
- // the responder.
-
- var skipOverBubbleShouldSetFrom = bubbleShouldSetFrom === responderInst;
- var shouldSetEvent = ResponderSyntheticEvent.getPooled(shouldSetEventType, bubbleShouldSetFrom, nativeEvent, nativeEventTarget);
- shouldSetEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
-
- if (skipOverBubbleShouldSetFrom) {
- accumulateTwoPhaseDispatchesSkipTarget(shouldSetEvent);
- } else {
- accumulateTwoPhaseDispatches(shouldSetEvent);
- }
-
- var wantsResponderInst = executeDispatchesInOrderStopAtTrue(shouldSetEvent);
-
- if (!shouldSetEvent.isPersistent()) {
- shouldSetEvent.constructor.release(shouldSetEvent);
- }
-
- if (!wantsResponderInst || wantsResponderInst === responderInst) {
- return null;
- }
-
- var extracted;
- var grantEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderGrant, wantsResponderInst, nativeEvent, nativeEventTarget);
- grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
- accumulateDirectDispatches(grantEvent);
- var blockHostResponder = executeDirectDispatch(grantEvent) === true;
-
- if (responderInst) {
- var terminationRequestEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget);
- terminationRequestEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
- accumulateDirectDispatches(terminationRequestEvent);
- var shouldSwitch = !hasDispatches(terminationRequestEvent) || executeDirectDispatch(terminationRequestEvent);
-
- if (!terminationRequestEvent.isPersistent()) {
- terminationRequestEvent.constructor.release(terminationRequestEvent);
- }
-
- if (shouldSwitch) {
- var terminateEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderTerminate, responderInst, nativeEvent, nativeEventTarget);
- terminateEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
- accumulateDirectDispatches(terminateEvent);
- extracted = accumulate(extracted, [grantEvent, terminateEvent]);
- changeResponder(wantsResponderInst, blockHostResponder);
- } else {
- var rejectEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderReject, wantsResponderInst, nativeEvent, nativeEventTarget);
- rejectEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
- accumulateDirectDispatches(rejectEvent);
- extracted = accumulate(extracted, rejectEvent);
- }
- } else {
- extracted = accumulate(extracted, grantEvent);
- changeResponder(wantsResponderInst, blockHostResponder);
- }
-
- return extracted;
-}
-/**
- * A transfer is a negotiation between a currently set responder and the next
- * element to claim responder status. Any start event could trigger a transfer
- * of responderInst. Any move event could trigger a transfer.
- *
- * @param {string} topLevelType Record from `BrowserEventConstants`.
- * @return {boolean} True if a transfer of responder could possibly occur.
- */
-
-
-function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) {
- return topLevelInst && ( // responderIgnoreScroll: We are trying to migrate away from specifically
- // tracking native scroll events here and responderIgnoreScroll indicates we
- // will send topTouchCancel to handle canceling touch events instead
- topLevelType === TOP_SCROLL && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && topLevelType === TOP_SELECTION_CHANGE || isStartish(topLevelType) || isMoveish(topLevelType));
-}
-/**
- * Returns whether or not this touch end event makes it such that there are no
- * longer any touches that started inside of the current `responderInst`.
- *
- * @param {NativeEvent} nativeEvent Native touch end event.
- * @return {boolean} Whether or not this touch end event ends the responder.
- */
-
-
-function noResponderTouches(nativeEvent) {
- var touches = nativeEvent.touches;
-
- if (!touches || touches.length === 0) {
- return true;
- }
-
- for (var i = 0; i < touches.length; i++) {
- var activeTouch = touches[i];
- var target = activeTouch.target;
-
- if (target !== null && target !== undefined && target !== 0) {
- // Is the original touch location inside of the current responder?
- var targetInst = getInstanceFromNode(target);
-
- if (isAncestor(responderInst, targetInst)) {
- return false;
- }
- }
- }
-
- return true;
-}
-
-var ResponderEventPlugin = {
- /* For unit testing only */
- _getResponder: function () {
- return responderInst;
- },
- eventTypes: eventTypes,
-
- /**
- * We must be resilient to `targetInst` being `null` on `touchMove` or
- * `touchEnd`. On certain platforms, this means that a native scroll has
- * assumed control and the original touch targets are destroyed.
- */
- extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
- if (isStartish(topLevelType)) {
- trackedTouchCount += 1;
- } else if (isEndish(topLevelType)) {
- if (trackedTouchCount >= 0) {
- trackedTouchCount -= 1;
- } else {
- {
- warn('Ended a touch event which was not counted in `trackedTouchCount`.');
- }
-
- return null;
- }
- }
-
- ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent);
- var extracted = canTriggerTransfer(topLevelType, targetInst, nativeEvent) ? setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) : null; // Responder may or may not have transferred on a new touch start/move.
- // Regardless, whoever is the responder after any potential transfer, we
- // direct all touch start/move/ends to them in the form of
- // `onResponderMove/Start/End`. These will be called for *every* additional
- // finger that move/start/end, dispatched directly to whoever is the
- // current responder at that moment, until the responder is "released".
- //
- // These multiple individual change touch events are are always bookended
- // by `onResponderGrant`, and one of
- // (`onResponderRelease/onResponderTerminate`).
-
- var isResponderTouchStart = responderInst && isStartish(topLevelType);
- var isResponderTouchMove = responderInst && isMoveish(topLevelType);
- var isResponderTouchEnd = responderInst && isEndish(topLevelType);
- var incrementalTouch = isResponderTouchStart ? eventTypes.responderStart : isResponderTouchMove ? eventTypes.responderMove : isResponderTouchEnd ? eventTypes.responderEnd : null;
-
- if (incrementalTouch) {
- var gesture = ResponderSyntheticEvent.getPooled(incrementalTouch, responderInst, nativeEvent, nativeEventTarget);
- gesture.touchHistory = ResponderTouchHistoryStore.touchHistory;
- accumulateDirectDispatches(gesture);
- extracted = accumulate(extracted, gesture);
- }
-
- var isResponderTerminate = responderInst && topLevelType === TOP_TOUCH_CANCEL;
- var isResponderRelease = responderInst && !isResponderTerminate && isEndish(topLevelType) && noResponderTouches(nativeEvent);
- var finalTouch = isResponderTerminate ? eventTypes.responderTerminate : isResponderRelease ? eventTypes.responderRelease : null;
-
- if (finalTouch) {
- var finalEvent = ResponderSyntheticEvent.getPooled(finalTouch, responderInst, nativeEvent, nativeEventTarget);
- finalEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
- accumulateDirectDispatches(finalEvent);
- extracted = accumulate(extracted, finalEvent);
- changeResponder(null);
- }
-
- return extracted;
- },
- GlobalResponderHandler: null,
- injection: {
- /**
- * @param {{onChange: (ReactID, ReactID) => void} GlobalResponderHandler
- * Object that handles any change in responder. Use this to inject
- * integration with an existing touch handling system etc.
- */
- injectGlobalResponderHandler: function (GlobalResponderHandler) {
- ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
- }
- }
-};
-
-// Keep in sync with ReactDOM.js, ReactTestUtils.js, and ReactTestUtilsAct.js:
-
-var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,
- getInstanceFromNode$1 = _ReactDOM$__SECRET_IN[0],
- getNodeFromInstance$1 = _ReactDOM$__SECRET_IN[1],
- getFiberCurrentPropsFromNode$1 = _ReactDOM$__SECRET_IN[2],
- injectEventPluginsByName = _ReactDOM$__SECRET_IN[3];
-setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
-
-var ReactDOMUnstableNativeDependencies = /*#__PURE__*/Object.freeze({
- __proto__: null,
- ResponderEventPlugin: ResponderEventPlugin,
- ResponderTouchHistoryStore: ResponderTouchHistoryStore,
- injectEventPluginsByName: injectEventPluginsByName
-});
-
-var unstableNativeDependencies = ReactDOMUnstableNativeDependencies;
-
-module.exports = unstableNativeDependencies;
- })();
-}
diff --git a/healthy-hair/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js b/healthy-hair/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js
deleted file mode 100644
index 1dc56793f..000000000
--- a/healthy-hair/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @license React v16.13.1
- * react-dom-unstable-native-dependencies.production.min.js
- *
- * 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.
- */
-
-'use strict';var h=require("react-dom"),k=require("object-assign");function m(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;cthis.eventPool.length&&this.eventPool.push(a)}function F(a){a.eventPool=[];a.getPooled=ba;a.release=ca}var G=E.extend({touchHistory:function(){return null}});function H(a){return"touchstart"===a||"mousedown"===a}function I(a){return"touchmove"===a||"mousemove"===a}function J(a){return"touchend"===a||"touchcancel"===a||"mouseup"===a}
-var K=["touchstart","mousedown"],L=["touchmove","mousemove"],N=["touchcancel","touchend","mouseup"],O=[],P={touchBank:O,numberActiveTouches:0,indexOfSingleActiveTouch:-1,mostRecentTimeStamp:0};function Q(a){return a.timeStamp||a.timestamp}function R(a){a=a.identifier;if(null==a)throw Error(m(138));return a}
-function da(a){var b=R(a),c=O[b];c?(c.touchActive=!0,c.startPageX=a.pageX,c.startPageY=a.pageY,c.startTimeStamp=Q(a),c.currentPageX=a.pageX,c.currentPageY=a.pageY,c.currentTimeStamp=Q(a),c.previousPageX=a.pageX,c.previousPageY=a.pageY,c.previousTimeStamp=Q(a)):(c={touchActive:!0,startPageX:a.pageX,startPageY:a.pageY,startTimeStamp:Q(a),currentPageX:a.pageX,currentPageY:a.pageY,currentTimeStamp:Q(a),previousPageX:a.pageX,previousPageY:a.pageY,previousTimeStamp:Q(a)},O[b]=c);P.mostRecentTimeStamp=Q(a)}
-function ea(a){var b=O[R(a)];b&&(b.touchActive=!0,b.previousPageX=b.currentPageX,b.previousPageY=b.currentPageY,b.previousTimeStamp=b.currentTimeStamp,b.currentPageX=a.pageX,b.currentPageY=a.pageY,b.currentTimeStamp=Q(a),P.mostRecentTimeStamp=Q(a))}function fa(a){var b=O[R(a)];b&&(b.touchActive=!1,b.previousPageX=b.currentPageX,b.previousPageY=b.currentPageY,b.previousTimeStamp=b.currentTimeStamp,b.currentPageX=a.pageX,b.currentPageY=a.pageY,b.currentTimeStamp=Q(a),P.mostRecentTimeStamp=Q(a))}
-var S={recordTouchTrack:function(a,b){if(I(a))b.changedTouches.forEach(ea);else if(H(a))b.changedTouches.forEach(da),P.numberActiveTouches=b.touches.length,1===P.numberActiveTouches&&(P.indexOfSingleActiveTouch=b.touches[0].identifier);else if(J(a)&&(b.changedTouches.forEach(fa),P.numberActiveTouches=b.touches.length,1===P.numberActiveTouches))for(a=0;a 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
-
- printWarning('warn', format, args);
- }
-}
-function error(format) {
- {
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- args[_key2 - 1] = arguments[_key2];
- }
-
- printWarning('error', format, args);
- }
-}
-
-function printWarning(level, format, args) {
- // When changing this logic, you might want to also
- // update consoleWithStackDev.www.js as well.
- {
- var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
-
- if (!hasExistingStack) {
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
- var stack = ReactDebugCurrentFrame.getStackAddendum();
-
- if (stack !== '') {
- format += '%s';
- args = args.concat([stack]);
- }
- }
-
- var argsWithFormat = args.map(function (item) {
- return '' + item;
- }); // Careful: RN currently depends on this prefix
-
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
- // breaks IE9: https://github.com/facebook/react/issues/13610
- // eslint-disable-next-line react-internal/no-production-logging
-
- Function.prototype.apply.call(console[level], console, argsWithFormat);
-
- try {
- // --- Welcome to debugging React ---
- // This error was thrown as a convenience so that you can use this stack
- // to find the callsite that caused this warning to fire.
- var argIndex = 0;
- var message = 'Warning: ' + format.replace(/%s/g, function () {
- return args[argIndex++];
- });
- throw new Error(message);
- } catch (x) {}
- }
-}
-
-if (!React) {
- {
- throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." );
- }
-}
-
-var invokeGuardedCallbackImpl = function (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);
- }
-};
-
-{
- // In DEV mode, we swap out invokeGuardedCallback for a special version
- // that plays more nicely with the browser's DevTools. The idea is to preserve
- // "Pause on exceptions" behavior. Because React wraps all user-provided
- // functions in invokeGuardedCallback, and the production version of
- // invokeGuardedCallback uses a try-catch, all user exceptions are treated
- // like caught exceptions, and the DevTools won't pause unless the developer
- // takes the extra step of enabling pause on caught exceptions. This is
- // unintuitive, though, because even though React has caught the error, from
- // the developer's perspective, the error is uncaught.
- //
- // To preserve the expected "Pause on exceptions" behavior, we don't use a
- // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
- // DOM node, and call the user-provided callback from inside an event handler
- // for that fake event. If the callback throws, the error is "captured" using
- // a global event handler. But because the error happens in a different
- // event loop context, it does not interrupt the normal program flow.
- // Effectively, this gives us try-catch behavior without actually using
- // try-catch. Neat!
- // Check that the browser supports the APIs we need to implement our special
- // DEV version of invokeGuardedCallback
- if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
- var fakeNode = document.createElement('react');
-
- var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
- // If document doesn't exist we know for sure we will crash in this method
- // when we call document.createEvent(). However this can cause confusing
- // errors: https://github.com/facebookincubator/create-react-app/issues/3482
- // So we preemptively throw with a better message instead.
- if (!(typeof document !== 'undefined')) {
- {
- throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." );
- }
- }
-
- var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
- // set this to true at the beginning, then set it to false right after
- // calling the function. If the function errors, `didError` will never be
- // set to false. This strategy works even if the browser is flaky and
- // fails to call our global error handler, because it doesn't rely on
- // the error event at all.
-
- var didError = true; // Keeps track of the value of window.event so that we can reset it
- // during the callback to let user code access window.event in the
- // browsers that support it.
-
- var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event
- // dispatching: https://github.com/facebook/react/issues/13688
-
- var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); // Create an event handler for our fake event. We will synchronously
- // dispatch our fake event using `dispatchEvent`. Inside the handler, we
- // call the user-provided callback.
-
- var funcArgs = Array.prototype.slice.call(arguments, 3);
-
- function callCallback() {
- // We immediately remove the callback from event listeners so that
- // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
- // nested call would trigger the fake event handlers of any call higher
- // in the stack.
- fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the
- // window.event assignment in both IE <= 10 as they throw an error
- // "Member not found" in strict mode, and in Firefox which does not
- // support window.event.
-
- if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
- window.event = windowEvent;
- }
-
- func.apply(context, funcArgs);
- didError = false;
- } // Create a global error event handler. We use this to capture the value
- // that was thrown. It's possible that this error handler will fire more
- // than once; for example, if non-React code also calls `dispatchEvent`
- // and a handler for that event throws. We should be resilient to most of
- // those cases. Even if our error event handler fires more than once, the
- // last error event is always used. If the callback actually does error,
- // we know that the last error event is the correct one, because it's not
- // possible for anything else to have happened in between our callback
- // erroring and the code that follows the `dispatchEvent` call below. If
- // the callback doesn't error, but the error event was fired, we know to
- // ignore it because `didError` will be false, as described above.
-
-
- var error; // Use this to track whether the error event is ever called.
-
- var didSetError = false;
- var isCrossOriginError = false;
-
- function handleWindowError(event) {
- error = event.error;
- didSetError = true;
-
- if (error === null && event.colno === 0 && event.lineno === 0) {
- isCrossOriginError = true;
- }
-
- if (event.defaultPrevented) {
- // Some other error handler has prevented default.
- // Browsers silence the error report if this happens.
- // We'll remember this to later decide whether to log it or not.
- if (error != null && typeof error === 'object') {
- try {
- error._suppressLogging = true;
- } catch (inner) {// Ignore.
- }
- }
- }
- } // Create a fake event type.
-
-
- var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers
-
- window.addEventListener('error', handleWindowError);
- fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function
- // errors, it will trigger our global error handler.
-
- evt.initEvent(evtType, false, false);
- fakeNode.dispatchEvent(evt);
-
- if (windowEventDescriptor) {
- Object.defineProperty(window, 'event', windowEventDescriptor);
- }
-
- if (didError) {
- if (!didSetError) {
- // The callback errored, but the error event never fired.
- error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
- } else if (isCrossOriginError) {
- error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
- }
-
- this.onError(error);
- } // Remove our event listeners
-
-
- window.removeEventListener('error', handleWindowError);
- };
-
- invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
- }
-}
-
-var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
-
-var hasError = false;
-var caughtError = null; // Used by event system to capture/rethrow the first error.
-
-var hasRethrowError = false;
-var rethrowError = null;
-var reporter = {
- onError: function (error) {
- hasError = true;
- caughtError = error;
- }
-};
-/**
- * Call a function while guarding against errors that happens within it.
- * Returns an error if it throws, otherwise null.
- *
- * In production, this is implemented using a try-catch. The reason we don't
- * use a try-catch directly is so that we can swap out a different
- * implementation in DEV mode.
- *
- * @param {String} name of the guard to use for logging or debugging
- * @param {Function} func The function to invoke
- * @param {*} context The context to use when calling the function
- * @param {...*} args Arguments for function
- */
-
-function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
- hasError = false;
- caughtError = null;
- invokeGuardedCallbackImpl$1.apply(reporter, arguments);
-}
-/**
- * Same as invokeGuardedCallback, but instead of returning an error, it stores
- * it in a global so it can be rethrown by `rethrowCaughtError` later.
- * TODO: See if caughtError and rethrowError can be unified.
- *
- * @param {String} name of the guard to use for logging or debugging
- * @param {Function} func The function to invoke
- * @param {*} context The context to use when calling the function
- * @param {...*} args Arguments for function
- */
-
-function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
- invokeGuardedCallback.apply(this, arguments);
-
- if (hasError) {
- var error = clearCaughtError();
-
- if (!hasRethrowError) {
- hasRethrowError = true;
- rethrowError = error;
- }
- }
-}
-/**
- * During execution of guarded functions we will capture the first error which
- * we will rethrow to be handled by the top level error handler.
- */
-
-function rethrowCaughtError() {
- if (hasRethrowError) {
- var error = rethrowError;
- hasRethrowError = false;
- rethrowError = null;
- throw error;
- }
-}
-function hasCaughtError() {
- return hasError;
-}
-function clearCaughtError() {
- if (hasError) {
- var error = caughtError;
- hasError = false;
- caughtError = null;
- return error;
- } else {
- {
- {
- throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." );
- }
- }
- }
-}
-
-var getFiberCurrentPropsFromNode = null;
-var getInstanceFromNode = null;
-var getNodeFromInstance = null;
-function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
- getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
- getInstanceFromNode = getInstanceFromNodeImpl;
- getNodeFromInstance = getNodeFromInstanceImpl;
-
- {
- if (!getNodeFromInstance || !getInstanceFromNode) {
- error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
- }
- }
-}
-var validateEventDispatches;
-
-{
- validateEventDispatches = function (event) {
- var dispatchListeners = event._dispatchListeners;
- var dispatchInstances = event._dispatchInstances;
- var listenersIsArr = Array.isArray(dispatchListeners);
- var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
- var instancesIsArr = Array.isArray(dispatchInstances);
- var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
-
- if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
- error('EventPluginUtils: Invalid `event`.');
- }
- };
-}
-/**
- * Dispatch the event to the listener.
- * @param {SyntheticEvent} event SyntheticEvent to handle
- * @param {function} listener Application-level callback
- * @param {*} inst Internal component instance
- */
-
-
-function executeDispatch(event, listener, inst) {
- var type = event.type || 'unknown-event';
- event.currentTarget = getNodeFromInstance(inst);
- invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
- event.currentTarget = null;
-}
-/**
- * Standard/simple iteration through an event's collected dispatches.
- */
-
-function executeDispatchesInOrder(event) {
- var dispatchListeners = event._dispatchListeners;
- var dispatchInstances = event._dispatchInstances;
-
- {
- validateEventDispatches(event);
- }
-
- if (Array.isArray(dispatchListeners)) {
- for (var i = 0; i < dispatchListeners.length; i++) {
- if (event.isPropagationStopped()) {
- break;
- } // Listeners and Instances are two parallel arrays that are always in sync.
-
-
- executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
- }
- } else if (dispatchListeners) {
- executeDispatch(event, dispatchListeners, dispatchInstances);
- }
-
- event._dispatchListeners = null;
- event._dispatchInstances = null;
-}
-
-var FunctionComponent = 0;
-var ClassComponent = 1;
-var IndeterminateComponent = 2; // Before we know whether it is function or class
-
-var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
-
-var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
-
-var HostComponent = 5;
-var HostText = 6;
-var Fragment = 7;
-var Mode = 8;
-var ContextConsumer = 9;
-var ContextProvider = 10;
-var ForwardRef = 11;
-var Profiler = 12;
-var SuspenseComponent = 13;
-var MemoComponent = 14;
-var SimpleMemoComponent = 15;
-var LazyComponent = 16;
-var IncompleteClassComponent = 17;
-var DehydratedFragment = 18;
-var SuspenseListComponent = 19;
-var FundamentalComponent = 20;
-var ScopeComponent = 21;
-var Block = 22;
-
-/**
- * Injectable ordering of event plugins.
- */
-var eventPluginOrder = null;
-/**
- * Injectable mapping from names to event plugin modules.
- */
-
-var namesToPlugins = {};
-/**
- * Recomputes the plugin list using the injected plugins and plugin ordering.
- *
- * @private
- */
-
-function recomputePluginOrdering() {
- if (!eventPluginOrder) {
- // Wait until an `eventPluginOrder` is injected.
- return;
- }
-
- for (var pluginName in namesToPlugins) {
- var pluginModule = namesToPlugins[pluginName];
- var pluginIndex = eventPluginOrder.indexOf(pluginName);
-
- if (!(pluginIndex > -1)) {
- {
- throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`." );
- }
- }
-
- if (plugins[pluginIndex]) {
- continue;
- }
-
- if (!pluginModule.extractEvents) {
- {
- throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not." );
- }
- }
-
- plugins[pluginIndex] = pluginModule;
- var publishedEvents = pluginModule.eventTypes;
-
- for (var eventName in publishedEvents) {
- if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) {
- {
- throw Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`." );
- }
- }
- }
- }
-}
-/**
- * Publishes an event so that it can be dispatched by the supplied plugin.
- *
- * @param {object} dispatchConfig Dispatch configuration for the event.
- * @param {object} PluginModule Plugin publishing the event.
- * @return {boolean} True if the event was successfully published.
- * @private
- */
-
-
-function publishEventForPlugin(dispatchConfig, pluginModule, 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 (var phaseName in phasedRegistrationNames) {
- if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
- var phasedRegistrationName = phasedRegistrationNames[phaseName];
- publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
- }
- }
-
- return true;
- } else if (dispatchConfig.registrationName) {
- publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
- return true;
- }
-
- return false;
-}
-/**
- * Publishes a registration name that is used to identify dispatched events.
- *
- * @param {string} registrationName Registration name to add.
- * @param {object} PluginModule Plugin publishing the event.
- * @private
- */
-
-
-function publishRegistrationName(registrationName, pluginModule, eventName) {
- if (!!registrationNameModules[registrationName]) {
- {
- throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + registrationName + "`." );
- }
- }
-
- registrationNameModules[registrationName] = pluginModule;
- registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
-
- {
- var lowerCasedName = registrationName.toLowerCase();
- possibleRegistrationNames[lowerCasedName] = registrationName;
-
- if (registrationName === 'onDoubleClick') {
- possibleRegistrationNames.ondblclick = registrationName;
- }
- }
-}
-/**
- * Registers plugins so that they can extract and dispatch events.
- */
-
-/**
- * Ordered list of injected plugins.
- */
-
-
-var plugins = [];
-/**
- * Mapping from event name to dispatch config
- */
-
-var eventNameDispatchConfigs = {};
-/**
- * Mapping from registration name to plugin module
- */
-
-var registrationNameModules = {};
-/**
- * Mapping from registration name to event name
- */
-
-var registrationNameDependencies = {};
-/**
- * Mapping from lowercase registration names to the properly cased version,
- * used to warn in the case of missing event handlers. Available
- * only in true.
- * @type {Object}
- */
-
-var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true
-
-/**
- * Injects an ordering of plugins (by plugin name). This allows the ordering
- * to be decoupled from injection of the actual plugins so that ordering is
- * always deterministic regardless of packaging, on-the-fly injection, etc.
- *
- * @param {array} InjectedEventPluginOrder
- * @internal
- */
-
-function injectEventPluginOrder(injectedEventPluginOrder) {
- 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." );
- }
- } // Clone the ordering so it cannot be dynamically mutated.
-
-
- eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
- recomputePluginOrdering();
-}
-/**
- * Injects plugins to be used by plugin event system. The plugin names must be
- * in the ordering injected by `injectEventPluginOrder`.
- *
- * Plugins can be injected as part of page initialization or on-the-fly.
- *
- * @param {object} injectedNamesToPlugins Map from names to plugin modules.
- * @internal
- */
-
-function injectEventPluginsByName(injectedNamesToPlugins) {
- var isOrderingDirty = false;
-
- for (var pluginName in injectedNamesToPlugins) {
- if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
- continue;
- }
-
- var pluginModule = injectedNamesToPlugins[pluginName];
-
- if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
- if (!!namesToPlugins[pluginName]) {
- {
- throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`." );
- }
- }
-
- namesToPlugins[pluginName] = pluginModule;
- isOrderingDirty = true;
- }
- }
-
- if (isOrderingDirty) {
- recomputePluginOrdering();
- }
-}
-
-var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
-
-var PLUGIN_EVENT_SYSTEM = 1;
-var IS_REPLAYED = 1 << 5;
-var IS_FIRST_ANCESTOR = 1 << 6;
-
-var restoreImpl = null;
-var restoreTarget = null;
-var restoreQueue = null;
-
-function restoreStateOfTarget(target) {
- // We perform this translation at the end of the event loop so that we
- // always receive the correct fiber here
- var internalInstance = getInstanceFromNode(target);
-
- if (!internalInstance) {
- // Unmounted
- return;
- }
-
- if (!(typeof restoreImpl === 'function')) {
- {
- throw Error( "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." );
- }
- }
-
- var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted.
-
- if (stateNode) {
- var _props = getFiberCurrentPropsFromNode(stateNode);
-
- restoreImpl(internalInstance.stateNode, internalInstance.type, _props);
- }
-}
-
-function setRestoreImplementation(impl) {
- restoreImpl = impl;
-}
-function enqueueStateRestore(target) {
- if (restoreTarget) {
- if (restoreQueue) {
- restoreQueue.push(target);
- } else {
- restoreQueue = [target];
- }
- } else {
- restoreTarget = target;
- }
-}
-function needsStateRestore() {
- return restoreTarget !== null || restoreQueue !== null;
-}
-function restoreStateIfNeeded() {
- if (!restoreTarget) {
- return;
- }
-
- var target = restoreTarget;
- var queuedTargets = restoreQueue;
- restoreTarget = null;
- restoreQueue = null;
- restoreStateOfTarget(target);
-
- if (queuedTargets) {
- for (var i = 0; i < queuedTargets.length; i++) {
- restoreStateOfTarget(queuedTargets[i]);
- }
- }
-}
-
-var enableProfilerTimer = true; // Trace which interactions trigger each commit.
-
-var enableDeprecatedFlareAPI = false; // Experimental Host Component support.
-
-var enableFundamentalAPI = false; // Experimental Scope support.
-var warnAboutStringRefs = false;
-
-// the renderer. Such as when we're dispatching events or if third party
-// libraries need to call batchedUpdates. Eventually, this API will go away when
-// everything is batched by default. We'll then have a similar API to opt-out of
-// scheduled work and instead do synchronous work.
-// Defaults
-
-var batchedUpdatesImpl = function (fn, bookkeeping) {
- return fn(bookkeeping);
-};
-
-var discreteUpdatesImpl = function (fn, a, b, c, d) {
- return fn(a, b, c, d);
-};
-
-var flushDiscreteUpdatesImpl = function () {};
-
-var batchedEventUpdatesImpl = batchedUpdatesImpl;
-var isInsideEventHandler = false;
-var isBatchingEventUpdates = false;
-
-function finishEventHandler() {
- // Here we wait until all updates have propagated, which is important
- // when using controlled components within layers:
- // https://github.com/facebook/react/issues/1698
- // Then we restore state of any controlled component.
- var controlledComponentsHavePendingUpdates = needsStateRestore();
-
- if (controlledComponentsHavePendingUpdates) {
- // If a controlled event was fired, we may need to restore the state of
- // the DOM node back to the controlled value. This is necessary when React
- // bails out of the update without touching the DOM.
- flushDiscreteUpdatesImpl();
- restoreStateIfNeeded();
- }
-}
-
-function batchedUpdates(fn, bookkeeping) {
- if (isInsideEventHandler) {
- // If we are currently inside another batch, we need to wait until it
- // fully completes before restoring state.
- return fn(bookkeeping);
- }
-
- isInsideEventHandler = true;
-
- try {
- return batchedUpdatesImpl(fn, bookkeeping);
- } finally {
- isInsideEventHandler = false;
- finishEventHandler();
- }
-}
-function batchedEventUpdates(fn, a, b) {
- if (isBatchingEventUpdates) {
- // If we are currently inside another batch, we need to wait until it
- // fully completes before restoring state.
- return fn(a, b);
- }
-
- isBatchingEventUpdates = true;
-
- try {
- return batchedEventUpdatesImpl(fn, a, b);
- } finally {
- isBatchingEventUpdates = false;
- finishEventHandler();
- }
-} // This is for the React Flare event system
-function discreteUpdates(fn, a, b, c, d) {
- var prevIsInsideEventHandler = isInsideEventHandler;
- isInsideEventHandler = true;
-
- try {
- return discreteUpdatesImpl(fn, a, b, c, d);
- } finally {
- isInsideEventHandler = prevIsInsideEventHandler;
-
- if (!isInsideEventHandler) {
- finishEventHandler();
- }
- }
-}
-function flushDiscreteUpdatesIfNeeded(timeStamp) {
- // event.timeStamp isn't overly reliable due to inconsistencies in
- // how different browsers have historically provided the time stamp.
- // Some browsers provide high-resolution time stamps for all events,
- // some provide low-resolution time stamps for all events. FF < 52
- // even mixes both time stamps together. Some browsers even report
- // negative time stamps or time stamps that are 0 (iOS9) in some cases.
- // Given we are only comparing two time stamps with equality (!==),
- // we are safe from the resolution differences. If the time stamp is 0
- // we bail-out of preventing the flush, which can affect semantics,
- // such as if an earlier flush removes or adds event listeners that
- // are fired in the subsequent flush. However, this is the same
- // behaviour as we had before this change, so the risks are low.
- if (!isInsideEventHandler && (!enableDeprecatedFlareAPI )) {
- flushDiscreteUpdatesImpl();
- }
-}
-function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) {
- batchedUpdatesImpl = _batchedUpdatesImpl;
- discreteUpdatesImpl = _discreteUpdatesImpl;
- flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
- batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
-}
-
-var DiscreteEvent = 0;
-var UserBlockingEvent = 1;
-var ContinuousEvent = 2;
-
-// A reserved attribute.
-// It is handled by React separately and shouldn't be written to the DOM.
-var RESERVED = 0; // A simple string attribute.
-// Attributes that aren't in the whitelist are presumed to have this type.
-
-var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
-// "enumerated" attributes with "true" and "false" as possible values.
-// When true, it should be set to a "true" string.
-// When false, it should be set to a "false" string.
-
-var BOOLEANISH_STRING = 2; // A real boolean attribute.
-// When true, it should be present (set either to an empty string or its name).
-// When false, it should be omitted.
-
-var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
-// When true, it should be present (set either to an empty string or its name).
-// When false, it should be omitted.
-// For any other value, should be present with that value.
-
-var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
-// When falsy, it should be removed.
-
-var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
-// When falsy, it should be removed.
-
-var POSITIVE_NUMERIC = 6;
-
-/* eslint-disable max-len */
-var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
-/* eslint-enable max-len */
-
-var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
-var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
-var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-var illegalAttributeNameCache = {};
-var validatedAttributeNameCache = {};
-function isAttributeNameSafe(attributeName) {
- if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
- return true;
- }
-
- if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
- return false;
- }
-
- if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
- validatedAttributeNameCache[attributeName] = true;
- return true;
- }
-
- illegalAttributeNameCache[attributeName] = true;
-
- {
- error('Invalid attribute name: `%s`', attributeName);
- }
-
- return false;
-}
-function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
- if (propertyInfo !== null) {
- return propertyInfo.type === RESERVED;
- }
-
- if (isCustomComponentTag) {
- return false;
- }
-
- if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
- return true;
- }
-
- return false;
-}
-function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
- if (propertyInfo !== null && propertyInfo.type === RESERVED) {
- return false;
- }
-
- switch (typeof value) {
- case 'function': // $FlowIssue symbol is perfectly valid here
-
- case 'symbol':
- // eslint-disable-line
- return true;
-
- case 'boolean':
- {
- if (isCustomComponentTag) {
- return false;
- }
-
- if (propertyInfo !== null) {
- return !propertyInfo.acceptsBooleans;
- } else {
- var prefix = name.toLowerCase().slice(0, 5);
- return prefix !== 'data-' && prefix !== 'aria-';
- }
- }
-
- default:
- return false;
- }
-}
-function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
- if (value === null || typeof value === 'undefined') {
- return true;
- }
-
- if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
- return true;
- }
-
- if (isCustomComponentTag) {
- return false;
- }
-
- if (propertyInfo !== null) {
- switch (propertyInfo.type) {
- case BOOLEAN:
- return !value;
-
- case OVERLOADED_BOOLEAN:
- return value === false;
-
- case NUMERIC:
- return isNaN(value);
-
- case POSITIVE_NUMERIC:
- return isNaN(value) || value < 1;
- }
- }
-
- return false;
-}
-function getPropertyInfo(name) {
- return properties.hasOwnProperty(name) ? properties[name] : null;
-}
-
-function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
- this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
- this.attributeName = attributeName;
- this.attributeNamespace = attributeNamespace;
- this.mustUseProperty = mustUseProperty;
- this.propertyName = name;
- this.type = type;
- this.sanitizeURL = sanitizeURL;
-} // When adding attributes to this list, be sure to also add them to
-// the `possibleStandardNames` module to ensure casing and incorrect
-// name warnings.
-
-
-var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
-
-var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
-// elements (not just inputs). Now that ReactDOMInput assigns to the
-// defaultValue property -- do we need this?
-'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
-
-reservedProps.forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // A few React string attributes have a different name.
-// This is a mapping from React prop names to the attribute names.
-
-[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
- var name = _ref[0],
- attributeName = _ref[1];
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
- attributeName, // attributeName
- null, // attributeNamespace
- false);
-}); // These are "enumerated" HTML attributes that accept "true" and "false".
-// In React, we let users pass `true` and `false` even though technically
-// these aren't boolean attributes (they are coerced to strings).
-
-['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
- name.toLowerCase(), // attributeName
- null, // attributeNamespace
- false);
-}); // These are "enumerated" SVG attributes that accept "true" and "false".
-// In React, we let users pass `true` and `false` even though technically
-// these aren't boolean attributes (they are coerced to strings).
-// Since these are SVG attributes, their attribute names are case-sensitive.
-
-['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // These are HTML boolean attributes.
-
-['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
-// on the client side because the browsers are inconsistent. Instead we call focus().
-'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
-'itemScope'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
- name.toLowerCase(), // attributeName
- null, // attributeNamespace
- false);
-}); // These are the few React props that we set as DOM properties
-// rather than attributes. These are all booleans.
-
-['checked', // Note: `option.selected` is not updated if `select.multiple` is
-// disabled with `removeAttribute`. We have special logic for handling this.
-'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
-// you'll need to set attributeName to name.toLowerCase()
-// instead in the assignment below.
-].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // These are HTML attributes that are "overloaded booleans": they behave like
-// booleans, but can also accept a string value.
-
-['capture', 'download' // NOTE: if you add a camelCased prop to this list,
-// you'll need to set attributeName to name.toLowerCase()
-// instead in the assignment below.
-].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // These are HTML attributes that must be positive numbers.
-
-['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
-// you'll need to set attributeName to name.toLowerCase()
-// instead in the assignment below.
-].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
- name, // attributeName
- null, // attributeNamespace
- false);
-}); // These are HTML attributes that must be numbers.
-
-['rowSpan', 'start'].forEach(function (name) {
- properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
- name.toLowerCase(), // attributeName
- null, // attributeNamespace
- false);
-});
-var CAMELIZE = /[\-\:]([a-z])/g;
-
-var capitalize = function (token) {
- return token[1].toUpperCase();
-}; // This is a list of all SVG attributes that need special casing, namespacing,
-// or boolean value assignment. Regular attributes that just accept strings
-// and have the same names are omitted, just like in the HTML whitelist.
-// Some of these attributes can be hard to find. This list was created by
-// scraping the MDN documentation.
-
-
-['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
-// you'll need to set attributeName to name.toLowerCase()
-// instead in the assignment below.
-].forEach(function (attributeName) {
- var name = attributeName.replace(CAMELIZE, capitalize);
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
- attributeName, null, // attributeNamespace
- false);
-}); // String SVG attributes with the xlink namespace.
-
-['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
-// you'll need to set attributeName to name.toLowerCase()
-// instead in the assignment below.
-].forEach(function (attributeName) {
- var name = attributeName.replace(CAMELIZE, capitalize);
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
- attributeName, 'http://www.w3.org/1999/xlink', false);
-}); // String SVG attributes with the xml namespace.
-
-['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
-// you'll need to set attributeName to name.toLowerCase()
-// instead in the assignment below.
-].forEach(function (attributeName) {
- var name = attributeName.replace(CAMELIZE, capitalize);
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
- attributeName, 'http://www.w3.org/XML/1998/namespace', false);
-}); // These attribute exists both in HTML and SVG.
-// The attribute name is case-sensitive in SVG so we can't just use
-// the React name like we do for attributes that exist only in HTML.
-
-['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
- properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
- attributeName.toLowerCase(), // attributeName
- null, // attributeNamespace
- false);
-}); // These attributes accept URLs. These must not allow javascript: URLS.
-// These will also need to accept Trusted Types object in the future.
-
-var xlinkHref = 'xlinkHref';
-properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
-'xlink:href', 'http://www.w3.org/1999/xlink', true);
-['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
- properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
- attributeName.toLowerCase(), // attributeName
- null, // attributeNamespace
- true);
-});
-
-var ReactDebugCurrentFrame = null;
-
-{
- ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
-} // A javascript: URL can contain leading C0 control or \u0020 SPACE,
-// and any newline or tab are filtered out as if they're not part of the URL.
-// https://url.spec.whatwg.org/#url-parsing
-// Tab or newline are defined as \r\n\t:
-// https://infra.spec.whatwg.org/#ascii-tab-or-newline
-// A C0 control is a code point in the range \u0000 NULL to \u001F
-// INFORMATION SEPARATOR ONE, inclusive:
-// https://infra.spec.whatwg.org/#c0-control-or-space
-
-/* eslint-disable max-len */
-
-
-var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
-var didWarn = false;
-
-function sanitizeURL(url) {
- {
- if (!didWarn && isJavaScriptProtocol.test(url)) {
- didWarn = true;
-
- error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
- }
- }
-}
-
-/**
- * Get the value for a property on a node. Only used in DEV for SSR validation.
- * The "expected" argument is used as a hint of what the expected value is.
- * Some properties have multiple equivalent values.
- */
-function getValueForProperty(node, name, expected, propertyInfo) {
- {
- if (propertyInfo.mustUseProperty) {
- var propertyName = propertyInfo.propertyName;
- return node[propertyName];
- } else {
- if ( propertyInfo.sanitizeURL) {
- // If we haven't fully disabled javascript: URLs, and if
- // the hydration is successful of a javascript: URL, we
- // still want to warn on the client.
- sanitizeURL('' + expected);
- }
-
- var attributeName = propertyInfo.attributeName;
- var stringValue = null;
-
- if (propertyInfo.type === OVERLOADED_BOOLEAN) {
- if (node.hasAttribute(attributeName)) {
- var value = node.getAttribute(attributeName);
-
- if (value === '') {
- return true;
- }
-
- if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
- return value;
- }
-
- if (value === '' + expected) {
- return expected;
- }
-
- return value;
- }
- } else if (node.hasAttribute(attributeName)) {
- if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
- // We had an attribute but shouldn't have had one, so read it
- // for the error message.
- return node.getAttribute(attributeName);
- }
-
- if (propertyInfo.type === BOOLEAN) {
- // If this was a boolean, it doesn't matter what the value is
- // the fact that we have it is the same as the expected.
- return expected;
- } // Even if this property uses a namespace we use getAttribute
- // because we assume its namespaced name is the same as our config.
- // To use getAttributeNS we need the local name which we don't have
- // in our config atm.
-
-
- stringValue = node.getAttribute(attributeName);
- }
-
- if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
- return stringValue === null ? expected : stringValue;
- } else if (stringValue === '' + expected) {
- return expected;
- } else {
- return stringValue;
- }
- }
- }
-}
-/**
- * Get the value for a attribute on a node. Only used in DEV for SSR validation.
- * The third argument is used as a hint of what the expected value is. Some
- * attributes have multiple equivalent values.
- */
-
-function getValueForAttribute(node, name, expected) {
- {
- if (!isAttributeNameSafe(name)) {
- return;
- }
-
- if (!node.hasAttribute(name)) {
- return expected === undefined ? undefined : null;
- }
-
- var value = node.getAttribute(name);
-
- if (value === '' + expected) {
- return expected;
- }
-
- return value;
- }
-}
-/**
- * Sets the value for a property on a node.
- *
- * @param {DOMElement} node
- * @param {string} name
- * @param {*} value
- */
-
-function setValueForProperty(node, name, value, isCustomComponentTag) {
- var propertyInfo = getPropertyInfo(name);
-
- if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
- return;
- }
-
- if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
- value = null;
- } // If the prop isn't in the special list, treat it as a simple attribute.
-
-
- if (isCustomComponentTag || propertyInfo === null) {
- if (isAttributeNameSafe(name)) {
- var _attributeName = name;
-
- if (value === null) {
- node.removeAttribute(_attributeName);
- } else {
- node.setAttribute(_attributeName, '' + value);
- }
- }
-
- return;
- }
-
- var mustUseProperty = propertyInfo.mustUseProperty;
-
- if (mustUseProperty) {
- var propertyName = propertyInfo.propertyName;
-
- if (value === null) {
- var type = propertyInfo.type;
- node[propertyName] = type === BOOLEAN ? false : '';
- } else {
- // Contrary to `setAttribute`, object properties are properly
- // `toString`ed by IE8/9.
- node[propertyName] = value;
- }
-
- return;
- } // The rest are treated as attributes with special cases.
-
-
- var attributeName = propertyInfo.attributeName,
- attributeNamespace = propertyInfo.attributeNamespace;
-
- if (value === null) {
- node.removeAttribute(attributeName);
- } else {
- var _type = propertyInfo.type;
- var attributeValue;
-
- if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
- // If attribute type is boolean, we know for sure it won't be an execution sink
- // and we won't require Trusted Type here.
- attributeValue = '';
- } else {
- // `setAttribute` with objects becomes only `[object]` in IE8/9,
- // ('' + value) makes it output the correct toString()-value.
- {
- attributeValue = '' + value;
- }
-
- if (propertyInfo.sanitizeURL) {
- sanitizeURL(attributeValue.toString());
- }
- }
-
- if (attributeNamespace) {
- node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
- } else {
- node.setAttribute(attributeName, attributeValue);
- }
- }
-}
-
-var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
-function describeComponentFrame (name, source, ownerName) {
- var sourceInfo = '';
-
- if (source) {
- var path = source.fileName;
- var fileName = path.replace(BEFORE_SLASH_RE, '');
-
- {
- // In DEV, include code for a common special case:
- // prefer "folder/index.js" instead of just "index.js".
- if (/^index\./.test(fileName)) {
- var match = path.match(BEFORE_SLASH_RE);
-
- if (match) {
- var pathBeforeSlash = match[1];
-
- if (pathBeforeSlash) {
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
- fileName = folderName + '/' + fileName;
- }
- }
- }
- }
-
- sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
- } else if (ownerName) {
- sourceInfo = ' (created by ' + ownerName + ')';
- }
-
- return '\n in ' + (name || 'Unknown') + sourceInfo;
-}
-
-// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
-// nor polyfill, then a plain number is used for performance.
-var hasSymbol = typeof Symbol === 'function' && Symbol.for;
-var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
-var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
-var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
-var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
-var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
-var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
-var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
-var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
-var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
-var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
-var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
-var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
-var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
-var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
-var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
-var FAUX_ITERATOR_SYMBOL = '@@iterator';
-function getIteratorFn(maybeIterable) {
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
- return null;
- }
-
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
-
- if (typeof maybeIterator === 'function') {
- return maybeIterator;
- }
-
- return null;
-}
-
-var Uninitialized = -1;
-var Pending = 0;
-var Resolved = 1;
-var Rejected = 2;
-function refineResolvedLazyComponent(lazyComponent) {
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
-}
-function initializeLazyComponentType(lazyComponent) {
- if (lazyComponent._status === Uninitialized) {
- lazyComponent._status = Pending;
- var ctor = lazyComponent._ctor;
- var thenable = ctor();
- lazyComponent._result = thenable;
- thenable.then(function (moduleObject) {
- if (lazyComponent._status === Pending) {
- var defaultExport = moduleObject.default;
-
- {
- if (defaultExport === undefined) {
- error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
- }
- }
-
- lazyComponent._status = Resolved;
- lazyComponent._result = defaultExport;
- }
- }, function (error) {
- if (lazyComponent._status === Pending) {
- lazyComponent._status = Rejected;
- lazyComponent._result = error;
- }
- });
- }
-}
-
-function getWrappedName(outerType, innerType, wrapperName) {
- var functionName = innerType.displayName || innerType.name || '';
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
-}
-
-function getComponentName(type) {
- if (type == null) {
- // Host root, text node or just invalid type.
- return null;
- }
-
- {
- if (typeof type.tag === 'number') {
- error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
- }
- }
-
- if (typeof type === 'function') {
- return type.displayName || type.name || null;
- }
-
- if (typeof type === 'string') {
- 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 (typeof type === 'object') {
- switch (type.$$typeof) {
- case REACT_CONTEXT_TYPE:
- return 'Context.Consumer';
-
- case REACT_PROVIDER_TYPE:
- return 'Context.Provider';
-
- case REACT_FORWARD_REF_TYPE:
- return getWrappedName(type, type.render, 'ForwardRef');
-
- case REACT_MEMO_TYPE:
- return getComponentName(type.type);
-
- case REACT_BLOCK_TYPE:
- return getComponentName(type.render);
-
- case REACT_LAZY_TYPE:
- {
- var thenable = type;
- var resolvedThenable = refineResolvedLazyComponent(thenable);
-
- if (resolvedThenable) {
- return getComponentName(resolvedThenable);
- }
-
- break;
- }
- }
- }
-
- return null;
-}
-
-var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
-
-function describeFiber(fiber) {
- switch (fiber.tag) {
- case HostRoot:
- case HostPortal:
- case HostText:
- case Fragment:
- case ContextProvider:
- case ContextConsumer:
- return '';
-
- default:
- var owner = fiber._debugOwner;
- var source = fiber._debugSource;
- var name = getComponentName(fiber.type);
- var ownerName = null;
-
- if (owner) {
- ownerName = getComponentName(owner.type);
- }
-
- return describeComponentFrame(name, source, ownerName);
- }
-}
-
-function getStackByFiberInDevAndProd(workInProgress) {
- var info = '';
- var node = workInProgress;
-
- do {
- info += describeFiber(node);
- node = node.return;
- } while (node);
-
- return info;
-}
-var current = null;
-var isRendering = false;
-function getCurrentFiberOwnerNameInDevOrNull() {
- {
- if (current === null) {
- return null;
- }
-
- var owner = current._debugOwner;
-
- if (owner !== null && typeof owner !== 'undefined') {
- return getComponentName(owner.type);
- }
- }
-
- return null;
-}
-function getCurrentFiberStackInDev() {
- {
- if (current === null) {
- return '';
- } // Safe because if current fiber exists, we are reconciling,
- // and it is guaranteed to be the work-in-progress version.
-
-
- return getStackByFiberInDevAndProd(current);
- }
-}
-function resetCurrentFiber() {
- {
- ReactDebugCurrentFrame$1.getCurrentStack = null;
- current = null;
- isRendering = false;
- }
-}
-function setCurrentFiber(fiber) {
- {
- ReactDebugCurrentFrame$1.getCurrentStack = getCurrentFiberStackInDev;
- current = fiber;
- isRendering = false;
- }
-}
-function setIsRendering(rendering) {
- {
- isRendering = rendering;
- }
-}
-
-// Flow does not allow string concatenation of most non-string types. To work
-// around this limitation, we use an opaque type that can only be obtained by
-// passing the value through getToStringValue first.
-function toString(value) {
- return '' + value;
-}
-function getToStringValue(value) {
- switch (typeof value) {
- case 'boolean':
- case 'number':
- case 'object':
- case 'string':
- case 'undefined':
- return value;
-
- default:
- // function, symbol are assigned as empty strings
- return '';
- }
-}
-
-var ReactDebugCurrentFrame$2 = null;
-var ReactControlledValuePropTypes = {
- checkPropTypes: null
-};
-
-{
- ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
- var hasReadOnlyValue = {
- button: true,
- checkbox: true,
- image: true,
- hidden: true,
- radio: true,
- reset: true,
- submit: true
- };
- var propTypes = {
- value: function (props, propName, componentName) {
- if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
- return null;
- }
-
- return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
- },
- checked: function (props, propName, componentName) {
- if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
- return null;
- }
-
- return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
- }
- };
- /**
- * Provide a linked `value` attribute for controlled forms. You should not use
- * this outside of the ReactDOM controlled form components.
- */
-
- ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
- checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
- };
-}
-
-function isCheckable(elem) {
- var type = elem.type;
- var nodeName = elem.nodeName;
- return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
-}
-
-function getTracker(node) {
- return node._valueTracker;
-}
-
-function detachTracker(node) {
- node._valueTracker = null;
-}
-
-function getValueFromNode(node) {
- var value = '';
-
- if (!node) {
- return value;
- }
-
- if (isCheckable(node)) {
- value = node.checked ? 'true' : 'false';
- } else {
- value = node.value;
- }
-
- return value;
-}
-
-function trackValueOnNode(node) {
- var valueField = isCheckable(node) ? 'checked' : 'value';
- var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
- var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail
- // and don't track value will cause over reporting of changes,
- // but it's better then a hard failure
- // (needed for certain tests that spyOn input values and Safari)
-
- if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
- return;
- }
-
- var get = descriptor.get,
- set = descriptor.set;
- Object.defineProperty(node, valueField, {
- configurable: true,
- get: function () {
- return get.call(this);
- },
- set: function (value) {
- currentValue = '' + value;
- set.call(this, value);
- }
- }); // We could've passed this the first time
- // but it triggers a bug in IE11 and Edge 14/15.
- // Calling defineProperty() again should be equivalent.
- // https://github.com/facebook/react/issues/11768
-
- Object.defineProperty(node, valueField, {
- enumerable: descriptor.enumerable
- });
- var tracker = {
- getValue: function () {
- return currentValue;
- },
- setValue: function (value) {
- currentValue = '' + value;
- },
- stopTracking: function () {
- detachTracker(node);
- delete node[valueField];
- }
- };
- return tracker;
-}
-
-function track(node) {
- if (getTracker(node)) {
- return;
- } // TODO: Once it's just Fiber we can move this to node._wrapperState
-
-
- node._valueTracker = trackValueOnNode(node);
-}
-function updateValueIfChanged(node) {
- if (!node) {
- return false;
- }
-
- var tracker = getTracker(node); // if there is no tracker at this point it's unlikely
- // that trying again will succeed
-
- if (!tracker) {
- return true;
- }
-
- var lastValue = tracker.getValue();
- var nextValue = getValueFromNode(node);
-
- if (nextValue !== lastValue) {
- tracker.setValue(nextValue);
- return true;
- }
-
- return false;
-}
-
-var didWarnValueDefaultValue = false;
-var didWarnCheckedDefaultChecked = false;
-var didWarnControlledToUncontrolled = false;
-var didWarnUncontrolledToControlled = false;
-
-function isControlled(props) {
- var usesChecked = props.type === 'checkbox' || props.type === 'radio';
- return usesChecked ? props.checked != null : props.value != null;
-}
-/**
- * Implements an host component that allows setting these optional
- * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
- *
- * If `checked` or `value` are not supplied (or null/undefined), user actions
- * that affect the checked state or value will trigger updates to the element.
- *
- * If they are supplied (and not null/undefined), the rendered element will not
- * trigger updates to the element. Instead, the props must change in order for
- * the rendered element to be updated.
- *
- * The rendered element will be initialized as unchecked (or `defaultChecked`)
- * with an empty value (or `defaultValue`).
- *
- * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
- */
-
-
-function getHostProps(element, props) {
- var node = element;
- var checked = props.checked;
-
- var hostProps = _assign({}, props, {
- defaultChecked: undefined,
- defaultValue: undefined,
- value: undefined,
- checked: checked != null ? checked : node._wrapperState.initialChecked
- });
-
- return hostProps;
-}
-function initWrapperState(element, props) {
- {
- ReactControlledValuePropTypes.checkPropTypes('input', props);
-
- if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
- error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
-
- didWarnCheckedDefaultChecked = true;
- }
-
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
- error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
-
- didWarnValueDefaultValue = true;
- }
- }
-
- var node = element;
- var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
- node._wrapperState = {
- initialChecked: props.checked != null ? props.checked : props.defaultChecked,
- initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
- controlled: isControlled(props)
- };
-}
-function updateChecked(element, props) {
- var node = element;
- var checked = props.checked;
-
- if (checked != null) {
- setValueForProperty(node, 'checked', checked, false);
- }
-}
-function updateWrapper(element, props) {
- var node = element;
-
- {
- var controlled = isControlled(props);
-
- if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
- error('A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
-
- didWarnUncontrolledToControlled = true;
- }
-
- if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
- error('A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
-
- didWarnControlledToUncontrolled = true;
- }
- }
-
- updateChecked(element, props);
- var value = getToStringValue(props.value);
- var type = props.type;
-
- if (value != null) {
- if (type === 'number') {
- if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible.
- // eslint-disable-next-line
- node.value != value) {
- node.value = toString(value);
- }
- } else if (node.value !== toString(value)) {
- node.value = toString(value);
- }
- } else if (type === 'submit' || type === 'reset') {
- // Submit/reset inputs need the attribute removed completely to avoid
- // blank-text buttons.
- node.removeAttribute('value');
- return;
- }
-
- {
- // When syncing the value attribute, the value comes from a cascade of
- // properties:
- // 1. The value React property
- // 2. The defaultValue React property
- // 3. Otherwise there should be no change
- if (props.hasOwnProperty('value')) {
- setDefaultValue(node, props.type, value);
- } else if (props.hasOwnProperty('defaultValue')) {
- setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
- }
- }
-
- {
- // When syncing the checked attribute, it only changes when it needs
- // to be removed, such as transitioning from a checkbox into a text input
- if (props.checked == null && props.defaultChecked != null) {
- node.defaultChecked = !!props.defaultChecked;
- }
- }
-}
-function postMountWrapper(element, props, isHydrating) {
- var node = element; // Do not assign value if it is already set. This prevents user text input
- // from being lost during SSR hydration.
-
- if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
- var type = props.type;
- var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the
- // default value provided by the browser. See: #12872
-
- if (isButton && (props.value === undefined || props.value === null)) {
- return;
- }
-
- var initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input
- // from being lost during SSR hydration.
-
- if (!isHydrating) {
- {
- // When syncing the value attribute, the value property should use
- // the wrapperState._initialValue property. This uses:
- //
- // 1. The value React property when present
- // 2. The defaultValue React property when present
- // 3. An empty string
- if (initialValue !== node.value) {
- node.value = initialValue;
- }
- }
- }
-
- {
- // Otherwise, the value attribute is synchronized to the property,
- // so we assign defaultValue to the same thing as the value property
- // assignment step above.
- node.defaultValue = initialValue;
- }
- } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
- // this is needed to work around a chrome bug where setting defaultChecked
- // will sometimes influence the value of checked (even after detachment).
- // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
- // We need to temporarily unset name to avoid disrupting radio button groups.
-
-
- var name = node.name;
-
- if (name !== '') {
- node.name = '';
- }
-
- {
- // When syncing the checked attribute, both the checked property and
- // attribute are assigned at the same time using defaultChecked. This uses:
- //
- // 1. The checked React property when present
- // 2. The defaultChecked React property when present
- // 3. Otherwise, false
- node.defaultChecked = !node.defaultChecked;
- node.defaultChecked = !!node._wrapperState.initialChecked;
- }
-
- if (name !== '') {
- node.name = name;
- }
-}
-function restoreControlledState(element, props) {
- var node = element;
- updateWrapper(node, props);
- updateNamedCousins(node, props);
-}
-
-function updateNamedCousins(rootNode, props) {
- var name = props.name;
-
- if (props.type === 'radio' && name != null) {
- var queryRoot = rootNode;
-
- while (queryRoot.parentNode) {
- queryRoot = queryRoot.parentNode;
- } // If `rootNode.form` was non-null, then we could try `form.elements`,
- // but that sometimes behaves strangely in IE8. We could also try using
- // `form.getElementsByName`, but that will only return direct children
- // and won't include inputs that use the HTML5 `form=` attribute. Since
- // the input might not even be in a form. It might not even be in the
- // document. Let's just use the local `querySelectorAll` to ensure we don't
- // miss anything.
-
-
- var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
-
- for (var i = 0; i < group.length; i++) {
- var otherNode = group[i];
-
- if (otherNode === rootNode || otherNode.form !== rootNode.form) {
- continue;
- } // This will throw if radio buttons rendered by different copies of React
- // and the same name are rendered into the same form (same as #1939).
- // That's probably okay; we don't support it just as we don't support
- // mixing React radio buttons with non-React ones.
-
-
- var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
-
- if (!otherProps) {
- {
- throw Error( "ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported." );
- }
- } // We need update the tracked value on the named cousin since the value
- // was changed but the input saw no event or value set
-
-
- updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that
- // was previously checked to update will cause it to be come re-checked
- // as appropriate.
-
- updateWrapper(otherNode, otherProps);
- }
- }
-} // In Chrome, assigning defaultValue to certain input types triggers input validation.
-// For number inputs, the display value loses trailing decimal points. For email inputs,
-// Chrome raises "The specified value is not a valid email address".
-//
-// Here we check to see if the defaultValue has actually changed, avoiding these problems
-// when the user is inputting text
-//
-// https://github.com/facebook/react/issues/7253
-
-
-function setDefaultValue(node, type, value) {
- if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
- type !== 'number' || node.ownerDocument.activeElement !== node) {
- if (value == null) {
- node.defaultValue = toString(node._wrapperState.initialValue);
- } else if (node.defaultValue !== toString(value)) {
- node.defaultValue = toString(value);
- }
- }
-}
-
-var didWarnSelectedSetOnOption = false;
-var didWarnInvalidChild = false;
-
-function flattenChildren(children) {
- var content = ''; // Flatten children. We'll warn if they are invalid
- // during validateProps() which runs for hydration too.
- // Note that this would throw on non-element objects.
- // Elements are stringified (which is normally irrelevant
- // but matters for ).
-
- React.Children.forEach(children, function (child) {
- if (child == null) {
- return;
- }
-
- content += child; // Note: we don't warn about invalid children here.
- // Instead, this is done separately below so that
- // it happens during the hydration codepath too.
- });
- return content;
-}
-/**
- * Implements an