forge-openclaw-plugin 0.2.102 → 0.2.103

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 (174) hide show
  1. package/dist/assets/activity-page-Dv6X5ZCV.js +1 -0
  2. package/dist/assets/{ai-surface-workspace-xtB5RFQu.js → ai-surface-workspace-CutiG6uS.js} +1 -1
  3. package/dist/assets/{atlas-panel-B3dPHCmZ.js → atlas-panel-jgMRyaHn.js} +1 -1
  4. package/dist/assets/{board-DqHzdCPQ.js → board-dIX6etHh.js} +1 -1
  5. package/dist/assets/calendar-page-q7Nm5E2U.js +1 -0
  6. package/dist/assets/calendar-rules-DPFsfiRl.js +1 -0
  7. package/dist/assets/{calendar-week-toolbar-BZ_-X3Wb.js → calendar-week-toolbar-nVhgB-0s.js} +1 -1
  8. package/dist/assets/{charts-FcU0F3XV.js → charts-DFnEuIMB.js} +1 -1
  9. package/dist/assets/companion-sync-lab-page-CJ8UTij8.js +1 -0
  10. package/dist/assets/{daily-metrics-dashboard-BMyL0Qr4.js → daily-metrics-dashboard-CiJkkkd1.js} +1 -1
  11. package/dist/assets/entity-note-count-link-RzBB6ujx.js +1 -0
  12. package/dist/assets/{entity-notes-surface-CBylYDwy.js → entity-notes-surface-Djz50HvD.js} +1 -1
  13. package/dist/assets/execution-board-CtPhI-58.js +1 -0
  14. package/dist/assets/{faceted-token-search-D7xPWfOl.js → faceted-token-search-DEC6ANa9.js} +1 -1
  15. package/dist/assets/{flagship-signal-deck-BEFKOhvx.js → flagship-signal-deck-CtHC3mql.js} +1 -1
  16. package/dist/assets/floating-action-menu-CKQRhff9.js +1 -0
  17. package/dist/assets/{forms-CmLAyGqz.js → forms-hB0SqEh-.js} +1 -1
  18. package/dist/assets/goal-detail-page-CF5fNQeR.js +1 -0
  19. package/dist/assets/goals-page-fsY8NzGB.js +1 -0
  20. package/dist/assets/{graph-BTa79qum.js → graph-DDUZNRsO.js} +1 -1
  21. package/dist/assets/habits-page-COoGz4kj.js +1 -0
  22. package/dist/assets/index-BAXYM89v.css +1 -0
  23. package/dist/assets/index-EqQsXoat.js +19 -0
  24. package/dist/assets/{insight-flow-dialog-BtIQXXsS.js → insight-flow-dialog-DtX_5W7g.js} +1 -1
  25. package/dist/assets/insights-page-cBd74ObU.js +8 -0
  26. package/dist/assets/kanban-page-CYav9THw.js +1 -0
  27. package/dist/assets/knowledge-graph-page-D2A-W1jE.js +1 -0
  28. package/dist/assets/{life-force-page-BGDkKfbJ.js → life-force-page-CACGlNhq.js} +1 -1
  29. package/dist/assets/life-force-workspace-BJ4N1I78.js +1 -0
  30. package/dist/assets/{maps-CF1RagUX.js → maps-C-yOWiDN.js} +1 -1
  31. package/dist/assets/{metric-tile-4iMd_WnJ.js → metric-tile-CMadwnGz.js} +1 -1
  32. package/dist/assets/{motion-CfdU2F35.js → motion-Lt5B1XuE.js} +1 -1
  33. package/dist/assets/movement-page-D5VqFd2q.js +1 -0
  34. package/dist/assets/{note-markdown-CsGQhQXF.js → note-markdown-BzK2Qlgr.js} +1 -1
  35. package/dist/assets/{note-tags-input-DdZi93tj.js → note-tags-input-CZzqJMLc.js} +1 -1
  36. package/dist/assets/notes-page-D3Hsh90C.js +1 -0
  37. package/dist/assets/{open-in-graph-button-C0TGev7c.js → open-in-graph-button-BFPKfyK3.js} +1 -1
  38. package/dist/assets/{orbit-map-DVXkfQdd.js → orbit-map-CnyfSmOG.js} +1 -1
  39. package/dist/assets/{overview-page-BwMlFQKX.js → overview-page-CXdWrOV1.js} +1 -1
  40. package/dist/assets/{page-hero-oFHaAjtL.js → page-hero-ffKzgyW3.js} +1 -1
  41. package/dist/assets/pill-cluster-C2D0h3lx.js +1 -0
  42. package/dist/assets/{preference-entity-handoff-button-DOKV9bZc.js → preference-entity-handoff-button-Dj3V6VxL.js} +1 -1
  43. package/dist/assets/preferences-page-Jo8Gw386.js +1 -0
  44. package/dist/assets/project-collections-qSqp90HN.js +1 -0
  45. package/dist/assets/{project-detail-page-DogvVNEn.js → project-detail-page-BifhiLQX.js} +1 -1
  46. package/dist/assets/project-management-hierarchy-page-DZ_9klIc.js +1 -0
  47. package/dist/assets/project-management-section-nav-BImLCVvf.js +1 -0
  48. package/dist/assets/projects-page-ptcx6H38.js +1 -0
  49. package/dist/assets/{psyche-behaviors-page-BeVlXvbj.js → psyche-behaviors-page-BDwXyDta.js} +1 -1
  50. package/dist/assets/{psyche-flashcards-page-CqAWCO4E.js → psyche-flashcards-page-DL1BP1jX.js} +1 -1
  51. package/dist/assets/{psyche-goal-map-page-IyNnbk_W.js → psyche-goal-map-page-ovcpisx1.js} +1 -1
  52. package/dist/assets/{psyche-graph-IkUQRaDK.js → psyche-graph-EP5GL612.js} +1 -1
  53. package/dist/assets/{psyche-metrics-page-uai0a7Lx.js → psyche-metrics-page-Bcu813Rg.js} +1 -1
  54. package/dist/assets/{psyche-mode-guide-page-C7p-ABiF.js → psyche-mode-guide-page-C0g27Xpt.js} +1 -1
  55. package/dist/assets/{psyche-modes-page-CLQ5V3w0.js → psyche-modes-page-BjKjX5MR.js} +1 -1
  56. package/dist/assets/{psyche-page-NQBHkkpU.js → psyche-page-F4tF2W70.js} +1 -1
  57. package/dist/assets/{psyche-patterns-page-BkRiNpI_.js → psyche-patterns-page-B-14hukK.js} +1 -1
  58. package/dist/assets/{psyche-questionnaire-builder-page-Du-7HwPC.js → psyche-questionnaire-builder-page-BdXmoHvK.js} +1 -1
  59. package/dist/assets/{psyche-questionnaire-detail-page-C5-yf8MF.js → psyche-questionnaire-detail-page-Cu5uwlJu.js} +1 -1
  60. package/dist/assets/{psyche-questionnaire-run-detail-page-CoSH5O6R.js → psyche-questionnaire-run-detail-page-C3R4PClg.js} +1 -1
  61. package/dist/assets/{psyche-questionnaire-run-page-ChI7c1wy.js → psyche-questionnaire-run-page-Div3iDdt.js} +1 -1
  62. package/dist/assets/{psyche-questionnaires-page-xUcJJzbI.js → psyche-questionnaires-page-DpqAPQCp.js} +1 -1
  63. package/dist/assets/{psyche-report-detail-page-BPrZCFZS.js → psyche-report-detail-page-BvWVDKP3.js} +1 -1
  64. package/dist/assets/{psyche-reports-page-D2EXJmm6.js → psyche-reports-page-BrbWUlAq.js} +1 -1
  65. package/dist/assets/{psyche-schemas-RcZYaokx.js → psyche-schemas-Dxj554nU.js} +1 -1
  66. package/dist/assets/{psyche-schemas-beliefs-page-h0ooZ1lp.js → psyche-schemas-beliefs-page-DYKvAtSD.js} +1 -1
  67. package/dist/assets/{psyche-screen-time-page-_3-4LikV.js → psyche-screen-time-page-CAOKCyQw.js} +1 -1
  68. package/dist/assets/{psyche-self-observation-page-BdbCsgR5.js → psyche-self-observation-page-F0MVA0UH.js} +1 -1
  69. package/dist/assets/{psyche-values-page-DuUVki5e.js → psyche-values-page-DyvX-d0o.js} +1 -1
  70. package/dist/assets/{report-chain-fields-BBMz0sGI.js → report-chain-fields-CeC1cJFS.js} +1 -1
  71. package/dist/assets/rewards-page-C2loyODo.js +1 -0
  72. package/dist/assets/scheduling-rules-editor-D40AC2jR.js +1 -0
  73. package/dist/assets/{schema-badge-D93RcG36.js → schema-badge-FY7818qB.js} +1 -1
  74. package/dist/assets/{select-menu-Cdq7foRu.js → select-menu-DJsCG6rM.js} +1 -1
  75. package/dist/assets/settings-agents-page-BFkJ5AAD.js +6 -0
  76. package/dist/assets/settings-bin-page-D3-Ab-iA.js +1 -0
  77. package/dist/assets/settings-calendar-page-ly_mSTAD.js +5 -0
  78. package/dist/assets/settings-data-page-D7QOqNf-.js +1 -0
  79. package/dist/assets/settings-logs-page-Ca87HEUx.js +1 -0
  80. package/dist/assets/settings-mobile-page-D0jejZot.js +1 -0
  81. package/dist/assets/settings-models-page-DPDsZjSc.js +1 -0
  82. package/dist/assets/settings-page-1cArlSPM.js +1 -0
  83. package/dist/assets/settings-rewards-page-Db4BV1DC.js +1 -0
  84. package/dist/assets/{settings-section-nav-Dc4IeVBt.js → settings-section-nav-DP9o4peU.js} +1 -1
  85. package/dist/assets/settings-users-page-BHFyDSsd.js +1 -0
  86. package/dist/assets/settings-wiki-page-BNaiupBm.js +1 -0
  87. package/dist/assets/sleep-page-BmOPF0yD.js +1 -0
  88. package/dist/assets/sports-page-BldIiclr.js +1 -0
  89. package/dist/assets/{state-VYvD1QVP.js → state-vCcAT5Hq.js} +1 -1
  90. package/dist/assets/strategies-page-CaTN99qj.js +1 -0
  91. package/dist/assets/strategy-detail-page-DsgFTd-U.js +1 -0
  92. package/dist/assets/{strategy-dialog-DMyRKrWf.js → strategy-dialog-7X7peRzu.js} +1 -1
  93. package/dist/assets/{surface-Bfz_sLX6.js → surface-CJI17F3n.js} +1 -1
  94. package/dist/assets/{table-C0VTeqw0.js → table-BNqMG3_S.js} +1 -1
  95. package/dist/assets/task-detail-page-M1sIIPA8.js +1 -0
  96. package/dist/assets/timebox-planning-dialog-ByojN0AN.js +1 -0
  97. package/dist/assets/today-page-BjDijtn8.js +1 -0
  98. package/dist/assets/training-load-page-BPRmaWmF.js +1 -0
  99. package/dist/assets/{ui-CsEkP2V8.js → ui-C1iwpj2-.js} +1 -1
  100. package/dist/assets/{use-psyche-focus-target-qxT5Oy_z.js → use-psyche-focus-target-Ct-acS9G.js} +1 -1
  101. package/dist/assets/{vendor-kIz9EZnX.js → vendor-Dnkkx2co.js} +3 -3
  102. package/dist/assets/{vitals-page-Dz1Jt5H8.js → vitals-page-CE9zdGLF.js} +1 -1
  103. package/dist/assets/weekly-review-page-CzhTv90n.js +1 -0
  104. package/dist/assets/weight-loss-page-Bp_cIk78.js +5 -0
  105. package/dist/assets/wiki-article-markdown-Dok2uy2p.js +4 -0
  106. package/dist/assets/wiki-editor-page-BuW32Y3f.js +26 -0
  107. package/dist/assets/wiki-ingest-history-page-DZKSBNHV.js +1 -0
  108. package/dist/assets/wiki-ingest-modal-DyqBEZcC.js +1 -0
  109. package/dist/assets/wiki-page-DqxlbLKG.js +1 -0
  110. package/dist/assets/workbench-flow-page-C4nc9jUg.js +5 -0
  111. package/dist/assets/workbench-page-BnyR7SL0.js +1 -0
  112. package/dist/assets/{workout-detail-page-DD9IGN6l.js → workout-detail-page-DT-c5cHL.js} +2 -2
  113. package/dist/index.html +9 -9
  114. package/dist/server/server/src/app.js +22 -3
  115. package/dist/server/server/src/health-weight-loss.js +114 -39
  116. package/dist/server/server/src/repositories/model-settings.js +9 -3
  117. package/dist/server/src/components/workbench-boxes/shared/generic-node-view.js +13 -5
  118. package/dist/server/src/lib/api.js +10 -1
  119. package/openclaw.plugin.json +1 -1
  120. package/package.json +1 -1
  121. package/dist/assets/activity-page-CgF7K2ww.js +0 -1
  122. package/dist/assets/calendar-page-C1Wfd2Fy.js +0 -1
  123. package/dist/assets/calendar-rules-CaZXtlxt.js +0 -1
  124. package/dist/assets/companion-sync-lab-page-NgeK-O-P.js +0 -1
  125. package/dist/assets/entity-note-count-link-BrS1-O0o.js +0 -1
  126. package/dist/assets/execution-board-CpO2ch6v.js +0 -1
  127. package/dist/assets/floating-action-menu-zzC2r0Ob.js +0 -1
  128. package/dist/assets/goal-detail-page-JK_Nva8e.js +0 -1
  129. package/dist/assets/goals-page-yeoJ06Vw.js +0 -1
  130. package/dist/assets/habits-page-Dx5EhkJi.js +0 -1
  131. package/dist/assets/index-BHIKoiZ6.js +0 -19
  132. package/dist/assets/index-H8R-ABM3.css +0 -1
  133. package/dist/assets/insights-page-CujrosD_.js +0 -8
  134. package/dist/assets/kanban-page-Q9NuIz5w.js +0 -1
  135. package/dist/assets/knowledge-graph-page-DaJmlvvM.js +0 -1
  136. package/dist/assets/life-force-workspace-CLVexVnb.js +0 -1
  137. package/dist/assets/movement-page-ClaoTNuX.js +0 -1
  138. package/dist/assets/notes-page-DYI8s3NN.js +0 -1
  139. package/dist/assets/pill-cluster-7UZd_lHp.js +0 -1
  140. package/dist/assets/preferences-page-BrKEkmfD.js +0 -1
  141. package/dist/assets/project-collections-CZagCmeH.js +0 -1
  142. package/dist/assets/project-management-hierarchy-page-Dr7hW9PW.js +0 -1
  143. package/dist/assets/project-management-section-nav-BLdAgTge.js +0 -1
  144. package/dist/assets/projects-page-UKrby_5-.js +0 -1
  145. package/dist/assets/rewards-page-PZFPa6rR.js +0 -1
  146. package/dist/assets/scheduling-rules-editor-B9KNKsQz.js +0 -1
  147. package/dist/assets/settings-agents-page-DPx2F6wf.js +0 -6
  148. package/dist/assets/settings-bin-page-COwP3gjo.js +0 -1
  149. package/dist/assets/settings-calendar-page-C-ghE0YT.js +0 -5
  150. package/dist/assets/settings-data-page-CBubzKBw.js +0 -1
  151. package/dist/assets/settings-logs-page-uOuXMeBm.js +0 -1
  152. package/dist/assets/settings-mobile-page-C5rfj8_r.js +0 -1
  153. package/dist/assets/settings-models-page-DijmUWdU.js +0 -1
  154. package/dist/assets/settings-page-B4u5TR5g.js +0 -1
  155. package/dist/assets/settings-rewards-page-COiTwkMH.js +0 -1
  156. package/dist/assets/settings-users-page-DEGa5DNn.js +0 -1
  157. package/dist/assets/settings-wiki-page-Cvsiz5_e.js +0 -1
  158. package/dist/assets/sleep-page-BnSOwkEU.js +0 -1
  159. package/dist/assets/sports-page-l1RqXzA_.js +0 -1
  160. package/dist/assets/strategies-page-DEnPlpAs.js +0 -1
  161. package/dist/assets/strategy-detail-page-Ls8bxKeH.js +0 -1
  162. package/dist/assets/task-detail-page-CgrYgQLD.js +0 -1
  163. package/dist/assets/timebox-planning-dialog-Ww0NGLLo.js +0 -1
  164. package/dist/assets/today-page-CIuFHMi1.js +0 -1
  165. package/dist/assets/training-load-page-BIwc648i.js +0 -1
  166. package/dist/assets/weekly-review-page-BFpBe1kI.js +0 -1
  167. package/dist/assets/weight-loss-page-BgMoBpBt.js +0 -5
  168. package/dist/assets/wiki-article-markdown-gsPTXTg1.js +0 -4
  169. package/dist/assets/wiki-editor-page-BpAZHooY.js +0 -26
  170. package/dist/assets/wiki-ingest-history-page-C-ig8O22.js +0 -1
  171. package/dist/assets/wiki-ingest-modal-BK4eQgqs.js +0 -1
  172. package/dist/assets/wiki-page-CMTZ60Zt.js +0 -1
  173. package/dist/assets/workbench-flow-page-BIpWUcLJ.js +0 -5
  174. package/dist/assets/workbench-page-CtCjYSRe.js +0 -1
@@ -1,19 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-page-CgF7K2ww.js","assets/vendor-kIz9EZnX.js","assets/vendor-CRS-psbw.css","assets/state-VYvD1QVP.js","assets/page-hero-oFHaAjtL.js","assets/table-C0VTeqw0.js","assets/entity-links-DwpxhW2H.js","assets/motion-CfdU2F35.js","assets/ui-CsEkP2V8.js","assets/forms-CmLAyGqz.js","assets/board-DqHzdCPQ.js","assets/graph-BTa79qum.js","assets/graph-BZV40eAE.css","assets/calendar-page-C1Wfd2Fy.js","assets/calendar-week-toolbar-BZ_-X3Wb.js","assets/calendar-ui-Cy1XRwzV.js","assets/timebox-planning-dialog-Ww0NGLLo.js","assets/scheduling-rules-editor-B9KNKsQz.js","assets/floating-action-menu-zzC2r0Ob.js","assets/calendar-display-preferences-Cid-2RnL.js","assets/companion-sync-lab-page-NgeK-O-P.js","assets/goal-detail-page-JK_Nva8e.js","assets/open-in-graph-button-C0TGev7c.js","assets/note-markdown-CsGQhQXF.js","assets/entity-notes-surface-CBylYDwy.js","assets/note-tags-input-DdZi93tj.js","assets/preference-entity-handoff-button-DOKV9bZc.js","assets/project-collections-CZagCmeH.js","assets/activity-copy-Bj4h9OcF.js","assets/goals-page-yeoJ06Vw.js","assets/entity-note-count-link-BrS1-O0o.js","assets/pill-cluster-7UZd_lHp.js","assets/habits-page-Dx5EhkJi.js","assets/use-psyche-focus-target-qxT5Oy_z.js","assets/select-menu-Cdq7foRu.js","assets/date-keys-Cj1G3TOn.js","assets/insights-page-CujrosD_.js","assets/insight-flow-dialog-BtIQXXsS.js","assets/charts-FcU0F3XV.js","assets/kanban-page-Q9NuIz5w.js","assets/execution-board-CpO2ch6v.js","assets/project-management-section-nav-BLdAgTge.js","assets/knowledge-graph-page-DaJmlvvM.js","assets/faceted-token-search-D7xPWfOl.js","assets/life-force-page-BGDkKfbJ.js","assets/life-force-workspace-CLVexVnb.js","assets/movement-page-ClaoTNuX.js","assets/surface-Bfz_sLX6.js","assets/notes-page-DYI8s3NN.js","assets/overview-page-BwMlFQKX.js","assets/ai-surface-workspace-xtB5RFQu.js","assets/flagship-signal-deck-BEFKOhvx.js","assets/project-detail-page-DogvVNEn.js","assets/calendar-rules-CaZXtlxt.js","assets/project-management-hierarchy-page-Dr7hW9PW.js","assets/projects-page-UKrby_5-.js","assets/settings-wiki-page-Cvsiz5_e.js","assets/settings-section-nav-Dc4IeVBt.js","assets/strategies-page-DEnPlpAs.js","assets/strategy-dialog-DMyRKrWf.js","assets/strategy-detail-page-Ls8bxKeH.js","assets/preferences-page-BrKEkmfD.js","assets/psyche-page-NQBHkkpU.js","assets/psyche-graph-IkUQRaDK.js","assets/psyche-behaviors-page-BeVlXvbj.js","assets/atlas-panel-B3dPHCmZ.js","assets/schema-badge-D93RcG36.js","assets/schema-visuals-CvC9a3i6.js","assets/query-cache-IQ8W-LNC.js","assets/psyche-schemas-RcZYaokx.js","assets/psyche-flashcards-page-CqAWCO4E.js","assets/psyche-goal-map-page-IyNnbk_W.js","assets/psyche-metrics-page-uai0a7Lx.js","assets/daily-metrics-dashboard-BMyL0Qr4.js","assets/psyche-mode-guide-page-C7p-ABiF.js","assets/psyche-modes-page-CLQ5V3w0.js","assets/psyche-patterns-page-BkRiNpI_.js","assets/orbit-map-DVXkfQdd.js","assets/psyche-questionnaire-builder-page-Du-7HwPC.js","assets/psyche-questionnaire-detail-page-C5-yf8MF.js","assets/psyche-questionnaire-run-detail-page-CoSH5O6R.js","assets/psyche-questionnaire-run-page-ChI7c1wy.js","assets/psyche-questionnaires-page-xUcJJzbI.js","assets/psyche-report-detail-page-BPrZCFZS.js","assets/report-chain-fields-BBMz0sGI.js","assets/psyche-reports-page-D2EXJmm6.js","assets/psyche-self-observation-page-BdbCsgR5.js","assets/psyche-screen-time-page-_3-4LikV.js","assets/psyche-schemas-beliefs-page-h0ooZ1lp.js","assets/psyche-values-page-DuUVki5e.js","assets/settings-page-B4u5TR5g.js","assets/settings-data-page-CBubzKBw.js","assets/metric-tile-4iMd_WnJ.js","assets/settings-agents-page-DPx2F6wf.js","assets/settings-bin-page-COwP3gjo.js","assets/settings-calendar-page-C-ghE0YT.js","assets/settings-mobile-page-C5rfj8_r.js","assets/settings-models-page-DijmUWdU.js","assets/settings-logs-page-uOuXMeBm.js","assets/settings-rewards-page-COiTwkMH.js","assets/settings-users-page-DEGa5DNn.js","assets/rewards-page-PZFPa6rR.js","assets/sleep-page-BnSOwkEU.js","assets/health-link-options-Cpx8w7uM.js","assets/sports-page-l1RqXzA_.js","assets/training-load-page-BIwc648i.js","assets/workout-detail-page-DD9IGN6l.js","assets/maps-CF1RagUX.js","assets/maps-B-YMMjus.css","assets/task-detail-page-CgrYgQLD.js","assets/today-page-CIuFHMi1.js","assets/vitals-page-Dz1Jt5H8.js","assets/weight-loss-page-BgMoBpBt.js","assets/wiki-page-CMTZ60Zt.js","assets/wiki-article-markdown-gsPTXTg1.js","assets/wiki-ingest-modal-BK4eQgqs.js","assets/wiki-ingest-history-page-C-ig8O22.js","assets/wiki-editor-page-BpAZHooY.js","assets/weekly-review-page-BFpBe1kI.js","assets/workbench-page-CtCjYSRe.js","assets/workbench-flow-page-BIpWUcLJ.js"])))=>i.map(i=>d[i]);
2
- var tl=Object.defineProperty;var rl=(e,t,a)=>t in e?tl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var jt=(e,t,a)=>rl(e,typeof t!="symbol"?t+"":t,a);import{aA as al,T as sl,j as r,r as c,aB as nl,aC as Lt,aD as Pi,aE as Fr,aF as ma,aG as ir,aH as ur,aI as Ti,aJ as Bt,aK as dt,aL as Ra,aM as il,aN as Mn,aO as ol,aP as Kt,aQ as ll,aR as Sr,aS as Pt,aT as Ii,aU as _a,aV as Ot,aW as or,aX as Fn,aY as Ea,aZ as cl,a_ as dl,a$ as ul,b0 as ml,b1 as pl,b2 as Rr,b3 as gt,F as zr,b4 as Wr,b5 as Aa,b6 as hl,b7 as Ci,b8 as Ri,b9 as _i,ba as La,bb as Ei,bc as qr,bd as Oa,be as Ai,bf as Da,bg as Br,bh as Li,bi as gl,bj as fl,bk as yl,bl as Oi,bm as pa,bn as ha,bo as Di,bp as xl,bq as $i,br as Mi,bs as vl,bt as Fi,bu as bl,bv as wl,bw as kl,bx as jl,by as Sl,bz as Nl,bA as zi,bB as lr,bC as Wi,bD as Pl,bE as Tl,bF as Il,bG as Cl,bH as Rl,bI as _l,bJ as $a,bK as Ma,bL as El,bM as Al,bN as Ll,bO as Ol,bP as qi,d as Dl,m as Kr,bQ as $l,bR as zn,bS as Ml,bT as Fl,bU as zl,bV as Wl,bW as ql,bX as Bl,bY as Kl,bZ as W,b_ as Yr,R as Bi,b$ as Hl,c0 as Ul,c1 as Gl}from"./vendor-kIz9EZnX.js";import{i as Hr,j as mr,k as cr,l as Vl,m as Jl,a as Ki,f as Xl,n as Ql,g as Yl,o as Zl,q as ec,r as tc,t as Hi,v as rc,P as ac,Q as sc}from"./state-VYvD1QVP.js";import{m as ht,u as nc,A as Fa}from"./motion-CfdU2F35.js";import{R as ft,P as yt,O as xt,C as vt,T as bt,D as wt,a as Dt,b as ic}from"./ui-CsEkP2V8.js";import{e as fe,s as j,o as he,a as me,c as _e,l as er,b as Nt,Z as ga,n as oc}from"./forms-CmLAyGqz.js";import{u as lc,a as cc,P as dc,D as uc,c as mc,S as pc,v as hc,b as gc,C as fc,d as yc}from"./board-DqHzdCPQ.js";import{H as xc,P as Wn}from"./graph-BTa79qum.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function a(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(n){if(n.ep)return;n.ep=!0;const o=a(n);fetch(n.href,o)}})();function b(...e){return al(sl(e))}function vc(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function za({className:e,tone:t="primary"}){return r.jsx("span",{"aria-hidden":"true",className:b("inline-block size-4 rounded-full border border-[var(--ui-border-strong)] border-t-transparent bg-[conic-gradient(from_180deg_at_50%_50%,transparent,color-mix(in_srgb,var(--ui-ink-strong)_34%,transparent),transparent)] align-middle motion-safe:animate-spin",t==="primary"&&"shadow-[0_0_0_1px_color-mix(in_srgb,var(--primary)_22%,transparent)]",t==="subtle"&&"opacity-80 shadow-[0_0_0_1px_var(--ui-border-subtle)]",t==="psyche"&&"shadow-[0_0_0_1px_color-mix(in_srgb,var(--secondary)_22%,transparent)]",e)})}function bc(){return{common:{actions:{cancel:"Cancel",close:"Close",create:"Create",edit:"Edit",inspect:"Inspect",open:"Open",refresh:"Refresh",retry:"Retry",save:"Save",reset:"Reset filters",view:"View"},labels:{loading:"Loading",backgroundActivity:"Background activity",syncInProgress:"Sync in progress",connectionState:"Connection state",errorCode:"Error code: {code}",noDate:"No date",noProject:"No project linked",noGoal:"No life goal linked",noExecutionNote:"No execution note attached yet.",noRunNote:"No run note recorded.",released:"Released",stable:"Stable",timedOut:"Timed out",waiting:"Waiting",today:"Today"},enums:{taskStatus:{backlog:"Backlog",focus:"Focus",in_progress:"In progress",blocked:"Blocked",done:"Done"},priority:{critical:"Critical",high:"High",medium:"Medium",low:"Low"},effort:{marathon:"Marathon",deep:"Deep",light:"Light"},energy:{high:"High",steady:"Steady",low:"Low"},projectStatus:{active:"Active",paused:"Suspended",completed:"Finished"},goalHorizon:{quarter:"Quarter",year:"Year",lifetime:"Lifetime"}},shell:{appName:"The Kinetic Forge",appMark:"FORGE",more:"More",command:"Action bar",moreRoutesEyebrow:"More routes",moreRoutesTitle:"Move through Forge",moreRoutesDescription:"Use this sheet for secondary destinations so the bottom bar stays clean and easy to use.",loadingEyebrow:"Forge shell",loadingTitle:"Loading Forge",loadingDescription:"Checking your operator session and loading your latest snapshot.",sessionEyebrow:"Forge operator session",stateEyebrow:"Forge state",settled:"Up to date",savingOne:"Saving {count} change",savingOther:"Saving {count} changes",refreshingOne:"Refreshing {count} view",refreshingOther:"Refreshing {count} views",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",rail:{taskBackToKanban:"Back to Kanban",taskOpenToday:"Open Today",projectAll:"All projects",projectGoals:"Goal architecture",goalAll:"All goals",goalProjects:"Active projects",psycheHub:"Psyche hub",psycheReports:"Reports",overview:"Overview",today:"Today"},momentum:{title:"Momentum",streak:"Streak",xp:"XP",momentum:"Momentum",streakBadgeOne:"{count} day streak",streakBadgeOther:"{count} day streak",weeklyXp:"{count} weekly XP",liveMomentum:"{count}% momentum",psycheMode:"Psyche active"}},routeLabels:{overview:"Overview",goals:"Goals",habits:"Habits",projects:"Projects",strategies:"Strategies",preferences:"Preferences",calendar:"Calendar",movement:"Movement",sleep:"Sleep",sports:"Sports",kanban:"Kanban",today:"Today",notes:"Notes",wiki:"KarpaWiki",psyche:"Psyche",activity:"Activity",insights:"Insights",review:"Review",settings:"Settings"},routeDetails:{overview:"See priorities, momentum, and recent evidence in one place.",goals:"Keep long-term direction connected to day-to-day work.",habits:"Track recurring commitments and recurring slips with explicit XP consequences.",projects:"Track the initiatives currently moving your goals forward.",strategies:"Plan the directed path from current work to the end state.",preferences:"Model taste, compare tradeoffs, and inspect preference evidence by context.",calendar:"Sync provider calendars, define work blocks, and plan real timeboxes.",movement:"See stays, trips, landmarks, and movement-linked evidence across time.",sleep:"Inspect sleep timing, recovery, and Psyche-linked context.",sports:"Inspect workout sessions, training volume, and reflection metadata.",kanban:"Move active work across the board without losing context.",today:"Focus today on the clearest next move.",notes:"Search Markdown work notes and reopen the linked work fast.",wiki:"Work in KarpaWiki, the SQLite-backed memory workspace with backlinks, entity links, and optional embeddings.",psyche:"Reflect on values, patterns, and reports with structure.",activity:"Review the visible audit trail of what changed and when.",insights:"Store and review coaching, analysis, and recommendations.",review:"Review the week and set the next push.",settings:"Manage collaboration, safety, and operator preferences."},navigation:{openRoute:"Open {label}",create:"Create",createTitle:"Create in Forge",createDescription:"Choose what you want to add next.",closeCreateMenu:"Close create menu",newGoal:"New life goal",newGoalDescription:"Define a long-term direction.",newProject:"New project",newProjectDescription:"Add a concrete initiative under a life goal.",newTask:"New task",newTaskDescription:"Capture the next actionable step in a project.",newStrategy:"New strategy",newStrategyDescription:"Add a directed plan across projects and tasks."},commandPalette:{searchPlaceholder:"Search Forge routes, records, KarpaWiki pages, notes, and active work",noResults:"No Forge result matches this search yet.",categoryRoute:"Route",categoryGoal:"Goal",categoryProject:"Project",categoryTask:"Task",routeOverview:"Open the overview.",routeToday:"Open today.",routeKanban:"Open the board.",routeNotes:"Search notes.",routeWiki:"Open KarpaWiki.",routePsyche:"Open Psyche.",routeGoals:"Open your life goals.",routeHabits:"Open your habits.",routeProjects:"Open your projects.",routeStrategies:"Open your strategies.",routePreferences:"Open the preferences workspace.",routeCalendar:"Open the calendar workspace.",routeReview:"Open weekly review.",routeSettings:"Open settings.",openLifeGoal:"Open life goal",openFocusTask:"Open focus task"},actionBar:{title:"Forge Action bar",description:"Search routes and Forge records, apply structured filters, or launch create actions from one command surface.",searchPlaceholder:"Search anything in Forge or type create habit…",idleHint:"Search Forge records, routes, and recent work. Add entity-type badges when you want structured narrowing without losing free text.",activeHint:"Free text stays live while selected badges narrow the entity results. Type create plus an entity to jump into the right creation flow.",filtersLabel:"Filter results",filtersPlaceholder:"Add entity type filters…",filtersEmpty:"No filter matches yet.",searching:"Searching Forge...",noResults:"No Forge result matches this search yet.",noResultsWithFilters:"No Forge record matches this query and filter combination yet.",sections:{routes:"Routes",recent:"Recent",quickActions:"Quick actions",results:"Results"}},pageState:{loadingTitle:"Getting things ready",loadingDescription:"Loading the latest Forge data for this view."},settings:{localeLabel:"Language",localeDescription:"Choose the language used throughout Forge.",localeEnglish:"English",localeFrench:"French",localeSaved:"Language saved"},overview:{heroEyebrow:"Strategic overview",heroEmptyTitle:"Ready to get started",heroDescription:"See your goals, active projects, current tasks, and recent evidence in one place.",emptyTitle:"No overview yet",emptyDescription:"Create a life goal, project, or task to give Forge something real to organize.",emptyAction:"Open life goals",commandEyebrow:"Command surface",commandTitle:"Now, next, risks, and recent proof",commandDescription:"See what needs attention now, what comes next, where drift is appearing, and what progress is already visible.",sectionGoals:"Active life goals",sectionProjects:"Active projects",sectionFocus:"Today's focus",sectionEvidence:"Recent evidence",sectionMomentum:"Momentum core",sectionAttention:"Needs attention",noGoals:"No life goals are active yet. Start by defining the direction you want Forge to support.",noProjects:"No active projects yet. Add a project to turn a goal into practical work.",noFocus:"No focus tasks yet. Promote a task when you know what deserves attention next.",noEvidence:"No evidence has been recorded yet. Completed work and logged activity will appear here.",noProjectYet:"No project yet",noAttention:"No major drift signal right now. Forge will raise neglected goals here when they start slipping.",metricsLevel:"Level",metricsWeeklyXp:"Weekly XP",metricsFocusTasks:"Focus tasks",metricsOverdue:"Overdue"},todayPage:{heroEyebrow:"Today",heroEmptyTitle:"No daily direction yet",heroDescription:"Start a task, earn XP, and keep today's work clear.",emptyTitle:"No daily runway yet",emptyDescription:"Add goals, tasks, or reward targets so Forge can shape a useful day plan.",emptyAction:"Open life goals",commandEyebrow:"Today command",commandTitle:"Directive, daily quests, recovery, and finish line",commandDescription:"See the next useful move clearly and keep the day grounded in real work.",questsTitle:"Daily quests",questsEmpty:"No daily quests yet. They will appear once Forge has enough live work and reward context.",rewardsTitle:"Milestone rewards",rewardsEmpty:"No milestone rewards are active yet. Long-term rewards will appear here as progress structure grows.",signalDirective:"Directive",signalQuest:"Quest chain",signalComeback:"Recovery",signalFinish:"Finish line",noDirective:"Choose one clear task to anchor the day.",noQuest:"No active daily quest chain",noQuestDetail:"Daily quests should reinforce real work, not distract from it.",noComeback:"Recovery window is clear",noFinish:"Keep the day clean",noDirectiveDetail:"Promote a real task and Today will become sharper immediately.",noFinishDetail:"A good finish today should make tomorrow lighter, not noisier."},kanban:{heroEyebrow:"Task board",heroTitle:"Task board",heroDescription:"Use the board to move active work, review blocked items, and open task details when you need more context.",emptyTitle:"No board yet",emptyDescription:"Create your first task inside a project to start using the board.",emptyAction:"Open life goals",healthEyebrow:"Board status",healthTitle:"Visible work, focus, blockers, and completed work",healthDescription:"See what is active, what needs attention, and what has already been completed.",visibleWork:"Visible work",focusWork:"Current focus",blockedWork:"Blocked work",completedWork:"Completed work",visibleDetail:"{hidden} tasks are outside the current filters.",focusDetailReady:"These are the tasks most ready to be picked up next.",focusDetailEmpty:"Move one backlog task into focus to make the board more useful.",blockedDetail:"These tasks need a decision, an unblock, or a reset before they can move again.",blockedDetailEmpty:"No blocked tasks right now.",doneDetail:"Completed work stays here until you review it or reopen it.",doneDetailEmpty:"Nothing has been completed on this board yet.",boardFilters:"Board filters",filterGoal:"Goal",filterOwner:"Owner",allGoals:"All goals",allOwners:"All owners",noTasksMatch:"No tasks match these filters",noTasksMatchDescription:"These filters hide every task. Reset them to see the full board again.",taskContext:"Task details",evidence:"Recent activity",runHistory:"Run history",noTaskEvidence:"No activity has been recorded for this task yet.",noRunHistory:"No runs have been recorded for this task yet.",taskPlacement:"Task placement",projectLabel:"Project: {value}",goalLabel:"Life goal: {value}",ownerLabel:"Owner: {value}",dueLabel:"Due: {value}",openTask:"Open task",openProject:"Open project",openGoal:"Open life goal",noProjectLinked:"No project linked",noGoalLinked:"No life goal linked"},dailyRunway:{runwayEyebrow:"Today",runwayTitle:"Tasks for today",prioritiesOne:"{count} task",prioritiesOther:"{count} tasks",unassigned:"Unassigned",runwayItem:"Task {index}",noNote:"No note yet.",inspect:"Open task",actionBacklog:"Start",actionFocus:"Start",actionProgress:"Done",actionBlocked:"Start",timelineEyebrow:"By status",timelineTitle:"Tasks by status",emptyBucket:"Nothing here right now."},executionBoard:{laneBacklogTitle:"Backlog",laneBacklogDetail:"Not started yet",laneFocusTitle:"Focus",laneFocusDetail:"Ready to work on",laneProgressTitle:"In progress",laneProgressDetail:"Currently moving",laneBlockedTitle:"Blocked",laneBlockedDetail:"Needs attention",laneDoneTitle:"Done",laneDoneDetail:"Completed",noExecutionNote:"No note yet.",reopen:"Reopen",emptyLane:"No tasks in this lane.",deleteDropTitle:"Drop here to delete",deleteDropDetail:"Move this task into the Bin.",deleteConfirmTitle:"Delete task?",deleteConfirmDescription:'Move "{title}" to the Bin? You can restore it later from Settings.',deleteConfirmCheckbox:"Do not ask again",deleteConfirmCancel:"No",deleteConfirmSubmit:"Yes, delete",deletingTask:"Deleting…"},weeklyReview:{heroEyebrow:"Weekly review",heroDescription:"Review the week, note what moved, and decide what needs attention next.",summaryEyebrow:"Weekly summary",summaryTitle:"This week, wins, recovery, and next steps",summaryDescription:"Use this review to understand what happened this week and choose the most useful next move.",sectionMomentum:"Momentum summary",sectionGoals:"Goal check-in",sectionWins:"Wins",completionBonus:"Completion bonus",finalize:"Finish review",finalized:"Review finalized",finalizedDetail:"This cycle is already locked into evidence.",finalizePending:"Finalizing review",noWin:"No win recorded yet",noWinDetail:"If this week was quiet, use the review to capture one useful takeaway anyway.",noRecovery:"No recovery suggestion yet",noRecoveryDetail:"If the week felt steady, keep a light recovery option available for next week."},dialogs:{closeDialog:"Close dialog",task:{eyebrow:"Task",createTitle:"Create task",editTitle:"Edit task",description:"Use tasks for the next concrete step inside a project. Pick the project first so Forge can keep the larger context aligned.",project:"Project",selectProject:"Select a project",goal:"Life goal",title:"Title",descriptionLabel:"Description",owner:"Owner",xp:"XP",priority:"Priority",status:"Status",effort:"Effort",energy:"Energy",dueDate:"Due date",tags:"Tags",save:"Save task",create:"Create task"},project:{eyebrow:"Project",createTitle:"Create project",editTitle:"Edit project",description:"Use projects to turn a life goal into a concrete stream of work with tasks, evidence, and momentum.",goal:"Life goal",selectGoal:"Select a life goal",title:"Title",descriptionLabel:"Description",status:"Status",targetXp:"Target XP",themeColor:"Theme color",save:"Save project",create:"Create project",submitError:"Project update failed."},goal:{eyebrow:"Life goal",createTitle:"Create life goal",editTitle:"Edit life goal",description:"Use life goals to define what matters over the coming months or years before you break the path into projects.",title:"Title",descriptionLabel:"Description",horizon:"Horizon",status:"Status",targetXp:"Target XP",themeColor:"Theme color",tags:"Life domains and context",save:"Save life goal",create:"Create life goal",submitError:"Goal update failed."}},taskDetail:{eyebrow:"Task",errorEyebrow:"Task",emptyPayload:"Forge returned an empty task payload.",heroFallback:"Use this task page to update the work, move it forward, and keep its context clear.",commandEyebrow:"Task overview",commandTitle:"What this task is, what to do next, and where it fits",commandDescription:"Use this page to update the task itself and understand its surrounding context clearly.",signalState:"State",signalNext:"Next move",signalEvidence:"Recent activity",signalAnchor:"Connected project",noStateChange:"No state change needed",terminalStateDetail:"This task is already in a completed state unless you decide to reopen it.",noEvidence:"No recent activity yet",noEvidenceDetail:"Completed work, corrections, and logged sessions will appear here as the task moves.",noAnchor:"No connected project yet",linkAnchorDetail:"Connect this task to a project or life goal so Forge can show why it matters.",edit:"Edit task",deleteTask:"Delete",deleting:"Deleting…",deleteTaskConfirm:'Move "{title}" to the Bin? You can restore it later unless you permanently delete it from Settings.',openProject:"Open project",openGoal:"Open life goal",markNotCompleted:"Mark not completed",sectionStatus:"Task status",fieldProject:"Project",fieldGoal:"Life goal",fieldDueDate:"Due date",pendingMove:"Moving",actionBacklog:"Move to backlog",actionFocus:"Move to focus",actionProgress:"Start now",actionBlocked:"Mark blocked",actionDone:"Mark completed",sectionEvidence:"Recent activity",noVisibleEvidence:"No activity has been recorded for this task yet.",removeLog:"Remove log",openRelatedItem:"Open related item",sectionRuns:"Work sessions",noRuns:"No work sessions have been recorded for this task yet.",sectionMetadata:"More task details",metaOwner:"Owner: {value}",metaEffort:"Effort: {value}",metaEnergy:"Energy: {value}",metaCreated:"Created: {value}",metaUpdated:"Last updated: {value}",metaCompleted:"Completed at: {value}",metaNotCompleted:"Not completed"},projectDetail:{errorEyebrow:"Project",heroEyebrow:"Project",commandEyebrow:"Project status",commandTitle:"Momentum, next task, risk, and evidence",commandDescription:"Use this page to see what is moving, what needs attention next, and what evidence already supports the project.",signalMomentum:"Momentum",signalNext:"Next task",signalRisk:"Risk",signalEvidence:"Evidence",trackedTasksOne:"{count} tracked task",trackedTasksOther:"{count} tracked tasks",noNextTask:"No next task selected yet",noNextTaskDetail:"Pick or create a task so the project has a clear next move.",needsFocus:"Needs focus",noRisk:"No immediate risk signal",noRiskDetail:"Blocked or neglected work will appear here when the project starts drifting.",noEvidence:"No recent evidence yet",noEvidenceDetail:"Completed work and logged activity will appear here as the project moves.",compatibility:"Compatibility mode",compatibilityDescription:"This project comes from an older snapshot format. You can review it here, but editing the project itself needs the updated backend.",addTask:"Add task",editProject:"Edit project",suspendProject:"Suspend",suspending:"Suspending…",finishProject:"Finish",finishing:"Finishing…",restartProject:"Restart",restarting:"Restarting…",deleteProject:"Delete",deleting:"Deleting…",deleteProjectConfirm:'Move "{title}" to the Bin? You can restore it later unless you permanently delete it from Settings.',openGoal:"Open life goal",sectionHealth:"Project health",fieldStatus:"Status",fieldProgress:"Progress",fieldMomentum:"Momentum",sectionEvidence:"Recent evidence"},goalDetail:{eyebrow:"Life goal",missingTitle:"This life goal is not available",missingDescription:"Forge cannot find this life goal in the current snapshot. Return to the goals view and choose an active one.",backToGoals:"Back to goals",heroBadgeOne:"{count} project",heroBadgeOther:"{count} projects",commandEyebrow:"Goal status",commandTitle:"Progress, next push, risk, and evidence",commandDescription:"Use this page to see what is advancing the goal, what should move next, and where support is needed.",signalProgress:"Progress",signalNext:"Next push",signalRisk:"Risk",signalEvidence:"Evidence",progressTitle:"{progress}% with {count} completed tasks",progressDetail:"{xp} XP is already banked on this goal.",noProject:"No active project yet",noProjectDetail:"Add a project so this goal has a concrete execution path.",needsProject:"Needs project",nextMove:"Next move: {value}",noRisk:"No drift signal right now",noRiskDetail:"If this goal starts slipping, Forge will surface that pressure here.",noEvidence:"No recent evidence yet",noEvidenceDetail:"Completed tasks, project motion, and agent actions will appear here as proof of progress.",edit:"Edit life goal",addProject:"Add project",deleteGoal:"Delete",deleting:"Deleting…",deleteGoalConfirm:'Move "{title}" to the Bin? You can restore it later unless you permanently delete it from Settings.',sectionProjects:"Projects advancing this goal",noProjects:"This goal does not have an active project yet. Add one to turn the goal into practical motion.",addNextTask:"Add the next task",sectionHealth:"Goal health",fieldProgress:"Progress",fieldCompletedTasks:"Completed tasks",fieldXpBanked:"XP banked",sectionEvidence:"Recent evidence",noEvidenceLogged:"No evidence has been logged for this goal yet. Task completions, project updates, and agent actions will appear here."}}}}const wc=bc(),kc={common:{actions:{cancel:"Annuler",close:"Fermer",create:"Créer",edit:"Modifier",inspect:"Inspecter",open:"Ouvrir",refresh:"Actualiser",retry:"Réessayer",save:"Enregistrer",reset:"Réinitialiser les filtres",view:"Voir"},labels:{loading:"Chargement",backgroundActivity:"Activité en arrière-plan",syncInProgress:"Synchronisation en cours",connectionState:"État de la connexion",errorCode:"Code d'erreur : {code}",noDate:"Aucune date",noProject:"Aucun projet lié",noGoal:"Aucun objectif de vie lié",noExecutionNote:"Aucune note d'exécution pour le moment.",noRunNote:"Aucune note d'exécution enregistrée.",released:"Libérée",stable:"Stable",timedOut:"Expirée",waiting:"En attente",today:"Aujourd'hui"},enums:{taskStatus:{backlog:"Backlog",focus:"Priorité",in_progress:"En cours",blocked:"Bloqué",done:"Terminé"},priority:{critical:"Critique",high:"Élevée",medium:"Moyenne",low:"Basse"},effort:{marathon:"Marathon",deep:"Approfondi",light:"Léger"},energy:{high:"Haute",steady:"Stable",low:"Basse"},projectStatus:{active:"Actif",paused:"Suspendu",completed:"Terminé"},goalHorizon:{quarter:"Trimestre",year:"Année",lifetime:"Vie entière"}},shell:{appName:"The Kinetic Forge",appMark:"FORGE",more:"Plus",command:"Barre d'action",moreRoutesEyebrow:"Autres vues",moreRoutesTitle:"Parcourir Forge",moreRoutesDescription:"Utilisez ce panneau pour accéder aux vues secondaires sans surcharger la barre inférieure.",loadingEyebrow:"Forge",loadingTitle:"Chargement de Forge",loadingDescription:"Vérification de votre session opérateur et chargement du dernier instantané.",sessionEyebrow:"Session opérateur Forge",stateEyebrow:"État de Forge",settled:"À jour",savingOne:"Enregistrement de {count} modification",savingOther:"Enregistrement de {count} modifications",refreshingOne:"Actualisation de {count} vue",refreshingOther:"Actualisation de {count} vues",collapseSidebar:"Réduire la barre latérale",expandSidebar:"Déployer la barre latérale",rail:{taskBackToKanban:"Retour au Kanban",taskOpenToday:"Ouvrir Aujourd'hui",projectAll:"Tous les projets",projectGoals:"Architecture des objectifs",goalAll:"Tous les objectifs",goalProjects:"Projets actifs",psycheHub:"Hub Psyche",psycheReports:"Rapports",overview:"Vue d'ensemble",today:"Aujourd'hui"},momentum:{title:"Momentum",streak:"Série",xp:"XP",momentum:"Momentum",streakBadgeOne:"{count} jour de série",streakBadgeOther:"{count} jours de série",weeklyXp:"{count} XP cette semaine",liveMomentum:"{count}% de momentum",psycheMode:"Psyche active"}},routeLabels:{overview:"Vue d'ensemble",goals:"Objectifs",habits:"Habitudes",projects:"Projets",strategies:"Stratégies",preferences:"Préférences",calendar:"Calendrier",movement:"Mouvement",sleep:"Sommeil",sports:"Sport",kanban:"Kanban",today:"Aujourd'hui",notes:"Notes",wiki:"KarpaWiki",psyche:"Psyche",activity:"Activité",insights:"Insights",review:"Revue",settings:"Réglages"},routeDetails:{overview:"Voyez les priorités, le momentum et les preuves récentes au même endroit.",goals:"Reliez la direction long terme au travail du quotidien.",habits:"Suivez les engagements récurrents et les rechutes avec des conséquences XP explicites.",projects:"Suivez les initiatives qui font avancer vos objectifs.",strategies:"Planifiez le chemin dirigé entre le travail actuel et l'état final.",preferences:"Modélisez les goûts, comparez les arbitrages et inspectez les preuves par contexte.",calendar:"Synchronisez les calendriers, définissez les blocs de travail et planifiez des timeboxes réelles.",movement:"Inspectez séjours, trajets, lieux clés et preuves liées au mouvement.",sleep:"Inspectez le sommeil, la régularité et le contexte lié à Psyche.",sports:"Inspectez les entraînements, le volume et les métadonnées de réflexion.",kanban:"Faites progresser le travail actif sans perdre le contexte.",today:"Concentrez aujourd'hui sur le prochain mouvement le plus net.",notes:"Recherchez les notes Markdown et rouvrez vite le travail lié.",wiki:"Travaillez dans une mémoire explicite basée sur des fichiers avec backlinks, liens Forge et embeddings optionnels.",psyche:"Réfléchissez avec structure sur vos valeurs, vos schémas et vos rapports.",activity:"Relisez la trace visible de ce qui a changé et quand.",insights:"Stockez et relisez coaching, analyses et recommandations.",review:"Relisez la semaine et préparez la prochaine poussée.",settings:"Gérez la collaboration, la sécurité et vos préférences."},navigation:{openRoute:"Ouvrir {label}",create:"Créer",createTitle:"Créer dans Forge",createDescription:"Choisissez ce que vous voulez ajouter ensuite.",closeCreateMenu:"Fermer le menu de création",newGoal:"Nouvel objectif de vie",newGoalDescription:"Définir une direction à long terme.",newProject:"Nouveau projet",newProjectDescription:"Ajouter une initiative concrète sous un objectif de vie.",newTask:"Nouvelle tâche",newTaskDescription:"Capturer la prochaine étape actionnable dans un projet.",newStrategy:"Nouvelle stratégie",newStrategyDescription:"Ajouter un plan dirigé à travers projets et tâches."},commandPalette:{searchPlaceholder:"Rechercher les vues Forge, les fiches, les pages wiki, les notes et le travail actif",noResults:"Aucun résultat Forge ne correspond à cette recherche.",categoryRoute:"Vue",categoryGoal:"Objectif",categoryProject:"Projet",categoryTask:"Tâche",routeOverview:"Ouvrir la vue d'ensemble.",routeToday:"Ouvrir aujourd'hui.",routeKanban:"Ouvrir le tableau.",routeNotes:"Rechercher les notes.",routeWiki:"Ouvrir l'espace mémoire wiki.",routePsyche:"Ouvrir Psyche.",routeGoals:"Ouvrir vos objectifs de vie.",routeHabits:"Ouvrir vos habitudes.",routeProjects:"Ouvrir vos projets.",routeStrategies:"Ouvrir vos stratégies.",routePreferences:"Ouvrir l'espace préférences.",routeCalendar:"Ouvrir l'espace calendrier.",routeReview:"Ouvrir la revue hebdomadaire.",routeSettings:"Ouvrir les réglages.",openLifeGoal:"Ouvrir l'objectif de vie",openFocusTask:"Ouvrir la tâche prioritaire"},actionBar:{title:"Barre d'action Forge",description:"Recherchez des vues et des fiches Forge, ajoutez des filtres structurés ou lancez des actions de création depuis une seule surface.",searchPlaceholder:"Rechercher dans Forge ou taper créer habitude…",idleHint:"Recherchez les fiches, vues et éléments récents de Forge. Ajoutez des badges de type d'entité pour affiner la recherche sans perdre le texte libre.",activeHint:"Le texte libre reste actif pendant que les badges sélectionnés resserrent les résultats. Tapez créer plus un type d'entité pour ouvrir le bon flux de création.",filtersLabel:"Filtrer les résultats",filtersPlaceholder:"Ajouter des filtres de type d'entité…",filtersEmpty:"Aucun filtre correspondant pour le moment.",searching:"Recherche dans Forge...",noResults:"Aucun résultat Forge ne correspond à cette recherche.",noResultsWithFilters:"Aucune fiche Forge ne correspond encore à cette combinaison de requête et de filtres.",sections:{routes:"Vues",recent:"Récent",quickActions:"Actions rapides",results:"Résultats"}},pageState:{loadingTitle:"Préparation en cours",loadingDescription:"Chargement des dernières données Forge pour cette vue."},settings:{localeLabel:"Langue",localeDescription:"Choisissez la langue utilisée dans Forge.",localeEnglish:"Anglais",localeFrench:"Français",localeSaved:"Langue enregistrée"},overview:{heroEyebrow:"Vue stratégique",heroEmptyTitle:"Prêt à démarrer",heroDescription:"Voyez vos objectifs, projets actifs, tâches en cours et preuves récentes au même endroit.",emptyTitle:"Pas encore de vue d'ensemble",emptyDescription:"Créez un objectif de vie, un projet ou une tâche pour donner à Forge une base réelle.",emptyAction:"Ouvrir les objectifs de vie",commandEyebrow:"Vue de commande",commandTitle:"Maintenant, ensuite, risques et preuves récentes",commandDescription:"Cette vue doit montrer ce qui mérite votre attention maintenant, ce qui vient ensuite, où la dérive apparaît et les progrès déjà visibles.",sectionGoals:"Objectifs de vie actifs",sectionProjects:"Projets actifs",sectionFocus:"Priorité du jour",sectionEvidence:"Preuves récentes",sectionMomentum:"Noyau de momentum",sectionAttention:"À surveiller",noGoals:"Aucun objectif de vie actif pour le moment. Commencez par définir la direction que Forge doit soutenir.",noProjects:"Aucun projet actif. Ajoutez un projet pour transformer un objectif en travail concret.",noFocus:"Aucune tâche prioritaire pour le moment. Faites passer une tâche en priorité quand vous savez quoi faire ensuite.",noEvidence:"Aucune preuve enregistrée pour le moment. Le travail accompli et l'activité journalisée apparaîtront ici.",noProjectYet:"Pas encore de projet",noAttention:"Aucun signal majeur de dérive pour le moment. Forge affichera ici les objectifs négligés.",metricsLevel:"Niveau",metricsWeeklyXp:"XP hebdo",metricsFocusTasks:"Tâches prioritaires",metricsOverdue:"En retard"},todayPage:{heroEyebrow:"Aujourd'hui",heroEmptyTitle:"Pas encore de direction du jour",heroDescription:"Commencez une tâche, gagnez de l'XP et gardez la journée claire.",emptyTitle:"Pas encore de piste du jour",emptyDescription:"Ajoutez des objectifs, des tâches ou des cibles de récompense pour que Forge puisse construire une journée utile.",emptyAction:"Ouvrir les objectifs de vie",commandEyebrow:"Commande du jour",commandTitle:"Directive, quêtes du jour, reprise et ligne d'arrivée",commandDescription:"Aujourd'hui doit rendre le prochain mouvement utile évident et garder la journée ancrée dans un vrai travail.",questsTitle:"Quêtes du jour",questsEmpty:"Pas encore de quêtes du jour. Elles apparaîtront quand Forge aura assez de travail réel et de contexte de récompense.",rewardsTitle:"Récompenses jalons",rewardsEmpty:"Aucune récompense jalon active pour le moment. Elles apparaîtront à mesure que la structure de progression se précise.",signalDirective:"Directive",signalQuest:"Chaîne de quêtes",signalComeback:"Reprise",signalFinish:"Ligne d'arrivée",noDirective:"Choisissez une tâche claire pour ancrer la journée.",noQuest:"Aucune chaîne de quêtes active",noQuestDetail:"Les quêtes du jour doivent renforcer le vrai travail, pas le détourner.",noComeback:"La fenêtre de reprise est claire",noFinish:"Gardez la journée nette",noDirectiveDetail:"Faites passer une vraie tâche en priorité et la vue Aujourd'hui deviendra plus nette.",noFinishDetail:"Une bonne fin de journée doit alléger demain, pas l'encombrer."},kanban:{heroEyebrow:"Tableau des tâches",heroTitle:"Tableau des tâches",heroDescription:"Utilisez le tableau pour faire avancer le travail actif, revoir les blocages et ouvrir les détails quand nécessaire.",emptyTitle:"Pas encore de tableau",emptyDescription:"Créez votre première tâche dans un projet pour commencer à utiliser le tableau.",emptyAction:"Ouvrir les objectifs de vie",healthEyebrow:"État du tableau",healthTitle:"Travail visible, priorité, blocages et travail terminé",healthDescription:"Le tableau doit montrer ce qui est actif, ce qui demande de l'attention et ce qui est déjà terminé.",visibleWork:"Travail visible",focusWork:"Priorité actuelle",blockedWork:"Travail bloqué",completedWork:"Travail terminé",visibleDetail:"{hidden} tâches sont hors des filtres actuels.",focusDetailReady:"Ce sont les tâches les plus prêtes à être reprises maintenant.",focusDetailEmpty:"Faites passer une tâche du backlog en priorité pour rendre le tableau plus utile.",blockedDetail:"Ces tâches ont besoin d'une décision, d'un déblocage ou d'une remise à plat avant d'avancer.",blockedDetailEmpty:"Aucune tâche bloquée pour le moment.",doneDetail:"Le travail terminé reste ici jusqu'à sa revue ou sa réouverture.",doneDetailEmpty:"Rien n'a encore été terminé sur ce tableau.",boardFilters:"Filtres du tableau",filterGoal:"Objectif",filterOwner:"Responsable",allGoals:"Tous les objectifs",allOwners:"Tous les responsables",noTasksMatch:"Aucune tâche ne correspond à ces filtres",noTasksMatchDescription:"Ces filtres masquent toutes les tâches. Réinitialisez-les pour revoir l'ensemble du tableau.",taskContext:"Détails de la tâche",evidence:"Activité récente",runHistory:"Historique d'exécution",noTaskEvidence:"Aucune activité n'a encore été enregistrée pour cette tâche.",noRunHistory:"Aucune exécution n'a encore été enregistrée pour cette tâche.",taskPlacement:"Placement de la tâche",projectLabel:"Projet : {value}",goalLabel:"Objectif de vie : {value}",ownerLabel:"Responsable : {value}",dueLabel:"Échéance : {value}",openTask:"Ouvrir la tâche",openProject:"Ouvrir le projet",openGoal:"Ouvrir l'objectif de vie",noProjectLinked:"Aucun projet lié",noGoalLinked:"Aucun objectif de vie lié"},dailyRunway:{runwayEyebrow:"Aujourd'hui",runwayTitle:"Tâches du jour",prioritiesOne:"{count} tâche",prioritiesOther:"{count} tâches",unassigned:"Non attribué",runwayItem:"Tâche {index}",noNote:"Aucune note pour le moment.",inspect:"Ouvrir la tâche",actionBacklog:"Commencer",actionFocus:"Commencer",actionProgress:"Terminer",actionBlocked:"Commencer",timelineEyebrow:"Par statut",timelineTitle:"Tâches par statut",emptyBucket:"Rien ici pour le moment."},executionBoard:{laneBacklogTitle:"Backlog",laneBacklogDetail:"Pas encore commencé",laneFocusTitle:"Priorité",laneFocusDetail:"Prêt à être traité",laneProgressTitle:"En cours",laneProgressDetail:"En mouvement",laneBlockedTitle:"Bloqué",laneBlockedDetail:"Demande de l'attention",laneDoneTitle:"Terminé",laneDoneDetail:"Achevé",noExecutionNote:"Aucune note pour le moment.",reopen:"Rouvrir",emptyLane:"Aucune tâche dans cette colonne.",deleteDropTitle:"Déposer ici pour supprimer",deleteDropDetail:"Déplacez cette tâche dans la corbeille.",deleteConfirmTitle:"Supprimer la tâche ?",deleteConfirmDescription:'Déplacer "{title}" vers la corbeille ? Vous pourrez la restaurer plus tard dans Réglages.',deleteConfirmCheckbox:"Ne plus demander",deleteConfirmCancel:"Non",deleteConfirmSubmit:"Oui, supprimer",deletingTask:"Suppression…"},weeklyReview:{heroEyebrow:"Revue hebdomadaire",heroDescription:"Relisez la semaine, notez ce qui a avancé et décidez de ce qui demande de l'attention ensuite.",summaryEyebrow:"Résumé hebdomadaire",summaryTitle:"Cette semaine, les progrès, la récupération et la suite",summaryDescription:"Utilisez cette revue pour comprendre la semaine et choisir le prochain mouvement utile.",sectionMomentum:"Résumé du momentum",sectionGoals:"Point sur les objectifs",sectionWins:"Progrès",completionBonus:"Bonus de complétion",finalize:"Terminer la revue",finalized:"Revue terminée",finalizedDetail:"Ce cycle est déjà consigné comme preuve.",finalizePending:"Finalisation de la revue",noWin:"Aucun progrès enregistré",noWinDetail:"Même si la semaine a été calme, notez au moins un apprentissage utile.",noRecovery:"Aucune suggestion de récupération",noRecoveryDetail:"Si la semaine a été stable, gardez malgré tout une option légère de récupération."},dialogs:{closeDialog:"Fermer la fenêtre",task:{eyebrow:"Tâche",createTitle:"Créer une tâche",editTitle:"Modifier la tâche",description:"Utilisez les tâches pour représenter la prochaine étape concrète dans un projet. Choisissez d'abord le projet pour garder le bon contexte.",project:"Projet",selectProject:"Sélectionner un projet",goal:"Objectif de vie",title:"Titre",descriptionLabel:"Description",owner:"Responsable",xp:"XP",priority:"Priorité",status:"Statut",effort:"Effort",energy:"Énergie",dueDate:"Date d'échéance",tags:"Tags",save:"Enregistrer la tâche",create:"Créer la tâche"},project:{eyebrow:"Projet",createTitle:"Créer un projet",editTitle:"Modifier le projet",description:"Utilisez les projets pour transformer un objectif de vie en flux de travail concret avec tâches, preuves et momentum.",goal:"Objectif de vie",selectGoal:"Sélectionner un objectif de vie",title:"Titre",descriptionLabel:"Description",status:"Statut",targetXp:"XP cible",themeColor:"Couleur du thème",save:"Enregistrer le projet",create:"Créer le projet",submitError:"La mise à jour du projet a échoué."},goal:{eyebrow:"Objectif de vie",createTitle:"Créer un objectif de vie",editTitle:"Modifier l'objectif de vie",description:"Utilisez les objectifs de vie pour définir ce qui compte sur les mois ou les années à venir avant de le décliner en projets.",title:"Titre",descriptionLabel:"Description",horizon:"Horizon",status:"Statut",targetXp:"XP cible",themeColor:"Couleur du thème",tags:"Domaines de vie et contexte",save:"Enregistrer l'objectif de vie",create:"Créer l'objectif de vie",submitError:"La mise à jour de l'objectif a échoué."}},taskDetail:{eyebrow:"Tâche",errorEyebrow:"Tâche",emptyPayload:"Forge a renvoyé une charge utile de tâche vide.",heroFallback:"Utilisez cette page pour mettre à jour la tâche, la faire avancer et garder son contexte clair.",commandEyebrow:"Commande de tâche",commandTitle:"Statut, prochaine action, preuves et contexte",commandDescription:"Cette page doit aider à modifier directement la tâche et à comprendre clairement son contexte.",signalState:"Statut",signalNext:"Prochaine action",signalEvidence:"Activité récente",signalAnchor:"Projet lié",noStateChange:"Aucun changement d'état nécessaire",terminalStateDetail:"Cette tâche est déjà dans un état terminé, sauf si vous décidez de la rouvrir.",noEvidence:"Aucune activité récente pour le moment",noEvidenceDetail:"Le travail terminé, les corrections et les sessions apparaîtront ici à mesure que la tâche avance.",noAnchor:"Aucun projet lié",linkAnchorDetail:"Reliez cette tâche à un projet ou à un objectif de vie pour que Forge puisse montrer pourquoi elle compte.",edit:"Modifier la tâche",deleteTask:"Supprimer",deleting:"Suppression…",deleteTaskConfirm:`Déplacer "{title}" vers la corbeille ? Vous pourrez la restaurer plus tard tant qu'elle n'est pas supprimée définitivement dans Réglages.`,openProject:"Ouvrir le projet",openGoal:"Ouvrir l'objectif de vie",markNotCompleted:"Marquer comme non terminée",sectionStatus:"Statut de la tâche",fieldProject:"Projet",fieldGoal:"Objectif de vie",fieldDueDate:"Date d'échéance",pendingMove:"Déplacement",actionBacklog:"Passer au backlog",actionFocus:"Passer en priorité",actionProgress:"Commencer maintenant",actionBlocked:"Marquer bloquée",actionDone:"Marquer terminée",sectionEvidence:"Activité récente",noVisibleEvidence:"Aucune activité n'a encore été enregistrée pour cette tâche.",removeLog:"Supprimer l'entrée",openRelatedItem:"Ouvrir l'élément lié",sectionRuns:"Sessions de travail",noRuns:"Aucune session de travail n'a encore été enregistrée pour cette tâche.",sectionMetadata:"Autres détails de la tâche",metaOwner:"Responsable : {value}",metaEffort:"Effort : {value}",metaEnergy:"Énergie : {value}",metaCreated:"Créée : {value}",metaUpdated:"Dernière mise à jour : {value}",metaCompleted:"Terminée le : {value}",metaNotCompleted:"Non terminée"},projectDetail:{errorEyebrow:"Projet",heroEyebrow:"Projet",commandEyebrow:"État du projet",commandTitle:"Momentum, prochaine tâche, risque et preuves",commandDescription:"Utilisez cette page pour voir ce qui avance, ce qui demande votre attention ensuite, et quelles preuves soutiennent déjà le projet.",signalMomentum:"Momentum",signalNext:"Prochaine tâche",signalRisk:"Risque",signalEvidence:"Preuves",trackedTasksOne:"{count} tâche suivie",trackedTasksOther:"{count} tâches suivies",noNextTask:"Aucune prochaine tâche choisie",noNextTaskDetail:"Choisissez ou créez une tâche pour donner au projet un prochain mouvement clair.",needsFocus:"Besoin de priorité",noRisk:"Aucun risque immédiat",noRiskDetail:"Le travail bloqué ou négligé apparaîtra ici si le projet commence à dériver.",noEvidence:"Aucune preuve récente",noEvidenceDetail:"Le travail terminé et l'activité enregistrée apparaîtront ici à mesure que le projet avance.",compatibility:"Mode de compatibilité",compatibilityDescription:"Ce projet provient d'un ancien format d'instantané. Vous pouvez le consulter ici, mais sa modification demande le backend mis à jour.",addTask:"Ajouter une tâche",editProject:"Modifier le projet",suspendProject:"Suspendre",suspending:"Suspension…",finishProject:"Terminer",finishing:"Finalisation…",restartProject:"Relancer",restarting:"Relance…",deleteProject:"Supprimer",deleting:"Suppression…",deleteProjectConfirm:`Déplacer "{title}" vers la corbeille ? Vous pourrez le restaurer plus tard tant qu'il n'est pas supprimé définitivement dans Réglages.`,openGoal:"Ouvrir l'objectif de vie",sectionHealth:"Santé du projet",fieldStatus:"Statut",fieldProgress:"Progression",fieldMomentum:"Momentum",sectionEvidence:"Preuves récentes"},goalDetail:{eyebrow:"Objectif de vie",missingTitle:"Cet objectif de vie n'est pas disponible",missingDescription:"Forge ne trouve pas cet objectif de vie dans l'instantané actuel. Revenez à la vue des objectifs et choisissez-en un actif.",backToGoals:"Retour aux objectifs",heroBadgeOne:"{count} projet",heroBadgeOther:"{count} projets",commandEyebrow:"État de l'objectif",commandTitle:"Progression, prochain élan, risque et preuves",commandDescription:"Utilisez cette page pour voir ce qui fait avancer l'objectif, ce qui doit bouger ensuite, et où du soutien est nécessaire.",signalProgress:"Progression",signalNext:"Prochain élan",signalRisk:"Risque",signalEvidence:"Preuves",progressTitle:"{progress}% avec {count} tâches terminées",progressDetail:"{xp} XP sont déjà cumulés sur cet objectif.",noProject:"Aucun projet actif pour le moment",noProjectDetail:"Ajoutez un projet pour donner à cet objectif un chemin d'exécution concret.",needsProject:"Projet nécessaire",nextMove:"Prochaine action : {value}",noRisk:"Aucun signal de dérive pour le moment",noRiskDetail:"Si cet objectif commence à glisser, Forge affichera cette pression ici.",noEvidence:"Aucune preuve récente",noEvidenceDetail:"Les tâches terminées, le mouvement des projets et les actions d'agents apparaîtront ici comme preuve de progression.",edit:"Modifier l'objectif de vie",addProject:"Ajouter un projet",deleteGoal:"Supprimer",deleting:"Suppression…",deleteGoalConfirm:`Déplacer "{title}" vers la corbeille ? Vous pourrez le restaurer plus tard tant qu'il n'est pas supprimé définitivement dans Réglages.`,sectionProjects:"Projets qui font avancer cet objectif",noProjects:"Cet objectif n'a pas encore de projet actif. Ajoutez-en un pour le transformer en mouvement concret.",addNextTask:"Ajouter la prochaine tâche",sectionHealth:"Santé de l'objectif",fieldProgress:"Progression",fieldCompletedTasks:"Tâches terminées",fieldXpBanked:"XP cumulés",sectionEvidence:"Preuves récentes",noEvidenceLogged:"Aucune preuve n'a encore été enregistrée pour cet objectif. Les tâches terminées, les mises à jour de projet et les actions d'agents apparaîtront ici."}}},qn={en:wc,fr:kc};function Bn(e,t){const a=t.split(".");let s=e;for(const n of a){if(!s||typeof s=="string")return;s=s[n]}return typeof s=="string"?s:void 0}function jc(e,t){return t?e.replace(/\{(\w+)\}/g,(a,s)=>{const n=t[s];return n==null?"":String(n)}):e}function _r(e,t,a){const s=Bn(qn[e],t),n=Bn(qn.en,t);return jc(s??n??t,a)}const Sc={locale:"en",t:(e,t)=>_r("en",e,t),formatDate:e=>e?new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}).format(new Date(`${e}T00:00:00.000Z`)):_r("en","common.labels.noDate"),formatDateTime:e=>new Intl.DateTimeFormat("en",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e)),formatNumber:e=>new Intl.NumberFormat("en").format(e)},Ui=c.createContext(null);function Nc({children:e,locale:t}){const a=c.useMemo(()=>({locale:t,t:(s,n)=>_r(t,s,n),formatDate:s=>s?new Intl.DateTimeFormat(t,{month:"short",day:"numeric"}).format(new Date(`${s}T00:00:00.000Z`)):_r(t,"common.labels.noDate"),formatDateTime:s=>new Intl.DateTimeFormat(t,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(s)),formatNumber:s=>new Intl.NumberFormat(t).format(s)}),[t]);return r.jsx(Ui.Provider,{value:a,children:e})}function De(){return c.useContext(Ui)??Sc}function Kn({active:e,label:t,className:a,onClick:s}){const{t:n}=De();return r.jsxs(ht.button,{type:"button",initial:!1,animate:{opacity:e?1:.55,y:0,scale:e?1:.98},transition:{duration:.24,ease:"easeOut"},onClick:s,className:b("surface-pulse ambient-glow inline-flex min-h-11 shrink-0 items-center gap-2.5 rounded-full border border-[var(--ui-border-subtle)] px-4 py-2 text-left shadow-[var(--ui-shadow-soft)] backdrop-blur-xl transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",s?"cursor-pointer":"cursor-default",a),"aria-live":"polite","aria-label":`${n("common.labels.backgroundActivity")}: ${t}`,children:[r.jsx(za,{tone:"subtle",className:e?"opacity-100":"opacity-45"}),r.jsxs("div",{className:"inline-flex min-w-0 max-w-full items-center gap-2 whitespace-nowrap",children:[r.jsx("span",{className:"type-label hidden text-[var(--ui-ink-soft)] sm:inline",children:n("common.labels.backgroundActivity")}),r.jsx("span",{className:"hidden text-[var(--ui-ink-faint)] sm:inline",children:"•"}),r.jsx("span",{className:"truncate text-sm text-[var(--ui-ink-medium)]",children:t})]})]})}function le({className:e,tone:t="default",size:a="md",wrap:s=!1,...n}){return r.jsx("span",{className:b("inline-flex max-w-full items-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] font-medium text-[var(--ui-ink-medium)]",s?"whitespace-normal break-words [overflow-wrap:anywhere]":"overflow-hidden text-ellipsis whitespace-nowrap",a==="xs"?"min-h-5 px-2 py-0.5 text-[10px]":a==="sm"?"min-h-7 px-2.5 py-1 text-[12px]":"min-h-8 px-3 py-1.5 text-[12px]",t==="meta"&&"bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]",t==="signal"&&"border-[color-mix(in_srgb,var(--primary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]",e),...n})}const Pc=nl("inline-flex min-w-0 max-w-full items-center justify-center gap-2 overflow-hidden whitespace-nowrap rounded-[var(--radius-control)] font-medium leading-none transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--primary)_45%,transparent)] disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{primary:"border border-[color-mix(in_srgb,var(--primary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)] hover:bg-[var(--ui-accent-soft-hover)]",secondary:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)] hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",ghost:"border border-transparent bg-transparent text-[var(--primary)] hover:bg-[var(--ui-surface-1)]"},size:{sm:"min-h-[2.125rem] px-2.5 py-[0.4375rem] text-[13px]",md:"interactive-tap min-h-10 px-3 py-2 text-[13px]",lg:"min-h-11 px-4 py-2.5 text-sm"}},defaultVariants:{variant:"primary",size:"md"}});function ue({className:e,variant:t,size:a,pending:s=!1,pendingLabel:n,children:o,disabled:i,...l}){return r.jsxs("button",{className:b(Pc({variant:t,size:a}),e),disabled:i||s,"aria-busy":s,...l,children:[s?r.jsx(za,{className:"size-3.5",tone:"subtle"}):null,r.jsx("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2 overflow-hidden truncate whitespace-nowrap",children:s&&n?n:o})]})}function Tc({value:e,className:t,tone:a="primary"}){const s=`${Math.max(4,Math.min(100,e))}%`,n=a==="secondary"?"from-[var(--secondary)] to-[rgba(78,222,163,0.45)]":a==="tertiary"?"from-[var(--tertiary)] to-[rgba(255,185,95,0.45)]":"from-[var(--primary)] to-[rgba(192,193,255,0.45)]";return r.jsx("div",{className:b("h-1.5 rounded-full bg-[var(--ui-surface-2)]",t),children:r.jsx("div",{className:b("h-full rounded-full bg-gradient-to-r",n),style:{width:s}})})}class Er extends Error{constructor(a){super(a.message);jt(this,"status");jt(this,"code");jt(this,"details");jt(this,"requestPath");jt(this,"response");this.name="ForgeApiError",this.status=a.status,this.code=a.code,this.details=a.details??[],this.requestPath=a.requestPath,this.response=a.response??null}}function Ic(e){return e instanceof Er?{title:`Request failed (${e.status})`,description:e.details.length>0?`${e.message} ${e.details.map(t=>`${t.path}: ${t.message}`).join(" · ")}`:e.message,code:e.code}:e instanceof Error?{title:"Something went wrong",description:e.message,code:"unknown_error"}:{title:"Something went wrong",description:"Unexpected API failure.",code:"unknown_error"}}function Gi(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase()}function $t(e){const t=e==null?void 0:e.trim();return t||null}function Mt(e){return $t(e)??"Unnamed calendar"}function Vi(e){switch(e){case"google":return"Google";case"apple":return"Apple";case"microsoft":return"Microsoft";case"macos_local":return"Mac";case"caldav":default:return"CalDAV"}}function Cc(e){const t=$t(e);if(!t)return null;try{const a=new URL(t),n=a.pathname.split("/").map(o=>o.trim()).filter(Boolean).at(-1);return n?`${a.host}/${decodeURIComponent(n)}`:a.host}catch{return t}}function Zr(e){const t=e.map($t).filter(a=>!!a);return t.length>0?t.join(" · "):null}function Rc(e){const t=[a=>a.providerLabel,a=>Zr([a.providerLabel,a.accountLabel]),a=>Zr([a.providerLabel,a.connectionLabel]),a=>a.connectionLabel,a=>a.accountLabel,a=>Cc(a.url),a=>a.url];for(const a of t){const s=e.map(a);if(s.some(o=>!$t(o)))continue;const n=s.map(o=>Gi(o));if(new Set(n).size===e.length)return s}return e.map((a,s)=>Zr([a.providerLabel,`${s+1}`])??`${s+1}`)}function Ji(e){const t=new Map,a=new Map;for(const s of e){const n=Gi(s.baseName),o=a.get(n)??[];o.push(s),a.set(n,o)}for(const s of a.values()){if(s.length===1){t.set(s[0].id,s[0].baseName);continue}const n=Rc(s);s.forEach((o,i)=>{t.set(o.id,`${o.baseName} (${n[i]})`)})}return t}function pr(e){const t=Ji(e.calendars.map(a=>({id:a.url,baseName:Mt(a.displayName),providerLabel:Vi(e.provider),connectionLabel:null,accountLabel:e.accountLabel,url:a.url})));return{...e,calendars:e.calendars.map(a=>({...a,dedupedName:t.get(a.url)??Mt(a.displayName)}))}}function _c(e,t){const a=new Map(t.map(n=>[n.id,n])),s=Ji(e.map(n=>{const o=a.get(n.connectionId);return{id:n.id,baseName:Mt(n.title),providerLabel:o?Vi(o.provider):null,connectionLabel:(o==null?void 0:o.label)??null,accountLabel:(o==null?void 0:o.accountLabel)??null,url:n.remoteId}}));return e.map(n=>({...n,dedupedName:s.get(n.id)??Mt(n.title)}))}function Ec(e){return{...e,calendars:_c(e.calendars,e.connections)}}function Ny(e){return"title"in e?$t(e.dedupedName)??Mt(e.title):$t(e.dedupedName)??Mt(e.displayName)}function Xi(e){const t=e.startsWith("/")?e:`/${e}`;return t.endsWith("/")?t:`${t}/`}function Ac(e){const t=Xi(e);return t==="/"?"/":t.endsWith("/")?t.slice(0,-1):t}function Lc(){return new URL(Xi("/forge/"),window.location.origin)}function Wa(e){if(e.startsWith("/api/"))return e;const t=e.startsWith("/")?e.slice(1):e;return new URL(t,Lc()).pathname}function fa(e,t=0){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"?e:typeof e=="bigint"?e.toString():e instanceof Error?{name:e.name,message:e.message,stack:e.stack??null}:Array.isArray(e)?t>=3?`[Array(${e.length})]`:e.slice(0,20).map(a=>fa(a,t+1)):e&&typeof e=="object"?t>=3?"[Object]":Object.fromEntries(Object.entries(e).slice(0,30).map(([a,s])=>[a,fa(s,t+1)])):String(e)}function Oc(e){return e?Object.fromEntries(Object.entries(e).map(([t,a])=>[t,fa(a)])):{}}async function Ur(e){try{await fetch(Wa("/api/v1/diagnostics/logs"),{method:"POST",credentials:"same-origin",keepalive:!0,headers:{"content-type":"application/json","x-forge-source":"ui"},body:JSON.stringify({...e,source:e.source??"ui",details:Oc(e.details)})})}catch{}}function Qi(e){return t=>Ur({...e,...t})}const Dc={allowWorkBlockKinds:[],blockWorkBlockKinds:[],allowCalendarIds:[],blockCalendarIds:[],allowEventTypes:[],blockEventTypes:[],allowEventKeywords:[],blockEventKeywords:[],allowAvailability:[],blockAvailability:[]};function mt(e){return{id:(e==null?void 0:e.id)??"",title:(e==null?void 0:e.title)??"",description:(e==null?void 0:e.description)??"",level:(e==null?void 0:e.level)??"task",status:(e==null?void 0:e.status)??"backlog",priority:(e==null?void 0:e.priority)??"medium",owner:(e==null?void 0:e.owner)??"Albert",goalId:(e==null?void 0:e.goalId)??null,projectId:(e==null?void 0:e.projectId)??null,parentWorkItemId:(e==null?void 0:e.parentWorkItemId)??null,dueDate:(e==null?void 0:e.dueDate)??null,effort:(e==null?void 0:e.effort)??"deep",energy:(e==null?void 0:e.energy)??"steady",points:(e==null?void 0:e.points)??0,plannedDurationSeconds:(e==null?void 0:e.plannedDurationSeconds)??null,schedulingRules:(e==null?void 0:e.schedulingRules)??null,sortOrder:(e==null?void 0:e.sortOrder)??0,resolutionKind:(e==null?void 0:e.resolutionKind)??null,splitParentTaskId:(e==null?void 0:e.splitParentTaskId)??null,aiInstructions:(e==null?void 0:e.aiInstructions)??"",executionMode:(e==null?void 0:e.executionMode)??null,acceptanceCriteria:(e==null?void 0:e.acceptanceCriteria)??[],blockerLinks:(e==null?void 0:e.blockerLinks)??[],completionReport:(e==null?void 0:e.completionReport)??null,gitRefs:(e==null?void 0:e.gitRefs)??[],completedAt:(e==null?void 0:e.completedAt)??null,createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),tagIds:(e==null?void 0:e.tagIds)??[],userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null,ownerUserId:(e==null?void 0:e.ownerUserId)??(e==null?void 0:e.userId)??null,ownerUser:(e==null?void 0:e.ownerUser)??(e==null?void 0:e.user)??null,assigneeUserIds:(e==null?void 0:e.assigneeUserIds)??[],assignees:(e==null?void 0:e.assignees)??[],time:(e==null?void 0:e.time)??{totalTrackedSeconds:0,totalCreditedSeconds:0,liveTrackedSeconds:0,liveCreditedSeconds:0,manualAdjustedSeconds:0,activeRunCount:0,hasCurrentRun:!1,currentRunId:null},actionPointSummary:(e==null?void 0:e.actionPointSummary)??{costBand:"standard",totalCostAp:100,expectedDurationSeconds:86400,sustainRateApPerHour:100/24,spentTodayAp:0,spentTotalAp:0,remainingAp:100},splitSuggestion:(e==null?void 0:e.splitSuggestion)??{shouldSplit:!1,reason:null,thresholdSeconds:2*86400}}}function ea(e){return{id:(e==null?void 0:e.id)??"",title:(e==null?void 0:e.title)??"",description:(e==null?void 0:e.description)??"",horizon:(e==null?void 0:e.horizon)==="quarter"||(e==null?void 0:e.horizon)==="lifetime"?e.horizon:"year",status:(e==null?void 0:e.status)==="paused"||(e==null?void 0:e.status)==="completed"?e.status:"active",targetPoints:(e==null?void 0:e.targetPoints)??0,themeColor:(e==null?void 0:e.themeColor)??"#c8a46b",createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),tagIds:(e==null?void 0:e.tagIds)??[],userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null}}function ta(e){return{id:(e==null?void 0:e.id)??"",name:(e==null?void 0:e.name)??"",kind:(e==null?void 0:e.kind)==="value"||(e==null?void 0:e.kind)==="execution"?e.kind:"category",color:(e==null?void 0:e.color)??"#71717a",description:(e==null?void 0:e.description)??"",userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null}}function ra(e){return{id:(e==null?void 0:e.id)??"",goalId:(e==null?void 0:e.goalId)??"",title:(e==null?void 0:e.title)??"",description:(e==null?void 0:e.description)??(e==null?void 0:e.summary)??"",status:(e==null?void 0:e.status)==="paused"||(e==null?void 0:e.status)==="completed"?e.status:"active",workflowStatus:(e==null?void 0:e.workflowStatus)??"backlog",targetPoints:(e==null?void 0:e.targetPoints)??(e==null?void 0:e.totalPoints)??0,themeColor:(e==null?void 0:e.themeColor)??"#c0c1ff",productRequirementsDocument:(e==null?void 0:e.productRequirementsDocument)??"",schedulingRules:(e==null?void 0:e.schedulingRules)??Dc,createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),goalTitle:(e==null?void 0:e.goalTitle)??"",activeTaskCount:(e==null?void 0:e.activeTaskCount)??0,completedTaskCount:(e==null?void 0:e.completedTaskCount)??0,totalTasks:(e==null?void 0:e.totalTasks)??0,earnedPoints:(e==null?void 0:e.earnedPoints)??(e==null?void 0:e.totalPoints)??0,progress:(e==null?void 0:e.progress)??0,nextTaskId:(e==null?void 0:e.nextTaskId)??null,nextTaskTitle:(e==null?void 0:e.nextTaskTitle)??null,momentumLabel:(e==null?void 0:e.momentumLabel)??"No momentum yet",userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null,ownerUserId:(e==null?void 0:e.ownerUserId)??(e==null?void 0:e.userId)??null,ownerUser:(e==null?void 0:e.ownerUser)??(e==null?void 0:e.user)??null,assigneeUserIds:(e==null?void 0:e.assigneeUserIds)??[],assignees:(e==null?void 0:e.assignees)??[],time:(e==null?void 0:e.time)??{totalTrackedSeconds:0,totalCreditedSeconds:0,liveTrackedSeconds:0,liveCreditedSeconds:0,manualAdjustedSeconds:0,activeRunCount:0,hasCurrentRun:!1,currentRunId:null}}}function br(e){return{id:(e==null?void 0:e.id)??"",title:(e==null?void 0:e.title)??"",description:(e==null?void 0:e.description)??"",status:(e==null?void 0:e.status)??"active",polarity:(e==null?void 0:e.polarity)??"positive",frequency:(e==null?void 0:e.frequency)??"daily",targetCount:(e==null?void 0:e.targetCount)??1,weekDays:(e==null?void 0:e.weekDays)??[],linkedGoalIds:(e==null?void 0:e.linkedGoalIds)??[],linkedProjectIds:(e==null?void 0:e.linkedProjectIds)??[],linkedTaskIds:(e==null?void 0:e.linkedTaskIds)??[],linkedValueIds:(e==null?void 0:e.linkedValueIds)??[],linkedPatternIds:(e==null?void 0:e.linkedPatternIds)??[],linkedBehaviorIds:(e==null?void 0:e.linkedBehaviorIds)??[],linkedBeliefIds:(e==null?void 0:e.linkedBeliefIds)??[],linkedModeIds:(e==null?void 0:e.linkedModeIds)??[],linkedReportIds:(e==null?void 0:e.linkedReportIds)??[],linkedBehaviorId:(e==null?void 0:e.linkedBehaviorId)??null,linkedBehaviorTitle:(e==null?void 0:e.linkedBehaviorTitle)??null,linkedBehaviorTitles:(e==null?void 0:e.linkedBehaviorTitles)??[],rewardXp:(e==null?void 0:e.rewardXp)??12,penaltyXp:(e==null?void 0:e.penaltyXp)??8,generatedHealthEventTemplate:(e==null?void 0:e.generatedHealthEventTemplate)??{enabled:!1,workoutType:"",title:"",durationMinutes:60,xpReward:0,tags:[],links:[],notesTemplate:""},createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),lastCheckInAt:(e==null?void 0:e.lastCheckInAt)??null,lastCheckInStatus:(e==null?void 0:e.lastCheckInStatus)??null,streakCount:(e==null?void 0:e.streakCount)??0,completionRate:(e==null?void 0:e.completionRate)??0,dueToday:(e==null?void 0:e.dueToday)??!1,userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null,checkIns:(e==null?void 0:e.checkIns)??[]}}function Hn(e){return{id:(e==null?void 0:e.id)??"",kind:(e==null?void 0:e.kind)??"human",handle:(e==null?void 0:e.handle)??"",displayName:(e==null?void 0:e.displayName)??"",description:(e==null?void 0:e.description)??"",accentColor:(e==null?void 0:e.accentColor)??"#c0c1ff",createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString()}}function $c(e){return{id:(e==null?void 0:e.id)??"",title:(e==null?void 0:e.title)??"",overview:(e==null?void 0:e.overview)??"",endStateDescription:(e==null?void 0:e.endStateDescription)??"",status:(e==null?void 0:e.status)==="paused"||(e==null?void 0:e.status)==="completed"?e.status:"active",targetGoalIds:(e==null?void 0:e.targetGoalIds)??[],targetProjectIds:(e==null?void 0:e.targetProjectIds)??[],linkedEntities:(e==null?void 0:e.linkedEntities)??[],graph:(e==null?void 0:e.graph)??{nodes:[],edges:[]},metrics:(e==null?void 0:e.metrics)??{alignmentScore:0,planCoverageScore:0,sequencingScore:100,scopeDisciplineScore:100,qualityScore:0,targetProgressScore:0,completedNodeCount:0,startedNodeCount:0,readyNodeCount:0,totalNodeCount:1,completedTargetCount:0,totalTargetCount:0,offPlanEntityCount:0,offPlanActiveEntityCount:0,offPlanCompletedEntityCount:0,activeNodeIds:[],nextNodeIds:[],blockedNodeIds:[],outOfOrderNodeIds:[]},isLocked:(e==null?void 0:e.isLocked)??!1,lockedAt:(e==null?void 0:e.lockedAt)??null,lockedByUserId:(e==null?void 0:e.lockedByUserId)??null,lockedByUser:(e==null?void 0:e.lockedByUser)??null,createdAt:(e==null?void 0:e.createdAt)??new Date(0).toISOString(),updatedAt:(e==null?void 0:e.updatedAt)??new Date(0).toISOString(),userId:(e==null?void 0:e.userId)??null,user:(e==null?void 0:e.user)??null}}function Mc(e){var o,i,l,u,p,m,g,f,v,y,_,h,w,P,x,$,S,F,N,E,T,z,ee,ne,ie,V,k,M,oe,ae,C,J,O,Y,A,Z,pe,Oe,Ae,Te,ye,be,Ie,we,Ke,ze,ut,ce,tt,je,Ge,L,X,R,q,re,We,rt,Gt,Ct,Vt,Jt,Xt,Qt,Yt,Zt,I,D,Q,qe,Rt,it,kt,_t,Es,As,Ls,Os,Ds,$s,Ms,Fs,zs,Ws,qs,Bs,Ks,Hs,Us,Gs,Vs,Js,Xs,Qs,Ys,Zs,en,tn,rn,an,sn,nn,on,ln,cn,dn,un,mn,pn,hn,gn,fn,yn,xn,vn,bn,wn,kn,jn,Sn,Nn,Pn,Tn,In,Cn,Rn,_n,En,An,Ln,On,Dn,$n;const t=e,a=(t.projects??t.campaigns??[]).map(ra),s=(((o=t.dashboard)==null?void 0:o.projects)??((i=t.dashboard)==null?void 0:i.campaigns)??a).map(ra),n=(((l=t.overview)==null?void 0:l.projects)??((u=t.overview)==null?void 0:u.campaigns)??s).map(ra);return{...e,meta:{apiVersion:"v1",transport:"rest+sse",generatedAt:((p=e.meta)==null?void 0:p.generatedAt)??new Date().toISOString(),backend:((m=e.meta)==null?void 0:m.backend)??"forge-node-runtime",mode:((g=e.meta)==null?void 0:g.mode)??"transitional-node"},metrics:{totalXp:((f=e.metrics)==null?void 0:f.totalXp)??0,level:((v=e.metrics)==null?void 0:v.level)??1,currentLevelXp:((y=e.metrics)==null?void 0:y.currentLevelXp)??0,nextLevelXp:((_=e.metrics)==null?void 0:_.nextLevelXp)??120,xpIntoLevel:((h=e.metrics)==null?void 0:h.xpIntoLevel)??((w=e.metrics)==null?void 0:w.currentLevelXp)??0,xpToNextLevel:((P=e.metrics)==null?void 0:P.xpToNextLevel)??((x=e.metrics)==null?void 0:x.nextLevelXp)??120,currentLevelStartXp:(($=e.metrics)==null?void 0:$.currentLevelStartXp)??0,nextLevelTotalXp:((S=e.metrics)==null?void 0:S.nextLevelTotalXp)??(((F=e.metrics)==null?void 0:F.totalXp)??0)+(((N=e.metrics)==null?void 0:N.nextLevelXp)??120),levelCurveVersion:((E=e.metrics)==null?void 0:E.levelCurveVersion)??"legacy-linear-120",weeklyXp:((T=e.metrics)==null?void 0:T.weeklyXp)??0,streakDays:((z=e.metrics)==null?void 0:z.streakDays)??0,comboMultiplier:((ee=e.metrics)==null?void 0:ee.comboMultiplier)??1,momentumScore:((ne=e.metrics)==null?void 0:ne.momentumScore)??0,topGoalId:((ie=e.metrics)==null?void 0:ie.topGoalId)??null,topGoalTitle:((V=e.metrics)==null?void 0:V.topGoalTitle)??null},users:(e.users??[]).map(Hn),strategies:(e.strategies??[]).map($c),userScope:{selectedUserIds:((k=e.userScope)==null?void 0:k.selectedUserIds)??[],selectedUsers:(((M=e.userScope)==null?void 0:M.selectedUsers)??[]).map(Hn)},dashboard:{stats:{totalPoints:((ae=(oe=e.dashboard)==null?void 0:oe.stats)==null?void 0:ae.totalPoints)??0,completedThisWeek:((J=(C=e.dashboard)==null?void 0:C.stats)==null?void 0:J.completedThisWeek)??0,activeGoals:((Y=(O=e.dashboard)==null?void 0:O.stats)==null?void 0:Y.activeGoals)??0,alignmentScore:((Z=(A=e.dashboard)==null?void 0:A.stats)==null?void 0:Z.alignmentScore)??0,focusTasks:((Oe=(pe=e.dashboard)==null?void 0:pe.stats)==null?void 0:Oe.focusTasks)??0,overdueTasks:((Te=(Ae=e.dashboard)==null?void 0:Ae.stats)==null?void 0:Te.overdueTasks)??0,dueThisWeek:((be=(ye=e.dashboard)==null?void 0:ye.stats)==null?void 0:be.dueThisWeek)??0},goals:(((Ie=e.dashboard)==null?void 0:Ie.goals)??[]).map(Ve=>({...Ve,...ea(Ve)})),projects:s,tasks:(((we=e.dashboard)==null?void 0:we.tasks)??[]).map(mt),habits:(((Ke=e.dashboard)==null?void 0:Ke.habits)??e.habits??[]).map(br),tags:(((ze=e.dashboard)==null?void 0:ze.tags)??[]).map(ta),suggestedTags:(((ut=e.dashboard)==null?void 0:ut.suggestedTags)??[]).map(ta),owners:((ce=e.dashboard)==null?void 0:ce.owners)??[],executionBuckets:(((tt=e.dashboard)==null?void 0:tt.executionBuckets)??[]).map(Ve=>({...Ve,tasks:(Ve.tasks??[]).map(mt)})),gamification:((je=e.dashboard)==null?void 0:je.gamification)??{totalXp:((Ge=e.metrics)==null?void 0:Ge.totalXp)??0,level:((L=e.metrics)==null?void 0:L.level)??1,currentLevelXp:((X=e.metrics)==null?void 0:X.currentLevelXp)??0,nextLevelXp:((R=e.metrics)==null?void 0:R.nextLevelXp)??120,xpIntoLevel:((q=e.metrics)==null?void 0:q.xpIntoLevel)??((re=e.metrics)==null?void 0:re.currentLevelXp)??0,xpToNextLevel:((We=e.metrics)==null?void 0:We.xpToNextLevel)??((rt=e.metrics)==null?void 0:rt.nextLevelXp)??120,currentLevelStartXp:((Gt=e.metrics)==null?void 0:Gt.currentLevelStartXp)??0,nextLevelTotalXp:((Ct=e.metrics)==null?void 0:Ct.nextLevelTotalXp)??(((Vt=e.metrics)==null?void 0:Vt.totalXp)??0)+(((Jt=e.metrics)==null?void 0:Jt.nextLevelXp)??120),levelCurveVersion:((Xt=e.metrics)==null?void 0:Xt.levelCurveVersion)??"legacy-linear-120",weeklyXp:((Qt=e.metrics)==null?void 0:Qt.weeklyXp)??0,streakDays:((Yt=e.metrics)==null?void 0:Yt.streakDays)??0,comboMultiplier:((Zt=e.metrics)==null?void 0:Zt.comboMultiplier)??1,momentumScore:((I=e.metrics)==null?void 0:I.momentumScore)??0,topGoalId:((D=e.metrics)==null?void 0:D.topGoalId)??null,topGoalTitle:((Q=e.metrics)==null?void 0:Q.topGoalTitle)??null},achievements:((qe=e.dashboard)==null?void 0:qe.achievements)??[],milestoneRewards:((Rt=e.dashboard)==null?void 0:Rt.milestoneRewards)??[],recentActivity:((it=e.dashboard)==null?void 0:it.recentActivity)??[],notesSummaryByEntity:((kt=e.dashboard)==null?void 0:kt.notesSummaryByEntity)??{}},overview:{generatedAt:((_t=e.overview)==null?void 0:_t.generatedAt)??new Date().toISOString(),strategicHeader:{streakDays:((As=(Es=e.overview)==null?void 0:Es.strategicHeader)==null?void 0:As.streakDays)??((Ls=e.metrics)==null?void 0:Ls.streakDays)??0,level:((Ds=(Os=e.overview)==null?void 0:Os.strategicHeader)==null?void 0:Ds.level)??(($s=e.metrics)==null?void 0:$s.level)??1,totalXp:((Fs=(Ms=e.overview)==null?void 0:Ms.strategicHeader)==null?void 0:Fs.totalXp)??((zs=e.metrics)==null?void 0:zs.totalXp)??0,currentLevelXp:((qs=(Ws=e.overview)==null?void 0:Ws.strategicHeader)==null?void 0:qs.currentLevelXp)??((Bs=e.metrics)==null?void 0:Bs.currentLevelXp)??0,nextLevelXp:((Hs=(Ks=e.overview)==null?void 0:Ks.strategicHeader)==null?void 0:Hs.nextLevelXp)??((Us=e.metrics)==null?void 0:Us.nextLevelXp)??120,momentumScore:((Vs=(Gs=e.overview)==null?void 0:Gs.strategicHeader)==null?void 0:Vs.momentumScore)??((Js=e.metrics)==null?void 0:Js.momentumScore)??0,focusTasks:((Qs=(Xs=e.overview)==null?void 0:Xs.strategicHeader)==null?void 0:Qs.focusTasks)??0,overdueTasks:((Zs=(Ys=e.overview)==null?void 0:Ys.strategicHeader)==null?void 0:Zs.overdueTasks)??0},projects:n,activeGoals:(((en=e.overview)==null?void 0:en.activeGoals)??[]).map(Ve=>({...Ve,...ea(Ve)})),topTasks:(((tn=e.overview)==null?void 0:tn.topTasks)??[]).map(mt),dueHabits:(((rn=e.overview)==null?void 0:rn.dueHabits)??((an=e.today)==null?void 0:an.dueHabits)??((sn=e.dashboard)==null?void 0:sn.habits)??[]).map(br),recentEvidence:((nn=e.overview)==null?void 0:nn.recentEvidence)??[],achievements:((on=e.overview)==null?void 0:on.achievements)??[],domainBalance:((ln=e.overview)==null?void 0:ln.domainBalance)??[],neglectedGoals:((cn=e.overview)==null?void 0:cn.neglectedGoals)??[]},today:{generatedAt:((dn=e.today)==null?void 0:dn.generatedAt)??new Date().toISOString(),directive:{task:(mn=(un=e.today)==null?void 0:un.directive)!=null&&mn.task?mt(e.today.directive.task):null,goalTitle:((hn=(pn=e.today)==null?void 0:pn.directive)==null?void 0:hn.goalTitle)??null,rewardXp:((fn=(gn=e.today)==null?void 0:gn.directive)==null?void 0:fn.rewardXp)??0,sessionLabel:((xn=(yn=e.today)==null?void 0:yn.directive)==null?void 0:xn.sessionLabel)??"No active session"},timeline:(((vn=e.today)==null?void 0:vn.timeline)??[]).map(Ve=>({...Ve,tasks:(Ve.tasks??[]).map(mt)})),dueHabits:(((bn=e.today)==null?void 0:bn.dueHabits)??((wn=e.overview)==null?void 0:wn.dueHabits)??((kn=e.dashboard)==null?void 0:kn.habits)??[]).map(br),dailyQuests:((jn=e.today)==null?void 0:jn.dailyQuests)??[],milestoneRewards:((Sn=e.today)==null?void 0:Sn.milestoneRewards)??[],recentHabitRewards:((Nn=e.today)==null?void 0:Nn.recentHabitRewards)??[],momentum:{streakDays:((Tn=(Pn=e.today)==null?void 0:Pn.momentum)==null?void 0:Tn.streakDays)??0,momentumScore:((Cn=(In=e.today)==null?void 0:In.momentum)==null?void 0:Cn.momentumScore)??0,recoveryHint:((_n=(Rn=e.today)==null?void 0:Rn.momentum)==null?void 0:_n.recoveryHint)??""}},risk:{generatedAt:((En=e.risk)==null?void 0:En.generatedAt)??new Date().toISOString(),overdueTasks:(((An=e.risk)==null?void 0:An.overdueTasks)??[]).map(mt),blockedTasks:(((Ln=e.risk)==null?void 0:Ln.blockedTasks)??[]).map(mt),neglectedGoals:((On=e.risk)==null?void 0:On.neglectedGoals)??[],summary:((Dn=e.risk)==null?void 0:Dn.summary)??""},goals:(e.goals??[]).map(ea),projects:a,tags:(e.tags??[]).map(ta),tasks:(e.tasks??[]).map(mt),habits:(e.habits??(($n=e.dashboard)==null?void 0:$n.habits)??[]).map(br),activity:e.activity??[],activeTaskRuns:e.activeTaskRuns??[],lifeForce:e.lifeForce??{userId:"",dateKey:new Date().toISOString().slice(0,10),baselineDailyAp:200,dailyBudgetAp:200,spentTodayAp:0,remainingAp:200,forecastAp:0,plannedRemainingAp:0,targetBandMinAp:170,targetBandMaxAp:200,instantCapacityApPerHour:0,instantFreeApPerHour:0,overloadApPerHour:0,currentDrainApPerHour:0,fatigueBufferApPerHour:0,sleepRecoveryMultiplier:1,readinessMultiplier:1,fatigueDebtCarry:0,stats:[],currentCurve:[],activeDrains:[],plannedDrains:[],warnings:[],recommendations:[],topTaskIdsNeedingSplit:[],updatedAt:new Date(0).toISOString()}}}function qa(e){const t=typeof e.location=="string"?e.location:"",a=e.place??{label:t,address:"",timezone:"",latitude:null,longitude:null,source:"",externalPlaceId:""};return{...e,place:{label:a.label||t,address:a.address??"",timezone:a.timezone??"",latitude:a.latitude??null,longitude:a.longitude??null,source:a.source??"",externalPlaceId:a.externalPlaceId??""}}}function Fc(e){return{...Ec(e),events:e.events.map(qa)}}async function ya(e){const t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}const zc="/api/v1/diagnostics/logs",Nr="/api/v1/auth/operator-session",Wc="x-forge-source",qc="ui";function Ba(e){return typeof e=="object"&&e!==null?e:null}function Ka(e){const t=Ba(e);return typeof(t==null?void 0:t.code)=="string"?t.code:typeof(t==null?void 0:t.error)=="string"?t.error:"request_failed"}function Bc(e,t){return e.status===401&&Ka(t)==="auth_required"}function Yi(e){return e===zc}function Kc(e){return!!((e==null?void 0:e.body)===void 0||e.body===null||typeof e.body=="string"||typeof URLSearchParams<"u"&&e.body instanceof URLSearchParams||typeof FormData<"u"&&e.body instanceof FormData||typeof Blob<"u"&&e.body instanceof Blob||typeof ArrayBuffer<"u"&&e.body instanceof ArrayBuffer||ArrayBuffer.isView(e.body))}function Zi(e){return e.path!==Nr&&Bc(e.response,e.body)&&Kc(e.init)}function Ha(e,t,a){const s=Ba(a),n=Array.isArray(s==null?void 0:s.details)?s.details:[];return new Er({status:t.status,code:Ka(a),message:typeof(s==null?void 0:s.error)=="string"?s.error:typeof(s==null?void 0:s.message)=="string"?s.message:typeof a=="string"?a:`Request failed: ${t.status}`,requestPath:e,details:n,response:typeof a=="string"||a&&typeof a=="object"?a:null})}function Ua(e,t,a){if(Yi(e))return;const s=Ba(a),n=Array.isArray(s==null?void 0:s.details)?s.details:[];Ur({level:t.status>=500?"error":"warning",scope:"frontend_api",eventKey:"request_failed",message:`API request failed: ${e}`,route:e,functionName:"request",details:{statusCode:t.status,code:Ka(a),response:typeof a=="string"||a&&typeof a=="object"?a:null,validationIssues:n}})}async function xa(e,t){const a=await va(e,t),s=await ya(a);return{response:a,body:s}}async function va(e,t){const a=new Headers(t==null?void 0:t.headers);a.set(Wc,qc),(t==null?void 0:t.body)!==void 0&&!(typeof FormData<"u"&&t.body instanceof FormData)&&!a.has("content-type")&&a.set("content-type","application/json");let s;try{s=await fetch(Wa(e),{...t,credentials:"same-origin",headers:a})}catch(n){throw Yi(e)||Ur({level:"error",scope:"frontend_api",eventKey:"request_network_failure",message:`API request failed before reaching Forge: ${e}`,route:e,functionName:"request",details:{error:n instanceof Error?{name:n.name,message:n.message,stack:n.stack??null}:String(n)}}),n}return s}let wr=null;async function eo(){wr||(wr=(async()=>{const{response:e,body:t}=await xa(Nr);if(!e.ok)throw Ua(Nr,e,t),Ha(Nr,e,t)})().finally(()=>{wr=null})),await wr}async function d(e,t){let{response:a,body:s}=await xa(e,t);if(Zi({path:e,init:t,response:a,body:s})&&(await eo(),{response:a,body:s}=await xa(e,t)),!a.ok)throw Ua(e,a,s),Ha(e,a,s);return s}async function to(e,t){let a=await va(e,t),s=null;if(a.ok||(s=await ya(a)),Zi({path:e,init:t,response:a,body:s})&&(await eo(),a=await va(e,t),s=a.ok?null:await ya(a)),!a.ok)throw Ua(e,a,s),Ha(e,a,s);const n=a.headers.get("content-disposition"),o=n==null?void 0:n.match(/filename=\"([^\"]+)\"/i);return{blob:await a.blob(),fileName:(o==null?void 0:o[1])??null,mimeType:a.headers.get("content-type")||"application/octet-stream"}}function Gr(e){return e.map(t=>({contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null})).filter(t=>t.contentMarkdown.length>0)}const Hc="forge.selected-user-ids";function Uc(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Hc);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean):[]}catch{return[]}}function Gc(e){return e??Uc()}function H(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):void 0}function K(e,t){for(const a of Gc(t))a.trim()&&e.append("userIds",a.trim())}function Vc(){return d("/api/v1/auth/operator-session")}function Jc(){return d("/api/v1/auth/operator-session",{method:"DELETE"})}function Xc(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/context${a}`).then(Mc)}function Py(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/life-force${a}`)}function Ty(e,t,a){const s=new URLSearchParams;K(s,H(a));const n=s.size>0?`?${s.toString()}`:"";return d(`/api/v1/life-force/templates/${e}${n}`,{method:"PUT",body:JSON.stringify(t)})}function Iy(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/life-force/fatigue-signals${s}`,{method:"POST",body:JSON.stringify(e)})}function Cy(e,t){var n;const a=new URLSearchParams;K(a,H(e)),(n=t==null?void 0:t.q)!=null&&n.trim()&&a.set("q",t.q.trim());for(const o of(t==null?void 0:t.entityKinds)??[])a.append("entityKind",o);for(const o of(t==null?void 0:t.relationKinds)??[])a.append("relationKind",o);for(const o of(t==null?void 0:t.tags)??[])a.append("tag",o);for(const o of(t==null?void 0:t.owners)??[])a.append("owner",o);t!=null&&t.updatedFrom&&a.set("updatedFrom",t.updatedFrom),t!=null&&t.updatedTo&&a.set("updatedTo",t.updatedTo),typeof(t==null?void 0:t.limit)=="number"&&Number.isFinite(t.limit)&&a.set("limit",String(t.limit)),t!=null&&t.focusNodeId&&a.set("focusNodeId",t.focusNodeId);const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/knowledge-graph${s}`).then(o=>o.graph)}function Ry(e){const t=new URLSearchParams;e.userId&&t.set("userId",e.userId),e.domain&&t.set("domain",e.domain),e.contextId&&t.set("contextId",e.contextId);const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/preferences/workspace${a}`)}function _y(e){return d("/api/v1/preferences/game/start",{method:"POST",body:JSON.stringify(e)})}function Ey(e){return d("/api/v1/preferences/catalogs",{method:"POST",body:JSON.stringify(e)})}function Ay(e,t){return d(`/api/v1/preferences/catalogs/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Ly(e){return d(`/api/v1/preferences/catalogs/${e}`,{method:"DELETE"})}function Oy(e){return d("/api/v1/preferences/catalog-items",{method:"POST",body:JSON.stringify(e)})}function Dy(e,t){return d(`/api/v1/preferences/catalog-items/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function $y(e){return d(`/api/v1/preferences/catalog-items/${e}`,{method:"DELETE"})}function My(e){return d("/api/v1/preferences/contexts",{method:"POST",body:JSON.stringify(e)})}function Fy(e,t){return d(`/api/v1/preferences/contexts/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function zy(e){return d("/api/v1/preferences/contexts/merge",{method:"POST",body:JSON.stringify(e)})}function Wy(e){return d("/api/v1/preferences/items",{method:"POST",body:JSON.stringify(e)})}function qy(e,t){return d(`/api/v1/preferences/items/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function By(e){return d("/api/v1/preferences/items/from-entity",{method:"POST",body:JSON.stringify(e)})}function Ky(e){return d("/api/v1/preferences/judgments",{method:"POST",body:JSON.stringify(e)})}function Hy(e){return d("/api/v1/preferences/signals",{method:"POST",body:JSON.stringify(e)})}function Uy(e,t){return d(`/api/v1/preferences/items/${e}/score`,{method:"PATCH",body:JSON.stringify(t)})}function Gy(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/insights${a}`)}function Vy(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/overview${a}`)}function Jy(){return d("/api/v1/psyche/metrics")}function Xy(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/questionnaires${a}`)}function Qy(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/psyche/questionnaires/${e}${s}`)}function Yy(e){return d("/api/v1/psyche/questionnaires",{method:"POST",body:JSON.stringify(e)})}function Zy(e,t={}){return d(`/api/v1/psyche/questionnaires/${e}/clone`,{method:"POST",body:JSON.stringify(t)})}function ex(e){return d(`/api/v1/psyche/questionnaires/${e}/draft`,{method:"POST",body:JSON.stringify({})})}function tx(e,t){return d(`/api/v1/psyche/questionnaires/${e}/draft`,{method:"PATCH",body:JSON.stringify(t)})}function rx(e,t={}){return d(`/api/v1/psyche/questionnaires/${e}/publish`,{method:"POST",body:JSON.stringify(t)})}function ax(e,t={}){return d(`/api/v1/psyche/questionnaires/${e}/runs`,{method:"POST",body:JSON.stringify(t)})}function sx(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/psyche/questionnaire-runs/${e}${s}`)}function nx(e,t){return d(`/api/v1/psyche/questionnaire-runs/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function ix(e){return d(`/api/v1/psyche/questionnaire-runs/${e}/complete`,{method:"POST",body:JSON.stringify({})})}function Qc(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/values${a}`)}function ox(e){return d("/api/v1/psyche/values",{method:"POST",body:JSON.stringify(e)})}function lx(e,t){return d(`/api/v1/psyche/values/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Yc(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/patterns${a}`)}function cx(e){return d("/api/v1/psyche/patterns",{method:"POST",body:JSON.stringify(e)})}function dx(e,t){return d(`/api/v1/psyche/patterns/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Zc(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/behaviors${a}`)}function ux(e){return d("/api/v1/psyche/behaviors",{method:"POST",body:JSON.stringify(e)})}function mx(e,t){return d(`/api/v1/psyche/behaviors/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function px(){return d("/api/v1/psyche/schema-catalog")}function ed(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/beliefs${a}`)}function hx(e){return d("/api/v1/psyche/beliefs",{method:"POST",body:JSON.stringify(e)})}function gx(e,t){return d(`/api/v1/psyche/beliefs/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function fx(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/modes${a}`)}function yx(e){return d("/api/v1/psyche/modes",{method:"POST",body:JSON.stringify(e)})}function xx(e,t){return d(`/api/v1/psyche/modes/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function vx(){return d("/api/v1/psyche/mode-guides")}function bx(e){return d("/api/v1/psyche/mode-guides",{method:"POST",body:JSON.stringify(e)})}function Ga(e){if(e.ok!==!0||!e.entity){const t=typeof e.error=="object"&&e.error!==null?JSON.stringify(e.error):"Batch entity operation failed.";throw new Error(t)}return e.entity}async function wx(e){var s;return{flashcards:((s=(await no({searches:[{entityTypes:["flashcard"],userIds:H(e),limit:200}]})).results[0])==null?void 0:s.matches)??[]}}async function kx(e){const t=await kd({operations:[{entityType:"flashcard",data:e}],atomic:!0});return{flashcard:Ga(t.results[0]??{})}}async function jx(e,t){const a=await jd({operations:[{entityType:"flashcard",id:e,patch:t}],atomic:!0});return{flashcard:Ga(a.results[0]??{})}}async function Sx(e){const t=await Sd({operations:[{entityType:"flashcard",id:e}],atomic:!0});return{flashcard:Ga(t.results[0]??{})}}function Nx(){return d("/api/v1/psyche/event-types")}function Px(){return d("/api/v1/psyche/emotions")}function td(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/reports${a}`)}function Tx(e){return d("/api/v1/psyche/reports",{method:"POST",body:JSON.stringify(e)})}function Ix(e){return d(`/api/v1/psyche/reports/${e}`)}function Cx(e,t){return d(`/api/v1/psyche/reports/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Rx(e={}){const t=new URLSearchParams;e.linkedEntityType&&t.set("linkedEntityType",e.linkedEntityType),e.linkedEntityId&&t.set("linkedEntityId",e.linkedEntityId),e.anchorKey!==void 0&&e.anchorKey!==null&&t.set("anchorKey",e.anchorKey);for(const s of e.linkedTo??[])t.append("linkedTo",`${s.entityType}:${s.entityId}`);for(const s of e.tags??[])s.trim()&&t.append("tags",s.trim());for(const s of e.textTerms??[])s.trim()&&t.append("textTerms",s.trim());e.author&&t.set("author",e.author),e.query&&t.set("query",e.query),K(t,e.userIds),e.updatedFrom&&t.set("updatedFrom",e.updatedFrom),e.updatedTo&&t.set("updatedTo",e.updatedTo),e.limit&&t.set("limit",String(e.limit));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/notes${a}`)}function rd(e){return d("/api/v1/notes",{method:"POST",body:JSON.stringify(e)})}function _x(e){return d(`/api/v1/notes/${e}`)}function Ex(e,t){return d(`/api/v1/notes/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Ax(e,t="soft"){const a=t==="soft"?"":`?mode=${t}`;return d(`/api/v1/notes/${e}${a}`,{method:"DELETE"})}function Lx(){return d("/api/v1/wiki/settings")}function Ox(e){return d("/api/v1/wiki/spaces",{method:"POST",body:JSON.stringify(e)})}function Dx(e={}){const t=new URLSearchParams;e.spaceId&&t.set("spaceId",e.spaceId),e.kind&&t.set("kind",e.kind),e.limit&&t.set("limit",String(e.limit));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/wiki/pages${a}`)}function $x(e){return d(`/api/v1/wiki/pages/${e}`)}function Mx(e={}){var a;const t=new URLSearchParams;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),d(`/api/v1/wiki/home${t.size>0?`?${t.toString()}`:""}`)}function Fx(e){var a;const t=new URLSearchParams;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),d(`/api/v1/wiki/by-slug/${encodeURIComponent(e.slug)}${t.size>0?`?${t.toString()}`:""}`)}function zx(e={}){var a;const t=new URLSearchParams;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),e.kind&&t.set("kind",e.kind),d(`/api/v1/wiki/tree${t.size>0?`?${t.toString()}`:""}`)}function ad(e){return d("/api/v1/wiki/pages",{method:"POST",body:JSON.stringify({kind:e.kind??"wiki",title:e.title,slug:e.slug??"",parentSlug:e.parentSlug??null,indexOrder:e.indexOrder??0,showInIndex:e.showInIndex??!0,aliases:e.aliases??[],summary:e.summary??"",contentMarkdown:e.contentMarkdown,author:e.author??null,tags:e.tags??[],spaceId:e.spaceId??"",frontmatter:e.frontmatter??{},links:e.links??[]})})}function Wx(e,t){return d(`/api/v1/wiki/pages/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function qx(e,t="soft"){const a=new URLSearchParams;return a.set("mode",t),d(`/api/v1/wiki/pages/${e}?${a.toString()}`,{method:"DELETE"})}function Bx(e){return d("/api/v1/wiki/search",{method:"POST",body:JSON.stringify(e)})}function Kx(e={}){return d("/api/v1/wiki/sync",{method:"POST",body:JSON.stringify(e)})}function Hx(e={}){return d("/api/v1/wiki/reindex",{method:"POST",body:JSON.stringify(e)})}function Ux(e){return d("/api/v1/wiki/settings/embedding-profiles",{method:"POST",body:JSON.stringify(e)})}function Gx(e,t){return d(`/api/v1/wiki/settings/${e}-profiles/${t}`,{method:"DELETE"})}function Vx(e){return d("/api/v1/wiki/ingest-jobs",{method:"POST",body:JSON.stringify(e)})}function Jx(e){var a,s,n;const t=new FormData;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),(s=e.titleHint)!=null&&s.trim()&&t.set("titleHint",e.titleHint.trim()),(n=e.llmProfileId)!=null&&n.trim()&&t.set("llmProfileId",e.llmProfileId.trim()),t.set("parseStrategy",e.parseStrategy??"auto"),t.set("entityProposalMode",e.entityProposalMode??"suggest"),t.set("createAsKind",e.createAsKind??"wiki"),t.set("linkedEntityHints",JSON.stringify(e.linkedEntityHints??[])),e.files.forEach(o=>{t.append("files",o)}),d("/api/v1/wiki/ingest-jobs/uploads",{method:"POST",body:t})}function sd(e={}){var a;const t=new URLSearchParams;return(a=e.spaceId)!=null&&a.trim()&&t.set("spaceId",e.spaceId.trim()),typeof e.limit=="number"&&t.set("limit",String(e.limit)),d(`/api/v1/wiki/ingest-jobs${t.size>0?`?${t.toString()}`:""}`)}function Xx(e){return d(`/api/v1/wiki/ingest-jobs/${e}`)}function Qx(e){return d("/api/v1/wiki/search",{method:"POST",body:JSON.stringify({spaceId:e.spaceId,kind:e.kind,mode:e.mode??"text",query:e.query??"",profileId:e.profileId,limit:e.limit??8})})}function Yx(e){return d(`/api/v1/wiki/ingest-jobs/${e}`,{method:"DELETE"})}function Zx(e){return d(`/api/v1/wiki/ingest-jobs/${e}/rerun`,{method:"POST"})}function ev(e){return d(`/api/v1/wiki/ingest-jobs/${e}/resume`,{method:"POST"})}function tv(e){return d(`/api/v1/wiki/ingest-jobs/${e.jobId}/review`,{method:"POST",body:JSON.stringify({decisions:e.decisions})})}function rv(e){return d("/api/v1/insights",{method:"POST",body:JSON.stringify({...e,originAgentId:e.originAgentId||null,originLabel:e.originLabel||null,entityType:e.entityType||null,entityId:e.entityId||null,timeframeLabel:e.timeframeLabel||null,visibility:"visible",status:"open",evidence:[]})})}function av(e){return d(`/api/v1/insights/${e}`,{method:"DELETE"})}function sv(e,t,a=""){return d(`/api/v1/insights/${e}/feedback`,{method:"POST",body:JSON.stringify({feedbackType:t,note:a})})}function nv(){return d("/api/v1/reviews/weekly")}function iv(){return d("/api/v1/reviews/weekly/finalize",{method:"POST"})}function ov(e={}){const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),K(t,H(e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/calendar/overview${a}`).then(s=>({...s,calendar:Fc(s.calendar)}))}function lv(e={}){const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),K(t,H(e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/psyche/self-observation/calendar${a}`)}function cv(e){var a;const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),(a=e.search)!=null&&a.trim()&&t.set("search",e.search.trim()),e.includeObservations!==void 0&&t.set("includeObservations",String(e.includeObservations)),e.includeActivity!==void 0&&t.set("includeActivity",String(e.includeActivity)),e.onlyHumanOwned!==void 0&&t.set("onlyHumanOwned",String(e.onlyHumanOwned));for(const s of e.tags??[]){const n=s.trim();n&&t.append("tags",n)}return t.set("format",e.format),K(t,H(e.userIds)),to(`/api/v1/psyche/self-observation/calendar/export?${t.toString()}`)}function dv(){return d("/api/v1/calendar/connections")}function uv(e){return d("/api/v1/calendar/discovery",{method:"POST",body:JSON.stringify(e)}).then(t=>({...t,discovery:pr(t.discovery)}))}function mv(){return d("/api/v1/calendar/macos-local/status")}function pv(){return d("/api/v1/calendar/macos-local/request-access",{method:"POST"})}function hv(){return d("/api/v1/calendar/macos-local/discovery").then(e=>({...e,discovery:{...e.discovery,sources:e.discovery.sources.map(t=>({...t,calendars:pr({provider:"macos_local",accountLabel:t.accountLabel,serverUrl:"forge-macos-local://eventkit/",principalUrl:null,homeUrl:null,calendars:t.calendars}).calendars}))}}))}function gv(e){return d("/api/v1/calendar/oauth/google/start",{method:"POST",body:JSON.stringify(e)})}function fv(e){return d(`/api/v1/calendar/oauth/google/session/${e}`).then(t=>({...t,session:{...t.session,discovery:t.session.discovery?pr(t.session.discovery):null}}))}function yv(e){return d("/api/v1/calendar/oauth/microsoft/start",{method:"POST",body:JSON.stringify(e)})}function xv(e){return d("/api/v1/calendar/oauth/microsoft/test-config",{method:"POST",body:JSON.stringify(e)})}function vv(e){return d(`/api/v1/calendar/oauth/microsoft/session/${e}`).then(t=>({...t,session:{...t.session,discovery:t.session.discovery?pr(t.session.discovery):null}}))}function bv(e){return d(`/api/v1/calendar/connections/${e}/discovery`).then(t=>({...t,discovery:pr(t.discovery)}))}function wv(e){return d("/api/v1/calendar/connections",{method:"POST",body:JSON.stringify(e)})}function kv(e){return d(`/api/v1/calendar/connections/${e}/sync`,{method:"POST"})}function jv(e,t){return d(`/api/v1/calendar/connections/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Sv(e){return d(`/api/v1/calendar/connections/${e}`,{method:"DELETE"})}function Nv(){return d("/api/v1/calendar/calendars")}function Pv(e){return d("/api/v1/calendar/work-block-templates",{method:"POST",body:JSON.stringify(e)})}function Tv(e,t){return d(`/api/v1/calendar/work-block-templates/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Iv(e){return d(`/api/v1/calendar/work-block-templates/${e}`,{method:"DELETE"})}function Cv(e){return d("/api/v1/calendar/events",{method:"POST",body:JSON.stringify(e)}).then(t=>({...t,event:qa(t.event)}))}function Rv(e,t){return d(`/api/v1/calendar/events/${e}`,{method:"PATCH",body:JSON.stringify(t)}).then(a=>({...a,event:qa(a.event)}))}function _v(e){return d(`/api/v1/calendar/events/${e}`,{method:"DELETE"})}function Ev(e){return d("/api/v1/calendar/timeboxes",{method:"POST",body:JSON.stringify(e)})}function Av(e,t){return d(`/api/v1/calendar/timeboxes/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Lv(e){return d(`/api/v1/calendar/timeboxes/${e}`,{method:"DELETE"})}function Ov(e){return d("/api/v1/calendar/timeboxes/recommend",{method:"POST",body:JSON.stringify(e)})}function Dv(e={}){const t=new URLSearchParams;K(t,e.userIds),e.status&&t.set("status",e.status),e.polarity&&t.set("polarity",e.polarity),e.dueToday&&t.set("dueToday","true"),e.orderBy&&t.set("orderBy",e.orderBy),e.limit&&t.set("limit",String(e.limit));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/habits${a}`)}function $v(e){return d("/api/v1/habits",{method:"POST",body:JSON.stringify({...e,linkedBehaviorId:e.linkedBehaviorId||null})})}function Mv(e,t){return d(`/api/v1/habits/${e}`,{method:"PATCH",body:JSON.stringify({...t,linkedBehaviorId:t.linkedBehaviorId===""?null:t.linkedBehaviorId})})}function Fv(e){return d(`/api/v1/habits/${e}`,{method:"DELETE"})}function zv(e,t){return d(`/api/v1/habits/${e}/check-ins`,{method:"POST",body:JSON.stringify(t)})}function Wv(e,t){return d(`/api/v1/habits/${e}/check-ins/${encodeURIComponent(t)}`,{method:"DELETE"})}function qv(e){return d(`/api/v1/projects/${e}/board`)}function Bv(e){const t=new URLSearchParams;if(e!=null&&e.projectId&&t.set("projectId",e.projectId),e!=null&&e.goalId&&t.set("goalId",e.goalId),Array.isArray(e==null?void 0:e.levels)&&e.levels.length>0&&t.set("levels",e.levels.join(",")),Array.isArray(e==null?void 0:e.userIds))for(const s of e.userIds)typeof s=="string"&&s.trim().length>0&&t.append("userIds",s);if(Array.isArray(e==null?void 0:e.assigneeIds))for(const s of e.assigneeIds)typeof s=="string"&&s.trim().length>0&&t.append("assigneeIds",s);const a=t.toString().length>0?`?${t.toString()}`:"";return d(`/api/v1/work-items/hierarchy${a}`)}function Kv(){return d("/api/v1/operator/context")}function ro(){return d("/api/v1/settings")}function nd(){return d("/api/v1/doctor")}function id(e){return d("/api/v1/doctor/fixes",{method:"POST",body:JSON.stringify(e)})}function Hv(e){return d("/api/v1/settings/models/connections",{method:"POST",body:JSON.stringify(e)})}function Uv(e){return d(`/api/v1/settings/models/connections/${e}`,{method:"DELETE"})}function Gv(e){return d("/api/v1/settings/models/connections/test",{method:"POST",body:JSON.stringify(e)})}function Vv(){return d("/api/v1/settings/models/oauth/openai-codex/start",{method:"POST"})}function Jv(e){return d(`/api/v1/settings/models/oauth/openai-codex/session/${e}`)}function Xv(e,t){return d(`/api/v1/settings/models/oauth/openai-codex/session/${e}/manual`,{method:"POST",body:JSON.stringify({codeOrUrl:t})})}function Qv(e){return d(`/api/v1/surfaces/${e}/layout`)}function Yv(e,t){return d(`/api/v1/surfaces/${e}/layout`,{method:"PUT",body:JSON.stringify(t)})}function Zv(e){return d(`/api/v1/surfaces/${e}/layout/reset`,{method:"POST"})}function od(){return d("/api/v1/workbench/flows")}function eb(e){return d("/api/v1/workbench/flows",{method:"POST",body:JSON.stringify(e)})}function ld(e){return d(`/api/v1/workbench/flows/${e}`)}function cd(e,t){return d(`/api/v1/workbench/flows/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function dd(e){return d(`/api/v1/workbench/flows/${e}`,{method:"DELETE"})}function ud(e,t){return d(`/api/v1/workbench/flows/${e}/run`,{method:"POST",body:JSON.stringify(t)})}function md(e,t){return d(`/api/v1/workbench/flows/${e}/chat`,{method:"POST",body:JSON.stringify(t)})}function pd(e,t){return d(`/api/v1/workbench/flows/${e}/runs/${t}`)}function hd(e,t){return d(`/api/v1/workbench/flows/${e}/runs/${t}/nodes`)}function gd(e,t,a){return d(`/api/v1/workbench/flows/${e}/runs/${t}/nodes/${a}`)}function fd(e,t){return d(`/api/v1/workbench/flows/${e}/nodes/${t}/output`)}function tb(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/overview${a}`)}function yd(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/sleep${a}`)}function rb(e){return d(`/api/v1/health/sleep/${e}/raw`)}function ab(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/fitness${a}`)}function sb(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/training-load${a}`)}function nb(e,t="adaptive"){const a=new URLSearchParams({resolution:t});return d(`/api/v1/health/workouts/${e}/detail?${a.toString()}`)}function ib(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/vitals${a}`)}function ob(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/weight-loss${a}`)}function lb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/target${s}`,{method:"PATCH",body:JSON.stringify(e)})}function cb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/daily-active-calories${s}`,{method:"PATCH",body:JSON.stringify(e)})}function db(e){const t=new URLSearchParams;K(t,H(e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/weight-loss/foods/search${a}`,{method:"POST",body:JSON.stringify({query:e.query,limit:e.limit})})}function ub(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/food-logs${s}`,{method:"POST",body:JSON.stringify(e)})}function mb(e,t,a){const s=new URLSearchParams;K(s,H(a));const n=s.size>0?`?${s.toString()}`:"";return d(`/api/v1/health/weight-loss/food-logs/${e}${n}`,{method:"PATCH",body:JSON.stringify(t)})}function pb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/food-logs/${e}${s}`,{method:"DELETE"})}function hb(e){const t=new URLSearchParams;K(t,H(e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/health/weight-loss/parse${a}`,{method:"POST",body:JSON.stringify({text:e.text,mealTime:e.mealTime,imageRefs:e.imageRefs,connectionId:e.connectionId,commitCandidate:e.commitCandidate})})}function gb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/body-checkins${s}`,{method:"POST",body:JSON.stringify(e)})}function fb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/appearance-checkins${s}`,{method:"POST",body:JSON.stringify(e)})}function yb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/subjective-checkins${s}`,{method:"POST",body:JSON.stringify(e)})}function xb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/health/weight-loss/gut-checkins${s}`,{method:"POST",body:JSON.stringify(e)})}function vb(e){const t=new URLSearchParams;e!=null&&e.date&&t.set("date",e.date),K(t,H(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/day${a}`)}function bb(e){const t=new URLSearchParams;e!=null&&e.month&&t.set("month",e.month),K(t,H(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/month${a}`)}function wb(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/all-time${a}`)}function kb(e){const t=new URLSearchParams;K(t,H(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/screen-time/day${a}`)}function jb(e){const t=new URLSearchParams;K(t,H(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/screen-time/month${a}`)}function Sb(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/screen-time/all-time${a}`)}function Nb(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/screen-time/settings${a}`)}function Pb(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/settings${a}`)}function Tb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/settings${s}`,{method:"PATCH",body:JSON.stringify(e)})}function Ib(e){const t=new URLSearchParams;K(t,H(e));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/places${a}`)}function Cb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/places${s}`,{method:"POST",body:JSON.stringify(e)})}function Rb(e,t){return d(`/api/v1/movement/places/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function _b(e,t){return d(`/api/v1/movement/stays/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Eb(e){return d(`/api/v1/movement/trips/${e}`)}function Ab(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/boxes/${e}${s}`)}function Lb(e){const t=new URLSearchParams;e!=null&&e.before&&t.set("before",e.before),typeof(e==null?void 0:e.limit)=="number"&&t.set("limit",String(e.limit)),e!=null&&e.includeInvalid&&t.set("includeInvalid","true"),K(t,H(e==null?void 0:e.userIds));const a=t.size>0?`?${t.toString()}`:"";return d(`/api/v1/movement/timeline${a}`)}function Ob(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/user-boxes${s}`,{method:"POST",body:JSON.stringify(e)})}function Db(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/user-boxes/preflight${s}`,{method:"POST",body:JSON.stringify(e)})}function $b(e,t,a){const s=new URLSearchParams;K(s,H(a));const n=s.size>0?`?${s.toString()}`:"";return d(`/api/v1/movement/user-boxes/${e}${n}`,{method:"PATCH",body:JSON.stringify(t)})}function Mb(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.size>0?`?${a.toString()}`:"";return d(`/api/v1/movement/user-boxes/${e}${s}`,{method:"DELETE"})}function Fb(e,t,a){const s=new URLSearchParams;K(s,H(a));const n=s.size>0?`?${s.toString()}`:"";return d(`/api/v1/movement/automatic-boxes/${e}/invalidate${n}`,{method:"POST",body:JSON.stringify(t)})}function zb(e){return d("/api/v1/movement/selection",{method:"POST",body:JSON.stringify(e)})}function Wb(e){return d("/api/v1/health/pairing-sessions",{method:"POST",body:JSON.stringify(e??{})})}function qb(e){return d(`/api/v1/health/pairing-sessions/${e}`,{method:"DELETE"})}function Bb(e,t,a){return d(`/api/v1/health/pairing-sessions/${e}/sources/${t}`,{method:"PATCH",body:JSON.stringify({desiredEnabled:a})})}function Kb(e){return d("/api/v1/health/pairing-sessions/revoke-all",{method:"POST",body:JSON.stringify(e??{})})}function Hb(e,t){return d(`/api/v1/health/workouts/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function xd(e,t){return d(`/api/v1/health/sleep/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Ub(){return d("/api/v1/users/directory")}function Gb(e,t){return d(`/api/v1/users/access-grants/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Vb(e){return d("/api/v1/users",{method:"POST",body:JSON.stringify(e)})}function Jb(e,t){return d(`/api/v1/users/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Xb(e){return d("/api/v1/strategies",{method:"POST",body:JSON.stringify(e)})}function Qb(e){return d(`/api/v1/strategies/${e}`)}function Yb(e,t){return d(`/api/v1/strategies/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Zb(e){return d(`/api/v1/strategies/${e}`,{method:"DELETE"})}function ew(){return d("/api/v1/settings/bin")}function tw(){return d("/api/v1/settings/data")}function rw(e){return d("/api/v1/settings/data",{method:"PATCH",body:JSON.stringify(e)})}function aw(){return d("/api/v1/settings/data/scan",{method:"POST",body:JSON.stringify({})})}function sw(e=""){return d("/api/v1/settings/data/backups",{method:"POST",body:JSON.stringify({note:e})})}function nw(e,t=!0){return d(`/api/v1/settings/data/backups/${e}/restore`,{method:"POST",body:JSON.stringify({createSafetyBackup:t})})}function iw(e){return d("/api/v1/settings/data/switch-root",{method:"POST",body:JSON.stringify(e)})}function ow(e){return to(`/api/v1/settings/data/export?format=${e}`)}function lw(){return d("/api/v1/agents/sessions")}function cw(e){return d(`/api/v1/agents/sessions/${e}/history`)}function dw(e,t=""){return d(`/api/v1/agents/sessions/${e}/reconnect`,{method:"POST",body:JSON.stringify({note:t})})}function uw(e,t={}){return d(`/api/v1/agents/sessions/${e}/disconnect`,{method:"POST",body:JSON.stringify(t)})}function mw(){return d("/api/v1/agents/onboarding")}function pw(){return d("/api/v1/approval-requests")}function hw(e,t=""){return d(`/api/v1/approval-requests/${e}/approve`,{method:"POST",body:JSON.stringify({note:t})})}function gw(e,t=""){return d(`/api/v1/approval-requests/${e}/reject`,{method:"POST",body:JSON.stringify({note:t})})}function fw(){return d("/api/v1/rewards/rules")}function yw(e,t){return d(`/api/v1/rewards/rules/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function xw(e){return d("/api/v1/rewards/bonus",{method:"POST",body:JSON.stringify(e)})}function vw(e=50){return d(`/api/v1/rewards/ledger?limit=${e}`)}function vd(e){const t=new URLSearchParams;K(t,H(e));const a=t.toString()?`?${t}`:"";return d(`/api/v1/metrics/xp${a}`)}function bw(e){const t=new URLSearchParams;K(t,H(e));const a=t.toString()?`?${t}`:"";return d(`/api/v1/gamification/catalog${a}`)}function ao(){return d("/api/v1/gamification/assets")}function so(e){return d("/api/v1/gamification/assets/install",{method:"POST",body:JSON.stringify({style:e})})}function ww(e,t){const a=new URLSearchParams;K(a,H(t));const s=a.toString()?`?${a}`:"";return d(`/api/v1/gamification/equipment${s}`,{method:"PUT",body:JSON.stringify(e)})}function bd(e){return d(`/api/v1/gamification/celebrations/${e}/seen`,{method:"POST"})}function wd(e){return d("/api/v1/settings",{method:"PATCH",body:JSON.stringify(e)})}function kd(e){return d("/api/v1/entities/create",{method:"POST",body:JSON.stringify(e)})}function jd(e){return d("/api/v1/entities/update",{method:"POST",body:JSON.stringify(e)})}function Sd(e){return d("/api/v1/entities/delete",{method:"POST",body:JSON.stringify(e)})}function kw(e){return d("/api/v1/entities/restore",{method:"POST",body:JSON.stringify(e)})}function no(e){return d("/api/v1/entities/search",{method:"POST",body:JSON.stringify(e)})}function jw(e){return d("/api/v1/settings/tokens",{method:"POST",body:JSON.stringify(e)})}function Sw(e){return d(`/api/v1/settings/tokens/${e}/rotate`,{method:"POST"})}function Nw(e){return d(`/api/v1/settings/tokens/${e}/revoke`,{method:"POST"})}function Pw(e={}){const t=new URLSearchParams;return t.set("limit",String(e.limit??100)),e.entityType&&t.set("entityType",e.entityType),e.entityId&&t.set("entityId",e.entityId),e.includeCorrected&&t.set("includeCorrected","true"),K(t,H(e.userIds)),d(`/api/v1/activity?${t.toString()}`)}function Tw(e={}){const t=new URLSearchParams;return t.set("limit",String(e.limit??200)),e.level&&t.set("level",e.level),e.source&&t.set("source",e.source),e.scope&&t.set("scope",e.scope),e.route&&t.set("route",e.route),e.entityType&&t.set("entityType",e.entityType),e.entityId&&t.set("entityId",e.entityId),e.jobId&&t.set("jobId",e.jobId),e.search&&t.set("search",e.search),e.beforeCreatedAt&&t.set("beforeCreatedAt",e.beforeCreatedAt),e.beforeId&&t.set("beforeId",e.beforeId),d(`/api/v1/diagnostics/logs?${t.toString()}`)}function io(e){return d("/api/v1/goals",{method:"POST",body:JSON.stringify({...e,notes:Gr(e.notes)})})}function oo(e){return d("/api/v1/projects",{method:"POST",body:JSON.stringify({...e,notes:Gr(e.notes)})})}function Nd(e,t){return d(`/api/v1/projects/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Iw(e,t="soft"){return d(`/api/v1/projects/${e}${t==="hard"?"?mode=hard":""}`,{method:"DELETE"})}function Pd(e,t){return d(`/api/v1/goals/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Cw(e){return d(`/api/v1/goals/${e}`,{method:"DELETE"})}function Td(e){const t={...e,goalId:e.goalId||null,projectId:e.projectId||null,parentWorkItemId:e.parentWorkItemId||null,dueDate:e.dueDate||null,plannedDurationSeconds:e.plannedDurationSeconds===void 0?null:e.plannedDurationSeconds,notes:Gr(e.notes)};return d("/api/v1/tasks",{method:"POST",body:JSON.stringify(t)})}function Id(e){const t={...e,goalId:e.goalId||null,projectId:e.projectId||null,parentWorkItemId:e.parentWorkItemId||null,dueDate:e.dueDate||null,plannedDurationSeconds:e.plannedDurationSeconds===void 0?null:e.plannedDurationSeconds,notes:Gr(e.notes)};return d("/api/v1/work-items",{method:"POST",body:JSON.stringify(t)})}function Un(e,t){return d(`/api/v1/tasks/${e}`,{method:"PATCH",body:JSON.stringify({...t,goalId:t.goalId===""?null:t.goalId,projectId:t.projectId===""?null:t.projectId,parentWorkItemId:t.parentWorkItemId===""?null:t.parentWorkItemId,dueDate:t.dueDate===""?null:t.dueDate,plannedDurationSeconds:t.plannedDurationSeconds===void 0?void 0:t.plannedDurationSeconds})})}function Rw(e,t){return d(`/api/v1/tasks/${e}/split`,{method:"POST",body:JSON.stringify(t)})}function _w(e){return d(`/api/v1/tasks/${e}`,{method:"DELETE"})}function Ew(e){return d(`/api/v1/tasks/${e}/uncomplete`,{method:"POST",body:JSON.stringify({})})}function Aw(e){return d(`/api/v1/tasks/${e}/context`)}function Lw(e){return d("/api/v1/operator/log-work",{method:"POST",body:JSON.stringify(e)})}function Ow(e){return d("/api/v1/work-adjustments",{method:"POST",body:JSON.stringify(e)})}function Dw(e,t="Removed from the visible archive."){return d(`/api/v1/activity/${e}/remove`,{method:"POST",body:JSON.stringify({reason:t})})}function Cd(e){return d("/api/v1/session-events",{method:"POST",body:JSON.stringify(e)})}function Rd(e,t){return d(`/api/v1/tasks/${e}/runs`,{method:"POST",body:JSON.stringify(t)})}function _d(){return d("/api/v1/git-helper/overview")}function Ed(e){var a,s;const t=new URLSearchParams;return t.set("kind",e.kind),(a=e.query)!=null&&a.trim()&&t.set("query",e.query.trim()),(s=e.repository)!=null&&s.trim()&&t.set("repository",e.repository.trim()),d(`/api/v1/git-helper/search?${t.toString()}`)}function Ad(e,t){return d(`/api/v1/task-runs/${e}/heartbeat`,{method:"POST",body:JSON.stringify(t)})}function Ld(e,t={}){return d(`/api/v1/task-runs/${e}/focus`,{method:"POST",body:JSON.stringify(t)})}function Od(e,t){return d(`/api/v1/task-runs/${e}/complete`,{method:"POST",body:JSON.stringify(t)})}function Dd(e,t){return d(`/api/v1/task-runs/${e}/release`,{method:"POST",body:JSON.stringify(t)})}const $d=[{value:"dramatic-smithie",label:"Fantasy",description:"Warm, lighthearted 3D forge art with brighter mascot reactions and playful trophies."},{value:"dark-fantasy",label:"Dark Fantasy",description:"Obsidian iron, ember gold, high-pressure streak energy, and mythic trophy silhouettes."},{value:"mind-locksmith",label:"Mind Locksmith",description:"Modern locksmith-of-the-mind art for planning, memory, Psyche, health, and agent work."}],Ft="dramatic-smithie",$w=["item-trophy-xp-levels-the-first-heat","item-trophy-tasks-anvil-marathon","item-unlock-streaks-molten-crown-fire"];function hr(e){return $d.some(t=>t.value===e)?e:Ft}function Pr(e,t=512,a=Ft){const s="/forge/",n=s.endsWith("/")?s:`${s}/`,o=hr(a),i=e.startsWith("item-")?"items":e.startsWith("mascot-")?"mascots":"";return`${n}gamification/sprites/themes/${o}/${i?`${i}/`:""}${e}-${t}.webp`}function ba(e=Ft){const t="/forge/",a=t.endsWith("/")?t:`${t}/`,s=hr(e);return`${a}gamification-previews/${s}-mascot.webp`}function Mw(e,t){const a="/forge/",s=a.endsWith("/")?a:`${a}/`,n=hr(e);return`${s}gamification-previews/${n}-${t}.webp`}function lo(){var t;const e=Hr({queryKey:["forge-settings"],queryFn:ro,staleTime:3e4});return hr(((t=e==null?void 0:e.data)==null?void 0:t.settings.gamificationTheme)??Ft)}const Je={totalXp:0,level:1,currentLevelXp:0,nextLevelXp:100,levelCurveVersion:"smith-forge",weeklyXp:0,streakDays:0,comboMultiplier:1,momentumScore:0,topGoalId:null,topGoalTitle:null};function Tr(e){e.currentTarget.hidden=!0}function co(e){const t=(e==null?void 0:e.totalXp)??Je.totalXp,a=Math.max(1,(e==null?void 0:e.level)??Je.level),s=(e==null?void 0:e.xpIntoLevel)??(e==null?void 0:e.currentLevelXp)??Je.currentLevelXp,n=Math.max(1,(e==null?void 0:e.nextLevelXp)??Je.nextLevelXp),o=Math.max(0,(e==null?void 0:e.xpToNextLevel)??n-s),i=(e==null?void 0:e.currentLevelStartXp)??Math.max(0,t-s);return{totalXp:t,level:a,currentLevelXp:s,nextLevelXp:n,xpIntoLevel:s,xpToNextLevel:o,currentLevelStartXp:i,nextLevelTotalXp:(e==null?void 0:e.nextLevelTotalXp)??i+n,levelCurveVersion:(e==null?void 0:e.levelCurveVersion)??Je.levelCurveVersion,weeklyXp:(e==null?void 0:e.weeklyXp)??Je.weeklyXp,streakDays:(e==null?void 0:e.streakDays)??Je.streakDays,comboMultiplier:(e==null?void 0:e.comboMultiplier)??Je.comboMultiplier,momentumScore:(e==null?void 0:e.momentumScore)??Je.momentumScore,topGoalId:(e==null?void 0:e.topGoalId)??Je.topGoalId,topGoalTitle:(e==null?void 0:e.topGoalTitle)??Je.topGoalTitle}}function uo(e){return Intl.NumberFormat(void 0,{notation:e>=1e4?"compact":"standard",maximumFractionDigits:1}).format(e)}function Md({metrics:e,className:t}){const a=co(e),s=Math.min(100,Math.round(a.currentLevelXp/Math.max(1,a.nextLevelXp)*100));return r.jsxs(Lt,{to:"/rewards",className:b("inline-flex min-h-10 max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-[12px] font-medium text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-soft)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]",t),children:[r.jsxs("span",{className:"relative grid size-8 shrink-0 place-items-center rounded-full bg-[var(--ui-surface-2)]",children:[r.jsx("span",{className:"absolute inset-0 rounded-full",style:{background:`conic-gradient(var(--tertiary) ${s}%, var(--ui-border-subtle) 0)`}}),r.jsxs("span",{className:"relative grid size-6 place-items-center rounded-full bg-[var(--ui-surface-section)] text-[10px] text-[var(--tertiary)]",children:["L",a.level]})]}),r.jsxs("span",{className:"min-w-0",children:[r.jsxs("span",{className:"block truncate",children:[a.currentLevelXp,"/",a.nextLevelXp," XP"]}),r.jsxs("span",{className:"block truncate text-[11px] text-[var(--ui-ink-faint)]",children:[a.streakDays," day streak"]})]})]})}function Fw({metrics:e,compact:t=!1}){var h,w,P;const a=lo(),s=mr(),n=Hr({queryKey:["forge-gamification-assets"],queryFn:ao}),o=cr({mutationFn:so,onSuccess:async()=>{await s.invalidateQueries({queryKey:["forge-gamification-assets"]})}}),i=co(e.profile),l=Math.min(100,Math.round(i.currentLevelXp/Math.max(1,i.nextLevelXp)*100)),u=e.catalogPreview??[],p=e.nextUnlock??u.find(x=>!x.unlocked)??null,m=e.newestUnlock??u.find(x=>x.unlocked)??null,g=(h=e.nextTargets)!=null&&h.length?e.nextTargets:p?[p]:[],f=[...m?[m]:[],...u.filter(x=>x.unlocked&&x.id!==(m==null?void 0:m.id))].slice(0,5),v=((w=e.equipment)==null?void 0:w.selectedMascotSkin)??"default smith",y=(P=n.data)==null?void 0:P.assets.styles.find(x=>x.id===a),_=(y==null?void 0:y.label)??a.split("-").map(x=>x.charAt(0).toUpperCase()+x.slice(1)).join(" ");if(y&&!y.installed){const x=o.isPending&&o.variables===a;return r.jsx("section",{className:"relative isolate min-w-0 overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] p-4 shadow-[var(--ui-shadow-soft)]",children:r.jsxs("div",{className:"grid min-w-0 gap-4 sm:grid-cols-[4.5rem_minmax(0,1fr)] sm:items-center",children:[r.jsx("div",{className:"grid size-18 place-items-center overflow-hidden rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",children:r.jsx("img",{src:ba(a),alt:`${_} preview`,className:"size-16 object-contain"})}),r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsxs(le,{className:"bg-[var(--ui-surface-2)] text-[var(--tertiary)]",children:["Level ",i.level]}),r.jsxs(le,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[i.currentLevelXp,"/",i.nextLevelXp," XP"]}),r.jsx(le,{className:"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",children:"Assets not downloaded"})]}),r.jsxs("div",{className:"mt-3 flex min-w-0 flex-wrap items-end justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"font-display text-xl text-[var(--ui-ink-strong)]",children:["Download ",_," rewards"]}),r.jsx("p",{className:"mt-1 max-w-2xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:"This installs the optional mascot, trophy, and unlock art for the selected reward style."})]}),r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsxs(ue,{size:"sm",pending:x,pendingLabel:"Downloading",onClick:()=>o.mutate(a),children:[r.jsx(Pi,{className:"size-3.5"}),"Download"]}),r.jsxs(Lt,{to:"/settings",className:"inline-flex min-h-[2.125rem] items-center gap-2 rounded-[var(--radius-control)] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-[0.4375rem] text-[13px] font-medium text-[var(--ui-ink-soft)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]",children:[r.jsx(Fr,{className:"size-3.5"}),"Settings"]})]})]}),o.isError?r.jsx("div",{className:"mt-3 text-sm text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:o.error instanceof Error?o.error.message:"Could not download reward assets."}):r.jsxs("div",{className:"mt-3 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[y.spriteCount,"/",y.expectedSpriteCount," sprites installed"]})]})]})})}return r.jsxs("section",{className:"relative isolate min-w-0 overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] p-4 shadow-[var(--ui-shadow-soft)] md:p-5",children:[r.jsx("div",{className:"absolute inset-0 -z-10 bg-[radial-gradient(circle_at_18%_20%,color-mix(in_srgb,var(--tertiary)_12%,transparent),transparent_34%),radial-gradient(circle_at_82%_10%,color-mix(in_srgb,var(--info)_10%,transparent),transparent_32%),radial-gradient(circle_at_76%_82%,color-mix(in_srgb,var(--primary)_10%,transparent),transparent_34%)]"}),r.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(18rem,0.84fr)_minmax(0,1.16fr)] lg:items-center",children:[r.jsxs("div",{className:"relative min-h-[17rem] overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",children:[r.jsx("img",{src:Pr(e.mascot.spriteKey,512,a),alt:"Forge Smith mascot",onError:Tr,className:"absolute inset-x-0 bottom-3 mx-auto h-[15.5rem] max-w-none object-contain drop-shadow-[var(--ui-shadow-soft)]"}),r.jsxs("div",{className:"absolute inset-x-0 bottom-0 bg-[linear-gradient(to_top,color-mix(in_srgb,var(--ui-surface-section)_92%,transparent),transparent)] p-4",children:[r.jsxs("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:[e.scope.label," · ",v.replaceAll("-"," ")]}),r.jsx("div",{className:"mt-1 font-display text-xl text-[var(--ui-ink-strong)]",children:e.mascot.headline})]})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsxs(le,{className:"bg-[var(--ui-surface-2)] text-[var(--tertiary)]",children:["Level ",i.level]}),r.jsxs(le,{className:"bg-[var(--ui-surface-2)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[i.streakDays," days"]}),r.jsxs(le,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[uo(i.totalXp)," XP"]})]}),r.jsxs("div",{className:"mt-4 grid gap-3",children:[r.jsxs("div",{className:"flex min-w-0 items-end justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"font-display text-2xl text-[var(--ui-ink-strong)] md:text-3xl",children:["Forge level ",i.level]}),r.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:e.mascot.line})]}),r.jsxs(Lt,{to:"/rewards",className:"inline-flex shrink-0 items-center gap-2 rounded-full bg-[var(--primary)] px-3 py-2 text-[12px] font-semibold text-[var(--ui-ink-on-accent)] transition hover:opacity-90",children:[r.jsx(ma,{className:"size-3.5"}),"Hall"]})]}),r.jsx(Tc,{value:l}),r.jsxs("div",{className:"flex flex-wrap justify-between gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[r.jsxs("span",{children:[i.currentLevelXp,"/",i.nextLevelXp," XP"]}),r.jsxs("span",{children:[i.xpToNextLevel??i.nextLevelXp-i.currentLevelXp," ","to next"]})]})]}),t?null:r.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(13rem,0.72fr)]",children:[r.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-[var(--ui-ink-strong)]",children:[r.jsx(ir,{className:"size-4 text-[var(--tertiary)]"}),"Next targets"]}),r.jsx("div",{className:"mt-3 grid gap-2",children:g.length>0?g.map(x=>r.jsxs("div",{className:"grid grid-cols-[2rem_minmax(0,1fr)_3.5rem] items-center gap-2",children:[r.jsx("img",{src:Pr(x.assetKey,256,a),alt:"",onError:Tr,className:"size-8 object-contain opacity-90"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"truncate text-sm text-[var(--ui-ink-medium)]",children:x.title}),r.jsx("div",{className:"truncate text-[11px] text-[var(--ui-ink-faint)]",children:x.requirementText})]}),r.jsxs("div",{className:"text-right text-[11px] text-[var(--ui-ink-faint)]",children:[x.progressPercent,"%"]})]},x.id)):r.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"All visible rewards unlocked"})})]}),r.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-[var(--ui-ink-strong)]",children:[r.jsx(ma,{className:"size-4 text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]"}),"Latest shelf"]}),r.jsx("div",{className:"mt-3 flex min-w-0 gap-2",children:f.length>0?f.map(x=>r.jsx("img",{src:Pr(x.assetKey,256,a),alt:x.title,title:x.title,onError:Tr,className:"size-11 rounded-2xl bg-[var(--ui-surface-2)] object-contain p-1"},x.id)):r.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"No trophy yet"})}),r.jsxs("div",{className:"mt-3 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[e.unlockedItemCount,"/",e.totalItemCount," unlocked"]})]})]})]})]})]})}function Fd({xpNotice:e,celebrations:t,onSeen:a}){const s=nc(),n=lo(),o=t[0]??null,i=(o==null?void 0:o.kind)==="level"||(o==null?void 0:o.kind)==="trophy"||(o==null?void 0:o.kind)==="unlock";return r.jsx(Fa,{children:o?r.jsx(ht.div,{initial:s?{opacity:0}:{opacity:0,y:20,scale:.96},animate:s?{opacity:1}:{opacity:1,y:0,scale:1},exit:s?{opacity:0}:{opacity:0,y:16,scale:.98},transition:{duration:.28,ease:"easeOut"},className:b("pointer-events-auto fixed z-50 px-4",i?"inset-x-0 bottom-24 flex justify-center lg:bottom-8":"right-0 bottom-24 lg:bottom-8"),onAnimationComplete:()=>{window.setTimeout(()=>a(o.id),i?3e3:1800)},children:r.jsxs("div",{className:b("relative min-w-0 overflow-hidden rounded-[26px] border border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",i?"w-full max-w-[34rem] p-4":"max-w-[24rem] p-3"),children:[r.jsx("div",{className:"absolute inset-0 -z-10 bg-[radial-gradient(circle_at_22%_12%,color-mix(in_srgb,var(--tertiary)_16%,transparent),transparent_42%),radial-gradient(circle_at_82%_16%,color-mix(in_srgb,var(--primary)_14%,transparent),transparent_38%)]"}),r.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[r.jsx("img",{src:Pr(o.assetKey||"mascot-state-020",256,n),alt:"",onError:Tr,className:b("shrink-0 object-contain",i?"size-24":"size-14")}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--tertiary)]",children:o.kind}),r.jsx("div",{className:"mt-1 truncate font-display text-xl text-[var(--ui-ink-strong)]",children:o.title}),r.jsx("div",{className:"mt-1 line-clamp-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:o.summary})]})]})]})},o.id):e?r.jsx(ht.div,{initial:s?{opacity:0}:{opacity:0,y:14},animate:s?{opacity:1}:{opacity:1,y:0},exit:s?{opacity:0}:{opacity:0,y:10},className:"pointer-events-none fixed inset-x-0 bottom-24 z-50 flex justify-center px-4 lg:bottom-6",children:r.jsxs("div",{className:b("inline-flex items-center gap-2 rounded-full border px-4 py-2 text-sm font-medium shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",e.deltaXp>0?"border-[color-mix(in_srgb,var(--success)_34%,var(--ui-border-subtle)_66%)] bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]":"border-[color-mix(in_srgb,var(--danger)_34%,var(--ui-border-subtle)_66%)] bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]"),children:[e.deltaXp>0?r.jsx(ur,{className:"size-4 shrink-0"}):r.jsx(Ti,{className:"size-4 shrink-0"}),r.jsxs("span",{children:[e.deltaXp>0?`XP +${e.deltaXp}`:`XP ${e.deltaXp}`," ","· ",uo(e.totalXp)," total"]})]})},`xp-${e.totalXp}`):null})}const aa="forge-gamification-assets-setup-dismissed-v1";function zd(){var y,_;const e=mr(),t=Bt(),[a,s]=c.useState(()=>typeof window>"u"?!0:window.localStorage.getItem(aa)==="1"),[n,o]=c.useState(Ft),i=Hr({queryKey:["forge-gamification-assets"],queryFn:ao,staleTime:3e4}),l=((y=i.data)==null?void 0:y.assets.styles)??[],u=l.filter(h=>h.installed),m=!t.pathname.startsWith("/settings")&&!a&&i.isSuccess&&u.length===0;c.useEffect(()=>{var w;const h=hr((w=i.data)==null?void 0:w.assets.defaultStyle);o(h)},[(_=i.data)==null?void 0:_.assets.defaultStyle]);const g=c.useMemo(()=>l.find(h=>h.id===n)??l.find(h=>h.id===Ft)??l[0],[n,l]),f=cr({mutationFn:async h=>{const w=await so(h);return await wd({gamificationTheme:h}),w},onSuccess:async()=>{window.localStorage.removeItem(aa),await Promise.all([e.invalidateQueries({queryKey:["forge-gamification-assets"]}),e.invalidateQueries({queryKey:["forge-settings"]})])}});function v(){window.localStorage.setItem(aa,"1"),s(!0)}return l.length?r.jsx(ft,{open:m,children:r.jsxs(yt,{children:[r.jsx(xt,{className:"fixed inset-0 z-50 bg-[rgba(3,7,18,0.74)] backdrop-blur-xl"}),r.jsxs(vt,{className:"fixed left-1/2 top-1/2 z-50 w-[min(44rem,calc(100vw-1.25rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-[30px] border border-white/10 bg-[linear-gradient(180deg,rgba(16,23,36,0.98),rgba(8,12,22,0.98))] shadow-[0_32px_90px_rgba(3,8,18,0.56)] outline-none",children:[r.jsx(bt,{className:"sr-only",children:"Download Forge reward art"}),r.jsx(wt,{className:"sr-only",children:"Choose whether Forge should download optional trophy and mascot art."}),r.jsx("button",{type:"button",onClick:v,className:"absolute right-3 top-3 z-10 inline-flex size-9 items-center justify-center rounded-full border border-white/10 bg-white/8 text-white/62 transition hover:bg-white/12 hover:text-white","aria-label":"Close",children:r.jsx(dt,{className:"size-4"})}),r.jsxs("div",{className:"grid gap-0 md:grid-cols-[16rem_minmax(0,1fr)]",children:[r.jsx("div",{className:"relative min-h-[18rem] overflow-hidden bg-[linear-gradient(160deg,rgba(245,158,11,0.18),rgba(34,197,94,0.12)_42%,rgba(14,165,233,0.14))]",children:r.jsx("img",{src:ba(n),alt:"",className:"absolute inset-x-0 bottom-4 mx-auto h-56 max-w-none object-contain drop-shadow-[0_24px_42px_rgba(0,0,0,0.48)]"})}),r.jsxs("div",{className:"p-5 sm:p-6",children:[r.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--tertiary)]",children:"Optional reward art"}),r.jsx("h2",{className:"mt-2 font-display text-2xl text-white",children:"Download trophies and mascot sprites?"}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-white/62",children:"Forge can keep the app package small and install only the reward art style you want. The app works without these images."}),r.jsx("div",{className:"mt-5 grid gap-2",children:l.map(h=>{const w=h.id===n;return r.jsxs("button",{type:"button",onClick:()=>o(h.id),className:["grid grid-cols-[3.5rem_minmax(0,1fr)] items-center gap-3 rounded-[18px] border p-2 text-left transition",w?"border-[var(--primary)] bg-[var(--primary)]/12":"border-white/10 bg-white/[0.04] hover:bg-white/[0.07]"].join(" "),children:[r.jsx("img",{src:ba(h.id),alt:"",className:"size-14 object-contain"}),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block truncate text-sm font-semibold text-white",children:h.label}),r.jsx("span",{className:"mt-1 line-clamp-2 block text-[12px] leading-5 text-white/52",children:h.description})]})]},h.id)})}),f.isError?r.jsx("div",{className:"mt-4 rounded-[16px] border border-red-300/20 bg-red-500/10 px-3 py-2 text-[12px] leading-5 text-red-100",children:f.error instanceof Error?f.error.message:"Could not download the selected art."}):null,r.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:v,className:"inline-flex items-center justify-center rounded-full border border-white/10 px-4 py-2 text-sm font-semibold text-white/72 transition hover:bg-white/8 hover:text-white",children:"Not now"}),r.jsxs("button",{type:"button",disabled:!g||f.isPending,onClick:()=>{g&&f.mutate(g.id)},className:"inline-flex items-center justify-center gap-2 rounded-full bg-[var(--primary)] px-4 py-2 text-sm font-semibold text-slate-950 transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",children:[r.jsx(Pi,{className:"size-4"}),f.isPending?"Downloading":"Download"]})]})]})]})]})]})}):null}const Wd=["goal","project","issue","task","strategy","habit","tag","note","wiki_page","wiki_space","insight","calendar_event","work_block","timebox","value","pattern","behavior","belief","mode","mode_session","flashcard","report","event_type","emotion","workbench","functor","chat"],qd=[{kind:"goal",label:"Goal",icon:Ra,iconName:"Target",accentRgb:[251,191,36]},{kind:"project",label:"Project",icon:il,iconName:"FolderOpen",accentRgb:[56,189,248]},{kind:"issue",label:"Issue",icon:Mn,iconName:"FileText",accentRgb:[251,146,60]},{kind:"task",label:"Task",icon:ol,iconName:"ListTodo",accentRgb:[129,140,248]},{kind:"strategy",label:"Strategy",icon:Kt,iconName:"GitBranch",accentRgb:[34,211,238]},{kind:"habit",label:"Habit",icon:ll,iconName:"RefreshCw",accentRgb:[45,212,191]},{kind:"tag",label:"Tag",icon:Sr,iconName:"PanelTop",accentRgb:[163,230,53]},{kind:"note",label:"Note",icon:Pt,iconName:"NotebookPen",accentRgb:[148,163,184]},{kind:"wiki_page",label:"Wiki Page",icon:Ii,iconName:"StickyNote",accentRgb:[125,211,252]},{kind:"wiki_space",label:"Wiki Space",icon:_a,iconName:"Network",accentRgb:[99,102,241]},{kind:"insight",label:"Insight",icon:ir,iconName:"Sparkles",accentRgb:[244,63,94]},{kind:"calendar_event",label:"Calendar Event",icon:Ot,iconName:"CalendarDays",accentRgb:[14,165,233]},{kind:"work_block",label:"Work Block",icon:Sr,iconName:"PanelTop",accentRgb:[16,185,129]},{kind:"timebox",label:"Timebox",icon:or,iconName:"Timer",accentRgb:[244,114,182]},{kind:"value",label:"Value",icon:Fn,iconName:"Heart",accentRgb:[52,211,153]},{kind:"pattern",label:"Pattern",icon:Ea,iconName:"Repeat",accentRgb:[251,113,133]},{kind:"behavior",label:"Behavior",icon:cl,iconName:"Route",accentRgb:[251,146,60]},{kind:"belief",label:"Belief",icon:dl,iconName:"Quote",accentRgb:[167,139,250]},{kind:"mode",label:"Mode",icon:ul,iconName:"Shapes",accentRgb:[217,70,239]},{kind:"mode_session",label:"Mode Session",icon:ml,iconName:"Compass",accentRgb:[192,132,252]},{kind:"flashcard",label:"Flashcard",icon:Sr,iconName:"PanelTop",accentRgb:[20,184,166]},{kind:"report",label:"Report",icon:Mn,iconName:"FileText",accentRgb:[96,165,250]},{kind:"event_type",label:"Event Type",icon:Ot,iconName:"CalendarDays",accentRgb:[45,212,191]},{kind:"emotion",label:"Emotion",icon:Fn,iconName:"Heart",accentRgb:[248,113,113]},{kind:"workbench",label:"Workbench",icon:pl,iconName:"Workflow",accentRgb:[45,212,191]},{kind:"functor",label:"Functor",icon:ir,iconName:"Sparkles",accentRgb:[250,204,21]},{kind:"chat",label:"Chat",icon:Rr,iconName:"Bot",accentRgb:[129,140,248]}];function Bd(e){return`#${e.map(t=>t.toString(16).padStart(2,"0")).join("")}`}function Xe(e,t,a){return`rgba(var(--forge-entity-${e}-rgb,${t.join(",")}),${a})`}function Kd(e){return{kind:e.kind,label:e.label,icon:e.icon,iconName:e.iconName,colorToken:{cssVariable:`--forge-entity-${e.kind}-rgb`,rgb:e.accentRgb,hex:Bd(e.accentRgb)},iconClassName:`text-[${Xe(e.kind,e.accentRgb,.96)}]`,nameClassName:`text-[${Xe(e.kind,e.accentRgb,.96)}]`,badgeClassName:`border-[${Xe(e.kind,e.accentRgb,.24)}] bg-[linear-gradient(135deg,${Xe(e.kind,e.accentRgb,.24)},${Xe(e.kind,e.accentRgb,.08)})] text-white`,subtleBadgeClassName:`border-[${Xe(e.kind,e.accentRgb,.18)}] bg-[${Xe(e.kind,e.accentRgb,.08)}] text-[${Xe(e.kind,e.accentRgb,.92)}]`,buttonClassName:`border-[${Xe(e.kind,e.accentRgb,.2)}] bg-[${Xe(e.kind,e.accentRgb,.12)}] text-white hover:bg-[${Xe(e.kind,e.accentRgb,.18)}]`}}const Hd=Object.fromEntries(qd.map(e=>[e.kind,Kd(e)])),Ud={goal:"goal",project:"project",task:"task",strategy:"strategy",habit:"habit",tag:"tag",note:"note",insight:"insight",calendar_event:"calendar_event",work_block_template:"work_block",task_timebox:"timebox",psyche_value:"value",behavior_pattern:"pattern",behavior:"behavior",belief_entry:"belief",mode_profile:"mode",mode_guide_session:"mode_session",flashcard:"flashcard",event_type:"event_type",emotion_definition:"emotion",trigger_report:"report"};function Vr(e){return Hd[e]}function zw(e){return Wd.includes(e)}function Gn(e,t){return e==="note"&&(t==null?void 0:t.noteKind)==="wiki"?"wiki_page":Ud[e]??null}function Ww(e){return e==="chat"?"chat":"functor"}function qw(e,t){const a=Vr(e);return t?`border ${a.buttonClassName}`:"border border-white/8 bg-white/[0.05] text-white/62 hover:bg-white/[0.08] hover:text-white"}function et({kind:e,label:t,compact:a=!1,size:s,showIcon:n=!0,iconOnly:o=!1,gradient:i=!0,wrap:l=!1,className:u,...p}){const m=Vr(e),g=m.icon;return r.jsxs(le,{size:s??(a?"sm":"md"),wrap:l,className:b("max-w-full min-w-0 gap-1.5 border font-medium",i?m.badgeClassName:m.subtleBadgeClassName,a&&!o&&"px-2.5",o&&"px-2.5",s==="xs"&&"gap-1 px-2",u),...p,children:[n?r.jsx(g,{className:b(s==="xs"?"size-3":"size-3.5","shrink-0",m.iconClassName)}):null,o?null:r.jsx("span",{className:b("min-w-0 max-w-full",l?"whitespace-normal break-words [overflow-wrap:anywhere]":"truncate"),children:t??m.label})]})}function Gd(e,t,a){return Math.min(a,Math.max(t,e))}function Vd(e,t,a){const s=(a==null?void 0:a.offset)??8,n=(a==null?void 0:a.margin)??12,o=(a==null?void 0:a.preferredMaxHeight)??320,i=(a==null?void 0:a.minHeight)??160,[l,u]=c.useState(null),p=c.useCallback(()=>{const m=e.current;if(!m||typeof window>"u"){u(null);return}const g=m.getBoundingClientRect(),f=window.visualViewport,v=(f==null?void 0:f.width)??window.innerWidth,y=(f==null?void 0:f.height)??window.innerHeight,_=(f==null?void 0:f.offsetLeft)??0,h=(f==null?void 0:f.offsetTop)??0,w=Math.min(g.width,v-n*2),P=_+v-n-w,x=Gd(g.left,_+n,P),$=h+y-g.bottom-s-n,S=g.top-h-s-n,F=$<i&&S>$,N=Math.max(i,F?S:$),E=Math.min(o,N),T=F?Math.max(h+n,g.top-s-E):g.bottom+s;u({position:"fixed",left:x,top:T,width:w,maxHeight:E})},[e,n,i,s,o]);return c.useEffect(()=>{if(!t||typeof window>"u"){u(null);return}let m=0;const g=()=>{m===0&&(m=window.requestAnimationFrame(()=>{m=0,p()}))};p();const f=window.visualViewport;return window.addEventListener("resize",g),window.addEventListener("scroll",g,!0),f==null||f.addEventListener("resize",g),f==null||f.addEventListener("scroll",g),()=>{m!==0&&window.cancelAnimationFrame(m),window.removeEventListener("resize",g),window.removeEventListener("scroll",g,!0),f==null||f.removeEventListener("resize",g),f==null||f.removeEventListener("scroll",g)}},[t,p]),l}function sa(e){return e.trim().toLowerCase()}function Vn(e,t){return e.includes(t)?e:[...e,t]}function Jd({options:e,selectedValues:t,onChange:a,placeholder:s="Search or create…",emptyMessage:n="No matching entries yet.",createLabel:o="Create",onCreate:i,className:l,variant:u="default"}){const[p,m]=c.useState(""),[g,f]=c.useState(!1),[v,y]=c.useState(0),[_,h]=c.useState(!1),[w,P]=c.useState(null),[x,$]=c.useState([]),S=c.useRef(null),F=c.useRef(null),N=e??[],E=t??[],T=u==="action-bar",z=Vd(S,g,{offset:6,preferredMaxHeight:320,minHeight:160}),ee=c.useMemo(()=>{const C=new Map;return[...x,...N].forEach(J=>{C.set(J.value,J)}),Array.from(C.values())},[x,N]),ne=c.useMemo(()=>E.map(C=>ee.find(J=>J.value===C)??{value:C,label:C}),[ee,E]),ie=sa(p),V=c.useMemo(()=>{const C=ee.filter(J=>!E.includes(J.value));return ie?C.filter(J=>`${J.label} ${J.description??""} ${J.searchText??""}`.toLowerCase().includes(ie)).slice(0,8):C.slice(0,8)},[ee,ie,E]),k=ee.some(C=>sa(C.label)===ie);c.useEffect(()=>{if(!g)return;const C=O=>{var A,Z;const Y=O.target;(A=S.current)!=null&&A.contains(Y)||(Z=F.current)!=null&&Z.contains(Y)||f(!1)},J=O=>{O.key==="Escape"&&f(!1)};return document.addEventListener("pointerdown",C),document.addEventListener("keydown",J),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",J)}},[g]);const M=C=>{a(Vn(E,C)),m(""),P(null),y(0),f(!1)},oe=C=>{a(E.filter(J=>J!==C))},ae=async()=>{const C=p.trim();if(!(!i||!C)){h(!0);try{const J=await i(C);$(O=>O.some(Y=>Y.value===J.value)?O:[J,...O]),a(Vn(E,J.value)),m(""),P(null),y(0),f(!1)}catch(J){P(J instanceof Error?J.message:"Unable to create that link right now.")}finally{h(!1)}}};return r.jsxs("div",{className:b("relative grid gap-2",l),ref:S,children:[r.jsxs("div",{className:b("rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",T?"rounded-[20px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3.5 py-3 shadow-[inset_0_1px_0_var(--ui-border-subtle)]":"px-3 py-3"),children:[ne.length>0?r.jsx("div",{className:b("flex flex-wrap gap-2",T?"mb-2.5":"mb-2"),children:ne.map(C=>r.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2",children:[C.kind?r.jsx(et,{kind:C.kind,label:C.label,compact:!0,wrap:!0,gradient:!1,className:"max-w-full"}):C.badge?C.badge:r.jsx("span",{className:b("inline-flex items-center gap-2 rounded-full px-3 py-1.5 text-sm","border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]"),children:r.jsx("span",{className:"max-w-full break-words whitespace-normal [overflow-wrap:anywhere]",children:C.label})}),r.jsx("button",{type:"button",className:b("rounded-full transition","text-[var(--ui-ink-faint)] hover:text-[var(--ui-ink-strong)]"),"aria-label":`Remove ${C.label}`,onClick:()=>oe(C.value),children:r.jsx(dt,{className:"size-3.5"})})]},C.value))}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(gt,{className:b("size-4","text-[var(--ui-ink-faint)]")}),r.jsx("input",{type:"text",value:p,onChange:C=>{m(C.target.value),P(null),f(!0),y(0)},onFocus:()=>f(!0),onKeyDown:C=>{if(C.key==="Backspace"&&!p&&E.length>0){oe(E[E.length-1]);return}if(C.key==="ArrowDown"){C.preventDefault(),f(!0),y(Y=>V.length===0?0:Math.min(V.length-1,Y+1));return}if(C.key==="ArrowUp"){C.preventDefault(),y(Y=>Math.max(0,Y-1));return}if(C.key==="Escape"){f(!1);return}if(C.key!=="Enter")return;C.preventDefault();const J=V[v];if(J){M(J.value);return}const O=ee.find(Y=>sa(Y.label)===ie);if(O&&!E.includes(O.value)){M(O.value);return}ae()},placeholder:s,className:b("min-w-0 flex-1 bg-transparent text-sm focus:outline-none","text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-faint)]")})]})]}),g&&z&&typeof document<"u"?zr.createPortal(r.jsxs("div",{ref:F,role:"listbox","aria-multiselectable":"true",className:b("z-[80] overflow-y-auto overscroll-contain rounded-[22px] p-2 [webkit-overflow-scrolling:touch]",T?"border border-[var(--ui-border-subtle)] bg-[color-mix(in_srgb,var(--ui-surface-1)_94%,transparent)] shadow-[var(--ui-shadow-floating)]":"border border-[var(--ui-border-subtle)] bg-[color-mix(in_srgb,var(--ui-surface-1)_96%,transparent)] shadow-[var(--ui-shadow-floating)]","backdrop-blur-xl"),style:z,children:[V.map((C,J)=>r.jsx("button",{type:"button",role:"option","aria-selected":!1,className:b("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",J===v?"bg-[var(--ui-surface-3)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>y(J),onMouseDown:O=>O.preventDefault(),onPointerDown:O=>{O.preventDefault(),M(C.value)},onClick:()=>M(C.value),children:r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"truncate text-sm font-medium",children:C.kind?r.jsx(et,{kind:C.kind,label:C.label,compact:!0,gradient:!1}):C.menuBadge?C.menuBadge:C.badge?C.badge:C.label}),C.description?r.jsx("div",{className:b("mt-1 text-xs leading-5","text-[var(--ui-ink-soft)]"),children:C.description}):null]})},C.value)),!k&&ie&&i?r.jsxs("button",{type:"button",disabled:_,className:b("mt-1 flex w-full items-center gap-2 rounded-[18px] px-3 py-2.5 text-left text-sm transition disabled:opacity-50","text-[var(--secondary)] hover:bg-[var(--ui-surface-hover)]"),onMouseDown:C=>C.preventDefault(),onPointerDown:C=>{C.preventDefault(),ae()},onClick:()=>void ae(),children:[r.jsx(Wr,{className:"size-4"}),r.jsx("span",{className:"truncate",children:_?"Creating…":`${o} "${p.trim()}"`})]}):null,V.length===0&&(!ie||k||!i)?r.jsx("div",{className:b("px-3 py-2.5 text-sm","text-[var(--ui-ink-soft)]"),children:n}):null]}),document.body):null,w?r.jsx("div",{className:"text-sm text-[color-mix(in_srgb,var(--danger)_74%,var(--ui-ink-strong)_26%)]",children:w}):null]})}const Xd={sm:"text-base",md:"text-lg",lg:"text-2xl",xl:"text-3xl"},na={1:"truncate whitespace-nowrap",2:"overflow-hidden whitespace-normal [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2]",3:"overflow-hidden whitespace-normal [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:3]"};function gr({kind:e,label:t,variant:a="inline",size:s="md",showKind:n=!1,showIcon:o=!0,showBadge:i=!1,badgeLabel:l,badgeCompact:u=!0,badgeGradient:p=!1,lines:m=1,labelClassName:g,className:f,...v}){const y=Vr(e),_=y.icon;return a==="pill"?r.jsxs("span",{className:b("inline-flex max-w-full items-center gap-2 rounded-full border px-4 py-2 font-medium shadow-[var(--ui-shadow-soft)]",y.badgeClassName,f),...v,children:[o?r.jsx(_,{className:b("size-4 shrink-0",y.iconClassName)}):null,r.jsx("span",{className:b("min-w-0 max-w-full",na[m],g),children:t})]}):a==="heading"?r.jsxs("span",{className:b("inline-flex max-w-full min-w-0 items-center gap-3",f),...v,children:[i?r.jsx(et,{kind:e,label:l??y.label,compact:u,gradient:p,className:"shrink-0"}):null,n&&!i?r.jsx(et,{kind:e,label:l??y.label,compact:!0,gradient:!1,className:"shrink-0"}):null,r.jsx("span",{className:b("min-w-0 max-w-full font-display leading-tight",Xd[s],na[m],y.nameClassName,g),children:t})]}):r.jsxs("span",{className:b("inline-flex max-w-full min-w-0 items-center gap-2",f),...v,children:[o?r.jsx(_,{className:b("size-4 shrink-0",y.iconClassName)}):null,i?r.jsx(et,{kind:e,label:l??y.label,compact:u,gradient:p,className:"shrink-0"}):null,n?r.jsx("span",{className:b("text-sm font-medium",y.nameClassName),children:y.label}):null,r.jsx("span",{className:b("min-w-0 max-w-full",na[m],y.nameClassName,g),children:t})]})}function ve({className:e,size:t,...a}){return r.jsx("input",{...a,className:b("interactive-tap w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-[15px] text-[var(--ui-ink-strong)] outline-none ring-0 placeholder:text-[var(--ui-ink-faint)] transition focus:border-[var(--primary)]/35 focus:bg-[var(--ui-surface-3)]",e)})}function mo(e){return e.map(t=>(t==null?void 0:t.trim())??"").filter(Boolean)}function Qd(e){return Array.isArray(e)?e:[]}function Bw(e){const t=Qd(e);return t.length===1?t[0]:null}function Qe(e){return e?`${e.displayName} · ${e.kind}${e.handle?` · @${e.handle}`:""}`:""}function Va(e,t="Default Forge owner"){return e?`Suggested owner: ${e.displayName} · ${e.kind}`:t}function Kw(e,t){const a=Qe(t);return a?`${e} · ${a}`:e}function Hw(e,t,a="No description yet."){return mo([e,Qe(t)]).join(" · ")||a}function Uw(e,t){const a=t&&"user"in t?t.user:t;return mo([...e,a==null?void 0:a.displayName,a==null?void 0:a.handle,a==null?void 0:a.kind,a==null?void 0:a.description]).join(" ").toLowerCase()}const Yd=["goal","project","task","strategy","habit","note","insight","calendar_event","work_block_template","task_timebox","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","flashcard","trigger_report"];function wa(e){return e.map(t=>(t==null?void 0:t.trim())??"").filter(Boolean)}function Ce(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function Zd(e){if(!e||typeof e!="object")return null;const t=e,a=Ce(t.id),s=Ce(t.kind),n=Ce(t.displayName);return!a||!n||s!=="human"&&s!=="bot"?null:{id:a,kind:s,displayName:n,handle:Ce(t.handle)??"",description:Ce(t.description)??"",accentColor:Ce(t.accentColor)??"",createdAt:Ce(t.createdAt)??"",updatedAt:Ce(t.updatedAt)??""}}function eu(e){return e==="create"||e==="new"||e.startsWith("create ")||e.startsWith("new ")}function tu(e){return e==="create"||e==="new"?"":e.startsWith("create ")?e.slice(7).trim():e.startsWith("new ")?e.slice(4).trim():null}function ar(e){return e.trim().toLowerCase()}function ru(e,t){return e==="note"?Gn(e,{noteKind:Ce(t==null?void 0:t.kind)==="wiki"?"wiki":"evidence"}):Gn(e)}function Jr(e,t){switch(e){case"goal":return"Goal";case"project":return"Project";case"task":return"Task";case"strategy":return"Strategy";case"habit":return"Habit";case"note":return Ce(t==null?void 0:t.kind)==="wiki"?"Wiki page":"Note";case"insight":return"Insight";case"calendar_event":return"Calendar event";case"work_block_template":return"Work block";case"task_timebox":return"Timebox";case"psyche_value":return"Value";case"behavior_pattern":return"Pattern";case"behavior":return"Behavior";case"belief_entry":return"Belief";case"mode_profile":return"Mode";case"flashcard":return"Flashcard";case"trigger_report":return"Report";default:return e.replaceAll("_"," ")}}const Jn=[{id:"goal",family:"entity-type",label:"Goal",kind:"goal",searchText:"goal life goal direction",entityTypes:["goal"]},{id:"project",family:"entity-type",label:"Project",kind:"project",searchText:"project initiative",entityTypes:["project"]},{id:"task",family:"entity-type",label:"Task",kind:"task",searchText:"task action work item",entityTypes:["task"]},{id:"strategy",family:"entity-type",label:"Strategy",kind:"strategy",searchText:"strategy plan sequence roadmap",entityTypes:["strategy"]},{id:"habit",family:"entity-type",label:"Habit",kind:"habit",searchText:"habit recurring routine",entityTypes:["habit"]},{id:"note",family:"entity-type",label:"Note",kind:"note",searchText:"note evidence scratch note",entityTypes:["note"]},{id:"wiki_page",family:"entity-type",label:"Wiki page",kind:"wiki_page",searchText:"wiki page karpawiki article knowledge page",entityTypes:["note"]},{id:"calendar_event",family:"entity-type",label:"Calendar event",kind:"calendar_event",searchText:"calendar event meeting block schedule",entityTypes:["calendar_event"]},{id:"psyche_value",family:"entity-type",label:"Value",kind:"value",searchText:"value psyche value",entityTypes:["psyche_value"]},{id:"behavior_pattern",family:"entity-type",label:"Pattern",kind:"pattern",searchText:"pattern loop psyche pattern",entityTypes:["behavior_pattern"]},{id:"behavior",family:"entity-type",label:"Behavior",kind:"behavior",searchText:"behavior psyche behavior",entityTypes:["behavior"]},{id:"belief_entry",family:"entity-type",label:"Belief",kind:"belief",searchText:"belief schema belief entry",entityTypes:["belief_entry"]},{id:"mode_profile",family:"entity-type",label:"Mode",kind:"mode",searchText:"mode profile psyche mode",entityTypes:["mode_profile"]},{id:"flashcard",family:"entity-type",label:"Flashcard",kind:"flashcard",searchText:"flashcard card urge trigger reminder psyche",entityTypes:["flashcard"]},{id:"trigger_report",family:"entity-type",label:"Report",kind:"report",searchText:"report trigger report psyche report",entityTypes:["trigger_report"]}];function po(e,t){return(e==="belief_entry"?[t.statement,t.title,t.name]:e==="flashcard"?[t.title,t.message,t.triggerSentence]:e==="note"?[t.title,t.slug]:[t.title,t.displayName,t.statement,t.name,t.label,t.slug]).map(Ce).find(Boolean)??`${Jr(e,t)} ${String(t.id??"")}`}function ho(e,t){const a=[t.summary,t.description,t.overview,t.flexibleAlternative,t.originNote,t.endState,t.whyItMatters,t.valuedDirection,t.triggerSentence,t.triggerSituation,t.contentPlain].map(Ce).find(Boolean),s=[t.goalTitle,t.projectTitle,t.status,t.kind].map(Ce).find(Boolean),n=Qe(Zd(t.user)),o=wa([e==="note"?Jr(e,t):null,n||null]).join(" · ");return wa([a,s,n||null]).join(" · ")||o}function au(e,t){return wa([po(e,t),ho(e,t),Jr(e,t),Ce(t.slug),Ce(t.handle)]).join(" ").toLowerCase()}function su(e,t,a){switch(e){case"goal":return`/goals/${encodeURIComponent(t)}`;case"project":return`/projects/${encodeURIComponent(t)}`;case"task":return`/tasks/${encodeURIComponent(t)}`;case"strategy":return`/strategies/${encodeURIComponent(t)}`;case"habit":return`/habits?focus=${encodeURIComponent(t)}`;case"note":{const s=Ce(a.kind),n=Ce(a.slug),o=Ce(a.spaceId);if(s==="wiki"&&n){const i=o?`?spaceId=${encodeURIComponent(o)}`:"";return`/wiki/page/${encodeURIComponent(n)}${i}`}return"/notes"}case"insight":return"/insights";case"calendar_event":case"work_block_template":case"task_timebox":return"/calendar";case"psyche_value":return`/psyche/values?focus=${encodeURIComponent(t)}`;case"behavior_pattern":return`/psyche/patterns?focus=${encodeURIComponent(t)}`;case"behavior":return`/psyche/behaviors?focus=${encodeURIComponent(t)}`;case"belief_entry":return`/psyche/schemas-beliefs?focus=${encodeURIComponent(t)}`;case"mode_profile":return`/psyche/modes?focus=${encodeURIComponent(t)}`;case"flashcard":return`/psyche/flashcards?focus=${encodeURIComponent(t)}`;case"trigger_report":return`/psyche/reports/${encodeURIComponent(t)}`;default:return null}}function ka(e,t,a){const s=ar(e);if(!s)return 0;const n=ar(t),o=ar(a),i=s.split(/\s+/).filter(Boolean);let l=0;n===s&&(l+=400),n.startsWith(s)&&(l+=240),n.includes(s)&&(l+=180),o.startsWith(s)&&(l+=32),o.includes(s)&&(l+=20);for(const u of i)n.startsWith(u)?l+=36:n.includes(u)&&(l+=24),o.includes(u)&&(l+=12);return l}function go(e){if(e.length===0)return Yd;const t=new Set;return e.forEach(a=>{a.entityTypes.forEach(s=>t.add(s))}),Array.from(t)}function nu(e,t,a){if(!e.entityTypes.includes(t))return!1;if(t!=="note")return!0;const s=Ce(a.kind);return e.id==="wiki_page"?s==="wiki":e.id==="note"?s!=="wiki":!0}function iu(e,t,a){if(a.length===0)return!0;const s=new Map;a.forEach(n=>{const o=s.get(n.family)??[];o.push(n),s.set(n.family,o)});for(const n of s.values())if(!n.some(i=>nu(i,e,t)))return!1;return!0}function ou(e,t){if(t.length===0)return!0;const a=new Set(t.filter(s=>s.family==="entity-type").map(s=>s.id));return a.size===0?!0:e.filterIds.some(s=>a.has(s))}function lu(e,t){const a=ar(e);if(!eu(a))return[];const s=tu(a);return s===null?[]:t.map(n=>{const o=[n.title,n.quickActionTitle,n.description,...n.aliases].join(" ").toLowerCase(),i=s.length===0?1:ka(s,n.quickActionTitle,o);return{...n,score:i}}).filter(n=>n.score>0).sort((n,o)=>o.score-n.score||n.quickActionTitle.localeCompare(o.quickActionTitle))}const cu=new Set(go([]));function du(e){return typeof e=="string"&&cu.has(e)}function Se(e,t){const a=t??gt;switch(e){case"action":return{icon:Wr,tileClassName:"border-emerald-300/18 bg-emerald-300/12 text-emerald-100 shadow-[0_18px_36px_rgba(52,211,153,0.12)]",badgeClassName:"border-emerald-300/18 bg-emerald-300/10 text-emerald-100"};case"wiki":return{icon:La,tileClassName:"border-blue-300/18 bg-blue-300/12 text-blue-100 shadow-[0_18px_36px_rgba(96,165,250,0.12)]",badgeClassName:"border-blue-300/18 bg-blue-300/10 text-blue-100"};case"note":return{icon:Pt,tileClassName:"border-amber-300/18 bg-amber-300/12 text-amber-100 shadow-[0_18px_36px_rgba(251,191,36,0.12)]",badgeClassName:"border-amber-300/18 bg-amber-300/10 text-amber-100"};case"insight":return{icon:_i,tileClassName:"border-emerald-300/18 bg-emerald-300/12 text-emerald-100 shadow-[0_18px_36px_rgba(52,211,153,0.12)]",badgeClassName:"border-emerald-300/18 bg-emerald-300/10 text-emerald-100"};case"calendar":return{icon:Ot,tileClassName:"border-cyan-300/18 bg-cyan-300/12 text-cyan-100 shadow-[0_18px_36px_rgba(34,211,238,0.12)]",badgeClassName:"border-cyan-300/18 bg-cyan-300/10 text-cyan-100"};case"route":return{icon:a,tileClassName:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-soft)]",badgeClassName:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]"};default:return{icon:a,tileClassName:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-soft)]",badgeClassName:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]"}}}function uu({item:e}){if(e.kind){const s=Vr(e.kind),n=s.icon;return r.jsx("span",{className:b("mt-0.5 inline-flex size-11 shrink-0 items-center justify-center rounded-[17px] border",s.subtleBadgeClassName),children:r.jsx(n,{className:b("size-5",s.iconClassName)})})}const t=Se("search",e.icon),a=e.icon??t.icon;return r.jsx("span",{className:b("mt-0.5 inline-flex size-11 shrink-0 items-center justify-center rounded-[17px] border",e.tileClassName??t.tileClassName),children:r.jsx(a,{className:"size-5"})})}function mu({item:e}){if(e.kind&&e.section==="results")return r.jsx(et,{kind:e.kind,label:e.category,compact:!0,gradient:!1});const t=Se(e.section==="quick-actions"?"action":"search",e.icon),a=e.icon??t.icon;return r.jsxs("span",{className:b("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium",e.badgeClassName??t.badgeClassName),children:[r.jsx(a,{className:"size-3.5"}),e.category]})}function Fe(e,t,a){return`${e} ${t} ${a}`.trim().toLowerCase()}function pu({open:e,onOpenChange:t,snapshot:a,selectedUserIds:s,createActions:n}){var V;const o=Aa(),{t:i}=De(),l=c.useRef([]),[u,p]=c.useState(""),[m,g]=c.useState(0),[f,v]=c.useState([]),y=c.useDeferredValue(u),_=ar(y),h=c.useMemo(()=>Jn.filter(k=>f.includes(k.id)),[f]);c.useEffect(()=>{e||(p(""),g(0),v([]))},[e]);const w=c.useMemo(()=>Jn.map(k=>({value:k.id,label:k.label,description:k.id==="wiki_page"?"Search only KarpaWiki pages.":k.id==="note"?"Search notes and evidence that are not wiki pages.":`Search ${k.label.toLowerCase()} records.`,searchText:k.searchText,kind:k.kind})),[]),P=c.useMemo(()=>({routes:i("common.actionBar.sections.routes"),recent:i("common.actionBar.sections.recent"),"quick-actions":i("common.actionBar.sections.quickActions"),results:i("common.actionBar.sections.results")}),[i]),x=c.useMemo(()=>[{id:"route-overview",title:i("common.routeLabels.overview"),detail:i("common.commandPalette.routeOverview"),href:"/overview",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.overview"),i("common.commandPalette.routeOverview"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Ei)},{id:"route-today",title:i("common.routeLabels.today"),detail:i("common.commandPalette.routeToday"),href:"/today",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.today"),i("common.commandPalette.routeToday"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",qr)},{id:"route-kanban",title:i("common.routeLabels.kanban"),detail:i("common.commandPalette.routeKanban"),href:"/kanban",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.kanban"),i("common.commandPalette.routeKanban"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",ur)},{id:"route-psyche",title:i("common.routeLabels.psyche"),detail:i("common.commandPalette.routePsyche"),href:"/psyche",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.psyche"),i("common.commandPalette.routePsyche"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Oa)},{id:"route-notes",title:i("common.routeLabels.notes"),detail:i("common.commandPalette.routeNotes"),href:"/notes",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.notes"),i("common.commandPalette.routeNotes"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Pt)},{id:"route-wiki",title:i("common.routeLabels.wiki"),detail:i("common.commandPalette.routeWiki"),href:"/wiki",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.wiki"),i("common.commandPalette.routeWiki"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",La)},{id:"route-goals",title:i("common.routeLabels.goals"),detail:i("common.commandPalette.routeGoals"),href:"/goals",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.goals"),i("common.commandPalette.routeGoals"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Ra)},{id:"route-habits",title:i("common.routeLabels.habits"),detail:i("common.commandPalette.routeHabits"),href:"/habits",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.habits"),i("common.commandPalette.routeHabits"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Ea)},{id:"route-projects",title:i("common.routeLabels.projects"),detail:i("common.commandPalette.routeProjects"),href:"/projects",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.projects"),i("common.commandPalette.routeProjects"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Ai)},{id:"route-strategies",title:i("common.routeLabels.strategies"),detail:i("common.commandPalette.routeStrategies"),href:"/strategies",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.strategies"),i("common.commandPalette.routeStrategies"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Kt)},{id:"route-preferences",title:i("common.routeLabels.preferences"),detail:i("common.commandPalette.routePreferences"),href:"/preferences",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.preferences"),i("common.commandPalette.routePreferences"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Da)},{id:"route-calendar",title:i("common.routeLabels.calendar"),detail:i("common.commandPalette.routeCalendar"),href:"/calendar",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.calendar"),i("common.commandPalette.routeCalendar"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Ot)},{id:"route-knowledge-graph",title:"Knowledge Graph",detail:"Open the world model and graph views for Forge.",href:"/knowledge-graph",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe("Knowledge Graph","Open the world model and graph views for Forge.",i("common.commandPalette.categoryRoute")),score:0,...Se("route",_a)},{id:"route-settings",title:i("common.routeLabels.settings"),detail:i("common.commandPalette.routeSettings"),href:"/settings",category:i("common.commandPalette.categoryRoute"),section:"routes",searchText:Fe(i("common.routeLabels.settings"),i("common.commandPalette.routeSettings"),i("common.commandPalette.categoryRoute")),score:0,...Se("route",Fr)}],[i]),$=c.useMemo(()=>{const k=[...a.overview.topTasks.slice(0,4).map(M=>({id:`task-${M.id}`,title:M.title,detail:Qe(M.user)||i("common.commandPalette.openFocusTask"),href:`/tasks/${M.id}`,category:i("common.commandPalette.categoryTask"),section:"recent",searchText:`${M.title} ${Qe(M.user)}`.toLowerCase(),score:0,kind:"task"})),...a.dashboard.projects.slice(0,3).map(M=>({id:`project-${M.id}`,title:M.title,detail:[M.goalTitle,Qe(M.user)].filter(Boolean).join(" · "),href:`/projects/${M.id}`,category:i("common.commandPalette.categoryProject"),section:"recent",searchText:`${M.title} ${M.goalTitle??""} ${Qe(M.user)}`.toLowerCase(),score:0,kind:"project"})),...a.overview.activeGoals.slice(0,2).map(M=>({id:`goal-${M.id}`,title:M.title,detail:Qe(M.user)||i("common.commandPalette.openLifeGoal"),href:`/goals/${M.id}`,category:i("common.commandPalette.categoryGoal"),section:"recent",searchText:`${M.title} ${Qe(M.user)}`.toLowerCase(),score:0,kind:"goal"})),...a.dashboard.habits.slice(0,2).map(M=>({id:`habit-${M.id}`,title:M.title,detail:[M.frequency==="daily"?"Daily habit":"Weekly habit",Qe(M.user)].filter(Boolean).join(" · "),href:`/habits?focus=${M.id}`,category:i("common.routeLabels.habits"),section:"recent",searchText:`${M.title} ${M.frequency} ${Qe(M.user)}`.toLowerCase(),score:0,kind:"habit"}))].slice(0,8);return[...x.slice(0,6),...k]},[x,a,i]),S=Hr({queryKey:["forge-action-bar-search",_,[...f].sort().join("|"),[...s].sort().join("|")],enabled:e&&(_.length>0||h.length>0),queryFn:async()=>{const k=go(h),M=await no({searches:k.map(ae=>({entityTypes:[ae],query:y.trim()||void 0,userIds:s.length>0?s:void 0,limit:ae==="note"?6:4,clientRef:ae}))}),oe=new Map;for(const ae of M.results){const C=Array.isArray(ae.matches)?ae.matches??[]:[];for(const J of C){if(!J||typeof J!="object")continue;const O=J;if(!du(O.entityType)||typeof O.id!="string"||!O.entity||typeof O.entity!="object")continue;const Y=O.entity;if(!iu(O.entityType,Y,h))continue;const A=su(O.entityType,O.id,Y);if(!A)continue;const Z=po(O.entityType,Y),pe=ho(O.entityType,Y),Oe=Jr(O.entityType,Y),Ae=au(O.entityType,Y),Te=ru(O.entityType,Y)??void 0,ye=_.length>0?ka(y,Z,Ae):0;let be=Se("search");O.entityType==="note"?be=Se(Y.kind==="wiki"?"wiki":"note"):O.entityType==="insight"?be=Se("insight"):(O.entityType==="calendar_event"||O.entityType==="task_timebox"||O.entityType==="work_block_template")&&(be=Se("calendar"));const Ie={id:`${O.entityType}-${O.id}`,title:Z,detail:pe,href:A,category:Oe,section:"results",searchText:Ae,score:ye,kind:Te,icon:be.icon,tileClassName:be.tileClassName,badgeClassName:be.badgeClassName},we=oe.get(Ie.id);(!we||Ie.score>we.score||Ie.score===we.score&&Ie.title<we.title)&&oe.set(Ie.id,Ie)}}return Array.from(oe.values()).sort((ae,C)=>C.score!==ae.score?C.score-ae.score:ae.title.localeCompare(C.title)).slice(0,12)}}),F=c.useMemo(()=>_?x.map(k=>({...k,score:ka(y,k.title,k.searchText)})).filter(k=>k.score>0).sort((k,M)=>M.score-k.score||k.title.localeCompare(M.title)).slice(0,4):[],[y,_,x]),N=c.useMemo(()=>lu(y,n).filter(k=>ou(k,h)).slice(0,6).map(k=>({id:`quick-${k.id}`,title:k.quickActionTitle,detail:k.description,category:"Quick action",section:"quick-actions",searchText:`${k.quickActionTitle} ${k.description} ${k.aliases.join(" ")}`.toLowerCase(),score:k.score,onSelect:k.onSelect,...Se("action",Wr)})),[n,y,h]),E=c.useMemo(()=>{if(!_&&h.length===0)return $;const k=[...N,...F],M=new Set(k.map(oe=>oe.id));for(const oe of S.data??[])M.has(oe.id)||(M.add(oe.id),k.push(oe));return k.slice(0,16)},[$,S.data,_,N,F,h.length]);c.useEffect(()=>{g(0)},[_,e,f.join("|")]),c.useEffect(()=>{E.length!==0&&g(k=>Math.min(Math.max(k,0),E.length-1))},[E]),c.useEffect(()=>{const k=l.current[m];k==null||k.scrollIntoView({block:"nearest"})},[m]);const T=E[m]??null,z=a.users.filter(k=>s.includes(k.id)),ee=s.length===0?"All humans and bots":z.length===1?((V=z[0])==null?void 0:V.displayName)??"1 selected owner":`${z.length||s.length} selected owners`,ne=(_.length>0||h.length>0)&&S.isFetching,ie=k=>{if(t(!1),k.onSelect){k.onSelect();return}k.href&&o(k.href)};return r.jsx(ft,{open:e,onOpenChange:t,children:r.jsxs(yt,{children:[r.jsx(xt,{className:"surface-overlay fixed inset-0 z-40 backdrop-blur-xl"}),r.jsxs(vt,{className:"surface-modal-panel fixed inset-x-3 bottom-3 top-3 z-50 flex flex-col overflow-hidden rounded-[30px] border sm:inset-x-6 sm:bottom-6 sm:top-6 md:left-1/2 md:right-auto md:top-[9vh] md:h-[min(82vh,48rem)] md:w-[min(64rem,calc(100vw-2rem))] md:-translate-x-1/2 md:bottom-auto",children:[r.jsx(bt,{className:"sr-only",children:i("common.actionBar.title")}),r.jsx(wt,{className:"sr-only",children:i("common.actionBar.description")}),r.jsxs("div",{className:"border-b border-[var(--ui-border-subtle)] px-4 py-4 sm:px-5",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-1.5 text-[12px] text-[var(--ui-ink-medium)]",children:[r.jsx("span",{className:"rounded-full bg-[var(--ui-surface-2)] px-2 py-0.5 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Scope"}),r.jsx("span",{children:ee})]}),h.length>0?r.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-1.5 text-[12px] text-[var(--ui-ink-medium)]",children:[r.jsx(hl,{className:"size-3.5 text-[var(--ui-ink-faint)]"}),r.jsxs("span",{children:[h.length," filter",h.length===1?"":"s"]})]}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[r.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Shift Shift"}),r.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Cmd/Ctrl K"})]})]}),r.jsxs("div",{className:"mt-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-4 shadow-[inset_0_1px_0_var(--ui-border-subtle)]",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(gt,{className:"size-5 text-[var(--ui-ink-faint)]"}),r.jsx(ve,{autoFocus:!0,value:u,onChange:k=>p(k.target.value),onKeyDown:k=>{if(k.key==="ArrowDown"){k.preventDefault(),g(M=>E.length===0?0:Math.min(M+1,E.length-1));return}if(k.key==="ArrowUp"){k.preventDefault(),g(M=>Math.max(M-1,0));return}if(k.key==="Enter"&&T){k.preventDefault(),ie(T);return}k.key==="Escape"&&(k.preventDefault(),t(!1))},placeholder:i("common.actionBar.searchPlaceholder"),className:"border-0 bg-transparent px-0 py-0 text-[1rem] focus:border-0"}),ne?r.jsx(Ci,{className:"size-4 shrink-0 animate-spin text-[var(--ui-ink-faint)]"}):null]}),r.jsx("div",{className:"mt-2 pl-8 text-[13px] leading-6 text-[var(--ui-ink-soft)]",children:i(_?"common.actionBar.activeHint":"common.actionBar.idleHint")}),r.jsxs("div",{className:"mt-4 border-t border-[var(--ui-border-subtle)] pt-4",children:[r.jsx("div",{className:"mb-2 pl-1 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:i("common.actionBar.filtersLabel")}),r.jsx(Jd,{options:w,selectedValues:f,onChange:v,placeholder:i("common.actionBar.filtersPlaceholder"),emptyMessage:i("common.actionBar.filtersEmpty"),variant:"action-bar"})]})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3 sm:px-4",children:E.length===0?r.jsx("div",{className:"rounded-[24px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-8 text-center text-sm text-[var(--ui-ink-soft)]",children:S.isFetching?i("common.actionBar.searching"):h.length>0?i("common.actionBar.noResultsWithFilters"):i("common.actionBar.noResults")}):r.jsx("div",{className:"grid gap-2",children:E.map((k,M)=>{var C;const ae=(((C=E[M-1])==null?void 0:C.section)??null)!==k.section;return r.jsxs("div",{children:[ae?r.jsx("div",{className:"px-2 pb-1 pt-2 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)] first:pt-0",children:P[k.section]}):null,r.jsxs("button",{ref:J=>{l.current[M]=J},type:"button",className:b("group flex w-full items-start gap-3 rounded-[24px] border px-4 py-3.5 text-left transition",M===m?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-3)] shadow-[var(--ui-shadow-soft)]":"border-transparent bg-[var(--ui-surface-1)] hover:border-[var(--ui-border-subtle)] hover:bg-[var(--ui-surface-hover)]"),onMouseEnter:()=>g(M),onClick:()=>ie(k),children:[r.jsx(uu,{item:k}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:r.jsx(mu,{item:k})}),r.jsx("div",{className:"mt-2 text-[15px] font-medium text-[var(--ui-ink-strong)]",children:k.kind&&k.section==="results"?r.jsx(gr,{kind:k.kind,label:k.title,showIcon:!1,labelClassName:"text-[var(--ui-ink-strong)]"}):k.title}),r.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:k.detail})]}),r.jsx(Ri,{className:b("mt-1 size-4 shrink-0 transition",M===m?"text-[var(--ui-ink-medium)]":"text-[var(--ui-ink-faint)] group-hover:text-[var(--ui-ink-soft)]")})]})]},k.id)})})}),r.jsx("div",{className:"border-t border-[var(--ui-border-subtle)] px-4 py-3 sm:px-5",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12px] text-[var(--ui-ink-faint)]",children:[r.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Up/Down navigate"}),r.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Enter open"}),r.jsx("span",{className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1",children:"Esc close"})]})})]})]})})}function Xn({routeKey:e,tone:t="core",children:a}){return r.jsx(ht.div,{"data-route-key":e,"data-route-tone":t,className:"w-full max-w-full min-w-0",initial:!1,animate:{opacity:1,y:0},transition:{duration:.12,ease:"easeOut"},children:a})}const hu={spark:"Spark stage",story:"Story stage",state:"State stage",lens:"Lens stage",pivot:"Pivot stage"};function gu(e,t){return`${e}:${t}`}function Gw(e,t,a){return(e==null?void 0:e[gu(t,a)])??{count:0,latestNoteId:null,latestCreatedAt:null}}function Vw(e){return`${e} Note${e===1?"":"s"}`}function fu(e){return e.replaceAll("_"," ")}function yu(e){if(!e)return null;const t=e.trim().toLowerCase(),a=hu[t];return a||t.split(/[_\-\s]+/).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function Jw(e,t){const a=yu(t);return a?e==="trigger_report"?`This note is pinned to the ${a.toLowerCase()} of the report, so it stays attached to that part of the reflective chain.`:`This note is pinned to the "${a}" section of the ${fu(e)} instead of only the whole entity.`:null}function fo(e,t){switch(e){case"goal":return`/goals/${t}`;case"project":return`/projects/${t}`;case"task":return`/tasks/${t}`;case"strategy":return`/strategies/${t}`;case"psyche_value":return`/psyche/values?focus=${t}#values-atlas`;case"behavior_pattern":return`/psyche/patterns?focus=${t}#pattern-lanes`;case"behavior":return`/psyche/behaviors?focus=${t}#behavior-columns`;case"belief_entry":return`/psyche/schemas-beliefs?focus=${t}`;case"mode_profile":return`/psyche/modes?focus=${t}`;case"flashcard":return`/psyche/flashcards?focus=${t}`;case"trigger_report":return`/psyche/reports/${t}`;default:return null}}function yo(e,t){switch(e){case"goal":case"project":case"task":case"strategy":case"trigger_report":{const a=fo(e,t);return a?`${a}#notes`:null}default:return`/notes?entityType=${encodeURIComponent(e)}&entityId=${encodeURIComponent(t)}`}}function Xw(e){return e.links.find(t=>fo(t.entityType,t.entityId)!==null)??e.links[0]??null}function xu(e){switch(e.entityType){case"workbench_flow":case"workbench_surface":case"wiki_space":return null;default:return yo(e.entityType,e.entityId)}}function vu({group:e,onSelectNode:t}){return e.relations.length===0?null:r.jsxs("section",{className:"grid gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:e.label}),r.jsxs("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:[e.itemCount," entities across ",e.relationCount," relation",e.relationCount===1?"":"s"]})]}),r.jsx(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] text-[var(--ui-ink-medium)]",children:e.family})]}),r.jsx("div",{className:"grid gap-3",children:e.relations.map(a=>r.jsxs("div",{className:"grid gap-2",children:[r.jsx("div",{className:"text-xs font-medium text-[var(--ui-ink-soft)]",children:a.label}),r.jsx("div",{className:"grid gap-2",children:a.items.map(s=>r.jsxs("button",{type:"button",className:"flex min-w-0 items-center justify-between gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] px-3 py-2 text-left transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",onClick:()=>t(s),children:[r.jsxs("span",{className:"min-w-0",children:[r.jsx(gr,{kind:s.entityKind,label:s.title,className:"max-w-full",lines:1}),s.subtitle?r.jsx("span",{className:"mt-1 block truncate text-[12px] text-[var(--ui-ink-soft)]",children:s.subtitle}):null]}),r.jsx(Br,{className:"size-4 shrink-0 text-[var(--ui-ink-faint)]"})]},s.id))})]},a.relationKind))})]})}function bu({focus:e,onOpenPage:t,onOpenNotes:a,onOpenHierarchy:s,onSelectNode:n,className:o}){var p;if(!e.focusNode)return r.jsx("div",{className:b("grid h-full place-items-center rounded-[24px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-6 text-center",o),children:r.jsxs("div",{className:"grid gap-2",children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Focus"}),r.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Select a node to inspect its structure, context, and nearby navigation paths."})]})});const i=e.focusNode,l=xu(i),u=Object.values(e.secondRingCounts).reduce((m,g)=>m+g,0);return r.jsxs("div",{className:b("grid gap-4",o),children:[r.jsxs("div",{className:"grid gap-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[linear-gradient(180deg,rgba(11,17,30,0.98),rgba(9,14,24,0.96))] p-4 shadow-[0_28px_90px_rgba(0,0,0,0.3)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx(et,{kind:i.entityKind,label:i.entityKind.replaceAll("_"," "),compact:!0}),r.jsx("div",{className:"mt-3",children:r.jsx(gr,{kind:i.entityKind,label:i.title,variant:"heading",size:"lg",lines:3,className:"max-w-full"})}),i.subtitle?r.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:i.subtitle}):null]}),r.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[(p=i.owner)!=null&&p.displayName?r.jsx(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:i.owner.displayName}):null,i.updatedAt?r.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Updated ",vc(i.updatedAt)]}):null]})]}),i.description?r.jsx("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:i.description}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.previewStats.map(m=>r.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[m.label,": ",m.value]},`${m.label}-${m.value}`)),r.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Degree: ",i.graphStats.degree]}),r.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Structural: ",i.graphStats.structuralDegree]}),r.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Contextual: ",i.graphStats.contextualDegree]}),r.jsxs(le,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Nearby second ring: ",u]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.href?r.jsxs(ue,{variant:"secondary",onClick:()=>t(i),children:[r.jsx(Br,{className:"size-4"}),"Open page"]}):null,l?r.jsxs(ue,{variant:"secondary",onClick:()=>a(i),children:[r.jsx(Pt,{className:"size-4"}),"Open notes"]}):null,r.jsxs(ue,{variant:"secondary",onClick:()=>s(i),children:[r.jsx(Li,{className:"size-4"}),"Open in hierarchy"]})]})]}),r.jsx("div",{className:"grid gap-4",children:e.familyGroups.length>0?e.familyGroups.map(m=>r.jsx(vu,{group:m,onSelectNode:n},m.family)):r.jsx("div",{className:"rounded-[20px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-5 text-sm text-[var(--ui-ink-soft)]",children:"This node has no explicit first-ring relationships in the current graph filters."})})]})}function wu({focus:e,onOpenPage:t,onOpenNotes:a,onOpenHierarchy:s,onSelectNode:n,onClose:o}){return r.jsxs("aside",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--ui-border-subtle)] px-4 py-3",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-soft)]",children:[r.jsx(gl,{className:"size-3.5"}),"Focus Node"]}),o?r.jsxs(ue,{variant:"secondary",size:"sm",onClick:o,children:[r.jsx(dt,{className:"size-4"}),"Close"]}):null]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4 pt-3",children:r.jsx(bu,{focus:e,onOpenPage:t,onOpenNotes:a,onOpenHierarchy:s,onSelectNode:n})})]})}const Et=16,ku=320,ju=180,Su=220;function Nu({children:e,className:t}){return r.jsx("div",{className:b("text-sm leading-6 text-[var(--ui-ink-soft)]",t),children:e})}function zt({content:e,title:t,label:a="Explain this field",className:s,panelClassName:n,maxWidthPx:o=ku}){const[i,l]=c.useState(!1),[u,p]=c.useState({}),m=c.useRef(null),g=c.useRef(null),f=c.useId(),v=typeof document>"u"?null:zr.createPortal(r.jsxs("span",{id:f,role:"tooltip","aria-hidden":!i,"data-state":i?"open":"closed",style:u,className:b("pointer-events-none fixed z-[9999] grid overflow-y-auto rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-3 py-2.5 text-left font-sans text-sm normal-case leading-6 tracking-normal text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-floating)] backdrop-blur-xl transition",i?"translate-y-0 opacity-100":"translate-y-1 opacity-0",n),children:[t?r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--ui-ink-soft)]",children:t}):null,r.jsx("span",{className:"block min-w-0 whitespace-normal break-words",children:e})]}),document.body);return c.useLayoutEffect(()=>{if(!i)return;const y=()=>{const _=g.current;if(!_)return;const h=_.getBoundingClientRect(),w=window.innerWidth<480?window.innerWidth-Et*2:Math.min(o,window.innerWidth-Et*2),P=h.left+h.width/2-w/2,x=window.innerWidth-w-Et,$=Math.max(Et,Math.min(P,x)),F=window.innerHeight-h.bottom>=ju?h.bottom+8:Math.max(Et,h.top-Su);p({left:$,maxHeight:`calc(100vh - ${F+Et}px)`,top:F,width:w})};return y(),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0),()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0)}},[o,i]),c.useEffect(()=>{if(!i)return;const y=_=>{var h;(h=m.current)!=null&&h.contains(_.target)||l(!1)};return document.addEventListener("pointerdown",y),()=>document.removeEventListener("pointerdown",y)},[i]),r.jsxs("span",{ref:m,className:b("relative inline-flex items-center",s),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[r.jsx("button",{ref:g,type:"button","aria-label":a,"aria-describedby":i?f:void 0,"aria-expanded":i,className:"inline-flex size-5 items-center justify-center rounded-full text-[var(--ui-ink-faint)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-medium)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/35",onFocus:()=>l(!0),onBlur:()=>l(!1),onClick:()=>l(y=>!y),onKeyDown:y=>{y.key==="Escape"&&l(!1)},children:r.jsx(fl,{className:"size-3.5"})}),v]})}function fr({className:e,"aria-label":t="Close dialog",title:a="Close",...s}){return r.jsx("button",{type:"button","aria-label":t,title:a,className:b("inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/45",e),...s,children:r.jsx(dt,{className:"size-[1.05rem]"})})}const Qn="(max-width: 1023px)",Pu="forge.question-flow-draft",xo=1,Tu=1e3;function Iu({open:e,wasOpen:t,initialStepId:a,previousInitialStepId:s,currentStepIndex:n,steps:o}){if(!e)return 0;const i=()=>{if(!a)return 0;const u=o.findIndex(p=>p.id===a);return u>=0?u:0};return!t||s!==a?i():o.length===0?0:n>=o.length?Math.max(0,o.length-1):n<0?0:n}function Cu(e){const t=e.split(/\n\s*\n/g).map(a=>a.split(`
3
- `).map(s=>s.trim()).filter(s=>s.length>0)).filter(a=>a.length>0);return t.length===0?null:r.jsx("div",{className:"grid gap-2",children:t.map((a,s)=>{const n=a.filter(i=>i.startsWith("- ")),o=a.filter(i=>!i.startsWith("- "));return r.jsxs("div",{className:"grid gap-2",children:[o.map((i,l)=>r.jsx("p",{children:i},`${s}-${i}-${l}`)),n.length>0?r.jsx("ul",{className:"grid list-disc gap-1 pl-5",children:n.map((i,l)=>r.jsx("li",{children:i.slice(2)},`${s}-${i}-${l}`))}):null]},`section-${s}`)})})}function Ru(){const[e,t]=c.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(Qn).matches);return c.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(Qn),s=n=>{t(n.matches)};return t(a.matches),typeof a.addEventListener=="function"?(a.addEventListener("change",s),()=>a.removeEventListener("change",s)):(a.addListener(s),()=>a.removeListener(s))},[]),e}function Xr(){return typeof window<"u"&&typeof window.localStorage<"u"}function Ja(e){return`${Pu}.${e}`}function Yn(e){try{return JSON.stringify(e)}catch{return null}}function _u(e){if(!Xr())return null;try{const t=window.localStorage.getItem(Ja(e));if(!t)return null;const a=JSON.parse(t);return a.version!==xo||typeof a.baseline!="string"||typeof a.draft!="string"?null:a}catch{return null}}function Eu(e,t){if(Xr())try{window.localStorage.setItem(Ja(e),JSON.stringify(t))}catch{}}function Zn(e){if(Xr())try{window.localStorage.removeItem(Ja(e))}catch{}}function te({label:e,description:t,labelHelp:a,hint:s,error:n,children:o}){return r.jsxs("label",{className:"grid gap-2",children:[r.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-[var(--ui-ink-strong)]",children:[r.jsx("span",{children:e}),a?r.jsx(zt,{content:a,label:`Explain ${e}`}):null]}),t?r.jsx("span",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:t}):null,o,s?r.jsx(Nu,{children:s}):null,n?r.jsx("span",{className:"text-sm text-rose-300",children:n}):null]})}function Ye({options:e,value:t,onChange:a,columns:s=2}){return r.jsx("div",{className:b("grid gap-3",s===3?"md:grid-cols-3":"md:grid-cols-2"),children:e.map(n=>{const o=n.value===t;return r.jsxs("button",{type:"button",className:b("rounded-[22px] border px-4 py-4 text-left transition",o?"border-[var(--primary)]/28 bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)]"),onClick:()=>a(n.value),children:[r.jsx("div",{className:"font-medium",children:n.label}),n.description?r.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:n.description}):null]},n.value)})})}function Xa({open:e,onOpenChange:t,eyebrow:a,title:s,description:n,value:o,onChange:i,steps:l,onSubmit:u,submitLabel:p,pending:m=!1,pendingLabel:g,error:f,resolveError:v,initialStepId:y,contentClassName:_,draftPersistenceKey:h}){const{t:w}=De(),P=Ru(),[x,$]=c.useState(0),S=c.useRef(e),F=c.useRef(y),N=c.useRef(e),E=c.useRef(null),T=c.useRef(null),z=c.useRef(null),ee=c.useRef(o),ne=l[x];ee.current=o,c.useEffect(()=>{const O=S.current,Y=F.current,A=Iu({open:e,wasOpen:O,initialStepId:y,previousInitialStepId:Y,currentStepIndex:x,steps:l});S.current=e,F.current=y,A!==x&&$(A)},[y,e,x,l]);const ie=O=>{i({...o,...O})},V=l.length,k=V===0?0:(x+1)/V*100,M=ne?v==null?void 0:v(ne.id):void 0,oe=M===void 0?f:M,ae=c.useCallback(()=>{if(!h)return;const O=T.current,Y=Yn(ee.current);if(!(!O||!Y)){if(Y===O){Zn(h),z.current=Y;return}z.current!==Y&&(Eu(h,{version:xo,baseline:O,draft:Y,updatedAt:Date.now()}),z.current=Y)}},[h]);c.useEffect(()=>{if(!e){E.current=null;return}if(!h){T.current=null,z.current=null;return}const O=Yn(o);if(!O||E.current===h)return;E.current=h,T.current=O;const Y=_u(h);if(Y&&Y.baseline===O&&Y.draft!==O)try{i(JSON.parse(Y.draft)),z.current=Y.draft;return}catch{Zn(h)}z.current=O},[h,i,e,o]),c.useEffect(()=>{if(!h||!e||!Xr())return;const O=window.setInterval(()=>{ae()},Tu);return()=>window.clearInterval(O)},[h,e,ae]),c.useEffect(()=>{N.current&&!e&&ae(),N.current=e},[e,ae]);const C=O=>{ae(),$(O)},J=O=>{O||ae(),t(O)};return r.jsx(ft,{open:e,onOpenChange:J,children:r.jsxs(yt,{children:[r.jsx(xt,{className:"surface-overlay fixed inset-0 z-40 backdrop-blur-xl"}),r.jsxs(vt,{"data-testid":"question-flow-dialog",className:b("surface-modal-panel fixed z-50 flex flex-col overflow-hidden border",P?"inset-x-3 bottom-3 top-4 rounded-[30px]":"left-1/2 top-1/2 h-[min(52rem,calc(100vh-1rem))] w-[min(56rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 rounded-[34px]",_),children:[r.jsx(bt,{className:"sr-only",children:s}),r.jsx(wt,{className:"sr-only",children:n}),r.jsx("div",{className:"sticky top-0 z-10 border-b border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-4 py-2.5 backdrop-blur-xl md:px-6",children:r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:[r.jsx("span",{className:"truncate",children:a}),r.jsxs("span",{className:"shrink-0 text-right",children:["Step ",x+1," of ",V]})]}),r.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-[var(--ui-surface-2)]",children:r.jsx(ht.div,{className:"h-full rounded-full bg-[linear-gradient(90deg,var(--primary),var(--secondary))]",animate:{width:`${k}%`},transition:{duration:.35,ease:"easeOut"}})})]}),r.jsx(Dt,{asChild:!0,children:r.jsx(fr,{"aria-label":w("common.dialogs.closeDialog")})})]})}),r.jsx("div",{"data-testid":"question-flow-canvas",className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 md:px-6 md:py-5",children:r.jsx(Fa,{mode:"wait",children:r.jsx(ht.div,{initial:{opacity:0,y:18},animate:{opacity:1,y:0},exit:{opacity:0,y:-18},transition:{duration:.28,ease:"easeOut"},className:"flex min-h-full min-w-0 flex-col gap-5",children:r.jsxs("div",{className:"flex min-h-full min-w-0 flex-col justify-start",children:[ne.eyebrow?r.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--secondary)]",children:ne.eyebrow}):null,r.jsx("h3",{className:"mt-1.5 font-display text-[clamp(1.45rem,2.15vw,2rem)] leading-tight text-[var(--ui-ink-strong)]",children:ne.title}),ne.description?r.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:ne.description}):null,oe?r.jsx("div",{className:"mt-4 rounded-[20px] border border-[color-mix(in_srgb,var(--danger)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-danger-soft)] px-4 py-3 text-sm leading-6 text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:Cu(oe)}):null,r.jsx("div",{className:"mt-5 grid flex-1 content-start gap-5",children:ne.render(o,ie)})]})},ne.id)})}),r.jsx("div",{className:"sticky bottom-0 border-t border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-4 pt-2.5 pb-[calc(env(safe-area-inset-bottom)+0.75rem)] backdrop-blur-xl md:px-6 md:pb-3",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 sm:justify-between",children:[r.jsx("div",{className:"hidden min-w-0 shrink text-[12px] text-[var(--ui-ink-faint)] sm:block",children:r.jsxs("span",{className:"truncate",children:["Step ",x+1,"/",V]})}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center justify-end gap-1.5 sm:gap-2",children:[x>0?r.jsxs(ue,{type:"button",variant:"secondary",className:"min-w-0 px-3 text-[12px]",onClick:()=>C(Math.max(0,x-1)),children:[r.jsx(yl,{className:"size-4"}),"Back"]}):r.jsx(Dt,{asChild:!0,children:r.jsx(ue,{type:"button",variant:"secondary",className:"min-w-0 px-3 text-[12px]",children:w("common.actions.cancel")})}),x<V-1?r.jsxs(ue,{type:"button",className:"min-w-0 px-3 text-[12px]",onClick:()=>C(Math.min(V-1,x+1)),children:["Continue",r.jsx(Ri,{className:"size-4"})]}):r.jsxs(ue,{type:"button",className:"min-w-0 px-3 text-[12px]",pending:m,pendingLabel:g,onClick:()=>{ae(),u()},children:[r.jsx(Oi,{className:"size-4"}),p]})]})]})})]})]})})}const at=c.forwardRef(function({className:t,...a},s){return r.jsx("textarea",{ref:s,...a,className:b("min-h-28 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-[15px] text-[var(--ui-ink-strong)] outline-none ring-0 placeholder:text-[var(--ui-ink-faint)] transition focus:border-[var(--primary)]/35 focus:bg-[var(--ui-surface-3)]",t)})}),Au={contentMarkdown:"",author:""};function Lu(){return{...Au}}function Qa({notes:e,onChange:t,entityLabel:a}){return r.jsxs("div",{className:"grid gap-3",children:[e.length===0?r.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm leading-6 text-white/58",children:["Add an optional Markdown note if this ",a," should start with context, evidence, or a clear handoff summary."]}):null,e.map((s,n)=>r.jsxs("div",{className:"rounded-[20px] border border-white/8 bg-white/[0.04] p-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:["Creation note ",n+1]}),r.jsx(ue,{type:"button",variant:"ghost",size:"sm",onClick:()=>t(e.filter((o,i)=>i!==n)),children:"Remove"})]}),r.jsxs("div",{className:"mt-4 grid gap-4",children:[r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"text-sm text-white/58",children:"Author"}),r.jsx(ve,{value:s.author,placeholder:"Albert",onChange:o=>t(e.map((i,l)=>l===n?{...i,author:o.target.value}:i))})]}),r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"text-sm text-white/58",children:"Markdown note"}),r.jsx(at,{className:"min-h-28",value:s.contentMarkdown,placeholder:"Capture why this was created now, what changed, or what the next person should know.",onChange:o=>t(e.map((i,l)=>l===n?{...i,contentMarkdown:o.target.value}:i))})]})]})]},n)),r.jsx("div",{children:r.jsx(ue,{type:"button",variant:"secondary",onClick:()=>t([...e,Lu()]),children:"Add creation note"})})]})}function Ya({value:e,users:t,onChange:a,label:s="Owner",defaultLabel:n="Default Forge owner",help:o}){return r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"text-sm font-medium text-white",children:s}),o?r.jsx("span",{className:"text-xs leading-5 text-white/52",children:o}):null,r.jsxs("select",{value:e??"",onChange:i=>a(i.target.value||null),className:"min-h-10 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:[r.jsx("option",{value:"",children:n}),t.map(i=>r.jsxs("option",{value:i.id,children:[i.displayName," · ",i.kind]},i.id))]})]})}const Ou=["obsidian","solar","aurora","ember","paper","dawn","atelier","custom","system"],Du=fe(Ou),pt=j().trim().regex(/^#[0-9a-fA-F]{6}$/,"Use a 6-digit hex color"),$u=he({label:j().trim().min(1,"Theme name is required").max(40),primary:pt,secondary:pt,tertiary:pt,canvas:pt,panel:pt,panelHigh:pt,panelLow:pt,ink:pt}),Mu=["--primary","--secondary","--tertiary","--surface","--canvas","--surface-low","--surface-panel","--surface-high","--surface-glass","--surface-psyche","--surface-psyche-high","--hero-gradient","--card-gradient","--card-shadow","--card-shadow-hover","--ui-accent","--ui-ink","--ui-ink-muted","--forge-body-ambient-primary","--forge-body-ambient-secondary","--forge-body-gradient-start","--forge-body-gradient-end","--forge-body-text"],vo={label:"Custom Forge",primary:"#7cc7ff",secondary:"#4edea3",tertiary:"#ffb95f",canvas:"#0b1326",panel:"#171f33",panelHigh:"#222a3d",panelLow:"#131b2e",ink:"#eef2ff"},Le={obsidian:{label:"Obsidian",description:"Deep indigo with cool neon edges. This is the current default.",mode:"dark",preview:{label:"Obsidian",primary:"#c0c1ff",secondary:"#4edea3",tertiary:"#ffb95f",canvas:"#0b1326",panel:"#171f33",panelHigh:"#222a3d",panelLow:"#131b2e",ink:"#eef2ff"}},solar:{label:"Catppuccin",description:"Pastel mocha surfaces inspired by the widely adopted Catppuccin palette.",mode:"dark",preview:{label:"Catppuccin",primary:"#cba6f7",secondary:"#94e2d5",tertiary:"#fab387",canvas:"#1e1e2e",panel:"#313244",panelHigh:"#45475a",panelLow:"#181825",ink:"#cdd6f4"}},aurora:{label:"Nord",description:"Arctic blue-grey surfaces based on Nord's clean and uncluttered palette.",mode:"dark",preview:{label:"Nord",primary:"#88c0d0",secondary:"#a3be8c",tertiary:"#ebcb8b",canvas:"#2e3440",panel:"#3b4252",panelHigh:"#434c5e",panelLow:"#242933",ink:"#eceff4"}},ember:{label:"Dracula",description:"High-contrast purple and pink accents drawn from the official Dracula specification.",mode:"dark",preview:{label:"Dracula",primary:"#bd93f9",secondary:"#8be9fd",tertiary:"#ff79c6",canvas:"#282a36",panel:"#343746",panelHigh:"#424450",panelLow:"#21222c",ink:"#f8f8f2"}},paper:{label:"Paper",description:"Warm ivory surfaces with navy ink and restrained blue-green accents for a crisp daytime workspace.",mode:"light",preview:{label:"Paper",primary:"#2f6fed",secondary:"#1d8f6b",tertiary:"#c9772b",canvas:"#f4efe6",panel:"#fbf7f1",panelHigh:"#ffffff",panelLow:"#e5ddd0",ink:"#182235"}},dawn:{label:"Dawn",description:"Rosy morning tones with plum-blue ink and enough contrast to stay readable across dense settings screens.",mode:"light",preview:{label:"Dawn",primary:"#8b5cf6",secondary:"#ec7a6b",tertiary:"#d0a12b",canvas:"#f8eef1",panel:"#fff7f8",panelHigh:"#ffffff",panelLow:"#ead9df",ink:"#2d1834"}},atelier:{label:"Atelier",description:"Cool drafting-table neutrals with slate ink and modern cobalt accents for a brighter, studio-like shell.",mode:"light",preview:{label:"Atelier",primary:"#2563eb",secondary:"#0f8b6d",tertiary:"#b85c38",canvas:"#edf3f7",panel:"#f8fbfd",panelHigh:"#ffffff",panelLow:"#dbe5ec",ink:"#162334"}}},Qw=[{value:"obsidian",label:Le.obsidian.label,description:Le.obsidian.description},{value:"solar",label:Le.solar.label,description:Le.solar.description},{value:"aurora",label:Le.aurora.label,description:Le.aurora.description},{value:"ember",label:Le.ember.label,description:Le.ember.description},{value:"paper",label:Le.paper.label,description:Le.paper.description},{value:"dawn",label:Le.dawn.label,description:Le.dawn.description},{value:"atelier",label:Le.atelier.label,description:Le.atelier.description},{value:"custom",label:"Custom",description:"Use your own Forge token set through the guided editor or direct JSON import."},{value:"system",label:"System",description:"Follow the device preference. Forge maps dark mode to Obsidian and light mode to Paper."}];function ja(e){const t=e.replace("#","");return{r:Number.parseInt(t.slice(0,2),16),g:Number.parseInt(t.slice(2,4),16),b:Number.parseInt(t.slice(4,6),16)}}function Fu({r:e,g:t,b:a}){return`#${[e,t,a].map(s=>Math.max(0,Math.min(255,Math.round(s))).toString(16).padStart(2,"0")).join("")}`}function St(e,t,a){const s=ja(e),n=ja(t);return Fu({r:s.r+(n.r-s.r)*a,g:s.g+(n.g-s.g)*a,b:s.b+(n.b-s.b)*a})}function He(e,t){const{r:a,g:s,b:n}=ja(e);return`rgba(${a}, ${s}, ${n}, ${t})`}function zu(e,t){return e==="system"?t?"obsidian":"paper":e}function Yw(e,t){return e==="custom"?t??vo:e==="system"?Le.obsidian.preview:Le[e].preview}function Wu(e){const t=St(e.panelHigh,e.primary,.08),a=St(e.panelHigh,e.primary,.16),s=St(e.canvas,e.secondary,.06);return{"--primary":e.primary,"--secondary":e.secondary,"--tertiary":e.tertiary,"--surface":e.canvas,"--canvas":e.canvas,"--surface-low":e.panelLow,"--surface-panel":e.panel,"--surface-high":e.panelHigh,"--surface-glass":He(e.canvas,.82),"--surface-psyche":He(St(e.canvas,e.secondary,.12),.94),"--surface-psyche-high":He(St(e.panelHigh,e.secondary,.1),.96),"--hero-gradient":`linear-gradient(180deg, ${He(a,.95)}, ${He(s,.95)})`,"--card-gradient":`linear-gradient(180deg, ${He(t,.96)}, ${He(e.panelLow,.94)})`,"--card-shadow":`0 24px 60px ${He(e.canvas,.3)}`,"--card-shadow-hover":`0 32px 80px ${He(e.canvas,.38)}`,"--ui-accent":e.primary,"--ui-ink":e.ink,"--ui-ink-muted":He(e.ink,.58),"--forge-body-ambient-primary":He(e.primary,.2),"--forge-body-ambient-secondary":He(e.secondary,.14),"--forge-body-gradient-start":St(e.panel,e.primary,.08),"--forge-body-gradient-end":St(e.canvas,"#000000",.16),"--forge-body-text":e.ink}}function qu(e,t){if(typeof document>"u")return;const a=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,s=zu(e,a),n=document.body,o=document.documentElement;if(n.classList.remove("theme-forge-dark","theme-forge-light","theme-forge-obsidian","theme-forge-solar","theme-forge-aurora","theme-forge-ember","theme-forge-paper","theme-forge-dawn","theme-forge-atelier","theme-forge-custom"),s==="custom"){const i=t??vo,l=Wu(i);n.classList.add("theme-forge-custom"),n.classList.add("theme-forge-dark");for(const[u,p]of Object.entries(l))o.style.setProperty(u,p);o.dataset.forgeTheme=i.label;return}for(const i of Mu)o.style.removeProperty(i);delete o.dataset.forgeTheme,n.classList.add(Le[s].mode==="light"?"theme-forge-light":"theme-forge-dark"),n.classList.add(`theme-forge-${s}`)}const Bu=fe(["en","fr"]),Ku=fe(["dark-fantasy","dramatic-smithie","mind-locksmith"]),Za=he({contentMarkdown:j().trim().min(1,"Note content is required"),author:j().trim()}),Hu=he({title:j().trim().min(1,"Title is required"),description:j().trim(),horizon:fe(["quarter","year","lifetime"]),status:fe(["active","paused","completed"]),userId:j().trim().nullable().optional(),targetPoints:_e.number().int().min(25).max(1e4),themeColor:j().trim().regex(/^#[0-9a-fA-F]{6}$/,"Theme color must be a valid hex value"),tagIds:me(j()),notes:me(Za)}),Uu=he({goalId:j().trim().min(1,"Life goal is required"),title:j().trim().min(1,"Title is required"),description:j().trim(),status:fe(["active","paused","completed"]),workflowStatus:fe(["backlog","focus","in_progress","blocked","done"]),userId:j().trim().nullable().optional(),assigneeUserIds:me(j().trim()),targetPoints:_e.number().int().min(25).max(1e4),themeColor:j().trim().regex(/^#[0-9a-fA-F]{6}$/,"Theme color must be a valid hex value"),productRequirementsDocument:j().trim(),notes:me(Za)}),Zw=he({profile:he({operatorName:j().trim().min(1,"Name is required"),operatorEmail:j().trim().min(1,"Email is required"),operatorTitle:j().trim().min(1,"Title is required")}),notifications:he({goalDriftAlerts:Nt(),dailyQuestReminders:Nt(),achievementCelebrations:Nt()}),execution:he({maxActiveTasks:_e.number().int().min(1).max(8),timeAccountingMode:fe(["split","parallel","primary_only"])}),themePreference:Du,gamificationTheme:Ku.default("dramatic-smithie"),customTheme:$u.nullable().optional(),localePreference:Bu,calendarProviders:he({google:he({clientId:j().trim().optional(),clientSecret:j().trim().optional(),storedClientId:j().optional(),storedClientSecret:j().optional(),appBaseUrl:j().optional(),redirectUri:j().optional(),allowedOrigins:me(j()).optional(),usesPkce:er(!0).optional(),requiresServerClientSecret:er(!1).optional(),oauthClientType:er("desktop_app").optional(),authMode:er("localhost_pkce").optional(),isConfigured:Nt().optional(),isReadyForPairing:Nt().optional(),isLocalOnly:er(!0).optional(),runtimeOrigin:j().optional(),setupMessage:j().optional()}).optional(),microsoft:he({clientId:j().trim(),tenantId:j().trim(),redirectUri:j().trim()}).optional()}).optional().superRefine((e,t)=>{var l,u;const a=e==null?void 0:e.google;if(!a)return;const s=a.clientId!==void 0,n=a.clientSecret!==void 0,o=(((l=a.clientId)==null?void 0:l.length)??0)>0,i=(((u=a.clientSecret)==null?void 0:u.length)??0)>0;if(s!==n){t.addIssue({code:ga.custom,path:["google",s?"clientSecret":"clientId"],message:"Provide both the Google client ID and client secret together, or clear both together."});return}o!==i&&t.addIssue({code:ga.custom,path:["google",o?"clientSecret":"clientId"],message:"Provide both the Google client ID and client secret together, or clear both together."})}),modelSettings:he({forgeAgent:he({basicChat:he({connectionId:j().trim().nullable().optional(),model:j().trim().optional()}).optional(),wiki:he({connectionId:j().trim().nullable().optional(),model:j().trim().optional()}).optional()}).optional()}).optional()}),ek=he({label:j().trim().min(1,"Label is required"),agentLabel:j().trim().min(1,"Agent name is required"),agentType:j().trim().min(1,"Agent type is required"),description:j().trim(),trustLevel:fe(["standard","trusted","autonomous"]),autonomyMode:fe(["approval_required","scoped_write","autonomous"]),approvalMode:fe(["approval_by_default","high_impact_only","none"]),scopes:me(j().trim().min(1)).min(1),bootstrapPolicy:he({mode:fe(["disabled","active_only","scoped","full"]),goalsLimit:_e.number().int().min(0).max(100),projectsLimit:_e.number().int().min(0).max(100),tasksLimit:_e.number().int().min(0).max(100),habitsLimit:_e.number().int().min(0).max(100),strategiesLimit:_e.number().int().min(0).max(100),peoplePageLimit:_e.number().int().min(0).max(50),includePeoplePages:Nt()}),scopePolicy:he({userIds:me(j().trim().min(1)),projectIds:me(j().trim().min(1)),tagIds:me(j().trim().min(1))})}),tk=he({originType:fe(["system","user","agent"]),originAgentId:j().trim(),originLabel:j().trim(),entityType:j().trim(),entityId:j().trim(),timeframeLabel:j().trim(),title:j().trim().min(1,"Title is required"),summary:j().trim().min(1,"Summary is required"),recommendation:j().trim().min(1,"Recommendation is required"),rationale:j().trim(),confidence:_e.number().min(0).max(1),ctaLabel:j().trim().min(1,"CTA label is required")}),Gu=he({title:j().trim().min(1,"Title is required"),description:j().trim(),level:fe(["issue","task","subtask"]),owner:j().trim().min(1,"Owner is required"),userId:j().trim().nullable().optional(),assigneeUserIds:me(j().trim()),goalId:j().trim(),projectId:j().trim().min(1,"Project is required"),parentWorkItemId:j().trim().nullable().optional(),priority:fe(["low","medium","high","critical"]),status:fe(["backlog","focus","in_progress","blocked","done"]),effort:fe(["light","deep","marathon"]),energy:fe(["low","steady","high"]),dueDate:j().trim(),points:_e.number().int().min(5).max(500),plannedDurationSeconds:_e.number().int().min(60).max(7*86400).nullable().optional(),actionCostBand:fe(["tiny","light","standard","heavy","brutal"]).optional(),aiInstructions:j().trim(),executionMode:fe(["afk","hitl"]).nullable().optional(),acceptanceCriteria:me(j().trim()),blockerLinks:me(he({entityType:j().trim().min(1),entityId:j().trim().min(1),label:j().trim().optional()})),completionReport:he({modifiedFiles:me(j().trim()),workSummary:j().trim(),linkedGitRefIds:me(j().trim())}).nullable().optional(),gitRefs:me(he({id:j().trim().min(1).optional(),workItemId:j().trim().optional(),refType:fe(["commit","branch","pull_request"]),provider:j().trim().default("git"),repository:j().trim().default(""),refValue:j().trim().min(1),url:j().trim().url().nullable().optional(),displayTitle:j().trim().default("")})).default([]),tagIds:me(j()),notes:me(Za)}),rk=he({title:j().trim().min(1,"Title is required"),description:j().trim(),status:fe(["active","paused","archived"]),userId:j().trim().nullable().optional(),polarity:fe(["positive","negative"]),frequency:fe(["daily","weekly"]),targetCount:_e.number().int().min(1).max(14),weekDays:me(oc().int().min(0).max(6)).max(7),linkedGoalIds:me(j().trim().min(1)),linkedProjectIds:me(j().trim().min(1)),linkedTaskIds:me(j().trim().min(1)),linkedValueIds:me(j().trim().min(1)),linkedPatternIds:me(j().trim().min(1)),linkedBehaviorIds:me(j().trim().min(1)),linkedBeliefIds:me(j().trim().min(1)),linkedModeIds:me(j().trim().min(1)),linkedReportIds:me(j().trim().min(1)),linkedBehaviorId:j().trim(),rewardXp:_e.number().int().min(1).max(100),penaltyXp:_e.number().int().min(1).max(100),generatedHealthEventTemplate:he({enabled:Nt(),workoutType:j().trim(),title:j().trim(),durationMinutes:_e.number().int().min(1).max(1440),xpReward:_e.number().int().min(0).max(500),tags:me(j().trim()),links:me(he({entityType:j().trim().min(1),entityId:j().trim().min(1),relationshipType:j().trim().default("context")})),notesTemplate:j().trim()})}).superRefine((e,t)=>{e.frequency==="weekly"&&e.weekDays.length===0&&t.addIssue({code:ga.custom,path:["weekDays"],message:"Pick at least one weekday"})}),ak=he({entityType:fe(["task","project"]),entityId:j().trim().min(1,"A target is required"),deltaMinutes:_e.number().int().refine(e=>e!==0,"Minutes must not be zero"),note:j().trim()});he({name:j().trim().min(1,"Name is required"),kind:fe(["value","category","execution"]),userId:j().trim().nullable().optional(),color:j().trim().regex(/^#[0-9a-fA-F]{6}$/,"Color must be a valid hex value"),description:j().trim()});const Ir={title:"",description:"",horizon:"year",status:"active",userId:null,targetPoints:400,themeColor:"#c8a46b",tagIds:[],notes:[]};function Vu(e){return{title:e.title,description:e.description,horizon:e.horizon,status:e.status,userId:e.userId??null,targetPoints:e.targetPoints,themeColor:e.themeColor,tagIds:e.tagIds,notes:[]}}function Ju({open:e,pending:t=!1,editingGoal:a,tags:s,users:n,defaultUserId:o=null,onOpenChange:i,onSubmit:l}){const{t:u}=De(),p=n??[],m=p.find(x=>x.id===o)??null,[g,f]=c.useState(Ir),[v,y]=c.useState(null),[_,h]=c.useState({}),w=x=>{h(Object.fromEntries(Object.entries(x).map(([$,S])=>[$,S==null?void 0:S[0]])))};c.useEffect(()=>{e&&(y(null),h({}),f(a?Vu(a):{...Ir,userId:o}))},[o,a,e]);const P=[{id:"intent",eyebrow:"Direction",title:"Name the arc and why it matters",description:"Start with the long-horizon direction itself. We can refine cadence, tags, and visual tone after the intent is clear.",render:(x,$)=>r.jsxs(r.Fragment,{children:[r.jsx(te,{label:u("common.dialogs.goal.title"),error:_.title??null,children:r.jsx(ve,{value:x.title,onChange:S=>$({title:S.target.value}),placeholder:"Build a durable body and calm energy"})}),r.jsx(te,{label:u("common.dialogs.goal.descriptionLabel"),children:r.jsx(at,{value:x.description,onChange:S=>$({description:S.target.value}),placeholder:"Write the goal description in Markdown. This can stay short or grow into a long strategic page."})}),r.jsx(Ya,{value:x.userId,users:p,onChange:S=>$({userId:S}),label:"Owner user",defaultLabel:Va(m),help:"Goals can belong to a human or bot user. The current single-user scope becomes the default when one user is selected."})]})},{id:"cadence",eyebrow:"Cadence",title:"Choose the horizon and current posture",description:"Keep this simple: how long does this arc run, and is it currently active, paused, or already complete?",render:(x,$)=>r.jsxs(r.Fragment,{children:[r.jsx(te,{label:u("common.dialogs.goal.horizon"),children:r.jsx(Ye,{value:x.horizon,onChange:S=>$({horizon:S}),options:[{value:"quarter",label:u("common.enums.goalHorizon.quarter"),description:"Tight strategic push for the coming months."},{value:"year",label:u("common.enums.goalHorizon.year"),description:"A full-cycle objective for this year."},{value:"lifetime",label:u("common.enums.goalHorizon.lifetime"),description:"A long-running life arc that projects can keep serving."}],columns:3})}),r.jsx(te,{label:u("common.dialogs.goal.status"),children:r.jsx(Ye,{value:x.status,onChange:S=>$({status:S}),options:[{value:"active",label:u("common.enums.projectStatus.active"),description:"This is live right now."},{value:"paused",label:u("common.enums.projectStatus.paused"),description:"Keep it visible, but do not push it right now."},{value:"completed",label:u("common.enums.projectStatus.completed"),description:"You have already fulfilled this arc."}]})})]})},{id:"signal",eyebrow:"Signal",title:"Set the target and visual signature",description:"Give Forge enough signal to show progress and make this arc recognizable throughout the app.",render:(x,$)=>r.jsxs(r.Fragment,{children:[r.jsx(te,{label:u("common.dialogs.goal.targetXp"),error:_.targetPoints??null,children:r.jsx(ve,{type:"number",value:x.targetPoints,onChange:S=>$({targetPoints:Number(S.target.value)||0})})}),r.jsx(te,{label:u("common.dialogs.goal.themeColor"),error:_.themeColor??null,children:r.jsxs("div",{className:"flex items-center gap-3 rounded-[22px] border border-white/8 bg-white/6 px-4 py-3",children:[r.jsx("input",{className:"h-10 w-12 rounded-lg border border-white/10 bg-transparent",type:"color",value:x.themeColor,onChange:S=>$({themeColor:S.target.value})}),r.jsx(ve,{className:"border-none bg-transparent px-0 py-0",value:x.themeColor,onChange:S=>$({themeColor:S.target.value})})]})}),r.jsx(te,{label:u("common.dialogs.goal.tags"),children:r.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(S=>{const F=x.tagIds.includes(S.id);return r.jsx("button",{type:"button",className:`rounded-full px-3 py-2 text-sm transition ${F?"bg-white/16 text-white":"bg-white/6 text-white/58 hover:bg-white/10 hover:text-white"}`,onClick:()=>$({tagIds:F?x.tagIds.filter(N=>N!==S.id):[...x.tagIds,S.id]}),children:S.name},S.id)})})})]})},{id:"notes",eyebrow:"Evidence",title:"Attach any creation context that should live with this goal",description:"Creation notes become real linked Markdown notes, so strategic context does not vanish into the form flow.",render:(x,$)=>r.jsx(te,{label:"Creation notes",children:r.jsx(Qa,{notes:x.notes,onChange:S=>$({notes:S}),entityLabel:"goal"})})}];return r.jsx(Xa,{open:e,onOpenChange:i,eyebrow:u("common.dialogs.goal.eyebrow"),title:u(a?"common.dialogs.goal.editTitle":"common.dialogs.goal.createTitle"),description:u("common.dialogs.goal.description"),value:g,onChange:f,draftPersistenceKey:a?`goal.${a.id}`:"goal.new",steps:P,pending:t,pendingLabel:u(a?"common.dialogs.goal.save":"common.dialogs.goal.create"),submitLabel:u(a?"common.dialogs.goal.save":"common.dialogs.goal.create"),error:v,onSubmit:async()=>{y(null);const x=Hu.safeParse(g);if(!x.success){w(x.error.flatten().fieldErrors),y("Some answers still need attention before this goal arc can be saved.");return}h({});try{await l(x.data,a==null?void 0:a.id),f(Ir),i(!1)}catch($){y($ instanceof Error?$.message:u("common.dialogs.goal.submitError"))}}})}function Xu({user:e,compact:t=!1,size:a,className:s}){if(!e)return r.jsx(le,{size:a??(t?"sm":"md"),className:b("border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)]",s),children:"Unassigned"});const n=e.kind==="bot"?Rr:pa;return r.jsxs(le,{size:a??(t?"sm":"md"),className:b("max-w-full gap-1.5 border",e.kind==="bot"?"border-[color-mix(in_srgb,var(--info)_24%,transparent)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]":"border-[color-mix(in_srgb,var(--warning)_24%,transparent)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",a==="xs"&&"gap-1",s),children:[r.jsx(n,{className:b(a==="xs"?"size-3":"size-3.5","shrink-0")}),r.jsx("span",{className:"truncate",children:e.displayName}),r.jsx("span",{className:"text-[var(--ui-ink-faint)]",children:e.kind})]})}const Sa={goalId:"",title:"",description:"",status:"active",workflowStatus:"backlog",userId:null,assigneeUserIds:[],targetPoints:240,themeColor:"#c0c1ff",productRequirementsDocument:"",notes:[]};function Qu(e){return{goalId:e.goalId,title:e.title,description:e.description,status:e.status,workflowStatus:e.workflowStatus,userId:e.userId??null,assigneeUserIds:e.assigneeUserIds??[],targetPoints:e.targetPoints,themeColor:e.themeColor,productRequirementsDocument:e.productRequirementsDocument,notes:[]}}function Yu({open:e,goals:t,users:a,editingProject:s,initialGoalId:n,initialStepId:o,defaultUserId:i=null,onOpenChange:l,onSubmit:u}){const{t:p}=De(),m=a??[],[g,f]=c.useState(Sa),[v,y]=c.useState(null),[_,h]=c.useState({}),w=t.find(S=>S.id===g.goalId)??null,P=m.find(S=>S.id===((w==null?void 0:w.userId)??i))??null,x=S=>{h(Object.fromEntries(Object.entries(S).map(([F,N])=>[F,N==null?void 0:N[0]])))};c.useEffect(()=>{var S;e&&(y(null),h({}),f(s?Qu(s):{...Sa,goalId:n??"",userId:((S=t.find(F=>F.id===n))==null?void 0:S.userId)??i}))},[i,s,t,n,e]);const $=[{id:"anchor",eyebrow:"Anchor",title:"Attach the project to the right goal",description:"Projects should serve one clear life-goal arc, so start by picking the direction this initiative belongs to.",render:(S,F)=>r.jsx(te,{label:p("common.dialogs.project.goal"),error:_.goalId??null,children:r.jsx("div",{className:"grid gap-3",children:t.map(N=>{const E=N.id===S.goalId;return r.jsxs("button",{type:"button",className:`rounded-[22px] border px-4 py-4 text-left transition ${E?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/72 hover:bg-white/[0.07]"}`,onClick:()=>F({goalId:N.id}),children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx(gr,{kind:"goal",label:N.title,className:"max-w-full"}),r.jsx(Xu,{user:N.user,compact:!0})]}),r.jsx("div",{className:"mt-2 text-sm leading-6 text-white/54",children:N.description||"No strategic note attached yet."})]},N.id)})})})},{id:"shape",eyebrow:"Shape",title:"Name the initiative and the work it will make possible",description:"Keep the project concrete. The title should sound like something you can actually move forward this season.",render:(S,F)=>r.jsxs(r.Fragment,{children:[r.jsx(te,{label:p("common.dialogs.project.title"),error:_.title??null,children:r.jsx(ve,{value:S.title,onChange:N=>F({title:N.target.value}),placeholder:"Launch the new creative practice system"})}),r.jsx(te,{label:p("common.dialogs.project.descriptionLabel"),children:r.jsx(at,{value:S.description,onChange:N=>F({description:N.target.value}),placeholder:"Write the project description in Markdown. Use as much detail as the workstream needs."})}),r.jsx(te,{label:"Product requirements document",children:r.jsx(at,{value:S.productRequirementsDocument,onChange:N=>F({productRequirementsDocument:N.target.value}),placeholder:"Capture the PRD in Markdown so the project view can present it clearly."})}),r.jsx(Ya,{value:S.userId,users:m,onChange:N=>F({userId:N}),label:"Owner user",defaultLabel:Va(P),help:"Projects can intentionally cross user boundaries, but the linked goal owner is suggested by default."}),r.jsx(te,{label:"Assignees",children:r.jsx("select",{multiple:!0,value:S.assigneeUserIds,onChange:N=>F({assigneeUserIds:Array.from(N.target.selectedOptions,E=>E.value)}),className:"min-h-28 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:m.map(N=>r.jsxs("option",{value:N.id,children:[N.displayName," · ",N.kind]},N.id))})})]})},{id:"signal",eyebrow:"Signal",title:"Set the project's posture and progress target",description:"This keeps the board, reward system, and detail views aligned without forcing you through a giant settings form.",render:(S,F)=>r.jsxs(r.Fragment,{children:[r.jsx(te,{label:p("common.dialogs.project.status"),children:r.jsx(Ye,{value:S.status,onChange:N=>F({status:N}),options:[{value:"active",label:p("common.enums.projectStatus.active"),description:"Push this initiative now."},{value:"paused",label:p("common.enums.projectStatus.paused"),description:"Keep it available without active pressure."},{value:"completed",label:p("common.enums.projectStatus.completed"),description:"This initiative has landed."}]})}),r.jsx(te,{label:"Board workflow status",children:r.jsx(Ye,{value:S.workflowStatus,onChange:N=>F({workflowStatus:N}),options:[{value:"backlog",label:"Backlog"},{value:"focus",label:"Focus"},{value:"in_progress",label:"In progress"},{value:"blocked",label:"Blocked"},{value:"done",label:"Done"}]})}),r.jsx(te,{label:p("common.dialogs.project.targetXp"),error:_.targetPoints??null,children:r.jsx(ve,{type:"number",value:S.targetPoints,onChange:N=>F({targetPoints:Number(N.target.value)||0})})}),r.jsx(te,{label:p("common.dialogs.project.themeColor"),error:_.themeColor??null,children:r.jsxs("div",{className:"flex items-center gap-3 rounded-[22px] border border-white/8 bg-white/6 px-4 py-3",children:[r.jsx("input",{className:"h-10 w-12 rounded-lg border border-white/10 bg-transparent",type:"color",value:S.themeColor,onChange:N=>F({themeColor:N.target.value})}),r.jsx(ve,{className:"border-none bg-transparent px-0 py-0",value:S.themeColor,onChange:N=>F({themeColor:N.target.value})})]})})]})},{id:"notes",eyebrow:"Evidence",title:"Keep the creation context attached to the project from day one",description:"Use linked Markdown notes when the initiative needs setup context, assumptions, or a handoff summary right away.",render:(S,F)=>r.jsx(te,{label:"Creation notes",children:r.jsx(Qa,{notes:S.notes,onChange:N=>F({notes:N}),entityLabel:"project"})})}];return r.jsx(Xa,{open:e,onOpenChange:l,eyebrow:p("common.dialogs.project.eyebrow"),title:p(s?"common.dialogs.project.editTitle":"common.dialogs.project.createTitle"),description:p("common.dialogs.project.description"),value:g,onChange:f,draftPersistenceKey:s?`project.${s.id}`:"project.new",steps:$,initialStepId:o,submitLabel:p(s?"common.dialogs.project.save":"common.dialogs.project.create"),error:v,onSubmit:async()=>{y(null);const S=Uu.safeParse(g);if(!S.success){x(S.error.flatten().fieldErrors),y("A couple of answers still need attention before this project can be saved.");return}h({});try{await u(S.data,s==null?void 0:s.id),l(!1)}catch(F){y(F instanceof Error?F.message:p("common.dialogs.project.submitError"))}}})}function ia(e){return typeof e=="string"?e.trim():""}function Zu(e,t){const a=t.find(s=>s.refType===e.refType&&s.refValue===e.refValue&&s.repository===e.repository)??null;return{id:(a==null?void 0:a.id)??`draft-${e.refType}-${e.refValue.replace(/[^a-zA-Z0-9]+/g,"-")}`,workItemId:(a==null?void 0:a.workItemId)??"",refType:e.refType,provider:e.provider,repository:e.repository,refValue:e.refValue,url:e.url,displayTitle:e.displayTitle}}function em(e){return e==="branch"?Kt:e==="pull_request"?Di:xl}function tm({selectedRefs:e,onChange:t}){const[a,s]=c.useState(null),[n,o]=c.useState(null),[i,l]=c.useState(!1),[u,p]=c.useState("branch"),[m,g]=c.useState(""),[f,v]=c.useState(""),[y,_]=c.useState([]),[h,w]=c.useState([]),[P,x]=c.useState(!1),[$,S]=c.useState(null);c.useEffect(()=>{let T=!1;return l(!0),_d().then(z=>{T||(s(z.git),v(ee=>ee.trim().length>0?ee:z.git.repository||ee),o(null))}).catch(z=>{T||o(z instanceof Error?z.message:"Forge could not load git helper context.")}).finally(()=>{T||l(!1)}),()=>{T=!0}},[]),c.useEffect(()=>{let T=!1;return x(!0),Ed({kind:u,query:m,repository:f}).then(z=>{T||(_(z.git.refs),w(z.git.warnings),S(null))}).catch(z=>{T||(S(z instanceof Error?z.message:"Forge could not search git refs right now."),_([]))}).finally(()=>{T||x(!1)}),()=>{T=!0}},[u,m,f]);const F=c.useMemo(()=>{const T=ia(a==null?void 0:a.currentBranch),z=ia(f)||ia(a==null?void 0:a.repository);return T?{key:`branch:${T}`,refType:"branch",provider:z?"github":"git",repository:z,refValue:T,url:z&&T?`https://github.com/${z}/tree/${encodeURIComponent(T)}`:null,displayTitle:T,subtitle:"Current local branch"}:null},[a==null?void 0:a.currentBranch,a==null?void 0:a.repository,f]),N=T=>{const z=Zu(T,e);e.some(ee=>ee.refType===z.refType&&ee.refValue===z.refValue&&ee.repository===z.repository)||t([...e,z])},E=T=>{t(e.filter(z=>z.id!==T.id))};return r.jsxs("div",{className:"grid gap-3 rounded-[20px] border border-white/8 bg-white/[0.03] p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"type-label text-white/45",children:"Git links"}),r.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"Pick the live branch, commits, or pull requests from the local repo instead of typing raw hashes."})]}),F?r.jsxs(ue,{type:"button",variant:"secondary",size:"sm",onClick:()=>N(F),children:[r.jsx(Kt,{className:"size-4"}),"Use current branch"]}):null]}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-[10rem_minmax(0,1fr)]",children:[r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Type"}),r.jsxs("select",{value:u,onChange:T=>p(T.target.value),className:"min-h-10 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:[r.jsx("option",{value:"branch",children:"Branch"}),r.jsx("option",{value:"commit",children:"Commit"}),r.jsx("option",{value:"pull_request",children:"Pull request"})]})]}),r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Repository"}),r.jsx(ve,{value:f,onChange:T=>v(T.target.value),placeholder:(a==null?void 0:a.repository)||"owner/repo"})]})]}),r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Search"}),r.jsxs("div",{className:"relative",children:[r.jsx(gt,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-white/32"}),r.jsx(ve,{value:m,onChange:T=>g(T.target.value),placeholder:u==="branch"?"Search branches":u==="pull_request"?"Search pull requests":"Search commits",className:"pl-10"})]})]}),e.length>0?r.jsxs("div",{className:"grid gap-2",children:[r.jsx("div",{className:"type-label text-white/45",children:"Selected links"}),r.jsx("div",{className:"grid gap-2",children:e.map(T=>r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[16px] border border-white/8 bg-white/[0.04] px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(le,{className:"bg-white/[0.08] text-white/72",children:T.refType.replaceAll("_"," ")}),r.jsx("div",{className:"truncate text-sm text-white/84",children:T.displayTitle||T.refValue})]}),r.jsx("div",{className:"mt-1 text-xs text-white/46",children:[T.repository,T.refValue].filter(Boolean).join(" · ")})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[T.url?r.jsx("a",{href:T.url,target:"_blank",rel:"noreferrer",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",children:r.jsx(ha,{className:"size-4"})}):null,r.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",onClick:()=>E(T),children:r.jsx(dt,{className:"size-4"})})]})]},T.id))})]}):null,r.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/8 bg-white/[0.02] p-2",children:[i||P?r.jsxs("div",{className:"flex items-center gap-2 px-2 py-4 text-sm text-white/52",children:[r.jsx(Ci,{className:"size-4 animate-spin"}),"Loading git suggestions…"]}):null,n?r.jsx("div",{className:"rounded-[14px] bg-rose-500/10 px-3 py-2 text-sm text-rose-200",children:n}):null,$?r.jsx("div",{className:"rounded-[14px] bg-rose-500/10 px-3 py-2 text-sm text-rose-200",children:$}):null,[...(a==null?void 0:a.warnings)??[],...h].filter(Boolean).slice(0,2).map(T=>r.jsx("div",{className:"rounded-[14px] bg-amber-400/10 px-3 py-2 text-sm text-amber-100",children:T},T)),!P&&!$&&y.length===0?r.jsx("div",{className:"px-2 py-4 text-sm text-white/45",children:"No matching git refs found."}):null,y.map(T=>{const z=em(u),ee=e.some(ne=>ne.refType===T.refType&&ne.refValue===T.refValue&&ne.repository===T.repository);return r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[14px] px-2 py-2 transition hover:bg-white/[0.04]",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/82",children:[r.jsx(z,{className:"size-4 shrink-0 text-[var(--primary)]"}),r.jsx("span",{className:"truncate",children:T.displayTitle||T.refValue})]}),r.jsx("div",{className:"mt-1 text-xs text-white/46",children:[T.repository,T.subtitle].filter(Boolean).join(" · ")})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[T.url?r.jsx("a",{href:T.url,target:"_blank",rel:"noreferrer",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",children:r.jsx(ha,{className:"size-4"})}):null,r.jsx(ue,{type:"button",size:"sm",variant:"secondary",disabled:ee,onClick:()=>N(T),children:ee?"Added":"Add"})]})]},T.key)})]})]})}const sr={title:"",description:"",level:"task",owner:"Albert",userId:null,assigneeUserIds:[],goalId:"",projectId:"",parentWorkItemId:null,priority:"medium",status:"focus",effort:"deep",energy:"steady",dueDate:"",points:60,plannedDurationSeconds:86400,actionCostBand:"standard",aiInstructions:"",executionMode:null,acceptanceCriteria:[],blockerLinks:[],completionReport:null,gitRefs:[],tagIds:[],notes:[]},rm=[];function am(e){return e.split(`
4
- `).map(t=>t.trim()).filter(t=>t.length>0)}function Na(e){return e.modifiedFiles.length===0&&e.workSummary.trim().length===0&&e.linkedGitRefIds.length===0?null:{modifiedFiles:e.modifiedFiles,workSummary:e.workSummary,linkedGitRefIds:e.linkedGitRefIds}}function sm(e,t){return Na({modifiedFiles:(t==null?void 0:t.modifiedFiles)??[],workSummary:(t==null?void 0:t.workSummary)??"",linkedGitRefIds:e.map(a=>a.id).filter(a=>typeof a=="string")})}function Ze(e){return e.trim().toLowerCase()}function nm(e){return e==="issue"?["goal","project"]:e==="task"?["goal","project","issue"]:["goal","project","task"]}function im(e){return e==="issue"?["goal","project"]:e==="task"?["goal","project","issue"]:["goal","project"]}function ei(e){return e==="task"?"task":e}function om(e){var v;const{editingTask:t,initialGoalId:a,initialLevel:s,initialParentWorkItemId:n,initialProjectId:o,defaultUserId:i,projects:l,users:u,workItems:p}=e;if(t)return mm(t);const m=n?p.find(y=>y.id===n)??null:null,g=l.find(y=>y.id===((m==null?void 0:m.projectId)??o))??null,f=(g==null?void 0:g.userId)??i??null;return{...sr,level:s??((m==null?void 0:m.level)==="issue"?"task":(m==null?void 0:m.level)==="task"?"subtask":sr.level),owner:((v=u.find(y=>y.id===f))==null?void 0:v.displayName)??sr.owner,userId:f,goalId:(m==null?void 0:m.goalId)??(g==null?void 0:g.goalId)??a??"",projectId:(g==null?void 0:g.id)??"",parentWorkItemId:(m==null?void 0:m.id)??null}}function lm(e){const{draft:t,goals:a,projects:s,workItems:n}=e,o=[];if(t.goalId){const i=a.find(l=>l.id===t.goalId);i&&o.push({id:`goal:${i.id}`,kind:"goal",mode:"existing",entityId:i.id,label:i.title,description:"Goal",searchText:Ze(`${i.title} ${i.description}`),goalId:i.id,projectId:null,parentWorkItemId:null})}if(t.projectId){const i=s.find(l=>l.id===t.projectId);i&&o.push({id:`project:${i.id}`,kind:"project",mode:"existing",entityId:i.id,label:i.title,description:"Project",searchText:Ze(`${i.title} ${i.description} ${i.goalTitle}`),goalId:i.goalId,projectId:i.id,parentWorkItemId:null})}if(t.parentWorkItemId){const i=n.find(l=>l.id===t.parentWorkItemId);i&&o.push({id:`${i.level}:${i.id}`,kind:i.level==="issue"?"issue":"task",mode:"existing",entityId:i.id,label:i.title,description:i.level==="issue"?"Issue":"Task",searchText:Ze(`${i.title} ${i.description} ${i.aiInstructions}`),goalId:i.goalId,projectId:i.projectId,parentWorkItemId:i.parentWorkItemId})}return o}function cm(e){const{goals:t,projects:a,workItems:s,allowedKinds:n,editingTaskId:o}=e,i=[];return n.includes("goal")&&i.push(...t.map(l=>({id:`goal:${l.id}`,kind:"goal",mode:"existing",entityId:l.id,label:l.title,description:"Goal",searchText:Ze(`${l.title} ${l.description}`),goalId:l.id,projectId:null,parentWorkItemId:null}))),n.includes("project")&&i.push(...a.map(l=>({id:`project:${l.id}`,kind:"project",mode:"existing",entityId:l.id,label:l.title,description:`Project · ${l.goalTitle}`,searchText:Ze(`${l.title} ${l.description} ${l.goalTitle} ${l.productRequirementsDocument}`),goalId:l.goalId,projectId:l.id,parentWorkItemId:null}))),n.includes("issue")&&i.push(...s.filter(l=>l.level==="issue"&&l.id!==o).map(l=>({id:`issue:${l.id}`,kind:"issue",mode:"existing",entityId:l.id,label:l.title,description:"Issue",searchText:Ze(`${l.title} ${l.description} ${l.aiInstructions} ${l.executionMode??""}`),goalId:l.goalId,projectId:l.projectId,parentWorkItemId:null}))),n.includes("task")&&i.push(...s.filter(l=>l.level==="task"&&l.id!==o).map(l=>({id:`task:${l.id}`,kind:"task",mode:"existing",entityId:l.id,label:l.title,description:"Task",searchText:Ze(`${l.title} ${l.description} ${l.aiInstructions} ${l.executionMode??""}`),goalId:l.goalId,projectId:l.projectId,parentWorkItemId:l.parentWorkItemId}))),i}function dm(e,t,a){if(t.kind==="goal"){const s=e.projectId?a.find(o=>o.projectId===e.projectId)??null:null,n=!e.projectId||(s==null?void 0:s.goalId)===t.entityId||t.goalId===e.goalId;return{goalId:t.entityId,projectId:n?e.projectId:"",parentWorkItemId:n?e.parentWorkItemId:null}}if(t.kind==="project"){const s=e.parentWorkItemId?a.find(n=>n.id===e.parentWorkItemId)??null:null;return{goalId:t.goalId??e.goalId,projectId:t.entityId,parentWorkItemId:!s||s.projectId===t.entityId?e.parentWorkItemId:null}}return{goalId:t.goalId??e.goalId,projectId:t.projectId??e.projectId,parentWorkItemId:t.entityId}}function um(e){return e==="goal"?{goalId:"",projectId:"",parentWorkItemId:null}:e==="project"?{projectId:"",parentWorkItemId:null}:{parentWorkItemId:null}}function mm(e){var t;return{title:e.title,description:e.description,level:e.level,owner:e.owner,userId:e.userId??null,assigneeUserIds:e.assigneeUserIds??[],goalId:e.goalId??"",projectId:e.projectId??"",parentWorkItemId:e.parentWorkItemId??null,priority:e.priority,status:e.status,effort:e.effort,energy:e.energy,dueDate:e.dueDate??"",points:e.points,plannedDurationSeconds:e.plannedDurationSeconds??86400,actionCostBand:((t=e.actionPointSummary)==null?void 0:t.costBand)??"standard",aiInstructions:e.aiInstructions,executionMode:e.executionMode,acceptanceCriteria:e.acceptanceCriteria,blockerLinks:e.blockerLinks,completionReport:e.completionReport,gitRefs:e.gitRefs,tagIds:e.tagIds,notes:[]}}function pm({open:e,goals:t,projects:a,workItems:s,tags:n,users:o,editingTask:i,initialProjectId:l,initialGoalId:u,initialParentWorkItemId:p,initialLevel:m,initialStepId:g,defaultUserId:f=null,onRefreshEntities:v,currentCreditedSeconds:y,onOpenChange:_,onAdjustTrackedTime:h,onSubmit:w}){const{t:P}=De(),x=t??[],$=a??[],S=s??rm,F=n??[],N=o??[],[E,T]=c.useState(sr),[z,ee]=c.useState(null),[ne,ie]=c.useState({}),[V,k]=c.useState(""),[M,oe]=c.useState(!1),[ae,C]=c.useState(0),[J,O]=c.useState(null),[Y,A]=c.useState(null),[Z,pe]=c.useState(0),Oe=L=>{ie(Object.fromEntries(Object.entries(L).map(([X,R])=>[X,R==null?void 0:R[0]])))};c.useEffect(()=>{e&&(ee(null),ie({}),k(""),oe(!1),C(0),O(null),A(null),pe(i?Math.max(0,Math.floor((y??i.time.totalCreditedSeconds)/60)):0),T(om({editingTask:i,initialGoalId:u,initialLevel:m,initialParentWorkItemId:p,initialProjectId:l,defaultUserId:f,projects:$,users:N,workItems:S})))},[f,i,u,m,p,l,e,$,N,S,y]);const Ae=i?Math.max(0,Math.floor((y??i.time.totalCreditedSeconds)/60)):0,Te=i?Z-Ae:0,ye=c.useMemo(()=>$.find(L=>L.id===E.projectId)??null,[E.projectId,$]),be=c.useMemo(()=>nm(E.level),[E.level]),Ie=c.useMemo(()=>im(E.level),[E.level]),we=c.useMemo(()=>lm({draft:E,goals:x,projects:$,workItems:S}),[E,x,$,S]),Ke=c.useMemo(()=>cm({goals:x,projects:$,workItems:S,allowedKinds:be,editingTaskId:i==null?void 0:i.id}),[be,i==null?void 0:i.id,x,$,S]),ze=c.useMemo(()=>{const L=Ze(V),X=L.length===0?Ke.slice(0,8):Ke.filter(q=>q.searchText.includes(L)).slice(0,8);if(L.length===0)return X;const R=Ie.map(q=>q==="project"&&!E.goalId?{id:`create:${q}:${L}`,kind:q,mode:"create",label:V.trim(),description:"Pick or create a goal first, then create a project here.",disabled:!0,disabledReason:"Pick or create a goal first."}:q==="issue"&&!E.projectId?{id:`create:${q}:${L}`,kind:q,mode:"create",label:V.trim(),description:"Pick or create a project first, then create an issue here.",disabled:!0,disabledReason:"Pick or create a project first."}:{id:`create:${q}:${L}`,kind:q,mode:"create",label:V.trim(),description:`Create a new ${q} from "${V.trim()}".`});return[...X,...R]},[V,Ke,Ie,E.goalId,E.projectId]),ut=N.find(L=>L.id===((ye==null?void 0:ye.userId)??f))??null;c.useEffect(()=>{ye&&E.goalId!==ye.goalId&&T(L=>({...L,goalId:ye.goalId}))},[E.goalId,ye]);const ce=L=>{T(X=>({...X,...dm(X,L,S)})),k(""),O(null),C(0),oe(!1)},tt=L=>{T(X=>({...X,...um(L)})),O(null)},je=async L=>{if(L.disabled){O(L.disabledReason??L.description);return}const X=L.label.trim();if(X){A(L.id),O(null);try{if(L.kind==="goal"){const R=await io({...Ir,title:X,userId:E.userId??null});await(v==null?void 0:v()),ce({id:`goal:${R.goal.id}`,kind:"goal",mode:"existing",entityId:R.goal.id,label:R.goal.title,description:"Goal",searchText:Ze(`${R.goal.title} ${R.goal.description}`),goalId:R.goal.id,projectId:null,parentWorkItemId:null});return}if(L.kind==="project"){if(!E.goalId)throw new Error("Pick or create a goal first.");const R=await oo({...Sa,goalId:E.goalId,title:X,userId:E.userId??null,assigneeUserIds:E.assigneeUserIds});await(v==null?void 0:v()),ce({id:`project:${R.project.id}`,kind:"project",mode:"existing",entityId:R.project.id,label:R.project.title,description:"Project",searchText:Ze(`${R.project.title} ${R.project.description}`),goalId:R.project.goalId,projectId:R.project.id,parentWorkItemId:null});return}if(L.kind==="issue"){if(!E.projectId)throw new Error("Pick or create a project first.");const R=await Id({...sr,level:"issue",title:X,owner:E.owner,userId:E.userId??null,assigneeUserIds:E.assigneeUserIds,goalId:E.goalId,projectId:E.projectId,executionMode:"afk"});await(v==null?void 0:v()),ce({id:`issue:${R.workItem.id}`,kind:"issue",mode:"existing",entityId:R.workItem.id,label:R.workItem.title,description:"Issue",searchText:Ze(`${R.workItem.title} ${R.workItem.description}`),goalId:R.workItem.goalId,projectId:R.workItem.projectId,parentWorkItemId:null})}}catch(R){O(R instanceof Error?R.message:"Unable to create that linked entity right now.")}finally{A(null)}}},Ge=[{id:"anchor",eyebrow:"Placement",title:"Choose where this work belongs",description:"Anchor the work through the hierarchy. Tasks can carry a goal, project, and issue parent together so the chain of meaning stays explicit.",render:(L,X)=>{var R;return r.jsxs(r.Fragment,{children:[r.jsx(te,{label:"Hierarchy anchors",labelHelp:"Pick the goal and project anchors, then choose the real parent where needed. Tasks can live under issues, subtasks under tasks.",error:ne.projectId??null,children:r.jsx("div",{className:"grid gap-3",children:r.jsxs("div",{className:"rounded-[24px] border border-white/10 bg-white/[0.04] p-4",children:[we.length>0?r.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:we.map(q=>r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-white/8 bg-white/[0.06] px-2.5 py-1.5",children:[r.jsx(et,{kind:ei(q.kind),label:q.label,compact:!0,gradient:!1,className:"max-w-[16rem]"}),r.jsx("button",{type:"button",className:"rounded-full text-white/52 transition hover:text-white",onClick:()=>tt(q.kind),"aria-label":`Remove ${q.label}`,children:r.jsx(dt,{className:"size-3.5"})})]},q.id))}):null,r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:"flex items-center gap-3 rounded-[18px] border border-white/8 bg-black/20 px-4 py-3",children:[r.jsx(gt,{className:"size-4 text-white/36"}),r.jsx("input",{value:V,onChange:q=>{k(q.target.value),oe(!0),C(0),O(null)},onFocus:()=>oe(!0),onBlur:()=>{window.setTimeout(()=>oe(!1),120)},onKeyDown:q=>{if(q.key==="Backspace"&&!V&&we.length>0){tt(we[we.length-1].kind);return}if(q.key==="ArrowDown"){q.preventDefault(),oe(!0),C(re=>ze.length===0?0:Math.min(ze.length-1,re+1));return}if(q.key==="ArrowUp"){q.preventDefault(),C(re=>Math.max(0,re-1));return}if(q.key==="Escape"){oe(!1);return}if(q.key==="Enter"&&ze[ae]){q.preventDefault();const re=ze[ae];re.mode==="existing"?ce(re):je(re)}},placeholder:'Search or create Goal, Project, or parent Issue like Goal + "Creative system"',className:"min-w-0 flex-1 bg-transparent text-sm text-white placeholder:text-white/34 focus:outline-none"})]}),M?r.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-white/8 bg-[rgba(8,13,24,0.96)] p-2 shadow-[0_26px_60px_rgba(4,8,18,0.32)] backdrop-blur-xl",children:ze.length>0?ze.map((q,re)=>r.jsxs("button",{type:"button",disabled:q.mode==="create"&&q.disabled,className:b("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",re===ae?"bg-white/[0.1] text-white":"text-white/70 hover:bg-white/[0.06] hover:text-white",q.mode==="create"&&q.disabled&&"cursor-not-allowed opacity-45"),onMouseEnter:()=>C(re),onMouseDown:We=>We.preventDefault(),onClick:()=>{if(q.mode==="existing"){ce(q);return}je(q)},children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(et,{kind:ei(q.kind),label:q.mode==="create"?`Create ${q.kind}`:q.label,compact:!0,gradient:!1}),q.mode==="create"?r.jsxs(le,{className:"bg-white/[0.08] text-white/70",children:['"',q.label,'"']}):null]}),r.jsx("div",{className:"mt-1 text-xs leading-5 text-white/46",children:q.description})]}),q.mode==="create"?r.jsx("span",{className:"rounded-full bg-[var(--primary)]/12 p-2 text-[var(--primary)]",children:r.jsx(Wr,{className:"size-3.5"})}):null]},q.id)):r.jsx("div",{className:"px-3 py-2.5 text-sm text-white/42",children:"Type to find an existing anchor or create a new one."})}):null]}),J?r.jsx("div",{className:"mt-3 rounded-[16px] border border-rose-400/16 bg-rose-400/10 px-3 py-2 text-sm text-rose-100",children:J}):null]})})}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[r.jsx(te,{label:"Resolved project",children:r.jsx(ve,{readOnly:!0,value:(ye==null?void 0:ye.title)??"",placeholder:"Select or create a project anchor"})}),r.jsx(te,{label:"Resolved goal",children:r.jsx(ve,{readOnly:!0,value:((R=x.find(q=>q.id===L.goalId))==null?void 0:R.title)??"",placeholder:"Select or create a goal anchor"})})]})]})}},{id:"shape",eyebrow:"Shape",title:"Define the next concrete move",description:"Keep the task small enough to be actionable and strong enough to clearly move the project forward.",render:(L,X)=>r.jsxs(r.Fragment,{children:[r.jsx(te,{label:"Hierarchy level",error:ne.level??null,children:r.jsx(Ye,{value:L.level,onChange:R=>X({level:R}),options:[{value:"issue",label:"Issue",description:"Vertical slice with AFK or HITL execution mode."},{value:"task",label:"Task",description:"One focused AI session with direct instructions."},{value:"subtask",label:"Subtask",description:"A lightweight child step under a task."}]})}),r.jsx(te,{label:P("common.dialogs.task.title"),error:ne.title??null,children:r.jsx(ve,{value:L.title,onChange:R=>X({title:R.target.value}),placeholder:"Draft the first mode atlas sketch"})}),r.jsx(te,{label:P("common.dialogs.task.descriptionLabel"),children:r.jsx(at,{value:L.description,onChange:R=>X({description:R.target.value}),placeholder:"Write the task description in Markdown. Keep it short or turn it into a full acceptance doc."})}),L.level==="issue"||L.level==="task"?r.jsxs(r.Fragment,{children:[r.jsx(te,{label:"Execution mode",children:r.jsx(Ye,{value:L.executionMode??"afk",onChange:R=>X({executionMode:R}),options:[{value:"afk",label:"AFK",description:"AI can complete the issue flow without waiting on a human decision."},{value:"hitl",label:"HITL",description:"A human decision is required somewhere in the slice."}]})}),r.jsx(te,{label:"Acceptance criteria",children:r.jsx(at,{value:L.acceptanceCriteria.join(`
5
- `),onChange:R=>X({acceptanceCriteria:R.target.value.split(`
6
- `).map(q=>q.trim()).filter(q=>q.length>0)}),placeholder:"Given ... / When ... / Then ..."})})]}):null,L.level!=="issue"?r.jsx(te,{label:"AI instructions",children:r.jsx(at,{value:L.aiInstructions,onChange:R=>X({aiInstructions:R.target.value}),placeholder:"Tell the executing agent which files and patterns matter, and what finished work looks like."})}):null,r.jsx(te,{label:P("common.dialogs.task.owner"),labelHelp:"The owner is the person or role expected to carry this task.",error:ne.owner??null,children:r.jsx(ve,{value:L.owner,onChange:R=>X({owner:R.target.value}),placeholder:"Albert"})}),r.jsx(Ya,{value:L.userId,users:N,onChange:R=>{var q;return X({userId:R,owner:((q=N.find(re=>re.id===R))==null?void 0:q.displayName)??L.owner})},label:"Owner user",defaultLabel:Va(ut),help:"Tasks can belong to a human or bot user. The linked project owner is suggested first so cross-user task routing stays explicit."}),r.jsx(te,{label:"Assignees",children:r.jsx("select",{multiple:!0,value:L.assigneeUserIds,onChange:R=>X({assigneeUserIds:Array.from(R.target.selectedOptions,q=>q.value)}),className:"min-h-28 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:N.map(R=>r.jsxs("option",{value:R.id,children:[R.displayName," · ",R.kind]},R.id))})})]})},{id:"execution",eyebrow:"Execution",title:"Set priority, status, effort, and energy",description:"This is the minimum the execution engine needs in order to place the task well and show the right next move.",render:(L,X)=>r.jsxs(r.Fragment,{children:[r.jsx(te,{label:P("common.dialogs.task.priority"),labelHelp:"Priority controls how strongly Forge should surface this task in the board and daily views.",children:r.jsx(Ye,{value:L.priority,onChange:R=>X({priority:R}),options:[{value:"low",label:P("common.enums.priority.low")},{value:"medium",label:P("common.enums.priority.medium")},{value:"high",label:P("common.enums.priority.high")},{value:"critical",label:P("common.enums.priority.critical")}]})}),r.jsx(te,{label:P("common.dialogs.task.status"),labelHelp:"Status tells Forge whether the task is waiting, ready for focus, active, blocked, or done.",children:r.jsx(Ye,{value:L.status,onChange:R=>X({status:R}),options:[{value:"backlog",label:P("common.enums.taskStatus.backlog")},{value:"focus",label:P("common.enums.taskStatus.focus")},{value:"in_progress",label:P("common.enums.taskStatus.in_progress")},{value:"blocked",label:P("common.enums.taskStatus.blocked")}]})}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsx(te,{label:P("common.dialogs.task.effort"),labelHelp:"Effort describes how much concentration and time this task usually needs.",children:r.jsx(Ye,{value:L.effort,onChange:R=>X({effort:R}),options:[{value:"light",label:P("common.enums.effort.light")},{value:"deep",label:P("common.enums.effort.deep")},{value:"marathon",label:P("common.enums.effort.marathon")}]})}),r.jsx(te,{label:P("common.dialogs.task.energy"),labelHelp:"Energy helps you match this task to a low-energy, steady, or high-energy moment.",children:r.jsx(Ye,{value:L.energy,onChange:R=>X({energy:R}),options:[{value:"low",label:P("common.enums.energy.low")},{value:"steady",label:P("common.enums.energy.steady")},{value:"high",label:P("common.enums.energy.high")}]})})]})]})},{id:"signal",eyebrow:"Reward and timing",title:"Set the reward and timing details",description:"This keeps the daily surfaces honest without forcing you through a bloated last-mile form.",render:(L,X)=>r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsx(te,{label:P("common.dialogs.task.xp"),labelHelp:"XP is the reward weight for finishing this task. Higher XP should mean more meaningful work.",error:ne.points??null,children:r.jsx(ve,{type:"number",value:L.points,onChange:R=>X({points:Number(R.target.value)||0}),placeholder:"60"})}),r.jsx(te,{label:P("common.dialogs.task.dueDate"),labelHelp:"Only add a due date when timing really matters for this task.",children:r.jsx(ve,{type:"date",value:L.dueDate,onChange:R=>X({dueDate:R.target.value})})})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsx(te,{label:"Expected duration",labelHelp:"Life Force uses this as the expected shape of the task. The default is one day.",error:ne.plannedDurationSeconds??null,children:r.jsx(ve,{type:"number",min:15,max:10080,step:15,value:Math.max(15,Math.round((L.plannedDurationSeconds??86400)/60)),onChange:R=>X({plannedDurationSeconds:Math.max(60,(Number(R.target.value)||1440)*60)})})}),i?r.jsx(te,{label:"Tracked minutes",labelHelp:"Change the current credited work total without starting a live run. Forge records the difference as a work adjustment when you save.",children:r.jsx(ve,{type:"number",min:0,step:1,value:Z,onChange:R=>pe(Math.max(0,Math.trunc(Number(R.target.value)||0)))})}):null,r.jsx(te,{label:"Action cost",labelHelp:"Choose a simple AP band now. Advanced AP editing can happen later inside the task.",children:r.jsx(Ye,{value:L.actionCostBand??"standard",onChange:R=>X({actionCostBand:R}),options:[{value:"tiny",label:"Tiny"},{value:"light",label:"Light"},{value:"standard",label:"Standard"},{value:"heavy",label:"Heavy"},{value:"brutal",label:"Brutal"}]})})]}),i?r.jsxs("div",{className:"rounded-[22px] border border-white/8 bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/62",children:["Currently recorded: ",Ae," min."," ",Te===0?"Saving this edit keeps the tracked total unchanged.":`Saving this edit will ${Te>0?"add":"remove"} ${Math.abs(Te)} minute${Math.abs(Te)===1?"":"s"} from the task history.`]}):null,r.jsx(te,{label:P("common.dialogs.task.tags"),children:r.jsx("div",{className:"flex flex-wrap gap-2",children:F.map(R=>{const q=L.tagIds.includes(R.id);return r.jsx("button",{type:"button",className:`rounded-full px-3 py-2 text-sm transition ${q?"bg-white/16 text-white":"bg-white/6 text-white/58 hover:bg-white/10 hover:text-white"}`,onClick:()=>X({tagIds:q?L.tagIds.filter(re=>re!==R.id):[...L.tagIds,R.id]}),children:R.name},R.id)})})})]})},{id:"notes",eyebrow:"Closeout",title:"Capture what changed when the work is done",description:"Completion stays truthful when the closeout records modified files, a concise work summary, and the associated commit refs.",render:(L,X)=>{var R,q;return r.jsxs(r.Fragment,{children:[L.level!=="issue"?r.jsxs(r.Fragment,{children:[r.jsx(te,{label:"Work summary",children:r.jsx(at,{value:((R=L.completionReport)==null?void 0:R.workSummary)??"",onChange:re=>{var We,rt;return X({completionReport:Na({modifiedFiles:((We=L.completionReport)==null?void 0:We.modifiedFiles)??[],workSummary:re.target.value,linkedGitRefIds:((rt=L.completionReport)==null?void 0:rt.linkedGitRefIds)??[]})})},placeholder:"Summarize what changed in this session and what is now true."})}),r.jsx(te,{label:"Modified files",children:r.jsx(at,{value:(((q=L.completionReport)==null?void 0:q.modifiedFiles)??[]).join(`
7
- `),onChange:re=>{var We,rt;return X({completionReport:Na({modifiedFiles:am(re.target.value),workSummary:((We=L.completionReport)==null?void 0:We.workSummary)??"",linkedGitRefIds:((rt=L.completionReport)==null?void 0:rt.linkedGitRefIds)??[]})})},placeholder:`src/pages/kanban-page.tsx
8
- server/src/repositories/tasks.ts`})}),r.jsx(te,{label:"Git links",children:r.jsx(tm,{selectedRefs:L.gitRefs,onChange:re=>X({gitRefs:re,completionReport:sm(re,L.completionReport)})})})]}):null,r.jsx(te,{label:"Creation notes",children:r.jsx(Qa,{notes:L.notes,onChange:re=>X({notes:re}),entityLabel:"task"})})]})}},{id:"notes-evidence",eyebrow:"Evidence",title:"Capture launch context if this task needs a durable work note",description:"These notes become linked Markdown evidence on the task immediately, which helps preserve setup context, blockers, or handoff detail.",render:(L,X)=>r.jsx("div",{className:"text-sm leading-6 text-white/62",children:"Use the previous step for completion closeout. Use linked notes here only when you want durable extra context, setup detail, or handoff evidence beyond the structured completion report."})}];return r.jsx(Xa,{open:e,onOpenChange:_,eyebrow:P("common.dialogs.task.eyebrow"),title:P(i?"common.dialogs.task.editTitle":"common.dialogs.task.createTitle"),description:P("common.dialogs.task.description"),value:E,onChange:T,draftPersistenceKey:i?`task.${i.id}`:"task.new",steps:Ge,initialStepId:g,submitLabel:P(i?"common.dialogs.task.save":"common.dialogs.task.create"),error:z,onSubmit:async()=>{if(ee(null),i&&Z<0){ee("Tracked minutes cannot be negative.");return}const L=Gu.safeParse(E);if(!L.success){Oe(L.error.flatten().fieldErrors),ee("A few task details still need attention before this move can be saved.");return}ie({});try{await w(L.data,i==null?void 0:i.id),i&&h&&Te!==0&&await h({entityType:"task",entityId:i.id,deltaMinutes:Te,note:"Adjusted from task editor."}),_(!1)}catch(X){ee(X instanceof Error?X.message:"Unable to save this task right now.")}}})}const ti="(max-width: 1023px)",ri=["Execution","Psyche","Knowledge"];function hm(){const[e,t]=c.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(ti).matches);return c.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(ti),s=n=>{t(n.matches)};return t(a.matches),typeof a.addEventListener=="function"?(a.addEventListener("change",s),()=>a.removeEventListener("change",s)):(a.addListener(s),()=>a.removeListener(s))},[]),e}function ai({kind:e,title:t,description:a,onClick:s}){return r.jsxs("button",{type:"button",className:"w-full min-w-0 rounded-[22px] border border-white/8 bg-white/[0.04] px-4 py-4 text-left transition hover:bg-white/[0.08]",onClick:s,children:[r.jsx(et,{kind:e,label:t,compact:!0,gradient:!1,className:"max-w-full"}),r.jsx("div",{className:"mt-1 text-sm text-white/55",children:a})]})}function gm(e){return[{id:"goal",kind:"goal",group:"Execution",title:e("common.navigation.newGoal"),quickActionTitle:"Create life goal",description:e("common.navigation.newGoalDescription"),aliases:["goal","life goal","direction","objective"],filterIds:["goal"]},{id:"project",kind:"project",group:"Execution",title:e("common.navigation.newProject"),quickActionTitle:"Create project",description:e("common.navigation.newProjectDescription"),aliases:["project","initiative"],filterIds:["project"]},{id:"task",kind:"task",group:"Execution",title:e("common.navigation.newTask"),quickActionTitle:"Create task",description:e("common.navigation.newTaskDescription"),aliases:["task","todo","to-do","action item"],filterIds:["task"]},{id:"strategy",kind:"strategy",group:"Execution",title:"Strategy",quickActionTitle:"Create strategy",description:"Plan a directed path across projects and tasks toward a real end state.",aliases:["strategy","plan","roadmap"],filterIds:["strategy"]},{id:"habit",kind:"habit",group:"Execution",title:"Habit",quickActionTitle:"Create habit",description:"Track a recurring commitment or recurring slip with explicit XP logic.",aliases:["habit","routine","recurring"],filterIds:["habit"]},{id:"psyche_value",kind:"value",group:"Psyche",title:"Value",quickActionTitle:"Create value",description:"Place one value into the goal, project, and task constellation.",aliases:["value","psyche value","principle"],filterIds:["psyche_value"]},{id:"behavior_pattern",kind:"pattern",group:"Psyche",title:"Pattern",quickActionTitle:"Create pattern",description:"Map a loop, its payoff, its cost, and the response you want.",aliases:["pattern","loop","behavior pattern","psyche pattern"],filterIds:["behavior_pattern"]},{id:"behavior",kind:"behavior",group:"Psyche",title:"Behavior",quickActionTitle:"Create behavior",description:"Describe the move first, then classify it and link it.",aliases:["behavior","psyche behavior","behaviour"],filterIds:["behavior"]},{id:"flashcard",kind:"flashcard",group:"Psyche",title:"Flashcard",quickActionTitle:"Create flashcard",description:"Write a compact therapeutic card for urges, triggers, or values-based pivots.",aliases:["flashcard","card","urge card","trigger card","therapy card"],filterIds:["flashcard"]},{id:"trigger_report",kind:"report",group:"Psyche",title:"Report",quickActionTitle:"Create report",description:"Start a Spark-to-Pivot reflective chain.",aliases:["report","trigger report","psyche report"],filterIds:["trigger_report"]},{id:"wiki_page",kind:"wiki_page",group:"Knowledge",title:"Wiki page",quickActionTitle:"Create wiki page",description:"Open a fresh KarpaWiki page draft in the current knowledge workspace.",aliases:["wiki","wiki page","karpawiki","page","article"],filterIds:["wiki_page"]}]}function fm({goals:e,projects:t,tags:a,users:s,defaultUserId:n=null,onCreateGoal:o,onCreateProject:i,onCreateTask:l}){const{t:u}=De(),p=Aa(),m=e??[],g=t??[],f=a??[],v=s??[],[y,_]=c.useState(!1),[h,w]=c.useState(!1),[P,x]=c.useState(!1),$=c.useMemo(()=>gm(u),[u]),S=c.useMemo(()=>$.map(N=>({...N,onSelect:()=>{switch(N.id){case"goal":_(!0);return;case"project":w(!0);return;case"task":x(!0);return;case"strategy":p("/strategies?create=1");return;case"habit":p("/habits?create=1");return;case"psyche_value":p("/psyche/values?create=1");return;case"behavior_pattern":p("/psyche/patterns?create=1");return;case"behavior":p("/psyche/behaviors?create=1");return;case"flashcard":p("/psyche/flashcards?create=1");return;case"trigger_report":p("/psyche/reports?create=1");return;case"wiki_page":p("/wiki/new");return;default:return}}})),[p,$]),F=r.jsxs(r.Fragment,{children:[r.jsx(Ju,{open:y,editingGoal:null,tags:f,users:v,defaultUserId:n,onOpenChange:_,onSubmit:async N=>{await o(N)}}),r.jsx(Yu,{open:h,goals:m,users:v,editingProject:null,defaultUserId:n,onOpenChange:w,onSubmit:async N=>{await i(N)}}),r.jsx(pm,{open:P,goals:m,projects:g,tags:f,users:v,editingTask:null,defaultUserId:n,onOpenChange:x,onSubmit:async N=>{await l(N)}})]});return{actions:S,dialogs:F}}function ym({actions:e,className:t}){const{t:a}=De(),[s,n]=c.useState(!1),[o,i]=c.useState(null),l=hm(),u=c.useRef(null),p=c.useRef(null);return c.useEffect(()=>{if(!s||l)return;const m=()=>{var y;const v=(y=u.current)==null?void 0:y.getBoundingClientRect();v&&i({top:Math.max(24,v.top-18),right:Math.max(24,window.innerWidth-v.right)})};m();const g=v=>{var y,_;(y=u.current)!=null&&y.contains(v.target)||(_=p.current)!=null&&_.contains(v.target)||n(!1)},f=v=>{v.key==="Escape"&&n(!1)};return document.addEventListener("pointerdown",g),document.addEventListener("keydown",f),window.addEventListener("resize",m),window.addEventListener("scroll",m,!0),()=>{document.removeEventListener("pointerdown",g),document.removeEventListener("keydown",f),window.removeEventListener("resize",m),window.removeEventListener("scroll",m,!0)}},[l,s]),r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:u,className:t,style:l?{right:"max(1rem, calc(var(--forge-safe-area-right) + 1rem))",bottom:"var(--forge-mobile-create-bottom)"}:void 0,children:r.jsxs(ue,{type:"button","data-testid":"create-floating-trigger","aria-expanded":s,"aria-haspopup":"dialog",onClick:()=>n(m=>l?!0:!m),className:`min-w-max max-w-[calc(100vw-2rem)] shrink-0 rounded-full px-3.5 py-2 text-[12px] shadow-[0_20px_60px_rgba(4,8,18,0.34)] ${s?"bg-[linear-gradient(135deg,rgba(192,193,255,0.52),rgba(125,211,252,0.24))] text-white":""}`,children:[r.jsx(ir,{className:`size-4 transition ${s?"text-white":"text-white/72"}`}),a("common.navigation.create")]})}),s&&!l&&typeof document<"u"&&o?zr.createPortal(r.jsxs("div",{ref:p,"data-testid":"create-desktop-menu",className:"fixed z-50 w-[min(26rem,calc(100vw-2rem))] max-h-[min(34rem,calc(100vh-4rem))] overflow-y-auto rounded-[30px] border border-white/8 bg-[linear-gradient(180deg,rgba(18,24,40,0.985),rgba(10,15,27,0.985))] p-4 shadow-[0_28px_90px_rgba(3,8,18,0.46)]",style:{top:`${o.top}px`,right:`${o.right}px`,transform:"translateY(-100%)"},children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Create"}),r.jsx("div",{className:"mt-2 text-lg font-medium text-white",children:"Start the next move"}),r.jsx("div",{className:"mt-1 text-sm leading-6 text-white/56",children:"Pick one thing to create. The flow keeps the first step light and visible."}),ri.map(m=>r.jsxs("div",{className:"mt-4",children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/38",children:m}),r.jsx("div",{className:"mt-2 grid gap-2",children:e.filter(g=>g.group===m).map(g=>r.jsx(ai,{kind:g.kind,title:g.title,description:g.description,onClick:()=>{n(!1),g.onSelect()}},g.id))})]},m))]}),document.body):null,r.jsx(ft,{open:s&&l,onOpenChange:n,children:r.jsxs(yt,{children:[r.jsx(xt,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.72)] backdrop-blur-xl lg:hidden"}),r.jsxs(vt,{"data-testid":"create-mobile-sheet",className:"fixed inset-x-4 bottom-28 z-50 flex max-h-[min(30rem,calc(100vh-8rem))] flex-col overflow-hidden rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(24,31,50,0.98),rgba(15,21,36,0.98))] p-0 shadow-[0_30px_90px_rgba(3,8,18,0.45)] lg:hidden",style:{left:"max(1rem, calc(var(--forge-safe-area-left) + 1rem))",right:"max(1rem, calc(var(--forge-safe-area-right) + 1rem))",bottom:"calc(var(--forge-mobile-nav-clearance) - 0.5rem)"},children:[r.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-white/8 px-5 py-5",children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.navigation.create")}),r.jsx(bt,{className:"mt-2 font-display text-2xl text-white",children:a("common.navigation.createTitle")}),r.jsx(wt,{className:"mt-2 text-sm leading-6 text-white/60",children:a("common.navigation.createDescription")})]}),r.jsx(Dt,{asChild:!0,children:r.jsx("button",{type:"button","aria-label":a("common.navigation.closeCreateMenu"),className:"rounded-full bg-white/6 p-2 text-white/65 transition hover:bg-white/10 hover:text-white",children:r.jsx(dt,{className:"size-4"})})})]}),r.jsx("div",{className:"overflow-y-auto p-4 overscroll-contain",children:ri.map(m=>r.jsxs("div",{className:"mt-1 grid gap-2 first:mt-0",children:[r.jsx("div",{className:"px-1 text-[11px] uppercase tracking-[0.18em] text-white/38",children:m}),e.filter(g=>g.group===m).map(g=>r.jsx(ai,{kind:g.kind,title:g.title,description:g.description,onClick:()=>{n(!1),g.onSelect()}},g.id))]},m))})]})]})})]})}function es({open:e,onOpenChange:t,eyebrow:a,title:s,description:n,children:o}){return r.jsx(ft,{open:e,onOpenChange:t,children:r.jsxs(yt,{children:[r.jsx(xt,{className:"surface-overlay fixed inset-0 z-40 backdrop-blur-xl"}),r.jsxs(vt,{className:"surface-modal-panel fixed inset-x-4 bottom-4 top-4 z-50 mx-auto flex max-w-xl flex-col overflow-hidden rounded-[32px] border",children:[r.jsx("div",{className:"border-b border-[var(--ui-border-subtle)] px-5 py-5",children:r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:a}),r.jsx(bt,{className:"mt-2 type-display-section text-[var(--ui-ink-strong)]",children:s}),n?r.jsx(wt,{className:"mt-3 type-body text-[var(--ui-ink-soft)]",children:n}):null]}),r.jsx(Dt,{asChild:!0,children:r.jsx(fr,{})})]})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto p-4",children:o})]})]})})}function xm(e){return e===null?"20":String(Math.max(1,Math.round(e/60)))}function vm({tasks:e,projects:t,activeRunCount:a,maxActiveTasks:s,timeAccountingMode:n,pending:o,errorMessage:i,initialTaskId:l,defaultProjectId:u,onCancel:p,onStartExisting:m,onCreateAndStart:g}){const[f,v]=c.useState("existing"),[y,_]=c.useState(""),[h,w]=c.useState(l??null),[P,x]=c.useState(""),[$,S]=c.useState(""),[F,N]=c.useState(u??""),[E,T]=c.useState("planned"),[z,ee]=c.useState("20"),[ne,ie]=c.useState(""),[V,k]=c.useState("");c.useEffect(()=>{v(l?"existing":"new"),_(""),w(l??null),x(""),S(""),N(u??""),T("planned"),ee("20"),ie(""),k("")},[u,l]);const M=c.useMemo(()=>e.filter(A=>A.status!=="done").sort((A,Z)=>A.time.hasCurrentRun!==Z.time.hasCurrentRun?Number(Z.time.hasCurrentRun)-Number(A.time.hasCurrentRun):A.status!==Z.status?A.status.localeCompare(Z.status):A.title.localeCompare(Z.title)),[e]),oe=c.useMemo(()=>{const A=y.trim().toLowerCase();return A?M.filter(Z=>{var Oe,Ae,Te,ye,be,Ie;const pe=t.find(we=>we.id===Z.projectId);return[Z.title,Z.description,Z.owner,((Oe=Z.user)==null?void 0:Oe.displayName)??"",((Ae=Z.user)==null?void 0:Ae.handle)??"",((Te=Z.user)==null?void 0:Te.kind)??"",(pe==null?void 0:pe.title)??"",((ye=pe==null?void 0:pe.user)==null?void 0:ye.displayName)??"",((be=pe==null?void 0:pe.user)==null?void 0:be.handle)??"",((Ie=pe==null?void 0:pe.user)==null?void 0:Ie.kind)??""].some(we=>we.toLowerCase().includes(A))}):M},[t,M,y]),ae=c.useMemo(()=>t.find(A=>A.id===F)??null,[F,t]),C=E==="planned"?Math.max(60,(Number.parseInt(z,10)||20)*60):null,J=c.useMemo(()=>{const A=ne.trim(),Z=V.trim();return!A&&!Z?null:{provider:"github",repository:A,branch:Z,baseBranch:"main",branchUrl:A&&Z?`https://github.com/${A}/tree/${encodeURIComponent(Z)}`:null,pullRequestUrl:null,pullRequestNumber:null,compareUrl:A&&Z?`https://github.com/${A}/compare/main...${encodeURIComponent(Z)}`:null}},[V,ne]),O=f==="existing"?!!h:!!(P.trim()&&F),Y=n==="split"?"Split time":n==="parallel"?"Parallel time":"Primary only";return r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Start work"}),r.jsx("h3",{className:"mt-2 font-display text-[clamp(1.2rem,1.8vw,1.65rem)] text-white",children:"Pick a task and start the timer"}),r.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:"Use an existing task or create a new one quickly. Forge will move the task into in progress as soon as work starts."})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(le,{className:"bg-white/[0.08] text-white/72",children:[a,"/",s," live"]}),r.jsx(le,{className:"bg-white/[0.08] text-white/72",children:Y})]})]}),r.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:[{value:"existing",label:"Existing task",detail:"Search and start something that already exists."},{value:"new",label:"New quick task",detail:"Create a task with a title, short description, and project."}].map(A=>{const Z=f===A.value;return r.jsxs("button",{type:"button",className:b("rounded-[18px] border px-4 py-4 text-left transition",Z?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/65 hover:bg-white/[0.07]"),onClick:()=>v(A.value),children:[r.jsx("div",{className:"font-medium",children:A.label}),r.jsx("div",{className:"mt-2 text-sm leading-6 text-inherit/80",children:A.detail})]},A.value)})}),f==="existing"?r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Search tasks"}),r.jsxs("div",{className:"relative",children:[r.jsx(gt,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-white/32"}),r.jsx(ve,{value:y,onChange:A=>_(A.target.value),placeholder:"Search task, project, human, bot, or owner",className:"pl-10"})]})]}),r.jsx("div",{className:"grid max-h-[19rem] gap-2 overflow-y-auto rounded-[20px] bg-white/[0.03] p-2",children:oe.length===0?r.jsx("div",{className:"rounded-[16px] border border-dashed border-white/8 px-4 py-8 text-center text-sm text-white/42",children:"No tasks match. Switch to New quick task to create one now."}):oe.slice(0,16).map(A=>{const Z=h===A.id,pe=t.find(Oe=>Oe.id===A.projectId);return r.jsx("button",{type:"button",className:b("rounded-[16px] border px-4 py-3 text-left transition",Z?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/72 hover:bg-white/[0.07]"),onClick:()=>w(A.id),children:r.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx(gr,{kind:"task",label:A.title,className:"max-w-full"}),r.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[pe?r.jsx(et,{kind:"project",label:pe.title,compact:!0,gradient:!1}):null,r.jsx(le,{className:"bg-white/[0.08] text-white/70",children:A.status.replaceAll("_"," ")}),A.time.activeRunCount>0?r.jsxs(le,{className:"bg-emerald-500/12 text-emerald-200",children:[A.time.activeRunCount," live"]}):null]})]}),r.jsxs("span",{className:"text-[12px] text-white/45",children:[A.points," xp"]})]})},A.id)})})]}):r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Task title"}),r.jsx(ve,{value:P,onChange:A=>x(A.target.value),placeholder:"Write the next concrete task"})]}),r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Short description"}),r.jsx(at,{value:$,onChange:A=>S(A.target.value),placeholder:"Keep it short and concrete."})]}),r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Project"}),r.jsxs("select",{value:F,onChange:A=>N(A.target.value),className:"min-h-10 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:[r.jsx("option",{value:"",children:"Select project"}),t.map(A=>r.jsx("option",{value:A.id,children:A.user?`${A.title} · ${A.user.displayName} (${A.user.kind})`:A.title},A.id))]})]}),ae?r.jsxs("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/62",children:["This task will be created inside ",r.jsx("span",{className:"font-medium text-white",children:ae.title}),ae.user?` for ${ae.user.displayName} (${ae.user.kind})`:""," ","and started immediately."]}):null]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Timer"}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_8rem]",children:[[{value:"planned",label:"20 min planned",detail:"Pomodoro-style by default."},{value:"unlimited",label:"Unlimited",detail:"Keep tracking until you stop."}].map(A=>{const Z=E===A.value;return r.jsxs("button",{type:"button",className:b("rounded-[18px] border px-4 py-3 text-left transition",Z?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/65 hover:bg-white/[0.07]"),onClick:()=>T(A.value),children:[r.jsx("div",{className:"font-medium",children:A.label}),r.jsx("div",{className:"mt-1.5 text-sm leading-6 text-inherit/80",children:A.detail})]},A.value)}),r.jsxs("label",{className:b("grid gap-2",E!=="planned"&&"opacity-50"),children:[r.jsx("span",{className:"type-label text-white/45",children:"Minutes"}),r.jsx(ve,{type:"number",min:1,max:240,disabled:E!=="planned",value:z,onChange:A=>ee(A.target.value)})]})]})]}),r.jsxs("div",{className:"grid gap-3 rounded-[20px] border border-white/8 bg-white/[0.03] p-4",children:[r.jsxs("div",{children:[r.jsx("div",{className:"type-label text-white/45",children:"GitHub context"}),r.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:"Optional. Record the repository and branch for this work session so the project board can show the live agent branch."})]}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Repository"}),r.jsx(ve,{value:ne,onChange:A=>ie(A.target.value),placeholder:"owner/repo"})]}),r.jsxs("label",{className:"grid gap-2",children:[r.jsx("span",{className:"type-label text-white/45",children:"Branch"}),r.jsx(ve,{value:V,onChange:A=>k(A.target.value),placeholder:"agent/board-redesign"})]})]})]}),i?r.jsx("div",{className:"rounded-[18px] bg-rose-500/10 px-4 py-3 text-sm leading-6 text-rose-200",children:i}):null,r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-white/6 pt-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2 text-[12px] text-white/45",children:[r.jsx("div",{className:"rounded-full bg-white/[0.05] px-3 py-2",children:"Starts in progress"}),r.jsx("div",{className:"rounded-full bg-white/[0.05] px-3 py-2",children:E==="planned"?`${xm(C)} min target`:"Unlimited timer"})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(ue,{variant:"secondary",size:"lg",onClick:p,children:"Cancel"}),r.jsxs(ue,{size:"lg",pending:o,pendingLabel:"Starting",disabled:!O,onClick:async()=>{if(O){if(f==="existing"&&h){await m(h,{timerMode:E,plannedDurationSeconds:C,gitContext:J});return}await g({title:P.trim(),description:$.trim(),projectId:F,timerMode:E,plannedDurationSeconds:C,gitContext:J})}},children:[f==="existing"?r.jsx(or,{className:"size-4"}):r.jsx($i,{className:"size-4"}),"Start work",r.jsx(Mi,{className:"size-4"})]})]})]})]})}function si({open:e,onOpenChange:t,presentation:a="responsive",...s}){const n=r.jsx(vm,{...s,onCancel:()=>t(!1)});return r.jsxs(r.Fragment,{children:[e&&a!=="mobile_sheet"?r.jsx("div",{className:"hidden lg:block",children:r.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(17,24,39,0.98),rgba(11,16,28,0.97))] p-4 shadow-[0_24px_60px_rgba(3,8,18,0.28)]",children:[r.jsx("div",{className:"mb-3 flex justify-end",children:r.jsxs(ue,{variant:"ghost",size:"sm",className:"px-3",onClick:()=>t(!1),children:[r.jsx(dt,{className:"size-4"}),"Close"]})}),n]})}):null,a!=="desktop_inline"?r.jsx("div",{className:a==="responsive"?"lg:hidden":"",children:r.jsx(es,{open:e,onOpenChange:t,eyebrow:"Start work",title:"Start work",description:"Pick an existing task or create a new one quickly, then start the timer immediately.",children:n})}):null]})}const bm=[{id:"goals",label:"Goals",kinds:["goal"]},{id:"strategies",label:"Strategies",kinds:["strategy"]},{id:"projects",label:"Projects",kinds:["project"]},{id:"tasks",label:"Tasks",kinds:["task"]},{id:"wiki-spaces",label:"Wiki Spaces",kinds:["wiki_space"]},{id:"knowledge",label:"Wiki Pages / Notes",kinds:["wiki_page","note"]},{id:"support",label:"Habits / Insights / Tags",kinds:["habit","insight","tag"]},{id:"calendar",label:"Calendar",kinds:["calendar_event","work_block","timebox"]},{id:"values",label:"Values",kinds:["value"]},{id:"patterns",label:"Patterns",kinds:["pattern"]},{id:"behaviors",label:"Behaviors",kinds:["behavior"]},{id:"beliefs",label:"Beliefs",kinds:["belief"]},{id:"modes",label:"Modes / Mode Sessions",kinds:["mode","mode_session"]},{id:"flashcards",label:"Flashcards",kinds:["flashcard"]},{id:"reports",label:"Reports / Event Types / Emotions",kinds:["report","event_type","emotion"]},{id:"workbench",label:"Workbench / Functors / Chats",kinds:["workbench","functor","chat"]}],sk=bm.flatMap(e=>[...e.kinds]),nk={goal_project:"Goal to project",goal_task:"Goal to task",project_task:"Project to task",tag_goal:"Tag to goal",tag_task:"Tag to task",tag_strategy:"Tag to strategy",value_goal:"Value to goal",value_project:"Value to project",value_task:"Value to task",strategy_target:"Strategy target",strategy_step:"Strategy step",strategy_link:"Strategy context",habit_link:"Habit link",note_link:"Note link",wiki_parent:"Wiki parent",wiki_link:"Wiki link",calendar_link:"Calendar link",timebox_task:"Timebox to task",timebox_project:"Timebox to project",pattern_value:"Pattern to value",pattern_belief:"Pattern to belief",pattern_mode:"Pattern to mode",behavior_pattern:"Behavior to pattern",behavior_value:"Behavior to value",behavior_belief:"Behavior to belief",behavior_mode:"Behavior to mode",belief_value:"Belief to value",belief_behavior:"Belief to behavior",belief_mode:"Belief to mode",belief_report:"Belief to report",mode_pattern:"Mode to pattern",mode_behavior:"Mode to behavior",mode_value:"Mode to value",flashcard_value:"Flashcard to value",flashcard_behavior:"Flashcard to behavior",flashcard_pattern:"Flashcard to pattern",flashcard_belief:"Flashcard to belief",flashcard_mode:"Flashcard to mode",flashcard_report:"Flashcard to report",report_value:"Report to value",report_pattern:"Report to pattern",report_goal:"Report to goal",report_project:"Report to project",report_task:"Report to task",report_behavior:"Report to behavior",report_belief:"Report to belief",report_mode:"Report to mode",report_event_type:"Report to event type",report_emotion:"Report to emotion",mode_session_mode:"Mode session to mode",workbench_flow:"Workbench flow",workbench_surface:"Workbench surface",workbench_route:"Workbench route"},ik={structural:"Structure",contextual:"Context",taxonomy:"Taxonomy",workspace:"Workspace"};function ok(e,t){return`${e}:${t}`}function lk(e){if(!e)return null;const t=e.indexOf(":");return t<=0||t>=e.length-1?null:{entityType:e.slice(0,t),entityId:e.slice(t+1)}}function bo(e,t){return`${e}:${t}`}function ck(e,t,a){var o;const s=new URLSearchParams;s.set("focus",bo(e,t)),a!=null&&a.view&&a.view!=="graph"&&s.set("view",a.view),(o=a==null?void 0:a.query)!=null&&o.trim()&&s.set("q",a.query.trim());for(const i of(a==null?void 0:a.kinds)??[])s.append("kind",i);for(const i of(a==null?void 0:a.relations)??[])s.append("relation",i);const n=s.toString();return n.length>0?`/knowledge-graph?${n}`:"/knowledge-graph"}function wm(e,t){return e.length===t.length&&e.every((a,s)=>a===t[s])}function km(e,t){if(e.length===0||t.length===0)return e;const a=new Set(t.map(s=>s.id));return e.filter(s=>a.has(s))}function jm(e,t={}){const a=t.timerMode??"unlimited",s=t.plannedDurationSeconds===void 0?a==="planned"?1200:null:t.plannedDurationSeconds;return{actor:e,timerMode:a,plannedDurationSeconds:s,isCurrent:!0,leaseTtlSeconds:1800,note:""}}function Sm(e){switch(e.entityType){case"workbench_flow":case"workbench_surface":case"wiki_space":return null;default:return yo(e.entityType,e.entityId)}}function ni(e,t,a){const s=new URLSearchParams(e.search);if(t?s.set("focus",bo(t.entityType,t.entityId)):s.delete("focus"),a)for(const[o,i]of Object.entries(a))i===null?s.delete(o):s.set(o,i);const n=s.toString();return n?`?${n}`:""}function Nm(e){return new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:e>=1e3?1:0}).format(e)}function Pm(e){return e==="/wiki"||e.startsWith("/wiki/page/")?"/wiki":e==="/wiki/new"||e.startsWith("/wiki/edit/")?"/wiki/editor":e}function oa(e){return`${e.pathname}${e.search}${e.hash}`}function Tm(e,t){const a=new URL(t,"http://forge.local");return{...e,pathname:a.pathname,search:a.search,hash:a.hash,key:`intent:${a.pathname}${a.search}${a.hash}`}}function ot({className:e,...t}){return r.jsx("div",{className:b("w-full max-w-full min-w-0 rounded-[var(--radius-card)] border border-[var(--ui-border-subtle)] bg-[var(--card-gradient)] p-4 shadow-[var(--card-shadow)] backdrop-blur-sm",e),...t})}const rr=[{to:"/psyche",label:"Overview",icon:Oa},{to:"/psyche/metrics",label:"Metrics",icon:vl},{to:"/psyche/flashcards",label:"Flashcards",icon:Sr},{to:"/psyche/values",label:"Values",icon:Fi},{to:"/psyche/patterns",label:"Patterns",icon:bl},{to:"/psyche/questionnaires",label:"Questionnaires",icon:wl},{to:"/psyche/self-observation",label:"Self Observation",icon:Ii},{to:"/psyche/behaviors",label:"Behaviors",icon:Li},{to:"/psyche/reports",label:"Reports",icon:ir},{to:"/psyche/goal-map",label:"Goal Map",icon:kl},{to:"/psyche/schemas-beliefs",label:"Schemas & Beliefs",icon:jl},{to:"/psyche/modes",label:"Modes",icon:Sl},{to:"/psyche/screen-time",label:"Screen Time",icon:Nl},{to:"/preferences",label:"Preferences",icon:Da},{to:"/sleep",label:"Sleep",icon:zi}];function la(e,t){return t==="/psyche"?e==="/psyche":e===t||e.startsWith(`${t}/`)}function dk({className:e}){const t=Bt(),[a,s]=c.useState(!1),n=c.useMemo(()=>[...rr].sort((o,i)=>i.to.length-o.to.length).find(o=>la(t.pathname,o.to))??rr[0],[t.pathname]);return c.useEffect(()=>{if(!a)return;const o=document.body.style.overflow,i=document.body.style.touchAction,l=u=>{u.key==="Escape"&&s(!1)};return document.body.style.overflow="hidden",document.body.style.touchAction="none",window.addEventListener("keydown",l),()=>{document.body.style.overflow=o,document.body.style.touchAction=i,window.removeEventListener("keydown",l)}},[a]),r.jsxs(r.Fragment,{children:[r.jsxs(ot,{className:b("overflow-hidden border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] p-2",e),children:[r.jsx("div",{className:"hidden items-center gap-3 lg:flex",children:r.jsx("div",{className:"flex flex-wrap gap-2",children:rr.map(o=>r.jsxs(lr,{to:o.to,end:o.to==="/psyche",className:({isActive:i})=>b("inline-flex items-center gap-2 whitespace-nowrap rounded-full px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",i||la(t.pathname,o.to)?"bg-[color-mix(in_srgb,var(--tertiary)_18%,var(--ui-surface-1)_82%)] text-[var(--tertiary)]":"bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),children:[r.jsx(o.icon,{className:"size-3.5"}),r.jsx("span",{children:o.label})]},o.to))})}),r.jsx("div",{className:"flex items-center justify-between gap-3 lg:hidden",children:r.jsx("button",{type:"button",className:"inline-flex min-w-0 flex-1 items-center gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3.5 py-2.5 text-left shadow-[var(--ui-shadow-soft)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",onClick:()=>s(!0),children:r.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[r.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-2xl border border-[color-mix(in_srgb,var(--tertiary)_24%,transparent)] bg-[color-mix(in_srgb,var(--tertiary)_14%,transparent)]",children:r.jsx(n.icon,{className:"size-4 text-[var(--tertiary)]"})}),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Psyche section"}),r.jsx("span",{className:"mt-0.5 block truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:n.label})]})]})})})]}),a&&typeof document<"u"?zr.createPortal(r.jsxs("div",{className:"lg:hidden",children:[r.jsx("div",{className:"fixed inset-0 z-50 bg-[var(--overlay)] backdrop-blur-xl"}),r.jsx("button",{type:"button","aria-label":"Close psyche sections",className:"fixed inset-0 z-[51]",onClick:()=>s(!1)}),r.jsx("div",{className:"pointer-events-none fixed inset-0 z-[52] flex items-end justify-center px-3 pt-3 sm:px-4 sm:pt-4",style:{paddingLeft:"max(0.75rem, calc(var(--forge-safe-area-left) + 0.75rem))",paddingRight:"max(0.75rem, calc(var(--forge-safe-area-right) + 0.75rem))",paddingTop:"max(0.75rem, calc(env(safe-area-inset-top) + 0.75rem))",paddingBottom:"calc(var(--forge-mobile-nav-clearance) - 0.25rem)"},children:r.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Psyche sections",className:"pointer-events-auto flex max-h-[min(34rem,calc(100dvh-var(--forge-mobile-nav-clearance)-1rem))] w-full max-w-xl min-h-0 flex-col overflow-hidden rounded-[30px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] shadow-[var(--ui-shadow-floating)]",children:[r.jsx("div",{className:"shrink-0 border-b border-[var(--ui-border-subtle)] px-4 pb-2.5 pt-3 sm:px-5",children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.22em] text-[var(--ui-ink-faint)]",children:"Psyche sections"}),r.jsxs("div",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-2",children:[r.jsx("div",{className:"truncate text-[1.05rem] font-semibold text-[var(--ui-ink-strong)]",children:"Move through Psyche"}),r.jsx("span",{className:"rounded-full border border-[color-mix(in_srgb,var(--tertiary)_24%,transparent)] bg-[color-mix(in_srgb,var(--tertiary)_14%,transparent)] px-2.5 py-1 text-[10px] uppercase tracking-[0.16em] text-[var(--tertiary)]",children:n.label})]})]}),r.jsx("button",{type:"button","aria-label":"Close psyche sections",className:"inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:()=>s(!1),children:r.jsx(dt,{className:"size-4"})})]})}),r.jsx("div",{className:"min-h-0 overflow-y-auto p-3 overscroll-contain sm:p-4",children:r.jsx("div",{className:"grid gap-2",children:rr.map(o=>{const i=la(t.pathname,o.to);return r.jsxs(lr,{to:o.to,end:o.to==="/psyche",onClick:()=>s(!1),className:b("group flex items-center justify-between gap-3 rounded-[22px] border px-3.5 py-3 transition-[transform,border-color,background-color,color] duration-150 hover:-translate-y-[1px] hover:text-[var(--ui-ink-strong)]",i?"border-[color-mix(in_srgb,var(--tertiary)_24%,transparent)] bg-[color-mix(in_srgb,var(--tertiary)_14%,var(--ui-surface-1)_86%)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]"),children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[r.jsx("span",{className:b("flex size-10 shrink-0 items-center justify-center rounded-2xl border transition",i?"border-[color-mix(in_srgb,var(--tertiary)_24%,transparent)] bg-[color-mix(in_srgb,var(--tertiary)_16%,transparent)] text-[var(--tertiary)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] group-hover:border-[var(--ui-border-strong)] group-hover:text-[var(--ui-ink-strong)]"),children:r.jsx(o.icon,{className:"size-4"})}),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:o.label}),r.jsx("span",{className:"mt-0.5 block text-[10px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:o.to==="/preferences"?"Preference system":"Psyche workspace"})]})]}),r.jsx("span",{className:b("rounded-full px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]",i?"bg-[color-mix(in_srgb,var(--tertiary)_16%,transparent)] text-[var(--tertiary)]":"bg-[var(--ui-surface-2)] text-[var(--ui-ink-faint)]"),children:i?"Current":"Open"})]},o.to)})})})]})})]}),document.body):null]})}const Qr=[{id:"overview",to:"/overview",labelKey:"common.routeLabels.overview",detailKey:"common.routeDetails.overview",icon:Ei},{id:"life-force",to:"/life-force",label:"Life Force",detail:"Action Point capacity, weekday curves, and instant drains",icon:Wi},{id:"goals",to:"/goals",labelKey:"common.routeLabels.goals",detailKey:"common.routeDetails.goals",icon:Ra},{id:"habits",to:"/habits",labelKey:"common.routeLabels.habits",detailKey:"common.routeDetails.habits",icon:Ea},{id:"projects",to:"/projects",labelKey:"common.routeLabels.projects",detailKey:"common.routeDetails.projects",icon:Ai},{id:"strategies",to:"/strategies",labelKey:"common.routeLabels.strategies",detailKey:"common.routeDetails.strategies",icon:Kt},{id:"preferences",to:"/preferences",labelKey:"common.routeLabels.preferences",detailKey:"common.routeDetails.preferences",icon:Da},{id:"calendar",to:"/calendar",labelKey:"common.routeLabels.calendar",detailKey:"common.routeDetails.calendar",icon:Ot},{id:"knowledge-graph",to:"/knowledge-graph",label:"Knowledge Graph",detail:"A living graph of Forge entities, links, and structural layers",icon:Fi},{id:"workbench",to:"/workbench",label:"Workbench",detail:"Global graph flows, AI tools, and published outputs",icon:_a},{id:"movement",to:"/movement",labelKey:"common.routeLabels.movement",detailKey:"common.routeDetails.movement",icon:Pl},{id:"sleep",to:"/sleep",labelKey:"common.routeLabels.sleep",detailKey:"common.routeDetails.sleep",icon:zi},{id:"sports",to:"/sports",labelKey:"common.routeLabels.sports",detailKey:"common.routeDetails.sports",icon:Tl},{id:"training-load",to:"/training-load",label:"Training Load",detail:"Cardiovascular load, HR zone targets, acute/chronic stress, and adaptation signals",icon:Il},{id:"vitals",to:"/vitals",label:"Vitals",detail:"Recovery, cardio fitness, breathing, composition, and body signals",icon:Cl},{id:"weight-loss",to:"/weight-loss",label:"Weight Loss",detail:"Food logs, body composition, gut comfort, aesthetic signals, and nutrition experiments",icon:Rl},{id:"kanban",to:"/kanban",labelKey:"common.routeLabels.kanban",detailKey:"common.routeDetails.kanban",icon:ur},{id:"today",to:"/today",labelKey:"common.routeLabels.today",detailKey:"common.routeDetails.today",icon:qr},{id:"rewards",to:"/rewards",label:"Trophy Hall",detail:"Forge Smith levels, streaks, trophies, and cosmetic unlocks",icon:ma},{id:"notes",to:"/notes",labelKey:"common.routeLabels.notes",detailKey:"common.routeDetails.notes",icon:Pt},{id:"wiki",to:"/wiki",labelKey:"common.routeLabels.wiki",detailKey:"common.routeDetails.wiki",icon:La},{id:"psyche",to:"/psyche",labelKey:"common.routeLabels.psyche",detailKey:"common.routeDetails.psyche",icon:Oa},{id:"activity",to:"/activity",labelKey:"common.routeLabels.activity",detailKey:"common.routeDetails.activity",icon:Br},{id:"insights",to:"/insights",labelKey:"common.routeLabels.insights",detailKey:"common.routeDetails.insights",icon:_i},{id:"review",to:"/review/weekly",labelKey:"common.routeLabels.review",detailKey:"common.routeDetails.review",icon:_l},{id:"settings",to:"/settings",labelKey:"common.routeLabels.settings",detailKey:"common.routeDetails.settings",icon:Fr}],Im=rr.filter(e=>e.to!=="/psyche").map(e=>({id:`psyche:${e.to}`,to:e.to,icon:e.icon,label:e.label,detail:"Psyche shortcut"})),Tt=[...Qr,...Im],Cm=Qr.filter(e=>e.to!=="/preferences"&&e.to!=="/sleep");function tr(e){const t=Qr.find(a=>a.id===e);if(!t)throw new Error(`Missing primary route: ${e}`);return t}function Rm(e){return e==="/wiki"||e.startsWith("/wiki/page/")||e==="/wiki/new"||e.startsWith("/wiki/edit/")}function Ar(e){return e.startsWith("/psyche")||e==="/preferences"||e.startsWith("/preferences/")||e==="/sleep"||e.startsWith("/sleep/")}function Lr(e,t){return t.to==="/psyche"?Ar(e):e===t.to||e.startsWith(`${t.to}/`)}function lt(e,t){return e.labelKey?t(e.labelKey):e.label??e.to}function ts(e,t){return e.detailKey?t(e.detailKey):e.detail??e.to}const wo="fixed inset-0 z-50 bg-[var(--ui-overlay-backdrop)] backdrop-blur-sm",ko="fixed left-1/2 z-50 -translate-x-1/2 rounded-[30px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] p-4 shadow-[var(--ui-shadow-floating)] sm:p-5",jo="font-display text-[1.25rem] tracking-[-0.04em] text-[var(--ui-ink-strong)]",So="mt-1 text-[13px] leading-6 text-[var(--ui-ink-muted)]",ii="bg-[var(--ui-surface-1)] text-[var(--ui-ink-muted)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",No="bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)] shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--primary)_28%,transparent)]",kr="text-[var(--ui-ink-faint)]",Pa="forge.desktop-nav-layout",Ta="forge.mobile-nav-layout",oi="forge.nav-layout-migrations",li="forge.desktop-sidebar-metrics-position",_m="desktop-knowledge-graph-default-v1",Em="mobile-knowledge-graph-default-v1";function Ia(e){return!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey}function ci(e,t){if(typeof window>"u")return t;try{const a=window.localStorage.getItem(e);if(!a)return t;const s=JSON.parse(a);if(!Array.isArray(s))return t;const n=new Set(Tt.map(m=>m.id)),o=s.filter(m=>typeof m=="string"&&n.has(m)),i=o.length>0?o:t,l=()=>{try{const m=window.localStorage.getItem(oi);if(!m)return{};const g=JSON.parse(m);return g&&typeof g=="object"&&!Array.isArray(g)?g:{}}catch{return{}}},u=m=>{try{window.localStorage.setItem(oi,JSON.stringify(m))}catch{return}},p=(m,g,f)=>{const v=l();if(v[g])return m;const y=m.includes("knowledge-graph")?m:(()=>{const _=m.indexOf(f);return _<0?[...m,"knowledge-graph"]:[...m.slice(0,_+1),"knowledge-graph",...m.slice(_+1)]})();return u({...v,[g]:!0}),y};return e===Pa?p(i,_m,"calendar"):e===Ta?p(i,Em,"notes"):i}catch{return t}}function di(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{return}}function Am(e){const[t,a]=c.useState(!1),[s,n]=c.useState(()=>ci(Pa,[...Cm.map(w=>w.id)])),[o,i]=c.useState(()=>ci(Ta,[tr("overview").id,tr("today").id,tr("kanban").id,tr("notes").id,tr("knowledge-graph").id])),[l,u]=c.useState(!1),[p,m]=c.useState(()=>{if(typeof window>"u")return"above";try{return window.localStorage.getItem(li)==="below"?"below":"above"}catch{return"above"}}),g=c.useRef(!1),f=c.useRef(!1),v=c.useRef(!1),y=Rm(e)||Ar(e)||e.startsWith("/workbench")||e.startsWith("/knowledge-graph"),_=s.map(w=>Tt.find(P=>P.id===w)??null).filter(w=>w!==null),h=o.map(w=>Tt.find(P=>P.id===w)??null).filter(w=>w!==null);return c.useEffect(()=>{try{window.localStorage.getItem("forge.desktop-nav-collapsed")==="true"&&a(!0)}catch{return}},[]),c.useEffect(()=>{if(v.current){v.current=!1;return}try{window.localStorage.setItem("forge.desktop-nav-collapsed",String(t))}catch{return}},[t]),c.useEffect(()=>{try{window.localStorage.setItem(li,p)}catch{return}},[p]),c.useEffect(()=>{di(Pa,s)},[s]),c.useEffect(()=>{di(Ta,o)},[o]),c.useEffect(()=>{if(y){g.current||(f.current=t,g.current=!0,t||(v.current=!0,a(!0)));return}g.current&&(g.current=!1,t!==f.current&&(v.current=!0,a(f.current)))},[y,t]),{navCollapsed:t,setNavCollapsed:a,desktopNavIds:s,setDesktopNavIds:n,mobileNavIds:o,setMobileNavIds:i,desktopRoutes:_,mobileRoutes:h,navEditorOpen:l,setNavEditorOpen:u,desktopSidebarMetricsPosition:p,setDesktopSidebarMetricsPosition:m}}function Lm({route:e,compact:t=!1,onRouteIntent:a}){const{t:s}=De(),n=Bt(),o=lt(e,s),i=e.icon,l=Lr(n.pathname,e);return r.jsxs(lr,{to:e.to,title:t?o:void 0,"aria-label":o,onClick:u=>{Ia(u)&&(a==null||a(e.to))},className:({isActive:u})=>b("interactive-tap flex items-center rounded-[18px] text-sm transition",u||l?No:"text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",t?"justify-center px-3 py-3.5":"gap-3 px-4 py-3"),children:[r.jsx(i,{className:"size-4 shrink-0"}),t?null:r.jsx("span",{children:o})]})}function Om({routes:e,onOpenEditor:t,onRouteIntent:a}){const[s,n]=c.useState(!1),{t:o}=De(),i=Bt(),l=c.useRef(null),u=c.useRef(!1),p=e.slice(0,4),m=Tt.filter(v=>!p.some(y=>y.id===v.id));function g(){u.current=!1,l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{u.current=!0,n(!1),t==null||t()},520)}function f(){l.current!==null&&(window.clearTimeout(l.current),l.current=null)}return r.jsxs(r.Fragment,{children:[r.jsx("nav",{"data-testid":"mobile-bottom-nav",className:"fixed inset-x-0 bottom-0 z-40 border-t border-[var(--ui-border-subtle)] bg-[color-mix(in_srgb,var(--surface-glass)_96%,transparent)] backdrop-blur-xl lg:hidden",style:{paddingLeft:"max(0.75rem, calc(var(--forge-safe-area-left) + 0.75rem))",paddingRight:"max(0.75rem, calc(var(--forge-safe-area-right) + 0.75rem))",paddingTop:"0.75rem",paddingBottom:"calc(var(--forge-safe-area-bottom) + 0.75rem)"},children:r.jsxs("div",{className:"grid grid-cols-5 gap-2",children:[p.map(v=>r.jsxs(lr,{to:v.to,onPointerDown:g,onPointerUp:f,onPointerLeave:f,onClick:y=>{if(u.current){y.preventDefault(),u.current=!1;return}Ia(y)&&(a==null||a(v.to))},className:({isActive:y})=>b("flex min-h-11 flex-col items-center justify-center gap-1 rounded-2xl px-2 py-2 text-[12px]",y||Lr(i.pathname,v)?"bg-[var(--ui-surface-active)] text-[var(--primary)]":"text-[var(--ui-ink-soft)]"),children:[r.jsx(v.icon,{className:"size-4"}),r.jsx("span",{children:lt(v,o)})]},v.id)),r.jsxs("button",{type:"button",className:"flex min-h-11 flex-col items-center justify-center gap-1 rounded-2xl px-2 py-2 text-[12px] text-[var(--ui-ink-soft)]",onClick:()=>{if(u.current){u.current=!1;return}n(!0)},onPointerDown:g,onPointerUp:f,onPointerLeave:f,children:[r.jsx(Fr,{className:"size-4"}),r.jsx("span",{children:o("common.shell.more")})]})]})}),r.jsxs(es,{open:s,onOpenChange:n,eyebrow:o("common.shell.moreRoutesEyebrow"),title:o("common.shell.moreRoutesTitle"),description:o("common.shell.moreRoutesDescription"),children:[r.jsx("div",{className:"mb-3 flex items-center justify-between gap-3",children:r.jsxs("button",{type:"button",className:b("inline-flex min-h-10 items-center gap-2 rounded-full px-3 py-2 text-sm",ii),onClick:()=>{n(!1),t==null||t()},children:[r.jsx($a,{className:"size-4"}),"Customize navigation"]})}),r.jsx("div",{className:"grid gap-3",children:m.map(v=>r.jsxs(lr,{to:v.to,onClick:y=>{Ia(y)&&(a==null||a(v.to)),n(!1)},className:({isActive:y})=>b("interactive-tap flex items-center justify-between rounded-[24px] px-4 py-4",y||Lr(i.pathname,v)?No:ii),children:[r.jsxs("span",{className:"flex items-center gap-3",children:[r.jsx(v.icon,{className:"size-4 text-[var(--primary)]"}),r.jsxs("span",{children:[r.jsx("span",{className:"block text-base font-medium",children:lt(v,o)}),r.jsx("span",{className:"mt-1 block text-sm text-[var(--ui-ink-soft)]",children:ts(v,o)})]})]}),r.jsx(Br,{className:"size-4 text-[var(--ui-ink-faint)]"})]},v.id))})]})]})}function Dm(e,t,a){const s=e.indexOf(t),n=e.indexOf(a);return s<0||n<0||s===n?e:yc(e,s,n)}function $m({route:e,prefix:t,label:a,onRemove:s}){const n=gc({id:`${t}:${e.id}`});return r.jsxs("div",{ref:n.setNodeRef,style:{transform:fc.Transform.toString(n.transform),transition:n.transition},className:"flex min-h-16 items-center justify-between gap-3 rounded-[20px] bg-[var(--ui-surface-1)] px-4 py-3",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[r.jsx("button",{type:"button",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]","aria-label":`Reorder ${a}`,...n.attributes,...n.listeners,children:r.jsx($a,{className:"size-4"})}),r.jsx(e.icon,{className:"size-4 shrink-0 text-[var(--primary)]"}),r.jsx("span",{className:"truncate text-sm text-[var(--ui-ink-strong)]",children:a})]}),r.jsx("button",{type:"button",className:"rounded-full bg-[var(--ui-surface-2)] px-3 py-1.5 text-[12px] text-[var(--ui-ink-medium)]",onClick:s,children:"Remove"})]})}function Mm({open:e,onOpenChange:t,desktopNavIds:a,onDesktopNavIdsChange:s,desktopSidebarMetricsPosition:n,onDesktopSidebarMetricsPositionChange:o,mobileNavIds:i,onMobileNavIdsChange:l}){const{t:u}=De(),p=lc(cc(dc,{activationConstraint:{distance:6}})),m=Tt.filter(h=>!a.includes(h.id)||!i.includes(h.id)),g=10,f=4;function v(h,w,P,x,$){const S=h.map(N=>Tt.find(E=>E.id===N)??null).filter(N=>N!==null),F=Math.max(0,w-S.length);return r.jsxs("div",{className:"grid gap-2",children:[r.jsx(uc,{sensors:p,collisionDetection:mc,onDragEnd:N=>{const E=String(N.active.id),T=N.over?String(N.over.id):null;T&&P(Dm(h,E.replace(`${$}:`,""),T.replace(`${$}:`,"")))},children:r.jsx(pc,{items:S.map(N=>`${$}:${N.id}`),strategy:hc,children:S.map(N=>r.jsx($m,{route:N,prefix:$,label:lt(N,u),onRemove:()=>_(h,N.id,P,x)},`${$}-${N.id}`))})}),Array.from({length:F},(N,E)=>r.jsxs("div",{className:"flex min-h-16 items-center justify-between gap-3 rounded-[20px] border border-dashed border-[var(--ui-border-strong)] bg-[var(--ui-surface-1)] px-4 py-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:"Empty slot"}),r.jsx("div",{className:"text-[12px] text-[var(--ui-ink-faint)]",children:"Add a route below to fill this slot"})]}),r.jsxs("div",{className:"rounded-full bg-[var(--ui-surface-2)] px-2.5 py-1 text-[11px] text-[var(--ui-ink-faint)]",children:["Slot ",S.length+E+1]})]},`${$}-empty-${E}`))]})}function y(h,w,P,x){if(h.includes(w))return;const $=[...h,w];P(x?$.slice(0,x):$)}function _(h,w,P,x=1){const $=h.filter(S=>S!==w);$.length<x||P($)}return r.jsx(es,{open:e,onOpenChange:t,eyebrow:"Navigation",title:"Customize navigation",description:"Add or remove main routes, Psyche shortcuts, and the Workbench flow workspace.",children:r.jsxs("div",{className:"grid gap-5",children:[r.jsxs("div",{className:"grid gap-3",children:[r.jsx("div",{className:b("text-[11px] uppercase tracking-[0.16em]",kr),children:"Desktop sidebar"}),r.jsxs("div",{className:"rounded-[20px] bg-[var(--ui-surface-1)] p-3",children:[r.jsx("div",{className:b("text-[11px] uppercase tracking-[0.14em]",kr),children:"Metric strip position"}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:[["above","Above navigation"],["below","Below navigation"]].map(([h,w])=>r.jsx("button",{type:"button",className:b("rounded-full px-3 py-1.5 text-[12px] transition",n===h?"bg-[var(--primary)] text-[var(--ui-ink-on-accent)]":"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)]"),onClick:()=>o(h),children:w},h))})]}),r.jsx("div",{className:"grid gap-2",children:v(a,g,s,4,"desktop")})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsx("div",{className:b("text-[11px] uppercase tracking-[0.16em]",kr),children:"Mobile bar"}),r.jsx("div",{className:"grid gap-2",children:v(i,f,l,2,"mobile")})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsx("div",{className:b("text-[11px] uppercase tracking-[0.16em]",kr),children:"Available routes"}),r.jsx("div",{className:"grid gap-2",children:m.map(h=>r.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-[20px] bg-[var(--ui-surface-1)] px-4 py-3",children:[r.jsxs("span",{className:"flex items-center gap-3",children:[r.jsx(h.icon,{className:"size-4 text-[var(--primary)]"}),r.jsxs("span",{children:[r.jsx("span",{className:"block text-sm text-[var(--ui-ink-strong)]",children:lt(h,u)}),r.jsx("span",{className:"block text-[12px] text-[var(--ui-ink-soft)]",children:ts(h,u)})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[a.includes(h.id)?null:r.jsx("button",{type:"button",className:"rounded-full bg-[var(--ui-surface-2)] px-2.5 py-1.5 text-[11px] text-[var(--ui-ink-medium)]",onClick:()=>y(a,h.id,s),children:"+ Sidebar"}),i.includes(h.id)?null:r.jsx("button",{type:"button",className:"rounded-full bg-[var(--ui-surface-2)] px-2.5 py-1.5 text-[11px] text-[var(--ui-ink-medium)]",onClick:()=>y(i,h.id,l,4),children:"+ Mobile"})]})]},`available-${h.id}`))})]})]})})}function Po({eyebrow:e,title:t,description:a}){const{t:s}=De();return r.jsxs(ot,{className:"surface-pulse ambient-glow mx-auto grid max-w-2xl gap-4 text-center",children:[r.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:e??s("common.labels.loading")}),r.jsx("div",{className:"type-display-section text-[var(--ui-ink-strong)]",children:t??s("common.pageState.loadingTitle")}),r.jsx("p",{className:"type-body mx-auto max-w-xl text-[var(--ui-ink-soft)]",children:a??s("common.pageState.loadingDescription")}),r.jsxs("div",{className:"mx-auto flex min-h-11 items-center gap-3 rounded-full bg-[var(--ui-surface-2)] px-4 py-3 text-[var(--ui-ink-soft)]",children:[r.jsx(za,{tone:"subtle",className:"size-3.5"}),r.jsx("span",{className:"type-meta",children:s("common.labels.syncInProgress")})]})]})}function Cr({error:e,onRetry:t,eyebrow:a}){const{t:s}=De(),{title:n,description:o,code:i}=Ic(e);return r.jsxs(ot,{className:"mx-auto grid max-w-2xl gap-4",children:[r.jsx("div",{className:"type-label text-rose-200/72",children:a??s("common.labels.connectionState")}),r.jsx("div",{className:"type-display-section text-[var(--ui-ink-strong)]",children:n}),r.jsx("p",{className:"type-body text-[var(--ui-ink-soft)]",children:o}),r.jsx("div",{className:"type-meta text-[var(--ui-ink-faint)]",children:s("common.labels.errorCode",{code:i})}),t?r.jsx("div",{className:"flex flex-wrap gap-3",children:r.jsxs(ue,{type:"button",variant:"secondary",onClick:t,children:[r.jsx(Ma,{className:"mr-2 size-4"}),s("common.actions.retry")]})}):null]})}function uk({eyebrow:e,title:t,description:a,action:s}){const{t:n}=De();return r.jsxs(ot,{className:"mx-auto grid max-w-2xl gap-4 text-center",children:[r.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:e??n("common.labels.loading")}),r.jsx("div",{className:"type-display-section text-[var(--ui-ink-strong)]",children:t}),r.jsx("p",{className:"type-body mx-auto max-w-xl text-[var(--ui-ink-soft)]",children:a}),s?r.jsx("div",{className:"flex justify-center",children:s}):null]})}function Fm(e){const t=new URLSearchParams;return e.job.spaceId&&t.set("spaceId",e.job.spaceId),t.set("ingest","1"),t.set("ingestJobId",e.job.id),{pathname:"/wiki",search:`?${t.toString()}`}}function zm(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}function Wm({open:e,onOpenChange:t,isLoading:a,isError:s,error:n,onRetry:o,recentIngestJobs:i}){return r.jsx(ft,{open:e,onOpenChange:t,children:r.jsxs(yt,{children:[r.jsx(xt,{className:wo}),r.jsxs(vt,{className:b(ko,"top-[10vh] w-[min(42rem,calc(100vw-1.5rem))]"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx(bt,{className:jo,children:"Background activity"}),r.jsx(wt,{className:So,children:"Follow active KarpaWiki ingest jobs and reopen completed reviews without leaving your current context."})]}),r.jsx(Dt,{asChild:!0,children:r.jsx(fr,{"aria-label":"Close background activity dialog"})})]}),r.jsx("div",{className:"mt-4 max-h-[65vh] overflow-y-auto",children:a?r.jsx(Po,{eyebrow:"Background",title:"Loading activity",description:"Checking the latest queued and completed ingest jobs."}):s?r.jsx(Cr,{eyebrow:"Background",error:n,onRetry:o}):i.length===0?r.jsx("div",{className:"rounded-[24px] border border-dashed border-[var(--ui-border-strong)] px-4 py-10 text-center text-[13px] leading-6 text-[var(--ui-ink-faint)]",children:"No background ingest jobs yet."}):r.jsx("div",{className:"grid gap-3",children:i.map(l=>{const u=["queued","processing"].includes(l.job.status);return r.jsx(Lt,{to:Fm(l),onClick:()=>t(!1),className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-4 transition hover:bg-[var(--ui-surface-hover)]",children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"KarpaWiki ingest"}),r.jsx("div",{className:"mt-2 text-[14px] font-semibold text-[var(--ui-ink-strong)]",children:l.job.titleHint||l.job.latestMessage||"Background ingest"}),r.jsxs("div",{className:"mt-1 text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:[l.job.status," · ",l.job.phase," ·"," ",l.job.progressPercent,"% ·"," ",zm(l.job.updatedAt)]}),r.jsxs("div",{className:"mt-2 text-[12px] leading-5 text-[var(--ui-ink-faint)]",children:[l.job.createdPageCount," pages ·"," ",l.job.createdEntityCount," entities ·"," ",l.job.acceptedCount," accepted ·"," ",l.job.rejectedCount," rejected"]})]}),r.jsx("div",{className:"shrink-0",children:u?r.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-xs text-[var(--ui-ink-soft)]",children:[r.jsx(Ma,{className:"size-3.5 animate-spin"}),"Running"]}):r.jsx(le,{tone:"meta",children:l.job.phase})})]})},l.job.id)})})})]})]})})}const To=[{key:"deep_work",label:"Deep work",description:"High-focus work, coding, writing, studying, or mentally demanding work.",defaultRateApPerHour:14},{key:"admin",label:"Admin",description:"Email, coordination, planning, logistics, and fragmented office work.",defaultRateApPerHour:9},{key:"maintenance",label:"Maintenance",description:"Light chores, errands, upkeep, and low-friction background work.",defaultRateApPerHour:6},{key:"meeting",label:"Meeting",description:"Busy social or collaborative commitments with real cognitive and social load.",defaultRateApPerHour:13},{key:"recovery_break",label:"Rest",description:"Lunch, recovery, and decompression are still activities, just lighter ones.",defaultRateApPerHour:3},{key:"holiday_leisure",label:"Holiday",description:"Leisure, outings, or all-day holiday context that still consumes throughput.",defaultRateApPerHour:4},{key:"light_context",label:"Light context",description:"Visible low-friction context that still occupies a little capacity.",defaultRateApPerHour:2},{key:"task_inherited",label:"Task default",description:"Use the task's own Action Point profile for this timebox.",defaultRateApPerHour:100/24}];function Io(e,t,a){return Math.min(a,Math.max(t,e))}function yr(e,t){return Math.max(0,Math.floor((Date.parse(t)-Date.parse(e))/1e3))}function Ht(e,t){const a=t/3600*e;return{rateApPerHour:Number(e.toFixed(2)),totalAp:Number(a.toFixed(2))}}function rs(e){return(e==null?void 0:e.sustainRateApPerHour)??null}function Co(e){var t;return((t=To.find(a=>a.key===e))==null?void 0:t.defaultRateApPerHour)??null}function Ro(e){var t;return typeof((t=e==null?void 0:e.metadata)==null?void 0:t.activityPresetKey)=="string"?e.metadata.activityPresetKey:null}function qm(e){var t;return typeof((t=e==null?void 0:e.metadata)==null?void 0:t.customSustainRateApPerHour)=="number"?e.metadata.customSustainRateApPerHour:null}function mk(){return To}function pk(e){return Ro(e)}function hk(e){return qm(e)}function _o(e,t){return typeof e!="number"||!Number.isFinite(e)?`0 ${t}`:`${Number(e.toFixed(1))} ${t}`}function gk(e){return _o(e,"AP")}function Bm(e){return _o(e,"AP/h")}function fk(e){const t=rs(e.actionProfile)??4.166666666666667;return Ht(t,yr(e.startsAt,e.endsAt))}function Eo(e){return e==="main_activity"?14:e==="secondary_activity"?9:e==="third_activity"||e==="custom"?6:e==="holiday"?4:3}function yk(e){const t=rs(e.actionProfile)??Eo(e.kind);return Ht(t,yr(e.startAt,e.endAt))}function xk(e){const t="2026-01-01T00:00:00.000Z",a=new Date(t);a.setUTCMinutes(e.startMinute,0,0);const s=new Date(t);s.setUTCMinutes(e.endMinute,0,0),s<=a&&s.setUTCDate(s.getUTCDate()+1);const n=e.customSustainRateApPerHour??Co(e.activityPresetKey)??Eo(e.kind);return Ht(n,yr(a.toISOString(),s.toISOString()))}function Km(e){const t=`${e.title} ${e.eventType??""}`.toLowerCase();return t.includes("lunch")||t.includes("break")||t.includes("rest")?3:t.includes("holiday")||t.includes("vacation")?4:t.includes("meeting")||t.includes("call")||t.includes("interview")?13:t.includes("deep work")||t.includes("focus")?14:t.includes("admin")||t.includes("email")||t.includes("inbox")?9:e.availability==="busy"?12:2}function vk(e){const t=e.customSustainRateApPerHour??rs(e.actionProfile)??Co(e.activityPresetKey??Ro(e.actionProfile))??Km(e);return Ht(t,yr(e.startAt,e.endAt))}function bk(e){const t=Io((e.expectedMet??2)*4,4,22);return Ht(t,yr(e.startedAt,e.endedAt))}function wk(e){return{totalAp:3,rateApPerHour:0}}function kk(e){if(!e.generatedHealthEventTemplate.enabled)return null;const t=Io(e.generatedHealthEventTemplate.durationMinutes||0,0,1440);return t<=0?null:Ht(24,t*60)}function jk(e){return{totalAp:1,rateApPerHour:0}}const Hm={ap:"Action Points estimate remaining usable capacity today from the Life Force model. They combine baseline capacity, current drains, and scheduled recovery.","instant-ap":"Instant AP per hour estimates the headroom Forge thinks you have right now. Positive values mean the current moment can absorb more work; low or negative values suggest recovery or lighter work.",streak:"The streak counts qualifying Forge activity days. It is a consistency signal, not a moral score.",xp:"XP comes from the auditable reward ledger. It summarizes completed work and meaningful captured evidence across Forge.",momentum:"Momentum combines recent XP, task movement, habit evidence, and streak context into a quick operating signal for the selected user scope."},ui={title:"Forge surface",purpose:"This view is part of the Forge operating system. It keeps the current user scope, active work timer, search, creation tools, and navigation available while the page focuses on one domain.",primaryAction:"Use the page title, nearby chips, and visible action buttons to decide whether you are reviewing evidence, planning work, or executing the next task.",metricNote:"Numbers in Forge are decision-support signals. Open the local tooltips on metric labels to see exactly what each one means."},mi={overview:{title:"Overview",purpose:"Overview is the daily command page. It combines momentum, Life Force, active goals, active projects, top tasks, health context, and recent evidence into one scan.",primaryAction:"Start here when you need to choose what matters next. Open the top task, inspect the body-signal block, or jump into Today when the next move is unclear.",metricNote:"Momentum, AP, XP, and streak are summary signals. They are meant to point attention, not replace judgement."},"life-force":{title:"Life Force",purpose:"Life Force models daily Action Point capacity, current drains, recovery, and the editable weekly capacity curve.",primaryAction:"Use it to understand whether the next work block should be heavy, light, or delayed until recovery improves.",metricNote:"AP and AP/hour are local planning units. They are not medical or physiological measurements."},goals:{title:"Goals",purpose:"Goals describe long-range direction and keep projects, tasks, habits, and evidence connected to something larger.",primaryAction:"Review goal progress, open a goal detail page, and check whether current projects still point at the right horizon."},habits:{title:"Habits",purpose:"Habits track recurring commitments, check-ins, streak evidence, and reward signals.",primaryAction:"Use this view to check in, inspect habit drift, and decide which routines need adjustment."},projects:{title:"Projects",purpose:"Projects are PRD-backed initiatives that connect goals, strategies, issues, tasks, ownership, and delivery state.",primaryAction:"Open project detail for PRD context, or switch to hierarchy when you need the full goal-to-task chain."},strategies:{title:"Strategies",purpose:"Strategies capture the reasoning layer between goals and execution. They explain why the work is arranged this way.",primaryAction:"Use this view to inspect strategy graphs and check whether active work still follows the intended plan."},preferences:{title:"Preferences",purpose:"Preferences store pairwise judgments, profiles, and model state that help Forge and agents understand taste and priorities.",primaryAction:"Use it when Forge needs clearer ranking signals or when agent recommendations feel misaligned."},calendar:{title:"Calendar",purpose:"Calendar turns planning into timeboxes and provider-backed scheduled commitments.",primaryAction:"Use it to inspect the week, move timeboxes, and keep commitments visible next to execution work."},"knowledge-graph":{title:"Knowledge Graph",purpose:"Knowledge Graph shows Forge entities and links as a living map so goals, tasks, notes, wiki pages, Psyche records, and evidence do not stay isolated.",primaryAction:"Search or focus a node when you need context around an entity before editing or executing work."},workbench:{title:"Workbench",purpose:"Workbench organizes graph flows, AI tools, published outputs, and reusable operations.",primaryAction:"Open a flow when you need a structured tool process instead of a normal page action."},movement:{title:"Movement",purpose:"Movement explains trips, stays, places, and location-derived context from the companion sync.",primaryAction:"Use it to understand where time went, verify movement import quality, and connect place context to daily planning."},sleep:{title:"Sleep",purpose:"Sleep presents canonical nights, recovery context, and raw segment evidence without making transport fragments the main product object.",primaryAction:"Use it to check whether today should be a heavy training/work day or a recovery-biased day."},sports:{title:"Sports",purpose:"Sports is the workout cockpit: sessions, routes, preserved HealthKit evidence, friendly activity names, and per-workout drill-down.",primaryAction:"Open a workout when you need the evidence behind a training-load or heart-rate conclusion."},"training-load":{title:"Training Load",purpose:"Training Load estimates cardiovascular stress from workouts, heart-rate timelines, adaptive HRR zones, and recent vitals.",primaryAction:"Use it to decide whether the next block should build aerobic base, hold load, sharpen intensity, or recover.",metricNote:"ACWR, strain, HR zones, and VO2max are coaching signals. They are not clinical diagnosis and should be interpreted with session context."},vitals:{title:"Vitals",purpose:"Vitals gathers body signals such as resting heart rate, HRV, VO2max, breathing, and body metrics.",primaryAction:"Use it to inspect recovery trends and confirm whether a single number is stable or just a sparse reading."},kanban:{title:"Kanban",purpose:"Kanban is the execution board for active work items and lane movement.",primaryAction:"Move work deliberately between backlog, focus, in progress, blocked, and done. Open task detail for execution notes."},today:{title:"Today",purpose:"Today narrows Forge to immediate commitments, planned work, due habits, and the next meaningful actions.",primaryAction:"Use it when the system feels too broad and you need a single practical runway."},rewards:{title:"Trophy Hall",purpose:"Trophy Hall explains XP, levels, streaks, achievements, cosmetic unlocks, and the Forge Smith state from the reward ledger.",primaryAction:"Use it to understand what behavior earned rewards and what current next targets mean."},notes:{title:"Notes",purpose:"Notes store evidence, thoughts, linked context, and local memory that can attach to Forge entities.",primaryAction:"Capture raw context here, then link it to goals, projects, tasks, Psyche records, or wiki pages."},wiki:{title:"KarpaWiki",purpose:"KarpaWiki is the durable knowledge surface for authored pages, imported material, links, summaries, and entity memory.",primaryAction:"Search before creating, then write or ingest when the knowledge should become reusable."},psyche:{title:"Psyche",purpose:"Psyche tracks values, modes, behaviors, beliefs, patterns, reports, questionnaires, and flashcards as reflective records.",primaryAction:"Use it to turn mental-state evidence into structured reminders, behavior maps, and reviewable reports."},activity:{title:"Activity",purpose:"Activity is the event log for work, imports, edits, agent actions, and recent system evidence.",primaryAction:"Use it to audit what changed and jump back to the entity that produced the evidence."},insights:{title:"Insights",purpose:"Insights stores recommendations and realizations that may need to become real Forge records.",primaryAction:"Review each insight, then apply, link, or dismiss it so it does not remain vague advice."},review:{title:"Weekly Review",purpose:"Weekly Review turns recent evidence into a closeout: wins, calibration, unfinished loops, and next-week direction.",primaryAction:"Use it at the end of a week to convert activity into decisions and written memory."},settings:{title:"Settings",purpose:"Settings controls runtime configuration, data tools, users, agents, mobile pairing, models, rewards, logs, and recovery surfaces.",primaryAction:"Use it for configuration or maintenance. Avoid changing data paths unless you explicitly intend a storage migration."}};function Um(e){if(!e)return ui;const t=e.split(":")[0]??e;return mi[e]??mi[t]??ui}function Gm(e,t){return[{id:"ap",label:"AP",compactValue:e.lifeForce?String(Math.round(e.lifeForce.remainingAp)):"0",expandedValue:e.lifeForce?`${Math.round(e.lifeForce.remainingAp)} AP left`:"AP unavailable",icon:Wi},{id:"instant-ap",label:"Instant AP/h",compactValue:e.lifeForce?String(Number(e.lifeForce.instantFreeApPerHour.toFixed(1))):"0",expandedValue:e.lifeForce?Bm(e.lifeForce.instantFreeApPerHour):"0 AP/h",icon:qr},{id:"streak",label:t("common.shell.momentum.streak"),compactValue:String(e.metrics.streakDays),expandedValue:t(e.metrics.streakDays===1?"common.shell.momentum.streakBadgeOne":"common.shell.momentum.streakBadgeOther",{count:e.metrics.streakDays}),icon:Ti},{id:"xp",label:t("common.shell.momentum.xp"),compactValue:String(e.metrics.totalXp),expandedValue:`${e.metrics.totalXp} XP`,icon:ur},{id:"momentum",label:t("common.shell.momentum.momentum"),compactValue:`${e.metrics.momentumScore}%`,expandedValue:t("common.shell.momentum.liveMomentum",{count:e.metrics.momentumScore}),icon:El}]}function pi({metrics:e,collapsed:t}){return r.jsx("div",{className:b(t?"mt-4":"mt-6"),children:r.jsxs("div",{className:b("rounded-[24px] bg-[var(--ui-surface-1)]",t?"px-2 py-2.5":"p-4"),children:[t?null:r.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:"Live metrics"}),r.jsx("div",{className:b("grid",t?"gap-1.5":"mt-3 gap-3"),children:e.map(a=>r.jsx(Vm,{metric:a,collapsed:t},a.id))})]})})}function Vm({metric:e,collapsed:t}){const a=e.icon;return t?r.jsxs("div",{title:`${e.label}: ${e.compactValue}`,className:"flex min-w-0 flex-col items-center gap-1 rounded-[16px] bg-[var(--ui-surface-1)] px-1 py-2.5 text-center",children:[r.jsx(a,{className:"size-3.5 shrink-0 text-[var(--ui-ink-faint)]"}),r.jsx("div",{className:"max-w-full text-[12px] font-semibold leading-none text-[var(--ui-ink-strong)]",children:e.compactValue})]}):r.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-1)] px-3 py-3",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-[0.14em] text-[var(--ui-ink-faint)]",children:[r.jsx("span",{children:e.label}),r.jsx(zt,{label:`Explain ${e.label}`,title:e.label,content:Hm[e.id]??"This is a live Forge shell metric for the selected user scope.",panelClassName:"normal-case tracking-normal"})]}),r.jsx("div",{className:"mt-1 text-lg font-semibold leading-tight text-[var(--ui-ink-strong)]",children:e.expandedValue})]})}function Jm({prompt:e,setPrompt:t,onSubmit:a}){return r.jsx(ft,{open:e!==null,onOpenChange:s=>{s||t(null)},children:r.jsxs(yt,{children:[r.jsx(xt,{className:"fixed inset-0 z-[70] bg-[var(--ui-overlay-backdrop)] backdrop-blur-xl"}),r.jsxs(vt,{className:"fixed left-1/2 top-1/2 z-[71] w-[min(92vw,34rem)] -translate-x-1/2 -translate-y-1/2 rounded-[28px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] p-6 shadow-[var(--ui-shadow-floating)]",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx(bt,{className:"font-display text-[1.35rem] leading-tight text-[var(--ui-ink-strong)]",children:"Log today's work before closing"}),r.jsxs(wt,{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-medium)]",children:["Forge closes tasks from actual time worked today, not from the checkbox itself. Add the time you spent on"," ",r.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:(e==null?void 0:e.title)??"this task"})," ","today, or confirm that you did not work on it today."]})]}),r.jsx(fr,{onClick:()=>t(null)})]}),r.jsxs("div",{className:"mt-5",children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Quick amounts"}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:[{label:"5m",seconds:300},{label:"15m",seconds:900},{label:"30m",seconds:1800},{label:"1h",seconds:3600},{label:"2h",seconds:7200}].map(s=>r.jsx(ue,{variant:"secondary",onClick:()=>a(s.seconds),children:s.label},s.label))})]}),r.jsxs("div",{className:"mt-5 grid gap-3 rounded-[20px] bg-[var(--ui-surface-1)] p-4",children:[r.jsxs("label",{className:"grid gap-2 text-sm text-[var(--ui-ink-medium)]",children:[r.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Custom minutes"}),r.jsx("input",{type:"number",min:0,step:5,value:(e==null?void 0:e.customMinutes)??"",onChange:s=>{t(n=>n&&{...n,customMinutes:s.target.value,error:null})},className:"h-11 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[color-mix(in_srgb,var(--primary)_40%,transparent)] focus:bg-[var(--ui-surface-2)]",placeholder:"45"})]}),e!=null&&e.error?r.jsx("div",{className:"text-sm text-[var(--danger)]",children:e.error}):null]}),r.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-3",children:[r.jsx(ue,{variant:"secondary",onClick:()=>t(null),children:"Cancel"}),r.jsx(ue,{variant:"secondary",onClick:()=>a(0),children:"No work today"}),r.jsx(ue,{onClick:()=>{if(!e)return;const s=Number(e.customMinutes);if(!Number.isFinite(s)||s<0){t(n=>n&&{...n,error:"Enter a valid number of minutes."});return}a(Math.round(s*60))},children:"Close with logged time"})]})]})]})})}const as=c.createContext({expanded:!1,setExpanded:()=>{}});function hi({children:e}){const[t,a]=c.useState(!1),s=c.useRef(0);return c.useEffect(()=>{if(!t)return;s.current=performance.now();let n=window.scrollY;const o=()=>{if(performance.now()-s.current<280){n=window.scrollY;return}window.scrollY-n>16&&a(!1),n=window.scrollY};return window.addEventListener("scroll",o,{passive:!0}),()=>window.removeEventListener("scroll",o)},[t]),r.jsx(as.Provider,{value:{expanded:t,setExpanded:a},children:e})}function At(e){const t=Math.max(0,Math.floor(e)),a=Math.floor(t/3600),s=Math.floor(t%3600/60),n=t%60;return a>0?`${a}:${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`:`${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function Xm(e,t,a,s,n){const o=Math.max(1,e.length),i=Date.parse(a),l=Number.isFinite(i)?Math.max(0,Math.floor((n-i)/1e3)):0;return e.map(u=>{const p=t.find(_=>_.id===u.taskId),m=u.status==="active"?u.elapsedWallSeconds+l:u.elapsedWallSeconds,g=u.status!=="active"?0:s==="parallel"?l:s==="split"?l/o:u.isCurrent?l:0,f=u.creditedSeconds+g,v=u.timerMode==="planned"&&u.plannedDurationSeconds!==null?Math.max(0,u.plannedDurationSeconds-m):null,y=u.timerMode==="planned"&&u.plannedDurationSeconds!==null?Math.max(0,m-u.plannedDurationSeconds):0;return{run:u,title:(p==null?void 0:p.title)??u.taskTitle,wallSeconds:m,creditedSeconds:f,remainingSeconds:v,overtimeSeconds:y}}).sort((u,p)=>Number(p.run.isCurrent)-Number(u.run.isCurrent))}function Ao(e,t,a,s){const[n,o]=c.useState(()=>Date.now());return c.useEffect(()=>{if(e.length===0)return;const i=window.setInterval(()=>o(Date.now()),1e3);return()=>window.clearInterval(i)},[e.length]),c.useMemo(()=>Xm(e,t,a,s,n),[a,n,e,t,s])}function gi({runs:e,tasks:t,generatedAt:a,timeAccountingMode:s,pending:n,onOpenStartWork:o,onPause:i,onFocus:l}){const{expanded:u,setExpanded:p}=c.useContext(as),m=Ao(e,t,a,s),g=m.find(v=>v.run.isCurrent)??m[0]??null,f=g?m.filter(v=>v.run.id!==g.run.id):[];return g?r.jsxs("div",{className:b("flex min-h-[2.125rem] min-w-0 items-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] transition-colors",u&&"border-[var(--primary)]/25 bg-[var(--primary)]/[0.06]"),children:[r.jsxs("button",{type:"button","aria-expanded":u,"aria-label":u?"Collapse work details":"Expand work details",className:"flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-l-full py-1 pl-2.5 pr-2 transition-colors hover:bg-[var(--ui-surface-hover)]",onClick:()=>p(v=>!v),children:[r.jsx(or,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),r.jsx("span",{className:"truncate text-[12px] font-medium text-[var(--ui-ink-strong)]",children:g.title}),r.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-[var(--ui-ink-faint)]",children:At(g.creditedSeconds)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 pr-1",children:[f.length>0?r.jsx("button",{type:"button",title:"Switch to next task",disabled:n,className:"inline-flex size-6 items-center justify-center rounded-full bg-[var(--primary)]/15 text-[10px] font-bold tabular-nums text-[var(--primary)] transition hover:bg-[var(--primary)]/25 disabled:pointer-events-none disabled:opacity-70",onClick:()=>void l(f[0].run.id),children:m.length}):null,r.jsx("button",{type:"button",title:"Stop",disabled:n,className:"inline-flex size-6 items-center justify-center rounded-full text-[var(--ui-ink-faint)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)] disabled:pointer-events-none disabled:opacity-70",onClick:()=>void i(g.run.id),children:r.jsx(Al,{className:"size-2.5 fill-current"})}),r.jsx("button",{type:"button",title:"Start new work",disabled:n,className:"inline-flex size-6 items-center justify-center rounded-full text-[var(--ui-ink-faint)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)] disabled:pointer-events-none disabled:opacity-70",onClick:()=>o(),children:r.jsx(Mi,{className:"size-2.5 fill-current"})})]})]}):r.jsxs("div",{className:"flex min-h-[2.125rem] min-w-0 items-center gap-1.5 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] py-1 pl-2.5 pr-1",children:[r.jsx(or,{className:"size-3.5 shrink-0 text-[var(--ui-ink-faint)]"}),r.jsx("span",{className:"truncate text-[12px] text-[var(--ui-ink-faint)]",children:"No active work"}),r.jsx("button",{type:"button",className:"ml-auto inline-flex h-[1.5rem] shrink-0 items-center rounded-full bg-[var(--ui-surface-active)] px-2 text-[11px] font-medium text-[var(--ui-ink-strong)] transition hover:bg-[var(--ui-surface-hover)]",onClick:o,children:"Start work"})]})}function fi({runs:e,tasks:t,generatedAt:a,timeAccountingMode:s,pending:n,onOpenStartWork:o,onFocus:i,onPause:l,onComplete:u}){var y,_,h,w;const{expanded:p}=c.useContext(as),m=Ao(e,t,a,s),g=m.find(P=>P.run.isCurrent)??m[0]??null,f=g?m.filter(P=>P.run.id!==g.run.id):[],v=s==="split"&&m.length>1?`Split across ${m.length} active tasks`:s==="parallel"&&m.length>1?`Parallel time across ${m.length} active tasks`:s==="primary_only"&&m.length>1?"Only the current task is earning credited time":null;return g?r.jsx(Fa,{initial:!1,children:p?r.jsx(ht.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.25,ease:"easeOut"},className:"overflow-hidden",children:r.jsxs("div",{className:"mt-2 rounded-2xl border border-[var(--ui-border-subtle)] bg-[var(--ui-accent-soft)] p-4",children:[r.jsxs("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(le,{tone:"signal",children:"Current task"}),r.jsx(le,{tone:"meta",children:g.run.timerMode==="planned"?"Planned timer":"Unlimited timer"}),v?r.jsx(le,{tone:"meta",children:v}):null]}),r.jsx("div",{className:"mt-3 text-xl font-medium text-[var(--ui-ink-strong)] md:text-2xl",children:g.title}),r.jsxs("div",{className:"mt-2 flex flex-wrap gap-4 text-sm text-[var(--ui-ink-soft)]",children:[r.jsxs("span",{children:[At(g.creditedSeconds)," credited"]}),r.jsxs("span",{children:[At(g.wallSeconds)," wall time"]}),g.run.timerMode==="planned"?g.overtimeSeconds>0?r.jsxs("span",{className:"text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]",children:["+",At(g.overtimeSeconds)," overtime"]}):r.jsxs("span",{children:[At(g.remainingSeconds??0)," ","remaining"]}):r.jsx("span",{children:"Unlimited session"})]}),(y=g.run.gitContext)!=null&&y.branch||(_=g.run.gitContext)!=null&&_.pullRequestNumber?r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[(h=g.run.gitContext)!=null&&h.branch?r.jsxs(le,{tone:"meta",children:[r.jsx(Kt,{className:"mr-1 size-3"}),g.run.gitContext.branch]}):null,(w=g.run.gitContext)!=null&&w.pullRequestNumber?r.jsxs(le,{tone:"meta",children:[r.jsx(Di,{className:"mr-1 size-3"}),"PR #",g.run.gitContext.pullRequestNumber]}):null]}):null]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ue,{variant:"secondary",pending:n,pendingLabel:"Opening",onClick:o,children:[r.jsx(or,{className:"size-4"}),"Start work"]}),r.jsxs(ue,{variant:"secondary",pending:n,pendingLabel:"Pausing",onClick:()=>void l(g.run.id),children:[r.jsx(Ll,{className:"size-4"}),"Pause"]}),r.jsxs(ue,{pending:n,pendingLabel:"Completing",onClick:()=>void u(g.run.id),children:[r.jsx(Ol,{className:"size-4"}),"Complete"]})]})]}),f.length>0?r.jsx("div",{className:"mt-4 grid gap-2 lg:grid-cols-2",children:f.map(P=>r.jsxs("button",{type:"button",className:b("flex items-center justify-between gap-3 rounded-2xl bg-[var(--ui-surface-1)] px-4 py-3 text-left transition hover:bg-[var(--ui-surface-hover)]",n&&"pointer-events-none opacity-70"),onClick:()=>void i(P.run.id),children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:P.title}),r.jsxs("div",{className:"mt-1 flex flex-wrap gap-3 text-[12px] text-[var(--ui-ink-faint)]",children:[r.jsxs("span",{children:[At(P.creditedSeconds)," credited"]}),r.jsx("span",{children:P.run.timerMode==="planned"?"planned":"unlimited"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-[var(--ui-ink-faint)]",children:[r.jsx(qr,{className:"size-3.5"}),"Switch"]})]},P.run.id))}):null]})},"timer-rail-detail"):null}):null}function Lo(e,t){if(e.length!==t.length)return!1;const a=[...e].sort().join("|"),s=[...t].sort().join("|");return a===s}function Qm(e){const t=e.split(/\s+/).map(a=>a.trim()).filter(Boolean);return t.length===0?"??":t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]??""}${t[1][0]??""}`.toUpperCase()}function Oo(e){const t=e.filter(s=>s.kind==="human"),a=e.filter(s=>s.kind==="bot");return[{id:"all",label:"All",shortLabel:"All",description:"Show every human and bot together.",userIds:[],token:"ALL",icon:qi},{id:"humans",label:"Humans",shortLabel:"Humans",description:"Focus only on human-owned work.",userIds:t.map(s=>s.id),token:"HU",icon:pa},{id:"bots",label:"Bots",shortLabel:"Bots",description:"Focus only on bot-owned work.",userIds:a.map(s=>s.id),token:"AI",icon:Rr},...e.map(s=>({id:s.id,label:s.displayName,shortLabel:s.displayName,description:`${s.kind==="human"?"Human":"Bot"} · ${s.handle}`,userIds:[s.id],token:Qm(s.displayName),icon:s.kind==="human"?pa:Rr}))]}function Ym(e,t){return Oo(e).find(a=>Lo(t,a.userIds))??{id:"custom",label:t.length>1?`${t.length} selected`:"Custom",shortLabel:t.length>1?`${t.length} selected`:"Custom",description:"Using a custom combination of users.",userIds:t,token:t.length>1?String(t.length):"C",icon:qi}}function yi({users:e,selectedUserIds:t,onChange:a,compact:s=!1}){const[n,o]=c.useState(!1),i=c.useMemo(()=>Oo(e),[e]),l=c.useMemo(()=>Ym(e,t),[t,e]),u=l.icon;return r.jsxs(ft,{open:n,onOpenChange:o,children:[r.jsx(ic,{asChild:!0,children:r.jsxs("button",{type:"button",className:b("shell-scope-trigger inline-flex items-center gap-2",s?"px-2.5 text-[12px]":"px-3.5 text-[13px]"),children:[r.jsx("span",{className:"shell-scope-avatar",children:l.id==="all"?r.jsx(u,{className:"size-3.5"}):l.token}),r.jsx("span",{className:b("truncate text-left",s?"max-w-[7.5rem]":"max-w-[11rem]"),children:l.shortLabel})]})}),r.jsxs(yt,{children:[r.jsx(xt,{className:wo}),r.jsxs(vt,{className:b(ko,"top-[12vh] w-[min(40rem,calc(100vw-1.5rem))]"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx(bt,{className:jo,children:"Choose user scope"}),r.jsx(wt,{className:So,children:"Change which humans and bots shape the current Forge view."})]}),r.jsx(Dt,{asChild:!0,children:r.jsx(fr,{"aria-label":"Close user scope dialog"})})]}),r.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:i.map(p=>{const m=Lo(t,p.userIds),g=p.icon;return r.jsxs("button",{type:"button",className:b("flex items-center justify-between gap-3 rounded-[24px] border px-4 py-4 text-left transition",m?"border-[color-mix(in_srgb,var(--primary)_26%,transparent)] bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onClick:()=>{a(p.userIds),o(!1)},children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[r.jsx("span",{className:"shell-scope-avatar",children:r.jsx(g,{className:"size-3.5"})}),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block truncate text-[14px] font-semibold",children:p.label}),r.jsx("span",{className:"mt-1 block text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:p.description})]})]}),m?r.jsx(Oi,{className:"size-4 shrink-0 text-[var(--primary)]"}):null]},p.id)})})]})]})]})}async function se(e){try{return{data:await e()}}catch(t){return{error:t}}}const It=Vl({reducerPath:"forgeApi",baseQuery:Jl(),tagTypes:["OperatorSession","Settings","Snapshot","Gamification","Doctor","Sleep","Psyche","WikiIngestJobs","WorkbenchFlow","WorkbenchFlows"],endpoints:e=>({getOperatorSession:e.query({queryFn:()=>se(Vc),providesTags:["OperatorSession"]}),getSettings:e.query({queryFn:()=>se(ro),providesTags:["Settings"]}),getForgeDoctor:e.query({queryFn:()=>se(nd),providesTags:["Doctor"]}),applyForgeDoctorFixes:e.mutation({queryFn:t=>se(()=>id(t)),invalidatesTags:["Doctor","Settings"]}),listWorkbenchFlows:e.query({queryFn:()=>se(()=>od()),providesTags:["WorkbenchFlows"]}),getWorkbenchFlow:e.query({queryFn:t=>se(()=>ld(t)),providesTags:(t,a,s)=>[{type:"WorkbenchFlow",id:s},"WorkbenchFlows"]}),getWorkbenchFlowRun:e.query({queryFn:({flowId:t,runId:a})=>se(()=>pd(t,a)),providesTags:(t,a,{flowId:s})=>[{type:"WorkbenchFlow",id:s}]}),getWorkbenchFlowRunNodes:e.query({queryFn:({flowId:t,runId:a})=>se(()=>hd(t,a)),providesTags:(t,a,{flowId:s})=>[{type:"WorkbenchFlow",id:s}]}),getWorkbenchFlowRunNode:e.query({queryFn:({flowId:t,runId:a,nodeId:s})=>se(()=>gd(t,a,s)),providesTags:(t,a,{flowId:s})=>[{type:"WorkbenchFlow",id:s}]}),getWorkbenchFlowNodeOutput:e.query({queryFn:({flowId:t,nodeId:a})=>se(()=>fd(t,a)),providesTags:(t,a,{flowId:s})=>[{type:"WorkbenchFlow",id:s}]}),getSnapshot:e.query({queryFn:t=>se(()=>Xc(t)),providesTags:["Snapshot"]}),getXpMetrics:e.query({queryFn:t=>se(()=>vd(t)),providesTags:["Gamification"]}),markGamificationCelebrationSeen:e.mutation({queryFn:t=>se(()=>bd(t)),invalidatesTags:["Gamification"]}),revokeOperatorSession:e.mutation({queryFn:()=>se(Jc),invalidatesTags:["OperatorSession","Settings","Snapshot","Gamification"]}),listWikiIngestJobs:e.query({queryFn:()=>se(()=>sd()),providesTags:["WikiIngestJobs"]}),createTask:e.mutation({queryFn:t=>se(()=>Td(t)),invalidatesTags:["Snapshot"]}),createGoal:e.mutation({queryFn:t=>se(()=>io(t)),invalidatesTags:["Snapshot"]}),createProject:e.mutation({queryFn:t=>se(()=>oo(t)),invalidatesTags:["Snapshot"]}),patchGoal:e.mutation({queryFn:({goalId:t,patch:a})=>se(()=>Pd(t,a)),invalidatesTags:["Snapshot"]}),patchProject:e.mutation({queryFn:({projectId:t,patch:a})=>se(()=>Nd(t,a)),invalidatesTags:["Snapshot"]}),patchTask:e.mutation({queryFn:({taskId:t,patch:a})=>se(()=>Un(t,a)),invalidatesTags:["Snapshot"]}),patchTaskStatus:e.mutation({queryFn:({taskId:t,status:a,completedAt:s,enforceTodayWorkLog:n,completedTodayWorkSeconds:o})=>se(()=>Un(t,{status:a,completedAt:s,enforceTodayWorkLog:n,completedTodayWorkSeconds:o})),invalidatesTags:["Snapshot"]}),claimTaskRun:e.mutation({queryFn:({taskId:t,input:a})=>se(()=>Rd(t,a)),invalidatesTags:["Snapshot"]}),heartbeatTaskRun:e.mutation({queryFn:({runId:t,input:a})=>se(()=>Ad(t,a)),invalidatesTags:["Snapshot"]}),focusTaskRun:e.mutation({queryFn:t=>se(()=>Ld(t)),invalidatesTags:["Snapshot"]}),releaseTaskRun:e.mutation({queryFn:({runId:t,input:a})=>se(()=>Dd(t,a)),invalidatesTags:["Snapshot"]}),completeTaskRun:e.mutation({queryFn:({runId:t,input:a})=>se(()=>Od(t,a)),invalidatesTags:["Snapshot"]}),getSleepView:e.query({queryFn:t=>se(()=>yd(t)),providesTags:["Sleep"]}),getPsycheValues:e.query({queryFn:t=>se(()=>Qc(t)),providesTags:["Psyche"]}),getBehaviorPatterns:e.query({queryFn:t=>se(()=>Yc(t)),providesTags:["Psyche"]}),getBehaviors:e.query({queryFn:t=>se(()=>Zc(t)),providesTags:["Psyche"]}),getBeliefs:e.query({queryFn:t=>se(()=>ed(t)),providesTags:["Psyche"]}),getTriggerReports:e.query({queryFn:t=>se(()=>td(t)),providesTags:["Psyche"]}),patchSleepSession:e.mutation({queryFn:({sleepId:t,patch:a})=>se(()=>xd(t,a)),invalidatesTags:["Sleep"]}),updateWorkbenchFlow:e.mutation({queryFn:({flowId:t,patch:a})=>se(()=>cd(t,a)),invalidatesTags:(t,a,{flowId:s})=>[{type:"WorkbenchFlow",id:s},"WorkbenchFlows"]}),deleteWorkbenchFlow:e.mutation({queryFn:t=>se(()=>dd(t)),invalidatesTags:(t,a,s)=>[{type:"WorkbenchFlow",id:s},"WorkbenchFlows"]}),runWorkbenchFlow:e.mutation({queryFn:({flowId:t,input:a})=>se(()=>ud(t,a)),invalidatesTags:(t,a,{flowId:s})=>[{type:"WorkbenchFlow",id:s}]}),chatWorkbenchFlow:e.mutation({queryFn:({flowId:t,input:a})=>se(()=>md(t,a)),invalidatesTags:(t,a,{flowId:s})=>[{type:"WorkbenchFlow",id:s}]})})}),{useClaimTaskRunMutation:Zm,useCompleteTaskRunMutation:ep,useCreateGoalMutation:tp,useCreateProjectMutation:rp,useCreateTaskMutation:ap,useFocusTaskRunMutation:sp,useGetForgeDoctorQuery:Sk,useGetOperatorSessionQuery:np,useGetXpMetricsQuery:ip,useGetSettingsQuery:op,useGetSnapshotQuery:lp,useGetWorkbenchFlowQuery:Nk,useGetWorkbenchFlowRunNodeQuery:Pk,useGetWorkbenchFlowRunNodesQuery:Tk,useListWikiIngestJobsQuery:cp,useHeartbeatTaskRunMutation:dp,useChatWorkbenchFlowMutation:Ik,useDeleteWorkbenchFlowMutation:Ck,usePatchGoalMutation:up,usePatchProjectMutation:mp,usePatchTaskMutation:pp,usePatchTaskStatusMutation:hp,useReleaseTaskRunMutation:gp,useMarkGamificationCelebrationSeenMutation:fp,useApplyForgeDoctorFixesMutation:Rk,useRevokeOperatorSessionMutation:_k,useRunWorkbenchFlowMutation:Ek,useUpdateWorkbenchFlowMutation:Ak}=It,Do="forge.selected-user-ids";function yp(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Do);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean):[]}catch{return[]}}function xp(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Do,JSON.stringify(Array.from(new Set(e))))}catch{return}}const vp={collapseProgress:0,selectedUserIds:yp(),displayedRouteKey:"",pendingRouteKey:null,pendingRouteStatus:"idle",routeReadyToCommit:!1,knowledgeGraphOverlayFocus:null},$o=Ki({name:"shell",initialState:vp,reducers:{hydrateSelectedUserIds(e,t){e.selectedUserIds=t.payload},setSelectedUserIds(e,t){e.selectedUserIds=t.payload},setCollapseProgress(e,t){e.collapseProgress=t.payload},syncDisplayedRouteKey(e,t){e.displayedRouteKey=t.payload,e.pendingRouteKey=null,e.pendingRouteStatus="idle",e.routeReadyToCommit=!1},beginRouteHandoff(e,t){if(e.displayedRouteKey===t.payload){e.pendingRouteKey=null,e.pendingRouteStatus="idle",e.routeReadyToCommit=!1;return}e.pendingRouteKey=t.payload,e.pendingRouteStatus="loading",e.routeReadyToCommit=!1},setPendingRouteStatus(e,t){e.pendingRouteStatus=t.payload},setRouteReadyToCommit(e,t){e.routeReadyToCommit=t.payload},commitPendingRoute(e){e.pendingRouteKey&&(e.displayedRouteKey=e.pendingRouteKey,e.pendingRouteKey=null,e.pendingRouteStatus="idle",e.routeReadyToCommit=!1)},cancelPendingRoute(e){e.pendingRouteKey=null,e.pendingRouteStatus="idle",e.routeReadyToCommit=!1},setKnowledgeGraphOverlayFocus(e,t){e.knowledgeGraphOverlayFocus=t.payload},clearKnowledgeGraphOverlayFocus(e){e.knowledgeGraphOverlayFocus=null}}}),{beginRouteHandoff:bp,cancelPendingRoute:Lk,clearKnowledgeGraphOverlayFocus:xi,commitPendingRoute:wp,hydrateSelectedUserIds:kp,setKnowledgeGraphOverlayFocus:Ok,setCollapseProgress:jp,setPendingRouteStatus:Dk,setRouteReadyToCommit:$k,setSelectedUserIds:Ca,syncDisplayedRouteKey:Sp}=$o.actions,Np=$o.reducer,Mo=Xl();Mo.startListening({matcher:Ql(kp,Ca),effect:async e=>{Array.isArray(e.payload)&&xp(e.payload.filter(t=>typeof t=="string"))}});const Pp="knowledge_graph",Tp=220,Ip=24,vi=.45,Cp=.8;function st(e,t=4){const a=10**t;return Math.round(e*a)/a}function ca(e){return Math.hypot(e.x,e.y)}function Mk(){return!1}function Fk(e){let t=0,a=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(const i of e)t+=1,a=Math.min(a,i.x),s=Math.max(s,i.x),n=Math.min(n,i.y),o=Math.max(o,i.y);return t===0?{x:0,y:0}:{x:st((a+s)/2),y:st((n+o)/2)}}function Rp(e){let t=0,a=0,s=0;for(const n of e)t+=1,a+=n.x,s+=n.y;return t===0?{x:0,y:0}:{x:st(a/t),y:st(s/t)}}function zk(e){const t=Rp(e);return{changed:Math.abs(t.x)>=1e-4||Math.abs(t.y)>=1e-4,offset:t,positions:e.map(s=>({x:st(s.x-t.x),y:st(s.y-t.y)}))}}function Wk({centroid:e,boundsCenter:t,camera:a}){return{centroidDistanceFromOrigin:st(ca(e)),boundsCenterDistanceFromOrigin:st(ca(t)),cameraDistanceFromOrigin:st(ca({x:a.x,y:a.y})),cameraToCentroidDistance:st(Math.hypot(a.x-e.x,a.y-e.y))}}function qk(e){return e.centroidDistanceFromOrigin<=vi&&e.cameraDistanceFromOrigin<=vi&&e.cameraToCentroidDistance<=Cp}function Bk(e="/knowledge-graph"){const t=Qi({scope:Pp,route:e,source:"ui"});return async({level:a,eventKey:s,message:n,functionName:o,details:i,entityType:l,entityId:u})=>t({level:a,eventKey:s,message:n,functionName:o??null,details:i,entityType:l??null,entityId:u??null})}const _p={panelOpen:!1,latestStatus:null,recentEvents:[],recentSnapshots:[]};function bi(e,t,a){const s=[t,...e];return s.length<=a?s:s.slice(0,a)}const Fo=Ki({name:"knowledgeGraphDiagnostics",initialState:_p,reducers:{setKnowledgeGraphDiagnosticsPanelOpen(e,t){e.panelOpen=t.payload},setKnowledgeGraphDiagnosticsStatus(e,t){e.latestStatus=t.payload},recordKnowledgeGraphDiagnosticsEvent(e,t){e.recentEvents=bi(e.recentEvents,t.payload,Tp)},recordKnowledgeGraphDiagnosticsSnapshot(e,t){e.recentSnapshots=bi(e.recentSnapshots,t.payload,Ip)},resetKnowledgeGraphDiagnostics(e){e.latestStatus=null,e.recentEvents=[],e.recentSnapshots=[],e.panelOpen=!1}}}),{recordKnowledgeGraphDiagnosticsEvent:Kk,recordKnowledgeGraphDiagnosticsSnapshot:Hk,resetKnowledgeGraphDiagnostics:Uk,setKnowledgeGraphDiagnosticsPanelOpen:Gk,setKnowledgeGraphDiagnosticsStatus:Vk}=Fo.actions,Ep=Fo.reducer,Ap=Dl({shell:Np,knowledgeGraphDiagnostics:Ep,[It.reducerPath]:It.reducer});function Lp(){const e=Yl({reducer:Ap,middleware:t=>t({serializableCheck:!1}).concat(Mo.middleware,It.middleware)});return Zl(e.dispatch),e}const ss=Lp();function Op(){const e=mr();c.useEffect(()=>{const t=new EventSource(Wa("/api/v1/events/stream")),a=()=>{ss.dispatch(It.util.invalidateTags(["OperatorSession","Settings","Snapshot","Gamification","Sleep","Psyche","WikiIngestJobs"])),Promise.all([e.invalidateQueries({queryKey:["forge-snapshot"]}),e.invalidateQueries({queryKey:["task-context"]})])};return t.addEventListener("snapshot",a),t.addEventListener("activity",a),t.onerror=()=>{t.close()},()=>{t.removeEventListener("snapshot",a),t.removeEventListener("activity",a),t.close()}},[e])}const Dp=[{id:"sleep",matches:e=>e==="/sleep"||e.startsWith("/sleep/"),isReady:e=>e.bootstrapReady&&e.sleepReady}];function $p(e){return Dp.find(t=>t.matches(e))??null}function Mp(e,t){if(!t.bootstrapReady)return!1;const a=$p(e);return a?a.isReady(t):!0}const ns=e=>e.shell,Fp=Kr(ns,e=>e.selectedUserIds),zp=Kr(ns,e=>e.collapseProgress);Kr(ns,e=>({displayedRouteKey:e.displayedRouteKey,pendingRouteKey:e.pendingRouteKey,pendingRouteStatus:e.pendingRouteStatus,routeReadyToCommit:e.routeReadyToCommit}));const zo=Kr(e=>e[It.reducerPath],e=>{const t=Object.values(e.queries).filter(s=>(s==null?void 0:s.status)==="pending").length,a=Object.values(e.mutations).filter(s=>(s==null?void 0:s.status)==="pending").length;return t+a});function Wp({backgroundActivityOpen:e,fetchingCount:t,mutatingCount:a,t:s}){var p;const n=cp(void 0,{pollingInterval:e?2e3:15e3,refetchOnFocus:!0,refetchOnReconnect:!0}),o=((p=n.data)==null?void 0:p.jobs)??[],i=o.some(m=>["queued","processing"].includes(m.job.status)),l=c.useMemo(()=>o.filter(m=>["queued","processing"].includes(m.job.status)),[o]);return{activityLabel:c.useMemo(()=>{if(l.length>0){if(l.length===1){const m=l[0];return(m==null?void 0:m.job.latestMessage)||(m==null?void 0:m.job.titleHint)||"1 ingest running"}return`${l.length} ingest jobs running`}return a>0?s(a===1?"common.shell.savingOne":"common.shell.savingOther",{count:a}):t>0?s(t===1?"common.shell.refreshingOne":"common.shell.refreshingOther",{count:t}):s("common.shell.settled")},[l,t,a,s]),hasActiveIngestJobs:i,ingestJobsQuery:n,recentIngestJobs:o}}function qp(e,t,a){return Math.min(Math.max(e,t),a)}function xe(e,t,a){return t+(a-t)*e}function Bp(e,t){e&&(e.style.setProperty("--forge-shell-collapse",t.toFixed(4)),e.style.setProperty("--forge-shell-desktop-header-padding-top",`${xe(t,18,4)}px`),e.style.setProperty("--forge-shell-desktop-header-padding-bottom",`${xe(t,15,4)}px`),e.style.setProperty("--forge-shell-desktop-title-size",`${xe(t,1.42,.96)}rem`),e.style.setProperty("--forge-shell-desktop-primary-translate-y",`${xe(t,0,2)}px`),e.style.setProperty("--forge-shell-desktop-primary-scale",`${xe(t,1,.98)}`),e.style.setProperty("--forge-shell-desktop-secondary-opacity",`${xe(t,1,0)}`),e.style.setProperty("--forge-shell-desktop-secondary-max-height",`${xe(t,176,0)}px`),e.style.setProperty("--forge-shell-desktop-secondary-spacing",`${xe(t,14,0)}px`),e.style.setProperty("--forge-shell-desktop-secondary-translate-y",`${xe(t,0,-18)}px`),e.style.setProperty("--forge-shell-mobile-header-padding-top",`${xe(t,14,4)}px`),e.style.setProperty("--forge-shell-mobile-header-padding-bottom",`${xe(t,12,4)}px`),e.style.setProperty("--forge-shell-mobile-title-size",`${xe(t,1.2,.9)}rem`),e.style.setProperty("--forge-shell-mobile-primary-translate-y",`${xe(t,0,1)}px`),e.style.setProperty("--forge-shell-mobile-primary-scale",`${xe(t,1,.98)}`),e.style.setProperty("--forge-shell-mobile-copy-opacity",`${xe(t,1,0)}`),e.style.setProperty("--forge-shell-mobile-copy-max-height",`${xe(t,320,0)}px`),e.style.setProperty("--forge-shell-mobile-copy-translate-y",`${xe(t,0,-14)}px`),e.style.setProperty("--forge-shell-hero-padding-top",`${xe(t,20,15)}px`),e.style.setProperty("--forge-shell-hero-padding-bottom",`${xe(t,20,14)}px`),e.style.setProperty("--forge-shell-hero-title-translate-y",`${xe(t,0,-6)}px`),e.style.setProperty("--forge-shell-hero-title-scale",`${xe(t,1,.94)}`),e.style.setProperty("--forge-shell-hero-description-opacity",`${xe(t,1,.45)}`),e.style.setProperty("--forge-shell-hero-description-translate-y",`${xe(t,0,-5)}px`))}function Kp(){var e,t,a;return typeof window>"u"?0:Math.max(window.scrollY||0,((e=document.scrollingElement)==null?void 0:e.scrollTop)||0,((t=document.documentElement)==null?void 0:t.scrollTop)||0,((a=document.body)==null?void 0:a.scrollTop)||0)}const is=()=>ec(),nr=tc;function Hp(e){const t=is(),a=nr(zp),s=c.useRef(a);c.useEffect(()=>{s.current=a},[a]),c.useEffect(()=>{const n=()=>{const o=window.innerWidth>=1024?124:96,i=document.scrollingElement??document.documentElement??document.body,u=Math.max(0,i.scrollHeight-window.innerHeight)<o?0:qp(Kp()/o,0,1);Math.abs(s.current-u)<.001||t(jp(u))};return n(),window.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{window.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[t]),c.useEffect(()=>{Bp(e.current,a)},[a,e])}function Up({routePathKey:e,routerLocation:t,outlet:a,routerLocationContext:s,optimisticLocation:n,optimisticRoutePathKey:o,destinationLoadingNode:i}){const l=is(),u=c.useRef(e),[p,m]=c.useState(e),g=o??e,f=n??t,v=o!==null||p!==e;c.useEffect(()=>{if(o!==null||p===e)return;const h=window.setTimeout(()=>{m(e)},120);return()=>{window.clearTimeout(h)}},[o,p,e]);const y={key:g,node:v?i:a,location:f};c.useEffect(()=>{u.current!==e&&(l(bp(e)),l(wp()),u.current=e),l(Sp(e))},[l,e]);const _=s?{...s,location:y.location}:null;return{displayedRoute:y,displayedLocationContext:_,pendingRoute:null,visibleLocation:f}}function Gp(e){const t=c.useRef(`forge_session_${Math.random().toString(36).slice(2,10)}`);c.useEffect(()=>{if(!e)return;let a=!1,s=!1,n=!1;const o=()=>{a=!0},i=(p,m)=>Cd({sessionId:t.current,eventType:p,metrics:m}).catch(()=>{});i("session_started",{visible:document.visibilityState==="visible",interacted:!1});const l=window.setTimeout(()=>{document.visibilityState==="visible"&&a&&!s&&(s=!0,i("dwell_120_seconds",{visible:!0,interacted:!0}))},12e4),u=()=>{const p=Math.max(1,document.documentElement.scrollHeight-window.innerHeight),m=Math.round(window.scrollY/p*100);m>=75&&a&&!n&&(n=!0,i("scroll_depth_75",{visible:document.visibilityState==="visible",interacted:!0,scrollDepth:m}))};return window.addEventListener("pointerdown",o),window.addEventListener("keydown",o),window.addEventListener("scroll",u,{passive:!0}),()=>{window.clearTimeout(l),window.removeEventListener("pointerdown",o),window.removeEventListener("keydown",o),window.removeEventListener("scroll",u)}},[e])}function Vp({snapshot:e,settings:t}){const[a]=dp();c.useEffect(()=>{if(!e||!t||e.activeTaskRuns.length===0)return;const s=()=>{for(const u of e.activeTaskRuns)a({runId:u.id,input:{actor:u.actor,leaseTtlSeconds:u.leaseTtlSeconds,note:u.note}}).unwrap().catch(()=>{})},n=window.setInterval(()=>{s()},3e4),o=()=>{s()},i=()=>{s()},l=()=>{s()};return document.addEventListener("visibilitychange",o),window.addEventListener("focus",i),window.addEventListener("pagehide",l),()=>{window.clearInterval(n),document.removeEventListener("visibilitychange",o),window.removeEventListener("focus",i),window.removeEventListener("pagehide",l)}},[a,t,e])}function Jp(e){c.useEffect(()=>{if(!e)return;const t=()=>{qu(e.themePreference,e.customTheme??null)};if(t(),e.themePreference!=="system"||typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>t();return typeof a.addEventListener=="function"?(a.addEventListener("change",s),()=>a.removeEventListener("change",s)):(a.addListener(s),()=>a.removeListener(s))},[e])}async function Xp(e,t=[]){ss.dispatch(It.util.invalidateTags(["Snapshot","Gamification"])),await Promise.all([e.invalidateQueries({queryKey:["forge-snapshot"]}),...t.map(a=>e.invalidateQueries({queryKey:a}))])}function Ue({className:e}){return r.jsx("div",{className:b("surface-pulse rounded-2xl bg-[var(--ui-surface-2)]",e)})}function Qp({header:e=!0,sideRail:t=!0,className:a,eyebrow:s,title:n,description:o,columns:i=2,blocks:l=4}){const u=Array.from({length:Math.max(2,l)});return r.jsxs("div",{className:b("grid gap-5",a),"aria-hidden":"true",children:[e?r.jsxs(ot,{className:"grid gap-4",children:[r.jsx(Ue,{className:b("h-3",s?"w-40":"w-32")}),r.jsx(Ue,{className:b("h-12",n?"max-w-2xl":"max-w-3xl")}),r.jsx(Ue,{className:b("h-5",o?"max-w-3xl":"max-w-2xl")})]}):null,r.jsxs("section",{className:b("grid gap-5",t?"xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]":""),children:[r.jsxs("div",{className:"grid gap-5",children:[r.jsxs(ot,{className:"grid gap-4",children:[r.jsx(Ue,{className:"h-3 w-28"}),r.jsx(Ue,{className:"h-28 w-full"})]}),r.jsxs(ot,{className:"grid gap-4",children:[r.jsx(Ue,{className:"h-3 w-40"}),r.jsx("div",{className:b("grid gap-3",i>1?"md:grid-cols-2":""),children:u.map((p,m)=>r.jsx(Ue,{className:"h-28 w-full"},m))})]})]}),t?r.jsxs("div",{className:"grid gap-5",children:[r.jsxs(ot,{className:"grid gap-4",children:[r.jsx(Ue,{className:"h-3 w-24"}),r.jsx(Ue,{className:"h-20 w-full"})]}),r.jsxs(ot,{className:"grid gap-4",children:[r.jsx(Ue,{className:"h-3 w-36"}),r.jsx(Ue,{className:"h-16 w-full"}),r.jsx(Ue,{className:"h-16 w-full"})]})]}):null]})]})}function Yp({children:e}){return r.jsx(r.Fragment,{children:e})}const Wo={overview:{surfaceId:"overview",title:"Overview",description:"Daily signal, momentum, and current Forge state.",tone:"core",skeleton:{blocks:5,columns:3,sideRail:!0}},"life-force-index":{surfaceId:"life-force-index",title:"Life Force",description:"Action Point capacity, weekday curves, and dynamic drains.",tone:"core",skeleton:{blocks:5,columns:2,sideRail:!0}},"goals-index":{surfaceId:"goals-index",title:"Goals",description:"Goal planning and long-horizon direction.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},"habits-index":{surfaceId:"habits-index",title:"Habits",description:"Recurring commitments, streaks, and check-ins.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"goal-detail":{surfaceId:"goal-detail",title:"Goal detail",description:"Goal detail, progress, and linked execution context.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"projects-index":{surfaceId:"projects-index",title:"Projects",description:"PRD-backed projects and execution initiatives.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},"project-hierarchy":{surfaceId:"project-hierarchy",title:"Project hierarchy",description:"Full hierarchy from goals down to subtasks.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},"project-detail":{surfaceId:"project-detail",title:"Project detail",description:"Project detail, tasks, and execution health.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"strategies-index":{surfaceId:"strategies-index",title:"Strategies",description:"Strategy graphs and long-range execution plans.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"strategy-detail":{surfaceId:"strategy-detail",title:"Strategy detail",description:"Strategy DAG detail, targets, and progress.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"preferences-index":{surfaceId:"preferences-index",title:"Preferences",description:"Preference profiles, pairwise judgments, and model state.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"calendar-index":{surfaceId:"calendar-index",title:"Calendar",description:"Calendar planning, timeboxes, and provider sync.",tone:"core",skeleton:{blocks:6,columns:3,sideRail:!1}},"knowledge-graph-index":{surfaceId:"knowledge-graph-index",title:"Knowledge Graph",description:"One connected map of Forge entities and relationships.",tone:"knowledge",skeleton:{blocks:4,columns:2,sideRail:!0}},"movement-index":{surfaceId:"movement-index",title:"Movement",description:"Movement traces, places, and trip evidence.",tone:"health",skeleton:{blocks:5,columns:2,sideRail:!0}},"sleep-index":{surfaceId:"sleep-index",title:"Sleep",description:"Sleep sessions, health context, and recovery trends.",tone:"health",skeleton:{blocks:5,columns:2,sideRail:!0}},"sports-index":{surfaceId:"sports-index",title:"Sports",description:"Fitness, workouts, and sports context.",tone:"health",skeleton:{blocks:6,columns:3,sideRail:!0}},"sports-workout-detail":{surfaceId:"sports-workout-detail",title:"Workout detail",description:"Raw workout evidence, heart-rate zones, and session context.",tone:"health",skeleton:{blocks:6,columns:2,sideRail:!0}},"training-load-index":{surfaceId:"training-load-index",title:"Training Load",description:"Cardiovascular load, intensity distribution, and targets.",tone:"health",skeleton:{blocks:6,columns:3,sideRail:!0}},"vitals-index":{surfaceId:"vitals-index",title:"Vitals",description:"Body signals, recovery, cardio fitness, and daily metrics.",tone:"health",skeleton:{blocks:6,columns:3,sideRail:!0}},"weight-loss-index":{surfaceId:"weight-loss-index",title:"Weight Loss",description:"Nutrition, calorie balance, body composition, gut comfort, subjective energy, aesthetic signals, and food experiments.",tone:"health",skeleton:{blocks:7,columns:3,sideRail:!0}},"psyche-index":{surfaceId:"psyche-index",title:"Psyche",description:"Values, modes, reports, and reflective context.",tone:"psyche",skeleton:{blocks:6,columns:2,sideRail:!0}},"psyche-metrics":{surfaceId:"psyche-metrics",title:"Psyche metrics",description:"Daily Psyche metric history with plots and statistics.",tone:"psyche",skeleton:{blocks:5,columns:3,sideRail:!0}},"psyche-flashcards":{surfaceId:"psyche-flashcards",title:"Psyche flashcards",description:"Therapeutic reminder cards for urges and triggers.",tone:"psyche",skeleton:{blocks:6,columns:3,sideRail:!1}},"psyche-values":{surfaceId:"psyche-values",title:"Psyche values",description:"Values and linked goal context.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-patterns":{surfaceId:"psyche-patterns",title:"Psyche patterns",description:"Behavior patterns and recurring loops.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-questionnaires":{surfaceId:"psyche-questionnaires",title:"Questionnaires",description:"Questionnaire library and recent runs.",tone:"psyche",skeleton:{blocks:6,columns:2,sideRail:!0}},"psyche-questionnaire-new":{surfaceId:"psyche-questionnaire-new",title:"New questionnaire",description:"Questionnaire builder workspace.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!1}},"psyche-questionnaire-detail":{surfaceId:"psyche-questionnaire-detail",title:"Questionnaire detail",description:"Questionnaire detail and scores.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-questionnaire-edit":{surfaceId:"psyche-questionnaire-edit",title:"Edit questionnaire",description:"Questionnaire builder workspace.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!1}},"psyche-questionnaire-run":{surfaceId:"psyche-questionnaire-run",title:"Take questionnaire",description:"Questionnaire runner and answers.",tone:"psyche",skeleton:{blocks:4,columns:1,sideRail:!1}},"psyche-questionnaire-run-detail":{surfaceId:"psyche-questionnaire-run-detail",title:"Questionnaire run detail",description:"Questionnaire result review.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-self-observation":{surfaceId:"psyche-self-observation",title:"Self observation",description:"Self-observation notes and reflective tracking.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-screen-time":{surfaceId:"psyche-screen-time",title:"Screen Time",description:"Device-activity patterns and reflective usage history.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-behaviors":{surfaceId:"psyche-behaviors",title:"Behaviors",description:"Behavior records and linked evidence.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-reports":{surfaceId:"psyche-reports",title:"Reports",description:"Trigger and reflective report review.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-report-detail":{surfaceId:"psyche-report-detail",title:"Report detail",description:"Detailed reflective report view.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-goal-map":{surfaceId:"psyche-goal-map",title:"Goal map",description:"Goal-to-values relationship map.",tone:"psyche",skeleton:{blocks:4,columns:2,sideRail:!0}},"psyche-schemas-beliefs":{surfaceId:"psyche-schemas-beliefs",title:"Schemas and beliefs",description:"Beliefs, schemas, and linked patterns.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-modes":{surfaceId:"psyche-modes",title:"Modes",description:"Mode profiles and guides.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-mode-guide":{surfaceId:"psyche-mode-guide",title:"Mode guide",description:"Guided mode session flow.",tone:"psyche",skeleton:{blocks:4,columns:1,sideRail:!1}},"kanban-index":{surfaceId:"kanban-index",title:"Kanban",description:"Task board execution surface.",tone:"execution",skeleton:{blocks:6,columns:3,sideRail:!1}},"notes-index":{surfaceId:"notes-index",title:"Notes",description:"Notes, evidence, and writing surfaces.",tone:"knowledge",skeleton:{blocks:6,columns:2,sideRail:!0}},"wiki-index":{surfaceId:"wiki-index",title:"KarpaWiki",description:"KarpaWiki search and page navigation.",tone:"knowledge",skeleton:{blocks:6,columns:2,sideRail:!0}},"wiki-ingest-history":{surfaceId:"wiki-ingest-history",title:"KarpaWiki ingest history",description:"Ingest jobs and processing history.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!0}},"wiki-page-detail":{surfaceId:"wiki-page-detail",title:"KarpaWiki page",description:"KarpaWiki page detail and backlinks.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!0}},"wiki-new":{surfaceId:"wiki-new",title:"New KarpaWiki page",description:"KarpaWiki editor for new pages.",tone:"knowledge",skeleton:{blocks:4,columns:1,sideRail:!1}},"wiki-edit":{surfaceId:"wiki-edit",title:"Edit KarpaWiki page",description:"KarpaWiki editor for existing pages.",tone:"knowledge",skeleton:{blocks:4,columns:1,sideRail:!1}},"today-index":{surfaceId:"today-index",title:"Today",description:"Current work, time, and daily runway.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},workbench:{surfaceId:"workbench",title:"Workbench",description:"Search, organize, and launch Forge flows.",tone:"knowledge",skeleton:{blocks:6,columns:2,sideRail:!0}},"workbench-flow":{surfaceId:"workbench-flow",title:"Workbench flow",description:"Graph editor and runtime surface for a single flow.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!1}},"activity-index":{surfaceId:"activity-index",title:"Activity",description:"Activity log and event history.",tone:"core",skeleton:{blocks:6,columns:2,sideRail:!0}},"insights-index":{surfaceId:"insights-index",title:"Insights",description:"Insight review and decisions.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!0}},"weekly-review":{surfaceId:"weekly-review",title:"Weekly review",description:"Weekly review workflow and closeout.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-index":{surfaceId:"settings-index",title:"Settings",description:"Operator settings and runtime configuration.",tone:"settings",skeleton:{blocks:6,columns:2,sideRail:!0}},"settings-data":{surfaceId:"settings-data",title:"Settings data",description:"Runtime storage, backups, exports, and recovery.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-users":{surfaceId:"settings-users",title:"Settings users",description:"User directory and ownership settings.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-calendar":{surfaceId:"settings-calendar",title:"Settings calendar",description:"Calendar provider settings and sync.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-mobile":{surfaceId:"settings-mobile",title:"Settings mobile",description:"Mobile companion settings and pairing.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-mobile-lab":{surfaceId:"settings-mobile-lab",title:"Companion sync lab",description:"Dev-only source-state and movement gap QA fixtures.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-models":{surfaceId:"settings-models",title:"Settings models",description:"Model connections and defaults.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-agents":{surfaceId:"settings-agents",title:"Settings agents",description:"Agent tokens and runtime access.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-rewards":{surfaceId:"settings-rewards",title:"Settings rewards",description:"Rewards and XP rule settings.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},rewards:{surfaceId:"rewards",title:"Trophy Hall",description:"Trophies, unlocks, streak pressure, and progression.",tone:"execution",skeleton:{blocks:6,columns:3,sideRail:!0}},"settings-wiki":{surfaceId:"settings-wiki",title:"KarpaWiki settings",description:"KarpaWiki ingestion and profile settings.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-logs":{surfaceId:"settings-logs",title:"Settings logs",description:"Diagnostics and event logs.",tone:"settings",skeleton:{blocks:6,columns:2,sideRail:!0}},"settings-bin":{surfaceId:"settings-bin",title:"Settings bin",description:"Deleted entity recovery.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"task-detail":{surfaceId:"task-detail",title:"Task detail",description:"Task detail, timer, and notes.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}}};function os(e){const t=e.startsWith("/forge/")?e.slice(6):e==="/forge"?"/":e,a=t.startsWith("/")?t:`/${t}`;return a.length>1&&a.endsWith("/")?a.slice(0,-1):a}function G(...e){const t=new Set(e.map(os));return a=>t.has(a)}function Zp(e){const t=os(e);return a=>a===t||a.startsWith(`${t}/`)}function Be(e){return t=>e.test(t)}const eh=[{viewId:"overview",match:G("/","/overview")},{viewId:"life-force-index",match:G("/life-force")},{viewId:"goals-index",match:G("/goals")},{viewId:"habits-index",match:G("/habits")},{viewId:"goal-detail",match:Be(/^\/goals\/[^/]+$/)},{viewId:"project-hierarchy",match:G("/projects/hierarchy")},{viewId:"projects-index",match:G("/projects")},{viewId:"project-detail",match:Be(/^\/projects\/[^/]+$/)},{viewId:"strategies-index",match:G("/strategies")},{viewId:"strategy-detail",match:Be(/^\/strategies\/[^/]+$/)},{viewId:"preferences-index",match:Zp("/preferences")},{viewId:"calendar-index",match:G("/calendar")},{viewId:"knowledge-graph-index",match:G("/knowledge-graph")},{viewId:"movement-index",match:G("/movement")},{viewId:"sleep-index",match:G("/sleep")},{viewId:"sports-workout-detail",match:Be(/^\/sports\/workouts\/[^/]+$/)},{viewId:"sports-index",match:G("/sports")},{viewId:"training-load-index",match:G("/training-load")},{viewId:"vitals-index",match:G("/vitals")},{viewId:"weight-loss-index",match:G("/weight-loss")},{viewId:"psyche-metrics",match:G("/psyche/metrics")},{viewId:"psyche-flashcards",match:G("/psyche/flashcards")},{viewId:"psyche-values",match:G("/psyche/values")},{viewId:"psyche-patterns",match:G("/psyche/patterns")},{viewId:"psyche-questionnaire-new",match:G("/psyche/questionnaires/new")},{viewId:"psyche-questionnaire-edit",match:Be(/^\/psyche\/questionnaires\/[^/]+\/edit$/)},{viewId:"psyche-questionnaire-run",match:Be(/^\/psyche\/questionnaires\/[^/]+\/take$/)},{viewId:"psyche-questionnaire-detail",match:Be(/^\/psyche\/questionnaires\/[^/]+$/)},{viewId:"psyche-questionnaires",match:G("/psyche/questionnaires")},{viewId:"psyche-questionnaire-run-detail",match:Be(/^\/psyche\/questionnaire-runs\/[^/]+$/)},{viewId:"psyche-self-observation",match:G("/psyche/self-observation")},{viewId:"psyche-screen-time",match:G("/psyche/screen-time")},{viewId:"psyche-behaviors",match:G("/psyche/behaviors")},{viewId:"psyche-report-detail",match:Be(/^\/psyche\/reports\/[^/]+$/)},{viewId:"psyche-reports",match:G("/psyche/reports")},{viewId:"psyche-goal-map",match:G("/psyche/goal-map")},{viewId:"psyche-schemas-beliefs",match:G("/psyche/schemas-beliefs")},{viewId:"psyche-mode-guide",match:G("/psyche/modes/guide")},{viewId:"psyche-modes",match:G("/psyche/modes")},{viewId:"psyche-index",match:G("/psyche")},{viewId:"kanban-index",match:G("/kanban")},{viewId:"notes-index",match:G("/notes")},{viewId:"wiki-ingest-history",match:G("/wiki/ingest-history")},{viewId:"wiki-page-detail",match:Be(/^\/wiki\/page\/[^/]+$/)},{viewId:"wiki-new",match:G("/wiki/new")},{viewId:"wiki-edit",match:Be(/^\/wiki\/edit\/[^/]+$/)},{viewId:"wiki-index",match:G("/wiki")},{viewId:"today-index",match:G("/today")},{viewId:"workbench-flow",match:Be(/^\/workbench\/[^/]+$/)},{viewId:"workbench",match:G("/workbench")},{viewId:"activity-index",match:G("/activity")},{viewId:"insights-index",match:G("/insights")},{viewId:"weekly-review",match:G("/review/weekly")},{viewId:"settings-data",match:G("/settings/data")},{viewId:"settings-users",match:G("/settings/users")},{viewId:"settings-calendar",match:G("/settings/calendar")},{viewId:"settings-mobile-lab",match:G("/settings/mobile/lab")},{viewId:"settings-mobile",match:G("/settings/mobile")},{viewId:"settings-models",match:G("/settings/models")},{viewId:"settings-agents",match:G("/settings/agents")},{viewId:"settings-rewards",match:G("/settings/rewards")},{viewId:"settings-wiki",match:G("/settings/wiki")},{viewId:"settings-logs",match:G("/settings/logs")},{viewId:"settings-bin",match:G("/settings/bin")},{viewId:"settings-index",match:G("/settings")},{viewId:"rewards",match:G("/rewards")},{viewId:"task-detail",match:Be(/^\/tasks\/[^/]+$/)}];function th(e){var a;const t=os(e);return((a=eh.find(s=>s.match(t)))==null?void 0:a.viewId)??"overview"}const rh={core:"route-view-loading--core",execution:"route-view-loading--execution",health:"route-view-loading--health",knowledge:"route-view-loading--knowledge",psyche:"route-view-loading--psyche",settings:"route-view-loading--settings"};function ah({index:e}){return r.jsxs("div",{className:"surface-pulse min-h-[7.5rem] rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",style:{animationDelay:`${e*90}ms`},children:[r.jsx("div",{className:"h-2.5 w-24 rounded-full bg-[var(--ui-surface-3)]"}),r.jsx("div",{className:"mt-4 h-9 w-full rounded-2xl bg-[var(--ui-surface-2)]"}),r.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[r.jsx("div",{className:"h-3 rounded-full bg-[var(--ui-surface-2)]"}),r.jsx("div",{className:"h-3 rounded-full bg-[var(--ui-surface-1)]"}),r.jsx("div",{className:"h-3 rounded-full bg-[var(--ui-surface-1)]"})]})]})}function qo({meta:e}){const t=e.skeleton??{},a=Math.max(2,t.blocks??4),s=Array.from({length:Math.min(a,6)});return r.jsxs(ht.section,{className:b("route-view-loading relative isolate grid min-h-[28rem] gap-5 overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] p-4 shadow-[var(--ui-shadow-soft)] sm:p-5",rh[e.tone]),role:"status","aria-busy":"true","aria-live":"polite",initial:{opacity:.72,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[r.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-px bg-[linear-gradient(90deg,transparent,var(--ui-border-strong),transparent)]"}),r.jsx("div",{className:"pointer-events-none absolute inset-x-6 top-0 h-24 bg-[linear-gradient(180deg,var(--ui-surface-2),transparent)] opacity-70"}),r.jsxs("header",{className:"relative flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Opening surface"}),r.jsx("h1",{className:"mt-2 font-display text-2xl font-semibold tracking-normal text-[var(--ui-ink-strong)] sm:text-3xl",children:e.title}),r.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:e.description})]}),r.jsxs("div",{className:"inline-flex w-fit items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-2 text-[12px] font-medium text-[var(--ui-ink-soft)]",children:[r.jsxs("span",{className:"relative flex size-2.5",children:[r.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-[var(--primary)]/30"}),r.jsx("span",{className:"relative inline-flex size-2.5 rounded-full bg-[var(--primary)]"})]}),"Loading"]})]}),r.jsx("div",{className:b("relative grid gap-3",(t.columns??2)>1?"md:grid-cols-2 xl:grid-cols-3":""),"aria-hidden":"true",children:s.map((n,o)=>r.jsx(ah,{index:o},o))}),r.jsx(Qp,{header:t.header??!1,sideRail:t.sideRail??!0,columns:t.columns??2,blocks:a,className:"relative opacity-80"})]},e.surfaceId)}function sh({viewId:e,children:t}){const a=Wo[e];return r.jsx(c.Suspense,{fallback:r.jsx(qo,{meta:a}),children:r.jsx(Yp,{surfaceId:a.surfaceId,children:t})})}const Bo=c.createContext(null);let Ko=null;function nh({onClick:e}){const{t}=De();return r.jsxs(ue,{variant:"secondary",size:"sm",className:"min-w-0 px-3.5",onClick:e,children:[r.jsx(gt,{className:"size-4"}),t("common.shell.command"),r.jsx(le,{size:"sm",tone:"meta",className:"ml-1 hidden bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] xl:inline-flex",children:"Shift Shift"}),r.jsx(le,{size:"sm",tone:"meta",className:"hidden bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] 2xl:inline-flex",children:"Cmd K"})]})}function ih({children:e,routeLocation:t,onRouteIntent:a,settings:s,timerPending:n,startWorkOpen:o,startWorkPending:i,startWorkError:l,startWorkDefaults:u,onOpenStartWork:p,onCloseStartWork:m,onStartExistingTask:g,onCreateAndStartTask:f,onFocusRun:v,onPauseRun:y,onCompleteRun:_}){const h=lh(),{t:w}=De(),P=Tt.find(ce=>Lr(t.pathname,ce))??Qr[0],x=Um(P.id),$=Pm(t.pathname),[S,F]=c.useState(!1),[N,E]=c.useState(!1),T=c.useRef(null),{navCollapsed:z,setNavCollapsed:ee,desktopNavIds:ne,setDesktopNavIds:ie,mobileNavIds:V,setMobileNavIds:k,desktopRoutes:M,mobileRoutes:oe,navEditorOpen:ae,setNavEditorOpen:C,desktopSidebarMetricsPosition:J,setDesktopSidebarMetricsPosition:O}=Am(t.pathname),Y=Ar(t.pathname),A=t.pathname.startsWith("/knowledge-graph"),Z=Hi(),pe=rc(),Oe=nr(zo),Ae=Z+pe+Oe,{activityLabel:Te,hasActiveIngestJobs:ye,ingestJobsQuery:be,recentIngestJobs:Ie}=Wp({backgroundActivityOpen:N,fetchingCount:Z+Oe,mutatingCount:pe,t:w}),we=Gm(h.snapshot,w),Ke=fm({goals:h.snapshot.dashboard.goals,projects:h.snapshot.dashboard.projects,tags:h.snapshot.tags,users:h.snapshot.users,defaultUserId:h.selectedUserIds.length===1?h.selectedUserIds[0]:null,onCreateGoal:h.createGoal,onCreateProject:h.createProject,onCreateTask:h.createTask}),ze=c.useMemo(()=>t.pathname.startsWith("/tasks/")?[{to:"/kanban",label:w("common.shell.rail.taskBackToKanban")},{to:"/today",label:w("common.shell.rail.taskOpenToday")}]:t.pathname.startsWith("/projects/")?[{to:"/projects",label:w("common.shell.rail.projectAll")},{to:"/goals",label:w("common.shell.rail.projectGoals")}]:t.pathname.startsWith("/goals/")?[{to:"/goals",label:w("common.shell.rail.goalAll")},{to:"/projects",label:w("common.shell.rail.goalProjects")}]:t.pathname.startsWith("/strategies")?[{to:"/strategies",label:w("common.routeLabels.strategies")},{to:"/projects",label:w("common.shell.rail.projectAll")}]:Ar(t.pathname)?[{to:"/psyche",label:w("common.shell.rail.psycheHub")},{to:"/psyche/reports",label:w("common.shell.rail.psycheReports")}]:[{to:"/overview",label:w("common.shell.rail.overview")},{to:"/today",label:w("common.shell.rail.today")}],[t.pathname,w]);c.useEffect(()=>{let ce=0;const tt=je=>{if((je.metaKey||je.ctrlKey)&&je.key.toLowerCase()==="k"){je.preventDefault(),F(Ge=>!Ge),ce=0;return}if(je.key==="Shift"&&!je.metaKey&&!je.ctrlKey&&!je.altKey&&!je.repeat){const Ge=window.performance.now();if(Ge-ce<=360){je.preventDefault(),F(!0),ce=0;return}ce=Ge;return}!je.metaKey&&!je.ctrlKey&&!je.altKey&&(ce=0)};return window.addEventListener("keydown",tt),()=>window.removeEventListener("keydown",tt)},[]),Hp(T);const ut=c.useMemo(()=>({"--forge-shell-collapse":"0","--forge-shell-desktop-header-padding-top":"18px","--forge-shell-desktop-header-padding-bottom":"15px","--forge-shell-desktop-title-size":"1.42rem","--forge-shell-desktop-primary-translate-y":"0px","--forge-shell-desktop-primary-scale":"1","--forge-shell-desktop-secondary-opacity":"1","--forge-shell-desktop-secondary-max-height":"176px","--forge-shell-desktop-secondary-spacing":"14px","--forge-shell-desktop-secondary-translate-y":"0px","--forge-shell-mobile-header-padding-top":"14px","--forge-shell-mobile-header-padding-bottom":"12px","--forge-shell-mobile-title-size":"1.2rem","--forge-shell-mobile-primary-translate-y":"0px","--forge-shell-mobile-primary-scale":"1","--forge-shell-mobile-copy-opacity":"1","--forge-shell-mobile-copy-max-height":"320px","--forge-shell-mobile-copy-translate-y":"0px","--forge-shell-hero-padding-top":"20px","--forge-shell-hero-padding-bottom":"20px","--forge-shell-hero-title-translate-y":"0px","--forge-shell-hero-title-scale":"1","--forge-shell-hero-description-opacity":"1","--forge-shell-hero-description-translate-y":"0px"}),[]);return r.jsxs("div",{ref:T,className:"min-h-screen",style:ut,children:[r.jsx(pu,{open:S,onOpenChange:F,snapshot:h.snapshot,selectedUserIds:h.selectedUserIds,createActions:Ke.actions}),Ke.dialogs,r.jsxs("div",{className:"hidden lg:grid lg:min-h-screen",style:{gridTemplateColumns:z?"5.75rem minmax(0,1fr)":"17.75rem minmax(0,1fr)"},children:[r.jsxs("aside",{className:b("flex min-h-screen flex-col border-r border-[var(--ui-border-subtle)] py-6 backdrop-blur-xl transition-[padding,width]",z?"px-3":"px-5"),style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--surface-panel) 94%, transparent), color-mix(in srgb, var(--surface-low) 92%, transparent))"},children:[r.jsxs("div",{className:b("flex items-start",z?"flex-col items-center gap-3":"justify-between gap-3"),children:[r.jsxs(Lt,{to:"/overview",className:b("block min-w-0",z&&"text-center"),children:[r.jsx("div",{className:b("font-display text-[var(--primary)]",z?"text-2xl":"text-3xl"),children:w("common.shell.appMark")}),z?null:r.jsxs("div",{className:"type-meta mt-2 text-[var(--ui-ink-faint)]",children:["Level ",h.snapshot.metrics.level]})]}),r.jsx(ue,{type:"button",variant:"secondary",size:"sm",className:"mt-0.5 px-2.5",onClick:()=>ee(ce=>!ce),"aria-label":w(z?"common.shell.expandSidebar":"common.shell.collapseSidebar"),title:w(z?"common.shell.expandSidebar":"common.shell.collapseSidebar"),children:z?r.jsx(Fl,{className:"size-4"}):r.jsx(zl,{className:"size-4"})})]}),r.jsxs(ue,{type:"button",variant:"secondary",size:"sm",className:b("mt-3",z?"px-2.5":"w-full justify-start px-3"),onClick:()=>C(!0),children:[r.jsx($a,{className:"size-4"}),z?null:"Customize nav"]}),J==="above"?r.jsx(pi,{metrics:we,collapsed:z}):null,r.jsx("div",{className:b("grid gap-2",z?"mt-6":"mt-8"),children:M.map(ce=>r.jsx(Lm,{route:ce,compact:z,onRouteIntent:a},ce.id))}),J==="below"?r.jsx(pi,{metrics:we,collapsed:z}):null]}),r.jsxs("div",{className:"min-h-screen",children:[r.jsx(hi,{children:r.jsxs("header",{className:"sticky top-0 z-30 border-b border-[var(--ui-border-subtle)] px-6 backdrop-blur-xl",style:{background:"color-mix(in srgb, var(--surface-glass) 92%, transparent)",paddingTop:"var(--forge-shell-desktop-header-padding-top)",paddingBottom:"var(--forge-shell-desktop-header-padding-bottom)",willChange:"padding, background-color"},children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",style:{transform:"translateY(var(--forge-shell-desktop-primary-translate-y)) scale(var(--forge-shell-desktop-primary-scale))",transformOrigin:"top center",willChange:"transform"},children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-5",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 font-display text-[var(--ui-ink-strong)]",style:{fontSize:"var(--forge-shell-desktop-title-size)",lineHeight:1,willChange:"font-size"},children:[r.jsx("span",{children:lt(P,w)}),r.jsx(zt,{className:"font-sans",label:`Explain ${lt(P,w)}`,title:x.title,content:r.jsxs("span",{className:"grid gap-2",children:[r.jsx("span",{children:x.purpose}),r.jsx("span",{children:x.primaryAction}),x.metricNote?r.jsx("span",{className:"text-[var(--ui-ink-soft)]",children:x.metricNote}):null]})})]}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx(gi,{runs:h.snapshot.activeTaskRuns,tasks:h.snapshot.tasks,generatedAt:h.snapshot.meta.generatedAt,timeAccountingMode:s.execution.timeAccountingMode,pending:n,onOpenStartWork:()=>p(),onPause:y,onFocus:v})})]}),r.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:[r.jsx(Md,{metrics:h.snapshot.metrics,className:"hidden xl:inline-flex"}),r.jsx(Kn,{active:Ae>0||ye,label:Te,onClick:()=>E(!0)}),r.jsx(nh,{onClick:()=>F(!0)}),r.jsxs(ue,{variant:"secondary",size:"sm",className:"min-w-0 px-3.5",onClick:()=>void h.refresh(),children:[r.jsx(Ma,{className:"size-4"}),w("common.actions.refresh")]})]})]}),r.jsx(fi,{runs:h.snapshot.activeTaskRuns,tasks:h.snapshot.tasks,generatedAt:h.snapshot.meta.generatedAt,timeAccountingMode:s.execution.timeAccountingMode,pending:n,onOpenStartWork:()=>p(),onFocus:v,onPause:y,onComplete:_}),r.jsxs("div",{className:"flex items-center justify-between gap-4 overflow-hidden border-t border-[var(--ui-border-subtle)]",style:{opacity:"var(--forge-shell-desktop-secondary-opacity)",maxHeight:"var(--forge-shell-desktop-secondary-max-height)",marginTop:"var(--forge-shell-desktop-secondary-spacing)",paddingTop:"var(--forge-shell-desktop-secondary-spacing)",transform:"translateY(var(--forge-shell-desktop-secondary-translate-y))",willChange:"opacity, max-height, transform"},children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsx("div",{className:"max-w-[34rem] text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:x.primaryAction}),ze.map(ce=>r.jsx(Lt,{to:ce.to,className:"interactive-tap inline-flex min-h-10 min-w-0 max-w-full items-center justify-center rounded-full bg-[var(--ui-surface-1)] px-4 py-2 text-center text-[13px] leading-tight text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)] sm:whitespace-nowrap",children:ce.label},ce.to)),r.jsx(yi,{users:h.snapshot.users,selectedUserIds:h.selectedUserIds,onChange:h.setSelectedUserIds,compact:!0})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(le,{tone:"meta",children:w(h.snapshot.metrics.streakDays===1?"common.shell.momentum.streakBadgeOne":"common.shell.momentum.streakBadgeOther",{count:h.snapshot.metrics.streakDays})}),r.jsx(le,{tone:"meta",children:w("common.shell.momentum.weeklyXp",{count:h.snapshot.metrics.weeklyXp})}),r.jsx(le,{tone:Y?"signal":"meta",children:Y?w("common.shell.momentum.psycheMode"):w("common.shell.momentum.liveMomentum",{count:h.snapshot.metrics.momentumScore})})]})]})]})}),r.jsx("div",{className:"px-6 pt-3",children:r.jsx(si,{open:o,onOpenChange:ce=>{ce||m()},presentation:"desktop_inline",tasks:h.snapshot.tasks,projects:h.snapshot.dashboard.projects,activeRunCount:h.snapshot.activeTaskRuns.length,maxActiveTasks:s.execution.maxActiveTasks,timeAccountingMode:s.execution.timeAccountingMode,pending:i,errorMessage:l,initialTaskId:u.taskId??null,defaultProjectId:u.projectId??null,onStartExisting:g,onCreateAndStart:f})}),r.jsx("main",{className:"px-6 pb-3",children:r.jsx("div",{className:"min-w-0",children:r.jsx(Xn,{routeKey:$,tone:Y?"psyche":"core",children:e})})})]})]}),r.jsxs("div",{className:"min-h-[100dvh] overflow-x-clip lg:hidden",children:[r.jsx(hi,{children:r.jsxs("header",{className:"sticky top-0 z-30 border-b border-[var(--ui-border-subtle)] px-4 backdrop-blur-xl",style:{background:"color-mix(in srgb, var(--surface-glass) 96%, transparent)",paddingTop:"var(--forge-shell-mobile-header-padding-top)",paddingBottom:"var(--forge-shell-mobile-header-padding-bottom)",willChange:"padding, background-color"},children:[r.jsxs("div",{className:"grid gap-2",style:{transform:"translateY(var(--forge-shell-mobile-primary-translate-y)) scale(var(--forge-shell-mobile-primary-scale))",transformOrigin:"top center",willChange:"transform"},children:[r.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[r.jsx("div",{className:"min-w-0 truncate font-display text-[var(--ui-ink-strong)]",style:{fontSize:"var(--forge-shell-mobile-title-size)",willChange:"font-size"},children:lt(P,w)}),r.jsx(zt,{className:"shrink-0",label:`Explain ${lt(P,w)}`,title:x.title,content:r.jsxs("span",{className:"grid gap-2",children:[r.jsx("span",{children:x.purpose}),r.jsx("span",{children:x.primaryAction}),x.metricNote?r.jsx("span",{className:"text-[var(--ui-ink-soft)]",children:x.metricNote}):null]})})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx(ue,{variant:"secondary",size:"sm",className:"min-h-[2.125rem] px-2.5",onClick:()=>F(!0),"aria-label":w("common.actionBar.title"),title:w("common.actionBar.title"),children:r.jsx(gt,{className:"size-4"})}),r.jsxs("div",{className:"inline-flex min-h-[2.125rem] max-w-[9.5rem] items-center gap-1.5 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 text-[12px] font-medium text-[var(--primary)]",title:`Level ${h.snapshot.metrics.level} · ${h.snapshot.metrics.totalXp} XP · ${h.snapshot.metrics.streakDays} day streak`,children:[r.jsx(ur,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"min-w-0 truncate",children:["L",h.snapshot.metrics.level," ·"," ",Nm(h.snapshot.metrics.totalXp)," XP · ",h.snapshot.metrics.streakDays,"d"]})]})]})]}),r.jsx("div",{className:"min-w-0",children:r.jsx(gi,{runs:h.snapshot.activeTaskRuns,tasks:h.snapshot.tasks,generatedAt:h.snapshot.meta.generatedAt,timeAccountingMode:s.execution.timeAccountingMode,pending:n,onOpenStartWork:()=>p(),onPause:y,onFocus:v})})]}),r.jsx(fi,{runs:h.snapshot.activeTaskRuns,tasks:h.snapshot.tasks,generatedAt:h.snapshot.meta.generatedAt,timeAccountingMode:s.execution.timeAccountingMode,pending:n,onOpenStartWork:()=>p(),onFocus:v,onPause:y,onComplete:_}),r.jsxs("div",{className:"overflow-hidden",style:{opacity:"var(--forge-shell-mobile-copy-opacity)",maxHeight:"var(--forge-shell-mobile-copy-max-height)",transform:"translateY(var(--forge-shell-mobile-copy-translate-y))",willChange:"opacity, max-height, transform"},children:[r.jsxs("div",{className:"mt-2 text-[13px] leading-5 text-[var(--ui-ink-soft)]",children:[ts(P,w)," ",x.primaryAction]}),r.jsx("div",{className:"mt-2",children:r.jsx(Kn,{active:Ae>0||ye,label:Te,onClick:()=>E(!0)})}),r.jsx("div",{className:"mt-3 overflow-x-auto pb-1",children:r.jsx(yi,{users:h.snapshot.users,selectedUserIds:h.selectedUserIds,onChange:h.setSelectedUserIds,compact:!0})})]})]})}),r.jsx(si,{open:o,onOpenChange:ce=>{ce||m()},presentation:"mobile_sheet",tasks:h.snapshot.tasks,projects:h.snapshot.dashboard.projects,activeRunCount:h.snapshot.activeTaskRuns.length,maxActiveTasks:s.execution.maxActiveTasks,timeAccountingMode:s.execution.timeAccountingMode,pending:i,errorMessage:l,initialTaskId:u.taskId??null,defaultProjectId:u.projectId??null,onStartExisting:g,onCreateAndStart:f}),r.jsx("main",{className:b("overflow-x-clip pb-2.5 lg:pb-24",A?"px-0":"px-4"),style:{paddingBottom:"calc(var(--forge-mobile-nav-clearance) + 2.5rem)",paddingLeft:A?"var(--forge-safe-area-left)":"max(1rem, calc(var(--forge-safe-area-left) + 1rem))",paddingRight:A?"var(--forge-safe-area-right)":"max(1rem, calc(var(--forge-safe-area-right) + 1rem))"},children:r.jsx(Xn,{routeKey:$,tone:Y?"psyche":"core",children:e})}),r.jsx(Om,{routes:oe,onOpenEditor:()=>C(!0),onRouteIntent:a}),r.jsx(Mm,{open:ae,onOpenChange:C,desktopNavIds:ne,onDesktopNavIdsChange:ie,desktopSidebarMetricsPosition:J,onDesktopSidebarMetricsPositionChange:O,mobileNavIds:V,onMobileNavIdsChange:k})]}),r.jsx(Wm,{open:N,onOpenChange:E,isLoading:be.isLoading,isError:be.isError,error:be.error,onRetry:()=>void be.refetch(),recentIngestJobs:Ie}),r.jsx(ym,{className:"fixed z-40 lg:bottom-6 lg:right-6",actions:Ke.actions})]})}function oh(){var Jt,Xt,Qt,Yt,Zt;Op();const e=is(),t=Aa(),a=c.useRef(null),s=c.useRef(null),n=mr(),o=Bt(),i=c.useContext(zn),l=Ml();Hi(),nr(zo);const u=nr(Fp),p=nr(I=>I.shell.knowledgeGraphOverlayFocus),[m,g]=c.useState(!1),[f,v]=c.useState({}),[y,_]=c.useState(null),[h,w]=c.useState(null),[P,x]=c.useState(null),[$,S]=c.useState(!1),[F,N]=c.useState(null),[E,T]=c.useState(()=>new Set),z=oa(o),ee=F?oa(F):null,ne=I=>{const D=Tm(o,I);if(oa(D)===z){N(null);return}N(D)},ie=np(),V=lp(u,{skip:!ie.isSuccess}),k=op(void 0,{skip:!ie.isSuccess}),M=ie.isSuccess&&V.isSuccess&&k.isSuccess,oe=ip(u,{skip:!M||!$}),[ae,C]=fp(),J=c.useMemo(()=>{var I;return(((I=oe.data)==null?void 0:I.metrics.celebrations)??[]).filter(D=>!E.has(D.id))},[E,(Jt=oe.data)==null?void 0:Jt.metrics.celebrations]);Mp(o.pathname,{bootstrapReady:M,sleepReady:!0});const O=th((F==null?void 0:F.pathname)??o.pathname),Y=c.useMemo(()=>r.jsx(qo,{meta:Wo[O]},ee??z),[O,ee,z]),{displayedRoute:A,displayedLocationContext:Z,visibleLocation:pe}=Up({routePathKey:z,routerLocation:o,outlet:l,routerLocationContext:i,optimisticLocation:F,optimisticRoutePathKey:ee,destinationLoadingNode:Y}),Oe=I=>{e(Ca(I))};c.useEffect(()=>{ee!==null&&ee===z&&N(null)},[ee,z]),c.useEffect(()=>{if(S(!1),!M)return;const I=window.setTimeout(()=>{S(!0)},8e3);return()=>{window.clearTimeout(I)}},[u,M]);const Ae=I=>{const D=ni(o,I);I||e(xi()),t({pathname:"/knowledge-graph",search:D})},Te=I=>{t({pathname:"/knowledge-graph",search:ni(o,I,{view:"hierarchy"})})};c.useEffect(()=>{ie.isSuccess&&n.invalidateQueries({predicate:I=>{const[D]=I.queryKey;return D==="notes-index"||D==="project-board"||D==="task-context"||typeof D=="string"&&D.startsWith("forge-")}})},[ie.isSuccess,n,u]),c.useEffect(()=>{var Q;const I=(Q=V.data)==null?void 0:Q.users;if(!I||u.length===0)return;const D=km(u,I);wm(D,u)||e(Ca(D))},[e,u,(Xt=V.data)==null?void 0:Xt.users]),c.useEffect(()=>{o.pathname.startsWith("/knowledge-graph")||p&&e(xi())},[e,p,o.pathname]),Gp(ie.isSuccess),Vp({snapshot:V.data,settings:(Qt=k.data)==null?void 0:Qt.settings}),Jp((Yt=k.data)==null?void 0:Yt.settings),c.useEffect(()=>{s.current=null,x(null)},[ie.isSuccess,u]),c.useEffect(()=>{var Q;const I=(Q=V.data)==null?void 0:Q.metrics.totalXp;if(typeof I!="number")return;if(s.current===null){s.current=I;return}const D=I-s.current;s.current=I,D!==0&&(x({deltaXp:D,totalXp:I}),n.invalidateQueries({queryKey:["forge-xp-metrics"]}),a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{x(null),a.current=null},2600))},[n,(Zt=V.data)==null?void 0:Zt.metrics.totalXp]),c.useEffect(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]);const[ye]=ap(),[be]=tp(),[Ie]=rp(),[we]=up(),[Ke]=mp(),[ze]=pp(),[ut]=hp(),[ce,tt]=Zm(),[je,Ge]=sp(),[L,X]=gp(),[R,q]=ep(),re=async()=>{await Xp(n)},We=async(I,D,Q)=>{var qe,Rt;try{await ut({taskId:I,status:D,enforceTodayWorkLog:D==="done"&&(Q==null?void 0:Q.completedTodayWorkSeconds)===void 0,completedTodayWorkSeconds:Q==null?void 0:Q.completedTodayWorkSeconds}).unwrap(),await re()}catch(it){if(it instanceof Er&&it.code==="task_completion_work_log_required"&&D==="done"&&(Q==null?void 0:Q.completedTodayWorkSeconds)===void 0){const kt=((Rt=(qe=V.data)==null?void 0:qe.tasks.find(_t=>_t.id===I))==null?void 0:Rt.title)??"this task";w({taskId:I,title:kt,status:D,customMinutes:"",error:null});return}throw it}},rt=async I=>{if(h)try{await We(h.taskId,h.status,{completedTodayWorkSeconds:I}),w(null)}catch(D){w(Q=>Q&&{...Q,error:D instanceof Error?D.message:"Could not close the task right now."})}},Gt=cr({mutationFn:async I=>{var it,kt;const D=(it=V.data)==null?void 0:it.dashboard.projects.find(_t=>_t.id===I.projectId);if(!D)throw new Error("Select a project before starting work.");const Q=((kt=k.data)==null?void 0:kt.settings.profile.operatorName)??"Albert",qe=await ye({title:I.title,description:I.description,level:"task",owner:Q,userId:D.userId??(u.length===1?u[0]:null),assigneeUserIds:[],goalId:D.goalId,projectId:D.id,parentWorkItemId:null,priority:"medium",status:"in_progress",effort:"deep",energy:"steady",dueDate:"",points:60,plannedDurationSeconds:86400,aiInstructions:"",executionMode:null,acceptanceCriteria:[],blockerLinks:[],completionReport:null,gitRefs:[],tagIds:[],notes:[]}).unwrap();if(!await Ct(qe.task.id,{actor:Q,timerMode:I.timerMode,plannedDurationSeconds:I.plannedDurationSeconds,isCurrent:!0,leaseTtlSeconds:1800,note:"",gitContext:I.gitContext}))throw new Error("The task was created, but live work did not start because the calendar override was cancelled.");return qe.task},onSuccess:async()=>{await re()}}),Ct=async(I,D)=>{try{return await ce({taskId:I,input:D}).unwrap(),await re(),!0}catch(Q){if(Q instanceof Er&&Q.code==="task_run_calendar_blocked"&&typeof window<"u"){const qe=window.prompt("Calendar rules block this task right now. Add a reason to override and start anyway.");return!qe||qe.trim().length===0?!1:(await ce({taskId:I,input:{...D,overrideReason:qe.trim()}}).unwrap(),await re(),!0)}throw Q}};if(ie.isLoading||V.isLoading||k.isLoading)return r.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:r.jsx(Po,{eyebrow:"Forge shell",title:"Loading Forge",description:"Checking your operator session and loading your latest snapshot."})});if(ie.isError)return r.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:r.jsx(Cr,{eyebrow:"Forge operator session",error:ie.error,onRetry:()=>void ie.refetch()})});if(k.isError)return r.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:r.jsx(Cr,{eyebrow:"Forge settings",error:k.error,onRetry:()=>void k.refetch()})});if(V.isError||!V.data||!k.data)return r.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:r.jsx(Cr,{eyebrow:"Forge state",error:V.error,onRetry:()=>void V.refetch()})});const Vt={snapshot:V.data,selectedUserIds:u,setSelectedUserIds:Oe,refresh:async()=>{await Promise.all([V.refetch(),re()])},createTask:async I=>{await ye(I).unwrap(),await re()},startTaskNow:async(I,D={})=>{const Q=k.data.settings.profile.operatorName;await Ct(I,jm(Q,D))},stopTaskRun:async I=>{await L({runId:I.id,input:{actor:I.actor,note:I.note??""}}).unwrap(),await re()},createGoal:async I=>{await be(I).unwrap(),await re()},createProject:async I=>{await Ie(I).unwrap(),await re()},patchGoal:async(I,D)=>{await we({goalId:I,patch:D}).unwrap(),await re()},patchProject:async(I,D)=>{await Ke({projectId:I,patch:D}).unwrap(),await re()},patchTask:async(I,D)=>{await ze({taskId:I,patch:D}).unwrap(),await re()},patchTaskStatus:async(I,D,Q)=>{await We(I,D,Q)},openStartWork:(I={})=>{v(I),_(null),g(!0)}};return Ko=Vt,r.jsx(Nc,{locale:k.data.settings.localePreference,children:r.jsx(Bo.Provider,{value:Vt,children:r.jsxs(r.Fragment,{children:[r.jsx(zd,{}),r.jsx(ih,{routeLocation:pe,onRouteIntent:ne,settings:k.data.settings,timerPending:Ge.isLoading||X.isLoading||q.isLoading,startWorkOpen:m,startWorkPending:tt.isLoading||Gt.isPending,startWorkError:y,startWorkDefaults:f,onOpenStartWork:I=>{v(I??{}),_(null),g(!0)},onCloseStartWork:()=>{g(!1),_(null)},onStartExistingTask:async(I,D)=>{try{const Q=k.data.settings.profile.operatorName;await Ct(I,{actor:Q,timerMode:D.timerMode,plannedDurationSeconds:D.plannedDurationSeconds,isCurrent:!0,leaseTtlSeconds:1800,note:"",gitContext:D.gitContext})&&(g(!1),_(null))}catch(Q){_(Q instanceof Error?Q.message:"Could not start work.")}},onCreateAndStartTask:async I=>{try{await Gt.mutateAsync(I),g(!1),_(null)}catch(D){_(D instanceof Error?D.message:"Could not create and start the task.")}},onFocusRun:async I=>{await je(I).unwrap(),await re()},onPauseRun:async I=>{const D=V.data.activeTaskRuns.find(Q=>Q.id===I);await L({runId:I,input:{actor:D==null?void 0:D.actor,note:(D==null?void 0:D.note)??""}}).unwrap(),await re()},onCompleteRun:async I=>{const D=V.data.activeTaskRuns.find(Q=>Q.id===I);await R({runId:I,input:{actor:D==null?void 0:D.actor,note:(D==null?void 0:D.note)??""}}).unwrap(),await re()},children:r.jsx("div",{className:"relative min-w-0",children:Z?r.jsx(zn.Provider,{value:Z,children:A.node}):A.node})}),r.jsx(Jm,{prompt:h,setPrompt:w,onSubmit:I=>{rt(I)}}),p!=null&&p.focusNode?r.jsx("div",{className:"pointer-events-none fixed inset-y-0 right-0 z-[64] hidden lg:flex lg:max-w-[min(30rem,calc(100vw-4rem))] lg:items-start lg:justify-end lg:p-4",children:r.jsx("div",{className:"pointer-events-auto h-full w-[min(30rem,calc(100vw-4rem))] max-w-full overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] bg-[color-mix(in_srgb,var(--surface-glass)_94%,transparent)] pt-[calc(var(--forge-shell-desktop-header-padding-top)+4.8rem)] shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",children:r.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:r.jsx(wu,{focus:p,onOpenPage:I=>{I.href&&t(I.href)},onOpenNotes:I=>{const D=Sm(I);D&&t(D)},onOpenHierarchy:Te,onSelectNode:Ae,onClose:()=>Ae(null)})})})}):null,r.jsx(Fd,{xpNotice:P,celebrations:J,onSeen:I=>{C.isLoading||E.has(I)||(T(D=>{const Q=new Set(D);return Q.add(I),Q}),ae(I).unwrap().catch(()=>{T(D=>{const Q=new Set(D);return Q.delete(I),Q})}))}})]})})})}function lh(){const e=c.useContext(Bo),t=$l(),a=e??t??Ko;if(!a)throw new Error("Forge shell context is unavailable.");return a}function ct(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function ch(...e){for(const t of e)if(typeof t=="string")return t;return""}function dh(...e){for(const t of e){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const a=Number(t);if(Number.isFinite(a))return a}}return null}function uh(...e){for(const t of e){if(Array.isArray(t)){const a=t.filter(s=>typeof s=="string"&&s.trim().length>0);if(a.length>0)return a;continue}if(typeof t=="string"){const a=t.trim();if(!a)continue;try{const s=JSON.parse(a);if(Array.isArray(s)){const n=s.filter(o=>typeof o=="string"&&o.trim().length>0);if(n.length>0)return n}}catch{const s=a.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(s.length>0)return s}}}return[]}function mh(e,t,a){const s={};return(a.length>0?a:[{key:"summary"}]).forEach((o,i)=>{const l=t&&o.key in t?t[o.key]:i===0||o.key==="summary"?e:null;s[o.key]={text:typeof l=="string"?l:Array.isArray(l)||ct(l)?JSON.stringify(l,null,2):String(l??""),json:ct(l)}}),s}function ph(e,t,a){var o;const s=e.output??[];if(!t&&s.length===0)return null;const n=t?{...t}:{};if(s.length>0){const i=(o=s[0])==null?void 0:o.key;i&&!(i in n)&&(n[i]=a),s.some(l=>l.key==="summary")&&!("summary"in n)&&(n.summary=a)}return n}function nt(e,t){const a=ph(e.definition,t.output,t.primaryText);return{primaryText:t.primaryText,payload:a,logs:t.logs??[],outputMap:mh(t.primaryText,a,e.definition.output)}}function de(e,t,a,s){return nt(e,{primaryText:a??`${e.definition.title}
9
- ${e.definition.description}
10
- Route: ${e.definition.routePath??"n/a"}`,output:t,logs:s})}function hh(e,t,a){const s=Math.max(1,Math.min(50,Math.round(a.limit??12))),n=e.services.entities.search({searches:[{query:a.query,entityTypes:a.entityTypes,limit:s}]}).results[0],o=n!=null&&n.ok?n.matches??[]:[],i=o.slice(0,s).map(l=>{const u=typeof l.title=="string"?l.title:typeof l.name=="string"?l.name:typeof l.id=="string"?l.id:"Untitled";return`${typeof l.entityType=="string"?l.entityType:"entity"}: ${u}`});return{title:t.title,matches:o,summaryText:i.length>0?i.join(`
11
- `):`No ${t.title.toLowerCase()} matches found.`,limit:s,query:a.query}}function Re(e,t){const a=ch(e.inputs.query,e.params.query,t.query).trim(),s=uh(e.inputs.entityTypes,e.params.entityTypes,t.entityTypes),n=dh(e.inputs.limit,e.params.limit,t.limit)??t.limit??12,o=hh(e.context,e.definition,{query:a,entityTypes:s,limit:n});return nt(e,{primaryText:o.summaryText,output:{summary:o.summaryText,matches:o.matches,matchCount:o.matches.length}})}function gh(e){var a,s;const t=((s=(a=e.context.services.movement).listPlaces)==null?void 0:s.call(a))??[];return nt(e,{primaryText:t.length>0?t.slice(0,24).map(n=>typeof n.label=="string"?n.label:typeof n.name=="string"?n.name:typeof n.id=="string"?n.id:"Place").join(`
12
- `):"No known places are stored yet.",output:{summary:t.length>0?`${t.length} place${t.length===1?"":"s"} available.`:"No known places are stored yet.",places:t}})}function ls(e){var a,s;const t=((s=(a=e.context.services.health).getSleepViewData)==null?void 0:s.call(a))??null;return nt(e,{primaryText:t&&typeof t=="object"?"Sleep history and derived patterns are available.":"No sleep data is available.",output:t&&typeof t=="object"?{summary:"Sleep history and derived patterns are available.",sleepView:t}:{summary:"No sleep data is available."}})}function cs(e){var a,s;const t=((s=(a=e.context.services.health).getFitnessViewData)==null?void 0:s.call(a))??null;return nt(e,{primaryText:t&&typeof t=="object"?"Workout history and composition are available.":"No sports data is available.",output:t&&typeof t=="object"?{summary:"Workout history and composition are available.",sportsView:t}:{summary:"No sports data is available."}})}function fh(e){var n,o;const t=((o=(n=e.context.services.overview).getContext)==null?void 0:o.call(n))??null,a=ct(t),s=a?[`Projects: ${Array.isArray(a.projects)?a.projects.length:0}`,`Goals: ${Array.isArray(a.activeGoals)?a.activeGoals.length:0}`,`Top tasks: ${Array.isArray(a.topTasks)?a.topTasks.length:0}`,`Due habits: ${Array.isArray(a.dueHabits)?a.dueHabits.length:0}`].join(`
13
- `):"No overview context is available.";return nt(e,{primaryText:s,output:a?{summary:s,context:a}:{summary:s}})}function Ho(e){var i,l;const t=((l=(i=e.context.services.overview).getInsights)==null?void 0:l.call(i))??null,a=ct(t),s=ct(a==null?void 0:a.status),n=ct(a==null?void 0:a.coaching),o=a?[typeof(s==null?void 0:s.systemStatus)=="string"?s.systemStatus:"Insights ready",typeof(n==null?void 0:n.title)=="string"?n.title:null,typeof(n==null?void 0:n.summary)=="string"?n.summary:null].filter(Boolean).join(`
14
- `):"No insights payload is available.";return nt(e,{primaryText:o,output:a?{summary:o,insights:a}:{summary:o}})}function yh(e){var o,i;const t=((i=(o=e.context.services.overview).getWeeklyReview)==null?void 0:i.call(o))??null,a=ct(t),s=ct(a==null?void 0:a.momentumSummary),n=a?[typeof a.windowLabel=="string"?a.windowLabel:"Weekly review",typeof(s==null?void 0:s.totalXp)=="number"?`${s.totalXp} XP`:null,typeof(s==null?void 0:s.focusHours)=="number"?`${s.focusHours} focus hours`:null].filter(Boolean).join(`
15
- `):"No weekly review payload is available.";return nt(e,{primaryText:n,output:a?{summary:n,weeklyReview:a}:{summary:n}})}function xh(e){var s,n;const t=((n=(s=e.context.services.wiki).listPages)==null?void 0:n.call(s))??[],a=t.length>0?t.slice(0,12).map(o=>typeof o.title=="string"?o.title:typeof o.slug=="string"?o.slug:typeof o.id=="string"?o.id:"Wiki page").join(`
16
- `):"No wiki pages are available.";return nt(e,{primaryText:a,output:{summary:a,pages:t}})}function vh(e){var i,l;const t=((l=(i=e.context.services.wiki).getHealth)==null?void 0:l.call(i))??null,a=ct(t),s=Array.isArray(a==null?void 0:a.unresolvedLinks)?a.unresolvedLinks.length:null,n=Array.isArray(a==null?void 0:a.orphanPages)?a.orphanPages.length:null,o=a?["Wiki health summary",s!==null?`${s} unresolved links`:null,n!==null?`${n} orphan pages`:null].filter(Boolean).join(`
17
- `):"No wiki health payload is available.";return nt(e,{primaryText:o,output:a?{summary:o,health:a}:{summary:o}})}const bh=["text","number","boolean","object","array","json","tool","summary","entity","entity_list","context","metrics","filters","markdown","timeline","selection","record","record_list"],wh={goal:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"horizon",label:"Horizon",kind:"text"}],project:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"goalId",label:"Goal id",kind:"text"}],task:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"priority",label:"Priority",kind:"text"},{key:"projectId",label:"Project id",kind:"text"}],strategy:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"overview",label:"Overview",kind:"markdown"}],habit:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"status",label:"Status",kind:"text"},{key:"frequency",label:"Frequency",kind:"text"},{key:"polarity",label:"Polarity",kind:"text"}],note:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"summary",label:"Summary",kind:"markdown"},{key:"kind",label:"Kind",kind:"text"},{key:"updatedAt",label:"Updated at",kind:"text"}],insight:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"summary",label:"Summary",kind:"markdown"},{key:"status",label:"Status",kind:"text"}],calendar_event:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"startsAt",label:"Starts at",kind:"text"},{key:"endsAt",label:"Ends at",kind:"text"},{key:"origin",label:"Origin",kind:"text"}],wiki_page:[{key:"id",label:"Id",kind:"text",required:!0},{key:"title",label:"Title",kind:"text",required:!0},{key:"slug",label:"Slug",kind:"text"},{key:"summary",label:"Summary",kind:"markdown"}],sleep_session:[{key:"id",label:"Id",kind:"text",required:!0},{key:"startAt",label:"Start",kind:"text"},{key:"endAt",label:"End",kind:"text"},{key:"totalSleepMinutes",label:"Total sleep minutes",kind:"number"}],workout_session:[{key:"id",label:"Id",kind:"text",required:!0},{key:"type",label:"Type",kind:"text"},{key:"startedAt",label:"Started at",kind:"text"},{key:"durationMinutes",label:"Duration minutes",kind:"number"}]},kh={WorkbenchUserMessage:[{key:"message",label:"Message",kind:"text",required:!0}],WorkbenchUserContext:[{key:"context",label:"Context",kind:"record"}],WorkbenchMergedContext:[{key:"merged",label:"Merged",kind:"record",required:!0}],WorkbenchTemplateOutput:[{key:"rendered",label:"Rendered",kind:"markdown",required:!0}],WorkbenchSelectedValue:[{key:"selected",label:"Selected",kind:"record",required:!0}],WorkbenchPublishedOutput:[{key:"published",label:"Published",kind:"record",required:!0}],WeeklyReviewPayload:[{key:"wins",label:"Wins",kind:"record_list"},{key:"trends",label:"Trends",kind:"record_list"}],InsightsPayload:[{key:"insights",label:"Insights",kind:"record_list"},{key:"heatmap",label:"Heatmap",kind:"record_list"}],OperatorOverviewPayload:[{key:"summary",label:"Summary",kind:"markdown"},{key:"currentWork",label:"Current work",kind:"record_list"}],OperatorContextPayload:[{key:"tasks",label:"Tasks",kind:"record_list"},{key:"focus",label:"Focus",kind:"record_list"}],SleepViewData:[{key:"sessions",label:"Sessions",kind:"record_list"},{key:"metrics",label:"Metrics",kind:"metrics"}]};function jh(e){var n,o,i;const t=(n=e.kind)==null?void 0:n.trim().toLowerCase();if(t&&bh.includes(t))return t;const a=((o=e.key)==null?void 0:o.trim().toLowerCase())??"",s=((i=e.modelName)==null?void 0:i.trim().toLowerCase())??"";return t==="content"?a==="summary"||s.includes("summary")?"summary":a==="answer"||a==="rendered"||s.includes("answer")||s.includes("markdown")||s.includes("template")?"markdown":a==="message"||a==="query"||a==="title"||s.includes("message")?"text":e.itemKind?"entity_list":"record":a.endsWith("count")||a==="limit"?"number":a==="summary"?"summary":a==="answer"||a==="rendered"?"markdown":a==="message"||a==="query"?"text":e.itemKind?"entity_list":"record"}function ds(e){return e?wh[e]??[]:[]}function us(e){return e?kh[e]??[]:[]}function ms(e){const t=jh(e),a=ds(e.itemKind),s=us(e.modelName),n=e.shape&&e.shape.length>0?e.shape:a.length>0?a:s;return{...e,kind:t,shape:n.length>0?n:[]}}function jr(e){return e.map(t=>ms(t))}function Sh(e,t){return Object.assign(e,{workbench:{...t,WebView:e}})}function Uo(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function dr(e){const t=e.itemKind?ds(e.itemKind):[],a=e.modelName?us(e.modelName):[];return ms({key:e.key,label:e.label,kind:e.kind,description:e.description,required:e.required??!1,modelName:e.modelName,itemKind:e.itemKind,shape:e.shape??(t.length>0?t:a),exampleValue:e.exampleValue})}function da(e){const t=e.itemKind?ds(e.itemKind):[],a=e.modelName?us(e.modelName):[];return ms({key:e.key,label:e.label,kind:e.kind,description:e.description,required:e.required??!1,modelName:e.modelName,itemKind:e.itemKind,shape:e.shape??(t.length>0?t:a),exampleValue:e.exampleValue})}function ua(e){return{key:e.key,label:e.label,kind:e.kind,description:e.description,required:e.required??!1,options:e.options}}function U(e){return dr({key:"summary",label:(e==null?void 0:e.label)??"Summary",kind:"summary",description:(e==null?void 0:e.description)??"Human-readable summary of what this node currently knows or produced.",modelName:"WorkbenchSummary",exampleValue:e==null?void 0:e.exampleValue})}function Ee(e){const t=Uo(e.itemKind);return[U({label:e.summaryLabel??"Search summary",description:`Compact summary of the current ${e.itemLabel.toLowerCase()} search results.`}),dr({key:e.collectionKey??"matches",label:e.collectionLabel??`${e.itemLabel} matches`,kind:"entity_list",description:`Structured ${e.itemLabel.toLowerCase()} records returned by Forge search.`,modelName:`${t}SearchResults`,itemKind:e.itemKind,exampleValue:`[{"id":"...","title":"Example ${e.itemLabel}"}]`}),dr({key:"matchCount",label:"Match count",kind:"number",description:"Number of records returned by the search.",modelName:`${t}SearchCount`,exampleValue:"12"})]}function $e(e){const t=Uo(e.itemKind);return[da({key:"query",label:"Query",kind:"text",description:`Search text for narrowing ${e.itemLabel.toLowerCase()} results.`,modelName:`${t}SearchQuery`,exampleValue:"backlog"}),da({key:"entityTypes",label:"Entity types",kind:"array",description:"Entity types to include in the Forge search.",modelName:`${t}SearchEntityTypes`,exampleValue:JSON.stringify(e.defaultEntityTypes??[e.itemKind])}),da({key:"limit",label:"Limit",kind:"number",description:"Maximum number of results to request.",modelName:`${t}SearchLimit`,exampleValue:String(e.defaultLimit??20)})]}function Me(e){return[ua({key:"query",label:"Default query",kind:"text",description:"Used when no query input edge is connected."}),ua({key:"entityTypes",label:"Default entity types",kind:"array",description:"Used when no entity types input edge is connected. Enter a JSON array or comma-separated values."}),ua({key:"limit",label:"Default limit",kind:"number",description:"Used when no limit input edge is connected."})]}function Ne(e){return dr({key:e.key,label:e.label,kind:"context",description:e.description,modelName:e.modelName,shape:e.shape,exampleValue:e.exampleValue})}function Go(e){return dr({key:e.key,label:e.label,kind:"record_list",description:e.description,modelName:e.modelName,itemKind:e.itemKind,exampleValue:e.exampleValue})}function Pe(e){return{key:"forge.search_entities",label:"Search Forge entities",description:e,accessMode:"read",argsSchema:{type:"object",properties:{query:{type:"string",description:"Search text to match against Forge entities."},entityTypes:{type:"array",items:{type:"string"},description:"Optional entity types to narrow the search."},limit:{type:"number",description:"Maximum number of results to return."}}}}}function Or(e){return{key:"forge.create_note",label:"Create note",description:e,accessMode:"write",argsSchema:{type:"object",properties:{title:{type:"string",description:"Title of the note to create."},summary:{type:"string",description:"Optional short summary for the note."},markdown:{type:"string",description:"Markdown content that should become the note body."}}}}}function Dr(e){return{key:"forge.update_task_status",label:"Move task",description:e,accessMode:"write",argsSchema:{type:"object",properties:{taskId:{type:"string",description:"Task id to update."},status:{type:"string",description:"New Forge task status.",enum:["backlog","focus","in_progress","blocked","done"]}}}}}function Nh(e){return[e.kind,e.modelName,e.itemKind?`item:${e.itemKind}`:null].filter(Boolean).join(" · ")}function wi({title:e,ports:t,align:a}){return r.jsxs("div",{className:"grid gap-1.5",children:[r.jsxs("div",{className:b("flex items-center gap-1 text-[10px] uppercase tracking-[0.18em] text-white/34",a==="left"?"text-left":"text-right"),children:[r.jsx("span",{children:e}),r.jsx(zt,{content:a==="left"?"Inputs are values this box expects from upstream nodes.":"Outputs are values this box publishes for downstream nodes.",label:a==="left"?"Explain box inputs":"Explain box outputs"})]}),t.length===0?r.jsx("div",{className:"rounded-full border border-dashed border-white/10 px-3 py-1.5 text-[11px] text-white/28",children:"None"}):null,t.map(s=>r.jsxs("div",{className:b("relative rounded-[16px] bg-white/[0.05] px-3 py-2 text-[11px] text-white/62",a==="left"?"pl-5 text-left":"pr-5 text-right"),children:[r.jsx(xc,{type:a==="left"?"target":"source",position:a==="left"?Wn.Left:Wn.Right,id:s.key,className:"!size-2.5 !border !border-white/80 !bg-[#b8c5ff]",style:{[a]:6}}),r.jsx("div",{children:s.label}),r.jsx("div",{className:"mt-1 text-[10px] text-white/38",children:Nh(s)})]},s.key))]})}function ge(e){return function(a){const[s,n]=c.useState(!1);return r.jsxs("div",{className:"min-w-[280px] rounded-[24px] border border-white/10 bg-[linear-gradient(180deg,rgba(20,28,45,0.98),rgba(11,16,29,0.98))] p-3 shadow-[0_26px_80px_rgba(0,0,0,0.4)]",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"truncate text-sm font-semibold text-white",children:e.title}),r.jsx("div",{className:"mt-1 line-clamp-2 text-[12px] leading-5 text-white/48",children:e.description})]}),r.jsx("div",{className:"rounded-full bg-white/[0.06] px-2.5 py-1 text-[10px] uppercase tracking-[0.16em] text-white/56",children:"box"})]}),e.params.length>0?r.jsxs("div",{className:"mt-3 rounded-[18px] bg-white/[0.04] px-3 py-2 text-[11px] text-white/52",children:[e.params.length," param",e.params.length===1?"":"s"," configurable in the flow editor"]}):null,e.tools.length>0?r.jsxs("div",{className:"mt-2 rounded-[18px] bg-white/[0.04] px-3 py-2 text-[11px] text-white/52",children:[e.tools.length," tool",e.tools.length===1?"":"s"," available"]}):null,r.jsx("div",{className:"mt-2",children:r.jsx("button",{type:"button",className:"rounded-full bg-white/[0.05] px-3 py-1.5 text-[11px] text-white/56 transition hover:bg-white/[0.08] hover:text-white",onClick:()=>n(o=>!o),children:s?"Hide schema":"Preview schema"})}),r.jsxs("div",{className:"mt-3 grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)] gap-3",children:[r.jsx(wi,{title:"Inputs",ports:e.inputs,align:"left"}),r.jsx(wi,{title:"Outputs",ports:e.output,align:"right"})]}),s?r.jsxs("div",{className:"mt-3 rounded-[18px] border border-white/8 bg-black/20 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-[0.18em] text-white/38",children:[r.jsx("span",{children:"Box contract"}),r.jsx(zt,{content:"This preview summarizes what the box consumes, publishes, and what tools it can expose to AI nodes.",label:"Explain box contract preview"})]}),r.jsx("pre",{className:"mt-2 overflow-auto whitespace-pre-wrap text-[11px] leading-5 text-white/64",children:JSON.stringify({inputs:e.inputs.map(({key:o,kind:i,required:l,description:u,modelName:p,itemKind:m,shape:g,exampleValue:f})=>({key:o,kind:i,required:!!l,description:u,modelName:p,itemKind:m,shape:g,exampleValue:f})),outputs:e.output.map(({key:o,kind:i,required:l,description:u,modelName:p,itemKind:m,shape:g,exampleValue:f})=>({key:o,kind:i,required:!!l,description:u,modelName:p,itemKind:m,shape:g,exampleValue:f})),tools:e.tools.map(({key:o,accessMode:i,argsSchema:l})=>({key:o,accessMode:i,argsSchema:l}))},null,2)})]}):null]})}}function Ph(e){const t=new Date(e.getFullYear(),e.getMonth(),1),a=(t.getDay()+6)%7,s=new Date(t);return s.setDate(s.getDate()-a),Array.from({length:35},(n,o)=>{const i=new Date(s);return i.setDate(s.getDate()+o),i})}function Th(e,t){return typeof window>"u"?t:window.localStorage.getItem(e)??t}function Ih(e,t){typeof window>"u"||window.localStorage.setItem(e,t)}function ps({compact:e}){const[t,a]=c.useState(()=>new Date);return c.useEffect(()=>{const s=window.setInterval(()=>a(new Date),3e4);return()=>window.clearInterval(s)},[]),r.jsxs("div",{className:"flex h-full flex-col justify-between gap-4 rounded-[20px] bg-white/[0.03] p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white/45",children:[r.jsx($i,{className:"size-4"}),r.jsx("span",{className:"text-[12px] uppercase tracking-[0.16em]",children:"Local time"})]}),r.jsx("div",{className:b("font-display text-white",e?"text-3xl":"text-5xl"),children:new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(t)}),r.jsx("div",{className:"text-sm text-white/58",children:new Intl.DateTimeFormat(void 0,{weekday:"long",month:"long",day:"numeric"}).format(t)})]})}function hs({compact:e}){const t=new Date,a=c.useMemo(()=>Ph(t),[t]),s=e?["M","T","W","T","F","S","S"]:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return r.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-white",children:[r.jsx(Ot,{className:"size-4 text-[var(--primary)]"}),new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(t)]}),r.jsx("div",{className:"text-[12px] text-white/45",children:e?"Mini":"Month view"})]}),r.jsxs("div",{className:"grid grid-cols-7 gap-1.5",children:[s.map(n=>r.jsx("div",{className:"text-center text-[11px] uppercase tracking-[0.14em] text-white/35",children:n},n)),a.map(n=>{const o=n.getMonth()===t.getMonth(),i=n.toDateString()===t.toDateString();return r.jsx("div",{className:b("flex min-h-9 items-center justify-center rounded-xl text-sm",i?"bg-[var(--primary)] text-slate-950":o?"bg-white/[0.04] text-white/78":"bg-transparent text-white/24"),children:n.getDate()},n.toISOString())})]})]})}function gs({surfaceId:e}){const t=`forge.utility.spotify.${e}`,[a,s]=c.useState(()=>Th(t,"https://open.spotify.com/"));return c.useEffect(()=>{Ih(t,a)},[t,a]),r.jsxs("div",{className:"grid h-full gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white",children:[r.jsx(Wl,{className:"size-4 text-[var(--secondary)]"}),r.jsx("span",{className:"text-sm font-semibold",children:"Spotify link"})]}),r.jsx("input",{value:a,onChange:n=>s(n.target.value),className:"w-full rounded-2xl border border-white/10 bg-white/[0.04] px-3 py-2.5 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.35)]",placeholder:"Paste a playlist, album, or artist URL"}),r.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-10 items-center justify-center gap-2 rounded-2xl bg-[rgba(78,222,163,0.14)] px-3 py-2 text-sm font-medium text-[var(--secondary)] transition hover:bg-[rgba(78,222,163,0.22)]",children:["Open Spotify",r.jsx(ha,{className:"size-4"})]})]})}function fs({compact:e}){const[t,a]=c.useState(null),[s,n]=c.useState("Locating…");return c.useEffect(()=>{if(typeof navigator>"u"||!navigator.geolocation){n("Location unavailable");return}let o=!1;return navigator.geolocation.getCurrentPosition(async i=>{try{const u=await(await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${i.coords.latitude}&longitude=${i.coords.longitude}&current=temperature_2m,weather_code`)).json();if(o||!u.current)return;a({temperature:Number(u.current.temperature_2m??0),weatherCode:Number(u.current.weather_code??0)}),n("Live")}catch{o||n("Weather unavailable")}},()=>{o||n("Permission denied")},{maximumAge:3e5,timeout:6e3}),()=>{o=!0}},[]),r.jsxs("div",{className:"flex h-full flex-col justify-between gap-4 rounded-[20px] bg-white/[0.03] p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white",children:[r.jsx(ql,{className:"size-4 text-[var(--tertiary)]"}),r.jsx("span",{className:"text-sm font-semibold",children:"Weather"})]}),t?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:b("font-display text-white",e?"text-3xl":"text-5xl"),children:[Math.round(t.temperature),"°"]}),r.jsxs("div",{className:"text-sm text-white/58",children:["Code ",t.weatherCode," · ",s]})]}):r.jsx("div",{className:"text-sm text-white/58",children:s})]})}function ys({compact:e,defaultUserId:t}){const a=mr(),s=c.useRef(null),n=c.useRef(null),[o,i]=c.useState(""),[l,u]=c.useState(""),p=cr({mutationFn:async()=>rd({contentMarkdown:`# ${o.trim()||"Quick note"}
18
-
19
- ${l.trim()}`,author:"Forge quick capture",userId:t??null,links:[]}),onSuccess:async()=>{i(""),u(""),await a.invalidateQueries({queryKey:["notes-index"]})}}),m=cr({mutationFn:async()=>ad({title:o.trim()||"Quick capture",contentMarkdown:l.trim(),summary:l.trim().slice(0,180),author:"Forge quick capture"}),onSuccess:async()=>{i(""),u(""),await a.invalidateQueries({queryKey:["wiki-pages"]})}});function g(f,v=f){const y=n.current;if(!y)return;const _=y.selectionStart??0,h=y.selectionEnd??0,w=l.slice(_,h),P=`${l.slice(0,_)}${f}${w}${v}${l.slice(h)}`;u(P),requestAnimationFrame(()=>{y.focus(),y.selectionStart=_+f.length,y.selectionEnd=h+f.length})}return r.jsxs("div",{className:"grid h-full min-h-0 gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white",children:[r.jsx(Pt,{className:"size-4 text-[var(--primary)]"}),r.jsx("span",{className:"text-sm font-semibold",children:"Quick capture"})]}),r.jsx("input",{ref:s,value:o,onChange:f=>i(f.target.value),className:"w-full rounded-2xl border border-white/10 bg-white/[0.04] px-3 py-2.5 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.35)]",placeholder:"Title"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:[{label:"B",action:()=>g("**")},{label:"I",action:()=>g("_")},{label:"H1",action:()=>g("# ","")},{label:"[]",action:()=>g("- [ ] ","")}].map(f=>r.jsx("button",{type:"button",className:"inline-flex min-h-8 items-center justify-center rounded-xl bg-white/[0.05] px-2.5 text-[12px] font-semibold text-white/72 transition hover:bg-white/[0.08] hover:text-white",onClick:f.action,children:f.label},f.label))}),r.jsx("textarea",{ref:n,value:l,onChange:f=>u(f.target.value),className:b("min-h-0 w-full rounded-[20px] border border-white/10 bg-white/[0.04] px-3 py-3 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.35)]",e?"h-28":"h-40"),placeholder:"Write a quick note or rough wiki draft"}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[r.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center justify-center gap-2 rounded-2xl bg-[rgba(192,193,255,0.16)] px-3 py-2 text-sm font-medium text-[var(--primary)] transition hover:bg-[rgba(192,193,255,0.24)] disabled:opacity-50",disabled:!l.trim()||p.isPending,onClick:()=>p.mutate(),children:[r.jsx(Bl,{className:"size-4"}),"Save as note"]}),r.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center justify-center gap-2 rounded-2xl bg-[rgba(255,185,95,0.16)] px-3 py-2 text-sm font-medium text-[var(--tertiary)] transition hover:bg-[rgba(255,185,95,0.24)] disabled:opacity-50",disabled:!l.trim()||m.isPending,onClick:()=>m.mutate(),children:[r.jsx(Pt,{className:"size-4"}),"Save as wiki"]})]})]})}const Ch={id:"surface:utility:time",surfaceId:"utility",routePath:null,title:"Clock",icon:"timer",description:"Live local time widget.",category:"Utilities",tags:["utility","clock"],inputs:[],params:[],output:[U({label:"Current time",description:"Formatted local time string published by the clock widget."}),Ne({key:"clock",label:"Clock state",description:"Structured clock state including the current ISO timestamp.",modelName:"ForgeClockState"})],tools:[],NodeView:ge({title:"Clock",description:"Live local time widget.",inputs:[],params:[],output:[U({label:"Current time",description:"Formatted local time string published by the clock widget."}),Ne({key:"clock",label:"Clock state",description:"Structured clock state including the current ISO timestamp.",modelName:"ForgeClockState"})],tools:[]}),WebView:ps,execute:e=>de(e,{clock:{now:e.context.now}},new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(e.context.now)))};ps.workbench=Ch;const Rh={id:"surface:utility:mini-calendar",surfaceId:"utility",routePath:null,title:"Mini calendar",icon:"calendar",description:"Compact month calendar widget.",category:"Utilities",tags:["utility","calendar"],inputs:[],params:[],output:[U({label:"Month view",description:"Summary of the compact month calendar widget."}),Ne({key:"calendarView",label:"Calendar view",description:"Structured mini-calendar state including the current month anchor.",modelName:"ForgeMiniCalendarView"})],tools:[],NodeView:ge({title:"Mini calendar",description:"Compact month calendar widget.",inputs:[],params:[],output:[U({label:"Month view",description:"Summary of the compact month calendar widget."}),Ne({key:"calendarView",label:"Calendar view",description:"Structured mini-calendar state including the current month anchor.",modelName:"ForgeMiniCalendarView"})],tools:[]}),WebView:hs,execute:e=>de(e,{calendarView:{now:e.context.now}},"Compact month calendar")};hs.workbench=Rh;const _h={id:"surface:utility:spotify",surfaceId:"utility",routePath:null,title:"Spotify",icon:"music",description:"Pinned music link widget.",category:"Utilities",tags:["utility","spotify"],inputs:[{key:"surfaceId",label:"Surface id",kind:"text",required:!1}],params:[],output:[U({label:"Spotify link",description:"Summary of the pinned music link widget."}),Ne({key:"spotifyLink",label:"Spotify state",description:"Structured Spotify widget state and pinned surface context.",modelName:"ForgeSpotifyWidgetState"})],tools:[],NodeView:ge({title:"Spotify",description:"Pinned music link widget.",inputs:[{key:"surfaceId",label:"Surface id",kind:"text"}],params:[],output:[U({label:"Spotify link",description:"Summary of the pinned music link widget."}),Ne({key:"spotifyLink",label:"Spotify state",description:"Structured Spotify widget state and pinned surface context.",modelName:"ForgeSpotifyWidgetState"})],tools:[]}),WebView:gs,execute:e=>de(e,{spotifyLink:{surfaceId:e.inputs.surfaceId??null}},"Pinned Spotify link")};gs.workbench=_h;const Eh={id:"surface:utility:weather",surfaceId:"utility",routePath:null,title:"Weather",icon:"weather",description:"Location-aware weather widget.",category:"Utilities",tags:["utility","weather"],inputs:[],params:[],output:[U({label:"Weather summary",description:"Summary of the weather widget state."}),Ne({key:"weather",label:"Weather payload",description:"Structured weather widget payload.",modelName:"ForgeWeatherWidgetState"})],tools:[],NodeView:ge({title:"Weather",description:"Location-aware weather widget.",inputs:[],params:[],output:[U({label:"Weather summary",description:"Summary of the weather widget state."}),Ne({key:"weather",label:"Weather payload",description:"Structured weather widget payload.",modelName:"ForgeWeatherWidgetState"})],tools:[]}),WebView:fs,execute:e=>de(e,{weather:null},"Weather widget")};fs.workbench=Eh;const Ah={id:"surface:utility:quick-capture",surfaceId:"utility",routePath:null,title:"Quick capture",icon:"capture",description:"Draft a quick note or wiki page.",category:"Capture",tags:["capture","notes"],inputs:[{key:"defaultUserId",label:"Default user id",kind:"text",required:!1}],params:[],output:[U({label:"Draft summary",description:"Summary of the quick-capture draft state."}),Ne({key:"draft",label:"Draft context",description:"Structured quick-capture draft context.",modelName:"ForgeQuickCaptureDraft"})],tools:[Or("Create a Forge evidence note from captured markdown.")],NodeView:ge({title:"Quick capture",description:"Draft a quick note or wiki page.",inputs:[{key:"defaultUserId",label:"Default user id",kind:"text"}],params:[],output:[U({label:"Draft summary",description:"Summary of the quick-capture draft state."}),Ne({key:"draft",label:"Draft context",description:"Structured quick-capture draft context.",modelName:"ForgeQuickCaptureDraft"})],tools:[Or("Create a Forge evidence note from captured markdown.")]}),WebView:ys,execute:e=>de(e,{draft:{defaultUserId:e.inputs.defaultUserId??null}},"Quick capture can draft notes and wiki pages.")};ys.workbench=Ah;function ke(e,t){const a=s=>e(s);return a.displayName=t.title.replace(/\s+/g,""),Sh(a,t)}function Lh({children:e}){return r.jsx(r.Fragment,{children:e})}function Vo(e,t,a,s,n,o){return ke(Lh,{id:e,surfaceId:"insights",routePath:"/insights",title:t,icon:"insights",description:a,category:"Insights",tags:s,inputs:[],params:[],output:o,tools:[],NodeView:ge({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:n})}const Oh=Vo("surface:insights:feed","Insights feed","Current coaching feed, status summary, and evidence-backed insight stream.",["insights","feed"],e=>Ho(e),[U({label:"Insight summary",description:"Summary of the current coaching feed and evidence-backed insight stream."}),Ne({key:"insights",label:"Insight payload",description:"Structured status and coaching payload returned by Forge insights.",modelName:"ForgeInsightsPayload"})]),Dh=Vo("surface:insights:coaching","Coaching recommendation","Single-action coaching summary for what Forge thinks matters next.",["insights","coaching"],e=>de(e,{focus:"coaching_recommendation"},"Coaching recommendation surface for the highest-leverage next move."),[U({label:"Coaching recommendation",description:"Summary of the highest-leverage coaching recommendation."})]);function xs({children:e}){return r.jsx(r.Fragment,{children:e})}const Wt=$e({itemKind:"task",itemLabel:"Task",defaultEntityTypes:["task"],defaultLimit:24}),qt=Me(),$h=ke(xs,{id:"surface:kanban-index:summary",surfaceId:"kanban-index",routePath:"/kanban",title:"Kanban summary",icon:"kanban",description:"Board summary and execution posture.",category:"Execution",tags:["kanban","summary"],inputs:Wt,params:qt,output:[U({label:"Kanban summary",description:"Summary of board posture and execution pressure."})],tools:[],NodeView:ge({title:"Kanban summary",description:"Board summary and execution posture.",inputs:Wt,params:qt,output:[U({label:"Kanban summary",description:"Summary of board posture and execution pressure."})],tools:[]}),execute:e=>Re(e,{query:"",entityTypes:["task"],limit:24})}),Mh=ke(xs,{id:"surface:kanban-index:filters",surfaceId:"kanban-index",routePath:"/kanban",title:"Kanban filters",icon:"filter",description:"Goal, owner, and tag filters for board scope.",category:"Execution",tags:["kanban","filters"],inputs:Wt,params:qt,output:[U({label:"Filter summary",description:"Summary of the current Kanban filters and scope."})],tools:[Pe("Search Forge entities by query and entity types.")],NodeView:ge({title:"Kanban filters",description:"Goal, owner, and tag filters for board scope.",inputs:Wt,params:qt,output:[U({label:"Filter summary",description:"Summary of the current Kanban filters and scope."})],tools:[Pe("Search Forge entities by query and entity types.")]}),execute:e=>Re(e,{query:"",entityTypes:["task"],limit:24})}),Fh=ke(xs,{id:"surface:kanban-index:board",surfaceId:"kanban-index",routePath:"/kanban",title:"Kanban board",icon:"board",description:"Task board with move and execution actions.",category:"Execution",tags:["kanban","board","tasks"],inputs:Wt,params:qt,output:Ee({itemKind:"kanban_task",itemLabel:"Kanban task"}),tools:[Pe("Search Forge entities by query and entity types."),Dr("Update a task status.")],NodeView:ge({title:"Kanban board",description:"Task board with move and execution actions.",inputs:Wt,params:qt,output:Ee({itemKind:"kanban_task",itemLabel:"Kanban task"}),tools:[Pe("Search Forge entities by query and entity types."),Dr("Update a task status.")]}),execute:e=>Re(e,{query:"",entityTypes:["task"],limit:24})});function zh({children:e}){return r.jsx(r.Fragment,{children:e})}function vs(e,t,a,s,n,o,i,l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke(zh,{id:e,surfaceId:"calendar",routePath:"/calendar",title:t,icon:"calendar",description:a,category:"Calendar",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const Wh=vs("surface:calendar:overview","Calendar overview","Main calendar surface for mirrored events, work blocks, and planned timeboxes.",["calendar","overview"],e=>de(e,{surfaces:["events","work_blocks","timeboxes"]},"Calendar overview spanning mirrored events, work blocks, and timeboxes."),[U({label:"Calendar summary",description:"Summary of mirrored events, work blocks, and timeboxes."})],[]),qh=vs("surface:calendar:events","Calendar events","Mirrored calendar events and Forge-managed calendar records.",["calendar","events","mirrored"],e=>Re(e,{query:"",entityTypes:["calendar_event"],limit:20}),Ee({itemKind:"calendar_event",itemLabel:"Calendar event"}),[Pe("Search calendar-backed Forge entities and planning records.")],{inputs:$e({itemKind:"calendar_event",itemLabel:"Calendar event",defaultEntityTypes:["calendar_event"],defaultLimit:20}),params:Me()}),Bh=vs("surface:calendar:planning","Planning blocks","Planned task timeboxes and reusable work block templates.",["calendar","planning","timeboxes"],e=>Re(e,{query:"",entityTypes:["task_timebox","work_block_template"],limit:20}),Ee({itemKind:"calendar_plan",itemLabel:"Planning record"}),[Pe("Search calendar-backed Forge entities and planning records.")],{inputs:$e({itemKind:"calendar_plan",itemLabel:"Planning record",defaultEntityTypes:["task_timebox","work_block_template"],defaultLimit:20}),params:Me()});function Kh({children:e}){return r.jsx(r.Fragment,{children:e})}function bs(e,t,a,s,n,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke(Kh,{id:e,surfaceId:"goals",routePath:"/goals",title:t,icon:"goal",description:a,category:"Goals",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const Hh=bs("surface:goals:hero","Goals hero","Goals page header and long-horizon direction context.",["goals","hero"],e=>de(e,null,"Goals page header."),[U({label:"Goals summary",description:"High-level goals page framing."})]),Uh=bs("surface:goals:search-results","Goals list and results","Goal browser, linked context, and search results.",["goals","search"],e=>Re(e,{query:"",entityTypes:["goal"],limit:20}),Ee({itemKind:"goal",itemLabel:"Goal"}),[Pe("Search goal entities by query and entity types.")],{inputs:$e({itemKind:"goal",itemLabel:"Goal",defaultEntityTypes:["goal"],defaultLimit:20}),params:Me()}),Gh=bs("surface:goals:summary","Goals summary","Goal collection summary and state context.",["goals","summary"],e=>de(e,null,"Goal collection summary."),[U({label:"Goals summary",description:"Summary of the goal collection and its current state."})]);function Vh({children:e}){return r.jsx(r.Fragment,{children:e})}function ws(e,t,a,s,n,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke(Vh,{id:e,surfaceId:"habits",routePath:"/habits",title:t,icon:"habit",description:a,category:"Habits",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const Jh=ws("surface:habits:hero","Habits hero","Habits page header and recurring execution context.",["habits","hero"],e=>de(e,null,"Habits page header."),[U({label:"Habits summary",description:"High-level habits page framing."})]),Xh=ws("surface:habits:search-results","Habits list and results","Habit browser, due habits, and recurring check-in context.",["habits","search","check-ins"],e=>Re(e,{query:"",entityTypes:["habit"],limit:20}),Ee({itemKind:"habit",itemLabel:"Habit"}),[Pe("Search habit entities by query and entity types.")],{inputs:$e({itemKind:"habit",itemLabel:"Habit",defaultEntityTypes:["habit"],defaultLimit:20}),params:Me()}),Qh=ws("surface:habits:summary","Habits summary","Habit streaks, due state, and collection-level rhythm context.",["habits","summary","streaks"],e=>de(e,null,"Habit collection summary."),[U({label:"Habit summary",description:"Summary of habit streaks, due state, and collection rhythm."})]);function Yh({children:e}){return r.jsx(r.Fragment,{children:e})}function Ut(e){return ke(Yh,{id:e.id,surfaceId:e.surfaceId,routePath:e.routePath,title:e.title,icon:e.surfaceId,description:e.description,category:e.category,tags:e.tags,inputs:[],params:[],output:e.output,tools:[],NodeView:ge({title:e.title,description:e.description,inputs:[],params:[],output:e.output,tools:[]}),execute:e.execute})}const Zh=Ut({id:"surface:sleep-index:summary",surfaceId:"sleep-index",routePath:"/sleep",title:"Sleep summary",description:"Recent nightly sleep metrics and recovery posture.",category:"Sleep",tags:["sleep","summary"],execute:e=>ls(e),output:[U({label:"Sleep summary",description:"Summary of recent sleep and recovery posture."}),Ne({key:"sleepView",label:"Sleep view",description:"Structured sleep history and derived sleep patterns.",modelName:"ForgeSleepView"})]}),eg=Ut({id:"surface:sleep-index:patterns",surfaceId:"sleep-index",routePath:"/sleep",title:"Sleep patterns",description:"Weekly baseline, stage mix, and timing patterns around canonical nights.",category:"Sleep",tags:["sleep","patterns"],execute:e=>ls(e),output:[U({label:"Sleep pattern summary",description:"Summary of trend, stage averages, and recovery state."}),Ne({key:"sleepView",label:"Sleep view",description:"Structured sleep trend, stage averages, and recovery signals.",modelName:"ForgeSleepView"})]}),tg=Ut({id:"surface:sleep-index:browser",surfaceId:"sleep-index",routePath:"/sleep",title:"Night detail",description:"Interactive sleep calendar, selected-night detail, and optional raw evidence.",category:"Sleep",tags:["sleep","browser","history"],execute:e=>ls(e),output:[U({label:"Night detail summary",description:"Summary of the sleep calendar and selected-night detail."}),Ne({key:"sleepView",label:"Sleep view",description:"Structured canonical nights, calendar summaries, and phase detail.",modelName:"ForgeSleepView"})]}),rg=Ut({id:"surface:sports-index:summary",surfaceId:"sports-index",routePath:"/sports",title:"Sports summary",description:"Recent workout metrics, streaks, and linked-session totals.",category:"Sports",tags:["sports","summary"],execute:e=>cs(e),output:[U({label:"Sports summary",description:"Summary of recent workout metrics and streaks."}),Ne({key:"sportsView",label:"Sports view",description:"Structured workout metrics, streaks, and linked session totals.",modelName:"ForgeSportsView"})]}),ag=Ut({id:"surface:sports-index:composition",surfaceId:"sports-index",routePath:"/sports",title:"Training composition",description:"Workout mix, trend, and session composition context.",category:"Sports",tags:["sports","composition","trend"],execute:e=>cs(e),output:[U({label:"Composition summary",description:"Summary of workout mix, trend, and session composition."}),Ne({key:"sportsView",label:"Sports view",description:"Structured workout mix, trend, and session composition data.",modelName:"ForgeSportsView"})]}),sg=Ut({id:"surface:sports-index:browser",surfaceId:"sports-index",routePath:"/sports",title:"Session browser",description:"Searchable and virtualized workout history browser.",category:"Sports",tags:["sports","browser","history"],execute:e=>cs(e),output:[U({label:"Session browser summary",description:"Summary of searchable workout history."}),Ne({key:"sportsView",label:"Sports view",description:"Structured workout history for browsing and analysis.",modelName:"ForgeSportsView"})]});function ng({children:e}){return r.jsx(r.Fragment,{children:e})}function xr(e,t,a,s,n,o){return ke(ng,{id:e,surfaceId:"movement-index",routePath:"/movement",title:t,icon:"movement",description:a,category:"Movement",tags:s,inputs:[],params:[],output:o,tools:[],NodeView:ge({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:n})}const ig=xr("surface:movement-index:summary","Movement summary","Tracking mode, daily totals, and passive capture posture.",["movement","summary"],e=>de(e,null,"Movement summary is available."),[U({label:"Movement summary",description:"Summary of tracking mode, daily totals, and passive capture posture."})]),og=xr("surface:movement-index:selection","Movement selection aggregate","Selected-stay and selected-trip aggregate totals.",["movement","selection","aggregate"],e=>de(e,null,"Selected stay and trip aggregate totals."),[U({label:"Selection summary",description:"Summary of selected-stay and selected-trip aggregates."})]),lg=xr("surface:movement-index:timeline","Movement life timeline","Life-scale stay and trip timeline with edit access.",["movement","timeline","life"],e=>de(e,null,"Movement life timeline with stay and trip history."),[U({label:"Timeline summary",description:"Summary of the movement life timeline and trip history."})]),cg=xr("surface:movement-index:places","Known places","Known places, aliases, and category tags.",["movement","places"],e=>gh(e),[U({label:"Places summary",description:"Summary of known places, aliases, and category tags."}),Go({key:"places",label:"Known places",description:"Structured list of places known to Forge movement tracking.",modelName:"ForgeMovementPlaces",itemKind:"movement_place"})]),dg=xr("surface:movement-index:data-browser","Movement data browser","Datapoint browsing, invalid records, and movement data cleanup.",["movement","data","browser"],e=>de(e,null,"Movement datapoint browser with cleanup actions."),[U({label:"Data browser summary",description:"Summary of movement datapoint browsing and cleanup."})]);function ks({children:e}){return r.jsx(r.Fragment,{children:e})}const $r=$e({itemKind:"note",itemLabel:"Note",defaultEntityTypes:["note"],defaultLimit:20}),Mr=Me(),ug=ke(ks,{id:"surface:notes-index:filters",surfaceId:"notes-index",routePath:"/notes",title:"Note filters",icon:"filter",description:"Entity, tag, text, author, and date filters for notes.",category:"Notes",tags:["notes","filters","search"],inputs:$r,params:Mr,output:[U({label:"Filter summary",description:"Summary of the current note filters and search scope."})],tools:[Pe("Search Forge entities by query and entity types.")],NodeView:ge({title:"Note filters",description:"Entity, tag, text, author, and date filters for notes.",inputs:$r,params:Mr,output:[U({label:"Filter summary",description:"Summary of the current note filters and search scope."})],tools:[Pe("Search Forge entities by query and entity types.")]}),execute:e=>Re(e,{query:"",entityTypes:["note"],limit:20})}),mg=ke(ks,{id:"surface:notes-index:composer",surfaceId:"notes-index",routePath:"/notes",title:"Note composer",icon:"write",description:"Markdown note composer with links, tags, and capture actions.",category:"Notes",tags:["notes","composer","capture"],inputs:$r,params:Mr,output:[U({label:"Draft summary",description:"Summary of the current note drafting surface."})],tools:[Or("Create an evidence note from markdown content.")],NodeView:ge({title:"Note composer",description:"Markdown note composer with links, tags, and capture actions.",inputs:$r,params:Mr,output:[U({label:"Draft summary",description:"Summary of the current note drafting surface."})],tools:[Or("Create an evidence note from markdown content.")]}),execute:e=>de(e,{draftable:!0},"This node can draft or create a note.")}),pg=ke(ks,{id:"surface:notes-index:library",surfaceId:"notes-index",routePath:"/notes",title:"Notes library",icon:"library",description:"Filtered library of Forge notes and linked evidence.",category:"Notes",tags:["notes","library","history"],inputs:[],params:[],output:Ee({itemKind:"note",itemLabel:"Note"}),tools:[],NodeView:ge({title:"Notes library",description:"Filtered library of Forge notes and linked evidence.",inputs:[],params:[],output:Ee({itemKind:"note",itemLabel:"Note"}),tools:[]}),execute:e=>Re(e,{query:"",entityTypes:["note"],limit:20})});function hg({children:e}){return r.jsx(r.Fragment,{children:e})}function js(e,t,a,s,n,o){return ke(hg,{id:e,surfaceId:"overview",routePath:"/overview",title:t,icon:"overview",description:a,category:"Overview",tags:s,inputs:[],params:[],output:o,tools:[],NodeView:ge({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:n})}const gg=js("surface:overview:snapshot","Forge snapshot","Live overview of goals, projects, tasks, habits, and current operating pressure.",["overview","snapshot"],e=>fh(e),[U({label:"Overview summary",description:"Compact summary of goals, projects, tasks, and habits."}),Ne({key:"context",label:"Overview context",description:"Structured Forge overview context for the current operating picture.",modelName:"ForgeOverviewContext"})]),fg=js("surface:overview:momentum","Momentum and health","Momentum-focused summary of streaks, neglected areas, and active execution pressure.",["overview","momentum"],e=>de(e,{dimensions:["momentum","neglected_goals","domain_balance"]},"Overview momentum surface tracking neglected goals, domain balance, and execution pressure."),[U({label:"Momentum summary",description:"Summary of momentum, neglected goals, and execution pressure."})]),yg=js("surface:overview:insights","Overview insights","Insight-oriented summary of the current Forge operating picture.",["overview","insights"],e=>Ho(e),[U({label:"Insight summary",description:"Compact explanation of the current insight payload."}),Ne({key:"insights",label:"Insight payload",description:"Structured insight and coaching payload returned by Forge.",modelName:"ForgeInsightsPayload"})]);function xg({children:e}){return r.jsx(r.Fragment,{children:e})}function Ss(e,t,a,s,n,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke(xg,{id:e,surfaceId:"projects",routePath:"/projects",title:t,icon:"projects",description:a,category:"Projects",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const vg=Ss("surface:projects:hero","Projects hero","Projects page header.",["projects","hero"],e=>de(e,null,"Projects page header."),[U({label:"Projects summary",description:"High-level projects page framing."})]),bg=Ss("surface:projects:search-results","Search and results","Project browser, filters, and search context.",["projects","search"],e=>Re(e,{query:"",entityTypes:["project"],limit:20}),Ee({itemKind:"project",itemLabel:"Project"}),[Pe("Search project entities by query and entity types.")],{inputs:$e({itemKind:"project",itemLabel:"Project",defaultEntityTypes:["project"],defaultLimit:20}),params:Me()}),wg=Ss("surface:projects:summary","Collection summary","Collection summary and project state metrics.",["projects","summary"],e=>de(e,null,"Project collection summary."),[U({label:"Project summary",description:"Summary of the project collection and current state."})]);function kg({children:e}){return r.jsx(r.Fragment,{children:e})}function Ns(e,t,a,s,n,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke(kg,{id:e,surfaceId:"preferences",routePath:"/preferences",title:t,icon:"preferences",description:a,category:"Preferences",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const jg=Ns("surface:preferences:workspace","Preferences workspace","Main preference modeling workspace, including summaries, tradeoffs, and evidence.",["preferences","workspace"],e=>de(e,{surfaces:["summary","comparison_game","evidence"]},"Preferences workspace with summary, pairwise comparison, and evidence views."),[U({label:"Preference summary",description:"Summary of the active preference modeling workspace."})]),Sg=Ns("surface:preferences:contexts","Preference contexts","Preference contexts that shape which tradeoffs and evidence are active.",["preferences","contexts"],e=>Re(e,{query:"",entityTypes:["preference_context"],limit:20}),Ee({itemKind:"preference_context",itemLabel:"Preference context"}),[Pe("Search preference contexts and modeled preference items.")],{inputs:$e({itemKind:"preference_context",itemLabel:"Preference context",defaultEntityTypes:["preference_context"],defaultLimit:20}),params:Me()}),Ng=Ns("surface:preferences:items","Preference items","Preference items scored and compared inside the active context.",["preferences","items"],e=>Re(e,{query:"",entityTypes:["preference_item"],limit:20}),Ee({itemKind:"preference_item",itemLabel:"Preference item"}),[Pe("Search preference contexts and modeled preference items.")],{inputs:$e({itemKind:"preference_item",itemLabel:"Preference item",defaultEntityTypes:["preference_item"],defaultLimit:20}),params:Me()});function Pg({children:e}){return r.jsx(r.Fragment,{children:e})}function Ps(e,t,a,s,n,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke(Pg,{id:e,surfaceId:"psyche",routePath:"/psyche",title:t,icon:"psyche",description:a,category:"Psyche",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const Tg=Ps("surface:psyche:overview","Psyche overview","High-level overview of values, patterns, beliefs, modes, and reports.",["psyche","overview"],e=>de(e,{surfaces:["values","patterns","beliefs","modes","reports"]},"Psyche overview spanning values, patterns, beliefs, modes, and reports."),[U({label:"Psyche summary",description:"Summary of values, patterns, beliefs, modes, and reports."})]),Ig=Ps("surface:psyche:values","Psyche values","Values and long-lived internal directions tracked inside Forge.",["psyche","values"],e=>Re(e,{query:"",entityTypes:["psyche_value"],limit:20}),Ee({itemKind:"psyche_value",itemLabel:"Psyche value"}),[Pe("Search psyche entities and reflective records.")],{inputs:$e({itemKind:"psyche_value",itemLabel:"Psyche value",defaultEntityTypes:["psyche_value"],defaultLimit:20}),params:Me()}),Cg=Ps("surface:psyche:reports","Trigger reports","Trigger reports and behavior-pattern signals linked to reflective work.",["psyche","reports","patterns"],e=>Re(e,{query:"",entityTypes:["trigger_report","behavior_pattern","belief_entry","mode_profile"],limit:20}),Ee({itemKind:"psyche_record",itemLabel:"Psyche record"}),[Pe("Search psyche entities and reflective records.")],{inputs:$e({itemKind:"psyche_record",itemLabel:"Psyche record",defaultEntityTypes:["trigger_report","behavior_pattern","belief_entry","mode_profile"],defaultLimit:20}),params:Me()});function Rg({children:e}){return r.jsx(r.Fragment,{children:e})}function Ts(e,t,a,s,n,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke(Rg,{id:e,surfaceId:"questionnaires",routePath:"/psyche/questionnaires",title:t,icon:"questionnaire",description:a,category:"Questionnaires",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const _g=Ts("surface:questionnaires:library","Questionnaire library","Library of questionnaire instruments available in Forge.",["questionnaires","library"],e=>Re(e,{query:"",entityTypes:["questionnaire_instrument"],limit:20}),Ee({itemKind:"questionnaire_instrument",itemLabel:"Questionnaire"}),[Pe("Search questionnaire instruments and related records.")],{inputs:$e({itemKind:"questionnaire_instrument",itemLabel:"Questionnaire",defaultEntityTypes:["questionnaire_instrument"],defaultLimit:20}),params:Me()}),Eg=Ts("surface:questionnaires:drafting","Questionnaire drafting","Drafting and publishing context for questionnaire instruments.",["questionnaires","drafting","authoring"],e=>de(e,{states:["draft","published","run"]},"Questionnaire drafting surface with draft, publish, and run lifecycle context."),[U({label:"Drafting summary",description:"Summary of questionnaire drafting and lifecycle context."})]),Ag=Ts("surface:questionnaires:self-observation","Self-observation calendar","Calendar of self-observation notes and linked psyche context.",["questionnaires","self-observation","psyche"],e=>de(e,{linkedDomains:["patterns","reports","notes"]},"Self-observation calendar surface with linked psyche context."),[U({label:"Observation summary",description:"Summary of the self-observation calendar and linked psyche context."})]);function Lg({children:e}){return r.jsx(r.Fragment,{children:e})}function Jo(e,t,a,s,n,o){return ke(Lg,{id:e,surfaceId:"review",routePath:"/review/weekly",title:t,icon:"review",description:a,category:"Review",tags:s,inputs:[],params:[],output:o,tools:[],NodeView:ge({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:n})}const Og=Jo("surface:review:weekly-summary","Weekly review summary","Weekly review payload with momentum, wins, calibration, and completion state.",["review","weekly"],e=>yh(e),[U({label:"Weekly review summary",description:"Summary of momentum, wins, calibration, and review completion state."}),Ne({key:"weeklyReview",label:"Weekly review payload",description:"Structured weekly review payload returned by Forge.",modelName:"ForgeWeeklyReview"})]),Dg=Jo("surface:review:reward","Review reward","Reward framing and completion incentive for closing the current review cycle.",["review","reward"],e=>de(e,{reward:"weekly_review_completion"},"Weekly review reward surface for locking the current cycle into evidence."),[U({label:"Review reward summary",description:"Summary of the reward framing for closing the current review cycle."})]);function $g({children:e}){return r.jsx(r.Fragment,{children:e})}function Is(e,t,a,s,n,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke($g,{id:e,surfaceId:"strategies",routePath:"/strategies",title:t,icon:"strategy",description:a,category:"Strategies",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const Mg=Is("surface:strategies:hero","Strategies hero","Strategies page header and sequencing context.",["strategies","hero"],e=>de(e,null,"Strategies page header."),[U({label:"Strategies summary",description:"High-level strategies page framing."})]),Fg=Is("surface:strategies:search-results","Strategies list and results","Strategy browser and structured operating context.",["strategies","search"],e=>Re(e,{query:"",entityTypes:["strategy"],limit:20}),Ee({itemKind:"strategy",itemLabel:"Strategy"}),[Pe("Search strategy entities by query and entity types.")],{inputs:$e({itemKind:"strategy",itemLabel:"Strategy",defaultEntityTypes:["strategy"],defaultLimit:20}),params:Me()}),zg=Is("surface:strategies:summary","Strategies summary","Strategy collection summary and state context.",["strategies","summary"],e=>de(e,null,"Strategy collection summary."),[U({label:"Strategy summary",description:"Summary of strategy state and collection context."})]);function Wg({children:e}){return r.jsx(r.Fragment,{children:e})}function Cs(e,t,a,s,n,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke(Wg,{id:e,surfaceId:"tasks",routePath:"/today",title:t,icon:"task",description:a,category:"Tasks",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const qg=Cs("surface:tasks:inbox","Task queue","Searchable task queue spanning backlog, focus, and in-progress work.",["tasks","queue","search"],e=>Re(e,{query:"",entityTypes:["task"],limit:20}),Ee({itemKind:"task",itemLabel:"Task"}),[Pe("Search task entities by title, status, or linked context."),Dr("Move a task between backlog, focus, in progress, blocked, and done.")],{inputs:$e({itemKind:"task",itemLabel:"Task",defaultEntityTypes:["task"],defaultLimit:20}),params:Me()}),Bg=Cs("surface:tasks:focus-lane","Focus lane","Focused task lane for what should happen next right now.",["tasks","focus","execution"],e=>de(e,{hint:"Use this surface to represent active or next-up work."},"Focus lane context for the current execution board."),[U({label:"Focus summary",description:"Human-readable explanation of what the focus lane represents."})],[Dr("Change task state as the flow decides what should happen next.")]),Kg=Cs("surface:tasks:summary","Task summary","High-level summary of the current task system and work state.",["tasks","summary"],e=>de(e,{states:["backlog","focus","in_progress","blocked","done"]},"Task system summary with the key task states Forge tracks."),[U({label:"Task summary",description:"High-level summary of the current task system and work state."})]);function Hg({children:e}){return r.jsx(r.Fragment,{children:e})}function vr(e,t,a,s,n,o,i=[],l){const u=(l==null?void 0:l.inputs)??[],p=(l==null?void 0:l.params)??[];return ke(Hg,{id:e,surfaceId:"today",routePath:"/today",title:t,icon:"today",description:a,category:"Today",tags:s,inputs:u,params:p,output:o,tools:i,NodeView:ge({title:t,description:a,inputs:u,params:p,output:o,tools:i}),execute:n})}const Ug=vr("surface:today:hero","Today hero","Daily execution header and directive.",["today","hero"],e=>de(e,null,"Daily execution header."),[U({label:"Today summary",description:"High-level framing for today's execution."})]),Gg=vr("surface:today:metrics","Live metrics","Daily XP, level, and momentum metrics.",["today","metrics"],e=>de(e,null,"Daily metrics."),[U({label:"Metrics summary",description:"Summary of today's XP, level, and momentum metrics."})]),Vg=vr("surface:today:runway","Runway","Execution lane and current work.",["today","execution"],e=>Re(e,{query:"",entityTypes:["task","habit"],limit:16}),Ee({itemKind:"execution_item",itemLabel:"Execution item"}),[Pe("Search today's active tasks and habits by query and entity types.")],{inputs:$e({itemKind:"execution_item",itemLabel:"Execution item",defaultEntityTypes:["task","habit"],defaultLimit:16}),params:Me()}),Jg=vr("surface:today:calendar","Calendar","Calendar context for today.",["today","calendar"],e=>de(e,null,"Today's calendar context."),[U({label:"Calendar summary",description:"Summary of today's calendar context."})]),Xg=vr("surface:today:focus","Current focus","Today priorities and focus context.",["today","focus"],e=>Re(e,{query:"",entityTypes:["task","habit"],limit:16}),Ee({itemKind:"focus_item",itemLabel:"Focus item"}),[Pe("Search today's priority tasks and habits by query and entity types.")],{inputs:$e({itemKind:"focus_item",itemLabel:"Focus item",defaultEntityTypes:["task","habit"],defaultLimit:16}),params:Me()});function Qg({children:e}){return r.jsx(r.Fragment,{children:e})}function Rs(e,t,a,s,n,o){return ke(Qg,{id:e,surfaceId:"wiki",routePath:"/wiki",title:t,icon:"wiki",description:a,category:"Wiki",tags:s,inputs:[],params:[],output:o,tools:[],NodeView:ge({title:t,description:a,inputs:[],params:[],output:o,tools:[]}),execute:n})}const Yg=Rs("surface:wiki:pages","Wiki pages","Live list of wiki pages that can be used as memory or authored knowledge.",["wiki","pages"],e=>xh(e),[U({label:"Wiki page summary",description:"Summary of the currently available wiki pages."}),Go({key:"pages",label:"Wiki pages",description:"Structured wiki page records available in Forge memory.",modelName:"ForgeWikiPages",itemKind:"wiki_page"})]),Zg=Rs("surface:wiki:health","Wiki health","Index health, unresolved links, and orphaned-page signals for the wiki.",["wiki","health"],e=>vh(e),[U({label:"Wiki health summary",description:"Summary of unresolved links and orphaned-page signals."}),Ne({key:"health",label:"Wiki health",description:"Structured wiki health payload returned by Forge.",modelName:"ForgeWikiHealth"})]),ef=Rs("surface:wiki:authoring","Wiki authoring","Authoring and ingest surface for creating or refining Forge memory.",["wiki","authoring","ingest"],e=>de(e,{actions:["upsert","ingest","reindex"]},"Wiki authoring surface for ingesting sources and maintaining memory pages."),[U({label:"Wiki authoring summary",description:"Summary of wiki authoring and ingest actions available on this surface."})]),tf=[ps,hs,gs,fs,ys,Wh,qh,Bh,Hh,Uh,Gh,Jh,Xh,Qh,Oh,Dh,$h,Mh,Fh,ug,mg,pg,gg,fg,yg,ig,og,lg,cg,dg,Zh,eg,tg,rg,ag,sg,vg,bg,wg,jg,Sg,Ng,Tg,Ig,Cg,_g,Eg,Ag,Og,Dg,Mg,Fg,zg,qg,Bg,Kg,Ug,Gg,Vg,Jg,Xg,Yg,Zg,ef],Xo=new Map(tf.filter(e=>e.workbench).map(e=>[e.workbench.id,e.workbench]));function _s(){return Array.from(Xo.values())}function Qo(e){return Xo.get(e)??null}function Yo(){return _s().map(e=>({id:e.id,boxId:e.id,surfaceId:e.surfaceId,routePath:e.routePath,title:e.title,label:e.title,icon:e.icon??null,description:e.description,category:e.category,tags:e.tags,capabilityModes:["content",...e.tools.length>0?["tool"]:[]],inputs:jr(e.inputs),params:jr(e.params),output:jr(e.output),tools:e.tools,outputs:jr(e.output),toolAdapters:e.tools,snapshotResolverKey:void 0}))}const Zo=c.createContext(null),rf={definitions:_s(),catalog:Yo(),getDefinition:Qo};function af({children:e}){const t=c.useMemo(()=>({definitions:_s(),catalog:Yo(),getDefinition:Qo}),[]);return r.jsx(Zo.Provider,{value:t,children:e})}function el(){return c.useContext(Zo)??rf}function Jk(){return el().catalog}function Xk(e){const t=el();return e?t.getDefinition(e):null}function Qk({children:e}){return r.jsx(r.Fragment,{children:e})}const sf="modulepreload",nf=function(e){return"/forge/"+e},ki={},B=function(t,a,s){let n=Promise.resolve();if(a&&a.length>0){let i=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=i(a.map(p=>{if(p=nf(p),p in ki)return;ki[p]=!0;const m=p.endsWith(".css"),g=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const f=document.createElement("link");if(f.rel=m?"stylesheet":sf,m||(f.as="script"),f.crossOrigin="",f.href=p,u&&f.setAttribute("nonce",u),document.head.appendChild(f),m)return new Promise((v,y)=>{f.addEventListener("load",v),f.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return n.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},of=c.lazy(()=>B(()=>import("./activity-page-CgF7K2ww.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.ActivityPage}))),lf=c.lazy(()=>B(()=>import("./calendar-page-C1Wfd2Fy.js"),__vite__mapDeps([13,1,2,3,14,15,16,17,4,18,19,7,8,9,10,11,12])).then(e=>({default:e.CalendarPage})));c.lazy(()=>B(()=>import("./companion-sync-lab-page-NgeK-O-P.js"),__vite__mapDeps([20,1,2,4,3,7,8,9,10,11,12])).then(e=>({default:e.CompanionSyncLabPage})));const cf=c.lazy(()=>B(()=>import("./goal-detail-page-JK_Nva8e.js"),__vite__mapDeps([21,1,2,3,22,23,24,25,26,27,4,28,6,7,8,9,10,11,12])).then(e=>({default:e.GoalDetailPage}))),df=c.lazy(()=>B(()=>import("./goals-page-yeoJ06Vw.js"),__vite__mapDeps([29,1,2,4,30,31,27,3,7,8,9,10,11,12])).then(e=>({default:e.GoalsPage}))),uf=c.lazy(()=>B(()=>import("./habits-page-Dx5EhkJi.js"),__vite__mapDeps([32,1,2,8,3,30,23,33,4,34,35,7,9,10,11,12])).then(e=>({default:e.HabitsPage}))),mf=c.lazy(()=>B(()=>import("./insights-page-CujrosD_.js"),__vite__mapDeps([36,1,2,3,37,4,38,7,8,9,10,11,12])).then(e=>({default:e.InsightsPage}))),pf=c.lazy(()=>B(()=>import("./kanban-page-Q9NuIz5w.js"),__vite__mapDeps([39,1,2,3,40,10,30,18,41,4,7,8,9,11,12])).then(e=>({default:e.KanbanPage}))),hf=c.lazy(()=>B(()=>import("./knowledge-graph-page-DaJmlvvM.js"),__vite__mapDeps([42,1,2,8,3,11,12,43,7,9,10])).then(e=>({default:e.KnowledgeGraphPage}))),gf=c.lazy(()=>B(()=>import("./life-force-page-BGDkKfbJ.js"),__vite__mapDeps([44,1,2,45,3,18,38,4,7,8,9,10,11,12])).then(e=>({default:e.LifeForcePage}))),ff=c.lazy(()=>B(()=>import("./movement-page-ClaoTNuX.js"),__vite__mapDeps([46,1,2,3,43,4,8,7,47,38,9,10,11,12])).then(e=>({default:e.MovementPage}))),yf=c.lazy(()=>B(()=>import("./notes-page-DYI8s3NN.js"),__vite__mapDeps([48,1,2,3,23,25,4,18,7,8,9,10,11,12])).then(e=>({default:e.NotesPage}))),xf=c.lazy(()=>B(()=>import("./overview-page-BwMlFQKX.js"),__vite__mapDeps([49,1,2,50,10,3,51,7,45,18,38,30,4,28,8,9,11,12])).then(e=>({default:e.OverviewPage}))),vf=c.lazy(()=>B(()=>import("./project-detail-page-DogvVNEn.js"),__vite__mapDeps([52,1,2,3,17,22,41,53,40,10,30,18,23,24,25,26,4,28,6,7,8,9,11,12])).then(e=>({default:e.ProjectDetailPage}))),bf=c.lazy(()=>B(()=>import("./project-management-hierarchy-page-Dr7hW9PW.js"),__vite__mapDeps([54,1,2,3,41,4,7,8,9,10,11,12])).then(e=>({default:e.ProjectManagementHierarchyPage}))),wf=c.lazy(()=>B(()=>import("./projects-page-UKrby_5-.js"),__vite__mapDeps([55,1,2,50,10,3,31,4,30,27,41,7,8,9,11,12])).then(e=>({default:e.ProjectsPage}))),kf=c.lazy(()=>B(()=>import("./settings-wiki-page-Cvsiz5_e.js"),__vite__mapDeps([56,1,2,3,57,4,7,8,9,10,11,12])).then(e=>({default:e.SettingsWikiPage}))),jf=c.lazy(()=>B(()=>import("./strategies-page-DEnPlpAs.js"),__vite__mapDeps([58,1,2,3,59,10,4,7,8,9,11,12])).then(e=>({default:e.StrategiesPage}))),Sf=c.lazy(()=>B(()=>import("./strategy-detail-page-Ls8bxKeH.js"),__vite__mapDeps([60,1,2,3,22,26,59,10,11,12,4,7,8,9])).then(e=>({default:e.StrategyDetailPage}))),Nf=c.lazy(()=>B(()=>import("./preferences-page-BrKEkmfD.js"),__vite__mapDeps([61,1,2,3,4,8,7,9,10,11,12])).then(e=>({default:e.PreferencesPage}))),Pf=c.lazy(()=>B(()=>import("./psyche-page-NQBHkkpU.js"),__vite__mapDeps([62,1,2,3,50,10,63,4,7,8,9,11,12])).then(e=>({default:e.PsychePage}))),Tf=c.lazy(()=>B(()=>import("./psyche-behaviors-page-BeVlXvbj.js"),__vite__mapDeps([64,1,2,3,30,65,66,67,33,4,68,69,9,7,8,10,11,12])).then(e=>({default:e.PsycheBehaviorsPage}))),If=c.lazy(()=>B(()=>import("./psyche-flashcards-page-CqAWCO4E.js"),__vite__mapDeps([70,1,2,3,33,4,69,9,7,8,10,11,12])).then(e=>({default:e.PsycheFlashcardsPage}))),Cf=c.lazy(()=>B(()=>import("./psyche-goal-map-page-IyNnbk_W.js"),__vite__mapDeps([71,1,2,3,63,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheGoalMapPage}))),Rf=c.lazy(()=>B(()=>import("./psyche-metrics-page-uai0a7Lx.js"),__vite__mapDeps([72,1,2,3,4,73,8,38,7,9,10,11,12])).then(e=>({default:e.PsycheMetricsPage}))),_f=c.lazy(()=>B(()=>import("./psyche-mode-guide-page-C7p-ABiF.js"),__vite__mapDeps([74,1,2,3,9,4,69,7,8,10,11,12])).then(e=>({default:e.PsycheModeGuidePage}))),Ef=c.lazy(()=>B(()=>import("./psyche-modes-page-CLQ5V3w0.js"),__vite__mapDeps([75,1,2,3,30,65,33,4,68,69,9,7,8,10,11,12])).then(e=>({default:e.PsycheModesPage}))),Af=c.lazy(()=>B(()=>import("./psyche-patterns-page-BkRiNpI_.js"),__vite__mapDeps([76,1,2,3,30,65,77,7,66,67,33,4,68,69,9,8,10,11,12])).then(e=>({default:e.PsychePatternsPage}))),ji=c.lazy(()=>B(()=>import("./psyche-questionnaire-builder-page-Du-7HwPC.js"),__vite__mapDeps([78,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnaireBuilderPage}))),Lf=c.lazy(()=>B(()=>import("./psyche-questionnaire-detail-page-C5-yf8MF.js"),__vite__mapDeps([79,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnaireDetailPage}))),Of=c.lazy(()=>B(()=>import("./psyche-questionnaire-run-detail-page-CoSH5O6R.js"),__vite__mapDeps([80,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnaireRunDetailPage}))),Df=c.lazy(()=>B(()=>import("./psyche-questionnaire-run-page-ChI7c1wy.js"),__vite__mapDeps([81,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnaireRunPage}))),$f=c.lazy(()=>B(()=>import("./psyche-questionnaires-page-xUcJJzbI.js"),__vite__mapDeps([82,1,2,3,43,4,7,8,9,10,11,12])).then(e=>({default:e.PsycheQuestionnairesPage}))),Mf=c.lazy(()=>B(()=>import("./psyche-report-detail-page-BPrZCFZS.js"),__vite__mapDeps([83,1,2,3,7,37,22,24,23,25,84,4,69,9,67,8,10,11,12])).then(e=>({default:e.PsycheReportDetailPage}))),Ff=c.lazy(()=>B(()=>import("./psyche-reports-page-D2EXJmm6.js"),__vite__mapDeps([85,1,2,3,30,65,66,67,84,4,68,69,9,7,8,10,11,12])).then(e=>({default:e.PsycheReportsPage}))),zf=c.lazy(()=>B(()=>import("./psyche-self-observation-page-BdbCsgR5.js"),__vite__mapDeps([86,1,2,3,25,4,14,15,34,6,7,8,9,10,11,12])).then(e=>({default:e.PsycheSelfObservationPage}))),Wf=c.lazy(()=>B(()=>import("./psyche-screen-time-page-_3-4LikV.js"),__vite__mapDeps([87,1,2,3,4,38,7,8,9,10,11,12])).then(e=>({default:e.PsycheScreenTimePage}))),qf=c.lazy(()=>B(()=>import("./psyche-schemas-beliefs-page-h0ooZ1lp.js"),__vite__mapDeps([88,1,2,3,66,67,30,65,33,4,68,69,9,7,8,10,11,12])).then(e=>({default:e.PsycheSchemasBeliefsPage}))),Bf=c.lazy(()=>B(()=>import("./psyche-values-page-DuUVki5e.js"),__vite__mapDeps([89,1,2,3,30,65,77,7,33,4,69,9,8,10,11,12])).then(e=>({default:e.PsycheValuesPage}))),Kf=c.lazy(()=>B(()=>import("./settings-page-B4u5TR5g.js"),__vite__mapDeps([90,1,2,3,9,57,4,7,8,10,11,12])).then(e=>({default:e.SettingsPage}))),Hf=c.lazy(()=>B(()=>import("./settings-data-page-CBubzKBw.js"),__vite__mapDeps([91,1,2,3,57,4,92,7,8,9,10,11,12])).then(e=>({default:e.SettingsDataPage}))),Uf=c.lazy(()=>B(()=>import("./settings-agents-page-DPx2F6wf.js"),__vite__mapDeps([93,1,2,3,8,7,57,4,92,9,10,11,12])).then(e=>({default:e.SettingsAgentsPage}))),Gf=c.lazy(()=>B(()=>import("./settings-bin-page-COwP3gjo.js"),__vite__mapDeps([94,1,2,3,57,4,7,8,9,10,11,12])).then(e=>({default:e.SettingsBinPage}))),Vf=c.lazy(()=>B(()=>import("./settings-calendar-page-C-ghE0YT.js"),__vite__mapDeps([95,1,2,3,57,4,19,7,8,9,10,11,12])).then(e=>({default:e.SettingsCalendarPage}))),Jf=c.lazy(()=>B(()=>import("./settings-mobile-page-C5rfj8_r.js"),__vite__mapDeps([96,1,2,3,57,4,7,8,9,10,11,12])).then(e=>({default:e.SettingsMobilePage}))),Xf=c.lazy(()=>B(()=>import("./settings-models-page-DijmUWdU.js"),__vite__mapDeps([97,1,2,3,57,4,7,8,9,10,11,12])).then(e=>({default:e.SettingsModelsPage}))),Qf=c.lazy(()=>B(()=>import("./settings-logs-page-uOuXMeBm.js"),__vite__mapDeps([98,1,2,3,4,57,7,8,9,10,11,12])).then(e=>({default:e.SettingsLogsPage}))),Yf=c.lazy(()=>B(()=>import("./settings-rewards-page-COiTwkMH.js"),__vite__mapDeps([99,1,2,3,9,57,7,4,92,8,10,11,12])).then(e=>({default:e.SettingsRewardsPage}))),Zf=c.lazy(()=>B(()=>import("./settings-users-page-DEGa5DNn.js"),__vite__mapDeps([100,1,2,3,57,4,11,12,7,8,9,10])).then(e=>({default:e.SettingsUsersPage}))),ey=c.lazy(()=>B(()=>import("./rewards-page-PZFPa6rR.js"),__vite__mapDeps([101,1,2,3,4,7,8,9,10,11,12])).then(e=>({default:e.RewardsPage}))),ty=c.lazy(()=>B(()=>import("./sleep-page-BnSOwkEU.js"),__vite__mapDeps([102,1,2,3,4,103,7,8,9,10,11,12])).then(e=>({default:e.SleepPage}))),ry=c.lazy(()=>B(()=>import("./sports-page-l1RqXzA_.js"),__vite__mapDeps([104,1,2,3,43,4,35,103,38,7,8,9,10,11,12])).then(e=>({default:e.SportsPage}))),ay=c.lazy(()=>B(()=>import("./training-load-page-BIwc648i.js"),__vite__mapDeps([105,1,2,3,38,4,7,8,9,10,11,12])).then(e=>({default:e.TrainingLoadPage}))),sy=c.lazy(()=>B(()=>import("./workout-detail-page-DD9IGN6l.js"),__vite__mapDeps([106,1,2,3,107,108,4,38,7,8,9,10,11,12])).then(e=>({default:e.WorkoutDetailPage}))),ny=c.lazy(()=>B(()=>import("./task-detail-page-CgrYgQLD.js"),__vite__mapDeps([109,1,2,3,16,17,15,22,23,24,25,26,53,4,28,6,7,8,9,10,11,12])).then(e=>({default:e.TaskDetailPage}))),iy=c.lazy(()=>B(()=>import("./today-page-CIuFHMi1.js"),__vite__mapDeps([110,1,2,3,50,10,30,47,45,18,38,4,7,8,9,11,12])).then(e=>({default:e.TodayPage}))),oy=c.lazy(()=>B(()=>import("./vitals-page-Dz1Jt5H8.js"),__vite__mapDeps([111,1,2,3,4,73,8,38,7,9,10,11,12])).then(e=>({default:e.VitalsPage}))),ly=c.lazy(()=>B(()=>import("./weight-loss-page-BgMoBpBt.js"),__vite__mapDeps([112,1,2,3,4,47,7,8,9,10,11,12])).then(e=>({default:e.WeightLossPage}))),Si=c.lazy(()=>B(()=>import("./wiki-page-CMTZ60Zt.js"),__vite__mapDeps([113,1,2,8,3,22,114,115,7,9,10,11,12])).then(e=>({default:e.WikiPage}))),cy=c.lazy(()=>B(()=>import("./wiki-ingest-history-page-C-ig8O22.js"),__vite__mapDeps([116,1,2,3,115,8,4,7,9,10,11,12])).then(e=>({default:e.WikiIngestHistoryPage}))),Ni=c.lazy(()=>B(()=>import("./wiki-editor-page-BpAZHooY.js"),__vite__mapDeps([117,1,2,8,3,114,7,9,10,11,12])).then(e=>({default:e.WikiEditorPage}))),dy=c.lazy(()=>B(()=>import("./weekly-review-page-BFpBe1kI.js"),__vite__mapDeps([118,1,2,3,51,7,4,38,8,9,10,11,12])).then(e=>({default:e.WeeklyReviewPage}))),uy=c.lazy(()=>B(()=>import("./workbench-page-CtCjYSRe.js"),__vite__mapDeps([119,1,2,3,43,4,7,8,9,10,11,12])).then(e=>({default:e.WorkbenchPage}))),my=c.lazy(()=>B(()=>import("./workbench-flow-page-BIpWUcLJ.js"),__vite__mapDeps([120,1,2,22,4,11,3,12,8,43,7,9,10])).then(e=>({default:e.WorkbenchFlowPage})));function py(){const e=Bt();return c.useEffect(()=>{const t=`${e.pathname}${e.search}${e.hash}`,a=Qi({scope:"frontend_runtime",route:t}),s=o=>{a({level:"error",eventKey:"window_error",message:o.message||"Unhandled browser error",functionName:"window.onerror",details:{fileName:o.filename||null,line:o.lineno||null,column:o.colno||null,error:o.error??null}})},n=o=>{a({level:"error",eventKey:"unhandled_rejection",message:"Unhandled promise rejection",functionName:"window.onunhandledrejection",details:{reason:o.reason??null}})};return window.addEventListener("error",s),window.addEventListener("unhandledrejection",n),()=>{window.removeEventListener("error",s),window.removeEventListener("unhandledrejection",n)}},[e.hash,e.pathname,e.search]),c.useEffect(()=>{const t=`${e.pathname}${e.search}${e.hash}`;Ur({level:"info",scope:"frontend_navigation",eventKey:"route_view",message:`Viewed route ${e.pathname}`,route:t,functionName:"DiagnosticsBootstrap.routeView",details:{pathname:e.pathname,search:e.search||null,hash:e.hash||null}})},[e.hash,e.pathname,e.search]),null}function hy(){function e(t,a,s,n){return r.jsx(sh,{viewId:t,children:n})}return r.jsxs(af,{children:[r.jsx(py,{}),r.jsxs(Kl,{children:[r.jsxs(W,{element:r.jsx(oh,{}),children:[r.jsx(W,{index:!0,element:r.jsx(Yr,{to:"/overview",replace:!0})}),r.jsx(W,{path:"overview",element:e("overview","Overview","Daily signal, momentum, and current Forge state.",r.jsx(xf,{}))}),r.jsx(W,{path:"life-force",element:e("life-force-index","Life Force","Action Point capacity, weekday curves, and dynamic drains.",r.jsx(gf,{}))}),r.jsx(W,{path:"goals",element:e("goals-index","Goals","Goal planning and long-horizon direction.",r.jsx(df,{}))}),r.jsx(W,{path:"habits",element:e("habits-index","Habits","Recurring commitments, streaks, and check-ins.",r.jsx(uf,{}))}),r.jsx(W,{path:"goals/:goalId",element:e("goal-detail","Goal detail","Goal detail, progress, and linked execution context.",r.jsx(cf,{}))}),r.jsx(W,{path:"projects",element:e("projects-index","Projects","PRD-backed projects and execution initiatives.",r.jsx(wf,{}))}),r.jsx(W,{path:"projects/hierarchy",element:e("project-hierarchy","Project hierarchy","Full hierarchy from goals down to subtasks.",r.jsx(bf,{}))}),r.jsx(W,{path:"projects/:projectId",element:e("project-detail","Project detail","Project detail, tasks, and execution health.",r.jsx(vf,{}))}),r.jsx(W,{path:"strategies",element:e("strategies-index","Strategies","Strategy graphs and long-range execution plans.",r.jsx(jf,{}))}),r.jsx(W,{path:"strategies/:strategyId",element:e("strategy-detail","Strategy detail","Strategy DAG detail, targets, and progress.",r.jsx(Sf,{}))}),r.jsx(W,{path:"preferences",element:e("preferences-index","Preferences","Preference profiles, pairwise judgments, and model state.",r.jsx(Nf,{}))}),r.jsx(W,{path:"campaigns",element:r.jsx(Yr,{to:"/projects",replace:!0})}),r.jsx(W,{path:"calendar",element:e("calendar-index","Calendar","Calendar planning, timeboxes, and provider sync.",r.jsx(lf,{}))}),r.jsx(W,{path:"knowledge-graph",element:e("knowledge-graph-index","Knowledge Graph","One connected map of Forge entities and explicit relationships.",r.jsx(hf,{}))}),r.jsx(W,{path:"movement",element:e("movement-index","Movement","Movement traces, places, and trip evidence.",r.jsx(ff,{}))}),r.jsx(W,{path:"sleep",element:e("sleep-index","Sleep","Sleep sessions, health context, and recovery trends.",r.jsx(ty,{}))}),r.jsx(W,{path:"sports",element:e("sports-index","Sports","Fitness, workouts, and sports context.",r.jsx(ry,{}))}),r.jsx(W,{path:"sports/workouts/:workoutId",element:e("sports-workout-detail","Workout Detail","Raw workout evidence, heart-rate zones, and session context.",r.jsx(sy,{}))}),r.jsx(W,{path:"training-load",element:e("training-load-index","Training Load","Cardiovascular load, intensity distribution, and training targets.",r.jsx(ay,{}))}),r.jsx(W,{path:"vitals",element:e("vitals-index","Vitals","Body signals, recovery, cardio fitness, and daily HealthKit metrics.",r.jsx(oy,{}))}),r.jsx(W,{path:"weight-loss",element:e("weight-loss-index","Weight Loss","Nutrition, body composition, food effects, gut signals, and aesthetic experiments.",r.jsx(ly,{}))}),r.jsx(W,{path:"psyche",element:e("psyche-index","Psyche","Values, modes, reports, and reflective context.",r.jsx(Pf,{}))}),r.jsx(W,{path:"psyche/metrics",element:e("psyche-metrics","Psyche metrics","Daily Psyche metric history with plots and summary statistics.",r.jsx(Rf,{}))}),r.jsx(W,{path:"psyche/flashcards",element:e("psyche-flashcards","Psyche flashcards","Therapeutic reminder cards for urges, triggers, and values-based pivots.",r.jsx(If,{}))}),r.jsx(W,{path:"psyche/values",element:e("psyche-values","Psyche values","Values and linked goal context.",r.jsx(Bf,{}))}),r.jsx(W,{path:"psyche/patterns",element:e("psyche-patterns","Psyche patterns","Behavior patterns and recurring loops.",r.jsx(Af,{}))}),r.jsx(W,{path:"psyche/questionnaires",element:e("psyche-questionnaires","Questionnaires","Questionnaire library and recent runs.",r.jsx($f,{}))}),r.jsx(W,{path:"psyche/questionnaires/new",element:e("psyche-questionnaire-new","New questionnaire","Questionnaire builder workspace.",r.jsx(ji,{}))}),r.jsx(W,{path:"psyche/questionnaires/:instrumentId",element:e("psyche-questionnaire-detail","Questionnaire detail","Questionnaire detail and scores.",r.jsx(Lf,{}))}),r.jsx(W,{path:"psyche/questionnaires/:instrumentId/edit",element:e("psyche-questionnaire-edit","Edit questionnaire","Questionnaire builder workspace.",r.jsx(ji,{}))}),r.jsx(W,{path:"psyche/questionnaires/:instrumentId/take",element:e("psyche-questionnaire-run","Take questionnaire","Questionnaire runner and answers.",r.jsx(Df,{}))}),r.jsx(W,{path:"psyche/questionnaire-runs/:runId",element:e("psyche-questionnaire-run-detail","Questionnaire run detail","Questionnaire result review.",r.jsx(Of,{}))}),r.jsx(W,{path:"psyche/self-observation",element:e("psyche-self-observation","Self observation","Self-observation notes and reflective tracking.",r.jsx(zf,{}))}),r.jsx(W,{path:"psyche/screen-time",element:e("psyche-screen-time","Screen Time","Apple-compliant device-activity patterns and reflective usage history.",r.jsx(Wf,{}))}),r.jsx(W,{path:"psyche/behaviors",element:e("psyche-behaviors","Behaviors","Behavior records and linked evidence.",r.jsx(Tf,{}))}),r.jsx(W,{path:"psyche/reports",element:e("psyche-reports","Reports","Trigger and reflective report review.",r.jsx(Ff,{}))}),r.jsx(W,{path:"psyche/reports/:reportId",element:e("psyche-report-detail","Report detail","Detailed reflective report view.",r.jsx(Mf,{}))}),r.jsx(W,{path:"psyche/goal-map",element:e("psyche-goal-map","Goal map","Goal-to-values relationship map.",r.jsx(Cf,{}))}),r.jsx(W,{path:"psyche/schemas-beliefs",element:e("psyche-schemas-beliefs","Schemas and beliefs","Beliefs, schemas, and linked patterns.",r.jsx(qf,{}))}),r.jsx(W,{path:"psyche/modes",element:e("psyche-modes","Modes","Mode profiles and guides.",r.jsx(Ef,{}))}),r.jsx(W,{path:"psyche/modes/guide",element:e("psyche-mode-guide","Mode guide","Guided mode session flow.",r.jsx(_f,{}))}),r.jsx(W,{path:"kanban",element:e("kanban-index","Kanban","Task board execution surface.",r.jsx(pf,{}))}),r.jsx(W,{path:"notes",element:e("notes-index","Notes","Notes, evidence, and writing surfaces.",r.jsx(yf,{}))}),r.jsx(W,{path:"wiki",element:e("wiki-index","KarpaWiki","KarpaWiki search and page navigation.",r.jsx(Si,{}))}),r.jsx(W,{path:"wiki/ingest-history",element:e("wiki-ingest-history","KarpaWiki ingest history","Ingest jobs and processing history.",r.jsx(cy,{}))}),r.jsx(W,{path:"wiki/page/:slug",element:e("wiki-page-detail","KarpaWiki page","KarpaWiki page detail and backlinks.",r.jsx(Si,{}))}),r.jsx(W,{path:"wiki/new",element:e("wiki-new","New KarpaWiki page","KarpaWiki editor for new pages.",r.jsx(Ni,{}))}),r.jsx(W,{path:"wiki/edit/:pageId",element:e("wiki-edit","Edit KarpaWiki page","KarpaWiki editor for existing pages.",r.jsx(Ni,{}))}),r.jsx(W,{path:"today",element:e("today-index","Today","Current work, time, and daily runway.",r.jsx(iy,{}))}),r.jsx(W,{path:"workbench",element:e("workbench","Workbench","Search, organize, and launch Forge flows.",r.jsx(uy,{}))}),r.jsx(W,{path:"workbench/:flowId",element:e("workbench-flow","Workbench flow","Graph editor and runtime surface for a single flow.",r.jsx(my,{}))}),r.jsx(W,{path:"activity",element:e("activity-index","Activity","Activity log and event history.",r.jsx(of,{}))}),r.jsx(W,{path:"insights",element:e("insights-index","Insights","Insight review and decisions.",r.jsx(mf,{}))}),r.jsx(W,{path:"review/weekly",element:e("weekly-review","Weekly review","Weekly review workflow and closeout.",r.jsx(dy,{}))}),r.jsx(W,{path:"settings",element:e("settings-index","Settings","Operator settings and runtime configuration.",r.jsx(Kf,{}))}),r.jsx(W,{path:"settings/data",element:e("settings-data","Settings data","Runtime storage, backups, exports, and recovery.",r.jsx(Hf,{}))}),r.jsx(W,{path:"settings/users",element:e("settings-users","Settings users","User directory and ownership settings.",r.jsx(Zf,{}))}),r.jsx(W,{path:"settings/calendar",element:e("settings-calendar","Settings calendar","Calendar provider settings and sync.",r.jsx(Vf,{}))}),r.jsx(W,{path:"settings/mobile",element:e("settings-mobile","Settings mobile","Mobile companion settings and pairing.",r.jsx(Jf,{}))}),null,r.jsx(W,{path:"settings/models",element:e("settings-models","Settings models","Model connections and defaults.",r.jsx(Xf,{}))}),r.jsx(W,{path:"settings/agents",element:e("settings-agents","Settings agents","Agent tokens and runtime access.",r.jsx(Uf,{}))}),r.jsx(W,{path:"settings/rewards",element:e("settings-rewards","Settings rewards","Rewards and XP rule settings.",r.jsx(Yf,{}))}),r.jsx(W,{path:"rewards",element:e("rewards","Trophy Hall","Trophies, unlocks, streak pressure, and Forge Smith progression.",r.jsx(ey,{}))}),r.jsx(W,{path:"settings/wiki",element:e("settings-wiki","KarpaWiki settings","KarpaWiki ingestion and profile settings.",r.jsx(kf,{}))}),r.jsx(W,{path:"settings/logs",element:e("settings-logs","Settings logs","Diagnostics and event logs.",r.jsx(Qf,{}))}),r.jsx(W,{path:"settings/bin",element:e("settings-bin","Settings bin","Deleted entity recovery.",r.jsx(Gf,{}))}),r.jsx(W,{path:"tasks/:taskId",element:e("task-detail","Task detail","Task detail, timer, and notes.",r.jsx(ny,{}))})]}),r.jsx(W,{path:"*",element:r.jsx(Yr,{to:"/overview",replace:!0})})]})]})}class gy extends Bi.Component{constructor(){super(...arguments);jt(this,"state",{error:null})}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a,s){console.error("Forge failed to render",a,s)}render(){return this.state.error?r.jsx("main",{className:"grid min-h-dvh place-items-center bg-canvas px-5 py-10 text-ink",children:r.jsxs("section",{className:"w-full max-w-xl rounded-[1.25rem] border border-white/12 bg-panel/90 p-6 shadow-2xl shadow-black/30",children:[r.jsx("p",{className:"font-label text-xs font-bold uppercase tracking-[0.08em] text-primary/80",children:"Forge runtime"}),r.jsx("h1",{className:"mt-3 text-3xl font-bold tracking-normal text-ink",children:"Forge could not finish rendering"}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-ink/70",children:"The HTML entrypoint loaded, but the React application hit an error before the interface could be displayed. Hard refresh the Tailscale page first; if this remains visible, check the browser console and the local Forge runtime logs."}),r.jsx("pre",{className:"mt-4 max-h-44 overflow-auto rounded-2xl border border-white/10 bg-black/30 p-4 text-xs leading-5 text-ink/70",children:this.state.error.message}),r.jsx("button",{className:"mt-5 rounded-full border border-white/12 bg-white/10 px-4 py-2 text-sm font-semibold text-ink transition hover:bg-white/15",type:"button",onClick:()=>window.location.reload(),children:"Reload Forge"})]})}):this.props.children}}const fy=new Hl({defaultOptions:{queries:{staleTime:2e4,refetchOnWindowFocus:!1}}});Ul.createRoot(document.getElementById("root")).render(r.jsx(Bi.StrictMode,{children:r.jsx(gy,{children:r.jsx(ac,{store:ss,children:r.jsx(sc,{client:fy,children:r.jsx(Gl,{basename:Ac("/forge/"),children:r.jsx(hy,{})})})})})}));export{rk as $,Cv as A,ue as B,ot as C,Rv as D,Cr as E,te as F,_v as G,Qe as H,ve as I,yk as J,fk as K,Po as L,Un as M,ov as N,Py as O,De as P,Xa as Q,Cw as R,Qp as S,at as T,Xu as U,gr as V,Tc as W,Ju as X,Yu as Y,b as Z,Gw as _,uk as a,Mb as a$,Ya as a0,Va as a1,Qd as a2,Mv as a3,$v as a4,zv as a5,Fv as a6,kk as a7,Md as a8,Er as a9,zk as aA,Fk as aB,Wk as aC,nk as aD,ik as aE,ok as aF,sk as aG,bm as aH,is as aI,nr as aJ,Bk as aK,Mk as aL,Rp as aM,qk as aN,lk as aO,bo as aP,xi as aQ,Ok as aR,Vr as aS,es as aT,bu as aU,fr as aV,Cy as aW,yi as aX,Ob as aY,$b as aZ,Cb as a_,Wv as aa,wk as ab,Dv as ac,Vy as ad,Gu as ae,Uu as af,Hu as ag,Nu as ah,rv as ai,sv as aj,av as ak,Td as al,oo as am,io as an,rd as ao,yo as ap,zt as aq,Gy as ar,_w as as,Ow as at,Rw as au,$h as av,Mh as aw,Fh as ax,Ew as ay,pm as az,et as b,Zb as b$,Fb as b0,_b as b1,Lb as b2,Ab as b3,Ib as b4,Db as b5,Tb as b6,Rb as b7,bk as b8,ig as b9,fx as bA,wx as bB,td as bC,Rx as bD,ip as bE,Fw as bF,ps as bG,fs as bH,hs as bI,gs as bJ,ys as bK,yd as bL,ab as bM,ib as bN,Nd as bO,Iw as bP,qv as bQ,Bv as bR,vg as bS,bg as bT,wg as bU,Ox as bV,Kx as bW,Hx as bX,Lx as bY,Yb as bZ,Xb as b_,og as ba,lg as bb,cg as bc,dg as bd,vb as be,bb as bf,wb as bg,Pb as bh,Eb as bi,zb as bj,Uw as bk,Hw as bl,Ex as bm,Ax as bn,jk as bo,Xw as bp,fo as bq,ug as br,mg as bs,pg as bt,fu as bu,yu as bv,Qc as bw,Yc as bx,Zc as by,ed as bz,le as c,Ix as c$,Qb as c0,By as c1,Wy as c2,Ey as c3,Ay as c4,Ly as c5,Oy as c6,Dy as c7,$y as c8,_y as c9,_x as cA,hx as cB,Zy as cC,ex as cD,Yy as cE,tx as cF,rx as cG,Qy as cH,sx as cI,Ov as cJ,ck as cK,Wa as cL,Jw as cM,Vw as cN,tk as cO,Ty as cP,Iy as cQ,Yv as cR,Zv as cS,Qk as cT,Qv as cU,ak as cV,vd as cW,ax as cX,nx as cY,ix as cZ,Cx as c_,Ky as ca,Hy as cb,qy as cc,Uy as cd,My as ce,zy as cf,Fy as cg,dk as ch,Ry as ci,qw as cj,Xy as ck,mx as cl,ux as cm,Kw as cn,cx as co,ox as cp,yx as cq,px as cr,jx as cs,kx as ct,Sx as cu,Jy as cv,bx as cw,vx as cx,xx as cy,dx as cz,Bm as d,yv as d$,Nx as d0,Px as d1,Tx as d2,cv as d3,lv as d4,Nb as d5,kb as d6,jb as d7,Sb as d8,gx as d9,aw as dA,iw as dB,nw as dC,ow as dD,tw as dE,ek as dF,jw as dG,Sw as dH,Nw as dI,hw as dJ,gw as dK,dw as dL,uw as dM,Lw as dN,pw as dO,mw as dP,lw as dQ,cw as dR,Kv as dS,kw as dT,Sd as dU,ew as dV,hv as dW,uv as dX,mv as dY,pv as dZ,xv as d_,lx as da,$u as db,Le as dc,vo as dd,Yw as de,Sk as df,wd as dg,so as dh,_k as di,Rk as dj,Zw as dk,qu as dl,Qw as dm,$d as dn,Ca as dp,It as dq,ba as dr,$w as ds,Mw as dt,Vc as du,ro as dv,tb as dw,ao as dx,rw as dy,sw as dz,vk as e,cb as e$,gv as e0,fv as e1,vv as e2,wv as e3,kv as e4,jv as e5,Sv as e6,_c as e7,dv as e8,Nv as e9,Pr as eA,bw as eB,xd as eC,Zh as eD,eg as eE,tg as eF,rb as eG,Hb as eH,rg as eI,ag as eJ,sg as eK,sb as eL,B as eM,nb as eN,Dd as eO,Od as eP,Aw as eQ,Ug as eR,Gg as eS,Vg as eT,Jg as eU,Xg as eV,db as eW,hb as eX,ub as eY,mb as eZ,pb as e_,bv as ea,Wb as eb,qb as ec,Kb as ed,Bb as ee,Hv as ef,Uv as eg,Ux as eh,Gx as ei,Gv as ej,Vv as ek,Xv as el,Jv as em,Vd as en,zw as eo,Tw as ep,yw as eq,xw as er,fw as es,vw as et,Jb as eu,Vb as ev,Gb as ew,Ub as ex,lo as ey,ww as ez,vc as f,lb as f0,gb as f1,yb as f2,xb as f3,fb as f4,ob as f5,qx as f6,Mx as f7,Fx as f8,zx as f9,Nk as fA,op as fB,Ak as fC,Ck as fD,Ek as fE,Ik as fF,Bx as fa,ev as fb,Jx as fc,Vx as fd,tv as fe,Zx as ff,Yx as fg,no as fh,Qx as fi,Xx as fj,sd as fk,Wx as fl,ad as fm,$x as fn,Dx as fo,iv as fp,nv as fq,eb as fr,Ww as fs,od as ft,bh as fu,ms as fv,Xk as fw,Tk as fx,Pk as fy,Jk as fz,Gn as g,gk as h,Xp as i,Ye as j,mk as k,Pw as l,Jd as m,Ny as n,hk as o,pk as p,xk as q,Dw as r,Bw as s,Pv as t,lh as u,Tv as v,Iv as w,Ev as x,Av as y,Lv as z};