forge-openclaw-plugin 0.3.18 → 0.3.19

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 (161) hide show
  1. package/dist/assets/{action-bar-BAZevCEA.js → action-bar-B3ttL3XF.js} +1 -1
  2. package/dist/assets/{activity-page-CnT_hnCU.js → activity-page-CoNcd0PX.js} +1 -1
  3. package/dist/assets/{ai-surface-workspace-GPZzIIut.js → ai-surface-workspace-Db34puL5.js} +1 -1
  4. package/dist/assets/artifacts-page-C09tfJTW.js +2 -0
  5. package/dist/assets/{atlas-panel-B95nrYpZ.js → atlas-panel-DRMA3RbG.js} +1 -1
  6. package/dist/assets/{board-CGgOvBP9.js → board-Dl7As76Q.js} +1 -1
  7. package/dist/assets/{calendar-page-mlr94wIS.js → calendar-page-CagtpmrB.js} +1 -1
  8. package/dist/assets/{calendar-rules-DdxPmBZJ.js → calendar-rules-jys-Ya5M.js} +1 -1
  9. package/dist/assets/{calendar-week-toolbar-Cu8V6zv1.js → calendar-week-toolbar-DWTObcj1.js} +1 -1
  10. package/dist/assets/{charts-Cdtn55ol.js → charts-YpkKrjkZ.js} +1 -1
  11. package/dist/assets/{companion-sync-lab-page-CJI5jf8W.js → companion-sync-lab-page-COYI00E2.js} +1 -1
  12. package/dist/assets/{daily-metrics-dashboard-CXESx7bU.js → daily-metrics-dashboard-CLoHakVX.js} +1 -1
  13. package/dist/assets/{define-workbench-box-Dbl9W7oE.js → define-workbench-box-DkTWtzNA.js} +1 -1
  14. package/dist/assets/{entity-link-multiselect-DZ_jAjs4.js → entity-link-multiselect-HmmmJO5A.js} +1 -1
  15. package/dist/assets/{entity-note-count-link-FOK_qhcC.js → entity-note-count-link-BDLj5ezr.js} +1 -1
  16. package/dist/assets/{entity-notes-surface-Dq9dFKjD.js → entity-notes-surface-Csbm1myW.js} +1 -1
  17. package/dist/assets/{execution-board-D9hkXKC2.js → execution-board-C7wYWJE4.js} +1 -1
  18. package/dist/assets/{faceted-token-search-BeShxjkc.js → faceted-token-search-B2XWEl8j.js} +1 -1
  19. package/dist/assets/{flagship-signal-deck-DZx_HEH9.js → flagship-signal-deck-DnNN_VE1.js} +1 -1
  20. package/dist/assets/{floating-action-menu-CFrgvQJi.js → floating-action-menu-D2Lk9TOc.js} +1 -1
  21. package/dist/assets/{forms-DhEGHkFR.js → forms-DznAv9hZ.js} +1 -1
  22. package/dist/assets/{generic-node-view-C1kLClIm.js → generic-node-view-C_WhZXoj.js} +1 -1
  23. package/dist/assets/goal-detail-page-B395rAnv.js +1 -0
  24. package/dist/assets/{goal-dialog-BlZHh3dw.js → goal-dialog-DiEV3MyU.js} +1 -1
  25. package/dist/assets/goals-page-BNwaz0yD.js +1 -0
  26. package/dist/assets/{graph-U1J6VkbG.js → graph-BUSFLDnl.js} +1 -1
  27. package/dist/assets/{habits-page-DHxZSThT.js → habits-page-BkfbiwMJ.js} +1 -1
  28. package/dist/assets/{health-boxes-BZjIqiiG.js → health-boxes-BlA33CqS.js} +1 -1
  29. package/dist/assets/index-C0CztQTU.js +2 -0
  30. package/dist/assets/index-CKnJCN1y.css +1 -0
  31. package/dist/assets/{inline-note-fields-DpmCMAJf.js → inline-note-fields-CbA0QOnc.js} +1 -1
  32. package/dist/assets/{insight-flow-dialog-DNIe0sts.js → insight-flow-dialog-DdxIE6oo.js} +1 -1
  33. package/dist/assets/{insights-page-D_N_MWGu.js → insights-page-C0q_J9Hz.js} +1 -1
  34. package/dist/assets/{kanban-boxes-DTDG5UEJ.js → kanban-boxes-BynqbGHC.js} +1 -1
  35. package/dist/assets/{kanban-page-DEvIY5IW.js → kanban-page-DyiaHH0e.js} +1 -1
  36. package/dist/assets/{knowledge-graph-page-CvXSnnG5.js → knowledge-graph-page-Cn9VkUur.js} +1 -1
  37. package/dist/assets/{life-force-page-CgvUrqQb.js → life-force-page-DQPEIj23.js} +1 -1
  38. package/dist/assets/{life-force-workspace-BNeMbRHf.js → life-force-workspace-Db7XThH2.js} +1 -1
  39. package/dist/assets/{maps-Dk9tZqTA.js → maps-CpdpZmGM.js} +1 -1
  40. package/dist/assets/{metric-tile-DAhX60rg.js → metric-tile-sDt_l_O7.js} +1 -1
  41. package/dist/assets/{motion-DeJZhOSA.js → motion-eRlWWQT8.js} +1 -1
  42. package/dist/assets/{movement-boxes-BOqU18NH.js → movement-boxes-birc_cd8.js} +1 -1
  43. package/dist/assets/{movement-page-DCDeUynh.js → movement-page-BQllmJBm.js} +1 -1
  44. package/dist/assets/{note-markdown-Cxj84-0j.js → note-markdown-Dpve4W0R.js} +1 -1
  45. package/dist/assets/{note-tags-input-CP0-EPpE.js → note-tags-input-Hvi_ifLe.js} +1 -1
  46. package/dist/assets/{notes-boxes-C7WPT7mf.js → notes-boxes-J-MuDr8u.js} +1 -1
  47. package/dist/assets/{notes-page-Dll8PIks.js → notes-page-uR_LafDv.js} +1 -1
  48. package/dist/assets/{open-in-graph-button-BHl16hJP.js → open-in-graph-button-JgYTH-IQ.js} +1 -1
  49. package/dist/assets/{orbit-map-De0qpMpY.js → orbit-map-BpNCTagm.js} +1 -1
  50. package/dist/assets/overview-page-DQB4q_vg.js +1 -0
  51. package/dist/assets/{page-hero-DYmFM6-q.js → page-hero-ED69y6m0.js} +1 -1
  52. package/dist/assets/pill-cluster-DbPrs1Y4.js +1 -0
  53. package/dist/assets/{preference-entity-handoff-button-1XXtBsUF.js → preference-entity-handoff-button-NkwkWqGv.js} +1 -1
  54. package/dist/assets/{preferences-page-OwfPIQwe.js → preferences-page-BFUVjsHA.js} +1 -1
  55. package/dist/assets/{project-collections-DfmkBk9d.js → project-collections-DHXN2w-P.js} +1 -1
  56. package/dist/assets/{project-detail-page-BC_MNaca.js → project-detail-page-nE0M0UmN.js} +1 -1
  57. package/dist/assets/{project-dialog-BuZdXECa.js → project-dialog-CDkUuAgl.js} +1 -1
  58. package/dist/assets/{project-management-hierarchy-page-AhEHe60K.js → project-management-hierarchy-page-CID81NpW.js} +1 -1
  59. package/dist/assets/{project-management-section-nav-CnaseOqL.js → project-management-section-nav-BjFavt6d.js} +1 -1
  60. package/dist/assets/{projects-boxes-D0zM8PfY.js → projects-boxes-DzGqWlhE.js} +1 -1
  61. package/dist/assets/projects-page-DpFKm_CM.js +1 -0
  62. package/dist/assets/{psyche-behaviors-page-CPurgDg6.js → psyche-behaviors-page-CEQ2EByW.js} +1 -1
  63. package/dist/assets/{psyche-flashcards-page-DnUSe-bb.js → psyche-flashcards-page-D-g1DOS7.js} +1 -1
  64. package/dist/assets/{psyche-goal-map-page-uWocO7kZ.js → psyche-goal-map-page-DbWVOpVH.js} +1 -1
  65. package/dist/assets/{psyche-graph-BDszV3UN.js → psyche-graph-1FHrdH3f.js} +1 -1
  66. package/dist/assets/{psyche-metrics-page-CIJLJTPy.js → psyche-metrics-page-B3736p8_.js} +1 -1
  67. package/dist/assets/{psyche-mode-guide-page-uC8L4WvH.js → psyche-mode-guide-page-CjsMqDsi.js} +1 -1
  68. package/dist/assets/{psyche-modes-page-CtBeRA_3.js → psyche-modes-page-B2qzppBs.js} +1 -1
  69. package/dist/assets/{psyche-page-Ds3QDsin.js → psyche-page-BEPP2B13.js} +1 -1
  70. package/dist/assets/{psyche-patterns-page-Cvq5WshW.js → psyche-patterns-page-CWeNeX2P.js} +2 -2
  71. package/dist/assets/{psyche-questionnaire-builder-page-Cg5Upe6z.js → psyche-questionnaire-builder-page-QFg9LkM0.js} +1 -1
  72. package/dist/assets/{psyche-questionnaire-detail-page-D4jEnNoh.js → psyche-questionnaire-detail-page-D67EJ1D5.js} +1 -1
  73. package/dist/assets/psyche-questionnaire-run-detail-page-C1KsEy8T.js +1 -0
  74. package/dist/assets/{psyche-questionnaire-run-page-Yg_VG2vq.js → psyche-questionnaire-run-page-CB3rSTAX.js} +1 -1
  75. package/dist/assets/{psyche-questionnaires-page-BqeOJRj7.js → psyche-questionnaires-page-wU3bZws7.js} +1 -1
  76. package/dist/assets/{psyche-report-detail-page-BtcMQ7mk.js → psyche-report-detail-page-DI3jE820.js} +3 -3
  77. package/dist/assets/{psyche-reports-page-tagvW0To.js → psyche-reports-page-aUbgZ_12.js} +1 -1
  78. package/dist/assets/{psyche-schemas-CvRSkI_u.js → psyche-schemas-B00gm5HO.js} +1 -1
  79. package/dist/assets/{psyche-schemas-beliefs-page-4NL3415v.js → psyche-schemas-beliefs-page-C_PMXwjL.js} +2 -2
  80. package/dist/assets/{psyche-screen-time-page-Bc5AwZHQ.js → psyche-screen-time-page-CMIgDG-3.js} +1 -1
  81. package/dist/assets/{psyche-self-observation-page-CUrUYbQ_.js → psyche-self-observation-page-DC3orZgf.js} +1 -1
  82. package/dist/assets/{psyche-values-page-BshT2sXE.js → psyche-values-page-CPdKfTdl.js} +2 -2
  83. package/dist/assets/{question-flow-dialog-CPyXCqA-.js → question-flow-dialog-B4B3BI8e.js} +2 -2
  84. package/dist/assets/{report-chain-fields-C0UMLpze.js → report-chain-fields-D-XNut8V.js} +1 -1
  85. package/dist/assets/rewards-page-D8w07BIZ.js +1 -0
  86. package/dist/assets/{scheduling-rules-editor-DiA6KkQ4.js → scheduling-rules-editor-Cn6t-RRn.js} +1 -1
  87. package/dist/assets/{schema-badge-DURw2eYH.js → schema-badge-Dsk9AoYd.js} +1 -1
  88. package/dist/assets/{schemas-D_z2C8l1.js → schemas-3GS34K1i.js} +1 -1
  89. package/dist/assets/{select-menu-BUB8__Nx.js → select-menu-BDeaaa4m.js} +1 -1
  90. package/dist/assets/{settings-agents-page-Kk98Whcf.js → settings-agents-page-CkS4s4kN.js} +2 -2
  91. package/dist/assets/settings-bin-page-BHlW0n-a.js +1 -0
  92. package/dist/assets/{settings-calendar-page-CdhlUnUW.js → settings-calendar-page-BAmKOPeT.js} +3 -3
  93. package/dist/assets/{settings-data-page-BvvuZNbb.js → settings-data-page-C-VrzHGq.js} +1 -1
  94. package/dist/assets/{settings-logs-page-CrzkXxtZ.js → settings-logs-page-CnVuzJ7d.js} +1 -1
  95. package/dist/assets/{settings-mobile-page-Dl582NK6.js → settings-mobile-page-0SWGg6CE.js} +1 -1
  96. package/dist/assets/settings-models-page-BjVixsws.js +1 -0
  97. package/dist/assets/{settings-page-DqnlOCgo.js → settings-page-DVZ58c3R.js} +1 -1
  98. package/dist/assets/settings-rewards-page-Df0ONVFq.js +1 -0
  99. package/dist/assets/{settings-section-nav-C1NcWveT.js → settings-section-nav-Btjx5m2u.js} +1 -1
  100. package/dist/assets/settings-users-page-Cl0YuOOI.js +1 -0
  101. package/dist/assets/{settings-wiki-page-CkpnUkiZ.js → settings-wiki-page-K8KBzeYx.js} +1 -1
  102. package/dist/assets/{sleep-page-DrS1zs3B.js → sleep-page-BFj8hcTf.js} +1 -1
  103. package/dist/assets/{sports-page-EVnB_zjB.js → sports-page-7yta1r8s.js} +1 -1
  104. package/dist/assets/{state-DWw8Jay_.js → state-CkEUXgqt.js} +1 -1
  105. package/dist/assets/{strategies-page-COhyv_SH.js → strategies-page-BQoWnPtN.js} +1 -1
  106. package/dist/assets/strategy-detail-page-D9DTQoyy.js +1 -0
  107. package/dist/assets/strategy-dialog-z9w2UB3s.js +1 -0
  108. package/dist/assets/{surface-Dg5fauKP.js → surface-BL_bDiZ5.js} +1 -1
  109. package/dist/assets/{table-CWVROEBP.js → table--SK_dk4S.js} +1 -1
  110. package/dist/assets/{task-detail-page-3IeMYIXl.js → task-detail-page-RcbvVzXn.js} +1 -1
  111. package/dist/assets/{task-dialog-B7ZT4KE5.js → task-dialog-ri1qEzPp.js} +4 -4
  112. package/dist/assets/timebox-planning-dialog-DoeeGwCm.js +1 -0
  113. package/dist/assets/{today-boxes-BbUNpb16.js → today-boxes-CTw0D5JP.js} +1 -1
  114. package/dist/assets/today-page-5-qRLbBt.js +1 -0
  115. package/dist/assets/{training-load-page-DTYbu9f0.js → training-load-page-DrGnOtnH.js} +1 -1
  116. package/dist/assets/{ui-CdEDMtXF.js → ui-CDt36qNz.js} +1 -1
  117. package/dist/assets/{use-anchored-overlay-position-Cracjgo6.js → use-anchored-overlay-position-C2kg0Ay0.js} +1 -1
  118. package/dist/assets/{use-psyche-focus-target-DvRgu-94.js → use-psyche-focus-target-p2l8W-Af.js} +1 -1
  119. package/dist/assets/{user-badge-B8hYK6NU.js → user-badge-BWoSrGA-.js} +1 -1
  120. package/dist/assets/{user-select-field-akGHK-2t.js → user-select-field-DbB9v7Lf.js} +1 -1
  121. package/dist/assets/{utility-widgets-D4KsKxLT.js → utility-widgets-fodvUR7I.js} +2 -2
  122. package/dist/assets/{vendor-y_uz1Wft.js → vendor-Dgw7UY7q.js} +1 -1
  123. package/dist/assets/{vitals-page-Cjcxh-kO.js → vitals-page-f8QdPdpp.js} +1 -1
  124. package/dist/assets/{weekly-review-page-CR57efzH.js → weekly-review-page-D0wPiQgO.js} +1 -1
  125. package/dist/assets/{weight-loss-page-Bk7YkB7b.js → weight-loss-page-BT9dPxYi.js} +1 -1
  126. package/dist/assets/{wiki-article-markdown-um6gpmGQ.js → wiki-article-markdown-Hyu5JwrY.js} +1 -1
  127. package/dist/assets/{wiki-editor-page-DdP5hvjZ.js → wiki-editor-page-ujqNw8ua.js} +1 -1
  128. package/dist/assets/{wiki-ingest-history-page-DSTndduq.js → wiki-ingest-history-page-BwoDT00-.js} +1 -1
  129. package/dist/assets/{wiki-ingest-modal-PNW3CJ-o.js → wiki-ingest-modal-cvnNma0M.js} +1 -1
  130. package/dist/assets/{wiki-page-CsJlPyQ6.js → wiki-page-jHyJ7EgO.js} +1 -1
  131. package/dist/assets/{workbench-flow-page-DFtIKgNe.js → workbench-flow-page-DJD5sXMF.js} +1 -1
  132. package/dist/assets/{workbench-page-DEpKjMEv.js → workbench-page-Ci0xh6rG.js} +1 -1
  133. package/dist/assets/{workout-detail-page-BwfEhxA_.js → workout-detail-page-DA30ubtE.js} +2 -2
  134. package/dist/index.html +8 -8
  135. package/dist/openclaw/tools.js +1 -1
  136. package/dist/server/apps/api/src/app.js +26 -8
  137. package/dist/server/apps/api/src/openapi.js +103 -24
  138. package/dist/server/apps/api/src/services/artifacts.js +138 -68
  139. package/dist/server/apps/web/src/lib/api.js +3 -0
  140. package/openclaw.plugin.json +1 -1
  141. package/package.json +1 -1
  142. package/skills/forge-openclaw/SKILL.md +7 -5
  143. package/skills/forge-openclaw/entity_conversation_playbooks.md +5 -3
  144. package/dist/assets/artifacts-page-Bqjp0L-L.js +0 -2
  145. package/dist/assets/goal-detail-page-BhMrnVQs.js +0 -1
  146. package/dist/assets/goals-page-CesC8IkZ.js +0 -1
  147. package/dist/assets/index-CHbe1sy1.css +0 -1
  148. package/dist/assets/index-Dj8q65se.js +0 -2
  149. package/dist/assets/overview-page-C1RX7dcq.js +0 -1
  150. package/dist/assets/pill-cluster-ClkmFVFT.js +0 -1
  151. package/dist/assets/projects-page-ltrWfLrA.js +0 -1
  152. package/dist/assets/psyche-questionnaire-run-detail-page-CWoZEY31.js +0 -1
  153. package/dist/assets/rewards-page-D9BzsNPW.js +0 -1
  154. package/dist/assets/settings-bin-page-BnJ-mgy2.js +0 -1
  155. package/dist/assets/settings-models-page-COoBw28S.js +0 -1
  156. package/dist/assets/settings-rewards-page-Cw5QSTjy.js +0 -1
  157. package/dist/assets/settings-users-page-0opvepcM.js +0 -1
  158. package/dist/assets/strategy-detail-page-BaCVkvIu.js +0 -1
  159. package/dist/assets/strategy-dialog-DvlPo9WV.js +0 -1
  160. package/dist/assets/timebox-planning-dialog-DoZzpEBp.js +0 -1
  161. package/dist/assets/today-page-adKXN2g1.js +0 -1
@@ -1 +0,0 @@
1
- import{r as E,j as e,aC as $}from"./vendor-y_uz1Wft.js";import{A as q}from"./ai-surface-workspace-GPZzIIut.js";import{i as F}from"./state-DWw8Jay_.js";import{T as Q,W as B,M as z,S as G,Q as Y}from"./utility-widgets-D4KsKxLT.js";import{F as J}from"./flagship-signal-deck-DZx_HEH9.js";import{u as Z,d as ee,bk as te,z as R,y as L,bl as D,j as p,ad as ie,c as se,C as M,b as ae,E as re,_ as ne,a0 as le,bm as oe,bn as de,a$ as ce,bo as ue}from"./index-Dj8q65se.js";import{L as me}from"./life-force-workspace-BNeMbRHf.js";import{E as pe}from"./entity-note-count-link-FOK_qhcC.js";import{P as fe}from"./page-hero-DYmFM6-q.js";import{a as ve,g as xe}from"./activity-copy-Bj4h9OcF.js";import"./board-CGgOvBP9.js";import"./generic-node-view-C1kLClIm.js";import"./graph-U1J6VkbG.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./forms-DhEGHkFR.js";import"./floating-action-menu-CFrgvQJi.js";import"./charts-Cdtn55ol.js";const f={"Life Force":"Life Force compares today's spent Action Points with the modeled daily budget. It is Forge's local capacity planning layer, not a medical score.",Momentum:"Momentum summarizes recent execution, XP, streak context, and movement across Forge records. Use it as an attention signal.",Instant:"Instant AP/hour estimates current headroom from the Life Force drain model. Higher values mean Forge thinks the next block can absorb more effort.",Level:"Level comes from the XP ledger. It represents accumulated meaningful Forge activity for the selected user scope.","Weekly XP":"Weekly XP is recent reward-ledger movement. It helps separate a genuinely active week from old accumulated progress."};function he(a){const n=["gamification","summary","pipeline","body-signals","signals"],t=[...a.order];let r=!1;for(const v of n)t.includes(v)||(t.push(v),r=!0);const j=t.indexOf("summary"),c=t.indexOf("pipeline"),x=t.indexOf("body-signals"),g=t.indexOf("signals");if(j===-1||c===-1||x===-1||g===-1)return r?{...a,order:t}:a;if(j<c&&c<x&&x<g&&!r)return a;for(const v of n){const b=t.indexOf(v);b!==-1&&t.splice(b,1)}const y=t.indexOf("goals");return t.splice(y===-1?0:y,0,...n),{...a,order:t}}function ge(a=new Date){const n=a.getFullYear(),t=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${n}-${t}-${r}`}function W(a){if(a>=3600){const n=a/3600;return n>=10||Number.isInteger(n)?`${Math.round(n)}h`:`${n.toFixed(1)}h`}return`${Math.max(1,Math.round(a/60))}m`}function ye(a){return a>=1e3?`${(a/1e3).toFixed(1)} km`:`${Math.round(a)} m`}function be(a){if(!a)return[];const n=new Map;for(const t of a.segments){if(t.kind!=="stay"||t.durationSeconds<=0)continue;const r=t.label.trim()||"Unlabeled stay";n.set(r,(n.get(r)??0)+t.durationSeconds)}return[...n.entries()].map(([t,r])=>({label:t,seconds:r})).sort((t,r)=>r.seconds-t.seconds).slice(0,3)}function ke(a){return a?["restingHeartRate","heartRateVariabilitySDNN","vo2Max","oxygenSaturation"].map(t=>a.metrics.find(r=>r.metric===t)).filter(t=>!!t).slice(0,3):[]}function we(a){if(a.latestValue==null)return"No reading";const n=a.unit==="steps"||a.unit==="flights"||a.unit==="kcal"||a.unit==="min"?0:1;return`${a.latestValue.toLocaleString(void 0,{maximumFractionDigits:n,minimumFractionDigits:n===0||a.latestValue>=100?0:1})} ${a.unit}`}function De(){var X,C;const{t:a}=Z(),n=ee(),t=n.snapshot,r=Array.isArray(n.selectedUserIds)?n.selectedUserIds:[],j=r.join("|"),[c,x]=E.useState(!1);E.useEffect(()=>{x(!1);const i=window.setTimeout(()=>{x(!0)},650);return()=>window.clearTimeout(i)},[j]);const g=ge(),y=F({queryKey:["forge-overview-sleep",...r],queryFn:async()=>(await oe(r)).sleep,enabled:c,staleTime:6e4})??{},v=F({queryKey:["forge-overview-fitness",...r],queryFn:async()=>(await de(r,{compact:!0})).fitness,enabled:c,staleTime:6e4})??{},b=F({queryKey:["forge-overview-movement-day",g,...r],queryFn:async()=>(await ce({date:g,userIds:r})).movement,enabled:c,staleTime:6e4})??{},H=F({queryKey:["forge-overview-vitals",...r],queryFn:async()=>(await ue(r)).vitals,enabled:c,staleTime:6e4})??{},I=te(r,{skip:!c}),u=t.dashboard.milestoneRewards.find(i=>!i.completed)??t.dashboard.milestoneRewards[0]??null,o=t.overview.topTasks[0]??null,d=t.overview.dueHabits[0]??null,m=t.overview.recentEvidence[0]??null,V=new Map(t.projects.map(i=>[i.id,i])),N=t.metrics.momentumScore>=80?"Strong":t.metrics.momentumScore>=60?"Steady":"Needs attention",k=((X=y.data)==null?void 0:X.summary)??null,h=((C=v.data)==null?void 0:C.summary)??null,l=b.data,S=H.data??null,A=ke(S??void 0),T=be(l),O=k!==null||h!==null||S!==null,P=l!==void 0&&(l.summary.tripCount>0||l.summary.stayCount>0||l.summary.totalMovingSeconds>0||T.length>0),K=t.lifeForce?[{label:"Life Force",value:`${Math.round(t.lifeForce.spentTodayAp)} / ${Math.round(t.lifeForce.dailyBudgetAp)} AP`,detail:`Remaining ${R(t.lifeForce.remainingAp)}`,help:f["Life Force"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${N} · ${t.metrics.streakDays} day streak`,help:f.Momentum},{label:"Instant",value:L(t.lifeForce.instantFreeApPerHour),detail:t.lifeForce.overloadApPerHour>0?`${L(t.lifeForce.overloadApPerHour)} overload`:"Headroom right now",help:f.Instant},{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:f.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:f["Weekly XP"]}]:[{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:f.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:f["Weekly XP"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${N} · ${t.metrics.streakDays} day streak`,help:f.Momentum}];function _(i){return i.entityType==="goal"?`/goals/${i.entityId}`:i.entityType==="project"?`/projects/${i.entityId}`:i.entityType==="task"?`/tasks/${i.entityId}`:i.entityType==="habit"?"/habits":i.entityType==="task_run"&&typeof i.metadata.taskId=="string"?`/tasks/${i.metadata.taskId}`:`/activity?eventId=${i.id}`}const U=[{id:"hero",title:"Overview",description:"The route header stays movable like any other surface block.",defaultWidth:12,defaultHeight:2,removable:!1,minHeight:2,maxHeight:3,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(fe,{title:"Overview",titleText:"Overview",description:`${N}. Life Force, momentum, XP, goals, active projects, and top tasks all start here.`,badge:`Momentum ${t.metrics.momentumScore}`})},{id:"gamification",title:"Forge Smith",description:"Selected-user level, XP, streak, trophy, and unlock state.",defaultWidth:12,defaultHeight:4,removable:!1,minHeight:3,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:({compact:i})=>{var s;return I.data?e.jsx(D,{metrics:I.data.metrics,compact:i}):e.jsx(D,{metrics:{scope:{mode:"operator_fallback",userIds:t.userScope.selectedUserIds,users:t.userScope.selectedUsers,label:((s=t.userScope.selectedUsers[0])==null?void 0:s.displayName)??"Forge"},profile:t.metrics,achievements:[],milestoneRewards:[],momentumPulse:{status:t.metrics.momentumScore>=80?"surging":t.metrics.momentumScore>=60?"steady":"recovering",headline:`${t.metrics.streakDays}-day streak`,detail:`${t.metrics.currentLevelXp}/${t.metrics.nextLevelXp} XP in level ${t.metrics.level}.`,celebrationLabel:"Forge Smith",nextMilestoneId:null,nextMilestoneLabel:"Next unlock"},catalogPreview:[],unlockedItemCount:0,totalItemCount:144,nextUnlock:null,newestUnlock:null,nextTargets:[],equipment:{selectedMascotSkin:null,selectedHudTreatment:null,selectedStreakEffect:null,selectedTrophyShelf:null,selectedCelebrationVariant:null,updatedAt:null},mascot:{mood:"wise",spriteKey:"mascot-state-014",streakSpriteKey:"mascot-state-017",headline:"Small heat still counts.",line:"Return to the anvil today.",pressureLevel:0,missedDays:0,lastActiveDateKey:null},celebrations:[],recentLedger:[],rules:[],dailyAmbientXp:0,dailyAmbientCap:12},compact:i})}},{id:"summary",title:"Momentum summary",description:"Smaller titles and denser metrics free space for the widgets themselves.",defaultWidth:12,defaultHeight:3,minWidth:6,render:({compact:i})=>e.jsxs("div",{className:"rounded-[24px] bg-[var(--ui-surface-1)] 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:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Momentum summary"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:"Core live metrics"}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Life Force, momentum, XP, and instant headroom stay grouped here."})]}),e.jsx(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:N})]}),e.jsx("div",{className:se("mt-4 grid gap-3",i?"grid-cols-2":"sm:grid-cols-2 xl:grid-cols-5"),children:K.map(s=>e.jsxs("div",{className:"rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[e.jsx("span",{children:s.label}),e.jsx(ie,{label:`Explain ${s.label}`,title:s.label,content:s.help,panelClassName:"normal-case tracking-normal"})]}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-[var(--ui-ink-strong)]",children:s.value}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-faint)]",children:s.detail})]},s.label))})]})},{id:"life-force",title:"Life Force",description:"Dynamic Action Points, the editable capacity curve, current drains, and stat growth all live here.",defaultWidth:12,defaultHeight:7,minWidth:6,render:()=>t.lifeForce?e.jsx(me,{selectedUserIds:r,fallbackLifeForce:t.lifeForce,onRefresh:n.refresh,showEditor:!1}):e.jsx(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Life Force is not configured for this user yet. Once a profile exists, the full capacity curve, drains, and recommendations will appear here."})},{id:"body-signals",title:"Life, health, movement",description:"Health imports and movement context make the overview feel like a real daily operating page.",defaultWidth:12,defaultHeight:4,minWidth:6,render:()=>e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-3",children:[e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Life Force"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:t.lifeForce?`${Math.round(t.lifeForce.remainingAp)} AP remaining`:"No Life Force profile yet"})]}),t.lifeForce?e.jsx(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:L(t.lifeForce.instantFreeApPerHour)}):null]}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:t.lifeForce?`${Math.round(t.lifeForce.spentTodayAp)} / ${Math.round(t.lifeForce.dailyBudgetAp)} AP spent today. Remaining ${R(t.lifeForce.remainingAp)} with ${L(t.lifeForce.currentDrainApPerHour)} current drain.`:"Once Life Force is configured, this block will show today's budget, remaining headroom, and live drain."})]}),e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Body signals"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:O?"Recovery, training, and vitals":"No health data yet"})]}),S?e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[S.summary.metricCount," metrics"]}):null]}),y.isLoading||v.isLoading||H.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Loading recent sleep, workout, and body-signal metrics…"}):O?e.jsxs("div",{className:"mt-3 grid gap-2 text-sm text-[var(--ui-ink-soft)]",children:[k?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Average sleep"}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:W(k.averageSleepSeconds)})]}):null,k?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Sleep score"}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:Math.round(k.averageSleepScore)})]}):null,h?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Exercise"}),e.jsxs("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:[Math.round(h.exerciseMinutes)," min"]})]}):null,h?e.jsx("div",{className:"text-xs leading-5 text-[var(--ui-ink-faint)]",children:h.topWorkoutType?`${h.topWorkoutType} is the top workout type right now.`:"Workout imports are available when Apple Health or habit-generated sessions exist."}):null,A.length>0?e.jsx("div",{className:"mt-1 grid gap-2",children:A.map(i=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-2",children:[e.jsx("span",{children:i.label}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:we(i)})]},i.metric))}):null]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Sleep, workout, and vitals summaries appear here as soon as Forge has recent HealthKit records."})]}),e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Movement"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:P?"Today's place balance":"No movement timeline yet"})]}),P?e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[W((l==null?void 0:l.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),b.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Loading today's stays, trips, and place balance…"}):P?e.jsxs("div",{className:"mt-3 grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[T.map(i=>e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[W(i.seconds)," at ",i.label]},i.label)),((l==null?void 0:l.summary.totalMovingSeconds)??0)>0?e.jsxs(p,{className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[W((l==null?void 0:l.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),e.jsxs("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:[(l==null?void 0:l.summary.tripCount)??0," trip",((l==null?void 0:l.summary.tripCount)??0)===1?"":"s"," and"," ",ye((l==null?void 0:l.summary.totalDistanceMeters)??0)," ","tracked today."]})]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Movement summaries appear here once the companion has synced stays, trips, or known places."})]})]})},{id:"signals",title:"Action signals",description:"Direct links to the next things worth opening.",defaultWidth:7,defaultHeight:4,minWidth:4,render:()=>e.jsx(J,{eyebrow:"Actions",title:"Open what matters now",description:"These cards stay compact by default so the page can fit more live context at once.",items:[{id:"top-task",label:o?"Top task":d?"Due habit":"Recovery lane",title:(o==null?void 0:o.title)??(d==null?void 0:d.title)??"Get a real task moving",detail:(o==null?void 0:o.description)||(d==null?void 0:d.description)||"There is no single top task yet, so use this surface to choose one clean next move.",badge:o?`${o.points} xp`:d?`${d.rewardXp} xp`:`${t.metrics.weeklyXp} weekly xp`,href:o?`/tasks/${o.id}`:d?"/habits":"/today",actionLabel:o?"Open task":d?"Open habits":"Open today"},{id:"reward",label:"Next reward",title:(u==null?void 0:u.title)??"Keep the streak alive",detail:(u==null?void 0:u.progressLabel)??`Level ${t.metrics.level} is active. ${t.metrics.weeklyXp} weekly XP is already logged.`,badge:(u==null?void 0:u.rewardLabel)??`${t.metrics.comboMultiplier.toFixed(2)}x combo`,href:"/rewards",actionLabel:"Open rewards"},{id:"recent-activity",label:"Recent activity",title:m?xe(m):"No recent evidence",detail:m?ve(m):"The next work closeout or note will appear here.",badge:(m==null?void 0:m.source)??"activity",href:m?_(m):"/activity",actionLabel:"Open"}]})},{id:"goals",title:"Goals",description:"Long-range direction stays visible without taking over the whole page.",defaultWidth:8,defaultHeight:5,minWidth:4,render:({compact:i})=>e.jsx("div",{className:"grid gap-3",children:t.overview.activeGoals.slice(0,i?2:4).map(s=>{var w;return e.jsxs("div",{className:"group relative rounded-[20px] bg-[var(--ui-surface-1)] p-4 transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsx($,{to:`/goals/${s.id}`,className:"absolute inset-0 rounded-[20px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--primary)]","aria-label":`Open goal ${s.title}`}),e.jsxs("div",{className:"pointer-events-none relative z-10",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsx(ae,{kind:"goal",label:((w=s.tags[0])==null?void 0:w.name)??s.horizon,compact:!0,gradient:!1}),e.jsxs("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[s.progress,"%"]})]}),e.jsx("div",{className:"mt-3",children:e.jsx(re,{kind:"goal",label:s.title,variant:"heading",size:i?"md":"lg",lines:2,className:"max-w-full",labelClassName:"[overflow-wrap:anywhere]"})}),i?null:e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:s.description}),e.jsx("div",{className:"mt-3",children:e.jsx(ne,{value:s.progress})})]}),e.jsx("div",{className:"relative z-20 mt-3",children:e.jsx(pe,{entityType:"goal",entityId:s.id,count:le(t.dashboard.notesSummaryByEntity,"goal",s.id).count})})]},s.id)})})},{id:"pipeline",title:"Projects, habits, tasks",description:"Execution blocks can shrink while keeping the useful subtitles visible.",defaultWidth:12,defaultHeight:5,minWidth:6,render:({compact:i})=>e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-3",children:[e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Projects"}),t.overview.projects.slice(0,i?3:4).map(s=>{var w;return e.jsxs($,{to:`/projects/${s.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:((w=V.get(s.id))==null?void 0:w.status)??"active"})]}),e.jsxs(p,{wrap:!0,className:"max-w-[7rem] shrink-0",children:[s.earnedPoints," xp"]})]}),i?null:e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:s.description})]},s.id)})]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Due habits"}),t.overview.dueHabits.slice(0,i?3:4).map(s=>e.jsx($,{to:"/habits","aria-label":`Open habit ${s.title}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:s.title}),i?null:e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:s.description})]}),e.jsxs(p,{wrap:!0,className:"max-w-[7rem] shrink-0 bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[s.rewardXp," xp"]})]})},s.id))]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Top tasks"}),t.overview.topTasks.slice(0,i?3:4).map(s=>e.jsx($,{to:`/tasks/${s.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:s.status.replaceAll("_"," ")})]}),e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[s.points," xp"]})]})},s.id))]})]})},{id:"time",title:"Clock",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(Q,{compact:i})},{id:"weather",title:"Weather",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(B,{compact:i})},{id:"mini-calendar",title:"Mini calendar",description:"Optional utility widget.",defaultWidth:4,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>e.jsx(z,{compact:i})},{id:"spotify",title:"Spotify",description:"Optional utility widget.",defaultWidth:4,defaultHeight:2,defaultHidden:!0,render:()=>e.jsx(G,{surfaceId:"overview"})},{id:"quick-capture",title:"Quick capture",description:"Save a standalone note or wiki draft from any dashboard.",defaultWidth:5,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>{var s;return e.jsx(Y,{compact:i,defaultUserId:r[0]??((s=t.users[0])==null?void 0:s.id)??null})}}];return e.jsx(q,{surfaceId:"overview",baseWidgets:U,normalizeLayout:he})}export{De as OverviewPage};
@@ -1 +0,0 @@
1
- import{j as t}from"./vendor-y_uz1Wft.js";import{c as a}from"./index-Dj8q65se.js";function i({children:r,className:s}){return t.jsx("div",{className:a("flex flex-wrap gap-2",s),children:r})}export{i as P};
@@ -1 +0,0 @@
1
- import{j as e,r as g,aK as X,b8 as J,aC as A}from"./vendor-y_uz1Wft.js";import{A as Y}from"./ai-surface-workspace-GPZzIIut.js";import{P as Z}from"./pill-cluster-ClkmFVFT.js";import{c as V,j as C,b as D,d as U,a0 as q,C as M,E as W,_ as H,B as O,h as ee}from"./index-Dj8q65se.js";import{P as te,a as se,b as ae}from"./projects-boxes-D0zM8PfY.js";import{P as ie}from"./page-hero-DYmFM6-q.js";import{E as re}from"./entity-note-count-link-FOK_qhcC.js";import{b as ne,f as oe,P as le}from"./project-collections-DfmkBk9d.js";import{P as ce}from"./project-management-section-nav-CnaseOqL.js";import{U as de}from"./user-badge-B8hYK6NU.js";import{b as F,d as R}from"./user-ownership-DJGl4rAj.js";import"./board-CGgOvBP9.js";import"./state-DWw8Jay_.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./forms-DhEGHkFR.js";import"./generic-node-view-C1kLClIm.js";import"./graph-U1J6VkbG.js";import"./define-workbench-box-Dbl9W7oE.js";function ue({children:s,columns:d="single",className:w}){return e.jsx("section",{className:V("grid gap-4",d==="two"&&"lg:grid-cols-2",d==="sidebar"&&"xl:grid-cols-[minmax(0,25rem)_minmax(0,1fr)]",w),children:s})}function me(s){return s.trim().toLowerCase()}function Q(s,d=!1){switch(s.kind){case"goal":return e.jsx(D,{kind:"goal",label:s.label,compact:!0,gradient:!1});case"task":return e.jsx(D,{kind:"task",label:s.label,compact:!0,gradient:!1});case"tag":return e.jsx(C,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:s.label});case"status":return e.jsx(C,{className:"bg-[var(--ui-accent-soft)] text-[color-mix(in_srgb,var(--primary)_72%,var(--ui-ink-strong)_28%)]",children:s.label});case"type":return e.jsx(C,{className:"bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_76%,var(--ui-ink-strong)_24%)]",children:s.label});case"user":return e.jsx(C,{className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]",children:s.label});default:return s.label}}function he({query:s,onQueryChange:d,options:w,selectedOptionIds:m,onSelectedOptionIdsChange:I,resultSummary:P}){const[L,j]=g.useState(!1),[T,p]=g.useState(0),N=g.useMemo(()=>m.map(n=>w.find(l=>l.id===n)).filter(Boolean),[w,m]),S=me(s),b=g.useMemo(()=>{const n=w.filter(l=>!m.includes(l.id));return S?n.filter(l=>`${l.label} ${l.description??""} ${l.searchText??""}`.toLowerCase().includes(S)).slice(0,10):n.slice(0,10)},[S,w,m]),k=n=>{m.includes(n)||(I([...m,n]),d(""),p(0),j(!1))},B=n=>{I(m.filter(l=>l!==n))},K=()=>{d(""),I([]),p(0),j(!1)};return e.jsx("div",{className:"grid gap-3",children:e.jsxs("div",{className:"rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 shadow-[var(--ui-shadow-soft)] sm: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-label text-[11px] uppercase tracking-[0.2em] text-[var(--ui-ink-muted)]",children:"Project search"}),e.jsx("div",{className:"mt-2 max-w-2xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Search with free text, then pin matching goals, tasks, tags, human users, bot users, statuses, or project-type chips as you narrow the list."})]}),s.trim().length>0||m.length>0?e.jsx("button",{type:"button",onClick:K,className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-2 text-sm text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",children:"Clear search"}):null]}),e.jsxs("div",{className:"mt-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[N.length>0?e.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:N.map(n=>e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-2.5 py-1.5",children:[Q(n,!0),e.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-soft)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>B(n.id),"aria-label":`Remove ${n.label}`,children:e.jsx(X,{className:"size-3.5"})})]},n.id))}):null,e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(J,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx("input",{value:s,onChange:n=>{d(n.target.value),j(!0),p(0)},onFocus:()=>j(!0),onBlur:()=>{window.setTimeout(()=>j(!1),120)},onKeyDown:n=>{if(n.key==="Backspace"&&!s&&m.length>0){B(m[m.length-1]);return}if(n.key==="ArrowDown"){n.preventDefault(),j(!0),p(l=>b.length===0?0:Math.min(b.length-1,l+1));return}if(n.key==="ArrowUp"){n.preventDefault(),p(l=>Math.max(0,l-1));return}if(n.key==="Escape"){j(!1);return}n.key==="Enter"&&b[T]&&(n.preventDefault(),k(b[T].id))},placeholder:"Type a project, goal, task, human, bot, user, or tag",className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-muted)] focus:outline-none"})]}),L?e.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-strong)] backdrop-blur-xl",children:b.length>0?b.map((n,l)=>e.jsx("button",{type:"button",className:V("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",l===T?"bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>p(l),onMouseDown:_=>_.preventDefault(),onClick:()=>k(n.id),children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:Q(n)}),n.description?e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-soft)]",children:n.description}):null]})},n.id)):e.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-muted)]",children:"Keep typing to search by free text, or select a suggested goal, task, human or bot owner, tag, status, or type chip when it appears."})}):null]})]}),e.jsx("div",{className:"mt-3 text-sm text-[var(--ui-ink-soft)]",children:P})]})})}const pe={execution:"Execution",value:"Value",category:"Category"};function xe(s){return s.trim().toLowerCase()}function ze(){const s=U(),[d,w]=g.useState("active"),[m,I]=g.useState(""),[P,L]=g.useState([]),[j,T]=g.useState(null),p=g.useMemo(()=>ne(s.snapshot.dashboard.projects),[s.snapshot.dashboard.projects]),N=g.useMemo(()=>{const a=new Map(s.snapshot.dashboard.goals.map(r=>[r.id,r])),o=new Map(s.snapshot.tags.map(r=>[r.id,r])),u=new Map(s.snapshot.users.map(r=>[r.id,r])),f=new Map;for(const r of s.snapshot.tasks){if(!r.projectId)continue;const x=f.get(r.projectId)??[];x.push(r),f.set(r.projectId,x)}return new Map(s.snapshot.dashboard.projects.map(r=>{const x=a.get(r.goalId)??null,$=f.get(r.id)??[],v=r.userId?u.get(r.userId)??null:null,y=new Map;for(const c of(x==null?void 0:x.tags)??[])y.set(c.id,{id:c.id,name:c.name,kind:c.kind});for(const c of $)for(const t of c.tagIds){const i=o.get(t);i&&y.set(i.id,{id:i.id,name:i.name,kind:i.kind})}const E=Array.from(new Set(Array.from(y.values()).map(c=>c.kind))),z=[r.title,r.description,r.goalTitle,(v==null?void 0:v.displayName)??"",(v==null?void 0:v.handle)??"",(v==null?void 0:v.kind)??"",(x==null?void 0:x.description)??"",r.nextTaskTitle??"",r.momentumLabel,r.status,$.map(c=>c.title).join(" "),Array.from(y.values()).map(c=>`${c.name} ${c.kind}`).join(" ")].join(" ").toLowerCase();return[r.id,{tagIds:Array.from(y.keys()),tags:Array.from(y.values()),taskIds:$.map(c=>c.id),typeKeys:E,userId:r.userId,searchText:z}]}))},[s.snapshot.dashboard.goals,s.snapshot.dashboard.projects,s.snapshot.tags,s.snapshot.tasks,s.snapshot.users]),S=g.useMemo(()=>{var v,y,E,z,c;const a=new Map,o=new Map,u=new Map,f=new Map,r=new Map,x=new Map,$=new Map;for(const t of s.snapshot.dashboard.projects){const i=N.get(t.id);if(i){o.has(t.goalId)||o.set(t.goalId,new Set),o.get(t.goalId).add(t.id),r.has(t.status)||r.set(t.status,new Set),r.get(t.status).add(t.id);for(const h of i.taskIds)u.has(h)||u.set(h,new Set),u.get(h).add(t.id);for(const h of i.tags)f.has(h.id)||f.set(h.id,new Set),f.get(h.id).add(t.id);for(const h of i.typeKeys)x.has(h)||x.set(h,new Set),x.get(h).add(t.id);i.userId&&($.has(i.userId)||$.set(i.userId,new Set),$.get(i.userId).add(t.id))}}for(const t of s.snapshot.dashboard.goals){const i=((v=o.get(t.id))==null?void 0:v.size)??0;i!==0&&a.set(`goal:${t.id}`,{id:`goal:${t.id}`,kind:"goal",value:t.id,label:t.title,description:R(`${i} project${i===1?"":"s"} linked to this goal`,t.user,`${i} project${i===1?"":"s"} linked to this goal`),searchText:F([t.title,t.description],t)})}for(const t of s.snapshot.tasks){const i=((y=u.get(t.id))==null?void 0:y.size)??0;i!==0&&a.set(`task:${t.id}`,{id:`task:${t.id}`,kind:"task",value:t.id,label:t.title,description:R(`${i} project${i===1?"":"s"} linked to this task`,t.user,`${i} project${i===1?"":"s"} linked to this task`),searchText:F([t.title,t.description],t)})}for(const t of s.snapshot.tags){const i=((E=f.get(t.id))==null?void 0:E.size)??0;i!==0&&a.set(`tag:${t.id}`,{id:`tag:${t.id}`,kind:"tag",value:t.id,label:t.name,description:R(`${i} project${i===1?"":"s"} touching this tag`,t.user,`${i} project${i===1?"":"s"} touching this tag`),searchText:F([t.name,t.kind,t.description],t)})}for(const[t,i]of Object.entries(p))t==="all"||i===0||a.set(`status:${t}`,{id:`status:${t}`,kind:"status",value:t,label:t==="paused"?"Suspended":t==="completed"?"Finished":"Active",description:`${i} project${i===1?"":"s"} currently ${t==="paused"?"suspended":t==="completed"?"finished":"active"}`,searchText:`${t} ${t==="paused"?"suspended":""} ${t==="completed"?"finished":""}`});for(const[t,i]of Object.entries(pe)){const h=((z=x.get(t))==null?void 0:z.size)??0;h!==0&&a.set(`type:${t}`,{id:`type:${t}`,kind:"type",value:t,label:i,description:`${h} project${h===1?"":"s"} linked to ${i.toLowerCase()} tags`,searchText:`${i} ${t} project type`})}for(const t of s.snapshot.users){const i=((c=$.get(t.id))==null?void 0:c.size)??0;i!==0&&a.set(`user:${t.id}`,{id:`user:${t.id}`,kind:"user",value:t.id,label:t.displayName,description:`${i} project${i===1?"":"s"} owned by this ${t.kind}`,searchText:`${t.displayName} ${t.handle} ${t.kind} ${t.description}`})}return Array.from(a.values()).sort((t,i)=>t.label.localeCompare(i.label))},[p,N,s.snapshot.dashboard.goals,s.snapshot.dashboard.projects,s.snapshot.tags,s.snapshot.tasks,s.snapshot.users]),b=g.useMemo(()=>P.map(a=>S.find(o=>o.id===a)).filter(Boolean),[S,P]),k=g.useMemo(()=>{const a=xe(m);return oe(s.snapshot.dashboard.projects,d).filter(o=>{const u=N.get(o.id);return!u||!b.every(r=>{switch(r.kind){case"goal":return o.goalId===r.value;case"task":return u.taskIds.includes(r.value);case"tag":return u.tagIds.includes(r.value);case"status":return o.status===r.value;case"type":return u.typeKeys.includes(r.value);case"user":return u.userId===r.value;default:return!0}})?!1:a?u.searchText.includes(a):!0})},[d,N,m,b,s.snapshot.dashboard.projects]),B=d==="all"?p.all:p[d],n=m.trim().length>0||P.length>0?`${k.length} matching project${k.length===1?"":"s"} in the current collection view`:`${B} project${B===1?"":"s"} in ${d==="all"?"all project states":d==="paused"?"the suspended view":d==="completed"?"the finished view":"the active view"}`,l=async a=>{T(a);try{await s.patchProject(a,{status:"active"})}finally{T(null)}},_=e.jsx(ue,{columns:"two",className:"2xl:grid-cols-3",children:k.map(a=>{const o=q(s.snapshot.dashboard.notesSummaryByEntity,"project",a.id),u=N.get(a.id),f=(u==null?void 0:u.tags.slice(0,3))??[];return e.jsxs(M,{className:"flex h-full flex-col transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsx(D,{kind:"goal",label:a.goalTitle,compact:!0}),e.jsx(de,{user:a.user,compact:!0})]}),e.jsx(C,{className:a.status==="completed"?"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":a.status==="paused"?"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_76%,var(--ui-ink-strong)_24%)]":"bg-[var(--ui-accent-soft)] text-[var(--primary)]",children:a.status==="paused"?"Suspended":a.status==="completed"?"Finished":"Active"})]}),e.jsx("div",{className:"mt-4",children:e.jsx(A,{to:`/projects/${a.id}`,className:"transition hover:opacity-90",children:e.jsx(W,{kind:"project",label:a.title,variant:"heading",size:"xl",lines:2})})}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description}),f.length>0?e.jsx(Z,{className:"mt-4",children:f.map(r=>e.jsx(C,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:r.name},r.id))}):null,e.jsx("div",{className:"mt-4",children:e.jsx(H,{value:a.progress,tone:a.status==="completed"?"secondary":"primary"})}),e.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Active"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:a.activeTaskCount})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Completed"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:a.completedTaskCount})]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"XP"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:a.earnedPoints})]})]}),e.jsx("div",{className:"mt-5 break-words text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:a.nextTaskTitle?`Next move: ${a.nextTaskTitle}`:"Ready for the next task"}),e.jsx("div",{className:"mt-4",children:e.jsx(re,{entityType:"project",entityId:a.id,count:o.count})}),e.jsxs("div",{className:"mt-5 flex flex-wrap items-center justify-between gap-3 pt-1",children:[e.jsx(A,{to:`/projects/${a.id}`,children:e.jsx(O,{variant:"ghost",children:"Open project"})}),d!=="active"&&a.status!=="active"?e.jsx(O,{variant:"secondary",pending:j===a.id,pendingLabel:"Restarting…",onClick:()=>void l(a.id),children:"Restart"}):null]})]},a.id)})}),G=[{id:"hero",title:"Projects",description:"Route header",defaultWidth:12,defaultHeight:2,removable:!1,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(te,{children:e.jsx(ie,{entityKind:"project",title:e.jsx(W,{kind:"project",label:"Projects",variant:"heading",size:"lg"}),titleText:"Projects",description:"Projects are the concrete paths that move a life goal forward.",badge:`${s.snapshot.dashboard.projects.length} total projects`})})},{id:"search-results",title:"Search and results",description:"Search stays grouped with its live result set.",defaultWidth:8,defaultHeight:6,minWidth:6,render:({compact:a})=>e.jsx(se,{children:e.jsxs("div",{className:"grid min-w-0 gap-4",children:[e.jsx(he,{query:m,onQueryChange:I,options:S,selectedOptionIds:P,onSelectedOptionIdsChange:L,resultSummary:n}),e.jsx(le,{value:d,counts:p,onChange:w}),k.length===0?e.jsxs(M,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"No matching projects"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Nothing in this project collection matches the current search and chips."})]}):a?e.jsx("div",{className:"grid min-w-0 gap-3",children:k.slice(0,5).map(o=>e.jsx(A,{to:`/projects/${o.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-2)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:o.title}),e.jsx("div",{className:"truncate text-sm text-[var(--ui-ink-soft)]",children:o.goalTitle})]}),e.jsxs(C,{wrap:!0,className:"max-w-[7rem] shrink-0 bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",children:[o.earnedPoints," xp"]})]})},o.id))}):_]})})},{id:"summary",title:"Collection summary",description:"Counts and spotlight cards.",defaultWidth:4,defaultHeight:5,minWidth:4,render:()=>{const a=k[0]??s.snapshot.dashboard.projects[0]??null;return e.jsx(ae,{children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-1",children:[e.jsxs(M,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Active"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-[var(--ui-ink-strong)]",children:p.active})]}),e.jsxs(M,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Finished"}),e.jsx("div",{className:"mt-2 font-display text-4xl text-[var(--ui-ink-strong)]",children:p.completed})]})]}),a?e.jsxs(M,{className:"p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Spotlight"}),e.jsx("div",{className:"mt-3 text-base font-semibold text-[var(--ui-ink-strong)]",children:a.title}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description}),e.jsx("div",{className:"mt-3",children:e.jsx(H,{value:a.progress})})]}):null]})})}}];return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(ce,{}),s.snapshot.dashboard.projects.length===0?e.jsx(ee,{eyebrow:"Projects",title:"No projects in flight",description:"Create the first practical path under a life goal so execution, kanban, and evidence all have a concrete home.",action:e.jsx(A,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-[var(--ui-surface-2)] px-4 py-3 text-sm whitespace-nowrap text-[var(--ui-ink-strong)] transition hover:bg-[var(--ui-surface-hover)]",children:"Open goals"})}):e.jsx(Y,{surfaceId:"projects",baseWidgets:G})]})}export{ze as ProjectsPage};
@@ -1 +0,0 @@
1
- import{b_ as g,j as e,aC as o}from"./vendor-y_uz1Wft.js";import{i as h}from"./state-DWw8Jay_.js";import{P as b}from"./page-hero-DYmFM6-q.js";import{L as v,e as w,B as d,C as l,h as f,j,c as y,cw as N}from"./index-Dj8q65se.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./board-CGgOvBP9.js";import"./forms-DhEGHkFR.js";const c="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",u="min-w-0 overflow-hidden border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)]",m="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-4",k="border border-[color-mix(in_srgb,var(--success)_36%,var(--ui-border-subtle)_64%)] bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_70%,var(--ui-ink-strong)_30%)]",C="border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]";function R(){const{runId:t=""}=g(),a=h({queryKey:["forge-psyche-questionnaire-run",t],queryFn:()=>N(t),enabled:t.length>0});if(a.isLoading)return e.jsx(v,{eyebrow:"Questionnaire result",title:"Loading scored run",description:"Hydrating the recorded answers, stored scores, and longitudinal context."});if(a.isError||!a.data)return e.jsx(w,{eyebrow:"Questionnaire result",error:a.error,onRetry:()=>void a.refetch()});const s=a.data,x=new Map(s.answers.map(r=>[r.itemId,r]));return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(b,{eyebrow:"Questionnaire result",title:s.instrument.title,description:"Stored raw answers, computed scores, and score history all remain attached to the exact version used for this run.",badge:s.run.completedAt?"Completed":"Draft",actions:e.jsxs(e.Fragment,{children:[e.jsx(o,{to:`/psyche/questionnaires/${s.instrument.id}`,children:e.jsx(d,{variant:"secondary",children:"Back to questionnaire"})}),e.jsx(o,{to:`/psyche/questionnaires/${s.instrument.id}/take`,children:e.jsx(d,{children:"Take again"})})]})}),e.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,0.9fr)_minmax(18rem,1.1fr)]",children:[e.jsxs(l,{className:u,children:[e.jsx("div",{className:c,children:"Stored scores"}),s.scores.length===0?e.jsx("div",{className:"mt-4",children:e.jsx(f,{eyebrow:"Scores",title:"No scores stored yet",description:"This run has not been completed, so there are no persisted score rows yet."})}):e.jsx("div",{className:"mt-4 grid gap-3",children:s.scores.map(r=>e.jsx("div",{className:m,children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-words text-sm font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:r.label}),r.bandLabel?e.jsx("div",{className:"mt-2 break-words text-xs uppercase tracking-[0.16em] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)] [overflow-wrap:anywhere]",children:r.bandLabel}):null]}),e.jsx("div",{className:"min-w-0 break-words text-right text-lg font-semibold text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:r.valueText??r.valueNumeric??"—"})]})},r.scoreKey))})]}),e.jsxs(l,{className:u,children:[e.jsx("div",{className:c,children:"Answer ledger"}),e.jsx("div",{className:"mt-4 grid gap-3",children:s.version.definition.items.map(r=>{const i=x.get(r.id);return e.jsxs("div",{className:m,children:[e.jsx("div",{className:"break-words text-sm font-medium leading-6 text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:r.prompt}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:r.options.map(n=>{const p=(i==null?void 0:i.optionKey)===n.key;return e.jsx(j,{className:y("max-w-full break-words [overflow-wrap:anywhere]",p?k:C),children:n.label},`${r.id}-${n.key}`)})})]},r.id)})})]})]})]})}export{R as PsycheQuestionnaireRunDetailPage};
@@ -1 +0,0 @@
1
- import{r as S,j as t,aF as le,dv as ce,aI as J,aG as Z,dw as ee,b8 as de,bH as ue}from"./vendor-y_uz1Wft.js";import{j as me,i as he,k as pe}from"./state-DWw8Jay_.js";import{d as ke,e4 as ge,az as fe,bk as ye,e as Ce,a2 as be,B as j,e5 as A,j as N,C as H,c as P,_ as re,cX as ve,e6 as xe,e7 as we}from"./index-Dj8q65se.js";import{P as Se}from"./page-hero-DYmFM6-q.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./board-CGgOvBP9.js";import"./forms-DhEGHkFR.js";const U=[{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}],je=[1,2,3,5,7,14,21,30,45,60,90,180,365,730],Ae=[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 $(r){return r.toLowerCase().replace(/['’]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Te(r,l){const u=(r+1)/l;return u>.82?"platinum":u>.55?"gold":u>.25?"silver":"bronze"}function _e(r){return r==="platinum"?"legendary":r==="gold"?"hard":r==="silver"?"standard":"intro"}function Ne(r){return r==="platinum"?"legendary":r==="gold"?"epic":r==="silver"?"rare":"common"}function Pe(r){return`item-${r.kind}-${$(r.category)}-${$(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 Re=[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.")],Fe=[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"})],Ee=[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.")],Ie=[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"})],Me=[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.")],Ke=[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"})],$e=[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.")],Le=[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"})],Ge=[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.")],Oe=[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"})],He=[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.")],De=[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"})],ze=[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.")],Be=[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"})],We=[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.")],Ue=[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"})],Xe=[...Re,...Fe,...Ee,...Ie,...Me,...Ke,...$e,...Le,...Ge,...Oe,...He,...De,...ze,...Be,...We,...Ue];function Ye(){let r=0,l=0,u=0;const d=new Map;return Xe.map(i=>{const m=U.find(L=>L.id===i.category);if(!m)throw new Error(`Unknown gamification category ${i.category}`);const p=d.get(i.category)??{trophy:0,unlock:0},x=p[i.kind];p[i.kind]+=1,d.set(i.category,p);const R=i.kind==="trophy"?m.trophyCount:m.unlockCount,v=Te(x,R),F=`${i.kind}-${$(i.category)}-${$(i.title)}`,w=i.kind==="trophy"?l++:u++;return{id:F,kind:i.kind,category:i.category,tier:v,difficulty:_e(v),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:F},assetKey:Pe(i),sheetKey:`${i.kind==="trophy"?"trophies":"unlocks"}-r${Math.floor(w/10)+1}-c${w%10+1}`,rarity:Ne(v),sortOrder:r++}})}const y=Ye();function qe(){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 U){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.")}qe();const te=U.map(r=>({id:r.id,label:r.label})),Ve=Array.from({length:30},(r,l)=>`mascot-state-${String(l+1).padStart(3,"0")}`),Qe=je.map((r,l)=>[r,`mascot-state-${String(17+l).padStart(3,"0")}`]),Je=Ae.map((r,l)=>[r,`mascot-state-${String(10-l).padStart(3,"0")}`]),z=Ve;if(z.length!==30)throw new Error(`GAMIFICATION_MASCOT_KEYS must contain exactly 30 mascot/state keys; found ${z.length}.`);function Ze(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 et(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 tt=Object.fromEntries(y.map(r=>[r.assetKey,{key:r.assetKey,role:"item",itemKind:r.kind,alt:`${r.title} ${r.kind} icon.`,dominantColor:Ze(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:et(r)}])),at=Object.fromEntries(z.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"}]}));({...tt,...at});function T(r){r.currentTarget.hidden=!0}const rt=["all","bronze","silver","gold","platinum"],st=[{id:"trophies",label:"Trophies"},{id:"unlocks",label:"Unlocks"},{id:"armory",label:"Mascot Armory"},{id:"streak",label:"Streak Forge"}],B={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 se(r){switch(r){case"platinum":return"border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-accent-soft)] text-[var(--primary)]";case"gold":return"border-[color-mix(in_srgb,var(--warning)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]";case"silver":return"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]";default:return"border-[color-mix(in_srgb,var(--warning)_26%,var(--ui-border-subtle)_74%)] bg-[var(--ui-warning-soft)] text-[var(--warning)]"}}const ae="min-w-0 overflow-hidden rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",D="min-w-0 overflow-hidden rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",C="text-[var(--ui-ink-strong)]",b="text-[var(--ui-ink-soft)]",_="text-[var(--ui-ink-faint)]",W="bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]";function ot(r){const l=r.unlockType?B[r.unlockType]:null,u=l?r.rewardPayload[l.payloadKey]:null;return typeof u=="string"?u:null}function nt({item:r,gamificationTheme:l,onSelect:u}){return t.jsxs("button",{type:"button",onClick:()=>u(r),className:P("group relative min-h-[19rem] overflow-hidden rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 text-left shadow-[var(--ui-shadow-soft)] transition hover:-translate-y-0.5 hover:border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] hover:bg-[var(--ui-surface-hover)]",!r.unlocked&&"opacity-78"),children:[t.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[t.jsx(N,{className:P("border",se(r.tier)),children:r.tier}),t.jsx(N,{className:W,children:r.unlocked?"earned":"locked"})]}),t.jsx("div",{className:"mt-3 grid place-items-center",children:t.jsx("img",{src:A(r.assetKey,512,l),alt:"",onError:T,className:P("size-36 object-contain drop-shadow-[var(--ui-shadow-soft)] 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 ${C}`,children:r.title}),t.jsx("p",{className:`mt-2 line-clamp-2 text-sm leading-6 ${b}`,children:r.unlocked?r.summary:r.requirementText})]}),t.jsxs("div",{className:"mt-4",children:[t.jsx(re,{value:r.progressPercent}),t.jsxs("div",{className:`mt-2 flex justify-between gap-3 text-[11px] uppercase tracking-[0.16em] ${_}`,children:[t.jsxs("span",{children:[r.progressCurrent,"/",r.progressTarget]}),t.jsxs("span",{children:[r.progressPercent,"%"]})]})]})]})}function kt(){var Y,q,V,Q;const r=ke(),l=ge(),u=me(),d=fe(),i=Array.isArray(r.selectedUserIds)?r.selectedUserIds:[],[m,p]=S.useState("trophies"),[x,R]=S.useState("all"),[v,F]=S.useState("all"),[w,L]=S.useState("all"),[G,oe]=S.useState(""),[k,E]=S.useState(null),I=he({queryKey:["forge-gamification-catalog",...i],queryFn:()=>we(i)}),M=ye(i),X=pe({mutationFn:s=>xe(s,i),onSuccess:async()=>{await Promise.all([u.invalidateQueries({queryKey:["forge-gamification-catalog"]}),u.invalidateQueries({queryKey:["forge-xp-metrics"]})]),d(ve.util.invalidateTags(["Gamification"]))}}),g=(Y=I.data)==null?void 0:Y.catalog,O=(g==null?void 0:g.items)??[],ne=S.useMemo(()=>{const s=G.trim().toLowerCase();return O.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"||x!=="all"&&c.category!==x||v!=="all"&&c.tier!==v||w==="unlocked"&&!c.unlocked||w==="locked"&&c.unlocked?!1:s?`${c.title} ${c.summary} ${c.requirementText} ${c.reward}`.toLowerCase().includes(s):!0)},[x,O,G,w,m,v]),h=(g==null?void 0:g.equipment)??((q=M.data)==null?void 0:q.metrics.equipment)??null,ie=O.filter(s=>s.kind==="unlock"&&s.unlockType&&B[s.unlockType]);return I.isError?t.jsx(Ce,{eyebrow:"Rewards",error:I.error,onRetry:()=>void I.refetch()}):t.jsxs("div",{className:"mx-auto grid w-full max-w-[1320px] gap-5",children:[t.jsx(Se,{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:(V=M.data)!=null&&V.metrics?t.jsx(be,{metrics:M.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:ae,children:[t.jsx("div",{className:"flex flex-wrap gap-2",children:st.map(s=>t.jsxs(j,{type:"button",variant:m===s.id?"primary":"secondary",size:"sm",onClick:()=>p(s.id),children:[s.id==="trophies"?t.jsx(le,{className:"size-4"}):null,s.id==="armory"?t.jsx(ce,{className:"size-4"}):null,s.id==="streak"?t.jsx(J,{className:"size-4"}):null,s.id==="unlocks"?t.jsx(Z,{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(j,{type:"button",variant:w===s?"primary":"secondary",size:"sm",onClick:()=>L(s),children:[s==="locked"?t.jsx(ee,{className:"size-4"}):null,s]},s)),t.jsxs("label",{className:`ml-auto flex min-h-10 min-w-0 max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-sm ${b} sm:min-w-[16rem]`,children:[t.jsx(de,{className:`size-4 shrink-0 ${_}`}),t.jsx("input",{value:G,onChange:s=>oe(s.target.value),placeholder:"Search rewards",className:"min-w-0 flex-1 bg-transparent text-[var(--ui-ink-strong)] outline-none placeholder:text-[var(--ui-ink-faint)]"})]})]}),t.jsxs("div",{className:"mt-4 flex min-w-0 flex-wrap gap-2",children:[t.jsx(j,{type:"button",variant:x==="all"?"primary":"secondary",size:"sm",onClick:()=>R("all"),children:"all categories"}),te.map(s=>t.jsx(j,{type:"button",variant:x===s.id?"primary":"secondary",size:"sm",onClick:()=>R(s.id),children:s.label},s.id))]}),t.jsx("div",{className:"mt-4 flex min-w-0 flex-wrap gap-2",children:rt.map(s=>t.jsx(j,{type:"button",variant:v===s?"primary":"secondary",size:"sm",onClick:()=>F(s),children:s},s))})]}),t.jsxs("div",{className:ae,children:[t.jsxs("div",{className:`flex items-center gap-2 text-sm font-semibold ${C}`,children:[t.jsx(Z,{className:"size-4 text-[var(--tertiary)]"}),"Near completion"]}),((g==null?void 0:g.nextTargets)??[]).map(s=>t.jsxs("button",{type:"button",onClick:()=>E(s),className:"grid min-w-0 grid-cols-[2.75rem_minmax(0,1fr)_3rem] items-center gap-3 rounded-2xl border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-2 text-left transition hover:bg-[var(--ui-surface-hover)]",children:[t.jsx("img",{src:A(s.assetKey,256,l),alt:"",onError:T,className:"size-11 object-contain"}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:`block truncate text-sm ${C}`,children:s.title}),t.jsx("span",{className:`block truncate text-[11px] ${_}`,children:s.requirementText})]}),t.jsxs("span",{className:`text-right text-xs ${b}`,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-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 shadow-[var(--ui-shadow-soft)]",children:[t.jsx("img",{src:A(((Q=M.data)==null?void 0:Q.metrics.mascot.spriteKey)??"mascot-state-014",512,l),alt:"Forge Smith mascot",onError:T,className:"absolute inset-x-0 bottom-0 mx-auto h-[23rem] object-contain"}),t.jsxs("div",{className:"relative z-10",children:[t.jsx(N,{className:"bg-[var(--ui-accent-soft)] text-[var(--tertiary)]",children:"Equipped"}),t.jsxs("div",{className:`mt-3 grid gap-1 text-sm ${b}`,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:ie.map(s=>{const c=s.unlockType?B[s.unlockType]:null,f=ot(s),K=!!(c&&f&&(h==null?void 0:h[c.field])===f);return t.jsxs(H,{className:P("p-4",!s.unlocked&&"opacity-70"),children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(N,{className:W,children:(c==null?void 0:c.label)??"Cosmetic"}),K?t.jsx(ue,{className:"size-4 text-[var(--success)]"}):null]}),t.jsx("img",{src:A(s.assetKey,256,l),alt:"",onError:T,className:P("mx-auto mt-3 size-28 object-contain",!s.unlocked&&"grayscale")}),t.jsx("div",{className:`mt-3 font-display text-lg ${C}`,children:s.title}),t.jsx("p",{className:`mt-2 line-clamp-2 text-sm leading-6 ${b}`,children:s.unlocked?s.summary:s.requirementText}),t.jsx(j,{type:"button",variant:K?"secondary":"primary",size:"sm",disabled:!s.unlocked||!c||!f||X.isPending,className:"mt-4 w-full",onClick:()=>{!c||!f||X.mutate({[c.field]:K?null:f})},children:K?"Unequip":s.unlocked?"Equip":"Locked"})]},s.id)})})]}):m==="streak"?t.jsxs("section",{className:"grid gap-4",children:[t.jsxs(H,{className:"p-4",children:[t.jsxs("div",{className:`flex items-center gap-2 font-display text-xl ${C}`,children:[t.jsx(J,{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:Qe.map(([s,c])=>t.jsxs("div",{className:D,children:[t.jsx("img",{src:A(c,256,l),alt:"",onError:T,className:"mx-auto size-28 object-contain"}),t.jsxs("div",{className:`mt-2 text-center text-sm ${b}`,children:[s," day power"]})]},c))})]}),t.jsxs(H,{className:"p-4",children:[t.jsxs("div",{className:`flex items-center gap-2 font-display text-xl ${C}`,children:[t.jsx(ee,{className:`size-5 ${_}`}),"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:Je.map(([s,c])=>t.jsxs("div",{className:D,children:[t.jsx("img",{src:A(c,256,l),alt:"",onError:T,className:"mx-auto size-28 object-contain"}),t.jsxs("div",{className:`mt-2 text-center text-sm ${b}`,children:[s," days away"]})]},c))})]})]}):t.jsx("section",{className:"grid gap-5",children:te.map(s=>{const c=ne.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 ${C}`,children:s.label}),t.jsxs("div",{className:`text-sm ${_}`,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(nt,{item:f,gamificationTheme:l,onSelect:E},f.id))})]},s.id)})}),k?t.jsx("div",{className:"fixed inset-0 z-50 grid place-items-center bg-[var(--ui-overlay)] p-4 backdrop-blur-sm",onClick:()=>E(null),children:t.jsxs("div",{className:"max-h-[calc(100vh-2rem)] w-full max-w-[34rem] overflow-y-auto rounded-[26px] border border-[var(--ui-border-subtle)] bg-[var(--card-gradient)] p-5 shadow-[var(--card-shadow)]",onClick:s=>s.stopPropagation(),children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-4 sm:flex-row sm:items-start",children:[t.jsx("img",{src:A(k.assetKey,512,l),alt:"",onError:T,className:"size-32 shrink-0 object-contain"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(N,{className:P("border",se(k.tier)),children:k.tier}),t.jsx(N,{className:W,children:k.kind})]}),t.jsx("div",{className:`mt-3 font-display text-2xl ${C}`,children:k.title}),t.jsx("p",{className:`mt-2 text-sm leading-6 ${b}`,children:k.summary})]})]}),t.jsxs("div",{className:`mt-5 ${D}`,children:[t.jsx("div",{className:`text-sm font-semibold ${C}`,children:"Requirement"}),t.jsx("p",{className:`mt-2 text-sm leading-6 ${b}`,children:k.requirementText}),t.jsxs("div",{className:"mt-4",children:[t.jsx(re,{value:k.progressPercent}),t.jsxs("div",{className:`mt-2 flex justify-between gap-3 text-[11px] uppercase tracking-[0.16em] ${_}`,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(j,{type:"button",variant:"secondary",onClick:()=>E(null),children:"Close"})})]})}):null]})}export{kt as RewardsPage};
@@ -1 +0,0 @@
1
- import{r as u,j as e,b8 as F,d3 as E,c1 as R}from"./vendor-y_uz1Wft.js";import{j as Q,i as A,k as h}from"./state-DWw8Jay_.js";import{S as K}from"./settings-section-nav-C1NcWveT.js";import{S as H,e as B,C as x,I as W,c as G,B as f,b as V,dq as P,dr as D,d1 as Y,ds as O}from"./index-Dj8q65se.js";import{P as J}from"./page-hero-DYmFM6-q.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./board-CGgOvBP9.js";import"./forms-DhEGHkFR.js";const a={goal:"Goals",project:"Projects",task:"Tasks",strategy:"Strategies",habit:"Habits",tag:"Tags",note:"Notes",insight:"Insights",artifact:"Artifacts",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"},U={goal:"goal",project:"project",task:"task",strategy:"strategy",habit:"habit",tag:null,note:null,insight:"report",artifact:"artifact",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},v="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",X="text-[var(--ui-ink-strong)]",j="text-[var(--ui-ink-soft)]",m="text-[var(--ui-ink-faint)]",Z="border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",ee="border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-accent-soft)] text-[var(--primary)]",te="grid min-w-0 gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4 lg:grid-cols-[minmax(0,1fr)_auto]";function se(y){return new Date(y).toLocaleString()}function me(){var C,T;const y=Q(),[b,$]=u.useState(""),[l,L]=u.useState([]),c=A({queryKey:["forge-operator-session"],queryFn:Y}),M=c.isSuccess,o=A({queryKey:["forge-settings-bin"],queryFn:O,enabled:M}),p=async()=>{await y.invalidateQueries({predicate:t=>Array.isArray(t.queryKey)&&typeof t.queryKey[0]=="string"&&t.queryKey[0].startsWith("forge-")})},_=h({mutationFn:t=>P({operations:[{entityType:t.entityType,id:t.entityId}]}),onSuccess:p}),w=h({mutationFn:t=>D({operations:[{entityType:t.entityType,id:t.entityId,mode:"hard"}]}),onSuccess:p}),k=h({mutationFn:t=>P({operations:t.map(s=>({entityType:s.entityType,id:s.entityId}))}),onSuccess:p}),N=h({mutationFn:t=>D({operations:t.map(s=>({entityType:s.entityType,id:s.entityId,mode:"hard"}))}),onSuccess:p}),d=((C=o.data)==null?void 0:C.bin.records)??[],g=b.trim().toLowerCase(),r=u.useMemo(()=>d.filter(t=>l.length===0||l.includes(t.entityType)?g?[t.title,t.subtitle??"",t.entityType,t.entityId,t.deletedByActor??"",t.deletedSource??"",t.deleteReason??""].join(" ").toLowerCase().includes(g):!0:!1),[g,d,l]),S=u.useMemo(()=>{const t=new Map;for(const s of r){const i=t.get(s.entityType)??[];i.push(s),t.set(s.entityType,i)}return[...t.entries()].sort((s,i)=>a[s[0]].localeCompare(a[i[0]]))},[r]),I=u.useMemo(()=>[...new Set(d.map(t=>t.entityType))].sort((t,s)=>a[t].localeCompare(a[s])),[d]);function q(t){L(s=>s.includes(t)?s.filter(i=>i!==t):[...s,t])}async function z(){r.length===0||!window.confirm(`Permanently delete ${r.length} item${r.length===1?"":"s"} from the bin? This cannot be undone.`)||await N.mutateAsync(r)}return c.isLoading||o.isLoading?e.jsx(H,{eyebrow:"Settings",title:"Loading bin",description:"Loading deleted items and restore controls.",columns:2,blocks:6}):c.isError?e.jsx(B,{eyebrow:"Settings",error:c.error,onRetry:()=>void c.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(J,{title:"Bin",description:"Restore soft-deleted items or permanently remove them when you really mean it.",badge:`${((T=o.data)==null?void 0:T.bin.totalCount)??0} deleted items`}),e.jsx(K,{}),e.jsxs(x,{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:v,children:"Find deleted items"}),e.jsxs("div",{className:"relative",children:[e.jsx(F,{className:`pointer-events-none absolute left-4 top-1/2 size-4 -translate-y-1/2 ${m}`}),e.jsx(W,{value:b,onChange:t=>$(t.target.value),placeholder:"Search title, id, reason, or source",className:"pl-11"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:I.map(t=>{const s=l.includes(t);return e.jsx("button",{type:"button",onClick:()=>q(t),className:G("rounded-full border px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",s?ee:Z),children:a[t]},t)})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 lg:max-w-[22rem] lg:justify-end",children:[e.jsxs(f,{variant:"secondary",size:"sm",disabled:r.length===0,pending:k.isPending,pendingLabel:"Restoring",onClick:()=>void k.mutateAsync(r),children:[e.jsx(E,{className:"size-4"}),e.jsx("span",{children:"Restore visible"})]}),e.jsxs(f,{variant:"secondary",size:"sm",disabled:r.length===0,pending:N.isPending,pendingLabel:"Deleting",onClick:()=>void z(),children:[e.jsx(R,{className:"size-4"}),e.jsx("span",{children:"Delete visible forever"})]})]})]}),e.jsxs("div",{className:`flex flex-wrap gap-3 text-sm ${m}`,children:[e.jsxs("span",{children:[r.length," visible"]}),l.length>0?e.jsxs("span",{children:[l.length," type filters active"]}):null,g?e.jsxs("span",{children:["Search: “",b.trim(),"”"]}):null]})]}),d.length===0?e.jsxs(x,{children:[e.jsx("div",{className:v,children:"Deleted items"}),e.jsx("div",{className:`mt-4 ${j}`,children:"Nothing is in the bin right now."})]}):S.length===0?e.jsxs(x,{children:[e.jsx("div",{className:v,children:"Deleted items"}),e.jsx("div",{className:`mt-4 ${j}`,children:"No deleted items match the current search or filters."})]}):e.jsx("div",{className:"grid gap-5",children:S.map(([t,s])=>{const i=U[t];return e.jsxs(x,{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(V,{kind:i,label:a[t],compact:!0}):null,i?null:e.jsx("div",{className:`rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-1 text-[11px] uppercase tracking-[0.16em] ${m}`,children:a[t]}),e.jsxs("div",{className:`text-sm ${m}`,children:[s.length," deleted"]})]})}),e.jsx("div",{className:"mt-4 grid gap-3",children:s.map(n=>e.jsxs("div",{className:te,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:`break-words text-lg font-medium [overflow-wrap:anywhere] ${X}`,children:n.title}),n.subtitle?e.jsx("div",{className:`mt-1 break-words text-sm [overflow-wrap:anywhere] ${j}`,children:n.subtitle}):null,e.jsxs("div",{className:`mt-3 flex flex-wrap gap-3 break-words text-xs [overflow-wrap:anywhere] ${m}`,children:[e.jsxs("span",{children:["Deleted ",se(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(f,{variant:"secondary",size:"sm",pending:_.isPending,pendingLabel:"Restoring",onClick:()=>void _.mutateAsync(n),children:[e.jsx(E,{className:"size-4"}),e.jsx("span",{children:"Restore"})]}),e.jsxs(f,{variant:"secondary",size:"sm",pending:w.isPending,pendingLabel:"Deleting",onClick:()=>void w.mutateAsync(n),children:[e.jsx(R,{className:"size-4"}),e.jsx("span",{children:"Delete forever"})]})]})]},`${n.entityType}:${n.entityId}`))})]},t)})})]})}export{me as SettingsBinPage};
@@ -1 +0,0 @@
1
- import{r as n,j as e,b3 as le,dt as fe,c1 as ce,du as ke,aG as ye,cR as Ne,dh as we}from"./vendor-y_uz1Wft.js";import{j as Ce,i as I,k as h}from"./state-DWw8Jay_.js";import{S as Ae}from"./settings-section-nav-C1NcWveT.js";import{P as Se}from"./page-hero-DYmFM6-q.js";import{L as Oe,e as Ie,C,B as o,j as l,cY as Me,dO as Pe,dP as Le,dQ as Ee,dR as Ke,dS as Fe,dT as Ue,dU as _e,d2 as ze,bw as $e,dV as Be}from"./index-Dj8q65se.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./board-CGgOvBP9.js";import"./forms-DhEGHkFR.js";const ue="grid min-w-0 gap-2 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",M="grid min-w-0 gap-3 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",P="rounded-[20px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-5 text-sm leading-6 text-[var(--ui-ink-soft)]",d="min-w-0 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-strong)] outline-none placeholder:text-[var(--ui-ink-faint)] transition focus:border-[var(--primary)]/35 focus:bg-[var(--ui-surface-3)]",j="text-sm text-[var(--ui-ink-strong)]",L="text-[var(--ui-ink-soft)]",m="text-[var(--ui-ink-faint)]",We="text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",g="bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",qe="bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",Qe="rounded-[20px] border border-[color-mix(in_srgb,var(--danger)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-danger-soft)] px-4 py-5 text-sm leading-6 text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]";function E(i="openai-api"){return{label:i==="openai-codex"?"OpenAI Codex":i==="openai-compatible"?"Local compatible endpoint":i==="mock"?"Workbench mock runtime":"OpenAI API",provider:i,baseUrl:i==="openai-codex"?"https://chatgpt.com/backend-api":i==="openai-compatible"?"http://127.0.0.1:11434/v1":i==="mock"?"mock://workbench":"https://api.openai.com/v1",model:i==="mock"?"mock-echo":"gpt-5.4-mini",apiKey:""}}function Te(i){return{id:i.id,label:i.label,provider:i.provider,baseUrl:i.baseUrl,model:i.model,apiKey:""}}function ea(){var ie,te,ne,re,de;const i=Ce(),[s,x]=n.useState(()=>E()),[K,F]=n.useState(""),[U,_]=n.useState("gpt-5.4-mini"),[z,$]=n.useState(""),[B,W]=n.useState("gpt-5.4-mini"),[A,me]=n.useState("Fast wiki search"),[S,ge]=n.useState("text-embedding-3-small"),[q,he]=n.useState("https://api.openai.com/v1"),[Q,T]=n.useState(""),[R,xe]=n.useState("1200"),[D,pe]=n.useState("200"),[O,y]=n.useState(""),[c,N]=n.useState(null),[G,v]=n.useState(null),u=I({queryKey:["forge-settings"],queryFn:ze}),w=I({queryKey:["forge-wiki-settings"],queryFn:$e}),ve=I({queryKey:["forge-openai-codex-oauth",c],queryFn:async()=>{if(!c)throw new Error("Missing OAuth session id");return await Be(c)},enabled:!!c,refetchInterval:a=>{var oe;const r=(oe=a.state.data)==null?void 0:oe.session.status;return r&&["authorized","error","consumed","expired"].includes(r)?!1:1500}}),f=async()=>{await i.invalidateQueries({queryKey:["forge-settings"]}),await i.invalidateQueries({queryKey:["forge-wiki-settings"]}),await i.invalidateQueries({queryKey:["forge-wiki-search"]}),await i.invalidateQueries({queryKey:["forge-openai-codex-oauth",c]})},Z=h({mutationFn:()=>Me({modelSettings:{forgeAgent:{basicChat:{connectionId:K||null,model:U},wiki:{connectionId:z||null,model:B}}}}),onSuccess:f}),H=h({mutationFn:()=>Fe({id:s.id,label:s.label,provider:s.provider,authMode:s.provider==="openai-codex"?"oauth":"api_key",baseUrl:s.baseUrl,model:s.model,apiKey:s.provider==="openai-codex"?void 0:s.apiKey||void 0,oauthSessionId:s.provider==="openai-codex"?c??void 0:void 0}),onSuccess:async()=>{v("Connection saved."),s.provider==="openai-codex"&&(N(null),y("")),x(E(s.provider)),await f()},onError:a=>{v(a instanceof Error?a.message:"Connection save failed.")}}),V=h({mutationFn:_e,onSuccess:f}),Y=h({mutationFn:()=>Le({label:A.trim(),model:S.trim(),baseUrl:q.trim(),apiKey:Q.trim()||void 0,chunkSize:Number(R),chunkOverlap:Number(D)}),onSuccess:async()=>{T(""),await f()}}),J=h({mutationFn:a=>Pe("embedding",a),onSuccess:f}),X=h({mutationFn:async()=>Ue({connectionId:s.id,provider:s.provider,baseUrl:s.baseUrl,model:s.model,apiKey:s.provider==="openai-codex"?void 0:s.apiKey||void 0}),onSuccess:({result:a})=>{v(`Connection test succeeded: ${a.outputPreview}`)},onError:a=>{v(a instanceof Error?a.message:"Connection test failed.")}}),ee=h({mutationFn:Ee,onSuccess:({session:a})=>{N(a.id),v("OpenAI Codex OAuth started."),a.authUrl&&window.open(a.authUrl,"_blank","noopener,noreferrer")}}),ae=h({mutationFn:async()=>{if(!c)throw new Error("No OAuth session started yet.");return await Ke(c,O)},onSuccess:({session:a})=>{v(a.status==="authorized"?"OpenAI Codex OAuth authorized.":"Manual OAuth code submitted.")}});n.useEffect(()=>{var r;const a=(r=u.data)==null?void 0:r.settings;a&&(F(a.modelSettings.forgeAgent.basicChat.connectionId??""),_(a.modelSettings.forgeAgent.basicChat.model),$(a.modelSettings.forgeAgent.wiki.provider==="openai-codex"?a.modelSettings.forgeAgent.wiki.connectionId??"":""),W(a.modelSettings.forgeAgent.wiki.model))},[u.data]);const p=((ie=u.data)==null?void 0:ie.settings.modelSettings.connections)??[],se=p.filter(a=>a.provider==="openai-codex"&&a.authMode==="oauth"),be=se.filter(a=>a.hasStoredCredential),t=((te=ve.data)==null?void 0:te.session)??null,b=s.id?p.find(a=>a.id===s.id):null,je=n.useMemo(()=>!s.label.trim()||!s.model.trim()?!1:s.provider==="openai-codex"?!!((t==null?void 0:t.status)==="authorized"||s.id&&(b!=null&&b.hasStoredCredential)):s.provider==="mock"?!0:s.apiKey.trim().length>0||!!s.id,[s,b==null?void 0:b.hasStoredCredential,t==null?void 0:t.status]);if(u.isLoading)return e.jsx(Oe,{eyebrow:"Models",title:"Loading model settings",description:"Fetching Forge agent defaults and configured AI connections."});if(u.isError||!((ne=u.data)!=null&&ne.settings))return e.jsx(Ie,{eyebrow:"Models",error:u.error??new Error("Forge returned an empty model settings payload."),onRetry:()=>void u.refetch()});const k=u.data.settings;return e.jsxs("div",{className:"mx-auto grid min-w-0 w-full max-w-[1440px] gap-5",children:[e.jsx(Se,{eyebrow:"AI runtime",title:"Model Settings",description:"Manage Forge Agent defaults, OpenAI OAuth/API connections, and local OpenAI-compatible endpoints as first-class chat agents.",badge:`${p.length} model connection${p.length===1?"":"s"}`}),e.jsx(Ae,{}),e.jsxs(C,{className:"grid gap-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(le,{className:"size-4 text-[var(--secondary)]"}),e.jsxs("div",{children:[e.jsx("div",{className:j,children:"Forge Agent defaults"}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Forge Agent stays the default system agent. Choose which model connection powers basic chat and the managed wiki workflow."})]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("label",{className:ue,children:[e.jsx("span",{className:`text-sm ${L}`,children:"Basic chat connection"}),e.jsxs("select",{className:d,value:K,onChange:a=>F(a.target.value),children:[e.jsx("option",{value:"",children:"No external connection"}),p.map(a=>e.jsxs("option",{value:a.id,children:[a.label," (",a.agentLabel,")"]},a.id))]}),e.jsx("input",{className:d,value:U,onChange:a=>_(a.target.value),placeholder:"Model"})]}),e.jsxs("label",{className:ue,children:[e.jsx("span",{className:`text-sm ${L}`,children:"KarpaWiki Codex OAuth connection"}),e.jsxs("select",{className:d,value:z,onChange:a=>$(a.target.value),children:[e.jsx("option",{value:"",children:"No Codex OAuth connection"}),se.map(a=>e.jsxs("option",{value:a.id,disabled:!a.hasStoredCredential,children:[a.label," (",a.accountLabel??a.agentLabel,")",a.hasStoredCredential?"":" · needs OAuth"]},a.id))]}),e.jsx("input",{className:d,value:B,onChange:a=>W(a.target.value),placeholder:"Model"}),e.jsx("span",{className:`text-xs leading-5 ${m}`,children:"KarpaWiki smart ingest uses ChatGPT/Codex OAuth only. It does not use metered OpenAI Platform API keys."})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(o,{pending:Z.isPending,pendingLabel:"Saving defaults",onClick:()=>void Z.mutateAsync(),children:"Save Forge Agent defaults"}),e.jsxs(l,{className:g,children:["Forge Agent",k.modelSettings.forgeAgent.basicChat.connectionLabel?` basic chat: ${k.modelSettings.forgeAgent.basicChat.connectionLabel}`:" basic chat stays local"]}),e.jsx(l,{className:g,children:k.modelSettings.forgeAgent.wiki.connectionLabel?`KarpaWiki OAuth: ${k.modelSettings.forgeAgent.wiki.connectionLabel}`:"KarpaWiki: no Codex OAuth model selected"}),be.length===0?e.jsx(l,{className:qe,children:"Add OpenAI Codex OAuth before smart ingest"}):null]})]}),e.jsxs(C,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(fe,{className:"size-4 text-[var(--secondary)]"}),e.jsxs("div",{children:[e.jsx("div",{className:j,children:"KarpaWiki embeddings"}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Semantic search profiles live with model settings. They remain optional; KarpaWiki text search and entity-linked search still work without embeddings."})]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(20rem,0.9fr)]",children:[e.jsxs("div",{className:"grid gap-3",children:[w.isLoading?e.jsx("div",{className:P,children:"Loading embedding profiles."}):null,w.isError?e.jsx("div",{className:Qe,children:"Could not load KarpaWiki embedding profiles."}):null,((re=w.data)==null?void 0:re.settings.embeddingProfiles.length)===0?e.jsx("div",{className:P,children:"No embedding profile yet. Add one only if you want semantic wiki search in addition to exact search and links."}):null,(de=w.data)==null?void 0:de.settings.embeddingProfiles.map(a=>e.jsxs("div",{className:"grid min-w-0 gap-2 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[var(--ui-ink-strong)]",children:a.label}),e.jsxs("div",{className:`mt-1 break-words text-xs [overflow-wrap:anywhere] ${m}`,children:[a.model," · ",a.baseUrl]})]}),e.jsx(o,{variant:"secondary",pending:J.isPending,pendingLabel:"Deleting",onClick:()=>void J.mutateAsync(a.id),children:e.jsx(ce,{className:"size-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(l,{className:g,children:["chunk ",a.chunkSize]}),e.jsxs(l,{className:g,children:["overlap ",a.chunkOverlap]}),e.jsx(l,{className:g,children:a.enabled?"enabled":"disabled"})]})]},a.id))]}),e.jsxs("div",{className:M,children:[e.jsx("input",{className:d,value:A,onChange:a=>me(a.target.value),placeholder:"Profile label"}),e.jsx("input",{className:d,value:S,onChange:a=>ge(a.target.value),placeholder:"Embedding model"}),e.jsx("input",{className:d,value:q,onChange:a=>he(a.target.value),placeholder:"Embedding base URL"}),e.jsx("input",{className:d,value:Q,onChange:a=>T(a.target.value),placeholder:"Embedding API key (optional)",type:"password"}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsx("input",{className:d,value:R,onChange:a=>xe(a.target.value),placeholder:"Chunk size",type:"number"}),e.jsx("input",{className:d,value:D,onChange:a=>pe(a.target.value),placeholder:"Chunk overlap",type:"number"})]}),e.jsx(o,{pending:Y.isPending,pendingLabel:"Saving",disabled:!A.trim()||!S.trim(),onClick:()=>void Y.mutateAsync(),children:"Save embedding profile"})]})]})]}),e.jsxs("div",{className:"grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]",children:[e.jsxs(C,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ke,{className:"size-4 text-[var(--secondary)]"}),e.jsxs("div",{children:[e.jsx("div",{className:j,children:"Connection editor"}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Every saved connection becomes a first-class agent layered on top of Forge Agent."})]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:We,children:"Provider"}),e.jsx("div",{className:"grid gap-2 md:grid-cols-3",children:[["openai-api","OpenAI API"],["openai-codex","OpenAI Codex OAuth"],["openai-compatible","OpenAI-compatible"]].map(([a,r])=>e.jsx("button",{type:"button",className:`rounded-[18px] px-4 py-3 text-left text-sm transition ${s.provider===a?"border border-[color-mix(in_srgb,var(--primary)_34%,var(--ui-border-subtle)_66%)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)]":"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"}`,onClick:()=>{x(E(a)),N(null),y("")},children:r},a))})]}),e.jsx("input",{className:d,value:s.label,onChange:a=>x(r=>({...r,label:a.target.value})),placeholder:"Connection label"}),e.jsx("input",{className:d,value:s.model,onChange:a=>x(r=>({...r,model:a.target.value})),placeholder:"Model"}),s.provider==="mock"?e.jsxs("div",{className:M,children:[e.jsx("div",{className:j,children:"The Workbench mock runtime is only meant for local development and test workflows."}),e.jsxs("div",{className:`text-xs leading-5 ${m}`,children:["Use mock models like ",e.jsx("code",{children:"mock-echo"}),","," ",e.jsx("code",{children:"mock-json"}),",",e.jsx("code",{children:"mock-tool-search"}),","," ",e.jsx("code",{children:"mock-tool-note"}),", or",e.jsx("code",{children:"mock-chat-memory"})," to exercise deterministic flow behavior without a real external model."]})]}):s.provider!=="openai-codex"?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:d,value:s.baseUrl,onChange:a=>x(r=>({...r,baseUrl:a.target.value})),placeholder:"Base URL"}),e.jsx("input",{className:d,value:s.apiKey,onChange:a=>x(r=>({...r,apiKey:a.target.value})),placeholder:s.id?"Leave blank to keep the stored key":"API key",type:"password"})]}):e.jsxs("div",{className:M,children:[e.jsxs("div",{className:j,children:["OpenAI Codex uses the documented PKCE flow with the local callback at"," ",e.jsx("span",{className:"break-words [overflow-wrap:anywhere]",children:k.modelSettings.oauth.openAiCodex.callbackUrl})]}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Start OAuth, finish the browser sign-in, then save the resulting connection as a chat agent backed by the ChatGPT Codex runtime."}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(o,{variant:"secondary",pending:ee.isPending,pendingLabel:"Starting OAuth",onClick:()=>void ee.mutateAsync(),children:[e.jsx(ye,{className:"size-4"}),"Start OAuth"]}),t!=null&&t.authUrl?e.jsxs(o,{variant:"secondary",onClick:()=>window.open(t.authUrl??"","_blank","noopener,noreferrer"),children:["Open sign-in",e.jsx(Ne,{className:"size-4"})]}):null]}),t?e.jsxs("div",{className:"grid min-w-0 gap-2 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-code-bg)] p-3 text-sm text-[var(--ui-code-text)]",children:[e.jsxs("div",{children:["Status: ",t.status]}),t.accountLabel?e.jsxs("div",{children:["Account: ",t.accountLabel]}):null,t.error?e.jsx("div",{className:"text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:t.error}):null]}):null,e.jsxs("div",{className:"grid gap-2",children:[e.jsx("input",{className:d,value:O,onChange:a=>y(a.target.value),placeholder:"Paste the authorization code or full redirect URL"}),e.jsx(o,{variant:"secondary",disabled:!O.trim()||!c,pending:ae.isPending,pendingLabel:"Submitting",onClick:()=>void ae.mutateAsync(),children:"Submit manual code"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(o,{pending:H.isPending,pendingLabel:"Saving connection",disabled:!je,onClick:()=>void H.mutateAsync(),children:"Save connection"}),e.jsxs(o,{variant:"secondary",pending:X.isPending,pendingLabel:"Testing",disabled:s.provider==="openai-codex"?!s.id:s.provider==="mock"?!1:!s.id&&!s.apiKey.trim(),onClick:()=>void X.mutateAsync(),children:[e.jsx(we,{className:"size-4"}),"Test connection"]})]}),G?e.jsx("div",{className:`rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm ${L}`,children:G}):null]})]}),e.jsxs(C,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(le,{className:"size-4 text-[var(--secondary)]"}),e.jsxs("div",{children:[e.jsx("div",{className:j,children:"Connected agents"}),e.jsx("div",{className:`text-xs leading-5 ${m}`,children:"Each connection registers its own chat-facing agent identity."})]})]}),e.jsxs("div",{className:"grid gap-3",children:[p.length===0?e.jsx("div",{className:P,children:"No external model connection yet. Add one with OAuth or API credentials and Forge will expose it as a first-class agent."}):null,p.map(a=>e.jsxs("div",{className:"grid min-w-0 gap-3 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-words text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:a.label}),e.jsxs("div",{className:`mt-1 break-words text-xs [overflow-wrap:anywhere] ${m}`,children:[a.agentLabel," · ",a.provider," ·"," ",a.model]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o,{variant:"secondary",onClick:()=>{x(Te(a)),N(null),y("")},children:"Edit"}),e.jsx(o,{variant:"secondary",pending:V.isPending,pendingLabel:"Deleting",onClick:()=>void V.mutateAsync(a.id),children:e.jsx(ce,{className:"size-4"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(l,{className:g,children:a.authMode==="oauth"?"OAuth":"API key"}),e.jsx(l,{className:g,children:a.status}),e.jsx(l,{className:g,wrap:!0,children:a.baseUrl}),a.accountLabel?e.jsx(l,{className:g,wrap:!0,children:a.accountLabel}):null]})]},a.id))]})]})]})]})}export{ea as SettingsModelsPage};
@@ -1 +0,0 @@
1
- import{j as e,r as v}from"./vendor-y_uz1Wft.js";import{j as de,i as k,k as z}from"./state-DWw8Jay_.js";import{u as U}from"./forms-DhEGHkFR.js";import{S as ce}from"./settings-section-nav-C1NcWveT.js";import{j as p,c as _,_ as ee,f as oe,d as me,S as ue,e as xe,C as ge,I as J,T as E,B as se,dY as pe,dZ as he,d1 as be,cv as ve,d_ as fe,d$ as je,ab as we}from"./index-Dj8q65se.js";import{m as ae}from"./motion-DeJZhOSA.js";import{P as ye}from"./page-hero-DYmFM6-q.js";import{M as re}from"./metric-tile-DAhX60rg.js";import"./ui-CdEDMtXF.js";import"./board-CGgOvBP9.js";function Ne(r){switch(r){case"platinum":return"bg-[var(--ui-accent-soft)] text-[var(--primary)]";case"gold":return"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]";case"silver":return"bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]";default:return"bg-[var(--ui-warning-soft)] text-[var(--warning)]"}}function ke(r){switch(r){case"surging":return"bg-[color-mix(in_srgb,var(--ui-accent-soft)_62%,var(--ui-success-soft)_38%)]";case"steady":return"bg-[var(--ui-accent-soft)]";default:return"bg-[color-mix(in_srgb,var(--ui-warning-soft)_54%,var(--ui-accent-soft)_46%)]"}}const P="min-w-0 overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",te="min-w-0 overflow-hidden rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",A="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",S="text-[var(--ui-ink-strong)]",$="text-[var(--ui-ink-soft)]",I="text-[var(--ui-ink-faint)]",O="bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]";function _e({profile:r,achievements:m,milestoneRewards:d,momentumPulse:u,recentLedger:R=[],className:j,tone:X="core"}){const w=m.filter(t=>t.unlocked),h=(w.length>0?w:m).slice(0,3),C=d.slice(0,3),M=R.slice(0,3),F=Math.min(100,Math.round(r.currentLevelXp/r.nextLevelXp*100));return e.jsxs("section",{className:_("min-w-0 overflow-hidden rounded-[30px] border border-[var(--ui-border-subtle)] bg-[var(--card-gradient)] shadow-[var(--card-shadow)]",X==="psyche"&&"border-[color-mix(in_srgb,var(--success)_18%,var(--ui-border-subtle)_82%)]",j),children:[e.jsx("div",{className:_("px-5 py-5",ke(u.status)),children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:A,children:"Weekly progress"}),e.jsx("h2",{className:`mt-3 font-display text-3xl leading-none lg:text-4xl ${S}`,children:u.headline}),e.jsx("p",{className:`mt-3 max-w-3xl text-sm leading-7 ${$}`,children:u.detail})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2",children:[e.jsxs(p,{wrap:!0,className:O,children:["Level ",r.level]}),e.jsxs(p,{wrap:!0,className:O,children:[r.streakDays," day streak"]}),e.jsxs(p,{wrap:!0,className:O,children:[r.weeklyXp," weekly XP"]})]})]})}),e.jsxs("div",{className:"grid gap-5 px-5 py-5 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)]",children:[e.jsxs("div",{className:"grid gap-5",children:[e.jsxs(ae.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.24,ease:"easeOut"},className:P,children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:`font-medium ${S}`,children:"Next reward"}),e.jsx("div",{className:`mt-2 text-sm ${$}`,children:u.nextMilestoneLabel})]}),e.jsx(p,{wrap:!0,className:"max-w-[12rem] shrink-0 self-start text-[var(--tertiary)]",children:u.celebrationLabel})]}),e.jsx("div",{className:"mt-5",children:e.jsx(ee,{value:F})}),e.jsxs("div",{className:`mt-3 flex flex-wrap items-center justify-between gap-3 text-xs uppercase tracking-[0.16em] ${I}`,children:[e.jsxs("span",{children:[r.currentLevelXp,"/",r.nextLevelXp," XP"]}),e.jsxs("span",{children:[r.comboMultiplier.toFixed(2),"x combo"]})]})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:h.map((t,c)=>e.jsxs(ae.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.24,delay:.04*c,ease:"easeOut"},className:P,children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsx("div",{className:`min-w-0 flex-1 font-medium ${S}`,children:t.title}),e.jsx(p,{wrap:!0,className:_("max-w-[8rem] shrink-0 self-start",Ne(t.tier)),children:t.tier})]}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${$}`,children:t.summary}),e.jsx("div",{className:`mt-4 text-xs uppercase tracking-[0.16em] ${I}`,children:t.progressLabel})]},t.id))})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:P,children:[e.jsx("div",{className:A,children:"Rewards in progress"}),e.jsx("div",{className:"mt-4 grid gap-3",children:C.map(t=>{const c=Math.min(100,Math.round(t.current/t.target*100));return e.jsxs("div",{className:te,children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsx("div",{className:`min-w-0 flex-1 font-medium ${S}`,children:t.title}),e.jsx(p,{wrap:!0,className:_("max-w-[10.5rem] shrink-0 self-start",t.completed?"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":O),children:t.rewardLabel})]}),e.jsx("div",{className:`mt-2 text-sm ${$}`,children:t.summary}),e.jsx("div",{className:"mt-4",children:e.jsx(ee,{value:c})}),e.jsx("div",{className:`mt-3 text-xs uppercase tracking-[0.16em] ${I}`,children:t.progressLabel})]},t.id)})})]}),M.length>0?e.jsxs("div",{className:P,children:[e.jsx("div",{className:A,children:"Recent XP changes"}),e.jsx("div",{className:"mt-4 grid gap-3",children:M.map(t=>e.jsxs("div",{className:te,children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsx("div",{className:`min-w-0 flex-1 font-medium ${S}`,children:t.reasonTitle}),e.jsxs(p,{wrap:!0,className:_("max-w-[8rem] shrink-0 self-start",t.deltaXp>=0?"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]"),children:[t.deltaXp>0?"+":"",t.deltaXp," XP"]})]}),e.jsx("div",{className:`mt-2 text-sm ${$}`,children:t.reasonSummary}),e.jsx("div",{className:`mt-3 text-xs uppercase tracking-[0.16em] ${I}`,children:oe(t.createdAt)})]},t.id))})]}):null]})]})]})}const Q="min-w-0 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",ie="min-w-0 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",B="min-w-0 rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--primary)]/35 focus:bg-[var(--ui-surface-3)]",Se="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",q="text-[var(--ui-ink-strong)]",n="text-[var(--ui-ink-soft)]",$e="text-[var(--ui-ink-faint)]",ne="text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",Re="mt-4 rounded-[18px] border border-[color-mix(in_srgb,var(--success)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-success-soft)] p-4 text-sm text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]";function Xe(r){return JSON.stringify(r,null,2)}function le(r){const m=r.trim();if(!m)return{};const d=JSON.parse(m);if(!d||typeof d!="object"||Array.isArray(d))throw new Error("Expected a JSON object.");return d}function Ae(){var G,W,H;const r=me(),m=de(),[d,u]=v.useState(""),[R,j]=v.useState(null),[X,w]=v.useState(null),h=k({queryKey:["forge-operator-session"],queryFn:be}),C=h.isSuccess,M=k({queryKey:["forge-xp-metrics"],queryFn:ve}),F=k({queryKey:["forge-reward-rules"],queryFn:fe,enabled:C}),t=k({queryKey:["forge-reward-ledger"],queryFn:()=>je(30),enabled:C}),c=k({queryKey:["forge-psyche-overview"],queryFn:async()=>(await we()).overview}),b=U({defaultValues:{title:"",description:"",active:!0,configJson:"{}"}}),l=U({defaultValues:{entityType:"task",entityId:"",deltaXp:15,reasonTitle:"Operator bonus",reasonSummary:"Manual boost for a meaningful action captured with good provenance.",metadataJson:"{}"}}),K=async()=>{await Promise.all([m.invalidateQueries({queryKey:["forge-xp-metrics"]}),m.invalidateQueries({queryKey:["forge-reward-rules"]}),m.invalidateQueries({queryKey:["forge-reward-ledger"]})])},D=z({mutationFn:s=>pe(s.ruleId,{title:s.title,description:s.description,active:s.active,config:s.config}),onSuccess:K}),f=z({mutationFn:he,onSuccess:K}),x=((G=F.data)==null?void 0:G.rules)??[],T=v.useMemo(()=>{var s,i,y,N,L,Y,Z;return{system:[{id:"operator_manual_reward",label:"Operator reward ledger"}],goal:r.snapshot.goals.map(a=>({id:a.id,label:a.title})),project:r.snapshot.dashboard.projects.map(a=>({id:a.id,label:a.title})),task:r.snapshot.tasks.map(a=>({id:a.id,label:a.title})),habit:r.snapshot.habits.map(a=>({id:a.id,label:a.title})),tag:r.snapshot.tags.map(a=>({id:a.id,label:a.name})),note:[],insight:[],psyche_value:(((s=c.data)==null?void 0:s.values)??[]).map(a=>({id:a.id,label:a.title})),behavior_pattern:(((i=c.data)==null?void 0:i.patterns)??[]).map(a=>({id:a.id,label:a.title})),behavior:(((y=c.data)==null?void 0:y.behaviors)??[]).map(a=>({id:a.id,label:a.title})),belief_entry:(((N=c.data)==null?void 0:N.beliefs)??[]).map(a=>({id:a.id,label:a.statement})),mode_profile:(((L=c.data)==null?void 0:L.modes)??[]).map(a=>({id:a.id,label:a.title})),flashcard:(((Y=c.data)==null?void 0:Y.flashcards)??[]).map(a=>({id:a.id,label:a.title||a.message})),trigger_report:(((Z=c.data)==null?void 0:Z.reports)??[]).map(a=>({id:a.id,label:a.title}))}},[c.data,r.snapshot.dashboard.projects,r.snapshot.goals,r.snapshot.habits,r.snapshot.tags,r.snapshot.tasks]);v.useEffect(()=>{var N;const s=l.getValues("entityType"),i=l.getValues("entityId"),y=T[s]??[];i&&y.some(L=>L.id===i)||l.setValue("entityId",((N=y[0])==null?void 0:N.id)??"")},[l,T]),v.useEffect(()=>{x.length&&(!d||!x.some(s=>s.id===d))&&u(x[0].id)},[x,d]);const g=x.find(s=>s.id===d)??x[0]??null;v.useEffect(()=>{g&&(b.reset({title:g.title,description:g.description,active:g.active,configJson:Xe(g.config)}),j(null))},[g,b]);const o=(W=M.data)==null?void 0:W.metrics,V=(((H=t.data)==null?void 0:H.ledger)??[]).filter(s=>s.metadata.manual===!0).slice(0,8);return h.isLoading?e.jsx(ue,{eyebrow:"Settings · Rewards",title:"Loading reward controls",description:"Establishing the operator session and fetching reward configuration.",columns:2,blocks:6}):h.isError?e.jsx(xe,{eyebrow:"Settings · Rewards",error:h.error,onRetry:()=>void h.refetch()}):e.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[e.jsx(ye,{title:"Rewards",description:"XP command deck, reward rule editor, manual bonus grants, and ledger history."}),e.jsx(ce,{}),e.jsx("div",{className:"grid gap-5",children:e.jsxs(ge,{children:[e.jsx("div",{className:Se,children:"Reward operations"}),e.jsxs("div",{className:"mt-4 grid gap-4",children:[o?e.jsx(_e,{profile:o.profile,achievements:o.achievements,milestoneRewards:o.milestoneRewards,momentumPulse:o.momentumPulse,recentLedger:o.recentLedger}):null,o?e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(re,{label:"Total XP",value:o.profile.totalXp,tone:"core"}),e.jsx(re,{label:"Daily ambient",value:`${o.dailyAmbientXp} / ${o.dailyAmbientCap}`,tone:"core"})]}):null,e.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[e.jsxs("div",{className:Q,children:[e.jsx("div",{className:`font-medium ${q}`,children:"Reward rule editor"}),x.length>0?e.jsxs("form",{className:"mt-4 grid gap-4",onSubmit:b.handleSubmit(async s=>{try{j(null);const i=le(s.configJson);if(!g)return;await D.mutateAsync({ruleId:g.id,title:s.title,description:s.description,active:s.active,config:i})}catch(i){j(i instanceof Error?i.message:"Invalid reward rule config.")}}),children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Rule"}),e.jsx("select",{className:B,value:d,onChange:s=>u(s.target.value),children:x.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Title"}),e.jsx(J,{...b.register("title")})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Description"}),e.jsx(E,{className:"min-h-24",...b.register("description")})]}),e.jsxs("label",{className:"flex min-w-0 items-center justify-between gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx("span",{className:n,children:"Rule is active"}),e.jsx("input",{type:"checkbox",...b.register("active")})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Config JSON"}),e.jsx(E,{className:"min-h-28 font-mono text-xs",...b.register("configJson")})]}),R?e.jsx("div",{className:`text-sm ${ne}`,children:R}):null,e.jsx(se,{type:"submit",pending:D.isPending,pendingLabel:"Saving rule",children:"Save reward rule"})]}):e.jsx("div",{className:`mt-4 text-sm ${n}`,children:"Loading reward rules..."})]}),e.jsxs("div",{className:Q,children:[e.jsx("div",{className:`font-medium ${q}`,children:"Manual bonus XP"}),e.jsxs("form",{className:"mt-4 grid gap-4",onSubmit:l.handleSubmit(async s=>{try{w(null);const i=le(s.metadataJson);await f.mutateAsync({entityType:s.entityType,entityId:s.entityId,deltaXp:s.deltaXp,reasonTitle:s.reasonTitle,reasonSummary:s.reasonSummary,metadata:i}),l.reset({...s,entityId:"",reasonTitle:"Operator bonus",reasonSummary:"Manual boost for a meaningful action captured with good provenance.",metadataJson:"{}"})}catch(i){w(i instanceof Error?i.message:"Invalid metadata payload.")}}),children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Entity type"}),e.jsx("select",{className:B,...l.register("entityType"),children:Object.keys(T).map(s=>e.jsx("option",{value:s,children:s.replaceAll("_"," ")},s))})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Entity id"}),e.jsx("select",{className:B,...l.register("entityId"),children:(T[l.watch("entityType")]??[]).map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Delta XP"}),e.jsx(J,{type:"number",...l.register("deltaXp",{valueAsNumber:!0})})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Reason title"}),e.jsx(J,{...l.register("reasonTitle")})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Reason summary"}),e.jsx(E,{className:"min-h-24",...l.register("reasonSummary")})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:`text-sm ${n}`,children:"Metadata JSON"}),e.jsx(E,{className:"min-h-24 font-mono text-xs",...l.register("metadataJson")})]}),X?e.jsx("div",{className:`text-sm ${ne}`,children:X}):null,e.jsx(se,{type:"submit",pending:f.isPending,pendingLabel:"Issuing bonus",children:"Issue bonus XP"})]}),f.data?e.jsxs("div",{className:Re,children:["Granted ",f.data.reward.deltaXp>0?"+":"",f.data.reward.deltaXp," XP for"," ",e.jsx("strong",{children:f.data.reward.reasonTitle}),"."]}):null]})]}),e.jsxs("div",{className:Q,children:[e.jsx("div",{className:`font-medium ${q}`,children:"Manual bonus history"}),e.jsx("div",{className:"mt-4 grid gap-3",children:V.length===0?e.jsx("div",{className:`${ie} text-sm ${n}`,children:"No manual bonus grants yet."}):V.map(s=>e.jsxs("div",{className:ie,children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:`min-w-0 break-words font-medium ${q}`,children:s.reasonTitle}),e.jsxs(p,{wrap:!0,className:s.deltaXp>=0?"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",children:[s.deltaXp>0?"+":"",s.deltaXp," XP"]})]}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${n}`,children:s.reasonSummary||"No summary supplied."}),e.jsxs("div",{className:`mt-2 break-words text-xs uppercase tracking-[0.16em] [overflow-wrap:anywhere] ${$e}`,children:[s.entityType," · ",s.entityId," ·"," ",new Date(s.createdAt).toLocaleString()]})]},s.id))})]})]})]})})]})}export{Ae as SettingsRewardsPage};
@@ -1 +0,0 @@
1
- import{r as g,j as e,aC as ce}from"./vendor-y_uz1Wft.js";import{i as de,k as Z}from"./state-DWw8Jay_.js";import{S as he}from"./settings-section-nav-C1NcWveT.js";import{P as ue}from"./page-hero-DYmFM6-q.js";import{i as pe,C as ge,B as me,M as xe}from"./graph-U1J6VkbG.js";import{C as F,ad as fe,j as b,I as T,T as be,_ as ve,d as je,B as J,e0 as we,e1 as ye,e2 as Ne,e3 as ke}from"./index-Dj8q65se.js";import{U as E}from"./user-badge-B8hYK6NU.js";import{Q as ie,F as $,a as H}from"./question-flow-dialog-CPyXCqA-.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./board-CGgOvBP9.js";import"./forms-DhEGHkFR.js";const ae=[{id:"visibility",label:"Discovery and visibility",description:"What the source user can discover, inspect, and pull into read flows on the target side.",rights:[{key:"discoverable",label:"Discoverable",description:"The target appears as a reachable collaborator in the source user's graph and pickers."},{key:"canListUsers",label:"List users",description:"The source user can include the target in directory, comparison, and routing surfaces."},{key:"canReadProfile",label:"Read profile",description:"The source user can inspect the target's identity card, handle, type, and description."},{key:"canReadEntities",label:"Read entities",description:"The source user can read the target's goals, projects, tasks, notes, strategies, and related records."},{key:"canSearchEntities",label:"Search entities",description:"The source user can find the target's work through Forge search and entity pickers."}]},{id:"coordination",label:"Messaging, context, and handoff",description:"What the source user can message, connect, and coordinate on the target side before changing execution.",rights:[{key:"canLinkEntities",label:"Share context",description:"The source user can attach the target's records into shared notes, strategies, calendar context, and cross-owner plans."},{key:"canCoordinate",label:"Message and coordinate",description:"The source user can communicate with the target through Forge, hand off work, and coordinate execution."},{key:"canViewMetrics",label:"View metrics",description:"The source user can inspect the target's XP, alignment, and progress metrics."},{key:"canViewActivity",label:"View activity",description:"The source user can inspect the target's activity stream, evidence, and execution trail."}]},{id:"execution",label:"Plan and execution control",description:"What the source user can actually change on the target side once collaboration is trusted.",rights:[{key:"canManageStrategies",label:"Manage strategies",description:"The source user can draft and update strategies that belong to the target."},{key:"canCreateOnBehalf",label:"Create on behalf",description:"The source user can intentionally create new target-owned entities."},{key:"canAffectEntities",label:"Affect entities",description:"The source user can mutate work that belongs to the target."}]}],Ce=[{id:"full_collab",label:"Full collaboration",description:"Use when two humans or agents can see, coordinate, plan, and change each other's work.",rights:{discoverable:!0,canListUsers:!0,canReadProfile:!0,canReadEntities:!0,canSearchEntities:!0,canLinkEntities:!0,canCoordinate:!0,canAffectEntities:!0,canManageStrategies:!0,canCreateOnBehalf:!0,canViewMetrics:!0,canViewActivity:!0}},{id:"coordination_only",label:"Coordinate only",description:"Use when the source user may see and coordinate with the target but should not directly mutate target-owned work.",rights:{discoverable:!0,canListUsers:!0,canReadProfile:!0,canReadEntities:!0,canSearchEntities:!0,canLinkEntities:!0,canCoordinate:!0,canAffectEntities:!1,canManageStrategies:!0,canCreateOnBehalf:!1,canViewMetrics:!0,canViewActivity:!0}},{id:"observe_only",label:"Observe only",description:"Use when the source user should keep visibility into the target without planning or execution control.",rights:{discoverable:!0,canListUsers:!0,canReadProfile:!0,canReadEntities:!0,canSearchEntities:!0,canLinkEntities:!1,canCoordinate:!1,canAffectEntities:!1,canManageStrategies:!1,canCreateOnBehalf:!1,canViewMetrics:!0,canViewActivity:!0}},{id:"hidden",label:"Hidden edge",description:"Use when this direction should stop discovering, reading, or acting on the target.",rights:{discoverable:!1,canListUsers:!1,canReadProfile:!1,canReadEntities:!1,canSearchEntities:!1,canLinkEntities:!1,canCoordinate:!1,canAffectEntities:!1,canManageStrategies:!1,canCreateOnBehalf:!1,canViewMetrics:!1,canViewActivity:!1}}],A=ae.reduce((s,n)=>s+n.rights.length,0);function P(s){return Object.values(s.config.rights).filter(Boolean).length}function re(s){const n=[];return s.config.rights.canReadEntities&&n.push("See"),s.config.rights.canCoordinate&&n.push("Message"),s.config.rights.canManageStrategies&&n.push("Plan"),s.config.rights.canAffectEntities&&n.push("Affect"),n.join(" · ")||"Hidden"}function Ue(s){return!s.config.rights.discoverable&&!s.config.rights.canReadEntities?"Hidden":s.config.rights.canAffectEntities&&s.config.rights.canManageStrategies?"Trusted":s.config.rights.canCoordinate||s.config.rights.canLinkEntities?"Coordinated":"Observed"}function ne(s){return[{id:"see",label:"See",enabled:s.config.rights.discoverable&&s.config.rights.canReadEntities&&s.config.rights.canSearchEntities},{id:"message",label:"Message",enabled:s.config.rights.canCoordinate},{id:"share",label:"Share context",enabled:s.config.rights.canLinkEntities},{id:"plan",label:"Plan",enabled:s.config.rights.canManageStrategies},{id:"affect",label:"Affect",enabled:s.config.rights.canAffectEntities||s.config.rights.canCreateOnBehalf}]}function Ee(s,n){return Object.entries(n.rights).every(([i,u])=>s.config.rights[i]===u)}function Se(s,n){const i=s.filter(a=>a.kind==="human"),u=s.filter(a=>a.kind==="bot"),p={x:560,y:360},m={width:226,height:132},d=i[0]??null,w=[...i.slice(d?1:0).map(a=>({user:a,radius:245,offset:-90})),...u.map(a=>({user:a,radius:390,offset:-90}))],f=w.length,y=[...d?[{user:d,position:{x:p.x-m.width/2,y:p.y-m.height/2}}]:[],...w.map((a,c)=>{const h=(a.offset+360/Math.max(f,1)*c)*Math.PI/180;return{user:a.user,position:{x:p.x+Math.cos(h)*a.radius-m.width/2,y:p.y+Math.sin(h)*a.radius-m.height/2}}})],C=new Set(n.selectedGrant?[n.selectedGrant.subjectUserId,n.selectedGrant.targetUserId]:n.selectedUserId?[n.selectedUserId]:[]);return y.map(({user:a,position:c})=>{const h=C.has(a.id),t=a.id===n.selectedUserId;return{id:a.id,position:c,draggable:!1,selectable:!1,data:{label:e.jsxs("div",{className:`min-w-[206px] rounded-[22px] border px-4 py-4 shadow-[var(--ui-shadow-soft)] transition ${t?"border-[color-mix(in_srgb,var(--warning)_45%,var(--ui-border-subtle)_55%)] bg-[var(--ui-warning-soft)]":h?"border-[color-mix(in_srgb,var(--primary)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-accent-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(E,{user:a}),e.jsx(b,{tone:"meta",children:a.kind})]}),e.jsxs("div",{className:"mt-3 text-xs text-[var(--ui-ink-soft)]",children:["@",a.handle]}),e.jsx("div",{className:"mt-2 line-clamp-2 text-xs leading-5 text-[var(--ui-ink-faint)]",children:a.description||"No user description yet."})]})},style:{background:"transparent",border:"none",padding:0}}})}function Ie(s,n,i){return s.filter(u=>u.subjectUserId!==u.targetUserId).map(u=>{const p=n===u.id,m=i!==null&&(u.subjectUserId===i||u.targetUserId===i),d=P(u),v=p?"var(--warning)":!u.config.rights.discoverable&&!u.config.rights.canReadEntities?"var(--danger)":m?"var(--primary)":"var(--ui-border-strong)";return{id:u.id,source:u.subjectUserId,target:u.targetUserId,label:`${re(u)} · ${d}/${A}`,markerEnd:{type:xe.ArrowClosed,color:v},labelStyle:{fill:p?"var(--warning)":"var(--ui-ink-medium)",fontSize:11,fontWeight:600},labelBgStyle:{fill:p?"var(--ui-warning-soft)":"var(--ui-surface-1)",stroke:p?"color-mix(in_srgb,var(--warning)_36%,var(--ui-border-subtle)_64%)":"var(--ui-border-subtle)",strokeWidth:1},labelBgPadding:[7,5],labelBgBorderRadius:8,style:{stroke:v,strokeWidth:p?2.5:m?1.8:1.25},animated:p}})}function Me({users:s,grants:n,selectedGrantId:i=null,selectedUserId:u=null,onOpenGrant:p,onOpenUser:m}){const d=n.find(c=>c.id===i)??null,v=g.useMemo(()=>Se(s,{selectedUserId:u,selectedGrant:d}),[d,u,s]),w=g.useMemo(()=>Ie(n,i,u),[n,i,u]),f=g.useMemo(()=>n.filter(c=>c.subjectUserId!==c.targetUserId),[n]),y=f.filter(c=>P(c)===A).length,C=f.filter(c=>c.config.rights.canCoordinate).length,a=f.filter(c=>c.config.rights.canAffectEntities||c.config.rights.canCreateOnBehalf).length;return e.jsxs(F,{className:"overflow-hidden p-0",children:[e.jsxs("div",{className:"grid gap-4 border-b border-[var(--ui-border-subtle)] px-5 py-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Directed relationship graph"}),e.jsx(fe,{content:"Keep Forge, OpenClaw, Hermes, and the browser on the same runtime and storage root when these arrows should describe one shared human and bot system.",label:"Explain the shared runtime rule"})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Click a user card to open that user's settings. Click any arrow to open the exact directional relationship flow for that lane."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(b,{tone:"meta",children:[f.length," edges"]}),e.jsxs(b,{className:"bg-[var(--ui-success-soft)] text-[var(--success)]",children:[y," fully open"]})]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Full collaboration"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:y}),e.jsx("div",{className:"text-xs leading-5 text-[var(--ui-ink-faint)]",children:"Directions still running with the default fully open posture."})]}),e.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Coordination lanes"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:C}),e.jsx("div",{className:"text-xs leading-5 text-[var(--ui-ink-faint)]",children:"Directions allowed to coordinate directly through Forge."})]}),e.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Execution control"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:a}),e.jsx("div",{className:"text-xs leading-5 text-[var(--ui-ink-faint)]",children:"Directions allowed to create or mutate target-owned work."})]})]})]}),e.jsx("div",{className:"h-[clamp(26rem,58vh,42rem)] bg-[linear-gradient(180deg,var(--ui-surface-2),var(--ui-surface-1))] sm:h-[min(72vh,54rem)] sm:min-h-[34rem]",children:e.jsxs(pe,{className:"user-relationship-flow",nodes:v,edges:w,fitView:!0,fitViewOptions:{padding:.1,maxZoom:.95},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:(c,h)=>{m(h.id)},onEdgeClick:(c,h)=>{p(h.id)},attributionPosition:"bottom-left",children:[e.jsx(ge,{showInteractive:!1}),e.jsx(me,{gap:28,size:1,color:"var(--ui-border-subtle)"})]})})]})}const O="rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",Y="text-sm font-medium text-[var(--ui-ink-strong)]",Oe="text-sm leading-6 text-[var(--ui-ink-soft)]",Re={kind:"human",handle:"",displayName:"",description:"",accentColor:"#c0c1ff"};function ee(s){return s?{kind:s.kind,handle:s.handle,displayName:s.displayName,description:s.description,accentColor:s.accentColor}:Re}function Fe({open:s,onOpenChange:n,user:i,grants:u,ownership:p,xp:m,pending:d=!1,onSubmit:v,onOpenRelationship:w}){const[f,y]=g.useState(()=>ee(i)),[C,a]=g.useState(null);g.useEffect(()=>{s&&(y(ee(i)),a(null))},[s,i]);const c=g.useMemo(()=>u.filter(o=>o.subjectUserId!==o.targetUserId),[u]),h=g.useMemo(()=>i?c.filter(o=>o.subjectUserId===i.id):[],[c,i]),t=g.useMemo(()=>i?c.filter(o=>o.targetUserId===i.id):[],[c,i]),N=[{id:"identity",eyebrow:i?"Edit user":"Create user",title:i?"Update the user identity":"Add a human or bot user",description:"Set the owner type and the public identity Forge will use across ownership, routing, and collaboration surfaces.",render:(o,x)=>e.jsxs(e.Fragment,{children:[e.jsx($,{label:"Kind",description:"Humans represent real people. Bots represent agents or automations with their own ownership lane.",children:e.jsx(H,{columns:2,value:o.kind,onChange:k=>x({kind:k}),options:[{value:"human",label:"Human",description:"Use for a real person in the Forge runtime."},{value:"bot",label:"Bot",description:"Use for an agent, assistant, or automation actor."}]})}),e.jsx($,{label:"Handle",description:"This becomes the stable short id shown as @handle.",hint:"Use lowercase and a durable label, for example forge-operator or planner-bot.",children:e.jsx(T,{value:o.handle,onChange:k=>x({handle:k.target.value}),placeholder:"forge-operator"})}),e.jsx($,{label:"Display name",description:"This is the human-readable label used across the UI.",children:e.jsx(T,{value:o.displayName,onChange:k=>x({displayName:k.target.value}),placeholder:"Forge Operator"})})]})},{id:"profile",eyebrow:"Profile",title:"Describe the user lane",description:"Capture what this user represents in the shared Forge runtime and pick the accent color that helps the lane stay recognizable.",render:(o,x)=>e.jsxs(e.Fragment,{children:[e.jsx($,{label:"Description",description:"Explain what this user is responsible for and what side of the system it represents.",children:e.jsx(be,{value:o.description,onChange:k=>x({description:k.target.value}),className:"min-h-36",placeholder:"Primary human operator for strategy, execution, and review."})}),e.jsx($,{label:"Accent color",description:"Forge uses this accent to help the user stand out in ownership and collaboration surfaces.",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(T,{value:o.accentColor,onChange:k=>x({accentColor:k.target.value}),placeholder:"#c0c1ff"}),e.jsx("div",{className:"size-10 shrink-0 rounded-full border border-[var(--ui-border-subtle)]",style:{backgroundColor:o.accentColor||"#c0c1ff"}})]})}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:`${O} px-4 py-3`,children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Owned records"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:(p==null?void 0:p.totalOwnedEntities)??0})]}),e.jsxs("div",{className:`${O} px-4 py-3`,children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Total XP"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:(m==null?void 0:m.totalXp)??0})]}),e.jsxs("div",{className:`${O} px-4 py-3`,children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Weekly XP"}),e.jsx("div",{className:"mt-2 text-[var(--ui-ink-strong)]",children:(m==null?void 0:m.weeklyXp)??0})]})]})]})},{id:"relationships",eyebrow:"Relationships",title:"Open directional relationship settings",description:"Each arrow is a separate contract. Open the exact lane you want to adjust and Forge will take you into the relationship flow.",render:()=>i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`${O} p-4`,children:[e.jsx(E,{user:i}),e.jsxs("div",{className:`mt-3 ${Oe}`,children:["@",i.handle," · ",i.description||"No description yet."]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:Y,children:"Outbound lanes"}),h.length>0?h.map(o=>e.jsxs("button",{type:"button",className:`${O} px-4 py-4 text-left transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]`,onClick:()=>w(o.id),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(E,{user:o.subjectUser}),e.jsx("span",{className:"text-[var(--ui-ink-faint)]",children:"→"}),e.jsx(E,{user:o.targetUser})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(b,{tone:"meta",children:re(o)}),e.jsxs(b,{tone:"meta",children:[P(o),"/",A," rights"]})]})]},o.id)):e.jsx("div",{className:"rounded-[20px] border border-dashed border-[var(--ui-border-subtle)] px-4 py-4 text-sm text-[var(--ui-ink-soft)]",children:"No outbound relationship lanes yet."})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:Y,children:"Inbound lanes"}),t.length>0?t.map(o=>e.jsxs("button",{type:"button",className:`${O} px-4 py-4 text-left transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]`,onClick:()=>w(o.id),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(E,{user:o.subjectUser}),e.jsx("span",{className:"text-[var(--ui-ink-faint)]",children:"→"}),e.jsx(E,{user:o.targetUser})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:ne(o).map(x=>e.jsx(b,{className:x.enabled?"bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]":"bg-[var(--ui-surface-1)] text-[var(--ui-ink-faint)] opacity-70",children:x.label},`${o.id}-${x.id}`))})]},o.id)):e.jsx("div",{className:"rounded-[20px] border border-dashed border-[var(--ui-border-subtle)] px-4 py-4 text-sm text-[var(--ui-ink-soft)]",children:"No inbound relationship lanes yet."})]})]})]}):e.jsx("div",{className:"rounded-[20px] border border-dashed border-[var(--ui-border-subtle)] px-4 py-4 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Create the user first, then Forge will generate the directional relationship lanes you can tune from here."})}];return e.jsx(ie,{open:s,onOpenChange:n,eyebrow:i?"User settings":"Create user",title:i?"User settings":"Create user",description:"Edit the user identity, clarify what this lane represents, and jump into relationship settings without crowding the page.",value:f,onChange:y,draftPersistenceKey:i?`users.settings.${i.id}`:"users.settings.new",steps:N,submitLabel:i?"Save user":"Create user",pending:d,pendingLabel:i?"Saving user":"Creating user",error:C,contentClassName:"lg:w-[min(58rem,calc(100vw-1.5rem))]",onSubmit:async()=>{const o=f.handle.trim(),x=f.displayName.trim();if(o.length===0){a("Add a handle before saving this user.");return}if(x.length===0){a("Add a display name before saving this user.");return}await v({userId:i==null?void 0:i.id,input:{kind:f.kind,handle:o,displayName:x,description:f.description.trim(),accentColor:f.accentColor.trim()||"#c0c1ff"}}),n(!1)}})}const _="rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",S="text-sm font-medium text-[var(--ui-ink-strong)]",G="text-sm leading-6 text-[var(--ui-ink-soft)]",Ae="text-xs leading-5 text-[var(--ui-ink-faint)]";function se(s,n){return{accessLevel:(s==null?void 0:s.accessLevel)??"manage",applyScope:"this_arrow",rights:{discoverable:(s==null?void 0:s.config.rights.discoverable)??!0,canListUsers:(s==null?void 0:s.config.rights.canListUsers)??!0,canReadProfile:(s==null?void 0:s.config.rights.canReadProfile)??!0,canReadEntities:(s==null?void 0:s.config.rights.canReadEntities)??!0,canSearchEntities:(s==null?void 0:s.config.rights.canSearchEntities)??!0,canLinkEntities:(s==null?void 0:s.config.rights.canLinkEntities)??!0,canCoordinate:(s==null?void 0:s.config.rights.canCoordinate)??!0,canAffectEntities:(s==null?void 0:s.config.rights.canAffectEntities)??!0,canManageStrategies:(s==null?void 0:s.config.rights.canManageStrategies)??!0,canCreateOnBehalf:(s==null?void 0:s.config.rights.canCreateOnBehalf)??!0,canViewMetrics:(s==null?void 0:s.config.rights.canViewMetrics)??!0,canViewActivity:(s==null?void 0:s.config.rights.canViewActivity)??!0}}}function $e({open:s,onOpenChange:n,grant:i,grants:u,pending:p=!1,onSubmit:m}){const d=g.useMemo(()=>i?u.find(a=>a.subjectUserId===i.targetUserId&&a.targetUserId===i.subjectUserId)??null:null,[i,u]),[v,w]=g.useState(()=>se(i,!!d));g.useEffect(()=>{s&&w(se(i,!!d))},[i,s,d]);const f=g.useMemo(()=>Object.values(v.rights).filter(Boolean).length,[v.rights]),y=Math.round(f/A*100),C=[{id:"posture",eyebrow:"Relationship posture",title:"Set the trust mode for this arrow",description:"Each arrow is directional. Decide whether you want to tune only this lane or mirror the same contract onto both directions.",render:(a,c)=>e.jsxs(e.Fragment,{children:[i?e.jsxs("div",{className:`${_} p-4`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(E,{user:i.subjectUser}),e.jsx("span",{className:"text-[var(--ui-ink-faint)]",children:"→"}),e.jsx(E,{user:i.targetUser})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(b,{tone:"meta",children:Ue(i)}),e.jsxs(b,{tone:"meta",children:[P(i),"/",A," rights"]})]})]}):null,e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:S,children:"Access level"}),e.jsx(H,{columns:2,value:a.accessLevel,onChange:h=>c({accessLevel:h}),options:[{value:"view",label:"View",description:"Use when this lane should stay mostly observational."},{value:"manage",label:"Manage",description:"Use when the source side can actively collaborate or act."}]})]}),d?e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:S,children:"Apply scope"}),e.jsx(H,{columns:2,value:a.applyScope,onChange:h=>c({applyScope:h}),options:[{value:"this_arrow",label:"This arrow",description:"Only change the exact direction you opened."},{value:"both_arrows",label:"Both arrows",description:"Mirror the same contract onto the reverse direction too."}]})]}):null]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:S,children:"Quick preset"}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:Ce.map(h=>e.jsxs("button",{type:"button",className:`rounded-[22px] border p-4 text-left transition ${i&&Ee(i,h)?"border-[color-mix(in_srgb,var(--warning)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-warning-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]"}`,onClick:()=>c({rights:{...a.rights,...h.rights}}),children:[e.jsx("div",{className:S,children:h.label}),e.jsx("div",{className:`mt-2 ${G}`,children:h.description})]},h.id))})]})]})},{id:"rights",eyebrow:"Rights",title:"Tune the individual permissions",description:"Use the preset as the starting point, then sharpen the exact boundaries only where this relationship needs them.",render:(a,c)=>e.jsx(e.Fragment,{children:ae.map(h=>e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:S,children:h.label}),e.jsx("div",{className:`mt-1 ${G}`,children:h.description})]}),e.jsx("div",{className:"grid gap-2",children:h.rights.map(t=>e.jsxs("label",{className:"flex items-start justify-between gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:S,children:t.label}),e.jsx("div",{className:`mt-1 ${Ae}`,children:t.description})]}),e.jsx("input",{type:"checkbox",checked:a.rights[t.key],onChange:N=>c({rights:{...a.rights,[t.key]:N.target.checked}})})]},t.key))})]},h.id))})},{id:"review",eyebrow:"Review",title:"Review the final relationship contract",description:"Check the enabled capabilities, confirm whether both directions should match, and then save the relationship.",render:a=>{var c,h;return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:`${_} p-4`,children:[e.jsx("div",{className:S,children:"Capability coverage"}),e.jsx("div",{className:"mt-4",children:e.jsx(ve,{value:y})}),e.jsxs("div",{className:"mt-3 text-sm text-[var(--ui-ink-soft)]",children:[f,"/",A," rights enabled"]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:ne({...i??{id:"draft",subjectUserId:"",targetUserId:"",accessLevel:a.accessLevel,config:{self:!1,mutable:!0,linkedEntities:!0,rights:a.rights},createdAt:"",updatedAt:"",subjectUser:null,targetUser:null},accessLevel:a.accessLevel,config:{...(i==null?void 0:i.config)??{self:!1,mutable:!0,linkedEntities:!0},rights:a.rights}}).map(t=>e.jsx(b,{className:t.enabled?"bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]":"bg-[var(--ui-surface-1)] text-[var(--ui-ink-faint)] opacity-70",children:t.label},t.id))})]}),e.jsxs("div",{className:`${_} p-4`,children:[e.jsx("div",{className:S,children:"Save scope"}),e.jsx("div",{className:`mt-3 ${G}`,children:a.applyScope==="both_arrows"&&d?"Forge will apply the same access level and rights to both directions of this pair.":"Forge will only update the exact arrow you opened."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(b,{tone:"meta",children:["access ",a.accessLevel]}),e.jsxs(b,{tone:"meta",children:["scope"," ",a.applyScope==="both_arrows"&&d?"both arrows":"this arrow"]})]}),d?e.jsxs("div",{className:"mt-4 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-sm text-[var(--ui-ink-soft)]",children:["Reverse arrow available:"," ",((c=d.subjectUser)==null?void 0:c.displayName)??d.subjectUserId," ","→"," ",((h=d.targetUser)==null?void 0:h.displayName)??d.targetUserId]}):null]})]})})}}];return e.jsx(ie,{open:s,onOpenChange:n,eyebrow:"Relationship settings",title:"Relationship settings",description:"Edit the exact directional contract between two users without keeping the full rights editor pinned on the page.",value:v,onChange:w,draftPersistenceKey:i?`users.relationship.${i.id}`:"users.relationship.new",steps:C,submitLabel:"Save relationship",pending:p,pendingLabel:"Saving relationship",contentClassName:"lg:w-[min(62rem,calc(100vw-1.5rem))]",onSubmit:async()=>{i&&(await m({grantId:i.id,patch:{accessLevel:v.accessLevel,rights:v.rights},reverseGrantId:(d==null?void 0:d.id)??null,applyToReverse:v.applyScope==="both_arrows"&&d!==null}),n(!1))}})}const U="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",M="text-sm leading-6 text-[var(--ui-ink-soft)]",te="text-xs leading-5 text-[var(--ui-ink-faint)]",R="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]";function Qe(){var X;const s=je(),[n,i]=g.useState(null),[u,p]=g.useState(null),[m,d]=g.useState(!1),[v,w]=g.useState(!1),[f,y]=g.useState(""),C=de({queryKey:["forge-user-directory"],queryFn:ke}),a=async()=>{await Promise.all([s.refresh(),C.refetch()])},c=Z({mutationFn:async({input:r,userId:l})=>l?(await we(l,r)).user:(await ye(r)).user,onSuccess:async()=>{i(null),d(!1),await a()}}),h=Z({mutationFn:async({grantId:r,patch:l})=>(await Ne(r,l)).grant,onSuccess:a}),t=(X=C.data)==null?void 0:X.directory,N=(t==null?void 0:t.grants.find(r=>r.id===u))??null,o=g.useMemo(()=>new Map(((t==null?void 0:t.ownership)??[]).map(r=>[r.userId,r])),[t==null?void 0:t.ownership]),x=g.useMemo(()=>new Map(((t==null?void 0:t.xp)??[]).map(r=>[r.userId,r])),[t==null?void 0:t.xp]),k=g.useMemo(()=>{const r=new Map;for(const l of(t==null?void 0:t.grants)??[]){if(!l.targetUser||l.subjectUserId===l.targetUserId)continue;const j=r.get(l.subjectUserId)??[];j.push(l.targetUser),r.set(l.subjectUserId,j)}return r},[t==null?void 0:t.grants]),L=g.useMemo(()=>{const r=((t==null?void 0:t.grants)??[]).filter(l=>l.subjectUserId!==l.targetUserId);return{totalEdges:r.length,fullyOpenEdges:r.filter(l=>Object.values(l.config.rights).every(Boolean)).length,coordinationEdges:r.filter(l=>l.config.rights.canCoordinate).length,executionEdges:r.filter(l=>l.config.rights.canAffectEntities||l.config.rights.canCreateOnBehalf).length}},[t==null?void 0:t.grants]),B=f.trim().toLowerCase(),V=g.useMemo(()=>{const l=((t==null?void 0:t.users)??s.snapshot.users).filter(j=>B?[j.displayName,j.handle,j.kind,j.description].join(" ").toLowerCase().includes(B):!0);return{humans:l.filter(j=>j.kind==="human"),bots:l.filter(j=>j.kind==="bot")}},[t==null?void 0:t.users,B,s.snapshot.users]),le=(N==null?void 0:N.subjectUserId)??(n==null?void 0:n.id)??null,oe=(N==null?void 0:N.id)??null;return e.jsxs("div",{className:"mx-auto grid w-full max-w-[1440px] gap-5",children:[e.jsx(ue,{title:"Users",description:"Forge users can be human or bot. Ownership, search, and routing are prepared so work can move across both sides of the system.",badge:`${s.snapshot.users.length} users`}),e.jsx(he,{}),e.jsx(Fe,{open:m,onOpenChange:d,user:n,grants:(t==null?void 0:t.grants)??[],ownership:n?o.get(n.id)??null:null,xp:n?x.get(n.id)??null:null,pending:c.isPending,onSubmit:async r=>{await c.mutateAsync(r)},onOpenRelationship:r=>{d(!1),p(r),w(!0)}}),e.jsx($e,{open:v,onOpenChange:w,grant:N,grants:(t==null?void 0:t.grants)??[],pending:h.isPending,onSubmit:async r=>{await h.mutateAsync({grantId:r.grantId,patch:r.patch}),r.applyToReverse&&r.reverseGrantId&&await h.mutateAsync({grantId:r.reverseGrantId,patch:r.patch})}}),e.jsxs(F,{className:"grid gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:U,children:"Multi-user posture"}),e.jsx("div",{className:`mt-2 ${M}`,children:(t==null?void 0:t.posture.summary)??"Forge is preparing modular user access while keeping the current posture permissive."})]}),e.jsx(b,{tone:"meta",children:(t==null?void 0:t.posture.accessModel)??"permissive"})]}),e.jsx("div",{className:`flex items-center gap-3 ${R} px-4 py-3`,children:e.jsx(T,{value:f,onChange:r=>y(r.target.value),placeholder:"Search human, bot, @handle, or description"})})]}),e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-5",children:[e.jsxs(F,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:U,children:"Multi-agent onboarding"}),e.jsx("div",{className:`mt-2 ${M}`,children:"Forge now treats the users graph as the collaboration control plane. Create each human or bot here, keep the runtime shared, then narrow only the specific arrows that should stop seeing, coordinating, planning, or affecting another user."})]}),e.jsx(b,{tone:"meta",children:"default open"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsxs("div",{className:`${R} px-4 py-3`,children:[e.jsx("div",{className:U,children:"Directional edges"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:L.totalEdges})]}),e.jsxs("div",{className:`${R} px-4 py-3`,children:[e.jsx("div",{className:U,children:"Fully open"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:L.fullyOpenEdges})]}),e.jsxs("div",{className:`${R} px-4 py-3`,children:[e.jsx("div",{className:U,children:"Coordination"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:L.coordinationEdges})]}),e.jsxs("div",{className:`${R} px-4 py-3`,children:[e.jsx("div",{className:U,children:"Execution control"}),e.jsx("div",{className:"mt-2 text-lg text-[var(--ui-ink-strong)]",children:L.executionEdges})]})]}),e.jsxs("div",{className:`grid gap-2 ${M}`,children:[e.jsx("div",{children:"1. Create the human and bot users that should exist in the shared Forge system."}),e.jsx("div",{children:"2. Point OpenClaw, Hermes, and the browser at the same Forge runtime and storage root."}),e.jsx("div",{children:"3. Use the graph below to decide what each direction can see, message, plan, or change."}),e.jsx("div",{children:"4. Keep strategy drafting open while the plan is negotiated, then lock the strategy once it becomes the contract."})]})]}),e.jsx(Me,{users:(t==null?void 0:t.users)??s.snapshot.users,grants:(t==null?void 0:t.grants)??[],selectedGrantId:oe,selectedUserId:le,onOpenUser:r=>{const l=((t==null?void 0:t.users)??s.snapshot.users).find(j=>j.id===r)??null;p(null),i(l),d(!0)},onOpenGrant:r=>{i(null),p(r),w(!0)}}),e.jsxs(F,{className:"grid gap-3",children:[e.jsx("div",{className:U,children:"Agent onboarding"}),e.jsx("div",{className:M,children:"OpenClaw, Hermes, and the Forge UI all read this same multi-user graph. Keep the defaults open while you are still wiring collaboration, then narrow specific arrows when one user or agent should stop seeing, messaging, planning, or changing another user's work."}),e.jsx("div",{className:M,children:"Forge now treats every owner as either human or bot, keeps search cross-user by default, and allows cross-owner links plus explicit coordination lanes between projects, tasks, notes, and strategies."}),e.jsx("div",{children:e.jsx(ce,{to:"/settings/agents",className:"inline-flex min-h-10 items-center justify-center rounded-[var(--radius-control)] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-[13px] font-medium text-[var(--ui-ink-strong)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",children:"Open agent onboarding"})})]})]}),e.jsx(F,{children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:U,children:"User directory"}),e.jsx("div",{className:`mt-2 ${M}`,children:"Open any user to edit its identity and jump into the exact directional relationship lanes from the user settings flow."})]}),e.jsx(J,{onClick:()=>{p(null),i(null),d(!0)},children:"Create user"})]})}),e.jsx("div",{className:"grid gap-5",children:[{title:"Human users",users:V.humans},{title:"Bot users",users:V.bots}].map(r=>e.jsxs(F,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:U,children:r.title}),e.jsx(b,{tone:"meta",children:r.users.length})]}),e.jsx("div",{className:"mt-4 grid gap-3",children:r.users.map(l=>{var j,z,K,Q,W,q;return e.jsx("div",{className:`${R} px-4 py-4`,children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(E,{user:l}),e.jsxs("div",{className:"mt-3 text-sm text-[var(--ui-ink-soft)]",children:["@",l.handle]}),e.jsx("div",{className:`mt-2 ${M}`,children:l.description||"No description yet."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(b,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:[((j=x.get(l.id))==null?void 0:j.totalXp)??0," XP"]}),e.jsxs(b,{tone:"meta",children:[((z=x.get(l.id))==null?void 0:z.weeklyXp)??0," weekly"]}),e.jsxs(b,{tone:"meta",children:[((K=x.get(l.id))==null?void 0:K.rewardEventCount)??0," ","rewards"]}),Object.entries(((Q=o.get(l.id))==null?void 0:Q.entityCounts)??{}).sort((I,D)=>D[1]-I[1]).slice(0,4).map(([I,D])=>e.jsxs(b,{tone:"meta",children:[D," ",I]},`${l.id}-${I}`)),e.jsxs(b,{tone:"meta",children:[((W=o.get(l.id))==null?void 0:W.totalOwnedEntities)??0," ","owned"]})]}),e.jsxs("div",{className:`mt-3 ${te}`,children:["Can currently read:"," ",(k.get(l.id)??[]).map(I=>`${I.displayName} (${I.kind})`).join(", ")||"no other users"]}),(q=x.get(l.id))!=null&&q.lastRewardAt?e.jsxs("div",{className:`mt-2 ${te}`,children:["Last XP movement:"," ",new Date(x.get(l.id).lastRewardAt).toLocaleString()]}):null]}),e.jsx("div",{className:"flex gap-2",children:e.jsx(J,{variant:"secondary",onClick:()=>{p(null),i(l),d(!0)},children:"Open settings"})})]})},l.id)})})]},r.title))})]})]})}export{Qe as SettingsUsersPage};
@@ -1 +0,0 @@
1
- import{r as p,j as e,cA as K,cy as W,cE as V,cC as J,aC as $,b_ as X,b7 as Y}from"./vendor-y_uz1Wft.js";import{j as Z,i as ee,k as A}from"./state-DWw8Jay_.js";import{O as se}from"./open-in-graph-button-BHl16hJP.js";import{P as te}from"./preference-entity-handoff-button-1XXtBsUF.js";import{a as ae,i as re,b as ie,S as ne}from"./strategy-dialog-DvlPo9WV.js";import{i as le,C as oe,B as de,M as ce}from"./graph-U1J6VkbG.js";import{j as x,d as ue,L as me,e as F,B as _,C as k,_ as xe,b7 as ge,by as G,bx as pe,bA as he}from"./index-Dj8q65se.js";import{U as L}from"./user-badge-B8hYK6NU.js";import{P as fe}from"./page-hero-DYmFM6-q.js";import{g as ve}from"./user-ownership-DJGl4rAj.js";import"./board-CGgOvBP9.js";import"./question-flow-dialog-CPyXCqA-.js";import"./ui-CdEDMtXF.js";import"./motion-DeJZhOSA.js";import"./user-select-field-akGHK-2t.js";import"./forms-DhEGHkFR.js";function Q(a){const i=new Map;for(const r of a.nodes)i.set(r.id,[]);for(const r of a.edges)i.set(r.to,[...i.get(r.to)??[],r.from]);const o=new Map,d=r=>{const c=o.get(r);if(c!==void 0)return c;const j=i.get(r)??[],h=j.length===0?0:Math.max(...j.map(l=>d(l)))+1;return o.set(r,h),h};for(const r of a.nodes)d(r.id);return o}function be(a){const i=Q(a),o=new Map;for(const d of a.nodes){const r=i.get(d.id)??0;o.set(r,[...o.get(r)??[],d.id])}return Array.from(o.entries()).sort((d,r)=>d[0]-r[0]).map(([d,r])=>({level:d,nodeIds:r}))}function je(a,i){const o=Q(a.graph),d=new Map;for(const r of a.graph.nodes){const c=o.get(r.id)??0;d.set(c,[...d.get(c)??[],r.id])}return a.graph.nodes.map(r=>{const c=o.get(r.id)??0,j=(d.get(c)??[]).indexOf(r.id),h=a.metrics.activeNodeIds.includes(r.id),l=a.metrics.blockedNodeIds.includes(r.id),m=a.metrics.outOfOrderNodeIds.includes(r.id),v=!h&&!l&&!m,s=(i==null?void 0:i.get(r.id))??null;let g="border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",n="bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]";return h?(g="border-[color-mix(in_srgb,var(--success)_34%,var(--ui-border-subtle))] bg-[var(--ui-success-soft)]",n="bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_78%,var(--ui-ink-strong)_22%)]"):l?(g="border-[color-mix(in_srgb,var(--danger)_32%,var(--ui-border-subtle))] bg-[var(--ui-danger-soft)]",n="bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_78%,var(--ui-ink-strong)_22%)]"):m?(g="border-[color-mix(in_srgb,var(--warning)_34%,var(--ui-border-subtle))] bg-[var(--ui-warning-soft)]",n="bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]"):a.metrics.completedNodeCount>0&&(g="border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle))] bg-[var(--ui-info-soft)]",n="bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]"),{id:r.id,position:{x:72+c*308,y:56+j*168},draggable:!1,selectable:!1,data:{label:e.jsxs("div",{className:`w-[min(17rem,calc(100vw-5rem))] min-w-0 max-w-[17rem] rounded-[22px] border px-4 py-4 shadow-[var(--ui-shadow-soft)] ${g}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(x,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:r.entityType}),h?e.jsx(x,{className:n,children:"Active"}):null,l?e.jsx(x,{className:n,children:"Blocked"}):null,m?e.jsx(x,{className:n,children:"Out of order"}):null,v&&!l&&!m?e.jsx(x,{className:n,children:"In plan"}):null]}),e.jsx("div",{className:"mt-3 break-words text-base font-medium leading-6 text-[var(--ui-ink-strong)]",children:r.title}),r.branchLabel?e.jsx("div",{className:"mt-2 break-words text-xs uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:r.branchLabel}):null,r.notes?e.jsx("div",{className:"mt-2 break-words text-sm leading-5 text-[var(--ui-ink-soft)]",children:r.notes}):null,s?e.jsxs("div",{className:"mt-3 flex min-w-0 items-center gap-2 text-xs text-[var(--ui-ink-faint)]",children:[e.jsx("span",{className:"inline-block size-2.5 rounded-full",style:{backgroundColor:s.color}}),e.jsx("span",{className:"min-w-0 break-words",children:s.label})]}):null]})},style:{background:"transparent",border:"none",padding:0}}})}function ye(a){return a.graph.edges.map(i=>{const o=a.metrics.activeNodeIds.includes(i.to),d=a.metrics.blockedNodeIds.includes(i.to),r=a.metrics.outOfOrderNodeIds.includes(i.to);let c="var(--ui-border-strong)";return o?c="var(--success)":d?c="var(--danger)":r&&(c="var(--warning)"),{id:`${i.from}->${i.to}`,source:i.from,target:i.to,label:i.label||void 0,animated:o,markerEnd:{type:ce.ArrowClosed,color:c},style:{stroke:c,strokeWidth:o?2.4:1.5},labelStyle:{fill:"var(--ui-ink-soft)",fontSize:11,fontWeight:600}}})}function we({strategy:a,ownerByNodeId:i,heightClassName:o="h-[540px]"}){const d=p.useMemo(()=>je(a,i),[i,a]),r=p.useMemo(()=>ye(a),[a]);return e.jsx("div",{className:`${o} min-w-0 overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] shadow-[var(--ui-shadow-soft)]`,children:e.jsxs(le,{fitView:!0,nodes:d,edges:r,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,attributionPosition:"bottom-left",children:[e.jsx(oe,{showInteractive:!1}),e.jsx(de,{gap:28,size:1,color:"var(--ui-border-subtle)"})]})})}function Ne(a,i){const o=a.metrics.activeNodeIds.includes(i),d=a.metrics.blockedNodeIds.includes(i),r=a.metrics.outOfOrderNodeIds.includes(i);return d?{label:"Blocked",className:"bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_78%,var(--ui-ink-strong)_22%)]"}:r?{label:"Out of order",className:"bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]"}:o?{label:"Ready now",className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_78%,var(--ui-ink-strong)_22%)]"}:{label:"In plan",className:"bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]"}}function ke({strategy:a,projectsById:i,tasksById:o,className:d}){const r=p.useMemo(()=>be(a.graph),[a.graph]),c=p.useMemo(()=>{const l=new Map;for(const m of a.graph.nodes)l.set(m.id,[]);for(const m of a.graph.edges)l.set(m.to,[...l.get(m.to)??[],m.from]);return l},[a.graph]),[j,h]=p.useState([]);return e.jsxs("div",{className:d??"grid gap-3",children:[r.map(l=>{const m=j.includes(l.level),v=l.level===0?"Launch phase":`Phase ${l.level+1}`,s=l.nodeIds.length>1;return e.jsxs("div",{className:"min-w-0 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] shadow-[var(--ui-shadow-soft)]",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 px-4 py-4",children:[e.jsxs("button",{type:"button",className:"flex min-w-0 max-w-full items-center gap-3 text-left",onClick:()=>h(g=>m?g.filter(n=>n!==l.level):[...g,l.level]),children:[e.jsx("span",{className:"rounded-full bg-[var(--ui-surface-3)] p-2 text-[var(--ui-ink-soft)]",children:m?e.jsx(K,{className:"size-4"}):e.jsx(W,{className:"size-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-words font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:v}),e.jsx("div",{className:"mt-1 break-words text-sm text-[var(--ui-ink-soft)]",children:s?"These branches can progress in parallel once the previous phase is complete.":"This phase advances as one focused step in the strategy."})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(x,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:[l.nodeIds.length," node",l.nodeIds.length===1?"":"s"]}),e.jsx(x,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:s?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"mr-1 size-3.5"}),"Parallel"]}):e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"mr-1 size-3.5"}),"Sequential"]})})]})]}),m?null:e.jsx("div",{className:"grid min-w-0 gap-3 border-t border-[var(--ui-border-subtle)] px-4 py-4 lg:grid-cols-2",children:l.nodeIds.map(g=>{var T,N,O;const n=a.graph.nodes.find(f=>f.id===g);if(!n)return null;const w=n.entityType==="project"?i.get(n.entityId):o.get(n.entityId),M=n.entityType==="project"?`/projects/${n.entityId}`:`/tasks/${n.entityId}`,I=n.entityType==="project"?(T=i.get(n.entityId))==null?void 0:T.user:(N=o.get(n.entityId))==null?void 0:N.user,b=((O=c.get(n.id))==null?void 0:O.map(f=>{var P;return((P=a.graph.nodes.find(B=>B.id===f))==null?void 0:P.title)??f}))??[],y=Ne(a,n.id);return e.jsxs("div",{className:"min-w-0 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(x,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:n.entityType}),e.jsx(x,{className:y.className,children:y.label})]}),e.jsx($,{to:M,className:"mt-3 block break-words text-lg font-medium text-[var(--ui-ink-strong)] transition hover:text-[var(--primary)]",children:n.title}),e.jsx("div",{className:"mt-2 break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:n.notes||("description"in(w??{})?w==null?void 0:w.description:"")||"No extra step note attached yet."})]}),e.jsx(L,{user:I,compact:!0})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[n.branchLabel?e.jsx(x,{className:"bg-[var(--ui-accent-soft)] text-[var(--primary)]",children:n.branchLabel}):null,b.length===0?e.jsx(x,{className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_78%,var(--ui-ink-strong)_22%)]",children:"Start node"}):b.map(f=>e.jsxs(x,{className:"max-w-full break-words bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",children:["Depends on ",f]},`${n.id}:${f}`))]})]},n.id)})})]},l.level)}),r.length===0?e.jsx("div",{className:"rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-4 text-sm text-[var(--ui-ink-soft)]",children:"No phases mapped yet."}):null]})}function Ue(){var B;const a=ue(),{strategyId:i}=X(),o=Y(),d=Z(),[r,c]=p.useState(!1),[j,h]=p.useState(),l=ve(a.selectedUserIds),m=a.snapshot.strategies.find(t=>t.id===i)??null,v=ee({queryKey:["strategy-detail",i],queryFn:async()=>(await he(i)).strategy,enabled:!!(i&&!m)}),s=m??v.data??null,g=async()=>{await Promise.all([d.invalidateQueries({queryKey:["strategy-detail",i]}),a.refresh()])},n=A({mutationFn:async({input:t,currentStrategyId:u})=>(await G(u,t)).strategy,onSuccess:g}),w=A({mutationFn:async t=>pe(t),onSuccess:async()=>{await g(),o("/strategies")}}),M=A({mutationFn:async t=>(await G(i,{isLocked:t,lockedByUserId:t?l??(s==null?void 0:s.userId)??"user_operator":null})).strategy,onSuccess:g}),I=p.useMemo(()=>new Map(a.snapshot.goals.map(t=>[t.id,t])),[a.snapshot.goals]),b=p.useMemo(()=>new Map(a.snapshot.dashboard.projects.map(t=>[t.id,t])),[a.snapshot.dashboard.projects]),y=p.useMemo(()=>new Map(a.snapshot.tasks.map(t=>[t.id,t])),[a.snapshot.tasks]),T=p.useMemo(()=>s?new Map(s.graph.nodes.map(t=>{var S,C;const u=t.entityType==="project"?(S=b.get(t.entityId))==null?void 0:S.user:(C=y.get(t.entityId))==null?void 0:C.user;return[t.id,u?{label:`${u.displayName} (${u.kind})`,color:u.accentColor}:null]})):new Map,[b,s,y]),N=s??{title:"",overview:"",endStateDescription:"",targetGoalIds:[],targetProjectIds:[],graph:{nodes:[],edges:[]}},O=p.useMemo(()=>ae(N),[N]),f=p.useMemo(()=>re(N),[N]),P=p.useMemo(()=>ie((s==null?void 0:s.metrics)??{planCoverageScore:0,sequencingScore:0,scopeDisciplineScore:0,qualityScore:0,targetProgressScore:0,startedNodeCount:0,totalNodeCount:1,offPlanEntityCount:0,offPlanActiveEntityCount:0,blockedNodeIds:[],outOfOrderNodeIds:[]}),[s==null?void 0:s.metrics]);return v.isLoading&&!s?e.jsx(me,{eyebrow:"Strategy",title:"Loading strategy",description:"Resolving the directed plan, targets, and current alignment."}):v.isError?e.jsx(F,{eyebrow:"Strategy",error:v.error,onRetry:()=>void v.refetch()}):s?e.jsxs("div",{className:"grid gap-5",children:[e.jsx(fe,{title:s.title,titleText:s.title,description:s.overview||s.endStateDescription,badge:`${s.metrics.alignmentScore}% aligned`,actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(te,{userId:l,domain:"strategies",entityType:"strategy",entityId:s.id,label:s.title,description:s.overview||s.endStateDescription}),e.jsx(se,{entityType:"strategy",entityId:s.id}),s.isLocked?null:e.jsx(_,{variant:"secondary",onClick:()=>{h(void 0),c(!0)},children:"Edit strategy"}),e.jsx(_,{variant:"secondary",disabled:!s.isLocked&&!f,pending:M.isPending,pendingLabel:s.isLocked?"Unlocking contract":"Locking contract",onClick:()=>{M.mutateAsync(!s.isLocked)},children:s.isLocked?"Unlock contract":"Lock as contract"}),e.jsx(_,{variant:"secondary",pending:w.isPending,pendingLabel:"Deleting strategy",onClick:()=>{window.confirm(`Delete strategy "${s.title}"?`)&&w.mutateAsync(s.id)},children:"Delete"})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(L,{user:s.user}),e.jsx(x,{className:s.isLocked?"bg-amber-500/12 text-amber-200":"bg-emerald-500/12 text-emerald-200",children:s.isLocked?"Contract locked":"Editable draft"}),e.jsx(x,{className:"bg-white/[0.08] text-white/76",children:s.status}),e.jsxs(x,{className:"bg-white/[0.08] text-white/76",children:[s.graph.nodes.length," nodes"]}),e.jsxs(x,{className:"bg-white/[0.08] text-white/76",children:[s.graph.edges.length," edges"]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.15fr)_minmax(18rem,0.85fr)]",children:[e.jsxs("div",{className:"grid gap-5",children:[e.jsxs(k,{className:"grid gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"End state"}),e.jsx("div",{className:"text-sm leading-7 text-white/64",children:s.endStateDescription||"No end-state description yet."})]}),e.jsxs(k,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Directed execution graph"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"The graph is the contract surface for this strategy. It shows which branches are available now, where work is blocked, and whether any node is moving out of sequence."})]}),s.isLocked?null:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(_,{variant:"secondary",onClick:()=>{h("sequence"),c(!0)},children:"Refine sequence"}),e.jsx(_,{onClick:()=>{h("sequence"),c(!0)},children:"Add parallel work"})]})]}),e.jsx(we,{strategy:s,ownerByNodeId:T}),e.jsx(ke,{strategy:s,projectsById:b,tasksById:y})]})]}),e.jsxs("div",{className:"grid gap-5",children:[e.jsxs(k,{className:"grid gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Contract state"}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsx("div",{className:"text-sm text-white/58",children:s.isLocked?"This strategy is currently locked as a contract. The graph, targets, and descriptive plan stay frozen until you explicitly unlock it.":"This strategy is still a draft. Agents and users can keep refining the plan until you lock it."}),s.isLocked?e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-sm text-white/60",children:[e.jsxs("span",{children:["Locked by"," ",((B=s.lockedByUser)==null?void 0:B.displayName)??"Unknown user"]}),s.lockedAt?e.jsxs("span",{children:["· ",new Date(s.lockedAt).toLocaleString()]}):null]}):null,s.isLocked?null:e.jsx("div",{className:"mt-4 grid gap-2",children:O.map(t=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-[14px] bg-white/[0.03] px-3 py-2",children:[e.jsx("div",{className:"text-sm text-white/64",children:t.label}),e.jsx(x,{className:t.satisfied?"bg-emerald-500/12 text-emerald-200":"bg-amber-500/12 text-amber-200",children:t.satisfied?"Ready":"Missing"})]},t.id))})]}),!s.isLocked&&!f?e.jsx("div",{className:"rounded-[18px] border border-amber-400/18 bg-amber-500/[0.08] px-4 py-3 text-sm leading-6 text-amber-100/86",children:"Add a target goal or project plus an overview or end state before locking this draft as the execution contract."}):null,s.isLocked?null:e.jsx("div",{className:"mt-4 text-xs leading-5 text-white/46",children:"Drafts may stay incomplete while humans and agents negotiate the plan. Only the lock action requires the contract checks to pass."})]}),e.jsxs(k,{className:"grid gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Alignment metrics"}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsx("div",{className:"text-sm text-white/56",children:"Alignment score"}),e.jsxs("div",{className:"mt-2 font-display text-3xl text-[var(--primary)]",children:[s.metrics.alignmentScore,"%"]}),e.jsxs("div",{className:"mt-3 text-xs leading-5 text-white/48",children:[s.metrics.startedNodeCount,"/",s.metrics.totalNodeCount," planned nodes started,"," ",s.metrics.completedNodeCount," completed,"," ",s.metrics.readyNodeCount," ready now."]})]}),P.map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm text-white/56",children:t.label}),e.jsxs("div",{className:"text-sm font-medium text-white",children:[t.value,"%"]})]}),e.jsx(xe,{value:t.value,className:"mt-3"}),e.jsx("div",{className:"mt-3 text-xs leading-5 text-white/48",children:t.detail})]},t.id))]}),e.jsxs(k,{className:"grid gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"End targets"}),s.targetGoalIds.map(t=>{const u=I.get(t);return u?e.jsx($,{to:`/goals/${u.id}`,className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/78 transition hover:bg-white/[0.08]",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("span",{children:["Goal: ",u.title]}),e.jsx(L,{user:u.user,compact:!0})]})},u.id):null}),s.targetProjectIds.map(t=>{const u=b.get(t);return u?e.jsx($,{to:`/projects/${u.id}`,className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/78 transition hover:bg-white/[0.08]",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("span",{children:["Project: ",u.title]}),e.jsx(L,{user:u.user,compact:!0})]})},u.id):null}),s.targetGoalIds.length===0&&s.targetProjectIds.length===0?e.jsx("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/52",children:"No end targets linked yet."}):null]}),e.jsxs(k,{className:"grid gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Linked entities"}),s.linkedEntities.length===0?e.jsx("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/52",children:"No additional linked entities."}):s.linkedEntities.map(t=>{var C,D,E,q,R,U,z;const u=ge(t.entityType,t.entityId),S=t.entityType==="goal"?(C=I.get(t.entityId))==null?void 0:C.title:t.entityType==="project"?(D=b.get(t.entityId))==null?void 0:D.title:t.entityType==="task"?(E=y.get(t.entityId))==null?void 0:E.title:`${t.entityType}:${t.entityId}`;return u?e.jsx($,{to:u,className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/78 transition hover:bg-white/[0.08]",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:S}),e.jsx(L,{user:t.entityType==="goal"?(q=I.get(t.entityId))==null?void 0:q.user:t.entityType==="project"?(R=b.get(t.entityId))==null?void 0:R.user:t.entityType==="task"?(U=y.get(t.entityId))==null?void 0:U.user:t.entityType==="strategy"?(z=a.snapshot.strategies.find(H=>H.id===t.entityId))==null?void 0:z.user:null,compact:!0})]})},`${t.entityType}:${t.entityId}`):e.jsx("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/52",children:S},`${t.entityType}:${t.entityId}`)})]})]})]}),e.jsx(ne,{open:r,pending:n.isPending,editingStrategy:s,goals:a.snapshot.dashboard.goals,projects:a.snapshot.dashboard.projects,tasks:a.snapshot.tasks,habits:a.snapshot.habits,strategies:a.snapshot.strategies,users:a.snapshot.users,defaultUserId:l,initialStepId:j,onOpenChange:t=>{c(t),t||h(void 0)},onSubmit:async t=>{await n.mutateAsync({input:t,currentStrategyId:s.id})}})]}):e.jsx(F,{eyebrow:"Strategy",error:new Error("Strategy not found."),onRetry:()=>o("/strategies")})}export{Ue as StrategyDetailPage};