Socket
Socket
Sign inDemoInstall

react-dom

Package Overview
Dependencies
Maintainers
5
Versions
1902
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dom - npm Package Compare versions

Comparing version 0.0.0-experimental-eb33bd747-20240312 to 0.0.0-experimental-eb3ad065-20240822

cjs/react-dom-client.development.js

1534

cjs/react-dom-test-utils.development.js

@@ -11,1523 +11,15 @@ /**

'use strict';
if (process.env.NODE_ENV !== "production") {
(function() {
'use strict';
var React = require('react');
var ReactDOM = require('react-dom');
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
// by calls to these methods by a Babel plugin.
//
// In PROD (or in packages without access to React internals),
// they are left as they are instead.
function warn(format) {
{
{
for (var _len = arguments.length, args = new Array(_len > 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 ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var stack = ReactDebugCurrentFrame.getStackAddendum();
if (stack !== '') {
format += '%s';
args = args.concat([stack]);
} // eslint-disable-next-line react-internal/safe-string-coercion
var argsWithFormat = args.map(function (item) {
return String(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);
}
}
/**
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* instance (key) and the internal representation (value). This allows public
* methods to accept the user facing instance as an argument and map them back
* to internal methods.
*
* Note that this module is currently shared and assumed to be stateless.
* If this becomes an actual Map, that will break.
*/
function get(key) {
return key._reactInternals;
}
var FunctionComponent = 0;
var ClassComponent = 1;
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
var HostComponent = 5;
var HostText = 6;
var HostHoistable = 26;
var HostSingleton = 27;
var NoFlags =
/* */
0;
var Placement =
/* */
2;
var Hydrating =
/* */
4096; // You can change the rest (and add more).
function getNearestMountedFiber(fiber) {
var node = fiber;
var nearestMounted = fiber;
if (!fiber.alternate) {
// If there is no alternate, this might be a new tree that isn't inserted
// yet. If it is, then it will have a pending insertion effect on it.
var nextNode = node;
do {
node = nextNode;
if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
// This is an insertion or in-progress hydration. The nearest possible
// mounted fiber is the parent but we need to continue to figure out
// if that one is still mounted.
nearestMounted = node.return;
} // $FlowFixMe[incompatible-type] we bail out when we get a null
nextNode = node.return;
} while (nextNode);
} else {
while (node.return) {
node = node.return;
}
}
if (node.tag === HostRoot) {
// TODO: Check if this was a nested HostRoot when used with
// renderContainerIntoSubtree.
return nearestMounted;
} // If we didn't hit the root, that means that we're in an disconnected tree
// that has been unmounted.
return null;
}
function assertIsMounted(fiber) {
if (getNearestMountedFiber(fiber) !== fiber) {
throw new Error('Unable to find node on an unmounted component.');
}
}
function findCurrentFiberUsingSlowPath(fiber) {
var alternate = fiber.alternate;
if (!alternate) {
// If there is no alternate, then we only need to check if it is mounted.
var nearestMounted = getNearestMountedFiber(fiber);
if (nearestMounted === null) {
throw new Error('Unable to find node on an unmounted component.');
}
if (nearestMounted !== fiber) {
return null;
}
return fiber;
} // If we have two possible branches, we'll walk backwards up to the root
// to see what path the root points to. On the way we may hit one of the
// special cases and we'll deal with them.
var a = fiber;
var b = alternate;
while (true) {
var parentA = a.return;
if (parentA === null) {
// We're at the root.
break;
}
var parentB = parentA.alternate;
if (parentB === null) {
// There is no alternate. This is an unusual case. Currently, it only
// happens when a Suspense component is hidden. An extra fragment fiber
// is inserted in between the Suspense fiber and its children. Skip
// over this extra fragment fiber and proceed to the next parent.
var nextParent = parentA.return;
if (nextParent !== null) {
a = b = nextParent;
continue;
} // If there's no parent, we're at the root.
break;
} // If both copies of the parent fiber point to the same child, we can
// assume that the child is current. This happens when we bailout on low
// priority: the bailed out fiber's child reuses the current child.
if (parentA.child === parentB.child) {
var child = parentA.child;
while (child) {
if (child === a) {
// We've determined that A is the current branch.
assertIsMounted(parentA);
return fiber;
}
if (child === b) {
// We've determined that B is the current branch.
assertIsMounted(parentA);
return alternate;
}
child = child.sibling;
} // We should never have an alternate for any mounting node. So the only
// way this could possibly happen is if this was unmounted, if at all.
throw new Error('Unable to find node on an unmounted component.');
}
if (a.return !== b.return) {
// The return pointer of A and the return pointer of B point to different
// fibers. We assume that return pointers never criss-cross, so A must
// belong to the child set of A.return, and B must belong to the child
// set of B.return.
a = parentA;
b = parentB;
} else {
// The return pointers point to the same fiber. We'll have to use the
// default, slow path: scan the child sets of each parent alternate to see
// which child belongs to which set.
//
// Search parent A's child set
var didFindChild = false;
var _child = parentA.child;
while (_child) {
if (_child === a) {
didFindChild = true;
a = parentA;
b = parentB;
break;
}
if (_child === b) {
didFindChild = true;
b = parentA;
a = parentB;
break;
}
_child = _child.sibling;
}
if (!didFindChild) {
// Search parent B's child set
_child = parentB.child;
while (_child) {
if (_child === a) {
didFindChild = true;
a = parentB;
b = parentA;
break;
}
if (_child === b) {
didFindChild = true;
b = parentB;
a = parentA;
break;
}
_child = _child.sibling;
}
if (!didFindChild) {
throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.');
}
}
}
if (a.alternate !== b) {
throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.');
}
} // If the root is not a host container, we're in a disconnected tree. I.e.
// unmounted.
if (a.tag !== HostRoot) {
throw new Error('Unable to find node on an unmounted component.');
}
if (a.stateNode.current === a) {
// We've determined that A is the current branch.
return fiber;
} // Otherwise B has to be current branch.
return alternate;
}
var assign = Object.assign;
/**
* `charCode` represents the actual "character code" and is safe to use with
* `String.fromCharCode`. As such, only keys that correspond to printable
* characters produce a valid `charCode`, the only exception to this is Enter.
* The Tab-key is considered non-printable and does not have a `charCode`,
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
* @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
var charCode;
var keyCode = nativeEvent.keyCode;
if ('charCode' in nativeEvent) {
charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`.
if (charCode === 0 && keyCode === 13) {
charCode = 13;
}
} else {
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
charCode = keyCode;
} // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
// report Enter as charCode 10 when ctrl is pressed.
if (charCode === 10) {
charCode = 13;
} // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
// Must not discard the (non-)printable Enter-key.
if (charCode >= 32 || charCode === 13) {
return charCode;
}
return 0;
}
function functionThatReturnsTrue() {
return true;
}
function functionThatReturnsFalse() {
return false;
} // This is intentionally a factory so that we have different returned constructors.
// If we had a single constructor, it would be megamorphic and engines would deopt.
function createSyntheticEvent(Interface) {
/**
* 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.
*/
// $FlowFixMe[missing-this-annot]
function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) {
this._reactName = reactName;
this._targetInst = targetInst;
this.type = reactEventType;
this.nativeEvent = nativeEvent;
this.target = nativeEventTarget;
this.currentTarget = null;
for (var propName in Interface) {
if (!Interface.hasOwnProperty(propName)) {
continue;
}
var normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
} 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;
} // $FlowFixMe[prop-missing] found when upgrading Flow
assign(SyntheticBaseEvent.prototype, {
// $FlowFixMe[missing-this-annot]
preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
if (!event) {
return;
}
if (event.preventDefault) {
event.preventDefault(); // $FlowFixMe[illegal-typeof] - flow is not aware of `unknown` in IE
} else if (typeof event.returnValue !== 'unknown') {
event.returnValue = false;
}
this.isDefaultPrevented = functionThatReturnsTrue;
},
// $FlowFixMe[missing-this-annot]
stopPropagation: function () {
var event = this.nativeEvent;
if (!event) {
return;
}
if (event.stopPropagation) {
event.stopPropagation(); // $FlowFixMe[illegal-typeof] - flow is not aware of `unknown` in IE
} 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 () {// Modern event system doesn't use pooling.
},
/**
* Checks if this event should be released back into the pool.
*
* @return {boolean} True if this should not be released, false otherwise.
*/
isPersistent: functionThatReturnsTrue
});
return SyntheticBaseEvent;
}
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var EventInterface = {
eventPhase: 0,
bubbles: 0,
cancelable: 0,
timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: 0,
isTrusted: 0
};
var SyntheticEvent = createSyntheticEvent(EventInterface);
var UIEventInterface = assign({}, EventInterface, {
view: 0,
detail: 0
});
createSyntheticEvent(UIEventInterface);
var lastMovementX;
var lastMovementY;
var lastMouseEvent;
function updateMouseMovementPolyfillState(event) {
if (event !== lastMouseEvent) {
if (lastMouseEvent && event.type === 'mousemove') {
// $FlowFixMe[unsafe-arithmetic] assuming this is a number
lastMovementX = event.screenX - lastMouseEvent.screenX; // $FlowFixMe[unsafe-arithmetic] assuming this is a number
lastMovementY = event.screenY - lastMouseEvent.screenY;
} else {
lastMovementX = 0;
lastMovementY = 0;
}
lastMouseEvent = event;
}
}
/**
* @interface MouseEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var MouseEventInterface = assign({}, UIEventInterface, {
screenX: 0,
screenY: 0,
clientX: 0,
clientY: 0,
pageX: 0,
pageY: 0,
ctrlKey: 0,
shiftKey: 0,
altKey: 0,
metaKey: 0,
getModifierState: getEventModifierState,
button: 0,
buttons: 0,
relatedTarget: function (event) {
if (event.relatedTarget === undefined) return event.fromElement === event.srcElement ? event.toElement : event.fromElement;
return event.relatedTarget;
},
movementX: function (event) {
if ('movementX' in event) {
return event.movementX;
}
updateMouseMovementPolyfillState(event);
return lastMovementX;
},
movementY: function (event) {
if ('movementY' in event) {
return event.movementY;
} // Don't need to call updateMouseMovementPolyfillState() here
// because it's guaranteed to have already run when movementX
// was copied.
return lastMovementY;
}
});
createSyntheticEvent(MouseEventInterface);
/**
* @interface DragEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var DragEventInterface = assign({}, MouseEventInterface, {
dataTransfer: 0
});
createSyntheticEvent(DragEventInterface);
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var FocusEventInterface = assign({}, UIEventInterface, {
relatedTarget: 0
});
createSyntheticEvent(FocusEventInterface);
/**
* @interface Event
* @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
*/
var AnimationEventInterface = assign({}, EventInterface, {
animationName: 0,
elapsedTime: 0,
pseudoElement: 0
});
createSyntheticEvent(AnimationEventInterface);
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = assign({}, EventInterface, {
clipboardData: function (event) {
return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
});
createSyntheticEvent(ClipboardEventInterface);
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
var CompositionEventInterface = assign({}, EventInterface, {
data: 0
});
createSyntheticEvent(CompositionEventInterface);
/**
* Normalization of deprecated HTML5 `key` values
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var normalizeKey = {
Esc: 'Escape',
Spacebar: ' ',
Left: 'ArrowLeft',
Up: 'ArrowUp',
Right: 'ArrowRight',
Down: 'ArrowDown',
Del: 'Delete',
Win: 'OS',
Menu: 'ContextMenu',
Apps: 'ContextMenu',
Scroll: 'ScrollLock',
MozPrintableKey: 'Unidentified'
};
/**
* Translation from legacy `keyCode` to HTML5 `key`
* Only special keys supported, all others depend on keyboard layout or browser
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var translateToKey = {
'8': 'Backspace',
'9': 'Tab',
'12': 'Clear',
'13': 'Enter',
'16': 'Shift',
'17': 'Control',
'18': 'Alt',
'19': 'Pause',
'20': 'CapsLock',
'27': 'Escape',
'32': ' ',
'33': 'PageUp',
'34': 'PageDown',
'35': 'End',
'36': 'Home',
'37': 'ArrowLeft',
'38': 'ArrowUp',
'39': 'ArrowRight',
'40': 'ArrowDown',
'45': 'Insert',
'46': 'Delete',
'112': 'F1',
'113': 'F2',
'114': 'F3',
'115': 'F4',
'116': 'F5',
'117': 'F6',
'118': 'F7',
'119': 'F8',
'120': 'F9',
'121': 'F10',
'122': 'F11',
'123': 'F12',
'144': 'NumLock',
'145': 'ScrollLock',
'224': 'Meta'
};
/**
* @param {object} nativeEvent Native browser event.
* @return {string} Normalized `key` property.
*/
function getEventKey(nativeEvent) {
if (nativeEvent.key) {
// Normalize inconsistent values reported by browsers due to
// implementations of a working draft specification.
// FireFox implements `key` but returns `MozPrintableKey` for all
// printable characters (normalized to `Unidentified`), ignore it.
var key = // $FlowFixMe[invalid-computed-prop] unable to index with a `mixed` value
normalizeKey[nativeEvent.key] || nativeEvent.key;
if (key !== 'Unidentified') {
return key;
}
} // Browser does not implement `key`, polyfill as much of it as we can.
if (nativeEvent.type === 'keypress') {
var charCode = getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
nativeEvent); // The enter-key is technically both printable and non-printable and can
// thus be captured by `keypress`, no other non-printable key should.
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
}
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
// While user keyboard layout determines the actual meaning of each
// `keyCode` value, almost all function keys have a universal value.
// $FlowFixMe[invalid-computed-prop] unable to index with a `mixed` value
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
}
return '';
}
/**
* Translation from modifier key to the associated property in the event.
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
*/
var modifierKeyToProp = {
Alt: 'altKey',
Control: 'ctrlKey',
Meta: 'metaKey',
Shift: 'shiftKey'
}; // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
// getModifierState. If getModifierState is not supported, we map it to a set of
// modifier keys exposed by the event. In this case, Lock-keys are not supported.
// $FlowFixMe[missing-local-annot]
// $FlowFixMe[missing-this-annot]
function modifierStateGetter(keyArg) {
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
return nativeEvent.getModifierState(keyArg);
}
var keyProp = modifierKeyToProp[keyArg];
return keyProp ? !!nativeEvent[keyProp] : false;
}
function getEventModifierState(nativeEvent) {
return modifierStateGetter;
}
/**
* @interface KeyboardEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var KeyboardEventInterface = assign({}, UIEventInterface, {
key: getEventKey,
code: 0,
location: 0,
ctrlKey: 0,
shiftKey: 0,
altKey: 0,
metaKey: 0,
repeat: 0,
locale: 0,
getModifierState: getEventModifierState,
// Legacy Interface
charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
// KeyPress is deprecated, but its replacement is not yet final and not
// implemented in any major browser. Only KeyPress has charCode.
if (event.type === 'keypress') {
return getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
event);
}
return 0;
},
keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
// The actual meaning of the value depends on the users' keyboard layout
// which cannot be detected. Assuming that it is a US keyboard layout
// provides a surprisingly accurate mapping for US and European users.
// Due to this, it is left to the user to implement at this time.
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
},
which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
return getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
event);
}
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
}
});
createSyntheticEvent(KeyboardEventInterface);
/**
* @interface PointerEvent
* @see http://www.w3.org/TR/pointerevents/
*/
var PointerEventInterface = assign({}, MouseEventInterface, {
pointerId: 0,
width: 0,
height: 0,
pressure: 0,
tangentialPressure: 0,
tiltX: 0,
tiltY: 0,
twist: 0,
pointerType: 0,
isPrimary: 0
});
createSyntheticEvent(PointerEventInterface);
/**
* @interface TouchEvent
* @see http://www.w3.org/TR/touch-events/
*/
var TouchEventInterface = assign({}, UIEventInterface, {
touches: 0,
targetTouches: 0,
changedTouches: 0,
altKey: 0,
metaKey: 0,
ctrlKey: 0,
shiftKey: 0,
getModifierState: getEventModifierState
});
createSyntheticEvent(TouchEventInterface);
/**
* @interface Event
* @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
* @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
*/
var TransitionEventInterface = assign({}, EventInterface, {
propertyName: 0,
elapsedTime: 0,
pseudoElement: 0
});
createSyntheticEvent(TransitionEventInterface);
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = assign({}, MouseEventInterface, {
deltaX: function (event) {
return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
'wheelDeltaX' in event ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
-event.wheelDeltaX : 0;
},
deltaY: function (event) {
return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
-event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
-event.wheelDelta : 0;
},
deltaZ: 0,
// Browsers without "deltaMode" is reporting in raw wheel delta where one
// notch on the scroll is always +/- 120, roughly equivalent to pixels.
// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
deltaMode: 0
});
createSyntheticEvent(WheelEventInterface);
/**
* HTML nodeType values that represent the type of the node
*/
var ELEMENT_NODE = 1;
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
function isArray(a) {
return isArrayImpl(a);
}
var SecretInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
var EventInternals = SecretInternals.Events;
var getInstanceFromNode = EventInternals[0];
var getNodeFromInstance = EventInternals[1];
var getFiberCurrentPropsFromNode = EventInternals[2];
var enqueueStateRestore = EventInternals[3];
var restoreStateIfNeeded = EventInternals[4]; // TODO: Add a warning if this API is accessed with advice to switch to
// importing directly from the React package instead.
var act = React.act;
function Event(suffix) {}
var hasWarnedAboutDeprecatedMockComponent = false;
/**
* @class ReactTestUtils
*/
function findAllInRenderedFiberTreeInternal(fiber, test) {
if (!fiber) {
return [];
}
var currentParent = findCurrentFiberUsingSlowPath(fiber);
if (!currentParent) {
return [];
}
var node = currentParent;
var ret = [];
while (true) {
if (node.tag === HostComponent || node.tag === HostText || node.tag === ClassComponent || node.tag === FunctionComponent || (node.tag === HostHoistable ) || node.tag === HostSingleton) {
var publicInst = node.stateNode;
if (test(publicInst)) {
ret.push(publicInst);
}
}
if (node.child) {
node.child.return = node;
node = node.child;
continue;
}
if (node === currentParent) {
return ret;
}
while (!node.sibling) {
if (!node.return || node.return === currentParent) {
return ret;
}
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
}
}
function validateClassInstance(inst, methodName) {
if (!inst) {
// This is probably too relaxed but it's existing behavior.
return;
}
if (get(inst)) {
// This is a public instance indeed.
return;
}
var received;
var stringified = String(inst);
if (isArray(inst)) {
received = 'an array';
} else if (inst && inst.nodeType === ELEMENT_NODE && inst.tagName) {
received = 'a DOM node';
} else if (stringified === '[object Object]') {
received = 'object with keys {' + Object.keys(inst).join(', ') + '}';
} else {
received = stringified;
}
throw new Error("The first argument must be a React class instance. " + ("Instead received: " + received + "."));
}
/**
* Utilities for making it easy to test React components.
*
* See https://reactjs.org/docs/test-utils.html
*
* Todo: Support the entire DOM.scry query syntax. For now, these simple
* utilities will suffice for testing purposes.
* @lends ReactTestUtils
*/
function renderIntoDocument(element) {
var div = document.createElement('div'); // None of our tests actually require attaching the container to the
// DOM, and doing so creates a mess that we rely on test isolation to
// clean up, so we're going to stop honoring the name of this method
// (and probably rename it eventually) if no problems arise.
// document.documentElement.appendChild(div);
return ReactDOM.render(element, div);
}
function isElement(element) {
return React.isValidElement(element);
}
function isElementOfType(inst, convenienceConstructor) {
return React.isValidElement(inst) && inst.type === convenienceConstructor;
}
function isDOMComponent(inst) {
return !!(inst && inst.nodeType === ELEMENT_NODE && inst.tagName);
}
function isDOMComponentElement(inst) {
return !!(inst && React.isValidElement(inst) && !!inst.tagName);
}
function isCompositeComponent(inst) {
if (isDOMComponent(inst)) {
// Accessing inst.setState warns; just return false as that'll be what
// this returns when we have DOM nodes as refs directly
return false;
}
return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
}
function isCompositeComponentWithType(inst, type) {
if (!isCompositeComponent(inst)) {
return false;
}
var internalInstance = get(inst);
var constructor = internalInstance.type;
return constructor === type;
}
function findAllInRenderedTree(inst, test) {
validateClassInstance(inst);
if (!inst) {
return [];
}
var internalInstance = get(inst);
return findAllInRenderedFiberTreeInternal(internalInstance, test);
}
/**
* Finds all instances of components in the rendered tree that are DOM
* components with the class name matching `className`.
* @return {array} an array of all the matches.
*/
function scryRenderedDOMComponentsWithClass(root, classNames) {
validateClassInstance(root);
return findAllInRenderedTree(root, function (inst) {
if (isDOMComponent(inst)) {
var className = inst.className;
if (typeof className !== 'string') {
// SVG, probably.
className = inst.getAttribute('class') || '';
}
var classList = className.split(/\s+/);
if (!isArray(classNames)) {
if (classNames === undefined) {
throw new Error('TestUtils.scryRenderedDOMComponentsWithClass expects a ' + 'className as a second argument.');
}
classNames = classNames.split(/\s+/);
}
return classNames.every(function (name) {
return classList.indexOf(name) !== -1;
});
}
return false;
});
}
/**
* Like scryRenderedDOMComponentsWithClass but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
function findRenderedDOMComponentWithClass(root, className) {
validateClassInstance(root);
var all = scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
}
return all[0];
}
/**
* Finds all instances of components in the rendered tree that are DOM
* components with the tag name matching `tagName`.
* @return {array} an array of all the matches.
*/
function scryRenderedDOMComponentsWithTag(root, tagName) {
validateClassInstance(root);
return findAllInRenderedTree(root, function (inst) {
return isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
});
}
/**
* Like scryRenderedDOMComponentsWithTag but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
function findRenderedDOMComponentWithTag(root, tagName) {
validateClassInstance(root);
var all = scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
}
return all[0];
}
/**
* Finds all instances of components with type equal to `componentType`.
* @return {array} an array of all the matches.
*/
function scryRenderedComponentsWithType(root, componentType) {
validateClassInstance(root);
return findAllInRenderedTree(root, function (inst) {
return isCompositeComponentWithType(inst, componentType);
});
}
/**
* Same as `scryRenderedComponentsWithType` but expects there to be one result
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactComponent} The one match.
*/
function findRenderedComponentWithType(root, componentType) {
validateClassInstance(root);
var all = scryRenderedComponentsWithType(root, componentType);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
}
return all[0];
}
/**
* Pass a mocked component module to this method to augment it with
* useful methods that allow it to be used as a dummy React component.
* Instead of rendering as usual, the component will become a simple
* <div> 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)
*/
function mockComponent(module, mockTagName) {
{
if (!hasWarnedAboutDeprecatedMockComponent) {
hasWarnedAboutDeprecatedMockComponent = true;
warn('ReactTestUtils.mockComponent() is deprecated. ' + 'Use shallow rendering or jest.mock() instead.\n\n' + 'See https://react.dev/link/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;
}
function nativeTouchData(x, y) {
return {
touches: [{
pageX: x,
pageY: y
}]
};
} // Start of inline: the below functions were inlined from
// EventPropagator.js, as they deviated from ReactDOM's newer
// implementations.
var hasError = false;
var caughtError = null;
/**
* 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) {
event.currentTarget = getNodeFromInstance(inst);
try {
listener(event);
} catch (error) {
if (!hasError) {
hasError = true;
caughtError = error;
}
}
event.currentTarget = null;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchInstances = event._dispatchInstances;
if (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;
}
/**
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
* @private
*/
function executeDispatchesAndRelease(event
/* ReactSyntheticEvent */
) {
if (event) {
executeDispatchesInOrder(event);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
}
function isInteractive(tag) {
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
}
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 && inst.tag !== HostSingleton);
if (inst) {
return inst;
}
return null;
}
/**
* 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 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
/* Fiber */
, registrationName) {
// 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;
}
var listener = props[registrationName];
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
return null;
}
if (listener && typeof listener !== 'function') {
throw new Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type.");
}
return listener;
}
function listenerAtPhase(inst, event, propagationPhase) {
var registrationName = event._reactName;
if (propagationPhase === 'captured') {
registrationName += 'Capture';
}
return getListener(inst, registrationName);
}
function accumulateDispatches(inst, ignoredDirection, event) {
if (inst && event && event._reactName) {
var registrationName = event._reactName;
var listener = getListener(inst, registrationName);
if (listener) {
if (event._dispatchListeners == null) {
event._dispatchListeners = [];
}
if (event._dispatchInstances == null) {
event._dispatchInstances = [];
}
event._dispatchListeners.push(listener);
event._dispatchInstances.push(inst);
}
}
}
function accumulateDirectionalDispatches(inst, phase, event) {
{
if (!inst) {
error('Dispatching inst must not be null');
}
}
var listener = listenerAtPhase(inst, event, phase);
if (listener) {
if (event._dispatchListeners == null) {
event._dispatchListeners = [];
}
if (event._dispatchInstances == null) {
event._dispatchInstances = [];
}
event._dispatchListeners.push(listener);
event._dispatchInstances.push(inst);
}
}
function accumulateDirectDispatchesSingle(event) {
if (event && event._reactName) {
accumulateDispatches(event._targetInst, null, event);
}
}
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event._reactName) {
traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
}
} // End of inline
var Simulate = {};
var directDispatchEventTypes = new Set(['mouseEnter', 'mouseLeave', 'pointerEnter', 'pointerLeave']);
/**
* Exports:
*
* - `Simulate.click(Element)`
* - `Simulate.mouseMove(Element)`
* - `Simulate.change(Element)`
* - ... (All keys from event plugin `eventTypes` objects)
*/
function makeSimulator(eventType) {
return function (domNode, eventData) {
if (React.isValidElement(domNode)) {
throw new 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 (isCompositeComponent(domNode)) {
throw new 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 reactName = 'on' + eventType[0].toUpperCase() + eventType.slice(1);
var fakeNativeEvent = new Event();
fakeNativeEvent.target = domNode;
fakeNativeEvent.type = eventType.toLowerCase();
var targetInst = getInstanceFromNode(domNode);
var event = new SyntheticEvent(reactName, fakeNativeEvent.type, 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 (directDispatchEventTypes.has(eventType)) {
accumulateDirectDispatchesSingle(event);
} else {
accumulateTwoPhaseDispatchesSingle(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(domNode);
executeDispatchesAndRelease(event);
if (hasError) {
var error = caughtError;
hasError = false;
caughtError = null;
throw error;
}
});
restoreStateIfNeeded();
};
} // A one-time snapshot with no plans to update. We'll probably want to deprecate Simulate API.
var simulatedEventTypes = ['blur', 'cancel', 'click', 'close', 'contextMenu', 'copy', 'cut', 'auxClick', 'doubleClick', 'dragEnd', 'dragStart', 'drop', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'mouseDown', 'mouseUp', 'paste', 'pause', 'play', 'pointerCancel', 'pointerDown', 'pointerUp', 'rateChange', 'reset', 'resize', 'seeked', 'submit', 'touchCancel', 'touchEnd', 'touchStart', 'volumeChange', 'drag', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'mouseMove', 'mouseOut', 'mouseOver', 'pointerMove', 'pointerOut', 'pointerOver', 'scroll', 'toggle', 'touchMove', 'wheel', 'abort', 'animationEnd', 'animationIteration', 'animationStart', 'canPlay', 'canPlayThrough', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'gotPointerCapture', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'lostPointerCapture', 'playing', 'progress', 'seeking', 'stalled', 'suspend', 'timeUpdate', 'transitionEnd', 'waiting', 'mouseEnter', 'mouseLeave', 'pointerEnter', 'pointerLeave', 'change', 'select', 'beforeInput', 'compositionEnd', 'compositionStart', 'compositionUpdate'];
function buildSimulators() {
simulatedEventTypes.forEach(function (eventType) {
Simulate[eventType] = makeSimulator(eventType);
});
}
buildSimulators();
exports.Simulate = Simulate;
exports.act = act;
exports.findAllInRenderedTree = findAllInRenderedTree;
exports.findRenderedComponentWithType = findRenderedComponentWithType;
exports.findRenderedDOMComponentWithClass = findRenderedDOMComponentWithClass;
exports.findRenderedDOMComponentWithTag = findRenderedDOMComponentWithTag;
exports.isCompositeComponent = isCompositeComponent;
exports.isCompositeComponentWithType = isCompositeComponentWithType;
exports.isDOMComponent = isDOMComponent;
exports.isDOMComponentElement = isDOMComponentElement;
exports.isElement = isElement;
exports.isElementOfType = isElementOfType;
exports.mockComponent = mockComponent;
exports.nativeTouchData = nativeTouchData;
exports.renderIntoDocument = renderIntoDocument;
exports.scryRenderedComponentsWithType = scryRenderedComponentsWithType;
exports.scryRenderedDOMComponentsWithClass = scryRenderedDOMComponentsWithClass;
exports.scryRenderedDOMComponentsWithTag = scryRenderedDOMComponentsWithTag;
exports.traverseTwoPhase = traverseTwoPhase;
"use strict";
"production" !== process.env.NODE_ENV &&
(function () {
var React = require("react"),
didWarnAboutUsingAct = !1;
exports.act = function (callback) {
!1 === didWarnAboutUsingAct &&
((didWarnAboutUsingAct = !0),
console.error(
"`ReactDOMTestUtils.act` is deprecated in favor of `React.act`. Import `act` from `react` instead of `react-dom/test-utils`. See https://react.dev/warnings/react-dom-test-utils for more info."
));
return React.act(callback);
};
})();
}
/**
* @license React
* react-dom-test-utils.production.min.js
* react-dom-test-utils.production.js
*

@@ -11,1450 +11,12 @@ * Copyright (c) Meta Platforms, Inc. and affiliates.

'use strict';
var React = require('react');
var ReactDOM = require('react-dom');
/**
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* instance (key) and the internal representation (value). This allows public
* methods to accept the user facing instance as an argument and map them back
* to internal methods.
*
* Note that this module is currently shared and assumed to be stateless.
* If this becomes an actual Map, that will break.
*/
function get(key) {
return key._reactInternals;
}
const FunctionComponent = 0;
const ClassComponent = 1;
const HostRoot = 3; // Root of a host tree. Could be nested inside another node.
const HostComponent = 5;
const HostText = 6;
const HostHoistable = 26;
const HostSingleton = 27;
const NoFlags =
/* */
0b0000000000000000000000000000;
const Placement =
/* */
0b0000000000000000000000000010;
const Hydrating =
/* */
0b0000000000000001000000000000; // You can change the rest (and add more).
function getNearestMountedFiber(fiber) {
let node = fiber;
let nearestMounted = fiber;
if (!fiber.alternate) {
// If there is no alternate, this might be a new tree that isn't inserted
// yet. If it is, then it will have a pending insertion effect on it.
let nextNode = node;
do {
node = nextNode;
if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
// This is an insertion or in-progress hydration. The nearest possible
// mounted fiber is the parent but we need to continue to figure out
// if that one is still mounted.
nearestMounted = node.return;
} // $FlowFixMe[incompatible-type] we bail out when we get a null
nextNode = node.return;
} while (nextNode);
} else {
while (node.return) {
node = node.return;
}
}
if (node.tag === HostRoot) {
// TODO: Check if this was a nested HostRoot when used with
// renderContainerIntoSubtree.
return nearestMounted;
} // If we didn't hit the root, that means that we're in an disconnected tree
// that has been unmounted.
return null;
}
function assertIsMounted(fiber) {
if (getNearestMountedFiber(fiber) !== fiber) {
throw new Error('Unable to find node on an unmounted component.');
}
}
function findCurrentFiberUsingSlowPath(fiber) {
const alternate = fiber.alternate;
if (!alternate) {
// If there is no alternate, then we only need to check if it is mounted.
const nearestMounted = getNearestMountedFiber(fiber);
if (nearestMounted === null) {
throw new Error('Unable to find node on an unmounted component.');
}
if (nearestMounted !== fiber) {
return null;
}
return fiber;
} // If we have two possible branches, we'll walk backwards up to the root
// to see what path the root points to. On the way we may hit one of the
// special cases and we'll deal with them.
let a = fiber;
let b = alternate;
while (true) {
const parentA = a.return;
if (parentA === null) {
// We're at the root.
break;
}
const parentB = parentA.alternate;
if (parentB === null) {
// There is no alternate. This is an unusual case. Currently, it only
// happens when a Suspense component is hidden. An extra fragment fiber
// is inserted in between the Suspense fiber and its children. Skip
// over this extra fragment fiber and proceed to the next parent.
const nextParent = parentA.return;
if (nextParent !== null) {
a = b = nextParent;
continue;
} // If there's no parent, we're at the root.
break;
} // If both copies of the parent fiber point to the same child, we can
// assume that the child is current. This happens when we bailout on low
// priority: the bailed out fiber's child reuses the current child.
if (parentA.child === parentB.child) {
let child = parentA.child;
while (child) {
if (child === a) {
// We've determined that A is the current branch.
assertIsMounted(parentA);
return fiber;
}
if (child === b) {
// We've determined that B is the current branch.
assertIsMounted(parentA);
return alternate;
}
child = child.sibling;
} // We should never have an alternate for any mounting node. So the only
// way this could possibly happen is if this was unmounted, if at all.
throw new Error('Unable to find node on an unmounted component.');
}
if (a.return !== b.return) {
// The return pointer of A and the return pointer of B point to different
// fibers. We assume that return pointers never criss-cross, so A must
// belong to the child set of A.return, and B must belong to the child
// set of B.return.
a = parentA;
b = parentB;
} else {
// The return pointers point to the same fiber. We'll have to use the
// default, slow path: scan the child sets of each parent alternate to see
// which child belongs to which set.
//
// Search parent A's child set
let didFindChild = false;
let child = parentA.child;
while (child) {
if (child === a) {
didFindChild = true;
a = parentA;
b = parentB;
break;
}
if (child === b) {
didFindChild = true;
b = parentA;
a = parentB;
break;
}
child = child.sibling;
}
if (!didFindChild) {
// Search parent B's child set
child = parentB.child;
while (child) {
if (child === a) {
didFindChild = true;
a = parentB;
b = parentA;
break;
}
if (child === b) {
didFindChild = true;
b = parentB;
a = parentA;
break;
}
child = child.sibling;
}
if (!didFindChild) {
throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.');
}
}
}
if (a.alternate !== b) {
throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.');
}
} // If the root is not a host container, we're in a disconnected tree. I.e.
// unmounted.
if (a.tag !== HostRoot) {
throw new Error('Unable to find node on an unmounted component.');
}
if (a.stateNode.current === a) {
// We've determined that A is the current branch.
return fiber;
} // Otherwise B has to be current branch.
return alternate;
}
const assign = Object.assign;
/**
* `charCode` represents the actual "character code" and is safe to use with
* `String.fromCharCode`. As such, only keys that correspond to printable
* characters produce a valid `charCode`, the only exception to this is Enter.
* The Tab-key is considered non-printable and does not have a `charCode`,
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
* @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
let charCode;
const keyCode = nativeEvent.keyCode;
if ('charCode' in nativeEvent) {
charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`.
if (charCode === 0 && keyCode === 13) {
charCode = 13;
}
} else {
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
charCode = keyCode;
} // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
// report Enter as charCode 10 when ctrl is pressed.
if (charCode === 10) {
charCode = 13;
} // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
// Must not discard the (non-)printable Enter-key.
if (charCode >= 32 || charCode === 13) {
return charCode;
}
return 0;
}
function functionThatReturnsTrue() {
return true;
}
function functionThatReturnsFalse() {
return false;
} // This is intentionally a factory so that we have different returned constructors.
// If we had a single constructor, it would be megamorphic and engines would deopt.
function createSyntheticEvent(Interface) {
/**
* 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.
*/
// $FlowFixMe[missing-this-annot]
function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) {
this._reactName = reactName;
this._targetInst = targetInst;
this.type = reactEventType;
this.nativeEvent = nativeEvent;
this.target = nativeEventTarget;
this.currentTarget = null;
for (const propName in Interface) {
if (!Interface.hasOwnProperty(propName)) {
continue;
}
const normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
this[propName] = nativeEvent[propName];
}
}
const defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = functionThatReturnsTrue;
} else {
this.isDefaultPrevented = functionThatReturnsFalse;
}
this.isPropagationStopped = functionThatReturnsFalse;
return this;
} // $FlowFixMe[prop-missing] found when upgrading Flow
assign(SyntheticBaseEvent.prototype, {
// $FlowFixMe[missing-this-annot]
preventDefault: function () {
this.defaultPrevented = true;
const event = this.nativeEvent;
if (!event) {
return;
}
if (event.preventDefault) {
event.preventDefault(); // $FlowFixMe[illegal-typeof] - flow is not aware of `unknown` in IE
} else if (typeof event.returnValue !== 'unknown') {
event.returnValue = false;
}
this.isDefaultPrevented = functionThatReturnsTrue;
},
// $FlowFixMe[missing-this-annot]
stopPropagation: function () {
const event = this.nativeEvent;
if (!event) {
return;
}
if (event.stopPropagation) {
event.stopPropagation(); // $FlowFixMe[illegal-typeof] - flow is not aware of `unknown` in IE
} 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 () {// Modern event system doesn't use pooling.
},
/**
* Checks if this event should be released back into the pool.
*
* @return {boolean} True if this should not be released, false otherwise.
*/
isPersistent: functionThatReturnsTrue
});
return SyntheticBaseEvent;
}
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
const EventInterface = {
eventPhase: 0,
bubbles: 0,
cancelable: 0,
timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: 0,
isTrusted: 0
"use strict";
var React = require("react"),
didWarnAboutUsingAct = !1;
exports.act = function (callback) {
!1 === didWarnAboutUsingAct &&
((didWarnAboutUsingAct = !0),
console.error(
"`ReactDOMTestUtils.act` is deprecated in favor of `React.act`. Import `act` from `react` instead of `react-dom/test-utils`. See https://react.dev/warnings/react-dom-test-utils for more info."
));
return React.act(callback);
};
const SyntheticEvent = createSyntheticEvent(EventInterface);
const UIEventInterface = assign({}, EventInterface, {
view: 0,
detail: 0
});
createSyntheticEvent(UIEventInterface);
let lastMovementX;
let lastMovementY;
let lastMouseEvent;
function updateMouseMovementPolyfillState(event) {
if (event !== lastMouseEvent) {
if (lastMouseEvent && event.type === 'mousemove') {
// $FlowFixMe[unsafe-arithmetic] assuming this is a number
lastMovementX = event.screenX - lastMouseEvent.screenX; // $FlowFixMe[unsafe-arithmetic] assuming this is a number
lastMovementY = event.screenY - lastMouseEvent.screenY;
} else {
lastMovementX = 0;
lastMovementY = 0;
}
lastMouseEvent = event;
}
}
/**
* @interface MouseEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
const MouseEventInterface = assign({}, UIEventInterface, {
screenX: 0,
screenY: 0,
clientX: 0,
clientY: 0,
pageX: 0,
pageY: 0,
ctrlKey: 0,
shiftKey: 0,
altKey: 0,
metaKey: 0,
getModifierState: getEventModifierState,
button: 0,
buttons: 0,
relatedTarget: function (event) {
if (event.relatedTarget === undefined) return event.fromElement === event.srcElement ? event.toElement : event.fromElement;
return event.relatedTarget;
},
movementX: function (event) {
if ('movementX' in event) {
return event.movementX;
}
updateMouseMovementPolyfillState(event);
return lastMovementX;
},
movementY: function (event) {
if ('movementY' in event) {
return event.movementY;
} // Don't need to call updateMouseMovementPolyfillState() here
// because it's guaranteed to have already run when movementX
// was copied.
return lastMovementY;
}
});
createSyntheticEvent(MouseEventInterface);
/**
* @interface DragEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
const DragEventInterface = assign({}, MouseEventInterface, {
dataTransfer: 0
});
createSyntheticEvent(DragEventInterface);
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
const FocusEventInterface = assign({}, UIEventInterface, {
relatedTarget: 0
});
createSyntheticEvent(FocusEventInterface);
/**
* @interface Event
* @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
* @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
*/
const AnimationEventInterface = assign({}, EventInterface, {
animationName: 0,
elapsedTime: 0,
pseudoElement: 0
});
createSyntheticEvent(AnimationEventInterface);
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
const ClipboardEventInterface = assign({}, EventInterface, {
clipboardData: function (event) {
return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
});
createSyntheticEvent(ClipboardEventInterface);
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
const CompositionEventInterface = assign({}, EventInterface, {
data: 0
});
createSyntheticEvent(CompositionEventInterface);
/**
* Normalization of deprecated HTML5 `key` values
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
const normalizeKey = {
Esc: 'Escape',
Spacebar: ' ',
Left: 'ArrowLeft',
Up: 'ArrowUp',
Right: 'ArrowRight',
Down: 'ArrowDown',
Del: 'Delete',
Win: 'OS',
Menu: 'ContextMenu',
Apps: 'ContextMenu',
Scroll: 'ScrollLock',
MozPrintableKey: 'Unidentified'
};
/**
* Translation from legacy `keyCode` to HTML5 `key`
* Only special keys supported, all others depend on keyboard layout or browser
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
const translateToKey = {
'8': 'Backspace',
'9': 'Tab',
'12': 'Clear',
'13': 'Enter',
'16': 'Shift',
'17': 'Control',
'18': 'Alt',
'19': 'Pause',
'20': 'CapsLock',
'27': 'Escape',
'32': ' ',
'33': 'PageUp',
'34': 'PageDown',
'35': 'End',
'36': 'Home',
'37': 'ArrowLeft',
'38': 'ArrowUp',
'39': 'ArrowRight',
'40': 'ArrowDown',
'45': 'Insert',
'46': 'Delete',
'112': 'F1',
'113': 'F2',
'114': 'F3',
'115': 'F4',
'116': 'F5',
'117': 'F6',
'118': 'F7',
'119': 'F8',
'120': 'F9',
'121': 'F10',
'122': 'F11',
'123': 'F12',
'144': 'NumLock',
'145': 'ScrollLock',
'224': 'Meta'
};
/**
* @param {object} nativeEvent Native browser event.
* @return {string} Normalized `key` property.
*/
function getEventKey(nativeEvent) {
if (nativeEvent.key) {
// Normalize inconsistent values reported by browsers due to
// implementations of a working draft specification.
// FireFox implements `key` but returns `MozPrintableKey` for all
// printable characters (normalized to `Unidentified`), ignore it.
const key = // $FlowFixMe[invalid-computed-prop] unable to index with a `mixed` value
normalizeKey[nativeEvent.key] || nativeEvent.key;
if (key !== 'Unidentified') {
return key;
}
} // Browser does not implement `key`, polyfill as much of it as we can.
if (nativeEvent.type === 'keypress') {
const charCode = getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
nativeEvent); // The enter-key is technically both printable and non-printable and can
// thus be captured by `keypress`, no other non-printable key should.
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
}
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
// While user keyboard layout determines the actual meaning of each
// `keyCode` value, almost all function keys have a universal value.
// $FlowFixMe[invalid-computed-prop] unable to index with a `mixed` value
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
}
return '';
}
/**
* Translation from modifier key to the associated property in the event.
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
*/
const modifierKeyToProp = {
Alt: 'altKey',
Control: 'ctrlKey',
Meta: 'metaKey',
Shift: 'shiftKey'
}; // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
// getModifierState. If getModifierState is not supported, we map it to a set of
// modifier keys exposed by the event. In this case, Lock-keys are not supported.
// $FlowFixMe[missing-local-annot]
// $FlowFixMe[missing-this-annot]
function modifierStateGetter(keyArg) {
const syntheticEvent = this;
const nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
return nativeEvent.getModifierState(keyArg);
}
const keyProp = modifierKeyToProp[keyArg];
return keyProp ? !!nativeEvent[keyProp] : false;
}
function getEventModifierState(nativeEvent) {
return modifierStateGetter;
}
/**
* @interface KeyboardEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
const KeyboardEventInterface = assign({}, UIEventInterface, {
key: getEventKey,
code: 0,
location: 0,
ctrlKey: 0,
shiftKey: 0,
altKey: 0,
metaKey: 0,
repeat: 0,
locale: 0,
getModifierState: getEventModifierState,
// Legacy Interface
charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
// KeyPress is deprecated, but its replacement is not yet final and not
// implemented in any major browser. Only KeyPress has charCode.
if (event.type === 'keypress') {
return getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
event);
}
return 0;
},
keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
// The actual meaning of the value depends on the users' keyboard layout
// which cannot be detected. Assuming that it is a US keyboard layout
// provides a surprisingly accurate mapping for US and European users.
// Due to this, it is left to the user to implement at this time.
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
},
which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
return getEventCharCode( // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
event);
}
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
}
});
createSyntheticEvent(KeyboardEventInterface);
/**
* @interface PointerEvent
* @see http://www.w3.org/TR/pointerevents/
*/
const PointerEventInterface = assign({}, MouseEventInterface, {
pointerId: 0,
width: 0,
height: 0,
pressure: 0,
tangentialPressure: 0,
tiltX: 0,
tiltY: 0,
twist: 0,
pointerType: 0,
isPrimary: 0
});
createSyntheticEvent(PointerEventInterface);
/**
* @interface TouchEvent
* @see http://www.w3.org/TR/touch-events/
*/
const TouchEventInterface = assign({}, UIEventInterface, {
touches: 0,
targetTouches: 0,
changedTouches: 0,
altKey: 0,
metaKey: 0,
ctrlKey: 0,
shiftKey: 0,
getModifierState: getEventModifierState
});
createSyntheticEvent(TouchEventInterface);
/**
* @interface Event
* @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
* @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
*/
const TransitionEventInterface = assign({}, EventInterface, {
propertyName: 0,
elapsedTime: 0,
pseudoElement: 0
});
createSyntheticEvent(TransitionEventInterface);
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
const WheelEventInterface = assign({}, MouseEventInterface, {
deltaX(event) {
return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
'wheelDeltaX' in event ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
-event.wheelDeltaX : 0;
},
deltaY(event) {
return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
-event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? // $FlowFixMe[unsafe-arithmetic] assuming this is a number
-event.wheelDelta : 0;
},
deltaZ: 0,
// Browsers without "deltaMode" is reporting in raw wheel delta where one
// notch on the scroll is always +/- 120, roughly equivalent to pixels.
// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
deltaMode: 0
});
createSyntheticEvent(WheelEventInterface);
/**
* HTML nodeType values that represent the type of the node
*/
const ELEMENT_NODE = 1;
const isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
function isArray(a) {
return isArrayImpl(a);
}
const SecretInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
const EventInternals = SecretInternals.Events;
const getInstanceFromNode = EventInternals[0];
const getNodeFromInstance = EventInternals[1];
const getFiberCurrentPropsFromNode = EventInternals[2];
const enqueueStateRestore = EventInternals[3];
const restoreStateIfNeeded = EventInternals[4]; // TODO: Add a warning if this API is accessed with advice to switch to
// importing directly from the React package instead.
const act = React.act;
function Event(suffix) {}
/**
* @class ReactTestUtils
*/
function findAllInRenderedFiberTreeInternal(fiber, test) {
if (!fiber) {
return [];
}
const currentParent = findCurrentFiberUsingSlowPath(fiber);
if (!currentParent) {
return [];
}
let node = currentParent;
const ret = [];
while (true) {
if (node.tag === HostComponent || node.tag === HostText || node.tag === ClassComponent || node.tag === FunctionComponent || (node.tag === HostHoistable ) || node.tag === HostSingleton) {
const publicInst = node.stateNode;
if (test(publicInst)) {
ret.push(publicInst);
}
}
if (node.child) {
node.child.return = node;
node = node.child;
continue;
}
if (node === currentParent) {
return ret;
}
while (!node.sibling) {
if (!node.return || node.return === currentParent) {
return ret;
}
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
}
}
function validateClassInstance(inst, methodName) {
if (!inst) {
// This is probably too relaxed but it's existing behavior.
return;
}
if (get(inst)) {
// This is a public instance indeed.
return;
}
let received;
const stringified = String(inst);
if (isArray(inst)) {
received = 'an array';
} else if (inst && inst.nodeType === ELEMENT_NODE && inst.tagName) {
received = 'a DOM node';
} else if (stringified === '[object Object]') {
received = 'object with keys {' + Object.keys(inst).join(', ') + '}';
} else {
received = stringified;
}
throw new Error("The first argument must be a React class instance. " + ("Instead received: " + received + "."));
}
/**
* Utilities for making it easy to test React components.
*
* See https://reactjs.org/docs/test-utils.html
*
* Todo: Support the entire DOM.scry query syntax. For now, these simple
* utilities will suffice for testing purposes.
* @lends ReactTestUtils
*/
function renderIntoDocument(element) {
const div = document.createElement('div'); // None of our tests actually require attaching the container to the
// DOM, and doing so creates a mess that we rely on test isolation to
// clean up, so we're going to stop honoring the name of this method
// (and probably rename it eventually) if no problems arise.
// document.documentElement.appendChild(div);
return ReactDOM.render(element, div);
}
function isElement(element) {
return React.isValidElement(element);
}
function isElementOfType(inst, convenienceConstructor) {
return React.isValidElement(inst) && inst.type === convenienceConstructor;
}
function isDOMComponent(inst) {
return !!(inst && inst.nodeType === ELEMENT_NODE && inst.tagName);
}
function isDOMComponentElement(inst) {
return !!(inst && React.isValidElement(inst) && !!inst.tagName);
}
function isCompositeComponent(inst) {
if (isDOMComponent(inst)) {
// Accessing inst.setState warns; just return false as that'll be what
// this returns when we have DOM nodes as refs directly
return false;
}
return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
}
function isCompositeComponentWithType(inst, type) {
if (!isCompositeComponent(inst)) {
return false;
}
const internalInstance = get(inst);
const constructor = internalInstance.type;
return constructor === type;
}
function findAllInRenderedTree(inst, test) {
validateClassInstance(inst);
if (!inst) {
return [];
}
const internalInstance = get(inst);
return findAllInRenderedFiberTreeInternal(internalInstance, test);
}
/**
* Finds all instances of components in the rendered tree that are DOM
* components with the class name matching `className`.
* @return {array} an array of all the matches.
*/
function scryRenderedDOMComponentsWithClass(root, classNames) {
validateClassInstance(root);
return findAllInRenderedTree(root, function (inst) {
if (isDOMComponent(inst)) {
let className = inst.className;
if (typeof className !== 'string') {
// SVG, probably.
className = inst.getAttribute('class') || '';
}
const classList = className.split(/\s+/);
if (!isArray(classNames)) {
if (classNames === undefined) {
throw new Error('TestUtils.scryRenderedDOMComponentsWithClass expects a ' + 'className as a second argument.');
}
classNames = classNames.split(/\s+/);
}
return classNames.every(function (name) {
return classList.indexOf(name) !== -1;
});
}
return false;
});
}
/**
* Like scryRenderedDOMComponentsWithClass but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
function findRenderedDOMComponentWithClass(root, className) {
validateClassInstance(root);
const all = scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
}
return all[0];
}
/**
* Finds all instances of components in the rendered tree that are DOM
* components with the tag name matching `tagName`.
* @return {array} an array of all the matches.
*/
function scryRenderedDOMComponentsWithTag(root, tagName) {
validateClassInstance(root);
return findAllInRenderedTree(root, function (inst) {
return isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
});
}
/**
* Like scryRenderedDOMComponentsWithTag but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
function findRenderedDOMComponentWithTag(root, tagName) {
validateClassInstance(root);
const all = scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
}
return all[0];
}
/**
* Finds all instances of components with type equal to `componentType`.
* @return {array} an array of all the matches.
*/
function scryRenderedComponentsWithType(root, componentType) {
validateClassInstance(root);
return findAllInRenderedTree(root, function (inst) {
return isCompositeComponentWithType(inst, componentType);
});
}
/**
* Same as `scryRenderedComponentsWithType` but expects there to be one result
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactComponent} The one match.
*/
function findRenderedComponentWithType(root, componentType) {
validateClassInstance(root);
const all = scryRenderedComponentsWithType(root, componentType);
if (all.length !== 1) {
throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
}
return all[0];
}
/**
* Pass a mocked component module to this method to augment it with
* useful methods that allow it to be used as a dummy React component.
* Instead of rendering as usual, the component will become a simple
* <div> 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)
*/
function mockComponent(module, mockTagName) {
mockTagName = mockTagName || module.mockTagName || 'div';
module.prototype.render.mockImplementation(function () {
return React.createElement(mockTagName, null, this.props.children);
});
return this;
}
function nativeTouchData(x, y) {
return {
touches: [{
pageX: x,
pageY: y
}]
};
} // Start of inline: the below functions were inlined from
// EventPropagator.js, as they deviated from ReactDOM's newer
// implementations.
let hasError = false;
let caughtError = null;
/**
* 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) {
event.currentTarget = getNodeFromInstance(inst);
try {
listener(event);
} catch (error) {
if (!hasError) {
hasError = true;
caughtError = error;
}
}
event.currentTarget = null;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event) {
const dispatchListeners = event._dispatchListeners;
const dispatchInstances = event._dispatchInstances;
if (isArray(dispatchListeners)) {
for (let 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;
}
/**
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
* @private
*/
function executeDispatchesAndRelease(event
/* ReactSyntheticEvent */
) {
if (event) {
executeDispatchesInOrder(event);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
}
function isInteractive(tag) {
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
}
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 && inst.tag !== HostSingleton);
if (inst) {
return inst;
}
return null;
}
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
*/
function traverseTwoPhase(inst, fn, arg) {
const path = [];
while (inst) {
path.push(inst);
inst = getParent(inst);
}
let 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 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
/* Fiber */
, registrationName) {
// TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
// live here; needs to be moved to a better place soon
const stateNode = inst.stateNode;
if (!stateNode) {
// Work in progress (ex: onload events in incremental mode).
return null;
}
const props = getFiberCurrentPropsFromNode(stateNode);
if (!props) {
// Work in progress.
return null;
}
const listener = props[registrationName];
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
return null;
}
if (listener && typeof listener !== 'function') {
throw new Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type.");
}
return listener;
}
function listenerAtPhase(inst, event, propagationPhase) {
let registrationName = event._reactName;
if (propagationPhase === 'captured') {
registrationName += 'Capture';
}
return getListener(inst, registrationName);
}
function accumulateDispatches(inst, ignoredDirection, event) {
if (inst && event && event._reactName) {
const registrationName = event._reactName;
const listener = getListener(inst, registrationName);
if (listener) {
if (event._dispatchListeners == null) {
event._dispatchListeners = [];
}
if (event._dispatchInstances == null) {
event._dispatchInstances = [];
}
event._dispatchListeners.push(listener);
event._dispatchInstances.push(inst);
}
}
}
function accumulateDirectionalDispatches(inst, phase, event) {
const listener = listenerAtPhase(inst, event, phase);
if (listener) {
if (event._dispatchListeners == null) {
event._dispatchListeners = [];
}
if (event._dispatchInstances == null) {
event._dispatchInstances = [];
}
event._dispatchListeners.push(listener);
event._dispatchInstances.push(inst);
}
}
function accumulateDirectDispatchesSingle(event) {
if (event && event._reactName) {
accumulateDispatches(event._targetInst, null, event);
}
}
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event._reactName) {
traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
}
} // End of inline
const Simulate = {};
const directDispatchEventTypes = new Set(['mouseEnter', 'mouseLeave', 'pointerEnter', 'pointerLeave']);
/**
* Exports:
*
* - `Simulate.click(Element)`
* - `Simulate.mouseMove(Element)`
* - `Simulate.change(Element)`
* - ... (All keys from event plugin `eventTypes` objects)
*/
function makeSimulator(eventType) {
return function (domNode, eventData) {
if (React.isValidElement(domNode)) {
throw new 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 (isCompositeComponent(domNode)) {
throw new 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.');
}
const reactName = 'on' + eventType[0].toUpperCase() + eventType.slice(1);
const fakeNativeEvent = new Event();
fakeNativeEvent.target = domNode;
fakeNativeEvent.type = eventType.toLowerCase();
const targetInst = getInstanceFromNode(domNode);
const event = new SyntheticEvent(reactName, fakeNativeEvent.type, 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 (directDispatchEventTypes.has(eventType)) {
accumulateDirectDispatchesSingle(event);
} else {
accumulateTwoPhaseDispatchesSingle(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(domNode);
executeDispatchesAndRelease(event);
if (hasError) {
const error = caughtError;
hasError = false;
caughtError = null;
throw error;
}
});
restoreStateIfNeeded();
};
} // A one-time snapshot with no plans to update. We'll probably want to deprecate Simulate API.
const simulatedEventTypes = ['blur', 'cancel', 'click', 'close', 'contextMenu', 'copy', 'cut', 'auxClick', 'doubleClick', 'dragEnd', 'dragStart', 'drop', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'mouseDown', 'mouseUp', 'paste', 'pause', 'play', 'pointerCancel', 'pointerDown', 'pointerUp', 'rateChange', 'reset', 'resize', 'seeked', 'submit', 'touchCancel', 'touchEnd', 'touchStart', 'volumeChange', 'drag', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'mouseMove', 'mouseOut', 'mouseOver', 'pointerMove', 'pointerOut', 'pointerOver', 'scroll', 'toggle', 'touchMove', 'wheel', 'abort', 'animationEnd', 'animationIteration', 'animationStart', 'canPlay', 'canPlayThrough', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'gotPointerCapture', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'lostPointerCapture', 'playing', 'progress', 'seeking', 'stalled', 'suspend', 'timeUpdate', 'transitionEnd', 'waiting', 'mouseEnter', 'mouseLeave', 'pointerEnter', 'pointerLeave', 'change', 'select', 'beforeInput', 'compositionEnd', 'compositionStart', 'compositionUpdate'];
function buildSimulators() {
simulatedEventTypes.forEach(eventType => {
Simulate[eventType] = makeSimulator(eventType);
});
}
buildSimulators();
exports.Simulate = Simulate;
exports.act = act;
exports.findAllInRenderedTree = findAllInRenderedTree;
exports.findRenderedComponentWithType = findRenderedComponentWithType;
exports.findRenderedDOMComponentWithClass = findRenderedDOMComponentWithClass;
exports.findRenderedDOMComponentWithTag = findRenderedDOMComponentWithTag;
exports.isCompositeComponent = isCompositeComponent;
exports.isCompositeComponentWithType = isCompositeComponentWithType;
exports.isDOMComponent = isDOMComponent;
exports.isDOMComponentElement = isDOMComponentElement;
exports.isElement = isElement;
exports.isElementOfType = isElementOfType;
exports.mockComponent = mockComponent;
exports.nativeTouchData = nativeTouchData;
exports.renderIntoDocument = renderIntoDocument;
exports.scryRenderedComponentsWithType = scryRenderedComponentsWithType;
exports.scryRenderedDOMComponentsWithClass = scryRenderedDOMComponentsWithClass;
exports.scryRenderedDOMComponentsWithTag = scryRenderedDOMComponentsWithTag;
exports.traverseTwoPhase = traverseTwoPhase;

@@ -11,309 +11,331 @@ /**

'use strict';
if (process.env.NODE_ENV !== "production") {
(function() {
'use strict';
var React = require('react');
function noop() {}
var DefaultDispatcher = {
prefetchDNS: noop,
preconnect: noop,
preload: noop,
preloadModule: noop,
preinitScript: noop,
preinitStyle: noop,
preinitModuleScript: noop
};
var Internals = {
usingClientEntryPoint: false,
Events: null,
ReactDOMCurrentDispatcher: {
current: DefaultDispatcher
}
};
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
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);
"use strict";
"production" !== process.env.NODE_ENV &&
(function () {
function noop() {}
function getCrossOriginStringAs(as, input) {
if ("font" === as) return "";
if ("string" === typeof input)
return "use-credentials" === input ? input : "";
}
}
}
function printWarning(level, format, args) {
// When changing this logic, you might want to also
// update consoleWithStackDev.www.js as well.
{
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var stack = ReactDebugCurrentFrame.getStackAddendum();
if (stack !== '') {
format += '%s';
args = args.concat([stack]);
} // eslint-disable-next-line react-internal/safe-string-coercion
var argsWithFormat = args.map(function (item) {
return String(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);
}
}
function getCrossOriginString(input) {
if (typeof input === 'string') {
return input === 'use-credentials' ? input : '';
}
return undefined;
}
function getCrossOriginStringAs(as, input) {
if (as === 'font') {
return '';
}
if (typeof input === 'string') {
return input === 'use-credentials' ? input : '';
}
return undefined;
}
var ReactDOMCurrentDispatcher = Internals.ReactDOMCurrentDispatcher;
function prefetchDNS(href) {
{
if (typeof href !== 'string' || !href) {
error('ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
} else if (arguments.length > 1) {
var options = arguments[1];
if (typeof options === 'object' && options.hasOwnProperty('crossOrigin')) {
error('ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.', getValueDescriptorExpectingEnumForWarning(options));
} else {
error('ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.', getValueDescriptorExpectingEnumForWarning(options));
}
function getValueDescriptorExpectingObjectForWarning(thing) {
return null === thing
? "`null`"
: void 0 === thing
? "`undefined`"
: "" === thing
? "an empty string"
: 'something with type "' + typeof thing + '"';
}
}
if (typeof href === 'string') {
ReactDOMCurrentDispatcher.current.prefetchDNS(href);
} // We don't error because preconnect needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preconnect(href, options) {
{
if (typeof href !== 'string' || !href) {
error('ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
} else if (options != null && typeof options !== 'object') {
error('ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.', getValueDescriptorExpectingEnumForWarning(options));
} else if (options != null && typeof options.crossOrigin !== 'string') {
error('ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.', getValueDescriptorExpectingObjectForWarning(options.crossOrigin));
function getValueDescriptorExpectingEnumForWarning(thing) {
return null === thing
? "`null`"
: void 0 === thing
? "`undefined`"
: "" === thing
? "an empty string"
: "string" === typeof thing
? JSON.stringify(thing)
: "number" === typeof thing
? "`" + thing + "`"
: 'something with type "' + typeof thing + '"';
}
}
if (typeof href === 'string') {
var crossOrigin = options ? getCrossOriginString(options.crossOrigin) : null;
ReactDOMCurrentDispatcher.current.preconnect(href, crossOrigin);
} // We don't error because preconnect needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preload(href, options) {
{
var encountered = '';
if (typeof href !== 'string' || !href) {
encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
}
if (options == null || typeof options !== 'object') {
encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
} else if (typeof options.as !== 'string' || !options.as) {
encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".";
}
if (encountered) {
error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s', encountered);
}
}
if (typeof href === 'string' && // We check existence because we cannot enforce this function is actually called with the stated type
typeof options === 'object' && options !== null && typeof options.as === 'string') {
var as = options.as;
var crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
ReactDOMCurrentDispatcher.current.preload(href, as, {
crossOrigin: crossOrigin,
integrity: typeof options.integrity === 'string' ? options.integrity : undefined,
nonce: typeof options.nonce === 'string' ? options.nonce : undefined,
type: typeof options.type === 'string' ? options.type : undefined,
fetchPriority: typeof options.fetchPriority === 'string' ? options.fetchPriority : undefined,
referrerPolicy: typeof options.referrerPolicy === 'string' ? options.referrerPolicy : undefined,
imageSrcSet: typeof options.imageSrcSet === 'string' ? options.imageSrcSet : undefined,
imageSizes: typeof options.imageSizes === 'string' ? options.imageSizes : undefined
});
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preloadModule(href, options) {
{
var encountered = '';
if (typeof href !== 'string' || !href) {
encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
}
if (options !== undefined && typeof options !== 'object') {
encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
} else if (options && 'as' in options && typeof options.as !== 'string') {
encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".";
}
if (encountered) {
error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s', encountered);
}
}
if (typeof href === 'string') {
if (options) {
var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
ReactDOMCurrentDispatcher.current.preloadModule(href, {
as: typeof options.as === 'string' && options.as !== 'script' ? options.as : undefined,
crossOrigin: crossOrigin,
integrity: typeof options.integrity === 'string' ? options.integrity : undefined
});
} else {
ReactDOMCurrentDispatcher.current.preloadModule(href);
}
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preinit(href, options) {
{
if (typeof href !== 'string' || !href) {
error('ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
} else if (options == null || typeof options !== 'object') {
error('ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.', getValueDescriptorExpectingEnumForWarning(options));
} else if (options.as !== 'style' && options.as !== 'script') {
error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".', getValueDescriptorExpectingEnumForWarning(options.as));
}
}
if (typeof href === 'string' && options && typeof options.as === 'string') {
var as = options.as;
var crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
var integrity = typeof options.integrity === 'string' ? options.integrity : undefined;
var fetchPriority = typeof options.fetchPriority === 'string' ? options.fetchPriority : undefined;
if (as === 'style') {
ReactDOMCurrentDispatcher.current.preinitStyle(href, typeof options.precedence === 'string' ? options.precedence : undefined, {
crossOrigin: crossOrigin,
integrity: integrity,
fetchPriority: fetchPriority
});
} else if (as === 'script') {
ReactDOMCurrentDispatcher.current.preinitScript(href, {
crossOrigin: crossOrigin,
integrity: integrity,
fetchPriority: fetchPriority,
nonce: typeof options.nonce === 'string' ? options.nonce : undefined
});
}
} // We don't error because preinit needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preinitModule(href, options) {
{
var encountered = '';
if (typeof href !== 'string' || !href) {
encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
}
if (options !== undefined && typeof options !== 'object') {
encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
} else if (options && 'as' in options && options.as !== 'script') {
encountered += " The `as` option encountered was " + getValueDescriptorExpectingEnumForWarning(options.as) + ".";
}
if (encountered) {
error('ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s', encountered);
} else {
var as = options && typeof options.as === 'string' ? options.as : 'script';
switch (as) {
case 'script':
{
var React = require("react"),
Internals = {
d: {
f: noop,
r: function () {
throw Error(
"Invalid form element. requestFormReset must be passed a form that was rendered by React."
);
},
D: noop,
C: noop,
L: noop,
m: noop,
X: noop,
S: noop,
M: noop
},
p: 0,
findDOMNode: null
};
if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)
throw Error(
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
);
("function" === typeof Map &&
null != Map.prototype &&
"function" === typeof Map.prototype.forEach &&
"function" === typeof Set &&
null != Set.prototype &&
"function" === typeof Set.prototype.clear &&
"function" === typeof Set.prototype.forEach) ||
console.error(
"React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"
);
exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
Internals;
exports.preconnect = function (href, options) {
"string" === typeof href && href
? null != options && "object" !== typeof options
? console.error(
"ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",
getValueDescriptorExpectingEnumForWarning(options)
)
: null != options &&
"string" !== typeof options.crossOrigin &&
console.error(
"ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",
getValueDescriptorExpectingObjectForWarning(options.crossOrigin)
)
: console.error(
"ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
getValueDescriptorExpectingObjectForWarning(href)
);
"string" === typeof href &&
(options
? ((options = options.crossOrigin),
(options =
"string" === typeof options
? "use-credentials" === options
? options
: ""
: void 0))
: (options = null),
Internals.d.C(href, options));
};
exports.prefetchDNS = function (href) {
if ("string" !== typeof href || !href)
console.error(
"ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
getValueDescriptorExpectingObjectForWarning(href)
);
else if (1 < arguments.length) {
var options = arguments[1];
"object" === typeof options && options.hasOwnProperty("crossOrigin")
? console.error(
"ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
getValueDescriptorExpectingEnumForWarning(options)
)
: console.error(
"ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
getValueDescriptorExpectingEnumForWarning(options)
);
}
"string" === typeof href && Internals.d.D(href);
};
exports.preinit = function (href, options) {
"string" === typeof href && href
? null == options || "object" !== typeof options
? console.error(
"ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",
getValueDescriptorExpectingEnumForWarning(options)
)
: "style" !== options.as &&
"script" !== options.as &&
console.error(
'ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',
getValueDescriptorExpectingEnumForWarning(options.as)
)
: console.error(
"ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
getValueDescriptorExpectingObjectForWarning(href)
);
if (
"string" === typeof href &&
options &&
"string" === typeof options.as
) {
var as = options.as,
crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),
integrity =
"string" === typeof options.integrity ? options.integrity : void 0,
fetchPriority =
"string" === typeof options.fetchPriority
? options.fetchPriority
: void 0;
"style" === as
? Internals.d.S(
href,
"string" === typeof options.precedence
? options.precedence
: void 0,
{
crossOrigin: crossOrigin,
integrity: integrity,
fetchPriority: fetchPriority
}
)
: "script" === as &&
Internals.d.X(href, {
crossOrigin: crossOrigin,
integrity: integrity,
fetchPriority: fetchPriority,
nonce: "string" === typeof options.nonce ? options.nonce : void 0
});
}
};
exports.preinitModule = function (href, options) {
var encountered = "";
("string" === typeof href && href) ||
(encountered +=
" The `href` argument encountered was " +
getValueDescriptorExpectingObjectForWarning(href) +
".");
void 0 !== options && "object" !== typeof options
? (encountered +=
" The `options` argument encountered was " +
getValueDescriptorExpectingObjectForWarning(options) +
".")
: options &&
"as" in options &&
"script" !== options.as &&
(encountered +=
" The `as` option encountered was " +
getValueDescriptorExpectingEnumForWarning(options.as) +
".");
if (encountered)
console.error(
"ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",
encountered
);
else
switch (
((encountered =
options && "string" === typeof options.as ? options.as : "script"),
encountered)
) {
case "script":
break;
}
// We have an invalid as type and need to warn
default:
{
var typeOfAs = getValueDescriptorExpectingEnumForWarning(as);
error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script"' + ' but received "%s" instead. This warning was generated for `href` "%s". In the future other' + ' module types will be supported, aligning with the import-attributes proposal. Learn more here:' + ' (https://github.com/tc39/proposal-import-attributes)', typeOfAs, href);
}
}
}
}
if (typeof href === 'string') {
if (typeof options === 'object' && options !== null) {
if (options.as == null || options.as === 'script') {
var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
ReactDOMCurrentDispatcher.current.preinitModuleScript(href, {
default:
(encountered =
getValueDescriptorExpectingEnumForWarning(encountered)),
console.error(
'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',
encountered,
href
);
}
if ("string" === typeof href)
if ("object" === typeof options && null !== options) {
if (null == options.as || "script" === options.as)
(encountered = getCrossOriginStringAs(
options.as,
options.crossOrigin
)),
Internals.d.M(href, {
crossOrigin: encountered,
integrity:
"string" === typeof options.integrity
? options.integrity
: void 0,
nonce:
"string" === typeof options.nonce ? options.nonce : void 0
});
} else null == options && Internals.d.M(href);
};
exports.preload = function (href, options) {
var encountered = "";
("string" === typeof href && href) ||
(encountered +=
" The `href` argument encountered was " +
getValueDescriptorExpectingObjectForWarning(href) +
".");
null == options || "object" !== typeof options
? (encountered +=
" The `options` argument encountered was " +
getValueDescriptorExpectingObjectForWarning(options) +
".")
: ("string" === typeof options.as && options.as) ||
(encountered +=
" The `as` option encountered was " +
getValueDescriptorExpectingObjectForWarning(options.as) +
".");
encountered &&
console.error(
'ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',
encountered
);
if (
"string" === typeof href &&
"object" === typeof options &&
null !== options &&
"string" === typeof options.as
) {
encountered = options.as;
var crossOrigin = getCrossOriginStringAs(
encountered,
options.crossOrigin
);
Internals.d.L(href, encountered, {
crossOrigin: crossOrigin,
integrity: typeof options.integrity === 'string' ? options.integrity : undefined,
nonce: typeof options.nonce === 'string' ? options.nonce : undefined
integrity:
"string" === typeof options.integrity ? options.integrity : void 0,
nonce: "string" === typeof options.nonce ? options.nonce : void 0,
type: "string" === typeof options.type ? options.type : void 0,
fetchPriority:
"string" === typeof options.fetchPriority
? options.fetchPriority
: void 0,
referrerPolicy:
"string" === typeof options.referrerPolicy
? options.referrerPolicy
: void 0,
imageSrcSet:
"string" === typeof options.imageSrcSet
? options.imageSrcSet
: void 0,
imageSizes:
"string" === typeof options.imageSizes
? options.imageSizes
: void 0,
media: "string" === typeof options.media ? options.media : void 0
});
}
} else if (options == null) {
ReactDOMCurrentDispatcher.current.preinitModuleScript(href);
}
} // We don't error because preinit needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function getValueDescriptorExpectingObjectForWarning(thing) {
return thing === null ? '`null`' : thing === undefined ? '`undefined`' : thing === '' ? 'an empty string' : "something with type \"" + typeof thing + "\"";
}
function getValueDescriptorExpectingEnumForWarning(thing) {
return thing === null ? '`null`' : thing === undefined ? '`undefined`' : thing === '' ? 'an empty string' : typeof thing === 'string' ? JSON.stringify(thing) : typeof thing === 'number' ? '`' + thing + '`' : "something with type \"" + typeof thing + "\"";
}
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.preconnect = preconnect;
exports.prefetchDNS = prefetchDNS;
exports.preinit = preinit;
exports.preinitModule = preinitModule;
exports.preload = preload;
exports.preloadModule = preloadModule;
};
exports.preloadModule = function (href, options) {
var encountered = "";
("string" === typeof href && href) ||
(encountered +=
" The `href` argument encountered was " +
getValueDescriptorExpectingObjectForWarning(href) +
".");
void 0 !== options && "object" !== typeof options
? (encountered +=
" The `options` argument encountered was " +
getValueDescriptorExpectingObjectForWarning(options) +
".")
: options &&
"as" in options &&
"string" !== typeof options.as &&
(encountered +=
" The `as` option encountered was " +
getValueDescriptorExpectingObjectForWarning(options.as) +
".");
encountered &&
console.error(
'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',
encountered
);
"string" === typeof href &&
(options
? ((encountered = getCrossOriginStringAs(
options.as,
options.crossOrigin
)),
Internals.d.m(href, {
as:
"string" === typeof options.as && "script" !== options.as
? options.as
: void 0,
crossOrigin: encountered,
integrity:
"string" === typeof options.integrity
? options.integrity
: void 0
}))
: Internals.d.m(href));
};
exports.version = "19.0.0-experimental-eb3ad065-20240822";
})();
}
/**
* @license React
* react-dom.react-server.production.min.js
* react-dom.react-server.production.js
*

@@ -11,155 +11,143 @@ * Copyright (c) Meta Platforms, Inc. and affiliates.

'use strict';
"use strict";
var React = require("react");
function noop() {}
const DefaultDispatcher = {
prefetchDNS: noop,
preconnect: noop,
preload: noop,
preloadModule: noop,
preinitScript: noop,
preinitStyle: noop,
preinitModuleScript: noop
var Internals = {
d: {
f: noop,
r: function () {
throw Error(
"Invalid form element. requestFormReset must be passed a form that was rendered by React."
);
},
D: noop,
C: noop,
L: noop,
m: noop,
X: noop,
S: noop,
M: noop
},
p: 0,
findDOMNode: null
};
const Internals = {
usingClientEntryPoint: false,
Events: null,
ReactDOMCurrentDispatcher: {
current: DefaultDispatcher
if (!React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)
throw Error(
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
);
function getCrossOriginStringAs(as, input) {
if ("font" === as) return "";
if ("string" === typeof input)
return "use-credentials" === input ? input : "";
}
exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
Internals;
exports.preconnect = function (href, options) {
"string" === typeof href &&
(options
? ((options = options.crossOrigin),
(options =
"string" === typeof options
? "use-credentials" === options
? options
: ""
: void 0))
: (options = null),
Internals.d.C(href, options));
};
exports.prefetchDNS = function (href) {
"string" === typeof href && Internals.d.D(href);
};
exports.preinit = function (href, options) {
if ("string" === typeof href && options && "string" === typeof options.as) {
var as = options.as,
crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),
integrity =
"string" === typeof options.integrity ? options.integrity : void 0,
fetchPriority =
"string" === typeof options.fetchPriority
? options.fetchPriority
: void 0;
"style" === as
? Internals.d.S(
href,
"string" === typeof options.precedence ? options.precedence : void 0,
{
crossOrigin: crossOrigin,
integrity: integrity,
fetchPriority: fetchPriority
}
)
: "script" === as &&
Internals.d.X(href, {
crossOrigin: crossOrigin,
integrity: integrity,
fetchPriority: fetchPriority,
nonce: "string" === typeof options.nonce ? options.nonce : void 0
});
}
};
function getCrossOriginString(input) {
if (typeof input === 'string') {
return input === 'use-credentials' ? input : '';
exports.preinitModule = function (href, options) {
if ("string" === typeof href)
if ("object" === typeof options && null !== options) {
if (null == options.as || "script" === options.as) {
var crossOrigin = getCrossOriginStringAs(
options.as,
options.crossOrigin
);
Internals.d.M(href, {
crossOrigin: crossOrigin,
integrity:
"string" === typeof options.integrity ? options.integrity : void 0,
nonce: "string" === typeof options.nonce ? options.nonce : void 0
});
}
} else null == options && Internals.d.M(href);
};
exports.preload = function (href, options) {
if (
"string" === typeof href &&
"object" === typeof options &&
null !== options &&
"string" === typeof options.as
) {
var as = options.as,
crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
Internals.d.L(href, as, {
crossOrigin: crossOrigin,
integrity:
"string" === typeof options.integrity ? options.integrity : void 0,
nonce: "string" === typeof options.nonce ? options.nonce : void 0,
type: "string" === typeof options.type ? options.type : void 0,
fetchPriority:
"string" === typeof options.fetchPriority
? options.fetchPriority
: void 0,
referrerPolicy:
"string" === typeof options.referrerPolicy
? options.referrerPolicy
: void 0,
imageSrcSet:
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
imageSizes:
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
media: "string" === typeof options.media ? options.media : void 0
});
}
return undefined;
}
function getCrossOriginStringAs(as, input) {
if (as === 'font') {
return '';
}
if (typeof input === 'string') {
return input === 'use-credentials' ? input : '';
}
return undefined;
}
const ReactDOMCurrentDispatcher = Internals.ReactDOMCurrentDispatcher;
function prefetchDNS(href) {
if (typeof href === 'string') {
ReactDOMCurrentDispatcher.current.prefetchDNS(href);
} // We don't error because preconnect needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preconnect(href, options) {
if (typeof href === 'string') {
const crossOrigin = options ? getCrossOriginString(options.crossOrigin) : null;
ReactDOMCurrentDispatcher.current.preconnect(href, crossOrigin);
} // We don't error because preconnect needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preload(href, options) {
if (typeof href === 'string' && // We check existence because we cannot enforce this function is actually called with the stated type
typeof options === 'object' && options !== null && typeof options.as === 'string') {
const as = options.as;
const crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
ReactDOMCurrentDispatcher.current.preload(href, as, {
crossOrigin,
integrity: typeof options.integrity === 'string' ? options.integrity : undefined,
nonce: typeof options.nonce === 'string' ? options.nonce : undefined,
type: typeof options.type === 'string' ? options.type : undefined,
fetchPriority: typeof options.fetchPriority === 'string' ? options.fetchPriority : undefined,
referrerPolicy: typeof options.referrerPolicy === 'string' ? options.referrerPolicy : undefined,
imageSrcSet: typeof options.imageSrcSet === 'string' ? options.imageSrcSet : undefined,
imageSizes: typeof options.imageSizes === 'string' ? options.imageSizes : undefined
});
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preloadModule(href, options) {
if (typeof href === 'string') {
};
exports.preloadModule = function (href, options) {
if ("string" === typeof href)
if (options) {
const crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
ReactDOMCurrentDispatcher.current.preloadModule(href, {
as: typeof options.as === 'string' && options.as !== 'script' ? options.as : undefined,
crossOrigin,
integrity: typeof options.integrity === 'string' ? options.integrity : undefined
var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
Internals.d.m(href, {
as:
"string" === typeof options.as && "script" !== options.as
? options.as
: void 0,
crossOrigin: crossOrigin,
integrity:
"string" === typeof options.integrity ? options.integrity : void 0
});
} else {
ReactDOMCurrentDispatcher.current.preloadModule(href);
}
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preinit(href, options) {
if (typeof href === 'string' && options && typeof options.as === 'string') {
const as = options.as;
const crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
const integrity = typeof options.integrity === 'string' ? options.integrity : undefined;
const fetchPriority = typeof options.fetchPriority === 'string' ? options.fetchPriority : undefined;
if (as === 'style') {
ReactDOMCurrentDispatcher.current.preinitStyle(href, typeof options.precedence === 'string' ? options.precedence : undefined, {
crossOrigin,
integrity,
fetchPriority
});
} else if (as === 'script') {
ReactDOMCurrentDispatcher.current.preinitScript(href, {
crossOrigin,
integrity,
fetchPriority,
nonce: typeof options.nonce === 'string' ? options.nonce : undefined
});
}
} // We don't error because preinit needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
function preinitModule(href, options) {
if (typeof href === 'string') {
if (typeof options === 'object' && options !== null) {
if (options.as == null || options.as === 'script') {
const crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
ReactDOMCurrentDispatcher.current.preinitModuleScript(href, {
crossOrigin,
integrity: typeof options.integrity === 'string' ? options.integrity : undefined,
nonce: typeof options.nonce === 'string' ? options.nonce : undefined
});
}
} else if (options == null) {
ReactDOMCurrentDispatcher.current.preinitModuleScript(href);
}
} // We don't error because preinit needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
}
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
exports.preconnect = preconnect;
exports.prefetchDNS = prefetchDNS;
exports.preinit = preinit;
exports.preinitModule = preinitModule;
exports.preload = preload;
exports.preloadModule = preloadModule;
} else Internals.d.m(href);
};
exports.version = "19.0.0-experimental-eb3ad065-20240822";
'use strict';
var m = require('react-dom');
function checkDCE() {
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'
) {
return;
}
if (process.env.NODE_ENV !== 'production') {
// This branch is unreachable because this function is only called
// in production, but the condition is true only in development.
// Therefore if the branch is still here, dead code elimination wasn't
// properly applied.
// Don't change the message. React DevTools relies on it. Also make sure
// this message doesn't occur elsewhere in this function, or it will cause
// a false positive.
throw new Error('^_^');
}
try {
// Verify that the code above has been dead code eliminated (DCE'd).
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
} catch (err) {
// DevTools shouldn't crash React, no matter what.
// We should still report in case we break this code.
console.error(err);
}
}
if (process.env.NODE_ENV === 'production') {
exports.createRoot = m.createRoot;
exports.hydrateRoot = m.hydrateRoot;
// DCE check should happen before ReactDOM bundle executes so that
// DevTools can report bad minification during injection.
checkDCE();
module.exports = require('./cjs/react-dom-client.production.js');
} else {
var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
exports.createRoot = function (c, o) {
i.usingClientEntryPoint = true;
try {
return m.createRoot(c, o);
} finally {
i.usingClientEntryPoint = false;
}
};
exports.hydrateRoot = function (c, h, o) {
i.usingClientEntryPoint = true;
try {
return m.hydrateRoot(c, h, o);
} finally {
i.usingClientEntryPoint = false;
}
};
module.exports = require('./cjs/react-dom-client.development.js');
}

@@ -35,5 +35,5 @@ 'use strict';

checkDCE();
module.exports = require('./cjs/react-dom.production.min.js');
module.exports = require('./cjs/react-dom.production.js');
} else {
module.exports = require('./cjs/react-dom.development.js');
}
{
"name": "react-dom",
"version": "0.0.0-experimental-eb33bd747-20240312",
"version": "0.0.0-experimental-eb3ad065-20240822",
"description": "React package for working with the DOM.",

@@ -20,6 +20,6 @@ "main": "index.js",

"dependencies": {
"scheduler": "0.0.0-experimental-eb33bd747-20240312"
"scheduler": "0.0.0-experimental-eb3ad065-20240822"
},
"peerDependencies": {
"react": "0.0.0-experimental-eb33bd747-20240312"
"react": "0.0.0-experimental-eb3ad065-20240822"
},

@@ -29,21 +29,24 @@ "files": [

"README.md",
"client.js",
"client.react-server.js",
"index.js",
"client.js",
"profiling.js",
"server.js",
"profiling.react-server.js",
"react-dom.react-server.js",
"server.browser.js",
"server.bun.js",
"server.edge.js",
"server.js",
"server.node.js",
"server.bun.js",
"static.js",
"server.react-server.js",
"static.browser.js",
"static.edge.js",
"static.js",
"static.node.js",
"server-rendering-stub.js",
"static.react-server.js",
"test-utils.js",
"unstable_testing.js",
"unstable_testing.react-server.js",
"unstable_server-external-runtime.js",
"react-dom.react-server.js",
"cjs/",
"umd/"
"cjs/"
],

@@ -55,4 +58,8 @@ "exports": {

},
"./client": "./client.js",
"./client": {
"react-server": "./client.react-server.js",
"default": "./client.js"
},
"./server": {
"react-server": "./server.react-server.js",
"workerd": "./server.edge.js",

@@ -62,27 +69,54 @@ "bun": "./server.bun.js",

"worker": "./server.browser.js",
"browser": "./server.browser.js",
"node": "./server.node.js",
"edge-light": "./server.edge.js",
"browser": "./server.browser.js",
"default": "./server.node.js"
},
"./server.browser": "./server.browser.js",
"./server.bun": "./server.bun.js",
"./server.edge": "./server.edge.js",
"./server.node": "./server.node.js",
"./server.browser": {
"react-server": "./server.react-server.js",
"default": "./server.browser.js"
},
"./server.bun": {
"react-server": "./server.react-server.js",
"default": "./server.bun.js"
},
"./server.edge": {
"react-server": "./server.react-server.js",
"default": "./server.edge.js"
},
"./server.node": {
"react-server": "./server.react-server.js",
"default": "./server.node.js"
},
"./static": {
"react-server": "./static.react-server.js",
"workerd": "./static.edge.js",
"deno": "./static.browser.js",
"worker": "./static.browser.js",
"browser": "./static.browser.js",
"node": "./static.node.js",
"edge-light": "./static.edge.js",
"browser": "./static.browser.js",
"default": "./static.node.js"
},
"./static.browser": "./static.browser.js",
"./static.edge": "./static.edge.js",
"./static.node": "./static.node.js",
"./server-rendering-stub": "./server-rendering-stub.js",
"./profiling": "./profiling.js",
"./static.browser": {
"react-server": "./static.react-server.js",
"default": "./static.browser.js"
},
"./static.edge": {
"react-server": "./static.react-server.js",
"default": "./static.edge.js"
},
"./static.node": {
"react-server": "./static.react-server.js",
"default": "./static.node.js"
},
"./profiling": {
"react-server": "./profiling.react-server.js",
"default": "./profiling.js"
},
"./test-utils": "./test-utils.js",
"./unstable_testing": "./unstable_testing.js",
"./unstable_testing": {
"react-server": "./unstable_testing.react-server.js",
"default": "./unstable_testing.js"
},
"./unstable_server-external-runtime": "./unstable_server-external-runtime.js",

@@ -89,0 +123,0 @@ "./package.json": "./package.json"

@@ -35,5 +35,5 @@ 'use strict';

checkDCE();
module.exports = require('./cjs/react-dom.profiling.min.js');
module.exports = require('./cjs/react-dom-profiling.profiling.js');
} else {
module.exports = require('./cjs/react-dom.development.js');
module.exports = require('./cjs/react-dom-profiling.development.js');
}
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-dom.react-server.production.min.js');
module.exports = require('./cjs/react-dom.react-server.production.js');
} else {
module.exports = require('./cjs/react-dom.react-server.development.js');
}

@@ -5,4 +5,4 @@ 'use strict';

if (process.env.NODE_ENV === 'production') {
l = require('./cjs/react-dom-server-legacy.browser.production.min.js');
s = require('./cjs/react-dom-server.browser.production.min.js');
l = require('./cjs/react-dom-server-legacy.browser.production.js');
s = require('./cjs/react-dom-server.browser.production.js');
} else {

@@ -16,4 +16,2 @@ l = require('./cjs/react-dom-server-legacy.browser.development.js');

exports.renderToStaticMarkup = l.renderToStaticMarkup;
exports.renderToNodeStream = l.renderToNodeStream;
exports.renderToStaticNodeStream = l.renderToStaticNodeStream;
exports.renderToReadableStream = s.renderToReadableStream;

@@ -20,0 +18,0 @@ if (s.resume) {

@@ -6,4 +6,4 @@ 'use strict';

if (process.env.NODE_ENV === 'production') {
b = require('./cjs/react-dom-server.bun.production.min.js');
l = require('./cjs/react-dom-server-legacy.browser.production.min.js');
b = require('./cjs/react-dom-server.bun.production.js');
l = require('./cjs/react-dom-server-legacy.browser.production.js');
} else {

@@ -19,5 +19,3 @@ b = require('./cjs/react-dom-server.bun.development.js');

}
exports.renderToNodeStream = b.renderToNodeStream;
exports.renderToStaticNodeStream = b.renderToStaticNodeStream;
exports.renderToString = l.renderToString;
exports.renderToStaticMarkup = l.renderToStaticMarkup;

@@ -6,4 +6,4 @@ 'use strict';

if (process.env.NODE_ENV === 'production') {
b = require('./cjs/react-dom-server.edge.production.min.js');
l = require('./cjs/react-dom-server-legacy.browser.production.min.js');
b = require('./cjs/react-dom-server.edge.production.js');
l = require('./cjs/react-dom-server-legacy.browser.production.js');
} else {

@@ -16,4 +16,2 @@ b = require('./cjs/react-dom-server.edge.development.js');

exports.renderToReadableStream = b.renderToReadableStream;
exports.renderToNodeStream = b.renderToNodeStream;
exports.renderToStaticNodeStream = b.renderToStaticNodeStream;
exports.renderToString = l.renderToString;

@@ -20,0 +18,0 @@ exports.renderToStaticMarkup = l.renderToStaticMarkup;

@@ -5,4 +5,4 @@ 'use strict';

if (process.env.NODE_ENV === 'production') {
l = require('./cjs/react-dom-server-legacy.node.production.min.js');
s = require('./cjs/react-dom-server.node.production.min.js');
l = require('./cjs/react-dom-server-legacy.node.production.js');
s = require('./cjs/react-dom-server.node.production.js');
} else {

@@ -16,4 +16,2 @@ l = require('./cjs/react-dom-server-legacy.node.development.js');

exports.renderToStaticMarkup = l.renderToStaticMarkup;
exports.renderToNodeStream = l.renderToNodeStream;
exports.renderToStaticNodeStream = l.renderToStaticNodeStream;
exports.renderToPipeableStream = s.renderToPipeableStream;

@@ -20,0 +18,0 @@ if (s.resumeToPipeableStream) {

@@ -5,3 +5,3 @@ 'use strict';

if (process.env.NODE_ENV === 'production') {
s = require('./cjs/react-dom-server.browser.production.min.js');
s = require('./cjs/react-dom-server.browser.production.js');
} else {

@@ -8,0 +8,0 @@ s = require('./cjs/react-dom-server.browser.development.js');

@@ -5,3 +5,3 @@ 'use strict';

if (process.env.NODE_ENV === 'production') {
s = require('./cjs/react-dom-server.edge.production.min.js');
s = require('./cjs/react-dom-server.edge.production.js');
} else {

@@ -8,0 +8,0 @@ s = require('./cjs/react-dom-server.edge.development.js');

@@ -5,3 +5,3 @@ 'use strict';

if (process.env.NODE_ENV === 'production') {
s = require('./cjs/react-dom-server.node.production.min.js');
s = require('./cjs/react-dom-server.node.production.js');
} else {

@@ -8,0 +8,0 @@ s = require('./cjs/react-dom-server.node.development.js');

'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-dom-test-utils.production.min.js');
module.exports = require('./cjs/react-dom-test-utils.production.js');
} else {
module.exports = require('./cjs/react-dom-test-utils.development.js');
}

@@ -1,7 +0,236 @@

(function(){function p(b,a,d){a=document.getElementById(a);a.parentNode.removeChild(a);var c=document.getElementById(b);if(c){b=c.previousSibling;if(d)b.data="$!",c.setAttribute("data-dgst",d);else{d=b.parentNode;c=b.nextSibling;var f=0;do{if(c&&8===c.nodeType){var e=c.data;if("/$"===e)if(0===f)break;else f--;else"$"!==e&&"$?"!==e&&"$!"!==e||f++}e=c.nextSibling;d.removeChild(c);c=e}while(c);for(;a.firstChild;)d.insertBefore(a.firstChild,c);b.data="$"}b._reactRetry&&b._reactRetry()}}function B(b,a,
d){for(var c=new Map,f=document,e,h,q=f.querySelectorAll("link[data-precedence],style[data-precedence]"),w=[],r=0;h=q[r++];)"not all"===h.getAttribute("media")?w.push(h):("LINK"===h.tagName&&v.set(h.getAttribute("href"),h),c.set(h.dataset.precedence,e=h));h=0;q=[];var t,g;for(r=!0;;){if(r){var n=d[h++];if(!n){r=!1;h=0;continue}var k=!1,u=0;var l=n[u++];if(g=v.get(l)){var m=g._p;k=!0}else{g=f.createElement("link");g.href=l;g.rel="stylesheet";for(g.dataset.precedence=t=n[u++];m=n[u++];)g.setAttribute(m,
n[u++]);m=g._p=new Promise(function(C,D){g.onload=C;g.onerror=D});v.set(l,g)}l=g.getAttribute("media");!m||"l"===m.s||l&&!window.matchMedia(l).matches||q.push(m);if(k)continue}else{g=w[h++];if(!g)break;t=g.getAttribute("data-precedence");g.removeAttribute("media")}k=c.get(t)||e;k===e&&(e=g);c.set(t,g);k?k.parentNode.insertBefore(g,k.nextSibling):(k=f.head,k.insertBefore(g,k.firstChild))}Promise.all(q).then(p.bind(null,b,a,""),p.bind(null,b,a,"Resource failed to load"))}function x(b){b=b.querySelectorAll("template");
for(var a=0;a<b.length;a++)y(b[a])}function z(b){function a(c){for(var f=0;f<c.length;f++)for(var e=c[f].addedNodes,h=0;h<e.length;h++)e[h].parentNode&&y(e[h])}var d=new MutationObserver(a);d.observe(b,{childList:!0});window.addEventListener("DOMContentLoaded",function(){a(d.takeRecords());d.disconnect()})}function y(b){if(1===b.nodeType&&b.dataset){var a=b.dataset;if(null!=a.rxi){var d=a.dgst,c=a.msg,f=a.stck,e=document.getElementById(a.bid);e&&(a=e.previousSibling,a.data="$!",e=e.dataset,d&&(e.dgst=
d),c&&(e.msg=c),f&&(e.stck=f),a._reactRetry&&a._reactRetry());b.remove()}else if(null!=a.rri)B(a.bid,a.sid,JSON.parse(a.sty)),b.remove();else if(null!=a.rci)p(a.bid,a.sid),b.remove();else if(null!=a.rsi){d=a.pid;c=document.getElementById(a.sid);d=document.getElementById(d);for(c.parentNode.removeChild(c);c.firstChild;)d.parentNode.insertBefore(c.firstChild,d);d.parentNode.removeChild(d);b.remove()}}}var v=new Map;(function(){addEventListener("submit",function(b){if(!b.defaultPrevented){var a=b.target,
d=b.submitter,c=a.action,f=d;if(d){var e=d.getAttribute("formAction");null!=e&&(c=e,f=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===c&&(b.preventDefault(),f?(b=document.createElement("input"),b.name=f.name,b.value=f.value,f.parentNode.insertBefore(b,f),f=new FormData(a),b.parentNode.removeChild(b)):f=new FormData(a),b=a.ownerDocument||a,(b.$$reactFormReplay=b.$$reactFormReplay||[]).push(a,d,f))}})})();window.$RC||(window.$RC=p,window.$RM=new Map);if(null!=document.body)"loading"===
document.readyState&&z(document.body),x(document.body);else{var A=new MutationObserver(function(){null!=document.body&&("loading"===document.readyState&&z(document.body),x(document.body),A.disconnect())});A.observe(document.documentElement,{childList:!0})}})();
(function () {
function completeBoundary(suspenseBoundaryID, contentID, errorDigest) {
contentID = document.getElementById(contentID);
contentID.parentNode.removeChild(contentID);
var suspenseIdNode = document.getElementById(suspenseBoundaryID);
if (suspenseIdNode) {
suspenseBoundaryID = suspenseIdNode.previousSibling;
if (errorDigest)
(suspenseBoundaryID.data = "$!"),
suspenseIdNode.setAttribute("data-dgst", errorDigest);
else {
errorDigest = suspenseBoundaryID.parentNode;
suspenseIdNode = suspenseBoundaryID.nextSibling;
var depth = 0;
do {
if (suspenseIdNode && 8 === suspenseIdNode.nodeType) {
var data = suspenseIdNode.data;
if ("/$" === data)
if (0 === depth) break;
else depth--;
else ("$" !== data && "$?" !== data && "$!" !== data) || depth++;
}
data = suspenseIdNode.nextSibling;
errorDigest.removeChild(suspenseIdNode);
suspenseIdNode = data;
} while (suspenseIdNode);
for (; contentID.firstChild; )
errorDigest.insertBefore(contentID.firstChild, suspenseIdNode);
suspenseBoundaryID.data = "$";
}
suspenseBoundaryID._reactRetry && suspenseBoundaryID._reactRetry();
}
}
function completeBoundaryWithStyles(
suspenseBoundaryID,
contentID,
stylesheetDescriptors
) {
function cleanupWith(cb) {
this._p = null;
cb();
}
for (
var precedences = new Map(),
thisDocument = document,
lastResource,
node,
nodes = thisDocument.querySelectorAll(
"link[data-precedence],style[data-precedence]"
),
styleTagsToHoist = [],
i$0 = 0;
(node = nodes[i$0++]);
)
"not all" === node.getAttribute("media")
? styleTagsToHoist.push(node)
: ("LINK" === node.tagName &&
resourceMap.set(node.getAttribute("href"), node),
precedences.set(node.dataset.precedence, (lastResource = node)));
node = 0;
nodes = [];
var precedence, resourceEl;
for (i$0 = !0; ; ) {
if (i$0) {
var stylesheetDescriptor = stylesheetDescriptors[node++];
if (!stylesheetDescriptor) {
i$0 = !1;
node = 0;
continue;
}
var avoidInsert = !1,
j = 0;
var href = stylesheetDescriptor[j++];
if ((resourceEl = resourceMap.get(href))) {
var attr = resourceEl._p;
avoidInsert = !0;
} else {
resourceEl = thisDocument.createElement("link");
resourceEl.href = href;
resourceEl.rel = "stylesheet";
for (
resourceEl.dataset.precedence = precedence =
stylesheetDescriptor[j++];
(attr = stylesheetDescriptor[j++]);
)
resourceEl.setAttribute(attr, stylesheetDescriptor[j++]);
attr = resourceEl._p = new Promise(function (resolve, reject) {
resourceEl.onload = cleanupWith.bind(resourceEl, resolve);
resourceEl.onerror = cleanupWith.bind(resourceEl, reject);
});
resourceMap.set(href, resourceEl);
}
href = resourceEl.getAttribute("media");
!attr || (href && !window.matchMedia(href).matches) || nodes.push(attr);
if (avoidInsert) continue;
} else {
resourceEl = styleTagsToHoist[node++];
if (!resourceEl) break;
precedence = resourceEl.getAttribute("data-precedence");
resourceEl.removeAttribute("media");
}
avoidInsert = precedences.get(precedence) || lastResource;
avoidInsert === lastResource && (lastResource = resourceEl);
precedences.set(precedence, resourceEl);
avoidInsert
? avoidInsert.parentNode.insertBefore(
resourceEl,
avoidInsert.nextSibling
)
: ((avoidInsert = thisDocument.head),
avoidInsert.insertBefore(resourceEl, avoidInsert.firstChild));
}
Promise.all(nodes).then(
completeBoundary.bind(null, suspenseBoundaryID, contentID, ""),
completeBoundary.bind(
null,
suspenseBoundaryID,
contentID,
"Resource failed to load"
)
);
}
function handleExistingNodes(target) {
target = target.querySelectorAll("template");
for (var i = 0; i < target.length; i++) handleNode(target[i]);
}
function installFizzInstrObserver(target) {
function handleMutations(mutations) {
for (var i = 0; i < mutations.length; i++)
for (
var addedNodes = mutations[i].addedNodes, j = 0;
j < addedNodes.length;
j++
)
addedNodes[j].parentNode && handleNode(addedNodes[j]);
}
var fizzInstrObserver = new MutationObserver(handleMutations);
fizzInstrObserver.observe(target, { childList: !0 });
window.addEventListener("DOMContentLoaded", function () {
handleMutations(fizzInstrObserver.takeRecords());
fizzInstrObserver.disconnect();
});
}
function handleNode(node_) {
if (1 === node_.nodeType && node_.dataset) {
var dataset = node_.dataset;
if (null != dataset.rxi) {
var errorDigest = dataset.dgst,
errorMsg = dataset.msg,
errorStack = dataset.stck,
errorComponentStack = dataset.cstck,
suspenseIdNode = document.getElementById(dataset.bid);
suspenseIdNode &&
((dataset = suspenseIdNode.previousSibling),
(dataset.data = "$!"),
(suspenseIdNode = suspenseIdNode.dataset),
errorDigest && (suspenseIdNode.dgst = errorDigest),
errorMsg && (suspenseIdNode.msg = errorMsg),
errorStack && (suspenseIdNode.stck = errorStack),
errorComponentStack && (suspenseIdNode.cstck = errorComponentStack),
dataset._reactRetry && dataset._reactRetry());
node_.remove();
} else if (null != dataset.rri)
completeBoundaryWithStyles(
dataset.bid,
dataset.sid,
JSON.parse(dataset.sty)
),
node_.remove();
else if (null != dataset.rci)
completeBoundary(dataset.bid, dataset.sid), node_.remove();
else if (null != dataset.rsi) {
errorDigest = dataset.pid;
errorMsg = document.getElementById(dataset.sid);
errorDigest = document.getElementById(errorDigest);
for (errorMsg.parentNode.removeChild(errorMsg); errorMsg.firstChild; )
errorDigest.parentNode.insertBefore(errorMsg.firstChild, errorDigest);
errorDigest.parentNode.removeChild(errorDigest);
node_.remove();
}
}
}
var resourceMap = new Map();
(function () {
addEventListener("submit", function (event) {
if (!event.defaultPrevented) {
var form = event.target,
submitter = event.submitter,
action = form.action,
formDataSubmitter = submitter;
if (submitter) {
var submitterAction = submitter.getAttribute("formAction");
null != submitterAction &&
((action = submitterAction), (formDataSubmitter = null));
}
"javascript:throw new Error('React form unexpectedly submitted.')" ===
action &&
(event.preventDefault(),
formDataSubmitter
? ((event = document.createElement("input")),
(event.name = formDataSubmitter.name),
(event.value = formDataSubmitter.value),
formDataSubmitter.parentNode.insertBefore(
event,
formDataSubmitter
),
(formDataSubmitter = new FormData(form)),
event.parentNode.removeChild(event))
: (formDataSubmitter = new FormData(form)),
(event = form.ownerDocument || form),
(event.$$reactFormReplay = event.$$reactFormReplay || []).push(
form,
submitter,
formDataSubmitter
));
}
});
})();
window.$RC || ((window.$RC = completeBoundary), (window.$RM = new Map()));
if (null != document.body)
"loading" === document.readyState &&
installFizzInstrObserver(document.body),
handleExistingNodes(document.body);
else {
var domBodyObserver = new MutationObserver(function () {
null != document.body &&
("loading" === document.readyState &&
installFizzInstrObserver(document.body),
handleExistingNodes(document.body),
domBodyObserver.disconnect());
});
domBodyObserver.observe(document.documentElement, { childList: !0 });
}
})();

@@ -35,5 +35,5 @@ 'use strict';

checkDCE();
module.exports = require('./cjs/react-dom-unstable_testing.production.min.js');
module.exports = require('./cjs/react-dom-unstable_testing.production.js');
} else {
module.exports = require('./cjs/react-dom-unstable_testing.development.js');
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc