forge-openclaw-plugin 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{action-bar-DBZ38L_6.js → action-bar-CsDQF9d4.js} +1 -1
- package/dist/assets/{activity-page-BJxUR9bD.js → activity-page-CACf1Sd5.js} +1 -1
- package/dist/assets/{ai-surface-workspace-ehzBjTsW.js → ai-surface-workspace-Vn5fqCAT.js} +1 -1
- package/dist/assets/{atlas-panel-BFUeVT69.js → atlas-panel-GdK1oyxo.js} +1 -1
- package/dist/assets/{board-CLOHbg6t.js → board-CuxQRKPJ.js} +1 -1
- package/dist/assets/{calendar-page-Bg8W-YQ-.js → calendar-page-CcVGbvfY.js} +1 -1
- package/dist/assets/{calendar-rules-9XQLoI96.js → calendar-rules-Dlq0KT93.js} +1 -1
- package/dist/assets/{calendar-week-toolbar-BeYnx1pE.js → calendar-week-toolbar-BVFb1_2G.js} +1 -1
- package/dist/assets/{charts-DwTguE_x.js → charts-BzT4pUPg.js} +1 -1
- package/dist/assets/{companion-sync-lab-page-BRKYkIrs.js → companion-sync-lab-page-Dgvtdc4i.js} +1 -1
- package/dist/assets/{daily-metrics-dashboard-Jt0nAHU5.js → daily-metrics-dashboard-ChQVbNJI.js} +1 -1
- package/dist/assets/date-keys-BnZV4PNO.js +1 -0
- package/dist/assets/{define-workbench-box-5h-dyvJY.js → define-workbench-box-DWAqqjvH.js} +1 -1
- package/dist/assets/{entity-link-multiselect-Bb4De_e3.js → entity-link-multiselect-Do5DTju7.js} +1 -1
- package/dist/assets/{entity-note-count-link-BzWnsOmI.js → entity-note-count-link-CV3eOv66.js} +1 -1
- package/dist/assets/{entity-notes-surface-CagOwdng.js → entity-notes-surface-CiUgAVl7.js} +1 -1
- package/dist/assets/{execution-board-DTmAtmqZ.js → execution-board-ClaXVQ0H.js} +1 -1
- package/dist/assets/{faceted-token-search-DJPRm9AY.js → faceted-token-search-DoSsb7qT.js} +1 -1
- package/dist/assets/{flagship-signal-deck-CJbGZF7I.js → flagship-signal-deck-B2s7TrIN.js} +1 -1
- package/dist/assets/{floating-action-menu-K77jh8XZ.js → floating-action-menu-DGkHCmvI.js} +1 -1
- package/dist/assets/{forms-C5d5hTf2.js → forms-D1qJ3oOP.js} +1 -1
- package/dist/assets/{generic-node-view-p5ePSFuG.js → generic-node-view-CgLkbts-.js} +1 -1
- package/dist/assets/{goal-detail-page-DGu_khEK.js → goal-detail-page-JRcEYpeA.js} +1 -1
- package/dist/assets/{goal-dialog-BWD7cOv9.js → goal-dialog-6R2uYWPQ.js} +1 -1
- package/dist/assets/{goals-page-Bgj3sj0f.js → goals-page-CYestXkp.js} +1 -1
- package/dist/assets/{graph-Cd5WF3lw.js → graph-BF4IsheG.js} +1 -1
- package/dist/assets/{habits-page-Ctut1tuX.js → habits-page-B27lnyKu.js} +1 -1
- package/dist/assets/{health-boxes-Ie3horXx.js → health-boxes-CeqSGyZ3.js} +1 -1
- package/dist/assets/index-DGYIFHgo.js +2 -0
- package/dist/assets/{index-CEgIwgk9.css → index-UzsVTD1W.css} +1 -1
- package/dist/assets/{inline-note-fields-DE6WM9uM.js → inline-note-fields-CJ9ukqFp.js} +1 -1
- package/dist/assets/{insight-flow-dialog-XL8I74eJ.js → insight-flow-dialog-BgaJRYGX.js} +1 -1
- package/dist/assets/{insights-page-Bz1FLbp5.js → insights-page-Dc5bilGE.js} +1 -1
- package/dist/assets/{kanban-boxes-BBziel7P.js → kanban-boxes-qIwmQlRq.js} +1 -1
- package/dist/assets/{kanban-page-DdQP73I3.js → kanban-page-BGnVLHeN.js} +1 -1
- package/dist/assets/{knowledge-graph-page-DdHWj4Dj.js → knowledge-graph-page-B7IsVVO_.js} +1 -1
- package/dist/assets/{life-force-page-BRN-93cI.js → life-force-page-B5N4DknK.js} +1 -1
- package/dist/assets/{life-force-workspace-BowvP5R4.js → life-force-workspace-Da-dmoRX.js} +1 -1
- package/dist/assets/{maps-D0Mm6WPG.js → maps-BTVHALP8.js} +1 -1
- package/dist/assets/{metric-tile-B6aJueRo.js → metric-tile-BVuj7mc3.js} +1 -1
- package/dist/assets/{motion-DwjmC9aq.js → motion-DcgUnXhY.js} +1 -1
- package/dist/assets/{movement-boxes-5cjWjIdR.js → movement-boxes-BZrdIh8b.js} +1 -1
- package/dist/assets/{movement-page-Dy53RWtB.js → movement-page-CY2XLgp_.js} +1 -1
- package/dist/assets/{note-markdown-CvEQCfoi.js → note-markdown-BZHBOkEd.js} +1 -1
- package/dist/assets/{note-tags-input-Cg5zBXos.js → note-tags-input-DucocvNH.js} +1 -1
- package/dist/assets/{notes-boxes-CgZyf7mV.js → notes-boxes-DAQ6KBkJ.js} +1 -1
- package/dist/assets/{notes-page-Cbdcv0Ej.js → notes-page-CSCfdDJl.js} +1 -1
- package/dist/assets/{open-in-graph-button-D31ZOEhA.js → open-in-graph-button-ObO3m8yd.js} +1 -1
- package/dist/assets/{orbit-map-8eNDWek8.js → orbit-map-Bteg-ola.js} +1 -1
- package/dist/assets/{overview-page-CZ6q52Qj.js → overview-page-ckfN_sLZ.js} +1 -1
- package/dist/assets/{page-hero-C0MpI3MM.js → page-hero-BkrRTu-t.js} +1 -1
- package/dist/assets/pill-cluster-COzv8VgR.js +1 -0
- package/dist/assets/{preference-entity-handoff-button-CJhr5AXl.js → preference-entity-handoff-button-BpVAeFmY.js} +1 -1
- package/dist/assets/{preferences-page-8vszDNFX.js → preferences-page-DseOh9AP.js} +1 -1
- package/dist/assets/{project-collections-sC7eAAhS.js → project-collections-C7yU5PSi.js} +1 -1
- package/dist/assets/{project-detail-page-BKdnMjJy.js → project-detail-page-Crt46y_7.js} +1 -1
- package/dist/assets/{project-dialog-BiHZpOo1.js → project-dialog-YYxtlqg8.js} +1 -1
- package/dist/assets/{project-management-hierarchy-page-VW-hykAI.js → project-management-hierarchy-page-DnojKHzy.js} +1 -1
- package/dist/assets/{project-management-section-nav-BEZ5zihs.js → project-management-section-nav-Ctjd348W.js} +1 -1
- package/dist/assets/{projects-boxes-Ca6rpYeE.js → projects-boxes-D8lLFGBC.js} +1 -1
- package/dist/assets/{projects-page-D86pjpTf.js → projects-page-CV_2em8d.js} +1 -1
- package/dist/assets/{psyche-behaviors-page-YLJB6CRU.js → psyche-behaviors-page-CYCNk0rz.js} +1 -1
- package/dist/assets/{psyche-flashcards-page-D3gdHLUw.js → psyche-flashcards-page-DwmjBixN.js} +1 -1
- package/dist/assets/{psyche-goal-map-page-DJiqSiCx.js → psyche-goal-map-page-CdMhyBKh.js} +1 -1
- package/dist/assets/{psyche-graph-Tke0qFdt.js → psyche-graph-BcrZcJrq.js} +1 -1
- package/dist/assets/{psyche-metrics-page-DoLnvmC2.js → psyche-metrics-page-D5bX1mNX.js} +1 -1
- package/dist/assets/{psyche-mode-guide-page-_Zbvg_HL.js → psyche-mode-guide-page-BmX9EOOB.js} +1 -1
- package/dist/assets/{psyche-modes-page-eAkaAzJc.js → psyche-modes-page-CTHFDyLE.js} +1 -1
- package/dist/assets/{psyche-page-CwmuBVjA.js → psyche-page-DRR3Fjv-.js} +1 -1
- package/dist/assets/{psyche-patterns-page-D7B4Ykjq.js → psyche-patterns-page-BAS38xYf.js} +1 -1
- package/dist/assets/{psyche-questionnaire-builder-page-CHJlvCzX.js → psyche-questionnaire-builder-page-DpSi-zg3.js} +1 -1
- package/dist/assets/{psyche-questionnaire-detail-page-Bg3ll-D4.js → psyche-questionnaire-detail-page-BcXIiV4E.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-detail-page-CIEerczF.js → psyche-questionnaire-run-detail-page-DvccwzWO.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-page-DyxIk6Qx.js → psyche-questionnaire-run-page-vcyon8IZ.js} +1 -1
- package/dist/assets/{psyche-questionnaires-page-ZlqUxuIl.js → psyche-questionnaires-page-B0DDTner.js} +1 -1
- package/dist/assets/{psyche-report-detail-page-B2jgYnQ5.js → psyche-report-detail-page-BgBA3xIO.js} +1 -1
- package/dist/assets/{psyche-reports-page-DlXr52yr.js → psyche-reports-page-Ce1vEEqW.js} +1 -1
- package/dist/assets/{psyche-schemas-Dtskzvv1.js → psyche-schemas-DDol0j-g.js} +1 -1
- package/dist/assets/{psyche-schemas-beliefs-page-BhrTZN9B.js → psyche-schemas-beliefs-page-D-IHHohY.js} +1 -1
- package/dist/assets/{psyche-screen-time-page-WNGcdusx.js → psyche-screen-time-page-DOKW3m8B.js} +1 -1
- package/dist/assets/{psyche-self-observation-page-XsCOglo4.js → psyche-self-observation-page-j7Sk6Ns1.js} +1 -1
- package/dist/assets/{psyche-values-page-NvHI6zWK.js → psyche-values-page-NfzdWUyb.js} +1 -1
- package/dist/assets/{question-flow-dialog-Bj4PxpjS.js → question-flow-dialog-CLHVmFON.js} +1 -1
- package/dist/assets/{report-chain-fields-mWFikZzT.js → report-chain-fields-C9MuyBha.js} +1 -1
- package/dist/assets/{rewards-page-DyjwXsQN.js → rewards-page-CVxOBP6m.js} +1 -1
- package/dist/assets/{scheduling-rules-editor-C6FEYOxd.js → scheduling-rules-editor-BmbOHH_R.js} +1 -1
- package/dist/assets/{schema-badge-CCe4zkSN.js → schema-badge-BAiS_OAp.js} +1 -1
- package/dist/assets/{schemas-Cjwn6ooR.js → schemas-B0AXfuOr.js} +1 -1
- package/dist/assets/{select-menu-DeJhCsd8.js → select-menu-Bl5MILOj.js} +1 -1
- package/dist/assets/{settings-agents-page-DYDxyKu-.js → settings-agents-page-BIRP02mt.js} +1 -1
- package/dist/assets/{settings-bin-page-BWLfKVW1.js → settings-bin-page-DxJKeM28.js} +1 -1
- package/dist/assets/{settings-calendar-page-Ci-wXhCv.js → settings-calendar-page-aMBtwvO_.js} +1 -1
- package/dist/assets/{settings-data-page-DxIw-fWn.js → settings-data-page-nHNergsh.js} +1 -1
- package/dist/assets/{settings-logs-page-inpyIdu6.js → settings-logs-page-CFotPoFy.js} +1 -1
- package/dist/assets/{settings-mobile-page-BcJGLax8.js → settings-mobile-page-Bf_1D-bN.js} +1 -1
- package/dist/assets/{settings-models-page-OWTRhfkj.js → settings-models-page-BbFNmnik.js} +1 -1
- package/dist/assets/{settings-page-DXxF3qK2.js → settings-page-CalbNbcg.js} +1 -1
- package/dist/assets/{settings-rewards-page-CCXin1n_.js → settings-rewards-page-ByDfCzP5.js} +1 -1
- package/dist/assets/{settings-section-nav-CwSDNC3W.js → settings-section-nav-x_JXfzL9.js} +1 -1
- package/dist/assets/{settings-users-page-B4NEACwR.js → settings-users-page-N1jl9hWV.js} +1 -1
- package/dist/assets/{settings-wiki-page-BNRK1SYc.js → settings-wiki-page-Bn2Qr94L.js} +1 -1
- package/dist/assets/{sleep-page-Bara54nB.js → sleep-page-DyU635jb.js} +1 -1
- package/dist/assets/{sports-page-BawekFKD.js → sports-page-DbK4yGrR.js} +1 -1
- package/dist/assets/{state-BtwEvpO6.js → state-Bpe5dF3T.js} +1 -1
- package/dist/assets/{strategies-page-BEl3NGAU.js → strategies-page-AUBlFCZ9.js} +1 -1
- package/dist/assets/{strategy-detail-page-DPPI_8Ub.js → strategy-detail-page-DCF8mVaL.js} +1 -1
- package/dist/assets/{strategy-dialog-DU6wbBkQ.js → strategy-dialog-50xKlqcz.js} +1 -1
- package/dist/assets/{surface-BVYp-Wq9.js → surface-BjT1dIAF.js} +1 -1
- package/dist/assets/{table-BuONJH1s.js → table-U7otr5go.js} +1 -1
- package/dist/assets/{task-detail-page-BsMVAsbb.js → task-detail-page-Dsll2LCX.js} +1 -1
- package/dist/assets/{task-dialog-BGzPc6TW.js → task-dialog-BfPkbIPE.js} +1 -1
- package/dist/assets/{timebox-planning-dialog-4_XWuqkw.js → timebox-planning-dialog-BTKUS6Jj.js} +1 -1
- package/dist/assets/{today-boxes-5pCvh5zS.js → today-boxes-BPi9bDHM.js} +1 -1
- package/dist/assets/{today-page-BGurICpl.js → today-page-BSXSA-Ts.js} +1 -1
- package/dist/assets/{training-load-page-BkoYKZ9_.js → training-load-page-BD0s8-Zm.js} +1 -1
- package/dist/assets/{ui-B9O-eUim.js → ui-B9TWEtCx.js} +1 -1
- package/dist/assets/{use-anchored-overlay-position-BrQ4cqKn.js → use-anchored-overlay-position-BY4kNzPj.js} +1 -1
- package/dist/assets/{use-psyche-focus-target-Cuxni3SK.js → use-psyche-focus-target-BhNedCZB.js} +1 -1
- package/dist/assets/{user-badge-DfDv87j7.js → user-badge-ap1PvOxd.js} +1 -1
- package/dist/assets/{user-select-field-BNqv8-wd.js → user-select-field-fx129Uh6.js} +1 -1
- package/dist/assets/{utility-widgets-CbYj32he.js → utility-widgets-Cq508sqJ.js} +1 -1
- package/dist/assets/{vendor-Cpmju3nw.js → vendor-BwL6m4SE.js} +216 -211
- package/dist/assets/{vitals-page-DlxMk-L7.js → vitals-page-BnXk8OzN.js} +1 -1
- package/dist/assets/{weekly-review-page-VrEvAl1T.js → weekly-review-page-CnmSGnEC.js} +1 -1
- package/dist/assets/weight-loss-page-Bn6lAXNf.js +5 -0
- package/dist/assets/{wiki-article-markdown-DxTkiQRy.js → wiki-article-markdown-BDnkdNDC.js} +1 -1
- package/dist/assets/{wiki-editor-page-Beu92YnZ.js → wiki-editor-page-CHEETB0G.js} +1 -1
- package/dist/assets/{wiki-ingest-history-page-Cq_soygm.js → wiki-ingest-history-page-CisvtAzm.js} +1 -1
- package/dist/assets/{wiki-ingest-modal-D6xs2sEn.js → wiki-ingest-modal-C2faIjzj.js} +1 -1
- package/dist/assets/{wiki-page-yF3Flgtg.js → wiki-page-CELe_6qL.js} +1 -1
- package/dist/assets/{workbench-flow-page-CZZGg3a8.js → workbench-flow-page-JBVim3L0.js} +1 -1
- package/dist/assets/{workbench-page-DKENZ5Nz.js → workbench-page-q7Z3sQtz.js} +1 -1
- package/dist/assets/{workout-detail-page-CeN4QiYQ.js → workout-detail-page-9I_3DPYU.js} +2 -2
- package/dist/index.html +8 -8
- package/dist/server/server/migrations/070_health_mobile_sync_completion_index.sql +16 -0
- package/dist/server/server/src/app.js +135 -13
- package/dist/server/server/src/health-weight-loss.js +48 -6
- package/dist/server/server/src/health.js +301 -93
- package/dist/server/server/src/openapi.js +31 -0
- package/dist/server/server/src/repositories/gamification.js +25 -0
- package/dist/server/server/src/repositories/tasks.js +82 -17
- package/dist/server/server/src/services/dashboard.js +5 -4
- package/dist/server/server/src/services/gamification.js +47 -19
- package/dist/server/server/src/services/life-force.js +99 -0
- package/dist/server/src/lib/api.js +4 -0
- package/dist/server/src/lib/snapshot-normalizer.js +42 -23
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/server/migrations/070_health_mobile_sync_completion_index.sql +16 -0
- package/skills/forge-openclaw/SKILL.md +1 -0
- package/skills/forge-openclaw/psyche_entity_playbooks.md +8 -0
- package/dist/assets/date-keys-Cj1G3TOn.js +0 -1
- package/dist/assets/index-BaiwtAgo.js +0 -2
- package/dist/assets/pill-cluster-DGwKZQKF.js +0 -1
- package/dist/assets/weight-loss-page-DJDnjxKF.js +0 -5
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/goal-dialog-6R2uYWPQ.js","assets/vendor-BwL6m4SE.js","assets/vendor-CRS-psbw.css","assets/question-flow-dialog-CLHVmFON.js","assets/ui-B9TWEtCx.js","assets/motion-DcgUnXhY.js","assets/inline-note-fields-CJ9ukqFp.js","assets/user-select-field-fx129Uh6.js","assets/schemas-B0AXfuOr.js","assets/forms-D1qJ3oOP.js","assets/user-ownership-DJGl4rAj.js","assets/state-Bpe5dF3T.js","assets/board-CuxQRKPJ.js","assets/project-dialog-YYxtlqg8.js","assets/user-badge-ap1PvOxd.js","assets/task-dialog-BfPkbIPE.js","assets/action-bar-CsDQF9d4.js","assets/entity-link-multiselect-Do5DTju7.js","assets/use-anchored-overlay-position-BY4kNzPj.js","assets/activity-page-CACf1Sd5.js","assets/page-hero-BkrRTu-t.js","assets/table-U7otr5go.js","assets/entity-links-DwpxhW2H.js","assets/calendar-page-CcVGbvfY.js","assets/calendar-week-toolbar-BVFb1_2G.js","assets/calendar-ui-Cy1XRwzV.js","assets/timebox-planning-dialog-BTKUS6Jj.js","assets/scheduling-rules-editor-BmbOHH_R.js","assets/floating-action-menu-DGkHCmvI.js","assets/calendar-display-preferences-Cid-2RnL.js","assets/companion-sync-lab-page-Dgvtdc4i.js","assets/goal-detail-page-JRcEYpeA.js","assets/open-in-graph-button-ObO3m8yd.js","assets/note-markdown-BZHBOkEd.js","assets/entity-notes-surface-CiUgAVl7.js","assets/note-tags-input-DucocvNH.js","assets/preference-entity-handoff-button-BpVAeFmY.js","assets/project-collections-C7yU5PSi.js","assets/activity-copy-Bj4h9OcF.js","assets/goals-page-CYestXkp.js","assets/entity-note-count-link-CV3eOv66.js","assets/pill-cluster-COzv8VgR.js","assets/habits-page-B27lnyKu.js","assets/use-psyche-focus-target-BhNedCZB.js","assets/select-menu-Bl5MILOj.js","assets/date-keys-BnZV4PNO.js","assets/insights-page-Dc5bilGE.js","assets/insight-flow-dialog-BgaJRYGX.js","assets/kanban-page-BGnVLHeN.js","assets/kanban-boxes-qIwmQlRq.js","assets/generic-node-view-CgLkbts-.js","assets/graph-BF4IsheG.js","assets/graph-BZV40eAE.css","assets/define-workbench-box-DWAqqjvH.js","assets/execution-board-ClaXVQ0H.js","assets/project-management-section-nav-Ctjd348W.js","assets/knowledge-graph-page-B7IsVVO_.js","assets/faceted-token-search-DoSsb7qT.js","assets/life-force-page-B5N4DknK.js","assets/life-force-workspace-Da-dmoRX.js","assets/charts-BzT4pUPg.js","assets/movement-page-CY2XLgp_.js","assets/surface-BjT1dIAF.js","assets/movement-boxes-BZrdIh8b.js","assets/notes-page-CSCfdDJl.js","assets/notes-boxes-DAQ6KBkJ.js","assets/overview-page-ckfN_sLZ.js","assets/ai-surface-workspace-Vn5fqCAT.js","assets/utility-widgets-Cq508sqJ.js","assets/flagship-signal-deck-B2s7TrIN.js","assets/project-detail-page-Crt46y_7.js","assets/calendar-rules-Dlq0KT93.js","assets/project-management-hierarchy-page-DnojKHzy.js","assets/projects-page-CV_2em8d.js","assets/projects-boxes-D8lLFGBC.js","assets/settings-wiki-page-Bn2Qr94L.js","assets/settings-section-nav-x_JXfzL9.js","assets/strategies-page-AUBlFCZ9.js","assets/strategy-dialog-50xKlqcz.js","assets/strategy-detail-page-DCF8mVaL.js","assets/preferences-page-DseOh9AP.js","assets/psyche-page-DRR3Fjv-.js","assets/psyche-graph-BcrZcJrq.js","assets/psyche-behaviors-page-CYCNk0rz.js","assets/atlas-panel-GdK1oyxo.js","assets/schema-badge-BAiS_OAp.js","assets/schema-visuals-CvC9a3i6.js","assets/query-cache-IQ8W-LNC.js","assets/psyche-schemas-DDol0j-g.js","assets/psyche-flashcards-page-DwmjBixN.js","assets/psyche-goal-map-page-CdMhyBKh.js","assets/psyche-metrics-page-D5bX1mNX.js","assets/daily-metrics-dashboard-ChQVbNJI.js","assets/psyche-mode-guide-page-BmX9EOOB.js","assets/psyche-modes-page-CTHFDyLE.js","assets/psyche-patterns-page-BAS38xYf.js","assets/orbit-map-Bteg-ola.js","assets/psyche-questionnaire-builder-page-DpSi-zg3.js","assets/psyche-questionnaire-detail-page-BcXIiV4E.js","assets/psyche-questionnaire-run-detail-page-DvccwzWO.js","assets/psyche-questionnaire-run-page-vcyon8IZ.js","assets/psyche-questionnaires-page-B0DDTner.js","assets/psyche-report-detail-page-BgBA3xIO.js","assets/report-chain-fields-C9MuyBha.js","assets/psyche-reports-page-Ce1vEEqW.js","assets/psyche-self-observation-page-j7Sk6Ns1.js","assets/psyche-screen-time-page-DOKW3m8B.js","assets/psyche-schemas-beliefs-page-D-IHHohY.js","assets/psyche-values-page-NfzdWUyb.js","assets/settings-page-CalbNbcg.js","assets/settings-data-page-nHNergsh.js","assets/metric-tile-BVuj7mc3.js","assets/settings-agents-page-BIRP02mt.js","assets/settings-bin-page-DxJKeM28.js","assets/settings-calendar-page-aMBtwvO_.js","assets/settings-mobile-page-Bf_1D-bN.js","assets/settings-models-page-BbFNmnik.js","assets/settings-logs-page-CFotPoFy.js","assets/settings-rewards-page-ByDfCzP5.js","assets/settings-users-page-N1jl9hWV.js","assets/rewards-page-CVxOBP6m.js","assets/sleep-page-DyU635jb.js","assets/health-boxes-CeqSGyZ3.js","assets/health-link-options-Cpx8w7uM.js","assets/sports-page-DbK4yGrR.js","assets/training-load-page-BD0s8-Zm.js","assets/workout-detail-page-9I_3DPYU.js","assets/maps-BTVHALP8.js","assets/maps-B-YMMjus.css","assets/task-detail-page-Dsll2LCX.js","assets/today-page-BSXSA-Ts.js","assets/today-boxes-BPi9bDHM.js","assets/vitals-page-BnXk8OzN.js","assets/weight-loss-page-Bn6lAXNf.js","assets/wiki-page-CELe_6qL.js","assets/wiki-article-markdown-BDnkdNDC.js","assets/wiki-ingest-modal-C2faIjzj.js","assets/wiki-ingest-history-page-CisvtAzm.js","assets/wiki-editor-page-CHEETB0G.js","assets/weekly-review-page-CnmSGnEC.js","assets/workbench-page-q7Z3sQtz.js","assets/workbench-flow-page-JBVim3L0.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Qi=Object.defineProperty;var Yi=(e,t,n)=>t in e?Qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>Yi(e,typeof t!="symbol"?t+"":t,n);import{aA as Zi,T as er,j as s,r as l,aB as tr,aC as Ke,aD as Ga,aE as ks,aF as ls,aG as bt,aH as Wt,aI as Ha,aJ as Qe,aK as Ye,aL as Ua,aM as sr,aN as la,aO as nr,aP as Ss,aQ as ar,aR as Ot,aS as js,aT as qa,aU as Ka,aV as cs,aW as xt,aX as ca,aY as Ba,aZ as ir,a_ as rr,a$ as or,b0 as lr,b1 as cr,b2 as ds,b3 as Gt,b4 as Va,b5 as dr,b6 as Ja,F as Ns,b7 as Ps,b8 as ur,b9 as Xa,ba as Qa,bb as mr,bc as Ya,bd as pr,be as hr,bf as gr,bg as fr,bh as vr,bi as yr,bj as Za,bk as ei,bl as wt,bm as br,bn as ti,bo as xr,bp as wr,bq as kr,br as Sr,bs as jr,bt as Nr,bu as Ts,bv as Pr,bw as Tr,bx as Rr,by as Rs,bz as _s,bA as _r,bB as Cr,bC as Ir,bD as Or,bE as Er,bF as Ar,bG as Lr,bH as si,bI as da,d as Dr,m as Ht,bJ as $r,bK as ua,bL as Mr,bM as zr,bN as Fr,bO as Wr,bP as S,bQ as Qt,R as ni,bR as Gr,bS as Hr,bT as Ur}from"./vendor-BwL6m4SE.js";import{i as Cs,j as Ut,k as Is,l as qr,m as Kr,a as ai,f as Br,n as Vr,g as Jr,o as Xr,q as Qr,r as Yr,t as ii,v as Zr,P as eo,Q as to}from"./state-Bpe5dF3T.js";import{m as Be,u as so,A as ri}from"./motion-DcgUnXhY.js";import{R as Ze,P as et,O as tt,C as st,T as nt,D as at,a as qt,b as no}from"./ui-B9TWEtCx.js";import{u as ao,a as io,P as ro,D as oo,c as lo,S as co,v as uo,b as mo,C as po,d as ho}from"./board-CuxQRKPJ.js";import{e as go,s as oi,o as fo}from"./forms-D1qJ3oOP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const vo="modulepreload",yo=function(e){return"/forge/"+e},ma={},N=function(t,n,a){let i=Promise.resolve();if(n&&n.length>0){let c=function(g){return Promise.all(g.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=c(n.map(g=>{if(g=yo(g),g in ma)return;ma[g]=!0;const u=g.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${h}`))return;const j=document.createElement("link");if(j.rel=u?"stylesheet":vo,u||(j.as="script"),j.crossOrigin="",j.href=g,p&&j.setAttribute("nonce",p),document.head.appendChild(j),u)return new Promise((b,v)=>{j.addEventListener("load",b),j.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${g}`)))})}))}function o(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return i.then(c=>{for(const d of c||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})};function x(...e){return Zi(er(e))}function bo(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function Os({className:e,tone:t="primary"}){return s.jsx("span",{"aria-hidden":"true",className:x("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 xo(){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:"Review today’s priorities, active work, recent evidence, and overall Forge momentum.",goals:"Define long-term directions and connect them to strategies, projects, and daily execution.",habits:"Track recurring commitments, negative habits, streaks, missed days, and habit-linked evidence.",projects:"Manage PRD-backed initiatives and the work items that move them forward.",strategies:"Build strategy graphs that turn goals and projects into ordered execution paths.",preferences:"Compare preferences, record tradeoffs, and inspect the evidence behind taste models.",calendar:"Plan timeboxes, manage calendar events, and sync provider calendars into Forge.",movement:"Review stays, trips, known places, gaps, and movement evidence captured from the phone.",sleep:"Inspect overnight sleep sessions, stages, recovery context, and trends by wake date.",sports:"Review workouts, routes, preserved HealthKit evidence, sport trends, and reflections.",kanban:"Move projects, issues, tasks, and subtasks through execution lanes without losing hierarchy.",today:"Choose today’s next work, inspect time pressure, and keep active execution visible.",notes:"Create and search Markdown notes linked to Forge entities, dates, tags, and evidence.",wiki:"Search KarpaWiki pages, backlinks, entity links, and the SQLite-backed memory graph.",psyche:"Navigate Psyche records for values, modes, beliefs, reports, patterns, and self-observation.",activity:"Review the audit trail of entity changes, sync events, task work, and system activity.",insights:"Store analyses, coaching notes, recommendations, and decisions that should remain visible.",review:"Close out the week, review evidence, and decide the next execution push.",settings:"Manage Forge runtime preferences, users, integrations, data, models, and companion setup."},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 wo=xo(),ko={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:"Relisez les priorités du jour, le travail actif, les preuves récentes et le momentum Forge.",goals:"Définissez les directions longues et reliez-les aux stratégies, projets et actions quotidiennes.",habits:"Suivez les engagements, habitudes négatives, séries, jours manqués et preuves liées.",projects:"Gérez les initiatives avec PRD et les éléments de travail qui les font avancer.",strategies:"Construisez les graphes qui transforment objectifs et projets en chemins d'exécution.",preferences:"Comparez les préférences, notez les arbitrages et inspectez les preuves de goût.",calendar:"Planifiez des timeboxes, gérez les événements et synchronisez les calendriers externes.",movement:"Relisez séjours, trajets, lieux connus, trous et preuves de mouvement du téléphone.",sleep:"Inspectez les nuits, phases, contexte de récupération et tendances par date de réveil.",sports:"Relisez entraînements, trajets, preuves HealthKit préservées, tendances sportives et réflexions.",kanban:"Déplacez projets, issues, tâches et sous-tâches sans perdre la hiérarchie.",today:"Choisissez le prochain travail du jour, voyez la pression temporelle et gardez l'exécution visible.",notes:"Créez et recherchez des notes Markdown liées aux entités, dates, tags et preuves.",wiki:"Recherchez pages KarpaWiki, backlinks, liens d'entités et graphe mémoire SQLite.",psyche:"Naviguez dans valeurs, modes, croyances, rapports, patterns et observations Psyche.",activity:"Relisez la piste d'audit des changements, synchronisations, tâches et événements système.",insights:"Conservez analyses, notes de coaching, recommandations et décisions importantes.",review:"Clôturez la semaine, relisez les preuves et choisissez la prochaine poussée.",settings:"Gérez préférences, utilisateurs, intégrations, données, modèles et compagnon mobile."},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."}}},pa={en:wo,fr:ko};function ha(e,t){const n=t.split(".");let a=e;for(const i of n){if(!a||typeof a=="string")return;a=a[i]}return typeof a=="string"?a:void 0}function So(e,t){return t?e.replace(/\{(\w+)\}/g,(n,a)=>{const i=t[a];return i==null?"":String(i)}):e}function $t(e,t,n){const a=ha(pa[e],t),i=ha(pa.en,t);return So(a??i??t,n)}const jo={locale:"en",t:(e,t)=>$t("en",e,t),formatDate:e=>e?new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}).format(new Date(`${e}T00:00:00.000Z`)):$t("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)},li=l.createContext(null);function No({children:e,locale:t}){const n=l.useMemo(()=>({locale:t,t:(a,i)=>$t(t,a,i),formatDate:a=>a?new Intl.DateTimeFormat(t,{month:"short",day:"numeric"}).format(new Date(`${a}T00:00:00.000Z`)):$t(t,"common.labels.noDate"),formatDateTime:a=>new Intl.DateTimeFormat(t,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(a)),formatNumber:a=>new Intl.NumberFormat(t).format(a)}),[t]);return s.jsx(li.Provider,{value:n,children:e})}function ye(){return l.useContext(li)??jo}function ga({active:e,label:t,className:n,onClick:a}){const{t:i}=ye();return s.jsxs(Be.button,{type:"button",initial:!1,animate:{opacity:e?1:.55,y:0,scale:e?1:.98},transition:{duration:.24,ease:"easeOut"},onClick:a,className:x("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)]",a?"cursor-pointer":"cursor-default",n),"aria-live":"polite","aria-label":`${i("common.labels.backgroundActivity")}: ${t}`,children:[s.jsx(Os,{tone:"subtle",className:e?"opacity-100":"opacity-45"}),s.jsxs("div",{className:"inline-flex min-w-0 max-w-full items-center gap-2 whitespace-nowrap",children:[s.jsx("span",{className:"type-label hidden text-[var(--ui-ink-soft)] sm:inline",children:i("common.labels.backgroundActivity")}),s.jsx("span",{className:"hidden text-[var(--ui-ink-faint)] sm:inline",children:"•"}),s.jsx("span",{className:"truncate text-sm text-[var(--ui-ink-medium)]",children:t})]})]})}function D({className:e,tone:t="default",size:n="md",wrap:a=!1,...i}){return s.jsx("span",{className:x("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)]",a?"whitespace-normal break-words [overflow-wrap:anywhere]":"overflow-hidden text-ellipsis whitespace-nowrap",n==="xs"?"min-h-5 px-2 py-0.5 text-[10px]":n==="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),...i})}const Po=tr("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 B({className:e,variant:t,size:n,pending:a=!1,pendingLabel:i,children:o,disabled:c,...d}){return s.jsxs("button",{className:x(Po({variant:t,size:n}),e),disabled:c||a,"aria-busy":a,...d,children:[a?s.jsx(Os,{className:"size-3.5",tone:"subtle"}):null,s.jsx("span",{className:"inline-flex min-w-0 max-w-full items-center gap-2 overflow-hidden truncate whitespace-nowrap",children:a&&i?i:o})]})}function To({value:e,className:t,tone:n="primary"}){const a=`${Math.max(4,Math.min(100,e))}%`,i=n==="secondary"?"from-[var(--secondary)] to-[rgba(78,222,163,0.45)]":n==="tertiary"?"from-[var(--tertiary)] to-[rgba(255,185,95,0.45)]":"from-[var(--primary)] to-[rgba(192,193,255,0.45)]";return s.jsx("div",{className:x("h-1.5 rounded-full bg-[var(--ui-surface-2)]",t),children:s.jsx("div",{className:x("h-full rounded-full bg-gradient-to-r",i),style:{width:a}})})}class Mt extends Error{constructor(n){super(n.message);Ae(this,"status");Ae(this,"code");Ae(this,"details");Ae(this,"requestPath");Ae(this,"response");this.name="ForgeApiError",this.status=n.status,this.code=n.code,this.details=n.details??[],this.requestPath=n.requestPath,this.response=n.response??null}}function Ro(e){return e instanceof Mt?{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 ci(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase()}function Ve(e){const t=e==null?void 0:e.trim();return t||null}function Je(e){return Ve(e)??"Unnamed calendar"}function di(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 _o(e){const t=Ve(e);if(!t)return null;try{const n=new URL(t),i=n.pathname.split("/").map(o=>o.trim()).filter(Boolean).at(-1);return i?`${n.host}/${decodeURIComponent(i)}`:n.host}catch{return t}}function Yt(e){const t=e.map(Ve).filter(n=>!!n);return t.length>0?t.join(" · "):null}function Co(e){const t=[n=>n.providerLabel,n=>Yt([n.providerLabel,n.accountLabel]),n=>Yt([n.providerLabel,n.connectionLabel]),n=>n.connectionLabel,n=>n.accountLabel,n=>_o(n.url),n=>n.url];for(const n of t){const a=e.map(n);if(a.some(o=>!Ve(o)))continue;const i=a.map(o=>ci(o));if(new Set(i).size===e.length)return a}return e.map((n,a)=>Yt([n.providerLabel,`${a+1}`])??`${a+1}`)}function ui(e){const t=new Map,n=new Map;for(const a of e){const i=ci(a.baseName),o=n.get(i)??[];o.push(a),n.set(i,o)}for(const a of n.values()){if(a.length===1){t.set(a[0].id,a[0].baseName);continue}const i=Co(a);a.forEach((o,c)=>{t.set(o.id,`${o.baseName} (${i[c]})`)})}return t}function kt(e){const t=ui(e.calendars.map(n=>({id:n.url,baseName:Je(n.displayName),providerLabel:di(e.provider),connectionLabel:null,accountLabel:e.accountLabel,url:n.url})));return{...e,calendars:e.calendars.map(n=>({...n,dedupedName:t.get(n.url)??Je(n.displayName)}))}}function Io(e,t){const n=new Map(t.map(i=>[i.id,i])),a=ui(e.map(i=>{const o=n.get(i.connectionId);return{id:i.id,baseName:Je(i.title),providerLabel:o?di(o.provider):null,connectionLabel:(o==null?void 0:o.label)??null,accountLabel:(o==null?void 0:o.accountLabel)??null,url:i.remoteId}}));return e.map(i=>({...i,dedupedName:a.get(i.id)??Je(i.title)}))}function Oo(e){return{...e,calendars:Io(e.calendars,e.connections)}}function Tm(e){return"title"in e?Ve(e.dedupedName)??Je(e.title):Ve(e.dedupedName)??Je(e.displayName)}function mi(e){const t=e.startsWith("/")?e:`/${e}`;return t.endsWith("/")?t:`${t}/`}function Eo(e){const t=mi(e);return t==="/"?"/":t.endsWith("/")?t.slice(0,-1):t}function Ao(){return new URL(mi("/forge/"),window.location.origin)}function Es(e){if(e.startsWith("/api/"))return e;const t=e.startsWith("/")?e.slice(1):e;return new URL(t,Ao()).pathname}function us(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(n=>us(n,t+1)):e&&typeof e=="object"?t>=3?"[Object]":Object.fromEntries(Object.entries(e).slice(0,30).map(([n,a])=>[n,us(a,t+1)])):String(e)}function Lo(e){return e?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,us(n)])):{}}async function Kt(e){try{await fetch(Es("/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:Lo(e.details)})})}catch{}}function pi(e){return t=>Kt({...e,...t})}const Do={allowWorkBlockKinds:[],blockWorkBlockKinds:[],allowCalendarIds:[],blockCalendarIds:[],allowEventTypes:[],blockEventTypes:[],allowEventKeywords:[],blockEventKeywords:[],allowAvailability:[],blockAvailability:[]};function Zt(e,t){return t?(e==null?void 0:e.get(t))??null:null}function Ce(e,t){const n=(e==null?void 0:e.userId)??null,a=(e==null?void 0:e.ownerUserId)??(e==null?void 0:e.userId)??null,i=(e==null?void 0:e.user)??Zt(t,n),o=(e==null?void 0:e.ownerUser)??(e==null?void 0:e.user)??Zt(t,a),c=(e==null?void 0:e.assigneeUserIds)??[],d=(e==null?void 0:e.assignees)??c.map(p=>Zt(t,p)).filter(p=>p!==null);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:n,user:i,ownerUserId:a,ownerUser:o,assigneeUserIds:c,assignees:d,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 es(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 ts(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 ss(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)??Do,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 _t(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 fa(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 $o(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 Mo(e){var u,h,j,b,v,C,m,y,O,T,$,V,M,A,G,ee,z,te,be,X,F,J,se,xe,ie,re,ue,we,me,k,L,q,oe,pe,ke,he,le,je,ge,_e,Me,ze,W,Oe,Q,Ne,rt,Nt,Pt,Tt,Y,ot,Rt,lt,Fe,ct,dt,ut,mt,pt,ht,f,w,I,ne,We,Pe,Ee,Ge,Xs,Qs,Ys,Zs,en,tn,sn,nn,an,rn,on,ln,cn,dn,un,mn,pn,hn,gn,fn,vn,yn,bn,xn,wn,kn,Sn,jn,Nn,Pn,Tn,Rn,_n,Cn,In,On,En,An,Ln,Dn,$n,Mn,zn,Fn,Wn,Gn,Hn,Un,qn,Kn,Bn,Vn,Jn,Xn,Qn,Yn,Zn,ea,ta,sa,na,aa,ia,ra,oa;const t=e,n=(e.users??[]).map(fa),a=new Map(n.map(H=>[H.id,H])),i=(e.tasks??[]).map(H=>Ce(H,a)),o=(e.tags??[]).map(ts),c=(e.habits??((u=e.dashboard)==null?void 0:u.habits)??[]).map(_t),d=(t.projects??t.campaigns??[]).map(ss),p=(((h=t.dashboard)==null?void 0:h.projects)??((j=t.dashboard)==null?void 0:j.campaigns)??d).map(ss),g=(((b=t.overview)==null?void 0:b.projects)??((v=t.overview)==null?void 0:v.campaigns)??p).map(ss);return{...e,meta:{apiVersion:"v1",transport:"rest+sse",generatedAt:((C=e.meta)==null?void 0:C.generatedAt)??new Date().toISOString(),backend:((m=e.meta)==null?void 0:m.backend)??"forge-node-runtime",mode:((y=e.meta)==null?void 0:y.mode)??"transitional-node"},metrics:{totalXp:((O=e.metrics)==null?void 0:O.totalXp)??0,level:((T=e.metrics)==null?void 0:T.level)??1,currentLevelXp:(($=e.metrics)==null?void 0:$.currentLevelXp)??0,nextLevelXp:((V=e.metrics)==null?void 0:V.nextLevelXp)??120,xpIntoLevel:((M=e.metrics)==null?void 0:M.xpIntoLevel)??((A=e.metrics)==null?void 0:A.currentLevelXp)??0,xpToNextLevel:((G=e.metrics)==null?void 0:G.xpToNextLevel)??((ee=e.metrics)==null?void 0:ee.nextLevelXp)??120,currentLevelStartXp:((z=e.metrics)==null?void 0:z.currentLevelStartXp)??0,nextLevelTotalXp:((te=e.metrics)==null?void 0:te.nextLevelTotalXp)??(((be=e.metrics)==null?void 0:be.totalXp)??0)+(((X=e.metrics)==null?void 0:X.nextLevelXp)??120),levelCurveVersion:((F=e.metrics)==null?void 0:F.levelCurveVersion)??"legacy-linear-120",weeklyXp:((J=e.metrics)==null?void 0:J.weeklyXp)??0,streakDays:((se=e.metrics)==null?void 0:se.streakDays)??0,comboMultiplier:((xe=e.metrics)==null?void 0:xe.comboMultiplier)??1,momentumScore:((ie=e.metrics)==null?void 0:ie.momentumScore)??0,topGoalId:((re=e.metrics)==null?void 0:re.topGoalId)??null,topGoalTitle:((ue=e.metrics)==null?void 0:ue.topGoalTitle)??null},users:n,strategies:(e.strategies??[]).map($o),userScope:{selectedUserIds:((we=e.userScope)==null?void 0:we.selectedUserIds)??[],selectedUsers:(((me=e.userScope)==null?void 0:me.selectedUsers)??[]).map(fa)},dashboard:{stats:{totalPoints:((L=(k=e.dashboard)==null?void 0:k.stats)==null?void 0:L.totalPoints)??0,completedThisWeek:((oe=(q=e.dashboard)==null?void 0:q.stats)==null?void 0:oe.completedThisWeek)??0,activeGoals:((ke=(pe=e.dashboard)==null?void 0:pe.stats)==null?void 0:ke.activeGoals)??0,alignmentScore:((le=(he=e.dashboard)==null?void 0:he.stats)==null?void 0:le.alignmentScore)??0,focusTasks:((ge=(je=e.dashboard)==null?void 0:je.stats)==null?void 0:ge.focusTasks)??0,overdueTasks:((Me=(_e=e.dashboard)==null?void 0:_e.stats)==null?void 0:Me.overdueTasks)??0,dueThisWeek:((W=(ze=e.dashboard)==null?void 0:ze.stats)==null?void 0:W.dueThisWeek)??0},goals:(((Oe=e.dashboard)==null?void 0:Oe.goals)??[]).map(H=>({...H,...es(H)})),projects:p,tasks:(((Q=e.dashboard)==null?void 0:Q.tasks)??i).map(H=>Ce(H,a)),habits:(((Ne=e.dashboard)==null?void 0:Ne.habits)??c).map(_t),tags:(((rt=e.dashboard)==null?void 0:rt.tags)??o).map(ts),suggestedTags:(((Nt=e.dashboard)==null?void 0:Nt.suggestedTags)??[]).map(ts),owners:((Pt=e.dashboard)==null?void 0:Pt.owners)??[],executionBuckets:(((Tt=e.dashboard)==null?void 0:Tt.executionBuckets)??[]).map(H=>({...H,tasks:(H.tasks??[]).map(Xt=>Ce(Xt,a))})),gamification:((Y=e.dashboard)==null?void 0:Y.gamification)??{totalXp:((ot=e.metrics)==null?void 0:ot.totalXp)??0,level:((Rt=e.metrics)==null?void 0:Rt.level)??1,currentLevelXp:((lt=e.metrics)==null?void 0:lt.currentLevelXp)??0,nextLevelXp:((Fe=e.metrics)==null?void 0:Fe.nextLevelXp)??120,xpIntoLevel:((ct=e.metrics)==null?void 0:ct.xpIntoLevel)??((dt=e.metrics)==null?void 0:dt.currentLevelXp)??0,xpToNextLevel:((ut=e.metrics)==null?void 0:ut.xpToNextLevel)??((mt=e.metrics)==null?void 0:mt.nextLevelXp)??120,currentLevelStartXp:((pt=e.metrics)==null?void 0:pt.currentLevelStartXp)??0,nextLevelTotalXp:((ht=e.metrics)==null?void 0:ht.nextLevelTotalXp)??(((f=e.metrics)==null?void 0:f.totalXp)??0)+(((w=e.metrics)==null?void 0:w.nextLevelXp)??120),levelCurveVersion:((I=e.metrics)==null?void 0:I.levelCurveVersion)??"legacy-linear-120",weeklyXp:((ne=e.metrics)==null?void 0:ne.weeklyXp)??0,streakDays:((We=e.metrics)==null?void 0:We.streakDays)??0,comboMultiplier:((Pe=e.metrics)==null?void 0:Pe.comboMultiplier)??1,momentumScore:((Ee=e.metrics)==null?void 0:Ee.momentumScore)??0,topGoalId:((Ge=e.metrics)==null?void 0:Ge.topGoalId)??null,topGoalTitle:((Xs=e.metrics)==null?void 0:Xs.topGoalTitle)??null},achievements:((Qs=e.dashboard)==null?void 0:Qs.achievements)??[],milestoneRewards:((Ys=e.dashboard)==null?void 0:Ys.milestoneRewards)??[],recentActivity:((Zs=e.dashboard)==null?void 0:Zs.recentActivity)??e.activity??[],notesSummaryByEntity:((en=e.dashboard)==null?void 0:en.notesSummaryByEntity)??{}},overview:{generatedAt:((tn=e.overview)==null?void 0:tn.generatedAt)??new Date().toISOString(),strategicHeader:{streakDays:((nn=(sn=e.overview)==null?void 0:sn.strategicHeader)==null?void 0:nn.streakDays)??((an=e.metrics)==null?void 0:an.streakDays)??0,level:((on=(rn=e.overview)==null?void 0:rn.strategicHeader)==null?void 0:on.level)??((ln=e.metrics)==null?void 0:ln.level)??1,totalXp:((dn=(cn=e.overview)==null?void 0:cn.strategicHeader)==null?void 0:dn.totalXp)??((un=e.metrics)==null?void 0:un.totalXp)??0,currentLevelXp:((pn=(mn=e.overview)==null?void 0:mn.strategicHeader)==null?void 0:pn.currentLevelXp)??((hn=e.metrics)==null?void 0:hn.currentLevelXp)??0,nextLevelXp:((fn=(gn=e.overview)==null?void 0:gn.strategicHeader)==null?void 0:fn.nextLevelXp)??((vn=e.metrics)==null?void 0:vn.nextLevelXp)??120,momentumScore:((bn=(yn=e.overview)==null?void 0:yn.strategicHeader)==null?void 0:bn.momentumScore)??((xn=e.metrics)==null?void 0:xn.momentumScore)??0,focusTasks:((kn=(wn=e.overview)==null?void 0:wn.strategicHeader)==null?void 0:kn.focusTasks)??0,overdueTasks:((jn=(Sn=e.overview)==null?void 0:Sn.strategicHeader)==null?void 0:jn.overdueTasks)??0},projects:g,activeGoals:(((Nn=e.overview)==null?void 0:Nn.activeGoals)??[]).map(H=>({...H,...es(H)})),topTasks:(((Pn=e.overview)==null?void 0:Pn.topTasks)??[]).map(H=>Ce(H,a)),dueHabits:(((Tn=e.overview)==null?void 0:Tn.dueHabits)??((Rn=e.today)==null?void 0:Rn.dueHabits)??((_n=e.dashboard)==null?void 0:_n.habits)??[]).map(_t),recentEvidence:((Cn=e.overview)==null?void 0:Cn.recentEvidence)??[],achievements:((In=e.overview)==null?void 0:In.achievements)??[],domainBalance:((On=e.overview)==null?void 0:On.domainBalance)??[],neglectedGoals:((En=e.overview)==null?void 0:En.neglectedGoals)??[]},today:{generatedAt:((An=e.today)==null?void 0:An.generatedAt)??new Date().toISOString(),directive:{task:(Dn=(Ln=e.today)==null?void 0:Ln.directive)!=null&&Dn.task?Ce(e.today.directive.task,a):null,goalTitle:((Mn=($n=e.today)==null?void 0:$n.directive)==null?void 0:Mn.goalTitle)??null,rewardXp:((Fn=(zn=e.today)==null?void 0:zn.directive)==null?void 0:Fn.rewardXp)??0,sessionLabel:((Gn=(Wn=e.today)==null?void 0:Wn.directive)==null?void 0:Gn.sessionLabel)??"No active session"},timeline:(((Hn=e.today)==null?void 0:Hn.timeline)??[]).map(H=>({...H,tasks:(H.tasks??[]).map(Xt=>Ce(Xt,a))})),dueHabits:(((Un=e.today)==null?void 0:Un.dueHabits)??((qn=e.overview)==null?void 0:qn.dueHabits)??((Kn=e.dashboard)==null?void 0:Kn.habits)??[]).map(_t),dailyQuests:((Bn=e.today)==null?void 0:Bn.dailyQuests)??[],milestoneRewards:((Vn=e.today)==null?void 0:Vn.milestoneRewards)??[],recentHabitRewards:((Jn=e.today)==null?void 0:Jn.recentHabitRewards)??[],momentum:{streakDays:((Qn=(Xn=e.today)==null?void 0:Xn.momentum)==null?void 0:Qn.streakDays)??0,momentumScore:((Zn=(Yn=e.today)==null?void 0:Yn.momentum)==null?void 0:Zn.momentumScore)??0,recoveryHint:((ta=(ea=e.today)==null?void 0:ea.momentum)==null?void 0:ta.recoveryHint)??""}},risk:{generatedAt:((sa=e.risk)==null?void 0:sa.generatedAt)??new Date().toISOString(),overdueTasks:(((na=e.risk)==null?void 0:na.overdueTasks)??[]).map(H=>Ce(H,a)),blockedTasks:(((aa=e.risk)==null?void 0:aa.blockedTasks)??[]).map(H=>Ce(H,a)),neglectedGoals:((ia=e.risk)==null?void 0:ia.neglectedGoals)??[],summary:((ra=e.risk)==null?void 0:ra.summary)??""},goals:(e.goals??[]).map(es),projects:d,tags:o,tasks:i,habits:c,activity:e.activity??((oa=e.dashboard)==null?void 0:oa.recentActivity)??[],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 As(e){const t=typeof e.location=="string"?e.location:"",n=e.place??{label:t,address:"",timezone:"",latitude:null,longitude:null,source:"",externalPlaceId:""};return{...e,place:{label:n.label||t,address:n.address??"",timezone:n.timezone??"",latitude:n.latitude??null,longitude:n.longitude??null,source:n.source??"",externalPlaceId:n.externalPlaceId??""}}}function zo(e){return{...Oo(e),events:e.events.map(As)}}async function ms(e){const t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}const Fo="/api/v1/diagnostics/logs",Et="/api/v1/auth/operator-session",Wo="x-forge-source",Go="ui";function Ls(e){return typeof e=="object"&&e!==null?e:null}function Ds(e){const t=Ls(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 Ho(e,t){return e.status===401&&Ds(t)==="auth_required"}function hi(e){return e===Fo}function Uo(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 gi(e){return e.path!==Et&&Ho(e.response,e.body)&&Uo(e.init)}function $s(e,t,n){const a=Ls(n),i=Array.isArray(a==null?void 0:a.details)?a.details:[];return new Mt({status:t.status,code:Ds(n),message:typeof(a==null?void 0:a.error)=="string"?a.error:typeof(a==null?void 0:a.message)=="string"?a.message:typeof n=="string"?n:`Request failed: ${t.status}`,requestPath:e,details:i,response:typeof n=="string"||n&&typeof n=="object"?n:null})}function Ms(e,t,n){if(hi(e))return;const a=Ls(n),i=Array.isArray(a==null?void 0:a.details)?a.details:[];Kt({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:Ds(n),response:typeof n=="string"||n&&typeof n=="object"?n:null,validationIssues:i}})}async function ps(e,t){const n=await hs(e,t),a=await ms(n);return{response:n,body:a}}async function hs(e,t){const n=new Headers(t==null?void 0:t.headers);n.set(Wo,Go),(t==null?void 0:t.body)!==void 0&&!(typeof FormData<"u"&&t.body instanceof FormData)&&!n.has("content-type")&&n.set("content-type","application/json");let a;try{a=await fetch(Es(e),{...t,credentials:"same-origin",headers:n})}catch(i){throw hi(e)||Kt({level:"error",scope:"frontend_api",eventKey:"request_network_failure",message:`API request failed before reaching Forge: ${e}`,route:e,functionName:"request",details:{error:i instanceof Error?{name:i.name,message:i.message,stack:i.stack??null}:String(i)}}),i}return a}let Ct=null;async function fi(){Ct||(Ct=(async()=>{const{response:e,body:t}=await ps(Et);if(!e.ok)throw Ms(Et,e,t),$s(Et,e,t)})().finally(()=>{Ct=null})),await Ct}async function r(e,t){let{response:n,body:a}=await ps(e,t);if(gi({path:e,init:t,response:n,body:a})&&(await fi(),{response:n,body:a}=await ps(e,t)),!n.ok)throw Ms(e,n,a),$s(e,n,a);return a}async function vi(e,t){let n=await hs(e,t),a=null;if(n.ok||(a=await ms(n)),gi({path:e,init:t,response:n,body:a})&&(await fi(),n=await hs(e,t),a=n.ok?null:await ms(n)),!n.ok)throw Ms(e,n,a),$s(e,n,a);const i=n.headers.get("content-disposition"),o=i==null?void 0:i.match(/filename=\"([^\"]+)\"/i);return{blob:await n.blob(),fileName:(o==null?void 0:o[1])??null,mimeType:n.headers.get("content-type")||"application/octet-stream"}}function Bt(e){return e.map(t=>({contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null})).filter(t=>t.contentMarkdown.length>0)}const qo="forge.selected-user-ids";function Ko(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(qo);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean):[]}catch{return[]}}function Bo(e){return e??Ko()}function R(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):void 0}function P(e,t){for(const n of Bo(t))n.trim()&&e.append("userIds",n.trim())}function Vo(){return r("/api/v1/auth/operator-session")}function Jo(){return r("/api/v1/auth/operator-session",{method:"DELETE"})}function Xo(e){const t=new URLSearchParams;t.set("profile","shell"),P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/context${n}`).then(Mo)}function Rm(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/life-force${n}`)}function _m(e,t,n){const a=new URLSearchParams;P(a,R(n));const i=a.size>0?`?${a.toString()}`:"";return r(`/api/v1/life-force/templates/${e}${i}`,{method:"PUT",body:JSON.stringify(t)})}function Cm(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/life-force/fatigue-signals${a}`,{method:"POST",body:JSON.stringify(e)})}function Im(e,t){var i;const n=new URLSearchParams;P(n,R(e)),(i=t==null?void 0:t.q)!=null&&i.trim()&&n.set("q",t.q.trim());for(const o of(t==null?void 0:t.entityKinds)??[])n.append("entityKind",o);for(const o of(t==null?void 0:t.relationKinds)??[])n.append("relationKind",o);for(const o of(t==null?void 0:t.tags)??[])n.append("tag",o);for(const o of(t==null?void 0:t.owners)??[])n.append("owner",o);t!=null&&t.updatedFrom&&n.set("updatedFrom",t.updatedFrom),t!=null&&t.updatedTo&&n.set("updatedTo",t.updatedTo),typeof(t==null?void 0:t.limit)=="number"&&Number.isFinite(t.limit)&&n.set("limit",String(t.limit)),t!=null&&t.focusNodeId&&n.set("focusNodeId",t.focusNodeId);const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/knowledge-graph${a}`).then(o=>o.graph)}function Om(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 n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/preferences/workspace${n}`)}function Em(e){return r("/api/v1/preferences/game/start",{method:"POST",body:JSON.stringify(e)})}function Am(e){return r("/api/v1/preferences/catalogs",{method:"POST",body:JSON.stringify(e)})}function Lm(e,t){return r(`/api/v1/preferences/catalogs/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Dm(e){return r(`/api/v1/preferences/catalogs/${e}`,{method:"DELETE"})}function $m(e){return r("/api/v1/preferences/catalog-items",{method:"POST",body:JSON.stringify(e)})}function Mm(e,t){return r(`/api/v1/preferences/catalog-items/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function zm(e){return r(`/api/v1/preferences/catalog-items/${e}`,{method:"DELETE"})}function Fm(e){return r("/api/v1/preferences/contexts",{method:"POST",body:JSON.stringify(e)})}function Wm(e,t){return r(`/api/v1/preferences/contexts/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Gm(e){return r("/api/v1/preferences/contexts/merge",{method:"POST",body:JSON.stringify(e)})}function Hm(e){return r("/api/v1/preferences/items",{method:"POST",body:JSON.stringify(e)})}function Um(e,t){return r(`/api/v1/preferences/items/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function qm(e){return r("/api/v1/preferences/items/from-entity",{method:"POST",body:JSON.stringify(e)})}function Km(e){return r("/api/v1/preferences/judgments",{method:"POST",body:JSON.stringify(e)})}function Bm(e){return r("/api/v1/preferences/signals",{method:"POST",body:JSON.stringify(e)})}function Vm(e,t){return r(`/api/v1/preferences/items/${e}/score`,{method:"PATCH",body:JSON.stringify(t)})}function Jm(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/insights${n}`)}function Xm(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/psyche/overview${n}`)}function Qm(){return r("/api/v1/psyche/metrics")}function Ym(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/psyche/questionnaires${n}`)}function Zm(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/psyche/questionnaires/${e}${a}`)}function ep(e){return r("/api/v1/psyche/questionnaires",{method:"POST",body:JSON.stringify(e)})}function tp(e,t={}){return r(`/api/v1/psyche/questionnaires/${e}/clone`,{method:"POST",body:JSON.stringify(t)})}function sp(e){return r(`/api/v1/psyche/questionnaires/${e}/draft`,{method:"POST",body:JSON.stringify({})})}function np(e,t){return r(`/api/v1/psyche/questionnaires/${e}/draft`,{method:"PATCH",body:JSON.stringify(t)})}function ap(e,t={}){return r(`/api/v1/psyche/questionnaires/${e}/publish`,{method:"POST",body:JSON.stringify(t)})}function ip(e,t={}){return r(`/api/v1/psyche/questionnaires/${e}/runs`,{method:"POST",body:JSON.stringify(t)})}function rp(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/psyche/questionnaire-runs/${e}${a}`)}function op(e,t){return r(`/api/v1/psyche/questionnaire-runs/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function lp(e){return r(`/api/v1/psyche/questionnaire-runs/${e}/complete`,{method:"POST",body:JSON.stringify({})})}function Qo(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/psyche/values${n}`)}function cp(e){return r("/api/v1/psyche/values",{method:"POST",body:JSON.stringify(e)})}function dp(e,t){return r(`/api/v1/psyche/values/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Yo(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/psyche/patterns${n}`)}function up(e){return r("/api/v1/psyche/patterns",{method:"POST",body:JSON.stringify(e)})}function mp(e,t){return r(`/api/v1/psyche/patterns/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Zo(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/psyche/behaviors${n}`)}function pp(e){return r("/api/v1/psyche/behaviors",{method:"POST",body:JSON.stringify(e)})}function hp(e,t){return r(`/api/v1/psyche/behaviors/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function gp(){return r("/api/v1/psyche/schema-catalog")}function el(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/psyche/beliefs${n}`)}function fp(e){return r("/api/v1/psyche/beliefs",{method:"POST",body:JSON.stringify(e)})}function vp(e,t){return r(`/api/v1/psyche/beliefs/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function yp(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/psyche/modes${n}`)}function bp(e){return r("/api/v1/psyche/modes",{method:"POST",body:JSON.stringify(e)})}function xp(e,t){return r(`/api/v1/psyche/modes/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function wp(){return r("/api/v1/psyche/mode-guides")}function kp(e){return r("/api/v1/psyche/mode-guides",{method:"POST",body:JSON.stringify(e)})}function zs(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 Sp(e){var a;return{flashcards:((a=(await Sl({searches:[{entityTypes:["flashcard"],userIds:R(e),limit:200}]})).results[0])==null?void 0:a.matches)??[]}}async function jp(e){const t=await xl({operations:[{entityType:"flashcard",data:e}],atomic:!0});return{flashcard:zs(t.results[0]??{})}}async function Np(e,t){const n=await wl({operations:[{entityType:"flashcard",id:e,patch:t}],atomic:!0});return{flashcard:zs(n.results[0]??{})}}async function Pp(e){const t=await kl({operations:[{entityType:"flashcard",id:e}],atomic:!0});return{flashcard:zs(t.results[0]??{})}}function Tp(){return r("/api/v1/psyche/event-types")}function Rp(){return r("/api/v1/psyche/emotions")}function tl(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/psyche/reports${n}`)}function _p(e){return r("/api/v1/psyche/reports",{method:"POST",body:JSON.stringify(e)})}function Cp(e){return r(`/api/v1/psyche/reports/${e}`)}function Ip(e,t){return r(`/api/v1/psyche/reports/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Op(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 a of e.linkedTo??[])t.append("linkedTo",`${a.entityType}:${a.entityId}`);for(const a of e.tags??[])a.trim()&&t.append("tags",a.trim());for(const a of e.textTerms??[])a.trim()&&t.append("textTerms",a.trim());e.author&&t.set("author",e.author),e.query&&t.set("query",e.query),P(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 n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/notes${n}`)}function Ep(e){return r("/api/v1/notes",{method:"POST",body:JSON.stringify(e)})}function Ap(e){return r(`/api/v1/notes/${e}`)}function Lp(e,t){return r(`/api/v1/notes/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Dp(e,t="soft"){const n=t==="soft"?"":`?mode=${t}`;return r(`/api/v1/notes/${e}${n}`,{method:"DELETE"})}function $p(){return r("/api/v1/wiki/settings")}function Mp(e){return r("/api/v1/wiki/spaces",{method:"POST",body:JSON.stringify(e)})}function zp(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 n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/wiki/pages${n}`)}function Fp(e){return r(`/api/v1/wiki/pages/${e}`)}function Wp(e={}){var n;const t=new URLSearchParams;return(n=e.spaceId)!=null&&n.trim()&&t.set("spaceId",e.spaceId.trim()),r(`/api/v1/wiki/home${t.size>0?`?${t.toString()}`:""}`)}function Gp(e){var n;const t=new URLSearchParams;return(n=e.spaceId)!=null&&n.trim()&&t.set("spaceId",e.spaceId.trim()),r(`/api/v1/wiki/by-slug/${encodeURIComponent(e.slug)}${t.size>0?`?${t.toString()}`:""}`)}function Hp(e={}){var n;const t=new URLSearchParams;return(n=e.spaceId)!=null&&n.trim()&&t.set("spaceId",e.spaceId.trim()),e.kind&&t.set("kind",e.kind),r(`/api/v1/wiki/tree${t.size>0?`?${t.toString()}`:""}`)}function Up(e){return r("/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 qp(e,t){return r(`/api/v1/wiki/pages/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Kp(e,t="soft"){const n=new URLSearchParams;return n.set("mode",t),r(`/api/v1/wiki/pages/${e}?${n.toString()}`,{method:"DELETE"})}function Bp(e){return r("/api/v1/wiki/search",{method:"POST",body:JSON.stringify(e)})}function Vp(e={}){return r("/api/v1/wiki/sync",{method:"POST",body:JSON.stringify(e)})}function Jp(e={}){return r("/api/v1/wiki/reindex",{method:"POST",body:JSON.stringify(e)})}function Xp(e){return r("/api/v1/wiki/settings/embedding-profiles",{method:"POST",body:JSON.stringify(e)})}function Qp(e,t){return r(`/api/v1/wiki/settings/${e}-profiles/${t}`,{method:"DELETE"})}function Yp(e){return r("/api/v1/wiki/ingest-jobs",{method:"POST",body:JSON.stringify(e)})}function Zp(e){var n,a,i;const t=new FormData;return(n=e.spaceId)!=null&&n.trim()&&t.set("spaceId",e.spaceId.trim()),(a=e.titleHint)!=null&&a.trim()&&t.set("titleHint",e.titleHint.trim()),(i=e.llmProfileId)!=null&&i.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)}),r("/api/v1/wiki/ingest-jobs/uploads",{method:"POST",body:t})}function sl(e={}){var n;const t=new URLSearchParams;return(n=e.spaceId)!=null&&n.trim()&&t.set("spaceId",e.spaceId.trim()),typeof e.limit=="number"&&t.set("limit",String(e.limit)),r(`/api/v1/wiki/ingest-jobs${t.size>0?`?${t.toString()}`:""}`)}function eh(e){return r(`/api/v1/wiki/ingest-jobs/${e}`)}function th(e){return r("/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 sh(e){return r(`/api/v1/wiki/ingest-jobs/${e}`,{method:"DELETE"})}function nh(e){return r(`/api/v1/wiki/ingest-jobs/${e}/rerun`,{method:"POST"})}function ah(e){return r(`/api/v1/wiki/ingest-jobs/${e}/resume`,{method:"POST"})}function ih(e){return r(`/api/v1/wiki/ingest-jobs/${e.jobId}/review`,{method:"POST",body:JSON.stringify({decisions:e.decisions})})}function rh(e){return r("/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 oh(e){return r(`/api/v1/insights/${e}`,{method:"DELETE"})}function lh(e,t,n=""){return r(`/api/v1/insights/${e}/feedback`,{method:"POST",body:JSON.stringify({feedbackType:t,note:n})})}function ch(){return r("/api/v1/reviews/weekly")}function dh(){return r("/api/v1/reviews/weekly/finalize",{method:"POST"})}function uh(e={}){const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),P(t,R(e.userIds));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/calendar/overview${n}`).then(a=>({...a,calendar:zo(a.calendar)}))}function mh(e={}){const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),P(t,R(e.userIds));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/psyche/self-observation/calendar${n}`)}function ph(e){var n;const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),(n=e.search)!=null&&n.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 a of e.tags??[]){const i=a.trim();i&&t.append("tags",i)}return t.set("format",e.format),P(t,R(e.userIds)),vi(`/api/v1/psyche/self-observation/calendar/export?${t.toString()}`)}function hh(){return r("/api/v1/calendar/connections")}function gh(e){return r("/api/v1/calendar/discovery",{method:"POST",body:JSON.stringify(e)}).then(t=>({...t,discovery:kt(t.discovery)}))}function fh(){return r("/api/v1/calendar/macos-local/status")}function vh(){return r("/api/v1/calendar/macos-local/request-access",{method:"POST"})}function yh(){return r("/api/v1/calendar/macos-local/discovery").then(e=>({...e,discovery:{...e.discovery,sources:e.discovery.sources.map(t=>({...t,calendars:kt({provider:"macos_local",accountLabel:t.accountLabel,serverUrl:"forge-macos-local://eventkit/",principalUrl:null,homeUrl:null,calendars:t.calendars}).calendars}))}}))}function bh(e){return r("/api/v1/calendar/oauth/google/start",{method:"POST",body:JSON.stringify(e)})}function xh(e){return r(`/api/v1/calendar/oauth/google/session/${e}`).then(t=>({...t,session:{...t.session,discovery:t.session.discovery?kt(t.session.discovery):null}}))}function wh(e){return r("/api/v1/calendar/oauth/microsoft/start",{method:"POST",body:JSON.stringify(e)})}function kh(e){return r("/api/v1/calendar/oauth/microsoft/test-config",{method:"POST",body:JSON.stringify(e)})}function Sh(e){return r(`/api/v1/calendar/oauth/microsoft/session/${e}`).then(t=>({...t,session:{...t.session,discovery:t.session.discovery?kt(t.session.discovery):null}}))}function jh(e){return r(`/api/v1/calendar/connections/${e}/discovery`).then(t=>({...t,discovery:kt(t.discovery)}))}function Nh(e){return r("/api/v1/calendar/connections",{method:"POST",body:JSON.stringify(e)})}function Ph(e){return r(`/api/v1/calendar/connections/${e}/sync`,{method:"POST"})}function Th(e,t){return r(`/api/v1/calendar/connections/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Rh(e){return r(`/api/v1/calendar/connections/${e}`,{method:"DELETE"})}function _h(){return r("/api/v1/calendar/calendars")}function Ch(e){return r("/api/v1/calendar/work-block-templates",{method:"POST",body:JSON.stringify(e)})}function Ih(e,t){return r(`/api/v1/calendar/work-block-templates/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Oh(e){return r(`/api/v1/calendar/work-block-templates/${e}`,{method:"DELETE"})}function Eh(e){return r("/api/v1/calendar/events",{method:"POST",body:JSON.stringify(e)}).then(t=>({...t,event:As(t.event)}))}function Ah(e,t){return r(`/api/v1/calendar/events/${e}`,{method:"PATCH",body:JSON.stringify(t)}).then(n=>({...n,event:As(n.event)}))}function Lh(e){return r(`/api/v1/calendar/events/${e}`,{method:"DELETE"})}function Dh(e){return r("/api/v1/calendar/timeboxes",{method:"POST",body:JSON.stringify(e)})}function $h(e,t){return r(`/api/v1/calendar/timeboxes/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Mh(e){return r(`/api/v1/calendar/timeboxes/${e}`,{method:"DELETE"})}function zh(e){return r("/api/v1/calendar/timeboxes/recommend",{method:"POST",body:JSON.stringify(e)})}function Fh(e={}){const t=new URLSearchParams;P(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 n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/habits${n}`)}function Wh(e){return r("/api/v1/habits",{method:"POST",body:JSON.stringify({...e,linkedBehaviorId:e.linkedBehaviorId||null})})}function Gh(e,t){return r(`/api/v1/habits/${e}`,{method:"PATCH",body:JSON.stringify({...t,linkedBehaviorId:t.linkedBehaviorId===""?null:t.linkedBehaviorId})})}function Hh(e){return r(`/api/v1/habits/${e}`,{method:"DELETE"})}function Uh(e,t){return r(`/api/v1/habits/${e}/check-ins`,{method:"POST",body:JSON.stringify(t)})}function qh(e,t){return r(`/api/v1/habits/${e}/check-ins/${encodeURIComponent(t)}`,{method:"DELETE"})}function Kh(e){return r(`/api/v1/projects/${e}/board`)}function Bh(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 a of e.userIds)typeof a=="string"&&a.trim().length>0&&t.append("userIds",a);if(Array.isArray(e==null?void 0:e.assigneeIds))for(const a of e.assigneeIds)typeof a=="string"&&a.trim().length>0&&t.append("assigneeIds",a);const n=t.toString().length>0?`?${t.toString()}`:"";return r(`/api/v1/work-items/hierarchy${n}`)}function Vh(){return r("/api/v1/operator/context")}function yi(){return r("/api/v1/settings")}function nl(){return r("/api/v1/doctor")}function al(e){return r("/api/v1/doctor/fixes",{method:"POST",body:JSON.stringify(e)})}function Jh(e){return r("/api/v1/settings/models/connections",{method:"POST",body:JSON.stringify(e)})}function Xh(e){return r(`/api/v1/settings/models/connections/${e}`,{method:"DELETE"})}function Qh(e){return r("/api/v1/settings/models/connections/test",{method:"POST",body:JSON.stringify(e)})}function Yh(){return r("/api/v1/settings/models/oauth/openai-codex/start",{method:"POST"})}function Zh(e){return r(`/api/v1/settings/models/oauth/openai-codex/session/${e}`)}function eg(e,t){return r(`/api/v1/settings/models/oauth/openai-codex/session/${e}/manual`,{method:"POST",body:JSON.stringify({codeOrUrl:t})})}function tg(e){return r(`/api/v1/surfaces/${e}/layout`)}function sg(e,t){return r(`/api/v1/surfaces/${e}/layout`,{method:"PUT",body:JSON.stringify(t)})}function ng(e){return r(`/api/v1/surfaces/${e}/layout/reset`,{method:"POST"})}function il(){return r("/api/v1/workbench/flows")}function ag(e){return r("/api/v1/workbench/flows",{method:"POST",body:JSON.stringify(e)})}function rl(e){return r(`/api/v1/workbench/flows/${e}`)}function ol(e,t){return r(`/api/v1/workbench/flows/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function ll(e){return r(`/api/v1/workbench/flows/${e}`,{method:"DELETE"})}function cl(e,t){return r(`/api/v1/workbench/flows/${e}/run`,{method:"POST",body:JSON.stringify(t)})}function dl(e,t){return r(`/api/v1/workbench/flows/${e}/chat`,{method:"POST",body:JSON.stringify(t)})}function ul(e,t){return r(`/api/v1/workbench/flows/${e}/runs/${t}`)}function ml(e,t){return r(`/api/v1/workbench/flows/${e}/runs/${t}/nodes`)}function pl(e,t,n){return r(`/api/v1/workbench/flows/${e}/runs/${t}/nodes/${n}`)}function hl(e,t){return r(`/api/v1/workbench/flows/${e}/nodes/${t}/output`)}function ig(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/health/overview${n}`)}function gl(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/health/sleep${n}`)}function rg(e){return r(`/api/v1/health/sleep/${e}/raw`)}function og(e,t={}){const n=new URLSearchParams;P(n,R(e)),t.compact&&n.set("compact","1");const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/fitness${a}`)}function lg(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/health/training-load${n}`)}function cg(e,t="adaptive"){const n=new URLSearchParams({resolution:t});return r(`/api/v1/health/workouts/${e}/detail?${n.toString()}`)}function dg(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/health/vitals${n}`)}function ug(e,t){const n=new URLSearchParams;P(n,R(e)),t!=null&&t.dateKey&&n.set("dateKey",t.dateKey),t!=null&&t.dayStartAt&&n.set("dayStartAt",t.dayStartAt),t!=null&&t.dayEndAt&&n.set("dayEndAt",t.dayEndAt),t!=null&&t.timeZone&&n.set("timeZone",t.timeZone);const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/weight-loss${a}`)}function mg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/weight-loss/target${a}`,{method:"PATCH",body:JSON.stringify(e)})}function pg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/weight-loss/daily-active-calories${a}`,{method:"PATCH",body:JSON.stringify(e)})}function hg(e){const t=new URLSearchParams;P(t,R(e.userIds));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/health/weight-loss/foods/search${n}`,{method:"POST",body:JSON.stringify({query:e.query,limit:e.limit})})}function gg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/weight-loss/food-logs${a}`,{method:"POST",body:JSON.stringify(e)})}function fg(e,t,n){const a=new URLSearchParams;P(a,R(n));const i=a.size>0?`?${a.toString()}`:"";return r(`/api/v1/health/weight-loss/food-logs/${e}${i}`,{method:"PATCH",body:JSON.stringify(t)})}function vg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/weight-loss/food-logs/${e}${a}`,{method:"DELETE"})}function yg(e){const t=new URLSearchParams;P(t,R(e.userIds));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/health/weight-loss/parse${n}`,{method:"POST",body:JSON.stringify({text:e.text,mealTime:e.mealTime,imageRefs:e.imageRefs,connectionId:e.connectionId,commitCandidate:e.commitCandidate})})}function bg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/weight-loss/body-checkins${a}`,{method:"POST",body:JSON.stringify(e)})}function xg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/weight-loss/appearance-checkins${a}`,{method:"POST",body:JSON.stringify(e)})}function wg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/weight-loss/subjective-checkins${a}`,{method:"POST",body:JSON.stringify(e)})}function kg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/health/weight-loss/gut-checkins${a}`,{method:"POST",body:JSON.stringify(e)})}function Sg(e){const t=new URLSearchParams;e!=null&&e.date&&t.set("date",e.date),P(t,R(e==null?void 0:e.userIds));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/movement/day${n}`)}function jg(e){const t=new URLSearchParams;e!=null&&e.month&&t.set("month",e.month),P(t,R(e==null?void 0:e.userIds));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/movement/month${n}`)}function Ng(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/movement/all-time${n}`)}function Pg(e){const t=new URLSearchParams;P(t,R(e==null?void 0:e.userIds));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/screen-time/day${n}`)}function Tg(e){const t=new URLSearchParams;P(t,R(e==null?void 0:e.userIds));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/screen-time/month${n}`)}function Rg(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/screen-time/all-time${n}`)}function _g(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/screen-time/settings${n}`)}function Cg(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/movement/settings${n}`)}function Ig(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/movement/settings${a}`,{method:"PATCH",body:JSON.stringify(e)})}function Og(e){const t=new URLSearchParams;P(t,R(e));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/movement/places${n}`)}function Eg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/movement/places${a}`,{method:"POST",body:JSON.stringify(e)})}function Ag(e,t){return r(`/api/v1/movement/places/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Lg(e,t){return r(`/api/v1/movement/stays/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Dg(e){return r(`/api/v1/movement/trips/${e}`)}function $g(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/movement/boxes/${e}${a}`)}function Mg(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"),P(t,R(e==null?void 0:e.userIds));const n=t.size>0?`?${t.toString()}`:"";return r(`/api/v1/movement/timeline${n}`)}function zg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/movement/user-boxes${a}`,{method:"POST",body:JSON.stringify(e)})}function Fg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/movement/user-boxes/preflight${a}`,{method:"POST",body:JSON.stringify(e)})}function Wg(e,t,n){const a=new URLSearchParams;P(a,R(n));const i=a.size>0?`?${a.toString()}`:"";return r(`/api/v1/movement/user-boxes/${e}${i}`,{method:"PATCH",body:JSON.stringify(t)})}function Gg(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.size>0?`?${n.toString()}`:"";return r(`/api/v1/movement/user-boxes/${e}${a}`,{method:"DELETE"})}function Hg(e,t,n){const a=new URLSearchParams;P(a,R(n));const i=a.size>0?`?${a.toString()}`:"";return r(`/api/v1/movement/automatic-boxes/${e}/invalidate${i}`,{method:"POST",body:JSON.stringify(t)})}function Ug(e){return r("/api/v1/movement/selection",{method:"POST",body:JSON.stringify(e)})}function qg(e){return r("/api/v1/health/pairing-sessions",{method:"POST",body:JSON.stringify(e??{})})}function Kg(e){return r(`/api/v1/health/pairing-sessions/${e}`,{method:"DELETE"})}function Bg(e,t,n){return r(`/api/v1/health/pairing-sessions/${e}/sources/${t}`,{method:"PATCH",body:JSON.stringify({desiredEnabled:n})})}function Vg(e){return r("/api/v1/health/pairing-sessions/revoke-all",{method:"POST",body:JSON.stringify(e??{})})}function Jg(e,t){return r(`/api/v1/health/workouts/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function fl(e,t){return r(`/api/v1/health/sleep/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Xg(){return r("/api/v1/users/directory")}function Qg(e,t){return r(`/api/v1/users/access-grants/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Yg(e){return r("/api/v1/users",{method:"POST",body:JSON.stringify(e)})}function Zg(e,t){return r(`/api/v1/users/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function ef(e){return r("/api/v1/strategies",{method:"POST",body:JSON.stringify(e)})}function tf(e){return r(`/api/v1/strategies/${e}`)}function sf(e,t){return r(`/api/v1/strategies/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function nf(e){return r(`/api/v1/strategies/${e}`,{method:"DELETE"})}function af(){return r("/api/v1/settings/bin")}function rf(){return r("/api/v1/settings/data")}function of(e){return r("/api/v1/settings/data",{method:"PATCH",body:JSON.stringify(e)})}function lf(){return r("/api/v1/settings/data/scan",{method:"POST",body:JSON.stringify({})})}function cf(e=""){return r("/api/v1/settings/data/backups",{method:"POST",body:JSON.stringify({note:e})})}function df(e,t=!0){return r(`/api/v1/settings/data/backups/${e}/restore`,{method:"POST",body:JSON.stringify({createSafetyBackup:t})})}function uf(e){return r("/api/v1/settings/data/switch-root",{method:"POST",body:JSON.stringify(e)})}function mf(e){return vi(`/api/v1/settings/data/export?format=${e}`)}function pf(){return r("/api/v1/agents/sessions")}function hf(e){return r(`/api/v1/agents/sessions/${e}/history`)}function gf(e,t=""){return r(`/api/v1/agents/sessions/${e}/reconnect`,{method:"POST",body:JSON.stringify({note:t})})}function ff(e,t={}){return r(`/api/v1/agents/sessions/${e}/disconnect`,{method:"POST",body:JSON.stringify(t)})}function vf(){return r("/api/v1/agents/onboarding")}function yf(){return r("/api/v1/approval-requests")}function bf(e,t=""){return r(`/api/v1/approval-requests/${e}/approve`,{method:"POST",body:JSON.stringify({note:t})})}function xf(e,t=""){return r(`/api/v1/approval-requests/${e}/reject`,{method:"POST",body:JSON.stringify({note:t})})}function wf(){return r("/api/v1/rewards/rules")}function kf(e,t){return r(`/api/v1/rewards/rules/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Sf(e){return r("/api/v1/rewards/bonus",{method:"POST",body:JSON.stringify(e)})}function jf(e=50){return r(`/api/v1/rewards/ledger?limit=${e}`)}function vl(e){const t=new URLSearchParams;P(t,R(e));const n=t.toString()?`?${t}`:"";return r(`/api/v1/metrics/xp${n}`)}function Nf(e){const t=new URLSearchParams;P(t,R(e));const n=t.toString()?`?${t}`:"";return r(`/api/v1/gamification/catalog${n}`)}function bi(){return r("/api/v1/gamification/assets")}function xi(e){return r("/api/v1/gamification/assets/install",{method:"POST",body:JSON.stringify({style:e})})}function Pf(e,t){const n=new URLSearchParams;P(n,R(t));const a=n.toString()?`?${n}`:"";return r(`/api/v1/gamification/equipment${a}`,{method:"PUT",body:JSON.stringify(e)})}function yl(e){return r(`/api/v1/gamification/celebrations/${e}/seen`,{method:"POST"})}function bl(e){return r("/api/v1/settings",{method:"PATCH",body:JSON.stringify(e)})}function xl(e){return r("/api/v1/entities/create",{method:"POST",body:JSON.stringify(e)})}function wl(e){return r("/api/v1/entities/update",{method:"POST",body:JSON.stringify(e)})}function kl(e){return r("/api/v1/entities/delete",{method:"POST",body:JSON.stringify(e)})}function Tf(e){return r("/api/v1/entities/restore",{method:"POST",body:JSON.stringify(e)})}function Sl(e){return r("/api/v1/entities/search",{method:"POST",body:JSON.stringify(e)})}function Rf(e){return r("/api/v1/settings/tokens",{method:"POST",body:JSON.stringify(e)})}function _f(e){return r(`/api/v1/settings/tokens/${e}/rotate`,{method:"POST"})}function Cf(e){return r(`/api/v1/settings/tokens/${e}/revoke`,{method:"POST"})}function If(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"),P(t,R(e.userIds)),r(`/api/v1/activity?${t.toString()}`)}function Of(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),r(`/api/v1/diagnostics/logs?${t.toString()}`)}function jl(e){return r("/api/v1/goals",{method:"POST",body:JSON.stringify({...e,notes:Bt(e.notes)})})}function Nl(e){return r("/api/v1/projects",{method:"POST",body:JSON.stringify({...e,notes:Bt(e.notes)})})}function Pl(e,t){return r(`/api/v1/projects/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Ef(e,t="soft"){return r(`/api/v1/projects/${e}${t==="hard"?"?mode=hard":""}`,{method:"DELETE"})}function Tl(e,t){return r(`/api/v1/goals/${e}`,{method:"PATCH",body:JSON.stringify(t)})}function Af(e){return r(`/api/v1/goals/${e}`,{method:"DELETE"})}function Rl(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:Bt(e.notes)};return r("/api/v1/tasks",{method:"POST",body:JSON.stringify(t)})}function Lf(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:Bt(e.notes)};return r("/api/v1/work-items",{method:"POST",body:JSON.stringify(t)})}function va(e,t){return r(`/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 Df(e,t){return r(`/api/v1/tasks/${e}/split`,{method:"POST",body:JSON.stringify(t)})}function $f(e){return r(`/api/v1/tasks/${e}`,{method:"DELETE"})}function Mf(e){return r(`/api/v1/tasks/${e}/uncomplete`,{method:"POST",body:JSON.stringify({})})}function zf(e){return r(`/api/v1/tasks/${e}/context`)}function Ff(e){return r("/api/v1/operator/log-work",{method:"POST",body:JSON.stringify(e)})}function Wf(e){return r("/api/v1/work-adjustments",{method:"POST",body:JSON.stringify(e)})}function Gf(e,t="Removed from the visible archive."){return r(`/api/v1/activity/${e}/remove`,{method:"POST",body:JSON.stringify({reason:t})})}function _l(e){return r("/api/v1/session-events",{method:"POST",body:JSON.stringify(e)})}function Cl(e,t){return r(`/api/v1/tasks/${e}/runs`,{method:"POST",body:JSON.stringify(t)})}function Hf(){return r("/api/v1/git-helper/overview")}function Uf(e){var n,a;const t=new URLSearchParams;return t.set("kind",e.kind),(n=e.query)!=null&&n.trim()&&t.set("query",e.query.trim()),(a=e.repository)!=null&&a.trim()&&t.set("repository",e.repository.trim()),r(`/api/v1/git-helper/search?${t.toString()}`)}function Il(e,t){return r(`/api/v1/task-runs/${e}/heartbeat`,{method:"POST",body:JSON.stringify(t)})}function Ol(e,t={}){return r(`/api/v1/task-runs/${e}/focus`,{method:"POST",body:JSON.stringify(t)})}function El(e,t){return r(`/api/v1/task-runs/${e}/complete`,{method:"POST",body:JSON.stringify(t)})}function Al(e,t){return r(`/api/v1/task-runs/${e}/release`,{method:"POST",body:JSON.stringify(t)})}const Ll=[{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."}],Xe="dramatic-smithie",qf=["item-trophy-xp-levels-the-first-heat","item-trophy-tasks-anvil-marathon","item-unlock-streaks-molten-crown-fire"];function St(e){return Ll.some(t=>t.value===e)?e:Xe}function At(e,t=512,n=Xe){const a="/forge/",i=a.endsWith("/")?a:`${a}/`,o=St(n),c=e.startsWith("item-")?"items":e.startsWith("mascot-")?"mascots":"";return`${i}gamification/sprites/themes/${o}/${c?`${c}/`:""}${e}-${t}.webp`}function gs(e=Xe){const t="/forge/",n=t.endsWith("/")?t:`${t}/`,a=St(e);return`${n}gamification-previews/${a}-mascot.webp`}function Kf(e,t){const n="/forge/",a=n.endsWith("/")?n:`${n}/`,i=St(e);return`${a}gamification-previews/${i}-${t}.webp`}function wi(){var t;const e=Cs({queryKey:["forge-settings"],queryFn:yi,staleTime:3e4});return St(((t=e==null?void 0:e.data)==null?void 0:t.settings.gamificationTheme)??Xe)}const fe={totalXp:0,level:1,currentLevelXp:0,nextLevelXp:100,levelCurveVersion:"smith-forge",weeklyXp:0,streakDays:0,comboMultiplier:1,momentumScore:0,topGoalId:null,topGoalTitle:null};function Lt(e){e.currentTarget.hidden=!0}function ki(e){const t=(e==null?void 0:e.totalXp)??fe.totalXp,n=Math.max(1,(e==null?void 0:e.level)??fe.level),a=(e==null?void 0:e.xpIntoLevel)??(e==null?void 0:e.currentLevelXp)??fe.currentLevelXp,i=Math.max(1,(e==null?void 0:e.nextLevelXp)??fe.nextLevelXp),o=Math.max(0,(e==null?void 0:e.xpToNextLevel)??i-a),c=(e==null?void 0:e.currentLevelStartXp)??Math.max(0,t-a);return{totalXp:t,level:n,currentLevelXp:a,nextLevelXp:i,xpIntoLevel:a,xpToNextLevel:o,currentLevelStartXp:c,nextLevelTotalXp:(e==null?void 0:e.nextLevelTotalXp)??c+i,levelCurveVersion:(e==null?void 0:e.levelCurveVersion)??fe.levelCurveVersion,weeklyXp:(e==null?void 0:e.weeklyXp)??fe.weeklyXp,streakDays:(e==null?void 0:e.streakDays)??fe.streakDays,comboMultiplier:(e==null?void 0:e.comboMultiplier)??fe.comboMultiplier,momentumScore:(e==null?void 0:e.momentumScore)??fe.momentumScore,topGoalId:(e==null?void 0:e.topGoalId)??fe.topGoalId,topGoalTitle:(e==null?void 0:e.topGoalTitle)??fe.topGoalTitle}}function Si(e){return Intl.NumberFormat(void 0,{notation:e>=1e4?"compact":"standard",maximumFractionDigits:1}).format(e)}function Dl({metrics:e,className:t}){const n=ki(e),a=Math.min(100,Math.round(n.currentLevelXp/Math.max(1,n.nextLevelXp)*100));return s.jsxs(Ke,{to:"/rewards",className:x("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:[s.jsxs("span",{className:"relative grid size-8 shrink-0 place-items-center rounded-full bg-[var(--ui-surface-2)]",children:[s.jsx("span",{className:"absolute inset-0 rounded-full",style:{background:`conic-gradient(var(--tertiary) ${a}%, var(--ui-border-subtle) 0)`}}),s.jsxs("span",{className:"relative grid size-6 place-items-center rounded-full bg-[var(--ui-surface-section)] text-[10px] text-[var(--tertiary)]",children:["L",n.level]})]}),s.jsxs("span",{className:"min-w-0",children:[s.jsxs("span",{className:"block truncate",children:[n.currentLevelXp,"/",n.nextLevelXp," XP"]}),s.jsxs("span",{className:"block truncate text-[11px] text-[var(--ui-ink-faint)]",children:[n.streakDays," day streak"]})]})]})}function Bf({metrics:e,compact:t=!1}){var m,y,O;const n=wi(),a=Ut(),i=Cs({queryKey:["forge-gamification-assets"],queryFn:bi}),o=Is({mutationFn:xi,onSuccess:async()=>{await a.invalidateQueries({queryKey:["forge-gamification-assets"]})}}),c=ki(e.profile),d=Math.min(100,Math.round(c.currentLevelXp/Math.max(1,c.nextLevelXp)*100)),p=e.catalogPreview??[],g=e.nextUnlock??p.find(T=>!T.unlocked)??null,u=e.newestUnlock??p.find(T=>T.unlocked)??null,h=(m=e.nextTargets)!=null&&m.length?e.nextTargets:g?[g]:[],j=[...u?[u]:[],...p.filter(T=>T.unlocked&&T.id!==(u==null?void 0:u.id))].slice(0,5),b=((y=e.equipment)==null?void 0:y.selectedMascotSkin)??"default smith",v=(O=i.data)==null?void 0:O.assets.styles.find(T=>T.id===n),C=(v==null?void 0:v.label)??n.split("-").map(T=>T.charAt(0).toUpperCase()+T.slice(1)).join(" ");if(v&&!v.installed){const T=o.isPending&&o.variables===n;return s.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:s.jsxs("div",{className:"grid min-w-0 gap-4 sm:grid-cols-[4.5rem_minmax(0,1fr)] sm:items-center",children:[s.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:s.jsx("img",{src:gs(n),alt:`${C} preview`,className:"size-16 object-contain"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsxs(D,{className:"bg-[var(--ui-surface-2)] text-[var(--tertiary)]",children:["Level ",c.level]}),s.jsxs(D,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[c.currentLevelXp,"/",c.nextLevelXp," XP"]}),s.jsx(D,{className:"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",children:"Assets not downloaded"})]}),s.jsxs("div",{className:"mt-3 flex min-w-0 flex-wrap items-end justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"font-display text-xl text-[var(--ui-ink-strong)]",children:["Download ",C," rewards"]}),s.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."})]}),s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsxs(B,{size:"sm",pending:T,pendingLabel:"Downloading",onClick:()=>o.mutate(n),children:[s.jsx(Ga,{className:"size-3.5"}),"Download"]}),s.jsxs(Ke,{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:[s.jsx(ks,{className:"size-3.5"}),"Settings"]})]})]}),o.isError?s.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."}):s.jsxs("div",{className:"mt-3 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[v.spriteCount,"/",v.expectedSpriteCount," sprites installed"]})]})]})})}return s.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:[s.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%)]"}),s.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(18rem,0.84fr)_minmax(0,1.16fr)] lg:items-center",children:[s.jsxs("div",{className:"relative min-h-[17rem] overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",children:[s.jsx("img",{src:At(e.mascot.spriteKey,512,n),alt:"Forge Smith mascot",onError:Lt,className:"absolute inset-x-0 bottom-3 mx-auto h-[15.5rem] max-w-none object-contain drop-shadow-[var(--ui-shadow-soft)]"}),s.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:[s.jsxs("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:[e.scope.label," · ",b.replaceAll("-"," ")]}),s.jsx("div",{className:"mt-1 font-display text-xl text-[var(--ui-ink-strong)]",children:e.mascot.headline})]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsxs(D,{className:"bg-[var(--ui-surface-2)] text-[var(--tertiary)]",children:["Level ",c.level]}),s.jsxs(D,{className:"bg-[var(--ui-surface-2)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[c.streakDays," days"]}),s.jsxs(D,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[Si(c.totalXp)," XP"]})]}),s.jsxs("div",{className:"mt-4 grid gap-3",children:[s.jsxs("div",{className:"flex min-w-0 items-end justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"font-display text-2xl text-[var(--ui-ink-strong)] md:text-3xl",children:["Forge level ",c.level]}),s.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:e.mascot.line})]}),s.jsxs(Ke,{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:[s.jsx(ls,{className:"size-3.5"}),"Hall"]})]}),s.jsx(To,{value:d}),s.jsxs("div",{className:"flex flex-wrap justify-between gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[s.jsxs("span",{children:[c.currentLevelXp,"/",c.nextLevelXp," XP"]}),s.jsxs("span",{children:[c.xpToNextLevel??c.nextLevelXp-c.currentLevelXp," ","to next"]})]})]}),t?null:s.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(13rem,0.72fr)]",children:[s.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-[var(--ui-ink-strong)]",children:[s.jsx(bt,{className:"size-4 text-[var(--tertiary)]"}),"Next targets"]}),s.jsx("div",{className:"mt-3 grid gap-2",children:h.length>0?h.map(T=>s.jsxs("div",{className:"grid grid-cols-[2rem_minmax(0,1fr)_3.5rem] items-center gap-2",children:[s.jsx("img",{src:At(T.assetKey,256,n),alt:"",onError:Lt,className:"size-8 object-contain opacity-90"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-sm text-[var(--ui-ink-medium)]",children:T.title}),s.jsx("div",{className:"truncate text-[11px] text-[var(--ui-ink-faint)]",children:T.requirementText})]}),s.jsxs("div",{className:"text-right text-[11px] text-[var(--ui-ink-faint)]",children:[T.progressPercent,"%"]})]},T.id)):s.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"All visible rewards unlocked"})})]}),s.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-[var(--ui-ink-strong)]",children:[s.jsx(ls,{className:"size-4 text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]"}),"Latest shelf"]}),s.jsx("div",{className:"mt-3 flex min-w-0 gap-2",children:j.length>0?j.map(T=>s.jsx("img",{src:At(T.assetKey,256,n),alt:T.title,title:T.title,onError:Lt,className:"size-11 rounded-2xl bg-[var(--ui-surface-2)] object-contain p-1"},T.id)):s.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"No trophy yet"})}),s.jsxs("div",{className:"mt-3 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[e.unlockedItemCount,"/",e.totalItemCount," unlocked"]})]})]})]})]})]})}function $l({xpNotice:e,celebrations:t,onSeen:n}){const a=so(),i=wi(),o=t[0]??null,c=(o==null?void 0:o.kind)==="level"||(o==null?void 0:o.kind)==="trophy"||(o==null?void 0:o.kind)==="unlock";return s.jsx(ri,{children:o?s.jsx(Be.div,{initial:a?{opacity:0}:{opacity:0,y:20,scale:.96},animate:a?{opacity:1}:{opacity:1,y:0,scale:1},exit:a?{opacity:0}:{opacity:0,y:16,scale:.98},transition:{duration:.28,ease:"easeOut"},className:x("pointer-events-auto fixed z-50 px-4",c?"inset-x-0 bottom-24 flex justify-center lg:bottom-8":"right-0 bottom-24 lg:bottom-8"),onAnimationComplete:()=>{window.setTimeout(()=>n(o.id),c?3e3:1800)},children:s.jsxs("div",{className:x("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",c?"w-full max-w-[34rem] p-4":"max-w-[24rem] p-3"),children:[s.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%)]"}),s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("img",{src:At(o.assetKey||"mascot-state-020",256,i),alt:"",onError:Lt,className:x("shrink-0 object-contain",c?"size-24":"size-14")}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--tertiary)]",children:o.kind}),s.jsx("div",{className:"mt-1 truncate font-display text-xl text-[var(--ui-ink-strong)]",children:o.title}),s.jsx("div",{className:"mt-1 line-clamp-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:o.summary})]})]})]})},o.id):e?s.jsx(Be.div,{initial:a?{opacity:0}:{opacity:0,y:14},animate:a?{opacity:1}:{opacity:1,y:0},exit:a?{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:s.jsxs("div",{className:x("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?s.jsx(Wt,{className:"size-4 shrink-0"}):s.jsx(Ha,{className:"size-4 shrink-0"}),s.jsxs("span",{children:[e.deltaXp>0?`XP +${e.deltaXp}`:`XP ${e.deltaXp}`," ","· ",Si(e.totalXp)," total"]})]})},`xp-${e.totalXp}`):null})}const ns="forge-gamification-assets-setup-dismissed-v1";function Ml(){var v,C;const e=Ut(),t=Qe(),[n,a]=l.useState(()=>typeof window>"u"?!0:window.localStorage.getItem(ns)==="1"),[i,o]=l.useState(Xe),c=Cs({queryKey:["forge-gamification-assets"],queryFn:bi,staleTime:3e4}),d=((v=c.data)==null?void 0:v.assets.styles)??[],p=d.filter(m=>m.installed),u=!t.pathname.startsWith("/settings")&&!n&&c.isSuccess&&p.length===0;l.useEffect(()=>{var y;const m=St((y=c.data)==null?void 0:y.assets.defaultStyle);o(m)},[(C=c.data)==null?void 0:C.assets.defaultStyle]);const h=l.useMemo(()=>d.find(m=>m.id===i)??d.find(m=>m.id===Xe)??d[0],[i,d]),j=Is({mutationFn:async m=>{const y=await xi(m);return await bl({gamificationTheme:m}),y},onSuccess:async()=>{window.localStorage.removeItem(ns),await Promise.all([e.invalidateQueries({queryKey:["forge-gamification-assets"]}),e.invalidateQueries({queryKey:["forge-settings"]})])}});function b(){window.localStorage.setItem(ns,"1"),a(!0)}return d.length?s.jsx(Ze,{open:u,children:s.jsxs(et,{children:[s.jsx(tt,{className:"fixed inset-0 z-50 bg-[rgba(3,7,18,0.74)] backdrop-blur-xl"}),s.jsxs(st,{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:[s.jsx(nt,{className:"sr-only",children:"Download Forge reward art"}),s.jsx(at,{className:"sr-only",children:"Choose whether Forge should download optional trophy and mascot art."}),s.jsx("button",{type:"button",onClick:b,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:s.jsx(Ye,{className:"size-4"})}),s.jsxs("div",{className:"grid gap-0 md:grid-cols-[16rem_minmax(0,1fr)]",children:[s.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:s.jsx("img",{src:gs(i),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)]"})}),s.jsxs("div",{className:"p-5 sm:p-6",children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--tertiary)]",children:"Optional reward art"}),s.jsx("h2",{className:"mt-2 font-display text-2xl text-white",children:"Download trophies and mascot sprites?"}),s.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."}),s.jsx("div",{className:"mt-5 grid gap-2",children:d.map(m=>{const y=m.id===i;return s.jsxs("button",{type:"button",onClick:()=>o(m.id),className:["grid grid-cols-[3.5rem_minmax(0,1fr)] items-center gap-3 rounded-[18px] border p-2 text-left transition",y?"border-[var(--primary)] bg-[var(--primary)]/12":"border-white/10 bg-white/[0.04] hover:bg-white/[0.07]"].join(" "),children:[s.jsx("img",{src:gs(m.id),alt:"",className:"size-14 object-contain"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-sm font-semibold text-white",children:m.label}),s.jsx("span",{className:"mt-1 line-clamp-2 block text-[12px] leading-5 text-white/52",children:m.description})]})]},m.id)})}),j.isError?s.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:j.error instanceof Error?j.error.message:"Could not download the selected art."}):null,s.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-2",children:[s.jsx("button",{type:"button",onClick:b,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"}),s.jsxs("button",{type:"button",disabled:!h||j.isPending,onClick:()=>{h&&j.mutate(h.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:[s.jsx(Ga,{className:"size-4"}),j.isPending?"Downloading":"Download"]})]})]})]})]})]})}):null}function ya({routeKey:e,tone:t="core",children:n}){return s.jsx(Be.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:n})}const zl=["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"],Fl=[{kind:"goal",label:"Goal",icon:Ua,iconName:"Target",accentRgb:[251,191,36]},{kind:"project",label:"Project",icon:sr,iconName:"FolderOpen",accentRgb:[56,189,248]},{kind:"issue",label:"Issue",icon:la,iconName:"FileText",accentRgb:[251,146,60]},{kind:"task",label:"Task",icon:nr,iconName:"ListTodo",accentRgb:[129,140,248]},{kind:"strategy",label:"Strategy",icon:Ss,iconName:"GitBranch",accentRgb:[34,211,238]},{kind:"habit",label:"Habit",icon:ar,iconName:"RefreshCw",accentRgb:[45,212,191]},{kind:"tag",label:"Tag",icon:Ot,iconName:"PanelTop",accentRgb:[163,230,53]},{kind:"note",label:"Note",icon:js,iconName:"NotebookPen",accentRgb:[148,163,184]},{kind:"wiki_page",label:"Wiki Page",icon:qa,iconName:"StickyNote",accentRgb:[125,211,252]},{kind:"wiki_space",label:"Wiki Space",icon:Ka,iconName:"Network",accentRgb:[99,102,241]},{kind:"insight",label:"Insight",icon:bt,iconName:"Sparkles",accentRgb:[244,63,94]},{kind:"calendar_event",label:"Calendar Event",icon:cs,iconName:"CalendarDays",accentRgb:[14,165,233]},{kind:"work_block",label:"Work Block",icon:Ot,iconName:"PanelTop",accentRgb:[16,185,129]},{kind:"timebox",label:"Timebox",icon:xt,iconName:"Timer",accentRgb:[244,114,182]},{kind:"value",label:"Value",icon:ca,iconName:"Heart",accentRgb:[52,211,153]},{kind:"pattern",label:"Pattern",icon:Ba,iconName:"Repeat",accentRgb:[251,113,133]},{kind:"behavior",label:"Behavior",icon:ir,iconName:"Route",accentRgb:[251,146,60]},{kind:"belief",label:"Belief",icon:rr,iconName:"Quote",accentRgb:[167,139,250]},{kind:"mode",label:"Mode",icon:or,iconName:"Shapes",accentRgb:[217,70,239]},{kind:"mode_session",label:"Mode Session",icon:lr,iconName:"Compass",accentRgb:[192,132,252]},{kind:"flashcard",label:"Flashcard",icon:Ot,iconName:"PanelTop",accentRgb:[20,184,166]},{kind:"report",label:"Report",icon:la,iconName:"FileText",accentRgb:[96,165,250]},{kind:"event_type",label:"Event Type",icon:cs,iconName:"CalendarDays",accentRgb:[45,212,191]},{kind:"emotion",label:"Emotion",icon:ca,iconName:"Heart",accentRgb:[248,113,113]},{kind:"workbench",label:"Workbench",icon:cr,iconName:"Workflow",accentRgb:[45,212,191]},{kind:"functor",label:"Functor",icon:bt,iconName:"Sparkles",accentRgb:[250,204,21]},{kind:"chat",label:"Chat",icon:ds,iconName:"Bot",accentRgb:[129,140,248]}];function Wl(e){return`#${e.map(t=>t.toString(16).padStart(2,"0")).join("")}`}function ve(e,t,n){return`rgba(var(--forge-entity-${e}-rgb,${t.join(",")}),${n})`}function Gl(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:Wl(e.accentRgb)},iconClassName:`text-[${ve(e.kind,e.accentRgb,.96)}]`,nameClassName:`text-[${ve(e.kind,e.accentRgb,.96)}]`,badgeClassName:`border-[${ve(e.kind,e.accentRgb,.24)}] bg-[linear-gradient(135deg,${ve(e.kind,e.accentRgb,.24)},${ve(e.kind,e.accentRgb,.08)})] text-white`,subtleBadgeClassName:`border-[${ve(e.kind,e.accentRgb,.18)}] bg-[${ve(e.kind,e.accentRgb,.08)}] text-[${ve(e.kind,e.accentRgb,.92)}]`,buttonClassName:`border-[${ve(e.kind,e.accentRgb,.2)}] bg-[${ve(e.kind,e.accentRgb,.12)}] text-white hover:bg-[${ve(e.kind,e.accentRgb,.18)}]`}}const Hl=Object.fromEntries(Fl.map(e=>[e.kind,Gl(e)])),Ul={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 Fs(e){return Hl[e]}function Vf(e){return zl.includes(e)}function Jf(e,t){return e==="note"&&(t==null?void 0:t.noteKind)==="wiki"?"wiki_page":Ul[e]??null}function Xf(e){return e==="chat"?"chat":"functor"}function Qf(e,t){const n=Fs(e);return t?`border ${n.buttonClassName}`:"border border-white/8 bg-white/[0.05] text-white/62 hover:bg-white/[0.08] hover:text-white"}function qe({kind:e,label:t,compact:n=!1,size:a,showIcon:i=!0,iconOnly:o=!1,gradient:c=!0,wrap:d=!1,className:p,...g}){const u=Fs(e),h=u.icon;return s.jsxs(D,{size:a??(n?"sm":"md"),wrap:d,className:x("max-w-full min-w-0 gap-1.5 border font-medium",c?u.badgeClassName:u.subtleBadgeClassName,n&&!o&&"px-2.5",o&&"px-2.5",a==="xs"&&"gap-1 px-2",p),...g,children:[i?s.jsx(h,{className:x(a==="xs"?"size-3":"size-3.5","shrink-0",u.iconClassName)}):null,o?null:s.jsx("span",{className:x("min-w-0 max-w-full",d?"whitespace-normal break-words [overflow-wrap:anywhere]":"truncate"),children:t??u.label})]})}const ql={sm:"text-base",md:"text-lg",lg:"text-2xl",xl:"text-3xl"},as={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 Ws({kind:e,label:t,variant:n="inline",size:a="md",showKind:i=!1,showIcon:o=!0,showBadge:c=!1,badgeLabel:d,badgeCompact:p=!0,badgeGradient:g=!1,lines:u=1,labelClassName:h,className:j,...b}){const v=Fs(e),C=v.icon;return n==="pill"?s.jsxs("span",{className:x("inline-flex max-w-full items-center gap-2 rounded-full border px-4 py-2 font-medium shadow-[var(--ui-shadow-soft)]",v.badgeClassName,j),...b,children:[o?s.jsx(C,{className:x("size-4 shrink-0",v.iconClassName)}):null,s.jsx("span",{className:x("min-w-0 max-w-full",as[u],h),children:t})]}):n==="heading"?s.jsxs("span",{className:x("inline-flex max-w-full min-w-0 items-center gap-3",j),...b,children:[c?s.jsx(qe,{kind:e,label:d??v.label,compact:p,gradient:g,className:"shrink-0"}):null,i&&!c?s.jsx(qe,{kind:e,label:d??v.label,compact:!0,gradient:!1,className:"shrink-0"}):null,s.jsx("span",{className:x("min-w-0 max-w-full font-display leading-tight",ql[a],as[u],v.nameClassName,h),children:t})]}):s.jsxs("span",{className:x("inline-flex max-w-full min-w-0 items-center gap-2",j),...b,children:[o?s.jsx(C,{className:x("size-4 shrink-0",v.iconClassName)}):null,c?s.jsx(qe,{kind:e,label:d??v.label,compact:p,gradient:g,className:"shrink-0"}):null,i?s.jsx("span",{className:x("text-sm font-medium",v.nameClassName),children:v.label}):null,s.jsx("span",{className:x("min-w-0 max-w-full",as[u],v.nameClassName,h),children:t})]})}const Kl={spark:"Spark stage",story:"Story stage",state:"State stage",lens:"Lens stage",pivot:"Pivot stage"};function Bl(e,t){return`${e}:${t}`}function Yf(e,t,n){return(e==null?void 0:e[Bl(t,n)])??{count:0,latestNoteId:null,latestCreatedAt:null}}function Zf(e){return`${e} Note${e===1?"":"s"}`}function Vl(e){return e.replaceAll("_"," ")}function Jl(e){if(!e)return null;const t=e.trim().toLowerCase(),n=Kl[t];return n||t.split(/[_\-\s]+/).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}function ev(e,t){const n=Jl(t);return n?e==="trigger_report"?`This note is pinned to the ${n.toLowerCase()} of the report, so it stays attached to that part of the reflective chain.`:`This note is pinned to the "${n}" section of the ${Vl(e)} instead of only the whole entity.`:null}function ji(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 Ni(e,t){switch(e){case"goal":case"project":case"task":case"strategy":case"trigger_report":{const n=ji(e,t);return n?`${n}#notes`:null}default:return`/notes?entityType=${encodeURIComponent(e)}&entityId=${encodeURIComponent(t)}`}}function tv(e){return e.links.find(t=>ji(t.entityType,t.entityId)!==null)??e.links[0]??null}function Xl(e){switch(e.entityType){case"workbench_flow":case"workbench_surface":case"wiki_space":return null;default:return Ni(e.entityType,e.entityId)}}function Ql({group:e,onSelectNode:t}){return e.relations.length===0?null:s.jsxs("section",{className:"grid gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:e.label}),s.jsxs("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:[e.itemCount," entities across ",e.relationCount," relation",e.relationCount===1?"":"s"]})]}),s.jsx(D,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] text-[var(--ui-ink-medium)]",children:e.family})]}),s.jsx("div",{className:"grid gap-3",children:e.relations.map(n=>s.jsxs("div",{className:"grid gap-2",children:[s.jsx("div",{className:"text-xs font-medium text-[var(--ui-ink-soft)]",children:n.label}),s.jsx("div",{className:"grid gap-2",children:n.items.map(a=>s.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(a),children:[s.jsxs("span",{className:"min-w-0",children:[s.jsx(Ws,{kind:a.entityKind,label:a.title,className:"max-w-full",lines:1}),a.subtitle?s.jsx("span",{className:"mt-1 block truncate text-[12px] text-[var(--ui-ink-soft)]",children:a.subtitle}):null]}),s.jsx(Gt,{className:"size-4 shrink-0 text-[var(--ui-ink-faint)]"})]},a.id))})]},n.relationKind))})]})}function Yl({focus:e,onOpenPage:t,onOpenNotes:n,onOpenHierarchy:a,onSelectNode:i,className:o}){var g;if(!e.focusNode)return s.jsx("div",{className:x("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:s.jsxs("div",{className:"grid gap-2",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Focus"}),s.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Select a node to inspect its structure, context, and nearby navigation paths."})]})});const c=e.focusNode,d=Xl(c),p=Object.values(e.secondRingCounts).reduce((u,h)=>u+h,0);return s.jsxs("div",{className:x("grid gap-4",o),children:[s.jsxs("div",{className:"grid gap-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 shadow-[var(--ui-shadow-floating)]",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(qe,{kind:c.entityKind,label:c.entityKind.replaceAll("_"," "),compact:!0}),s.jsx("div",{className:"mt-3",children:s.jsx(Ws,{kind:c.entityKind,label:c.title,variant:"heading",size:"lg",lines:3,className:"max-w-full"})}),c.subtitle?s.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:c.subtitle}):null]}),s.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[(g=c.owner)!=null&&g.displayName?s.jsx(D,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:c.owner.displayName}):null,c.updatedAt?s.jsxs(D,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Updated ",bo(c.updatedAt)]}):null]})]}),c.description?s.jsx("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:c.description}):null,s.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.previewStats.map(u=>s.jsxs(D,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[u.label,": ",u.value]},`${u.label}-${u.value}`)),s.jsxs(D,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Degree: ",c.graphStats.degree]}),s.jsxs(D,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Structural: ",c.graphStats.structuralDegree]}),s.jsxs(D,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Contextual: ",c.graphStats.contextualDegree]}),s.jsxs(D,{className:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:["Nearby second ring: ",p]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.href?s.jsxs(B,{variant:"secondary",onClick:()=>t(c),children:[s.jsx(Gt,{className:"size-4"}),"Open page"]}):null,d?s.jsxs(B,{variant:"secondary",onClick:()=>n(c),children:[s.jsx(js,{className:"size-4"}),"Open notes"]}):null,s.jsxs(B,{variant:"secondary",onClick:()=>a(c),children:[s.jsx(Va,{className:"size-4"}),"Open in hierarchy"]})]})]}),s.jsx("div",{className:"grid gap-4",children:e.familyGroups.length>0?e.familyGroups.map(u=>s.jsx(Ql,{group:u,onSelectNode:i},u.family)):s.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 Zl({focus:e,onOpenPage:t,onOpenNotes:n,onOpenHierarchy:a,onSelectNode:i,onClose:o}){return s.jsxs("aside",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--ui-border-subtle)] px-4 py-3",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-soft)]",children:[s.jsx(dr,{className:"size-3.5"}),"Focus Node"]}),o?s.jsxs(B,{variant:"secondary",size:"sm",onClick:o,children:[s.jsx(Ye,{className:"size-4"}),"Close"]}):null]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4 pt-3",children:s.jsx(Yl,{focus:e,onOpenPage:t,onOpenNotes:n,onOpenHierarchy:a,onSelectNode:i})})]})}const ba="(max-width: 1023px)",xa=["Execution","Psyche","Knowledge"],ec=l.lazy(()=>N(()=>import("./goal-dialog-6R2uYWPQ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.GoalDialog}))),tc=l.lazy(()=>N(()=>import("./project-dialog-YYxtlqg8.js"),__vite__mapDeps([13,1,2,3,4,5,6,7,14,8,9,10,11,12])).then(e=>({default:e.ProjectDialog}))),sc=l.lazy(()=>N(()=>import("./task-dialog-BfPkbIPE.js"),__vite__mapDeps([15,1,2,3,4,5,0,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.TaskDialog})));function nc(){const[e,t]=l.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(ba).matches);return l.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(ba),a=i=>{t(i.matches)};return t(n.matches),typeof n.addEventListener=="function"?(n.addEventListener("change",a),()=>n.removeEventListener("change",a)):(n.addListener(a),()=>n.removeListener(a))},[]),e}function wa({kind:e,title:t,description:n,onClick:a}){return s.jsxs("button",{type:"button",className:"w-full min-w-0 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-4 text-left transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",onClick:a,children:[s.jsx(qe,{kind:e,label:t,compact:!0,gradient:!1,className:"max-w-full"}),s.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:n})]})}function ac(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 ic({goals:e,projects:t,tags:n,users:a,defaultUserId:i=null,onCreateGoal:o,onCreateProject:c,onCreateTask:d}){const{t:p}=ye(),g=Ja(),u=e??[],h=t??[],j=n??[],b=a??[],[v,C]=l.useState(!1),[m,y]=l.useState(!1),[O,T]=l.useState(!1),$=l.useMemo(()=>ac(p),[p]),V=l.useMemo(()=>$.map(A=>({...A,onSelect:()=>{switch(A.id){case"goal":C(!0);return;case"project":y(!0);return;case"task":T(!0);return;case"strategy":g("/strategies?create=1");return;case"habit":g("/habits?create=1");return;case"psyche_value":g("/psyche/values?create=1");return;case"behavior_pattern":g("/psyche/patterns?create=1");return;case"behavior":g("/psyche/behaviors?create=1");return;case"flashcard":g("/psyche/flashcards?create=1");return;case"trigger_report":g("/psyche/reports?create=1");return;case"wiki_page":g("/wiki/new");return;default:return}}})),[g,$]),M=s.jsxs(l.Suspense,{fallback:null,children:[v?s.jsx(ec,{open:v,editingGoal:null,tags:j,users:b,defaultUserId:i,onOpenChange:C,onSubmit:async A=>{await o(A)}}):null,m?s.jsx(tc,{open:m,goals:u,users:b,editingProject:null,defaultUserId:i,onOpenChange:y,onSubmit:async A=>{await c(A)}}):null,O?s.jsx(sc,{open:O,goals:u,projects:h,tags:j,users:b,editingTask:null,defaultUserId:i,onOpenChange:T,onSubmit:async A=>{await d(A)}}):null]});return{actions:V,dialogs:M}}function rc({actions:e,className:t}){const{t:n}=ye(),[a,i]=l.useState(!1),[o,c]=l.useState(null),d=nc(),p=l.useRef(null),g=l.useRef(null);return l.useEffect(()=>{if(!a||d)return;const u=()=>{var v;const b=(v=p.current)==null?void 0:v.getBoundingClientRect();b&&c({top:Math.max(24,b.top-18),right:Math.max(24,window.innerWidth-b.right)})};u();const h=b=>{var v,C;(v=p.current)!=null&&v.contains(b.target)||(C=g.current)!=null&&C.contains(b.target)||i(!1)},j=b=>{b.key==="Escape"&&i(!1)};return document.addEventListener("pointerdown",h),document.addEventListener("keydown",j),window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",j),window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[d,a]),s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:p,className:t,style:d?{right:"max(1rem, calc(var(--forge-safe-area-right) + 1rem))",bottom:"var(--forge-mobile-create-bottom)"}:void 0,children:s.jsxs(B,{type:"button","data-testid":"create-floating-trigger","aria-expanded":a,"aria-haspopup":"dialog",onClick:()=>i(u=>d?!0:!u),className:`min-w-max max-w-[calc(100vw-2rem)] shrink-0 rounded-full px-3.5 py-2 text-[12px] shadow-[var(--ui-shadow-soft)] ${a?"border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-accent-soft-hover)] text-[var(--ui-ink-strong)]":""}`,children:[s.jsx(bt,{className:`size-4 transition ${a?"text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)]"}`}),n("common.navigation.create")]})}),a&&!d&&typeof document<"u"&&o?Ns.createPortal(s.jsxs("div",{ref:g,"data-testid":"create-desktop-menu",className:"fixed z-50 max-h-[min(34rem,calc(100vh-4rem))] w-[min(26rem,calc(100vw-2rem))] overflow-y-auto rounded-[30px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] p-4 shadow-[var(--ui-shadow-floating)]",style:{top:`${o.top}px`,right:`${o.right}px`,transform:"translateY(-100%)"},children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Create"}),s.jsx("div",{className:"mt-2 text-lg font-medium text-[var(--ui-ink-strong)]",children:"Start the next move"}),s.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Pick one thing to create. The flow keeps the first step light and visible."}),xa.map(u=>s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:u}),s.jsx("div",{className:"mt-2 grid gap-2",children:e.filter(h=>h.group===u).map(h=>s.jsx(wa,{kind:h.kind,title:h.title,description:h.description,onClick:()=>{i(!1),h.onSelect()}},h.id))})]},u))]}),document.body):null,s.jsx(Ze,{open:a&&d,onOpenChange:i,children:s.jsxs(et,{children:[s.jsx(tt,{className:"surface-overlay fixed inset-0 z-40 backdrop-blur-xl lg:hidden"}),s.jsxs(st,{"data-testid":"create-mobile-sheet",className:"surface-modal-panel fixed inset-x-4 bottom-28 z-50 flex max-h-[min(30rem,calc(100vh-8rem))] flex-col overflow-hidden rounded-[28px] border p-0 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:[s.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--ui-border-subtle)] px-5 py-5",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:n("common.navigation.create")}),s.jsx(nt,{className:"mt-2 font-display text-2xl text-[var(--ui-ink-strong)]",children:n("common.navigation.createTitle")}),s.jsx(at,{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:n("common.navigation.createDescription")})]}),s.jsx(qt,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":n("common.navigation.closeCreateMenu"),className:"rounded-full bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",children:s.jsx(Ye,{className:"size-4"})})})]}),s.jsx("div",{className:"overflow-y-auto p-4 overscroll-contain",children:xa.map(u=>s.jsxs("div",{className:"mt-1 grid gap-2 first:mt-0",children:[s.jsx("div",{className:"px-1 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:u}),e.filter(h=>h.group===u).map(h=>s.jsx(wa,{kind:h.kind,title:h.title,description:h.description,onClick:()=>{i(!1),h.onSelect()}},h.id))]},u))})]})]})})]})}function Vt({className:e,"aria-label":t="Close dialog",title:n="Close",...a}){return s.jsx("button",{type:"button","aria-label":t,title:n,className:x("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),...a,children:s.jsx(Ye,{className:"size-[1.05rem]"})})}function Gs({open:e,onOpenChange:t,eyebrow:n,title:a,description:i,children:o}){return s.jsx(Ze,{open:e,onOpenChange:t,children:s.jsxs(et,{children:[s.jsx(tt,{className:"surface-overlay fixed inset-0 z-40 backdrop-blur-xl"}),s.jsxs(st,{className:"surface-modal-panel fixed left-1/2 bottom-4 top-4 z-50 flex w-[min(36rem,calc(100vw-2rem))] max-w-none -translate-x-1/2 flex-col overflow-hidden rounded-[32px] border",children:[s.jsx("div",{className:"border-b border-[var(--ui-border-subtle)] px-5 py-5",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:n}),s.jsx(nt,{className:"mt-2 type-display-section text-[var(--ui-ink-strong)]",children:a}),i?s.jsx(at,{className:"mt-3 type-body text-[var(--ui-ink-soft)]",children:i}):null]}),s.jsx(qt,{asChild:!0,children:s.jsx(Vt,{})})]})}),s.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto p-4",children:o})]})]})})}function gt({className:e,size:t,...n}){return s.jsx("input",{...n,className:x("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)})}const oc=l.forwardRef(function({className:t,...n},a){return s.jsx("textarea",{ref:a,...n,className:x("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)})});function lc(e){return e===null?"20":String(Math.max(1,Math.round(e/60)))}function cc({tasks:e,projects:t,activeRunCount:n,maxActiveTasks:a,timeAccountingMode:i,pending:o,errorMessage:c,initialTaskId:d,defaultProjectId:p,onCancel:g,onStartExisting:u,onCreateAndStart:h}){const[j,b]=l.useState("existing"),[v,C]=l.useState(""),[m,y]=l.useState(d??null),[O,T]=l.useState(""),[$,V]=l.useState(""),[M,A]=l.useState(p??""),[G,ee]=l.useState("planned"),[z,te]=l.useState("20"),[be,X]=l.useState(""),[F,J]=l.useState("");l.useEffect(()=>{b(d?"existing":"new"),C(""),y(d??null),T(""),V(""),A(p??""),ee("planned"),te("20"),X(""),J("")},[p,d]);const se=l.useMemo(()=>e.filter(k=>k.status!=="done").sort((k,L)=>k.time.hasCurrentRun!==L.time.hasCurrentRun?Number(L.time.hasCurrentRun)-Number(k.time.hasCurrentRun):k.status!==L.status?k.status.localeCompare(L.status):k.title.localeCompare(L.title)),[e]),xe=l.useMemo(()=>{const k=v.trim().toLowerCase();return k?se.filter(L=>{var oe,pe,ke,he,le,je;const q=t.find(ge=>ge.id===L.projectId);return[L.title,L.description,L.owner,((oe=L.user)==null?void 0:oe.displayName)??"",((pe=L.user)==null?void 0:pe.handle)??"",((ke=L.user)==null?void 0:ke.kind)??"",(q==null?void 0:q.title)??"",((he=q==null?void 0:q.user)==null?void 0:he.displayName)??"",((le=q==null?void 0:q.user)==null?void 0:le.handle)??"",((je=q==null?void 0:q.user)==null?void 0:je.kind)??""].some(ge=>ge.toLowerCase().includes(k))}):se},[t,se,v]),ie=l.useMemo(()=>t.find(k=>k.id===M)??null,[M,t]),re=G==="planned"?Math.max(60,(Number.parseInt(z,10)||20)*60):null,ue=l.useMemo(()=>{const k=be.trim(),L=F.trim();return!k&&!L?null:{provider:"github",repository:k,branch:L,baseBranch:"main",branchUrl:k&&L?`https://github.com/${k}/tree/${encodeURIComponent(L)}`:null,pullRequestUrl:null,pullRequestNumber:null,compareUrl:k&&L?`https://github.com/${k}/compare/main...${encodeURIComponent(L)}`:null}},[F,be]),we=j==="existing"?!!m:!!(O.trim()&&M),me=i==="split"?"Split time":i==="parallel"?"Parallel time":"Primary only";return s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Start work"}),s.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"}),s.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."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(D,{className:"bg-white/[0.08] text-white/72",children:[n,"/",a," live"]}),s.jsx(D,{className:"bg-white/[0.08] text-white/72",children:me})]})]}),s.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(k=>{const L=j===k.value;return s.jsxs("button",{type:"button",className:x("rounded-[18px] border px-4 py-4 text-left transition",L?"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:()=>b(k.value),children:[s.jsx("div",{className:"font-medium",children:k.label}),s.jsx("div",{className:"mt-2 text-sm leading-6 text-inherit/80",children:k.detail})]},k.value)})}),j==="existing"?s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Search tasks"}),s.jsxs("div",{className:"relative",children:[s.jsx(Ps,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-white/32"}),s.jsx(gt,{value:v,onChange:k=>C(k.target.value),placeholder:"Search task, project, human, bot, or owner",className:"pl-10"})]})]}),s.jsx("div",{className:"grid max-h-[19rem] gap-2 overflow-y-auto rounded-[20px] bg-white/[0.03] p-2",children:xe.length===0?s.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."}):xe.slice(0,16).map(k=>{const L=m===k.id,q=t.find(oe=>oe.id===k.projectId);return s.jsx("button",{type:"button",className:x("rounded-[16px] border px-4 py-3 text-left transition",L?"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:()=>y(k.id),children:s.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(Ws,{kind:"task",label:k.title,className:"max-w-full"}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[q?s.jsx(qe,{kind:"project",label:q.title,compact:!0,gradient:!1}):null,s.jsx(D,{className:"bg-white/[0.08] text-white/70",children:k.status.replaceAll("_"," ")}),k.time.activeRunCount>0?s.jsxs(D,{className:"bg-emerald-500/12 text-emerald-200",children:[k.time.activeRunCount," live"]}):null]})]}),s.jsxs("span",{className:"text-[12px] text-white/45",children:[k.points," xp"]})]})},k.id)})})]}):s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Task title"}),s.jsx(gt,{value:O,onChange:k=>T(k.target.value),placeholder:"Write the next concrete task"})]}),s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Short description"}),s.jsx(oc,{value:$,onChange:k=>V(k.target.value),placeholder:"Keep it short and concrete."})]}),s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Project"}),s.jsxs("select",{value:M,onChange:k=>A(k.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:[s.jsx("option",{value:"",children:"Select project"}),t.map(k=>s.jsx("option",{value:k.id,children:k.user?`${k.title} · ${k.user.displayName} (${k.user.kind})`:k.title},k.id))]})]}),ie?s.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 ",s.jsx("span",{className:"font-medium text-white",children:ie.title}),ie.user?` for ${ie.user.displayName} (${ie.user.kind})`:""," ","and started immediately."]}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Timer"}),s.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(k=>{const L=G===k.value;return s.jsxs("button",{type:"button",className:x("rounded-[18px] border px-4 py-3 text-left transition",L?"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:()=>ee(k.value),children:[s.jsx("div",{className:"font-medium",children:k.label}),s.jsx("div",{className:"mt-1.5 text-sm leading-6 text-inherit/80",children:k.detail})]},k.value)}),s.jsxs("label",{className:x("grid gap-2",G!=="planned"&&"opacity-50"),children:[s.jsx("span",{className:"type-label text-white/45",children:"Minutes"}),s.jsx(gt,{type:"number",min:1,max:240,disabled:G!=="planned",value:z,onChange:k=>te(k.target.value)})]})]})]}),s.jsxs("div",{className:"grid gap-3 rounded-[20px] border border-white/8 bg-white/[0.03] p-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"type-label text-white/45",children:"GitHub context"}),s.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."})]}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Repository"}),s.jsx(gt,{value:be,onChange:k=>X(k.target.value),placeholder:"owner/repo"})]}),s.jsxs("label",{className:"grid gap-2",children:[s.jsx("span",{className:"type-label text-white/45",children:"Branch"}),s.jsx(gt,{value:F,onChange:k=>J(k.target.value),placeholder:"agent/board-redesign"})]})]})]}),c?s.jsx("div",{className:"rounded-[18px] bg-rose-500/10 px-4 py-3 text-sm leading-6 text-rose-200",children:c}):null,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-white/6 pt-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-2 text-[12px] text-white/45",children:[s.jsx("div",{className:"rounded-full bg-white/[0.05] px-3 py-2",children:"Starts in progress"}),s.jsx("div",{className:"rounded-full bg-white/[0.05] px-3 py-2",children:G==="planned"?`${lc(re)} min target`:"Unlimited timer"})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(B,{variant:"secondary",size:"lg",onClick:g,children:"Cancel"}),s.jsxs(B,{size:"lg",pending:o,pendingLabel:"Starting",disabled:!we,onClick:async()=>{if(we){if(j==="existing"&&m){await u(m,{timerMode:G,plannedDurationSeconds:re,gitContext:ue});return}await h({title:O.trim(),description:$.trim(),projectId:M,timerMode:G,plannedDurationSeconds:re,gitContext:ue})}},children:[j==="existing"?s.jsx(xt,{className:"size-4"}):s.jsx(ur,{className:"size-4"}),"Start work",s.jsx(Xa,{className:"size-4"})]})]})]})]})}function ka({open:e,onOpenChange:t,presentation:n="responsive",...a}){const i=s.jsx(cc,{...a,onCancel:()=>t(!1)});return s.jsxs(s.Fragment,{children:[e&&n!=="mobile_sheet"?s.jsx("div",{className:"hidden lg:block",children:s.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:[s.jsx("div",{className:"mb-3 flex justify-end",children:s.jsxs(B,{variant:"ghost",size:"sm",className:"px-3",onClick:()=>t(!1),children:[s.jsx(Ye,{className:"size-4"}),"Close"]})}),i]})}):null,n!=="desktop_inline"?s.jsx("div",{className:n==="responsive"?"lg:hidden":"",children:s.jsx(Gs,{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:i})}):null]})}const dc=[{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"]}],sv=dc.flatMap(e=>[...e.kinds]),nv={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"},av={structural:"Structure",contextual:"Context",taxonomy:"Taxonomy",workspace:"Workspace"};function iv(e,t){return`${e}:${t}`}function rv(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 Pi(e,t){return`${e}:${t}`}function ov(e,t,n){var o;const a=new URLSearchParams;a.set("focus",Pi(e,t)),n!=null&&n.view&&n.view!=="graph"&&a.set("view",n.view),(o=n==null?void 0:n.query)!=null&&o.trim()&&a.set("q",n.query.trim());for(const c of(n==null?void 0:n.kinds)??[])a.append("kind",c);for(const c of(n==null?void 0:n.relations)??[])a.append("relation",c);const i=a.toString();return i.length>0?`/knowledge-graph?${i}`:"/knowledge-graph"}function uc(e,t){return e.length===t.length&&e.every((n,a)=>n===t[a])}function mc(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(a=>a.id));return e.filter(a=>n.has(a))}function pc(e,t={}){const n=t.timerMode??"unlimited",a=t.plannedDurationSeconds===void 0?n==="planned"?1200:null:t.plannedDurationSeconds;return{actor:e,timerMode:n,plannedDurationSeconds:a,isCurrent:!0,leaseTtlSeconds:1800,note:""}}function hc(e){switch(e.entityType){case"workbench_flow":case"workbench_surface":case"wiki_space":return null;default:return Ni(e.entityType,e.entityId)}}function Sa(e,t,n){const a=new URLSearchParams(e.search);if(t?a.set("focus",Pi(t.entityType,t.entityId)):a.delete("focus"),n)for(const[o,c]of Object.entries(n))c===null?a.delete(o):a.set(o,c);const i=a.toString();return i?`?${i}`:""}function gc(e){return new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:e>=1e3?1:0}).format(e)}function fc(e){return e==="/wiki"||e.startsWith("/wiki/page/")?"/wiki":e==="/wiki/new"||e.startsWith("/wiki/edit/")?"/wiki/editor":e}function is(e){return`${e.pathname}${e.search}${e.hash}`}function vc(e,t){const n=new URL(t,"http://forge.local");return{...e,pathname:n.pathname,search:n.search,hash:n.hash,key:`intent:${n.pathname}${n.search}${n.hash}`}}function Te({className:e,...t}){return s.jsx("div",{className:x("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 vt=[{to:"/psyche",label:"Overview",icon:Qa},{to:"/psyche/metrics",label:"Metrics",icon:mr},{to:"/psyche/flashcards",label:"Flashcards",icon:Ot},{to:"/psyche/values",label:"Values",icon:Ya},{to:"/psyche/patterns",label:"Patterns",icon:pr},{to:"/psyche/questionnaires",label:"Questionnaires",icon:hr},{to:"/psyche/self-observation",label:"Self Observation",icon:qa},{to:"/psyche/behaviors",label:"Behaviors",icon:Va},{to:"/psyche/reports",label:"Reports",icon:bt},{to:"/psyche/goal-map",label:"Goal Map",icon:gr},{to:"/psyche/schemas-beliefs",label:"Schemas & Beliefs",icon:fr},{to:"/psyche/modes",label:"Modes",icon:vr},{to:"/psyche/screen-time",label:"Screen Time",icon:yr},{to:"/preferences",label:"Preferences",icon:Za},{to:"/sleep",label:"Sleep",icon:ei}];function rs(e,t){return t==="/psyche"?e==="/psyche":e===t||e.startsWith(`${t}/`)}function lv({className:e}){const t=Qe(),[n,a]=l.useState(!1),i=l.useMemo(()=>[...vt].sort((o,c)=>c.to.length-o.to.length).find(o=>rs(t.pathname,o.to))??vt[0],[t.pathname]);return l.useEffect(()=>{if(!n)return;const o=document.body.style.overflow,c=document.body.style.touchAction,d=p=>{p.key==="Escape"&&a(!1)};return document.body.style.overflow="hidden",document.body.style.touchAction="none",window.addEventListener("keydown",d),()=>{document.body.style.overflow=o,document.body.style.touchAction=c,window.removeEventListener("keydown",d)}},[n]),s.jsxs(s.Fragment,{children:[s.jsxs(Te,{className:x("overflow-hidden border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] p-2",e),children:[s.jsx("div",{className:"hidden items-center gap-3 lg:flex",children:s.jsx("div",{className:"flex flex-wrap gap-2",children:vt.map(o=>s.jsxs(wt,{to:o.to,end:o.to==="/psyche",className:({isActive:c})=>x("inline-flex items-center gap-2 whitespace-nowrap rounded-full px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",c||rs(t.pathname,o.to)?"bg-[color-mix(in_srgb,var(--tertiary)_18%,var(--ui-surface-1)_82%)] text-[var(--ui-ink-strong)]":"bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),children:[s.jsx(o.icon,{className:"size-3.5"}),s.jsx("span",{children:o.label})]},o.to))})}),s.jsx("div",{className:"flex items-center justify-between gap-3 lg:hidden",children:s.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:()=>a(!0),children:s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.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:s.jsx(i.icon,{className:"size-4 text-[var(--tertiary)]"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Psyche section"}),s.jsx("span",{className:"mt-0.5 block truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:i.label})]})]})})})]}),n&&typeof document<"u"?Ns.createPortal(s.jsxs("div",{className:"lg:hidden",children:[s.jsx("div",{className:"fixed inset-0 z-50 bg-[var(--overlay)] backdrop-blur-xl"}),s.jsx("button",{type:"button","aria-label":"Close psyche sections",className:"fixed inset-0 z-[51]",onClick:()=>a(!1)}),s.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:s.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:[s.jsx("div",{className:"shrink-0 border-b border-[var(--ui-border-subtle)] px-4 pb-2.5 pt-3 sm:px-5",children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.22em] text-[var(--ui-ink-faint)]",children:"Psyche sections"}),s.jsxs("div",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("div",{className:"truncate text-[1.05rem] font-semibold text-[var(--ui-ink-strong)]",children:"Move through Psyche"}),s.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:i.label})]})]}),s.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:()=>a(!1),children:s.jsx(Ye,{className:"size-4"})})]})}),s.jsx("div",{className:"min-h-0 overflow-y-auto p-3 overscroll-contain sm:p-4",children:s.jsx("div",{className:"grid gap-2",children:vt.map(o=>{const c=rs(t.pathname,o.to);return s.jsxs(wt,{to:o.to,end:o.to==="/psyche",onClick:()=>a(!1),className:x("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)]",c?"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:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("span",{className:x("flex size-10 shrink-0 items-center justify-center rounded-2xl border transition",c?"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:s.jsx(o.icon,{className:"size-4"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:o.label}),s.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"})]})]}),s.jsx("span",{className:x("rounded-full px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]",c?"bg-[color-mix(in_srgb,var(--tertiary)_16%,transparent)] text-[var(--tertiary)]":"bg-[var(--ui-surface-2)] text-[var(--ui-ink-faint)]"),children:c?"Current":"Open"})]},o.to)})})})]})})]}),document.body):null]})}const U={overview:{surfaceId:"overview",title:"Overview",description:"Review today’s priorities, active work, recent evidence, and overall Forge momentum.",tone:"core",skeleton:{blocks:5,columns:3,sideRail:!0}},"life-force-index":{surfaceId:"life-force-index",title:"Life Force",description:"Model daily Action Point capacity, weekday energy curves, drains, and recovery.",tone:"core",skeleton:{blocks:5,columns:2,sideRail:!0}},"goals-index":{surfaceId:"goals-index",title:"Goals",description:"Define long-term directions and connect them to strategies, projects, and daily execution.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},"habits-index":{surfaceId:"habits-index",title:"Habits",description:"Track recurring commitments, negative habits, streaks, missed days, and habit-linked evidence.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"goal-detail":{surfaceId:"goal-detail",title:"Goal detail",description:"Inspect one goal’s purpose, progress, linked projects, strategies, notes, and execution history.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"projects-index":{surfaceId:"projects-index",title:"Projects",description:"Manage PRD-backed initiatives and the work items that move them forward.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},"project-hierarchy":{surfaceId:"project-hierarchy",title:"Project hierarchy",description:"Trace the execution ladder from goals through strategies, projects, issues, tasks, and subtasks.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},"project-detail":{surfaceId:"project-detail",title:"Project detail",description:"Review one project’s PRD, linked hierarchy, board state, tasks, and delivery health.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"strategies-index":{surfaceId:"strategies-index",title:"Strategies",description:"Build strategy graphs that turn goals and projects into ordered execution paths.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"strategy-detail":{surfaceId:"strategy-detail",title:"Strategy detail",description:"Inspect one strategy’s graph, dependencies, target states, linked work, and progress.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"preferences-index":{surfaceId:"preferences-index",title:"Preferences",description:"Compare preferences, record tradeoffs, and inspect the evidence behind taste models.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"calendar-index":{surfaceId:"calendar-index",title:"Calendar",description:"Plan timeboxes, manage calendar events, and sync provider calendars into Forge.",tone:"core",skeleton:{blocks:6,columns:3,sideRail:!1}},"knowledge-graph-index":{surfaceId:"knowledge-graph-index",title:"Knowledge Graph",description:"Explore Forge records as a connected graph of entities, links, clusters, and relationships.",tone:"knowledge",skeleton:{blocks:4,columns:2,sideRail:!0}},"movement-index":{surfaceId:"movement-index",title:"Movement",description:"Review stays, trips, known places, gaps, and movement evidence captured from the phone.",tone:"health",skeleton:{blocks:5,columns:2,sideRail:!0}},"sleep-index":{surfaceId:"sleep-index",title:"Sleep",description:"Inspect overnight sleep sessions, stages, recovery context, and trends by wake date.",tone:"health",skeleton:{blocks:5,columns:2,sideRail:!0}},"sports-index":{surfaceId:"sports-index",title:"Sports",description:"Review workouts, routes, preserved HealthKit evidence, sport trends, and reflections.",tone:"health",skeleton:{blocks:6,columns:3,sideRail:!0}},"sports-workout-detail":{surfaceId:"sports-workout-detail",title:"Workout detail",description:"Inspect one workout’s heart-rate timeline, route points, zones, events, and raw evidence.",tone:"health",skeleton:{blocks:6,columns:2,sideRail:!0}},"training-load-index":{surfaceId:"training-load-index",title:"Training Load",description:"Track acute and chronic cardiovascular load, HR zones, intensity mix, and training targets.",tone:"health",skeleton:{blocks:6,columns:3,sideRail:!0}},"vitals-index":{surfaceId:"vitals-index",title:"Vitals",description:"Review daily HealthKit body signals, recovery markers, cardio fitness, and metric trends.",tone:"health",skeleton:{blocks:6,columns:3,sideRail:!0}},"weight-loss-index":{surfaceId:"weight-loss-index",title:"Weight Loss",description:"Track food, calorie balance, body composition, gut comfort, energy, and appearance experiments.",tone:"health",skeleton:{blocks:7,columns:3,sideRail:!0}},"psyche-index":{surfaceId:"psyche-index",title:"Psyche",description:"Navigate Psyche records for values, modes, beliefs, reports, patterns, and self-observation.",tone:"psyche",skeleton:{blocks:6,columns:2,sideRail:!0}},"psyche-metrics":{surfaceId:"psyche-metrics",title:"Psyche metrics",description:"Review tracked Psyche metrics such as mood, urges, self-regulation, and conversation-derived signals.",tone:"psyche",skeleton:{blocks:5,columns:3,sideRail:!0}},"psyche-flashcards":{surfaceId:"psyche-flashcards",title:"Psyche flashcards",description:"Create and review therapeutic reminder cards used during urges, triggers, and value pivots.",tone:"psyche",skeleton:{blocks:6,columns:3,sideRail:!1}},"psyche-values":{surfaceId:"psyche-values",title:"Psyche values",description:"Define valued directions and connect them to goals, behaviors, beliefs, and reports.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-patterns":{surfaceId:"psyche-patterns",title:"Psyche patterns",description:"Map recurring behavior loops, their payoffs, costs, triggers, and replacement moves.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-questionnaires":{surfaceId:"psyche-questionnaires",title:"Questionnaires",description:"Manage questionnaire templates, launch runs, and review recent answers and scores.",tone:"psyche",skeleton:{blocks:6,columns:2,sideRail:!0}},"psyche-questionnaire-new":{surfaceId:"psyche-questionnaire-new",title:"New questionnaire",description:"Build a new questionnaire with sections, questions, scoring, and instructions.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!1}},"psyche-questionnaire-detail":{surfaceId:"psyche-questionnaire-detail",title:"Questionnaire detail",description:"Review a questionnaire’s structure, versions, previous runs, and computed scores.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-questionnaire-edit":{surfaceId:"psyche-questionnaire-edit",title:"Edit questionnaire",description:"Edit questionnaire sections, questions, scoring rules, and user instructions.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!1}},"psyche-questionnaire-run":{surfaceId:"psyche-questionnaire-run",title:"Take questionnaire",description:"Answer a questionnaire one prompt at a time and save the completed run.",tone:"psyche",skeleton:{blocks:4,columns:1,sideRail:!1}},"psyche-questionnaire-run-detail":{surfaceId:"psyche-questionnaire-run-detail",title:"Questionnaire run detail",description:"Review a completed questionnaire run with raw answers, computed scores, and context.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-self-observation":{surfaceId:"psyche-self-observation",title:"Self observation",description:"Log dated observations about emotions, thoughts, triggers, body state, and context.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-screen-time":{surfaceId:"psyche-screen-time",title:"Screen Time",description:"Inspect device-use patterns and connect screen time to mood, attention, and routines.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-behaviors":{surfaceId:"psyche-behaviors",title:"Behaviors",description:"Describe concrete behaviors, urges, replacement moves, and the evidence linked to them.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-reports":{surfaceId:"psyche-reports",title:"Reports",description:"Review trigger reports and reflective chains across emotions, thoughts, behaviors, and modes.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-report-detail":{surfaceId:"psyche-report-detail",title:"Report detail",description:"Inspect one report’s event chain, emotions, thoughts, behaviors, modes, and linked records.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-goal-map":{surfaceId:"psyche-goal-map",title:"Goal map",description:"See how goals, values, behaviors, and Psyche records pull on each other.",tone:"psyche",skeleton:{blocks:4,columns:2,sideRail:!0}},"psyche-schemas-beliefs":{surfaceId:"psyche-schemas-beliefs",title:"Schemas and beliefs",description:"Organize recurring schemas and the belief scripts that shape reactions under pressure.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-modes":{surfaceId:"psyche-modes",title:"Modes",description:"Manage mode profiles, their needs, risks, cues, and preferred responses.",tone:"psyche",skeleton:{blocks:5,columns:2,sideRail:!0}},"psyche-mode-guide":{surfaceId:"psyche-mode-guide",title:"Mode guide",description:"Run a guided mode session to name the active part and choose the next response.",tone:"psyche",skeleton:{blocks:4,columns:1,sideRail:!1}},"kanban-index":{surfaceId:"kanban-index",title:"Kanban",description:"Move projects, issues, tasks, and subtasks through execution lanes without losing hierarchy.",tone:"execution",skeleton:{blocks:6,columns:3,sideRail:!1}},"notes-index":{surfaceId:"notes-index",title:"Notes",description:"Create and search Markdown notes linked to Forge entities, dates, tags, and evidence.",tone:"knowledge",skeleton:{blocks:6,columns:2,sideRail:!0}},"wiki-index":{surfaceId:"wiki-index",title:"KarpaWiki",description:"Search KarpaWiki pages, backlinks, entity links, and the SQLite-backed memory graph.",tone:"knowledge",skeleton:{blocks:6,columns:2,sideRail:!0}},"wiki-ingest-history":{surfaceId:"wiki-ingest-history",title:"KarpaWiki ingest history",description:"Review KarpaWiki ingest jobs, source files, mapped entities, and processing outcomes.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!0}},"wiki-page-detail":{surfaceId:"wiki-page-detail",title:"KarpaWiki page",description:"Read one KarpaWiki page with backlinks, linked entities, citations, and related pages.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!0}},"wiki-new":{surfaceId:"wiki-new",title:"New KarpaWiki page",description:"Draft a new KarpaWiki page with Markdown, metadata, and entity links.",tone:"knowledge",skeleton:{blocks:4,columns:1,sideRail:!1}},"wiki-edit":{surfaceId:"wiki-edit",title:"Edit KarpaWiki page",description:"Edit an existing KarpaWiki page while preserving links, metadata, and history.",tone:"knowledge",skeleton:{blocks:4,columns:1,sideRail:!1}},"today-index":{surfaceId:"today-index",title:"Today",description:"Choose today’s next work, inspect time pressure, and keep active execution visible.",tone:"execution",skeleton:{blocks:6,columns:2,sideRail:!0}},workbench:{surfaceId:"workbench",title:"Workbench",description:"Search, organize, and launch graph-based Forge flows, AI tools, and published outputs.",tone:"knowledge",skeleton:{blocks:6,columns:2,sideRail:!0}},"workbench-flow":{surfaceId:"workbench-flow",title:"Workbench flow",description:"Edit and run one Workbench flow with nodes, contracts, traces, and outputs.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!1}},"activity-index":{surfaceId:"activity-index",title:"Activity",description:"Review the audit trail of entity changes, sync events, task work, and system activity.",tone:"core",skeleton:{blocks:6,columns:2,sideRail:!0}},"insights-index":{surfaceId:"insights-index",title:"Insights",description:"Store analyses, coaching notes, recommendations, and decisions that should remain visible.",tone:"knowledge",skeleton:{blocks:5,columns:2,sideRail:!0}},"weekly-review":{surfaceId:"weekly-review",title:"Weekly review",description:"Close out the week, review evidence, and decide the next execution push.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-index":{surfaceId:"settings-index",title:"Settings",description:"Manage Forge runtime preferences, users, integrations, data, models, and companion setup.",tone:"settings",skeleton:{blocks:6,columns:2,sideRail:!0}},"settings-data":{surfaceId:"settings-data",title:"Settings data",description:"Inspect the active data root, create backups, export data, and recover storage state.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-users":{surfaceId:"settings-users",title:"Settings users",description:"Manage human and bot users, ownership, relationships, and visibility rights.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-calendar":{surfaceId:"settings-calendar",title:"Settings calendar",description:"Connect calendar providers, choose writable calendars, and configure scheduling rules.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-mobile":{surfaceId:"settings-mobile",title:"Settings mobile",description:"Pair iPhone and watch companions, inspect mobile sync state, and manage device access.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-mobile-lab":{surfaceId:"settings-mobile-lab",title:"Companion sync lab",description:"Test mobile source states, movement gap fixtures, and companion sync edge cases.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-models":{surfaceId:"settings-models",title:"Settings models",description:"Configure local and remote model providers, defaults, reasoning settings, and availability.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-agents":{surfaceId:"settings-agents",title:"Settings agents",description:"Manage agent tokens, runtime identities, adapter access, and session visibility.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-rewards":{surfaceId:"settings-rewards",title:"Settings rewards",description:"Configure XP posture, reward assets, trophy rules, and progression display.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},rewards:{surfaceId:"rewards",title:"Trophy Hall",description:"Review earned trophies, locked achievements, streak pressure, mascot gear, and unlocks.",tone:"execution",skeleton:{blocks:6,columns:3,sideRail:!0}},"settings-wiki":{surfaceId:"settings-wiki",title:"KarpaWiki settings",description:"Configure KarpaWiki ingest behavior, wiki profiles, memory settings, and source handling.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"settings-logs":{surfaceId:"settings-logs",title:"Settings logs",description:"Inspect diagnostic logs, runtime events, errors, and troubleshooting context.",tone:"settings",skeleton:{blocks:6,columns:2,sideRail:!0}},"settings-bin":{surfaceId:"settings-bin",title:"Settings bin",description:"Review soft-deleted Forge records and restore useful data before permanent cleanup.",tone:"settings",skeleton:{blocks:5,columns:2,sideRail:!0}},"task-detail":{surfaceId:"task-detail",title:"Task detail",description:"Work one task with timer state, instructions, linked context, notes, and closeout.",tone:"execution",skeleton:{blocks:5,columns:2,sideRail:!0}}};function Hs(e){const t=e.startsWith("/forge/")?e.slice(6):e==="/forge"?"/":e,n=t.startsWith("/")?t:`/${t}`;return n.length>1&&n.endsWith("/")?n.slice(0,-1):n}function _(...e){const t=new Set(e.map(Hs));return n=>t.has(n)}function yc(e){const t=Hs(e);return n=>n===t||n.startsWith(`${t}/`)}function ae(e){return t=>e.test(t)}const bc=[{viewId:"overview",match:_("/","/overview")},{viewId:"life-force-index",match:_("/life-force")},{viewId:"goals-index",match:_("/goals")},{viewId:"habits-index",match:_("/habits")},{viewId:"goal-detail",match:ae(/^\/goals\/[^/]+$/)},{viewId:"project-hierarchy",match:_("/projects/hierarchy")},{viewId:"projects-index",match:_("/projects")},{viewId:"project-detail",match:ae(/^\/projects\/[^/]+$/)},{viewId:"strategies-index",match:_("/strategies")},{viewId:"strategy-detail",match:ae(/^\/strategies\/[^/]+$/)},{viewId:"preferences-index",match:yc("/preferences")},{viewId:"calendar-index",match:_("/calendar")},{viewId:"knowledge-graph-index",match:_("/knowledge-graph")},{viewId:"movement-index",match:_("/movement")},{viewId:"sleep-index",match:_("/sleep")},{viewId:"sports-workout-detail",match:ae(/^\/sports\/workouts\/[^/]+$/)},{viewId:"sports-index",match:_("/sports")},{viewId:"training-load-index",match:_("/training-load")},{viewId:"vitals-index",match:_("/vitals")},{viewId:"weight-loss-index",match:_("/weight-loss")},{viewId:"psyche-metrics",match:_("/psyche/metrics")},{viewId:"psyche-flashcards",match:_("/psyche/flashcards")},{viewId:"psyche-values",match:_("/psyche/values")},{viewId:"psyche-patterns",match:_("/psyche/patterns")},{viewId:"psyche-questionnaire-new",match:_("/psyche/questionnaires/new")},{viewId:"psyche-questionnaire-edit",match:ae(/^\/psyche\/questionnaires\/[^/]+\/edit$/)},{viewId:"psyche-questionnaire-run",match:ae(/^\/psyche\/questionnaires\/[^/]+\/take$/)},{viewId:"psyche-questionnaire-detail",match:ae(/^\/psyche\/questionnaires\/[^/]+$/)},{viewId:"psyche-questionnaires",match:_("/psyche/questionnaires")},{viewId:"psyche-questionnaire-run-detail",match:ae(/^\/psyche\/questionnaire-runs\/[^/]+$/)},{viewId:"psyche-self-observation",match:_("/psyche/self-observation")},{viewId:"psyche-screen-time",match:_("/psyche/screen-time")},{viewId:"psyche-behaviors",match:_("/psyche/behaviors")},{viewId:"psyche-report-detail",match:ae(/^\/psyche\/reports\/[^/]+$/)},{viewId:"psyche-reports",match:_("/psyche/reports")},{viewId:"psyche-goal-map",match:_("/psyche/goal-map")},{viewId:"psyche-schemas-beliefs",match:_("/psyche/schemas-beliefs")},{viewId:"psyche-mode-guide",match:_("/psyche/modes/guide")},{viewId:"psyche-modes",match:_("/psyche/modes")},{viewId:"psyche-index",match:_("/psyche")},{viewId:"kanban-index",match:_("/kanban")},{viewId:"notes-index",match:_("/notes")},{viewId:"wiki-ingest-history",match:_("/wiki/ingest-history")},{viewId:"wiki-page-detail",match:ae(/^\/wiki\/page\/[^/]+$/)},{viewId:"wiki-new",match:_("/wiki/new")},{viewId:"wiki-edit",match:ae(/^\/wiki\/edit\/[^/]+$/)},{viewId:"wiki-index",match:_("/wiki")},{viewId:"today-index",match:_("/today")},{viewId:"workbench-flow",match:ae(/^\/workbench\/[^/]+$/)},{viewId:"workbench",match:_("/workbench")},{viewId:"activity-index",match:_("/activity")},{viewId:"insights-index",match:_("/insights")},{viewId:"weekly-review",match:_("/review/weekly")},{viewId:"settings-data",match:_("/settings/data")},{viewId:"settings-users",match:_("/settings/users")},{viewId:"settings-calendar",match:_("/settings/calendar")},{viewId:"settings-mobile-lab",match:_("/settings/mobile/lab")},{viewId:"settings-mobile",match:_("/settings/mobile")},{viewId:"settings-models",match:_("/settings/models")},{viewId:"settings-agents",match:_("/settings/agents")},{viewId:"settings-rewards",match:_("/settings/rewards")},{viewId:"settings-wiki",match:_("/settings/wiki")},{viewId:"settings-logs",match:_("/settings/logs")},{viewId:"settings-bin",match:_("/settings/bin")},{viewId:"settings-index",match:_("/settings")},{viewId:"rewards",match:_("/rewards")},{viewId:"task-detail",match:ae(/^\/tasks\/[^/]+$/)}];function xc(e){var n;const t=Hs(e);return((n=bc.find(a=>a.match(t)))==null?void 0:n.viewId)??"overview"}const Jt=[{id:"overview",to:"/overview",labelKey:"common.routeLabels.overview",detailKey:"common.routeDetails.overview",icon:br},{id:"life-force",to:"/life-force",label:"Life Force",detail:U["life-force-index"].description,icon:ti},{id:"goals",to:"/goals",labelKey:"common.routeLabels.goals",detailKey:"common.routeDetails.goals",icon:Ua},{id:"habits",to:"/habits",labelKey:"common.routeLabels.habits",detailKey:"common.routeDetails.habits",icon:Ba},{id:"projects",to:"/projects",labelKey:"common.routeLabels.projects",detailKey:"common.routeDetails.projects",icon:xr},{id:"strategies",to:"/strategies",labelKey:"common.routeLabels.strategies",detailKey:"common.routeDetails.strategies",icon:Ss},{id:"preferences",to:"/preferences",labelKey:"common.routeLabels.preferences",detailKey:"common.routeDetails.preferences",icon:Za},{id:"calendar",to:"/calendar",labelKey:"common.routeLabels.calendar",detailKey:"common.routeDetails.calendar",icon:cs},{id:"knowledge-graph",to:"/knowledge-graph",label:"Knowledge Graph",detail:U["knowledge-graph-index"].description,icon:Ya},{id:"workbench",to:"/workbench",label:"Workbench",detail:U.workbench.description,icon:Ka},{id:"movement",to:"/movement",labelKey:"common.routeLabels.movement",detailKey:"common.routeDetails.movement",icon:wr},{id:"sleep",to:"/sleep",labelKey:"common.routeLabels.sleep",detailKey:"common.routeDetails.sleep",icon:ei},{id:"sports",to:"/sports",labelKey:"common.routeLabels.sports",detailKey:"common.routeDetails.sports",icon:kr},{id:"training-load",to:"/training-load",label:"Training Load",detail:U["training-load-index"].description,icon:Sr},{id:"vitals",to:"/vitals",label:"Vitals",detail:U["vitals-index"].description,icon:jr},{id:"weight-loss",to:"/weight-loss",label:"Weight Loss",detail:U["weight-loss-index"].description,icon:Nr},{id:"kanban",to:"/kanban",labelKey:"common.routeLabels.kanban",detailKey:"common.routeDetails.kanban",icon:Wt},{id:"today",to:"/today",labelKey:"common.routeLabels.today",detailKey:"common.routeDetails.today",icon:Ts},{id:"rewards",to:"/rewards",label:"Trophy Hall",detail:U.rewards.description,icon:ls},{id:"notes",to:"/notes",labelKey:"common.routeLabels.notes",detailKey:"common.routeDetails.notes",icon:js},{id:"wiki",to:"/wiki",labelKey:"common.routeLabels.wiki",detailKey:"common.routeDetails.wiki",icon:Pr},{id:"psyche",to:"/psyche",labelKey:"common.routeLabels.psyche",detailKey:"common.routeDetails.psyche",icon:Qa},{id:"activity",to:"/activity",labelKey:"common.routeLabels.activity",detailKey:"common.routeDetails.activity",icon:Gt},{id:"insights",to:"/insights",labelKey:"common.routeLabels.insights",detailKey:"common.routeDetails.insights",icon:Tr},{id:"review",to:"/review/weekly",labelKey:"common.routeLabels.review",detailKey:"common.routeDetails.review",icon:Rr},{id:"settings",to:"/settings",labelKey:"common.routeLabels.settings",detailKey:"common.routeDetails.settings",icon:ks}],wc={"/psyche/metrics":U["psyche-metrics"].description,"/psyche/flashcards":U["psyche-flashcards"].description,"/psyche/values":U["psyche-values"].description,"/psyche/patterns":U["psyche-patterns"].description,"/psyche/questionnaires":U["psyche-questionnaires"].description,"/psyche/self-observation":U["psyche-self-observation"].description,"/psyche/behaviors":U["psyche-behaviors"].description,"/psyche/reports":U["psyche-reports"].description,"/psyche/goal-map":U["psyche-goal-map"].description,"/psyche/schemas-beliefs":U["psyche-schemas-beliefs"].description,"/psyche/modes":U["psyche-modes"].description,"/psyche/screen-time":U["psyche-screen-time"].description,"/preferences":U["preferences-index"].description,"/sleep":U["sleep-index"].description},kc=vt.filter(e=>e.to!=="/psyche").map(e=>({id:`psyche:${e.to}`,to:e.to,icon:e.icon,label:e.label,detail:wc[e.to]??U["psyche-index"].description})),De=[...Jt,...kc],Sc=Jt.filter(e=>e.to!=="/preferences"&&e.to!=="/sleep");function ft(e){const t=Jt.find(n=>n.id===e);if(!t)throw new Error(`Missing primary route: ${e}`);return t}function jc(e){return e==="/wiki"||e.startsWith("/wiki/page/")||e==="/wiki/new"||e.startsWith("/wiki/edit/")}function zt(e){return e.startsWith("/psyche")||e==="/preferences"||e.startsWith("/preferences/")||e==="/sleep"||e.startsWith("/sleep/")}function Ft(e,t){return t.to==="/psyche"?zt(e):e===t.to||e.startsWith(`${t.to}/`)}function Re(e,t){return e.labelKey?t(e.labelKey):e.label??e.to}function Us(e,t){return e.detailKey?t(e.detailKey):e.detail??e.to}const Ti="fixed inset-0 z-50 bg-[var(--ui-overlay-backdrop)] backdrop-blur-sm",Ri="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",_i="font-display text-[1.25rem] tracking-[-0.04em] text-[var(--ui-ink-strong)]",Ci="mt-1 text-[13px] leading-6 text-[var(--ui-ink-muted)]",ja="bg-[var(--ui-surface-1)] text-[var(--ui-ink-muted)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",Ii="bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)] shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--primary)_28%,transparent)]",It="text-[var(--ui-ink-faint)]",fs="forge.desktop-nav-layout",vs="forge.mobile-nav-layout",Na="forge.nav-layout-migrations",Pa="forge.desktop-sidebar-metrics-position",Nc="desktop-knowledge-graph-default-v1",Pc="mobile-knowledge-graph-default-v1";function ys(e){return!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey}function Ta(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(e);if(!n)return t;const a=JSON.parse(n);if(!Array.isArray(a))return t;const i=new Set(De.map(u=>u.id)),o=a.filter(u=>typeof u=="string"&&i.has(u)),c=o.length>0?o:t,d=()=>{try{const u=window.localStorage.getItem(Na);if(!u)return{};const h=JSON.parse(u);return h&&typeof h=="object"&&!Array.isArray(h)?h:{}}catch{return{}}},p=u=>{try{window.localStorage.setItem(Na,JSON.stringify(u))}catch{return}},g=(u,h,j)=>{const b=d();if(b[h])return u;const v=u.includes("knowledge-graph")?u:(()=>{const C=u.indexOf(j);return C<0?[...u,"knowledge-graph"]:[...u.slice(0,C+1),"knowledge-graph",...u.slice(C+1)]})();return p({...b,[h]:!0}),v};return e===fs?g(c,Nc,"calendar"):e===vs?g(c,Pc,"notes"):c}catch{return t}}function Ra(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{return}}function Tc(e){const[t,n]=l.useState(!1),[a,i]=l.useState(()=>Ta(fs,[...Sc.map(y=>y.id)])),[o,c]=l.useState(()=>Ta(vs,[ft("overview").id,ft("today").id,ft("kanban").id,ft("notes").id,ft("knowledge-graph").id])),[d,p]=l.useState(!1),[g,u]=l.useState(()=>{if(typeof window>"u")return"above";try{return window.localStorage.getItem(Pa)==="below"?"below":"above"}catch{return"above"}}),h=l.useRef(!1),j=l.useRef(!1),b=l.useRef(!1),v=jc(e)||zt(e)||e.startsWith("/workbench")||e.startsWith("/knowledge-graph"),C=a.map(y=>De.find(O=>O.id===y)??null).filter(y=>y!==null),m=o.map(y=>De.find(O=>O.id===y)??null).filter(y=>y!==null);return l.useEffect(()=>{try{window.localStorage.getItem("forge.desktop-nav-collapsed")==="true"&&n(!0)}catch{return}},[]),l.useEffect(()=>{if(b.current){b.current=!1;return}try{window.localStorage.setItem("forge.desktop-nav-collapsed",String(t))}catch{return}},[t]),l.useEffect(()=>{try{window.localStorage.setItem(Pa,g)}catch{return}},[g]),l.useEffect(()=>{Ra(fs,a)},[a]),l.useEffect(()=>{Ra(vs,o)},[o]),l.useEffect(()=>{if(v){h.current||(j.current=t,h.current=!0,t||(b.current=!0,n(!0)));return}h.current&&(h.current=!1,t!==j.current&&(b.current=!0,n(j.current)))},[v,t]),{navCollapsed:t,setNavCollapsed:n,desktopNavIds:a,setDesktopNavIds:i,mobileNavIds:o,setMobileNavIds:c,desktopRoutes:C,mobileRoutes:m,navEditorOpen:d,setNavEditorOpen:p,desktopSidebarMetricsPosition:g,setDesktopSidebarMetricsPosition:u}}function Rc({route:e,compact:t=!1,onRouteIntent:n}){const{t:a}=ye(),i=Qe(),o=Re(e,a),c=e.icon,d=Ft(i.pathname,e);return s.jsxs(wt,{to:e.to,title:t?o:void 0,"aria-label":o,onClick:p=>{ys(p)&&(n==null||n(e.to))},className:({isActive:p})=>x("interactive-tap flex items-center rounded-[18px] text-sm transition",p||d?Ii:"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:[s.jsx(c,{className:"size-4 shrink-0"}),t?null:s.jsx("span",{children:o})]})}function _c({routes:e,onOpenEditor:t,onRouteIntent:n}){const[a,i]=l.useState(!1),{t:o}=ye(),c=Qe(),d=l.useRef(null),p=l.useRef(!1),g=e.slice(0,4),u=De.filter(b=>!g.some(v=>v.id===b.id));function h(){p.current=!1,d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{p.current=!0,i(!1),t==null||t()},520)}function j(){d.current!==null&&(window.clearTimeout(d.current),d.current=null)}return s.jsxs(s.Fragment,{children:[s.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:s.jsxs("div",{className:"grid grid-cols-5 gap-2",children:[g.map(b=>s.jsxs(wt,{to:b.to,onPointerDown:h,onPointerUp:j,onPointerLeave:j,onClick:v=>{if(p.current){v.preventDefault(),p.current=!1;return}ys(v)&&(n==null||n(b.to))},className:({isActive:v})=>x("flex min-h-11 flex-col items-center justify-center gap-1 rounded-2xl px-2 py-2 text-[12px]",v||Ft(c.pathname,b)?"bg-[var(--ui-surface-active)] text-[var(--primary)]":"text-[var(--ui-ink-soft)]"),children:[s.jsx(b.icon,{className:"size-4"}),s.jsx("span",{children:Re(b,o)})]},b.id)),s.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(p.current){p.current=!1;return}i(!0)},onPointerDown:h,onPointerUp:j,onPointerLeave:j,children:[s.jsx(ks,{className:"size-4"}),s.jsx("span",{children:o("common.shell.more")})]})]})}),s.jsxs(Gs,{open:a,onOpenChange:i,eyebrow:o("common.shell.moreRoutesEyebrow"),title:o("common.shell.moreRoutesTitle"),description:o("common.shell.moreRoutesDescription"),children:[s.jsx("div",{className:"mb-3 flex items-center justify-between gap-3",children:s.jsxs("button",{type:"button",className:x("inline-flex min-h-10 items-center gap-2 rounded-full px-3 py-2 text-sm",ja),onClick:()=>{i(!1),t==null||t()},children:[s.jsx(Rs,{className:"size-4"}),"Customize navigation"]})}),s.jsx("div",{className:"grid gap-3",children:u.map(b=>s.jsxs(wt,{to:b.to,onClick:v=>{ys(v)&&(n==null||n(b.to)),i(!1)},className:({isActive:v})=>x("interactive-tap flex items-center justify-between rounded-[24px] px-4 py-4",v||Ft(c.pathname,b)?Ii:ja),children:[s.jsxs("span",{className:"flex items-center gap-3",children:[s.jsx(b.icon,{className:"size-4 text-[var(--primary)]"}),s.jsxs("span",{children:[s.jsx("span",{className:"block text-base font-medium",children:Re(b,o)}),s.jsx("span",{className:"mt-1 block text-sm text-[var(--ui-ink-soft)]",children:Us(b,o)})]})]}),s.jsx(Gt,{className:"size-4 text-[var(--ui-ink-faint)]"})]},b.id))})]})]})}function Cc(e,t,n){const a=e.indexOf(t),i=e.indexOf(n);return a<0||i<0||a===i?e:ho(e,a,i)}function Ic({route:e,prefix:t,label:n,onRemove:a}){const i=mo({id:`${t}:${e.id}`});return s.jsxs("div",{ref:i.setNodeRef,style:{transform:po.Transform.toString(i.transform),transition:i.transition},className:"flex min-h-16 items-center justify-between gap-3 rounded-[20px] bg-[var(--ui-surface-1)] px-4 py-3",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.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 ${n}`,...i.attributes,...i.listeners,children:s.jsx(Rs,{className:"size-4"})}),s.jsx(e.icon,{className:"size-4 shrink-0 text-[var(--primary)]"}),s.jsx("span",{className:"truncate text-sm text-[var(--ui-ink-strong)]",children:n})]}),s.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:a,children:"Remove"})]})}function Oc({open:e,onOpenChange:t,desktopNavIds:n,onDesktopNavIdsChange:a,desktopSidebarMetricsPosition:i,onDesktopSidebarMetricsPositionChange:o,mobileNavIds:c,onMobileNavIdsChange:d}){const{t:p}=ye(),g=ao(io(ro,{activationConstraint:{distance:6}})),u=De.filter(m=>!n.includes(m.id)||!c.includes(m.id)),h=10,j=4;function b(m,y,O,T,$){const V=m.map(A=>De.find(G=>G.id===A)??null).filter(A=>A!==null),M=Math.max(0,y-V.length);return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(oo,{sensors:g,collisionDetection:lo,onDragEnd:A=>{const G=String(A.active.id),ee=A.over?String(A.over.id):null;ee&&O(Cc(m,G.replace(`${$}:`,""),ee.replace(`${$}:`,"")))},children:s.jsx(co,{items:V.map(A=>`${$}:${A.id}`),strategy:uo,children:V.map(A=>s.jsx(Ic,{route:A,prefix:$,label:Re(A,p),onRemove:()=>C(m,A.id,O,T)},`${$}-${A.id}`))})}),Array.from({length:M},(A,G)=>s.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:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:"Empty slot"}),s.jsx("div",{className:"text-[12px] text-[var(--ui-ink-faint)]",children:"Add a route below to fill this slot"})]}),s.jsxs("div",{className:"rounded-full bg-[var(--ui-surface-2)] px-2.5 py-1 text-[11px] text-[var(--ui-ink-faint)]",children:["Slot ",V.length+G+1]})]},`${$}-empty-${G}`))]})}function v(m,y,O,T){if(m.includes(y))return;const $=[...m,y];O(T?$.slice(0,T):$)}function C(m,y,O,T=1){const $=m.filter(V=>V!==y);$.length<T||O($)}return s.jsx(Gs,{open:e,onOpenChange:t,eyebrow:"Navigation",title:"Customize navigation",description:"Choose which Forge surfaces appear in the sidebar and mobile bar; Psyche entries open specific record families such as metrics, beliefs, modes, and reports.",children:s.jsxs("div",{className:"grid gap-5",children:[s.jsxs("div",{className:"grid gap-3",children:[s.jsx("div",{className:x("text-[11px] uppercase tracking-[0.16em]",It),children:"Desktop sidebar"}),s.jsxs("div",{className:"rounded-[20px] bg-[var(--ui-surface-1)] p-3",children:[s.jsx("div",{className:x("text-[11px] uppercase tracking-[0.14em]",It),children:"Metric strip position"}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:[["above","Above navigation"],["below","Below navigation"]].map(([m,y])=>s.jsx("button",{type:"button",className:x("rounded-full px-3 py-1.5 text-[12px] transition",i===m?"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(m),children:y},m))})]}),s.jsx("div",{className:"grid gap-2",children:b(n,h,a,4,"desktop")})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx("div",{className:x("text-[11px] uppercase tracking-[0.16em]",It),children:"Mobile bar"}),s.jsx("div",{className:"grid gap-2",children:b(c,j,d,2,"mobile")})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx("div",{className:x("text-[11px] uppercase tracking-[0.16em]",It),children:"Available routes"}),s.jsx("div",{className:"grid gap-2",children:u.map(m=>s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-[20px] bg-[var(--ui-surface-1)] px-4 py-3",children:[s.jsxs("span",{className:"flex items-center gap-3",children:[s.jsx(m.icon,{className:"size-4 text-[var(--primary)]"}),s.jsxs("span",{children:[s.jsx("span",{className:"block text-sm text-[var(--ui-ink-strong)]",children:Re(m,p)}),s.jsx("span",{className:"block text-[12px] text-[var(--ui-ink-soft)]",children:Us(m,p)})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[n.includes(m.id)?null:s.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:()=>v(n,m.id,a),children:"+ Sidebar"}),c.includes(m.id)?null:s.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:()=>v(c,m.id,d,4),children:"+ Mobile"})]})]},`available-${m.id}`))})]})]})})}function Oi({eyebrow:e,title:t,description:n}){const{t:a}=ye();return s.jsxs(Te,{className:"surface-pulse ambient-glow mx-auto grid max-w-2xl gap-4 text-center",children:[s.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:e??a("common.labels.loading")}),s.jsx("div",{className:"type-display-section text-[var(--ui-ink-strong)]",children:t??a("common.pageState.loadingTitle")}),s.jsx("p",{className:"type-body mx-auto max-w-xl text-[var(--ui-ink-soft)]",children:n??a("common.pageState.loadingDescription")}),s.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:[s.jsx(Os,{tone:"subtle",className:"size-3.5"}),s.jsx("span",{className:"type-meta",children:a("common.labels.syncInProgress")})]})]})}function Dt({error:e,onRetry:t,eyebrow:n}){const{t:a}=ye(),{title:i,description:o,code:c}=Ro(e);return s.jsxs(Te,{className:"mx-auto grid max-w-2xl gap-4",children:[s.jsx("div",{className:"type-label text-rose-200/72",children:n??a("common.labels.connectionState")}),s.jsx("div",{className:"type-display-section text-[var(--ui-ink-strong)]",children:i}),s.jsx("p",{className:"type-body text-[var(--ui-ink-soft)]",children:o}),s.jsx("div",{className:"type-meta text-[var(--ui-ink-faint)]",children:a("common.labels.errorCode",{code:c})}),t?s.jsx("div",{className:"flex flex-wrap gap-3",children:s.jsxs(B,{type:"button",variant:"secondary",onClick:t,children:[s.jsx(_s,{className:"mr-2 size-4"}),a("common.actions.retry")]})}):null]})}function cv({eyebrow:e,title:t,description:n,action:a}){const{t:i}=ye();return s.jsxs(Te,{className:"mx-auto grid max-w-2xl gap-4 text-center",children:[s.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:e??i("common.labels.loading")}),s.jsx("div",{className:"type-display-section text-[var(--ui-ink-strong)]",children:t}),s.jsx("p",{className:"type-body mx-auto max-w-xl text-[var(--ui-ink-soft)]",children:n}),a?s.jsx("div",{className:"flex justify-center",children:a}):null]})}function Ec(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 Ac(e){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}function Lc({open:e,onOpenChange:t,isLoading:n,isError:a,error:i,onRetry:o,recentIngestJobs:c}){return s.jsx(Ze,{open:e,onOpenChange:t,children:s.jsxs(et,{children:[s.jsx(tt,{className:Ti}),s.jsxs(st,{className:x(Ri,"top-[10vh] w-[min(42rem,calc(100vw-1.5rem))]"),children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx(nt,{className:_i,children:"Background activity"}),s.jsx(at,{className:Ci,children:"Follow active KarpaWiki ingest jobs and reopen completed reviews without leaving your current context."})]}),s.jsx(qt,{asChild:!0,children:s.jsx(Vt,{"aria-label":"Close background activity dialog"})})]}),s.jsx("div",{className:"mt-4 max-h-[65vh] overflow-y-auto",children:n?s.jsx(Oi,{eyebrow:"Background",title:"Loading activity",description:"Checking the latest queued and completed ingest jobs."}):a?s.jsx(Dt,{eyebrow:"Background",error:i,onRetry:o}):c.length===0?s.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."}):s.jsx("div",{className:"grid gap-3",children:c.map(d=>{const p=["queued","processing"].includes(d.job.status);return s.jsx(Ke,{to:Ec(d),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:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"KarpaWiki ingest"}),s.jsx("div",{className:"mt-2 text-[14px] font-semibold text-[var(--ui-ink-strong)]",children:d.job.titleHint||d.job.latestMessage||"Background ingest"}),s.jsxs("div",{className:"mt-1 text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:[d.job.status," · ",d.job.phase," ·"," ",d.job.progressPercent,"% ·"," ",Ac(d.job.updatedAt)]}),s.jsxs("div",{className:"mt-2 text-[12px] leading-5 text-[var(--ui-ink-faint)]",children:[d.job.createdPageCount," pages ·"," ",d.job.createdEntityCount," entities ·"," ",d.job.acceptedCount," accepted ·"," ",d.job.rejectedCount," rejected"]})]}),s.jsx("div",{className:"shrink-0",children:p?s.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:[s.jsx(_s,{className:"size-3.5 animate-spin"}),"Running"]}):s.jsx(D,{tone:"meta",children:d.job.phase})})]})},d.job.id)})})})]})]})})}const He=16,Dc=320,$c=180,Mc=220;function dv({children:e,className:t}){return s.jsx("div",{className:x("text-sm leading-6 text-[var(--ui-ink-soft)]",t),children:e})}function bs({content:e,title:t,label:n="Explain this field",className:a,panelClassName:i,maxWidthPx:o=Dc}){const[c,d]=l.useState(!1),[p,g]=l.useState({}),u=l.useRef(null),h=l.useRef(null),j=l.useId(),b=typeof document>"u"?null:Ns.createPortal(s.jsxs("span",{id:j,role:"tooltip","aria-hidden":!c,"data-state":c?"open":"closed",style:p,className:x("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",c?"translate-y-0 opacity-100":"translate-y-1 opacity-0",i),children:[t?s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--ui-ink-soft)]",children:t}):null,s.jsx("span",{className:"block min-w-0 whitespace-normal break-words",children:e})]}),document.body);return l.useLayoutEffect(()=>{if(!c)return;const v=()=>{const C=h.current;if(!C)return;const m=C.getBoundingClientRect(),y=window.innerWidth<480?window.innerWidth-He*2:Math.min(o,window.innerWidth-He*2),O=m.left+m.width/2-y/2,T=window.innerWidth-y-He,$=Math.max(He,Math.min(O,T)),M=window.innerHeight-m.bottom>=$c?m.bottom+8:Math.max(He,m.top-Mc);g({left:$,maxHeight:`calc(100vh - ${M+He}px)`,top:M,width:y})};return v(),window.addEventListener("resize",v),window.addEventListener("scroll",v,!0),()=>{window.removeEventListener("resize",v),window.removeEventListener("scroll",v,!0)}},[o,c]),l.useEffect(()=>{if(!c)return;const v=C=>{var m;(m=u.current)!=null&&m.contains(C.target)||d(!1)};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[c]),s.jsxs("span",{ref:u,className:x("relative inline-flex items-center",a),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[s.jsx("button",{ref:h,type:"button","aria-label":n,"aria-describedby":c?j:void 0,"aria-expanded":c,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:()=>d(!0),onBlur:()=>d(!1),onClick:()=>d(v=>!v),onKeyDown:v=>{v.key==="Escape"&&d(!1)},children:s.jsx(_r,{className:"size-3.5"})}),b]})}const Ei=[{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 Ai(e,t,n){return Math.min(n,Math.max(t,e))}function jt(e,t){return Math.max(0,Math.floor((Date.parse(t)-Date.parse(e))/1e3))}function it(e,t){const n=t/3600*e;return{rateApPerHour:Number(e.toFixed(2)),totalAp:Number(n.toFixed(2))}}function qs(e){return(e==null?void 0:e.sustainRateApPerHour)??null}function Li(e){var t;return((t=Ei.find(n=>n.key===e))==null?void 0:t.defaultRateApPerHour)??null}function Di(e){var t;return typeof((t=e==null?void 0:e.metadata)==null?void 0:t.activityPresetKey)=="string"?e.metadata.activityPresetKey:null}function zc(e){var t;return typeof((t=e==null?void 0:e.metadata)==null?void 0:t.customSustainRateApPerHour)=="number"?e.metadata.customSustainRateApPerHour:null}function uv(){return Ei}function mv(e){return Di(e)}function pv(e){return zc(e)}function $i(e,t){return typeof e!="number"||!Number.isFinite(e)?`0 ${t}`:`${Number(e.toFixed(1))} ${t}`}function hv(e){return $i(e,"AP")}function Fc(e){return $i(e,"AP/h")}function gv(e){const t=qs(e.actionProfile)??4.166666666666667;return it(t,jt(e.startsAt,e.endsAt))}function Mi(e){return e==="main_activity"?14:e==="secondary_activity"?9:e==="third_activity"||e==="custom"?6:e==="holiday"?4:3}function fv(e){const t=qs(e.actionProfile)??Mi(e.kind);return it(t,jt(e.startAt,e.endAt))}function vv(e){const t="2026-01-01T00:00:00.000Z",n=new Date(t);n.setUTCMinutes(e.startMinute,0,0);const a=new Date(t);a.setUTCMinutes(e.endMinute,0,0),a<=n&&a.setUTCDate(a.getUTCDate()+1);const i=e.customSustainRateApPerHour??Li(e.activityPresetKey)??Mi(e.kind);return it(i,jt(n.toISOString(),a.toISOString()))}function Wc(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 yv(e){const t=e.customSustainRateApPerHour??qs(e.actionProfile)??Li(e.activityPresetKey??Di(e.actionProfile))??Wc(e);return it(t,jt(e.startAt,e.endAt))}function bv(e){const t=Ai((e.expectedMet??2)*4,4,22);return it(t,jt(e.startedAt,e.endedAt))}function xv(e){return{totalAp:3,rateApPerHour:0}}function wv(e){if(!e.generatedHealthEventTemplate.enabled)return null;const t=Ai(e.generatedHealthEventTemplate.durationMinutes||0,0,1440);return t<=0?null:it(24,t*60)}function kv(e){return{totalAp:1,rateApPerHour:0}}const Gc={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."},_a={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."},Ca={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 Hc(e){if(!e)return _a;const t=e.split(":")[0]??e;return Ca[e]??Ca[t]??_a}function Uc(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:ti},{id:"instant-ap",label:"Instant AP/h",compactValue:e.lifeForce?String(Number(e.lifeForce.instantFreeApPerHour.toFixed(1))):"0",expandedValue:e.lifeForce?Fc(e.lifeForce.instantFreeApPerHour):"0 AP/h",icon:Ts},{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:Ha},{id:"xp",label:t("common.shell.momentum.xp"),compactValue:String(e.metrics.totalXp),expandedValue:`${e.metrics.totalXp} XP`,icon:Wt},{id:"momentum",label:t("common.shell.momentum.momentum"),compactValue:`${e.metrics.momentumScore}%`,expandedValue:t("common.shell.momentum.liveMomentum",{count:e.metrics.momentumScore}),icon:Cr}]}function Ia({metrics:e,collapsed:t}){return s.jsx("div",{className:x(t?"mt-4":"mt-6"),children:s.jsxs("div",{className:x("rounded-[24px] bg-[var(--ui-surface-1)]",t?"px-2 py-2.5":"p-4"),children:[t?null:s.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:"Live metrics"}),s.jsx("div",{className:x("grid",t?"gap-1.5":"mt-3 gap-3"),children:e.map(n=>s.jsx(qc,{metric:n,collapsed:t},n.id))})]})})}function qc({metric:e,collapsed:t}){const n=e.icon;return t?s.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:[s.jsx(n,{className:"size-3.5 shrink-0 text-[var(--ui-ink-faint)]"}),s.jsx("div",{className:"max-w-full text-[12px] font-semibold leading-none text-[var(--ui-ink-strong)]",children:e.compactValue})]}):s.jsxs("div",{className:"rounded-[18px] bg-[var(--ui-surface-1)] px-3 py-3",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-[0.14em] text-[var(--ui-ink-faint)]",children:[s.jsx("span",{children:e.label}),s.jsx(bs,{label:`Explain ${e.label}`,title:e.label,content:Gc[e.id]??"This is a live Forge shell metric for the selected user scope.",panelClassName:"normal-case tracking-normal"})]}),s.jsx("div",{className:"mt-1 text-lg font-semibold leading-tight text-[var(--ui-ink-strong)]",children:e.expandedValue})]})}function Kc({prompt:e,setPrompt:t,onSubmit:n}){return s.jsx(Ze,{open:e!==null,onOpenChange:a=>{a||t(null)},children:s.jsxs(et,{children:[s.jsx(tt,{className:"fixed inset-0 z-[70] bg-[var(--ui-overlay-backdrop)] backdrop-blur-xl"}),s.jsxs(st,{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:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(nt,{className:"font-display text-[1.35rem] leading-tight text-[var(--ui-ink-strong)]",children:"Log today's work before closing"}),s.jsxs(at,{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"," ",s.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."]})]}),s.jsx(Vt,{onClick:()=>t(null)})]}),s.jsxs("div",{className:"mt-5",children:[s.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Quick amounts"}),s.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(a=>s.jsx(B,{variant:"secondary",onClick:()=>n(a.seconds),children:a.label},a.label))})]}),s.jsxs("div",{className:"mt-5 grid gap-3 rounded-[20px] bg-[var(--ui-surface-1)] p-4",children:[s.jsxs("label",{className:"grid gap-2 text-sm text-[var(--ui-ink-medium)]",children:[s.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Custom minutes"}),s.jsx("input",{type:"number",min:0,step:5,value:(e==null?void 0:e.customMinutes)??"",onChange:a=>{t(i=>i&&{...i,customMinutes:a.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?s.jsx("div",{className:"text-sm text-[var(--danger)]",children:e.error}):null]}),s.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-3",children:[s.jsx(B,{variant:"secondary",onClick:()=>t(null),children:"Cancel"}),s.jsx(B,{variant:"secondary",onClick:()=>n(0),children:"No work today"}),s.jsx(B,{onClick:()=>{if(!e)return;const a=Number(e.customMinutes);if(!Number.isFinite(a)||a<0){t(i=>i&&{...i,error:"Enter a valid number of minutes."});return}n(Math.round(a*60))},children:"Close with logged time"})]})]})]})})}const Ks=l.createContext({expanded:!1,setExpanded:()=>{}});function Oa({children:e}){const[t,n]=l.useState(!1),a=l.useRef(0);return l.useEffect(()=>{if(!t)return;a.current=performance.now();let i=window.scrollY;const o=()=>{if(performance.now()-a.current<280){i=window.scrollY;return}window.scrollY-i>16&&n(!1),i=window.scrollY};return window.addEventListener("scroll",o,{passive:!0}),()=>window.removeEventListener("scroll",o)},[t]),s.jsx(Ks.Provider,{value:{expanded:t,setExpanded:n},children:e})}function Ue(e){const t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),a=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${String(a).padStart(2,"0")}:${String(i).padStart(2,"0")}`:`${String(a).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function Bc(e,t,n,a,i){const o=Math.max(1,e.length),c=Date.parse(n),d=Number.isFinite(c)?Math.max(0,Math.floor((i-c)/1e3)):0;return e.map(p=>{const g=t.find(C=>C.id===p.taskId),u=p.status==="active"?p.elapsedWallSeconds+d:p.elapsedWallSeconds,h=p.status!=="active"?0:a==="parallel"?d:a==="split"?d/o:p.isCurrent?d:0,j=p.creditedSeconds+h,b=p.timerMode==="planned"&&p.plannedDurationSeconds!==null?Math.max(0,p.plannedDurationSeconds-u):null,v=p.timerMode==="planned"&&p.plannedDurationSeconds!==null?Math.max(0,u-p.plannedDurationSeconds):0;return{run:p,title:(g==null?void 0:g.title)??p.taskTitle,wallSeconds:u,creditedSeconds:j,remainingSeconds:b,overtimeSeconds:v}}).sort((p,g)=>Number(g.run.isCurrent)-Number(p.run.isCurrent))}function zi(e,t,n,a){const[i,o]=l.useState(()=>Date.now());return l.useEffect(()=>{if(e.length===0)return;const c=window.setInterval(()=>o(Date.now()),1e3);return()=>window.clearInterval(c)},[e.length]),l.useMemo(()=>Bc(e,t,n,a,i),[n,i,e,t,a])}function Ea({runs:e,tasks:t,generatedAt:n,timeAccountingMode:a,pending:i,onOpenStartWork:o,onPause:c,onFocus:d}){const{expanded:p,setExpanded:g}=l.useContext(Ks),u=zi(e,t,n,a),h=u.find(b=>b.run.isCurrent)??u[0]??null,j=h?u.filter(b=>b.run.id!==h.run.id):[];return h?s.jsxs("div",{className:x("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",p&&"border-[var(--primary)]/25 bg-[var(--primary)]/[0.06]"),children:[s.jsxs("button",{type:"button","aria-expanded":p,"aria-label":p?"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:()=>g(b=>!b),children:[s.jsx(xt,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),s.jsx("span",{className:"truncate text-[12px] font-medium text-[var(--ui-ink-strong)]",children:h.title}),s.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-[var(--ui-ink-faint)]",children:Ue(h.creditedSeconds)})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 pr-1",children:[j.length>0?s.jsx("button",{type:"button",title:"Switch to next task",disabled:i,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 d(j[0].run.id),children:u.length}):null,s.jsx("button",{type:"button",title:"Stop",disabled:i,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 c(h.run.id),children:s.jsx(Ir,{className:"size-2.5 fill-current"})}),s.jsx("button",{type:"button",title:"Start new work",disabled:i,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:s.jsx(Xa,{className:"size-2.5 fill-current"})})]})]}):s.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:[s.jsx(xt,{className:"size-3.5 shrink-0 text-[var(--ui-ink-faint)]"}),s.jsx("span",{className:"truncate text-[12px] text-[var(--ui-ink-faint)]",children:"No active work"}),s.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 Aa({runs:e,tasks:t,generatedAt:n,timeAccountingMode:a,pending:i,onOpenStartWork:o,onFocus:c,onPause:d,onComplete:p}){var v,C,m,y;const{expanded:g}=l.useContext(Ks),u=zi(e,t,n,a),h=u.find(O=>O.run.isCurrent)??u[0]??null,j=h?u.filter(O=>O.run.id!==h.run.id):[],b=a==="split"&&u.length>1?`Split across ${u.length} active tasks`:a==="parallel"&&u.length>1?`Parallel time across ${u.length} active tasks`:a==="primary_only"&&u.length>1?"Only the current task is earning credited time":null;return h?s.jsx(ri,{initial:!1,children:g?s.jsx(Be.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:s.jsxs("div",{className:"mt-2 rounded-2xl border border-[var(--ui-border-subtle)] bg-[var(--ui-accent-soft)] p-4",children:[s.jsxs("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(D,{tone:"signal",children:"Current task"}),s.jsx(D,{tone:"meta",children:h.run.timerMode==="planned"?"Planned timer":"Unlimited timer"}),b?s.jsx(D,{tone:"meta",children:b}):null]}),s.jsx("div",{className:"mt-3 text-xl font-medium text-[var(--ui-ink-strong)] md:text-2xl",children:h.title}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-4 text-sm text-[var(--ui-ink-soft)]",children:[s.jsxs("span",{children:[Ue(h.creditedSeconds)," credited"]}),s.jsxs("span",{children:[Ue(h.wallSeconds)," wall time"]}),h.run.timerMode==="planned"?h.overtimeSeconds>0?s.jsxs("span",{className:"text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]",children:["+",Ue(h.overtimeSeconds)," overtime"]}):s.jsxs("span",{children:[Ue(h.remainingSeconds??0)," ","remaining"]}):s.jsx("span",{children:"Unlimited session"})]}),(v=h.run.gitContext)!=null&&v.branch||(C=h.run.gitContext)!=null&&C.pullRequestNumber?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[(m=h.run.gitContext)!=null&&m.branch?s.jsxs(D,{tone:"meta",children:[s.jsx(Ss,{className:"mr-1 size-3"}),h.run.gitContext.branch]}):null,(y=h.run.gitContext)!=null&&y.pullRequestNumber?s.jsxs(D,{tone:"meta",children:[s.jsx(Or,{className:"mr-1 size-3"}),"PR #",h.run.gitContext.pullRequestNumber]}):null]}):null]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(B,{variant:"secondary",pending:i,pendingLabel:"Opening",onClick:o,children:[s.jsx(xt,{className:"size-4"}),"Start work"]}),s.jsxs(B,{variant:"secondary",pending:i,pendingLabel:"Pausing",onClick:()=>void d(h.run.id),children:[s.jsx(Er,{className:"size-4"}),"Pause"]}),s.jsxs(B,{pending:i,pendingLabel:"Completing",onClick:()=>void p(h.run.id),children:[s.jsx(Ar,{className:"size-4"}),"Complete"]})]})]}),j.length>0?s.jsx("div",{className:"mt-4 grid gap-2 lg:grid-cols-2",children:j.map(O=>s.jsxs("button",{type:"button",className:x("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)]",i&&"pointer-events-none opacity-70"),onClick:()=>void c(O.run.id),children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:O.title}),s.jsxs("div",{className:"mt-1 flex flex-wrap gap-3 text-[12px] text-[var(--ui-ink-faint)]",children:[s.jsxs("span",{children:[Ue(O.creditedSeconds)," credited"]}),s.jsx("span",{children:O.run.timerMode==="planned"?"planned":"unlimited"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-[var(--ui-ink-faint)]",children:[s.jsx(Ts,{className:"size-3.5"}),"Switch"]})]},O.run.id))}):null]})},"timer-rail-detail"):null}):null}function Fi(e,t){if(e.length!==t.length)return!1;const n=[...e].sort().join("|"),a=[...t].sort().join("|");return n===a}function Vc(e){const t=e.split(/\s+/).map(n=>n.trim()).filter(Boolean);return t.length===0?"??":t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]??""}${t[1][0]??""}`.toUpperCase()}function Wi(e){const t=e.filter(a=>a.kind==="human"),n=e.filter(a=>a.kind==="bot");return[{id:"all",label:"All",shortLabel:"All",description:"Show every human and bot together.",userIds:[],token:"ALL",icon:si},{id:"humans",label:"Humans",shortLabel:"Humans",description:"Focus only on human-owned work.",userIds:t.map(a=>a.id),token:"HU",icon:da},{id:"bots",label:"Bots",shortLabel:"Bots",description:"Focus only on bot-owned work.",userIds:n.map(a=>a.id),token:"AI",icon:ds},...e.map(a=>({id:a.id,label:a.displayName,shortLabel:a.displayName,description:`${a.kind==="human"?"Human":"Bot"} · ${a.handle}`,userIds:[a.id],token:Vc(a.displayName),icon:a.kind==="human"?da:ds}))]}function Jc(e,t){return Wi(e).find(n=>Fi(t,n.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:si}}function La({users:e,selectedUserIds:t,onChange:n,compact:a=!1}){const[i,o]=l.useState(!1),c=l.useMemo(()=>Wi(e),[e]),d=l.useMemo(()=>Jc(e,t),[t,e]),p=d.icon;return s.jsxs(Ze,{open:i,onOpenChange:o,children:[s.jsx(no,{asChild:!0,children:s.jsxs("button",{type:"button",className:x("shell-scope-trigger inline-flex items-center gap-2",a?"px-2.5 text-[12px]":"px-3.5 text-[13px]"),children:[s.jsx("span",{className:"shell-scope-avatar",children:d.id==="all"?s.jsx(p,{className:"size-3.5"}):d.token}),s.jsx("span",{className:x("truncate text-left",a?"max-w-[7.5rem]":"max-w-[11rem]"),children:d.shortLabel})]})}),s.jsxs(et,{children:[s.jsx(tt,{className:Ti}),s.jsxs(st,{className:x(Ri,"top-[12vh] w-[min(40rem,calc(100vw-1.5rem))]"),children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx(nt,{className:_i,children:"Choose user scope"}),s.jsx(at,{className:Ci,children:"Change which humans and bots shape the current Forge view."})]}),s.jsx(qt,{asChild:!0,children:s.jsx(Vt,{"aria-label":"Close user scope dialog"})})]}),s.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:c.map(g=>{const u=Fi(t,g.userIds),h=g.icon;return s.jsxs("button",{type:"button",className:x("flex items-center justify-between gap-3 rounded-[24px] border px-4 py-4 text-left transition",u?"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:()=>{n(g.userIds),o(!1)},children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("span",{className:"shell-scope-avatar",children:s.jsx(h,{className:"size-3.5"})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-[14px] font-semibold",children:g.label}),s.jsx("span",{className:"mt-1 block text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:g.description})]})]}),u?s.jsx(Lr,{className:"size-4 shrink-0 text-[var(--primary)]"}):null]},g.id)})})]})]})]})}async function E(e){try{return{data:await e()}}catch(t){return{error:t}}}const $e=qr({reducerPath:"forgeApi",baseQuery:Kr(),tagTypes:["OperatorSession","Settings","Snapshot","Gamification","Doctor","Sleep","Psyche","WikiIngestJobs","WorkbenchFlow","WorkbenchFlows"],endpoints:e=>({getOperatorSession:e.query({queryFn:()=>E(Vo),providesTags:["OperatorSession"]}),getSettings:e.query({queryFn:()=>E(yi),providesTags:["Settings"]}),getForgeDoctor:e.query({queryFn:()=>E(nl),providesTags:["Doctor"]}),applyForgeDoctorFixes:e.mutation({queryFn:t=>E(()=>al(t)),invalidatesTags:["Doctor","Settings"]}),listWorkbenchFlows:e.query({queryFn:()=>E(()=>il()),providesTags:["WorkbenchFlows"]}),getWorkbenchFlow:e.query({queryFn:t=>E(()=>rl(t)),providesTags:(t,n,a)=>[{type:"WorkbenchFlow",id:a},"WorkbenchFlows"]}),getWorkbenchFlowRun:e.query({queryFn:({flowId:t,runId:n})=>E(()=>ul(t,n)),providesTags:(t,n,{flowId:a})=>[{type:"WorkbenchFlow",id:a}]}),getWorkbenchFlowRunNodes:e.query({queryFn:({flowId:t,runId:n})=>E(()=>ml(t,n)),providesTags:(t,n,{flowId:a})=>[{type:"WorkbenchFlow",id:a}]}),getWorkbenchFlowRunNode:e.query({queryFn:({flowId:t,runId:n,nodeId:a})=>E(()=>pl(t,n,a)),providesTags:(t,n,{flowId:a})=>[{type:"WorkbenchFlow",id:a}]}),getWorkbenchFlowNodeOutput:e.query({queryFn:({flowId:t,nodeId:n})=>E(()=>hl(t,n)),providesTags:(t,n,{flowId:a})=>[{type:"WorkbenchFlow",id:a}]}),getSnapshot:e.query({queryFn:t=>E(()=>Xo(t)),providesTags:["Snapshot"]}),getXpMetrics:e.query({queryFn:t=>E(()=>vl(t)),providesTags:["Gamification"]}),markGamificationCelebrationSeen:e.mutation({queryFn:t=>E(()=>yl(t)),invalidatesTags:["Gamification"]}),revokeOperatorSession:e.mutation({queryFn:()=>E(Jo),invalidatesTags:["OperatorSession","Settings","Snapshot","Gamification"]}),listWikiIngestJobs:e.query({queryFn:()=>E(()=>sl()),providesTags:["WikiIngestJobs"]}),createTask:e.mutation({queryFn:t=>E(()=>Rl(t)),invalidatesTags:["Snapshot"]}),createGoal:e.mutation({queryFn:t=>E(()=>jl(t)),invalidatesTags:["Snapshot"]}),createProject:e.mutation({queryFn:t=>E(()=>Nl(t)),invalidatesTags:["Snapshot"]}),patchGoal:e.mutation({queryFn:({goalId:t,patch:n})=>E(()=>Tl(t,n)),invalidatesTags:["Snapshot"]}),patchProject:e.mutation({queryFn:({projectId:t,patch:n})=>E(()=>Pl(t,n)),invalidatesTags:["Snapshot"]}),patchTask:e.mutation({queryFn:({taskId:t,patch:n})=>E(()=>va(t,n)),invalidatesTags:["Snapshot"]}),patchTaskStatus:e.mutation({queryFn:({taskId:t,status:n,completedAt:a,enforceTodayWorkLog:i,completedTodayWorkSeconds:o})=>E(()=>va(t,{status:n,completedAt:a,enforceTodayWorkLog:i,completedTodayWorkSeconds:o})),invalidatesTags:["Snapshot"]}),claimTaskRun:e.mutation({queryFn:({taskId:t,input:n})=>E(()=>Cl(t,n)),invalidatesTags:["Snapshot"]}),heartbeatTaskRun:e.mutation({queryFn:({runId:t,input:n})=>E(()=>Il(t,n)),invalidatesTags:["Snapshot"]}),focusTaskRun:e.mutation({queryFn:t=>E(()=>Ol(t)),invalidatesTags:["Snapshot"]}),releaseTaskRun:e.mutation({queryFn:({runId:t,input:n})=>E(()=>Al(t,n)),invalidatesTags:["Snapshot"]}),completeTaskRun:e.mutation({queryFn:({runId:t,input:n})=>E(()=>El(t,n)),invalidatesTags:["Snapshot"]}),getSleepView:e.query({queryFn:t=>E(()=>gl(t)),providesTags:["Sleep"]}),getPsycheValues:e.query({queryFn:t=>E(()=>Qo(t)),providesTags:["Psyche"]}),getBehaviorPatterns:e.query({queryFn:t=>E(()=>Yo(t)),providesTags:["Psyche"]}),getBehaviors:e.query({queryFn:t=>E(()=>Zo(t)),providesTags:["Psyche"]}),getBeliefs:e.query({queryFn:t=>E(()=>el(t)),providesTags:["Psyche"]}),getTriggerReports:e.query({queryFn:t=>E(()=>tl(t)),providesTags:["Psyche"]}),patchSleepSession:e.mutation({queryFn:({sleepId:t,patch:n})=>E(()=>fl(t,n)),invalidatesTags:["Sleep"]}),updateWorkbenchFlow:e.mutation({queryFn:({flowId:t,patch:n})=>E(()=>ol(t,n)),invalidatesTags:(t,n,{flowId:a})=>[{type:"WorkbenchFlow",id:a},"WorkbenchFlows"]}),deleteWorkbenchFlow:e.mutation({queryFn:t=>E(()=>ll(t)),invalidatesTags:(t,n,a)=>[{type:"WorkbenchFlow",id:a},"WorkbenchFlows"]}),runWorkbenchFlow:e.mutation({queryFn:({flowId:t,input:n})=>E(()=>cl(t,n)),invalidatesTags:(t,n,{flowId:a})=>[{type:"WorkbenchFlow",id:a}]}),chatWorkbenchFlow:e.mutation({queryFn:({flowId:t,input:n})=>E(()=>dl(t,n)),invalidatesTags:(t,n,{flowId:a})=>[{type:"WorkbenchFlow",id:a}]})})}),{useClaimTaskRunMutation:Xc,useCompleteTaskRunMutation:Qc,useCreateGoalMutation:Yc,useCreateProjectMutation:Zc,useCreateTaskMutation:ed,useFocusTaskRunMutation:td,useGetForgeDoctorQuery:Sv,useGetOperatorSessionQuery:sd,useGetXpMetricsQuery:nd,useGetSettingsQuery:ad,useGetSnapshotQuery:id,useGetWorkbenchFlowQuery:jv,useGetWorkbenchFlowRunNodeQuery:Nv,useGetWorkbenchFlowRunNodesQuery:Pv,useListWikiIngestJobsQuery:rd,useHeartbeatTaskRunMutation:od,useChatWorkbenchFlowMutation:Tv,useDeleteWorkbenchFlowMutation:Rv,usePatchGoalMutation:ld,usePatchProjectMutation:cd,usePatchTaskMutation:dd,usePatchTaskStatusMutation:ud,useReleaseTaskRunMutation:md,useMarkGamificationCelebrationSeenMutation:pd,useApplyForgeDoctorFixesMutation:_v,useRevokeOperatorSessionMutation:Cv,useRunWorkbenchFlowMutation:Iv,useUpdateWorkbenchFlowMutation:Ov}=$e,Gi="forge.selected-user-ids";function hd(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Gi);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean):[]}catch{return[]}}function gd(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Gi,JSON.stringify(Array.from(new Set(e))))}catch{return}}const fd={collapseProgress:0,selectedUserIds:hd(),displayedRouteKey:"",pendingRouteKey:null,pendingRouteStatus:"idle",routeReadyToCommit:!1,knowledgeGraphOverlayFocus:null},Hi=ai({name:"shell",initialState:fd,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:vd,cancelPendingRoute:Ev,clearKnowledgeGraphOverlayFocus:Da,commitPendingRoute:yd,hydrateSelectedUserIds:bd,setKnowledgeGraphOverlayFocus:Av,setCollapseProgress:xd,setPendingRouteStatus:Lv,setRouteReadyToCommit:Dv,setSelectedUserIds:xs,syncDisplayedRouteKey:wd}=Hi.actions,kd=Hi.reducer,Ui=Br();Ui.startListening({matcher:Vr(bd,xs),effect:async e=>{Array.isArray(e.payload)&&gd(e.payload.filter(t=>typeof t=="string"))}});const Sd="knowledge_graph",jd=220,Nd=24,$a=.45,Pd=.8;function Se(e,t=4){const n=10**t;return Math.round(e*n)/n}function os(e){return Math.hypot(e.x,e.y)}function $v(){return!1}function Mv(e){let t=0,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(const c of e)t+=1,n=Math.min(n,c.x),a=Math.max(a,c.x),i=Math.min(i,c.y),o=Math.max(o,c.y);return t===0?{x:0,y:0}:{x:Se((n+a)/2),y:Se((i+o)/2)}}function Td(e){let t=0,n=0,a=0;for(const i of e)t+=1,n+=i.x,a+=i.y;return t===0?{x:0,y:0}:{x:Se(n/t),y:Se(a/t)}}function zv(e){const t=Td(e);return{changed:Math.abs(t.x)>=1e-4||Math.abs(t.y)>=1e-4,offset:t,positions:e.map(a=>({x:Se(a.x-t.x),y:Se(a.y-t.y)}))}}function Fv({centroid:e,boundsCenter:t,camera:n}){return{centroidDistanceFromOrigin:Se(os(e)),boundsCenterDistanceFromOrigin:Se(os(t)),cameraDistanceFromOrigin:Se(os({x:n.x,y:n.y})),cameraToCentroidDistance:Se(Math.hypot(n.x-e.x,n.y-e.y))}}function Wv(e){return e.centroidDistanceFromOrigin<=$a&&e.cameraDistanceFromOrigin<=$a&&e.cameraToCentroidDistance<=Pd}function Gv(e="/knowledge-graph"){const t=pi({scope:Sd,route:e,source:"ui"});return async({level:n,eventKey:a,message:i,functionName:o,details:c,entityType:d,entityId:p})=>t({level:n,eventKey:a,message:i,functionName:o??null,details:c,entityType:d??null,entityId:p??null})}const Rd={panelOpen:!1,latestStatus:null,recentEvents:[],recentSnapshots:[]};function Ma(e,t,n){const a=[t,...e];return a.length<=n?a:a.slice(0,n)}const qi=ai({name:"knowledgeGraphDiagnostics",initialState:Rd,reducers:{setKnowledgeGraphDiagnosticsPanelOpen(e,t){e.panelOpen=t.payload},setKnowledgeGraphDiagnosticsStatus(e,t){e.latestStatus=t.payload},recordKnowledgeGraphDiagnosticsEvent(e,t){e.recentEvents=Ma(e.recentEvents,t.payload,jd)},recordKnowledgeGraphDiagnosticsSnapshot(e,t){e.recentSnapshots=Ma(e.recentSnapshots,t.payload,Nd)},resetKnowledgeGraphDiagnostics(e){e.latestStatus=null,e.recentEvents=[],e.recentSnapshots=[],e.panelOpen=!1}}}),{recordKnowledgeGraphDiagnosticsEvent:Hv,recordKnowledgeGraphDiagnosticsSnapshot:Uv,resetKnowledgeGraphDiagnostics:qv,setKnowledgeGraphDiagnosticsPanelOpen:Kv,setKnowledgeGraphDiagnosticsStatus:Bv}=qi.actions,_d=qi.reducer,Cd=Dr({shell:kd,knowledgeGraphDiagnostics:_d,[$e.reducerPath]:$e.reducer});function Id(){const e=Jr({reducer:Cd,middleware:t=>t({serializableCheck:!1}).concat(Ui.middleware,$e.middleware)});return Xr(e.dispatch),e}const Bs=Id();function Od(){const e=Ut();l.useEffect(()=>{const t=new EventSource(Es("/api/v1/events/stream")),n=()=>{Bs.dispatch($e.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",n),t.addEventListener("activity",n),t.onerror=()=>{t.close()},()=>{t.removeEventListener("snapshot",n),t.removeEventListener("activity",n),t.close()}},[e])}const Ed=[{id:"sleep",matches:e=>e==="/sleep"||e.startsWith("/sleep/"),isReady:e=>e.bootstrapReady&&e.sleepReady}];function Ad(e){return Ed.find(t=>t.matches(e))??null}function Ld(e,t){if(!t.bootstrapReady)return!1;const n=Ad(e);return n?n.isReady(t):!0}const Vs=e=>e.shell,Dd=Ht(Vs,e=>e.selectedUserIds),$d=Ht(Vs,e=>e.collapseProgress);Ht(Vs,e=>({displayedRouteKey:e.displayedRouteKey,pendingRouteKey:e.pendingRouteKey,pendingRouteStatus:e.pendingRouteStatus,routeReadyToCommit:e.routeReadyToCommit}));const Ki=Ht(e=>e[$e.reducerPath],e=>{const t=Object.values(e.queries).filter(a=>(a==null?void 0:a.status)==="pending").length,n=Object.values(e.mutations).filter(a=>(a==null?void 0:a.status)==="pending").length;return t+n});function Md({backgroundActivityOpen:e,fetchingCount:t,mutatingCount:n,t:a}){var g;const i=rd(void 0,{pollingInterval:e?2e3:15e3,refetchOnFocus:!0,refetchOnReconnect:!0}),o=((g=i.data)==null?void 0:g.jobs)??[],c=o.some(u=>["queued","processing"].includes(u.job.status)),d=l.useMemo(()=>o.filter(u=>["queued","processing"].includes(u.job.status)),[o]);return{activityLabel:l.useMemo(()=>{if(d.length>0){if(d.length===1){const u=d[0];return(u==null?void 0:u.job.latestMessage)||(u==null?void 0:u.job.titleHint)||"1 ingest running"}return`${d.length} ingest jobs running`}return n>0?a(n===1?"common.shell.savingOne":"common.shell.savingOther",{count:n}):t>0?a(t===1?"common.shell.refreshingOne":"common.shell.refreshingOther",{count:t}):a("common.shell.settled")},[d,t,n,a]),hasActiveIngestJobs:c,ingestJobsQuery:i,recentIngestJobs:o}}function zd(e,t,n){return Math.min(Math.max(e,t),n)}function K(e,t,n){return t+(n-t)*e}function Fd(e,t){e&&(e.style.setProperty("--forge-shell-collapse",t.toFixed(4)),e.style.setProperty("--forge-shell-desktop-header-padding-top",`${K(t,18,4)}px`),e.style.setProperty("--forge-shell-desktop-header-padding-bottom",`${K(t,15,4)}px`),e.style.setProperty("--forge-shell-desktop-title-size",`${K(t,1.42,.96)}rem`),e.style.setProperty("--forge-shell-desktop-primary-translate-y",`${K(t,0,2)}px`),e.style.setProperty("--forge-shell-desktop-primary-scale",`${K(t,1,.98)}`),e.style.setProperty("--forge-shell-desktop-secondary-opacity",`${K(t,1,0)}`),e.style.setProperty("--forge-shell-desktop-secondary-max-height",`${K(t,176,0)}px`),e.style.setProperty("--forge-shell-desktop-secondary-spacing",`${K(t,14,0)}px`),e.style.setProperty("--forge-shell-desktop-secondary-translate-y",`${K(t,0,-18)}px`),e.style.setProperty("--forge-shell-mobile-header-padding-top",`${K(t,14,4)}px`),e.style.setProperty("--forge-shell-mobile-header-padding-bottom",`${K(t,12,4)}px`),e.style.setProperty("--forge-shell-mobile-title-size",`${K(t,1.2,.9)}rem`),e.style.setProperty("--forge-shell-mobile-primary-translate-y",`${K(t,0,1)}px`),e.style.setProperty("--forge-shell-mobile-primary-scale",`${K(t,1,.98)}`),e.style.setProperty("--forge-shell-mobile-copy-opacity",`${K(t,1,0)}`),e.style.setProperty("--forge-shell-mobile-copy-max-height",`${K(t,320,0)}px`),e.style.setProperty("--forge-shell-mobile-copy-translate-y",`${K(t,0,-14)}px`),e.style.setProperty("--forge-shell-hero-padding-top",`${K(t,20,15)}px`),e.style.setProperty("--forge-shell-hero-padding-bottom",`${K(t,20,14)}px`),e.style.setProperty("--forge-shell-hero-title-translate-y",`${K(t,0,-6)}px`),e.style.setProperty("--forge-shell-hero-title-scale",`${K(t,1,.94)}`),e.style.setProperty("--forge-shell-hero-description-opacity",`${K(t,1,.45)}`),e.style.setProperty("--forge-shell-hero-description-translate-y",`${K(t,0,-5)}px`))}function Wd(){var e,t,n;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,((n=document.body)==null?void 0:n.scrollTop)||0)}const Js=()=>Qr(),yt=Yr;function Gd(e){const t=Js(),n=yt($d),a=l.useRef(n);l.useEffect(()=>{a.current=n},[n]),l.useEffect(()=>{const i=()=>{const o=window.innerWidth>=1024?124:96,c=document.scrollingElement??document.documentElement??document.body,p=Math.max(0,c.scrollHeight-window.innerHeight)<o?0:zd(Wd()/o,0,1);Math.abs(a.current-p)<.001||t(xd(p))};return i(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[t]),l.useEffect(()=>{Fd(e.current,n)},[n,e])}function Hd({routePathKey:e,routerLocation:t,outlet:n,routerLocationContext:a,optimisticLocation:i,optimisticRoutePathKey:o,destinationLoadingNode:c}){const d=Js(),p=l.useRef(e),[g,u]=l.useState(e),h=o??e,j=i??t,b=o!==null||g!==e;l.useEffect(()=>{if(o!==null||g===e)return;const m=window.setTimeout(()=>{u(e)},120);return()=>{window.clearTimeout(m)}},[o,g,e]);const v={key:h,node:b?c:n,location:j};l.useEffect(()=>{p.current!==e&&(d(vd(e)),d(yd()),p.current=e),d(wd(e))},[d,e]);const C=a?{...a,location:v.location}:null;return{displayedRoute:v,displayedLocationContext:C,pendingRoute:null,visibleLocation:j}}function Ud(e){const t=l.useRef(`forge_session_${Math.random().toString(36).slice(2,10)}`);l.useEffect(()=>{if(!e)return;let n=!1,a=!1,i=!1;const o=()=>{n=!0},c=(g,u)=>_l({sessionId:t.current,eventType:g,metrics:u}).catch(()=>{});c("session_started",{visible:document.visibilityState==="visible",interacted:!1});const d=window.setTimeout(()=>{document.visibilityState==="visible"&&n&&!a&&(a=!0,c("dwell_120_seconds",{visible:!0,interacted:!0}))},12e4),p=()=>{const g=Math.max(1,document.documentElement.scrollHeight-window.innerHeight),u=Math.round(window.scrollY/g*100);u>=75&&n&&!i&&(i=!0,c("scroll_depth_75",{visible:document.visibilityState==="visible",interacted:!0,scrollDepth:u}))};return window.addEventListener("pointerdown",o),window.addEventListener("keydown",o),window.addEventListener("scroll",p,{passive:!0}),()=>{window.clearTimeout(d),window.removeEventListener("pointerdown",o),window.removeEventListener("keydown",o),window.removeEventListener("scroll",p)}},[e])}function qd({snapshot:e,settings:t}){const[n]=od();l.useEffect(()=>{if(!e||!t||e.activeTaskRuns.length===0)return;const a=()=>{for(const p of e.activeTaskRuns)n({runId:p.id,input:{actor:p.actor,leaseTtlSeconds:p.leaseTtlSeconds,note:p.note}}).unwrap().catch(()=>{})},i=window.setInterval(()=>{a()},3e4),o=()=>{a()},c=()=>{a()},d=()=>{a()};return document.addEventListener("visibilitychange",o),window.addEventListener("focus",c),window.addEventListener("pagehide",d),()=>{window.clearInterval(i),document.removeEventListener("visibilitychange",o),window.removeEventListener("focus",c),window.removeEventListener("pagehide",d)}},[n,t,e])}const Kd=["obsidian","solar","aurora","ember","paper","dawn","atelier","custom","system"],Vv=go(Kd),Ie=oi().trim().regex(/^#[0-9a-fA-F]{6}$/,"Use a 6-digit hex color"),Jv=fo({label:oi().trim().min(1,"Theme name is required").max(40),primary:Ie,secondary:Ie,tertiary:Ie,canvas:Ie,panel:Ie,panelHigh:Ie,panelLow:Ie,ink:Ie}),Bd=["--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"],Bi={label:"Custom Forge",primary:"#7cc7ff",secondary:"#4edea3",tertiary:"#ffb95f",canvas:"#0b1326",panel:"#171f33",panelHigh:"#222a3d",panelLow:"#131b2e",ink:"#eef2ff"},Z={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"}}},Xv=[{value:"obsidian",label:Z.obsidian.label,description:Z.obsidian.description},{value:"solar",label:Z.solar.label,description:Z.solar.description},{value:"aurora",label:Z.aurora.label,description:Z.aurora.description},{value:"ember",label:Z.ember.label,description:Z.ember.description},{value:"paper",label:Z.paper.label,description:Z.paper.description},{value:"dawn",label:Z.dawn.label,description:Z.dawn.description},{value:"atelier",label:Z.atelier.label,description:Z.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 ws(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 Vd({r:e,g:t,b:n}){return`#${[e,t,n].map(a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0")).join("")}`}function Le(e,t,n){const a=ws(e),i=ws(t);return Vd({r:a.r+(i.r-a.r)*n,g:a.g+(i.g-a.g)*n,b:a.b+(i.b-a.b)*n})}function ce(e,t){const{r:n,g:a,b:i}=ws(e);return`rgba(${n}, ${a}, ${i}, ${t})`}function Jd(e,t){return e==="system"?t?"obsidian":"paper":e}function Qv(e,t){return e==="custom"?t??Bi:e==="system"?Z.obsidian.preview:Z[e].preview}function Xd(e){const t=Le(e.panelHigh,e.primary,.08),n=Le(e.panelHigh,e.primary,.16),a=Le(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":ce(e.canvas,.82),"--surface-psyche":ce(Le(e.canvas,e.secondary,.12),.94),"--surface-psyche-high":ce(Le(e.panelHigh,e.secondary,.1),.96),"--hero-gradient":`linear-gradient(180deg, ${ce(n,.95)}, ${ce(a,.95)})`,"--card-gradient":`linear-gradient(180deg, ${ce(t,.96)}, ${ce(e.panelLow,.94)})`,"--card-shadow":`0 24px 60px ${ce(e.canvas,.3)}`,"--card-shadow-hover":`0 32px 80px ${ce(e.canvas,.38)}`,"--ui-accent":e.primary,"--ui-ink":e.ink,"--ui-ink-muted":ce(e.ink,.58),"--forge-body-ambient-primary":ce(e.primary,.2),"--forge-body-ambient-secondary":ce(e.secondary,.14),"--forge-body-gradient-start":Le(e.panel,e.primary,.08),"--forge-body-gradient-end":Le(e.canvas,"#000000",.16),"--forge-body-text":e.ink}}function Qd(e,t){if(typeof document>"u")return;const n=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,a=Jd(e,n),i=document.body,o=document.documentElement;if(i.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"),a==="custom"){const c=t??Bi,d=Xd(c);i.classList.add("theme-forge-custom"),i.classList.add("theme-forge-dark");for(const[p,g]of Object.entries(d))o.style.setProperty(p,g);o.dataset.forgeTheme=c.label;return}for(const c of Bd)o.style.removeProperty(c);delete o.dataset.forgeTheme,i.classList.add(Z[a].mode==="light"?"theme-forge-light":"theme-forge-dark"),i.classList.add(`theme-forge-${a}`)}function Yd(e){l.useEffect(()=>{if(!e)return;const t=()=>{Qd(e.themePreference,e.customTheme??null)};if(t(),e.themePreference!=="system"||typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>t();return typeof n.addEventListener=="function"?(n.addEventListener("change",a),()=>n.removeEventListener("change",a)):(n.addListener(a),()=>n.removeListener(a))},[e])}async function Zd(e,t=[]){Bs.dispatch($e.util.invalidateTags(["Snapshot","Gamification"])),await Promise.all([e.invalidateQueries({queryKey:["forge-snapshot"]}),...t.map(n=>e.invalidateQueries({queryKey:n}))])}function de({className:e}){return s.jsx("div",{className:x("surface-pulse rounded-2xl bg-[var(--ui-surface-2)]",e)})}function eu({header:e=!0,sideRail:t=!0,className:n,eyebrow:a,title:i,description:o,columns:c=2,blocks:d=4}){const p=Array.from({length:Math.max(2,d)});return s.jsxs("div",{className:x("grid gap-5",n),"aria-hidden":"true",children:[e?s.jsxs(Te,{className:"grid gap-4",children:[s.jsx(de,{className:x("h-3",a?"w-40":"w-32")}),s.jsx(de,{className:x("h-12",i?"max-w-2xl":"max-w-3xl")}),s.jsx(de,{className:x("h-5",o?"max-w-3xl":"max-w-2xl")})]}):null,s.jsxs("section",{className:x("grid gap-5",t?"xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]":""),children:[s.jsxs("div",{className:"grid gap-5",children:[s.jsxs(Te,{className:"grid gap-4",children:[s.jsx(de,{className:"h-3 w-28"}),s.jsx(de,{className:"h-28 w-full"})]}),s.jsxs(Te,{className:"grid gap-4",children:[s.jsx(de,{className:"h-3 w-40"}),s.jsx("div",{className:x("grid gap-3",c>1?"md:grid-cols-2":""),children:p.map((g,u)=>s.jsx(de,{className:"h-28 w-full"},u))})]})]}),t?s.jsxs("div",{className:"grid gap-5",children:[s.jsxs(Te,{className:"grid gap-4",children:[s.jsx(de,{className:"h-3 w-24"}),s.jsx(de,{className:"h-20 w-full"})]}),s.jsxs(Te,{className:"grid gap-4",children:[s.jsx(de,{className:"h-3 w-36"}),s.jsx(de,{className:"h-16 w-full"}),s.jsx(de,{className:"h-16 w-full"})]})]}):null]})]})}function tu({children:e}){return s.jsx(s.Fragment,{children:e})}const su={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 nu({index:e}){return s.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:[s.jsx("div",{className:"h-2.5 w-24 rounded-full bg-[var(--ui-surface-3)]"}),s.jsx("div",{className:"mt-4 h-9 w-full rounded-2xl bg-[var(--ui-surface-2)]"}),s.jsxs("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[s.jsx("div",{className:"h-3 rounded-full bg-[var(--ui-surface-2)]"}),s.jsx("div",{className:"h-3 rounded-full bg-[var(--ui-surface-1)]"}),s.jsx("div",{className:"h-3 rounded-full bg-[var(--ui-surface-1)]"})]})]})}function Vi({meta:e}){const t=e.skeleton??{},n=Math.max(2,t.blocks??4),a=Array.from({length:Math.min(n,6)});return s.jsxs(Be.section,{className:x("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",su[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:[s.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-px bg-[linear-gradient(90deg,transparent,var(--ui-border-strong),transparent)]"}),s.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"}),s.jsxs("header",{className:"relative flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Opening surface"}),s.jsx("h1",{className:"mt-2 font-display text-2xl font-semibold tracking-normal text-[var(--ui-ink-strong)] sm:text-3xl",children:e.title}),s.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:e.description})]}),s.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:[s.jsxs("span",{className:"relative flex size-2.5",children:[s.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-[var(--primary)]/30"}),s.jsx("span",{className:"relative inline-flex size-2.5 rounded-full bg-[var(--primary)]"})]}),"Loading"]})]}),s.jsx("div",{className:x("relative grid gap-3",(t.columns??2)>1?"md:grid-cols-2 xl:grid-cols-3":""),"aria-hidden":"true",children:a.map((i,o)=>s.jsx(nu,{index:o},o))}),s.jsx(eu,{header:t.header??!1,sideRail:t.sideRail??!0,columns:t.columns??2,blocks:n,className:"relative opacity-80"})]},e.surfaceId)}function au({viewId:e,children:t}){const n=U[e];return s.jsx(l.Suspense,{fallback:s.jsx(Vi,{meta:n}),children:s.jsx(tu,{surfaceId:n.surfaceId,children:t})})}const iu=l.lazy(()=>N(()=>import("./action-bar-CsDQF9d4.js"),__vite__mapDeps([16,1,2,4,11,17,18,10,5,12,9])).then(e=>({default:e.ActionBar}))),Ji=l.createContext(null);let Xi=null;function ru({onClick:e}){const{t}=ye();return s.jsxs(B,{variant:"secondary",size:"sm",className:"min-w-0 px-3.5",onClick:e,children:[s.jsx(Ps,{className:"size-4"}),t("common.shell.command"),s.jsx(D,{size:"sm",tone:"meta",className:"ml-1 hidden bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] xl:inline-flex",children:"Shift Shift"}),s.jsx(D,{size:"sm",tone:"meta",className:"hidden bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] 2xl:inline-flex",children:"Cmd K"})]})}function ou({children:e,routeLocation:t,onRouteIntent:n,settings:a,timerPending:i,startWorkOpen:o,startWorkPending:c,startWorkError:d,startWorkDefaults:p,onOpenStartWork:g,onCloseStartWork:u,onStartExistingTask:h,onCreateAndStartTask:j,onFocusRun:b,onPauseRun:v,onCompleteRun:C}){const m=cu(),{t:y}=ye(),O=De.find(W=>Ft(t.pathname,W))??Jt[0],T=Hc(O.id),$=fc(t.pathname),[V,M]=l.useState(!1),[A,G]=l.useState(!1),ee=l.useRef(null),{navCollapsed:z,setNavCollapsed:te,desktopNavIds:be,setDesktopNavIds:X,mobileNavIds:F,setMobileNavIds:J,desktopRoutes:se,mobileRoutes:xe,navEditorOpen:ie,setNavEditorOpen:re,desktopSidebarMetricsPosition:ue,setDesktopSidebarMetricsPosition:we}=Tc(t.pathname),me=zt(t.pathname),k=t.pathname.startsWith("/knowledge-graph"),L=ii(),q=Zr(),oe=yt(Ki),pe=L+q+oe,{activityLabel:ke,hasActiveIngestJobs:he,ingestJobsQuery:le,recentIngestJobs:je}=Md({backgroundActivityOpen:A,fetchingCount:L+oe,mutatingCount:q,t:y}),ge=Uc(m.snapshot,y),_e=ic({goals:m.snapshot.dashboard.goals,projects:m.snapshot.dashboard.projects,tags:m.snapshot.tags,users:m.snapshot.users,defaultUserId:m.selectedUserIds.length===1?m.selectedUserIds[0]:null,onCreateGoal:m.createGoal,onCreateProject:m.createProject,onCreateTask:m.createTask}),Me=l.useMemo(()=>t.pathname.startsWith("/tasks/")?[{to:"/kanban",label:y("common.shell.rail.taskBackToKanban")},{to:"/today",label:y("common.shell.rail.taskOpenToday")}]:t.pathname.startsWith("/projects/")?[{to:"/projects",label:y("common.shell.rail.projectAll")},{to:"/goals",label:y("common.shell.rail.projectGoals")}]:t.pathname.startsWith("/goals/")?[{to:"/goals",label:y("common.shell.rail.goalAll")},{to:"/projects",label:y("common.shell.rail.goalProjects")}]:t.pathname.startsWith("/strategies")?[{to:"/strategies",label:y("common.routeLabels.strategies")},{to:"/projects",label:y("common.shell.rail.projectAll")}]:zt(t.pathname)?[{to:"/psyche",label:y("common.shell.rail.psycheHub")},{to:"/psyche/reports",label:y("common.shell.rail.psycheReports")}]:[{to:"/overview",label:y("common.shell.rail.overview")},{to:"/today",label:y("common.shell.rail.today")}],[t.pathname,y]);l.useEffect(()=>{let W=0;const Oe=Q=>{if((Q.metaKey||Q.ctrlKey)&&Q.key.toLowerCase()==="k"){Q.preventDefault(),M(Ne=>!Ne),W=0;return}if(Q.key==="Shift"&&!Q.metaKey&&!Q.ctrlKey&&!Q.altKey&&!Q.repeat){const Ne=window.performance.now();if(Ne-W<=360){Q.preventDefault(),M(!0),W=0;return}W=Ne;return}!Q.metaKey&&!Q.ctrlKey&&!Q.altKey&&(W=0)};return window.addEventListener("keydown",Oe),()=>window.removeEventListener("keydown",Oe)},[]),Gd(ee);const ze=l.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 s.jsxs("div",{ref:ee,className:"min-h-screen",style:ze,children:[s.jsx(l.Suspense,{fallback:null,children:V?s.jsx(iu,{open:V,onOpenChange:M,snapshot:m.snapshot,selectedUserIds:m.selectedUserIds,createActions:_e.actions}):null}),_e.dialogs,s.jsxs("div",{className:"hidden lg:grid lg:min-h-screen",style:{gridTemplateColumns:z?"5.75rem minmax(0,1fr)":"17.75rem minmax(0,1fr)"},children:[s.jsxs("aside",{className:x("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:[s.jsxs("div",{className:x("flex items-start",z?"flex-col items-center gap-3":"justify-between gap-3"),children:[s.jsxs(Ke,{to:"/overview",className:x("block min-w-0",z&&"text-center"),children:[s.jsx("div",{className:x("font-display text-[var(--primary)]",z?"text-2xl":"text-3xl"),children:y("common.shell.appMark")}),z?null:s.jsxs("div",{className:"type-meta mt-2 text-[var(--ui-ink-faint)]",children:["Level ",m.snapshot.metrics.level]})]}),s.jsx(B,{type:"button",variant:"secondary",size:"sm",className:"mt-0.5 px-2.5",onClick:()=>te(W=>!W),"aria-label":y(z?"common.shell.expandSidebar":"common.shell.collapseSidebar"),title:y(z?"common.shell.expandSidebar":"common.shell.collapseSidebar"),children:z?s.jsx(zr,{className:"size-4"}):s.jsx(Fr,{className:"size-4"})})]}),s.jsxs(B,{type:"button",variant:"secondary",size:"sm",className:x("mt-3",z?"px-2.5":"w-full justify-start px-3"),onClick:()=>re(!0),children:[s.jsx(Rs,{className:"size-4"}),z?null:"Customize nav"]}),ue==="above"?s.jsx(Ia,{metrics:ge,collapsed:z}):null,s.jsx("div",{className:x("grid gap-2",z?"mt-6":"mt-8"),children:se.map(W=>s.jsx(Rc,{route:W,compact:z,onRouteIntent:n},W.id))}),ue==="below"?s.jsx(Ia,{metrics:ge,collapsed:z}):null]}),s.jsxs("div",{className:"min-h-screen",children:[s.jsx(Oa,{children:s.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:[s.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:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-5",children:[s.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:[s.jsx("span",{children:Re(O,y)}),s.jsx(bs,{className:"font-sans",label:`Explain ${Re(O,y)}`,title:T.title,content:s.jsxs("span",{className:"grid gap-2",children:[s.jsx("span",{children:T.purpose}),s.jsx("span",{children:T.primaryAction}),T.metricNote?s.jsx("span",{className:"text-[var(--ui-ink-soft)]",children:T.metricNote}):null]})})]}),s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(Ea,{runs:m.snapshot.activeTaskRuns,tasks:m.snapshot.tasks,generatedAt:m.snapshot.meta.generatedAt,timeAccountingMode:a.execution.timeAccountingMode,pending:i,onOpenStartWork:()=>g(),onPause:v,onFocus:b})})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:[s.jsx(Dl,{metrics:m.snapshot.metrics,className:"hidden xl:inline-flex"}),s.jsx(ga,{active:pe>0||he,label:ke,onClick:()=>G(!0)}),s.jsx(ru,{onClick:()=>M(!0)}),s.jsxs(B,{variant:"secondary",size:"sm",className:"min-w-0 px-3.5",onClick:()=>void m.refresh(),children:[s.jsx(_s,{className:"size-4"}),y("common.actions.refresh")]})]})]}),s.jsx(Aa,{runs:m.snapshot.activeTaskRuns,tasks:m.snapshot.tasks,generatedAt:m.snapshot.meta.generatedAt,timeAccountingMode:a.execution.timeAccountingMode,pending:i,onOpenStartWork:()=>g(),onFocus:b,onPause:v,onComplete:C}),s.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:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("div",{className:"max-w-[34rem] text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:T.primaryAction}),Me.map(W=>s.jsx(Ke,{to:W.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:W.label},W.to)),s.jsx(La,{users:m.snapshot.users,selectedUserIds:m.selectedUserIds,onChange:m.setSelectedUserIds,compact:!0})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(D,{tone:"meta",children:y(m.snapshot.metrics.streakDays===1?"common.shell.momentum.streakBadgeOne":"common.shell.momentum.streakBadgeOther",{count:m.snapshot.metrics.streakDays})}),s.jsx(D,{tone:"meta",children:y("common.shell.momentum.weeklyXp",{count:m.snapshot.metrics.weeklyXp})}),s.jsx(D,{tone:me?"signal":"meta",children:me?y("common.shell.momentum.psycheMode"):y("common.shell.momentum.liveMomentum",{count:m.snapshot.metrics.momentumScore})})]})]})]})}),s.jsx("div",{className:"px-6 pt-3",children:s.jsx(ka,{open:o,onOpenChange:W=>{W||u()},presentation:"desktop_inline",tasks:m.snapshot.tasks,projects:m.snapshot.dashboard.projects,activeRunCount:m.snapshot.activeTaskRuns.length,maxActiveTasks:a.execution.maxActiveTasks,timeAccountingMode:a.execution.timeAccountingMode,pending:c,errorMessage:d,initialTaskId:p.taskId??null,defaultProjectId:p.projectId??null,onStartExisting:h,onCreateAndStart:j})}),s.jsx("main",{className:"px-6 pb-3",children:s.jsx("div",{className:"min-w-0",children:s.jsx(ya,{routeKey:$,tone:me?"psyche":"core",children:e})})})]})]}),s.jsxs("div",{className:"min-h-[100dvh] overflow-x-clip lg:hidden",children:[s.jsx(Oa,{children:s.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:[s.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:[s.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[s.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:Re(O,y)}),s.jsx(bs,{className:"shrink-0",label:`Explain ${Re(O,y)}`,title:T.title,content:s.jsxs("span",{className:"grid gap-2",children:[s.jsx("span",{children:T.purpose}),s.jsx("span",{children:T.primaryAction}),T.metricNote?s.jsx("span",{className:"text-[var(--ui-ink-soft)]",children:T.metricNote}):null]})})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s.jsx(B,{variant:"secondary",size:"sm",className:"min-h-[2.125rem] px-2.5",onClick:()=>M(!0),"aria-label":y("common.actionBar.title"),title:y("common.actionBar.title"),children:s.jsx(Ps,{className:"size-4"})}),s.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 ${m.snapshot.metrics.level} · ${m.snapshot.metrics.totalXp} XP · ${m.snapshot.metrics.streakDays} day streak`,children:[s.jsx(Wt,{className:"size-3.5 shrink-0"}),s.jsxs("span",{className:"min-w-0 truncate",children:["L",m.snapshot.metrics.level," ·"," ",gc(m.snapshot.metrics.totalXp)," XP · ",m.snapshot.metrics.streakDays,"d"]})]})]})]}),s.jsx("div",{className:"min-w-0",children:s.jsx(Ea,{runs:m.snapshot.activeTaskRuns,tasks:m.snapshot.tasks,generatedAt:m.snapshot.meta.generatedAt,timeAccountingMode:a.execution.timeAccountingMode,pending:i,onOpenStartWork:()=>g(),onPause:v,onFocus:b})})]}),s.jsx(Aa,{runs:m.snapshot.activeTaskRuns,tasks:m.snapshot.tasks,generatedAt:m.snapshot.meta.generatedAt,timeAccountingMode:a.execution.timeAccountingMode,pending:i,onOpenStartWork:()=>g(),onFocus:b,onPause:v,onComplete:C}),s.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:[s.jsxs("div",{className:"mt-2 text-[13px] leading-5 text-[var(--ui-ink-soft)]",children:[Us(O,y)," ",T.primaryAction]}),s.jsx("div",{className:"mt-2",children:s.jsx(ga,{active:pe>0||he,label:ke,onClick:()=>G(!0)})}),s.jsx("div",{className:"mt-3 overflow-x-auto pb-1",children:s.jsx(La,{users:m.snapshot.users,selectedUserIds:m.selectedUserIds,onChange:m.setSelectedUserIds,compact:!0})})]})]})}),s.jsx(ka,{open:o,onOpenChange:W=>{W||u()},presentation:"mobile_sheet",tasks:m.snapshot.tasks,projects:m.snapshot.dashboard.projects,activeRunCount:m.snapshot.activeTaskRuns.length,maxActiveTasks:a.execution.maxActiveTasks,timeAccountingMode:a.execution.timeAccountingMode,pending:c,errorMessage:d,initialTaskId:p.taskId??null,defaultProjectId:p.projectId??null,onStartExisting:h,onCreateAndStart:j}),s.jsx("main",{className:x("overflow-x-clip pb-2.5 lg:pb-24",k?"px-0":"px-4"),style:{paddingBottom:"calc(var(--forge-mobile-nav-clearance) + 2.5rem)",paddingLeft:k?"var(--forge-safe-area-left)":"max(1rem, calc(var(--forge-safe-area-left) + 1rem))",paddingRight:k?"var(--forge-safe-area-right)":"max(1rem, calc(var(--forge-safe-area-right) + 1rem))"},children:s.jsx(ya,{routeKey:$,tone:me?"psyche":"core",children:e})}),s.jsx(_c,{routes:xe,onOpenEditor:()=>re(!0),onRouteIntent:n}),s.jsx(Oc,{open:ie,onOpenChange:re,desktopNavIds:be,onDesktopNavIdsChange:X,desktopSidebarMetricsPosition:ue,onDesktopSidebarMetricsPositionChange:we,mobileNavIds:F,onMobileNavIdsChange:J})]}),s.jsx(Lc,{open:A,onOpenChange:G,isLoading:le.isLoading,isError:le.isError,error:le.error,onRetry:()=>void le.refetch(),recentIngestJobs:je}),s.jsx(rc,{className:"fixed z-40 lg:bottom-6 lg:right-6",actions:_e.actions})]})}function lu(){var dt,ut,mt,pt,ht;Od();const e=Js(),t=Ja(),n=l.useRef(null),a=l.useRef(null),i=Ut(),o=Qe(),c=l.useContext(ua),d=Mr();ii(),yt(Ki);const p=yt(Dd),g=yt(f=>f.shell.knowledgeGraphOverlayFocus),[u,h]=l.useState(!1),[j,b]=l.useState({}),[v,C]=l.useState(null),[m,y]=l.useState(null),[O,T]=l.useState(null),[$,V]=l.useState(!1),[M,A]=l.useState(null),[G,ee]=l.useState(()=>new Set),z=is(o),te=M?is(M):null,be=f=>{const w=vc(o,f);if(is(w)===z){A(null);return}A(w)},X=sd(),F=id(p,{skip:!X.isSuccess}),J=ad(void 0,{skip:!X.isSuccess}),se=X.isSuccess&&F.isSuccess&&J.isSuccess,xe=nd(p,{skip:!se||!$}),[ie,re]=pd(),ue=l.useMemo(()=>{var f;return(((f=xe.data)==null?void 0:f.metrics.celebrations)??[]).filter(w=>!G.has(w.id))},[G,(dt=xe.data)==null?void 0:dt.metrics.celebrations]);Ld(o.pathname,{bootstrapReady:se,sleepReady:!0});const we=xc((M==null?void 0:M.pathname)??o.pathname),me=l.useMemo(()=>s.jsx(Vi,{meta:U[we]},te??z),[we,te,z]),{displayedRoute:k,displayedLocationContext:L,visibleLocation:q}=Hd({routePathKey:z,routerLocation:o,outlet:d,routerLocationContext:c,optimisticLocation:M,optimisticRoutePathKey:te,destinationLoadingNode:me}),oe=f=>{e(xs(f))};l.useEffect(()=>{te!==null&&te===z&&A(null)},[te,z]),l.useEffect(()=>{if(V(!1),!se)return;const f=window.setTimeout(()=>{V(!0)},8e3);return()=>{window.clearTimeout(f)}},[p,se]);const pe=f=>{const w=Sa(o,f);f||e(Da()),t({pathname:"/knowledge-graph",search:w})},ke=f=>{t({pathname:"/knowledge-graph",search:Sa(o,f,{view:"hierarchy"})})};l.useEffect(()=>{X.isSuccess&&i.invalidateQueries({predicate:f=>{const[w]=f.queryKey;return w==="notes-index"||w==="project-board"||w==="task-context"||typeof w=="string"&&w.startsWith("forge-")}})},[X.isSuccess,i,p]),l.useEffect(()=>{var I;const f=(I=F.data)==null?void 0:I.users;if(!f||p.length===0)return;const w=mc(p,f);uc(w,p)||e(xs(w))},[e,p,(ut=F.data)==null?void 0:ut.users]),l.useEffect(()=>{o.pathname.startsWith("/knowledge-graph")||g&&e(Da())},[e,g,o.pathname]),Ud(X.isSuccess),qd({snapshot:F.data,settings:(mt=J.data)==null?void 0:mt.settings}),Yd((pt=J.data)==null?void 0:pt.settings),l.useEffect(()=>{a.current=null,T(null)},[X.isSuccess,p]),l.useEffect(()=>{var I;const f=(I=F.data)==null?void 0:I.metrics.totalXp;if(typeof f!="number")return;if(a.current===null){a.current=f;return}const w=f-a.current;a.current=f,w!==0&&(T({deltaXp:w,totalXp:f}),i.invalidateQueries({queryKey:["forge-xp-metrics"]}),n.current!==null&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>{T(null),n.current=null},2600))},[i,(ht=F.data)==null?void 0:ht.metrics.totalXp]),l.useEffect(()=>()=>{n.current!==null&&window.clearTimeout(n.current)},[]);const[he]=ed(),[le]=Yc(),[je]=Zc(),[ge]=ld(),[_e]=cd(),[Me]=dd(),[ze]=ud(),[W,Oe]=Xc(),[Q,Ne]=td(),[rt,Nt]=md(),[Pt,Tt]=Qc(),Y=async()=>{await Zd(i)},ot=async(f,w,I)=>{var ne,We;try{await ze({taskId:f,status:w,enforceTodayWorkLog:w==="done"&&(I==null?void 0:I.completedTodayWorkSeconds)===void 0,completedTodayWorkSeconds:I==null?void 0:I.completedTodayWorkSeconds}).unwrap(),await Y()}catch(Pe){if(Pe instanceof Mt&&Pe.code==="task_completion_work_log_required"&&w==="done"&&(I==null?void 0:I.completedTodayWorkSeconds)===void 0){const Ee=((We=(ne=F.data)==null?void 0:ne.tasks.find(Ge=>Ge.id===f))==null?void 0:We.title)??"this task";y({taskId:f,title:Ee,status:w,customMinutes:"",error:null});return}throw Pe}},Rt=async f=>{if(m)try{await ot(m.taskId,m.status,{completedTodayWorkSeconds:f}),y(null)}catch(w){y(I=>I&&{...I,error:w instanceof Error?w.message:"Could not close the task right now."})}},lt=Is({mutationFn:async f=>{var Pe,Ee;const w=(Pe=F.data)==null?void 0:Pe.dashboard.projects.find(Ge=>Ge.id===f.projectId);if(!w)throw new Error("Select a project before starting work.");const I=((Ee=J.data)==null?void 0:Ee.settings.profile.operatorName)??"Albert",ne=await he({title:f.title,description:f.description,level:"task",owner:I,userId:w.userId??(p.length===1?p[0]:null),assigneeUserIds:[],goalId:w.goalId,projectId:w.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 Fe(ne.task.id,{actor:I,timerMode:f.timerMode,plannedDurationSeconds:f.plannedDurationSeconds,isCurrent:!0,leaseTtlSeconds:1800,note:"",gitContext:f.gitContext}))throw new Error("The task was created, but live work did not start because the calendar override was cancelled.");return ne.task},onSuccess:async()=>{await Y()}}),Fe=async(f,w)=>{try{return await W({taskId:f,input:w}).unwrap(),await Y(),!0}catch(I){if(I instanceof Mt&&I.code==="task_run_calendar_blocked"&&typeof window<"u"){const ne=window.prompt("Calendar rules block this task right now. Add a reason to override and start anyway.");return!ne||ne.trim().length===0?!1:(await W({taskId:f,input:{...w,overrideReason:ne.trim()}}).unwrap(),await Y(),!0)}throw I}};if(X.isLoading||F.isLoading||J.isLoading)return s.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:s.jsx(Oi,{eyebrow:"Forge shell",title:"Loading Forge",description:"Checking your operator session and loading your latest snapshot."})});if(X.isError)return s.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:s.jsx(Dt,{eyebrow:"Forge operator session",error:X.error,onRetry:()=>void X.refetch()})});if(J.isError)return s.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:s.jsx(Dt,{eyebrow:"Forge settings",error:J.error,onRetry:()=>void J.refetch()})});if(F.isError||!F.data||!J.data)return s.jsx("div",{className:"grid min-h-screen place-items-center p-6",children:s.jsx(Dt,{eyebrow:"Forge state",error:F.error,onRetry:()=>void F.refetch()})});const ct={snapshot:F.data,selectedUserIds:p,setSelectedUserIds:oe,refresh:async()=>{await Promise.all([F.refetch(),Y()])},createTask:async f=>{await he(f).unwrap(),await Y()},startTaskNow:async(f,w={})=>{const I=J.data.settings.profile.operatorName;await Fe(f,pc(I,w))},stopTaskRun:async f=>{await rt({runId:f.id,input:{actor:f.actor,note:f.note??""}}).unwrap(),await Y()},createGoal:async f=>{await le(f).unwrap(),await Y()},createProject:async f=>{await je(f).unwrap(),await Y()},patchGoal:async(f,w)=>{await ge({goalId:f,patch:w}).unwrap(),await Y()},patchProject:async(f,w)=>{await _e({projectId:f,patch:w}).unwrap(),await Y()},patchTask:async(f,w)=>{await Me({taskId:f,patch:w}).unwrap(),await Y()},patchTaskStatus:async(f,w,I)=>{await ot(f,w,I)},openStartWork:(f={})=>{b(f),C(null),h(!0)}};return Xi=ct,s.jsx(No,{locale:J.data.settings.localePreference,children:s.jsx(Ji.Provider,{value:ct,children:s.jsxs(s.Fragment,{children:[s.jsx(Ml,{}),s.jsx(ou,{routeLocation:q,onRouteIntent:be,settings:J.data.settings,timerPending:Ne.isLoading||Nt.isLoading||Tt.isLoading,startWorkOpen:u,startWorkPending:Oe.isLoading||lt.isPending,startWorkError:v,startWorkDefaults:j,onOpenStartWork:f=>{b(f??{}),C(null),h(!0)},onCloseStartWork:()=>{h(!1),C(null)},onStartExistingTask:async(f,w)=>{try{const I=J.data.settings.profile.operatorName;await Fe(f,{actor:I,timerMode:w.timerMode,plannedDurationSeconds:w.plannedDurationSeconds,isCurrent:!0,leaseTtlSeconds:1800,note:"",gitContext:w.gitContext})&&(h(!1),C(null))}catch(I){C(I instanceof Error?I.message:"Could not start work.")}},onCreateAndStartTask:async f=>{try{await lt.mutateAsync(f),h(!1),C(null)}catch(w){C(w instanceof Error?w.message:"Could not create and start the task.")}},onFocusRun:async f=>{await Q(f).unwrap(),await Y()},onPauseRun:async f=>{const w=F.data.activeTaskRuns.find(I=>I.id===f);await rt({runId:f,input:{actor:w==null?void 0:w.actor,note:(w==null?void 0:w.note)??""}}).unwrap(),await Y()},onCompleteRun:async f=>{const w=F.data.activeTaskRuns.find(I=>I.id===f);await Pt({runId:f,input:{actor:w==null?void 0:w.actor,note:(w==null?void 0:w.note)??""}}).unwrap(),await Y()},children:s.jsx("div",{className:"relative min-w-0",children:L?s.jsx(ua.Provider,{value:L,children:k.node}):k.node})}),s.jsx(Kc,{prompt:m,setPrompt:y,onSubmit:f=>{Rt(f)}}),g!=null&&g.focusNode?s.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:s.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:s.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:s.jsx(Zl,{focus:g,onOpenPage:f=>{f.href&&t(f.href)},onOpenNotes:f=>{const w=hc(f);w&&t(w)},onOpenHierarchy:ke,onSelectNode:pe,onClose:()=>pe(null)})})})}):null,s.jsx($l,{xpNotice:O,celebrations:ue,onSeen:f=>{re.isLoading||G.has(f)||(ee(w=>{const I=new Set(w);return I.add(f),I}),ie(f).unwrap().catch(()=>{ee(w=>{const I=new Set(w);return I.delete(f),I})}))}})]})})})}function cu(){const e=l.useContext(Ji),t=$r(),n=e??t??Xi;if(!n)throw new Error("Forge shell context is unavailable.");return n}const du=l.lazy(()=>N(()=>import("./activity-page-CACf1Sd5.js"),__vite__mapDeps([19,1,2,11,20,21,14,22,5,4,12,9])).then(e=>({default:e.ActivityPage}))),uu=l.lazy(()=>N(()=>import("./calendar-page-CcVGbvfY.js"),__vite__mapDeps([23,1,2,11,3,4,5,17,18,24,25,26,27,20,28,29,10,12,9])).then(e=>({default:e.CalendarPage})));l.lazy(()=>N(()=>import("./companion-sync-lab-page-Dgvtdc4i.js"),__vite__mapDeps([30,1,2,20,11,5,4,12,9])).then(e=>({default:e.CompanionSyncLabPage})));const mu=l.lazy(()=>N(()=>import("./goal-detail-page-JRcEYpeA.js"),__vite__mapDeps([31,1,2,11,0,3,4,5,6,7,8,9,10,12,32,33,13,14,34,35,17,18,36,37,20,38,22])).then(e=>({default:e.GoalDetailPage}))),pu=l.lazy(()=>N(()=>import("./goals-page-CYestXkp.js"),__vite__mapDeps([39,1,2,20,40,0,3,4,5,6,7,8,9,10,11,12,41,37,14])).then(e=>({default:e.GoalsPage}))),hu=l.lazy(()=>N(()=>import("./habits-page-B27lnyKu.js"),__vite__mapDeps([42,1,2,4,11,40,33,43,20,3,5,7,10,8,9,44,14,45,12])).then(e=>({default:e.HabitsPage}))),gu=l.lazy(()=>N(()=>import("./insights-page-Dc5bilGE.js"),__vite__mapDeps([46,1,2,11,3,4,5,8,9,47,20,14,12])).then(e=>({default:e.InsightsPage}))),fu=l.lazy(()=>N(()=>import("./kanban-page-BGnVLHeN.js"),__vite__mapDeps([48,1,2,11,49,50,51,52,53,54,12,14,40,28,13,3,4,5,6,7,8,9,10,55,17,18,15,0,20])).then(e=>({default:e.KanbanPage}))),vu=l.lazy(()=>N(()=>import("./knowledge-graph-page-B7IsVVO_.js"),__vite__mapDeps([56,1,2,4,11,51,52,17,18,57,14,5,12,9])).then(e=>({default:e.KnowledgeGraphPage}))),yu=l.lazy(()=>N(()=>import("./life-force-page-B5N4DknK.js"),__vite__mapDeps([58,1,2,59,11,28,60,20,5,4,12,9])).then(e=>({default:e.LifeForcePage}))),bu=l.lazy(()=>N(()=>import("./movement-page-CY2XLgp_.js"),__vite__mapDeps([61,1,2,11,57,20,4,5,62,63,50,51,52,53,60,12,9])).then(e=>({default:e.MovementPage}))),xu=l.lazy(()=>N(()=>import("./notes-page-CSCfdDJl.js"),__vite__mapDeps([64,1,2,11,17,18,33,35,20,65,50,51,52,53,28,10,5,4,12,9])).then(e=>({default:e.NotesPage}))),wu=l.lazy(()=>N(()=>import("./overview-page-ckfN_sLZ.js"),__vite__mapDeps([66,1,2,67,12,11,68,50,51,52,69,5,59,28,60,40,20,38,4,9])).then(e=>({default:e.OverviewPage}))),ku=l.lazy(()=>N(()=>import("./project-detail-page-Crt46y_7.js"),__vite__mapDeps([70,1,2,11,27,32,13,3,4,5,6,7,14,8,9,10,12,55,15,0,71,54,40,28,33,34,35,17,18,36,20,38,22])).then(e=>({default:e.ProjectDetailPage}))),Su=l.lazy(()=>N(()=>import("./project-management-hierarchy-page-DnojKHzy.js"),__vite__mapDeps([72,1,2,11,17,18,55,20,14,5,4,12,9])).then(e=>({default:e.ProjectManagementHierarchyPage}))),ju=l.lazy(()=>N(()=>import("./projects-page-CV_2em8d.js"),__vite__mapDeps([73,1,2,67,12,11,41,74,50,51,52,53,20,40,37,55,14,10,5,4,9])).then(e=>({default:e.ProjectsPage}))),Nu=l.lazy(()=>N(()=>import("./settings-wiki-page-Bn2Qr94L.js"),__vite__mapDeps([75,1,2,11,76,20,5,4,12,9])).then(e=>({default:e.SettingsWikiPage}))),Pu=l.lazy(()=>N(()=>import("./strategies-page-AUBlFCZ9.js"),__vite__mapDeps([77,1,2,11,78,12,3,4,5,14,7,10,20,9])).then(e=>({default:e.StrategiesPage}))),Tu=l.lazy(()=>N(()=>import("./strategy-detail-page-DCF8mVaL.js"),__vite__mapDeps([79,1,2,11,32,36,78,12,3,4,5,14,7,10,51,52,20,9])).then(e=>({default:e.StrategyDetailPage}))),Ru=l.lazy(()=>N(()=>import("./preferences-page-DseOh9AP.js"),__vite__mapDeps([80,1,2,11,20,14,10,4,5,12,9])).then(e=>({default:e.PreferencesPage}))),_u=l.lazy(()=>N(()=>import("./psyche-page-DRR3Fjv-.js"),__vite__mapDeps([81,1,2,11,67,12,82,3,4,5,20,9])).then(e=>({default:e.PsychePage}))),Cu=l.lazy(()=>N(()=>import("./psyche-behaviors-page-CYCNk0rz.js"),__vite__mapDeps([83,1,2,11,3,4,5,40,84,17,18,85,86,43,20,14,7,87,88,9,10,12])).then(e=>({default:e.PsycheBehaviorsPage}))),Iu=l.lazy(()=>N(()=>import("./psyche-flashcards-page-DwmjBixN.js"),__vite__mapDeps([89,1,2,11,43,20,14,7,88,9,10,5,4,12])).then(e=>({default:e.PsycheFlashcardsPage}))),Ou=l.lazy(()=>N(()=>import("./psyche-goal-map-page-CdMhyBKh.js"),__vite__mapDeps([90,1,2,11,82,20,5,4,12,9])).then(e=>({default:e.PsycheGoalMapPage}))),Eu=l.lazy(()=>N(()=>import("./psyche-metrics-page-D5bX1mNX.js"),__vite__mapDeps([91,1,2,11,20,92,4,60,5,12,9])).then(e=>({default:e.PsycheMetricsPage}))),Au=l.lazy(()=>N(()=>import("./psyche-mode-guide-page-BmX9EOOB.js"),__vite__mapDeps([93,1,2,11,9,20,88,5,4,12])).then(e=>({default:e.PsycheModeGuidePage}))),Lu=l.lazy(()=>N(()=>import("./psyche-modes-page-CTHFDyLE.js"),__vite__mapDeps([94,1,2,11,3,4,5,40,84,17,18,43,20,7,87,88,9,10,12])).then(e=>({default:e.PsycheModesPage}))),Du=l.lazy(()=>N(()=>import("./psyche-patterns-page-BAS38xYf.js"),__vite__mapDeps([95,1,2,11,3,4,5,40,84,17,18,96,85,86,43,20,14,7,87,88,9,10,12])).then(e=>({default:e.PsychePatternsPage}))),za=l.lazy(()=>N(()=>import("./psyche-questionnaire-builder-page-DpSi-zg3.js"),__vite__mapDeps([97,1,2,11,20,5,4,12,9])).then(e=>({default:e.PsycheQuestionnaireBuilderPage}))),$u=l.lazy(()=>N(()=>import("./psyche-questionnaire-detail-page-BcXIiV4E.js"),__vite__mapDeps([98,1,2,11,20,5,4,12,9])).then(e=>({default:e.PsycheQuestionnaireDetailPage}))),Mu=l.lazy(()=>N(()=>import("./psyche-questionnaire-run-detail-page-DvccwzWO.js"),__vite__mapDeps([99,1,2,11,20,5,4,12,9])).then(e=>({default:e.PsycheQuestionnaireRunDetailPage}))),zu=l.lazy(()=>N(()=>import("./psyche-questionnaire-run-page-vcyon8IZ.js"),__vite__mapDeps([100,1,2,11,20,5,4,12,9])).then(e=>({default:e.PsycheQuestionnaireRunPage}))),Fu=l.lazy(()=>N(()=>import("./psyche-questionnaires-page-B0DDTner.js"),__vite__mapDeps([101,1,2,11,57,20,5,4,12,9])).then(e=>({default:e.PsycheQuestionnairesPage}))),Wu=l.lazy(()=>N(()=>import("./psyche-report-detail-page-BgBA3xIO.js"),__vite__mapDeps([102,1,2,11,5,47,3,4,8,9,32,34,33,35,17,18,10,103,20,88,86,12])).then(e=>({default:e.PsycheReportDetailPage}))),Gu=l.lazy(()=>N(()=>import("./psyche-reports-page-Ce1vEEqW.js"),__vite__mapDeps([104,1,2,11,3,4,5,40,84,17,18,85,86,103,20,14,7,87,88,9,10,12])).then(e=>({default:e.PsycheReportsPage}))),Hu=l.lazy(()=>N(()=>import("./psyche-self-observation-page-j7Sk6Ns1.js"),__vite__mapDeps([105,1,2,11,17,18,35,20,24,25,44,14,7,22,10,5,4,12,9])).then(e=>({default:e.PsycheSelfObservationPage}))),Uu=l.lazy(()=>N(()=>import("./psyche-screen-time-page-DOKW3m8B.js"),__vite__mapDeps([106,1,2,11,20,60,5,4,12,9])).then(e=>({default:e.PsycheScreenTimePage}))),qu=l.lazy(()=>N(()=>import("./psyche-schemas-beliefs-page-D-IHHohY.js"),__vite__mapDeps([107,1,2,11,85,86,3,4,5,40,84,17,18,43,20,14,7,87,88,9,10,12])).then(e=>({default:e.PsycheSchemasBeliefsPage}))),Ku=l.lazy(()=>N(()=>import("./psyche-values-page-NfzdWUyb.js"),__vite__mapDeps([108,1,2,11,3,4,5,40,84,96,43,20,14,7,88,9,10,12])).then(e=>({default:e.PsycheValuesPage}))),Bu=l.lazy(()=>N(()=>import("./settings-page-CalbNbcg.js"),__vite__mapDeps([109,1,2,11,9,3,4,5,76,20,8,12])).then(e=>({default:e.SettingsPage}))),Vu=l.lazy(()=>N(()=>import("./settings-data-page-nHNergsh.js"),__vite__mapDeps([110,1,2,11,3,4,5,76,20,111,12,9])).then(e=>({default:e.SettingsDataPage}))),Ju=l.lazy(()=>N(()=>import("./settings-agents-page-BIRP02mt.js"),__vite__mapDeps([112,1,2,11,3,4,5,8,9,76,20,111,12])).then(e=>({default:e.SettingsAgentsPage}))),Xu=l.lazy(()=>N(()=>import("./settings-bin-page-DxJKeM28.js"),__vite__mapDeps([113,1,2,11,76,20,5,4,12,9])).then(e=>({default:e.SettingsBinPage}))),Qu=l.lazy(()=>N(()=>import("./settings-calendar-page-aMBtwvO_.js"),__vite__mapDeps([114,1,2,11,3,4,5,76,20,29,12,9])).then(e=>({default:e.SettingsCalendarPage}))),Yu=l.lazy(()=>N(()=>import("./settings-mobile-page-Bf_1D-bN.js"),__vite__mapDeps([115,1,2,11,76,20,10,5,4,12,9])).then(e=>({default:e.SettingsMobilePage}))),Zu=l.lazy(()=>N(()=>import("./settings-models-page-BbFNmnik.js"),__vite__mapDeps([116,1,2,11,76,20,5,4,12,9])).then(e=>({default:e.SettingsModelsPage}))),em=l.lazy(()=>N(()=>import("./settings-logs-page-CFotPoFy.js"),__vite__mapDeps([117,1,2,11,20,76,18,5,4,12,9])).then(e=>({default:e.SettingsLogsPage}))),tm=l.lazy(()=>N(()=>import("./settings-rewards-page-ByDfCzP5.js"),__vite__mapDeps([118,1,2,11,9,76,5,20,111,4,12])).then(e=>({default:e.SettingsRewardsPage}))),sm=l.lazy(()=>N(()=>import("./settings-users-page-N1jl9hWV.js"),__vite__mapDeps([119,1,2,11,76,20,51,52,14,3,4,5,12,9])).then(e=>({default:e.SettingsUsersPage}))),nm=l.lazy(()=>N(()=>import("./rewards-page-CVxOBP6m.js"),__vite__mapDeps([120,1,2,11,20,5,4,12,9])).then(e=>({default:e.RewardsPage}))),am=l.lazy(()=>N(()=>import("./sleep-page-DyU635jb.js"),__vite__mapDeps([121,1,2,11,17,18,20,122,50,51,52,53,123,5,4,12,9])).then(e=>({default:e.SleepPage}))),im=l.lazy(()=>N(()=>import("./sports-page-DbK4yGrR.js"),__vite__mapDeps([124,1,2,11,17,18,57,20,122,50,51,52,53,45,123,60,5,4,12,9])).then(e=>({default:e.SportsPage}))),rm=l.lazy(()=>N(()=>import("./training-load-page-BD0s8-Zm.js"),__vite__mapDeps([125,1,2,11,60,20,5,4,12,9])).then(e=>({default:e.TrainingLoadPage}))),om=l.lazy(()=>N(()=>import("./workout-detail-page-9I_3DPYU.js"),__vite__mapDeps([126,1,2,11,127,128,20,60,5,4,12,9])).then(e=>({default:e.WorkoutDetailPage}))),lm=l.lazy(()=>N(()=>import("./task-detail-page-Dsll2LCX.js"),__vite__mapDeps([129,1,2,11,26,27,3,4,5,25,32,33,34,35,17,18,10,36,15,0,6,7,8,9,12,13,14,71,20,38,22])).then(e=>({default:e.TaskDetailPage}))),cm=l.lazy(()=>N(()=>import("./today-page-BSXSA-Ts.js"),__vite__mapDeps([130,1,2,11,67,12,68,50,51,52,40,62,59,28,60,20,131,53,5,4,9])).then(e=>({default:e.TodayPage}))),dm=l.lazy(()=>N(()=>import("./vitals-page-BnXk8OzN.js"),__vite__mapDeps([132,1,2,11,20,92,4,60,5,12,9])).then(e=>({default:e.VitalsPage}))),um=l.lazy(()=>N(()=>import("./weight-loss-page-Bn6lAXNf.js"),__vite__mapDeps([133,1,2,11,20,62,3,4,5,45,12,9])).then(e=>({default:e.WeightLossPage}))),Fa=l.lazy(()=>N(()=>import("./wiki-page-CELe_6qL.js"),__vite__mapDeps([134,1,2,4,11,32,135,136,5,12,9])).then(e=>({default:e.WikiPage}))),mm=l.lazy(()=>N(()=>import("./wiki-ingest-history-page-CisvtAzm.js"),__vite__mapDeps([137,1,2,11,136,4,20,5,12,9])).then(e=>({default:e.WikiIngestHistoryPage}))),Wa=l.lazy(()=>N(()=>import("./wiki-editor-page-CHEETB0G.js"),__vite__mapDeps([138,1,2,4,11,17,18,135,5,12,9])).then(e=>({default:e.WikiEditorPage}))),pm=l.lazy(()=>N(()=>import("./weekly-review-page-CnmSGnEC.js"),__vite__mapDeps([139,1,2,11,69,5,20,4,12,9])).then(e=>({default:e.WeeklyReviewPage}))),hm=l.lazy(()=>N(()=>import("./workbench-page-q7Z3sQtz.js"),__vite__mapDeps([140,1,2,11,57,20,5,4,12,9])).then(e=>({default:e.WorkbenchPage}))),gm=l.lazy(()=>N(()=>import("./workbench-flow-page-JBVim3L0.js"),__vite__mapDeps([141,1,2,32,20,68,11,50,51,52,53,49,122,63,65,74,131,3,4,5,57,12,9])).then(e=>({default:e.WorkbenchFlowPage})));function fm(){const e=Qe();return l.useEffect(()=>{const t=`${e.pathname}${e.search}${e.hash}`,n=pi({scope:"frontend_runtime",route:t}),a=o=>{n({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}})},i=o=>{n({level:"error",eventKey:"unhandled_rejection",message:"Unhandled promise rejection",functionName:"window.onunhandledrejection",details:{reason:o.reason??null}})};return window.addEventListener("error",a),window.addEventListener("unhandledrejection",i),()=>{window.removeEventListener("error",a),window.removeEventListener("unhandledrejection",i)}},[e.hash,e.pathname,e.search]),l.useEffect(()=>{const t=`${e.pathname}${e.search}${e.hash}`;Kt({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 vm(){function e(t,n,a,i){return s.jsx(au,{viewId:t,children:i})}return s.jsxs(s.Fragment,{children:[s.jsx(fm,{}),s.jsxs(Wr,{children:[s.jsxs(S,{element:s.jsx(lu,{}),children:[s.jsx(S,{index:!0,element:s.jsx(Qt,{to:"/overview",replace:!0})}),s.jsx(S,{path:"overview",element:e("overview","Overview","Daily signal, momentum, and current Forge state.",s.jsx(wu,{}))}),s.jsx(S,{path:"life-force",element:e("life-force-index","Life Force","Action Point capacity, weekday curves, and dynamic drains.",s.jsx(yu,{}))}),s.jsx(S,{path:"goals",element:e("goals-index","Goals","Goal planning and long-horizon direction.",s.jsx(pu,{}))}),s.jsx(S,{path:"habits",element:e("habits-index","Habits","Recurring commitments, streaks, and check-ins.",s.jsx(hu,{}))}),s.jsx(S,{path:"goals/:goalId",element:e("goal-detail","Goal detail","Goal detail, progress, and linked execution context.",s.jsx(mu,{}))}),s.jsx(S,{path:"projects",element:e("projects-index","Projects","PRD-backed projects and execution initiatives.",s.jsx(ju,{}))}),s.jsx(S,{path:"projects/hierarchy",element:e("project-hierarchy","Project hierarchy","Full hierarchy from goals down to subtasks.",s.jsx(Su,{}))}),s.jsx(S,{path:"projects/:projectId",element:e("project-detail","Project detail","Project detail, tasks, and execution health.",s.jsx(ku,{}))}),s.jsx(S,{path:"strategies",element:e("strategies-index","Strategies","Strategy graphs and long-range execution plans.",s.jsx(Pu,{}))}),s.jsx(S,{path:"strategies/:strategyId",element:e("strategy-detail","Strategy detail","Strategy DAG detail, targets, and progress.",s.jsx(Tu,{}))}),s.jsx(S,{path:"preferences",element:e("preferences-index","Preferences","Preference profiles, pairwise judgments, and model state.",s.jsx(Ru,{}))}),s.jsx(S,{path:"campaigns",element:s.jsx(Qt,{to:"/projects",replace:!0})}),s.jsx(S,{path:"calendar",element:e("calendar-index","Calendar","Calendar planning, timeboxes, and provider sync.",s.jsx(uu,{}))}),s.jsx(S,{path:"knowledge-graph",element:e("knowledge-graph-index","Knowledge Graph","One connected map of Forge entities and explicit relationships.",s.jsx(vu,{}))}),s.jsx(S,{path:"movement",element:e("movement-index","Movement","Movement traces, places, and trip evidence.",s.jsx(bu,{}))}),s.jsx(S,{path:"sleep",element:e("sleep-index","Sleep","Sleep sessions, health context, and recovery trends.",s.jsx(am,{}))}),s.jsx(S,{path:"sports",element:e("sports-index","Sports","Fitness, workouts, and sports context.",s.jsx(im,{}))}),s.jsx(S,{path:"sports/workouts/:workoutId",element:e("sports-workout-detail","Workout Detail","Raw workout evidence, heart-rate zones, and session context.",s.jsx(om,{}))}),s.jsx(S,{path:"training-load",element:e("training-load-index","Training Load","Cardiovascular load, intensity distribution, and training targets.",s.jsx(rm,{}))}),s.jsx(S,{path:"vitals",element:e("vitals-index","Vitals","Body signals, recovery, cardio fitness, and daily HealthKit metrics.",s.jsx(dm,{}))}),s.jsx(S,{path:"weight-loss",element:e("weight-loss-index","Weight Loss","Nutrition, body composition, food effects, gut signals, and aesthetic experiments.",s.jsx(um,{}))}),s.jsx(S,{path:"psyche",element:e("psyche-index","Psyche","Values, modes, reports, and reflective context.",s.jsx(_u,{}))}),s.jsx(S,{path:"psyche/metrics",element:e("psyche-metrics","Psyche metrics","Daily Psyche metric history with plots and summary statistics.",s.jsx(Eu,{}))}),s.jsx(S,{path:"psyche/flashcards",element:e("psyche-flashcards","Psyche flashcards","Therapeutic reminder cards for urges, triggers, and values-based pivots.",s.jsx(Iu,{}))}),s.jsx(S,{path:"psyche/values",element:e("psyche-values","Psyche values","Values and linked goal context.",s.jsx(Ku,{}))}),s.jsx(S,{path:"psyche/patterns",element:e("psyche-patterns","Psyche patterns","Behavior patterns and recurring loops.",s.jsx(Du,{}))}),s.jsx(S,{path:"psyche/questionnaires",element:e("psyche-questionnaires","Questionnaires","Questionnaire library and recent runs.",s.jsx(Fu,{}))}),s.jsx(S,{path:"psyche/questionnaires/new",element:e("psyche-questionnaire-new","New questionnaire","Questionnaire builder workspace.",s.jsx(za,{}))}),s.jsx(S,{path:"psyche/questionnaires/:instrumentId",element:e("psyche-questionnaire-detail","Questionnaire detail","Questionnaire detail and scores.",s.jsx($u,{}))}),s.jsx(S,{path:"psyche/questionnaires/:instrumentId/edit",element:e("psyche-questionnaire-edit","Edit questionnaire","Questionnaire builder workspace.",s.jsx(za,{}))}),s.jsx(S,{path:"psyche/questionnaires/:instrumentId/take",element:e("psyche-questionnaire-run","Take questionnaire","Questionnaire runner and answers.",s.jsx(zu,{}))}),s.jsx(S,{path:"psyche/questionnaire-runs/:runId",element:e("psyche-questionnaire-run-detail","Questionnaire run detail","Questionnaire result review.",s.jsx(Mu,{}))}),s.jsx(S,{path:"psyche/self-observation",element:e("psyche-self-observation","Self observation","Self-observation notes and reflective tracking.",s.jsx(Hu,{}))}),s.jsx(S,{path:"psyche/screen-time",element:e("psyche-screen-time","Screen Time","Apple-compliant device-activity patterns and reflective usage history.",s.jsx(Uu,{}))}),s.jsx(S,{path:"psyche/behaviors",element:e("psyche-behaviors","Behaviors","Behavior records and linked evidence.",s.jsx(Cu,{}))}),s.jsx(S,{path:"psyche/reports",element:e("psyche-reports","Reports","Trigger and reflective report review.",s.jsx(Gu,{}))}),s.jsx(S,{path:"psyche/reports/:reportId",element:e("psyche-report-detail","Report detail","Detailed reflective report view.",s.jsx(Wu,{}))}),s.jsx(S,{path:"psyche/goal-map",element:e("psyche-goal-map","Goal map","Goal-to-values relationship map.",s.jsx(Ou,{}))}),s.jsx(S,{path:"psyche/schemas-beliefs",element:e("psyche-schemas-beliefs","Schemas and beliefs","Beliefs, schemas, and linked patterns.",s.jsx(qu,{}))}),s.jsx(S,{path:"psyche/modes",element:e("psyche-modes","Modes","Mode profiles and guides.",s.jsx(Lu,{}))}),s.jsx(S,{path:"psyche/modes/guide",element:e("psyche-mode-guide","Mode guide","Guided mode session flow.",s.jsx(Au,{}))}),s.jsx(S,{path:"kanban",element:e("kanban-index","Kanban","Task board execution surface.",s.jsx(fu,{}))}),s.jsx(S,{path:"notes",element:e("notes-index","Notes","Notes, evidence, and writing surfaces.",s.jsx(xu,{}))}),s.jsx(S,{path:"wiki",element:e("wiki-index","KarpaWiki","KarpaWiki search and page navigation.",s.jsx(Fa,{}))}),s.jsx(S,{path:"wiki/ingest-history",element:e("wiki-ingest-history","KarpaWiki ingest history","Ingest jobs and processing history.",s.jsx(mm,{}))}),s.jsx(S,{path:"wiki/page/:slug",element:e("wiki-page-detail","KarpaWiki page","KarpaWiki page detail and backlinks.",s.jsx(Fa,{}))}),s.jsx(S,{path:"wiki/new",element:e("wiki-new","New KarpaWiki page","KarpaWiki editor for new pages.",s.jsx(Wa,{}))}),s.jsx(S,{path:"wiki/edit/:pageId",element:e("wiki-edit","Edit KarpaWiki page","KarpaWiki editor for existing pages.",s.jsx(Wa,{}))}),s.jsx(S,{path:"today",element:e("today-index","Today","Current work, time, and daily runway.",s.jsx(cm,{}))}),s.jsx(S,{path:"workbench",element:e("workbench","Workbench","Search, organize, and launch Forge flows.",s.jsx(hm,{}))}),s.jsx(S,{path:"workbench/:flowId",element:e("workbench-flow","Workbench flow","Graph editor and runtime surface for a single flow.",s.jsx(gm,{}))}),s.jsx(S,{path:"activity",element:e("activity-index","Activity","Activity log and event history.",s.jsx(du,{}))}),s.jsx(S,{path:"insights",element:e("insights-index","Insights","Insight review and decisions.",s.jsx(gu,{}))}),s.jsx(S,{path:"review/weekly",element:e("weekly-review","Weekly review","Weekly review workflow and closeout.",s.jsx(pm,{}))}),s.jsx(S,{path:"settings",element:e("settings-index","Settings","Operator settings and runtime configuration.",s.jsx(Bu,{}))}),s.jsx(S,{path:"settings/data",element:e("settings-data","Settings data","Runtime storage, backups, exports, and recovery.",s.jsx(Vu,{}))}),s.jsx(S,{path:"settings/users",element:e("settings-users","Settings users","User directory and ownership settings.",s.jsx(sm,{}))}),s.jsx(S,{path:"settings/calendar",element:e("settings-calendar","Settings calendar","Calendar provider settings and sync.",s.jsx(Qu,{}))}),s.jsx(S,{path:"settings/mobile",element:e("settings-mobile","Settings mobile","Mobile companion settings and pairing.",s.jsx(Yu,{}))}),null,s.jsx(S,{path:"settings/models",element:e("settings-models","Settings models","Model connections and defaults.",s.jsx(Zu,{}))}),s.jsx(S,{path:"settings/agents",element:e("settings-agents","Settings agents","Agent tokens and runtime access.",s.jsx(Ju,{}))}),s.jsx(S,{path:"settings/rewards",element:e("settings-rewards","Settings rewards","Rewards and XP rule settings.",s.jsx(tm,{}))}),s.jsx(S,{path:"rewards",element:e("rewards","Trophy Hall","Trophies, unlocks, streak pressure, and Forge Smith progression.",s.jsx(nm,{}))}),s.jsx(S,{path:"settings/wiki",element:e("settings-wiki","KarpaWiki settings","KarpaWiki ingestion and profile settings.",s.jsx(Nu,{}))}),s.jsx(S,{path:"settings/logs",element:e("settings-logs","Settings logs","Diagnostics and event logs.",s.jsx(em,{}))}),s.jsx(S,{path:"settings/bin",element:e("settings-bin","Settings bin","Deleted entity recovery.",s.jsx(Xu,{}))}),s.jsx(S,{path:"tasks/:taskId",element:e("task-detail","Task detail","Task detail, timer, and notes.",s.jsx(lm,{}))})]}),s.jsx(S,{path:"*",element:s.jsx(Qt,{to:"/overview",replace:!0})})]})]})}class ym extends ni.Component{constructor(){super(...arguments);Ae(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,a){console.error("Forge failed to render",n,a)}render(){return this.state.error?s.jsx("main",{className:"grid min-h-dvh place-items-center bg-canvas px-5 py-10 text-ink",children:s.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:[s.jsx("p",{className:"font-label text-xs font-bold uppercase tracking-[0.08em] text-primary/80",children:"Forge runtime"}),s.jsx("h1",{className:"mt-3 text-3xl font-bold tracking-normal text-ink",children:"Forge could not finish rendering"}),s.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."}),s.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}),s.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 bm=new Gr({defaultOptions:{queries:{staleTime:2e4,refetchOnWindowFocus:!1}}});Hr.createRoot(document.getElementById("root")).render(s.jsx(ni.StrictMode,{children:s.jsx(ym,{children:s.jsx(eo,{store:Bs,children:s.jsx(to,{client:bm,children:s.jsx(Ur,{basename:Eo("/forge/"),children:s.jsx(vm,{})})})})})}));export{Hh as $,Ah as A,B,Te as C,Lh as D,Ws as E,Oh as F,$h as G,Ch as H,gt as I,Ih as J,Mh as K,Oi as L,Dh as M,uh as N,Rm as O,To as P,Af as Q,Yf as R,eu as S,oc as T,wv as U,Dl as V,Mt as W,qh as X,xv as Y,Gh as Z,Wh as _,Fs as a,Vl as a$,Uh as a0,Fh as a1,Xm as a2,dv as a3,bs as a4,lh as a5,oh as a6,Rl as a7,Nl as a8,jl as a9,Gs as aA,Yl as aB,Vt as aC,Im as aD,La as aE,zg as aF,Wg as aG,Eg as aH,Gg as aI,Hg as aJ,Mg as aK,Lg as aL,$g as aM,Og as aN,Fg as aO,bv as aP,Ig as aQ,Ag as aR,Sg as aS,jg as aT,Ng as aU,Cg as aV,Dg as aW,Ug as aX,kv as aY,tv as aZ,ji as a_,Ep as aa,Ni as ab,rh as ac,Jm as ad,Mf as ae,$f as af,Wf as ag,Df as ah,zv as ai,Mv as aj,Fv as ak,nv as al,av as am,iv as an,sv as ao,dc as ap,Js as aq,yt as ar,Gv as as,$v as at,Td as au,Wv as av,rv as aw,Pi as ax,Da as ay,Av as az,qe as b,fp as b$,Jl as b0,Dp as b1,Lp as b2,Qo as b3,Yo as b4,Zo as b5,el as b6,yp as b7,Sp as b8,tl as b9,Am as bA,Lm as bB,Dm as bC,Mm as bD,zm as bE,$m as bF,Em as bG,Bm as bH,Km as bI,Om as bJ,Qf as bK,Ym as bL,hp as bM,pp as bN,up as bO,cp as bP,bp as bQ,gp as bR,Np as bS,jp as bT,Pp as bU,Qm as bV,kp as bW,wp as bX,xp as bY,mp as bZ,Ap as b_,Op as ba,nd as bb,Bf as bc,gl as bd,og as be,dg as bf,Pl as bg,Ef as bh,Kh as bi,Bh as bj,Vp as bk,Jp as bl,Mp as bm,$p as bn,nf as bo,sf as bp,ef as bq,tf as br,lv as bs,qm as bt,Um as bu,Vm as bv,Hm as bw,Wm as bx,Fm as by,Gm as bz,x as c,mf as c$,tp as c0,sp as c1,ep as c2,np as c3,ap as c4,Zm as c5,zh as c6,ov as c7,Es as c8,ev as c9,Tg as cA,Rg as cB,vp as cC,dp as cD,Z as cE,Bi as cF,Qv as cG,Sv as cH,Cv as cI,_v as cJ,Qd as cK,Xv as cL,Ll as cM,xs as cN,$e as cO,bl as cP,xi as cQ,gs as cR,qf as cS,Kf as cT,Vo as cU,yi as cV,ig as cW,bi as cX,lf as cY,cf as cZ,of as c_,Zf as ca,Vv as cb,Jv as cc,Hf as cd,Uf as ce,Lf as cf,_m as cg,Cm as ch,sg as ci,ng as cj,tg as ck,Up as cl,vl as cm,rp as cn,ip as co,op as cp,lp as cq,Ip as cr,Cp as cs,Tp as ct,Rp as cu,_p as cv,ph as cw,mh as cx,_g as cy,Pg as cz,cu as d,fl as d$,uf as d0,df as d1,rf as d2,Rf as d3,Ff as d4,gf as d5,ff as d6,_f as d7,Cf as d8,bf as d9,jh as dA,qg as dB,Vg as dC,Kg as dD,Bg as dE,Qp as dF,Xp as dG,Yh as dH,eg as dI,Jh as dJ,Qh as dK,Xh as dL,Zh as dM,Of as dN,Vf as dO,kf as dP,Sf as dQ,wf as dR,jf as dS,Zg as dT,Yg as dU,Qg as dV,Xg as dW,wi as dX,At as dY,Pf as dZ,Nf as d_,xf as da,yf as db,vf as dc,pf as dd,hf as de,Vh as df,Tf as dg,kl as dh,af as di,yh as dj,gh as dk,fh as dl,vh as dm,kh as dn,wh as dp,bh as dq,xh as dr,Sh as ds,Io as dt,Ph as du,Nh as dv,Th as dw,Rh as dx,hh as dy,_h as dz,Dt as e,rg as e0,Jg as e1,lg as e2,N as e3,cg as e4,Al as e5,El as e6,zf as e7,gg as e8,vg as e9,zp as eA,dh as eB,ch as eC,Xf as eD,ag as eE,il as eF,Pv as eG,Nv as eH,jv as eI,ad as eJ,Ov as eK,Rv as eL,Iv as eM,Tv as eN,pg as ea,mg as eb,bg as ec,fg as ed,yg as ee,hg as ef,wg as eg,kg as eh,xg as ei,ug as ej,Kp as ek,Wp as el,Gp as em,Hp as en,Bp as eo,ah as ep,Zp as eq,Yp as er,ih as es,nh as et,sh as eu,th as ev,eh as ew,sl as ex,qp as ey,Fp as ez,bo as f,Jf as g,cv as h,Zd as i,yv as j,D as k,If as l,Fc as m,hv as n,uv as o,Tm as p,pv as q,Gf as r,Sl as s,mv as t,ye as u,vv as v,fv as w,gv as x,va as y,Eh as z};
|