"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
0 && (module.exports = {
    hookPropertyMap: null,
    defaultOverrides: null,
    baseOverrides: null,
    experimentalOverrides: null,
    addHookAliases: null,
    overrideReact: null
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: all[name]
    });
}
_export(exports, {
    hookPropertyMap: function() {
        return hookPropertyMap;
    },
    defaultOverrides: function() {
        return defaultOverrides;
    },
    baseOverrides: function() {
        return baseOverrides;
    },
    experimentalOverrides: function() {
        return experimentalOverrides;
    },
    addHookAliases: function() {
        return addHookAliases;
    },
    overrideReact: function() {
        return overrideReact;
    }
});
const { dirname  } = require("path");
let resolve = process.env.NEXT_MINIMAL ? __non_webpack_require__.resolve : require.resolve;
let nextPaths = undefined;
if (!process.env.NEXT_MINIMAL) {
    nextPaths = {
        paths: resolve.paths("next/package.json") || undefined
    };
}
const hookPropertyMap = new Map();
const defaultOverrides = {
    "styled-jsx": process.env.NEXT_MINIMAL ? dirname(resolve("styled-jsx/package.json")) : dirname(resolve("styled-jsx/package.json", nextPaths)),
    "styled-jsx/style": process.env.NEXT_MINIMAL ? resolve("styled-jsx/style") : resolve("styled-jsx/style", nextPaths)
};
const baseOverrides = {
    react: "next/dist/compiled/react",
    "react/package.json": "next/dist/compiled/react/package.json",
    "react/jsx-runtime": "next/dist/compiled/react/jsx-runtime",
    "react/jsx-dev-runtime": "next/dist/compiled/react/jsx-dev-runtime",
    "react-dom": "next/dist/compiled/react-dom/server-rendering-stub",
    "react-dom/package.json": "next/dist/compiled/react-dom/package.json",
    "react-dom/client": "next/dist/compiled/react-dom/client",
    "react-dom/server": "next/dist/compiled/react-dom/server",
    // when the require hook applies, we want to use the edge version, for both app and pages
    "react-dom/server.browser": "next/dist/compiled/react-dom/server.edge",
    "react-dom/server.edge": "next/dist/compiled/react-dom/server.edge",
    "react-server-dom-webpack/client": "next/dist/compiled/react-server-dom-webpack/client",
    "react-server-dom-webpack/client.edge": "next/dist/compiled/react-server-dom-webpack/client.edge",
    "react-server-dom-webpack/server.edge": "next/dist/compiled/react-server-dom-webpack/server.edge",
    "react-server-dom-webpack/server.node": "next/dist/compiled/react-server-dom-webpack/server.node"
};
const experimentalOverrides = {
    react: "next/dist/compiled/react-experimental",
    "react/jsx-runtime": "next/dist/compiled/react-experimental/jsx-runtime",
    "react/jsx-dev-runtime": "next/dist/compiled/react-experimental/jsx-dev-runtime",
    "react-dom": "next/dist/compiled/react-dom-experimental/server-rendering-stub",
    "react/package.json": "next/dist/compiled/react-experimental/package.json",
    "react-dom/package.json": "next/dist/compiled/react-dom-experimental/package.json",
    "react-dom/client": "next/dist/compiled/react-dom-experimental/client",
    "react-dom/server": "next/dist/compiled/react-dom-experimental/server",
    // when the require hook applies, we want to use the edge version, for both app and pages
    "react-dom/server.browser": "next/dist/compiled/react-dom-experimental/server.edge",
    "react-dom/server.edge": "next/dist/compiled/react-dom-experimental/server.edge",
    "react-server-dom-webpack/client": "next/dist/compiled/react-server-dom-webpack-experimental/client",
    "react-server-dom-webpack/client.edge": "next/dist/compiled/react-server-dom-webpack-experimental/client.edge",
    "react-server-dom-webpack/server.edge": "next/dist/compiled/react-server-dom-webpack-experimental/server.edge",
    "react-server-dom-webpack/server.node": "next/dist/compiled/react-server-dom-webpack-experimental/server.node"
};
let aliasedPrebundledReact = false;
const toResolveMap = (map)=>Object.entries(map).map(([key, value])=>[
            key,
            resolve(value, nextPaths)
        ]);
function addHookAliases(aliases = []) {
    for (const [key, value] of aliases){
        hookPropertyMap.set(key, value);
    }
}
addHookAliases(toResolveMap(defaultOverrides));
function overrideReact() {
    if (process.env.__NEXT_PRIVATE_PREBUNDLED_REACT && !aliasedPrebundledReact) {
        aliasedPrebundledReact = true;
        // Require these modules with static paths to make sure they are tracked by
        // NFT when building the app in standalone mode, as we are now conditionally
        // aliasing them it's tricky to track them in build time.
        if (process.env.__NEXT_PRIVATE_PREBUNDLED_REACT === "experimental") {
            addHookAliases(toResolveMap(experimentalOverrides));
        } else {
            addHookAliases(toResolveMap(baseOverrides));
        }
    }
}
overrideReact();

//# sourceMappingURL=import-overrides.js.map