import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cv as t,Gy as n,Hy as r,Ly as i,Sv as a,ap as o,dg as s,kp as c,lh as l,lt as u,sn as d,uv as f,wv as p,xv as m}from"./index-DDwwBb9e.js";import{t as h}from"./persistence-C_-y6wzH.js";var g=e(n()),_=r();function v(){let e=c(),{project:n}=o(),r=(0,g.useRef)(!1),v=l.experiments.saveEvaluationsV3.useMutation();return(0,g.useEffect)(()=>{!n||r.current||(r.current=!0,(async()=>{try{let t=h(u()),r=await v.mutateAsync({projectId:n.id,experimentId:void 0,state:t});e.replace(`/${n.slug}/experiments/workbench/${r.slug}`)}catch(e){console.error(`Failed to create new experiment:`,e)}})())},[n,e,v]),(0,_.jsx)(d,{backgroundColor:`bg.panel`,compactMenu:!0,children:(0,_.jsx)(f,{height:`calc(100vh - 100px)`,children:v.isError?(0,_.jsx)(i,{padding:6,maxWidth:`500px`,children:(0,_.jsxs)(t,{status:`error`,children:[(0,_.jsx)(a,{}),(0,_.jsxs)(s,{align:`start`,gap:1,children:[(0,_.jsx)(p,{children:`Failed to create experiment`}),(0,_.jsx)(m,{children:v.error?.message??`An unexpected error occurred.`})]})]})}):null})})}export{v as default};
//# sourceMappingURL=workbench-CeX3eWTi.js.map