import{a as D,b as g}from"/build/_shared/chunk-OHXAE2AT.js";import"/build/_shared/chunk-XN75JBKL.js";import{a as b}from"/build/_shared/chunk-IR4JM7DR.js";import{a as v}from"/build/_shared/chunk-ZGIETDW3.js";import"/build/_shared/chunk-4GQGFAPU.js";import{a as n}from"/build/_shared/chunk-NN3FAUXK.js";import{a as h}from"/build/_shared/chunk-WL3EVROT.js";import"/build/_shared/chunk-EBHCYYOH.js";import"/build/_shared/chunk-5G5YQZRT.js";import{a as L}from"/build/_shared/chunk-BPD542OA.js";import"/build/_shared/chunk-BKXSGWW3.js";import"/build/_shared/chunk-7Z6LVCRT.js";import"/build/_shared/chunk-FXRQ2H3S.js";import"/build/_shared/chunk-GYJW4R24.js";import{c as K}from"/build/_shared/chunk-VX2L2R2M.js";import"/build/_shared/chunk-JSLPGHFC.js";import"/build/_shared/chunk-NF7BQEED.js";import"/build/_shared/chunk-ZH5DBAIE.js";import{a as A}from"/build/_shared/chunk-PAEG26CW.js";import"/build/_shared/chunk-F4G4S474.js";import{B as y,C as i,a as O,e as l,u as d,w as u}from"/build/_shared/chunk-XIQ3C74K.js";import{a as W}from"/build/_shared/chunk-5TRFQBKG.js";import"/build/_shared/chunk-T6T2AEVA.js";import{a as f}from"/build/_shared/chunk-LR6G3KVW.js";import{d as t}from"/build/_shared/chunk-G5WX4PPA.js";var P=t(W(),1);y();y();var I=t(O(),1);var e=t(i(),1),j=({sortedEnvironments:r})=>{let o=l(),p=u(),s=v()?.project?.openaiApiKey,[a,C]=(0,I.useState)(s),F=[{label:"API Keys"}],S=()=>{p.submit({key:a},{method:"POST",action:f.actions.project.setOpenAIKey(o.projectId),encType:"application/json"})},w=a===s,m=p.data?.project.openaiApiKey,c=p.state==="idle"&&m&&a.startsWith(m.replaceAll("*",""));return(0,e.jsx)(L,{breadcrumbs:F,children:(0,e.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(n,{children:"Montelo"}),(0,e.jsx)(D,{sortedEnvironments:r,projectId:o.projectId})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)(n,{children:"OpenAI"}),(0,e.jsx)("p",{className:"text-muted-foreground text-sm",children:"Your OpenAI key will only be used for Fine-Tuning."}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(b,{className:"w-1/3",placeholder:"sk-...",value:a,onChange:N=>C(N.target.value)}),(0,e.jsxs)(h,{onClick:S,disabled:w,className:"flex gap-1",children:[c&&(0,e.jsx)(K,{className:"h-4 w-4"}),c?"Saved":"Save"]})]})]})]})})};var x=t(i(),1),$=A(async({api:r})=>{let o=await r.apiKey.apiKeyControllerGetApiKeysForProject();return(0,P.json)(o)});function E(){let r=d(),o=g(r||[]);return(0,x.jsx)(j,{sortedEnvironments:o})}export{E as default};
