syntaur 0.38.0 → 0.40.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/.claude-plugin/plugin.json +1 -1
- package/dashboard/dist/assets/{_basePickBy-CtdDyWI3.js → _basePickBy-D6criIXV.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-BrYcYu4o.js → _baseUniq-CKxMpzId.js} +1 -1
- package/dashboard/dist/assets/{arc-Blomplbp.js → arc-9r-o7jsh.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-D8DyWpkf.js → architectureDiagram-2XIMDMQ5-CNC47xK1.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-CZ6i8GXN.js → blockDiagram-WCTKOSBZ-CxLXL7nx.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-C7dPq0u5.js → c4Diagram-IC4MRINW-BLbJctin.js} +1 -1
- package/dashboard/dist/assets/channel-3nrYYZ_g.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-6zDBgBeT.js → chunk-4BX2VUAB-CDbpfqib.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-BZkCraj9.js → chunk-55IACEB6-L4WI8t-Y.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-CN2j-rFU.js → chunk-FMBD7UC4-By5-igEn.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-BYsbAdgs.js → chunk-JSJVCQXG-Q9k6_65Q.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-Dfc0aWQd.js → chunk-KX2RTZJC-BHIFtGWH.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-BiXmiDYL.js → chunk-NQ4KR5QH-B4NuJ8C_.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-R1hYMT_4.js → chunk-QZHKN3VN-BQyRAT6J.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-CC4nhvhI.js → chunk-WL4C6EOR-De4b_Qs3.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-B2kUF3N9.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-B2kUF3N9.js +1 -0
- package/dashboard/dist/assets/clone-CNGwk6vy.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-CNOFXwCb.js → cose-bilkent-S5V4N54A-DrH8QqS8.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-1JaoReCQ.js → dagre-KLK3FWXG-DPchOAoI.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-BxFw3-FY.js → diagram-E7M64L7V-jehxXjzH.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-Lfn8UJ8l.js → diagram-IFDJBPK2-Dk0Hd4w_.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-CoQQlPkY.js → diagram-P4PSJMXO-CTg6e3e_.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-DusriRlw.js → erDiagram-INFDFZHY-C53s82M7.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-_PmEAx7M.js → flowDiagram-PKNHOUZH-DuNh0Fc7.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-Bv3knxgm.js → ganttDiagram-A5KZAMGK-B74hkBwP.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-BQB5xLyK.js → gitGraphDiagram-K3NZZRJ6-CTwOleky.js} +1 -1
- package/dashboard/dist/assets/{graph-DIUO0LCp.js → graph-DuB65SUX.js} +1 -1
- package/dashboard/dist/assets/{index-BNdp0oDE.js → index-IKAckop6.js} +2 -2
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-CYB0Thzd.js → infoDiagram-LFFYTUFH-CPgiVLQb.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-GWvcZVsx.js → ishikawaDiagram-PHBUUO56-Di5CEnNR.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-jiBSGOCN.js → journeyDiagram-4ABVD52K-B1RhycTR.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-BTnx7SRz.js → kanban-definition-K7BYSVSG-vw0FgyVD.js} +1 -1
- package/dashboard/dist/assets/{layout-B5VNVxc3.js → layout-D4u8D4QF.js} +1 -1
- package/dashboard/dist/assets/{linear-CftlOwCN.js → linear-vN7TVTLe.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-kD88Q7JM.js → mermaid.core-CkrBXB3x.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-BbmIci4q.js → mindmap-definition-YRQLILUH-DF83eEZe.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-Hrt6DEtg.js → pieDiagram-SKSYHLDU-s6OowTfq.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-BhLoVS5K.js → quadrantDiagram-337W2JSQ-BdInZyNW.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-CtcoVCDD.js → requirementDiagram-Z7DCOOCP-ChbwbMIW.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-B9MMy-_E.js → sankeyDiagram-WA2Y5GQK-DISdO2ue.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-By_UEqGK.js → sequenceDiagram-2WXFIKYE-D12TBnwJ.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-CFda6FPd.js → stateDiagram-RAJIS63D-CgCT1a9a.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-wC4ehH_U.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-D35V4ptp.js → timeline-definition-YZTLITO2-Cp3_SQeH.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-BTcsnnaB.js → treemap-KZPCXAKY-CuMtPlep.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-D6mFW-zB.js → vennDiagram-LZ73GAT5-CoLZAO3b.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-CjXlzQeh.js → xychartDiagram-JWTSCODW-D96zGIQV.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/dashboard/server.js +87 -7
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +125 -20
- package/dist/index.js.map +1 -1
- package/dist/launch/index.d.ts +7 -1
- package/dist/launch/index.js +133 -9
- package/dist/launch/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
- package/platforms/codex/.codex-plugin/plugin.json +1 -1
- 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/dashboard/dist/assets/channel-Bf97NQLX.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-BuggR87C.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BuggR87C.js +0 -1
- package/dashboard/dist/assets/clone-BLOPzOsq.js +0 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-TKOTbQ__.js +0 -1
|
@@ -527,7 +527,7 @@ You can add a description to the \`${si}\` by passing a \`${Hk}\` component as a
|
|
|
527
527
|
|
|
528
528
|
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.
|
|
529
529
|
|
|
530
|
-
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},vD=_k,wD=Fk,Yk=zk,Jk=Bk,Xk=Kk,Qk=Gk,Zk=Vk,e1=Wk;const Ga=vD,jD=wD,t1=f.forwardRef(({className:e,...t},n)=>r.jsx(Yk,{ref:n,className:Ce("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));t1.displayName=Yk.displayName;const Bo=f.forwardRef(({className:e,...t},n)=>r.jsxs(jD,{children:[r.jsx(t1,{}),r.jsx(Jk,{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=Jk.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(Zk,{ref:n,className:Ce("text-lg font-semibold tracking-tight text-foreground",e),...t}));Uo.displayName=Zk.displayName;const Vo=f.forwardRef(({className:e,...t},n)=>r.jsx(e1,{ref:n,className:Ce("text-sm leading-6 text-muted-foreground",e),...t}));Vo.displayName=e1.displayName;const oo=f.forwardRef(({className:e,...t},n)=>r.jsx(Xk,{ref:n,className:Ce(e),...t}));oo.displayName=Xk.displayName;const Ul=f.forwardRef(({className:e,...t},n)=>r.jsx(Qk,{ref:n,className:Ce(e),...t}));Ul.displayName=Qk.displayName;const kD=[{to:"/",label:"Overview",icon:c0},{to:"/playbooks",label:"Playbooks",icon:a0},{to:"/memories",label:"Memories",icon:QT},{to:"/resources",label:"Resources",icon:pP},{to:"/inventories",label:"Inventories",icon:Ld},{to:"/usage",label:"Usage",icon:Od},{to:"/todos",label:"Todos",icon:Ar},{to:"/views",label:"Saved Views",icon:f0},{to:"/archive",label:"Archive",icon:Dd}],SD=[{suffix:"/projects",label:"Projects",icon:eg},{suffix:"/assignments",label:"Assignments",icon:gP},{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}],ND=[{to:"/help",label:"Help",icon:mP},{to:"/settings",label:"Settings",icon:CP}];function CD({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(Fv,{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(Fv,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(Z3,{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 Fv({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}=Ik(),c=Wn(),[u,p]=f.useState(new Set),[m,h]=f.useState(!1),[g,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=nD([...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(bv,{items:kD,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:SD.map(ne=>{const M=`${oe}${ne.suffix}`,q=C0(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=g.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:g,onChange:V=>y(V.target.value),onKeyDown:V=>{V.key==="Escape"&&(h(!1),y(""))},onBlur:()=>{g.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(bv,{items:ND,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 ED(){const e=Wn(),{workspace:t}=$t(),{title:n,breadcrumbs:s,projectSlug:a}=E0(e.pathname);return r.jsx(CD,{title:n,breadcrumbs:s,projectSlug:a,workspace:t??null,children:r.jsx(uT,{})})}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 TD({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 PD(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function RD({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=PD(l,{total:e.total,title:a}),u=s?AD(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 AD(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Rg=["kanban","list","table"],n1=["title","status","priority","assignee","dependencies","created","updated"],DD=["asc","desc"],$D=["comfortable","compact"],LD=["none","status","type","priority","assignee","project"],OD=["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 ID(e,t){const n=tt(e),s=tt(t);return n.length===s.length&&n.every(a=>s.includes(a))}const MD={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:MD,projects:{}};function km(e){return e==="table"?"table":"kanban"}function _D(e,t){return t?{...e,...t}:{...e}}function r1(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:_D(n.filters,s.filters)}:n}const Sm=["title","status","priority","assignee","dependencies","created","updated"],FD=["small","wide","tall","large"],zD={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},zv="2026-05-21T00:00:00Z";function Nm(e,t,n){return{id:e,name:t,workspace:null,config:{viewMode:"list",filters:{...zD,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:zv,updatedAt:zv}}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 s1(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 o1(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?s1(e.config,t.slug):!1}}const a1=`syntaur.savedViews.cache.v${ao.version}`;let oi=BD(),_o=null,Ag=null;const yh=new Set,cd=new Set;let i1=0;function l1(){return++i1}function bh(e){return e===i1}function BD(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(a1);if(!e)return null;const t=JSON.parse(e);return t.version!==ao.version?null:t}catch{return null}}function UD(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(a1,JSON.stringify(e))}catch{}}function c1(e){oi=e,Ag=null,UD(e);for(const t of yh)t(e);for(const t of cd)t(null)}function VD(e){Ag=e;for(const t of cd)t(e)}function u1(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 Bv(){if(_o)return _o;const e=l1();return _o=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=u1(t);return bh(e)&&c1(n),_o=null,oi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return bh(e)&&VD(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),Bv().then(y=>{m||(t(y),s(!1),l(!0))});const h=y=>{m||(t(y),s(!1),l(!0),u(null))},g=y=>{m||(u(y),s(!1),l(!0))};return yh.add(h),cd.add(g),()=>{m=!0,yh.delete(h),cd.delete(g)}},[]),{file:e,loading:n,ready:a,error:c,refetch:()=>{_o=null,s(!0),u(null),l(!1),Bv()}}}function Vd(){const{file:e,loading:t}=Dg();return{views:e.views,loading:t}}function HD(){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=l1(),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=u1(await a.json());return bh(s)&&c1(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 WD(e){return Hd("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function KD(e){return Hd("PUT","/api/dashboard",{slots:e})}const qD=["top","right","bottom","left"],co=Math.min,hr=Math.max,ud=Math.round,Pu=Math.floor,ds=e=>({x:e,y:e}),GD={left:"right",right:"left",bottom:"top",top:"bottom"};function vh(e,t,n){return hr(e,co(t,n))}function Ds(e,t){return typeof e=="function"?e(t):e}function $s(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 YD(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 JD(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 Uv=["left","right"],Vv=["right","left"],XD=["top","bottom"],QD=["bottom","top"];function ZD(e,t,n){switch(e){case"top":case"bottom":return n?t?Vv:Uv:t?Uv:Vv;case"left":case"right":return t?XD:QD;default:return[]}}function e4(e,t,n,s){const a=wi(e);let l=ZD($s(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=$s(e);return GD[t]+e.slice(t.length)}function t4(e){return{top:0,right:0,bottom:0,left:0,...e}}function d1(e){return typeof e!="number"?t4(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 Hv(e,t,n){let{reference:s,floating:a}=e;const l=ls(t),c=Ig(t),u=Og(c),p=$s(t),m=l==="y",h=s.x+s.width/2-a.width/2,g=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:g};break;case"left":b={x:s.x-a.width,y:g};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 n4(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:g="floating",altBoundary:y=!1,padding:b=0}=Ds(t,e),C=d1(b),w=u[y?g==="floating"?"reference":"floating":g],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=g==="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 r4=50,s4=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:n4},p=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:g}=Hv(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:g,initialPlacement:s,placement:y,strategy:a,middlewareData:C,rects:m,platform:u,elements:{reference:e,floating:t}});h=N??h,g=P??g,C[k]={...C[k],...$},T&&b<r4&&(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:g}=Hv(m,y,p)),j=-1)}return{x:h,y:g,placement:y,strategy:a,middlewareData:C}},o4=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}=Ds(e,t)||{};if(m==null)return{};const g=d1(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(g[k],J),L=co(g[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}}}),a4=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:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...w}=Ds(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=$s(a),E=ls(u),N=$s(u)===u,P=await(p.isRTL==null?void 0:p.isRTL(m.floating)),$=y||(N||!j?[dd(u)]:JD(u)),T=C!=="none";!y&&T&&$.push(...e4(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]),g){const z=YD(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&&(!(g==="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 Wv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Kv(e){return qD.some(t=>e[t]>=0)}const i4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:a="referenceHidden",...l}=Ds(e,t);switch(a){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),u=Wv(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Kv(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=Wv(c,n.floating);return{data:{escapedOffsets:u,escaped:Kv(u)}}}default:return{}}}}},f1=new Set(["left","top"]);async function l4(e,t){const{placement:n,platform:s,elements:a}=e,l=await(s.isRTL==null?void 0:s.isRTL(a.floating)),c=$s(n),u=wi(n),p=ls(n)==="y",m=f1.has(c)?-1:1,h=l&&p?-1:1,g=Ds(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:C}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.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 c4=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 l4(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}}}}},u4=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}=Ds(e,t),h={x:n,y:s},g=await l.detectOverflow(t,m),y=ls($s(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+g[k],P=C-g[E];C=vh(N,C,P)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",N=j+g[k],P=j-g[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}}}}}},d4=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}=Ds(e,t),h={x:n,y:s},g=ls(a),y=Lg(g);let b=h[y],C=h[g];const j=Ds(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=f1.has($s(a)),$=l.reference[g]-l.floating[N]+(P&&((k=c.offset)==null?void 0:k[g])||0)+(P?0:w.crossAxis),T=l.reference[g]+l.reference[N]+(P?0:((E=c.offset)==null?void 0:E[g])||0)-(P?w.crossAxis:0);C<$?C=$:C>T&&(C=T)}return{[y]:b,[g]:C}}}},f4=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}=Ds(e,t),h=await c.detectOverflow(t,m),g=$s(a),y=wi(a),b=ls(a)==="y",{width:C,height:j}=l.floating;let w,k;g==="top"||g==="bottom"?(w=g,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,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 p1(e)?(e.nodeName||"").toLowerCase():"#document"}function yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xs(e){var t;return(t=(p1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function p1(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 qv(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 p4(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 m4=/transform|translate|scale|rotate|perspective|filter/,h4=/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))||m4.test(t.willChange||"")||h4.test(t.contain||"")}function g4(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||qv(e)&&e.host||xs(e);return qv(t)?t.host:t}function m1(e){const t=uo(e);return fi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Is(t)&&ic(t)?t:m1(t)}function Hl(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=m1(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 h1(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}=h1(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 x4=ds(0);function g1(e){const t=yr(e);return!_g()||!t.visualViewport?x4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function y4(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=y4(l,n,s)?g1(l):ds(0);let p=(a.left+u.x)/c.x,m=(a.top+u.y)/c.y,h=a.width/c.x,g=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,g*=w.y,p+=N,m+=P,C=yr(j),j=jh(C)}}return fd({width:h,height:g,x:p,y:m})}function Yd(e,t){const n=Gd(e).scrollLeft;return t?t.left+n:Yo(xs(e)).left+n}function x1(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 b4(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const l=a==="fixed",c=xs(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),g=Is(s);if((g||!g&&!l)&&((ji(s)!=="body"||ic(c))&&(p=Gd(s)),g)){const b=Yo(s);m=ai(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!l?x1(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 v4(e){return Array.from(e.getClientRects())}function w4(e){const t=xs(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 Gv=25;function j4(e,t){const n=yr(e),s=xs(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,g=h.body,y=getComputedStyle(g),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,C=Math.abs(s.clientWidth-g.clientWidth-b);C<=Gv&&(l-=C)}else m<=Gv&&(l+=m);return{width:l,height:c,x:u,y:p}}function k4(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 Yv(e,t,n){let s;if(t==="viewport")s=j4(e,n);else if(t==="document")s=w4(xs(e));else if(qr(t))s=k4(t,n);else{const a=g1(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return fd(s)}function y1(e,t){const n=uo(e);return n===t||!qr(n)||fi(n)?!1:Gr(n).position==="fixed"||y1(n,t)}function S4(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&&y1(e,c))?s=s.filter(h=>h!==c):a=u,c=uo(c)}return t.set(e,s),s}function N4(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?qd(t)?[]:S4(t,this._c):[].concat(n),s],u=Yv(t,c[0],a);let p=u.top,m=u.right,h=u.bottom,g=u.left;for(let y=1;y<c.length;y++){const b=Yv(t,c[y],a);p=hr(b.top,p),m=co(b.right,m),h=co(b.bottom,h),g=hr(b.left,g)}return{width:m-g,height:h-p,x:g,y:p}}function C4(e){const{width:t,height:n}=h1(e);return{width:t,height:n}}function E4(e,t,n){const s=Is(t),a=xs(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?x1(a,u):ds(0),g=c.left+u.scrollLeft-p.x-h.x,y=c.top+u.scrollTop-p.y-h.y;return{x:g,y,width:c.width,height:c.height}}function Em(e){return Gr(e).position==="static"}function Jv(e,t){if(!Is(e)||Gr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return xs(e)===n&&(n=n.ownerDocument.body),n}function b1(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=Jv(e,t);for(;s&&p4(s)&&Em(s);)s=Jv(s,t);return s&&fi(s)&&Em(s)&&!Mg(s)?n:s||g4(e)||n}const T4=async function(e){const t=this.getOffsetParent||b1,n=this.getDimensions,s=await n(e.floating);return{reference:E4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function P4(e){return Gr(e).direction==="rtl"}const R4={convertOffsetParentRelativeRectToViewportRelativeRect:b4,getDocumentElement:xs,getClippingRect:N4,getOffsetParent:b1,getElementRects:T4,getClientRects:v4,getDimensions:C4,getScale:ai,isElement:qr,isRTL:P4};function v1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function A4(e,t){let n=null,s;const a=xs(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:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const C=Pu(g),j=Pu(a.clientWidth-(h+y)),w=Pu(a.clientHeight-(g+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&&!v1(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 D4(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 g=m&&u?A4(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&&!v1(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)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,p&&cancelAnimationFrame(C)}}const $4=c4,L4=u4,O4=a4,I4=f4,M4=i4,Xv=o4,_4=d4,F4=(e,t,n)=>{const s=new Map,a={platform:R4,...n},l={...a.platform,_c:s};return s4(e,t,{...a,platform:l})};var z4=typeof document<"u",B4=function(){},Gu=z4?f.useLayoutEffect:B4;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 w1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qv(e,t){const n=w1(e);return Math.round(t*n)/n}function Tm(e){const t=f.useRef(e);return Gu(()=>{t.current=e}),t}function U4(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,g]=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),F4(T.current,D.current,M).then(q=>{const A={...q,isPositioned:W.current!==!1};z.current&&!pd(O.current,A)&&(O.current=A,Ps.flushSync(()=>{g(A)}))})},[y,t,n,L,W]);Gu(()=>{m===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,g(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=Qv(ee.floating,h.x),A=Qv(ee.floating,h.y);return u?{...M,transform:"translate("+q+"px, "+A+"px)",...w1(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 V4=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?Xv({element:s.current,padding:a}).fn(n):{}:s?Xv({element:s,padding:a}).fn(n):{}}}},H4=(e,t)=>{const n=$4(e);return{name:n.name,fn:n.fn,options:[e,t]}},W4=(e,t)=>{const n=L4(e);return{name:n.name,fn:n.fn,options:[e,t]}},K4=(e,t)=>({fn:_4(e).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=I4(e);return{name:n.name,fn:n.fn,options:[e,t]}},Y4=(e,t)=>{const n=M4(e);return{name:n.name,fn:n.fn,options:[e,t]}},J4=(e,t)=>{const n=V4(e);return{name:n.name,fn:n.fn,options:[e,t]}};var X4="Arrow",j1=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"})})});j1.displayName=X4;var Q4=j1;function Z4(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",[k1,S1]=Xo(zg),[e$,N1]=k1(zg),C1=e=>{const{__scopePopper:t,children:n}=e,[s,a]=f.useState(null);return r.jsx(e$,{scope:t,anchor:s,onAnchorChange:a,children:n})};C1.displayName=zg;var E1="PopperAnchor",T1=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,l=N1(E1,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})});T1.displayName=E1;var Bg="PopperContent",[t$,n$]=k1(Bg),P1=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:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:C,...j}=e,w=N1(Bg,n),[k,E]=f.useState(null),N=Fn(t,Ye=>E(Ye)),[P,$]=f.useState(null),T=Z4(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(s$),altBoundary:W},{refs:z,floatingStyles:H,placement:ee,isPositioned:ne,middlewareData:M}=U4({strategy:"fixed",placement:J,whileElementsMounted:(...Ye)=>D4(...Ye,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[H4({mainAxis:a+O,alignmentAxis:c}),p&&W4({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?K4():void 0,...oe}),p&&q4({...oe}),G4({...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&&J4({element:P,padding:u}),o$({arrowWidth:D,arrowHeight:O}),y&&Y4({strategy:"referenceHidden",...oe})]}),[q,A]=D1(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,de=((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(t$,{scope:n,placedSide:q,onArrowChange:$,arrowX:Z,arrowY:I,shouldHideArrow:de,children:r.jsx(mn.div,{"data-side":q,"data-align":A,...j,ref:N,style:{...j.style,animation:ne?void 0:"none"}})})})});P1.displayName=Bg;var R1="PopperArrow",r$={top:"bottom",right:"left",bottom:"top",left:"right"},A1=f.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,l=n$(R1,s),c=r$[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(Q4,{...a,ref:n,style:{...a.style,display:"block"}})})});A1.displayName=R1;function s$(e){return e!==null}var o$=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]=D1(n),g={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?g:`${y}px`,j=`${-p}px`):m==="top"?(C=c?g:`${y}px`,j=`${s.floating.height+p}px`):m==="right"?(C=`${-p}px`,j=c?g:`${b}px`):m==="left"&&(C=`${s.floating.width+p}px`,j=c?g:`${b}px`),{data:{x:C,y:j}}}});function D1(e){const[t,n="center"]=e.split("-");return[t,n]}var a$=C1,i$=T1,l$=P1,c$=A1,u$=Symbol("radix.slottable");function d$(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=u$,t}var f$=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"}),p$="VisuallyHidden",$1=f.forwardRef((e,t)=>r.jsx(mn.span,{...e,ref:t,style:{...f$,...e.style}}));$1.displayName=p$;var m$=$1,[Jd]=Xo("Tooltip",[S1]),Xd=S1(),L1="TooltipProvider",h$=700,kh="tooltip.open",[g$,Ug]=Jd(L1),O1=e=>{const{__scopeTooltip:t,delayDuration:n=h$,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(g$,{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})};O1.displayName=L1;var Wl="Tooltip",[x$,lc]=Jd(Wl),I1=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,g]=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(a$,{...m,children:r.jsx(x$,{scope:t,contentId:y,open:k,stateAttribute:N,trigger:h,onTriggerChange:g,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})})};I1.displayName=Wl;var Sh="TooltipTrigger",M1=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),g=f.useCallback(()=>m.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),r.jsx(i$,{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",g,{once:!0})}),onFocus:qt(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:qt(e.onBlur,a.onClose),onClick:qt(e.onClick,a.onClose)})})});M1.displayName=Sh;var Vg="TooltipPortal",[y$,b$]=Jd(Vg,{forceMount:void 0}),_1=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,l=lc(Vg,t);return r.jsx(y$,{scope:t,forceMount:n,children:r.jsx(Qo,{present:n||l.open,children:r.jsx(gg,{asChild:!0,container:a,children:s})})})};_1.displayName=Vg;var pi="TooltipContent",F1=f.forwardRef((e,t)=>{const n=b$(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(z1,{side:a,...l,ref:t}):r.jsx(v$,{side:a,...l,ref:t})})}),v$=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:g}=s,y=f.useCallback(()=>{u(null),g(!1)},[g]),b=f.useCallback((C,j)=>{const w=C.currentTarget,k={x:C.clientX,y:C.clientY},E=N$(k,w.getBoundingClientRect()),N=C$(k,E),P=E$(j.getBoundingClientRect()),$=P$([...N,...P]);u($),g(!0)},[g]);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=!T$(k,c);E?y():N&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[p,h,c,m,y]),r.jsx(z1,{...e,ref:l})}),[w$,j$]=Jd(Wl,{isInside:!1}),k$=d$("TooltipContent"),z1=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 g=y=>{const b=y.target;b!=null&&b.contains(p.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[p.trigger,h]),r.jsx(hg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(l$,{"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(k$,{children:s}),r.jsx(w$,{scope:n,isInside:!0,children:r.jsx(m$,{id:p.contentId,role:"tooltip",children:a||s})})]})})});F1.displayName=pi;var B1="TooltipArrow",S$=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=Xd(n);return j$(B1,n).isInside?null:r.jsx(c$,{...a,...s,ref:t})});S$.displayName=B1;function N$(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 C$(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 E$(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 T$(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,g=p.x,y=p.y;h>s!=y>s&&n<(g-m)*(s-h)/(y-h)+m&&(a=!a)}return a}function P$(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),R$(t)}function R$(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 A$=O1,D$=I1,$$=M1,L$=_1,U1=F1;const Wo=A$,Pr=D$,Rr=$$,gr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(L$,{children:r.jsx(U1,{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=U1.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,g=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(hs,{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:g,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:g,onClick:()=>s(!1),children:b},p.key):r.jsx("button",{type:"button",className:g,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(iP,{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(i0,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?p.submenu.map(g=>u(g,!0)):null]},p.key)}return u(p,!1)})})})]})}function Zv(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const O$={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 I$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function M$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function _$(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=O$[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<I$(l)||c&&a>M$(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),g=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"&&!Zv(e.updated)||y==="fresh"&&Zv(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(g.length){const b=e.tags??[];if(!g.some(C=>b.includes(C)))return!1}if(!_$(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 V1={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 F$(){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,V1)),Fo)}function Zo(){const[e,t]=f.useState(()=>Rl??V1);return f.useEffect(()=>{F$().then(t)},[]),e}function ew(){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 tw={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=(tw[a.priority]??99)-(tw[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:g,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&&g?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:()=>g(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}),g?r.jsx("button",{type:"button",onClick:()=>g(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(z$,{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 z$({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",B$="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",U$="border-status-review-foreground/30 bg-status-review text-status-review-foreground",V$="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",H$="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",W$="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:nP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:El,icon:c0},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Pm,icon:vP},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:B$,icon:lh},review:{label:"Review",description:"Ready for inspection or approval.",className:U$,icon:kP},completed:{label:"Completed",description:"Finished successfully.",className:V$,icon:Zh},failed:{label:"Failed",description:"Could not be completed as planned.",className:H$,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:eP},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:W$,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 H1(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:H1(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 W1={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 K$(){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,W1)),za)}function ef(){const[e,t]=f.useState(()=>Yu??W1);return f.useEffect(()=>{K$().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 q$(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=q$(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(hs,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(rd,{className:"h-3 w-3","aria-hidden":"true"})})}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,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(g=>{const y=new Set(g);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 g=uc(e.filter(C=>C.status===h),n,s);if(g.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:g.length})]}),y&&r.jsx("ul",{className:Ce("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:g.map(C=>{const j=G$(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 J$(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function X$({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 g=J$(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:g,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 Q$(e,t,n){return e.filter(s=>Wg(s,t,{workspace:n,search:t.search}))}function K1({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=Q$(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(Z$,{item:m}):r.jsx(eL,{item:m})});case"list":return r.jsx(Y$,{items:p,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(X$,{items:p,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function Z$({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 eL({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 tL({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(K1,{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 nL({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(rL,{session:t})},t.sessionId))})]})}function rL({session:e}){const t=ln(),[n,s]=f.useState(!1),a=sL(e,t),l=oL(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," · ",S0(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 sL(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function oL(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}function aL(){const{data:e,loading:t,error:n}=B0();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(nL,{sessions:(e==null?void 0:e.sessions)??[]})}const iL=5;function lL(){const{data:e,loading:t,error:n}=z0();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,iL);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 q1={"saved-view":{title:"Saved view",icon:f0,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(tL,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Ad,render:()=>f.createElement(aL)},inventories:{title:"Inventories",icon:Ld,render:()=>f.createElement(lL)}},cL={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},uL={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function dL({slot:e,onReplace:t,onRemove:n,onResize:s}){const a=e.size??"small",l=cL[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=q1[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(fL,{slot:e,fallback:c.title})})]}),r.jsx(Hg,{items:[{key:"replace",label:"Replace…",icon:wP,onSelect:t},{key:"size",label:"Size",icon:xP,submenu:FD.map(p=>({key:`size-${p}`,label:uL[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 fL({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 pL=["agent-sessions","inventories"];function mL({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(gs,{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:pL.map(c=>{const u=q1[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 hL(){const{data:e,error:t,refetch:n}=bR(),{data:s}=M0(),{layout:a}=HD(),[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 g=f.useCallback(k=>{p(k),c(!0)},[]),y=f.useCallback(async k=>{h(null);try{await KD(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(RD,{hero:e.hero,itemsById:w}):t?r.jsx(wt,{error:t}):r.jsx(mt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(TD,{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(dL,{slot:k,index:E,onReplace:()=>g(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(mL,{open:l,onOpenChange:k=>{c(k),k||p(null)},onSelect:b})]})}function gL({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 xL(){const{data:e,loading:t,error:n}=M0(),{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(gL,{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 yL={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"},nw=["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:yL[p]??nw[c++%nw.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 bL=["pending","active","blocked","failed","completed"],qg=bL,vL=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function G1(e){return e&&e.length>0?e:[...vL]}function wL(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 jL=220,Au=8;function Y1({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)??jL,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 kL="__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,g]=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:kL,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function w(){if(j){g(!0),b(null);try{await s(p),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{g(!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(gs,{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(hs,{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 rw(){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,g]=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)=>CL(M,q,C)):[],[s,p,h,y,C,e]),W=L.map(M=>`${M.slug}:${M.status}`).join("|");f.useEffect(()=>{T(EL(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=>g(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:NL,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(de=>de.status===q).map(de=>de.slug);T(de=>({...de,[q]:wL(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(TL,{project:M,dragging:q})})}}),r.jsx(Y1,{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 SL={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},NL=qg.map(e=>({id:e,title:SL[e],description:Zd(e)}));function CL(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return sw(t)-sw(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function sw(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function EL(e){return Object.fromEntries(qg.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function TL({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 PL=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},PL)},[]);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 RL(){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 ow(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function AL(){const{data:e,loading:t,error:n,refetch:s}=vR(),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState({}),{toast:h,showToast:g,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(),g($,"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(i0,{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:ow($),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:ow(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(RL,{}),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 aw="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",iw="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(aw,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${a} in ${n.system}`,children:[r.jsx("span",{className:iw,children:a}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:aw,title:a,children:r.jsx("span",{className:iw,children:a})},l)})})}const DL={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(DL[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 lw(e){const t=$L(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(OL);if(p){const m=p.props.children,h=u.map(g=>g===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);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 $L(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=ML(a),u=IL(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 LL=Symbol("radix.slottable");function OL(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===LL}function IL(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 ML(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 _L(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=lw(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",g="data-radix-collection-item",y=lw(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,{[g]:"",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(`[${g}]`));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 FL=f.createContext(void 0);function J1(e){const t=f.useContext(FL);return e||t||"ltr"}var Rm="rovingFocusGroup.onEntryFocus",zL={bubbles:!1,cancelable:!0},dc="RovingFocusGroup",[Nh,X1,BL]=_L(dc),[UL,Q1]=Xo(dc,[BL]),[VL,HL]=UL(dc),Z1=f.forwardRef((e,t)=>r.jsx(Nh.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Nh.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(WL,{...e,ref:t})})}));Z1.displayName=dc;var WL=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,...g}=e,y=f.useRef(null),b=Fn(t,y),C=J1(l),[j,w]=zd({prop:c,defaultProp:u??null,onChange:p,caller:dc}),[k,E]=f.useState(!1),N=Ko(m),P=X1(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(VL,{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,...g,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,zL);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);nS(H,h)}}$.current=!1}),onBlur:qt(e.onBlur,()=>E(!1))})})}),eS="RovingFocusGroupItem",tS=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=HL(eS,n),g=h.currentTabStopId===m,y=X1(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:g?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=GL(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?YL(N,P+1):N.slice(P+1)}setTimeout(()=>nS(N))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:j!=null}):c})})});tS.displayName=eS;var KL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function GL(e,t,n){const s=qL(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return KL[s]}function nS(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function YL(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var JL=Z1,XL=tS,rf="Tabs",[QL]=Xo(rf,[Q1]),rS=Q1(),[ZL,Jg]=QL(rf),sS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:p="automatic",...m}=e,h=J1(u),[g,y]=zd({prop:s,onChange:a,defaultProp:l??"",caller:rf});return r.jsx(ZL,{scope:n,baseId:ni(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(mn.div,{dir:h,"data-orientation":c,...m,ref:t})})});sS.displayName=rf;var oS="TabsList",aS=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,l=Jg(oS,n),c=rS(n);return r.jsx(JL,{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})})});aS.displayName=oS;var iS="TabsTrigger",lS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...l}=e,c=Jg(iS,n),u=rS(n),p=dS(c.baseId,s),m=fS(c.baseId,s),h=s===c.value;return r.jsx(XL,{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,g=>{!a&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:qt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:qt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!a&&g&&c.onValueChange(s)})})})});lS.displayName=iS;var cS="TabsContent",uS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:l,...c}=e,u=Jg(cS,n),p=dS(u.baseId,s),m=fS(u.baseId,s),h=s===u.value,g=f.useRef(h);return f.useEffect(()=>{const y=requestAnimationFrame(()=>g.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:g.current?"0s":void 0},children:y&&l})})});uS.displayName=cS;function dS(e,t){return`${e}-trigger-${t}`}function fS(e,t){return`${e}-content-${t}`}var pS=sS,mS=aS,Ch=lS,Eh=uS;function Xg({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(pS,{value:e,onValueChange:t,className:s,children:[r.jsx(mS,{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 eO="modulepreload",tO=function(e){return"/"+e},cw={},nO=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(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};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=tO(m),m in cw)return;cw[m]=!0;const h=m.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":eO,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 rO({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 g(){if(s.current)try{const y=(await nO(async()=>{const{default:j}=await import("./mermaid.core-kD88Q7JM.js").then(w=>w.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:sO(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,oO(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),g(),()=>{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 sO(e){const t=document.documentElement,n=g=>{const y=getComputedStyle(t).getPropertyValue(g).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 oO(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 aO(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const iO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cO={};function uw(e,t){return(cO.jsx?lO:iO).test(e)}const uO=/[ \t\n\f\r]/g;function dO(e){return typeof e=="object"?e.type==="text"?dw(e.value):!1:dw(e)}function dw(e){return e.replace(uO,"")===""}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 hS(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 fO=0;const dt=ra(),dn=ra(),Ph=ra(),Te=ra(),It=ra(),li=ra(),pr=ra();function ra(){return 2**++fO}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),fw(this,"space",a),typeof s=="number")for(;++l<Am.length;){const c=Am[l];fw(this,Am[l],(s&Rh[c])===Rh[c])}}}Qg.prototype.defined=!0;function fw(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 gS=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 xS(e,t){return t in e?e[t]:t}function yS(e,t){return xS(e,t.toLowerCase())}const pO=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:yS}),mO=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:xS}),bS=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()}}),vS=ki({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yS}),wS=ki({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),hO={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"},gO=/[A-Z]/g,pw=/-[a-z]/g,xO=/^data[-\w.:]+$/i;function yO(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"&&xO.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(pw,vO);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!pw.test(l)){let c=l.replace(gO,bO);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Qg}return new a(s,t)}function bO(e){return"-"+e.toLowerCase()}function vO(e){return e.charAt(1).toUpperCase()}const wO=hS([gS,pO,bS,vS,wS],"html"),Zg=hS([gS,mO,bS,vS,wS],"svg");function jO(e){return e.join(" ").trim()}var Ba={},Dm,mw;function kO(){if(mw)return Dm;mw=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=`
|
|
530
|
+
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},vD=_k,wD=Fk,Yk=zk,Jk=Bk,Xk=Kk,Qk=Gk,Zk=Vk,e1=Wk;const Ga=vD,jD=wD,t1=f.forwardRef(({className:e,...t},n)=>r.jsx(Yk,{ref:n,className:Ce("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));t1.displayName=Yk.displayName;const Bo=f.forwardRef(({className:e,...t},n)=>r.jsxs(jD,{children:[r.jsx(t1,{}),r.jsx(Jk,{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=Jk.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(Zk,{ref:n,className:Ce("text-lg font-semibold tracking-tight text-foreground",e),...t}));Uo.displayName=Zk.displayName;const Vo=f.forwardRef(({className:e,...t},n)=>r.jsx(e1,{ref:n,className:Ce("text-sm leading-6 text-muted-foreground",e),...t}));Vo.displayName=e1.displayName;const oo=f.forwardRef(({className:e,...t},n)=>r.jsx(Xk,{ref:n,className:Ce(e),...t}));oo.displayName=Xk.displayName;const Ul=f.forwardRef(({className:e,...t},n)=>r.jsx(Qk,{ref:n,className:Ce(e),...t}));Ul.displayName=Qk.displayName;const kD=[{to:"/",label:"Overview",icon:c0},{to:"/playbooks",label:"Playbooks",icon:a0},{to:"/memories",label:"Memories",icon:QT},{to:"/resources",label:"Resources",icon:pP},{to:"/inventories",label:"Inventories",icon:Ld},{to:"/usage",label:"Usage",icon:Od},{to:"/todos",label:"Todos",icon:Ar},{to:"/views",label:"Saved Views",icon:f0},{to:"/archive",label:"Archive",icon:Dd}],SD=[{suffix:"/projects",label:"Projects",icon:eg},{suffix:"/assignments",label:"Assignments",icon:gP},{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}],ND=[{to:"/help",label:"Help",icon:mP},{to:"/settings",label:"Settings",icon:CP}];function CD({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(Fv,{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(Fv,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(Z3,{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 Fv({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}=Ik(),c=Wn(),[u,p]=f.useState(new Set),[m,h]=f.useState(!1),[g,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=nD([...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(bv,{items:kD,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:SD.map(ne=>{const M=`${oe}${ne.suffix}`,q=C0(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=g.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:g,onChange:V=>y(V.target.value),onKeyDown:V=>{V.key==="Escape"&&(h(!1),y(""))},onBlur:()=>{g.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(bv,{items:ND,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 ED(){const e=Wn(),{workspace:t}=$t(),{title:n,breadcrumbs:s,projectSlug:a}=E0(e.pathname);return r.jsx(CD,{title:n,breadcrumbs:s,projectSlug:a,workspace:t??null,children:r.jsx(uT,{})})}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 TD({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 PD(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function RD({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=PD(l,{total:e.total,title:a}),u=s?AD(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 AD(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Rg=["kanban","list","table"],n1=["title","status","priority","assignee","dependencies","created","updated"],DD=["asc","desc"],$D=["comfortable","compact"],LD=["none","status","type","priority","assignee","project"],OD=["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 ID(e,t){const n=tt(e),s=tt(t);return n.length===s.length&&n.every(a=>s.includes(a))}const MD={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:MD,projects:{}};function km(e){return e==="table"?"table":"kanban"}function _D(e,t){return t?{...e,...t}:{...e}}function r1(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:_D(n.filters,s.filters)}:n}const Sm=["title","status","priority","assignee","dependencies","created","updated"],FD=["small","wide","tall","large"],zD={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},zv="2026-05-21T00:00:00Z";function Nm(e,t,n){return{id:e,name:t,workspace:null,config:{viewMode:"list",filters:{...zD,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:zv,updatedAt:zv}}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 s1(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 o1(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?s1(e.config,t.slug):!1}}const a1=`syntaur.savedViews.cache.v${ao.version}`;let oi=BD(),_o=null,Ag=null;const yh=new Set,cd=new Set;let i1=0;function l1(){return++i1}function bh(e){return e===i1}function BD(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(a1);if(!e)return null;const t=JSON.parse(e);return t.version!==ao.version?null:t}catch{return null}}function UD(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(a1,JSON.stringify(e))}catch{}}function c1(e){oi=e,Ag=null,UD(e);for(const t of yh)t(e);for(const t of cd)t(null)}function VD(e){Ag=e;for(const t of cd)t(e)}function u1(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 Bv(){if(_o)return _o;const e=l1();return _o=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=u1(t);return bh(e)&&c1(n),_o=null,oi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return bh(e)&&VD(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),Bv().then(y=>{m||(t(y),s(!1),l(!0))});const h=y=>{m||(t(y),s(!1),l(!0),u(null))},g=y=>{m||(u(y),s(!1),l(!0))};return yh.add(h),cd.add(g),()=>{m=!0,yh.delete(h),cd.delete(g)}},[]),{file:e,loading:n,ready:a,error:c,refetch:()=>{_o=null,s(!0),u(null),l(!1),Bv()}}}function Vd(){const{file:e,loading:t}=Dg();return{views:e.views,loading:t}}function HD(){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=l1(),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=u1(await a.json());return bh(s)&&c1(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 WD(e){return Hd("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function KD(e){return Hd("PUT","/api/dashboard",{slots:e})}const qD=["top","right","bottom","left"],co=Math.min,hr=Math.max,ud=Math.round,Pu=Math.floor,ds=e=>({x:e,y:e}),GD={left:"right",right:"left",bottom:"top",top:"bottom"};function vh(e,t,n){return hr(e,co(t,n))}function Ds(e,t){return typeof e=="function"?e(t):e}function $s(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 YD(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 JD(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 Uv=["left","right"],Vv=["right","left"],XD=["top","bottom"],QD=["bottom","top"];function ZD(e,t,n){switch(e){case"top":case"bottom":return n?t?Vv:Uv:t?Uv:Vv;case"left":case"right":return t?XD:QD;default:return[]}}function e4(e,t,n,s){const a=wi(e);let l=ZD($s(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=$s(e);return GD[t]+e.slice(t.length)}function t4(e){return{top:0,right:0,bottom:0,left:0,...e}}function d1(e){return typeof e!="number"?t4(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 Hv(e,t,n){let{reference:s,floating:a}=e;const l=ls(t),c=Ig(t),u=Og(c),p=$s(t),m=l==="y",h=s.x+s.width/2-a.width/2,g=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:g};break;case"left":b={x:s.x-a.width,y:g};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 n4(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:g="floating",altBoundary:y=!1,padding:b=0}=Ds(t,e),C=d1(b),w=u[y?g==="floating"?"reference":"floating":g],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=g==="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 r4=50,s4=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:n4},p=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:g}=Hv(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:g,initialPlacement:s,placement:y,strategy:a,middlewareData:C,rects:m,platform:u,elements:{reference:e,floating:t}});h=N??h,g=P??g,C[k]={...C[k],...$},T&&b<r4&&(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:g}=Hv(m,y,p)),j=-1)}return{x:h,y:g,placement:y,strategy:a,middlewareData:C}},o4=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}=Ds(e,t)||{};if(m==null)return{};const g=d1(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(g[k],J),L=co(g[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}}}),a4=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:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...w}=Ds(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=$s(a),E=ls(u),N=$s(u)===u,P=await(p.isRTL==null?void 0:p.isRTL(m.floating)),$=y||(N||!j?[dd(u)]:JD(u)),T=C!=="none";!y&&T&&$.push(...e4(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]),g){const z=YD(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&&(!(g==="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 Wv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Kv(e){return qD.some(t=>e[t]>=0)}const i4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:a="referenceHidden",...l}=Ds(e,t);switch(a){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),u=Wv(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Kv(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=Wv(c,n.floating);return{data:{escapedOffsets:u,escaped:Kv(u)}}}default:return{}}}}},f1=new Set(["left","top"]);async function l4(e,t){const{placement:n,platform:s,elements:a}=e,l=await(s.isRTL==null?void 0:s.isRTL(a.floating)),c=$s(n),u=wi(n),p=ls(n)==="y",m=f1.has(c)?-1:1,h=l&&p?-1:1,g=Ds(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:C}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.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 c4=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 l4(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}}}}},u4=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}=Ds(e,t),h={x:n,y:s},g=await l.detectOverflow(t,m),y=ls($s(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+g[k],P=C-g[E];C=vh(N,C,P)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",N=j+g[k],P=j-g[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}}}}}},d4=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}=Ds(e,t),h={x:n,y:s},g=ls(a),y=Lg(g);let b=h[y],C=h[g];const j=Ds(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=f1.has($s(a)),$=l.reference[g]-l.floating[N]+(P&&((k=c.offset)==null?void 0:k[g])||0)+(P?0:w.crossAxis),T=l.reference[g]+l.reference[N]+(P?0:((E=c.offset)==null?void 0:E[g])||0)-(P?w.crossAxis:0);C<$?C=$:C>T&&(C=T)}return{[y]:b,[g]:C}}}},f4=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}=Ds(e,t),h=await c.detectOverflow(t,m),g=$s(a),y=wi(a),b=ls(a)==="y",{width:C,height:j}=l.floating;let w,k;g==="top"||g==="bottom"?(w=g,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,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 p1(e)?(e.nodeName||"").toLowerCase():"#document"}function yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xs(e){var t;return(t=(p1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function p1(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 qv(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 p4(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 m4=/transform|translate|scale|rotate|perspective|filter/,h4=/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))||m4.test(t.willChange||"")||h4.test(t.contain||"")}function g4(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||qv(e)&&e.host||xs(e);return qv(t)?t.host:t}function m1(e){const t=uo(e);return fi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Is(t)&&ic(t)?t:m1(t)}function Hl(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=m1(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 h1(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}=h1(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 x4=ds(0);function g1(e){const t=yr(e);return!_g()||!t.visualViewport?x4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function y4(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=y4(l,n,s)?g1(l):ds(0);let p=(a.left+u.x)/c.x,m=(a.top+u.y)/c.y,h=a.width/c.x,g=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,g*=w.y,p+=N,m+=P,C=yr(j),j=jh(C)}}return fd({width:h,height:g,x:p,y:m})}function Yd(e,t){const n=Gd(e).scrollLeft;return t?t.left+n:Yo(xs(e)).left+n}function x1(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 b4(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const l=a==="fixed",c=xs(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),g=Is(s);if((g||!g&&!l)&&((ji(s)!=="body"||ic(c))&&(p=Gd(s)),g)){const b=Yo(s);m=ai(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!l?x1(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 v4(e){return Array.from(e.getClientRects())}function w4(e){const t=xs(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 Gv=25;function j4(e,t){const n=yr(e),s=xs(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,g=h.body,y=getComputedStyle(g),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,C=Math.abs(s.clientWidth-g.clientWidth-b);C<=Gv&&(l-=C)}else m<=Gv&&(l+=m);return{width:l,height:c,x:u,y:p}}function k4(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 Yv(e,t,n){let s;if(t==="viewport")s=j4(e,n);else if(t==="document")s=w4(xs(e));else if(qr(t))s=k4(t,n);else{const a=g1(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return fd(s)}function y1(e,t){const n=uo(e);return n===t||!qr(n)||fi(n)?!1:Gr(n).position==="fixed"||y1(n,t)}function S4(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&&y1(e,c))?s=s.filter(h=>h!==c):a=u,c=uo(c)}return t.set(e,s),s}function N4(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?qd(t)?[]:S4(t,this._c):[].concat(n),s],u=Yv(t,c[0],a);let p=u.top,m=u.right,h=u.bottom,g=u.left;for(let y=1;y<c.length;y++){const b=Yv(t,c[y],a);p=hr(b.top,p),m=co(b.right,m),h=co(b.bottom,h),g=hr(b.left,g)}return{width:m-g,height:h-p,x:g,y:p}}function C4(e){const{width:t,height:n}=h1(e);return{width:t,height:n}}function E4(e,t,n){const s=Is(t),a=xs(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?x1(a,u):ds(0),g=c.left+u.scrollLeft-p.x-h.x,y=c.top+u.scrollTop-p.y-h.y;return{x:g,y,width:c.width,height:c.height}}function Em(e){return Gr(e).position==="static"}function Jv(e,t){if(!Is(e)||Gr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return xs(e)===n&&(n=n.ownerDocument.body),n}function b1(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=Jv(e,t);for(;s&&p4(s)&&Em(s);)s=Jv(s,t);return s&&fi(s)&&Em(s)&&!Mg(s)?n:s||g4(e)||n}const T4=async function(e){const t=this.getOffsetParent||b1,n=this.getDimensions,s=await n(e.floating);return{reference:E4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function P4(e){return Gr(e).direction==="rtl"}const R4={convertOffsetParentRelativeRectToViewportRelativeRect:b4,getDocumentElement:xs,getClippingRect:N4,getOffsetParent:b1,getElementRects:T4,getClientRects:v4,getDimensions:C4,getScale:ai,isElement:qr,isRTL:P4};function v1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function A4(e,t){let n=null,s;const a=xs(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:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const C=Pu(g),j=Pu(a.clientWidth-(h+y)),w=Pu(a.clientHeight-(g+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&&!v1(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 D4(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 g=m&&u?A4(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&&!v1(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)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,p&&cancelAnimationFrame(C)}}const $4=c4,L4=u4,O4=a4,I4=f4,M4=i4,Xv=o4,_4=d4,F4=(e,t,n)=>{const s=new Map,a={platform:R4,...n},l={...a.platform,_c:s};return s4(e,t,{...a,platform:l})};var z4=typeof document<"u",B4=function(){},Gu=z4?f.useLayoutEffect:B4;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 w1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qv(e,t){const n=w1(e);return Math.round(t*n)/n}function Tm(e){const t=f.useRef(e);return Gu(()=>{t.current=e}),t}function U4(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,g]=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),F4(T.current,D.current,M).then(q=>{const A={...q,isPositioned:W.current!==!1};z.current&&!pd(O.current,A)&&(O.current=A,Ps.flushSync(()=>{g(A)}))})},[y,t,n,L,W]);Gu(()=>{m===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,g(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=Qv(ee.floating,h.x),A=Qv(ee.floating,h.y);return u?{...M,transform:"translate("+q+"px, "+A+"px)",...w1(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 V4=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?Xv({element:s.current,padding:a}).fn(n):{}:s?Xv({element:s,padding:a}).fn(n):{}}}},H4=(e,t)=>{const n=$4(e);return{name:n.name,fn:n.fn,options:[e,t]}},W4=(e,t)=>{const n=L4(e);return{name:n.name,fn:n.fn,options:[e,t]}},K4=(e,t)=>({fn:_4(e).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=I4(e);return{name:n.name,fn:n.fn,options:[e,t]}},Y4=(e,t)=>{const n=M4(e);return{name:n.name,fn:n.fn,options:[e,t]}},J4=(e,t)=>{const n=V4(e);return{name:n.name,fn:n.fn,options:[e,t]}};var X4="Arrow",j1=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"})})});j1.displayName=X4;var Q4=j1;function Z4(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",[k1,S1]=Xo(zg),[e$,N1]=k1(zg),C1=e=>{const{__scopePopper:t,children:n}=e,[s,a]=f.useState(null);return r.jsx(e$,{scope:t,anchor:s,onAnchorChange:a,children:n})};C1.displayName=zg;var E1="PopperAnchor",T1=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,l=N1(E1,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})});T1.displayName=E1;var Bg="PopperContent",[t$,n$]=k1(Bg),P1=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:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:C,...j}=e,w=N1(Bg,n),[k,E]=f.useState(null),N=Fn(t,Ye=>E(Ye)),[P,$]=f.useState(null),T=Z4(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(s$),altBoundary:W},{refs:z,floatingStyles:H,placement:ee,isPositioned:ne,middlewareData:M}=U4({strategy:"fixed",placement:J,whileElementsMounted:(...Ye)=>D4(...Ye,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[H4({mainAxis:a+O,alignmentAxis:c}),p&&W4({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?K4():void 0,...oe}),p&&q4({...oe}),G4({...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&&J4({element:P,padding:u}),o$({arrowWidth:D,arrowHeight:O}),y&&Y4({strategy:"referenceHidden",...oe})]}),[q,A]=D1(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,de=((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(t$,{scope:n,placedSide:q,onArrowChange:$,arrowX:Z,arrowY:I,shouldHideArrow:de,children:r.jsx(mn.div,{"data-side":q,"data-align":A,...j,ref:N,style:{...j.style,animation:ne?void 0:"none"}})})})});P1.displayName=Bg;var R1="PopperArrow",r$={top:"bottom",right:"left",bottom:"top",left:"right"},A1=f.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,l=n$(R1,s),c=r$[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(Q4,{...a,ref:n,style:{...a.style,display:"block"}})})});A1.displayName=R1;function s$(e){return e!==null}var o$=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]=D1(n),g={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?g:`${y}px`,j=`${-p}px`):m==="top"?(C=c?g:`${y}px`,j=`${s.floating.height+p}px`):m==="right"?(C=`${-p}px`,j=c?g:`${b}px`):m==="left"&&(C=`${s.floating.width+p}px`,j=c?g:`${b}px`),{data:{x:C,y:j}}}});function D1(e){const[t,n="center"]=e.split("-");return[t,n]}var a$=C1,i$=T1,l$=P1,c$=A1,u$=Symbol("radix.slottable");function d$(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=u$,t}var f$=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"}),p$="VisuallyHidden",$1=f.forwardRef((e,t)=>r.jsx(mn.span,{...e,ref:t,style:{...f$,...e.style}}));$1.displayName=p$;var m$=$1,[Jd]=Xo("Tooltip",[S1]),Xd=S1(),L1="TooltipProvider",h$=700,kh="tooltip.open",[g$,Ug]=Jd(L1),O1=e=>{const{__scopeTooltip:t,delayDuration:n=h$,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(g$,{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})};O1.displayName=L1;var Wl="Tooltip",[x$,lc]=Jd(Wl),I1=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,g]=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(a$,{...m,children:r.jsx(x$,{scope:t,contentId:y,open:k,stateAttribute:N,trigger:h,onTriggerChange:g,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})})};I1.displayName=Wl;var Sh="TooltipTrigger",M1=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),g=f.useCallback(()=>m.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),r.jsx(i$,{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",g,{once:!0})}),onFocus:qt(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:qt(e.onBlur,a.onClose),onClick:qt(e.onClick,a.onClose)})})});M1.displayName=Sh;var Vg="TooltipPortal",[y$,b$]=Jd(Vg,{forceMount:void 0}),_1=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,l=lc(Vg,t);return r.jsx(y$,{scope:t,forceMount:n,children:r.jsx(Qo,{present:n||l.open,children:r.jsx(gg,{asChild:!0,container:a,children:s})})})};_1.displayName=Vg;var pi="TooltipContent",F1=f.forwardRef((e,t)=>{const n=b$(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(z1,{side:a,...l,ref:t}):r.jsx(v$,{side:a,...l,ref:t})})}),v$=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:g}=s,y=f.useCallback(()=>{u(null),g(!1)},[g]),b=f.useCallback((C,j)=>{const w=C.currentTarget,k={x:C.clientX,y:C.clientY},E=N$(k,w.getBoundingClientRect()),N=C$(k,E),P=E$(j.getBoundingClientRect()),$=P$([...N,...P]);u($),g(!0)},[g]);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=!T$(k,c);E?y():N&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[p,h,c,m,y]),r.jsx(z1,{...e,ref:l})}),[w$,j$]=Jd(Wl,{isInside:!1}),k$=d$("TooltipContent"),z1=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 g=y=>{const b=y.target;b!=null&&b.contains(p.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[p.trigger,h]),r.jsx(hg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(l$,{"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(k$,{children:s}),r.jsx(w$,{scope:n,isInside:!0,children:r.jsx(m$,{id:p.contentId,role:"tooltip",children:a||s})})]})})});F1.displayName=pi;var B1="TooltipArrow",S$=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=Xd(n);return j$(B1,n).isInside?null:r.jsx(c$,{...a,...s,ref:t})});S$.displayName=B1;function N$(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 C$(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 E$(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 T$(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,g=p.x,y=p.y;h>s!=y>s&&n<(g-m)*(s-h)/(y-h)+m&&(a=!a)}return a}function P$(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),R$(t)}function R$(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 A$=O1,D$=I1,$$=M1,L$=_1,U1=F1;const Wo=A$,Pr=D$,Rr=$$,gr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(L$,{children:r.jsx(U1,{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=U1.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,g=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(hs,{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:g,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:g,onClick:()=>s(!1),children:b},p.key):r.jsx("button",{type:"button",className:g,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(iP,{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(i0,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?p.submenu.map(g=>u(g,!0)):null]},p.key)}return u(p,!1)})})})]})}function Zv(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const O$={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 I$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function M$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function _$(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=O$[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<I$(l)||c&&a>M$(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),g=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"&&!Zv(e.updated)||y==="fresh"&&Zv(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(g.length){const b=e.tags??[];if(!g.some(C=>b.includes(C)))return!1}if(!_$(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 V1={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 F$(){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,V1)),Fo)}function Zo(){const[e,t]=f.useState(()=>Rl??V1);return f.useEffect(()=>{F$().then(t)},[]),e}function ew(){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 tw={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=(tw[a.priority]??99)-(tw[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:g,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&&g?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:()=>g(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}),g?r.jsx("button",{type:"button",onClick:()=>g(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(z$,{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 z$({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",B$="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",U$="border-status-review-foreground/30 bg-status-review text-status-review-foreground",V$="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",H$="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",W$="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:nP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:El,icon:c0},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Pm,icon:vP},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:B$,icon:lh},review:{label:"Review",description:"Ready for inspection or approval.",className:U$,icon:kP},completed:{label:"Completed",description:"Finished successfully.",className:V$,icon:Zh},failed:{label:"Failed",description:"Could not be completed as planned.",className:H$,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:eP},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:W$,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 H1(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:H1(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 W1={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 K$(){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,W1)),za)}function ef(){const[e,t]=f.useState(()=>Yu??W1);return f.useEffect(()=>{K$().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 q$(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=q$(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(hs,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(rd,{className:"h-3 w-3","aria-hidden":"true"})})}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,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(g=>{const y=new Set(g);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 g=uc(e.filter(C=>C.status===h),n,s);if(g.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:g.length})]}),y&&r.jsx("ul",{className:Ce("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:g.map(C=>{const j=G$(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 J$(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function X$({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 g=J$(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:g,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 Q$(e,t,n){return e.filter(s=>Wg(s,t,{workspace:n,search:t.search}))}function K1({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=Q$(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(Z$,{item:m}):r.jsx(eL,{item:m})});case"list":return r.jsx(Y$,{items:p,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(X$,{items:p,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function Z$({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 eL({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 tL({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(K1,{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 nL({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(rL,{session:t})},t.sessionId))})]})}function rL({session:e}){const t=ln(),[n,s]=f.useState(!1),a=sL(e,t),l=oL(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," · ",S0(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 sL(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function oL(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}function aL(){const{data:e,loading:t,error:n}=B0();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(nL,{sessions:(e==null?void 0:e.sessions)??[]})}const iL=5;function lL(){const{data:e,loading:t,error:n}=z0();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,iL);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 q1={"saved-view":{title:"Saved view",icon:f0,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(tL,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Ad,render:()=>f.createElement(aL)},inventories:{title:"Inventories",icon:Ld,render:()=>f.createElement(lL)}},cL={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},uL={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function dL({slot:e,onReplace:t,onRemove:n,onResize:s}){const a=e.size??"small",l=cL[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=q1[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(fL,{slot:e,fallback:c.title})})]}),r.jsx(Hg,{items:[{key:"replace",label:"Replace…",icon:wP,onSelect:t},{key:"size",label:"Size",icon:xP,submenu:FD.map(p=>({key:`size-${p}`,label:uL[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 fL({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 pL=["agent-sessions","inventories"];function mL({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(gs,{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:pL.map(c=>{const u=q1[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 hL(){const{data:e,error:t,refetch:n}=bR(),{data:s}=M0(),{layout:a}=HD(),[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 g=f.useCallback(k=>{p(k),c(!0)},[]),y=f.useCallback(async k=>{h(null);try{await KD(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(RD,{hero:e.hero,itemsById:w}):t?r.jsx(wt,{error:t}):r.jsx(mt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(TD,{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(dL,{slot:k,index:E,onReplace:()=>g(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(mL,{open:l,onOpenChange:k=>{c(k),k||p(null)},onSelect:b})]})}function gL({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 xL(){const{data:e,loading:t,error:n}=M0(),{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(gL,{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 yL={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"},nw=["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:yL[p]??nw[c++%nw.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 bL=["pending","active","blocked","failed","completed"],qg=bL,vL=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function G1(e){return e&&e.length>0?e:[...vL]}function wL(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 jL=220,Au=8;function Y1({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)??jL,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 kL="__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,g]=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:kL,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function w(){if(j){g(!0),b(null);try{await s(p),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{g(!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(gs,{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(hs,{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 rw(){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,g]=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)=>CL(M,q,C)):[],[s,p,h,y,C,e]),W=L.map(M=>`${M.slug}:${M.status}`).join("|");f.useEffect(()=>{T(EL(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=>g(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:NL,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(de=>de.status===q).map(de=>de.slug);T(de=>({...de,[q]:wL(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(TL,{project:M,dragging:q})})}}),r.jsx(Y1,{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 SL={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},NL=qg.map(e=>({id:e,title:SL[e],description:Zd(e)}));function CL(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return sw(t)-sw(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function sw(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function EL(e){return Object.fromEntries(qg.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function TL({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 PL=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},PL)},[]);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 RL(){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 ow(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function AL(){const{data:e,loading:t,error:n,refetch:s}=vR(),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState({}),{toast:h,showToast:g,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(),g($,"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(i0,{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:ow($),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:ow(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(RL,{}),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 aw="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",iw="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(aw,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${a} in ${n.system}`,children:[r.jsx("span",{className:iw,children:a}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:aw,title:a,children:r.jsx("span",{className:iw,children:a})},l)})})}const DL={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(DL[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 lw(e){const t=$L(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(OL);if(p){const m=p.props.children,h=u.map(g=>g===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);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 $L(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=ML(a),u=IL(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 LL=Symbol("radix.slottable");function OL(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===LL}function IL(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 ML(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 _L(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=lw(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",g="data-radix-collection-item",y=lw(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,{[g]:"",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(`[${g}]`));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 FL=f.createContext(void 0);function J1(e){const t=f.useContext(FL);return e||t||"ltr"}var Rm="rovingFocusGroup.onEntryFocus",zL={bubbles:!1,cancelable:!0},dc="RovingFocusGroup",[Nh,X1,BL]=_L(dc),[UL,Q1]=Xo(dc,[BL]),[VL,HL]=UL(dc),Z1=f.forwardRef((e,t)=>r.jsx(Nh.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Nh.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(WL,{...e,ref:t})})}));Z1.displayName=dc;var WL=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,...g}=e,y=f.useRef(null),b=Fn(t,y),C=J1(l),[j,w]=zd({prop:c,defaultProp:u??null,onChange:p,caller:dc}),[k,E]=f.useState(!1),N=Ko(m),P=X1(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(VL,{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,...g,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,zL);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);nS(H,h)}}$.current=!1}),onBlur:qt(e.onBlur,()=>E(!1))})})}),eS="RovingFocusGroupItem",tS=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=HL(eS,n),g=h.currentTabStopId===m,y=X1(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:g?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=GL(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?YL(N,P+1):N.slice(P+1)}setTimeout(()=>nS(N))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:j!=null}):c})})});tS.displayName=eS;var KL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function GL(e,t,n){const s=qL(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return KL[s]}function nS(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function YL(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var JL=Z1,XL=tS,rf="Tabs",[QL]=Xo(rf,[Q1]),rS=Q1(),[ZL,Jg]=QL(rf),sS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:p="automatic",...m}=e,h=J1(u),[g,y]=zd({prop:s,onChange:a,defaultProp:l??"",caller:rf});return r.jsx(ZL,{scope:n,baseId:ni(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(mn.div,{dir:h,"data-orientation":c,...m,ref:t})})});sS.displayName=rf;var oS="TabsList",aS=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,l=Jg(oS,n),c=rS(n);return r.jsx(JL,{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})})});aS.displayName=oS;var iS="TabsTrigger",lS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...l}=e,c=Jg(iS,n),u=rS(n),p=dS(c.baseId,s),m=fS(c.baseId,s),h=s===c.value;return r.jsx(XL,{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,g=>{!a&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:qt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:qt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!a&&g&&c.onValueChange(s)})})})});lS.displayName=iS;var cS="TabsContent",uS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:l,...c}=e,u=Jg(cS,n),p=dS(u.baseId,s),m=fS(u.baseId,s),h=s===u.value,g=f.useRef(h);return f.useEffect(()=>{const y=requestAnimationFrame(()=>g.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:g.current?"0s":void 0},children:y&&l})})});uS.displayName=cS;function dS(e,t){return`${e}-trigger-${t}`}function fS(e,t){return`${e}-content-${t}`}var pS=sS,mS=aS,Ch=lS,Eh=uS;function Xg({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(pS,{value:e,onValueChange:t,className:s,children:[r.jsx(mS,{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 eO="modulepreload",tO=function(e){return"/"+e},cw={},nO=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(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};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=tO(m),m in cw)return;cw[m]=!0;const h=m.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":eO,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 rO({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 g(){if(s.current)try{const y=(await nO(async()=>{const{default:j}=await import("./mermaid.core-CkrBXB3x.js").then(w=>w.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:sO(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,oO(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),g(),()=>{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 sO(e){const t=document.documentElement,n=g=>{const y=getComputedStyle(t).getPropertyValue(g).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 oO(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 aO(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const iO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cO={};function uw(e,t){return(cO.jsx?lO:iO).test(e)}const uO=/[ \t\n\f\r]/g;function dO(e){return typeof e=="object"?e.type==="text"?dw(e.value):!1:dw(e)}function dw(e){return e.replace(uO,"")===""}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 hS(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 fO=0;const dt=ra(),dn=ra(),Ph=ra(),Te=ra(),It=ra(),li=ra(),pr=ra();function ra(){return 2**++fO}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),fw(this,"space",a),typeof s=="number")for(;++l<Am.length;){const c=Am[l];fw(this,Am[l],(s&Rh[c])===Rh[c])}}}Qg.prototype.defined=!0;function fw(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 gS=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 xS(e,t){return t in e?e[t]:t}function yS(e,t){return xS(e,t.toLowerCase())}const pO=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:yS}),mO=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:xS}),bS=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()}}),vS=ki({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yS}),wS=ki({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),hO={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"},gO=/[A-Z]/g,pw=/-[a-z]/g,xO=/^data[-\w.:]+$/i;function yO(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"&&xO.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(pw,vO);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!pw.test(l)){let c=l.replace(gO,bO);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Qg}return new a(s,t)}function bO(e){return"-"+e.toLowerCase()}function vO(e){return e.charAt(1).toUpperCase()}const wO=hS([gS,pO,bS,vS,wS],"html"),Zg=hS([gS,mO,bS,vS,wS],"svg");function jO(e){return e.join(" ").trim()}var Ba={},Dm,mw;function kO(){if(mw)return Dm;mw=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=`
|
|
531
531
|
`,m="/",h="*",g="",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;g!=w.charAt(H)&&(h!=w.charAt(H)||m!=w.charAt(H+1));)++H;if(H+=2,g===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,g)),value:ee?j(ee[0].replace(e,g)):g});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,g):g}return Dm=C,Dm}var hw;function SO(){if(hw)return Ba;hw=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(kO());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={},gw;function NO(){if(gw)return yl;gw=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,xw;function CO(){if(xw)return bl;xw=1;var e=bl&&bl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(SO()),n=NO();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 EO=CO();const TO=Td(EO),jS=kS("end"),ex=kS("start");function kS(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 PO(e){const t=ex(e),n=jS(e);if(t&&n)return{start:t,end:n}}function Al(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yw(e.position):"start"in e||"end"in e?yw(e):"line"in e||"column"in e?Ah(e):""}function Ah(e){return bw(e&&e.line)+":"+bw(e&&e.column)}function yw(e){return Ah(e&&e.start)+"-"+Ah(e&&e.end)}function bw(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,RO=new Map,AO=/[A-Z]/g,DO=new Set(["table","tbody","thead","tfoot","tr"]),$O=new Set(["td","th"]),SS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function LO(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=UO(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=BO(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:wO,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=NS(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function NS(e,t,n){if(t.type==="element")return OO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return IO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return _O(e,t,n);if(t.type==="mdxjsEsm")return MO(e,t);if(t.type==="root")return FO(e,t,n);if(t.type==="text")return zO(e,t)}function OO(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=ES(e,t.tagName,!1),c=VO(e,t);let u=rx(e,t);return DO.has(t.tagName)&&(u=u.filter(function(p){return typeof p=="string"?!dO(p):!0})),CS(e,c,l,t),nx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function IO(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 MO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ql(e,t.position)}function _O(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:ES(e,t.name,!0),c=HO(e,t),u=rx(e,t);return CS(e,c,l,t),nx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function FO(e,t,n){const s={};return nx(s,rx(e,t)),e.create(t,e.Fragment,s,n)}function zO(e,t){return t.value}function CS(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 BO(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 UO(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 VO(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&tx.call(t.properties,a)){const l=WO(e,a,t.properties[a]);if(l){const[c,u]=l;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&$O.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 HO(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:RO;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=NS(e,l,c);u!==void 0&&n.push(u)}return n}function WO(e,t,n){const s=yO(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?aO(n):jO(n)),s.property==="style"){let a=typeof n=="object"?n:KO(e,String(n));return e.stylePropertyNameCase==="css"&&(a=qO(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?hO[s.property]||s.property:s.attribute,n]}}function KO(e,t){try{return TO(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=SS+"#cannot-parse-style-attribute",a}}function ES(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=uw(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=uw(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=SS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function qO(e){const t={};let n;for(n in e)tx.call(e,n)&&(t[GO(n)]=e[n]);return t}function GO(e){let t=e.replace(AO,YO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function YO(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"]},JO={};function XO(e,t){const n=JO,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return TS(e,s,a)}function TS(e,t,n){if(QO(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 vw(e.children,t,n)}return Array.isArray(e)?vw(e,t,n):""}function vw(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=TS(e[a],t,n);return s.join("")}function QO(e){return!!(e&&typeof e=="object")}const ww=document.createElement("i");function sx(e){const t="&"+e+";";ww.innerHTML=t;const n=ww.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 jw={}.hasOwnProperty;function ZO(e){const t={};let n=-1;for(;++n<e.length;)eI(t,e[n]);return t}function eI(e,t){let n;for(n in t){const a=(jw.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){jw.call(a,c)||(a[c]=[]);const u=l[c];tI(a[c],Array.isArray(u)?u:u?[u]:[])}}}function tI(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 PS(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]/),nI=ho(/[#-'*+\--9=?A-Z^-~]/);function Dh(e){return e!==null&&(e<32||e===127)}const $h=ho(/\d/),rI=ho(/[\dA-Fa-f]/),sI=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 oI=ho(new RegExp("\\p{P}|\\p{S}","u")),aI=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 iI={tokenize:lI};function lI(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 cI={tokenize:uI},kw={tokenize:dI};function uI(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(kw,h,g)(N)}function h(N){return a&&E(),k(s),y(N)}function g(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(kw,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 dI(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 Sw(e){if(e===null||sr(e)||aI(e))return 1;if(oI(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:fI,tokenize:pI};function fI(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 g={...e[s][1].end},y={...e[n][1].start};Nw(g,-p),Nw(y,p),c={type:p>1?"strongSequence":"emphasisSequence",start:g,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 pI(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Sw(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=Sw(p),g=!h||h===2&&a||n.includes(p),y=!a||a===2&&h||n.includes(s);return m._open=!!(l===42?g:g&&(a||!y)),m._close=!!(l===42?y:y&&(h||!g)),t(p)}}function Nw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const mI={name:"autolink",tokenize:hI};function hI(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):nI(b)?(e.consume(b),m):n(b)}function h(b){return xr(b)?g(b):n(b)}function g(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:g;return e.consume(b),C}return n(b)}}const sf={partial:!0,tokenize:gI};function gI(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 RS={continuation:{tokenize:yI},exit:bI,name:"blockQuote",tokenize:xI};function xI(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 yI(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(RS,t,n)(c)}}function bI(e){e.exit("blockQuote")}const AS={name:"characterEscape",tokenize:vI};function vI(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 sI(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const DS={name:"characterReference",tokenize:wI};function wI(e,t,n){const s=this;let a=0,l,c;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),p}function p(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,c=xr,h(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,c=rI,h):(e.enter("characterReferenceValue"),l=7,c=$h,h(g))}function h(g){if(g===59&&a){const y=e.exit("characterReferenceValue");return c===xr&&!sx(s.sliceSerialize(y))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&a++<l?(e.consume(g),h):n(g)}}const Cw={partial:!0,tokenize:kI},Ew={concrete:!0,name:"codeFenced",tokenize:jI};function jI(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,g,"whitespace")(T):g(T))}function g(T){return T===null||st(T)?(e.exit("codeFencedFence"),s.interrupt?t(T):e.check(Cw,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"),g(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)?g(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"),g(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(Cw,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 kI(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:NI},SI={partial:!0,tokenize:CI};function NI(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(SI,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 CI(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 EI={name:"codeText",previous:PI,resolve:TI,tokenize:RI};function TI(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 PI(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function RI(e,t,n){let s=0,a,l;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),s++,u):(e.exit("codeTextSequence"),p(g))}function p(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),p):g===96?(l=e.enter("codeTextSequence"),a=0,h(g)):st(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||st(g)?(e.exit("codeTextData"),p(g)):(e.consume(g),m)}function h(g){return g===96?(e.consume(g),a++,h):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(l.type="codeTextData",m(g))}}class AI{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 $S(e){const t={};let n=-1,s,a,l,c,u,p,m;const h=new AI(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,DI(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 DI(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,g,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),g&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(h),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=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 $I={resolve:OI,tokenize:II},LI={partial:!0,tokenize:MI};function OI(e){return $S(e),e}function II(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(LI,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 MI(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 LS(e,t,n,s,a,l,c,u,p){const m=p||Number.POSITIVE_INFINITY;let h=0;return g;function g(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 OS(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"}),g(b))}function g(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:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function IS(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?g:h)}function g(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 _I={name:"definition",tokenize:zI},FI={partial:!0,tokenize:BI};function zI(e,t,n){const s=this;let a;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return OS.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 LS(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(FI,g,g)(b)}function g(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 BI(e,t,n){return s;function s(u){return sr(u)?Dl(e,a)(u):n(u)}function a(u){return IS(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 UI={name:"hardBreakEscape",tokenize:VI};function VI(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 HI={name:"headingAtx",resolve:WI,tokenize:KI};function WI(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 KI(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 qI=["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"],Tw=["pre","script","style","textarea"],GI={concrete:!0,name:"htmlFlow",resolveTo:XI,tokenize:QI},YI={partial:!0,tokenize:eM},JI={partial:!0,tokenize:ZI};function XI(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 QI(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),g}function g(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 de="CDATA[";return I===de.charCodeAt(u++)?(e.consume(I),u===de.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 de=I===47,ge=c.toLowerCase();return!de&&!l&&Tw.includes(ge)?(a=1,s.interrupt?t(I):W(I)):qI.includes(c.toLowerCase())?(a=6,de?(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(YI,Z,oe)(I)):I===null||st(I)?(e.exit("htmlFlowData"),oe(I)):(e.consume(I),W)}function oe(I){return e.check(JI,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 de=c.toLowerCase();return Tw.includes(de)?(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 ZI(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 eM(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(sf,t,n)}}const tM={name:"htmlText",tokenize:nM};function nM(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 g(A){return A===null?n(A):A===45?(e.consume(A),y):st(A)?(c=g,ne(A)):(e.consume(A),g)}function y(A){return A===45?(e.consume(A),b):g(A)}function b(A){return A===62?ee(A):A===45?y(A):g(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:aM,resolveTo:iM,tokenize:lM},rM={tokenize:cM},sM={tokenize:uM},oM={tokenize:dM};function aM(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 iM(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 lM(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?g(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(rM,h,c?h:g)(y):y===91?e.attempt(sM,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(oM,h,g)(y)}function h(y){return t(y)}function g(y){return l._balanced=!0,n(y)}}function cM(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),a}function a(g){return sr(g)?Dl(e,l)(g):l(g)}function l(g){return g===41?h(g):LS(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return sr(g)?Dl(e,p)(g):h(g)}function u(g){return n(g)}function p(g){return g===34||g===39||g===40?IS(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return sr(g)?Dl(e,h)(g):h(g)}function h(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function uM(e,t,n){const s=this;return a;function a(u){return OS.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 dM(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 fM={name:"labelStartImage",resolveAll:ax.resolveAll,tokenize:pM};function pM(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 mM={name:"labelStartLink",resolveAll:ax.resolveAll,tokenize:hM};function hM(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:gM};function gM(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:xM};function xM(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:wM},exit:kM,name:"list",tokenize:vM},yM={partial:!0,tokenize:SM},bM={partial:!0,tokenize:jM};function vM(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(yM,y,g))}function h(b){return s.containerState.initialBlankLine=!0,l++,y(b)}function g(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 wM(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(bM,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 jM(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 kM(e){e.exit(this.containerState.type)}function SM(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 Pw={name:"setextUnderline",resolveTo:NM,tokenize:CM};function NM(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 CM(e,t,n){const s=this;let a;return l;function l(m){let h=s.events.length,g;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){g=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(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 EM={tokenize:TM};function TM(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($I,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 PM={resolveAll:_S()},RM=MS("string"),AM=MS("text");function MS(e){return{resolveAll:_S(e==="text"?DM: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 g=a[h];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function _S(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 DM(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 $M={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:RS},LM={91:_I},OM={[-2]:Lm,[-1]:Lm,32:Lm},IM={35:HI,42:Ju,45:[Pw,Ju],60:GI,61:Pw,95:Ju,96:Ew,126:Ew},MM={38:DS,92:AS},_M={[-5]:Om,[-4]:Om,[-3]:Om,33:fM,38:DS,42:Lh,60:[mI,tM],91:mM,92:[UI,AS],93:ax,95:Lh,96:EI},FM={null:[Lh,PM]},zM={null:[42,95]},BM={null:[]},UM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:zM,contentInitial:LM,disable:BM,document:$M,flow:IM,flowInitial:OM,insideSpan:FM,string:MM,text:_M},Symbol.toStringTag,{value:"Module"}));function VM(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:g};let h=t.tokenize.call(m,p);return t.resolveAll&&l.push(t),m;function g(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 WM(b(L),W)}function b(L){return HM(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,de,ge)(me)}}function de(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 HM(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 WM(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=`
|
|
532
532
|
`;break}case-3:{c=`\r
|
|
533
533
|
`;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 KM(e){const s={constructs:ZO([UM,...(e||{}).extensions||[]]),content:a(iI),defined:[],document:a(cI),flow:a(EM),lazy:{},string:a(RM),text:a(AM)};return s;function a(l){return c;function c(u){return VM(s,l,u)}}}function qM(e){for(;!$S(e););return e}const Rw=/[\0\t\n\r]/g;function GM(){let e=1,t="",n=!0,s;return a;function a(l,c,u){const p=[];let m,h,g,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),g=0,t="",n&&(l.charCodeAt(0)===65279&&g++,n=void 0);g<l.length;){if(Rw.lastIndex=g,m=Rw.exec(l),y=m&&m.index!==void 0?m.index:l.length,b=l.charCodeAt(y),!m){t=l.slice(g);break}if(b===10&&g===y&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),g<y&&(p.push(l.slice(g,y)),e+=y-g),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}g=y+1}return u&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const YM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JM(e){return e.replace(YM,XM)}function XM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return PS(n.slice(l?2:1),l?16:10)}return sx(n)||e}const FS={}.hasOwnProperty;function QM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),ZM(n)(qM(KM(n).document().write(GM()(e,t,!0))))}function ZM(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,g),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:de,resourceDestinationString:A,resourceTitleString:F,resource:Z,setextHeading:p(O),setextHeadingLineSequence:D,setextHeadingText:T,strong:p(),thematicBreak:p()}};zS(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]];FS.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]||Aw).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]||Aw).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 XO(this.stack.pop())}function g(){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=JM(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 de(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=PS(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 zS(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?zS(e,s):e5(e,s)}}function e5(e,t){let n;for(n in t)if(FS.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 Aw(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 t5(e){const t=this;t.parser=n;function n(s){return QM(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function n5(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 r5(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -563,4 +563,4 @@ workspace: ${t}`)),a(b),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async funct
|
|
|
563
563
|
To pick up a draggable item, press the space bar.
|
|
564
564
|
While dragging, use the arrow keys to move the item.
|
|
565
565
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
566
|
-
`},D6={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function $6(e){let{announcements:t=D6,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=A6}=e;const{announce:l,announcement:c}=T6(),u=gc("DndLiveRegion"),[p,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),P6(f.useMemo(()=>({onDragStart(g){let{active:y}=g;l(t.onDragStart({active:y}))},onDragMove(g){let{active:y,over:b}=g;t.onDragMove&&l(t.onDragMove({active:y,over:b}))},onDragOver(g){let{active:y,over:b}=g;l(t.onDragOver({active:y,over:b}))},onDragEnd(g){let{active:y,over:b}=g;l(t.onDragEnd({active:y,over:b}))},onDragCancel(g){let{active:y,over:b}=g;l(t.onDragCancel({active:y,over:b}))}}),[l,t])),!p)return null;const h=nn.createElement(nn.Fragment,null,nn.createElement(C6,{id:s,value:a.draggable}),nn.createElement(E6,{id:u,announcement:c}));return n?Ps.createPortal(h,n):h}var bn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(bn||(bn={}));function wd(){}function jd(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function VN(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const Yr=Object.freeze({x:0,y:0});function HN(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function WN(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function L6(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function vj(e){let{left:t,top:n,height:s,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+s},{x:t+a,y:n+s}]}function KN(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wj(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const qN=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=wj(t,t.left,t.top),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=HN(wj(p),a);l.push({id:u,data:{droppableContainer:c,value:m}})}}return l.sort(WN)},O6=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=vj(t),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=vj(p),h=a.reduce((y,b,C)=>y+HN(m[C],b),0),g=Number((h/4).toFixed(4));l.push({id:u,data:{droppableContainer:c,value:g}})}}return l.sort(WN)};function I6(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),c=a-s,u=l-n;if(s<a&&n<l){const p=t.width*t.height,m=e.width*e.height,h=c*u,g=h/(p+m-h);return Number(g.toFixed(4))}return 0}const M6=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=[];for(const l of s){const{id:c}=l,u=n.get(c);if(u){const p=I6(u,t);p>0&&a.push({id:c,data:{droppableContainer:l,value:p}})}}return a.sort(L6)};function _6(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function GN(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Yr}function F6(e){return function(n){for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l<s;l++)a[l-1]=arguments[l];return a.reduce((c,u)=>({...c,top:c.top+e*u.y,bottom:c.bottom+e*u.y,left:c.left+e*u.x,right:c.right+e*u.x}),{...n})}}const z6=F6(1);function B6(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function U6(e,t,n){const s=B6(t);if(!s)return e;const{scaleX:a,scaleY:l,x:c,y:u}=s,p=e.left-c-(1-a)*parseFloat(n),m=e.top-u-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),h=a?e.width/a:e.width,g=l?e.height/l:e.height;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p}}const V6={ignoreTransform:!1};function Ri(e,t){t===void 0&&(t=V6);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=lr(e).getComputedStyle(e);m&&(n=U6(n,m,h))}const{top:s,left:a,width:l,height:c,bottom:u,right:p}=n;return{top:s,left:a,width:l,height:c,bottom:u,right:p}}function jj(e){return Ri(e,{ignoreTransform:!0})}function H6(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function W6(e,t){return t===void 0&&(t=lr(e).getComputedStyle(e)),t.position==="fixed"}function K6(e,t){t===void 0&&(t=lr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const l=t[a];return typeof l=="string"?n.test(l):!1})}function gf(e,t){const n=[];function s(a){if(t!=null&&n.length>=t||!a)return n;if(Ex(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!mc(a)||zN(a)||n.includes(a))return n;const l=lr(e).getComputedStyle(a);return a!==e&&K6(a,l)&&n.push(a),W6(a,l)?n:s(a.parentNode)}return e?s(e):n}function YN(e){const[t]=gf(e,1);return t??null}function th(e){return!hf||!e?null:Ti(e)?e:Cx(e)?Ex(e)||e===Pi(e).scrollingElement?window:mc(e)?e:null:null}function JN(e){return Ti(e)?e.scrollX:e.scrollLeft}function XN(e){return Ti(e)?e.scrollY:e.scrollTop}function zh(e){return{x:JN(e),y:XN(e)}}var En;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(En||(En={}));function QN(e){return!hf||!e?!1:e===document.scrollingElement}function ZN(e){const t={x:0,y:0},n=QN(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,c=e.scrollTop>=s.y,u=e.scrollLeft>=s.x;return{isTop:a,isLeft:l,isBottom:c,isRight:u,maxScroll:s,minScroll:t}}const q6={x:.2,y:.2};function G6(e,t,n,s,a){let{top:l,left:c,right:u,bottom:p}=n;s===void 0&&(s=10),a===void 0&&(a=q6);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=ZN(e),b={x:0,y:0},C={x:0,y:0},j={height:t.height*a.y,width:t.width*a.x};return!m&&l<=t.top+j.height?(b.y=En.Backward,C.y=s*Math.abs((t.top+j.height-l)/j.height)):!h&&p>=t.bottom-j.height&&(b.y=En.Forward,C.y=s*Math.abs((t.bottom-j.height-p)/j.height)),!y&&u>=t.right-j.width?(b.x=En.Forward,C.x=s*Math.abs((t.right-j.width-u)/j.width)):!g&&c<=t.left+j.width&&(b.x=En.Backward,C.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:C}}function Y6(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:c}=window;return{top:0,left:0,right:l,bottom:c,width:l,height:c}}const{top:t,left:n,right:s,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:a,width:e.clientWidth,height:e.clientHeight}}function eC(e){return e.reduce((t,n)=>di(t,zh(n)),Yr)}function J6(e){return e.reduce((t,n)=>t+JN(n),0)}function X6(e){return e.reduce((t,n)=>t+XN(n),0)}function Q6(e,t){if(t===void 0&&(t=Ri),!e)return;const{top:n,left:s,bottom:a,right:l}=t(e);YN(e)&&(a<=0||l<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Z6=[["x",["left","right"],J6],["y",["top","bottom"],X6]];class Rx{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=gf(n),a=eC(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,c,u]of Z6)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=u(s),h=a[l]-m;return this.rect[p]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ml{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var a;(a=this.target)==null||a.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function ez(e){const{EventTarget:t}=lr(e);return e instanceof t?e:Pi(e)}function nh(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Er;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Er||(Er={}));function kj(e){e.preventDefault()}function tz(e){e.stopPropagation()}var ht;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(ht||(ht={}));const tC={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter,ht.Tab]},nz=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ht.Right:return{...n,x:n.x+25};case ht.Left:return{...n,x:n.x-25};case ht.Down:return{...n,y:n.y+25};case ht.Up:return{...n,y:n.y-25}}};class xf{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ml(Pi(n)),this.windowListeners=new Ml(lr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Er.Resize,this.handleCancel),this.windowListeners.add(Er.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Er.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&Q6(s),n(Yr)}handleKeyDown(t){if(Px(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:l=tC,coordinateGetter:c=nz,scrollBehavior:u="smooth"}=a,{code:p}=t;if(l.end.includes(p)){this.handleEnd(t);return}if(l.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=s.current,h=m?{x:m.left,y:m.top}:Yr;this.referenceCoordinates||(this.referenceCoordinates=h);const g=c(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=Zl(g,h),b={x:0,y:0},{scrollableAncestors:C}=s.current;for(const j of C){const w=t.code,{isTop:k,isRight:E,isLeft:N,isBottom:P,maxScroll:$,minScroll:T}=ZN(j),D=Y6(j),O={x:Math.min(w===ht.Right?D.right-D.width/2:D.right,Math.max(w===ht.Right?D.left:D.left+D.width/2,g.x)),y:Math.min(w===ht.Down?D.bottom-D.height/2:D.bottom,Math.max(w===ht.Down?D.top:D.top+D.height/2,g.y))},J=w===ht.Right&&!E||w===ht.Left&&!N,V=w===ht.Down&&!P||w===ht.Up&&!k;if(J&&O.x!==g.x){const L=j.scrollLeft+y.x,W=w===ht.Right&&L<=$.x||w===ht.Left&&L>=T.x;if(W&&!y.y){j.scrollTo({left:L,behavior:u});return}W?b.x=j.scrollLeft-L:b.x=w===ht.Right?j.scrollLeft-$.x:j.scrollLeft-T.x,b.x&&j.scrollBy({left:-b.x,behavior:u});break}else if(V&&O.y!==g.y){const L=j.scrollTop+y.y,W=w===ht.Down&&L<=$.y||w===ht.Up&&L>=T.y;if(W&&!y.x){j.scrollTo({top:L,behavior:u});return}W?b.y=j.scrollTop-L:b.y=w===ht.Down?j.scrollTop-$.y:j.scrollTop-T.y,b.y&&j.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,di(Zl(g,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}xf.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=tC,onActivation:a}=t,{active:l}=n;const{code:c}=e.nativeEvent;if(s.start.includes(c)){const u=l.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function Sj(e){return!!(e&&"distance"in e)}function Nj(e){return!!(e&&"delay"in e)}class Ax{constructor(t,n,s){var a;s===void 0&&(s=ez(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:l}=t,{target:c}=l;this.props=t,this.events=n,this.document=Pi(c),this.documentListeners=new Ml(this.document),this.listeners=new Ml(s),this.windowListeners=new Ml(lr(c)),this.initialCoordinates=(a=Fh(l))!=null?a:Yr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Er.Resize,this.handleCancel),this.windowListeners.add(Er.DragStart,kj),this.windowListeners.add(Er.VisibilityChange,this.handleCancel),this.windowListeners.add(Er.ContextMenu,kj),this.documentListeners.add(Er.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Nj(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Sj(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:a}=this.props;a(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Er.Click,tz,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Er.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:a,props:l}=this,{onMove:c,options:{activationConstraint:u}}=l;if(!a)return;const p=(n=Fh(t))!=null?n:Yr,m=Zl(a,p);if(!s&&u){if(Sj(u)){if(u.tolerance!=null&&nh(m,u.tolerance))return this.handleCancel();if(nh(m,u.distance))return this.handleStart()}if(Nj(u)&&nh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),c(p)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===ht.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const rz={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class yf extends Ax{constructor(t){const{event:n}=t,s=Pi(n.target);super(t,rz,s)}}yf.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const sz={move:{name:"mousemove"},end:{name:"mouseup"}};var Bh;(function(e){e[e.RightClick=2]="RightClick"})(Bh||(Bh={}));class oz extends Ax{constructor(t){super(t,sz,Pi(t.event.target))}}oz.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Bh.RightClick?!1:(s==null||s({event:n}),!0)}}];const rh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class az extends Ax{constructor(t){super(t,rh)}static setup(){return window.addEventListener(rh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(rh.move.name,t)};function t(){}}}az.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:a}=n;return a.length>1?!1:(s==null||s({event:n}),!0)}}];var _l;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(_l||(_l={}));var kd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(kd||(kd={}));function iz(e){let{acceleration:t,activator:n=_l.Pointer,canScroll:s,draggingRect:a,enabled:l,interval:c=5,order:u=kd.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=cz({delta:g,disabled:!l}),[C,j]=w6(),w=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case _l.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case _l.DraggableRect:return a}},[n,a,p]),N=f.useRef(null),P=f.useCallback(()=>{const T=N.current;if(!T)return;const D=w.current.x*k.current.x,O=w.current.y*k.current.y;T.scrollBy(D,O)},[]),$=f.useMemo(()=>u===kd.TreeOrder?[...m].reverse():m,[u,m]);f.useEffect(()=>{if(!l||!m.length||!E){j();return}for(const T of $){if((s==null?void 0:s(T))===!1)continue;const D=m.indexOf(T),O=h[D];if(!O)continue;const{direction:J,speed:V}=G6(T,O,E,t,y);for(const L of["x","y"])b[L][J[L]]||(V[L]=0,J[L]=0);if(V.x>0||V.y>0){j(),N.current=T,C(P,c),w.current=V,k.current=J;return}}w.current={x:0,y:0},k.current={x:0,y:0},j()},[t,P,s,j,l,c,JSON.stringify(E),JSON.stringify(b),C,m,$,h,JSON.stringify(y)])}const lz={x:{[En.Backward]:!1,[En.Forward]:!1},y:{[En.Backward]:!1,[En.Forward]:!1}};function cz(e){let{delta:t,disabled:n}=e;const s=_h(t);return hc(a=>{if(n||!s||!a)return lz;const l={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[En.Backward]:a.x[En.Backward]||l.x===-1,[En.Forward]:a.x[En.Forward]||l.x===1},y:{[En.Backward]:a.y[En.Backward]||l.y===-1,[En.Forward]:a.y[En.Forward]||l.y===1}}},[n,t,s])}function uz(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return hc(a=>{var l;return t==null?null:(l=s??a)!=null?l:null},[s,t])}function dz(e,t){return f.useMemo(()=>e.reduce((n,s)=>{const{sensor:a}=s,l=a.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,s)}));return[...n,...l]},[]),[e,t])}var ec;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ec||(ec={}));var Uh;(function(e){e.Optimized="optimized"})(Uh||(Uh={}));const Cj=new Map;function fz(e,t){let{dragging:n,dependencies:s,config:a}=t;const[l,c]=f.useState(null),{frequency:u,measure:p,strategy:m}=a,h=f.useRef(e),g=w(),y=Ql(g),b=f.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(E=>E===null?k:E.concat(k.filter(N=>!E.includes(N))))},[y]),C=f.useRef(null),j=hc(k=>{if(g&&!n)return Cj;if(!k||k===Cj||h.current!==e||l!=null){const E=new Map;for(let N of e){if(!N)continue;if(l&&l.length>0&&!l.includes(N.id)&&N.rect.current){E.set(N.id,N.rect.current);continue}const P=N.node.current,$=P?new Rx(p(P),P):null;N.rect.current=$,$&&E.set(N.id,$)}return E}return k},[e,l,n,g,p]);return f.useEffect(()=>{h.current=e},[e]),f.useEffect(()=>{g||b()},[n,g]),f.useEffect(()=>{l&&l.length>0&&c(null)},[JSON.stringify(l)]),f.useEffect(()=>{g||typeof u!="number"||C.current!==null||(C.current=setTimeout(()=>{b(),C.current=null},u))},[u,g,b,...s]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:l!=null};function w(){switch(m){case ec.Always:return!1;case ec.BeforeDragging:return n;default:return!n}}}function nC(e,t){return hc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function pz(e,t){return nC(e,t)}function mz(e){let{callback:t,disabled:n}=e;const s=Tx(t),a=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(s)},[s,n]);return f.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function bf(e){let{callback:t,disabled:n}=e;const s=Tx(t),a=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(s)},[n]);return f.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function hz(e){return new Rx(Ri(e),e)}function Ej(e,t,n){t===void 0&&(t=hz);const[s,a]=f.useState(null);function l(){a(p=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=p??n)!=null?m:null}const h=t(e);return JSON.stringify(p)===JSON.stringify(h)?p:h})}const c=mz({callback(p){if(e)for(const m of p){const{type:h,target:g}=m;if(h==="childList"&&g instanceof HTMLElement&&g.contains(e)){l();break}}}}),u=bf({callback:l});return ps(()=>{l(),e?(u==null||u.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),c==null||c.disconnect())},[e]),s}function gz(e){const t=nC(e);return GN(e,t)}const Tj=[];function xz(e){const t=f.useRef(e),n=hc(s=>e?s&&s!==Tj&&e&&t.current&&e.parentNode===t.current.parentNode?s:gf(e):Tj,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function yz(e){const[t,n]=f.useState(null),s=f.useRef(e),a=f.useCallback(l=>{const c=th(l.target);c&&n(u=>u?(u.set(c,zh(c)),new Map(u)):null)},[]);return f.useEffect(()=>{const l=s.current;if(e!==l){c(l);const u=e.map(p=>{const m=th(p);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,zh(m)]):null}).filter(p=>p!=null);n(u.length?new Map(u):null),s.current=e}return()=>{c(e),c(l)};function c(u){u.forEach(p=>{const m=th(p);m==null||m.removeEventListener("scroll",a)})}},[a,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,c)=>di(l,c),Yr):eC(e):Yr,[e,t])}function Pj(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==Yr;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?Zl(e,n.current):Yr}function bz(e){f.useEffect(()=>{if(!hf)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function vz(e,t){return f.useMemo(()=>e.reduce((n,s)=>{let{eventName:a,handler:l}=s;return n[a]=c=>{l(c,t)},n},{}),[e,t])}function rC(e){return f.useMemo(()=>e?H6(e):null,[e])}const Rj=[];function wz(e,t){t===void 0&&(t=Ri);const[n]=e,s=rC(n?lr(n):null),[a,l]=f.useState(Rj);function c(){l(()=>e.length?e.map(p=>QN(p)?s:new Rx(t(p),p)):Rj)}const u=bf({callback:c});return ps(()=>{u==null||u.disconnect(),c(),e.forEach(p=>u==null?void 0:u.observe(p))},[e]),a}function jz(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return mc(t)?t:e}function kz(e){let{measure:t}=e;const[n,s]=f.useState(null),a=f.useCallback(m=>{for(const{target:h}of m)if(mc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),l=bf({callback:a}),c=f.useCallback(m=>{const h=jz(m);l==null||l.disconnect(),h&&(l==null||l.observe(h)),s(h?t(h):null)},[t,l]),[u,p]=vd(c);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:p}),[n,u,p])}const Sz=[{sensor:yf,options:{}},{sensor:xf,options:{}}],Nz={current:{}},Qu={draggable:{measure:jj},droppable:{measure:jj,strategy:ec.WhileDragging,frequency:Uh.Optimized},dragOverlay:{measure:Ri}};class Fl extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Cz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Qu,measureDroppableContainers:wd,windowRect:null,measuringScheduled:!1},Ez={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:wd,draggableNodes:new Map,over:null,measureDroppableContainers:wd},vf=f.createContext(Ez),sC=f.createContext(Cz);function Tz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fl}}}function Pz(e,t){switch(t.type){case bn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case bn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case bn.DragEnd:case bn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case bn.RegisterDroppable:{const{element:n}=t,{id:s}=n,a=new Fl(e.droppable.containers);return a.set(s,n),{...e,droppable:{...e.droppable,containers:a}}}case bn.SetDroppableDisabled:{const{id:n,key:s,disabled:a}=t,l=e.droppable.containers.get(n);if(!l||s!==l.key)return e;const c=new Fl(e.droppable.containers);return c.set(n,{...l,disabled:a}),{...e,droppable:{...e.droppable,containers:c}}}case bn.UnregisterDroppable:{const{id:n,key:s}=t,a=e.droppable.containers.get(n);if(!a||s!==a.key)return e;const l=new Fl(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function Rz(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=f.useContext(vf),l=_h(s),c=_h(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&l&&c!=null){if(!Px(l)||document.activeElement===l.target)return;const u=a.get(c);if(!u)return;const{activatorNode:p,node:m}=u;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[p.current,m.current]){if(!h)continue;const g=S6(h);if(g){g.focus();break}}})}},[s,t,a,c,l]),null}function Az(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,l)=>l({transform:a,...s}),n):n}function Dz(e){return f.useMemo(()=>({draggable:{...Qu.draggable,...e==null?void 0:e.draggable},droppable:{...Qu.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Qu.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function $z(e){let{activeNode:t,measure:n,initialRect:s,config:a=!0}=e;const l=f.useRef(!1),{x:c,y:u}=typeof a=="boolean"?{x:a,y:a}:a;ps(()=>{if(!c&&!u||!t){l.current=!1;return}if(l.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const h=n(m),g=GN(h,s);if(c||(g.x=0),u||(g.y=0),l.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const y=YN(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const oC=f.createContext({...Yr,scaleX:1,scaleY:1});var so;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(so||(so={}));const aC=f.memo(function(t){var n,s,a,l;let{id:c,accessibility:u,autoScroll:p=!0,children:m,sensors:h=Sz,collisionDetection:g=M6,measuring:y,modifiers:b,...C}=t;const j=f.useReducer(Pz,void 0,Tz),[w,k]=j,[E,N]=R6(),[P,$]=f.useState(so.Uninitialized),T=P===so.Initialized,{draggable:{active:D,nodes:O,translate:J},droppable:{containers:V}}=w,L=D!=null?O.get(D):null,W=f.useRef({initial:null,translated:null}),oe=f.useMemo(()=>{var Be;return D!=null?{id:D,data:(Be=L==null?void 0:L.data)!=null?Be:Nz,rect:W}:null},[D,L]),z=f.useRef(null),[H,ee]=f.useState(null),[ne,M]=f.useState(null),q=Ql(C,Object.values(C)),A=gc("DndDescribedBy",c),F=f.useMemo(()=>V.getEnabled(),[V]),Z=Dz(y),{droppableRects:I,measureDroppableContainers:de,measuringScheduled:ge}=fz(F,{dragging:T,dependencies:[J.x,J.y],config:Z.droppable}),U=uz(O,D),ae=f.useMemo(()=>ne?Fh(ne):null,[ne]),me=ue(),ve=pz(U,Z.draggable.measure);$z({activeNode:D!=null?O.get(D):null,config:me.layoutShiftCompensation,initialRect:ve,measure:Z.draggable.measure});const ke=Ej(U,Z.draggable.measure,ve),he=Ej(U?U.parentElement:null),Je=f.useRef({activatorEvent:null,active:null,activeNode:U,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:V,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=V.getNodeFor((n=Je.current.over)==null?void 0:n.id),ot=kz({measure:Z.dragOverlay.measure}),Y=(s=ot.nodeRef.current)!=null?s:U,Ie=T?(a=ot.rect)!=null?a:ke:null,Se=!!(ot.nodeRef.current&&ot.rect),Oe=gz(Se?null:ke),Xe=rC(Y?lr(Y):null),Me=xz(T?Ye??U:null),nt=wz(Me),Ke=Az(b,{transform:{x:J.x-Oe.x,y:J.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:ne,active:oe,activeNodeRect:ke,containerNodeRect:he,draggingNodeRect:Ie,over:Je.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Me,scrollableAncestorRects:nt,windowRect:Xe}),gt=ae?di(ae,J):null,Pt=yz(Me),at=Pj(Pt),ie=Pj(Pt,[ke]),G=di(Ke,at),pe=Ie?z6(Ie,Ke):null,Q=oe&&pe?g({active:oe,collisionRect:pe,droppableRects:I,droppableContainers:F,pointerCoordinates:gt}):null,ye=KN(Q,"id"),[Re,lt]=f.useState(null),te=Se?Ke:di(Ke,ie),be=_6(te,(l=Re==null?void 0:Re.rect)!=null?l:null,ke),Le=f.useRef(null),it=f.useCallback((Be,Fe)=>{let{sensor:Nt,options:$n}=Fe;if(z.current==null)return;const Yt=O.get(z.current);if(!Yt)return;const sn=Be.nativeEvent,Wt=new Nt({active:z.current,activeNode:Yt,event:sn,options:$n,context:Je,onAbort(xt){if(!O.get(xt))return;const{onDragAbort:Rt}=q.current,re={id:xt};Rt==null||Rt(re),E({type:"onDragAbort",event:re})},onPending(xt,jn,Rt,re){if(!O.get(xt))return;const{onDragPending:Qe}=q.current,Ft={id:xt,constraint:jn,initialCoordinates:Rt,offset:re};Qe==null||Qe(Ft),E({type:"onDragPending",event:Ft})},onStart(xt){const jn=z.current;if(jn==null)return;const Rt=O.get(jn);if(!Rt)return;const{onDragStart:re}=q.current,Ae={activatorEvent:sn,active:{id:jn,data:Rt.data,rect:W}};Ps.unstable_batchedUpdates(()=>{re==null||re(Ae),$(so.Initializing),k({type:bn.DragStart,initialCoordinates:xt,active:jn}),E({type:"onDragStart",event:Ae}),ee(Le.current),M(sn)})},onMove(xt){k({type:bn.DragMove,coordinates:xt})},onEnd:Gn(bn.DragEnd),onCancel:Gn(bn.DragCancel)});Le.current=Wt;function Gn(xt){return async function(){const{active:Rt,collisions:re,over:Ae,scrollAdjustedTranslate:Qe}=Je.current;let Ft=null;if(Rt&&Qe){const{cancelDrop:hn}=q.current;Ft={activatorEvent:sn,active:Rt,collisions:re,delta:Qe,over:Ae},xt===bn.DragEnd&&typeof hn=="function"&&await Promise.resolve(hn(Ft))&&(xt=bn.DragCancel)}z.current=null,Ps.unstable_batchedUpdates(()=>{k({type:xt}),$(so.Uninitialized),lt(null),ee(null),M(null),Le.current=null;const hn=xt===bn.DragEnd?"onDragEnd":"onDragCancel";if(Ft){const Ct=q.current[hn];Ct==null||Ct(Ft),E({type:hn,event:Ft})}})}}},[O]),_e=f.useCallback((Be,Fe)=>(Nt,$n)=>{const Yt=Nt.nativeEvent,sn=O.get($n);if(z.current!==null||!sn||Yt.dndKit||Yt.defaultPrevented)return;const Wt={active:sn};Be(Nt,Fe.options,Wt)===!0&&(Yt.dndKit={capturedBy:Fe.sensor},z.current=$n,it(Nt,Fe))},[O,it]),bt=dz(h,_e);bz(h),ps(()=>{ke&&P===so.Initializing&&$(so.Initialized)},[ke,P]),f.useEffect(()=>{const{onDragMove:Be}=q.current,{active:Fe,activatorEvent:Nt,collisions:$n,over:Yt}=Je.current;if(!Fe||!Nt)return;const sn={active:Fe,activatorEvent:Nt,collisions:$n,delta:{x:G.x,y:G.y},over:Yt};Ps.unstable_batchedUpdates(()=>{Be==null||Be(sn),E({type:"onDragMove",event:sn})})},[G.x,G.y]),f.useEffect(()=>{const{active:Be,activatorEvent:Fe,collisions:Nt,droppableContainers:$n,scrollAdjustedTranslate:Yt}=Je.current;if(!Be||z.current==null||!Fe||!Yt)return;const{onDragOver:sn}=q.current,Wt=$n.get(ye),Gn=Wt&&Wt.rect.current?{id:Wt.id,rect:Wt.rect.current,data:Wt.data,disabled:Wt.disabled}:null,xt={active:Be,activatorEvent:Fe,collisions:Nt,delta:{x:Yt.x,y:Yt.y},over:Gn};Ps.unstable_batchedUpdates(()=>{lt(Gn),sn==null||sn(xt),E({type:"onDragOver",event:xt})})},[ye]),ps(()=>{Je.current={activatorEvent:ne,active:oe,activeNode:U,collisionRect:pe,collisions:Q,droppableRects:I,draggableNodes:O,draggingNode:Y,draggingNodeRect:Ie,droppableContainers:V,over:Re,scrollableAncestors:Me,scrollAdjustedTranslate:G},W.current={initial:Ie,translated:pe}},[oe,U,Q,pe,O,Y,Ie,I,V,Re,Me,G]),iz({...me,delta:J,draggingRect:pe,pointerCoordinates:gt,scrollableAncestors:Me,scrollableAncestorRects:nt});const _t=f.useMemo(()=>({active:oe,activeNode:U,activeNodeRect:ke,activatorEvent:ne,collisions:Q,containerNodeRect:he,dragOverlay:ot,draggableNodes:O,droppableContainers:V,droppableRects:I,over:Re,measureDroppableContainers:de,scrollableAncestors:Me,scrollableAncestorRects:nt,measuringConfiguration:Z,measuringScheduled:ge,windowRect:Xe}),[oe,U,ke,ne,Q,he,ot,O,V,I,Re,de,Me,nt,Z,ge,Xe]),Gt=f.useMemo(()=>({activatorEvent:ne,activators:bt,active:oe,activeNodeRect:ke,ariaDescribedById:{draggable:A},dispatch:k,draggableNodes:O,over:Re,measureDroppableContainers:de}),[ne,bt,oe,ke,k,A,O,Re,de]);return nn.createElement(UN.Provider,{value:N},nn.createElement(vf.Provider,{value:Gt},nn.createElement(sC.Provider,{value:_t},nn.createElement(oC.Provider,{value:be},m)),nn.createElement(Rz,{disabled:(u==null?void 0:u.restoreFocus)===!1})),nn.createElement($6,{...u,hiddenTextDescribedById:A}));function ue(){const Be=(H==null?void 0:H.autoScrollEnabled)===!1,Fe=typeof p=="object"?p.enabled===!1:p===!1,Nt=T&&!Be&&!Fe;return typeof p=="object"?{...p,enabled:Nt}:{enabled:Nt}}}),Lz=f.createContext(null),Aj="button",Oz="Draggable";function Iz(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const l=gc(Oz),{activators:c,activatorEvent:u,active:p,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=f.useContext(vf),{role:b=Aj,roleDescription:C="draggable",tabIndex:j=0}=a??{},w=(p==null?void 0:p.id)===t,k=f.useContext(w?oC:Lz),[E,N]=vd(),[P,$]=vd(),T=vz(c,t),D=Ql(n);ps(()=>(g.set(t,{id:t,key:l,node:E,activatorNode:P,data:D}),()=>{const J=g.get(t);J&&J.key===l&&g.delete(t)}),[g,t]);const O=f.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":w&&b===Aj?!0:void 0,"aria-roledescription":C,"aria-describedby":h.draggable}),[s,b,j,w,C,h.draggable]);return{active:p,activatorEvent:u,activeNodeRect:m,attributes:O,isDragging:w,listeners:s?void 0:T,node:E,over:y,setNodeRef:N,setActivatorNodeRef:$,transform:k}}function Mz(){return f.useContext(sC)}const _z="Droppable",Fz={timeout:25};function zz(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const l=gc(_z),{active:c,dispatch:u,over:p,measureDroppableContainers:m}=f.useContext(vf),h=f.useRef({disabled:n}),g=f.useRef(!1),y=f.useRef(null),b=f.useRef(null),{disabled:C,updateMeasurementsFor:j,timeout:w}={...Fz,...a},k=Ql(j??s),E=f.useCallback(()=>{if(!g.current){g.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(k.current)?k.current:[k.current]),b.current=null},w)},[w]),N=bf({callback:E,disabled:C||!c}),P=f.useCallback((O,J)=>{N&&(J&&(N.unobserve(J),g.current=!1),O&&N.observe(O))},[N]),[$,T]=vd(P),D=Ql(t);return f.useEffect(()=>{!N||!$.current||(N.disconnect(),g.current=!1,N.observe($.current))},[$,N]),f.useEffect(()=>(u({type:bn.RegisterDroppable,element:{id:s,key:l,disabled:n,node:$,rect:y,data:D}}),()=>u({type:bn.UnregisterDroppable,key:l,id:s})),[s]),f.useEffect(()=>{n!==h.current.disabled&&(u({type:bn.SetDroppableDisabled,id:s,key:l,disabled:n}),h.current.disabled=n)},[s,l,n,u]),{active:c,rect:y,isOver:(p==null?void 0:p.id)===s,node:$,over:p,setNodeRef:T}}function wf(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function Bz(e,t){return e.reduce((n,s,a)=>{const l=t.get(s);return l&&(n[a]=l),n},Array(e.length))}function Iu(e){return e!==null&&e>=0}function Uz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Vz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const iC=e=>{let{rects:t,activeIndex:n,overIndex:s,index:a}=e;const l=wf(t,s,n),c=t[a],u=l[a];return!u||!c?null:{x:u.left-c.left,y:u.top-c.top,scaleX:u.width/c.width,scaleY:u.height/c.height}},Mu={scaleX:1,scaleY:1},lC=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:a,rects:l,overIndex:c}=e;const u=(t=l[n])!=null?t:s;if(!u)return null;if(a===n){const m=l[c];return m?{x:0,y:n<c?m.top+m.height-(u.top+u.height):m.top-u.top,...Mu}:null}const p=Hz(l,a,n);return a>n&&a<=c?{x:0,y:-u.height-p,...Mu}:a<n&&a>=c?{x:0,y:u.height+p,...Mu}:{x:0,y:0,...Mu}};function Hz(e,t,n){const s=e[t],a=e[t-1],l=e[t+1];return s?n<t?a?s.top-(a.top+a.height):l?l.top-(s.top+s.height):0:l?l.top-(s.top+s.height):a?s.top-(a.top+a.height):0:0}const cC="Sortable",uC=nn.createContext({activeIndex:-1,containerId:cC,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:iC,disabled:{draggable:!1,droppable:!1}});function dC(e){let{children:t,id:n,items:s,strategy:a=iC,disabled:l=!1}=e;const{active:c,dragOverlay:u,droppableRects:p,over:m,measureDroppableContainers:h}=Mz(),g=gc(cC,n),y=u.rect!==null,b=f.useMemo(()=>s.map(T=>typeof T=="object"&&"id"in T?T.id:T),[s]),C=c!=null,j=c?b.indexOf(c.id):-1,w=m?b.indexOf(m.id):-1,k=f.useRef(b),E=!Uz(b,k.current),N=w!==-1&&j===-1||E,P=Vz(l);ps(()=>{E&&C&&h(b)},[E,b,C,h]),f.useEffect(()=>{k.current=b},[b]);const $=f.useMemo(()=>({activeIndex:j,containerId:g,disabled:P,disableTransforms:N,items:b,overIndex:w,useDragOverlay:y,sortedRects:Bz(b,p),strategy:a}),[j,g,P.draggable,P.droppable,N,b,w,p,y,a]);return nn.createElement(uC.Provider,{value:$},t)}const Wz=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return wf(n,s,a).indexOf(t)},Kz=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:a,items:l,newIndex:c,previousItems:u,previousContainerId:p,transition:m}=e;return!m||!s||u!==l&&a===c?!1:n?!0:c!==a&&t===p},qz={duration:200,easing:"ease"},fC="transform",Gz=hi.Transition.toString({property:fC,duration:0,easing:"linear"}),Yz={roleDescription:"sortable"};function Jz(e){let{disabled:t,index:n,node:s,rect:a}=e;const[l,c]=f.useState(null),u=f.useRef(n);return ps(()=>{if(!t&&n!==u.current&&s.current){const p=a.current;if(p){const m=Ri(s.current,{ignoreTransform:!0}),h={x:p.left-m.left,y:p.top-m.top,scaleX:p.width/m.width,scaleY:p.height/m.height};(h.x||h.y)&&c(h)}}n!==u.current&&(u.current=n)},[t,n,s,a]),f.useEffect(()=>{l&&c(null)},[l]),l}function pC(e){let{animateLayoutChanges:t=Kz,attributes:n,disabled:s,data:a,getNewIndex:l=Wz,id:c,strategy:u,resizeObserverConfig:p,transition:m=qz}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:C,sortedRects:j,overIndex:w,useDragOverlay:k,strategy:E}=f.useContext(uC),N=Xz(s,b),P=h.indexOf(c),$=f.useMemo(()=>({sortable:{containerId:g,index:P,items:h},...a}),[g,a,P,h]),T=f.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:D,node:O,isOver:J,setNodeRef:V}=zz({id:c,data:$,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...p}}),{active:L,activatorEvent:W,activeNodeRect:oe,attributes:z,setNodeRef:H,listeners:ee,isDragging:ne,over:M,setActivatorNodeRef:q,transform:A}=Iz({id:c,data:$,attributes:{...Yz,...n},disabled:N.draggable}),F=v6(V,H),Z=!!L,I=Z&&!C&&Iu(y)&&Iu(w),de=!k&&ne,ge=de&&I?A:null,ae=I?ge??(u??E)({rects:j,activeNodeRect:oe,activeIndex:y,overIndex:w,index:P}):null,me=Iu(y)&&Iu(w)?l({id:c,items:h,activeIndex:y,overIndex:w}):P,ve=L==null?void 0:L.id,ke=f.useRef({activeId:ve,items:h,newIndex:me,containerId:g}),he=h!==ke.current.items,Je=t({active:L,containerId:g,isDragging:ne,isSorting:Z,id:c,index:P,items:h,newIndex:ke.current.newIndex,previousItems:ke.current.items,previousContainerId:ke.current.containerId,transition:m,wasDragging:ke.current.activeId!=null}),Ye=Jz({disabled:!Je,index:P,node:O,rect:D});return f.useEffect(()=>{Z&&ke.current.newIndex!==me&&(ke.current.newIndex=me),g!==ke.current.containerId&&(ke.current.containerId=g),h!==ke.current.items&&(ke.current.items=h)},[Z,me,g,h]),f.useEffect(()=>{if(ve===ke.current.activeId)return;if(ve!=null&&ke.current.activeId==null){ke.current.activeId=ve;return}const Y=setTimeout(()=>{ke.current.activeId=ve},50);return()=>clearTimeout(Y)},[ve]),{active:L,activeIndex:y,attributes:z,data:$,rect:D,index:P,newIndex:me,items:h,isOver:J,isSorting:Z,isDragging:ne,listeners:ee,node:O,overIndex:w,over:M,setNodeRef:F,setActivatorNodeRef:q,setDroppableNodeRef:V,setDraggableNodeRef:H,transform:Ye??ae,transition:ot()};function ot(){if(Ye||he&&ke.current.newIndex===P)return Gz;if(!(de&&!Px(W)||!m)&&(Z||Je))return hi.Transition.toString({...m,property:fC})}}function Xz(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:t.droppable}}function Sd(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Qz=[ht.Down,ht.Right,ht.Up,ht.Left],Zz=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:l,over:c,scrollableAncestors:u}}=t;if(Qz.includes(e.code)){if(e.preventDefault(),!n||!s)return;const p=[];l.getEnabled().forEach(g=>{if(!g||g!=null&&g.disabled)return;const y=a.get(g.id);if(y)switch(e.code){case ht.Down:s.top<y.top&&p.push(g);break;case ht.Up:s.top>y.top&&p.push(g);break;case ht.Left:s.left>y.left&&p.push(g);break;case ht.Right:s.left<y.left&&p.push(g);break}});const m=O6({collisionRect:s,droppableRects:a,droppableContainers:p});let h=KN(m,"id");if(h===(c==null?void 0:c.id)&&m.length>1&&(h=m[1].id),h!=null){const g=l.get(n.id),y=l.get(h),b=y?a.get(y.id):null,C=y==null?void 0:y.node.current;if(C&&b&&g&&y){const w=gf(C).some((T,D)=>u[D]!==T),k=mC(g,y),E=eB(g,y),N=w||!k?{x:0,y:0}:{x:E?s.width-b.width:0,y:E?s.height-b.height:0},P={x:b.left,y:b.top};return N.x&&N.y?P:Zl(P,N)}}}};function mC(e,t){return!Sd(e)||!Sd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function eB(e,t){return!Sd(e)||!Sd(t)||!mC(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function tB({value:e,onChange:t,ariaLabel:n}){const s=n??"Pick a color",a=n?`${n} (hex)`:"Color hex value";return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e||"#64748b",onChange:l=>t(l.target.value),className:"h-7 w-7 shrink-0 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5",title:"Pick a color","aria-label":s}),r.jsx("input",{type:"text",value:e,onChange:l=>t(l.target.value),placeholder:"#64748b",className:"editor-input w-[5.5rem] font-mono text-xs","aria-label":a})]})}const Vh=["projects","playbooks","todos","servers","config"];function nB(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))Vh.includes(n)&&t.add(n);return t}function Dj(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function rB(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(""),[c,u]=f.useState(new Set(Vh)),[p,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(null),[C,j]=f.useState(null),w=f.useCallback(async()=>{try{const T=await fetch("/api/backup");if(!T.ok)throw new Error(`HTTP ${T.status}`);const D=await T.json();s(D),l(D.repo??""),u(nB(D.categories)),m(!1)}catch(T){j({type:"error",message:`Failed to load backup config: ${T instanceof Error?T.message:String(T)}`})}finally{t(!1)}},[]);f.useEffect(()=>{w()},[w]);function k(T){u(D=>{const O=new Set(D);return O.has(T)?O.delete(T):O.add(T),O}),m(!0)}async function E(){g(!0),j(null);try{const T=Array.from(c),D=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:a.trim()||null,categories:T})}),O=await D.json();if(!D.ok)throw new Error(O.error||`HTTP ${D.status}`);s(O),m(!1),j({type:"success",message:"Backup configuration saved."})}catch(T){j({type:"error",message:`Save failed: ${T instanceof Error?T.message:String(T)}`})}finally{g(!1)}}async function N(){b("push"),j(null);try{const T=await fetch("/api/backup/push",{method:"POST"}),D=await T.json();if(!T.ok||D.success===!1)throw new Error(D.error||D.message||`HTTP ${T.status}`);j({type:"success",message:D.message||"Backup complete."}),await w()}catch(T){j({type:"error",message:`Backup failed: ${T instanceof Error?T.message:String(T)}`})}finally{b(null)}}async function P(){if(window.confirm("Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?")){b("pull"),j(null);try{const D=await fetch("/api/backup/pull",{method:"POST"}),O=await D.json();if(!D.ok||O.success===!1)throw new Error(O.error||O.message||`HTTP ${D.status}`);j({type:"success",message:O.message||"Restore complete."}),await w()}catch(D){j({type:"error",message:`Restore failed: ${D instanceof Error?D.message:String(D)}`})}finally{b(null)}}}if(e)return r.jsx(We,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})});const $=!!a.trim()&&c.size>0&&!y&&!p;return r.jsx(We,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:r.jsxs("div",{className:"space-y-4",children:[C&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${C.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:C.message}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repository URL"}),r.jsx("input",{type:"text",value:a,onChange:T=>{l(T.target.value),m(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",r.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Vh.map(T=>{const D=c.has(T);return r.jsxs("button",{type:"button",onClick:()=>k(T),className:`shell-action text-xs ${D?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:[r.jsx("span",{className:`mr-1 inline-block h-2 w-2 rounded-full ${D?"bg-primary":"bg-muted-foreground/40"}`}),T]},T)})})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last backup: "}),Dj((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),Dj((n==null?void 0:n.lastRestore)??null)]}),(n==null?void 0:n.locked)&&r.jsx("div",{className:"sm:col-span-2 text-warning-foreground",children:"⚠ A backup operation is in progress or the lock file is stale."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:E,disabled:h||!p,children:[r.jsx(Id,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:N,disabled:!$,title:$?"Back up now":p?"Save config first":"Set repo and pick categories",children:[r.jsx(RP,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:P,disabled:!$,title:$?"Restore from backup":p?"Save config first":"Set repo and pick categories",children:[r.jsx(aP,{className:"h-3.5 w-3.5"}),y==="pull"?"Restoring...":"Restore"]}),p&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]}),r.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-muted/20 p-3 text-xs text-muted-foreground",children:[r.jsx(sP,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Restore never overwrites ",r.jsx("code",{className:"rounded bg-muted px-1",children:"config.md"})," (would clobber backup settings). The agent sessions database is not backed up — only markdown files."]})]})]})})}function sB({open:e,affected:t,remaining:n,onResolve:s,onCancel:a}){var j;const[l,c]=f.useState(n.length>0?"remap":"delete"),[u,p]=f.useState(((j=n[0])==null?void 0:j.id)??""),[m,h]=f.useState(!1);f.useEffect(()=>{var w;e&&(c(n.length>0?"remap":"delete"),p(((w=n[0])==null?void 0:w.id)??""),h(!1))},[e,n]);const g=l==="remap"&&n.length>0&&u!==""&&u!==t.id||l==="delete"&&m;function y(){g&&s(l==="remap"?{id:t.id,mode:"remap",target:u}:{id:t.id,mode:"delete"})}const b=t.assignments.slice(0,10),C=t.count-b.length;return r.jsx(ar,{open:e,onOpenChange:w=>w?void 0:a(),children:r.jsxs(Kn,{className:"max-w-xl",children:[r.jsxs(Qr,{children:[r.jsxs(qn,{children:['Delete status "',t.label,'" — ',t.count," assignment",t.count===1?"":"s"," reference it"]}),r.jsx(gs,{children:"Choose how to resolve the affected assignments before this status is removed from the workflow."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("ul",{className:"space-y-1 text-sm",children:[b.map(w=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:w.display})},`${w.projectSlug??"standalone"}/${w.assignmentSlug}`)),C>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",C," more not shown"]})]})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="remap",onChange:()=>c("remap"),disabled:n.length===0,className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium",children:"Remap to another status"}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),onClick:()=>c("remap"),disabled:l!=="remap"||n.length===0,className:"mt-2 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(w=>r.jsxs("option",{value:w.id,children:[w.label," (",w.id,")"]},w.id))]}),n.length===0&&r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"No other saved statuses to remap to. Add another status first, or use Delete."})]})]}),r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="delete",onChange:()=>c("delete"),className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:"Delete these assignments"}),r.jsxs("span",{className:"block text-xs text-muted-foreground mt-1",children:["Permanently removes ",t.count," assignment",t.count===1?"":"s"," from disk. This cannot be undone."]}),l==="delete"&&r.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:m,onChange:w=>h(w.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(Ls,{children:[r.jsx("button",{type:"button",onClick:a,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:y,disabled:!g,className:`shell-action ${l==="delete"?"bg-error text-error-foreground hover:opacity-90":"shell-action--cta"} disabled:cursor-not-allowed disabled:opacity-50`,children:l==="remap"?`Remap ${t.count} → ${u||"..."}`:`Delete ${t.count}`})]})]})})}function oB(e){const t=Array.from(e.pendingResolutions.values());return{body:{statuses:e.statuses.map(s=>({id:s.id,label:s.label,...s.description?{description:s.description}:{},...s.color?{color:s.color}:{},...s.terminal?{terminal:!0}:{}})),order:e.order,transitions:[],resolutions:t},resolutions:t}}function aB(e,t){const n=new Map;t.forEach((a,l)=>{n.has(a)||n.set(a,l)});const s=t.length;return e.map((a,l)=>({s:a,originalIndex:l,r:n.get(a.id)??s})).sort((a,l)=>a.r-l.r||a.originalIndex-l.originalIndex).map(a=>a.s)}function $j(e,t){const n=new Map;for(const[s,a]of e.entries())t.has(a.id)||a.mode==="remap"&&!t.has(a.target)||n.set(s,a);return n}function iB(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:a,unbindAction:l}=po(),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(!1),y=Object.values(t).some(N=>typeof N=="string"&&N.length>0);function b(N,P){m({type:N,message:P}),setTimeout(()=>m(null),2500)}function C(N){u({kind:N,combo:null,conflict:null,saving:!1,error:null})}function j(N){if(!c||N.key==="Escape")return;if(N.key==="Enter"&&c.combo){N.preventDefault(),w();return}if(N.key==="Enter")return;N.preventDefault(),N.stopPropagation();const P=V0(N.nativeEvent);if(!P)return;const $=s(P,c.kind);u({...c,combo:P,conflict:$,error:null})}async function w(){var N;if(c!=null&&c.combo){if((N=c.conflict)!=null&&N.description){u({...c,error:`Reserved: ${c.conflict.description}`});return}u({...c,saving:!0,error:null});try{await a(c.kind,c.combo),u(null),b("success",`Bound ${xl[c.kind]}`)}catch(P){u({...c,saving:!1,error:P instanceof Error?P.message:"Failed to save"})}}}async function k(N){try{await l(N),b("success",`Cleared ${xl[N]} binding`)}catch(P){b("error",P instanceof Error?P.message:"Failed to clear binding")}}async function E(){if(!h){g(!0);try{await J3(),b("success","All hotkey bindings cleared")}catch(N){b("error",N instanceof Error?N.message:"Failed to reset bindings")}finally{g(!1)}}}return r.jsxs(We,{title:"Hotkey Bindings",description:"Each canonical create action ships with a default hotkey that fires the action without opening the palette. Override any of them below — Clear restores the default.",actions:y?r.jsxs("button",{className:"shell-action text-xs",onClick:()=>void E(),disabled:h,children:[r.jsx(io,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[p?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${p.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:p.message}):null,r.jsx("ul",{className:"space-y-2",children:_d.map(N=>{var O,J;const P=n.find(V=>V.bindableKind===N),$=e[N],T=typeof t[N]=="string"&&!!t[N],D=(c==null?void 0:c.kind)===N;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[r.jsx(uh,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm text-foreground",children:(P==null?void 0:P.title)??xl[N]}),P!=null&&P.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:P.subtitle}):null]}),$?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-foreground",children:us($)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${T?"text-primary":"text-muted-foreground"}`,children:T?"custom":"default"})]}):r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>C(N),children:$?"Rebind":"Bind"}),T?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(N),"aria-label":`Restore default ${xl[N]} binding`,children:[r.jsx(ig,{className:"h-3 w-3"}),"Restore default"]}):null]}),D?r.jsx("div",{className:"mt-2 w-full rounded-md border border-primary/40 bg-primary/5 px-3 py-3 text-center outline-none",tabIndex:0,autoFocus:!0,onKeyDown:j,onBlur:()=>{(c==null?void 0:c.kind)===N&&!c.saving&&u(null)},children:c!=null&&c.combo?r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:us(c.combo)}),(O=c.conflict)!=null&&O.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(J=c.conflict)!=null&&J.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',xl[c.conflict.kind],'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press Enter to save, Esc to cancel, any other key to retry."}),c.error?r.jsx("div",{className:"text-xs text-destructive",children:c.error}):null]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press the key combination you want to bind…"})}):null]},N)})})]})}const lB={kanban:"Kanban",list:"List",table:"Table"},cB={comfortable:"Comfortable",compact:"Compact"},uB={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},dB={asc:"Ascending",desc:"Descending"};function fB(){const e=Y_(),t=e.global,[n,s]=f.useState(!1),[a,l]=f.useState(null);function c(m,h){l({type:m,message:h}),setTimeout(()=>l(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await dN({[m]:h}),c("success","Saved")}catch(g){c("error",g instanceof Error?g.message:"Failed to save")}finally{s(!1)}}}async function p(){if(e.custom){s(!0);try{await J_(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(We,{title:"View defaults",description:"Defaults for the assignments board, list, and table views. Per-project overrides are saved automatically as you use them.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:p,disabled:n,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[a&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${a.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:a.message}),r.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Default view"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:Rg.map(m=>r.jsx("button",{type:"button",onClick:()=>u("defaultView",m),disabled:n,"aria-pressed":t.defaultView===m,className:`px-3 py-1 text-xs ${t.defaultView===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:lB[m]},m))})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Density"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:$D.map(m=>r.jsx("button",{type:"button",onClick:()=>u("density",m),disabled:n,"aria-pressed":t.density===m,className:`px-3 py-1 text-xs ${t.density===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:cB[m]},m))})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sort by"}),r.jsx("dd",{className:"mt-1.5",children:r.jsx("select",{value:t.sortField,onChange:m=>u("sortField",m.target.value),disabled:n,className:"editor-input max-w-[220px]",children:n1.map(m=>r.jsx("option",{value:m,children:uB[m]},m))})})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Direction"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:DD.map(m=>r.jsx("button",{type:"button",onClick:()=>u("sortDirection",m),disabled:n,"aria-pressed":t.sortDirection===m,className:`px-3 py-1 text-xs ${t.sortDirection===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:dB[m]},m))})]})]})]})}const pB=/^[a-z0-9][a-z0-9_-]*$/,hC=["first","last","none"];class gC extends Error{constructor(n,s){super(n);Xb(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const Dx={agents:[],custom:!1};let Xa=null,Ka=null,Nd=0;const Hh=new Set;function xC(e){Xa=e;for(const t of Hh)t(e)}function mB(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(typeof t.id!="string"||t.id.length===0||typeof t.label!="string"||typeof t.command!="string")return null;const n={id:t.id,label:t.label,command:t.command};return Array.isArray(t.args)&&t.args.every(s=>typeof s=="string")&&(n.args=t.args),typeof t.promptArgPosition=="string"&&hC.includes(t.promptArgPosition)&&(n.promptArgPosition=t.promptArgPosition),typeof t.resolveFromShellAliases=="boolean"&&(n.resolveFromShellAliases=t.resolveFromShellAliases),typeof t.default=="boolean"&&(n.default=t.default),n}function $x(e){if(!e||typeof e!="object")return Dx;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const a of n){const l=mB(a);l&&s.push(l)}return{agents:s,custom:t.custom===!0}}function hB(){if(Xa)return Promise.resolve(Xa);if(Ka)return Ka;const e=++Nd;return Ka=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Ka=null;const n=$x(t);return e!==Nd?Xa??n:(Xa=n,n)}).catch(()=>(Ka=null,Dx)),Ka}function gB(){const[e,t]=f.useState(()=>Xa??Dx);return f.useEffect(()=>{let n=!1;return hB().then(s=>{n||t(s)}),Hh.add(t),()=>{n=!0,Hh.delete(t)}},[]),e}async function yC(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new gC(n,t==null?void 0:t.fieldErrors)}async function xB(e){++Nd;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await yC(t);const n=$x(await t.json());return xC(n),n}async function yB(){++Nd;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await yC(e);const t=$x(await e.json());return xC(t),t}const bB={first:"first",last:"last",none:"none"};function bC(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Nl(e){return e.map(t=>({rowKey:bC(),id:t.id,originalId:t.id,isNew:!1,idEditable:!1,autoSlugFromLabel:!1,label:t.label,command:t.command,argsText:t.args?t.args.join(" "):"",promptArgPosition:t.promptArgPosition??"first",resolveFromShellAliases:t.resolveFromShellAliases??!1,default:t.default??!1,fieldErrors:{}}))}function vB(e){return e.map(t=>{const n={id:t.id,label:t.label,command:t.command},s=t.argsText.split(/[,\s]+/).filter(Boolean);return s.length>0&&(n.args=s),t.promptArgPosition!=="first"&&(n.promptArgPosition=t.promptArgPosition),t.resolveFromShellAliases&&(n.resolveFromShellAliases=!0),t.default&&(n.default=!0),n})}function wB(e){if(e.length===0)return e;let t=-1;for(let n=0;n<e.length;n++)if(e[n].default){t=n;break}return e.map((n,s)=>({...n,default:t===-1?s===0:s===t}))}function jB(e,t){return!t||t.length===0?e:e.map((n,s)=>{const a={};for(const l of t){if(l.index!==void 0){l.index===s&&(a[l.field]=l.message);continue}if(l.id!==void 0){l.id===n.id&&(a[l.field]=l.message);continue}a[l.field]=l.message}return{...n,fieldErrors:a}})}function kB(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function SB(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],a=t[n];if(s.id!==a.id||s.label!==a.label||s.command!==a.command||s.argsText!==a.argsText||s.promptArgPosition!==a.promptArgPosition||s.resolveFromShellAliases!==a.resolveFromShellAliases||s.default!==a.default)return!1}return!0}function NB({row:e,index:t,canRemove:n,onPatch:s,onSetDefault:a,onRemove:l}){const{attributes:c,listeners:u,setNodeRef:p,setActivatorNodeRef:m,transform:h,transition:g,isDragging:y}=pC({id:e.rowKey}),b={transform:hi.Transform.toString(h),transition:g,zIndex:y?50:void 0,position:y?"relative":void 0};function C(k){const E={label:k};if(e.autoSlugFromLabel){const N=mr(k);N&&pB.test(N)?E.id=N:E.id=`agent-${t+1}`}s(E)}function j(k){s({id:k,autoSlugFromLabel:!1})}const w=k=>e.fieldErrors[k]?"border-error-foreground/60":"";return r.jsxs("div",{ref:p,style:b,className:`surface-panel space-y-2 px-3 py-2 ${y?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:m,...c,...u,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(d0,{className:"h-4 w-4"})}),r.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:a,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?r.jsx("input",{type:"text",value:e.id,onChange:k=>j(k.target.value),className:`editor-input w-32 font-mono text-xs ${w("id")}`,"aria-label":"Agent id"}):r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),r.jsx("button",{type:"button",onClick:l,disabled:!n,"aria-label":"Remove agent",className:"rounded p-1 text-muted-foreground/60 transition hover:bg-foreground/[0.04] hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30",children:r.jsx(or,{className:"h-3.5 w-3.5"})})]})]}),e.fieldErrors.id&&r.jsx("p",{className:"ml-7 text-[11px] text-error-foreground",children:e.fieldErrors.id}),r.jsxs("div",{className:"ml-7 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Label"}),r.jsx("input",{type:"text",value:e.label,onChange:k=>C(k.target.value),className:`editor-input mt-0.5 w-full ${w("label")}`}),e.fieldErrors.label&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.label})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Command"}),r.jsx("input",{type:"text",value:e.command,placeholder:"claude or /usr/local/bin/claude",onChange:k=>s({command:k.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("command")}`}),e.fieldErrors.command&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.command})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Args (comma- or space-separated)"}),r.jsx("input",{type:"text",value:e.argsText,placeholder:"--dangerously-skip-permissions",onChange:k=>s({argsText:k.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("args")}`}),e.fieldErrors.args&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.args})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Prompt arg position"}),r.jsx("select",{value:e.promptArgPosition,onChange:k=>s({promptArgPosition:k.target.value}),className:`editor-input mt-0.5 w-full ${w("promptArgPosition")}`,children:hC.map(k=>r.jsx("option",{value:k,children:bB[k]},k))}),e.fieldErrors.promptArgPosition&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),r.jsxs("label",{className:"col-span-full inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:e.resolveFromShellAliases,onChange:k=>s({resolveFromShellAliases:k.target.checked}),className:"h-3.5 w-3.5 cursor-pointer accent-foreground"}),"Resolve from shell aliases (look up ",r.jsx("code",{className:"font-mono",children:"command"})," in your interactive shell before launching)"]})]})]})}function CB(){const e=gB(),[t,n]=f.useState(()=>Nl(e.agents)),[s,a]=f.useState(()=>Nl(e.agents)),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);f.useEffect(()=>{const T=Nl(e.agents);n(T),a(T),p(null)},[e.agents]);const g=f.useMemo(()=>!SB(t,s),[t,s]),y=VN(jd(yf,{activationConstraint:{distance:8}}),jd(xf));function b(T,D){h({type:T,message:D}),setTimeout(()=>h(null),2500)}function C(T,D){n(O=>O.map(J=>J.rowKey===T?{...J,...D,fieldErrors:EB(J.fieldErrors,D)}:J))}function j(T){n(D=>D.map(O=>({...O,default:O.rowKey===T})))}function w(){n(T=>{const D=new Set(T.map(oe=>oe.id)),O="new-agent";let J=O,V=1;for(;D.has(J);)V+=1,J=`${O}-${V}`;const L=V===1?"New Agent":`New Agent ${V}`,W={rowKey:bC(),id:J,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:L,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,fieldErrors:{}};return[...T,W]})}function k(T){n(D=>D.filter(O=>O.rowKey!==T))}async function E(){c(!0),p(null);try{const T=wB(t),D=vB(T),O=await xB(D),J=Nl(O.agents);n(J),a(J),b("success","Agents saved")}catch(T){if(T instanceof gC)p(T.message),n(D=>jB(kB(D),T.fieldErrors)),b("error",T.message);else{const D=T instanceof Error?T.message:"Failed to save";p(D),b("error",D)}}finally{c(!1)}}function N(){n(s),p(null)}async function P(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){c(!0),p(null);try{const T=await yB(),D=Nl(T.agents);n(D),a(D),b("success","Reset to defaults")}catch(T){const D=T instanceof Error?T.message:"Failed to reset";p(D),b("error",D)}finally{c(!1)}}}function $(T){const{active:D,over:O}=T;!O||D.id===O.id||n(J=>{const V=J.findIndex(W=>W.rowKey===D.id),L=J.findIndex(W=>W.rowKey===O.id);return V===-1||L===-1?J:wf(J,V,L)})}return r.jsxs(We,{title:"Agents",description:"Configure which agents the dashboard and 'Open in agent' actions can launch. The default agent is used when no other one is specified.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:P,disabled:l,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[!e.custom&&r.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-foreground/[0.02] px-3 py-2 text-xs text-muted-foreground",children:[r.jsx(ng,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Using built-in defaults — first save will write your own list to"," ",r.jsx("code",{className:"font-mono",children:"~/.syntaur/config.md"}),"."]})]}),m&&r.jsx("div",{className:`rounded-md border px-3 py-1.5 text-xs ${m.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:m.message}),u&&(!m||m.type!=="error")&&r.jsx("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-1.5 text-xs text-error-foreground",children:u}),r.jsx(aC,{sensors:y,collisionDetection:qN,onDragEnd:$,children:r.jsx(dC,{items:t.map(T=>T.rowKey),strategy:lC,children:r.jsx("div",{className:"space-y-2",children:t.map((T,D)=>r.jsx(NB,{row:T,index:D,canRemove:t.length>1,onPatch:O=>C(T.rowKey,O),onSetDefault:()=>j(T.rowKey),onRemove:()=>k(T.rowKey)},T.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:w,disabled:l,className:"shell-action text-xs",children:[r.jsx(rn,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:N,disabled:!g||l,className:"shell-action text-xs",children:"Discard"}),r.jsxs("button",{type:"button",onClick:E,disabled:!g||l,className:"shell-action text-xs",children:[r.jsx(Id,{className:"h-3 w-3"}),"Save"]})]})]})]})}function EB(e,t){if(Object.keys(e).length===0)return e;const n={...e};return"id"in t&&delete n.id,"label"in t&&delete n.label,"command"in t&&delete n.command,"argsText"in t&&delete n.args,"promptArgPosition"in t&&delete n.promptArgPosition,"resolveFromShellAliases"in t&&delete n.resolveFromShellAliases,"default"in t&&delete n.default,n}const vC=["terminal-app","iterm","ghostty","alacritty","warp","kitty"],Cd={terminal:"terminal-app",custom:!1};let Qa=null,qa=null,Ed=0;const Wh=new Set;function wC(e){Qa=e;for(const t of Wh)t(e)}function Lx(e){if(!e||typeof e!="object")return Cd;const t=e;return{terminal:typeof t.terminal=="string"&&vC.includes(t.terminal)?t.terminal:Cd.terminal,custom:t.custom===!0}}function TB(){if(Qa)return Promise.resolve(Qa);if(qa)return qa;const e=++Ed;return qa=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{qa=null;const n=Lx(t);return e!==Ed?Qa??n:(Qa=n,n)}).catch(()=>(qa=null,Cd)),qa}function PB(){const[e,t]=f.useState(()=>Qa??Cd);return f.useEffect(()=>{let n=!1;return TB().then(s=>{n||t(s)}),Wh.add(t),()=>{n=!0,Wh.delete(t)}},[]),e}async function RB(e){++Ed;const t=await fetch("/api/config/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({terminal:e})});if(!t.ok){const s=await t.json().catch(()=>null);throw new Error((s==null?void 0:s.error)??`HTTP ${t.status}`)}const n=Lx(await t.json());return wC(n),n}async function AB(){++Ed;const e=await fetch("/api/config/terminal",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=Lx(await e.json());return wC(t),t}const _u={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty"};function DB(){const{terminal:e,custom:t}=PB(),[n,s]=f.useState(!1),[a,l]=f.useState(null);function c(m){l(m),setTimeout(()=>l(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await RB(m),c({type:"success",message:`Terminal set to ${_u[m]}.`})}catch(h){c({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function p(){s(!0);try{const m=await AB();c({type:"success",message:`Reset to OS default (${_u[m.terminal]}).`})}catch(m){c({type:"error",message:m instanceof Error?m.message:"Reset failed."})}finally{s(!1)}}return r.jsxs(We,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${_u[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:p,disabled:n,type:"button",children:[r.jsx(io,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[a&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${a.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:a.message}),r.jsxs("label",{className:"block text-sm",children:[r.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Launch in"}),r.jsx("select",{value:e,onChange:m=>u(m.target.value),disabled:n,className:"w-full max-w-sm rounded-md border border-border/60 bg-background px-3 py-1.5 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:vC.map(m=>r.jsx("option",{value:m,children:_u[m]},m))})]})]})}function Cl(e){return e===ld?"Ungrouped":e}function $B(){const{data:e,loading:t,error:n,refetch:s}=oc(),{hidden:a,custom:l,loading:c,error:u,reload:p}=Ik(),[m,h]=f.useState(!1),[g,y]=f.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const C=e?[...e.workspaces,...e.hasUngrouped?[ld]:[]]:[];async function j(k,E){const N=E?a.filter(P=>P!==k):[...a,k];h(!0);try{await aD(N),b({type:"success",message:E?`Showing "${Cl(k)}" in the left nav.`:`Hiding "${Cl(k)}" from the left nav.`})}catch(P){b({type:"error",message:P instanceof Error?P.message:"Save failed."})}finally{h(!1)}}async function w(){h(!0);try{await iD(),b({type:"success",message:"All workspaces shown in the left nav."})}catch(k){b({type:"error",message:k instanceof Error?k.message:"Reset failed."})}finally{h(!1)}}return r.jsxs(We,{title:"Workspace visibility",description:"Choose which workspaces appear in the left nav. Hidden workspaces stay fully reachable by direct URL — this only controls the sidebar.",actions:l?r.jsxs("button",{className:"shell-action text-xs",onClick:w,disabled:m,type:"button",children:[r.jsx(io,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[g&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),t||c?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||u?r.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[r.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&s(),u&&p()},children:[r.jsx(io,{className:"h-3 w-3"}),"Retry"]})]}):C.length===0?r.jsx("div",{className:"text-sm text-muted-foreground",children:"No workspaces yet."}):r.jsx("ul",{className:"flex flex-col divide-y divide-border/40",children:C.map(k=>{const E=!rD(k,a);return r.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("span",{className:"truncate text-sm",title:Cl(k),children:[Cl(k),k===ld&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":E,"aria-label":`Show "${Cl(k)}" in the left nav`,onClick:()=>j(k,!E),disabled:m,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-60 ${E?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${E?"translate-x-4":"translate-x-0"}`})})]},k)})})]})}function jC(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function sh(e){const t=e.statuses.map(n=>({rowKey:jC(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return aB(t,e.order)}function LB({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:a,listeners:l,setNodeRef:c,setActivatorNodeRef:u,transform:p,transition:m,isDragging:h}=pC({id:e.rowKey}),g={transform:hi.Transform.toString(p),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0};return r.jsxs("div",{ref:c,style:g,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${h?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:u,...a,...l,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(d0,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsx("input",{type:"text",value:e.id,readOnly:!0,"aria-label":"Status ID",className:"editor-input w-full text-sm cursor-not-allowed opacity-60"})}),r.jsx(gr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:"To rename a saved status, delete the row and create a new one (this triggers the orphan-resolution flow if assignments still reference it)."})]}):r.jsx("input",{type:"text",value:e.id,onChange:y=>n("id",y.target.value),"aria-label":"Status ID",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:r.jsx("input",{type:"text",value:e.label,onChange:y=>n("label",y.target.value),"aria-label":"Status label",className:"editor-input w-full text-sm"})}),r.jsx(tB,{value:e.color,onChange:y=>n("color",y),ariaLabel:`Color for ${e.label||e.id}`}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(gr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:'When enabled, assignments in this status count as finished — they fill the "done" portion of progress bars and satisfy dependency requirements.'})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":e.terminal,"aria-label":`Done state for ${e.label||e.id}`,onClick:()=>n("terminal",!e.terminal),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background ${e.terminal?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${e.terminal?"translate-x-4":"translate-x-0"}`})})]}),r.jsx("button",{type:"button",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",onClick:s,title:"Remove status","aria-label":`Remove status ${e.id}`,children:r.jsx(or,{className:"h-3.5 w-3.5"})})]})}function OB(){var ge;const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(!1),[c,u]=f.useState([]),[p,m]=f.useState(!1),[h,g]=f.useState(null),[y,b]=f.useState(!1),[C,j]=f.useState(new Set),[w,k]=f.useState(new Map),[E,N]=f.useState({open:!1}),P=VN(jd(yf,{activationConstraint:{distance:8}}),jd(xf,{coordinateGetter:Zz})),{preset:$,setPreset:T,resetPreset:D}=ug(),[O,J]=f.useState(!1),[V,L]=f.useState(null);async function W(U){if(!(U===$||O)){J(!0),L(null);try{await T(U),L({type:"success",message:"Theme updated"}),setTimeout(()=>L(null),2e3)}catch(ae){L({type:"error",message:ae instanceof Error?ae.message:"Failed to save theme"})}finally{J(!1)}}}async function oe(){J(!0),L(null);try{await D(),L({type:"success",message:"Theme reset to default"}),setTimeout(()=>L(null),2e3)}catch(U){L({type:"error",message:U instanceof Error?U.message:"Failed to reset theme"})}finally{J(!1)}}const z=f.useCallback(async()=>{try{const U=await fetch("/api/config/statuses");if(!U.ok)throw new Error(`HTTP ${U.status}`);const ae=await U.json(),me=sh(ae);u(me),l(ae.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),s(null)}catch(U){s(U instanceof Error?U.message:"Failed to load config")}finally{t(!1)}},[]);f.useEffect(()=>{z()},[z]);function H(){setTimeout(()=>g(null),3e3)}async function ee(){m(!0),g(null);try{const{body:U}=oB({statuses:c,order:c.map(he=>he.id),pendingResolutions:w}),ae=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)});if(!ae.ok){const he=await ae.json().catch(()=>null);if(ae.status===409&&(he==null?void 0:he.error)==="unresolved-orphans"){const Je=Array.isArray(he.unresolved)?he.unresolved.map(Ye=>Ye.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${Je}. Click the trash icon on each row to choose remap or delete.`)}if(ae.status===409&&(he==null?void 0:he.error)==="concurrent-edit"){const Je=he.applied?` (${he.applied.remapped} remapped, ${he.applied.deleted} deleted before the conflict)`:"";g({type:"error",message:`Concurrent edit detected${Je}: ${he.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await z();return}if(ae.status===500&&(he==null?void 0:he.error)==="config-write-failed"&&(he!=null&&he.applied)){const{remapped:Je,deleted:Ye}=he.applied,ot=he.message?`: ${he.message}`:"";g({type:"error",message:`Resolutions applied (${Je} remapped, ${Ye} deleted) but the status config write failed${ot}. Click Save again to retry.`}),await z();return}throw(he==null?void 0:he.error)==="invalid-remap-target"?new Error(`Invalid remap target (${he.reason}): ${he.id} → ${he.target}.`):(he==null?void 0:he.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(he.ids??[]).join(", ")}`):(he==null?void 0:he.error)==="stale-resolution"?new Error(`Stale resolution for id "${he.id??"?"}".`):(he==null?void 0:he.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${he.message??"unknown"}`):(he==null?void 0:he.error)==="remap-write-failed"||(he==null?void 0:he.error)==="delete-failed"||(he==null?void 0:he.error)==="scan-failed"?new Error(`${he.error}: ${he.cause??"unknown"}`):new Error((he==null?void 0:he.error)??`Save failed (HTTP ${ae.status})`)}const me=await ae.json(),ve=sh(me);u(ve),l(me.custom),j(new Set(ve.map(he=>he.id))),k(new Map),b(!1),ew();const ke=me.applied?` (${me.applied.remapped} remapped, ${me.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${ke}`}),H()}catch(U){g({type:"error",message:U instanceof Error?U.message:"Save failed"})}finally{m(!1)}}async function ne(){m(!0),g(null);try{const U=await fetch("/api/config/statuses",{method:"DELETE"});if(!U.ok)throw new Error("Reset failed");const ae=await U.json(),me=sh(ae);u(me),l(ae.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),ew(),g({type:"success",message:"Reset to defaults"}),H()}catch(U){g({type:"error",message:U instanceof Error?U.message:"Reset failed"})}finally{m(!1)}}function M(U,ae,me){u(ve=>{const ke=[...ve];return ke[U]={...ke[U],[ae]:me},ke}),b(!0)}function q(){const U=`status_${c.length+1}`;u(ae=>[...ae,{rowKey:jC(),id:U,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function A(U){u(ae=>{const me=ae.filter(ke=>ke.id!==U),ve=new Set(me.map(ke=>ke.id));return k(ke=>$j(ke,ve)),me}),b(!0)}async function F(U){const ae=c[U].id;if(!C.has(ae)){A(ae);return}try{const me=await fetch(`/api/config/statuses/affected/${encodeURIComponent(ae)}`);if(!me.ok)throw new Error(`HTTP ${me.status}`);const ve=await me.json();if(ve.count===0){A(ae);return}N({open:!0,affected:ve,pendingId:ae})}catch(me){g({type:"error",message:`Could not check affected assignments for "${ae}": ${me instanceof Error?me.message:String(me)}`})}}function Z(U){if(!E.open)return;const{pendingId:ae}=E;if(ae!==U.id){N({open:!1});return}if(!c.some(me=>me.id===ae)){g({type:"error",message:`Row for "${ae}" was already removed — modal action ignored.`}),N({open:!1});return}u(me=>{const ve=me.filter(he=>he.id!==ae),ke=new Set(ve.map(he=>he.id));return k(he=>{const Je=$j(he,ke),Ye=new Map(Je);return Ye.set(ae,U),Ye}),ve}),b(!0),N({open:!1})}function I(){N({open:!1})}function de(U){const{active:ae,over:me}=U;!me||ae.id===me.id||(u(ve=>{const ke=ve.findIndex(Je=>Je.rowKey===ae.id),he=ve.findIndex(Je=>Je.rowKey===me.id);return ke===-1||he===-1?ve:wf(ve,ke,he)}),b(!0))}return e?r.jsx(mt,{label:"Loading settings..."}):n?r.jsx(wt,{error:n}):r.jsx(Wo,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs(We,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:$!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:oe,disabled:O,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[V&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${V.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:V.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:T0.map(U=>{const ae=U.slug===$;return r.jsxs("button",{type:"button",onClick:()=>W(U.slug),disabled:O,"aria-pressed":ae,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${ae?"border-primary ring-2 ring-primary/40":"border-border/60 hover:border-primary/40"}`,children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.amber}}),ae&&r.jsx("span",{className:"ml-auto inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground",children:r.jsx(hs,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:U.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:U.description})]})]},U.slug)})})]}),r.jsx(iB,{}),r.jsx(DB,{}),r.jsx($B,{}),r.jsx(CB,{}),r.jsx(fB,{}),r.jsxs("div",{className:`flex items-center justify-between rounded-lg border px-4 py-3 text-sm ${a?"border-primary/30 bg-primary/5 text-primary":"border-border/60 bg-muted/30 text-muted-foreground"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ng,{className:"h-4 w-4"}),a?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:ne,disabled:p||!a&&!y,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset to Defaults"]})]}),h&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),r.jsx(We,{title:"Status Definitions",description:"Define the statuses assignments can have. Drag rows to set the display order used by Kanban columns, progress bars, and dropdowns.",actions:r.jsxs("button",{className:"shell-action text-xs",onClick:q,children:[r.jsx(rn,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(aC,{sensors:P,collisionDetection:qN,onDragEnd:de,children:r.jsx(dC,{items:c.map(U=>U.rowKey),strategy:lC,children:r.jsx("div",{className:"space-y-2",children:c.map((U,ae)=>r.jsx(LB,{row:U,isSaved:C.has(U.id),onUpdate:(me,ve)=>M(ae,me,ve),onRemove:()=>F(ae)},U.rowKey))})})})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:ee,disabled:p||!y,children:[r.jsx(Id,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),z()},disabled:p,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]})]}),r.jsx(rB,{}),E.open&&r.jsx(sB,{open:E.open,affected:{...E.affected,label:((ge=c.find(U=>U.id===E.affected.id))==null?void 0:ge.label)??E.affected.id},remaining:c.filter(U=>U.id!==E.affected.id&&C.has(U.id)).map(U=>({id:U.id,label:U.label})),onResolve:Z,onCancel:I})]})})}const Ts=e=>`${e.workspace}::${e.id}`;function Lj(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function IB(){var lt;const{data:e,loading:t,error:n,refetch:s}=H0(),a=Dt(),[l,c]=f.useState(""),u=f.useRef(null);mo("list:todos");const[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(""),[C,j]=f.useState("_global"),[w,k]=f.useState(null),[E,N]=f.useState(null),[P,$]=f.useState(new Set),[T,D]=f.useState(!1),O=f.useRef(null),[J,V]=f.useState(null),L=hx("all"),[W,oe]=f.useState(null),[z,H]=f.useState(null),ee=f.useRef(null);f.useEffect(()=>{let te=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const Le=await be.json();te||V(Le.filter(it=>!it.archived))}catch{}})(),()=>{te=!0}},[]);function ne(te,be){te.stopPropagation(),navigator.clipboard.writeText(be),k(be),setTimeout(()=>k(Le=>Le===be?null:Le),1500)}const M=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const te=[];for(const be of e.workspaces)for(const Le of be.items)te.push({...Le,workspace:be.workspace});return te},[e]),q=f.useMemo(()=>{const te=new Set;for(const be of M)for(const Le of be.tags)te.add(Le);return Array.from(te).sort()},[M]),A=f.useMemo(()=>{let te=M;if(l.trim()){const be=l.toLowerCase();te=te.filter(Le=>Le.description.toLowerCase().includes(be)||Le.tags.some(it=>it.toLowerCase().includes(be))||Le.id.includes(be))}return p&&(te=te.filter(be=>be.status===p)),h&&(te=te.filter(be=>be.tags.includes(h))),te},[M,l,p,h]);f.useEffect(()=>{$(new Set),O.current=null},[l,p,h]);const F=f.useMemo(()=>A.filter(te=>P.has(Ts(te))),[A,P]),Z=A.length>0&&F.length===A.length,I=F.length>0&&!Z,de=f.useMemo(()=>{if(F.length===0)return null;const te=new Set(F.map(be=>be.workspace));return te.size===1?[...te][0]:null},[F]),ge=f.useMemo(()=>{if(!de||!J)return;const te=J.filter(be=>be.workspace===de);return te.length===1?te[0].slug:void 0},[de,J]),U=((lt=F[0])==null?void 0:lt.description)??"",ae=f.useMemo(()=>{if(de)return null;const te=new Map;for(const be of F)te.has(be.workspace)||te.set(be.workspace,[]),te.get(be.workspace).push(be.id);return Array.from(te,([be,Le])=>({workspace:be,todoIds:Le}))},[F,de]),me=de?{kind:"workspace",workspace:de}:{kind:"aggregate",groups:ae??[]};function ve(te,be,Le){const it=Ts(te),_e=!!(Le&&"shiftKey"in Le&&Le.shiftKey),bt=O.current?nt.findIndex(_t=>Ts(_t)===O.current):-1;if(_e&&bt!==-1){const _t=Math.min(bt,be),Gt=Math.max(bt,be);$(ue=>{const Be=new Set(ue);for(let Fe=_t;Fe<=Gt;Fe++){const Nt=nt[Fe];Nt&&Be.add(Ts(Nt))}return Be})}else $(_t=>{const Gt=new Set(_t);return Gt.has(it)?Gt.delete(it):Gt.add(it),Gt});O.current=it}function ke(){$(te=>{const be=new Set(te);if(Z)for(const Le of A)be.delete(Ts(Le));else for(const Le of A)be.add(Ts(Le));return be})}function he(){$(new Set),O.current=null}function Je(te){he(),s(),te!=null&&te.assignmentRef&&a(Lj(te.assignmentRef))}const Ye=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const te={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const be of e.workspaces)te.open+=be.counts.open,te.in_progress+=be.counts.in_progress,te.completed+=be.counts.completed,te.blocked+=be.counts.blocked,te.total+=be.counts.total;return te},[e]);async function ot(){y.trim()&&(await fg(C,y.trim()),b(""),s())}async function Y(te,be,Le){switch(Le){case"open":await G0(te,be);break;case"in_progress":await q0(te,be);break;case"completed":await W0(te,be);break;case"blocked":await K0(te,be);break}s()}async function Ie(te,be){await Y0(te,be),s()}async function Se(te,be,Le){await J0(te,be,Le),s()}async function Oe(te,be,Le){await X0(te,be,Le),s()}async function Xe(te,be,Le){await Q0(te,be,Le),s()}const Me=mx(A),nt=Me.filter(te=>!L.isCollapsed(te.config.id)).flatMap(te=>te.items),{hotkeyRowProps:Ke}=ac(nt,{scope:"list:todos",bindO:!1,onOpen:te=>N(Ts(te))});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var te;return(te=u.current)==null?void 0:te.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[gt,Pt]=ms(),at=gt.get("focus");f.useEffect(()=>{if(!at)return;const te=M.find(Le=>Le.id===at);if(!te)return;const be=lf(te.status);L.isCollapsed(be)&&L.toggle(be)},[at,M]),f.useEffect(()=>{if(!at)return;const te=document.querySelector(`[data-todo-id="${CSS.escape(at)}"]`);if(!te)return;te.scrollIntoView({block:"nearest"}),te.classList.add("ring-2","ring-primary/60");const be=window.setTimeout(()=>{te.classList.remove("ring-2","ring-primary/60"),Pt(Le=>{const it=new URLSearchParams(Le);return it.delete("focus"),it})},1500);return()=>window.clearTimeout(be)},[at,nt.length,Pt]);const ie=W?A.find(te=>Ts(te)===W)??null:null;function G(te,be){const Le=ee.current;if(Le!=null&&Le.closest(mi)){te.preventDefault();return}te.dataTransfer.effectAllowed="move",te.dataTransfer.setData("text/plain",be),oe(be)}function pe(){oe(null),H(null)}function Q(te,be){!ie||be.statuses.includes(ie.status)||(te.preventDefault(),te.dataTransfer.dropEffect="move",H(be.id))}function ye(te,be){z===be.id&&!te.currentTarget.contains(te.relatedTarget)&&H(null)}function Re(te,be){te.preventDefault();const Le=ie;pe(),!(!Le||be.statuses.includes(Le.status))&&Y(Le.workspace,Le.id,be.dropStatus)}return t?r.jsx(mt,{label:"Loading todos..."}):n?r.jsx(wt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(An,{label:"Open",value:Ye.open,icon:Ar}),r.jsx(An,{label:"In Progress",value:Ye.in_progress,icon:rg,tone:"info"}),r.jsx(An,{label:"Blocked",value:Ye.blocked,icon:ag,tone:"warn"}),r.jsx(An,{label:"Completed",value:Ye.completed,icon:Ar,tone:"default"})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("select",{value:C,onChange:te=>j(te.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"_global",children:"Global"}),e==null?void 0:e.workspaces.filter(te=>te.workspace!=="_global").map(te=>r.jsx("option",{value:te.workspace,children:te.workspace},te.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:te=>b(te.target.value),onKeyDown:te=>te.key==="Enter"&&ot(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:ot,disabled:!y.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(rn,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:u,type:"text",placeholder:"Search todos...",value:l,onChange:te=>c(te.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:p,onChange:te=>m(te.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),q.length>0&&r.jsxs("select",{value:h,onChange:te=>g(te.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),q.map(te=>r.jsxs("option",{value:te,children:["#",te]},te))]})]}),F.length>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[F.length," selected",de?r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",r.jsx("strong",{children:de}),")"]}):r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(F.map(te=>te.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>D(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:he,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,A.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:Z,ref:te=>{te&&(te.indeterminate=I)},onChange:ke,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",A.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let te=-1;return Me.map(({config:be,items:Le})=>{const it=!L.isCollapsed(be.id);return r.jsx(px,{label:be.label,count:Le.length,expanded:it,onToggle:()=>L.toggle(be.id),isDropTarget:z===be.id,onDragOver:_e=>Q(_e,be),onDragLeave:_e=>ye(_e,be),onDrop:_e=>Re(_e,be),children:it&&Le.map(_e=>{te+=1;const bt=te,_t=Ts(_e),Gt=P.has(_t);return r.jsxs("div",{draggable:!0,"data-todo-id":_e.id,...Ke(bt),onMouseDown:ue=>{ee.current=ue.target},onDragStart:ue=>G(ue,_t),onDragEnd:pe,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${Gt?"ring-1 ring-foreground/20":""} ${W===_t?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${_e.id}`,title:"Select",checked:Gt,onChange:()=>{},onClick:ue=>{ue.stopPropagation(),ve(_e,bt,ue)},className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(QS,{status:_e.status,onChange:ue=>Y(_e.workspace,_e.id,ue)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[r.jsx(eN,{description:_e.description,status:_e.status,editing:E===_t,onBeginEdit:()=>N(_t),onEndEdit:()=>N(null),onSave:ue=>Se(_e.workspace,_e.id,ue)}),_e.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:_e.tags.map(ue=>`#${ue}`).join(" ")}),_e.linkedAssignmentRef?r.jsxs(Ee,{to:Lj(_e.linkedAssignmentRef),"data-no-drag":!0,className:"inline-flex items-center gap-0.5 rounded-full border border-status-completed-foreground/40 bg-status-completed/30 px-1.5 py-0.5 text-[10px] font-mono text-status-completed-foreground hover:bg-status-completed/50",onClick:ue=>ue.stopPropagation(),children:[r.jsx(o0,{className:"h-2.5 w-2.5"}),_e.linkedAssignmentRef.includes("/")?_e.linkedAssignmentRef:`oneoff:${_e.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(tN,{item:_e,attachmentUrl:(ue,Be)=>pg(_e.workspace,ue,Be),onAdd:ue=>Oe(_e.workspace,_e.id,ue),onDelete:ue=>Xe(_e.workspace,_e.id,ue)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:_e.workspace!=="_global"&&r.jsx(Ee,{to:`/w/${_e.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:ue=>ue.stopPropagation(),children:_e.workspace})}),w===_e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(hs,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:ue=>ne(ue,_e.id),children:["t:",_e.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:ue=>ne(ue,_e.id),children:r.jsx(rd,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:ue=>{ue.stopPropagation(),Ie(_e.workspace,_e.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${_e.workspace}-${_e.id}`)})},be.id)})})()}),r.jsx(fx,{open:T,selectedIds:F.map(te=>te.id),scope:me,onOpenChange:D,onDone:Je,defaultProject:ge,defaultTitle:U,allowOneOff:!0})]})}const MB={open:{icon:"○",cls:"text-muted-foreground",label:"Open"},in_progress:{icon:"◉",cls:"text-status-in-progress-foreground",label:"In progress"},blocked:{icon:"✕",cls:"text-status-blocked-foreground",label:"Blocked"},completed:{icon:"✓",cls:"text-status-completed-foreground",label:"Completed"},mixed:{icon:"◐",cls:"text-muted-foreground",label:"Mixed"}};function _B({bundle:e}){const t=MB[e.derivedStatus.status],{counts:n}=e.derivedStatus;return r.jsxs("div",{className:"border rounded-md p-3 mb-2 bg-card",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:`text-lg leading-none ${t.cls}`,title:t.label,children:t.icon}),r.jsxs("span",{className:"font-mono text-sm text-muted-foreground",children:["b:",e.id]}),e.slug&&r.jsx("span",{className:"font-medium",children:e.slug}),r.jsxs("span",{className:"ml-auto text-sm text-muted-foreground",children:[n.completed,"/",n.total," done"]})]}),r.jsxs("div",{className:"mt-2 grid gap-1 text-sm",children:[e.branch&&r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Branch:"})," ",r.jsx("code",{className:"font-mono",children:e.branch})]}),e.worktreePath&&r.jsxs("div",{className:"text-muted-foreground truncate",children:[r.jsx("span",{className:"font-medium",children:"Worktree:"})," ",r.jsx("code",{className:"font-mono",children:e.worktreePath})]}),e.planDir&&r.jsxs("div",{className:"text-muted-foreground truncate",children:[r.jsx("span",{className:"font-medium",children:"Plan:"})," ",r.jsx("code",{className:"font-mono",children:e.planDir})]})]}),r.jsx("ul",{className:"mt-2 ml-6 text-sm list-disc",children:e.members.map(s=>r.jsxs("li",{className:s.status==="completed"?"line-through text-muted-foreground":"",children:[r.jsxs("span",{className:"font-mono text-xs text-muted-foreground mr-2",children:["t:",s.id]}),s.description]},s.id))})]})}function FB({bundles:e,title:t="Bundles"}){return e.length===0?null:r.jsxs("section",{className:"mb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:[t," (",e.length,")"]}),e.map(n=>r.jsx(_B,{bundle:n},n.id))]})}function zB(e){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch bundles")}finally{a(!1)}},[e]);return f.useEffect(()=>{u()},[u]),sc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function BB(){const{workspace:e}=$t(),t=e||"_global",{data:n,loading:s,error:a,refetch:l}=FR(t),{data:c}=zB(t),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,C]=f.useState(""),[j,w]=f.useState(null),[k,E]=f.useState(null),[N,P]=f.useState(new Set),[$,T]=f.useState(!1),[D,O]=f.useState(!1),[J,V]=f.useState(null),L=f.useRef(null);mo("list:todos");const W=hx("workspace:"+t),[oe,z]=f.useState(null),[H,ee]=f.useState(null),ne=f.useRef(null);function M(Q,ye){Q.stopPropagation(),navigator.clipboard.writeText(ye),w(ye),setTimeout(()=>w(Re=>Re===ye?null:Re),1500)}const q=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const Q=new Set;for(const ye of n.items)for(const Re of ye.tags)Q.add(Re);return Array.from(Q).sort()},[n]),A=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let Q=n.items;if(u.trim()){const ye=u.toLowerCase();Q=Q.filter(Re=>Re.description.toLowerCase().includes(ye)||Re.tags.some(lt=>lt.toLowerCase().includes(ye))||Re.id.includes(ye))}return m&&(Q=Q.filter(ye=>ye.status===m)),g&&(Q=Q.filter(ye=>ye.tags.includes(g))),Q},[n,u,m,g]);f.useEffect(()=>{P(new Set)},[u,m,g,t]);const F=f.useMemo(()=>A.filter(Q=>N.has(Q.id)).length,[A,N]),Z=A.length>0&&F===A.length,I=F>0&&!Z;function de(Q){P(ye=>{const Re=new Set(ye);return Re.has(Q)?Re.delete(Q):Re.add(Q),Re})}function ge(){P(Q=>{const ye=new Set(Q);if(Z)for(const Re of A)ye.delete(Re.id);else for(const Re of A)ye.add(Re.id);return ye})}function U(){P(new Set)}const ae=J?[J]:Array.from(N);function me(){P(new Set),V(null),l()}function ve(){P(new Set),l()}async function ke(){b.trim()&&(await fg(t,b.trim()),C(""),l())}async function he(Q,ye,Re){Q.stopPropagation(),window.confirm(`Delete "${Re}"? This can't be undone.`)&&(await Y0(t,ye),l())}async function Je(Q,ye){switch(ye){case"open":await G0(t,Q);break;case"in_progress":await q0(t,Q);break;case"completed":await W0(t,Q);break;case"blocked":await K0(t,Q);break}l()}async function Ye(Q,ye){await J0(t,Q,ye),l()}async function ot(Q,ye){await X0(t,Q,ye),l()}async function Y(Q,ye){await Q0(t,Q,ye),l()}const Ie=mx(A),Se=Ie.filter(Q=>!W.isCollapsed(Q.config.id)).flatMap(Q=>Q.items),{hotkeyRowProps:Oe}=ac(Se,{scope:"list:todos",bindO:!1,onOpen:Q=>E(Q.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Q;return(Q=L.current)==null?void 0:Q.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>l()});const[Xe,Me]=ms(),nt=Xe.get("focus");f.useEffect(()=>{if(!nt||!(n!=null&&n.items))return;const Q=n.items.find(Re=>Re.id===nt);if(!Q)return;const ye=lf(Q.status);W.isCollapsed(ye)&&W.toggle(ye)},[nt,n==null?void 0:n.items]),f.useEffect(()=>{if(!nt)return;const Q=document.querySelector(`[data-todo-id="${window.CSS.escape(nt)}"]`);if(!Q)return;Q.scrollIntoView({block:"nearest"}),Q.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{Q.classList.remove("ring-2","ring-primary/60"),Me(Re=>{const lt=new URLSearchParams(Re);return lt.delete("focus"),lt})},1500);return()=>window.clearTimeout(ye)},[nt,Se.length,Me]);const Ke=oe?(n==null?void 0:n.items.find(Q=>Q.id===oe))??null:null;function gt(Q,ye){const Re=ne.current;if(Re!=null&&Re.closest(mi)){Q.preventDefault();return}Q.dataTransfer.effectAllowed="move",Q.dataTransfer.setData("text/plain",ye),z(ye)}function Pt(){z(null),ee(null)}function at(Q,ye){!Ke||ye.statuses.includes(Ke.status)||(Q.preventDefault(),Q.dataTransfer.dropEffect="move",ee(ye.id))}function ie(Q,ye){H===ye.id&&!Q.currentTarget.contains(Q.relatedTarget)&&ee(null)}function G(Q,ye){Q.preventDefault();const Re=Ke;Pt(),!(!Re||ye.statuses.includes(Re.status))&&Je(Re.id,ye.dropStatus)}if(s)return r.jsx(mt,{label:"Loading todos..."});if(a)return r.jsx(wt,{error:a});const pe=(n==null?void 0:n.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(An,{label:"Open",value:pe.open,icon:Ar}),r.jsx(An,{label:"In Progress",value:pe.in_progress,icon:Ar,tone:"info"}),r.jsx(An,{label:"Blocked",value:pe.blocked,icon:ag,tone:"warn"}),r.jsx(An,{label:"Total",value:pe.total,icon:Ar})]}),c&&r.jsx(FB,{bundles:c.bundles}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:b,onChange:Q=>C(Q.target.value),onKeyDown:Q=>Q.key==="Enter"&&ke(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:ke,disabled:!b.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(rn,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:L,type:"text",placeholder:"Search...",value:u,onChange:Q=>p(Q.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:m,onChange:Q=>h(Q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),q.length>0&&r.jsxs("select",{value:g,onChange:Q=>y(Q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),q.map(Q=>r.jsxs("option",{value:Q,children:["#",Q]},Q))]})]}),N.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[N.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>T(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{V(null),O(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:U,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,A.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:Z,ref:Q=>{Q&&(Q.indeterminate=I)},onChange:ge,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",A.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let Q=-1;return Ie.map(({config:ye,items:Re})=>{const lt=!W.isCollapsed(ye.id);return r.jsx(px,{label:ye.label,count:Re.length,expanded:lt,onToggle:()=>W.toggle(ye.id),isDropTarget:H===ye.id,onDragOver:te=>at(te,ye),onDragLeave:te=>ie(te,ye),onDrop:te=>G(te,ye),children:lt&&Re.map(te=>(Q+=1,r.jsx(ZS,{item:te,copiedId:j,selected:N.has(te.id),editing:k===te.id,onBeginEdit:be=>E(be),onEndEdit:()=>E(null),onPatchDescription:Ye,onAddAttachments:ot,onDeleteAttachment:Y,attachmentUrl:(be,Le)=>pg(t,be,Le),onToggleSelected:be=>de(be),onMoveOne:(be,Le)=>{Le.stopPropagation(),V(be),O(!0)},onStatusChange:Je,onCopyId:M,onDelete:he,hotkeyRowProps:Oe(Q),onDragOrigin:be=>{ne.current=be.target},onDragStart:gt,onDragEnd:Pt,isDragging:oe===te.id},te.id)))},ye.id)})})()}),r.jsx(fx,{open:$,selectedIds:Array.from(N),scope:{kind:"workspace",workspace:t},onOpenChange:T,onDone:ve}),r.jsx(rN,{open:D,selectedIds:ae,scope:{kind:"workspace",workspace:t},onOpenChange:Q=>{O(Q),Q||V(null)},onDone:me})]})}function kC(){const{views:e}=Vd();async function t(a,l,c){const u=e.find(h=>h.id===a.id)??a,p=hN(c,u.workspace).config,m=jx(u.config,p,u.config);await $g(a.id,{name:l,config:m})}async function n(a){await Wd({name:`${a.name} (copy)`,workspace:a.workspace,config:a.config})}async function s(a){await WD(a.id)}return{submitEdit:t,duplicate:n,remove:s}}const Oj=80,UB={kanban:"Kanban",list:"List",table:"Table"},VB={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function SC({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:a}){const l=!!s,c=Zo(),u=ef(),{data:p}=Jo(),{data:m}=Md(),[h,g]=f.useState(""),[y,b]=f.useState(Wa.viewMode),[C,j]=f.useState([]),[w,k]=f.useState([]),[E,N]=f.useState([]),[P,$]=f.useState([]),[T,D]=f.useState([]),[O,J]=f.useState([]),[V,L]=f.useState("all"),[W,oe]=f.useState(null),[z,H]=f.useState(""),[ee,ne]=f.useState(Wa.sortField),[M,q]=f.useState(Wa.sortDirection),[A,F]=f.useState(!1),[Z,I]=f.useState(null);function de(){b(Wa.viewMode),j([]),k([]),N([]),$([]),D([]),J([]),L("all"),oe(null),H(""),ne(Wa.sortField),q(Wa.sortDirection)}f.useEffect(()=>{if(e)if(I(null),F(!1),s){const Y=s.config.filters;g(s.name),b(s.config.viewMode),j(tt(Y.status)),k(tt(Y.priority)),N(tt(Y.type)),$(tt(Y.project)),D(tt(Y.assignee)),J(tt(Y.tags)),L(Y.activity??"all"),oe(gN(Y.dateRange)),H(Y.search??""),ne(s.config.sortField),q(s.config.sortDirection)}else g(""),de()},[e,s]);const ge=Y=>Ie=>Y?Y==="_ungrouped"?Ie.projectWorkspace===null:Ie.projectWorkspace===Y:!0,U=f.useMemo(()=>{const Y=Se=>n?n==="_ungrouped"?Se.workspace===null:Se.workspace===n:!0,Ie=(p??[]).filter(Y);return[{value:"__standalone__",label:"No project"},...Ie.map(Se=>({value:Se.slug,label:Se.title}))]},[p,n]),ae=f.useMemo(()=>{const Y=new Set,Ie=ge(n);for(const Oe of(m==null?void 0:m.assignments)??[])Ie(Oe)&&Oe.assignee&&Y.add(Oe.assignee);const Se=[{value:"__unassigned__",label:"Unassigned"}];for(const Oe of Array.from(Y).sort())Se.push({value:Oe,label:Oe});return Se},[m,n]),me=f.useMemo(()=>{const Y=new Set,Ie=ge(n);for(const Se of(m==null?void 0:m.assignments)??[])if(Ie(Se))for(const Oe of Se.tags??[])Y.add(Oe);return Array.from(Y).sort().map(Se=>({value:Se,label:Se}))},[m,n]),ve=f.useMemo(()=>c.order.map(Y=>({value:Y,label:cc(c,Y)})),[c]),ke=f.useMemo(()=>nF.map(Y=>({value:Y,label:Y[0].toUpperCase()+Y.slice(1)})),[]),he=f.useMemo(()=>u.definitions.map(Y=>({value:Y.id,label:ii(u,Y.id)})),[u]),Je=Rg.map(Y=>({value:Y,label:UB[Y]})),Ye=h.trim(),ot=Ye.length>0&&Ye.length<=Oj;return r.jsx(ar,{open:e,onOpenChange:t,children:r.jsx(Kn,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async Y=>{if(Y.preventDefault(),!ot||A)return;F(!0),I(null);const Ie={viewMode:y,filters:{status:C,priority:w,type:E,project:P,assignee:T,tags:O,activity:V,dateRange:Xl(W),search:z},sortField:ee,sortDirection:M};try{await a(Ye,Ie)}catch(Se){I(Se instanceof Error?Se.message:String(Se)),F(!1)}},children:[r.jsx(Qr,{children:r.jsx(qn,{children:l?"Edit view":"Create view"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-view-name",children:"Name"}),r.jsx("input",{id:"create-view-name",type:"text",value:h,autoFocus:!0,required:!0,maxLength:Oj,onChange:Y=>g(Y.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"View mode"}),r.jsx(nf,{value:y,onChange:Y=>b(Y),options:Je})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ss,{label:"Status",children:r.jsx(Rn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:ve,value:C,onChange:j})}),r.jsx(ss,{label:"Priority",children:r.jsx(Rn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:ke,value:w,onChange:k})}),r.jsx(ss,{label:"Type",children:r.jsx(Rn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:he,value:E,onChange:N})}),r.jsx(ss,{label:"Project",children:r.jsx(Rn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:U,value:P,onChange:$})}),r.jsx(ss,{label:"Assignee",children:r.jsx(Rn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ae,value:T,onChange:D})}),r.jsx(ss,{label:"Tags",children:r.jsx(Rn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:me,value:O,onChange:J})}),r.jsx(ss,{label:"Activity",children:r.jsxs("select",{value:V,onChange:Y=>L(Y.target.value),className:"editor-input w-full",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(ss,{label:"Date range",children:r.jsx(wx,{className:"w-full",value:W,onChange:oe})}),r.jsx(ss,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:z,onChange:Y=>H(Y.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(ss,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:ee,onChange:Y=>ne(Y.target.value),className:"editor-input w-full",children:n1.map(Y=>r.jsx("option",{value:Y,children:VB[Y]},Y))}),r.jsx("button",{type:"button",onClick:()=>q(Y=>Y==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:M==="asc"?"Ascending":"Descending",children:M==="asc"?"Asc":"Desc"})]})})]}),Z?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:Z}):null,r.jsxs(Ls,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:de,className:"shell-action",disabled:A,children:"Clear all"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:A,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!ot||A,className:"shell-action shell-action--cta disabled:opacity-50",children:A?"Saving…":l?"Save changes":"Create view"})]})]})]})})})}function ss({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const HB={kanban:"Kanban",list:"List",table:"Table"};function Ij(){const{workspace:e}=$t(),{views:t,loading:n}=Vd(),{submitEdit:s,duplicate:a,remove:l}=kC(),{toast:c,showToast:u,dismissToast:p}=ta(),[m,h]=f.useState(null),[g,y]=f.useState(!1),[b,C]=f.useState(!1),[j,w]=f.useState(null);async function k(T,D){const{workspace:O,config:J}=hN(D,e??null);try{await Wd({name:T,workspace:O,config:J}),C(!1),u(`Created view "${T}"`)}catch(V){throw u(V instanceof Error?V.message:"Failed to create saved view"),V}}async function E(T,D,O){try{await s(T,D,O),w(null),u(`Updated view "${D}"`)}catch(J){throw u(J instanceof Error?J.message:"Failed to update saved view"),J}}async function N(T){try{await a(T),u(`Duplicated "${T.name}"`)}catch(D){u(D instanceof Error?D.message:"Failed to duplicate saved view")}}async function P(){if(m){y(!0);try{await l(m),h(null)}catch(T){u(T instanceof Error?T.message:"Failed to delete saved view")}finally{y(!1)}}}const $=r.jsxs("button",{type:"button",onClick:()=>C(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(rn,{className:"h-4 w-4"}),"Create view"]});return r.jsxs("div",{className:"space-y-4",children:[r.jsx(xd,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:$}),n?r.jsx(mt,{label:"Loading saved views…"}):t.length===0?r.jsx(St,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:$}):r.jsx(We,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(T=>r.jsx(WB,{view:T,onRequestDelete:()=>h(T),onRequestEdit:()=>w(T),onRequestDuplicate:()=>void N(T)},T.id))})}),r.jsx(SC,{open:b||j!==null,onOpenChange:T=>{T||(C(!1),w(null))},workspace:j?j.workspace:e??null,initialView:j,onSubmit:j?(T,D)=>E(j,T,D):k}),r.jsx(sa,{open:m!==null,title:"Delete saved view?",description:m?`Delete '${m.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:g,destructive:!0,onConfirm:P,onOpenChange:T=>{!T&&!g&&h(null)}}),r.jsx(na,{toast:c,onDismiss:p})]})}function WB({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const a=Dt(),l=()=>a(yN(e)),c=vN(e.config.filters),u=e.workspace?yn(e.workspace):null;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,className:"truncate text-left text-sm font-semibold text-foreground hover:text-primary",title:"Open view",children:e.name}),r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:HB[e.config.viewMode]}),u?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:u}):null]}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:c})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,className:"shell-action",children:"Open"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const KB={kanban:"Kanban",list:"List",table:"Table"};function Mj(){const{id:e,workspace:t}=$t(),n=Dt(),{view:s,ready:a,error:l,refetch:c}=Go(e),{submitEdit:u,duplicate:p,remove:m}=kC(),{toast:h,showToast:g,dismissToast:y}=ta(),[b,C]=f.useState(!1),[j,w]=f.useState(!1),[k,E]=f.useState(!1);if(f.useEffect(()=>{!a||!s||(t??null)!==(s.workspace??null)&&n(yN(s),{replace:!0})},[a,s,t,n]),!a)return r.jsx(mt,{label:"Loading view…"});if(l)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-6 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:l.message}),r.jsx("button",{type:"button",onClick:()=>c(),className:"shell-action mt-3",children:"Retry"})]});if(!s)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(xd,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ee,{to:Xu(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(td,{className:"h-4 w-4"})," Back to Saved Views"]})]});const N=s.workspace?yn(s.workspace):null;async function P(D,O){const J=s;try{await u(J,D,O),C(!1),g(`Updated view "${D}"`)}catch(V){throw g(V instanceof Error?V.message:"Failed to update saved view"),V}}async function $(){const D=s;try{await p(D),g(`Duplicated "${D.name}"`)}catch(O){g(O instanceof Error?O.message:"Failed to duplicate saved view")}}async function T(){const D=s;E(!0);try{await m(D),w(!1),n(Xu(D.workspace))}catch(O){g(O instanceof Error?O.message:"Failed to delete saved view")}finally{E(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ee,{to:Xu(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(td,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(xd,{title:s.name,description:vN(s.config.filters),actions:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:KB[s.config.viewMode]}),N?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:N}):null,r.jsx("button",{type:"button",onClick:()=>C(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void $(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(bN(s)),className:"shell-action",children:"Open on board"}),r.jsx("button",{type:"button",onClick:()=>w(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),r.jsx(K1,{view:s}),b?r.jsx(SC,{open:b,onOpenChange:C,workspace:s.workspace,initialView:s,onSubmit:P}):null,r.jsx(sa,{open:j,title:"Delete saved view?",description:`Delete '${s.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:k,destructive:!0,onConfirm:T,onOpenChange:D=>{!D&&!k&&w(!1)}}),r.jsx(na,{toast:h,onDismiss:y})]})}function qB(){return r.jsx(MT,{children:r.jsx(Q3,{children:r.jsx(fT,{children:r.jsxs(He,{element:r.jsx(ED,{}),children:[r.jsx(He,{path:"/",element:r.jsx(hL,{})}),r.jsx(He,{path:"/projects",element:r.jsx(rw,{})}),r.jsx(He,{path:"/archive",element:r.jsx(AL,{})}),r.jsx(He,{path:"/assignments",element:r.jsx(cj,{})}),r.jsx(He,{path:"/assignments/new",element:r.jsx(pj,{})}),r.jsx(He,{path:"/assignments/:id",element:r.jsx(RF,{})}),r.jsx(He,{path:"/assignments/:id/edit",element:r.jsx(Ym,{})}),r.jsx(He,{path:"/assignments/:id/plan/edit",element:r.jsx(Jm,{})}),r.jsx(He,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(Xm,{})}),r.jsx(He,{path:"/assignments/:id/handoff/edit",element:r.jsx(Qm,{})}),r.jsx(He,{path:"/assignments/:id/decision-record/edit",element:r.jsx(Zm,{})}),r.jsx(He,{path:"/servers",element:r.jsx(hj,{})}),r.jsx(He,{path:"/inventories",element:r.jsx(gj,{})}),r.jsx(He,{path:"/usage",element:r.jsx(xj,{})}),r.jsx(He,{path:"/agent-sessions",element:r.jsx(yj,{})}),r.jsx(He,{path:"/playbooks",element:r.jsx(l6,{})}),r.jsx(He,{path:"/playbooks/create",element:r.jsx(u6,{})}),r.jsx(He,{path:"/playbooks/:slug",element:r.jsx(c6,{})}),r.jsx(He,{path:"/playbooks/:slug/edit",element:r.jsx(d6,{})}),r.jsx(He,{path:"/memories",element:r.jsx(f6,{})}),r.jsx(He,{path:"/memories/new",element:r.jsx(m6,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(p6,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(h6,{})}),r.jsx(He,{path:"/resources",element:r.jsx(g6,{})}),r.jsx(He,{path:"/resources/new",element:r.jsx(y6,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(x6,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(b6,{})}),r.jsx(He,{path:"/todos",element:r.jsx(IB,{})}),r.jsx(He,{path:"/views",element:r.jsx(Ij,{})}),r.jsx(He,{path:"/views/:id",element:r.jsx(Mj,{})}),r.jsx(He,{path:"/help",element:r.jsx(xL,{})}),r.jsx(He,{path:"/settings",element:r.jsx(OB,{})}),r.jsx(He,{path:"/create/project",element:r.jsx(dj,{})}),r.jsx(He,{path:"/projects/:slug",element:r.jsx(sj,{})}),r.jsx(He,{path:"/projects/:slug/edit",element:r.jsx(mj,{})}),r.jsx(He,{path:"/projects/:slug/create/assignment",element:r.jsx(fj,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(aj,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(Ym,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Jm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Xm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Qm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Zm,{})}),r.jsx(He,{path:"/w/:workspace/projects",element:r.jsx(rw,{})}),r.jsx(He,{path:"/w/:workspace/assignments",element:r.jsx(cj,{})}),r.jsx(He,{path:"/w/:workspace/assignments/new",element:r.jsx(pj,{})}),r.jsx(He,{path:"/w/:workspace/servers",element:r.jsx(hj,{})}),r.jsx(He,{path:"/w/:workspace/inventories",element:r.jsx(gj,{})}),r.jsx(He,{path:"/w/:workspace/usage",element:r.jsx(xj,{})}),r.jsx(He,{path:"/w/:workspace/agent-sessions",element:r.jsx(yj,{})}),r.jsx(He,{path:"/w/:workspace/todos",element:r.jsx(BB,{})}),r.jsx(He,{path:"/w/:workspace/views",element:r.jsx(Ij,{})}),r.jsx(He,{path:"/w/:workspace/views/:id",element:r.jsx(Mj,{})}),r.jsx(He,{path:"/w/:workspace/create/project",element:r.jsx(dj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug",element:r.jsx(sj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(mj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(fj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(aj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(Ym,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Jm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Xm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Qm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Zm,{})})]})})})})}gR();f2.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(xR,{children:r.jsx(qB,{})})}));export{nO as _,YB as a,Td as g};
|
|
566
|
+
`},D6={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function $6(e){let{announcements:t=D6,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=A6}=e;const{announce:l,announcement:c}=T6(),u=gc("DndLiveRegion"),[p,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),P6(f.useMemo(()=>({onDragStart(g){let{active:y}=g;l(t.onDragStart({active:y}))},onDragMove(g){let{active:y,over:b}=g;t.onDragMove&&l(t.onDragMove({active:y,over:b}))},onDragOver(g){let{active:y,over:b}=g;l(t.onDragOver({active:y,over:b}))},onDragEnd(g){let{active:y,over:b}=g;l(t.onDragEnd({active:y,over:b}))},onDragCancel(g){let{active:y,over:b}=g;l(t.onDragCancel({active:y,over:b}))}}),[l,t])),!p)return null;const h=nn.createElement(nn.Fragment,null,nn.createElement(C6,{id:s,value:a.draggable}),nn.createElement(E6,{id:u,announcement:c}));return n?Ps.createPortal(h,n):h}var bn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(bn||(bn={}));function wd(){}function jd(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function VN(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const Yr=Object.freeze({x:0,y:0});function HN(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function WN(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function L6(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function vj(e){let{left:t,top:n,height:s,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+s},{x:t+a,y:n+s}]}function KN(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wj(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const qN=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=wj(t,t.left,t.top),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=HN(wj(p),a);l.push({id:u,data:{droppableContainer:c,value:m}})}}return l.sort(WN)},O6=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=vj(t),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=vj(p),h=a.reduce((y,b,C)=>y+HN(m[C],b),0),g=Number((h/4).toFixed(4));l.push({id:u,data:{droppableContainer:c,value:g}})}}return l.sort(WN)};function I6(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),c=a-s,u=l-n;if(s<a&&n<l){const p=t.width*t.height,m=e.width*e.height,h=c*u,g=h/(p+m-h);return Number(g.toFixed(4))}return 0}const M6=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=[];for(const l of s){const{id:c}=l,u=n.get(c);if(u){const p=I6(u,t);p>0&&a.push({id:c,data:{droppableContainer:l,value:p}})}}return a.sort(L6)};function _6(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function GN(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Yr}function F6(e){return function(n){for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l<s;l++)a[l-1]=arguments[l];return a.reduce((c,u)=>({...c,top:c.top+e*u.y,bottom:c.bottom+e*u.y,left:c.left+e*u.x,right:c.right+e*u.x}),{...n})}}const z6=F6(1);function B6(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function U6(e,t,n){const s=B6(t);if(!s)return e;const{scaleX:a,scaleY:l,x:c,y:u}=s,p=e.left-c-(1-a)*parseFloat(n),m=e.top-u-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),h=a?e.width/a:e.width,g=l?e.height/l:e.height;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p}}const V6={ignoreTransform:!1};function Ri(e,t){t===void 0&&(t=V6);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=lr(e).getComputedStyle(e);m&&(n=U6(n,m,h))}const{top:s,left:a,width:l,height:c,bottom:u,right:p}=n;return{top:s,left:a,width:l,height:c,bottom:u,right:p}}function jj(e){return Ri(e,{ignoreTransform:!0})}function H6(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function W6(e,t){return t===void 0&&(t=lr(e).getComputedStyle(e)),t.position==="fixed"}function K6(e,t){t===void 0&&(t=lr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const l=t[a];return typeof l=="string"?n.test(l):!1})}function gf(e,t){const n=[];function s(a){if(t!=null&&n.length>=t||!a)return n;if(Ex(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!mc(a)||zN(a)||n.includes(a))return n;const l=lr(e).getComputedStyle(a);return a!==e&&K6(a,l)&&n.push(a),W6(a,l)?n:s(a.parentNode)}return e?s(e):n}function YN(e){const[t]=gf(e,1);return t??null}function th(e){return!hf||!e?null:Ti(e)?e:Cx(e)?Ex(e)||e===Pi(e).scrollingElement?window:mc(e)?e:null:null}function JN(e){return Ti(e)?e.scrollX:e.scrollLeft}function XN(e){return Ti(e)?e.scrollY:e.scrollTop}function zh(e){return{x:JN(e),y:XN(e)}}var En;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(En||(En={}));function QN(e){return!hf||!e?!1:e===document.scrollingElement}function ZN(e){const t={x:0,y:0},n=QN(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,c=e.scrollTop>=s.y,u=e.scrollLeft>=s.x;return{isTop:a,isLeft:l,isBottom:c,isRight:u,maxScroll:s,minScroll:t}}const q6={x:.2,y:.2};function G6(e,t,n,s,a){let{top:l,left:c,right:u,bottom:p}=n;s===void 0&&(s=10),a===void 0&&(a=q6);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=ZN(e),b={x:0,y:0},C={x:0,y:0},j={height:t.height*a.y,width:t.width*a.x};return!m&&l<=t.top+j.height?(b.y=En.Backward,C.y=s*Math.abs((t.top+j.height-l)/j.height)):!h&&p>=t.bottom-j.height&&(b.y=En.Forward,C.y=s*Math.abs((t.bottom-j.height-p)/j.height)),!y&&u>=t.right-j.width?(b.x=En.Forward,C.x=s*Math.abs((t.right-j.width-u)/j.width)):!g&&c<=t.left+j.width&&(b.x=En.Backward,C.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:C}}function Y6(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:c}=window;return{top:0,left:0,right:l,bottom:c,width:l,height:c}}const{top:t,left:n,right:s,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:a,width:e.clientWidth,height:e.clientHeight}}function eC(e){return e.reduce((t,n)=>di(t,zh(n)),Yr)}function J6(e){return e.reduce((t,n)=>t+JN(n),0)}function X6(e){return e.reduce((t,n)=>t+XN(n),0)}function Q6(e,t){if(t===void 0&&(t=Ri),!e)return;const{top:n,left:s,bottom:a,right:l}=t(e);YN(e)&&(a<=0||l<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Z6=[["x",["left","right"],J6],["y",["top","bottom"],X6]];class Rx{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=gf(n),a=eC(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,c,u]of Z6)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=u(s),h=a[l]-m;return this.rect[p]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ml{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var a;(a=this.target)==null||a.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function ez(e){const{EventTarget:t}=lr(e);return e instanceof t?e:Pi(e)}function nh(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Er;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Er||(Er={}));function kj(e){e.preventDefault()}function tz(e){e.stopPropagation()}var ht;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(ht||(ht={}));const tC={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter,ht.Tab]},nz=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ht.Right:return{...n,x:n.x+25};case ht.Left:return{...n,x:n.x-25};case ht.Down:return{...n,y:n.y+25};case ht.Up:return{...n,y:n.y-25}}};class xf{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ml(Pi(n)),this.windowListeners=new Ml(lr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Er.Resize,this.handleCancel),this.windowListeners.add(Er.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Er.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&Q6(s),n(Yr)}handleKeyDown(t){if(Px(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:l=tC,coordinateGetter:c=nz,scrollBehavior:u="smooth"}=a,{code:p}=t;if(l.end.includes(p)){this.handleEnd(t);return}if(l.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=s.current,h=m?{x:m.left,y:m.top}:Yr;this.referenceCoordinates||(this.referenceCoordinates=h);const g=c(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=Zl(g,h),b={x:0,y:0},{scrollableAncestors:C}=s.current;for(const j of C){const w=t.code,{isTop:k,isRight:E,isLeft:N,isBottom:P,maxScroll:$,minScroll:T}=ZN(j),D=Y6(j),O={x:Math.min(w===ht.Right?D.right-D.width/2:D.right,Math.max(w===ht.Right?D.left:D.left+D.width/2,g.x)),y:Math.min(w===ht.Down?D.bottom-D.height/2:D.bottom,Math.max(w===ht.Down?D.top:D.top+D.height/2,g.y))},J=w===ht.Right&&!E||w===ht.Left&&!N,V=w===ht.Down&&!P||w===ht.Up&&!k;if(J&&O.x!==g.x){const L=j.scrollLeft+y.x,W=w===ht.Right&&L<=$.x||w===ht.Left&&L>=T.x;if(W&&!y.y){j.scrollTo({left:L,behavior:u});return}W?b.x=j.scrollLeft-L:b.x=w===ht.Right?j.scrollLeft-$.x:j.scrollLeft-T.x,b.x&&j.scrollBy({left:-b.x,behavior:u});break}else if(V&&O.y!==g.y){const L=j.scrollTop+y.y,W=w===ht.Down&&L<=$.y||w===ht.Up&&L>=T.y;if(W&&!y.x){j.scrollTo({top:L,behavior:u});return}W?b.y=j.scrollTop-L:b.y=w===ht.Down?j.scrollTop-$.y:j.scrollTop-T.y,b.y&&j.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,di(Zl(g,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}xf.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=tC,onActivation:a}=t,{active:l}=n;const{code:c}=e.nativeEvent;if(s.start.includes(c)){const u=l.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function Sj(e){return!!(e&&"distance"in e)}function Nj(e){return!!(e&&"delay"in e)}class Ax{constructor(t,n,s){var a;s===void 0&&(s=ez(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:l}=t,{target:c}=l;this.props=t,this.events=n,this.document=Pi(c),this.documentListeners=new Ml(this.document),this.listeners=new Ml(s),this.windowListeners=new Ml(lr(c)),this.initialCoordinates=(a=Fh(l))!=null?a:Yr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Er.Resize,this.handleCancel),this.windowListeners.add(Er.DragStart,kj),this.windowListeners.add(Er.VisibilityChange,this.handleCancel),this.windowListeners.add(Er.ContextMenu,kj),this.documentListeners.add(Er.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Nj(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Sj(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:a}=this.props;a(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Er.Click,tz,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Er.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:a,props:l}=this,{onMove:c,options:{activationConstraint:u}}=l;if(!a)return;const p=(n=Fh(t))!=null?n:Yr,m=Zl(a,p);if(!s&&u){if(Sj(u)){if(u.tolerance!=null&&nh(m,u.tolerance))return this.handleCancel();if(nh(m,u.distance))return this.handleStart()}if(Nj(u)&&nh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),c(p)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===ht.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const rz={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class yf extends Ax{constructor(t){const{event:n}=t,s=Pi(n.target);super(t,rz,s)}}yf.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const sz={move:{name:"mousemove"},end:{name:"mouseup"}};var Bh;(function(e){e[e.RightClick=2]="RightClick"})(Bh||(Bh={}));class oz extends Ax{constructor(t){super(t,sz,Pi(t.event.target))}}oz.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Bh.RightClick?!1:(s==null||s({event:n}),!0)}}];const rh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class az extends Ax{constructor(t){super(t,rh)}static setup(){return window.addEventListener(rh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(rh.move.name,t)};function t(){}}}az.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:a}=n;return a.length>1?!1:(s==null||s({event:n}),!0)}}];var _l;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(_l||(_l={}));var kd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(kd||(kd={}));function iz(e){let{acceleration:t,activator:n=_l.Pointer,canScroll:s,draggingRect:a,enabled:l,interval:c=5,order:u=kd.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=cz({delta:g,disabled:!l}),[C,j]=w6(),w=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case _l.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case _l.DraggableRect:return a}},[n,a,p]),N=f.useRef(null),P=f.useCallback(()=>{const T=N.current;if(!T)return;const D=w.current.x*k.current.x,O=w.current.y*k.current.y;T.scrollBy(D,O)},[]),$=f.useMemo(()=>u===kd.TreeOrder?[...m].reverse():m,[u,m]);f.useEffect(()=>{if(!l||!m.length||!E){j();return}for(const T of $){if((s==null?void 0:s(T))===!1)continue;const D=m.indexOf(T),O=h[D];if(!O)continue;const{direction:J,speed:V}=G6(T,O,E,t,y);for(const L of["x","y"])b[L][J[L]]||(V[L]=0,J[L]=0);if(V.x>0||V.y>0){j(),N.current=T,C(P,c),w.current=V,k.current=J;return}}w.current={x:0,y:0},k.current={x:0,y:0},j()},[t,P,s,j,l,c,JSON.stringify(E),JSON.stringify(b),C,m,$,h,JSON.stringify(y)])}const lz={x:{[En.Backward]:!1,[En.Forward]:!1},y:{[En.Backward]:!1,[En.Forward]:!1}};function cz(e){let{delta:t,disabled:n}=e;const s=_h(t);return hc(a=>{if(n||!s||!a)return lz;const l={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[En.Backward]:a.x[En.Backward]||l.x===-1,[En.Forward]:a.x[En.Forward]||l.x===1},y:{[En.Backward]:a.y[En.Backward]||l.y===-1,[En.Forward]:a.y[En.Forward]||l.y===1}}},[n,t,s])}function uz(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return hc(a=>{var l;return t==null?null:(l=s??a)!=null?l:null},[s,t])}function dz(e,t){return f.useMemo(()=>e.reduce((n,s)=>{const{sensor:a}=s,l=a.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,s)}));return[...n,...l]},[]),[e,t])}var ec;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ec||(ec={}));var Uh;(function(e){e.Optimized="optimized"})(Uh||(Uh={}));const Cj=new Map;function fz(e,t){let{dragging:n,dependencies:s,config:a}=t;const[l,c]=f.useState(null),{frequency:u,measure:p,strategy:m}=a,h=f.useRef(e),g=w(),y=Ql(g),b=f.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(E=>E===null?k:E.concat(k.filter(N=>!E.includes(N))))},[y]),C=f.useRef(null),j=hc(k=>{if(g&&!n)return Cj;if(!k||k===Cj||h.current!==e||l!=null){const E=new Map;for(let N of e){if(!N)continue;if(l&&l.length>0&&!l.includes(N.id)&&N.rect.current){E.set(N.id,N.rect.current);continue}const P=N.node.current,$=P?new Rx(p(P),P):null;N.rect.current=$,$&&E.set(N.id,$)}return E}return k},[e,l,n,g,p]);return f.useEffect(()=>{h.current=e},[e]),f.useEffect(()=>{g||b()},[n,g]),f.useEffect(()=>{l&&l.length>0&&c(null)},[JSON.stringify(l)]),f.useEffect(()=>{g||typeof u!="number"||C.current!==null||(C.current=setTimeout(()=>{b(),C.current=null},u))},[u,g,b,...s]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:l!=null};function w(){switch(m){case ec.Always:return!1;case ec.BeforeDragging:return n;default:return!n}}}function nC(e,t){return hc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function pz(e,t){return nC(e,t)}function mz(e){let{callback:t,disabled:n}=e;const s=Tx(t),a=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(s)},[s,n]);return f.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function bf(e){let{callback:t,disabled:n}=e;const s=Tx(t),a=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(s)},[n]);return f.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function hz(e){return new Rx(Ri(e),e)}function Ej(e,t,n){t===void 0&&(t=hz);const[s,a]=f.useState(null);function l(){a(p=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=p??n)!=null?m:null}const h=t(e);return JSON.stringify(p)===JSON.stringify(h)?p:h})}const c=mz({callback(p){if(e)for(const m of p){const{type:h,target:g}=m;if(h==="childList"&&g instanceof HTMLElement&&g.contains(e)){l();break}}}}),u=bf({callback:l});return ps(()=>{l(),e?(u==null||u.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),c==null||c.disconnect())},[e]),s}function gz(e){const t=nC(e);return GN(e,t)}const Tj=[];function xz(e){const t=f.useRef(e),n=hc(s=>e?s&&s!==Tj&&e&&t.current&&e.parentNode===t.current.parentNode?s:gf(e):Tj,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function yz(e){const[t,n]=f.useState(null),s=f.useRef(e),a=f.useCallback(l=>{const c=th(l.target);c&&n(u=>u?(u.set(c,zh(c)),new Map(u)):null)},[]);return f.useEffect(()=>{const l=s.current;if(e!==l){c(l);const u=e.map(p=>{const m=th(p);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,zh(m)]):null}).filter(p=>p!=null);n(u.length?new Map(u):null),s.current=e}return()=>{c(e),c(l)};function c(u){u.forEach(p=>{const m=th(p);m==null||m.removeEventListener("scroll",a)})}},[a,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,c)=>di(l,c),Yr):eC(e):Yr,[e,t])}function Pj(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==Yr;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?Zl(e,n.current):Yr}function bz(e){f.useEffect(()=>{if(!hf)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function vz(e,t){return f.useMemo(()=>e.reduce((n,s)=>{let{eventName:a,handler:l}=s;return n[a]=c=>{l(c,t)},n},{}),[e,t])}function rC(e){return f.useMemo(()=>e?H6(e):null,[e])}const Rj=[];function wz(e,t){t===void 0&&(t=Ri);const[n]=e,s=rC(n?lr(n):null),[a,l]=f.useState(Rj);function c(){l(()=>e.length?e.map(p=>QN(p)?s:new Rx(t(p),p)):Rj)}const u=bf({callback:c});return ps(()=>{u==null||u.disconnect(),c(),e.forEach(p=>u==null?void 0:u.observe(p))},[e]),a}function jz(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return mc(t)?t:e}function kz(e){let{measure:t}=e;const[n,s]=f.useState(null),a=f.useCallback(m=>{for(const{target:h}of m)if(mc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),l=bf({callback:a}),c=f.useCallback(m=>{const h=jz(m);l==null||l.disconnect(),h&&(l==null||l.observe(h)),s(h?t(h):null)},[t,l]),[u,p]=vd(c);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:p}),[n,u,p])}const Sz=[{sensor:yf,options:{}},{sensor:xf,options:{}}],Nz={current:{}},Qu={draggable:{measure:jj},droppable:{measure:jj,strategy:ec.WhileDragging,frequency:Uh.Optimized},dragOverlay:{measure:Ri}};class Fl extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Cz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Qu,measureDroppableContainers:wd,windowRect:null,measuringScheduled:!1},Ez={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:wd,draggableNodes:new Map,over:null,measureDroppableContainers:wd},vf=f.createContext(Ez),sC=f.createContext(Cz);function Tz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fl}}}function Pz(e,t){switch(t.type){case bn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case bn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case bn.DragEnd:case bn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case bn.RegisterDroppable:{const{element:n}=t,{id:s}=n,a=new Fl(e.droppable.containers);return a.set(s,n),{...e,droppable:{...e.droppable,containers:a}}}case bn.SetDroppableDisabled:{const{id:n,key:s,disabled:a}=t,l=e.droppable.containers.get(n);if(!l||s!==l.key)return e;const c=new Fl(e.droppable.containers);return c.set(n,{...l,disabled:a}),{...e,droppable:{...e.droppable,containers:c}}}case bn.UnregisterDroppable:{const{id:n,key:s}=t,a=e.droppable.containers.get(n);if(!a||s!==a.key)return e;const l=new Fl(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function Rz(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=f.useContext(vf),l=_h(s),c=_h(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&l&&c!=null){if(!Px(l)||document.activeElement===l.target)return;const u=a.get(c);if(!u)return;const{activatorNode:p,node:m}=u;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[p.current,m.current]){if(!h)continue;const g=S6(h);if(g){g.focus();break}}})}},[s,t,a,c,l]),null}function Az(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,l)=>l({transform:a,...s}),n):n}function Dz(e){return f.useMemo(()=>({draggable:{...Qu.draggable,...e==null?void 0:e.draggable},droppable:{...Qu.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Qu.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function $z(e){let{activeNode:t,measure:n,initialRect:s,config:a=!0}=e;const l=f.useRef(!1),{x:c,y:u}=typeof a=="boolean"?{x:a,y:a}:a;ps(()=>{if(!c&&!u||!t){l.current=!1;return}if(l.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const h=n(m),g=GN(h,s);if(c||(g.x=0),u||(g.y=0),l.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const y=YN(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const oC=f.createContext({...Yr,scaleX:1,scaleY:1});var so;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(so||(so={}));const aC=f.memo(function(t){var n,s,a,l;let{id:c,accessibility:u,autoScroll:p=!0,children:m,sensors:h=Sz,collisionDetection:g=M6,measuring:y,modifiers:b,...C}=t;const j=f.useReducer(Pz,void 0,Tz),[w,k]=j,[E,N]=R6(),[P,$]=f.useState(so.Uninitialized),T=P===so.Initialized,{draggable:{active:D,nodes:O,translate:J},droppable:{containers:V}}=w,L=D!=null?O.get(D):null,W=f.useRef({initial:null,translated:null}),oe=f.useMemo(()=>{var Be;return D!=null?{id:D,data:(Be=L==null?void 0:L.data)!=null?Be:Nz,rect:W}:null},[D,L]),z=f.useRef(null),[H,ee]=f.useState(null),[ne,M]=f.useState(null),q=Ql(C,Object.values(C)),A=gc("DndDescribedBy",c),F=f.useMemo(()=>V.getEnabled(),[V]),Z=Dz(y),{droppableRects:I,measureDroppableContainers:de,measuringScheduled:ge}=fz(F,{dragging:T,dependencies:[J.x,J.y],config:Z.droppable}),U=uz(O,D),ae=f.useMemo(()=>ne?Fh(ne):null,[ne]),me=ue(),ve=pz(U,Z.draggable.measure);$z({activeNode:D!=null?O.get(D):null,config:me.layoutShiftCompensation,initialRect:ve,measure:Z.draggable.measure});const ke=Ej(U,Z.draggable.measure,ve),he=Ej(U?U.parentElement:null),Je=f.useRef({activatorEvent:null,active:null,activeNode:U,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:V,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=V.getNodeFor((n=Je.current.over)==null?void 0:n.id),ot=kz({measure:Z.dragOverlay.measure}),Y=(s=ot.nodeRef.current)!=null?s:U,Ie=T?(a=ot.rect)!=null?a:ke:null,Se=!!(ot.nodeRef.current&&ot.rect),Oe=gz(Se?null:ke),Xe=rC(Y?lr(Y):null),Me=xz(T?Ye??U:null),nt=wz(Me),Ke=Az(b,{transform:{x:J.x-Oe.x,y:J.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:ne,active:oe,activeNodeRect:ke,containerNodeRect:he,draggingNodeRect:Ie,over:Je.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Me,scrollableAncestorRects:nt,windowRect:Xe}),gt=ae?di(ae,J):null,Pt=yz(Me),at=Pj(Pt),ie=Pj(Pt,[ke]),G=di(Ke,at),pe=Ie?z6(Ie,Ke):null,Q=oe&&pe?g({active:oe,collisionRect:pe,droppableRects:I,droppableContainers:F,pointerCoordinates:gt}):null,ye=KN(Q,"id"),[Re,lt]=f.useState(null),te=Se?Ke:di(Ke,ie),be=_6(te,(l=Re==null?void 0:Re.rect)!=null?l:null,ke),Le=f.useRef(null),it=f.useCallback((Be,Fe)=>{let{sensor:Nt,options:$n}=Fe;if(z.current==null)return;const Yt=O.get(z.current);if(!Yt)return;const sn=Be.nativeEvent,Wt=new Nt({active:z.current,activeNode:Yt,event:sn,options:$n,context:Je,onAbort(xt){if(!O.get(xt))return;const{onDragAbort:Rt}=q.current,re={id:xt};Rt==null||Rt(re),E({type:"onDragAbort",event:re})},onPending(xt,jn,Rt,re){if(!O.get(xt))return;const{onDragPending:Qe}=q.current,Ft={id:xt,constraint:jn,initialCoordinates:Rt,offset:re};Qe==null||Qe(Ft),E({type:"onDragPending",event:Ft})},onStart(xt){const jn=z.current;if(jn==null)return;const Rt=O.get(jn);if(!Rt)return;const{onDragStart:re}=q.current,Ae={activatorEvent:sn,active:{id:jn,data:Rt.data,rect:W}};Ps.unstable_batchedUpdates(()=>{re==null||re(Ae),$(so.Initializing),k({type:bn.DragStart,initialCoordinates:xt,active:jn}),E({type:"onDragStart",event:Ae}),ee(Le.current),M(sn)})},onMove(xt){k({type:bn.DragMove,coordinates:xt})},onEnd:Gn(bn.DragEnd),onCancel:Gn(bn.DragCancel)});Le.current=Wt;function Gn(xt){return async function(){const{active:Rt,collisions:re,over:Ae,scrollAdjustedTranslate:Qe}=Je.current;let Ft=null;if(Rt&&Qe){const{cancelDrop:hn}=q.current;Ft={activatorEvent:sn,active:Rt,collisions:re,delta:Qe,over:Ae},xt===bn.DragEnd&&typeof hn=="function"&&await Promise.resolve(hn(Ft))&&(xt=bn.DragCancel)}z.current=null,Ps.unstable_batchedUpdates(()=>{k({type:xt}),$(so.Uninitialized),lt(null),ee(null),M(null),Le.current=null;const hn=xt===bn.DragEnd?"onDragEnd":"onDragCancel";if(Ft){const Ct=q.current[hn];Ct==null||Ct(Ft),E({type:hn,event:Ft})}})}}},[O]),_e=f.useCallback((Be,Fe)=>(Nt,$n)=>{const Yt=Nt.nativeEvent,sn=O.get($n);if(z.current!==null||!sn||Yt.dndKit||Yt.defaultPrevented)return;const Wt={active:sn};Be(Nt,Fe.options,Wt)===!0&&(Yt.dndKit={capturedBy:Fe.sensor},z.current=$n,it(Nt,Fe))},[O,it]),bt=dz(h,_e);bz(h),ps(()=>{ke&&P===so.Initializing&&$(so.Initialized)},[ke,P]),f.useEffect(()=>{const{onDragMove:Be}=q.current,{active:Fe,activatorEvent:Nt,collisions:$n,over:Yt}=Je.current;if(!Fe||!Nt)return;const sn={active:Fe,activatorEvent:Nt,collisions:$n,delta:{x:G.x,y:G.y},over:Yt};Ps.unstable_batchedUpdates(()=>{Be==null||Be(sn),E({type:"onDragMove",event:sn})})},[G.x,G.y]),f.useEffect(()=>{const{active:Be,activatorEvent:Fe,collisions:Nt,droppableContainers:$n,scrollAdjustedTranslate:Yt}=Je.current;if(!Be||z.current==null||!Fe||!Yt)return;const{onDragOver:sn}=q.current,Wt=$n.get(ye),Gn=Wt&&Wt.rect.current?{id:Wt.id,rect:Wt.rect.current,data:Wt.data,disabled:Wt.disabled}:null,xt={active:Be,activatorEvent:Fe,collisions:Nt,delta:{x:Yt.x,y:Yt.y},over:Gn};Ps.unstable_batchedUpdates(()=>{lt(Gn),sn==null||sn(xt),E({type:"onDragOver",event:xt})})},[ye]),ps(()=>{Je.current={activatorEvent:ne,active:oe,activeNode:U,collisionRect:pe,collisions:Q,droppableRects:I,draggableNodes:O,draggingNode:Y,draggingNodeRect:Ie,droppableContainers:V,over:Re,scrollableAncestors:Me,scrollAdjustedTranslate:G},W.current={initial:Ie,translated:pe}},[oe,U,Q,pe,O,Y,Ie,I,V,Re,Me,G]),iz({...me,delta:J,draggingRect:pe,pointerCoordinates:gt,scrollableAncestors:Me,scrollableAncestorRects:nt});const _t=f.useMemo(()=>({active:oe,activeNode:U,activeNodeRect:ke,activatorEvent:ne,collisions:Q,containerNodeRect:he,dragOverlay:ot,draggableNodes:O,droppableContainers:V,droppableRects:I,over:Re,measureDroppableContainers:de,scrollableAncestors:Me,scrollableAncestorRects:nt,measuringConfiguration:Z,measuringScheduled:ge,windowRect:Xe}),[oe,U,ke,ne,Q,he,ot,O,V,I,Re,de,Me,nt,Z,ge,Xe]),Gt=f.useMemo(()=>({activatorEvent:ne,activators:bt,active:oe,activeNodeRect:ke,ariaDescribedById:{draggable:A},dispatch:k,draggableNodes:O,over:Re,measureDroppableContainers:de}),[ne,bt,oe,ke,k,A,O,Re,de]);return nn.createElement(UN.Provider,{value:N},nn.createElement(vf.Provider,{value:Gt},nn.createElement(sC.Provider,{value:_t},nn.createElement(oC.Provider,{value:be},m)),nn.createElement(Rz,{disabled:(u==null?void 0:u.restoreFocus)===!1})),nn.createElement($6,{...u,hiddenTextDescribedById:A}));function ue(){const Be=(H==null?void 0:H.autoScrollEnabled)===!1,Fe=typeof p=="object"?p.enabled===!1:p===!1,Nt=T&&!Be&&!Fe;return typeof p=="object"?{...p,enabled:Nt}:{enabled:Nt}}}),Lz=f.createContext(null),Aj="button",Oz="Draggable";function Iz(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const l=gc(Oz),{activators:c,activatorEvent:u,active:p,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=f.useContext(vf),{role:b=Aj,roleDescription:C="draggable",tabIndex:j=0}=a??{},w=(p==null?void 0:p.id)===t,k=f.useContext(w?oC:Lz),[E,N]=vd(),[P,$]=vd(),T=vz(c,t),D=Ql(n);ps(()=>(g.set(t,{id:t,key:l,node:E,activatorNode:P,data:D}),()=>{const J=g.get(t);J&&J.key===l&&g.delete(t)}),[g,t]);const O=f.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":w&&b===Aj?!0:void 0,"aria-roledescription":C,"aria-describedby":h.draggable}),[s,b,j,w,C,h.draggable]);return{active:p,activatorEvent:u,activeNodeRect:m,attributes:O,isDragging:w,listeners:s?void 0:T,node:E,over:y,setNodeRef:N,setActivatorNodeRef:$,transform:k}}function Mz(){return f.useContext(sC)}const _z="Droppable",Fz={timeout:25};function zz(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const l=gc(_z),{active:c,dispatch:u,over:p,measureDroppableContainers:m}=f.useContext(vf),h=f.useRef({disabled:n}),g=f.useRef(!1),y=f.useRef(null),b=f.useRef(null),{disabled:C,updateMeasurementsFor:j,timeout:w}={...Fz,...a},k=Ql(j??s),E=f.useCallback(()=>{if(!g.current){g.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(k.current)?k.current:[k.current]),b.current=null},w)},[w]),N=bf({callback:E,disabled:C||!c}),P=f.useCallback((O,J)=>{N&&(J&&(N.unobserve(J),g.current=!1),O&&N.observe(O))},[N]),[$,T]=vd(P),D=Ql(t);return f.useEffect(()=>{!N||!$.current||(N.disconnect(),g.current=!1,N.observe($.current))},[$,N]),f.useEffect(()=>(u({type:bn.RegisterDroppable,element:{id:s,key:l,disabled:n,node:$,rect:y,data:D}}),()=>u({type:bn.UnregisterDroppable,key:l,id:s})),[s]),f.useEffect(()=>{n!==h.current.disabled&&(u({type:bn.SetDroppableDisabled,id:s,key:l,disabled:n}),h.current.disabled=n)},[s,l,n,u]),{active:c,rect:y,isOver:(p==null?void 0:p.id)===s,node:$,over:p,setNodeRef:T}}function wf(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function Bz(e,t){return e.reduce((n,s,a)=>{const l=t.get(s);return l&&(n[a]=l),n},Array(e.length))}function Iu(e){return e!==null&&e>=0}function Uz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Vz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const iC=e=>{let{rects:t,activeIndex:n,overIndex:s,index:a}=e;const l=wf(t,s,n),c=t[a],u=l[a];return!u||!c?null:{x:u.left-c.left,y:u.top-c.top,scaleX:u.width/c.width,scaleY:u.height/c.height}},Mu={scaleX:1,scaleY:1},lC=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:a,rects:l,overIndex:c}=e;const u=(t=l[n])!=null?t:s;if(!u)return null;if(a===n){const m=l[c];return m?{x:0,y:n<c?m.top+m.height-(u.top+u.height):m.top-u.top,...Mu}:null}const p=Hz(l,a,n);return a>n&&a<=c?{x:0,y:-u.height-p,...Mu}:a<n&&a>=c?{x:0,y:u.height+p,...Mu}:{x:0,y:0,...Mu}};function Hz(e,t,n){const s=e[t],a=e[t-1],l=e[t+1];return s?n<t?a?s.top-(a.top+a.height):l?l.top-(s.top+s.height):0:l?l.top-(s.top+s.height):a?s.top-(a.top+a.height):0:0}const cC="Sortable",uC=nn.createContext({activeIndex:-1,containerId:cC,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:iC,disabled:{draggable:!1,droppable:!1}});function dC(e){let{children:t,id:n,items:s,strategy:a=iC,disabled:l=!1}=e;const{active:c,dragOverlay:u,droppableRects:p,over:m,measureDroppableContainers:h}=Mz(),g=gc(cC,n),y=u.rect!==null,b=f.useMemo(()=>s.map(T=>typeof T=="object"&&"id"in T?T.id:T),[s]),C=c!=null,j=c?b.indexOf(c.id):-1,w=m?b.indexOf(m.id):-1,k=f.useRef(b),E=!Uz(b,k.current),N=w!==-1&&j===-1||E,P=Vz(l);ps(()=>{E&&C&&h(b)},[E,b,C,h]),f.useEffect(()=>{k.current=b},[b]);const $=f.useMemo(()=>({activeIndex:j,containerId:g,disabled:P,disableTransforms:N,items:b,overIndex:w,useDragOverlay:y,sortedRects:Bz(b,p),strategy:a}),[j,g,P.draggable,P.droppable,N,b,w,p,y,a]);return nn.createElement(uC.Provider,{value:$},t)}const Wz=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return wf(n,s,a).indexOf(t)},Kz=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:a,items:l,newIndex:c,previousItems:u,previousContainerId:p,transition:m}=e;return!m||!s||u!==l&&a===c?!1:n?!0:c!==a&&t===p},qz={duration:200,easing:"ease"},fC="transform",Gz=hi.Transition.toString({property:fC,duration:0,easing:"linear"}),Yz={roleDescription:"sortable"};function Jz(e){let{disabled:t,index:n,node:s,rect:a}=e;const[l,c]=f.useState(null),u=f.useRef(n);return ps(()=>{if(!t&&n!==u.current&&s.current){const p=a.current;if(p){const m=Ri(s.current,{ignoreTransform:!0}),h={x:p.left-m.left,y:p.top-m.top,scaleX:p.width/m.width,scaleY:p.height/m.height};(h.x||h.y)&&c(h)}}n!==u.current&&(u.current=n)},[t,n,s,a]),f.useEffect(()=>{l&&c(null)},[l]),l}function pC(e){let{animateLayoutChanges:t=Kz,attributes:n,disabled:s,data:a,getNewIndex:l=Wz,id:c,strategy:u,resizeObserverConfig:p,transition:m=qz}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:C,sortedRects:j,overIndex:w,useDragOverlay:k,strategy:E}=f.useContext(uC),N=Xz(s,b),P=h.indexOf(c),$=f.useMemo(()=>({sortable:{containerId:g,index:P,items:h},...a}),[g,a,P,h]),T=f.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:D,node:O,isOver:J,setNodeRef:V}=zz({id:c,data:$,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...p}}),{active:L,activatorEvent:W,activeNodeRect:oe,attributes:z,setNodeRef:H,listeners:ee,isDragging:ne,over:M,setActivatorNodeRef:q,transform:A}=Iz({id:c,data:$,attributes:{...Yz,...n},disabled:N.draggable}),F=v6(V,H),Z=!!L,I=Z&&!C&&Iu(y)&&Iu(w),de=!k&&ne,ge=de&&I?A:null,ae=I?ge??(u??E)({rects:j,activeNodeRect:oe,activeIndex:y,overIndex:w,index:P}):null,me=Iu(y)&&Iu(w)?l({id:c,items:h,activeIndex:y,overIndex:w}):P,ve=L==null?void 0:L.id,ke=f.useRef({activeId:ve,items:h,newIndex:me,containerId:g}),he=h!==ke.current.items,Je=t({active:L,containerId:g,isDragging:ne,isSorting:Z,id:c,index:P,items:h,newIndex:ke.current.newIndex,previousItems:ke.current.items,previousContainerId:ke.current.containerId,transition:m,wasDragging:ke.current.activeId!=null}),Ye=Jz({disabled:!Je,index:P,node:O,rect:D});return f.useEffect(()=>{Z&&ke.current.newIndex!==me&&(ke.current.newIndex=me),g!==ke.current.containerId&&(ke.current.containerId=g),h!==ke.current.items&&(ke.current.items=h)},[Z,me,g,h]),f.useEffect(()=>{if(ve===ke.current.activeId)return;if(ve!=null&&ke.current.activeId==null){ke.current.activeId=ve;return}const Y=setTimeout(()=>{ke.current.activeId=ve},50);return()=>clearTimeout(Y)},[ve]),{active:L,activeIndex:y,attributes:z,data:$,rect:D,index:P,newIndex:me,items:h,isOver:J,isSorting:Z,isDragging:ne,listeners:ee,node:O,overIndex:w,over:M,setNodeRef:F,setActivatorNodeRef:q,setDroppableNodeRef:V,setDraggableNodeRef:H,transform:Ye??ae,transition:ot()};function ot(){if(Ye||he&&ke.current.newIndex===P)return Gz;if(!(de&&!Px(W)||!m)&&(Z||Je))return hi.Transition.toString({...m,property:fC})}}function Xz(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:t.droppable}}function Sd(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Qz=[ht.Down,ht.Right,ht.Up,ht.Left],Zz=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:l,over:c,scrollableAncestors:u}}=t;if(Qz.includes(e.code)){if(e.preventDefault(),!n||!s)return;const p=[];l.getEnabled().forEach(g=>{if(!g||g!=null&&g.disabled)return;const y=a.get(g.id);if(y)switch(e.code){case ht.Down:s.top<y.top&&p.push(g);break;case ht.Up:s.top>y.top&&p.push(g);break;case ht.Left:s.left>y.left&&p.push(g);break;case ht.Right:s.left<y.left&&p.push(g);break}});const m=O6({collisionRect:s,droppableRects:a,droppableContainers:p});let h=KN(m,"id");if(h===(c==null?void 0:c.id)&&m.length>1&&(h=m[1].id),h!=null){const g=l.get(n.id),y=l.get(h),b=y?a.get(y.id):null,C=y==null?void 0:y.node.current;if(C&&b&&g&&y){const w=gf(C).some((T,D)=>u[D]!==T),k=mC(g,y),E=eB(g,y),N=w||!k?{x:0,y:0}:{x:E?s.width-b.width:0,y:E?s.height-b.height:0},P={x:b.left,y:b.top};return N.x&&N.y?P:Zl(P,N)}}}};function mC(e,t){return!Sd(e)||!Sd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function eB(e,t){return!Sd(e)||!Sd(t)||!mC(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function tB({value:e,onChange:t,ariaLabel:n}){const s=n??"Pick a color",a=n?`${n} (hex)`:"Color hex value";return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e||"#64748b",onChange:l=>t(l.target.value),className:"h-7 w-7 shrink-0 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5",title:"Pick a color","aria-label":s}),r.jsx("input",{type:"text",value:e,onChange:l=>t(l.target.value),placeholder:"#64748b",className:"editor-input w-[5.5rem] font-mono text-xs","aria-label":a})]})}const Vh=["projects","playbooks","todos","servers","config"];function nB(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))Vh.includes(n)&&t.add(n);return t}function Dj(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function rB(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(""),[c,u]=f.useState(new Set(Vh)),[p,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(null),[C,j]=f.useState(null),w=f.useCallback(async()=>{try{const T=await fetch("/api/backup");if(!T.ok)throw new Error(`HTTP ${T.status}`);const D=await T.json();s(D),l(D.repo??""),u(nB(D.categories)),m(!1)}catch(T){j({type:"error",message:`Failed to load backup config: ${T instanceof Error?T.message:String(T)}`})}finally{t(!1)}},[]);f.useEffect(()=>{w()},[w]);function k(T){u(D=>{const O=new Set(D);return O.has(T)?O.delete(T):O.add(T),O}),m(!0)}async function E(){g(!0),j(null);try{const T=Array.from(c),D=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:a.trim()||null,categories:T})}),O=await D.json();if(!D.ok)throw new Error(O.error||`HTTP ${D.status}`);s(O),m(!1),j({type:"success",message:"Backup configuration saved."})}catch(T){j({type:"error",message:`Save failed: ${T instanceof Error?T.message:String(T)}`})}finally{g(!1)}}async function N(){b("push"),j(null);try{const T=await fetch("/api/backup/push",{method:"POST"}),D=await T.json();if(!T.ok||D.success===!1)throw new Error(D.error||D.message||`HTTP ${T.status}`);j({type:"success",message:D.message||"Backup complete."}),await w()}catch(T){j({type:"error",message:`Backup failed: ${T instanceof Error?T.message:String(T)}`})}finally{b(null)}}async function P(){if(window.confirm("Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?")){b("pull"),j(null);try{const D=await fetch("/api/backup/pull",{method:"POST"}),O=await D.json();if(!D.ok||O.success===!1)throw new Error(O.error||O.message||`HTTP ${D.status}`);j({type:"success",message:O.message||"Restore complete."}),await w()}catch(D){j({type:"error",message:`Restore failed: ${D instanceof Error?D.message:String(D)}`})}finally{b(null)}}}if(e)return r.jsx(We,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})});const $=!!a.trim()&&c.size>0&&!y&&!p;return r.jsx(We,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:r.jsxs("div",{className:"space-y-4",children:[C&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${C.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:C.message}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repository URL"}),r.jsx("input",{type:"text",value:a,onChange:T=>{l(T.target.value),m(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",r.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Vh.map(T=>{const D=c.has(T);return r.jsxs("button",{type:"button",onClick:()=>k(T),className:`shell-action text-xs ${D?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:[r.jsx("span",{className:`mr-1 inline-block h-2 w-2 rounded-full ${D?"bg-primary":"bg-muted-foreground/40"}`}),T]},T)})})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last backup: "}),Dj((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),Dj((n==null?void 0:n.lastRestore)??null)]}),(n==null?void 0:n.locked)&&r.jsx("div",{className:"sm:col-span-2 text-warning-foreground",children:"⚠ A backup operation is in progress or the lock file is stale."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:E,disabled:h||!p,children:[r.jsx(Id,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:N,disabled:!$,title:$?"Back up now":p?"Save config first":"Set repo and pick categories",children:[r.jsx(RP,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:P,disabled:!$,title:$?"Restore from backup":p?"Save config first":"Set repo and pick categories",children:[r.jsx(aP,{className:"h-3.5 w-3.5"}),y==="pull"?"Restoring...":"Restore"]}),p&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]}),r.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-muted/20 p-3 text-xs text-muted-foreground",children:[r.jsx(sP,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Restore never overwrites ",r.jsx("code",{className:"rounded bg-muted px-1",children:"config.md"})," (would clobber backup settings). The agent sessions database is not backed up — only markdown files."]})]})]})})}function sB({open:e,affected:t,remaining:n,onResolve:s,onCancel:a}){var j;const[l,c]=f.useState(n.length>0?"remap":"delete"),[u,p]=f.useState(((j=n[0])==null?void 0:j.id)??""),[m,h]=f.useState(!1);f.useEffect(()=>{var w;e&&(c(n.length>0?"remap":"delete"),p(((w=n[0])==null?void 0:w.id)??""),h(!1))},[e,n]);const g=l==="remap"&&n.length>0&&u!==""&&u!==t.id||l==="delete"&&m;function y(){g&&s(l==="remap"?{id:t.id,mode:"remap",target:u}:{id:t.id,mode:"delete"})}const b=t.assignments.slice(0,10),C=t.count-b.length;return r.jsx(ar,{open:e,onOpenChange:w=>w?void 0:a(),children:r.jsxs(Kn,{className:"max-w-xl",children:[r.jsxs(Qr,{children:[r.jsxs(qn,{children:['Delete status "',t.label,'" — ',t.count," assignment",t.count===1?"":"s"," reference it"]}),r.jsx(gs,{children:"Choose how to resolve the affected assignments before this status is removed from the workflow."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("ul",{className:"space-y-1 text-sm",children:[b.map(w=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:w.display})},`${w.projectSlug??"standalone"}/${w.assignmentSlug}`)),C>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",C," more not shown"]})]})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="remap",onChange:()=>c("remap"),disabled:n.length===0,className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium",children:"Remap to another status"}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),onClick:()=>c("remap"),disabled:l!=="remap"||n.length===0,className:"mt-2 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(w=>r.jsxs("option",{value:w.id,children:[w.label," (",w.id,")"]},w.id))]}),n.length===0&&r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"No other saved statuses to remap to. Add another status first, or use Delete."})]})]}),r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="delete",onChange:()=>c("delete"),className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:"Delete these assignments"}),r.jsxs("span",{className:"block text-xs text-muted-foreground mt-1",children:["Permanently removes ",t.count," assignment",t.count===1?"":"s"," from disk. This cannot be undone."]}),l==="delete"&&r.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:m,onChange:w=>h(w.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(Ls,{children:[r.jsx("button",{type:"button",onClick:a,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:y,disabled:!g,className:`shell-action ${l==="delete"?"bg-error text-error-foreground hover:opacity-90":"shell-action--cta"} disabled:cursor-not-allowed disabled:opacity-50`,children:l==="remap"?`Remap ${t.count} → ${u||"..."}`:`Delete ${t.count}`})]})]})})}function oB(e){const t=Array.from(e.pendingResolutions.values());return{body:{statuses:e.statuses.map(s=>({id:s.id,label:s.label,...s.description?{description:s.description}:{},...s.color?{color:s.color}:{},...s.terminal?{terminal:!0}:{}})),order:e.order,transitions:[],resolutions:t},resolutions:t}}function aB(e,t){const n=new Map;t.forEach((a,l)=>{n.has(a)||n.set(a,l)});const s=t.length;return e.map((a,l)=>({s:a,originalIndex:l,r:n.get(a.id)??s})).sort((a,l)=>a.r-l.r||a.originalIndex-l.originalIndex).map(a=>a.s)}function $j(e,t){const n=new Map;for(const[s,a]of e.entries())t.has(a.id)||a.mode==="remap"&&!t.has(a.target)||n.set(s,a);return n}function iB(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:a,unbindAction:l}=po(),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(!1),y=Object.values(t).some(N=>typeof N=="string"&&N.length>0);function b(N,P){m({type:N,message:P}),setTimeout(()=>m(null),2500)}function C(N){u({kind:N,combo:null,conflict:null,saving:!1,error:null})}function j(N){if(!c||N.key==="Escape")return;if(N.key==="Enter"&&c.combo){N.preventDefault(),w();return}if(N.key==="Enter")return;N.preventDefault(),N.stopPropagation();const P=V0(N.nativeEvent);if(!P)return;const $=s(P,c.kind);u({...c,combo:P,conflict:$,error:null})}async function w(){var N;if(c!=null&&c.combo){if((N=c.conflict)!=null&&N.description){u({...c,error:`Reserved: ${c.conflict.description}`});return}u({...c,saving:!0,error:null});try{await a(c.kind,c.combo),u(null),b("success",`Bound ${xl[c.kind]}`)}catch(P){u({...c,saving:!1,error:P instanceof Error?P.message:"Failed to save"})}}}async function k(N){try{await l(N),b("success",`Cleared ${xl[N]} binding`)}catch(P){b("error",P instanceof Error?P.message:"Failed to clear binding")}}async function E(){if(!h){g(!0);try{await J3(),b("success","All hotkey bindings cleared")}catch(N){b("error",N instanceof Error?N.message:"Failed to reset bindings")}finally{g(!1)}}}return r.jsxs(We,{title:"Hotkey Bindings",description:"Each canonical create action ships with a default hotkey that fires the action without opening the palette. Override any of them below — Clear restores the default.",actions:y?r.jsxs("button",{className:"shell-action text-xs",onClick:()=>void E(),disabled:h,children:[r.jsx(io,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[p?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${p.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:p.message}):null,r.jsx("ul",{className:"space-y-2",children:_d.map(N=>{var O,J;const P=n.find(V=>V.bindableKind===N),$=e[N],T=typeof t[N]=="string"&&!!t[N],D=(c==null?void 0:c.kind)===N;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[r.jsx(uh,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm text-foreground",children:(P==null?void 0:P.title)??xl[N]}),P!=null&&P.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:P.subtitle}):null]}),$?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-foreground",children:us($)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${T?"text-primary":"text-muted-foreground"}`,children:T?"custom":"default"})]}):r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>C(N),children:$?"Rebind":"Bind"}),T?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(N),"aria-label":`Restore default ${xl[N]} binding`,children:[r.jsx(ig,{className:"h-3 w-3"}),"Restore default"]}):null]}),D?r.jsx("div",{className:"mt-2 w-full rounded-md border border-primary/40 bg-primary/5 px-3 py-3 text-center outline-none",tabIndex:0,autoFocus:!0,onKeyDown:j,onBlur:()=>{(c==null?void 0:c.kind)===N&&!c.saving&&u(null)},children:c!=null&&c.combo?r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:us(c.combo)}),(O=c.conflict)!=null&&O.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(J=c.conflict)!=null&&J.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',xl[c.conflict.kind],'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press Enter to save, Esc to cancel, any other key to retry."}),c.error?r.jsx("div",{className:"text-xs text-destructive",children:c.error}):null]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press the key combination you want to bind…"})}):null]},N)})})]})}const lB={kanban:"Kanban",list:"List",table:"Table"},cB={comfortable:"Comfortable",compact:"Compact"},uB={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},dB={asc:"Ascending",desc:"Descending"};function fB(){const e=Y_(),t=e.global,[n,s]=f.useState(!1),[a,l]=f.useState(null);function c(m,h){l({type:m,message:h}),setTimeout(()=>l(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await dN({[m]:h}),c("success","Saved")}catch(g){c("error",g instanceof Error?g.message:"Failed to save")}finally{s(!1)}}}async function p(){if(e.custom){s(!0);try{await J_(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(We,{title:"View defaults",description:"Defaults for the assignments board, list, and table views. Per-project overrides are saved automatically as you use them.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:p,disabled:n,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[a&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${a.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:a.message}),r.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Default view"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:Rg.map(m=>r.jsx("button",{type:"button",onClick:()=>u("defaultView",m),disabled:n,"aria-pressed":t.defaultView===m,className:`px-3 py-1 text-xs ${t.defaultView===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:lB[m]},m))})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Density"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:$D.map(m=>r.jsx("button",{type:"button",onClick:()=>u("density",m),disabled:n,"aria-pressed":t.density===m,className:`px-3 py-1 text-xs ${t.density===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:cB[m]},m))})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sort by"}),r.jsx("dd",{className:"mt-1.5",children:r.jsx("select",{value:t.sortField,onChange:m=>u("sortField",m.target.value),disabled:n,className:"editor-input max-w-[220px]",children:n1.map(m=>r.jsx("option",{value:m,children:uB[m]},m))})})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Direction"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:DD.map(m=>r.jsx("button",{type:"button",onClick:()=>u("sortDirection",m),disabled:n,"aria-pressed":t.sortDirection===m,className:`px-3 py-1 text-xs ${t.sortDirection===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:dB[m]},m))})]})]})]})}const pB=/^[a-z0-9][a-z0-9_-]*$/,hC=["first","last","none"];class gC extends Error{constructor(n,s){super(n);Xb(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const Dx={agents:[],custom:!1};let Xa=null,Ka=null,Nd=0;const Hh=new Set;function xC(e){Xa=e;for(const t of Hh)t(e)}function mB(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(typeof t.id!="string"||t.id.length===0||typeof t.label!="string"||typeof t.command!="string")return null;const n={id:t.id,label:t.label,command:t.command};return Array.isArray(t.args)&&t.args.every(s=>typeof s=="string")&&(n.args=t.args),typeof t.promptArgPosition=="string"&&hC.includes(t.promptArgPosition)&&(n.promptArgPosition=t.promptArgPosition),typeof t.resolveFromShellAliases=="boolean"&&(n.resolveFromShellAliases=t.resolveFromShellAliases),typeof t.default=="boolean"&&(n.default=t.default),n}function $x(e){if(!e||typeof e!="object")return Dx;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const a of n){const l=mB(a);l&&s.push(l)}return{agents:s,custom:t.custom===!0}}function hB(){if(Xa)return Promise.resolve(Xa);if(Ka)return Ka;const e=++Nd;return Ka=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Ka=null;const n=$x(t);return e!==Nd?Xa??n:(Xa=n,n)}).catch(()=>(Ka=null,Dx)),Ka}function gB(){const[e,t]=f.useState(()=>Xa??Dx);return f.useEffect(()=>{let n=!1;return hB().then(s=>{n||t(s)}),Hh.add(t),()=>{n=!0,Hh.delete(t)}},[]),e}async function yC(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new gC(n,t==null?void 0:t.fieldErrors)}async function xB(e){++Nd;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await yC(t);const n=$x(await t.json());return xC(n),n}async function yB(){++Nd;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await yC(e);const t=$x(await e.json());return xC(t),t}const bB={first:"first",last:"last",none:"none"};function bC(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Nl(e){return e.map(t=>({rowKey:bC(),id:t.id,originalId:t.id,isNew:!1,idEditable:!1,autoSlugFromLabel:!1,label:t.label,command:t.command,argsText:t.args?t.args.join(" "):"",promptArgPosition:t.promptArgPosition??"first",resolveFromShellAliases:t.resolveFromShellAliases??!1,default:t.default??!1,fieldErrors:{}}))}function vB(e){return e.map(t=>{const n={id:t.id,label:t.label,command:t.command},s=t.argsText.split(/[,\s]+/).filter(Boolean);return s.length>0&&(n.args=s),t.promptArgPosition!=="first"&&(n.promptArgPosition=t.promptArgPosition),t.resolveFromShellAliases&&(n.resolveFromShellAliases=!0),t.default&&(n.default=!0),n})}function wB(e){if(e.length===0)return e;let t=-1;for(let n=0;n<e.length;n++)if(e[n].default){t=n;break}return e.map((n,s)=>({...n,default:t===-1?s===0:s===t}))}function jB(e,t){return!t||t.length===0?e:e.map((n,s)=>{const a={};for(const l of t){if(l.index!==void 0){l.index===s&&(a[l.field]=l.message);continue}if(l.id!==void 0){l.id===n.id&&(a[l.field]=l.message);continue}a[l.field]=l.message}return{...n,fieldErrors:a}})}function kB(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function SB(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],a=t[n];if(s.id!==a.id||s.label!==a.label||s.command!==a.command||s.argsText!==a.argsText||s.promptArgPosition!==a.promptArgPosition||s.resolveFromShellAliases!==a.resolveFromShellAliases||s.default!==a.default)return!1}return!0}function NB({row:e,index:t,canRemove:n,onPatch:s,onSetDefault:a,onRemove:l}){const{attributes:c,listeners:u,setNodeRef:p,setActivatorNodeRef:m,transform:h,transition:g,isDragging:y}=pC({id:e.rowKey}),b={transform:hi.Transform.toString(h),transition:g,zIndex:y?50:void 0,position:y?"relative":void 0};function C(k){const E={label:k};if(e.autoSlugFromLabel){const N=mr(k);N&&pB.test(N)?E.id=N:E.id=`agent-${t+1}`}s(E)}function j(k){s({id:k,autoSlugFromLabel:!1})}const w=k=>e.fieldErrors[k]?"border-error-foreground/60":"";return r.jsxs("div",{ref:p,style:b,className:`surface-panel space-y-2 px-3 py-2 ${y?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:m,...c,...u,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(d0,{className:"h-4 w-4"})}),r.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:a,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?r.jsx("input",{type:"text",value:e.id,onChange:k=>j(k.target.value),className:`editor-input w-32 font-mono text-xs ${w("id")}`,"aria-label":"Agent id"}):r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),r.jsx("button",{type:"button",onClick:l,disabled:!n,"aria-label":"Remove agent",className:"rounded p-1 text-muted-foreground/60 transition hover:bg-foreground/[0.04] hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30",children:r.jsx(or,{className:"h-3.5 w-3.5"})})]})]}),e.fieldErrors.id&&r.jsx("p",{className:"ml-7 text-[11px] text-error-foreground",children:e.fieldErrors.id}),r.jsxs("div",{className:"ml-7 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Label"}),r.jsx("input",{type:"text",value:e.label,onChange:k=>C(k.target.value),className:`editor-input mt-0.5 w-full ${w("label")}`}),e.fieldErrors.label&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.label})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Command"}),r.jsx("input",{type:"text",value:e.command,placeholder:"claude or /usr/local/bin/claude",onChange:k=>s({command:k.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("command")}`}),e.fieldErrors.command&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.command})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Args (comma- or space-separated)"}),r.jsx("input",{type:"text",value:e.argsText,placeholder:"--dangerously-skip-permissions",onChange:k=>s({argsText:k.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("args")}`}),e.fieldErrors.args&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.args})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Prompt arg position"}),r.jsx("select",{value:e.promptArgPosition,onChange:k=>s({promptArgPosition:k.target.value}),className:`editor-input mt-0.5 w-full ${w("promptArgPosition")}`,children:hC.map(k=>r.jsx("option",{value:k,children:bB[k]},k))}),e.fieldErrors.promptArgPosition&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),r.jsxs("label",{className:"col-span-full inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:e.resolveFromShellAliases,onChange:k=>s({resolveFromShellAliases:k.target.checked}),className:"h-3.5 w-3.5 cursor-pointer accent-foreground"}),"Resolve from shell aliases (look up ",r.jsx("code",{className:"font-mono",children:"command"})," in your interactive shell before launching)"]})]})]})}function CB(){const e=gB(),[t,n]=f.useState(()=>Nl(e.agents)),[s,a]=f.useState(()=>Nl(e.agents)),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);f.useEffect(()=>{const T=Nl(e.agents);n(T),a(T),p(null)},[e.agents]);const g=f.useMemo(()=>!SB(t,s),[t,s]),y=VN(jd(yf,{activationConstraint:{distance:8}}),jd(xf));function b(T,D){h({type:T,message:D}),setTimeout(()=>h(null),2500)}function C(T,D){n(O=>O.map(J=>J.rowKey===T?{...J,...D,fieldErrors:EB(J.fieldErrors,D)}:J))}function j(T){n(D=>D.map(O=>({...O,default:O.rowKey===T})))}function w(){n(T=>{const D=new Set(T.map(oe=>oe.id)),O="new-agent";let J=O,V=1;for(;D.has(J);)V+=1,J=`${O}-${V}`;const L=V===1?"New Agent":`New Agent ${V}`,W={rowKey:bC(),id:J,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:L,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,fieldErrors:{}};return[...T,W]})}function k(T){n(D=>D.filter(O=>O.rowKey!==T))}async function E(){c(!0),p(null);try{const T=wB(t),D=vB(T),O=await xB(D),J=Nl(O.agents);n(J),a(J),b("success","Agents saved")}catch(T){if(T instanceof gC)p(T.message),n(D=>jB(kB(D),T.fieldErrors)),b("error",T.message);else{const D=T instanceof Error?T.message:"Failed to save";p(D),b("error",D)}}finally{c(!1)}}function N(){n(s),p(null)}async function P(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){c(!0),p(null);try{const T=await yB(),D=Nl(T.agents);n(D),a(D),b("success","Reset to defaults")}catch(T){const D=T instanceof Error?T.message:"Failed to reset";p(D),b("error",D)}finally{c(!1)}}}function $(T){const{active:D,over:O}=T;!O||D.id===O.id||n(J=>{const V=J.findIndex(W=>W.rowKey===D.id),L=J.findIndex(W=>W.rowKey===O.id);return V===-1||L===-1?J:wf(J,V,L)})}return r.jsxs(We,{title:"Agents",description:"Configure which agents the dashboard and 'Open in agent' actions can launch. The default agent is used when no other one is specified.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:P,disabled:l,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[!e.custom&&r.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-foreground/[0.02] px-3 py-2 text-xs text-muted-foreground",children:[r.jsx(ng,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Using built-in defaults — first save will write your own list to"," ",r.jsx("code",{className:"font-mono",children:"~/.syntaur/config.md"}),"."]})]}),m&&r.jsx("div",{className:`rounded-md border px-3 py-1.5 text-xs ${m.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:m.message}),u&&(!m||m.type!=="error")&&r.jsx("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-1.5 text-xs text-error-foreground",children:u}),r.jsx(aC,{sensors:y,collisionDetection:qN,onDragEnd:$,children:r.jsx(dC,{items:t.map(T=>T.rowKey),strategy:lC,children:r.jsx("div",{className:"space-y-2",children:t.map((T,D)=>r.jsx(NB,{row:T,index:D,canRemove:t.length>1,onPatch:O=>C(T.rowKey,O),onSetDefault:()=>j(T.rowKey),onRemove:()=>k(T.rowKey)},T.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:w,disabled:l,className:"shell-action text-xs",children:[r.jsx(rn,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:N,disabled:!g||l,className:"shell-action text-xs",children:"Discard"}),r.jsxs("button",{type:"button",onClick:E,disabled:!g||l,className:"shell-action text-xs",children:[r.jsx(Id,{className:"h-3 w-3"}),"Save"]})]})]})]})}function EB(e,t){if(Object.keys(e).length===0)return e;const n={...e};return"id"in t&&delete n.id,"label"in t&&delete n.label,"command"in t&&delete n.command,"argsText"in t&&delete n.args,"promptArgPosition"in t&&delete n.promptArgPosition,"resolveFromShellAliases"in t&&delete n.resolveFromShellAliases,"default"in t&&delete n.default,n}const vC=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],Cd={terminal:"terminal-app",custom:!1};let Qa=null,qa=null,Ed=0;const Wh=new Set;function wC(e){Qa=e;for(const t of Wh)t(e)}function Lx(e){if(!e||typeof e!="object")return Cd;const t=e;return{terminal:typeof t.terminal=="string"&&vC.includes(t.terminal)?t.terminal:Cd.terminal,custom:t.custom===!0}}function TB(){if(Qa)return Promise.resolve(Qa);if(qa)return qa;const e=++Ed;return qa=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{qa=null;const n=Lx(t);return e!==Ed?Qa??n:(Qa=n,n)}).catch(()=>(qa=null,Cd)),qa}function PB(){const[e,t]=f.useState(()=>Qa??Cd);return f.useEffect(()=>{let n=!1;return TB().then(s=>{n||t(s)}),Wh.add(t),()=>{n=!0,Wh.delete(t)}},[]),e}async function RB(e){++Ed;const t=await fetch("/api/config/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({terminal:e})});if(!t.ok){const s=await t.json().catch(()=>null);throw new Error((s==null?void 0:s.error)??`HTTP ${t.status}`)}const n=Lx(await t.json());return wC(n),n}async function AB(){++Ed;const e=await fetch("/api/config/terminal",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=Lx(await e.json());return wC(t),t}const _u={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function DB(){const{terminal:e,custom:t}=PB(),[n,s]=f.useState(!1),[a,l]=f.useState(null);function c(m){l(m),setTimeout(()=>l(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await RB(m),c({type:"success",message:`Terminal set to ${_u[m]}.`})}catch(h){c({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function p(){s(!0);try{const m=await AB();c({type:"success",message:`Reset to OS default (${_u[m.terminal]}).`})}catch(m){c({type:"error",message:m instanceof Error?m.message:"Reset failed."})}finally{s(!1)}}return r.jsxs(We,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${_u[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:p,disabled:n,type:"button",children:[r.jsx(io,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[a&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${a.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:a.message}),r.jsxs("label",{className:"block text-sm",children:[r.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Launch in"}),r.jsx("select",{value:e,onChange:m=>u(m.target.value),disabled:n,className:"w-full max-w-sm rounded-md border border-border/60 bg-background px-3 py-1.5 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:vC.map(m=>r.jsx("option",{value:m,children:_u[m]},m))})]})]})}function Cl(e){return e===ld?"Ungrouped":e}function $B(){const{data:e,loading:t,error:n,refetch:s}=oc(),{hidden:a,custom:l,loading:c,error:u,reload:p}=Ik(),[m,h]=f.useState(!1),[g,y]=f.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const C=e?[...e.workspaces,...e.hasUngrouped?[ld]:[]]:[];async function j(k,E){const N=E?a.filter(P=>P!==k):[...a,k];h(!0);try{await aD(N),b({type:"success",message:E?`Showing "${Cl(k)}" in the left nav.`:`Hiding "${Cl(k)}" from the left nav.`})}catch(P){b({type:"error",message:P instanceof Error?P.message:"Save failed."})}finally{h(!1)}}async function w(){h(!0);try{await iD(),b({type:"success",message:"All workspaces shown in the left nav."})}catch(k){b({type:"error",message:k instanceof Error?k.message:"Reset failed."})}finally{h(!1)}}return r.jsxs(We,{title:"Workspace visibility",description:"Choose which workspaces appear in the left nav. Hidden workspaces stay fully reachable by direct URL — this only controls the sidebar.",actions:l?r.jsxs("button",{className:"shell-action text-xs",onClick:w,disabled:m,type:"button",children:[r.jsx(io,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[g&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),t||c?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||u?r.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[r.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&s(),u&&p()},children:[r.jsx(io,{className:"h-3 w-3"}),"Retry"]})]}):C.length===0?r.jsx("div",{className:"text-sm text-muted-foreground",children:"No workspaces yet."}):r.jsx("ul",{className:"flex flex-col divide-y divide-border/40",children:C.map(k=>{const E=!rD(k,a);return r.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("span",{className:"truncate text-sm",title:Cl(k),children:[Cl(k),k===ld&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":E,"aria-label":`Show "${Cl(k)}" in the left nav`,onClick:()=>j(k,!E),disabled:m,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-60 ${E?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${E?"translate-x-4":"translate-x-0"}`})})]},k)})})]})}function jC(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function sh(e){const t=e.statuses.map(n=>({rowKey:jC(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return aB(t,e.order)}function LB({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:a,listeners:l,setNodeRef:c,setActivatorNodeRef:u,transform:p,transition:m,isDragging:h}=pC({id:e.rowKey}),g={transform:hi.Transform.toString(p),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0};return r.jsxs("div",{ref:c,style:g,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${h?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:u,...a,...l,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(d0,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsx("input",{type:"text",value:e.id,readOnly:!0,"aria-label":"Status ID",className:"editor-input w-full text-sm cursor-not-allowed opacity-60"})}),r.jsx(gr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:"To rename a saved status, delete the row and create a new one (this triggers the orphan-resolution flow if assignments still reference it)."})]}):r.jsx("input",{type:"text",value:e.id,onChange:y=>n("id",y.target.value),"aria-label":"Status ID",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:r.jsx("input",{type:"text",value:e.label,onChange:y=>n("label",y.target.value),"aria-label":"Status label",className:"editor-input w-full text-sm"})}),r.jsx(tB,{value:e.color,onChange:y=>n("color",y),ariaLabel:`Color for ${e.label||e.id}`}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(gr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:'When enabled, assignments in this status count as finished — they fill the "done" portion of progress bars and satisfy dependency requirements.'})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":e.terminal,"aria-label":`Done state for ${e.label||e.id}`,onClick:()=>n("terminal",!e.terminal),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background ${e.terminal?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${e.terminal?"translate-x-4":"translate-x-0"}`})})]}),r.jsx("button",{type:"button",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",onClick:s,title:"Remove status","aria-label":`Remove status ${e.id}`,children:r.jsx(or,{className:"h-3.5 w-3.5"})})]})}function OB(){var ge;const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(!1),[c,u]=f.useState([]),[p,m]=f.useState(!1),[h,g]=f.useState(null),[y,b]=f.useState(!1),[C,j]=f.useState(new Set),[w,k]=f.useState(new Map),[E,N]=f.useState({open:!1}),P=VN(jd(yf,{activationConstraint:{distance:8}}),jd(xf,{coordinateGetter:Zz})),{preset:$,setPreset:T,resetPreset:D}=ug(),[O,J]=f.useState(!1),[V,L]=f.useState(null);async function W(U){if(!(U===$||O)){J(!0),L(null);try{await T(U),L({type:"success",message:"Theme updated"}),setTimeout(()=>L(null),2e3)}catch(ae){L({type:"error",message:ae instanceof Error?ae.message:"Failed to save theme"})}finally{J(!1)}}}async function oe(){J(!0),L(null);try{await D(),L({type:"success",message:"Theme reset to default"}),setTimeout(()=>L(null),2e3)}catch(U){L({type:"error",message:U instanceof Error?U.message:"Failed to reset theme"})}finally{J(!1)}}const z=f.useCallback(async()=>{try{const U=await fetch("/api/config/statuses");if(!U.ok)throw new Error(`HTTP ${U.status}`);const ae=await U.json(),me=sh(ae);u(me),l(ae.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),s(null)}catch(U){s(U instanceof Error?U.message:"Failed to load config")}finally{t(!1)}},[]);f.useEffect(()=>{z()},[z]);function H(){setTimeout(()=>g(null),3e3)}async function ee(){m(!0),g(null);try{const{body:U}=oB({statuses:c,order:c.map(he=>he.id),pendingResolutions:w}),ae=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)});if(!ae.ok){const he=await ae.json().catch(()=>null);if(ae.status===409&&(he==null?void 0:he.error)==="unresolved-orphans"){const Je=Array.isArray(he.unresolved)?he.unresolved.map(Ye=>Ye.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${Je}. Click the trash icon on each row to choose remap or delete.`)}if(ae.status===409&&(he==null?void 0:he.error)==="concurrent-edit"){const Je=he.applied?` (${he.applied.remapped} remapped, ${he.applied.deleted} deleted before the conflict)`:"";g({type:"error",message:`Concurrent edit detected${Je}: ${he.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await z();return}if(ae.status===500&&(he==null?void 0:he.error)==="config-write-failed"&&(he!=null&&he.applied)){const{remapped:Je,deleted:Ye}=he.applied,ot=he.message?`: ${he.message}`:"";g({type:"error",message:`Resolutions applied (${Je} remapped, ${Ye} deleted) but the status config write failed${ot}. Click Save again to retry.`}),await z();return}throw(he==null?void 0:he.error)==="invalid-remap-target"?new Error(`Invalid remap target (${he.reason}): ${he.id} → ${he.target}.`):(he==null?void 0:he.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(he.ids??[]).join(", ")}`):(he==null?void 0:he.error)==="stale-resolution"?new Error(`Stale resolution for id "${he.id??"?"}".`):(he==null?void 0:he.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${he.message??"unknown"}`):(he==null?void 0:he.error)==="remap-write-failed"||(he==null?void 0:he.error)==="delete-failed"||(he==null?void 0:he.error)==="scan-failed"?new Error(`${he.error}: ${he.cause??"unknown"}`):new Error((he==null?void 0:he.error)??`Save failed (HTTP ${ae.status})`)}const me=await ae.json(),ve=sh(me);u(ve),l(me.custom),j(new Set(ve.map(he=>he.id))),k(new Map),b(!1),ew();const ke=me.applied?` (${me.applied.remapped} remapped, ${me.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${ke}`}),H()}catch(U){g({type:"error",message:U instanceof Error?U.message:"Save failed"})}finally{m(!1)}}async function ne(){m(!0),g(null);try{const U=await fetch("/api/config/statuses",{method:"DELETE"});if(!U.ok)throw new Error("Reset failed");const ae=await U.json(),me=sh(ae);u(me),l(ae.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),ew(),g({type:"success",message:"Reset to defaults"}),H()}catch(U){g({type:"error",message:U instanceof Error?U.message:"Reset failed"})}finally{m(!1)}}function M(U,ae,me){u(ve=>{const ke=[...ve];return ke[U]={...ke[U],[ae]:me},ke}),b(!0)}function q(){const U=`status_${c.length+1}`;u(ae=>[...ae,{rowKey:jC(),id:U,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function A(U){u(ae=>{const me=ae.filter(ke=>ke.id!==U),ve=new Set(me.map(ke=>ke.id));return k(ke=>$j(ke,ve)),me}),b(!0)}async function F(U){const ae=c[U].id;if(!C.has(ae)){A(ae);return}try{const me=await fetch(`/api/config/statuses/affected/${encodeURIComponent(ae)}`);if(!me.ok)throw new Error(`HTTP ${me.status}`);const ve=await me.json();if(ve.count===0){A(ae);return}N({open:!0,affected:ve,pendingId:ae})}catch(me){g({type:"error",message:`Could not check affected assignments for "${ae}": ${me instanceof Error?me.message:String(me)}`})}}function Z(U){if(!E.open)return;const{pendingId:ae}=E;if(ae!==U.id){N({open:!1});return}if(!c.some(me=>me.id===ae)){g({type:"error",message:`Row for "${ae}" was already removed — modal action ignored.`}),N({open:!1});return}u(me=>{const ve=me.filter(he=>he.id!==ae),ke=new Set(ve.map(he=>he.id));return k(he=>{const Je=$j(he,ke),Ye=new Map(Je);return Ye.set(ae,U),Ye}),ve}),b(!0),N({open:!1})}function I(){N({open:!1})}function de(U){const{active:ae,over:me}=U;!me||ae.id===me.id||(u(ve=>{const ke=ve.findIndex(Je=>Je.rowKey===ae.id),he=ve.findIndex(Je=>Je.rowKey===me.id);return ke===-1||he===-1?ve:wf(ve,ke,he)}),b(!0))}return e?r.jsx(mt,{label:"Loading settings..."}):n?r.jsx(wt,{error:n}):r.jsx(Wo,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs(We,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:$!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:oe,disabled:O,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[V&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${V.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:V.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:T0.map(U=>{const ae=U.slug===$;return r.jsxs("button",{type:"button",onClick:()=>W(U.slug),disabled:O,"aria-pressed":ae,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${ae?"border-primary ring-2 ring-primary/40":"border-border/60 hover:border-primary/40"}`,children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:U.swatches.amber}}),ae&&r.jsx("span",{className:"ml-auto inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground",children:r.jsx(hs,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:U.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:U.description})]})]},U.slug)})})]}),r.jsx(iB,{}),r.jsx(DB,{}),r.jsx($B,{}),r.jsx(CB,{}),r.jsx(fB,{}),r.jsxs("div",{className:`flex items-center justify-between rounded-lg border px-4 py-3 text-sm ${a?"border-primary/30 bg-primary/5 text-primary":"border-border/60 bg-muted/30 text-muted-foreground"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ng,{className:"h-4 w-4"}),a?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:ne,disabled:p||!a&&!y,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset to Defaults"]})]}),h&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),r.jsx(We,{title:"Status Definitions",description:"Define the statuses assignments can have. Drag rows to set the display order used by Kanban columns, progress bars, and dropdowns.",actions:r.jsxs("button",{className:"shell-action text-xs",onClick:q,children:[r.jsx(rn,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(aC,{sensors:P,collisionDetection:qN,onDragEnd:de,children:r.jsx(dC,{items:c.map(U=>U.rowKey),strategy:lC,children:r.jsx("div",{className:"space-y-2",children:c.map((U,ae)=>r.jsx(LB,{row:U,isSaved:C.has(U.id),onUpdate:(me,ve)=>M(ae,me,ve),onRemove:()=>F(ae)},U.rowKey))})})})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:ee,disabled:p||!y,children:[r.jsx(Id,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),z()},disabled:p,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]})]}),r.jsx(rB,{}),E.open&&r.jsx(sB,{open:E.open,affected:{...E.affected,label:((ge=c.find(U=>U.id===E.affected.id))==null?void 0:ge.label)??E.affected.id},remaining:c.filter(U=>U.id!==E.affected.id&&C.has(U.id)).map(U=>({id:U.id,label:U.label})),onResolve:Z,onCancel:I})]})})}const Ts=e=>`${e.workspace}::${e.id}`;function Lj(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function IB(){var lt;const{data:e,loading:t,error:n,refetch:s}=H0(),a=Dt(),[l,c]=f.useState(""),u=f.useRef(null);mo("list:todos");const[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(""),[C,j]=f.useState("_global"),[w,k]=f.useState(null),[E,N]=f.useState(null),[P,$]=f.useState(new Set),[T,D]=f.useState(!1),O=f.useRef(null),[J,V]=f.useState(null),L=hx("all"),[W,oe]=f.useState(null),[z,H]=f.useState(null),ee=f.useRef(null);f.useEffect(()=>{let te=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const Le=await be.json();te||V(Le.filter(it=>!it.archived))}catch{}})(),()=>{te=!0}},[]);function ne(te,be){te.stopPropagation(),navigator.clipboard.writeText(be),k(be),setTimeout(()=>k(Le=>Le===be?null:Le),1500)}const M=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const te=[];for(const be of e.workspaces)for(const Le of be.items)te.push({...Le,workspace:be.workspace});return te},[e]),q=f.useMemo(()=>{const te=new Set;for(const be of M)for(const Le of be.tags)te.add(Le);return Array.from(te).sort()},[M]),A=f.useMemo(()=>{let te=M;if(l.trim()){const be=l.toLowerCase();te=te.filter(Le=>Le.description.toLowerCase().includes(be)||Le.tags.some(it=>it.toLowerCase().includes(be))||Le.id.includes(be))}return p&&(te=te.filter(be=>be.status===p)),h&&(te=te.filter(be=>be.tags.includes(h))),te},[M,l,p,h]);f.useEffect(()=>{$(new Set),O.current=null},[l,p,h]);const F=f.useMemo(()=>A.filter(te=>P.has(Ts(te))),[A,P]),Z=A.length>0&&F.length===A.length,I=F.length>0&&!Z,de=f.useMemo(()=>{if(F.length===0)return null;const te=new Set(F.map(be=>be.workspace));return te.size===1?[...te][0]:null},[F]),ge=f.useMemo(()=>{if(!de||!J)return;const te=J.filter(be=>be.workspace===de);return te.length===1?te[0].slug:void 0},[de,J]),U=((lt=F[0])==null?void 0:lt.description)??"",ae=f.useMemo(()=>{if(de)return null;const te=new Map;for(const be of F)te.has(be.workspace)||te.set(be.workspace,[]),te.get(be.workspace).push(be.id);return Array.from(te,([be,Le])=>({workspace:be,todoIds:Le}))},[F,de]),me=de?{kind:"workspace",workspace:de}:{kind:"aggregate",groups:ae??[]};function ve(te,be,Le){const it=Ts(te),_e=!!(Le&&"shiftKey"in Le&&Le.shiftKey),bt=O.current?nt.findIndex(_t=>Ts(_t)===O.current):-1;if(_e&&bt!==-1){const _t=Math.min(bt,be),Gt=Math.max(bt,be);$(ue=>{const Be=new Set(ue);for(let Fe=_t;Fe<=Gt;Fe++){const Nt=nt[Fe];Nt&&Be.add(Ts(Nt))}return Be})}else $(_t=>{const Gt=new Set(_t);return Gt.has(it)?Gt.delete(it):Gt.add(it),Gt});O.current=it}function ke(){$(te=>{const be=new Set(te);if(Z)for(const Le of A)be.delete(Ts(Le));else for(const Le of A)be.add(Ts(Le));return be})}function he(){$(new Set),O.current=null}function Je(te){he(),s(),te!=null&&te.assignmentRef&&a(Lj(te.assignmentRef))}const Ye=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const te={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const be of e.workspaces)te.open+=be.counts.open,te.in_progress+=be.counts.in_progress,te.completed+=be.counts.completed,te.blocked+=be.counts.blocked,te.total+=be.counts.total;return te},[e]);async function ot(){y.trim()&&(await fg(C,y.trim()),b(""),s())}async function Y(te,be,Le){switch(Le){case"open":await G0(te,be);break;case"in_progress":await q0(te,be);break;case"completed":await W0(te,be);break;case"blocked":await K0(te,be);break}s()}async function Ie(te,be){await Y0(te,be),s()}async function Se(te,be,Le){await J0(te,be,Le),s()}async function Oe(te,be,Le){await X0(te,be,Le),s()}async function Xe(te,be,Le){await Q0(te,be,Le),s()}const Me=mx(A),nt=Me.filter(te=>!L.isCollapsed(te.config.id)).flatMap(te=>te.items),{hotkeyRowProps:Ke}=ac(nt,{scope:"list:todos",bindO:!1,onOpen:te=>N(Ts(te))});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var te;return(te=u.current)==null?void 0:te.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[gt,Pt]=ms(),at=gt.get("focus");f.useEffect(()=>{if(!at)return;const te=M.find(Le=>Le.id===at);if(!te)return;const be=lf(te.status);L.isCollapsed(be)&&L.toggle(be)},[at,M]),f.useEffect(()=>{if(!at)return;const te=document.querySelector(`[data-todo-id="${CSS.escape(at)}"]`);if(!te)return;te.scrollIntoView({block:"nearest"}),te.classList.add("ring-2","ring-primary/60");const be=window.setTimeout(()=>{te.classList.remove("ring-2","ring-primary/60"),Pt(Le=>{const it=new URLSearchParams(Le);return it.delete("focus"),it})},1500);return()=>window.clearTimeout(be)},[at,nt.length,Pt]);const ie=W?A.find(te=>Ts(te)===W)??null:null;function G(te,be){const Le=ee.current;if(Le!=null&&Le.closest(mi)){te.preventDefault();return}te.dataTransfer.effectAllowed="move",te.dataTransfer.setData("text/plain",be),oe(be)}function pe(){oe(null),H(null)}function Q(te,be){!ie||be.statuses.includes(ie.status)||(te.preventDefault(),te.dataTransfer.dropEffect="move",H(be.id))}function ye(te,be){z===be.id&&!te.currentTarget.contains(te.relatedTarget)&&H(null)}function Re(te,be){te.preventDefault();const Le=ie;pe(),!(!Le||be.statuses.includes(Le.status))&&Y(Le.workspace,Le.id,be.dropStatus)}return t?r.jsx(mt,{label:"Loading todos..."}):n?r.jsx(wt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(An,{label:"Open",value:Ye.open,icon:Ar}),r.jsx(An,{label:"In Progress",value:Ye.in_progress,icon:rg,tone:"info"}),r.jsx(An,{label:"Blocked",value:Ye.blocked,icon:ag,tone:"warn"}),r.jsx(An,{label:"Completed",value:Ye.completed,icon:Ar,tone:"default"})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("select",{value:C,onChange:te=>j(te.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"_global",children:"Global"}),e==null?void 0:e.workspaces.filter(te=>te.workspace!=="_global").map(te=>r.jsx("option",{value:te.workspace,children:te.workspace},te.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:te=>b(te.target.value),onKeyDown:te=>te.key==="Enter"&&ot(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:ot,disabled:!y.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(rn,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:u,type:"text",placeholder:"Search todos...",value:l,onChange:te=>c(te.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:p,onChange:te=>m(te.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),q.length>0&&r.jsxs("select",{value:h,onChange:te=>g(te.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),q.map(te=>r.jsxs("option",{value:te,children:["#",te]},te))]})]}),F.length>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[F.length," selected",de?r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",r.jsx("strong",{children:de}),")"]}):r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(F.map(te=>te.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>D(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:he,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,A.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:Z,ref:te=>{te&&(te.indeterminate=I)},onChange:ke,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",A.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let te=-1;return Me.map(({config:be,items:Le})=>{const it=!L.isCollapsed(be.id);return r.jsx(px,{label:be.label,count:Le.length,expanded:it,onToggle:()=>L.toggle(be.id),isDropTarget:z===be.id,onDragOver:_e=>Q(_e,be),onDragLeave:_e=>ye(_e,be),onDrop:_e=>Re(_e,be),children:it&&Le.map(_e=>{te+=1;const bt=te,_t=Ts(_e),Gt=P.has(_t);return r.jsxs("div",{draggable:!0,"data-todo-id":_e.id,...Ke(bt),onMouseDown:ue=>{ee.current=ue.target},onDragStart:ue=>G(ue,_t),onDragEnd:pe,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${Gt?"ring-1 ring-foreground/20":""} ${W===_t?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${_e.id}`,title:"Select",checked:Gt,onChange:()=>{},onClick:ue=>{ue.stopPropagation(),ve(_e,bt,ue)},className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(QS,{status:_e.status,onChange:ue=>Y(_e.workspace,_e.id,ue)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[r.jsx(eN,{description:_e.description,status:_e.status,editing:E===_t,onBeginEdit:()=>N(_t),onEndEdit:()=>N(null),onSave:ue=>Se(_e.workspace,_e.id,ue)}),_e.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:_e.tags.map(ue=>`#${ue}`).join(" ")}),_e.linkedAssignmentRef?r.jsxs(Ee,{to:Lj(_e.linkedAssignmentRef),"data-no-drag":!0,className:"inline-flex items-center gap-0.5 rounded-full border border-status-completed-foreground/40 bg-status-completed/30 px-1.5 py-0.5 text-[10px] font-mono text-status-completed-foreground hover:bg-status-completed/50",onClick:ue=>ue.stopPropagation(),children:[r.jsx(o0,{className:"h-2.5 w-2.5"}),_e.linkedAssignmentRef.includes("/")?_e.linkedAssignmentRef:`oneoff:${_e.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(tN,{item:_e,attachmentUrl:(ue,Be)=>pg(_e.workspace,ue,Be),onAdd:ue=>Oe(_e.workspace,_e.id,ue),onDelete:ue=>Xe(_e.workspace,_e.id,ue)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:_e.workspace!=="_global"&&r.jsx(Ee,{to:`/w/${_e.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:ue=>ue.stopPropagation(),children:_e.workspace})}),w===_e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(hs,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:ue=>ne(ue,_e.id),children:["t:",_e.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:ue=>ne(ue,_e.id),children:r.jsx(rd,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:ue=>{ue.stopPropagation(),Ie(_e.workspace,_e.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${_e.workspace}-${_e.id}`)})},be.id)})})()}),r.jsx(fx,{open:T,selectedIds:F.map(te=>te.id),scope:me,onOpenChange:D,onDone:Je,defaultProject:ge,defaultTitle:U,allowOneOff:!0})]})}const MB={open:{icon:"○",cls:"text-muted-foreground",label:"Open"},in_progress:{icon:"◉",cls:"text-status-in-progress-foreground",label:"In progress"},blocked:{icon:"✕",cls:"text-status-blocked-foreground",label:"Blocked"},completed:{icon:"✓",cls:"text-status-completed-foreground",label:"Completed"},mixed:{icon:"◐",cls:"text-muted-foreground",label:"Mixed"}};function _B({bundle:e}){const t=MB[e.derivedStatus.status],{counts:n}=e.derivedStatus;return r.jsxs("div",{className:"border rounded-md p-3 mb-2 bg-card",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:`text-lg leading-none ${t.cls}`,title:t.label,children:t.icon}),r.jsxs("span",{className:"font-mono text-sm text-muted-foreground",children:["b:",e.id]}),e.slug&&r.jsx("span",{className:"font-medium",children:e.slug}),r.jsxs("span",{className:"ml-auto text-sm text-muted-foreground",children:[n.completed,"/",n.total," done"]})]}),r.jsxs("div",{className:"mt-2 grid gap-1 text-sm",children:[e.branch&&r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Branch:"})," ",r.jsx("code",{className:"font-mono",children:e.branch})]}),e.worktreePath&&r.jsxs("div",{className:"text-muted-foreground truncate",children:[r.jsx("span",{className:"font-medium",children:"Worktree:"})," ",r.jsx("code",{className:"font-mono",children:e.worktreePath})]}),e.planDir&&r.jsxs("div",{className:"text-muted-foreground truncate",children:[r.jsx("span",{className:"font-medium",children:"Plan:"})," ",r.jsx("code",{className:"font-mono",children:e.planDir})]})]}),r.jsx("ul",{className:"mt-2 ml-6 text-sm list-disc",children:e.members.map(s=>r.jsxs("li",{className:s.status==="completed"?"line-through text-muted-foreground":"",children:[r.jsxs("span",{className:"font-mono text-xs text-muted-foreground mr-2",children:["t:",s.id]}),s.description]},s.id))})]})}function FB({bundles:e,title:t="Bundles"}){return e.length===0?null:r.jsxs("section",{className:"mb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:[t," (",e.length,")"]}),e.map(n=>r.jsx(_B,{bundle:n},n.id))]})}function zB(e){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch bundles")}finally{a(!1)}},[e]);return f.useEffect(()=>{u()},[u]),sc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function BB(){const{workspace:e}=$t(),t=e||"_global",{data:n,loading:s,error:a,refetch:l}=FR(t),{data:c}=zB(t),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,C]=f.useState(""),[j,w]=f.useState(null),[k,E]=f.useState(null),[N,P]=f.useState(new Set),[$,T]=f.useState(!1),[D,O]=f.useState(!1),[J,V]=f.useState(null),L=f.useRef(null);mo("list:todos");const W=hx("workspace:"+t),[oe,z]=f.useState(null),[H,ee]=f.useState(null),ne=f.useRef(null);function M(Q,ye){Q.stopPropagation(),navigator.clipboard.writeText(ye),w(ye),setTimeout(()=>w(Re=>Re===ye?null:Re),1500)}const q=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const Q=new Set;for(const ye of n.items)for(const Re of ye.tags)Q.add(Re);return Array.from(Q).sort()},[n]),A=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let Q=n.items;if(u.trim()){const ye=u.toLowerCase();Q=Q.filter(Re=>Re.description.toLowerCase().includes(ye)||Re.tags.some(lt=>lt.toLowerCase().includes(ye))||Re.id.includes(ye))}return m&&(Q=Q.filter(ye=>ye.status===m)),g&&(Q=Q.filter(ye=>ye.tags.includes(g))),Q},[n,u,m,g]);f.useEffect(()=>{P(new Set)},[u,m,g,t]);const F=f.useMemo(()=>A.filter(Q=>N.has(Q.id)).length,[A,N]),Z=A.length>0&&F===A.length,I=F>0&&!Z;function de(Q){P(ye=>{const Re=new Set(ye);return Re.has(Q)?Re.delete(Q):Re.add(Q),Re})}function ge(){P(Q=>{const ye=new Set(Q);if(Z)for(const Re of A)ye.delete(Re.id);else for(const Re of A)ye.add(Re.id);return ye})}function U(){P(new Set)}const ae=J?[J]:Array.from(N);function me(){P(new Set),V(null),l()}function ve(){P(new Set),l()}async function ke(){b.trim()&&(await fg(t,b.trim()),C(""),l())}async function he(Q,ye,Re){Q.stopPropagation(),window.confirm(`Delete "${Re}"? This can't be undone.`)&&(await Y0(t,ye),l())}async function Je(Q,ye){switch(ye){case"open":await G0(t,Q);break;case"in_progress":await q0(t,Q);break;case"completed":await W0(t,Q);break;case"blocked":await K0(t,Q);break}l()}async function Ye(Q,ye){await J0(t,Q,ye),l()}async function ot(Q,ye){await X0(t,Q,ye),l()}async function Y(Q,ye){await Q0(t,Q,ye),l()}const Ie=mx(A),Se=Ie.filter(Q=>!W.isCollapsed(Q.config.id)).flatMap(Q=>Q.items),{hotkeyRowProps:Oe}=ac(Se,{scope:"list:todos",bindO:!1,onOpen:Q=>E(Q.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Q;return(Q=L.current)==null?void 0:Q.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>l()});const[Xe,Me]=ms(),nt=Xe.get("focus");f.useEffect(()=>{if(!nt||!(n!=null&&n.items))return;const Q=n.items.find(Re=>Re.id===nt);if(!Q)return;const ye=lf(Q.status);W.isCollapsed(ye)&&W.toggle(ye)},[nt,n==null?void 0:n.items]),f.useEffect(()=>{if(!nt)return;const Q=document.querySelector(`[data-todo-id="${window.CSS.escape(nt)}"]`);if(!Q)return;Q.scrollIntoView({block:"nearest"}),Q.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{Q.classList.remove("ring-2","ring-primary/60"),Me(Re=>{const lt=new URLSearchParams(Re);return lt.delete("focus"),lt})},1500);return()=>window.clearTimeout(ye)},[nt,Se.length,Me]);const Ke=oe?(n==null?void 0:n.items.find(Q=>Q.id===oe))??null:null;function gt(Q,ye){const Re=ne.current;if(Re!=null&&Re.closest(mi)){Q.preventDefault();return}Q.dataTransfer.effectAllowed="move",Q.dataTransfer.setData("text/plain",ye),z(ye)}function Pt(){z(null),ee(null)}function at(Q,ye){!Ke||ye.statuses.includes(Ke.status)||(Q.preventDefault(),Q.dataTransfer.dropEffect="move",ee(ye.id))}function ie(Q,ye){H===ye.id&&!Q.currentTarget.contains(Q.relatedTarget)&&ee(null)}function G(Q,ye){Q.preventDefault();const Re=Ke;Pt(),!(!Re||ye.statuses.includes(Re.status))&&Je(Re.id,ye.dropStatus)}if(s)return r.jsx(mt,{label:"Loading todos..."});if(a)return r.jsx(wt,{error:a});const pe=(n==null?void 0:n.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(An,{label:"Open",value:pe.open,icon:Ar}),r.jsx(An,{label:"In Progress",value:pe.in_progress,icon:Ar,tone:"info"}),r.jsx(An,{label:"Blocked",value:pe.blocked,icon:ag,tone:"warn"}),r.jsx(An,{label:"Total",value:pe.total,icon:Ar})]}),c&&r.jsx(FB,{bundles:c.bundles}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:b,onChange:Q=>C(Q.target.value),onKeyDown:Q=>Q.key==="Enter"&&ke(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:ke,disabled:!b.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(rn,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:L,type:"text",placeholder:"Search...",value:u,onChange:Q=>p(Q.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:m,onChange:Q=>h(Q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),q.length>0&&r.jsxs("select",{value:g,onChange:Q=>y(Q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),q.map(Q=>r.jsxs("option",{value:Q,children:["#",Q]},Q))]})]}),N.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[N.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>T(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{V(null),O(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:U,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,A.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:Z,ref:Q=>{Q&&(Q.indeterminate=I)},onChange:ge,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",A.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let Q=-1;return Ie.map(({config:ye,items:Re})=>{const lt=!W.isCollapsed(ye.id);return r.jsx(px,{label:ye.label,count:Re.length,expanded:lt,onToggle:()=>W.toggle(ye.id),isDropTarget:H===ye.id,onDragOver:te=>at(te,ye),onDragLeave:te=>ie(te,ye),onDrop:te=>G(te,ye),children:lt&&Re.map(te=>(Q+=1,r.jsx(ZS,{item:te,copiedId:j,selected:N.has(te.id),editing:k===te.id,onBeginEdit:be=>E(be),onEndEdit:()=>E(null),onPatchDescription:Ye,onAddAttachments:ot,onDeleteAttachment:Y,attachmentUrl:(be,Le)=>pg(t,be,Le),onToggleSelected:be=>de(be),onMoveOne:(be,Le)=>{Le.stopPropagation(),V(be),O(!0)},onStatusChange:Je,onCopyId:M,onDelete:he,hotkeyRowProps:Oe(Q),onDragOrigin:be=>{ne.current=be.target},onDragStart:gt,onDragEnd:Pt,isDragging:oe===te.id},te.id)))},ye.id)})})()}),r.jsx(fx,{open:$,selectedIds:Array.from(N),scope:{kind:"workspace",workspace:t},onOpenChange:T,onDone:ve}),r.jsx(rN,{open:D,selectedIds:ae,scope:{kind:"workspace",workspace:t},onOpenChange:Q=>{O(Q),Q||V(null)},onDone:me})]})}function kC(){const{views:e}=Vd();async function t(a,l,c){const u=e.find(h=>h.id===a.id)??a,p=hN(c,u.workspace).config,m=jx(u.config,p,u.config);await $g(a.id,{name:l,config:m})}async function n(a){await Wd({name:`${a.name} (copy)`,workspace:a.workspace,config:a.config})}async function s(a){await WD(a.id)}return{submitEdit:t,duplicate:n,remove:s}}const Oj=80,UB={kanban:"Kanban",list:"List",table:"Table"},VB={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function SC({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:a}){const l=!!s,c=Zo(),u=ef(),{data:p}=Jo(),{data:m}=Md(),[h,g]=f.useState(""),[y,b]=f.useState(Wa.viewMode),[C,j]=f.useState([]),[w,k]=f.useState([]),[E,N]=f.useState([]),[P,$]=f.useState([]),[T,D]=f.useState([]),[O,J]=f.useState([]),[V,L]=f.useState("all"),[W,oe]=f.useState(null),[z,H]=f.useState(""),[ee,ne]=f.useState(Wa.sortField),[M,q]=f.useState(Wa.sortDirection),[A,F]=f.useState(!1),[Z,I]=f.useState(null);function de(){b(Wa.viewMode),j([]),k([]),N([]),$([]),D([]),J([]),L("all"),oe(null),H(""),ne(Wa.sortField),q(Wa.sortDirection)}f.useEffect(()=>{if(e)if(I(null),F(!1),s){const Y=s.config.filters;g(s.name),b(s.config.viewMode),j(tt(Y.status)),k(tt(Y.priority)),N(tt(Y.type)),$(tt(Y.project)),D(tt(Y.assignee)),J(tt(Y.tags)),L(Y.activity??"all"),oe(gN(Y.dateRange)),H(Y.search??""),ne(s.config.sortField),q(s.config.sortDirection)}else g(""),de()},[e,s]);const ge=Y=>Ie=>Y?Y==="_ungrouped"?Ie.projectWorkspace===null:Ie.projectWorkspace===Y:!0,U=f.useMemo(()=>{const Y=Se=>n?n==="_ungrouped"?Se.workspace===null:Se.workspace===n:!0,Ie=(p??[]).filter(Y);return[{value:"__standalone__",label:"No project"},...Ie.map(Se=>({value:Se.slug,label:Se.title}))]},[p,n]),ae=f.useMemo(()=>{const Y=new Set,Ie=ge(n);for(const Oe of(m==null?void 0:m.assignments)??[])Ie(Oe)&&Oe.assignee&&Y.add(Oe.assignee);const Se=[{value:"__unassigned__",label:"Unassigned"}];for(const Oe of Array.from(Y).sort())Se.push({value:Oe,label:Oe});return Se},[m,n]),me=f.useMemo(()=>{const Y=new Set,Ie=ge(n);for(const Se of(m==null?void 0:m.assignments)??[])if(Ie(Se))for(const Oe of Se.tags??[])Y.add(Oe);return Array.from(Y).sort().map(Se=>({value:Se,label:Se}))},[m,n]),ve=f.useMemo(()=>c.order.map(Y=>({value:Y,label:cc(c,Y)})),[c]),ke=f.useMemo(()=>nF.map(Y=>({value:Y,label:Y[0].toUpperCase()+Y.slice(1)})),[]),he=f.useMemo(()=>u.definitions.map(Y=>({value:Y.id,label:ii(u,Y.id)})),[u]),Je=Rg.map(Y=>({value:Y,label:UB[Y]})),Ye=h.trim(),ot=Ye.length>0&&Ye.length<=Oj;return r.jsx(ar,{open:e,onOpenChange:t,children:r.jsx(Kn,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async Y=>{if(Y.preventDefault(),!ot||A)return;F(!0),I(null);const Ie={viewMode:y,filters:{status:C,priority:w,type:E,project:P,assignee:T,tags:O,activity:V,dateRange:Xl(W),search:z},sortField:ee,sortDirection:M};try{await a(Ye,Ie)}catch(Se){I(Se instanceof Error?Se.message:String(Se)),F(!1)}},children:[r.jsx(Qr,{children:r.jsx(qn,{children:l?"Edit view":"Create view"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-view-name",children:"Name"}),r.jsx("input",{id:"create-view-name",type:"text",value:h,autoFocus:!0,required:!0,maxLength:Oj,onChange:Y=>g(Y.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"View mode"}),r.jsx(nf,{value:y,onChange:Y=>b(Y),options:Je})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ss,{label:"Status",children:r.jsx(Rn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:ve,value:C,onChange:j})}),r.jsx(ss,{label:"Priority",children:r.jsx(Rn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:ke,value:w,onChange:k})}),r.jsx(ss,{label:"Type",children:r.jsx(Rn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:he,value:E,onChange:N})}),r.jsx(ss,{label:"Project",children:r.jsx(Rn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:U,value:P,onChange:$})}),r.jsx(ss,{label:"Assignee",children:r.jsx(Rn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ae,value:T,onChange:D})}),r.jsx(ss,{label:"Tags",children:r.jsx(Rn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:me,value:O,onChange:J})}),r.jsx(ss,{label:"Activity",children:r.jsxs("select",{value:V,onChange:Y=>L(Y.target.value),className:"editor-input w-full",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(ss,{label:"Date range",children:r.jsx(wx,{className:"w-full",value:W,onChange:oe})}),r.jsx(ss,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:z,onChange:Y=>H(Y.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(ss,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:ee,onChange:Y=>ne(Y.target.value),className:"editor-input w-full",children:n1.map(Y=>r.jsx("option",{value:Y,children:VB[Y]},Y))}),r.jsx("button",{type:"button",onClick:()=>q(Y=>Y==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:M==="asc"?"Ascending":"Descending",children:M==="asc"?"Asc":"Desc"})]})})]}),Z?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:Z}):null,r.jsxs(Ls,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:de,className:"shell-action",disabled:A,children:"Clear all"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:A,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!ot||A,className:"shell-action shell-action--cta disabled:opacity-50",children:A?"Saving…":l?"Save changes":"Create view"})]})]})]})})})}function ss({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const HB={kanban:"Kanban",list:"List",table:"Table"};function Ij(){const{workspace:e}=$t(),{views:t,loading:n}=Vd(),{submitEdit:s,duplicate:a,remove:l}=kC(),{toast:c,showToast:u,dismissToast:p}=ta(),[m,h]=f.useState(null),[g,y]=f.useState(!1),[b,C]=f.useState(!1),[j,w]=f.useState(null);async function k(T,D){const{workspace:O,config:J}=hN(D,e??null);try{await Wd({name:T,workspace:O,config:J}),C(!1),u(`Created view "${T}"`)}catch(V){throw u(V instanceof Error?V.message:"Failed to create saved view"),V}}async function E(T,D,O){try{await s(T,D,O),w(null),u(`Updated view "${D}"`)}catch(J){throw u(J instanceof Error?J.message:"Failed to update saved view"),J}}async function N(T){try{await a(T),u(`Duplicated "${T.name}"`)}catch(D){u(D instanceof Error?D.message:"Failed to duplicate saved view")}}async function P(){if(m){y(!0);try{await l(m),h(null)}catch(T){u(T instanceof Error?T.message:"Failed to delete saved view")}finally{y(!1)}}}const $=r.jsxs("button",{type:"button",onClick:()=>C(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(rn,{className:"h-4 w-4"}),"Create view"]});return r.jsxs("div",{className:"space-y-4",children:[r.jsx(xd,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:$}),n?r.jsx(mt,{label:"Loading saved views…"}):t.length===0?r.jsx(St,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:$}):r.jsx(We,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(T=>r.jsx(WB,{view:T,onRequestDelete:()=>h(T),onRequestEdit:()=>w(T),onRequestDuplicate:()=>void N(T)},T.id))})}),r.jsx(SC,{open:b||j!==null,onOpenChange:T=>{T||(C(!1),w(null))},workspace:j?j.workspace:e??null,initialView:j,onSubmit:j?(T,D)=>E(j,T,D):k}),r.jsx(sa,{open:m!==null,title:"Delete saved view?",description:m?`Delete '${m.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:g,destructive:!0,onConfirm:P,onOpenChange:T=>{!T&&!g&&h(null)}}),r.jsx(na,{toast:c,onDismiss:p})]})}function WB({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const a=Dt(),l=()=>a(yN(e)),c=vN(e.config.filters),u=e.workspace?yn(e.workspace):null;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,className:"truncate text-left text-sm font-semibold text-foreground hover:text-primary",title:"Open view",children:e.name}),r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:HB[e.config.viewMode]}),u?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:u}):null]}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:c})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,className:"shell-action",children:"Open"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const KB={kanban:"Kanban",list:"List",table:"Table"};function Mj(){const{id:e,workspace:t}=$t(),n=Dt(),{view:s,ready:a,error:l,refetch:c}=Go(e),{submitEdit:u,duplicate:p,remove:m}=kC(),{toast:h,showToast:g,dismissToast:y}=ta(),[b,C]=f.useState(!1),[j,w]=f.useState(!1),[k,E]=f.useState(!1);if(f.useEffect(()=>{!a||!s||(t??null)!==(s.workspace??null)&&n(yN(s),{replace:!0})},[a,s,t,n]),!a)return r.jsx(mt,{label:"Loading view…"});if(l)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-6 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:l.message}),r.jsx("button",{type:"button",onClick:()=>c(),className:"shell-action mt-3",children:"Retry"})]});if(!s)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(xd,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ee,{to:Xu(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(td,{className:"h-4 w-4"})," Back to Saved Views"]})]});const N=s.workspace?yn(s.workspace):null;async function P(D,O){const J=s;try{await u(J,D,O),C(!1),g(`Updated view "${D}"`)}catch(V){throw g(V instanceof Error?V.message:"Failed to update saved view"),V}}async function $(){const D=s;try{await p(D),g(`Duplicated "${D.name}"`)}catch(O){g(O instanceof Error?O.message:"Failed to duplicate saved view")}}async function T(){const D=s;E(!0);try{await m(D),w(!1),n(Xu(D.workspace))}catch(O){g(O instanceof Error?O.message:"Failed to delete saved view")}finally{E(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ee,{to:Xu(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(td,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(xd,{title:s.name,description:vN(s.config.filters),actions:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:KB[s.config.viewMode]}),N?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:N}):null,r.jsx("button",{type:"button",onClick:()=>C(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void $(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(bN(s)),className:"shell-action",children:"Open on board"}),r.jsx("button",{type:"button",onClick:()=>w(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),r.jsx(K1,{view:s}),b?r.jsx(SC,{open:b,onOpenChange:C,workspace:s.workspace,initialView:s,onSubmit:P}):null,r.jsx(sa,{open:j,title:"Delete saved view?",description:`Delete '${s.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:k,destructive:!0,onConfirm:T,onOpenChange:D=>{!D&&!k&&w(!1)}}),r.jsx(na,{toast:h,onDismiss:y})]})}function qB(){return r.jsx(MT,{children:r.jsx(Q3,{children:r.jsx(fT,{children:r.jsxs(He,{element:r.jsx(ED,{}),children:[r.jsx(He,{path:"/",element:r.jsx(hL,{})}),r.jsx(He,{path:"/projects",element:r.jsx(rw,{})}),r.jsx(He,{path:"/archive",element:r.jsx(AL,{})}),r.jsx(He,{path:"/assignments",element:r.jsx(cj,{})}),r.jsx(He,{path:"/assignments/new",element:r.jsx(pj,{})}),r.jsx(He,{path:"/assignments/:id",element:r.jsx(RF,{})}),r.jsx(He,{path:"/assignments/:id/edit",element:r.jsx(Ym,{})}),r.jsx(He,{path:"/assignments/:id/plan/edit",element:r.jsx(Jm,{})}),r.jsx(He,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(Xm,{})}),r.jsx(He,{path:"/assignments/:id/handoff/edit",element:r.jsx(Qm,{})}),r.jsx(He,{path:"/assignments/:id/decision-record/edit",element:r.jsx(Zm,{})}),r.jsx(He,{path:"/servers",element:r.jsx(hj,{})}),r.jsx(He,{path:"/inventories",element:r.jsx(gj,{})}),r.jsx(He,{path:"/usage",element:r.jsx(xj,{})}),r.jsx(He,{path:"/agent-sessions",element:r.jsx(yj,{})}),r.jsx(He,{path:"/playbooks",element:r.jsx(l6,{})}),r.jsx(He,{path:"/playbooks/create",element:r.jsx(u6,{})}),r.jsx(He,{path:"/playbooks/:slug",element:r.jsx(c6,{})}),r.jsx(He,{path:"/playbooks/:slug/edit",element:r.jsx(d6,{})}),r.jsx(He,{path:"/memories",element:r.jsx(f6,{})}),r.jsx(He,{path:"/memories/new",element:r.jsx(m6,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(p6,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(h6,{})}),r.jsx(He,{path:"/resources",element:r.jsx(g6,{})}),r.jsx(He,{path:"/resources/new",element:r.jsx(y6,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(x6,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(b6,{})}),r.jsx(He,{path:"/todos",element:r.jsx(IB,{})}),r.jsx(He,{path:"/views",element:r.jsx(Ij,{})}),r.jsx(He,{path:"/views/:id",element:r.jsx(Mj,{})}),r.jsx(He,{path:"/help",element:r.jsx(xL,{})}),r.jsx(He,{path:"/settings",element:r.jsx(OB,{})}),r.jsx(He,{path:"/create/project",element:r.jsx(dj,{})}),r.jsx(He,{path:"/projects/:slug",element:r.jsx(sj,{})}),r.jsx(He,{path:"/projects/:slug/edit",element:r.jsx(mj,{})}),r.jsx(He,{path:"/projects/:slug/create/assignment",element:r.jsx(fj,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(aj,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(Ym,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Jm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Xm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Qm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Zm,{})}),r.jsx(He,{path:"/w/:workspace/projects",element:r.jsx(rw,{})}),r.jsx(He,{path:"/w/:workspace/assignments",element:r.jsx(cj,{})}),r.jsx(He,{path:"/w/:workspace/assignments/new",element:r.jsx(pj,{})}),r.jsx(He,{path:"/w/:workspace/servers",element:r.jsx(hj,{})}),r.jsx(He,{path:"/w/:workspace/inventories",element:r.jsx(gj,{})}),r.jsx(He,{path:"/w/:workspace/usage",element:r.jsx(xj,{})}),r.jsx(He,{path:"/w/:workspace/agent-sessions",element:r.jsx(yj,{})}),r.jsx(He,{path:"/w/:workspace/todos",element:r.jsx(BB,{})}),r.jsx(He,{path:"/w/:workspace/views",element:r.jsx(Ij,{})}),r.jsx(He,{path:"/w/:workspace/views/:id",element:r.jsx(Mj,{})}),r.jsx(He,{path:"/w/:workspace/create/project",element:r.jsx(dj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug",element:r.jsx(sj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(mj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(fj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(aj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(Ym,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Jm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Xm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Qm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Zm,{})})]})})})})}gR();f2.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(xR,{children:r.jsx(qB,{})})}));export{nO as _,YB as a,Td as g};
|