import * as __WEBPACK_EXTERNAL_MODULE_react_dom__ from "react-dom";
const fullClone = {
    ...__WEBPACK_EXTERNAL_MODULE_react_dom__
};
const { version, render: reactRender, unmountComponentAtNode } = fullClone;
let createRoot;
try {
    const mainVersion = Number((version || '').split('.')[0]);
    if (mainVersion >= 18 && fullClone.createRoot) createRoot = fullClone.createRoot;
} catch (e) {}
function toggleWarning(skip) {
    const { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } = fullClone;
    if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && 'object' == typeof __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip;
}
const MARK = '__antd_mobile_root__';
function legacyRender(node, container) {
    reactRender(node, container);
}
function concurrentRender(node, container) {
    toggleWarning(true);
    const root = container[MARK] || createRoot(container);
    toggleWarning(false);
    root.render(node);
    container[MARK] = root;
}
function render(node, container) {
    if (createRoot) {
        concurrentRender(node, container);
        return;
    }
    legacyRender(node, container);
}
function legacyUnmount(container) {
    return unmountComponentAtNode(container);
}
async function concurrentUnmount(container) {
    return Promise.resolve().then(()=>{
        var _container_MARK;
        null === (_container_MARK = container[MARK]) || void 0 === _container_MARK || _container_MARK.unmount();
        delete container[MARK];
    });
}
function unmount(container) {
    if (createRoot) return concurrentUnmount(container);
    return legacyUnmount(container);
}
export { render, unmount };
