import{r as a,aJ as e}from"./@ui-core-DKdciH1Z.js";import{bt as m,L as i,Q as d,R as c,V as D,W as j,X as f,Y as g,Z as b,O as u,N as R,B as w,U as h}from"./index-D7KLAbvI.js";import{c as C}from"./helper-DWeonard.js";import{u as y}from"./bulk-delete-C2Plj5jD.js";const{ContextProvider:S,useContext:l}=C();function x(){const{setRowSelection:n}=l(),{mutateAsync:s}=m();async function t(r){await s({runId:r})}return y({deleteFn:t,queryKeyToInvalidate:["runs"],setRowSelection:n})}function N({id:n}){const[s,t]=a.useState(!1),{bulkDelete:r}=x();async function o(){await r([n]),t(!1)}return e.jsxs(e.Fragment,{children:[e.jsx(i,{open:s,onOpenChange:t,children:e.jsx(d,{title:"Delete Run",handleDelete:o,children:e.jsxs(c,{children:[e.jsx("p",{children:"Are you sure?"}),e.jsx("p",{children:"This action cannot be undone."})]})})}),e.jsxs(D,{children:[e.jsx(j,{asChild:!0,children:e.jsx(f,{children:e.jsx("span",{className:"sr-only",children:"Open run actions"})})}),e.jsx(g,{align:"end",sideOffset:7,children:e.jsx(b,{onSelect:()=>t(!0),icon:e.jsx(u,{}),children:"Delete"})})]})]})}function v(){const[n,s]=a.useState(!1),{selectedRowCount:t,selectedRowIDs:r}=l(),{bulkDelete:o}=x();async function p(){await o(r),s(!1)}return e.jsxs(i,{open:n,onOpenChange:s,children:[e.jsx(R,{asChild:!0,children:e.jsxs(w,{className:"rounded-sharp border-y-0 bg-white",size:"md",emphasis:"subtle",intent:"secondary",children:[e.jsx(u,{className:"h-5 w-5 shrink-0 gap-1 fill-neutral-400"}),"Delete"]})}),e.jsx(d,{title:`Delete ${h(t,"Run")}`,handleDelete:p,children:e.jsxs(c,{children:[e.jsx("p",{children:"Are you sure?"}),e.jsx("p",{children:"This action cannot be undone."})]})})]})}function k(){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} ${h(n,"Run")} selected`}),e.jsx(v,{})]})}export{S as R,N as a,k as b,l as u};
