'use client';
"use client";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));

// src/client/DevToolsProvider.tsx
import { useEffect } from "react";
import { Fragment, jsx } from "react/jsx-runtime";
function DevToolsProvider({
  children,
  devToolsUrl = "/__react_devtools__",
  enabled = true
}) {
  const isEnabled = enabled;
  useEffect(() => {
    if (!isEnabled)
      return;
    if (typeof window === "undefined")
      return;
    if (!window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
      const renderers = /* @__PURE__ */ new Map();
      window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
        __IS_OUR_MOCK__: true,
        checkDCE() {
        },
        supportsFiber: true,
        renderers,
        onScheduleFiberRoot() {
        },
        onCommitFiberRoot() {
        },
        onCommitFiberUnmount() {
        },
        inject(renderer) {
          const id = Math.random().toString(36).slice(2);
          renderers.set(id, renderer);
          return id;
        }
      };
    }
    async function setupGlobals() {
      try {
        const React = await import("react");
        const ReactDOM = await import("react-dom");
        window.React = React;
        window.ReactDOM = ReactDOM;
        try {
          const ReactDOMClient = await import("react-dom/client");
          window.ReactDOM = __spreadProps(__spreadValues({}, ReactDOM), {
            createRoot: ReactDOMClient.createRoot,
            hydrateRoot: ReactDOMClient.hydrateRoot
          });
        } catch (e) {
        }
        ;
        window.__REACT_DEVTOOLS_GLOBALS_READY__ = true;
        window.dispatchEvent(new CustomEvent("react-devtools-globals-ready"));
      } catch (err) {
        console.warn("[React DevTools] Failed to setup globals:", err);
      }
    }
    async function loadOverlay() {
      try {
        const overlayUrl = devToolsUrl.endsWith("/") ? `${devToolsUrl}overlay.mjs` : `${devToolsUrl}/overlay.mjs`;
        const script = document.createElement("script");
        script.type = "module";
        script.src = overlayUrl;
        script.onerror = () => {
          console.debug(
            "[React DevTools] Overlay not available - DevTools server may not be running"
          );
        };
        document.body.appendChild(script);
      } catch (err) {
        console.debug("[React DevTools] Failed to load overlay:", err);
      }
    }
    setupGlobals().then(() => {
      loadOverlay();
    });
  }, [isEnabled, devToolsUrl]);
  return /* @__PURE__ */ jsx(Fragment, { children });
}

// src/client/DevToolsScript.tsx
import { useEffect as useEffect2 } from "react";
function DevToolsScript({ basePath = "/__react_devtools__", enabled = true } = {}) {
  useEffect2(() => {
    if (!enabled || typeof window === "undefined")
      return;
    if (!window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
      const renderers = /* @__PURE__ */ new Map();
      window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
        __IS_OUR_MOCK__: true,
        checkDCE() {
        },
        supportsFiber: true,
        renderers,
        onScheduleFiberRoot() {
        },
        onCommitFiberRoot() {
        },
        onCommitFiberUnmount() {
        },
        inject(renderer) {
          const id = Math.random().toString(36).slice(2);
          renderers.set(id, renderer);
          return id;
        }
      };
    }
    async function setupGlobals() {
      try {
        const React = await import("react");
        const ReactDOM = await import("react-dom");
        window.React = React;
        window.ReactDOM = ReactDOM;
        try {
          const ReactDOMClient = await import("react-dom/client");
          window.ReactDOM = __spreadProps(__spreadValues({}, ReactDOM), { createRoot: ReactDOMClient.createRoot, hydrateRoot: ReactDOMClient.hydrateRoot });
        } catch (e) {
        }
        ;
        window.__REACT_DEVTOOLS_GLOBALS_READY__ = true;
        window.dispatchEvent(new CustomEvent("react-devtools-globals-ready"));
      } catch (err) {
        console.warn("[React DevTools] Failed to setup globals:", err);
      }
    }
    function loadOverlay() {
      ;
      window.__REACT_DEVTOOLS_CONFIG__ = __spreadProps(__spreadValues({}, window.__REACT_DEVTOOLS_CONFIG__), { clientUrl: basePath });
      if (!document.getElementById("react-devtools-overlay-styles")) {
        const link = document.createElement("link");
        link.id = "react-devtools-overlay-styles";
        link.rel = "stylesheet";
        link.href = `${basePath}/overlay.css`;
        document.head.appendChild(link);
      }
      const script = document.createElement("script");
      script.type = "module";
      script.src = `${basePath}/overlay.mjs`;
      document.body.appendChild(script);
    }
    setupGlobals();
    if (window.__REACT_DEVTOOLS_GLOBALS_READY__)
      loadOverlay();
    else window.addEventListener("react-devtools-globals-ready", loadOverlay, { once: true });
  }, [basePath, enabled]);
  return null;
}
export {
  DevToolsProvider,
  DevToolsScript
};
//# sourceMappingURL=next-client.js.map