import {
  ExperimentsTable
} from "/build/_shared/chunk-EWUZNH5A.js";
import "/build/_shared/chunk-66K6NTQO.js";
import {
  PageDocLink
} from "/build/_shared/chunk-T75MUU5G.js";
import "/build/_shared/chunk-UWBTKPLD.js";
import "/build/_shared/chunk-7FHGZRTC.js";
import "/build/_shared/chunk-634BMO4L.js";
import {
  require_dayjs_min
} from "/build/_shared/chunk-HUUSILLY.js";
import {
  PageSubtitle
} from "/build/_shared/chunk-VV3RU6RL.js";
import "/build/_shared/chunk-P3C75TI5.js";
import {
  PageLayout
} from "/build/_shared/chunk-BXT5AGPN.js";
import "/build/_shared/chunk-LGQ4GCFK.js";
import "/build/_shared/chunk-AI5FD5Y6.js";
import {
  withAuth
} from "/build/_shared/chunk-NHF4CNMF.js";
import "/build/_shared/chunk-KQKP3VNY.js";
import {
  init_esm2 as init_esm,
  useLoaderData
} from "/build/_shared/chunk-ZC2TL3GZ.js";
import {
  require_jsx_dev_runtime
} from "/build/_shared/chunk-ED7KKCRB.js";
import "/build/_shared/chunk-RYE6BCZB.js";
import "/build/_shared/chunk-PECDPABK.js";
import {
  require_node
} from "/build/_shared/chunk-G7CHZRZX.js";
import "/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 "/build/_shared/chunk-ZIPKILLR.js";
import {
  __toESM
} from "/build/_shared/chunk-PNG5AS42.js";

// app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index.tsx
init_remix_hmr();
var import_node = __toESM(require_node(), 1);
init_esm();
var import_dayjs = __toESM(require_dayjs_min(), 1);

// app/pages/experiments/ExperimentsPage.tsx
init_remix_hmr();
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/pages/experiments/ExperimentsPage.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/experiments/ExperimentsPage.tsx"
  );
  import.meta.hot.lastModified = "1711327267023.5732";
}
var ExperimentsPage = ({
  experiments,
  totalCount,
  currentPage,
  totalPages
}) => {
  const breadcrumbs = [{
    label: "Experiments"
  }];
  const subtitle = () => {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PageSubtitle, { children: [
      "Run experiments from your codebase to validate your system.",
      " ",
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PageDocLink, { to: Routes.external.docs.experiments, children: "Experiments Docs." }, void 0, false, {
        fileName: "app/pages/experiments/ExperimentsPage.tsx",
        lineNumber: 38,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/experiments/ExperimentsPage.tsx",
      lineNumber: 36,
      columnNumber: 12
    }, this);
  };
  return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PageLayout, { breadcrumbs, subtitle, children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(ExperimentsTable, { experiments, totalCount, currentPage, totalPages }, void 0, false, {
    fileName: "app/pages/experiments/ExperimentsPage.tsx",
    lineNumber: 42,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/pages/experiments/ExperimentsPage.tsx",
    lineNumber: 41,
    columnNumber: 10
  }, this);
};
_c = ExperimentsPage;
var _c;
$RefreshReg$(_c, "ExperimentsPage");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index.tsx
var import_jsx_dev_runtime2 = __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+/project+/$projectId+/env+/$envId+/experiments+/index.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index.tsx"
  );
  import.meta.hot.lastModified = "1711663831023.2021";
}
var loader = withAuth(async ({
  request,
  api,
  params
}) => {
  const envId = params.envId;
  const {
    searchParams
  } = new URL(request.url);
  const currentPage = parseInt(searchParams.get("page") || "1");
  const pageSize = 20;
  const skipAmount = (currentPage - 1) * pageSize;
  const {
    experiments,
    totalCount
  } = await api.experiment.experimentControllerGetPaginatedExperimentsForEnvironment({
    envId,
    take: pageSize.toString(),
    skip: skipAmount.toString()
  });
  const totalPages = Math.ceil(totalCount / pageSize);
  const formattedExperiments = experiments.map((experiment) => ({
    ...experiment,
    createdAt: (0, import_dayjs.default)(experiment.createdAt).format("MMM D YY / h:mm:ss a")
  }));
  return (0, import_node.json)({
    experiments: formattedExperiments,
    totalCount,
    currentPage,
    totalPages
  });
});
function ExperimentsRoute() {
  _s();
  const {
    experiments,
    totalCount,
    currentPage,
    totalPages
  } = useLoaderData();
  return /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(ExperimentsPage, { experiments, totalCount, currentPage, totalPages }, void 0, false, {
    fileName: "app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index.tsx",
    lineNumber: 67,
    columnNumber: 10
  }, this);
}
_s(ExperimentsRoute, "Rj0Ci2jFIcdusZtiBHjtBjR7Mgo=", false, function() {
  return [useLoaderData];
});
_c2 = ExperimentsRoute;
var _c2;
$RefreshReg$(_c2, "ExperimentsRoute");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;
export {
  ExperimentsRoute as default
};
//# sourceMappingURL=/build/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index-7RDUZGGG.js.map
