1import{r as a,aP as t,dv as y,i9 as C,f5 as k}from"../../vendors/vendor-YUfIzhZH-1791218974056.js";import{t as v,f as S,s as L,l as i}from"../../sprint-planning/sprint-planning-core-D8DFNeL2-1791218975454.js";import{a0 as $}from"../../PostAuthShell-CGTWuJSs-1791218975571.js";import"../../index-BqcUo8yk-1791218901832.js";import"../../stripe-DXSJviaI-1791218975691.js";import"../../usageCredit-qfbiNRjQ-1791218975691.js";import"../../pushServiceWorkerRegistration-DqD1wY4R-1791218975571.js";import"../../useOnboardingV2-BaJC-1WO-1791218975691.js";import"../../onboardingFlowConfig-Bvk52W2j-1791218975692.js";import"../../runHandoff-ylshTy2o-1791218975692.js";import"../../founder-run-entry-CnqzgYiQ-1791218975692.js";import"../../vendors/charts-DyYnQkLd-1791218975263.js";import"../../vendors/export-tools-B8MmWLNG-1791218975334.js";const j={high:"High alignment",medium:"Medium alignment",low:"Low alignment",not_scored:"Not scored"},M={high:"text-emerald-500",medium:"text-amber-500",low:"text-red-500",not_scored:"text-muted-foreground"};function A(r){try{const s=r?.data?.data?.[0];return!s||!Array.isArray(s.items)?null:s}catch{return null}}function E(r){if(!r)return"secondary";const s=r.toLowerCase();return s.includes("done")||s.includes("closed")||s.includes("resolved")?"success":s.includes("progress")||s.includes("active")||s.includes("review")?"warning":s.includes("block")||s.includes("reject")?"destructive":"secondary"}function B(r){return r.map(s=>`"${s.title||"Untitled"}" (id ${s.id})`).join(", ")}function I(r){if(r.length===0)return[];const s=B(r),o=[{id:"create-brief",label:r.length===1?"Create a brief":"Create briefs",message:r.length===1?`Create a brief for ${s}. Carry over a success metric if we have agreed one.`:`Create a brief for each of these: ${s}. Carry over a success metric if we have agreed one.`}];return r.every(c=>c.type?.toLowerCase()==="epic")&&o.push({id:"break-into-stories",label:"Break into stories",message:`Break ${s} into stories.`}),o}function V({artifact:r}){const s=A(r),o=$(e=>e.queueMessage),[l,c]=a.useState(()=>new Set),u=a.useMemo(()=>s?.items??[],[s]),N=a.useCallback(e=>{c(d=>{const n=new Set(d);return n.has(e)?n.delete(e):n.add(e),n})},[]),m=a.useCallback(()=>c(new Set),[]),x=a.useMemo(()=>u.filter(e=>e.id&&l.has(e.id)),[u,l]),f=a.useMemo(()=>I(x),[x]),w=a.useCallback(e=>{o(e),m()},[o,m]);if(!s||s.items.length===0)return t.jsx("div",{"data-testid":"renderer-work-items",className:"flex items-center justify-center p-8 text-muted-foreground text-sm",children:"No work items found"});const{totalCount:g,returnedCount:p,alignmentCoverage:h}=s;return t.jsxs("div",{"data-testid":"renderer-work-items",className:"flex flex-col gap-3 p-4",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(y,{className:"w-4 h-4 text-muted-foreground"}),t.jsxs("span",{className:"text-sm font-semibold text-foreground",children:[p," of ",g," items"]})]}),h&&h.averageOfScored!=null&&t.jsxs(v,{variant:"secondary",size:"sm",children:["Avg alignment: ",Math.round(h.averageOfScored*100),"%"]})]}),t.jsx("div",{className:"space-y-1.5 max-h-[400px] overflow-y-auto",children:u.map((e,d)=>{const n=!!e.id,b=n&&l.has(e.id);return t.jsx(S,{className:i("border-border/40 transition-colors",b&&"border-primary/60 bg-primary/5"),children:t.jsx(L,{className:"p-0",children:t.jsx("button",{type:"button",disabled:!n,"aria-pressed":n?b:void 0,onClick:n?()=>N(e.id):void 0,"data-testid":`work-item-row-${e.id||d}`,className:i("w-full text-left p-2.5 rounded-lg","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",n?"cursor-pointer hover:bg-muted/40":"cursor-default"),children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("div",{className:i("w-1 h-8 rounded-full flex-shrink-0 mt-0.5 transition-colors",b?"bg-primary":e.priority?.toLowerCase().includes("critical")||e.priority?.toLowerCase().includes("highest")?"bg-red-500":e.priority?.toLowerCase().includes("high")?"bg-orange-500":e.priority?.toLowerCase().includes("medium")?"bg-amber-500":"bg-muted")}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.externalKey&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-mono flex-shrink-0",children:e.externalKey}),t.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:e.title||"Untitled"})]}),t.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.type&&t.jsx(v,{variant:"secondary",size:"xs",className:"capitalize",children:e.type}),e.status&&t.jsx(v,{variant:E(e.status),size:"xs",children:e.status}),e.storyPoints!=null&&t.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-0.5",children:[t.jsx(C,{className:"w-2.5 h-2.5"}),e.storyPoints," SP"]}),e.assignee&&t.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-0.5 truncate max-w-[100px]",children:[t.jsx(k,{className:"w-2.5 h-2.5 flex-shrink-0"}),e.assignee]}),e.alignment&&t.jsx("span",{className:i("text-[10px] font-medium tabular-nums",M[e.alignment]),title:j[e.alignment],"aria-label":j[e.alignment],children:e.alignment==="not_scored"?"Not scored":e.alignmentScore!=null?`${Math.round(e.alignmentScore*100)}% aligned`:`${e.alignment} alignment`})]})]})]})})})},e.id||d)})}),f.length>0&&t.jsxs("div",{"data-testid":"work-items-actions",className:"flex items-center justify-between gap-2 pt-2 border-t border-border/30",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-[11px] text-muted-foreground tabular-nums","aria-live":"polite",children:[x.length," selected"]}),t.jsx("button",{type:"button",onClick:m,"data-testid":"work-items-clear-selection",className:i("text-[11px] text-muted-foreground underline underline-offset-2","hover:text-foreground transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded"),children:"Clear"})]}),t.jsx("div",{className:"flex items-center gap-2",children:f.map(e=>t.jsx("button",{type:"button",onClick:()=>w(e.message),"data-testid":`work-items-action-${e.id}`,className:i("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium","transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","bg-secondary text-secondary-foreground hover:bg-secondary/80"),children:e.label},e.id))})]}),f.length===0&&t.jsx("p",{className:"text-[10px] text-muted-foreground text-center",children:g>p?`Showing ${p} of ${g} â select items to act on them, or ask to filter by status or assignee`:"Select items to act on them"})]})}
1export{I as actionsForSelection,V as default,B as describeSelection};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.