import "/build/_shared/chunk-Q4RXG3XC.js";
import {
  useAppLayoutData
} from "/build/_shared/chunk-CUOCTUZ2.js";
import {
  require_jsx_dev_runtime
} from "/build/_shared/chunk-D5XSJF2M.js";
import {
  Link,
  Outlet,
  init_esm2 as init_esm,
  isRouteErrorResponse,
  useParams,
  useRouteError
} from "/build/_shared/chunk-VJFCZKPM.js";
import "/build/_shared/chunk-OCFPP4X2.js";
import {
  require_react
} from "/build/_shared/chunk-HWKMUXRS.js";
import {
  Routes
} from "/build/_shared/chunk-5222SY3A.js";
import {
  createHotContext,
  init_remix_hmr
} from "/build/_shared/chunk-4FTV3JJX.js";
import "/build/_shared/chunk-YLRAJVC6.js";
import {
  __toESM
} from "/build/_shared/chunk-RODUX5XG.js";

// app/routes/app+/_layout.tsx
init_remix_hmr();
init_esm();
var import_react2 = __toESM(require_react(), 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+/_layout.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+/_layout.tsx"
  );
  import.meta.hot.lastModified = "1715882071671.2446";
}
function ErrorBoundary() {
  _s();
  const params = useParams();
  const error = useRouteError();
  if (isRouteErrorResponse(error)) {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { className: "p-8", children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("h1", { children: [
        error.status,
        " ",
        error.statusText
      ] }, void 0, true, {
        fileName: "app/routes/app+/_layout.tsx",
        lineNumber: 34,
        columnNumber: 9
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("p", { children: error.data }, void 0, false, {
        fileName: "app/routes/app+/_layout.tsx",
        lineNumber: 37,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/routes/app+/_layout.tsx",
      lineNumber: 33,
      columnNumber: 12
    }, this);
  } else if (error instanceof Error) {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { className: "p-8", children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("h1", { className: "text-4xl font-medium", children: "An error occurred, sorry about that!" }, void 0, false, {
        fileName: "app/routes/app+/_layout.tsx",
        lineNumber: 41,
        columnNumber: 9
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Link, { to: Routes.app.project.env.dashboard({
        projectId: params.projectId,
        envId: params.envId
      }), className: "text-2xl underline underline-offset-2", children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("h2", { children: "Go back home" }, void 0, false, {
        fileName: "app/routes/app+/_layout.tsx",
        lineNumber: 46,
        columnNumber: 11
      }, this) }, void 0, false, {
        fileName: "app/routes/app+/_layout.tsx",
        lineNumber: 42,
        columnNumber: 9
      }, this),
      true ? /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("p", { children: error.message }, void 0, false, {
          fileName: "app/routes/app+/_layout.tsx",
          lineNumber: 49,
          columnNumber: 13
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("p", { children: "The stack trace is:" }, void 0, false, {
          fileName: "app/routes/app+/_layout.tsx",
          lineNumber: 50,
          columnNumber: 13
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("pre", { children: error.stack }, void 0, false, {
          fileName: "app/routes/app+/_layout.tsx",
          lineNumber: 51,
          columnNumber: 13
        }, this)
      ] }, void 0, true, {
        fileName: "app/routes/app+/_layout.tsx",
        lineNumber: 48,
        columnNumber: 51
      }, this) : null
    ] }, void 0, true, {
      fileName: "app/routes/app+/_layout.tsx",
      lineNumber: 40,
      columnNumber: 12
    }, this);
  } else {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("h1", { children: "Unknown Error" }, void 0, false, {
      fileName: "app/routes/app+/_layout.tsx",
      lineNumber: 55,
      columnNumber: 12
    }, this);
  }
}
_s(ErrorBoundary, "zdr1Q18Q8gvmYGshq8PhZqIbfWs=", false, function() {
  return [useParams, useRouteError];
});
_c = ErrorBoundary;
function AppLayout() {
  _s2();
  const appLayoutData = useAppLayoutData();
  (0, import_react2.useEffect)(() => {
    if (false) {
      const name = appLayoutData.user.firstName + " " + appLayoutData.user.lastName;
      const email = appLayoutData.user.emailAddresses[0].emailAddress;
      posthog.identify(appLayoutData.user.id, {
        email,
        name
      });
    }
  }, [appLayoutData?.user]);
  return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { className: "h-screen w-screen px-4 pb-1 pt-4", children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Outlet, {}, void 0, false, {
    fileName: "app/routes/app+/_layout.tsx",
    lineNumber: 76,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/routes/app+/_layout.tsx",
    lineNumber: 75,
    columnNumber: 10
  }, this);
}
_s2(AppLayout, "UarzKZdg4ZWbicqJs/Wd2sNOzC0=", false, function() {
  return [useAppLayoutData];
});
_c2 = AppLayout;
var _c;
var _c2;
$RefreshReg$(_c, "ErrorBoundary");
$RefreshReg$(_c2, "AppLayout");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;
export {
  ErrorBoundary,
  AppLayout as default
};
//# sourceMappingURL=/build/routes/app+/_layout-UJJQPMHZ.js.map
