@useorgx/openclaw-plugin 0.7.16 → 0.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{C3PrI8L7.js → 05zHA1Am.js} +1 -1
- package/dashboard/dist/assets/05zHA1Am.js.br +0 -0
- package/dashboard/dist/assets/05zHA1Am.js.gz +0 -0
- package/dashboard/dist/assets/{JDPvhd68.js → 0uYJrBLl.js} +1 -1
- package/dashboard/dist/assets/0uYJrBLl.js.br +0 -0
- package/dashboard/dist/assets/0uYJrBLl.js.gz +0 -0
- package/dashboard/dist/assets/{8pbG6uLK.js → 8nr6IqT4.js} +1 -1
- package/dashboard/dist/assets/8nr6IqT4.js.br +0 -0
- package/dashboard/dist/assets/8nr6IqT4.js.gz +0 -0
- package/dashboard/dist/assets/{R6N_VVqm.js → B7kFLPiD.js} +1 -1
- package/dashboard/dist/assets/B7kFLPiD.js.br +0 -0
- package/dashboard/dist/assets/B7kFLPiD.js.gz +0 -0
- package/dashboard/dist/assets/{Cn8sRTkO.js → B8NuBCcY.js} +1 -1
- package/dashboard/dist/assets/B8NuBCcY.js.br +0 -0
- package/dashboard/dist/assets/B8NuBCcY.js.gz +0 -0
- package/dashboard/dist/assets/{D5IgXoTj.js → BDlKSbsp.js} +1 -1
- package/dashboard/dist/assets/BDlKSbsp.js.br +0 -0
- package/dashboard/dist/assets/BDlKSbsp.js.gz +0 -0
- package/dashboard/dist/assets/C8AYbjlq.js +212 -0
- package/dashboard/dist/assets/C8AYbjlq.js.br +0 -0
- package/dashboard/dist/assets/C8AYbjlq.js.gz +0 -0
- package/dashboard/dist/assets/{BkMrrjAv.js → CMir7ekf.js} +1 -1
- package/dashboard/dist/assets/CMir7ekf.js.br +0 -0
- package/dashboard/dist/assets/CMir7ekf.js.gz +0 -0
- package/dashboard/dist/assets/{cEP7N1dn.js → CWXk6UZl.js} +1 -1
- package/dashboard/dist/assets/CWXk6UZl.js.br +0 -0
- package/dashboard/dist/assets/CWXk6UZl.js.gz +0 -0
- package/dashboard/dist/assets/{konqMbVI.js → CoDun8X6.js} +1 -1
- package/dashboard/dist/assets/CoDun8X6.js.br +0 -0
- package/dashboard/dist/assets/CoDun8X6.js.gz +0 -0
- package/dashboard/dist/assets/{CUXb_4F3.js → Crj3jKHE.js} +1 -1
- package/dashboard/dist/assets/Crj3jKHE.js.br +0 -0
- package/dashboard/dist/assets/Crj3jKHE.js.gz +0 -0
- package/dashboard/dist/assets/{wc6cgXzV.js → CyUpNSKv.js} +1 -1
- package/dashboard/dist/assets/CyUpNSKv.js.br +0 -0
- package/dashboard/dist/assets/CyUpNSKv.js.gz +0 -0
- package/dashboard/dist/assets/{Bv_86bUY.js → D8mvKY2h.js} +1 -1
- package/dashboard/dist/assets/D8mvKY2h.js.br +0 -0
- package/dashboard/dist/assets/D8mvKY2h.js.gz +0 -0
- package/dashboard/dist/assets/{C6AqbA9J.js → DBRLnKWw.js} +1 -1
- package/dashboard/dist/assets/DBRLnKWw.js.br +0 -0
- package/dashboard/dist/assets/DBRLnKWw.js.gz +0 -0
- package/dashboard/dist/assets/{BpF7v1Dk.js → DBct8HLW.js} +1 -1
- package/dashboard/dist/assets/DBct8HLW.js.br +0 -0
- package/dashboard/dist/assets/DBct8HLW.js.gz +0 -0
- package/dashboard/dist/assets/{BM75sh1f.js → DLNTxNX-.js} +1 -1
- package/dashboard/dist/assets/DLNTxNX-.js.br +0 -0
- package/dashboard/dist/assets/DLNTxNX-.js.gz +0 -0
- package/dashboard/dist/assets/{BYVYH9CH.js → DdYkuATV.js} +1 -1
- package/dashboard/dist/assets/DdYkuATV.js.br +0 -0
- package/dashboard/dist/assets/DdYkuATV.js.gz +0 -0
- package/dashboard/dist/assets/{DXzpQUC0.js → DvFumX8R.js} +1 -1
- package/dashboard/dist/assets/DvFumX8R.js.br +0 -0
- package/dashboard/dist/assets/DvFumX8R.js.gz +0 -0
- package/dashboard/dist/assets/RZkbqlJk.css +1 -0
- package/dashboard/dist/assets/RZkbqlJk.css.br +0 -0
- package/dashboard/dist/assets/RZkbqlJk.css.gz +0 -0
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/index.html.br +0 -0
- package/dashboard/dist/index.html.gz +0 -0
- package/package.json +1 -1
- package/dashboard/dist/assets/8pbG6uLK.js.br +0 -0
- package/dashboard/dist/assets/8pbG6uLK.js.gz +0 -0
- package/dashboard/dist/assets/B1LENRC8.js +0 -212
- package/dashboard/dist/assets/B1LENRC8.js.br +0 -0
- package/dashboard/dist/assets/B1LENRC8.js.gz +0 -0
- package/dashboard/dist/assets/BM75sh1f.js.br +0 -0
- package/dashboard/dist/assets/BM75sh1f.js.gz +0 -0
- package/dashboard/dist/assets/BYVYH9CH.js.br +0 -0
- package/dashboard/dist/assets/BYVYH9CH.js.gz +0 -0
- package/dashboard/dist/assets/BkMrrjAv.js.br +0 -0
- package/dashboard/dist/assets/BkMrrjAv.js.gz +0 -0
- package/dashboard/dist/assets/BpF7v1Dk.js.br +0 -0
- package/dashboard/dist/assets/BpF7v1Dk.js.gz +0 -0
- package/dashboard/dist/assets/Bv_86bUY.js.br +0 -0
- package/dashboard/dist/assets/Bv_86bUY.js.gz +0 -0
- package/dashboard/dist/assets/C3PrI8L7.js.br +0 -0
- package/dashboard/dist/assets/C3PrI8L7.js.gz +0 -0
- package/dashboard/dist/assets/C6AqbA9J.js.br +0 -0
- package/dashboard/dist/assets/C6AqbA9J.js.gz +0 -0
- package/dashboard/dist/assets/CUXb_4F3.js.br +0 -0
- package/dashboard/dist/assets/CUXb_4F3.js.gz +0 -0
- package/dashboard/dist/assets/Cn8sRTkO.js.br +0 -0
- package/dashboard/dist/assets/Cn8sRTkO.js.gz +0 -0
- package/dashboard/dist/assets/D5IgXoTj.js.br +0 -0
- package/dashboard/dist/assets/D5IgXoTj.js.gz +0 -0
- package/dashboard/dist/assets/DXzpQUC0.js.br +0 -0
- package/dashboard/dist/assets/DXzpQUC0.js.gz +0 -0
- package/dashboard/dist/assets/JDPvhd68.js.br +0 -0
- package/dashboard/dist/assets/JDPvhd68.js.gz +0 -0
- package/dashboard/dist/assets/R6N_VVqm.js.br +0 -0
- package/dashboard/dist/assets/R6N_VVqm.js.gz +0 -0
- package/dashboard/dist/assets/cEP7N1dn.js.br +0 -0
- package/dashboard/dist/assets/cEP7N1dn.js.gz +0 -0
- package/dashboard/dist/assets/iLnvdWmW.css +0 -1
- package/dashboard/dist/assets/iLnvdWmW.css.br +0 -0
- package/dashboard/dist/assets/iLnvdWmW.css.gz +0 -0
- package/dashboard/dist/assets/konqMbVI.js.br +0 -0
- package/dashboard/dist/assets/konqMbVI.js.gz +0 -0
- package/dashboard/dist/assets/wc6cgXzV.js.br +0 -0
- package/dashboard/dist/assets/wc6cgXzV.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as t}from"./Dj2k1r16.js";import{i as L,b as C,T as A,a8 as T}from"./
|
|
1
|
+
import{r as o,j as t}from"./Dj2k1r16.js";import{i as L,b as C,T as A,a8 as T}from"./C8AYbjlq.js";function R(c){const i=Date.parse(c);if(!Number.isFinite(i))return null;const s=Date.now()-i,r=s<0,a=Math.abs(s),l=Math.round(a/6e4);if(l<1)return r?"soon":"just now";if(l<60)return r?`in ${l}m`:`${l}m ago`;const u=Math.round(a/36e5);if(u<48)return r?`in ${u}h`:`${u}h ago`;const p=Math.round(a/864e5);return p<30?r?`in ${p}d`:`${p}d ago`:new Date(i).toLocaleDateString()}async function M(c,i){const s=await fetch(c,i);if(!s.ok){const r=await s.json().catch(()=>null),a=typeof(r==null?void 0:r.error)=="string"&&r.error||typeof(r==null?void 0:r.message)=="string"&&r.message||`Request failed (${s.status})`;throw new Error(a)}return await s.json()}function J(c){const{entityType:i,entityId:s,authToken:r,embedMode:a,className:l,variant:u="default"}=c,[p,b]=o.useState(!0),[j,v]=o.useState(!1),[N,x]=o.useState(null),[E,S]=o.useState([]),[h,g]=o.useState(""),m=L(),y=o.useMemo(()=>{const e=encodeURIComponent(i),n=encodeURIComponent(s);return`/orgx/api/entities/${e}/${n}/comments`},[i,s]),f=o.useCallback(async()=>{if(m){S([]),x(null),b(!1);return}b(!0),x(null);try{const e=await M(y,{method:"GET",headers:C({authToken:r,embedMode:a})});S(Array.isArray(e.comments)?e.comments:[])}catch(e){x(e instanceof Error?e.message:String(e))}finally{b(!1)}},[r,m,a,y]);o.useEffect(()=>{f()},[f]);const w=o.useCallback(async()=>{if(m){g("");return}const e=h.trim();if(e){v(!0),x(null);try{await M(y,{method:"POST",headers:C({authToken:r,embedMode:a,contentTypeJson:!0}),body:JSON.stringify({body:e,commentType:"note",severity:"info",tags:[]})}),g(""),await f()}catch(n){x(n instanceof Error?n.message:String(n))}finally{v(!1)}}},[r,h,m,a,y,f]),_=o.useCallback(e=>{e.key==="Enter"&&(!e.metaKey&&!e.ctrlKey||(e.preventDefault(),w()))},[w]),d=u==="inline";return t.jsxs("div",{className:l,children:[t.jsxs("div",{className:d?"space-y-1":"space-y-2",children:[t.jsx("textarea",{value:h,onChange:e=>g(e.target.value),onKeyDown:_,placeholder:"Leave a note for humans or agents...",className:d?"min-h-[60px] w-full resize-y border-b border-white/[0.06] bg-transparent px-0 py-2 text-body text-bright outline-none placeholder:text-faint focus:border-white/15 transition-colors":"min-h-[96px] w-full resize-y rounded-xl border border-white/[0.10] bg-white/[0.03] px-4 py-3 text-body text-bright outline-none placeholder:text-faint focus:border-white/20 focus:bg-white/[0.05] transition-colors"}),t.jsxs("div",{className:`flex flex-wrap items-center justify-between gap-3 ${d?"opacity-70":""}`,children:[t.jsx("p",{className:"text-caption text-muted",children:"Cmd/Ctrl+Enter to post. Visible to agents and collaborators."}),t.jsx("button",{type:"button",onClick:w,disabled:j||h.trim().length===0,className:d?"text-caption font-semibold text-primary hover:text-white transition-colors disabled:opacity-50":"inline-flex items-center justify-center rounded-full border border-strong bg-white/[0.05] px-3.5 py-1.5 text-caption font-semibold tracking-wide text-primary transition-colors hover:bg-white/[0.09] disabled:opacity-50 disabled:hover:bg-white/[0.05]",children:j?"Saving…":"Post note"})]})]}),N?t.jsx("div",{className:`mt-2 text-caption text-red-200 ${d?"":"rounded-xl border border-red-500/20 bg-red-500/10 px-3.5 py-2"}`,children:N}):null,p?t.jsx("div",{className:"mt-2 text-body text-muted",children:"Loading notes…"}):E.length===0?t.jsx(A,{icon:"inbox",headline:"No notes yet",description:m?"Notes are unavailable in demo mode.":"Add a note to keep context for your team and agents.",className:"py-6"}):t.jsx("div",{className:`mt-2 space-y-2 ${d?"divide-y divide-white/[0.06]":"space-y-3"}`,children:E.map(e=>{const n=e.created_at?R(e.created_at):null,k=e.author_name??(e.author_type==="agent"?e.author_id:"Unknown");if(d)return t.jsxs("div",{className:"pt-2 first:pt-0",children:[t.jsxs("div",{className:"flex items-center gap-2 text-micro text-muted",children:[t.jsx("span",{className:"font-medium text-secondary",children:k}),n?t.jsx("span",{title:T(e.created_at),children:n}):null]}),t.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-body leading-relaxed text-primary",children:e.body})]},e.id);const D=e.comment_type??"note",$=typeof e.severity=="string"?e.severity:"info";return t.jsxs("div",{className:"rounded-2xl border border-white/[0.10] bg-white/[0.02] px-4 py-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-body font-semibold text-bright",children:k}),t.jsx("span",{className:"rounded-full border border-strong bg-white/[0.06] px-2 py-0.5 text-micro uppercase tracking-[0.08em] text-secondary",children:e.author_type}),t.jsx("span",{className:"rounded-full border border-strong px-2 py-0.5 text-micro uppercase tracking-[0.08em] text-secondary",children:D}),$!=="info"?t.jsx("span",{className:"rounded-full border border-strong px-2 py-0.5 text-micro uppercase tracking-[0.08em] text-secondary",children:$}):null]}),n?t.jsx("span",{className:"text-caption text-muted",title:T(e.created_at),children:n}):null]}),t.jsx("p",{className:"mt-2 whitespace-pre-wrap text-body leading-relaxed text-primary",children:e.body})]},e.id)})})]})}export{J as E};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as e}from"./Dj2k1r16.js";import{G as Jt,u as Xt,K as b,P as Yt,B as ie,H as ft,T as Ot,C as I,v as Nt,A as kt,E as je,e as bt,h as Ye,D as gt,F as es,U as ts}from"./B1LENRC8.js";import{S as A}from"./DXzpQUC0.js";import{A as ke,m as z,u as jt,R as ss,b as ns,a as is}from"./eeHXe_OQ.js";import{Q as m,d as rs,q as Ue,a as wt,b as yt,c as St,e as Ze}from"./R6N_VVqm.js";async function Ct(s,a){var f;const o=await(await fetch(s,a)).json().catch(()=>null),p=((f=o==null?void 0:o.data)==null?void 0:f.url)??(o==null?void 0:o.url)??null;if(typeof p=="string"&&p.trim())return p.trim();throw new Error((o==null?void 0:o.error)??"Billing link unavailable")}async function as(s){var p;const a=((p=s==null?void 0:s.actions)==null?void 0:p.checkout)??"/orgx/api/billing/checkout",c=((s==null?void 0:s.requiredPlan)??"starter").trim().toLowerCase()||"starter",o=await Ct(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({planId:c})});window.open(o,"_blank","noopener,noreferrer")}async function os(s){var o;const a=((o=s==null?void 0:s.actions)==null?void 0:o.portal)??"/orgx/api/billing/portal",c=await Ct(a,{method:"POST"});window.open(c,"_blank","noopener,noreferrer")}function ls(s){return s==="success"?"border-emerald-400/30 bg-[#0A1210]/95 text-emerald-100":s==="warning"?"border-amber-300/30 bg-[#12100A]/95 text-amber-100":s==="error"?"border-red-400/32 bg-[#120A0A]/95 text-red-100":s==="info"?"border-cyan-300/28 bg-[#0A1012]/95 text-cyan-100":"border-strong bg-[#0B0F16]/95 text-primary"}function cs({open:s,tone:a="neutral",title:c,message:o=null,className:p,primaryAction:f=null,secondaryAction:k=null,onDismiss:S=null,autoDismissMs:q=null}){return l.useEffect(()=>{if(!s||!S||!q)return;const K=window.setTimeout(()=>S(),q);return()=>window.clearTimeout(K)},[q,S,s,c,o]),e.jsx(ke,{initial:!1,children:s?e.jsx(z.div,{initial:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.985},transition:{duration:.2,ease:[.22,1,.36,1]},className:`pointer-events-none ${p??""}`,children:e.jsxs("div",{className:`pointer-events-none min-w-[220px] max-w-[420px] rounded-xl border px-3 py-2 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur ${ls(a)}`,children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-caption font-semibold",children:c}),o?e.jsx("p",{className:"mt-0.5 text-caption opacity-85",children:o}):null]}),S?e.jsx("button",{type:"button",onClick:S,className:"pointer-events-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-current/70 transition-colors hover:bg-white/[0.08] hover:text-current","aria-label":"Dismiss toast",title:"Dismiss",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}):null]}),f||k?e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[k?e.jsx("button",{type:"button",onClick:k.onClick,className:"pointer-events-auto h-7 rounded-md border border-strong bg-white/[0.06] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.12]",children:k.label}):null,f?e.jsx("button",{type:"button",onClick:f.onClick,className:"pointer-events-auto h-7 rounded-md border border-white/25 bg-white/[0.14] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.2]",children:f.label}):null]}):null]})}):null})}function It({className:s=""}){return e.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:e.jsx("path",{d:"M7 5.4v9.2c0 .7.75 1.15 1.38.83l7.6-4.6a.95.95 0 0 0 0-1.62l-7.6-4.64A.95.95 0 0 0 7 5.4Z",fill:"currentColor"})})}function ds({className:s=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:[e.jsx("path",{d:"M6.2 9.4V6.7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.4 8.9V5.8c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.6 8.9V6.2c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M12.8 9.6V7.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v4.2c0 2.7-1.9 4.6-4.6 4.6H9.2c-2.1 0-3.7-1-4.6-2.8l-.9-1.7c-.3-.6 0-1.4.6-1.7.6-.3 1.3 0 1.6.6l.7 1.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function us({className:s=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:[e.jsx("path",{d:"M6.4 9.2V7.4c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v1.3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.6 8.9V7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.8 9.2V7.3c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M13 9.8V8.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v3.6c0 2.4-1.7 4-4.1 4H9.7c-2 0-3.4-.9-4.2-2.5l-.8-1.4c-.3-.6 0-1.3.5-1.6.6-.3 1.2-.1 1.6.5l.6 1",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Je(s){const a=typeof s.sliceTaskCount=="number"&&Number.isFinite(s.sliceTaskCount)?Math.max(0,Math.floor(s.sliceTaskCount)):null,c=s.sliceScope==="task"?"task":s.sliceScope==="milestone"?"milestone slice":"workstream slice",o=a&&a>0?`${a} ${a===1?"task":"tasks"}`:null;return s.queueState===m.RUNNING?o?`Executing ${o} in ${c}.`:"Execution in progress. Task detail will appear as the scheduler advances.":s.queueState===m.BLOCKED?s.blockReason?"Blocked while waiting for dependency resolution.":"Blocked. Waiting for dependency or review.":s.queueState===m.QUEUED?o?`Queued with ${o} in ${c}.`:"Queued at workstream scope. Task detail will populate after dispatch.":s.queueState===m.COMPLETED?"Completed. No queued tasks remain.":"Idle. Ready to dispatch when started."}function qt(s){const a=typeof s.initiativePriority=="string"?s.initiativePriority.trim().toLowerCase():"",c=typeof s.initiativePriorityNum=="number"&&Number.isFinite(s.initiativePriorityNum)?Math.max(1,Math.min(100,Math.round(s.initiativePriorityNum))):null,o=a==="urgent"||a==="high"||a==="medium"||a==="low"?a:c!==null?c<=12?"urgent":c<=30?"high":c<=60?"medium":"low":null;if(!o)return null;const p=o==="urgent"?"P1":o==="high"?"P2":o==="medium"?"P3":"P4",f=o==="urgent"?"Urgent":o==="high"?"High":o==="medium"?"Medium":"Low",k=o==="urgent"?"border-red-300/35 bg-red-500/[0.14] text-red-100":o==="high"?"border-amber-300/35 bg-amber-500/[0.14] text-amber-100":o==="medium"?"border-[#BFFF00]/35 bg-[#BFFF00]/14 text-[#E1FFB2]":"border-white/[0.2] bg-white/[0.08] text-white/70";return{shortLabel:`${p} ${f}`,longLabel:`Initiative priority ${f} (${p})`,toneClass:k}}function ms(s){const a=s.trim().toLowerCase();if(a.includes("timed out")||a.includes("timeout")||a.includes("request cancelled")||a.includes("signal is aborted"))return"Next Up is still syncing. Keep this panel open and it will repopulate automatically.";if(a.includes("unauthorized")||a.includes("forbidden")||a.includes("api key")||a.includes("auth"))return"Next Up is unavailable until OrgX authentication is reconnected in Settings.";if(a.includes("unknown api endpoint")||a.includes("route is unavailable"))return"This runtime is missing queue routes. Restart and update the plugin build.";const c=s.split("|").map(o=>o.trim()).filter(Boolean).map(o=>o.replace(/^[^:]+:\s*/,"").trim()).filter(Boolean).slice(0,2).join(" ");return Ye(c||s)||"Next Up is temporarily unavailable."}function xs(s){const a=s.trim().toLowerCase();return a.includes("circular")||a.includes("timeline estimate")||a.includes("adjusted accordingly")?null:a.includes("timed out")||a.includes("timeout")||a.includes("request cancelled")||a.includes("signal is aborted")?"Signal is delayed right now. Queue data will appear as soon as sync catches up.":a.includes("fallback")?"Showing fallback queue data while full signal refreshes.":a.includes("unknown api endpoint")||a.includes("route is unavailable")?"Some queue controls are unavailable in this plugin build. Update and restart to restore full controls.":Ye(s.trim())}function Se(s,a,c){const o=typeof s=="string"?s.trim():"";if(o&&!gt(o))return I(o);const p=typeof a=="string"?a.trim():"";return p?gt(p)?`${c} ${es(p)}`:I(p):c}function $t(s){const a=typeof s.runnerAgentName=="string"?s.runnerAgentName.trim():"";if(!a)return"Unassigned";const c=a.toLowerCase();return c==="undefined"||c==="null"||c==="main"&&(s.runnerAgentId==="unassigned"||s.runnerSource==="fallback")?"Unassigned":a}function Tt(s){return s.runnerSource==="inferred"?"inferred":null}function Mt(s,a){const c=s.runnerSource==="assigned"?"assigned":s.runnerSource==="inferred"?"inferred":"fallback";return a==="Unassigned"?`Runner ${c}`:`${a} · ${c}`}function pe(s,a){return!s||s.trim().length===0?a:Ye(s.trim())||a}function vt(s){return!s||typeof s!="object"||Array.isArray(s)?null:s}function Xe(s,a){const c=I(s.workstreamTitle),o=vt(a),p=o&&typeof o.dispatchMode=="string"?o.dispatchMode:null,f=vt(o==null?void 0:o.run);return(f&&typeof f.stopReason=="string"?f.stopReason:f&&typeof f.stop_reason=="string"?f.stop_reason:null)==="budget_exhausted"?`Dispatch acknowledged for ${c}, but autopilot stopped: budget exhausted.`:p==="pending"?`Dispatching ${c}; waiting for slice start…`:p==="fallback"?`Dispatched ${c} using fallback runner.`:`Dispatched ${c}.`}function Rt({className:s=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:[e.jsx("circle",{cx:"4.5",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"15.5",cy:"10",r:"1.4",fill:"currentColor"})]})}function ps({compact:s}){const a=s?3:6;return e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 pt-1 text-micro uppercase tracking-[0.12em] text-muted",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#BFFF00]/70 status-breathe"}),e.jsx("span",{children:"Calibrating queue"})]}),Array.from({length:a}).map((c,o)=>e.jsxs("div",{className:"nextup-skeleton-card rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx(A,{className:"h-8 w-8 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(A,{className:"h-3 w-40 rounded-md"}),e.jsx(A,{className:"mt-2 h-4 w-56 rounded-md"})]})]}),e.jsx(A,{className:"h-5 w-16 rounded-full"})]}),e.jsxs("div",{className:"mt-3 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2",children:[e.jsx(A,{className:"h-3 w-14 rounded"}),e.jsx(A,{className:"mt-2 h-3 w-full rounded"}),e.jsx(A,{className:"mt-2 h-3 w-3/5 rounded"})]}),e.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[e.jsx(A,{className:"h-8 w-24 rounded-full"}),e.jsx(A,{className:"h-8 w-20 rounded-full"}),e.jsx(A,{className:"h-8 w-24 rounded-full"})]})]},`nextup-skeleton-${o}`))]})}function hs({initiativeId:s=null,projectId:a=null,authToken:c=null,embedMode:o=!1,title:p="Next Up",showHeader:f=!0,compact:k=!1,className:S,disableEnterAnimation:q=!1,allowCompactToggle:K=!1,onToggleCompact:he,onOpenInitiative:$,onOpenSettings:L,onUpgradeGate:D,onOpenSliceDetail:_,selectionEnabled:Q=!0,panelStyle:Ce="card",showQueueSettings:Ie=!0,queueModel:qe,queueActions:Ae,onPlayWorkstream:W,snapshotVersion:$e=null,excludeRunning:T=!1}){var ht;const[re,fe]=l.useState(k);l.useEffect(()=>fe(k),[k]);const d=K&&!he?re:k,ae=t=>{he?he(t):fe(t)},[B,y]=l.useState(null),[w,J]=l.useState("workstream"),oe="bottom",[j,le]=l.useState(null),[F,X]=l.useState(null),[x,Y]=l.useState(null),[V,ce]=l.useState(new Set),[Te,de]=l.useState(null),[be,ge]=l.useState(!1),[Et,Me]=l.useState(!1),G=jt(),Oe=l.useRef(null),et=l.useRef(null),tt=l.useRef(null),Lt=Jt({initiativeId:s,projectId:a,limit:40,authToken:c,embedMode:o,enabled:!qe,snapshotVersion:$e,zoomLevel:w}),Bt=qe??Lt,{items:ue,degraded:O,isLoading:M,isFetching:st,isFetchingNextPage:Re,hasNextPage:ze,error:Ee,refetch:Ft,fetchNextPage:nt,playWorkstream:Pt,startWorkstreamAutoContinue:it,initiativeGroups:De,milestoneGroups:_e}=Bt,Ut=Xt({authToken:c,embedMode:o}),H=Ae??Ut,P=t=>`${t.initiativeId}:${t.workstreamId}`,ee=w==="workstream",Ge=l.useMemo(()=>G?{duration:.01}:b.surfaceSwitch,[G]),U=l.useMemo(()=>{if(T)return ue.filter(i=>i.queueState!==m.RUNNING);const t=ue.filter(i=>i.queueState!==m.RUNNING);return t.length>0?t:ue},[T,ue]),rt=l.useMemo(()=>U.length===0?"empty":U.some(t=>t.queueState!==m.RUNNING&&t.queueState!==m.BLOCKED)?m.QUEUED:U.some(t=>t.queueState===m.BLOCKED)?m.BLOCKED:U.some(t=>t.queueState===m.RUNNING)?m.RUNNING:m.QUEUED,[U]),at=l.useMemo(()=>{if(!T)return De;const t=[];for(const i of De){const r=i.items.filter(n=>n.queueState!==m.RUNNING);r.length!==0&&t.push({...i,items:r,queueState:rs(r)})}return t},[T,De]),we=l.useMemo(()=>[...at].sort((t,i)=>{const r=Ue(t.queueState)-Ue(i.queueState);return r!==0?r:t.initiativeTitle.localeCompare(i.initiativeTitle)}),[at]),ot=l.useMemo(()=>T?_e.filter(t=>t.item.queueState!==m.RUNNING):_e,[T,_e]),ye=l.useMemo(()=>[...ot].sort((t,i)=>{const r=Ue(t.queueState)-Ue(i.queueState);if(r!==0)return r;const n=t.initiativeTitle.localeCompare(i.initiativeTitle);if(n!==0)return n;const u=t.workstreamTitle.localeCompare(i.workstreamTitle);return u!==0?u:t.milestoneTitle.localeCompare(i.milestoneTitle)}),[ot]),Ke=l.useMemo(()=>d?we.slice(0,5):we,[d,we]),Qe=l.useMemo(()=>d?ye.slice(0,5):ye,[d,ye]),lt=l.useMemo(()=>w==="initiative"?we.length:w==="milestone"?ye.length:U.length,[U.length,we.length,ye.length,w]),At=[{value:"initiative",label:"Initiative"},{value:"workstream",label:"Workstream"},{value:"milestone",label:"Milestone"}],C=l.useMemo(()=>ee?d?U.slice(0,5):U:[],[d,ee,U]),zt=l.useMemo(()=>C.filter(t=>V.has(P(t))),[V,C]),[me,ct]=l.useState([]),We=l.useRef([]),dt=l.useMemo(()=>{const t=new Map;for(const i of C)t.set(P(i),i);return t},[C]),R=l.useMemo(()=>C.map(P),[C]),Dt=l.useMemo(()=>R.join("|"),[R]);l.useEffect(()=>{ct(t=>{if(d)return[];const i=[],r=new Set(R);for(const n of t)r.has(n)&&i.push(n);for(const n of R)i.includes(n)||i.push(n);return i})},[d,Dt]),l.useEffect(()=>{We.current=me},[me]),l.useEffect(()=>{Te&&(R.includes(Te)||de(null))},[Te,R]),l.useEffect(()=>{ce(t=>{if(t.size===0)return t;const i=new Set(C.map(P)),r=new Set;for(const n of t)i.has(n)&&r.add(n);return r.size===t.size?t:r})},[C]),l.useEffect(()=>{if(!x)return;C.some(i=>P(i)===x)||Y(null)},[x,C]),l.useEffect(()=>{if(O.length===0){Me(!1);return}Me(!1)},[O]),l.useEffect(()=>{Q&&!d&&V.size>0&&ge(!1)},[d,V.size,Q]),l.useEffect(()=>{if(!be)return;const t=r=>{var u;const n=r.target;n&&((u=Oe.current)!=null&&u.contains(n)||ge(!1))},i=r=>{r.key==="Escape"&&ge(!1)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t),document.removeEventListener("keydown",i)}},[be]),l.useEffect(()=>{if(!ze)return;const t=et.current,i=tt.current;if(!t||!i)return;const r=new IntersectionObserver(n=>{n.some(u=>u.isIntersecting)&&(M||Re||nt().catch(()=>null))},{root:t,rootMargin:"220px 0px 220px 0px",threshold:0});return r.observe(i),()=>r.disconnect()},[nt,ze,Re,M]);const ut=async t=>{const i=P(t),r=I(t.workstreamTitle);try{await H.remove({initiativeId:t.initiativeId,workstreamId:t.workstreamId}),ce(n=>{if(!n.has(i))return n;const u=new Set(n);return u.delete(i),u}),de(n=>n===i?null:n),y(`Removed ${r} from queue.`)}catch(n){const u=n instanceof Error?n.message:"";y(pe(u,"Failed to remove from queue"))}},_t=(t,i,r)=>{const n=d?R:me.length>0?me:R;ce(u=>{const h=new Set(u),E=Te;if(r&&E&&n.includes(E)){const g=n.indexOf(t),Z=n.indexOf(E);if(g>=0&&Z>=0){const[Fe,Pe]=g<Z?[g,Z]:[Z,g];for(const Ne of n.slice(Fe,Pe+1))i?h.add(Ne):h.delete(Ne)}else i?h.add(t):h.delete(t)}else i?h.add(t):h.delete(t);return h}),de(t)},Gt=()=>{ce(new Set(R)),de(R.length>0?R[R.length-1]:null)},Kt=()=>{ce(new Set),de(null)},Ve=async t=>{if(V.size===0){y("Select one or more queue items first.");return}const i=C.map(r=>({key:P(r),item:r})).filter(r=>V.has(r.key));if(i.length===0){y("Selected queue items are no longer visible.");return}X(`bulk:${t}`),y(null);try{const r=i.map(({item:g})=>({initiativeId:g.initiativeId,workstreamId:g.workstreamId})),n=await H.bulk({action:t,items:r}),u=typeof(n==null?void 0:n.updated)=="number"?n.updated??0:0,h=typeof(n==null?void 0:n.failed)=="number"?n.failed??0:0,E=Array.isArray(n==null?void 0:n.errors)?n.errors.filter(g=>typeof g=="string").map(g=>g.trim()).filter(Boolean):[],v=t==="remove"?"removed":t==="move_top"?"moved to top":"moved to bottom";u===0&&h>0&&E.length>0?y(pe(E[0],`${h} queue action${h===1?"":"s"} failed.`)):y(h>0?`${u} item${u===1?"":"s"} ${v}; ${h} failed.`:`${u} item${u===1?"":"s"} ${v}.`),ce(new Set),de(null)}catch(r){const n=r instanceof Error?r.message:"";y(pe(n,"Bulk queue action failed"))}finally{X(null)}},Qt=async()=>{const t=We.current.map(i=>dt.get(i)).filter(Boolean).map(i=>({initiativeId:i.initiativeId,workstreamId:i.workstreamId}));t.length!==0&&await H.reorder({order:t})},te=async(t,i,r)=>{y(null),le(null),D==null||D(null),X(t);try{const n=await i();y(typeof r=="function"?r(n):r)}catch(n){if(n instanceof ts)le(n),D==null||D(n);else{const u=n instanceof Error?n.message:"";y(pe(u,"Action failed"))}}finally{X(null)}},Le=async t=>W?await W(t):await Pt({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId}),Be=j?"upgrade":Ee?"error":B?"notice":null,mt=Ee?ms(Ee):null,ve=O.length>0?xs(O[0]):null,Wt=Be!==null,Vt=O.length>0&&ve!==null&&!Et&&x===null&&!be,se=zt.length,Ht=l.useMemo(()=>w==="initiative"?Ke.length>0:w==="milestone"?Qe.length>0:C.length>0,[Ke.length,C.length,Qe.length,w]),xt=Q&&ee&&!d&&se>0,He=l.useMemo(()=>{if(!T)return 0;let t=0;for(const i of ue)i.queueState===m.RUNNING&&t++;return t},[T,ue]),Zt=w==="initiative"?"No initiatives in the queue right now.":w==="milestone"?"No milestone slices in the queue right now.":He>0?`All queued work is in progress (${He} running).`:O.length>0&&ve?"Queue signal is delayed right now.":"No queued workstreams right now.",pt=e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:Gt,className:"control-pill h-8 px-2.5 text-caption font-semibold",children:"Select all"}),e.jsx("button",{type:"button",onClick:Kt,disabled:V.size===0,className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Clear"}),e.jsx("button",{type:"button",disabled:se===0||F==="bulk:move_top",onClick:()=>void Ve("move_top"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move top"}),e.jsx("button",{type:"button",disabled:se===0||F==="bulk:move_bottom",onClick:()=>void Ve("move_bottom"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move bottom"}),e.jsx("button",{type:"button",disabled:se===0||F==="bulk:remove",onClick:()=>void Ve("remove"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Remove"})]});return e.jsxs(Yt,{surface:Ce==="card",className:`flex h-full min-h-0 flex-col overflow-hidden ${q?"":"card-enter"} ${Ce==="flat"?"!rounded-none !border-none !bg-transparent !shadow-none":""} ${S??""}`,children:[f?e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-subtle px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("h2",{className:"truncate text-heading font-semibold text-white",children:p}),e.jsx("span",{className:"chip inline-flex min-w-[52px] justify-center text-micro tabular-nums",children:M?e.jsx("span",{"aria-hidden":!0,className:"h-2.5 w-5 rounded bg-white/15 animate-pulse"}):lt}),e.jsx("span",{className:ie("inline-flex min-w-[92px] justify-end text-micro text-muted transition-opacity",st&&!M?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"inline-flex items-center rounded-xl border border-white/[0.1] bg-white/[0.03] p-1",role:"tablist","aria-label":"Next Up scope",children:At.map(t=>{const i=w===t.value;return e.jsxs(z.button,{type:"button",role:"tab","aria-selected":i,onClick:()=>J(t.value),...b.segmentedTap,className:ie("relative h-7 rounded-lg px-2.5 text-caption font-semibold transition-colors",i?"text-[#E8FFD0]":"text-secondary hover:text-white"),title:`Show ${t.label.toLowerCase()} queue`,children:[i?e.jsx(z.span,{layoutId:"next-up-scope-indicator",transition:G?{duration:.01}:b.railMorphSpring,className:"pointer-events-none absolute inset-0 rounded-lg border border-[#BFFF00]/35 bg-[#BFFF00]/16","aria-hidden":!0}):null,e.jsx("span",{className:"relative z-[1]",children:t.label})]},t.value)})}),K?e.jsx("button",{type:"button",onClick:()=>ae(!d),className:"control-pill h-8 flex-shrink-0 whitespace-nowrap px-3 text-caption font-semibold",title:d?"Switch to expanded cards":"Switch to compact list","aria-label":d?"Expand Next Up queue":"Compact Next Up queue",children:d?"Expand":"Compact"}):null]})]}):null,Wt&&e.jsx("div",{className:"px-3 pt-2",children:e.jsx(ke,{initial:!1,mode:"wait",children:Be==="upgrade"&&j?e.jsx(z.div,{initial:{opacity:0,y:-4,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:Ge,className:"rounded-xl border border-amber-200/25 bg-amber-200/10 px-3 py-2 text-caption text-amber-100",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-amber-200/25 bg-amber-200/10 px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em] text-amber-100/90",children:"Upgrade required"}),e.jsxs("span",{className:"truncate text-micro text-secondary",children:[ft(j.currentPlan)," →"," ",ft(j.requiredPlan)]})]}),e.jsx("div",{className:"mt-1 line-clamp-2 text-caption leading-snug text-amber-50/90",title:j.message,children:j.message}),B?e.jsx("div",{className:"mt-1 text-micro text-rose-50/85",children:B}):null]}),e.jsxs("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>void as({actions:j.actions,requiredPlan:j.requiredPlan}).catch(t=>y(pe(t instanceof Error?t.message:"","Checkout failed"))),className:"h-7 rounded-full border border-amber-200/25 bg-amber-200/15 px-3 text-micro font-semibold text-amber-50 transition-colors hover:bg-amber-200/20",children:"Upgrade"}),e.jsx("button",{type:"button",onClick:()=>void os({actions:j.actions}).catch(t=>y(pe(t instanceof Error?t.message:"","Portal failed"))),className:"h-7 rounded-full border border-strong bg-white/[0.04] px-3 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Billing"}),L&&e.jsx("button",{type:"button",onClick:L,className:"h-7 rounded-full border border-strong bg-white/[0.04] px-2.5 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Settings"})]}),(ht=j.actions)!=null&&ht.pricing?e.jsx("a",{href:j.actions.pricing,target:"_blank",rel:"noopener noreferrer",className:"text-micro text-secondary underline decoration-white/20 hover:text-primary",children:"View pricing"}):null]})]})},"upgrade"):Be==="error"&&mt?e.jsx(z.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:Ge,className:"rounded-xl border border-red-400/25 bg-red-500/[0.08] px-3 py-2 text-caption text-red-100",children:mt},"error"):Be==="notice"&&B?e.jsx(z.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:Ge,className:"rounded-xl border border-white/[0.1] bg-white/[0.03] px-3 py-2 text-caption text-primary",children:B},"notice"):null})}),e.jsxs("div",{ref:et,className:`flex-1 space-y-2.5 overflow-y-auto overscroll-y-contain scroll-smooth px-3 pb-3 ${f?"pt-1":"pt-2.5"}`,children:[!M&<>0?e.jsxs("div",{className:"flex flex-col gap-2.5 px-0.5 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-micro uppercase tracking-[0.08em] text-muted",children:w==="initiative"?"Initiatives":w==="milestone"?"Milestone slices":rt===m.BLOCKED?"Needs attention":rt===m.RUNNING?"Running now":"Queue"}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[se>0?e.jsxs("span",{className:"chip text-micro",children:[se," selected"]}):null,e.jsx("span",{className:ie("inline-flex min-w-[92px] text-micro text-muted transition-opacity",st&&!M?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"}),Q&&ee&&!d&&se===0?e.jsx("span",{className:"text-micro text-muted",children:"Shift+select to pick ranges."}):null]})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 sm:justify-end",children:[K?e.jsx("button",{type:"button",onClick:()=>ae(!d),className:"control-pill h-8 px-2.5 text-caption font-semibold",title:d?"Switch to expanded cards":"Switch to compact list","aria-label":d?"Expand Next Up queue":"Compact Next Up queue",children:d?"Expand":"Compact"}):null,xt?e.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:pt}):null,!xt&&Ie&&ee?e.jsxs("div",{ref:Oe,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>ge(t=>!t),className:"control-pill h-8 px-2.5 text-caption font-semibold","aria-haspopup":"menu","aria-expanded":be,title:"Queue settings",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"opacity-85","aria-hidden":!0,children:[e.jsx("path",{d:"M4 6h16"}),e.jsx("path",{d:"M7 12h10"}),e.jsx("path",{d:"M10 18h4"})]}),e.jsx("span",{children:"Queue"})]}),be?e.jsx("div",{className:"surface-tier-2 absolute right-0 top-[calc(100%+8px)] z-[280] w-[320px] max-w-[86vw] rounded-xl p-3 shadow-[0_18px_42px_rgba(0,0,0,0.46)] backdrop-blur-xl",children:e.jsxs("div",{className:"space-y-2.5",children:[Q&&!d?e.jsxs("div",{children:[e.jsx("p",{className:"section-kicker",children:"Bulk actions"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:pt})]}):null,L?e.jsx("button",{type:"button",onClick:()=>{ge(!1),L()},className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open settings"}):null]})}):null]}):null]})]}):null,M?e.jsx(ps,{compact:d}):null,!M&&!Ht&&!Ee&&e.jsx(Ot,{icon:"queue",headline:Zt,description:He>0?"Check the In Progress tab to see active work.":ve??"Create an initiative or add workstreams to populate the queue.",primaryAction:O.length>0&&ve?{label:"Retry now",onClick:()=>{Me(!1),Ft()}}:void 0}),!M&&w==="initiative"?e.jsx(ke,{initial:!1,children:Ke.map((t,i)=>{const r=t.items.find(v=>v.queueState!==m.RUNNING&&v.queueState!=="completed")??t.items[0]??null,n=Se(t.initiativeTitle,t.initiativeId,"Initiative"),u=wt(t.queueState),h=yt(t.queueState),E=t.items.reduce((v,g)=>v+(g.sliceTaskCount??0),0);return e.jsxs(z.article,{layout:!0,initial:{opacity:0,y:8,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:G?.01:b.surfaceSwitch.duration,delay:G?0:Math.min(i,b.listStaggerMaxItems)*b.listStaggerStep,ease:b.surfaceSwitch.ease},className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-micro uppercase tracking-[0.08em] text-muted",children:"Initiative"}),e.jsx("p",{className:"mt-0.5 truncate text-body font-semibold text-white",title:n,children:n})]}),e.jsx("span",{className:ie("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em]",h),children:u})]}),e.jsxs("p",{className:"mt-1 text-micro text-secondary",children:[t.workstreamCount," workstreams · ",E," tasks"]}),e.jsx("div",{className:"mt-2 space-y-1",children:t.items.slice(0,3).map((v,g)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-white/[0.06] bg-black/[0.18] px-2.5 py-1.5 text-caption",children:[e.jsx("span",{className:"truncate text-white/84",children:I(v.workstreamTitle)}),e.jsxs("span",{className:"text-micro text-secondary",children:[v.sliceTaskCount??0," tasks"]})]},`${v.workstreamId}:${g}`))}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>$==null?void 0:$(t.initiativeId,t.initiativeTitle),className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open"}),e.jsx("button",{type:"button",disabled:!r||F===`initiative:${t.initiativeId}`,onClick:()=>{r&&te(`initiative:${t.initiativeId}`,()=>Le(r),`Dispatched ${I(r.workstreamTitle)}.`)},className:"control-pill h-7 px-2.5 text-micro font-semibold disabled:opacity-45",children:"Dispatch"})]})]},`initiative-group:${t.initiativeId}`)})}):null,!M&&w==="milestone"?e.jsx(ke,{initial:!1,children:Qe.map((t,i)=>{const r=t.item,n=`milestone:${t.workstreamId}:${t.milestoneId??"none"}`;return e.jsxs(z.article,{layout:!0,initial:{opacity:0,y:8,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:G?.01:b.surfaceSwitch.duration,delay:G?0:Math.min(i,b.listStaggerMaxItems)*b.listStaggerStep,ease:b.surfaceSwitch.ease},className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-micro uppercase tracking-[0.08em] text-muted",children:[I(t.initiativeTitle)," · ",I(t.workstreamTitle)]}),e.jsx("p",{className:"mt-0.5 truncate text-body font-semibold text-white",title:t.milestoneTitle,children:I(t.milestoneTitle)})]}),e.jsx("span",{className:ie("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em]",yt(t.queueState)),children:wt(t.queueState)})]}),e.jsxs("p",{className:"mt-1 text-micro text-secondary",children:[t.taskCount," tasks in slice"]}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>$==null?void 0:$(t.initiativeId,t.initiativeTitle),className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open"}),e.jsx("button",{type:"button",disabled:F===n||t.queueState===m.RUNNING,onClick:()=>void te(n,()=>Le(r),u=>Xe(r,u)),className:"control-pill h-7 px-2.5 text-micro font-semibold disabled:opacity-45",children:t.queueState===m.RUNNING?"Running":"Start"})]})]},`${t.initiativeId}:${t.workstreamId}:${t.milestoneId??"none"}`)})}):null,!M&&ee&&d?e.jsx(ke,{initial:!1,children:C.map((t,i)=>{const r=P(t),n=F===r,u=t.queueState===m.RUNNING,h=t.nextTaskDueAt?Nt(t.nextTaskDueAt):null,E=Se(t.initiativeTitle,t.initiativeId,"Initiative"),v=Se(t.workstreamTitle,t.workstreamId,"Workstream"),g=qt(t),Z=t.nextTaskTitle?I(t.nextTaskTitle):null,Fe=t.blockReason?I(t.blockReason):null,Pe=$t(t),Ne=Tt(t);return e.jsxs(z.article,{layout:!0,initial:{opacity:0,y:6,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:G?.01:b.surfaceSwitch.duration,delay:G?0:Math.min(i,b.listStaggerMaxItems)*b.listStaggerStep,ease:b.surfaceSwitch.ease},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-2.5 py-2 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>_==null?void 0:_(t),role:"button",tabIndex:0,onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),_==null||_(t))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-2.5 top-0 h-px bg-gradient-to-r ${St(t.queueState)}`,"aria-hidden":!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(kt,{name:Pe,hint:Mt(t,Pe),size:"xs"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(je,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>$==null?void 0:$(t.initiativeId,t.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:E,children:E}),g?e.jsx("span",{className:ie("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",g.toneClass),title:g.longLabel,children:g.shortLabel}):null]}),e.jsxs("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 text-caption font-semibold leading-snug text-white",title:v,children:[e.jsx(je,{type:"workstream",size:12,className:"flex-shrink-0 opacity-95"}),e.jsx("span",{className:"line-clamp-2",children:v})]}),Z?e.jsxs("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:`${Ze(t.queueState)}: ${Z}${h?` · ${h}`:""}`,children:[Ze(t.queueState),": ",Z,h?` · ${h}`:""]}):e.jsx("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:Je(t),children:Je(t)}),Ne?e.jsxs("p",{className:"mt-0.5 text-micro text-muted",children:["Runner ",Ne]}):null,e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[(()=>{const N=t.objectiveScore??t.compositeScore??null;if(N==null)return null;const xe=N>=80?"S":N>=60?"A":"B",ne=xe==="S"?"border-[#BFFF00]/30 bg-[#BFFF00]/[0.12] text-[#d8ffa1]":xe==="A"?"border-[#14B8A6]/30 bg-[#14B8A6]/[0.12] text-[#87FFE9]":"border-white/[0.12] bg-white/[0.05] text-white/60";return e.jsxs("span",{className:`chip text-[9px] font-semibold ${ne}`,children:[xe,"-tier"]})})(),(()=>{const N=t.expectedValueUsd,xe=t.sliceTaskCount??0,ne=[];return xe>0&&ne.push(`${xe} tasks`),typeof N=="number"&&N>0&&ne.push(`$${N.toFixed(2)}`),h&&ne.push(h),ne.length===0?null:e.jsx("span",{className:"text-micro text-muted",children:ne.join(" · ")})})()]})]})]}),(t.sliceTaskCount??0)>0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-[2px] rounded-b-2xl overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(t.queueState===m.COMPLETED?100:t.queueState===m.RUNNING?50:15,4)}%`,background:`linear-gradient(90deg, ${bt.lime}, ${bt.teal})`,opacity:.6}})}),Fe&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",Fe]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",onClick:N=>N.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:n||u,onClick:()=>void te(r,()=>Le(t),N=>Xe(t,N)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:u?"Already running":"Start now",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(It,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:u?"Running":"Start"})]})}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:n,onClick:()=>Y(N=>N===r?null:r),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Rt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),x===r&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[178px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{Y(null),te(`${r}:top`,()=>H.move({initiativeId:t.initiativeId,workstreamId:t.workstreamId,placement:"top"}),`Moved ${v} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{Y(null),te(`${r}:bottom`,()=>H.move({initiativeId:t.initiativeId,workstreamId:t.workstreamId,placement:"bottom"}),`Moved ${v} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{Y(null),te(`${r}:auto`,()=>it({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId,scope:"initiative"}),`Auto enabled for ${E}.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Auto on"}),e.jsx("button",{type:"button",disabled:H.isRemoving,onClick:()=>{Y(null),ut(t)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]},r)})}):!M&&ee?e.jsx(ss,{axis:"y",values:me,onReorder:t=>{We.current=t,ct(t)},className:"space-y-2.5",children:me.map(t=>dt.get(t)).filter(Boolean).map((t,i)=>e.jsx(fs,{item:t,index:i,actionKey:F,setNotice:y,setUpgradeGate:le,onUpgradeGate:D,onOpenInitiative:$,onOpenSliceDetail:_,selected:V.has(P(t)),selectionEnabled:Q,onToggleSelection:_t,menuKey:x,setMenuKey:Y,onPlayWorkstream:Le,startWorkstreamAutoContinue:it,triagePlacement:oe,onPauseWorkstream:(r,n)=>H.stopTriage({initiativeId:r.initiativeId,workstreamId:r.workstreamId,placement:n,resetToTodo:!1}),onMoveWorkstream:(r,n)=>H.move({initiativeId:r.initiativeId,workstreamId:r.workstreamId,placement:n}),onCommitReorder:()=>void Qt().catch(()=>null),onDismiss:ut,runAction:te},P(t)))}):null,(ze||Re)&&e.jsx("div",{ref:tt,className:"flex h-10 items-center justify-center",children:e.jsx("span",{className:"text-micro text-muted",children:Re?"Loading more queue items…":"Scroll for more"})})]}),e.jsx("div",{className:"pointer-events-none absolute bottom-3 right-3 z-[250]",children:e.jsx(cs,{open:Vt,tone:"warning",title:"Limited signal",message:ve,autoDismissMs:6e3,onDismiss:()=>Me(!0)})})]})}function fs({item:s,index:a,actionKey:c,setNotice:o,setUpgradeGate:p,onUpgradeGate:f,onOpenInitiative:k,onOpenSliceDetail:S,selected:q,selectionEnabled:K,onToggleSelection:he,menuKey:$,setMenuKey:L,onPlayWorkstream:D,startWorkstreamAutoContinue:_,triagePlacement:Q,onPauseWorkstream:Ce,onMoveWorkstream:Ie,onCommitReorder:qe,onDismiss:Ae,runAction:W}){const $e=ns(),T=jt(),[re,fe]=l.useState(!1),d=`${s.initiativeId}:${s.workstreamId}`,ae=c===d,B=s.queueState===m.RUNNING,y=s.nextTaskDueAt?Nt(s.nextTaskDueAt):null,w=Se(s.initiativeTitle,s.initiativeId,"Initiative"),J=Se(s.workstreamTitle,s.workstreamId,"Workstream"),oe=qt(s),j=s.nextTaskTitle?I(s.nextTaskTitle):null,le=s.blockReason?I(s.blockReason):null,F=$t(s),X=Tt(s);return e.jsx(is,{value:d,id:d,dragListener:!1,dragControls:$e,onDragStart:()=>fe(!0),onDragEnd:()=>{fe(!1),qe()},whileDrag:{scale:1.02,boxShadow:"0 20px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(191,255,0,0.15)",zIndex:50,cursor:"grabbing"},className:"relative",children:e.jsxs(z.article,{layout:!0,initial:{opacity:0,y:12,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.98},transition:{duration:T?.01:b.surfaceSwitch.duration,ease:b.surfaceSwitch.ease,delay:T?0:Math.min(a,b.listStaggerMaxItems)*b.listStaggerStep,opacity:{duration:T?.01:b.surfaceSwitch.duration,ease:b.surfaceSwitch.ease}},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>S==null?void 0:S(s),role:"button",tabIndex:0,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),S==null||S(s))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-3 top-0 h-px bg-gradient-to-r ${St(s.queueState)}`,"aria-hidden":!0}),e.jsx("div",{className:"flex items-start justify-between gap-2.5",children:e.jsxs("div",{className:"min-w-0 flex flex-1 items-start gap-2.5",children:[e.jsxs("div",{className:"relative h-8 w-8 flex-shrink-0",children:[e.jsx("div",{className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out ${K?q?"opacity-0 scale-90":"opacity-100 scale-100 group-hover:opacity-0 group-hover:scale-90 group-focus-within:opacity-0 group-focus-within:scale-90":"opacity-100 scale-100"}`,children:e.jsx(kt,{name:F,hint:Mt(s,F),size:"sm"})}),K?e.jsx("button",{type:"button",role:"checkbox","aria-checked":q,"aria-label":"Select queue row",title:q?"Selected (Shift+click for range)":"Select (Shift+click for range)",onClick:x=>{x.stopPropagation(),he(d,!q,x.shiftKey)},onMouseDown:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),className:`absolute inset-0 flex items-center justify-center rounded-full border transition-[opacity,transform,background-color,border-color,color] duration-200 ease-out ${q?"opacity-100 scale-100 border-[#BFFF00]/40 bg-[#BFFF00]/18 text-[#E1FFB2]":"opacity-0 scale-90 border-white/[0.24] bg-black/55 text-white/78 group-hover:opacity-100 group-hover:scale-100 group-focus-within:opacity-100 group-focus-within:scale-100 hover:bg-black/62"}`,children:e.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full border border-current/45 bg-black/30",children:q?e.jsx("svg",{viewBox:"0 0 16 16",className:"h-2.5 w-2.5",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M3.2 8.3 6.2 11l6.6-6.1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(je,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>k==null?void 0:k(s.initiativeId,s.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:w,children:w}),oe?e.jsx("span",{className:ie("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",oe.toneClass),title:oe.longLabel,children:oe.shortLabel}):null]}),e.jsxs("div",{className:"mt-0.5 flex min-w-0 items-start gap-1.5",children:[e.jsx(je,{type:"workstream",size:12,className:"mt-[3px] flex-shrink-0 opacity-95"}),e.jsx("p",{className:"min-w-0 line-clamp-2 text-body font-semibold leading-snug text-white",title:J,children:J})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-micro text-secondary",children:[e.jsx("span",{className:"rounded-full border border-strong bg-white/[0.03] px-2 py-0.5 text-micro uppercase tracking-[0.08em] text-secondary",children:"Runner"}),e.jsxs("span",{className:"truncate text-white/68",children:[F,X?` · ${X}`:""]})]})]})]})}),e.jsx("div",{className:"mt-2 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2 text-caption text-white/68",children:j?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-micro uppercase tracking-[0.08em] text-white/44",children:[e.jsx(je,{type:"task",size:10,className:"flex-shrink-0 opacity-80"}),e.jsx("span",{children:Ze(s.queueState)}),y?e.jsxs("span",{className:"truncate text-micro normal-case tracking-normal text-muted",children:["· ",y]}):null]}),e.jsx("p",{className:"line-clamp-2 break-words text-caption leading-snug text-white/84",title:j,children:j})]}):e.jsx("span",{className:"text-secondary",children:Je(s)})}),le&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",le]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",onClick:x=>x.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:ae||B,onClick:()=>void W(d,()=>D(s),x=>Xe(s,x)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:B?"Already running":"Start this workstream now",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(It,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:B?"Running":"Start"})]})}),e.jsxs("button",{type:"button",onPointerDown:x=>$e.start(x),"aria-label":"Drag to reorder",title:re?"Reordering":"Drag to reorder",className:`control-pill flex h-7 items-center justify-center gap-1 px-2 text-micro font-semibold transition-colors ${re?"border-[#BFFF00]/35 bg-[#BFFF00]/14 text-[#E1FFB2] cursor-grabbing":"cursor-grab hover:bg-white/[0.08] hover:text-bright"}`,children:[re?e.jsx(us,{className:"h-3.5 w-3.5 opacity-90"}):e.jsx(ds,{className:"h-3.5 w-3.5 opacity-90"}),e.jsx("span",{children:re?"Reordering":"Drag"})]}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:ae,onClick:()=>L(x=>x===d?null:d),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Rt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),$===d&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[198px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{L(null),W(`${d}:top`,()=>Ie(s,"top"),`Moved ${J} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{L(null),W(`${d}:bottom`,()=>Ie(s,"bottom"),`Moved ${J} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{L(null),W(`${d}:auto`,()=>_({initiativeId:s.initiativeId,workstreamId:s.workstreamId,agentId:s.runnerAgentId,scope:"initiative"}),`Auto enabled for ${w}.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Auto on"}),B?e.jsx("button",{type:"button",onClick:()=>{L(null),W(`${d}:pause`,()=>Ce(s,Q),`Paused ${J}.`)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Pause run"}):null,e.jsx("button",{type:"button",disabled:ae||B,onClick:()=>{L(null),Ae(s)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]})})}const Ns=Object.freeze(Object.defineProperty({__proto__:null,NextUpPanel:hs},Symbol.toStringTag,{value:"Module"}));export{cs as I,hs as N,Ns as a,as as o};
|
|
1
|
+
import{r as l,j as e}from"./Dj2k1r16.js";import{G as Jt,u as Xt,K as b,P as Yt,B as ie,H as ft,T as Ot,C as I,v as Nt,A as kt,E as je,e as bt,h as Ye,D as gt,F as es,U as ts}from"./C8AYbjlq.js";import{S as A}from"./DvFumX8R.js";import{A as ke,m as z,u as jt,R as ss,b as ns,a as is}from"./eeHXe_OQ.js";import{Q as m,d as rs,q as Ue,a as wt,b as yt,c as St,e as Ze}from"./B7kFLPiD.js";async function Ct(s,a){var f;const o=await(await fetch(s,a)).json().catch(()=>null),p=((f=o==null?void 0:o.data)==null?void 0:f.url)??(o==null?void 0:o.url)??null;if(typeof p=="string"&&p.trim())return p.trim();throw new Error((o==null?void 0:o.error)??"Billing link unavailable")}async function as(s){var p;const a=((p=s==null?void 0:s.actions)==null?void 0:p.checkout)??"/orgx/api/billing/checkout",c=((s==null?void 0:s.requiredPlan)??"starter").trim().toLowerCase()||"starter",o=await Ct(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({planId:c})});window.open(o,"_blank","noopener,noreferrer")}async function os(s){var o;const a=((o=s==null?void 0:s.actions)==null?void 0:o.portal)??"/orgx/api/billing/portal",c=await Ct(a,{method:"POST"});window.open(c,"_blank","noopener,noreferrer")}function ls(s){return s==="success"?"border-emerald-400/30 bg-[#0A1210]/95 text-emerald-100":s==="warning"?"border-amber-300/30 bg-[#12100A]/95 text-amber-100":s==="error"?"border-red-400/32 bg-[#120A0A]/95 text-red-100":s==="info"?"border-cyan-300/28 bg-[#0A1012]/95 text-cyan-100":"border-strong bg-[#0B0F16]/95 text-primary"}function cs({open:s,tone:a="neutral",title:c,message:o=null,className:p,primaryAction:f=null,secondaryAction:k=null,onDismiss:S=null,autoDismissMs:q=null}){return l.useEffect(()=>{if(!s||!S||!q)return;const K=window.setTimeout(()=>S(),q);return()=>window.clearTimeout(K)},[q,S,s,c,o]),e.jsx(ke,{initial:!1,children:s?e.jsx(z.div,{initial:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.985},transition:{duration:.2,ease:[.22,1,.36,1]},className:`pointer-events-none ${p??""}`,children:e.jsxs("div",{className:`pointer-events-none min-w-[220px] max-w-[420px] rounded-xl border px-3 py-2 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur ${ls(a)}`,children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-caption font-semibold",children:c}),o?e.jsx("p",{className:"mt-0.5 text-caption opacity-85",children:o}):null]}),S?e.jsx("button",{type:"button",onClick:S,className:"pointer-events-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-current/70 transition-colors hover:bg-white/[0.08] hover:text-current","aria-label":"Dismiss toast",title:"Dismiss",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}):null]}),f||k?e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[k?e.jsx("button",{type:"button",onClick:k.onClick,className:"pointer-events-auto h-7 rounded-md border border-strong bg-white/[0.06] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.12]",children:k.label}):null,f?e.jsx("button",{type:"button",onClick:f.onClick,className:"pointer-events-auto h-7 rounded-md border border-white/25 bg-white/[0.14] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.2]",children:f.label}):null]}):null]})}):null})}function It({className:s=""}){return e.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:e.jsx("path",{d:"M7 5.4v9.2c0 .7.75 1.15 1.38.83l7.6-4.6a.95.95 0 0 0 0-1.62l-7.6-4.64A.95.95 0 0 0 7 5.4Z",fill:"currentColor"})})}function ds({className:s=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:[e.jsx("path",{d:"M6.2 9.4V6.7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.4 8.9V5.8c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.6 8.9V6.2c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M12.8 9.6V7.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v4.2c0 2.7-1.9 4.6-4.6 4.6H9.2c-2.1 0-3.7-1-4.6-2.8l-.9-1.7c-.3-.6 0-1.4.6-1.7.6-.3 1.3 0 1.6.6l.7 1.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function us({className:s=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:[e.jsx("path",{d:"M6.4 9.2V7.4c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v1.3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.6 8.9V7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.8 9.2V7.3c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M13 9.8V8.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v3.6c0 2.4-1.7 4-4.1 4H9.7c-2 0-3.4-.9-4.2-2.5l-.8-1.4c-.3-.6 0-1.3.5-1.6.6-.3 1.2-.1 1.6.5l.6 1",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Je(s){const a=typeof s.sliceTaskCount=="number"&&Number.isFinite(s.sliceTaskCount)?Math.max(0,Math.floor(s.sliceTaskCount)):null,c=s.sliceScope==="task"?"task":s.sliceScope==="milestone"?"milestone slice":"workstream slice",o=a&&a>0?`${a} ${a===1?"task":"tasks"}`:null;return s.queueState===m.RUNNING?o?`Executing ${o} in ${c}.`:"Execution in progress. Task detail will appear as the scheduler advances.":s.queueState===m.BLOCKED?s.blockReason?"Blocked while waiting for dependency resolution.":"Blocked. Waiting for dependency or review.":s.queueState===m.QUEUED?o?`Queued with ${o} in ${c}.`:"Queued at workstream scope. Task detail will populate after dispatch.":s.queueState===m.COMPLETED?"Completed. No queued tasks remain.":"Idle. Ready to dispatch when started."}function qt(s){const a=typeof s.initiativePriority=="string"?s.initiativePriority.trim().toLowerCase():"",c=typeof s.initiativePriorityNum=="number"&&Number.isFinite(s.initiativePriorityNum)?Math.max(1,Math.min(100,Math.round(s.initiativePriorityNum))):null,o=a==="urgent"||a==="high"||a==="medium"||a==="low"?a:c!==null?c<=12?"urgent":c<=30?"high":c<=60?"medium":"low":null;if(!o)return null;const p=o==="urgent"?"P1":o==="high"?"P2":o==="medium"?"P3":"P4",f=o==="urgent"?"Urgent":o==="high"?"High":o==="medium"?"Medium":"Low",k=o==="urgent"?"border-red-300/35 bg-red-500/[0.14] text-red-100":o==="high"?"border-amber-300/35 bg-amber-500/[0.14] text-amber-100":o==="medium"?"border-[#BFFF00]/35 bg-[#BFFF00]/14 text-[#E1FFB2]":"border-white/[0.2] bg-white/[0.08] text-white/70";return{shortLabel:`${p} ${f}`,longLabel:`Initiative priority ${f} (${p})`,toneClass:k}}function ms(s){const a=s.trim().toLowerCase();if(a.includes("timed out")||a.includes("timeout")||a.includes("request cancelled")||a.includes("signal is aborted"))return"Next Up is still syncing. Keep this panel open and it will repopulate automatically.";if(a.includes("unauthorized")||a.includes("forbidden")||a.includes("api key")||a.includes("auth"))return"Next Up is unavailable until OrgX authentication is reconnected in Settings.";if(a.includes("unknown api endpoint")||a.includes("route is unavailable"))return"This runtime is missing queue routes. Restart and update the plugin build.";const c=s.split("|").map(o=>o.trim()).filter(Boolean).map(o=>o.replace(/^[^:]+:\s*/,"").trim()).filter(Boolean).slice(0,2).join(" ");return Ye(c||s)||"Next Up is temporarily unavailable."}function xs(s){const a=s.trim().toLowerCase();return a.includes("circular")||a.includes("timeline estimate")||a.includes("adjusted accordingly")?null:a.includes("timed out")||a.includes("timeout")||a.includes("request cancelled")||a.includes("signal is aborted")?"Signal is delayed right now. Queue data will appear as soon as sync catches up.":a.includes("fallback")?"Showing fallback queue data while full signal refreshes.":a.includes("unknown api endpoint")||a.includes("route is unavailable")?"Some queue controls are unavailable in this plugin build. Update and restart to restore full controls.":Ye(s.trim())}function Se(s,a,c){const o=typeof s=="string"?s.trim():"";if(o&&!gt(o))return I(o);const p=typeof a=="string"?a.trim():"";return p?gt(p)?`${c} ${es(p)}`:I(p):c}function $t(s){const a=typeof s.runnerAgentName=="string"?s.runnerAgentName.trim():"";if(!a)return"Unassigned";const c=a.toLowerCase();return c==="undefined"||c==="null"||c==="main"&&(s.runnerAgentId==="unassigned"||s.runnerSource==="fallback")?"Unassigned":a}function Tt(s){return s.runnerSource==="inferred"?"inferred":null}function Mt(s,a){const c=s.runnerSource==="assigned"?"assigned":s.runnerSource==="inferred"?"inferred":"fallback";return a==="Unassigned"?`Runner ${c}`:`${a} · ${c}`}function pe(s,a){return!s||s.trim().length===0?a:Ye(s.trim())||a}function vt(s){return!s||typeof s!="object"||Array.isArray(s)?null:s}function Xe(s,a){const c=I(s.workstreamTitle),o=vt(a),p=o&&typeof o.dispatchMode=="string"?o.dispatchMode:null,f=vt(o==null?void 0:o.run);return(f&&typeof f.stopReason=="string"?f.stopReason:f&&typeof f.stop_reason=="string"?f.stop_reason:null)==="budget_exhausted"?`Dispatch acknowledged for ${c}, but autopilot stopped: budget exhausted.`:p==="pending"?`Dispatching ${c}; waiting for slice start…`:p==="fallback"?`Dispatched ${c} using fallback runner.`:`Dispatched ${c}.`}function Rt({className:s=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:s,children:[e.jsx("circle",{cx:"4.5",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"15.5",cy:"10",r:"1.4",fill:"currentColor"})]})}function ps({compact:s}){const a=s?3:6;return e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 pt-1 text-micro uppercase tracking-[0.12em] text-muted",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#BFFF00]/70 status-breathe"}),e.jsx("span",{children:"Calibrating queue"})]}),Array.from({length:a}).map((c,o)=>e.jsxs("div",{className:"nextup-skeleton-card rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx(A,{className:"h-8 w-8 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(A,{className:"h-3 w-40 rounded-md"}),e.jsx(A,{className:"mt-2 h-4 w-56 rounded-md"})]})]}),e.jsx(A,{className:"h-5 w-16 rounded-full"})]}),e.jsxs("div",{className:"mt-3 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2",children:[e.jsx(A,{className:"h-3 w-14 rounded"}),e.jsx(A,{className:"mt-2 h-3 w-full rounded"}),e.jsx(A,{className:"mt-2 h-3 w-3/5 rounded"})]}),e.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[e.jsx(A,{className:"h-8 w-24 rounded-full"}),e.jsx(A,{className:"h-8 w-20 rounded-full"}),e.jsx(A,{className:"h-8 w-24 rounded-full"})]})]},`nextup-skeleton-${o}`))]})}function hs({initiativeId:s=null,projectId:a=null,authToken:c=null,embedMode:o=!1,title:p="Next Up",showHeader:f=!0,compact:k=!1,className:S,disableEnterAnimation:q=!1,allowCompactToggle:K=!1,onToggleCompact:he,onOpenInitiative:$,onOpenSettings:L,onUpgradeGate:D,onOpenSliceDetail:_,selectionEnabled:Q=!0,panelStyle:Ce="card",showQueueSettings:Ie=!0,queueModel:qe,queueActions:Ae,onPlayWorkstream:W,snapshotVersion:$e=null,excludeRunning:T=!1}){var ht;const[re,fe]=l.useState(k);l.useEffect(()=>fe(k),[k]);const d=K&&!he?re:k,ae=t=>{he?he(t):fe(t)},[B,y]=l.useState(null),[w,J]=l.useState("workstream"),oe="bottom",[j,le]=l.useState(null),[F,X]=l.useState(null),[x,Y]=l.useState(null),[V,ce]=l.useState(new Set),[Te,de]=l.useState(null),[be,ge]=l.useState(!1),[Et,Me]=l.useState(!1),G=jt(),Oe=l.useRef(null),et=l.useRef(null),tt=l.useRef(null),Lt=Jt({initiativeId:s,projectId:a,limit:40,authToken:c,embedMode:o,enabled:!qe,snapshotVersion:$e,zoomLevel:w}),Bt=qe??Lt,{items:ue,degraded:O,isLoading:M,isFetching:st,isFetchingNextPage:Re,hasNextPage:ze,error:Ee,refetch:Ft,fetchNextPage:nt,playWorkstream:Pt,startWorkstreamAutoContinue:it,initiativeGroups:De,milestoneGroups:_e}=Bt,Ut=Xt({authToken:c,embedMode:o}),H=Ae??Ut,P=t=>`${t.initiativeId}:${t.workstreamId}`,ee=w==="workstream",Ge=l.useMemo(()=>G?{duration:.01}:b.surfaceSwitch,[G]),U=l.useMemo(()=>{if(T)return ue.filter(i=>i.queueState!==m.RUNNING);const t=ue.filter(i=>i.queueState!==m.RUNNING);return t.length>0?t:ue},[T,ue]),rt=l.useMemo(()=>U.length===0?"empty":U.some(t=>t.queueState!==m.RUNNING&&t.queueState!==m.BLOCKED)?m.QUEUED:U.some(t=>t.queueState===m.BLOCKED)?m.BLOCKED:U.some(t=>t.queueState===m.RUNNING)?m.RUNNING:m.QUEUED,[U]),at=l.useMemo(()=>{if(!T)return De;const t=[];for(const i of De){const r=i.items.filter(n=>n.queueState!==m.RUNNING);r.length!==0&&t.push({...i,items:r,queueState:rs(r)})}return t},[T,De]),we=l.useMemo(()=>[...at].sort((t,i)=>{const r=Ue(t.queueState)-Ue(i.queueState);return r!==0?r:t.initiativeTitle.localeCompare(i.initiativeTitle)}),[at]),ot=l.useMemo(()=>T?_e.filter(t=>t.item.queueState!==m.RUNNING):_e,[T,_e]),ye=l.useMemo(()=>[...ot].sort((t,i)=>{const r=Ue(t.queueState)-Ue(i.queueState);if(r!==0)return r;const n=t.initiativeTitle.localeCompare(i.initiativeTitle);if(n!==0)return n;const u=t.workstreamTitle.localeCompare(i.workstreamTitle);return u!==0?u:t.milestoneTitle.localeCompare(i.milestoneTitle)}),[ot]),Ke=l.useMemo(()=>d?we.slice(0,5):we,[d,we]),Qe=l.useMemo(()=>d?ye.slice(0,5):ye,[d,ye]),lt=l.useMemo(()=>w==="initiative"?we.length:w==="milestone"?ye.length:U.length,[U.length,we.length,ye.length,w]),At=[{value:"initiative",label:"Initiative"},{value:"workstream",label:"Workstream"},{value:"milestone",label:"Milestone"}],C=l.useMemo(()=>ee?d?U.slice(0,5):U:[],[d,ee,U]),zt=l.useMemo(()=>C.filter(t=>V.has(P(t))),[V,C]),[me,ct]=l.useState([]),We=l.useRef([]),dt=l.useMemo(()=>{const t=new Map;for(const i of C)t.set(P(i),i);return t},[C]),R=l.useMemo(()=>C.map(P),[C]),Dt=l.useMemo(()=>R.join("|"),[R]);l.useEffect(()=>{ct(t=>{if(d)return[];const i=[],r=new Set(R);for(const n of t)r.has(n)&&i.push(n);for(const n of R)i.includes(n)||i.push(n);return i})},[d,Dt]),l.useEffect(()=>{We.current=me},[me]),l.useEffect(()=>{Te&&(R.includes(Te)||de(null))},[Te,R]),l.useEffect(()=>{ce(t=>{if(t.size===0)return t;const i=new Set(C.map(P)),r=new Set;for(const n of t)i.has(n)&&r.add(n);return r.size===t.size?t:r})},[C]),l.useEffect(()=>{if(!x)return;C.some(i=>P(i)===x)||Y(null)},[x,C]),l.useEffect(()=>{if(O.length===0){Me(!1);return}Me(!1)},[O]),l.useEffect(()=>{Q&&!d&&V.size>0&&ge(!1)},[d,V.size,Q]),l.useEffect(()=>{if(!be)return;const t=r=>{var u;const n=r.target;n&&((u=Oe.current)!=null&&u.contains(n)||ge(!1))},i=r=>{r.key==="Escape"&&ge(!1)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t),document.removeEventListener("keydown",i)}},[be]),l.useEffect(()=>{if(!ze)return;const t=et.current,i=tt.current;if(!t||!i)return;const r=new IntersectionObserver(n=>{n.some(u=>u.isIntersecting)&&(M||Re||nt().catch(()=>null))},{root:t,rootMargin:"220px 0px 220px 0px",threshold:0});return r.observe(i),()=>r.disconnect()},[nt,ze,Re,M]);const ut=async t=>{const i=P(t),r=I(t.workstreamTitle);try{await H.remove({initiativeId:t.initiativeId,workstreamId:t.workstreamId}),ce(n=>{if(!n.has(i))return n;const u=new Set(n);return u.delete(i),u}),de(n=>n===i?null:n),y(`Removed ${r} from queue.`)}catch(n){const u=n instanceof Error?n.message:"";y(pe(u,"Failed to remove from queue"))}},_t=(t,i,r)=>{const n=d?R:me.length>0?me:R;ce(u=>{const h=new Set(u),E=Te;if(r&&E&&n.includes(E)){const g=n.indexOf(t),Z=n.indexOf(E);if(g>=0&&Z>=0){const[Fe,Pe]=g<Z?[g,Z]:[Z,g];for(const Ne of n.slice(Fe,Pe+1))i?h.add(Ne):h.delete(Ne)}else i?h.add(t):h.delete(t)}else i?h.add(t):h.delete(t);return h}),de(t)},Gt=()=>{ce(new Set(R)),de(R.length>0?R[R.length-1]:null)},Kt=()=>{ce(new Set),de(null)},Ve=async t=>{if(V.size===0){y("Select one or more queue items first.");return}const i=C.map(r=>({key:P(r),item:r})).filter(r=>V.has(r.key));if(i.length===0){y("Selected queue items are no longer visible.");return}X(`bulk:${t}`),y(null);try{const r=i.map(({item:g})=>({initiativeId:g.initiativeId,workstreamId:g.workstreamId})),n=await H.bulk({action:t,items:r}),u=typeof(n==null?void 0:n.updated)=="number"?n.updated??0:0,h=typeof(n==null?void 0:n.failed)=="number"?n.failed??0:0,E=Array.isArray(n==null?void 0:n.errors)?n.errors.filter(g=>typeof g=="string").map(g=>g.trim()).filter(Boolean):[],v=t==="remove"?"removed":t==="move_top"?"moved to top":"moved to bottom";u===0&&h>0&&E.length>0?y(pe(E[0],`${h} queue action${h===1?"":"s"} failed.`)):y(h>0?`${u} item${u===1?"":"s"} ${v}; ${h} failed.`:`${u} item${u===1?"":"s"} ${v}.`),ce(new Set),de(null)}catch(r){const n=r instanceof Error?r.message:"";y(pe(n,"Bulk queue action failed"))}finally{X(null)}},Qt=async()=>{const t=We.current.map(i=>dt.get(i)).filter(Boolean).map(i=>({initiativeId:i.initiativeId,workstreamId:i.workstreamId}));t.length!==0&&await H.reorder({order:t})},te=async(t,i,r)=>{y(null),le(null),D==null||D(null),X(t);try{const n=await i();y(typeof r=="function"?r(n):r)}catch(n){if(n instanceof ts)le(n),D==null||D(n);else{const u=n instanceof Error?n.message:"";y(pe(u,"Action failed"))}}finally{X(null)}},Le=async t=>W?await W(t):await Pt({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId}),Be=j?"upgrade":Ee?"error":B?"notice":null,mt=Ee?ms(Ee):null,ve=O.length>0?xs(O[0]):null,Wt=Be!==null,Vt=O.length>0&&ve!==null&&!Et&&x===null&&!be,se=zt.length,Ht=l.useMemo(()=>w==="initiative"?Ke.length>0:w==="milestone"?Qe.length>0:C.length>0,[Ke.length,C.length,Qe.length,w]),xt=Q&&ee&&!d&&se>0,He=l.useMemo(()=>{if(!T)return 0;let t=0;for(const i of ue)i.queueState===m.RUNNING&&t++;return t},[T,ue]),Zt=w==="initiative"?"No initiatives in the queue right now.":w==="milestone"?"No milestone slices in the queue right now.":He>0?`All queued work is in progress (${He} running).`:O.length>0&&ve?"Queue signal is delayed right now.":"No queued workstreams right now.",pt=e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:Gt,className:"control-pill h-8 px-2.5 text-caption font-semibold",children:"Select all"}),e.jsx("button",{type:"button",onClick:Kt,disabled:V.size===0,className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Clear"}),e.jsx("button",{type:"button",disabled:se===0||F==="bulk:move_top",onClick:()=>void Ve("move_top"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move top"}),e.jsx("button",{type:"button",disabled:se===0||F==="bulk:move_bottom",onClick:()=>void Ve("move_bottom"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move bottom"}),e.jsx("button",{type:"button",disabled:se===0||F==="bulk:remove",onClick:()=>void Ve("remove"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Remove"})]});return e.jsxs(Yt,{surface:Ce==="card",className:`flex h-full min-h-0 flex-col overflow-hidden ${q?"":"card-enter"} ${Ce==="flat"?"!rounded-none !border-none !bg-transparent !shadow-none":""} ${S??""}`,children:[f?e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-subtle px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("h2",{className:"truncate text-heading font-semibold text-white",children:p}),e.jsx("span",{className:"chip inline-flex min-w-[52px] justify-center text-micro tabular-nums",children:M?e.jsx("span",{"aria-hidden":!0,className:"h-2.5 w-5 rounded bg-white/15 animate-pulse"}):lt}),e.jsx("span",{className:ie("inline-flex min-w-[92px] justify-end text-micro text-muted transition-opacity",st&&!M?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"inline-flex items-center rounded-xl border border-white/[0.1] bg-white/[0.03] p-1",role:"tablist","aria-label":"Next Up scope",children:At.map(t=>{const i=w===t.value;return e.jsxs(z.button,{type:"button",role:"tab","aria-selected":i,onClick:()=>J(t.value),...b.segmentedTap,className:ie("relative h-7 rounded-lg px-2.5 text-caption font-semibold transition-colors",i?"text-[#E8FFD0]":"text-secondary hover:text-white"),title:`Show ${t.label.toLowerCase()} queue`,children:[i?e.jsx(z.span,{layoutId:"next-up-scope-indicator",transition:G?{duration:.01}:b.railMorphSpring,className:"pointer-events-none absolute inset-0 rounded-lg border border-[#BFFF00]/35 bg-[#BFFF00]/16","aria-hidden":!0}):null,e.jsx("span",{className:"relative z-[1]",children:t.label})]},t.value)})}),K?e.jsx("button",{type:"button",onClick:()=>ae(!d),className:"control-pill h-8 flex-shrink-0 whitespace-nowrap px-3 text-caption font-semibold",title:d?"Switch to expanded cards":"Switch to compact list","aria-label":d?"Expand Next Up queue":"Compact Next Up queue",children:d?"Expand":"Compact"}):null]})]}):null,Wt&&e.jsx("div",{className:"px-3 pt-2",children:e.jsx(ke,{initial:!1,mode:"wait",children:Be==="upgrade"&&j?e.jsx(z.div,{initial:{opacity:0,y:-4,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:Ge,className:"rounded-xl border border-amber-200/25 bg-amber-200/10 px-3 py-2 text-caption text-amber-100",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-amber-200/25 bg-amber-200/10 px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em] text-amber-100/90",children:"Upgrade required"}),e.jsxs("span",{className:"truncate text-micro text-secondary",children:[ft(j.currentPlan)," →"," ",ft(j.requiredPlan)]})]}),e.jsx("div",{className:"mt-1 line-clamp-2 text-caption leading-snug text-amber-50/90",title:j.message,children:j.message}),B?e.jsx("div",{className:"mt-1 text-micro text-rose-50/85",children:B}):null]}),e.jsxs("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>void as({actions:j.actions,requiredPlan:j.requiredPlan}).catch(t=>y(pe(t instanceof Error?t.message:"","Checkout failed"))),className:"h-7 rounded-full border border-amber-200/25 bg-amber-200/15 px-3 text-micro font-semibold text-amber-50 transition-colors hover:bg-amber-200/20",children:"Upgrade"}),e.jsx("button",{type:"button",onClick:()=>void os({actions:j.actions}).catch(t=>y(pe(t instanceof Error?t.message:"","Portal failed"))),className:"h-7 rounded-full border border-strong bg-white/[0.04] px-3 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Billing"}),L&&e.jsx("button",{type:"button",onClick:L,className:"h-7 rounded-full border border-strong bg-white/[0.04] px-2.5 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Settings"})]}),(ht=j.actions)!=null&&ht.pricing?e.jsx("a",{href:j.actions.pricing,target:"_blank",rel:"noopener noreferrer",className:"text-micro text-secondary underline decoration-white/20 hover:text-primary",children:"View pricing"}):null]})]})},"upgrade"):Be==="error"&&mt?e.jsx(z.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:Ge,className:"rounded-xl border border-red-400/25 bg-red-500/[0.08] px-3 py-2 text-caption text-red-100",children:mt},"error"):Be==="notice"&&B?e.jsx(z.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:Ge,className:"rounded-xl border border-white/[0.1] bg-white/[0.03] px-3 py-2 text-caption text-primary",children:B},"notice"):null})}),e.jsxs("div",{ref:et,className:`flex-1 space-y-2.5 overflow-y-auto overscroll-y-contain scroll-smooth px-3 pb-3 ${f?"pt-1":"pt-2.5"}`,children:[!M&<>0?e.jsxs("div",{className:"flex flex-col gap-2.5 px-0.5 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-micro uppercase tracking-[0.08em] text-muted",children:w==="initiative"?"Initiatives":w==="milestone"?"Milestone slices":rt===m.BLOCKED?"Needs attention":rt===m.RUNNING?"Running now":"Queue"}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[se>0?e.jsxs("span",{className:"chip text-micro",children:[se," selected"]}):null,e.jsx("span",{className:ie("inline-flex min-w-[92px] text-micro text-muted transition-opacity",st&&!M?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"}),Q&&ee&&!d&&se===0?e.jsx("span",{className:"text-micro text-muted",children:"Shift+select to pick ranges."}):null]})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 sm:justify-end",children:[K?e.jsx("button",{type:"button",onClick:()=>ae(!d),className:"control-pill h-8 px-2.5 text-caption font-semibold",title:d?"Switch to expanded cards":"Switch to compact list","aria-label":d?"Expand Next Up queue":"Compact Next Up queue",children:d?"Expand":"Compact"}):null,xt?e.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:pt}):null,!xt&&Ie&&ee?e.jsxs("div",{ref:Oe,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>ge(t=>!t),className:"control-pill h-8 px-2.5 text-caption font-semibold","aria-haspopup":"menu","aria-expanded":be,title:"Queue settings",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"opacity-85","aria-hidden":!0,children:[e.jsx("path",{d:"M4 6h16"}),e.jsx("path",{d:"M7 12h10"}),e.jsx("path",{d:"M10 18h4"})]}),e.jsx("span",{children:"Queue"})]}),be?e.jsx("div",{className:"surface-tier-2 absolute right-0 top-[calc(100%+8px)] z-[280] w-[320px] max-w-[86vw] rounded-xl p-3 shadow-[0_18px_42px_rgba(0,0,0,0.46)] backdrop-blur-xl",children:e.jsxs("div",{className:"space-y-2.5",children:[Q&&!d?e.jsxs("div",{children:[e.jsx("p",{className:"section-kicker",children:"Bulk actions"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:pt})]}):null,L?e.jsx("button",{type:"button",onClick:()=>{ge(!1),L()},className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open settings"}):null]})}):null]}):null]})]}):null,M?e.jsx(ps,{compact:d}):null,!M&&!Ht&&!Ee&&e.jsx(Ot,{icon:"queue",headline:Zt,description:He>0?"Check the In Progress tab to see active work.":ve??"Create an initiative or add workstreams to populate the queue.",primaryAction:O.length>0&&ve?{label:"Retry now",onClick:()=>{Me(!1),Ft()}}:void 0}),!M&&w==="initiative"?e.jsx(ke,{initial:!1,children:Ke.map((t,i)=>{const r=t.items.find(v=>v.queueState!==m.RUNNING&&v.queueState!=="completed")??t.items[0]??null,n=Se(t.initiativeTitle,t.initiativeId,"Initiative"),u=wt(t.queueState),h=yt(t.queueState),E=t.items.reduce((v,g)=>v+(g.sliceTaskCount??0),0);return e.jsxs(z.article,{layout:!0,initial:{opacity:0,y:8,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:G?.01:b.surfaceSwitch.duration,delay:G?0:Math.min(i,b.listStaggerMaxItems)*b.listStaggerStep,ease:b.surfaceSwitch.ease},className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-micro uppercase tracking-[0.08em] text-muted",children:"Initiative"}),e.jsx("p",{className:"mt-0.5 truncate text-body font-semibold text-white",title:n,children:n})]}),e.jsx("span",{className:ie("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em]",h),children:u})]}),e.jsxs("p",{className:"mt-1 text-micro text-secondary",children:[t.workstreamCount," workstreams · ",E," tasks"]}),e.jsx("div",{className:"mt-2 space-y-1",children:t.items.slice(0,3).map((v,g)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-white/[0.06] bg-black/[0.18] px-2.5 py-1.5 text-caption",children:[e.jsx("span",{className:"truncate text-white/84",children:I(v.workstreamTitle)}),e.jsxs("span",{className:"text-micro text-secondary",children:[v.sliceTaskCount??0," tasks"]})]},`${v.workstreamId}:${g}`))}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>$==null?void 0:$(t.initiativeId,t.initiativeTitle),className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open"}),e.jsx("button",{type:"button",disabled:!r||F===`initiative:${t.initiativeId}`,onClick:()=>{r&&te(`initiative:${t.initiativeId}`,()=>Le(r),`Dispatched ${I(r.workstreamTitle)}.`)},className:"control-pill h-7 px-2.5 text-micro font-semibold disabled:opacity-45",children:"Dispatch"})]})]},`initiative-group:${t.initiativeId}`)})}):null,!M&&w==="milestone"?e.jsx(ke,{initial:!1,children:Qe.map((t,i)=>{const r=t.item,n=`milestone:${t.workstreamId}:${t.milestoneId??"none"}`;return e.jsxs(z.article,{layout:!0,initial:{opacity:0,y:8,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:G?.01:b.surfaceSwitch.duration,delay:G?0:Math.min(i,b.listStaggerMaxItems)*b.listStaggerStep,ease:b.surfaceSwitch.ease},className:"rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-micro uppercase tracking-[0.08em] text-muted",children:[I(t.initiativeTitle)," · ",I(t.workstreamTitle)]}),e.jsx("p",{className:"mt-0.5 truncate text-body font-semibold text-white",title:t.milestoneTitle,children:I(t.milestoneTitle)})]}),e.jsx("span",{className:ie("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em]",yt(t.queueState)),children:wt(t.queueState)})]}),e.jsxs("p",{className:"mt-1 text-micro text-secondary",children:[t.taskCount," tasks in slice"]}),e.jsxs("div",{className:"mt-2.5 flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>$==null?void 0:$(t.initiativeId,t.initiativeTitle),className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open"}),e.jsx("button",{type:"button",disabled:F===n||t.queueState===m.RUNNING,onClick:()=>void te(n,()=>Le(r),u=>Xe(r,u)),className:"control-pill h-7 px-2.5 text-micro font-semibold disabled:opacity-45",children:t.queueState===m.RUNNING?"Running":"Start"})]})]},`${t.initiativeId}:${t.workstreamId}:${t.milestoneId??"none"}`)})}):null,!M&&ee&&d?e.jsx(ke,{initial:!1,children:C.map((t,i)=>{const r=P(t),n=F===r,u=t.queueState===m.RUNNING,h=t.nextTaskDueAt?Nt(t.nextTaskDueAt):null,E=Se(t.initiativeTitle,t.initiativeId,"Initiative"),v=Se(t.workstreamTitle,t.workstreamId,"Workstream"),g=qt(t),Z=t.nextTaskTitle?I(t.nextTaskTitle):null,Fe=t.blockReason?I(t.blockReason):null,Pe=$t(t),Ne=Tt(t);return e.jsxs(z.article,{layout:!0,initial:{opacity:0,y:6,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:G?.01:b.surfaceSwitch.duration,delay:G?0:Math.min(i,b.listStaggerMaxItems)*b.listStaggerStep,ease:b.surfaceSwitch.ease},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-2.5 py-2 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>_==null?void 0:_(t),role:"button",tabIndex:0,onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),_==null||_(t))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-2.5 top-0 h-px bg-gradient-to-r ${St(t.queueState)}`,"aria-hidden":!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(kt,{name:Pe,hint:Mt(t,Pe),size:"xs"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(je,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>$==null?void 0:$(t.initiativeId,t.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:E,children:E}),g?e.jsx("span",{className:ie("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",g.toneClass),title:g.longLabel,children:g.shortLabel}):null]}),e.jsxs("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 text-caption font-semibold leading-snug text-white",title:v,children:[e.jsx(je,{type:"workstream",size:12,className:"flex-shrink-0 opacity-95"}),e.jsx("span",{className:"line-clamp-2",children:v})]}),Z?e.jsxs("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:`${Ze(t.queueState)}: ${Z}${h?` · ${h}`:""}`,children:[Ze(t.queueState),": ",Z,h?` · ${h}`:""]}):e.jsx("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:Je(t),children:Je(t)}),Ne?e.jsxs("p",{className:"mt-0.5 text-micro text-muted",children:["Runner ",Ne]}):null,e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[(()=>{const N=t.objectiveScore??t.compositeScore??null;if(N==null)return null;const xe=N>=80?"S":N>=60?"A":"B",ne=xe==="S"?"border-[#BFFF00]/30 bg-[#BFFF00]/[0.12] text-[#d8ffa1]":xe==="A"?"border-[#14B8A6]/30 bg-[#14B8A6]/[0.12] text-[#87FFE9]":"border-white/[0.12] bg-white/[0.05] text-white/60";return e.jsxs("span",{className:`chip text-[9px] font-semibold ${ne}`,children:[xe,"-tier"]})})(),(()=>{const N=t.expectedValueUsd,xe=t.sliceTaskCount??0,ne=[];return xe>0&&ne.push(`${xe} tasks`),typeof N=="number"&&N>0&&ne.push(`$${N.toFixed(2)}`),h&&ne.push(h),ne.length===0?null:e.jsx("span",{className:"text-micro text-muted",children:ne.join(" · ")})})()]})]})]}),(t.sliceTaskCount??0)>0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-[2px] rounded-b-2xl overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.max(t.queueState===m.COMPLETED?100:t.queueState===m.RUNNING?50:15,4)}%`,background:`linear-gradient(90deg, ${bt.lime}, ${bt.teal})`,opacity:.6}})}),Fe&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",Fe]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",onClick:N=>N.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:n||u,onClick:()=>void te(r,()=>Le(t),N=>Xe(t,N)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:u?"Already running":"Start now",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(It,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:u?"Running":"Start"})]})}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:n,onClick:()=>Y(N=>N===r?null:r),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Rt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),x===r&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[178px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{Y(null),te(`${r}:top`,()=>H.move({initiativeId:t.initiativeId,workstreamId:t.workstreamId,placement:"top"}),`Moved ${v} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{Y(null),te(`${r}:bottom`,()=>H.move({initiativeId:t.initiativeId,workstreamId:t.workstreamId,placement:"bottom"}),`Moved ${v} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{Y(null),te(`${r}:auto`,()=>it({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId,scope:"initiative"}),`Auto enabled for ${E}.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Auto on"}),e.jsx("button",{type:"button",disabled:H.isRemoving,onClick:()=>{Y(null),ut(t)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]},r)})}):!M&&ee?e.jsx(ss,{axis:"y",values:me,onReorder:t=>{We.current=t,ct(t)},className:"space-y-2.5",children:me.map(t=>dt.get(t)).filter(Boolean).map((t,i)=>e.jsx(fs,{item:t,index:i,actionKey:F,setNotice:y,setUpgradeGate:le,onUpgradeGate:D,onOpenInitiative:$,onOpenSliceDetail:_,selected:V.has(P(t)),selectionEnabled:Q,onToggleSelection:_t,menuKey:x,setMenuKey:Y,onPlayWorkstream:Le,startWorkstreamAutoContinue:it,triagePlacement:oe,onPauseWorkstream:(r,n)=>H.stopTriage({initiativeId:r.initiativeId,workstreamId:r.workstreamId,placement:n,resetToTodo:!1}),onMoveWorkstream:(r,n)=>H.move({initiativeId:r.initiativeId,workstreamId:r.workstreamId,placement:n}),onCommitReorder:()=>void Qt().catch(()=>null),onDismiss:ut,runAction:te},P(t)))}):null,(ze||Re)&&e.jsx("div",{ref:tt,className:"flex h-10 items-center justify-center",children:e.jsx("span",{className:"text-micro text-muted",children:Re?"Loading more queue items…":"Scroll for more"})})]}),e.jsx("div",{className:"pointer-events-none absolute bottom-3 right-3 z-[250]",children:e.jsx(cs,{open:Vt,tone:"warning",title:"Limited signal",message:ve,autoDismissMs:6e3,onDismiss:()=>Me(!0)})})]})}function fs({item:s,index:a,actionKey:c,setNotice:o,setUpgradeGate:p,onUpgradeGate:f,onOpenInitiative:k,onOpenSliceDetail:S,selected:q,selectionEnabled:K,onToggleSelection:he,menuKey:$,setMenuKey:L,onPlayWorkstream:D,startWorkstreamAutoContinue:_,triagePlacement:Q,onPauseWorkstream:Ce,onMoveWorkstream:Ie,onCommitReorder:qe,onDismiss:Ae,runAction:W}){const $e=ns(),T=jt(),[re,fe]=l.useState(!1),d=`${s.initiativeId}:${s.workstreamId}`,ae=c===d,B=s.queueState===m.RUNNING,y=s.nextTaskDueAt?Nt(s.nextTaskDueAt):null,w=Se(s.initiativeTitle,s.initiativeId,"Initiative"),J=Se(s.workstreamTitle,s.workstreamId,"Workstream"),oe=qt(s),j=s.nextTaskTitle?I(s.nextTaskTitle):null,le=s.blockReason?I(s.blockReason):null,F=$t(s),X=Tt(s);return e.jsx(is,{value:d,id:d,dragListener:!1,dragControls:$e,onDragStart:()=>fe(!0),onDragEnd:()=>{fe(!1),qe()},whileDrag:{scale:1.02,boxShadow:"0 20px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(191,255,0,0.15)",zIndex:50,cursor:"grabbing"},className:"relative",children:e.jsxs(z.article,{layout:!0,initial:{opacity:0,y:12,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.98},transition:{duration:T?.01:b.surfaceSwitch.duration,ease:b.surfaceSwitch.ease,delay:T?0:Math.min(a,b.listStaggerMaxItems)*b.listStaggerStep,opacity:{duration:T?.01:b.surfaceSwitch.duration,ease:b.surfaceSwitch.ease}},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>S==null?void 0:S(s),role:"button",tabIndex:0,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),S==null||S(s))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-3 top-0 h-px bg-gradient-to-r ${St(s.queueState)}`,"aria-hidden":!0}),e.jsx("div",{className:"flex items-start justify-between gap-2.5",children:e.jsxs("div",{className:"min-w-0 flex flex-1 items-start gap-2.5",children:[e.jsxs("div",{className:"relative h-8 w-8 flex-shrink-0",children:[e.jsx("div",{className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out ${K?q?"opacity-0 scale-90":"opacity-100 scale-100 group-hover:opacity-0 group-hover:scale-90 group-focus-within:opacity-0 group-focus-within:scale-90":"opacity-100 scale-100"}`,children:e.jsx(kt,{name:F,hint:Mt(s,F),size:"sm"})}),K?e.jsx("button",{type:"button",role:"checkbox","aria-checked":q,"aria-label":"Select queue row",title:q?"Selected (Shift+click for range)":"Select (Shift+click for range)",onClick:x=>{x.stopPropagation(),he(d,!q,x.shiftKey)},onMouseDown:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),className:`absolute inset-0 flex items-center justify-center rounded-full border transition-[opacity,transform,background-color,border-color,color] duration-200 ease-out ${q?"opacity-100 scale-100 border-[#BFFF00]/40 bg-[#BFFF00]/18 text-[#E1FFB2]":"opacity-0 scale-90 border-white/[0.24] bg-black/55 text-white/78 group-hover:opacity-100 group-hover:scale-100 group-focus-within:opacity-100 group-focus-within:scale-100 hover:bg-black/62"}`,children:e.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full border border-current/45 bg-black/30",children:q?e.jsx("svg",{viewBox:"0 0 16 16",className:"h-2.5 w-2.5",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M3.2 8.3 6.2 11l6.6-6.1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(je,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>k==null?void 0:k(s.initiativeId,s.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:w,children:w}),oe?e.jsx("span",{className:ie("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",oe.toneClass),title:oe.longLabel,children:oe.shortLabel}):null]}),e.jsxs("div",{className:"mt-0.5 flex min-w-0 items-start gap-1.5",children:[e.jsx(je,{type:"workstream",size:12,className:"mt-[3px] flex-shrink-0 opacity-95"}),e.jsx("p",{className:"min-w-0 line-clamp-2 text-body font-semibold leading-snug text-white",title:J,children:J})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-micro text-secondary",children:[e.jsx("span",{className:"rounded-full border border-strong bg-white/[0.03] px-2 py-0.5 text-micro uppercase tracking-[0.08em] text-secondary",children:"Runner"}),e.jsxs("span",{className:"truncate text-white/68",children:[F,X?` · ${X}`:""]})]})]})]})}),e.jsx("div",{className:"mt-2 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2 text-caption text-white/68",children:j?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-micro uppercase tracking-[0.08em] text-white/44",children:[e.jsx(je,{type:"task",size:10,className:"flex-shrink-0 opacity-80"}),e.jsx("span",{children:Ze(s.queueState)}),y?e.jsxs("span",{className:"truncate text-micro normal-case tracking-normal text-muted",children:["· ",y]}):null]}),e.jsx("p",{className:"line-clamp-2 break-words text-caption leading-snug text-white/84",title:j,children:j})]}):e.jsx("span",{className:"text-secondary",children:Je(s)})}),le&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",le]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",onClick:x=>x.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:ae||B,onClick:()=>void W(d,()=>D(s),x=>Xe(s,x)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:B?"Already running":"Start this workstream now",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(It,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:B?"Running":"Start"})]})}),e.jsxs("button",{type:"button",onPointerDown:x=>$e.start(x),"aria-label":"Drag to reorder",title:re?"Reordering":"Drag to reorder",className:`control-pill flex h-7 items-center justify-center gap-1 px-2 text-micro font-semibold transition-colors ${re?"border-[#BFFF00]/35 bg-[#BFFF00]/14 text-[#E1FFB2] cursor-grabbing":"cursor-grab hover:bg-white/[0.08] hover:text-bright"}`,children:[re?e.jsx(us,{className:"h-3.5 w-3.5 opacity-90"}):e.jsx(ds,{className:"h-3.5 w-3.5 opacity-90"}),e.jsx("span",{children:re?"Reordering":"Drag"})]}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:ae,onClick:()=>L(x=>x===d?null:d),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Rt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),$===d&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[198px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{L(null),W(`${d}:top`,()=>Ie(s,"top"),`Moved ${J} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{L(null),W(`${d}:bottom`,()=>Ie(s,"bottom"),`Moved ${J} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{L(null),W(`${d}:auto`,()=>_({initiativeId:s.initiativeId,workstreamId:s.workstreamId,agentId:s.runnerAgentId,scope:"initiative"}),`Auto enabled for ${w}.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Auto on"}),B?e.jsx("button",{type:"button",onClick:()=>{L(null),W(`${d}:pause`,()=>Ce(s,Q),`Paused ${J}.`)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Pause run"}):null,e.jsx("button",{type:"button",disabled:ae||B,onClick:()=>{L(null),Ae(s)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]})})}const Ns=Object.freeze(Object.defineProperty({__proto__:null,NextUpPanel:hs},Symbol.toStringTag,{value:"Module"}));export{cs as I,hs as N,Ns as a,as as o};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as p,j as e}from"./Dj2k1r16.js";import{y as D,E as W,e as m,v as Q}from"./
|
|
1
|
+
import{r as p,j as e}from"./Dj2k1r16.js";import{y as D,E as W,e as m,v as Q}from"./C8AYbjlq.js";import"./DMKyYAtD.js";import"./eeHXe_OQ.js";import"./cX2e-TLi.js";import"./BjK42gtU.js";import"./BV0BcV1u.js";const q={blocked:0,failed:1,running:2,active:2,queued:3,in_progress:3,pending:4,paused:5,cancelled:6,completed:7,archived:8};function Y(n){if(!n)return 0;const x=Date.parse(n);return Number.isFinite(x)?x:0}function F(n){return Y(n.updatedAt??n.lastEventAt??n.startedAt)}function G(n,x){const i=q[(n.status??"").toLowerCase()]??99,y=q[(x.status??"").toLowerCase()]??99;return i!==y?i-y:F(x)-F(n)}function H(n,x){const i=n.trim().toLowerCase();return i==="failed"?m.red:i==="blocked"||x>0?m.red:i==="running"||i==="active"||i==="in_progress"?m.lime:i==="queued"||i==="pending"?m.amber:i==="completed"?m.teal:m.textMuted}function J(n){switch(n){case"active":return{title:"Active Sessions",subtitle:"Running and queued work across agents."};case"blocked":return{title:"Blocked Sessions",subtitle:"Work that needs attention before it can proceed."};case"failed":return{title:"Failed Sessions",subtitle:"Runs that exited with an error and may need a retry."};default:return{title:"Sessions",subtitle:"All sessions visible to this dashboard."}}}function K(n,x){var j;const i=(x.status??"").toLowerCase(),y=((j=x.blockers)==null?void 0:j.length)??0;return n==="active"?["running","active","queued","pending","in_progress"].includes(i):n==="blocked"?i==="blocked"||y>0:n==="failed"?i==="failed":!0}function le({open:n,onClose:x,mode:i,sessions:y,onOpenSession:j,onRunAction:A,onRefetch:L,onSetNotice:v}){const{title:I,subtitle:P}=J(i),[S,_]=p.useState(""),[w,B]=p.useState(new Set),[d,k]=p.useState(null),[M,h]=p.useState(null),[N,C]=p.useState(null);p.useEffect(()=>{n&&(h(null),C(null))},[n]);const f=p.useMemo(()=>y.filter(t=>K(i,t)),[i,y]),g=p.useMemo(()=>{const t={};for(const o of f){const a=(o.status??"unknown").toLowerCase();t[a]=(t[a]??0)+1}const r=f.filter(o=>{var a;return(o.status??"").toLowerCase()==="blocked"||(((a=o.blockers)==null?void 0:a.length)??0)>0}).length,s=f.filter(o=>(o.status??"").toLowerCase()==="failed").length,l=f.filter(o=>["running","active","queued","pending","in_progress"].includes((o.status??"").toLowerCase())).length;return{total:f.length,active:l,blocked:r,failed:s,byStatus:t}},[f]),u=p.useMemo(()=>{const t=S.trim().toLowerCase(),r=[...f].sort(G);return t?r.filter(s=>[s.title,s.agentName,s.agentId,s.runId,s.lastEventSummary].filter(Boolean).join(" ").toLowerCase().includes(t)):r},[S,f]);p.useEffect(()=>{n&&B(t=>{const r=new Set(u.map(l=>l.id)),s=new Set;for(const l of t)r.has(l)&&s.add(l);return s})},[u,n]);const b=w.size,T=u.length>0&&u.every(t=>w.has(t.id)),R=()=>{d||B(t=>u.length===0?t:T?new Set:new Set(u.map(r=>r.id)))},U=t=>{d||B(r=>{const s=new Set(r);return s.has(t)?s.delete(t):s.add(t),s})},O=async()=>{if(b===0||d)return;const t=[];for(const s of u){if(!w.has(s.id))continue;const l=s.blockers??[];if(l.length!==0){t.push(`- ${s.title} (${l.length} blocker${l.length===1?"":"s"})`);for(const o of l)t.push(` - ${o}`)}}const r=t.length>0?t.join(`
|
|
2
2
|
`):"No blockers found for selected sessions.";try{await navigator.clipboard.writeText(r),h("Copied blockers to clipboard.")}catch{h("Copy failed (clipboard unavailable).")}},$=async t=>{if(b===0||d)return;if(t==="cancel"){C({text:""});return}const r=u.filter(a=>w.has(a.id));h(null),k({action:t,processed:0,total:r.length});let s=0;const l=[];for(const a of r)try{await A(a,t)}catch(c){s+=1;const E=c instanceof Error?c.message:"unknown error";l.push(`${a.title||a.runId}: ${E}`)}finally{k(c=>c&&{...c,processed:Math.min(c.total,c.processed+1)})}const o=r.length-s;if(k(null),s>0){const a=l.length>0?` — ${l[0]}${l.length>1?` (+${l.length-1} more)`:""}`:"";h(`${t} finished: ${o} ok, ${s} failed.${a}`)}else h(`${t} finished: ${o} session${o===1?"":"s"}.`);try{await L()}catch{}t==="resume"?v(`Bulk resume requested: ${o} ok${s?`, ${s} failed`:""}.`):t==="pause"?v(`Bulk pause requested: ${o} ok${s?`, ${s} failed`:""}.`):t==="complete"&&v(`Bulk mark completed requested: ${o} ok${s?`, ${s} failed`:""}.`)},z=async()=>{if(!N||d||N.text.trim().toUpperCase()!=="CANCEL")return;const t=u.filter(a=>w.has(a.id));h(null),k({action:"cancel",processed:0,total:t.length}),C(null);let r=0;const s=[];for(const a of t)try{await A(a,"cancel")}catch(c){r+=1;const E=c instanceof Error?c.message:"unknown error";s.push(`${a.title||a.runId}: ${E}`)}finally{k(c=>c&&{...c,processed:Math.min(c.total,c.processed+1)})}const l=t.length-r;k(null);const o=s.length>0?` — ${s[0]}${s.length>1?` (+${s.length-1} more)`:""}`:"";h(`cancel finished: ${l} ok${r?`, ${r} failed`:""}.${o}`),v(`Bulk cancel requested: ${l} ok${r?`, ${r} failed`:""}.`);try{await L()}catch{}};return e.jsx(D,{open:n,onClose:x,maxWidth:"max-w-4xl",children:e.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxs("div",{className:"border-b border-subtle px-5 pt-5 pb-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h3",{className:"inline-flex items-center gap-2 text-heading font-semibold text-white",children:[e.jsx(W,{type:"session",size:14}),e.jsx("span",{className:"truncate",children:I}),e.jsx("span",{className:"rounded-full border border-strong bg-white/[0.04] px-2 py-0.5 text-caption font-semibold text-primary",children:g.total})]}),e.jsx("p",{className:"mt-1 text-body leading-relaxed text-secondary",children:P}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-white/[0.1] bg-white/[0.03] px-2 py-0.5 text-micro text-secondary",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:m.teal}}),"Total ",e.jsx("span",{className:"font-semibold text-white",children:g.total})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-white/[0.1] bg-white/[0.03] px-2 py-0.5 text-micro text-secondary",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:g.active>0?m.lime:m.textMuted}}),"Active ",e.jsx("span",{className:"font-semibold text-white",children:g.active})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-white/[0.1] bg-white/[0.03] px-2 py-0.5 text-micro text-secondary",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:g.blocked>0?m.red:m.textMuted}}),"Blocked ",e.jsx("span",{className:"font-semibold text-white",children:g.blocked})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-white/[0.1] bg-white/[0.03] px-2 py-0.5 text-micro text-secondary",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:g.failed>0?m.red:m.textMuted}}),"Failed ",e.jsx("span",{className:"font-semibold text-white",children:g.failed})]})]})]}),e.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-strong bg-white/[0.03] px-2.5 py-1.5 text-caption text-primary transition-colors hover:bg-white/[0.08]","aria-label":"Close bulk modal",children:"Close"})]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"sr-only",htmlFor:"bulk-sessions-search",children:"Search sessions"}),e.jsx("input",{id:"bulk-sessions-search",value:S,onChange:t=>_(t.target.value),placeholder:"Search title, agent, run id…","data-modal-autofocus":"true",className:"w-full rounded-lg border border-strong bg-black/25 px-3 py-2 text-body text-white placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/35"})]}),e.jsx("button",{type:"button",onClick:R,disabled:u.length===0||!!d,className:"rounded-lg border border-strong bg-white/[0.03] px-3 py-2 text-caption text-primary transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:T?"Clear all":`Select all (${u.length})`})]}),M&&e.jsx("div",{className:"mt-3 rounded-xl border border-white/[0.08] bg-white/[0.02] px-3 py-2 text-body text-secondary",children:M}),N&&e.jsxs("div",{className:"mt-3 rounded-xl border border-red-400/25 bg-red-500/[0.06] px-3 py-2.5",children:[e.jsxs("p",{className:"text-body font-semibold text-red-200",children:["Cancel ",b," session",b===1?"":"s","?"]}),e.jsxs("p",{className:"mt-1 text-caption text-red-200/70",children:["This is destructive. Type ",e.jsx("span",{className:"font-semibold",children:"CANCEL"})," to confirm."]}),e.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx("input",{value:N.text,onChange:t=>C({text:t.target.value}),placeholder:"CANCEL",className:"flex-1 rounded-lg border border-red-300/25 bg-black/30 px-3 py-2 text-body text-white placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-red-300/40"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>C(null),className:"rounded-lg border border-strong bg-white/[0.03] px-3 py-2 text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Back"}),e.jsx("button",{type:"button",onClick:z,disabled:N.text.trim().toUpperCase()!=="CANCEL",className:"rounded-lg border border-red-300/25 bg-red-500/15 px-3 py-2 text-caption font-semibold text-red-200 transition-colors hover:bg-red-500/20 disabled:opacity-45",children:"Confirm cancel"})]})]})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:u.length===0?e.jsx("div",{className:"rounded-xl border border-subtle bg-white/[0.02] p-4 text-body text-secondary",children:"No sessions match this view."}):e.jsx("div",{className:"space-y-2",children:u.map(t=>{const r=w.has(t.id),s=t.blockers??[],l=H(t.status??"",s.length),o=t.updatedAt??t.lastEventAt??t.startedAt,a=[(t.agentName??t.agentId??"").trim()||"Unknown agent",(t.status??"unknown").toLowerCase(),o?Q(o):null].filter(Boolean);return e.jsx("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.02] px-3 py-2.5 transition-colors hover:bg-white/[0.04]",style:{borderColor:r?`${m.lime}40`:"rgba(255,255,255,0.08)"},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:()=>U(t.id),disabled:!!d,className:"mt-0.5 h-4 w-4 rounded border-white/20 bg-black/40 text-lime focus:ring-lime/40","aria-label":`Select session ${t.title}`}),e.jsx("button",{type:"button",onClick:()=>j(t),disabled:!!d,className:"min-w-0 flex-1 text-left",title:"Open session inspector",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-body font-medium text-white",children:t.title}),e.jsx("p",{className:"mt-0.5 text-caption text-secondary",children:a.join(" · ")}),t.lastEventSummary&&e.jsx("p",{className:"mt-1 line-clamp-2 text-caption text-secondary",children:t.lastEventSummary}),s.length>0&&e.jsxs("p",{className:"mt-1 text-micro text-red-200/80",children:[s.length," blocker",s.length===1?"":"s"," · ",s[0]]})]}),e.jsx("span",{className:"shrink-0 rounded-full border px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em]",style:{borderColor:`${l}30`,backgroundColor:`${l}14`,color:l},children:(t.status??"unknown").toUpperCase()})]})})]})},t.id)})})}),e.jsxs("div",{className:"flex flex-col gap-2 border-t border-subtle px-5 py-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-caption text-secondary",children:[d?e.jsxs("span",{children:[d.action," ",d.processed,"/",d.total]}):e.jsx("span",{children:b>0?`${b} selected`:"No selection"}),i==="blocked"&&e.jsx("button",{type:"button",onClick:O,disabled:b===0||!!d,className:"rounded-md border border-strong bg-white/[0.03] px-2.5 py-1.5 text-caption text-secondary transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:"Copy blockers"})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{const t=u.find(r=>w.has(r.id))??null;t&&j(t)},disabled:b!==1||!!d,className:"rounded-md border border-strong bg-white/[0.03] px-3 py-1.5 text-caption text-primary transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:"Open inspector"}),e.jsx("button",{type:"button",onClick:()=>void $("resume"),disabled:b===0||!!d,className:"rounded-md border border-lime/25 bg-lime/10 px-3 py-1.5 text-caption font-semibold text-lime transition-colors hover:bg-lime/20 disabled:opacity-45",children:"Resume selected"}),e.jsx("button",{type:"button",onClick:()=>void $("complete"),disabled:b===0||!!d,className:"rounded-md border border-teal/25 bg-teal/10 px-3 py-1.5 text-caption font-semibold text-teal transition-colors hover:bg-teal/20 disabled:opacity-45",children:"Mark completed"}),e.jsx("button",{type:"button",onClick:()=>void $("pause"),disabled:b===0||!!d,className:"rounded-md border border-strong bg-white/[0.03] px-3 py-1.5 text-caption text-primary transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:"Pause selected"}),e.jsx("button",{type:"button",onClick:()=>void $("cancel"),disabled:b===0||!!d,className:"rounded-md border border-red-300/25 bg-red-500/10 px-3 py-1.5 text-caption font-semibold text-red-200 transition-colors hover:bg-red-500/15 disabled:opacity-45",children:"Cancel selected"})]})]})]})})}export{le as BulkSessionsModal};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e}from"./Dj2k1r16.js";import{c as R}from"./DMKyYAtD.js";import{l as T,q as V,y as W,S as u,e as o,M as $,b as E}from"./
|
|
1
|
+
import{r as x,j as e}from"./Dj2k1r16.js";import{c as R}from"./DMKyYAtD.js";import{l as T,q as V,y as W,S as u,e as o,M as $,b as E}from"./C8AYbjlq.js";import{S as b}from"./DvFumX8R.js";import"./eeHXe_OQ.js";import"./cX2e-TLi.js";import"./BjK42gtU.js";import"./BV0BcV1u.js";const f={draft:o.textMuted,in_review:o.amber,approved:o.lime,changes_requested:o.red,superseded:o.textMuted,archived:o.textMuted},U={draft:"Draft",in_review:"In Review",approved:"Approved",changes_requested:"Changes Requested",superseded:"Superseded",archived:"Archived"};function D(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:o.cyan,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),e.jsx("path",{d:"M10 9H8"}),e.jsx("path",{d:"M16 13H8"}),e.jsx("path",{d:"M16 17H8"})]})}function J(){var M,_,C,L,I,q;const{state:l,close:m}=T(),g=null,j=!1,[c,p]=x.useState(null),{data:a,isLoading:F,isFetching:v,error:y,refetch:H}=R({queryKey:V.artifactDetail({artifactId:l.artifactId??"",authToken:g,embedMode:j}),enabled:!!l.artifactId,queryFn:async()=>{const i=E({authToken:g,embedMode:j}),s=await fetch(`/orgx/api/artifacts/${encodeURIComponent(l.artifactId)}`,{headers:i});if(!s.ok){const r=await s.json().catch(()=>null),d=(typeof(r==null?void 0:r.error)=="string"?r.error:null)??(r!=null&&r.error&&typeof r.error=="object"&&typeof r.error.message=="string"?r.error.message:null)??(typeof(r==null?void 0:r.message)=="string"?r.message:null),B=s.status===401?"Authentication required to view this artifact.":`Failed to fetch artifact (${s.status}).`;throw new Error(d!=null&&d.trim().length?d.trim():B)}return s.json()}}),t=a==null?void 0:a.artifact,S=(a==null?void 0:a.localFallback)===!0||((M=t==null?void 0:t.metadata)==null?void 0:M.local_fallback)===!0,w=(typeof(a==null?void 0:a.warning)=="string"&&a.warning.trim().length>0?a.warning:(_=t==null?void 0:t.metadata)==null?void 0:_.local_warning)??null,h=((C=t==null?void 0:t.metadata)==null?void 0:C.preview_markdown)??null,n=x.useMemo(()=>{if(!(t!=null&&t.metadata))return null;const i=[t.metadata.local_source_path,t.metadata.url,t.metadata.path,t.metadata.file_path,t.metadata.filepath,t.metadata.artifact_path,t.metadata.output_path];for(const s of i)if(typeof s=="string"&&s.trim().length>0)return s.trim();return null},[t==null?void 0:t.metadata]),k=x.useMemo(()=>n?/^https?:\/\//i.test(n)?n:`/orgx/api/live/filesystem/open?path=${encodeURIComponent(n)}`:null,[n]),N=((L=t==null?void 0:t.metadata)==null?void 0:L.external_url)??(t==null?void 0:t.artifact_url);x.useEffect(()=>{if(!c)return;const i=window.setTimeout(()=>p(null),2e3);return()=>window.clearTimeout(i)},[c]);const A=async(i,s)=>{try{await navigator.clipboard.writeText(i),p(`${s} copied`)}catch{p("Copy failed")}};return e.jsxs(W,{open:!!l.artifactId,onClose:m,maxWidth:"max-w-3xl",children:[F&&e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx(b,{className:"h-6 w-2/3"}),e.jsx(b,{className:"h-4 w-1/3"}),e.jsx(b,{className:"h-32 w-full"})]}),y&&e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsxs("div",{className:"rounded-xl border border-red-300/22 bg-red-500/[0.08] p-4",children:[e.jsx("p",{className:"text-body font-semibold text-red-200",children:"Failed to load artifact"}),e.jsx("p",{className:"mt-1 text-caption leading-relaxed text-red-100/80",children:y.message})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",onClick:m,className:"rounded-full border border-strong bg-white/[0.03] px-3 py-1.5 text-caption font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Back to activity"}),e.jsx("button",{type:"button",onClick:()=>void H(),disabled:v,className:"rounded-full border border-red-300/22 bg-red-500/[0.08] px-3 py-1.5 text-caption font-semibold text-red-100 transition-colors hover:bg-red-500/[0.14] disabled:opacity-45",children:v?"Retrying…":"Retry"})]})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-subtle px-5 py-4 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(D,{}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"truncate text-sm font-medium text-white",children:t.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx(u,{tone:"muted",className:"text-micro uppercase tracking-[0.06em]",children:((I=t.catalog)==null?void 0:I.label)??t.artifact_type}),e.jsx(u,{tone:"neutral",className:"text-micro font-semibold uppercase tracking-[0.06em]",style:{color:f[t.status]??o.textMuted,backgroundColor:`${f[t.status]??o.textMuted}20`,borderColor:`${f[t.status]??o.textMuted}44`},children:U[t.status]??t.status}),((q=t.catalog)==null?void 0:q.domain)&&e.jsxs("span",{className:"text-micro text-faint",children:[t.catalog.domain," / ",t.catalog.stage]}),c&&e.jsx(u,{tone:"neutral",className:"text-micro text-secondary",children:c})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[N&&e.jsx("a",{href:N,target:"_blank",rel:"noopener noreferrer",className:"rounded-lg p-2 text-secondary transition-colors hover:bg-white/[0.08] hover:text-white",title:"Open source",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M15 3h6v6"}),e.jsx("path",{d:"M10 14 21 3"}),e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}),e.jsx("button",{onClick:m,className:"p-2 rounded-lg hover:bg-white/[0.06] text-secondary hover:text-white transition-colors",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]})]}),e.jsxs("div",{className:"max-h-[65vh] overflow-y-auto px-5 py-4 sm:px-6 space-y-4",children:[S&&e.jsxs("div",{className:"rounded-xl border border-amber-300/25 bg-amber-500/[0.09] p-4",children:[e.jsx("p",{className:"text-caption font-semibold uppercase tracking-[0.08em] text-amber-100/90",children:"Local fallback artifact"}),e.jsx("p",{className:"mt-1 text-body text-amber-50/90",children:"This artifact is buffered locally because OrgX registration is currently unavailable."}),w&&e.jsxs("p",{className:"mt-1.5 text-caption text-amber-100/70",children:["Upstream error: ",w]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[k&&e.jsx("a",{href:k,target:"_blank",rel:"noopener noreferrer",className:"rounded-full border border-amber-200/25 bg-black/25 px-3 py-1 text-caption font-semibold text-amber-100 transition-colors hover:bg-black/35",children:"Open local artifact"}),n&&e.jsx("button",{type:"button",onClick:()=>void A(n,"Artifact path"),className:"rounded-full border border-amber-200/25 bg-black/20 px-3 py-1 text-caption font-semibold text-amber-100 transition-colors hover:bg-black/35",children:"Copy path"})]})]}),t.description&&e.jsx("div",{children:e.jsx("p",{className:"text-body leading-relaxed text-primary",children:t.description})}),h&&e.jsx("div",{className:"rounded-xl border border-white/[0.06] bg-white/[0.02] p-4",children:e.jsx($,{mode:"block",text:h,className:"text-body leading-relaxed text-primary"})}),!t.description&&!h&&e.jsxs("div",{className:"py-12 text-center text-muted",children:[e.jsxs("svg",{className:"mx-auto mb-3 opacity-50",width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"})]}),e.jsx("p",{className:"text-sm",children:"No preview available"})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-1.5 text-micro text-faint",children:[e.jsxs("span",{children:["Entity: ",t.entity_type,"/",t.entity_id.slice(0,8)]}),e.jsxs("span",{children:["Version: ",t.version]}),e.jsxs("span",{children:["Updated:"," ",new Date(t.updated_at).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})]})]})]})]})]})}export{J as ArtifactViewerModal};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./Dj2k1r16.js";import{B as s}from"./
|
|
1
|
+
import{j as r}from"./Dj2k1r16.js";import{B as s}from"./C8AYbjlq.js";function i({className:e=""}){return r.jsx("div",{className:s("shimmer-skeleton",e),"aria-hidden":"true"})}export{i as S};
|
|
Binary file
|
|
Binary file
|