forge-openclaw-plugin 0.2.101 → 0.2.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/dist/assets/activity-page-Dv6X5ZCV.js +1 -0
  2. package/dist/assets/ai-surface-workspace-CutiG6uS.js +1 -0
  3. package/dist/assets/atlas-panel-jgMRyaHn.js +1 -0
  4. package/dist/assets/{board-BkDRaMp6.js → board-dIX6etHh.js} +1 -1
  5. package/dist/assets/calendar-page-q7Nm5E2U.js +1 -0
  6. package/dist/assets/calendar-rules-DPFsfiRl.js +1 -0
  7. package/dist/assets/calendar-week-toolbar-nVhgB-0s.js +1 -0
  8. package/dist/assets/{charts-P7EVhIog.js → charts-DFnEuIMB.js} +8 -8
  9. package/dist/assets/companion-sync-lab-page-CJ8UTij8.js +1 -0
  10. package/dist/assets/daily-metrics-dashboard-CiJkkkd1.js +1 -0
  11. package/dist/assets/entity-note-count-link-RzBB6ujx.js +1 -0
  12. package/dist/assets/entity-notes-surface-Djz50HvD.js +1 -0
  13. package/dist/assets/execution-board-CtPhI-58.js +1 -0
  14. package/dist/assets/faceted-token-search-DEC6ANa9.js +1 -0
  15. package/dist/assets/flagship-signal-deck-CtHC3mql.js +1 -0
  16. package/dist/assets/floating-action-menu-CKQRhff9.js +1 -0
  17. package/dist/assets/{forms-BFlTgZ3W.js → forms-hB0SqEh-.js} +1 -1
  18. package/dist/assets/goal-detail-page-CF5fNQeR.js +1 -0
  19. package/dist/assets/goals-page-fsY8NzGB.js +1 -0
  20. package/dist/assets/{graph-D6JLqDbD.js → graph-DDUZNRsO.js} +14 -14
  21. package/dist/assets/habits-page-COoGz4kj.js +1 -0
  22. package/dist/assets/index-BAXYM89v.css +1 -0
  23. package/dist/assets/index-EqQsXoat.js +19 -0
  24. package/dist/assets/insight-flow-dialog-DtX_5W7g.js +1 -0
  25. package/dist/assets/insights-page-cBd74ObU.js +8 -0
  26. package/dist/assets/kanban-page-CYav9THw.js +1 -0
  27. package/dist/assets/knowledge-graph-page-D2A-W1jE.js +1 -0
  28. package/dist/assets/{life-force-page-Dy0JTS2G.js → life-force-page-CACGlNhq.js} +1 -1
  29. package/dist/assets/life-force-workspace-BJ4N1I78.js +1 -0
  30. package/dist/assets/{maps-ClgJoCjz.js → maps-C-yOWiDN.js} +1 -1
  31. package/dist/assets/metric-tile-CMadwnGz.js +1 -0
  32. package/dist/assets/{motion-BeD44FeG.js → motion-Lt5B1XuE.js} +1 -1
  33. package/dist/assets/movement-page-D5VqFd2q.js +1 -0
  34. package/dist/assets/note-markdown-BzK2Qlgr.js +3 -0
  35. package/dist/assets/note-tags-input-CZzqJMLc.js +1 -0
  36. package/dist/assets/notes-page-D3Hsh90C.js +1 -0
  37. package/dist/assets/{open-in-graph-button-IXe9SGth.js → open-in-graph-button-BFPKfyK3.js} +1 -1
  38. package/dist/assets/orbit-map-CnyfSmOG.js +1 -0
  39. package/dist/assets/overview-page-CXdWrOV1.js +1 -0
  40. package/dist/assets/page-hero-ffKzgyW3.js +1 -0
  41. package/dist/assets/pill-cluster-C2D0h3lx.js +1 -0
  42. package/dist/assets/{preference-entity-handoff-button-5PzUn42S.js → preference-entity-handoff-button-Dj3V6VxL.js} +1 -1
  43. package/dist/assets/preferences-page-Jo8Gw386.js +1 -0
  44. package/dist/assets/project-collections-qSqp90HN.js +1 -0
  45. package/dist/assets/{project-detail-page-BXK5-4xW.js → project-detail-page-BifhiLQX.js} +1 -1
  46. package/dist/assets/project-management-hierarchy-page-DZ_9klIc.js +1 -0
  47. package/dist/assets/project-management-section-nav-BImLCVvf.js +1 -0
  48. package/dist/assets/projects-page-ptcx6H38.js +1 -0
  49. package/dist/assets/psyche-behaviors-page-BDwXyDta.js +5 -0
  50. package/dist/assets/psyche-flashcards-page-DL1BP1jX.js +1 -0
  51. package/dist/assets/psyche-goal-map-page-ovcpisx1.js +1 -0
  52. package/dist/assets/psyche-graph-EP5GL612.js +1 -0
  53. package/dist/assets/{psyche-metrics-page-CuR9oqEy.js → psyche-metrics-page-Bcu813Rg.js} +1 -1
  54. package/dist/assets/psyche-mode-guide-page-C0g27Xpt.js +1 -0
  55. package/dist/assets/psyche-modes-page-BjKjX5MR.js +1 -0
  56. package/dist/assets/psyche-page-F4tF2W70.js +1 -0
  57. package/dist/assets/psyche-patterns-page-B-14hukK.js +5 -0
  58. package/dist/assets/psyche-questionnaire-builder-page-BdXmoHvK.js +1 -0
  59. package/dist/assets/psyche-questionnaire-detail-page-Cu5uwlJu.js +1 -0
  60. package/dist/assets/psyche-questionnaire-run-detail-page-C3R4PClg.js +1 -0
  61. package/dist/assets/psyche-questionnaire-run-page-Div3iDdt.js +1 -0
  62. package/dist/assets/psyche-questionnaires-page-DpqAPQCp.js +1 -0
  63. package/dist/assets/psyche-report-detail-page-BvWVDKP3.js +3 -0
  64. package/dist/assets/psyche-reports-page-BrbWUlAq.js +1 -0
  65. package/dist/assets/{psyche-schemas-HFmg37Wj.js → psyche-schemas-Dxj554nU.js} +1 -1
  66. package/dist/assets/psyche-schemas-beliefs-page-DYKvAtSD.js +9 -0
  67. package/dist/assets/psyche-screen-time-page-CAOKCyQw.js +1 -0
  68. package/dist/assets/psyche-self-observation-page-F0MVA0UH.js +1 -0
  69. package/dist/assets/psyche-values-page-DyvX-d0o.js +5 -0
  70. package/dist/assets/report-chain-fields-CeC1cJFS.js +1 -0
  71. package/dist/assets/rewards-page-C2loyODo.js +1 -0
  72. package/dist/assets/scheduling-rules-editor-D40AC2jR.js +1 -0
  73. package/dist/assets/schema-badge-FY7818qB.js +1 -0
  74. package/dist/assets/schema-visuals-CvC9a3i6.js +1 -0
  75. package/dist/assets/select-menu-DJsCG6rM.js +1 -0
  76. package/dist/assets/settings-agents-page-BFkJ5AAD.js +6 -0
  77. package/dist/assets/settings-bin-page-D3-Ab-iA.js +1 -0
  78. package/dist/assets/settings-calendar-page-ly_mSTAD.js +5 -0
  79. package/dist/assets/settings-data-page-D7QOqNf-.js +1 -0
  80. package/dist/assets/settings-logs-page-Ca87HEUx.js +1 -0
  81. package/dist/assets/settings-mobile-page-D0jejZot.js +1 -0
  82. package/dist/assets/settings-models-page-DPDsZjSc.js +1 -0
  83. package/dist/assets/settings-page-1cArlSPM.js +1 -0
  84. package/dist/assets/settings-rewards-page-Db4BV1DC.js +1 -0
  85. package/dist/assets/{settings-section-nav-DSOuht_F.js → settings-section-nav-DP9o4peU.js} +1 -1
  86. package/dist/assets/settings-users-page-BHFyDSsd.js +1 -0
  87. package/dist/assets/settings-wiki-page-BNaiupBm.js +1 -0
  88. package/dist/assets/sleep-page-BmOPF0yD.js +1 -0
  89. package/dist/assets/sports-page-BldIiclr.js +1 -0
  90. package/dist/assets/{state-B-4sS1xO.js → state-vCcAT5Hq.js} +1 -1
  91. package/dist/assets/strategies-page-CaTN99qj.js +1 -0
  92. package/dist/assets/strategy-detail-page-DsgFTd-U.js +1 -0
  93. package/dist/assets/strategy-dialog-7X7peRzu.js +1 -0
  94. package/dist/assets/surface-CJI17F3n.js +1 -0
  95. package/dist/assets/{table-WfAPUppN.js → table-BNqMG3_S.js} +1 -1
  96. package/dist/assets/task-detail-page-M1sIIPA8.js +1 -0
  97. package/dist/assets/timebox-planning-dialog-ByojN0AN.js +1 -0
  98. package/dist/assets/today-page-BjDijtn8.js +1 -0
  99. package/dist/assets/training-load-page-BPRmaWmF.js +1 -0
  100. package/dist/assets/{ui-C13Nbgas.js → ui-C1iwpj2-.js} +4 -4
  101. package/dist/assets/use-psyche-focus-target-Ct-acS9G.js +1 -0
  102. package/dist/assets/vendor-Dnkkx2co.js +1067 -0
  103. package/dist/assets/{vitals-page-qre17Nw8.js → vitals-page-CE9zdGLF.js} +1 -1
  104. package/dist/assets/weekly-review-page-CzhTv90n.js +1 -0
  105. package/dist/assets/weight-loss-page-Bp_cIk78.js +5 -0
  106. package/dist/assets/wiki-article-markdown-Dok2uy2p.js +4 -0
  107. package/dist/assets/wiki-editor-page-BuW32Y3f.js +26 -0
  108. package/dist/assets/wiki-ingest-history-page-DZKSBNHV.js +1 -0
  109. package/dist/assets/wiki-ingest-modal-DyqBEZcC.js +1 -0
  110. package/dist/assets/wiki-page-DqxlbLKG.js +1 -0
  111. package/dist/assets/workbench-flow-page-C4nc9jUg.js +5 -0
  112. package/dist/assets/workbench-page-BnyR7SL0.js +1 -0
  113. package/dist/assets/workout-detail-page-DT-c5cHL.js +2 -0
  114. package/dist/index.html +9 -9
  115. package/dist/openclaw/local-runtime.js +41 -14
  116. package/dist/server/server/migrations/067_weight_loss_daily_active_overrides.sql +13 -0
  117. package/dist/server/server/src/app.js +125 -33
  118. package/dist/server/server/src/health-weight-loss.js +554 -77
  119. package/dist/server/server/src/health.js +12 -4
  120. package/dist/server/server/src/movement.js +84 -1
  121. package/dist/server/server/src/openapi.js +123 -18
  122. package/dist/server/server/src/repositories/model-settings.js +21 -12
  123. package/dist/server/server/src/repositories/settings.js +19 -5
  124. package/dist/server/src/components/ui/info-tooltip.js +6 -6
  125. package/dist/server/src/components/workbench-boxes/shared/generic-node-view.js +13 -5
  126. package/dist/server/src/lib/api.js +24 -5
  127. package/dist/server/src/lib/theme-system.js +8 -0
  128. package/openclaw.plugin.json +1 -1
  129. package/package.json +3 -3
  130. package/server/migrations/067_weight_loss_daily_active_overrides.sql +13 -0
  131. package/skills/forge-openclaw/SKILL.md +13 -0
  132. package/skills/forge-openclaw/entity_conversation_playbooks.md +7 -1
  133. package/dist/assets/activity-page-CpjuNSHw.js +0 -1
  134. package/dist/assets/ai-surface-workspace-DEAFZruS.js +0 -1
  135. package/dist/assets/atlas-panel-CdVNPotj.js +0 -1
  136. package/dist/assets/calendar-page-DNNt6lfz.js +0 -1
  137. package/dist/assets/calendar-rules-DNJFNsxi.js +0 -1
  138. package/dist/assets/calendar-week-toolbar-BbPwYeN0.js +0 -1
  139. package/dist/assets/companion-sync-lab-page-KxEDigM6.js +0 -1
  140. package/dist/assets/daily-metrics-dashboard-B3cqJgDt.js +0 -1
  141. package/dist/assets/entity-note-count-link-DrhjJZ4i.js +0 -1
  142. package/dist/assets/entity-notes-surface-CkcRsKJQ.js +0 -1
  143. package/dist/assets/execution-board-D07gOocB.js +0 -1
  144. package/dist/assets/faceted-token-search-BxRRcM3q.js +0 -1
  145. package/dist/assets/flagship-signal-deck-cmy82b8_.js +0 -1
  146. package/dist/assets/floating-action-menu-Fs_ZiUMo.js +0 -1
  147. package/dist/assets/goal-detail-page-CqLiNz4f.js +0 -1
  148. package/dist/assets/goals-page-BTk7mg_T.js +0 -1
  149. package/dist/assets/habits-page-BJxagdzx.js +0 -1
  150. package/dist/assets/index-CF4J4R9L.js +0 -19
  151. package/dist/assets/index-CZbuZQjw.css +0 -1
  152. package/dist/assets/insight-flow-dialog-8f3D0GuC.js +0 -1
  153. package/dist/assets/insights-page-D6rOa7uk.js +0 -8
  154. package/dist/assets/kanban-page-XQ7Se6dH.js +0 -1
  155. package/dist/assets/knowledge-graph-page-BtAg8iv3.js +0 -1
  156. package/dist/assets/life-force-workspace-OfyB9HJM.js +0 -1
  157. package/dist/assets/metric-tile-DKpo-8xw.js +0 -1
  158. package/dist/assets/movement-page-Bg_T_Stx.js +0 -1
  159. package/dist/assets/note-markdown-N-uxD3Xt.js +0 -3
  160. package/dist/assets/note-tags-input-Cdu7wiw6.js +0 -1
  161. package/dist/assets/notes-page-CKXnF_KU.js +0 -1
  162. package/dist/assets/orbit-map-Dzi6KliQ.js +0 -1
  163. package/dist/assets/overview-page-1miYqaVS.js +0 -1
  164. package/dist/assets/page-hero-DRy5b2MU.js +0 -1
  165. package/dist/assets/pill-cluster-C9QczVJ2.js +0 -1
  166. package/dist/assets/preferences-page-DtNaF5Q3.js +0 -1
  167. package/dist/assets/project-collections-xPz2mlRr.js +0 -1
  168. package/dist/assets/project-management-hierarchy-page-DtRpMABw.js +0 -1
  169. package/dist/assets/project-management-section-nav-P3ixzPa-.js +0 -1
  170. package/dist/assets/projects-page-C5ViRuf4.js +0 -1
  171. package/dist/assets/psyche-behaviors-page-Dco46sC4.js +0 -5
  172. package/dist/assets/psyche-flashcards-page-ZcoEB8gV.js +0 -1
  173. package/dist/assets/psyche-goal-map-page-CLBAQOI0.js +0 -1
  174. package/dist/assets/psyche-graph-k4tX2tdp.js +0 -1
  175. package/dist/assets/psyche-mode-guide-page-hIVXcCnE.js +0 -1
  176. package/dist/assets/psyche-modes-page-0lYtBlhO.js +0 -1
  177. package/dist/assets/psyche-page-VZ9k9ISp.js +0 -1
  178. package/dist/assets/psyche-patterns-page-gx5nmdGq.js +0 -5
  179. package/dist/assets/psyche-questionnaire-builder-page-Bn0TOISd.js +0 -1
  180. package/dist/assets/psyche-questionnaire-detail-page-CmVzSd_s.js +0 -1
  181. package/dist/assets/psyche-questionnaire-run-detail-page-BsMbmXCG.js +0 -1
  182. package/dist/assets/psyche-questionnaire-run-page-CgkRL2vi.js +0 -1
  183. package/dist/assets/psyche-questionnaires-page-D7V8uLXM.js +0 -1
  184. package/dist/assets/psyche-report-detail-page-OlFq57eL.js +0 -3
  185. package/dist/assets/psyche-reports-page-dVUZjna1.js +0 -1
  186. package/dist/assets/psyche-schemas-beliefs-page-BCgc8FUd.js +0 -9
  187. package/dist/assets/psyche-screen-time-page-B_6BT_WN.js +0 -1
  188. package/dist/assets/psyche-self-observation-page-CEG5mluK.js +0 -1
  189. package/dist/assets/psyche-values-page-DRbRfEd6.js +0 -5
  190. package/dist/assets/report-chain-fields-CALCV3V5.js +0 -1
  191. package/dist/assets/rewards-page-DmC4R_Ps.js +0 -1
  192. package/dist/assets/scheduling-rules-editor-D02s70hr.js +0 -1
  193. package/dist/assets/schema-badge-BZO-qNhO.js +0 -1
  194. package/dist/assets/schema-visuals-D6nxjbYC.js +0 -1
  195. package/dist/assets/select-menu-fYyreSdQ.js +0 -1
  196. package/dist/assets/settings-agents-page-C_v_hMJF.js +0 -6
  197. package/dist/assets/settings-bin-page-DY5bg81n.js +0 -1
  198. package/dist/assets/settings-calendar-page-D1CzE6cg.js +0 -5
  199. package/dist/assets/settings-data-page-CHRQFU9H.js +0 -1
  200. package/dist/assets/settings-logs-page-B04pUwEv.js +0 -1
  201. package/dist/assets/settings-mobile-page-D9kTlYDS.js +0 -1
  202. package/dist/assets/settings-models-page-D26270R2.js +0 -1
  203. package/dist/assets/settings-page-DYDTFlnv.js +0 -1
  204. package/dist/assets/settings-rewards-page-cl4vqqO_.js +0 -1
  205. package/dist/assets/settings-users-page-BU79JB_T.js +0 -1
  206. package/dist/assets/settings-wiki-page-DwAUlyA3.js +0 -1
  207. package/dist/assets/sleep-page-D8NbdhyS.js +0 -1
  208. package/dist/assets/sports-page-CV4Cnzwn.js +0 -1
  209. package/dist/assets/strategies-page-C4qvXnql.js +0 -1
  210. package/dist/assets/strategy-detail-page-DJLo5rfy.js +0 -1
  211. package/dist/assets/strategy-dialog-D3AuUlVz.js +0 -1
  212. package/dist/assets/task-detail-page-z-9u9rF0.js +0 -1
  213. package/dist/assets/timebox-planning-dialog-DB6FLqmI.js +0 -1
  214. package/dist/assets/today-page-BKlu6gx5.js +0 -1
  215. package/dist/assets/training-load-page-CyJQqo_3.js +0 -1
  216. package/dist/assets/use-psyche-focus-target-C1C_XjYG.js +0 -1
  217. package/dist/assets/vendor-DHkYh85p.js +0 -1052
  218. package/dist/assets/weekly-review-page-Cz4vkRcx.js +0 -1
  219. package/dist/assets/weight-loss-page-BQrnOI0y.js +0 -1
  220. package/dist/assets/wiki-article-markdown-DdiR2TJE.js +0 -4
  221. package/dist/assets/wiki-editor-page-DqwoqVFb.js +0 -26
  222. package/dist/assets/wiki-ingest-history-page--evBLbOw.js +0 -1
  223. package/dist/assets/wiki-ingest-modal--ohzFnj2.js +0 -1
  224. package/dist/assets/wiki-page-B_VJFBPA.js +0 -1
  225. package/dist/assets/workbench-flow-page-Du62mtJU.js +0 -5
  226. package/dist/assets/workbench-page-4MKr3iRm.js +0 -1
  227. package/dist/assets/workout-detail-page-DfUbYYw1.js +0 -2
@@ -1 +0,0 @@
1
- import{r as w,j as t,aF as ae,ds as re,aI as Y,aG as X,dt as q,b3 as se,bl as oe}from"./vendor-DHkYh85p.js";import{j as ne,i as ie,k as le}from"./state-B-4sS1xO.js";import{u as ce,ey as de,aF as ue,bE as me,dt as he,ez as pe,E as ke,a8 as ge,B as v,eA as S,c as A,C as G,Z as T,W as Q,eB as fe}from"./index-CF4J4R9L.js";import{P as ye}from"./page-hero-DRy5b2MU.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const H=[{id:"xp_levels",label:"XP and level",trophyCount:8,unlockCount:4},{id:"streaks",label:"Streak and comeback",trophyCount:14,unlockCount:10},{id:"tasks",label:"Tasks and focus runs",trophyCount:14,unlockCount:4},{id:"projects",label:"Projects, goals, and strategy",trophyCount:14,unlockCount:4},{id:"wiki",label:"Wiki, notes, and knowledge graph",trophyCount:16,unlockCount:6},{id:"psyche",label:"Psyche",trophyCount:18,unlockCount:10},{id:"habits",label:"Habits, Life Force, and health",trophyCount:8,unlockCount:8},{id:"agents",label:"Agents and collaboration",trophyCount:4,unlockCount:2}],Ce=[1,2,3,5,7,14,21,30,45,60,90,180,365,730],be=[1,2,3,5,7,10,14,21,30,60];function e(r,l){return{metric:r,threshold:l}}function n(...r){return{allOf:r}}function I(r){return r.toLowerCase().replace(/['’]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function xe(r,l){const u=(r+1)/l;return u>.82?"platinum":u>.55?"gold":u>.25?"silver":"bronze"}function we(r){return r==="platinum"?"legendary":r==="gold"?"hard":r==="silver"?"standard":"intro"}function ve(r){return r==="platinum"?"legendary":r==="gold"?"epic":r==="silver"?"rare":"common"}function Se(r){return`item-${r.kind}-${I(r.category)}-${I(r.title)}`}function a(r,l,u,d,i,m){return{category:r,kind:"trophy",title:l,summary:i,requirement:u,requirementText:d,reward:`${l} trophy on the Forge shelf`}}function o(r,l,u,d,i,m,p){return{category:r,kind:"unlock",title:l,summary:m,requirement:d,requirementText:i,reward:`${l} cosmetic`,unlockType:u,rewardPayload:p}}const je=[a("xp_levels","The First Heat",e("nonManualXp",5e3),"Earn 5,000 non-manual XP.","The first real furnace of work is hot enough to be noticed."),a("xp_levels","Bellows Graduate",e("nonManualXp",1e4),"Earn 10,000 non-manual XP.","Your reward ledger is no longer a spark; it is a system."),a("xp_levels","Iron Apprentice",e("nonManualXp",2e4),"Earn 20,000 non-manual XP.","You have repeated the work enough that the anvil knows your hand."),a("xp_levels","Steel Temper",e("nonManualXp",5e4),"Earn 50,000 non-manual XP.","Pressure has started to make the metal cleaner instead of louder."),a("xp_levels","Crown of Coals",e("nonManualXp",1e5),"Earn 100,000 non-manual XP.","A visible crown for an invisible mountain of completed work."),a("xp_levels","Obsidian Master",e("nonManualXp",25e4),"Earn 250,000 non-manual XP.","The Forge Smith stops testing your seriousness and starts respecting it."),a("xp_levels","Star-Forge Adept",e("nonManualXp",5e5),"Earn 500,000 non-manual XP.","Your XP trail burns like a constellation across the operating system."),a("xp_levels","Mythic Smith",e("nonManualXp",1e6),"Earn 1,000,000 non-manual XP.","A ridiculous trophy for a ridiculous amount of lived execution.")],Ae=[o("xp_levels","Obsidian Smith","mascot_skin",e("nonManualXp",8e3),"Earn 8,000 non-manual XP.","A dramatic black-iron Forge Smith skin.",{mascotSkin:"obsidian-smith"}),o("xp_levels","Molten Progress Bar","hud_treatment",e("nonManualXp",25e3),"Earn 25,000 non-manual XP.","A bright molten XP fill for the level ring.",{hudTreatment:"molten-progress"}),o("xp_levels","Apex Level Frame","icon_frame",e("nonManualXp",1e5),"Earn 100,000 non-manual XP.","A high-tier frame for level and trophy icons.",{iconFrame:"apex-level"}),o("xp_levels","Masterwork Glow","celebration_variant",e("nonManualXp",25e4),"Earn 250,000 non-manual XP.","A stronger forge-bell reveal for major unlocks.",{celebrationVariant:"masterwork-glow"})],Te=[a("streaks","Spark Kept",e("longestStreakDays",1),"Play one qualifying day.","The first day is small, but the forge heard it."),a("streaks","Three-Day Furnace",e("longestStreakDays",3),"Reach a 3-day streak.","Three returns make the first shape of discipline."),a("streaks","Week-Fire",e("longestStreakDays",7),"Reach a 7-day streak.","Seven days changes the temperature of your life."),a("streaks","Twin-Week Bellows",e("longestStreakDays",14),"Reach a 14-day streak.","Two weeks of showing up makes the room expect you."),a("streaks","Cinder Discipline",e("longestStreakDays",21),"Reach a 21-day streak.","The fire is not accidental anymore."),a("streaks","Monthly Forge",e("longestStreakDays",30),"Reach a 30-day streak.","A full month of returns becomes a personal weather system."),a("streaks","Sixty-Day Flame",e("longestStreakDays",60),"Reach a 60-day streak.","The Smith grows stronger because you stopped disappearing."),a("streaks","Quarter-Anvil",e("longestStreakDays",90),"Reach a 90-day streak.","Ninety days is not motivation. It is architecture."),a("streaks","Half-Year Inferno",e("longestStreakDays",180),"Reach a 180-day streak.","The forge is now a season of your life."),a("streaks","Year of Steel",e("longestStreakDays",365),"Reach a 365-day streak.","A year of returns. The anvil has become a witness."),a("streaks","Comeback Hammer",e("comebackAfter7Count",1),"Return after 7+ missed days and complete a qualifying action.","You came back after the room went cold."),a("streaks","Repair Artist",e("comebackAfter7Count",3),"Complete 3 major comebacks.","Breaking the chain did not become breaking the story."),a("streaks","Rust Refuser",n(e("comebackAfter7Count",5),e("longestStreakDays",30)),"Complete 5 major comebacks and reach a 30-day streak.","You repeatedly turned absence into a new strike."),a("streaks","Relentless Return",n(e("comebackAfter7Count",8),e("longestStreakDays",90)),"Complete 8 major comebacks and reach a 90-day streak.","This trophy is for the part of you that keeps coming back.")],_e=[o("streaks","Bronze Ember Flame","streak_effect",e("longestStreakDays",3),"Reach a 3-day streak.","A small ember around the streak HUD.",{streakEffect:"bronze-ember"}),o("streaks","Blue Forge-Fire","streak_effect",e("longestStreakDays",7),"Reach a 7-day streak.","A cool blue streak flame.",{streakEffect:"blue-forge-fire"}),o("streaks","Violet Arc Flame","streak_effect",e("longestStreakDays",21),"Reach a 21-day streak.","A sharper violet flame effect.",{streakEffect:"violet-arc"}),o("streaks","Molten Crown Fire","streak_effect",e("longestStreakDays",60),"Reach a 60-day streak.","A crown-like fire treatment for streaks.",{streakEffect:"molten-crown"}),o("streaks","Stern Pressure Pose","mascot_pose",e("comebackAfter7Count",1),"Complete a major comeback.","Unlocks the Smith's stern pressure pose.",{mascotPose:"stern-pressure"}),o("streaks","Comeback Pose","mascot_pose",e("comebackAfter7Count",2),"Complete 2 major comebacks.","Unlocks the Smith's comeback repair pose.",{mascotPose:"comeback"}),o("streaks","Awakening Forge Pose","mascot_pose",e("longestStreakDays",30),"Reach a 30-day streak.","Unlocks the forge awakening mascot pose.",{mascotPose:"awakening-forge"}),o("streaks","Yearfire Aura","streak_effect",e("longestStreakDays",365),"Reach a 365-day streak.","A huge aura for year-scale presence.",{streakEffect:"yearfire-aura"}),o("streaks","Old Foundry Shelf","trophy_shelf",e("longestStreakDays",90),"Reach a 90-day streak.","A warmer trophy shelf skin.",{trophyShelf:"old-foundry"}),o("streaks","Relentless Bell","celebration_variant",e("longestStreakDays",180),"Reach a 180-day streak.","A heavier celebration sound-and-spark treatment.",{celebrationVariant:"relentless-bell"})],Ne=[a("tasks","First Strike",e("taskCompletionCount",25),"Complete 25 tasks.","A real task trail begins."),a("tasks","Clean Swing",n(e("taskCompletionCount",50),e("focusRunCount",10)),"Complete 50 tasks and 10 task runs.","Tasks and time-tracked execution start to converge."),a("tasks","Five Rivets",n(e("taskCompletionCount",75),e("taskCloseoutReportCount",5)),"Complete 75 tasks and 5 completion reports.","You are leaving proof behind, not just checkmarks."),a("tasks","Task Blade",n(e("taskCompletionCount",120),e("focusRunCount",25)),"Complete 120 tasks and 25 task runs.","A sharp blade forged out of repeated finishes."),a("tasks","Anvil Marathon",n(e("taskCompletionCount",300),e("focusRunCount",75)),"Complete 300 tasks and 75 task runs.","The long road achievement for serious execution."),a("tasks","Deep-Work Maul",e("creditedFocusMinutes",3e3),"Log 3,000 credited focus minutes.","The heavy hammer of deliberate time."),a("tasks","Planned Heat",e("plannedFocusRunCount",25),"Complete 25 planned task runs.","You planned the heat before striking the metal."),a("tasks","Closeout Scribe",e("taskCloseoutReportCount",25),"Write 25 task completion reports.","The Forge remembers what changed because you wrote it down."),a("tasks","Hundred-Hammer Road",e("taskCompletionCount",500),"Complete 500 tasks.","A road paved with finished work."),a("tasks","Timebox Knight",n(e("plannedFocusRunCount",75),e("creditedFocusMinutes",7500)),"Complete 75 planned runs and 7,500 focus minutes.","A trophy for time that obeyed the mission."),a("tasks","Backlog Breaker",e("taskCompletionCount",750),"Complete 750 tasks.","The backlog learned to fear your return."),a("tasks","Execution Monarch",n(e("taskCompletionCount",1e3),e("focusRunCount",200)),"Complete 1,000 tasks and 200 task runs.","A crown for turning vague intention into finished artifacts."),a("tasks","Forge Ledger Exact",e("taskCloseoutReportCount",100),"Write 100 task completion reports.","The most boring discipline becomes the most useful history."),a("tasks","The Hammer Does Not Blink",n(e("taskCompletionCount",1500),e("creditedFocusMinutes",15e3)),"Complete 1,500 tasks and 15,000 focus minutes.","For absurd consistency under real load.")],Pe=[o("tasks","Hammer Cursor","icon_frame",e("taskCompletionCount",75),"Complete 75 tasks.","A hammer-shaped action accent.",{iconFrame:"hammer-cursor"}),o("tasks","Focus Rail Glow","hud_treatment",e("focusRunCount",25),"Complete 25 task runs.","A task-run glow for compact HUDs.",{hudTreatment:"focus-rail-glow"}),o("tasks","Completion Burst","celebration_variant",e("taskCloseoutReportCount",25),"Write 25 completion reports.","A sharper task-completion burst.",{celebrationVariant:"completion-burst"}),o("tasks","Ember Knight","mascot_skin",e("taskCompletionCount",500),"Complete 500 tasks.","A molten-armored Forge Smith skin for execution mastery.",{mascotSkin:"ember-knight"})],Re=[a("projects","Aligned Spark",e("goalLinkedTaskCompletionCount",25),"Complete 25 goal-linked tasks.","Work starts pointing at something bigger."),a("projects","Goal Rivet",n(e("goalLinkedTaskCompletionCount",50),e("distinctGoalsWithCompletions",3)),"Complete 50 goal-linked tasks across 3 goals.","Several goals now have real rivets, not just titles."),a("projects","Strategist's Seal",n(e("goalLinkedTaskCompletionCount",50),e("distinctGoalsWithCompletions",5)),"Complete 50 goal-linked tasks across 5 goals.","A seal for strategy that survived contact with execution."),a("projects","Project Spine",n(e("projectLinkedTaskCompletionCount",100),e("activeProjectCount",5)),"Complete 100 project-linked tasks while maintaining 5 active projects.","The work has a spine across multiple initiatives."),a("projects","Strategy Weld",e("strategyCount",10),"Create 10 strategies.","You forged planning layers instead of improvising every day."),a("projects","Purpose Hammer",e("goalLinkedTaskCompletionCount",150),"Complete 150 goal-linked tasks.","The hammer keeps landing where your stated life points."),a("projects","Arc Builder",n(e("projectLinkedTaskCompletionCount",250),e("distinctGoalsWithCompletions",8)),"Complete 250 project-linked tasks across 8 goals.","Multiple arcs moved because you kept building."),a("projects","North-Star Foundry",n(e("goalLinkedTaskCompletionCount",300),e("strategyCount",20)),"Complete 300 goal-linked tasks and create 20 strategies.","The north star is no longer decorative."),a("projects","Project Finisher",e("projectCompletionCount",5),"Complete 5 projects.","Finished projects leave heavier evidence than active dreams."),a("projects","Life-Work Crown",n(e("projectCompletionCount",10),e("goalLinkedTaskCompletionCount",500)),"Complete 10 projects and 500 goal-linked tasks.","A crown for long arcs that actually closed."),a("projects","Portfolio Anvil",e("activeProjectCount",12),"Maintain 12 active projects.","A large operating portfolio, held without flattening."),a("projects","Tracer Bullet Guild",n(e("projectCompletionCount",15),e("strategyCount",35)),"Complete 15 projects and create 35 strategies.","Strategy and delivery joined hands repeatedly."),a("projects","Mountain Moved",e("goalLinkedTaskCompletionCount",1e3),"Complete 1,000 goal-linked tasks.","The trophy for moving a mountain one task at a time."),a("projects","The Work Had A Spine",n(e("projectCompletionCount",25),e("distinctGoalsWithCompletions",12)),"Complete 25 projects across 12 goals.","Your life map became execution history.")],Fe=[o("projects","Goal Compass Frame","icon_frame",e("goalLinkedTaskCompletionCount",50),"Complete 50 goal-linked tasks.","A compass frame for aligned-work trophies.",{iconFrame:"goal-compass"}),o("projects","War-Room Iron Shelf","trophy_shelf",e("projectLinkedTaskCompletionCount",150),"Complete 150 project-linked tasks.","A darker tactical trophy shelf.",{trophyShelf:"war-room-iron"}),o("projects","North-Star HUD","hud_treatment",e("strategyCount",20),"Create 20 strategies.","A strategy-forward HUD treatment.",{hudTreatment:"north-star"}),o("projects","Foundry Compass Burst","celebration_variant",e("projectCompletionCount",10),"Complete 10 projects.","A compass-shaped major reveal.",{celebrationVariant:"foundry-compass"})],Ee=[a("wiki","First Inscription",e("wikiPageCount",50),"Create 50 wiki pages.","Knowledge has started to become an archive."),a("wiki","Memory Rivet",e("noteCount",100),"Create 100 notes.","The system remembers because you gave it material."),a("wiki","Archive Ember",n(e("wikiPageCount",150),e("wikiLinkCount",50)),"Create 150 wiki pages and 50 wiki links.","The archive starts connecting to itself."),a("wiki","Knowledge Anvil",n(e("wikiPageCount",250),e("wikiLinkCount",150)),"Create 250 wiki pages and 150 wiki links.","A serious anvil of memory and links."),a("wiki","Living Index",n(e("wikiPageWithSummaryCount",100),e("linkedWikiPageCount",100)),"Maintain 100 wiki pages with summaries and linked entities.","Pages now carry shape, summary, and relationships."),a("wiki","Black Library",n(e("wikiPageCount",500),e("wikiLinkCount",300)),"Create 500 wiki pages and 300 wiki links.","The great hard knowledge trophy."),a("wiki","Obsidian Index",n(e("wikiPageWithSummaryCount",250),e("wikiLinkCount",500)),"Maintain 250 summarized pages and 500 links.","The archive is no longer just big; it is navigable."),a("wiki","Graph Lantern",e("knowledgeGraphNodeCount",500),"Reach 500 Knowledge Graph nodes.","The graph has enough stars to navigate by."),a("wiki","Entity Weaver",e("linkedWikiPageCount",200),"Link 200 wiki pages to other pages or entities.","Your memory connects to the operating system."),a("wiki","Codex Temper",n(e("wikiPageCount",750),e("wikiLinkCount",750)),"Create 750 wiki pages and 750 wiki links.","A codex tempered by breadth and connection."),a("wiki","Note Furnace",e("noteCount",500),"Create 500 notes.","Raw notes became a real furnace of evidence."),a("wiki","Archive Cartographer",n(e("wikiPageWithSummaryCount",400),e("linkedWikiPageCount",300)),"Maintain 400 summarized pages and 300 linked pages.","You mapped the archive enough that it can map you back."),a("wiki","The Shelf Breathes",e("knowledgeGraphNodeCount",1e3),"Reach 1,000 Knowledge Graph nodes.","The knowledge system feels alive at a glance."),a("wiki","Librarian of Coals",n(e("noteCount",1e3),e("wikiLinkCount",1e3)),"Create 1,000 notes and 1,000 wiki links.","A trophy for the long, quiet archive discipline."),a("wiki","Living Codex",n(e("wikiPageCount",1500),e("wikiPageWithSummaryCount",750),e("wikiLinkCount",1500)),"Create 1,500 pages, 750 summarized pages, and 1,500 links.","The living memory crown."),a("wiki","Memory Starfield",e("knowledgeGraphNodeCount",2e3),"Reach 2,000 Knowledge Graph nodes.","The graph becomes a sky.")],Ie=[o("wiki","Quiet Library Shelf","trophy_shelf",e("wikiPageCount",150),"Create 150 wiki pages.","A quiet library shelf skin.",{trophyShelf:"quiet-library"}),o("wiki","Rune Page Frame","icon_frame",e("wikiLinkCount",150),"Create 150 wiki links.","A runic frame for knowledge trophies.",{iconFrame:"rune-page"}),o("wiki","Scholar Glass HUD","hud_treatment",e("wikiPageWithSummaryCount",100),"Maintain 100 summarized wiki pages.","A glassy scholar HUD treatment.",{hudTreatment:"scholar-glass"}),o("wiki","Archive Sparks","celebration_variant",e("linkedWikiPageCount",200),"Link 200 wiki pages to other pages or entities.","A page-flare reveal variant.",{celebrationVariant:"archive-sparks"}),o("wiki","Astral Archive Shelf","trophy_shelf",e("knowledgeGraphNodeCount",1e3),"Reach 1,000 Knowledge Graph nodes.","A cosmic trophy shelf for memory work.",{trophyShelf:"astral-archive"}),o("wiki","Reading Smith Pose","mascot_pose",e("wikiPageWithSummaryCount",250),"Maintain 250 summarized wiki pages.","Unlocks the Forge Smith reading pose.",{mascotPose:"reading"})],Me=[a("psyche","Named Spark",e("psycheValueCount",5),"Create 5 Psyche values.","You named the values the forge should obey."),a("psyche","Pattern Tongs",e("behaviorPatternCount",5),"Create 5 behavior patterns.","The recurring loops are now held with tongs."),a("psyche","Belief Crucible",e("beliefEntryCount",5),"Create 5 belief entries.","Beliefs entered the fire where they can be worked."),a("psyche","Mode Lantern",e("modeProfileCount",3),"Create 3 mode profiles.","The inner cast has names and lantern light."),a("psyche","Trigger Witness",e("triggerReportCount",3),"Create 3 trigger reports.","You turned moments of activation into evidence."),a("psyche","Mode Cartographer",n(e("modeProfileCount",8),e("linkedModeProfileCount",8)),"Create 8 mode profiles, each linked to a value, behavior, or pattern.","A map of modes, not a pile of labels."),a("psyche","Trigger Alchemist",n(e("triggerReportRichCount",30),e("triggerReportCompletedCount",20)),"Complete 30 rich trigger reports and mark 20 reports beyond draft.","Activation was turned into material for change."),a("psyche","Pattern Breaker",n(e("behaviorPatternCount",20),e("behaviorPatternWithReplacementCount",10)),"Create 20 patterns and link 10 to replacement responses.","The old loops now have counter-moves."),a("psyche","Belief Temperer",n(e("beliefEntryCount",25),e("beliefFlexibleAlternativeCount",25)),"Create 25 beliefs with flexible alternatives.","Rigid beliefs were heated until they could bend."),a("psyche","Value Blade",n(e("psycheValueCount",10),e("goalLinkedTaskCompletionCount",100)),"Create 10 values and complete 100 goal-linked tasks.","Values and work started cutting in the same direction."),a("psyche","Shadow Temper",n(e("modeProfileCount",12),e("triggerReportRichCount",50)),"Create 12 modes and 50 rich trigger reports.","Shadow material became usable steel."),a("psyche","Inner Forge",n(e("psycheValueCount",12),e("behaviorPatternCount",25),e("beliefFlexibleAlternativeCount",30)),"Create 12 values, 25 patterns, and 30 flexible beliefs.","A full inner forge takes shape."),a("psyche","Schema Bell",e("questionnaireRunCount",40),"Complete 40 questionnaire runs.","Structured self-observation rang the bell repeatedly."),a("psyche","Mode Guide",e("modeGuideSessionCount",5),"Complete 5 mode guide sessions.","Guided mode work became an actual practice."),a("psyche","Repair Script",e("behaviorCount",10),"Create 10 Psyche behaviors.","Behaviors now carry repair plans, not just names."),a("psyche","Flexible Self",e("beliefFlexibleAlternativeCount",50),"Create 50 beliefs with flexible alternatives.","A trophy for not letting old beliefs remain iron cages."),a("psyche","Trigger Cartography",e("triggerReportRichCount",100),"Create 100 rich trigger reports.","The map of activation became detailed enough to steer by."),a("psyche","The Inner Council",n(e("modeProfileCount",20),e("behaviorCount",20),e("beliefFlexibleAlternativeCount",75)),"Create 20 modes, 20 behaviors, and 75 flexible beliefs.","The inner system became a council instead of noise.")],Ke=[o("psyche","Scholar Smith","mascot_skin",e("psycheValueCount",7),"Create 7 Psyche values.","A wise, bookish Forge Smith skin.",{mascotSkin:"scholar-smith"}),o("psyche","Wise Smith Pose","mascot_pose",e("modeProfileCount",3),"Create 3 mode profiles.","Unlocks the wise mentor pose.",{mascotPose:"wise"}),o("psyche","Reflection Frame","icon_frame",e("beliefEntryCount",10),"Create 10 belief entries.","A reflective frame for Psyche trophies.",{iconFrame:"reflection"}),o("psyche","Mode Lens HUD","hud_treatment",e("modeProfileCount",8),"Create 8 mode profiles.","A HUD tuned to Psyche work.",{hudTreatment:"mode-lens"}),o("psyche","Shadow Smith","mascot_skin",e("triggerReportRichCount",25),"Create 25 rich trigger reports.","A darker Smith skin for shadow work.",{mascotSkin:"shadow-smith"}),o("psyche","Arcane Metallurgist","mascot_skin",e("beliefFlexibleAlternativeCount",25),"Create 25 beliefs with flexible alternatives.","A rune-lit Smith skin for deep reflection.",{mascotSkin:"arcane-metallurgist"}),o("psyche","Inner-Fire Halo","streak_effect",e("psycheValueCount",10),"Create 10 Psyche values.","A halo-like flame for reflective momentum.",{streakEffect:"inner-fire-halo"}),o("psyche","Mode Lantern Reveal","celebration_variant",e("modeProfileCount",12),"Create 12 mode profiles.","A lantern reveal for Psyche unlocks.",{celebrationVariant:"mode-lantern"}),o("psyche","Therapist's Shelf","trophy_shelf",e("triggerReportRichCount",50),"Create 50 rich trigger reports.","A quiet shelf for inner-work trophies.",{trophyShelf:"therapist-shelf"}),o("psyche","Prismatic Crucible","celebration_variant",e("beliefFlexibleAlternativeCount",50),"Create 50 flexible belief alternatives.","A prismatic reveal for belief work.",{celebrationVariant:"prismatic-crucible"})],Le=[a("habits","Ritual Spark",e("habitAlignedCount",25),"Record 25 aligned habit check-ins.","Your recurring commitments have started to leave marks."),a("habits","Routine Rivet",e("habitAlignedCount",75),"Record 75 aligned habit check-ins.","The habit rail is no longer decorative."),a("habits","Habit Heat",n(e("habitAlignedCount",150),e("habitStreakMax",14)),"Record 150 aligned check-ins and a 14-day habit streak.","One behavior got hot enough to shape you."),a("habits","Ritual Iron",e("habitAlignedCount",365),"Record 365 aligned habit check-ins.","The hard habit trophy."),a("habits","Recovery Shield",e("recoveryEventCount",50),"Earn 50 recovery rewards.","Recovery was treated as part of the work."),a("habits","Life-Force Alloy",e("lifeForceSnapshotCount",100),"Record 100 Life Force day snapshots.","Energy accounting became a usable alloy."),a("habits","Sleep Temper",e("healthSleepSessionCount",120),"Import 120 sleep sessions.","Sleep became evidence, not a guess."),a("habits","Vitality Forge",n(e("workoutSessionCount",100),e("healthSleepSessionCount",200)),"Import 100 workouts and 200 sleep sessions.","Body data and execution entered the same forge.")],Ge=[o("habits","Recovery Blue Flame","streak_effect",e("recoveryEventCount",20),"Earn 20 recovery rewards.","A cooler recovery flame.",{streakEffect:"recovery-blue"}),o("habits","Ritual Check Glow","hud_treatment",e("habitAlignedCount",75),"Record 75 aligned habit check-ins.","A habit-check glow for the HUD.",{hudTreatment:"ritual-check"}),o("habits","Storm Forger","mascot_skin",e("workoutSessionCount",50),"Import 50 workouts.","A storm-lit Smith skin for movement arcs.",{mascotSkin:"storm-forger"}),o("habits","Clockwork Smith","mascot_skin",e("habitAlignedCount",150),"Record 150 aligned habit check-ins.","A clockwork skin for ritual precision.",{mascotSkin:"clockwork-smith"}),o("habits","Vital Flame","streak_effect",e("healthSleepSessionCount",90),"Import 90 sleep sessions.","A vital-sign flame around streak indicators.",{streakEffect:"vital-flame"}),o("habits","Life-Force Frame","icon_frame",e("lifeForceSnapshotCount",100),"Record 100 Life Force snapshots.","An AP-inspired frame for body trophies.",{iconFrame:"life-force"}),o("habits","Steady-State Aura","streak_effect",e("habitStreakMax",60),"Reach a 60-day habit streak.","An aura for long stable rituals.",{streakEffect:"steady-state"}),o("habits","Celestial Smith","mascot_skin",n(e("workoutSessionCount",100),e("healthSleepSessionCount",200)),"Import 100 workouts and 200 sleep sessions.","A celestial skin for body stewardship.",{mascotSkin:"celestial-smith"})],Oe=[a("agents","Companion Spark",e("agentActionCount",5),"Record 5 agent actions.","The first sign of a working human-agent council."),a("agents","Bot Bellows",e("agentCompletedActionCount",20),"Complete 20 agent actions.","Agents are not just present; they are moving work."),a("agents","Council Spark",e("collaborationRewardCount",50),"Earn 50 collaboration rewards.","The collaboration trophy for meaningful assisted work."),a("agents","Guild Forge",n(e("agentCompletedActionCount",100),e("collaborationRewardCount",100)),"Complete 100 agent actions and earn 100 collaboration rewards.","The Forge has become a small guild.")],De=[o("agents","Guild Badge Frame","icon_frame",e("agentCompletedActionCount",20),"Complete 20 agent actions.","A guild frame for agent trophies.",{iconFrame:"guild-badge"}),o("agents","Council Sparks Reveal","celebration_variant",e("collaborationRewardCount",50),"Earn 50 collaboration rewards.","A council-sparks reveal for collaboration.",{celebrationVariant:"council-sparks"})],He=[...je,...Ae,...Te,..._e,...Ne,...Pe,...Re,...Fe,...Ee,...Ie,...Me,...Ke,...Le,...Ge,...Oe,...De];function ze(){let r=0,l=0,u=0;const d=new Map;return He.map(i=>{const m=H.find(M=>M.id===i.category);if(!m)throw new Error(`Unknown gamification category ${i.category}`);const p=d.get(i.category)??{trophy:0,unlock:0},b=p[i.kind];p[i.kind]+=1,d.set(i.category,p);const _=i.kind==="trophy"?m.trophyCount:m.unlockCount,C=xe(b,_),N=`${i.kind}-${I(i.category)}-${I(i.title)}`,x=i.kind==="trophy"?l++:u++;return{id:N,kind:i.kind,category:i.category,tier:C,difficulty:we(C),hidden:i.hidden??!1,title:i.title,summary:i.summary,requirement:i.requirement,requirementText:i.requirementText,reward:i.reward,unlockType:i.kind==="unlock"?i.unlockType??"icon_frame":null,rewardPayload:i.kind==="unlock"?i.rewardPayload??{}:{trophyId:N},assetKey:Se(i),sheetKey:`${i.kind==="trophy"?"trophies":"unlocks"}-r${Math.floor(x/10)+1}-c${x%10+1}`,rarity:ve(C),sortOrder:r++}})}const y=ze();function We(){if(y.length!==144)throw new Error(`GAMIFICATION_CATALOG must contain exactly 144 items; found ${y.length}.`);const r=y.filter(d=>d.kind==="trophy").length,l=y.filter(d=>d.kind==="unlock").length;if(r!==96||l!==48)throw new Error(`GAMIFICATION_CATALOG must contain 96 trophies and 48 unlocks; found ${r}/${l}.`);for(const d of H){const i=y.filter(p=>p.category===d.id&&p.kind==="trophy").length,m=y.filter(p=>p.category===d.id&&p.kind==="unlock").length;if(i!==d.trophyCount||m!==d.unlockCount)throw new Error(`${d.id} expected ${d.trophyCount}/${d.unlockCount}, found ${i}/${m}.`)}if(new Set(y.map(d=>d.assetKey)).size!==y.length)throw new Error("Every trophy and unlock must have a unique asset key.")}We();const V=H.map(r=>({id:r.id,label:r.label})),$e=Array.from({length:30},(r,l)=>`mascot-state-${String(l+1).padStart(3,"0")}`),Be=Ce.map((r,l)=>[r,`mascot-state-${String(17+l).padStart(3,"0")}`]),Ue=be.map((r,l)=>[r,`mascot-state-${String(10-l).padStart(3,"0")}`]),O=$e;if(O.length!==30)throw new Error(`GAMIFICATION_MASCOT_KEYS must contain exactly 30 mascot/state keys; found ${O.length}.`);function Ye(r){switch(r.category){case"xp_levels":return"#f59e0b";case"streaks":return"#fb923c";case"tasks":return"#f97316";case"projects":return"#38bdf8";case"wiki":return"#a78bfa";case"psyche":return"#8b5cf6";case"habits":return"#4ade80";case"agents":return"#22d3ee";default:return"#f59e0b"}}function Xe(r){return["cinematic stylized blacksmith game icon",r.category.replace(/_/g," "),r.kind,r.title,"obsidian iron, ember gold, cool violet and cyan steel highlights, no text"].join(", ")}const qe=Object.fromEntries(y.map(r=>[r.assetKey,{key:r.assetKey,role:"item",itemKind:r.kind,alt:`${r.title} ${r.kind} icon.`,dominantColor:Ye(r),tierFrame:r.tier,sourcePath:`gamification/source/themes/dark-fantasy/items/${r.assetKey}.png`,spritePath:`gamification/sprites/themes/dark-fantasy/items/${r.assetKey}-{size}.webp`,sheetKey:r.sheetKey,prompt:Xe(r)}])),Ve=Object.fromEntries(O.map(r=>{const l=Number(r.replace("mascot-state-","")),u=l<=10,d=l>=17;return[r,{key:r,role:d||u?"streak":"mascot",alt:u?"The Forge Smith in a safe cold-forge absence state.":"The Forge Smith mascot in a dramatic blacksmith game-art pose.",dominantColor:u?"#64748b":d?"#fb923c":"#38bdf8",tierFrame:"none",sourcePath:`gamification/source/themes/dark-fantasy/mascots/${r}.png`,spritePath:`gamification/sprites/themes/dark-fantasy/mascots/${r}-{size}.webp`,sheetKey:null,prompt:"dramatic Forge Smith blacksmith mascot, premium game art, no text, no watermark"}]}));({...qe,...Ve});function j(r){r.currentTarget.hidden=!0}const Qe=["all","bronze","silver","gold","platinum"],Je=[{id:"trophies",label:"Trophies"},{id:"unlocks",label:"Unlocks"},{id:"armory",label:"Mascot Armory"},{id:"streak",label:"Streak Forge"}],D={mascot_skin:{field:"selectedMascotSkin",payloadKey:"mascotSkin",label:"Mascot skin"},hud_treatment:{field:"selectedHudTreatment",payloadKey:"hudTreatment",label:"HUD treatment"},streak_effect:{field:"selectedStreakEffect",payloadKey:"streakEffect",label:"Streak flame"},trophy_shelf:{field:"selectedTrophyShelf",payloadKey:"trophyShelf",label:"Trophy shelf"},celebration_variant:{field:"selectedCelebrationVariant",payloadKey:"celebrationVariant",label:"Celebration"}};function J(r){switch(r){case"platinum":return"border-cyan-200/35 text-cyan-100";case"gold":return"border-amber-200/35 text-amber-100";case"silver":return"border-slate-200/35 text-slate-100";default:return"border-orange-300/35 text-orange-100"}}function Ze(r){const l=r.unlockType?D[r.unlockType]:null,u=l?r.rewardPayload[l.payloadKey]:null;return typeof u=="string"?u:null}function et({item:r,gamificationTheme:l,onSelect:u}){return t.jsxs("button",{type:"button",onClick:()=>u(r),className:T("group relative min-h-[19rem] overflow-hidden rounded-[18px] border border-white/8 bg-white/[0.045] p-4 text-left transition hover:-translate-y-0.5 hover:border-white/16 hover:bg-white/[0.07]",!r.unlocked&&"opacity-78"),children:[t.jsx("div",{className:"absolute inset-0 -z-10 bg-[radial-gradient(circle_at_50%_0%,rgba(249,115,22,0.16),transparent_38%)]"}),t.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[t.jsx(A,{className:T("border bg-black/18",J(r.tier)),children:r.tier}),t.jsx(A,{className:"bg-white/[0.06] text-white/58",children:r.unlocked?"earned":"locked"})]}),t.jsx("div",{className:"mt-3 grid place-items-center",children:t.jsx("img",{src:S(r.assetKey,512,l),alt:"",onError:j,className:T("size-36 object-contain drop-shadow-[0_22px_34px_rgba(0,0,0,0.44)] transition group-hover:scale-[1.03]",!r.unlocked&&"grayscale")})}),t.jsxs("div",{className:"mt-3 min-w-0",children:[t.jsx("div",{className:"font-display text-lg text-white",children:r.title}),t.jsx("p",{className:"mt-2 line-clamp-2 text-sm leading-6 text-white/58",children:r.unlocked?r.summary:r.requirementText})]}),t.jsxs("div",{className:"mt-4",children:[t.jsx(Q,{value:r.progressPercent}),t.jsxs("div",{className:"mt-2 flex justify-between gap-3 text-[11px] uppercase tracking-[0.16em] text-white/38",children:[t.jsxs("span",{children:[r.progressCurrent,"/",r.progressTarget]}),t.jsxs("span",{children:[r.progressPercent,"%"]})]})]})]})}function dt(){var W,$,B,U;const r=ce(),l=de(),u=ne(),d=ue(),i=Array.isArray(r.selectedUserIds)?r.selectedUserIds:[],[m,p]=w.useState("trophies"),[b,_]=w.useState("all"),[C,N]=w.useState("all"),[x,M]=w.useState("all"),[K,Z]=w.useState(""),[k,P]=w.useState(null),R=ie({queryKey:["forge-gamification-catalog",...i],queryFn:()=>fe(i)}),F=me(i),z=le({mutationFn:s=>pe(s,i),onSuccess:async()=>{await Promise.all([u.invalidateQueries({queryKey:["forge-gamification-catalog"]}),u.invalidateQueries({queryKey:["forge-xp-metrics"]})]),d(he.util.invalidateTags(["Gamification"]))}}),g=(W=R.data)==null?void 0:W.catalog,L=(g==null?void 0:g.items)??[],ee=w.useMemo(()=>{const s=K.trim().toLowerCase();return L.filter(c=>m==="trophies"&&c.kind!=="trophy"||m==="unlocks"&&c.kind!=="unlock"||(m==="armory"||m==="streak")&&c.kind!=="unlock"||m==="armory"&&!c.unlockType||m==="streak"&&c.unlockType!=="streak_effect"||b!=="all"&&c.category!==b||C!=="all"&&c.tier!==C||x==="unlocked"&&!c.unlocked||x==="locked"&&c.unlocked?!1:s?`${c.title} ${c.summary} ${c.requirementText} ${c.reward}`.toLowerCase().includes(s):!0)},[b,L,K,x,m,C]),h=(g==null?void 0:g.equipment)??(($=F.data)==null?void 0:$.metrics.equipment)??null,te=L.filter(s=>s.kind==="unlock"&&s.unlockType&&D[s.unlockType]);return R.isError?t.jsx(ke,{eyebrow:"Rewards",error:R.error,onRetry:()=>void R.refetch()}):t.jsxs("div",{className:"mx-auto grid w-full max-w-[1320px] gap-5",children:[t.jsx(ye,{title:"Trophy Hall",description:"Achievements are earned from real Forge behavior: tasks, runs, goals, wiki links, Psyche work, habits, Life Force, health, and collaboration.",badge:g?`${g.unlockedCount}/${g.totalCount} earned`:"Loading",actions:(B=F.data)!=null&&B.metrics?t.jsx(ge,{metrics:F.data.metrics.profile}):null}),t.jsxs("section",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(20rem,0.42fr)]",children:[t.jsxs("div",{className:"rounded-[22px] border border-white/8 bg-white/[0.045] p-4",children:[t.jsx("div",{className:"flex flex-wrap gap-2",children:Je.map(s=>t.jsxs(v,{type:"button",variant:m===s.id?"primary":"secondary",size:"sm",onClick:()=>p(s.id),children:[s.id==="trophies"?t.jsx(ae,{className:"size-4"}):null,s.id==="armory"?t.jsx(re,{className:"size-4"}):null,s.id==="streak"?t.jsx(Y,{className:"size-4"}):null,s.id==="unlocks"?t.jsx(X,{className:"size-4"}):null,s.label]},s.id))}),t.jsxs("div",{className:"mt-4 flex min-w-0 flex-wrap items-center gap-2",children:[["all","unlocked","locked"].map(s=>t.jsxs(v,{type:"button",variant:x===s?"primary":"secondary",size:"sm",onClick:()=>M(s),children:[s==="locked"?t.jsx(q,{className:"size-4"}):null,s]},s)),t.jsxs("label",{className:"ml-auto flex min-h-10 min-w-[16rem] max-w-full items-center gap-2 rounded-full border border-white/8 bg-black/18 px-3 text-sm text-white/70",children:[t.jsx(se,{className:"size-4 shrink-0 text-white/38"}),t.jsx("input",{value:K,onChange:s=>Z(s.target.value),placeholder:"Search rewards",className:"min-w-0 flex-1 bg-transparent text-white outline-none placeholder:text-white/34"})]})]}),t.jsxs("div",{className:"mt-4 flex min-w-0 flex-wrap gap-2",children:[t.jsx(v,{type:"button",variant:b==="all"?"primary":"secondary",size:"sm",onClick:()=>_("all"),children:"all categories"}),V.map(s=>t.jsx(v,{type:"button",variant:b===s.id?"primary":"secondary",size:"sm",onClick:()=>_(s.id),children:s.label},s.id))]}),t.jsx("div",{className:"mt-4 flex min-w-0 flex-wrap gap-2",children:Qe.map(s=>t.jsx(v,{type:"button",variant:C===s?"primary":"secondary",size:"sm",onClick:()=>N(s),children:s},s))})]}),t.jsxs("div",{className:"grid gap-3 rounded-[22px] border border-white/8 bg-black/18 p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-white",children:[t.jsx(X,{className:"size-4 text-[var(--tertiary)]"}),"Near completion"]}),((g==null?void 0:g.nextTargets)??[]).map(s=>t.jsxs("button",{type:"button",onClick:()=>P(s),className:"grid grid-cols-[2.75rem_minmax(0,1fr)_3rem] items-center gap-3 rounded-2xl bg-white/[0.045] p-2 text-left",children:[t.jsx("img",{src:S(s.assetKey,256,l),alt:"",onError:j,className:"size-11 object-contain"}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block truncate text-sm text-white/82",children:s.title}),t.jsx("span",{className:"block truncate text-[11px] text-white/42",children:s.requirementText})]}),t.jsxs("span",{className:"text-right text-xs text-white/50",children:[s.progressPercent,"%"]})]},s.id))]})]}),m==="armory"?t.jsxs("section",{className:"grid gap-3 lg:grid-cols-[minmax(18rem,0.42fr)_minmax(0,1fr)]",children:[t.jsxs("div",{className:"relative min-h-[24rem] overflow-hidden rounded-[24px] border border-white/8 bg-[linear-gradient(145deg,rgba(15,23,42,0.92),rgba(24,24,36,0.88))] p-4",children:[t.jsx("img",{src:S(((U=F.data)==null?void 0:U.metrics.mascot.spriteKey)??"mascot-state-014",512,l),alt:"Forge Smith mascot",onError:j,className:"absolute inset-x-0 bottom-0 mx-auto h-[23rem] object-contain"}),t.jsxs("div",{className:"relative z-10",children:[t.jsx(A,{className:"bg-black/30 text-[var(--tertiary)]",children:"Equipped"}),t.jsxs("div",{className:"mt-3 grid gap-1 text-sm text-white/68",children:[t.jsxs("span",{children:["Skin: ",(h==null?void 0:h.selectedMascotSkin)??"default"]}),t.jsxs("span",{children:["HUD: ",(h==null?void 0:h.selectedHudTreatment)??"default"]}),t.jsxs("span",{children:["Flame: ",(h==null?void 0:h.selectedStreakEffect)??"default"]}),t.jsxs("span",{children:["Shelf: ",(h==null?void 0:h.selectedTrophyShelf)??"default"]})]})]})]}),t.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:te.map(s=>{const c=s.unlockType?D[s.unlockType]:null,f=Ze(s),E=!!(c&&f&&(h==null?void 0:h[c.field])===f);return t.jsxs(G,{className:T("p-4",!s.unlocked&&"opacity-70"),children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(A,{className:"bg-white/[0.06] text-white/58",children:(c==null?void 0:c.label)??"Cosmetic"}),E?t.jsx(oe,{className:"size-4 text-emerald-200"}):null]}),t.jsx("img",{src:S(s.assetKey,256,l),alt:"",onError:j,className:T("mx-auto mt-3 size-28 object-contain",!s.unlocked&&"grayscale")}),t.jsx("div",{className:"mt-3 font-display text-lg text-white",children:s.title}),t.jsx("p",{className:"mt-2 line-clamp-2 text-sm leading-6 text-white/56",children:s.unlocked?s.summary:s.requirementText}),t.jsx(v,{type:"button",variant:E?"secondary":"primary",size:"sm",disabled:!s.unlocked||!c||!f||z.isPending,className:"mt-4 w-full",onClick:()=>{!c||!f||z.mutate({[c.field]:E?null:f})},children:E?"Unequip":s.unlocked?"Equip":"Locked"})]},s.id)})})]}):m==="streak"?t.jsxs("section",{className:"grid gap-4",children:[t.jsxs(G,{className:"p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 font-display text-xl text-white",children:[t.jsx(Y,{className:"size-5 text-[var(--tertiary)]"}),"Streak power states"]}),t.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 md:grid-cols-4 xl:grid-cols-5",children:Be.map(([s,c])=>t.jsxs("div",{className:"rounded-[18px] border border-white/8 bg-white/[0.04] p-3",children:[t.jsx("img",{src:S(c,256,l),alt:"",onError:j,className:"mx-auto size-28 object-contain"}),t.jsxs("div",{className:"mt-2 text-center text-sm text-white/74",children:[s," day power"]})]},c))})]}),t.jsxs(G,{className:"p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 font-display text-xl text-white",children:[t.jsx(q,{className:"size-5 text-slate-300"}),"Absence pressure states"]}),t.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 md:grid-cols-4 xl:grid-cols-5",children:Ue.map(([s,c])=>t.jsxs("div",{className:"rounded-[18px] border border-white/8 bg-white/[0.04] p-3",children:[t.jsx("img",{src:S(c,256,l),alt:"",onError:j,className:"mx-auto size-28 object-contain"}),t.jsxs("div",{className:"mt-2 text-center text-sm text-white/74",children:[s," days away"]})]},c))})]})]}):t.jsx("section",{className:"grid gap-5",children:V.map(s=>{const c=ee.filter(f=>f.category===s.id);return c.length===0?null:t.jsxs("section",{className:"grid gap-3",children:[t.jsx("div",{className:"flex items-end justify-between gap-3",children:t.jsxs("div",{children:[t.jsx("div",{className:"font-display text-xl text-white",children:s.label}),t.jsxs("div",{className:"text-sm text-white/44",children:[c.length," visible rewards"]})]})}),t.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:c.map(f=>t.jsx(et,{item:f,gamificationTheme:l,onSelect:P},f.id))})]},s.id)})}),k?t.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-black/72 p-4 backdrop-blur-sm",onClick:()=>P(null),children:t.jsxs("div",{className:"w-full max-w-[34rem] rounded-[26px] border border-white/10 bg-[rgb(12,17,30)] p-5 shadow-[0_32px_90px_rgba(0,0,0,0.6)]",onClick:s=>s.stopPropagation(),children:[t.jsxs("div",{className:"flex items-start gap-4",children:[t.jsx("img",{src:S(k.assetKey,512,l),alt:"",onError:j,className:"size-32 object-contain"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(A,{className:T("border bg-black/18",J(k.tier)),children:k.tier}),t.jsx(A,{className:"bg-white/[0.06] text-white/58",children:k.kind})]}),t.jsx("div",{className:"mt-3 font-display text-2xl text-white",children:k.title}),t.jsx("p",{className:"mt-2 text-sm leading-6 text-white/62",children:k.summary})]})]}),t.jsxs("div",{className:"mt-5 rounded-[18px] border border-white/8 bg-white/[0.04] p-4",children:[t.jsx("div",{className:"text-sm font-semibold text-white",children:"Requirement"}),t.jsx("p",{className:"mt-2 text-sm leading-6 text-white/58",children:k.requirementText}),t.jsxs("div",{className:"mt-4",children:[t.jsx(Q,{value:k.progressPercent}),t.jsxs("div",{className:"mt-2 flex justify-between text-[11px] uppercase tracking-[0.16em] text-white/40",children:[t.jsxs("span",{children:[k.progressCurrent,"/",k.progressTarget]}),t.jsx("span",{children:k.unlocked?"earned":"locked"})]})]})]}),t.jsx("div",{className:"mt-4 flex justify-end",children:t.jsx(v,{type:"button",variant:"secondary",onClick:()=>P(null),children:"Close"})})]})}):null]})}export{dt as RewardsPage};
@@ -1 +0,0 @@
1
- import{r as s,j as e}from"./vendor-DHkYh85p.js";import{C as J,I as r,B as z}from"./index-CF4J4R9L.js";const F=[{value:"main_activity",label:"Main activity"},{value:"secondary_activity",label:"Secondary activity"},{value:"third_activity",label:"Third activity"},{value:"rest",label:"Rest"},{value:"holiday",label:"Holiday"},{value:"custom",label:"Custom"}],G=[{value:"busy",label:"Busy"},{value:"free",label:"Free"}],t={allowWorkBlockKinds:[],blockWorkBlockKinds:[],allowCalendarIds:[],blockCalendarIds:[],allowEventTypes:[],blockEventTypes:[],allowEventKeywords:[],blockEventKeywords:[],allowAvailability:[],blockAvailability:[]};function d(o){return o.join(", ")}function n(o){return o.split(",").map(v=>v.trim()).filter(Boolean)}function b({label:o,selected:v,onToggle:a,options:p}){return e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:o}),e.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(c=>{const m=v.includes(c.value);return e.jsx("button",{type:"button",onClick:()=>a(c.value),className:`rounded-full px-3 py-2 text-sm transition ${m?"bg-[var(--primary)]/18 text-[var(--primary)] shadow-[inset_0_0_0_1px_rgba(192,193,255,0.24)]":"bg-white/[0.05] text-white/62 hover:bg-white/[0.08]"}`,children:c.label},c.value)})})]})}function Z({title:o,subtitle:v,initialRules:a,initialPlannedDurationSeconds:p,onSave:c,saveLabel:m="Save scheduling rules",allowPlannedDuration:i=!1}){const[x,A]=s.useState((a==null?void 0:a.allowWorkBlockKinds)??t.allowWorkBlockKinds),[g,T]=s.useState((a==null?void 0:a.blockWorkBlockKinds)??t.blockWorkBlockKinds),[k,S]=s.useState((a==null?void 0:a.allowAvailability)??t.allowAvailability),[h,I]=s.useState((a==null?void 0:a.blockAvailability)??t.blockAvailability),[j,_]=s.useState(d((a==null?void 0:a.allowCalendarIds)??t.allowCalendarIds)),[u,W]=s.useState(d((a==null?void 0:a.blockCalendarIds)??t.blockCalendarIds)),[C,M]=s.useState(d((a==null?void 0:a.allowEventTypes)??t.allowEventTypes)),[E,O]=s.useState(d((a==null?void 0:a.blockEventTypes)??t.blockEventTypes)),[N,L]=s.useState(d((a==null?void 0:a.allowEventKeywords)??t.allowEventKeywords)),[B,P]=s.useState(d((a==null?void 0:a.blockEventKeywords)??t.blockEventKeywords)),[f,H]=s.useState(p?String(Math.round(p/60)):"30"),[U,y]=s.useState(!1),Y=s.useMemo(()=>({allowWorkBlockKinds:x,blockWorkBlockKinds:g,allowCalendarIds:n(j),blockCalendarIds:n(u),allowEventTypes:n(C),blockEventTypes:n(E),allowEventKeywords:n(N),blockEventKeywords:n(B),allowAvailability:k,blockAvailability:h}),[k,j,N,C,x,h,u,B,E,g]),V=Object.values(Y).every(l=>l.length===0),w=(l,$,K)=>{$(l.includes(K)?l.filter(q=>q!==K):[...l,K])};return e.jsxs(J,{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:o}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-white/60",children:v})]}),i?e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Planned duration"}),e.jsx(r,{type:"number",min:15,step:15,value:f,onChange:l=>H(l.target.value),placeholder:"30"})]}):null,e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(b,{label:"Allow work blocks",selected:x,onToggle:l=>w(x,A,l),options:F}),e.jsx(b,{label:"Block work blocks",selected:g,onToggle:l=>w(g,T,l),options:F}),e.jsx(b,{label:"Allow availability",selected:k,onToggle:l=>w(k,S,l),options:G}),e.jsx(b,{label:"Block availability",selected:h,onToggle:l=>w(h,I,l),options:G})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Allow calendar ids"}),e.jsx(r,{value:j,onChange:l=>_(l.target.value),placeholder:"calendar_123, primary"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Block calendar ids"}),e.jsx(r,{value:u,onChange:l=>W(l.target.value),placeholder:"calendar_456"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Allow event types"}),e.jsx(r,{value:C,onChange:l=>M(l.target.value),placeholder:"focus, personal"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Block event types"}),e.jsx(r,{value:E,onChange:l=>O(l.target.value),placeholder:"out-of-office, main-work"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Allow event keywords"}),e.jsx(r,{value:N,onChange:l=>L(l.target.value),placeholder:"creative, writing"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Block event keywords"}),e.jsx(r,{value:B,onChange:l=>P(l.target.value),placeholder:"psychiatrist, clinic, rest"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(z,{pending:U,pendingLabel:"Saving",onClick:async()=>{y(!0);try{await c({schedulingRules:V?t:Y,plannedDurationSeconds:i?Math.max(15,Number(f||30))*60:void 0})}finally{y(!1)}},children:m}),e.jsx(z,{variant:"secondary",onClick:async()=>{y(!0);try{A([]),T([]),S([]),I([]),_(""),W(""),M(""),O(""),L(""),P(""),await c({schedulingRules:null,plannedDurationSeconds:i?Math.max(15,Number(f||30))*60:void 0})}finally{y(!1)}},children:"Clear custom rules"})]})]})}export{Z as S};
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-DHkYh85p.js";import{Z as l}from"./index-CF4J4R9L.js";import{a as m,b as o}from"./schema-visuals-D6nxjbYC.js";function d({label:s,schemaType:a,compact:n=!1,showType:t=!1,className:i}){const r=o(a);return e.jsxs("span",{className:l("inline-flex max-w-full min-w-0 items-center gap-2 rounded-full border px-3 py-1.5 text-sm leading-tight shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",n?"min-h-8":"min-h-9",r.badgeTone,i),children:[t?e.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-white/58",children:m(a)}):null,e.jsx("span",{className:"min-w-0 break-words whitespace-normal",children:s})]})}export{d as S};
@@ -1 +0,0 @@
1
- const o={maladaptive:"Maladaptive schema",adaptive:"Adaptive schema"},d={maladaptive:"A recurring pressure pattern that can distort how you interpret situations or respond.",adaptive:"A stable healthy belief pattern you want to strengthen and rely on."},l={disconnection_rejection:"Disconnection & rejection",impaired_autonomy:"Autonomy & competence",other_directedness:"Boundaries & mutuality",overvigilance_inhibition:"Standards & inhibition",healthy_selfhood:"Healthy selfhood"};function c(e){return o[e]}function g(e){return d[e]}function s(e){return l[e]??e.replaceAll("_"," ")}function b(e){return e==="adaptive"?{sectionTone:"border-emerald-400/14 bg-[linear-gradient(180deg,rgba(26,53,48,0.72),rgba(10,18,30,0.92))]",sectionEyebrow:"text-emerald-200/84",cardTone:"border-emerald-400/14 bg-[linear-gradient(180deg,rgba(28,63,56,0.44),rgba(14,24,36,0.92))]",badgeTone:"border-emerald-300/18 bg-[linear-gradient(135deg,rgba(16,185,129,0.18),rgba(56,189,248,0.12))] text-emerald-50",subtleBadgeTone:"border-emerald-300/12 bg-[rgba(16,185,129,0.1)] text-emerald-100/88",countLabel:"support links",linkSummary:"linked strengthening belief",emptyCopy:"No adaptive schema is linked yet. Add one when you want to capture the healthier pattern you are building from."}:{sectionTone:"border-fuchsia-400/14 bg-[linear-gradient(180deg,rgba(44,28,58,0.72),rgba(10,18,30,0.92))]",sectionEyebrow:"text-fuchsia-200/84",cardTone:"border-violet-400/14 bg-[linear-gradient(180deg,rgba(48,33,68,0.44),rgba(14,18,34,0.92))]",badgeTone:"border-rose-300/18 bg-[linear-gradient(135deg,rgba(244,63,94,0.16),rgba(168,85,247,0.12))] text-rose-50",subtleBadgeTone:"border-rose-300/12 bg-[rgba(244,63,94,0.1)] text-rose-100/88",countLabel:"linked records",linkSummary:"linked belief",emptyCopy:"No maladaptive schema is linked yet. Add one when you want to capture the recurring old pattern clearly."}}function n(e){return e.trim().toLowerCase()}function i(e,a){const t=n(a);return[e.id,e.slug,e.title].some(r=>n(r)===t)}function u(e,a){return a.find(t=>i(t,e))??null}function m(e,a){const t=e.filter(r=>!i(a,r));return t.length===e.length?[...t,a.id]:t}export{c as a,b,g as c,u as f,s as g,m as t};
@@ -1 +0,0 @@
1
- import{r as n,j as e,cx as v,bl as j}from"./vendor-DHkYh85p.js";import{Z as i}from"./index-CF4J4R9L.js";function k({label:u,value:o,options:d,onChange:f,className:p,triggerClassName:w,menuClassName:g}){const[a,c]=n.useState(!1),m=n.useRef(null),h=n.useRef(null),b=n.useId(),r=n.useMemo(()=>d.find(t=>t.value===o)??d[0],[d,o]);return n.useEffect(()=>{if(!a)return;const t=x=>{var l;(l=m.current)!=null&&l.contains(x.target)||c(!1)},s=x=>{var l;x.key==="Escape"&&(c(!1),(l=h.current)==null||l.focus())};return document.addEventListener("pointerdown",t),document.addEventListener("keydown",s),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",s)}},[a]),e.jsxs("div",{className:i("relative",p),ref:m,children:[e.jsx("div",{className:"mb-1.5 text-[11px] font-medium uppercase tracking-[0.18em] text-white/42",children:u}),e.jsxs("button",{ref:h,type:"button",className:i("flex min-h-11 w-full min-w-[15rem] items-center justify-between gap-3 rounded-[18px] border border-white/8 bg-[linear-gradient(180deg,rgba(255,255,255,0.08),rgba(255,255,255,0.03))] px-4 py-2.5 text-left shadow-[0_16px_32px_rgba(15,23,42,0.18)] transition hover:border-white/14 hover:bg-[linear-gradient(180deg,rgba(255,255,255,0.11),rgba(255,255,255,0.05))] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[rgba(192,193,255,0.45)]",w),"aria-haspopup":"listbox","aria-expanded":a,"aria-controls":b,onClick:()=>c(t=>!t),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-white",children:(r==null?void 0:r.label)??o}),r!=null&&r.description?e.jsx("div",{className:"truncate text-xs text-white/48",children:r.description}):null]}),e.jsx(v,{className:i("size-4 shrink-0 text-white/48 transition",a&&"rotate-180 text-white/72")})]}),a?e.jsx("div",{id:b,role:"listbox","aria-label":u,className:i("absolute left-0 top-[calc(100%+0.6rem)] z-30 w-full overflow-hidden rounded-[22px] border border-white/8 bg-[linear-gradient(180deg,rgba(20,28,42,0.98),rgba(12,17,30,0.98))] p-2 shadow-[0_28px_64px_rgba(3,8,18,0.42)] backdrop-blur-xl",g),children:e.jsx("div",{className:"grid gap-1",children:d.map(t=>{const s=t.value===o;return e.jsxs("button",{type:"button",role:"option","aria-selected":s,className:i("flex w-full items-start justify-between gap-3 rounded-[16px] px-3 py-2.5 text-left transition",s?"bg-[rgba(192,193,255,0.14)] text-white":"text-white/74 hover:bg-white/[0.06] hover:text-white"),onClick:()=>{f(t.value),c(!1)},children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium",children:t.label}),t.description?e.jsx("div",{className:"mt-0.5 text-xs text-white/44",children:t.description}):null]}),e.jsx(j,{className:i("mt-0.5 size-4 shrink-0 transition",s?"text-white":"opacity-0")})]},t.value)})})}):null]})}export{k as S};
@@ -1,6 +0,0 @@
1
- import{r as v,j as e,df as _e,aK as qe,bl as Ce,c8 as Oe,b8 as De,b4 as Ee,dg as Be,cw as He,cx as Ue}from"./vendor-DHkYh85p.js";import{j as Ke,i as F,k as I}from"./state-B-4sS1xO.js";import{Q as Se,dH as ze,j as M,F as u,I as C,T as $e,c as g,B as P,dI as We,dJ as Qe,dK as Xe,dL as Ge,dM as Ye,dN as Je,dO as Ze,dP as Ve,S as et,E as ye,C as k,V as Z,b as tt,dx as st,b$ as at,dQ as it,dR as nt,dS as rt,dT as ot,dU as lt}from"./index-CF4J4R9L.js";import{R as dt,P as ct,O as ht,C as pt,T as xt,D as mt,a as ut}from"./ui-C13Nbgas.js";import{m as gt}from"./motion-BeD44FeG.js";import{S as vt}from"./settings-section-nav-DSOuht_F.js";import{P as bt}from"./page-hero-DRy5b2MU.js";import{M as W}from"./metric-tile-DKpo-8xw.js";import"./board-BkDRaMp6.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const G=["read","write","insights","rewards.manage","psyche.read","psyche.write","psyche.note","psyche.insight","psyche.mode"],wt=[{value:"read",label:"Read",description:"Inspect goals, projects, tasks, reviews, and metrics."},{value:"write",label:"Write",description:"Create and update work through the versioned API."},{value:"insights",label:"Insights",description:"Store structured findings, rationale, and feedback."},{value:"rewards.manage",label:"Rewards",description:"Tune reward rules and issue explainable bonus XP grants."},{value:"psyche.read",label:"Psyche read",description:"Read sensitive values, patterns, and trigger analyses."},{value:"psyche.write",label:"Psyche write",description:"Create and update sensitive therapeutic records."},{value:"psyche.note",label:"Psyche note",description:"Create and edit Markdown notes linked to reflective records."},{value:"psyche.insight",label:"Psyche insight",description:"Store therapeutic insights on Psyche entities."},{value:"psyche.mode",label:"Psyche mode",description:"Name, refine, and map mode profiles and guided mode results."}],se={mode:"active_only",goalsLimit:5,projectsLimit:8,tasksLimit:10,habitsLimit:6,strategiesLimit:4,peoplePageLimit:4,includePeoplePages:!0},X={userIds:[],projectIds:[],tagIds:[]};function V(a){return a==="review"?{mode:"active_only",goalsLimit:3,projectsLimit:5,tasksLimit:6,habitsLimit:4,strategiesLimit:3,peoplePageLimit:0,includePeoplePages:!1}:a==="operator"?{...se}:a==="autonomous"?{mode:"scoped",goalsLimit:10,projectsLimit:14,tasksLimit:16,habitsLimit:10,strategiesLimit:8,peoplePageLimit:6,includePeoplePages:!0}:{...se}}function ee(a){return Array.from(new Set(a.split(",").map(n=>n.trim()).filter(n=>n.length>0)))}function Ae(a,n,l){return n==="review"?{...a,preset:n,trustLevel:"trusted",autonomyMode:"approval_required",approvalMode:"approval_by_default",scopes:[...l],bootstrapPolicy:V(n),scopePolicy:{...X}}:n==="operator"?{...a,preset:n,trustLevel:"trusted",autonomyMode:"scoped_write",approvalMode:"high_impact_only",scopes:[...G],bootstrapPolicy:V(n),scopePolicy:{...X}}:n==="autonomous"?{...a,preset:n,trustLevel:"autonomous",autonomyMode:"autonomous",approvalMode:"none",scopes:[...G],bootstrapPolicy:V(n),scopePolicy:{...X}}:{...a,preset:n}}function fe(a,n,l){const m={preset:a,label:"Forge Pilot Token",agentLabel:n,agentType:"assistant",description:"Collaborative planning agent.",trustLevel:"trusted",autonomyMode:"scoped_write",approvalMode:"high_impact_only",scopes:[...G],bootstrapPolicy:{...se},scopePolicy:{...X}};return Ae(m,a,l)}function jt({open:a,onOpenChange:n,pending:l=!1,initialPreset:m="operator",defaultAgentLabel:p="OpenClaw",recommendedScopes:b=[...G],onSubmit:f}){const[h,j]=v.useState(()=>fe(m,p,b)),[_,w]=v.useState(null);v.useEffect(()=>{a&&(j(fe(m,p,b)),w(null))},[a,m,p,b]);const A=[{id:"preset",eyebrow:"Agent token",title:"Choose a starting point for this token",description:"Each preset locks in a sensible trust, autonomy, and approval policy. You can tune any setting in the next steps.",render:(i,r)=>e.jsx(M,{columns:3,value:i.preset,onChange:s=>r(Ae(i,s,b)),options:[{value:"review",label:"Review-first",description:"Every action waits for your approval. Safe starting point for a new agent you have not yet trusted."},{value:"operator",label:"Full operator",description:"Trusted collaborator with full scopes. High-impact actions still ask for approval."},{value:"autonomous",label:"Autonomous pilot",description:"No approval gates. Use only for agents you have fully verified in a controlled setup."},{value:"custom",label:"Custom",description:"Start from a blank slate and configure every dimension yourself."}]})},{id:"identity",eyebrow:"Agent identity",title:"Name the agent and this token",description:"The agent name appears in logs, approval requests, and audit trails. The token label is for your reference.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Agent name",labelHelp:"This label identifies the agent in every log entry, approval notification, and XP attribution. Pick something memorable.",children:e.jsx(C,{value:i.agentLabel,placeholder:"OpenClaw",onChange:s=>r({agentLabel:s.target.value})})}),e.jsx(u,{label:"Token label",description:"A short name for this credential — mainly for your reference in the token list.",children:e.jsx(C,{value:i.label,placeholder:"Forge Pilot Token",onChange:s=>r({label:s.target.value})})}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsx(u,{label:"Agent type",labelHelp:"Use 'assistant' for interactive agents. Use 'automation' for scripts or scheduled jobs with no conversational layer.",children:e.jsxs("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.agentType,onChange:s=>r({agentType:s.target.value}),children:[e.jsx("option",{value:"assistant",children:"assistant"}),e.jsx("option",{value:"automation",children:"automation"}),e.jsx("option",{value:"observer",children:"observer"})]})}),e.jsx(u,{label:"Description",description:"Optional note about what this agent does.",children:e.jsx(C,{value:i.description,placeholder:"Collaborative planning agent.",onChange:s=>r({description:s.target.value})})})]})]})},{id:"policy",eyebrow:"Access policy",title:"Set trust level and approval behaviour",description:"These three settings control how much autonomy the agent has and when it needs your sign-off. The preset you chose filled sensible defaults — adjust only if needed.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Trust level",labelHelp:"Standard agents are sandboxed readers. Trusted agents can write with policy guardrails. Autonomous agents bypass all trust checks — use with care.",children:e.jsx(M,{columns:3,value:i.trustLevel,onChange:s=>r({trustLevel:s}),options:[{value:"standard",label:"Standard",description:"Read-only by default, limited write surface."},{value:"trusted",label:"Trusted",description:"Full write surface with policy guardrails active."},{value:"autonomous",label:"Autonomous",description:"All checks bypassed — maximum capability."}]})}),e.jsx(u,{label:"Autonomy mode",labelHelp:"Approval-required means every mutation is held for review. Scoped write lets the agent act within its scopes. Autonomous skips all gates.",children:e.jsx(M,{columns:3,value:i.autonomyMode,onChange:s=>r({autonomyMode:s}),options:[{value:"approval_required",label:"Approval required",description:"Every write action queues for your review."},{value:"scoped_write",label:"Scoped write",description:"Acts freely within its assigned scopes."},{value:"autonomous",label:"Autonomous",description:"No gates — full freedom to write."}]})}),e.jsx(u,{label:"Approval policy",labelHelp:"Controls which actions trigger the approval queue. High-impact-only is the balanced default: routine writes go through, large mutations get reviewed.",children:e.jsx(M,{columns:3,value:i.approvalMode,onChange:s=>r({approvalMode:s}),options:[{value:"approval_by_default",label:"Approve by default",description:"Everything needs a sign-off unless explicitly exempt."},{value:"high_impact_only",label:"High impact only",description:"Routine writes pass through; high-stakes actions are held."},{value:"none",label:"None",description:"No approval gates — actions execute immediately."}]})})]})},{id:"scopes",eyebrow:"Scopes",title:"Select what this agent can access",description:"Scope selection follows the principle of least privilege — only grant what the agent actually needs. The full operator bundle covers every capability.",render:(i,r)=>e.jsxs(u,{label:"Capabilities",labelHelp:"Read lets the agent inspect the system. Write lets it create and update work. Rewards and Psyche scopes unlock more sensitive subsystems.",children:[e.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:wt.map(s=>{const y=i.scopes.includes(s.value);return e.jsxs("button",{type:"button",className:`rounded-[18px] border px-4 py-4 text-left transition ${y?"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/58 hover:bg-white/[0.08]"}`,onClick:()=>{if(y){if(i.scopes.length===1)return;r({scopes:i.scopes.filter(S=>S!==s.value)})}else r({scopes:[...i.scopes,s.value]})},children:[e.jsx("div",{className:"font-medium",children:s.label}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/58",children:s.description})]},s.value)})}),e.jsxs("div",{className:"mt-2 text-xs text-white/40",children:[i.scopes.length," scope",i.scopes.length!==1?"s":""," ","selected"]})]})},{id:"default-scope",eyebrow:"Default read scope",title:"Decide which owners and slices this agent sees by default",description:"Leave these blank for broad reads. When set, Forge automatically narrows overview, context, and bootstrap reads for this token unless the request narrows further.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Default user IDs",description:"Comma-separated owner ids such as user_operator or user_forge_bot.",labelHelp:"If you set user ids here, this token only sees that owner slice by default. Explicit userIds in a request can narrow further, but they will not silently widen beyond this list.",children:e.jsx(C,{value:i.scopePolicy.userIds.join(", "),placeholder:"user_operator, user_forge_bot",onChange:s=>r({scopePolicy:{...i.scopePolicy,userIds:ee(s.target.value)}})})}),e.jsx(u,{label:"Project IDs",description:"Optional project-level boundary for overview, context, and bootstrap reads.",children:e.jsx(C,{value:i.scopePolicy.projectIds.join(", "),placeholder:"project_123, project_456",onChange:s=>r({scopePolicy:{...i.scopePolicy,projectIds:ee(s.target.value)}})})}),e.jsx(u,{label:"Tag IDs",description:"Optional tag-level boundary for overview, context, and bootstrap reads.",children:e.jsx(C,{value:i.scopePolicy.tagIds.join(", "),placeholder:"tag_focus, tag_client",onChange:s=>r({scopePolicy:{...i.scopePolicy,tagIds:ee(s.target.value)}})})}),e.jsxs("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/62",children:["Default scope summary:"," ",i.scopePolicy.userIds.length>0?`${i.scopePolicy.userIds.length} user slice${i.scopePolicy.userIds.length===1?"":"s"}`:"all visible users",i.scopePolicy.projectIds.length>0?` · ${i.scopePolicy.projectIds.length} project ${i.scopePolicy.projectIds.length===1?"boundary":"boundaries"}`:"",i.scopePolicy.tagIds.length>0?` · ${i.scopePolicy.tagIds.length} tag ${i.scopePolicy.tagIds.length===1?"boundary":"boundaries"}`:""]})]})},{id:"bootstrap",eyebrow:"Bootstrap",title:"Decide how much Forge context is injected at session start",description:"This controls the automatic BOOTSTRAP snapshot for agent sessions. Keep it lean unless the agent genuinely needs broad context on every new session.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Bootstrap mode",labelHelp:"Disabled injects nothing. Active-only keeps a compact current-work snapshot. Scoped keeps budgets but not status filters. Full mirrors the legacy broad bootstrap.",children:e.jsx(M,{columns:3,value:i.bootstrapPolicy.mode,onChange:s=>r({bootstrapPolicy:{...i.bootstrapPolicy,mode:s}}),options:[{value:"disabled",label:"Disabled",description:"No automatic Forge snapshot is injected."},{value:"active_only",label:"Active only",description:"Only active projects, focus tasks, due habits, and bounded summaries."},{value:"scoped",label:"Scoped",description:"Bounded lists without forcing only active items."},{value:"full",label:"Full",description:"Legacy broad bootstrap. Highest context cost."}]})}),e.jsx("div",{className:"grid gap-5 md:grid-cols-3",children:[["goalsLimit","Goals"],["projectsLimit","Projects"],["tasksLimit","Tasks"],["habitsLimit","Habits"],["strategiesLimit","Strategies"],["peoplePageLimit","People pages"]].map(([s,y])=>e.jsx(u,{label:y,children:e.jsx(C,{type:"number",min:0,max:s==="peoplePageLimit"?50:100,value:i.bootstrapPolicy[s],onChange:S=>r({bootstrapPolicy:{...i.bootstrapPolicy,[s]:Number(S.target.value||0)}})})},s))}),e.jsxs("label",{className:"flex items-center gap-3 rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/70",children:[e.jsx("input",{type:"checkbox",checked:i.bootstrapPolicy.includePeoplePages,onChange:s=>r({bootstrapPolicy:{...i.bootstrapPolicy,includePeoplePages:s.target.checked}})}),"Include People wiki pages in the bootstrap snapshot"]})]})}];return e.jsx(Se,{open:a,onOpenChange:n,eyebrow:"Agent setup",title:"Issue an agent token",description:"Configure a new agent token step by step. The preset fills sensible defaults — adjust what you need.",value:h,onChange:j,draftPersistenceKey:"settings.agent-token.new",steps:A,submitLabel:"Issue token",pending:l,pendingLabel:"Issuing token…",error:_,onSubmit:async()=>{w(null);const i=ze.safeParse({label:h.label,agentLabel:h.agentLabel,agentType:h.agentType,description:h.description,trustLevel:h.trustLevel,autonomyMode:h.autonomyMode,approvalMode:h.approvalMode,scopes:h.scopes,bootstrapPolicy:h.bootstrapPolicy,scopePolicy:h.scopePolicy});if(!i.success){const r=i.error.issues[0];w((r==null?void 0:r.message)??"Check the agent name and at least one scope before issuing.");return}try{await f(i.data),n(!1)}catch(r){w(r instanceof Error?r.message:"Could not issue the token right now.")}}})}function Ne(a){return{source:"new",taskId:"",title:"",description:"",owner:a,projectId:"",status:"done",points:40}}function yt({open:a,onOpenChange:n,pending:l=!1,defaultOwner:m="",availableTasks:p=[],availableProjects:b=[],onSubmit:f}){const[h,j]=v.useState(()=>Ne(m)),[_,w]=v.useState(null);v.useEffect(()=>{a&&(j(Ne(m)),w(null))},[a,m]);const A=[{id:"source",eyebrow:"Log work",title:"Is this work already tracked?",description:"If a task exists, link the work to it so Forge can update the record with the right status and XP. If not, a new task will be created from what you describe.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(M,{columns:2,value:i.source,onChange:s=>r({source:s,taskId:""}),options:[{value:"new",label:"New task",description:"The work is not tracked yet — Forge will create a task and log the time against it."},{value:"existing",label:"Existing task",description:"Pick a task already in the board. The log will update its record and award XP."}]}),i.source==="existing"&&p.length>0?e.jsx(u,{label:"Pick the task",description:"Select the task this work belongs to.",children:e.jsxs("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.taskId,onChange:s=>r({taskId:s.target.value}),children:[e.jsx("option",{value:"",children:"— choose a task —"}),p.map(s=>e.jsxs("option",{value:s.id,children:[s.title," · ",s.status.replaceAll("_"," ")]},s.id))]})}):i.source==="existing"&&p.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm text-white/58",children:'No tasks are loaded yet. Switch to "New task" to create one from scratch.'}):null]})},{id:"details",eyebrow:"Work details",title:"Describe what was done",description:"Give the work a clear title and enough context to understand it later. These become the task record if you are creating a new one.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Title",labelHelp:"Write the title like a short achievement: what was completed, not what was started.",children:e.jsx(C,{value:i.title,placeholder:"Write postmortem draft",onChange:s=>r({title:s.target.value})})}),e.jsx(u,{label:"Owner",description:"Who did this work? Defaults to the operator name.",children:e.jsx(C,{value:i.owner,placeholder:"Your name",onChange:s=>r({owner:s.target.value})})}),e.jsx(u,{label:"Description",description:"What moved forward? What should remain visible in the project history?",children:e.jsx($e,{className:"min-h-28",value:i.description,placeholder:"Wrote the full incident timeline and drafted the three key learnings for the team retrospective.",onChange:s=>r({description:s.target.value})})})]})},{id:"placement",eyebrow:"Placement",title:"Set the context and XP value",description:"Assign the work to a project and choose its final status. The XP value controls how much this work contributes to the operator's progress curve.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsx(u,{label:"Project",description:"Link this work to an active project if it belongs to one.",children:e.jsxs("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.projectId,onChange:s=>r({projectId:s.target.value}),children:[e.jsx("option",{value:"",children:"No project link"}),b.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})}),e.jsx(u,{label:"Final status",labelHelp:"'Done' is the most common choice. Use 'In progress' if the work was real but the task is still open.",children:e.jsx(M,{columns:2,value:i.status,onChange:s=>r({status:s}),options:[{value:"done",label:"Done",description:"Work is complete."},{value:"in_progress",label:"In progress",description:"Still active but already worth logging."},{value:"focus",label:"Focus",description:"Moved into focus."},{value:"blocked",label:"Blocked",description:"Work hit a wall."}]})})]}),e.jsx(u,{label:"XP value",labelHelp:"Typical task XP ranges from 20 to 100. Use 40 for routine tasks, 80+ for complex deliverables.",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(C,{type:"number",min:5,max:500,className:"w-36",value:i.points,onChange:s=>r({points:Number(s.target.value)})}),e.jsx("div",{className:"flex gap-2",children:[20,40,80,120].map(s=>e.jsxs("button",{type:"button",className:`rounded-full px-3 py-1.5 text-xs transition ${i.points===s?"bg-white/18 text-white":"bg-white/[0.06] text-white/55 hover:bg-white/[0.10]"}`,onClick:()=>r({points:s}),children:[s," xp"]},s))})]})})]})}];return e.jsx(Se,{open:a,onOpenChange:n,eyebrow:"Log work",title:"Log retroactive work",description:"Capture work that happened outside the timer so it counts toward progress and XP.",value:h,onChange:j,draftPersistenceKey:"settings.log-work",steps:A,submitLabel:"Log work",pending:l,pendingLabel:"Logging work…",error:_,onSubmit:async()=>{if(w(null),h.source==="new"&&h.title.trim().length===0){w("Add a title so Forge knows what work to create.");return}if(h.source==="existing"&&!h.taskId){w("Pick an existing task or switch to New task.");return}try{await f({taskId:h.source==="existing"&&h.taskId?h.taskId:void 0,title:h.source==="new"&&h.title.trim()?h.title.trim():void 0,description:h.description.trim()||void 0,owner:h.owner.trim()||void 0,projectId:h.projectId||null,status:h.status,points:h.points}),n(!1)}catch(i){w(i instanceof Error?i.message:"Could not log the work right now.")}}})}function Te({text:a}){const[n,l]=v.useState(!1),m=async()=>{try{await navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2200)}catch{}};return e.jsxs("button",{type:"button",onClick:()=>void m(),className:"flex items-center gap-1.5 rounded-full bg-white/[0.07] px-3 py-1.5 text-xs font-medium text-white/65 transition hover:bg-white/[0.12] hover:text-white",children:[n?e.jsx(Ce,{className:"size-3 text-emerald-400"}):e.jsx(Oe,{className:"size-3"}),n?"Copied":"Copy"]})}function te({label:a,children:n,copyText:l}){return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:a}),e.jsx(Te,{text:l??n})]}),e.jsx("pre",{className:"mt-3 overflow-x-auto rounded-[14px] bg-[rgba(8,13,28,0.78)] p-3 text-xs leading-6 text-white/78",children:e.jsx("code",{children:n})})]})}function ft({open:a,onOpenChange:n,state:l}){if(!l)return null;const{tokenString:m,agentLabel:p,onboarding:b}=l,f=JSON.stringify({baseUrl:b.forgeBaseUrl,apiToken:m,actorLabel:p,timeoutMs:b.defaultTimeoutMs},null,2),h=[`curl -s ${b.healthUrl} \\`,` -H "Authorization: Bearer ${m}" \\`,' -H "X-Forge-Source: agent" \\',` -H "X-Forge-Actor: ${p}"`].join(`
2
- `),j=["openclaw gateway restart",'openclaw agent --message "forge_get_operator_overview"'].join(`
3
- `);return e.jsx(dt,{open:a,onOpenChange:n,children:e.jsxs(ct,{children:[e.jsx(ht,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.82)] backdrop-blur-xl"}),e.jsxs(pt,{className:"fixed left-1/2 top-1/2 z-50 flex h-[min(52rem,calc(100vh-1rem))] w-[min(52rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-[34px] border border-[rgba(192,193,255,0.14)] bg-[linear-gradient(180deg,rgba(21,28,44,0.99),rgba(12,17,30,0.99))] shadow-[0_30px_90px_rgba(3,8,18,0.55)]",children:[e.jsx(xt,{className:"sr-only",children:"Token issued — setup instructions"}),e.jsx(mt,{className:"sr-only",children:"Your new agent token has been issued. Copy it now and follow the setup guide."}),e.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4 border-b border-white/8 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-full bg-[rgba(192,193,255,0.12)]",children:e.jsx(_e,{className:"size-5 text-[rgba(192,193,255,0.85)]"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Token issued"}),e.jsx("div",{className:"mt-0.5 font-display text-xl text-white",children:"Save your token now"})]})]}),e.jsx(ut,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close",className:"rounded-full bg-white/6 p-2 text-white/55 transition hover:bg-white/10 hover:text-white",children:e.jsx(qe,{className:"size-4"})})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:e.jsxs(gt.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"grid gap-5",children:[e.jsxs("div",{className:"rounded-[20px] border border-amber-400/18 bg-amber-400/[0.07] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{className:"text-amber-300",children:"One-time reveal"}),e.jsx("span",{className:"text-sm text-white/60",children:"This value will not be shown again."})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 rounded-[14px] bg-[rgba(8,13,28,0.78)] px-4 py-3",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs text-white/90",children:m}),e.jsx(Te,{text:m})]}),e.jsx("div",{className:"mt-2 text-xs text-white/45",children:"Forge stores only a hash — the raw token is unrecoverable after you close this dialog. If lost, rotate the token from the Agents settings page."})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-5 items-center justify-center rounded-full bg-white/12 text-xs font-semibold text-white",children:"1"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Add the token to your OpenClaw plugin config"})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4 text-sm leading-6 text-white/62",children:["Open your ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"openclaw.json"})," file and find the"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"forge"})," plugin entry under"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"plugins"}),". Add or replace its"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"params"})," with the config block below."]}),e.jsx("div",{className:"mt-3",children:e.jsx(te,{label:"Plugin params — paste into openclaw.json → plugins → forge → params",copyText:f,children:f})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-5 items-center justify-center rounded-full bg-white/12 text-xs font-semibold text-white",children:"2"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Restart the gateway and confirm the agent can connect"})]}),e.jsx(te,{label:"Run in terminal",copyText:j,children:j})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-5 items-center justify-center rounded-full bg-white/12 text-xs font-semibold text-white",children:"3"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Verify the token is accepted by the API"})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4 text-sm leading-6 text-white/62",children:["Run the curl below. A"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-emerald-300",children:"200 OK"})," response means the token works and the agent"," ",e.jsx("strong",{className:"text-white/80",children:p})," is authenticated."]}),e.jsx("div",{className:"mt-3",children:e.jsx(te,{label:"Verify token — run in terminal",copyText:h,children:h})})]}),e.jsxs("div",{className:"rounded-[18px] border border-white/6 bg-white/[0.03] px-4 py-3 text-sm leading-6 text-white/50",children:[e.jsx("strong",{className:"text-white/68",children:"Tip:"})," If you ever lose this token, go to ",e.jsx("strong",{className:"text-white/68",children:"Settings → Agents → Agent tokens"}),", find the entry, and click"," ",e.jsx("strong",{className:"text-white/68",children:"Rotate & reveal"})," to get a fresh value without creating a new agent identity."]})]})}),e.jsx("div",{className:"shrink-0 border-t border-white/8 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm text-white/45",children:"Token saved? Close this dialog when you are ready."}),e.jsxs(P,{onClick:()=>n(!1),children:[e.jsx(Ce,{className:"size-4"}),"Done"]})]})})]})]})})}function Q(a,n){return n.every(l=>a.scopes.includes(l))}function $(a){if(!a)return"Never";try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(a))}catch{return a}}function ke(a){return a==="connected"?"text-emerald-300":a==="stale"||a==="reconnecting"?"text-amber-300":a==="error"?"text-rose-300":"text-white/45"}function Nt(a){return a.some(n=>n.status==="connected")?"connected":a.some(n=>n.status==="reconnecting")?"reconnecting":a.some(n=>n.status==="error")?"error":a.some(n=>n.status==="stale")?"stale":"disconnected"}function kt(a){const n=new Map;for(const l of a){const m=l.agentId??`${l.provider}:${l.agentLabel}`,p=n.get(m);if(!p){n.set(m,{key:m,agentId:l.agentId,agentLabel:l.agentLabel,provider:l.provider,status:l.status,primary:l,sessions:[l],actionCount:l.actionCount,eventCount:l.eventCount});continue}p.sessions.push(l),p.actionCount+=l.actionCount,p.eventCount+=l.eventCount,p.sessions.sort((b,f)=>Date.parse(f.lastHeartbeatAt)-Date.parse(b.lastHeartbeatAt)),p.primary=p.sessions[0]??p.primary,p.status=Nt(p.sessions)}return Array.from(n.values()).sort((l,m)=>Date.parse(m.primary.lastHeartbeatAt)-Date.parse(l.primary.lastHeartbeatAt))}function Pe(a){return a.replaceAll("_"," ")}function Pt(a){const n=[];return a.scopePolicy.userIds.length>0?n.push(`${a.scopePolicy.userIds.length} user${a.scopePolicy.userIds.length===1?"":"s"}`):n.push("all visible users"),a.scopePolicy.projectIds.length>0&&n.push(`${a.scopePolicy.projectIds.length} project${a.scopePolicy.projectIds.length===1?"":"s"}`),a.scopePolicy.tagIds.length>0&&n.push(`${a.scopePolicy.tagIds.length} tag${a.scopePolicy.tagIds.length===1?"":"s"}`),n.join(" · ")}function Ot(){var ue,ge,ve,be,we,je;const a=Ke(),[n,l]=v.useState(!1),[m,p]=v.useState("operator"),[b,f]=v.useState(null),[h,j]=v.useState(!1),[_,w]=v.useState(!1),[A,i]=v.useState(!1),[r,s]=v.useState(null),y=F({queryKey:["forge-operator-session"],queryFn:st}),S=y.isSuccess,q=F({queryKey:["forge-settings"],queryFn:at,enabled:S}),Le=F({queryKey:["forge-approval-requests"],queryFn:it,enabled:S}),ae=F({queryKey:["forge-agent-onboarding"],queryFn:nt}),Y=F({queryKey:["forge-agent-runtime-sessions"],queryFn:rt,enabled:S}),J=F({queryKey:["forge-agent-runtime-session-history",r],queryFn:()=>ot(r),enabled:S&&!!r}),Ie=F({queryKey:["forge-operator-context"],queryFn:lt,enabled:S}),T=async()=>{await Promise.all([a.invalidateQueries({queryKey:["forge-operator-session"]}),a.invalidateQueries({queryKey:["forge-settings"]}),a.invalidateQueries({queryKey:["forge-approval-requests"]}),a.invalidateQueries({queryKey:["forge-agent-onboarding"]}),a.invalidateQueries({queryKey:["forge-agent-runtime-sessions"]}),a.invalidateQueries({queryKey:["forge-agent-runtime-session-history"]}),a.invalidateQueries({queryKey:["forge-operator-context"]})])},ie=I({mutationFn:t=>We(t),onSuccess:T}),ne=I({mutationFn:t=>Qe(t),onSuccess:async t=>{if(await T(),o){const d=t.token;f({tokenString:d.token,agentLabel:d.tokenSummary.agentLabel??"forge-agent",onboarding:o}),j(!0)}}}),re=I({mutationFn:t=>Xe(t),onSuccess:T}),oe=I({mutationFn:t=>Ge(t),onSuccess:T}),le=I({mutationFn:t=>Ye(t),onSuccess:T}),de=I({mutationFn:({sessionId:t,note:d})=>Je(t,d),onSuccess:T}),ce=I({mutationFn:({sessionId:t,note:d,lastError:c})=>Ze(t,{note:d,lastError:c}),onSuccess:T}),O=I({mutationFn:Ve,onSuccess:T}),N=(ue=q.data)==null?void 0:ue.settings,D=((ge=Le.data)==null?void 0:ge.approvalRequests)??[],o=(ve=ae.data)==null?void 0:ve.onboarding,he=v.useMemo(()=>{var t;return((t=Y.data)==null?void 0:t.sessions)??[]},[(be=Y.data)==null?void 0:be.sessions]),E=v.useMemo(()=>kt(he),[he]),R=J.data,x=(we=Ie.data)==null?void 0:we.context,L=(N==null?void 0:N.agentTokens.filter(t=>t.status==="active"))??[],pe=(o==null?void 0:o.recommendedScopes)??[],B=L.some(t=>Q(t,pe)),H=L.some(t=>Q(t,["rewards.manage"])),U=L.some(t=>Q(t,["psyche.write"])),K=L.some(t=>t.autonomyMode!=="approval_required"&&Q(t,["write"])),z=L.length>0,xe=E.filter(t=>t.status==="connected"),me=E.filter(t=>t.status==="stale"),Re=v.useMemo(()=>{if(!x)return[];const t=[...x.focusTasks,...x.currentBoard.backlog,...x.currentBoard.focus,...x.currentBoard.inProgress,...x.currentBoard.blocked,...x.currentBoard.done],d=new Map;for(const c of t)d.set(c.id,c);return[...d.values()]},[x]),Fe=(N==null?void 0:N.profile.operatorName)??"",Me=[{label:"Operator session",ok:!0,badge:"active",badgeTone:"emerald",detail:(je=y.data)!=null&&je.session?`Session open as ${y.data.session.actorLabel}. Works for localhost and Tailscale without a token.`:"Passwordless session is active for local and Tailscale access.",action:null},{label:"Agent token",ok:z,badge:z?`${L.length} active`:"none issued",badgeTone:z?"emerald":"amber",detail:z?`${L.length} active token${L.length===1?"":"s"} allow external agents and scripts to authenticate.`:"No token yet. Issue one to let external agents connect via the API.",action:z?null:{label:"Issue token",preset:"operator",onClick:()=>{p("operator"),l(!0)}}},{label:"Full operator bundle",ok:B,badge:B?"ready":"optional",badgeTone:B?"emerald":"neutral",detail:B?"A token covers all recommended scopes for full operator collaboration.":"No token covers the full recommended scope bundle. Issue one to unlock complete agent collaboration.",action:B?null:{label:"Set up",preset:"operator",onClick:()=>{p("operator"),l(!0)}}},{label:"Reward control",ok:H,badge:H?"ready":"optional",badgeTone:H?"emerald":"neutral",detail:H?"An agent can tune reward rules and issue bonus XP grants.":"No token has rewards.manage — agents cannot adjust XP rules or issue bonuses.",action:H?null:{label:"Add scope",preset:"operator",onClick:()=>{p("operator"),l(!0)}}},{label:"Psyche writes",ok:U,badge:U?"ready":"optional",badgeTone:U?"emerald":"neutral",detail:U?"Sensitive Psyche collaboration is enabled — agents can create and update therapeutic records.":"No token has psyche.write — agent collaboration on sensitive Psyche records is disabled.",action:U?null:{label:"Add scope",preset:"operator",onClick:()=>{p("operator"),l(!0)}}},{label:"Scoped writes",ok:K,badge:K?"ready":"optional",badgeTone:K?"emerald":"neutral",detail:K?"A trusted agent can write without constant approval prompts.":"All write tokens are approval-required. Agents must queue every mutation for your review.",action:K?null:{label:"Configure",preset:"operator",onClick:()=>{p("operator"),l(!0)}}}];return y.isLoading||q.isLoading?e.jsx(et,{eyebrow:"Settings · Agents",title:"Loading agent console",description:"Establishing the operator session and loading agent configuration.",columns:2,blocks:6}):y.isError?e.jsx(ye,{eyebrow:"Settings · Agents",error:y.error,onRetry:()=>void y.refetch()}):q.isError||!N?e.jsx(ye,{eyebrow:"Settings · Agents",error:q.error??new Error("Could not load settings."),onRetry:()=>void q.refetch()}):e.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[e.jsx(bt,{title:"Agents",description:"Connection status, capability access, tokens, approval queue, and work logging."}),e.jsx(vt,{}),e.jsx(jt,{open:n,onOpenChange:l,pending:ie.isPending,initialPreset:m,defaultAgentLabel:(o==null?void 0:o.defaultActorLabel)??"OpenClaw",recommendedScopes:pe,onSubmit:async t=>{const d=await ie.mutateAsync(t);l(!1),o&&(f({tokenString:d.token.token,agentLabel:t.agentLabel,onboarding:o}),j(!0))}}),e.jsx(ft,{open:h,onOpenChange:j,state:b}),e.jsx(yt,{open:_,onOpenChange:w,pending:O.isPending,defaultOwner:Fe,availableTasks:Re,availableProjects:(x==null?void 0:x.activeProjects)??[],onSubmit:async t=>{await O.mutateAsync(t)}}),e.jsxs("div",{className:"grid gap-5",children:[x?e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsx(W,{label:"Active sessions",value:xe.length,tone:"core"}),e.jsx(W,{label:"Stale sessions",value:me.length,tone:"core"}),e.jsx(W,{label:"Pending approvals",value:D.filter(t=>t.status==="pending").length,tone:"core"}),e.jsx(W,{label:"Operator level",value:x.xp.profile.level,tone:"core",detail:`${x.xp.profile.totalXp} total XP`})]}):null,e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Capability status"}),e.jsx("div",{className:"mt-4 grid gap-3",children:Me.map(t=>e.jsxs("div",{className:"flex items-start justify-between gap-4 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"font-medium text-white",children:t.label}),e.jsx(g,{className:t.badgeTone==="emerald"?"text-emerald-300":t.badgeTone==="amber"?"text-amber-300":"text-white/45",children:t.badge})]}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-white/55",children:t.detail})]}),t.action?e.jsxs("button",{type:"button",onClick:t.action.onClick,className:"mt-0.5 flex shrink-0 items-center gap-1.5 rounded-full bg-white/[0.07] px-3 py-1.5 text-xs font-medium text-white/72 transition hover:bg-white/[0.12] hover:text-white",children:[t.action.label,e.jsx(De,{className:"size-3"})]}):null]},t.label))})]}),e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Runtime sessions"}),e.jsx("div",{className:"mt-1 text-sm text-white/55",children:"Live OpenClaw, Hermes, and Codex sessions registered against this Forge runtime, with stale detection and reconnect guidance."})]}),E.length>0?e.jsxs(g,{className:"text-white/60",children:[xe.length," live · ",me.length," stale"]}):null]}),e.jsx("div",{className:"mt-4 grid gap-3",children:Y.isLoading?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"Loading agent runtime sessions…"}):E.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"No runtime sessions have registered yet. OpenClaw, Hermes, and Codex now self-register here when their Forge adapter starts."}):E.map(t=>{const d=t.primary;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"font-medium text-white",children:t.agentLabel}),e.jsx(g,{className:ke(t.status),children:t.status})]}),e.jsxs("div",{className:"mt-1 text-sm text-white/52",children:[t.provider," · ",d.connectionMode.replaceAll("_"," ")," · last heartbeat"," ",$(d.lastHeartbeatAt)]}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-white/42",children:[e.jsxs("span",{children:[t.sessions.length," runtime session",t.sessions.length===1?"":"s"]}),e.jsxs("span",{children:["Current key ",d.sessionKey]}),e.jsxs("span",{children:[t.actionCount," recorded actions"]}),e.jsxs("span",{children:[t.eventCount," session events"]})]}),d.lastError?e.jsx("div",{className:"mt-3 text-sm text-rose-200/82",children:d.lastError}):null]}),e.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[t.status!=="connected"?e.jsx(P,{variant:"secondary",size:"sm",pending:de.isPending,pendingLabel:"Requesting",onClick:()=>void de.mutateAsync({sessionId:d.id}),children:"Reconnect"}):null,e.jsx(P,{variant:"secondary",size:"sm",onClick:()=>s(c=>c===d.id?null:d.id),children:r===d.id?"Hide history":"View history"}),t.status!=="disconnected"?e.jsx(P,{variant:"ghost",size:"sm",pending:ce.isPending,pendingLabel:"Closing",onClick:()=>void ce.mutateAsync({sessionId:d.id,note:"Marked disconnected from the Forge agents console."}),children:"Mark offline"}):null]})]}),d.recentEvents.length>0?e.jsx("div",{className:"mt-4 grid gap-2",children:d.recentEvents.slice(0,3).map(c=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[16px] bg-[rgba(255,255,255,0.03)] px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-white",children:c.title}),e.jsx("div",{className:"mt-0.5 text-xs leading-5 text-white/48",children:c.summary||c.eventType})]}),e.jsx("div",{className:"shrink-0 text-xs text-white/35",children:$(c.createdAt)})]},c.id))}):null,e.jsxs("div",{className:"mt-4 rounded-[16px] bg-[rgba(8,13,28,0.52)] p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Reconnect plan"}),e.jsx("div",{className:"mt-2 text-sm text-white/62",children:d.reconnectPlan.summary}),e.jsx("pre",{className:"mt-3 overflow-x-auto text-xs leading-6 text-white/70",children:e.jsx("code",{children:d.reconnectPlan.commands.join(`
4
- `)})})]}),t.sessions.length>1?e.jsxs("div",{className:"mt-4 rounded-[16px] bg-[rgba(8,13,28,0.38)] p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Session history under this agent"}),e.jsx("div",{className:"mt-2 grid gap-2",children:t.sessions.slice(0,6).map(c=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-[12px] bg-white/[0.035] px-3 py-2 text-xs text-white/50",children:[e.jsx("span",{className:"min-w-0 truncate",children:c.sessionKey}),e.jsxs("span",{className:ke(c.status),children:[c.status," · ",$(c.lastHeartbeatAt)]})]},c.id))})]}):null,r===d.id?e.jsxs("div",{className:"mt-4 rounded-[16px] bg-[rgba(8,13,28,0.52)] p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Work history"}),J.isLoading?e.jsx("div",{className:"mt-3 text-sm text-white/55",children:"Loading session history…"}):J.isError?e.jsx("div",{className:"mt-3 text-sm text-rose-200/82",children:"Could not load session history."}):(R==null?void 0:R.session.id)===d.id?e.jsxs("div",{className:"mt-3 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Agent actions"}),e.jsx("div",{className:"mt-2 grid gap-2",children:R.actions.length>0?R.actions.map(c=>e.jsxs("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"text-sm text-white",children:c.title}),e.jsx(g,{className:"text-white/55",children:c.status})]}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/48",children:c.summary||c.actionType}),e.jsx("div",{className:"mt-1 text-xs text-white/35",children:$(c.createdAt)})]},c.id)):e.jsx("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5 text-sm text-white/50",children:"No recorded agent actions for this session yet."})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Session events"}),e.jsx("div",{className:"mt-2 grid gap-2",children:R.events.length>0?R.events.map(c=>e.jsxs("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"text-sm text-white",children:c.title}),e.jsx(g,{className:"text-white/55",children:c.level})]}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/48",children:c.summary||c.eventType}),e.jsx("div",{className:"mt-1 text-xs text-white/35",children:$(c.createdAt)})]},c.id)):e.jsx("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5 text-sm text-white/50",children:"No session events recorded yet."})})]})]}):null]}):null]},t.key)})})]}),e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Agent tokens"}),e.jsxs(P,{size:"sm",variant:"secondary",onClick:()=>{p("operator"),l(!0)},children:[e.jsx(Ee,{className:"size-3.5"}),"Issue token"]})]}),e.jsx("div",{className:"mt-4 grid gap-3",children:N.agentTokens.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"No tokens yet. Issue one to let external agents or scripts authenticate with Forge."}):N.agentTokens.map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsxs("div",{className:"mt-0.5 text-sm text-white/50",children:[t.agentLabel??"Unassigned agent"," ·"," ",e.jsx("span",{className:"font-mono text-xs",children:t.tokenPrefix})]})]}),e.jsx(g,{className:t.status==="active"?"text-emerald-300":"text-white/45",children:t.status})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs text-white/55",children:[e.jsx("span",{children:t.trustLevel}),e.jsx("span",{children:"·"}),e.jsx("span",{children:t.autonomyMode.replaceAll("_"," ")}),e.jsx("span",{children:"·"}),e.jsx("span",{children:t.approvalMode.replaceAll("_"," ")})]}),e.jsxs("div",{className:"mt-2 text-xs text-white/45",children:["Bootstrap: ",Pe(t.bootstrapPolicy.mode)," · ",t.bootstrapPolicy.projectsLimit," projects"," · ",t.bootstrapPolicy.tasksLimit," tasks",t.bootstrapPolicy.includePeoplePages?` · ${t.bootstrapPolicy.peoplePageLimit} people pages`:" · no people pages"]}),e.jsxs("div",{className:"mt-1 text-xs text-white/45",children:["Default read scope: ",Pt(t)]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:["write","rewards.manage","psyche.write"].map(d=>e.jsx(g,{className:t.scopes.includes(d)?"text-emerald-300":"text-white/30",children:d},d))}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(P,{variant:"secondary",size:"sm",pending:ne.isPending,pendingLabel:"Rotating",onClick:()=>void ne.mutateAsync(t.id),children:"Rotate & reveal new token"}),e.jsx(P,{variant:"ghost",size:"sm",pending:re.isPending,pendingLabel:"Revoking",onClick:()=>void re.mutateAsync(t.id),children:"Revoke"})]})]},t.id))}),e.jsx("div",{className:"mt-3 px-1 text-xs text-white/35",children:"Raw token values are shown once and are never recoverable. If a token is lost, rotate or issue a new one."})]}),N.agents.length>0?e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Connected agents"}),e.jsx("div",{className:"mt-4 grid gap-3",children:N.agents.map(t=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),t.description?e.jsx("div",{className:"mt-1 text-sm text-white/52",children:t.description}):null,t.linkedUsers.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:t.linkedUsers.map(d=>{var c;return e.jsx(g,{className:"text-white/55",children:((c=d.user)==null?void 0:c.displayName)??d.userId},d.userId)})}):null,e.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-sm text-white/55",children:[e.jsx("span",{children:t.agentType}),t.identityKey?e.jsx("span",{className:"font-mono text-xs",children:t.identityKey}):null,e.jsx("span",{children:t.autonomyMode.replaceAll("_"," ")}),e.jsxs("span",{children:[t.activeTokenCount," active token",t.activeTokenCount!==1?"s":""]})]})]}),e.jsx(g,{className:"text-white/60",children:t.trustLevel})]},t.id))})]}):null,x?e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]",children:[e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Recommended next move"}),x.recommendedNextTask?e.jsxs("div",{className:"mt-4 grid gap-2",children:[e.jsx(Z,{kind:"task",label:x.recommendedNextTask.title,variant:"heading",size:"lg"}),e.jsx("div",{className:"text-sm leading-6 text-white/58",children:x.recommendedNextTask.description||"No extra notes yet."}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.jsx(g,{children:x.recommendedNextTask.status.replaceAll("_"," ")}),e.jsxs(g,{children:[x.recommendedNextTask.points," xp"]}),e.jsx(g,{children:x.recommendedNextTask.owner})]})]}):e.jsx("div",{className:"mt-4 text-sm text-white/55",children:"Board is clear. No recommended task right now."})]}),e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Board pulse"}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[{label:"Backlog",value:x.currentBoard.backlog.length},{label:"Focus",value:x.currentBoard.focus.length},{label:"In progress",value:x.currentBoard.inProgress.length},{label:"Blocked",value:x.currentBoard.blocked.length}].map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:t.label}),e.jsx("div",{className:"mt-2 font-display text-3xl text-white",children:t.value})]},t.label))})]})]}):null,x&&x.activeProjects.length>0?e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Active projects"}),e.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:x.activeProjects.slice(0,6).map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx(Z,{kind:"project",label:t.title}),e.jsxs(g,{children:[t.progress,"%"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(tt,{kind:"goal",label:t.goalTitle,compact:!0,gradient:!1})}),e.jsxs("div",{className:"mt-2 text-xs text-white/38",children:[t.activeTaskCount," active ·"," ",t.completedTaskCount," done"]})]},t.id))})]}):null,e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Approval queue"}),D.filter(t=>t.status==="pending").length>0?e.jsxs(g,{className:"text-amber-300",children:[D.filter(t=>t.status==="pending").length," pending"]}):null]}),e.jsx("div",{className:"mt-4 grid gap-3",children:D.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"No pending approvals. Agent actions are flowing through."}):D.map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-white",children:t.title}),e.jsx("div",{className:"mt-0.5 text-sm text-white/55",children:t.summary||t.actionType})]}),e.jsx(g,{className:t.status==="pending"?"text-amber-300":"text-white/45",children:t.status})]}),t.status==="pending"?e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(P,{variant:"secondary",size:"sm",pending:oe.isPending,pendingLabel:"Approving",onClick:()=>void oe.mutateAsync(t.id),children:"Approve"}),e.jsx(P,{variant:"ghost",size:"sm",pending:le.isPending,pendingLabel:"Rejecting",onClick:()=>void le.mutateAsync(t.id),children:"Reject"})]}):null]},t.id))})]}),e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Retroactive work log"}),e.jsx("div",{className:"mt-1 text-sm text-white/55",children:"Capture work done outside the timer so it counts toward progress and XP."})]}),e.jsxs(P,{variant:"secondary",size:"sm",onClick:()=>w(!0),children:[e.jsx(Be,{className:"size-3.5"}),"Log work"]})]}),O.data?e.jsxs("div",{className:"mt-4 rounded-[18px] bg-[rgba(192,193,255,0.10)] px-4 py-3 text-sm text-white",children:["Logged"," ",e.jsx("span",{className:"inline-block align-middle",children:e.jsx(Z,{kind:"task",label:O.data.task.title,showKind:!1})}),". Operator XP updated to ",O.data.xp.profile.totalXp,"."]}):null]}),e.jsxs(k,{children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-4 text-left",onClick:()=>i(t=>!t),children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Connection & onboarding"}),o?e.jsx("div",{className:"mt-1 text-sm text-white/55",children:o.forgeBaseUrl}):null]}),A?e.jsx(He,{className:"size-4 shrink-0 text-white/38"}):e.jsx(Ue,{className:"size-4 shrink-0 text-white/38"})]}),A&&o?e.jsxs("div",{className:"mt-5 grid gap-4",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Forge API"}),e.jsx("div",{className:"mt-2 break-all text-sm text-white",children:o.forgeBaseUrl})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Web app"}),e.jsx("div",{className:"mt-2 break-all text-sm text-white",children:o.webAppUrl})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"OpenAPI spec"}),e.jsx("div",{className:"mt-2 break-all text-sm text-white",children:o.openApiUrl})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Default policy"}),e.jsxs("div",{className:"mt-2 text-sm text-white",children:[o.recommendedTrustLevel," ·"," ",o.recommendedAutonomyMode.replaceAll("_"," ")," ·"," ",o.recommendedApprovalMode.replaceAll("_"," ")]}),e.jsxs("div",{className:"mt-2 text-xs text-white/45",children:["Bootstrap default:"," ",Pe(o.defaultBootstrapPolicy.mode)," · ",o.defaultBootstrapPolicy.projectsLimit," projects"," · ",o.defaultBootstrapPolicy.tasksLimit," tasks"]})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:o.authModes.operatorSession.label}),e.jsx(g,{className:"mt-1 text-emerald-300",children:o.defaultConnectionMode==="operator_session"?"default":"available"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.authModes.operatorSession.summary}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.authModes.operatorSession.trustedTargets.map(t=>e.jsx(g,{className:"text-white/65",children:t},t))})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:o.authModes.managedToken.label}),e.jsx(g,{className:"mt-1 text-white/55",children:"optional"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.authModes.managedToken.summary}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/48",children:o.tokenRecovery.rotationSummary})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Shared runtime"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:"Keep Forge, OpenClaw, Hermes, and the browser on the same runtime when they should see one shared user directory, one strategy graph, and one task history."}),e.jsxs("div",{className:"mt-3 text-xs leading-5 text-white/46",children:["Base URL: ",o.forgeBaseUrl]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Agent identity"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:"Create each agent as a bot user, then write with that user's `userId`. The relationship graph in Settings -> Users controls what each direction can see, message, share, plan, and affect."}),e.jsx("div",{className:"mt-3 text-xs leading-5 text-white/46",children:"Cross-owner links stay valid even when ownership differs."})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Contract timing"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:"Leave strategies editable while humans and bots refine the graph. Lock them only when the plan becomes the contract the alignment metrics should judge."}),e.jsx("div",{className:"mt-3 text-xs leading-5 text-white/46",children:"Coverage, sequencing, scope discipline, and quality all contribute to alignment now."})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Fast onboarding checklist"}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:[e.jsx("div",{children:"1. Create the human and bot users in Settings -> Users."}),e.jsx("div",{children:"2. Keep the default graph permissive until collaboration is flowing cleanly."}),e.jsx("div",{children:"3. Point OpenClaw and Hermes at the same Forge runtime and storage root when they should collaborate."}),e.jsx("div",{children:"4. Give each adapter a distinct actor label so activity stays readable."}),e.jsx("div",{children:"5. Build strategies as drafts first, then lock when the plan is ready to become the contract."})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Rights language"}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:[e.jsx("div",{children:"`See` means discover, search, and read another owner."}),e.jsx("div",{children:"`Message` means coordinate and hand off through Forge."}),e.jsx("div",{children:"`Plan` means draft or edit that owner's strategies."}),e.jsx("div",{children:"`Affect` means create or mutate that owner's work."})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Strategy lifecycle"}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:[e.jsx("div",{children:"1. Save an incomplete draft while the plan is still being negotiated."}),e.jsx("div",{children:"2. Let humans and bots refine targets, nodes, and sequence together."}),e.jsx("div",{children:"3. Lock only when the graph becomes the contract for alignment."}),e.jsx("div",{children:"4. Unlock only when the contract itself is being renegotiated."})]})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Quick-connect verification"}),e.jsx("pre",{className:"mt-3 overflow-x-auto rounded-[16px] bg-[rgba(8,13,28,0.78)] p-4 text-xs leading-6 text-white/72",children:e.jsx("code",{children:[`curl -s ${o.healthUrl}`,"openclaw plugins install ./projects/forge","openclaw gateway restart"].join(`
5
- `)})})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Required API headers"}),e.jsxs("div",{className:"mt-3 grid gap-1 text-sm text-white/60",children:[e.jsx("div",{children:o.requiredHeaders.authorization}),e.jsx("div",{children:o.requiredHeaders.source}),e.jsx("div",{children:o.requiredHeaders.actor})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Session registry"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.sessionRegistry.summary}),e.jsxs("div",{className:"mt-3 grid gap-1 text-xs leading-5 text-white/46",children:[e.jsxs("div",{children:["Register: ",o.sessionRegistry.registerUrl]}),e.jsxs("div",{children:["Heartbeat: ",o.sessionRegistry.heartbeatUrl]}),e.jsxs("div",{children:["Events: ",o.sessionRegistry.eventsUrl]})]})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:[o.connectionGuides.openclaw,o.connectionGuides.hermes,o.connectionGuides.codex].map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsx("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:t.installSteps.map(d=>e.jsx("div",{children:d},d))}),e.jsx("pre",{className:"mt-4 overflow-x-auto rounded-[16px] bg-[rgba(8,13,28,0.78)] p-4 text-xs leading-6 text-white/72",children:e.jsx("code",{children:t.verifyCommands.join(`
6
- `)})}),e.jsx("div",{className:"mt-3 grid gap-1 text-sm leading-6 text-white/48",children:t.configNotes.map(d=>e.jsx("div",{children:d},d))})]},t.label))}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Multi-user model"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.multiUserModel.summary}),e.jsx("div",{className:"mt-3 grid gap-1 text-sm leading-6 text-white/48",children:o.multiUserModel.routeScoping.map(t=>e.jsx("div",{children:t},t))})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Strategy contracts"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.strategyContractModel.lockSummary}),e.jsx("div",{className:"mt-3 grid gap-1 text-sm leading-6 text-white/48",children:o.strategyContractModel.metricBreakdown.map(t=>e.jsx("div",{children:t},t))})]})]})]}):A&&ae.isError?e.jsx("div",{className:"mt-4 rounded-[18px] bg-[rgba(120,33,33,0.22)] px-4 py-3 text-sm text-rose-100/80",children:"Could not load the onboarding contract. Check the API bridge."}):A?e.jsx("div",{className:"mt-4 text-sm text-white/50",children:"Loading…"}):null]})]})]})}export{Ot as SettingsAgentsPage};
@@ -1 +0,0 @@
1
- import{r as p,j as e,b3 as z,d0 as k,c7 as T}from"./vendor-DHkYh85p.js";import{j as q,i as E,k as h}from"./state-B-4sS1xO.js";import{S as F}from"./settings-section-nav-DSOuht_F.js";import{dV as R,dW as C,S as Q,E as B,C as g,I as K,Z as $,B as x,b as W,dx as H,dX as V}from"./index-CF4J4R9L.js";import{P as G}from"./page-hero-DRy5b2MU.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const r={goal:"Goals",project:"Projects",task:"Tasks",strategy:"Strategies",habit:"Habits",tag:"Tags",note:"Notes",insight:"Insights",psyche_value:"Values",behavior_pattern:"Patterns",behavior:"Behaviors",belief_entry:"Beliefs",mode_profile:"Modes",mode_guide_session:"Mode guides",flashcard:"Flashcards",event_type:"Event types",emotion_definition:"Emotions",trigger_report:"Reports",calendar_event:"Calendar events",work_block_template:"Work blocks",task_timebox:"Timeboxes",preference_catalog:"Preference catalogs",preference_catalog_item:"Preference catalog items",preference_context:"Preference contexts",preference_item:"Preference items",questionnaire_instrument:"Questionnaires",sleep_session:"Sleep sessions",workout_session:"Workout sessions"},Y={goal:"goal",project:"project",task:"task",strategy:"strategy",habit:"habit",tag:null,note:null,insight:"report",psyche_value:"value",behavior_pattern:"pattern",behavior:"behavior",belief_entry:"belief",mode_profile:"mode",mode_guide_session:"mode",flashcard:"flashcard",event_type:null,emotion_definition:null,trigger_report:"report",calendar_event:null,work_block_template:null,task_timebox:null,preference_catalog:null,preference_catalog_item:null,preference_context:null,preference_item:null,questionnaire_instrument:null,sleep_session:null,workout_session:null};function O(y){return new Date(y).toLocaleString()}function re(){var N,S;const y=q(),[f,A]=p.useState(""),[l,D]=p.useState([]),d=E({queryKey:["forge-operator-session"],queryFn:H}),P=d.isSuccess,o=E({queryKey:["forge-settings-bin"],queryFn:V,enabled:P}),m=async()=>{await y.invalidateQueries({predicate:t=>Array.isArray(t.queryKey)&&typeof t.queryKey[0]=="string"&&t.queryKey[0].startsWith("forge-")})},b=h({mutationFn:t=>R({operations:[{entityType:t.entityType,id:t.entityId}]}),onSuccess:m}),v=h({mutationFn:t=>C({operations:[{entityType:t.entityType,id:t.entityId,mode:"hard"}]}),onSuccess:m}),j=h({mutationFn:t=>R({operations:t.map(s=>({entityType:s.entityType,id:s.entityId}))}),onSuccess:m}),w=h({mutationFn:t=>C({operations:t.map(s=>({entityType:s.entityType,id:s.entityId,mode:"hard"}))}),onSuccess:m}),c=((N=o.data)==null?void 0:N.bin.records)??[],u=f.trim().toLowerCase(),a=p.useMemo(()=>c.filter(t=>l.length===0||l.includes(t.entityType)?u?[t.title,t.subtitle??"",t.entityType,t.entityId,t.deletedByActor??"",t.deletedSource??"",t.deleteReason??""].join(" ").toLowerCase().includes(u):!0:!1),[u,c,l]),_=p.useMemo(()=>{const t=new Map;for(const s of a){const i=t.get(s.entityType)??[];i.push(s),t.set(s.entityType,i)}return[...t.entries()].sort((s,i)=>r[s[0]].localeCompare(r[i[0]]))},[a]),L=p.useMemo(()=>[...new Set(c.map(t=>t.entityType))].sort((t,s)=>r[t].localeCompare(r[s])),[c]);function M(t){D(s=>s.includes(t)?s.filter(i=>i!==t):[...s,t])}async function I(){a.length===0||!window.confirm(`Permanently delete ${a.length} item${a.length===1?"":"s"} from the bin? This cannot be undone.`)||await w.mutateAsync(a)}return d.isLoading||o.isLoading?e.jsx(Q,{eyebrow:"Settings",title:"Loading bin",description:"Loading deleted items and restore controls.",columns:2,blocks:6}):d.isError?e.jsx(B,{eyebrow:"Settings",error:d.error,onRetry:()=>void d.refetch()}):o.isError?e.jsx(B,{eyebrow:"Settings",error:o.error,onRetry:()=>void o.refetch()}):e.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[e.jsx(G,{title:"Bin",description:"Restore soft-deleted items or permanently remove them when you really mean it.",badge:`${((S=o.data)==null?void 0:S.bin.totalCount)??0} deleted items`}),e.jsx(F,{}),e.jsxs(g,{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-start",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Find deleted items"}),e.jsxs("div",{className:"relative",children:[e.jsx(z,{className:"pointer-events-none absolute left-4 top-1/2 size-4 -translate-y-1/2 text-white/35"}),e.jsx(K,{value:f,onChange:t=>A(t.target.value),placeholder:"Search title, id, reason, or source",className:"pl-11"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:L.map(t=>{const s=l.includes(t);return e.jsx("button",{type:"button",onClick:()=>M(t),className:$("rounded-full border px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",s?"border-[var(--primary)]/30 bg-[var(--primary)]/[0.16] text-[var(--primary)]":"border-white/10 bg-white/[0.04] text-white/58 hover:bg-white/[0.08] hover:text-white"),children:r[t]},t)})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 lg:max-w-[22rem] lg:justify-end",children:[e.jsxs(x,{variant:"secondary",size:"sm",disabled:a.length===0,pending:j.isPending,pendingLabel:"Restoring",onClick:()=>void j.mutateAsync(a),children:[e.jsx(k,{className:"size-4"}),e.jsx("span",{children:"Restore visible"})]}),e.jsxs(x,{variant:"secondary",size:"sm",disabled:a.length===0,pending:w.isPending,pendingLabel:"Deleting",onClick:()=>void I(),children:[e.jsx(T,{className:"size-4"}),e.jsx("span",{children:"Delete visible forever"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-sm text-white/55",children:[e.jsxs("span",{children:[a.length," visible"]}),l.length>0?e.jsxs("span",{children:[l.length," type filters active"]}):null,u?e.jsxs("span",{children:["Search: “",f.trim(),"”"]}):null]})]}),c.length===0?e.jsxs(g,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Deleted items"}),e.jsx("div",{className:"mt-4 text-white/72",children:"Nothing is in the bin right now."})]}):_.length===0?e.jsxs(g,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Deleted items"}),e.jsx("div",{className:"mt-4 text-white/72",children:"No deleted items match the current search or filters."})]}):e.jsx("div",{className:"grid gap-5",children:_.map(([t,s])=>{const i=Y[t];return e.jsxs(g,{children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[i?e.jsx(W,{kind:i,label:r[t],compact:!0}):null,i?null:e.jsx("div",{className:"rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-white/55",children:r[t]}),e.jsxs("div",{className:"text-sm text-white/55",children:[s.length," deleted"]})]})}),e.jsx("div",{className:"mt-4 grid gap-3",children:s.map(n=>e.jsxs("div",{className:"grid gap-3 rounded-[22px] border border-white/8 bg-white/[0.04] p-4 lg:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-medium text-white",children:n.title}),n.subtitle?e.jsx("div",{className:"mt-1 text-sm text-white/62",children:n.subtitle}):null,e.jsxs("div",{className:"mt-3 flex flex-wrap gap-3 text-xs text-white/45",children:[e.jsxs("span",{children:["Deleted ",O(n.deletedAt)]}),n.deletedByActor?e.jsxs("span",{children:["By ",n.deletedByActor]}):null,n.deletedSource?e.jsxs("span",{children:["Source ",n.deletedSource]}):null,n.deleteReason?e.jsxs("span",{children:["Reason: ",n.deleteReason]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-start justify-end gap-2",children:[e.jsxs(x,{variant:"secondary",size:"sm",pending:b.isPending,pendingLabel:"Restoring",onClick:()=>void b.mutateAsync(n),children:[e.jsx(k,{className:"size-4"}),e.jsx("span",{children:"Restore"})]}),e.jsxs(x,{variant:"secondary",size:"sm",pending:v.isPending,pendingLabel:"Deleting",onClick:()=>void v.mutateAsync(n),children:[e.jsx(T,{className:"size-4"}),e.jsx("span",{children:"Delete forever"})]})]})]},`${n.entityType}:${n.entityId}`))})]},t)})})]})}export{re as SettingsBinPage};
@@ -1,5 +0,0 @@
1
- import{j as e,cb as Me,df as Ee,aN as ur,bn as be,r as l,dh as pr,bF as Re,ce as mr,d6 as Pe,c2 as fr,cY as xr,c7 as vr,aV as Te}from"./vendor-DHkYh85p.js";import{j as ar,k as Q,i as Ue}from"./state-B-4sS1xO.js";import{C as Ge,dY as br,dZ as Qe,d_ as wr,d$ as yr,dj as He,e0 as Cr,F as D,j as jr,I as B,c as b,B as k,aq as Fr,n as De,Q as $e,a9 as Nr,e1 as Sr,e2 as kr,e3 as Ur,e4 as Ir,e5 as Mr,e6 as Er,e7 as Or,e8 as Ar,e9 as Lr,S as Rr,E as Ye,i as Gr,dx as Dr,b$ as _r,ea as Pr,eb as zr,ec as Tr}from"./index-CF4J4R9L.js";import{S as $r}from"./settings-section-nav-DSOuht_F.js";import{P as qr}from"./page-hero-DRy5b2MU.js";import{r as Vr,b as Kr,w as Wr}from"./calendar-display-preferences-Cid-2RnL.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const Xe=[{title:"Before you connect anything",description:"Forge mirrors provider events into Forge. Writable providers can also publish work blocks plus owned timeboxes into one shared Forge write target, while Exchange Online stays read-only for now.",bullets:["Google uses a localhost Authorization Code + PKCE flow. Each user signs in with their own Google account on the same machine running Forge, while Forge stores that user's refresh token on the server for background sync.","Calendars On This Mac uses EventKit to access the calendars already configured in Calendar.app on the host machine, including iCloud, Google, Exchange, and other accounts the Mac is already syncing.","Apple Calendar starts from https://caldav.icloud.com and autodiscovers the real principal plus calendar collections for you.","Exchange Online uses Microsoft Graph with a guided local public-client Microsoft sign-in flow and mirrors the calendars you select into Forge.","Custom CalDAV uses one account-level base URL, then Forge discovers the writable calendars before you choose what to mirror.","Read-only .ics feeds are not enough for writable-provider flows because Forge needs write access for work blocks and task timeboxes."],icon:Me,links:[]},{title:"Calendars On This Mac setup",description:"Use this path when the Mac already has the needed accounts connected in Calendar.app and Forge should sync them through EventKit instead of reconnecting each provider manually.",bullets:["Open Forge on the same Mac whose Calendar.app already contains the accounts you want to mirror.","Choose Calendars On This Mac in Forge settings.","Grant Calendar full access when macOS prompts for it, or re-enable it later in System Settings -> Privacy & Security -> Calendars.","Let Forge discover the available host calendar sources and pick the source account you want to sync.","Choose which calendars Forge should mirror. If Forge already has a write target on another writable connection, this new connection can reuse it instead of creating another Forge calendar.","If Forge already syncs the same account through Google, Apple, CalDAV, or Microsoft, the macOS-local connection replaces the older remote one instead of keeping two visible copies."],icon:Me,links:[]},{title:"Google Calendar setup",description:"Use one Google Cloud desktop-app OAuth client for local Forge, register the exact localhost callback URI, and let Forge complete the Authorization Code + PKCE exchange on the backend.",bullets:["Open Google Cloud credentials and create or reuse one OAuth client for Forge as a Desktop app.","Enable the Calendar API for the same project.","Register Forge's exact callback URI. In local Forge, the default callback is http://127.0.0.1:4317/api/v1/calendar/oauth/google/callback.","Open Forge on localhost on the same machine that is running Forge. If Forge is opened remotely from a phone or a Tailscale route while the callback is localhost, Google will redirect to localhost on that device and the flow will fail.","The user signs in with their own Google account and grants Forge access. They do not create their own Google OAuth client during this step.","Forge will discover the calendars, let you choose which calendars to mirror, and create or reuse Forge as the write calendar."],icon:Ee,links:[{label:"Google Cloud credentials",href:"https://console.cloud.google.com/apis/credentials"},{label:"Calendar API quickstart",href:"https://developers.google.com/workspace/calendar/api/quickstart"}]},{title:"Apple Calendar setup",description:"Apple does not require you to paste raw calendar collection URLs into Forge. Start with your Apple ID email, an app-specific password, and the iCloud CalDAV base URL.",bullets:["Create an Apple app-specific password for third-party calendar access.","Open Forge settings and choose Apple Calendar.","Enter the Apple ID email and the app-specific password. Forge uses https://caldav.icloud.com for autodiscovery.","After discovery, choose which calendars Forge should mirror.","If a calendar named Forge already exists, Forge will preselect it as the write calendar. Otherwise you can ask Forge to create it for you."],icon:ur,links:[{label:"Apple app-specific passwords",href:"https://support.apple.com/en-us/102654"},{label:"Use iCloud Calendar with third-party apps",href:"https://support.apple.com/guide/icloud/set-up-calendar-mmfc0f2442/icloud"}]},{title:"Exchange Online setup",description:"Use Microsoft Graph for Microsoft 365 or Exchange Online calendars. In self-hosted local Forge, the user first saves a Microsoft public client ID, tenant, and redirect URI in Settings -> Calendar, then completes a guided local sign-in flow with PKCE. The connection is still read-only in Forge today.",bullets:["Open Microsoft Entra App registrations and create or reuse an app for this local Forge instance.","Choose a supported account type that matches your self-hosted use case. Use a broad multi-account setup when Forge should work with normal personal or organizational Microsoft sign-ins.","Enable mobile and desktop or public client flow support for that app registration.","Add Forge's callback URI to the redirect URI list. The default local callback is http://127.0.0.1:4317/api/v1/calendar/oauth/microsoft/callback.","Add delegated Graph permissions for User.Read and Calendars.Read, then grant or request consent as required by the tenant.","Open Forge Settings -> Calendar and save the Microsoft client ID, tenant value, and redirect URI in the Exchange Online setup card.","Use Test Microsoft configuration to confirm Forge can launch the local sign-in flow.","Click Sign in with Microsoft, complete the popup flow, and then choose which Exchange Online calendars Forge should mirror."],icon:Ee,links:[{label:"Microsoft Graph permissions",href:"https://learn.microsoft.com/en-us/graph/permissions-reference"},{label:"Microsoft identity platform",href:"https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow"},{label:"Microsoft Graph calendar overview",href:"https://learn.microsoft.com/en-us/graph/api/resources/calendar?view=graph-rest-1.0"}]},{title:"Custom CalDAV setup",description:"Use this path for Nextcloud, Fastmail, Baikal, DAViCal, and other CalDAV-compatible providers that expose an account-level base URL.",bullets:["Confirm the provider supports CalDAV, not just an .ics export.","Gather the account-level CalDAV server URL, username, and password or app password.","Open Forge settings and choose Custom CalDAV.","Forge discovers the available calendars from that base URL before anything is saved.","Choose which calendars to mirror and either select an existing Forge calendar or let Forge create one automatically."],icon:Me,links:[]}];function Br(t){if(!t)return Xe;const c=t==="google"?"Google Calendar setup":t==="macos_local"?"Calendars On This Mac setup":t==="apple"?"Apple Calendar setup":t==="microsoft"?"Exchange Online setup":"Custom CalDAV setup";return Xe.filter(p=>p.title==="Before you connect anything"||p.title===c)}function Qr({section:t,compact:c}){const p=t.icon;return e.jsxs(Ge,{className:c?"grid gap-3 rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(18,28,38,0.98),rgba(11,17,28,0.98))] p-4":"grid gap-4 rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(18,28,38,0.98),rgba(11,17,28,0.98))]",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"rounded-[18px] bg-[var(--primary)]/14 p-3 text-[var(--primary)]",children:e.jsx(p,{className:c?"size-4":"size-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:c?"font-medium text-white":"font-display text-[1.15rem] text-white",children:t.title}),e.jsx("p",{className:c?"mt-1.5 text-sm leading-6 text-white/62":"mt-2 max-w-3xl text-sm leading-6 text-white/62",children:t.description})]})]}),e.jsx("div",{className:c?"grid gap-1.5":"grid gap-2",children:t.bullets.map(w=>e.jsx("div",{className:c?"rounded-[16px] bg-white/[0.04] px-3 py-2.5 text-sm leading-6 text-white/70":"rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/72",children:w},w))}),t.links.length>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:t.links.map(w=>e.jsxs("a",{href:w.href,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-10 items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white/74 transition hover:bg-white/[0.08] hover:text-white",children:[e.jsx(be,{className:"size-3.5"}),w.label]},w.href))}):null]})}function Hr({provider:t,compact:c=!1}){const p=Br(t);return e.jsx("div",{className:"grid gap-4",children:p.map(w=>e.jsx(Qr,{section:w,compact:c},w.title))})}const Ze="/api/v1/calendar/oauth/microsoft/callback",Yr=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,Je=1e3,_e={google:{label:"Primary Google",serverUrl:""},apple:{label:"Primary Apple",serverUrl:"https://caldav.icloud.com"},microsoft:{label:"Primary Exchange Online",serverUrl:""},macos_local:{label:"Calendars On This Mac",serverUrl:"forge-macos-local://eventkit/"},caldav:{label:"Primary CalDAV",serverUrl:"https://caldav.example.com"}};function ze(t){return{provider:t,label:_e[t].label,serverUrl:_e[t].serverUrl,username:"",password:"",selectedCalendarUrls:[],forgeCalendarUrl:null,createForgeCalendar:!1,sourceId:null,replaceConnectionIds:[]}}function oe(t,c){const p=c.trim();return p.length>0?p:_e[t].label}function Le(t){return{clientId:t.clientId,tenantId:t.tenantId,redirectUri:t.redirectUri}}function Ie(t){return{clientId:t.storedClientId??"",clientSecret:t.storedClientSecret??""}}function Xr(t){return t.replace(/\s*No GOOGLE_CLIENT_SECRET is used in this local PKCE flow\./gi,"").replace(/\s{2,}/g," ").trim()}function er(){return["Google OAuth credentials are not set for this Forge install.","- Save a Google desktop-app client ID and client secret below for this Forge install.","- Or rely on the packaged or environment defaults for the Forge runtime."].join(`
2
- `)}function rr(t,c){return[t,"- Open Forge from a local browser on the host running Forge.",`- Use one of these local addresses: ${c.join(", ")}.`].join(`
3
- `)}function nr(t){return{clientId:(t.clientId??"").trim(),clientSecret:(t.clientSecret??"").trim()}}function Zr(t,c){return t.clientId.trim()===c.clientId.trim()&&t.clientSecret.trim()===c.clientSecret.trim()}function Jr(t){const c=nr(t),p={},w=c.clientId.length>0,A=c.clientSecret.length>0;if(w!==A){const q="When overriding Google OAuth credentials, save the client ID and client secret together, or clear both to use the bundled defaults.";w||(p.clientId=q),A||(p.clientSecret=q)}return{normalized:c,issues:p,isValid:Object.keys(p).length===0}}function qe(t){return{clientId:t.clientId.trim(),tenantId:t.tenantId.trim()||"common",redirectUri:t.redirectUri.trim()}}function et(t){const c=qe(t),p={};if(c.clientId?Yr.test(c.clientId)||(p.clientId="Use the Microsoft app registration client ID GUID."):p.clientId="Microsoft client ID is required.",!c.redirectUri)p.redirectUri="Redirect URI is required.";else try{const w=new URL(c.redirectUri);w.protocol!=="http:"&&w.protocol!=="https:"?p.redirectUri="Redirect URI must use http or https.":w.pathname!==Ze&&(p.redirectUri=`Redirect URI must end with ${Ze}.`)}catch{p.redirectUri="Redirect URI must be a full URL."}return{normalized:c,issues:p,isValid:Object.keys(p).length===0}}function rt(t,c){return t.clientId.trim()===c.clientId.trim()&&t.tenantId.trim()===c.tenantId.trim()&&t.redirectUri.trim()===c.redirectUri.trim()}function Ve(t){return t==="127.0.0.1"||t==="localhost"}function tt(t){return t.endsWith(".ts.net")}function st(t){t.allowedOrigins.filter(w=>{try{return Ve(new URL(w).hostname)}catch{return!1}});const c=(()=>{try{return new URL(t.redirectUri).hostname}catch{return""}})();let p="";try{p=new URL(t.currentOrigin).hostname}catch{p=""}return tt(p)&&Ve(c)?`Google sign-in has to start from a local browser on the host running Forge. Forge is currently open through Tailscale at ${t.currentOrigin}, but Google sends the callback to localhost on the device that opens the popup. On a phone or another computer, that callback goes to that device instead of the Forge host.`:t.isLocalOnly?"Google sign-in has to start from a local browser on the host running Forge. Google sends the callback to localhost, so if Forge is opened remotely, the callback goes to the other device instead of the Forge host.":`Google sign-in is only enabled from the configured Forge host for this deployment. Open Forge on ${t.appBaseUrl}. Current browser origin: ${t.currentOrigin}.`}function at({open:t,onOpenChange:c,initialProvider:p="google",initialStepId:w,googleSetup:A,microsoftSetup:q,onCalendarSettingsChanged:H,existingConnections:ge=[],onSubmit:Y,pending:N=!1}){const we=ar(),[n,V]=l.useState(()=>ze(p)),[ye,m]=l.useState(null),[v,_]=l.useState(null),[U,ae]=l.useState("not_determined"),[C,P]=l.useState(null),[g,y]=l.useState(null),[u,X]=l.useState(null),[h,ue]=l.useState(A),[I,K]=l.useState(()=>Ie(A)),[z,le]=l.useState(()=>Ie(A)),[Oe,ne]=l.useState(!1),[Z,F]=l.useState(null),[T,pe]=l.useState(q),[S,ce]=l.useState(()=>Le(q)),[Ce,ie]=l.useState(()=>Le(q)),[me,L]=l.useState(null),M=l.useRef(null),fe=(r=[])=>{const a=new Set(r);return ge.find(i=>{var o;return a.has(i.id)?!1:typeof((o=i.config)==null?void 0:o.forgeCalendarUrl)=="string"&&i.config.forgeCalendarUrl.trim().length>0})??null},R=l.useMemo(()=>n.provider==="microsoft"?null:fe(n.replaceConnectionIds),[n.provider,n.replaceConnectionIds,ge]),E=R?R.accountLabel&&R.accountLabel.trim().length>0?`${R.label} · ${R.accountLabel}`:R.label:null,je=r=>(we.setQueryData(["forge-settings"],r),r.settings),s=()=>{y(null),M.current=null},d=()=>{X(null),M.current=null},f=r=>{_(r);const a=r.calendars.filter(o=>o.selectedByDefault).map(o=>o.url),i=r.calendars.find(o=>o.isForgeCandidate);V(o=>{const j=fe(o.replaceConnectionIds);return{...o,selectedCalendarUrls:o.selectedCalendarUrls.length>0?o.selectedCalendarUrls.filter(se=>r.calendars.some(Ne=>Ne.url===se)):a,forgeCalendarUrl:o.provider==="microsoft"||j?null:(i==null?void 0:i.url)??o.forgeCalendarUrl??null,createForgeCalendar:o.provider==="microsoft"||j?!1:o.createForgeCalendar&&!i}}),m(null)};l.useEffect(()=>{var r;if(!t){(r=M.current)==null||r.close(),M.current=null;return}m(null),_(null),V(ze(p)),s(),d(),P(null),ae("not_determined"),ne(!1),F(null),L(null)},[p,t]),l.useEffect(()=>{!t||n.provider!=="macos_local"||G.mutateAsync()},[n.provider,t]),l.useEffect(()=>{if(!t||!v||n.provider==="microsoft"||R||n.forgeCalendarUrl||n.createForgeCalendar)return;const r=v.calendars.find(a=>a.isForgeCandidate);r&&V(a=>a.provider==="microsoft"||a.forgeCalendarUrl||a.createForgeCalendar||fe(a.replaceConnectionIds)?a:{...a,forgeCalendarUrl:r.url})},[v,n.createForgeCalendar,n.forgeCalendarUrl,n.provider,t,R]),l.useEffect(()=>{if(!t)return;ue(A);const r=Ie(A);K(r),le(r),ne(!1),F(null)},[A,t]),l.useEffect(()=>{if(!t)return;pe(q);const r=Le(q);ce(r),ie(r),L(null)},[q,t]),l.useEffect(()=>{if(!t||!g||g.status!=="pending")return;const r=new URL(h.redirectUri).origin;let a=!1;const i=()=>{a||(a=!0,cr(g.sessionId).finally(()=>{a=!1}))},o=he=>{var Se,ke;he.origin===r&&(((Se=he.data)==null?void 0:Se.type)!=="forge:google-calendar-auth"||((ke=he.data)==null?void 0:ke.sessionId)!==g.sessionId||i())},j=()=>{i()},se=()=>{document.visibilityState==="visible"&&i()},Ne=window.setInterval(i,Je);return window.addEventListener("message",o),window.addEventListener("focus",j),document.addEventListener("visibilitychange",se),()=>{window.removeEventListener("message",o),window.removeEventListener("focus",j),document.removeEventListener("visibilitychange",se),window.clearInterval(Ne)}},[h.redirectUri,g,t]),l.useEffect(()=>{if(!t||!u||u.status!=="pending")return;const r=new URL(T.redirectUri).origin;let a=!1;const i=()=>{a||(a=!0,dr(u.sessionId).finally(()=>{a=!1}))},o=he=>{var Se,ke;he.origin===r&&(((Se=he.data)==null?void 0:Se.type)!=="forge:microsoft-calendar-auth"||((ke=he.data)==null?void 0:ke.sessionId)!==u.sessionId||i())},j=()=>{i()},se=()=>{document.visibilityState==="visible"&&i()},Ne=window.setInterval(i,Je);return window.addEventListener("message",o),window.addEventListener("focus",j),document.addEventListener("visibilitychange",se),()=>{window.removeEventListener("message",o),window.removeEventListener("focus",j),document.removeEventListener("visibilitychange",se),window.clearInterval(Ne)}},[T.redirectUri,u,t]);const x=Q({mutationFn:()=>n.provider==="macos_local"?br().then(({discovery:r})=>{P(r),ae(r.status);const a=r.sources.find(i=>i.sourceId===n.sourceId)??r.sources[0]??null;return a&&(f({provider:"macos_local",accountLabel:a.accountLabel,serverUrl:n.serverUrl,principalUrl:null,homeUrl:null,calendars:a.calendars}),V(i=>({...i,sourceId:a.sourceId}))),{discovery:null}}):n.provider==="apple"?Qe({provider:"apple",username:n.username,password:n.password}):Qe({provider:"caldav",serverUrl:n.serverUrl,username:n.username,password:n.password}),onSuccess:({discovery:r})=>{r&&f(r)},onError:r=>{_(null),m(r instanceof Error?r.message:"Forge could not discover calendars with these credentials.")}}),G=Q({mutationFn:wr,onSuccess:({status:r})=>{ae(r),r!=="full_access"&&(P(null),_(null))}}),J=Q({mutationFn:yr,onSuccess:({granted:r,status:a,message:i})=>{if(ae(a),r){m(null);return}m(i??"Forge could not obtain Calendar access from macOS yet. Open System Settings > Privacy & Security > Calendars, allow Forge, then return here and click Check access.")},onError:r=>{m(r instanceof Error?r.message:"Forge could not request Calendar access from macOS.")}});l.useEffect(()=>{!t||n.provider!=="macos_local"||U!=="full_access"||C!==null||x.isPending||x.mutateAsync()},[x,n.provider,C,U,t]);const ee=Q({mutationFn:async r=>{const a=qe(r),i=await He({calendarProviders:{microsoft:a}});return{normalized:a,settings:je(i)}},onSuccess:async({settings:r})=>{pe(r.calendarProviders.microsoft);const a=Le(r.calendarProviders.microsoft);ie(a),ce(a),L("Microsoft settings saved. Start the guided Microsoft sign-in when you are ready."),H==null||H()},onError:r=>{L(r instanceof Error?r.message:"Forge could not save the Microsoft settings.")}}),$=Q({mutationFn:async r=>{const a=nr(r),i=await He({calendarProviders:{google:a}});return{normalized:a,settings:je(i)}},onSuccess:async({normalized:r,settings:a})=>{ue(a.calendarProviders.google);const i=Ie(a.calendarProviders.google);le(i),K(i),ne(!1),F(r.clientId||r.clientSecret?"Google OAuth credentials saved on the Forge server for this install.":"Google OAuth override cleared. Forge will use the packaged or environment default again."),H==null||H()},onError:r=>{F(r instanceof Error?r.message:"Forge could not save the Google OAuth credentials.")}}),re=Q({mutationFn:r=>{const a=qe(r);return Cr(a)},onSuccess:({result:r})=>{L(r.message)},onError:r=>{L(r instanceof Error?r.message:"Forge could not validate the Microsoft configuration.")}}),O=l.useMemo(()=>et(S),[S]),W=l.useMemo(()=>Jr(I),[I]),te=!Zr(I,z),xe=!rt(S,Ce),de=typeof window>"u"?"":window.location.origin,Ke=l.useMemo(()=>{try{return new URL(h.redirectUri).origin}catch{return""}},[h.redirectUri]),Ae=de.length>0&&h.allowedOrigins.includes(de)&&(!h.isLocalOnly||Ve(new URL(de).hostname)),Fe=de&&!Ae?st({currentOrigin:de,appBaseUrl:h.appBaseUrl,redirectUri:h.redirectUri,allowedOrigins:h.allowedOrigins,isLocalOnly:h.isLocalOnly}):null,ir=h.isReadyForPairing?null:Xr(h.setupMessage)||er(),or=Fe?rr(Fe,h.allowedOrigins):null,lr=r=>{if(ye)return ye;if(n.provider==="google"&&(r==="credentials"||r==="discovery")){if(te)return"Save the Google OAuth credential change before starting sign-in.";const a=[or,ir].filter(i=>!!i);if(a.length>0)return a.join(`
4
-
5
- `)}if(n.provider==="microsoft"&&r==="credentials"){if(xe)return"Save these Microsoft settings before starting sign-in.";if(!xe&&!Ce.clientId&&!me)return T.setupMessage}if(n.provider==="macos_local"&&(r==="credentials"||r==="discovery")&&U!=="full_access")return U==="unavailable"?"This provider is only available on macOS, because Forge uses EventKit to access the host machine's calendar store.":"Grant Calendar full access for Forge on this Mac before discovering host calendars."},cr=async(r,a)=>{try{const{session:i}=await Ur(r);if(y(i),i.status==="authorized"&&i.discovery){f(i.discovery),m(null);return}if(i.status==="error"||i.status==="expired"){m(i.error??"Google sign-in did not complete. Start the guided sign-in again.");return}a!=null&&a.afterPopupClose}catch(i){m(i instanceof Error?i.message:"Forge could not confirm the Google sign-in session.")}},dr=async(r,a)=>{try{const{session:i}=await Ir(r);if(X(i),i.status==="authorized"&&i.discovery){f(i.discovery),m(null);return}if(i.status==="error"||i.status==="expired"){m(i.error??"Microsoft sign-in did not complete. Start the guided sign-in again.");return}a!=null&&a.afterPopupClose}catch(i){m(i instanceof Error?i.message:"Forge could not confirm the Microsoft sign-in session.")}},We=async()=>{var r;try{if(Fe)throw new Error(rr(Fe,h.allowedOrigins));if(!h.isReadyForPairing)throw new Error(er());m(null),_(null);const{session:a}=await Sr({label:oe("google",n.label),browserOrigin:de||void 0});if(!a.authUrl)throw new Error("Forge could not prepare the Google sign-in URL.");if(y(a),(r=M.current)==null||r.close(),M.current=window.open(a.authUrl,"forge-google-calendar-auth","popup=yes,width=520,height=720,resizable=yes,scrollbars=yes"),!M.current)throw new Error("The Google sign-in popup was blocked. Allow popups for Forge and try again.");M.current.focus()}catch(a){s(),m(a instanceof Error?a.message:"Forge could not start the Google sign-in flow.")}},Be=async()=>{var r;try{if(!O.isValid)throw new Error("Enter a valid Microsoft client ID and redirect URI before starting sign-in.");if(xe)throw new Error("Save the Microsoft settings in this guided flow before starting sign-in.");if(ee.isPending)throw new Error("Wait for Forge to finish saving the Microsoft settings before starting sign-in.");m(null),L(null),_(null);const{session:a}=await kr({label:oe("microsoft",n.label)});if(!a.authUrl)throw new Error("Forge could not prepare the Microsoft sign-in URL.");if(X(a),(r=M.current)==null||r.close(),M.current=window.open(a.authUrl,"forge-microsoft-calendar-auth","popup=yes,width=520,height=720,resizable=yes,scrollbars=yes"),!M.current)throw new Error("The Microsoft sign-in popup was blocked. Allow popups for Forge and try again.");M.current.focus()}catch(a){d(),m(a instanceof Error?a.message:"Forge could not start the Microsoft sign-in flow.")}},hr=l.useMemo(()=>[{id:"provider",eyebrow:"Connection",title:"Choose the calendar provider Forge should connect to",description:"macOS local uses EventKit to access the calendars already configured on this Mac, Apple uses autodiscovery from caldav.icloud.com, Google uses a localhost Authorization Code + PKCE flow, Exchange Online uses guided Microsoft sign-in in read-only mode, and custom CalDAV stays available for everything else.",render:(r,a)=>e.jsxs("div",{className:"grid gap-5",children:[e.jsx(D,{label:"Provider",description:"Each setup path is guided. Forge discovers calendars before anything is saved.",children:e.jsx(jr,{value:r.provider,onChange:i=>{_(null),P(null),m(null),L(null),s(),d(),a(ze(i))},options:[{value:"google",label:"Google Calendar",description:"Use Google sign-in with Authorization Code + PKCE, let Forge exchange the code on the backend, and store a per-user refresh token server-side."},{value:"apple",label:"Apple Calendar",description:"Start from https://caldav.icloud.com and autodiscover calendars with your app password."},{value:"microsoft",label:"Exchange Online",description:"Save the Microsoft app registration fields in Settings, then sign in with Microsoft and mirror selected Exchange Online calendars in read-only mode."},{value:"macos_local",label:"Calendars On This Mac",description:"Use EventKit to access the calendars already configured in Calendar.app on this host machine and avoid reconnecting those same accounts manually."},{value:"caldav",label:"Custom CalDAV",description:"Use a CalDAV base URL for Nextcloud, Fastmail, Baikal, and other compatible providers."}]})}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 text-white",children:[e.jsx(pr,{className:"size-4 text-[var(--primary)]"}),e.jsx("div",{className:"font-medium",children:"Dedicated write calendar"})]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-white/60",children:r.provider==="microsoft"?"Exchange Online is read-only for now. Forge mirrors selected calendars into Forge, but it does not publish work blocks or owned timeboxes back to Microsoft.":e.jsxs(e.Fragment,{children:["Forge writes work blocks and owned timeboxes into a dedicated calendar named"," ",e.jsx("span",{className:"font-medium text-white",children:"Forge"}),"."]})})]}),e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 text-white",children:[e.jsx(Ee,{className:"size-4 text-[var(--primary)]"}),e.jsx("div",{className:"font-medium",children:"Discovery first"})]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-white/60",children:r.provider==="google"?"Forge opens a Google sign-in popup, exchanges the authorization code on the backend, stores a per-user refresh token, and then discovers the writable calendars for that account.":r.provider==="macos_local"?"Forge asks macOS for Calendar access, discovers the host calendars grouped by account source, and replaces overlapping remote connections instead of keeping two copies.":r.provider==="microsoft"?"Forge starts a Microsoft sign-in popup, then discovers the calendars available to that account before you choose what to mirror.":"Forge discovers the actual calendar collections before you choose which ones to mirror and which one should receive owned timeboxes."})]})]}),e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-white/[0.03] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Setup guide"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-white/60",children:"These are the exact setup steps for the selected provider. They stay inside this guided flow so Settings can stay focused on connection health and actions."}),e.jsx("div",{className:"mt-4",children:e.jsx(Hr,{provider:r.provider,compact:!0})})]})]})},{id:"credentials",eyebrow:"Credentials",title:n.provider==="google"?"Sign in with Google":n.provider==="macos_local"?"Use the calendars already configured on this Mac":n.provider==="apple"?"Provide the Apple account email and app-specific password":n.provider==="microsoft"?"Sign in with Microsoft":"Provide the custom CalDAV base URL and credentials",description:n.provider==="google"?"Review the Google desktop OAuth client, save a local override only if you need one, then start the popup and let Forge finish the PKCE exchange on the backend.":n.provider==="macos_local"?"Forge requests Calendar access through EventKit, discovers sources from Calendar.app, then lets you choose which host calendars to mirror and where Forge should write.":n.provider==="apple"?"Apple discovery starts from https://caldav.icloud.com, so you only need the Apple ID email and app password here.":n.provider==="microsoft"?"Forge uses the Microsoft client ID, tenant, and redirect URI saved in Settings -> Calendar, then runs a guided popup sign-in.":"Forge stores the secrets securely, then discovers the available calendars before anything is saved.",render:(r,a)=>{var i;return e.jsxs("div",{className:"grid gap-4",children:[e.jsx(D,{label:"Connection label",description:"This is the readable label Forge shows in settings and the calendar health cards.",children:e.jsx(B,{value:r.label,onChange:o=>a({label:o.target.value}),placeholder:_e[r.provider].label})}),r.provider==="macos_local"?e.jsx("div",{className:"grid gap-4",children:e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(20,32,48,0.98),rgba(11,18,30,0.98))] p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:"macOS Calendar access"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:"Forge uses EventKit to read and write the calendars already configured in Calendar.app on this Mac. Grant Calendar full access, then discover the available account sources."})]}),e.jsx(b,{className:U==="full_access"?"bg-emerald-500/16 text-emerald-100":"bg-white/[0.08] text-white/72",children:U==="full_access"?"Full access":U.replaceAll("_"," ")})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3",children:[e.jsxs(k,{type:"button",onClick:()=>void J.mutateAsync(),pending:J.isPending,pendingLabel:"Waiting for macOS",children:[e.jsx(Ee,{className:"size-4"}),"Request Calendar access"]}),e.jsxs(k,{type:"button",variant:"secondary",onClick:()=>void G.mutateAsync(),pending:G.isPending,pendingLabel:"Checking",children:[e.jsx(Re,{className:"size-4"}),"Check access"]}),e.jsxs(k,{type:"button",onClick:()=>void x.mutateAsync(),disabled:U!=="full_access",pending:x.isPending,pendingLabel:"Discovering",children:[e.jsx(Re,{className:"size-4"}),"Discover host calendars"]})]}),(i=C==null?void 0:C.sources)!=null&&i.length?e.jsxs("div",{className:"mt-5 grid gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:"Host calendar sources"}),C.sources.map(o=>{const j=r.sourceId===o.sourceId;return e.jsxs("button",{type:"button",className:`rounded-[20px] border px-4 py-3 text-left transition ${j?"border-[var(--primary)]/40 bg-[var(--primary)]/12 text-white":"border-white/8 bg-white/[0.04] text-white/72 hover:bg-white/[0.07]"}`,onClick:()=>{a({sourceId:o.sourceId}),f({provider:"macos_local",accountLabel:o.accountLabel,serverUrl:r.serverUrl,principalUrl:null,homeUrl:null,calendars:o.calendars})},children:[e.jsx("div",{className:"font-medium",children:o.accountLabel||o.sourceTitle}),e.jsxs("div",{className:"mt-1 text-sm text-white/56",children:[o.sourceType," · ",o.calendars.length," ","calendars"]})]},o.sourceId)})]}):null]})}):r.provider==="google"?e.jsx("div",{className:"grid gap-4",children:e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(20,32,48,0.98),rgba(11,18,30,0.98))] p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:"How Google sign-in works"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:"Start the popup from the host running Forge. Google returns to Forge on localhost, Forge completes the PKCE exchange on the backend, then Forge discovers the calendars for that account."})]}),e.jsx(b,{className:"bg-emerald-500/16 text-emerald-100",children:"Auth code + PKCE"})]}),e.jsxs("div",{className:"mt-4 rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/68",children:[e.jsxs("div",{children:["Forge runtime:"," ",e.jsx("span",{className:"font-medium text-white",children:h.appBaseUrl})]}),e.jsxs("div",{className:"break-all",children:["Redirect URI:"," ",e.jsx("span",{className:"font-medium text-white",children:h.redirectUri})]}),e.jsxs("div",{className:"break-all",children:["Redirect origin:"," ",e.jsx("span",{className:"font-medium text-white",children:Ke||"Unavailable"})]}),e.jsxs("div",{children:["Allowed local browser origins:"," ",e.jsx("span",{className:"font-medium text-white",children:h.allowedOrigins.join(", ")})]}),e.jsxs("div",{className:"break-all",children:["Detected browser origin:"," ",e.jsx("span",{className:"font-medium text-white",children:de||"Unavailable"})]})]}),e.jsx("div",{className:"mt-4 rounded-[18px] bg-white/[0.04] p-4",children:Oe?e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:"Google OAuth override"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:"Save both the client ID and client secret only when this Forge install should use a different Google desktop OAuth app than the packaged default."})]}),e.jsx("button",{type:"button","aria-label":"Done editing Google OAuth client",className:"inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.06] text-white/72 transition hover:bg-white/[0.12] hover:text-white",onClick:()=>{F(null);const o=Ie(h);K(o),ne(!1)},children:e.jsx(Pe,{className:"size-4"})})]}),e.jsxs(D,{label:"Client ID",description:"Override the packaged Google desktop-app client ID for this Forge install.",children:[e.jsx(B,{"aria-label":"Client ID",value:I.clientId,onChange:o=>{F(null),K({...I,clientId:o.target.value})},placeholder:"1234567890-abcdef.apps.googleusercontent.com"}),W.issues.clientId?e.jsx("p",{className:"mt-2 text-sm text-rose-200",children:W.issues.clientId}):null]}),e.jsxs(D,{label:"Client secret",description:"Override the packaged Google desktop-app client secret for this Forge install.",children:[e.jsx(B,{"aria-label":"Client secret",value:I.clientSecret,onChange:o=>{F(null),K({...I,clientSecret:o.target.value})},placeholder:"GOCSPX-..."}),W.issues.clientSecret?e.jsx("p",{className:"mt-2 text-sm text-rose-200",children:W.issues.clientSecret}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(k,{type:"button",onClick:()=>void $.mutateAsync(I),disabled:!te||!W.isValid,pending:$.isPending,pendingLabel:"Saving",children:"Save Google OAuth override"}),e.jsx(k,{type:"button",variant:"secondary",onClick:()=>{F(null),K({clientId:"",clientSecret:""})},disabled:$.isPending||!z.clientId&&!z.clientSecret&&I.clientId.length===0&&I.clientSecret.length===0,children:z.clientId||z.clientSecret?"Clear override":"Use packaged default"})]})]}):e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"grid min-w-0 gap-3",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-white",children:"Google OAuth client"}),e.jsx(b,{className:h.storedClientId||h.storedClientSecret?"bg-emerald-500/16 text-emerald-100":"bg-white/[0.08] text-white/72",children:h.storedClientId||h.storedClientSecret?"Stored on server":"Using packaged default"}),e.jsx(Fr,{content:"Forge ships with a packaged Google desktop OAuth client by default. Save both fields only when this Forge install should use a different client ID and client secret pair.",label:"Explain Google OAuth client",className:"shrink-0"})]})}),e.jsx("button",{type:"button","aria-label":"Edit Google OAuth client",className:"inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.06] text-white/72 transition hover:bg-white/[0.12] hover:text-white",onClick:()=>{F(null),ne(!0)},children:e.jsx(mr,{className:"size-4"})})]})}),e.jsx(D,{label:"Effective client ID",description:"This is the Google desktop-app client ID Forge will use right now.",children:e.jsx("div",{className:"flex min-h-11 min-w-0 items-center overflow-hidden rounded-[18px] border border-white/8 bg-black/20 px-4 text-sm text-white/38",children:e.jsx("span",{className:"block min-w-0 truncate",title:h.clientId,children:h.clientId})})}),e.jsx(D,{label:"Effective client secret",description:"Forge uses this value on the local backend when exchanging and refreshing Google tokens.",children:e.jsx("div",{className:"flex min-h-11 min-w-0 items-center overflow-hidden rounded-[18px] border border-white/8 bg-black/20 px-4 text-sm text-white/38",children:e.jsx("span",{className:"block min-w-0 truncate",title:h.clientSecret||"",children:h.clientSecret||""})})})]})}),Z?e.jsx("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/72",children:Z}):null,e.jsx("div",{className:"mt-4 rounded-[18px] border border-sky-400/20 bg-sky-400/10 px-4 py-3 text-sm leading-6 text-sky-50",children:"If you open Forge on a phone or another remote route, Google redirects to localhost on that other device instead of back to Forge."}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3",children:[e.jsxs(k,{type:"button",onClick:()=>void We(),disabled:!h.isReadyForPairing||!Ae||te||$.isPending,pending:(g==null?void 0:g.status)==="pending",pendingLabel:"Waiting for Google",children:[e.jsx(be,{className:"size-4"}),(g==null?void 0:g.status)==="authorized"?"Sign in again":"Sign in with Google"]}),g!=null&&g.accountLabel?e.jsxs(b,{className:"bg-emerald-500/16 text-emerald-100",children:[e.jsx(Pe,{className:"mr-1 size-3.5"}),g.accountLabel]}):null]})]})}):r.provider==="microsoft"?e.jsx("div",{className:"grid gap-4",children:e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(20,32,48,0.98),rgba(11,18,30,0.98))] p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:"Guided Microsoft setup"}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:"Save the Microsoft app registration details for this Forge instance here, optionally test them, then continue into the Microsoft sign-in popup. Exchange Online stays read-only for now."})]}),e.jsx(b,{className:"bg-sky-400/12 text-sky-100",children:"Read only"})]}),e.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:[e.jsxs(D,{label:"Microsoft client ID",description:"Use the Application (client) ID from the Microsoft Entra app registration for this Forge instance.",children:[e.jsx(B,{value:S.clientId,onChange:o=>{L(null),ce(j=>({...j,clientId:o.target.value}))},placeholder:"00000000-0000-0000-0000-000000000000"}),O.issues.clientId?e.jsx("div",{className:"text-sm text-rose-300",children:O.issues.clientId}):null]}),e.jsx(D,{label:"Tenant / authority",description:"Use common unless you need a tenant-specific authority.",children:e.jsx(B,{value:S.tenantId,onChange:o=>{L(null),ce(j=>({...j,tenantId:o.target.value}))},placeholder:"common"})})]}),e.jsxs(D,{label:"Redirect URI",description:"Register this exact Forge callback URI in the Microsoft app registration.",children:[e.jsx(B,{value:S.redirectUri,onChange:o=>{L(null),ce(j=>({...j,redirectUri:o.target.value}))},placeholder:"http://127.0.0.1:4317/api/v1/calendar/oauth/microsoft/callback"}),O.issues.redirectUri?e.jsx("div",{className:"text-sm text-rose-300",children:O.issues.redirectUri}):null]}),e.jsx("div",{className:"mt-4 rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/68",children:"Forge saves the client ID, tenant, and redirect URI for this local instance, then handles Microsoft sign-in in a popup."}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3",children:[e.jsx(k,{type:"button",onClick:()=>void ee.mutateAsync(S),disabled:!O.isValid,pending:ee.isPending,pendingLabel:"Saving",children:"Save Microsoft settings"}),e.jsx(k,{type:"button",variant:"secondary",onClick:()=>void re.mutateAsync(S),disabled:!O.isValid,pending:re.isPending,pendingLabel:"Testing",children:"Test Microsoft configuration"}),e.jsxs(k,{type:"button",onClick:()=>void Be(),disabled:!O.isValid||xe||ee.isPending,pending:(u==null?void 0:u.status)==="pending",pendingLabel:"Waiting for Microsoft",children:[e.jsx(be,{className:"size-4"}),(u==null?void 0:u.status)==="authorized"?"Sign in again":"Sign in with Microsoft"]}),u!=null&&u.accountLabel?e.jsxs(b,{className:"bg-emerald-500/16 text-emerald-100",children:[e.jsx(Pe,{className:"mr-1 size-3.5"}),u.accountLabel]}):null]}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/68",children:"Save before sign-in. The Microsoft popup always uses the latest saved client ID, tenant, and redirect URI."}),e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/68",children:"After sign-in, Forge will let you choose which Exchange Online calendars to mirror into the Calendar page."})]}),me?e.jsx("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/72",children:me}):null]})}):e.jsxs(e.Fragment,{children:[r.provider==="caldav"?e.jsx(D,{label:"CalDAV base URL",description:"Use the account-level CalDAV server URL, not an individual calendar collection URL.",children:e.jsx(B,{value:r.serverUrl,onChange:o=>a({serverUrl:o.target.value}),placeholder:"https://caldav.example.com"})}):null,r.provider==="apple"?e.jsx(D,{label:"Apple CalDAV base URL",children:e.jsx(B,{value:"https://caldav.icloud.com",disabled:!0})}):null,e.jsx(D,{label:"Account email or username",children:e.jsx(B,{value:r.username,onChange:o=>a({username:o.target.value}),placeholder:"operator@example.com"})}),e.jsx(D,{label:r.provider==="apple"?"App-specific password":"Password or app password",children:e.jsx(B,{type:"password",value:r.password,onChange:o=>a({password:o.target.value}),placeholder:"Password"})})]})]})}},{id:"discovery",eyebrow:"Discovery",title:"Discover the calendars and choose what Forge should sync",description:n.provider==="microsoft"?"Select the Exchange Online calendars Forge should mirror into the Calendar page. This connection stays read-only for now.":n.provider==="macos_local"?E?`Select the host-machine calendars Forge should mirror into the Calendar page. Forge already writes work blocks and timeboxes through ${E}.`:"Select the host-machine calendars Forge should mirror into the Calendar page, then choose the host calendar Forge should write into for work blocks and timeboxes.":E?`Select the calendars Forge should mirror into the Calendar page. Forge already writes work blocks and timeboxes through ${E}.`:"Select the calendars Forge should mirror into the Calendar page, then choose the calendar Forge should write into for work blocks and timeboxes.",render:(r,a)=>e.jsxs("div",{className:"grid gap-4",children:[r.provider==="google"?e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(k,{type:"button",onClick:()=>void We(),disabled:!h.isReadyForPairing||!Ae,pending:(g==null?void 0:g.status)==="pending",pendingLabel:"Waiting for Google",children:[e.jsx(be,{className:"size-4"}),(g==null?void 0:g.status)==="authorized"?"Reconnect Google":"Sign in with Google"]}),v?e.jsxs(b,{className:"bg-white/[0.08] text-white/74",children:[v.calendars.length," discovered"]}):null]}):r.provider==="microsoft"?e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(k,{type:"button",onClick:()=>void Be(),disabled:!O.isValid||xe||ee.isPending,pending:(u==null?void 0:u.status)==="pending",pendingLabel:"Waiting for Microsoft",children:[e.jsx(be,{className:"size-4"}),(u==null?void 0:u.status)==="authorized"?"Reconnect Microsoft":"Sign in with Microsoft"]}),v?e.jsxs(b,{className:"bg-white/[0.08] text-white/74",children:[v.calendars.length," discovered"]}):null]}):e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(k,{pending:x.isPending,pendingLabel:"Discovering",onClick:()=>void x.mutateAsync(),disabled:r.provider==="macos_local"&&U!=="full_access",children:[e.jsx(Re,{className:"size-4"}),r.provider==="macos_local"?"Discover host calendars":"Discover calendars"]}),v?e.jsxs(b,{className:"bg-white/[0.08] text-white/74",children:[v.calendars.length," discovered"]}):null]}),v?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-white/[0.04] p-4 text-sm leading-6 text-white/64",children:[r.provider==="macos_local"?"Discovered through the host calendar store":"Discovered through"," ",e.jsx("span",{className:"font-medium text-white",children:v.serverUrl}),v.homeUrl?e.jsxs(e.Fragment,{children:[" ","· home set"," ",e.jsx("span",{className:"font-medium text-white",children:v.homeUrl})]}):null]}),r.provider!=="microsoft"&&E?e.jsxs("div",{className:"rounded-[24px] border border-emerald-400/20 bg-emerald-400/10 p-4 text-sm leading-6 text-emerald-50",children:["Forge already writes work blocks and owned timeboxes through"," ",e.jsx("span",{className:"font-medium text-white",children:E}),". This connection only needs a mirror selection."]}):null,e.jsx("div",{className:"grid gap-3",children:v.calendars.map(i=>{const o=r.selectedCalendarUrls.includes(i.url),j=r.forgeCalendarUrl===i.url;return e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:De(i)}),e.jsxs("div",{className:"mt-1 text-sm text-white/56",children:[i.timezone||"No timezone exposed"," ·"," ",i.url]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.isForgeCandidate?e.jsx(b,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:"Forge match"}):null,i.isPrimary?e.jsx(b,{className:"bg-white/[0.08] text-white/74",children:"Primary"}):null]})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>a({selectedCalendarUrls:o?r.selectedCalendarUrls.filter(se=>se!==i.url):[...r.selectedCalendarUrls,i.url]}),className:`rounded-full px-3 py-2 text-sm transition ${o?"bg-[var(--primary)]/18 text-[var(--primary)] shadow-[inset_0_0_0_1px_rgba(192,193,255,0.24)]":"bg-white/[0.05] text-white/62 hover:bg-white/[0.08]"}`,children:o?"Mirrored":"Mirror into Forge"}),r.provider!=="microsoft"&&!E?e.jsx("button",{type:"button",onClick:()=>a({forgeCalendarUrl:i.url,createForgeCalendar:!1}),className:`rounded-full px-3 py-2 text-sm transition ${j?"bg-emerald-500/18 text-emerald-100 shadow-[inset_0_0_0_1px_rgba(16,185,129,0.28)]":"bg-white/[0.05] text-white/62 hover:bg-white/[0.08]"}`,children:j?"Forge writes here":"Use for Forge writes"}):e.jsx(b,{className:r.provider==="microsoft"?"bg-sky-400/12 text-sky-100":"bg-white/[0.08] text-white/74",children:r.provider==="microsoft"?"Read only":"Shared target elsewhere"})]})]},i.url)})}),r.provider!=="microsoft"&&!E?e.jsxs("div",{className:"rounded-[24px] border border-dashed border-white/10 bg-white/[0.03] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:"No Forge calendar yet?"}),e.jsxs("p",{className:"mt-2 text-sm leading-6 text-white/60",children:["If none of the discovered calendars should receive Forge-owned work blocks and timeboxes, let Forge create a dedicated calendar named"," ",e.jsx("span",{className:"font-medium text-white",children:"Forge"}),"."]}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{type:"button",onClick:()=>a({forgeCalendarUrl:null,createForgeCalendar:!r.createForgeCalendar}),className:`rounded-full px-3 py-2 text-sm transition ${r.createForgeCalendar?"bg-emerald-500/18 text-emerald-100 shadow-[inset_0_0_0_1px_rgba(16,185,129,0.28)]":"bg-white/[0.05] text-white/62 hover:bg-white/[0.08]"}`,children:r.createForgeCalendar?"Forge will create one":"Create a new Forge calendar"})})]}):r.provider==="microsoft"?e.jsx("div",{className:"rounded-[24px] border border-sky-400/20 bg-sky-400/10 p-4 text-sm leading-6 text-sky-50",children:"Exchange Online is connected through Microsoft Graph in read-only mode. Forge will mirror the calendars you select here, but it will keep work blocks and owned timeboxes local or publish them through another writable provider."}):e.jsxs("div",{className:"rounded-[24px] border border-dashed border-white/10 bg-white/[0.03] p-4 text-sm leading-6 text-white/60",children:["Forge will keep"," ",e.jsx("span",{className:"font-medium text-white",children:E})," ","as the canonical write target instead of creating another Forge calendar on this connection."]})]}):e.jsx("div",{className:"rounded-[24px] border border-dashed border-white/10 bg-white/[0.03] px-4 py-6 text-sm leading-6 text-white/58",children:r.provider==="google"?e.jsx(e.Fragment,{children:"Start the guided Google sign-in first. Forge will bring the discovered Google calendars back here as soon as the popup completes."}):r.provider==="microsoft"?e.jsx(e.Fragment,{children:"Start the guided Microsoft sign-in first. Forge will bring the discovered Exchange Online calendars back here as soon as the popup completes."}):e.jsx(e.Fragment,{children:r.provider==="macos_local"?"Grant macOS Calendar access and discover the host calendars first. If Calendar.app already aggregates Google, Exchange, or iCloud for this Mac, Forge will pick them up here without reconnecting those accounts.":e.jsxs(e.Fragment,{children:["Discover calendars after entering the credentials. For Apple, Forge starts from"," ",e.jsx("span",{className:"font-medium text-white",children:"https://caldav.icloud.com"})," ","and resolves the principal plus calendar home automatically."]})})})]})},{id:"review",eyebrow:"Review",title:"Confirm what Forge will mirror and where it will write",description:"This keeps the sync model explicit before the provider connection is saved.",render:r=>{var a,i;return e.jsxs("div",{className:"grid gap-4",children:[r.provider==="macos_local"&&r.sourceId?e.jsxs("div",{className:"rounded-[20px] border border-white/8 bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/70",children:["Selected host source:"," ",e.jsx("span",{className:"font-medium text-white",children:((a=C==null?void 0:C.sources.find(o=>o.sourceId===r.sourceId))==null?void 0:a.accountLabel)??((i=C==null?void 0:C.sources.find(o=>o.sourceId===r.sourceId))==null?void 0:i.sourceTitle)??r.sourceId})]}):null,e.jsxs("div",{className:"rounded-[26px] border border-white/8 bg-[linear-gradient(180deg,rgba(21,31,42,0.96),rgba(10,16,26,0.96))] p-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-[18px] bg-[var(--primary)]/14 p-3 text-[var(--primary)]",children:e.jsx(Me,{className:"size-4"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-display text-xl text-white",children:oe(r.provider,r.label)}),e.jsx("div",{className:"mt-1 text-sm text-white/58",children:r.provider==="google"?"Google Calendar":r.provider==="macos_local"?"Calendars On This Mac":r.provider==="apple"?"Apple Calendar":r.provider==="microsoft"?"Exchange Online":"Custom CalDAV"})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[20px] bg-white/[0.04] px-4 py-3 text-sm text-white/72",children:["Mirrored calendars:"," ",e.jsx("span",{className:"font-medium text-white",children:r.selectedCalendarUrls.length})]}),e.jsxs("div",{className:"rounded-[20px] bg-white/[0.04] px-4 py-3 text-sm text-white/72",children:["Forge writes:"," ",e.jsx("span",{className:"font-medium text-white",children:r.provider==="microsoft"?"read only":r.forgeCalendarUrl?"existing calendar":r.createForgeCalendar?"new Forge calendar":E?`shared target via ${E}`:"not selected"})]})]}),r.replaceConnectionIds.length>0?e.jsxs("div",{className:"mt-4 rounded-[20px] border border-amber-400/20 bg-amber-400/10 px-4 py-3 text-sm leading-6 text-amber-50",children:["Forge will replace ",r.replaceConnectionIds.length," older overlapping connection",r.replaceConnectionIds.length===1?"":"s"," for this same calendar account so only one visible copy remains.",ge.filter(o=>r.replaceConnectionIds.includes(o.id)).map(o=>o.label).join(", ")?` ${ge.filter(o=>r.replaceConnectionIds.includes(o.id)).map(o=>o.label).join(", ")}.`:""]}):null]})]})}}],[v,x.isPending,n.provider,Oe,I,g,h.clientId,Z,h.allowedOrigins,h.appBaseUrl,h.isLocalOnly,h.isReadyForPairing,h.redirectUri,Ke,te,Ae,Fe,xe,S,T.setupMessage,me,O,$.isPending,ee.isPending,Ce,re.isPending,T.isReadyForSignIn,T.redirectUri,C,u,R,E]),gr=n.provider==="macos_local"&&n.replaceConnectionIds.length>0?"Replace and connect":"Connect provider";return e.jsx($e,{open:t,onOpenChange:c,eyebrow:"Calendar settings",title:"Connect a calendar provider",description:"Discover provider calendars first, choose which calendars Forge should mirror, and only choose a Forge write target when the runtime does not already have one.",value:n,onChange:r=>{V(r),v&&r.provider!==v.provider&&_(null),r.provider!=="macos_local"&&P(null)},draftPersistenceKey:"calendar.connection.new",steps:hr,submitLabel:gr,pending:N,pendingLabel:"Connecting",error:ye,resolveError:lr,initialStepId:w,onSubmit:async()=>{try{if(m(null),!v){m("Discover the available calendars before saving the connection.");return}if(n.selectedCalendarUrls.length===0){m("Select at least one calendar to mirror into Forge.");return}if(n.provider!=="microsoft"&&!n.forgeCalendarUrl&&!n.createForgeCalendar&&!R){m("Choose the calendar Forge should write into, ask Forge to create one, or keep using the existing shared Forge write target.");return}if(n.provider==="google"){if(!(g!=null&&g.sessionId)||g.status!=="authorized"){m("Complete the Google sign-in flow before saving this connection.");return}await Y({provider:"google",label:oe("google",n.label),authSessionId:g.sessionId,selectedCalendarUrls:n.selectedCalendarUrls,forgeCalendarUrl:n.forgeCalendarUrl,createForgeCalendar:n.createForgeCalendar})}else if(n.provider==="apple")await Y({provider:"apple",label:oe("apple",n.label),username:n.username.trim(),password:n.password.trim(),selectedCalendarUrls:n.selectedCalendarUrls,forgeCalendarUrl:n.forgeCalendarUrl,createForgeCalendar:n.createForgeCalendar});else if(n.provider==="microsoft"){if(!(u!=null&&u.sessionId)||u.status!=="authorized"){m("Complete the Microsoft sign-in flow before saving this connection.");return}await Y({provider:"microsoft",label:oe("microsoft",n.label),authSessionId:u.sessionId,selectedCalendarUrls:n.selectedCalendarUrls})}else if(n.provider==="macos_local"){if(!n.sourceId){m("Choose which host calendar source Forge should connect before saving.");return}await Y({provider:"macos_local",label:oe("macos_local",n.label),sourceId:n.sourceId,selectedCalendarUrls:n.selectedCalendarUrls,forgeCalendarUrl:n.forgeCalendarUrl,createForgeCalendar:n.createForgeCalendar,replaceConnectionIds:n.replaceConnectionIds})}else await Y({provider:"caldav",label:oe("caldav",n.label),serverUrl:n.serverUrl.trim(),username:n.username.trim(),password:n.password.trim(),selectedCalendarUrls:n.selectedCalendarUrls,forgeCalendarUrl:n.forgeCalendarUrl,createForgeCalendar:n.createForgeCalendar});c(!1)}catch(r){if(r instanceof Nr&&r.code==="calendar_connection_overlap"){const a=r.response,i=Array.isArray(a==null?void 0:a.overlappingConnectionIds)?a==null?void 0:a.overlappingConnectionIds.filter(o=>typeof o=="string"):[];V(o=>({...o,replaceConnectionIds:i})),m(`${r.message} Submit again to replace the older overlapping connection${i.length===1?"":"s"}.`);return}m(r instanceof Error?r.message:"Forge could not create this calendar connection.")}}})}function ve(t){try{const c=new URL(t);return c.pathname.endsWith("/")||(c.pathname=`${c.pathname}/`),c.toString()}catch{return t}}function tr(t){switch(t){case"google":return"Google Calendar";case"apple":return"Apple Calendar";case"microsoft":return"Exchange Online";case"macos_local":return"Calendars On This Mac";case"caldav":default:return"Custom CalDAV"}}function nt(t){switch(t){case"google":return"Open Google guided flow";case"microsoft":return"Open Microsoft guided flow";case"macos_local":return"Open Mac calendar flow";default:return"Open guided setup"}}function it(t){switch(t){case"google":case"microsoft":return Ee;case"macos_local":return Te;case"apple":return Te;case"caldav":default:return Me}}function ot(t){switch(t){case"microsoft":return"Read only";case"macos_local":return"Read + write";default:return"Read + write"}}function lt(t){switch(t){case"google":return"Local PKCE";case"microsoft":return"Guided sign-in";case"macos_local":return"Host machine";case"apple":return"App password";case"caldav":default:return"CalDAV credentials"}}function ct(t){switch(t){case"google":return"Sign in from the same machine running Forge. After connection, Forge can mirror the calendars you choose and reuse the current shared Forge write target, creating one only when the runtime does not already have one.";case"apple":return"Use your Apple ID email and app-specific password. Forge discovers your iCloud calendars before you choose what to mirror.";case"microsoft":return"Use the guided Microsoft sign-in flow. Forge mirrors the Exchange calendars you choose and keeps this provider read only.";case"macos_local":return"Use the calendars already configured in Calendar.app on this Mac. Forge requests Calendar access through macOS, discovers host calendars by account source, and replaces overlapping remote account connections instead of duplicating them.";case"caldav":default:return"Enter a CalDAV server URL and account credentials. Forge discovers the calendars on that account before you choose what to mirror."}}function sr(t){return`${t} connection${t===1?"":"s"}`}function yt(){var M,fe,R,E,je;const t=ar(),[c,p]=fr(),[w,A]=l.useState(!1),[q,H]=l.useState("google"),[ge,Y]=l.useState(void 0),[N,we]=l.useState(null),[n,V]=l.useState([]),[ye,m]=l.useState(!1),[v,_]=l.useState(null),[U,ae]=l.useState(()=>Vr()),C=Ue({queryKey:["forge-operator-session"],queryFn:Dr}),P=C.isSuccess,g=Ue({queryKey:["forge-settings"],queryFn:_r,enabled:P}),y=Ue({queryKey:["forge-calendar-connections"],queryFn:Pr,enabled:P}),u=Ue({queryKey:["forge-calendar-resources"],queryFn:zr,enabled:P}),X=async()=>{await Promise.all([t.invalidateQueries({queryKey:["forge-settings"]}),t.invalidateQueries({queryKey:["forge-calendar-connections"]}),t.invalidateQueries({queryKey:["forge-calendar-resources"]}),t.invalidateQueries({queryKey:["forge-calendar-overview"]}),Gr(t)])},h=Q({mutationFn:Mr,onSuccess:X}),ue=Q({mutationFn:s=>Er(s),onSuccess:X}),I=Q({mutationFn:({connectionId:s,patch:d})=>Or(s,d),onSuccess:X}),K=Q({mutationFn:s=>Ar(s),onSuccess:X});l.useEffect(()=>{if(!P)return;const s=c.get("intent"),d=c.get("provider");if(s!=="connect")return;H(d==="apple"||d==="caldav"||d==="google"||d==="microsoft"||d==="macos_local"?d:"google"),Y(d==="microsoft"?"credentials":void 0),A(!0);const f=new URLSearchParams(c);f.delete("intent"),f.delete("provider"),p(f,{replace:!0})},[P,c,p]);const z=l.useMemo(()=>{var s,d;return Lr(((s=u.data)==null?void 0:s.calendars)??[],((d=y.data)==null?void 0:d.connections)??[])},[(M=u.data)==null?void 0:M.calendars,(fe=y.data)==null?void 0:fe.connections]),le=l.useMemo(()=>{const s=new Map;for(const d of z){const f=s.get(d.connectionId)??[];f.push(d),s.set(d.connectionId,f)}return s},[z]),Oe=l.useMemo(()=>{var d;const s={};for(const f of((d=y.data)==null?void 0:d.connections)??[])s[f.provider]=(s[f.provider]??0)+1;return s},[(R=y.data)==null?void 0:R.connections]),ne=l.useMemo(()=>Kr(z,U.calendarColors),[z,U.calendarColors]),Z=l.useMemo(()=>{var s;return(((s=y.data)==null?void 0:s.connections)??[]).find(d=>{var f;return typeof((f=d.config)==null?void 0:f.forgeCalendarUrl)=="string"&&d.config.forgeCalendarUrl.trim().length>0})??null},[(E=y.data)==null?void 0:E.connections]),F=l.useMemo(()=>{var s;return((s=y.data)==null?void 0:s.connections.find(d=>d.id===N))??null},[y.data,N]),T=l.useMemo(()=>{var s;return((s=y.data)==null?void 0:s.connections.find(d=>d.id===v))??null},[y.data,v]),pe=l.useMemo(()=>N?le.get(N)??[]:[],[le,N]),S=Ue({queryKey:["forge-calendar-connection-discovery",N],queryFn:()=>Tr(N),enabled:P&&N!==null});l.useEffect(()=>{if(!N){V([]),m(!1);return}const s=pe.filter(d=>d.selectedForSync).map(d=>ve(d.remoteId));V(s),m(!0)},[N,pe]),l.useEffect(()=>{Wr(U)},[U]);const ce=l.useMemo(()=>[{id:"mirrors",eyebrow:"Mirroring",title:"Choose which calendars Forge should mirror",description:"Unselected calendars stop showing up in Forge’s mirrored calendar views. The Forge write calendar stays available for work blocks and timeboxes.",render:(s,d)=>{var J,ee;if(S.isLoading)return e.jsx("div",{className:"rounded-[24px] border border-white/8 bg-white/[0.03] px-4 py-6 text-sm leading-6 text-white/58",children:"Rediscovering calendars for this connection."});if(S.isError||!((J=S.data)!=null&&J.discovery))return e.jsx("div",{className:"rounded-[24px] border border-rose-400/20 bg-rose-400/10 px-4 py-6 text-sm leading-6 text-rose-100",children:S.error instanceof Error?S.error.message:"Forge could not rediscover calendars for this connection."});const f=S.data.discovery,x=(F==null?void 0:F.provider)==="microsoft",G=typeof((ee=F==null?void 0:F.config)==null?void 0:ee.forgeCalendarUrl)=="string"?ve(F.config.forgeCalendarUrl):null;return e.jsx("div",{className:"grid gap-3",children:f.calendars.map($=>{const re=ve($.url),O=ye?s.selectedCalendarUrls.includes(re):pe.some(te=>te.selectedForSync&&ve(te.remoteId)===re),W=G===re;return e.jsxs("div",{className:"rounded-[24px] border border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-white",children:De($)}),e.jsxs("div",{className:"mt-1 text-sm text-white/56",children:[$.timezone||"No timezone exposed"," ·"," ",$.url]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[W&&!x?e.jsx(b,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:"Forge writes here"}):null,x?e.jsx(b,{className:"bg-sky-400/12 text-sky-100",children:"Read only"}):null,$.isPrimary?e.jsx(b,{className:"bg-white/[0.08] text-white/74",children:"Primary"}):null]})]}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:e.jsx("button",{type:"button",disabled:W&&!x,onClick:()=>d({selectedCalendarUrls:O?s.selectedCalendarUrls.filter(te=>te!==re):[...s.selectedCalendarUrls,re]}),className:`rounded-full px-3 py-2 text-sm transition ${W&&!x?"cursor-not-allowed bg-white/[0.05] text-white/35":O?"bg-emerald-500/18 text-emerald-100 shadow-[inset_0_0_0_1px_rgba(16,185,129,0.28)]":"bg-white/[0.05] text-white/62 hover:bg-white/[0.08]"}`,children:W&&!x?"Always available for Forge writes":O?"Mirrored into Forge":"Do not mirror"})})]},$.url)})})}}],[F,S]);if(C.isLoading||g.isLoading||y.isLoading||u.isLoading)return e.jsx(Rr,{eyebrow:"Settings · Calendar",title:"Loading calendar settings",description:"Checking the operator session and loading provider connections.",columns:2,blocks:6});if(C.isError)return e.jsx(Ye,{eyebrow:"Settings · Calendar",error:C.error,onRetry:()=>void C.refetch()});if(g.isError||y.isError||u.isError||!((je=g.data)!=null&&je.settings)||!y.data||!u.data)return e.jsx(Ye,{eyebrow:"Settings · Calendar",error:g.error??y.error??u.error??new Error("Calendar settings are unavailable."),onRetry:()=>{g.refetch(),y.refetch(),u.refetch()}});const{providers:Ce,connections:ie}=y.data,me=g.data.settings.calendarProviders.google,L=g.data.settings.calendarProviders.microsoft;return e.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[e.jsx(qr,{title:"Calendar settings",description:"Manage provider connections, review the shared Forge write target, and open guided setup only when you need to connect or reconfigure a provider.",badge:`${ie.length} connection${ie.length===1?"":"s"}`}),e.jsx($r,{}),e.jsxs("div",{className:"grid gap-5",children:[e.jsxs(Ge,{className:"surface-section-panel grid gap-5 rounded-[30px] border",children:[e.jsxs("div",{className:"max-w-3xl",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Provider connections"}),e.jsxs("p",{className:"mt-2 text-sm leading-6 text-white/60",children:["Connect a provider here, then choose which calendars Forge should mirror. Writable providers publish work blocks and owned timeboxes through one shared"," ",e.jsx("span",{className:"font-medium text-white",children:"Forge"})," write target, creating it only when the runtime does not already have one."]})]}),e.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:Ce.map(s=>{const d=it(s.provider),f=Oe[s.provider]??0,x=f>0;return e.jsxs("div",{className:`flex min-h-[248px] flex-col rounded-[26px] border p-5 shadow-[inset_0_1px_0_var(--ui-border-subtle)] ${x?"border-emerald-400/24 bg-[linear-gradient(180deg,color-mix(in_srgb,#10b981_18%,var(--surface-panel)_82%),var(--ui-surface-2))]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]"}`,children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:`rounded-[18px] p-3 ${x?"bg-emerald-400/16 text-emerald-100":"bg-[var(--primary)]/14 text-[var(--primary)]"}`,children:e.jsx(d,{className:"size-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.label}),x?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"bg-emerald-400/16 text-emerald-50",children:"Connected"}),e.jsx(b,{className:"bg-white/[0.08] text-white/82",children:sr(f)})]}):null]}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:ct(s.provider)}),x?e.jsxs("div",{className:"mt-3 text-sm text-emerald-100/88",children:["Forge already has"," ",sr(f)," for this provider. Open the guided flow again to add another account or reconfigure one."]}):null]})]}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-2",children:[e.jsx(b,{tone:"signal",className:"bg-[var(--primary)]/14 text-white/86",children:lt(s.provider)}),e.jsx(b,{className:s.supportsDedicatedForgeCalendar?"bg-emerald-500/16 text-emerald-100":"bg-sky-400/14 text-sky-100",children:ot(s.provider)})]}),e.jsx("div",{className:"mt-auto pt-5",children:e.jsxs(k,{variant:"secondary",className:"w-full justify-center",onClick:()=>{H(s.provider),Y(s.provider==="google"||s.provider==="microsoft"?"credentials":void 0),A(!0)},children:[e.jsx(be,{className:"size-4"}),nt(s.provider)]})})]},s.provider)})})]}),e.jsxs(Ge,{className:"surface-section-panel grid gap-4 rounded-[30px] border",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Calendar colors"}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/60",children:"Calendar colors are on by default so each mirrored calendar stays legible in the week view. Adjust any display color here without changing the provider itself."})]}),e.jsx("button",{type:"button",onClick:()=>ae(s=>({...s,useCalendarColors:!s.useCalendarColors})),className:`rounded-full px-4 py-2 text-sm transition ${U.useCalendarColors?"bg-[var(--ui-accent-soft)] text-[var(--primary)] shadow-[inset_0_0_0_1px_rgba(192,193,255,0.2)]":"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)]"}`,children:U.useCalendarColors?"Colors on":"Colors off"})]}),z.length>0?e.jsx("div",{className:"grid gap-3",children:z.map(s=>{const d=De(s);return e.jsxs("div",{className:"grid gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 md:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsx("div",{className:"min-w-0",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{"aria-hidden":"true",className:"size-3 shrink-0 rounded-full",style:{backgroundColor:ne[s.id]}}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-medium text-[var(--ui-ink-strong)]",children:d}),e.jsxs("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:[s.canWrite?"Writable":"Read only"," ·"," ",s.timezone]})]})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("input",{"aria-label":`Choose display color for ${d}`,type:"color",value:ne[s.id],onChange:f=>ae(x=>({...x,calendarColors:{...x.calendarColors,[s.id]:f.target.value}})),className:"h-10 w-12 cursor-pointer rounded-[14px] border border-[var(--ui-border-subtle)] bg-transparent p-1"}),e.jsx(k,{size:"sm",variant:"secondary",onClick:()=>ae(f=>{const x={...f.calendarColors};return delete x[s.id],{...f,calendarColors:x}}),children:"Reset palette"})]})]},s.id)})}):e.jsx("div",{className:"rounded-[24px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-5 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Connect a provider first, then Forge will let you tune the display color of each mirrored calendar here."})]}),e.jsxs(Ge,{className:"surface-section-panel grid gap-4 rounded-[30px] border",children:[e.jsx("div",{className:"flex items-center justify-between gap-3",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Connected providers"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-white/60",children:"Review connection health, confirm which provider calendars Forge can read or mirror, and see which connection currently owns the shared Forge write target."})]})}),ie.length>0?e.jsx("div",{className:"grid gap-3",children:ie.map(s=>{var x;const d=le.get(s.id)??[],f=s.provider!=="microsoft"&&Z!==null&&Z.id!==s.id;return e.jsxs("div",{className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.label}),e.jsxs("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:[tr(s.provider)," ·"," ",s.accountLabel||"No account label yet"]}),s.lastSyncedAt?e.jsxs("div",{className:"mt-2 text-sm text-[var(--ui-ink-faint)]",children:["Last synced"," ",new Date(s.lastSyncedAt).toLocaleString()]}):null,s.lastSyncError?e.jsx("div",{className:"mt-2 text-sm text-rose-200",children:s.lastSyncError}):null,f?e.jsxs("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:["Forge writes through"," ",e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:Z.label}),Z.accountLabel?` · ${Z.accountLabel}`:"","."]}):null]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{className:"bg-white/[0.08] text-white/74",children:s.status}),((x=s.config)==null?void 0:x.readOnly)===!0?e.jsx(b,{className:"bg-sky-400/12 text-sky-100",children:"Read only"}):null,e.jsxs(k,{size:"sm",variant:"secondary",pending:ue.isPending&&ue.variables===s.id,pendingLabel:"Syncing",onClick:()=>void ue.mutateAsync(s.id),children:[e.jsx(Re,{className:"size-4"}),"Sync"]}),e.jsxs(k,{size:"sm",variant:"secondary",onClick:()=>{const G=(le.get(s.id)??[]).filter(J=>J.selectedForSync).map(J=>ve(J.remoteId));V(G),m(!0),we(s.id)},children:[e.jsx(xr,{className:"size-4"}),"Manage mirrored calendars"]}),e.jsxs(k,{size:"sm",variant:"secondary",onClick:()=>_(s.id),children:[e.jsx(vr,{className:"size-4"}),"Remove"]})]})]}),e.jsx("div",{className:"mt-4 grid gap-2",children:d.map(G=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:De(G)}),e.jsxs("div",{className:"mt-1 text-xs uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[G.canWrite?"Writable":"Read only"," ·"," ",G.timezone]})]}),G.forgeManaged?e.jsx(b,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:"Forge"}):e.jsxs(b,{className:"bg-white/[0.08] text-white/74",children:[e.jsx(Te,{className:"mr-1 size-3.5"}),"Mirrored"]})]},G.id))})]},s.id)})}):e.jsxs("div",{className:"rounded-[26px] border border-dashed border-white/10 bg-white/[0.03] px-5 py-6 text-sm leading-6 text-white/60",children:["No provider is connected yet. Open a guided setup flow above when you are ready. Forge will reuse one shared"," ",e.jsx("span",{className:"font-medium text-white",children:"Forge"})," write target across writable providers when it already exists, create one only when none exists yet, and mirror selected calendars in read-only mode for providers like Exchange Online."]})]})]}),e.jsx(at,{open:w,onOpenChange:s=>{A(s),s||Y(void 0)},initialProvider:q,initialStepId:ge,googleSetup:me,microsoftSetup:L,existingConnections:ie.map(s=>({id:s.id,label:s.label,provider:s.provider,status:s.status,accountLabel:s.accountLabel,forgeCalendarId:s.forgeCalendarId,config:s.config})),onCalendarSettingsChanged:X,pending:h.isPending,onSubmit:async s=>{await h.mutateAsync(s)}}),e.jsx($e,{open:N!==null,onOpenChange:s=>{s||we(null)},eyebrow:"Calendar settings",title:"Manage mirrored calendars",description:"Choose which calendars this connection should mirror into Forge.",value:{selectedCalendarUrls:n},onChange:s=>V(s.selectedCalendarUrls),draftPersistenceKey:N?`settings.calendar.manage.${N}`:"settings.calendar.manage",steps:ce,pending:I.isPending,pendingLabel:"Saving",submitLabel:"Save mirror selection",error:I.error instanceof Error?I.error.message:null,onSubmit:async()=>{N&&(await I.mutateAsync({connectionId:N,patch:{selectedCalendarUrls:n.map(ve)}}),m(!1),we(null))}}),e.jsx($e,{open:v!==null,onOpenChange:s=>{s||_(null)},eyebrow:"Calendar settings",title:"Remove calendar connection",description:"This removes the provider connection, stops syncing its calendars, removes mirrored external events from Forge, and keeps Forge-native events local.",value:{acknowledgement:!1},onChange:()=>{},draftPersistenceKey:v?`settings.calendar.remove.${v}`:"settings.calendar.remove",steps:[{id:"confirm",eyebrow:"Disconnect",title:T?`Remove ${T.label}?`:"Remove this connection?",description:"Use this when you want to disconnect the account entirely. You can reconnect later with the guided setup flow.",render:()=>e.jsx("div",{className:"rounded-[24px] border border-rose-400/20 bg-rose-400/10 p-4 text-sm leading-6 text-rose-100",children:T?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"font-medium text-white",children:[tr(T.provider)," ·"," ",T.accountLabel||"No account label"]}),e.jsx("div",{className:"mt-2",children:"Mirrored provider calendars and external mirrored events from this connection will be removed. Forge-owned events, work blocks, and timeboxes remain in Forge."})]}):"This connection will be removed from Forge."})}],pending:K.isPending,pendingLabel:"Removing",submitLabel:"Remove connection",error:K.error instanceof Error?K.error.message:null,onSubmit:async()=>{v&&(await K.mutateAsync(v),_(null))}})]})}export{yt as SettingsCalendarPage};