import{j as e}from"./@radix-D8tIKeo-.js";import{S as a}from"./trash-Dp8wQrEE.js";import{D as i,a as d}from"./DeleteAlertDialog-DbZA_NGz.js";import{J as u,N as m,O as D,Q as j,R as f,U as g,K as R,B as b,L as c}from"./index-B44sgOyQ.js";import{a as h}from"./@monaco-editor-CuNQBT0l.js";import{c as w}from"./helper-Bk0vl-dI.js";import{u as C}from"./delete-run-ApKnxGry.js";import{u as y}from"./bulk-delete-0rjuYwfx.js";const{ContextProvider:M,useContext:l}=w();function p(){const{setRowSelection:n}=l(),{mutateAsync:s}=C();async function t(r){await s({runId:r})}return y({deleteFn:t,queryKeyToInvalidate:["runs"],setRowSelection:n})}function $({id:n}){const[s,t]=h.useState(!1),{bulkDelete:r}=p();async function o(){await r([n]),t(!1)}return e.jsxs(e.Fragment,{children:[e.jsx(u,{open:s,onOpenChange:t,children:e.jsx(i,{title:"Delete Run",handleDelete:o,children:e.jsxs(d,{children:[e.jsx("p",{children:"Are you sure?"}),e.jsx("p",{children:"This action cannot be undone."})]})})}),e.jsxs(m,{children:[e.jsx(D,{asChild:!0,children:e.jsx(j,{children:e.jsx("span",{className:"sr-only",children:"Open run actions"})})}),e.jsx(f,{align:"end",sideOffset:7,children:e.jsx(g,{onSelect:()=>t(!0),icon:e.jsx(a,{}),children:"Delete"})})]})]})}function v(){const[n,s]=h.useState(!1),{selectedRowCount:t,selectedRowIDs:r}=l(),{bulkDelete:o}=p();async function x(){await o(r),s(!1)}return e.jsxs(u,{open:n,onOpenChange:s,children:[e.jsx(R,{asChild:!0,children:e.jsxs(b,{className:"rounded-sharp border-y-0 bg-white",size:"md",emphasis:"subtle",intent:"secondary",children:[e.jsx(a,{className:"h-5 w-5 shrink-0 gap-1 fill-neutral-400"}),"Delete"]})}),e.jsx(i,{title:`Delete ${c(t,"Run")}`,handleDelete:x,children:e.jsxs(d,{children:[e.jsx("p",{children:"Are you sure?"}),e.jsx("p",{children:"This action cannot be undone."})]})})]})}function z(){const{selectedRowCount:n}=l();return e.jsxs("div",{className:"flex items-center divide-x divide-theme-border-moderate overflow-hidden rounded-md border border-theme-border-moderate",children:[e.jsx("div",{className:"bg-primary-25 px-2 py-1 font-semibold text-theme-text-brand",children:`${n} ${c(n,"Run")} selected`}),e.jsx(v,{})]})}export{M as R,$ as a,z as b,l as u};
