From 63c766e21bcaa5fdafbcada5acdbd38eb69c8e0f Mon Sep 17 00:00:00 2001 From: poteto Date: Mon, 12 Dec 2022 17:48:11 +0000 Subject: [PATCH] Revert "Fork ReactDOMSharedInternals for www (#25791)" (#25864) We did some cleanup internally of our ReactDOM module, so this fork should be safe to remove now. Will land this only after our internal diff lands. DiffTrain build for [9c09c1cd62ef862df91bcb4df4271917629d6963](https://github.com/facebook/react/commit/9c09c1cd62ef862df91bcb4df4271917629d6963) [View git log for this commit](https://github.com/facebook/react/commits/9c09c1cd62ef862df91bcb4df4271917629d6963) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/REVISION_TRANSFORMS | 2 +- compiled/facebook-www/React-dev.classic.js | 2 +- compiled/facebook-www/React-dev.modern.js | 2 +- compiled/facebook-www/React-prod.classic.js | 2 +- compiled/facebook-www/React-prod.modern.js | 2 +- .../facebook-www/React-profiling.classic.js | 2 +- .../facebook-www/React-profiling.modern.js | 2 +- compiled/facebook-www/ReactART-dev.classic.js | 2 +- compiled/facebook-www/ReactART-dev.modern.js | 2 +- .../facebook-www/ReactART-prod.classic.js | 4 +- compiled/facebook-www/ReactART-prod.modern.js | 4 +- compiled/facebook-www/ReactDOM-dev.classic.js | 2 +- compiled/facebook-www/ReactDOM-dev.modern.js | 2 +- .../facebook-www/ReactDOM-prod.classic.js | 6 +- compiled/facebook-www/ReactDOM-prod.modern.js | 6 +- .../ReactDOM-profiling.classic.js | 6 +- .../facebook-www/ReactDOM-profiling.modern.js | 6 +- .../ReactDOMForked-dev.classic.js | 2 +- .../facebook-www/ReactDOMForked-dev.modern.js | 2 +- .../ReactDOMForked-prod.classic.js | 6 +- .../ReactDOMForked-prod.modern.js | 6 +- .../ReactDOMForked-profiling.classic.js | 6 +- .../ReactDOMForked-profiling.modern.js | 6 +- .../ReactDOMServer-dev.classic.js | 6 +- .../facebook-www/ReactDOMServer-dev.modern.js | 6 +- .../ReactDOMServer-prod.classic.js | 9 +- .../ReactDOMServer-prod.modern.js | 9 +- .../ReactDOMServerStreaming-dev.modern.js | 4 +- .../ReactDOMServerStreaming-prod.modern.js | 7 +- .../ReactDOMTesting-dev.classic.js | 16182 ++++++++-------- .../ReactDOMTesting-dev.modern.js | 8 +- .../ReactDOMTesting-prod.classic.js | 6974 ++++--- .../ReactDOMTesting-prod.modern.js | 16 +- .../ReactFlightDOMRelayServer-dev.classic.js | 4 +- .../ReactFlightDOMRelayServer-dev.modern.js | 4 +- .../ReactFlightDOMRelayServer-prod.classic.js | 5 +- .../ReactFlightDOMRelayServer-prod.modern.js | 5 +- .../ReactTestRenderer-dev.classic.js | 2 +- .../ReactTestRenderer-dev.modern.js | 2 +- 40 files changed, 11653 insertions(+), 11674 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 40a68e4f05..40fbc64921 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -996e4c0d56dabab382ca932cd5b8517e63020999 +9c09c1cd62ef862df91bcb4df4271917629d6963 diff --git a/compiled/facebook-www/REVISION_TRANSFORMS b/compiled/facebook-www/REVISION_TRANSFORMS index 40a68e4f05..40fbc64921 100644 --- a/compiled/facebook-www/REVISION_TRANSFORMS +++ b/compiled/facebook-www/REVISION_TRANSFORMS @@ -1 +1 @@ -996e4c0d56dabab382ca932cd5b8517e63020999 +9c09c1cd62ef862df91bcb4df4271917629d6963 diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index edd3cc7ee5..80cbe2ed22 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-classic-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-classic-9c09c1cd6-20221212"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index e8f4c81861..db3c2dc2a4 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-modern-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-modern-9c09c1cd6-20221212"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/React-prod.classic.js b/compiled/facebook-www/React-prod.classic.js index a6b85c03d3..7663e3e5d1 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -643,4 +643,4 @@ exports.useSyncExternalStore = function( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-996e4c0d5-20221212"; +exports.version = "18.3.0-www-classic-9c09c1cd6-20221212"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index 15cd5e8522..acea5a1c7e 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -635,4 +635,4 @@ exports.useSyncExternalStore = function( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-modern-996e4c0d5-20221212"; +exports.version = "18.3.0-www-modern-9c09c1cd6-20221212"; diff --git a/compiled/facebook-www/React-profiling.classic.js b/compiled/facebook-www/React-profiling.classic.js index ff9c189594..1ac554eefd 100644 --- a/compiled/facebook-www/React-profiling.classic.js +++ b/compiled/facebook-www/React-profiling.classic.js @@ -654,7 +654,7 @@ exports.useSyncExternalStore = function( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-996e4c0d5-20221212"; +exports.version = "18.3.0-www-classic-9c09c1cd6-20221212"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index 136e16a1fe..ad5a6eb01f 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -646,7 +646,7 @@ exports.useSyncExternalStore = function( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-modern-996e4c0d5-20221212"; +exports.version = "18.3.0-www-modern-9c09c1cd6-20221212"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index ea8aec39d5..57768ee704 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-classic-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-classic-9c09c1cd6-20221212"; var LegacyRoot = 0; var ConcurrentRoot = 1; diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index 8a78a32e3e..4138b6c22e 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-modern-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-modern-9c09c1cd6-20221212"; var LegacyRoot = 0; var ConcurrentRoot = 1; diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index 536e3ac6b5..4ead11de3e 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -9807,7 +9807,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-classic-996e4c0d5-20221212", + version: "18.3.0-www-classic-9c09c1cd6-20221212", rendererPackageName: "react-art" }; var internals$jscomp$inline_1338 = { @@ -9838,7 +9838,7 @@ var internals$jscomp$inline_1338 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1339 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index 4f4924a85c..676386c415 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -9474,7 +9474,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-modern-996e4c0d5-20221212", + version: "18.3.0-www-modern-9c09c1cd6-20221212", rendererPackageName: "react-art" }; var internals$jscomp$inline_1329 = { @@ -9505,7 +9505,7 @@ var internals$jscomp$inline_1329 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1330 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index 08fa3d1d6c..902025fe99 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -42565,7 +42565,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-classic-9c09c1cd6-20221212"; function createPortal( children, diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index b189199ac7..44ec222e5c 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -42289,7 +42289,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-modern-9c09c1cd6-20221212"; function createPortal( children, diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index 1efaa879dd..f1e184f3bb 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -15557,7 +15557,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1770 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-996e4c0d5-20221212", + version: "18.3.0-www-classic-9c09c1cd6-20221212", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2157 = { @@ -15587,7 +15587,7 @@ var internals$jscomp$inline_2157 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2158 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15829,4 +15829,4 @@ exports.unstable_renderSubtreeIntoContainer = function( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-996e4c0d5-20221212"; +exports.version = "18.3.0-next-9c09c1cd6-20221212"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index 95a2d95e64..883bad84b4 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -15118,7 +15118,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1738 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-996e4c0d5-20221212", + version: "18.3.0-www-modern-9c09c1cd6-20221212", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2132 = { @@ -15149,7 +15149,7 @@ var internals$jscomp$inline_2132 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2133 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15337,4 +15337,4 @@ exports.unstable_flushControlled = function(fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-996e4c0d5-20221212"; +exports.version = "18.3.0-next-9c09c1cd6-20221212"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index d6fec4b6ea..840c9021d7 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -16327,7 +16327,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1844 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-996e4c0d5-20221212", + version: "18.3.0-www-classic-9c09c1cd6-20221212", rendererPackageName: "react-dom" }; (function(internals) { @@ -16371,7 +16371,7 @@ var devToolsConfig$jscomp$inline_1844 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -16600,7 +16600,7 @@ exports.unstable_renderSubtreeIntoContainer = function( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-996e4c0d5-20221212"; +exports.version = "18.3.0-next-9c09c1cd6-20221212"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index ba08b083d0..c2d68c3cbb 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -15878,7 +15878,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1812 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-996e4c0d5-20221212", + version: "18.3.0-www-modern-9c09c1cd6-20221212", rendererPackageName: "react-dom" }; (function(internals) { @@ -15923,7 +15923,7 @@ var devToolsConfig$jscomp$inline_1812 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function(children, container) { @@ -16098,7 +16098,7 @@ exports.unstable_flushControlled = function(fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-996e4c0d5-20221212"; +exports.version = "18.3.0-next-9c09c1cd6-20221212"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMForked-dev.classic.js b/compiled/facebook-www/ReactDOMForked-dev.classic.js index 08fa3d1d6c..902025fe99 100644 --- a/compiled/facebook-www/ReactDOMForked-dev.classic.js +++ b/compiled/facebook-www/ReactDOMForked-dev.classic.js @@ -42565,7 +42565,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-classic-9c09c1cd6-20221212"; function createPortal( children, diff --git a/compiled/facebook-www/ReactDOMForked-dev.modern.js b/compiled/facebook-www/ReactDOMForked-dev.modern.js index b189199ac7..44ec222e5c 100644 --- a/compiled/facebook-www/ReactDOMForked-dev.modern.js +++ b/compiled/facebook-www/ReactDOMForked-dev.modern.js @@ -42289,7 +42289,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-modern-9c09c1cd6-20221212"; function createPortal( children, diff --git a/compiled/facebook-www/ReactDOMForked-prod.classic.js b/compiled/facebook-www/ReactDOMForked-prod.classic.js index 1efaa879dd..f1e184f3bb 100644 --- a/compiled/facebook-www/ReactDOMForked-prod.classic.js +++ b/compiled/facebook-www/ReactDOMForked-prod.classic.js @@ -15557,7 +15557,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1770 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-996e4c0d5-20221212", + version: "18.3.0-www-classic-9c09c1cd6-20221212", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2157 = { @@ -15587,7 +15587,7 @@ var internals$jscomp$inline_2157 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2158 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15829,4 +15829,4 @@ exports.unstable_renderSubtreeIntoContainer = function( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-996e4c0d5-20221212"; +exports.version = "18.3.0-next-9c09c1cd6-20221212"; diff --git a/compiled/facebook-www/ReactDOMForked-prod.modern.js b/compiled/facebook-www/ReactDOMForked-prod.modern.js index 95a2d95e64..883bad84b4 100644 --- a/compiled/facebook-www/ReactDOMForked-prod.modern.js +++ b/compiled/facebook-www/ReactDOMForked-prod.modern.js @@ -15118,7 +15118,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1738 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-996e4c0d5-20221212", + version: "18.3.0-www-modern-9c09c1cd6-20221212", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2132 = { @@ -15149,7 +15149,7 @@ var internals$jscomp$inline_2132 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2133 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15337,4 +15337,4 @@ exports.unstable_flushControlled = function(fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-996e4c0d5-20221212"; +exports.version = "18.3.0-next-9c09c1cd6-20221212"; diff --git a/compiled/facebook-www/ReactDOMForked-profiling.classic.js b/compiled/facebook-www/ReactDOMForked-profiling.classic.js index d6fec4b6ea..840c9021d7 100644 --- a/compiled/facebook-www/ReactDOMForked-profiling.classic.js +++ b/compiled/facebook-www/ReactDOMForked-profiling.classic.js @@ -16327,7 +16327,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1844 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-996e4c0d5-20221212", + version: "18.3.0-www-classic-9c09c1cd6-20221212", rendererPackageName: "react-dom" }; (function(internals) { @@ -16371,7 +16371,7 @@ var devToolsConfig$jscomp$inline_1844 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -16600,7 +16600,7 @@ exports.unstable_renderSubtreeIntoContainer = function( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-996e4c0d5-20221212"; +exports.version = "18.3.0-next-9c09c1cd6-20221212"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMForked-profiling.modern.js b/compiled/facebook-www/ReactDOMForked-profiling.modern.js index ba08b083d0..c2d68c3cbb 100644 --- a/compiled/facebook-www/ReactDOMForked-profiling.modern.js +++ b/compiled/facebook-www/ReactDOMForked-profiling.modern.js @@ -15878,7 +15878,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1812 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-996e4c0d5-20221212", + version: "18.3.0-www-modern-9c09c1cd6-20221212", rendererPackageName: "react-dom" }; (function(internals) { @@ -15923,7 +15923,7 @@ var devToolsConfig$jscomp$inline_1812 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-996e4c0d5-20221212" + reconcilerVersion: "18.3.0-next-9c09c1cd6-20221212" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function(children, container) { @@ -16098,7 +16098,7 @@ exports.unstable_flushControlled = function(fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-996e4c0d5-20221212"; +exports.version = "18.3.0-next-9c09c1cd6-20221212"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index f2d796fd17..7bf470e3ac 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.classic.js +++ b/compiled/facebook-www/ReactDOMServer-dev.classic.js @@ -17,8 +17,9 @@ if (__DEV__) { "use strict"; var React = require("react"); +var ReactDOM = require("react-dom"); -var ReactVersion = "18.3.0-www-classic-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-classic-9c09c1cd6-20221212"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -3609,9 +3610,6 @@ var completeBoundaryWithStyles = var completeSegment = "$RS=function(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};"; -// $FlowIgnore[cannot-resolve-module] provided by www -var ReactDOM = require("ReactDOMComet"); - var ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index 924b52eeb1..b4e741541d 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServer-dev.modern.js @@ -17,8 +17,9 @@ if (__DEV__) { "use strict"; var React = require("react"); +var ReactDOM = require("react-dom"); -var ReactVersion = "18.3.0-www-modern-996e4c0d5-20221212"; +var ReactVersion = "18.3.0-www-modern-9c09c1cd6-20221212"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -3613,9 +3614,6 @@ var completeBoundaryWithStyles = var completeSegment = "$RS=function(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};"; -// $FlowIgnore[cannot-resolve-module] provided by www -var ReactDOM = require("ReactDOMComet"); - var ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; diff --git a/compiled/facebook-www/ReactDOMServer-prod.classic.js b/compiled/facebook-www/ReactDOMServer-prod.classic.js index 5dba8238bd..3f4b51a2c5 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -11,7 +11,8 @@ */ "use strict"; -var React = require("react"); +var React = require("react"), + ReactDOM = require("react-dom"); function formatProdErrorMessage(code) { for ( var url = "https://reactjs.org/docs/error-decoder.html?invariant=" + code, @@ -640,8 +641,8 @@ function hoistResourcesToRoot(resources, boundaryResources) { }); boundaryResources.clear(); } -var ReactDOMCurrentDispatcher = require("ReactDOMComet") - .__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher; +var ReactDOMCurrentDispatcher = + ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher; function createFormatContext(insertionMode, selectedValue, noscriptTagInScope) { return { insertionMode: insertionMode, @@ -3632,4 +3633,4 @@ exports.renderToString = function(children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "18.3.0-www-classic-996e4c0d5-20221212"; +exports.version = "18.3.0-www-classic-9c09c1cd6-20221212"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index 87de2dad05..35134b014d 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -11,7 +11,8 @@ */ "use strict"; -var React = require("react"); +var React = require("react"), + ReactDOM = require("react-dom"); function formatProdErrorMessage(code) { for ( var url = "https://reactjs.org/docs/error-decoder.html?invariant=" + code, @@ -640,8 +641,8 @@ function hoistResourcesToRoot(resources, boundaryResources) { }); boundaryResources.clear(); } -var ReactDOMCurrentDispatcher = require("ReactDOMComet") - .__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher; +var ReactDOMCurrentDispatcher = + ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher; function createFormatContext(insertionMode, selectedValue, noscriptTagInScope) { return { insertionMode: insertionMode, @@ -3545,4 +3546,4 @@ exports.renderToString = function(children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "18.3.0-www-modern-996e4c0d5-20221212"; +exports.version = "18.3.0-www-modern-9c09c1cd6-20221212"; diff --git a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js index a2e7c6e115..c48a4e5b47 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js @@ -17,6 +17,7 @@ if (__DEV__) { "use strict"; var React = require("react"); +var ReactDOM = require("react-dom"); // This refers to a WWW module. var warningWWW = require("warning"); @@ -3610,9 +3611,6 @@ var completeBoundaryWithStyles = var completeSegment = "$RS=function(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};"; -// $FlowIgnore[cannot-resolve-module] provided by www -var ReactDOM = require("ReactDOMComet"); - var ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; diff --git a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js index e9a7e6b101..ab8fc5864e 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-prod.modern.js @@ -11,7 +11,8 @@ */ "use strict"; -var React = require("react"); +var React = require("react"), + ReactDOM = require("react-dom"); function writeChunk(destination, chunk) { destination.buffer += chunk; } @@ -640,8 +641,8 @@ function hoistResourcesToRoot(resources, boundaryResources) { }); boundaryResources.clear(); } -var ReactDOMCurrentDispatcher = require("ReactDOMComet") - .__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher, +var ReactDOMCurrentDispatcher = + ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher, scriptRegex = /(<\/|<)(s)(cript)/gi; function scriptReplacer(match, prefix, s, suffix) { return "" + prefix + ("s" === s ? "\\u0073" : "\\u0053") + suffix; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index cdfe7f75e7..51b3d43fa7 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -8442,8042 +8442,6 @@ function lanesToEventPriority(lanes) { return IdleEventPriority; } -// $FlowIgnore[cannot-resolve-module] provided by www -var ReactDOM = require("ReactDOMComet"); - -var ReactDOMSharedInternals = - ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -function warnOnMissingHrefAndRel(pendingProps, currentProps) { - { - if (currentProps != null) { - var originalResourceName = - typeof currentProps.href === "string" - ? 'Resource with href "' + currentProps.href + '"' - : "Resource"; - var originalRelStatement = getValueDescriptorExpectingEnumForWarning( - currentProps.rel - ); - var pendingRel = getValueDescriptorExpectingEnumForWarning( - pendingProps.rel - ); - var pendingHref = getValueDescriptorExpectingEnumForWarning( - pendingProps.href - ); - - if (typeof pendingProps.rel !== "string") { - error( - 'A previously rendered as a %s with rel "%s" but was updated with an invalid rel: %s. When a link' + - " does not have a valid rel prop it is not represented in the DOM. If this is intentional, instead" + - " do not render the anymore.", - originalResourceName, - originalRelStatement, - pendingRel - ); - } else if (typeof pendingProps.href !== "string") { - error( - "A previously rendered as a %s but was updated with an invalid href prop: %s. When a link" + - " does not have a valid href prop it is not represented in the DOM. If this is intentional, instead" + - " do not render the anymore.", - originalResourceName, - pendingHref - ); - } - } else { - var _pendingRel = getValueDescriptorExpectingEnumForWarning( - pendingProps.rel - ); - - var _pendingHref = getValueDescriptorExpectingEnumForWarning( - pendingProps.href - ); - - if (typeof pendingProps.rel !== "string") { - error( - "A is rendering with an invalid rel: %s. When a link" + - " does not have a valid rel prop it is not represented in the DOM. If this is intentional, instead" + - " do not render the anymore.", - _pendingRel - ); - } else if (typeof pendingProps.href !== "string") { - error( - "A is rendering with an invalid href: %s. When a link" + - " does not have a valid href prop it is not represented in the DOM. If this is intentional, instead" + - " do not render the anymore.", - _pendingHref - ); - } - } - } -} -function validatePreloadResourceDifference( - originalProps, - originalImplicit, - latestProps, - latestImplicit -) { - { - var href = originalProps.href; - var originalWarningName = getResourceNameForWarning( - "preload", - originalProps, - originalImplicit - ); - var latestWarningName = getResourceNameForWarning( - "preload", - latestProps, - latestImplicit - ); - - if (latestProps.as !== originalProps.as) { - error( - 'A %s is using the same href "%s" as a %s. This is always an error and React will only keep the first preload' + - " for any given href, discarding subsequent instances. To fix, find where you are using this href in link" + - " tags or in calls to ReactDOM.preload() or ReactDOM.preinit() and either make the Resource types agree or" + - " update the hrefs to be distinct for different Resource types.", - latestWarningName, - href, - originalWarningName - ); - } else { - var missingProps = null; - var extraProps = null; - var differentProps = null; - - if (originalProps.media != null && latestProps.media == null) { - missingProps = missingProps || {}; - missingProps.media = originalProps.media; - } - - for (var propName in latestProps) { - var propValue = latestProps[propName]; - var originalValue = originalProps[propName]; - - if (propValue != null && propValue !== originalValue) { - if (originalValue == null) { - extraProps = extraProps || {}; - extraProps[propName] = propValue; - } else { - differentProps = differentProps || {}; - differentProps[propName] = { - original: originalValue, - latest: propValue - }; - } - } - } - - if (missingProps || extraProps || differentProps) { - warnDifferentProps( - href, - "href", - originalWarningName, - latestWarningName, - extraProps, - missingProps, - differentProps - ); - } - } - } -} -function validateStyleResourceDifference(originalProps, latestProps) { - { - var href = originalProps.href; // eslint-disable-next-line no-labels - - var originalWarningName = getResourceNameForWarning( - "style", - originalProps, - false - ); - var latestWarningName = getResourceNameForWarning( - "style", - latestProps, - false - ); - var missingProps = null; - var extraProps = null; - var differentProps = null; - - if (originalProps.media != null && latestProps.media == null) { - missingProps = missingProps || {}; - missingProps.media = originalProps.media; - } - - for (var propName in latestProps) { - var propValue = latestProps[propName]; - var originalValue = originalProps[propName]; - - if (propValue != null && propValue !== originalValue) { - propName = propName === "data-precedence" ? "precedence" : propName; - - if (originalValue == null) { - extraProps = extraProps || {}; - extraProps[propName] = propValue; - } else { - differentProps = differentProps || {}; - differentProps[propName] = { - original: originalValue, - latest: propValue - }; - } - } - } - - if (missingProps || extraProps || differentProps) { - warnDifferentProps( - href, - "href", - originalWarningName, - latestWarningName, - extraProps, - missingProps, - differentProps - ); - } - } -} -function validateScriptResourceDifference(originalProps, latestProps) { - { - var src = originalProps.src; // eslint-disable-next-line no-labels - - var originalWarningName = getResourceNameForWarning( - "script", - originalProps, - false - ); - var latestWarningName = getResourceNameForWarning( - "script", - latestProps, - false - ); - var extraProps = null; - var differentProps = null; - - for (var propName in latestProps) { - var propValue = latestProps[propName]; - var originalValue = originalProps[propName]; - - if (propValue != null && propValue !== originalValue) { - if (originalValue == null) { - extraProps = extraProps || {}; - extraProps[propName] = propValue; - } else { - differentProps = differentProps || {}; - differentProps[propName] = { - original: originalValue, - latest: propValue - }; - } - } - } - - if (extraProps || differentProps) { - warnDifferentProps( - src, - "src", - originalWarningName, - latestWarningName, - extraProps, - null, - differentProps - ); - } - } -} - -function warnDifferentProps( - url, - urlPropKey, - originalName, - latestName, - extraProps, - missingProps, - differentProps -) { - { - var juxtaposedNameStatement = - latestName === originalName - ? "an earlier instance of this Resource" - : "a " + originalName + " with the same " + urlPropKey; - var comparisonStatement = ""; - - if (missingProps !== null && typeof missingProps === "object") { - for (var propName in missingProps) { - comparisonStatement += - "\n " + - propName + - ': missing or null in latest props, "' + - missingProps[propName] + - '" in original props'; - } - } - - if (extraProps !== null && typeof extraProps === "object") { - for (var _propName in extraProps) { - comparisonStatement += - "\n " + - _propName + - ': "' + - extraProps[_propName] + - '" in latest props, missing or null in original props'; - } - } - - if (differentProps !== null && typeof differentProps === "object") { - for (var _propName2 in differentProps) { - comparisonStatement += - "\n " + - _propName2 + - ': "' + - differentProps[_propName2].latest + - '" in latest props, "' + - differentProps[_propName2].original + - '" in original props'; - } - } - - error( - 'A %s with %s "%s" has props that disagree with those found on %s. Resources always use the props' + - " that were provided the first time they are encountered so any differences will be ignored. Please" + - " update Resources that share an %s to have props that agree. The differences are described below.%s", - latestName, - urlPropKey, - url, - juxtaposedNameStatement, - urlPropKey, - comparisonStatement - ); - } -} - -function getResourceNameForWarning(type, props, implicit) { - { - switch (type) { - case "style": { - return "style Resource"; - } - - case "script": { - return "script Resource"; - } - - case "preload": { - if (implicit) { - return "preload for a " + props.as + " Resource"; - } - - return 'preload Resource (as "' + props.as + '")'; - } - } - } - - return "Resource"; -} - -function validateURLKeyedUpdatedProps( - pendingProps, - currentProps, - resourceType, - urlPropKey -) { - { - // This function should never be called if we don't have /srcs so we don't bother considering - // Whether they are null or undefined - if (pendingProps[urlPropKey] === currentProps[urlPropKey]) { - // If we have the same href/src we need all other props to be the same - var missingProps; - var extraProps; - var differentProps; - var allProps = Array.from( - new Set(Object.keys(currentProps).concat(Object.keys(pendingProps))) - ); - - for (var i = 0; i < allProps.length; i++) { - var propName = allProps[i]; - var pendingValue = pendingProps[propName]; - var currentValue = currentProps[propName]; - - if ( - pendingValue !== currentValue && - !(pendingValue == null && currentValue == null) - ) { - if (pendingValue == null) { - missingProps = missingProps || {}; - missingProps[propName] = currentValue; - } else if (currentValue == null) { - extraProps = extraProps || {}; - extraProps[propName] = pendingValue; - } else { - differentProps = differentProps || {}; - differentProps[propName] = { - original: currentValue, - latest: pendingValue - }; - } - } - } - - if (missingProps || extraProps || differentProps) { - var latestWarningName = getResourceNameForWarning( - resourceType, - currentProps, - false - ); - var comparisonStatement = ""; - - if (missingProps !== null && typeof missingProps === "object") { - for (var _propName3 in missingProps) { - comparisonStatement += - "\n " + - _propName3 + - ': missing or null in latest props, "' + - missingProps[_propName3] + - '" in original props'; - } - } - - if (extraProps !== null && typeof extraProps === "object") { - for (var _propName4 in extraProps) { - comparisonStatement += - "\n " + - _propName4 + - ': "' + - extraProps[_propName4] + - '" in latest props, missing or null in original props'; - } - } - - if (differentProps !== null && typeof differentProps === "object") { - for (var _propName5 in differentProps) { - comparisonStatement += - "\n " + - _propName5 + - ': "' + - differentProps[_propName5].latest + - '" in latest props, "' + - differentProps[_propName5].original + - '" in original props'; - } - } - - error( - 'A %s with %s "%s" received new props with different values from the props used' + - " when this Resource was first rendered. React will only use the props provided when" + - " this resource was first rendered until a new %s is provided. Unlike conventional" + - " DOM elements, Resources instances do not have a one to one correspondence with Elements" + - " in the DOM and as such, every instance of a Resource for a single Resource identifier" + - " (%s) must have props that agree with each other. The differences are described below.%s", - latestWarningName, - urlPropKey, - currentProps[urlPropKey], - urlPropKey, - urlPropKey, - comparisonStatement - ); - - return true; - } - } - } - - return false; -} -function validateLinkPropsForStyleResource(props) { - { - // This should only be called when we know we are opting into Resource semantics (i.e. precedence is not null) - var href = props.href, - onLoad = props.onLoad, - onError = props.onError, - disabled = props.disabled; - var allProps = ["onLoad", "onError", "disabled"]; - var includedProps = []; - if (onLoad) includedProps.push("onLoad"); - if (onError) includedProps.push("onError"); - if (disabled != null) includedProps.push("disabled"); - var allPropsUnionPhrase = propNamesListJoin(allProps, "or"); - var includedPropsPhrase = propNamesListJoin(includedProps, "and"); - includedPropsPhrase += includedProps.length === 1 ? " prop" : " props"; - - if (includedProps.length) { - error( - 'A link (rel="stylesheet") element with href "%s" has the precedence prop but also included the %s.' + - " When using %s React will opt out of Resource behavior. If you meant for this" + - " element to be treated as a Resource remove the %s. Otherwise remove the precedence prop.", - href, - includedPropsPhrase, - allPropsUnionPhrase, - includedPropsPhrase - ); - - return true; - } - } - - return false; -} - -function propNamesListJoin(list, combinator) { - switch (list.length) { - case 0: - return ""; - - case 1: - return list[0]; - - case 2: - return list[0] + " " + combinator + " " + list[1]; - - default: - return ( - list.slice(0, -1).join(", ") + - ", " + - combinator + - " " + - list[list.length - 1] - ); - } -} - -function validateLinkPropsForPreloadResource(linkProps) { - { - var href = linkProps.href, - as = linkProps.as; - - if (as === "font") { - var name = getResourceNameForWarning("preload", linkProps, false); - - if (!hasOwnProperty.call(linkProps, "crossOrigin")) { - error( - 'A %s with href "%s" did not specify the crossOrigin prop. Font preloads must always use' + - ' anonymouse CORS mode. To fix add an empty string, "anonymous", or any other string' + - ' value except "use-credentials" for the crossOrigin prop of all font preloads.', - name, - href - ); - } else if (linkProps.crossOrigin === "use-credentials") { - error( - 'A %s with href "%s" specified a crossOrigin value of "use-credentials". Font preloads must always use' + - ' anonymouse CORS mode. To fix use an empty string, "anonymous", or any other string' + - ' value except "use-credentials" for the crossOrigin prop of all font preloads.', - name, - href - ); - } - } - } -} -function validatePreloadArguments(href, options) { - { - if (!href || typeof href !== "string") { - var typeOfArg = getValueDescriptorExpectingObjectForWarning(href); - - error( - "ReactDOM.preload() expected the first argument to be a string representing an href but found %s instead.", - typeOfArg - ); - } else if (typeof options !== "object" || options === null) { - var _typeOfArg = getValueDescriptorExpectingObjectForWarning(options); - - error( - 'ReactDOM.preload() expected the second argument to be an options argument containing at least an "as" property' + - ' specifying the Resource type. It found %s instead. The href for the preload call where this warning originated is "%s".', - _typeOfArg, - href - ); - } else { - var as = options.as; - - switch (as) { - // Font specific validation of options - case "font": { - if (options.crossOrigin === "use-credentials") { - error( - 'ReactDOM.preload() was called with an "as" type of "font" and with a "crossOrigin" option of "use-credentials".' + - ' Fonts preloading must use crossOrigin "anonymous" to be functional. Please update your font preload to omit' + - ' the crossOrigin option or change it to any other value than "use-credentials" (Browsers default all other values' + - ' to anonymous mode). The href for the preload call where this warning originated is "%s"', - href - ); - } - - break; - } - - case "script": - case "style": { - break; - } - // We have an invalid as type and need to warn - - default: { - var typeOfAs = getValueDescriptorExpectingEnumForWarning(as); - - error( - 'ReactDOM.preload() expected a valid "as" type in the options (second) argument but found %s instead.' + - " Please use one of the following valid values instead: %s. The href for the preload call where this" + - ' warning originated is "%s".', - typeOfAs, - '"style", "font", or "script"', - href - ); - } - } - } - } -} -function validatePreinitArguments(href, options) { - { - if (!href || typeof href !== "string") { - var typeOfArg = getValueDescriptorExpectingObjectForWarning(href); - - error( - "ReactDOM.preinit() expected the first argument to be a string representing an href but found %s instead.", - typeOfArg - ); - } else if (typeof options !== "object" || options === null) { - var _typeOfArg2 = getValueDescriptorExpectingObjectForWarning(options); - - error( - 'ReactDOM.preinit() expected the second argument to be an options argument containing at least an "as" property' + - ' specifying the Resource type. It found %s instead. The href for the preload call where this warning originated is "%s".', - _typeOfArg2, - href - ); - } else { - var as = options.as; - - switch (as) { - case "style": - case "script": { - break; - } - // We have an invalid as type and need to warn - - default: { - var typeOfAs = getValueDescriptorExpectingEnumForWarning(as); - - error( - 'ReactDOM.preinit() expected the second argument to be an options argument containing at least an "as" property' + - ' specifying the Resource type. It found %s instead. Currently, valid resource types for for preinit are "style"' + - ' and "script". The href for the preinit call where this warning originated is "%s".', - typeOfAs, - href - ); - } - } - } - } -} - -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) - : 'something with type "' + typeof thing + '"'; -} - -var valueStack = []; -var fiberStack; - -{ - fiberStack = []; -} - -var index = -1; - -function createCursor(defaultValue) { - return { - current: defaultValue - }; -} - -function pop(cursor, fiber) { - if (index < 0) { - { - error("Unexpected pop."); - } - - return; - } - - { - if (fiber !== fiberStack[index]) { - error("Unexpected Fiber popped."); - } - } - - cursor.current = valueStack[index]; - valueStack[index] = null; - - { - fiberStack[index] = null; - } - - index--; -} - -function push(cursor, value, fiber) { - index++; - valueStack[index] = cursor.current; - - { - fiberStack[index] = fiber; - } - - cursor.current = value; -} - -var contextStackCursor = createCursor(null); -var contextFiberStackCursor = createCursor(null); -var rootInstanceStackCursor = createCursor(null); - -function requiredContext(c) { - { - if (c === null) { - error( - "Expected host context to exist. This error is likely caused by a bug " + - "in React. Please file an issue." - ); - } - } - - return c; -} - -function getCurrentRootHostContainer() { - return rootInstanceStackCursor.current; -} - -function getRootHostContainer() { - var rootInstance = requiredContext(rootInstanceStackCursor.current); - return rootInstance; -} - -function pushHostContainer(fiber, nextRootInstance) { - // Push current root instance onto the stack; - // This allows us to reset root when portals are popped. - push(rootInstanceStackCursor, nextRootInstance, fiber); // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - - push(contextFiberStackCursor, fiber, fiber); // Finally, we need to push the host context to the stack. - // However, we can't just call getRootHostContext() and push it because - // we'd have a different number of entries on the stack depending on - // whether getRootHostContext() throws somewhere in renderer code or not. - // So we push an empty value first. This lets us safely unwind on errors. - - push(contextStackCursor, null, fiber); - var nextRootContext = getRootHostContext(nextRootInstance); // Now that we know this function doesn't throw, replace it. - - pop(contextStackCursor, fiber); - push(contextStackCursor, nextRootContext, fiber); -} - -function popHostContainer(fiber) { - pop(contextStackCursor, fiber); - pop(contextFiberStackCursor, fiber); - pop(rootInstanceStackCursor, fiber); -} - -function getHostContext() { - var context = requiredContext(contextStackCursor.current); - return context; -} - -function pushHostContext(fiber) { - var context = requiredContext(contextStackCursor.current); - var nextContext = getChildHostContext(context, fiber.type); // Don't push this Fiber's context unless it's unique. - - if (context === nextContext) { - return; - } // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - - push(contextFiberStackCursor, fiber, fiber); - push(contextStackCursor, nextContext, fiber); -} - -function popHostContext(fiber) { - // Do not pop unless this Fiber provided the current context. - // pushHostContext() only pushes Fibers that provide unique contexts. - if (contextFiberStackCursor.current !== fiber) { - return; - } - - pop(contextStackCursor, fiber); - pop(contextFiberStackCursor, fiber); -} - -var Dispatcher = ReactDOMSharedInternals.Dispatcher; -// In the future this may need to change, especially when modules / scripts are supported - -// It is valid to preload even when we aren't actively rendering. For cases where Float functions are -// called when there is no rendering we track the last used document. It is not safe to insert -// arbitrary resources into the lastCurrentDocument b/c it may not actually be the document -// that the resource is meant to apply too (for example stylesheets or scripts). This is only -// appropriate for resources that don't really have a strict tie to the document itself for example -// preloads -var lastCurrentDocument = null; -var previousDispatcher = null; -function prepareToRenderResources(rootContainer) { - var rootNode = getRootNode(rootContainer); - lastCurrentDocument = getDocumentFromRoot(rootNode); - previousDispatcher = Dispatcher.current; - Dispatcher.current = ReactDOMClientDispatcher; -} -function cleanupAfterRenderResources() { - Dispatcher.current = previousDispatcher; - previousDispatcher = null; -} // We want this to be the default dispatcher on ReactDOMSharedInternals but we don't want to mutate -// internals in Module scope. Instead we export it and Internals will import it. There is already a cycle -// from Internals -> ReactDOM -> FloatClient -> Internals so this doesn't introduce a new one. - -var ReactDOMClientDispatcher = { - preload: preload, - preinit: preinit -}; -// global maps of Resources -var preloadResources = new Map(); // getRootNode is missing from IE and old jsdom versions - -function getRootNode(container) { - // $FlowFixMe[method-unbinding] - return typeof container.getRootNode === "function" - ? /* $FlowFixMe[incompatible-return] Flow types this as returning a `Node`, - * but it's either a `Document` or `ShadowRoot`. */ - container.getRootNode() - : container.ownerDocument; -} - -function getCurrentResourceRoot() { - var currentContainer = getCurrentRootHostContainer(); // $FlowFixMe flow should know currentContainer is a Node and has getRootNode - - return currentContainer ? getRootNode(currentContainer) : null; -} // This resource type constraint can be loosened. It really is everything except PreloadResource -// because that is the only one that does not have an optional instance type. Expand as needed. - -function resetInstance(resource) { - resource.instance = undefined; -} - -function clearRootResources(rootContainer) { - var rootNode = getRootNode(rootContainer); - var resources = getResourcesFromRoot(rootNode); // We can't actually delete the resource cache because this function is called - // during commit after we have rendered. Instead we detatch any instances from - // the Resource object if they are going to be cleared - // Styles stay put - // Scripts get reset - - resources.scripts.forEach(resetInstance); // Head Resources get reset - - resources.head.forEach(resetInstance); // lastStructuredMeta stays put -} // Preloads are somewhat special. Even if we don't have the Document -// used by the root that is rendering a component trying to insert a preload -// we can still seed the file cache by doing the preload on any document we have -// access to. We prefer the currentDocument if it exists, we also prefer the -// lastCurrentDocument if that exists. As a fallback we will use the window.document -// if available. - -function getDocumentForPreloads() { - var root = getCurrentResourceRoot(); - - if (root) { - return root.ownerDocument || root; - } else { - try { - return lastCurrentDocument || window.document; - } catch (error) { - return null; - } - } -} - -function getDocumentFromRoot(root) { - return root.ownerDocument || root; -} // -------------------------------------- -// ReactDOM.Preload -// -------------------------------------- - -function preload(href, options) { - { - validatePreloadArguments(href, options); - } - - var ownerDocument = getDocumentForPreloads(); - - if ( - typeof href === "string" && - href && - typeof options === "object" && - options !== null && - ownerDocument - ) { - var as = options.as; - var resource = preloadResources.get(href); - - if (resource) { - { - var originallyImplicit = resource._dev_implicit_construction === true; - var latestProps = preloadPropsFromPreloadOptions(href, as, options); - validatePreloadResourceDifference( - resource.props, - originallyImplicit, - latestProps, - false - ); - } - } else { - var resourceProps = preloadPropsFromPreloadOptions(href, as, options); - createPreloadResource(ownerDocument, href, resourceProps); - } - } -} - -function preloadPropsFromPreloadOptions(href, as, options) { - return { - href: href, - rel: "preload", - as: as, - crossOrigin: as === "font" ? "" : options.crossOrigin, - integrity: options.integrity - }; -} // -------------------------------------- -// ReactDOM.preinit -// -------------------------------------- - -function preinit(href, options) { - { - validatePreinitArguments(href, options); - } - - if ( - typeof href === "string" && - href && - typeof options === "object" && - options !== null - ) { - var resourceRoot = getCurrentResourceRoot(); - var as = options.as; - - if (!resourceRoot) { - // We are going to emit a preload as a best effort fallback since this preinit - // was called outside of a render. Given the passive nature of this fallback - // we do not warn in dev when props disagree if there happens to already be a - // matching preload with this href - var preloadDocument = getDocumentForPreloads(); - - if (preloadDocument) { - var preloadResource = preloadResources.get(href); - - if (!preloadResource) { - var preloadProps = preloadPropsFromPreinitOptions(href, as, options); - createPreloadResource(preloadDocument, href, preloadProps); - } - } - - return; - } - - switch (as) { - case "style": { - var styleResources = getResourcesFromRoot(resourceRoot).styles; - var precedence = options.precedence || "default"; - var resource = styleResources.get(href); - - if (resource) { - { - var latestProps = stylePropsFromPreinitOptions( - href, - precedence, - options - ); - validateStyleResourceDifference(resource.props, latestProps); - } - } else { - var resourceProps = stylePropsFromPreinitOptions( - href, - precedence, - options - ); - resource = createStyleResource( - styleResources, - resourceRoot, - href, - precedence, - resourceProps - ); - } - - acquireResource(resource); - return; - } - - case "script": { - var src = href; - var scriptResources = getResourcesFromRoot(resourceRoot).scripts; - - var _resource = scriptResources.get(src); - - if (_resource) { - { - var _latestProps = scriptPropsFromPreinitOptions(src, options); - - validateScriptResourceDifference(_resource.props, _latestProps); - } - } else { - var _resourceProps = scriptPropsFromPreinitOptions(src, options); - - _resource = createScriptResource( - scriptResources, - resourceRoot, - src, - _resourceProps - ); - } - - acquireResource(_resource); - return; - } - } - } -} - -function preloadPropsFromPreinitOptions(href, as, options) { - return { - href: href, - rel: "preload", - as: as, - crossOrigin: as === "font" ? "" : options.crossOrigin, - integrity: options.integrity - }; -} - -function stylePropsFromPreinitOptions(href, precedence, options) { - return { - rel: "stylesheet", - href: href, - "data-precedence": precedence, - crossOrigin: options.crossOrigin - }; -} - -function scriptPropsFromPreinitOptions(src, options) { - return { - src: src, - async: true, - crossOrigin: options.crossOrigin, - integrity: options.integrity - }; -} // -------------------------------------- -// Resources from render -// -------------------------------------- - -function getTitleKey(child) { - return "title:" + child; -} // This function is called in begin work and we should always have a currentDocument set - -function getResource(type, pendingProps, currentProps) { - var resourceRoot = getCurrentResourceRoot(); - - if (!resourceRoot) { - throw new Error( - '"resourceRoot" was expected to exist. This is a bug in React.' - ); - } - - switch (type) { - case "base": { - var headRoot = getDocumentFromRoot(resourceRoot); - var headResources = getResourcesFromRoot(headRoot).head; - var target = pendingProps.target, - href = pendingProps.href; - var matcher = "base"; - matcher += - typeof href === "string" - ? '[href="' + - escapeSelectorAttributeValueInsideDoubleQuotes(href) + - '"]' - : ":not([href])"; - matcher += - typeof target === "string" - ? '[target="' + - escapeSelectorAttributeValueInsideDoubleQuotes(target) + - '"]' - : ":not([target])"; - var resource = headResources.get(matcher); - - if (!resource) { - resource = { - type: "base", - matcher: matcher, - props: assign({}, pendingProps), - count: 0, - instance: null, - root: headRoot - }; - headResources.set(matcher, resource); - } - - return resource; - } - - case "meta": { - var _matcher, propertyString, parentResource; - - var charSet = pendingProps.charSet, - content = pendingProps.content, - httpEquiv = pendingProps.httpEquiv, - name = pendingProps.name, - itemProp = pendingProps.itemProp, - property = pendingProps.property; - - var _headRoot = getDocumentFromRoot(resourceRoot); - - var _getResourcesFromRoot = getResourcesFromRoot(_headRoot), - _headResources = _getResourcesFromRoot.head, - lastStructuredMeta = _getResourcesFromRoot.lastStructuredMeta; - - if (typeof charSet === "string") { - _matcher = "meta[charset]"; - } else if (typeof content === "string") { - if (typeof httpEquiv === "string") { - _matcher = - 'meta[http-equiv="' + - escapeSelectorAttributeValueInsideDoubleQuotes(httpEquiv) + - '"][content="' + - escapeSelectorAttributeValueInsideDoubleQuotes(content) + - '"]'; - } else if (typeof property === "string") { - propertyString = property; - _matcher = - 'meta[property="' + - escapeSelectorAttributeValueInsideDoubleQuotes(property) + - '"][content="' + - escapeSelectorAttributeValueInsideDoubleQuotes(content) + - '"]'; - var parentPropertyPath = property - .split(":") - .slice(0, -1) - .join(":"); - parentResource = lastStructuredMeta.get(parentPropertyPath); - - if (parentResource) { - // When using parentResource the matcher is not functional for locating - // the instance in the DOM but it still serves as a unique key. - _matcher = parentResource.matcher + _matcher; - } - } else if (typeof name === "string") { - _matcher = - 'meta[name="' + - escapeSelectorAttributeValueInsideDoubleQuotes(name) + - '"][content="' + - escapeSelectorAttributeValueInsideDoubleQuotes(content) + - '"]'; - } else if (typeof itemProp === "string") { - _matcher = - 'meta[itemprop="' + - escapeSelectorAttributeValueInsideDoubleQuotes(itemProp) + - '"][content="' + - escapeSelectorAttributeValueInsideDoubleQuotes(content) + - '"]'; - } - } - - if (_matcher) { - var _resource2 = _headResources.get(_matcher); - - if (!_resource2) { - _resource2 = { - type: "meta", - matcher: _matcher, - property: propertyString, - parentResource: parentResource, - props: assign({}, pendingProps), - count: 0, - instance: null, - root: _headRoot - }; - - _headResources.set(_matcher, _resource2); - } - - if (typeof _resource2.property === "string") { - // We cast because flow doesn't know that this resource must be a Meta resource - lastStructuredMeta.set(_resource2.property, _resource2); - } - - return _resource2; - } - - return null; - } - - case "title": { - var children = pendingProps.children; - var child; - - if (Array.isArray(children)) { - child = children.length === 1 ? children[0] : null; - } else { - child = children; - } - - if ( - typeof child !== "function" && - typeof child !== "symbol" && - child !== null && - child !== undefined - ) { - // eslint-disable-next-line react-internal/safe-string-coercion - var childString = "" + child; - - var _headRoot2 = getDocumentFromRoot(resourceRoot); - - var _headResources2 = getResourcesFromRoot(_headRoot2).head; - var key = getTitleKey(childString); - - var _resource3 = _headResources2.get(key); - - if (!_resource3) { - var titleProps = titlePropsFromRawProps(childString, pendingProps); - _resource3 = { - type: "title", - props: titleProps, - count: 0, - instance: null, - root: _headRoot2 - }; - - _headResources2.set(key, _resource3); - } - - return _resource3; - } - - return null; - } - - case "link": { - var rel = pendingProps.rel; - - switch (rel) { - case "stylesheet": { - var styleResources = getResourcesFromRoot(resourceRoot).styles; - var didWarn; - - { - if (currentProps) { - didWarn = validateURLKeyedUpdatedProps( - pendingProps, - currentProps, - "style", - "href" - ); - } - - if (!didWarn) { - didWarn = validateLinkPropsForStyleResource(pendingProps); - } - } - - var precedence = pendingProps.precedence, - _href = pendingProps.href; - - if (typeof _href === "string" && typeof precedence === "string") { - // We've asserted all the specific types for StyleQualifyingProps - var styleRawProps = pendingProps; // We construct or get an existing resource for the style itself and return it - - var _resource4 = styleResources.get(_href); - - if (_resource4) { - { - if (!didWarn) { - var latestProps = stylePropsFromRawProps(styleRawProps); - - if (_resource4._dev_preload_props) { - adoptPreloadPropsForStyle( - latestProps, - _resource4._dev_preload_props - ); - } - - validateStyleResourceDifference( - _resource4.props, - latestProps - ); - } - } - } else { - var resourceProps = stylePropsFromRawProps(styleRawProps); - _resource4 = createStyleResource( - styleResources, - resourceRoot, - _href, - precedence, - resourceProps - ); - immediatelyPreloadStyleResource(_resource4); - } - - return _resource4; - } - - return null; - } - - case "preload": { - { - validateLinkPropsForPreloadResource(pendingProps); - } - - var _href2 = pendingProps.href; - - if (typeof _href2 === "string") { - // We've asserted all the specific types for PreloadQualifyingProps - var preloadRawProps = pendingProps; - - var _resource5 = preloadResources.get(_href2); - - if (_resource5) { - { - var originallyImplicit = - _resource5._dev_implicit_construction === true; - - var _latestProps2 = preloadPropsFromRawProps(preloadRawProps); - - validatePreloadResourceDifference( - _resource5.props, - originallyImplicit, - _latestProps2, - false - ); - } - } else { - var _resourceProps2 = preloadPropsFromRawProps(preloadRawProps); - - _resource5 = createPreloadResource( - getDocumentFromRoot(resourceRoot), - _href2, - _resourceProps2 - ); - } - - return _resource5; - } - - return null; - } - - default: { - var _href3 = pendingProps.href, - sizes = pendingProps.sizes, - media = pendingProps.media; - - if (typeof rel === "string" && typeof _href3 === "string") { - var sizeKey = "::sizes:" + (typeof sizes === "string" ? sizes : ""); - var mediaKey = - "::media:" + (typeof media === "string" ? media : ""); - - var _key = "rel:" + rel + "::href:" + _href3 + sizeKey + mediaKey; - - var _headRoot3 = getDocumentFromRoot(resourceRoot); - - var _headResources3 = getResourcesFromRoot(_headRoot3).head; - - var _resource6 = _headResources3.get(_key); - - if (!_resource6) { - _resource6 = { - type: "link", - props: assign({}, pendingProps), - count: 0, - instance: null, - root: _headRoot3 - }; - - _headResources3.set(_key, _resource6); - } - - return _resource6; - } - - { - warnOnMissingHrefAndRel(pendingProps, currentProps); - } - - return null; - } - } - } - - case "script": { - var scriptResources = getResourcesFromRoot(resourceRoot).scripts; - - var _didWarn; - - { - if (currentProps) { - _didWarn = validateURLKeyedUpdatedProps( - pendingProps, - currentProps, - "script", - "src" - ); - } - } - - var src = pendingProps.src, - async = pendingProps.async; - - if (async && typeof src === "string") { - var scriptRawProps = pendingProps; - - var _resource7 = scriptResources.get(src); - - if (_resource7) { - { - if (!_didWarn) { - var _latestProps3 = scriptPropsFromRawProps(scriptRawProps); - - if (_resource7._dev_preload_props) { - adoptPreloadPropsForScript( - _latestProps3, - _resource7._dev_preload_props - ); - } - - validateScriptResourceDifference(_resource7.props, _latestProps3); - } - } - } else { - var _resourceProps3 = scriptPropsFromRawProps(scriptRawProps); - - _resource7 = createScriptResource( - scriptResources, - resourceRoot, - src, - _resourceProps3 - ); - } - - return _resource7; - } - - return null; - } - - default: { - throw new Error( - 'getResource encountered a resource type it did not expect: "' + - type + - '". this is a bug in React.' - ); - } - } -} - -function preloadPropsFromRawProps(rawBorrowedProps) { - return assign({}, rawBorrowedProps); -} - -function titlePropsFromRawProps(child, rawProps) { - var props = assign({}, rawProps); - - props.children = child; - return props; -} - -function stylePropsFromRawProps(rawProps) { - var props = assign({}, rawProps); - - props["data-precedence"] = rawProps.precedence; - props.precedence = null; - return props; -} - -function scriptPropsFromRawProps(rawProps) { - var props = assign({}, rawProps); - - return props; -} // -------------------------------------- -// Resource Reconciliation -// -------------------------------------- - -function acquireResource(resource) { - switch (resource.type) { - case "base": - case "title": - case "link": - case "meta": { - return acquireHeadResource(resource); - } - - case "style": { - return acquireStyleResource(resource); - } - - case "script": { - return acquireScriptResource(resource); - } - - case "preload": { - return resource.instance; - } - - default: { - throw new Error( - 'acquireResource encountered a resource type it did not expect: "' + - resource.type + - '". this is a bug in React.' - ); - } - } -} -function releaseResource(resource) { - switch (resource.type) { - case "link": - case "title": - case "meta": { - return releaseHeadResource(resource); - } - - case "style": { - resource.count--; - return; - } - } -} - -function releaseHeadResource(resource) { - if (--resource.count === 0) { - // the instance will have existed since we acquired it - var instance = resource.instance; - var parent = instance.parentNode; - - if (parent) { - parent.removeChild(instance); - } - - resource.instance = null; - } -} - -function createResourceInstance(type, props, ownerDocument) { - var element = createElement(type, props, ownerDocument, HTML_NAMESPACE); - setInitialProperties(element, type, props); - markNodeAsResource(element); - return element; -} - -function createStyleResource(styleResources, root, href, precedence, props) { - { - if (styleResources.has(href)) { - error( - "createStyleResource was called when a style Resource matching the same href already exists. This is a bug in React." - ); - } - } - - var limitedEscapedHref = escapeSelectorAttributeValueInsideDoubleQuotes(href); - var existingEl = root.querySelector( - 'link[rel="stylesheet"][href="' + limitedEscapedHref + '"]' - ); - var resource = { - type: "style", - count: 0, - href: href, - precedence: precedence, - props: props, - hint: null, - preloaded: false, - loaded: false, - error: false, - root: root, - instance: null - }; - styleResources.set(href, resource); - - if (existingEl) { - // If we have an existing element in the DOM we don't need to preload this resource nor can we - // adopt props from any preload that might exist already for this resource. We do need to try - // to reify the Resource loading state the best we can. - var loadingState = existingEl._p; - - if (loadingState) { - switch (loadingState.s) { - case "l": { - resource.loaded = true; - break; - } - - case "e": { - resource.error = true; - break; - } - - default: { - attachLoadListeners(existingEl, resource); - } - } - } else { - // This is unfortunately just an assumption. The rationale here is that stylesheets without - // a loading state must have been flushed in the shell and would have blocked until loading - // or error. we can't know afterwards which happened for all types of stylesheets (cross origin) - // for instance) and the techniques for determining if a sheet has loaded that we do have still - // fail if the sheet loaded zero rules. At the moment we are going to just opt to assume the - // sheet is loaded if it was flushed in the shell - resource.loaded = true; - } - } else { - var hint = preloadResources.get(href); - - if (hint) { - // $FlowFixMe[incompatible-type]: found when upgrading Flow - resource.hint = hint; // If a preload for this style Resource already exists there are certain props we want to adopt - // on the style Resource, primarily focussed on making sure the style network pathways utilize - // the preload pathways. For instance if you have diffreent crossOrigin attributes for a preload - // and a stylesheet the stylesheet will make a new request even if the preload had already loaded - - var preloadProps = hint.props; - adoptPreloadPropsForStyle(resource.props, hint.props); - - { - resource._dev_preload_props = preloadProps; - } - } - } - - return resource; -} - -function adoptPreloadPropsForStyle(styleProps, preloadProps) { - if (styleProps.crossOrigin == null) - styleProps.crossOrigin = preloadProps.crossOrigin; - if (styleProps.referrerPolicy == null) - styleProps.referrerPolicy = preloadProps.referrerPolicy; - if (styleProps.title == null) styleProps.title = preloadProps.title; -} - -function immediatelyPreloadStyleResource(resource) { - // This function must be called synchronously after creating a styleResource otherwise it may - // violate assumptions around the existence of a preload. The reason it is extracted out is we - // don't always want to preload a style, in particular when we are going to synchronously insert - // that style. We confirm the style resource has no preload already and then construct it. If - // we wait and call this later it is possible a preload will already exist for this href - if (resource.loaded === false && resource.hint === null) { - var href = resource.href, - props = resource.props; - var preloadProps = preloadPropsFromStyleProps(props); - resource.hint = createPreloadResource( - getDocumentFromRoot(resource.root), - href, - preloadProps - ); - } -} - -function preloadPropsFromStyleProps(props) { - return { - rel: "preload", - as: "style", - href: props.href, - crossOrigin: props.crossOrigin, - integrity: props.integrity, - media: props.media, - hrefLang: props.hrefLang, - referrerPolicy: props.referrerPolicy - }; -} - -function createScriptResource(scriptResources, root, src, props) { - { - if (scriptResources.has(src)) { - error( - "createScriptResource was called when a script Resource matching the same src already exists. This is a bug in React." - ); - } - } - - var limitedEscapedSrc = escapeSelectorAttributeValueInsideDoubleQuotes(src); - var existingEl = root.querySelector( - 'script[async][src="' + limitedEscapedSrc + '"]' - ); - var resource = { - type: "script", - src: src, - props: props, - root: root, - instance: existingEl || null - }; - scriptResources.set(src, resource); - - if (!existingEl) { - var hint = preloadResources.get(src); - - if (hint) { - // If a preload for this style Resource already exists there are certain props we want to adopt - // on the style Resource, primarily focussed on making sure the style network pathways utilize - // the preload pathways. For instance if you have diffreent crossOrigin attributes for a preload - // and a stylesheet the stylesheet will make a new request even if the preload had already loaded - var preloadProps = hint.props; - adoptPreloadPropsForScript(props, hint.props); - - { - resource._dev_preload_props = preloadProps; - } - } - } else { - markNodeAsResource(existingEl); - } - - return resource; -} - -function adoptPreloadPropsForScript(scriptProps, preloadProps) { - if (scriptProps.crossOrigin == null) - scriptProps.crossOrigin = preloadProps.crossOrigin; - if (scriptProps.referrerPolicy == null) - scriptProps.referrerPolicy = preloadProps.referrerPolicy; - if (scriptProps.integrity == null) - scriptProps.referrerPolicy = preloadProps.integrity; -} - -function createPreloadResource(ownerDocument, href, props) { - var limitedEscapedHref = escapeSelectorAttributeValueInsideDoubleQuotes(href); - var element = ownerDocument.querySelector( - 'link[rel="preload"][href="' + limitedEscapedHref + '"]' - ); - - if (!element) { - element = createResourceInstance("link", props, ownerDocument); - insertResourceInstanceBefore(ownerDocument, element, null); - } else { - markNodeAsResource(element); - } - - return { - type: "preload", - href: href, - ownerDocument: ownerDocument, - props: props, - instance: element - }; -} - -function acquireHeadResource(resource) { - resource.count++; - var instance = resource.instance; - - if (!instance) { - var props = resource.props, - root = resource.root, - type = resource.type; - - switch (type) { - case "title": { - var titles = root.querySelectorAll("title"); - - for (var i = 0; i < titles.length; i++) { - if (titles[i].textContent === props.children) { - instance = resource.instance = titles[i]; - markNodeAsResource(instance); - return instance; - } - } - - instance = resource.instance = createResourceInstance( - type, - props, - root - ); - var firstTitle = titles[0]; - insertResourceInstanceBefore( - root, - instance, - firstTitle && firstTitle.namespaceURI !== SVG_NAMESPACE - ? firstTitle - : null - ); - break; - } - - case "meta": { - var insertBefore = null; - var metaResource = resource; - var matcher = metaResource.matcher, - property = metaResource.property, - parentResource = metaResource.parentResource; - - if (parentResource && typeof property === "string") { - // This resoruce is a structured meta type with a parent. - // Instead of using the matcher we just traverse forward - // siblings of the parent instance until we find a match - // or exhaust. - var parent = parentResource.instance; - - if (parent) { - var node = null; - var nextNode = (insertBefore = parent.nextSibling); - - while ((node = nextNode)) { - nextNode = node.nextSibling; - - if (node.nodeName === "META") { - var meta = node; - var propertyAttr = meta.getAttribute("property"); - - if (typeof propertyAttr !== "string") { - continue; - } else if ( - propertyAttr === property && - meta.getAttribute("content") === props.content - ) { - resource.instance = meta; - markNodeAsResource(meta); - return meta; - } else if (property.startsWith(propertyAttr + ":")) { - // This meta starts a new instance of a parent structure for this meta type - // We need to halt our search here because even if we find a later match it - // is for a different parent element - break; - } - } - } - } - } else if ((instance = root.querySelector(matcher))) { - resource.instance = instance; - markNodeAsResource(instance); - return instance; - } - - instance = resource.instance = createResourceInstance( - type, - props, - root - ); - insertResourceInstanceBefore(root, instance, insertBefore); - break; - } - - case "link": { - var linkProps = props; - var limitedEscapedRel = escapeSelectorAttributeValueInsideDoubleQuotes( - linkProps.rel - ); - var limitedEscapedHref = escapeSelectorAttributeValueInsideDoubleQuotes( - linkProps.href - ); - var selector = - 'link[rel="' + - limitedEscapedRel + - '"][href="' + - limitedEscapedHref + - '"]'; - - if (typeof linkProps.sizes === "string") { - var limitedEscapedSizes = escapeSelectorAttributeValueInsideDoubleQuotes( - linkProps.sizes - ); - selector += '[sizes="' + limitedEscapedSizes + '"]'; - } - - if (typeof linkProps.media === "string") { - var limitedEscapedMedia = escapeSelectorAttributeValueInsideDoubleQuotes( - linkProps.media - ); - selector += '[media="' + limitedEscapedMedia + '"]'; - } - - var existingEl = root.querySelector(selector); - - if (existingEl) { - instance = resource.instance = existingEl; - markNodeAsResource(instance); - return instance; - } - - instance = resource.instance = createResourceInstance( - type, - props, - root - ); - insertResourceInstanceBefore(root, instance, null); - return instance; - } - - case "base": { - var baseResource = resource; - var _matcher2 = baseResource.matcher; - var base = root.querySelector(_matcher2); - - if (base) { - instance = resource.instance = base; - markNodeAsResource(instance); - } else { - instance = resource.instance = createResourceInstance( - type, - props, - root - ); - insertResourceInstanceBefore( - root, - instance, - root.querySelector("base") - ); - } - - return instance; - } - - default: { - throw new Error( - 'acquireHeadResource encountered a resource type it did not expect: "' + - type + - '". This is a bug in React.' - ); - } - } - } - - return instance; -} - -function acquireStyleResource(resource) { - var instance = resource.instance; - - if (!instance) { - var props = resource.props, - root = resource.root, - precedence = resource.precedence; - var limitedEscapedHref = escapeSelectorAttributeValueInsideDoubleQuotes( - props.href - ); - var existingEl = root.querySelector( - 'link[rel="stylesheet"][data-precedence][href="' + - limitedEscapedHref + - '"]' - ); - - if (existingEl) { - instance = resource.instance = existingEl; - markNodeAsResource(instance); - resource.preloaded = true; - var loadingState = existingEl._p; - - if (loadingState) { - // if an existingEl is found there should always be a loadingState because if - // the resource was flushed in the head it should have already been found when - // the resource was first created. Still defensively we gate this - switch (loadingState.s) { - case "l": { - resource.loaded = true; - resource.error = false; - break; - } - - case "e": { - resource.error = true; - break; - } - - default: { - attachLoadListeners(existingEl, resource); - } - } - } else { - resource.loaded = true; - } - } else { - instance = resource.instance = createResourceInstance( - "link", - resource.props, - getDocumentFromRoot(root) - ); - attachLoadListeners(instance, resource); - insertStyleInstance(instance, precedence, root); - } - } - - resource.count++; - return instance; -} - -function acquireScriptResource(resource) { - var instance = resource.instance; - - if (!instance) { - var props = resource.props, - root = resource.root; - var limitedEscapedSrc = escapeSelectorAttributeValueInsideDoubleQuotes( - props.src - ); - var existingEl = root.querySelector( - 'script[async][src="' + limitedEscapedSrc + '"]' - ); - - if (existingEl) { - instance = resource.instance = existingEl; - markNodeAsResource(instance); - } else { - instance = resource.instance = createResourceInstance( - "script", - resource.props, - getDocumentFromRoot(root) - ); - insertResourceInstanceBefore(getDocumentFromRoot(root), instance, null); - } - } - - return instance; -} - -function attachLoadListeners(instance, resource) { - var listeners = {}; - listeners.load = onResourceLoad.bind( - null, - instance, - resource, - listeners, - loadAndErrorEventListenerOptions - ); - listeners.error = onResourceError.bind( - null, - instance, - resource, - listeners, - loadAndErrorEventListenerOptions - ); - instance.addEventListener( - "load", - listeners.load, - loadAndErrorEventListenerOptions - ); - instance.addEventListener( - "error", - listeners.error, - loadAndErrorEventListenerOptions - ); -} - -var loadAndErrorEventListenerOptions = { - passive: true -}; - -function onResourceLoad(instance, resource, listeners, listenerOptions) { - resource.loaded = true; - resource.error = false; - - for (var event in listeners) { - instance.removeEventListener(event, listeners[event], listenerOptions); - } -} - -function onResourceError(instance, resource, listeners, listenerOptions) { - resource.loaded = false; - resource.error = true; - - for (var event in listeners) { - instance.removeEventListener(event, listeners[event], listenerOptions); - } -} - -function insertStyleInstance(instance, precedence, root) { - var nodes = root.querySelectorAll('link[rel="stylesheet"][data-precedence]'); - var last = nodes.length ? nodes[nodes.length - 1] : null; - var prior = last; - - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - var nodePrecedence = node.dataset.precedence; - - if (nodePrecedence === precedence) { - prior = node; - } else if (prior !== last) { - break; - } - } - - if (prior) { - // We get the prior from the document so we know it is in the tree. - // We also know that links can't be the topmost Node so the parentNode - // must exist. - prior.parentNode.insertBefore(instance, prior.nextSibling); - } else { - var parent = root.nodeType === DOCUMENT_NODE ? root.head : root; - - if (parent) { - parent.insertBefore(instance, parent.firstChild); - } else { - throw new Error( - "While attempting to insert a Resource, React expected the Document to contain" + - " a head element but it was not found." - ); - } - } -} - -function insertResourceInstanceBefore(ownerDocument, instance, before) { - { - if (instance.tagName === "LINK" && instance.rel === "stylesheet") { - error( - "insertResourceInstanceBefore was called with a stylesheet. Stylesheets must be" + - " inserted with insertStyleInstance instead. This is a bug in React." - ); - } - } - - var parent = (before && before.parentNode) || ownerDocument.head; - - if (parent) { - parent.insertBefore(instance, before); - } else { - throw new Error( - "While attempting to insert a Resource, React expected the Document to contain" + - " a head element but it was not found." - ); - } -} // When passing user input into querySelector(All) the embedded string must not alter -// the semantics of the query. This escape function is safe to use when we know the -// provided value is going to be wrapped in double quotes as part of an attribute selector -// Do not use it anywhere else -// we escape double quotes and backslashes - -var escapeSelectorAttributeValueInsideDoubleQuotesRegex = /[\n\"\\]/g; - -function escapeSelectorAttributeValueInsideDoubleQuotes(value) { - return value.replace( - escapeSelectorAttributeValueInsideDoubleQuotesRegex, - function(ch) { - return "\\" + ch.charCodeAt(0).toString(16); - } - ); -} - -var SUPPRESS_HYDRATION_WARNING$1 = "suppressHydrationWarning"; -var SUSPENSE_START_DATA = "$"; -var SUSPENSE_END_DATA = "/$"; -var SUSPENSE_PENDING_START_DATA = "$?"; -var SUSPENSE_FALLBACK_START_DATA = "$!"; -var STYLE$1 = "style"; -var eventsEnabled = null; -var selectionInformation = null; -function getRootHostContext(rootContainerInstance) { - var type; - var namespace; - var nodeType = rootContainerInstance.nodeType; - - switch (nodeType) { - case DOCUMENT_NODE: - case DOCUMENT_FRAGMENT_NODE: { - type = nodeType === DOCUMENT_NODE ? "#document" : "#fragment"; - var root = rootContainerInstance.documentElement; - namespace = root ? root.namespaceURI : getChildNamespace(null, ""); - break; - } - - default: { - var container = - nodeType === COMMENT_NODE - ? rootContainerInstance.parentNode - : rootContainerInstance; - var ownNamespace = container.namespaceURI || null; - type = container.tagName; - namespace = getChildNamespace(ownNamespace, type); - break; - } - } - - { - var validatedTag = type.toLowerCase(); - var ancestorInfo = updatedAncestorInfoDev(null, validatedTag); - return { - namespace: namespace, - ancestorInfo: ancestorInfo - }; - } -} -function getChildHostContext(parentHostContext, type) { - { - var parentHostContextDev = parentHostContext; - var namespace = getChildNamespace(parentHostContextDev.namespace, type); - var ancestorInfo = updatedAncestorInfoDev( - parentHostContextDev.ancestorInfo, - type - ); - return { - namespace: namespace, - ancestorInfo: ancestorInfo - }; - } -} -function getPublicInstance(instance) { - return instance; -} -function prepareForCommit(containerInfo) { - eventsEnabled = isEnabled(); - selectionInformation = getSelectionInformation(); - var activeInstance = null; - - { - var focusedElem = selectionInformation.focusedElem; - - if (focusedElem !== null) { - activeInstance = getClosestInstanceFromNode(focusedElem); - } - } - - setEnabled(false); - return activeInstance; -} -function beforeActiveInstanceBlur(internalInstanceHandle) { - { - setEnabled(true); - dispatchBeforeDetachedBlur( - selectionInformation.focusedElem, - internalInstanceHandle - ); - setEnabled(false); - } -} -function afterActiveInstanceBlur() { - { - setEnabled(true); - dispatchAfterDetachedBlur(selectionInformation.focusedElem); - setEnabled(false); - } -} -function resetAfterCommit(containerInfo) { - restoreSelection(selectionInformation); - setEnabled(eventsEnabled); - eventsEnabled = null; - selectionInformation = null; -} -function createInstance( - type, - props, - rootContainerInstance, - hostContext, - internalInstanceHandle -) { - var parentNamespace; - - { - // TODO: take namespace into account when validating. - var hostContextDev = hostContext; - validateDOMNesting(type, null, hostContextDev.ancestorInfo); - - if ( - typeof props.children === "string" || - typeof props.children === "number" - ) { - var string = "" + props.children; - var ownAncestorInfo = updatedAncestorInfoDev( - hostContextDev.ancestorInfo, - type - ); - validateDOMNesting(null, string, ownAncestorInfo); - } - - parentNamespace = hostContextDev.namespace; - } - - var domElement = createElement( - type, - props, - rootContainerInstance, - parentNamespace - ); - precacheFiberNode(internalInstanceHandle, domElement); - updateFiberProps(domElement, props); - return domElement; -} -function appendInitialChild(parentInstance, child) { - parentInstance.appendChild(child); -} -function finalizeInitialChildren(domElement, type, props, hostContext) { - setInitialProperties(domElement, type, props); - - switch (type) { - case "button": - case "input": - case "select": - case "textarea": - return !!props.autoFocus; - - case "img": - return true; - - default: - return false; - } -} -function prepareUpdate(domElement, type, oldProps, newProps, hostContext) { - { - var hostContextDev = hostContext; - - if ( - typeof newProps.children !== typeof oldProps.children && - (typeof newProps.children === "string" || - typeof newProps.children === "number") - ) { - var string = "" + newProps.children; - var ownAncestorInfo = updatedAncestorInfoDev( - hostContextDev.ancestorInfo, - type - ); - validateDOMNesting(null, string, ownAncestorInfo); - } - } - - return diffProperties(domElement, type, oldProps, newProps); -} -function shouldSetTextContent(type, props) { - return ( - type === "textarea" || - type === "noscript" || - typeof props.children === "string" || - typeof props.children === "number" || - (typeof props.dangerouslySetInnerHTML === "object" && - props.dangerouslySetInnerHTML !== null && - props.dangerouslySetInnerHTML.__html != null) - ); -} -function createTextInstance( - text, - rootContainerInstance, - hostContext, - internalInstanceHandle -) { - { - var hostContextDev = hostContext; - validateDOMNesting(null, text, hostContextDev.ancestorInfo); - } - - var textNode = createTextNode(text, rootContainerInstance); - precacheFiberNode(internalInstanceHandle, textNode); - return textNode; -} -function getCurrentEventPriority() { - var currentEvent = window.event; - - if (currentEvent === undefined) { - return DefaultEventPriority; - } - - return getEventPriority(currentEvent.type); -} -// if a component just imports ReactDOM (e.g. for findDOMNode). -// Some environments might not have setTimeout or clearTimeout. - -var scheduleTimeout = typeof setTimeout === "function" ? setTimeout : undefined; -var cancelTimeout = - typeof clearTimeout === "function" ? clearTimeout : undefined; -var noTimeout = -1; -var localPromise = typeof Promise === "function" ? Promise : undefined; -function getInstanceFromNode(node) { - return getClosestInstanceFromNode(node) || null; -} -function preparePortalMount(portalInstance) { - listenToAllSupportedEvents(portalInstance); -} -function prepareScopeUpdate(scopeInstance, internalInstanceHandle) { - { - precacheFiberNode(internalInstanceHandle, scopeInstance); - } -} -function getInstanceFromScope(scopeInstance) { - { - return getFiberFromScopeInstance(scopeInstance); - } -} // ------------------- -var scheduleMicrotask = - typeof queueMicrotask === "function" - ? queueMicrotask - : typeof localPromise !== "undefined" - ? function(callback) { - return localPromise - .resolve(null) - .then(callback) - .catch(handleErrorInNextTick); - } - : scheduleTimeout; // TODO: Determine the best fallback here. - -function handleErrorInNextTick(error) { - setTimeout(function() { - throw error; - }); -} // ------------------- -function commitMount(domElement, type, newProps, internalInstanceHandle) { - // Despite the naming that might imply otherwise, this method only - // fires if there is an `Update` effect scheduled during mounting. - // This happens if `finalizeInitialChildren` returns `true` (which it - // does to implement the `autoFocus` attribute on the client). But - // there are also other cases when this might happen (such as patching - // up text content during hydration mismatch). So we'll check this again. - switch (type) { - case "button": - case "input": - case "select": - case "textarea": - if (newProps.autoFocus) { - domElement.focus(); - } - - return; - - case "img": { - if (newProps.src) { - domElement.src = newProps.src; - } - - return; - } - } -} -function commitUpdate( - domElement, - updatePayload, - type, - oldProps, - newProps, - internalInstanceHandle -) { - // Apply the diff to the DOM node. - updateProperties(domElement, updatePayload, type, oldProps, newProps); // Update the props handle so that we know which props are the ones with - // with current event handlers. - - updateFiberProps(domElement, newProps); -} -function resetTextContent(domElement) { - setTextContent(domElement, ""); -} -function commitTextUpdate(textInstance, oldText, newText) { - textInstance.nodeValue = newText; -} -function appendChild(parentInstance, child) { - parentInstance.appendChild(child); -} -function appendChildToContainer(container, child) { - var parentNode; - - if (container.nodeType === COMMENT_NODE) { - parentNode = container.parentNode; - parentNode.insertBefore(child, container); - } else { - parentNode = container; - parentNode.appendChild(child); - } // This container might be used for a portal. - // If something inside a portal is clicked, that click should bubble - // through the React tree. However, on Mobile Safari the click would - // never bubble through the *DOM* tree unless an ancestor with onclick - // event exists. So we wouldn't see it and dispatch it. - // This is why we ensure that non React root containers have inline onclick - // defined. - // https://github.com/facebook/react/issues/11918 - - var reactRootContainer = container._reactRootContainer; - - if ( - (reactRootContainer === null || reactRootContainer === undefined) && - parentNode.onclick === null - ) { - // TODO: This cast may not be sound for SVG, MathML or custom elements. - trapClickOnNonInteractiveElement(parentNode); - } -} -function insertBefore(parentInstance, child, beforeChild) { - parentInstance.insertBefore(child, beforeChild); -} -function insertInContainerBefore(container, child, beforeChild) { - if (container.nodeType === COMMENT_NODE) { - container.parentNode.insertBefore(child, beforeChild); - } else { - container.insertBefore(child, beforeChild); - } -} - -function createEvent(type, bubbles) { - var event = document.createEvent("Event"); - event.initEvent(type, bubbles, false); - return event; -} - -function dispatchBeforeDetachedBlur(target, internalInstanceHandle) { - { - var event = createEvent("beforeblur", true); // Dispatch "beforeblur" directly on the target, - // so it gets picked up by the event system and - // can propagate through the React internal tree. - // $FlowFixMe: internal field - - event._detachedInterceptFiber = internalInstanceHandle; - target.dispatchEvent(event); - } -} - -function dispatchAfterDetachedBlur(target) { - { - var event = createEvent("afterblur", false); // So we know what was detached, make the relatedTarget the - // detached target on the "afterblur" event. - - event.relatedTarget = target; // Dispatch the event on the document. - - document.dispatchEvent(event); - } -} - -function removeChild(parentInstance, child) { - parentInstance.removeChild(child); -} -function removeChildFromContainer(container, child) { - if (container.nodeType === COMMENT_NODE) { - container.parentNode.removeChild(child); - } else { - container.removeChild(child); - } -} -function clearSuspenseBoundary(parentInstance, suspenseInstance) { - var node = suspenseInstance; // Delete all nodes within this suspense boundary. - // There might be nested nodes so we need to keep track of how - // deep we are and only break out when we're back on top. - - var depth = 0; - - do { - var nextNode = node.nextSibling; - parentInstance.removeChild(node); - - if (nextNode && nextNode.nodeType === COMMENT_NODE) { - var data = nextNode.data; - - if (data === SUSPENSE_END_DATA) { - if (depth === 0) { - parentInstance.removeChild(nextNode); // Retry if any event replaying was blocked on this. - - retryIfBlockedOn(suspenseInstance); - return; - } else { - depth--; - } - } else if ( - data === SUSPENSE_START_DATA || - data === SUSPENSE_PENDING_START_DATA || - data === SUSPENSE_FALLBACK_START_DATA - ) { - depth++; - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - node = nextNode; - } while (node); // TODO: Warn, we didn't find the end comment boundary. - // Retry if any event replaying was blocked on this. - - retryIfBlockedOn(suspenseInstance); -} -function clearSuspenseBoundaryFromContainer(container, suspenseInstance) { - if (container.nodeType === COMMENT_NODE) { - clearSuspenseBoundary(container.parentNode, suspenseInstance); - } else if (container.nodeType === ELEMENT_NODE) { - clearSuspenseBoundary(container, suspenseInstance); - } // Retry if any event replaying was blocked on this. - - retryIfBlockedOn(container); -} -function hideInstance(instance) { - // TODO: Does this work for all element types? What about MathML? Should we - // pass host context to this method? - instance = instance; - var style = instance.style; // $FlowFixMe[method-unbinding] - - if (typeof style.setProperty === "function") { - style.setProperty("display", "none", "important"); - } else { - style.display = "none"; - } -} -function hideTextInstance(textInstance) { - textInstance.nodeValue = ""; -} -function unhideInstance(instance, props) { - instance = instance; - var styleProp = props[STYLE$1]; - var display = - styleProp !== undefined && - styleProp !== null && - styleProp.hasOwnProperty("display") - ? styleProp.display - : null; - instance.style.display = dangerousStyleValue("display", display); -} -function unhideTextInstance(textInstance, text) { - textInstance.nodeValue = text; -} -function clearContainer(container) { - { - var nodeType = container.nodeType; - - if (nodeType === DOCUMENT_NODE) { - clearRootResources(container); - clearContainerSparingly(container); - } else if (nodeType === ELEMENT_NODE) { - switch (container.nodeName) { - case "HEAD": { - // If we are clearing document.head as a container we are essentially clearing everything - // that was hoisted to the head and should forget the instances that will no longer be in the DOM - clearRootResources(container); // fall through to clear child contents - } - // eslint-disable-next-line-no-fallthrough - - case "HTML": - case "BODY": - clearContainerSparingly(container); - return; - - default: { - container.textContent = ""; - } - } - } - } -} - -function clearContainerSparingly(container) { - var node; - var nextNode = container.firstChild; - - if (nextNode && nextNode.nodeType === DOCUMENT_TYPE_NODE) { - nextNode = nextNode.nextSibling; - } - - while (nextNode) { - node = nextNode; - nextNode = nextNode.nextSibling; - - switch (node.nodeName) { - case "HTML": - case "HEAD": - case "BODY": { - var element = node; - clearContainerSparingly(element); // If these singleton instances had previously been rendered with React they - // may still hold on to references to the previous fiber tree. We detatch them - // prospectively to reset them to a baseline starting state since we cannot create - // new instances. - - detachDeletedInstance(element); - continue; - } - - case "STYLE": { - continue; - } - - case "LINK": { - if (node.rel.toLowerCase() === "stylesheet") { - continue; - } - } - } - - container.removeChild(node); - } - - return; -} // Making this so we can eventually move all of the instance caching to the commit phase. -// inserted without breaking hydration - -function isHydratable(type, props) { - { - if (type === "link") { - if (props.rel === "stylesheet" && typeof props.precedence !== "string") { - return true; - } - - return false; - } else if (type === "script") { - var _ref = props, - async = _ref.async, - onLoad = _ref.onLoad, - onError = _ref.onError; - return !(async && (onLoad || onError)); - } - - return true; - } -} -function canHydrateInstance(instance, type, props) { - if ( - instance.nodeType !== ELEMENT_NODE || - type.toLowerCase() !== instance.nodeName.toLowerCase() - ) { - return null; - } // This has now been refined to an element node. - - return instance; -} -function canHydrateTextInstance(instance, text) { - if (text === "" || instance.nodeType !== TEXT_NODE) { - // Empty strings are not parsed by HTML so there won't be a correct match here. - return null; - } // This has now been refined to a text node. - - return instance; -} -function canHydrateSuspenseInstance(instance) { - if (instance.nodeType !== COMMENT_NODE) { - // Empty strings are not parsed by HTML so there won't be a correct match here. - return null; - } // This has now been refined to a suspense node. - - return instance; -} -function isSuspenseInstancePending(instance) { - return instance.data === SUSPENSE_PENDING_START_DATA; -} -function isSuspenseInstanceFallback(instance) { - return instance.data === SUSPENSE_FALLBACK_START_DATA; -} -function getSuspenseInstanceFallbackErrorDetails(instance) { - var dataset = instance.nextSibling && instance.nextSibling.dataset; - var digest, message, stack; - - if (dataset) { - digest = dataset.dgst; - - { - message = dataset.msg; - stack = dataset.stck; - } - } - - { - return { - message: message, - digest: digest, - stack: stack - }; - } -} -function registerSuspenseInstanceRetry(instance, callback) { - instance._reactRetry = callback; -} - -function getNextHydratable(node) { - // Skip non-hydratable nodes. - for (; node != null; node = node.nextSibling) { - var nodeType = node.nodeType; - - { - if (nodeType === ELEMENT_NODE) { - var element = node; - - switch (element.tagName) { - // This is subtle. in SVG scope the title tag is case sensitive. we don't want to skip - // titles in svg but we do want to skip them outside of svg. there is an edge case where - // you could do `React.createElement('TITLE', ...)` inside an svg scope but the SSR serializer - // will still emit lowercase. Practically speaking the only time the DOM will have a non-uppercased - // title tagName is if it is inside an svg. - // Other Resource types like META, BASE, LINK, and SCRIPT should be treated as resources even inside - // svg scope because they are invalid otherwise. We still don't need to handle the lowercase variant - // because if they are present in the DOM already they would have been hoisted outside the SVG scope - // as Resources. So while it would be correct to skip a inside and this algorithm won't - // skip that link because the tagName will not be uppercased it functionally is irrelevant. If one - // tries to render incompatible types such as a non-resource stylesheet inside an svg the server will - // emit that invalid html and hydration will fail. In Dev this will present warnings guiding the - // developer on how to fix. - case "TITLE": - case "META": - case "BASE": - case "HTML": - case "HEAD": - case "BODY": { - continue; - } - - case "LINK": { - var linkEl = element; // All links that are server rendered are resources except - // stylesheets that do not have a precedence - - if ( - linkEl.rel === "stylesheet" && - !linkEl.hasAttribute("data-precedence") - ) { - break; - } - - continue; - } - - case "STYLE": { - var styleEl = element; - - if (styleEl.hasAttribute("data-precedence")) { - continue; - } - - break; - } - - case "SCRIPT": { - var scriptEl = element; - - if (scriptEl.hasAttribute("async")) { - continue; - } - - break; - } - } - - break; - } else if (nodeType === TEXT_NODE) { - break; - } - } - - if (nodeType === COMMENT_NODE) { - var nodeData = node.data; - - if ( - nodeData === SUSPENSE_START_DATA || - nodeData === SUSPENSE_FALLBACK_START_DATA || - nodeData === SUSPENSE_PENDING_START_DATA - ) { - break; - } - - if (nodeData === SUSPENSE_END_DATA) { - return null; - } - } - } - - return node; -} - -function getNextHydratableSibling(instance) { - return getNextHydratable(instance.nextSibling); -} -function getFirstHydratableChild(parentInstance) { - return getNextHydratable(parentInstance.firstChild); -} -function getFirstHydratableChildWithinContainer(parentContainer) { - return getNextHydratable(parentContainer.firstChild); -} -function getFirstHydratableChildWithinSuspenseInstance(parentInstance) { - return getNextHydratable(parentInstance.nextSibling); -} -function hydrateInstance( - instance, - type, - props, - hostContext, - internalInstanceHandle, - shouldWarnDev -) { - precacheFiberNode(internalInstanceHandle, instance); // TODO: Possibly defer this until the commit phase where all the events - // get attached. - - updateFiberProps(instance, props); - var parentNamespace; - - { - var hostContextDev = hostContext; - parentNamespace = hostContextDev.namespace; - } // TODO: Temporary hack to check if we're in a concurrent root. We can delete - // when the legacy root API is removed. - - var isConcurrentMode = - (internalInstanceHandle.mode & ConcurrentMode) !== NoMode; - return diffHydratedProperties( - instance, - type, - props, - parentNamespace, - isConcurrentMode, - shouldWarnDev - ); -} -function hydrateTextInstance( - textInstance, - text, - internalInstanceHandle, - shouldWarnDev -) { - precacheFiberNode(internalInstanceHandle, textInstance); // TODO: Temporary hack to check if we're in a concurrent root. We can delete - // when the legacy root API is removed. - - var isConcurrentMode = - (internalInstanceHandle.mode & ConcurrentMode) !== NoMode; - return diffHydratedText(textInstance, text); -} -function hydrateSuspenseInstance(suspenseInstance, internalInstanceHandle) { - precacheFiberNode(internalInstanceHandle, suspenseInstance); -} -function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) { - var node = suspenseInstance.nextSibling; // Skip past all nodes within this suspense boundary. - // There might be nested nodes so we need to keep track of how - // deep we are and only break out when we're back on top. - - var depth = 0; - - while (node) { - if (node.nodeType === COMMENT_NODE) { - var data = node.data; - - if (data === SUSPENSE_END_DATA) { - if (depth === 0) { - return getNextHydratableSibling(node); - } else { - depth--; - } - } else if ( - data === SUSPENSE_START_DATA || - data === SUSPENSE_FALLBACK_START_DATA || - data === SUSPENSE_PENDING_START_DATA - ) { - depth++; - } - } - - node = node.nextSibling; - } // TODO: Warn, we didn't find the end comment boundary. - - return null; -} // Returns the SuspenseInstance if this node is a direct child of a -// SuspenseInstance. I.e. if its previous sibling is a Comment with -// SUSPENSE_x_START_DATA. Otherwise, null. - -function getParentSuspenseInstance(targetInstance) { - var node = targetInstance.previousSibling; // Skip past all nodes within this suspense boundary. - // There might be nested nodes so we need to keep track of how - // deep we are and only break out when we're back on top. - - var depth = 0; - - while (node) { - if (node.nodeType === COMMENT_NODE) { - var data = node.data; - - if ( - data === SUSPENSE_START_DATA || - data === SUSPENSE_FALLBACK_START_DATA || - data === SUSPENSE_PENDING_START_DATA - ) { - if (depth === 0) { - return node; - } else { - depth--; - } - } else if (data === SUSPENSE_END_DATA) { - depth++; - } - } - - node = node.previousSibling; - } - - return null; -} -function commitHydratedContainer(container) { - // Retry if any event replaying was blocked on this. - retryIfBlockedOn(container); -} -function commitHydratedSuspenseInstance(suspenseInstance) { - // Retry if any event replaying was blocked on this. - retryIfBlockedOn(suspenseInstance); -} // @TODO remove this function once float lands and hydrated tail nodes -function didNotMatchHydratedContainerTextInstance( - parentContainer, - textInstance, - text, - isConcurrentMode, - shouldWarnDev -) { - checkForUnmatchedText( - textInstance.nodeValue, - text, - isConcurrentMode, - shouldWarnDev - ); -} -function didNotMatchHydratedTextInstance( - parentType, - parentProps, - parentInstance, - textInstance, - text, - isConcurrentMode, - shouldWarnDev -) { - if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { - checkForUnmatchedText( - textInstance.nodeValue, - text, - isConcurrentMode, - shouldWarnDev - ); - } -} -function didNotHydrateInstanceWithinContainer(parentContainer, instance) { - { - if (instance.nodeType === ELEMENT_NODE) { - warnForDeletedHydratableElement(parentContainer, instance); - } else if (instance.nodeType === COMMENT_NODE); - else { - warnForDeletedHydratableText(parentContainer, instance); - } - } -} -function didNotHydrateInstanceWithinSuspenseInstance(parentInstance, instance) { - { - // $FlowFixMe: Only Element or Document can be parent nodes. - var parentNode = parentInstance.parentNode; - - if (parentNode !== null) { - if (instance.nodeType === ELEMENT_NODE) { - warnForDeletedHydratableElement(parentNode, instance); - } else if (instance.nodeType === COMMENT_NODE); - else { - warnForDeletedHydratableText(parentNode, instance); - } - } - } -} -function didNotHydrateInstance( - parentType, - parentProps, - parentInstance, - instance, - isConcurrentMode -) { - { - if ( - isConcurrentMode || - parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true - ) { - if (instance.nodeType === ELEMENT_NODE) { - warnForDeletedHydratableElement(parentInstance, instance); - } else if (instance.nodeType === COMMENT_NODE); - else { - warnForDeletedHydratableText(parentInstance, instance); - } - } - } -} -function didNotFindHydratableInstanceWithinContainer( - parentContainer, - type, - props -) { - { - warnForInsertedHydratedElement(parentContainer, type); - } -} -function didNotFindHydratableTextInstanceWithinContainer( - parentContainer, - text -) { - { - warnForInsertedHydratedText(parentContainer, text); - } -} -function didNotFindHydratableInstanceWithinSuspenseInstance( - parentInstance, - type, - props -) { - { - // $FlowFixMe: Only Element or Document can be parent nodes. - var parentNode = parentInstance.parentNode; - if (parentNode !== null) warnForInsertedHydratedElement(parentNode, type); - } -} -function didNotFindHydratableTextInstanceWithinSuspenseInstance( - parentInstance, - text -) { - { - // $FlowFixMe: Only Element or Document can be parent nodes. - var parentNode = parentInstance.parentNode; - if (parentNode !== null) warnForInsertedHydratedText(parentNode, text); - } -} -function didNotFindHydratableInstance( - parentType, - parentProps, - parentInstance, - type, - props, - isConcurrentMode -) { - { - if ( - isConcurrentMode || - parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true - ) { - warnForInsertedHydratedElement(parentInstance, type); - } - } -} -function didNotFindHydratableTextInstance( - parentType, - parentProps, - parentInstance, - text, - isConcurrentMode -) { - { - if ( - isConcurrentMode || - parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true - ) { - warnForInsertedHydratedText(parentInstance, text); - } - } -} -function errorHydratingContainer(parentContainer) { - { - // TODO: This gets logged by onRecoverableError, too, so we should be - // able to remove it. - error( - "An error occurred during hydration. The server HTML was replaced with client content in <%s>.", - parentContainer.nodeName.toLowerCase() - ); - } -} // ------------------- -function findFiberRoot(node) { - var stack = [node]; - var index = 0; - - while (index < stack.length) { - var current = stack[index++]; - - if (isContainerMarkedAsRoot(current)) { - return getInstanceFromNode$1(current); - } - - stack.push.apply(stack, current.children); - } - - return null; -} -function getBoundingRect(node) { - var rect = node.getBoundingClientRect(); - return { - x: rect.left, - y: rect.top, - width: rect.width, - height: rect.height - }; -} -function matchAccessibilityRole(node, role) { - if (hasRole(node, role)) { - return true; - } - - return false; -} -function getTextContent(fiber) { - switch (fiber.tag) { - case HostResource: - case HostSingleton: - case HostComponent: - var textContent = ""; - var childNodes = fiber.stateNode.childNodes; - - for (var i = 0; i < childNodes.length; i++) { - var childNode = childNodes[i]; - - if (childNode.nodeType === Node.TEXT_NODE) { - textContent += childNode.textContent; - } - } - - return textContent; - - case HostText: - return fiber.stateNode.textContent; - } - - return null; -} -function isHiddenSubtree(fiber) { - return fiber.tag === HostComponent && fiber.memoizedProps.hidden === true; -} -function setFocusIfFocusable(node) { - // The logic for determining if an element is focusable is kind of complex, - // and since we want to actually change focus anyway- we can just skip it. - // Instead we'll just listen for a "focus" event to verify that focus was set. - // - // We could compare the node to document.activeElement after focus, - // but this would not handle the case where application code managed focus to automatically blur. - var didFocus = false; - - var handleFocus = function() { - didFocus = true; - }; - - var element = node; - - try { - element.addEventListener("focus", handleFocus); // $FlowFixMe[method-unbinding] - - (element.focus || HTMLElement.prototype.focus).call(element); - } finally { - element.removeEventListener("focus", handleFocus); - } - - return didFocus; -} -function setupIntersectionObserver(targets, callback, options) { - var rectRatioCache = new Map(); - targets.forEach(function(target) { - rectRatioCache.set(target, { - rect: getBoundingRect(target), - ratio: 0 - }); - }); - - var handleIntersection = function(entries) { - entries.forEach(function(entry) { - var boundingClientRect = entry.boundingClientRect, - intersectionRatio = entry.intersectionRatio, - target = entry.target; - rectRatioCache.set(target, { - rect: { - x: boundingClientRect.left, - y: boundingClientRect.top, - width: boundingClientRect.width, - height: boundingClientRect.height - }, - ratio: intersectionRatio - }); - }); - callback(Array.from(rectRatioCache.values())); - }; - - var observer = new IntersectionObserver(handleIntersection, options); - targets.forEach(function(target) { - observer.observe(target); - }); - return { - disconnect: function() { - return observer.disconnect(); - }, - observe: function(target) { - rectRatioCache.set(target, { - rect: getBoundingRect(target), - ratio: 0 - }); - observer.observe(target); - }, - unobserve: function(target) { - rectRatioCache.delete(target); - observer.unobserve(target); - } - }; -} -function isHostResourceType(type, props, hostContext) { - var outsideHostContainerContext; - var namespace; - - { - var hostContextDev = hostContext; // We can only render resources when we are not within the host container context - - outsideHostContainerContext = !hostContextDev.ancestorInfo - .containerTagInScope; - namespace = hostContextDev.namespace; - } - - switch (type) { - case "base": - case "meta": { - return true; - } - - case "title": { - return namespace !== SVG_NAMESPACE; - } - - case "link": { - var onLoad = props.onLoad, - onError = props.onError; - - if (onLoad || onError) { - { - if (outsideHostContainerContext) { - error( - "Cannot render a with onLoad or onError listeners outside the main document." + - " Try removing onLoad={...} and onError={...} or moving it into the root tag or" + - " somewhere in the ." - ); - } else if (namespace === SVG_NAMESPACE) { - error( - "Cannot render a with onLoad or onError listeners as a descendent of ." + - " Try removing onLoad={...} and onError={...} or moving it above the ancestor." - ); - } - } - - return false; - } - - switch (props.rel) { - case "stylesheet": { - var href = props.href, - precedence = props.precedence, - disabled = props.disabled; - - { - validateLinkPropsForStyleResource(props); - - if (typeof precedence !== "string") { - if (outsideHostContainerContext) { - error( - 'Cannot render a outside the main document without knowing its precedence.' + - ' Consider adding precedence="default" or moving it into the root tag.' - ); - } else if (namespace === SVG_NAMESPACE) { - error( - 'Cannot render a as a descendent of an element without knowing its precedence.' + - ' Consider adding precedence="default" or moving it above the ancestor.' - ); - } - } - } - - return ( - typeof href === "string" && - typeof precedence === "string" && - disabled == null - ); - } - - default: { - var rel = props.rel, - _href = props.href; - return typeof _href === "string" && typeof rel === "string"; - } - } - } - - case "script": { - // We don't validate because it is valid to use async with onLoad/onError unlike combining - // precedence with these for style resources - var src = props.src, - async = props.async, - _onLoad = props.onLoad, - _onError = props.onError; - - { - if (async !== true) { - if (outsideHostContainerContext) { - error( - "Cannot render a sync or defer tag.' - ); - } else if (namespace === SVG_NAMESPACE) { - error( - "Cannot render a sync or defer