import {
  Badge,
  idShortener
} from "/build/_shared/chunk-KSAJCXX3.js";
import {
  Table,
  TableBody,
  TableCell,
  TableHead,
  TableHeader,
  TableRow
} from "/build/_shared/chunk-F5GZ2BM6.js";
import {
  Button
} from "/build/_shared/chunk-ZESRKRPI.js";
import {
  require_dayjs_min
} from "/build/_shared/chunk-RFBEIH4W.js";
import {
  PageDocLink
} from "/build/_shared/chunk-TPFG27GP.js";
import {
  PageSubtitle
} from "/build/_shared/chunk-Z534YQLL.js";
import "/build/_shared/chunk-4CHLX6OP.js";
import {
  ExternalLink
} from "/build/_shared/chunk-EEPFRJZL.js";
import {
  require_lodash
} from "/build/_shared/chunk-MZIT35JI.js";
import {
  LoadingSpinner
} from "/build/_shared/chunk-FU25ZMLT.js";
import {
  PageLayout
} from "/build/_shared/chunk-IVHXUM2B.js";
import "/build/_shared/chunk-P2DAPPQF.js";
import {
  usePaidGuard
} from "/build/_shared/chunk-W2WK7NJF.js";
import "/build/_shared/chunk-527IW2Z6.js";
import "/build/_shared/chunk-AI5FD5Y6.js";
import "/build/_shared/chunk-CUOCTUZ2.js";
import {
  require_jsx_dev_runtime
} from "/build/_shared/chunk-D5XSJF2M.js";
import {
  Link,
  init_esm2 as init_esm,
  useLoaderData,
  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 {
  FineTuneWithDatasetDtoProviderEnum,
  FineTuneWithDatasetDtoStatusEnum,
  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+/finetuning+/index.tsx
init_remix_hmr();
var import_node = __toESM(require_node(), 1);
init_esm();

// app/pages/finetuning/FineTuningPage.tsx
init_remix_hmr();

// app/pages/finetuning/FineTunesTable.tsx
init_remix_hmr();

// app/pages/finetuning/FineTuneCell.tsx
init_remix_hmr();
init_esm();
var import_dayjs = __toESM(require_dayjs_min(), 1);
var import_lodash = __toESM(require_lodash(), 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/pages/finetuning/FineTuneCell.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/finetuning/FineTuneCell.tsx"
  );
  import.meta.hot.lastModified = "1715882071664.867";
}
var FineTuneCell = ({
  finetune
}) => {
  _s();
  const params = useParams();
  const metadata = finetune.metadata;
  const {
    variant
  } = idShortener(finetune.id);
  const toMap = {
    [FineTuneWithDatasetDtoProviderEnum.Openai]: `https://platform.openai.com/finetune/${metadata.id}`,
    [FineTuneWithDatasetDtoProviderEnum.Montelo]: null,
    [FineTuneWithDatasetDtoProviderEnum.Cohere]: `https://dashboard.cohere.com/fine-tuning/custom/${metadata.id}`
  };
  const nameMap = {
    [FineTuneWithDatasetDtoProviderEnum.Openai]: metadata.fine_tuned_model,
    [FineTuneWithDatasetDtoProviderEnum.Montelo]: metadata.fireworksFineTuneId,
    [FineTuneWithDatasetDtoProviderEnum.Cohere]: metadata.id
  };
  const to = toMap[finetune.provider];
  const name = nameMap[finetune.provider];
  const showLoader = finetune.status === FineTuneWithDatasetDtoStatusEnum.Pending || finetune.status === FineTuneWithDatasetDtoStatusEnum.Running || finetune.status === FineTuneWithDatasetDtoStatusEnum.Deploying;
  return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableRow, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: name ? /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Badge, { variant, children: name }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 55,
      columnNumber: 26
    }, this) : "\u2014" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 55,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Link, { to: Routes.app.project.env.datasetsId({
      projectId: params.projectId,
      envId: params.envId,
      datasetId: finetune.dataset.id
    }), className: "flex gap-1", children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(ExternalLink, { className: "h-4 w-4" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTuneCell.tsx",
        lineNumber: 62,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("p", { children: finetune.dataset.name }, void 0, false, {
        fileName: "app/pages/finetuning/FineTuneCell.tsx",
        lineNumber: 63,
        columnNumber: 11
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 57,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 56,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: finetune.model }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 66,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { className: "flex", children: [
      showLoader ? /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(LoadingSpinner, { size: 20 }, void 0, false, {
        fileName: "app/pages/finetuning/FineTuneCell.tsx",
        lineNumber: 68,
        columnNumber: 23
      }, this) : null,
      "\xA0",
      import_lodash.default.capitalize(finetune.status)
    ] }, void 0, true, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 67,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: finetune.startedAt ? (0, import_dayjs.default)(finetune.startedAt).format("h:mma D/M/YY") : "\u2014" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 70,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: finetune.endedAt ? (0, import_dayjs.default)(finetune.endedAt).format("h:mma D/M/YY") : "\u2014" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 71,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: to ? /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Link, { to, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(ExternalLink, { className: "h-4 w-4" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 74,
      columnNumber: 13
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 73,
      columnNumber: 15
    }, this) : null }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 72,
      columnNumber: 7
    }, this)
  ] }, finetune.id, true, {
    fileName: "app/pages/finetuning/FineTuneCell.tsx",
    lineNumber: 54,
    columnNumber: 10
  }, this);
};
_s(FineTuneCell, "+jVsTcECDRo3yq2d7EQxlN9Ixog=", false, function() {
  return [useParams];
});
_c = FineTuneCell;
var _c;
$RefreshReg$(_c, "FineTuneCell");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/pages/finetuning/FineTunesTable.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/finetuning/FineTunesTable.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/finetuning/FineTunesTable.tsx"
  );
  import.meta.hot.lastModified = "1715882071665.1863";
}
var FineTunesTable = ({
  fineTunes
}) => {
  _s2();
  const {
    isBasicPlan
  } = usePaidGuard();
  return isBasicPlan ? /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)("div", { className: "text-center", children: /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)("p", { children: "Upgrade to Pro to create fine-tuned models." }, void 0, false, {
    fileName: "app/pages/finetuning/FineTunesTable.tsx",
    lineNumber: 33,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/pages/finetuning/FineTunesTable.tsx",
    lineNumber: 32,
    columnNumber: 24
  }, this) : /* @__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: "Name" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 37,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Dataset" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 38,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Base Model" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 39,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Status" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 40,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Started" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 41,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Ended" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 42,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Actions" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 43,
        columnNumber: 11
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 36,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 35,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableBody, { children: fineTunes.length ? fineTunes.map((finetune) => /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(FineTuneCell, { finetune }, finetune.id, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 47,
      columnNumber: 55
    }, this)) : /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableCell, { colSpan: 8, className: "h-24 text-center", children: "No fine-tunes" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 48,
      columnNumber: 13
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 47,
      columnNumber: 113
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 46,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/pages/finetuning/FineTunesTable.tsx",
    lineNumber: 34,
    columnNumber: 14
  }, this);
};
_s2(FineTunesTable, "qIpv8I5yWgplXNtltCSDNf8H1Yc=", false, function() {
  return [usePaidGuard];
});
_c2 = FineTunesTable;
var _c2;
$RefreshReg$(_c2, "FineTunesTable");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/pages/finetuning/FineTuningPage.tsx
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/finetuning/FineTuningPage.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/finetuning/FineTuningPage.tsx"
  );
  import.meta.hot.lastModified = "1715882071665.4194";
}
var FineTuningPage = ({
  fineTunes
}) => {
  const breadcrumbs = [{
    label: "Fine-Tuning"
  }];
  const subtitle = () => {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(PageSubtitle, { children: [
      "Fine-tune models using your datasets.",
      " ",
      /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(PageDocLink, { to: Routes.external.docs.fineTuning, children: "Fine-Tuning Docs." }, void 0, false, {
        fileName: "app/pages/finetuning/FineTuningPage.tsx",
        lineNumber: 36,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/finetuning/FineTuningPage.tsx",
      lineNumber: 34,
      columnNumber: 12
    }, this);
  };
  const action = () => {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)("div", { className: "flex gap-2", children: /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(Button, { children: "Create Fine-Tune" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuningPage.tsx",
      lineNumber: 41,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuningPage.tsx",
      lineNumber: 40,
      columnNumber: 12
    }, this);
  };
  return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(PageLayout, { breadcrumbs, subtitle, children: /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(FineTunesTable, { fineTunes }, void 0, false, {
    fileName: "app/pages/finetuning/FineTuningPage.tsx",
    lineNumber: 45,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/pages/finetuning/FineTuningPage.tsx",
    lineNumber: 44,
    columnNumber: 10
  }, this);
};
_c3 = FineTuningPage;
var _c3;
$RefreshReg$(_c3, "FineTuningPage");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/routes/app+/project+/$projectId+/env+/$envId+/finetuning+/index.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/routes/app+/project+/$projectId+/env+/$envId+/finetuning+/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+/finetuning+/index.tsx"
  );
  import.meta.hot.lastModified = "1715882071673.401";
}
var loader = withAuth(async ({
  api,
  params
}) => {
  const envId = params.envId;
  const fineTunes = await api.fineTuning.finetuneControllerGetFineTunesForEnv({
    envId
  });
  return (0, import_node.json)({
    fineTunes
  });
});
function FineTuningRoute() {
  _s3();
  const {
    fineTunes
  } = useLoaderData();
  return /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(FineTuningPage, { fineTunes }, void 0, false, {
    fileName: "app/routes/app+/project+/$projectId+/env+/$envId+/finetuning+/index.tsx",
    lineNumber: 43,
    columnNumber: 10
  }, this);
}
_s3(FineTuningRoute, "0Ul24eL5+2zQi818BQhz8YWbQWw=", false, function() {
  return [useLoaderData];
});
_c4 = FineTuningRoute;
var _c4;
$RefreshReg$(_c4, "FineTuningRoute");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;
export {
  FineTuningRoute as default
};
//# sourceMappingURL=/build/routes/app+/project+/$projectId+/env+/$envId+/finetuning+/index-KJKZPBWX.js.map
