import { useActivePlugin } from "@docusaurus/plugin-content-docs/client";
import { ReactContextError, useDocsPreferredVersion } from "@docusaurus/theme-common";
export function getColorMode() {
    const html = document.querySelector("html");
    return html === null || html === void 0 ? void 0 : html.dataset.theme;
}
export function getPreferredVersion(index) {
    var _a;
    const activePlugin = useActivePlugin();
    try {
        const { preferredVersion } = useDocsPreferredVersion((_a = activePlugin === null || activePlugin === void 0 ? void 0 : activePlugin.pluginId) !== null && _a !== void 0 ? _a : "default");
        return preferredVersion.name;
    }
    catch (e) {
        if (index) {
            if (e instanceof ReactContextError) {
                return "current";
            }
            else {
                throw e;
            }
        }
        return null;
    }
}
