import "./chunk-RZHPB5F4.mjs";
import {
  ToolpadApp,
  componentsStore
} from "./chunk-3OJ5QDPS.mjs";
import "./chunk-7HXI5QAG.mjs";
import "./chunk-IEP6GGEX.mjs";

// src/entrypoint.tsx
import Button from "@mui/material/Button";
import * as React from "react";
import * as ReactDOM from "react-dom/client";
import { AppHostProvider } from "@toolpad/studio-runtime";
import createCache from "@emotion/cache";
import { CacheProvider } from "@emotion/react";
import { Box } from "@mui/material";
var IS_PREVIEW = process.env.NODE_ENV !== "production";
var TOOLPAD_PLAN = process.env.TOOLPAD_PLAN;
var cache = createCache({
  key: "css",
  prepend: true
});
cache.compat = true;
function setComponents(newComponents) {
  componentsStore.setState(newComponents);
}
function Root({ ToolpadApp: ToolpadApp2, initialState, base }) {
  return /* @__PURE__ */ React.createElement(React.StrictMode, null, /* @__PURE__ */ React.createElement(CacheProvider, { value: cache }, /* @__PURE__ */ React.createElement(Button, { sx: { display: "none" } }), /* @__PURE__ */ React.createElement(AppHostProvider, { isPreview: IS_PREVIEW, plan: TOOLPAD_PLAN }, /* @__PURE__ */ React.createElement(ToolpadApp2, { basename: base, state: initialState })), /* @__PURE__ */ React.createElement(Box, { "data-testid": "page-ready-marker", sx: { display: "none" } })));
}
function init({ ToolpadApp: ToolpadApp2 = ToolpadApp, initialState, base }) {
  ReactDOM.createRoot(document.getElementById("root")).render(
    /* @__PURE__ */ React.createElement(Root, { base, ToolpadApp: ToolpadApp2, initialState })
  );
}
export {
  init,
  setComponents
};
//# sourceMappingURL=entrypoint.mjs.map