import{r as m,j as e}from"./@radix-DeK6qiuw.js";import{t as u}from"./zod-BwEbpOxH.js";import{z as l,ao as p,aD as f,ap as x,I as h,aE as j,ar as D,f as o,n as E,F as g,p as y,q as A}from"./index-CCOPpudF.js";import{u as C}from"./index.esm-Dy6Z9Ung.js";import{b}from"./@tanstack-DT5WLu9C.js";const T=l.object({delete:l.string()}).refine(t=>t.delete==="DELETE",{message:"Please type DELETE to confirm"}),N=m.forwardRef(({handleDelete:t,title:a,children:s},r)=>{const{register:n,handleSubmit:i,formState:{isValid:c}}=C({resolver:u(T),defaultValues:{delete:""}});return e.jsxs(p,{ref:r,children:[e.jsx(f,{children:e.jsx(x,{children:a})}),e.jsxs("form",{onSubmit:i(()=>t()),id:"delete-form",className:"space-y-5 p-5",children:[s,e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"mb-0.5 text-text-sm",children:"Please type DELETE to confirm"}),e.jsx(h,{onPaste:d=>d.preventDefault(),...n("delete"),className:"w-full"})]})]}),e.jsxs(j,{className:"gap-[10px]",children:[e.jsx(D,{asChild:!0,children:e.jsx(o,{size:"sm",intent:"secondary",children:"Cancel"})}),e.jsx(o,{form:"delete-form",disabled:!c,intent:"danger",type:"submit",children:"Delete"})]})]})});N.displayName="DeleteAlertContent";function S({children:t,className:a}){return e.jsx("div",{className:E("text-text-md text-theme-text-secondary",a),children:t})}async function w({runId:t}){const a=y(A.runs.detail(t)),s=await fetch(a,{method:"DELETE",credentials:"include",headers:{"Content-Type":"application/json"}});if(!s.ok){const r=await s.json().then(n=>n.detail).catch(()=>`Failed to delete run ${t}`);throw new g({status:s.status,statusText:s.statusText,message:r})}return s.json()}function z(t){return b({mutationFn:w,...t})}export{N as D,S as a,z as u};
