maestro-flow 0.3.8 → 0.3.9

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 (211) hide show
  1. package/.claude/commands/learn-decompose.md +3 -3
  2. package/.claude/commands/learn-follow.md +5 -5
  3. package/.claude/commands/learn-investigate.md +3 -3
  4. package/.claude/commands/learn-retro.md +6 -6
  5. package/.claude/commands/learn-second-opinion.md +3 -3
  6. package/.claude/commands/maestro-analyze.md +123 -99
  7. package/.claude/commands/maestro-brainstorm.md +2 -2
  8. package/.claude/commands/maestro-execute.md +137 -97
  9. package/.claude/commands/maestro-fork.md +111 -0
  10. package/.claude/commands/maestro-init.md +6 -6
  11. package/.claude/commands/maestro-merge.md +77 -0
  12. package/.claude/commands/maestro-milestone-audit.md +72 -60
  13. package/.claude/commands/maestro-milestone-complete.md +67 -59
  14. package/.claude/commands/maestro-milestone-release.md +6 -6
  15. package/.claude/commands/maestro-plan.md +151 -130
  16. package/.claude/commands/maestro-quick.md +4 -4
  17. package/.claude/commands/maestro-roadmap.md +5 -5
  18. package/.claude/commands/maestro-spec-generate.md +5 -5
  19. package/.claude/commands/maestro-ui-design.md +3 -3
  20. package/.claude/commands/maestro-verify.md +106 -87
  21. package/.claude/commands/maestro.md +10 -4
  22. package/.claude/commands/manage-codebase-rebuild.md +4 -4
  23. package/.claude/commands/manage-codebase-refresh.md +1 -1
  24. package/.claude/commands/manage-harvest.md +5 -5
  25. package/.claude/commands/manage-issue-discover.md +1 -1
  26. package/.claude/commands/manage-issue-execute.md +6 -6
  27. package/.claude/commands/manage-issue.md +6 -6
  28. package/.claude/commands/manage-learn.md +2 -2
  29. package/.claude/commands/manage-memory-capture.md +4 -4
  30. package/.claude/commands/manage-memory.md +2 -2
  31. package/.claude/commands/manage-status.md +24 -24
  32. package/.claude/commands/quality-business-test.md +5 -5
  33. package/.claude/commands/quality-debug.md +4 -4
  34. package/.claude/commands/quality-integration-test.md +4 -4
  35. package/.claude/commands/quality-refactor.md +3 -3
  36. package/.claude/commands/quality-retrospective.md +2 -2
  37. package/.claude/commands/quality-review.md +4 -4
  38. package/.claude/commands/quality-sync.md +3 -3
  39. package/.claude/commands/quality-test-gen.md +4 -4
  40. package/.claude/commands/quality-test.md +9 -9
  41. package/.claude/commands/spec-add.md +2 -2
  42. package/.claude/commands/spec-load.md +1 -1
  43. package/.claude/commands/spec-setup.md +5 -5
  44. package/.claude/commands/wiki-connect.md +3 -3
  45. package/.claude/commands/wiki-digest.md +4 -4
  46. package/.codex/skills/maestro-analyze/SKILL.md +52 -14
  47. package/.codex/skills/maestro-execute/SKILL.md +27 -26
  48. package/.codex/skills/maestro-milestone-audit/SKILL.md +103 -209
  49. package/.codex/skills/maestro-milestone-complete/SKILL.md +149 -158
  50. package/.codex/skills/maestro-plan/SKILL.md +47 -17
  51. package/.codex/skills/maestro-roadmap/SKILL.md +3 -2
  52. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +2 -2
  53. package/.codex/skills/team-executor/roles/executor/commands/monitor.md +1 -1
  54. package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +2 -2
  55. package/.codex/skills/team-lifecycle-v4/specs/knowledge-transfer.md +2 -2
  56. package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +1 -1
  57. package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +1 -1
  58. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +1 -1
  59. package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +1 -1
  60. package/README.md +19 -14
  61. package/README.zh-CN.md +16 -12
  62. package/bin/maestro-mcp.js +1 -1
  63. package/chains/_intent-map.json +21 -9
  64. package/chains/_router.json +30 -77
  65. package/chains/brainstorm-driven.json +17 -6
  66. package/chains/full-lifecycle.json +22 -23
  67. package/chains/milestone-close.json +20 -7
  68. package/chains/milestone-fork-merge.json +50 -0
  69. package/chains/roadmap-driven.json +17 -6
  70. package/chains/spec-driven.json +17 -6
  71. package/dashboard/dist/assets/{ArtifactsPage-BmPOu8sO.js → ArtifactsPage-DZNCi6tn.js} +12 -7
  72. package/dashboard/dist/assets/ChatInput-Bvr-FeEq.js +49 -0
  73. package/dashboard/dist/assets/ChatPage-D9zTkJZo.js +22 -0
  74. package/dashboard/dist/assets/CollabPage-B4NAHXS2.js +1 -0
  75. package/dashboard/dist/assets/ExecutionPanel-CFt4LJyq.js +1 -0
  76. package/dashboard/dist/assets/KanbanPage-C8USth6H.js +21 -0
  77. package/dashboard/dist/assets/{MarkdownRenderer-BjZ43aSa.js → MarkdownRenderer-X4af_WNb.js} +1 -1
  78. package/dashboard/dist/assets/McpPage-BKfCVIyU.js +21 -0
  79. package/dashboard/dist/assets/OutputPanel-BlBQFJSW.js +1 -0
  80. package/dashboard/dist/assets/ProblemsPanel-De3DLvoI.js +1 -0
  81. package/dashboard/dist/assets/{RequirementBoardPage-B7yRL0s_.js → RequirementBoardPage-Bf1trzqs.js} +2 -2
  82. package/dashboard/dist/assets/{RequirementPage-D8J_-b6O.js → RequirementPage-Bllxe2XI.js} +10 -5
  83. package/dashboard/dist/assets/{SpecsPage-6lO8v8_C.js → SpecsPage-9lwxKT27.js} +2 -2
  84. package/dashboard/dist/assets/{SupervisorPage-Ds5N378a.js → SupervisorPage-SusdfHFq.js} +1 -1
  85. package/dashboard/dist/assets/{TeamsPage-DrkKr17T.js → TeamsPage-DsuM6OwC.js} +2 -2
  86. package/dashboard/dist/assets/TreeBrowser-Q12qobZs.js +6 -0
  87. package/dashboard/dist/assets/WorkflowPage-D_Fzdy3_.js +6 -0
  88. package/dashboard/dist/assets/{arrow-left-CadP5YgU.js → arrow-left-Bqtb2hle.js} +1 -1
  89. package/dashboard/dist/assets/{check-5xufDzS8.js → check-u6fGOwQO.js} +1 -1
  90. package/dashboard/dist/assets/{chevron-right-CYbpR4ev.js → chevron-right-Csu22t58.js} +1 -1
  91. package/dashboard/dist/assets/{circle-Bm-5Q-Yh.js → circle-CMrkbRNg.js} +1 -1
  92. package/dashboard/dist/assets/{circle-alert-BqcYuT7x.js → circle-alert-c3tH1P4z.js} +1 -1
  93. package/dashboard/dist/assets/{circle-check-big-yyzAFysU.js → circle-check-big-TDSeWstm.js} +1 -1
  94. package/dashboard/dist/assets/{circle-check-DEVzW_lm.js → circle-check-gYxxSYuH.js} +1 -1
  95. package/dashboard/dist/assets/{code-BBdC8Wmw.js → code-CFN2uX9V.js} +1 -1
  96. package/dashboard/dist/assets/{columns-3-CQ9Trztr.js → columns-3-38xIDlzy.js} +1 -1
  97. package/dashboard/dist/assets/{download-DayuF-sn.js → download-DC7KkKyP.js} +1 -1
  98. package/dashboard/dist/assets/{folder-CqXeSKeC.js → folder-CWq_lAnf.js} +1 -1
  99. package/dashboard/dist/assets/index-DWG-WrzT.js +231 -0
  100. package/dashboard/dist/assets/{index-Dru5HYy0.js → index-Do71weNR.js} +1 -1
  101. package/dashboard/dist/assets/index-GUNJodSR.css +1 -0
  102. package/dashboard/dist/assets/{list-DBOD6IUt.js → list-CgIP_2A-.js} +1 -1
  103. package/dashboard/dist/assets/{minus-fQI1Syn2.js → minus-DYoN5UGk.js} +1 -1
  104. package/dashboard/dist/assets/{pen-line-Bkbbngl5.js → pen-line-Bh_WKYHm.js} +1 -1
  105. package/dashboard/dist/assets/{proxy-teW12DdZ.js → proxy-BKxDAKTj.js} +1 -1
  106. package/dashboard/dist/assets/{search-Bq3ygFUW.js → search-SieXnOgr.js} +1 -1
  107. package/dashboard/dist/assets/{shallow-22ZN8sFt.js → shallow-Bme1JY57.js} +1 -1
  108. package/dashboard/dist/assets/{table-BEYtdWc4.js → table-llyEtj-7.js} +1 -1
  109. package/dashboard/dist/assets/terminal-BB3Xfuv5.js +6 -0
  110. package/dashboard/dist/assets/{trash-2-DMqGBgcF.js → trash-2-C8f4vFFM.js} +1 -1
  111. package/dashboard/dist/assets/{zap-9DVkGVtt.js → zap-4uwlzVm0.js} +1 -1
  112. package/dashboard/dist/index.html +2 -2
  113. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +8 -4
  114. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  115. package/dashboard/dist-server/dashboard/src/server/agents/entry-normalizer.d.ts +1 -0
  116. package/dashboard/dist-server/dashboard/src/server/agents/entry-normalizer.js +2 -1
  117. package/dashboard/dist-server/dashboard/src/server/agents/entry-normalizer.js.map +1 -1
  118. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js +20 -10
  119. package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
  120. package/dashboard/dist-server/dashboard/src/server/routes/git.d.ts +2 -0
  121. package/dashboard/dist-server/dashboard/src/server/routes/git.js +79 -0
  122. package/dashboard/dist-server/dashboard/src/server/routes/git.js.map +1 -0
  123. package/dashboard/dist-server/dashboard/src/server/routes/index.js +3 -0
  124. package/dashboard/dist-server/dashboard/src/server/routes/index.js.map +1 -1
  125. package/dashboard/dist-server/dashboard/src/server/routes/workspace.js +43 -0
  126. package/dashboard/dist-server/dashboard/src/server/routes/workspace.js.map +1 -1
  127. package/dashboard/dist-server/dashboard/src/server/state/state-manager.js +43 -3
  128. package/dashboard/dist-server/dashboard/src/server/state/state-manager.js.map +1 -1
  129. package/dashboard/package.json +59 -59
  130. package/dist/src/cli.js +3 -1
  131. package/dist/src/cli.js.map +1 -1
  132. package/dist/src/commands/{team.d.ts → collab.d.ts} +2 -2
  133. package/dist/src/commands/collab.d.ts.map +1 -0
  134. package/dist/src/commands/{team.js → collab.js} +391 -24
  135. package/dist/src/commands/collab.js.map +1 -0
  136. package/dist/src/commands/msg.d.ts.map +1 -1
  137. package/dist/src/commands/msg.js +4 -3
  138. package/dist/src/commands/msg.js.map +1 -1
  139. package/dist/src/hooks/team-monitor.d.ts.map +1 -1
  140. package/dist/src/hooks/team-monitor.js +16 -0
  141. package/dist/src/hooks/team-monitor.js.map +1 -1
  142. package/dist/src/tools/collab-adapter.d.ts +85 -0
  143. package/dist/src/tools/collab-adapter.d.ts.map +1 -0
  144. package/dist/src/tools/collab-adapter.js +320 -0
  145. package/dist/src/tools/collab-adapter.js.map +1 -0
  146. package/dist/src/tools/namespace-guard.d.ts +2 -0
  147. package/dist/src/tools/namespace-guard.d.ts.map +1 -1
  148. package/dist/src/tools/namespace-guard.js +12 -0
  149. package/dist/src/tools/namespace-guard.js.map +1 -1
  150. package/dist/src/tools/phase-gate-evaluator.d.ts +45 -0
  151. package/dist/src/tools/phase-gate-evaluator.d.ts.map +1 -0
  152. package/dist/src/tools/phase-gate-evaluator.js +42 -0
  153. package/dist/src/tools/phase-gate-evaluator.js.map +1 -0
  154. package/dist/src/tools/team-members.d.ts +18 -0
  155. package/dist/src/tools/team-members.d.ts.map +1 -1
  156. package/dist/src/tools/team-members.js +50 -0
  157. package/dist/src/tools/team-members.js.map +1 -1
  158. package/dist/src/tools/team-tasks.d.ts +120 -0
  159. package/dist/src/tools/team-tasks.d.ts.map +1 -0
  160. package/dist/src/tools/team-tasks.js +365 -0
  161. package/dist/src/tools/team-tasks.js.map +1 -0
  162. package/dist/src/tools/transition-recorder.d.ts +3 -0
  163. package/dist/src/tools/transition-recorder.d.ts.map +1 -1
  164. package/dist/src/tools/transition-recorder.js +52 -1
  165. package/dist/src/tools/transition-recorder.js.map +1 -1
  166. package/dist/src/utils/get-version.d.ts.map +1 -1
  167. package/dist/src/utils/get-version.js +15 -4
  168. package/dist/src/utils/get-version.js.map +1 -1
  169. package/package.json +1 -1
  170. package/templates/config.json +7 -0
  171. package/templates/worktree-scope.json +10 -0
  172. package/templates/worktrees.json +27 -0
  173. package/workflows/analyze.md +86 -36
  174. package/workflows/brainstorm.md +17 -37
  175. package/workflows/execute.md +94 -28
  176. package/workflows/fork.md +309 -0
  177. package/workflows/init.md +10 -1
  178. package/workflows/issue.md +66 -7
  179. package/workflows/maestro-coordinate.md +23 -16
  180. package/workflows/maestro.md +52 -35
  181. package/workflows/merge.md +285 -0
  182. package/workflows/milestone-audit.md +89 -70
  183. package/workflows/milestone-complete.md +89 -156
  184. package/workflows/plan.md +122 -17
  185. package/workflows/retrospective.md +3 -3
  186. package/workflows/roadmap.md +11 -3
  187. package/workflows/spec-generate.md +9 -0
  188. package/workflows/status.md +76 -27
  189. package/workflows/ui-design.md +14 -12
  190. package/workflows/verify.md +44 -8
  191. package/.claude/commands/maestro-phase-add.md +0 -63
  192. package/.claude/commands/maestro-phase-transition.md +0 -75
  193. package/.codex/skills/maestro-phase-add/SKILL.md +0 -154
  194. package/.codex/skills/maestro-phase-transition/SKILL.md +0 -173
  195. package/chains/singles/phase-add.json +0 -31
  196. package/chains/singles/phase-transition.json +0 -23
  197. package/dashboard/dist/assets/ChatInput-CL8YDfOU.js +0 -67
  198. package/dashboard/dist/assets/ChatPage-CT-ozBK2.js +0 -8
  199. package/dashboard/dist/assets/CollabPage-C0rWMden.js +0 -1
  200. package/dashboard/dist/assets/KanbanPage-C6WbAlwI.js +0 -16
  201. package/dashboard/dist/assets/McpPage-BPIXADQi.js +0 -16
  202. package/dashboard/dist/assets/TreeBrowser-g_QUKemL.js +0 -11
  203. package/dashboard/dist/assets/WorkflowPage-X8aNkDEr.js +0 -6
  204. package/dashboard/dist/assets/git-branch-SqFf4Ru5.js +0 -6
  205. package/dashboard/dist/assets/index-D2Mtyw7I.css +0 -1
  206. package/dashboard/dist/assets/index-nufWop4p.js +0 -231
  207. package/dashboard/dist/assets/wrench-B84-zdLI.js +0 -11
  208. package/dist/src/commands/team.d.ts.map +0 -1
  209. package/dist/src/commands/team.js.map +0 -1
  210. package/workflows/phase-add.md +0 -252
  211. package/workflows/phase-transition.md +0 -399
@@ -1,67 +0,0 @@
1
- import{E as M,j as s,r as N,x as gn,d as Se,y as vn,k as Pe,s as yt,p as bn,i as Le,c as yn,R as wn,P as Cn,O as kn,f as Tn,T as In,h as uo,v as Sn,t as zt}from"./index-nufWop4p.js";import{Z as Dt}from"./zap-9DVkGVtt.js";import{M as jn}from"./MarkdownRenderer-BjZ43aSa.js";import{W as Rn,T as Nn}from"./wrench-B84-zdLI.js";import{C as Mo}from"./chevron-right-CYbpR4ev.js";import{C as zn}from"./circle-alert-BqcYuT7x.js";const It=0,Ae=1,qe=2,Lo=4;function po(e){return()=>e}function En(e){e()}function Oo(e,t){return o=>e(t(o))}function mo(e,t){return()=>e(t)}function Hn(e,t){return o=>e(t,o)}function Ut(e){return e!==void 0}function Bn(...e){return()=>{e.map(En)}}function Ze(){}function St(e,t){return t(e),e}function Mn(e,t){return t(e)}function oe(...e){return e}function Q(e,t){return e(Ae,t)}function $(e,t){e(It,t)}function Kt(e){e(qe)}function se(e){return e(Lo)}function L(e,t){return Q(e,Hn(t,It))}function je(e,t){const o=e(Ae,n=>{o(),t(n)});return o}function ho(e){let t,o;return n=>r=>{t=r,o&&clearTimeout(o),o=setTimeout(()=>{n(t)},e)}}function Ao(e,t){return e===t}function te(e=Ao){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function W(e){return t=>o=>{e(o)&&t(o)}}function z(e){return t=>Oo(t,e)}function ze(e){return t=>()=>{t(e)}}function C(e,...t){const o=Ln(...t);return((n,r)=>{switch(n){case qe:Kt(e);return;case Ae:return Q(e,o(r))}})}function Ee(e,t){return o=>n=>{o(t=e(t,n))}}function Ve(e){return t=>o=>{e>0?e--:t(o)}}function Be(e){let t=null,o;return n=>r=>{t=r,!o&&(o=setTimeout(()=>{o=void 0,n(t)},e))}}function G(...e){const t=new Array(e.length);let o=0,n=null;const r=2**e.length-1;return e.forEach((l,i)=>{const c=2**i;Q(l,a=>{const u=o;o|=c,t[i]=a,u!==r&&o===r&&n&&(n(),n=null)})}),l=>i=>{const c=()=>{l([i].concat(t))};o===r?c():n=c}}function Ln(...e){return t=>e.reduceRight(Mn,t)}function On(e){let t,o;const n=()=>t==null?void 0:t();return function(r,l){switch(r){case Ae:return l?o===l?void 0:(n(),o=l,t=Q(e,l),t):(n(),Ze);case qe:n(),o=null;return}}}function T(e){let t=e;const o=K();return((n,r)=>{switch(n){case It:t=r;break;case Ae:{r(t);break}case Lo:return t}return o(n,r)})}function ve(e,t){return St(T(t),o=>L(e,o))}function K(){const e=[];return((t,o)=>{switch(t){case It:e.slice().forEach(n=>{n(o)});return;case qe:e.splice(0,e.length);return;case Ae:return e.push(o),()=>{const n=e.indexOf(o);n>-1&&e.splice(n,1)}}})}function ke(e){return St(K(),t=>L(e,t))}function Y(e,t=[],{singleton:o}={singleton:!0}){return{constructor:e,dependencies:t,id:An(),singleton:o}}const An=()=>Symbol();function _n(e){const t=new Map,o=({constructor:n,dependencies:r,id:l,singleton:i})=>{if(i&&t.has(l))return t.get(l);const c=n(r.map(a=>o(a)));return i&&t.set(l,c),c};return o(e)}function ue(...e){const t=K(),o=new Array(e.length);let n=0;const r=2**e.length-1;return e.forEach((l,i)=>{const c=2**i;Q(l,a=>{o[i]=a,n|=c,n===r&&$(t,o)})}),function(l,i){switch(l){case qe:{Kt(t);return}case Ae:return n===r&&i(o),Q(t,i)}}}function D(e,t=Ao){return C(e,te(t))}function Wt(...e){return function(t,o){switch(t){case qe:return;case Ae:return Bn(...e.map(n=>Q(n,o)))}}}const he={DEBUG:0,INFO:1,WARN:2,ERROR:3},Dn={[he.DEBUG]:"debug",[he.ERROR]:"error",[he.INFO]:"log",[he.WARN]:"warn"},Wn=()=>typeof globalThis>"u"?window:globalThis,_e=Y(()=>{const e=T(he.ERROR);return{log:T((t,o,n=he.INFO)=>{const r=Wn().VIRTUOSO_LOG_LEVEL??se(e);n>=r&&console[Dn[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)}),logLevel:e}},[],{singleton:!0});function $e(e,t,o){return Yt(e,t,o).callbackRef}function Yt(e,t,o){const n=M.useRef(null);let r=i=>{};const l=M.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const c=()=>{const a=i[0].target;a.offsetParent!==null&&e(a)};o?c():requestAnimationFrame(c)}):null,[e,o]);return r=i=>{i&&t?(l==null||l.observe(i),n.current=i):(n.current&&(l==null||l.unobserve(n.current)),n.current=null)},{callbackRef:r,ref:n}}function Fn(e,t,o,n,r,l,i,c,a){const u=M.useCallback(h=>{const v=Pn(h.children,t,c?"offsetWidth":"offsetHeight",r);let x=h.parentElement;for(;x.dataset.virtuosoScroller===void 0;)x=x.parentElement;const f=x.lastElementChild.dataset.viewportType==="window";let w;f&&(w=x.ownerDocument.defaultView);const b=i?c?i.scrollLeft:i.scrollTop:f?c?w.scrollX||w.document.documentElement.scrollLeft:w.scrollY||w.document.documentElement.scrollTop:c?x.scrollLeft:x.scrollTop,g=i?c?i.scrollWidth:i.scrollHeight:f?c?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight:c?x.scrollWidth:x.scrollHeight,m=i?c?i.offsetWidth:i.offsetHeight:f?c?w.innerWidth:w.innerHeight:c?x.offsetWidth:x.offsetHeight;n({scrollHeight:g,scrollTop:Math.max(b,0),viewportHeight:m}),l==null||l(c?fo("column-gap",getComputedStyle(h).columnGap,r):fo("row-gap",getComputedStyle(h).rowGap,r)),v!==null&&e(v)},[e,t,r,l,i,n,c]);return Yt(u,o,a)}function Pn(e,t,o,n){const r=e.length;if(r===0)return null;const l=[];for(let i=0;i<r;i++){const c=e.item(i);if(c.dataset.index===void 0)continue;const a=parseInt(c.dataset.index),u=parseFloat(c.dataset.knownSize),h=t(c,o);if(h===0&&n("Zero-sized element, this should not happen",{child:c},he.ERROR),h===u)continue;const v=l[l.length-1];l.length===0||v.size!==h||v.endIndex!==a-1?l.push({endIndex:a,size:h,startIndex:a}):l[l.length-1].endIndex++}return l}function fo(e,t,o){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&o(`${e} was not resolved to pixel value correctly`,t,he.WARN),t==="normal"?0:parseInt(t??"0",10)}function _o(e,t,o){const n=M.useRef(null),r=M.useCallback(a=>{if(!(a!=null&&a.offsetParent))return;const u=a.getBoundingClientRect(),h=u.width;let v,x;if(t){const f=t.getBoundingClientRect(),w=u.top-f.top;x=f.height-Math.max(0,w),v=w+t.scrollTop}else{const f=i.current.ownerDocument.defaultView;x=f.innerHeight-Math.max(0,u.top),v=u.top+f.scrollY}n.current={listHeight:u.height,offsetTop:v,visibleHeight:x,visibleWidth:h},e(n.current)},[e,t]),{callbackRef:l,ref:i}=Yt(r,!0,o),c=M.useCallback(()=>{r(i.current)},[r,i]);return M.useEffect(()=>{var u;if(t){t.addEventListener("scroll",c);const h=new ResizeObserver(()=>{requestAnimationFrame(c)});return h.observe(t),()=>{t.removeEventListener("scroll",c),h.unobserve(t)}}const a=(u=i.current)==null?void 0:u.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",c),a==null||a.addEventListener("resize",c),()=>{a==null||a.removeEventListener("scroll",c),a==null||a.removeEventListener("resize",c)}},[c,t,i]),l}const ye=Y(()=>{const e=K(),t=K(),o=T(0),n=K(),r=T(0),l=K(),i=K(),c=T(0),a=T(0),u=T(0),h=T(0),v=K(),x=K(),f=T(!1),w=T(!1),b=T(!1);return L(C(e,z(({scrollTop:g})=>g)),t),L(C(e,z(({scrollHeight:g})=>g)),i),L(t,r),{deviation:o,fixedFooterHeight:u,fixedHeaderHeight:a,footerHeight:h,headerHeight:c,horizontalDirection:w,scrollBy:x,scrollContainerState:e,scrollHeight:i,scrollingInProgress:f,scrollTo:v,scrollTop:t,skipAnimationFrameInResizeObserver:b,smoothScrollTargetReached:n,statefulScrollTop:r,viewportHeight:l}},[],{singleton:!0}),rt={lvl:0};function Do(e,t){const o=e.length;if(o===0)return[];let{index:n,value:r}=t(e[0]);const l=[];for(let i=1;i<o;i++){const{index:c,value:a}=t(e[i]);l.push({end:c-1,start:n,value:r}),n=c,r=a}return l.push({end:1/0,start:n,value:r}),l}function q(e){return e===rt}function st(e,t){if(!q(e))return t===e.k?e.v:t<e.k?st(e.l,t):st(e.r,t)}function Re(e,t,o="k"){if(q(e))return[-1/0,void 0];if(Number(e[o])===t)return[e.k,e.v];if(Number(e[o])<t){const n=Re(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return Re(e.l,t,o)}function Ce(e,t,o){return q(e)?Po(t,o,1):t===e.k?me(e,{k:t,v:o}):t<e.k?xo(me(e,{l:Ce(e.l,t,o)})):xo(me(e,{r:Ce(e.r,t,o)}))}function Ye(){return rt}function Xe(e,t,o){if(q(e))return[];const n=Re(e,t)[0];return Vn(Pt(e,n,o))}function Ft(e,t){if(q(e))return rt;const{k:o,l:n,r}=e;if(t===o){if(q(n))return r;if(q(r))return n;const[l,i]=Fo(n);return wt(me(e,{k:l,l:Wo(n),v:i}))}return t<o?wt(me(e,{l:Ft(n,t)})):wt(me(e,{r:Ft(r,t)}))}function Fe(e){return q(e)?[]:[...Fe(e.l),{k:e.k,v:e.v},...Fe(e.r)]}function Pt(e,t,o){if(q(e))return[];const{k:n,l:r,r:l,v:i}=e;let c=[];return n>t&&(c=c.concat(Pt(r,t,o))),n>=t&&n<=o&&c.push({k:n,v:i}),n<=o&&(c=c.concat(Pt(l,t,o))),c}function wt(e){const{l:t,lvl:o,r:n}=e;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(Et(t))return Vo(me(e,{lvl:o-1}));if(!q(t)&&!q(t.r))return me(t.r,{l:me(t,{r:t.r.l}),lvl:o,r:me(e,{l:t.r.r,lvl:o-1})});throw new Error("Unexpected empty nodes")}if(Et(e))return Vt(me(e,{lvl:o-1}));if(!q(n)&&!q(n.l)){const r=n.l,l=Et(r)?n.lvl-1:n.lvl;return me(r,{l:me(e,{lvl:o-1,r:r.l}),lvl:r.lvl+1,r:Vt(me(n,{l:r.r,lvl:l}))})}throw new Error("Unexpected empty nodes")}function me(e,t){return Po(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Wo(e){return q(e.r)?e.l:wt(me(e,{r:Wo(e.r)}))}function Et(e){return q(e)||e.lvl>e.r.lvl}function Fo(e){return q(e.r)?[e.k,e.v]:Fo(e.r)}function Po(e,t,o,n=rt,r=rt){return{k:e,l:n,lvl:o,r,v:t}}function xo(e){return Vt(Vo(e))}function Vo(e){const{l:t}=e;return!q(t)&&t.lvl===e.lvl?me(t,{r:me(e,{l:t.r})}):e}function Vt(e){const{lvl:t,r:o}=e;return!q(o)&&!q(o.r)&&o.lvl===t&&o.r.lvl===t?me(o,{l:me(e,{r:o.l}),lvl:t+1}):e}function Vn(e){return Do(e,({k:t,v:o})=>({index:t,value:o}))}function $o(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function lt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Xt=Y(()=>({recalcInProgress:T(!1)}),[],{singleton:!0});function Go(e,t,o){return e[kt(e,t,o)]}function kt(e,t,o,n=0){let r=e.length-1;for(;n<=r;){const l=Math.floor((n+r)/2),i=e[l],c=o(i,t);if(c===0)return l;if(c===-1){if(r-n<2)return l-1;r=l-1}else{if(r===n)return l;n=l+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function $n(e,t,o,n){const r=kt(e,t,n),l=kt(e,o,n,r);return e.slice(r,l+1)}function Oe(e,t){return Math.round(e.getBoundingClientRect()[t])}function jt(e){return!q(e.groupOffsetTree)}function Qt({index:e},t){return t===e?0:t<e?-1:1}function Gn(){return{groupIndices:[],groupOffsetTree:Ye(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Ye()}}function Un(e,t){let o=q(e)?0:1/0;for(const n of t){const{endIndex:r,size:l,startIndex:i}=n;if(o=Math.min(o,i),q(e)){e=Ce(e,0,l);continue}const c=Xe(e,i-1,r+1);if(c.some(Jn(n)))continue;let a=!1,u=!1;for(const{end:h,start:v,value:x}of c)a?(r>=v||l===x)&&(e=Ft(e,v)):(u=x!==l,a=!0),h>r&&r>=v&&x!==l&&(e=Ce(e,r+1,x));u&&(e=Ce(e,i,l))}return[e,o]}function Kn(e){return typeof e.groupIndex<"u"}function Yn({offset:e},t){return t===e?0:t<e?-1:1}function it(e,t,o){if(t.length===0)return 0;const{index:n,offset:r,size:l}=Go(t,e,Qt),i=e-n,c=l*i+(i-1)*o+r;return c>0?c+o:c}function Uo(e,t){if(!jt(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function Ko(e,t,o){if(Kn(e))return t.groupIndices[e.groupIndex]+1;const n=e.index==="LAST"?o:e.index;let r=Uo(n,t);return r=Math.max(0,r,Math.min(o,r)),r}function Xn(e,t,o,n=0){return n>0&&(t=Math.max(t,Go(e,n,Qt).offset)),Do($n(e,t,o,Yn),Zn)}function Qn(e,[t,o,n,r]){t.length>0&&n("received item sizes",t,he.DEBUG);const l=e.sizeTree;let i=l,c=0;if(o.length>0&&q(l)&&t.length===2){const x=t[0].size,f=t[1].size;i=o.reduce((w,b)=>Ce(Ce(w,b,x),b+1,f),i)}else[i,c]=Un(i,t);if(i===l)return e;const{lastIndex:a,lastOffset:u,lastSize:h,offsetTree:v}=$t(e.offsetTree,c,i,r);return{groupIndices:o,groupOffsetTree:o.reduce((x,f)=>Ce(x,f,it(f,v,r)),Ye()),lastIndex:a,lastOffset:u,lastSize:h,offsetTree:v,sizeTree:i}}function qn(e){return Fe(e).map(({k:t,v:o},n,r)=>{const l=r[n+1];return{endIndex:l!==void 0?l.k-1:1/0,size:o,startIndex:t}})}function go(e,t){let o=0,n=0;for(;o<e;)o+=t[n+1]-t[n]-1,n++;return n-(o===e?0:1)}function $t(e,t,o,n){let r=e,l=0,i=0,c=0,a=0;if(t!==0){a=kt(r,t-1,Qt),c=r[a].offset;const u=Re(o,t-1);l=u[0],i=u[1],r.length&&r[a].size===Re(o,t)[1]&&(a-=1),r=r.slice(0,a+1)}else r=[];for(const{start:u,value:h}of Xe(o,t,1/0)){const v=u-l,x=v*i+c+v*n;r.push({index:u,offset:x,size:h}),l=u,c=x,i=h}return{lastIndex:l,lastOffset:c,lastSize:i,offsetTree:r}}function Zn(e){return{index:e.index,value:e}}function Jn(e){const{endIndex:t,size:o,startIndex:n}=e;return r=>r.start===n&&(r.end===t||r.end===1/0)&&r.value===o}const er={offsetHeight:"height",offsetWidth:"width"},He=Y(([{log:e},{recalcInProgress:t}])=>{const o=K(),n=K(),r=ve(n,0),l=K(),i=K(),c=T(0),a=T([]),u=T(void 0),h=T(void 0),v=T(void 0),x=T(void 0),f=T((d,y)=>Oe(d,er[y])),w=T(void 0),b=T(0),g=Gn(),m=ve(C(o,G(a,e,b),Ee(Qn,g),te()),g),p=ve(C(a,te(),Ee((d,y)=>({current:y,prev:d.current}),{current:[],prev:[]}),z(({prev:d})=>d)),[]);L(C(a,W(d=>d.length>0),G(m,b),z(([d,y,S])=>{const B=d.reduce((H,P,V)=>Ce(H,P,it(P,y.offsetTree,S)||V),Ye());return{...y,groupIndices:d,groupOffsetTree:B}})),m),L(C(n,G(m),W(([d,{lastIndex:y}])=>d<y),z(([d,{lastIndex:y,lastSize:S}])=>[{endIndex:y,size:S,startIndex:d}])),o),L(u,h);const k=ve(C(u,z(d=>d===void 0)),!0);L(C(h,W(d=>d!==void 0&&q(se(m).sizeTree)),z(d=>{const y=se(v),S=se(a).length>0;return y!==void 0&&y!==0?S?[{endIndex:0,size:y,startIndex:0},{endIndex:1,size:d,startIndex:1}]:[]:[{endIndex:0,size:d,startIndex:0}]})),o),L(C(x,W(d=>d!==void 0&&d.length>0&&q(se(m).sizeTree)),z(d=>{const y=[];let S=d[0],B=0;for(let H=1;H<d.length;H++){const P=d[H];P!==S&&(y.push({endIndex:H-1,size:S,startIndex:B}),S=P,B=H)}return y.push({endIndex:d.length-1,size:S,startIndex:B}),y})),o),L(C(a,G(v,h),W(([,d,y])=>d!==void 0&&y!==void 0),z(([d,y,S])=>{const B=[];for(let H=0;H<d.length;H++){const P=d[H],V=d[H+1];B.push({startIndex:P,endIndex:P,size:y}),V!==void 0&&B.push({startIndex:P+1,endIndex:V-1,size:S})}return B})),o);const E=ke(C(o,G(m),Ee(({sizes:d},[y,S])=>({changed:S!==d,sizes:S}),{changed:!1,sizes:g}),z(d=>d.changed)));Q(C(c,Ee((d,y)=>({diff:d.prev-y,prev:y}),{diff:0,prev:0}),z(d=>d.diff)),d=>{const{groupIndices:y}=se(m);if(d>0)$(t,!0),$(l,d+go(d,y));else if(d<0){const S=se(p);S.length>0&&(d-=go(-d,S)),$(i,d)}}),Q(C(c,G(e)),([d,y])=>{d<0&&y("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},he.ERROR)});const j=ke(l);L(C(l,G(m),z(([d,y])=>{const S=y.groupIndices.length>0,B=[],H=y.lastSize;if(S){const P=st(y.sizeTree,0);let V=0,A=0;for(;V<d;){const I=y.groupIndices[A],_=y.groupIndices.length===A+1?1/0:y.groupIndices[A+1]-I-1;B.push({endIndex:I,size:P,startIndex:I}),B.push({endIndex:I+1+_-1,size:H,startIndex:I+1}),A++,V+=_+1}const U=Fe(y.sizeTree);return V!==d&&U.shift(),U.reduce((I,{k:_,v:J})=>{let fe=I.ranges;return I.prevSize!==0&&(fe=[...I.ranges,{endIndex:_+d-1,size:I.prevSize,startIndex:I.prevIndex}]),{prevIndex:_+d,prevSize:J,ranges:fe}},{prevIndex:d,prevSize:0,ranges:B}).ranges}return Fe(y.sizeTree).reduce((P,{k:V,v:A})=>({prevIndex:V+d,prevSize:A,ranges:[...P.ranges,{endIndex:V+d-1,size:P.prevSize,startIndex:P.prevIndex}]}),{prevIndex:0,prevSize:H,ranges:[]}).ranges})),o);const O=ke(C(i,G(m,b),z(([d,{offsetTree:y},S])=>{const B=-d;return it(B,y,S)})));return L(C(i,G(m,b),z(([d,y,S])=>{if(y.groupIndices.length>0){if(q(y.sizeTree))return y;let H=Ye();const P=se(p);let V=0,A=0,U=0;for(;V<-d;){U=P[A];const I=P[A+1]-U-1;A++,V+=I+1}if(H=Fe(y.sizeTree).reduce((I,{k:_,v:J})=>Ce(I,Math.max(0,_+d),J),H),V!==-d){const I=st(y.sizeTree,U);H=Ce(H,0,I);const _=Re(y.sizeTree,-d+1)[1];H=Ce(H,1,_)}return{...y,sizeTree:H,...$t(y.offsetTree,0,H,S)}}const B=Fe(y.sizeTree).reduce((H,{k:P,v:V})=>Ce(H,Math.max(0,P+d),V),Ye());return{...y,sizeTree:B,...$t(y.offsetTree,0,B,S)}})),m),{beforeUnshiftWith:j,data:w,defaultItemSize:h,firstItemIndex:c,fixedItemSize:u,fixedGroupSize:v,gap:b,groupIndices:a,heightEstimates:x,itemSize:f,listRefresh:E,shiftWith:i,shiftWithOffset:O,sizeRanges:o,sizes:m,statefulTotalCount:r,totalCount:n,trackItemSizes:k,unshiftWith:l}},oe(_e,Xt),{singleton:!0});function tr(e){return e.reduce((t,o)=>(t.groupIndices.push(t.totalCount),t.totalCount+=o+1,t),{groupIndices:[],totalCount:0})}const Yo=Y(([{groupIndices:e,sizes:t,totalCount:o},{headerHeight:n,scrollTop:r}])=>{const l=K(),i=K(),c=ke(C(l,z(tr)));return L(C(c,z(a=>a.totalCount)),o),L(C(c,z(a=>a.groupIndices)),e),L(C(ue(r,t,n),W(([a,u])=>jt(u)),z(([a,u,h])=>Re(u.groupOffsetTree,Math.max(a-h,0),"v")[0]),te(),z(a=>[a])),i),{groupCounts:l,topItemsIndexes:i}},oe(He,ye)),De=Y(([{log:e}])=>{const t=T(!1),o=ke(C(t,W(n=>n),te()));return Q(t,n=>{n&&se(e)("props updated",{},he.DEBUG)}),{didMount:o,propsReady:t}},oe(_e),{singleton:!0}),or=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Xo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!or)&&(t.behavior="auto"),t.offset===void 0&&(t.offset=0),t}const dt=Y(([{gap:e,listRefresh:t,sizes:o,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:l,footerHeight:i,headerHeight:c,scrollingInProgress:a,scrollTo:u,smoothScrollTargetReached:h,viewportHeight:v},{log:x}])=>{const f=K(),w=K(),b=T(0);let g=null,m=null,p=null;function k(){g!==null&&(g(),g=null),p!==null&&(p(),p=null),m&&(clearTimeout(m),m=null),$(a,!1)}return L(C(f,G(o,v,n,b,c,i,x),G(e,l,r),z(([[E,j,O,d,y,S,B,H],P,V,A])=>{const U=Xo(E),{align:I,behavior:_,offset:J}=U,fe=d-1,ie=Ko(U,j,fe);let we=it(ie,j.offsetTree,P)+S;I==="end"?(we+=V+Re(j.sizeTree,ie)[1]-O+A,ie===fe&&(we+=B)):I==="center"?we+=(V+Re(j.sizeTree,ie)[1]-O+A)/2:we-=y,J!==void 0&&J!==0&&(we+=J);const Me=xe=>{k(),xe?(H("retrying to scroll to",{location:E},he.DEBUG),$(f,E)):($(w,!0),H("list did not change, scroll successful",{},he.DEBUG))};if(k(),_==="smooth"){let xe=!1;p=Q(t,Ue=>{xe=xe||Ue}),g=je(h,()=>{Me(xe)})}else g=je(C(t,nr(150)),Me);return m=setTimeout(()=>{k()},1200),$(a,!0),H("scrolling from index to",{behavior:_,index:ie,top:we},he.DEBUG),{behavior:_,top:we}})),u),{scrollTargetReached:w,scrollToIndex:f,topListHeight:b}},oe(He,ye,_e),{singleton:!0});function nr(e){return t=>{const o=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(o))}}}function qt(e,t){e===0?t():requestAnimationFrame(()=>{qt(e-1,t)})}function Zt(e,t){const o=t-1;return typeof e=="number"?e:e.index==="LAST"?o:e.index}const pt=Y(([{defaultItemSize:e,listRefresh:t,sizes:o},{scrollTop:n},{scrollTargetReached:r,scrollToIndex:l},{didMount:i}])=>{const c=T(!0),a=T(0),u=T(!0);return L(C(i,G(a),W(([h,v])=>v!==0),ze(!1)),c),L(C(i,G(a),W(([h,v])=>v!==0),ze(!1)),u),Q(C(ue(t,i),G(c,o,e,u),W(([[,h],v,{sizeTree:x},f,w])=>h&&(!q(x)||Ut(f))&&!v&&!w),G(a)),([,h])=>{je(r,()=>{$(u,!0)}),qt(4,()=>{je(n,()=>{$(c,!0)}),$(l,h)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:a,scrolledToInitialItem:c}},oe(He,ye,dt,De),{singleton:!0});function Qo(e,t){return Math.abs(e-t)<1.01}const at="up",ot="down",rr="none",sr={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},lr=0,mt=Y(([{footerHeight:e,headerHeight:t,scrollBy:o,scrollContainerState:n,scrollTop:r,viewportHeight:l}])=>{const i=T(!1),c=T(!0),a=K(),u=K(),h=T(4),v=T(lr),x=ve(C(Wt(C(D(r),Ve(1),ze(!0)),C(D(r),Ve(1),ze(!1),ho(100))),te()),!1),f=ve(C(Wt(C(o,ze(!0)),C(o,ze(!1),ho(200))),te()),!1);L(C(ue(D(r),D(v)),z(([p,k])=>p<=k),te()),c),L(C(c,Be(50)),u);const w=ke(C(ue(n,D(l),D(t),D(e),D(h)),Ee((p,[{scrollHeight:k,scrollTop:E},j,O,d,y])=>{const S=E+j-k>-y,B={scrollHeight:k,scrollTop:E,viewportHeight:j};if(S){let P,V;return E>p.state.scrollTop?(P="SCROLLED_DOWN",V=p.state.scrollTop-E):(P="SIZE_DECREASED",V=p.state.scrollTop-E||p.scrollTopDelta),{atBottom:!0,atBottomBecause:P,scrollTopDelta:V,state:B}}let H;return B.scrollHeight>p.state.scrollHeight?H="SIZE_INCREASED":j<p.state.viewportHeight?H="VIEWPORT_HEIGHT_DECREASING":E<p.state.scrollTop?H="SCROLLING_UPWARDS":H="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:H,state:B}},sr),te((p,k)=>p!==void 0&&p.atBottom===k.atBottom))),b=ve(C(n,Ee((p,{scrollHeight:k,scrollTop:E,viewportHeight:j})=>{if(!Qo(p.scrollHeight,k)){const O=k-(E+j)<1;return p.scrollTop!==E&&O?{changed:!0,jump:p.scrollTop-E,scrollHeight:k,scrollTop:E}:{changed:!0,jump:0,scrollHeight:k,scrollTop:E}}return{changed:!1,jump:0,scrollHeight:k,scrollTop:E}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),W(p=>p.changed),z(p=>p.jump)),0);L(C(w,z(p=>p.atBottom)),i),L(C(i,Be(50)),a);const g=T(ot);L(C(n,z(({scrollTop:p})=>p),te(),Ee((p,k)=>se(f)?{direction:p.direction,prevScrollTop:k}:{direction:k<p.prevScrollTop?at:ot,prevScrollTop:k},{direction:ot,prevScrollTop:0}),z(p=>p.direction)),g),L(C(n,Be(50),ze(rr)),g);const m=T(0);return L(C(x,W(p=>!p),ze(0)),m),L(C(r,Be(100),G(x),W(([p,k])=>k),Ee(([p,k],[E])=>[k,E],[0,0]),z(([p,k])=>k-p)),m),{atBottomState:w,atBottomStateChange:a,atBottomThreshold:h,atTopStateChange:u,atTopThreshold:v,isAtBottom:i,isAtTop:c,isScrolling:x,lastJumpDueToItemResize:b,scrollDirection:g,scrollVelocity:m}},oe(ye)),ct="top",ut="bottom",vo="none";function bo(e,t,o){return typeof e=="number"?o===at&&t===ct||o===ot&&t===ut?e:0:o===at?t===ct?e.main:e.reverse:t===ut?e.main:e.reverse}function yo(e,t){return typeof e=="number"?e:e[t]??0}const Jt=Y(([{deviation:e,fixedHeaderHeight:t,headerHeight:o,scrollTop:n,viewportHeight:r}])=>{const l=K(),i=T(0),c=T(0),a=T(0),u=ve(C(ue(D(n),D(r),D(o),D(l,lt),D(a),D(i),D(t),D(e),D(c)),z(([h,v,x,[f,w],b,g,m,p,k])=>{const E=h-p,j=g+m,O=Math.max(x-E,0);let d=vo;const y=yo(k,ct),S=yo(k,ut);return f-=p,f+=x+m,w+=x+m,w-=p,f>h+j-y&&(d=at),w<h-O+v+S&&(d=ot),d!==vo?[Math.max(E-x-bo(b,ct,d)-y,0),E-O-m+v+bo(b,ut,d)+S]:null}),W(h=>h!==null),te(lt)),[0,0]);return{increaseViewportBy:c,listBoundary:l,overscan:a,topListHeight:i,visibleRange:u}},oe(ye),{singleton:!0});function ir(e,t,o){if(jt(t)){const n=Uo(e,t);return[{index:Re(t.groupOffsetTree,n)[0],offset:0,size:0},{data:o==null?void 0:o[0],index:n,offset:0,size:0}]}return[{data:o==null?void 0:o[0],index:e,offset:0,size:0}]}const Ht={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Ct(e,t,o,n,r,l){const{lastIndex:i,lastOffset:c,lastSize:a}=r;let u=0,h=0;if(e.length>0){u=e[0].offset;const b=e[e.length-1];h=b.offset+b.size}const v=o-i,x=c+v*a+(v-1)*n,f=u,w=x-h;return{bottom:h,firstItemIndex:l,items:wo(e,r,l),offsetBottom:w,offsetTop:u,top:f,topItems:wo(t,r,l),topListHeight:t.reduce((b,g)=>g.size+b,0),totalCount:o}}function qo(e,t,o,n,r,l){let i=0;if(o.groupIndices.length>0)for(const h of o.groupIndices){if(h-i>=e)break;i++}const c=e+i,a=Zt(t,c),u=Array.from({length:c}).map((h,v)=>({data:l[v+a],index:v+a,offset:0,size:0}));return Ct(u,[],c,r,o,n)}function wo(e,t,o){if(e.length===0)return[];if(!jt(t))return e.map(u=>({...u,index:u.index+o,originalIndex:u.index}));const n=e[0].index,r=e[e.length-1].index,l=[],i=Xe(t.groupOffsetTree,n,r);let c,a=0;for(const u of e){(!c||c.end<u.index)&&(c=i.shift(),a=t.groupIndices.indexOf(c.start));let h;u.index===c.start?h={index:a,type:"group"}:h={groupIndex:a,index:u.index-(a+1)+o},l.push({...h,data:u.data,offset:u.offset,originalIndex:u.index,size:u.size})}return l}function Co(e,t){return e===void 0?0:typeof e=="number"?e:e[t]??0}const Ge=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n,totalCount:r},l,{listBoundary:i,topListHeight:c,visibleRange:a},{initialTopMostItemIndex:u,scrolledToInitialItem:h},{topListHeight:v},x,{didMount:f},{recalcInProgress:w}])=>{const b=T([]),g=T(0),m=K(),p=T(0);L(l.topItemsIndexes,b);const k=ve(C(ue(f,w,D(a,lt),D(r),D(n),D(u),h,D(b),D(t),D(o),D(p),e),W(([d,y,,S,,,,,,,,B])=>{const H=B!==void 0&&B.length!==S;return d&&!y&&!H}),z(([,,[d,y],S,B,H,P,V,A,U,I,_])=>{var X,de;const J=B,{offsetTree:fe,sizeTree:ie}=J,we=se(g);if(S===0)return{...Ht,totalCount:S};if(d===0&&y===0)return we===0?{...Ht,totalCount:S}:qo(we,H,B,A,U,_||[]);if(q(ie))return we>0?null:Ct(ir(Zt(H,S),J,_),[],S,U,J,A);const Me=[];if(V.length>0){const ee=V[0],ne=V[V.length-1];let pe=0;for(const ae of Xe(ie,ee,ne)){const Z=ae.value,le=Math.max(ae.start,ee),be=Math.min(ae.end,ne);for(let ce=le;ce<=be;ce++)Me.push({data:_==null?void 0:_[ce],index:ce,offset:pe,size:Z}),pe+=Z}}if(!P)return Ct([],Me,S,U,J,A);const xe=V.length>0?V[V.length-1]+1:0,Ue=Xn(fe,d,y,xe);if(Ue.length===0)return null;const Je=S-1,Ne=St([],ee=>{for(const ne of Ue){const pe=ne.value;let ae=pe.offset,Z=ne.start;const le=pe.size;if(pe.offset<d){Z+=Math.floor((d-pe.offset+U)/(le+U));const ce=Z-ne.start;ae+=ce*le+ce*U}Z<xe&&(ae+=(xe-Z)*le,Z=xe);const be=Math.min(ne.end,Je);for(let ce=Z;ce<=be&&!(ae>=y);ce++)ee.push({data:_==null?void 0:_[ce],index:ce,offset:ae,size:le}),ae+=le+U}}),et=Co(I,ct),R=Co(I,ut);if(Ne.length>0&&(et>0||R>0)){const ee=Ne[0],ne=Ne[Ne.length-1];if(et>0&&ee.index>xe){const pe=Math.min(et,ee.index-xe),ae=[];let Z=ee.offset;for(let le=ee.index-1;le>=ee.index-pe;le--){const be=((X=Xe(ie,le,le)[0])==null?void 0:X.value)??ee.size;Z-=be+U,ae.unshift({data:_==null?void 0:_[le],index:le,offset:Z,size:be})}Ne.unshift(...ae)}if(R>0&&ne.index<Je){const pe=Math.min(R,Je-ne.index);let ae=ne.offset+ne.size+U;for(let Z=ne.index+1;Z<=ne.index+pe;Z++){const le=((de=Xe(ie,Z,Z)[0])==null?void 0:de.value)??ne.size;Ne.push({data:_==null?void 0:_[Z],index:Z,offset:ae,size:le}),ae+=le+U}}}return Ct(Ne,Me,S,U,J,A)}),W(d=>d!==null),te()),Ht);L(C(e,W(Ut),z(d=>d==null?void 0:d.length)),r),L(C(k,z(d=>d.topListHeight)),v),L(v,c),L(C(k,z(d=>[d.top,d.bottom])),i),L(C(k,z(d=>d.items)),m);const E=ke(C(k,W(({items:d})=>d.length>0),G(r,e),W(([{items:d},y])=>d[d.length-1].originalIndex===y-1),z(([,d,y])=>[d-1,y]),te(lt),z(([d])=>d))),j=ke(C(k,Be(200),W(({items:d,topItems:y})=>d.length>0&&d[0].originalIndex===y.length),z(({items:d})=>d[0].index),te())),O=ke(C(k,W(({items:d})=>d.length>0),z(({items:d})=>{let y=0,S=d.length-1;for(;d[y].type==="group"&&y<S;)y++;for(;d[S].type==="group"&&S>y;)S--;return{endIndex:d[S].index,startIndex:d[y].index}}),te($o)));return{endReached:E,initialItemCount:g,itemsRendered:m,listState:k,minOverscanItemCount:p,rangeChanged:O,startReached:j,topItemsIndexes:b,...x}},oe(He,Yo,Jt,pt,dt,mt,De,Xt),{singleton:!0}),Zo=Y(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:o,headerHeight:n},{listState:r}])=>{const l=K(),i=ve(C(ue(o,e,n,t,r),z(([c,a,u,h,v])=>c+a+u+h+v.offsetBottom+v.bottom)),0);return L(D(i),l),{totalListHeight:i,totalListHeightChanged:l}},oe(ye,Ge),{singleton:!0}),ar=Y(([{viewportHeight:e},{totalListHeight:t}])=>{const o=T(!1),n=ve(C(ue(o,e,t),W(([r])=>r),z(([,r,l])=>Math.max(0,r-l)),Be(0),te()),0);return{alignToBottom:o,paddingTopAddition:n}},oe(ye,Zo),{singleton:!0}),Jo=Y(()=>({context:T(null)})),cr=({itemBottom:e,itemTop:t,locationParams:{align:o,behavior:n,...r},viewportBottom:l,viewportTop:i})=>t<i?{...r,align:o??"start",...n!==void 0?{behavior:n}:{}}:e>l?{...r,align:o??"end",...n!==void 0?{behavior:n}:{}}:null,en=Y(([{gap:e,sizes:t,totalCount:o},{fixedFooterHeight:n,fixedHeaderHeight:r,headerHeight:l,scrollingInProgress:i,scrollTop:c,viewportHeight:a},{scrollToIndex:u}])=>{const h=K();return L(C(h,G(t,a,o,l,r,n,c),G(e),z(([[v,x,f,w,b,g,m,p],k])=>{const{calculateViewLocation:E=cr,done:j,...O}=v,d=Ko(v,x,w-1),y=it(d,x.offsetTree,k)+b+g,S=y+Re(x.sizeTree,d)[1],B=p+g,H=p+f-m,P=E({itemBottom:S,itemTop:y,locationParams:O,viewportBottom:H,viewportTop:B});return P!==null?j&&je(C(i,W(V=>!V),Ve(se(i)?1:2)),j):j==null||j(),P}),W(v=>v!==null)),u),{scrollIntoView:h}},oe(He,ye,dt,Ge,_e),{singleton:!0});function ko(e){return e===!1?!1:e==="smooth"?"smooth":"auto"}const ur=(e,t)=>typeof e=="function"?ko(e(t)):t&&ko(e),dr=Y(([{listRefresh:e,totalCount:t,fixedItemSize:o,data:n},{atBottomState:r,isAtBottom:l},{scrollToIndex:i},{scrolledToInitialItem:c},{didMount:a,propsReady:u},{log:h},{scrollingInProgress:v},{context:x},{scrollIntoView:f}])=>{const w=T(!1),b=K();let g=null;function m(j){$(i,{align:"end",behavior:j,index:"LAST"})}Q(C(ue(C(D(t),Ve(1)),a),G(D(w),l,c,v),z(([[j,O],d,y,S,B])=>{let H=O&&S,P="auto";return H&&(P=ur(d,y||B),H=H&&P!==!1),{followOutputBehavior:P,shouldFollow:H,totalCount:j}}),W(({shouldFollow:j})=>j)),({followOutputBehavior:j,totalCount:O})=>{g!==null&&(g(),g=null),se(o)!==void 0?requestAnimationFrame(()=>{se(h)("following output to ",{totalCount:O},he.DEBUG),m(j)}):g=je(e,()=>{se(h)("following output to ",{totalCount:O},he.DEBUG),m(j),g=null})});function p(j){const O=je(r,d=>{j&&!d.atBottom&&d.notAtBottomBecause==="SIZE_INCREASED"&&g===null&&(se(h)("scrolling to bottom due to increased size",{},he.DEBUG),m("auto"))});setTimeout(O,100)}Q(C(ue(D(w),t,u),W(([j,,O])=>j!==!1&&O),Ee(({value:j},[,O])=>({refreshed:j===O,value:O}),{refreshed:!1,value:0}),W(({refreshed:j})=>j),G(w,t)),([,j])=>{se(c)&&p(j!==!1)}),Q(b,()=>{p(se(w)!==!1)}),Q(ue(D(w),r),([j,O])=>{j!==!1&&!O.atBottom&&O.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&m("auto")});const k=T(null),E=K();return L(Wt(C(D(n),z(j=>(j==null?void 0:j.length)??0)),C(D(t))),E),Q(C(ue(C(E,Ve(1)),a),G(D(k),c,v,x),z(([[j,O],d,y,S,B])=>O&&y&&(d==null?void 0:d({context:B,totalCount:j,scrollingInProgress:S}))),W(j=>!!j),Be(0)),j=>{g!==null&&(g(),g=null),se(o)!==void 0?requestAnimationFrame(()=>{se(h)("scrolling into view",{}),$(f,j)}):g=je(e,()=>{se(h)("scrolling into view",{}),$(f,j),g=null})}),{autoscrollToBottom:b,followOutput:w,scrollIntoViewOnChange:k}},oe(He,mt,dt,pt,De,_e,ye,Jo,en)),pr=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n},{initialTopMostItemIndex:r},{initialItemCount:l,listState:i},{didMount:c}])=>(L(C(c,G(l),W(([,a])=>a!==0),G(r,n,t,o,e),z(([[,a],u,h,v,x,f=[]])=>qo(a,u,h,v,x,f))),i),{}),oe(He,pt,Ge,De),{singleton:!0}),mr=Y(([{didMount:e},{scrollTo:t},{listState:o}])=>{const n=T(0);return Q(C(e,G(n),W(([,r])=>r!==0),z(([,r])=>({top:r}))),r=>{je(C(o,Ve(1),W(l=>l.items.length>1)),()=>{requestAnimationFrame(()=>{$(t,r)})})}),{initialScrollTop:n}},oe(De,ye,Ge),{singleton:!0}),tn=Y(([{scrollVelocity:e}])=>{const t=T(!1),o=K(),n=T(!1);return L(C(e,G(n,t,o),W(([r,l])=>l!==!1&&l!==void 0),z(([r,l,i,c])=>{const{enter:a,exit:u}=l;if(i){if(u(r,c))return!1}else if(a(r,c))return!0;return i}),te()),t),Q(C(ue(t,e,o),G(n)),([[r,l,i],c])=>{r&&c!==!1&&c!==void 0&&c.change&&c.change(l,i)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:o,scrollVelocity:e}},oe(mt),{singleton:!0}),eo=Y(([{scrollContainerState:e,scrollTo:t}])=>{const o=K(),n=K(),r=K(),l=T(!1),i=T(void 0);return L(C(ue(o,n),z(([{scrollTop:c,viewportHeight:a},{offsetTop:u,listHeight:h}])=>({scrollHeight:h,scrollTop:Math.max(0,c-u),viewportHeight:a}))),e),L(C(t,G(n),z(([c,{offsetTop:a}])=>({...c,top:c.top+a}))),r),{customScrollParent:i,useWindowScroll:l,windowScrollContainerState:o,windowScrollTo:r,windowViewportRect:n}},oe(ye)),hr=Y(([{sizeRanges:e,sizes:t},{headerHeight:o,scrollTop:n},{initialTopMostItemIndex:r},{didMount:l},{useWindowScroll:i,windowScrollContainerState:c,windowViewportRect:a}])=>{const u=K(),h=T(void 0),v=T(null),x=T(null);return L(c,v),L(a,x),Q(C(u,G(t,n,i,v,x,o)),([f,w,b,g,m,p,k])=>{const E=qn(w.sizeTree);g&&m!==null&&p!==null&&(b=m.scrollTop-p.offsetTop),b-=k,f({ranges:E,scrollTop:b})}),L(C(h,W(Ut),z(fr)),r),L(C(l,G(h),W(([,f])=>f!==void 0),te(),z(([,f])=>f.ranges)),e),{getState:u,restoreStateFrom:h}},oe(He,ye,pt,De,eo));function fr(e){return{align:"start",index:0,offset:e.scrollTop}}const xr=Y(([{topItemsIndexes:e}])=>{const t=T(0);return L(C(t,W(o=>o>=0),z(o=>Array.from({length:o}).map((n,r)=>r))),e),{topItemCount:t}},oe(Ge));function on(e){let t=!1,o;return(()=>(t||(t=!0,o=e()),o))}const gr=on(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),vr=Y(([{deviation:e,scrollBy:t,scrollingInProgress:o,scrollTop:n},{isAtBottom:r,isScrolling:l,lastJumpDueToItemResize:i,scrollDirection:c},{listState:a},{beforeUnshiftWith:u,gap:h,shiftWithOffset:v,sizes:x},{log:f},{recalcInProgress:w}])=>{const b=ke(C(a,G(i),Ee(([,m,p,k],[{bottom:E,items:j,offsetBottom:O,totalCount:d},y])=>{const S=E+O;let B=0;return p===d&&m.length>0&&j.length>0&&(j[0].originalIndex===0&&m[0].originalIndex===0||(B=S-k,B!==0&&(B+=y))),[B,j,d,S]},[0,[],0,0]),W(([m])=>m!==0),G(n,c,o,r,f,w),W(([,m,p,k,,,E])=>!E&&!k&&m!==0&&p===at),z(([[m],,,,,p])=>(p("Upward scrolling compensation",{amount:m},he.DEBUG),m))));function g(m){m>0?($(t,{behavior:"auto",top:-m}),$(e,0)):($(e,0),$(t,{behavior:"auto",top:-m}))}return Q(C(b,G(e,l)),([m,p,k])=>{k&&gr()?$(e,p-m):g(-m)}),Q(C(ue(ve(l,!1),e,w),W(([m,p,k])=>!m&&!k&&p!==0),z(([m,p])=>p),Be(1)),g),L(C(v,z(m=>({top:-m}))),t),Q(C(u,G(x,h),z(([m,{groupIndices:p,lastSize:k,sizeTree:E},j])=>{function O(H){return H*(k+j)}if(p.length===0)return O(m);let d=0;const y=st(E,0);let S=0,B=0;for(;S<m;){S++,d+=y;let H=p.length===B+1?1/0:p[B+1]-p[B]-1;S+H>m&&(d-=y,H=m-S+1),S+=H,d+=O(H),B++}return d})),m=>{$(e,m),requestAnimationFrame(()=>{$(t,{top:m}),requestAnimationFrame(()=>{$(e,0),$(w,!1)})})}),{deviation:e}},oe(ye,mt,Ge,He,_e,Xt)),br=Y(([e,t,o,n,r,l,i,c,a,u,h])=>({...e,...t,...o,...n,...r,...l,...i,...c,...a,...u,...h}),oe(Jt,pr,De,tn,Zo,mr,ar,eo,en,_e,Jo)),nn=Y(([{data:e,defaultItemSize:t,firstItemIndex:o,fixedItemSize:n,fixedGroupSize:r,gap:l,groupIndices:i,heightEstimates:c,itemSize:a,sizeRanges:u,sizes:h,statefulTotalCount:v,totalCount:x,trackItemSizes:f},{initialItemFinalLocationReached:w,initialTopMostItemIndex:b,scrolledToInitialItem:g},m,p,k,E,{scrollToIndex:j},O,{topItemCount:d},{groupCounts:y},S])=>{const{listState:B,minOverscanItemCount:H,topItemsIndexes:P,rangeChanged:V,...A}=E;return L(V,S.scrollSeekRangeChanged),L(C(S.windowViewportRect,z(U=>U.visibleHeight)),m.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:o,fixedItemHeight:n,fixedGroupHeight:r,gap:l,groupCounts:y,heightEstimates:c,initialItemFinalLocationReached:w,initialTopMostItemIndex:b,scrolledToInitialItem:g,sizeRanges:u,topItemCount:d,topItemsIndexes:P,totalCount:x,...k,groupIndices:i,itemSize:a,listState:B,minOverscanItemCount:H,scrollToIndex:j,statefulTotalCount:v,trackItemSizes:f,rangeChanged:V,...A,...S,...m,sizes:h,...p}},oe(He,pt,ye,hr,dr,Ge,dt,vr,xr,Yo,br));function yr(e,t){const o={},n={};let r=0;const l=e.length;for(;r<l;)n[e[r]]=1,r+=1;for(const i in t)Object.hasOwn(n,i)||(o[i]=t[i]);return o}const xt=typeof document<"u"?M.useLayoutEffect:M.useEffect;function rn(e,t,o){const n=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),l=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),c=M.createContext({});function a(g,m){g.propsReady!==void 0&&$(g.propsReady,!1);for(const p of n){const k=g[t.required[p]];$(k,m[p])}for(const p of r)if(p in m){const k=g[t.optional[p]];$(k,m[p])}g.propsReady!==void 0&&$(g.propsReady,!0)}function u(g){return l.reduce((m,p)=>(m[p]=k=>{const E=g[t.methods[p]];$(E,k)},m),{})}function h(g){return i.reduce((m,p)=>(m[p]=On(g[t.events[p]]),m),{})}const v=M.forwardRef(function(g,m){const{children:p,...k}=g,[E]=M.useState(()=>St(_n(e),d=>{a(d,k)})),[j]=M.useState(mo(h,E));xt(()=>{for(const d of i)d in k&&Q(j[d],k[d]);return()=>{Object.values(j).map(Kt)}},[k,j,E]),xt(()=>{a(E,k)}),M.useImperativeHandle(m,po(u(E)));const O=o;return s.jsx(c.Provider,{value:E,children:o!==void 0?s.jsx(O,{...yr([...n,...r,...i],k),children:p}):p})}),x=g=>{const m=M.useContext(c);return M.useCallback(p=>{$(m[g],p)},[m,g])},f=g=>{const m=M.useContext(c)[g],p=M.useCallback(k=>Q(m,k),[m]);return M.useSyncExternalStore(p,()=>se(m),()=>se(m))},w=g=>{const m=M.useContext(c)[g],[p,k]=M.useState(mo(se,m));return xt(()=>Q(m,E=>{E!==p&&k(po(E))}),[m,p]),p},b=M.version.startsWith("18")?f:w;return{Component:v,useEmitter:(g,m)=>{const p=M.useContext(c)[g];xt(()=>Q(p,m),[m,p])},useEmitterValue:b,usePublisher:x}}const sn=M.createContext(void 0),ln=M.createContext(void 0),Bt="-webkit-sticky",To="sticky",to=on(()=>{if(typeof document>"u")return To;const e=document.createElement("div");return e.style.position=Bt,e.style.position===Bt?Bt:To}),an=typeof document<"u"?M.useLayoutEffect:M.useEffect;function Mt(e){return"self"in e}function wr(e){return"body"in e}function cn(e,t,o,n=Ze,r,l){const i=M.useRef(null),c=M.useRef(null),a=M.useRef(null),u=M.useCallback(x=>{let f,w,b;const g=x.target;if(wr(g)||Mt(g)){const p=Mt(g)?g:g.defaultView;b=l===!0?p.scrollX:p.scrollY,f=l===!0?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight,w=l===!0?p.innerWidth:p.innerHeight}else b=l===!0?g.scrollLeft:g.scrollTop,f=l===!0?g.scrollWidth:g.scrollHeight,w=l===!0?g.offsetWidth:g.offsetHeight;const m=()=>{e({scrollHeight:f,scrollTop:Math.max(b,0),viewportHeight:w})};x.suppressFlushSync===!0?m():gn.flushSync(m),c.current!==null&&(b===c.current||b<=0||b===f-w)&&(c.current=null,t(!0),a.current&&(clearTimeout(a.current),a.current=null))},[e,t,l]);M.useEffect(()=>{const x=r||i.current;return n(r||i.current),u({suppressFlushSync:!0,target:x}),x.addEventListener("scroll",u,{passive:!0}),()=>{n(null),x.removeEventListener("scroll",u)}},[i,u,o,n,r]);function h(x){const f=i.current;if(!f||(l===!0?"offsetWidth"in f&&f.offsetWidth===0:"offsetHeight"in f&&f.offsetHeight===0))return;const w=x.behavior==="smooth";let b,g,m;Mt(f)?(g=Math.max(Oe(f.document.documentElement,l===!0?"width":"height"),l===!0?f.document.documentElement.scrollWidth:f.document.documentElement.scrollHeight),b=l===!0?f.innerWidth:f.innerHeight,m=l===!0?window.scrollX:window.scrollY):(g=f[l===!0?"scrollWidth":"scrollHeight"],b=Oe(f,l===!0?"width":"height"),m=f[l===!0?"scrollLeft":"scrollTop"]);const p=g-b;if(x.top=Math.ceil(Math.max(Math.min(p,x.top),0)),Qo(b,g)||x.top===m){e({scrollHeight:g,scrollTop:m,viewportHeight:b}),w&&t(!0);return}w?(c.current=x.top,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,c.current=null,t(!0)},1e3)):c.current=null,l===!0&&(x={...x.behavior!==void 0?{behavior:x.behavior}:{},left:x.top}),f.scrollTo(x)}function v(x){l===!0&&(x={...x.behavior!==void 0?{behavior:x.behavior}:{},...x.top!==void 0?{left:x.top}:{}}),i.current.scrollBy(x)}return{scrollByCallback:v,scrollerRef:i,scrollToCallback:h}}function oo(e){return e}const Cr=Y(()=>{const e=T(c=>`Item ${c}`),t=T(c=>`Group ${c}`),o=T({}),n=T(oo),r=T("div"),l=T(Ze),i=(c,a=null)=>ve(C(o,z(u=>u[c]),te()),a);return{components:o,computeItemKey:n,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:r,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:l,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),kr=Y(([e,t])=>({...e,...t}),oe(nn,Cr)),Tr=({height:e})=>s.jsx("div",{style:{height:e}}),Ir={overflowAnchor:"none",position:to(),zIndex:1},un={overflowAnchor:"none"},Sr={...un,display:"inline-block",height:"100%"},Io=M.memo(function({showTopList:e=!1}){const t=F("listState"),o=Te("sizeRanges"),n=F("useWindowScroll"),r=F("customScrollParent"),l=Te("windowScrollContainerState"),i=Te("scrollContainerState"),c=r||n?l:i,a=F("itemContent"),u=F("context"),h=F("groupContent"),v=F("trackItemSizes"),x=F("itemSize"),f=F("log"),w=Te("gap"),b=F("horizontalDirection"),{callbackRef:g}=Fn(o,x,v,e?Ze:c,f,w,r,b,F("skipAnimationFrameInResizeObserver")),[m,p]=M.useState(0);no("deviation",A=>{m!==A&&p(A)});const k=F("EmptyPlaceholder"),E=F("ScrollSeekPlaceholder")??Tr,j=F("ListComponent"),O=F("ItemComponent"),d=F("GroupComponent"),y=F("computeItemKey"),S=F("isSeeking"),B=F("groupIndices").length>0,H=F("alignToBottom"),P=F("initialItemFinalLocationReached"),V=e?{}:{boxSizing:"border-box",...b?{display:"inline-block",height:"100%",marginLeft:m!==0?m:H?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:m!==0?m:H?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...P?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&k!==null&&k!==void 0?s.jsx(k,{...ge(k,u)}):s.jsx(j,{...ge(j,u),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:V,children:(e?t.topItems:t.items).map(A=>{const U=A.originalIndex,I=y(U+t.firstItemIndex,A.data,u);return S?N.createElement(E,{...ge(E,u),height:A.size,index:A.index,key:I,type:A.type||"item",...A.type==="group"?{}:{groupIndex:A.groupIndex}}):A.type==="group"?N.createElement(d,{...ge(d,u),"data-index":U,"data-item-index":A.index,"data-known-size":A.size,key:I,style:Ir},h(A.index,u)):N.createElement(O,{...ge(O,u),...zr(O,A.data),"data-index":U,"data-item-group-index":A.groupIndex,"data-item-index":A.index,"data-known-size":A.size,key:I,style:b?Sr:un},B?a(A.index,A.groupIndex,A.data,u):a(A.index,A.data,u))})})}),jr={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Rr={outline:"none",overflowX:"auto",position:"relative"},Rt=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:void 0}),Nr={position:to(),top:0,width:"100%",zIndex:1};function ge(e,t){if(typeof e!="string")return{context:t}}function zr(e,t){return{item:typeof e=="string"?void 0:t}}const Er=M.memo(function(){const e=F("HeaderComponent"),t=Te("headerHeight"),o=F("HeaderFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,F("skipAnimationFrameInResizeObserver")),r=F("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null}),Hr=M.memo(function(){const e=F("FooterComponent"),t=Te("footerHeight"),o=F("HeaderFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,F("skipAnimationFrameInResizeObserver")),r=F("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null});function dn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return M.memo(function({children:n,style:r,context:l,...i}){const c=o("scrollContainerState"),a=t("ScrollerComponent"),u=o("smoothScrollTargetReached"),h=t("scrollerRef"),v=t("horizontalDirection")||!1,{scrollByCallback:x,scrollerRef:f,scrollToCallback:w}=cn(c,u,a,h,void 0,v);return e("scrollTo",w),e("scrollBy",x),s.jsx(a,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:f,style:{...v?Rr:jr,...r},tabIndex:0,...i,...ge(a,l),children:n})})}function pn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return M.memo(function({children:n,style:r,context:l,...i}){const c=o("windowScrollContainerState"),a=t("ScrollerComponent"),u=o("smoothScrollTargetReached"),h=t("totalListHeight"),v=t("deviation"),x=t("customScrollParent"),f=M.useRef(null),w=t("scrollerRef"),{scrollByCallback:b,scrollerRef:g,scrollToCallback:m}=cn(c,u,a,w,x);return an(()=>{var p;return g.current=x||((p=f.current)==null?void 0:p.ownerDocument.defaultView),()=>{g.current=null}},[g,x]),e("windowScrollTo",m),e("scrollBy",b),s.jsx(a,{ref:f,"data-virtuoso-scroller":!0,style:{position:"relative",...r,...h!==0?{height:h+v}:void 0},...i,...ge(a,l),children:n})})}const Br=({children:e})=>{const t=M.useContext(sn),o=Te("viewportHeight"),n=Te("fixedItemHeight"),r=F("alignToBottom"),l=F("horizontalDirection"),i=M.useMemo(()=>Oo(o,a=>Oe(a,l?"width":"height")),[o,l]),c=$e(i,!0,F("skipAnimationFrameInResizeObserver"));return M.useEffect(()=>{t&&(o(t.viewportHeight),n(t.itemHeight))},[t,o,n]),s.jsx("div",{"data-viewport-type":"element",ref:c,style:Rt(r),children:e})},Mr=({children:e})=>{const t=M.useContext(sn),o=Te("windowViewportRect"),n=Te("fixedItemHeight"),r=F("customScrollParent"),l=_o(o,r,F("skipAnimationFrameInResizeObserver")),i=F("alignToBottom");return M.useEffect(()=>{t&&(n(t.itemHeight),o({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,o,n]),s.jsx("div",{"data-viewport-type":"window",ref:l,style:Rt(i),children:e})},Lr=({children:e})=>{const t=F("TopItemListComponent")??"div",o=F("headerHeight"),n={...Nr,marginTop:`${o}px`},r=F("context");return s.jsx(t,{style:n,...ge(t,r),children:e})},Or=M.memo(function(e){const t=F("useWindowScroll"),o=F("topItemsIndexes").length>0,n=F("customScrollParent"),r=F("context");return s.jsxs(n||t?Dr:_r,{...e,context:r,children:[o&&s.jsx(Lr,{children:s.jsx(Io,{showTopList:!0})}),s.jsxs(n||t?Mr:Br,{children:[s.jsx(Er,{}),s.jsx(Io,{}),s.jsx(Hr,{})]})]})}),{Component:Ar,useEmitter:no,useEmitterValue:F,usePublisher:Te}=rn(kr,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Or),_r=dn({useEmitter:no,useEmitterValue:F,usePublisher:Te}),Dr=pn({useEmitter:no,useEmitterValue:F,usePublisher:Te}),Wr=Ar,Fr=Y(()=>{const e=T(u=>s.jsxs("td",{children:["Item $",u]})),t=T(null),o=T(u=>s.jsxs("td",{colSpan:1e3,children:["Group ",u]})),n=T(null),r=T(null),l=T({}),i=T(oo),c=T(Ze),a=(u,h=null)=>ve(C(l,z(v=>v[u]),te()),h);return{components:l,computeItemKey:i,context:t,EmptyPlaceholder:a("EmptyPlaceholder"),FillerRow:a("FillerRow"),fixedFooterContent:r,fixedHeaderContent:n,itemContent:e,groupContent:o,ScrollerComponent:a("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TableBodyComponent:a("TableBody","tbody"),TableComponent:a("Table","table"),TableFooterComponent:a("TableFoot","tfoot"),TableHeadComponent:a("TableHead","thead"),TableRowComponent:a("TableRow","tr"),GroupComponent:a("Group","tr")}});oe(nn,Fr);to();const So={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Pr={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:jo,floor:Tt,max:nt,min:Lt,round:Ro}=Math;function No(e,t,o){return Array.from({length:t-e+1}).map((n,r)=>({data:o===null?null:o[r+e],index:r+e}))}function Vr(e){return{...Pr,items:e}}function gt(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function $r(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}const Gr=Y(([{increaseViewportBy:e,listBoundary:t,overscan:o,visibleRange:n},{footerHeight:r,headerHeight:l,scrollBy:i,scrollContainerState:c,scrollTo:a,scrollTop:u,smoothScrollTargetReached:h,viewportHeight:v},x,f,{didMount:w,propsReady:b},{customScrollParent:g,useWindowScroll:m,windowScrollContainerState:p,windowScrollTo:k,windowViewportRect:E},j])=>{const O=T(0),d=T(0),y=T(So),S=T({height:0,width:0}),B=T({height:0,width:0}),H=K(),P=K(),V=T(0),A=T(null),U=T({column:0,row:0}),I=K(),_=K(),J=T(!1),fe=T(0),ie=T(!0),we=T(!1),Me=T(!1);Q(C(w,G(fe),W(([R,X])=>X!==0)),()=>{$(ie,!1)}),Q(C(ue(w,ie,B,S,fe,we),W(([R,X,de,ee,,ne])=>R&&!X&&de.height!==0&&ee.height!==0&&!ne)),([,,,,R])=>{$(we,!0),qt(1,()=>{$(H,R)}),je(C(u),()=>{$(t,[0,0]),$(ie,!0)})}),L(C(_,W(R=>R!=null&&R.scrollTop>0),ze(0)),d),Q(C(w,G(_),W(([,R])=>R!=null)),([,R])=>{R&&($(S,R.viewport),$(B,R.item),$(U,R.gap),R.scrollTop>0&&($(J,!0),je(C(u,Ve(1)),X=>{$(J,!1)}),$(a,{top:R.scrollTop})))}),L(C(S,z(({height:R})=>R)),v),L(C(ue(D(S,gt),D(B,gt),D(U,(R,X)=>R!==void 0&&R.column===X.column&&R.row===X.row),D(u)),z(([R,X,de,ee])=>({gap:de,item:X,scrollTop:ee,viewport:R}))),I),L(C(ue(D(O),n,D(U,$r),D(B,gt),D(S,gt),D(A),D(d),D(J),D(ie),D(fe)),W(([,,,,,,,R])=>!R),z(([R,[X,de],ee,ne,pe,ae,Z,,le,be])=>{const{column:ce,row:tt}=ee,{height:ht,width:Nt}=ne,{width:ro}=pe;if(Z===0&&(R===0||ro===0))return So;if(Nt===0){const co=Zt(be,R),xn=co+Math.max(Z-1,0);return Vr(No(co,xn,ae))}const ft=mn(ro,Nt,ce);let Ke,We;le?X===0&&de===0&&Z>0?(Ke=0,We=Z-1):(Ke=ft*Tt((X+tt)/(ht+tt)),We=ft*jo((de+tt)/(ht+tt))-1,We=Lt(R-1,nt(We,ft-1)),Ke=Lt(We,nt(0,Ke))):(Ke=0,We=-1);const so=No(Ke,We,ae),{bottom:lo,top:io}=zo(pe,ee,ne,so),ao=jo(R/ft),fn=ao*ht+(ao-1)*tt-lo;return{bottom:lo,itemHeight:ht,items:so,itemWidth:Nt,offsetBottom:fn,offsetTop:io,top:io}})),y),L(C(A,W(R=>R!==null),z(R=>R.length)),O),L(C(ue(S,B,y,U),W(([R,X,{items:de}])=>de.length>0&&X.height!==0&&R.height!==0),z(([R,X,{items:de},ee])=>{const{bottom:ne,top:pe}=zo(R,ee,X,de);return[pe,ne]}),te(lt)),t);const xe=T(!1);L(C(u,G(xe),z(([R,X])=>X||R!==0)),xe);const Ue=ke(C(ue(y,O),W(([{items:R}])=>R.length>0),G(xe),W(([[R,X],de])=>{const ee=R.items[R.items.length-1].index===X-1;return(de||R.bottom>0&&R.itemHeight>0&&R.offsetBottom===0&&R.items.length===X)&&ee}),z(([[,R]])=>R-1),te())),Je=ke(C(D(y),W(({items:R})=>R.length>0&&R[0].index===0),ze(0),te())),Ne=ke(C(D(y),G(J),W(([{items:R},X])=>R.length>0&&!X),z(([{items:R}])=>({endIndex:R[R.length-1].index,startIndex:R[0].index})),te($o),Be(0)));L(Ne,f.scrollSeekRangeChanged),L(C(H,G(S,B,O,U),z(([R,X,de,ee,ne])=>{const pe=Xo(R),{align:ae,behavior:Z,offset:le}=pe;let be=pe.index;be==="LAST"&&(be=ee-1),be=nt(0,be,Lt(ee-1,be));let ce=Gt(X,ne,de,be);return ae==="end"?ce=Ro(ce-X.height+de.height):ae==="center"&&(ce=Ro(ce-X.height/2+de.height/2)),le!==void 0&&le!==0&&(ce+=le),{behavior:Z,top:ce}})),a);const et=ve(C(y,z(R=>R.offsetBottom+R.bottom)),0);return L(C(E,z(R=>({height:R.visibleHeight,width:R.visibleWidth}))),S),{customScrollParent:g,data:A,deviation:V,footerHeight:r,gap:U,headerHeight:l,increaseViewportBy:e,initialItemCount:d,itemDimensions:B,overscan:o,restoreStateFrom:_,scrollBy:i,scrollContainerState:c,scrollHeight:P,scrollTo:a,scrollToIndex:H,scrollTop:u,smoothScrollTargetReached:h,totalCount:O,useWindowScroll:m,viewportDimensions:S,windowScrollContainerState:p,windowScrollTo:k,windowViewportRect:E,...f,gridState:y,horizontalDirection:Me,initialTopMostItemIndex:fe,totalListHeight:et,...x,endReached:Ue,propsReady:b,rangeChanged:Ne,startReached:Je,stateChanged:I,stateRestoreInProgress:J,...j}},oe(Jt,ye,mt,tn,De,eo,_e));function mn(e,t,o){return nt(1,Tt((e+o)/(Tt(t)+o)))}function zo(e,t,o,n){const{height:r}=o;if(r===void 0||n.length===0)return{bottom:0,top:0};const l=Gt(e,t,o,n[0].index);return{bottom:Gt(e,t,o,n[n.length-1].index)+r,top:l}}function Gt(e,t,o,n){const r=mn(e.width,o.width,t.column),l=Tt(n/r),i=l*o.height+nt(0,l-1)*t.row;return i>0?i+t.row:i}const Ur=Y(()=>{const e=T(v=>`Item ${v}`),t=T({}),o=T(null),n=T("virtuoso-grid-item"),r=T("virtuoso-grid-list"),l=T(oo),i=T("div"),c=T(Ze),a=(v,x=null)=>ve(C(t,z(f=>f[v]),te()),x),u=T(!1),h=T(!1);return L(D(h),u),{components:t,computeItemKey:l,context:o,FooterComponent:a("Footer"),HeaderComponent:a("Header"),headerFooterTag:i,itemClassName:n,ItemComponent:a("Item","div"),itemContent:e,listClassName:r,ListComponent:a("List","div"),readyStateChanged:u,reportReadyState:h,ScrollerComponent:a("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder","div")}}),Kr=Y(([e,t])=>({...e,...t}),oe(Gr,Ur)),Yr=M.memo(function(){const e=re("gridState"),t=re("listClassName"),o=re("itemClassName"),n=re("itemContent"),r=re("computeItemKey"),l=re("isSeeking"),i=Ie("scrollHeight"),c=re("ItemComponent"),a=re("ListComponent"),u=re("ScrollSeekPlaceholder"),h=re("context"),v=Ie("itemDimensions"),x=Ie("gap"),f=re("log"),w=re("stateRestoreInProgress"),b=Ie("reportReadyState"),g=$e(M.useMemo(()=>m=>{const p=m.parentElement.parentElement.scrollHeight;i(p);const k=m.firstChild;if(k!==null){const{height:E,width:j}=k.getBoundingClientRect();v({height:E,width:j})}x({column:Eo("column-gap",getComputedStyle(m).columnGap,f),row:Eo("row-gap",getComputedStyle(m).rowGap,f)})},[i,v,x,f]),!0,!1);return an(()=>{e.itemHeight>0&&e.itemWidth>0&&b(!0)},[e]),w?null:s.jsx(a,{className:t,ref:g,...ge(a,h),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(m=>{const p=r(m.index,m.data,h);return l?s.jsx(u,{...ge(u,h),height:e.itemHeight,index:m.index,width:e.itemWidth},p):N.createElement(c,{...ge(c,h),className:o,"data-index":m.index,key:p},n(m.index,m.data,h))})})}),Xr=M.memo(function(){const e=re("HeaderComponent"),t=Ie("headerHeight"),o=re("headerFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,!1),r=re("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null}),Qr=M.memo(function(){const e=re("FooterComponent"),t=Ie("footerHeight"),o=re("headerFooterTag"),n=$e(M.useMemo(()=>l=>{t(Oe(l,"height"))},[t]),!0,!1),r=re("context");return e!=null?s.jsx(o,{ref:n,children:s.jsx(e,{...ge(e,r)})}):null}),qr=({children:e})=>{const t=M.useContext(ln),o=Ie("itemDimensions"),n=Ie("viewportDimensions"),r=$e(M.useMemo(()=>l=>{n(l.getBoundingClientRect())},[n]),!0,!1);return M.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),o({height:t.itemHeight,width:t.itemWidth}))},[t,n,o]),s.jsx("div",{ref:r,style:Rt(!1),children:e})},Zr=({children:e})=>{const t=M.useContext(ln),o=Ie("windowViewportRect"),n=Ie("itemDimensions"),r=re("customScrollParent"),l=_o(o,r,!1);return M.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),o({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,o,n]),s.jsx("div",{ref:l,style:Rt(!1),children:e})},Jr=M.memo(function({...e}){const t=re("useWindowScroll"),o=re("customScrollParent"),n=o||t?ts:es,r=o||t?Zr:qr,l=re("context");return s.jsx(n,{...e,...ge(n,l),children:s.jsxs(r,{children:[s.jsx(Xr,{}),s.jsx(Yr,{}),s.jsx(Qr,{})]})})}),{useEmitter:hn,useEmitterValue:re,usePublisher:Ie}=rn(Kr,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Jr),es=dn({useEmitter:hn,useEmitterValue:re,usePublisher:Ie}),ts=pn({useEmitter:hn,useEmitterValue:re,usePublisher:Ie});function Eo(e,t,o){return t!=="normal"&&(t==null?void 0:t.endsWith("px"))!==!0&&o(`${e} was not resolved to pixel value correctly`,t,he.WARN),t==="normal"?0:parseInt(t??"0",10)}const os=150;function ns({entries:e,itemCount:t}){const o=N.useRef(null),[n,r]=N.useState(!1),l=N.useRef(!1),i=N.useRef(0),c=N.useRef(e.length),a=N.useRef(0),u=N.useCallback((f="smooth")=>{o.current&&(a.current=Date.now(),o.current.scrollToIndex({index:t-1,behavior:f,align:"end"}))},[t]),h=N.useCallback(f=>l.current||!f?!1:"auto",[]),v=N.useCallback(f=>{r(!f),f&&(l.current=!1)},[]),x=N.useCallback(f=>{const b=f.target.scrollTop;if(Date.now()-a.current<os){i.current=b;return}b-i.current<-10&&(l.current=!0),i.current=b},[]);return N.useEffect(()=>{const f=e.length,w=c.current,b=f>w;if(c.current=f,!b)return;const g=e[e.length-1];(g==null?void 0:g.type)==="user_message"&&(l.current=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{o.current&&(a.current=Date.now(),o.current.scrollToIndex({index:"LAST",behavior:"auto",align:"end"}))})}))},[e]),{virtuosoRef:o,handleScroll:x,handleAtBottomStateChange:v,handleFollowOutput:h,showScrollButton:n,scrollToBottom:u}}/**
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 rs=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ss=Se("chevron-up",rs);/**
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 ls=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],is=Se("file-code",ls);/**
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 as=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],cs=Se("file-plus",as);/**
17
- * @license lucide-react v0.577.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const us=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]],ds=Se("file-x",us);/**
22
- * @license lucide-react v0.577.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const ps=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],ms=Se("file",ps);/**
27
- * @license lucide-react v0.577.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const hs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],fs=Se("image",hs);/**
32
- * @license lucide-react v0.577.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const xs=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],bl=Se("layout-dashboard",xs);/**
37
- * @license lucide-react v0.577.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const gs=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],vs=Se("paperclip",gs);/**
42
- * @license lucide-react v0.577.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const bs=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],ys=Se("send",bs);/**
47
- * @license lucide-react v0.577.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const ws=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Cs=Se("shield-check",ws);/**
52
- * @license lucide-react v0.577.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const ks=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ts=Se("shield-question-mark",ks);/**
57
- * @license lucide-react v0.577.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const Is=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]],Ss=Se("shield-x",Is),js=/^(\/[a-zA-Z0-9_-]+)\s*/,Rs=/@([\w./\\-]+\.\w+)/g;function Ns(e){const t=[];let o=0,n;const r=new RegExp(Rs);for(;(n=r.exec(e))!==null;){n.index>o&&t.push(e.slice(o,n.index));const l=n[1];t.push(s.jsxs("span",{className:"inline-flex items-center gap-[3px] mx-[2px] px-[6px] py-[1px] rounded-[5px] text-[11px] font-mono align-middle",style:{backgroundColor:"rgba(255,255,255,0.1)",color:"#E8DFD5"},children:[s.jsx(ms,{size:10,strokeWidth:2}),l.split(/[\\/]/).pop()]},n.index)),o=r.lastIndex}return o<e.length&&t.push(e.slice(o)),t.length>0?t:e}function zs({entry:e}){const t=e.content.match(js),o=t==null?void 0:t[1],n=t?e.content.slice(t[0].length):e.content;return s.jsx("div",{className:"flex justify-end py-[var(--spacing-1-5)]",children:s.jsxs("div",{className:"max-w-[70%] px-[14px] py-[10px] text-[13px] leading-[1.6] whitespace-pre-wrap break-words",style:{backgroundColor:"#3D352D",color:"#F0EBE5",borderRadius:"16px 16px 4px 16px"},children:[o&&s.jsxs("span",{className:"inline-flex items-center gap-[4px] mr-[6px] px-[7px] py-[1px] rounded-[6px] text-[11px] font-semibold align-middle",style:{backgroundColor:"var(--color-tint-planning)",color:"var(--color-accent-purple)"},children:[s.jsx(Dt,{size:10,strokeWidth:2}),o]}),Ns(n)]})})}function Es({children:e,maxHeight:t=300,expandLabel:o="Show more",collapseLabel:n="Show less"}){var x;const r=N.useRef(null),[l,i]=N.useState(!1),[c,a]=N.useState(!1);N.useEffect(()=>{const f=r.current;if(!f)return;const w=()=>{const g=f.scrollHeight;i(g>t)};w();const b=new ResizeObserver(()=>{requestAnimationFrame(w)});return b.observe(f),()=>{b.disconnect()}},[t]);const u=N.useCallback(()=>a(f=>!f),[]),v=l&&!c?{maxHeight:`${t}px`,overflow:"hidden",maskImage:"linear-gradient(to bottom, black calc(100% - 60px), transparent)",WebkitMaskImage:"linear-gradient(to bottom, black calc(100% - 60px), transparent)",transition:"max-height 0.35s ease"}:{maxHeight:l?`${((x=r.current)==null?void 0:x.scrollHeight)??9999}px`:"none",overflow:"hidden",transition:"max-height 0.35s ease"};return s.jsxs("div",{children:[s.jsx("div",{ref:r,style:v,children:e}),l&&s.jsx("button",{type:"button",onClick:u,className:"flex items-center gap-1 mt-2 px-0 py-1 text-[12px] font-medium border-none bg-transparent cursor-pointer",style:{color:"color-mix(in srgb, var(--color-text-secondary) 80%, transparent)"},children:c?s.jsxs(s.Fragment,{children:[s.jsx(ss,{size:14}),n]}):s.jsxs(s.Fragment,{children:[s.jsx(vn,{size:14}),o]})})]})}const Qe={"claude-code":{label:"C",color:"var(--color-accent-purple)",className:"claude"},codex:{label:"Cx",color:"var(--color-accent-green)",className:"codex"},"codex-server":{label:"Cs",color:"var(--color-accent-green)",className:"codex"},gemini:{label:"G",color:"var(--color-accent-blue)",className:"gemini"},"gemini-a2a":{label:"Ga",color:"var(--color-accent-blue)",className:"gemini"},qwen:{label:"Q",color:"var(--color-accent-orange)",className:"qwen"},opencode:{label:"O",color:"var(--color-text-tertiary)",className:"opencode"},"agent-sdk":{label:"S",color:"var(--color-accent-purple)",className:"claude"}};function Hs({entry:e,isGroupContinuation:t}){const o=Pe(i=>i.processes[e.processId]),n=o==null?void 0:o.type,r=(o==null?void 0:o.status)==="running"||(o==null?void 0:o.status)==="spawning",l=Qe[n??"claude-code"]??Qe["claude-code"];return s.jsxs("div",{className:"flex gap-[10px]",style:{paddingTop:t?0:10,paddingBottom:10},children:[t?s.jsx("div",{className:"shrink-0 w-7"}):s.jsxs("div",{className:"relative shrink-0 w-7 h-7 rounded-[8px] flex items-center justify-center mt-[2px] text-[11px] font-bold text-white",style:{backgroundColor:l.color},children:[l.label,r&&s.jsx("span",{className:"absolute inset-[-3px] rounded-[10px] pointer-events-none",style:{border:"1.5px solid currentColor",color:l.color,opacity:.3,animation:"avatar-pulse 2.5s ease-in-out infinite"}})]}),s.jsx("div",{className:"flex-1 min-w-0 flex flex-col gap-2 contain-content",children:e.partial?s.jsxs("div",{className:"text-text-primary text-[13px] leading-[1.75] whitespace-pre-wrap break-words",children:[e.content,s.jsx("span",{className:"inline-block w-[2px] h-[1em] ml-[2px] align-text-bottom",style:{backgroundColor:"var(--color-accent-orange)",animation:"blink-cursor 1s step-end infinite"},"aria-label":"Typing"})]}):s.jsx(Es,{maxHeight:300,children:s.jsx(jn,{content:e.content})})})]})}function Bs({entry:e}){const[t,o]=N.useState(!1),n=Pe(i=>i.entries[e.processId]??[]),r=N.useMemo(()=>{const i=n.findIndex(a=>a.id===e.id);return i===-1||i===n.length-1||!n[i+1]},[n,e.id]),l=N.useMemo(()=>{if(r)return"Thinking...";const i=n.findIndex(v=>v.id===e.id),c=n[i+1];if(!c)return"Thinking...";const a=new Date(e.timestamp).getTime(),u=new Date(c.timestamp).getTime(),h=Math.round((u-a)/1e3);return h<1?"Thought for <1s":`Thought for ${h}s`},[n,e.id,e.timestamp,r]);return s.jsxs("div",{className:"contain-content",children:[s.jsxs("button",{type:"button",onClick:()=>o(i=>!i),className:"text-left text-[12px] leading-[1.6] italic py-[4px] cursor-pointer transition-colors",style:{color:"var(--color-text-tertiary)",transitionDuration:"var(--duration-fast)"},onMouseEnter:i=>{i.currentTarget.style.color="var(--color-text-secondary)"},onMouseLeave:i=>{i.currentTarget.style.color="var(--color-text-tertiary)"},children:[s.jsx("span",{className:"not-italic font-semibold text-[10px] uppercase tracking-[0.04em] mr-[6px]",style:{color:"var(--color-accent-purple)"},children:"Thinking"}),s.jsxs("span",{style:{color:"var(--color-accent-purple)"},children:[e.content.slice(0,60),e.content.length>60?"...":""]}),s.jsx("span",{className:"not-italic text-[10px] font-mono ml-[4px]",style:{color:"var(--color-text-placeholder)"},children:l.replace("Thought for ","").replace("Thinking...","...")})]}),t&&s.jsx("div",{className:"text-[12px] leading-[1.6] italic mt-[2px] pl-[2px] whitespace-pre-wrap break-words",style:{color:"var(--color-text-tertiary)"},children:e.content})]})}const Ms={pending:{bg:"var(--color-status-bg-pending)",color:"var(--color-status-pending)",label:"Pending"},running:{bg:"var(--color-status-bg-executing)",color:"var(--color-status-executing)",label:"Running"},completed:{bg:"var(--color-status-bg-completed)",color:"var(--color-status-completed)",label:"Completed"},failed:{bg:"var(--color-status-bg-blocked)",color:"var(--color-status-blocked)",label:"Failed"}};function Ls({entry:e}){const[t,o]=N.useState(!1),n=Ms[e.status];return s.jsxs("div",{className:"flex gap-[6px]",children:[s.jsxs("div",{className:"flex flex-col items-center shrink-0 pt-[12px]",style:{marginLeft:"2px"},children:[s.jsx("span",{className:"w-[8px] h-[8px] rounded-full shrink-0",style:{backgroundColor:e.status==="completed"?"var(--color-tint-completed)":e.status==="running"?"var(--color-tint-executing)":"var(--color-bg-card)",border:`2px solid ${e.status==="completed"?"var(--color-accent-green)":e.status==="running"?"var(--color-accent-yellow)":"var(--color-border)"}`}}),s.jsx("span",{className:"w-[2px] flex-1 mt-0",style:{backgroundColor:"var(--color-border)"}})]}),s.jsxs("div",{className:"flex-1 min-w-0 contain-content pl-[8px]",children:[s.jsxs("button",{type:"button",onClick:()=>o(r=>!r),className:"flex items-center gap-[6px] w-full py-[4px] text-left cursor-pointer transition-opacity hover:opacity-70",style:{transitionDuration:"var(--duration-fast)"},children:[s.jsx(Rn,{size:14,className:"shrink-0",strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),s.jsx("span",{className:"text-[12px] font-semibold text-text-primary truncate",children:e.name==="unknown"?"Tool Call":e.name}),e.input&&typeof e.input=="object"&&"file_path"in e.input&&s.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--color-text-tertiary)"},children:String(e.input.file_path).split("/").pop()}),s.jsx("span",{className:"ml-auto shrink-0 rounded-[var(--radius-full)] px-[var(--spacing-2)] py-[2px] text-[10px] font-semibold",style:{backgroundColor:n.bg,color:n.color},children:n.label})]}),t&&s.jsxs("div",{className:"mt-[4px] space-y-[4px]",children:[e.input&&Object.keys(e.input).length>0&&s.jsx("pre",{className:"text-[11px] font-mono rounded-[6px] p-[6px_8px] overflow-x-auto max-h-[120px] overflow-y-auto whitespace-pre-wrap break-words leading-[1.5]",style:{background:"var(--color-bg-primary)",color:"var(--color-text-secondary)",border:"1px solid var(--color-border-divider)"},children:JSON.stringify(e.input,null,2)}),e.result!=null&&e.result.length>0&&s.jsx("pre",{className:"text-[11px] font-mono rounded-[6px] p-[6px_8px] overflow-x-auto max-h-[120px] overflow-y-auto whitespace-pre-wrap break-words leading-[1.5]",style:{background:"var(--color-bg-primary)",color:"var(--color-text-secondary)",border:"1px solid var(--color-border-divider)"},children:e.result}),(!e.input||Object.keys(e.input).length===0)&&(!e.result||e.result.length===0)&&s.jsx("div",{className:"text-[11px] px-[8px] py-[4px]",style:{color:"var(--color-text-placeholder)"},children:"No details available"})]})]})]})}const Os={create:{icon:cs,color:"var(--color-accent-green)",bg:"var(--color-status-bg-completed)",label:"Create"},modify:{icon:is,color:"var(--color-accent-yellow)",bg:"var(--color-status-bg-executing)",label:"Modify"},delete:{icon:ds,color:"var(--color-accent-red)",bg:"var(--color-status-bg-blocked)",label:"Delete"}};function As({entry:e}){const[t,o]=N.useState(!1),n=Os[e.action],r=n.icon,l=e.diff!=null&&e.diff.length>0;return s.jsxs("div",{className:"rounded-[10px] border border-border overflow-hidden contain-content transition-shadow",style:{backgroundColor:"var(--color-bg-card)",transitionDuration:"var(--duration-slow)"},onMouseEnter:i=>{i.currentTarget.style.boxShadow="0 2px 12px rgba(45,42,38,0.06)"},onMouseLeave:i=>{i.currentTarget.style.boxShadow="none"},children:[s.jsxs("button",{type:"button",onClick:()=>l&&o(i=>!i),className:`flex items-center gap-[var(--spacing-2)] w-full px-[var(--spacing-3)] py-[var(--spacing-2)] text-left transition-colors ${l?"hover:bg-bg-hover cursor-pointer":"cursor-default"}`,style:{transitionDuration:"var(--duration-fast)"},children:[s.jsx(r,{size:14,className:"shrink-0",strokeWidth:1.8,style:{color:n.color}}),s.jsx("span",{className:"text-[11px] font-mono truncate",style:{color:"var(--color-text-secondary)"},children:e.path}),s.jsx("span",{className:"ml-auto shrink-0 rounded-[var(--radius-sm)] px-[7px] py-[2px] text-[10px] font-bold uppercase tracking-[0.03em]",style:{backgroundColor:n.bg,color:n.color},children:n.label}),l&&s.jsx(Mo,{size:14,className:"shrink-0 transition-transform text-text-tertiary",style:{transitionDuration:"var(--duration-fast)",transform:t?"rotate(90deg)":"rotate(0deg)"}})]}),t&&l&&s.jsx("div",{className:"border-t border-border-divider",children:s.jsx("pre",{className:"text-[length:var(--font-size-xs)] font-mono p-[var(--spacing-3)] overflow-x-auto max-h-[300px] overflow-y-auto",style:{background:"var(--code-bg)",color:"var(--code-t1)"},children:e.diff.split(`
62
- `).map((i,c)=>{const a=i.startsWith("+"),u=i.startsWith("-");return s.jsx("div",{style:{background:a?"rgba(90, 158, 120, 0.1)":u?"rgba(196, 101, 85, 0.1)":void 0,color:a?"#5A9E78":u?"#C46555":void 0},children:i},c)})})})]})}function _s({entry:e}){const[t,o]=N.useState(!1),n=e.output!=null&&e.output.length>0,r=e.exitCode!=null&&e.exitCode!==0;return s.jsxs("div",{className:"rounded-[10px] border overflow-hidden contain-content font-mono",style:{backgroundColor:"var(--code-bg)",borderColor:r?"var(--color-accent-red)":"var(--code-border)"},children:[s.jsxs("button",{type:"button",onClick:()=>n&&o(l=>!l),className:`flex items-center gap-[var(--spacing-2)] w-full px-[var(--spacing-3)] py-[var(--spacing-2)] text-left transition-colors ${n?"cursor-pointer":"cursor-default"}`,style:{transitionDuration:"var(--duration-fast)"},onMouseEnter:l=>{n&&(l.currentTarget.style.backgroundColor="rgba(255,255,255,0.03)")},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent"},children:[s.jsx(Nn,{size:14,className:"shrink-0",style:{color:"var(--code-t2)"}}),s.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--code-t1)"},children:e.command}),e.exitCode!=null&&s.jsxs("span",{className:"ml-auto shrink-0 text-[10px] font-semibold px-[7px] py-[2px] rounded-[var(--radius-sm)]",style:{color:r?"#D4A07A":"#A3BE8C",backgroundColor:r?"rgba(196,101,85,0.15)":"rgba(90,158,120,0.15)"},children:["exit ",e.exitCode]}),n&&s.jsx(Mo,{size:14,className:"shrink-0 transition-transform",style:{color:"var(--code-t2)",transitionDuration:"var(--duration-fast)",transform:t?"rotate(90deg)":"rotate(0deg)"}})]}),t&&n&&s.jsx("div",{style:{borderTop:"1px solid var(--code-border)"},children:s.jsx("pre",{className:"text-[11px] leading-[1.5] p-[var(--spacing-3)] overflow-x-auto max-h-[300px] overflow-y-auto whitespace-pre-wrap break-words",style:{color:"var(--code-t2)"},children:e.output})})]})}function Ot({label:e,light:t}){return s.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:18,height:16,padding:"0 4px",borderRadius:3,fontSize:10,fontFamily:"monospace",fontWeight:600,lineHeight:1,backgroundColor:t?"rgba(255,255,255,0.2)":"var(--color-bg-hover)",color:t?"rgba(255,255,255,0.8)":"var(--color-text-tertiary)",border:t?"none":"1px solid var(--color-border-divider)"},children:e})}function Ds({entry:e}){function t(o){yt({action:"approve",processId:e.processId,requestId:e.requestId,allow:o})}return s.jsxs("div",{className:"rounded-[10px] overflow-hidden contain-content",style:{backgroundColor:"var(--color-tint-verifying)",border:"1.5px solid var(--color-accent-orange)"},children:[s.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] py-[9px]",style:{borderBottom:"1px solid rgba(200,134,58,0.15)"},children:[s.jsx(Ts,{size:15,className:"shrink-0",strokeWidth:1.8,style:{color:"var(--color-accent-orange)"}}),s.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:"Permission Required"}),s.jsx("span",{className:"ml-auto shrink-0 rounded-[var(--radius-full)] px-[var(--spacing-2)] py-[2px] text-[10px] font-semibold",style:{backgroundColor:"rgba(200,134,58,0.12)",color:"var(--color-accent-orange)"},children:e.toolName})]}),s.jsx("div",{className:"px-[var(--spacing-3)] py-[10px]",children:s.jsx("pre",{className:"text-[11px] font-mono rounded-[var(--radius-default)] p-[8px_10px] overflow-x-auto max-h-[100px] overflow-y-auto whitespace-pre-wrap break-words",style:{color:"var(--color-text-secondary)",backgroundColor:"var(--color-bg-card)",border:"1px solid var(--color-border-divider)"},children:JSON.stringify(e.toolInput,null,2)})}),s.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] py-[var(--spacing-2)]",style:{borderTop:"1px solid rgba(200,134,58,0.15)"},children:[s.jsxs("button",{type:"button",onClick:()=>t(!0),className:"rounded-[var(--radius-md)] px-[var(--spacing-4)] py-[5px] text-[12px] font-semibold transition-all hover:opacity-90 flex items-center gap-[6px]",style:{backgroundColor:"var(--color-accent-green)",color:"#fff"},children:["Allow",s.jsx(Ot,{label:"Y",light:!0})]}),s.jsxs("button",{type:"button",onClick:()=>t(!1),className:"rounded-[var(--radius-md)] px-[var(--spacing-4)] py-[5px] text-[12px] font-semibold border transition-all flex items-center gap-[6px]",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-card)",color:"var(--color-accent-red)"},onMouseEnter:o=>{const n=o.currentTarget;n.style.borderColor="var(--color-accent-red)",n.style.backgroundColor="var(--color-tint-blocked)"},onMouseLeave:o=>{const n=o.currentTarget;n.style.borderColor="var(--color-border)",n.style.backgroundColor="var(--color-bg-card)"},children:["Deny",s.jsx(Ot,{label:"Esc"})]}),s.jsxs("span",{className:"ml-auto text-[10px]",style:{color:"var(--color-text-placeholder)"},children:[s.jsx(Ot,{label:"A"})," Always"]})]})]})}function Ws({entry:e}){const t=e.allowed?Cs:Ss,o=e.allowed?"var(--color-accent-green)":"var(--color-accent-red)",n=e.allowed?"var(--color-status-bg-completed)":"var(--color-status-bg-blocked)",r=e.allowed?"Allowed":"Denied";return s.jsx("div",{className:"flex items-center justify-center",children:s.jsxs("span",{className:"inline-flex items-center gap-[var(--spacing-1-5)] rounded-[var(--radius-full)] px-[var(--spacing-3)] py-[var(--spacing-1)] text-[length:var(--font-size-xs)] font-[var(--font-weight-medium)]",style:{backgroundColor:n,color:o},children:[s.jsx(t,{size:12}),r]})})}function Fs({entry:e}){return s.jsxs("div",{className:"flex items-start gap-[6px] py-[4px]",role:"alert",style:{color:"var(--color-accent-red)"},children:[s.jsx(zn,{size:14,className:"shrink-0 mt-[2px]",strokeWidth:1.8}),s.jsxs("div",{className:"min-w-0 text-[12px] leading-[1.5]",children:[s.jsx("span",{className:"break-words",children:e.message}),e.code&&s.jsx("code",{className:"ml-[4px] font-mono text-[11px] px-[5px] py-[1px] rounded-[3px]",style:{backgroundColor:"rgba(196,101,85,0.06)"},children:e.code})]})]})}const Ps={spawning:"var(--color-status-exploring)",running:"var(--color-status-executing)",paused:"var(--color-status-pending)",stopping:"var(--color-accent-orange)",stopped:"var(--color-status-pending)",error:"var(--color-accent-red)"},Vs={spawning:"var(--color-status-bg-exploring)",running:"var(--color-status-bg-executing)",paused:"var(--color-status-bg-pending)",stopping:"var(--color-status-bg-verifying)",stopped:"var(--color-status-bg-pending)",error:"var(--color-status-bg-blocked)"};function $s({entry:e}){const t=Ps[e.status]??"var(--color-text-tertiary)",o=Vs[e.status]??"var(--color-bg-secondary)";return s.jsxs("div",{className:"flex items-center justify-center gap-[var(--spacing-2)] py-[var(--spacing-1-5)]",children:[s.jsx("span",{className:"flex-1 max-w-[80px] h-[1px]",style:{backgroundColor:"var(--color-border-divider)"}}),s.jsxs("span",{className:"inline-flex items-center gap-[5px] rounded-[var(--radius-full)] px-[10px] py-[2px] text-[10px] font-semibold",style:{backgroundColor:o,color:t},children:[s.jsx(bn,{size:10,strokeWidth:2}),e.status,e.reason&&s.jsxs("span",{className:"text-text-tertiary",children:["-- ",e.reason]})]}),s.jsx("span",{className:"flex-1 max-w-[80px] h-[1px]",style:{backgroundColor:"var(--color-border-divider)"}})]})}function Ho(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Gs({entry:e}){const t=e.inputTokens+e.outputTokens,n=Math.min(100,Math.round(t/2e5*100));return s.jsxs("div",{className:"flex items-center gap-[10px] px-3 py-[6px] rounded-[8px] border",style:{backgroundColor:"var(--color-bg-primary)",borderColor:"var(--color-border-divider)"},children:[s.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--color-text-tertiary)"},children:"Tokens"}),s.jsx("span",{className:"text-[11px] font-mono font-medium",style:{color:"var(--color-text-secondary)"},children:Ho(t)}),s.jsx("div",{className:"flex-1 max-w-[60px] h-1 rounded-[2px] overflow-hidden",style:{backgroundColor:"var(--color-bg-tertiary)"},children:s.jsx("div",{className:"h-full rounded-[2px]",style:{width:`${n}%`,backgroundColor:"var(--color-accent-orange)"}})}),s.jsx("span",{className:"w-px h-3",style:{backgroundColor:"var(--color-border-divider)"}}),e.cacheReadTokens!=null&&e.cacheReadTokens>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--color-text-tertiary)"},children:"Cache"}),s.jsx("span",{className:"text-[11px] font-mono font-medium",style:{color:"var(--color-text-secondary)"},children:Ho(e.cacheReadTokens)})]}),"cost"in e&&typeof e.cost=="number"&&s.jsxs("span",{className:"text-[10px] ml-auto",style:{color:"var(--color-text-tertiary)"},children:["$",e.cost.toFixed(3)]})]})}function Us({entry:e,isGroupContinuation:t}){switch(e.type){case"user_message":return s.jsx(zs,{entry:e});case"assistant_message":return s.jsx(Hs,{entry:e,isGroupContinuation:t});case"thinking":return s.jsx(Bs,{entry:e});case"tool_use":return s.jsx(Ls,{entry:e});case"file_change":return s.jsx(As,{entry:e});case"command_exec":return s.jsx(_s,{entry:e});case"approval_request":return s.jsx(Ds,{entry:e});case"approval_response":return s.jsx(Ws,{entry:e});case"error":return s.jsx(Fs,{entry:e});case"status_change":return s.jsx($s,{entry:e});case"token_usage":return s.jsx(Gs,{entry:e});default:return null}}const Ks=new Set(["assistant_message","error","command_exec","tool_use"]);function Ys(e){const t={source_entry_id:e.id,source_process_id:e.processId};switch(e.type){case"assistant_message":return{...t,title:"Issue from assistant message",description:e.content.slice(0,2e3)};case"error":return{...t,title:`Error: ${e.message.slice(0,100)}`,description:e.message+(e.code?`
63
- Code: ${e.code}`:""),type:"bug",priority:"high"};case"command_exec":return{...t,title:`Issue from command: ${e.command.slice(0,80)}`,description:[`Command: ${e.command}`,e.exitCode!==void 0?`Exit code: ${e.exitCode}`:"",e.output?`Output:
64
- ${e.output.slice(0,1500)}`:""].filter(Boolean).join(`
65
- `),type:e.exitCode!==0?"bug":"task"};case"tool_use":return{...t,title:`Issue from tool: ${e.name}`,description:[`Tool: ${e.name}`,`Status: ${e.status}`,`Input: ${JSON.stringify(e.input,null,2).slice(0,500)}`,e.result?`Result: ${e.result.slice(0,1e3)}`:""].filter(Boolean).join(`
66
- `),type:e.status==="failed"?"bug":"task"};default:return t}}function Xs({entry:e,children:t,onCreateIssue:o}){const[n,r]=N.useState(null),l=N.useRef(null),i=Ks.has(e.type),c=N.useCallback(u=>{i&&(u.preventDefault(),r({x:u.clientX,y:u.clientY}))},[i]);N.useEffect(()=>{if(!n)return;function u(){r(null)}function h(v){v.key==="Escape"&&r(null)}return document.addEventListener("click",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("click",u),document.removeEventListener("keydown",h)}},[n]);const a=N.useCallback(()=>{r(null),o(Ys(e))},[e,o]);return s.jsxs("div",{onContextMenu:c,className:"relative",children:[t,n&&s.jsx("div",{ref:l,className:Le("fixed z-[100] min-w-[160px] rounded-[var(--radius-default)]","border border-border bg-bg-primary shadow-lg","py-[var(--spacing-1)]","animate-in fade-in-0 zoom-in-95"),style:{left:n.x,top:n.y},role:"menu",children:s.jsxs("button",{type:"button",role:"menuitem",onClick:a,className:Le("flex items-center gap-[var(--spacing-2)] w-full px-[var(--spacing-3)] py-[var(--spacing-1-5)]","text-left text-[length:var(--font-size-sm)] text-text-secondary","hover:bg-bg-hover hover:text-text-primary","transition-colors duration-[var(--duration-fast)]"),children:[s.jsxs("svg",{className:"w-4 h-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),s.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),"Create Issue"]})})]})}const Qs=[{value:"bug",label:"Bug"},{value:"feature",label:"Feature"},{value:"improvement",label:"Improvement"},{value:"task",label:"Task"}],qs=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}],vt=Le("w-full px-[var(--spacing-3)] py-[var(--spacing-2)]","rounded-[var(--radius-default)] border border-border","bg-bg-secondary text-text-primary","text-[length:var(--font-size-sm)]","focus:outline-none focus:shadow-[var(--shadow-focus-ring)]","transition-shadow duration-[var(--duration-fast)]"),bt="block text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)] text-text-secondary mb-[var(--spacing-1)]";function Zs({open:e,onOpenChange:t,prefill:o}){const n=yn(b=>b.createIssue),[r,l]=N.useState(""),[i,c]=N.useState(""),[a,u]=N.useState("task"),[h,v]=N.useState("medium"),[x,f]=N.useState(!1);N.useEffect(()=>{e&&o&&(l(o.title??""),c(o.description??""),u(o.type??"task"),v(o.priority??"medium")),e||(l(""),c(""),u("task"),v("medium"))},[e,o]);const w=N.useCallback(async()=>{if(!r.trim())return;f(!0);const b={title:r.trim(),description:i,type:a,priority:h};o!=null&&o.source_entry_id&&(b.source_entry_id=o.source_entry_id),o!=null&&o.source_process_id&&(b.source_process_id=o.source_process_id),await n(b),f(!1),t(!1)},[r,i,a,h,o,n,t]);return s.jsx(wn,{open:e,onOpenChange:t,children:s.jsxs(Cn,{children:[s.jsx(kn,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),s.jsxs(Tn,{className:Le("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[560px] max-w-[95vw] max-h-[85vh]","rounded-[var(--radius-lg)] border border-border bg-bg-primary shadow-lg","flex flex-col overflow-hidden","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[s.jsxs("div",{className:"flex items-center justify-between px-[var(--spacing-6)] py-[var(--spacing-4)] border-b border-border shrink-0",children:[s.jsx(In,{className:"text-[length:var(--font-size-lg)] font-[var(--font-weight-semibold)] text-text-primary",children:"Create Issue"}),s.jsx(uo,{className:Le("w-8 h-8 flex items-center justify-center rounded-[var(--radius-sm)]","text-text-secondary hover:text-text-primary hover:bg-bg-hover","transition-colors duration-[var(--duration-fast)]","focus-visible:outline-none focus-visible:shadow-[var(--shadow-focus-ring)]"),"aria-label":"Close",children:s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-6)] space-y-[var(--spacing-4)]",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"issue-title",className:bt,children:"Title"}),s.jsx("input",{id:"issue-title",type:"text",value:r,onChange:b=>l(b.target.value),placeholder:"Brief summary of the issue",className:vt,autoFocus:!0})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"issue-desc",className:bt,children:"Description"}),s.jsx("textarea",{id:"issue-desc",value:i,onChange:b=>c(b.target.value),placeholder:"Detailed description...",rows:6,className:Le(vt,"resize-y min-h-[120px]")})]}),s.jsxs("div",{className:"flex gap-[var(--spacing-4)]",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{htmlFor:"issue-type",className:bt,children:"Type"}),s.jsx("select",{id:"issue-type",value:a,onChange:b=>u(b.target.value),className:vt,children:Qs.map(b=>s.jsx("option",{value:b.value,children:b.label},b.value))})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{htmlFor:"issue-priority",className:bt,children:"Priority"}),s.jsx("select",{id:"issue-priority",value:h,onChange:b=>v(b.target.value),className:vt,children:qs.map(b=>s.jsx("option",{value:b.value,children:b.label},b.value))})]})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-[var(--spacing-3)] px-[var(--spacing-6)] py-[var(--spacing-4)] border-t border-border shrink-0",children:[s.jsx(uo,{className:Le("px-[var(--spacing-4)] py-[var(--spacing-2)]","rounded-[var(--radius-default)]","text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)]","text-text-secondary hover:text-text-primary hover:bg-bg-hover","transition-colors duration-[var(--duration-fast)]"),children:"Cancel"}),s.jsx("button",{type:"button",disabled:!r.trim()||x,onClick:w,className:Le("px-[var(--spacing-4)] py-[var(--spacing-2)]","rounded-[var(--radius-default)]","text-[length:var(--font-size-sm)] font-[var(--font-weight-medium)]","bg-[var(--color-accent-blue)] text-white","hover:opacity-90","disabled:opacity-50 disabled:cursor-not-allowed","transition-opacity duration-[var(--duration-fast)]"),children:x?"Creating...":"Create Issue"})]})]})]})})}const Bo=[];function Js({agentType:e}){const t=Qe[e??"claude-code"]??Qe["claude-code"];return s.jsx("div",{className:"max-w-[780px] mx-auto px-6",children:s.jsxs("div",{className:"flex gap-[10px]",style:{paddingTop:10,paddingBottom:10},children:[s.jsxs("div",{className:"relative shrink-0 w-7 h-7 rounded-[8px] flex items-center justify-center mt-[2px] text-[11px] font-bold text-white",style:{backgroundColor:t.color},children:[t.label,s.jsx("span",{className:"absolute inset-[-3px] rounded-[10px] pointer-events-none",style:{border:"1.5px solid currentColor",color:t.color,opacity:.3,animation:"avatar-pulse 2.5s ease-in-out infinite"}})]}),s.jsxs("div",{className:"flex items-center gap-[3px] pt-[6px]",children:[s.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:t.color,animationDelay:"0ms",opacity:.7}}),s.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:t.color,animationDelay:"150ms",opacity:.7}}),s.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:t.color,animationDelay:"300ms",opacity:.7}})]})]})})}function yl({processId:e}){const t=Pe(p=>e?p.entries[e]??Bo:Bo),o=Pe(p=>e?p.processes[e]:void 0),{virtuosoRef:n,handleScroll:r,handleFollowOutput:l,handleAtBottomStateChange:i,showScrollButton:c,scrollToBottom:a}=ns({entries:t,itemCount:t.length}),[u,h]=N.useState(!1),[v,x]=N.useState(),f=N.useCallback(p=>{x(p),h(!0)},[]),w=o==null?void 0:o.status,g=!((e==null?void 0:e.startsWith("cli-history-"))??!1)&&(w==="running"||w==="spawning"),m=N.useMemo(()=>{if(!g||t.length===0)return!1;const p=t[t.length-1];return!(p.type==="assistant_message"&&p.partial)},[g,t]);if(!e)return s.jsx("div",{className:"flex-1 flex items-center justify-center text-text-tertiary text-[length:var(--font-size-sm)]",children:"Select a session or start a new conversation"});if(t.length===0){if(g){const p=Qe[(o==null?void 0:o.type)??"claude-code"]??Qe["claude-code"];return s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsxs("div",{className:"relative w-9 h-9 rounded-[10px] flex items-center justify-center text-[13px] font-bold text-white",style:{backgroundColor:p.color},children:[p.label,s.jsx("span",{className:"absolute inset-[-3px] rounded-[12px] pointer-events-none",style:{border:"1.5px solid currentColor",color:p.color,opacity:.3,animation:"avatar-pulse 2.5s ease-in-out infinite"}})]}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:p.color,animationDelay:"0ms",opacity:.7}}),s.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:p.color,animationDelay:"150ms",opacity:.7}}),s.jsx("span",{className:"w-[5px] h-[5px] rounded-full animate-bounce",style:{backgroundColor:p.color,animationDelay:"300ms",opacity:.7}})]}),s.jsx("span",{className:"text-[12px]",style:{color:"var(--color-text-tertiary)"},children:w==="spawning"?"Starting agent...":"Thinking..."})]})})}return s.jsx("div",{className:"flex-1 flex items-center justify-center text-text-tertiary text-[length:var(--font-size-sm)]",children:"No messages yet"})}return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex-1 relative",style:{minHeight:0},children:[s.jsx(Wr,{ref:n,data:t,followOutput:l,atBottomStateChange:i,onScroll:r,atBottomThreshold:60,className:"h-full",style:{height:"100%"},components:m?{Footer:()=>s.jsx(Js,{agentType:o==null?void 0:o.type})}:{},itemContent:(p,k)=>{let E=!1;if(k.type==="assistant_message"&&p>0)for(let j=p-1;j>=0;j--){const O=t[j];if(O.type==="assistant_message"){E=!0;break}if(O.type==="user_message")break}return s.jsx("div",{className:"max-w-[780px] mx-auto px-6",children:s.jsx(Xs,{entry:k,onCreateIssue:f,children:s.jsx(Us,{entry:k,isGroupContinuation:E})})})}}),c&&s.jsx("button",{type:"button",onClick:()=>a("smooth"),style:{position:"absolute",bottom:"16px",right:"16px",width:"36px",height:"36px",borderRadius:"50%",border:"1px solid var(--color-border)",background:"var(--color-bg-secondary)",color:"var(--color-text-secondary)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",transition:"opacity 150ms ease",zIndex:10},"aria-label":"Scroll to bottom",children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M8 3v10M4 9l4 4 4-4"})})})]}),s.jsx(Zs,{open:u,onOpenChange:h,prefill:v})]})}const el=()=>{const e=N.useRef(!1);return{isComposing:e,compositionHandlers:{onCompositionStartCapture:()=>{e.current=!0},onCompositionEndCapture:()=>{e.current=!1}},createKeyDownHandler:(n,r)=>l=>{e.current||r!=null&&r(l)||l.key==="Enter"&&!l.shiftKey&&(l.preventDefault(),n())}}},tl=/^\/([a-zA-Z0-9_-]*)$/;function ol(e){const t=e.match(tl);return t?t[1]:null}function nl(e){const{input:t,commands:o,onSelect:n}=e,r=N.useMemo(()=>ol(t),[t]),[l,i]=N.useState(0),[c,a]=N.useState(!1);N.useEffect(()=>{i(0),a(!1)},[r]);const u=N.useMemo(()=>{if(r===null)return[];const f=r.trim().toLowerCase();return f?o.filter(w=>w.name.toLowerCase().startsWith("/"+f)||w.name.toLowerCase().startsWith(f)):o},[o,r]),h=r!==null&&!c&&u.length>0,v=N.useCallback(f=>{const w=u[f];return w?(n(w.name),a(!0),!0):!1},[u,n]),x=N.useCallback(f=>h?f.key==="Escape"?(f.preventDefault(),a(!0),!0):f.key==="ArrowDown"?(f.preventDefault(),i(w=>(w+1)%u.length),!0):f.key==="ArrowUp"?(f.preventDefault(),i(w=>(w-1+u.length)%u.length),!0):f.key==="Enter"&&!f.shiftKey?(f.preventDefault(),v(l)):!1:!1,[l,v,u.length,h]);return{isOpen:h,activeIndex:l,filteredCommands:u,onKeyDown:x,onSelectByIndex:v,setDismissed:a,setActiveIndex:i}}const rl=30,sl=800;function ll(e,t){const[o,n]=N.useState(!1),r=N.useRef(null),l=N.useRef(!1);return N.useEffect(()=>{if(e.includes(`
67
- `)){l.current=!0,n(!0);return}if(e.length>=sl){l.current=!0,n(!0);return}if(!e){l.current=!1,n(!1);return}const i=t.current;if(!i)return;const c=requestAnimationFrame(()=>{r.current||(r.current=document.createElement("canvas"));const a=r.current.getContext("2d");if(!a)return;const u=i.querySelector("textarea");if(!u)return;const h=getComputedStyle(u);a.font=`${h.fontWeight} ${h.fontSize} ${h.fontFamily}`;const v=a.measureText(e).width,x=parseFloat(h.paddingLeft)||0,f=parseFloat(h.paddingRight)||0,w=u.clientWidth-x-f,b=l.current;let g;b?g=v>w-rl:g=v>w,l.current=g,n(g)});return()=>cancelAnimationFrame(c)},[e,t]),{isMultiline:o}}const il=2e5;function At(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function al(e){return e>=80?"var(--color-accent-red)":e>=50?"var(--color-accent-orange)":"var(--color-accent-green)"}function cl({processId:e,contextWindow:t=il,size:o=24}){const n=Pe(x=>e?x.processTokenUsage[e]??null:null),[r,l]=N.useState(!1),{percentage:i,ringColor:c,strokeDashoffset:a,circumference:u}=N.useMemo(()=>{const x=n??{input:0,output:0},f=x.input+x.output,w=Math.min(f/t*100,100),g=(o-2.5)/2,m=2*Math.PI*g;return{percentage:w,ringColor:al(w),strokeDashoffset:m-w/100*m,circumference:m}},[n,t,o]);if(!n)return null;const h=2.5,v=(o-h)/2;return s.jsxs("div",{className:"relative flex items-center justify-center cursor-default",style:{width:o,height:o},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[s.jsxs("svg",{width:o,height:o,viewBox:`0 0 ${o} ${o}`,style:{transform:"rotate(-90deg)"},children:[s.jsx("circle",{cx:o/2,cy:o/2,r:v,fill:"none",stroke:"var(--color-border-divider)",strokeWidth:h}),s.jsx("circle",{cx:o/2,cy:o/2,r:v,fill:"none",stroke:c,strokeWidth:h,strokeLinecap:"round",strokeDasharray:u,strokeDashoffset:a,style:{transition:"stroke-dashoffset 0.3s ease, stroke 0.3s ease"}})]}),r&&s.jsxs("div",{className:"absolute bottom-[calc(100%+8px)] left-1/2 -translate-x-1/2 px-[10px] py-[6px] rounded-[8px] text-[11px] font-medium whitespace-nowrap z-50 pointer-events-none",style:{backgroundColor:"var(--color-text-primary)",color:"#fff",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:[s.jsxs("div",{style:{marginBottom:2},children:[i.toFixed(1),"% context used"]}),s.jsxs("div",{className:"flex flex-col gap-[2px] text-[10px]",style:{opacity:.85},children:[s.jsxs("span",{children:["Input: ",At(n.input)]}),s.jsxs("span",{children:["Output: ",At(n.output)]}),(n.cacheRead>0||n.cacheWrite>0)&&s.jsxs("span",{children:["Cache: ",At(n.cacheRead+n.cacheWrite)]})]})]})]})}const ul=["claude-code","codex","gemini","qwen","opencode","agent-sdk"],dl=[{name:"/maestro-plan",desc:"Create detailed phase plan",color:"var(--color-accent-purple)",bg:"var(--color-tint-planning)"},{name:"/quality-review",desc:"Tiered code review",color:"var(--color-accent-green)",bg:"var(--color-tint-completed)"},{name:"/maestro-execute",desc:"Execute phase with parallelization",color:"var(--color-accent-orange)",bg:"var(--color-tint-verifying)"},{name:"/quality-debug",desc:"Parallel hypothesis debugging",color:"var(--color-accent-blue)",bg:"var(--color-tint-exploring)"}],pl=new Set(["claude-code"]);function wl({processId:e,executor:t}={}){const[o,n]=N.useState(""),[r,l]=N.useState("claude-code"),[i,c]=N.useState("inject"),a=N.useRef(null),u=N.useRef(null),h=N.useRef(null),v=N.useRef(null),{isMultiline:x}=ll(o,u),f=Pe(I=>I.activeProcessId),w=Pe(I=>I.processes),b=e!==void 0?e:f,g=b?w[b]??null:null,m=!!(b&&b.startsWith("cli-history-")&&(g==null?void 0:g.interactive)===!0),p=g!=null?g.interactive===!1:t!=null&&!pl.has(t),k=e!==void 0&&!b||!m&&p,{compositionHandlers:E,createKeyDownHandler:j}=el(),O=N.useCallback(I=>{var _;n(I+" "),(_=a.current)==null||_.focus()},[]),d=nl({input:o,commands:dl,onSelect:O}),y=N.useCallback(()=>{const I=o.trim();I&&(b&&g?m?yt({action:"delegate:message",processId:b,content:I,delivery:i}):yt({action:"message",processId:b,content:I}):e===void 0&&yt({action:"spawn",config:{type:r,prompt:I,workDir:"."}}),n(""),d.setDismissed(!0),a.current&&(a.current.style.height="auto"))},[o,b,g,r,e,d,m,i]),S=j(y,d.onKeyDown),B=N.useCallback(()=>{const I=a.current;I&&(I.style.height="auto",I.style.height=`${Math.min(I.scrollHeight,200)}px`)},[]),H=N.useCallback(I=>{n(I.target.value)},[]),P=N.useCallback(I=>{var J,fe;const _=(J=I.target.files)==null?void 0:J[0];_&&(n(ie=>ie+(ie?" ":"")+`@${_.name}`),(fe=a.current)==null||fe.focus()),I.target.value=""},[]),V=N.useCallback(I=>{var J,fe;const _=(J=I.target.files)==null?void 0:J[0];_&&(n(ie=>ie+(ie?" ":"")+`@${_.name}`),(fe=a.current)==null||fe.focus()),I.target.value=""},[]),A=!b&&e===void 0,U=(g==null?void 0:g.type)??r;return s.jsxs("div",{className:"shrink-0 px-6 pb-[14px] pt-2",style:{backgroundColor:"var(--color-bg-primary)"},children:[s.jsx("input",{ref:h,type:"file",className:"hidden",onChange:P}),s.jsx("input",{ref:v,type:"file",accept:"image/*",className:"hidden",onChange:V}),s.jsxs("div",{className:"max-w-[780px] mx-auto relative",children:[d.isOpen&&s.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-[6px] border rounded-[12px] p-[6px] max-h-[240px] overflow-y-auto z-50",style:{backgroundColor:"var(--color-bg-card)",borderColor:"var(--color-border)",boxShadow:"0 -4px 20px rgba(0,0,0,0.06)",backdropFilter:"blur(12px)"},children:d.filteredCommands.map((I,_)=>s.jsxs("button",{type:"button",onClick:()=>d.onSelectByIndex(_),onMouseEnter:()=>d.setActiveIndex(_),className:"flex items-center gap-[10px] w-full px-[10px] py-[7px] rounded-[8px] cursor-pointer transition-colors duration-100 text-left border-none",style:{backgroundColor:_===d.activeIndex?"var(--color-bg-hover)":"transparent"},children:[s.jsx("span",{className:"w-7 h-7 rounded-[6px] flex items-center justify-center shrink-0",style:{backgroundColor:I.bg},children:s.jsx(Dt,{size:14,strokeWidth:1.8,stroke:I.color})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[12px] font-semibold text-text-primary",children:I.name}),s.jsx("div",{className:"text-[11px]",style:{color:"var(--color-text-tertiary)"},children:I.desc})]})]},I.name))}),s.jsxs("div",{ref:u,className:"border transition-[border-color,box-shadow]",style:{borderColor:"var(--color-border)",backgroundColor:"var(--color-bg-card)",borderRadius:"var(--style-composer-radius)",boxShadow:"var(--style-card-shadow)",transitionDuration:"var(--duration-normal)"},onFocusCapture:I=>{const _=I.currentTarget;_.style.borderColor="var(--color-accent-orange)",_.style.boxShadow="0 2px 12px rgba(0,0,0,0.06), 0 0 0 3px rgba(200, 134, 58, 0.08)"},onBlurCapture:I=>{if(!I.relatedTarget||!(I.relatedTarget instanceof Node)||!I.currentTarget.contains(I.relatedTarget)){const _=I.currentTarget;_.style.borderColor="var(--color-border)",_.style.boxShadow="0 2px 12px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.02)"}},children:[s.jsx("textarea",{ref:a,value:o,onChange:H,onInput:B,onKeyDown:S,...E,disabled:k,placeholder:m?"Queue a follow-up for this async delegate...":b?"Send a message...":"Send a message, / for commands...",rows:x?3:1,className:`w-full resize-none border-none leading-[1.5] bg-transparent outline-none disabled:opacity-40 disabled:cursor-not-allowed ${x?"min-h-[72px] max-h-[200px]":"min-h-[42px] max-h-[42px]"}`,style:{color:"var(--color-text-primary)",fontSize:"var(--style-composer-textarea-size)",padding:"var(--style-composer-padding)"}}),s.jsxs("div",{className:"flex items-center gap-[2px] px-[6px] py-1",style:{},children:[s.jsx(_t,{tooltip:"File",icon:s.jsx(vs,{size:15,strokeWidth:1.8}),onClick:()=>{var I;return(I=h.current)==null?void 0:I.click()}}),s.jsx(_t,{tooltip:"Image",icon:s.jsx(fs,{size:15,strokeWidth:1.8}),onClick:()=>{var I;return(I=v.current)==null?void 0:I.click()}}),s.jsx(_t,{tooltip:"Skills",icon:s.jsx(Dt,{size:15,strokeWidth:1.8}),onClick:()=>{var I;d.isOpen?d.setDismissed(!0):(n("/"),(I=a.current)==null||I.focus())}}),s.jsx("div",{className:"w-px h-[18px] mx-1",style:{backgroundColor:"var(--color-border-divider)"}}),s.jsx(cl,{processId:b}),m&&s.jsxs("div",{className:"flex items-center gap-[5px] px-[10px] py-[3px] text-[11px] font-medium",style:{border:"var(--style-btn-secondary-border)",backgroundColor:"var(--style-btn-secondary-bg)",borderRadius:"var(--style-btn-secondary-radius)",color:"var(--color-text-secondary)"},children:[s.jsx("span",{style:{color:"var(--color-text-tertiary)"},children:"Delivery"}),s.jsxs("select",{value:i,onChange:I=>c(I.target.value),className:"border-none bg-transparent cursor-pointer outline-none appearance-none text-[11px] font-medium",style:{color:"inherit"},children:[s.jsx("option",{value:"inject",children:"Inject"}),s.jsx("option",{value:"after_complete",children:"After Complete"})]})]}),s.jsxs("div",{className:"flex items-center gap-[5px] ml-auto px-[10px] py-[3px] cursor-pointer text-[11px] font-medium transition-colors duration-150",style:{border:"var(--style-btn-secondary-border)",backgroundColor:"var(--style-btn-secondary-bg)",borderRadius:"var(--style-btn-secondary-radius)",color:"var(--color-text-secondary)"},children:[s.jsx("span",{className:"w-[7px] h-[7px] rounded-full shrink-0",style:{backgroundColor:Sn[A?r:U]}}),A?s.jsx("select",{value:r,onChange:I=>l(I.target.value),className:"border-none bg-transparent cursor-pointer outline-none appearance-none text-[11px] font-medium",style:{color:"inherit"},children:ul.map(I=>s.jsx("option",{value:I,children:zt[I]},I))}):s.jsx("span",{children:zt[U]??U})]}),s.jsx("button",{type:"button",onClick:y,disabled:!o.trim()||k,className:"shrink-0 w-[34px] h-[30px] rounded-[8px] flex items-center justify-center transition-all duration-150 disabled:opacity-40 disabled:cursor-not-allowed hover:opacity-90 ml-1 border-none cursor-pointer",style:{backgroundColor:"var(--style-send-btn-bg)",color:"var(--style-send-btn-color)"},"aria-label":"Send message",children:s.jsx(ys,{size:15,strokeWidth:2})})]})]}),s.jsxs("div",{className:"flex gap-3 mt-[5px] px-[6px] text-[10px]",style:{color:"var(--color-text-placeholder)"},children:[s.jsxs("span",{children:[s.jsx("kbd",{className:"font-mono text-[10px] px-1 border rounded-[3px]",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-secondary)"},children:"Enter"})," ",m?"queue":"send"]}),s.jsxs("span",{children:[s.jsx("kbd",{className:"font-mono text-[10px] px-1 border rounded-[3px]",style:{borderColor:"var(--color-border-divider)",backgroundColor:"var(--color-bg-secondary)"},children:"/"})," skills"]}),s.jsxs("span",{className:"ml-auto",children:[zt[A?r:U]," · ",m?i==="after_complete"?"after complete":"inject":"opus-4.6"]})]})]})]})}function _t({tooltip:e,icon:t,onClick:o}){return s.jsxs("button",{type:"button",onClick:o,className:"group relative w-[30px] h-[30px] rounded-[8px] border-none bg-transparent flex items-center justify-center cursor-pointer transition-all duration-150",style:{color:"var(--color-text-tertiary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--style-icon-btn-hover-bg)",n.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="transparent",n.currentTarget.style.color="var(--color-text-tertiary)"},children:[t,s.jsx("span",{className:"absolute bottom-[calc(100%+6px)] left-1/2 -translate-x-1/2 px-[7px] py-[2px] rounded-[5px] text-[10px] font-medium text-white whitespace-nowrap opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity duration-[120ms]",style:{backgroundColor:"var(--color-text-primary)"},children:e})]})}export{wl as C,bl as L,yl as M};
@@ -1,8 +0,0 @@
1
- import{d as ae,r as c,j as e,k as M,s as W,q as re,t as oe,v as se,X as B,F as ce,w as q,m as ie,M as de}from"./index-nufWop4p.js";import{S as ue}from"./search-Bq3ygFUW.js";import{G as pe}from"./git-branch-SqFf4Ru5.js";import{Z as xe}from"./zap-9DVkGVtt.js";import{M as H,C as A,L as fe}from"./ChatInput-CL8YDfOU.js";import{T as ge,a as ye}from"./TreeBrowser-g_QUKemL.js";import"./MarkdownRenderer-BjZ43aSa.js";import"./wrench-B84-zdLI.js";import"./chevron-right-CYbpR4ev.js";import"./circle-alert-BqcYuT7x.js";import"./folder-CqXeSKeC.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 he=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ve=ae("columns-2",he),L=(t,r)=>(window.addEventListener(t,r),()=>window.removeEventListener(t,r)),me=(...t)=>()=>{const r=t.slice();for(;r.length;)r.pop()()};function be(t,r,o,n){if(!t)return r;try{const s=localStorage.getItem(t);if(s){const a=parseFloat(s);if(!isNaN(a)&&a>=o&&a<=n)return a}}catch{}return r}function je(t={}){const{defaultRatio:r=50,minRatio:o=25,maxRatio:n=75,storageKey:s}=t,[a,d]=c.useState(()=>be(s,r,o,n)),f=c.useCallback(u=>{if(d(u),s)try{localStorage.setItem(s,u.toString())}catch{}},[s]),l=c.useCallback((u=!1)=>i=>{if(i.pointerType!=="touch"&&i.button!==0)return;i.preventDefault();const v=i.currentTarget,N=v.parentElement,w=N==null?void 0:N.parentElement,T=(w==null?void 0:w.offsetWidth)||0;if(!T)return;const b=i.clientX,j=a,k=i.pointerId;let h=null,C=null,E=j,S=!0,I=null;const D=()=>{C!==null&&(E=C,d(C))},z=()=>{const y=document.body.style.userSelect;return document.body.style.userSelect="none",document.body.style.cursor="col-resize",()=>{document.body.style.userSelect=y,document.body.style.cursor="",h!==null&&(cancelAnimationFrame(h),h=null)}},R=y=>{if(!S)return;S=!1,h!==null&&(cancelAnimationFrame(h),h=null),D();let P=E;if(y&&"clientX"in y&&typeof y.clientX=="number"){const le=(u?b-y.clientX:y.clientX-b)/T*100;P=Math.max(o,Math.min(n,j+le))}f(P),I==null||I()},X=y=>{if(!S)return;if(y.buttons===0){R(y);return}const U=(u?b-y.clientX:y.clientX-b)/T*100;C=Math.max(o,Math.min(n,j+U)),h===null&&(h=requestAnimationFrame(()=>{h=null,D()}))},$=()=>R(),F=y=>R(y),O=y=>R(y),g=y=>R(y);if(v.setPointerCapture)try{v.setPointerCapture(k),v.addEventListener("lostpointercapture",$)}catch{}const p=()=>{var y;v.releasePointerCapture&&((y=v.hasPointerCapture)!=null&&y.call(v,k))&&v.releasePointerCapture(k),v.removeEventListener("lostpointercapture",$)};I=me(z(),p,L("pointermove",X),L("pointerup",F),L("pointercancel",O),L("mouseup",g),L("blur",()=>R()))},[a,o,n,f]),x=c.useCallback((u={})=>{const{className:i="",style:v,reverse:N,linePlacement:w,lineClassName:T="",lineStyle:b}=u,j=w?w==="start"?"justify-start":"justify-end":N?"justify-start":"justify-end";return e.jsx("div",{className:`group absolute top-0 bottom-0 z-20 cursor-col-resize flex items-center ${j} ${i}`,style:{width:"12px",...v},onPointerDown:l(N),onDoubleClick:()=>f(r),children:e.jsx("span",{className:`pointer-events-none block h-full rounded-full transition-all duration-150 w-[2px] opacity-60 group-hover:w-[5px] group-hover:opacity-100 group-active:w-[5px] group-active:opacity-100 ${T}`,style:{backgroundColor:"var(--color-border)",...b}})})},[l,f,r]),m=x({className:"right-0"});return{ratio:a,setRatio:f,dragHandle:m,createDragHandle:x}}function ke(t){const r=M(n=>n.pendingApprovals),o=c.useMemo(()=>t?Object.values(r).find(n=>n.processId===t)??null:null,[t,r]);c.useEffect(()=>{if(!o)return;function n(s){const a=s.target;if(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable)return;const d=s.key;if(d==="y"||d==="Y"){s.preventDefault(),W({action:"approve",processId:o.processId,requestId:o.id,allow:!0});return}if(d==="Escape"){s.preventDefault(),W({action:"approve",processId:o.processId,requestId:o.id,allow:!1});return}if(d==="a"||d==="A"){s.preventDefault(),W({action:"approve",processId:o.processId,requestId:o.id,allow:!0});return}}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[o])}function we(){const[t,r]=c.useState([]),[o,n]=c.useState(!0),s=c.useCallback(async()=>{n(!0);try{const a=await fetch("/api/workspace?tree=true");a.ok&&r(await a.json())}catch{}finally{n(!1)}},[]);return c.useEffect(()=>{s()},[s]),{tree:t,loading:o,refreshTree:s}}function Y(t){if(t<60)return`${t}s`;const r=Math.floor(t/60),o=t%60;return`${r}m ${o}s`}function G({processId:t}){const r=M(l=>t?l.processThoughts[t]:void 0),o=M(l=>t?l.processStreaming[t]??!1:!1),[n,s]=c.useState(0),a=c.useRef(Date.now());if(c.useEffect(()=>{if(!o&&!(r!=null&&r.subject)){s(0);return}a.current=Date.now(),s(0);const l=setInterval(()=>{s(Math.floor((Date.now()-a.current)/1e3))},1e3);return()=>clearInterval(l)},[o,r==null?void 0:r.subject]),!o&&!(r!=null&&r.subject))return null;const d=()=>{t&&W({action:"stop",processId:t})};if(o&&!(r!=null&&r.subject))return e.jsx("div",{style:K,children:e.jsxs("div",{style:V,children:[e.jsx(Q,{}),e.jsxs("span",{style:{color:"var(--color-text-secondary)",fontSize:12},children:["Processing...",e.jsxs("span",{style:{marginLeft:6,opacity:.6},children:["(",Y(n),")"]})]}),e.jsx(Z,{onClick:d})]})});const f=r&&r.description&&r.description!==r.subject;return e.jsx("div",{style:K,children:e.jsxs("div",{style:V,children:[o&&e.jsx(Q,{}),(r==null?void 0:r.subject)&&e.jsx("span",{style:Ce,children:r.subject}),f&&e.jsx("span",{style:{flex:1,fontSize:12,color:"var(--color-text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.description}),o&&e.jsxs("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",whiteSpace:"nowrap"},children:["(",Y(n),")"]}),o&&e.jsx(Z,{onClick:d})]})})}const K={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)"},V={display:"flex",alignItems:"center",gap:8},Ce={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 Q(){return e.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:[e.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"}),e.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]})}function Z({onClick:t}){return e.jsx("button",{type:"button",onClick:t,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:r=>{const o=r.currentTarget;o.style.borderColor="var(--color-accent-red)",o.style.backgroundColor="var(--color-tint-blocked)",o.style.color="var(--color-accent-red)"},onMouseLeave:r=>{const o=r.currentTarget;o.style.borderColor="var(--color-border)",o.style.backgroundColor="var(--color-bg-card)",o.style.color="var(--color-text-tertiary)"},"aria-label":"Stop process",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})})}function Se(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function Ne(t){try{return new Date(t).toLocaleDateString([],{month:"short",day:"numeric"})}catch{return""}}function J(t){return t.asyncDelegate===!0}function Te(t,r){const o=[];for(const n of r)n.status!=="dispatched"&&(o.push({id:`${n.messageId}:user`,processId:t,timestamp:n.createdAt,type:"user_message",content:n.message}),n.status==="dropped"&&o.push({id:`${n.messageId}:error`,processId:t,timestamp:n.dispatchedAt??n.createdAt,type:"error",message:n.dispatchReason?`Follow-up dropped: ${n.dispatchReason}`:"Follow-up dropped"}));return o}function Me(t){return t.delegateStatus==="cancelling"?{label:"Cancelling",bg:"var(--color-tint-planning)",fg:"var(--color-accent-orange)"}:t.cancelledAt||t.delegateStatus==="cancelled"?{label:"Cancelled",bg:"var(--color-bg-hover)",fg:"var(--color-text-secondary)"}:t.exitCode!==void 0?{label:t.exitCode===0?"OK":`Exit ${t.exitCode}`,bg:t.exitCode===0?"var(--color-tint-exploring)":"var(--color-tint-blocked)",fg:t.exitCode===0?"var(--color-accent-green)":"var(--color-accent-red)"}:t.delegateStatus?{label:t.delegateStatus,bg:"var(--color-tint-exploring)",fg:"var(--color-accent-blue)"}:null}function Ie({open:t}){const[r,o]=c.useState([]),[n,s]=c.useState("async"),a=M(l=>l.processes);c.useEffect(()=>{t&&fetch("/api/cli-history?limit=20").then(l=>l.ok?l.json():[]).then(l=>o(l)).catch(()=>{})},[t]);const d=c.useMemo(()=>new Set(Object.keys(a)),[a]),f=c.useMemo(()=>{const l=r.filter(x=>!d.has(x.execId)&&!d.has(`cli-history-${x.execId}`));switch(n){case"async":return l.filter(J);case"other":return l.filter(x=>!J(x));default:return l}},[r,d,n]);return e.jsxs("div",{className:"absolute right-0 top-0 bottom-0 z-40 overflow-y-auto flex flex-col",style:{width:280,backgroundColor:"var(--color-bg-secondary)",borderLeft:"1px solid var(--color-border)",boxShadow:t?"-4px 0 16px rgba(0,0,0,0.06)":"none",transform:t?"translateX(0)":"translateX(100%)",opacity:t?1:0,transition:"transform 200ms cubic-bezier(0.34,1.56,0.64,1), opacity 180ms ease",pointerEvents:t?"auto":"none"},children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 border-b shrink-0",style:{borderColor:"var(--color-border-divider)"},children:[e.jsx(re,{size:14,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),e.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--color-text-primary)"},children:"History"})]}),e.jsx("div",{className:"flex gap-1 px-2 py-2 border-b shrink-0",style:{borderColor:"var(--color-border-divider)"},children:[["async","Async"],["all","All"],["other","Other CLI"]].map(([l,x])=>e.jsx("button",{type:"button",onClick:()=>s(l),className:"px-2 py-1 rounded-md text-[11px] border-none cursor-pointer transition-colors duration-150",style:{backgroundColor:n===l?"var(--color-bg-active)":"transparent",color:n===l?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:x},l))}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:f.length===0?e.jsx("div",{className:"px-3 py-4 text-center text-[12px]",style:{color:"var(--color-text-tertiary)"},children:"No history entries"}):f.map(l=>e.jsx(Re,{meta:l,onRemove:x=>o(m=>m.filter(u=>u.execId!==x))},l.execId))})]})}function Re({meta:t,onRemove:r}){const{addProcess:o,addEntry:n,setActiveProcessId:s}=M.getState(),a=t.tool==="claude"?"claude-code":t.tool,d=se[a]??"var(--color-text-tertiary)",f=oe[a]??t.tool,l=async()=>{const i=`cli-history-${t.execId}`;if(M.getState().processes[i]){s(i);return}const v={id:i,type:a,status:t.delegateStatus==="cancelling"?"stopping":t.delegateStatus==="queued"?"spawning":t.delegateStatus==="running"?"running":"stopped",config:{type:a,prompt:t.prompt,workDir:t.workDir},startedAt:t.startedAt,interactive:t.asyncDelegate===!0};o(v),s(i);try{const[N,w]=await Promise.all([fetch(`/api/cli-history/${encodeURIComponent(t.execId)}/entries`),t.asyncDelegate?fetch(`/api/cli-history/${encodeURIComponent(t.execId)}/messages`):Promise.resolve(null)]);if(N.ok){const T=await N.json(),b=[];for(const j of T){const k={...j,processId:i};if(k.type==="assistant_message"){k.partial=!1;const h=b[b.length-1];if(h&&h.type==="assistant_message"){h.content+=k.content;continue}}if(k.type==="tool_use"&&(k.status==="completed"||k.status==="failed")){const h=b.findLastIndex(C=>C.type==="tool_use"&&C.status==="running");if(h!==-1){const C=b[h];b[h]={...C,status:k.status,result:k.result??C.result,input:C.input&&Object.keys(C.input).length>0?C.input:k.input};continue}}b.push(k)}for(const j of b)n(i,j)}if(w!=null&&w.ok){const T=await w.json();for(const b of Te(i,T))n(i,b)}}catch{}},x=i=>{i.stopPropagation();const v=`cli-history-${t.execId}`;M.getState().dismissProcess(v),r(t.execId)},m=Me(t),u=m?e.jsx("span",{className:"text-[10px] font-medium px-[5px] py-[1px] rounded",style:{backgroundColor:m.bg,color:m.fg},children:m.label}):null;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:l,className:"w-full text-left px-3 py-[10px] rounded-lg border-none bg-transparent cursor-pointer transition-colors duration-150",style:{color:"var(--color-text-secondary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent"},children:[e.jsxs("div",{className:"flex items-center gap-[6px] mb-[4px]",children:[e.jsx("span",{className:"w-[7px] h-[7px] rounded-full shrink-0",style:{backgroundColor:d}}),e.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--color-text-primary)"},children:f}),t.asyncDelegate&&e.jsx("span",{className:"text-[9px] font-semibold px-[4px] py-[1px] rounded",style:{backgroundColor:"var(--color-tint-exploring)",color:"var(--color-accent-blue)"},children:"ASYNC"}),u]}),e.jsxs("div",{className:"text-[11px] truncate mb-[4px]",style:{color:"var(--color-text-tertiary)"},children:[t.prompt.slice(0,60),t.prompt.length>60?"...":""]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px]",style:{color:"var(--color-text-placeholder)"},children:[e.jsx("span",{children:Ne(t.startedAt)}),e.jsx("span",{children:Se(t.startedAt)}),t.model&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--color-border-divider)"},children:"·"}),e.jsx("span",{children:t.model})]})]})]}),e.jsx("button",{type:"button",onClick:x,className:"absolute top-1 right-1 w-5 h-5 rounded flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity border-none bg-transparent cursor-pointer",style:{color:"var(--color-text-placeholder)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--color-tint-blocked)",i.currentTarget.style.color="var(--color-accent-red)"},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent",i.currentTarget.style.color="var(--color-text-placeholder)"},"aria-label":"Remove history item",children:e.jsx(B,{size:12,strokeWidth:2})})]})}function ee({filePath:t,onClose:r}){const[o,n]=c.useState(null),[s,a]=c.useState(!0),[d,f]=c.useState(null);c.useEffect(()=>{let x=!1;return a(!0),f(null),fetch(`/api/workspace/file?path=${encodeURIComponent(t)}`).then(async m=>{x||(m.ok?n(await m.text()):(f(`Failed to load: ${m.status}`),n(null)))}).catch(()=>{x||f("Failed to fetch file")}).finally(()=>{x||a(!1)}),()=>{x=!0}},[t]);const l=t.split("/").pop()??t;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.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:[e.jsx(ce,{size:13,strokeWidth:1.8,style:{color:"var(--color-text-tertiary)"}}),e.jsx("span",{className:"text-[12px] font-medium truncate flex-1",style:{color:"var(--color-text-primary)"},title:t,children:l}),e.jsx("span",{className:"text-[10px] truncate max-w-[200px]",style:{color:"var(--color-text-tertiary)"},children:t}),e.jsx("button",{type:"button",onClick:r,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:e.jsx(B,{size:12,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-auto",children:[s&&e.jsx("div",{className:"p-4 text-[12px] animate-pulse",style:{color:"var(--color-text-tertiary)"},children:"Loading..."}),d&&e.jsx("div",{className:"p-4 text-[12px]",style:{color:"var(--color-accent-red)"},children:d}),!s&&!d&&o!==null&&e.jsx("pre",{className:"p-4 m-0 text-[12px] leading-[1.7] whitespace-pre-wrap break-words",style:{color:"var(--color-text-secondary)",fontFamily:"var(--font-mono)",tabSize:2},children:o})]})]})}function Ee(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}const Pe={spawning:"Starting…",running:"Running",paused:"Paused",stopping:"Stopping…",stopped:"Stopped",error:"Error"};function De(t){return t.id.startsWith("cli-history-")}const Le=[{title:"Explore your codebase",desc:"Ask questions, trace code paths, understand architecture",icon:ue,iconColor:"var(--color-accent-blue)",iconBg:"var(--color-tint-exploring)"},{title:"Plan a feature",desc:"Break down requirements into phases and tasks",icon:pe,iconColor:"var(--color-accent-purple)",iconBg:"var(--color-tint-planning)"},{title:"Execute a workflow",desc:"Run parallel tasks with automatic verification",icon:xe,iconColor:"var(--color-accent-orange)",iconBg:"var(--color-tint-verifying)"},{title:"Review & debug",desc:"Multi-dimensional code review and hypothesis-driven debugging",icon:fe,iconColor:"var(--color-accent-green)",iconBg:"var(--color-tint-completed)"}];function We(){return ie(r=>r.stylePreset)==="cowork"?e.jsx("div",{className:"flex-1 flex flex-col",style:{paddingTop:"12vh"},children:e.jsxs("div",{className:"w-full px-6",style:{maxWidth:680},children:[e.jsx("h1",{style:{fontFamily:"var(--style-heading-font)",fontSize:"var(--style-heading-size)",fontWeight:"var(--style-heading-weight)",letterSpacing:"var(--style-heading-letter-spacing)",color:"var(--color-text-primary)",margin:0},children:"Let's build something together"}),e.jsx("p",{className:"mt-2 mb-6",style:{color:"var(--color-text-tertiary)",fontSize:14,margin:"8px 0 24px"},children:"Maestro workflow orchestration."}),e.jsx(A,{}),e.jsxs("div",{className:"mt-8",children:[e.jsx("p",{className:"mb-3",style:{color:"var(--color-text-tertiary)",fontSize:12,fontWeight:500},children:"Get started with Maestro"}),e.jsx("div",{className:"flex flex-col gap-[2px]",children:Le.map(r=>e.jsxs("div",{className:"flex items-center gap-3 px-2 py-[6px] rounded-[8px] cursor-pointer transition-colors duration-150",onMouseEnter:o=>{o.currentTarget.style.backgroundColor="var(--color-bg-hover)"},onMouseLeave:o=>{o.currentTarget.style.backgroundColor="transparent"},children:[e.jsx("div",{className:"shrink-0 flex items-center justify-center rounded-[10px]",style:{width:36,height:36,backgroundColor:r.iconBg},children:e.jsx(r.icon,{size:18,strokeWidth:1.5,style:{color:r.iconColor}})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--color-text-primary)"},children:r.title}),e.jsx("div",{style:{fontSize:12,color:"var(--color-text-tertiary)"},children:r.desc})]})]},r.title))})]})]})}):e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{marginTop:"-5vh"},children:e.jsxs("div",{className:"w-full px-4",style:{maxWidth:"clamp(360px, calc(100% - 32px), 780px)"},children:[e.jsxs("div",{className:"flex flex-col items-center mb-8",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl flex items-center justify-center mb-4",style:{backgroundColor:"var(--color-tint-exploring)"},children:e.jsx(de,{size:24,strokeWidth:1.5,style:{color:"var(--color-accent-blue)"}})}),e.jsx("h1",{className:"text-xl font-semibold mb-2 text-center",style:{color:"var(--color-text-primary)"},children:"Start a new conversation"}),e.jsx("p",{className:"text-[13px] text-center",style:{color:"var(--color-text-tertiary)"},children:"Select an agent, type a message, and press Enter to begin."})]}),e.jsx(A,{})]})})}function ne({process:t,isActive:r,onClick:o,onDismiss:n}){const s=se[t.type]??"var(--color-text-tertiary)",a=oe[t.type]??t.type,d=De(t),f=`${a}${d?" · Async Delegate":""} · ${Pe[t.status]??t.status}
7
- ${t.config.prompt.slice(0,100)}${t.config.prompt.length>100?"…":""}
8
- ${Ee(t.startedAt)} · ${t.type}`;return e.jsxs("button",{type:"button",onClick:o,title:f,className:"group/tab flex items-center gap-[6px] px-3 py-[5px] rounded-[9px] border-none text-[11px] font-medium cursor-pointer transition-all duration-150 shrink-0 relative",style:{backgroundColor:r?"var(--color-text-primary)":"transparent",color:r?"#fff":"var(--color-text-tertiary)",paddingRight:n?"22px":void 0},onMouseEnter:l=>{r||(l.currentTarget.style.backgroundColor="var(--color-bg-hover)",l.currentTarget.style.color="var(--color-text-primary)")},onMouseLeave:l=>{r||(l.currentTarget.style.backgroundColor="transparent",l.currentTarget.style.color="var(--color-text-tertiary)")},children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full shrink-0",style:{backgroundColor:r?"#fff":s}}),a,d&&e.jsx("span",{className:"px-[4px] py-[1px] rounded text-[9px] font-semibold",style:{backgroundColor:r?"rgba(255,255,255,0.16)":"var(--color-tint-exploring)",color:r?"#fff":"var(--color-accent-blue)"},children:"ASYNC"}),n&&e.jsx("span",{onClick:l=>{l.stopPropagation(),n()},className:"absolute right-[6px] top-1/2 -translate-y-1/2 w-[14px] h-[14px] rounded-sm flex items-center justify-center opacity-0 group-hover/tab:opacity-100 transition-opacity duration-100",style:{color:r?"rgba(255,255,255,0.6)":"var(--color-text-placeholder)"},onMouseEnter:l=>{l.currentTarget.style.color=r?"#fff":"var(--color-accent-red)",l.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.15)":"var(--color-tint-blocked)"},onMouseLeave:l=>{l.currentTarget.style.color=r?"rgba(255,255,255,0.6)":"var(--color-text-placeholder)",l.currentTarget.style.backgroundColor="transparent"},children:e.jsx(B,{size:10,strokeWidth:2})})]})}function Ae({sortedProcesses:t,activeProcessId:r,splitOpen:o,historyOpen:n,fileTreeOpen:s,onSelectProcess:a,onDismissProcess:d,onNewSession:f,onToggleSplit:l,onToggleHistory:x,onToggleFileTree:m}){return e.jsx("div",{className:"sticky top-0 z-30 flex justify-center pt-2 pointer-events-none shrink-0",children:e.jsxs("div",{className:"inline-flex items-center gap-[2px] border rounded-[12px] p-[3px] pointer-events-auto",style:{backgroundColor:"var(--color-bg-card)",borderColor:"var(--color-border)",boxShadow:"0 4px 20px rgba(0,0,0,0.06)",maxWidth:"calc(100% - 32px)"},children:[!o&&(t.length>0||r===null)&&e.jsxs("div",{className:"flex items-center gap-[2px] overflow-x-auto",style:{scrollbarWidth:"thin",maxWidth:"min(600px, 60vw)"},onWheel:u=>{Math.abs(u.deltaY)>Math.abs(u.deltaX)&&(u.currentTarget.scrollLeft+=u.deltaY,u.preventDefault())},children:[t.map(u=>e.jsx(ne,{process:u,isActive:u.id===r,onClick:()=>a(u.id),onDismiss:()=>d(u.id)},u.id)),r===null&&e.jsxs("button",{type:"button",className:"flex items-center gap-[6px] px-3 py-[5px] rounded-[9px] border-none text-[11px] font-medium cursor-pointer shrink-0",style:{backgroundColor:"var(--color-text-primary)",color:"#fff"},children:[e.jsx(q,{size:10,strokeWidth:2.5}),"New"]})]}),t.length>1&&e.jsxs(e.Fragment,{children:[!o&&t.length>0&&e.jsx("div",{className:"w-px h-4 shrink-0",style:{backgroundColor:"var(--color-border-divider)",margin:"0 2px"}}),e.jsx(_,{icon:e.jsx(ve,{size:14,strokeWidth:1.8}),isActive:o,onClick:l,label:"Toggle split view"})]}),e.jsx("button",{type:"button",onClick:f,className:"w-7 h-7 rounded-[8px] border-none bg-transparent flex items-center justify-center cursor-pointer transition-all duration-150 shrink-0",style:{color:"var(--color-text-tertiary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--color-bg-hover)",u.currentTarget.style.color="var(--color-text-primary)"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent",u.currentTarget.style.color="var(--color-text-tertiary)"},"aria-label":"New session",children:e.jsx(q,{size:14,strokeWidth:2})}),e.jsx("div",{className:"w-px h-4 shrink-0",style:{backgroundColor:"var(--color-border-divider)",margin:"0 2px"}}),e.jsx(_,{icon:e.jsx(ye,{size:14,strokeWidth:1.8}),isActive:s,onClick:m,label:"Toggle file tree"}),e.jsx(_,{icon:e.jsx(re,{size:14,strokeWidth:1.8}),isActive:n,onClick:x,label:"Toggle history"})]})})}function te({sortedProcesses:t,currentProcessId:r,onSelectProcess:o,onClose:n}){return e.jsx("div",{className:"flex justify-center pt-[6px] pb-[2px] pointer-events-none shrink-0",children:e.jsxs("div",{className:"inline-flex items-center gap-[2px] border rounded-[10px] p-[2px] pointer-events-auto",style:{backgroundColor:"var(--color-bg-card)",borderColor:"var(--color-border)",boxShadow:"0 2px 12px rgba(0,0,0,0.04)",maxWidth:"calc(100% - 16px)"},children:[e.jsx("div",{className:"flex items-center gap-[2px] overflow-x-auto",style:{scrollbarWidth:"thin",maxWidth:"min(400px, 100%)"},onWheel:s=>{Math.abs(s.deltaY)>Math.abs(s.deltaX)&&(s.currentTarget.scrollLeft+=s.deltaY,s.preventDefault())},children:t.map(s=>e.jsx(ne,{process:s,isActive:s.id===r,onClick:()=>o(s.id)},s.id))}),n&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-3 shrink-0",style:{backgroundColor:"var(--color-border-divider)",margin:"0 1px"}}),e.jsx("button",{type:"button",onClick:n,className:"w-[22px] h-[22px] rounded-[6px] border-none bg-transparent flex items-center justify-center cursor-pointer transition-all duration-100 shrink-0",style:{color:"var(--color-text-placeholder)"},onMouseEnter:s=>{s.currentTarget.style.backgroundColor="var(--color-tint-blocked)",s.currentTarget.style.color="var(--color-accent-red)"},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent",s.currentTarget.style.color="var(--color-text-placeholder)"},"aria-label":"Close pane",children:e.jsx(B,{size:10,strokeWidth:2})})]})]})})}function _({icon:t,isActive:r,onClick:o,label:n}){return e.jsx("button",{type:"button",onClick:o,className:"flex items-center px-2 py-[5px] rounded-[9px] border-none bg-transparent cursor-pointer transition-all duration-150 shrink-0",style:{color:r?"var(--color-accent-blue)":"var(--color-text-tertiary)",backgroundColor:r?"var(--color-tint-exploring)":"transparent"},onMouseEnter:s=>{r||(s.currentTarget.style.backgroundColor="var(--color-bg-hover)",s.currentTarget.style.color="var(--color-text-primary)")},onMouseLeave:s=>{r||(s.currentTarget.style.backgroundColor="transparent",s.currentTarget.style.color="var(--color-text-tertiary)")},"aria-label":n,children:t})}function Ge(){var O;const t=M(g=>g.processes),r=M(g=>g.activeProcessId),o=M(g=>g.setActiveProcessId),n=M(g=>g.dismissProcess),[s,a]=c.useState(!1),[d,f]=c.useState(null),[l,x]=c.useState(!1),[m,u]=c.useState(!1),[i,v]=c.useState(null),{ratio:N,setRatio:w,createDragHandle:T}=je({defaultRatio:50,minRatio:25,maxRatio:75,storageKey:"chat-split-ratio"}),b=we(),j=c.useMemo(()=>Object.values(t).sort((g,p)=>new Date(p.startedAt).getTime()-new Date(g.startedAt).getTime()),[t]),k=c.useRef(!1),h=Object.keys(t).length,C=c.useRef(h),E=c.useRef(j);E.current=j,c.useEffect(()=>{const g=C.current;if(C.current=h,k.current){if(h>g){k.current=!1;const p=E.current[0];p&&o(p.id)}return}if(!r&&h>0){const p=E.current[0];p&&o(p.id)}},[r,h,o]);const S=c.useRef({});c.useEffect(()=>{for(const p of j){const y=p.status==="stopped"||p.status==="error",P=p.id===r;y&&!P&&!S.current[p.id]&&(S.current[p.id]=setTimeout(()=>{delete S.current[p.id],n(p.id)},12e4)),(!y||P)&&S.current[p.id]&&(clearTimeout(S.current[p.id]),delete S.current[p.id])}for(const p of Object.keys(S.current))t[p]||(clearTimeout(S.current[p]),delete S.current[p])},[j,r,n,t]);const I=d?t[d]:null,D=!r;ke(r),c.useEffect(()=>{s&&d&&!t[d]&&(a(!1),f(null))},[s,d,t]);const z=c.useCallback(()=>{if(s)a(!1),f(null),v(null);else{const g=j.find(p=>p.id!==r);g&&(f(g.id),a(!0),w(50))}},[s,j,r,w]),R=c.useCallback(g=>{const p=t[g];p&&(p.status==="running"||p.status==="spawning")&&W({action:"stop",processId:g}),n(g)},[t,n]),X=c.useCallback(()=>{k.current=!0,o(null)},[o]),$=c.useCallback(g=>{i!==null?v(g):(v(g),a(!0),f(null),w(50))},[i,w]),F=c.useCallback(()=>{v(null),a(!1),f(null)},[]);return e.jsxs("div",{className:"h-full flex min-w-0 overflow-hidden relative",children:[e.jsx("div",{className:"shrink-0 flex flex-col overflow-hidden border-r transition-[width] duration-200 ease-[var(--ease-notion)]",style:{width:m?260:0,borderColor:m?"var(--color-border)":"transparent"},children:m&&e.jsx(ge,{tree:b.tree,selectedPath:i,onSelectFile:$,loading:b.loading})}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[e.jsx(Ae,{sortedProcesses:j,activeProcessId:r,splitOpen:s,historyOpen:l,fileTreeOpen:m,onSelectProcess:o,onDismissProcess:R,onNewSession:X,onToggleSplit:z,onToggleHistory:()=>x(!l),onToggleFileTree:()=>u(!m)}),D&&i?e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsx(ee,{filePath:i,onClose:F})}):D?e.jsx(We,{}):e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 relative",children:[e.jsxs("div",{className:"flex flex-col min-w-0 overflow-hidden",style:{flex:s?`0 0 ${N}%`:"1"},children:[s&&!i&&e.jsx(te,{sortedProcesses:j,currentProcessId:r,onSelectProcess:o}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:e.jsx(H,{processId:r})}),e.jsx(G,{processId:r}),s&&!i?e.jsx(A,{processId:r,executor:(O=t[r])==null?void 0:O.type}):e.jsx(A,{})]}),s&&e.jsx("div",{className:"relative shrink-0",style:{width:0},children:T({className:"left-[-6px]",linePlacement:"end",lineClassName:"opacity-40 group-hover:opacity-100 group-active:opacity-100",lineStyle:{backgroundColor:"var(--color-accent-orange)"}})}),s&&e.jsx("div",{className:"flex flex-col min-w-0 overflow-hidden border-l",style:{flex:`0 0 ${100-N}%`,borderColor:"var(--color-border)"},children:i?e.jsx(ee,{filePath:i,onClose:F}):e.jsxs(e.Fragment,{children:[e.jsx(te,{sortedProcesses:j,currentProcessId:d,onSelectProcess:f,onClose:z}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:e.jsx(H,{processId:d})}),e.jsx(G,{processId:d}),e.jsx(A,{processId:d,executor:I==null?void 0:I.type})]})})]})]}),e.jsx(Ie,{open:l})]})}export{Ge as ChatPage};
@@ -1 +0,0 @@
1
- import{j as e,Z as L,_ as c,$ as w,r as d,V as z}from"./index-nufWop4p.js";import{A as M}from"./index-Dru5HYy0.js";import{m as T}from"./proxy-teW12DdZ.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 _({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 E(){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(_,{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(X,{}),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(Z,{onRefresh:async()=>{const l=await x();v(l),l!=null&&l.exists&&(s(),o(),h(),p())}})}function Z({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 X(){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(E,{})})]})]})}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};