"use client";
import * as React from "react";
const isTestEnv = typeof process !== "undefined" && (process.env.NODE_ENV === "test" || typeof process.env.JEST_WORKER_ID !== "undefined");
let markdownPluginsPromise = null;
async function loadMarkdownPlugins() {
  if (isTestEnv) return [];
  if (!markdownPluginsPromise) {
    markdownPluginsPromise = import("remark-gfm").then((mod) => [mod.default ?? mod]).catch(() => []);
  }
  return markdownPluginsPromise;
}
function useMarkdownRemarkPlugins(providedPlugins) {
  const [plugins, setPlugins] = React.useState(() => providedPlugins ?? []);
  React.useEffect(() => {
    if (providedPlugins) {
      setPlugins(providedPlugins);
      return;
    }
    let mounted = true;
    void loadMarkdownPlugins().then((resolved) => {
      if (!mounted) return;
      setPlugins(resolved);
    });
    return () => {
      mounted = false;
    };
  }, [providedPlugins]);
  return providedPlugins ?? plugins;
}
export {
  useMarkdownRemarkPlugins
};
//# sourceMappingURL=useMarkdownRemarkPlugins.js.map
