import {
  require_clerk
} from "/build/_shared/chunk-RKIEMES6.js";
import {
  require_build
} from "/build/_shared/chunk-74UPEAGA.js";
import {
  Await,
  init_esm2 as init_esm,
  useLoaderData,
  useNavigate
} from "/build/_shared/chunk-ZC2TL3GZ.js";
import {
  require_jsx_dev_runtime
} from "/build/_shared/chunk-ED7KKCRB.js";
import {
  require_react
} from "/build/_shared/chunk-PECDPABK.js";
import {
  require_node
} from "/build/_shared/chunk-G7CHZRZX.js";
import {
  require_ssr
} from "/build/_shared/chunk-TLLKLDIT.js";
import {
  Routes
} from "/build/_shared/chunk-N27UEDHN.js";
import {
  createHotContext,
  init_remix_hmr
} from "/build/_shared/chunk-G7KTOMTD.js";
import {
  __toESM
} from "/build/_shared/chunk-PNG5AS42.js";

// app/routes/app+/index.tsx
init_remix_hmr();
var import_ssr = __toESM(require_ssr(), 1);
var import_node = __toESM(require_node(), 1);
init_esm();
var import_react2 = __toESM(require_react(), 1);
var import_remix_themes = __toESM(require_build(), 1);
var import_clerk = __toESM(require_clerk(), 1);
var import_jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/routes/app+/index.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s = $RefreshSig$();
var _s2 = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/routes/app+/index.tsx"
  );
  import.meta.hot.lastModified = "1711734246947.836";
}
var redirectComponent = (user) => {
  _s();
  const navigate = useNavigate();
  (0, import_react2.useEffect)(() => {
    const {
      personalProjectId,
      personalEnvId,
      hasOnboarded
    } = user?.publicMetadata || {};
    if (personalProjectId && personalEnvId) {
      const redirectPath = hasOnboarded ? Routes.app.project.env.dashboard : Routes.app.project.env.onboarding;
      navigate(redirectPath({
        projectId: personalProjectId,
        envId: personalEnvId
      }), {
        unstable_viewTransition: true
      });
    }
  }, [user]);
  return null;
};
_s(redirectComponent, "0pNeyzXk/ByIxyERsdaIrG6js9s=", false, function() {
  return [useNavigate];
});
function RootRoute() {
  _s2();
  const {
    user
  } = useLoaderData();
  const [theme] = (0, import_remix_themes.useTheme)();
  const isDarkMode = theme === import_remix_themes.Theme.DARK;
  return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(import_react2.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { className: "flex h-screen flex-col items-center justify-center gap-8", children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("img", { src: isDarkMode ? "/DarkModeLogo.svg" : "/LightModeLogo.svg", alt: "Montelo Logo", className: "w-48" }, void 0, false, {
    fileName: "app/routes/app+/index.tsx",
    lineNumber: 91,
    columnNumber: 11
  }, this) }, void 0, false, {
    fileName: "app/routes/app+/index.tsx",
    lineNumber: 90,
    columnNumber: 30
  }, this), children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Await, { resolve: user, children: redirectComponent }, void 0, false, {
    fileName: "app/routes/app+/index.tsx",
    lineNumber: 93,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/routes/app+/index.tsx",
    lineNumber: 90,
    columnNumber: 10
  }, this);
}
_s2(RootRoute, "+s4eH+Q1CCcCD82MhSUzP/RwBQA=", false, function() {
  return [useLoaderData, import_remix_themes.useTheme];
});
_c = RootRoute;
var _c;
$RefreshReg$(_c, "RootRoute");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

export {
  RootRoute
};
//# sourceMappingURL=/build/_shared/chunk-VJP4HR25.js.map
