"use client";
import { jsx } from "react/jsx-runtime";
import { useState } from "react";
import { useServerInsertedHTML } from "next/navigation";
import {
  createRootStyleCache,
  RootStyleRegistry as ReactRootStyleRegistry,
  StyleTagSSR
} from "../runtimes/react/root-style-registry";
function NextRootStyleRegistry({
  children,
  cacheKey,
  enableCssReset
}) {
  const [cache] = useState(() => createRootStyleCache({ key: cacheKey }));
  useServerInsertedHTML(() => {
    const { classNames, css } = cache.flush();
    return classNames.length > 0 ? /* @__PURE__ */ jsx(StyleTagSSR, { cacheKey: cache.key, classNames, css }) : null;
  });
  return /* @__PURE__ */ jsx(ReactRootStyleRegistry, { cache, enableCssReset, children });
}
export {
  NextRootStyleRegistry
};
//# sourceMappingURL=root-style-registry.js.map