@wrongstack/webui 0.309.0 → 0.309.1

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 (89) hide show
  1. package/dist/assets/{AgentRosterView-CbgKjnxJ.js → AgentRosterView-CBiLW8dV.js} +1 -1
  2. package/dist/assets/{AnalyticsDashboard-BXnPG2xB.js → AnalyticsDashboard-Grpp3QKX.js} +1 -1
  3. package/dist/assets/{AudienceMemoryPanel-Ch-jf06O.js → AudienceMemoryPanel-DU3hUuUl.js} +1 -1
  4. package/dist/assets/{ChangesView-5lcal8q4.js → ChangesView-DOrw4udd.js} +1 -1
  5. package/dist/assets/ChronicleDashboard-DlCuQRB8.js +1 -0
  6. package/dist/assets/CodeEditor-CU6zP0r8.js +2 -0
  7. package/dist/assets/CodeMap-BkJqVDg2.js +1 -0
  8. package/dist/assets/{ConfirmModal-KzK0LoJw.js → ConfirmModal-BJOVE-JI.js} +1 -1
  9. package/dist/assets/{CronJobsPanel-aLru0Rd_.js → CronJobsPanel-B3UJP0mn.js} +1 -1
  10. package/dist/assets/{DeadCodeScanPanel-BXpB_M2Z.js → DeadCodeScanPanel-_iUu5-90.js} +1 -1
  11. package/dist/assets/{DebugDashboard-hnhGaWr-.js → DebugDashboard-NTiN0je2.js} +1 -1
  12. package/dist/assets/{DesignGalleryView-CXHgaI2Q.js → DesignGalleryView-BG2Nr8wy.js} +1 -1
  13. package/dist/assets/{GoalView-BB5t68cb.js → GoalView-Dakf9ZR8.js} +1 -1
  14. package/dist/assets/KanbanView-BR07PhbR.js +3 -0
  15. package/dist/assets/{MailboxDetailView-jPxF6ia3.js → MailboxDetailView-D31IhaK_.js} +1 -1
  16. package/dist/assets/{MemoryDrawer-e8UxQq-s.js → MemoryDrawer-6n0Etoz4.js} +1 -1
  17. package/dist/assets/MemoryManager-7DSVhxZf.js +1 -0
  18. package/dist/assets/{ModelPicker-nyXP3xsj.js → ModelPicker-C72kprRH.js} +1 -1
  19. package/dist/assets/OfficeMapPanel-Ce7myLNH.css +1 -0
  20. package/dist/assets/OfficeMapPanel-Dc8-4CiU.js +4 -0
  21. package/dist/assets/{ProcessMonitor-Epj6RrOA.js → ProcessMonitor-BGLc3yNM.js} +1 -1
  22. package/dist/assets/{PromptJournalView-CMlGmjig.js → PromptJournalView-CxDiqUkN.js} +1 -1
  23. package/dist/assets/{QueuePanel-D67eiPuQ.js → QueuePanel-B2f1HbN0.js} +1 -1
  24. package/dist/assets/{RefreshDebugView-CWAwHE9i.js → RefreshDebugView-D8F95QxF.js} +1 -1
  25. package/dist/assets/{RequirementIntakeView-DPj065HL.js → RequirementIntakeView-BRolSCpk.js} +1 -1
  26. package/dist/assets/{SageTabs-BtRa8OZC.js → SageTabs-DblSyqzB.js} +2 -2
  27. package/dist/assets/{SddFlowGraph-DMSN4LTZ.js → SddFlowGraph-YOPsSaFc.js} +1 -1
  28. package/dist/assets/SddHub-IusMUP2D.js +2 -0
  29. package/dist/assets/{SessionInspectView-BdlOiPzO.js → SessionInspectView-B633Bi0X.js} +1 -1
  30. package/dist/assets/SessionList-BCE6NSCu.js +1 -0
  31. package/dist/assets/{SessionsDashboard-BiR0zh-a.js → SessionsDashboard-N__p7_i5.js} +1 -1
  32. package/dist/assets/SetupScreen-B06asuJC.js +1 -0
  33. package/dist/assets/SkillDetailView-BxpQcgfh.js +3 -0
  34. package/dist/assets/{SpecsView-2PqHEXH9.js → SpecsView-Ddbow1sn.js} +1 -1
  35. package/dist/assets/TechStackView-HTZUTbuu.js +2 -0
  36. package/dist/assets/{TerminalPanel-CLUB8F2H.js → TerminalPanel-Bi3CmRvI.js} +1 -1
  37. package/dist/assets/{Toaster-BlD1m8P2.js → Toaster-COVFFUKo.js} +1 -1
  38. package/dist/assets/{activity-DYwBIByU.js → activity-7Sj9fdO-.js} +2 -2
  39. package/dist/assets/{activity-CA5G03Kw.js → activity-B-LcgiXm.js} +2 -2
  40. package/dist/assets/{activity-CezOSNBd.js → activity-B7hiQ_IX.js} +2 -2
  41. package/dist/assets/{activity-C6pIBHte.js → activity-Cq0Lqtgz.js} +2 -2
  42. package/dist/assets/{activity-CxnlCaZu.js → activity-DVuAYnoi.js} +2 -2
  43. package/dist/assets/{activity-l8lDAw8a.js → activity-Dt0RpmkN.js} +2 -2
  44. package/dist/assets/{activity-CkGBp_I-.js → activity-JmCi-KcX.js} +2 -2
  45. package/dist/assets/{button-DvpRpKkt.js → button-DAT5OnLL.js} +1 -1
  46. package/dist/assets/{chat-store-c0pGYczr.js → chat-store-CtIMb3sU.js} +1 -1
  47. package/dist/assets/{codemap-activity-store-BH7Mh4k9.js → codemap-activity-store-CA_14DHd.js} +1 -1
  48. package/dist/assets/codemap-index-store-BlPxA13l.js +1 -0
  49. package/dist/assets/{dialog-BJjDUqb3.js → dialog-BMrjwjA6.js} +1 -1
  50. package/dist/assets/{empty-state-Cefmzojx.js → empty-state-Bf05Z1d2.js} +1 -1
  51. package/dist/assets/{i18n-DbJfY4tY.js → i18n-CYYBUSJB.js} +2 -2
  52. package/dist/assets/{index-DQn-Lz9q.js → index-cUeJ0FkT.js} +55 -54
  53. package/dist/assets/{input-BtoHcCl9.js → input-Ccsxvwz6.js} +1 -1
  54. package/dist/assets/{mailbox-store-bF96Ih2G.js → mailbox-store-BWD7JeF9.js} +1 -1
  55. package/dist/assets/{markdown-CIRD7kOg.js → markdown-Kp5uSgOw.js} +23 -23
  56. package/dist/assets/{roster-ws-DycHs92J.js → roster-ws-lMIf13ag.js} +1 -1
  57. package/dist/assets/{session-store-CKdsROPD.js → session-store-D4PNeAGe.js} +1 -1
  58. package/dist/assets/{shared-B3czc2Dj.js → shared-Y6T3EEnd.js} +1 -1
  59. package/dist/assets/stores-BUtRik4k.js +7 -0
  60. package/dist/assets/{ui-store-xx1NssJI.js → ui-store-DxMnhARg.js} +1 -1
  61. package/dist/assets/useWebSocket-Ew1Bbjci.js +29 -0
  62. package/dist/assets/{utils-tsZEnrBH.js → utils-B5X3DKef.js} +1 -1
  63. package/dist/assets/{vector-memory-panel-C6iWDhkJ.js → vector-memory-panel-CnBqV6GK.js} +1 -1
  64. package/dist/assets/{vendor-C_zEzV4N.js → vendor-DLS502Zs.js} +3 -3
  65. package/dist/assets/{view-navigation-CZKugncK.js → view-navigation-Hd631M1W.js} +1 -1
  66. package/dist/assets/{ws-client-CBfMQmW9.js → ws-client-DYrfK01f.js} +1 -1
  67. package/dist/components/AgentOfficeView/model.d.ts +20 -0
  68. package/dist/components/AgentOfficeView.d.ts +10 -0
  69. package/dist/index.css +114 -7
  70. package/dist/index.html +22 -22
  71. package/dist/index.js +317 -70
  72. package/dist/stores/index.d.ts +1 -1
  73. package/dist/stores/office-map-store.d.ts +6 -0
  74. package/package.json +15 -15
  75. package/dist/assets/ChronicleDashboard-BH9k5NjB.js +0 -1
  76. package/dist/assets/CodeEditor-BrQMwzOp.js +0 -2
  77. package/dist/assets/CodeMap-B5e0v0jn.js +0 -1
  78. package/dist/assets/KanbanView-bZtgy3zZ.js +0 -3
  79. package/dist/assets/MemoryManager-BXYIA9wG.js +0 -1
  80. package/dist/assets/OfficeMapPanel-CBfE7Kli.js +0 -4
  81. package/dist/assets/OfficeMapPanel-D6yTfGIT.css +0 -1
  82. package/dist/assets/SddHub-CuqWpqSd.js +0 -2
  83. package/dist/assets/SessionList-CvvH8SI2.js +0 -1
  84. package/dist/assets/SetupScreen-B8s5fvr8.js +0 -1
  85. package/dist/assets/SkillDetailView-DbXp7-E5.js +0 -3
  86. package/dist/assets/TechStackView-Dnws9pc9.js +0 -2
  87. package/dist/assets/codemap-index-store-BFm1TzVW.js +0 -1
  88. package/dist/assets/stores-C0xX0jn4.js +0 -7
  89. package/dist/assets/useWebSocket-D9Dy4-9x.js +0 -29
@@ -1 +0,0 @@
1
- .agent-office{--office-line:hsl(var(--border) / .72);--office-soft:hsl(var(--surface-2) / .78);--office-panel:hsl(var(--card) / .94);height:100%;min-height:0;color:hsl(var(--foreground));background:radial-gradient(circle at 9% 0%, hsl(var(--primary) / .08), transparent 24rem), linear-gradient(135deg, hsl(var(--background)), hsl(var(--surface-2) / .62));grid-template-rows:auto auto minmax(0,1fr) auto;display:grid;position:relative;overflow:hidden}.agent-office:before{pointer-events:none;content:"";opacity:.18;background-image:linear-gradient(hsl(var(--border) / .34) 1px, transparent 1px), linear-gradient(90deg, hsl(var(--border) / .34) 1px, transparent 1px);background-size:28px 28px;position:absolute;inset:0;-webkit-mask-image:linear-gradient(#0000,#000 16% 92%,#0000);mask-image:linear-gradient(#0000,#000 16% 92%,#0000)}.agent-office__header{z-index:4;border-bottom:1px solid var(--office-line);background:hsl(var(--card) / .9);min-height:68px;box-shadow:0 8px 30px hsl(var(--shadow-color) / .08);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);align-items:center;gap:18px;padding:10px 16px;display:flex;position:relative}.agent-office__title{align-items:center;gap:10px;min-width:210px;display:flex}.agent-office__brand-mark{border:1px solid hsl(var(--primary) / .34);width:38px;height:38px;color:hsl(var(--primary));background:hsl(var(--primary) / .1);border-radius:10px;flex:none;place-items:center;display:grid}.agent-office__brand-mark svg{width:19px;height:19px}.agent-office__title>div>span,.agent-office__detail-header>div>span{color:hsl(var(--muted-foreground));font:500 11px / 1.2 var(--font-mono);letter-spacing:.13em;display:block}.agent-office__title h1{max-width:280px;font:500 15px / 1.2 var(--font-display);text-overflow:ellipsis;white-space:nowrap;margin:3px 0 0;overflow:hidden}.agent-office__live-pill{border:1px solid hsl(var(--success) / .3);color:hsl(var(--success));background:hsl(var(--success) / .08);font:500 11px / 1 var(--font-mono);letter-spacing:.1em;border-radius:999px;align-items:center;gap:6px;padding:5px 8px;display:flex}.agent-office__live-pill>span,.agent-office__pulse-dot{width:6px;height:6px;box-shadow:0 0 0 4px hsl(var(--success) / .12);background:currentColor;border-radius:999px;animation:1.6s ease-in-out infinite agent-office-pulse}.agent-office__summary{flex:auto;justify-content:center;gap:6px;min-width:0;display:flex}.agent-office__summary>div{border-left:1px solid var(--office-line);grid-template-columns:auto auto;align-items:center;gap:0 6px;min-width:92px;padding:6px 9px;display:grid}.agent-office__summary svg{width:13px;height:13px;color:hsl(var(--muted-foreground))}.agent-office__summary strong{font:500 13px / 1 var(--font-mono)}.agent-office__summary span{color:hsl(var(--muted-foreground));grid-column:1/-1;font-size:11px}.agent-office__column-headings,.agent-office__lane{grid-template-columns:180px minmax(430px,1fr) 270px;display:grid}.agent-office__column-headings{z-index:3;border-bottom:1px solid var(--office-line);min-height:28px;color:hsl(var(--muted-foreground));background:hsl(var(--background) / .84);font:500 10px / 1 var(--font-mono);letter-spacing:.14em;align-items:center;padding:0 12px;position:relative}.agent-office__column-headings span{padding:0 12px}.agent-office__column-headings span:last-child{padding-left:16px}.agent-office__client-office{border:1px solid hsl(var(--border));background:hsl(var(--card) / .42);box-shadow:0 14px 38px hsl(var(--shadow-color) / .08);border-radius:16px;margin-bottom:14px;overflow:hidden}.agent-office__client-header{border-bottom:1px solid hsl(var(--border));background:linear-gradient(90deg, hsl(var(--primary) / .07), transparent 42%), hsl(var(--card) / .82);justify-content:space-between;align-items:center;gap:14px;min-height:62px;padding:9px 12px;display:flex}.agent-office__client-title{flex-wrap:wrap;flex:420px;align-items:center;gap:9px;min-width:210px;display:flex}.agent-office__client-copy{flex-direction:column;flex:150px;gap:2px;min-width:0;display:flex}.agent-office__client-copy strong{font:500 12px / 1.2 var(--font-display);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__client-copy>span{max-width:310px;color:hsl(var(--muted-foreground));font:400 10px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__client-icon{width:32px;height:32px;color:hsl(var(--primary));background:hsl(var(--primary) / .1);border-radius:9px;flex:none;place-items:center;display:grid}.agent-office__client-icon svg{width:16px;height:16px}.agent-office__client-agent-count{color:hsl(var(--primary));background:hsl(var(--primary) / .09);font:500 10px / 1 var(--font-mono);border-radius:999px;flex:none;padding:3px 6px}.agent-office__client-presence{flex-wrap:wrap;align-items:center;gap:4px;min-width:0;display:flex}.agent-office__presence-chip{border:1px solid hsl(var(--border));min-height:20px;color:hsl(var(--muted-foreground));background:hsl(var(--background) / .5);font:500 9px / 1 var(--font-mono);letter-spacing:.04em;border-radius:999px;flex:none;align-items:center;gap:3px;padding:3px 5px;display:inline-flex}.agent-office__presence-chip svg{width:9px;height:9px}.agent-office__presence-chip.is-live,.agent-office__presence-chip.is-telemetry{border-color:hsl(var(--success) / .25);color:hsl(var(--success));background:hsl(var(--success) / .07)}.agent-office__presence-chip.is-legacy{border-color:hsl(var(--warning) / .28);color:hsl(var(--warning));background:hsl(var(--warning) / .08)}.agent-office__agent-verified{min-height:16px;color:hsl(var(--success));background:hsl(var(--success) / .08);font:500 8px / 1 var(--font-mono);letter-spacing:.04em;border-radius:999px;flex:none;align-items:center;gap:2px;padding:2px 4px;display:inline-flex}.agent-office__agent-verified svg{width:8px;height:8px}.agent-office__client-stats{border:0;flex-wrap:wrap;justify-content:flex-end;gap:5px;min-width:0;margin:0;padding:0;display:flex}.agent-office__client-stats>span{border:1px solid hsl(var(--border));min-height:25px;color:hsl(var(--muted-foreground));background:hsl(var(--background) / .58);font:400 9px / 1 var(--font-mono);letter-spacing:.05em;border-radius:6px;align-items:center;gap:4px;padding:4px 6px;display:inline-flex}.agent-office__client-stats svg{width:11px;height:11px}.agent-office__client-stats strong{color:hsl(var(--foreground));font-size:11px}.agent-office__client-delta strong{color:hsl(var(--success))}.agent-office__client-delta b{color:hsl(var(--destructive));font-weight:500}.agent-office__client-desks{padding:9px 9px 1px}.agent-office__briefing{border-bottom:1px solid hsl(var(--border));background:hsl(var(--background) / .34);grid-template-columns:minmax(0,1.15fr) minmax(300px,.85fr);gap:8px;padding:8px 9px;display:grid}.agent-office__prompt-card,.agent-office__todo-board{border:1px solid hsl(var(--border));min-width:0;min-height:68px;color:hsl(var(--foreground));background:hsl(var(--card) / .7);text-align:left;box-shadow:0 6px 18px hsl(var(--shadow-color) / .045);border-radius:10px;align-items:center;gap:9px;padding:9px 10px;transition:border-color .16s,background .16s,transform .16s;display:flex;position:relative}.agent-office__prompt-card{overflow:hidden}.agent-office__prompt-card.is-active{border-color:hsl(var(--success) / .38);background:linear-gradient(90deg, hsl(var(--success) / .07), transparent 62%), hsl(var(--card) / .78);box-shadow:0 8px 24px hsl(var(--success) / .08)}.agent-office__prompt-card.is-fresh:after{pointer-events:none;content:"";background:linear-gradient(90deg, transparent, hsl(var(--primary) / .14), transparent);width:24%;animation:1.1s ease-out agent-office-brief-arrive;position:absolute;inset:0 auto 0 -30%;transform:skew(-18deg)}.agent-office__prompt-card.is-waiting,.agent-office__todo-board.is-waiting{background:hsl(var(--muted) / .28);border-style:dashed}.agent-office__prompt-card:hover,.agent-office__todo-board:hover{border-color:hsl(var(--primary) / .34);background:hsl(var(--card));transform:translateY(-1px)}.agent-office__briefing-icon{width:34px;height:34px;color:hsl(var(--primary));background:hsl(var(--primary) / .1);border-radius:9px;flex:none;place-items:center;display:grid}.agent-office__briefing-icon svg{width:16px;height:16px}.agent-office__briefing-copy{flex-direction:column;flex:auto;gap:4px;min-width:0;display:flex}.agent-office__briefing-copy>span,.agent-office__todo-heading>span{color:hsl(var(--muted-foreground));font:500 9px / 1 var(--font-mono);letter-spacing:.11em;text-transform:uppercase}.agent-office__briefing-copy strong{font:500 12px / 1.35 var(--font-display);-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.agent-office__prompt-card time{color:hsl(var(--muted-foreground));font:400 9px / 1 var(--font-mono);flex:none;align-self:flex-start}.agent-office__instruction-live{color:hsl(var(--success));background:hsl(var(--success) / .09);font:500 9px / 1 var(--font-mono);letter-spacing:.08em;border-radius:999px;flex:none;align-items:center;gap:4px;padding:3px 5px;display:inline-flex}.agent-office__instruction-live i{width:5px;height:5px;box-shadow:0 0 0 3px hsl(var(--success) / .1);background:currentColor;border-radius:50%;animation:1.6s ease-in-out infinite agent-office-pulse}.agent-office__todo-board{flex-direction:column;align-items:stretch;gap:7px}.agent-office__todo-board.has-active{border-color:hsl(var(--primary) / .26)}.agent-office__todo-board.has-active:after{content:"";background:linear-gradient(90deg, hsl(var(--primary) / .16), hsl(var(--primary)), hsl(var(--primary) / .16));background-size:200% 100%;border-radius:999px;width:38px;height:2px;animation:2.4s linear infinite agent-office-sync-line;position:absolute;bottom:7px;right:8px;overflow:hidden}.agent-office__todo-heading{justify-content:space-between;align-items:center;gap:8px;min-width:0;display:flex}.agent-office__todo-heading>span{align-items:center;gap:5px;display:inline-flex}.agent-office__todo-heading svg{width:12px;height:12px;color:hsl(var(--primary))}.agent-office__todo-heading strong,.agent-office__todo-more{color:hsl(var(--muted-foreground));font:500 9px / 1 var(--font-mono)}.agent-office__todo-preview{flex-direction:column;gap:4px;min-width:0;display:flex}.agent-office__todo-line{min-width:0;font:400 10px / 1.2 var(--font-mono);align-items:center;gap:6px;display:flex}.agent-office__todo-line i{border:1px solid hsl(var(--muted-foreground) / .62);border-radius:50%;flex:none;width:6px;height:6px}.agent-office__todo-line.is-in_progress i{border-color:hsl(var(--success));background:hsl(var(--success));box-shadow:0 0 0 3px hsl(var(--success) / .1);animation:1.6s ease-in-out infinite agent-office-pulse}.agent-office__todo-line>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__todo-empty{color:hsl(var(--muted-foreground));font:400 10px / 1.2 var(--font-mono);align-items:center;gap:6px;display:flex}.agent-office__todo-empty svg{width:13px;height:13px;color:hsl(var(--success))}.agent-office__todo-empty.is-waiting svg{color:hsl(var(--warning));animation:1.8s ease-in-out infinite agent-office-telemetry-wait}.agent-office__floor{z-index:2;overscroll-behavior:contain;scrollbar-color:hsl(var(--border)) transparent;min-height:0;padding:10px 12px 20px;position:relative;overflow-y:auto}.agent-office__lane{--desk-top:hsl(var(--warning) / .72);--desk-edge:hsl(var(--warning) / .3);--desk-leg:hsl(var(--muted-foreground) / .62);--desk-chair:hsl(var(--muted-foreground) / .28);--desk-screen:hsl(var(--primary));--desk-decor:hsl(var(--warning) / .68);--desk-wall:hsl(var(--info) / .055);--desk-floor:hsl(var(--warning) / .055);--desk-aura:hsl(var(--warning) / .045);border:1px solid var(--office-line);background:var(--office-panel);min-height:172px;box-shadow:0 10px 30px hsl(var(--shadow-color) / .06);border-radius:14px;margin-bottom:9px;transition:border-color .18s,box-shadow .18s,transform .18s;animation:.42s cubic-bezier(.16,.82,.28,1) agent-office-lane-arrive;position:relative;overflow:hidden}.agent-office__lane.is-desk-mint{--desk-top:hsl(var(--success) / .58);--desk-edge:hsl(var(--success) / .22);--desk-leg:hsl(var(--foreground) / .5);--desk-chair:hsl(var(--success) / .2);--desk-screen:hsl(var(--success));--desk-decor:hsl(var(--info) / .7);--desk-wall:hsl(var(--success) / .07);--desk-floor:hsl(var(--info) / .045);--desk-aura:hsl(var(--success) / .055)}.agent-office__lane.is-desk-ocean{--desk-top:hsl(var(--info) / .62);--desk-edge:hsl(var(--info) / .24);--desk-leg:hsl(var(--foreground) / .58);--desk-chair:hsl(var(--info) / .2);--desk-screen:hsl(var(--info));--desk-decor:hsl(var(--primary) / .72);--desk-wall:hsl(var(--info) / .09);--desk-floor:hsl(var(--primary) / .04);--desk-aura:hsl(var(--info) / .052)}.agent-office__lane.is-desk-plum{--desk-top:hsl(var(--primary) / .58);--desk-edge:hsl(var(--primary) / .24);--desk-leg:hsl(var(--foreground) / .54);--desk-chair:hsl(var(--primary) / .2);--desk-screen:hsl(var(--primary));--desk-decor:hsl(var(--warning) / .75);--desk-wall:hsl(var(--primary) / .075);--desk-floor:hsl(var(--warning) / .04);--desk-aura:hsl(var(--primary) / .052)}.agent-office__lane.is-desk-rose{--desk-top:hsl(var(--destructive) / .5);--desk-edge:hsl(var(--destructive) / .2);--desk-leg:hsl(var(--foreground) / .52);--desk-chair:hsl(var(--destructive) / .18);--desk-screen:hsl(var(--destructive));--desk-decor:hsl(var(--warning) / .72);--desk-wall:hsl(var(--destructive) / .06);--desk-floor:hsl(var(--warning) / .04);--desk-aura:hsl(var(--destructive) / .048)}.agent-office__lane.is-desk-graphite{--desk-top:hsl(var(--muted-foreground) / .58);--desk-edge:hsl(var(--foreground) / .18);--desk-leg:hsl(var(--foreground) / .66);--desk-chair:hsl(var(--foreground) / .16);--desk-screen:hsl(var(--success));--desk-decor:hsl(var(--info) / .7);--desk-wall:hsl(var(--muted-foreground) / .055);--desk-floor:hsl(var(--foreground) / .035);--desk-aura:hsl(var(--muted-foreground) / .044)}.dark .agent-office__lane{--desk-wall:hsl(var(--info) / .16);--desk-floor:hsl(var(--warning) / .16);--desk-aura:hsl(var(--warning) / .14)}.dark .agent-office__lane.is-desk-mint{--desk-wall:hsl(var(--success) / .18);--desk-floor:hsl(var(--info) / .14);--desk-aura:hsl(var(--success) / .16)}.dark .agent-office__lane.is-desk-ocean{--desk-wall:hsl(var(--info) / .2);--desk-floor:hsl(var(--primary) / .14);--desk-aura:hsl(var(--info) / .16)}.dark .agent-office__lane.is-desk-plum{--desk-wall:hsl(var(--primary) / .18);--desk-floor:hsl(var(--warning) / .14);--desk-aura:hsl(var(--primary) / .16)}.dark .agent-office__lane.is-desk-rose{--desk-wall:hsl(var(--destructive) / .16);--desk-floor:hsl(var(--warning) / .14);--desk-aura:hsl(var(--destructive) / .14)}.dark .agent-office__lane.is-desk-graphite{--desk-wall:hsl(var(--muted-foreground) / .14);--desk-floor:hsl(var(--foreground) / .1);--desk-aura:hsl(var(--muted-foreground) / .12)}.agent-office__lane:hover{box-shadow:0 13px 34px hsl(var(--shadow-color) / .1);transform:translateY(-1px)}.agent-office__lane.is-active{border-color:hsl(var(--primary) / .38);box-shadow:0 12px 34px hsl(var(--primary) / .09)}.agent-office__lane.is-failed{border-color:hsl(var(--destructive) / .42)}.agent-office__identity{border-right:1px solid var(--office-line);background:linear-gradient(145deg, var(--desk-aura), transparent 68%);flex-direction:column;justify-content:center;min-width:0;padding:16px;display:flex}.agent-office__identity-line{align-items:center;gap:8px;min-width:0;display:flex}.agent-office__identity-line strong{font:500 13px / 1.25 var(--font-display);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__status-dot{background:hsl(var(--muted-foreground) / .52);border-radius:999px;flex:none;width:7px;height:7px}.agent-office__status-dot.is-active{background:hsl(var(--success));box-shadow:0 0 0 4px hsl(var(--success) / .1)}.agent-office__status-dot.is-failed{background:hsl(var(--destructive));box-shadow:0 0 0 4px hsl(var(--destructive) / .1)}.agent-office__role{color:hsl(var(--primary));font:500 10px / 1 var(--font-mono);letter-spacing:.12em;margin:6px 0 16px 15px}.agent-office__agent-meta{flex-wrap:wrap;gap:5px;display:flex}.agent-office__agent-meta span{max-width:100%;color:hsl(var(--muted-foreground));background:hsl(var(--muted) / .75);font:400 10px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;border-radius:5px;padding:3px 6px;overflow:hidden}.agent-office__agent-task{border:1px solid hsl(var(--primary) / .2);width:100%;min-width:0;color:hsl(var(--foreground));background:hsl(var(--primary) / .055);text-align:left;border-radius:7px;align-items:center;gap:6px;margin-top:8px;padding:5px 6px;display:flex}.agent-office__agent-task:hover{border-color:hsl(var(--primary) / .4);background:hsl(var(--primary) / .09)}.agent-office__agent-task:not(.is-missing){animation:.46s cubic-bezier(.16,.82,.28,1) agent-office-task-assigned}.agent-office__agent-task.is-missing{color:hsl(var(--muted-foreground));background:hsl(var(--muted) / .3);border-style:dashed}.agent-office__agent-task.is-missing>svg{color:hsl(var(--warning));animation:1.8s ease-in-out infinite agent-office-telemetry-wait}.agent-office__agent-task>svg{width:13px;height:13px;color:hsl(var(--primary));flex:none}.agent-office__agent-task>span{flex-direction:column;gap:2px;min-width:0;display:flex}.agent-office__agent-task strong{color:hsl(var(--primary));font:500 8px / 1 var(--font-mono);letter-spacing:.09em}.agent-office__agent-task small{font:400 10px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__identity-mail{border:1px solid hsl(var(--info) / .18);width:100%;min-width:0;color:hsl(var(--muted-foreground));background:hsl(var(--info) / .055);text-align:left;border-radius:7px;align-items:center;gap:6px;margin-top:8px;padding:5px 6px;display:flex}.agent-office__identity-mail:hover{border-color:hsl(var(--info) / .34);background:hsl(var(--info) / .09)}.agent-office__identity-mail.is-unread{border-color:hsl(var(--info) / .38);color:hsl(var(--foreground))}.agent-office__identity-mail>svg{width:13px;height:13px;color:hsl(var(--info));flex:none}.agent-office__identity-mail>span{flex-direction:column;gap:2px;min-width:0;display:flex}.agent-office__identity-mail strong{font:500 9px / 1 var(--font-mono);letter-spacing:.08em}.agent-office__identity-mail small{max-width:100%;font:400 10px / 1.15 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__scene{background:linear-gradient(to bottom, var(--desk-wall) 0 68%, transparent 68%), linear-gradient(165deg, transparent 0 72%, var(--desk-floor) 72% 100%);min-width:0;position:relative;overflow:hidden}.agent-office__scene:after{pointer-events:none;content:"";border-top:1px solid hsl(var(--border) / .55);background-image:repeating-linear-gradient(90deg, transparent 0 54px, hsl(var(--border) / .26) 54px 55px);transform-origin:bottom;height:29%;position:absolute;bottom:0;left:0;right:0;transform:perspective(170px)rotateX(4deg)}.agent-office__window{border:1px solid hsl(var(--border));background:hsl(var(--card));width:70px;height:37px;box-shadow:inset 0 -10px 18px hsl(var(--info) / .08);border-radius:5px;gap:3px;padding:4px;display:flex;position:absolute;top:14px;left:15px}.agent-office__window span{background:linear-gradient(160deg, color-mix(in srgb, var(--desk-screen) 23%, transparent), hsl(var(--primary) / .04));border-radius:2px;flex:1;animation:8s ease-in-out infinite alternate agent-office-window-glow}.agent-office__window span:nth-child(2){animation-delay:-2.4s}.agent-office__window span:nth-child(3){animation-delay:-4.8s}.agent-office__plant{z-index:3;width:25px;height:41px;position:absolute;bottom:29px;left:9px}.agent-office__plant:after{content:"";background:var(--desk-decor);border-radius:3px 3px 8px 8px;width:18px;height:16px;position:absolute;bottom:0;left:4px}.agent-office__plant span,.agent-office__plant i,.agent-office__plant b{--plant-angle:0deg;--plant-scale:1;background:hsl(var(--success) / .72);width:8px;height:23px;transform:rotate(var(--plant-angle)) scale(var(--plant-scale));transform-origin:bottom;border-radius:100% 0;position:absolute;bottom:14px;left:10px}.agent-office__plant i{--plant-angle:-40deg}.agent-office__plant b{--plant-angle:43deg;--plant-scale:.86}.agent-office__plant span,.agent-office__plant i,.agent-office__plant b{animation:4.8s ease-in-out infinite alternate agent-office-plant-sway}.agent-office__plant i{animation-delay:-1.3s}.agent-office__plant b{animation-delay:-2.6s}.agent-office__desk-zone{z-index:4;width:128px;position:absolute;top:18px;bottom:19px;left:30px}.agent-office__desk{z-index:5;background:var(--desk-top);width:84px;height:9px;box-shadow:0 25px 0 -3px var(--desk-edge);border-radius:3px;position:absolute;bottom:29px;right:0}.agent-office__desk:before,.agent-office__desk:after{content:"";background:var(--desk-leg);width:5px;height:38px;position:absolute;top:7px}.agent-office__desk:before{left:7px}.agent-office__desk:after{right:7px}.agent-office__monitor{z-index:7;border:3px solid hsl(var(--foreground) / .8);width:48px;height:34px;color:var(--desk-screen);background:hsl(var(--background));box-shadow:inset 0 0 12px color-mix(in srgb, var(--desk-screen) 18%, transparent);border-radius:5px;place-items:center;display:grid;position:absolute;bottom:38px;right:22px}.agent-office__lane.is-active .agent-office__monitor:before{pointer-events:none;content:"";opacity:.46;background:linear-gradient(to bottom, transparent 0 42%, color-mix(in srgb, var(--desk-screen) 28%, transparent) 48% 54%, transparent 60% 100%);background-size:100% 220%;border-radius:2px;animation:2.2s linear infinite agent-office-monitor-scan;position:absolute;inset:3px}.agent-office__monitor:after{content:"";background:hsl(var(--foreground) / .72);width:4px;height:8px;position:absolute;bottom:-10px;left:20px}.agent-office__monitor>svg{width:15px;height:15px}.agent-office__monitor .agent-office__tool-glyph{width:23px;height:23px;box-shadow:none;background:0 0;border:0}.agent-office__monitor .agent-office__tool-glyph>svg{width:14px;height:14px}.agent-office__monitor .agent-office__file-underlay{display:none}.agent-office__activity-fx{z-index:9;pointer-events:none;opacity:0;width:58px;height:42px;position:absolute;bottom:35px;right:16px}.agent-office__activity-fx>span,.agent-office__activity-fx>i,.agent-office__activity-fx>b{display:block;position:absolute}.agent-office__scene.is-tool-terminal .agent-office__activity-fx{opacity:.8}.agent-office__scene.is-tool-terminal .agent-office__activity-fx>span,.agent-office__scene.is-tool-terminal .agent-office__activity-fx>i,.agent-office__scene.is-tool-terminal .agent-office__activity-fx>b{background:var(--desk-screen);border-radius:2px;width:2px;height:5px;animation:.85s ease-in-out infinite alternate agent-office-terminal-bars;bottom:10px;left:17px}.agent-office__scene.is-tool-terminal .agent-office__activity-fx>i{height:10px;animation-delay:-.42s;left:25px}.agent-office__scene.is-tool-terminal .agent-office__activity-fx>b{height:7px;animation-delay:-.7s;left:33px}.agent-office__scene.is-tool-web .agent-office__activity-fx{opacity:.7}.agent-office__scene.is-tool-web .agent-office__activity-fx>span,.agent-office__scene.is-tool-web .agent-office__activity-fx>i,.agent-office__scene.is-tool-web .agent-office__activity-fx>b{border:1px solid var(--desk-screen);border-bottom-color:#0000;border-left-color:#0000;border-radius:50%;width:12px;height:12px;animation:1.8s ease-out infinite agent-office-web-signal;top:1px;right:-2px;transform:rotate(-38deg)}.agent-office__scene.is-tool-web .agent-office__activity-fx>i{width:20px;height:20px;animation-delay:-.6s;top:-3px;right:-6px}.agent-office__scene.is-tool-web .agent-office__activity-fx>b{width:28px;height:28px;animation-delay:-1.2s;top:-7px;right:-10px}.agent-office__scene:is(.is-tool-read,.is-tool-search) .agent-office__activity-fx{opacity:.78}.agent-office__scene:is(.is-tool-read,.is-tool-search) .agent-office__activity-fx>span{border:2px solid var(--desk-screen);border-radius:50%;width:14px;height:14px;animation:1.65s ease-in-out infinite alternate agent-office-inspect;top:-3px;left:4px}.agent-office__scene:is(.is-tool-read,.is-tool-search) .agent-office__activity-fx>i{background:var(--desk-screen);border-radius:2px;width:9px;height:2px;animation:1.65s ease-in-out infinite alternate agent-office-inspect-handle;top:10px;left:16px;transform:rotate(42deg)}.agent-office__scene:is(.is-tool-read,.is-tool-search) .agent-office__activity-fx>b{border:1px solid color-mix(in srgb, var(--desk-screen) 58%, transparent);background:repeating-linear-gradient(to bottom, transparent 0 3px, color-mix(in srgb, var(--desk-screen) 32%, transparent) 3px 4px);border-radius:2px;width:12px;height:16px;top:1px;left:31px}.agent-office__scene:is(.is-tool-write,.is-tool-edit) .agent-office__activity-fx{opacity:.78}.agent-office__scene:is(.is-tool-write,.is-tool-edit) .agent-office__activity-fx>span{border-bottom:1px solid color-mix(in srgb, var(--desk-screen) 62%, transparent);background:repeating-linear-gradient(to bottom, transparent 0 3px, color-mix(in srgb, var(--desk-screen) 24%, transparent) 3px 4px);width:22px;height:8px;bottom:-2px;right:5px}.agent-office__scene:is(.is-tool-write,.is-tool-edit) .agent-office__activity-fx>i{background:var(--desk-screen);transform-origin:100%;border-radius:4px 1px 1px 4px;width:17px;height:3px;animation:.72s ease-in-out infinite alternate agent-office-write-stroke;bottom:3px;right:12px;transform:rotate(-27deg)}.agent-office__scene:is(.is-tool-write,.is-tool-edit) .agent-office__activity-fx>b{background:var(--desk-screen);border-radius:50%;width:3px;height:3px;bottom:1px;right:27px}.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx{opacity:.72}.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>span,.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>i,.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>b{border:1px solid var(--desk-screen);background:color-mix(in srgb, var(--desk-screen) 15%, transparent);border-radius:2px;width:6px;height:6px;animation:1.8s ease-in-out infinite agent-office-memory-pulse;top:-1px;right:0}.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>i{animation-delay:-.6s;top:8px;right:-5px}.agent-office__scene:is(.is-tool-memory,.is-tool-other) .agent-office__activity-fx>b{animation-delay:-1.2s;top:14px;right:4px}.agent-office__desk-lamp{z-index:8;background:var(--desk-leg);transform-origin:bottom;border-radius:3px;width:3px;height:25px;position:absolute;bottom:39px;right:76px;transform:rotate(8deg)}.agent-office__desk-lamp:before{content:"";background:var(--desk-decor);width:16px;height:10px;box-shadow:0 7px 11px color-mix(in srgb, var(--desk-decor) 20%, transparent);border-radius:8px 8px 3px 3px;position:absolute;top:-4px;left:-7px;transform:rotate(-12deg)}.agent-office__desk-lamp:after{content:"";background:var(--desk-leg);border-radius:4px;width:13px;height:3px;position:absolute;bottom:-2px;right:-5px}.agent-office__desk-clutter{z-index:8;background:hsl(var(--card));width:18px;height:7px;box-shadow:0 -3px 0 -1px var(--desk-decor), 0 1px 2px hsl(var(--shadow-color) / .12);border-radius:2px;position:absolute;bottom:39px;right:61px;transform:rotate(-3deg)}.agent-office__desk-clutter>i,.agent-office__desk-clutter>b{background:var(--desk-decor);border-radius:2px;width:2px;height:10px;position:absolute;bottom:8px;right:2px;transform:rotate(12deg)}.agent-office__desk-clutter>b{background:var(--desk-screen);height:8px;right:6px;transform:rotate(-5deg)}.agent-office__desk-charm{z-index:8;width:15px;height:14px;color:var(--desk-decor);display:block;position:absolute;bottom:11px;right:-6px}.agent-office__desk-charm.is-bot{background:color-mix(in srgb, var(--desk-decor) 18%, hsl(var(--card)));border:1px solid;border-radius:4px}.agent-office__desk-charm.is-bot:before,.agent-office__desk-charm.is-bot:after{content:"";background:currentColor;border-radius:50%;width:2px;height:2px;animation:4.1s ease-in-out infinite agent-office-charm-blink;position:absolute;top:4px}.agent-office__desk-charm.is-bot:before{left:3px}.agent-office__desk-charm.is-bot:after{right:3px}.agent-office__desk-charm.is-bot>i{background:currentColor;width:1px;height:5px;position:absolute;top:-5px;left:6px}.agent-office__desk-charm.is-cactus:before{content:"";background:hsl(var(--success) / .74);width:7px;height:12px;box-shadow:-4px 4px 0 -2px hsl(var(--success) / .74);border-radius:6px 6px 2px 2px;position:absolute;bottom:4px;right:4px}.agent-office__desk-charm.is-cactus:after{content:"";background:var(--desk-decor);border-radius:2px 2px 5px 5px;width:13px;height:5px;position:absolute;bottom:0;right:1px}.agent-office__desk-charm.is-duck:before{content:"";background:hsl(var(--warning) / .82);border-radius:65% 48% 48% 55%;width:14px;height:9px;animation:3.6s ease-in-out infinite agent-office-charm-bob;position:absolute;bottom:0;right:0}.agent-office__desk-charm.is-duck:after{content:"";background:hsl(var(--warning) / .82);width:8px;height:8px;box-shadow:-3px 4px 0 -2px hsl(var(--destructive) / .72);border-radius:50%;animation:3.6s ease-in-out infinite agent-office-charm-bob;position:absolute;top:0;left:1px}.agent-office__desk-charm.is-radio{background:hsl(var(--card));box-shadow:inset 5px 0 0 color-mix(in srgb, var(--desk-decor) 18%, transparent);border:1px solid;border-radius:3px}.agent-office__desk-charm.is-radio:before{content:"";border:1px dotted;border-radius:50%;width:5px;height:5px;position:absolute;top:3px;right:2px}.agent-office__desk-charm.is-radio:after{content:"";transform-origin:bottom;background:currentColor;width:1px;height:7px;position:absolute;top:-6px;left:3px;transform:rotate(-20deg)}.agent-office__lane.is-clutter-0 .agent-office__desk-lamp,.agent-office__lane.is-clutter-1 .agent-office__desk-clutter{display:none}.agent-office__lane.is-layout-1 .agent-office__desk-zone{left:39px}.agent-office__lane.is-layout-1 .agent-office__window{border-radius:14px 14px 5px 5px;width:49px}.agent-office__lane.is-layout-1 .agent-office__desk{border-radius:8px 3px 3px 8px;width:91px;transform:rotate(.7deg)}.agent-office__lane.is-layout-2 .agent-office__desk-zone{left:22px}.agent-office__lane.is-layout-2 .agent-office__desk{border-radius:2px 9px 2px 2px;height:11px;bottom:31px}.agent-office__lane.is-layout-2 .agent-office__desk:before{width:3px;left:17px}.agent-office__lane.is-layout-2 .agent-office__desk:after{width:3px;right:16px}.agent-office__lane.is-layout-2 .agent-office__plant{transform-origin:bottom;transform:scale(.78)}.agent-office__lane.is-layout-3 .agent-office__window{border-radius:3px;width:78px;height:29px;transform:rotate(-1deg)}.agent-office__lane.is-layout-3 .agent-office__window span:nth-child(2){flex:1.8}.agent-office__lane.is-layout-3 .agent-office__desk{border-radius:10px 2px 6px;width:78px;height:12px}.agent-office__lane.is-layout-3 .agent-office__plant{left:139px}.agent-office__mug{z-index:8;background:hsl(var(--primary) / .55);border-radius:2px 2px 4px 4px;width:11px;height:13px;position:absolute;bottom:39px;right:4px}.agent-office__mug:after{content:"";border:2px solid hsl(var(--primary) / .55);border-left:0;border-radius:0 5px 5px 0;width:6px;height:7px;position:absolute;top:3px;right:-5px}.agent-office__mug>i,.agent-office__mug>b{content:"";border-left:1px solid hsl(var(--muted-foreground) / .42);opacity:0;border-radius:50%;width:5px;height:8px;animation:3.4s ease-in-out infinite agent-office-mug-steam;position:absolute;top:-9px;left:2px}.agent-office__mug>b{animation-delay:-1.55s;left:6px}.agent-office__mug.is-leader{background:hsl(var(--warning) / .82);width:14px;box-shadow:inset 0 3px 0 hsl(var(--background) / .22)}.agent-office__mug.is-leader:before{content:"";background:hsl(var(--warning));clip-path:polygon(0 100%,0 0,30% 65%,50% 0,70% 65%,100% 0,100% 100%);width:10px;height:5px;position:absolute;top:-5px;left:2px}.agent-office__mug.is-leader:after{border-color:hsl(var(--warning) / .82)}.agent-office__mug.is-builder{background:hsl(var(--success) / .72);border-radius:3px;width:10px;height:18px}.agent-office__mug.is-builder:after{display:none}.agent-office__mug.is-researcher{background:hsl(var(--info) / .66);border-radius:3px 3px 7px 7px;width:15px;height:14px}.agent-office__mug.is-researcher:after{border-color:hsl(var(--info) / .66)}.agent-office__mug.is-reviewer{background:hsl(var(--warning) / .68);border-radius:2px 2px 5px 5px;width:10px;height:8px;bottom:39px;right:7px}.agent-office__mug.is-reviewer:after{border-color:hsl(var(--warning) / .68);width:5px;height:5px;top:1px;right:-4px}.agent-office__mug.is-planner{background:hsl(var(--primary) / .64);box-shadow:-8px -3px 0 -3px hsl(var(--foreground) / .72)}.agent-office__mug.is-operator{background:hsl(var(--muted-foreground) / .62)}.agent-office__mug.is-operator:after{border-color:hsl(var(--muted-foreground) / .62)}.agent-office__avatar{--avatar-shirt:hsl(var(--primary) / .72);--avatar-accent:hsl(var(--primary));--avatar-skin:hsl(var(--warning) / .42);--avatar-skin-shadow:hsl(var(--warning) / .14);--avatar-hair:hsl(var(--foreground) / .78);--avatar-cycle:7.2s;--avatar-delay:-.4s;--avatar-type-speed:.72s;z-index:6;width:58px;height:78px;position:absolute;bottom:25px;left:0}.agent-office__avatar-chair{background:var(--desk-chair);border-radius:15px 15px 8px 8px;width:41px;height:49px;position:absolute;bottom:2px;left:5px;transform:rotate(-3deg)}.agent-office__avatar-body{background:var(--avatar-shirt);border-radius:12px 12px 8px 8px;width:34px;height:35px;position:absolute;bottom:15px;left:14px}.agent-office__avatar-head{background:var(--avatar-skin);width:31px;height:32px;box-shadow:inset 0 -3px 0 var(--avatar-skin-shadow);border-radius:48% 48% 44% 44%;position:absolute;top:4px;left:15px}.agent-office__avatar-hair{background:var(--avatar-hair);border-radius:15px 14px 4px 7px;height:13px;position:absolute;inset:-2px 2px auto 0}.agent-office__avatar.is-avatar-1{--avatar-skin:color-mix(in srgb, hsl(var(--warning)) 72%, hsl(var(--foreground)));--avatar-skin-shadow:color-mix(in srgb, var(--avatar-skin) 72%, transparent);--avatar-hair:hsl(var(--primary) / .76)}.agent-office__avatar.is-avatar-1 .agent-office__avatar-hair{clip-path:polygon(0 0,100% 0,100% 68%,70% 42%,48% 100%,31% 43%,0 72%);border-radius:17px 15px 8px 3px;height:17px;inset:-3px -1px auto}.agent-office__avatar.is-avatar-2{--avatar-skin:color-mix(in srgb, hsl(var(--warning)) 63%, hsl(var(--background)));--avatar-skin-shadow:hsl(var(--warning) / .12);--avatar-hair:hsl(var(--foreground) / .7)}.agent-office__avatar.is-avatar-2 .agent-office__avatar-hair{background:radial-gradient(circle at 15% 58%, var(--avatar-hair) 0 4px, transparent 4.5px), radial-gradient(circle at 38% 34%, var(--avatar-hair) 0 5px, transparent 5.5px), radial-gradient(circle at 64% 38%, var(--avatar-hair) 0 5px, transparent 5.5px), radial-gradient(circle at 87% 62%, var(--avatar-hair) 0 4px, transparent 4.5px);border-radius:11px 13px 4px 7px;width:32px;height:15px;inset:-4px -1px auto}.agent-office__avatar.is-avatar-3{--avatar-skin:color-mix(in srgb, hsl(var(--warning)) 58%, hsl(var(--primary)));--avatar-skin-shadow:hsl(var(--primary) / .13);--avatar-hair:hsl(var(--muted-foreground) / .84)}.agent-office__avatar.is-avatar-3 .agent-office__avatar-hair{border-radius:14px 14px 3px 7px;height:9px;inset:-1px 3px auto 0}.agent-office__avatar.is-avatar-3 .agent-office__avatar-hair:after{content:"";background:var(--avatar-hair);border-radius:50%;width:11px;height:11px;position:absolute;top:-7px;right:-3px}.agent-office__avatar.is-avatar-4{--avatar-skin:color-mix(in srgb, hsl(var(--warning)) 78%, hsl(var(--background)));--avatar-skin-shadow:hsl(var(--warning) / .1);--avatar-hair:hsl(var(--foreground) / .66)}.agent-office__avatar.is-avatar-4 .agent-office__avatar-hair{background:repeating-linear-gradient(90deg, var(--avatar-hair) 0 2px, transparent 2px 4px);border-radius:50% 50% 2px 2px;height:5px;inset:0 2px auto 1px}.agent-office__avatar.is-avatar-5{--avatar-skin:hsl(var(--info) / .46);--avatar-skin-shadow:hsl(var(--info) / .31);--avatar-hair:hsl(var(--info) / .78)}.agent-office__avatar.is-avatar-5 .agent-office__avatar-hair{clip-path:polygon(0 0,100% 0,100% 100%,83% 55%,66% 100%,50% 55%,33% 100%,16% 55%,0 100%);border-radius:3px 3px 1px 1px;height:8px;inset:-2px 1px auto}.agent-office__avatar.is-motion-1{--avatar-cycle:8.6s;--avatar-delay:-3.1s;--avatar-type-speed:.58s}.agent-office__avatar.is-motion-2{--avatar-cycle:6.8s;--avatar-delay:-5.2s;--avatar-type-speed:.84s}.agent-office__avatar.is-motion-3{--avatar-cycle:9.4s;--avatar-delay:-1.7s;--avatar-type-speed:.66s}.agent-office__avatar-face:before,.agent-office__avatar-face:after{content:"";background:hsl(var(--foreground) / .7);width:2px;height:2px;animation:5.2s ease-in-out infinite agent-office-blink;animation-delay:var(--avatar-delay);border-radius:50%;position:absolute;top:17px}.agent-office__avatar-face:before{left:9px}.agent-office__avatar-face:after{right:9px}.agent-office__avatar-mouth{background:hsl(var(--foreground) / .58);transform-origin:50%;border-radius:50%;width:6px;height:2px;position:absolute;bottom:6px;left:13px}.agent-office__avatar-headset{border:2px solid hsl(var(--foreground) / .72);border-bottom:0;border-radius:15px 15px 0 0;height:20px;position:absolute;inset:5px -4px auto}.agent-office__avatar-headset:after{content:"";background:hsl(var(--foreground) / .72);border-radius:3px;width:5px;height:9px;position:absolute;bottom:-3px;right:-3px}.agent-office__avatar-arm{z-index:8;background:var(--avatar-shirt);transform-origin:0;border-radius:8px;width:29px;height:8px;position:absolute;bottom:29px;right:0;transform:rotate(-11deg)}.agent-office__avatar-role-badge{z-index:10;border:2px solid hsl(var(--card));width:18px;height:18px;color:hsl(var(--primary-foreground));background:var(--avatar-accent);box-shadow:0 2px 6px hsl(var(--shadow-color) / .18);border-radius:50%;place-items:center;display:grid;position:absolute;bottom:4px;left:18px}.agent-office__avatar-role-badge svg{width:9px;height:9px}.agent-office__avatar-prop{z-index:11;pointer-events:none;position:absolute}.agent-office__avatar.is-leader{--avatar-shirt:hsl(var(--primary) / .86);--avatar-accent:hsl(var(--warning))}.agent-office__avatar.is-leader .agent-office__avatar-prop{background:hsl(var(--warning));clip-path:polygon(0 100%,0 25%,25% 65%,50% 0,75% 65%,100% 25%,100% 100%);width:23px;height:11px;filter:drop-shadow(0 2px 2px hsl(var(--shadow-color) / .16));top:-3px;left:19px}.agent-office__avatar.is-builder{--avatar-shirt:hsl(var(--success) / .7);--avatar-accent:hsl(var(--success))}.agent-office__avatar.is-builder .agent-office__avatar-body{box-shadow:inset 0 4px 0 hsl(var(--background) / .18);border-radius:16px 16px 7px 7px}.agent-office__avatar.is-builder .agent-office__avatar-prop{background:hsl(var(--warning));border-radius:4px;width:23px;height:4px;bottom:20px;right:0;transform:rotate(-38deg)}.agent-office__avatar.is-researcher{--avatar-shirt:hsl(var(--info) / .68);--avatar-accent:hsl(var(--info))}.agent-office__avatar.is-researcher .agent-office__avatar-prop{border:3px solid hsl(var(--info));border-radius:50%;width:14px;height:14px;top:14px;right:2px}.agent-office__avatar.is-researcher .agent-office__avatar-prop:after{content:"";background:hsl(var(--info));border-radius:3px;width:9px;height:3px;position:absolute;bottom:-5px;right:-7px;transform:rotate(48deg)}.agent-office__avatar.is-reviewer{--avatar-shirt:hsl(var(--warning) / .64);--avatar-accent:hsl(var(--warning))}.agent-office__avatar.is-reviewer .agent-office__avatar-prop{border:2px solid hsl(var(--foreground) / .76);width:11px;height:7px;box-shadow:12px 0 0 -2px hsl(var(--warning) / .35), 12px 0 0 0 hsl(var(--foreground) / .76);border-radius:5px;top:18px;left:17px}.agent-office__avatar.is-planner{--avatar-shirt:hsl(var(--primary) / .56);--avatar-accent:hsl(var(--primary))}.agent-office__avatar.is-planner .agent-office__avatar-hair{border-radius:4px 15px 10px 4px;transform:rotate(-5deg)}.agent-office__avatar.is-planner .agent-office__avatar-prop{border:2px solid hsl(var(--primary));background:hsl(var(--card));width:18px;height:24px;box-shadow:inset 0 5px 0 hsl(var(--primary) / .15);border-radius:3px;bottom:16px;right:-1px;transform:rotate(8deg)}.agent-office__avatar.is-operator{--avatar-shirt:hsl(var(--muted-foreground) / .62);--avatar-accent:hsl(var(--muted-foreground))}.agent-office__avatar.is-active .agent-office__avatar-arm{animation:agent-office-type var(--avatar-type-speed) ease-in-out infinite alternate;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-active .agent-office__avatar-head{animation:2.6s ease-in-out infinite agent-office-nod;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-idle .agent-office__avatar-head{animation:agent-office-yawn-head var(--avatar-cycle) ease-in-out infinite;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-idle .agent-office__avatar-mouth{animation:agent-office-yawn-mouth var(--avatar-cycle) ease-in-out infinite;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-idle .agent-office__avatar-arm{animation:agent-office-idle-stretch var(--avatar-cycle) ease-in-out infinite;animation-delay:var(--avatar-delay)}.agent-office__avatar.is-failed .agent-office__avatar-body{background:hsl(var(--destructive) / .72)}.agent-office__conveyor{z-index:5;place-items:center;min-width:0;display:grid;position:absolute;inset:24px 16px 22px 168px}.agent-office__belt{border:1px solid hsl(var(--border));background:repeating-linear-gradient(115deg, hsl(var(--muted)) 0 18px, hsl(var(--surface-3) / .62) 18px 35px);height:30px;box-shadow:inset 0 4px 8px hsl(var(--shadow-color) / .06);border-radius:8px;justify-content:space-around;align-items:center;display:flex;position:absolute;bottom:15px;left:0;right:0;overflow:hidden}.agent-office__belt span{border:3px solid hsl(var(--muted-foreground) / .3);background:hsl(var(--card));border-radius:50%;flex:none;width:18px;height:18px}.agent-office__conveyor.is-moving .agent-office__belt{animation:1.8s linear infinite agent-office-belt}.agent-office__current-action{z-index:3;width:min(340px,90%);margin-bottom:25px;position:relative}.agent-office__current-action>.agent-office__parcel{animation:.52s cubic-bezier(.2,.8,.2,1) agent-office-arrive}.agent-office__parcel{border:1px solid hsl(var(--border));width:100%;min-width:0;color:hsl(var(--foreground));text-align:left;background:hsl(var(--card));box-shadow:0 9px 22px hsl(var(--shadow-color) / .12);cursor:pointer;border-radius:10px;align-items:center;gap:10px;padding:10px;transition:transform .15s,border-color .15s,box-shadow .15s;display:flex;position:relative}button.agent-office__parcel:hover{border-color:hsl(var(--primary) / .45);box-shadow:0 12px 26px hsl(var(--shadow-color) / .16);transform:translateY(-2px)}.agent-office__parcel.is-running{border-color:hsl(var(--primary) / .52);box-shadow:0 10px 26px hsl(var(--primary) / .14)}.agent-office__parcel.is-failed{border-color:hsl(var(--destructive) / .48)}.agent-office__parcel.is-compact{min-height:38px;box-shadow:none;border-radius:7px;gap:7px;padding:6px 7px}.agent-office__parcel--empty{cursor:default;color:hsl(var(--muted-foreground));background:hsl(var(--card) / .65);box-shadow:none;border-style:dashed}.agent-office__mail-parcel{border:1px solid hsl(var(--info) / .34);width:100%;min-width:0;color:hsl(var(--foreground));text-align:left;background:hsl(var(--card));box-shadow:0 8px 22px hsl(var(--info) / .12);cursor:pointer;border-radius:8px;align-items:center;gap:8px;padding:7px 8px;display:flex;position:relative}.agent-office__mail-parcel:hover{border-color:hsl(var(--info) / .58)}.agent-office__mail-parcel.is-outgoing{border-color:hsl(var(--success) / .36)}.agent-office__mail-parcel.is-unread:after{content:"";background:hsl(var(--info));width:5px;height:5px;box-shadow:0 0 0 3px hsl(var(--info) / .12);border-radius:50%;position:absolute;top:5px;right:5px}.agent-office__mail-parcel>svg{width:12px;height:12px;color:hsl(var(--info));flex:none}.agent-office__mail-icon{width:27px;height:27px;color:hsl(var(--info));background:hsl(var(--info) / .1);border-radius:6px;flex:none;place-items:center;display:grid}.agent-office__mail-icon svg{width:13px;height:13px}.agent-office__mail-parcel.is-outgoing .agent-office__mail-icon{color:hsl(var(--success));background:hsl(var(--success) / .1)}.agent-office__mail-flyby{z-index:12;width:min(190px,42%);position:absolute;top:8px;right:9px}.agent-office__mail-flyby.is-incoming{animation:.65s cubic-bezier(.16,.82,.28,1) agent-office-mail-in}.agent-office__mail-flyby.is-outgoing{animation:.65s cubic-bezier(.16,.82,.28,1) agent-office-mail-out}.agent-office__tool-glyph{border:1px solid hsl(var(--border));width:36px;height:36px;color:hsl(var(--muted-foreground));background:hsl(var(--muted));border-radius:9px;flex:none;place-items:center;display:grid;position:relative}.agent-office__tool-glyph>svg{z-index:2;width:17px;height:17px;position:relative}.agent-office__tool-glyph.is-read{color:hsl(var(--info));background:hsl(var(--info) / .1);border-color:hsl(var(--info) / .25)}.agent-office__tool-glyph.is-read>svg:not(.agent-office__file-underlay){width:13px;height:13px;transform:translate(5px,5px)}.agent-office__tool-glyph>.agent-office__file-underlay{z-index:1;opacity:.72;width:18px;height:18px;position:absolute;transform:translate(-3px,-3px)}.agent-office__tool-glyph.is-write,.agent-office__tool-glyph.is-edit{color:hsl(var(--warning));background:hsl(var(--warning) / .1);border-color:hsl(var(--warning) / .25)}.agent-office__tool-glyph.is-terminal{color:hsl(var(--success));background:hsl(var(--success) / .1);border-color:hsl(var(--success) / .25)}.agent-office__tool-glyph.is-web{color:hsl(var(--info));background:hsl(var(--info) / .1);border-color:hsl(var(--info) / .25)}.agent-office__tool-glyph.is-search,.agent-office__tool-glyph.is-memory{color:hsl(var(--primary));background:hsl(var(--primary) / .09);border-color:hsl(var(--primary) / .24)}.dark .agent-office__tool-glyph{border-color:hsl(var(--border));color:hsl(var(--muted-foreground));background:hsl(var(--muted) / .82)}.dark .agent-office__tool-glyph.is-read,.dark .agent-office__tool-glyph.is-web{border-color:hsl(var(--info) / .38);color:hsl(var(--info));background:hsl(var(--info) / .18)}.dark .agent-office__tool-glyph.is-write,.dark .agent-office__tool-glyph.is-edit{border-color:hsl(var(--warning) / .38);color:hsl(var(--warning));background:hsl(var(--warning) / .18)}.dark .agent-office__tool-glyph.is-terminal{border-color:hsl(var(--success) / .38);color:hsl(var(--success));background:hsl(var(--success) / .18)}.dark .agent-office__tool-glyph.is-search,.dark .agent-office__tool-glyph.is-memory{border-color:hsl(var(--primary) / .38);color:hsl(var(--primary));background:hsl(var(--primary) / .17)}.dark .agent-office__monitor .agent-office__tool-glyph{background:0 0;border:0}.agent-office__tool-glyph.is-active:after{z-index:0;content:"";opacity:.25;border:1px solid;border-radius:11px;animation:1.3s ease-out infinite agent-office-ring;position:absolute;inset:-4px}.agent-office__parcel.is-compact .agent-office__tool-glyph{border-radius:6px;width:27px;height:27px}.agent-office__parcel.is-compact .agent-office__tool-glyph>svg{width:13px;height:13px}.agent-office__parcel-copy{flex-direction:column;flex:auto;gap:2px;min-width:0;display:flex}.agent-office__parcel-topline{align-items:center;gap:6px;min-width:0;display:flex}.agent-office__parcel-copy strong{font:500 10px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__parcel-target{color:hsl(var(--muted-foreground));font:400 9px / 1.25 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__parcel-summary{color:hsl(var(--foreground) / .82);text-overflow:ellipsis;white-space:nowrap;font-size:10px;overflow:hidden}.agent-office__parcel.is-compact .agent-office__parcel-target,.agent-office__parcel.is-compact .agent-office__line-chip{display:none}.agent-office__parcel.is-compact .agent-office__parcel-summary{color:hsl(var(--muted-foreground));font-size:11px}.agent-office__line-chip{color:hsl(var(--info));background:hsl(var(--info) / .09);font:500 10px / 1 var(--font-mono);border-radius:4px;flex:none;padding:2px 4px}.agent-office__parcel-state{width:18px;height:18px;color:hsl(var(--success));flex:none;place-items:center;display:grid}.agent-office__parcel-state>svg{width:12px;height:12px}.agent-office__parcel-state .agent-office__pulse-dot{color:hsl(var(--primary));background:hsl(var(--primary));box-shadow:0 0 0 4px hsl(var(--primary) / .12)}.agent-office__parcel.is-failed .agent-office__parcel-state{color:hsl(var(--destructive))}.agent-office__history{border-left:1px solid var(--office-line);background:hsl(var(--background) / .24);min-width:0;padding:11px 12px}.agent-office__history-heading{color:hsl(var(--muted-foreground));font:500 10px / 1 var(--font-mono);letter-spacing:.1em;justify-content:space-between;align-items:center;margin-bottom:7px;display:flex}.agent-office__history-heading span:last-child{letter-spacing:0}.agent-office__history-list{scrollbar-color:hsl(var(--border)) transparent;scrollbar-width:thin;flex-direction:column;gap:5px;max-height:146px;padding-right:3px;display:flex;overflow-y:auto}.agent-office__history-empty{min-height:88px;color:hsl(var(--muted-foreground));place-items:center;font-size:10px;font-style:italic;display:grid}.agent-office__footer{z-index:4;border-top:1px solid var(--office-line);min-height:31px;color:hsl(var(--muted-foreground));background:hsl(var(--card) / .9);font:400 9px / 1 var(--font-mono);align-items:center;gap:18px;padding:5px 15px;display:flex;position:relative}.agent-office__footer>span{align-items:center;gap:6px;display:flex}.agent-office__footer svg{width:12px;height:12px}.agent-office__empty-state{text-align:center;place-content:center;justify-items:center;min-height:360px;display:grid}.agent-office__empty-state>span{border:1px dashed hsl(var(--border));width:64px;height:64px;color:hsl(var(--primary));background:hsl(var(--primary) / .06);border-radius:18px;place-items:center;margin-bottom:15px;display:grid}.agent-office__empty-state h2{font:500 16px / 1.3 var(--font-display);margin:0 0 5px}.agent-office__empty-state p{color:hsl(var(--muted-foreground));margin:0;font-size:11px}.agent-office__detail-backdrop{z-index:39;background:hsl(var(--background) / .44);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);cursor:default;border:0;position:absolute;inset:0}.agent-office__detail{z-index:40;border-left:1px solid hsl(var(--border));width:min(410px,94%);color:hsl(var(--foreground));background:hsl(var(--background));box-shadow:-20px 0 55px hsl(var(--shadow-color) / .24);animation:.22s ease-out agent-office-drawer;position:absolute;top:0;bottom:0;right:0;overflow-y:auto}.agent-office__detail-header{z-index:2;border-bottom:1px solid hsl(var(--border));background:hsl(var(--card) / .95);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);align-items:center;gap:10px;padding:14px;display:flex;position:sticky;top:0}.agent-office__detail-header h2{font:500 15px / 1.2 var(--font-display);margin:3px 0 0}.agent-office__detail-header>button{border:1px solid hsl(var(--border));width:30px;height:30px;color:hsl(var(--muted-foreground));background:hsl(var(--background));cursor:pointer;border-radius:7px;place-items:center;margin-left:auto;display:grid}.agent-office__detail-header>button:hover{color:hsl(var(--foreground));background:hsl(var(--accent))}.agent-office__detail-header>button svg{width:14px;height:14px}.agent-office__detail-icon{width:38px;height:38px;color:hsl(var(--primary));background:hsl(var(--primary) / .1);border-radius:10px;place-items:center;display:grid}.agent-office__detail-icon.is-terminal{color:hsl(var(--success));background:hsl(var(--success) / .1)}.agent-office__detail-icon.is-read,.agent-office__detail-icon.is-web{color:hsl(var(--info));background:hsl(var(--info) / .1)}.agent-office__detail-icon.is-edit,.agent-office__detail-icon.is-write{color:hsl(var(--warning));background:hsl(var(--warning) / .1)}.agent-office__detail-icon.is-mail{color:hsl(var(--info));background:hsl(var(--info) / .1)}.agent-office__detail-icon.is-task,.agent-office__detail-icon.is-briefing{color:hsl(var(--primary));background:hsl(var(--primary) / .1)}.agent-office__detail-icon svg{width:18px;height:18px}.agent-office__detail-status{border:1px solid hsl(var(--border));background:hsl(var(--card));border-radius:9px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:9px;margin:14px;padding:11px;display:grid}.agent-office__detail-status strong{text-overflow:ellipsis;white-space:nowrap;font-size:11px;overflow:hidden}.agent-office__detail-status>span:last-child{color:hsl(var(--muted-foreground));background:hsl(var(--muted));font:500 10px / 1 var(--font-mono);text-transform:uppercase;border-radius:4px;padding:3px 5px}.agent-office__detail-section{border-top:1px solid hsl(var(--border) / .72);padding:12px 14px}.agent-office__detail-section h3{color:hsl(var(--muted-foreground));font:500 11px / 1 var(--font-mono);letter-spacing:.11em;text-transform:uppercase;margin:0 0 9px}.agent-office__detail-row{justify-content:space-between;align-items:baseline;gap:14px;padding:4px 0;font-size:10px;display:flex}.agent-office__detail-row>span{color:hsl(var(--muted-foreground))}.agent-office__detail-row>strong{min-width:0;font:500 10px / 1.3 var(--font-mono);text-align:right;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__target-code{overflow-wrap:anywhere;color:hsl(var(--foreground));background:hsl(var(--muted) / .7);font:400 10px / 1.45 var(--font-mono);border-radius:7px;padding:9px;display:block}.agent-office__file-target{border:1px solid hsl(var(--border) / .68);border-radius:6px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:7px;margin-top:6px;padding:7px;display:grid}.agent-office__file-target svg{width:13px;height:13px;color:hsl(var(--info))}.agent-office__file-target span{font:400 9px / 1.2 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__file-target strong{color:hsl(var(--info));font:500 10px / 1 var(--font-mono)}.agent-office__metric-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;display:grid}.agent-office__metric-grid>div{background:hsl(var(--muted) / .62);border-radius:7px;flex-direction:column;min-width:0;padding:9px;display:flex}.agent-office__metric-grid strong{font:500 12px / 1.2 var(--font-mono);text-overflow:ellipsis;overflow:hidden}.agent-office__metric-grid span{color:hsl(var(--muted-foreground));margin-top:3px;font-size:10px}.agent-office__detail-section pre{border:1px solid hsl(var(--border));max-height:260px;color:hsl(var(--foreground) / .9);background:hsl(var(--popover));font:400 9px / 1.55 var(--font-mono);white-space:pre-wrap;overflow-wrap:anywhere;border-radius:7px;margin:0;padding:10px;overflow:auto}.agent-office__mail-body{border:1px solid hsl(var(--border));color:hsl(var(--foreground) / .88);background:hsl(var(--muted) / .45);font:400 11px / 1.55 var(--font-sans);white-space:pre-wrap;border-radius:8px;padding:10px}.agent-office__task-body{border:1px solid hsl(var(--border));color:hsl(var(--foreground) / .9);background:hsl(var(--muted) / .42);font:400 11px / 1.55 var(--font-sans);white-space:pre-wrap;border-radius:8px;padding:10px}.agent-office__todo-detail-list{flex-direction:column;gap:6px;display:flex}.agent-office__todo-detail{border:1px solid hsl(var(--border));background:hsl(var(--muted) / .3);border-radius:8px;align-items:flex-start;gap:8px;padding:7px 8px;display:flex}.agent-office__todo-detail>span{border:1px solid hsl(var(--muted-foreground));border-radius:50%;flex:none;width:7px;height:7px;margin-top:3px}.agent-office__todo-detail.is-in_progress>span{border-color:hsl(var(--success));background:hsl(var(--success));box-shadow:0 0 0 3px hsl(var(--success) / .1)}.agent-office__todo-detail.is-completed{opacity:.68}.agent-office__todo-detail.is-completed>span{border-color:hsl(var(--success));background:hsl(var(--success))}.agent-office__todo-detail>div{flex-direction:column;gap:3px;min-width:0;display:flex}.agent-office__todo-detail strong{font:500 10px / 1.35 var(--font-sans)}.agent-office__todo-detail small{color:hsl(var(--muted-foreground));font:400 9px / 1 var(--font-mono);text-transform:uppercase}@keyframes agent-office-arrive{0%{opacity:.4;transform:translate(42px)rotate(1deg)}to{opacity:1;transform:translate(0)rotate(0)}}@keyframes agent-office-mail-in{0%{opacity:0;transform:translate(72px)rotate(4deg)}to{opacity:1;transform:translate(0)rotate(0)}}@keyframes agent-office-mail-out{0%{opacity:0;transform:translate(-42px)rotate(-3deg)}to{opacity:1;transform:translate(0)rotate(0)}}@keyframes agent-office-belt{to{background-position:70px 0}}@keyframes agent-office-brief-arrive{0%{left:-30%}to{left:118%}}@keyframes agent-office-sync-line{to{background-position:-200% 0}}@keyframes agent-office-telemetry-wait{0%,to{opacity:.42}50%{opacity:1}}@keyframes agent-office-task-assigned{0%{opacity:0;transform:translate(-12px)rotate(-1deg)}to{opacity:1;transform:translate(0)rotate(0)}}@keyframes agent-office-window-glow{0%{opacity:.58}to{opacity:1;box-shadow:inset 0 0 8px hsl(var(--info) / .14)}}@keyframes agent-office-plant-sway{0%{transform:rotate(calc(var(--plant-angle) - 3deg)) scale(var(--plant-scale))}to{transform:rotate(calc(var(--plant-angle) + 3deg)) scale(var(--plant-scale))}}@keyframes agent-office-monitor-scan{0%{background-position:0 -110%}to{background-position:0 110%}}@keyframes agent-office-mug-steam{0%,18%{opacity:0;transform:translateY(3px)translate(0)}42%{opacity:.55}78%,to{opacity:0;transform:translateY(-6px)translate(2px)}}@keyframes agent-office-blink{0%,44%,48%,to{transform:scaleY(1)}46%{transform:scaleY(.12)}}@keyframes agent-office-terminal-bars{0%{opacity:.42;transform:scaleY(.45)}to{opacity:1;transform:scaleY(1.15)}}@keyframes agent-office-lane-arrive{0%{opacity:0;transform:translateY(8px)scale(.992)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes agent-office-memory-pulse{0%,to{opacity:.35;transform:scale(.72)rotate(0)}50%{opacity:1;transform:scale(1.08)rotate(8deg)}}@keyframes agent-office-web-signal{0%{opacity:0;transform:rotate(-38deg)scale(.72)}45%{opacity:.82}to{opacity:0;transform:rotate(-38deg)scale(1.08)}}@keyframes agent-office-inspect{0%{transform:translate(0)rotate(-4deg)}to{transform:translate(13px,3px)rotate(5deg)}}@keyframes agent-office-inspect-handle{0%{transform:translate(0)rotate(42deg)}to{transform:translate(13px,3px)rotate(51deg)}}@keyframes agent-office-write-stroke{0%{transform:translate(-4px)rotate(-27deg)}to{transform:translate(5px)rotate(-18deg)}}@keyframes agent-office-charm-blink{0%,45%,49%,to{transform:scaleY(1)}47%{transform:scaleY(.12)}}@keyframes agent-office-charm-bob{0%,76%,to{transform:translateY(0)rotate(0)}84%,91%{transform:translateY(-2px)rotate(-5deg)}}@keyframes agent-office-yawn-head{0%,72%,to{transform:translateY(0)rotate(0)}78%,90%{transform:translateY(-2px)rotate(-7deg)}}@keyframes agent-office-yawn-mouth{0%,72%,to{height:2px;transform:scale(1)}80%,88%{height:7px;transform:scale(1.15)}}@keyframes agent-office-idle-stretch{0%,72%,to{transform:rotate(-11deg)}80%,90%{transform:translate(2px,-7px)rotate(-34deg)}}@keyframes agent-office-type{to{transform:rotate(-4deg)translateY(2px)}}@keyframes agent-office-nod{0%,70%,to{transform:rotate(0)}82%{transform:rotate(3deg)}}@keyframes agent-office-ring{0%{opacity:.42;transform:scale(.82)}to{opacity:0;transform:scale(1.18)}}@keyframes agent-office-pulse{0%,to{opacity:.55;transform:scale(.8)}50%{opacity:1;transform:scale(1)}}@keyframes agent-office-drawer{0%{opacity:.5;transform:translate(35px)}to{opacity:1;transform:translate(0)}}.agent-office__model-chip{border:1px solid hsl(var(--primary) / .3);background:hsl(var(--primary) / .08);max-width:100%;color:hsl(var(--primary));font:600 9px / 1.5 var(--font-mono);letter-spacing:.02em;text-overflow:ellipsis;white-space:nowrap;border-radius:999px;align-items:center;padding:1px 7px;display:inline-flex;overflow:hidden}.agent-office__client-desks{position:relative}.agent-office__mail-routes{z-index:6;pointer-events:none;width:44px;position:absolute;top:9px;bottom:1px;left:206px}.agent-office__mail-route{position:absolute;inset:0}.agent-office__mail-route-parcel{top:var(--from);border:1px solid hsl(var(--info) / .55);background:hsl(var(--card) / .94);width:30px;height:30px;box-shadow:0 4px 14px hsl(var(--info) / .3), 0 0 0 3px hsl(var(--info) / .08);color:hsl(var(--info));border-radius:9px;place-items:center;animation:3.8s ease-in-out infinite agent-office-mail-travel;display:grid;position:absolute;left:0}.agent-office__mail-route-parcel svg{width:15px;height:15px}@keyframes agent-office-mail-travel{0%{top:var(--from);opacity:0;transform:translateY(-50%)scale(.7)}12%{opacity:1;transform:translateY(-50%)scale(1)}86%{opacity:1}to{top:var(--to);opacity:0;transform:translateY(-50%)scale(.7)}}.agent-office__desks-empty{border:1px dashed var(--office-line);color:hsl(var(--muted-foreground));font:500 10.5px / 1.4 var(--font-mono);border-radius:12px;align-items:center;gap:8px;margin:0 9px 9px;padding:13px 14px;display:flex}.agent-office__desks-empty svg{width:14px;height:14px;color:hsl(var(--warning))}.agent-office__lounge{border:1px dashed hsl(var(--border));background:linear-gradient(160deg, hsl(var(--warning) / .05), transparent 62%), var(--office-panel);border-radius:14px;margin:2px 9px 10px;padding:10px 12px 12px}.agent-office__lounge-heading{color:hsl(var(--muted-foreground));font:600 10px / 1 var(--font-mono);letter-spacing:.09em;text-transform:uppercase;align-items:center;gap:8px;margin-bottom:9px;display:flex}.agent-office__lounge-heading svg{width:14px;height:14px;color:hsl(var(--warning))}.agent-office__lounge-heading>span{letter-spacing:0;text-transform:none;margin-left:auto;font-weight:500}.agent-office__lounge-seats{flex-wrap:wrap;gap:8px;display:flex}.agent-office__lounge-seat{border:1px solid var(--office-line);background:hsl(var(--card) / .7);cursor:pointer;text-align:left;border-radius:11px;flex:0 auto;align-items:center;gap:9px;min-width:190px;padding:7px 10px;transition:border-color .16s,box-shadow .16s,transform .16s;display:flex}.agent-office__lounge-seat:disabled{cursor:default;opacity:.72}.agent-office__lounge-seat:not(:disabled):hover{border-color:hsl(var(--primary) / .4);box-shadow:0 6px 16px hsl(var(--shadow-color) / .1);transform:translateY(-1px)}.agent-office__lounge-avatar{border:1px solid hsl(var(--border));background:hsl(var(--accent) / .5);width:28px;height:28px;color:hsl(var(--muted-foreground));border-radius:9px;flex:none;place-items:center;display:grid}.agent-office__lounge-avatar svg{width:14px;height:14px}.agent-office__lounge-seat.is-leader .agent-office__lounge-avatar{border-color:hsl(var(--primary) / .35);background:hsl(var(--primary) / .12);color:hsl(var(--primary))}.agent-office__lounge-seat.is-builder .agent-office__lounge-avatar{border-color:hsl(var(--info) / .35);background:hsl(var(--info) / .12);color:hsl(var(--info))}.agent-office__lounge-seat.is-researcher .agent-office__lounge-avatar{border-color:hsl(var(--success) / .35);background:hsl(var(--success) / .12);color:hsl(var(--success))}.agent-office__lounge-seat.is-reviewer .agent-office__lounge-avatar{border-color:hsl(var(--destructive) / .32);background:hsl(var(--destructive) / .1);color:hsl(var(--destructive))}.agent-office__lounge-seat.is-planner .agent-office__lounge-avatar{border-color:hsl(var(--warning) / .38);background:hsl(var(--warning) / .12);color:hsl(var(--warning))}.agent-office__lounge-seat.is-operator .agent-office__lounge-avatar{border-color:hsl(var(--muted-foreground) / .34);background:hsl(var(--muted-foreground) / .1);color:hsl(var(--muted-foreground))}.agent-office__lounge-copy{flex-direction:column;gap:1px;min-width:0;display:flex}.agent-office__lounge-copy strong{color:hsl(var(--foreground));text-overflow:ellipsis;white-space:nowrap;font-size:11.5px;font-weight:600;line-height:1.25;overflow:hidden}.agent-office__lounge-copy small{color:hsl(var(--muted-foreground));font:500 9px / 1.3 var(--font-mono);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-office__lounge-meta{color:hsl(var(--muted-foreground));font:500 9px / 1 var(--font-mono);align-items:center;gap:7px;margin-left:auto;display:flex}.agent-office__lounge-mail{color:hsl(var(--info));align-items:center;gap:3px;display:inline-flex}.agent-office__lounge-mail svg{width:11px;height:11px}@media (width<=1040px){.agent-office__briefing{grid-template-columns:1fr}.agent-office__client-header{flex-wrap:wrap}.agent-office__client-stats{justify-content:flex-start;width:100%}.agent-office__column-headings,.agent-office__lane{grid-template-columns:150px minmax(390px,1fr) 230px}.agent-office__mail-routes{left:176px}.agent-office__summary>div{min-width:72px}.agent-office__summary span{display:none}.agent-office__title{min-width:185px}.agent-office__title h1{max-width:200px}}@media (width<=820px){.agent-office__header{flex-wrap:wrap;gap:8px}.agent-office__summary{order:3;justify-content:flex-start;width:100%}.agent-office__summary>div{padding-block:3px}.agent-office__live-pill{margin-left:auto}.agent-office__column-headings{display:none}.agent-office__lane{grid-template-columns:132px minmax(380px,1fr)}.agent-office__mail-routes{left:158px}.agent-office__history{display:none}.agent-office__floor{overflow-x:auto}}@media (prefers-reduced-motion:reduce){.agent-office *,.agent-office :before,.agent-office :after{scroll-behavior:auto;transition-duration:.001ms;animation-duration:.001ms;animation-iteration-count:1}}
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$n as t,Ba as n,Bt as r,Ci as i,Ct as a,Ea as o,En as s,Et as c,Ga as l,Gt as u,Ji as d,Ni as f,Nt as p,Ot as m,Pa as h,Pr as g,Pt as _,Qr as v,Ti as y,Ua as b,Ut as ee,Vn as te,Wt as x,dt as S,ea as C,gi as w,gn as T,ia as E,in as D,jn as O,jt as k,lt as A,ma as j,mn as ne,mr as M,na as re,or as N,qn as P,ra as F,ut as I,xt as ie,zi as L}from"./vendor-C_zEzV4N.js";import"./i18n-DbJfY4tY.js";import{t as ae}from"./useWebSocket-D9Dy4-9x.js";import{t as R}from"./utils-tsZEnrBH.js";import{c as z,p as B,s as V}from"./stores-C0xX0jn4.js";import{n as oe}from"./ui-store-xx1NssJI.js";import{o as H}from"./view-navigation-CZKugncK.js";import{a as se,i as ce,n as U,o as W,r as le,t as G}from"./dialog-BJjDUqb3.js";import{t as K}from"./button-DvpRpKkt.js";import{n as ue,t as q}from"./ModelPicker-nyXP3xsj.js";import{c as J,s as de}from"./index-DQn-Lz9q.js";import{a as Y,c as fe,i as X,l as pe,n as me,o as he,r as ge,s as _e,t as ve,u as ye}from"./SddFlowGraph-DMSN4LTZ.js";import{SpecsView as be}from"./SpecsView-2PqHEXH9.js";var Z=e(l(),1),Q=A();function xe({feed:e,now:t}){let{t:r}=n();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs font-semibold text-foreground`,children:[(0,Q.jsx)(h,{className:`h-3.5 w-3.5 text-warning`}),r(`activity:sdd.activityHeading`)]}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 space-y-1 overflow-auto overscroll-contain p-2`,children:e.length===0?(0,Q.jsx)(`p`,{className:`px-1 pt-4 text-center text-[11px] text-muted-foreground`,children:r(`activity:sdd.feedEmpty`)}):e.map((e,n)=>{let r=ge[e.kind]??ge.started,i=r.icon;return(0,Q.jsxs)(`div`,{className:R(`sdd-rise flex items-start gap-2 rounded-md px-2 py-1.5 text-[11px]`,n===0?`bg-muted`:`hover:bg-muted`),children:[(0,Q.jsx)(i,{className:R(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.color)}),(0,Q.jsx)(`span`,{className:`flex-1 leading-snug text-foreground`,children:e.text}),(0,Q.jsx)(`span`,{className:`shrink-0 tabular-nums text-[10px] text-muted-foreground`,children:he(e.ts,t)})]},`${e.ts}-${n}`)})})]})}function Se({open:e,onOpenChange:t,snapshot:r,busy:i,onConfirm:a}){let{t:o}=n(),s=r?.mergedCommits?.length??0,c=r?.baseBranch,[l,u]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&u(!1)},[e]);let d=r?.status===`running`||r?.status===`paused`,f=(0,Z.useMemo)(()=>{let e=new Set;for(let t of r?.tasks??[])t.worktreeBranch&&e.add(t.worktreeBranch);return e.size},[r?.tasks]),p=(0,Z.useMemo)(()=>{let e=new Set;for(let t of r?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.add(t.agentName);return e.size},[r?.tasks]);return(0,Q.jsx)(G,{open:e,onOpenChange:e=>!i&&t(e),children:(0,Q.jsxs)(U,{className:`sm:max-w-lg border-destructive/50`,children:[(0,Q.jsxs)(se,{children:[(0,Q.jsxs)(W,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(k,{className:`h-5 w-5 text-destructive`}),o(`activity:sdd.destroyTitle`)]}),(0,Q.jsx)(le,{children:o(`activity:sdd.destroyDesc`)})]}),(0,Q.jsxs)(`ul`,{className:`space-y-1.5 py-1 text-sm`,children:[d&&(0,Q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Q.jsx)(`span`,{children:p>0?o(`activity:sdd.stopRunAgents`,{count:p}):o(`activity:sdd.stopRun`)})]}),(0,Q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Q.jsx)(`span`,{children:f>0?o(`activity:sdd.removeWorktreesCount`,{count:f}):o(`activity:sdd.removeWorktreesAll`)})]}),(0,Q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Q.jsx)(`span`,{children:o(`activity:sdd.deleteArtifacts`)})]})]}),s>0&&(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md border border-warning/30 bg-warning/5 p-2.5 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),className:`mt-0.5 h-4 w-4 accent-warning`}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:o(`activity:sdd.revertMerged`,{count:s})}),` `,`on `,(0,Q.jsx)(`code`,{className:`text-xs`,children:c??o(`activity:sdd.baseBranchFallback`)}),(0,Q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:o(`activity:sdd.revertHint`)})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-muted/50 p-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(m,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),o(s>0&&!l?`activity:sdd.noteLeaveMerged`:`activity:sdd.noteAbandon`)]}),(0,Q.jsxs)(ce,{className:`gap-2 sm:gap-2`,children:[(0,Q.jsx)(K,{variant:`outline`,size:`sm`,disabled:i,onClick:()=>t(!1),children:o(`common:action.cancel`)}),(0,Q.jsx)(K,{size:`sm`,disabled:i,onClick:()=>a(l),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{className:`mr-1 h-3.5 w-3.5 animate-spin`}),` `,o(`activity:sdd.destroying`)]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{className:`mr-1 h-3.5 w-3.5`}),` `,o(`activity:sdd.destroyAll`)]})})]})]})})}var Ce=[{key:`pending`,labelKey:`kanbanBacklog`,accent:`border-border/70`,head:`text-muted-foreground`},{key:`queued`,labelKey:`kanbanReady`,accent:`border-primary/35`,head:`text-primary`},{key:`in_progress`,labelKey:`kanbanRunning`,accent:`border-warning/45`,head:`text-warning`},{key:`review`,labelKey:`kanbanReview`,accent:`border-primary/35`,head:`text-primary`},{key:`failed`,labelKey:`kanbanFailed`,accent:`border-destructive/35`,head:`text-destructive`},{key:`completed`,labelKey:`kanbanDone`,accent:`border-success/35`,head:`text-success`}];function we({tasks:e,selectedId:t,onTaskClick:r}){let{t:i}=n(),a=(0,Z.useMemo)(()=>{let t=new Map;for(let e of Ce)t.set(e.key,[]);for(let n of e){let e=n.displayStatus===`blocked`?`pending`:n.displayStatus===`cancelled`?`failed`:n.displayStatus;(t.get(e)??t.get(`pending`))?.push(n)}return t},[e]);return(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 gap-3 overflow-x-auto p-4`,children:Ce.map(e=>{let n=a.get(e.key)??[];return(0,Q.jsxs)(`div`,{className:`flex min-h-0 w-64 shrink-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:R(`mb-2 flex items-center gap-2 border-b-2 pb-1.5`,e.accent),children:[(0,Q.jsx)(`span`,{className:R(`text-xs font-bold uppercase tracking-wide`,e.head),children:i(`activity:sdd.${e.labelKey}`)}),(0,Q.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground`,children:n.length})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1`,children:[n.map(e=>(0,Q.jsx)(Te,{task:e,selected:e.id===t,onClick:()=>r(e.id)},e.id)),n.length===0&&(0,Q.jsx)(`div`,{className:`rounded-md border border-dashed border-border py-6 text-center text-[10px] text-muted-foreground`,children:i(`activity:sdd.kanbanEmpty`)})]})]},e.key)})})}function Te({task:e,selected:t,onClick:n}){let r=e.displayStatus===`in_progress`;return(0,Q.jsxs)(`button`,{type:`button`,onClick:n,className:R(`sdd-node-enter w-full rounded-lg border bg-card/85 p-2 text-left shadow-sm transition hover:border-primary/35 hover:bg-accent/35`,t?`border-primary/55 ring-1 ring-primary/35`:`border-border/70`,r&&`sdd-node-running`,e.displayStatus===`completed`&&`sdd-node-complete`,e.displayStatus===`failed`&&`sdd-node-failed`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[r&&(0,Q.jsx)(N,{className:`h-3 w-3 animate-spin text-warning`}),e.displayStatus===`completed`&&(0,Q.jsx)(F,{className:`h-3 w-3 text-success`}),e.displayStatus===`failed`&&(0,Q.jsx)(S,{className:`h-3 w-3 text-destructive`}),(0,Q.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.shortId}),(0,Q.jsx)(`span`,{className:R(`ml-auto rounded px-1.5 text-[9px] font-bold uppercase`,fe(e.priority).chip),children:e.priority})]}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:e.title}),(e.agentName||e.worktreeBranch||e.retries)&&(0,Q.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[e.agentName&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:R(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,r?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:Y(e.agentName)}),(0,Q.jsx)(`span`,{className:`max-w-[80px] truncate text-[10px] text-muted-foreground`,children:e.agentName})]}),e.retries?(0,Q.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,Q.jsx)(ne,{className:`h-2.5 w-2.5`}),e.retries]}):null,e.worktreeBranch&&(0,Q.jsx)(g,{className:`ml-auto h-2.5 w-2.5 text-muted-foreground`})]})]})}function Ee({task:e,allTasks:i,feed:s,now:c,expanded:l,modelCandidates:u,defaultModel:d,onClose:p,onToggleExpanded:m,onRetry:h,onReassign:_,onSetModel:v,onSetVerification:y,onCancel:b,onDelete:te,onSplit:x,onSelectTask:C}){let{t:w}=n(),T=pe(e.displayStatus),E=T.icon,D=e.displayStatus===`in_progress`,O=e.displayStatus===`pending`||e.displayStatus===`blocked`||e.displayStatus===`queued`,[A,j]=(0,Z.useState)(!1),[M,re]=(0,Z.useState)(``),[N,I]=(0,Z.useState)(null),[ie,L]=(0,Z.useState)(!1),[ae,z]=(0,Z.useState)(``),[B,V]=(0,Z.useState)(!1),[oe,H]=(0,Z.useState)(e.verificationCommand??``),se=()=>{M.trim()&&(_(e.id,M.trim()),j(!1),re(``))},ce=()=>{let t=ae.split(`
2
- `).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,...n]=e.split(`::`),r=(t??``).trim();return{title:r,description:n.join(`::`).trim()||r}}).filter(e=>e.title);t.length&&(x(e.id,t),L(!1),z(``))},U=(0,Z.useMemo)(()=>new Map(i.map(e=>[e.shortId,e])),[i]),W=(0,Z.useMemo)(()=>i.filter(t=>t.deps.includes(e.shortId)),[i,e.shortId]),le=(0,Z.useMemo)(()=>s.filter(t=>t.taskId===e.id||t.taskShortId===e.shortId),[s,e.id,e.shortId]),G=e.startedAt&&!e.completedAt?_e(c-e.startedAt):e.startedAt&&e.completedAt?_e(e.completedAt-e.startedAt):null;return(0,Q.jsxs)(`div`,{className:`sdd-rise flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:R(`flex items-center gap-2 border-b border-border/70 bg-card/70 px-3 py-2`,l&&`px-5 py-3`),children:[(0,Q.jsx)(`button`,{type:`button`,onClick:p,className:`text-muted-foreground hover:text-foreground`,title:w(`activity:sddTask.backTitle`),children:(0,Q.jsx)(o,{className:`h-4 w-4`})}),(0,Q.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),m&&(0,Q.jsx)(`button`,{type:`button`,onClick:m,className:`ml-1 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground`,title:w(l?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-label":w(l?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-pressed":l,children:l?(0,Q.jsx)(P,{className:`h-4 w-4`}):(0,Q.jsx)(t,{className:`h-4 w-4`})}),(0,Q.jsxs)(`span`,{className:R(`ml-auto flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px]`,T.ring,T.text),children:[(0,Q.jsx)(E,{className:R(`h-3 w-3`,D&&`animate-spin`)}),T.label]})]}),(0,Q.jsxs)(`div`,{className:R(`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain`,l?`grid grid-cols-2 content-start gap-4 p-5`:`space-y-3 p-3`),children:[(0,Q.jsx)(`h3`,{className:R(`text-sm font-semibold leading-snug text-foreground`,l&&`col-span-2 text-lg`),children:e.title}),e.agentName&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/70 bg-muted/45 p-2`,children:[(0,Q.jsx)(`span`,{className:R(`flex h-7 w-7 items-center justify-center rounded-full text-[10px] font-bold text-white`,D?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:Y(e.agentName)}),(0,Q.jsxs)(`div`,{className:`leading-tight`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.agentName}),(0,Q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:w(D?`activity:sddTask.workingOn`:`activity:sddTask.assigned`)})]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5 text-[11px]`,children:[(0,Q.jsx)(Oe,{label:w(`activity:sddTask.metaPriority`),children:(0,Q.jsx)(`span`,{className:R(`font-medium uppercase`,fe(e.priority).text),children:e.priority})}),(0,Q.jsx)(Oe,{label:w(`activity:sddTask.metaType`),children:e.type}),G&&(0,Q.jsx)(Oe,{label:e.completedAt?w(`activity:sddTask.metaDuration`):w(`activity:sddTask.metaElapsed`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(f,{className:`h-3 w-3 text-muted-foreground`}),G]})}),e.retries?(0,Q.jsx)(Oe,{label:w(`activity:sddTask.metaRetries`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-destructive`,children:[(0,Q.jsx)(ne,{className:`h-3 w-3`}),e.retries]})}):null,e.worktreeBranch&&(0,Q.jsx)(Oe,{label:w(`activity:sddTask.metaWorktree`),full:!0,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-foreground`,title:e.worktreeBranch,children:[(0,Q.jsx)(g,{className:`h-3 w-3 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.worktreeBranch})]})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[w(`activity:sddTask.workerModel`),!e.model&&d&&(0,Q.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,w(`activity:sddTask.runDefault`,{model:d})]})]}),(0,Q.jsx)(q,{value:e.model,provider:e.provider,candidates:u,placeholder:d?w(`activity:sddTask.runDefaultPlaceholderModel`,{model:d}):w(`activity:sddTask.runDefaultPlaceholder`),onPick:(t,n)=>v(e.id,t,n),onReset:e.model?()=>v(e.id,void 0,void 0):void 0}),e.fallbackModels&&e.fallbackModels.length>0&&(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.fallbackModels.map(e=>(0,Q.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`↳ `,e]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[w(`activity:sddTask.verificationCmd`),(0,Q.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,w(`activity:sddTask.gatesCompletion`)]})]}),B?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`input`,{value:oe,onChange:e=>H(e.target.value),onKeyDown:t=>{t.key===`Enter`?(y(e.id,oe.trim()||void 0),V(!1)):t.key===`Escape`&&(H(e.verificationCommand??``),V(!1))},placeholder:w(`activity:sddTask.verifyPlaceholder`),className:`w-full rounded border border-border bg-background px-2 py-1 font-mono text-[11px] text-foreground`}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{y(e.id,oe.trim()||void 0),V(!1)},className:`rounded bg-primary px-2 py-0.5 text-[10px] text-primary-foreground hover:opacity-90`,children:w(`common:action.save`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{H(e.verificationCommand??``),V(!1)},className:`rounded bg-muted px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:w(`common:action.cancel`)})]})]}):e.verificationCommand?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.verificationState&&(0,Q.jsx)(`span`,{title:e.verificationDetail,className:e.verificationState===`passed`?`rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success`:`rounded bg-destructive/10 px-1.5 py-0.5 text-[10px] text-destructive`,children:e.verificationState===`passed`?`✓ verified`:`✗ failed`}),(0,Q.jsx)(`code`,{className:`flex-1 truncate rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-foreground`,children:e.verificationCommand}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:w(`common:action.edit`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>y(e.id,void 0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:w(`common:action.clear`)})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:`rounded border border-dashed border-border px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,children:w(`activity:sddTask.addVerify`)})]}),e.description&&(0,Q.jsxs)(`div`,{className:R(l&&`col-span-2`),children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:w(`activity:sddTask.description`)}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap rounded-md bg-muted p-2 text-[11px] leading-relaxed text-foreground`,children:e.description})]}),(0,Q.jsx)(De,{events:le,expanded:l}),e.deps.length>0&&(0,Q.jsx)($,{title:w(`activity:sddTask.dependsOn`),shortIds:e.deps,byShort:U,onSelectTask:C}),W.length>0&&(0,Q.jsx)($,{title:w(`activity:sddTask.blocks`),shortIds:W.map(e=>e.shortId),byShort:U,onSelectTask:C})]}),(0,Q.jsxs)(`div`,{className:R(`border-t border-border p-2`,l&&`px-5 py-3`),children:[A?(0,Q.jsxs)(`div`,{className:`sdd-rise flex items-center gap-1.5`,children:[(0,Q.jsx)(`input`,{value:M,onChange:e=>re(e.target.value),onKeyDown:e=>{e.key===`Enter`&&se(),e.key===`Escape`&&j(!1)},placeholder:w(`activity:sddTask.newWorkerPlaceholder`),className:`min-w-0 flex-1 rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs outline-none focus:border-primary/60`}),(0,Q.jsx)(`button`,{type:`button`,onClick:se,disabled:!M.trim(),className:`rounded-md bg-primary/10 px-2 py-1.5 text-xs font-medium text-primary hover:bg-primary/15 disabled:opacity-40`,children:(0,Q.jsx)(F,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>j(!1),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(S,{className:`h-3.5 w-3.5`})})]}):N?(0,Q.jsxs)(`div`,{className:`sdd-rise flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`flex-1 text-xs text-foreground`,children:w(N===`stop`?`activity:sddTask.confirmStop`:`activity:sddTask.confirmDelete`)}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{N===`stop`?b(e.id):te(e.id),I(null)},className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Q.jsx)(F,{className:`h-3.5 w-3.5`}),` `,w(N===`stop`?`common:action.stop`:`common:action.delete`)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>I(null),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(S,{className:`h-3.5 w-3.5`})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>h(e.id),title:w(`activity:sddTask.retryTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-warning/12 py-1.5 text-xs font-medium text-warning hover:bg-warning/18`,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,w(`common:action.retry`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>j(!0),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Q.jsx)(a,{className:`h-3.5 w-3.5`}),` `,w(`activity:sddTask.reassign`)]}),D&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>I(`stop`),title:w(`activity:sddTask.stopTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Q.jsx)(r,{className:`h-3.5 w-3.5`}),` `,w(`common:action.stop`)]}),!D&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>L(!0),title:w(`activity:sddTask.splitTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Q.jsx)(ee,{className:`h-3.5 w-3.5`}),` `,w(`activity:sddTask.split`)]}),O&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>I(`delete`),title:w(`activity:sddTask.deleteTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Q.jsx)(k,{className:`h-3.5 w-3.5`}),` `,w(`common:action.delete`)]})]}),ie&&(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-[11px] text-muted-foreground`,htmlFor:`sdd-split-input`,children:w(`activity:sddTask.splitHint`)}),(0,Q.jsx)(`textarea`,{id:`sdd-split-input`,rows:3,value:ae,onChange:e=>z(e.target.value),placeholder:w(`activity:sddTask.splitPlaceholder`),className:`w-full resize-y rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:ce,className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Q.jsx)(ee,{className:`h-3.5 w-3.5`}),` `,w(`activity:sddTask.splitInto`)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{L(!1),z(``)},className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(S,{className:`h-3.5 w-3.5`})})]})]})]})]})}function De({events:e,expanded:t}){let{t:r}=n();return(0,Q.jsxs)(`section`,{className:R(`rounded-lg border border-border/70 bg-background/45`,t&&`col-span-2`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 px-3 py-2.5`,children:[(0,Q.jsx)(h,{className:`h-4 w-4 text-primary`}),(0,Q.jsx)(`h4`,{className:`text-xs font-semibold text-foreground`,children:r(`activity:sddTask.eventLog`)}),(0,Q.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,children:e.length}),(0,Q.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:r(`activity:sddTask.newestFirst`)})]}),e.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-5 text-center text-[11px] text-muted-foreground`,children:r(`activity:sddTask.noEvents`)}):(0,Q.jsx)(`div`,{className:R(`divide-y divide-border/45 overflow-auto`,t?`max-h-[32rem]`:`max-h-72`),children:e.map((e,t)=>{let n=e.kind===`file`,r=e.kind===`tool`,i=e.ok===!1||e.kind===`failed`||e.kind===`verification_failed`,a=n?v:r?p:h;return(0,Q.jsxs)(`div`,{className:R(`grid grid-cols-[4.75rem_1rem_minmax(0,1fr)] gap-2 px-3 py-2.5 text-[11px]`,i&&`bg-destructive/[0.035]`),children:[(0,Q.jsx)(`time`,{dateTime:new Date(e.ts).toISOString(),className:`font-mono text-[10px] text-muted-foreground`,title:new Date(e.ts).toLocaleString(),children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Q.jsx)(a,{className:R(`mt-0.5 h-3.5 w-3.5`,i?`text-destructive`:n?`text-info`:r?`text-warning`:`text-primary`)}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.action&&(0,Q.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium text-foreground`,children:e.action}),e.agentName&&(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.agentName}),e.durationMs!==void 0&&(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.durationMs<1e3?`${Math.round(e.durationMs)}ms`:`${(e.durationMs/1e3).toFixed(1)}s`})]}),e.filePath?(0,Q.jsx)(`code`,{className:`mt-1 block break-all font-mono text-[10px] leading-relaxed text-foreground`,children:e.filePath}):e.detail?(0,Q.jsx)(`code`,{className:`mt-1 block break-words font-mono text-[10px] leading-relaxed text-muted-foreground`,children:e.detail}):(0,Q.jsx)(`p`,{className:`mt-1 break-words leading-relaxed text-foreground`,children:e.text})]})]},`${e.ts}-${e.kind}-${t}`)})})]})}function Oe({label:e,children:t,full:n}){return(0,Q.jsxs)(`div`,{className:R(`rounded-md border border-border bg-muted/50 px-2 py-1`,n&&`col-span-2`),children:[(0,Q.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,Q.jsx)(`div`,{className:`text-foreground`,children:t})]})}function $({title:e,shortIds:t,byShort:n,onSelectTask:r}){return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>{let t=n.get(e);return(0,Q.jsxs)(`button`,{type:`button`,disabled:!t,onClick:()=>t&&r(t.id),className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-foreground hover:bg-muted disabled:opacity-50`,title:t?.title,children:[(0,Q.jsx)(`span`,{className:R(`h-1.5 w-1.5 rounded-full`,pe(t?.displayStatus??`pending`).dot)}),(0,Q.jsx)(`span`,{className:`font-mono`,children:e})]},e)})})]})}function ke({onClose:e}){let{t}=n(),{client:a}=ae(),o=z(e=>e.snapshot),l=z(e=>e.lifecycleResult),u=z(e=>e.destroying),d=z(e=>e.setDestroying),f=z(e=>e.setLifecycleResult),[p,g]=(0,Z.useState)(()=>Date.now()),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(!1),[ee,te]=(0,Z.useState)(`graph`),[x,C]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{a?.send?.({type:`sdd.board.get`})},[a]);let T=o&&(o.status===`running`||o.status===`paused`);(0,Z.useEffect)(()=>{if(!T)return;let e=setInterval(()=>g(Date.now()),1e3);return g(Date.now()),()=>clearInterval(e)},[T]);let E=(0,Z.useCallback)(e=>a?.send?.(e),[a]),D=(0,Z.useRef)(null),A=(0,Z.useCallback)(e=>{D.current=null,E({type:`sdd.board.destroy`,payload:{revertMerged:e}})},[E]),j=(0,Z.useCallback)(e=>{C(!1),f(null),d(!0),T?(E({type:`sdd.board.stop`,payload:{}}),D.current={revertMerged:e,deadline:Date.now()+5e3}):A(e)},[T,E,A,d,f]);(0,Z.useEffect)(()=>{let e=D.current;if(!e)return;if(!T||Date.now()>=e.deadline){A(e.revertMerged);return}let t=setTimeout(()=>{let e=D.current;e&&A(e.revertMerged)},Math.max(0,e.deadline-Date.now()));return()=>clearTimeout(t)},[T,o,A]);let M=(0,Z.useCallback)(()=>{f(null),E({type:`sdd.board.cleanup_worktrees`,payload:{}})},[E,f]),re=(0,Z.useCallback)(()=>{f(null),E({type:`sdd.board.rollback`,payload:{}})},[E,f]),N=(0,Z.useMemo)(()=>(o?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch})),[o?.tasks]),P=(0,Z.useMemo)(()=>{let e=new Map;for(let t of o?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.set(t.agentName,{name:t.agentName,task:t.title});return[...e.values()]},[o?.tasks]),F=(0,Z.useCallback)(e=>v(e),[]),ie=(0,Z.useCallback)(()=>{v(null),b(!1)},[]),L=(0,Z.useCallback)(e=>E({type:`sdd.board.retry`,payload:{taskId:e}}),[E]),V=(0,Z.useCallback)(()=>E({type:`sdd.board.retry_all_failed`,payload:{}}),[E]),H=(0,Z.useCallback)((e,t)=>{let n=t.trim();n&&E({type:`sdd.board.reassign`,payload:{taskId:e,agentName:n}})},[E]),se=(0,Z.useCallback)((e,t,n)=>E({type:`sdd.board.set_task_model`,payload:{taskId:e,model:t,provider:n}}),[E]),ce=(0,Z.useCallback)((e,t)=>E({type:`sdd.board.set_task_verification`,payload:{taskId:e,verificationCommand:t}}),[E]),U=(0,Z.useCallback)(e=>E({type:`sdd.board.cancel_task`,payload:{taskId:e}}),[E]),W=(0,Z.useCallback)(e=>{E({type:`sdd.board.delete_task`,payload:{taskId:e}}),v(null),b(!1)},[E]),le=(0,Z.useCallback)((e,t)=>{E({type:`sdd.board.split_task`,payload:{taskId:e,subtasks:t}}),v(null),b(!1)},[E]),G=ue(_!==null),q=(0,Z.useMemo)(()=>o?.tasks.find(e=>e.id===_)??null,[o?.tasks,_]),J=o?.progress,de=o?.diagnostics?.deadlockChains??[];return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Q.jsxs)(`header`,{className:`sdd-sheen shrink-0 border-b border-border px-4 pb-3 pt-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(h,{className:`h-5 w-5 text-warning`}),(0,Q.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:o?.title??t(`activity:sddBoard.titleFallback`)}),o&&(0,Q.jsx)(`span`,{className:R(`rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize`,X[o.status]??X.idle),children:o.status}),o?.defaultModel&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,title:t(`activity:sddBoard.defaultModelTitle`),children:[(0,Q.jsx)(i,{className:`h-3 w-3 text-primary`}),o.defaultModel]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o&&(0,Q.jsxs)(`button`,{type:`button`,title:t(`activity:sddBoardView.openTheMirroredKanbanBoardSForThisRunOnePerDependencyWave`),onClick:()=>{let e=`run:${o.runId}`,t=B.getState().boards.filter(t=>t.tags?.includes(e)),n=t.find(e=>e.tags?.includes(`phase:wave-0`))??t[0];n&&(B.getState().setActiveBoardId(n.id),a?.send?.({type:`kanban.get`,payload:{boardId:n.id}})),oe.getState().setCurrentView(`kanban`)},className:`inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,Q.jsx)(h,{className:`h-3.5 w-3.5`}),` Kanban`]}),o&&(0,Q.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted p-0.5 text-[11px]`,children:[`graph`,`kanban`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>te(e),className:R(`rounded px-2 py-0.5 capitalize transition`,ee===e?`bg-primary/12 text-primary`:`text-muted-foreground hover:text-foreground`),children:t(e===`graph`?`activity:sddBoard.graphLabel`:`activity:sddBoard.kanbanLabel`)},e))}),T&&(J?.failed??0)>0&&(0,Q.jsxs)(`button`,{type:`button`,onClick:V,title:t(`activity:sddBoard.retryAllTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.retryFailed`,{count:J?.failed??0})]}),T&&(0,Q.jsxs)(Q.Fragment,{children:[o?.status===`paused`?(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>E({type:`sdd.board.resume`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,Q.jsx)(s,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.resume`)]}):(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>E({type:`sdd.board.pause`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,Q.jsx)(O,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.pause`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>E({type:`sdd.board.stop`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive hover:bg-destructive/25`,children:[(0,Q.jsx)(r,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.stop`)]})]}),o&&!T&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:M,title:t(`activity:sddBoard.cleanTitle`),className:`inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/80`,children:[(0,Q.jsx)(w,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.cleanWorktrees`)]}),(o.mergedCommits?.length??0)>0&&(0,Q.jsxs)(`button`,{type:`button`,onClick:re,title:t(`activity:sddBoard.rollbackTitle`,{count:o.mergedCommits?.length??0,base:o.baseBranch??t(`activity:sdd.baseBranchFallback`)}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,Q.jsx)(c,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.rollback`,{count:o.mergedCommits?.length??0})]})]}),o&&(u?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive`,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5 animate-spin`}),` `,t(T?`activity:sddBoard.stopping`:`activity:sddBoard.destroying`)]}):(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>C(!0),title:t(`activity:sddBoard.destroyTitle`),className:`inline-flex items-center gap-1 rounded-md bg-destructive px-2.5 py-1 text-xs font-medium text-destructive-foreground hover:bg-destructive/90`,children:[(0,Q.jsx)(k,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.destroy`)]})),(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Q.jsx)(S,{className:`h-4 w-4`})})]})]}),o&&J&&(0,Q.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-5`,children:[(0,Q.jsx)(ye,{pct:J.percentComplete}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statDone`),value:`${J.completed}/${J.total}`,color:`text-success`}),J.inProgress>0&&(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statRunning`),value:J.inProgress,color:`text-warning`}),J.failed>0&&(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statFailed`),value:J.failed,color:`text-destructive`}),(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statWave`),value:o.wave+1,color:`text-primary`}),T&&o.startedAt>0&&(0,Q.jsx)(Me,{label:t(`activity:sddBoard.statElapsed`),value:_e(p-o.startedAt),color:`text-foreground`})]}),(0,Q.jsx)(`div`,{className:`flex min-h-[24px] items-center gap-1.5`,children:P.length===0?(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:sddBoard.noActiveWorkers`)}):P.map((e,t)=>(0,Q.jsxs)(`span`,{title:`${e.name} → ${e.task}`,className:`flex items-center gap-1 rounded-full bg-muted py-0.5 pl-0.5 pr-2`,children:[(0,Q.jsx)(`span`,{className:R(`sdd-agent-live flex h-5 w-5 items-center justify-center rounded-full text-[9px] font-bold text-white`,me[t%me.length]),children:Y(e.name)}),(0,Q.jsx)(`span`,{className:`max-w-[90px] truncate text-[11px] text-foreground`,children:e.name})]},e.name))})]})]})]}),l&&(0,Q.jsx)(je,{result:l,onDismiss:()=>f(null)}),de.length>0&&(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:[(0,Q.jsx)(m,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`font-semibold`,children:t(`activity:sddBoard.deadlock`)}),de.map(e=>(0,Q.jsxs)(`div`,{className:`font-mono`,children:[e.blocked,` ← `,e.blockedBy.join(`, `)]},e.blocked))]})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:o?ee===`graph`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ve,{tasks:N,columns:o.columns,onTaskClick:F}),(0,Q.jsx)(`div`,{className:`pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/40 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur`,children:t(`activity:sddBoard.clickTaskHint`)})]}):(0,Q.jsx)(we,{tasks:o.tasks,selectedId:_,onTaskClick:F}):(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[(0,Q.jsx)(I,{className:`h-10 w-10 text-primary/40`}),(0,Q.jsx)(`p`,{className:`text-foreground`,children:t(`activity:sddBoard.noRunTitle`)}),(0,Q.jsx)(`p`,{className:`max-w-sm text-center text-xs text-muted-foreground`,children:t(`activity:sddBoard.noRunBody`)})]})}),o&&(0,Q.jsx)(`aside`,{"data-testid":`sdd-task-panel`,"data-expanded":y&&q?`true`:`false`,className:R(`shrink-0 border-l border-border bg-card transition-[width] duration-200 ease-out`,y&&q?`w-[min(72rem,72vw)]`:`w-80`),children:q?(0,Q.jsx)(Ee,{task:q,allTasks:o.tasks,feed:o.taskEvents?.[q.id]??o.feed??[],now:p,expanded:y,modelCandidates:G,defaultModel:o.defaultModel,onClose:ie,onToggleExpanded:()=>b(e=>!e),onRetry:L,onReassign:H,onSetModel:se,onSetVerification:ce,onCancel:U,onDelete:W,onSplit:le,onSelectTask:v},q.id):(0,Q.jsx)(xe,{feed:o.feed??[],now:p})})]}),(0,Q.jsx)(Se,{open:x,onOpenChange:C,snapshot:o,busy:u,onConfirm:j})]})}function Ae(e){let t=e.op===`cleanup_worktrees`?`lcClean`:e.op===`rollback`?`lcRollback`:`lcDestroy`,n=b.t(`activity:sddBoard.${t}`);if(!e.ok)return b.t(`activity:sddBoard.lcFailed`,{op:n,reason:e.reason??b.t(`activity:sddBoard.lcUnknownError`)});let r=[];typeof e.removed==`number`&&r.push(b.t(`activity:sddBoard.lcWorktrees`,{count:e.removed})),typeof e.reverted==`number`&&e.reverted>0&&r.push(b.t(`activity:sddBoard.lcCommits`,{count:e.reverted})),e.deleted?.length&&r.push(b.t(`activity:sddBoard.lcDeleted`,{items:e.deleted.join(`, `)}));let i=r.length?r.join(` · `):b.t(`activity:sddBoard.lcNothing`);return e.reason?b.t(`activity:sddBoard.lcNote`,{op:n,body:i,reason:e.reason}):b.t(`activity:sddBoard.lcOk`,{op:n,body:i})}function je({result:e,onDismiss:t}){let n=!e.ok||!!e.reason;return(0,Q.jsxs)(`div`,{className:R(`flex items-start gap-2 border-b px-4 py-2 text-xs`,n?`border-warning/30 bg-warning/5 text-warning`:`border-success/30 bg-success/5 text-success`),children:[n?(0,Q.jsx)(L,{className:`mt-0.5 h-4 w-4 shrink-0`}):(0,Q.jsx)(d,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:Ae(e)}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 opacity-60 hover:opacity-100`,children:(0,Q.jsx)(S,{className:`h-3.5 w-3.5`})})]})}function Me({label:e,value:t,color:n}){return(0,Q.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,Q.jsx)(`span`,{className:R(`font-semibold tabular-nums`,n),children:t}),(0,Q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e})]})}var Ne={idle:`phaseStart`,questioning:`phaseInterview`,spec_review:`phaseSpecReview`,implementation:`phasePlanning`,task_review:`phaseTaskReview`,executing:`phaseRunning`,done:`phaseDone`},Pe=[`questioning`,`spec_review`,`implementation`,`task_review`,`executing`];function Fe({onClose:e,onRunStarted:t}){let{t:r}=n(),{client:i}=ae(),a=V(e=>e.snapshot),o=V(e=>e.agentText),s=V(e=>e.error),c=V(e=>e.startedRunId),l=V(e=>e.setStartedRunId),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!0),[b,ee]=(0,Z.useState)(!0),[w,E]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(void 0),[A,j]=(0,Z.useState)(void 0),[P,ie]=(0,Z.useState)([]),[L,z]=(0,Z.useState)(4),[B,oe]=(0,Z.useState)(!0),[H,se]=(0,Z.useState)(!1),ce=ue(w),U=(0,Z.useCallback)(e=>i?.send?.(e),[i]),W=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{U({type:`sdd.spec.get`})},[U]);let le=a?.answers.length??0;(0,Z.useEffect)(()=>{W.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[le,o]),(0,Z.useEffect)(()=>{c&&(l(null),t?.())},[t,l,c]);let G=a?.busy??!1,Y=a?.phase??`idle`,X=!!a?.sessionId,pe=!!a?.resumed,me=a?.lastRunId;(0,Z.useEffect)(()=>{X&&g(!1)},[X]);let he=a?.answers[a.answers.length-1]?.question??``,ge=!!a&&(a.taskCount>0||!!a.graphId||Y===`task_review`||Y===`executing`),_e=()=>{let e=d.trim();!e||G||h||(g(!0),U({type:`sdd.spec.start`,payload:{goal:e}}))},ye=()=>{let e=p.trim();!e||G||(U({type:`sdd.spec.message`,payload:{text:e}}),m(``))},be=e=>{G||!e.trim()||(U({type:`sdd.spec.message`,payload:{text:e.trim()}}),m(``))},xe=()=>!G&&U({type:`sdd.spec.approve`,payload:{}}),Se=e=>!G&&U({type:`sdd.spec.rewind`,payload:e?{targetPhase:e}:{}}),Ce=()=>{U({type:`sdd.run.start`,payload:{parallelSlots:L,worktrees:B,planDecompose:H,...O?{model:O,provider:A}:{},...P.length?{fallbackModels:P}:{}}}),E(!1)},we=()=>{G||U({type:`sdd.spec.discard`,payload:{}})},Te=(0,Z.useMemo)(()=>(a?.board?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch,retries:e.retries})),[a?.board]),Ee=Te.length>0,De=o&&Y===`questioning`?o:he??``,Oe=(0,Z.useMemo)(()=>Le(De),[De]),$=a?.answers.length??0,ke=a?.minQuestions??2,Ae=a?.maxQuestions??5,je=$>=ke,Me=Math.min(100,Math.round($/Math.max(1,Ae)*100));return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Q.jsxs)(`header`,{className:`sdd-sheen flex shrink-0 items-center justify-between border-b border-border px-4 py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(x,{className:`h-5 w-5 text-primary`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold`,children:a?.title||r(`activity:sddWizard.titleFallback`)}),X&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r(`activity:sddWizard.${Ne[Y]??`phaseStart`}`),Y===`questioning`&&` · ${r(`activity:sddWizard.questionsSuffix`,{cur:a?.questionCount??0,max:a?.maxQuestions??0})}`,a&&a.taskCount>0?` · ${r(`activity:sddWizard.tasksSuffix`,{count:a.taskCount})}`:``]})]}),G&&(0,Q.jsx)(N,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[me&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>t?.(),className:`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,Q.jsx)(T,{className:`h-3.5 w-3.5`}),` `,r(`activity:sddWizard.openLiveBoard`)]}),X&&(0,Q.jsx)(`button`,{type:`button`,onClick:we,disabled:G,title:r(`activity:sddWizard.discardTitle`),className:`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-destructive/10 hover:text-destructive disabled:opacity-50`,children:r(`activity:sddWizard.discardInterview`)}),ge&&(0,Q.jsxs)(`div`,{className:`relative flex items-center gap-1.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>E(e=>!e),title:r(`activity:sddWizard.runCfgTitle`),className:R(`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium`,O||P.length||H?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-muted text-muted-foreground hover:text-foreground`),children:[(0,Q.jsx)(u,{className:`h-3.5 w-3.5`}),O||r(`activity:sddWizard.modelsLabel`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:Ce,className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,Q.jsx)(T,{className:`h-3.5 w-3.5`}),` `,r(`activity:sddWizard.startRun`)]}),w&&(0,Q.jsxs)(`div`,{className:`sdd-rise absolute right-0 top-9 z-50 w-72 rounded-lg border border-border bg-popover p-3 shadow-xl`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.defaultWorkerModel`)}),(0,Q.jsx)(q,{value:O,provider:A,candidates:ce,placeholder:r(`activity:sddWizard.leaderDefaultPlaceholder`),resetLabel:r(`activity:sddWizard.useSessionDefault`),onPick:(e,t)=>{k(e),j(t)},onReset:O?()=>{k(void 0),j(void 0)}:void 0}),(0,Q.jsx)(`div`,{className:`mb-1 mt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.fallbackChain`)}),(0,Q.jsx)(de,{value:P,candidates:ce,onChange:ie}),(0,Q.jsx)(`p`,{className:`mt-2 text-[10px] text-muted-foreground`,children:r(`activity:sddWizard.appliesToAll`)}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`sdd-slots`,className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.parallelAgents`)}),(0,Q.jsx)(`input`,{id:`sdd-slots`,type:`number`,min:1,max:16,value:L,onChange:e=>{let t=Number.parseInt(e.target.value,10);z(Number.isFinite(t)?Math.min(16,Math.max(1,t)):1)},className:`w-16 rounded-md border border-border bg-background px-2 py-1 text-right text-xs outline-none focus:border-primary`})]}),(0,Q.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.isolateWorktrees`)}),(0,Q.jsx)(`input`,{type:`checkbox`,checked:B,onChange:e=>oe(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:r(B?`activity:sddWizard.worktreeOn`:`activity:sddWizard.worktreeOff`)}),(0,Q.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.planDecompose`)}),(0,Q.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>se(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:r(H?`activity:sddWizard.planDecomposeOn`:`activity:sddWizard.planDecomposeOff`)})]})]}),(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Q.jsx)(S,{className:`h-4 w-4`})})]})]}),X&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b bg-card/50 px-4 py-1.5 text-[11px]`,children:Pe.map((e,t)=>{let n=e===Y,i=Pe.indexOf(Y)>t;return(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[i&&!G&&Y!==`executing`&&Y!==`done`?(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>Se(e),title:r(`activity:sddWizard.rewindToPhaseTitle`,`Return to this phase to revise`),className:`inline-flex items-center rounded-full px-2 py-0.5 text-success transition hover:bg-success/10 hover:underline`,children:[(0,Q.jsx)(F,{className:`mr-0.5 inline h-3 w-3`}),r(`activity:sddWizard.${Ne[e]}`)]}):(0,Q.jsxs)(`span`,{className:R(`rounded-full px-2 py-0.5`,n?`bg-primary/15 text-primary font-medium`:i?`text-success`:`text-muted-foreground`),children:[i&&(0,Q.jsx)(F,{className:`mr-0.5 inline h-3 w-3`}),r(`activity:sddWizard.${Ne[e]}`)]}),t<Pe.length-1&&(0,Q.jsx)(`span`,{className:`text-muted-foreground/65`,children:`→`})]},e)})}),(0,Q.jsxs)(`div`,{ref:J(`sdd-wizard`),className:`min-h-0 flex-1 overflow-auto overscroll-contain p-4`,children:[s&&(0,Q.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive`,children:s}),pe&&X&&(0,Q.jsx)(`div`,{className:`mb-3 rounded-md border border-primary/30 bg-primary/5 px-3 py-2 text-xs text-primary`,children:r(`activity:sddWizard.resumeBanner`)}),X?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[Y===`questioning`&&(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/80 bg-card/60 p-2.5 shadow-sm`,children:[(0,Q.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between text-xs`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-foreground`,children:[(0,Q.jsx)(x,{className:`h-3.5 w-3.5 text-primary`}),r(`activity:sddWizard.interviewProgress`,`Interview Progress`)]}),(0,Q.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[r(`activity:sddWizard.questionOf`,{current:$+1,max:Ae}),` · `,je?(0,Q.jsx)(`span`,{className:`font-medium text-success`,children:r(`activity:sddWizard.minRequiredMet`,`Min met ✓`)}):(0,Q.jsx)(`span`,{children:r(`activity:sddWizard.minRequiredRemaining`,{count:ke-$})})]})]}),(0,Q.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,Q.jsx)(`div`,{className:R(`h-full transition-all duration-500`,je?`bg-success`:`bg-primary`),style:{width:`${Math.max(12,Me)}%`}})})]}),Ee&&(0,Q.jsxs)(`div`,{className:`sdd-rise overflow-hidden rounded-lg border border-primary/20 bg-[hsl(var(--surface-2)/0.85)]`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>y(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-muted/40`,children:[v?(0,Q.jsx)(re,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(C,{className:`h-3.5 w-3.5`}),(0,Q.jsx)(te,{className:`h-3.5 w-3.5`}),r(`activity:sddWizard.taskGraphSummary`,{count:a?.taskCount??0}),(0,Q.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:r(v?`activity:sddWizard.dragToExplore`:`activity:sddWizard.show`)})]}),v&&(0,Q.jsx)(`div`,{className:`h-[32dvh] min-h-[200px]`,children:(0,Q.jsx)(ve,{tasks:Te,columns:a?.board?.columns??[]})})]}),a?.goal&&(0,Q.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2`,children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,Q.jsx)(_,{className:`h-3 w-3`}),` `,r(`activity:sddWizard.goalLabel`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:a.goal})]}),a?.answers.length||o&&Y===`questioning`||G?(0,Q.jsxs)(`div`,{className:`space-y-2.5`,children:[a?.answers.map((e,t)=>(0,Q.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Q.jsx)(ze,{speaker:`assistant`,text:e.question,questionIndex:t+1}),(0,Q.jsx)(ze,{speaker:`user`,text:e.answer})]},`${t}-${e.question.slice(0,32)}`)),o&&Y===`questioning`&&o!==he&&(0,Q.jsx)(ze,{speaker:`assistant`,text:o,live:!0,questionIndex:$+1}),G&&(0,Q.jsx)(ze,{speaker:`assistant`,text:``,thinking:!0})]}):null,a?.spec&&(0,Q.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card p-3`,children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-semibold`,children:[(0,Q.jsx)(x,{className:`h-3.5 w-3.5 text-primary`}),a.spec.title]}),(0,Q.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.spec.overview}),(0,Q.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:a.spec.requirements.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,Q.jsx)(`span`,{className:R(`shrink-0 font-mono uppercase`,fe(e.priority).text),children:e.priority[0]}),(0,Q.jsx)(`span`,{children:e.description})]},`${e.priority}-${t}-${e.description.slice(0,24)}`))})]}),o&&(Y===`implementation`||Y===`task_review`)&&(0,Q.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ee(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-2 text-sm font-semibold hover:bg-muted/40`,children:[b?(0,Q.jsx)(re,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(C,{className:`h-3.5 w-3.5`}),(0,Q.jsx)(x,{className:`h-3.5 w-3.5 text-primary`}),` `,r(`activity:sddWizard.implementationPlan`)]}),b&&(0,Q.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto px-3 py-2`,children:(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:Ie(o)})})]}),o&&Y!==`questioning`&&Y!==`implementation`&&Y!==`task_review`&&!a?.spec&&(0,Q.jsx)(ze,{speaker:`assistant`,text:o}),(Y===`spec_review`||Y===`implementation`||Y===`task_review`)&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[Y===`task_review`?(0,Q.jsxs)(K,{className:`bg-success/15 text-success hover:bg-success/25`,onClick:Ce,disabled:G,children:[(0,Q.jsx)(T,{className:`mr-1.5 h-4 w-4`}),r(`activity:sddWizard.startRun`,`Start Run`)]}):(0,Q.jsxs)(K,{variant:`secondary`,onClick:xe,disabled:G,children:[(0,Q.jsx)(F,{className:`mr-1.5 h-4 w-4`}),r(Y===`spec_review`?`activity:sddWizard.approveSpec`:`activity:sddWizard.approvePlan`)]}),(0,Q.jsxs)(K,{variant:`outline`,onClick:()=>Se(),disabled:G,className:`text-xs text-muted-foreground hover:text-foreground`,title:Y===`spec_review`?r(`activity:sddWizard.backToQuestionsTitle`,`Reject spec and return to questioning`):r(`activity:sddWizard.backToSpecTitle`,`Reject plan and return to spec review`),children:[(0,Q.jsx)(ne,{className:`mr-1.5 h-3.5 w-3.5`}),Y===`spec_review`?r(`activity:sddWizard.backToQuestions`,`Back to Questions`):r(`activity:sddWizard.backToSpec`,`Back to Spec`)]})]}),(0,Q.jsx)(`div`,{ref:W})]}):(0,Q.jsxs)(`div`,{className:`mx-auto mt-8 max-w-xl`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,htmlFor:`sdd-goal`,children:r(`activity:sddWizard.goalPrompt`)}),(0,Q.jsx)(`textarea`,{id:`sdd-goal`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&_e()},rows:4,placeholder:r(`activity:sddWizard.goalPlaceholder`),className:`w-full resize-none rounded-md border border-border bg-card px-3 py-2 text-sm outline-none focus:border-primary`}),(0,Q.jsx)(K,{className:`mt-3`,onClick:_e,disabled:!d.trim()||h,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{className:`mr-1.5 h-4 w-4 animate-spin`}),` `,r(`activity:sddWizard.startingInterview`)]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(x,{className:`mr-1.5 h-4 w-4`}),` `,r(`activity:sddWizard.startInterview`)]})}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:r(`activity:sddWizard.introBody`)})]})]}),X&&Y!==`executing`&&Y!==`done`&&(0,Q.jsxs)(`div`,{className:`border-t bg-card`,children:[Y===`questioning`&&!G&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-4 pt-2`,children:[Oe.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>m(e),className:`inline-flex items-center rounded-full border border-primary/25 bg-primary/5 px-2.5 py-1 text-xs text-primary transition hover:bg-primary/15 hover:border-primary/40 active:scale-95`,children:[(0,Q.jsx)(`span`,{className:`mr-1 opacity-70`,children:`👉`}),e]},e)),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>be(r(`activity:sddWizard.quickBestPracticeDirective`,`Use standard industry best practices for this.`)),className:`inline-flex items-center rounded-full border border-warning/30 bg-warning/10 px-2.5 py-1 text-xs text-warning transition hover:bg-warning/20 active:scale-95`,title:`Answer using standard industry best practice`,children:[(0,Q.jsx)(M,{className:`mr-1 h-3 w-3`}),r(`activity:sddWizard.quickBestPractice`,`Use Best Practice`)]}),je&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>be(`We have covered the necessary requirements. Please generate the complete specification JSON now.`),className:`inline-flex items-center rounded-full border border-success/30 bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition hover:bg-success/25 active:scale-95`,title:r(`activity:sddWizard.generateSpecNowTitle`,`Generate the specification now with gathered requirements`),children:[(0,Q.jsx)(I,{className:`mr-1 h-3 w-3`}),r(`activity:sddWizard.generateSpecNow`,`Generate Spec Now`)]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-end gap-2 px-4 py-2`,children:[(0,Q.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ye())},rows:1,placeholder:r(Y===`questioning`?`activity:sddWizard.answerPlaceholder`:`activity:sddWizard.changePlaceholder`),disabled:G,className:`max-h-32 flex-1 resize-none rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary disabled:opacity-50`}),(0,Q.jsx)(K,{size:`icon`,onClick:ye,disabled:G||!p.trim(),children:(0,Q.jsx)(D,{className:`h-4 w-4`})})]})]})]})}function Ie(e){let t=e.replace(/```json[\s\S]*?```/gi,``).trim();return t.length>0?t:e.trim()}function Le(e){if(!e)return[];let t=[],n=e.matchAll(/(?:^|\n)\s*(?:[0-9]+[.)]|[A-D][.)]|[-*]\s+\*\*|[-*]\s+\[)\s*([^:\n\r]+)/gi);for(let e of n){let n=(e[1]??``).trim().replace(/^[`"']|[`"']$/g,``);n&&n.length>2&&n.length<50&&!t.includes(n)&&t.push(n)}if(t.length===0){let n=e.match(/(?:Options|Choices|Öneriler|Seçenekler):\s*([^\n\r]+)/i);if(n?.[1]){let e=n[1].split(/[,|/]/).map(e=>e.trim()).filter(e=>e.length>2&&e.length<45);t.push(...e.slice(0,4))}}return t.slice(0,4)}function Re(e){let t=e.toLowerCase();return/security|auth|jwt|oauth|token|permission|role|rbac|şifre|güvenlik/i.test(t)?{label:`Security & Auth`,color:`bg-destructive/10 text-destructive border-destructive/20`}:/database|sql|postgres|sqlite|redis|mongodb|schema|tablo|veritabanı/i.test(t)?{label:`Data & Storage`,color:`bg-info/10 text-info border-info/20`}:/api|endpoint|rest|graphql|grpc|route|http/i.test(t)?{label:`API & Routing`,color:`bg-success/10 text-success border-success/20`}:/test|vitest|jest|e2e|playwright|coverage|mock/i.test(t)?{label:`Testing & QA`,color:`bg-warning/10 text-warning border-warning/20`}:/ui|css|component|frontend|react|tailwind|button|view|görsel|arayüz/i.test(t)?{label:`UI & Layout`,color:`bg-primary/10 text-primary border-primary/20`}:/architecture|microservice|queue|worker|scale|mimari/i.test(t)?{label:`Architecture`,color:`bg-accent/30 text-accent-foreground border-border`}:null}function ze({speaker:e,text:t,live:n,thinking:r,questionIndex:i}){let a=e===`user`,[o,s]=(0,Z.useState)(!1),c=!a&&t?Re(t):null;return(0,Q.jsxs)(`div`,{className:R(`group sdd-rise flex items-start gap-2`,a&&`flex-row-reverse`),children:[(0,Q.jsx)(`span`,{className:R(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs`,a?`bg-info/15 text-info`:`bg-primary/15 text-primary`,(n||r)&&`sdd-agent-live`),children:a?(0,Q.jsx)(ie,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(j,{className:`h-3.5 w-3.5`})}),(0,Q.jsxs)(`div`,{className:R(`relative max-w-[85%] rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed text-foreground shadow-sm transition-all`,a?`rounded-tr-sm bg-info/10 border border-info/20`:`rounded-tl-sm bg-muted/80 border border-border/70`),children:[!a&&!r&&(0,Q.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px]`,children:[i!==void 0&&(0,Q.jsxs)(`span`,{className:`rounded bg-primary/15 px-1.5 py-0.2 font-mono font-semibold text-primary`,children:[`Q`,i]}),c&&(0,Q.jsx)(`span`,{className:R(`rounded border px-1.5 py-0.2 font-medium`,c.color),children:c.label})]}),r?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 py-1`,children:[(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-200ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-100ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground`})]}):(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap`,children:t}),!r&&t&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{t&&(navigator.clipboard.writeText(t),s(!0),setTimeout(()=>s(!1),1500))},title:o?`Copied`:`Copy`,className:`absolute -bottom-2 right-2 hidden rounded bg-background/90 p-1 text-[10px] text-muted-foreground shadow border group-hover:flex items-center gap-1 hover:text-foreground`,children:o?(0,Q.jsx)(E,{className:`h-3 w-3 text-success`}):(0,Q.jsx)(y,{className:`h-3 w-3`})})]})]})}var Be=[{id:`project`,labelKey:`activity:sddhub.tabProject`},{id:`board`,labelKey:`activity:sddhub.tabBoard`},{id:`specs`,labelKey:`activity:sddhub.tabSpecs`}];function Ve(){let{t:e}=n(),[t,r]=(0,Z.useState)(`project`),i=V(e=>e.startedRunId),a=V(e=>e.setStartedRunId),o=()=>H(`chat`),s=(0,Z.useCallback)(()=>r(`board`),[]);(0,Z.useEffect)(()=>{i&&(r(`board`),a(null))},[i,a]);let c=(e,t)=>{let n;if(e.key===`ArrowLeft`&&(n=(t-1+Be.length)%Be.length),e.key===`ArrowRight`&&(n=(t+1)%Be.length),e.key===`Home`&&(n=0),e.key===`End`&&(n=Be.length-1),n===void 0)return;e.preventDefault();let i=Be[n];i&&(r(i.id),e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)[n]?.focus())};return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Q.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:`flex shrink-0 items-end border-b border-border/70 bg-card px-4`,children:Be.map((n,i)=>{let a=t===n.id;return(0,Q.jsxs)(`button`,{id:`sdd-hub-tab-${n.id}`,type:`button`,role:`tab`,"aria-selected":a,"aria-controls":`sdd-hub-panel-${n.id}`,tabIndex:a?0:-1,onClick:()=>r(n.id),onKeyDown:e=>c(e,i),className:R(`relative px-4 py-2.5 text-sm font-medium transition-colors`,a?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e(n.labelKey),a&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-0 left-0 right-0 h-0.5 bg-primary`})]},n.id)})}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{id:`sdd-hub-panel-project`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-project`,hidden:t!==`project`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Fe,{onClose:o,onRunStarted:s})}),(0,Q.jsx)(`div`,{id:`sdd-hub-panel-board`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-board`,hidden:t!==`board`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(ke,{onClose:o})}),(0,Q.jsx)(`div`,{id:`sdd-hub-panel-specs`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-specs`,hidden:t!==`specs`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(be,{onClose:o,onRunStarted:s})})]})]})}export{Ve as SddHub};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,En as n,Ga as r,Ji as i,Ot as a,Pa as o,Pi as s,Ua as c,Vi as l,an as u,dt as ee,ft as d,hn as f,jt as p,kn as te,li as m,lt as h,on as ne,or as g,yn as re,zt as _}from"./vendor-C_zEzV4N.js";import"./i18n-DbJfY4tY.js";import{t as v}from"./utils-tsZEnrBH.js";import"./stores-C0xX0jn4.js";import{n as y}from"./ui-store-xx1NssJI.js";import{r as b}from"./ConfirmModal-KzK0LoJw.js";import{b as ie}from"./index-DQn-Lz9q.js";var x=e(r(),1),S=h(),ae=10,oe=20,C=e=>{if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t},w=e=>(e.iterationCount??0)+(e.toolCallCount??0)+(e.fileChangeCount??0),T=e=>{let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.max(0,Date.now()-t);if(n<6e4)return c.t(`common:time.justNow`);if(n<36e5)return c.t(`common:time.minutesAgo`,{count:Math.floor(n/6e4)});if(n<864e5)return c.t(`common:time.hoursAgo`,{count:Math.floor(n/36e5)});let r=Math.floor(n/864e5);return r<7?c.t(`common:time.daysAgo`,{count:r}):new Date(t).toLocaleDateString()},E=e=>e.lastActivityAt??e.endedAt??e.startedAt;function D(e){let t=C(e.startedAt);if(!t)return``;let n=e.isCurrent?Date.now():C(e.endedAt)||t,r=Math.max(0,Math.floor((n-t)/6e4));if(r<1)return`<1m`;if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h ${r%60}m`:`${Math.floor(i/24)}d ${i%24}h`}function O(e){return new Intl.NumberFormat(void 0,{notation:e>=1e3?`compact`:`standard`,maximumFractionDigits:1}).format(e)}function se(e){return e.filter(e=>e.tokenTotal===0&&!e.isCurrent).map(e=>e.id)}function ce(e,t){let n=t.query.trim().toLocaleLowerCase(),r=new Set(t.favoriteIds);return[...e.filter(e=>{if(!(!n||[e.name,e.title,e.lastUserMessage,e.model,e.provider,e.id,...Object.keys(e.toolBreakdown??{})].some(e=>e?.toLocaleLowerCase().includes(n))))return!1;switch(t.filter){case`favorites`:return r.has(e.id);case`active`:return e.isCurrent;case`completed`:return!e.isCurrent&&(e.outcome===`completed`||e.outcome===void 0&&!!e.endedAt);case`issues`:return e.outcome===`error`||e.outcome===`timeout`||e.outcome===`aborted`||(e.toolErrorCount??0)>0;default:return!0}})].sort((e,n)=>{if(t.sort===`tokens`&&n.tokenTotal!==e.tokenTotal)return n.tokenTotal-e.tokenTotal;if(t.sort===`activity`){let t=w(n)-w(e);if(t!==0)return t}return C(E(n))-C(E(e))})}function le(e,t,n=Date.now()){let r=new Date(n);r.setHours(0,0,0,0);let i=r.getTime(),a=i-864e5,o=i-5184e5,s=new Set(t),c=e.filter(e=>s.has(e.id)),l={today:[],yesterday:[],thisWeek:[],earlier:[]};for(let t of e){if(s.has(t.id))continue;let e=C(E(t));e>=i?l.today.push(t):e>=a?l.yesterday.push(t):e>=o?l.thisWeek.push(t):l.earlier.push(t)}let u=[];c.length>0&&u.push({label:`favorites`,rows:c,favorite:!0});for(let e of[`today`,`yesterday`,`thisWeek`,`earlier`])l[e].length>0&&u.push({label:e,rows:l[e]});return u}function ue(e){return e.reduce((e,t)=>({sessions:e.sessions+1,active:e.active+ +!!t.isCurrent,tokens:e.tokens+t.tokenTotal,tools:e.tools+(t.toolCallCount??0),files:e.files+(t.fileChangeCount??0),errors:e.errors+(t.toolErrorCount??0)+ +(t.outcome===`error`)}),{sessions:0,active:0,tokens:0,tools:0,files:0,errors:0})}function de(e){if(e.isCurrent)return{icon:o,label:`active`,defaultLabel:`Active`,className:`text-primary`};switch(e.outcome){case`completed`:return{icon:i,label:`completed`,defaultLabel:`Completed`,className:`text-success`};case`error`:return{icon:a,label:`error`,defaultLabel:`Error`,className:`text-destructive`};case`timeout`:return{icon:s,label:`timeout`,defaultLabel:`Timed out`,className:`text-warning`};case`aborted`:return{icon:l,label:`aborted`,defaultLabel:`Aborted`,className:`text-muted-foreground`};default:return e.endedAt?{icon:i,label:`completed`,defaultLabel:`Completed`,className:`text-success`}:{icon:f,label:`saved`,defaultLabel:`Saved session`,className:`text-muted-foreground`}}}function fe({stats:e}){let{t:n}=t(),r=[{label:n(`activity:sessions.stats.sessions`,{defaultValue:`Sessions`}),value:e.sessions,icon:f},{label:n(`activity:sessions.stats.tokens`,{defaultValue:`Tokens`}),value:e.tokens,icon:o},{label:n(`activity:sessions.stats.tools`,{defaultValue:`Tool calls`}),value:e.tools,icon:d},{label:n(`activity:sessions.stats.files`,{defaultValue:`Files changed`}),value:e.files,icon:m},{label:n(`activity:sessions.stats.errors`,{defaultValue:`Errors`}),value:e.errors,icon:a}];return(0,S.jsx)(`div`,{className:`grid grid-cols-2 border-b border-border/75 bg-card md:grid-cols-5`,children:r.map(e=>{let t=e.icon;return(0,S.jsxs)(`div`,{className:`border-b border-r border-border/75 px-4 py-3 md:border-b-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,S.jsx)(t,{className:`h-3 w-3`}),e.label]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums`,children:O(e.value)})]},e.label)})})}function k({historyQuery:e,setHistoryQuery:r,historyEntries:i,historyLoading:o,historyError:s,wsConnected:c,listSessions:l,resumeSession:h,deleteSession:C,renameSession:w,variant:k=`sidebar`}){let{t:A}=t(),j=y(e=>e.favoriteSessionIds),pe=y(e=>e.toggleFavoriteSession),M=y(e=>e.sessionNicknames),N=y(e=>e.setSessionNickname),me=y(e=>e.setInspectSession),[P,he]=(0,x.useState)(`all`),[F,ge]=(0,x.useState)(`recent`),[I,L]=(0,x.useState)(null),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(null),[H,U]=(0,x.useState)(1),W=(0,x.useRef)(null),G=(0,x.useRef)(null),K=k===`workspace`,q=(0,x.useCallback)(e=>e.name||M[e.id]||e.title||A(`activity:sessions.empty`),[M,A]),J=(0,x.useCallback)(e=>{L(e.id),z(e.name??M[e.id]??e.title??``)},[M]),Y=(0,x.useCallback)(e=>{L(null),N(e,R),w(e,R)},[R,w,N]);(0,x.useEffect)(()=>{B&&i.some(e=>e.id===B&&e.isCurrent)&&(V(null),W.current&&clearTimeout(W.current))},[i,B]),(0,x.useEffect)(()=>{I&&(G.current?.focus(),G.current?.select())},[I]),(0,x.useEffect)(()=>()=>{W.current&&clearTimeout(W.current)},[]);let X=(0,x.useCallback)(e=>{V(e),h(e),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>V(null),1e4)},[h]),Z=(0,x.useMemo)(()=>se(i),[i]),Q=(0,x.useMemo)(()=>ce(i,{query:e,filter:P,sort:F,favoriteIds:j}),[j,P,i,e,F]),$=K?oe:ae,_e=(0,x.useMemo)(()=>Q.slice((H-1)*$,H*$),[H,$,Q]),ve=(0,x.useMemo)(()=>le(_e,j),[j,_e]),ye=(0,x.useMemo)(()=>ue(i),[i]);(0,x.useEffect)(()=>{U(1)},[P,e,F]),(0,x.useEffect)(()=>{let e=Math.max(1,Math.ceil(Q.length/$));H>e&&U(e)},[H,$,Q.length]);let be=(0,x.useCallback)(async()=>{if(Z.length!==0&&await b({title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),message:A(`activity:sessions.deleteEmptyConfirmBody`),confirmLabel:A(`common:action.delete`),danger:!0}))for(let e of Z)C(e)},[C,Z,A]),xe=[{id:`all`,label:A(`activity:sessions.filters.all`,{defaultValue:`All`})},{id:`favorites`,label:A(`activity:sessions.filters.favorites`,{defaultValue:`Pinned`})},{id:`active`,label:A(`activity:sessions.filters.active`,{defaultValue:`Active`})},{id:`completed`,label:A(`activity:sessions.filters.completed`,{defaultValue:`Completed`})},{id:`issues`,label:A(`activity:sessions.filters.issues`,{defaultValue:`Issues`})}];return(0,S.jsxs)(`div`,{className:v(`flex min-h-0 min-w-0 flex-1 flex-col bg-background`,K&&`h-full`),"data-history-variant":k,children:[K?(0,S.jsx)(fe,{stats:ye}):null,(0,S.jsxs)(`div`,{className:v(`border-b border-border/75 bg-card`,K?`px-4 py-3`:`px-3 py-2`),children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:A(`activity:sessions.recentSessions`)}),K?(0,S.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:A(`activity:sessions.workspaceHint`,{defaultValue:`Search, inspect, pin and resume every project conversation.`})}):null]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center border border-border/75`,children:[Z.length>0?(0,S.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center justify-center gap-1 border-r border-border/75 px-2 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-40`,onClick:be,disabled:!c,title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),children:[(0,S.jsx)(p,{className:`h-3.5 w-3.5`}),K?(0,S.jsx)(`span`,{className:`text-[10px]`,children:Z.length}):null]}):null,(0,S.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 items-center justify-center text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40`,onClick:()=>l(200),disabled:!c,title:A(`common:action.refresh`),children:o?(0,S.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}):(0,S.jsx)(re,{className:`h-3.5 w-3.5`})})]})]}),(0,S.jsxs)(`div`,{className:v(`grid gap-2`,K?`mt-3 lg:grid-cols-[minmax(18rem,1fr)_auto_auto]`:`mt-2`),children:[(0,S.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,S.jsx)(u,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,S.jsx)(`input`,{type:`search`,value:e,onChange:e=>r(e.target.value),placeholder:A(`activity:sessions.filterPlaceholder`),"aria-label":A(`activity:sessions.filterPlaceholder`),className:`h-9 w-full border border-border/75 bg-background pl-8 pr-8 text-xs outline-none transition-colors placeholder:text-muted-foreground/70 focus:border-primary focus:ring-1 focus:ring-primary`}),e?(0,S.jsx)(`button`,{type:`button`,onClick:()=>r(``),className:`absolute right-0 top-0 inline-flex h-9 w-8 items-center justify-center text-muted-foreground hover:text-foreground`,title:A(`activity:sessions.clearFilter`),children:(0,S.jsx)(ee,{className:`h-3.5 w-3.5`})}):null]}),(0,S.jsxs)(`fieldset`,{className:`flex min-w-0 overflow-x-auto border border-border/75`,children:[(0,S.jsx)(`legend`,{className:`sr-only`,children:A(`activity:sessionList.historyFilters`)}),xe.map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>he(e.id),"aria-pressed":P===e.id,className:v(`h-9 shrink-0 border-r border-border/75 px-2.5 text-[10px] font-semibold uppercase tracking-[0.08em] transition-colors last:border-r-0`,P===e.id?`bg-foreground text-background`:`bg-background text-muted-foreground hover:bg-muted hover:text-foreground`),children:e.label},e.id))]}),(0,S.jsxs)(`select`,{value:F,onChange:e=>ge(e.target.value),"aria-label":A(`activity:sessions.sort.label`,{defaultValue:`Sort sessions`}),className:`h-9 border border-border/75 bg-background px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground outline-none focus:border-primary`,children:[(0,S.jsx)(`option`,{value:`recent`,children:A(`activity:sessions.sort.recent`,{defaultValue:`Recent`})}),(0,S.jsx)(`option`,{value:`tokens`,children:A(`activity:sessions.sort.tokens`,{defaultValue:`Most tokens`})}),(0,S.jsx)(`option`,{value:`activity`,children:A(`activity:sessions.sort.activity`,{defaultValue:`Most activity`})})]})]})]}),s?(0,S.jsx)(`div`,{className:`border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:s}):null,(0,S.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain overflow-x-hidden [scrollbar-gutter:stable]`,children:i.length===0&&!o?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(f,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noHistory`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noHistoryHint`)})]}):ve.length===0?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(u,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noMatches`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noMatchesHint`)})]}):(0,S.jsxs)(`div`,{className:v(K?`mx-auto w-full max-w-7xl p-4 lg:p-6`:`p-2`),children:[(0,S.jsx)(`div`,{className:v(`space-y-5`,K&&`grid gap-x-5 space-y-0 xl:grid-cols-2`),children:ve.map(e=>(0,S.jsxs)(`section`,{className:`min-w-0`,children:[(0,S.jsxs)(`div`,{className:v(`sticky top-0 z-[1] flex items-center gap-1 border-b border-border/75 bg-background/95 px-1 py-2 text-[10px] font-semibold uppercase tracking-[0.14em] backdrop-blur-sm`,e.favorite?`text-warning`:`text-muted-foreground`),children:[e.favorite?(0,S.jsx)(_,{className:`h-3 w-3 fill-current`}):null,A(`activity:sessions.group.${e.label}`),(0,S.jsx)(`span`,{className:`ml-1 font-mono font-normal text-muted-foreground`,children:e.rows.length})]}),(0,S.jsx)(`div`,{className:`divide-y divide-border/75 border-x border-b border-border/75`,children:e.rows.map(e=>{let t=j.includes(e.id),r=de(e),i=r.icon,o=I===e.id,s=B===e.id;return(0,S.jsxs)(`article`,{className:v(`group grid min-w-0 grid-cols-[minmax(0,1fr)_auto] bg-card transition-colors`,e.isCurrent?`border-l-2 border-l-primary bg-primary/5`:`border-l-2 border-l-transparent hover:bg-muted/45`),"data-session-id":e.id,children:[o?(0,S.jsxs)(`div`,{className:`min-w-0 px-3 py-3`,children:[(0,S.jsx)(`label`,{className:`block text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,htmlFor:`session-name-${e.id}`,children:A(`activity:sessions.rename`,{defaultValue:`Session name`})}),(0,S.jsx)(`input`,{ref:G,id:`session-name-${e.id}`,value:R,onChange:e=>z(e.target.value),onBlur:()=>Y(e.id),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),Y(e.id)):t.key===`Escape`&&(t.preventDefault(),L(null))},placeholder:e.title||A(`activity:sessions.nicknamePlaceholder`),className:`mt-1 h-8 w-full border border-primary bg-background px-2 text-sm outline-none ring-1 ring-primary`})]}):(0,S.jsx)(`button`,{type:`button`,disabled:e.isCurrent||B!==null,onClick:()=>X(e.id),onDoubleClick:()=>J(e),"aria-current":e.isCurrent?`page`:void 0,className:`min-w-0 px-3 py-3 text-left outline-none focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary disabled:cursor-default`,children:(0,S.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,S.jsx)(`span`,{className:v(`mt-0.5 shrink-0`,r.className),title:A(`activity:sessions.status.${r.label}`,{defaultValue:r.defaultLabel}),children:(0,S.jsx)(i,{className:v(`h-3.5 w-3.5`,e.isCurrent&&`animate-pulse`)})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,title:q(e),children:q(e)}),(0,S.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.provider,`/`,e.model]}),e.lastUserMessage?(0,S.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.lastUserMessage,children:e.lastUserMessage}):null,(0,S.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] text-muted-foreground`,children:[s?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans font-semibold text-primary`,children:[(0,S.jsx)(g,{className:`h-3 w-3 animate-spin`}),A(`activity:sessions.resuming`)]}):(0,S.jsx)(`span`,{title:new Date(E(e)).toLocaleString(),children:T(E(e))}),(0,S.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,S.jsx)(`span`,{children:D(e)}),e.tokenTotal>0?(0,S.jsxs)(`span`,{children:[O(e.tokenTotal),` tok`]}):null,(e.messageCount??0)>0?(0,S.jsxs)(`span`,{children:[O(e.messageCount??0),` msg`]}):null,(e.toolCallCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(d,{className:`h-3 w-3`}),e.toolCallCount]}):null,(e.fileChangeCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(m,{className:`h-3 w-3`}),e.fileChangeCount]}):null,(e.toolErrorCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-destructive`,children:[(0,S.jsx)(a,{className:`h-3 w-3`}),e.toolErrorCount]}):null]})]})]})}),(0,S.jsxs)(`div`,{className:`flex items-start gap-0.5 p-2`,children:[!e.isCurrent&&K&&!o?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>X(e.id),disabled:B!==null,className:`inline-flex h-7 items-center gap-1 border border-border/75 px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:border-primary hover:text-primary disabled:opacity-40`,title:A(`activity:sessions.resume`,{defaultValue:`Resume session`}),children:[(0,S.jsx)(n,{className:`h-3 w-3`}),A(`activity:sessions.resumeShort`,{defaultValue:`Resume`})]}):null,o?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>me(e.id),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:A(`activity:sessions.inspect`,{defaultValue:`Inspect session`}),children:(0,S.jsx)(ne,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>pe(e.id),"aria-pressed":t,className:v(`inline-flex h-7 w-7 items-center justify-center transition-colors hover:bg-warning/10 hover:text-warning`,t?`text-warning`:`text-muted-foreground`),title:A(t?`activity:sessions.unfavorite`:`activity:sessions.markFavorite`),children:(0,S.jsx)(_,{className:v(`h-3.5 w-3.5`,t&&`fill-current`)})}),o?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>J(e),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:A(`activity:sessions.renameAction`,{defaultValue:`Rename`}),children:(0,S.jsx)(te,{className:`h-3.5 w-3.5`})}),e.isCurrent?null:(0,S.jsx)(`button`,{type:`button`,onClick:async()=>{await b({title:A(`activity:sessions.deleteSessionConfirmTitle`),message:A(`activity:sessions.deleteSessionConfirmBody`,{name:q(e)}),confirmLabel:A(`common:action.delete`),danger:!0})&&C(e.id)},className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:A(`activity:sessions.deleteSessionTitle`),children:(0,S.jsx)(p,{className:`h-3.5 w-3.5`})})]})]},e.id)})})]},e.label))}),(0,S.jsx)(ie,{page:H,pageSize:$,totalItems:Q.length,onPageChange:U,compact:!K,itemLabel:`sessions`})]})})]})}export{D as i,O as n,T as r,k as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Fr as n,Ga as r,La as i,Ti as a,Tn as o,Ua as s,Wt as c,ea as l,en as u,jr as d,lt as f,ma as p,mi as m,na as h,or as g,qt as _,ra as v,t as y,wa as b,xr as x,yn as S}from"./vendor-C_zEzV4N.js";import"./i18n-DbJfY4tY.js";import{t as ee}from"./useWebSocket-D9Dy4-9x.js";import{t as C}from"./ws-client-CBfMQmW9.js";import{t as w}from"./utils-tsZEnrBH.js";import{I as te}from"./stores-C0xX0jn4.js";import{o as T}from"./view-navigation-CZKugncK.js";import{n as E}from"./Toaster-BlD1m8P2.js";import{a as D,n as ne,o as re,r as O,t as k}from"./dialog-BJjDUqb3.js";import{t as A}from"./button-DvpRpKkt.js";import{t as j}from"./input-BtoHcCl9.js";import{D as M,a as N,b as P,i as F,r as I,t as L,x as R}from"./index-DQn-Lz9q.js";var z=e(r(),1);function B(e,t=8e3){return new Promise((n,r)=>{let i=setTimeout(()=>{a(),r(Error(`timeout`))},t),a=e.on(`key.operation_result`,e=>{clearTimeout(i),a(),n(e.payload)})})}var V=f();function ie({onKeySaved:e}){let{t:n}=t(),[r,i]=(0,z.useState)(!1),[a,s]=(0,z.useState)(``),[c,u]=(0,z.useState)(`openai-compatible`),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(``),[h,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)([]),{setFieldRef:b,handleKeyDown:x}=N(),S=async()=>{if(a.trim()){_(!0);try{let t=C(te.getState().wsUrl),r=B(t);t.send({type:`provider.add`,payload:{id:a.trim(),family:c,baseUrl:d.trim()||void 0,apiKey:p.trim()||void 0,models:v.length>0?v.map(e=>e.id):void 0,customModels:v.length>0?Object.fromEntries(v.filter(e=>e.name||e.maxOutput||e.capabilities).map(e=>[e.id,{...e.name&&e.name!==e.id?{name:e.name}:{},...e.maxOutput?{maxOutput:e.maxOutput}:{},...e.capabilities&&Object.values(e.capabilities).some(Boolean)?{capabilities:e.capabilities}:{}}])):void 0}});let o=await r;if(!o.success)throw Error(o.message);E.success(n(`setup:screen.toasts.providerAdded`,{id:a.trim()})),e(a.trim()),t.listSavedProviders(),t.probeProvider(a.trim()),s(``),f(``),m(``),y([]),i(!1)}catch(e){let t=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;E.error(t??n(`setup:screen.toasts.providerAddFailed`))}finally{_(!1)}}};return(0,V.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,V.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,V.jsx)(o,{className:`h-5 w-5 text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium`,children:n(`setup:screen.custom.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`setup:screen.custom.description`)})]}),(0,V.jsx)(l,{className:w(`h-4 w-4 text-muted-foreground transition-transform`,r&&`rotate-90`)})]}),r&&(0,V.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:n(`setup:screen.custom.localServers`)}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:I.map(e=>(0,V.jsx)(A,{type:`button`,size:`sm`,variant:a===e.id?`default`:`outline`,onClick:()=>{s(e.id),u(`openai-compatible`),f(e.defaultBaseUrl),e.noAuth&&m(``),y([])},title:e.hint,children:e.label},e.id))})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.providerId`)}),(0,V.jsx)(j,{placeholder:n(`activity:customProviderSection.eGMyLlm`),value:a,onChange:e=>s(e.target.value),className:`text-sm`,ref:b(0),onKeyDown:e=>x(e,0)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.family`)}),(0,V.jsxs)(`select`,{value:c,onChange:e=>u(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,ref:b(1),onKeyDown:e=>x(e,1),children:[(0,V.jsx)(`option`,{value:`openai-compatible`,children:n(`setup:screen.custom.familyOpenAiCompatible`)}),(0,V.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,V.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,V.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.baseUrl`)}),(0,V.jsx)(j,{placeholder:n(`activity:customProviderSection.eGHttpLocalhost11434V1`),value:d,onChange:e=>f(e.target.value),className:`text-sm font-mono`,ref:b(2),onKeyDown:e=>x(e,2)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:n(`setup:screen.custom.apiKey`)}),(0,V.jsx)(j,{type:`password`,placeholder:n(`setup:screen.custom.apiKeyPlaceholder`),value:p,onChange:e=>m(e.target.value),className:`text-sm font-mono`,ref:b(3),onKeyDown:e=>x(e,3)})]}),(0,V.jsx)(L,{models:v,onChange:y}),(0,V.jsxs)(A,{onClick:S,disabled:!a.trim()||h,size:`sm`,ref:b(4),onKeyDown:e=>x(e,4,S),children:[h?(0,V.jsx)(g,{className:`h-4 w-4 animate-spin mr-2`}):null,n(`setup:screen.custom.add`)]})]})]})}var H=F();async function ae(e,t){try{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r))throw Error(`Expected JSON array`);let i=r.filter(e=>typeof e.id==`string`&&typeof e.name==`string`&&typeof e.family==`string`);return i.length>0?i:H}catch{return H}}function oe(e,t){let n=new Date().getTime()-e.getTime(),r=Math.floor(n/1e3);if(r<10)return t(`setup:screen.time.justNow`);if(r<60)return t(`setup:screen.time.secondsAgo`,{count:r});let i=Math.floor(r/60);if(i<60)return t(`setup:screen.time.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?t(`setup:screen.time.hoursAgo`,{count:a}):t(`setup:screen.time.daysAgo`,{count:Math.floor(a/24)})}var se=e(y(),1);function ce({popular:e,catalogProvider:r,savedProvider:i,onKeySaved:o,probeResult:s}){let{t:c}=t(),[d,f]=(0,z.useState)(``),[p,_]=(0,z.useState)(!1),[y,b]=(0,z.useState)(!!i?.apiKeys.some(e=>e.isActive)),[x,S]=(0,z.useState)(!1),[ee,T]=(0,z.useState)(!1),[M,N]=(0,z.useState)(!1),[P,F]=(0,z.useState)(null);(0,z.useEffect)(()=>{M&&e.referral&&se.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>F(e)).catch(()=>F(null))},[M,e.referral]);let I=async()=>{if(d.trim()){_(!0);try{let t=C(te.getState().wsUrl),n=B(t);r?t.addKey(e.id,`default`,d.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:d.trim()}});let i=await n;if(!i.success)throw Error(i.message);b(!0),f(``),E.success(c(`setup:screen.toasts.keySaved`,{name:e.name})),o(e.id),t.listSavedProviders(),t.probeProvider(e.id)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;E.error(n??c(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{_(!1)}}},L=e=>{e.key===`Enter`&&d.trim()&&I()},R=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),T(!0),E.success(c(`setup:screen.toasts.referralCopied`)),setTimeout(()=>T(!1),2e3)}catch{E.error(c(`setup:screen.toasts.referralCopyFailed`))}},ie=r&&r.modelCount>0;return(0,V.jsxs)(`div`,{className:w(`rounded-xl border p-4 transition-all`,y?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),y&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-success/10 text-success border border-success/20`,children:[(0,V.jsx)(v,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.keySaved`)]}),e.referral&&!y&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-warning/10 text-warning border border-warning/20`,children:[(0,V.jsx)(n,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.referral`)]})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!y&&(0,V.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),y?y?(0,V.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[i?.baseUrl&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:i.baseUrl,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.url`),` `]}),i.baseUrl]}),i?.models&&i.models.length>0&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.models`),` `]}),i.pickedModelId??i.models[0],(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` (+`,i.models.length-1,` more)`]})]}),s===`probing`?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,V.jsx)(g,{className:`h-3 w-3 animate-spin`}),c(`setup:screen.probe.checking`,`Checking connection…`)]}):s?.ok?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),(0,V.jsxs)(`span`,{children:[c(`setup:screen.probe.connected`,`Connected`),s.modelCount!=null&&` · ${s.modelCount} ${c(`setup:screen.probe.models`,`models`)}`,s.elapsedMs!=null&&` · ${s.elapsedMs}ms`]})]}):s&&!s.ok?(0,V.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,V.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:c(`setup:screen.probe.failed`,`Probe failed`)}),s.status===`no_base_url`&&(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:c(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),s.status===`unreachable`&&(0,V.jsxs)(`span`,{className:`block text-destructive/70`,children:[c(`setup:screen.probe.unreachable`,`Could not connect`),s.detail?`: ${s.detail}`:``]}),s.status!==`no_base_url`&&s.status!==`unreachable`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:s.httpStatus==null?s.status:`${c(`setup:screen.probe.httpStatus`,`Status`)} ${s.httpStatus}`}),s.detail&&(0,V.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:s.detail,children:s.detail})]})]})]}):null,ie&&(0,V.jsxs)(`button`,{type:`button`,onClick:()=>S(!x),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[c(`setup:screen.providers.modelsAvailable`,{count:r?.modelCount??0}),x?(0,V.jsx)(h,{className:`h-3 w-3`}):(0,V.jsx)(l,{className:`h-3 w-3`})]})]}):null:(0,V.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(j,{type:`password`,placeholder:e.keyPlaceholder,value:d,onChange:e=>f(e.target.value),onKeyDown:L,className:`font-mono text-sm`}),(0,V.jsx)(A,{onClick:I,disabled:!d.trim()||p,size:`sm`,className:`shrink-0`,children:p?(0,V.jsx)(g,{className:`h-4 w-4 animate-spin`}):c(`setup:screen.card.save`)})]}),e.docsUrl&&(0,V.jsxs)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors`,children:[c(`setup:screen.card.getKey`),` `,(0,V.jsx)(m,{className:`h-3 w-3`})]}),e.referral&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:ee?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(v,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copied`)]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(a,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copyReferral`)]})}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,V.jsx)(u,{className:`h-3 w-3`}),` `,c(`setup:screen.card.share`)]})]})]})]})]}),(0,V.jsx)(k,{open:M,onOpenChange:N,children:(0,V.jsxs)(ne,{className:`sm:max-w-md`,children:[(0,V.jsxs)(D,{children:[(0,V.jsxs)(re,{className:`flex items-center gap-2`,children:[(0,V.jsx)(n,{className:`h-4 w-4 text-warning`}),c(`setup:screen.share.title`,{name:e.name})]}),(0,V.jsx)(O,{children:c(`setup:screen.share.description`)})]}),(0,V.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`text-sm text-center`,children:(0,V.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),P?(0,V.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,V.jsx)(`img`,{src:P,alt:c(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,V.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,V.jsx)(g,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://twitter.com/intent/tweet?text=${t}&url=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.twitter`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`Check out ${e.name}! ${e.referral.reward}`);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${t}&summary=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.linkedin`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`})}),c(`activity:providerKey.linkedin`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward} ${e.referral.url}`);window.open(`https://t.me/share/url?url=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.telegram`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`})}),c(`activity:providerKey.telegram`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://wa.me/?text=${t}%20${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.whatsapp`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.134 1.585 5.934L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z`})}),c(`activity:providerKey.whatsapp`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`${e.name} - ${e.referral.reward}`);window.open(`https://www.reddit.com/submit?url=${t}&title=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.reddit`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 0 1.108-.701 1.25 1.25 0 0 1 2.144.33zm-8.811 8.748c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754zm7.944 0c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754z`})}),c(`activity:providerKey.reddit`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://www.facebook.com/sharer/sharer.php?u=${n}&quote=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:c(`setup:screen.share.facebook`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),c(`activity:providerKey.facebook`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`mailto:?subject=${t}&body=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors`,title:c(`setup:screen.share.email`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25H4.5a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75`})}),c(`activity:providerKey.email`)]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(j,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,V.jsx)(A,{size:`sm`,variant:`outline`,onClick:R,className:`shrink-0`,children:ee?(0,V.jsx)(v,{className:`h-4 w-4`}):(0,V.jsx)(a,{className:`h-4 w-4`})})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:c(`setup:screen.share.hint`)})]})]})})]})})]})}function U(){let{t:e}=t(),{model:n,setProvider:r,setModel:a,wsConnected:o,wsUrl:u}=te(i(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));ee();let[f,m]=(0,z.useState)([]),[h,y]=(0,z.useState)({}),[D,ne]=(0,z.useState)([]),[re,O]=(0,z.useState)(!1),[k,j]=(0,z.useState)(null),[N,F]=(0,z.useState)(0),[I,L]=(0,z.useState)(new Set),[B,se]=(0,z.useState)({}),[U,le]=(0,z.useState)(H),[W,G]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(0),[fe,pe]=(0,z.useState)(0),[K,me]=(0,z.useState)(null),q=(0,z.useRef)(!0);(0,z.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return G(!0),ae(t,e.signal).then(t=>{if(t!==H){if(le(t),G(!1),!q.current){let e=t.length-fe;e>0?E.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?E.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):E.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),pe(t.length)}me(new Date);return}return ae(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(le(e),!q.current){let t=e.length-fe;t>0?E.success(s.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?E.success(s.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):E.success(s.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),pe(e.length)}me(new Date)}}).catch(()=>{q.current||E.error(s.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{G(!1),q.current=!1}),()=>e.abort()},[ue]);let[J,he]=(0,z.useState)(null),[Y,X]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!o)return;let e=C(u),t=setTimeout(()=>{t=null,O(!1),j(s.t(`setup:screen.errors.backendNotResponding`))},8e3),r=()=>{t&&=(clearTimeout(t),null)},i=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){r(),j(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));m(t),O(!1)}}),a=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let t=e.payload;if(t.provider!==J)return;y(e=>({...e,[t.provider]:t.models})),_e(!1),t.models.length===1?X(t.models[0].id):n&&t.models.some(e=>e.id===n)&&X(n)}}),c=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));ne(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));L(n)}}),l=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;se(e=>({...e,[t.providerId]:t}))});return j(null),O(!0),e.listProviders(),()=>{r(),i?.(),a?.(),c?.(),l?.()}},[o,u,n,N,J]);let ve=(0,z.useCallback)(()=>{j(null),F(e=>e+1)},[]),ye=(0,z.useCallback)(()=>{de(e=>e+1)},[]),be=(0,z.useCallback)(t=>oe(t,e),[e]),Z=(0,z.useCallback)(e=>{L(t=>new Set([...t,e])),he(e),X(null)},[]),xe=I.size>0;(0,z.useEffect)(()=>{if(!J||!o)return;let e=C(u);h[J]||(_e(!0),e.listProviderModels(J))},[J,o,u,h]);let Se=J?h[J]??[]:[],Ce=(0,z.useCallback)(async()=>{if(!J||!Y)return;if(!I.has(J)){E.error(`Please save the provider configuration before starting a session.`);return}r(J),a(Y);let e=C(u),t=await e.switchModel(J,Y,5e3);t.success?(e.newSession(),T(`chat`)):E.error(t.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,r,a,u]),we=(0,z.useCallback)(async()=>{if(!J||!Y)return;r(J),a(Y);let e=await C(u).switchModel(J,Y,5e3);e.success?T(`chat`):E.error(e.message||s.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,r,a,u]),Te=new Set(U.map(e=>e.id)),Ee=f.filter(e=>!Te.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=R(Ee,10);R(D,9);let $=R(Se,12,J);return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,V.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b bg-card px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(`img`,{src:`/wrongstack.svg`,alt:`WrongStack`,draggable:!1,className:`ws-brand-logo h-10 w-10 shrink-0 border border-border/70 shadow-sm`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),xe&&J?(0,V.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,V.jsx)(v,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,V.jsx)(M,{className:`min-h-0 flex-1`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,xe?`text-success`:`text-primary font-medium`),children:[(0,V.jsx)(x,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,V.jsx)(l,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(p,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,V.jsx)(l,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J&&Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(c,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,V.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,V.jsx)(_,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),k?(0,V.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 py-12 rounded-xl border border-destructive/30 bg-destructive/5 px-6`,children:[(0,V.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,V.jsx)(d,{className:`h-6 w-6 text-destructive`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:k})]}),(0,V.jsxs)(A,{onClick:ve,size:`sm`,variant:`outline`,children:[(0,V.jsx)(g,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[W&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,V.jsx)(g,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),K&&!W&&(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:K.toLocaleString(),children:be(K)}),(0,V.jsxs)(`button`,{type:`button`,onClick:ye,disabled:W,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,title:e(`setup:screen.providers.refreshTitle`),children:[(0,V.jsx)(S,{className:w(`h-3 w-3`,W&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:U.map(e=>(0,V.jsx)(ce,{popular:e,catalogProvider:f.find(t=>t.id===e.id),savedProvider:D.find(t=>t.id===e.id),onKeySaved:Z,probeResult:B[e.id]},e.id))})]}),Ee.length>0&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,V.jsx)(ce,{popular:{id:t.id,name:t.name,description:e(`setup:screen.providers.catalogDescription`,{family:t.family,count:t.modelCount}),icon:`🔗`,color:`from-muted/60 to-muted/20 border-border hover:border-primary/40`,keyPlaceholder:`API key`,family:t.family},catalogProvider:t,savedProvider:D.find(e=>e.id===t.id),onKeySaved:Z,probeResult:B[t.id]},t.id))}),(0,V.jsx)(P,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,V.jsx)(ie,{onKeySaved:Z})]})]}),re&&(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(g,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),J&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,V.jsx)(c,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{he(null),X(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:J})}),ge?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(g,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Se.length>0?(0,V.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:$.pageItems.map(e=>{let t=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>X(e.id),className:w(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,Y===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:t}),e.capabilities.slice(0,3).map(e=>(0,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),Y===e.id&&(0,V.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,V.jsx)(v,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,V.jsx)(P,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),J&&Y&&(0,V.jsxs)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:[(0,V.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[J,` / `,Y]})}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,V.jsxs)(A,{onClick:Ce,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(p,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,V.jsx)(b,{className:`h-4 w-4 ml-2`})]}),(0,V.jsxs)(A,{onClick:we,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(v,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{U as SetupScreen};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-C_zEzV4N.js","assets/rolldown-runtime-hePW80VL.js","assets/monaco-BCqJp2xW.js","assets/monaco-Bowa0-zp.css","assets/markdown-CIRD7kOg.js","assets/vendor-BMdWcCR4.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ga as n,Kr as r,Nn as ee,Qr as te,Ti as ne,Ua as i,Wt as re,dt as ie,ea as a,ga as ae,jr as oe,jt as o,kn as se,lt as s,or as c,ra as ce,ta as le,xa as l,yi as ue,yn as de}from"./vendor-C_zEzV4N.js";import"./i18n-DbJfY4tY.js";import{s as u}from"./monaco-BCqJp2xW.js";import{t as fe}from"./useWebSocket-D9Dy4-9x.js";import{t as d}from"./utils-tsZEnrBH.js";import{n as pe}from"./ui-store-xx1NssJI.js";import{o as me}from"./view-navigation-CZKugncK.js";import{a as he,n as ge,o as _e,t as ve}from"./dialog-BJjDUqb3.js";import{p as f}from"./markdown-CIRD7kOg.js";import{c as ye,g as p,u as m}from"./index-DQn-Lz9q.js";import{t as be}from"./empty-state-Cefmzojx.js";var h=e(n(),1),g=s(),xe=(0,h.lazy)(()=>u(()=>import(`./vendor-C_zEzV4N.js`).then(e=>e.S),__vite__mapDeps([0,1,2,3,4,5])));function _(e){return e===`project`||e===`user`}function Se(e){let t=e.match(/^(.+?)\/SKILL(?:\.save)?\.md$/);return t?t[1]:null}function Ce({source:e}){let{t:n}=t(),r=e===`project`?`project`:e===`user`?`user`:`bundled`;return(0,g.jsx)(`span`,{className:d(`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide`,r===`project`&&`border-success/25 bg-success/8 text-success`,r===`user`&&`border-primary/25 bg-primary/10 text-primary`,r===`bundled`&&`border-border/70 bg-muted/60 text-muted-foreground`),children:n(`activity:skillDetail.${{project:`scopeProject`,user:`scopeGlobal`,bundled:`scopeBundled`}[r]}`)})}function v({className:e}){let{t:n}=t(),{client:s}=fe(),u=pe(e=>e.skillsState),v=pe(e=>e.setSkillsState),y=u.selectedSkill,b=u.navHistory,x=u.historyIndex,[S,C]=(0,h.useState)(null),[we,w]=(0,h.useState)(!1),[T,E]=(0,h.useState)(null),Te=ye(`skill-detail`,!!S),[D,O]=(0,h.useState)(!1),[k,A]=(0,h.useState)(``),[j,M]=(0,h.useState)(!1),[N,P]=(0,h.useState)(null),[F,I]=(0,h.useState)(!1),[L,R]=(0,h.useState)(null),[z,B]=(0,h.useState)(!1),V=(0,h.useRef)(``),[H,Ee]=(0,h.useState)(!1),[U,W]=(0,h.useState)(null),[De,Oe]=(0,h.useState)(!1),[G,K]=(0,h.useState)(null),[q,ke]=(0,h.useState)(!1),[Ae,je]=(0,h.useState)([]),J=(0,h.useRef)(u);J.current=u;let Y=(0,h.useRef)(!1),X=(0,h.useMemo)(()=>k?{lines:k.split(`
3
- `).length,words:k.trim()?k.trim().split(/\s+/).length:0,chars:k.length}:{lines:0,words:0,chars:0},[k]),Z=(0,h.useMemo)(()=>{if(!k)return null;let e=5242880,t=new Blob([k]).size;return t>=e?{level:`critical`,used:t,limit:e}:t>=4194304?{level:`warn`,used:t,limit:e}:null},[k]);(0,h.useEffect)(()=>{if(!L)return;let e=setTimeout(()=>R(null),2e3);return()=>clearTimeout(e)},[L]),(0,h.useEffect)(()=>{if(!D||!y)return;let e=setInterval(()=>{k&&k!==V.current&&(V.current=k,localStorage.setItem(`skills_draft_${y.name}`,JSON.stringify({content:k,savedAt:Date.now()})),R(Date.now()))},5e3);return()=>clearInterval(e)},[D,k,y]),(0,h.useEffect)(()=>{if(!y||!D)return;let e=localStorage.getItem(`skills_draft_${y.name}`);if(e)try{let{content:t}=JSON.parse(e);t&&t!==k&&t!==V.current&&(A(t),V.current=t,B(!0))}catch{}},[y?.name,D]),(0,h.useEffect)(()=>{if(!s||!y)return;w(!0),C(null),E(null);let e=setTimeout(()=>{w(!1),E(i.t(`activity:skillDetail.timeoutError`))},1e4),t=t=>{clearTimeout(e);let n=t;n.payload.error?E(n.payload.error):n.payload.name&&C(n.payload),w(!1)},n=e=>{let t=e;Ee(!1);let n=J.current;if(t.payload.success){let e={...n.knownRefs};for(let n of t.payload.updated??[])e[n.name]=n.newRef;v({...n,knownRefs:e,updateAvailableCount:0}),W({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),s.send({type:`skills.list`},{echoToChat:!1})}else W({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??i.t(`activity:skillDetail.updateFailed`)}]})},r=e=>{let t=e;t.payload.skills&&je(t.payload.skills)};return s.on(`skills.content`,t),s.on(`skills.updated`,n),s.on(`skills.list`,r),s.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),()=>{clearTimeout(e),s.off(`skills.content`,t),s.off(`skills.updated`,n),s.off(`skills.list`,r)}},[s,y?.name,y?.source]),(0,h.useEffect)(()=>{D&&(O(!1),A(``),P(null))},[y?.name]);let Q=(0,h.useCallback)(e=>Ae.find(t=>t.name.toLowerCase()===e.toLowerCase()),[Ae]),Me=(0,h.useCallback)(e=>{let t=Q(e);if(t){Y.current=!1;let e=b.slice(0,x+1);e.push(t),v({...J.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),O(!1),A(``),W(null)}},[Q,b,x,v]),Ne=(0,h.useCallback)(()=>{if(x<=0)return;Y.current=!0;let e=x-1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),W(null)},[x,b,v]),Pe=(0,h.useCallback)(()=>{if(x>=b.length-1)return;Y.current=!0;let e=x+1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),W(null)},[x,b,v]),$=(0,h.useCallback)(()=>{me(`chat`)},[]),Fe=(0,h.useCallback)(()=>{S&&(A(S.body),V.current=S.body,B(!1),P(null),O(!0),I(!1))},[S]),Ie=(0,h.useCallback)(()=>{O(!1),A(``),P(null),I(!1),B(!1),y&&localStorage.removeItem(`skills_draft_${y.name}`)},[y]),Le=(0,h.useCallback)(()=>{!y||!S||(B(!1),A(S.body),V.current=S.body,y&&localStorage.removeItem(`skills_draft_${y.name}`))},[y,S]),Re=(0,h.useCallback)(()=>{if(!s||!y||!k.trim())return;M(!0),P(null);let e=t=>{let n=t;M(!1),n.payload.success?(V.current=``,localStorage.removeItem(`skills_draft_${y.name}`),B(!1),O(!1),s.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),s.send({type:`skills.list`},{echoToChat:!1})):P(n.payload.error??i.t(`activity:skillDetail.saveFailed`)),s.off(`skills.edited`,e)};s.on(`skills.edited`,e),s.editSkill(y.name,k)},[s,y,k]),ze=(0,h.useCallback)(()=>{!s||!y||(Ee(!0),W(null),s.checkForUpdates(y.name,y.source===`user`))},[s,y]),Be=(0,h.useCallback)(()=>{y?.sourceUrl&&navigator.clipboard.writeText(y.sourceUrl).then(()=>{Oe(!0),setTimeout(()=>Oe(!1),2e3)})},[y]),Ve=(0,h.useCallback)(()=>{if(!S?.body)return;let e=new Blob([S.body],{type:`text/markdown`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${S.name.replace(/\//g,`_`)}-SKILL.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},[S]),He=(0,h.useCallback)(async e=>{if(!s||!e)return;ke(!0);let t=e=>{let n=e;ke(!1),n.payload.success?(K(null),s.send({type:`skills.list`},{echoToChat:!1}),$()):P(n.payload.error??i.t(`activity:skillDetail.uninstallFailed`)),s.off(`skills.uninstalled`,t)};s.on(`skills.uninstalled`,t),s.uninstallSkill(e.name,e.source===`user`)},[s,$]);return y?(0,g.jsxs)(`div`,{className:d(`flex h-full min-h-0 min-w-0 flex-col gap-3 overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:[(0,g.jsxs)(`div`,{className:`shrink-0 rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,g.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,g.jsx)(re,{className:`h-4 w-4`})}),(0,g.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold`,children:y.name}),y.version&&(0,g.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,y.version]}),(0,g.jsx)(Ce,{source:y.source})]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:y.description||y.trigger}),y.sourceUrl&&(0,g.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1`,children:[(0,g.jsxs)(`a`,{href:`https://${y.sourceUrl.replace(`github:`,``)}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,title:n(`activity:skillDetail.openSourceRepo`),children:[(0,g.jsx)(oe,{className:`h-3 w-3 shrink-0`}),(0,g.jsx)(`span`,{className:`truncate font-mono`,children:y.sourceUrl})]}),(0,g.jsx)(`button`,{type:`button`,onClick:Be,className:`flex shrink-0 items-center text-muted-foreground transition-colors hover:text-foreground`,title:n(`activity:skillDetail.copySourceUrl`),children:De?(0,g.jsx)(ce,{className:`h-3 w-3 text-success`}):(0,g.jsx)(ne,{className:`h-3 w-3`})})]}),y.scope.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:y.scope.map(e=>(0,g.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:e},e))}),U&&(0,g.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[U.updated.length>0&&(0,g.jsx)(`div`,{className:`text-success`,children:n(`activity:skillDetail.updatedLabel`,{list:U.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),U.unchanged.length>0&&(0,g.jsx)(`div`,{className:`text-muted-foreground`,children:n(`activity:skillDetail.upToDateLabel`,{list:U.unchanged.join(`, `)})}),U.errors.length>0&&(0,g.jsx)(`div`,{className:`text-destructive`,children:n(`activity:skillDetail.errorsLabel`,{list:U.errors.map(e=>`${e.name?`${e.name}: `:``}${e.error}`).join(`; `)})})]})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 lg:ml-auto lg:shrink-0 lg:justify-end`,children:[_(y.source)&&y.sourceUrl&&(0,g.jsx)(`button`,{type:`button`,onClick:ze,disabled:H,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50`,title:n(`activity:skillDetail.checkUpdatesTitle`),children:H?(0,g.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,g.jsx)(de,{className:`h-3.5 w-3.5`})}),y.source!==`bundled`&&!D&&(0,g.jsx)(`button`,{type:`button`,onClick:Ve,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:skillDetail.exportTitle`),children:(0,g.jsx)(ue,{className:`h-3.5 w-3.5`})}),_(y.source)&&!D&&(0,g.jsx)(`button`,{type:`button`,onClick:Fe,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:skillDetail.editTitle`),children:(0,g.jsx)(se,{className:`h-3.5 w-3.5`})}),_(y.source)&&(0,g.jsx)(`button`,{type:`button`,onClick:()=>K(y),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:n(`activity:skillDetail.uninstallTitle`),children:(0,g.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:$,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:n(`activity:skillDetail.closeTitle`),children:(0,g.jsx)(ie,{className:`h-4 w-4`})})]})]}),b.length>1&&(0,g.jsxs)(`div`,{className:`mt-3 flex min-w-0 items-center gap-1 rounded-lg border border-border/60 bg-muted/35 px-2 py-1`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:Ne,disabled:x<=0,className:d(`rounded p-1 transition-colors`,x<=0?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:n(`activity:skillDetail.backTitle`),children:(0,g.jsx)(le,{className:`h-4 w-4`})}),(0,g.jsx)(`button`,{type:`button`,onClick:Pe,disabled:x>=b.length-1,className:d(`rounded p-1 transition-colors`,x>=b.length-1?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:n(`activity:skillDetail.forwardTitle`),children:(0,g.jsx)(a,{className:`h-4 w-4`})}),(0,g.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto text-xs`,children:b.map((e,t)=>(0,g.jsxs)(`span`,{className:`flex items-center shrink-0`,children:[t>0&&(0,g.jsx)(a,{className:`h-3 w-3 text-muted-foreground/65 mx-0.5 shrink-0`}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>{t<x&&(Y.current=!0,v({...J.current,selectedSkill:e,historyIndex:t}),O(!1),A(``),W(null))},className:d(`hover:text-primary cursor-pointer transition-colors`,t===x?`text-primary font-medium`:`text-muted-foreground`),children:e.name})]},e.name+t))})]})]}),S&&(S.relatedFiles.length>0||S.references.length>0)&&(0,g.jsxs)(`div`,{className:`shrink-0 space-y-2 rounded-xl border border-border/70 bg-card/70 px-4 py-3 shadow-sm`,children:[S.relatedFiles.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,g.jsx)(r,{className:`h-3 w-3`}),(0,g.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:n(`activity:skillDetail.relatedFiles`)})]}),S.relatedFiles.map(e=>{let t=Se(e);return t&&Q(t)?(0,g.jsxs)(`button`,{type:`button`,onClick:()=>Me(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] transition-colors hover:border-primary/40 hover:text-primary`,title:n(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,g.jsx)(l,{className:`h-2.5 w-2.5`}),e]},e):(0,g.jsx)(`span`,{className:`rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:e},e)})]}),S.references.length>0&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,g.jsx)(te,{className:`h-3 w-3`}),(0,g.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:n(`activity:skillDetail.references`)})]}),S.references.map(e=>{let t=Se(e)??e.replace(/\.md$/,``);return Q(t)?(0,g.jsxs)(`button`,{type:`button`,onClick:()=>Me(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-[10px] text-primary transition-colors hover:border-primary/30 hover:bg-primary/10`,title:n(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,g.jsx)(l,{className:`h-2.5 w-2.5`}),t]},e):(0,g.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:t},e)})]})]}),(0,g.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden rounded-xl border border-border/70 bg-card/70 shadow-sm`,children:we?(0,g.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center text-muted-foreground`,children:[(0,g.jsx)(c,{className:`mx-auto mb-2 h-6 w-6 animate-spin text-primary`}),(0,g.jsx)(`p`,{children:n(`activity:skillDetail.loadingContent`)})]}):D?(0,g.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,g.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-border/70 bg-muted/30 px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`activity:skillDetail.editingLabel`,{name:y.name})}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:n(`activity:skillDetail.editStats`,{lines:X.lines,words:X.words,chars:X.chars})}),Z&&(0,g.jsx)(`span`,{className:`text-xs tabular-nums ${Z.level===`critical`?`font-medium text-destructive`:`text-warning`}`,children:n(`activity:skillDetail.charsWarningFmt`,{used:(Z.used/1048576).toFixed(1),limit:(Z.limit/1048576).toFixed(0)})}),L&&(0,g.jsx)(`span`,{className:`text-xs text-success animate-pulse`,children:n(`activity:skillDetail.draftSaved`)}),z&&(0,g.jsx)(`span`,{className:`animate-pulse text-xs text-warning`,children:n(`activity:skillDetail.draftRestored`)})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[N&&(0,g.jsx)(`span`,{className:`text-xs text-destructive`,children:N}),z&&(0,g.jsx)(`button`,{type:`button`,onClick:Le,className:`rounded-md border border-warning/35 px-2 py-1 text-[10px] text-warning transition-colors hover:bg-warning/10`,children:n(`activity:skillDetail.discardDraft`)}),(0,g.jsx)(`button`,{type:`button`,onClick:Ie,className:`rounded-md border border-border/70 px-2 py-1 text-xs transition-colors hover:bg-accent`,children:n(`common:action.cancel`)}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>I(e=>!e),title:n(F?`activity:skillDetail.hidePreviewTitle`:`activity:skillDetail.splitViewTitle`),className:`rounded-md border px-2 py-1 text-xs transition-colors ${F?`border-primary/40 bg-primary/10 text-primary`:`border-border/70 text-muted-foreground hover:bg-accent`}`,children:(0,g.jsx)(ee,{className:`h-3 w-3 inline`})}),(0,g.jsx)(`button`,{type:`button`,onClick:Re,disabled:j||!k.trim(),className:`rounded-md bg-primary px-3 py-1 text-xs text-primary-foreground shadow-sm shadow-primary/15 transition-colors hover:bg-primary/90 disabled:opacity-50`,children:j?(0,g.jsx)(c,{className:`h-3 w-3 animate-spin inline`}):n(`common:action.save`)})]})]}),F?(0,g.jsxs)(`div`,{className:`flex flex-1 min-h-0 gap-0.5`,children:[(0,g.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0`,children:(0,g.jsx)(h.Suspense,{fallback:null,children:(0,g.jsx)(xe,{value:k,onChange:e=>A(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:n(`activity:skillDetail.contentPlaceholder`)})})}),(0,g.jsx)(`div`,{className:`w-px bg-border flex-shrink-0`}),(0,g.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-background/45 p-4 prose prose-sm dark:prose-invert max-w-none`,children:(0,g.jsx)(m,{rehypePlugins:[f],components:p,children:k})})]}):(0,g.jsx)(h.Suspense,{fallback:null,children:(0,g.jsx)(xe,{value:k,onChange:e=>A(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:n(`activity:skillDetail.contentPlaceholder`)})})]}):S?(0,g.jsx)(`div`,{ref:Te,className:`h-full min-h-0 overflow-y-auto overscroll-contain p-5 sm:p-6 prose prose-sm dark:prose-invert max-w-none`,children:(0,g.jsx)(m,{rehypePlugins:[f],components:p,children:S.body})}):T?(0,g.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center`,children:[(0,g.jsx)(`p`,{className:`text-destructive mb-2`,children:n(`activity:skillDetail.loadFailed`)}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:T}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>{s&&y&&(w(!0),E(null),s.send({type:`skills.content`,payload:{name:y.name,source:y.source}}))},className:`mt-4 rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent`,children:n(`common:action.retry`)})]}):(0,g.jsx)(`div`,{className:`flex h-full min-h-[16rem] items-center justify-center p-8 text-center text-muted-foreground`,children:n(`activity:skillDetail.noContent`)})}),(0,g.jsx)(ve,{open:!!G,onOpenChange:e=>{e||K(null)},children:(0,g.jsxs)(ge,{className:`flex max-h-[calc(100dvh-2rem)] w-[380px] max-w-[90vw] flex-col gap-0 overflow-hidden p-0`,showCloseButton:!1,children:[(0,g.jsxs)(he,{className:`flex shrink-0 items-center justify-between border-b border-border/70 p-4 sm:flex-row sm:justify-between sm:space-y-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(o,{className:`h-4 w-4 text-destructive`}),(0,g.jsx)(_e,{className:`font-semibold text-sm`,children:n(`activity:skillDetail.uninstallSkillHeading`)})]}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>K(null),"aria-label":n(`common:action.close`),className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,g.jsx)(ie,{className:`h-4 w-4`})})]}),(0,g.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-4`,children:[(0,g.jsx)(`p`,{className:`text-sm`,children:G&&n(`activity:skillDetail.uninstallConfirm`,{name:G.name})}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:G&&n(`activity:skillDetail.uninstallRemovePath`,{path:G.path})})]}),(0,g.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-border/70 bg-muted/20 p-4`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>K(null),disabled:q,className:`rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent disabled:opacity-50`,children:n(`common:action.cancel`)}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>G&&He(G),disabled:q,className:`flex items-center gap-1.5 rounded-md bg-destructive px-3 py-1.5 text-xs text-destructive-foreground transition-colors hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[q&&(0,g.jsx)(c,{className:`h-3 w-3 animate-spin`}),n(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,g.jsx)(be,{icon:(0,g.jsx)(ae,{className:`h-6 w-6`}),title:n(`activity:skillDetail.noSkillSelected`),description:n(`activity:skillDetail.selectSkillHint`),action:{label:n(`activity:skillDetail.goToChat`),onClick:$},className:e})}export{v as SkillDetailView};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ai as t,Ba as n,Br as r,Ea as i,Ei as a,Ga as o,Gn as s,Ir as c,M as l,Ma as u,Mi as d,Nt as f,Qr as ee,Wt as p,Zt as te,an as m,ci as ne,dt as re,fa as h,gn as g,lt as _,mi as v,or as y,pa as ie,qt as ae,ut as b,yi as oe,yn as se,zn as x}from"./vendor-C_zEzV4N.js";import"./i18n-DbJfY4tY.js";import{t as S}from"./utils-tsZEnrBH.js";import{i as C}from"./stores-C0xX0jn4.js";import{t as w}from"./button-DvpRpKkt.js";import{t as T}from"./input-BtoHcCl9.js";import{A as ce,M as le,b as E,j as D,k as ue,x as O}from"./index-DQn-Lz9q.js";var k=e(o(),1),A=_(),j={current:{labelKey:`activity:techStackStatus.current`,badge:`border-success/35 bg-success/10 text-success`,dot:`bg-success`,weight:0},update_available_safe:{labelKey:`activity:techStackStatus.update_available_safe`,badge:`border-info/35 bg-info/10 text-info`,dot:`bg-info`,weight:30},update_available_breaking:{labelKey:`activity:techStackStatus.update_available_breaking`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:50},vulnerable:{labelKey:`activity:techStackStatus.vulnerable`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:100},deprecated:{labelKey:`activity:techStackStatus.deprecated`,badge:`border-destructive/35 bg-destructive/10 text-destructive`,dot:`bg-destructive`,weight:70},yanked:{labelKey:`activity:techStackStatus.yanked`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:80},unmaintained_suspected:{labelKey:`activity:techStackStatus.unmaintained_suspected`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:60},blocked_by_constraints:{labelKey:`activity:techStackStatus.blocked_by_constraints`,badge:`border-warning/30 bg-warning/5 text-warning`,dot:`bg-warning`,weight:40},private_or_unresolved:{labelKey:`activity:techStackStatus.private_or_unresolved`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:10},local_path:{labelKey:`activity:techStackStatus.local_path`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},git_dependency:{labelKey:`activity:techStackStatus.git_dependency`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unsupported:{labelKey:`activity:techStackStatus.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unknown:{labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:20}},de={labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:0};function M(e){return j[e]??de}var N={npm:{label:`npm / Node.js`,icon:x},python:{label:`Python`,icon:d},rust:{label:`Rust`,icon:ae},go:{label:`Go`,icon:g},dotnet:{label:`.NET`,icon:s},php:{label:`PHP`,icon:f},dart:{label:`Dart / Flutter`,icon:a},maven:{label:`Maven`,icon:u},gradle:{label:`Gradle`,icon:ie},ruby:{label:`Ruby`,icon:c},swift:{label:`Swift`,icon:b},elixir:{label:`Elixir`,icon:f},cpp:{label:`C / C++`,icon:t}},fe={labelKey:`activity:techStackStatus.unknown`};function P(e,t){let n=F(e);return n.labelKey?t(n.labelKey):n.label??e}function F(e){return N[e]??fe}function I({ecosystem:e,className:t=`size-3.5 shrink-0`}){let n=F(e);if(!n.icon)return null;let r=n.icon;return(0,A.jsx)(r,{className:t})}function pe(e){return M(e.status).weight>=50}var me=[`critical`,`high`,`medium`,`low`,`info`],L={critical:{labelKey:`activity:techStackSeverity.critical`,badge:`border-destructive/45 bg-destructive/15 text-destructive`},high:{labelKey:`activity:techStackSeverity.high`,badge:`border-destructive/35 bg-destructive/10 text-destructive`},medium:{labelKey:`activity:techStackSeverity.medium`,badge:`border-warning/35 bg-warning/10 text-warning`},low:{labelKey:`activity:techStackSeverity.low`,badge:`border-info/35 bg-info/10 text-info`},info:{labelKey:`activity:techStackSeverity.info`,badge:`border-border/70 bg-muted text-muted-foreground`}},R={none:`activity:techStackAction.none`,upgrade_patch:`activity:techStackAction.upgrade_patch`,upgrade_minor:`activity:techStackAction.upgrade_minor`,upgrade_major:`activity:techStackAction.upgrade_major`,replace:`activity:techStackAction.replace`,remove:`activity:techStackAction.remove`,investigate:`activity:techStackAction.investigate`},z={full:{labelKey:`activity:techStackCoverage.full`,badge:`border-success/35 bg-success/10 text-success`,noteKey:void 0},partial:{labelKey:`activity:techStackCoverage.partial`,badge:`border-warning/35 bg-warning/10 text-warning`,noteKey:`activity:techStackCoverage.partialNote`},unsupported:{labelKey:`activity:techStackCoverage.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,noteKey:`activity:techStackCoverage.unsupportedNote`}};function B(e){return z[e]??z.unsupported}function V(e){if(!e)return null;let t=/^\D*(\d+)/.exec(e);if(!t?.[1])return null;let n=Number(t[1]);return Number.isFinite(n)?n:null}function H(e){let t=V(e.locked??e.installed??e.requested),n=V(e.latestStable);if(t===null||n===null||n<=t)return{majorsBehind:0,label:null};let r=n-t;return{majorsBehind:r,label:`${r} major${r===1?``:`s`} behind`}}function U(e){return e.locked??e.installed??e.requested??null}function W(e){return e.confidence<1}function G({className:e,children:t}){return(0,A.jsx)(`span`,{className:S(`inline-flex shrink-0 items-center gap-1 border px-1.5 py-0.5 text-[10px] font-medium`,e),children:t})}function K({label:e,value:t,hint:n,tone:r=`default`}){let i={default:`text-foreground`,success:`text-success`,warning:`text-warning`,info:`text-info`,destructive:`text-destructive`}[r];return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/55 px-3 py-2.5 shadow-[inset_0_1px_0_hsl(var(--foreground)/0.035)]`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:e}),(0,A.jsxs)(`div`,{className:`mt-1 flex items-end justify-between gap-2`,children:[(0,A.jsx)(`p`,{className:S(`font-mono text-xl font-bold tabular-nums`,i),children:t}),(0,A.jsx)(`p`,{className:`truncate text-[9px] text-muted-foreground`,children:n})]})]})}function q(e,t){let n,r,i;if(t===`json`)n=JSON.stringify(e,null,2),r=`techstack.json`,i=`application/json`;else if(t===`spdx`){let t={spdxVersion:`SPDX-2.3`,dataLicense:`CC0-1.0`,SPDXID:`SPDXRef-DOCUMENT`,name:`TechStack-SBOM-${e.projectId}`,documentNamespace:`https://wrongstack.dev/spdx/${e.id}`,creationInfo:{created:e.createdAt,creators:[`Tool: WrongStack TechStack Engine`]},packages:e.dependencies.map((e,t)=>({name:e.name,SPDXID:`SPDXRef-Package-${t}`,versionInfo:e.locked??e.requested,downloadLocation:e.purl?`https://purl.io/${e.purl}`:`NOASSERTION`,licenseConcluded:e.license??`NOASSERTION`}))};n=JSON.stringify(t,null,2),r=`techstack-sbom-spdx.json`,i=`application/json`}else if(t===`cyclonedx`){let t={bomFormat:`CycloneDX`,specVersion:`1.5`,version:1,metadata:{timestamp:e.createdAt,tools:[{name:`WrongStack TechStack Engine`,version:e.adapterVersion}]},components:e.dependencies.map(e=>({type:`library`,name:e.name,version:e.locked??e.requested,...e.purl?{purl:e.purl}:{},...e.license?{licenses:[{license:{id:e.license}}]}:{}}))};n=JSON.stringify(t,null,2),r=`techstack-sbom-cyclonedx.json`,i=`application/json`}else{let t=[`# TechStack Report`,``,`**Generated:** ${e.createdAt}`,`**Target:** ${e.targetRoot}`,`**Fingerprint:** ${e.fingerprint}`,`**Workspaces:** ${e.workspaces.length}`,`**Dependencies:** ${e.dependencies.length}`,`**Findings:** ${e.findings.length}`,`**Coverage:** ${e.coverage}`,``];if(e.workspaces.length>0){t.push(`## Workspaces`,``,`| Workspace | Ecosystem | Coverage | Deps |`,`|---|---|---|---|`);for(let n of e.workspaces){let r=e.dependencies.filter(e=>e.workspaceId===n.id).length;t.push(`| ${n.relativeRoot} | ${n.ecosystem} | ${n.coverage} | ${r} |`)}t.push(``)}if(e.findings.length>0){t.push(`## Findings`,``);let n=new Map;for(let t of e.findings)n.set(t.severity,[...n.get(t.severity)??[],t]);for(let r of[`critical`,`high`,`medium`,`low`,`info`]){let i=n.get(r);if(i?.length){t.push(`### ${r.charAt(0).toUpperCase()+r.slice(1)} (${i.length})`,``);for(let n of i){let r=e.dependencies.find(e=>e.id===n.dependencyId);t.push(`- **${r?.name??n.dependencyId}** — ${n.type} — ${n.rationale}`)}t.push(``)}}}if(e.dependencies.length>0){t.push(`## Dependencies`,``,`| Name | Ecosystem | Status | Locked | Latest |`,`|---|---|---|---|---|`);for(let n of e.dependencies)t.push(`| ${n.name} | ${n.ecosystem} | ${n.status} | ${n.locked??`—`} | ${n.latestStable??`—`} |`)}n=t.join(`
2
- `),r=`techstack-report.md`,i=`text/markdown`}let a=new Blob([n],{type:i}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=r,s.click(),URL.revokeObjectURL(o)}function he({dependency:e,findings:t,deepDive:r,onDeepDive:a,onBack:o,coverage:s}){let{t:c}=n(),l=M(e.status),u=U(e),d=H(e),f=s?B(s).noteKey:void 0;return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`header`,{className:`shrink-0 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(w,{variant:`ghost`,size:`icon`,onClick:o,"aria-label":c(`activity:techStack.backToDependencyList`),className:`shrink-0 md:hidden`,children:(0,A.jsx)(i,{className:`size-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`h2`,{className:`min-w-0 truncate font-mono text-sm font-bold text-foreground`,children:e.name}),(0,A.jsx)(G,{className:l.badge,children:c(l.labelKey)})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[P(e.ecosystem,c),` ·`,` `,e.direct?`direct`:`transitive`,` · `,e.scope,` ·`,` `,e.sourceType,f&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,A.jsx)(`span`,{className:`text-warning`,children:c(f)})]})]})]})]}),(0,A.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-baseline gap-2 font-mono text-xs`,children:[(0,A.jsx)(`span`,{className:`text-foreground`,children:u??`—`}),e.latestStable&&e.latestStable!==u&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`text-info`,children:e.latestStable})]}),d.label&&(0,A.jsxs)(`span`,{className:`text-[10px] text-warning`,children:[`(`,d.label,`)`]})]})]}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`dl`,{className:`grid grid-cols-2 gap-px border border-border/70 bg-border/60`,children:[(0,A.jsx)(J,{label:c(`activity:techStack.constraint`),value:e.requested??`—`,mono:!0}),(0,A.jsx)(J,{label:c(`activity:techStack.locked`),value:e.locked??`—`,mono:!0}),(0,A.jsx)(J,{label:c(`activity:techStack.latestStable`),value:e.latestStable??`—`,mono:!0}),(0,A.jsx)(J,{label:c(`activity:techStack.license`),value:e.license??`—`}),e.wanted&&(0,A.jsx)(J,{label:c(`activity:techStack.wanted`),value:e.wanted,mono:!0}),e.resolvable&&(0,A.jsx)(J,{label:c(`activity:techStack.resolvable`),value:e.resolvable,mono:!0}),e.purl&&(0,A.jsx)(J,{label:c(`activity:techStack.purl`),value:e.purl,mono:!0}),(0,A.jsx)(J,{label:c(`activity:techStack.registryFlags`),value:[e.deprecated&&`deprecated`,e.yanked&&`yanked`].filter(Boolean).join(`, `)||`none`})]}),(0,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:c(`activity:techStack.findings`)}),(0,A.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>a(e),disabled:r.status===`loading`,className:`h-7 text-[10px]`,children:[r.status===`loading`?(0,A.jsx)(y,{className:`size-3 animate-spin`}):(0,A.jsx)(p,{className:`size-3`}),r.status===`loading`?`Researching…`:`Deep dive`]})]}),r.status===`error`&&r.error&&(0,A.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-[10px] text-destructive`,children:r.error}),t.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.nothingFlaggedRunADeepDive`)}):(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:L[e.severity].badge,children:c(L[e.severity].labelKey)}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]?c(R[e.action]):e.action}),W(e)&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(p,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk})]},e.id))})]}),(0,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:c(`activity:techStack.evidence`)}),e.evidence.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.noEvidenceRecorded`)}):(0,A.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.evidence.map((t,n)=>(0,A.jsxs)(`li`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:t.kind}),(0,A.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(t.retrievedAt).toLocaleString()})]}),t.source.startsWith(`http`)?(0,A.jsxs)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`mt-1 flex min-w-0 items-center gap-1 truncate text-[10px] text-info underline-offset-2 hover:underline`,children:[(0,A.jsx)(`span`,{className:`truncate`,children:t.source}),(0,A.jsx)(v,{className:`size-2.5 shrink-0`})]}):(0,A.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:t.source}),t.detail&&(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] leading-relaxed text-muted-foreground`,children:t.detail})]},`${e.id}-evidence-${n}`))})]})]})]})}function J({label:e,value:t,mono:n}){return(0,A.jsxs)(`div`,{className:`bg-card/55 px-2.5 py-1.5`,children:[(0,A.jsx)(`dt`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:e}),(0,A.jsx)(`dd`,{className:S(`mt-0.5 truncate text-[11px] text-foreground`,n&&`font-mono`),children:t})]})}var Y=`grid grid-cols-[minmax(0,2.2fr)_minmax(0,1.6fr)_minmax(0,1.1fr)] gap-2`;function ge({dependencies:e,selectedId:t,hasDependencies:r,coverageByWorkspaceId:i,onSelect:a}){let{t:o}=n(),s=O(e,30);return e.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:r?`No dependencies match the current filters.`:`No dependencies inventoried yet. Run a scan to populate the inventory.`})}):(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`div`,{className:S(Y,`shrink-0 border-b border-border/70 bg-card/45 px-3 py-1.5 text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`),children:[(0,A.jsx)(`span`,{children:o(`activity:techStack.package`)}),(0,A.jsx)(`span`,{children:o(`activity:techStack.installedLatest`)}),(0,A.jsx)(`span`,{children:o(`activity:techStack.status`)})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,A.jsx)(l,{className:`h-full`,"aria-label":o(`activity:techStack.dependencies`),children:s.pageItems.map(e=>(0,A.jsx)(_e,{dependency:e,selected:e.id===t,coverage:i?.get(e.workspaceId),onSelect:a},e.id))})}),(0,A.jsx)(E,{page:s.page,pageSize:s.pageSize,totalItems:s.totalItems,onPageChange:s.setPage,itemLabel:`dependencies`})]})}function _e({dependency:e,selected:t,coverage:r,onSelect:i}){let{t:a}=n(),o=M(e.status),s=U(e),c=H(e),l=r?B(r).noteKey:void 0;return(0,A.jsxs)(`button`,{type:`button`,onClick:()=>i(e),"aria-current":t,className:S(Y,`w-full items-center border-b border-border/40 px-3 py-2 text-left transition-colors hover:bg-accent/40`,t&&`bg-accent/60`),children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:S(`size-1.5 shrink-0`,o.dot),"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-xs text-foreground`,children:e.name})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(I,{ecosystem:e.ecosystem,className:`mr-0.5 inline-block size-3 align-text-bottom`}),P(e.ecosystem,a),` · `,e.direct?`direct`:`transitive`,` · `,e.scope,l&&(0,A.jsxs)(A.Fragment,{children:[` · `,(0,A.jsx)(`span`,{className:`text-warning`,children:a(l)})]})]})]}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5 font-mono text-[11px]`,children:[(0,A.jsx)(`span`,{className:`truncate text-foreground`,children:s??`—`}),e.latestStable&&e.latestStable!==s&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`truncate text-info`,children:e.latestStable})]})]}),c.label?(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-warning`,children:c.label}):e.requested&&(0,A.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:e.requested})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,A.jsx)(G,{className:o.badge,children:a(o.labelKey)}),e.deprecated&&(0,A.jsx)(G,{className:`border-destructive/35 bg-destructive/10 text-destructive`,children:`dep`}),e.yanked&&(0,A.jsx)(G,{className:`border-destructive/45 bg-destructive/15 text-destructive`,children:`yank`})]})]})}function ve({findings:e,dependenciesById:t,onSelectDependency:r}){let{t:i}=n(),a=O(e,20);if(e.length===0)return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsxs)(`p`,{className:`max-w-sm text-xs text-muted-foreground`,children:[i(`activity:techStack.noFindingsRun`),` `,(0,A.jsx)(`span`,{className:`font-mono text-foreground`,children:i(`activity:techStack.analyze`)}),` `,i(`activity:techStack.toCheckVersionsAndAdvisoriesAgainst`)]})});let o=me.map(e=>[e,a.pageItems.filter(t=>t.severity===e)]).filter(([,e])=>e.length>0);return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:o.map(([e,n])=>(0,A.jsxs)(`section`,{children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,A.jsx)(G,{className:L[e].badge,children:i(L[e].labelKey)}),(0,A.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-muted-foreground`,children:n.length})]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:n.map(e=>(0,A.jsx)(ye,{finding:e,dependency:t.get(e.dependencyId),onSelectDependency:r},e.id))})]},e))})}),(0,A.jsx)(E,{page:a.page,pageSize:a.pageSize,totalItems:a.totalItems,onPageChange:a.setPage,itemLabel:`findings`})]})}function ye({finding:e,dependency:t,onSelectDependency:r}){let{t:i}=n(),a=W(e);return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>r(e.dependencyId),className:`min-w-0 truncate font-mono text-xs text-foreground underline-offset-2 hover:underline`,children:t?.name??e.dependencyId}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]?i(R[e.action]):e.action}),a&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(p,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk}),e.evidence.length>0&&(0,A.jsx)(`ul`,{className:S(`mt-1.5 flex flex-col gap-0.5`),children:e.evidence.slice(0,4).map((t,n)=>(0,A.jsx)(`li`,{className:`min-w-0 truncate text-[10px]`,children:t.source.startsWith(`http`)?(0,A.jsx)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`text-info underline-offset-2 hover:underline`,children:t.detail??t.source}):(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:t.detail??t.source})},`${e.id}-${n}`))})]})}function be({searchQuery:e,ecosystemFilter:t,statusFilter:i,directOnly:a,sort:o,hasFilters:s,ecosystems:c,statuses:l,visibleCount:u,totalCount:d,onSearchChange:f,onEcosystemFilterChange:ee,onStatusFilterChange:p,onToggleDirectOnly:te,onSortChange:ne,onClearFilters:h}){let{t:g}=n();return(0,A.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,A.jsx)(m,{className:`pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,A.jsx)(T,{"aria-label":g(`activity:techStack.searchDependencies`),value:e,onChange:e=>f(e.target.value),placeholder:g(`activity:techStack.searchByPackageName`),className:`h-10 min-w-0 bg-background pl-9 pr-8 text-xs`}),e&&(0,A.jsx)(`button`,{type:`button`,"aria-label":g(`activity:techStack.clearSearch`),onClick:()=>f(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(re,{className:`size-3.5`})})]}),(0,A.jsx)(w,{variant:a?`default`:`outline`,size:`sm`,onClick:te,"aria-pressed":a,title:g(`activity:techStack.showOnlyDependenciesThisProjectDeclaresItself`),className:`shrink-0`,children:g(`activity:techStack.directOnly`)}),s&&(0,A.jsx)(w,{variant:`ghost`,size:`icon`,onClick:h,"aria-label":g(`activity:techStack.clearAllFilters`),title:g(`activity:techStack.clearAllFilters`),className:`shrink-0`,children:(0,A.jsx)(r,{className:`size-4`})})]}),(0,A.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-ecosystem-filter`,children:g(`activity:techStack.filterByEcosystem`)}),(0,A.jsxs)(`select`,{id:`techstack-ecosystem-filter`,value:t,onChange:e=>ee(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`all`,children:g(`activity:techStack.allEcosystems`)}),c.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[P(e,g),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-status-filter`,children:g(`activity:techStack.filterByStatus`)}),(0,A.jsxs)(`select`,{id:`techstack-status-filter`,value:i,onChange:e=>p(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`all`,children:g(`activity:techStack.allStatuses`)}),l.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[g(M(e).labelKey),` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-sort`,children:g(`activity:techStack.sortDependencies`)}),(0,A.jsxs)(`select`,{id:`techstack-sort`,value:o,onChange:e=>ne(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`attention`,children:g(`activity:techStack.sortNeedsAttention`)}),(0,A.jsx)(`option`,{value:`drift`,children:g(`activity:techStack.sortMostOutOfDate`)}),(0,A.jsx)(`option`,{value:`name`,children:g(`activity:techStack.sortName`)})]})]})]}),(0,A.jsx)(`p`,{className:S(`text-[10px] text-muted-foreground`,s&&`text-info`),children:u===d?`${d} dependencies`:`${u} of ${d} dependencies`})]})}var xe=[{id:`dependencies`,labelKey:`activity:techStack.tabDependencies`},{id:`findings`,labelKey:`activity:techStack.tabFindings`},{id:`workspaces`,labelKey:`activity:techStack.tabWorkspaces`},{id:`trends`,labelKey:`activity:techStack.tabTrends`},{id:`remediation`,labelKey:`activity:techStack.tabRemediation`}],X=new Set([`npm`,`python`,`rust`,`go`,`php`,`dotnet`]);function Z(){let{t:e}=n(),t=C(e=>e.snapshot),r=C(e=>e.stale),i=C(e=>e.loading),a=C(e=>e.error),o=C(e=>e.activeJob),[s,c]=(0,k.useState)(`dependencies`),[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(`all`),[m,h]=(0,k.useState)(`all`),[g,_]=(0,k.useState)(!1),[v,ie]=(0,k.useState)(`attention`),[b,x]=(0,k.useState)(null),[T,E]=(0,k.useState)([]),[O,j]=(0,k.useState)({status:`idle`,error:null}),[de,N]=(0,k.useState)(null),[fe,P]=(0,k.useState)(null),[F,I]=(0,k.useState)(new Set),[me,L]=(0,k.useState)(!1),R=(0,k.useCallback)(async()=>{let e=C.getState();e.setLoading(!0),e.setError(null);try{let t=await fetch(`/api/techstack/snapshot`);if(t.status===404){e.setSnapshot(null,!1);return}if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);let n=await t.json();e.setSnapshot(n.snapshot,n.stale)}catch(t){e.setError(t instanceof Error?t.message:String(t))}},[]),z=(0,k.useCallback)(async e=>{let t=C.getState();t.setLoading(!0),t.setError(null);try{let n=await fetch(`/api/techstack/${e}`,{method:`POST`}),r=await n.json();if(!n.ok||!r.jobId)throw Error(r.error??`HTTP ${n.status}: ${n.statusText}`);t.jobStarted(r.jobId,e)}catch(e){t.setError(e instanceof Error?e.message:String(e))}},[]),B=(0,k.useCallback)(async()=>{let e=C.getState().activeJob;if(e)try{let t=await fetch(`/api/techstack/jobs/${encodeURIComponent(e.id)}/cancel`,{method:`POST`});if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);C.getState().jobCancelled(e.id)}catch(e){C.getState().setError(e instanceof Error?e.message:String(e))}},[]),V=(0,k.useCallback)(async e=>{j({status:`loading`,error:null});try{let t=await fetch(`/api/techstack/deps/${encodeURIComponent(e.id)}/research`,{method:`POST`}),n=await t.json();if(!t.ok)throw Error(n.error??`HTTP ${t.status}`);E(n.findings??[]),j({status:`idle`,error:null})}catch(e){j({status:`error`,error:e instanceof Error?e.message:String(e)})}},[]);(0,k.useEffect)(()=>{R()},[R]),(0,k.useEffect)(()=>{(s===`trends`||s===`remediation`)&&fetch(`/api/techstack/${s===`trends`?`trends`:`remediation`}`).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);t.trend&&N(t.trend),t.plan&&P(t.plan)}).catch(e=>C.getState().setError(e instanceof Error?e.message:String(e)))},[s,t?.id]);let U=(0,k.useCallback)(async()=>{if(F.size!==0){L(!0);try{let e=await fetch(`/api/techstack/remediation/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvedItems:[...F]})}),t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);I(new Set),await z(`inventory`)}catch(e){C.getState().setError(e instanceof Error?e.message:String(e))}finally{L(!1)}}},[F,z]);(0,k.useEffect)(()=>{E([]),j({status:`idle`,error:null})},[t?.id]);let W=(0,k.useMemo)(()=>t?.dependencies??[],[t]),G=(0,k.useMemo)(()=>t?.findings??[],[t]),J=(0,k.useMemo)(()=>new Map(W.map(e=>[e.id,e])),[W]),Y=(0,k.useMemo)(()=>Ee(W.map(e=>e.ecosystem)),[W]),_e=(0,k.useMemo)(()=>Ee(W.map(e=>e.status)),[W]),ye=(0,k.useMemo)(()=>new Map(t?.workspaces.map(e=>[e.id,e.coverage])??[]),[t]),X=(0,k.useMemo)(()=>{let e=l.trim().toLowerCase(),t=[...W.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||d!==`all`&&t.ecosystem!==d||m!==`all`&&t.status!==m||g&&!t.direct))];return v===`name`?t.sort((e,t)=>e.name.localeCompare(t.name)):v===`drift`?t.sort((e,t)=>H(t).majorsBehind-H(e).majorsBehind||e.name.localeCompare(t.name)):t.sort((e,t)=>M(t.status).weight-M(e.status).weight||Number(t.direct)-Number(e.direct)||e.name.localeCompare(t.name)),t},[W,l,d,m,g,v]),Z=b?J.get(b):void 0,De=(0,k.useMemo)(()=>Z?[...G.filter(e=>e.dependencyId===Z.id),...T.filter(e=>e.dependencyId===Z.id)]:[],[G,T,Z]),Oe=(0,k.useMemo)(()=>W.filter(pe).length,[W]),ke=(0,k.useMemo)(()=>W.filter(e=>H(e).majorsBehind>0).length,[W]),Ae=(0,k.useMemo)(()=>W.filter(e=>e.status===`vulnerable`).length,[W]),je=l.trim()!==``||d!==`all`||m!==`all`||g,Me=(0,k.useCallback)(()=>{u(``),f(`all`),h(`all`),_(!1)},[]),$=!!(o&&![`completed`,`failed`,`cancelled`].includes(o.status)),Ne=(0,k.useCallback)(e=>{x(e),c(`dependencies`)},[]);return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,A.jsx)(`header`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h1`,{className:`text-base font-bold sm:text-lg`,children:e(`activity:techStack.techstack`)}),(0,A.jsx)(`span`,{className:`border border-info/35 bg-info/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-info`,children:t?`${t.workspaces.length} workspaces`:`no scan yet`}),r&&(0,A.jsx)(`span`,{className:`border border-warning/35 bg-warning/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-warning`,children:e(`activity:techStack.staleGt24h`)})]}),(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground sm:text-xs`,children:t?`${t.targetRoot} · scanned ${new Date(t.createdAt).toLocaleString()}`:`Scan the open project to inventory its dependencies.`})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>void z(`inventory`),disabled:$,title:e(`activity:techStack.offlineReReadManifestsAndLockfiles`),children:[(0,A.jsx)(se,{className:S(`size-3.5`,$&&`animate-spin`)}),(0,A.jsx)(`span`,{className:`hidden sm:inline`,children:e(`activity:techStack.refresh`)})]}),(0,A.jsxs)(w,{size:`sm`,onClick:()=>void z(`analyze`),disabled:$,title:e(`activity:techStack.checkRegistriesAndAdvisoriesThenInterpretTheResultsWithTheModel`),children:[(0,A.jsx)(p,{className:`size-3.5`}),e(`activity:techStack.analyze`)]}),$&&(0,A.jsx)(w,{variant:`ghost`,size:`icon`,onClick:()=>void B(),"aria-label":e(`activity:techStack.cancelJob`),children:(0,A.jsx)(re,{className:`size-4`})}),(0,A.jsxs)(ue,{children:[(0,A.jsx)(le,{asChild:!0,children:(0,A.jsx)(w,{variant:`ghost`,size:`icon`,disabled:!t,"aria-label":e(`activity:techStack.exportOptions`),title:e(`activity:techStack.exportOptions`),children:(0,A.jsx)(oe,{className:`size-4`})})}),(0,A.jsxs)(ce,{align:`end`,className:`w-60`,children:[(0,A.jsxs)(D,{onClick:()=>t&&q(t,`json`),children:[(0,A.jsx)(ne,{className:`mr-2 size-4`}),e(`activity:techStack.exportSnapshotAsJson`)]}),(0,A.jsxs)(D,{onClick:()=>t&&q(t,`spdx`),children:[(0,A.jsx)(ae,{className:`mr-2 size-4`}),e(`activity:techStack.exportSbomSpdx`)]}),(0,A.jsxs)(D,{onClick:()=>t&&q(t,`cyclonedx`),children:[(0,A.jsx)(te,{className:`mr-2 size-4`}),e(`activity:techStack.exportSbomCycloneDx`)]}),(0,A.jsxs)(D,{onClick:()=>t&&q(t,`md`),children:[(0,A.jsx)(ee,{className:`mr-2 size-4`}),e(`activity:techStack.exportReportMd`)]})]})]})]})]})}),t&&(0,A.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-px border-b border-border/70 bg-border/60 sm:grid-cols-4`,children:[(0,A.jsx)(K,{label:e(`activity:techStack.dependencies`),value:W.length,hint:`${X.length} visible`}),(0,A.jsx)(K,{label:e(`activity:techStack.outdated`),value:ke,hint:e(`activity:techStack.majorsBehind`),tone:ke>0?`warning`:`success`}),(0,A.jsx)(K,{label:e(`activity:techStack.vulnerable`),value:Ae,hint:e(`activity:techStack.knownAdvisories`),tone:Ae>0?`destructive`:`success`}),(0,A.jsx)(K,{label:e(`activity:techStack.findings`),value:G.length,hint:`${Oe} need attention`,tone:G.length>0?`info`:`default`})]}),($||a)&&(0,A.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-2`,"aria-live":`polite`,children:[$&&o&&(0,A.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-xs text-info`,children:[(0,A.jsx)(y,{className:`size-3.5 animate-spin`}),(0,A.jsx)(`span`,{className:`font-mono`,children:o.status}),o.progress&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[o.progress.completed,`/`,o.progress.total]})]}),a&&(0,A.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 text-xs text-destructive`,children:[(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>void R(),className:`underline`,children:e(`activity:techStack.retry`)})]})]}),i&&!t?(0,A.jsx)(Q,{}):t?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`nav`,{className:`flex shrink-0 gap-1 border-b border-border/70 px-2`,children:xe.map(t=>(0,A.jsxs)(`button`,{type:`button`,onClick:()=>c(t.id),"aria-current":s===t.id,className:S(`border-b-2 px-3 py-2 text-xs font-medium transition-colors`,s===t.id?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e(t.labelKey),t.id===`findings`&&G.length>0&&(0,A.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] tabular-nums text-muted-foreground`,children:G.length})]},t.id))}),s===`dependencies`&&(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 md:grid-cols-[minmax(340px,1fr)_minmax(0,1.15fr)]`,children:[(0,A.jsxs)(`section`,{className:S(`min-h-0 border-r border-border/70`,Z?`hidden md:flex md:flex-col`:`flex flex-col`),"aria-label":e(`activity:techStack.dependencyList`),children:[(0,A.jsx)(be,{searchQuery:l,ecosystemFilter:d,statusFilter:m,directOnly:g,sort:v,hasFilters:je,ecosystems:Y,statuses:_e,visibleCount:X.length,totalCount:W.length,onSearchChange:u,onEcosystemFilterChange:f,onStatusFilterChange:h,onToggleDirectOnly:()=>_(e=>!e),onSortChange:ie,onClearFilters:Me}),(0,A.jsx)(ge,{dependencies:X,selectedId:b,hasDependencies:W.length>0,coverageByWorkspaceId:ye,onSelect:e=>x(e.id)})]}),(0,A.jsx)(`section`,{className:S(`min-h-0`,Z?`flex flex-col`:`hidden md:flex md:flex-col`),"aria-label":e(`activity:techStack.dependencyDetail`),children:Z?(0,A.jsx)(he,{dependency:Z,findings:De,deepDive:O,onDeepDive:V,onBack:()=>x(null),coverage:ye.get(Z.workspaceId)}):(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:e(`activity:techStack.selectADependencyToSeeIts`)})})})]}),s===`findings`&&(0,A.jsx)(ve,{findings:G,dependenciesById:J,onSelectDependency:Ne}),s===`workspaces`&&(0,A.jsx)(we,{snapshot:t}),s===`trends`&&(0,A.jsx)(Se,{trend:de}),s===`remediation`&&(0,A.jsx)(Ce,{plan:fe,approved:F,applying:me,onToggle:e=>I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onApply:()=>void U()})]}):(0,A.jsx)(Te,{onScan:()=>void z(`inventory`),disabled:$})]})}function Se({trend:e}){return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[e.snapshots,` snapshots`,e.vulnerabilityHalfLifeMs===void 0?``:` · vulnerability half-life ${(e.vulnerabilityHalfLifeMs/864e5).toFixed(1)} days`]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.points.map(e=>(0,A.jsxs)(`div`,{className:`grid grid-cols-4 border border-border/70 bg-card/40 p-2 text-xs`,children:[(0,A.jsx)(`span`,{children:new Date(e.createdAt).toLocaleDateString()}),(0,A.jsxs)(`span`,{children:[e.dependencies,` deps`]}),(0,A.jsxs)(`span`,{className:`text-warning`,children:[e.outdated,` outdated`]}),(0,A.jsxs)(`span`,{className:`text-destructive`,children:[e.vulnerable,` vulnerable`]})]},e.snapshotId))})]}):(0,A.jsx)(Q,{})}function Ce({plan:e,approved:t,applying:r,onToggle:i,onApply:a}){let{t:o}=n();return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.warning}),(0,A.jsxs)(w,{size:`sm`,disabled:t.size===0||r,onClick:a,children:[r&&(0,A.jsx)(y,{className:`size-3.5 animate-spin`}),`Apply `,t.size>0?t.size:``]})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.items.map(e=>{let n=`${e.workspaceId}:${e.ecosystem}:${e.dependencyName}:${e.action}`,r=e.action===`replace`||e.action===`investigate`||!X.has(e.ecosystem);return(0,A.jsxs)(`label`,{className:S(`flex gap-3 border border-border/70 bg-card/40 p-2.5`,r?`cursor-not-allowed opacity-65`:`cursor-pointer`),children:[(0,A.jsx)(`input`,{type:`checkbox`,disabled:r,checked:t.has(n),onChange:()=>i(n)}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`span`,{className:`block font-mono text-xs`,children:[e.dependencyName,` · `,e.action]}),(0,A.jsxs)(`span`,{className:`block text-[10px] text-muted-foreground`,children:[e.currentVersion??`?`,` → `,e.targetVersion??`latest`,` · `,e.rationale]}),r&&(0,A.jsx)(`span`,{className:`block text-[10px] text-warning`,children:o(`activity:techStack.requiresAManualPackageChoice`)})]})]},n)}),e.items.length===0&&(0,A.jsx)(`p`,{className:`p-8 text-center text-xs text-muted-foreground`,children:o(`activity:techStack.noRemediationNeeded`)})]})]}):(0,A.jsx)(Q,{})}function we({snapshot:e}){let{t}=n(),r=(0,k.useMemo)(()=>{let t=new Map;for(let n of e.dependencies)t.set(n.workspaceId,(t.get(n.workspaceId)??0)+1);return t},[e]);return e.workspaces.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`activity:techStack.noWorkspacesDetected`)})}):(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.workspaces.map(e=>{let n=z[e.coverage];return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`truncate font-mono text-xs text-foreground`,children:e.relativeRoot}),(0,A.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(I,{ecosystem:e.ecosystem}),(0,A.jsx)(`span`,{children:P(e.ecosystem,t)}),e.packageManager?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsx)(`span`,{children:e.packageManager})]}):null,(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsxs)(`span`,{children:[r.get(e.id)??0,` deps`]})]})]}),(0,A.jsx)(`span`,{className:S(`shrink-0 border px-1.5 py-0.5 text-[10px] font-medium`,n.badge),children:t(n.labelKey)})]}),e.manifests.length>0&&(0,A.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:e.manifests.map(e=>(0,A.jsx)(`span`,{className:`border border-border/70 bg-background/45 px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:e.split(/[/\\]/).pop()},e))})]},e.id)})})})}function Q(){let{t:e}=n();return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,A.jsx)(y,{className:`size-5 animate-spin text-muted-foreground`}),(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`activity:techStack.loadingSnapshot`)})]})})}function Te({onScan:e,disabled:t}){let{t:r}=n(),i=(0,k.useMemo)(()=>Object.values(N).map(e=>e.label??``).filter(Boolean).join(`, `),[]);return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-3 text-center`,children:[(0,A.jsx)(`div`,{className:`flex size-14 items-center justify-center border border-info/25 bg-info/5 text-info`,children:(0,A.jsx)(h,{className:`size-6`})}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`activity:techStack.noInventoryYet`)}),(0,A.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`TechStack reads every manifest and lockfile in the open project — `,i,` — and compares what you have against the upstream registries.`]}),(0,A.jsxs)(w,{size:`sm`,onClick:e,disabled:t,children:[(0,A.jsx)(se,{className:S(`size-3.5`,t&&`animate-spin`)}),r(`activity:techStack.scanThisProject`)]})]})})}function Ee(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}export{Z as TechStackView};