import {
  import_dayjs,
  require_timezone
} from "/build/_shared/chunk-AQ3KUNDV.js";
import {
  Sheet,
  SheetContent,
  SheetDescription,
  SheetHeader,
  SheetTitle,
  SheetTrigger
} from "/build/_shared/chunk-S36FNI3O.js";
import {
  Pagination
} from "/build/_shared/chunk-W6HEMSBR.js";
import {
  SquareArrowUpRight
} from "/build/_shared/chunk-XSZNYPTW.js";
import {
  Badge,
  idShortener
} from "/build/_shared/chunk-KSAJCXX3.js";
import {
  Table,
  TableBody,
  TableCell,
  TableHead,
  TableHeader,
  TableRow
} from "/build/_shared/chunk-F5GZ2BM6.js";
import "/build/_shared/chunk-LYGYU3G2.js";
import {
  Button
} from "/build/_shared/chunk-ZESRKRPI.js";
import "/build/_shared/chunk-3E37RNOA.js";
import "/build/_shared/chunk-JYSNSZA2.js";
import {
  require_numbro_min
} from "/build/_shared/chunk-TCLIWQBB.js";
import {
  PrettyJson
} from "/build/_shared/chunk-H6F3VZYF.js";
import "/build/_shared/chunk-5DGBJUUY.js";
import {
  require_dayjs_min
} from "/build/_shared/chunk-RFBEIH4W.js";
import {
  Card,
  CardContent,
  CardHeader,
  CardTitle
} from "/build/_shared/chunk-MR25HKXM.js";
import {
  PageDocLink
} from "/build/_shared/chunk-TPFG27GP.js";
import {
  PageSubtitle
} from "/build/_shared/chunk-Z534YQLL.js";
import "/build/_shared/chunk-L7VKH6VP.js";
import "/build/_shared/chunk-4CHLX6OP.js";
import {
  Eye,
  Play,
  Target
} from "/build/_shared/chunk-EEPFRJZL.js";
import {
  PageLayout
} from "/build/_shared/chunk-IVHXUM2B.js";
import {
  ExternalLinkIcon
} from "/build/_shared/chunk-P2DAPPQF.js";
import "/build/_shared/chunk-AI5FD5Y6.js";
import {
  require_jsx_dev_runtime
} from "/build/_shared/chunk-D5XSJF2M.js";
import {
  Link,
  init_esm2 as init_esm,
  useLoaderData,
  useNavigate,
  useParams
} from "/build/_shared/chunk-VJFCZKPM.js";
import "/build/_shared/chunk-OCFPP4X2.js";
import "/build/_shared/chunk-HWKMUXRS.js";
import {
  withAuth
} from "/build/_shared/chunk-RHQW4WCH.js";
import {
  require_node
} from "/build/_shared/chunk-MDLUSIM2.js";
import "/build/_shared/chunk-EB6A6RVQ.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+/project+/$projectId+/env+/$envId+/experiments+/$experimentId+/index.tsx
init_remix_hmr();
var import_node = __toESM(require_node(), 1);
init_esm();

// app/pages/experiments/ExperimentId/ExperimentIdPage.tsx
init_remix_hmr();
init_esm();
var import_dayjs2 = __toESM(require_dayjs_min(), 1);
var import_numbro = __toESM(require_numbro_min(), 1);

// app/pages/experiments/ExperimentId/DatapointRunsTable.tsx
init_remix_hmr();

// app/pages/experiments/ExperimentId/DatapointRunCell.tsx
init_remix_hmr();
init_esm();
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/ExperimentId/DatapointRunCell.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/pages/experiments/ExperimentId/DatapointRunCell.tsx"
  );
  import.meta.hot.lastModified = "1715882071662.1658";
}
var DatapointRunCell = ({
  datapointRun
}) => {
  _s();
  const navigate = useNavigate();
  const params = useParams();
  const {
    short,
    variant
  } = idShortener(datapointRun.id);
  const onCellClick = (datapointRun2) => {
    navigate(Routes.app.project.env.datapointRunId({
      projectId: params.projectId,
      envId: params.envId,
      experimentId: params.experimentId,
      datapointRunId: datapointRun2.id
    }));
  };
  const WrappedCell = ({
    children
  }) => /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { className: "w-2/12", onClick: (e) => {
    e.preventDefault();
    e.stopPropagation();
  }, children }, void 0, false, {
    fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
    lineNumber: 51,
    columnNumber: 9
  }, this);
  return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableRow, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { className: "w-1/12", children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Badge, { variant, className: "cursor-pointer", onClick: () => {
      onCellClick(datapointRun);
    }, children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(SquareArrowUpRight, {}, void 0, false, {
        fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
        lineNumber: 62,
        columnNumber: 11
      }, this),
      "\xA0",
      short
    ] }, void 0, true, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 59,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 58,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { className: "w-1/12", children: datapointRun.createdAt }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 66,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(WrappedCell, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PrettyJson, { data: datapointRun.datapoint.input }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 68,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 67,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(WrappedCell, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PrettyJson, { data: datapointRun.datapoint.expectedOutput }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 71,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 70,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(WrappedCell, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PrettyJson, { data: datapointRun.output }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 74,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 73,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(WrappedCell, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PrettyJson, { data: datapointRun.evaluation }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 77,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 76,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { className: "w-1/12", children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Sheet, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(SheetTrigger, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Eye, { size: 20, className: "text-muted-foreground hover:text-primary-foreground cursor-pointer" }, void 0, false, {
        fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
        lineNumber: 82,
        columnNumber: 13
      }, this) }, void 0, false, {
        fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
        lineNumber: 81,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(SheetContent, { className: "min-w-[640px] max-w-[640px] overflow-y-scroll", children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(SheetHeader, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(SheetTitle, { children: "Run Overview" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
          lineNumber: 86,
          columnNumber: 15
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(SheetDescription, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { className: "flex flex-col gap-8", children: [
          /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("h1", { children: "Input" }, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
              lineNumber: 90,
              columnNumber: 21
            }, this),
            /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PrettyJson, { data: datapointRun.datapoint.input, shouldTruncate: false }, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
              lineNumber: 91,
              columnNumber: 21
            }, this)
          ] }, void 0, true, {
            fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
            lineNumber: 89,
            columnNumber: 19
          }, this),
          /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("h1", { children: "Expected Output" }, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
              lineNumber: 94,
              columnNumber: 21
            }, this),
            /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PrettyJson, { data: datapointRun.datapoint.expectedOutput, shouldTruncate: false }, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
              lineNumber: 95,
              columnNumber: 21
            }, this)
          ] }, void 0, true, {
            fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
            lineNumber: 93,
            columnNumber: 19
          }, this),
          /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("h1", { children: "Actual Output" }, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
              lineNumber: 98,
              columnNumber: 21
            }, this),
            /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PrettyJson, { data: datapointRun.output, shouldTruncate: false }, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
              lineNumber: 99,
              columnNumber: 21
            }, this)
          ] }, void 0, true, {
            fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
            lineNumber: 97,
            columnNumber: 19
          }, this),
          /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("h1", { children: "Evaluation" }, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
              lineNumber: 102,
              columnNumber: 21
            }, this),
            /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PrettyJson, { data: datapointRun.evaluation, shouldTruncate: false }, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
              lineNumber: 103,
              columnNumber: 21
            }, this)
          ] }, void 0, true, {
            fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
            lineNumber: 101,
            columnNumber: 19
          }, this)
        ] }, void 0, true, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
          lineNumber: 88,
          columnNumber: 17
        }, this) }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
          lineNumber: 87,
          columnNumber: 15
        }, this)
      ] }, void 0, true, {
        fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
        lineNumber: 85,
        columnNumber: 13
      }, this) }, void 0, false, {
        fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
        lineNumber: 84,
        columnNumber: 11
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 80,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
      lineNumber: 79,
      columnNumber: 7
    }, this)
  ] }, datapointRun.id, true, {
    fileName: "app/pages/experiments/ExperimentId/DatapointRunCell.tsx",
    lineNumber: 57,
    columnNumber: 10
  }, this);
};
_s(DatapointRunCell, "SzNGDGP4xGcYIk3uBFNVGGb4h2M=", false, function() {
  return [useNavigate, useParams];
});
_c = DatapointRunCell;
var _c;
$RefreshReg$(_c, "DatapointRunCell");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/pages/experiments/ExperimentId/DatapointRunsTable.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/pages/experiments/ExperimentId/DatapointRunsTable.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx"
  );
  import.meta.hot.lastModified = "1715882071662.3943";
}
var DatapointRunsTable = ({
  datapointRuns,
  currentPage,
  totalPages
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)("div", { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(Table, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableRow, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Run" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
          lineNumber: 33,
          columnNumber: 13
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Start Date" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
          lineNumber: 34,
          columnNumber: 13
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Input" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
          lineNumber: 35,
          columnNumber: 13
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Expected Output" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
          lineNumber: 36,
          columnNumber: 13
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Run Output" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
          lineNumber: 37,
          columnNumber: 13
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Evaluation" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
          lineNumber: 38,
          columnNumber: 13
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Actions" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
          lineNumber: 39,
          columnNumber: 13
        }, this)
      ] }, void 0, true, {
        fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
        lineNumber: 32,
        columnNumber: 11
      }, this) }, void 0, false, {
        fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
        lineNumber: 31,
        columnNumber: 9
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableBody, { children: datapointRuns.map((datapointRun) => /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(DatapointRunCell, { datapointRun }, datapointRun.id, false, {
        fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
        lineNumber: 43,
        columnNumber: 46
      }, this)) }, void 0, false, {
        fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
        lineNumber: 42,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
      lineNumber: 30,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)("div", { className: "mt-4 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(Pagination, { currentPage, totalPages }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
      lineNumber: 47,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
      lineNumber: 46,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/pages/experiments/ExperimentId/DatapointRunsTable.tsx",
    lineNumber: 29,
    columnNumber: 10
  }, this);
};
_c2 = DatapointRunsTable;
var _c2;
$RefreshReg$(_c2, "DatapointRunsTable");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/pages/experiments/ExperimentId/TopCard.tsx
init_remix_hmr();
var import_jsx_dev_runtime3 = __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/ExperimentId/TopCard.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/experiments/ExperimentId/TopCard.tsx"
  );
  import.meta.hot.lastModified = "1711234236157.0327";
}
var TopCard = ({
  title,
  content: Content
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(Card, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(CardHeader, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(CardTitle, { children: title }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/TopCard.tsx",
      lineNumber: 28,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/TopCard.tsx",
      lineNumber: 27,
      columnNumber: 7
    }, this),
    Content && /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(CardContent, { className: "text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(Content, {}, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/TopCard.tsx",
      lineNumber: 31,
      columnNumber: 11
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/TopCard.tsx",
      lineNumber: 30,
      columnNumber: 19
    }, this)
  ] }, void 0, true, {
    fileName: "app/pages/experiments/ExperimentId/TopCard.tsx",
    lineNumber: 26,
    columnNumber: 10
  }, this);
};
_c3 = TopCard;
var _c3;
$RefreshReg$(_c3, "TopCard");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/pages/experiments/ExperimentId/ExperimentIdPage.tsx
var import_jsx_dev_runtime4 = __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/ExperimentId/ExperimentIdPage.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s2 = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx"
  );
  import.meta.hot.lastModified = "1715882071662.73";
}
var ExperimentIdPage = ({
  experiment,
  totalDatapointRuns,
  currentPage,
  totalPages,
  stats
}) => {
  _s2();
  const params = useParams();
  const breadcrumbs = [{
    label: "Experiments",
    to: Routes.app.project.env.experiments({
      envId: params.envId,
      projectId: params.projectId
    })
  }, {
    label: experiment.name || "\u2014"
  }];
  const subtitle = () => {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(PageSubtitle, { children: [
      "Run experiments from your codebase to validate your system.",
      " ",
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(PageDocLink, { to: Routes.external.docs.experiments, children: "Experiments Docs." }, void 0, false, {
        fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
        lineNumber: 55,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
      lineNumber: 53,
      columnNumber: 12
    }, this);
  };
  const action = () => {
    const to = Routes.app.project.env.experimentIdEvals({
      projectId: params.projectId,
      envId: params.envId,
      experimentId: experiment.id
    });
    return /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(Link, { to, prefetch: "intent", children: /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(Button, { children: "View Evals" }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
      lineNumber: 65,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
      lineNumber: 64,
      columnNumber: 12
    }, this);
  };
  return /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(PageLayout, { breadcrumbs, subtitle, action, children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("div", { className: "flex flex-col gap-2", children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("div", { className: "flex flex-row items-center gap-1", children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(Target, { size: 20 }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 71,
          columnNumber: 11
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { className: "text-xl font-semibold", children: "Overview" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 72,
          columnNumber: 11
        }, this)
      ] }, void 0, true, {
        fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
        lineNumber: 70,
        columnNumber: 9
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("div", { className: "mb-2 grid grid-cols-3 gap-8", children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(TopCard, { title: "Experiment", content: () => /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("div", { children: [
          /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { children: experiment.description }, void 0, false, {
            fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
            lineNumber: 76,
            columnNumber: 17
          }, this),
          /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { children: [
            "Started on ",
            (0, import_dayjs2.default)(experiment.createdAt).format("MMMM D, h:mm a")
          ] }, void 0, true, {
            fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
            lineNumber: 77,
            columnNumber: 17
          }, this)
        ] }, void 0, true, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 75,
          columnNumber: 56
        }, this) }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 75,
          columnNumber: 11
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(TopCard, { title: "Dataset", content: () => /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("div", { children: [
          /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { className: "flex items-center", children: [
            experiment.dataset.name,
            /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(Link, { className: "hover:text-accent-foreground pl-1", to: Routes.app.project.env.datasetsId({
              projectId: params.projectId,
              envId: params.envId,
              datasetId: experiment.dataset.id
            }), prefetch: "intent", children: /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(ExternalLinkIcon, {}, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
              lineNumber: 87,
              columnNumber: 21
            }, this) }, void 0, false, {
              fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
              lineNumber: 82,
              columnNumber: 19
            }, this)
          ] }, void 0, true, {
            fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
            lineNumber: 80,
            columnNumber: 17
          }, this),
          /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { children: experiment.dataset.description }, void 0, false, {
            fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
            lineNumber: 90,
            columnNumber: 17
          }, this),
          /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { children: [
            totalDatapointRuns,
            " datapoints ran"
          ] }, void 0, true, {
            fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
            lineNumber: 91,
            columnNumber: 17
          }, this)
        ] }, void 0, true, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 79,
          columnNumber: 53
        }, this) }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 79,
          columnNumber: 11
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(TopCard, { title: "Stats", content: () => /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("div", { children: [
          /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { children: [
            "$",
            stats.totalCost ? (0, import_numbro.default)(stats.totalCost).format({
              thousandSeparated: true,
              mantissa: stats.totalCost < 1e-3 ? 4 : 2
            }) : "\u2014",
            " ",
            "total cost"
          ] }, void 0, true, {
            fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
            lineNumber: 94,
            columnNumber: 17
          }, this),
          /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { children: [
            stats.avgDuration ? (0, import_numbro.default)(stats.avgDuration).format({
              mantissa: 2
            }) : "\u2014",
            "s avg latency"
          ] }, void 0, true, {
            fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
            lineNumber: 102,
            columnNumber: 17
          }, this)
        ] }, void 0, true, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 93,
          columnNumber: 51
        }, this) }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 93,
          columnNumber: 11
        }, this)
      ] }, void 0, true, {
        fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
        lineNumber: 74,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
      lineNumber: 69,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("div", { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("div", { className: "flex flex-row items-center gap-1", children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(Play, { size: 20 }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 112,
          columnNumber: 11
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { className: "text-xl font-semibold", children: "Runs" }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 113,
          columnNumber: 11
        }, this)
      ] }, void 0, true, {
        fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
        lineNumber: 111,
        columnNumber: 9
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("p", { className: "text-muted-foreground mb-4", children: [
        "Each run is a datapoint from the dataset that was executed in this experiment.",
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(PageDocLink, { to: Routes.external.docs.runs, children: "Run Docs." }, void 0, false, {
          fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
          lineNumber: 117,
          columnNumber: 11
        }, this)
      ] }, void 0, true, {
        fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
        lineNumber: 115,
        columnNumber: 9
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(DatapointRunsTable, { datapointRuns: experiment.datapointRuns, currentPage, totalPages }, void 0, false, {
        fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
        lineNumber: 119,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
      lineNumber: 110,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/pages/experiments/ExperimentId/ExperimentIdPage.tsx",
    lineNumber: 68,
    columnNumber: 10
  }, this);
};
_s2(ExperimentIdPage, "+jVsTcECDRo3yq2d7EQxlN9Ixog=", false, function() {
  return [useParams];
});
_c4 = ExperimentIdPage;
var _c4;
$RefreshReg$(_c4, "ExperimentIdPage");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/pages/experiments/utils.ts
init_remix_hmr();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/experiments/utils.ts"
  );
  import.meta.hot.lastModified = "1715882071664.6033";
}
var formatExperimentRunDates = (experiment, timezone) => {
  const formattedRuns = experiment.datapointRuns.map((run) => ({
    ...run,
    createdAt: (0, import_dayjs.default)(run.createdAt).tz(timezone).format("h:mm:ss a")
  }));
  return {
    ...experiment,
    datapointRuns: formattedRuns
  };
};

// app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/$experimentId+/index.tsx
var import_timezone = __toESM(require_timezone(), 1);
var import_jsx_dev_runtime5 = __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+/$experimentId+/index.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s3 = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/$experimentId+/index.tsx"
  );
  import.meta.hot.lastModified = "1715882071672.9153";
}
var loader = withAuth(async ({
  request,
  api,
  params
}) => {
  const experimentId = params.experimentId;
  const {
    searchParams
  } = new URL(request.url);
  const page = parseInt(searchParams.get("page") || "1");
  const pageSize = 20;
  const skipAmount = (page - 1) * pageSize;
  const {
    experiment,
    totalDatapointRuns,
    stats
  } = await api.experiment.experimentControllerGetPaginatedExperimentWithDatapointRuns({
    experimentId,
    take: pageSize.toString(),
    skip: skipAmount.toString()
  });
  const timezone = await (0, import_timezone.getTimezone)(request);
  const formattedExperiment = formatExperimentRunDates(experiment, timezone);
  const totalPages = Math.ceil(totalDatapointRuns / pageSize);
  return (0, import_node.json)({
    experiment: formattedExperiment,
    totalDatapointRuns,
    currentPage: page,
    totalPages,
    timezone,
    stats
  });
});
function ExperimentIdRoute() {
  _s3();
  const {
    experiment,
    totalDatapointRuns,
    currentPage,
    totalPages,
    timezone,
    stats
  } = useLoaderData();
  const formattedExperiment = timezone ? experiment : formatExperimentRunDates(experiment, timezone);
  return /* @__PURE__ */ (0, import_jsx_dev_runtime5.jsxDEV)(ExperimentIdPage, { experiment: formattedExperiment, totalDatapointRuns, currentPage, totalPages, stats }, void 0, false, {
    fileName: "app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/$experimentId+/index.tsx",
    lineNumber: 74,
    columnNumber: 10
  }, this);
}
_s3(ExperimentIdRoute, "0XEew6L/7FML5ELx20hH6ih2f+0=", false, function() {
  return [useLoaderData];
});
_c5 = ExperimentIdRoute;
var _c5;
$RefreshReg$(_c5, "ExperimentIdRoute");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;
export {
  ExperimentIdRoute as default
};
//# sourceMappingURL=/build/routes/app+/project+/$projectId+/env+/$envId+/experiments+/$experimentId+/index-EPBCSF3F.js.map
