syntaur 0.34.0 → 0.36.0
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/{_basePickBy-BBDt2N1-.js → _basePickBy-Lh5zj1Jj.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-CX9QmA6j.js → _baseUniq-BPE2VzD5.js} +1 -1
- package/dashboard/dist/assets/{arc-CQ6470MS.js → arc-Dwo5A96L.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-q_340vb1.js → architectureDiagram-2XIMDMQ5-DHodinbk.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-DDcJVm3I.js → blockDiagram-WCTKOSBZ-BLEdeDZc.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-Bu7rCnPq.js → c4Diagram-IC4MRINW-BfxPDVhZ.js} +1 -1
- package/dashboard/dist/assets/channel-DRq7WAAN.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-D4mCzHM1.js → chunk-4BX2VUAB-lXhiTmN8.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-qZy5S9aK.js → chunk-55IACEB6-DcKyd5Ft.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-CP-aSp5R.js → chunk-FMBD7UC4-DaSQh-4I.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-Bjd2-Jbp.js → chunk-JSJVCQXG-BqCGk1hk.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-BHALK3O8.js → chunk-KX2RTZJC-x2UQCnir.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-EJgFAbBI.js → chunk-NQ4KR5QH-BaGs3F7c.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-LIJprKdb.js → chunk-QZHKN3VN-02sy1j1c.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-Bp9peutH.js → chunk-WL4C6EOR-DAzsQa_k.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-gwr79r0-.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-gwr79r0-.js +1 -0
- package/dashboard/dist/assets/clone-DihopI50.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-D2Khnalp.js → cose-bilkent-S5V4N54A-Bg5NoB5J.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-A7FKInZZ.js → dagre-KLK3FWXG-od18VoAX.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-CpCC84EE.js → diagram-E7M64L7V-BcS3Wt7S.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-UN3agGn6.js → diagram-IFDJBPK2-BgvMefc3.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-r7USVjRa.js → diagram-P4PSJMXO-DyzaWQJj.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-BqjWbP4d.js → erDiagram-INFDFZHY-BwxxYmWr.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-D3_hInoz.js → flowDiagram-PKNHOUZH-DwdUtKt0.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-Dzf0OcUQ.js → ganttDiagram-A5KZAMGK-BY36vHAR.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-DDVNfYsD.js → gitGraphDiagram-K3NZZRJ6-B1L2Nu_u.js} +1 -1
- package/dashboard/dist/assets/{graph-XQCpDL3e.js → graph-NYqxiaDD.js} +1 -1
- package/dashboard/dist/assets/{index-DTGG1F6E.js → index-B1LQxjk-.js} +2 -2
- package/dashboard/dist/assets/{index-BlO8cOgL.css → index-CZjjsaMH.css} +1 -1
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-Bn7xCldX.js → infoDiagram-LFFYTUFH-D8FSBl4v.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-BMaPOOT_.js → ishikawaDiagram-PHBUUO56-CIWtKNZw.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-CfYBwIWr.js → journeyDiagram-4ABVD52K-BgVDNTtB.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-DQoSgSWy.js → kanban-definition-K7BYSVSG-DUSPe43F.js} +1 -1
- package/dashboard/dist/assets/{layout-CFxopkD1.js → layout-DwVUSb2n.js} +1 -1
- package/dashboard/dist/assets/{linear-q1lde7uY.js → linear-C9DPjTIP.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-CclSNuh7.js → mermaid.core-CX2hHqD6.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-C_XHOwF9.js → mindmap-definition-YRQLILUH-CnqWo4vp.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-C8xZgEA3.js → pieDiagram-SKSYHLDU-BPsLJdMx.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-JZOm4MlZ.js → quadrantDiagram-337W2JSQ-Z57GbRCK.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-0o-kjUyz.js → requirementDiagram-Z7DCOOCP-BwP8mAaA.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-BQVypVuO.js → sankeyDiagram-WA2Y5GQK-CL4ioe3f.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-eHOgK4bp.js → sequenceDiagram-2WXFIKYE-BptD7Vjw.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-D08VAF0t.js → stateDiagram-RAJIS63D-Cp5RX2Hq.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-DdqWNlkA.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-BGqUaDJh.js → timeline-definition-YZTLITO2-dJrKqTxK.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-DDilTqSL.js → treemap-KZPCXAKY-CVyLDZfF.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-CGMFf3rB.js → vennDiagram-LZ73GAT5-5VumRCNt.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-DxpH1jvd.js → xychartDiagram-JWTSCODW-BkmoL9vw.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/index.js +146 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/SESSION-ID-RESOLUTION.md +117 -0
- package/platforms/claude-code/agents/syntaur-expert.md +1 -1
- package/platforms/claude-code/commands/track-session/track-session.md +5 -4
- package/platforms/claude-code/hooks/hooks.json +1 -1
- package/platforms/claude-code/hooks/session-cleanup.sh +16 -8
- package/platforms/claude-code/skills/clear-assignment/SKILL.md +1 -1
- package/platforms/claude-code/skills/complete-assignment/SKILL.md +1 -1
- package/platforms/claude-code/skills/grab-assignment/SKILL.md +5 -4
- package/platforms/claude-code/skills/save-session-summary/SKILL.md +15 -6
- package/platforms/claude-code/skills/track-session/SKILL.md +5 -4
- package/platforms/codex/agents/syntaur-operator.md +1 -1
- package/platforms/codex/commands/save-session-summary.md +1 -1
- package/platforms/codex/scripts/session-cleanup.sh +63 -6
- package/platforms/codex/skills/clear-assignment/SKILL.md +1 -1
- package/platforms/codex/skills/complete-assignment/SKILL.md +1 -1
- package/platforms/codex/skills/grab-assignment/SKILL.md +5 -4
- package/platforms/codex/skills/save-session-summary/SKILL.md +15 -6
- package/platforms/codex/skills/track-session/SKILL.md +5 -4
- package/platforms/cursor/hooks/README.md +49 -0
- package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
- package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
- package/platforms/opencode/plugin/syntaur-session-env.js +30 -0
- package/platforms/pi/README.md +50 -0
- package/skills/clear-assignment/SKILL.md +1 -1
- package/skills/complete-assignment/SKILL.md +1 -1
- package/skills/grab-assignment/SKILL.md +5 -4
- package/skills/save-session-summary/SKILL.md +15 -6
- package/skills/track-session/SKILL.md +5 -4
- package/dashboard/dist/assets/channel-C1JmUAYK.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-CL5uYMtW.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-CL5uYMtW.js +0 -1
- package/dashboard/dist/assets/clone-BGt3nn5b.js +0 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-9uffSM-p.js +0 -1
|
@@ -522,7 +522,7 @@ You can add a description to the \`${si}\` by passing a \`${Vk}\` component as a
|
|
|
522
522
|
|
|
523
523
|
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${si}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
524
524
|
|
|
525
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return f.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},yD=Mk,bD=_k,Gk=Fk,Yk=zk,Jk=Wk,Xk=qk,Qk=Uk,Zk=Hk;const Ga=yD,vD=bD,eS=f.forwardRef(({className:e,...t},n)=>r.jsx(Gk,{ref:n,className:Ce("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));eS.displayName=Gk.displayName;const Bo=f.forwardRef(({className:e,...t},n)=>r.jsxs(vD,{children:[r.jsx(eS,{}),r.jsx(Yk,{ref:n,className:Ce("chrome-card fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 !p-6 outline-none",e),...t})]}));Bo.displayName=Yk.displayName;function Ya({className:e,...t}){return r.jsx("div",{className:Ce("flex flex-col space-y-2 text-left",e),...t})}function Ja({className:e,...t}){return r.jsx("div",{className:Ce("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Uo=f.forwardRef(({className:e,...t},n)=>r.jsx(Qk,{ref:n,className:Ce("text-lg font-semibold tracking-tight text-foreground",e),...t}));Uo.displayName=Qk.displayName;const Vo=f.forwardRef(({className:e,...t},n)=>r.jsx(Zk,{ref:n,className:Ce("text-sm leading-6 text-muted-foreground",e),...t}));Vo.displayName=Zk.displayName;const oo=f.forwardRef(({className:e,...t},n)=>r.jsx(Jk,{ref:n,className:Ce(e),...t}));oo.displayName=Jk.displayName;const Ul=f.forwardRef(({className:e,...t},n)=>r.jsx(Xk,{ref:n,className:Ce(e),...t}));Ul.displayName=Xk.displayName;const wD=[{to:"/",label:"Overview",icon:l0},{to:"/playbooks",label:"Playbooks",icon:o0},{to:"/memories",label:"Memories",icon:JT},{to:"/resources",label:"Resources",icon:dP},{to:"/inventories",label:"Inventories",icon:Ld},{to:"/usage",label:"Usage",icon:Od},{to:"/todos",label:"Todos",icon:Ar},{to:"/views",label:"Saved Views",icon:d0},{to:"/archive",label:"Archive",icon:Dd}],jD=[{suffix:"/projects",label:"Projects",icon:eg},{suffix:"/assignments",label:"Assignments",icon:mP},{suffix:"/servers",label:"Servers",icon:sg},{suffix:"/inventories",label:"Inventories",icon:Ld},{suffix:"/usage",label:"Usage",icon:Od},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Ad},{suffix:"/todos",label:"Todos",icon:Ar}],kD=[{to:"/help",label:"Help",icon:fP},{to:"/settings",label:"Settings",icon:SP}];function SD({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:a}){const[l,c]=f.useState(!1);return Ht({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:l,handler:()=>c(!1)}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"hidden max-h-screen sticky top-0 overflow-y-auto border-r border-border/70 bg-sidebar px-4 py-4 lg:flex lg:flex-col",children:r.jsx(_v,{activeWorkspace:s})}),l?r.jsx("div",{className:"fixed inset-0 z-40 bg-overlay/40 lg:hidden",children:r.jsxs("div",{className:"h-full max-w-xs border-r border-border/70 bg-sidebar p-4 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[r.jsx(Ee,{to:"/",className:"text-lg font-semibold text-foreground",onClick:()=>c(!1),children:"Syntaur"}),r.jsx("button",{type:"button",onClick:()=>c(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border/70 bg-background/80",children:r.jsx(ig,{className:"h-4 w-4"})})]}),r.jsx(_v,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(X3,{title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:()=>c(!0)}),r.jsx("main",{className:"mx-auto w-full max-w-[1480px] px-4 py-4 lg:px-6 lg:py-5",children:a})]})]})})}function _v({activeWorkspace:e,onNavigate:t}){const{data:n}=oc(),s=(n==null?void 0:n.workspaces)??[],a=(n==null?void 0:n.hasUngrouped)??!1,{hidden:l}=Ok(),c=Wn(),[u,p]=f.useState(new Set),[m,h]=f.useState(!1),[x,y]=f.useState(""),[b,C]=f.useState(null),[j,w]=f.useState(null),[k,E]=f.useState(null),[N,P]=f.useState(!1),$=Dt();function T(V){p(L=>{const W=new Set(L);return W.has(V)?W.delete(V):W.add(V),W})}const D=eD([...s,...a?[ld]:[]],l);async function O(V){if(j){P(!0);try{const L=`/api/workspaces/${encodeURIComponent(j)}${V?"?cascade=true":""}`,W=await fetch(L,{method:"DELETE"});if(W.status===409){const oe=await W.json().catch(()=>({}));E((oe==null?void 0:oe.blockedBy)??{projects:[],standalones:[]});return}if(!W.ok){const oe=await W.json().catch(()=>({}));throw new Error(oe.error||"Failed to delete workspace")}w(null),E(null)}catch(L){console.error(L),alert(L instanceof Error?L.message:"Failed to delete workspace")}finally{P(!1)}}}async function J(V,L){try{if(V.type==="project"){const W=await fetch(`/api/projects/${encodeURIComponent(V.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:L})});if(!W.ok){const oe=await W.json().catch(()=>({}));throw new Error(oe.error||"Failed to move project")}return}if(V.type==="standalone-assignment"){const W=await fetch(`/api/assignments/${encodeURIComponent(V.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:L})});if(!W.ok){const oe=await W.json().catch(()=>({}));throw new Error(oe.error||"Failed to move assignment")}return}if(V.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(W){console.error(W),alert(W instanceof Error?W.message:"Failed to move item")}}return r.jsxs("div",{className:"flex h-full flex-col gap-3",children:[r.jsx("div",{className:"space-y-3",children:r.jsxs(Ee,{to:"/",className:"inline-flex items-center gap-3",onClick:t,children:[r.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-lg bg-card text-foreground shadow-sm ring-1 ring-border/60",children:r.jsxs("svg",{viewBox:"0 0 43 51","aria-label":"Syntaur",role:"img",className:"h-4 w-auto",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M13 2C13 0.89543 13.8954 0 15 0H41C42.1046 0 43 0.895431 43 2V12C43 13.1046 42.1046 14 41 14H13V2Z"}),r.jsx("path",{d:"M0 15C0 13.8954 0.895431 13 2 13H14V25C14 26.1046 13.1046 27 12 27H2C0.89543 27 0 26.1046 0 25V15Z"}),r.jsx("path",{d:"M30 49C30 50.1046 29.1046 51 28 51L2 51C0.89543 51 0 50.1046 0 49L0 39C0 37.8954 0.895431 37 2 37L30 37L30 49Z"}),r.jsx("path",{d:"M42.9646 36C42.9646 37.1046 42.0692 38 40.9646 38H28.9646V26C28.9646 24.8954 29.86 24 30.9646 24H40.9646C42.0692 24 42.9646 24.8954 42.9646 26V36Z"})]})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Syntaur"}),r.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Local-first project control"})]})]})}),r.jsx(yv,{items:wD,onNavigate:t}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[D.length===0&&!m&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),D.map(V=>{const L=V==="_ungrouped",W=L?"Ungrouped":yn(V),oe=L?"/w/_ungrouped":`/w/${V}`,z=u.has(V),H=e===V||e===null&&L&&c.pathname.startsWith("/w/_ungrouped"),ee=b===V;return r.jsxs("div",{className:`rounded-md transition ${ee?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:ne=>{ne.dataTransfer.types.includes("application/json")&&(ne.preventDefault(),ne.dataTransfer.dropEffect="move",C(V))},onDragLeave:ne=>{ne.currentTarget.contains(ne.relatedTarget)||C(M=>M===V?null:M)},onDrop:async ne=>{try{const M=ne.dataTransfer.getData("application/json");if(!M)return;ne.preventDefault();let q;try{q=JSON.parse(M)}catch{return}if(!(q!=null&&q.type)||!(q!=null&&q.id))return;await J(q,L?null:V)}finally{C(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>T(V),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${H?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx($r,{className:`h-3 w-3 transition-transform ${z?"-rotate-90":""}`}),W]}),L?null:r.jsx("button",{type:"button",onClick:ne=>{ne.stopPropagation(),w(V),E(null)},title:`Delete workspace "${V}"`,"aria-label":`Delete workspace "${V}"`,className:"mr-1 flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition hover:bg-destructive/10 hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100",children:r.jsx(or,{className:"h-3 w-3"})})]}),!z&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:jD.map(ne=>{const M=`${oe}${ne.suffix}`,q=N0(c.pathname,ne.suffix)&&c.pathname.startsWith(oe),A=ne.icon;return r.jsxs(Ee,{to:M,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${q?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx(A,{className:"h-4 w-4"}),r.jsx("span",{children:ne.label})]},M)})})]},V)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:V=>{V.preventDefault();const L=x.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");L&&(h(!1),y(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:L})}).then(()=>{t==null||t(),$(`/w/${L}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:x,onChange:V=>y(V.target.value),onKeyDown:V=>{V.key==="Escape"&&(h(!1),y(""))},onBlur:()=>{x.trim()||(h(!1),y(""))},placeholder:"workspace-name",className:"w-full rounded-md border border-border/60 bg-background/80 px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-foreground/40 focus:outline-none"})}):r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium text-muted-foreground/60 transition hover:text-muted-foreground",children:[r.jsx(rn,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(yv,{items:kD,onNavigate:t}),r.jsx(Ga,{open:j!==null,onOpenChange:V=>{N||V||(w(null),E(null))},children:r.jsxs(Bo,{children:[r.jsxs(Ya,{children:[r.jsx(Uo,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(Vo,{children:k?r.jsxs(r.Fragment,{children:["The workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," is still referenced by:"]}):r.jsxs(r.Fragment,{children:["Remove the workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),k?r.jsxs("div",{className:"space-y-2 text-sm",children:[k.projects.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",k.projects.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.projects.map(V=>r.jsx("li",{children:r.jsx(Ee,{to:`/projects/${V}`,className:"hover:underline",children:V})},V))})]}):null,k.standalones.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",k.standalones.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.standalones.map(V=>r.jsx("li",{children:r.jsx(Ee,{to:`/assignments/${V}`,className:"hover:underline",children:V})},V))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Choose "Clear references and delete" to set ',r.jsx("code",{children:"workspace:"})," / ",r.jsx("code",{children:"workspaceGroup:"})," to ",r.jsx("code",{children:"null"})," on each, then remove the workspace."]})]}):null,r.jsxs(Ja,{children:[r.jsx(Ul,{disabled:N,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(oo,{disabled:N,onClick:V=>{V.preventDefault(),O(!0)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:N?"Working…":"Clear references and delete"}):r.jsx(oo,{disabled:N,onClick:V=>{V.preventDefault(),O(!1)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:N?"Working…":"Delete"})]})]})})]})}function ND(){const e=Wn(),{workspace:t}=$t(),{title:n,breadcrumbs:s,projectSlug:a}=C0(e.pathname);return r.jsx(SD,{title:n,breadcrumbs:s,projectSlug:a,workspace:t??null,children:r.jsx(lT,{})})}function mt({label:e="Loading dashboard data…"}){return r.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:r.jsx("div",{className:"chrome-card !px-4 !py-3",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function wt({title:e="Something went wrong",error:t,action:n}){return r.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),n?r.jsx("div",{className:"pt-2",children:n}):null]})})}function qu({command:e,description:t,example:n}){return r.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[r.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?r.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?r.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function We({title:e,description:t,children:n,className:s,actions:a}){return r.jsxs("section",{className:Ce("surface-panel space-y-3",s),children:[e||a?r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?r.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),a]}):null,n]})}function CD({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return r.jsx(We,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:r.jsx(Ee,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:r.jsx("div",{className:"space-y-3",children:n.map((s,a)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:a+1}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:s.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:s.detail}),s.command?r.jsx(qu,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const jm={review:"{total} items ready for your review","review.singular":"Review {title}",ready_to_implement:"{total} plans ready to implement — start with {title}","ready_to_implement.singular":"Start implementing {title}",ready_for_planning:"{total} assignments ready to plan — start with {title}","ready_for_planning.singular":"Plan {title}",in_progress:"Resume {title} ({total} in progress)","in_progress.singular":"Resume {title}",draft:"Shape your {total} drafts — start with {title}","draft.singular":"Shape {title}",blocked:"Unblock {title} ({total} blocked)","blocked.singular":"Unblock {title}",stale:"Triage {total} stale items","stale.singular":"Triage {title} — sitting stale",clean:"You’re all clear. Nothing needs you right now."},Ho={emptyStateCleanTitle:"You’re all clear",emptyStateCleanCTA:"Browse projects",recentSessionsEmptyTitle:"No recent sessions",recentSessionsEmptyHint:"Use /grab-assignment or `syntaur track-session` to register one.",recentSessionsCopyPathLabel:"Copy path",recentSessionsCopyPathDisabled:"Session has no path",recentSessionsCopyFallbackHint:"Press ⌘C to copy"};function ED(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function TD({hero:e,itemsById:t}){const n=ln();if(e.kind==="clean")return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-border/60 bg-background/60 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:Ho.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:jm.clean}),r.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"When work shows up — a draft, a review, a stale row — it’ll surface here."}),r.jsx("div",{className:"mt-4",children:r.jsx(Ee,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:Ho.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,a=(s==null?void 0:s.assignmentTitle)??"",l=jm[e.copyKey]??jm[e.kind],c=ED(l,{total:e.total,title:a}),u=s?PD(s,n):`${n}/assignments`;return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-primary/20 bg-primary/5 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:"What needs you today"}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:c}),s?r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["In ",r.jsx("span",{className:"font-medium text-foreground",children:s.projectTitle??"Standalone"})," ","· status ",r.jsx("span",{className:"font-medium text-foreground",children:s.status})]}):null,r.jsx("div",{className:"mt-4",children:r.jsxs(Ee,{to:u,className:"shell-action shell-action--cta",children:["Open ",a||"assignment"]})})]})}function PD(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Rg=["kanban","list","table"],tS=["title","status","priority","assignee","dependencies","created","updated"],RD=["asc","desc"],AD=["comfortable","compact"],DD=["none","status","type","priority","assignee","project"],$D=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function tt(e){const t=e===void 0?[]:Array.isArray(e)?e:[e],n=[];for(const s of t){if(typeof s!="string")continue;const a=s.trim();!a||a==="all"||n.includes(a)||n.push(a)}return n}function LD(e,t){const n=tt(e),s=tt(t);return n.length===s.length&&n.every(a=>s.includes(a))}const OD={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},Vl={version:1,global:OD,projects:{}};function km(e){return e==="table"?"table":"kanban"}function ID(e,t){return t?{...e,...t}:{...e}}function nS(e,t){const n=e.global;if(t===null)return n;const s=e.projects[t];return s?{defaultView:s.defaultView??n.defaultView,sortField:s.sortField??n.sortField,sortDirection:s.sortDirection??n.sortDirection,density:n.density,grouping:s.grouping??n.grouping,filters:ID(n.filters,s.filters)}:n}const Sm=["title","status","priority","assignee","dependencies","created","updated"],MD=["small","wide","tall","large"],_D={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},Fv="2026-05-21T00:00:00Z";function Nm(e,t,n){return{id:e,name:t,workspace:null,config:{viewMode:"list",filters:{..._D,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:Fv,updatedAt:Fv}}const ao={version:1,views:[Nm("default-recently-updated","Recently updated",{}),Nm("default-high-priority","High priority",{priority:"high"}),Nm("default-stale","Stale",{activity:"stale"})],dashboard:{version:1,slots:[{id:"slot-0",widget:{kind:"agent-sessions"}},{id:"slot-1",widget:{kind:"saved-view",viewId:"default-recently-updated"}},{id:"slot-2",widget:{kind:"saved-view",viewId:"default-high-priority"}},{id:"slot-3",widget:{kind:"saved-view",viewId:"default-stale"}},{id:"slot-4",widget:{kind:"inventories"}}]}};function rS(e,t){const n=tt(e.filters.project),s=n.length===0||n.length===1&&n[0]===t,a=e.filters.activity,l=typeof e.filters.search=="string"&&e.filters.search.trim().length>0;return s&&(!a||a==="all")&&!l}function sS(e,t){switch(t.kind){case"global":return e.workspace===null;case"workspace":return e.workspace===t.workspace||e.workspace===null;case"project":return e.workspace===t.workspace||e.workspace===null?rS(e.config,t.slug):!1}}const oS=`syntaur.savedViews.cache.v${ao.version}`;let oi=FD(),_o=null,Ag=null;const yh=new Set,cd=new Set;let aS=0;function iS(){return++aS}function bh(e){return e===aS}function FD(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(oS);if(!e)return null;const t=JSON.parse(e);return t.version!==ao.version?null:t}catch{return null}}function zD(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(oS,JSON.stringify(e))}catch{}}function lS(e){oi=e,Ag=null,zD(e);for(const t of yh)t(e);for(const t of cd)t(null)}function BD(e){Ag=e;for(const t of cd)t(e)}function cS(e){if(!e||typeof e!="object")return ao;const t=e;return t.version!==ao.version||!Array.isArray(t.views)||!t.dashboard?ao:t}function zv(){if(_o)return _o;const e=iS();return _o=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=cS(t);return bh(e)&&lS(n),_o=null,oi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return bh(e)&&BD(n),_o=null,oi??ao}),_o}function Dg(){const[e,t]=f.useState(()=>oi??ao),[n,s]=f.useState(()=>oi===null),[a,l]=f.useState(!1),[c,u]=f.useState(()=>Ag);return f.useEffect(()=>{let m=!1;oi===null&&s(!0),zv().then(y=>{m||(t(y),s(!1),l(!0))});const h=y=>{m||(t(y),s(!1),l(!0),u(null))},x=y=>{m||(u(y),s(!1),l(!0))};return yh.add(h),cd.add(x),()=>{m=!0,yh.delete(h),cd.delete(x)}},[]),{file:e,loading:n,ready:a,error:c,refetch:()=>{_o=null,s(!0),u(null),l(!1),zv()}}}function Vd(){const{file:e,loading:t}=Dg();return{views:e.views,loading:t}}function UD(){const{file:e,loading:t}=Dg();return{layout:e.dashboard,loading:t}}function Go(e){const{file:t,loading:n,ready:s,error:a,refetch:l}=Dg();return e?{view:t.views.find(u=>u.id===e)??null,loading:n,ready:s,error:a,refetch:l}:{view:null,loading:!1,ready:!0,error:null,refetch:l}}async function Hd(e,t,n){const s=iS(),a=await fetch(t,{method:e,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!a.ok){const c=await a.json().catch(()=>({error:`HTTP ${a.status}`}));throw new Error(c.error??`HTTP ${a.status}`)}const l=cS(await a.json());return bh(s)&&lS(l),l}function Wd(e){return Hd("POST","/api/saved-views",e)}function $g(e,t){return Hd("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function VD(e){return Hd("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function HD(e){return Hd("PUT","/api/dashboard",{slots:e})}const WD=["top","right","bottom","left"],co=Math.min,hr=Math.max,ud=Math.round,Pu=Math.floor,ds=e=>({x:e,y:e}),KD={left:"right",right:"left",bottom:"top",top:"bottom"};function vh(e,t,n){return hr(e,co(t,n))}function As(e,t){return typeof e=="function"?e(t):e}function Ds(e){return e.split("-")[0]}function wi(e){return e.split("-")[1]}function Lg(e){return e==="x"?"y":"x"}function Og(e){return e==="y"?"height":"width"}function ls(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ig(e){return Lg(ls(e))}function qD(e,t,n){n===void 0&&(n=!1);const s=wi(e),a=Ig(e),l=Og(a);let c=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=dd(c)),[c,dd(c)]}function GD(e){const t=dd(e);return[wh(e),t,wh(t)]}function wh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bv=["left","right"],Uv=["right","left"],YD=["top","bottom"],JD=["bottom","top"];function XD(e,t,n){switch(e){case"top":case"bottom":return n?t?Uv:Bv:t?Bv:Uv;case"left":case"right":return t?YD:JD;default:return[]}}function QD(e,t,n,s){const a=wi(e);let l=XD(Ds(e),n==="start",s);return a&&(l=l.map(c=>c+"-"+a),t&&(l=l.concat(l.map(wh)))),l}function dd(e){const t=Ds(e);return KD[t]+e.slice(t.length)}function ZD(e){return{top:0,right:0,bottom:0,left:0,...e}}function uS(e){return typeof e!="number"?ZD(e):{top:e,right:e,bottom:e,left:e}}function fd(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}function Vv(e,t,n){let{reference:s,floating:a}=e;const l=ls(t),c=Ig(t),u=Og(c),p=Ds(t),m=l==="y",h=s.x+s.width/2-a.width/2,x=s.y+s.height/2-a.height/2,y=s[u]/2-a[u]/2;let b;switch(p){case"top":b={x:h,y:s.y-a.height};break;case"bottom":b={x:h,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:x};break;case"left":b={x:s.x-a.width,y:x};break;default:b={x:s.x,y:s.y}}switch(wi(t)){case"start":b[c]-=y*(n&&m?-1:1);break;case"end":b[c]+=y*(n&&m?-1:1);break}return b}async function e4(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:l,rects:c,elements:u,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:x="floating",altBoundary:y=!1,padding:b=0}=As(t,e),C=uS(b),w=u[y?x==="floating"?"reference":"floating":x],k=fd(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(w)))==null||n?w:w.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:p})),E=x==="floating"?{x:s,y:a,width:c.floating.width,height:c.floating.height}:c.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),P=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},$=fd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:N,strategy:p}):E);return{top:(k.top-$.top+C.top)/P.y,bottom:($.bottom-k.bottom+C.bottom)/P.y,left:(k.left-$.left+C.left)/P.x,right:($.right-k.right+C.right)/P.x}}const t4=50,n4=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:e4},p=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:x}=Vv(m,s,p),y=s,b=0;const C={};for(let j=0;j<l.length;j++){const w=l[j];if(!w)continue;const{name:k,fn:E}=w,{x:N,y:P,data:$,reset:T}=await E({x:h,y:x,initialPlacement:s,placement:y,strategy:a,middlewareData:C,rects:m,platform:u,elements:{reference:e,floating:t}});h=N??h,x=P??x,C[k]={...C[k],...$},T&&b<t4&&(b++,typeof T=="object"&&(T.placement&&(y=T.placement),T.rects&&(m=T.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:h,y:x}=Vv(m,y,p)),j=-1)}return{x:h,y:x,placement:y,strategy:a,middlewareData:C}},r4=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:l,platform:c,elements:u,middlewareData:p}=t,{element:m,padding:h=0}=As(e,t)||{};if(m==null)return{};const x=uS(h),y={x:n,y:s},b=Ig(a),C=Og(b),j=await c.getDimensions(m),w=b==="y",k=w?"top":"left",E=w?"bottom":"right",N=w?"clientHeight":"clientWidth",P=l.reference[C]+l.reference[b]-y[b]-l.floating[C],$=y[b]-l.reference[b],T=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let D=T?T[N]:0;(!D||!await(c.isElement==null?void 0:c.isElement(T)))&&(D=u.floating[N]||l.floating[C]);const O=P/2-$/2,J=D/2-j[C]/2-1,V=co(x[k],J),L=co(x[E],J),W=V,oe=D-j[C]-L,z=D/2-j[C]/2+O,H=vh(W,z,oe),ee=!p.arrow&&wi(a)!=null&&z!==H&&l.reference[C]/2-(z<W?V:L)-j[C]/2<0,ne=ee?z<W?z-W:z-oe:0;return{[b]:y[b]+ne,data:{[b]:H,centerOffset:z-H-ne,...ee&&{alignmentOffset:ne}},reset:ee}}}),s4=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:a,middlewareData:l,rects:c,initialPlacement:u,platform:p,elements:m}=t,{mainAxis:h=!0,crossAxis:x=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...w}=As(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=Ds(a),E=ls(u),N=Ds(u)===u,P=await(p.isRTL==null?void 0:p.isRTL(m.floating)),$=y||(N||!j?[dd(u)]:GD(u)),T=C!=="none";!y&&T&&$.push(...QD(u,j,C,P));const D=[u,...$],O=await p.detectOverflow(t,w),J=[];let V=((s=l.flip)==null?void 0:s.overflows)||[];if(h&&J.push(O[k]),x){const z=qD(a,c,P);J.push(O[z[0]],O[z[1]])}if(V=[...V,{placement:a,overflows:J}],!J.every(z=>z<=0)){var L,W;const z=(((L=l.flip)==null?void 0:L.index)||0)+1,H=D[z];if(H&&(!(x==="alignment"?E!==ls(H):!1)||V.every(M=>ls(M.placement)===E?M.overflows[0]>0:!0)))return{data:{index:z,overflows:V},reset:{placement:H}};let ee=(W=V.filter(ne=>ne.overflows[0]<=0).sort((ne,M)=>ne.overflows[1]-M.overflows[1])[0])==null?void 0:W.placement;if(!ee)switch(b){case"bestFit":{var oe;const ne=(oe=V.filter(M=>{if(T){const q=ls(M.placement);return q===E||q==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(q=>q>0).reduce((q,A)=>q+A,0)]).sort((M,q)=>M[1]-q[1])[0])==null?void 0:oe[0];ne&&(ee=ne);break}case"initialPlacement":ee=u;break}if(a!==ee)return{reset:{placement:ee}}}return{}}}};function Hv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wv(e){return WD.some(t=>e[t]>=0)}const o4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:a="referenceHidden",...l}=As(e,t);switch(a){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),u=Hv(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Wv(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=Hv(c,n.floating);return{data:{escapedOffsets:u,escaped:Wv(u)}}}default:return{}}}}},dS=new Set(["left","top"]);async function a4(e,t){const{placement:n,platform:s,elements:a}=e,l=await(s.isRTL==null?void 0:s.isRTL(a.floating)),c=Ds(n),u=wi(n),p=ls(n)==="y",m=dS.has(c)?-1:1,h=l&&p?-1:1,x=As(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:C}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return u&&typeof C=="number"&&(b=u==="end"?C*-1:C),p?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const i4=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:l,placement:c,middlewareData:u}=t,p=await a4(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:a+p.x,y:l+p.y,data:{...p,placement:c}}}}},l4=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a,platform:l}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:p={fn:k=>{let{x:E,y:N}=k;return{x:E,y:N}}},...m}=As(e,t),h={x:n,y:s},x=await l.detectOverflow(t,m),y=ls(Ds(a)),b=Lg(y);let C=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",N=C+x[k],P=C-x[E];C=vh(N,C,P)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",N=j+x[k],P=j-x[E];j=vh(N,j,P)}const w=p.fn({...t,[b]:C,[y]:j});return{...w,data:{x:w.x-n,y:w.y-s,enabled:{[b]:c,[y]:u}}}}}},c4=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:a,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:p=!0,crossAxis:m=!0}=As(e,t),h={x:n,y:s},x=ls(a),y=Lg(x);let b=h[y],C=h[x];const j=As(u,t),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(p){const N=y==="y"?"height":"width",P=l.reference[y]-l.floating[N]+w.mainAxis,$=l.reference[y]+l.reference[N]-w.mainAxis;b<P?b=P:b>$&&(b=$)}if(m){var k,E;const N=y==="y"?"width":"height",P=dS.has(Ds(a)),$=l.reference[x]-l.floating[N]+(P&&((k=c.offset)==null?void 0:k[x])||0)+(P?0:w.crossAxis),T=l.reference[x]+l.reference[N]+(P?0:((E=c.offset)==null?void 0:E[x])||0)-(P?w.crossAxis:0);C<$?C=$:C>T&&(C=T)}return{[y]:b,[x]:C}}}},u4=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:a,rects:l,platform:c,elements:u}=t,{apply:p=()=>{},...m}=As(e,t),h=await c.detectOverflow(t,m),x=Ds(a),y=wi(a),b=ls(a)==="y",{width:C,height:j}=l.floating;let w,k;x==="top"||x==="bottom"?(w=x,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=x,w=y==="end"?"top":"bottom");const E=j-h.top-h.bottom,N=C-h.left-h.right,P=co(j-h[w],E),$=co(C-h[k],N),T=!t.middlewareData.shift;let D=P,O=$;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(D=E),T&&!y){const V=hr(h.left,0),L=hr(h.right,0),W=hr(h.top,0),oe=hr(h.bottom,0);b?O=C-2*(V!==0||L!==0?V+L:hr(h.left,h.right)):D=j-2*(W!==0||oe!==0?W+oe:hr(h.top,h.bottom))}await p({...t,availableWidth:O,availableHeight:D});const J=await c.getDimensions(u.floating);return C!==J.width||j!==J.height?{reset:{rects:!0}}:{}}}};function Kd(){return typeof window<"u"}function ji(e){return fS(e)?(e.nodeName||"").toLowerCase():"#document"}function yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function gs(e){var t;return(t=(fS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fS(e){return Kd()?e instanceof Node||e instanceof yr(e).Node:!1}function qr(e){return Kd()?e instanceof Element||e instanceof yr(e).Element:!1}function Is(e){return Kd()?e instanceof HTMLElement||e instanceof yr(e).HTMLElement:!1}function Kv(e){return!Kd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yr(e).ShadowRoot}function ic(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=Gr(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&a!=="inline"&&a!=="contents"}function d4(e){return/^(table|td|th)$/.test(ji(e))}function qd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const f4=/transform|translate|scale|rotate|perspective|filter/,p4=/paint|layout|strict|content/,Io=e=>!!e&&e!=="none";let Cm;function Mg(e){const t=qr(e)?Gr(e):e;return Io(t.transform)||Io(t.translate)||Io(t.scale)||Io(t.rotate)||Io(t.perspective)||!_g()&&(Io(t.backdropFilter)||Io(t.filter))||f4.test(t.willChange||"")||p4.test(t.contain||"")}function m4(e){let t=uo(e);for(;Is(t)&&!fi(t);){if(Mg(t))return t;if(qd(t))return null;t=uo(t)}return null}function _g(){return Cm==null&&(Cm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Cm}function fi(e){return/^(html|body|#document)$/.test(ji(e))}function Gr(e){return yr(e).getComputedStyle(e)}function Gd(e){return qr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uo(e){if(ji(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Kv(e)&&e.host||gs(e);return Kv(t)?t.host:t}function pS(e){const t=uo(e);return fi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Is(t)&&ic(t)?t:pS(t)}function Hl(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=pS(e),l=a===((s=e.ownerDocument)==null?void 0:s.body),c=yr(a);if(l){const u=jh(c);return t.concat(c,c.visualViewport||[],ic(a)?a:[],u&&n?Hl(u):[])}else return t.concat(a,Hl(a,[],n))}function jh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mS(e){const t=Gr(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=Is(e),l=a?e.offsetWidth:n,c=a?e.offsetHeight:s,u=ud(n)!==l||ud(s)!==c;return u&&(n=l,s=c),{width:n,height:s,$:u}}function Fg(e){return qr(e)?e:e.contextElement}function ai(e){const t=Fg(e);if(!Is(t))return ds(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:l}=mS(t);let c=(l?ud(n.width):n.width)/s,u=(l?ud(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const h4=ds(0);function hS(e){const t=yr(e);return!_g()||!t.visualViewport?h4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function g4(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yr(e)?!1:t}function Yo(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=Fg(e);let c=ds(1);t&&(s?qr(s)&&(c=ai(s)):c=ai(e));const u=g4(l,n,s)?hS(l):ds(0);let p=(a.left+u.x)/c.x,m=(a.top+u.y)/c.y,h=a.width/c.x,x=a.height/c.y;if(l){const y=yr(l),b=s&&qr(s)?yr(s):s;let C=y,j=jh(C);for(;j&&s&&b!==C;){const w=ai(j),k=j.getBoundingClientRect(),E=Gr(j),N=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,P=k.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;p*=w.x,m*=w.y,h*=w.x,x*=w.y,p+=N,m+=P,C=yr(j),j=jh(C)}}return fd({width:h,height:x,x:p,y:m})}function Yd(e,t){const n=Gd(e).scrollLeft;return t?t.left+n:Yo(gs(e)).left+n}function gS(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Yd(e,n),a=n.top+t.scrollTop;return{x:s,y:a}}function x4(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const l=a==="fixed",c=gs(s),u=t?qd(t.floating):!1;if(s===c||u&&l)return n;let p={scrollLeft:0,scrollTop:0},m=ds(1);const h=ds(0),x=Is(s);if((x||!x&&!l)&&((ji(s)!=="body"||ic(c))&&(p=Gd(s)),x)){const b=Yo(s);m=ai(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!x&&!l?gS(c,p):ds(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-p.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-p.scrollTop*m.y+h.y+y.y}}function y4(e){return Array.from(e.getClientRects())}function b4(e){const t=gs(e),n=Gd(e),s=e.ownerDocument.body,a=hr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=hr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Yd(e);const u=-n.scrollTop;return Gr(s).direction==="rtl"&&(c+=hr(t.clientWidth,s.clientWidth)-a),{width:a,height:l,x:c,y:u}}const qv=25;function v4(e,t){const n=yr(e),s=gs(e),a=n.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,p=0;if(a){l=a.width,c=a.height;const h=_g();(!h||h&&t==="fixed")&&(u=a.offsetLeft,p=a.offsetTop)}const m=Yd(s);if(m<=0){const h=s.ownerDocument,x=h.body,y=getComputedStyle(x),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,C=Math.abs(s.clientWidth-x.clientWidth-b);C<=qv&&(l-=C)}else m<=qv&&(l+=m);return{width:l,height:c,x:u,y:p}}function w4(e,t){const n=Yo(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,l=Is(e)?ai(e):ds(1),c=e.clientWidth*l.x,u=e.clientHeight*l.y,p=a*l.x,m=s*l.y;return{width:c,height:u,x:p,y:m}}function Gv(e,t,n){let s;if(t==="viewport")s=v4(e,n);else if(t==="document")s=b4(gs(e));else if(qr(t))s=w4(t,n);else{const a=hS(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return fd(s)}function xS(e,t){const n=uo(e);return n===t||!qr(n)||fi(n)?!1:Gr(n).position==="fixed"||xS(n,t)}function j4(e,t){const n=t.get(e);if(n)return n;let s=Hl(e,[],!1).filter(u=>qr(u)&&ji(u)!=="body"),a=null;const l=Gr(e).position==="fixed";let c=l?uo(e):e;for(;qr(c)&&!fi(c);){const u=Gr(c),p=Mg(c);!p&&u.position==="fixed"&&(a=null),(l?!p&&!a:!p&&u.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||ic(c)&&!p&&xS(e,c))?s=s.filter(h=>h!==c):a=u,c=uo(c)}return t.set(e,s),s}function k4(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?qd(t)?[]:j4(t,this._c):[].concat(n),s],u=Gv(t,c[0],a);let p=u.top,m=u.right,h=u.bottom,x=u.left;for(let y=1;y<c.length;y++){const b=Gv(t,c[y],a);p=hr(b.top,p),m=co(b.right,m),h=co(b.bottom,h),x=hr(b.left,x)}return{width:m-x,height:h-p,x,y:p}}function S4(e){const{width:t,height:n}=mS(e);return{width:t,height:n}}function N4(e,t,n){const s=Is(t),a=gs(t),l=n==="fixed",c=Yo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const p=ds(0);function m(){p.x=Yd(a)}if(s||!s&&!l)if((ji(t)!=="body"||ic(a))&&(u=Gd(t)),s){const b=Yo(t,!0,l,t);p.x=b.x+t.clientLeft,p.y=b.y+t.clientTop}else a&&m();l&&!s&&a&&m();const h=a&&!s&&!l?gS(a,u):ds(0),x=c.left+u.scrollLeft-p.x-h.x,y=c.top+u.scrollTop-p.y-h.y;return{x,y,width:c.width,height:c.height}}function Em(e){return Gr(e).position==="static"}function Yv(e,t){if(!Is(e)||Gr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return gs(e)===n&&(n=n.ownerDocument.body),n}function yS(e,t){const n=yr(e);if(qd(e))return n;if(!Is(e)){let a=uo(e);for(;a&&!fi(a);){if(qr(a)&&!Em(a))return a;a=uo(a)}return n}let s=Yv(e,t);for(;s&&d4(s)&&Em(s);)s=Yv(s,t);return s&&fi(s)&&Em(s)&&!Mg(s)?n:s||m4(e)||n}const C4=async function(e){const t=this.getOffsetParent||yS,n=this.getDimensions,s=await n(e.floating);return{reference:N4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function E4(e){return Gr(e).direction==="rtl"}const T4={convertOffsetParentRelativeRectToViewportRelativeRect:x4,getDocumentElement:gs,getClippingRect:k4,getOffsetParent:yS,getElementRects:C4,getClientRects:y4,getDimensions:S4,getScale:ai,isElement:qr,isRTL:E4};function bS(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function P4(e,t){let n=null,s;const a=gs(e);function l(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,p){u===void 0&&(u=!1),p===void 0&&(p=1),l();const m=e.getBoundingClientRect(),{left:h,top:x,width:y,height:b}=m;if(u||t(),!y||!b)return;const C=Pu(x),j=Pu(a.clientWidth-(h+y)),w=Pu(a.clientHeight-(x+b)),k=Pu(h),N={rootMargin:-C+"px "+-j+"px "+-w+"px "+-k+"px",threshold:hr(0,co(1,p))||1};let P=!0;function $(T){const D=T[0].intersectionRatio;if(D!==p){if(!P)return c();D?c(!1,D):s=setTimeout(()=>{c(!1,1e-7)},1e3)}D===1&&!bS(m,e.getBoundingClientRect())&&c(),P=!1}try{n=new IntersectionObserver($,{...N,root:a.ownerDocument})}catch{n=new IntersectionObserver($,N)}n.observe(e)}return c(!0),l}function R4(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:p=!1}=s,m=Fg(e),h=a||l?[...m?Hl(m):[],...t?Hl(t):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const x=m&&u?P4(m,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(k=>{let[E]=k;E&&E.target===m&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var N;(N=b)==null||N.observe(t)})),n()}),m&&!p&&b.observe(m),t&&b.observe(t));let C,j=p?Yo(e):null;p&&w();function w(){const k=Yo(e);j&&!bS(j,k)&&n(),j=k,C=requestAnimationFrame(w)}return n(),()=>{var k;h.forEach(E=>{a&&E.removeEventListener("scroll",n),l&&E.removeEventListener("resize",n)}),x==null||x(),(k=b)==null||k.disconnect(),b=null,p&&cancelAnimationFrame(C)}}const A4=i4,D4=l4,$4=s4,L4=u4,O4=o4,Jv=r4,I4=c4,M4=(e,t,n)=>{const s=new Map,a={platform:T4,...n},l={...a.platform,_c:s};return n4(e,t,{...a,platform:l})};var _4=typeof document<"u",F4=function(){},Gu=_4?f.useLayoutEffect:F4;function pd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!pd(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const l=a[s];if(!(l==="_owner"&&e.$$typeof)&&!pd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function vS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xv(e,t){const n=vS(e);return Math.round(t*n)/n}function Tm(e){const t=f.useRef(e);return Gu(()=>{t.current=e}),t}function z4(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:l,floating:c}={},transform:u=!0,whileElementsMounted:p,open:m}=e,[h,x]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=f.useState(s);pd(y,s)||b(s);const[C,j]=f.useState(null),[w,k]=f.useState(null),E=f.useCallback(M=>{M!==T.current&&(T.current=M,j(M))},[]),N=f.useCallback(M=>{M!==D.current&&(D.current=M,k(M))},[]),P=l||C,$=c||w,T=f.useRef(null),D=f.useRef(null),O=f.useRef(h),J=p!=null,V=Tm(p),L=Tm(a),W=Tm(m),oe=f.useCallback(()=>{if(!T.current||!D.current)return;const M={placement:t,strategy:n,middleware:y};L.current&&(M.platform=L.current),M4(T.current,D.current,M).then(q=>{const A={...q,isPositioned:W.current!==!1};z.current&&!pd(O.current,A)&&(O.current=A,Ts.flushSync(()=>{x(A)}))})},[y,t,n,L,W]);Gu(()=>{m===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,x(M=>({...M,isPositioned:!1})))},[m]);const z=f.useRef(!1);Gu(()=>(z.current=!0,()=>{z.current=!1}),[]),Gu(()=>{if(P&&(T.current=P),$&&(D.current=$),P&&$){if(V.current)return V.current(P,$,oe);oe()}},[P,$,oe,V,J]);const H=f.useMemo(()=>({reference:T,floating:D,setReference:E,setFloating:N}),[E,N]),ee=f.useMemo(()=>({reference:P,floating:$}),[P,$]),ne=f.useMemo(()=>{const M={position:n,left:0,top:0};if(!ee.floating)return M;const q=Xv(ee.floating,h.x),A=Xv(ee.floating,h.y);return u?{...M,transform:"translate("+q+"px, "+A+"px)",...vS(ee.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:A}},[n,u,ee.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:oe,refs:H,elements:ee,floatingStyles:ne}),[h,oe,H,ee,ne])}const B4=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:a}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Jv({element:s.current,padding:a}).fn(n):{}:s?Jv({element:s,padding:a}).fn(n):{}}}},U4=(e,t)=>{const n=A4(e);return{name:n.name,fn:n.fn,options:[e,t]}},V4=(e,t)=>{const n=D4(e);return{name:n.name,fn:n.fn,options:[e,t]}},H4=(e,t)=>({fn:I4(e).fn,options:[e,t]}),W4=(e,t)=>{const n=$4(e);return{name:n.name,fn:n.fn,options:[e,t]}},K4=(e,t)=>{const n=L4(e);return{name:n.name,fn:n.fn,options:[e,t]}},q4=(e,t)=>{const n=O4(e);return{name:n.name,fn:n.fn,options:[e,t]}},G4=(e,t)=>{const n=B4(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Y4="Arrow",wS=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...l}=e;return r.jsx(mn.svg,{...l,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});wS.displayName=Y4;var J4=wS;function X4(e){const[t,n]=f.useState(void 0);return lo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const l=a[0];let c,u;if("borderBoxSize"in l){const p=l.borderBoxSize,m=Array.isArray(p)?p[0]:p;c=m.inlineSize,u=m.blockSize}else c=e.offsetWidth,u=e.offsetHeight;n({width:c,height:u})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var zg="Popper",[jS,kS]=Xo(zg),[Q4,SS]=jS(zg),NS=e=>{const{__scopePopper:t,children:n}=e,[s,a]=f.useState(null);return r.jsx(Q4,{scope:t,anchor:s,onAnchorChange:a,children:n})};NS.displayName=zg;var CS="PopperAnchor",ES=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,l=SS(CS,n),c=f.useRef(null),u=Fn(t,c),p=f.useRef(null);return f.useEffect(()=>{const m=p.current;p.current=(s==null?void 0:s.current)||c.current,m!==p.current&&l.onAnchorChange(p.current)}),s?null:r.jsx(mn.div,{...a,ref:u})});ES.displayName=CS;var Bg="PopperContent",[Z4,e$]=jS(Bg),TS=f.forwardRef((e,t)=>{var ae,me,ve,ke,he,Je;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:l="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:x="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:C,...j}=e,w=SS(Bg,n),[k,E]=f.useState(null),N=Fn(t,Ye=>E(Ye)),[P,$]=f.useState(null),T=X4(P),D=(T==null?void 0:T.width)??0,O=(T==null?void 0:T.height)??0,J=s+(l!=="center"?"-"+l:""),V=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},L=Array.isArray(m)?m:[m],W=L.length>0,oe={padding:V,boundary:L.filter(n$),altBoundary:W},{refs:z,floatingStyles:H,placement:ee,isPositioned:ne,middlewareData:M}=z4({strategy:"fixed",placement:J,whileElementsMounted:(...Ye)=>R4(...Ye,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[U4({mainAxis:a+O,alignmentAxis:c}),p&&V4({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?H4():void 0,...oe}),p&&W4({...oe}),K4({...oe,apply:({elements:Ye,rects:ot,availableWidth:Y,availableHeight:Ie})=>{const{width:Se,height:Oe}=ot.reference,Xe=Ye.floating.style;Xe.setProperty("--radix-popper-available-width",`${Y}px`),Xe.setProperty("--radix-popper-available-height",`${Ie}px`),Xe.setProperty("--radix-popper-anchor-width",`${Se}px`),Xe.setProperty("--radix-popper-anchor-height",`${Oe}px`)}}),P&&G4({element:P,padding:u}),r$({arrowWidth:D,arrowHeight:O}),y&&q4({strategy:"referenceHidden",...oe})]}),[q,A]=AS(ee),F=Ko(C);lo(()=>{ne&&(F==null||F())},[ne,F]);const Z=(ae=M.arrow)==null?void 0:ae.x,I=(me=M.arrow)==null?void 0:me.y,ue=((ve=M.arrow)==null?void 0:ve.centerOffset)!==0,[ge,U]=f.useState();return lo(()=>{k&&U(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:ne?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(ke=M.transformOrigin)==null?void 0:ke.x,(he=M.transformOrigin)==null?void 0:he.y].join(" "),...((Je=M.hide)==null?void 0:Je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(Z4,{scope:n,placedSide:q,onArrowChange:$,arrowX:Z,arrowY:I,shouldHideArrow:ue,children:r.jsx(mn.div,{"data-side":q,"data-align":A,...j,ref:N,style:{...j.style,animation:ne?void 0:"none"}})})})});TS.displayName=Bg;var PS="PopperArrow",t$={top:"bottom",right:"left",bottom:"top",left:"right"},RS=f.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,l=e$(PS,s),c=t$[l.placedSide];return r.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:r.jsx(J4,{...a,ref:n,style:{...a.style,display:"block"}})})});RS.displayName=PS;function n$(e){return e!==null}var r$=e=>({name:"transformOrigin",options:e,fn(t){var w,k,E;const{placement:n,rects:s,middlewareData:a}=t,c=((w=a.arrow)==null?void 0:w.centerOffset)!==0,u=c?0:e.arrowWidth,p=c?0:e.arrowHeight,[m,h]=AS(n),x={start:"0%",center:"50%",end:"100%"}[h],y=(((k=a.arrow)==null?void 0:k.x)??0)+u/2,b=(((E=a.arrow)==null?void 0:E.y)??0)+p/2;let C="",j="";return m==="bottom"?(C=c?x:`${y}px`,j=`${-p}px`):m==="top"?(C=c?x:`${y}px`,j=`${s.floating.height+p}px`):m==="right"?(C=`${-p}px`,j=c?x:`${b}px`):m==="left"&&(C=`${s.floating.width+p}px`,j=c?x:`${b}px`),{data:{x:C,y:j}}}});function AS(e){const[t,n="center"]=e.split("-");return[t,n]}var s$=NS,o$=ES,a$=TS,i$=RS,l$=Symbol("radix.slottable");function c$(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=l$,t}var u$=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),d$="VisuallyHidden",DS=f.forwardRef((e,t)=>r.jsx(mn.span,{...e,ref:t,style:{...u$,...e.style}}));DS.displayName=d$;var f$=DS,[Jd]=Xo("Tooltip",[kS]),Xd=kS(),$S="TooltipProvider",p$=700,kh="tooltip.open",[m$,Ug]=Jd($S),LS=e=>{const{__scopeTooltip:t,delayDuration:n=p$,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:l}=e,c=f.useRef(!0),u=f.useRef(!1),p=f.useRef(0);return f.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),r.jsx(m$,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(p.current),c.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:f.useCallback(m=>{u.current=m},[]),disableHoverableContent:a,children:l})};LS.displayName=$S;var Wl="Tooltip",[h$,lc]=Jd(Wl),OS=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:l,disableHoverableContent:c,delayDuration:u}=e,p=Ug(Wl,e.__scopeTooltip),m=Xd(t),[h,x]=f.useState(null),y=ni(),b=f.useRef(0),C=c??p.disableHoverableContent,j=u??p.delayDuration,w=f.useRef(!1),[k,E]=zd({prop:s,defaultProp:a??!1,onChange:D=>{D?(p.onOpen(),document.dispatchEvent(new CustomEvent(kh))):p.onClose(),l==null||l(D)},caller:Wl}),N=f.useMemo(()=>k?w.current?"delayed-open":"instant-open":"closed",[k]),P=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,E(!0)},[E]),$=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),T=f.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,E(!0),b.current=0},j)},[j,E]);return f.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(s$,{...m,children:r.jsx(h$,{scope:t,contentId:y,open:k,stateAttribute:N,trigger:h,onTriggerChange:x,onTriggerEnter:f.useCallback(()=>{p.isOpenDelayedRef.current?T():P()},[p.isOpenDelayedRef,T,P]),onTriggerLeave:f.useCallback(()=>{C?$():(window.clearTimeout(b.current),b.current=0)},[$,C]),onOpen:P,onClose:$,disableHoverableContent:C,children:n})})};OS.displayName=Wl;var Sh="TooltipTrigger",IS=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=lc(Sh,n),l=Ug(Sh,n),c=Xd(n),u=f.useRef(null),p=Fn(t,u,a.onTriggerChange),m=f.useRef(!1),h=f.useRef(!1),x=f.useCallback(()=>m.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),r.jsx(o$,{asChild:!0,...c,children:r.jsx(mn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:p,onPointerMove:qt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!l.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:qt(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:qt(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:qt(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:qt(e.onBlur,a.onClose),onClick:qt(e.onClick,a.onClose)})})});IS.displayName=Sh;var Vg="TooltipPortal",[g$,x$]=Jd(Vg,{forceMount:void 0}),MS=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,l=lc(Vg,t);return r.jsx(g$,{scope:t,forceMount:n,children:r.jsx(Qo,{present:n||l.open,children:r.jsx(gg,{asChild:!0,container:a,children:s})})})};MS.displayName=Vg;var pi="TooltipContent",_S=f.forwardRef((e,t)=>{const n=x$(pi,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...l}=e,c=lc(pi,e.__scopeTooltip);return r.jsx(Qo,{present:s||c.open,children:c.disableHoverableContent?r.jsx(FS,{side:a,...l,ref:t}):r.jsx(y$,{side:a,...l,ref:t})})}),y$=f.forwardRef((e,t)=>{const n=lc(pi,e.__scopeTooltip),s=Ug(pi,e.__scopeTooltip),a=f.useRef(null),l=Fn(t,a),[c,u]=f.useState(null),{trigger:p,onClose:m}=n,h=a.current,{onPointerInTransitChange:x}=s,y=f.useCallback(()=>{u(null),x(!1)},[x]),b=f.useCallback((C,j)=>{const w=C.currentTarget,k={x:C.clientX,y:C.clientY},E=k$(k,w.getBoundingClientRect()),N=S$(k,E),P=N$(j.getBoundingClientRect()),$=E$([...N,...P]);u($),x(!0)},[x]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(p&&h){const C=w=>b(w,h),j=w=>b(w,p);return p.addEventListener("pointerleave",C),h.addEventListener("pointerleave",j),()=>{p.removeEventListener("pointerleave",C),h.removeEventListener("pointerleave",j)}}},[p,h,b,y]),f.useEffect(()=>{if(c){const C=j=>{const w=j.target,k={x:j.clientX,y:j.clientY},E=(p==null?void 0:p.contains(w))||(h==null?void 0:h.contains(w)),N=!C$(k,c);E?y():N&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[p,h,c,m,y]),r.jsx(FS,{...e,ref:l})}),[b$,v$]=Jd(Wl,{isInside:!1}),w$=c$("TooltipContent"),FS=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=e,p=lc(pi,n),m=Xd(n),{onClose:h}=p;return f.useEffect(()=>(document.addEventListener(kh,h),()=>document.removeEventListener(kh,h)),[h]),f.useEffect(()=>{if(p.trigger){const x=y=>{const b=y.target;b!=null&&b.contains(p.trigger)&&h()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[p.trigger,h]),r.jsx(hg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:x=>x.preventDefault(),onDismiss:h,children:r.jsxs(a$,{"data-state":p.stateAttribute,...m,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(w$,{children:s}),r.jsx(b$,{scope:n,isInside:!0,children:r.jsx(f$,{id:p.contentId,role:"tooltip",children:a||s})})]})})});_S.displayName=pi;var zS="TooltipArrow",j$=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=Xd(n);return v$(zS,n).isInside?null:r.jsx(i$,{...a,...s,ref:t})});j$.displayName=zS;function k$(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,s,a,l)){case l:return"left";case a:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function S$(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function N$(e){const{top:t,right:n,bottom:s,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:s},{x:a,y:s}]}function C$(e,t){const{x:n,y:s}=e;let a=!1;for(let l=0,c=t.length-1;l<t.length;c=l++){const u=t[l],p=t[c],m=u.x,h=u.y,x=p.x,y=p.y;h>s!=y>s&&n<(x-m)*(s-h)/(y-h)+m&&(a=!a)}return a}function E$(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),T$(t)}function T$(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const a=e[s];for(;t.length>=2;){const l=t[t.length-1],c=t[t.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const a=e[s];for(;n.length>=2;){const l=n[n.length-1],c=n[n.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var P$=LS,R$=OS,A$=IS,D$=MS,BS=_S;const Wo=P$,Pr=R$,Rr=A$,gr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(D$,{children:r.jsx(BS,{ref:s,sideOffset:t,className:Ce("z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));gr.displayName=BS.displayName;function Hg({items:e,align:t="end"}){const[n,s]=f.useState(!1),[a,l]=f.useState(null),c=f.useRef(null);if(f.useEffect(()=>{if(!n){l(null);return}function p(h){c.current&&!c.current.contains(h.target)&&s(!1)}function m(h){h.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m)}},[n]),e.length===0)return null;function u(p,m){const h=p.icon,x=Ce("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",m&&"pl-8",p.disabled?"opacity-50 cursor-not-allowed":p.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),y=m?p.active?r.jsx($s,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):r.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):h?r.jsx(h,{className:"h-4 w-4 shrink-0"}):null,b=r.jsxs(r.Fragment,{children:[y,r.jsx("span",{className:"block min-w-0 truncate",children:p.label})]});if(p.disabled){const C=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:x,children:b})});return p.disabledReason?r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:C}),r.jsx(gr,{side:"left",children:p.disabledReason})]},p.key):r.jsx("div",{children:C},p.key)}return p.href?r.jsx(Ee,{to:p.href,className:x,onClick:()=>s(!1),children:b},p.key):r.jsx("button",{type:"button",className:x,onClick:()=>{var C;(C=p.onSelect)==null||C.call(p),s(!1)},children:b},p.key)}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsx("button",{type:"button",onClick:()=>s(p=>!p),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(oP,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:Ce("absolute top-full mt-1 z-30 min-w-[220px] rounded-md border border-border/70 bg-background shadow-lg py-1",t==="end"?"right-0":"left-0"),children:r.jsx(Wo,{delayDuration:200,children:e.map(p=>{if(p.submenu&&p.submenu.length>0){const m=p.icon,h=a===p.key;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",className:Ce("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":h,onClick:()=>l(h?null:p.key),children:[m?r.jsx(m,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 flex-1 truncate",children:p.label}),h?r.jsx($r,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(a0,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?p.submenu.map(x=>u(x,!0)):null]},p.key)}return u(p,!1)})})})]})}function Qv(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const $$={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function L$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function O$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function I$(e,t,n=Date.now()){if(!t)return!0;const s=t.field==="created"?e.created??e.updated:e.updated,a=Date.parse(s);if(Number.isNaN(a))return!1;if(t.preset){const u=$$[t.preset];return u===void 0?!0:t.preset.startsWith("older_")?n-a>u:a>=n-u&&a<=n}const l=t.from&&t.from.length>0?t.from:void 0,c=t.to&&t.to.length>0?t.to:void 0;return!l&&!c?!0:!(l&&a<L$(l)||c&&a>O$(c))}function Wg(e,t,n={}){const{workspace:s,search:a,includeArchived:l}=n;if(e.archived===!0&&!l)return!1;const c=tt(t.status),u=tt(t.priority),p=tt(t.type),m=tt(t.assignee),h=tt(t.project),x=tt(t.tags),{activity:y}=t;if(s){if(s==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==s)return!1}if(c.length&&!c.includes(e.status)||u.length&&!u.includes(e.priority)||p.length&&!p.includes(e.type??"")||y==="stale"&&!Qv(e.updated)||y==="fresh"&&Qv(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(C=>C==="__standalone__"?e.projectSlug==null:e.projectSlug===C))return!1;if(x.length){const b=e.tags??[];if(!x.some(C=>b.includes(C)))return!1}if(!I$(e,t.dateRange))return!1;if(a){const b=a.trim().toLowerCase();if(b&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(b))return!1}return!0}function Kl(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const US={statuses:[{id:"pending",label:"Pending"},{id:"in_progress",label:"In Progress"},{id:"blocked",label:"Blocked"},{id:"review",label:"Review"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}],order:["pending","in_progress","blocked","review","completed","failed"],transitions:[],custom:!1};let Rl=null,Fo=null;function M$(){return Rl?Promise.resolve(Rl):Fo||(Fo=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Rl=e,Fo=null,e)).catch(()=>(Fo=null,US)),Fo)}function Zo(){const[e,t]=f.useState(()=>Rl??US);return f.useEffect(()=>{M$().then(t)},[]),e}function Zv(){Rl=null,Fo=null}function cc(e,t){const n=e.statuses.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}const ew={critical:0,high:1,medium:2,low:3};function Ru(e){return Date.parse(e??"")||0}function uc(e,t,n){return[...e].sort((a,l)=>{let c=0;switch(t){case"title":c=a.title.localeCompare(l.title);break;case"status":c=a.status.localeCompare(l.status);break;case"priority":c=(ew[a.priority]??99)-(ew[l.priority]??99);break;case"assignee":c=(a.assignee??"").localeCompare(l.assignee??"");break;case"dependencies":c=a.dependsOn.length-l.dependsOn.length;break;case"created":c=Ru(a.created)-Ru(l.created);break;case"updated":c=Ru(a.updated)-Ru(l.updated);break}return n==="asc"?c:-c})}function St({title:e,description:t,actions:n}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:r.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[r.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?r.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const mi='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Qd({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:a,canDrop:l,onMove:c,getExternalDragData:u,onCardContextMenu:p,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:x,compact:y=!1,dragDisabled:b=!1}){const C=f.useMemo(()=>new Set(h??[]),[h]),j=f.useMemo(()=>e.filter(z=>!C.has(z.id)),[e,C]),w=f.useMemo(()=>e.filter(z=>C.has(z.id)),[e,C]),[k,E]=f.useState(null),[N,P]=f.useState(null),$=f.useRef(null),T=f.useMemo(()=>new Map(t.map(z=>[n(z),z])),[n,t]),D=f.useMemo(()=>j.map(z=>({column:z,items:t.filter(H=>s(H)===z.id)})),[j,s,t]),O=k?T.get(k)??null:null;function J(z){if(!O)return{allowed:!1};const H=s(O);return(l==null?void 0:l({item:O,fromColumnId:H,toColumnId:z}))??{allowed:!0}}function V(){E(null),P(null)}function L(z,H,ee){if(b)return;const ne=(u==null?void 0:u(H))??null;!c&&!ne||(z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",ee),ne&&z.dataTransfer.setData("application/json",JSON.stringify(ne)),c&&E(ee))}function W(z,H,ee){b||!c||!O||!J(H).allowed||(z.preventDefault(),z.dataTransfer.dropEffect="move",P(M=>(M==null?void 0:M.columnId)===H&&M.index===ee?M:{columnId:H,index:ee}))}async function oe(z,H,ee){var F;if(z.preventDefault(),b||!c||!O){V();return}const ne=s(O),q=(((F=D.find(Z=>Z.column.id===ne))==null?void 0:F.items)??[]).findIndex(Z=>n(Z)===n(O));if(!J(H).allowed||q<0){V();return}if(ne===H&&(ee===q||ee===q+1)){V();return}try{await c({item:O,fromColumnId:ne,toColumnId:H,fromIndex:q,toIndex:ee})}finally{V()}}return r.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[w.length>0&&x?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Hidden:"}),w.map(z=>r.jsxs("button",{type:"button",onClick:()=>x(z.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${z.title}" column`,children:[z.title," ×"]},z.id))]}):null,r.jsx("div",{className:Ce("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(200px,240px)]":"auto-cols-[minmax(260px,320px)]"),children:D.map(({column:z,items:H})=>{const ee=J(z.id),ne=(N==null?void 0:N.columnId)===z.id;return r.jsxs("section",{className:Ce("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",y?"min-h-[200px] p-2":"min-h-[320px] p-3",O&&!ee.allowed?"border-dashed opacity-65":"",O&&ee.allowed?"border-primary/30 bg-accent/30":"",ne?"ring-2 ring-ring/30":""),title:O&&!ee.allowed?ee.reason:void 0,children:[r.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:Ce("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:z.title}),z.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:z.description}):null]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs font-semibold text-foreground",children:H.length}),x?r.jsx("button",{type:"button",onClick:()=>x(z.id),className:"rounded-full border border-transparent px-1.5 py-0.5 text-xs text-muted-foreground hover:border-border hover:text-foreground",title:`Hide "${z.title}" column`,"aria-label":`Hide column ${z.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:M=>W(M,z.id,H.length),onDrop:M=>oe(M,z.id,H.length),children:[H.length===0?b?r.jsx("div",{className:"flex min-h-[128px] items-center justify-center rounded-lg border border-border/60 bg-background/50 px-4 text-center text-sm text-muted-foreground",children:typeof m=="function"?m(z):m}):r.jsx(_$,{active:(N==null?void 0:N.columnId)===z.id&&N.index===0,disabled:!!O&&!ee.allowed,children:typeof m=="function"?m(z):m}):null,H.map((M,q)=>{const A=n(M),F=k===A;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:Ce("h-2 rounded-full transition",(N==null?void 0:N.columnId)===z.id&&N.index===q?"bg-primary/70":"bg-transparent"),onDragOver:Z=>W(Z,z.id,q),onDrop:Z=>oe(Z,z.id,q)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:Z=>{$.current=Z.target},onDragStart:Z=>{const I=$.current;if(I!=null&&I.closest(mi)){Z.preventDefault();return}L(Z,M,A)},onDragEnd:V,onContextMenu:Z=>{if(!p)return;const I=Z.target;I!=null&&I.closest(mi)||p(M,Z)},className:Ce("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",F?"scale-[0.98] opacity-50":""),children:a(M,{dragging:F})})]},A)}),H.length>0&&!b?r.jsx("div",{className:Ce("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(N==null?void 0:N.columnId)===z.id&&N.index===H.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",O&&!ee.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},z.id)})})]})}function _$({active:e,disabled:t,children:n}){return r.jsx("div",{className:Ce("flex min-h-[128px] items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground transition",e?"border-primary/60 bg-primary/10 text-foreground":"border-border/60 bg-background/50",t?"opacity-45":""),children:n})}const El="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Pm="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",F$="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",z$="border-status-review-foreground/30 bg-status-review text-status-review-foreground",B$="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",U$="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",V$="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",md={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:El,icon:bi},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:El,icon:eP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:El,icon:l0},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Pm,icon:yP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Pm,icon:rg},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:F$,icon:lh},review:{label:"Review",description:"Ready for inspection or approval.",className:z$,icon:wP},completed:{label:"Completed",description:"Finished successfully.",className:B$,icon:Zh},failed:{label:"Failed",description:"Could not be completed as planned.",className:U$,icon:lh},active:{label:"Active",description:"The project has active or review work in flight.",className:Pm,icon:ch},stopped:{label:"Stopped",description:"Session ended without completing.",className:El,icon:QT},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:V$,icon:ch}};function hd(e){const t=md[e];return t||{className:El,icon:ch,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function VS(e,t){return Ce("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-medium tracking-normal","shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0)] dark:shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0.04)]",hd(e).className,t)}function pn({status:e,className:t,showIcon:n=!0,progress:s}){const a=hd(e),l=a.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,p=c?`${a.description} (${s.checked}/${s.total} criteria)`:a.description,m=n?c?r.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 items-center justify-center",children:[r.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*7,strokeDashoffset:2*Math.PI*7*(1-u)})]}),r.jsx(l,{className:"h-2.5 w-2.5"})]}):r.jsx(l,{className:"h-3.5 w-3.5"}):null;return r.jsxs("span",{title:p,className:VS(e,t),children:[m,r.jsx("span",{children:a.label})]})}function Zd(e){var t;return((t=md[e])==null?void 0:t.description)??`Status: ${e}`}const HS={definitions:[{id:"feature",label:"Feature"},{id:"bug",label:"Bug"},{id:"refactor",label:"Refactor"},{id:"research",label:"Research"},{id:"chore",label:"Chore"}],default:"feature",custom:!1};let Yu=null,za=null;function H$(){return Yu?Promise.resolve(Yu):za||(za=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Yu=e,za=null,e)).catch(()=>(za=null,HS)),za)}function ef(){const[e,t]=f.useState(()=>Yu??HS);return f.useEffect(()=>{H$().then(t)},[]),e}function ii(e,t){if(!t)return"—";const n=e.definitions.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function W$(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function ea({type:e,className:t,compact:n=!1}){const s=ef();if(!e)return null;const a=W$(s,e),l=(a==null?void 0:a.label)??e.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()),c=a!=null&&a.color?{backgroundColor:`color-mix(in oklch, ${a.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${a.color} 50%, transparent)`,color:a.color}:void 0;return r.jsx("span",{title:(a==null?void 0:a.description)??`Type: ${l}`,style:c,className:Ce("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!c&&"border-border/60 text-muted-foreground",t),children:l})}function Dr({value:e,label:t,disabled:n=!1,disabledReason:s,onError:a}){const[l,c]=f.useState(!1);async function u(){if(!n)try{if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch(p){a==null||a(p instanceof Error?p:new Error(String(p)))}}return n?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:s??"Copy unavailable","aria-label":t??"Copy",children:r.jsx(rd,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:u,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded",title:l?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:l?r.jsx($s,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(rd,{className:"h-3 w-3","aria-hidden":"true"})})}function K$(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function q$({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:a,compact:l=!1}){const c=Zo(),[u,p]=f.useState(()=>new Set(a.collapsed));f.useEffect(()=>{p(new Set(a.collapsed))},[a]);const m=h=>{p(x=>{const y=new Set(x);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:Ce("space-y-2",l?"space-y-1.5":"space-y-3"),children:t.map(h=>{const x=uc(e.filter(C=>C.status===h),n,s);if(x.length===0)return null;const y=!u.has(h),b=cc(c,h);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[r.jsxs("button",{type:"button",onClick:()=>m(h),className:Ce("flex w-full items-center gap-2 text-left",l?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[r.jsx($r,{className:Ce("text-muted-foreground transition-transform",l?"h-3.5 w-3.5":"h-4 w-4",y?"":"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:b}),r.jsx("span",{className:Ce("rounded-full border border-border/60 text-muted-foreground",l?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:x.length})]}),y&&r.jsx("ul",{className:Ce("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:x.map(C=>{const j=K$(C);return r.jsx("li",{children:r.jsxs(Ee,{to:j,className:Ce("flex items-center gap-3 hover:bg-muted/40",l?"px-3 py-1.5":"px-4 py-2.5"),children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:C.title}),C.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:C.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:Dn(C.updated)})]})},`${C.projectSlug??"standalone"}:${C.id}`)})})]},h)})})}function G$(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function Y$({items:e,sortField:t,sortDirection:n,tableColumnVisibility:s,compact:a=!1}){const l=new Set(s.hidden);l.delete("title");const c=h=>!l.has(h),u=uc(e,t,n),p=a?"py-2 pr-3":"py-3 pr-4",m=a?"text-xs":"text-sm";return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:Ce("w-full text-left",m),children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[c("title")?r.jsx("th",{className:Ce("font-medium",p),children:"Assignment"}):null,c("status")?r.jsx("th",{className:Ce("font-medium",p),children:"Status"}):null,c("priority")?r.jsx("th",{className:Ce("font-medium",p),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:Ce("font-medium",p),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:Ce("font-medium",p),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:Ce("font-medium",p),children:"Created"}):null,c("updated")?r.jsx("th",{className:Ce("font-medium",p),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const x=G$(h),y=`${h.projectSlug??"standalone"}:${h.id}`;return r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[c("title")?r.jsxs("td",{className:p,children:[r.jsx(Ee,{to:x,className:"font-semibold text-foreground hover:text-primary",children:h.title}),h.projectTitle?r.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:h.projectTitle}):null]}):null,c("status")?r.jsx("td",{className:p,children:r.jsx(pn,{status:h.status})}):null,c("priority")?r.jsx("td",{className:Ce("capitalize text-muted-foreground",p),children:h.priority}):null,c("assignee")?r.jsx("td",{className:Ce("text-muted-foreground",p),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:Ce("text-muted-foreground",p),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:Ce("text-muted-foreground",p),children:Dn(h.created)}):null,c("updated")?r.jsx("td",{className:Ce("text-muted-foreground",p),children:Dn(h.updated)}):null]},y)})})]})})}function J$(e,t,n){return e.filter(s=>Wg(s,t,{workspace:n,search:t.search}))}function WS({view:e,compact:t,emptyDescription:n}){const{data:s,loading:a,error:l}=Md(),c=Zo(),u=f.useMemo(()=>c.order.map(m=>({id:m,title:cc(c,m),description:Zd(m)})),[c]),p=f.useMemo(()=>{if(!s)return[];const m=J$(s.assignments,e.config.filters,e.workspace);return uc(m,e.config.sortField,e.config.sortDirection)},[s,e]);if(a&&!s)return r.jsx(mt,{label:"Loading assignments…"});if(l)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l})]});if(p.length===0)return r.jsx(St,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return r.jsx(Qd,{compact:t,dragDisabled:!0,columns:u,items:p,getItemId:m=>m.slug||m.id,getColumnId:m=>m.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:m=>t?r.jsx(X$,{item:m}):r.jsx(Q$,{item:m})});case"list":return r.jsx(q$,{items:p,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(Y$,{items:p,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function X$({item:e}){const t=Kl(e);return r.jsxs("div",{className:Ce("rounded-md border border-border/60 bg-background/85 p-2 shadow-sm"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(pn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:Dn(e.updated)})]}),e.id?r.jsxs("p",{className:"mt-1 inline-flex items-center gap-1 font-mono text-[10px] text-muted-foreground/70",children:[e.id.slice(0,8),r.jsx(Dr,{value:e.id})]}):null]})}function Q$({item:e}){const t=Kl(e);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(pn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(ea,{type:e.type,compact:!0}),r.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:Dn(e.updated)})]})]})}function Z$({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:a,refetch:l}=Go(e);return s?r.jsx(mt,{label:"Loading view…"}):a?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:a.message}),r.jsx("button",{type:"button",onClick:()=>l(),className:"shell-action mt-3",children:"Retry"})]}):n?r.jsx(WS,{view:n,compact:!0,emptyDescription:"Adjust the view's filters to surface different work, or pick another widget for this slot."}):r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"View no longer exists"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The saved view this slot was bound to has been deleted."}),r.jsx("button",{type:"button",onClick:t,className:"shell-action mt-3",children:"Pick another widget"})]})}function eL({sessions:e}){return r.jsxs("aside",{"aria-labelledby":"overview-sessions-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsx("header",{className:"border-b border-border/40 px-4 py-3",children:r.jsx("h3",{id:"overview-sessions-title",className:"text-sm font-semibold text-foreground",children:"Recent Sessions"})}),e.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:Ho.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:Ho.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(tL,{session:t})},t.sessionId))})]})}function tL({session:e}){const t=ln(),[n,s]=f.useState(!1),a=nL(e,t),l=rL(e),c=!e.path;return r.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:a,className:"block text-sm font-medium text-foreground hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:e.agent}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l," · ",k0(e.started)]}),n&&e.path?r.jsxs("div",{className:"mt-1 space-y-0.5",children:[r.jsx("code",{className:"block w-full select-all rounded bg-muted/40 px-1.5 py-0.5 text-xs text-foreground",children:e.path}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:Ho.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(Dr,{value:e.path,label:Ho.recentSessionsCopyPathLabel,disabled:c,disabledReason:Ho.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function nL(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function rL(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}function sL(){const{data:e,loading:t,error:n}=z0();return t&&!e?r.jsx(mt,{label:"Loading sessions…"}):n?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]}):r.jsx(eL,{sessions:(e==null?void 0:e.sessions)??[]})}const oL=5;function aL(){const{data:e,loading:t,error:n}=F0();if(t&&!e)return r.jsx(mt,{label:"Loading inventories…"});if(n)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load inventories"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]});const a=((e==null?void 0:e.inventories)??[]).slice(0,oL);return r.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[r.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),r.jsx(Ee,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),a.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:a.map(l=>{const c=l.inventory,u=l.active_leases.length,p=l.members.length,m=c.display_name??c.slug;return r.jsx("li",{children:r.jsxs(Ee,{to:`/inventories/${encodeURIComponent(c.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:m}),r.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[u,"/",p," leased"]})]})},c.slug)})})]})}const KS={"saved-view":{title:"Saved view",icon:d0,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(Z$,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Ad,render:()=>f.createElement(sL)},inventories:{title:"Inventories",icon:Ld,render:()=>f.createElement(aL)}},iL={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},lL={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function cL({slot:e,onReplace:t,onRemove:n,onResize:s}){const a=e.size??"small",l=iL[a];if(e.widget===null)return r.jsx("div",{className:Ce("flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-card/40 p-3 shadow-sm",l),children:r.jsxs("button",{type:"button",onClick:t,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(rn,{className:"h-4 w-4"}),"Add widget"]})});const c=KS[e.widget.kind];if(!c)return r.jsx("div",{className:Ce("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",l),children:r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})});const u=c.icon;return r.jsxs("div",{className:Ce("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",l),children:[r.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[r.jsx(u,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(uL,{slot:e,fallback:c.title})})]}),r.jsx(Hg,{items:[{key:"replace",label:"Replace…",icon:bP,onSelect:t},{key:"size",label:"Size",icon:hP,submenu:MD.map(p=>({key:`size-${p}`,label:lL[p],active:p===a,onSelect:()=>s(p)}))},{key:"remove",label:"Remove",icon:or,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:c.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function uL({slot:e,fallback:t}){var a,l;const n=((a=e.widget)==null?void 0:a.kind)==="saved-view"?e.widget.viewId:null,{view:s}=Go(n);return((l=e.widget)==null?void 0:l.kind)==="saved-view"&&s?r.jsx(r.Fragment,{children:s.name}):r.jsx(r.Fragment,{children:t})}const dL=["agent-sessions","inventories"];function fL({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:a}=Vd();function l(c){n(c),t(!1)}return r.jsx(ar,{open:e,onOpenChange:t,children:r.jsxs(Kn,{className:"max-w-xl",children:[r.jsxs(Qr,{children:[r.jsx(qn,{children:"Add a widget"}),r.jsx(hs,{children:"Choose a built-in widget or one of your saved views."})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:dL.map(c=>{const u=KS[c],p=u.icon;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:c}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx(p,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsx("span",{className:"font-medium text-foreground",children:u.title})]})},c)})})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),a?r.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):s.length===0?r.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",r.jsx(Ee,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):r.jsx("ul",{className:"max-h-72 divide-y divide-border/40 overflow-auto rounded-md border border-border/60",children:s.map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:"saved-view",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${c.workspace}`,children:c.workspace}):null,r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:c.config.viewMode})]})},c.id))}),!a&&s.some(c=>c.workspace!==null)?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}function pL(){const{data:e,error:t,refetch:n}=xR(),{data:s}=I0(),{layout:a}=UD(),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);mo("list:overview"),Ht({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const x=f.useCallback(k=>{p(k),c(!0)},[]),y=f.useCallback(async k=>{h(null);try{await HD(k)}catch(E){h(E instanceof Error?E.message:String(E))}},[]),b=f.useCallback(k=>{if(u===null)return;const E=a.slots.map((N,P)=>P===u?{...N,widget:k}:N);p(null),y(E)},[a.slots,u,y]),C=f.useCallback(k=>{const E=a.slots.map((N,P)=>P===k?{...N,widget:null}:N);y(E)},[a.slots,y]),j=f.useCallback((k,E)=>{const N=a.slots.map((P,$)=>$===k?{...P,size:E}:P);y(N)},[a.slots,y]),w={};if(e)for(const k of Object.keys(e.segments))for(const E of e.segments[k].items)w[E.id]=E;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("header",{className:"space-y-2",children:[r.jsx("p",{className:"eyebrow",children:"Workspace Overview"}),r.jsx("h1",{className:"text-4xl font-semibold tracking-display text-foreground md:text-5xl",children:"What needs you today"})]}),e?r.jsx(TD,{hero:e.hero,itemsById:w}):t?r.jsx(wt,{error:t}):r.jsx(mt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(CD,{help:s}):null,m?r.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Couldn't save dashboard layout: ",m]}):null,r.jsx("div",{className:"grid grid-flow-dense grid-cols-1 gap-4 xl:grid-cols-2",children:a.slots.map((k,E)=>r.jsx(cL,{slot:k,index:E,onReplace:()=>x(E),onRemove:()=>C(E),onResize:N=>j(E,N)},k.id))}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(sg,{className:"h-3 w-3","aria-hidden":"true"}),r.jsxs("span",{children:["● ",e.serverStats.totalPorts," ports ·"," ",e.serverStats.deadSessions>0?`${e.serverStats.deadSessions} dead`:"all healthy"]})]}):null,r.jsx(fL,{open:l,onOpenChange:k=>{c(k),k||p(null)},onSelect:b})]})}function mL({term:e,description:t}){return r.jsx("span",{title:t,className:"cursor-help rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-foreground underline decoration-dotted underline-offset-4",children:e})}function hL(){const{data:e,loading:t,error:n}=I0(),{openCheatsheet:s}=po();return t?r.jsx(mt,{label:"Loading help…"}):n||!e?r.jsx(wt,{error:n||"Help content is unavailable."}):r.jsxs("div",{className:"space-y-5",children:[r.jsx(We,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center gap-2 rounded-md border border-border/70 bg-background/80 px-3 py-1.5 text-sm font-medium text-foreground hover:bg-accent",children:"Open shortcuts cheatsheet"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",us("Mod+k")," opens the command palette."]})]})}),r.jsx(We,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:r.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(a=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:a},a))})}),r.jsx(We,{title:"Getting Started",children:r.jsx("div",{className:"space-y-3",children:e.workflow.map((a,l)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:a.detail}),a.command?r.jsx(qu,{command:a.command.command,description:a.command.description,example:a.command.example}):null,a.href?r.jsx(Ee,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(We,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(a=>r.jsx(mL,{term:a.term,description:a.description},a.term))}),r.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.term}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description})]},a.term))})]}),r.jsx(We,{title:"Status Guide",children:r.jsx("div",{className:"space-y-3",children:e.statusGuide.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(pn,{status:a.status}),r.jsx("p",{className:"font-semibold text-foreground",children:a.meaning})]}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:a.useWhen})]},a.status))})})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(We,{title:"Ownership And File Rules",children:r.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.label}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:a.files.map(l=>r.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:l},l))})]},a.label))})}),r.jsx(We,{title:"How To Navigate The Dashboard",children:r.jsx("div",{className:"space-y-3",children:e.navigation.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.label}),r.jsx(Ee,{className:"text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open"})]}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description})]},a.label))})})]}),r.jsx(We,{title:"CLI Quick Reference",children:r.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(a=>r.jsx(qu,{command:a.command,description:a.description,example:a.example},a.command))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(We,{title:"FAQ",children:r.jsx("div",{className:"space-y-3",children:e.faq.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.question}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.answer})]},a.question))})}),r.jsx(We,{title:"First Project Checklist",children:r.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((a,l)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:a.detail}),a.command?r.jsx(qu,{command:a.command.command,example:a.command.example}):null,a.href?r.jsx(Ee,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})})]})]})}function Kg({children:e}){return r.jsx("div",{className:"chrome-card flex flex-col gap-2 !p-2.5 md:flex-row md:flex-wrap md:items-center",children:e})}const tf=f.forwardRef(({value:e,onChange:t,placeholder:n="Search"},s)=>r.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[r.jsx(fo,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:a=>t(a.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));tf.displayName="SearchInput";function nf({value:e,options:t,onChange:n}){return r.jsx("div",{className:"inline-flex rounded-md border border-border/60 bg-background/80 p-1",children:t.map(s=>r.jsx("button",{type:"button","aria-pressed":e===s.value,onClick:()=>n(s.value),className:Ce("rounded-sm px-2.5 py-1.5 text-sm font-medium transition",e===s.value?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:s.label},s.value))})}const gL={completed:"bg-status-completed-foreground",in_progress:"bg-status-in-progress-foreground",review:"bg-status-review-foreground",blocked:"bg-status-blocked-foreground",failed:"bg-status-failed-foreground",pending:"bg-status-pending-foreground"},tw=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function gd({progress:e,className:t,showLegend:n=!1}){const s=Zo(),a=f.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(p=>p!=="total")).map(p=>({key:p,className:gL[p]??tw[c++%tw.length]}))},[s.order,e]),l=a.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:Ce("space-y-2",t),children:[r.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?r.jsx("div",{className:"h-full w-full bg-muted"}):l.map(c=>r.jsx("div",{className:c.className,style:{width:`${(e[c.key]??0)/e.total*100}%`},title:`${yn(c.key)}: ${e[c.key]??0}`},c.key))}),n?r.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:a.map(c=>r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[r.jsx("span",{className:Ce("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:yn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const xL=["pending","active","blocked","failed","completed"],qg=xL,yL=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function qS(e){return e&&e.length>0?e:[...yL]}function bL(e,t,n){if(t<0||t>=e.length)return e;const s=[...e],[a]=s.splice(t,1),l=t<n?n-1:n;return s.splice(Math.max(0,Math.min(l,s.length)),0,a),s}const vL=220,Au=8;function GS({anchor:e,items:t,onClose:n}){const s=f.useRef(null),[a,l]=f.useState(null);return f.useLayoutEffect(()=>{if(!e){l(null);return}const c=s.current,u=(c==null?void 0:c.offsetWidth)??vL,p=(c==null?void 0:c.offsetHeight)??0,m=Math.max(Au,window.innerWidth-u-Au),h=Math.max(Au,window.innerHeight-p-Au);l({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),f.useEffect(()=>{if(!e)return;function c(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function p(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),document.addEventListener("contextmenu",c),window.addEventListener("scroll",p,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",c),window.removeEventListener("scroll",p,!0)}},[e,n]),!e||t.length===0?null:r.jsx("div",{ref:s,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(a==null?void 0:a.left)??e.x,top:(a==null?void 0:a.top)??e.y,visibility:a?"visible":"hidden"},children:r.jsx(Wo,{delayDuration:200,children:t.map(c=>{const u=c.icon,p=Ce("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",c.disabled?"cursor-not-allowed opacity-50":c.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),m=r.jsxs(r.Fragment,{children:[u?r.jsx(u,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 truncate",children:c.label})]});if(c.disabled){const h=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:p,children:m})});return c.disabledReason?r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:h}),r.jsx(gr,{side:"left",children:c.disabledReason})]},c.key):r.jsx("div",{children:h},c.key)}return c.href?r.jsx(Ee,{to:c.href,className:p,onClick:()=>n(),children:m},c.key):r.jsx("button",{type:"button",className:p,onClick:()=>{var h;(h=c.onSelect)==null||h.call(c),n()},children:m},c.key)})})})}const wL="__ungrouped__";function Gg({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:s,title:a="Move to workspace",description:l="Pick the workspace this item should belong to."}){const{data:c,loading:u}=oc(),[p,m]=f.useState(n),[h,x]=f.useState(!1),[y,b]=f.useState(null);f.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const C=f.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:wL,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function w(){if(j){x(!0),b(null);try{await s(p),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{x(!1)}}}return r.jsx(ar,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(Kn,{children:[r.jsxs(Qr,{children:[r.jsx(qn,{children:a}),r.jsx(hs,{children:l})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:u&&C.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(rg,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):C.map(k=>{const E=k.value===n,N=k.value===p;return r.jsxs("button",{type:"button",disabled:E||h,onClick:()=>m(k.value),className:Ce("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",E?"cursor-not-allowed bg-foreground/5 text-muted-foreground":N?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:Ce("block min-w-0 truncate",k.value===null?"italic text-muted-foreground":""),children:[k.label,E?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),N?r.jsx($s,{className:"h-4 w-4 text-foreground"}):null]},k.key)})}),y?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:y}):null,r.jsxs(Ls,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),disabled:h,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:w,disabled:!j,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function nw(){const{workspace:e}=$t(),t=ln(),n=Dt(),{data:s,loading:a,error:l,refetch:c}=Jo(),u=f.useRef(null);mo("list:projects");const[p,m]=f.useState(""),[h,x]=f.useState("all"),[y,b]=f.useState("all"),[C,j]=f.useState("updated"),[w,k]=ms(),E=w.get("view"),N=E==="table"||E==="kanban"?E:"cards",P=M=>{k(q=>{const A=new URLSearchParams(q);return M==="cards"?A.delete("view"):A.set("view",M),A})},[$,T]=f.useState({}),[D,O]=f.useState(null),[J,V]=f.useState(null),L=f.useMemo(()=>s?s.filter(M=>{if(e){if(e==="_ungrouped"){if(M.workspace!==null)return!1}else if(M.workspace!==e)return!1}return h!=="all"&&M.status!==h||y!=="all"&&!M.tags.includes(y)?!1:p.trim()?`${M.title} ${M.tags.join(" ")} ${M.slug}`.toLowerCase().includes(p.toLowerCase()):!0}).sort((M,q)=>SL(M,q,C)):[],[s,p,h,y,C,e]),W=L.map(M=>`${M.slug}:${M.status}`).join("|");f.useEffect(()=>{T(NL(L))},[W,C]);const oe=f.useMemo(()=>{const M=new Map(L.map(q=>[q.slug,q]));return qg.flatMap(q=>($[q]??L.filter(F=>F.status===q).map(F=>F.slug)).map(F=>M.get(F)).filter(F=>!!F))},[L,$]),{visibleItems:z,visibleIndexByKey:H}=f.useMemo(()=>{const M=N==="kanban"?oe:L,q=new Map;return M.forEach((A,F)=>q.set(A.slug,F)),{visibleItems:M,visibleIndexByKey:q}},[N,L,oe]),{hotkeyRowProps:ee}=ac(z,{scope:"list:projects",onOpen:M=>n(`${t}/projects/${M.slug}`)});if(Ht({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var M;return(M=u.current)==null?void 0:M.focus()}}),Ht({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),a)return r.jsx(mt,{label:"Loading projects…"});if(l||!s)return r.jsx(wt,{error:l||"Project list is unavailable."});const ne=Array.from(new Set(s.flatMap(M=>M.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(Kg,{children:[r.jsx(tf,{ref:u,value:p,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:M=>x(M.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All statuses"}),r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"failed",children:"Failed"}),r.jsx("option",{value:"completed",children:"Completed"})]}),r.jsxs("select",{value:y,onChange:M=>b(M.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),ne.map(M=>r.jsx("option",{value:M,children:M},M))]}),r.jsxs("select",{value:C,onChange:M=>j(M.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"updated",children:"Sort: Updated"}),r.jsx("option",{value:"created",children:"Sort: Created"}),r.jsx("option",{value:"title",children:"Sort: Title"}),r.jsx("option",{value:"attention",children:"Sort: Attention"})]}),r.jsx(nf,{value:N,onChange:M=>P(M),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),L.length===0?s.length===0?r.jsxs("div",{className:"rounded-frame border border-border/60 bg-card px-6 py-16 text-center",children:[r.jsx("p",{className:"eyebrow mx-auto justify-center",children:"Start here"}),r.jsx("h2",{className:"mx-auto mt-4 max-w-2xl text-3xl font-semibold tracking-display text-foreground md:text-4xl",children:"The task manager built for agents, by agents"}),r.jsx("p",{className:"mx-auto mt-3 max-w-xl text-sm leading-6 text-muted-foreground",children:"A project groups assignments, resources, and memories under one objective. Markdown stays authoritative — the dashboard is just a view."}),r.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[r.jsx(Ee,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),r.jsx(Ee,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):r.jsx(St,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Ee,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):N==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:L.map((M,q)=>r.jsxs(Ee,{to:`${t}/projects/${M.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...ee(q),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:M.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Dn(M.updated)]})]}),r.jsx(pn,{status:M.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(gd,{progress:M.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:M.tags.map(A=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:A},A))}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:M.needsAttention.blockedCount+M.needsAttention.failedCount})]}),r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Assignments"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:M.progress.total})]})]})]})]},M.slug))}):N==="table"?r.jsx(We,{title:`${L.length} project${L.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"pb-3 font-medium",children:"Project"}),r.jsx("th",{className:"pb-3 font-medium",children:"Status"}),r.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),r.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),r.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:L.map((M,q)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...ee(q),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ee,{to:`${t}/projects/${M.slug}`,className:"font-semibold text-foreground hover:text-primary",children:M.title}),r.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:M.tags.map(A=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:A},A))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(pn,{status:M.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(gd,{progress:M.progress})})}),r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:M.needsAttention.blockedCount+M.needsAttention.failedCount}),r.jsx("td",{className:"py-4 text-muted-foreground",children:Dn(M.updated)})]},M.slug))})]})})}):r.jsx(Qd,{columns:kL,items:oe,getItemId:M=>M.slug,getColumnId:M=>M.status,canDrop:({fromColumnId:M,toColumnId:q})=>({allowed:!0,reason:M===q?void 0:"This will set a manual status override on the project."}),onMove:({item:M,fromColumnId:q,toColumnId:A,fromIndex:F,toIndex:Z})=>{if(q===A){const I=$[q]??L.filter(ue=>ue.status===q).map(ue=>ue.slug);T(ue=>({...ue,[q]:bL(I,F,Z)}));return}fetch(`/api/projects/${M.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:A})}).then(()=>{window.location.reload()})},getExternalDragData:M=>({type:"project",id:M.slug}),onCardContextMenu:(M,q)=>{q.preventDefault(),O({project:M,anchor:{x:q.clientX,y:q.clientY}})},emptyMessage:M=>`No ${M.title.toLowerCase()} projects.`,renderCard:(M,{dragging:q})=>{const A=H.get(M.slug)??-1;return r.jsx("div",{...A>=0?ee(A):{},children:r.jsx(CL,{project:M,dragging:q})})}}),r.jsx(GS,{anchor:(D==null?void 0:D.anchor)??null,items:D?[{key:"edit",label:"Edit",icon:bi,onSelect:()=>n(`${t}/projects/${D.project.slug}`)},{key:"move",label:"Move to workspace…",icon:$d,onSelect:()=>V(D.project)}]:[],onClose:()=>O(null)}),r.jsx(Gg,{open:J!==null,onOpenChange:M=>{M||V(null)},currentWorkspace:(J==null?void 0:J.workspace)??null,title:"Move project to workspace",onSubmit:async M=>{if(!J)return;const q=await fetch(`/api/projects/${encodeURIComponent(J.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:M})});if(!q.ok){const A=await q.json().catch(()=>({}));throw new Error(A.error||"Failed to move project")}c()}}),r.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(ng,{className:"mt-0.5 h-4 w-4"}),r.jsxs("p",{children:["Project status is derived from assignment state by default.",N==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const jL={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},kL=qg.map(e=>({id:e,title:jL[e],description:Zd(e)}));function SL(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return rw(t)-rw(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function rw(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function NL(e){return Object.fromEntries(qg.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function CL({project:e,dragging:t}){const n=ln();return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Ee,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Dn(e.updated)]})]}),r.jsx(pn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(gd,{progress:e.progress})}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.tags.map(s=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:s},s)),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.progress.total," assignments"]}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.needsAttention.blockedCount+e.needsAttention.failedCount," needs attention"]})]}),r.jsx("div",{className:"mt-4 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:t?"Reordering within status":"Derived project lane"})]})}function xd({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:Ce("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",s),children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?r.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}const EL=4e3;function ta(){const[e,t]=f.useState(null),n=f.useRef(null),s=f.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),a=f.useCallback((l,c="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:l,kind:c}),n.current=setTimeout(()=>{t(null),n.current=null},EL)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:a,dismissToast:s}}function na({toast:e,onDismiss:t}){if(!e)return null;const n=e.kind==="error";return r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-50 flex max-w-sm",role:"status","aria-live":"polite",children:r.jsx("button",{type:"button",onClick:t,className:Ce("syntaur-toast pointer-events-auto rounded-md border px-4 py-3 text-sm font-medium shadow-lg transition",n?"border-error-foreground/30 bg-error text-error-foreground hover:opacity-90":"border-success-foreground/30 bg-success text-success-foreground hover:opacity-90"),children:e.message},e.id)})}function TL(){return r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-status-archived-foreground/30 bg-status-archived px-2 py-0.5 text-xs font-medium text-status-archived-foreground",children:[r.jsx(Dd,{className:"h-3 w-3"}),"Archived"]})}function sw(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function PL(){const{data:e,loading:t,error:n,refetch:s}=yR(),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState({}),{toast:h,showToast:x,dismissToast:y}=ta();async function b(N,P,$){l(P),u(null);try{const T=await fetch(N,{method:"POST",headers:{"Content-Type":"application/json"}});if(!T.ok){const D=await T.json().catch(()=>null);throw new Error((D==null?void 0:D.error)||`HTTP ${T.status}`)}s(),x($,"success")}catch(T){u(T instanceof Error?T.message:"Restore failed")}finally{l(null)}}function C(N){return b(`/api/projects/${N.slug}/unarchive`,`project:${N.slug}`,"Project restored")}function j(N){const P=N.projectSlug?`/api/projects/${N.projectSlug}/assignments/${N.slug}/unarchive`:`/api/assignments/${N.id}/unarchive`;return b(P,`assignment:${N.id}`,"Assignment restored")}if(t)return r.jsx(mt,{label:"Loading archived content…"});if(n)return r.jsx(wt,{error:n});const w=(e==null?void 0:e.projects)??[],k=(e==null?void 0:e.assignments)??[],E=w.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(na,{toast:h,onDismiss:y}),r.jsx(xd,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),c?r.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:c}):null,E?r.jsx(St,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[w.length>0&&r.jsx(We,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:r.jsx("ul",{className:"divide-y divide-border",children:w.map(N=>{const P=p[N.slug]??!1;return r.jsxs("li",{className:"py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>m($=>({...$,[N.slug]:!P})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":P,children:[P?r.jsx($r,{className:"h-4 w-4"}):r.jsx(a0,{className:"h-4 w-4"}),r.jsx(eg,{className:"h-4 w-4 text-muted-foreground"}),N.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",N.assignments.length," assignment",N.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",N.archivedAt?Lr(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Ee,{to:`/projects/${N.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),r.jsxs("button",{type:"button",onClick:()=>C(N),disabled:a===`project:${N.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(ed,{className:"h-3 w-3"}),"Restore"]})]})]}),P&&N.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:N.assignments.map($=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ee,{to:sw($),className:"text-foreground hover:text-foreground/80",children:$.title}),r.jsx(pn,{status:$.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:$.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},$.id))})]},N.slug)})})}),k.length>0&&r.jsx(We,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:r.jsx("ul",{className:"divide-y divide-border",children:k.map(N=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Ee,{to:sw(N),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:N.title}),r.jsx(pn,{status:N.status,showIcon:!1}),r.jsx(TL,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.projectTitle??"Standalone"," · Archived"," ",N.archivedAt?Lr(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>j(N),disabled:a===`assignment:${N.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(ed,{className:"h-3 w-3"}),"Restore"]})]},N.id))})})]})]})}const ow="inline-flex max-w-[14rem] items-center gap-1 whitespace-nowrap rounded-full border px-2 py-0.5 text-[11px] font-semibold tracking-wide border-border/60 text-muted-foreground",aw="block min-w-0 truncate";function Yg({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:Ce("flex flex-wrap items-center gap-1.5",t),children:e.map((n,s)=>{const a=`${n.system}:${n.id}`,l=`${n.system}:${n.id}:${s}`;return n.url!=null&&n.url.length>0?r.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:Ce(ow,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${a} in ${n.system}`,children:[r.jsx("span",{className:aw,children:a}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:ow,title:a,children:r.jsx("span",{className:aw,children:a})},l)})})}const RL={default:"chrome-card",info:"rounded-lg border border-primary/30 bg-primary/5 p-3 dark:border-primary/40 dark:bg-primary/10",warn:"rounded-lg border border-warning-foreground/30 bg-warning p-3",danger:"rounded-lg border border-error-foreground/30 bg-error p-3",success:"rounded-lg border border-success-foreground/30 bg-success p-3"};function An({label:e,value:t,description:n,icon:s,tone:a="default",to:l}){const c=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),r.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),s?r.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:r.jsx(s,{className:"h-5 w-5"})}):null]}),n?r.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),u=Ce(RL[a],l?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return l?r.jsx(Ee,{to:l,className:u,children:c}):r.jsx("article",{className:u,children:c})}function iw(e){const t=AL(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find($L);if(p){const m=p.props.children,h=u.map(x=>x===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:x);return r.jsx(t,{...c,ref:a,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function AL(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=OL(a),u=LL(l,a.props);return a.type!==f.Fragment&&(u.ref=s?Fd(s,c):c),f.cloneElement(a,u)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var DL=Symbol("radix.slottable");function $L(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===DL}function LL(e,t){const n={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?n[s]=(...u)=>{const p=l(...u);return a(...u),p}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function OL(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function IL(e){const t=e+"CollectionProvider",[n,s]=Xo(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:w,children:k}=j,E=nn.useRef(null),N=nn.useRef(new Map).current;return r.jsx(a,{scope:w,itemMap:N,collectionRef:E,children:k})};c.displayName=t;const u=e+"CollectionSlot",p=iw(u),m=nn.forwardRef((j,w)=>{const{scope:k,children:E}=j,N=l(u,k),P=Fn(w,N.collectionRef);return r.jsx(p,{ref:P,children:E})});m.displayName=u;const h=e+"CollectionItemSlot",x="data-radix-collection-item",y=iw(h),b=nn.forwardRef((j,w)=>{const{scope:k,children:E,...N}=j,P=nn.useRef(null),$=Fn(w,P),T=l(h,k);return nn.useEffect(()=>(T.itemMap.set(P,{ref:P,...N}),()=>void T.itemMap.delete(P))),r.jsx(y,{[x]:"",ref:$,children:E})});b.displayName=h;function C(j){const w=l(e+"CollectionConsumer",j);return nn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const N=Array.from(E.querySelectorAll(`[${x}]`));return Array.from(w.itemMap.values()).sort((T,D)=>N.indexOf(T.ref.current)-N.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},C,s]}var ML=f.createContext(void 0);function YS(e){const t=f.useContext(ML);return e||t||"ltr"}var Rm="rovingFocusGroup.onEntryFocus",_L={bubbles:!1,cancelable:!0},dc="RovingFocusGroup",[Nh,JS,FL]=IL(dc),[zL,XS]=Xo(dc,[FL]),[BL,UL]=zL(dc),QS=f.forwardRef((e,t)=>r.jsx(Nh.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Nh.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(VL,{...e,ref:t})})}));QS.displayName=dc;var VL=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:p,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...x}=e,y=f.useRef(null),b=Fn(t,y),C=YS(l),[j,w]=zd({prop:c,defaultProp:u??null,onChange:p,caller:dc}),[k,E]=f.useState(!1),N=Ko(m),P=JS(n),$=f.useRef(!1),[T,D]=f.useState(0);return f.useEffect(()=>{const O=y.current;if(O)return O.addEventListener(Rm,N),()=>O.removeEventListener(Rm,N)},[N]),r.jsx(BL,{scope:n,orientation:s,dir:C,loop:a,currentTabStopId:j,onItemFocus:f.useCallback(O=>w(O),[w]),onItemShiftTab:f.useCallback(()=>E(!0),[]),onFocusableItemAdd:f.useCallback(()=>D(O=>O+1),[]),onFocusableItemRemove:f.useCallback(()=>D(O=>O-1),[]),children:r.jsx(mn.div,{tabIndex:k||T===0?-1:0,"data-orientation":s,...x,ref:b,style:{outline:"none",...e.style},onMouseDown:qt(e.onMouseDown,()=>{$.current=!0}),onFocus:qt(e.onFocus,O=>{const J=!$.current;if(O.target===O.currentTarget&&J&&!k){const V=new CustomEvent(Rm,_L);if(O.currentTarget.dispatchEvent(V),!V.defaultPrevented){const L=P().filter(ee=>ee.focusable),W=L.find(ee=>ee.active),oe=L.find(ee=>ee.id===j),H=[W,oe,...L].filter(Boolean).map(ee=>ee.ref.current);t1(H,h)}}$.current=!1}),onBlur:qt(e.onBlur,()=>E(!1))})})}),ZS="RovingFocusGroupItem",e1=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:l,children:c,...u}=e,p=ni(),m=l||p,h=UL(ZS,n),x=h.currentTabStopId===m,y=JS(n),{onFocusableItemAdd:b,onFocusableItemRemove:C,currentTabStopId:j}=h;return f.useEffect(()=>{if(s)return b(),()=>C()},[s,b,C]),r.jsx(Nh.ItemSlot,{scope:n,id:m,focusable:s,active:a,children:r.jsx(mn.span,{tabIndex:x?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:qt(e.onMouseDown,w=>{s?h.onItemFocus(m):w.preventDefault()}),onFocus:qt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:qt(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=KL(w,h.orientation,h.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let N=y().filter(P=>P.focusable).map(P=>P.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const P=N.indexOf(w.currentTarget);N=h.loop?qL(N,P+1):N.slice(P+1)}setTimeout(()=>t1(N))}}),children:typeof c=="function"?c({isCurrentTabStop:x,hasTabStop:j!=null}):c})})});e1.displayName=ZS;var HL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function KL(e,t,n){const s=WL(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return HL[s]}function t1(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function qL(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var GL=QS,YL=e1,rf="Tabs",[JL]=Xo(rf,[XS]),n1=XS(),[XL,Jg]=JL(rf),r1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:p="automatic",...m}=e,h=YS(u),[x,y]=zd({prop:s,onChange:a,defaultProp:l??"",caller:rf});return r.jsx(XL,{scope:n,baseId:ni(),value:x,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(mn.div,{dir:h,"data-orientation":c,...m,ref:t})})});r1.displayName=rf;var s1="TabsList",o1=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,l=Jg(s1,n),c=n1(n);return r.jsx(GL,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:s,children:r.jsx(mn.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:t})})});o1.displayName=s1;var a1="TabsTrigger",i1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...l}=e,c=Jg(a1,n),u=n1(n),p=u1(c.baseId,s),m=d1(c.baseId,s),h=s===c.value;return r.jsx(YL,{asChild:!0,...u,focusable:!a,active:h,children:r.jsx(mn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:p,...l,ref:t,onMouseDown:qt(e.onMouseDown,x=>{!a&&x.button===0&&x.ctrlKey===!1?c.onValueChange(s):x.preventDefault()}),onKeyDown:qt(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&c.onValueChange(s)}),onFocus:qt(e.onFocus,()=>{const x=c.activationMode!=="manual";!h&&!a&&x&&c.onValueChange(s)})})})});i1.displayName=a1;var l1="TabsContent",c1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:l,...c}=e,u=Jg(l1,n),p=u1(u.baseId,s),m=d1(u.baseId,s),h=s===u.value,x=f.useRef(h);return f.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(Qo,{present:a||h,children:({present:y})=>r.jsx(mn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":p,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:x.current?"0s":void 0},children:y&&l})})});c1.displayName=l1;function u1(e,t){return`${e}-trigger-${t}`}function d1(e,t){return`${e}-content-${t}`}var f1=r1,p1=o1,Ch=i1,Eh=c1;function Xg({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(f1,{value:e,onValueChange:t,className:s,children:[r.jsx(p1,{className:"scrollbar-none flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(a=>r.jsxs(Ch,{value:a.value,className:Ce("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:[r.jsx("span",{children:a.label}),typeof a.count=="number"?r.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:a.count}):null]},a.value))}),n.map(a=>r.jsx(Eh,{value:a.value,className:"pt-3",children:a.content},a.value))]})}const QL="modulepreload",ZL=function(e){return"/"+e},lw={},eO=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),p=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(m=>{if(m=ZL(m),m in lw)return;lw[m]=!0;const h=m.endsWith(".css"),x=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${x}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":QL,h||(y.as="script"),y.crossOrigin="",y.href=m,p&&y.setAttribute("nonce",p),document.head.appendChild(y),h)return new Promise((b,C)=>{y.addEventListener("load",b),y.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})};function tO({definition:e,className:t,nodeRoutes:n={}}){const s=f.useRef(null),[a,l]=f.useState(null),[c,u]=f.useState(!0),p=Dt(),m=document.documentElement.classList.contains("dark")?"dark":"default";return f.useEffect(()=>{let h=!1;async function x(){if(s.current)try{const y=(await eO(async()=>{const{default:j}=await import("./mermaid.core-CclSNuh7.js").then(w=>w.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:nO(m==="dark")}),h)return;const b=`mermaid-${Date.now()}`,{svg:C}=await y.render(b,e);if(h||!s.current)return;s.current.innerHTML=C,rO(s.current,n,p),u(!1)}catch(y){h||(l(y instanceof Error?y.message:"Failed to render graph"),u(!1))}}return u(!0),l(null),x(),()=>{h=!0}},[e,p,n,m]),a?r.jsxs("div",{className:Ce("rounded-lg border border-border bg-card p-4",t),children:[r.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",a]}),r.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):r.jsxs("div",{className:Ce("rounded-lg border border-border bg-card p-4",t),children:[c&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),r.jsx("div",{ref:s,className:"overflow-auto"})]})}function nO(e){const t=document.documentElement,n=x=>{const y=getComputedStyle(t).getPropertyValue(x).trim();return y?`oklch(${y})`:""},s=n("--card"),a=n("--card-foreground"),l=n("--border"),c=n("--primary"),u=n("--primary-foreground"),p=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:a,primaryBorderColor:l,secondaryColor:p,secondaryTextColor:a,secondaryBorderColor:l,tertiaryColor:p,tertiaryTextColor:m,tertiaryBorderColor:l,lineColor:e?m:l,textColor:a,mainBkg:s,nodeBkg:s,nodeTextColor:a,nodeBorder:l,clusterBkg:p,clusterBorder:l,edgeLabelBackground:s,titleColor:a,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:p,labelColor:a,errorBkgColor:h,errorTextColor:u}}function rO(e,t,n){var s;for(const a of e.querySelectorAll(".node")){const l=((s=a.textContent)==null?void 0:s.replace(/\s+/g," ").trim())??"",c=t[l];if(!c)continue;a.style.cursor="pointer",a.setAttribute("role","link"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",`Open ${l}`);const u=()=>n(c);a.addEventListener("click",u),a.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u())})}}function sO(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const oO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iO={};function cw(e,t){return(iO.jsx?aO:oO).test(e)}const lO=/[ \t\n\f\r]/g;function cO(e){return typeof e=="object"?e.type==="text"?uw(e.value):!1:uw(e)}function uw(e){return e.replace(lO,"")===""}class fc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}fc.prototype.normal={};fc.prototype.property={};fc.prototype.space=void 0;function m1(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new fc(n,s,t)}function Th(e){return e.toLowerCase()}class ir{constructor(t,n){this.attribute=n,this.property=t}}ir.prototype.attribute="";ir.prototype.booleanish=!1;ir.prototype.boolean=!1;ir.prototype.commaOrSpaceSeparated=!1;ir.prototype.commaSeparated=!1;ir.prototype.defined=!1;ir.prototype.mustUseProperty=!1;ir.prototype.number=!1;ir.prototype.overloadedBoolean=!1;ir.prototype.property="";ir.prototype.spaceSeparated=!1;ir.prototype.space=void 0;let uO=0;const dt=ra(),dn=ra(),Ph=ra(),Te=ra(),It=ra(),li=ra(),pr=ra();function ra(){return 2**++uO}const Rh=Object.freeze(Object.defineProperty({__proto__:null,boolean:dt,booleanish:dn,commaOrSpaceSeparated:pr,commaSeparated:li,number:Te,overloadedBoolean:Ph,spaceSeparated:It},Symbol.toStringTag,{value:"Module"})),Am=Object.keys(Rh);class Qg extends ir{constructor(t,n,s,a){let l=-1;if(super(t,n),dw(this,"space",a),typeof s=="number")for(;++l<Am.length;){const c=Am[l];dw(this,Am[l],(s&Rh[c])===Rh[c])}}}Qg.prototype.defined=!0;function dw(e,t,n){n&&(e[t]=n)}function ki(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const l=new Qg(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,n[Th(s)]=s,n[Th(l.attribute)]=s}return new fc(t,n,e.space)}const h1=ki({properties:{ariaActiveDescendant:null,ariaAtomic:dn,ariaAutoComplete:null,ariaBusy:dn,ariaChecked:dn,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,ariaControls:It,ariaCurrent:null,ariaDescribedBy:It,ariaDetails:null,ariaDisabled:dn,ariaDropEffect:It,ariaErrorMessage:null,ariaExpanded:dn,ariaFlowTo:It,ariaGrabbed:dn,ariaHasPopup:null,ariaHidden:dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:It,ariaLevel:Te,ariaLive:null,ariaModal:dn,ariaMultiLine:dn,ariaMultiSelectable:dn,ariaOrientation:null,ariaOwns:It,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:dn,ariaReadOnly:dn,ariaRelevant:null,ariaRequired:dn,ariaRoleDescription:It,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:dn,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function g1(e,t){return t in e?e[t]:t}function x1(e,t){return g1(e,t.toLowerCase())}const dO=ki({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:li,acceptCharset:It,accessKey:It,action:null,allow:null,allowFullScreen:dt,allowPaymentRequest:dt,allowUserMedia:dt,alt:null,as:null,async:dt,autoCapitalize:null,autoComplete:It,autoFocus:dt,autoPlay:dt,blocking:It,capture:null,charSet:null,checked:dt,cite:null,className:It,cols:Te,colSpan:null,content:null,contentEditable:dn,controls:dt,controlsList:It,coords:Te|li,crossOrigin:null,data:null,dateTime:null,decoding:null,default:dt,defer:dt,dir:null,dirName:null,disabled:dt,download:Ph,draggable:dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:dt,formTarget:null,headers:It,height:Te,hidden:Ph,high:Te,href:null,hrefLang:null,htmlFor:It,httpEquiv:It,id:null,imageSizes:null,imageSrcSet:null,inert:dt,inputMode:null,integrity:null,is:null,isMap:dt,itemId:null,itemProp:It,itemRef:It,itemScope:dt,itemType:It,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:dt,low:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,multiple:dt,muted:dt,name:null,nonce:null,noModule:dt,noValidate:dt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:dt,optimum:Te,pattern:null,ping:It,placeholder:null,playsInline:dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:dt,referrerPolicy:null,rel:It,required:dt,reversed:dt,rows:Te,rowSpan:Te,sandbox:It,scope:null,scoped:dt,seamless:dt,selected:dt,shadowRootClonable:dt,shadowRootDelegatesFocus:dt,shadowRootMode:null,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:dt,useMap:null,value:dn,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:It,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:dt,declare:dt,event:null,face:null,frame:null,frameBorder:null,hSpace:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:dt,noHref:dt,noShade:dt,noWrap:dt,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:dn,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:dt,disableRemotePlayback:dt,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:x1}),fO=ki({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:pr,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,className:It,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:li,g2:li,glyphName:li,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:pr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Te,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:It,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pr,rev:pr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pr,requiredFeatures:pr,requiredFonts:pr,requiredFormats:pr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:pr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pr,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:g1}),y1=ki({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),b1=ki({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:x1}),v1=ki({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pO={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},mO=/[A-Z]/g,fw=/-[a-z]/g,hO=/^data[-\w.:]+$/i;function gO(e,t){const n=Th(t);let s=t,a=ir;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hO.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(fw,yO);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!fw.test(l)){let c=l.replace(mO,xO);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Qg}return new a(s,t)}function xO(e){return"-"+e.toLowerCase()}function yO(e){return e.charAt(1).toUpperCase()}const bO=m1([h1,dO,y1,b1,v1],"html"),Zg=m1([h1,fO,y1,b1,v1],"svg");function vO(e){return e.join(" ").trim()}var Ba={},Dm,pw;function wO(){if(pw)return Dm;pw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,p=`
|
|
525
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return f.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},yD=Mk,bD=_k,Gk=Fk,Yk=zk,Jk=Wk,Xk=qk,Qk=Uk,Zk=Hk;const Ga=yD,vD=bD,eS=f.forwardRef(({className:e,...t},n)=>r.jsx(Gk,{ref:n,className:Ce("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));eS.displayName=Gk.displayName;const Bo=f.forwardRef(({className:e,...t},n)=>r.jsxs(vD,{children:[r.jsx(eS,{}),r.jsx(Yk,{ref:n,className:Ce("chrome-card fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 !p-6 outline-none",e),...t})]}));Bo.displayName=Yk.displayName;function Ya({className:e,...t}){return r.jsx("div",{className:Ce("flex flex-col space-y-2 text-left",e),...t})}function Ja({className:e,...t}){return r.jsx("div",{className:Ce("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Uo=f.forwardRef(({className:e,...t},n)=>r.jsx(Qk,{ref:n,className:Ce("text-lg font-semibold tracking-tight text-foreground",e),...t}));Uo.displayName=Qk.displayName;const Vo=f.forwardRef(({className:e,...t},n)=>r.jsx(Zk,{ref:n,className:Ce("text-sm leading-6 text-muted-foreground",e),...t}));Vo.displayName=Zk.displayName;const oo=f.forwardRef(({className:e,...t},n)=>r.jsx(Jk,{ref:n,className:Ce(e),...t}));oo.displayName=Jk.displayName;const Ul=f.forwardRef(({className:e,...t},n)=>r.jsx(Xk,{ref:n,className:Ce(e),...t}));Ul.displayName=Xk.displayName;const wD=[{to:"/",label:"Overview",icon:l0},{to:"/playbooks",label:"Playbooks",icon:o0},{to:"/memories",label:"Memories",icon:JT},{to:"/resources",label:"Resources",icon:dP},{to:"/inventories",label:"Inventories",icon:Ld},{to:"/usage",label:"Usage",icon:Od},{to:"/todos",label:"Todos",icon:Ar},{to:"/views",label:"Saved Views",icon:d0},{to:"/archive",label:"Archive",icon:Dd}],jD=[{suffix:"/projects",label:"Projects",icon:eg},{suffix:"/assignments",label:"Assignments",icon:mP},{suffix:"/servers",label:"Servers",icon:sg},{suffix:"/inventories",label:"Inventories",icon:Ld},{suffix:"/usage",label:"Usage",icon:Od},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Ad},{suffix:"/todos",label:"Todos",icon:Ar}],kD=[{to:"/help",label:"Help",icon:fP},{to:"/settings",label:"Settings",icon:SP}];function SD({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:a}){const[l,c]=f.useState(!1);return Ht({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:l,handler:()=>c(!1)}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"hidden max-h-screen sticky top-0 overflow-y-auto border-r border-border/70 bg-sidebar px-4 py-4 lg:flex lg:flex-col",children:r.jsx(_v,{activeWorkspace:s})}),l?r.jsx("div",{className:"fixed inset-0 z-40 bg-overlay/40 lg:hidden",children:r.jsxs("div",{className:"h-full max-w-xs border-r border-border/70 bg-sidebar p-4 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[r.jsx(Ee,{to:"/",className:"text-lg font-semibold text-foreground",onClick:()=>c(!1),children:"Syntaur"}),r.jsx("button",{type:"button",onClick:()=>c(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border/70 bg-background/80",children:r.jsx(ig,{className:"h-4 w-4"})})]}),r.jsx(_v,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(X3,{title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:()=>c(!0)}),r.jsx("main",{className:"mx-auto w-full max-w-[1480px] px-4 py-4 lg:px-6 lg:py-5",children:a})]})]})})}function _v({activeWorkspace:e,onNavigate:t}){const{data:n}=oc(),s=(n==null?void 0:n.workspaces)??[],a=(n==null?void 0:n.hasUngrouped)??!1,{hidden:l}=Ok(),c=Wn(),[u,p]=f.useState(new Set),[m,h]=f.useState(!1),[x,y]=f.useState(""),[b,C]=f.useState(null),[j,w]=f.useState(null),[k,E]=f.useState(null),[N,P]=f.useState(!1),$=Dt();function T(V){p(L=>{const W=new Set(L);return W.has(V)?W.delete(V):W.add(V),W})}const D=eD([...s,...a?[ld]:[]],l);async function O(V){if(j){P(!0);try{const L=`/api/workspaces/${encodeURIComponent(j)}${V?"?cascade=true":""}`,W=await fetch(L,{method:"DELETE"});if(W.status===409){const oe=await W.json().catch(()=>({}));E((oe==null?void 0:oe.blockedBy)??{projects:[],standalones:[]});return}if(!W.ok){const oe=await W.json().catch(()=>({}));throw new Error(oe.error||"Failed to delete workspace")}w(null),E(null)}catch(L){console.error(L),alert(L instanceof Error?L.message:"Failed to delete workspace")}finally{P(!1)}}}async function J(V,L){try{if(V.type==="project"){const W=await fetch(`/api/projects/${encodeURIComponent(V.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:L})});if(!W.ok){const oe=await W.json().catch(()=>({}));throw new Error(oe.error||"Failed to move project")}return}if(V.type==="standalone-assignment"){const W=await fetch(`/api/assignments/${encodeURIComponent(V.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:L})});if(!W.ok){const oe=await W.json().catch(()=>({}));throw new Error(oe.error||"Failed to move assignment")}return}if(V.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(W){console.error(W),alert(W instanceof Error?W.message:"Failed to move item")}}return r.jsxs("div",{className:"flex h-full flex-col gap-3",children:[r.jsx("div",{className:"space-y-3",children:r.jsxs(Ee,{to:"/",className:"inline-flex items-center gap-3",onClick:t,children:[r.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-lg bg-card text-foreground shadow-sm ring-1 ring-border/60",children:r.jsxs("svg",{viewBox:"0 0 43 51","aria-label":"Syntaur",role:"img",className:"h-4 w-auto",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M13 2C13 0.89543 13.8954 0 15 0H41C42.1046 0 43 0.895431 43 2V12C43 13.1046 42.1046 14 41 14H13V2Z"}),r.jsx("path",{d:"M0 15C0 13.8954 0.895431 13 2 13H14V25C14 26.1046 13.1046 27 12 27H2C0.89543 27 0 26.1046 0 25V15Z"}),r.jsx("path",{d:"M30 49C30 50.1046 29.1046 51 28 51L2 51C0.89543 51 0 50.1046 0 49L0 39C0 37.8954 0.895431 37 2 37L30 37L30 49Z"}),r.jsx("path",{d:"M42.9646 36C42.9646 37.1046 42.0692 38 40.9646 38H28.9646V26C28.9646 24.8954 29.86 24 30.9646 24H40.9646C42.0692 24 42.9646 24.8954 42.9646 26V36Z"})]})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Syntaur"}),r.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Local-first project control"})]})]})}),r.jsx(yv,{items:wD,onNavigate:t}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[D.length===0&&!m&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),D.map(V=>{const L=V==="_ungrouped",W=L?"Ungrouped":yn(V),oe=L?"/w/_ungrouped":`/w/${V}`,z=u.has(V),H=e===V||e===null&&L&&c.pathname.startsWith("/w/_ungrouped"),ee=b===V;return r.jsxs("div",{className:`rounded-md transition ${ee?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:ne=>{ne.dataTransfer.types.includes("application/json")&&(ne.preventDefault(),ne.dataTransfer.dropEffect="move",C(V))},onDragLeave:ne=>{ne.currentTarget.contains(ne.relatedTarget)||C(M=>M===V?null:M)},onDrop:async ne=>{try{const M=ne.dataTransfer.getData("application/json");if(!M)return;ne.preventDefault();let q;try{q=JSON.parse(M)}catch{return}if(!(q!=null&&q.type)||!(q!=null&&q.id))return;await J(q,L?null:V)}finally{C(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>T(V),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${H?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx($r,{className:`h-3 w-3 transition-transform ${z?"-rotate-90":""}`}),W]}),L?null:r.jsx("button",{type:"button",onClick:ne=>{ne.stopPropagation(),w(V),E(null)},title:`Delete workspace "${V}"`,"aria-label":`Delete workspace "${V}"`,className:"mr-1 flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition hover:bg-destructive/10 hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100",children:r.jsx(or,{className:"h-3 w-3"})})]}),!z&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:jD.map(ne=>{const M=`${oe}${ne.suffix}`,q=N0(c.pathname,ne.suffix)&&c.pathname.startsWith(oe),A=ne.icon;return r.jsxs(Ee,{to:M,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${q?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx(A,{className:"h-4 w-4"}),r.jsx("span",{children:ne.label})]},M)})})]},V)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:V=>{V.preventDefault();const L=x.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");L&&(h(!1),y(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:L})}).then(()=>{t==null||t(),$(`/w/${L}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:x,onChange:V=>y(V.target.value),onKeyDown:V=>{V.key==="Escape"&&(h(!1),y(""))},onBlur:()=>{x.trim()||(h(!1),y(""))},placeholder:"workspace-name",className:"w-full rounded-md border border-border/60 bg-background/80 px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-foreground/40 focus:outline-none"})}):r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium text-muted-foreground/60 transition hover:text-muted-foreground",children:[r.jsx(rn,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(yv,{items:kD,onNavigate:t}),r.jsx(Ga,{open:j!==null,onOpenChange:V=>{N||V||(w(null),E(null))},children:r.jsxs(Bo,{children:[r.jsxs(Ya,{children:[r.jsx(Uo,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(Vo,{children:k?r.jsxs(r.Fragment,{children:["The workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," is still referenced by:"]}):r.jsxs(r.Fragment,{children:["Remove the workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),k?r.jsxs("div",{className:"space-y-2 text-sm",children:[k.projects.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",k.projects.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.projects.map(V=>r.jsx("li",{children:r.jsx(Ee,{to:`/projects/${V}`,className:"hover:underline",children:V})},V))})]}):null,k.standalones.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",k.standalones.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.standalones.map(V=>r.jsx("li",{children:r.jsx(Ee,{to:`/assignments/${V}`,className:"hover:underline",children:V})},V))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Choose "Clear references and delete" to set ',r.jsx("code",{children:"workspace:"})," / ",r.jsx("code",{children:"workspaceGroup:"})," to ",r.jsx("code",{children:"null"})," on each, then remove the workspace."]})]}):null,r.jsxs(Ja,{children:[r.jsx(Ul,{disabled:N,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(oo,{disabled:N,onClick:V=>{V.preventDefault(),O(!0)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:N?"Working…":"Clear references and delete"}):r.jsx(oo,{disabled:N,onClick:V=>{V.preventDefault(),O(!1)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:N?"Working…":"Delete"})]})]})})]})}function ND(){const e=Wn(),{workspace:t}=$t(),{title:n,breadcrumbs:s,projectSlug:a}=C0(e.pathname);return r.jsx(SD,{title:n,breadcrumbs:s,projectSlug:a,workspace:t??null,children:r.jsx(lT,{})})}function mt({label:e="Loading dashboard data…"}){return r.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:r.jsx("div",{className:"chrome-card !px-4 !py-3",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function wt({title:e="Something went wrong",error:t,action:n}){return r.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),n?r.jsx("div",{className:"pt-2",children:n}):null]})})}function qu({command:e,description:t,example:n}){return r.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[r.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?r.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?r.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function We({title:e,description:t,children:n,className:s,actions:a}){return r.jsxs("section",{className:Ce("surface-panel space-y-3",s),children:[e||a?r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?r.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),a]}):null,n]})}function CD({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return r.jsx(We,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:r.jsx(Ee,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:r.jsx("div",{className:"space-y-3",children:n.map((s,a)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:a+1}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:s.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:s.detail}),s.command?r.jsx(qu,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const jm={review:"{total} items ready for your review","review.singular":"Review {title}",ready_to_implement:"{total} plans ready to implement — start with {title}","ready_to_implement.singular":"Start implementing {title}",ready_for_planning:"{total} assignments ready to plan — start with {title}","ready_for_planning.singular":"Plan {title}",in_progress:"Resume {title} ({total} in progress)","in_progress.singular":"Resume {title}",draft:"Shape your {total} drafts — start with {title}","draft.singular":"Shape {title}",blocked:"Unblock {title} ({total} blocked)","blocked.singular":"Unblock {title}",stale:"Triage {total} stale items","stale.singular":"Triage {title} — sitting stale",clean:"You’re all clear. Nothing needs you right now."},Ho={emptyStateCleanTitle:"You’re all clear",emptyStateCleanCTA:"Browse projects",recentSessionsEmptyTitle:"No recent sessions",recentSessionsEmptyHint:"Use /grab-assignment or `syntaur track-session` to register one.",recentSessionsCopyPathLabel:"Copy path",recentSessionsCopyPathDisabled:"Session has no path",recentSessionsCopyFallbackHint:"Press ⌘C to copy"};function ED(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function TD({hero:e,itemsById:t}){const n=ln();if(e.kind==="clean")return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-border/60 bg-background/60 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:Ho.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:jm.clean}),r.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"When work shows up — a draft, a review, a stale row — it’ll surface here."}),r.jsx("div",{className:"mt-4",children:r.jsx(Ee,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:Ho.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,a=(s==null?void 0:s.assignmentTitle)??"",l=jm[e.copyKey]??jm[e.kind],c=ED(l,{total:e.total,title:a}),u=s?PD(s,n):`${n}/assignments`;return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-primary/20 bg-primary/5 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:"What needs you today"}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:c}),s?r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["In ",r.jsx("span",{className:"font-medium text-foreground",children:s.projectTitle??"Standalone"})," ","· status ",r.jsx("span",{className:"font-medium text-foreground",children:s.status})]}):null,r.jsx("div",{className:"mt-4",children:r.jsxs(Ee,{to:u,className:"shell-action shell-action--cta",children:["Open ",a||"assignment"]})})]})}function PD(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Rg=["kanban","list","table"],tS=["title","status","priority","assignee","dependencies","created","updated"],RD=["asc","desc"],AD=["comfortable","compact"],DD=["none","status","type","priority","assignee","project"],$D=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function tt(e){const t=e===void 0?[]:Array.isArray(e)?e:[e],n=[];for(const s of t){if(typeof s!="string")continue;const a=s.trim();!a||a==="all"||n.includes(a)||n.push(a)}return n}function LD(e,t){const n=tt(e),s=tt(t);return n.length===s.length&&n.every(a=>s.includes(a))}const OD={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},Vl={version:1,global:OD,projects:{}};function km(e){return e==="table"?"table":"kanban"}function ID(e,t){return t?{...e,...t}:{...e}}function nS(e,t){const n=e.global;if(t===null)return n;const s=e.projects[t];return s?{defaultView:s.defaultView??n.defaultView,sortField:s.sortField??n.sortField,sortDirection:s.sortDirection??n.sortDirection,density:n.density,grouping:s.grouping??n.grouping,filters:ID(n.filters,s.filters)}:n}const Sm=["title","status","priority","assignee","dependencies","created","updated"],MD=["small","wide","tall","large"],_D={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},Fv="2026-05-21T00:00:00Z";function Nm(e,t,n){return{id:e,name:t,workspace:null,config:{viewMode:"list",filters:{..._D,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:Fv,updatedAt:Fv}}const ao={version:1,views:[Nm("default-recently-updated","Recently updated",{}),Nm("default-high-priority","High priority",{priority:"high"}),Nm("default-stale","Stale",{activity:"stale"})],dashboard:{version:1,slots:[{id:"slot-0",widget:{kind:"agent-sessions"}},{id:"slot-1",widget:{kind:"saved-view",viewId:"default-recently-updated"}},{id:"slot-2",widget:{kind:"saved-view",viewId:"default-high-priority"}},{id:"slot-3",widget:{kind:"saved-view",viewId:"default-stale"}},{id:"slot-4",widget:{kind:"inventories"}}]}};function rS(e,t){const n=tt(e.filters.project),s=n.length===0||n.length===1&&n[0]===t,a=e.filters.activity,l=typeof e.filters.search=="string"&&e.filters.search.trim().length>0;return s&&(!a||a==="all")&&!l}function sS(e,t){switch(t.kind){case"global":return e.workspace===null;case"workspace":return e.workspace===t.workspace||e.workspace===null;case"project":return e.workspace===t.workspace||e.workspace===null?rS(e.config,t.slug):!1}}const oS=`syntaur.savedViews.cache.v${ao.version}`;let oi=FD(),_o=null,Ag=null;const yh=new Set,cd=new Set;let aS=0;function iS(){return++aS}function bh(e){return e===aS}function FD(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(oS);if(!e)return null;const t=JSON.parse(e);return t.version!==ao.version?null:t}catch{return null}}function zD(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(oS,JSON.stringify(e))}catch{}}function lS(e){oi=e,Ag=null,zD(e);for(const t of yh)t(e);for(const t of cd)t(null)}function BD(e){Ag=e;for(const t of cd)t(e)}function cS(e){if(!e||typeof e!="object")return ao;const t=e;return t.version!==ao.version||!Array.isArray(t.views)||!t.dashboard?ao:t}function zv(){if(_o)return _o;const e=iS();return _o=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=cS(t);return bh(e)&&lS(n),_o=null,oi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return bh(e)&&BD(n),_o=null,oi??ao}),_o}function Dg(){const[e,t]=f.useState(()=>oi??ao),[n,s]=f.useState(()=>oi===null),[a,l]=f.useState(!1),[c,u]=f.useState(()=>Ag);return f.useEffect(()=>{let m=!1;oi===null&&s(!0),zv().then(y=>{m||(t(y),s(!1),l(!0))});const h=y=>{m||(t(y),s(!1),l(!0),u(null))},x=y=>{m||(u(y),s(!1),l(!0))};return yh.add(h),cd.add(x),()=>{m=!0,yh.delete(h),cd.delete(x)}},[]),{file:e,loading:n,ready:a,error:c,refetch:()=>{_o=null,s(!0),u(null),l(!1),zv()}}}function Vd(){const{file:e,loading:t}=Dg();return{views:e.views,loading:t}}function UD(){const{file:e,loading:t}=Dg();return{layout:e.dashboard,loading:t}}function Go(e){const{file:t,loading:n,ready:s,error:a,refetch:l}=Dg();return e?{view:t.views.find(u=>u.id===e)??null,loading:n,ready:s,error:a,refetch:l}:{view:null,loading:!1,ready:!0,error:null,refetch:l}}async function Hd(e,t,n){const s=iS(),a=await fetch(t,{method:e,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!a.ok){const c=await a.json().catch(()=>({error:`HTTP ${a.status}`}));throw new Error(c.error??`HTTP ${a.status}`)}const l=cS(await a.json());return bh(s)&&lS(l),l}function Wd(e){return Hd("POST","/api/saved-views",e)}function $g(e,t){return Hd("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function VD(e){return Hd("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function HD(e){return Hd("PUT","/api/dashboard",{slots:e})}const WD=["top","right","bottom","left"],co=Math.min,hr=Math.max,ud=Math.round,Pu=Math.floor,ds=e=>({x:e,y:e}),KD={left:"right",right:"left",bottom:"top",top:"bottom"};function vh(e,t,n){return hr(e,co(t,n))}function As(e,t){return typeof e=="function"?e(t):e}function Ds(e){return e.split("-")[0]}function wi(e){return e.split("-")[1]}function Lg(e){return e==="x"?"y":"x"}function Og(e){return e==="y"?"height":"width"}function ls(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ig(e){return Lg(ls(e))}function qD(e,t,n){n===void 0&&(n=!1);const s=wi(e),a=Ig(e),l=Og(a);let c=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=dd(c)),[c,dd(c)]}function GD(e){const t=dd(e);return[wh(e),t,wh(t)]}function wh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bv=["left","right"],Uv=["right","left"],YD=["top","bottom"],JD=["bottom","top"];function XD(e,t,n){switch(e){case"top":case"bottom":return n?t?Uv:Bv:t?Bv:Uv;case"left":case"right":return t?YD:JD;default:return[]}}function QD(e,t,n,s){const a=wi(e);let l=XD(Ds(e),n==="start",s);return a&&(l=l.map(c=>c+"-"+a),t&&(l=l.concat(l.map(wh)))),l}function dd(e){const t=Ds(e);return KD[t]+e.slice(t.length)}function ZD(e){return{top:0,right:0,bottom:0,left:0,...e}}function uS(e){return typeof e!="number"?ZD(e):{top:e,right:e,bottom:e,left:e}}function fd(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}function Vv(e,t,n){let{reference:s,floating:a}=e;const l=ls(t),c=Ig(t),u=Og(c),p=Ds(t),m=l==="y",h=s.x+s.width/2-a.width/2,x=s.y+s.height/2-a.height/2,y=s[u]/2-a[u]/2;let b;switch(p){case"top":b={x:h,y:s.y-a.height};break;case"bottom":b={x:h,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:x};break;case"left":b={x:s.x-a.width,y:x};break;default:b={x:s.x,y:s.y}}switch(wi(t)){case"start":b[c]-=y*(n&&m?-1:1);break;case"end":b[c]+=y*(n&&m?-1:1);break}return b}async function e4(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:l,rects:c,elements:u,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:x="floating",altBoundary:y=!1,padding:b=0}=As(t,e),C=uS(b),w=u[y?x==="floating"?"reference":"floating":x],k=fd(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(w)))==null||n?w:w.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:p})),E=x==="floating"?{x:s,y:a,width:c.floating.width,height:c.floating.height}:c.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),P=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},$=fd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:N,strategy:p}):E);return{top:(k.top-$.top+C.top)/P.y,bottom:($.bottom-k.bottom+C.bottom)/P.y,left:(k.left-$.left+C.left)/P.x,right:($.right-k.right+C.right)/P.x}}const t4=50,n4=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:e4},p=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:x}=Vv(m,s,p),y=s,b=0;const C={};for(let j=0;j<l.length;j++){const w=l[j];if(!w)continue;const{name:k,fn:E}=w,{x:N,y:P,data:$,reset:T}=await E({x:h,y:x,initialPlacement:s,placement:y,strategy:a,middlewareData:C,rects:m,platform:u,elements:{reference:e,floating:t}});h=N??h,x=P??x,C[k]={...C[k],...$},T&&b<t4&&(b++,typeof T=="object"&&(T.placement&&(y=T.placement),T.rects&&(m=T.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:h,y:x}=Vv(m,y,p)),j=-1)}return{x:h,y:x,placement:y,strategy:a,middlewareData:C}},r4=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:l,platform:c,elements:u,middlewareData:p}=t,{element:m,padding:h=0}=As(e,t)||{};if(m==null)return{};const x=uS(h),y={x:n,y:s},b=Ig(a),C=Og(b),j=await c.getDimensions(m),w=b==="y",k=w?"top":"left",E=w?"bottom":"right",N=w?"clientHeight":"clientWidth",P=l.reference[C]+l.reference[b]-y[b]-l.floating[C],$=y[b]-l.reference[b],T=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let D=T?T[N]:0;(!D||!await(c.isElement==null?void 0:c.isElement(T)))&&(D=u.floating[N]||l.floating[C]);const O=P/2-$/2,J=D/2-j[C]/2-1,V=co(x[k],J),L=co(x[E],J),W=V,oe=D-j[C]-L,z=D/2-j[C]/2+O,H=vh(W,z,oe),ee=!p.arrow&&wi(a)!=null&&z!==H&&l.reference[C]/2-(z<W?V:L)-j[C]/2<0,ne=ee?z<W?z-W:z-oe:0;return{[b]:y[b]+ne,data:{[b]:H,centerOffset:z-H-ne,...ee&&{alignmentOffset:ne}},reset:ee}}}),s4=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:a,middlewareData:l,rects:c,initialPlacement:u,platform:p,elements:m}=t,{mainAxis:h=!0,crossAxis:x=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...w}=As(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=Ds(a),E=ls(u),N=Ds(u)===u,P=await(p.isRTL==null?void 0:p.isRTL(m.floating)),$=y||(N||!j?[dd(u)]:GD(u)),T=C!=="none";!y&&T&&$.push(...QD(u,j,C,P));const D=[u,...$],O=await p.detectOverflow(t,w),J=[];let V=((s=l.flip)==null?void 0:s.overflows)||[];if(h&&J.push(O[k]),x){const z=qD(a,c,P);J.push(O[z[0]],O[z[1]])}if(V=[...V,{placement:a,overflows:J}],!J.every(z=>z<=0)){var L,W;const z=(((L=l.flip)==null?void 0:L.index)||0)+1,H=D[z];if(H&&(!(x==="alignment"?E!==ls(H):!1)||V.every(M=>ls(M.placement)===E?M.overflows[0]>0:!0)))return{data:{index:z,overflows:V},reset:{placement:H}};let ee=(W=V.filter(ne=>ne.overflows[0]<=0).sort((ne,M)=>ne.overflows[1]-M.overflows[1])[0])==null?void 0:W.placement;if(!ee)switch(b){case"bestFit":{var oe;const ne=(oe=V.filter(M=>{if(T){const q=ls(M.placement);return q===E||q==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(q=>q>0).reduce((q,A)=>q+A,0)]).sort((M,q)=>M[1]-q[1])[0])==null?void 0:oe[0];ne&&(ee=ne);break}case"initialPlacement":ee=u;break}if(a!==ee)return{reset:{placement:ee}}}return{}}}};function Hv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wv(e){return WD.some(t=>e[t]>=0)}const o4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:a="referenceHidden",...l}=As(e,t);switch(a){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),u=Hv(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Wv(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=Hv(c,n.floating);return{data:{escapedOffsets:u,escaped:Wv(u)}}}default:return{}}}}},dS=new Set(["left","top"]);async function a4(e,t){const{placement:n,platform:s,elements:a}=e,l=await(s.isRTL==null?void 0:s.isRTL(a.floating)),c=Ds(n),u=wi(n),p=ls(n)==="y",m=dS.has(c)?-1:1,h=l&&p?-1:1,x=As(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:C}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return u&&typeof C=="number"&&(b=u==="end"?C*-1:C),p?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const i4=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:l,placement:c,middlewareData:u}=t,p=await a4(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:a+p.x,y:l+p.y,data:{...p,placement:c}}}}},l4=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a,platform:l}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:p={fn:k=>{let{x:E,y:N}=k;return{x:E,y:N}}},...m}=As(e,t),h={x:n,y:s},x=await l.detectOverflow(t,m),y=ls(Ds(a)),b=Lg(y);let C=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",N=C+x[k],P=C-x[E];C=vh(N,C,P)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",N=j+x[k],P=j-x[E];j=vh(N,j,P)}const w=p.fn({...t,[b]:C,[y]:j});return{...w,data:{x:w.x-n,y:w.y-s,enabled:{[b]:c,[y]:u}}}}}},c4=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:a,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:p=!0,crossAxis:m=!0}=As(e,t),h={x:n,y:s},x=ls(a),y=Lg(x);let b=h[y],C=h[x];const j=As(u,t),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(p){const N=y==="y"?"height":"width",P=l.reference[y]-l.floating[N]+w.mainAxis,$=l.reference[y]+l.reference[N]-w.mainAxis;b<P?b=P:b>$&&(b=$)}if(m){var k,E;const N=y==="y"?"width":"height",P=dS.has(Ds(a)),$=l.reference[x]-l.floating[N]+(P&&((k=c.offset)==null?void 0:k[x])||0)+(P?0:w.crossAxis),T=l.reference[x]+l.reference[N]+(P?0:((E=c.offset)==null?void 0:E[x])||0)-(P?w.crossAxis:0);C<$?C=$:C>T&&(C=T)}return{[y]:b,[x]:C}}}},u4=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:a,rects:l,platform:c,elements:u}=t,{apply:p=()=>{},...m}=As(e,t),h=await c.detectOverflow(t,m),x=Ds(a),y=wi(a),b=ls(a)==="y",{width:C,height:j}=l.floating;let w,k;x==="top"||x==="bottom"?(w=x,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=x,w=y==="end"?"top":"bottom");const E=j-h.top-h.bottom,N=C-h.left-h.right,P=co(j-h[w],E),$=co(C-h[k],N),T=!t.middlewareData.shift;let D=P,O=$;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(D=E),T&&!y){const V=hr(h.left,0),L=hr(h.right,0),W=hr(h.top,0),oe=hr(h.bottom,0);b?O=C-2*(V!==0||L!==0?V+L:hr(h.left,h.right)):D=j-2*(W!==0||oe!==0?W+oe:hr(h.top,h.bottom))}await p({...t,availableWidth:O,availableHeight:D});const J=await c.getDimensions(u.floating);return C!==J.width||j!==J.height?{reset:{rects:!0}}:{}}}};function Kd(){return typeof window<"u"}function ji(e){return fS(e)?(e.nodeName||"").toLowerCase():"#document"}function yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function gs(e){var t;return(t=(fS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fS(e){return Kd()?e instanceof Node||e instanceof yr(e).Node:!1}function qr(e){return Kd()?e instanceof Element||e instanceof yr(e).Element:!1}function Is(e){return Kd()?e instanceof HTMLElement||e instanceof yr(e).HTMLElement:!1}function Kv(e){return!Kd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yr(e).ShadowRoot}function ic(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=Gr(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&a!=="inline"&&a!=="contents"}function d4(e){return/^(table|td|th)$/.test(ji(e))}function qd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const f4=/transform|translate|scale|rotate|perspective|filter/,p4=/paint|layout|strict|content/,Io=e=>!!e&&e!=="none";let Cm;function Mg(e){const t=qr(e)?Gr(e):e;return Io(t.transform)||Io(t.translate)||Io(t.scale)||Io(t.rotate)||Io(t.perspective)||!_g()&&(Io(t.backdropFilter)||Io(t.filter))||f4.test(t.willChange||"")||p4.test(t.contain||"")}function m4(e){let t=uo(e);for(;Is(t)&&!fi(t);){if(Mg(t))return t;if(qd(t))return null;t=uo(t)}return null}function _g(){return Cm==null&&(Cm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Cm}function fi(e){return/^(html|body|#document)$/.test(ji(e))}function Gr(e){return yr(e).getComputedStyle(e)}function Gd(e){return qr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uo(e){if(ji(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Kv(e)&&e.host||gs(e);return Kv(t)?t.host:t}function pS(e){const t=uo(e);return fi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Is(t)&&ic(t)?t:pS(t)}function Hl(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=pS(e),l=a===((s=e.ownerDocument)==null?void 0:s.body),c=yr(a);if(l){const u=jh(c);return t.concat(c,c.visualViewport||[],ic(a)?a:[],u&&n?Hl(u):[])}else return t.concat(a,Hl(a,[],n))}function jh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mS(e){const t=Gr(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=Is(e),l=a?e.offsetWidth:n,c=a?e.offsetHeight:s,u=ud(n)!==l||ud(s)!==c;return u&&(n=l,s=c),{width:n,height:s,$:u}}function Fg(e){return qr(e)?e:e.contextElement}function ai(e){const t=Fg(e);if(!Is(t))return ds(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:l}=mS(t);let c=(l?ud(n.width):n.width)/s,u=(l?ud(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const h4=ds(0);function hS(e){const t=yr(e);return!_g()||!t.visualViewport?h4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function g4(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yr(e)?!1:t}function Yo(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=Fg(e);let c=ds(1);t&&(s?qr(s)&&(c=ai(s)):c=ai(e));const u=g4(l,n,s)?hS(l):ds(0);let p=(a.left+u.x)/c.x,m=(a.top+u.y)/c.y,h=a.width/c.x,x=a.height/c.y;if(l){const y=yr(l),b=s&&qr(s)?yr(s):s;let C=y,j=jh(C);for(;j&&s&&b!==C;){const w=ai(j),k=j.getBoundingClientRect(),E=Gr(j),N=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,P=k.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;p*=w.x,m*=w.y,h*=w.x,x*=w.y,p+=N,m+=P,C=yr(j),j=jh(C)}}return fd({width:h,height:x,x:p,y:m})}function Yd(e,t){const n=Gd(e).scrollLeft;return t?t.left+n:Yo(gs(e)).left+n}function gS(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Yd(e,n),a=n.top+t.scrollTop;return{x:s,y:a}}function x4(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const l=a==="fixed",c=gs(s),u=t?qd(t.floating):!1;if(s===c||u&&l)return n;let p={scrollLeft:0,scrollTop:0},m=ds(1);const h=ds(0),x=Is(s);if((x||!x&&!l)&&((ji(s)!=="body"||ic(c))&&(p=Gd(s)),x)){const b=Yo(s);m=ai(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!x&&!l?gS(c,p):ds(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-p.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-p.scrollTop*m.y+h.y+y.y}}function y4(e){return Array.from(e.getClientRects())}function b4(e){const t=gs(e),n=Gd(e),s=e.ownerDocument.body,a=hr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=hr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Yd(e);const u=-n.scrollTop;return Gr(s).direction==="rtl"&&(c+=hr(t.clientWidth,s.clientWidth)-a),{width:a,height:l,x:c,y:u}}const qv=25;function v4(e,t){const n=yr(e),s=gs(e),a=n.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,p=0;if(a){l=a.width,c=a.height;const h=_g();(!h||h&&t==="fixed")&&(u=a.offsetLeft,p=a.offsetTop)}const m=Yd(s);if(m<=0){const h=s.ownerDocument,x=h.body,y=getComputedStyle(x),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,C=Math.abs(s.clientWidth-x.clientWidth-b);C<=qv&&(l-=C)}else m<=qv&&(l+=m);return{width:l,height:c,x:u,y:p}}function w4(e,t){const n=Yo(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,l=Is(e)?ai(e):ds(1),c=e.clientWidth*l.x,u=e.clientHeight*l.y,p=a*l.x,m=s*l.y;return{width:c,height:u,x:p,y:m}}function Gv(e,t,n){let s;if(t==="viewport")s=v4(e,n);else if(t==="document")s=b4(gs(e));else if(qr(t))s=w4(t,n);else{const a=hS(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return fd(s)}function xS(e,t){const n=uo(e);return n===t||!qr(n)||fi(n)?!1:Gr(n).position==="fixed"||xS(n,t)}function j4(e,t){const n=t.get(e);if(n)return n;let s=Hl(e,[],!1).filter(u=>qr(u)&&ji(u)!=="body"),a=null;const l=Gr(e).position==="fixed";let c=l?uo(e):e;for(;qr(c)&&!fi(c);){const u=Gr(c),p=Mg(c);!p&&u.position==="fixed"&&(a=null),(l?!p&&!a:!p&&u.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||ic(c)&&!p&&xS(e,c))?s=s.filter(h=>h!==c):a=u,c=uo(c)}return t.set(e,s),s}function k4(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?qd(t)?[]:j4(t,this._c):[].concat(n),s],u=Gv(t,c[0],a);let p=u.top,m=u.right,h=u.bottom,x=u.left;for(let y=1;y<c.length;y++){const b=Gv(t,c[y],a);p=hr(b.top,p),m=co(b.right,m),h=co(b.bottom,h),x=hr(b.left,x)}return{width:m-x,height:h-p,x,y:p}}function S4(e){const{width:t,height:n}=mS(e);return{width:t,height:n}}function N4(e,t,n){const s=Is(t),a=gs(t),l=n==="fixed",c=Yo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const p=ds(0);function m(){p.x=Yd(a)}if(s||!s&&!l)if((ji(t)!=="body"||ic(a))&&(u=Gd(t)),s){const b=Yo(t,!0,l,t);p.x=b.x+t.clientLeft,p.y=b.y+t.clientTop}else a&&m();l&&!s&&a&&m();const h=a&&!s&&!l?gS(a,u):ds(0),x=c.left+u.scrollLeft-p.x-h.x,y=c.top+u.scrollTop-p.y-h.y;return{x,y,width:c.width,height:c.height}}function Em(e){return Gr(e).position==="static"}function Yv(e,t){if(!Is(e)||Gr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return gs(e)===n&&(n=n.ownerDocument.body),n}function yS(e,t){const n=yr(e);if(qd(e))return n;if(!Is(e)){let a=uo(e);for(;a&&!fi(a);){if(qr(a)&&!Em(a))return a;a=uo(a)}return n}let s=Yv(e,t);for(;s&&d4(s)&&Em(s);)s=Yv(s,t);return s&&fi(s)&&Em(s)&&!Mg(s)?n:s||m4(e)||n}const C4=async function(e){const t=this.getOffsetParent||yS,n=this.getDimensions,s=await n(e.floating);return{reference:N4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function E4(e){return Gr(e).direction==="rtl"}const T4={convertOffsetParentRelativeRectToViewportRelativeRect:x4,getDocumentElement:gs,getClippingRect:k4,getOffsetParent:yS,getElementRects:C4,getClientRects:y4,getDimensions:S4,getScale:ai,isElement:qr,isRTL:E4};function bS(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function P4(e,t){let n=null,s;const a=gs(e);function l(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,p){u===void 0&&(u=!1),p===void 0&&(p=1),l();const m=e.getBoundingClientRect(),{left:h,top:x,width:y,height:b}=m;if(u||t(),!y||!b)return;const C=Pu(x),j=Pu(a.clientWidth-(h+y)),w=Pu(a.clientHeight-(x+b)),k=Pu(h),N={rootMargin:-C+"px "+-j+"px "+-w+"px "+-k+"px",threshold:hr(0,co(1,p))||1};let P=!0;function $(T){const D=T[0].intersectionRatio;if(D!==p){if(!P)return c();D?c(!1,D):s=setTimeout(()=>{c(!1,1e-7)},1e3)}D===1&&!bS(m,e.getBoundingClientRect())&&c(),P=!1}try{n=new IntersectionObserver($,{...N,root:a.ownerDocument})}catch{n=new IntersectionObserver($,N)}n.observe(e)}return c(!0),l}function R4(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:p=!1}=s,m=Fg(e),h=a||l?[...m?Hl(m):[],...t?Hl(t):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const x=m&&u?P4(m,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(k=>{let[E]=k;E&&E.target===m&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var N;(N=b)==null||N.observe(t)})),n()}),m&&!p&&b.observe(m),t&&b.observe(t));let C,j=p?Yo(e):null;p&&w();function w(){const k=Yo(e);j&&!bS(j,k)&&n(),j=k,C=requestAnimationFrame(w)}return n(),()=>{var k;h.forEach(E=>{a&&E.removeEventListener("scroll",n),l&&E.removeEventListener("resize",n)}),x==null||x(),(k=b)==null||k.disconnect(),b=null,p&&cancelAnimationFrame(C)}}const A4=i4,D4=l4,$4=s4,L4=u4,O4=o4,Jv=r4,I4=c4,M4=(e,t,n)=>{const s=new Map,a={platform:T4,...n},l={...a.platform,_c:s};return n4(e,t,{...a,platform:l})};var _4=typeof document<"u",F4=function(){},Gu=_4?f.useLayoutEffect:F4;function pd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!pd(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const l=a[s];if(!(l==="_owner"&&e.$$typeof)&&!pd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function vS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xv(e,t){const n=vS(e);return Math.round(t*n)/n}function Tm(e){const t=f.useRef(e);return Gu(()=>{t.current=e}),t}function z4(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:l,floating:c}={},transform:u=!0,whileElementsMounted:p,open:m}=e,[h,x]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=f.useState(s);pd(y,s)||b(s);const[C,j]=f.useState(null),[w,k]=f.useState(null),E=f.useCallback(M=>{M!==T.current&&(T.current=M,j(M))},[]),N=f.useCallback(M=>{M!==D.current&&(D.current=M,k(M))},[]),P=l||C,$=c||w,T=f.useRef(null),D=f.useRef(null),O=f.useRef(h),J=p!=null,V=Tm(p),L=Tm(a),W=Tm(m),oe=f.useCallback(()=>{if(!T.current||!D.current)return;const M={placement:t,strategy:n,middleware:y};L.current&&(M.platform=L.current),M4(T.current,D.current,M).then(q=>{const A={...q,isPositioned:W.current!==!1};z.current&&!pd(O.current,A)&&(O.current=A,Ts.flushSync(()=>{x(A)}))})},[y,t,n,L,W]);Gu(()=>{m===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,x(M=>({...M,isPositioned:!1})))},[m]);const z=f.useRef(!1);Gu(()=>(z.current=!0,()=>{z.current=!1}),[]),Gu(()=>{if(P&&(T.current=P),$&&(D.current=$),P&&$){if(V.current)return V.current(P,$,oe);oe()}},[P,$,oe,V,J]);const H=f.useMemo(()=>({reference:T,floating:D,setReference:E,setFloating:N}),[E,N]),ee=f.useMemo(()=>({reference:P,floating:$}),[P,$]),ne=f.useMemo(()=>{const M={position:n,left:0,top:0};if(!ee.floating)return M;const q=Xv(ee.floating,h.x),A=Xv(ee.floating,h.y);return u?{...M,transform:"translate("+q+"px, "+A+"px)",...vS(ee.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:A}},[n,u,ee.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:oe,refs:H,elements:ee,floatingStyles:ne}),[h,oe,H,ee,ne])}const B4=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:a}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Jv({element:s.current,padding:a}).fn(n):{}:s?Jv({element:s,padding:a}).fn(n):{}}}},U4=(e,t)=>{const n=A4(e);return{name:n.name,fn:n.fn,options:[e,t]}},V4=(e,t)=>{const n=D4(e);return{name:n.name,fn:n.fn,options:[e,t]}},H4=(e,t)=>({fn:I4(e).fn,options:[e,t]}),W4=(e,t)=>{const n=$4(e);return{name:n.name,fn:n.fn,options:[e,t]}},K4=(e,t)=>{const n=L4(e);return{name:n.name,fn:n.fn,options:[e,t]}},q4=(e,t)=>{const n=O4(e);return{name:n.name,fn:n.fn,options:[e,t]}},G4=(e,t)=>{const n=B4(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Y4="Arrow",wS=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...l}=e;return r.jsx(mn.svg,{...l,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});wS.displayName=Y4;var J4=wS;function X4(e){const[t,n]=f.useState(void 0);return lo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const l=a[0];let c,u;if("borderBoxSize"in l){const p=l.borderBoxSize,m=Array.isArray(p)?p[0]:p;c=m.inlineSize,u=m.blockSize}else c=e.offsetWidth,u=e.offsetHeight;n({width:c,height:u})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var zg="Popper",[jS,kS]=Xo(zg),[Q4,SS]=jS(zg),NS=e=>{const{__scopePopper:t,children:n}=e,[s,a]=f.useState(null);return r.jsx(Q4,{scope:t,anchor:s,onAnchorChange:a,children:n})};NS.displayName=zg;var CS="PopperAnchor",ES=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,l=SS(CS,n),c=f.useRef(null),u=Fn(t,c),p=f.useRef(null);return f.useEffect(()=>{const m=p.current;p.current=(s==null?void 0:s.current)||c.current,m!==p.current&&l.onAnchorChange(p.current)}),s?null:r.jsx(mn.div,{...a,ref:u})});ES.displayName=CS;var Bg="PopperContent",[Z4,e$]=jS(Bg),TS=f.forwardRef((e,t)=>{var ae,me,ve,ke,he,Je;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:l="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:x="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:C,...j}=e,w=SS(Bg,n),[k,E]=f.useState(null),N=Fn(t,Ye=>E(Ye)),[P,$]=f.useState(null),T=X4(P),D=(T==null?void 0:T.width)??0,O=(T==null?void 0:T.height)??0,J=s+(l!=="center"?"-"+l:""),V=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},L=Array.isArray(m)?m:[m],W=L.length>0,oe={padding:V,boundary:L.filter(n$),altBoundary:W},{refs:z,floatingStyles:H,placement:ee,isPositioned:ne,middlewareData:M}=z4({strategy:"fixed",placement:J,whileElementsMounted:(...Ye)=>R4(...Ye,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[U4({mainAxis:a+O,alignmentAxis:c}),p&&V4({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?H4():void 0,...oe}),p&&W4({...oe}),K4({...oe,apply:({elements:Ye,rects:ot,availableWidth:Y,availableHeight:Ie})=>{const{width:Se,height:Oe}=ot.reference,Xe=Ye.floating.style;Xe.setProperty("--radix-popper-available-width",`${Y}px`),Xe.setProperty("--radix-popper-available-height",`${Ie}px`),Xe.setProperty("--radix-popper-anchor-width",`${Se}px`),Xe.setProperty("--radix-popper-anchor-height",`${Oe}px`)}}),P&&G4({element:P,padding:u}),r$({arrowWidth:D,arrowHeight:O}),y&&q4({strategy:"referenceHidden",...oe})]}),[q,A]=AS(ee),F=Ko(C);lo(()=>{ne&&(F==null||F())},[ne,F]);const Z=(ae=M.arrow)==null?void 0:ae.x,I=(me=M.arrow)==null?void 0:me.y,ue=((ve=M.arrow)==null?void 0:ve.centerOffset)!==0,[ge,U]=f.useState();return lo(()=>{k&&U(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:ne?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(ke=M.transformOrigin)==null?void 0:ke.x,(he=M.transformOrigin)==null?void 0:he.y].join(" "),...((Je=M.hide)==null?void 0:Je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(Z4,{scope:n,placedSide:q,onArrowChange:$,arrowX:Z,arrowY:I,shouldHideArrow:ue,children:r.jsx(mn.div,{"data-side":q,"data-align":A,...j,ref:N,style:{...j.style,animation:ne?void 0:"none"}})})})});TS.displayName=Bg;var PS="PopperArrow",t$={top:"bottom",right:"left",bottom:"top",left:"right"},RS=f.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,l=e$(PS,s),c=t$[l.placedSide];return r.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:r.jsx(J4,{...a,ref:n,style:{...a.style,display:"block"}})})});RS.displayName=PS;function n$(e){return e!==null}var r$=e=>({name:"transformOrigin",options:e,fn(t){var w,k,E;const{placement:n,rects:s,middlewareData:a}=t,c=((w=a.arrow)==null?void 0:w.centerOffset)!==0,u=c?0:e.arrowWidth,p=c?0:e.arrowHeight,[m,h]=AS(n),x={start:"0%",center:"50%",end:"100%"}[h],y=(((k=a.arrow)==null?void 0:k.x)??0)+u/2,b=(((E=a.arrow)==null?void 0:E.y)??0)+p/2;let C="",j="";return m==="bottom"?(C=c?x:`${y}px`,j=`${-p}px`):m==="top"?(C=c?x:`${y}px`,j=`${s.floating.height+p}px`):m==="right"?(C=`${-p}px`,j=c?x:`${b}px`):m==="left"&&(C=`${s.floating.width+p}px`,j=c?x:`${b}px`),{data:{x:C,y:j}}}});function AS(e){const[t,n="center"]=e.split("-");return[t,n]}var s$=NS,o$=ES,a$=TS,i$=RS,l$=Symbol("radix.slottable");function c$(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=l$,t}var u$=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),d$="VisuallyHidden",DS=f.forwardRef((e,t)=>r.jsx(mn.span,{...e,ref:t,style:{...u$,...e.style}}));DS.displayName=d$;var f$=DS,[Jd]=Xo("Tooltip",[kS]),Xd=kS(),$S="TooltipProvider",p$=700,kh="tooltip.open",[m$,Ug]=Jd($S),LS=e=>{const{__scopeTooltip:t,delayDuration:n=p$,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:l}=e,c=f.useRef(!0),u=f.useRef(!1),p=f.useRef(0);return f.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),r.jsx(m$,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(p.current),c.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:f.useCallback(m=>{u.current=m},[]),disableHoverableContent:a,children:l})};LS.displayName=$S;var Wl="Tooltip",[h$,lc]=Jd(Wl),OS=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:l,disableHoverableContent:c,delayDuration:u}=e,p=Ug(Wl,e.__scopeTooltip),m=Xd(t),[h,x]=f.useState(null),y=ni(),b=f.useRef(0),C=c??p.disableHoverableContent,j=u??p.delayDuration,w=f.useRef(!1),[k,E]=zd({prop:s,defaultProp:a??!1,onChange:D=>{D?(p.onOpen(),document.dispatchEvent(new CustomEvent(kh))):p.onClose(),l==null||l(D)},caller:Wl}),N=f.useMemo(()=>k?w.current?"delayed-open":"instant-open":"closed",[k]),P=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,E(!0)},[E]),$=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),T=f.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,E(!0),b.current=0},j)},[j,E]);return f.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(s$,{...m,children:r.jsx(h$,{scope:t,contentId:y,open:k,stateAttribute:N,trigger:h,onTriggerChange:x,onTriggerEnter:f.useCallback(()=>{p.isOpenDelayedRef.current?T():P()},[p.isOpenDelayedRef,T,P]),onTriggerLeave:f.useCallback(()=>{C?$():(window.clearTimeout(b.current),b.current=0)},[$,C]),onOpen:P,onClose:$,disableHoverableContent:C,children:n})})};OS.displayName=Wl;var Sh="TooltipTrigger",IS=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=lc(Sh,n),l=Ug(Sh,n),c=Xd(n),u=f.useRef(null),p=Fn(t,u,a.onTriggerChange),m=f.useRef(!1),h=f.useRef(!1),x=f.useCallback(()=>m.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),r.jsx(o$,{asChild:!0,...c,children:r.jsx(mn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:p,onPointerMove:qt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!l.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:qt(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:qt(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:qt(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:qt(e.onBlur,a.onClose),onClick:qt(e.onClick,a.onClose)})})});IS.displayName=Sh;var Vg="TooltipPortal",[g$,x$]=Jd(Vg,{forceMount:void 0}),MS=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,l=lc(Vg,t);return r.jsx(g$,{scope:t,forceMount:n,children:r.jsx(Qo,{present:n||l.open,children:r.jsx(gg,{asChild:!0,container:a,children:s})})})};MS.displayName=Vg;var pi="TooltipContent",_S=f.forwardRef((e,t)=>{const n=x$(pi,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...l}=e,c=lc(pi,e.__scopeTooltip);return r.jsx(Qo,{present:s||c.open,children:c.disableHoverableContent?r.jsx(FS,{side:a,...l,ref:t}):r.jsx(y$,{side:a,...l,ref:t})})}),y$=f.forwardRef((e,t)=>{const n=lc(pi,e.__scopeTooltip),s=Ug(pi,e.__scopeTooltip),a=f.useRef(null),l=Fn(t,a),[c,u]=f.useState(null),{trigger:p,onClose:m}=n,h=a.current,{onPointerInTransitChange:x}=s,y=f.useCallback(()=>{u(null),x(!1)},[x]),b=f.useCallback((C,j)=>{const w=C.currentTarget,k={x:C.clientX,y:C.clientY},E=k$(k,w.getBoundingClientRect()),N=S$(k,E),P=N$(j.getBoundingClientRect()),$=E$([...N,...P]);u($),x(!0)},[x]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(p&&h){const C=w=>b(w,h),j=w=>b(w,p);return p.addEventListener("pointerleave",C),h.addEventListener("pointerleave",j),()=>{p.removeEventListener("pointerleave",C),h.removeEventListener("pointerleave",j)}}},[p,h,b,y]),f.useEffect(()=>{if(c){const C=j=>{const w=j.target,k={x:j.clientX,y:j.clientY},E=(p==null?void 0:p.contains(w))||(h==null?void 0:h.contains(w)),N=!C$(k,c);E?y():N&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[p,h,c,m,y]),r.jsx(FS,{...e,ref:l})}),[b$,v$]=Jd(Wl,{isInside:!1}),w$=c$("TooltipContent"),FS=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=e,p=lc(pi,n),m=Xd(n),{onClose:h}=p;return f.useEffect(()=>(document.addEventListener(kh,h),()=>document.removeEventListener(kh,h)),[h]),f.useEffect(()=>{if(p.trigger){const x=y=>{const b=y.target;b!=null&&b.contains(p.trigger)&&h()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[p.trigger,h]),r.jsx(hg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:x=>x.preventDefault(),onDismiss:h,children:r.jsxs(a$,{"data-state":p.stateAttribute,...m,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(w$,{children:s}),r.jsx(b$,{scope:n,isInside:!0,children:r.jsx(f$,{id:p.contentId,role:"tooltip",children:a||s})})]})})});_S.displayName=pi;var zS="TooltipArrow",j$=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=Xd(n);return v$(zS,n).isInside?null:r.jsx(i$,{...a,...s,ref:t})});j$.displayName=zS;function k$(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,s,a,l)){case l:return"left";case a:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function S$(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function N$(e){const{top:t,right:n,bottom:s,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:s},{x:a,y:s}]}function C$(e,t){const{x:n,y:s}=e;let a=!1;for(let l=0,c=t.length-1;l<t.length;c=l++){const u=t[l],p=t[c],m=u.x,h=u.y,x=p.x,y=p.y;h>s!=y>s&&n<(x-m)*(s-h)/(y-h)+m&&(a=!a)}return a}function E$(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),T$(t)}function T$(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const a=e[s];for(;t.length>=2;){const l=t[t.length-1],c=t[t.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const a=e[s];for(;n.length>=2;){const l=n[n.length-1],c=n[n.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var P$=LS,R$=OS,A$=IS,D$=MS,BS=_S;const Wo=P$,Pr=R$,Rr=A$,gr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(D$,{children:r.jsx(BS,{ref:s,sideOffset:t,className:Ce("z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));gr.displayName=BS.displayName;function Hg({items:e,align:t="end"}){const[n,s]=f.useState(!1),[a,l]=f.useState(null),c=f.useRef(null);if(f.useEffect(()=>{if(!n){l(null);return}function p(h){c.current&&!c.current.contains(h.target)&&s(!1)}function m(h){h.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m)}},[n]),e.length===0)return null;function u(p,m){const h=p.icon,x=Ce("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",m&&"pl-8",p.disabled?"opacity-50 cursor-not-allowed":p.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),y=m?p.active?r.jsx($s,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):r.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):h?r.jsx(h,{className:"h-4 w-4 shrink-0"}):null,b=r.jsxs(r.Fragment,{children:[y,r.jsx("span",{className:"block min-w-0 truncate",children:p.label})]});if(p.disabled){const C=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:x,children:b})});return p.disabledReason?r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:C}),r.jsx(gr,{side:"left",children:p.disabledReason})]},p.key):r.jsx("div",{children:C},p.key)}return p.href?r.jsx(Ee,{to:p.href,className:x,onClick:()=>s(!1),children:b},p.key):r.jsx("button",{type:"button",className:x,onClick:()=>{var C;(C=p.onSelect)==null||C.call(p),s(!1)},children:b},p.key)}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsx("button",{type:"button",onClick:()=>s(p=>!p),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(oP,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:Ce("absolute top-full mt-1 z-30 min-w-[220px] rounded-md border border-border/70 bg-background shadow-lg py-1",t==="end"?"right-0":"left-0"),children:r.jsx(Wo,{delayDuration:200,children:e.map(p=>{if(p.submenu&&p.submenu.length>0){const m=p.icon,h=a===p.key;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",className:Ce("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":h,onClick:()=>l(h?null:p.key),children:[m?r.jsx(m,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 flex-1 truncate",children:p.label}),h?r.jsx($r,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(a0,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?p.submenu.map(x=>u(x,!0)):null]},p.key)}return u(p,!1)})})})]})}function Qv(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const $$={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function L$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function O$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function I$(e,t,n=Date.now()){if(!t)return!0;const s=t.field==="created"?e.created??e.updated:e.updated,a=Date.parse(s);if(Number.isNaN(a))return!1;if(t.preset){const u=$$[t.preset];return u===void 0?!0:t.preset.startsWith("older_")?n-a>u:a>=n-u&&a<=n}const l=t.from&&t.from.length>0?t.from:void 0,c=t.to&&t.to.length>0?t.to:void 0;return!l&&!c?!0:!(l&&a<L$(l)||c&&a>O$(c))}function Wg(e,t,n={}){const{workspace:s,search:a,includeArchived:l}=n;if(e.archived===!0&&!l)return!1;const c=tt(t.status),u=tt(t.priority),p=tt(t.type),m=tt(t.assignee),h=tt(t.project),x=tt(t.tags),{activity:y}=t;if(s){if(s==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==s)return!1}if(c.length&&!c.includes(e.status)||u.length&&!u.includes(e.priority)||p.length&&!p.includes(e.type??"")||y==="stale"&&!Qv(e.updated)||y==="fresh"&&Qv(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(C=>C==="__standalone__"?e.projectSlug==null:e.projectSlug===C))return!1;if(x.length){const b=e.tags??[];if(!x.some(C=>b.includes(C)))return!1}if(!I$(e,t.dateRange))return!1;if(a){const b=a.trim().toLowerCase();if(b&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(b))return!1}return!0}function Kl(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const US={statuses:[{id:"pending",label:"Pending"},{id:"in_progress",label:"In Progress"},{id:"blocked",label:"Blocked"},{id:"review",label:"Review"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}],order:["pending","in_progress","blocked","review","completed","failed"],transitions:[],custom:!1};let Rl=null,Fo=null;function M$(){return Rl?Promise.resolve(Rl):Fo||(Fo=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Rl=e,Fo=null,e)).catch(()=>(Fo=null,US)),Fo)}function Zo(){const[e,t]=f.useState(()=>Rl??US);return f.useEffect(()=>{M$().then(t)},[]),e}function Zv(){Rl=null,Fo=null}function cc(e,t){const n=e.statuses.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}const ew={critical:0,high:1,medium:2,low:3};function Ru(e){return Date.parse(e??"")||0}function uc(e,t,n){return[...e].sort((a,l)=>{let c=0;switch(t){case"title":c=a.title.localeCompare(l.title);break;case"status":c=a.status.localeCompare(l.status);break;case"priority":c=(ew[a.priority]??99)-(ew[l.priority]??99);break;case"assignee":c=(a.assignee??"").localeCompare(l.assignee??"");break;case"dependencies":c=a.dependsOn.length-l.dependsOn.length;break;case"created":c=Ru(a.created)-Ru(l.created);break;case"updated":c=Ru(a.updated)-Ru(l.updated);break}return n==="asc"?c:-c})}function St({title:e,description:t,actions:n}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:r.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[r.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?r.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const mi='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Qd({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:a,canDrop:l,onMove:c,getExternalDragData:u,onCardContextMenu:p,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:x,compact:y=!1,dragDisabled:b=!1}){const C=f.useMemo(()=>new Set(h??[]),[h]),j=f.useMemo(()=>e.filter(z=>!C.has(z.id)),[e,C]),w=f.useMemo(()=>e.filter(z=>C.has(z.id)),[e,C]),[k,E]=f.useState(null),[N,P]=f.useState(null),$=f.useRef(null),T=f.useMemo(()=>new Map(t.map(z=>[n(z),z])),[n,t]),D=f.useMemo(()=>j.map(z=>({column:z,items:t.filter(H=>s(H)===z.id)})),[j,s,t]),O=k?T.get(k)??null:null;function J(z){if(!O)return{allowed:!1};const H=s(O);return(l==null?void 0:l({item:O,fromColumnId:H,toColumnId:z}))??{allowed:!0}}function V(){E(null),P(null)}function L(z,H,ee){if(b)return;const ne=(u==null?void 0:u(H))??null;!c&&!ne||(z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",ee),ne&&z.dataTransfer.setData("application/json",JSON.stringify(ne)),c&&E(ee))}function W(z,H,ee){b||!c||!O||!J(H).allowed||(z.preventDefault(),z.dataTransfer.dropEffect="move",P(M=>(M==null?void 0:M.columnId)===H&&M.index===ee?M:{columnId:H,index:ee}))}async function oe(z,H,ee){var F;if(z.preventDefault(),b||!c||!O){V();return}const ne=s(O),q=(((F=D.find(Z=>Z.column.id===ne))==null?void 0:F.items)??[]).findIndex(Z=>n(Z)===n(O));if(!J(H).allowed||q<0){V();return}if(ne===H&&(ee===q||ee===q+1)){V();return}try{await c({item:O,fromColumnId:ne,toColumnId:H,fromIndex:q,toIndex:ee})}finally{V()}}return r.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[w.length>0&&x?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Hidden:"}),w.map(z=>r.jsxs("button",{type:"button",onClick:()=>x(z.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${z.title}" column`,children:[z.title," ×"]},z.id))]}):null,r.jsx("div",{className:Ce("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(200px,240px)]":"auto-cols-[minmax(260px,320px)]"),children:D.map(({column:z,items:H})=>{const ee=J(z.id),ne=(N==null?void 0:N.columnId)===z.id;return r.jsxs("section",{className:Ce("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",y?"min-h-[200px] p-2":"min-h-[320px] p-3",O&&!ee.allowed?"border-dashed opacity-65":"",O&&ee.allowed?"border-primary/30 bg-accent/30":"",ne?"ring-2 ring-ring/30":""),title:O&&!ee.allowed?ee.reason:void 0,children:[r.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:Ce("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:z.title}),z.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:z.description}):null]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs font-semibold text-foreground",children:H.length}),x?r.jsx("button",{type:"button",onClick:()=>x(z.id),className:"rounded-full border border-transparent px-1.5 py-0.5 text-xs text-muted-foreground hover:border-border hover:text-foreground",title:`Hide "${z.title}" column`,"aria-label":`Hide column ${z.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:M=>W(M,z.id,H.length),onDrop:M=>oe(M,z.id,H.length),children:[H.length===0?b?r.jsx("div",{className:"flex min-h-[128px] items-center justify-center rounded-lg border border-border/60 bg-background/50 px-4 text-center text-sm text-muted-foreground",children:typeof m=="function"?m(z):m}):r.jsx(_$,{active:(N==null?void 0:N.columnId)===z.id&&N.index===0,disabled:!!O&&!ee.allowed,children:typeof m=="function"?m(z):m}):null,H.map((M,q)=>{const A=n(M),F=k===A;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:Ce("h-2 rounded-full transition",(N==null?void 0:N.columnId)===z.id&&N.index===q?"bg-primary/70":"bg-transparent"),onDragOver:Z=>W(Z,z.id,q),onDrop:Z=>oe(Z,z.id,q)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:Z=>{$.current=Z.target},onDragStart:Z=>{const I=$.current;if(I!=null&&I.closest(mi)){Z.preventDefault();return}L(Z,M,A)},onDragEnd:V,onContextMenu:Z=>{if(!p)return;const I=Z.target;I!=null&&I.closest(mi)||p(M,Z)},className:Ce("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",F?"scale-[0.98] opacity-50":""),children:a(M,{dragging:F})})]},A)}),H.length>0&&!b?r.jsx("div",{className:Ce("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(N==null?void 0:N.columnId)===z.id&&N.index===H.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",O&&!ee.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},z.id)})})]})}function _$({active:e,disabled:t,children:n}){return r.jsx("div",{className:Ce("flex min-h-[128px] items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground transition",e?"border-primary/60 bg-primary/10 text-foreground":"border-border/60 bg-background/50",t?"opacity-45":""),children:n})}const El="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Pm="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",F$="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",z$="border-status-review-foreground/30 bg-status-review text-status-review-foreground",B$="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",U$="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",V$="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",md={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:El,icon:bi},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:El,icon:eP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:El,icon:l0},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Pm,icon:yP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Pm,icon:rg},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:F$,icon:lh},review:{label:"Review",description:"Ready for inspection or approval.",className:z$,icon:wP},completed:{label:"Completed",description:"Finished successfully.",className:B$,icon:Zh},failed:{label:"Failed",description:"Could not be completed as planned.",className:U$,icon:lh},active:{label:"Active",description:"The project has active or review work in flight.",className:Pm,icon:ch},stopped:{label:"Stopped",description:"Session ended without completing.",className:El,icon:QT},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:V$,icon:ch}};function hd(e){const t=md[e];return t||{className:El,icon:ch,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function VS(e,t){return Ce("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-medium tracking-normal","shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0)] dark:shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0.04)]",hd(e).className,t)}function pn({status:e,className:t,showIcon:n=!0,progress:s}){const a=hd(e),l=a.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,p=c?`${a.description} (${s.checked}/${s.total} criteria)`:a.description,m=n?c?r.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 items-center justify-center",children:[r.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*7,strokeDashoffset:2*Math.PI*7*(1-u)})]}),r.jsx(l,{className:"h-2.5 w-2.5"})]}):r.jsx(l,{className:"h-3.5 w-3.5"}):null;return r.jsxs("span",{title:p,className:VS(e,t),children:[m,r.jsx("span",{children:a.label})]})}function Zd(e){var t;return((t=md[e])==null?void 0:t.description)??`Status: ${e}`}const HS={definitions:[{id:"feature",label:"Feature"},{id:"bug",label:"Bug"},{id:"refactor",label:"Refactor"},{id:"research",label:"Research"},{id:"chore",label:"Chore"}],default:"feature",custom:!1};let Yu=null,za=null;function H$(){return Yu?Promise.resolve(Yu):za||(za=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Yu=e,za=null,e)).catch(()=>(za=null,HS)),za)}function ef(){const[e,t]=f.useState(()=>Yu??HS);return f.useEffect(()=>{H$().then(t)},[]),e}function ii(e,t){if(!t)return"—";const n=e.definitions.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function W$(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function ea({type:e,className:t,compact:n=!1}){const s=ef();if(!e)return null;const a=W$(s,e),l=(a==null?void 0:a.label)??e.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()),c=a!=null&&a.color?{backgroundColor:`color-mix(in oklch, ${a.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${a.color} 50%, transparent)`,color:a.color}:void 0;return r.jsx("span",{title:(a==null?void 0:a.description)??`Type: ${l}`,style:c,className:Ce("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!c&&"border-border/60 text-muted-foreground",t),children:l})}function Dr({value:e,label:t,disabled:n=!1,disabledReason:s,onError:a}){const[l,c]=f.useState(!1);async function u(){if(!n)try{if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch(p){a==null||a(p instanceof Error?p:new Error(String(p)))}}return n?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:s??"Copy unavailable","aria-label":t??"Copy",children:r.jsx(rd,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:u,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded",title:l?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:l?r.jsx($s,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(rd,{className:"h-3 w-3","aria-hidden":"true"})})}function K$(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function q$({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:a,compact:l=!1}){const c=Zo(),[u,p]=f.useState(()=>new Set(a.collapsed));f.useEffect(()=>{p(new Set(a.collapsed))},[a]);const m=h=>{p(x=>{const y=new Set(x);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:Ce("space-y-2",l?"space-y-1.5":"space-y-3"),children:t.map(h=>{const x=uc(e.filter(C=>C.status===h),n,s);if(x.length===0)return null;const y=!u.has(h),b=cc(c,h);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[r.jsxs("button",{type:"button",onClick:()=>m(h),className:Ce("flex w-full items-center gap-2 text-left",l?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[r.jsx($r,{className:Ce("text-muted-foreground transition-transform",l?"h-3.5 w-3.5":"h-4 w-4",y?"":"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:b}),r.jsx("span",{className:Ce("rounded-full border border-border/60 text-muted-foreground",l?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:x.length})]}),y&&r.jsx("ul",{className:Ce("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:x.map(C=>{const j=K$(C);return r.jsx("li",{children:r.jsxs(Ee,{to:j,className:Ce("flex items-center gap-3 hover:bg-muted/40",l?"px-3 py-1.5":"px-4 py-2.5"),children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:C.title}),C.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:C.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:Dn(C.updated)})]})},`${C.projectSlug??"standalone"}:${C.id}`)})})]},h)})})}function G$(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function Y$({items:e,sortField:t,sortDirection:n,tableColumnVisibility:s,compact:a=!1}){const l=new Set(s.hidden);l.delete("title");const c=h=>!l.has(h),u=uc(e,t,n),p=a?"py-2 pr-3":"py-3 pr-4",m=a?"text-xs":"text-sm";return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:Ce("w-full text-left",m),children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[c("title")?r.jsx("th",{className:Ce("font-medium",p),children:"Assignment"}):null,c("status")?r.jsx("th",{className:Ce("font-medium",p),children:"Status"}):null,c("priority")?r.jsx("th",{className:Ce("font-medium",p),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:Ce("font-medium",p),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:Ce("font-medium",p),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:Ce("font-medium",p),children:"Created"}):null,c("updated")?r.jsx("th",{className:Ce("font-medium",p),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const x=G$(h),y=`${h.projectSlug??"standalone"}:${h.id}`;return r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[c("title")?r.jsxs("td",{className:p,children:[r.jsx(Ee,{to:x,className:"font-semibold text-foreground hover:text-primary",children:h.title}),h.projectTitle?r.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:h.projectTitle}):null]}):null,c("status")?r.jsx("td",{className:p,children:r.jsx(pn,{status:h.status})}):null,c("priority")?r.jsx("td",{className:Ce("capitalize text-muted-foreground",p),children:h.priority}):null,c("assignee")?r.jsx("td",{className:Ce("text-muted-foreground",p),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:Ce("text-muted-foreground",p),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:Ce("text-muted-foreground",p),children:Dn(h.created)}):null,c("updated")?r.jsx("td",{className:Ce("text-muted-foreground",p),children:Dn(h.updated)}):null]},y)})})]})})}function J$(e,t,n){return e.filter(s=>Wg(s,t,{workspace:n,search:t.search}))}function WS({view:e,compact:t,emptyDescription:n}){const{data:s,loading:a,error:l}=Md(),c=Zo(),u=f.useMemo(()=>c.order.map(m=>({id:m,title:cc(c,m),description:Zd(m)})),[c]),p=f.useMemo(()=>{if(!s)return[];const m=J$(s.assignments,e.config.filters,e.workspace);return uc(m,e.config.sortField,e.config.sortDirection)},[s,e]);if(a&&!s)return r.jsx(mt,{label:"Loading assignments…"});if(l)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l})]});if(p.length===0)return r.jsx(St,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return r.jsx(Qd,{compact:t,dragDisabled:!0,columns:u,items:p,getItemId:m=>m.slug||m.id,getColumnId:m=>m.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:m=>t?r.jsx(X$,{item:m}):r.jsx(Q$,{item:m})});case"list":return r.jsx(q$,{items:p,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(Y$,{items:p,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function X$({item:e}){const t=Kl(e);return r.jsxs("div",{className:Ce("rounded-md border border-border/60 bg-background/85 p-2 shadow-sm"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(pn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:Dn(e.updated)})]}),e.id?r.jsxs("p",{className:"mt-1 inline-flex items-center gap-1 font-mono text-[10px] text-muted-foreground/70",children:[e.id.slice(0,8),r.jsx(Dr,{value:e.id})]}):null]})}function Q$({item:e}){const t=Kl(e);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(pn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(ea,{type:e.type,compact:!0}),r.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:Dn(e.updated)})]})]})}function Z$({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:a,refetch:l}=Go(e);return s?r.jsx(mt,{label:"Loading view…"}):a?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:a.message}),r.jsx("button",{type:"button",onClick:()=>l(),className:"shell-action mt-3",children:"Retry"})]}):n?r.jsx(WS,{view:n,compact:!0,emptyDescription:"Adjust the view's filters to surface different work, or pick another widget for this slot."}):r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"View no longer exists"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The saved view this slot was bound to has been deleted."}),r.jsx("button",{type:"button",onClick:t,className:"shell-action mt-3",children:"Pick another widget"})]})}function eL({sessions:e}){return r.jsxs("aside",{"aria-labelledby":"overview-sessions-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsx("header",{className:"border-b border-border/40 px-4 py-3",children:r.jsx("h3",{id:"overview-sessions-title",className:"text-sm font-semibold text-foreground",children:"Recent Sessions"})}),e.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:Ho.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:Ho.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(tL,{session:t})},t.sessionId))})]})}function tL({session:e}){const t=ln(),[n,s]=f.useState(!1),a=nL(e,t),l=rL(e),c=!e.path;return r.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:a,className:"block text-sm font-medium text-foreground hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:e.agent}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l," · ",k0(e.started)]}),n&&e.path?r.jsxs("div",{className:"mt-1 space-y-0.5",children:[r.jsx("code",{className:"block w-full select-all rounded bg-muted/40 px-1.5 py-0.5 text-xs text-foreground",children:e.path}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:Ho.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(Dr,{value:e.path,label:Ho.recentSessionsCopyPathLabel,disabled:c,disabledReason:Ho.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function nL(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function rL(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}function sL(){const{data:e,loading:t,error:n}=z0();return t&&!e?r.jsx(mt,{label:"Loading sessions…"}):n?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]}):r.jsx(eL,{sessions:(e==null?void 0:e.sessions)??[]})}const oL=5;function aL(){const{data:e,loading:t,error:n}=F0();if(t&&!e)return r.jsx(mt,{label:"Loading inventories…"});if(n)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load inventories"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]});const a=((e==null?void 0:e.inventories)??[]).slice(0,oL);return r.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[r.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),r.jsx(Ee,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),a.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:a.map(l=>{const c=l.inventory,u=l.active_leases.length,p=l.members.length,m=c.display_name??c.slug;return r.jsx("li",{children:r.jsxs(Ee,{to:`/inventories/${encodeURIComponent(c.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:m}),r.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[u,"/",p," leased"]})]})},c.slug)})})]})}const KS={"saved-view":{title:"Saved view",icon:d0,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(Z$,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Ad,render:()=>f.createElement(sL)},inventories:{title:"Inventories",icon:Ld,render:()=>f.createElement(aL)}},iL={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},lL={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function cL({slot:e,onReplace:t,onRemove:n,onResize:s}){const a=e.size??"small",l=iL[a];if(e.widget===null)return r.jsx("div",{className:Ce("flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-card/40 p-3 shadow-sm",l),children:r.jsxs("button",{type:"button",onClick:t,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(rn,{className:"h-4 w-4"}),"Add widget"]})});const c=KS[e.widget.kind];if(!c)return r.jsx("div",{className:Ce("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",l),children:r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})});const u=c.icon;return r.jsxs("div",{className:Ce("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",l),children:[r.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[r.jsx(u,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(uL,{slot:e,fallback:c.title})})]}),r.jsx(Hg,{items:[{key:"replace",label:"Replace…",icon:bP,onSelect:t},{key:"size",label:"Size",icon:hP,submenu:MD.map(p=>({key:`size-${p}`,label:lL[p],active:p===a,onSelect:()=>s(p)}))},{key:"remove",label:"Remove",icon:or,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:c.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function uL({slot:e,fallback:t}){var a,l;const n=((a=e.widget)==null?void 0:a.kind)==="saved-view"?e.widget.viewId:null,{view:s}=Go(n);return((l=e.widget)==null?void 0:l.kind)==="saved-view"&&s?r.jsx(r.Fragment,{children:s.name}):r.jsx(r.Fragment,{children:t})}const dL=["agent-sessions","inventories"];function fL({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:a}=Vd();function l(c){n(c),t(!1)}return r.jsx(ar,{open:e,onOpenChange:t,children:r.jsxs(Kn,{className:"max-w-xl",children:[r.jsxs(Qr,{children:[r.jsx(qn,{children:"Add a widget"}),r.jsx(hs,{children:"Choose a built-in widget or one of your saved views."})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:dL.map(c=>{const u=KS[c],p=u.icon;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:c}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx(p,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsx("span",{className:"font-medium text-foreground",children:u.title})]})},c)})})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),a?r.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):s.length===0?r.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",r.jsx(Ee,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):r.jsx("ul",{className:"max-h-72 divide-y divide-border/40 overflow-auto rounded-md border border-border/60",children:s.map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:"saved-view",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${c.workspace}`,children:c.workspace}):null,r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:c.config.viewMode})]})},c.id))}),!a&&s.some(c=>c.workspace!==null)?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}function pL(){const{data:e,error:t,refetch:n}=xR(),{data:s}=I0(),{layout:a}=UD(),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);mo("list:overview"),Ht({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const x=f.useCallback(k=>{p(k),c(!0)},[]),y=f.useCallback(async k=>{h(null);try{await HD(k)}catch(E){h(E instanceof Error?E.message:String(E))}},[]),b=f.useCallback(k=>{if(u===null)return;const E=a.slots.map((N,P)=>P===u?{...N,widget:k}:N);p(null),y(E)},[a.slots,u,y]),C=f.useCallback(k=>{const E=a.slots.map((N,P)=>P===k?{...N,widget:null}:N);y(E)},[a.slots,y]),j=f.useCallback((k,E)=>{const N=a.slots.map((P,$)=>$===k?{...P,size:E}:P);y(N)},[a.slots,y]),w={};if(e)for(const k of Object.keys(e.segments))for(const E of e.segments[k].items)w[E.id]=E;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("header",{className:"space-y-2",children:[r.jsx("p",{className:"eyebrow",children:"Workspace Overview"}),r.jsx("h1",{className:"text-4xl font-semibold tracking-display text-foreground md:text-5xl",children:"What needs you today"})]}),e?r.jsx(TD,{hero:e.hero,itemsById:w}):t?r.jsx(wt,{error:t}):r.jsx(mt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(CD,{help:s}):null,m?r.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Couldn't save dashboard layout: ",m]}):null,r.jsx("div",{className:"grid grid-flow-dense grid-cols-1 gap-4 xl:grid-cols-2",children:a.slots.map((k,E)=>r.jsx(cL,{slot:k,index:E,onReplace:()=>x(E),onRemove:()=>C(E),onResize:N=>j(E,N)},k.id))}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(sg,{className:"h-3 w-3","aria-hidden":"true"}),r.jsxs("span",{children:["● ",e.serverStats.totalPorts," ports ·"," ",e.serverStats.deadSessions>0?`${e.serverStats.deadSessions} dead`:"all healthy"]})]}):null,r.jsx(fL,{open:l,onOpenChange:k=>{c(k),k||p(null)},onSelect:b})]})}function mL({term:e,description:t}){return r.jsx("span",{title:t,className:"cursor-help rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-foreground underline decoration-dotted underline-offset-4",children:e})}function hL(){const{data:e,loading:t,error:n}=I0(),{openCheatsheet:s}=po();return t?r.jsx(mt,{label:"Loading help…"}):n||!e?r.jsx(wt,{error:n||"Help content is unavailable."}):r.jsxs("div",{className:"space-y-5",children:[r.jsx(We,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center gap-2 rounded-md border border-border/70 bg-background/80 px-3 py-1.5 text-sm font-medium text-foreground hover:bg-accent",children:"Open shortcuts cheatsheet"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",us("Mod+k")," opens the command palette."]})]})}),r.jsx(We,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:r.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(a=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:a},a))})}),r.jsx(We,{title:"Getting Started",children:r.jsx("div",{className:"space-y-3",children:e.workflow.map((a,l)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:a.detail}),a.command?r.jsx(qu,{command:a.command.command,description:a.command.description,example:a.command.example}):null,a.href?r.jsx(Ee,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(We,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(a=>r.jsx(mL,{term:a.term,description:a.description},a.term))}),r.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.term}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description})]},a.term))})]}),r.jsx(We,{title:"Status Guide",children:r.jsx("div",{className:"space-y-3",children:e.statusGuide.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(pn,{status:a.status}),r.jsx("p",{className:"font-semibold text-foreground",children:a.meaning})]}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:a.useWhen})]},a.status))})})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(We,{title:"Ownership And File Rules",children:r.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.label}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:a.files.map(l=>r.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:l},l))})]},a.label))})}),r.jsx(We,{title:"How To Navigate The Dashboard",children:r.jsx("div",{className:"space-y-3",children:e.navigation.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.label}),r.jsx(Ee,{className:"text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open"})]}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description})]},a.label))})})]}),r.jsx(We,{title:"CLI Quick Reference",children:r.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(a=>r.jsx(qu,{command:a.command,description:a.description,example:a.example},a.command))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(We,{title:"FAQ",children:r.jsx("div",{className:"space-y-3",children:e.faq.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.question}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.answer})]},a.question))})}),r.jsx(We,{title:"First Project Checklist",children:r.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((a,l)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:a.detail}),a.command?r.jsx(qu,{command:a.command.command,example:a.command.example}):null,a.href?r.jsx(Ee,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})})]})]})}function Kg({children:e}){return r.jsx("div",{className:"chrome-card flex flex-col gap-2 !p-2.5 md:flex-row md:flex-wrap md:items-center",children:e})}const tf=f.forwardRef(({value:e,onChange:t,placeholder:n="Search"},s)=>r.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[r.jsx(fo,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:a=>t(a.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));tf.displayName="SearchInput";function nf({value:e,options:t,onChange:n}){return r.jsx("div",{className:"inline-flex rounded-md border border-border/60 bg-background/80 p-1",children:t.map(s=>r.jsx("button",{type:"button","aria-pressed":e===s.value,onClick:()=>n(s.value),className:Ce("rounded-sm px-2.5 py-1.5 text-sm font-medium transition",e===s.value?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:s.label},s.value))})}const gL={completed:"bg-status-completed-foreground",in_progress:"bg-status-in-progress-foreground",review:"bg-status-review-foreground",blocked:"bg-status-blocked-foreground",failed:"bg-status-failed-foreground",pending:"bg-status-pending-foreground"},tw=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function gd({progress:e,className:t,showLegend:n=!1}){const s=Zo(),a=f.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(p=>p!=="total")).map(p=>({key:p,className:gL[p]??tw[c++%tw.length]}))},[s.order,e]),l=a.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:Ce("space-y-2",t),children:[r.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?r.jsx("div",{className:"h-full w-full bg-muted"}):l.map(c=>r.jsx("div",{className:c.className,style:{width:`${(e[c.key]??0)/e.total*100}%`},title:`${yn(c.key)}: ${e[c.key]??0}`},c.key))}),n?r.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:a.map(c=>r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[r.jsx("span",{className:Ce("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:yn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const xL=["pending","active","blocked","failed","completed"],qg=xL,yL=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function qS(e){return e&&e.length>0?e:[...yL]}function bL(e,t,n){if(t<0||t>=e.length)return e;const s=[...e],[a]=s.splice(t,1),l=t<n?n-1:n;return s.splice(Math.max(0,Math.min(l,s.length)),0,a),s}const vL=220,Au=8;function GS({anchor:e,items:t,onClose:n}){const s=f.useRef(null),[a,l]=f.useState(null);return f.useLayoutEffect(()=>{if(!e){l(null);return}const c=s.current,u=(c==null?void 0:c.offsetWidth)??vL,p=(c==null?void 0:c.offsetHeight)??0,m=Math.max(Au,window.innerWidth-u-Au),h=Math.max(Au,window.innerHeight-p-Au);l({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),f.useEffect(()=>{if(!e)return;function c(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function p(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),document.addEventListener("contextmenu",c),window.addEventListener("scroll",p,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",c),window.removeEventListener("scroll",p,!0)}},[e,n]),!e||t.length===0?null:r.jsx("div",{ref:s,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(a==null?void 0:a.left)??e.x,top:(a==null?void 0:a.top)??e.y,visibility:a?"visible":"hidden"},children:r.jsx(Wo,{delayDuration:200,children:t.map(c=>{const u=c.icon,p=Ce("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",c.disabled?"cursor-not-allowed opacity-50":c.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),m=r.jsxs(r.Fragment,{children:[u?r.jsx(u,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 truncate",children:c.label})]});if(c.disabled){const h=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:p,children:m})});return c.disabledReason?r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:h}),r.jsx(gr,{side:"left",children:c.disabledReason})]},c.key):r.jsx("div",{children:h},c.key)}return c.href?r.jsx(Ee,{to:c.href,className:p,onClick:()=>n(),children:m},c.key):r.jsx("button",{type:"button",className:p,onClick:()=>{var h;(h=c.onSelect)==null||h.call(c),n()},children:m},c.key)})})})}const wL="__ungrouped__";function Gg({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:s,title:a="Move to workspace",description:l="Pick the workspace this item should belong to."}){const{data:c,loading:u}=oc(),[p,m]=f.useState(n),[h,x]=f.useState(!1),[y,b]=f.useState(null);f.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const C=f.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:wL,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function w(){if(j){x(!0),b(null);try{await s(p),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{x(!1)}}}return r.jsx(ar,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(Kn,{children:[r.jsxs(Qr,{children:[r.jsx(qn,{children:a}),r.jsx(hs,{children:l})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:u&&C.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(rg,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):C.map(k=>{const E=k.value===n,N=k.value===p;return r.jsxs("button",{type:"button",disabled:E||h,onClick:()=>m(k.value),className:Ce("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",E?"cursor-not-allowed bg-foreground/5 text-muted-foreground":N?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:Ce("block min-w-0 truncate",k.value===null?"italic text-muted-foreground":""),children:[k.label,E?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),N?r.jsx($s,{className:"h-4 w-4 text-foreground"}):null]},k.key)})}),y?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:y}):null,r.jsxs(Ls,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),disabled:h,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:w,disabled:!j,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function nw(){const{workspace:e}=$t(),t=ln(),n=Dt(),{data:s,loading:a,error:l,refetch:c}=Jo(),u=f.useRef(null);mo("list:projects");const[p,m]=f.useState(""),[h,x]=f.useState("all"),[y,b]=f.useState("all"),[C,j]=f.useState("updated"),[w,k]=ms(),E=w.get("view"),N=E==="table"||E==="kanban"?E:"cards",P=M=>{k(q=>{const A=new URLSearchParams(q);return M==="cards"?A.delete("view"):A.set("view",M),A})},[$,T]=f.useState({}),[D,O]=f.useState(null),[J,V]=f.useState(null),L=f.useMemo(()=>s?s.filter(M=>{if(e){if(e==="_ungrouped"){if(M.workspace!==null)return!1}else if(M.workspace!==e)return!1}return h!=="all"&&M.status!==h||y!=="all"&&!M.tags.includes(y)?!1:p.trim()?`${M.title} ${M.tags.join(" ")} ${M.slug}`.toLowerCase().includes(p.toLowerCase()):!0}).sort((M,q)=>SL(M,q,C)):[],[s,p,h,y,C,e]),W=L.map(M=>`${M.slug}:${M.status}`).join("|");f.useEffect(()=>{T(NL(L))},[W,C]);const oe=f.useMemo(()=>{const M=new Map(L.map(q=>[q.slug,q]));return qg.flatMap(q=>($[q]??L.filter(F=>F.status===q).map(F=>F.slug)).map(F=>M.get(F)).filter(F=>!!F))},[L,$]),{visibleItems:z,visibleIndexByKey:H}=f.useMemo(()=>{const M=N==="kanban"?oe:L,q=new Map;return M.forEach((A,F)=>q.set(A.slug,F)),{visibleItems:M,visibleIndexByKey:q}},[N,L,oe]),{hotkeyRowProps:ee}=ac(z,{scope:"list:projects",onOpen:M=>n(`${t}/projects/${M.slug}`)});if(Ht({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var M;return(M=u.current)==null?void 0:M.focus()}}),Ht({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),a)return r.jsx(mt,{label:"Loading projects…"});if(l||!s)return r.jsx(wt,{error:l||"Project list is unavailable."});const ne=Array.from(new Set(s.flatMap(M=>M.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(Kg,{children:[r.jsx(tf,{ref:u,value:p,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:M=>x(M.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All statuses"}),r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"failed",children:"Failed"}),r.jsx("option",{value:"completed",children:"Completed"})]}),r.jsxs("select",{value:y,onChange:M=>b(M.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),ne.map(M=>r.jsx("option",{value:M,children:M},M))]}),r.jsxs("select",{value:C,onChange:M=>j(M.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"updated",children:"Sort: Updated"}),r.jsx("option",{value:"created",children:"Sort: Created"}),r.jsx("option",{value:"title",children:"Sort: Title"}),r.jsx("option",{value:"attention",children:"Sort: Attention"})]}),r.jsx(nf,{value:N,onChange:M=>P(M),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),L.length===0?s.length===0?r.jsxs("div",{className:"rounded-frame border border-border/60 bg-card px-6 py-16 text-center",children:[r.jsx("p",{className:"eyebrow mx-auto justify-center",children:"Start here"}),r.jsx("h2",{className:"mx-auto mt-4 max-w-2xl text-3xl font-semibold tracking-display text-foreground md:text-4xl",children:"The task manager built for agents, by agents"}),r.jsx("p",{className:"mx-auto mt-3 max-w-xl text-sm leading-6 text-muted-foreground",children:"A project groups assignments, resources, and memories under one objective. Markdown stays authoritative — the dashboard is just a view."}),r.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[r.jsx(Ee,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),r.jsx(Ee,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):r.jsx(St,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Ee,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):N==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:L.map((M,q)=>r.jsxs(Ee,{to:`${t}/projects/${M.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...ee(q),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:M.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Dn(M.updated)]})]}),r.jsx(pn,{status:M.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(gd,{progress:M.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:M.tags.map(A=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:A},A))}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:M.needsAttention.blockedCount+M.needsAttention.failedCount})]}),r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Assignments"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:M.progress.total})]})]})]})]},M.slug))}):N==="table"?r.jsx(We,{title:`${L.length} project${L.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"pb-3 font-medium",children:"Project"}),r.jsx("th",{className:"pb-3 font-medium",children:"Status"}),r.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),r.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),r.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:L.map((M,q)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...ee(q),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ee,{to:`${t}/projects/${M.slug}`,className:"font-semibold text-foreground hover:text-primary",children:M.title}),r.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:M.tags.map(A=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:A},A))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(pn,{status:M.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(gd,{progress:M.progress})})}),r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:M.needsAttention.blockedCount+M.needsAttention.failedCount}),r.jsx("td",{className:"py-4 text-muted-foreground",children:Dn(M.updated)})]},M.slug))})]})})}):r.jsx(Qd,{columns:kL,items:oe,getItemId:M=>M.slug,getColumnId:M=>M.status,canDrop:({fromColumnId:M,toColumnId:q})=>({allowed:!0,reason:M===q?void 0:"This will set a manual status override on the project."}),onMove:({item:M,fromColumnId:q,toColumnId:A,fromIndex:F,toIndex:Z})=>{if(q===A){const I=$[q]??L.filter(ue=>ue.status===q).map(ue=>ue.slug);T(ue=>({...ue,[q]:bL(I,F,Z)}));return}fetch(`/api/projects/${M.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:A})}).then(()=>{window.location.reload()})},getExternalDragData:M=>({type:"project",id:M.slug}),onCardContextMenu:(M,q)=>{q.preventDefault(),O({project:M,anchor:{x:q.clientX,y:q.clientY}})},emptyMessage:M=>`No ${M.title.toLowerCase()} projects.`,renderCard:(M,{dragging:q})=>{const A=H.get(M.slug)??-1;return r.jsx("div",{...A>=0?ee(A):{},children:r.jsx(CL,{project:M,dragging:q})})}}),r.jsx(GS,{anchor:(D==null?void 0:D.anchor)??null,items:D?[{key:"edit",label:"Edit",icon:bi,onSelect:()=>n(`${t}/projects/${D.project.slug}`)},{key:"move",label:"Move to workspace…",icon:$d,onSelect:()=>V(D.project)}]:[],onClose:()=>O(null)}),r.jsx(Gg,{open:J!==null,onOpenChange:M=>{M||V(null)},currentWorkspace:(J==null?void 0:J.workspace)??null,title:"Move project to workspace",onSubmit:async M=>{if(!J)return;const q=await fetch(`/api/projects/${encodeURIComponent(J.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:M})});if(!q.ok){const A=await q.json().catch(()=>({}));throw new Error(A.error||"Failed to move project")}c()}}),r.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(ng,{className:"mt-0.5 h-4 w-4"}),r.jsxs("p",{children:["Project status is derived from assignment state by default.",N==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const jL={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},kL=qg.map(e=>({id:e,title:jL[e],description:Zd(e)}));function SL(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return rw(t)-rw(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function rw(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function NL(e){return Object.fromEntries(qg.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function CL({project:e,dragging:t}){const n=ln();return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Ee,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Dn(e.updated)]})]}),r.jsx(pn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(gd,{progress:e.progress})}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.tags.map(s=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:s},s)),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.progress.total," assignments"]}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.needsAttention.blockedCount+e.needsAttention.failedCount," needs attention"]})]}),r.jsx("div",{className:"mt-4 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:t?"Reordering within status":"Derived project lane"})]})}function xd({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:Ce("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",s),children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?r.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}const EL=4e3;function ta(){const[e,t]=f.useState(null),n=f.useRef(null),s=f.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),a=f.useCallback((l,c="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:l,kind:c}),n.current=setTimeout(()=>{t(null),n.current=null},EL)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:a,dismissToast:s}}function na({toast:e,onDismiss:t}){if(!e)return null;const n=e.kind==="error";return r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-50 flex max-w-sm",role:"status","aria-live":"polite",children:r.jsx("button",{type:"button",onClick:t,className:Ce("syntaur-toast pointer-events-auto rounded-md border px-4 py-3 text-sm font-medium shadow-lg transition",n?"border-error-foreground/30 bg-error text-error-foreground hover:opacity-90":"border-success-foreground/30 bg-success text-success-foreground hover:opacity-90"),children:e.message},e.id)})}function TL(){return r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-status-archived-foreground/30 bg-status-archived px-2 py-0.5 text-xs font-medium text-status-archived-foreground",children:[r.jsx(Dd,{className:"h-3 w-3"}),"Archived"]})}function sw(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function PL(){const{data:e,loading:t,error:n,refetch:s}=yR(),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState({}),{toast:h,showToast:x,dismissToast:y}=ta();async function b(N,P,$){l(P),u(null);try{const T=await fetch(N,{method:"POST",headers:{"Content-Type":"application/json"}});if(!T.ok){const D=await T.json().catch(()=>null);throw new Error((D==null?void 0:D.error)||`HTTP ${T.status}`)}s(),x($,"success")}catch(T){u(T instanceof Error?T.message:"Restore failed")}finally{l(null)}}function C(N){return b(`/api/projects/${N.slug}/unarchive`,`project:${N.slug}`,"Project restored")}function j(N){const P=N.projectSlug?`/api/projects/${N.projectSlug}/assignments/${N.slug}/unarchive`:`/api/assignments/${N.id}/unarchive`;return b(P,`assignment:${N.id}`,"Assignment restored")}if(t)return r.jsx(mt,{label:"Loading archived content…"});if(n)return r.jsx(wt,{error:n});const w=(e==null?void 0:e.projects)??[],k=(e==null?void 0:e.assignments)??[],E=w.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(na,{toast:h,onDismiss:y}),r.jsx(xd,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),c?r.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:c}):null,E?r.jsx(St,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[w.length>0&&r.jsx(We,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:r.jsx("ul",{className:"divide-y divide-border",children:w.map(N=>{const P=p[N.slug]??!1;return r.jsxs("li",{className:"py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>m($=>({...$,[N.slug]:!P})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":P,children:[P?r.jsx($r,{className:"h-4 w-4"}):r.jsx(a0,{className:"h-4 w-4"}),r.jsx(eg,{className:"h-4 w-4 text-muted-foreground"}),N.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",N.assignments.length," assignment",N.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",N.archivedAt?Lr(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Ee,{to:`/projects/${N.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),r.jsxs("button",{type:"button",onClick:()=>C(N),disabled:a===`project:${N.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(ed,{className:"h-3 w-3"}),"Restore"]})]})]}),P&&N.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:N.assignments.map($=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ee,{to:sw($),className:"text-foreground hover:text-foreground/80",children:$.title}),r.jsx(pn,{status:$.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:$.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},$.id))})]},N.slug)})})}),k.length>0&&r.jsx(We,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:r.jsx("ul",{className:"divide-y divide-border",children:k.map(N=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Ee,{to:sw(N),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:N.title}),r.jsx(pn,{status:N.status,showIcon:!1}),r.jsx(TL,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.projectTitle??"Standalone"," · Archived"," ",N.archivedAt?Lr(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>j(N),disabled:a===`assignment:${N.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(ed,{className:"h-3 w-3"}),"Restore"]})]},N.id))})})]})]})}const ow="inline-flex max-w-[14rem] items-center gap-1 whitespace-nowrap rounded-full border px-2 py-0.5 text-[11px] font-semibold tracking-wide border-border/60 text-muted-foreground",aw="block min-w-0 truncate";function Yg({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:Ce("flex flex-wrap items-center gap-1.5",t),children:e.map((n,s)=>{const a=`${n.system}:${n.id}`,l=`${n.system}:${n.id}:${s}`;return n.url!=null&&n.url.length>0?r.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:Ce(ow,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${a} in ${n.system}`,children:[r.jsx("span",{className:aw,children:a}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:ow,title:a,children:r.jsx("span",{className:aw,children:a})},l)})})}const RL={default:"chrome-card",info:"rounded-lg border border-primary/30 bg-primary/5 p-3 dark:border-primary/40 dark:bg-primary/10",warn:"rounded-lg border border-warning-foreground/30 bg-warning p-3",danger:"rounded-lg border border-error-foreground/30 bg-error p-3",success:"rounded-lg border border-success-foreground/30 bg-success p-3"};function An({label:e,value:t,description:n,icon:s,tone:a="default",to:l}){const c=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),r.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),s?r.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:r.jsx(s,{className:"h-5 w-5"})}):null]}),n?r.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),u=Ce(RL[a],l?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return l?r.jsx(Ee,{to:l,className:u,children:c}):r.jsx("article",{className:u,children:c})}function iw(e){const t=AL(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find($L);if(p){const m=p.props.children,h=u.map(x=>x===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:x);return r.jsx(t,{...c,ref:a,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function AL(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=OL(a),u=LL(l,a.props);return a.type!==f.Fragment&&(u.ref=s?Fd(s,c):c),f.cloneElement(a,u)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var DL=Symbol("radix.slottable");function $L(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===DL}function LL(e,t){const n={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?n[s]=(...u)=>{const p=l(...u);return a(...u),p}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function OL(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function IL(e){const t=e+"CollectionProvider",[n,s]=Xo(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:w,children:k}=j,E=nn.useRef(null),N=nn.useRef(new Map).current;return r.jsx(a,{scope:w,itemMap:N,collectionRef:E,children:k})};c.displayName=t;const u=e+"CollectionSlot",p=iw(u),m=nn.forwardRef((j,w)=>{const{scope:k,children:E}=j,N=l(u,k),P=Fn(w,N.collectionRef);return r.jsx(p,{ref:P,children:E})});m.displayName=u;const h=e+"CollectionItemSlot",x="data-radix-collection-item",y=iw(h),b=nn.forwardRef((j,w)=>{const{scope:k,children:E,...N}=j,P=nn.useRef(null),$=Fn(w,P),T=l(h,k);return nn.useEffect(()=>(T.itemMap.set(P,{ref:P,...N}),()=>void T.itemMap.delete(P))),r.jsx(y,{[x]:"",ref:$,children:E})});b.displayName=h;function C(j){const w=l(e+"CollectionConsumer",j);return nn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const N=Array.from(E.querySelectorAll(`[${x}]`));return Array.from(w.itemMap.values()).sort((T,D)=>N.indexOf(T.ref.current)-N.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},C,s]}var ML=f.createContext(void 0);function YS(e){const t=f.useContext(ML);return e||t||"ltr"}var Rm="rovingFocusGroup.onEntryFocus",_L={bubbles:!1,cancelable:!0},dc="RovingFocusGroup",[Nh,JS,FL]=IL(dc),[zL,XS]=Xo(dc,[FL]),[BL,UL]=zL(dc),QS=f.forwardRef((e,t)=>r.jsx(Nh.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Nh.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(VL,{...e,ref:t})})}));QS.displayName=dc;var VL=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:p,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...x}=e,y=f.useRef(null),b=Fn(t,y),C=YS(l),[j,w]=zd({prop:c,defaultProp:u??null,onChange:p,caller:dc}),[k,E]=f.useState(!1),N=Ko(m),P=JS(n),$=f.useRef(!1),[T,D]=f.useState(0);return f.useEffect(()=>{const O=y.current;if(O)return O.addEventListener(Rm,N),()=>O.removeEventListener(Rm,N)},[N]),r.jsx(BL,{scope:n,orientation:s,dir:C,loop:a,currentTabStopId:j,onItemFocus:f.useCallback(O=>w(O),[w]),onItemShiftTab:f.useCallback(()=>E(!0),[]),onFocusableItemAdd:f.useCallback(()=>D(O=>O+1),[]),onFocusableItemRemove:f.useCallback(()=>D(O=>O-1),[]),children:r.jsx(mn.div,{tabIndex:k||T===0?-1:0,"data-orientation":s,...x,ref:b,style:{outline:"none",...e.style},onMouseDown:qt(e.onMouseDown,()=>{$.current=!0}),onFocus:qt(e.onFocus,O=>{const J=!$.current;if(O.target===O.currentTarget&&J&&!k){const V=new CustomEvent(Rm,_L);if(O.currentTarget.dispatchEvent(V),!V.defaultPrevented){const L=P().filter(ee=>ee.focusable),W=L.find(ee=>ee.active),oe=L.find(ee=>ee.id===j),H=[W,oe,...L].filter(Boolean).map(ee=>ee.ref.current);t1(H,h)}}$.current=!1}),onBlur:qt(e.onBlur,()=>E(!1))})})}),ZS="RovingFocusGroupItem",e1=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:l,children:c,...u}=e,p=ni(),m=l||p,h=UL(ZS,n),x=h.currentTabStopId===m,y=JS(n),{onFocusableItemAdd:b,onFocusableItemRemove:C,currentTabStopId:j}=h;return f.useEffect(()=>{if(s)return b(),()=>C()},[s,b,C]),r.jsx(Nh.ItemSlot,{scope:n,id:m,focusable:s,active:a,children:r.jsx(mn.span,{tabIndex:x?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:qt(e.onMouseDown,w=>{s?h.onItemFocus(m):w.preventDefault()}),onFocus:qt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:qt(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=KL(w,h.orientation,h.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let N=y().filter(P=>P.focusable).map(P=>P.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const P=N.indexOf(w.currentTarget);N=h.loop?qL(N,P+1):N.slice(P+1)}setTimeout(()=>t1(N))}}),children:typeof c=="function"?c({isCurrentTabStop:x,hasTabStop:j!=null}):c})})});e1.displayName=ZS;var HL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function KL(e,t,n){const s=WL(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return HL[s]}function t1(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function qL(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var GL=QS,YL=e1,rf="Tabs",[JL]=Xo(rf,[XS]),n1=XS(),[XL,Jg]=JL(rf),r1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:p="automatic",...m}=e,h=YS(u),[x,y]=zd({prop:s,onChange:a,defaultProp:l??"",caller:rf});return r.jsx(XL,{scope:n,baseId:ni(),value:x,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(mn.div,{dir:h,"data-orientation":c,...m,ref:t})})});r1.displayName=rf;var s1="TabsList",o1=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,l=Jg(s1,n),c=n1(n);return r.jsx(GL,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:s,children:r.jsx(mn.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:t})})});o1.displayName=s1;var a1="TabsTrigger",i1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...l}=e,c=Jg(a1,n),u=n1(n),p=u1(c.baseId,s),m=d1(c.baseId,s),h=s===c.value;return r.jsx(YL,{asChild:!0,...u,focusable:!a,active:h,children:r.jsx(mn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:p,...l,ref:t,onMouseDown:qt(e.onMouseDown,x=>{!a&&x.button===0&&x.ctrlKey===!1?c.onValueChange(s):x.preventDefault()}),onKeyDown:qt(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&c.onValueChange(s)}),onFocus:qt(e.onFocus,()=>{const x=c.activationMode!=="manual";!h&&!a&&x&&c.onValueChange(s)})})})});i1.displayName=a1;var l1="TabsContent",c1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:l,...c}=e,u=Jg(l1,n),p=u1(u.baseId,s),m=d1(u.baseId,s),h=s===u.value,x=f.useRef(h);return f.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(Qo,{present:a||h,children:({present:y})=>r.jsx(mn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":p,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:x.current?"0s":void 0},children:y&&l})})});c1.displayName=l1;function u1(e,t){return`${e}-trigger-${t}`}function d1(e,t){return`${e}-content-${t}`}var f1=r1,p1=o1,Ch=i1,Eh=c1;function Xg({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(f1,{value:e,onValueChange:t,className:s,children:[r.jsx(p1,{className:"scrollbar-none flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(a=>r.jsxs(Ch,{value:a.value,className:Ce("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:[r.jsx("span",{children:a.label}),typeof a.count=="number"?r.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:a.count}):null]},a.value))}),n.map(a=>r.jsx(Eh,{value:a.value,className:"pt-3",children:a.content},a.value))]})}const QL="modulepreload",ZL=function(e){return"/"+e},lw={},eO=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),p=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(m=>{if(m=ZL(m),m in lw)return;lw[m]=!0;const h=m.endsWith(".css"),x=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${x}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":QL,h||(y.as="script"),y.crossOrigin="",y.href=m,p&&y.setAttribute("nonce",p),document.head.appendChild(y),h)return new Promise((b,C)=>{y.addEventListener("load",b),y.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})};function tO({definition:e,className:t,nodeRoutes:n={}}){const s=f.useRef(null),[a,l]=f.useState(null),[c,u]=f.useState(!0),p=Dt(),m=document.documentElement.classList.contains("dark")?"dark":"default";return f.useEffect(()=>{let h=!1;async function x(){if(s.current)try{const y=(await eO(async()=>{const{default:j}=await import("./mermaid.core-CX2hHqD6.js").then(w=>w.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:nO(m==="dark")}),h)return;const b=`mermaid-${Date.now()}`,{svg:C}=await y.render(b,e);if(h||!s.current)return;s.current.innerHTML=C,rO(s.current,n,p),u(!1)}catch(y){h||(l(y instanceof Error?y.message:"Failed to render graph"),u(!1))}}return u(!0),l(null),x(),()=>{h=!0}},[e,p,n,m]),a?r.jsxs("div",{className:Ce("rounded-lg border border-border bg-card p-4",t),children:[r.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",a]}),r.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):r.jsxs("div",{className:Ce("rounded-lg border border-border bg-card p-4",t),children:[c&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),r.jsx("div",{ref:s,className:"overflow-auto"})]})}function nO(e){const t=document.documentElement,n=x=>{const y=getComputedStyle(t).getPropertyValue(x).trim();return y?`oklch(${y})`:""},s=n("--card"),a=n("--card-foreground"),l=n("--border"),c=n("--primary"),u=n("--primary-foreground"),p=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:a,primaryBorderColor:l,secondaryColor:p,secondaryTextColor:a,secondaryBorderColor:l,tertiaryColor:p,tertiaryTextColor:m,tertiaryBorderColor:l,lineColor:e?m:l,textColor:a,mainBkg:s,nodeBkg:s,nodeTextColor:a,nodeBorder:l,clusterBkg:p,clusterBorder:l,edgeLabelBackground:s,titleColor:a,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:p,labelColor:a,errorBkgColor:h,errorTextColor:u}}function rO(e,t,n){var s;for(const a of e.querySelectorAll(".node")){const l=((s=a.textContent)==null?void 0:s.replace(/\s+/g," ").trim())??"",c=t[l];if(!c)continue;a.style.cursor="pointer",a.setAttribute("role","link"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",`Open ${l}`);const u=()=>n(c);a.addEventListener("click",u),a.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u())})}}function sO(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const oO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iO={};function cw(e,t){return(iO.jsx?aO:oO).test(e)}const lO=/[ \t\n\f\r]/g;function cO(e){return typeof e=="object"?e.type==="text"?uw(e.value):!1:uw(e)}function uw(e){return e.replace(lO,"")===""}class fc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}fc.prototype.normal={};fc.prototype.property={};fc.prototype.space=void 0;function m1(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new fc(n,s,t)}function Th(e){return e.toLowerCase()}class ir{constructor(t,n){this.attribute=n,this.property=t}}ir.prototype.attribute="";ir.prototype.booleanish=!1;ir.prototype.boolean=!1;ir.prototype.commaOrSpaceSeparated=!1;ir.prototype.commaSeparated=!1;ir.prototype.defined=!1;ir.prototype.mustUseProperty=!1;ir.prototype.number=!1;ir.prototype.overloadedBoolean=!1;ir.prototype.property="";ir.prototype.spaceSeparated=!1;ir.prototype.space=void 0;let uO=0;const dt=ra(),dn=ra(),Ph=ra(),Te=ra(),It=ra(),li=ra(),pr=ra();function ra(){return 2**++uO}const Rh=Object.freeze(Object.defineProperty({__proto__:null,boolean:dt,booleanish:dn,commaOrSpaceSeparated:pr,commaSeparated:li,number:Te,overloadedBoolean:Ph,spaceSeparated:It},Symbol.toStringTag,{value:"Module"})),Am=Object.keys(Rh);class Qg extends ir{constructor(t,n,s,a){let l=-1;if(super(t,n),dw(this,"space",a),typeof s=="number")for(;++l<Am.length;){const c=Am[l];dw(this,Am[l],(s&Rh[c])===Rh[c])}}}Qg.prototype.defined=!0;function dw(e,t,n){n&&(e[t]=n)}function ki(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const l=new Qg(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,n[Th(s)]=s,n[Th(l.attribute)]=s}return new fc(t,n,e.space)}const h1=ki({properties:{ariaActiveDescendant:null,ariaAtomic:dn,ariaAutoComplete:null,ariaBusy:dn,ariaChecked:dn,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,ariaControls:It,ariaCurrent:null,ariaDescribedBy:It,ariaDetails:null,ariaDisabled:dn,ariaDropEffect:It,ariaErrorMessage:null,ariaExpanded:dn,ariaFlowTo:It,ariaGrabbed:dn,ariaHasPopup:null,ariaHidden:dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:It,ariaLevel:Te,ariaLive:null,ariaModal:dn,ariaMultiLine:dn,ariaMultiSelectable:dn,ariaOrientation:null,ariaOwns:It,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:dn,ariaReadOnly:dn,ariaRelevant:null,ariaRequired:dn,ariaRoleDescription:It,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:dn,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function g1(e,t){return t in e?e[t]:t}function x1(e,t){return g1(e,t.toLowerCase())}const dO=ki({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:li,acceptCharset:It,accessKey:It,action:null,allow:null,allowFullScreen:dt,allowPaymentRequest:dt,allowUserMedia:dt,alt:null,as:null,async:dt,autoCapitalize:null,autoComplete:It,autoFocus:dt,autoPlay:dt,blocking:It,capture:null,charSet:null,checked:dt,cite:null,className:It,cols:Te,colSpan:null,content:null,contentEditable:dn,controls:dt,controlsList:It,coords:Te|li,crossOrigin:null,data:null,dateTime:null,decoding:null,default:dt,defer:dt,dir:null,dirName:null,disabled:dt,download:Ph,draggable:dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:dt,formTarget:null,headers:It,height:Te,hidden:Ph,high:Te,href:null,hrefLang:null,htmlFor:It,httpEquiv:It,id:null,imageSizes:null,imageSrcSet:null,inert:dt,inputMode:null,integrity:null,is:null,isMap:dt,itemId:null,itemProp:It,itemRef:It,itemScope:dt,itemType:It,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:dt,low:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,multiple:dt,muted:dt,name:null,nonce:null,noModule:dt,noValidate:dt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:dt,optimum:Te,pattern:null,ping:It,placeholder:null,playsInline:dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:dt,referrerPolicy:null,rel:It,required:dt,reversed:dt,rows:Te,rowSpan:Te,sandbox:It,scope:null,scoped:dt,seamless:dt,selected:dt,shadowRootClonable:dt,shadowRootDelegatesFocus:dt,shadowRootMode:null,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:dt,useMap:null,value:dn,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:It,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:dt,declare:dt,event:null,face:null,frame:null,frameBorder:null,hSpace:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:dt,noHref:dt,noShade:dt,noWrap:dt,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:dn,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:dt,disableRemotePlayback:dt,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:x1}),fO=ki({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:pr,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,className:It,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:li,g2:li,glyphName:li,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:pr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Te,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:It,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pr,rev:pr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pr,requiredFeatures:pr,requiredFonts:pr,requiredFormats:pr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:pr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pr,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:g1}),y1=ki({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),b1=ki({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:x1}),v1=ki({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pO={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},mO=/[A-Z]/g,fw=/-[a-z]/g,hO=/^data[-\w.:]+$/i;function gO(e,t){const n=Th(t);let s=t,a=ir;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hO.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(fw,yO);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!fw.test(l)){let c=l.replace(mO,xO);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Qg}return new a(s,t)}function xO(e){return"-"+e.toLowerCase()}function yO(e){return e.charAt(1).toUpperCase()}const bO=m1([h1,dO,y1,b1,v1],"html"),Zg=m1([h1,fO,y1,b1,v1],"svg");function vO(e){return e.join(" ").trim()}var Ba={},Dm,pw;function wO(){if(pw)return Dm;pw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,p=`
|
|
526
526
|
`,m="/",h="*",x="",y="comment",b="declaration";function C(w,k){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];k=k||{};var E=1,N=1;function P(z){var H=z.match(t);H&&(E+=H.length);var ee=z.lastIndexOf(p);N=~ee?z.length-ee:N+z.length}function $(){var z={line:E,column:N};return function(H){return H.position=new T(z),J(),H}}function T(z){this.start=z,this.end={line:E,column:N},this.source=k.source}T.prototype.content=w;function D(z){var H=new Error(k.source+":"+E+":"+N+": "+z);if(H.reason=z,H.filename=k.source,H.line=E,H.column=N,H.source=w,!k.silent)throw H}function O(z){var H=z.exec(w);if(H){var ee=H[0];return P(ee),w=w.slice(ee.length),H}}function J(){O(n)}function V(z){var H;for(z=z||[];H=L();)H!==!1&&z.push(H);return z}function L(){var z=$();if(!(m!=w.charAt(0)||h!=w.charAt(1))){for(var H=2;x!=w.charAt(H)&&(h!=w.charAt(H)||m!=w.charAt(H+1));)++H;if(H+=2,x===w.charAt(H-1))return D("End of comment missing");var ee=w.slice(2,H-2);return N+=2,P(ee),w=w.slice(H),N+=2,z({type:y,comment:ee})}}function W(){var z=$(),H=O(s);if(H){if(L(),!O(a))return D("property missing ':'");var ee=O(l),ne=z({type:b,property:j(H[0].replace(e,x)),value:ee?j(ee[0].replace(e,x)):x});return O(c),ne}}function oe(){var z=[];V(z);for(var H;H=W();)H!==!1&&(z.push(H),V(z));return z}return J(),oe()}function j(w){return w?w.replace(u,x):x}return Dm=C,Dm}var mw;function jO(){if(mw)return Ba;mw=1;var e=Ba&&Ba.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.default=n;const t=e(wO());function n(s,a){let l=null;if(!s||typeof s!="string")return l;const c=(0,t.default)(s),u=typeof a=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:h}=p;u?a(m,h,p):h&&(l=l||{},l[m]=h)}),l}return Ba}var yl={},hw;function kO(){if(hw)return yl;hw=1,Object.defineProperty(yl,"__esModule",{value:!0}),yl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(m){return!m||n.test(m)||e.test(m)},c=function(m,h){return h.toUpperCase()},u=function(m,h){return"".concat(h,"-")},p=function(m,h){return h===void 0&&(h={}),l(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(a,u):m=m.replace(s,u),m.replace(t,c))};return yl.camelCase=p,yl}var bl,gw;function SO(){if(gw)return bl;gw=1;var e=bl&&bl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(jO()),n=kO();function s(a,l){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(u,p){u&&p&&(c[(0,n.camelCase)(u,l)]=p)}),c}return s.default=s,bl=s,bl}var NO=SO();const CO=Td(NO),w1=j1("end"),ex=j1("start");function j1(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function EO(e){const t=ex(e),n=w1(e);if(t&&n)return{start:t,end:n}}function Al(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xw(e.position):"start"in e||"end"in e?xw(e):"line"in e||"column"in e?Ah(e):""}function Ah(e){return yw(e&&e.line)+":"+yw(e&&e.column)}function xw(e){return Ah(e&&e.start)+"-"+Ah(e&&e.end)}function yw(e){return e&&typeof e=="number"?e:1}class zn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",l={},c=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(c=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?l.ruleId=s:(l.source=s.slice(0,p),l.ruleId=s.slice(p+1))}if(!l.place&&l.ancestors&&l.ancestors){const p=l.ancestors[l.ancestors.length-1];p&&(l.place=p.position)}const u=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=u?u.line:void 0,this.name=Al(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}zn.prototype.file="";zn.prototype.name="";zn.prototype.reason="";zn.prototype.message="";zn.prototype.stack="";zn.prototype.column=void 0;zn.prototype.line=void 0;zn.prototype.ancestors=void 0;zn.prototype.cause=void 0;zn.prototype.fatal=void 0;zn.prototype.place=void 0;zn.prototype.ruleId=void 0;zn.prototype.source=void 0;const tx={}.hasOwnProperty,TO=new Map,PO=/[A-Z]/g,RO=new Set(["table","tbody","thead","tfoot","tr"]),AO=new Set(["td","th"]),k1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function DO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=zO(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=FO(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Zg:bO,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=S1(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function S1(e,t,n){if(t.type==="element")return $O(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return LO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return IO(e,t,n);if(t.type==="mdxjsEsm")return OO(e,t);if(t.type==="root")return MO(e,t,n);if(t.type==="text")return _O(e,t)}function $O(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Zg,e.schema=a),e.ancestors.push(t);const l=C1(e,t.tagName,!1),c=BO(e,t);let u=rx(e,t);return RO.has(t.tagName)&&(u=u.filter(function(p){return typeof p=="string"?!cO(p):!0})),N1(e,c,l,t),nx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function LO(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}ql(e,t.position)}function OO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ql(e,t.position)}function IO(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Zg,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:C1(e,t.name,!0),c=UO(e,t),u=rx(e,t);return N1(e,c,l,t),nx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function MO(e,t,n){const s={};return nx(s,rx(e,t)),e.create(t,e.Fragment,s,n)}function _O(e,t){return t.value}function N1(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function nx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function FO(e,t,n){return s;function s(a,l,c,u){const m=Array.isArray(c.children)?n:t;return u?m(l,c,u):m(l,c)}}function zO(e,t){return n;function n(s,a,l,c){const u=Array.isArray(l.children),p=ex(s);return t(a,l,c,u,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function BO(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&tx.call(t.properties,a)){const l=VO(e,a,t.properties[a]);if(l){const[c,u]=l;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&AO.has(t.tagName)?s=u:n[c]=u}}if(s){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function UO(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const l=s.data.estree.body[0];l.type;const c=l.expression;c.type;const u=c.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else ql(e,t.position);else{const a=s.name;let l;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const u=s.value.data.estree.body[0];u.type,l=e.evaluater.evaluateExpression(u.expression)}else ql(e,t.position);else l=s.value===null?!0:s.value;n[a]=l}return n}function rx(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:TO;for(;++s<t.children.length;){const l=t.children[s];let c;if(e.passKeys){const p=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(p){const m=a.get(p)||0;c=p+"-"+m,a.set(p,m+1)}}const u=S1(e,l,c);u!==void 0&&n.push(u)}return n}function VO(e,t,n){const s=gO(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?sO(n):vO(n)),s.property==="style"){let a=typeof n=="object"?n:HO(e,String(n));return e.stylePropertyNameCase==="css"&&(a=WO(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?pO[s.property]||s.property:s.attribute,n]}}function HO(e,t){try{return CO(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new zn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=k1+"#cannot-parse-style-attribute",a}}function C1(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let l=-1,c;for(;++l<a.length;){const u=cw(a[l])?{type:"Identifier",name:a[l]}:{type:"Literal",value:a[l]};c=c?{type:"MemberExpression",object:c,property:u,computed:!!(l&&u.type==="Literal"),optional:!1}:u}s=c}else s=cw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return tx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);ql(e)}function ql(e,t){const n=new zn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=k1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function WO(e){const t={};let n;for(n in e)tx.call(e,n)&&(t[KO(n)]=e[n]);return t}function KO(e){let t=e.replace(PO,qO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function qO(e){return"-"+e.toLowerCase()}const $m={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},GO={};function YO(e,t){const n=GO,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return E1(e,s,a)}function E1(e,t,n){if(JO(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return bw(e.children,t,n)}return Array.isArray(e)?bw(e,t,n):""}function bw(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=E1(e[a],t,n);return s.join("")}function JO(e){return!!(e&&typeof e=="object")}const vw=document.createElement("i");function sx(e){const t="&"+e+";";vw.innerHTML=t;const n=vw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function fs(e,t,n,s){const a=e.length;let l=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);l<s.length;)c=s.slice(l,l+1e4),c.unshift(t,0),e.splice(...c),l+=1e4,t+=1e4}function Tr(e,t){return e.length>0?(fs(e,e.length,0,t),e):t}const ww={}.hasOwnProperty;function XO(e){const t={};let n=-1;for(;++n<e.length;)QO(t,e[n]);return t}function QO(e,t){let n;for(n in t){const a=(ww.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){ww.call(a,c)||(a[c]=[]);const u=l[c];ZO(a[c],Array.isArray(u)?u:u?[u]:[])}}}function ZO(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);fs(e,0,0,s)}function T1(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ci(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const is=ho(/[A-Za-z]/),xr=ho(/[\dA-Za-z]/),eI=ho(/[#-'*+\--9=?A-Z^-~]/);function Dh(e){return e!==null&&(e<32||e===127)}const $h=ho(/\d/),tI=ho(/[\dA-Fa-f]/),nI=ho(/[!-/:-@[-`{-~]/);function st(e){return e!==null&&e<-2}function sr(e){return e!==null&&(e<0||e===32)}function Tt(e){return e===-2||e===-1||e===32}const rI=ho(new RegExp("\\p{P}|\\p{S}","u")),sI=ho(/\s/);function ho(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Si(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&xr(e.charCodeAt(n+1))&&xr(e.charCodeAt(n+2)))a=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(c=String.fromCharCode(l));else if(l>55295&&l<57344){const u=e.charCodeAt(n+1);l<56320&&u>56319&&u<57344?(c=String.fromCharCode(l,u),a=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function Mt(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(p){return Tt(p)?(e.enter(n),u(p)):t(p)}function u(p){return Tt(p)&&l++<a?(e.consume(p),u):(e.exit(n),t(p))}}const oI={tokenize:aI};function aI(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Mt(e,t,"linePrefix")}function a(u){return e.enter("paragraph"),l(u)}function l(u){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(u)}function c(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return st(u)?(e.consume(u),e.exit("chunkText"),l):(e.consume(u),c)}}const iI={tokenize:lI},jw={tokenize:cI};function lI(e){const t=this,n=[];let s=0,a,l,c;return u;function u(N){if(s<n.length){const P=n[s];return t.containerState=P[1],e.attempt(P[0].continuation,p,m)(N)}return m(N)}function p(N){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const P=t.events.length;let $=P,T;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){T=t.events[$][1].end;break}k(s);let D=P;for(;D<t.events.length;)t.events[D][1].end={...T},D++;return fs(t.events,$+1,0,t.events.slice(P)),t.events.length=D,m(N)}return u(N)}function m(N){if(s===n.length){if(!a)return y(N);if(a.currentConstruct&&a.currentConstruct.concrete)return C(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(jw,h,x)(N)}function h(N){return a&&E(),k(s),y(N)}function x(N){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,C(N)}function y(N){return t.containerState={},e.attempt(jw,b,C)(N)}function b(N){return s++,n.push([t.currentConstruct,t.containerState]),y(N)}function C(N){if(N===null){a&&E(),k(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:l}),j(N)}function j(N){if(N===null){w(e.exit("chunkFlow"),!0),k(0),e.consume(N);return}return st(N)?(e.consume(N),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(N),j)}function w(N,P){const $=t.sliceStream(N);if(P&&$.push(null),N.previous=l,l&&(l.next=N),l=N,a.defineSkip(N.start),a.write($),t.parser.lazy[N.start.line]){let T=a.events.length;for(;T--;)if(a.events[T][1].start.offset<c&&(!a.events[T][1].end||a.events[T][1].end.offset>c))return;const D=t.events.length;let O=D,J,V;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(J){V=t.events[O][1].end;break}J=!0}for(k(s),T=D;T<t.events.length;)t.events[T][1].end={...V},T++;fs(t.events,O+1,0,t.events.slice(D)),t.events.length=T}}function k(N){let P=n.length;for(;P-- >N;){const $=n[P];t.containerState=$[1],$[0].exit.call(t,e)}n.length=N}function E(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function cI(e,t,n){return Mt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function kw(e){if(e===null||sr(e)||sI(e))return 1;if(rI(e))return 2}function ox(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const l=e[a].resolveAll;l&&!s.includes(l)&&(t=l(t,n),s.push(l))}return t}const Lh={name:"attention",resolveAll:uI,tokenize:dI};function uI(e,t){let n=-1,s,a,l,c,u,p,m,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const x={...e[s][1].end},y={...e[n][1].start};Sw(x,-p),Sw(y,p),c={type:p>1?"strongSequence":"emphasisSequence",start:x,end:{...e[s][1].end}},u={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:p>1?"strong":"emphasis",start:{...c.start},end:{...u.end}},e[s][1].end={...c.start},e[n][1].start={...u.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=Tr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Tr(m,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",l,t]]),m=Tr(m,ox(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Tr(m,[["exit",l,t],["enter",u,t],["exit",u,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Tr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,fs(e,s-1,n-s+3,m),n=s+m.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function dI(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=kw(s);let l;return c;function c(p){return l=p,e.enter("attentionSequence"),u(p)}function u(p){if(p===l)return e.consume(p),u;const m=e.exit("attentionSequence"),h=kw(p),x=!h||h===2&&a||n.includes(p),y=!a||a===2&&h||n.includes(s);return m._open=!!(l===42?x:x&&(a||!y)),m._close=!!(l===42?y:y&&(h||!x)),t(p)}}function Sw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const fI={name:"autolink",tokenize:pI};function pI(e,t,n){let s=0;return a;function a(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return is(b)?(e.consume(b),c):b===64?n(b):m(b)}function c(b){return b===43||b===45||b===46||xr(b)?(s=1,u(b)):m(b)}function u(b){return b===58?(e.consume(b),s=0,p):(b===43||b===45||b===46||xr(b))&&s++<32?(e.consume(b),u):(s=0,m(b))}function p(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Dh(b)?n(b):(e.consume(b),p)}function m(b){return b===64?(e.consume(b),h):eI(b)?(e.consume(b),m):n(b)}function h(b){return xr(b)?x(b):n(b)}function x(b){return b===46?(e.consume(b),s=0,h):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||xr(b))&&s++<63){const C=b===45?y:x;return e.consume(b),C}return n(b)}}const sf={partial:!0,tokenize:mI};function mI(e,t,n){return s;function s(l){return Tt(l)?Mt(e,a,"linePrefix")(l):a(l)}function a(l){return l===null||st(l)?t(l):n(l)}}const P1={continuation:{tokenize:gI},exit:xI,name:"blockQuote",tokenize:hI};function hI(e,t,n){const s=this;return a;function a(c){if(c===62){const u=s.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),l}return n(c)}function l(c){return Tt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function gI(e,t,n){const s=this;return a;function a(c){return Tt(c)?Mt(e,l,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(P1,t,n)(c)}}function xI(e){e.exit("blockQuote")}const R1={name:"characterEscape",tokenize:yI};function yI(e,t,n){return s;function s(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),a}function a(l){return nI(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const A1={name:"characterReference",tokenize:bI};function bI(e,t,n){const s=this;let a=0,l,c;return u;function u(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),p}function p(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,c=xr,h(x))}function m(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,c=tI,h):(e.enter("characterReferenceValue"),l=7,c=$h,h(x))}function h(x){if(x===59&&a){const y=e.exit("characterReferenceValue");return c===xr&&!sx(s.sliceSerialize(y))?n(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(x)&&a++<l?(e.consume(x),h):n(x)}}const Nw={partial:!0,tokenize:wI},Cw={concrete:!0,name:"codeFenced",tokenize:vI};function vI(e,t,n){const s=this,a={partial:!0,tokenize:$};let l=0,c=0,u;return p;function p(T){return m(T)}function m(T){const D=s.events[s.events.length-1];return l=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,u=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(T)}function h(T){return T===u?(c++,e.consume(T),h):c<3?n(T):(e.exit("codeFencedFenceSequence"),Tt(T)?Mt(e,x,"whitespace")(T):x(T))}function x(T){return T===null||st(T)?(e.exit("codeFencedFence"),s.interrupt?t(T):e.check(Nw,j,P)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(T))}function y(T){return T===null||st(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(T)):Tt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Mt(e,b,"whitespace")(T)):T===96&&T===u?n(T):(e.consume(T),y)}function b(T){return T===null||st(T)?x(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(T))}function C(T){return T===null||st(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(T)):T===96&&T===u?n(T):(e.consume(T),C)}function j(T){return e.attempt(a,P,w)(T)}function w(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),k}function k(T){return l>0&&Tt(T)?Mt(e,E,"linePrefix",l+1)(T):E(T)}function E(T){return T===null||st(T)?e.check(Nw,j,P)(T):(e.enter("codeFlowValue"),N(T))}function N(T){return T===null||st(T)?(e.exit("codeFlowValue"),E(T)):(e.consume(T),N)}function P(T){return e.exit("codeFenced"),t(T)}function $(T,D,O){let J=0;return V;function V(H){return T.enter("lineEnding"),T.consume(H),T.exit("lineEnding"),L}function L(H){return T.enter("codeFencedFence"),Tt(H)?Mt(T,W,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):W(H)}function W(H){return H===u?(T.enter("codeFencedFenceSequence"),oe(H)):O(H)}function oe(H){return H===u?(J++,T.consume(H),oe):J>=c?(T.exit("codeFencedFenceSequence"),Tt(H)?Mt(T,z,"whitespace")(H):z(H)):O(H)}function z(H){return H===null||st(H)?(T.exit("codeFencedFence"),D(H)):O(H)}}}function wI(e,t,n){const s=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l)}function l(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const Lm={name:"codeIndented",tokenize:kI},jI={partial:!0,tokenize:SI};function kI(e,t,n){const s=this;return a;function a(m){return e.enter("codeIndented"),Mt(e,l,"linePrefix",5)(m)}function l(m){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?c(m):n(m)}function c(m){return m===null?p(m):st(m)?e.attempt(jI,c,p)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||st(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),u)}function p(m){return e.exit("codeIndented"),t(m)}}function SI(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):st(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):Mt(e,l,"linePrefix",5)(c)}function l(c){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):st(c)?a(c):n(c)}}const NI={name:"codeText",previous:EI,resolve:CI,tokenize:TI};function CI(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function EI(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TI(e,t,n){let s=0,a,l;return c;function c(x){return e.enter("codeText"),e.enter("codeTextSequence"),u(x)}function u(x){return x===96?(e.consume(x),s++,u):(e.exit("codeTextSequence"),p(x))}function p(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),p):x===96?(l=e.enter("codeTextSequence"),a=0,h(x)):st(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(x))}function m(x){return x===null||x===32||x===96||st(x)?(e.exit("codeTextData"),p(x)):(e.consume(x),m)}function h(x){return x===96?(e.consume(x),a++,h):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(l.type="codeTextData",m(x))}}class PI{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&vl(this.left,s),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),vl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),vl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);vl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);vl(this.left,n.reverse())}}}function vl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function D1(e){const t={};let n=-1,s,a,l,c,u,p,m;const h=new PI(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(s=h.get(n),n&&s[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,l=0,l<p.length&&p[l][1].type==="lineEndingBlank"&&(l+=2),l<p.length&&p[l][1].type==="content"))for(;++l<p.length&&p[l][1].type!=="content";)p[l][1].type==="chunkText"&&(p[l][1]._isInFirstContentOfListItem=!0,l++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,RI(h,n)),n=t[n],m=!0);else if(s[1]._container){for(l=n,a=void 0;l--;)if(c=h.get(l),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(h.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=l);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(s[1].end={...h.get(a)[1].start},u=h.slice(a,n),u.unshift(s),h.splice(a,n-a+1,u))}}return fs(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function RI(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const l=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const u=c.events,p=[],m={};let h,x,y=-1,b=n,C=0,j=0;const w=[j];for(;b;){for(;e.get(++a)[1]!==b;);l.push(a),b._tokenizer||(h=s.sliceStream(b),b.next||h.push(null),x&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(h),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),x=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(j=y+1,w.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):w.pop(),y=w.length;y--;){const k=u.slice(w[y],w[y+1]),E=l.pop();p.push([E,E+k.length-1]),e.splice(E,2,k)}for(p.reverse(),y=-1;++y<p.length;)m[C+p[y][0]]=C+p[y][1],C+=p[y][1]-p[y][0]-1;return m}const AI={resolve:$I,tokenize:LI},DI={partial:!0,tokenize:OI};function $I(e){return D1(e),e}function LI(e,t){let n;return s;function s(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(u)}function a(u){return u===null?l(u):st(u)?e.check(DI,c,l)(u):(e.consume(u),a)}function l(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function c(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function OI(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Mt(e,l,"linePrefix")}function l(c){if(c===null||st(c))return n(c);const u=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function $1(e,t,n,s,a,l,c,u,p){const m=p||Number.POSITIVE_INFINITY;let h=0;return x;function x(k){return k===60?(e.enter(s),e.enter(a),e.enter(l),e.consume(k),e.exit(l),y):k===null||k===32||k===41||Dh(k)?n(k):(e.enter(s),e.enter(c),e.enter(u),e.enter("chunkString",{contentType:"string"}),j(k))}function y(k){return k===62?(e.enter(l),e.consume(k),e.exit(l),e.exit(a),e.exit(s),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(u),y(k)):k===null||k===60||st(k)?n(k):(e.consume(k),k===92?C:b)}function C(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function j(k){return!h&&(k===null||k===41||sr(k))?(e.exit("chunkString"),e.exit(u),e.exit(c),e.exit(s),t(k)):h<m&&k===40?(e.consume(k),h++,j):k===41?(e.consume(k),h--,j):k===null||k===32||k===40||Dh(k)?n(k):(e.consume(k),k===92?w:j)}function w(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function L1(e,t,n,s,a,l){const c=this;let u=0,p;return m;function m(b){return e.enter(s),e.enter(a),e.consume(b),e.exit(a),e.enter(l),h}function h(b){return u>999||b===null||b===91||b===93&&!p||b===94&&!u&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(l),e.enter(a),e.consume(b),e.exit(a),e.exit(s),t):st(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===null||b===91||b===93||st(b)||u++>999?(e.exit("chunkString"),h(b)):(e.consume(b),p||(p=!Tt(b)),b===92?y:x)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,x):x(b)}}function O1(e,t,n,s,a,l){let c;return u;function u(y){return y===34||y===39||y===40?(e.enter(s),e.enter(a),e.consume(y),e.exit(a),c=y===40?41:y,p):n(y)}function p(y){return y===c?(e.enter(a),e.consume(y),e.exit(a),e.exit(s),t):(e.enter(l),m(y))}function m(y){return y===c?(e.exit(l),p(c)):y===null?n(y):st(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Mt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===c||y===null||st(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?x:h)}function x(y){return y===c||y===92?(e.consume(y),h):h(y)}}function Dl(e,t){let n;return s;function s(a){return st(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Tt(a)?Mt(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const II={name:"definition",tokenize:_I},MI={partial:!0,tokenize:FI};function _I(e,t,n){const s=this;let a;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return L1.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return a=ci(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):n(b)}function p(b){return sr(b)?Dl(e,m)(b):m(b)}function m(b){return $1(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(MI,x,x)(b)}function x(b){return Tt(b)?Mt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||st(b)?(e.exit("definition"),s.parser.defined.push(a),t(b)):n(b)}}function FI(e,t,n){return s;function s(u){return sr(u)?Dl(e,a)(u):n(u)}function a(u){return O1(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return Tt(u)?Mt(e,c,"whitespace")(u):c(u)}function c(u){return u===null||st(u)?t(u):n(u)}}const zI={name:"hardBreakEscape",tokenize:BI};function BI(e,t,n){return s;function s(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return st(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const UI={name:"headingAtx",resolve:VI,tokenize:HI};function VI(e,t){let n=e.length-2,s=3,a,l;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},l={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},fs(e,s,n-s+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function HI(e,t,n){let s=0;return a;function a(h){return e.enter("atxHeading"),l(h)}function l(h){return e.enter("atxHeadingSequence"),c(h)}function c(h){return h===35&&s++<6?(e.consume(h),c):h===null||sr(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),p(h)):h===null||st(h)?(e.exit("atxHeading"),t(h)):Tt(h)?Mt(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function p(h){return h===35?(e.consume(h),p):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||sr(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const WI=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ew=["pre","script","style","textarea"],KI={concrete:!0,name:"htmlFlow",resolveTo:YI,tokenize:JI},qI={partial:!0,tokenize:QI},GI={partial:!0,tokenize:XI};function YI(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function JI(e,t,n){const s=this;let a,l,c,u,p;return m;function m(I){return h(I)}function h(I){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(I),x}function x(I){return I===33?(e.consume(I),y):I===47?(e.consume(I),l=!0,j):I===63?(e.consume(I),a=3,s.interrupt?t:A):is(I)?(e.consume(I),c=String.fromCharCode(I),w):n(I)}function y(I){return I===45?(e.consume(I),a=2,b):I===91?(e.consume(I),a=5,u=0,C):is(I)?(e.consume(I),a=4,s.interrupt?t:A):n(I)}function b(I){return I===45?(e.consume(I),s.interrupt?t:A):n(I)}function C(I){const ue="CDATA[";return I===ue.charCodeAt(u++)?(e.consume(I),u===ue.length?s.interrupt?t:W:C):n(I)}function j(I){return is(I)?(e.consume(I),c=String.fromCharCode(I),w):n(I)}function w(I){if(I===null||I===47||I===62||sr(I)){const ue=I===47,ge=c.toLowerCase();return!ue&&!l&&Ew.includes(ge)?(a=1,s.interrupt?t(I):W(I)):WI.includes(c.toLowerCase())?(a=6,ue?(e.consume(I),k):s.interrupt?t(I):W(I)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(I):l?E(I):N(I))}return I===45||xr(I)?(e.consume(I),c+=String.fromCharCode(I),w):n(I)}function k(I){return I===62?(e.consume(I),s.interrupt?t:W):n(I)}function E(I){return Tt(I)?(e.consume(I),E):V(I)}function N(I){return I===47?(e.consume(I),V):I===58||I===95||is(I)?(e.consume(I),P):Tt(I)?(e.consume(I),N):V(I)}function P(I){return I===45||I===46||I===58||I===95||xr(I)?(e.consume(I),P):$(I)}function $(I){return I===61?(e.consume(I),T):Tt(I)?(e.consume(I),$):N(I)}function T(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),p=I,D):Tt(I)?(e.consume(I),T):O(I)}function D(I){return I===p?(e.consume(I),p=null,J):I===null||st(I)?n(I):(e.consume(I),D)}function O(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||sr(I)?$(I):(e.consume(I),O)}function J(I){return I===47||I===62||Tt(I)?N(I):n(I)}function V(I){return I===62?(e.consume(I),L):n(I)}function L(I){return I===null||st(I)?W(I):Tt(I)?(e.consume(I),L):n(I)}function W(I){return I===45&&a===2?(e.consume(I),ee):I===60&&a===1?(e.consume(I),ne):I===62&&a===4?(e.consume(I),F):I===63&&a===3?(e.consume(I),A):I===93&&a===5?(e.consume(I),q):st(I)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(qI,Z,oe)(I)):I===null||st(I)?(e.exit("htmlFlowData"),oe(I)):(e.consume(I),W)}function oe(I){return e.check(GI,z,Z)(I)}function z(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),H}function H(I){return I===null||st(I)?oe(I):(e.enter("htmlFlowData"),W(I))}function ee(I){return I===45?(e.consume(I),A):W(I)}function ne(I){return I===47?(e.consume(I),c="",M):W(I)}function M(I){if(I===62){const ue=c.toLowerCase();return Ew.includes(ue)?(e.consume(I),F):W(I)}return is(I)&&c.length<8?(e.consume(I),c+=String.fromCharCode(I),M):W(I)}function q(I){return I===93?(e.consume(I),A):W(I)}function A(I){return I===62?(e.consume(I),F):I===45&&a===2?(e.consume(I),A):W(I)}function F(I){return I===null||st(I)?(e.exit("htmlFlowData"),Z(I)):(e.consume(I),F)}function Z(I){return e.exit("htmlFlow"),t(I)}}function XI(e,t,n){const s=this;return a;function a(c){return st(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):n(c)}function l(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function QI(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(sf,t,n)}}const ZI={name:"htmlText",tokenize:eM};function eM(e,t,n){const s=this;let a,l,c;return u;function u(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),p}function p(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),$):A===63?(e.consume(A),N):is(A)?(e.consume(A),O):n(A)}function m(A){return A===45?(e.consume(A),h):A===91?(e.consume(A),l=0,C):is(A)?(e.consume(A),E):n(A)}function h(A){return A===45?(e.consume(A),b):n(A)}function x(A){return A===null?n(A):A===45?(e.consume(A),y):st(A)?(c=x,ne(A)):(e.consume(A),x)}function y(A){return A===45?(e.consume(A),b):x(A)}function b(A){return A===62?ee(A):A===45?y(A):x(A)}function C(A){const F="CDATA[";return A===F.charCodeAt(l++)?(e.consume(A),l===F.length?j:C):n(A)}function j(A){return A===null?n(A):A===93?(e.consume(A),w):st(A)?(c=j,ne(A)):(e.consume(A),j)}function w(A){return A===93?(e.consume(A),k):j(A)}function k(A){return A===62?ee(A):A===93?(e.consume(A),k):j(A)}function E(A){return A===null||A===62?ee(A):st(A)?(c=E,ne(A)):(e.consume(A),E)}function N(A){return A===null?n(A):A===63?(e.consume(A),P):st(A)?(c=N,ne(A)):(e.consume(A),N)}function P(A){return A===62?ee(A):N(A)}function $(A){return is(A)?(e.consume(A),T):n(A)}function T(A){return A===45||xr(A)?(e.consume(A),T):D(A)}function D(A){return st(A)?(c=D,ne(A)):Tt(A)?(e.consume(A),D):ee(A)}function O(A){return A===45||xr(A)?(e.consume(A),O):A===47||A===62||sr(A)?J(A):n(A)}function J(A){return A===47?(e.consume(A),ee):A===58||A===95||is(A)?(e.consume(A),V):st(A)?(c=J,ne(A)):Tt(A)?(e.consume(A),J):ee(A)}function V(A){return A===45||A===46||A===58||A===95||xr(A)?(e.consume(A),V):L(A)}function L(A){return A===61?(e.consume(A),W):st(A)?(c=L,ne(A)):Tt(A)?(e.consume(A),L):J(A)}function W(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),a=A,oe):st(A)?(c=W,ne(A)):Tt(A)?(e.consume(A),W):(e.consume(A),z)}function oe(A){return A===a?(e.consume(A),a=void 0,H):A===null?n(A):st(A)?(c=oe,ne(A)):(e.consume(A),oe)}function z(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||sr(A)?J(A):(e.consume(A),z)}function H(A){return A===47||A===62||sr(A)?J(A):n(A)}function ee(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function ne(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),M}function M(A){return Tt(A)?Mt(e,q,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):q(A)}function q(A){return e.enter("htmlTextData"),c(A)}}const ax={name:"labelEnd",resolveAll:sM,resolveTo:oM,tokenize:aM},tM={tokenize:iM},nM={tokenize:lM},rM={tokenize:cM};function sM(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&fs(e,0,e.length,n),e}function oM(e,t){let n=e.length,s=0,a,l,c,u;for(;n--;)if(a=e[n][1],l){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(l=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(c=n);const p={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[l][1].start},end:{...e[c][1].end}},h={type:"labelText",start:{...e[l+s+2][1].end},end:{...e[c-2][1].start}};return u=[["enter",p,t],["enter",m,t]],u=Tr(u,e.slice(l+1,l+s+3)),u=Tr(u,[["enter",h,t]]),u=Tr(u,ox(t.parser.constructs.insideSpan.null,e.slice(l+s+4,c-3),t)),u=Tr(u,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),u=Tr(u,e.slice(c+1)),u=Tr(u,[["exit",p,t]]),fs(e,l,e.length,u),e}function aM(e,t,n){const s=this;let a=s.events.length,l,c;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){l=s.events[a][1];break}return u;function u(y){return l?l._inactive?x(y):(c=s.parser.defined.includes(ci(s.sliceSerialize({start:l.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),p):n(y)}function p(y){return y===40?e.attempt(tM,h,c?h:x)(y):y===91?e.attempt(nM,h,c?m:x)(y):c?h(y):x(y)}function m(y){return e.attempt(rM,h,x)(y)}function h(y){return t(y)}function x(y){return l._balanced=!0,n(y)}}function iM(e,t,n){return s;function s(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),a}function a(x){return sr(x)?Dl(e,l)(x):l(x)}function l(x){return x===41?h(x):$1(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function c(x){return sr(x)?Dl(e,p)(x):h(x)}function u(x){return n(x)}function p(x){return x===34||x===39||x===40?O1(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):h(x)}function m(x){return sr(x)?Dl(e,h)(x):h(x)}function h(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),t):n(x)}}function lM(e,t,n){const s=this;return a;function a(u){return L1.call(s,e,l,c,"reference","referenceMarker","referenceString")(u)}function l(u){return s.parser.defined.includes(ci(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function cM(e,t,n){return s;function s(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),a}function a(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const uM={name:"labelStartImage",resolveAll:ax.resolveAll,tokenize:dM};function dM(e,t,n){const s=this;return a;function a(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),l}function l(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),c):n(u)}function c(u){return u===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):t(u)}}const fM={name:"labelStartLink",resolveAll:ax.resolveAll,tokenize:pM};function pM(e,t,n){const s=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),l}function l(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const Om={name:"lineEnding",tokenize:mM};function mM(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Mt(e,t,"linePrefix")}}const Ju={name:"thematicBreak",tokenize:hM};function hM(e,t,n){let s=0,a;return l;function l(m){return e.enter("thematicBreak"),c(m)}function c(m){return a=m,u(m)}function u(m){return m===a?(e.enter("thematicBreakSequence"),p(m)):s>=3&&(m===null||st(m))?(e.exit("thematicBreak"),t(m)):n(m)}function p(m){return m===a?(e.consume(m),s++,p):(e.exit("thematicBreakSequence"),Tt(m)?Mt(e,u,"whitespace")(m):u(m))}}const tr={continuation:{tokenize:bM},exit:wM,name:"list",tokenize:yM},gM={partial:!0,tokenize:jM},xM={partial:!0,tokenize:vM};function yM(e,t,n){const s=this,a=s.events[s.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return u;function u(b){const C=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:$h(b)){if(s.containerState.type||(s.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Ju,n,m)(b):m(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return n(b)}function p(b){return $h(b)&&++c<10?(e.consume(b),p):(!s.interrupt||c<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):n(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check(sf,s.interrupt?n:h,e.attempt(gM,y,x))}function h(b){return s.containerState.initialBlankLine=!0,l++,y(b)}function x(b){return Tt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return s.containerState.size=l+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function bM(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(sf,a,l);function a(u){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Mt(e,t,"listItemIndent",s.containerState.size+1)(u)}function l(u){return s.containerState.furtherBlankLines||!Tt(u)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(u)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(xM,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Mt(e,e.attempt(tr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function vM(e,t,n){const s=this;return Mt(e,a,"listItemIndent",s.containerState.size+1);function a(l){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(l):n(l)}}function wM(e){e.exit(this.containerState.type)}function jM(e,t,n){const s=this;return Mt(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const c=s.events[s.events.length-1];return!Tt(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const Tw={name:"setextUnderline",resolveTo:kM,tokenize:SM};function kM(e,t){let n=e.length,s,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",c,t]),e.splice(l+1,0,["exit",e[s][1],t]),e[s][1].end={...e[l][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function SM(e,t,n){const s=this;let a;return l;function l(m){let h=s.events.length,x;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){x=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||x)?(e.enter("setextHeadingLine"),a=m,c(m)):n(m)}function c(m){return e.enter("setextHeadingLineSequence"),u(m)}function u(m){return m===a?(e.consume(m),u):(e.exit("setextHeadingLineSequence"),Tt(m)?Mt(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||st(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const NM={tokenize:CM};function CM(e){const t=this,n=e.attempt(sf,s,e.attempt(this.parser.constructs.flowInitial,a,Mt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(AI,a)),"linePrefix")));return n;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const EM={resolveAll:M1()},TM=I1("string"),PM=I1("text");function I1(e){return{resolveAll:M1(e==="text"?RM:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],l=n.attempt(a,c,u);return c;function c(h){return m(h)?l(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),p}function p(h){return m(h)?(n.exit("data"),l(h)):(n.consume(h),p)}function m(h){if(h===null)return!0;const x=a[h];let y=-1;if(x)for(;++y<x.length;){const b=x[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function M1(e){return t;function t(n,s){let a=-1,l;for(;++a<=n.length;)l===void 0?n[a]&&n[a][1].type==="data"&&(l=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==l+2&&(n[l][1].end=n[a-1][1].end,n.splice(l+2,a-l-2),a=l+2),l=void 0);return e?e(n,s):n}}function RM(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let l=a.length,c=-1,u=0,p;for(;l--;){const m=a[l];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)u++,c--;if(c)break;c=-1}else if(m===-2)p=!0,u++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||p||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:s.start._bufferIndex+c,_index:s.start._index+l,line:s.end.line,column:s.end.column-u,offset:s.end.offset-u},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const AM={42:tr,43:tr,45:tr,48:tr,49:tr,50:tr,51:tr,52:tr,53:tr,54:tr,55:tr,56:tr,57:tr,62:P1},DM={91:II},$M={[-2]:Lm,[-1]:Lm,32:Lm},LM={35:UI,42:Ju,45:[Tw,Ju],60:KI,61:Tw,95:Ju,96:Cw,126:Cw},OM={38:A1,92:R1},IM={[-5]:Om,[-4]:Om,[-3]:Om,33:uM,38:A1,42:Lh,60:[fI,ZI],91:fM,92:[zI,R1],93:ax,95:Lh,96:NI},MM={null:[Lh,EM]},_M={null:[42,95]},FM={null:[]},zM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:_M,contentInitial:DM,disable:FM,document:AM,flow:LM,flowInitial:$M,insideSpan:MM,string:OM,text:IM},Symbol.toStringTag,{value:"Module"}));function BM(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},l=[];let c=[],u=[];const p={attempt:D($),check:D(T),consume:E,enter:N,exit:P,interrupt:D(T,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:C,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:x};let h=t.tokenize.call(m,p);return t.resolveAll&&l.push(t),m;function x(L){return c=Tr(c,L),w(),c[c.length-1]!==null?[]:(O(t,0),m.events=ox(l,m.events,m),m.events)}function y(L,W){return VM(b(L),W)}function b(L){return UM(c,L)}function C(){const{_bufferIndex:L,_index:W,line:oe,column:z,offset:H}=s;return{_bufferIndex:L,_index:W,line:oe,column:z,offset:H}}function j(L){a[L.line]=L.column,V()}function w(){let L;for(;s._index<c.length;){const W=c[s._index];if(typeof W=="string")for(L=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===L&&s._bufferIndex<W.length;)k(W.charCodeAt(s._bufferIndex));else k(W)}}function k(L){h=h(L)}function E(L){st(L)?(s.line++,s.column=1,s.offset+=L===-3?2:1,V()):L!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=L}function N(L,W){const oe=W||{};return oe.type=L,oe.start=C(),m.events.push(["enter",oe,m]),u.push(oe),oe}function P(L){const W=u.pop();return W.end=C(),m.events.push(["exit",W,m]),W}function $(L,W){O(L,W.from)}function T(L,W){W.restore()}function D(L,W){return oe;function oe(z,H,ee){let ne,M,q,A;return Array.isArray(z)?Z(z):"tokenize"in z?Z([z]):F(z);function F(U){return ae;function ae(me){const ve=me!==null&&U[me],ke=me!==null&&U.null,he=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return Z(he)(me)}}function Z(U){return ne=U,M=0,U.length===0?ee:I(U[M])}function I(U){return ae;function ae(me){return A=J(),q=U,U.partial||(m.currentConstruct=U),U.name&&m.parser.constructs.disable.null.includes(U.name)?ge():U.tokenize.call(W?Object.assign(Object.create(m),W):m,p,ue,ge)(me)}}function ue(U){return L(q,A),H}function ge(U){return A.restore(),++M<ne.length?I(ne[M]):ee}}}function O(L,W){L.resolveAll&&!l.includes(L)&&l.push(L),L.resolve&&fs(m.events,W,m.events.length-W,L.resolve(m.events.slice(W),m)),L.resolveTo&&(m.events=L.resolveTo(m.events,m))}function J(){const L=C(),W=m.previous,oe=m.currentConstruct,z=m.events.length,H=Array.from(u);return{from:z,restore:ee};function ee(){s=L,m.previous=W,m.currentConstruct=oe,m.events.length=z,u=H,V()}}function V(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function UM(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,l=t.end._bufferIndex;let c;if(n===a)c=[e[n].slice(s,l)];else{if(c=e.slice(n,a),s>-1){const u=c[0];typeof u=="string"?c[0]=u.slice(s):c.shift()}l>0&&c.push(e[a].slice(0,l))}return c}function VM(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const l=e[n];let c;if(typeof l=="string")c=l;else switch(l){case-5:{c="\r";break}case-4:{c=`
|
|
527
527
|
`;break}case-3:{c=`\r
|
|
528
528
|
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(l)}a=l===-2,s.push(c)}return s.join("")}function HM(e){const s={constructs:XO([zM,...(e||{}).extensions||[]]),content:a(oI),defined:[],document:a(iI),flow:a(NM),lazy:{},string:a(TM),text:a(PM)};return s;function a(l){return c;function c(u){return BM(s,l,u)}}}function WM(e){for(;!D1(e););return e}const Pw=/[\0\t\n\r]/g;function KM(){let e=1,t="",n=!0,s;return a;function a(l,c,u){const p=[];let m,h,x,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),x=0,t="",n&&(l.charCodeAt(0)===65279&&x++,n=void 0);x<l.length;){if(Pw.lastIndex=x,m=Pw.exec(l),y=m&&m.index!==void 0?m.index:l.length,b=l.charCodeAt(y),!m){t=l.slice(x);break}if(b===10&&x===y&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),x<y&&(p.push(l.slice(x,y)),e+=y-x),b){case 0:{p.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,p.push(-2);e++<h;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}x=y+1}return u&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const qM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function GM(e){return e.replace(qM,YM)}function YM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return T1(n.slice(l?2:1),l?16:10)}return sx(n)||e}const _1={}.hasOwnProperty;function JM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),XM(n)(WM(HM(n).document().write(KM()(e,t,!0))))}function XM(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Xe),autolinkProtocol:J,autolinkEmail:J,atxHeading:l(Y),blockQuote:l(ke),characterEscape:J,characterReference:J,codeFenced:l(he),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(he,c),codeText:l(Je,c),codeTextData:J,data:J,codeFlowValue:J,definition:l(Ye),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(ot),hardBreakEscape:l(Ie),hardBreakTrailing:l(Ie),htmlFlow:l(Se,c),htmlFlowData:J,htmlText:l(Se,c),htmlTextData:J,image:l(Oe),label:c,link:l(Xe),listItem:l(nt),listItemValue:y,listOrdered:l(Me,x),listUnordered:l(Me),paragraph:l(Ke),reference:I,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(Y),strong:l(gt),thematicBreak:l(at)},exit:{atxHeading:p(),atxHeadingSequence:$,autolink:p(),autolinkEmail:ve,autolinkProtocol:me,blockQuote:p(),characterEscapeValue:V,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:U,characterReference:ae,codeFenced:p(w),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:C,codeFlowValue:V,codeIndented:p(k),codeText:p(H),codeTextData:V,data:V,definition:p(),definitionDestinationString:P,definitionLabelString:E,definitionTitleString:N,emphasis:p(),hardBreakEscape:p(W),hardBreakTrailing:p(W),htmlFlow:p(oe),htmlFlowData:V,htmlText:p(z),htmlTextData:V,image:p(ne),label:q,labelText:M,lineEnding:L,link:p(ee),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ue,resourceDestinationString:A,resourceTitleString:F,resource:Z,setextHeading:p(O),setextHeadingLineSequence:D,setextHeadingText:T,strong:p(),thematicBreak:p()}};F1(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ie){let G={type:"root",children:[]};const pe={stack:[G],tokenStack:[],config:t,enter:u,exit:m,buffer:c,resume:h,data:n},Q=[];let ye=-1;for(;++ye<ie.length;)if(ie[ye][1].type==="listOrdered"||ie[ye][1].type==="listUnordered")if(ie[ye][0]==="enter")Q.push(ye);else{const Re=Q.pop();ye=a(ie,Re,ye)}for(ye=-1;++ye<ie.length;){const Re=t[ie[ye][0]];_1.call(Re,ie[ye][1].type)&&Re[ie[ye][1].type].call(Object.assign({sliceSerialize:ie[ye][2].sliceSerialize},pe),ie[ye][1])}if(pe.tokenStack.length>0){const Re=pe.tokenStack[pe.tokenStack.length-1];(Re[1]||Rw).call(pe,void 0,Re[0])}for(G.position={start:eo(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:eo(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<t.transforms.length;)G=t.transforms[ye](G)||G;return G}function a(ie,G,pe){let Q=G-1,ye=-1,Re=!1,lt,te,be,Le;for(;++Q<=pe;){const it=ie[Q];switch(it[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{it[0]==="enter"?ye++:ye--,Le=void 0;break}case"lineEndingBlank":{it[0]==="enter"&&(lt&&!Le&&!ye&&!be&&(be=Q),Le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Le=void 0}if(!ye&&it[0]==="enter"&&it[1].type==="listItemPrefix"||ye===-1&&it[0]==="exit"&&(it[1].type==="listUnordered"||it[1].type==="listOrdered")){if(lt){let _e=Q;for(te=void 0;_e--;){const bt=ie[_e];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;te&&(ie[te][1].type="lineEndingBlank",Re=!0),bt[1].type="lineEnding",te=_e}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}be&&(!te||be<te)&&(lt._spread=!0),lt.end=Object.assign({},te?ie[te][1].start:it[1].end),ie.splice(te||Q,0,["exit",lt,it[2]]),Q++,pe++}if(it[1].type==="listItemPrefix"){const _e={type:"listItem",_spread:!1,start:Object.assign({},it[1].start),end:void 0};lt=_e,ie.splice(Q,0,["enter",_e,it[2]]),Q++,pe++,be=void 0,Le=!0}}}return ie[G][1]._spread=Re,pe}function l(ie,G){return pe;function pe(Q){u.call(this,ie(Q),Q),G&&G.call(this,Q)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(ie,G,pe){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([G,pe||void 0]),ie.position={start:eo(G.start),end:void 0}}function p(ie){return G;function G(pe){ie&&ie.call(this,pe),m.call(this,pe)}}function m(ie,G){const pe=this.stack.pop(),Q=this.tokenStack.pop();if(Q)Q[0].type!==ie.type&&(G?G.call(this,ie,Q[0]):(Q[1]||Rw).call(this,ie,Q[0]));else throw new Error("Cannot close `"+ie.type+"` ("+Al({start:ie.start,end:ie.end})+"): it’s not open");pe.position.end=eo(ie.end)}function h(){return YO(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function y(ie){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.lang=ie}function C(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.meta=ie}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.value=ie.replace(/(\r?\n|\r)$/g,"")}function E(ie){const G=this.resume(),pe=this.stack[this.stack.length-1];pe.label=G,pe.identifier=ci(this.sliceSerialize(ie)).toLowerCase()}function N(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.title=ie}function P(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.url=ie}function $(ie){const G=this.stack[this.stack.length-1];if(!G.depth){const pe=this.sliceSerialize(ie).length;G.depth=pe}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function D(ie){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function J(ie){const pe=this.stack[this.stack.length-1].children;let Q=pe[pe.length-1];(!Q||Q.type!=="text")&&(Q=Pt(),Q.position={start:eo(ie.start),end:void 0},pe.push(Q)),this.stack.push(Q)}function V(ie){const G=this.stack.pop();G.value+=this.sliceSerialize(ie),G.position.end=eo(ie.end)}function L(ie){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=G.children[G.children.length-1];pe.position.end=eo(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&(J.call(this,ie),V.call(this,ie))}function W(){this.data.atHardBreak=!0}function oe(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.value=ie}function z(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.value=ie}function H(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.value=ie}function ee(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=G,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function ne(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=G,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function M(ie){const G=this.sliceSerialize(ie),pe=this.stack[this.stack.length-2];pe.label=GM(G),pe.identifier=ci(G).toLowerCase()}function q(){const ie=this.stack[this.stack.length-1],G=this.resume(),pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,pe.type==="link"){const Q=ie.children;pe.children=Q}else pe.alt=G}function A(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.url=ie}function F(){const ie=this.resume(),G=this.stack[this.stack.length-1];G.title=ie}function Z(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function ue(ie){const G=this.resume(),pe=this.stack[this.stack.length-1];pe.label=G,pe.identifier=ci(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function ge(ie){this.data.characterReferenceType=ie.type}function U(ie){const G=this.sliceSerialize(ie),pe=this.data.characterReferenceType;let Q;pe?(Q=T1(G,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Q=sx(G);const ye=this.stack[this.stack.length-1];ye.value+=Q}function ae(ie){const G=this.stack.pop();G.position.end=eo(ie.end)}function me(ie){V.call(this,ie);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(ie)}function ve(ie){V.call(this,ie);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(ie)}function ke(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function Je(){return{type:"inlineCode",value:""}}function Ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ot(){return{type:"emphasis",children:[]}}function Y(){return{type:"heading",depth:0,children:[]}}function Ie(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function Xe(){return{type:"link",title:null,url:"",children:[]}}function Me(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function nt(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function Ke(){return{type:"paragraph",children:[]}}function gt(){return{type:"strong",children:[]}}function Pt(){return{type:"text",value:""}}function at(){return{type:"thematicBreak"}}}function eo(e){return{line:e.line,column:e.column,offset:e.offset}}function F1(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?F1(e,s):QM(e,s)}}function QM(e,t){let n;for(n in t)if(_1.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function Rw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Al({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Al({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Al({start:t.start,end:t.end})+") is still open")}function ZM(e){const t=this;t.parser=n;function n(s){return JM(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function e_(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function t_(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -547,7 +547,7 @@ ${T.stderr}`:T instanceof Error?T.message:String(T))}finally{b(!1)}}}const $=r.j
|
|
|
547
547
|
`).trim(),l=[...t.slice(0,n),...t.slice(s)].join(`
|
|
548
548
|
`).replace(/\n{3,}/g,`
|
|
549
549
|
|
|
550
|
-
`).trim();return{hasSection:!0,todosMarkdown:a,remaining:l}}function jF({projectSlug:e,dependencies:t,blockedReason:n}){const[s,a]=f.useState(!1);if(t.length===0)return null;const l=t.filter(u=>u.status!=="completed"&&u.status!=="review"),c=l.length===0;return c&&!s?r.jsxs("button",{type:"button",onClick:()=>a(!0),className:"flex w-full items-center gap-2 rounded-lg border border-success-foreground/30 bg-success/70 px-4 py-2.5 text-left transition hover:bg-success",children:[r.jsx(Zh,{className:"h-4 w-4 shrink-0 text-success-foreground"}),r.jsxs("span",{className:"text-sm font-medium text-success-foreground",children:["All ",t.length," ",t.length===1?"dependency":"dependencies"," resolved"]}),r.jsx($r,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):r.jsxs("div",{className:"space-y-3",children:[l.length>0&&r.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3",children:[r.jsx(lh,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning-foreground"}),r.jsxs("div",{className:"text-sm text-warning-foreground",children:[r.jsxs("strong",{children:[l.length," ",l.length===1?"dependency is":"dependencies are"," not yet completed."]}),n&&r.jsxs("p",{className:"mt-1 text-warning-foreground/80",children:["Blocked reason: ",n]})]})]}),r.jsx(We,{title:"Dependencies",description:`${t.length-l.length} of ${t.length} resolved`,actions:c?r.jsx("button",{type:"button",onClick:()=>a(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:r.jsx("div",{className:"divide-y divide-border/40",children:t.map(u=>r.jsxs(Ee,{to:`/projects/${e}/assignments/${u.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(pn,{status:u.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:u.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u.slug})]}),u.assignee&&r.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:u.assignee}),r.jsx(nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function kF({links:e}){const t=ln();if(e.length===0)return null;const n=e.filter(a=>!a.isReverse),s=e.filter(a=>a.isReverse);return r.jsx(We,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:r.jsxs("div",{className:"divide-y divide-border/40",children:[n.map(a=>r.jsxs(Ee,{to:`${t}/projects/${a.projectSlug}/assignments/${a.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(s0,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(pn,{status:a.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),r.jsx(nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${a.slug}`)),s.map(a=>r.jsxs(Ee,{to:`${t}/projects/${a.projectSlug}/assignments/${a.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(td,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(pn,{status:a.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),r.jsx(nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${a.slug}`))]})})}function SF(e){const t=new Map;for(const s of e)t.set(s.id,{entry:s,replies:[]});const n=[];for(const s of e){const a=t.get(s.id);s.replyTo&&t.has(s.replyTo)?t.get(s.replyTo).replies.push(a):n.push(a)}return n}function NF(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function RN({projectSlug:e,assignmentSlug:t,entries:n}){const[s,a]=f.useState(n);f.useEffect(()=>{a(n)},[n]);const l=f.useMemo(()=>SF(s),[s]),[c,u]=f.useState(""),[p,m]=f.useState("note"),[h,x]=f.useState(!1),[y,b]=f.useState(null);async function C(w){var N;if(w.preventDefault(),!c.trim())return;x(!0),b(null);const k=`tmp-${Date.now()}`,E={id:k,timestamp:new Date().toISOString(),author:"human",type:p,body:c,resolved:p==="question"?!1:void 0};a(P=>[...P,E]);try{const P=await fetch(NF(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:p})});if(!P.ok){const D=await P.text();throw new Error(D||`HTTP ${P.status}`)}const $=await P.json().catch(()=>null),T=(N=$==null?void 0:$.comment)==null?void 0:N.id;a(D=>D.map(O=>O.id===k?{...O,id:T??O.id}:O)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(P){b(P instanceof Error?P.message:String(P)),a($=>$.filter(T=>T.id!==k))}finally{x(!1)}}async function j(w,k){a(E=>E.map(N=>N.id===w?{...N,resolved:k}:N));try{const E=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`,N=await fetch(E,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!N.ok)throw new Error(`HTTP ${N.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(E){b(E instanceof Error?E.message:String(E)),a(N=>N.map(P=>P.id===w?{...P,resolved:!k}:P))}}return r.jsx(We,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:r.jsxs("div",{className:"space-y-4",children:[l.map(w=>r.jsx(AN,{node:w,onToggleResolved:j,depth:0},w.entry.id)),r.jsxs("form",{onSubmit:C,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:c,onChange:w=>u(w.target.value),className:"w-full rounded border border-border bg-background p-2 text-sm",rows:3,placeholder:"Ask a question, leave a note, or give feedback…"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{value:p,onChange:w=>m(w.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[r.jsx("option",{value:"note",children:"note"}),r.jsx("option",{value:"question",children:"question"}),r.jsx("option",{value:"feedback",children:"feedback"})]}),r.jsx("button",{type:"submit",disabled:h||!c.trim(),className:"shell-action",children:h?"Posting…":"Post comment"}),y?r.jsx("span",{className:"text-xs text-error-foreground",children:y}):null]})]})]})})}function AN({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:a}=e,l=s.type==="question";return r.jsxs("div",{className:Ce("space-y-2",t>0&&"ml-4 border-l border-border pl-4"),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:s.id}),r.jsx("span",{children:"·"}),r.jsx("span",{children:s.timestamp}),r.jsx("span",{children:"·"}),r.jsx("span",{className:"font-medium text-foreground",children:s.author}),r.jsx("span",{children:"·"}),r.jsx("span",{className:Ce("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase",l&&"bg-warning text-warning-foreground",s.type==="feedback"&&"bg-info text-info-foreground",s.type==="note"&&"bg-muted text-muted-foreground"),children:s.type}),l?r.jsxs("button",{type:"button",onClick:()=>n(s.id,!s.resolved),className:Ce("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium",s.resolved?"bg-success text-success-foreground hover:bg-success/80":"bg-muted text-muted-foreground hover:bg-muted/80"),title:s.resolved?"Mark unresolved":"Mark resolved",children:[s.resolved?r.jsx(Zh,{className:"h-3 w-3"}):r.jsx(ZT,{className:"h-3 w-3"}),s.resolved?"resolved":"open"]}):null,s.replyTo?r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(vP,{className:"h-3 w-3"}),s.replyTo]}):null]}),r.jsx(fn,{content:s.body}),a.length>0?r.jsx("div",{className:"space-y-2",children:a.map(c=>r.jsx(AN,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const CF=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function oj(){var lt,te,be,Le,it,_e,bt,_t,Gt;const{slug:e,aslug:t}=$t(),n=Dt(),s=ln(),[a,l]=ms(),[c,u]=f.useState(null),{toast:p,showToast:m,dismissToast:h}=ta(),[x,y]=f.useState(null),[b,C]=f.useState(null),[j,w]=f.useState(null),[k,E]=f.useState(null),[N,P]=f.useState(!1),[$,T]=f.useState(!1),[D,O]=f.useState(0),J=a.get("tab")??"summary",V=Zo(),{data:L,loading:W,error:oe,refetch:z}=bR(e,t),{data:H}=M0(e),{data:ee}=dg(),{data:ne,loading:M,error:q}=wR(e,t),{data:A,loading:F,error:Z}=kR(e,t),I=f.useMemo(()=>{if(!L||!H)return[];const fe=new Map(H.assignments.map(Be=>[Be.slug,Be]));return L.dependsOn.map(Be=>{const Fe=fe.get(Be);return{slug:Be,title:(Fe==null?void 0:Fe.title)??Be,status:(Fe==null?void 0:Fe.status)??"pending",priority:(Fe==null?void 0:Fe.priority)??"medium",assignee:(Fe==null?void 0:Fe.assignee)??null}})},[L,H]),ue=I.filter(fe=>fe.status!=="completed"&&fe.status!=="review");mo("assignment");const ge=f.useMemo(()=>((H==null?void 0:H.assignments)??[]).map(fe=>fe.slug),[H]),U=t?ge.indexOf(t):-1,ae=U>0?ge[U-1]:null,me=U>=0&&U<ge.length-1?ge[U+1]:null,ve=`${s}/projects/${e}/assignments/${t}`;Ht({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${ve}/edit`)}),Ht({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${ve}/plan/edit`)}),Ht({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${ve}/handoff/edit`)}),Ht({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${ve}/decision-record/edit`)}),Ht({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${ve}/scratchpad/edit`)}),Ht({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!ae,handler:()=>ae&&n(`${s}/projects/${e}/assignments/${ae}`)}),Ht({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!me,handler:()=>me&&n(`${s}/projects/${e}/assignments/${me}`)});const ke=f.useMemo(()=>L?vF(L.body):{acceptanceCriteria:[],summaryBody:""},[L]),he=f.useMemo(()=>wF(ke.summaryBody),[ke.summaryBody]),Je=ke.acceptanceCriteria,Ye=Je.filter(fe=>fe.checked).length,ot=Je.length>0&&Ye===Je.length,Y=f.useRef(ot),Ie=f.useRef(!1);if(f.useEffect(()=>{if(L){if(!Ie.current){Y.current=ot,Ie.current=!0;return}ot&&!Y.current&&O(fe=>fe+1),Y.current=ot}},[ot,L]),W)return r.jsx(mt,{label:"Loading assignment workspace…"});if(oe||!L||!e||!t)return r.jsx(wt,{error:oe||"Assignment not found."});const Se=e,Oe=t,Xe=Je.length>0?{checked:Ye,total:Je.length}:void 0,Me=L.availableTransitions??[],nt=Me.filter(fe=>!fe.disabled&&fe.targetStatus!==L.status),Ke=CF.map(fe=>nt.find(Be=>Be.command===fe)).find(Boolean)??nt[0]??null,gt=[];if(ee!=null&&ee.sessions)for(const fe of ee.sessions)for(const Be of fe.windows)for(const Fe of Be.panes)((lt=Fe.assignment)==null?void 0:lt.project)===e&&((te=Fe.assignment)==null?void 0:te.slug)===t&>.push({sessionName:fe.name,command:Fe.command,urls:Fe.urls});async function Pt(fe){u(null);try{await wN(Se,Oe,fe),z()}catch(Be){u(Be.message)}}async function at(fe){u(null);try{const Be=await fetch(`/api/projects/${Se}/assignments/${Oe}/${fe?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Be.ok){const Fe=await Be.json().catch(()=>null);throw new Error((Fe==null?void 0:Fe.error)||`HTTP ${Be.status}`)}z(),m(fe?"Assignment archived":"Assignment restored","success")}catch(Be){u(Be.message)}}async function ie(){T(!0);try{await iF(Se,Oe),n(`${s}/projects/${Se}`)}catch(fe){u(fe.message),T(!1),P(!1)}}async function G(fe,Be){u(null),y(fe.command);try{return await vN(Se,Oe,fe,Be),z(),!0}catch(Fe){return u(Fe.message),!1}finally{y(null)}}function pe(fe){if(jN(fe)){C(fe);return}G(fe)}async function Q(fe,Be){w(null),E(fe);try{const Fe=await fetch(`/api/projects/${Se}/assignments/${Oe}/acceptance-criteria/${fe}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Be})}),Nt=await Fe.json();if(!Fe.ok)throw new Error(Nt.error||`HTTP ${Fe.status}`);z()}catch(Fe){w(Fe.message)}finally{E(null)}}const ye=[...nt.filter(fe=>fe!==Ke).map(fe=>({key:`transition-${fe.command}`,label:fe.label,onSelect:()=>pe(fe),disabled:x===fe.command})),...Me.filter(fe=>fe.disabled||fe.targetStatus===L.status).map(fe=>({key:`transition-${fe.command}`,label:fe.label,disabled:!0,disabledReason:fe.targetStatus===L.status?`Already ${L.status.replace(/_/g," ")}`:fe.disabledReason??fe.warning??fe.description})),...V.statuses.map(fe=>({key:`override-${fe.id}`,label:`Override → ${fe.label}`,onSelect:()=>Pt(fe.id),disabled:fe.id===L.status,disabledReason:fe.id===L.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:iP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:jP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:um,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:nd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:uP,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:L.archived?"unarchive":"archive",label:L.archived?"Restore assignment":"Archive assignment",icon:L.archived?ed:Dd,onSelect:()=>at(!L.archived)},{key:"delete",label:"Delete assignment",icon:or,destructive:!0,onSelect:()=>P(!0)}],Re=(Ke==null?void 0:Ke.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(na,{toast:p,onDismiss:h}),r.jsxs("div",{className:"sticky top-12 z-20 rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm backdrop-blur",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(pn,{status:L.status,progress:Xe}),r.jsx(ea,{type:L.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:L.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",k0(L.updated)]}),ue.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",ue.length," unmet dep",ue.length===1?"":"s"]}),r.jsx(Yg,{externalIds:L.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(TN,{target:{kind:"assignment",id:L.id},worktreePath:((be=L.workspace)==null?void 0:be.worktreePath)??null,repository:((Le=L.workspace)==null?void 0:Le.repository)??null}),!((it=L.workspace)!=null&&it.worktreePath)&&e&&t&&r.jsx(PN,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>z()}),Ke&&r.jsx("button",{type:"button",title:Ke.warning||Ke.description,disabled:x===Ke.command,onClick:()=>pe(Ke),className:Ce("shell-action disabled:cursor-not-allowed disabled:opacity-50",Ke.warning&&"border-warning-foreground/40",Re&&D>0&&"send-to-review-glow"),children:r.jsx("span",{children:x===Ke.command?"Working…":Ke.label})},Re?`review-${D}`:Ke.command),r.jsx(Hg,{items:ye,align:"end"})]})]}),c?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:c}):null,L.blockedReason?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsx("strong",{children:"Blocked reason:"})," ",L.blockedReason]}):null]}),I.length>0&&r.jsx(jF,{projectSlug:e,dependencies:I,blockedReason:L.blockedReason}),L.enrichedLinks&&L.enrichedLinks.length>0&&r.jsx(kF,{links:L.enrichedLinks}),L.referencedBy&&L.referencedBy.length>0&&r.jsx(We,{title:"Referenced by",description:"Other assignments whose Todos, progress, comments, or handoffs link to this one.",children:r.jsx("ul",{className:"space-y-2",children:L.referencedBy.map(fe=>{const Be=fe.sourceProjectSlug===null?`/assignments/${fe.sourceId}`:`${s}/projects/${fe.sourceProjectSlug}/assignments/${fe.sourceSlug}`;return r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ee,{to:Be,className:"text-foreground hover:text-primary",children:fe.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",fe.mentions," mention",fe.mentions===1?"":"s",")"]}),fe.sourceProjectSlug===null?r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"}):null]},fe.sourceId)})})}),r.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(Xg,{value:J,onValueChange:fe=>l({tab:fe}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[ke.acceptanceCriteria.length>0?r.jsx(We,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:r.jsxs("div",{className:"space-y-3",children:[j?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:j}):null,ke.acceptanceCriteria.map((fe,Be)=>{const Fe=k!==null;return r.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-border/60 bg-background/80 px-3 py-3",children:[r.jsx("input",{type:"checkbox",checked:fe.checked,disabled:Fe,onChange:Nt=>Q(Be,Nt.target.checked),className:"mt-1 h-4 w-4 rounded border-border text-primary"}),r.jsx("span",{className:"criterion-label text-sm leading-6","data-checked":fe.checked,children:fe.text})]},`${Be}-${fe.text}`)})]})}):null,he.hasSection?r.jsx(We,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(fn,{content:he.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(We,{title:"Assignment Summary",children:r.jsx(fn,{content:he.remaining,emptyState:ke.acceptanceCriteria.length>0||he.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:L.plan?1:0,content:L.plan?r.jsx("div",{className:"space-y-5",children:r.jsxs(We,{title:"Plan",description:"Shows plan.md only. Versioned plans (plan-v2.md, ...) linked from the Todos section are not yet rendered here — open them from the filesystem.",actions:r.jsxs(Ee,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/plan/edit`,children:[r.jsx(um,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(pn,{status:L.plan.status})}),r.jsx(fn,{content:L.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(St,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:L.scratchpad?1:0,content:L.scratchpad?r.jsx(We,{title:"Scratchpad",actions:r.jsxs(Ee,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(um,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(fn,{content:L.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(St,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((_e=L.handoff)==null?void 0:_e.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:L.handoff?r.jsx(We,{children:r.jsx(fn,{content:L.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(St,{title:"No handoff log yet",description:"Handoffs appear here when an agent runs /complete-assignment or you append one manually."})})},{value:"progress",label:"Progress",count:((bt=L.progress)==null?void 0:bt.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:L.progress&&L.progress.entries.length>0?r.jsx(We,{title:"Progress",description:"Reverse-chronological log of work done on this assignment. Agents append entries via progress.md.",children:r.jsx("ol",{className:"space-y-4",children:L.progress.entries.map((fe,Be)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:fe.timestamp}),r.jsx(fn,{content:fe.body})]},`${fe.timestamp}-${Be}`))})}):r.jsx(St,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((_t=L.comments)==null?void 0:_t.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:L.comments&&L.comments.entries.length>0?r.jsx(RN,{projectSlug:e,assignmentSlug:t,entries:L.comments.entries}):r.jsx(St,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((Gt=L.decisionRecord)==null?void 0:Gt.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:L.decisionRecord?r.jsx(We,{children:r.jsx(fn,{content:L.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(St,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(We,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(to,{label:"ID",value:L.id,copyable:!0}),r.jsx(to,{label:"Priority",value:L.priority}),L.assignee&&r.jsx(to,{label:"Assignee",value:L.assignee}),r.jsx(to,{label:"Updated",value:`${j0(L.updated)} · Created ${w0(L.created)}`}),L.workspace.repository&&r.jsx(to,{label:"Repository",value:L.workspace.repository,copyable:!0}),L.workspace.worktreePath&&r.jsx(to,{label:"Worktree",value:L.workspace.worktreePath,copyable:!0}),L.workspace.branch&&r.jsx(to,{label:"Branch",value:L.workspace.branch,copyable:!0}),L.workspace.parentBranch&&r.jsx(to,{label:"Parent branch",value:L.workspace.parentBranch,copyable:!0}),L.externalIds.map((fe,Be)=>r.jsx(EF,{entry:fe},`${fe.system}:${fe.id}:${Be}`))]})}),gt.length>0&&r.jsx(We,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:gt.map((fe,Be)=>r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",children:fe.command}),r.jsx("span",{className:"text-xs text-muted-foreground",children:fe.sessionName}),fe.urls.map(Fe=>r.jsxs("a",{href:Fe,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[Fe.replace("http://localhost:",":"),r.jsx(yi,{className:"h-2.5 w-2.5"})]},Fe))]},Be))})}),r.jsx(NN,{sessions:ne==null?void 0:ne.sessions,loading:M,error:q}),r.jsx(CN,{summary:A==null?void 0:A.summary,loading:F,error:Z})]})]}),r.jsx(EN,{open:b!==null,action:b,assignmentTitle:L.title,loading:x===(b==null?void 0:b.command),onOpenChange:fe=>{fe||C(null)},onConfirm:async fe=>{if(!b)return;await G(b,fe)&&C(null)}}),r.jsx(sa,{open:N,title:"Delete assignment?",description:`This will permanently delete "${L.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:$,onOpenChange:fe=>{fe||P(!1)},onConfirm:ie})]})}function to({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(Dr,{value:t})]})]})}function EF({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function TF(){var T,D,O,J,V,L,W,oe;const{id:e}=$t(),[t,n]=ms(),s=t.get("tab")??"summary",{data:a,loading:l,error:c,refetch:u}=vR(e),{data:p,loading:m,error:h}=jR(e),{data:x,loading:y,error:b}=SR(a==null?void 0:a.slug),[C,j]=f.useState(!1),[w,k]=f.useState(null),{toast:E,showToast:N,dismissToast:P}=ta();async function $(z){if(e){k(null);try{const H=await fetch(`/api/assignments/${e}/${z?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!H.ok){const ee=await H.json().catch(()=>null);throw new Error((ee==null?void 0:ee.error)||`HTTP ${H.status}`)}u(),N(z?"Assignment archived":"Assignment restored","success")}catch(H){k(H instanceof Error?H.message:"Archive failed")}}}return l?r.jsx(mt,{}):c?r.jsx(wt,{error:c}):a?r.jsxs("div",{className:"space-y-6",children:[r.jsx(na,{toast:E,onDismiss:P}),r.jsxs("header",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(pn,{status:a.status}),r.jsx(ea,{type:a.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:a.id}),r.jsx(Yg,{externalIds:a.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(TN,{target:{kind:"assignment",id:a.id},worktreePath:((T=a.workspace)==null?void 0:T.worktreePath)??null,repository:((D=a.workspace)==null?void 0:D.repository)??null,size:"compact"}),!((O=a.workspace)!=null&&O.worktreePath)&&r.jsx(PN,{assignmentId:a.id,defaultBranch:`syntaur/${a.slug}`,onCreated:()=>u()}),r.jsxs("button",{type:"button",onClick:()=>j(!0),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:[r.jsx($d,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Ee,{to:`/assignments/${a.id}/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>$(!a.archived),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:a.archived?"Restore this assignment":"Archive this assignment",children:[a.archived?r.jsx(ed,{className:"h-3 w-3"}):r.jsx(Dd,{className:"h-3 w-3"}),a.archived?"Restore":"Archive"]})]})]}),r.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:a.title}),a.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",a.blockedReason]}):null,w?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:w}):null]}),r.jsx(We,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(no,{label:"ID",value:a.id,copyable:!0}),r.jsx(no,{label:"Priority",value:a.priority}),a.assignee&&r.jsx(no,{label:"Assignee",value:a.assignee}),r.jsx(no,{label:"Updated",value:`${j0(a.updated)} · Created ${w0(a.created)}`}),a.workspace.repository&&r.jsx(no,{label:"Repository",value:a.workspace.repository,copyable:!0}),a.workspace.worktreePath&&r.jsx(no,{label:"Worktree",value:a.workspace.worktreePath,copyable:!0}),a.workspace.branch&&r.jsx(no,{label:"Branch",value:a.workspace.branch,copyable:!0}),a.workspace.parentBranch&&r.jsx(no,{label:"Parent branch",value:a.workspace.parentBranch,copyable:!0}),a.externalIds.map((z,H)=>r.jsx(PF,{entry:z},`${z.system}:${z.id}:${H}`))]})}),a.referencedBy&&a.referencedBy.length>0?r.jsx(We,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:r.jsx("ul",{className:"space-y-2",children:a.referencedBy.map(z=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ee,{to:z.sourceProjectSlug===null?`/assignments/${z.sourceId}`:`/projects/${z.sourceProjectSlug}/assignments/${z.sourceSlug}`,className:"text-foreground hover:text-primary",children:z.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",z.mentions," mention",z.mentions===1?"":"s",")"]})]},z.sourceId))})}):null,r.jsx(NN,{sessions:p==null?void 0:p.sessions,loading:m,error:h}),r.jsx(CN,{summary:x==null?void 0:x.summary,loading:y,error:b}),r.jsx(Xg,{value:s,onValueChange:z=>n({tab:z}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(We,{title:"Assignment",children:r.jsx(fn,{content:a.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((J=a.progress)==null?void 0:J.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.progress&&a.progress.entries.length>0?r.jsx(We,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:r.jsx("ol",{className:"space-y-4",children:a.progress.entries.map((z,H)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:z.timestamp}),r.jsx(fn,{content:z.body})]},`${z.timestamp}-${H}`))})}):r.jsx(St,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((V=a.comments)==null?void 0:V.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(RN,{projectSlug:null,assignmentSlug:a.id,entries:((L=a.comments)==null?void 0:L.entries)??[]})})},{value:"plan",label:"Plan",content:r.jsx("div",{className:"space-y-5",children:a.plan?r.jsxs(We,{children:[r.jsx(fn,{content:a.plan.body,emptyState:"Plan file exists but is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.id}/plan/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit plan"})})]}):r.jsx(St,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:r.jsx("div",{className:"space-y-5",children:a.scratchpad?r.jsxs(We,{children:[r.jsx(fn,{content:a.scratchpad.body,emptyState:"Scratchpad is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.id}/scratchpad/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit scratchpad"})})]}):r.jsx(St,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((W=a.handoff)==null?void 0:W.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.handoff?r.jsxs(We,{children:[r.jsx(fn,{content:a.handoff.body,emptyState:"No handoff history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.id}/handoff/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append handoff"})})]}):r.jsx(St,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((oe=a.decisionRecord)==null?void 0:oe.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.decisionRecord?r.jsxs(We,{children:[r.jsx(fn,{content:a.decisionRecord.body,emptyState:"No decision history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.id}/decision-record/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append decision"})})]}):r.jsx(St,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]}),r.jsx(Gg,{open:C,onOpenChange:j,currentWorkspace:a.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async z=>{const H=await fetch(`/api/assignments/${encodeURIComponent(a.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:z})});if(!H.ok){const ee=await H.json().catch(()=>({}));throw new Error(ee.error||"Failed to move assignment")}u()}})]}):r.jsx(wt,{error:"Assignment not found"})}function no({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(Dr,{value:t})]})]})}function PF({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function RF({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1}){const[a,l]=f.useState(!1),[c,u]=f.useState(null),[p,m]=f.useState(0),h=f.useRef(null),x=f.useRef(null),y=f.useId(),b=hd(e),C=b.icon,j=f.useCallback(P=>{l(!1),P&&requestAnimationFrame(()=>{var $;($=h.current)==null||$.focus()})},[]),w=f.useCallback(()=>{var $;const P=($=h.current)==null?void 0:$.getBoundingClientRect();P&&u({top:P.top,left:P.left,width:P.width,bottom:P.bottom})},[]);f.useLayoutEffect(()=>{a&&w()},[a,w]),f.useEffect(()=>{if(!a)return;const P=()=>w();return window.addEventListener("scroll",P,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P)}},[a,w]),f.useEffect(()=>{if(!a)return;const P=$=>{var D,O;const T=$.target;T&&((D=x.current)!=null&&D.contains(T)||(O=h.current)!=null&&O.contains(T)||j(!1))};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[a,j]),f.useEffect(()=>{a&&m(0)},[a,t.length]);function k(P){(P.key==="Enter"||P.key===" "||P.key==="ArrowDown")&&(P.preventDefault(),l(!0))}function E(P){if(t.length===0){P.key==="Escape"&&(P.preventDefault(),j(!0));return}if(P.key==="ArrowDown")P.preventDefault(),m($=>($+1)%t.length);else if(P.key==="ArrowUp")P.preventDefault(),m($=>($-1+t.length)%t.length);else if(P.key==="Home")P.preventDefault(),m(0);else if(P.key==="End")P.preventDefault(),m(t.length-1);else if(P.key==="Enter"){P.preventDefault();const $=t[p];$&&(n($),j(!0))}else P.key==="Escape"&&(P.preventDefault(),j(!0))}function N(P){n(P),j(!1)}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:h,type:"button","data-no-drag":!0,disabled:s,"aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?y:void 0,onClick:()=>{s||l(P=>!P)},onKeyDown:k,title:`Status: ${b.label}. Click to change.`,className:Ce(VS(e),"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",s&&"cursor-not-allowed opacity-60"),children:[r.jsx(C,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:b.label})]}),a&&c&&typeof document<"u"?Ts.createPortal(r.jsx("div",{ref:x,id:y,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:E,style:{position:"fixed",top:c.bottom+6,left:c.left,minWidth:Math.max(c.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:t.length===0?r.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No transitions available from this status."}):t.map((P,$)=>{const T=hd(P.targetStatus),D=T.icon,O=$===p;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>m($),onClick:()=>N(P),title:P.warning||P.description,className:Ce("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",O?"bg-foreground/5":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:"flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(D,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:P.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:T.label})]}),P.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:P.warning}):null]},`${P.command}:${P.targetStatus}`)})}),document.body):null]})}function DN({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[a,l]=f.useState(!1);return a?r.jsx(AF,{initialTitle:e,disabled:s,onSave:n,onExit:()=>l(!1)}):r.jsxs("div",{className:"group flex items-baseline gap-1.5",children:[r.jsx("button",{type:"button","data-no-drag":!0,disabled:s,onClick:()=>{s||l(!0)},className:Ce("text-left text-base font-semibold text-foreground transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",s&&"cursor-not-allowed opacity-60"),title:"Click to rename",children:e}),r.jsx(Ee,{to:t,"data-no-drag":!0,"aria-label":"Open detail page",title:"Open detail page",onClick:c=>c.stopPropagation(),className:"text-muted-foreground opacity-0 transition group-hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",children:r.jsx(yi,{className:"h-3.5 w-3.5"})})]})}function AF({initialTitle:e,disabled:t,onSave:n,onExit:s}){const a=f.useRef(e),[l,c]=f.useState(e),[u,p]=f.useState(!1),[m,h]=f.useState(!1),x=f.useRef(null),y=f.useRef(!1);f.useEffect(()=>{const w=x.current;w&&(w.focus(),w.select())},[]);const b=f.useCallback(()=>{var w;h(!0),window.setTimeout(()=>h(!1),260),(w=x.current)==null||w.focus()},[]),C=f.useCallback(async()=>{if(y.current)return;const w=l.trim();if(w.length===0){b();return}if(w===a.current){s();return}y.current=!0,p(!0);try{await n(w)}catch{}finally{p(!1),s()}},[l,s,n,b]);function j(w){w.key==="Enter"?(w.preventDefault(),C()):w.key==="Escape"&&(w.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:x,type:"text","data-no-drag":!0,disabled:t||u,value:l,onChange:w=>c(w.target.value),onKeyDown:j,onBlur:()=>void C(),className:Ce("w-full rounded-sm border border-border bg-background px-1.5 py-0.5 text-base font-semibold text-foreground outline-none transition focus:border-ring focus:ring-1 focus:ring-ring",m&&"syntaur-input-shake",u&&"opacity-70")})}function $N(e){const t=Dt(),n=f.useRef(null),s=f.useRef(!1),a=f.useCallback(()=>{const c=n.current,u=!!(c!=null&&c.querySelector('[aria-expanded="true"]')),p=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(c!=null&&c.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||p||h},[]),l=f.useCallback(c=>{if(s.current)return;const u=c.target;!u||u.closest(mi)||t(e)},[t,e]);return{containerRef:n,onMouseDown:a,onClick:l}}const aj=Rg;function ij(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function DF(e,t){return e.toString()===t.toString()}function lj(){const{workspace:e}=$t(),t=ln(),n=Dt(),s=f.useRef(null);mo("list:assignments");const{data:a,loading:l,error:c,refetch:u}=Md(),p=Zo(),m=ef(),[h,x]=ms(),y=e?`w:${e}`:null,b=lN(y),C=f.useRef(void 0),j=f.useMemo(()=>qS(p.order),[p]),w=f.useMemo(()=>{const _={};for(const le of j)_[le]=cc(p,le);return _},[j,p]),k=f.useMemo(()=>j.map(_=>({id:_,title:w[_]??_,description:Zd(_)})),[j,w]),E=f.useMemo(()=>m.definitions.map(_=>({id:_.id,title:ii(m,_.id),description:_.description})),[m]),N="__unknown_type__",P=f.useMemo(()=>new Set(["all",...j]),[j]),$=h.get("view"),T=h.get("status"),D=h.get("stale"),O=$&&aj.includes($)?$:"kanban";function J(_){if(!_)return[];const le=[];for(const xe of _.split(",")){const De=xe.trim();!De||De==="all"||!P.has(De)||le.includes(De)||le.push(De)}return le}const V=f.useCallback(_=>{x(le=>{const xe=new URLSearchParams(le);return _==="kanban"?xe.delete("view"):xe.set("view",_),xe})},[x]),[L,W]=f.useState(""),[oe,z]=f.useState(()=>J(T)),[H,ee]=f.useState(()=>tt(b.filters.priority)),[ne,M]=f.useState(()=>tt(b.filters.type)),[q,A]=f.useState(()=>tt(b.filters.assignee)),[F,Z]=f.useState(()=>tt(b.filters.project)),[I,ue]=f.useState(()=>tt(b.filters.tags)),[ge,U]=f.useState(null),[ae,me]=f.useState(()=>ij(D)),[ve,ke]=f.useState(()=>b.sortField),[he,Je]=f.useState(()=>b.sortDirection),[Ye,ot]=f.useState(()=>({hidden:[]})),[Y,Ie]=f.useState(()=>({hidden:[]})),[Se,Oe]=f.useState(()=>b.grouping),Xe=Se==="type"?"type":"status",[Me,nt]=f.useState(()=>new Set),[Ke,gt]=f.useState([]),{toast:Pt,showToast:at,dismissToast:ie}=ta(),[G,pe]=f.useState(null),[Q,ye]=f.useState(null),[Re,lt]=f.useState(null),[te,be]=f.useState(null),[Le,it]=f.useState(null),[_e,bt]=f.useState(null),[_t,Gt]=f.useState(null),[fe,Be]=f.useState(null),[Fe,Nt]=f.useState(null),[$n,Yt]=f.useState(!1),[sn,Wt]=f.useState(!1),Gn=e?{kind:"workspace",workspace:e}:{kind:"global"},xt=h.get("loadView"),{view:jn,loading:Rt,error:re}=Go(xt),{view:Ae,loading:Qe,error:Ft}=Go(Fe),hn=f.useRef(null);f.useEffect(()=>{gt((a==null?void 0:a.assignments)??[])},[a]),f.useEffect(()=>{Fe&&!Qe&&!Ft&&!Ae&&Nt(null)},[Ae,Ft,Fe,Qe]),f.useEffect(()=>{Nt(null),hn.current=null,U(null),W("")},[e]),f.useEffect(()=>{const _=J(T);LD(_,oe)||z(_);const le=ij(D);le!==ae&&me(le)},[ae,D,oe,T]),f.useEffect(()=>{C.current===y&&x(_=>{const le=new URLSearchParams(_);return oe.length===0?le.delete("status"):le.set("status",oe.join(",")),ae==="all"?le.delete("stale"):ae==="stale"?le.set("stale","1"):le.set("stale","0"),DF(_,le)?_:le})},[ae,y,x,oe]),f.useEffect(()=>{ee(tt(b.filters.priority)),M(tt(b.filters.type)),A(tt(b.filters.assignee)),Z(tt(b.filters.project)),ue(tt(b.filters.tags)),ke(b.sortField),Je(b.sortDirection),Oe(b.grouping)},[b.filters.priority,b.filters.type,b.filters.assignee,b.filters.project,b.filters.tags,b.sortField,b.sortDirection,b.grouping]),f.useEffect(()=>{if(C.current===y)return;let _=!1;return vx().then(le=>{if(_||C.current===y)return;const xe=nS(le,y),De=xe.defaultView,ct=tt(xe.filters.status),pt=xe.filters.activity??"all",yt=new URLSearchParams(window.location.search);let cn=!1;const on=new URLSearchParams(yt);yt.get("view")===null&&De!=="kanban"&&aj.includes(De)&&(on.set("view",De),cn=!0),yt.get("status")===null&&ct.length>0&&(on.set("status",ct.join(",")),z(ct),cn=!0),yt.get("stale")===null&&pt!=="all"&&(on.set("stale",pt==="stale"?"1":"0"),me(pt),cn=!0),cn&&x(on,{replace:!0}),queueMicrotask(()=>{C.current=y})}),()=>{_=!0}},[y]);const Ct=f.useCallback(_=>{(y===null?uN(_):dN(y,_)).catch(xe=>{console.warn("Failed to persist view prefs:",xe)})},[y]),jf=f.useCallback(_=>{V(_),Ct({defaultView:_})},[V,Ct]),Ai=f.useCallback(_=>{z(_),Ct({filters:{status:_}})},[Ct]),_r=f.useCallback(_=>{ee(_),Ct({filters:{priority:_}})},[Ct]),oa=f.useCallback(_=>{M(_),Ct({filters:{type:_}})},[Ct]),aa=f.useCallback(_=>{A(_),Ct({filters:{assignee:_}})},[Ct]),Di=f.useCallback(_=>{Z(_),Ct({filters:{project:_}})},[Ct]),ia=f.useCallback(_=>{ue(_),Ct({filters:{tags:_}})},[Ct]),la=f.useCallback(_=>{me(_),Ct({filters:{activity:_}})},[Ct]),ca=f.useCallback(_=>{ke(_),Ct({sortField:_})},[Ct]),go=f.useCallback(_=>{Je(_),Ct({sortDirection:_})},[Ct]),kf=f.useCallback(_=>{Oe(_),Ct({grouping:_})},[Ct]),ua=f.useCallback(()=>({viewMode:O,filters:{status:oe,priority:H,type:ne,assignee:q,project:F,tags:I,activity:ae,dateRange:Xl(ge),search:L},sortField:ve,sortDirection:he,listSectionVisibility:{collapsed:[...Me]},kanbanColumnVisibility:Ye,tableColumnVisibility:Y}),[O,oe,H,ne,q,F,I,ae,ge,L,ve,he,Me,Ye,Y]),Lt=f.useCallback(_=>{gN(_,{setViewMode:V,setStatusFilter:Ai,setPriorityFilter:_r,setTypeFilter:oa,setAssigneeFilter:aa,setProjectFilter:Di,setTagsFilter:ia,setActivityFilter:la,setDateRange:U,setSearch:W,setSortField:ca,setSortDirection:go,setListSectionVisibility:le=>nt(new Set(le.collapsed)),setKanbanColumnVisibility:ot,setTableColumnVisibility:Ie}),Nt(_.id)},[V,Ai,_r,oa,aa,Di,ia,la,ca,go]),Sf=f.useCallback(_=>{Lt(_),hn.current=_.id,x(le=>{const xe=new URLSearchParams(le);return xe.set("loadView",_.id),xe},{replace:!0})},[Lt,x]),$i=f.useCallback(async _=>{try{const le=Jl({name:_,context:{workspace:e??null,projectSlug:null},state:ua()}),xe=await Wd(le),De=xe.views[xe.views.length-1];Nt((De==null?void 0:De.id)??null),De&&(hn.current=De.id,x(ct=>{const pt=new URLSearchParams(ct);return pt.set("loadView",De.id),pt},{replace:!0})),Yt(!1),Wt(!1),at(`Saved view "${_}"`,"success")}catch(le){throw at(le instanceof Error?le.message:"Failed to save view","error"),le}},[ua,x,at,e]),xc=f.useCallback(async()=>{if(!(!Fe||!Ae))try{const _=Jl({name:Ae.name,context:{workspace:e??null,projectSlug:null},state:ua()}),le=jx(Ae.config,_.config,_.config);await $g(Fe,{config:le}),at("View updated","success")}catch(_){at(_ instanceof Error?_.message:"Failed to update view","error")}},[ua,Ae,Fe,at,e]);f.useEffect(()=>{if(!xt){hn.current=null;return}if(hn.current!==xt&&(Fe&&Fe!==xt&&Nt(null),!Rt)){if(re){at("Couldn't load saved view — try again","error");return}if(jn){hn.current=xt,Lt(jn),x(_=>{const le=new URLSearchParams(_);return le.delete("loadView"),le},{replace:!0});return}hn.current=xt,at("Saved view no longer exists","error"),x(_=>{const le=new URLSearchParams(_);return le.delete("loadView"),le},{replace:!0})}},[xt,jn,Rt,re,Fe,Lt,x,at]);const Bn=f.useMemo(()=>Ke.filter(_=>e?e==="_ungrouped"?_.projectWorkspace===null:_.projectWorkspace===e:!0),[Ke,e]),Nf=f.useMemo(()=>Array.from(new Set(Bn.map(_=>_.status))).sort(),[Bn]),yc=f.useMemo(()=>Array.from(new Set(Bn.map(_=>_.priority))).sort(),[Bn]),da=f.useMemo(()=>Array.from(new Set(Bn.map(_=>_.assignee??"__unassigned__"))).sort(),[Bn]),br=f.useMemo(()=>Array.from(new Map(Bn.filter(_=>_.projectSlug!==null).map(_=>[_.projectSlug,_.projectTitle]))).sort(([,_],[,le])=>_.localeCompare(le)),[Bn]),Cf=f.useMemo(()=>Array.from(new Set(Bn.flatMap(_=>_.tags??[]))).sort(),[Bn]),jt=f.useMemo(()=>Ke.filter(_=>Wg(_,{status:oe,priority:H,type:ne,assignee:q,project:F,tags:I,activity:ae,dateRange:Xl(ge)},{workspace:e,search:L})),[ae,Ke,L,oe,H,ne,q,F,I,ge,e]),xo=f.useMemo(()=>uc(jt,ve,he),[jt,ve,he]),Li=f.useMemo(()=>{if(Se==="none")return[{id:"__all__",label:"All assignments",items:jt}];if(Se==="type"){const _=m.definitions.map(De=>({id:De.id,label:ii(m,De.id),items:jt.filter(ct=>ct.type===De.id)})),le=new Set(m.definitions.map(De=>De.id)),xe=jt.filter(De=>!De.type||!le.has(De.type));return xe.length>0&&_.push({id:N,label:"Other",items:xe}),_}if(Se==="priority")return["critical","high","medium","low"].map(le=>({id:le,label:le.charAt(0).toUpperCase()+le.slice(1),items:jt.filter(xe=>xe.priority===le)}));if(Se==="assignee")return Array.from(new Set(jt.map(le=>le.assignee??"__unassigned__"))).sort().map(le=>({id:le,label:le==="__unassigned__"?"Unassigned":le,items:jt.filter(xe=>(xe.assignee??"__unassigned__")===le)}));if(Se==="project"){const _=new Map;for(const le of jt){const xe=le.projectSlug??"__standalone__",De=le.projectTitle??"Standalone";_.has(xe)||_.set(xe,De)}return Array.from(_.entries()).sort(([,le],[,xe])=>le.localeCompare(xe)).map(([le,xe])=>({id:le,label:xe,items:jt.filter(De=>(De.projectSlug??"__standalone__")===le)}))}return j.map(_=>({id:_,label:w[_]??_,items:jt.filter(le=>le.status===_)}))},[Se,jt,m,j,w]),Ef=f.useMemo(()=>{const _=new Set(m.definitions.map(xe=>xe.id));return jt.some(xe=>!xe.type||!_.has(xe.type))?[...E,{id:N,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,jt]),{visibleItems:fa,visibleIndexByKey:yo}=f.useMemo(()=>{let _;if(O==="table")_=xo;else if(O==="kanban"){const xe=new Set(m.definitions.map(De=>De.id));Xe==="type"?_=[...m.definitions.flatMap(De=>jt.filter(ct=>ct.type===De.id)),...jt.filter(De=>!De.type||!xe.has(De.type))]:_=j.flatMap(De=>jt.filter(ct=>ct.status===De))}else _=Li.flatMap(xe=>xe.items);const le=new Map;return _.forEach((xe,De)=>le.set(tn(xe),De)),{visibleItems:_,visibleIndexByKey:le}},[O,xo,Li,Xe,m,jt,j]),{hotkeyRowProps:xs}=ac(fa,{scope:"list:assignments",onOpen:_=>{if(_.projectSlug===null){n(`/assignments/${_.id}`);return}const le=_.projectWorkspace?`/w/${_.projectWorkspace}`:t;n(`${le}/projects/${_.projectSlug}/assignments/${_.slug}`)}});if(Ht({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var _;return(_=s.current)==null?void 0:_.focus()}}),Ht({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),l)return r.jsx(mt,{label:"Loading assignments board…"});if(c||!a)return r.jsx(wt,{error:c||"Assignments board is unavailable."});async function bo({item:_,toColumnId:le,action:xe,reason:De}){pe(tn(_));const ct=Ke;gt(pt=>pt.map(yt=>tn(yt)===tn(_)?{...yt,status:le,blockedReason:le==="blocked"?De??yt.blockedReason:null}:yt));try{if(_.projectSlug===null){if(!xe)throw new Error("Standalone assignments require a transition action, not status override.");const yt=await fetch(`/api/assignments/${encodeURIComponent(_.id)}/transitions/${encodeURIComponent(xe.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(De?{reason:De}:{})});if(!yt.ok)throw new Error((await yt.json()).error??`HTTP ${yt.status}`);const on=(await yt.json()).assignment;gt(kn=>kn.map(Un=>tn(Un)===tn(_)?{...Un,status:on.status,blockedReason:on.blockedReason,availableTransitions:on.availableTransitions,updated:on.updated}:Un));return}const pt=xe?await vN(_.projectSlug,_.slug,xe,De):await wN(_.projectSlug,_.slug,le);return gt(yt=>yt.map(cn=>tn(cn)===tn(_)?{...cn,status:pt.status,blockedReason:pt.blockedReason,availableTransitions:pt.availableTransitions,updated:pt.updated}:cn)),u(),!0}catch(pt){return gt(ct),at(pt.message,"error"),!1}finally{pe(null)}}async function vo({item:_,toColumnId:le,action:xe}){if(_.status===le)return;const De=xe??kl(_,le);if(De!=null&&De.disabled){at(De.disabledReason||`Cannot move this assignment to ${le}.`,"error");return}if(De&&jN(De)){be({item:_,toColumnId:le,action:De});return}await bo({item:_,toColumnId:le,action:De})}async function Oi(_,le){if(le===_.title)return;const xe=tn(_),De=Ke;gt(ct=>ct.map(pt=>tn(pt)===xe?{...pt,title:le}:pt)),pe(xe);try{const ct=_.projectSlug===null?await cF({id:_.id,title:le}):await lF({projectSlug:_.projectSlug,assignmentSlug:_.slug,title:le});gt(pt=>pt.map(yt=>tn(yt)===xe?{...yt,title:ct.title,updated:ct.updated}:yt)),u()}catch(ct){throw gt(De),at(ct.message,"error"),ct}finally{pe(null)}}function Ii(_){nt(le=>{const xe=new Set(le);return xe.has(_)?xe.delete(_):xe.add(_),xe})}function bc(_){ve===_?go(he==="asc"?"desc":"asc"):(ca(_),go("asc"))}const Ln=Q?Ke.find(_=>tn(_)===Q)??null:null;function wo(_,le){_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",le),ye(le)}function Mi(){ye(null),lt(null)}function _i(_,le){if(!Ln)return;const xe=kl(Ln,le);Ln.status===le||xe!=null&&xe.disabled||(_.preventDefault(),_.dataTransfer.dropEffect="move",lt(le))}function Et(_,le){Re===le&&!_.currentTarget.contains(_.relatedTarget)&<(null)}function vc(_,le){if(_.preventDefault(),!Ln||Ln.status===le){Mi();return}Mi(),vo({item:Ln,toColumnId:le})}function Zr({field:_,children:le}){const xe=ve===_;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>bc(_),className:"inline-flex items-center gap-1 hover:text-foreground",children:[le,xe?he==="asc"?r.jsx(i0,{className:"h-3 w-3"}):r.jsx($r,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":b.density,children:[r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(Ee,{to:`${t}/assignments/new`,className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(rn,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(Kg,{children:[r.jsx(tf,{ref:s,value:L,onChange:W,placeholder:"Search assignments or projects"}),r.jsx(Rn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",options:Nf.map(_=>({value:_,label:w[_]??_})),value:oe,onChange:Ai}),r.jsx(Rn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",options:yc.map(_=>({value:_,label:_[0].toUpperCase()+_.slice(1)})),value:H,onChange:_r}),r.jsx(Rn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",options:m.definitions.map(_=>({value:_.id,label:ii(m,_.id)})),value:ne,onChange:oa}),r.jsx(Rn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",options:[{value:"__unassigned__",label:"Unassigned"},...da.filter(_=>_!=="__unassigned__").map(_=>({value:_,label:_}))],value:q,onChange:aa}),r.jsx(Rn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",options:[{value:"__standalone__",label:"Standalone"},...br.map(([_,le])=>({value:_,label:le}))],value:F,onChange:Di}),r.jsx(Rn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",options:Cf.map(_=>({value:_,label:_})),value:I,onChange:ia}),r.jsx(wx,{className:"max-w-[200px]",value:ge,onChange:U}),r.jsxs("select",{value:ae,onChange:_=>la(_.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]}),r.jsx("select",{value:O==="kanban"?Xe:Se,onChange:_=>kf(_.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:DD.map(_=>{const le=O==="kanban"&&_!=="status"&&_!=="type",xe=_==="none"?"No grouping":`Group: ${_.charAt(0).toUpperCase()+_.slice(1)}`;return r.jsx("option",{value:_,disabled:le,children:le?`${xe} (list only)`:xe},_)})}),r.jsx(nf,{value:O,onChange:_=>jf(_),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),O==="table"?r.jsx(oN,{visibility:Y,onChange:Ie}):null,r.jsx(pN,{scope:Gn,loadedViewId:Fe,onApply:Sf,onOpenSaveDialog:()=>{Wt(!1),Yt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Ae?xc():(Wt(!1),Yt(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:Ae?`Update ${Ae.name}`:"Save current view",children:Ae?`Update '${Ae.name}'`:"Save view"}),Ae?r.jsx("button",{type:"button",onClick:()=>{Wt(!0),Yt(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),a.assignments.length===0?r.jsx(St,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Ee,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(eg,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):jt.length===0?r.jsx(St,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):O==="table"?(()=>{const _=new Set(Y.hidden),le=xe=>xe==="title"||!_.has(xe);return r.jsx(We,{title:`${xo.length} assignment${xo.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[le("title")?r.jsx(Zr,{field:"title",children:"Assignment"}):null,le("status")?r.jsx(Zr,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),le("priority")?r.jsx(Zr,{field:"priority",children:"Priority"}):null,le("assignee")?r.jsx(Zr,{field:"assignee",children:"Assignee"}):null,le("dependencies")?r.jsx(Zr,{field:"dependencies",children:"Dependencies"}):null,le("created")?r.jsx(Zr,{field:"created",children:"Created"}):null,le("updated")?r.jsx(Zr,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:xo.map((xe,De)=>r.jsxs(LF,{detailHref:Kl(xe),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...xs(De),children:[le("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(DN,{title:xe.title,detailHref:Kl(xe),onSave:ct=>Oi(xe,ct),disabled:G===tn(xe)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:xe.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"mt-0.5 inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:xe.id,children:[xe.id.slice(0,8),r.jsx(Dr,{value:xe.id})]})]}):null,le("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:xe.status,disabled:G===tn(xe),onChange:ct=>vo({item:xe,toColumnId:ct.target.value}),className:Ce("appearance-none rounded-full border px-2.5 py-0.5 text-xs font-semibold tracking-wide outline-none","cursor-pointer bg-[length:12px] bg-[right_6px_center] bg-no-repeat pr-6",`bg-[url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E")]`,(md[xe.status]??md.pending).className,G===tn(xe)&&"animate-pulse opacity-60"),children:j.map(ct=>{const pt=xe.status===ct?void 0:kl(xe,ct),yt=(pt==null?void 0:pt.disabled)??!1;return r.jsx("option",{value:ct,disabled:yt,title:yt?(pt==null?void 0:pt.disabledReason)??void 0:void 0,children:w[ct]},ct)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(ea,{type:xe.type,compact:!0})}),le("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:xe.priority}):null,le("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:xe.assignee??"Unassigned"}):null,le("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:xe.dependsOn.length}):null,le("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Dn(xe.created)}):null,le("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Dn(xe.updated)}):null]},tn(xe)))})]})})})})():O==="list"?r.jsx("div",{className:"space-y-3",children:Li.map(({id:_,label:le,items:xe})=>{var on;if(xe.length===0&&!(Ln&&Se==="status"))return null;const De=!Me.has(_),ct=Se==="status",pt=ct&&Ln?Ln.status!==_&&!((on=kl(Ln,_))!=null&&on.disabled):!1,yt=ct&&Ln?Ln.status!==_&&!pt:!1,cn=ct&&Re===_;return r.jsxs("div",{className:Ce("rounded-lg border border-border/60 bg-card/90 transition",cn&&pt&&"ring-2 ring-ring/30",yt&&"border-dashed opacity-65"),onDragOver:ct?kn=>_i(kn,_):void 0,onDragLeave:ct?kn=>Et(kn,_):void 0,onDrop:ct?kn=>vc(kn,_):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>Ii(_),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx($r,{className:`h-4 w-4 text-muted-foreground transition-transform ${De?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:le}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:xe.length})]}),De&&xe.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:xe.map(kn=>{const Un=tn(kn),Fr=Q===Un,wc=yo.get(Un)??-1,jo=ct;return r.jsx("div",{draggable:jo,onDragStart:jo?vr=>wo(vr,Un):void 0,onDragEnd:jo?Mi:void 0,...wc>=0?xs(wc):{},className:Ce("transition",jo&&"cursor-grab active:cursor-grabbing",Fr&&"scale-[0.98] opacity-50"),children:r.jsx(cj,{assignment:kn,dragging:Fr,transitioning:G===Un,onPillSelect:vr=>void vo({item:kn,toColumnId:vr.targetStatus,action:vr}),onRenameTitle:vr=>Oi(kn,vr)})},Un)})})]},_)})}):r.jsx(Qd,{columns:Xe==="type"?Ef:k,items:jt,getItemId:tn,getColumnId:_=>Xe==="type"?_.type&&m.definitions.some(le=>le.id===_.type)?_.type:N:_.status,canDrop:({item:_,fromColumnId:le,toColumnId:xe})=>{if(le===xe)return{allowed:!0};const De=kl(_,xe);return De!=null&&De.disabled?{allowed:!1,reason:De.disabledReason||De.description}:{allowed:!0,reason:De?De.warning||De.description:`Move to ${xe} (direct status change).`}},onMove:Xe==="type"?void 0:({item:_,toColumnId:le})=>vo({item:_,toColumnId:le}),dragDisabled:Xe==="type",getExternalDragData:_=>_.projectSlug===null?{type:"standalone-assignment",id:_.id}:{type:"project-assignment",id:_.id},onCardContextMenu:(_,le)=>{le.preventDefault(),it({item:_,anchor:{x:le.clientX,y:le.clientY}})},emptyMessage:_=>`No ${_.title.toLowerCase()} assignments.`,hiddenColumnIds:Ye.hidden,onHideColumn:_=>ot(le=>({hidden:le.hidden.includes(_)?le.hidden.filter(De=>De!==_):[...le.hidden,_]})),renderCard:(_,{dragging:le})=>{const xe=yo.get(tn(_))??-1;return r.jsx("div",{...xe>=0?xs(xe):{},children:r.jsx(cj,{assignment:_,dragging:le,transitioning:G===tn(_),onPillSelect:De=>void vo({item:_,toColumnId:De.targetStatus,action:De}),onRenameTitle:De=>Oi(_,De)})})}}),r.jsx(na,{toast:Pt,onDismiss:ie}),r.jsx(fN,{open:$n,onOpenChange:_=>{Yt(_),_||Wt(!1)},initialName:sn&&Ae?`${Ae.name} (copy)`:"",title:sn?"Save as new view":"Save view",onSubmit:$i}),r.jsx(EN,{open:te!==null,action:(te==null?void 0:te.action)??null,assignmentTitle:(te==null?void 0:te.item.title)??"Assignment",loading:G===(te?tn(te.item):null),onOpenChange:_=>{_||be(null)},onConfirm:async _=>{if(!te)return;const le=te;await bo({item:le.item,toColumnId:le.toColumnId,action:le.action,reason:_})&&be(null)}}),r.jsx(GS,{anchor:(Le==null?void 0:Le.anchor)??null,items:Le?$F(Le.item,{onEdit:()=>{const _=Le.item,le=_.projectSlug===null?`/assignments/${_.id}`:`${_.projectWorkspace?`/w/${_.projectWorkspace}`:t}/projects/${_.projectSlug}/assignments/${_.slug}`;n(le)},onDelete:()=>bt(Le.item),onMove:()=>Be(Le.item)}):[],onClose:()=>it(null)}),r.jsx(sa,{open:_e!==null,title:"Delete assignment?",description:_e?`"${_e.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:_t!==null,onOpenChange:_=>{!_&&_t===null&&bt(null)},onConfirm:async()=>{if(!_e||_e.projectSlug===null){bt(null);return}const _=tn(_e);Gt(_);try{const le=await fetch(`/api/projects/${encodeURIComponent(_e.projectSlug)}/assignments/${encodeURIComponent(_e.slug)}`,{method:"DELETE"});if(!le.ok){const xe=await le.json().catch(()=>({}));throw new Error(xe.error||"Failed to delete assignment")}bt(null),u()}catch(le){alert(le instanceof Error?le.message:"Failed to delete assignment")}finally{Gt(null)}}}),r.jsx(Gg,{open:fe!==null,onOpenChange:_=>{_||Be(null)},currentWorkspace:(fe==null?void 0:fe.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async _=>{if(!fe)return;const le=await fetch(`/api/assignments/${encodeURIComponent(fe.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:_})});if(!le.ok){const xe=await le.json().catch(()=>({}));throw new Error(xe.error||"Failed to move assignment")}u()}})]})}function $F(e,t){const n=[{key:"edit",label:"Edit",icon:bi,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:or,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:$d,onSelect:t.onMove}),n}function LF({detailHref:e,children:t,className:n,...s}){const a=$N(e);return r.jsx("tr",{...s,ref:a.containerRef,className:n,onMouseDown:a.onMouseDown,onClick:a.onClick,children:t})}function cj({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:a}){var p;const l=Kl(e),c=!!(s&&a),u=$N(l);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:Ce("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",c&&"cursor-pointer"),onMouseDown:c?u.onMouseDown:void 0,onClick:c?u.onClick:void 0,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[c?r.jsx(DN,{title:e.title,detailHref:l,onSave:a,disabled:n}):r.jsx(Ee,{to:l,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:e.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:e.id??"",children:[(p=e.id)==null?void 0:p.slice(0,8),e.id&&r.jsx(Dr,{value:e.id})]})]}),c?r.jsx(RF,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n}):r.jsx(pn,{status:e.status})]}),e.blockedReason?r.jsx("p",{className:"mt-3 rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground",children:e.blockedReason}):null,r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ea,{type:e.type}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:e.priority}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:e.assignee??"Unassigned"}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," dependencies"]})]}),r.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{children:n?"Updating":t?"Dragging":"Source-first"}),r.jsx("span",{children:Dn(e.updated)})]})]})}function kl(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function tn(e){return e.id||e.slug||"unknown"}function Mr(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!t)return{order:[],blocks:new Map,body:e};const n=t[1],s=e.slice(t[0].length),a=n.split(`
|
|
550
|
+
`).trim();return{hasSection:!0,todosMarkdown:a,remaining:l}}function jF({projectSlug:e,dependencies:t,blockedReason:n}){const[s,a]=f.useState(!1);if(t.length===0)return null;const l=t.filter(u=>u.status!=="completed"&&u.status!=="review"),c=l.length===0;return c&&!s?r.jsxs("button",{type:"button",onClick:()=>a(!0),className:"flex w-full items-center gap-2 rounded-lg border border-success-foreground/30 bg-success/70 px-4 py-2.5 text-left transition hover:bg-success",children:[r.jsx(Zh,{className:"h-4 w-4 shrink-0 text-success-foreground"}),r.jsxs("span",{className:"text-sm font-medium text-success-foreground",children:["All ",t.length," ",t.length===1?"dependency":"dependencies"," resolved"]}),r.jsx($r,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):r.jsxs("div",{className:"space-y-3",children:[l.length>0&&r.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3",children:[r.jsx(lh,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning-foreground"}),r.jsxs("div",{className:"text-sm text-warning-foreground",children:[r.jsxs("strong",{children:[l.length," ",l.length===1?"dependency is":"dependencies are"," not yet completed."]}),n&&r.jsxs("p",{className:"mt-1 text-warning-foreground/80",children:["Blocked reason: ",n]})]})]}),r.jsx(We,{title:"Dependencies",description:`${t.length-l.length} of ${t.length} resolved`,actions:c?r.jsx("button",{type:"button",onClick:()=>a(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:r.jsx("div",{className:"divide-y divide-border/40",children:t.map(u=>r.jsxs(Ee,{to:`/projects/${e}/assignments/${u.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(pn,{status:u.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:u.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u.slug})]}),u.assignee&&r.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:u.assignee}),r.jsx(nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function kF({links:e}){const t=ln();if(e.length===0)return null;const n=e.filter(a=>!a.isReverse),s=e.filter(a=>a.isReverse);return r.jsx(We,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:r.jsxs("div",{className:"divide-y divide-border/40",children:[n.map(a=>r.jsxs(Ee,{to:`${t}/projects/${a.projectSlug}/assignments/${a.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(s0,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(pn,{status:a.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),r.jsx(nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${a.slug}`)),s.map(a=>r.jsxs(Ee,{to:`${t}/projects/${a.projectSlug}/assignments/${a.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(td,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(pn,{status:a.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),r.jsx(nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${a.slug}`))]})})}function SF(e){const t=new Map;for(const s of e)t.set(s.id,{entry:s,replies:[]});const n=[];for(const s of e){const a=t.get(s.id);s.replyTo&&t.has(s.replyTo)?t.get(s.replyTo).replies.push(a):n.push(a)}return n}function NF(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function RN({projectSlug:e,assignmentSlug:t,entries:n}){const[s,a]=f.useState(n);f.useEffect(()=>{a(n)},[n]);const l=f.useMemo(()=>SF(s),[s]),[c,u]=f.useState(""),[p,m]=f.useState("note"),[h,x]=f.useState(!1),[y,b]=f.useState(null);async function C(w){var N;if(w.preventDefault(),!c.trim())return;x(!0),b(null);const k=`tmp-${Date.now()}`,E={id:k,timestamp:new Date().toISOString(),author:"human",type:p,body:c,resolved:p==="question"?!1:void 0};a(P=>[...P,E]);try{const P=await fetch(NF(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:p})});if(!P.ok){const D=await P.text();throw new Error(D||`HTTP ${P.status}`)}const $=await P.json().catch(()=>null),T=(N=$==null?void 0:$.comment)==null?void 0:N.id;a(D=>D.map(O=>O.id===k?{...O,id:T??O.id}:O)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(P){b(P instanceof Error?P.message:String(P)),a($=>$.filter(T=>T.id!==k))}finally{x(!1)}}async function j(w,k){a(E=>E.map(N=>N.id===w?{...N,resolved:k}:N));try{const E=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`,N=await fetch(E,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!N.ok)throw new Error(`HTTP ${N.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(E){b(E instanceof Error?E.message:String(E)),a(N=>N.map(P=>P.id===w?{...P,resolved:!k}:P))}}return r.jsx(We,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:r.jsxs("div",{className:"space-y-4",children:[l.map(w=>r.jsx(AN,{node:w,onToggleResolved:j,depth:0},w.entry.id)),r.jsxs("form",{onSubmit:C,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:c,onChange:w=>u(w.target.value),className:"w-full rounded border border-border bg-background p-2 text-sm",rows:3,placeholder:"Ask a question, leave a note, or give feedback…"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{value:p,onChange:w=>m(w.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[r.jsx("option",{value:"note",children:"note"}),r.jsx("option",{value:"question",children:"question"}),r.jsx("option",{value:"feedback",children:"feedback"})]}),r.jsx("button",{type:"submit",disabled:h||!c.trim(),className:"shell-action",children:h?"Posting…":"Post comment"}),y?r.jsx("span",{className:"text-xs text-error-foreground",children:y}):null]})]})]})})}function AN({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:a}=e,l=s.type==="question";return r.jsxs("div",{className:Ce("space-y-2",t>0&&"ml-4 border-l border-border pl-4"),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:s.id}),r.jsx("span",{children:"·"}),r.jsx("span",{children:s.timestamp}),r.jsx("span",{children:"·"}),r.jsx("span",{className:"font-medium text-foreground",children:s.author}),r.jsx("span",{children:"·"}),r.jsx("span",{className:Ce("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase",l&&"bg-warning text-warning-foreground",s.type==="feedback"&&"bg-info text-info-foreground",s.type==="note"&&"bg-muted text-muted-foreground"),children:s.type}),l?r.jsxs("button",{type:"button",onClick:()=>n(s.id,!s.resolved),className:Ce("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium",s.resolved?"bg-success text-success-foreground hover:bg-success/80":"bg-muted text-muted-foreground hover:bg-muted/80"),title:s.resolved?"Mark unresolved":"Mark resolved",children:[s.resolved?r.jsx(Zh,{className:"h-3 w-3"}):r.jsx(ZT,{className:"h-3 w-3"}),s.resolved?"resolved":"open"]}):null,s.replyTo?r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(vP,{className:"h-3 w-3"}),s.replyTo]}):null]}),r.jsx(fn,{content:s.body}),a.length>0?r.jsx("div",{className:"space-y-2",children:a.map(c=>r.jsx(AN,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const CF=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function oj(){var lt,te,be,Le,it,_e,bt,_t,Gt;const{slug:e,aslug:t}=$t(),n=Dt(),s=ln(),[a,l]=ms(),[c,u]=f.useState(null),{toast:p,showToast:m,dismissToast:h}=ta(),[x,y]=f.useState(null),[b,C]=f.useState(null),[j,w]=f.useState(null),[k,E]=f.useState(null),[N,P]=f.useState(!1),[$,T]=f.useState(!1),[D,O]=f.useState(0),J=a.get("tab")??"summary",V=Zo(),{data:L,loading:W,error:oe,refetch:z}=bR(e,t),{data:H}=M0(e),{data:ee}=dg(),{data:ne,loading:M,error:q}=wR(e,t),{data:A,loading:F,error:Z}=kR(e,t),I=f.useMemo(()=>{if(!L||!H)return[];const fe=new Map(H.assignments.map(Be=>[Be.slug,Be]));return L.dependsOn.map(Be=>{const Fe=fe.get(Be);return{slug:Be,title:(Fe==null?void 0:Fe.title)??Be,status:(Fe==null?void 0:Fe.status)??"pending",priority:(Fe==null?void 0:Fe.priority)??"medium",assignee:(Fe==null?void 0:Fe.assignee)??null}})},[L,H]),ue=I.filter(fe=>fe.status!=="completed"&&fe.status!=="review");mo("assignment");const ge=f.useMemo(()=>((H==null?void 0:H.assignments)??[]).map(fe=>fe.slug),[H]),U=t?ge.indexOf(t):-1,ae=U>0?ge[U-1]:null,me=U>=0&&U<ge.length-1?ge[U+1]:null,ve=`${s}/projects/${e}/assignments/${t}`;Ht({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${ve}/edit`)}),Ht({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${ve}/plan/edit`)}),Ht({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${ve}/handoff/edit`)}),Ht({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${ve}/decision-record/edit`)}),Ht({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${ve}/scratchpad/edit`)}),Ht({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!ae,handler:()=>ae&&n(`${s}/projects/${e}/assignments/${ae}`)}),Ht({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!me,handler:()=>me&&n(`${s}/projects/${e}/assignments/${me}`)});const ke=f.useMemo(()=>L?vF(L.body):{acceptanceCriteria:[],summaryBody:""},[L]),he=f.useMemo(()=>wF(ke.summaryBody),[ke.summaryBody]),Je=ke.acceptanceCriteria,Ye=Je.filter(fe=>fe.checked).length,ot=Je.length>0&&Ye===Je.length,Y=f.useRef(ot),Ie=f.useRef(!1);if(f.useEffect(()=>{if(L){if(!Ie.current){Y.current=ot,Ie.current=!0;return}ot&&!Y.current&&O(fe=>fe+1),Y.current=ot}},[ot,L]),W)return r.jsx(mt,{label:"Loading assignment workspace…"});if(oe||!L||!e||!t)return r.jsx(wt,{error:oe||"Assignment not found."});const Se=e,Oe=t,Xe=Je.length>0?{checked:Ye,total:Je.length}:void 0,Me=L.availableTransitions??[],nt=Me.filter(fe=>!fe.disabled&&fe.targetStatus!==L.status),Ke=CF.map(fe=>nt.find(Be=>Be.command===fe)).find(Boolean)??nt[0]??null,gt=[];if(ee!=null&&ee.sessions)for(const fe of ee.sessions)for(const Be of fe.windows)for(const Fe of Be.panes)((lt=Fe.assignment)==null?void 0:lt.project)===e&&((te=Fe.assignment)==null?void 0:te.slug)===t&>.push({sessionName:fe.name,command:Fe.command,urls:Fe.urls});async function Pt(fe){u(null);try{await wN(Se,Oe,fe),z()}catch(Be){u(Be.message)}}async function at(fe){u(null);try{const Be=await fetch(`/api/projects/${Se}/assignments/${Oe}/${fe?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Be.ok){const Fe=await Be.json().catch(()=>null);throw new Error((Fe==null?void 0:Fe.error)||`HTTP ${Be.status}`)}z(),m(fe?"Assignment archived":"Assignment restored","success")}catch(Be){u(Be.message)}}async function ie(){T(!0);try{await iF(Se,Oe),n(`${s}/projects/${Se}`)}catch(fe){u(fe.message),T(!1),P(!1)}}async function G(fe,Be){u(null),y(fe.command);try{return await vN(Se,Oe,fe,Be),z(),!0}catch(Fe){return u(Fe.message),!1}finally{y(null)}}function pe(fe){if(jN(fe)){C(fe);return}G(fe)}async function Q(fe,Be){w(null),E(fe);try{const Fe=await fetch(`/api/projects/${Se}/assignments/${Oe}/acceptance-criteria/${fe}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Be})}),Nt=await Fe.json();if(!Fe.ok)throw new Error(Nt.error||`HTTP ${Fe.status}`);z()}catch(Fe){w(Fe.message)}finally{E(null)}}const ye=[...nt.filter(fe=>fe!==Ke).map(fe=>({key:`transition-${fe.command}`,label:fe.label,onSelect:()=>pe(fe),disabled:x===fe.command})),...Me.filter(fe=>fe.disabled||fe.targetStatus===L.status).map(fe=>({key:`transition-${fe.command}`,label:fe.label,disabled:!0,disabledReason:fe.targetStatus===L.status?`Already ${L.status.replace(/_/g," ")}`:fe.disabledReason??fe.warning??fe.description})),...V.statuses.map(fe=>({key:`override-${fe.id}`,label:`Override → ${fe.label}`,onSelect:()=>Pt(fe.id),disabled:fe.id===L.status,disabledReason:fe.id===L.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:iP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:jP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:um,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:nd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:uP,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:L.archived?"unarchive":"archive",label:L.archived?"Restore assignment":"Archive assignment",icon:L.archived?ed:Dd,onSelect:()=>at(!L.archived)},{key:"delete",label:"Delete assignment",icon:or,destructive:!0,onSelect:()=>P(!0)}],Re=(Ke==null?void 0:Ke.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(na,{toast:p,onDismiss:h}),r.jsxs("div",{className:"sticky top-12 z-20 rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm backdrop-blur",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(pn,{status:L.status,progress:Xe}),r.jsx(ea,{type:L.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:L.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",k0(L.updated)]}),ue.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",ue.length," unmet dep",ue.length===1?"":"s"]}),r.jsx(Yg,{externalIds:L.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(TN,{target:{kind:"assignment",id:L.id},worktreePath:((be=L.workspace)==null?void 0:be.worktreePath)??null,repository:((Le=L.workspace)==null?void 0:Le.repository)??null}),!((it=L.workspace)!=null&&it.worktreePath)&&e&&t&&r.jsx(PN,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>z()}),Ke&&r.jsx("button",{type:"button",title:Ke.warning||Ke.description,disabled:x===Ke.command,onClick:()=>pe(Ke),className:Ce("shell-action disabled:cursor-not-allowed disabled:opacity-50",Ke.warning&&"border-warning-foreground/40",Re&&D>0&&"send-to-review-glow"),children:r.jsx("span",{children:x===Ke.command?"Working…":Ke.label})},Re?`review-${D}`:Ke.command),r.jsx(Hg,{items:ye,align:"end"})]})]}),c?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:c}):null,L.blockedReason?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsx("strong",{children:"Blocked reason:"})," ",L.blockedReason]}):null]}),I.length>0&&r.jsx(jF,{projectSlug:e,dependencies:I,blockedReason:L.blockedReason}),L.enrichedLinks&&L.enrichedLinks.length>0&&r.jsx(kF,{links:L.enrichedLinks}),L.referencedBy&&L.referencedBy.length>0&&r.jsx(We,{title:"Referenced by",description:"Other assignments whose Todos, progress, comments, or handoffs link to this one.",children:r.jsx("ul",{className:"space-y-2",children:L.referencedBy.map(fe=>{const Be=fe.sourceProjectSlug===null?`/assignments/${fe.sourceId}`:`${s}/projects/${fe.sourceProjectSlug}/assignments/${fe.sourceSlug}`;return r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ee,{to:Be,className:"text-foreground hover:text-primary",children:fe.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",fe.mentions," mention",fe.mentions===1?"":"s",")"]}),fe.sourceProjectSlug===null?r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"}):null]},fe.sourceId)})})}),r.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(Xg,{value:J,onValueChange:fe=>l({tab:fe}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[ke.acceptanceCriteria.length>0?r.jsx(We,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:r.jsxs("div",{className:"space-y-3",children:[j?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:j}):null,ke.acceptanceCriteria.map((fe,Be)=>{const Fe=k!==null;return r.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-border/60 bg-background/80 px-3 py-3",children:[r.jsx("input",{type:"checkbox",checked:fe.checked,disabled:Fe,onChange:Nt=>Q(Be,Nt.target.checked),className:"mt-1 h-4 w-4 rounded border-border text-primary"}),r.jsx("span",{className:"criterion-label text-sm leading-6","data-checked":fe.checked,children:fe.text})]},`${Be}-${fe.text}`)})]})}):null,he.hasSection?r.jsx(We,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(fn,{content:he.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(We,{title:"Assignment Summary",children:r.jsx(fn,{content:he.remaining,emptyState:ke.acceptanceCriteria.length>0||he.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:L.plan?1:0,content:L.plan?r.jsx("div",{className:"space-y-5",children:r.jsxs(We,{title:"Plan",description:"Shows plan.md only. Versioned plans (plan-v2.md, ...) linked from the Todos section are not yet rendered here — open them from the filesystem.",actions:r.jsxs(Ee,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/plan/edit`,children:[r.jsx(um,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(pn,{status:L.plan.status})}),r.jsx(fn,{content:L.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(St,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:L.scratchpad?1:0,content:L.scratchpad?r.jsx(We,{title:"Scratchpad",actions:r.jsxs(Ee,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(um,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(fn,{content:L.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(St,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((_e=L.handoff)==null?void 0:_e.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:L.handoff?r.jsx(We,{children:r.jsx(fn,{content:L.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(St,{title:"No handoff log yet",description:"Handoffs appear here when an agent runs /complete-assignment or you append one manually."})})},{value:"progress",label:"Progress",count:((bt=L.progress)==null?void 0:bt.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:L.progress&&L.progress.entries.length>0?r.jsx(We,{title:"Progress",description:"Reverse-chronological log of work done on this assignment. Agents append entries via progress.md.",children:r.jsx("ol",{className:"space-y-4",children:L.progress.entries.map((fe,Be)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:fe.timestamp}),r.jsx(fn,{content:fe.body})]},`${fe.timestamp}-${Be}`))})}):r.jsx(St,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((_t=L.comments)==null?void 0:_t.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:L.comments&&L.comments.entries.length>0?r.jsx(RN,{projectSlug:e,assignmentSlug:t,entries:L.comments.entries}):r.jsx(St,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((Gt=L.decisionRecord)==null?void 0:Gt.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:L.decisionRecord?r.jsx(We,{children:r.jsx(fn,{content:L.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(St,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"min-w-0 space-y-5",children:[r.jsx(We,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(to,{label:"ID",value:L.id,copyable:!0}),r.jsx(to,{label:"Priority",value:L.priority}),L.assignee&&r.jsx(to,{label:"Assignee",value:L.assignee}),r.jsx(to,{label:"Updated",value:`${j0(L.updated)} · Created ${w0(L.created)}`}),L.workspace.repository&&r.jsx(to,{label:"Repository",value:L.workspace.repository,copyable:!0}),L.workspace.worktreePath&&r.jsx(to,{label:"Worktree",value:L.workspace.worktreePath,copyable:!0}),L.workspace.branch&&r.jsx(to,{label:"Branch",value:L.workspace.branch,copyable:!0}),L.workspace.parentBranch&&r.jsx(to,{label:"Parent branch",value:L.workspace.parentBranch,copyable:!0}),L.externalIds.map((fe,Be)=>r.jsx(EF,{entry:fe},`${fe.system}:${fe.id}:${Be}`))]})}),gt.length>0&&r.jsx(We,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:gt.map((fe,Be)=>r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm",children:[r.jsx("span",{className:"min-w-0 max-w-full truncate rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",title:fe.command,children:fe.command}),r.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:fe.sessionName,children:fe.sessionName}),fe.urls.map(Fe=>r.jsxs("a",{href:Fe,target:"_blank",rel:"noopener noreferrer",title:Fe,className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded border border-primary/30 bg-primary/5 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 dark:border-primary/40 dark:bg-primary/10 dark:hover:bg-primary/20",children:[r.jsx("span",{className:"min-w-0 truncate",children:Fe.replace("http://localhost:",":")}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]},Fe))]},Be))})}),r.jsx(NN,{sessions:ne==null?void 0:ne.sessions,loading:M,error:q}),r.jsx(CN,{summary:A==null?void 0:A.summary,loading:F,error:Z})]})]}),r.jsx(EN,{open:b!==null,action:b,assignmentTitle:L.title,loading:x===(b==null?void 0:b.command),onOpenChange:fe=>{fe||C(null)},onConfirm:async fe=>{if(!b)return;await G(b,fe)&&C(null)}}),r.jsx(sa,{open:N,title:"Delete assignment?",description:`This will permanently delete "${L.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:$,onOpenChange:fe=>{fe||P(!1)},onConfirm:ie})]})}function to({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(Dr,{value:t})]})]})}function EF({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function TF(){var T,D,O,J,V,L,W,oe;const{id:e}=$t(),[t,n]=ms(),s=t.get("tab")??"summary",{data:a,loading:l,error:c,refetch:u}=vR(e),{data:p,loading:m,error:h}=jR(e),{data:x,loading:y,error:b}=SR(a==null?void 0:a.slug),[C,j]=f.useState(!1),[w,k]=f.useState(null),{toast:E,showToast:N,dismissToast:P}=ta();async function $(z){if(e){k(null);try{const H=await fetch(`/api/assignments/${e}/${z?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!H.ok){const ee=await H.json().catch(()=>null);throw new Error((ee==null?void 0:ee.error)||`HTTP ${H.status}`)}u(),N(z?"Assignment archived":"Assignment restored","success")}catch(H){k(H instanceof Error?H.message:"Archive failed")}}}return l?r.jsx(mt,{}):c?r.jsx(wt,{error:c}):a?r.jsxs("div",{className:"space-y-6",children:[r.jsx(na,{toast:E,onDismiss:P}),r.jsxs("header",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(pn,{status:a.status}),r.jsx(ea,{type:a.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:a.id}),r.jsx(Yg,{externalIds:a.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(TN,{target:{kind:"assignment",id:a.id},worktreePath:((T=a.workspace)==null?void 0:T.worktreePath)??null,repository:((D=a.workspace)==null?void 0:D.repository)??null,size:"compact"}),!((O=a.workspace)!=null&&O.worktreePath)&&r.jsx(PN,{assignmentId:a.id,defaultBranch:`syntaur/${a.slug}`,onCreated:()=>u()}),r.jsxs("button",{type:"button",onClick:()=>j(!0),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:[r.jsx($d,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Ee,{to:`/assignments/${a.id}/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>$(!a.archived),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:a.archived?"Restore this assignment":"Archive this assignment",children:[a.archived?r.jsx(ed,{className:"h-3 w-3"}):r.jsx(Dd,{className:"h-3 w-3"}),a.archived?"Restore":"Archive"]})]})]}),r.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:a.title}),a.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",a.blockedReason]}):null,w?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:w}):null]}),r.jsx(We,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(no,{label:"ID",value:a.id,copyable:!0}),r.jsx(no,{label:"Priority",value:a.priority}),a.assignee&&r.jsx(no,{label:"Assignee",value:a.assignee}),r.jsx(no,{label:"Updated",value:`${j0(a.updated)} · Created ${w0(a.created)}`}),a.workspace.repository&&r.jsx(no,{label:"Repository",value:a.workspace.repository,copyable:!0}),a.workspace.worktreePath&&r.jsx(no,{label:"Worktree",value:a.workspace.worktreePath,copyable:!0}),a.workspace.branch&&r.jsx(no,{label:"Branch",value:a.workspace.branch,copyable:!0}),a.workspace.parentBranch&&r.jsx(no,{label:"Parent branch",value:a.workspace.parentBranch,copyable:!0}),a.externalIds.map((z,H)=>r.jsx(PF,{entry:z},`${z.system}:${z.id}:${H}`))]})}),a.referencedBy&&a.referencedBy.length>0?r.jsx(We,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:r.jsx("ul",{className:"space-y-2",children:a.referencedBy.map(z=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ee,{to:z.sourceProjectSlug===null?`/assignments/${z.sourceId}`:`/projects/${z.sourceProjectSlug}/assignments/${z.sourceSlug}`,className:"text-foreground hover:text-primary",children:z.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",z.mentions," mention",z.mentions===1?"":"s",")"]})]},z.sourceId))})}):null,r.jsx(NN,{sessions:p==null?void 0:p.sessions,loading:m,error:h}),r.jsx(CN,{summary:x==null?void 0:x.summary,loading:y,error:b}),r.jsx(Xg,{value:s,onValueChange:z=>n({tab:z}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(We,{title:"Assignment",children:r.jsx(fn,{content:a.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((J=a.progress)==null?void 0:J.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.progress&&a.progress.entries.length>0?r.jsx(We,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:r.jsx("ol",{className:"space-y-4",children:a.progress.entries.map((z,H)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:z.timestamp}),r.jsx(fn,{content:z.body})]},`${z.timestamp}-${H}`))})}):r.jsx(St,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((V=a.comments)==null?void 0:V.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(RN,{projectSlug:null,assignmentSlug:a.id,entries:((L=a.comments)==null?void 0:L.entries)??[]})})},{value:"plan",label:"Plan",content:r.jsx("div",{className:"space-y-5",children:a.plan?r.jsxs(We,{children:[r.jsx(fn,{content:a.plan.body,emptyState:"Plan file exists but is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.id}/plan/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit plan"})})]}):r.jsx(St,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:r.jsx("div",{className:"space-y-5",children:a.scratchpad?r.jsxs(We,{children:[r.jsx(fn,{content:a.scratchpad.body,emptyState:"Scratchpad is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.id}/scratchpad/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit scratchpad"})})]}):r.jsx(St,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((W=a.handoff)==null?void 0:W.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.handoff?r.jsxs(We,{children:[r.jsx(fn,{content:a.handoff.body,emptyState:"No handoff history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.id}/handoff/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append handoff"})})]}):r.jsx(St,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((oe=a.decisionRecord)==null?void 0:oe.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.decisionRecord?r.jsxs(We,{children:[r.jsx(fn,{content:a.decisionRecord.body,emptyState:"No decision history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.id}/decision-record/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append decision"})})]}):r.jsx(St,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]}),r.jsx(Gg,{open:C,onOpenChange:j,currentWorkspace:a.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async z=>{const H=await fetch(`/api/assignments/${encodeURIComponent(a.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:z})});if(!H.ok){const ee=await H.json().catch(()=>({}));throw new Error(ee.error||"Failed to move assignment")}u()}})]}):r.jsx(wt,{error:"Assignment not found"})}function no({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(Dr,{value:t})]})]})}function PF({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function RF({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1}){const[a,l]=f.useState(!1),[c,u]=f.useState(null),[p,m]=f.useState(0),h=f.useRef(null),x=f.useRef(null),y=f.useId(),b=hd(e),C=b.icon,j=f.useCallback(P=>{l(!1),P&&requestAnimationFrame(()=>{var $;($=h.current)==null||$.focus()})},[]),w=f.useCallback(()=>{var $;const P=($=h.current)==null?void 0:$.getBoundingClientRect();P&&u({top:P.top,left:P.left,width:P.width,bottom:P.bottom})},[]);f.useLayoutEffect(()=>{a&&w()},[a,w]),f.useEffect(()=>{if(!a)return;const P=()=>w();return window.addEventListener("scroll",P,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P)}},[a,w]),f.useEffect(()=>{if(!a)return;const P=$=>{var D,O;const T=$.target;T&&((D=x.current)!=null&&D.contains(T)||(O=h.current)!=null&&O.contains(T)||j(!1))};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[a,j]),f.useEffect(()=>{a&&m(0)},[a,t.length]);function k(P){(P.key==="Enter"||P.key===" "||P.key==="ArrowDown")&&(P.preventDefault(),l(!0))}function E(P){if(t.length===0){P.key==="Escape"&&(P.preventDefault(),j(!0));return}if(P.key==="ArrowDown")P.preventDefault(),m($=>($+1)%t.length);else if(P.key==="ArrowUp")P.preventDefault(),m($=>($-1+t.length)%t.length);else if(P.key==="Home")P.preventDefault(),m(0);else if(P.key==="End")P.preventDefault(),m(t.length-1);else if(P.key==="Enter"){P.preventDefault();const $=t[p];$&&(n($),j(!0))}else P.key==="Escape"&&(P.preventDefault(),j(!0))}function N(P){n(P),j(!1)}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:h,type:"button","data-no-drag":!0,disabled:s,"aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?y:void 0,onClick:()=>{s||l(P=>!P)},onKeyDown:k,title:`Status: ${b.label}. Click to change.`,className:Ce(VS(e),"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",s&&"cursor-not-allowed opacity-60"),children:[r.jsx(C,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:b.label})]}),a&&c&&typeof document<"u"?Ts.createPortal(r.jsx("div",{ref:x,id:y,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:E,style:{position:"fixed",top:c.bottom+6,left:c.left,minWidth:Math.max(c.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:t.length===0?r.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No transitions available from this status."}):t.map((P,$)=>{const T=hd(P.targetStatus),D=T.icon,O=$===p;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>m($),onClick:()=>N(P),title:P.warning||P.description,className:Ce("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",O?"bg-foreground/5":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:"flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(D,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:P.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:T.label})]}),P.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:P.warning}):null]},`${P.command}:${P.targetStatus}`)})}),document.body):null]})}function DN({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[a,l]=f.useState(!1);return a?r.jsx(AF,{initialTitle:e,disabled:s,onSave:n,onExit:()=>l(!1)}):r.jsxs("div",{className:"group flex items-baseline gap-1.5",children:[r.jsx("button",{type:"button","data-no-drag":!0,disabled:s,onClick:()=>{s||l(!0)},className:Ce("text-left text-base font-semibold text-foreground transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",s&&"cursor-not-allowed opacity-60"),title:"Click to rename",children:e}),r.jsx(Ee,{to:t,"data-no-drag":!0,"aria-label":"Open detail page",title:"Open detail page",onClick:c=>c.stopPropagation(),className:"text-muted-foreground opacity-0 transition group-hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",children:r.jsx(yi,{className:"h-3.5 w-3.5"})})]})}function AF({initialTitle:e,disabled:t,onSave:n,onExit:s}){const a=f.useRef(e),[l,c]=f.useState(e),[u,p]=f.useState(!1),[m,h]=f.useState(!1),x=f.useRef(null),y=f.useRef(!1);f.useEffect(()=>{const w=x.current;w&&(w.focus(),w.select())},[]);const b=f.useCallback(()=>{var w;h(!0),window.setTimeout(()=>h(!1),260),(w=x.current)==null||w.focus()},[]),C=f.useCallback(async()=>{if(y.current)return;const w=l.trim();if(w.length===0){b();return}if(w===a.current){s();return}y.current=!0,p(!0);try{await n(w)}catch{}finally{p(!1),s()}},[l,s,n,b]);function j(w){w.key==="Enter"?(w.preventDefault(),C()):w.key==="Escape"&&(w.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:x,type:"text","data-no-drag":!0,disabled:t||u,value:l,onChange:w=>c(w.target.value),onKeyDown:j,onBlur:()=>void C(),className:Ce("w-full rounded-sm border border-border bg-background px-1.5 py-0.5 text-base font-semibold text-foreground outline-none transition focus:border-ring focus:ring-1 focus:ring-ring",m&&"syntaur-input-shake",u&&"opacity-70")})}function $N(e){const t=Dt(),n=f.useRef(null),s=f.useRef(!1),a=f.useCallback(()=>{const c=n.current,u=!!(c!=null&&c.querySelector('[aria-expanded="true"]')),p=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(c!=null&&c.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||p||h},[]),l=f.useCallback(c=>{if(s.current)return;const u=c.target;!u||u.closest(mi)||t(e)},[t,e]);return{containerRef:n,onMouseDown:a,onClick:l}}const aj=Rg;function ij(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function DF(e,t){return e.toString()===t.toString()}function lj(){const{workspace:e}=$t(),t=ln(),n=Dt(),s=f.useRef(null);mo("list:assignments");const{data:a,loading:l,error:c,refetch:u}=Md(),p=Zo(),m=ef(),[h,x]=ms(),y=e?`w:${e}`:null,b=lN(y),C=f.useRef(void 0),j=f.useMemo(()=>qS(p.order),[p]),w=f.useMemo(()=>{const _={};for(const le of j)_[le]=cc(p,le);return _},[j,p]),k=f.useMemo(()=>j.map(_=>({id:_,title:w[_]??_,description:Zd(_)})),[j,w]),E=f.useMemo(()=>m.definitions.map(_=>({id:_.id,title:ii(m,_.id),description:_.description})),[m]),N="__unknown_type__",P=f.useMemo(()=>new Set(["all",...j]),[j]),$=h.get("view"),T=h.get("status"),D=h.get("stale"),O=$&&aj.includes($)?$:"kanban";function J(_){if(!_)return[];const le=[];for(const xe of _.split(",")){const De=xe.trim();!De||De==="all"||!P.has(De)||le.includes(De)||le.push(De)}return le}const V=f.useCallback(_=>{x(le=>{const xe=new URLSearchParams(le);return _==="kanban"?xe.delete("view"):xe.set("view",_),xe})},[x]),[L,W]=f.useState(""),[oe,z]=f.useState(()=>J(T)),[H,ee]=f.useState(()=>tt(b.filters.priority)),[ne,M]=f.useState(()=>tt(b.filters.type)),[q,A]=f.useState(()=>tt(b.filters.assignee)),[F,Z]=f.useState(()=>tt(b.filters.project)),[I,ue]=f.useState(()=>tt(b.filters.tags)),[ge,U]=f.useState(null),[ae,me]=f.useState(()=>ij(D)),[ve,ke]=f.useState(()=>b.sortField),[he,Je]=f.useState(()=>b.sortDirection),[Ye,ot]=f.useState(()=>({hidden:[]})),[Y,Ie]=f.useState(()=>({hidden:[]})),[Se,Oe]=f.useState(()=>b.grouping),Xe=Se==="type"?"type":"status",[Me,nt]=f.useState(()=>new Set),[Ke,gt]=f.useState([]),{toast:Pt,showToast:at,dismissToast:ie}=ta(),[G,pe]=f.useState(null),[Q,ye]=f.useState(null),[Re,lt]=f.useState(null),[te,be]=f.useState(null),[Le,it]=f.useState(null),[_e,bt]=f.useState(null),[_t,Gt]=f.useState(null),[fe,Be]=f.useState(null),[Fe,Nt]=f.useState(null),[$n,Yt]=f.useState(!1),[sn,Wt]=f.useState(!1),Gn=e?{kind:"workspace",workspace:e}:{kind:"global"},xt=h.get("loadView"),{view:jn,loading:Rt,error:re}=Go(xt),{view:Ae,loading:Qe,error:Ft}=Go(Fe),hn=f.useRef(null);f.useEffect(()=>{gt((a==null?void 0:a.assignments)??[])},[a]),f.useEffect(()=>{Fe&&!Qe&&!Ft&&!Ae&&Nt(null)},[Ae,Ft,Fe,Qe]),f.useEffect(()=>{Nt(null),hn.current=null,U(null),W("")},[e]),f.useEffect(()=>{const _=J(T);LD(_,oe)||z(_);const le=ij(D);le!==ae&&me(le)},[ae,D,oe,T]),f.useEffect(()=>{C.current===y&&x(_=>{const le=new URLSearchParams(_);return oe.length===0?le.delete("status"):le.set("status",oe.join(",")),ae==="all"?le.delete("stale"):ae==="stale"?le.set("stale","1"):le.set("stale","0"),DF(_,le)?_:le})},[ae,y,x,oe]),f.useEffect(()=>{ee(tt(b.filters.priority)),M(tt(b.filters.type)),A(tt(b.filters.assignee)),Z(tt(b.filters.project)),ue(tt(b.filters.tags)),ke(b.sortField),Je(b.sortDirection),Oe(b.grouping)},[b.filters.priority,b.filters.type,b.filters.assignee,b.filters.project,b.filters.tags,b.sortField,b.sortDirection,b.grouping]),f.useEffect(()=>{if(C.current===y)return;let _=!1;return vx().then(le=>{if(_||C.current===y)return;const xe=nS(le,y),De=xe.defaultView,ct=tt(xe.filters.status),pt=xe.filters.activity??"all",yt=new URLSearchParams(window.location.search);let cn=!1;const on=new URLSearchParams(yt);yt.get("view")===null&&De!=="kanban"&&aj.includes(De)&&(on.set("view",De),cn=!0),yt.get("status")===null&&ct.length>0&&(on.set("status",ct.join(",")),z(ct),cn=!0),yt.get("stale")===null&&pt!=="all"&&(on.set("stale",pt==="stale"?"1":"0"),me(pt),cn=!0),cn&&x(on,{replace:!0}),queueMicrotask(()=>{C.current=y})}),()=>{_=!0}},[y]);const Ct=f.useCallback(_=>{(y===null?uN(_):dN(y,_)).catch(xe=>{console.warn("Failed to persist view prefs:",xe)})},[y]),jf=f.useCallback(_=>{V(_),Ct({defaultView:_})},[V,Ct]),Ai=f.useCallback(_=>{z(_),Ct({filters:{status:_}})},[Ct]),_r=f.useCallback(_=>{ee(_),Ct({filters:{priority:_}})},[Ct]),oa=f.useCallback(_=>{M(_),Ct({filters:{type:_}})},[Ct]),aa=f.useCallback(_=>{A(_),Ct({filters:{assignee:_}})},[Ct]),Di=f.useCallback(_=>{Z(_),Ct({filters:{project:_}})},[Ct]),ia=f.useCallback(_=>{ue(_),Ct({filters:{tags:_}})},[Ct]),la=f.useCallback(_=>{me(_),Ct({filters:{activity:_}})},[Ct]),ca=f.useCallback(_=>{ke(_),Ct({sortField:_})},[Ct]),go=f.useCallback(_=>{Je(_),Ct({sortDirection:_})},[Ct]),kf=f.useCallback(_=>{Oe(_),Ct({grouping:_})},[Ct]),ua=f.useCallback(()=>({viewMode:O,filters:{status:oe,priority:H,type:ne,assignee:q,project:F,tags:I,activity:ae,dateRange:Xl(ge),search:L},sortField:ve,sortDirection:he,listSectionVisibility:{collapsed:[...Me]},kanbanColumnVisibility:Ye,tableColumnVisibility:Y}),[O,oe,H,ne,q,F,I,ae,ge,L,ve,he,Me,Ye,Y]),Lt=f.useCallback(_=>{gN(_,{setViewMode:V,setStatusFilter:Ai,setPriorityFilter:_r,setTypeFilter:oa,setAssigneeFilter:aa,setProjectFilter:Di,setTagsFilter:ia,setActivityFilter:la,setDateRange:U,setSearch:W,setSortField:ca,setSortDirection:go,setListSectionVisibility:le=>nt(new Set(le.collapsed)),setKanbanColumnVisibility:ot,setTableColumnVisibility:Ie}),Nt(_.id)},[V,Ai,_r,oa,aa,Di,ia,la,ca,go]),Sf=f.useCallback(_=>{Lt(_),hn.current=_.id,x(le=>{const xe=new URLSearchParams(le);return xe.set("loadView",_.id),xe},{replace:!0})},[Lt,x]),$i=f.useCallback(async _=>{try{const le=Jl({name:_,context:{workspace:e??null,projectSlug:null},state:ua()}),xe=await Wd(le),De=xe.views[xe.views.length-1];Nt((De==null?void 0:De.id)??null),De&&(hn.current=De.id,x(ct=>{const pt=new URLSearchParams(ct);return pt.set("loadView",De.id),pt},{replace:!0})),Yt(!1),Wt(!1),at(`Saved view "${_}"`,"success")}catch(le){throw at(le instanceof Error?le.message:"Failed to save view","error"),le}},[ua,x,at,e]),xc=f.useCallback(async()=>{if(!(!Fe||!Ae))try{const _=Jl({name:Ae.name,context:{workspace:e??null,projectSlug:null},state:ua()}),le=jx(Ae.config,_.config,_.config);await $g(Fe,{config:le}),at("View updated","success")}catch(_){at(_ instanceof Error?_.message:"Failed to update view","error")}},[ua,Ae,Fe,at,e]);f.useEffect(()=>{if(!xt){hn.current=null;return}if(hn.current!==xt&&(Fe&&Fe!==xt&&Nt(null),!Rt)){if(re){at("Couldn't load saved view — try again","error");return}if(jn){hn.current=xt,Lt(jn),x(_=>{const le=new URLSearchParams(_);return le.delete("loadView"),le},{replace:!0});return}hn.current=xt,at("Saved view no longer exists","error"),x(_=>{const le=new URLSearchParams(_);return le.delete("loadView"),le},{replace:!0})}},[xt,jn,Rt,re,Fe,Lt,x,at]);const Bn=f.useMemo(()=>Ke.filter(_=>e?e==="_ungrouped"?_.projectWorkspace===null:_.projectWorkspace===e:!0),[Ke,e]),Nf=f.useMemo(()=>Array.from(new Set(Bn.map(_=>_.status))).sort(),[Bn]),yc=f.useMemo(()=>Array.from(new Set(Bn.map(_=>_.priority))).sort(),[Bn]),da=f.useMemo(()=>Array.from(new Set(Bn.map(_=>_.assignee??"__unassigned__"))).sort(),[Bn]),br=f.useMemo(()=>Array.from(new Map(Bn.filter(_=>_.projectSlug!==null).map(_=>[_.projectSlug,_.projectTitle]))).sort(([,_],[,le])=>_.localeCompare(le)),[Bn]),Cf=f.useMemo(()=>Array.from(new Set(Bn.flatMap(_=>_.tags??[]))).sort(),[Bn]),jt=f.useMemo(()=>Ke.filter(_=>Wg(_,{status:oe,priority:H,type:ne,assignee:q,project:F,tags:I,activity:ae,dateRange:Xl(ge)},{workspace:e,search:L})),[ae,Ke,L,oe,H,ne,q,F,I,ge,e]),xo=f.useMemo(()=>uc(jt,ve,he),[jt,ve,he]),Li=f.useMemo(()=>{if(Se==="none")return[{id:"__all__",label:"All assignments",items:jt}];if(Se==="type"){const _=m.definitions.map(De=>({id:De.id,label:ii(m,De.id),items:jt.filter(ct=>ct.type===De.id)})),le=new Set(m.definitions.map(De=>De.id)),xe=jt.filter(De=>!De.type||!le.has(De.type));return xe.length>0&&_.push({id:N,label:"Other",items:xe}),_}if(Se==="priority")return["critical","high","medium","low"].map(le=>({id:le,label:le.charAt(0).toUpperCase()+le.slice(1),items:jt.filter(xe=>xe.priority===le)}));if(Se==="assignee")return Array.from(new Set(jt.map(le=>le.assignee??"__unassigned__"))).sort().map(le=>({id:le,label:le==="__unassigned__"?"Unassigned":le,items:jt.filter(xe=>(xe.assignee??"__unassigned__")===le)}));if(Se==="project"){const _=new Map;for(const le of jt){const xe=le.projectSlug??"__standalone__",De=le.projectTitle??"Standalone";_.has(xe)||_.set(xe,De)}return Array.from(_.entries()).sort(([,le],[,xe])=>le.localeCompare(xe)).map(([le,xe])=>({id:le,label:xe,items:jt.filter(De=>(De.projectSlug??"__standalone__")===le)}))}return j.map(_=>({id:_,label:w[_]??_,items:jt.filter(le=>le.status===_)}))},[Se,jt,m,j,w]),Ef=f.useMemo(()=>{const _=new Set(m.definitions.map(xe=>xe.id));return jt.some(xe=>!xe.type||!_.has(xe.type))?[...E,{id:N,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,jt]),{visibleItems:fa,visibleIndexByKey:yo}=f.useMemo(()=>{let _;if(O==="table")_=xo;else if(O==="kanban"){const xe=new Set(m.definitions.map(De=>De.id));Xe==="type"?_=[...m.definitions.flatMap(De=>jt.filter(ct=>ct.type===De.id)),...jt.filter(De=>!De.type||!xe.has(De.type))]:_=j.flatMap(De=>jt.filter(ct=>ct.status===De))}else _=Li.flatMap(xe=>xe.items);const le=new Map;return _.forEach((xe,De)=>le.set(tn(xe),De)),{visibleItems:_,visibleIndexByKey:le}},[O,xo,Li,Xe,m,jt,j]),{hotkeyRowProps:xs}=ac(fa,{scope:"list:assignments",onOpen:_=>{if(_.projectSlug===null){n(`/assignments/${_.id}`);return}const le=_.projectWorkspace?`/w/${_.projectWorkspace}`:t;n(`${le}/projects/${_.projectSlug}/assignments/${_.slug}`)}});if(Ht({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var _;return(_=s.current)==null?void 0:_.focus()}}),Ht({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),l)return r.jsx(mt,{label:"Loading assignments board…"});if(c||!a)return r.jsx(wt,{error:c||"Assignments board is unavailable."});async function bo({item:_,toColumnId:le,action:xe,reason:De}){pe(tn(_));const ct=Ke;gt(pt=>pt.map(yt=>tn(yt)===tn(_)?{...yt,status:le,blockedReason:le==="blocked"?De??yt.blockedReason:null}:yt));try{if(_.projectSlug===null){if(!xe)throw new Error("Standalone assignments require a transition action, not status override.");const yt=await fetch(`/api/assignments/${encodeURIComponent(_.id)}/transitions/${encodeURIComponent(xe.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(De?{reason:De}:{})});if(!yt.ok)throw new Error((await yt.json()).error??`HTTP ${yt.status}`);const on=(await yt.json()).assignment;gt(kn=>kn.map(Un=>tn(Un)===tn(_)?{...Un,status:on.status,blockedReason:on.blockedReason,availableTransitions:on.availableTransitions,updated:on.updated}:Un));return}const pt=xe?await vN(_.projectSlug,_.slug,xe,De):await wN(_.projectSlug,_.slug,le);return gt(yt=>yt.map(cn=>tn(cn)===tn(_)?{...cn,status:pt.status,blockedReason:pt.blockedReason,availableTransitions:pt.availableTransitions,updated:pt.updated}:cn)),u(),!0}catch(pt){return gt(ct),at(pt.message,"error"),!1}finally{pe(null)}}async function vo({item:_,toColumnId:le,action:xe}){if(_.status===le)return;const De=xe??kl(_,le);if(De!=null&&De.disabled){at(De.disabledReason||`Cannot move this assignment to ${le}.`,"error");return}if(De&&jN(De)){be({item:_,toColumnId:le,action:De});return}await bo({item:_,toColumnId:le,action:De})}async function Oi(_,le){if(le===_.title)return;const xe=tn(_),De=Ke;gt(ct=>ct.map(pt=>tn(pt)===xe?{...pt,title:le}:pt)),pe(xe);try{const ct=_.projectSlug===null?await cF({id:_.id,title:le}):await lF({projectSlug:_.projectSlug,assignmentSlug:_.slug,title:le});gt(pt=>pt.map(yt=>tn(yt)===xe?{...yt,title:ct.title,updated:ct.updated}:yt)),u()}catch(ct){throw gt(De),at(ct.message,"error"),ct}finally{pe(null)}}function Ii(_){nt(le=>{const xe=new Set(le);return xe.has(_)?xe.delete(_):xe.add(_),xe})}function bc(_){ve===_?go(he==="asc"?"desc":"asc"):(ca(_),go("asc"))}const Ln=Q?Ke.find(_=>tn(_)===Q)??null:null;function wo(_,le){_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",le),ye(le)}function Mi(){ye(null),lt(null)}function _i(_,le){if(!Ln)return;const xe=kl(Ln,le);Ln.status===le||xe!=null&&xe.disabled||(_.preventDefault(),_.dataTransfer.dropEffect="move",lt(le))}function Et(_,le){Re===le&&!_.currentTarget.contains(_.relatedTarget)&<(null)}function vc(_,le){if(_.preventDefault(),!Ln||Ln.status===le){Mi();return}Mi(),vo({item:Ln,toColumnId:le})}function Zr({field:_,children:le}){const xe=ve===_;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>bc(_),className:"inline-flex items-center gap-1 hover:text-foreground",children:[le,xe?he==="asc"?r.jsx(i0,{className:"h-3 w-3"}):r.jsx($r,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":b.density,children:[r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(Ee,{to:`${t}/assignments/new`,className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(rn,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(Kg,{children:[r.jsx(tf,{ref:s,value:L,onChange:W,placeholder:"Search assignments or projects"}),r.jsx(Rn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",options:Nf.map(_=>({value:_,label:w[_]??_})),value:oe,onChange:Ai}),r.jsx(Rn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",options:yc.map(_=>({value:_,label:_[0].toUpperCase()+_.slice(1)})),value:H,onChange:_r}),r.jsx(Rn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",options:m.definitions.map(_=>({value:_.id,label:ii(m,_.id)})),value:ne,onChange:oa}),r.jsx(Rn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",options:[{value:"__unassigned__",label:"Unassigned"},...da.filter(_=>_!=="__unassigned__").map(_=>({value:_,label:_}))],value:q,onChange:aa}),r.jsx(Rn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",options:[{value:"__standalone__",label:"Standalone"},...br.map(([_,le])=>({value:_,label:le}))],value:F,onChange:Di}),r.jsx(Rn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",options:Cf.map(_=>({value:_,label:_})),value:I,onChange:ia}),r.jsx(wx,{className:"max-w-[200px]",value:ge,onChange:U}),r.jsxs("select",{value:ae,onChange:_=>la(_.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]}),r.jsx("select",{value:O==="kanban"?Xe:Se,onChange:_=>kf(_.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:DD.map(_=>{const le=O==="kanban"&&_!=="status"&&_!=="type",xe=_==="none"?"No grouping":`Group: ${_.charAt(0).toUpperCase()+_.slice(1)}`;return r.jsx("option",{value:_,disabled:le,children:le?`${xe} (list only)`:xe},_)})}),r.jsx(nf,{value:O,onChange:_=>jf(_),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),O==="table"?r.jsx(oN,{visibility:Y,onChange:Ie}):null,r.jsx(pN,{scope:Gn,loadedViewId:Fe,onApply:Sf,onOpenSaveDialog:()=>{Wt(!1),Yt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Ae?xc():(Wt(!1),Yt(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:Ae?`Update ${Ae.name}`:"Save current view",children:Ae?`Update '${Ae.name}'`:"Save view"}),Ae?r.jsx("button",{type:"button",onClick:()=>{Wt(!0),Yt(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),a.assignments.length===0?r.jsx(St,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Ee,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(eg,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):jt.length===0?r.jsx(St,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):O==="table"?(()=>{const _=new Set(Y.hidden),le=xe=>xe==="title"||!_.has(xe);return r.jsx(We,{title:`${xo.length} assignment${xo.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[le("title")?r.jsx(Zr,{field:"title",children:"Assignment"}):null,le("status")?r.jsx(Zr,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),le("priority")?r.jsx(Zr,{field:"priority",children:"Priority"}):null,le("assignee")?r.jsx(Zr,{field:"assignee",children:"Assignee"}):null,le("dependencies")?r.jsx(Zr,{field:"dependencies",children:"Dependencies"}):null,le("created")?r.jsx(Zr,{field:"created",children:"Created"}):null,le("updated")?r.jsx(Zr,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:xo.map((xe,De)=>r.jsxs(LF,{detailHref:Kl(xe),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...xs(De),children:[le("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(DN,{title:xe.title,detailHref:Kl(xe),onSave:ct=>Oi(xe,ct),disabled:G===tn(xe)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:xe.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"mt-0.5 inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:xe.id,children:[xe.id.slice(0,8),r.jsx(Dr,{value:xe.id})]})]}):null,le("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:xe.status,disabled:G===tn(xe),onChange:ct=>vo({item:xe,toColumnId:ct.target.value}),className:Ce("appearance-none rounded-full border px-2.5 py-0.5 text-xs font-semibold tracking-wide outline-none","cursor-pointer bg-[length:12px] bg-[right_6px_center] bg-no-repeat pr-6",`bg-[url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E")]`,(md[xe.status]??md.pending).className,G===tn(xe)&&"animate-pulse opacity-60"),children:j.map(ct=>{const pt=xe.status===ct?void 0:kl(xe,ct),yt=(pt==null?void 0:pt.disabled)??!1;return r.jsx("option",{value:ct,disabled:yt,title:yt?(pt==null?void 0:pt.disabledReason)??void 0:void 0,children:w[ct]},ct)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(ea,{type:xe.type,compact:!0})}),le("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:xe.priority}):null,le("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:xe.assignee??"Unassigned"}):null,le("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:xe.dependsOn.length}):null,le("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Dn(xe.created)}):null,le("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Dn(xe.updated)}):null]},tn(xe)))})]})})})})():O==="list"?r.jsx("div",{className:"space-y-3",children:Li.map(({id:_,label:le,items:xe})=>{var on;if(xe.length===0&&!(Ln&&Se==="status"))return null;const De=!Me.has(_),ct=Se==="status",pt=ct&&Ln?Ln.status!==_&&!((on=kl(Ln,_))!=null&&on.disabled):!1,yt=ct&&Ln?Ln.status!==_&&!pt:!1,cn=ct&&Re===_;return r.jsxs("div",{className:Ce("rounded-lg border border-border/60 bg-card/90 transition",cn&&pt&&"ring-2 ring-ring/30",yt&&"border-dashed opacity-65"),onDragOver:ct?kn=>_i(kn,_):void 0,onDragLeave:ct?kn=>Et(kn,_):void 0,onDrop:ct?kn=>vc(kn,_):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>Ii(_),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx($r,{className:`h-4 w-4 text-muted-foreground transition-transform ${De?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:le}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:xe.length})]}),De&&xe.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:xe.map(kn=>{const Un=tn(kn),Fr=Q===Un,wc=yo.get(Un)??-1,jo=ct;return r.jsx("div",{draggable:jo,onDragStart:jo?vr=>wo(vr,Un):void 0,onDragEnd:jo?Mi:void 0,...wc>=0?xs(wc):{},className:Ce("transition",jo&&"cursor-grab active:cursor-grabbing",Fr&&"scale-[0.98] opacity-50"),children:r.jsx(cj,{assignment:kn,dragging:Fr,transitioning:G===Un,onPillSelect:vr=>void vo({item:kn,toColumnId:vr.targetStatus,action:vr}),onRenameTitle:vr=>Oi(kn,vr)})},Un)})})]},_)})}):r.jsx(Qd,{columns:Xe==="type"?Ef:k,items:jt,getItemId:tn,getColumnId:_=>Xe==="type"?_.type&&m.definitions.some(le=>le.id===_.type)?_.type:N:_.status,canDrop:({item:_,fromColumnId:le,toColumnId:xe})=>{if(le===xe)return{allowed:!0};const De=kl(_,xe);return De!=null&&De.disabled?{allowed:!1,reason:De.disabledReason||De.description}:{allowed:!0,reason:De?De.warning||De.description:`Move to ${xe} (direct status change).`}},onMove:Xe==="type"?void 0:({item:_,toColumnId:le})=>vo({item:_,toColumnId:le}),dragDisabled:Xe==="type",getExternalDragData:_=>_.projectSlug===null?{type:"standalone-assignment",id:_.id}:{type:"project-assignment",id:_.id},onCardContextMenu:(_,le)=>{le.preventDefault(),it({item:_,anchor:{x:le.clientX,y:le.clientY}})},emptyMessage:_=>`No ${_.title.toLowerCase()} assignments.`,hiddenColumnIds:Ye.hidden,onHideColumn:_=>ot(le=>({hidden:le.hidden.includes(_)?le.hidden.filter(De=>De!==_):[...le.hidden,_]})),renderCard:(_,{dragging:le})=>{const xe=yo.get(tn(_))??-1;return r.jsx("div",{...xe>=0?xs(xe):{},children:r.jsx(cj,{assignment:_,dragging:le,transitioning:G===tn(_),onPillSelect:De=>void vo({item:_,toColumnId:De.targetStatus,action:De}),onRenameTitle:De=>Oi(_,De)})})}}),r.jsx(na,{toast:Pt,onDismiss:ie}),r.jsx(fN,{open:$n,onOpenChange:_=>{Yt(_),_||Wt(!1)},initialName:sn&&Ae?`${Ae.name} (copy)`:"",title:sn?"Save as new view":"Save view",onSubmit:$i}),r.jsx(EN,{open:te!==null,action:(te==null?void 0:te.action)??null,assignmentTitle:(te==null?void 0:te.item.title)??"Assignment",loading:G===(te?tn(te.item):null),onOpenChange:_=>{_||be(null)},onConfirm:async _=>{if(!te)return;const le=te;await bo({item:le.item,toColumnId:le.toColumnId,action:le.action,reason:_})&&be(null)}}),r.jsx(GS,{anchor:(Le==null?void 0:Le.anchor)??null,items:Le?$F(Le.item,{onEdit:()=>{const _=Le.item,le=_.projectSlug===null?`/assignments/${_.id}`:`${_.projectWorkspace?`/w/${_.projectWorkspace}`:t}/projects/${_.projectSlug}/assignments/${_.slug}`;n(le)},onDelete:()=>bt(Le.item),onMove:()=>Be(Le.item)}):[],onClose:()=>it(null)}),r.jsx(sa,{open:_e!==null,title:"Delete assignment?",description:_e?`"${_e.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:_t!==null,onOpenChange:_=>{!_&&_t===null&&bt(null)},onConfirm:async()=>{if(!_e||_e.projectSlug===null){bt(null);return}const _=tn(_e);Gt(_);try{const le=await fetch(`/api/projects/${encodeURIComponent(_e.projectSlug)}/assignments/${encodeURIComponent(_e.slug)}`,{method:"DELETE"});if(!le.ok){const xe=await le.json().catch(()=>({}));throw new Error(xe.error||"Failed to delete assignment")}bt(null),u()}catch(le){alert(le instanceof Error?le.message:"Failed to delete assignment")}finally{Gt(null)}}}),r.jsx(Gg,{open:fe!==null,onOpenChange:_=>{_||Be(null)},currentWorkspace:(fe==null?void 0:fe.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async _=>{if(!fe)return;const le=await fetch(`/api/assignments/${encodeURIComponent(fe.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:_})});if(!le.ok){const xe=await le.json().catch(()=>({}));throw new Error(xe.error||"Failed to move assignment")}u()}})]})}function $F(e,t){const n=[{key:"edit",label:"Edit",icon:bi,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:or,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:$d,onSelect:t.onMove}),n}function LF({detailHref:e,children:t,className:n,...s}){const a=$N(e);return r.jsx("tr",{...s,ref:a.containerRef,className:n,onMouseDown:a.onMouseDown,onClick:a.onClick,children:t})}function cj({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:a}){var p;const l=Kl(e),c=!!(s&&a),u=$N(l);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:Ce("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",c&&"cursor-pointer"),onMouseDown:c?u.onMouseDown:void 0,onClick:c?u.onClick:void 0,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[c?r.jsx(DN,{title:e.title,detailHref:l,onSave:a,disabled:n}):r.jsx(Ee,{to:l,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:e.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:e.id??"",children:[(p=e.id)==null?void 0:p.slice(0,8),e.id&&r.jsx(Dr,{value:e.id})]})]}),c?r.jsx(RF,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n}):r.jsx(pn,{status:e.status})]}),e.blockedReason?r.jsx("p",{className:"mt-3 rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground",children:e.blockedReason}):null,r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ea,{type:e.type}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:e.priority}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:e.assignee??"Unassigned"}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," dependencies"]})]}),r.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{children:n?"Updating":t?"Dragging":"Source-first"}),r.jsx("span",{children:Dn(e.updated)})]})]})}function kl(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function tn(e){return e.id||e.slug||"unknown"}function Mr(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!t)return{order:[],blocks:new Map,body:e};const n=t[1],s=e.slice(t[0].length),a=n.split(`
|
|
551
551
|
`),l=[],c=new Map;let u=null,p=[];const m=()=>{u&&(l.push(u),c.set(u,p))};for(const h of a){const x=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(x&&!h.startsWith(" ")){m(),u=x[1],p=[h];continue}u&&p.push(h)}return m(),{order:l,blocks:c,body:s}}function Ni(e){return`---
|
|
552
552
|
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
553
553
|
`)}
|