maestro-flow 0.3.11 → 0.3.12

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.
Files changed (164) hide show
  1. package/.claude/agents/conceptual-planning-agent.md +1 -0
  2. package/.claude/agents/workflow-analyzer.md +114 -114
  3. package/.claude/agents/workflow-collab-planner.md +144 -144
  4. package/.claude/agents/workflow-debugger.md +102 -103
  5. package/.claude/agents/workflow-executor.md +127 -128
  6. package/.claude/agents/workflow-integration-checker.md +82 -82
  7. package/.claude/agents/workflow-nyquist-auditor.md +85 -84
  8. package/.claude/agents/workflow-phase-researcher.md +85 -85
  9. package/.claude/agents/workflow-plan-checker.md +90 -90
  10. package/.claude/agents/workflow-planner.md +178 -178
  11. package/.claude/agents/workflow-roadmapper.md +81 -83
  12. package/.claude/agents/workflow-verifier.md +119 -119
  13. package/.claude/commands/learn-retro.md +2 -2
  14. package/.claude/commands/learn-second-opinion.md +2 -2
  15. package/.claude/commands/maestro-brainstorm.md +1 -0
  16. package/.claude/commands/maestro-fork.md +133 -111
  17. package/.claude/commands/maestro-merge.md +85 -77
  18. package/.claude/commands/maestro-plan.md +88 -2
  19. package/.claude/commands/maestro-roadmap.md +113 -2
  20. package/.claude/commands/maestro.md +1 -0
  21. package/.claude/commands/quality-business-test.md +5 -5
  22. package/.claude/commands/quality-debug.md +3 -2
  23. package/.claude/commands/quality-retrospective.md +6 -4
  24. package/.claude/commands/quality-review.md +1 -1
  25. package/.claude/commands/quality-test-gen.md +5 -4
  26. package/.codex/skills/maestro-brainstorm/SKILL.md +1 -1
  27. package/.codex/skills/maestro-fork/SKILL.md +98 -68
  28. package/.codex/skills/maestro-init/SKILL.md +4 -3
  29. package/.codex/skills/maestro-merge/SKILL.md +69 -62
  30. package/.codex/skills/maestro-ui-design/SKILL.md +1 -1
  31. package/.codex/skills/maestro-verify/SKILL.md +12 -12
  32. package/.codex/skills/manage-learn/SKILL.md +1 -1
  33. package/.codex/skills/manage-status/SKILL.md +4 -4
  34. package/.codex/skills/quality-business-test/SKILL.md +2 -2
  35. package/.codex/skills/quality-integration-test/SKILL.md +1 -1
  36. package/.codex/skills/quality-retrospective/SKILL.md +7 -7
  37. package/.codex/skills/quality-review/SKILL.md +2 -2
  38. package/.codex/skills/quality-test/SKILL.md +2 -2
  39. package/.codex/skills/quality-test-gen/SKILL.md +1 -1
  40. package/README.md +2 -0
  41. package/README.zh-CN.md +2 -0
  42. package/dashboard/dist/assets/{ArtifactsPage-DZNCi6tn.js → ArtifactsPage-CUrrDGgN.js} +1 -1
  43. package/dashboard/dist/assets/ChatInput-pUOLJIKE.js +49 -0
  44. package/dashboard/dist/assets/ChatPage-B8Xqkt0v.js +27 -0
  45. package/dashboard/dist/assets/{CollabPage-B4NAHXS2.js → CollabPage-DIUXeazv.js} +1 -1
  46. package/dashboard/dist/assets/{ExecutionPanel-CFt4LJyq.js → ExecutionPanel-VmYeADFj.js} +1 -1
  47. package/dashboard/dist/assets/KanbanPage-DLq8v7hg.js +21 -0
  48. package/dashboard/dist/assets/{MarkdownRenderer-X4af_WNb.js → MarkdownRenderer-D7AehrnR.js} +1 -1
  49. package/dashboard/dist/assets/{McpPage-BKfCVIyU.js → McpPage-BY0SjTgw.js} +2 -2
  50. package/dashboard/dist/assets/{OutputPanel-BlBQFJSW.js → OutputPanel-B-Rjwgmv.js} +1 -1
  51. package/dashboard/dist/assets/{ProblemsPanel-De3DLvoI.js → ProblemsPanel-GEpF-oi4.js} +1 -1
  52. package/dashboard/dist/assets/RequirementBoardPage-xs8uDM7I.js +6 -0
  53. package/dashboard/dist/assets/{RequirementPage-Bllxe2XI.js → RequirementPage-BKDSFwjA.js} +5 -10
  54. package/dashboard/dist/assets/SpecsPage-DLFb9ZH0.js +36 -0
  55. package/dashboard/dist/assets/SupervisorPage-SOki_kgz.js +6 -0
  56. package/dashboard/dist/assets/TeamsPage-BO2kP70F.js +11 -0
  57. package/dashboard/dist/assets/{TreeBrowser-Q12qobZs.js → TreeBrowser-B9DHdULE.js} +1 -1
  58. package/dashboard/dist/assets/{WorkflowPage-D_Fzdy3_.js → WorkflowPage-C8hWbYim.js} +1 -1
  59. package/dashboard/dist/assets/{check-u6fGOwQO.js → check-DJDk3A2a.js} +1 -1
  60. package/dashboard/dist/assets/{chevron-right-Csu22t58.js → chevron-right-C7bVDreZ.js} +1 -1
  61. package/dashboard/dist/assets/{circle-CMrkbRNg.js → circle-Qfgy4LB_.js} +1 -1
  62. package/dashboard/dist/assets/{circle-alert-c3tH1P4z.js → circle-alert-Na1vf6qQ.js} +1 -1
  63. package/dashboard/dist/assets/{circle-check-gYxxSYuH.js → circle-check-CEGgy3NV.js} +1 -1
  64. package/dashboard/dist/assets/{circle-check-big-TDSeWstm.js → circle-check-big-3JB8zRYj.js} +1 -1
  65. package/dashboard/dist/assets/{code-CFN2uX9V.js → code-Ble63Idz.js} +1 -1
  66. package/dashboard/dist/assets/{columns-3-38xIDlzy.js → columns-3-BUcKlxve.js} +1 -1
  67. package/dashboard/dist/assets/{download-DC7KkKyP.js → download-CMqkfn8x.js} +1 -1
  68. package/dashboard/dist/assets/{folder-CWq_lAnf.js → folder-B9ewx9LL.js} +1 -1
  69. package/dashboard/dist/assets/index-C2Mcb4TJ.js +231 -0
  70. package/dashboard/dist/assets/index-DyBbPc18.css +1 -0
  71. package/dashboard/dist/assets/{index-Do71weNR.js → index-JTmGteaT.js} +1 -1
  72. package/dashboard/dist/assets/{list-CgIP_2A-.js → list-DI8Wn2aT.js} +1 -1
  73. package/dashboard/dist/assets/loader-B5F6PzFT.js +11 -0
  74. package/dashboard/dist/assets/{minus-DYoN5UGk.js → minus-Lp_BfctG.js} +1 -1
  75. package/dashboard/dist/assets/{pen-line-Bh_WKYHm.js → pen-line-Ch7sphzZ.js} +1 -1
  76. package/dashboard/dist/assets/pencil-_yRMHmGT.js +6 -0
  77. package/dashboard/dist/assets/{proxy-BKxDAKTj.js → proxy-D72Y8a4Y.js} +1 -1
  78. package/dashboard/dist/assets/{search-SieXnOgr.js → search-BS6fI6Bg.js} +1 -1
  79. package/dashboard/dist/assets/{shallow-Bme1JY57.js → shallow-BXasQBvr.js} +1 -1
  80. package/dashboard/dist/assets/table-CeGlFjlP.js +6 -0
  81. package/dashboard/dist/assets/{terminal-BB3Xfuv5.js → terminal-BJic2yW-.js} +1 -1
  82. package/dashboard/dist/assets/{trash-2-C8f4vFFM.js → trash-2-Czz4X8Fb.js} +1 -1
  83. package/dashboard/dist/assets/{zap-4uwlzVm0.js → zap-C3H0jVFA.js} +1 -1
  84. package/dashboard/dist/index.html +2 -2
  85. package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js +16 -1
  86. package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js.map +1 -1
  87. package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js +1 -2
  88. package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js.map +1 -1
  89. package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.d.ts +1 -1
  90. package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js +2 -1
  91. package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js.map +1 -1
  92. package/dashboard/dist-server/dashboard/src/server/index.js +3 -0
  93. package/dashboard/dist-server/dashboard/src/server/index.js.map +1 -1
  94. package/dashboard/dist-server/dashboard/src/server/routes/collab.js +124 -0
  95. package/dashboard/dist-server/dashboard/src/server/routes/collab.js.map +1 -1
  96. package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.d.ts +10 -0
  97. package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js +73 -0
  98. package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js.map +1 -0
  99. package/dashboard/dist-server/dashboard/src/shared/collab-types.d.ts +31 -0
  100. package/dashboard/dist-server/dashboard/src/shared/collab-types.js +28 -0
  101. package/dashboard/dist-server/dashboard/src/shared/collab-types.js.map +1 -1
  102. package/dashboard/dist-server/dashboard/src/shared/constants.js +5 -0
  103. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  104. package/dashboard/dist-server/dashboard/src/shared/coordinate-types.d.ts +22 -0
  105. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +12 -0
  106. package/dashboard/dist-server/dashboard/src/shared/issue-types.js +12 -0
  107. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  108. package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +1 -0
  109. package/dashboard/dist-server/dashboard/src/shared/team-types.js +7 -0
  110. package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
  111. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +27 -1
  112. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
  113. package/dashboard/dist-server/shared/agent-types.d.ts +4 -0
  114. package/dashboard/dist-server/src/hooks/constants.d.ts +1 -1
  115. package/dashboard/dist-server/src/hooks/constants.js +2 -2
  116. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  117. package/dist/shared/agent-types.d.ts +4 -0
  118. package/dist/shared/agent-types.d.ts.map +1 -1
  119. package/dist/src/commands/install-backend.d.ts.map +1 -1
  120. package/dist/src/commands/install-backend.js +29 -18
  121. package/dist/src/commands/install-backend.js.map +1 -1
  122. package/dist/src/hooks/__tests__/statusline-visual-test.js +23 -1
  123. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -1
  124. package/dist/src/hooks/constants.d.ts +1 -1
  125. package/dist/src/hooks/constants.d.ts.map +1 -1
  126. package/dist/src/hooks/constants.js +2 -2
  127. package/dist/src/hooks/constants.js.map +1 -1
  128. package/dist/src/hooks/skill-context.d.ts +3 -0
  129. package/dist/src/hooks/skill-context.d.ts.map +1 -1
  130. package/dist/src/hooks/skill-context.js +95 -9
  131. package/dist/src/hooks/skill-context.js.map +1 -1
  132. package/dist/src/hooks/statusline.d.ts.map +1 -1
  133. package/dist/src/hooks/statusline.js +6 -3
  134. package/dist/src/hooks/statusline.js.map +1 -1
  135. package/dist/src/tools/merge-validator.d.ts.map +1 -1
  136. package/dist/src/tools/merge-validator.js +114 -16
  137. package/dist/src/tools/merge-validator.js.map +1 -1
  138. package/package.json +1 -1
  139. package/shared/agent-types.ts +4 -0
  140. package/templates/worktree-scope.json +9 -10
  141. package/templates/worktrees.json +26 -27
  142. package/workflows/brainstorm.md +10 -1
  143. package/workflows/debug.md +16 -6
  144. package/workflows/fork.md +100 -36
  145. package/workflows/integration-test.md +14 -2
  146. package/workflows/issue.md +14 -4
  147. package/workflows/learn.md +19 -5
  148. package/workflows/maestro.md +1 -0
  149. package/workflows/merge.md +113 -55
  150. package/workflows/retrospective.md +61 -22
  151. package/workflows/review.md +17 -4
  152. package/workflows/test.md +12 -2
  153. package/workflows/ui-style.md +9 -2
  154. package/dashboard/dist/assets/ChatInput-Bvr-FeEq.js +0 -49
  155. package/dashboard/dist/assets/ChatPage-D9zTkJZo.js +0 -22
  156. package/dashboard/dist/assets/KanbanPage-C8USth6H.js +0 -21
  157. package/dashboard/dist/assets/RequirementBoardPage-Bf1trzqs.js +0 -11
  158. package/dashboard/dist/assets/SpecsPage-9lwxKT27.js +0 -36
  159. package/dashboard/dist/assets/SupervisorPage-SusdfHFq.js +0 -6
  160. package/dashboard/dist/assets/TeamsPage-DsuM6OwC.js +0 -6
  161. package/dashboard/dist/assets/arrow-left-Bqtb2hle.js +0 -6
  162. package/dashboard/dist/assets/index-DWG-WrzT.js +0 -231
  163. package/dashboard/dist/assets/index-GUNJodSR.css +0 -1
  164. package/dashboard/dist/assets/table-llyEtj-7.js +0 -6
@@ -0,0 +1,27 @@
1
+ var En=e=>{throw TypeError(e)};var kn=(e,t,n)=>t.has(e)||En("Cannot "+n);var We=(e,t,n)=>(kn(e,t,"read from private field"),n?n.call(e):t.get(e)),Pn=(e,t,n)=>t.has(e)?En("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Tn=(e,t,n,r)=>(kn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{d as Zt,k as B,r as f,s as dt,j as c,X as wr,q as fe,t as Cr,F as An,v as Xe,w as Sr,M as ss,x as qt,y as et,z as be,D as ae,E as te,G as _t,H as tt,J as is,K as F,N as as,Q as wt,U as cs,Y as ls,Z as us,_ as ds,$ as fs,a0 as ps,a1 as hs}from"./index-C2Mcb4TJ.js";import{C as In,M as xs}from"./ChatInput-pUOLJIKE.js";import{T as ms}from"./TreeBrowser-B9DHdULE.js";import{P as gs}from"./pencil-_yRMHmGT.js";import{T as Rr}from"./trash-2-Czz4X8Fb.js";import"./zap-C3H0jVFA.js";import"./MarkdownRenderer-D7AehrnR.js";import"./chevron-right-C7bVDreZ.js";import"./terminal-BJic2yW-.js";import"./circle-alert-Na1vf6qQ.js";import"./search-BS6fI6Bg.js";import"./folder-B9ewx9LL.js";/**
2
+ * @license lucide-react v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const vs=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ys=Zt("copy",vs);/**
7
+ * @license lucide-react v0.577.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const bs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],ws=Zt("rows-2",bs);/**
12
+ * @license lucide-react v0.577.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Cs=[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],Ss=Zt("square-split-horizontal",Cs);function Rs(e){const t=B(r=>r.pendingApprovals),n=f.useMemo(()=>e?Object.values(t).find(r=>r.processId===e)??null:null,[e,t]);f.useEffect(()=>{if(!n)return;function r(o){const s=o.target;if(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable)return;const a=o.key;if(a==="y"||a==="Y"){o.preventDefault(),dt({action:"approve",processId:n.processId,requestId:n.id,allow:!0});return}if(a==="Escape"){o.preventDefault(),dt({action:"approve",processId:n.processId,requestId:n.id,allow:!1});return}if(a==="a"||a==="A"){o.preventDefault(),dt({action:"approve",processId:n.processId,requestId:n.id,allow:!0});return}}return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[n])}const jr=f.createContext(null);function js({children:e,content:t}){return c.jsx(jr,{value:t,children:e})}function Ms(){return f.useContext(jr)}const Es={spawning:"var(--color-accent-blue)",running:"var(--color-accent-green, #4caf50)",paused:"var(--color-accent-yellow)",stopping:"var(--color-accent-orange)",stopped:"var(--color-text-tertiary)",error:"var(--color-accent-red, #e53935)"},Nn={spawning:"starting",running:"running",paused:"paused",stopping:"stopping",error:"error"},ks=f.memo(function({tab:t,isActive:n,isFocused:r,processStatus:o,onSelect:s,onClose:a,onDragStart:l,groupId:i}){const u=f.useCallback(()=>{s(t.id)},[s,t.id]),d=f.useCallback(m=>{m.stopPropagation(),a(t.id)},[a,t.id]),h=f.useCallback(m=>{l(t.id,m)},[l,t.id]),p=f.useCallback(m=>{m.preventDefault(),m.dataTransfer.dropEffect="move"},[]),x=o?Es[o]??"var(--color-text-tertiary)":void 0;return c.jsxs("div",{role:"tab","aria-selected":n,tabIndex:n?0:-1,className:`
17
+ group relative flex items-center gap-[var(--spacing-1)] h-[28px]
18
+ min-w-[100px] max-w-[240px] px-[var(--spacing-2)] cursor-pointer
19
+ select-none whitespace-nowrap transition-colors duration-100
20
+ text-[length:var(--font-size-xs)]
21
+ ${n?"bg-bg-primary text-text-primary border-b-[2px] border-b-accent-blue":"text-text-tertiary hover:bg-bg-hover border-b-[2px] border-b-transparent"}
22
+
23
+ `,style:{flexShrink:1},onClick:u,onDragStart:h,onDragOver:p,draggable:!0,"data-tab-id":t.id,"data-group-id":i,title:t.title,children:[c.jsx("svg",{className:"shrink-0",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",stroke:x??"var(--color-accent-green)",children:c.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),c.jsx("span",{className:"truncate flex-1 min-w-0",children:t.title}),o&&Nn[o]&&c.jsxs("span",{className:"text-[9px] font-normal shrink-0",style:{color:n?"var(--color-text-tertiary)":"var(--color-text-placeholder)"},children:["· ",Nn[o]]}),c.jsx("button",{className:`
24
+ p-[2px] rounded-[var(--radius-sm)] hover:bg-bg-active transition-opacity shrink-0
25
+ ${n?"opacity-100":"opacity-0 group-hover:opacity-100"}
26
+ `,onClick:d,"aria-label":`Close ${t.title}`,tabIndex:-1,children:c.jsx(wr,{size:12,className:"text-text-tertiary"})})]})}),Ln="application/json",On="maestro-tab-drag";function Dt(e){return e.type==="leaf"?[e]:[...Dt(e.first),...Dt(e.second)]}const Ps=f.memo(function({tabs:t,activeTabId:n,groupId:r,isFocused:o,onTabSelect:s,onTabClose:a}){const{state:l,dispatch:i}=fe(),u=B(m=>m.processes),d=f.useRef(null),h=f.useCallback((m,g)=>{const v=t.find(w=>w.id===m);if(!v)return;const y={type:On,tabId:m,sourceGroupId:r,processId:v.ref};g.dataTransfer.setData(Ln,JSON.stringify(y)),g.dataTransfer.effectAllowed="move"},[t,r]),p=f.useCallback(m=>{m.preventDefault();const g=m.dataTransfer.getData(Ln);if(!g)return;let v;try{v=JSON.parse(g)}catch{return}if(v.type!==On)return;const y=Dt(l.editorArea).find(b=>b.id===v.sourceGroupId);if(!y)return;const w=y.tabs.find(b=>b.id===v.tabId);w&&(v.sourceGroupId===r?i({type:"SET_ACTIVE_TAB",groupId:r,tabId:v.tabId}):(i({type:"CLOSE_TAB",groupId:v.sourceGroupId,tabId:v.tabId}),i({type:"OPEN_TAB",groupId:r,tab:w})))},[l.editorArea,r,i]),x=f.useCallback(m=>{m.preventDefault(),m.dataTransfer.dropEffect="move"},[]);return c.jsxs("div",{className:"flex items-center h-[var(--size-tabbar-height)] min-h-[var(--size-tabbar-height)] bg-bg-secondary",onDrop:p,onDragOver:x,"data-tab-bar":r,children:[c.jsx("div",{ref:d,className:"flex items-end h-full overflow-x-auto scrollbar-none flex-1 min-w-0",role:"tablist","aria-label":"Open sessions",children:t.map(m=>{const g=m.id===n,v=m.ref?u[m.ref]:void 0,y=v==null?void 0:v.status;return c.jsx(ks,{tab:m,isActive:g,isFocused:o,processStatus:y,onSelect:s,onClose:a,onDragStart:h,groupId:r},m.id)})}),c.jsx(As,{groupId:r})]})}),Ts=[{type:"chat",label:"Chat",color:"var(--color-accent-green)",icon:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},{type:"file",label:"Code",color:"var(--color-accent-blue)",icon:""},{type:"agent",label:"Terminal",color:"var(--color-accent-orange)",icon:""}];let _n=0;function As({groupId:e}){const[t,n]=f.useState(!1),{dispatch:r}=fe(),o=f.useRef(null),[s,a]=f.useState({top:0,left:0}),l=f.useCallback(i=>{_n++;const u={id:`new-${i.type}-${_n}`,type:i.type,title:i.label,ref:""};r({type:"OPEN_TAB",groupId:e,tab:u}),n(!1)},[r,e]);return f.useEffect(()=>{if(t&&o.current){const i=o.current.getBoundingClientRect();a({top:i.bottom+2,left:i.left})}},[t]),c.jsxs("div",{className:"self-center ml-[2px] shrink-0",children:[c.jsx("button",{ref:o,type:"button",onClick:i=>{i.stopPropagation(),n(u=>!u)},className:"w-[22px] h-[22px] rounded-[4px] border-none bg-transparent flex items-center justify-center cursor-pointer transition-all duration-100",style:{color:"var(--color-text-placeholder)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--color-bg-hover)",i.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:i=>{t||(i.currentTarget.style.backgroundColor="transparent",i.currentTarget.style.color="var(--color-text-placeholder)")},title:"New tab",children:c.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),c.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),t&&Cr.createPortal(c.jsxs(c.Fragment,{children:[c.jsx("div",{style:{position:"fixed",inset:0,zIndex:9998},onClick:()=>n(!1)}),c.jsx("div",{style:{position:"fixed",top:s.top,left:s.left,zIndex:9999,backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border)",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.12)",minWidth:120,overflow:"hidden"},children:Ts.map(i=>c.jsxs("button",{type:"button",onClick:()=>l(i),className:"flex items-center gap-[6px] w-full px-[10px] py-[6px] border-none bg-transparent cursor-pointer text-left transition-colors duration-100 text-[11px]",style:{color:"var(--color-text-primary)",fontFamily:"inherit"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent"},children:[c.jsx(Is,{type:i.type,color:i.color}),c.jsx("span",{className:"font-medium",children:i.label})]},i.type))})]}),document.body)]})}function Is({type:e,color:t}){return e==="chat"?c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}):e==="file"?c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("polyline",{points:"16 18 22 12 16 6"}),c.jsx("polyline",{points:"8 6 2 12 8 18"})]}):c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("polyline",{points:"4 17 10 11 4 5"}),c.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function Dn(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),n=e%60;return`${t}m ${n}s`}function Ns({processId:e}){const t=B(i=>e?i.processThoughts[e]:void 0),n=B(i=>e?i.processStreaming[e]??!1:!1),[r,o]=f.useState(0),s=f.useRef(Date.now());if(f.useEffect(()=>{if(!n&&!(t!=null&&t.subject)){o(0);return}s.current=Date.now(),o(0);const i=setInterval(()=>{o(Math.floor((Date.now()-s.current)/1e3))},1e3);return()=>clearInterval(i)},[n,t==null?void 0:t.subject]),!n&&!(t!=null&&t.subject))return null;const a=()=>{e&&dt({action:"stop",processId:e})};if(n&&!(t!=null&&t.subject))return c.jsx("div",{style:zn,children:c.jsxs("div",{style:Fn,children:[c.jsx($n,{}),c.jsxs("span",{style:{color:"var(--color-text-secondary)",fontSize:12},children:["Processing...",c.jsxs("span",{style:{marginLeft:6,opacity:.6},children:["(",Dn(r),")"]})]}),c.jsx(Bn,{onClick:a})]})});const l=t&&t.description&&t.description!==t.subject;return c.jsx("div",{style:zn,children:c.jsxs("div",{style:Fn,children:[n&&c.jsx($n,{}),(t==null?void 0:t.subject)&&c.jsx("span",{style:Ls,children:t.subject}),l&&c.jsx("span",{style:{flex:1,fontSize:12,color:"var(--color-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.description}),n&&c.jsxs("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",whiteSpace:"nowrap"},children:["(",Dn(r),")"]}),n&&c.jsx(Bn,{onClick:a})]})})}const zn={background:"linear-gradient(135deg, var(--color-bg-card) 0%, var(--color-bg-primary) 100%)",borderRadius:10,padding:"8px 12px",margin:"0 16px 4px 16px",border:"1px solid var(--color-border-divider)"},Fn={display:"flex",alignItems:"center",gap:8},Ls={display:"inline-block",fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:6,backgroundColor:"var(--color-tint-exploring)",color:"var(--color-accent-blue)",whiteSpace:"nowrap"};function $n(){return c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-blue)",strokeWidth:"2.5",strokeLinecap:"round",style:{animation:"spin 1s linear infinite",flexShrink:0},children:[c.jsx("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"}),c.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]})}function Bn({onClick:e}){return c.jsx("button",{type:"button",onClick:e,style:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:6,border:"1px solid var(--color-border)",backgroundColor:"var(--color-bg-card)",cursor:"pointer",color:"var(--color-text-tertiary)",flexShrink:0,padding:0,transition:"all 150ms"},onMouseEnter:t=>{const n=t.currentTarget;n.style.borderColor="var(--color-accent-red)",n.style.backgroundColor="var(--color-tint-blocked)",n.style.color="var(--color-accent-red)"},onMouseLeave:t=>{const n=t.currentTarget;n.style.borderColor="var(--color-border)",n.style.backgroundColor="var(--color-bg-card)",n.style.color="var(--color-text-tertiary)"},"aria-label":"Stop process",children:c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor",children:c.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})})}function Os(e){var r;const t=((r=e.split(".").pop())==null?void 0:r.toLowerCase())??"";return{ts:"ts",tsx:"ts",js:"js",jsx:"js",mjs:"js",cjs:"js",json:"json",css:"css",html:"html",md:"md",yaml:"yaml",yml:"yaml",py:"py",rs:"rs",go:"go",sh:"sh",bash:"sh"}[t]??""}function _s(e,t){if(!t||t==="md")return[e];const n=[],r=t==="json"?[[/"(?:[^"\\]|\\.)*"/g,"var(--color-accent-green, #3D9B6F)"],[/\b(true|false|null)\b/g,"var(--color-accent-orange, #D4832E)"],[/\b\d+(?:\.\d+)?\b/g,"var(--color-accent-blue, #4A90D9)"]]:[[/\/\/.*$/gm,"var(--color-text-tertiary)"],[/(['"`])(?:(?!\1|\\).|\\.)*\1/g,"var(--color-accent-green, #3D9B6F)"],[/`[^`]*`/g,"var(--color-accent-green, #3D9B6F)"],[/\b(import|export|from|const|let|var|function|return|if|else|for|while|class|interface|type|extends|implements|new|async|await|try|catch|throw|switch|case|break|default|yield|of|in|as|is|typeof|instanceof|void|null|undefined|true|false|this|super|static|readonly|public|private|protected|abstract|enum|namespace|module|declare|require)\b/g,"var(--color-accent-purple, #8B6BBF)"],[/\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/g,"var(--color-accent-blue, #4A90D9)"],[/\b([a-zA-Z_$]\w*)\s*\(/g,"var(--color-accent-orange, #D4832E)"]],o=[];for(const[i,u]of r){const d=new RegExp(i.source,i.flags);let h;for(;(h=d.exec(e))!==null;)h[1]&&i.source.includes("\\(")?o.push({start:h.index,end:h.index+h[1].length,text:h[1],color:u}):o.push({start:h.index,end:h.index+h[0].length,text:h[0],color:u})}o.sort((i,u)=>i.start-u.start);const s=[];let a=0;for(const i of o)i.start>=a&&(s.push(i),a=i.end);let l=0;for(const i of s)i.start>l&&n.push(e.slice(l,i.start)),n.push({text:i.text,color:i.color}),l=i.end;return l<e.length&&n.push(e.slice(l)),n.length>0?n:[e]}function Ds({filePath:e,onClose:t,embedded:n}){const[r,o]=f.useState(null),[s,a]=f.useState(!0),[l,i]=f.useState(null);f.useEffect(()=>{let x=!1;return a(!0),i(null),fetch(`/api/workspace/file?path=${encodeURIComponent(e)}`).then(async m=>{x||(m.ok?o(await m.text()):(i(`Failed to load: ${m.status}`),o(null)))}).catch(()=>{x||i("Failed to fetch file")}).finally(()=>{x||a(!1)}),()=>{x=!0}},[e]);const u=e.split("/").pop()??e,d=Os(e),h=f.useMemo(()=>(r==null?void 0:r.split(`
27
+ `))??[],[r]),p=h.length>0?String(h.length).length:1;return c.jsxs("div",{className:"flex flex-col h-full",children:[!n&&c.jsxs("div",{className:"shrink-0 flex items-center gap-2 px-4 py-2 border-b",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-secondary)"},children:[c.jsx(An,{size:13,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),c.jsx("span",{className:"text-[12px] font-medium truncate flex-1",style:{color:"var(--color-text-primary)"},title:e,children:u}),c.jsx("span",{className:"text-[10px] truncate max-w-[200px]",style:{color:"var(--color-text-tertiary)"},children:e}),c.jsx("button",{type:"button",onClick:t,className:"w-6 h-6 rounded flex items-center justify-center transition-colors",style:{color:"var(--color-text-tertiary)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor="var(--color-bg-hover)",x.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent",x.currentTarget.style.color="var(--color-text-tertiary)"},"aria-label":"Close file viewer",children:c.jsx(wr,{size:12,strokeWidth:2})})]}),n&&c.jsxs("div",{className:"shrink-0 flex items-center gap-[6px] px-3 h-[26px] border-b",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-primary)"},children:[c.jsx(An,{size:12,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),c.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--color-text-secondary)"},title:e,children:e})]}),c.jsxs("div",{className:"flex-1 overflow-auto",children:[s&&c.jsx("div",{className:"p-4 text-[12px] animate-pulse",style:{color:"var(--color-text-tertiary)"},children:"Loading..."}),l&&c.jsx("div",{className:"p-4 text-[12px]",style:{color:"var(--color-accent-red)"},children:l}),!s&&!l&&r!==null&&c.jsx("div",{className:"m-0 text-[12px] leading-[1.7]",style:{fontFamily:"var(--font-mono)",tabSize:2},children:h.map((x,m)=>c.jsxs("div",{className:"flex hover:bg-bg-hover",style:{minHeight:"1.7em"},children:[c.jsx("span",{className:"shrink-0 select-none text-right pr-[12px] pl-[12px]",style:{color:"var(--color-text-placeholder)",width:`${p+3}ch`,userSelect:"none"},children:m+1}),c.jsx("span",{className:"flex-1 whitespace-pre-wrap break-all pr-4",style:{color:"var(--color-text-primary)"},children:_s(x,d).map((g,v)=>typeof g=="string"?c.jsx("span",{children:g},v):c.jsx("span",{style:{color:g.color},children:g.text},v))})]},m))})]})]})}const zs=2;function zt(e,t){if(e.type==="leaf")return e.id===t?0:-1;const n=zt(e.first,t);if(n>=0)return n+1;const r=zt(e.second,t);return r>=0?r+1:-1}function Fs({tab:e}){switch(e.type){case"chat":case"agent":return e.ref?c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsx("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:c.jsx(xs,{processId:e.ref})}),c.jsx(Ns,{processId:e.ref}),c.jsx(In,{processId:e.ref})]}):c.jsx("div",{className:"flex-1 flex flex-col items-center justify-center h-full",children:c.jsxs("div",{className:"w-full px-4",style:{maxWidth:"clamp(360px, calc(100% - 32px), 700px)"},children:[c.jsxs("div",{className:"flex flex-col items-center mb-6",children:[c.jsx("h2",{className:"text-[16px] font-semibold mb-[6px]",style:{color:"var(--color-text-secondary)"},children:"Start a new conversation"}),c.jsx("p",{className:"text-[13px]",style:{color:"var(--color-text-tertiary)"},children:"Select an agent, type a message, and press Enter to begin."})]}),c.jsx(In,{processId:null})]})});case"file":return e.ref?c.jsx(Ds,{filePath:e.ref,onClose:()=>{},embedded:!0}):c.jsx("div",{className:"flex items-center justify-center h-full text-[12px]",style:{color:"var(--color-text-placeholder)"},children:"Open a file from the Explorer sidebar"});default:return c.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[13px]",children:e.title})}}const $s=f.memo(function({node:t}){const{state:n,dispatch:r}=fe(),o=Xe(y=>y.focusedGroupId),s=Ms(),a=o===t.id,l=t.id==="editor-group-1",i=f.useRef(t.tabs);i.current=t.tabs;const u=f.useRef(t.activeTabId);u.current=t.activeTabId;const d=f.useRef(t.id);d.current=t.id;const h=f.useCallback(y=>{r({type:"SET_ACTIVE_TAB",groupId:t.id,tabId:y});const w=t.tabs.find(b=>b.id===y);(w==null?void 0:w.type)==="chat"&&w.ref&&B.getState().setActiveProcessId(w.ref)},[r,t.id,t.tabs]),p=f.useCallback(y=>{r({type:"CLOSE_TAB",groupId:t.id,tabId:y})},[r,t.id]),x=f.useCallback(()=>{r({type:"SPLIT_GROUP",groupId:t.id,direction:"horizontal"})},[r,t.id]),m=f.useCallback(()=>{r({type:"SPLIT_GROUP",groupId:t.id,direction:"vertical"})},[r,t.id]),g=f.useCallback(()=>{a||r({type:"SET_FOCUSED_GROUP",groupId:t.id})},[r,t.id,a]),v=zt(n.editorArea,t.id)<zs;return f.useEffect(()=>{function y(w){const b=i.current,C=u.current,S=d.current;if(w.ctrlKey&&w.key==="Tab"&&!w.shiftKey){if(w.preventDefault(),b.length<2)return;const R=(b.findIndex(M=>M.id===C)+1)%b.length;r({type:"SET_ACTIVE_TAB",groupId:S,tabId:b[R].id});return}if(w.ctrlKey&&w.key==="Tab"&&w.shiftKey){if(w.preventDefault(),b.length<2)return;const R=(b.findIndex(M=>M.id===C)-1+b.length)%b.length;r({type:"SET_ACTIVE_TAB",groupId:S,tabId:b[R].id});return}if(w.ctrlKey&&w.key==="w"){if(w.preventDefault(),!C)return;r({type:"CLOSE_TAB",groupId:S,tabId:C});return}}return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[r]),c.jsxs("div",{className:"flex flex-col h-full overflow-hidden ",onMouseDown:g,"data-editor-group":t.id,children:[c.jsxs("div",{className:"flex items-center shrink-0 h-[28px] border-b border-border bg-bg-secondary",children:[c.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:c.jsx(Ps,{tabs:t.tabs,activeTabId:t.activeTabId,groupId:t.id,isFocused:a,onTabSelect:h,onTabClose:p})}),v&&c.jsxs("div",{className:"flex items-center gap-[1px] px-1 shrink-0",children:[c.jsx("button",{className:"p-[3px] rounded-[var(--radius-sm)] hover:bg-bg-active text-text-tertiary hover:text-text-secondary transition-colors",onClick:x,title:"Split Right","aria-label":"Split right",children:c.jsx(Ss,{size:13})}),c.jsx("button",{className:"p-[3px] rounded-[var(--radius-sm)] hover:bg-bg-active text-text-tertiary hover:text-text-secondary transition-colors",onClick:m,title:"Split Down","aria-label":"Split down",children:c.jsx(ws,{size:13})})]})]}),c.jsx("div",{className:"flex-1 overflow-hidden relative",children:t.tabs.length===0?l&&s?c.jsx("div",{className:"h-full overflow-y-auto",children:s}):c.jsx("div",{className:"flex items-center justify-center h-full text-[12px]",style:{color:"var(--color-text-placeholder)"},children:"Click + to open a new tab"}):t.tabs.map(y=>c.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{display:y.id===t.activeTabId?"flex":"none"},"data-tab-content":y.id,children:c.jsx(Fs,{tab:y})},y.id))})]})});function Bs(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function Gs(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function Ws(e){return e/100*window.innerHeight}function Vs(e){return e/100*window.innerWidth}function Hs(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function He({groupSize:e,panelElement:t,styleProp:n}){let r;const[o,s]=Hs(n);switch(s){case"%":{r=o/100*e;break}case"px":{r=o;break}case"rem":{r=Gs(t,o);break}case"em":{r=Bs(t,o);break}case"vh":{r=Ws(o);break}case"vw":{r=Vs(o);break}}return r}function U(e){return parseFloat(e.toFixed(3))}function De({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,o)=>(r+=t==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,r),0)}function Ft(e){const{panels:t}=e,n=De({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:o,panelConstraints:s}=r;let a=0;if(s.collapsedSize!==void 0){const d=He({groupSize:n,panelElement:o,styleProp:s.collapsedSize});a=U(d/n*100)}let l;if(s.defaultSize!==void 0){const d=He({groupSize:n,panelElement:o,styleProp:s.defaultSize});l=U(d/n*100)}let i=0;if(s.minSize!==void 0){const d=He({groupSize:n,panelElement:o,styleProp:s.minSize});i=U(d/n*100)}let u=100;if(s.maxSize!==void 0){const d=He({groupSize:n,panelElement:o,styleProp:s.maxSize});u=U(d/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:a,collapsible:s.collapsible===!0,defaultSize:l,disabled:s.disabled,minSize:i,maxSize:u,panelId:r.id}})}function $(e,t="Assertion error"){if(!e)throw Error(t)}function $t(e,t){return Array.from(t).sort(e==="horizontal"?Ks:Us)}function Ks(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Us(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Mr(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Er(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Ys({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let o,s=Number.MAX_VALUE;for(const a of t){const{x:l,y:i}=Er(r,a),u=e==="horizontal"?l:i;u<s&&(s=u,o=a)}return $(o,"No rect found"),o}let at;function Xs(){return at===void 0&&(typeof matchMedia=="function"?at=!!matchMedia("(pointer:coarse)").matches:at=!1),at}function kr(e){const{element:t,orientation:n,panels:r,separators:o}=e,s=$t(n,Array.from(t.children).filter(Mr).map(m=>({element:m}))).map(({element:m})=>m),a=[];let l=!1,i=!1,u=-1,d=-1,h=0,p,x=[];{let m=-1;for(const g of s)g.hasAttribute("data-panel")&&(m++,g.hasAttribute("data-disabled")||(h++,u===-1&&(u=m),d=m))}if(h>1){let m=-1;for(const g of s)if(g.hasAttribute("data-panel")){m++;const v=r.find(y=>y.element===g);if(v){if(p){const y=p.element.getBoundingClientRect(),w=g.getBoundingClientRect();let b;if(i){const C=n==="horizontal"?new DOMRect(y.right,y.top,0,y.height):new DOMRect(y.left,y.bottom,y.width,0),S=n==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(x.length){case 0:{b=[C,S];break}case 1:{const j=x[0],R=Ys({orientation:n,rects:[y,w],targetRect:j.element.getBoundingClientRect()});b=[j,R===y?S:C];break}default:{b=x;break}}}else x.length?b=x:b=[n==="horizontal"?new DOMRect(y.right,w.top,w.left-y.right,w.height):new DOMRect(w.left,y.bottom,w.width,w.top-y.bottom)];for(const C of b){let S="width"in C?C:C.element.getBoundingClientRect();const j=Xs()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(S.width<j){const M=j-S.width;S=new DOMRect(S.x-M/2,S.y,S.width+M,S.height)}if(S.height<j){const M=j-S.height;S=new DOMRect(S.x,S.y-M/2,S.width,S.height+M)}const R=m<=u||m>d;!l&&!R&&a.push({group:e,groupSize:De({group:e}),panels:[p,v],separator:"width"in C?void 0:C,rect:S}),l=!1}}i=!1,p=v,x=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(l=!0);const v=o.find(y=>y.element===g);v?x.push(v):(p=void 0,x=[])}else i=!0}return a}var he;class Pr{constructor(){Pn(this,he,{})}addListener(t,n){const r=We(this,he)[t];return r===void 0?We(this,he)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=We(this,he)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let o=!1,s=null;const a=Array.from(r);for(let l=0;l<a.length;l++){const i=a[l];try{i.call(null,n)}catch(u){s===null&&(o=!0,s=u)}}if(o)throw s}}removeAllListeners(){Tn(this,he,{})}removeListener(t,n){const r=We(this,he)[t];if(r!==void 0){const o=r.indexOf(n);o>=0&&r.splice(o,1)}}}he=new WeakMap;let oe=new Map;const Tr=new Pr;function Zs(e){oe=new Map(oe),oe.delete(e)}function Gn(e,t){for(const[n]of oe)if(n.id===e)return n}function xe(e,t){for(const[n,r]of oe)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Ee(){return oe}function Jt(e,t){return Tr.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function le(e,t){const n=oe.get(e);oe=new Map(oe),oe.set(e,t),Tr.emit("groupChange",{group:e,prev:n,next:t})}function qs(e,t,n){let r,o={x:1/0,y:1/0};for(const s of t){const a=Er(n,s.rect);switch(e){case"horizontal":{a.x<=o.x&&(r=s,o=a);break}case"vertical":{a.y<=o.y&&(r=s,o=a);break}}}return r?{distance:o,hitRegion:r}:void 0}function Js(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Qs(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Hn(e),b:Hn(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();$(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Vn(Wn(n.a)),b:Vn(Wn(n.b))};if(o.a===o.b){const s=r.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let l=s.length;for(;l--;){const i=s[l];if(i===a.a)return 1;if(i===a.b)return-1}}return Math.sign(o.a-o.b)}const ei=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ti(e){const t=getComputedStyle(Ar(e)??e).display;return t==="flex"||t==="inline-flex"}function ni(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||ti(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||ei.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Wn(e){let t=e.length;for(;t--;){const n=e[t];if($(n,"Missing node"),ni(n))return n}return null}function Vn(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Hn(e){const t=[];for(;e;)t.push(e),e=Ar(e);return t}function Ar(e){const{parentNode:t}=e;return Js(t)?t.host:t}function ri(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function oi({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Mr(n)||n.contains(e)||e.contains(n))return!0;if(Qs(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ri(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Qt(e,t){const n=[];return t.forEach((r,o)=>{if(o.disabled)return;const s=kr(o),a=qs(o.orientation,s,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&oi({groupElement:o.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function si(e,t){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 V(e,t,n=0){return Math.abs(U(e)-U(t))<=n}function re(e,t){return V(e,t)?0:e>t?1:-1}function Ne({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:o=0,collapsible:s,disabled:a,maxSize:l=100,minSize:i=0}=t;if(a&&!e)return n;if(re(r,i)<0)if(s){const u=(o+i)/2;re(r,u)<0?r=o:r=i}else r=i;return r=Math.min(l,r),r=U(r),r}function Ze({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(V(e,0))return t;const a=s==="imperative-api",l=Object.values(t),i=Object.values(o),u=[...l],[d,h]=r;$(d!=null,"Invalid first pivot index"),$(h!=null,"Invalid second pivot index");let p=0;switch(s){case"keyboard":{{const g=e<0?h:d,v=n[g];$(v,`Panel constraints not found for index ${g}`);const{collapsedSize:y=0,collapsible:w,minSize:b=0}=v;if(w){const C=l[g];if($(C!=null,`Previous layout not found for panel index ${g}`),V(C,y)){const S=b-C;re(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}{const g=e<0?d:h,v=n[g];$(v,`No panel constraints found for index ${g}`);const{collapsedSize:y=0,collapsible:w,minSize:b=0}=v;if(w){const C=l[g];if($(C!=null,`Previous layout not found for panel index ${g}`),V(C,b)){const S=C-y;re(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}break}default:{const g=e<0?h:d,v=n[g];$(v,`Panel constraints not found for index ${g}`);const y=l[g],{collapsible:w,collapsedSize:b,minSize:C}=v;if(w&&re(y,C)<0)if(e>0){const S=C-b,j=S/2,R=y+e;re(R,C)<0&&(e=re(e,j)<=0?0:S)}else{const S=C-b,j=100-S/2,R=y-e;re(R,C)<0&&(e=re(100+e,j)>0?0:-S)}break}}{const g=e<0?1:-1;let v=e<0?h:d,y=0;for(;;){const b=l[v];$(b!=null,`Previous layout not found for panel index ${v}`);const C=Ne({overrideDisabledPanels:a,panelConstraints:n[v],prevSize:b,size:100})-b;if(y+=C,v+=g,v<0||v>=n.length)break}const w=Math.min(Math.abs(e),Math.abs(y));e=e<0?0-w:w}{let g=e<0?d:h;for(;g>=0&&g<n.length;){const v=Math.abs(e)-Math.abs(p),y=l[g];$(y!=null,`Previous layout not found for panel index ${g}`);const w=y-v,b=Ne({overrideDisabledPanels:a,panelConstraints:n[g],prevSize:y,size:w});if(!V(y,b)&&(p+=y-b,u[g]=b,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(si(i,u))return o;{const g=e<0?h:d,v=l[g];$(v!=null,`Previous layout not found for panel index ${g}`);const y=v+p,w=Ne({overrideDisabledPanels:a,panelConstraints:n[g],prevSize:v,size:y});if(u[g]=w,!V(w,y)){let b=y-w,C=e<0?h:d;for(;C>=0&&C<n.length;){const S=u[C];$(S!=null,`Previous layout not found for panel index ${C}`);const j=S+b,R=Ne({overrideDisabledPanels:a,panelConstraints:n[C],prevSize:S,size:j});if(V(S,R)||(b-=R-S,u[C]=R),V(b,0))break;e>0?C--:C++}}}const x=Object.values(u).reduce((g,v)=>v+g,0);if(!V(x,100,.1))return o;const m=Object.keys(o);return u.reduce((g,v,y)=>(g[m[y]]=v,g),{})}function Se(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||re(e[n],t[n])!==0)return!1;return!0}function Re({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],o=r.reduce((l,i)=>l+i,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(l=>`${l}%`).join(", ")}`);if(!V(o,100)&&r.length>0)for(let l=0;l<t.length;l++){const i=r[l];$(i!=null,`No layout data found for index ${l}`);const u=100/o*i;r[l]=u}let s=0;for(let l=0;l<t.length;l++){const i=n[l];$(i!=null,`No layout data found for index ${l}`);const u=r[l];$(u!=null,`No layout data found for index ${l}`);const d=Ne({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:i,size:u});u!=d&&(s+=u-d,r[l]=d)}if(!V(s,0))for(let l=0;l<t.length;l++){const i=r[l];$(i!=null,`No layout data found for index ${l}`);const u=i+s,d=Ne({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:i,size:u});if(i!==d&&(s-=d-i,r[l]=d,V(s,0)))break}const a=Object.keys(e);return r.reduce((l,i,u)=>(l[a[u]]=i,l),{})}function Ir({groupId:e,panelId:t}){const n=()=>{const l=Ee();for(const[i,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:h,groupSize:p,separatorToPanels:x}]of l)if(i.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:i,groupSize:p,layout:h,separatorToPanels:x};throw Error(`Group ${e} not found`)},r=()=>{const l=n().derivedPanelConstraints.find(i=>i.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},o=()=>{const l=n().group.panels.find(i=>i.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const l=n().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},a=l=>{const i=s();if(l===i)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:h,groupSize:p,layout:x,separatorToPanels:m}=n(),g=h.panels.findIndex(b=>b.id===t),v=g===h.panels.length-1,y=Ze({delta:v?i-l:l-i,initialLayout:x,panelConstraints:d,pivotIndices:v?[g-1,g]:[g,g+1],prevLayout:x,trigger:"imperative-api"}),w=Re({layout:y,panelConstraints:d});Se(x,w)||le(h,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:p,layout:w,separatorToPanels:m})};return{collapse:()=>{const{collapsible:l,collapsedSize:i}=r(),{mutableValues:u}=o(),d=s();l&&d!==i&&(u.expandToSize=d,a(i))},expand:()=>{const{collapsible:l,collapsedSize:i,minSize:u}=r(),{mutableValues:d}=o(),h=s();if(l&&h===i){let p=d.expandToSize??u;p===0&&(p=1),a(p)}},getSize:()=>{const{group:l}=n(),i=s(),{element:u}=o(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:i,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:i}=r(),u=s();return l&&V(i,u)},resize:l=>{const{group:i}=n(),{element:u}=o(),d=De({group:i}),h=He({groupSize:d,panelElement:u,styleProp:l}),p=U(h/d*100);a(p)}}}function Kn(e){if(e.defaultPrevented)return;const t=Ee();Qt(e,t).forEach(n=>{if(n.separator&&!n.separator.disableDoubleClick){const r=n.panels.find(o=>o.panelConstraints.defaultSize!==void 0);if(r){const o=r.panelConstraints.defaultSize,s=Ir({groupId:n.group.id,panelId:r.id});s&&o!==void 0&&(s.resize(o),e.preventDefault())}}})}function ft(e){const t=Ee();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function Nr({groupId:e}){const t=()=>{const n=Ee();for(const[r,o]of n)if(r.id===e)return{group:r,...o};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:o,group:s,groupSize:a,layout:l,separatorToPanels:i}=t(),u=Re({layout:n,panelConstraints:o});return r?l:(Se(l,u)||le(s,{defaultLayoutDeferred:r,derivedPanelConstraints:o,groupSize:a,layout:u,separatorToPanels:i}),u)}}}function we(e,t){const n=ft(e),r=xe(n.id,!0),o=n.separators.find(d=>d.element===e);$(o,"Matching separator not found");const s=r.separatorToPanels.get(o);$(s,"Matching panels not found");const a=s.map(d=>n.panels.indexOf(d)),l=Nr({groupId:n.id}).getLayout(),i=Ze({delta:t,initialLayout:l,panelConstraints:r.derivedPanelConstraints,pivotIndices:a,prevLayout:l,trigger:"keyboard"}),u=Re({layout:i,panelConstraints:r.derivedPanelConstraints});Se(l,u)||le(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:u,separatorToPanels:r.separatorToPanels})}function Un(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=ft(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&we(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&we(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&we(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&we(t,-5);break}case"End":{e.preventDefault(),we(t,100);break}case"Enter":{e.preventDefault();const r=ft(t),o=xe(r.id,!0),{derivedPanelConstraints:s,layout:a,separatorToPanels:l}=o,i=r.separators.find(p=>p.element===t);$(i,"Matching separator not found");const u=l.get(i);$(u,"Matching panels not found");const d=u[0],h=s.find(p=>p.panelId===d.id);if($(h,"Panel metadata not found"),h.collapsible){const p=a[d.id],x=h.collapsedSize===p?r.mutableState.expandedPanelSizes[d.id]??h.minSize:h.collapsedSize;we(t,x-p)}break}case"F6":{e.preventDefault();const r=ft(t).separators.map(a=>a.element),o=Array.from(r).findIndex(a=>a===e.currentTarget);$(o!==null,"Index not found");const s=e.shiftKey?o>0?o-1:r.length-1:o+1<r.length?o+1:0;r[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),we(t,-100);break}}}let Le={cursorFlags:0,state:"inactive"};const en=new Pr;function je(){return Le}function ii(e){return en.addListener("change",e)}function ai(e){const t=Le,n={...Le};n.cursorFlags=e,Le=n,en.emit("change",{prev:t,next:n})}function Oe(e){const t=Le;Le=e,en.emit("change",{prev:t,next:e})}function Yn(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Ee(),n=Qt(e,t),r=new Map;let o=!1;n.forEach(s=>{s.separator&&(o||(o=!0,s.separator.element.focus({preventScroll:!0})));const a=t.get(s.group);a&&r.set(s.group,a.layout)}),Oe({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const ci=e=>e,kt=()=>{},Lr=1,Or=2,_r=4,Dr=8,Xn=3,Zn=12;let ct;function qn(){return ct===void 0&&(ct=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ct=!0)),ct}function li({cursorFlags:e,groups:t,state:n}){let r=0,o=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{r++;break}case"vertical":{o++;break}}})}if(!(r===0&&o===0)){switch(n){case"active":{if(e&&qn()){const s=(e&Lr)!==0,a=(e&Or)!==0,l=(e&_r)!==0,i=(e&Dr)!==0;if(s)return l?"se-resize":i?"ne-resize":"e-resize";if(a)return l?"sw-resize":i?"nw-resize":"w-resize";if(l)return"s-resize";if(i)return"n-resize"}break}}return qn()?r>0&&o>0?"move":r>0?"ew-resize":"ns-resize":r>0&&o>0?"grab":r>0?"col-resize":"row-resize"}}const Jn=new WeakMap;function tn(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Jn.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=je();switch(r.state){case"active":case"hover":{const o=li({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(a=>a.group),state:r.state}),s=`*, *:hover {cursor: ${o} !important; }`;if(t===s)return;t=s,o?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Jn.set(e,{prevStyle:t,styleSheet:n})}function zr({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:o,pointerDownAtPoint:s,prevCursorFlags:a}){let l=0;n.forEach(u=>{const{group:d,groupSize:h}=u,{orientation:p,panels:x}=d,{disableCursor:m}=d.mutableState;let g=0;s?p==="horizontal"?g=(t.clientX-s.x)/h*100:g=(t.clientY-s.y)/h*100:p==="horizontal"?g=t.clientX<0?-100:100:g=t.clientY<0?-100:100;const v=r.get(d),y=o.get(d);if(!v||!y)return;const{defaultLayoutDeferred:w,derivedPanelConstraints:b,groupSize:C,layout:S,separatorToPanels:j}=y;if(b&&S&&j){const R=Ze({delta:g,initialLayout:v,panelConstraints:b,pivotIndices:u.panels.map(M=>x.indexOf(M)),prevLayout:S,trigger:"mouse-or-touch"});if(Se(R,S)){if(g!==0&&!m)switch(p){case"horizontal":{l|=g<0?Lr:Or;break}case"vertical":{l|=g<0?_r:Dr;break}}}else le(u.group,{defaultLayoutDeferred:w,derivedPanelConstraints:b,groupSize:C,layout:R,separatorToPanels:j})}});let i=0;t.movementX===0?i|=a&Xn:i|=l&Xn,t.movementY===0?i|=a&Zn:i|=l&Zn,ai(i),tn(e)}function Qn(e){const t=Ee(),n=je();switch(n.state){case"active":zr({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function er(e){var r,o;if(e.defaultPrevented)return;const t=je(),n=Ee();switch(t.state){case"active":{if(e.buttons===0){Oe({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const a=xe(s.group.id,!0);le(s.group,a)});return}for(const s of t.hitRegions)if(s.separator){const{element:a}=s.separator;(r=a.hasPointerCapture)!=null&&r.call(a,e.pointerId)||((o=a.setPointerCapture)==null||o.call(a,e.pointerId))}zr({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=Qt(e,n);s.length===0?t.state!=="inactive"&&Oe({cursorFlags:0,state:"inactive"}):Oe({cursorFlags:0,hitRegions:s,state:"hover"}),tn(e.currentTarget);break}}}function tr(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(je().state){case"hover":Oe({cursorFlags:0,state:"inactive"})}}function nr(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=je();switch(t.state){case"active":Oe({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(tn(e.currentTarget),t.hitRegions.forEach(n=>{const r=xe(n.group.id,!0);le(n.group,r)}),e.preventDefault())}}function rr(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const a=U(s.defaultSize);n+=a,r[s.panelId]=a}else r[s.panelId]=void 0;const o=e.length-t;if(o!==0){const s=U((100-n)/o);for(const a of e)a.defaultSize===void 0&&(r[a.panelId]=s)}return r}function ui(e,t,n){if(!n[0])return;const r=e.panels.find(i=>i.element===t);if(!r||!r.onResize)return;const o=De({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,a=r.mutableValues.prevSize,l={asPercentage:U(s/o*100),inPixels:s};r.mutableValues.prevSize=l,r.onResize(l,r.id,a)}function di(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function fi({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let o=0,s=0,a=!1;const l=new Map,i=[];for(const h of e.panels){const p=r[h.id]??0;switch(h.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{a=!0;const x=p/100*n,m=U(x/t*100);l.set(h.id,m),o+=m;break}case"preserve-relative-size":default:{i.push(h.id),s+=p;break}}}if(!a||i.length===0)return r;const u=100-o,d={...r};if(l.forEach((h,p)=>{d[p]=h}),s>0)for(const h of i){const p=r[h]??0;d[h]=U(p/s*u)}else{const h=U(u/i.length);for(const p of i)d[p]=h}return d}function pi(e,t){const n=e.map(o=>o.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!r.includes(o))return!1;return!0}const Ie=new Map;function hi(e){let t=!0;$(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,o=new Set,s=new n(m=>{for(const g of m){const{borderBoxSize:v,target:y}=g;if(y===e.element){if(t){const w=De({group:e});if(w===0)return;const b=xe(e.id);if(!b)return;const C=Ft(e),S=b.defaultLayoutDeferred?rr(C):b.layout,j=fi({group:e,nextGroupSize:w,prevGroupSize:b.groupSize,prevLayout:S}),R=Re({layout:j,panelConstraints:C});if(!b.defaultLayoutDeferred&&Se(b.layout,R)&&di(b.derivedPanelConstraints,C)&&b.groupSize===w)return;le(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:C,groupSize:w,layout:R,separatorToPanels:b.separatorToPanels})}}else ui(e,y,v)}});s.observe(e.element),e.panels.forEach(m=>{$(!r.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.onResize&&s.observe(m.element)});const a=De({group:e}),l=Ft(e),i=e.panels.map(({id:m})=>m).join(",");let u=e.mutableState.defaultLayout;u&&(pi(e.panels,u)||(u=void 0));const d=e.mutableState.layouts[i]??u??rr(l),h=Re({layout:d,panelConstraints:l}),p=e.element.ownerDocument;Ie.set(p,(Ie.get(p)??0)+1);const x=new Map;return kr(e).forEach(m=>{m.separator&&x.set(m.separator,m.panels)}),le(e,{defaultLayoutDeferred:a===0,derivedPanelConstraints:l,groupSize:a,layout:h,separatorToPanels:x}),e.separators.forEach(m=>{$(!o.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),o.add(m.id),m.element.addEventListener("keydown",Un)}),Ie.get(p)===1&&(p.addEventListener("dblclick",Kn,!0),p.addEventListener("pointerdown",Yn,!0),p.addEventListener("pointerleave",Qn),p.addEventListener("pointermove",er),p.addEventListener("pointerout",tr),p.addEventListener("pointerup",nr,!0)),function(){t=!1,Ie.set(p,Math.max(0,(Ie.get(p)??0)-1)),Zs(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",Un)}),Ie.get(p)||(p.removeEventListener("dblclick",Kn,!0),p.removeEventListener("pointerdown",Yn,!0),p.removeEventListener("pointerleave",Qn),p.removeEventListener("pointermove",er),p.removeEventListener("pointerout",tr),p.removeEventListener("pointerup",nr,!0)),s.disconnect()}}function xi(){const[e,t]=f.useState({}),n=f.useCallback(()=>t({}),[]);return[e,n]}function nn(e){const t=f.useId();return`${e??t}`}const ke=typeof window<"u"?f.useLayoutEffect:f.useEffect;function Ue(e){const t=f.useRef(e);return ke(()=>{t.current=e},[e]),f.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function rn(...e){return Ue(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function on(e){const t=f.useRef({...e});return ke(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Fr=f.createContext(null);function mi(e,t){const n=f.useRef({getLayout:()=>({}),setLayout:ci});f.useImperativeHandle(t,()=>n.current,[]),ke(()=>{Object.assign(n.current,Nr({groupId:e}))})}function $r({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:o,elementRef:s,groupRef:a,id:l,onLayoutChange:i,onLayoutChanged:u,orientation:d="horizontal",resizeTargetMinimumSize:h={coarse:20,fine:10},style:p,...x}){const m=f.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=Ue(P=>{Se(m.current.onLayoutChange,P)||(m.current.onLayoutChange=P,i==null||i(P))}),v=Ue(P=>{Se(m.current.onLayoutChanged,P)||(m.current.onLayoutChanged=P,u==null||u(P))}),y=nn(l),w=f.useRef(null),[b,C]=xi(),S=f.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:h,separators:[]}),j=rn(w,s);mi(y,a);const R=Ue((P,E)=>{const L=je(),T=Gn(P),N=xe(P);if(N){let A=!1;switch(L.state){case"active":{A=L.hitRegions.some(_=>_.group===T);break}}return{flexGrow:N.layout[E]??1,pointerEvents:A?"none":void 0}}if(n!=null&&n[E])return{flexGrow:n==null?void 0:n[E]}}),M=on({defaultLayout:n,disableCursor:r}),D=f.useMemo(()=>({get disableCursor(){return!!M.disableCursor},getPanelStyles:R,id:y,orientation:d,registerPanel:P=>{const E=S.current;return E.panels=$t(d,[...E.panels,P]),C(),()=>{E.panels=E.panels.filter(L=>L!==P),C()}},registerSeparator:P=>{const E=S.current;return E.separators=$t(d,[...E.separators,P]),C(),()=>{E.separators=E.separators.filter(L=>L!==P),C()}},updatePanelProps:(P,{disabled:E})=>{const L=S.current.panels.find(A=>A.id===P);L&&(L.panelConstraints.disabled=E);const T=Gn(y),N=xe(y);T&&N&&le(T,{...N,derivedPanelConstraints:Ft(T)})},updateSeparatorProps:(P,{disabled:E,disableDoubleClick:L})=>{const T=S.current.separators.find(N=>N.id===P);T&&(T.disabled=E,T.disableDoubleClick=L)}}),[R,y,C,d,M]),O=f.useRef(null);return ke(()=>{const P=w.current;if(P===null)return;const E=S.current;let L;if(M.defaultLayout!==void 0&&Object.keys(M.defaultLayout).length===E.panels.length){L={};for(const z of E.panels){const G=M.defaultLayout[z.id];G!==void 0&&(L[z.id]=G)}}const T={disabled:!!o,element:P,id:y,mutableState:{defaultLayout:L,disableCursor:!!M.disableCursor,expandedPanelSizes:S.current.lastExpandedPanelSizes,layouts:S.current.layouts},orientation:d,panels:E.panels,resizeTargetMinimumSize:E.resizeTargetMinimumSize,separators:E.separators};O.current=T;const N=hi(T),{defaultLayoutDeferred:A,derivedPanelConstraints:_,layout:I}=xe(T.id,!0);!A&&_.length>0&&(g(I),v(I));const k=Jt(y,z=>{const{defaultLayoutDeferred:G,derivedPanelConstraints:Y,layout:ne}=z.next;if(G||Y.length===0)return;const ve=T.panels.map(({id:W})=>W).join(",");T.mutableState.layouts[ve]=ne,Y.forEach(W=>{if(W.collapsible){const{layout:X}=z.prev??{};if(X){const ye=V(W.collapsedSize,ne[W.panelId]),K=V(W.collapsedSize,X[W.panelId]);ye&&!K&&(T.mutableState.expandedPanelSizes[W.panelId]=X[W.panelId])}}});const Ae=je().state!=="active";g(ne),Ae&&v(ne)});return()=>{O.current=null,N(),k()}},[o,y,v,g,d,b,M]),f.useEffect(()=>{const P=O.current;P&&(P.mutableState.defaultLayout=n,P.mutableState.disableCursor=!!r)}),c.jsx(Fr.Provider,{value:D,children:c.jsx("div",{...x,className:t,"data-group":!0,"data-testid":y,id:y,ref:j,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:d==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:d==="horizontal"?"pan-y":"pan-x"},children:e})})}$r.displayName="Group";function sn(){const e=f.useContext(Fr);return $(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function gi(e,t){const{id:n}=sn(),r=f.useRef({collapse:kt,expand:kt,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:kt});f.useImperativeHandle(t,()=>r.current,[]),ke(()=>{Object.assign(r.current,Ir({groupId:n,panelId:e}))})}function Bt({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:o,disabled:s,elementRef:a,groupResizeBehavior:l="preserve-relative-size",id:i,maxSize:u="100%",minSize:d="0%",onResize:h,panelRef:p,style:x,...m}){const g=!!i,v=nn(i),y=on({disabled:s}),w=f.useRef(null),b=rn(w,a),{getPanelStyles:C,id:S,orientation:j,registerPanel:R,updatePanelProps:M}=sn(),D=h!==null,O=Ue((T,N,A)=>{h==null||h(T,i,A)});ke(()=>{const T=w.current;if(T!==null){const N={element:T,id:v,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:D?O:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:n,collapsible:r,defaultSize:o,disabled:y.disabled,maxSize:u,minSize:d}};return R(N)}},[l,n,r,o,D,v,g,u,d,O,R,y]),f.useEffect(()=>{M(v,{disabled:s})},[s,v,M]),gi(v,p);const P=()=>{const T=C(S,v);if(T)return JSON.stringify(T)},E=f.useSyncExternalStore(T=>Jt(S,T),P,P);let L;return E?L=JSON.parse(E):o?L={flexGrow:void 0,flexShrink:void 0,flexBasis:o}:L={flexGrow:1},c.jsx("div",{...m,"data-disabled":s||void 0,"data-panel":!0,"data-testid":v,id:v,ref:b,style:{...vi,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...L},children:c.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...x,touchAction:j==="horizontal"?"pan-y":"pan-x"},children:e})})}Bt.displayName="Panel";const vi={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function yi({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let o,s;const a=e[n],l=t.find(i=>i.panelId===n);if(l){const i=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,d=[r,r+1];s=Re({layout:Ze({delta:u-a,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],o=Re({layout:Ze({delta:i-a,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:o,valueMin:s,valueNow:a}}function Br({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:o,id:s,style:a,...l}){const i=nn(s),u=on({disabled:n,disableDoubleClick:r}),[d,h]=f.useState({}),[p,x]=f.useState("inactive"),[m,g]=f.useState(!1),v=f.useRef(null),y=rn(v,o),{disableCursor:w,id:b,orientation:C,registerSeparator:S,updateSeparatorProps:j}=sn(),R=C==="horizontal"?"vertical":"horizontal";ke(()=>{const O=v.current;if(O!==null){const P={disabled:u.disabled,disableDoubleClick:u.disableDoubleClick,element:O,id:i},E=S(P),L=ii(N=>{x(N.next.state!=="inactive"&&N.next.hitRegions.some(A=>A.separator===P)?N.next.state:"inactive")}),T=Jt(b,N=>{const{derivedPanelConstraints:A,layout:_,separatorToPanels:I}=N.next,k=I.get(P);if(k){const z=k[0],G=k.indexOf(z);h(yi({layout:_,panelConstraints:A,panelId:z.id,panelIndex:G}))}});return()=>{L(),T(),E()}}},[b,i,S,u]),f.useEffect(()=>{j(i,{disabled:n,disableDoubleClick:r})},[n,r,i,j]);let M;n&&!w&&(M="not-allowed");let D;if(n)D="disabled";else switch(p){case"active":{D="active";break}default:m?D="focus":D=p}return c.jsx("div",{...l,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":R,"aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:e,className:t,"data-separator":D,"data-testid":i,id:i,onBlur:()=>g(!1),onFocus:()=>g(!0),ref:y,role:"separator",style:{flexBasis:"auto",cursor:M,...a,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}Br.displayName="Separator";const or=15,bi=f.memo(function({node:t}){const{dispatch:n}=fe(),r=Math.round(t.ratio*100),o=100-r,s=f.useCallback(a=>{const l=`${t.id}-first`,i=a[l];if(typeof i=="number"){const u=i/100;Math.abs(u-t.ratio)>.005&&n({type:"RESIZE_GROUP",branchId:t.id,ratio:u})}},[n,t.id,t.ratio]);return c.jsxs($r,{orientation:t.direction,id:t.id,className:"h-full",onLayoutChanged:s,children:[c.jsx(Bt,{id:`${t.id}-first`,defaultSize:`${r}%`,minSize:`${or}%`,className:"overflow-hidden",style:{minWidth:"var(--size-editor-min-width)",minHeight:"var(--size-editor-min-height)"},children:c.jsx(Gt,{node:t.first})}),c.jsx(Br,{id:`${t.id}-sep`,className:"group relative flex-shrink-0",style:{width:t.direction==="horizontal"?"1px":void 0,height:t.direction==="vertical"?"1px":void 0,backgroundColor:"var(--color-border)",transition:"background-color 150ms ease"},children:c.jsx("div",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:"var(--color-border-focused)",width:t.direction==="horizontal"?"3px":"100%",height:t.direction==="vertical"?"3px":"100%",left:t.direction==="horizontal"?"-1px":"0",top:t.direction==="vertical"?"-1px":"0"}})}),c.jsx(Bt,{id:`${t.id}-second`,defaultSize:`${o}%`,minSize:`${or}%`,className:"overflow-hidden",style:{minWidth:"var(--size-editor-min-width)",minHeight:"var(--size-editor-min-height)"},children:c.jsx(Gt,{node:t.second})})]})}),Gt=f.memo(function({node:t}){return t.type==="branch"?c.jsx(bi,{node:t}):c.jsx($s,{node:t})}),wi={center:"bg-accent-blue/10 border-accent-blue/30",left:"bg-accent-blue/15 border-l-2 border-accent-blue/50",right:"bg-accent-blue/15 border-r-2 border-accent-blue/50",top:"bg-accent-blue/15 border-t-2 border-accent-blue/50",bottom:"bg-accent-blue/15 border-b-2 border-accent-blue/50"},sr={center:"Move to group",left:"Split left",right:"Split right",top:"Split up",bottom:"Split down"},Ci=f.memo(function({onDrop:t,visible:n}){const[r,o]=f.useState(null),s=f.useRef(null),a=f.useCallback((d,h)=>{var v;const p=(v=s.current)==null?void 0:v.getBoundingClientRect();if(!p)return"center";const x=(d-p.left)/p.width,m=(h-p.top)/p.height,g=.25;return x<g?"left":x>1-g?"right":m<g?"top":m>1-g?"bottom":"center"},[]),l=f.useCallback(d=>{d.preventDefault(),d.dataTransfer.dropEffect="move",o(a(d.clientX,d.clientY))},[a]),i=f.useCallback(()=>{o(null)},[]),u=f.useCallback(d=>{d.preventDefault();const h=a(d.clientX,d.clientY);o(null),t(h)},[a,t]);return n?c.jsx("div",{ref:s,className:"absolute inset-0 z-50",onDragOver:l,onDragLeave:i,onDrop:u,children:c.jsxs("div",{className:"relative w-full h-full",children:[c.jsx(Ve,{zone:"left",activeZone:r,className:"absolute left-0 top-0 bottom-0 w-[25%]"}),c.jsx(Ve,{zone:"right",activeZone:r,className:"absolute right-0 top-0 bottom-0 w-[25%]"}),c.jsx(Ve,{zone:"top",activeZone:r,className:"absolute left-[25%] right-[25%] top-0 h-[25%]"}),c.jsx(Ve,{zone:"bottom",activeZone:r,className:"absolute left-[25%] right-[25%] bottom-0 h-[25%]"}),c.jsx(Ve,{zone:"center",activeZone:r,className:"absolute left-[25%] right-[25%] top-[25%] bottom-[25%]"})]})}):null});function Ve({zone:e,activeZone:t,className:n}){const r=t===e;return c.jsx("div",{className:`${n} transition-all duration-150 ${r?wi[e]:"border border-transparent"}`,"aria-label":sr[e],children:r&&c.jsx("div",{className:"flex items-center justify-center h-full",children:c.jsx("span",{className:"text-[length:var(--font-size-xs)] text-accent-blue font-[var(--font-weight-medium)] bg-bg-primary/80 px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)]",children:sr[e]})})})}const Pt=2;function Ye(e,t){if(e.type==="leaf")return e.id===t?0:-1;const n=Ye(e.first,t);if(n>=0)return n+1;const r=Ye(e.second,t);return r>=0?r+1:-1}function Wt(e){return e.type==="leaf"?[e.id]:[...Wt(e.first),...Wt(e.second)]}function Si({children:e}){const{dispatch:t}=fe(),n=Xe(h=>h.editorArea),r=Xe(h=>h.focusedGroupId),o=f.useRef(!1),s=f.useRef(null),[a,l]=f.useState(!1),i=f.useRef(n);i.current=n;const u=f.useRef(r);u.current=r,f.useEffect(()=>{function h(p){const x=i.current,m=u.current;if(p.ctrlKey&&p.key==="\\"&&!p.shiftKey&&!p.altKey){p.preventDefault(),Ye(x,m)<Pt&&t({type:"SPLIT_GROUP",groupId:m,direction:"horizontal"});return}if(p.ctrlKey&&p.key==="k"&&!p.shiftKey&&!p.altKey){p.preventDefault(),o.current=!0,s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current=!1},1e3);return}if(o.current&&p.ctrlKey&&p.key==="\\"){p.preventDefault(),o.current=!1,s.current&&(clearTimeout(s.current),s.current=null),Ye(x,m)<Pt&&t({type:"SPLIT_GROUP",groupId:m,direction:"vertical"});return}if(o.current&&(p.key==="ArrowRight"||p.key==="ArrowLeft")){p.preventDefault(),o.current=!1,s.current&&(clearTimeout(s.current),s.current=null);const g=Wt(x),v=g.indexOf(m);if(v>=0){const y=p.key==="ArrowRight"?(v+1)%g.length:(v-1+g.length)%g.length;t({type:"SET_FOCUSED_GROUP",groupId:g[y]})}return}}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t]);const d=f.useCallback(h=>{if(l(!1),!h||h==="center")return;const p=h==="left"||h==="right"?"horizontal":"vertical";Ye(n,r)>=Pt||t({type:"SPLIT_GROUP",groupId:r,direction:p})},[t,n,r]);return c.jsx(js,{content:e??null,children:c.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden relative bg-bg-primary",children:[c.jsx(Gt,{node:n}),c.jsx(Ci,{visible:a,onDrop:d})]})})}function Gr(e){return e.type==="leaf"?e:Gr(e.first)}function ht(e){return e.type==="leaf"?[e]:[...ht(e.first),...ht(e.second)]}function Ri(){const{dispatch:e}=fe(),t=Xe(i=>i.editorArea),n=Xe(i=>i.focusedGroupId),r=B(i=>i.processes),o=B(i=>i.activeProcessId),s=f.useMemo(()=>{const u=Date.now();return Object.entries(r).filter(([d,h])=>h.status==="running"||h.status==="spawning"||h.status==="paused"||d===o?!0:h.status==="stopped"||h.status==="error"?u-new Date(h.startedAt).getTime()<12e4:!1)},[r,o]),a=f.useRef(new Set);f.useEffect(()=>{const i=ht(t),u=new Set(s.map(([p])=>p)),d=new Set;for(const p of i)for(const x of p.tabs)x.ref&&d.add(x.ref);const h=n||Gr(t).id;for(const[p,x]of s){if(!d.has(p)){if(a.current.has(p))continue;const m=Sr[x.type]??x.type,g=i.find(v=>v.id===h);if(g){const v=g.tabs.find(y=>y.type==="chat"&&!y.ref);v&&e({type:"CLOSE_TAB",groupId:h,tabId:v.id})}e({type:"OPEN_TAB",groupId:h,tab:{id:`chat-${p}`,type:"chat",title:m,ref:p,icon:ss}})}a.current.add(p)}for(const p of i)for(const x of p.tabs)x.type==="chat"&&x.ref&&!u.has(x.ref)&&(e({type:"CLOSE_TAB",groupId:p.id,tabId:x.id}),a.current.delete(x.ref))},[s,n,e,t]);const l=f.useRef(o);return f.useEffect(()=>{if(!o||o===l.current){l.current=o;return}l.current=o;const i=`chat-${o}`,u=ht(t);for(const d of u)if(d.tabs.some(h=>h.id===i)){d.activeTabId!==i&&e({type:"SET_ACTIVE_TAB",groupId:d.id,tabId:i});break}},[o,t,e]),c.jsx(Si,{})}const Wr=f.createContext({sidebarOpen:!0,setSidebarOpen:()=>{},activeTab:"chat",setActiveTab:()=>{},fileTreeOpen:!1,setFileTreeOpen:()=>{},historyOpen:!1,setHistoryOpen:()=>{}});function ji(){return f.useContext(Wr)}function ir(e){const t=Mi(e),n=f.forwardRef((r,o)=>{const{children:s,...a}=r,l=f.Children.toArray(s),i=l.find(ki);if(i){const u=i.props.children,d=l.map(h=>h===i?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:h);return c.jsx(t,{...a,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,d):null})}return c.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function Mi(e){const t=f.forwardRef((n,r)=>{const{children:o,...s}=n;if(f.isValidElement(o)){const a=Ti(o),l=Pi(s,o.props);return o.type!==f.Fragment&&(l.ref=r?qt(r,a):a),f.cloneElement(o,l)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ei=Symbol("radix.slottable");function ki(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ei}function Pi(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const i=s(...l);return o(...l),i}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Ti(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Vr(e){const t=e+"CollectionProvider",[n,r]=et(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=g=>{const{scope:v,children:y}=g,w=be.useRef(null),b=be.useRef(new Map).current;return c.jsx(o,{scope:v,itemMap:b,collectionRef:w,children:y})};a.displayName=t;const l=e+"CollectionSlot",i=ir(l),u=be.forwardRef((g,v)=>{const{scope:y,children:w}=g,b=s(l,y),C=ae(v,b.collectionRef);return c.jsx(i,{ref:C,children:w})});u.displayName=l;const d=e+"CollectionItemSlot",h="data-radix-collection-item",p=ir(d),x=be.forwardRef((g,v)=>{const{scope:y,children:w,...b}=g,C=be.useRef(null),S=ae(v,C),j=s(d,y);return be.useEffect(()=>(j.itemMap.set(C,{ref:C,...b}),()=>void j.itemMap.delete(C))),c.jsx(p,{[h]:"",ref:S,children:w})});x.displayName=d;function m(g){const v=s(e+"CollectionConsumer",g);return be.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const b=Array.from(w.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((j,R)=>b.indexOf(j.ref.current)-b.indexOf(R.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:a,Slot:u,ItemSlot:x},m,r]}var Ai=f.createContext(void 0);function Hr(e){const t=f.useContext(Ai);return e||t||"ltr"}const Ii=["top","right","bottom","left"],me=Math.min,Z=Math.max,xt=Math.round,lt=Math.floor,ie=e=>({x:e,y:e}),Ni={left:"right",right:"left",bottom:"top",top:"bottom"};function Vt(e,t,n){return Z(e,me(t,n))}function ue(e,t){return typeof e=="function"?e(t):e}function de(e){return e.split("-")[0]}function Fe(e){return e.split("-")[1]}function an(e){return e==="x"?"y":"x"}function cn(e){return e==="y"?"height":"width"}function se(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ln(e){return an(se(e))}function Li(e,t,n){n===void 0&&(n=!1);const r=Fe(e),o=ln(e),s=cn(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=mt(a)),[a,mt(a)]}function Oi(e){const t=mt(e);return[Ht(e),t,Ht(t)]}function Ht(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ar=["left","right"],cr=["right","left"],_i=["top","bottom"],Di=["bottom","top"];function zi(e,t,n){switch(e){case"top":case"bottom":return n?t?cr:ar:t?ar:cr;case"left":case"right":return t?_i:Di;default:return[]}}function Fi(e,t,n,r){const o=Fe(e);let s=zi(de(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(Ht)))),s}function mt(e){const t=de(e);return Ni[t]+e.slice(t.length)}function $i(e){return{top:0,right:0,bottom:0,left:0,...e}}function Kr(e){return typeof e!="number"?$i(e):{top:e,right:e,bottom:e,left:e}}function gt(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function lr(e,t,n){let{reference:r,floating:o}=e;const s=se(t),a=ln(t),l=cn(a),i=de(t),u=s==="y",d=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,p=r[l]/2-o[l]/2;let x;switch(i){case"top":x={x:d,y:r.y-o.height};break;case"bottom":x={x:d,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:h};break;case"left":x={x:r.x-o.width,y:h};break;default:x={x:r.x,y:r.y}}switch(Fe(t)){case"start":x[a]-=p*(n&&u?-1:1);break;case"end":x[a]+=p*(n&&u?-1:1);break}return x}async function Bi(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:a,elements:l,strategy:i}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:x=0}=ue(t,e),m=Kr(x),v=l[p?h==="floating"?"reference":"floating":h],y=gt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:i})),w=h==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),C=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},S=gt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:b,strategy:i}):w);return{top:(y.top-S.top+m.top)/C.y,bottom:(S.bottom-y.bottom+m.bottom)/C.y,left:(y.left-S.left+m.left)/C.x,right:(S.right-y.right+m.right)/C.x}}const Gi=50,Wi=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:Bi},i=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:h}=lr(u,r,i),p=r,x=0;const m={};for(let g=0;g<s.length;g++){const v=s[g];if(!v)continue;const{name:y,fn:w}=v,{x:b,y:C,data:S,reset:j}=await w({x:d,y:h,initialPlacement:r,placement:p,strategy:o,middlewareData:m,rects:u,platform:l,elements:{reference:e,floating:t}});d=b??d,h=C??h,m[y]={...m[y],...S},j&&x<Gi&&(x++,typeof j=="object"&&(j.placement&&(p=j.placement),j.rects&&(u=j.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):j.rects),{x:d,y:h}=lr(u,p,i)),g=-1)}return{x:d,y:h,placement:p,strategy:o,middlewareData:m}},Vi=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:l,middlewareData:i}=t,{element:u,padding:d=0}=ue(e,t)||{};if(u==null)return{};const h=Kr(d),p={x:n,y:r},x=ln(o),m=cn(x),g=await a.getDimensions(u),v=x==="y",y=v?"top":"left",w=v?"bottom":"right",b=v?"clientHeight":"clientWidth",C=s.reference[m]+s.reference[x]-p[x]-s.floating[m],S=p[x]-s.reference[x],j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let R=j?j[b]:0;(!R||!await(a.isElement==null?void 0:a.isElement(j)))&&(R=l.floating[b]||s.floating[m]);const M=C/2-S/2,D=R/2-g[m]/2-1,O=me(h[y],D),P=me(h[w],D),E=O,L=R-g[m]-P,T=R/2-g[m]/2+M,N=Vt(E,T,L),A=!i.arrow&&Fe(o)!=null&&T!==N&&s.reference[m]/2-(T<E?O:P)-g[m]/2<0,_=A?T<E?T-E:T-L:0;return{[x]:p[x]+_,data:{[x]:N,centerOffset:T-N-_,...A&&{alignmentOffset:_}},reset:A}}}),Hi=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:l,platform:i,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...v}=ue(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=de(o),w=se(l),b=de(l)===l,C=await(i.isRTL==null?void 0:i.isRTL(u.floating)),S=p||(b||!g?[mt(l)]:Oi(l)),j=m!=="none";!p&&j&&S.push(...Fi(l,g,m,C));const R=[l,...S],M=await i.detectOverflow(t,v),D=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&D.push(M[y]),h){const T=Li(o,a,C);D.push(M[T[0]],M[T[1]])}if(O=[...O,{placement:o,overflows:D}],!D.every(T=>T<=0)){var P,E;const T=(((P=s.flip)==null?void 0:P.index)||0)+1,N=R[T];if(N&&(!(h==="alignment"?w!==se(N):!1)||O.every(I=>se(I.placement)===w?I.overflows[0]>0:!0)))return{data:{index:T,overflows:O},reset:{placement:N}};let A=(E=O.filter(_=>_.overflows[0]<=0).sort((_,I)=>_.overflows[1]-I.overflows[1])[0])==null?void 0:E.placement;if(!A)switch(x){case"bestFit":{var L;const _=(L=O.filter(I=>{if(j){const k=se(I.placement);return k===w||k==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(k=>k>0).reduce((k,z)=>k+z,0)]).sort((I,k)=>I[1]-k[1])[0])==null?void 0:L[0];_&&(A=_);break}case"initialPlacement":A=l;break}if(o!==A)return{reset:{placement:A}}}return{}}}};function ur(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function dr(e){return Ii.some(t=>e[t]>=0)}const Ki=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=ue(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=ur(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:dr(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),l=ur(a,n.floating);return{data:{escapedOffsets:l,escaped:dr(l)}}}default:return{}}}}},Ur=new Set(["left","top"]);async function Ui(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=de(n),l=Fe(n),i=se(n)==="y",u=Ur.has(a)?-1:1,d=s&&i?-1:1,h=ue(t,e);let{mainAxis:p,crossAxis:x,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof m=="number"&&(x=l==="end"?m*-1:m),i?{x:x*d,y:p*u}:{x:p*u,y:x*d}}const Yi=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:l}=t,i=await Ui(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+i.x,y:s+i.y,data:{...i,placement:a}}}}},Xi=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:i={fn:y=>{let{x:w,y:b}=y;return{x:w,y:b}}},...u}=ue(e,t),d={x:n,y:r},h=await s.detectOverflow(t,u),p=se(de(o)),x=an(p);let m=d[x],g=d[p];if(a){const y=x==="y"?"top":"left",w=x==="y"?"bottom":"right",b=m+h[y],C=m-h[w];m=Vt(b,m,C)}if(l){const y=p==="y"?"top":"left",w=p==="y"?"bottom":"right",b=g+h[y],C=g-h[w];g=Vt(b,g,C)}const v=i.fn({...t,[x]:m,[p]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[x]:a,[p]:l}}}}}},Zi=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:l=0,mainAxis:i=!0,crossAxis:u=!0}=ue(e,t),d={x:n,y:r},h=se(o),p=an(h);let x=d[p],m=d[h];const g=ue(l,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(i){const b=p==="y"?"height":"width",C=s.reference[p]-s.floating[b]+v.mainAxis,S=s.reference[p]+s.reference[b]-v.mainAxis;x<C?x=C:x>S&&(x=S)}if(u){var y,w;const b=p==="y"?"width":"height",C=Ur.has(de(o)),S=s.reference[h]-s.floating[b]+(C&&((y=a.offset)==null?void 0:y[h])||0)+(C?0:v.crossAxis),j=s.reference[h]+s.reference[b]+(C?0:((w=a.offset)==null?void 0:w[h])||0)-(C?v.crossAxis:0);m<S?m=S:m>j&&(m=j)}return{[p]:x,[h]:m}}}},qi=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:l}=t,{apply:i=()=>{},...u}=ue(e,t),d=await a.detectOverflow(t,u),h=de(o),p=Fe(o),x=se(o)==="y",{width:m,height:g}=s.floating;let v,y;h==="top"||h==="bottom"?(v=h,y=p===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(y=h,v=p==="end"?"top":"bottom");const w=g-d.top-d.bottom,b=m-d.left-d.right,C=me(g-d[v],w),S=me(m-d[y],b),j=!t.middlewareData.shift;let R=C,M=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=w),j&&!p){const O=Z(d.left,0),P=Z(d.right,0),E=Z(d.top,0),L=Z(d.bottom,0);x?M=m-2*(O!==0||P!==0?O+P:Z(d.left,d.right)):R=g-2*(E!==0||L!==0?E+L:Z(d.top,d.bottom))}await i({...t,availableWidth:M,availableHeight:R});const D=await a.getDimensions(l.floating);return m!==D.width||g!==D.height?{reset:{rects:!0}}:{}}}};function Ct(){return typeof window<"u"}function $e(e){return Yr(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ce(e){var t;return(t=(Yr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Yr(e){return Ct()?e instanceof Node||e instanceof q(e).Node:!1}function Q(e){return Ct()?e instanceof Element||e instanceof q(e).Element:!1}function pe(e){return Ct()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function fr(e){return!Ct()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}function nt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ee(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Ji(e){return/^(table|td|th)$/.test($e(e))}function St(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Qi=/transform|translate|scale|rotate|perspective|filter/,ea=/paint|layout|strict|content/,Ce=e=>!!e&&e!=="none";let Tt;function un(e){const t=Q(e)?ee(e):e;return Ce(t.transform)||Ce(t.translate)||Ce(t.scale)||Ce(t.rotate)||Ce(t.perspective)||!dn()&&(Ce(t.backdropFilter)||Ce(t.filter))||Qi.test(t.willChange||"")||ea.test(t.contain||"")}function ta(e){let t=ge(e);for(;pe(t)&&!ze(t);){if(un(t))return t;if(St(t))return null;t=ge(t)}return null}function dn(){return Tt==null&&(Tt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Tt}function ze(e){return/^(html|body|#document)$/.test($e(e))}function ee(e){return q(e).getComputedStyle(e)}function Rt(e){return Q(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ge(e){if($e(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fr(e)&&e.host||ce(e);return fr(t)?t.host:t}function Xr(e){const t=ge(e);return ze(t)?e.ownerDocument?e.ownerDocument.body:e.body:pe(t)&&nt(t)?t:Xr(t)}function qe(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Xr(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=q(o);if(s){const l=Kt(a);return t.concat(a,a.visualViewport||[],nt(o)?o:[],l&&n?qe(l):[])}else return t.concat(o,qe(o,[],n))}function Kt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zr(e){const t=ee(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=pe(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=xt(n)!==s||xt(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function fn(e){return Q(e)?e:e.contextElement}function _e(e){const t=fn(e);if(!pe(t))return ie(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Zr(t);let a=(s?xt(n.width):n.width)/r,l=(s?xt(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const na=ie(0);function qr(e){const t=q(e);return!dn()||!t.visualViewport?na:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ra(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function Me(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=fn(e);let a=ie(1);t&&(r?Q(r)&&(a=_e(r)):a=_e(e));const l=ra(s,n,r)?qr(s):ie(0);let i=(o.left+l.x)/a.x,u=(o.top+l.y)/a.y,d=o.width/a.x,h=o.height/a.y;if(s){const p=q(s),x=r&&Q(r)?q(r):r;let m=p,g=Kt(m);for(;g&&r&&x!==m;){const v=_e(g),y=g.getBoundingClientRect(),w=ee(g),b=y.left+(g.clientLeft+parseFloat(w.paddingLeft))*v.x,C=y.top+(g.clientTop+parseFloat(w.paddingTop))*v.y;i*=v.x,u*=v.y,d*=v.x,h*=v.y,i+=b,u+=C,m=q(g),g=Kt(m)}}return gt({width:d,height:h,x:i,y:u})}function jt(e,t){const n=Rt(e).scrollLeft;return t?t.left+n:Me(ce(e)).left+n}function Jr(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-jt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function oa(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=ce(r),l=t?St(t.floating):!1;if(r===a||l&&s)return n;let i={scrollLeft:0,scrollTop:0},u=ie(1);const d=ie(0),h=pe(r);if((h||!h&&!s)&&(($e(r)!=="body"||nt(a))&&(i=Rt(r)),h)){const x=Me(r);u=_e(r),d.x=x.x+r.clientLeft,d.y=x.y+r.clientTop}const p=a&&!h&&!s?Jr(a,i):ie(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-i.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-i.scrollTop*u.y+d.y+p.y}}function sa(e){return Array.from(e.getClientRects())}function ia(e){const t=ce(e),n=Rt(e),r=e.ownerDocument.body,o=Z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+jt(e);const l=-n.scrollTop;return ee(r).direction==="rtl"&&(a+=Z(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:l}}const pr=25;function aa(e,t){const n=q(e),r=ce(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,l=0,i=0;if(o){s=o.width,a=o.height;const d=dn();(!d||d&&t==="fixed")&&(l=o.offsetLeft,i=o.offsetTop)}const u=jt(r);if(u<=0){const d=r.ownerDocument,h=d.body,p=getComputedStyle(h),x=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(r.clientWidth-h.clientWidth-x);m<=pr&&(s-=m)}else u<=pr&&(s+=u);return{width:s,height:a,x:l,y:i}}function ca(e,t){const n=Me(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=pe(e)?_e(e):ie(1),a=e.clientWidth*s.x,l=e.clientHeight*s.y,i=o*s.x,u=r*s.y;return{width:a,height:l,x:i,y:u}}function hr(e,t,n){let r;if(t==="viewport")r=aa(e,n);else if(t==="document")r=ia(ce(e));else if(Q(t))r=ca(t,n);else{const o=qr(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return gt(r)}function Qr(e,t){const n=ge(e);return n===t||!Q(n)||ze(n)?!1:ee(n).position==="fixed"||Qr(n,t)}function la(e,t){const n=t.get(e);if(n)return n;let r=qe(e,[],!1).filter(l=>Q(l)&&$e(l)!=="body"),o=null;const s=ee(e).position==="fixed";let a=s?ge(e):e;for(;Q(a)&&!ze(a);){const l=ee(a),i=un(a);!i&&l.position==="fixed"&&(o=null),(s?!i&&!o:!i&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||nt(a)&&!i&&Qr(e,a))?r=r.filter(d=>d!==a):o=l,a=ge(a)}return t.set(e,r),r}function ua(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?St(t)?[]:la(t,this._c):[].concat(n),r],l=hr(t,a[0],o);let i=l.top,u=l.right,d=l.bottom,h=l.left;for(let p=1;p<a.length;p++){const x=hr(t,a[p],o);i=Z(x.top,i),u=me(x.right,u),d=me(x.bottom,d),h=Z(x.left,h)}return{width:u-h,height:d-i,x:h,y:i}}function da(e){const{width:t,height:n}=Zr(e);return{width:t,height:n}}function fa(e,t,n){const r=pe(t),o=ce(t),s=n==="fixed",a=Me(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const i=ie(0);function u(){i.x=jt(o)}if(r||!r&&!s)if(($e(t)!=="body"||nt(o))&&(l=Rt(t)),r){const x=Me(t,!0,s,t);i.x=x.x+t.clientLeft,i.y=x.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?Jr(o,l):ie(0),h=a.left+l.scrollLeft-i.x-d.x,p=a.top+l.scrollTop-i.y-d.y;return{x:h,y:p,width:a.width,height:a.height}}function At(e){return ee(e).position==="static"}function xr(e,t){if(!pe(e)||ee(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ce(e)===n&&(n=n.ownerDocument.body),n}function eo(e,t){const n=q(e);if(St(e))return n;if(!pe(e)){let o=ge(e);for(;o&&!ze(o);){if(Q(o)&&!At(o))return o;o=ge(o)}return n}let r=xr(e,t);for(;r&&Ji(r)&&At(r);)r=xr(r,t);return r&&ze(r)&&At(r)&&!un(r)?n:r||ta(e)||n}const pa=async function(e){const t=this.getOffsetParent||eo,n=this.getDimensions,r=await n(e.floating);return{reference:fa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ha(e){return ee(e).direction==="rtl"}const xa={convertOffsetParentRelativeRectToViewportRelativeRect:oa,getDocumentElement:ce,getClippingRect:ua,getOffsetParent:eo,getElementRects:pa,getClientRects:sa,getDimensions:da,getScale:_e,isElement:Q,isRTL:ha};function to(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ma(e,t){let n=null,r;const o=ce(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,i){l===void 0&&(l=!1),i===void 0&&(i=1),s();const u=e.getBoundingClientRect(),{left:d,top:h,width:p,height:x}=u;if(l||t(),!p||!x)return;const m=lt(h),g=lt(o.clientWidth-(d+p)),v=lt(o.clientHeight-(h+x)),y=lt(d),b={rootMargin:-m+"px "+-g+"px "+-v+"px "+-y+"px",threshold:Z(0,me(1,i))||1};let C=!0;function S(j){const R=j[0].intersectionRatio;if(R!==i){if(!C)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R===1&&!to(u,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(S,{...b,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,b)}n.observe(e)}return a(!0),s}function ga(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:i=!1}=r,u=fn(e),d=o||s?[...u?qe(u):[],...t?qe(t):[]]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const h=u&&l?ma(u,n):null;let p=-1,x=null;a&&(x=new ResizeObserver(y=>{let[w]=y;w&&w.target===u&&x&&t&&(x.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var b;(b=x)==null||b.observe(t)})),n()}),u&&!i&&x.observe(u),t&&x.observe(t));let m,g=i?Me(e):null;i&&v();function v(){const y=Me(e);g&&!to(g,y)&&n(),g=y,m=requestAnimationFrame(v)}return n(),()=>{var y;d.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),h==null||h(),(y=x)==null||y.disconnect(),x=null,i&&cancelAnimationFrame(m)}}const va=Yi,ya=Xi,ba=Hi,wa=qi,Ca=Ki,mr=Vi,Sa=Zi,Ra=(e,t,n)=>{const r=new Map,o={platform:xa,...n},s={...o.platform,_c:r};return Wi(e,t,{...o,platform:s})};var ja=typeof document<"u",Ma=function(){},pt=ja?f.useLayoutEffect:Ma;function vt(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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vt(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!vt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function no(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gr(e,t){const n=no(e);return Math.round(t*n)/n}function It(e){const t=f.useRef(e);return pt(()=>{t.current=e}),t}function Ea(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:i,open:u}=e,[d,h]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,x]=f.useState(r);vt(p,r)||x(r);const[m,g]=f.useState(null),[v,y]=f.useState(null),w=f.useCallback(I=>{I!==j.current&&(j.current=I,g(I))},[]),b=f.useCallback(I=>{I!==R.current&&(R.current=I,y(I))},[]),C=s||m,S=a||v,j=f.useRef(null),R=f.useRef(null),M=f.useRef(d),D=i!=null,O=It(i),P=It(o),E=It(u),L=f.useCallback(()=>{if(!j.current||!R.current)return;const I={placement:t,strategy:n,middleware:p};P.current&&(I.platform=P.current),Ra(j.current,R.current,I).then(k=>{const z={...k,isPositioned:E.current!==!1};T.current&&!vt(M.current,z)&&(M.current=z,Cr.flushSync(()=>{h(z)}))})},[p,t,n,P,E]);pt(()=>{u===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,h(I=>({...I,isPositioned:!1})))},[u]);const T=f.useRef(!1);pt(()=>(T.current=!0,()=>{T.current=!1}),[]),pt(()=>{if(C&&(j.current=C),S&&(R.current=S),C&&S){if(O.current)return O.current(C,S,L);L()}},[C,S,L,O,D]);const N=f.useMemo(()=>({reference:j,floating:R,setReference:w,setFloating:b}),[w,b]),A=f.useMemo(()=>({reference:C,floating:S}),[C,S]),_=f.useMemo(()=>{const I={position:n,left:0,top:0};if(!A.floating)return I;const k=gr(A.floating,d.x),z=gr(A.floating,d.y);return l?{...I,transform:"translate("+k+"px, "+z+"px)",...no(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:z}},[n,l,A.floating,d.x,d.y]);return f.useMemo(()=>({...d,update:L,refs:N,elements:A,floatingStyles:_}),[d,L,N,A,_])}const ka=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?mr({element:r.current,padding:o}).fn(n):{}:r?mr({element:r,padding:o}).fn(n):{}}}},Pa=(e,t)=>{const n=va(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ta=(e,t)=>{const n=ya(e);return{name:n.name,fn:n.fn,options:[e,t]}},Aa=(e,t)=>({fn:Sa(e).fn,options:[e,t]}),Ia=(e,t)=>{const n=ba(e);return{name:n.name,fn:n.fn,options:[e,t]}},Na=(e,t)=>{const n=wa(e);return{name:n.name,fn:n.fn,options:[e,t]}},La=(e,t)=>{const n=Ca(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oa=(e,t)=>{const n=ka(e);return{name:n.name,fn:n.fn,options:[e,t]}};var _a="Arrow",ro=f.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return c.jsx(te.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});ro.displayName=_a;var Da=ro;function za(e){const[t,n]=f.useState(void 0);return _t(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,l;if("borderBoxSize"in s){const i=s.borderBoxSize,u=Array.isArray(i)?i[0]:i;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var pn="Popper",[oo,so]=et(pn),[Fa,io]=oo(pn),ao=e=>{const{__scopePopper:t,children:n}=e,[r,o]=f.useState(null);return c.jsx(Fa,{scope:t,anchor:r,onAnchorChange:o,children:n})};ao.displayName=pn;var co="PopperAnchor",lo=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=io(co,n),a=f.useRef(null),l=ae(t,a),i=f.useRef(null);return f.useEffect(()=>{const u=i.current;i.current=(r==null?void 0:r.current)||a.current,u!==i.current&&s.onAnchorChange(i.current)}),r?null:c.jsx(te.div,{...o,ref:l})});lo.displayName=co;var hn="PopperContent",[$a,Ba]=oo(hn),uo=f.forwardRef((e,t)=>{var X,ye,K,Be,Rn,jn;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:i=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:x="optimized",onPlaced:m,...g}=e,v=io(hn,n),[y,w]=f.useState(null),b=ae(t,Ge=>w(Ge)),[C,S]=f.useState(null),j=za(C),R=(j==null?void 0:j.width)??0,M=(j==null?void 0:j.height)??0,D=r+(s!=="center"?"-"+s:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},P=Array.isArray(u)?u:[u],E=P.length>0,L={padding:O,boundary:P.filter(Wa),altBoundary:E},{refs:T,floatingStyles:N,placement:A,isPositioned:_,middlewareData:I}=Ea({strategy:"fixed",placement:D,whileElementsMounted:(...Ge)=>ga(...Ge,{animationFrame:x==="always"}),elements:{reference:v.anchor},middleware:[Pa({mainAxis:o+M,alignmentAxis:a}),i&&Ta({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Aa():void 0,...L}),i&&Ia({...L}),Na({...L,apply:({elements:Ge,rects:Mn,availableWidth:ts,availableHeight:ns})=>{const{width:rs,height:os}=Mn.reference,it=Ge.floating.style;it.setProperty("--radix-popper-available-width",`${ts}px`),it.setProperty("--radix-popper-available-height",`${ns}px`),it.setProperty("--radix-popper-anchor-width",`${rs}px`),it.setProperty("--radix-popper-anchor-height",`${os}px`)}}),C&&Oa({element:C,padding:l}),Va({arrowWidth:R,arrowHeight:M}),p&&La({strategy:"referenceHidden",...L})]}),[k,z]=ho(A),G=tt(m);_t(()=>{_&&(G==null||G())},[_,G]);const Y=(X=I.arrow)==null?void 0:X.x,ne=(ye=I.arrow)==null?void 0:ye.y,ve=((K=I.arrow)==null?void 0:K.centerOffset)!==0,[Ae,W]=f.useState();return _t(()=>{y&&W(window.getComputedStyle(y).zIndex)},[y]),c.jsx("div",{ref:T.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:_?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ae,"--radix-popper-transform-origin":[(Be=I.transformOrigin)==null?void 0:Be.x,(Rn=I.transformOrigin)==null?void 0:Rn.y].join(" "),...((jn=I.hide)==null?void 0:jn.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx($a,{scope:n,placedSide:k,onArrowChange:S,arrowX:Y,arrowY:ne,shouldHideArrow:ve,children:c.jsx(te.div,{"data-side":k,"data-align":z,...g,ref:b,style:{...g.style,animation:_?void 0:"none"}})})})});uo.displayName=hn;var fo="PopperArrow",Ga={top:"bottom",right:"left",bottom:"top",left:"right"},po=f.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Ba(fo,r),a=Ga[s.placedSide];return c.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:c.jsx(Da,{...o,ref:n,style:{...o.style,display:"block"}})})});po.displayName=fo;function Wa(e){return e!==null}var Va=e=>({name:"transformOrigin",options:e,fn(t){var v,y,w;const{placement:n,rects:r,middlewareData:o}=t,a=((v=o.arrow)==null?void 0:v.centerOffset)!==0,l=a?0:e.arrowWidth,i=a?0:e.arrowHeight,[u,d]=ho(n),h={start:"0%",center:"50%",end:"100%"}[d],p=(((y=o.arrow)==null?void 0:y.x)??0)+l/2,x=(((w=o.arrow)==null?void 0:w.y)??0)+i/2;let m="",g="";return u==="bottom"?(m=a?h:`${p}px`,g=`${-i}px`):u==="top"?(m=a?h:`${p}px`,g=`${r.floating.height+i}px`):u==="right"?(m=`${-i}px`,g=a?h:`${x}px`):u==="left"&&(m=`${r.floating.width+i}px`,g=a?h:`${x}px`),{data:{x:m,y:g}}}});function ho(e){const[t,n="center"]=e.split("-");return[t,n]}var Ha=ao,Ka=lo,Ua=uo,Ya=po,Nt="rovingFocusGroup.onEntryFocus",Xa={bubbles:!1,cancelable:!0},rt="RovingFocusGroup",[Ut,xo,Za]=Vr(rt),[qa,mo]=et(rt,[Za]),[Ja,Qa]=qa(rt),go=f.forwardRef((e,t)=>c.jsx(Ut.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(Ut.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(ec,{...e,ref:t})})}));go.displayName=rt;var ec=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:i,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,p=f.useRef(null),x=ae(t,p),m=Hr(s),[g,v]=as({prop:a,defaultProp:l??null,onChange:i,caller:rt}),[y,w]=f.useState(!1),b=tt(u),C=xo(n),S=f.useRef(!1),[j,R]=f.useState(0);return f.useEffect(()=>{const M=p.current;if(M)return M.addEventListener(Nt,b),()=>M.removeEventListener(Nt,b)},[b]),c.jsx(Ja,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:g,onItemFocus:f.useCallback(M=>v(M),[v]),onItemShiftTab:f.useCallback(()=>w(!0),[]),onFocusableItemAdd:f.useCallback(()=>R(M=>M+1),[]),onFocusableItemRemove:f.useCallback(()=>R(M=>M-1),[]),children:c.jsx(te.div,{tabIndex:y||j===0?-1:0,"data-orientation":r,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:F(e.onMouseDown,()=>{S.current=!0}),onFocus:F(e.onFocus,M=>{const D=!S.current;if(M.target===M.currentTarget&&D&&!y){const O=new CustomEvent(Nt,Xa);if(M.currentTarget.dispatchEvent(O),!O.defaultPrevented){const P=C().filter(A=>A.focusable),E=P.find(A=>A.active),L=P.find(A=>A.id===g),N=[E,L,...P].filter(Boolean).map(A=>A.ref.current);bo(N,d)}}S.current=!1}),onBlur:F(e.onBlur,()=>w(!1))})})}),vo="RovingFocusGroupItem",yo=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:a,...l}=e,i=is(),u=s||i,d=Qa(vo,n),h=d.currentTabStopId===u,p=xo(n),{onFocusableItemAdd:x,onFocusableItemRemove:m,currentTabStopId:g}=d;return f.useEffect(()=>{if(r)return x(),()=>m()},[r,x,m]),c.jsx(Ut.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:c.jsx(te.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:F(e.onMouseDown,v=>{r?d.onItemFocus(u):v.preventDefault()}),onFocus:F(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:F(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=rc(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let b=p().filter(C=>C.focusable).map(C=>C.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const C=b.indexOf(v.currentTarget);b=d.loop?oc(b,C+1):b.slice(C+1)}setTimeout(()=>bo(b))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:g!=null}):a})})});yo.displayName=vo;var tc={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function nc(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function rc(e,t,n){const r=nc(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return tc[r]}function bo(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function oc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var sc=go,ic=yo;function ac(e){const t=cc(e),n=f.forwardRef((r,o)=>{const{children:s,...a}=r,l=f.Children.toArray(s),i=l.find(uc);if(i){const u=i.props.children,d=l.map(h=>h===i?f.Children.count(u)>1?f.Children.only(null):f.isValidElement(u)?u.props.children:null:h);return c.jsx(t,{...a,ref:o,children:f.isValidElement(u)?f.cloneElement(u,void 0,d):null})}return c.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function cc(e){const t=f.forwardRef((n,r)=>{const{children:o,...s}=n;if(f.isValidElement(o)){const a=fc(o),l=dc(s,o.props);return o.type!==f.Fragment&&(l.ref=r?qt(r,a):a),f.cloneElement(o,l)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var lc=Symbol("radix.slottable");function uc(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lc}function dc(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const i=s(...l);return o(...l),i}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function fc(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Yt=["Enter"," "],pc=["ArrowDown","PageUp","Home"],wo=["ArrowUp","PageDown","End"],hc=[...pc,...wo],xc={ltr:[...Yt,"ArrowRight"],rtl:[...Yt,"ArrowLeft"]},mc={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ot="Menu",[Je,gc,vc]=Vr(ot),[Pe,Co]=et(ot,[vc,so,mo]),Mt=so(),So=mo(),[yc,Te]=Pe(ot),[bc,st]=Pe(ot),Ro=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:a=!0}=e,l=Mt(t),[i,u]=f.useState(null),d=f.useRef(!1),h=tt(s),p=Hr(o);return f.useEffect(()=>{const x=()=>{d.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>d.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),c.jsx(Ha,{...l,children:c.jsx(yc,{scope:t,open:n,onOpenChange:h,content:i,onContentChange:u,children:c.jsx(bc,{scope:t,onClose:f.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:p,modal:a,children:r})})})};Ro.displayName=ot;var wc="MenuAnchor",xn=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Mt(n);return c.jsx(Ka,{...o,...r,ref:t})});xn.displayName=wc;var mn="MenuPortal",[Cc,jo]=Pe(mn,{forceMount:void 0}),Mo=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Te(mn,t);return c.jsx(Cc,{scope:t,forceMount:n,children:c.jsx(wt,{present:n||s.open,children:c.jsx(cs,{asChild:!0,container:o,children:r})})})};Mo.displayName=mn;var J="MenuContent",[Sc,gn]=Pe(J),Eo=f.forwardRef((e,t)=>{const n=jo(J,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Te(J,e.__scopeMenu),a=st(J,e.__scopeMenu);return c.jsx(Je.Provider,{scope:e.__scopeMenu,children:c.jsx(wt,{present:r||s.open,children:c.jsx(Je.Slot,{scope:e.__scopeMenu,children:a.modal?c.jsx(Rc,{...o,ref:t}):c.jsx(jc,{...o,ref:t})})})})}),Rc=f.forwardRef((e,t)=>{const n=Te(J,e.__scopeMenu),r=f.useRef(null),o=ae(t,r);return f.useEffect(()=>{const s=r.current;if(s)return ls(s)},[]),c.jsx(vn,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:F(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),jc=f.forwardRef((e,t)=>{const n=Te(J,e.__scopeMenu);return c.jsx(vn,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Mc=ac("MenuContent.ScrollLock"),vn=f.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:i,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:p,onDismiss:x,disableOutsideScroll:m,...g}=e,v=Te(J,n),y=st(J,n),w=Mt(n),b=So(n),C=gc(n),[S,j]=f.useState(null),R=f.useRef(null),M=ae(t,R,v.onContentChange),D=f.useRef(0),O=f.useRef(""),P=f.useRef(0),E=f.useRef(null),L=f.useRef("right"),T=f.useRef(0),N=m?ds:f.Fragment,A=m?{as:Mc,allowPinchZoom:!0}:void 0,_=k=>{var X,ye;const z=O.current+k,G=C().filter(K=>!K.disabled),Y=document.activeElement,ne=(X=G.find(K=>K.ref.current===Y))==null?void 0:X.textValue,ve=G.map(K=>K.textValue),Ae=zc(ve,z,ne),W=(ye=G.find(K=>K.textValue===Ae))==null?void 0:ye.ref.current;(function K(Be){O.current=Be,window.clearTimeout(D.current),Be!==""&&(D.current=window.setTimeout(()=>K(""),1e3))})(z),W&&setTimeout(()=>W.focus())};f.useEffect(()=>()=>window.clearTimeout(D.current),[]),us();const I=f.useCallback(k=>{var G,Y;return L.current===((G=E.current)==null?void 0:G.side)&&$c(k,(Y=E.current)==null?void 0:Y.area)},[]);return c.jsx(Sc,{scope:n,searchRef:O,onItemEnter:f.useCallback(k=>{I(k)&&k.preventDefault()},[I]),onItemLeave:f.useCallback(k=>{var z;I(k)||((z=R.current)==null||z.focus(),j(null))},[I]),onTriggerLeave:f.useCallback(k=>{I(k)&&k.preventDefault()},[I]),pointerGraceTimerRef:P,onPointerGraceIntentChange:f.useCallback(k=>{E.current=k},[]),children:c.jsx(N,{...A,children:c.jsx(fs,{asChild:!0,trapped:o,onMountAutoFocus:F(s,k=>{var z;k.preventDefault(),(z=R.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:c.jsx(ps,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:p,onDismiss:x,children:c.jsx(sc,{asChild:!0,...b,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:j,onEntryFocus:F(i,k=>{y.isUsingKeyboardRef.current||k.preventDefault()}),preventScrollOnEntryFocus:!0,children:c.jsx(Ua,{role:"menu","aria-orientation":"vertical","data-state":Wo(v.open),"data-radix-menu-content":"",dir:y.dir,...w,...g,ref:M,style:{outline:"none",...g.style},onKeyDown:F(g.onKeyDown,k=>{const G=k.target.closest("[data-radix-menu-content]")===k.currentTarget,Y=k.ctrlKey||k.altKey||k.metaKey,ne=k.key.length===1;G&&(k.key==="Tab"&&k.preventDefault(),!Y&&ne&&_(k.key));const ve=R.current;if(k.target!==ve||!hc.includes(k.key))return;k.preventDefault();const W=C().filter(X=>!X.disabled).map(X=>X.ref.current);wo.includes(k.key)&&W.reverse(),_c(W)}),onBlur:F(e.onBlur,k=>{k.currentTarget.contains(k.target)||(window.clearTimeout(D.current),O.current="")}),onPointerMove:F(e.onPointerMove,Qe(k=>{const z=k.target,G=T.current!==k.clientX;if(k.currentTarget.contains(z)&&G){const Y=k.clientX>T.current?"right":"left";L.current=Y,T.current=k.clientX}}))})})})})})})});Eo.displayName=J;var Ec="MenuGroup",yn=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(te.div,{role:"group",...r,ref:t})});yn.displayName=Ec;var kc="MenuLabel",ko=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(te.div,{...r,ref:t})});ko.displayName=kc;var yt="MenuItem",vr="menu.itemSelect",Et=f.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=f.useRef(null),a=st(yt,e.__scopeMenu),l=gn(yt,e.__scopeMenu),i=ae(t,s),u=f.useRef(!1),d=()=>{const h=s.current;if(!n&&h){const p=new CustomEvent(vr,{bubbles:!0,cancelable:!0});h.addEventListener(vr,x=>r==null?void 0:r(x),{once:!0}),hs(h,p),p.defaultPrevented?u.current=!1:a.onClose()}};return c.jsx(Po,{...o,ref:i,disabled:n,onClick:F(e.onClick,d),onPointerDown:h=>{var p;(p=e.onPointerDown)==null||p.call(e,h),u.current=!0},onPointerUp:F(e.onPointerUp,h=>{var p;u.current||(p=h.currentTarget)==null||p.click()}),onKeyDown:F(e.onKeyDown,h=>{const p=l.searchRef.current!=="";n||p&&h.key===" "||Yt.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Et.displayName=yt;var Po=f.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,a=gn(yt,n),l=So(n),i=f.useRef(null),u=ae(t,i),[d,h]=f.useState(!1),[p,x]=f.useState("");return f.useEffect(()=>{const m=i.current;m&&x((m.textContent??"").trim())},[s.children]),c.jsx(Je.ItemSlot,{scope:n,disabled:r,textValue:o??p,children:c.jsx(ic,{asChild:!0,...l,focusable:!r,children:c.jsx(te.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:F(e.onPointerMove,Qe(m=>{r?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:F(e.onPointerLeave,Qe(m=>a.onItemLeave(m))),onFocus:F(e.onFocus,()=>h(!0)),onBlur:F(e.onBlur,()=>h(!1))})})})}),Pc="MenuCheckboxItem",To=f.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return c.jsx(Oo,{scope:e.__scopeMenu,checked:n,children:c.jsx(Et,{role:"menuitemcheckbox","aria-checked":bt(n)?"mixed":n,...o,ref:t,"data-state":wn(n),onSelect:F(o.onSelect,()=>r==null?void 0:r(bt(n)?!0:!n),{checkForDefaultPrevented:!1})})})});To.displayName=Pc;var Ao="MenuRadioGroup",[Tc,Ac]=Pe(Ao,{value:void 0,onValueChange:()=>{}}),Io=f.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=tt(r);return c.jsx(Tc,{scope:e.__scopeMenu,value:n,onValueChange:s,children:c.jsx(yn,{...o,ref:t})})});Io.displayName=Ao;var No="MenuRadioItem",Lo=f.forwardRef((e,t)=>{const{value:n,...r}=e,o=Ac(No,e.__scopeMenu),s=n===o.value;return c.jsx(Oo,{scope:e.__scopeMenu,checked:s,children:c.jsx(Et,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":wn(s),onSelect:F(r.onSelect,()=>{var a;return(a=o.onValueChange)==null?void 0:a.call(o,n)},{checkForDefaultPrevented:!1})})})});Lo.displayName=No;var bn="MenuItemIndicator",[Oo,Ic]=Pe(bn,{checked:!1}),_o=f.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=Ic(bn,n);return c.jsx(wt,{present:r||bt(s.checked)||s.checked===!0,children:c.jsx(te.span,{...o,ref:t,"data-state":wn(s.checked)})})});_o.displayName=bn;var Nc="MenuSeparator",Do=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(te.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Do.displayName=Nc;var Lc="MenuArrow",zo=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Mt(n);return c.jsx(Ya,{...o,...r,ref:t})});zo.displayName=Lc;var Oc="MenuSub",[nu,Fo]=Pe(Oc),Ke="MenuSubTrigger",$o=f.forwardRef((e,t)=>{const n=Te(Ke,e.__scopeMenu),r=st(Ke,e.__scopeMenu),o=Fo(Ke,e.__scopeMenu),s=gn(Ke,e.__scopeMenu),a=f.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:i}=s,u={__scopeMenu:e.__scopeMenu},d=f.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return f.useEffect(()=>d,[d]),f.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),i(null)}},[l,i]),c.jsx(xn,{asChild:!0,...u,children:c.jsx(Po,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Wo(n.open),...e,ref:qt(t,o.onTriggerChange),onClick:h=>{var p;(p=e.onClick)==null||p.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:F(e.onPointerMove,Qe(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:F(e.onPointerLeave,Qe(h=>{var x,m;d();const p=(x=n.content)==null?void 0:x.getBoundingClientRect();if(p){const g=(m=n.content)==null?void 0:m.dataset.side,v=g==="right",y=v?-5:5,w=p[v?"left":"right"],b=p[v?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+y,y:h.clientY},{x:w,y:p.top},{x:b,y:p.top},{x:b,y:p.bottom},{x:w,y:p.bottom}],side:g}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:F(e.onKeyDown,h=>{var x;const p=s.searchRef.current!=="";e.disabled||p&&h.key===" "||xc[r.dir].includes(h.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),h.preventDefault())})})})});$o.displayName=Ke;var Bo="MenuSubContent",Go=f.forwardRef((e,t)=>{const n=jo(J,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Te(J,e.__scopeMenu),a=st(J,e.__scopeMenu),l=Fo(Bo,e.__scopeMenu),i=f.useRef(null),u=ae(t,i);return c.jsx(Je.Provider,{scope:e.__scopeMenu,children:c.jsx(wt,{present:r||s.open,children:c.jsx(Je.Slot,{scope:e.__scopeMenu,children:c.jsx(vn,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;a.isUsingKeyboardRef.current&&((h=i.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:F(e.onFocusOutside,d=>{d.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:F(e.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:F(e.onKeyDown,d=>{var x;const h=d.currentTarget.contains(d.target),p=mc[a.dir].includes(d.key);h&&p&&(s.onOpenChange(!1),(x=l.trigger)==null||x.focus(),d.preventDefault())})})})})})});Go.displayName=Bo;function Wo(e){return e?"open":"closed"}function bt(e){return e==="indeterminate"}function wn(e){return bt(e)?"indeterminate":e?"checked":"unchecked"}function _c(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Dc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function zc(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=Dc(e,Math.max(s,0));o.length===1&&(a=a.filter(u=>u!==n));const i=a.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return i!==n?i:void 0}function Fc(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const l=t[s],i=t[a],u=l.x,d=l.y,h=i.x,p=i.y;d>r!=p>r&&n<(h-u)*(r-d)/(p-d)+u&&(o=!o)}return o}function $c(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Fc(n,t)}function Qe(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Bc=Ro,Gc=xn,Wc=Mo,Vc=Eo,Hc=yn,Kc=ko,Uc=Et,Yc=To,Xc=Io,Zc=Lo,qc=_o,Jc=Do,Qc=zo,el=$o,tl=Go,Cn="ContextMenu",[nl]=et(Cn,[Co]),H=Co(),[rl,Vo]=nl(Cn),Ho=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:o,modal:s=!0}=e,[a,l]=f.useState(!1),i=H(t),u=tt(r),d=f.useCallback(h=>{l(h),u(h)},[u]);return c.jsx(rl,{scope:t,open:a,onOpenChange:d,modal:s,children:c.jsx(Bc,{...i,dir:o,open:a,onOpenChange:d,modal:s,children:n})})};Ho.displayName=Cn;var Ko="ContextMenuTrigger",Uo=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...o}=e,s=Vo(Ko,n),a=H(n),l=f.useRef({x:0,y:0}),i=f.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),u=f.useRef(0),d=f.useCallback(()=>window.clearTimeout(u.current),[]),h=p=>{l.current={x:p.clientX,y:p.clientY},s.onOpenChange(!0)};return f.useEffect(()=>d,[d]),f.useEffect(()=>void(r&&d()),[r,d]),c.jsxs(c.Fragment,{children:[c.jsx(Gc,{...a,virtualRef:i}),c.jsx(te.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...o,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:F(e.onContextMenu,p=>{d(),h(p),p.preventDefault()}),onPointerDown:r?e.onPointerDown:F(e.onPointerDown,ut(p=>{d(),u.current=window.setTimeout(()=>h(p),700)})),onPointerMove:r?e.onPointerMove:F(e.onPointerMove,ut(d)),onPointerCancel:r?e.onPointerCancel:F(e.onPointerCancel,ut(d)),onPointerUp:r?e.onPointerUp:F(e.onPointerUp,ut(d))})]})});Uo.displayName=Ko;var ol="ContextMenuPortal",Yo=e=>{const{__scopeContextMenu:t,...n}=e,r=H(t);return c.jsx(Wc,{...r,...n})};Yo.displayName=ol;var Xo="ContextMenuContent",Zo=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Vo(Xo,n),s=H(n),a=f.useRef(!1);return c.jsx(Vc,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var i;(i=e.onCloseAutoFocus)==null||i.call(e,l),!l.defaultPrevented&&a.current&&l.preventDefault(),a.current=!1},onInteractOutside:l=>{var i;(i=e.onInteractOutside)==null||i.call(e,l),!l.defaultPrevented&&!o.modal&&(a.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Zo.displayName=Xo;var sl="ContextMenuGroup",il=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(Hc,{...o,...r,ref:t})});il.displayName=sl;var al="ContextMenuLabel",cl=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(Kc,{...o,...r,ref:t})});cl.displayName=al;var ll="ContextMenuItem",qo=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(Uc,{...o,...r,ref:t})});qo.displayName=ll;var ul="ContextMenuCheckboxItem",dl=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(Yc,{...o,...r,ref:t})});dl.displayName=ul;var fl="ContextMenuRadioGroup",pl=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(Xc,{...o,...r,ref:t})});pl.displayName=fl;var hl="ContextMenuRadioItem",xl=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(Zc,{...o,...r,ref:t})});xl.displayName=hl;var ml="ContextMenuItemIndicator",gl=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(qc,{...o,...r,ref:t})});gl.displayName=ml;var vl="ContextMenuSeparator",Jo=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(Jc,{...o,...r,ref:t})});Jo.displayName=vl;var yl="ContextMenuArrow",bl=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(Qc,{...o,...r,ref:t})});bl.displayName=yl;var wl="ContextMenuSubTrigger",Cl=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(el,{...o,...r,ref:t})});Cl.displayName=wl;var Sl="ContextMenuSubContent",Rl=f.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=H(n);return c.jsx(tl,{...o,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Rl.displayName=Sl;function ut(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var jl=Ho,Ml=Uo,El=Yo,kl=Zo,Pl=qo,Tl=Jo;function Al(e,t,n){const r=[],o=n.toLowerCase();function s(a,l){for(const i of a)o&&i.type==="file"&&!i.name.toLowerCase().includes(o)&&!i.path.toLowerCase().includes(o)||(r.push({node:i,depth:l}),i.type==="directory"&&i.children&&(o||t.has(i.path))&&s(i.children,l+1))}return s(e,0),r}function Il(){const[e,t]=f.useState([]),[n,r]=f.useState(!0),[o,s]=f.useState(""),[a,l]=f.useState(new Set),i=f.useCallback(async()=>{r(!0);try{const p=await fetch("/api/workspace?tree=true");p.ok&&t(await p.json())}catch{}finally{r(!1)}},[]);f.useEffect(()=>{i()},[i]);const u=f.useCallback(p=>{p.type==="directory"&&l(x=>{const m=new Set(x);return m.has(p.path)?m.delete(p.path):m.add(p.path),m})},[]),d=f.useCallback(()=>{l(new Set)},[]),h=f.useMemo(()=>Al(e,a,o),[e,a,o]);return{tree:e,loading:n,refreshTree:i,flatNodes:h,expandedPaths:a,searchQuery:o,setSearchQuery:s,toggleExpand:u,collapseAll:d}}function Nl(e=15e3){const[t,n]=f.useState(""),[r,o]=f.useState([]),[s,a]=f.useState([]),[l,i]=f.useState([]),[u,d]=f.useState([]),[h,p]=f.useState(!0),[x,m]=f.useState(null),g=f.useRef(!0),v=f.useCallback(async()=>{p(!0),m(null);try{const[y,w]=await Promise.all([fetch("/api/git/status"),fetch("/api/git/log?limit=8")]);if(!g.current)return;if(y.ok){const b=await y.json();b.error?m(b.error):(n(b.branch??""),o(b.staged??[]),a(b.unstaged??[]),i(b.untracked??[]))}else m(`Status fetch failed (${y.status})`);if(w.ok){const b=await w.json();b.error||d(b.commits??[])}}catch(y){g.current&&m(y.message)}finally{g.current&&p(!1)}},[]);return f.useEffect(()=>{g.current=!0,v();const y=setInterval(v,e);return()=>{g.current=!1,clearInterval(y)}},[v,e]),{branch:t,staged:r,unstaged:s,untracked:l,commits:u,loading:h,error:x,refresh:v}}function Ll(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}const Qo={chat:{title:"Conversations",path:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},files:{title:"Explorer",path:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"},git:{title:"Source Control",path:""},search:{title:"Search",path:""}};function Ol({tab:e}){return e==="git"?c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("circle",{cx:"18",cy:"18",r:"3"}),c.jsx("circle",{cx:"6",cy:"6",r:"3"}),c.jsx("path",{d:"M13 6h3a2 2 0 0 1 2 2v7"}),c.jsx("line",{x1:"6",y1:"9",x2:"6",y2:"21"})]}):e==="search"?c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}):c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("path",{d:Qo[e].path})})}function Xt(e){return e.type==="leaf"?[e]:[...Xt(e.first),...Xt(e.second)]}async function _l(e){try{await navigator.clipboard.writeText(e)}catch{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}}function Dl(){const e=B(x=>x.processes),t=B(x=>x.setActiveProcessId),n=B(x=>x.activeProcessId),r=B(x=>x.selectedProcessIds),[o,s]=f.useState(null),a=f.useRef(null),{state:l,dispatch:i}=fe(),u=f.useCallback(async(x,m)=>{var j;if(m&&(m.ctrlKey||m.metaKey)){m.preventDefault(),B.getState().toggleProcessSelection(x),a.current=x;return}const{selectedProcessIds:g,clearProcessSelection:v}=B.getState();if(g.size>0&&!g.has(x)){B.getState().toggleProcessSelection(x),a.current=x;return}if(g.has(x)&&g.size===1){v(),a.current=null;return}v(),t(x),a.current=x;const y=`chat-${x}`,w=Xt(l.editorArea);for(const R of w)if(R.tabs.some(M=>M.id===y)){R.activeTabId!==y&&i({type:"SET_ACTIVE_TAB",groupId:R.id,tabId:y});break}const{entries:b,setEntries:C}=B.getState(),S=b[x];if(!(S&&S.some(R=>R.type==="user_message"||R.type==="assistant_message"))){s(x);try{const R=x.startsWith("cli-history-"),M=R?x.replace("cli-history-",""):x,D=R?`/api/cli-history/${encodeURIComponent(M)}/entries`:`/api/agents/${encodeURIComponent(x)}/entries`,O=await fetch(D);if(O.ok){const P=await O.json(),E=[];for(const N of P){const A={...N,processId:x};if(A.type==="assistant_message"){A.partial=!1;const _=E[E.length-1];if(_&&_.type==="assistant_message"){_.content+=A.content;continue}}if(A.type==="tool_use"&&(A.status==="completed"||A.status==="failed")){const _=E.findLastIndex(I=>I.type==="tool_use"&&I.status==="running");if(_!==-1){const I=E[_];E[_]={...I,status:A.status,result:A.result??I.result,input:I.input&&Object.keys(I.input).length>0?I.input:A.input};continue}}E.push(A)}const L=[];for(let N=0;N<E.length;N++)E[N].type==="token_usage"&&L.push(N);if(L.length>1)for(let N=L.length-2;N>=0;N--)E.splice(L[N],1);if(!E.some(N=>N.type==="user_message")){const N=B.getState().processes[x],A=(j=N==null?void 0:N.config)==null?void 0:j.prompt;if(A){const _={id:`synth-user-${x}`,processId:x,timestamp:N.startedAt,type:"user_message",content:A};E.unshift(_)}}C(x,E)}}catch{}s(null)}},[t,l.editorArea,i]);f.useEffect(()=>{function x(m){const{selectedProcessIds:g,clearProcessSelection:v,batchDismissProcesses:y}=B.getState();m.key==="Escape"&&g.size>0&&v(),m.key==="Delete"&&g.size>0&&y(g)}return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[]);const{active:d,completed:h}=f.useMemo(()=>{const x=Object.values(e),m=[],g=[];for(const v of x)v.status==="running"||v.status==="spawning"?m.push(v):g.push(v);return m.sort((v,y)=>new Date(y.startedAt).getTime()-new Date(v.startedAt).getTime()),g.sort((v,y)=>new Date(y.startedAt).getTime()-new Date(v.startedAt).getTime()),{active:m,completed:g}},[e]),p=r.size>0;return d.length===0&&h.length===0?c.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"No conversations yet"}):c.jsxs(c.Fragment,{children:[d.length>0&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] px-[6px] pt-[6px] pb-[2px]",style:{color:"var(--color-text-tertiary)"},children:["Active (",d.length,")"]}),d.map(x=>c.jsx(yr,{process:x,isActive:x.id===n,isSelected:r.has(x.id),hasSelection:p,loading:o===x.id,onSelect:u},x.id))]}),h.length>0&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] px-[6px] pt-[8px] pb-[2px]",style:{color:"var(--color-text-tertiary)"},children:["Completed (",h.length,")"]}),h.map(x=>c.jsx(yr,{process:x,isActive:x.id===n,isSelected:r.has(x.id),hasSelection:p,loading:o===x.id,onSelect:u},x.id))]}),p&&c.jsx(zl,{count:r.size})]})}function zl({count:e}){const t=B(o=>o.clearProcessSelection),n=B(o=>o.selectedProcessIds),r=f.useCallback(()=>{B.getState().batchDismissProcesses(n)},[n]);return c.jsxs("div",{className:"flex items-center gap-2 mx-1 mt-2 px-3 py-2 rounded-lg",style:{backgroundColor:"var(--color-tint-exploring)",border:"1px solid var(--color-accent-blue)"},children:[c.jsxs("span",{className:"text-[11px] font-medium flex-1",style:{color:"var(--color-text-primary)"},children:[e," selected"]}),c.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium border-none cursor-pointer",style:{backgroundColor:"var(--color-tint-blocked)",color:"var(--color-accent-red)"},children:[c.jsx(Rr,{size:11}),"Delete"]}),c.jsx("button",{type:"button",onClick:t,className:"px-2 py-1 rounded text-[10px] border-none cursor-pointer",style:{backgroundColor:"var(--color-bg-hover)",color:"var(--color-text-secondary)"},children:"Cancel"})]})}function yr({process:e,isActive:t,isSelected:n,hasSelection:r,loading:o,onSelect:s}){var S,j;const[a,l]=f.useState(!1),[i,u]=f.useState(""),d=f.useRef(null),h=B(R=>R.processTitles),x=e.status==="running"||e.status==="spawning"?"var(--color-accent-green)":e.status==="error"?"var(--color-accent-red, #D05454)":"var(--color-text-placeholder)",m=Sr[e.type]??e.type,g=h[e.id]??((j=(S=e.config)==null?void 0:S.prompt)==null?void 0:j.slice(0,40))??m,v=f.useCallback(()=>{u(g),l(!0),requestAnimationFrame(()=>{var R;return(R=d.current)==null?void 0:R.focus()})},[g]),y=f.useCallback(()=>{const R=i.trim();R&&R!==g&&B.getState().renameProcess(e.id,R),l(!1)},[i,g,e.id]),w=f.useCallback(R=>{R.key==="Enter"?(R.preventDefault(),y()):R.key==="Escape"&&l(!1)},[y]),b=f.useCallback(()=>{_l(g)},[g]),C=f.useCallback(()=>{B.getState().dismissProcess(e.id)},[e.id]);return c.jsxs(jl,{children:[c.jsx(Ml,{asChild:!0,children:c.jsxs("div",{className:"relative flex items-center gap-[7px] w-full rounded-[5px] cursor-pointer transition-all duration-100",style:{padding:"5px 7px",backgroundColor:n?"var(--color-tint-exploring)":t?"var(--color-bg-active)":"transparent",borderLeft:n?"2px solid var(--color-accent-blue)":"2px solid transparent"},onClick:R=>s(e.id,R),onMouseEnter:R=>{!t&&!n&&(R.currentTarget.style.backgroundColor="var(--color-bg-hover)")},onMouseLeave:R=>{!t&&!n&&(R.currentTarget.style.backgroundColor="transparent")},children:[r&&c.jsx("span",{className:"shrink-0 w-[13px] h-[13px] rounded-[3px] border flex items-center justify-center",style:{borderColor:n?"var(--color-accent-blue)":"var(--color-border)",backgroundColor:n?"var(--color-accent-blue)":"transparent"},children:n&&c.jsx("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("polyline",{points:"20 6 9 17 4 12"})})}),c.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:x}}),c.jsxs("div",{className:"flex-1 min-w-0",children:[a?c.jsx("input",{ref:d,type:"text",value:i,onChange:R=>u(R.target.value),onBlur:y,onKeyDown:w,className:"w-full text-[11px] font-medium bg-transparent border-b outline-none py-0",style:{color:"var(--color-text-primary)",borderColor:"var(--color-accent-blue)",fontFamily:"inherit"},onClick:R=>R.stopPropagation()}):c.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:"var(--color-text-primary)"},children:o?"Loading...":g}),c.jsxs("div",{className:"text-[9px]",style:{color:"var(--color-text-tertiary)"},children:[Ll(e.startedAt)," · ",m.toLowerCase()]})]})]})}),c.jsx(El,{children:c.jsxs(kl,{className:"min-w-[150px] z-[100] rounded-md py-1",style:{backgroundColor:"var(--color-bg-elevated, var(--color-bg-primary))",border:"1px solid var(--color-border)",boxShadow:"0 4px 16px rgba(0,0,0,0.12)"},onCloseAutoFocus:R=>R.preventDefault(),children:[c.jsx(Lt,{icon:c.jsx(gs,{size:13}),label:"Rename",shortcut:"F2",onSelect:v}),c.jsx(Lt,{icon:c.jsx(ys,{size:13}),label:"Copy Title",onSelect:b}),c.jsx(Tl,{className:"h-px my-1",style:{backgroundColor:"var(--color-border-divider)"}}),c.jsx(Lt,{icon:c.jsx(Rr,{size:13}),label:"Delete",shortcut:"Del",destructive:!0,onSelect:C})]})})]})}function Lt({icon:e,label:t,shortcut:n,destructive:r,onSelect:o}){return c.jsxs(Pl,{className:"flex items-center gap-2 w-full px-3 py-1.5 text-[12px] rounded-sm cursor-pointer outline-none transition-colors",style:{color:r?"var(--color-accent-red)":"var(--color-text-secondary)"},onSelect:o,onMouseEnter:s=>{s.currentTarget.style.backgroundColor=r?"var(--color-tint-blocked)":"var(--color-bg-hover)"},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent"},children:[c.jsx("span",{className:"shrink-0",style:{opacity:.7},children:e}),c.jsx("span",{className:"flex-1",children:t}),n&&c.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--color-text-tertiary)"},children:n})]})}function Sn(e){return e.type==="leaf"?e:Sn(e.first)}function Fl(){const{sidebarOpen:e,activeTab:t,setActiveTab:n}=ji(),[r,o]=f.useState(""),s=Il(),{state:a,dispatch:l}=fe(),i=f.useCallback(u=>{const d=Sn(a.editorArea),h=u.split(/[\\/]/).pop()??u;l({type:"OPEN_TAB",groupId:d.id,tab:{id:`file-${u}`,type:"file",title:h,ref:u}})},[a.editorArea,l]);return c.jsxs("div",{className:"shrink-0 flex flex-col overflow-hidden transition-[width] duration-200",style:{width:e?230:0,backgroundColor:"var(--color-bg-secondary)",borderRight:e?"1px solid var(--color-border)":"none"},children:[c.jsx("div",{className:"flex items-center shrink-0",style:{height:32,padding:"0 4px",borderBottom:"1px solid var(--color-border-divider)"},children:["chat","files","git","search"].map(u=>c.jsx("button",{type:"button",onClick:()=>n(u),title:Qo[u].title,className:"flex items-center justify-center border-none bg-transparent cursor-pointer transition-all duration-100",style:{width:30,height:32,color:t===u?"var(--color-text-primary)":"var(--color-text-tertiary)",borderBottom:t===u?"2px solid var(--color-text-primary)":"2px solid transparent"},onMouseEnter:d=>{t!==u&&(d.currentTarget.style.color="var(--color-text-primary)")},onMouseLeave:d=>{t!==u&&(d.currentTarget.style.color="var(--color-text-tertiary)")},children:c.jsx(Ol,{tab:u})},u))}),c.jsx("div",{className:"px-[8px] py-[4px]",children:c.jsxs("div",{className:"relative",children:[c.jsxs("svg",{className:"absolute left-[7px] top-1/2 -translate-y-1/2 pointer-events-none",width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-text-placeholder)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("circle",{cx:"11",cy:"11",r:"8"}),c.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),c.jsx("input",{type:"text",value:r,onChange:u=>o(u.target.value),placeholder:"Search...",className:"w-full py-[4px] pl-[26px] pr-[7px] text-[11px] rounded-[5px] border outline-none transition-[border-color] duration-100",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-card)",color:"var(--color-text-primary)",fontFamily:"inherit"},onFocus:u=>{u.currentTarget.style.borderColor="var(--color-accent-blue)"},onBlur:u=>{u.currentTarget.style.borderColor="var(--color-border)"}})]})}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-[6px] pb-[8px]",children:[t==="chat"&&c.jsx(Dl,{}),t==="files"&&c.jsx(ms,{tree:s.tree,selectedPath:null,onSelectFile:i,loading:s.loading}),t==="git"&&c.jsx(Gl,{}),t==="search"&&c.jsx($l,{searchQuery:r,onSelectFile:i})]})]})}function $l({searchQuery:e,onSelectFile:t}){const[n,r]=f.useState([]),[o,s]=f.useState(0),[a,l]=f.useState(!1),[i,u]=f.useState(new Set),d=f.useRef(null);f.useEffect(()=>{if(d.current&&clearTimeout(d.current),e.length<2){r([]),s(0);return}return l(!0),d.current=setTimeout(async()=>{try{const x=await fetch(`/api/workspace/search?q=${encodeURIComponent(e)}&limit=30`);if(x.ok){const m=await x.json();r(m.results),s(m.total),u(new Set)}}catch{}l(!1)},300),()=>{d.current&&clearTimeout(d.current)}},[e]);const h=f.useMemo(()=>{const x=new Map;for(const m of n){const g=x.get(m.file);g?g.push(m):x.set(m.file,[m])}return x},[n]),p=f.useCallback(x=>{u(m=>{const g=new Set(m);return g.has(x)?g.delete(x):g.add(x),g})},[]);return e.length<2?c.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"Type to search across files"}):a?c.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"Searching..."}):n.length===0?c.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"No results"}):c.jsxs("div",{children:[c.jsxs("div",{className:"text-[9px] px-[6px] py-[2px]",style:{color:"var(--color-text-tertiary)"},children:[o," result",o!==1?"s":""," in ",h.size," file",h.size!==1?"s":""]}),[...h.entries()].map(([x,m])=>c.jsxs("div",{children:[c.jsxs("button",{type:"button",onClick:()=>p(x),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",fontFamily:"inherit"},children:[c.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:i.has(x)?"rotate(0deg)":"rotate(90deg)",transition:"transform 100ms"},children:c.jsx("path",{d:"M2 1l4 3-4 3z"})}),c.jsx(es,{}),c.jsx("span",{className:"flex-1 min-w-0 text-[11px] font-medium truncate",style:{color:"var(--color-text-primary)"},children:x}),c.jsx("span",{className:"text-[9px] shrink-0",style:{color:"var(--color-text-tertiary)"},children:m.length})]}),!i.has(x)&&m.map(g=>c.jsxs("button",{type:"button",onClick:()=>t(x),className:"flex items-center gap-[6px] w-full border-none bg-transparent cursor-pointer text-left transition-colors duration-75",style:{padding:"3px 7px 3px 22px",color:"var(--color-text-primary)",fontFamily:"inherit"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent"},children:[c.jsx("span",{className:"text-[10px] shrink-0 font-mono",style:{color:"var(--color-text-tertiary)",minWidth:28,textAlign:"right"},children:g.line}),c.jsx("span",{className:"text-[11px] truncate min-w-0",children:g.text.trim()})]},`${x}:${g.line}`))]},x))]})}const br={M:{bg:"rgba(201,155,45,0.15)",color:"var(--color-accent-yellow)"},A:{bg:"rgba(61,155,111,0.15)",color:"var(--color-accent-green)"},D:{bg:"rgba(208,84,84,0.15)",color:"var(--color-accent-red)"},R:{bg:"rgba(130,130,200,0.15)",color:"var(--color-accent-blue)"}};function Bl({status:e}){const t=br[e]??br.M;return c.jsx("span",{className:"text-[9px] font-semibold px-[5px] rounded-[3px] shrink-0",style:{backgroundColor:t.bg,color:t.color},children:e})}function es(){return c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",style:{opacity:.6},children:[c.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),c.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Ot({path:e,status:t,onClick:n}){return c.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-[6px] px-[7px] py-[3px] rounded-[4px] cursor-pointer w-full border-none bg-transparent text-left transition-colors duration-75",style:{color:"var(--color-text-primary)",fontFamily:"inherit"},onMouseEnter:r=>{r.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:r=>{r.currentTarget.style.backgroundColor="transparent"},children:[c.jsx(es,{}),c.jsx("span",{className:"flex-1 min-w-0 text-[11px] truncate",children:e}),c.jsx(Bl,{status:t})]})}function Gl(){const e=Nl(),{state:t,dispatch:n}=fe(),[r,o]=f.useState(!0),[s,a]=f.useState(!0),[l,i]=f.useState(!0),u=f.useCallback(p=>{const x=Sn(t.editorArea),m=p.split(/[\\/]/).pop()??p;n({type:"OPEN_TAB",groupId:x.id,tab:{id:`file-${p}`,type:"file",title:m,ref:p}})},[t.editorArea,n]);if(e.loading&&!e.branch)return c.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-text-tertiary)"},children:"Loading git status..."});if(e.error&&!e.branch)return c.jsx("div",{className:"px-[10px] py-[20px] text-center text-[11px]",style:{color:"var(--color-accent-red)"},children:e.error});const d=e.staged.length,h=e.unstaged.length+e.untracked.length;return c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-[5px] px-[7px] py-[4px] text-[11px] font-medium",style:{color:"var(--color-text-primary)"},children:[c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-green)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",children:[c.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),c.jsx("circle",{cx:"18",cy:"6",r:"3"}),c.jsx("circle",{cx:"6",cy:"18",r:"3"}),c.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),c.jsx("span",{className:"flex-1 min-w-0 truncate",children:e.branch||"unknown"}),c.jsx("button",{type:"button",onClick:e.refresh,title:"Refresh",className:"flex items-center justify-center border-none bg-transparent cursor-pointer rounded-[3px] transition-colors duration-75",style:{width:18,height:18,color:"var(--color-text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:p=>{p.currentTarget.style.color="var(--color-text-tertiary)"},children:c.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("polyline",{points:"23 4 23 10 17 10"}),c.jsx("polyline",{points:"1 20 1 14 7 14"}),c.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})})]}),d>0&&c.jsxs("div",{children:[c.jsxs("button",{type:"button",onClick:()=>o(p=>!p),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",fontFamily:"inherit"},children:[c.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 100ms"},children:c.jsx("path",{d:"M2 1l4 3-4 3z"})}),c.jsxs("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em]",style:{color:"var(--color-text-tertiary)"},children:["Staged Changes (",d,")"]})]}),r&&e.staged.map(p=>c.jsx(Ot,{path:p.path,status:p.status,onClick:()=>u(p.path)},`staged-${p.path}`))]}),h>0&&c.jsxs("div",{children:[c.jsxs("button",{type:"button",onClick:()=>a(p=>!p),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",fontFamily:"inherit"},children:[c.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:s?"rotate(90deg)":"rotate(0deg)",transition:"transform 100ms"},children:c.jsx("path",{d:"M2 1l4 3-4 3z"})}),c.jsxs("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em]",style:{color:"var(--color-text-tertiary)"},children:["Changes (",h,")"]})]}),s&&c.jsxs(c.Fragment,{children:[e.unstaged.map(p=>c.jsx(Ot,{path:p.path,status:p.status,onClick:()=>u(p.path)},`unstaged-${p.path}`)),e.untracked.map(p=>c.jsx(Ot,{path:p,status:"A",onClick:()=>u(p)},`untracked-${p}`))]})]}),d===0&&h===0&&c.jsx("div",{className:"px-[7px] py-[10px] text-center text-[10px]",style:{color:"var(--color-text-tertiary)"},children:"No changes detected"}),e.commits.length>0&&c.jsxs("div",{children:[c.jsxs("button",{type:"button",onClick:()=>i(p=>!p),className:"flex items-center gap-[4px] w-full border-none bg-transparent cursor-pointer text-left",style:{padding:"4px 6px",marginTop:4,fontFamily:"inherit"},children:[c.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"var(--color-text-tertiary)",style:{transform:l?"rotate(90deg)":"rotate(0deg)",transition:"transform 100ms"},children:c.jsx("path",{d:"M2 1l4 3-4 3z"})}),c.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-[0.04em]",style:{color:"var(--color-text-tertiary)"},children:"Recent Commits"})]}),l&&e.commits.map(p=>c.jsxs("div",{className:"flex items-center gap-[6px] px-[7px] py-[3px] text-[10px]",style:{color:"var(--color-text-primary)",opacity:.7},children:[c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"shrink-0",children:c.jsx("circle",{cx:"6",cy:"6",r:"3",fill:"var(--color-text-tertiary)"})}),c.jsxs("span",{className:"truncate min-w-0",children:[c.jsx("span",{className:"font-mono",style:{color:"var(--color-accent-blue)",marginRight:4},children:p.shortHash}),p.message]})]},p.hash))]})]})}function ru(){const e=B(u=>u.activeProcessId),[t,n]=f.useState(!0),[r,o]=f.useState("chat");Rs(e);const s=t&&r==="files",a=f.useCallback(u=>{u?(n(!0),o("files")):r==="files"&&n(!1)},[r]),l=t&&r==="chat",i=f.useCallback(u=>{u?(n(!0),o("chat")):r==="chat"&&n(!1)},[r]);return c.jsx(Wr,{value:{sidebarOpen:t,setSidebarOpen:n,activeTab:r,setActiveTab:o,fileTreeOpen:s,setFileTreeOpen:a,historyOpen:l,setHistoryOpen:i},children:c.jsxs("div",{className:"h-full flex min-w-0 overflow-hidden relative",children:[c.jsx(Fl,{}),c.jsx("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:c.jsx(Ri,{})})]})})}export{ru as ChatPage};
@@ -1 +1 @@
1
- import{j as e,a0 as L,a1 as c,a2 as w,r as d,V as z}from"./index-DWG-WrzT.js";import{A as M}from"./index-Do71weNR.js";import{m as T}from"./proxy-BKxDAKTj.js";function $(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function D({member:t}){return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-[var(--radius-md)] border border-border bg-bg-secondary hover:shadow-sm transition-shadow",children:[e.jsxs("div",{className:"relative flex-shrink-0 rounded-full flex items-center justify-center",style:{width:40,height:40,backgroundColor:"#6b7280"},children:[e.jsx("span",{className:"text-white text-[length:14px] font-semibold select-none",children:t.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-bg-secondary",style:{backgroundColor:L[t.status]}})]}),e.jsxs("div",{className:"flex flex-col min-w-0 gap-0.5",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary truncate",children:t.name}),(t.currentPhase||t.currentTask)&&e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary truncate",children:[t.currentPhase,t.currentTask].filter(Boolean).join(" / ")}),e.jsx("span",{className:"text-[length:10px] text-text-tertiary",children:$(t.lastSeen)})]})]})}function R(){const t=c(a=>a.filteredMembers());return t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[e.jsx("span",{className:"text-text-secondary text-[length:var(--font-size-sm)]",children:"No team members found"}),e.jsxs("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:["Run ",e.jsx("code",{className:"px-1 py-0.5 bg-bg-hover rounded text-[10px]",children:"maestro team join"})," to join the team"]})]}):e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:t.map(a=>e.jsx(D,{member:a},a.uid))})}function O(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function E({entry:t}){const a=w[t.action]??"#9ca3af";return e.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-[length:var(--font-size-xs)]",style:{borderLeft:`3px solid ${a}`},children:[e.jsx("span",{className:"text-text-tertiary flex-shrink-0 tabular-nums w-12",children:O(t.ts)}),e.jsx("span",{className:"font-[var(--font-weight-medium)] text-text-primary flex-shrink-0",children:t.user}),e.jsxs("span",{className:"text-text-secondary truncate",children:[t.action,t.target?` → ${t.target}`:""]})]})}function _(){const t=c(s=>s.activity),a=d.useRef(null),r=t.slice(-100);return d.useEffect(()=>{const s=a.current;s&&(s.scrollTop=s.scrollHeight)},[r.length]),r.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity yet"})}):e.jsx("div",{ref:a,className:"flex flex-col gap-1 overflow-y-auto h-full pr-1",children:r.map(s=>e.jsx(E,{entry:s},`${s.ts}-${s.user}-${s.action}`))})}const k={high:{label:"High",color:"#dc2626",bg:"rgba(239,68,68,0.08)",border:"rgba(239,68,68,0.2)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(234,179,8,0.08)",border:"rgba(234,179,8,0.2)"},low:{label:"Low",color:"#16a34a",bg:"rgba(34,197,94,0.08)",border:"rgba(34,197,94,0.2)"},none:{label:"None",color:"var(--color-text-tertiary, #9ca3af)",bg:"var(--color-bg-secondary)",border:"var(--color-border)"}};function A(t){return k[t]??k.none}function I(){const t=c(i=>i.aggregated),a=c(i=>i.members);if(c(i=>i.loading)&&t.length===0)return e.jsxs("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2 text-text-secondary",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading analysis data..."]});if(t.length===0)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-3",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M3 9h18"}),e.jsx("path",{d:"M9 21V9"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity data available for analysis"}),e.jsx("span",{className:"text-text-quaternary text-[length:var(--font-size-xs)]",children:"Activity will appear here as team members work on phases and tasks"})]});const s=t.reduce((i,m)=>i+m.count,0),o=new Set(t.flatMap(i=>i.members)).size,h=t.filter(i=>i.risk==="high").length,p=t.filter(i=>i.risk==="medium").length,x=[...t].sort((i,m)=>{const g={high:0,medium:1,low:2,none:3},v=g[i.risk]??3,u=g[m.risk]??3;return v!==u?v-u:m.count-i.count});return e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsx(N,{label:"Total Activity",value:s}),e.jsx(N,{label:"Active Members",value:o,total:a.length}),e.jsx(N,{label:"High Risk",value:h,color:h>0?"#dc2626":void 0}),e.jsx(N,{label:"Medium Risk",value:p,color:p>0?"#ca8a04":void 0})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[length:var(--font-size-xs)] text-text-tertiary",children:[e.jsx("span",{children:"Risk levels:"}),["none","low","medium","high"].map(i=>{const m=A(i);return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:m.color,opacity:.7}}),e.jsx("span",{children:m.label}),e.jsxs("span",{className:"text-text-quaternary",children:["(",i==="none"?"1":i==="low"?"2":i==="medium"?"3":"4+",i==="none"?" member":" members",")"]})]},i)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("h3",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-secondary uppercase tracking-wider",children:"Activity Concentration"}),e.jsx("div",{className:"grid grid-cols-1 gap-2",children:x.map((i,m)=>e.jsx(q,{entry:i},`${i.phase}::${i.task}::${m}`))})]})]})}function N({label:t,value:a,total:r,color:s}){return e.jsxs("div",{className:"rounded-[var(--radius-md,6px)] border border-border bg-bg-secondary px-4 py-3",children:[e.jsx("div",{className:"text-[10px] text-text-tertiary uppercase tracking-wider mb-1",children:t}),e.jsxs("div",{className:"text-[length:var(--font-size-xl)] font-bold",style:{color:s??"var(--color-text-primary)"},children:[a,r!=null&&e.jsxs("span",{className:"text-[length:var(--font-size-sm)] font-normal text-text-quaternary",children:[" / ",r]})]})]})}function q({entry:t}){const a=A(t.risk),r=t.phase||"(no phase)",s=t.task||"(general)";return e.jsxs("div",{className:"flex items-center gap-4 rounded-[var(--radius-md,6px)] px-4 py-3 border transition-colors",style:{backgroundColor:a.bg,borderColor:a.border},children:[e.jsx("div",{className:"flex flex-col items-center gap-1 shrink-0 w-[52px]",children:e.jsx("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-full",style:{color:a.color,backgroundColor:`${a.color}15`},children:a.label})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-medium text-text-primary truncate",children:r}),t.task&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-quaternary",children:"/"}),e.jsx("span",{className:"text-[length:var(--font-size-sm)] text-text-secondary truncate",children:s})]})]})}),e.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-bold text-text-primary",children:t.count}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"actions"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.members.slice(0,5).map(o=>e.jsx("span",{className:"w-6 h-6 rounded-full bg-bg-secondary border border-border flex items-center justify-center text-[10px] font-medium text-text-secondary uppercase",title:o,children:o.charAt(0)},o)),t.members.length>5&&e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:["+",t.members.length-5]})]})]})}const B={init:"⚡",join:"→",leave:"←",phase_change:"◆",task_update:"●",message:"✉",sync:"↻",report:"📋",discussion:"💬"},P=[{value:"all",label:"All types"},{value:"init",label:"Init"},{value:"join",label:"Join"},{value:"phase_change",label:"Phase changes"},{value:"task_update",label:"Task updates"},{value:"message",label:"Messages"},{value:"sync",label:"Sync"}];function F(t){const a=new Date(t),r=new Date,s=new Date(r);return s.setDate(s.getDate()-1),a.toDateString()===r.toDateString()?"Today":a.toDateString()===s.toDateString()?"Yesterday":a.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function H(t){return new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function W(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function V(t){return new Date(t).toDateString()}function U(t){switch(t){case"init":return"Initialized collaboration";case"join":return"Joined the team";case"leave":return"Left the team";case"phase_change":return"Changed phase";case"task_update":return"Updated task";case"message":return"Sent a message";case"sync":return"Synced activity";case"report":return"Generated report";case"discussion":return"Started discussion";default:return t}}function K(t){return`${w[t]??"#9ca3af"}12`}function G(){const t=c(n=>n.filteredActivity()),a=c(n=>n.members),r=c(n=>n.memberFilter),s=c(n=>n.typeFilter),o=c(n=>n.setMemberFilter),h=c(n=>n.setTypeFilter),p=c(n=>n.fetchActivity),x=c(n=>n.loading),[i,m]=d.useState(200);d.useEffect(()=>{p(i)},[p,i]);const g=d.useMemo(()=>{const n=[];let f="";for(const y of t){const j=V(y.ts);j!==f&&(f=j,n.push({day:j,label:F(y.ts),entries:[]})),n[n.length-1].entries.push(y)}return n},[t]),v=new Set(t.map(n=>n.user)).size,u=new Set(t.map(n=>n.action)).size;return x&&t.length===0?e.jsx("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading history..."}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 pb-4",children:[e.jsxs("select",{value:r,onChange:n=>o(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:[e.jsx("option",{value:"all",children:"All members"}),a.map(n=>e.jsx("option",{value:n.uid,children:n.name},n.uid))]}),e.jsx("select",{value:s,onChange:n=>h(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:P.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))}),(r!=="all"||s!=="all")&&e.jsx("button",{type:"button",onClick:()=>{o("all"),h("all")},className:"text-[11px] text-text-tertiary hover:text-text-primary transition-colors",children:"Clear"}),e.jsxs("div",{className:"ml-auto flex items-center gap-4 text-[11px] text-text-quaternary",children:[e.jsxs("span",{children:[t.length," events"]}),e.jsxs("span",{children:[v," users"]}),e.jsxs("span",{children:[u," types"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-2",children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No events match filters"})]}):e.jsx("div",{className:"flex flex-col gap-5",children:g.map(n=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3 sticky top-0 bg-bg-primary z-10 py-1",children:[e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-primary",children:n.label}),e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[n.entries.length," events"]})]}),e.jsx("div",{className:"relative ml-5 pl-5 border-l-2 border-border",children:e.jsx("div",{className:"flex flex-col gap-1",children:n.entries.map((f,y)=>e.jsx(J,{entry:f},`${f.ts}-${f.user}-${f.action}-${y}`))})})]},n.day))}),t.length>=i&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx("button",{type:"button",onClick:()=>m(n=>n+200),className:"px-3 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all border border-border",children:"Load more"})})]})]})}function J({entry:t}){const a=w[t.action]??"#9ca3af",r=B[t.action]??"•",s=t.user.charAt(0).toUpperCase();return e.jsxs("div",{className:"relative flex items-start gap-3 py-2 group hover:bg-bg-secondary/50 rounded-r-[var(--radius-md,6px)] px-3 -ml-[21px] transition-colors",children:[e.jsx("div",{className:"absolute -left-[8px] top-[14px] w-[14px] h-[14px] rounded-full border-2 flex items-center justify-center",style:{borderColor:a,backgroundColor:"var(--color-bg-primary)"},children:e.jsx("span",{style:{fontSize:"7px",lineHeight:1,color:a},children:r})}),e.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-semibold shrink-0 ml-2",style:{backgroundColor:K(t.action),color:a},children:s}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:t.user}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:U(t.action)})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[t.phase_id&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:["Phase ",t.phase_id]}),t.task_id&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:t.task_id}),t.target&&e.jsx("span",{className:"text-[10px] text-text-tertiary truncate max-w-[200px]",title:t.target,children:t.target}),t.host&&e.jsxs("span",{className:"text-[10px] text-text-quaternary flex items-center gap-1",children:[e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),t.host]})]})]}),e.jsxs("div",{className:"flex flex-col items-end shrink-0 gap-0.5",children:[e.jsx("span",{className:"text-[11px] text-text-tertiary tabular-nums",children:H(t.ts)}),e.jsx("span",{className:"text-[10px] text-text-quaternary",children:W(t.ts)})]})]})}const Y=[{label:"Overview",key:"overview",shortcut:"1"},{label:"Analysis",key:"analysis",shortcut:"2"},{label:"History",key:"history",shortcut:"3"}],C=["overview","analysis","history"],Q={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function ae(){const t=c(l=>l.members);c(l=>l.loading);const a=c(l=>l.error),r=c(l=>l.activeTab),s=c(l=>l.fetchMembers),o=c(l=>l.fetchActivity),h=c(l=>l.fetchPresence),p=c(l=>l.fetchAggregated),x=c(l=>l.fetchPreflight),i=c(l=>l.setActiveTab),m=c(l=>l.clearAll),[g,v]=d.useState(null),[u,n]=d.useState(!0),{register:f,unregister:y}=d.useContext(z),j=d.useCallback(l=>i(C[l]),[i]);return d.useEffect(()=>{f({items:Y.map(l=>({label:l.label,icon:null,shortcut:l.shortcut})),activeIndex:C.indexOf(r),onSwitch:j})},[r,f,j]),d.useEffect(()=>()=>y(),[y]),d.useEffect(()=>{function l(b){b.target instanceof HTMLInputElement||b.target instanceof HTMLTextAreaElement||(b.key==="1"?i("overview"):b.key==="2"?i("analysis"):b.key==="3"&&i("history"))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[i]),d.useEffect(()=>{let l=!1;return(async()=>{n(!0);const b=await x();l||(v(b),n(!1),b!=null&&b.exists&&(s(),o(),h(),p()))})(),()=>{l=!0,m()}},[]),u?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading..."}):g!=null&&g.exists?a&&t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-accent-red text-[length:var(--font-size-sm)]",children:"Failed to load collaboration data"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:a}),e.jsx("button",{type:"button",onClick:()=>{s(),o(),h()},className:"px-3 py-1.5 rounded-[var(--radius-md)] text-[11px] font-semibold bg-bg-secondary border border-border text-text-secondary hover:text-text-primary transition-all",children:"Retry"})]}):e.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(M,{mode:"popLayout",children:e.jsxs(T.div,{className:"h-full flex flex-col overflow-hidden",variants:Q,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15},children:[r==="overview"&&e.jsx(Z,{}),r==="analysis"&&e.jsx("div",{className:"p-4 h-full overflow-y-auto",children:e.jsx(I,{})}),r==="history"&&e.jsx("div",{className:"px-4 pt-4 pb-0 h-full flex flex-col overflow-visible",children:e.jsx(G,{})})]},r)})})}):e.jsx(X,{onRefresh:async()=>{const l=await x();v(l),l!=null&&l.exists&&(s(),o(),h(),p())}})}function X({onRefresh:t}){const a=c(x=>x.initCollab),[r,s]=d.useState(!1),[o,h]=d.useState(null);async function p(){s(!0),h(null);const x=await a();x.success?t():(h(x.error??"Unknown error"),s(!1))}return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"max-w-[480px] w-full px-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-12 h-12 rounded-[12px] bg-bg-secondary border border-border flex items-center justify-center mx-auto mb-4",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-secondary",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),e.jsx("h2",{className:"text-[length:var(--font-size-xl)] font-bold text-text-primary mb-2",children:"Team Collaboration"}),e.jsx("p",{className:"text-[length:var(--font-size-sm)] text-text-secondary leading-relaxed",children:"Track team activity, detect file conflicts, and coordinate phase assignments across multiple developers."})]}),e.jsx("div",{className:"border border-border rounded-[var(--radius-md,6px)] bg-bg-secondary p-4 mb-6",children:e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:[{label:"Member presence",desc:"Online/away/offline status"},{label:"Activity feed",desc:"Real-time team actions"},{label:"Conflict detection",desc:"Overlapping file edits"},{label:"Phase coordination",desc:"Who works on what"},{label:"Activity heatmap",desc:"Concentration analysis"},{label:"Collaboration timeline",desc:"Historical view"}].map(x=>e.jsxs("div",{className:"flex items-start gap-2 py-1",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-accent-green mt-[7px] shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-primary font-medium",children:x.label}),e.jsx("div",{className:"text-[10px] text-text-tertiary",children:x.desc})]})]},x.label))})}),e.jsxs("div",{className:"text-center",children:[e.jsx("button",{type:"button",onClick:p,disabled:r,className:"px-5 py-2.5 rounded-[var(--radius-md,6px)] text-[length:var(--font-size-sm)] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-50",children:r?"Initializing...":"Enable Team Collaboration"}),o&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-accent-red mt-2",children:o}),e.jsx("p",{className:"text-[10px] text-text-quaternary mt-2",children:"Creates .workflow/collab/ and registers you as the team owner"})]})]})})}function Z(){const t=c(o=>o.members),a=c(o=>o.presence),r=a.filter(o=>o.status==="online").length,s=a.filter(o=>o.status==="away").length;return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{className:"flex-1 min-w-0 overflow-y-auto p-4",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4 text-[length:var(--font-size-xs)]",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#22c55e]"}),e.jsxs("span",{className:"text-text-secondary",children:[r," online"]})]}),s>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#eab308]"}),e.jsxs("span",{className:"text-text-secondary",children:[s," away"]})]}),e.jsxs("span",{className:"text-text-quaternary",children:[t.length," members total"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx(ee,{}),e.jsx(S,{label:"Sync Activity",command:"maestro team sync",icon:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("polyline",{points:"1 20 1 14 7 14"}),e.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}),e.jsx(S,{label:"Team Status",command:"maestro team status",icon:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})})]}),e.jsx(R,{})]}),e.jsxs("div",{className:"w-[320px] shrink-0 border-l border-border flex flex-col h-full bg-bg-primary",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border",children:e.jsx("h3",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:"Activity"})}),e.jsx("div",{className:"flex-1 overflow-hidden px-4 py-2",children:e.jsx(_,{})})]})]})}function ee(){const t=c(u=>u.addMember),[a,r]=d.useState(!1),[s,o]=d.useState(""),[h,p]=d.useState("member"),[x,i]=d.useState(!1),[m,g]=d.useState(null);async function v(u){u.preventDefault();const n=s.trim();if(!n)return;i(!0),g(null);const f=await t(n,"",h);i(!1),f.success?(o(""),p("member"),r(!1)):g(f.error??"Failed to add member")}return a?e.jsxs("form",{onSubmit:v,className:"flex items-center gap-1.5",children:[e.jsx("input",{autoFocus:!0,value:s,onChange:u=>o(u.target.value),placeholder:"Name",className:"w-[120px] px-2 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-primary placeholder:text-text-quaternary outline-none focus:border-text-tertiary"}),e.jsxs("select",{value:h,onChange:u=>p(u.target.value),className:"px-1.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-secondary outline-none",children:[e.jsx("option",{value:"member",children:"Member"}),e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"viewer",children:"Viewer"})]}),e.jsx("button",{type:"submit",disabled:x||!s.trim(),className:"px-2.5 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-40",children:x?"...":"Add"}),e.jsx("button",{type:"button",onClick:()=>{r(!1),g(null)},className:"px-1.5 py-1.5 text-[11px] text-text-tertiary hover:text-text-primary",children:"Cancel"}),m&&e.jsx("span",{className:"text-[10px] text-accent-red",children:m})]}):e.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"8.5",cy:"7",r:"4"}),e.jsx("line",{x1:"20",y1:"8",x2:"20",y2:"14"}),e.jsx("line",{x1:"23",y1:"11",x2:"17",y2:"11"})]})}),e.jsx("span",{children:"Add Member"})]})}function S({label:t,command:a,icon:r}){const[s,o]=d.useState(!1);return e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(a),o(!0),setTimeout(()=>o(!1),1500)},title:`Copy: ${a}`,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:r}),e.jsx("span",{children:s?"Copied!":t})]})}export{ae as CollabPage};
1
+ import{j as e,ai as L,aj as c,ak as w,r as d,V as z}from"./index-C2Mcb4TJ.js";import{A as M}from"./index-JTmGteaT.js";import{m as T}from"./proxy-D72Y8a4Y.js";function $(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function D({member:t}){return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-[var(--radius-md)] border border-border bg-bg-secondary hover:shadow-sm transition-shadow",children:[e.jsxs("div",{className:"relative flex-shrink-0 rounded-full flex items-center justify-center",style:{width:40,height:40,backgroundColor:"#6b7280"},children:[e.jsx("span",{className:"text-white text-[length:14px] font-semibold select-none",children:t.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-bg-secondary",style:{backgroundColor:L[t.status]}})]}),e.jsxs("div",{className:"flex flex-col min-w-0 gap-0.5",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-primary truncate",children:t.name}),(t.currentPhase||t.currentTask)&&e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-tertiary truncate",children:[t.currentPhase,t.currentTask].filter(Boolean).join(" / ")}),e.jsx("span",{className:"text-[length:10px] text-text-tertiary",children:$(t.lastSeen)})]})]})}function R(){const t=c(a=>a.filteredMembers());return t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-2",children:[e.jsx("span",{className:"text-text-secondary text-[length:var(--font-size-sm)]",children:"No team members found"}),e.jsxs("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:["Run ",e.jsx("code",{className:"px-1 py-0.5 bg-bg-hover rounded text-[10px]",children:"maestro team join"})," to join the team"]})]}):e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:t.map(a=>e.jsx(D,{member:a},a.uid))})}function O(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function E({entry:t}){const a=w[t.action]??"#9ca3af";return e.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-[length:var(--font-size-xs)]",style:{borderLeft:`3px solid ${a}`},children:[e.jsx("span",{className:"text-text-tertiary flex-shrink-0 tabular-nums w-12",children:O(t.ts)}),e.jsx("span",{className:"font-[var(--font-weight-medium)] text-text-primary flex-shrink-0",children:t.user}),e.jsxs("span",{className:"text-text-secondary truncate",children:[t.action,t.target?` → ${t.target}`:""]})]})}function _(){const t=c(s=>s.activity),a=d.useRef(null),r=t.slice(-100);return d.useEffect(()=>{const s=a.current;s&&(s.scrollTop=s.scrollHeight)},[r.length]),r.length===0?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity yet"})}):e.jsx("div",{ref:a,className:"flex flex-col gap-1 overflow-y-auto h-full pr-1",children:r.map(s=>e.jsx(E,{entry:s},`${s.ts}-${s.user}-${s.action}`))})}const k={high:{label:"High",color:"#dc2626",bg:"rgba(239,68,68,0.08)",border:"rgba(239,68,68,0.2)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(234,179,8,0.08)",border:"rgba(234,179,8,0.2)"},low:{label:"Low",color:"#16a34a",bg:"rgba(34,197,94,0.08)",border:"rgba(34,197,94,0.2)"},none:{label:"None",color:"var(--color-text-tertiary, #9ca3af)",bg:"var(--color-bg-secondary)",border:"var(--color-border)"}};function A(t){return k[t]??k.none}function I(){const t=c(i=>i.aggregated),a=c(i=>i.members);if(c(i=>i.loading)&&t.length===0)return e.jsxs("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2 text-text-secondary",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Loading analysis data..."]});if(t.length===0)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-3",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M3 9h18"}),e.jsx("path",{d:"M9 21V9"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No activity data available for analysis"}),e.jsx("span",{className:"text-text-quaternary text-[length:var(--font-size-xs)]",children:"Activity will appear here as team members work on phases and tasks"})]});const s=t.reduce((i,m)=>i+m.count,0),o=new Set(t.flatMap(i=>i.members)).size,h=t.filter(i=>i.risk==="high").length,p=t.filter(i=>i.risk==="medium").length,x=[...t].sort((i,m)=>{const g={high:0,medium:1,low:2,none:3},v=g[i.risk]??3,u=g[m.risk]??3;return v!==u?v-u:m.count-i.count});return e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsx(N,{label:"Total Activity",value:s}),e.jsx(N,{label:"Active Members",value:o,total:a.length}),e.jsx(N,{label:"High Risk",value:h,color:h>0?"#dc2626":void 0}),e.jsx(N,{label:"Medium Risk",value:p,color:p>0?"#ca8a04":void 0})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[length:var(--font-size-xs)] text-text-tertiary",children:[e.jsx("span",{children:"Risk levels:"}),["none","low","medium","high"].map(i=>{const m=A(i);return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:m.color,opacity:.7}}),e.jsx("span",{children:m.label}),e.jsxs("span",{className:"text-text-quaternary",children:["(",i==="none"?"1":i==="low"?"2":i==="medium"?"3":"4+",i==="none"?" member":" members",")"]})]},i)})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("h3",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-secondary uppercase tracking-wider",children:"Activity Concentration"}),e.jsx("div",{className:"grid grid-cols-1 gap-2",children:x.map((i,m)=>e.jsx(q,{entry:i},`${i.phase}::${i.task}::${m}`))})]})]})}function N({label:t,value:a,total:r,color:s}){return e.jsxs("div",{className:"rounded-[var(--radius-md,6px)] border border-border bg-bg-secondary px-4 py-3",children:[e.jsx("div",{className:"text-[10px] text-text-tertiary uppercase tracking-wider mb-1",children:t}),e.jsxs("div",{className:"text-[length:var(--font-size-xl)] font-bold",style:{color:s??"var(--color-text-primary)"},children:[a,r!=null&&e.jsxs("span",{className:"text-[length:var(--font-size-sm)] font-normal text-text-quaternary",children:[" / ",r]})]})]})}function q({entry:t}){const a=A(t.risk),r=t.phase||"(no phase)",s=t.task||"(general)";return e.jsxs("div",{className:"flex items-center gap-4 rounded-[var(--radius-md,6px)] px-4 py-3 border transition-colors",style:{backgroundColor:a.bg,borderColor:a.border},children:[e.jsx("div",{className:"flex flex-col items-center gap-1 shrink-0 w-[52px]",children:e.jsx("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-full",style:{color:a.color,backgroundColor:`${a.color}15`},children:a.label})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-medium text-text-primary truncate",children:r}),t.task&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-quaternary",children:"/"}),e.jsx("span",{className:"text-[length:var(--font-size-sm)] text-text-secondary truncate",children:s})]})]})}),e.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-bold text-text-primary",children:t.count}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"actions"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.members.slice(0,5).map(o=>e.jsx("span",{className:"w-6 h-6 rounded-full bg-bg-secondary border border-border flex items-center justify-center text-[10px] font-medium text-text-secondary uppercase",title:o,children:o.charAt(0)},o)),t.members.length>5&&e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:["+",t.members.length-5]})]})]})}const B={init:"⚡",join:"→",leave:"←",phase_change:"◆",task_update:"●",message:"✉",sync:"↻",report:"📋",discussion:"💬"},P=[{value:"all",label:"All types"},{value:"init",label:"Init"},{value:"join",label:"Join"},{value:"phase_change",label:"Phase changes"},{value:"task_update",label:"Task updates"},{value:"message",label:"Messages"},{value:"sync",label:"Sync"}];function F(t){const a=new Date(t),r=new Date,s=new Date(r);return s.setDate(s.getDate()-1),a.toDateString()===r.toDateString()?"Today":a.toDateString()===s.toDateString()?"Yesterday":a.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function H(t){return new Date(t).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function W(t){const a=Date.now()-new Date(t).getTime(),r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function V(t){return new Date(t).toDateString()}function U(t){switch(t){case"init":return"Initialized collaboration";case"join":return"Joined the team";case"leave":return"Left the team";case"phase_change":return"Changed phase";case"task_update":return"Updated task";case"message":return"Sent a message";case"sync":return"Synced activity";case"report":return"Generated report";case"discussion":return"Started discussion";default:return t}}function K(t){return`${w[t]??"#9ca3af"}12`}function G(){const t=c(n=>n.filteredActivity()),a=c(n=>n.members),r=c(n=>n.memberFilter),s=c(n=>n.typeFilter),o=c(n=>n.setMemberFilter),h=c(n=>n.setTypeFilter),p=c(n=>n.fetchActivity),x=c(n=>n.loading),[i,m]=d.useState(200);d.useEffect(()=>{p(i)},[p,i]);const g=d.useMemo(()=>{const n=[];let f="";for(const y of t){const j=V(y.ts);j!==f&&(f=j,n.push({day:j,label:F(y.ts),entries:[]})),n[n.length-1].entries.push(y)}return n},[t]),v=new Set(t.map(n=>n.user)).size,u=new Set(t.map(n=>n.action)).size;return x&&t.length===0?e.jsx("div",{className:"flex items-center justify-center h-64 text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading history..."}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0 pb-4",children:[e.jsxs("select",{value:r,onChange:n=>o(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:[e.jsx("option",{value:"all",children:"All members"}),a.map(n=>e.jsx("option",{value:n.uid,children:n.name},n.uid))]}),e.jsx("select",{value:s,onChange:n=>h(n.target.value),className:"text-[length:var(--font-size-xs)] px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-text-primary outline-none focus:border-text-tertiary",children:P.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))}),(r!=="all"||s!=="all")&&e.jsx("button",{type:"button",onClick:()=>{o("all"),h("all")},className:"text-[11px] text-text-tertiary hover:text-text-primary transition-colors",children:"Clear"}),e.jsxs("div",{className:"ml-auto flex items-center gap-4 text-[11px] text-text-quaternary",children:[e.jsxs("span",{children:[t.length," events"]}),e.jsxs("span",{children:[v," users"]}),e.jsxs("span",{children:[u," types"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-2",children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-quaternary",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-sm)]",children:"No events match filters"})]}):e.jsx("div",{className:"flex flex-col gap-5",children:g.map(n=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3 sticky top-0 bg-bg-primary z-10 py-1",children:[e.jsx("span",{className:"text-[length:var(--font-size-xs)] font-semibold text-text-primary",children:n.label}),e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsxs("span",{className:"text-[10px] text-text-quaternary",children:[n.entries.length," events"]})]}),e.jsx("div",{className:"relative ml-5 pl-5 border-l-2 border-border",children:e.jsx("div",{className:"flex flex-col gap-1",children:n.entries.map((f,y)=>e.jsx(J,{entry:f},`${f.ts}-${f.user}-${f.action}-${y}`))})})]},n.day))}),t.length>=i&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx("button",{type:"button",onClick:()=>m(n=>n+200),className:"px-3 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all border border-border",children:"Load more"})})]})]})}function J({entry:t}){const a=w[t.action]??"#9ca3af",r=B[t.action]??"•",s=t.user.charAt(0).toUpperCase();return e.jsxs("div",{className:"relative flex items-start gap-3 py-2 group hover:bg-bg-secondary/50 rounded-r-[var(--radius-md,6px)] px-3 -ml-[21px] transition-colors",children:[e.jsx("div",{className:"absolute -left-[8px] top-[14px] w-[14px] h-[14px] rounded-full border-2 flex items-center justify-center",style:{borderColor:a,backgroundColor:"var(--color-bg-primary)"},children:e.jsx("span",{style:{fontSize:"7px",lineHeight:1,color:a},children:r})}),e.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-semibold shrink-0 ml-2",style:{backgroundColor:K(t.action),color:a},children:s}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:t.user}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary",children:U(t.action)})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[t.phase_id&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:["Phase ",t.phase_id]}),t.task_id&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-secondary border border-border text-text-tertiary",children:t.task_id}),t.target&&e.jsx("span",{className:"text-[10px] text-text-tertiary truncate max-w-[200px]",title:t.target,children:t.target}),t.host&&e.jsxs("span",{className:"text-[10px] text-text-quaternary flex items-center gap-1",children:[e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),t.host]})]})]}),e.jsxs("div",{className:"flex flex-col items-end shrink-0 gap-0.5",children:[e.jsx("span",{className:"text-[11px] text-text-tertiary tabular-nums",children:H(t.ts)}),e.jsx("span",{className:"text-[10px] text-text-quaternary",children:W(t.ts)})]})]})}const Y=[{label:"Overview",key:"overview",shortcut:"1"},{label:"Analysis",key:"analysis",shortcut:"2"},{label:"History",key:"history",shortcut:"3"}],C=["overview","analysis","history"],Q={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function ae(){const t=c(l=>l.members);c(l=>l.loading);const a=c(l=>l.error),r=c(l=>l.activeTab),s=c(l=>l.fetchMembers),o=c(l=>l.fetchActivity),h=c(l=>l.fetchPresence),p=c(l=>l.fetchAggregated),x=c(l=>l.fetchPreflight),i=c(l=>l.setActiveTab),m=c(l=>l.clearAll),[g,v]=d.useState(null),[u,n]=d.useState(!0),{register:f,unregister:y}=d.useContext(z),j=d.useCallback(l=>i(C[l]),[i]);return d.useEffect(()=>{f({items:Y.map(l=>({label:l.label,icon:null,shortcut:l.shortcut})),activeIndex:C.indexOf(r),onSwitch:j})},[r,f,j]),d.useEffect(()=>()=>y(),[y]),d.useEffect(()=>{function l(b){b.target instanceof HTMLInputElement||b.target instanceof HTMLTextAreaElement||(b.key==="1"?i("overview"):b.key==="2"?i("analysis"):b.key==="3"&&i("history"))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[i]),d.useEffect(()=>{let l=!1;return(async()=>{n(!0);const b=await x();l||(v(b),n(!1),b!=null&&b.exists&&(s(),o(),h(),p()))})(),()=>{l=!0,m()}},[]),u?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading..."}):g!=null&&g.exists?a&&t.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-accent-red text-[length:var(--font-size-sm)]",children:"Failed to load collaboration data"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:a}),e.jsx("button",{type:"button",onClick:()=>{s(),o(),h()},className:"px-3 py-1.5 rounded-[var(--radius-md)] text-[11px] font-semibold bg-bg-secondary border border-border text-text-secondary hover:text-text-primary transition-all",children:"Retry"})]}):e.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(M,{mode:"popLayout",children:e.jsxs(T.div,{className:"h-full flex flex-col overflow-hidden",variants:Q,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.15},children:[r==="overview"&&e.jsx(Z,{}),r==="analysis"&&e.jsx("div",{className:"p-4 h-full overflow-y-auto",children:e.jsx(I,{})}),r==="history"&&e.jsx("div",{className:"px-4 pt-4 pb-0 h-full flex flex-col overflow-visible",children:e.jsx(G,{})})]},r)})})}):e.jsx(X,{onRefresh:async()=>{const l=await x();v(l),l!=null&&l.exists&&(s(),o(),h(),p())}})}function X({onRefresh:t}){const a=c(x=>x.initCollab),[r,s]=d.useState(!1),[o,h]=d.useState(null);async function p(){s(!0),h(null);const x=await a();x.success?t():(h(x.error??"Unknown error"),s(!1))}return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsxs("div",{className:"max-w-[480px] w-full px-6",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-12 h-12 rounded-[12px] bg-bg-secondary border border-border flex items-center justify-center mx-auto mb-4",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-secondary",children:[e.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),e.jsx("h2",{className:"text-[length:var(--font-size-xl)] font-bold text-text-primary mb-2",children:"Team Collaboration"}),e.jsx("p",{className:"text-[length:var(--font-size-sm)] text-text-secondary leading-relaxed",children:"Track team activity, detect file conflicts, and coordinate phase assignments across multiple developers."})]}),e.jsx("div",{className:"border border-border rounded-[var(--radius-md,6px)] bg-bg-secondary p-4 mb-6",children:e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:[{label:"Member presence",desc:"Online/away/offline status"},{label:"Activity feed",desc:"Real-time team actions"},{label:"Conflict detection",desc:"Overlapping file edits"},{label:"Phase coordination",desc:"Who works on what"},{label:"Activity heatmap",desc:"Concentration analysis"},{label:"Collaboration timeline",desc:"Historical view"}].map(x=>e.jsxs("div",{className:"flex items-start gap-2 py-1",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-accent-green mt-[7px] shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-primary font-medium",children:x.label}),e.jsx("div",{className:"text-[10px] text-text-tertiary",children:x.desc})]})]},x.label))})}),e.jsxs("div",{className:"text-center",children:[e.jsx("button",{type:"button",onClick:p,disabled:r,className:"px-5 py-2.5 rounded-[var(--radius-md,6px)] text-[length:var(--font-size-sm)] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-50",children:r?"Initializing...":"Enable Team Collaboration"}),o&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-accent-red mt-2",children:o}),e.jsx("p",{className:"text-[10px] text-text-quaternary mt-2",children:"Creates .workflow/collab/ and registers you as the team owner"})]})]})})}function Z(){const t=c(o=>o.members),a=c(o=>o.presence),r=a.filter(o=>o.status==="online").length,s=a.filter(o=>o.status==="away").length;return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{className:"flex-1 min-w-0 overflow-y-auto p-4",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4 text-[length:var(--font-size-xs)]",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#22c55e]"}),e.jsxs("span",{className:"text-text-secondary",children:[r," online"]})]}),s>0&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-[#eab308]"}),e.jsxs("span",{className:"text-text-secondary",children:[s," away"]})]}),e.jsxs("span",{className:"text-text-quaternary",children:[t.length," members total"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx(ee,{}),e.jsx(S,{label:"Sync Activity",command:"maestro team sync",icon:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"23 4 23 10 17 10"}),e.jsx("polyline",{points:"1 20 1 14 7 14"}),e.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}),e.jsx(S,{label:"Team Status",command:"maestro team status",icon:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})})]}),e.jsx(R,{})]}),e.jsxs("div",{className:"w-[320px] shrink-0 border-l border-border flex flex-col h-full bg-bg-primary",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border",children:e.jsx("h3",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary",children:"Activity"})}),e.jsx("div",{className:"flex-1 overflow-hidden px-4 py-2",children:e.jsx(_,{})})]})]})}function ee(){const t=c(u=>u.addMember),[a,r]=d.useState(!1),[s,o]=d.useState(""),[h,p]=d.useState("member"),[x,i]=d.useState(!1),[m,g]=d.useState(null);async function v(u){u.preventDefault();const n=s.trim();if(!n)return;i(!0),g(null);const f=await t(n,"",h);i(!1),f.success?(o(""),p("member"),r(!1)):g(f.error??"Failed to add member")}return a?e.jsxs("form",{onSubmit:v,className:"flex items-center gap-1.5",children:[e.jsx("input",{autoFocus:!0,value:s,onChange:u=>o(u.target.value),placeholder:"Name",className:"w-[120px] px-2 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-primary placeholder:text-text-quaternary outline-none focus:border-text-tertiary"}),e.jsxs("select",{value:h,onChange:u=>p(u.target.value),className:"px-1.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] text-text-secondary outline-none",children:[e.jsx("option",{value:"member",children:"Member"}),e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"viewer",children:"Viewer"})]}),e.jsx("button",{type:"submit",disabled:x||!s.trim(),className:"px-2.5 py-1.5 rounded-[var(--radius-md,6px)] text-[11px] font-semibold bg-text-primary text-bg-primary hover:opacity-90 transition-opacity disabled:opacity-40",children:x?"...":"Add"}),e.jsx("button",{type:"button",onClick:()=>{r(!1),g(null)},className:"px-1.5 py-1.5 text-[11px] text-text-tertiary hover:text-text-primary",children:"Cancel"}),m&&e.jsx("span",{className:"text-[10px] text-accent-red",children:m})]}):e.jsxs("button",{type:"button",onClick:()=>r(!0),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"8.5",cy:"7",r:"4"}),e.jsx("line",{x1:"20",y1:"8",x2:"20",y2:"14"}),e.jsx("line",{x1:"23",y1:"11",x2:"17",y2:"11"})]})}),e.jsx("span",{children:"Add Member"})]})}function S({label:t,command:a,icon:r}){const[s,o]=d.useState(!1);return e.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(a),o(!0),setTimeout(()=>o(!1),1500)},title:`Copy: ${a}`,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md,6px)] border border-border bg-bg-primary text-[11px] font-medium text-text-secondary hover:text-text-primary hover:bg-bg-secondary transition-all",children:[e.jsx("span",{className:"text-text-tertiary",children:r}),e.jsx("span",{children:s?"Copied!":t})]})}export{ae as CollabPage};
@@ -1 +1 @@
1
- import{b as c,k as l,j as e}from"./index-DWG-WrzT.js";function d(){const i=c(s=>s.slots),a=c(s=>s.supervisorStatus),t=l(s=>s.processes),n=Object.values(i),r=Object.values(t).filter(s=>s.status==="running");return e.jsxs("div",{className:"h-full overflow-y-auto p-[var(--spacing-2)] text-[11px]",children:[a&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsx("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:"Supervisor"}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary",children:[e.jsx("span",{className:["w-[6px] h-[6px] rounded-full shrink-0",a.enabled?"bg-status-completed":"bg-text-secondary/40"].join(" ")}),e.jsx("span",{children:a.enabled?"Active":"Paused"}),a.lastTickAt&&e.jsxs("span",{className:"ml-auto text-text-secondary/60",children:["Last tick: ",x(a.lastTickAt)]})]})]}),a&&a.running.length>0&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Running (",a.running.length,")"]}),a.running.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.issueId}),e.jsxs("span",{className:"ml-auto",children:["Turn ",s.turnNumber,"/",s.maxTurns]})]},s.processId))]}),n.length>0&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Execution Slots (",n.length,")"]}),n.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.issueId}),e.jsx("span",{className:"ml-auto",children:s.executor})]},s.processId))]}),r.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Active Agents (",r.length,")"]}),r.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.type}),e.jsx("span",{className:"ml-auto",children:s.status})]},s.id))]}),n.length===0&&r.length===0&&!a&&e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-xs)]",children:"No active executions."})]})}function x(i){const a=new Date(i).getTime(),t=Date.now()-a;return isNaN(t)?"":t<1e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:new Date(a).toLocaleTimeString("en-US",{hour12:!1})}export{d as ExecutionPanel};
1
+ import{b as c,k as l,j as e}from"./index-C2Mcb4TJ.js";function d(){const i=c(s=>s.slots),a=c(s=>s.supervisorStatus),t=l(s=>s.processes),n=Object.values(i),r=Object.values(t).filter(s=>s.status==="running");return e.jsxs("div",{className:"h-full overflow-y-auto p-[var(--spacing-2)] text-[11px]",children:[a&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsx("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:"Supervisor"}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary",children:[e.jsx("span",{className:["w-[6px] h-[6px] rounded-full shrink-0",a.enabled?"bg-status-completed":"bg-text-secondary/40"].join(" ")}),e.jsx("span",{children:a.enabled?"Active":"Paused"}),a.lastTickAt&&e.jsxs("span",{className:"ml-auto text-text-secondary/60",children:["Last tick: ",x(a.lastTickAt)]})]})]}),a&&a.running.length>0&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Running (",a.running.length,")"]}),a.running.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.issueId}),e.jsxs("span",{className:"ml-auto",children:["Turn ",s.turnNumber,"/",s.maxTurns]})]},s.processId))]}),n.length>0&&e.jsxs("div",{className:"mb-[var(--spacing-2)] pb-[var(--spacing-2)] border-b border-border",children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Execution Slots (",n.length,")"]}),n.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.issueId}),e.jsx("span",{className:"ml-auto",children:s.executor})]},s.processId))]}),r.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-text-primary mb-[var(--spacing-1)]",children:["Active Agents (",r.length,")"]}),r.map(s=>e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] text-text-secondary py-[var(--spacing-0-5)]",children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0 bg-status-exploring animate-pulse"}),e.jsx("span",{className:"truncate",children:s.type}),e.jsx("span",{className:"ml-auto",children:s.status})]},s.id))]}),n.length===0&&r.length===0&&!a&&e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-xs)]",children:"No active executions."})]})}function x(i){const a=new Date(i).getTime(),t=Date.now()-a;return isNaN(t)?"":t<1e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:new Date(a).toLocaleTimeString("en-US",{hour12:!1})}export{d as ExecutionPanel};