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 +1 @@
1
- import{b7 as It,r as m,j as e,bY as Q,aD as Ct,aG as Re,aT as At,c1 as Be,b4 as Ke}from"./vendor-y_uz1Wft.js";import{j as Ot,i as M,k as W}from"./state-DWw8Jay_.js";import{E as ie}from"./entity-link-multiselect-DZ_jAjs4.js";import{n as F,N as qe,p as ze}from"./note-tags-input-CP0-EPpE.js";import{d as _t,S as Et,e as Mt,B as w,bB as Ft,C as Ue,j as f,c as v,I as oe,aJ as Lt,T as $t,cF as Pt,b as He,i as Ve,bb as Qe,aj as Dt,ba as Rt,b8 as rt,cG as Bt,bc as Kt,bd as qt,be as zt,bf as Ut,bg as Ht,bi as Vt}from"./index-Dj8q65se.js";import{P as Qt}from"./page-hero-DYmFM6-q.js";import{C as Wt}from"./calendar-week-toolbar-Cu8V6zv1.js";import{S as le}from"./select-menu-BUB8__Nx.js";import{U as We}from"./user-badge-B8hYK6NU.js";import{U as Yt}from"./user-select-field-akGHK-2t.js";import{s as Ye,b as de,c as Gt,f as Ge,d as Je}from"./calendar-ui-Cy1XRwzV.js";import{g as Jt,a as Xt}from"./entity-links-DwpxhW2H.js";import{g as Zt,f as ge,a as es,b as N,d as S}from"./user-ownership-DJGl4rAj.js";import"./use-anchored-overlay-position-Cracjgo6.js";import"./motion-DeJZhOSA.js";import"./ui-CdEDMtXF.js";import"./board-CGgOvBP9.js";import"./forms-DhEGHkFR.js";const nt="Self-observation",ts="Forge activity",Z="Entity · ",X="all",ss=[{value:"compact",label:"Compact",description:"One row per entry: time, entity, title."},{value:"informative",label:"Informative",description:"Adds one short preview line and key context."},{value:"extended",label:"Extended",description:"Adds a little more context with a hard text cap."}],rs=[{value:"markdown",label:"Markdown brief",description:"Readable weekly notes for sharing with a therapist."},{value:"csv",label:"CSV table",description:"Structured rows for spreadsheet review."},{value:"json",label:"JSON archive",description:"Full structured payload with filters and metadata."},{value:"ics",label:"Calendar file",description:"Importable weekly timeline in calendar apps."}],Xe="box-border min-w-0 max-w-full overflow-hidden rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)]",Y="box-border min-w-0 max-w-full overflow-hidden rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",ce="text-[11px] font-medium uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",P="text-sm font-medium text-[var(--ui-ink-strong)]",Ze="text-[var(--ui-ink-soft)]",ue="text-[var(--ui-ink-faint)]",K="max-w-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",me="max-w-full border border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_74%,var(--ui-ink-strong)_26%)]",pe="max-w-full border border-[color-mix(in_srgb,var(--warning)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_74%,var(--ui-ink-strong)_26%)]",ve="inline-flex max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-1.5 text-xs text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",et="inline-flex max-w-full items-center gap-1 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2 py-1 text-[11px] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",tt="min-w-0 rounded-[8px] border border-dashed border-[var(--ui-border-subtle)] text-left text-sm text-[var(--ui-ink-faint)] transition hover:border-[var(--ui-border-strong)] hover:text-[var(--ui-ink-medium)]",at=new Set(["goal","project","task","strategy","habit","tag","psyche_value","behavior","belief_entry","mode_profile"]),q={noteId:null,contentMarkdown:"",author:"",tags:[],userId:null,observedAtInput:"",linkedPatternIds:[],linkedTriggerReportId:null,linkedEntityValues:[]};function z(n=[]){return F([nt,...n])}function j(n,r){return`${n}:${r}`}function ns(n){const r=n.indexOf(":");if(r<=0||r>=n.length-1)return null;const i=n.slice(0,r);return at.has(i)?{entityType:i,entityId:n.slice(r+1)}:null}function as(n){return n!==null}function is(n){const r=new Set;return n.filter(i=>{const o=`${i.entityType}:${i.entityId}:${i.anchorKey??""}`;return r.has(o)?!1:(r.add(o),!0)})}function it(n){const r=new Date(n);if(Number.isNaN(r.getTime()))return"";const i=r.getFullYear(),o=String(r.getMonth()+1).padStart(2,"0"),x=String(r.getDate()).padStart(2,"0"),h=String(r.getHours()).padStart(2,"0"),_=String(r.getMinutes()).padStart(2,"0");return`${i}-${o}-${x}T${h}:${_}`}function G(n){const r=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0");return`${r}-${i}-${o}`}function J(n){return new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function U(n,r){const i=n.replace(/\s+/g," ").trim();return i.length<=r?i:`${i.slice(0,Math.max(0,r-3)).trimEnd()}...`}function os(n,r=120){return U(n.contentPlain||n.contentMarkdown,r)}function ot(n){const r=n.note.frontmatter.movement;return!!r&&typeof r=="object"&&!Array.isArray(r)}function T(n){return n.kind==="observation"}function ls(n){return T(n)?n.observation.note.user:n.activity.event.user}function ds(n){if(T(n)){const i=n.observation;return[i.note.contentPlain,i.note.contentMarkdown,i.note.author??"",i.tags.join(" "),i.linkedPatterns.map(o=>o.title).join(" "),i.linkedReports.map(o=>o.title).join(" ")].join(" ").toLowerCase()}const r=n.activity.event;return[r.title,r.description,r.actor??"",r.eventType,r.entityType,n.tags.join(" ")].join(" ").toLowerCase()}function cs(n,r){if(r.length===0)return!0;const i=new Set(n.map(o=>o.toLowerCase()));return r.some(o=>i.has(o.toLowerCase()))}function us(n,r=160){const i=[n.title,n.description].filter(Boolean).join(". ");return U(i,r)}function ms(n,r){const i=n.note.contentPlain||n.note.contentMarkdown;return U(i||"Observation",r)}function ps(n){if(ot(n))return"Movement";const r=n.note.links.find(i=>i.entityType!=="behavior_pattern"&&i.entityType!=="trigger_report");return r?rt(r.entityType):n.linkedPatterns.length>0?"Pattern":n.linkedReports.length>0?"Trigger report":"Observation"}function st(n){const r=n.tags.find(i=>i.startsWith(Z));return r?r.replace(`${Z}`,""):U(n.event.entityType||"Activity",32)}function vs(n){const r=n.filter(i=>i.startsWith(Z)).sort((i,o)=>i.localeCompare(o));return[{value:X,label:"All entities",description:"Show every entity kind across the week."},...r.map(i=>({value:i,label:i.replace(`${Z}`,""),description:`Only entries tagged ${i}.`}))]}function gs(n,r){const i=URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=r,o.click(),URL.revokeObjectURL(i)}function hs(n,r,i){const o=new Date(n),x=new Date(r);return x.setHours(i,Number.isNaN(o.getTime())?0:o.getMinutes(),0,0),x.toISOString()}function xs(n,r){var i;return n?{noteId:n.note.id,contentMarkdown:n.note.contentMarkdown,author:n.note.author??"",tags:F(n.note.tags??[]),userId:n.note.userId??r,observedAtInput:it(n.observedAt),linkedPatternIds:n.linkedPatterns.map(o=>o.id),linkedTriggerReportId:((i=n.linkedReports[0])==null?void 0:i.id)??null,linkedEntityValues:n.note.links.filter(o=>o.entityType!=="behavior_pattern"&&o.entityType!=="trigger_report"&&at.has(o.entityType)).map(o=>j(o.entityType,o.entityId))}:{...q,tags:z(),userId:r}}function bs(n){return n.map(r=>({value:r.id,label:r.title,description:`${r.targetBehavior||r.preferredResponse||"Pattern"}${r.user?` · ${ge(r.user)}`:""}`,searchText:`${r.title} ${r.targetBehavior} ${r.description} ${r.preferredResponse}`.toLowerCase(),kind:"pattern"}))}function fs(n){return n.map(r=>({value:r.id,label:r.title,description:`${r.customEventType||r.eventSituation||"Trigger report"}${r.user?` · ${ge(r.user)}`:""}`,searchText:`${r.title} ${r.customEventType} ${r.eventSituation}`.toLowerCase(),kind:"report"}))}function ys({goals:n,projects:r,tasks:i,strategies:o,habits:x,tags:h,values:_,behaviors:C,beliefs:ee,modes:A}){return[...[...n.map(s=>({value:j("goal",s.id),label:s.title,description:S(s.description,s.user,"Goal"),searchText:N([s.title,s.description??""],s),kind:"goal"})),...r.map(s=>({value:j("project",s.id),label:s.title,description:S(s.description,s.user,"Project"),searchText:N([s.title,s.description??""],s),kind:"project"})),...i.map(s=>({value:j("task",s.id),label:s.title,description:S(s.description,s.user,s.owner??void 0),searchText:N([s.title,s.description??"",s.owner??""],s),kind:"task"})),...o.map(s=>({value:j("strategy",s.id),label:s.title,description:S(s.overview,s.user,"Strategy"),searchText:N([s.title,s.overview??"",s.endStateDescription??""],s),kind:"strategy"})),...x.map(s=>({value:j("habit",s.id),label:s.title,description:S(s.description,s.user,"Habit"),searchText:N([s.title,s.description??""],s),kind:"habit"})),...h.map(s=>({value:j("tag",s.id),label:s.name,description:S(s.description,s.user,s.kind??void 0),searchText:N([s.name,s.kind??"",s.description??""],s)})),..._.map(s=>({value:j("psyche_value",s.id),label:s.title,description:S(s.description,s.user,"Psyche value"),searchText:N([s.title,s.description,s.valuedDirection],s),kind:"value"})),...C.map(s=>({value:j("behavior",s.id),label:s.title,description:S(s.description,s.user,"Behavior"),searchText:N([s.title,s.description,s.kind],s),kind:"behavior"})),...ee.map(s=>({value:j("belief_entry",s.id),label:s.statement,description:S(s.flexibleAlternative||s.originNote,s.user,"Belief"),searchText:N([s.statement,s.flexibleAlternative,s.originNote],s),kind:"belief"})),...A.map(s=>({value:j("mode_profile",s.id),label:s.title,description:S(s.archetype||s.family,s.user,"Mode"),searchText:N([s.title,s.archetype,s.family,s.persona],s),kind:"mode"}))]].sort((s,te)=>s.label.localeCompare(te.label))}function ws(n){return n.note.links.filter(r=>r.entityType!=="behavior_pattern"&&r.entityType!=="trigger_report").slice(0,2).map(r=>e.jsx(f,{className:K,children:rt(r.entityType)},`${n.note.id}-${r.entityType}-${r.entityId}`))}function Bs(){var Oe,_e,Ee,Me,Fe,Le,$e,Pe,De;const n=It(),r=Ot(),i=_t(),o=Array.isArray(i.selectedUserIds)?i.selectedUserIds:[],x=Zt(o),[h,_]=m.useState(()=>Ye()),[C,ee]=m.useState([]),[A,he]=m.useState(X),[s,te]=m.useState(""),[L,xe]=m.useState(!1),[D,lt]=m.useState(!0),[R,dt]=m.useState(!0),[y,ct]=m.useState("informative"),[se,ut]=m.useState("markdown"),[mt,E]=m.useState(!1),[u,b]=m.useState({...q,tags:z(),userId:x}),[pt,re]=m.useState(null),be=m.useMemo(()=>de(h,7),[h]),ne=m.useMemo(()=>Gt(h),[h]),fe=m.useMemo(()=>Array.from({length:24},(t,a)=>a),[]),k=M({queryKey:["forge-psyche-self-observation-calendar",h.toISOString(),...o],queryFn:()=>Bt({from:h.toISOString(),to:be.toISOString(),userIds:o})}),ye=M({queryKey:["forge-psyche-values",...o],queryFn:()=>Kt(o)}),we=M({queryKey:["forge-psyche-patterns",...o],queryFn:()=>qt(o)}),je=M({queryKey:["forge-psyche-behaviors",...o],queryFn:()=>zt(o)}),ke=M({queryKey:["forge-psyche-beliefs",...o],queryFn:()=>Ut(o)}),Ne=M({queryKey:["forge-psyche-modes",...o],queryFn:()=>Ht(o)}),Se=M({queryKey:["forge-psyche-reports",...o],queryFn:()=>Vt(o)}),Te=W({mutationFn:()=>Pt({from:h.toISOString(),to:be.toISOString(),userIds:o,tags:F(A===X?C:[...C,A]),includeObservations:D,includeActivity:R,onlyHumanOwned:L,search:s.trim(),format:se}),onSuccess:t=>{gs(t.blob,t.fileName??`forge-self-observation.${se}`)}}),H=W({mutationFn:async t=>{const a=ze(t.observedAtInput)??new Date().toISOString(),d=is([...t.linkedEntityValues.map(l=>ns(l)).filter(as).map(l=>({entityType:l.entityType,entityId:l.entityId,anchorKey:null})),...t.linkedPatternIds.map(l=>({entityType:"behavior_pattern",entityId:l,anchorKey:null})),...t.linkedTriggerReportId?[{entityType:"trigger_report",entityId:t.linkedTriggerReportId,anchorKey:null}]:[]]);return t.noteId?Qe(t.noteId,{contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null,tags:F(t.tags),userId:t.userId,frontmatter:{observedAt:a},links:d}):Dt({contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null,tags:F(t.tags),userId:t.userId,frontmatter:{observedAt:a},links:d})},onSuccess:async()=>{E(!1),b({...q,tags:z(),userId:x}),await Promise.all([r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]}),Ve(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),vt=W({mutationFn:async({noteId:t,frontmatter:a})=>Qe(t,{frontmatter:a}),onSuccess:async()=>{await r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]})}}),ae=W({mutationFn:t=>Rt(t),onSuccess:async(t,a)=>{u.noteId===a&&(E(!1),b({...q,tags:z(),userId:x})),await Promise.all([r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]}),Ve(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),V=m.useMemo(()=>{var t;return F([nt,ts,...((t=k.data)==null?void 0:t.calendar.availableTags)??[]])},[(Oe=k.data)==null?void 0:Oe.calendar.availableTags]),gt=m.useMemo(()=>{var t;return bs(((t=we.data)==null?void 0:t.patterns)??[])},[(_e=we.data)==null?void 0:_e.patterns]),ht=m.useMemo(()=>vs(V),[V]),xt=m.useMemo(()=>{var t;return fs(((t=Se.data)==null?void 0:t.reports)??[])},[(Ee=Se.data)==null?void 0:Ee.reports]),bt=m.useMemo(()=>{var t,a,d,l;return ys({goals:i.snapshot.goals,projects:i.snapshot.dashboard.projects,tasks:i.snapshot.tasks,strategies:i.snapshot.strategies,habits:i.snapshot.habits,tags:i.snapshot.tags,values:((t=ye.data)==null?void 0:t.values)??[],behaviors:((a=je.data)==null?void 0:a.behaviors)??[],beliefs:((d=ke.data)==null?void 0:d.beliefs)??[],modes:((l=Ne.data)==null?void 0:l.modes)??[]})},[(Me=je.data)==null?void 0:Me.behaviors,(Fe=ke.data)==null?void 0:Fe.beliefs,(Le=Ne.data)==null?void 0:Le.modes,i.snapshot.dashboard.projects,i.snapshot.goals,i.snapshot.habits,i.snapshot.strategies,i.snapshot.tags,i.snapshot.tasks,($e=ye.data)==null?void 0:$e.values]),ft=i.snapshot.users.filter(t=>o.includes(t.id)),yt=o.length===0?"All owners in scope":o.length===1?ge(ft[0]??null):`${o.length} owners selected`,O=m.useMemo(()=>{var d,l;const t=F(A===X?C:[...C,A]);return[...(((d=k.data)==null?void 0:d.calendar.observations)??[]).map(c=>({kind:"observation",id:c.note.id,observedAt:c.observedAt,tags:c.tags,observation:c})),...(((l=k.data)==null?void 0:l.calendar.activity)??[]).map(c=>({kind:"activity",id:c.id,observedAt:c.observedAt,tags:c.tags,activity:c}))].filter(c=>{var I;if(T(c)&&!D||!T(c)&&!R||L&&((I=ls(c))==null?void 0:I.kind)!=="human"||!cs(c.tags,t))return!1;const p=s.trim().toLowerCase();return!(p&&!ds(c).includes(p))}).sort((c,p)=>c.observedAt.localeCompare(p.observedAt))},[A,(Pe=k.data)==null?void 0:Pe.calendar.activity,(De=k.data)==null?void 0:De.calendar.observations,L,s,C,R,D]),wt=m.useMemo(()=>O.filter(T).length,[O]),jt=m.useMemo(()=>O.filter(t=>!T(t)).length,[O]),Ie=m.useMemo(()=>{const t=new Map;for(const a of O){const d=new Date(a.observedAt),l=`${G(d)}:${d.getHours()}`,c=t.get(l)??[];c.push(a),t.set(l,c)}for(const a of t.values())a.sort((d,l)=>d.observedAt.localeCompare(l.observedAt));return t},[O]),Ce=t=>{const a=y==="compact",d=y==="extended",l=ms(t,a?92:d?144:112),c=a?"":os(t.note,d?220:120),p=ps(t),I=d?4:2;return e.jsx("div",{draggable:!a,"data-self-observation-card":t.note.id,onDragStart:g=>{a||(re(t.note.id),g.dataTransfer.setData("text/forge-self-observation-id",t.note.id))},onDragEnd:()=>re(null),className:v("min-w-0 rounded-[8px] border p-3 text-[var(--ui-ink-strong)] transition",ot(t)?"border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] hover:bg-[color-mix(in_srgb,var(--info)_12%,var(--ui-surface-1)_88%)]":"border-[color-mix(in_srgb,var(--success)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-success-soft)] hover:bg-[color-mix(in_srgb,var(--success)_12%,var(--ui-surface-1)_88%)]",a&&"px-2.5 py-2"),children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>Nt(t),children:a?e.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[e.jsx("div",{className:"shrink-0 text-[11px] uppercase tracking-[0.16em] text-[color-mix(in_srgb,var(--success)_72%,var(--ui-ink-strong)_28%)]",children:J(t.observedAt)}),e.jsx(f,{className:v("shrink-0",me),children:p}),e.jsx("div",{className:"min-w-0 truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:l})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-start justify-between gap-2",children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-[color-mix(in_srgb,var(--success)_72%,var(--ui-ink-strong)_28%)]",children:J(t.observedAt)}),e.jsx(f,{className:me,children:p}),e.jsx(We,{user:t.note.user,compact:!0})]})}),e.jsx("div",{className:"mt-2 break-words text-sm font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:l}),e.jsx("div",{className:v("mt-1 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",d?"line-clamp-3":"line-clamp-1"),children:c}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[t.note.author?e.jsx(f,{className:K,children:t.note.author}):null,t.tags.slice(0,I).map(g=>e.jsx(f,{className:me,children:g},`${t.id}-${g}`)),ws(t),t.linkedPatterns.slice(0,d?2:1).map(g=>e.jsx(He,{kind:"pattern",label:g.title,compact:!0,gradient:!1},g.id)),t.linkedReports.slice(0,1).map(g=>e.jsx(He,{kind:"report",label:g.title,compact:!0,gradient:!1},g.id))]})]})}),a?null:e.jsx("button",{type:"button",className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-danger-soft)] hover:text-[color-mix(in_srgb,var(--danger)_74%,var(--ui-ink-strong)_26%)]","aria-label":`Delete observation ${t.note.id}`,onClick:g=>{g.stopPropagation(),ae.mutateAsync(t.note.id)},children:e.jsx(Be,{className:"size-3.5"})})]})},t.id)},Ae=t=>{const a=y==="compact",d=y==="extended",l=Jt(t.event),c=Xt(t.event),p=U(t.event.title||"Forge activity",a?92:d?144:112),I=a?"":us(t.event,d?220:120),g=d?4:2;return e.jsx("div",{role:a&&l?"button":void 0,tabIndex:a&&l?0:void 0,className:v("min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3 text-[var(--ui-ink-medium)]",a&&"px-2.5 py-2",a&&l&&"cursor-pointer"),onClick:a&&l?()=>n(l):void 0,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("div",{className:"min-w-0 flex-1",children:a?e.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[e.jsx("div",{className:v("shrink-0 text-[11px] uppercase tracking-[0.16em]",ue),children:J(t.observedAt)}),e.jsx(f,{className:v("shrink-0",pe),children:st(t)}),e.jsx("div",{className:"min-w-0 truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:p})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:v("text-xs uppercase tracking-[0.16em]",ue),children:J(t.observedAt)}),e.jsx(f,{className:pe,children:st(t)}),e.jsx(We,{user:t.event.user,compact:!0})]}),e.jsx("div",{className:"mt-2 break-words text-sm font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:p}),t.event.description?e.jsx("div",{className:v("mt-1 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",d?"line-clamp-3":"line-clamp-1"),children:I}):null,e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:t.tags.slice(0,g).map(B=>e.jsx(f,{className:K,children:B},`${t.id}-${B}`))})]})}),!a&&l&&c?e.jsxs(w,{size:"sm",variant:"secondary",onClick:()=>n(l),className:"shrink-0",children:[e.jsx(Ke,{className:"size-4"}),c]}):null]})},t.id)},kt=t=>{b({...q,userId:x,tags:z(),observedAtInput:t?it(t.toISOString()):""})},$=(t,a)=>{const d=new Date(t);d.setHours(a,0,0,0),kt(d),E(!0)},Nt=t=>{b(xs(t,x)),E(!0)},St=async(t,a,d)=>{await vt.mutateAsync({noteId:t.note.id,frontmatter:{...t.note.frontmatter,observedAt:hs(t.observedAt,a,d)}})},Tt=async()=>{const t=await H.mutateAsync(u),a=new URLSearchParams;a.set("create","1"),a.set("sourceObservationNoteId",t.note.id),t.note.userId&&a.set("userId",t.note.userId),n(`/psyche/patterns?${a.toString()}`)};return k.isLoading?e.jsx(Et,{}):k.isError?e.jsx(Mt,{eyebrow:"Self Observation",error:k.error,onRetry:()=>void k.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Qt,{title:"Self Observation",titleText:"Self Observation",description:"Map handwritten reflections and lower-priority Forge activity onto the real week by hour, so the calendar shows both what you noticed and what the system recorded you doing.",badge:`${O.length} visible this week`,actions:e.jsxs(w,{onClick:()=>$(new Date,new Date().getHours()),children:[e.jsx(Q,{className:"size-4"}),"Add observation"]})}),e.jsx(Ft,{}),e.jsxs(Ue,{className:v("grid gap-4 p-5",Xe),children:[e.jsx(Wt,{eyebrow:"Observation week",description:"True self-observation stays primary. Forge activity sits underneath it as supporting context, so you can review the week as lived evidence and export exactly the slice you want to share.",weekStart:h,badges:e.jsxs(e.Fragment,{children:[e.jsx(f,{className:K,children:yt}),e.jsxs(f,{className:"max-w-full border border-[color-mix(in_srgb,var(--success)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[wt," observations"]}),e.jsxs(f,{className:pe,children:[jt," activity"]}),e.jsx(f,{className:K,children:L?"Human-owned only":"All owners"})]}),onPrevious:()=>_(de(h,-7)),onCurrent:()=>_(Ye()),onNext:()=>_(de(h,7))}),e.jsxs("div",{className:"grid min-w-0 max-w-full gap-4 xl:grid-cols-[minmax(0,1.4fr)_minmax(18rem,0.8fr)]",children:[e.jsxs("div",{className:v("grid min-w-0 w-full max-w-[calc(100vw-4rem)] box-border gap-3 p-4 sm:max-w-full",Y),children:[e.jsxs("div",{children:[e.jsx("div",{className:ce,children:"Filter timeline"}),e.jsx("div",{className:v("mt-1 break-words text-sm [overflow-wrap:anywhere]",Ze),children:"Search the week, focus a specific entity kind, switch density, and narrow the timeline before you review it."})]}),e.jsxs("div",{className:"grid min-w-0 max-w-full gap-3 lg:grid-cols-[minmax(0,1.1fr)_minmax(15rem,0.8fr)_minmax(15rem,0.8fr)]",children:[e.jsx(oe,{value:s,onChange:t=>te(t.target.value),placeholder:"Search notes, authors, activity, or entity labels"}),e.jsx(le,{label:"Entity kind",value:A,options:ht,onChange:he}),e.jsx(le,{label:"Entry view",value:y,options:ss,onChange:ct})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:ce,children:"Extra tags"}),e.jsx("div",{className:v("break-words text-xs [overflow-wrap:anywhere]",ue),children:"Add narrower filters like `focus`, `Forge activity`, or `Source · UI`."}),e.jsx(qe,{value:C,onChange:ee,availableTags:V,placeholder:"Filter by tag"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(w,{variant:D?"primary":"ghost",onClick:()=>lt(t=>!t),children:D?"Hide observations":"Show observations"}),e.jsx(w,{variant:R?"secondary":"ghost",onClick:()=>dt(t=>!t),children:R?"Hide Forge activity":"Show Forge activity"}),e.jsx(w,{variant:L?"secondary":"primary",onClick:()=>xe(!1),children:"All owners"}),e.jsx(w,{variant:L?"primary":"ghost",onClick:()=>xe(!0),children:"Human only"})]})]}),e.jsxs("div",{className:v("grid min-w-0 w-full max-w-[calc(100vw-4rem)] box-border gap-3 p-4 sm:max-w-full",Y),children:[e.jsxs("div",{className:"min-w-0 max-w-full",children:[e.jsx("div",{className:ce,children:"Export week"}),e.jsx("div",{className:v("mt-1 break-words text-sm [overflow-wrap:anywhere]",Ze),children:"Export respects the current search, entity, tag, owner, and observation/activity filters."})]}),e.jsx(le,{label:"Export format",value:se,options:rs,onChange:ut}),e.jsxs(w,{variant:"secondary",pending:Te.isPending,pendingLabel:"Exporting",onClick:()=>void Te.mutateAsync(),children:[e.jsx(Ct,{className:"size-4"}),"Export week"]})]})]})]}),e.jsxs(Ue,{className:v("min-w-0 overflow-hidden p-0",Xe),children:[e.jsx("div",{className:"hidden overflow-x-auto lg:block",children:e.jsxs("div",{className:"min-w-[76rem]",children:[e.jsxs("div",{className:"grid grid-cols-[5rem_repeat(7,minmax(10rem,1fr))] border-b border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",children:[e.jsx("div",{className:"border-r border-[var(--ui-border-subtle)] px-3 py-4 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Hour"}),ne.map(t=>e.jsxs("div",{className:"border-r border-[var(--ui-border-subtle)] px-3 py-4 last:border-r-0",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--ui-ink-strong)]",children:Ge(t)}),e.jsx("div",{className:"mt-1 text-xs text-[var(--ui-ink-faint)]",children:G(t)})]},t.toISOString()))]}),fe.map(t=>e.jsxs("div",{className:"grid grid-cols-[5rem_repeat(7,minmax(10rem,1fr))] border-b border-[var(--ui-border-subtle)] last:border-b-0",children:[e.jsx("div",{className:"border-r border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-4 text-sm text-[var(--ui-ink-soft)]",children:Je(t)}),ne.map(a=>{const l=`${G(a)}:${t}`,c=Ie.get(l)??[];return e.jsx("div",{"data-self-observation-slot":l,className:v("border-r border-[var(--ui-border-subtle)] px-2 py-2 last:border-r-0",y==="compact"?"min-h-[4.25rem]":y==="extended"?"min-h-[7rem]":"min-h-[5.5rem]"),onDragOver:p=>p.preventDefault(),onDrop:p=>{p.preventDefault();const I=p.dataTransfer.getData("text/forge-self-observation-id")||pt;if(!I)return;const g=O.find(B=>T(B)&&B.observation.note.id===I);!g||!T(g)||(St(g.observation,a,t),re(null))},children:e.jsxs("div",{className:"grid gap-2",children:[c.length>0?e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{type:"button",className:et,onClick:()=>$(a,t),children:[e.jsx(Q,{className:"size-3.5"}),"Add"]})}):null,c.map(p=>T(p)?Ce(p.observation):Ae(p.activity)),c.length===0?e.jsx("button",{type:"button",className:v(tt,y==="compact"?"px-3 py-2":"px-3 py-4"),onClick:()=>$(a,t),children:y==="compact"?"Add":"Add observation"}):null]})},l)})]},t))]})}),e.jsx("div",{className:"grid gap-4 p-4 lg:hidden",children:ne.map(t=>{const a=G(t);return e.jsxs("div",{className:v("p-3",Y),children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3 rounded-[8px] bg-[var(--ui-surface-2)] px-3 py-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:Ge(t)}),e.jsx("div",{className:"mt-1 text-xs text-[var(--ui-ink-faint)]",children:a})]}),e.jsxs(w,{size:"sm",variant:"secondary",onClick:()=>$(t,new Date().getHours()),children:[e.jsx(Q,{className:"size-4"}),"Add"]})]}),e.jsx("div",{className:"mt-3 grid gap-2",children:fe.map(d=>{const l=`${a}:${d}`,c=Ie.get(l)??[];return e.jsxs("div",{"data-self-observation-slot-mobile":l,className:"min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:Je(d)}),e.jsxs("button",{type:"button",className:et,onClick:()=>$(t,d),children:[e.jsx(Q,{className:"size-3.5"}),"Add"]})]}),e.jsx("div",{className:"mt-2 grid gap-2",children:c.length===0?e.jsx("button",{type:"button",className:v(tt,y==="compact"?"px-3 py-2":"px-3 py-3"),onClick:()=>$(t,d),children:y==="compact"?"Add":"Add observation"}):c.map(p=>T(p)?Ce(p.observation):Ae(p.activity))})]},l)})})]},a)})})]}),e.jsx(Lt,{open:mt,onOpenChange:E,eyebrow:"Self Observation",title:u.noteId?"Edit observation":"Add observation",description:"Capture the note, set the exact observation time, then attach the pattern, trigger report, and any other Forge records that belong to that moment.",children:e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsx(Yt,{value:u.userId,users:i.snapshot.users,onChange:t=>b(a=>({...a,userId:t})),defaultLabel:es(i.snapshot.users.find(t=>t.id===x)??null,"Choose observation owner"),help:"Observation notes stay multi-user aware just like the rest of Forge."}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:P,children:"Author"}),e.jsx(oe,{value:u.author,onChange:t=>b(a=>({...a,author:t.target.value})),placeholder:"Albert"})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:P,children:"Observed at"}),e.jsx(oe,{type:"datetime-local",value:u.observedAtInput,onChange:t=>b(a=>({...a,observedAtInput:t.target.value}))})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:P,children:"Observation note"}),e.jsx($t,{value:u.contentMarkdown,onChange:t=>b(a=>({...a,contentMarkdown:t.target.value})),className:"min-h-[14rem]",placeholder:"What happened in this hour, what did you notice, and what mattered?"})]}),e.jsx(qe,{value:u.tags,onChange:t=>b(a=>({...a,tags:t})),availableTags:V,placeholder:"Add note tags for the observation"}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:P,children:"Linked patterns"}),e.jsxs("button",{type:"button",className:ve,onClick:()=>void Tt(),disabled:H.isPending||u.contentMarkdown.trim().length===0,children:[e.jsx(Re,{className:"size-3.5"}),"Create pattern from observation"]})]}),e.jsx(ie,{options:gt,selectedValues:u.linkedPatternIds,onChange:t=>b(a=>({...a,linkedPatternIds:t})),placeholder:"Search patterns in scope",emptyMessage:"No patterns in scope yet."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:P,children:"Trigger report"}),e.jsxs("button",{type:"button",className:ve,onClick:()=>{const t=new URLSearchParams;t.set("create","1"),u.observedAtInput&&t.set("occurredAt",ze(u.observedAtInput)??new Date().toISOString()),u.userId&&t.set("userId",u.userId),n(`/psyche/reports?${t.toString()}`),E(!1)},children:[e.jsx(Re,{className:"size-3.5"}),"Create report from time"]})]}),e.jsx(ie,{options:xt,selectedValues:u.linkedTriggerReportId?[u.linkedTriggerReportId]:[],onChange:t=>b(a=>({...a,linkedTriggerReportId:t.at(-1)??null})),placeholder:"Search trigger reports in scope",emptyMessage:"No trigger reports in scope yet."})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:P,children:"Linked records"}),e.jsx(ie,{options:bt,selectedValues:u.linkedEntityValues,onChange:t=>b(a=>({...a,linkedEntityValues:t})),placeholder:"Link goals, projects, tasks, values, beliefs, modes, or other Forge records",emptyMessage:"No linked records in scope yet."})]}),e.jsxs("div",{className:v("px-4 py-4",Y),children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 break-words text-sm text-[var(--ui-ink-medium)] [overflow-wrap:anywhere]",children:[e.jsx(At,{className:"size-4 text-[var(--tertiary)]"}),"Cards appear in the hourly week grid at the exact observation time, whether they came from deliberate reflection or rolling movement sync."]}),e.jsx("div",{className:"mt-2 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:"Move them later by drag-and-drop, edit the timestamp directly here, or delete them from the card itself when the observation should not stay on the calendar."})]}),e.jsxs("div",{className:"flex flex-wrap justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.noteId?e.jsxs(w,{variant:"secondary",pending:ae.isPending,pendingLabel:"Deleting",onClick:()=>u.noteId?void ae.mutateAsync(u.noteId):void 0,children:[e.jsx(Be,{className:"size-4"}),"Delete observation"]}):null,u.linkedTriggerReportId?e.jsxs("button",{type:"button",className:v(ve,"py-2 text-sm"),onClick:()=>n(`/psyche/reports/${u.linkedTriggerReportId}`),children:[e.jsx(Ke,{className:"size-4"}),"Open linked report"]}):null]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(w,{variant:"secondary",onClick:()=>E(!1),children:"Cancel"}),e.jsx(w,{pending:H.isPending,pendingLabel:"Saving",disabled:u.contentMarkdown.trim().length===0,onClick:()=>void H.mutateAsync(u),children:"Save observation"})]})]})]})})]})}export{Bs as PsycheSelfObservationPage};
1
+ import{b7 as It,r as m,j as e,bY as Q,aD as Ct,aG as Re,aT as At,c1 as Be,b4 as Ke}from"./vendor-Dgw7UY7q.js";import{j as Ot,i as M,k as W}from"./state-CkEUXgqt.js";import{E as ie}from"./entity-link-multiselect-HmmmJO5A.js";import{n as L,N as qe,p as ze}from"./note-tags-input-Hvi_ifLe.js";import{d as _t,S as Et,e as Mt,B as w,bD as Lt,C as He,j as f,c as v,I as oe,aL as Ft,T as $t,cH as Pt,b as Ue,i as Ve,bd as Qe,al as Dt,bc as Rt,ba as rt,cI as Bt,be as Kt,bf as qt,bg as zt,bh as Ht,bi as Ut,bk as Vt}from"./index-C0CztQTU.js";import{P as Qt}from"./page-hero-ED69y6m0.js";import{C as Wt}from"./calendar-week-toolbar-DWTObcj1.js";import{S as le}from"./select-menu-BDeaaa4m.js";import{U as We}from"./user-badge-BWoSrGA-.js";import{U as Yt}from"./user-select-field-DbB9v7Lf.js";import{s as Ye,b as de,c as Gt,f as Ge,d as Xe}from"./calendar-ui-Cy1XRwzV.js";import{g as Xt,a as Jt}from"./entity-links-DwpxhW2H.js";import{g as Zt,f as ge,a as es,b as N,d as S}from"./user-ownership-DJGl4rAj.js";import"./use-anchored-overlay-position-C2kg0Ay0.js";import"./motion-eRlWWQT8.js";import"./ui-CDt36qNz.js";import"./board-Dl7As76Q.js";import"./forms-DznAv9hZ.js";const nt="Self-observation",ts="Forge activity",Z="Entity · ",J="all",ss=[{value:"compact",label:"Compact",description:"One row per entry: time, entity, title."},{value:"informative",label:"Informative",description:"Adds one short preview line and key context."},{value:"extended",label:"Extended",description:"Adds a little more context with a hard text cap."}],rs=[{value:"markdown",label:"Markdown brief",description:"Readable weekly notes for sharing with a therapist."},{value:"csv",label:"CSV table",description:"Structured rows for spreadsheet review."},{value:"json",label:"JSON archive",description:"Full structured payload with filters and metadata."},{value:"ics",label:"Calendar file",description:"Importable weekly timeline in calendar apps."}],Je="box-border min-w-0 max-w-full overflow-hidden rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)]",Y="box-border min-w-0 max-w-full overflow-hidden rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",ce="text-[11px] font-medium uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",P="text-sm font-medium text-[var(--ui-ink-strong)]",Ze="text-[var(--ui-ink-soft)]",ue="text-[var(--ui-ink-faint)]",K="max-w-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",me="max-w-full border border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_74%,var(--ui-ink-strong)_26%)]",pe="max-w-full border border-[color-mix(in_srgb,var(--warning)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_74%,var(--ui-ink-strong)_26%)]",ve="inline-flex max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-1.5 text-xs text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",et="inline-flex max-w-full items-center gap-1 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2 py-1 text-[11px] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",tt="min-w-0 rounded-[8px] border border-dashed border-[var(--ui-border-subtle)] text-left text-sm text-[var(--ui-ink-faint)] transition hover:border-[var(--ui-border-strong)] hover:text-[var(--ui-ink-medium)]",at=new Set(["goal","project","task","strategy","habit","tag","psyche_value","behavior","belief_entry","mode_profile"]),q={noteId:null,contentMarkdown:"",author:"",tags:[],userId:null,observedAtInput:"",linkedPatternIds:[],linkedTriggerReportId:null,linkedEntityValues:[]};function z(n=[]){return L([nt,...n])}function j(n,r){return`${n}:${r}`}function ns(n){const r=n.indexOf(":");if(r<=0||r>=n.length-1)return null;const i=n.slice(0,r);return at.has(i)?{entityType:i,entityId:n.slice(r+1)}:null}function as(n){return n!==null}function is(n){const r=new Set;return n.filter(i=>{const o=`${i.entityType}:${i.entityId}:${i.anchorKey??""}`;return r.has(o)?!1:(r.add(o),!0)})}function it(n){const r=new Date(n);if(Number.isNaN(r.getTime()))return"";const i=r.getFullYear(),o=String(r.getMonth()+1).padStart(2,"0"),x=String(r.getDate()).padStart(2,"0"),h=String(r.getHours()).padStart(2,"0"),_=String(r.getMinutes()).padStart(2,"0");return`${i}-${o}-${x}T${h}:${_}`}function G(n){const r=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0");return`${r}-${i}-${o}`}function X(n){return new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function H(n,r){const i=n.replace(/\s+/g," ").trim();return i.length<=r?i:`${i.slice(0,Math.max(0,r-3)).trimEnd()}...`}function os(n,r=120){return H(n.contentPlain||n.contentMarkdown,r)}function ot(n){const r=n.note.frontmatter.movement;return!!r&&typeof r=="object"&&!Array.isArray(r)}function T(n){return n.kind==="observation"}function ls(n){return T(n)?n.observation.note.user:n.activity.event.user}function ds(n){if(T(n)){const i=n.observation;return[i.note.contentPlain,i.note.contentMarkdown,i.note.author??"",i.tags.join(" "),i.linkedPatterns.map(o=>o.title).join(" "),i.linkedReports.map(o=>o.title).join(" ")].join(" ").toLowerCase()}const r=n.activity.event;return[r.title,r.description,r.actor??"",r.eventType,r.entityType,n.tags.join(" ")].join(" ").toLowerCase()}function cs(n,r){if(r.length===0)return!0;const i=new Set(n.map(o=>o.toLowerCase()));return r.some(o=>i.has(o.toLowerCase()))}function us(n,r=160){const i=[n.title,n.description].filter(Boolean).join(". ");return H(i,r)}function ms(n,r){const i=n.note.contentPlain||n.note.contentMarkdown;return H(i||"Observation",r)}function ps(n){if(ot(n))return"Movement";const r=n.note.links.find(i=>i.entityType!=="behavior_pattern"&&i.entityType!=="trigger_report");return r?rt(r.entityType):n.linkedPatterns.length>0?"Pattern":n.linkedReports.length>0?"Trigger report":"Observation"}function st(n){const r=n.tags.find(i=>i.startsWith(Z));return r?r.replace(`${Z}`,""):H(n.event.entityType||"Activity",32)}function vs(n){const r=n.filter(i=>i.startsWith(Z)).sort((i,o)=>i.localeCompare(o));return[{value:J,label:"All entities",description:"Show every entity kind across the week."},...r.map(i=>({value:i,label:i.replace(`${Z}`,""),description:`Only entries tagged ${i}.`}))]}function gs(n,r){const i=URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=r,o.click(),URL.revokeObjectURL(i)}function hs(n,r,i){const o=new Date(n),x=new Date(r);return x.setHours(i,Number.isNaN(o.getTime())?0:o.getMinutes(),0,0),x.toISOString()}function xs(n,r){var i;return n?{noteId:n.note.id,contentMarkdown:n.note.contentMarkdown,author:n.note.author??"",tags:L(n.note.tags??[]),userId:n.note.userId??r,observedAtInput:it(n.observedAt),linkedPatternIds:n.linkedPatterns.map(o=>o.id),linkedTriggerReportId:((i=n.linkedReports[0])==null?void 0:i.id)??null,linkedEntityValues:n.note.links.filter(o=>o.entityType!=="behavior_pattern"&&o.entityType!=="trigger_report"&&at.has(o.entityType)).map(o=>j(o.entityType,o.entityId))}:{...q,tags:z(),userId:r}}function bs(n){return n.map(r=>({value:r.id,label:r.title,description:`${r.targetBehavior||r.preferredResponse||"Pattern"}${r.user?` · ${ge(r.user)}`:""}`,searchText:`${r.title} ${r.targetBehavior} ${r.description} ${r.preferredResponse}`.toLowerCase(),kind:"pattern"}))}function fs(n){return n.map(r=>({value:r.id,label:r.title,description:`${r.customEventType||r.eventSituation||"Trigger report"}${r.user?` · ${ge(r.user)}`:""}`,searchText:`${r.title} ${r.customEventType} ${r.eventSituation}`.toLowerCase(),kind:"report"}))}function ys({goals:n,projects:r,tasks:i,strategies:o,habits:x,tags:h,values:_,behaviors:C,beliefs:ee,modes:A}){return[...[...n.map(s=>({value:j("goal",s.id),label:s.title,description:S(s.description,s.user,"Goal"),searchText:N([s.title,s.description??""],s),kind:"goal"})),...r.map(s=>({value:j("project",s.id),label:s.title,description:S(s.description,s.user,"Project"),searchText:N([s.title,s.description??""],s),kind:"project"})),...i.map(s=>({value:j("task",s.id),label:s.title,description:S(s.description,s.user,s.owner??void 0),searchText:N([s.title,s.description??"",s.owner??""],s),kind:"task"})),...o.map(s=>({value:j("strategy",s.id),label:s.title,description:S(s.overview,s.user,"Strategy"),searchText:N([s.title,s.overview??"",s.endStateDescription??""],s),kind:"strategy"})),...x.map(s=>({value:j("habit",s.id),label:s.title,description:S(s.description,s.user,"Habit"),searchText:N([s.title,s.description??""],s),kind:"habit"})),...h.map(s=>({value:j("tag",s.id),label:s.name,description:S(s.description,s.user,s.kind??void 0),searchText:N([s.name,s.kind??"",s.description??""],s)})),..._.map(s=>({value:j("psyche_value",s.id),label:s.title,description:S(s.description,s.user,"Psyche value"),searchText:N([s.title,s.description,s.valuedDirection],s),kind:"value"})),...C.map(s=>({value:j("behavior",s.id),label:s.title,description:S(s.description,s.user,"Behavior"),searchText:N([s.title,s.description,s.kind],s),kind:"behavior"})),...ee.map(s=>({value:j("belief_entry",s.id),label:s.statement,description:S(s.flexibleAlternative||s.originNote,s.user,"Belief"),searchText:N([s.statement,s.flexibleAlternative,s.originNote],s),kind:"belief"})),...A.map(s=>({value:j("mode_profile",s.id),label:s.title,description:S(s.archetype||s.family,s.user,"Mode"),searchText:N([s.title,s.archetype,s.family,s.persona],s),kind:"mode"}))]].sort((s,te)=>s.label.localeCompare(te.label))}function ws(n){return n.note.links.filter(r=>r.entityType!=="behavior_pattern"&&r.entityType!=="trigger_report").slice(0,2).map(r=>e.jsx(f,{className:K,children:rt(r.entityType)},`${n.note.id}-${r.entityType}-${r.entityId}`))}function Bs(){var Oe,_e,Ee,Me,Le,Fe,$e,Pe,De;const n=It(),r=Ot(),i=_t(),o=Array.isArray(i.selectedUserIds)?i.selectedUserIds:[],x=Zt(o),[h,_]=m.useState(()=>Ye()),[C,ee]=m.useState([]),[A,he]=m.useState(J),[s,te]=m.useState(""),[F,xe]=m.useState(!1),[D,lt]=m.useState(!0),[R,dt]=m.useState(!0),[y,ct]=m.useState("informative"),[se,ut]=m.useState("markdown"),[mt,E]=m.useState(!1),[u,b]=m.useState({...q,tags:z(),userId:x}),[pt,re]=m.useState(null),be=m.useMemo(()=>de(h,7),[h]),ne=m.useMemo(()=>Gt(h),[h]),fe=m.useMemo(()=>Array.from({length:24},(t,a)=>a),[]),k=M({queryKey:["forge-psyche-self-observation-calendar",h.toISOString(),...o],queryFn:()=>Bt({from:h.toISOString(),to:be.toISOString(),userIds:o})}),ye=M({queryKey:["forge-psyche-values",...o],queryFn:()=>Kt(o)}),we=M({queryKey:["forge-psyche-patterns",...o],queryFn:()=>qt(o)}),je=M({queryKey:["forge-psyche-behaviors",...o],queryFn:()=>zt(o)}),ke=M({queryKey:["forge-psyche-beliefs",...o],queryFn:()=>Ht(o)}),Ne=M({queryKey:["forge-psyche-modes",...o],queryFn:()=>Ut(o)}),Se=M({queryKey:["forge-psyche-reports",...o],queryFn:()=>Vt(o)}),Te=W({mutationFn:()=>Pt({from:h.toISOString(),to:be.toISOString(),userIds:o,tags:L(A===J?C:[...C,A]),includeObservations:D,includeActivity:R,onlyHumanOwned:F,search:s.trim(),format:se}),onSuccess:t=>{gs(t.blob,t.fileName??`forge-self-observation.${se}`)}}),U=W({mutationFn:async t=>{const a=ze(t.observedAtInput)??new Date().toISOString(),d=is([...t.linkedEntityValues.map(l=>ns(l)).filter(as).map(l=>({entityType:l.entityType,entityId:l.entityId,anchorKey:null})),...t.linkedPatternIds.map(l=>({entityType:"behavior_pattern",entityId:l,anchorKey:null})),...t.linkedTriggerReportId?[{entityType:"trigger_report",entityId:t.linkedTriggerReportId,anchorKey:null}]:[]]);return t.noteId?Qe(t.noteId,{contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null,tags:L(t.tags),userId:t.userId,frontmatter:{observedAt:a},links:d}):Dt({contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null,tags:L(t.tags),userId:t.userId,frontmatter:{observedAt:a},links:d})},onSuccess:async()=>{E(!1),b({...q,tags:z(),userId:x}),await Promise.all([r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]}),Ve(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),vt=W({mutationFn:async({noteId:t,frontmatter:a})=>Qe(t,{frontmatter:a}),onSuccess:async()=>{await r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]})}}),ae=W({mutationFn:t=>Rt(t),onSuccess:async(t,a)=>{u.noteId===a&&(E(!1),b({...q,tags:z(),userId:x})),await Promise.all([r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]}),Ve(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),V=m.useMemo(()=>{var t;return L([nt,ts,...((t=k.data)==null?void 0:t.calendar.availableTags)??[]])},[(Oe=k.data)==null?void 0:Oe.calendar.availableTags]),gt=m.useMemo(()=>{var t;return bs(((t=we.data)==null?void 0:t.patterns)??[])},[(_e=we.data)==null?void 0:_e.patterns]),ht=m.useMemo(()=>vs(V),[V]),xt=m.useMemo(()=>{var t;return fs(((t=Se.data)==null?void 0:t.reports)??[])},[(Ee=Se.data)==null?void 0:Ee.reports]),bt=m.useMemo(()=>{var t,a,d,l;return ys({goals:i.snapshot.goals,projects:i.snapshot.dashboard.projects,tasks:i.snapshot.tasks,strategies:i.snapshot.strategies,habits:i.snapshot.habits,tags:i.snapshot.tags,values:((t=ye.data)==null?void 0:t.values)??[],behaviors:((a=je.data)==null?void 0:a.behaviors)??[],beliefs:((d=ke.data)==null?void 0:d.beliefs)??[],modes:((l=Ne.data)==null?void 0:l.modes)??[]})},[(Me=je.data)==null?void 0:Me.behaviors,(Le=ke.data)==null?void 0:Le.beliefs,(Fe=Ne.data)==null?void 0:Fe.modes,i.snapshot.dashboard.projects,i.snapshot.goals,i.snapshot.habits,i.snapshot.strategies,i.snapshot.tags,i.snapshot.tasks,($e=ye.data)==null?void 0:$e.values]),ft=i.snapshot.users.filter(t=>o.includes(t.id)),yt=o.length===0?"All owners in scope":o.length===1?ge(ft[0]??null):`${o.length} owners selected`,O=m.useMemo(()=>{var d,l;const t=L(A===J?C:[...C,A]);return[...(((d=k.data)==null?void 0:d.calendar.observations)??[]).map(c=>({kind:"observation",id:c.note.id,observedAt:c.observedAt,tags:c.tags,observation:c})),...(((l=k.data)==null?void 0:l.calendar.activity)??[]).map(c=>({kind:"activity",id:c.id,observedAt:c.observedAt,tags:c.tags,activity:c}))].filter(c=>{var I;if(T(c)&&!D||!T(c)&&!R||F&&((I=ls(c))==null?void 0:I.kind)!=="human"||!cs(c.tags,t))return!1;const p=s.trim().toLowerCase();return!(p&&!ds(c).includes(p))}).sort((c,p)=>c.observedAt.localeCompare(p.observedAt))},[A,(Pe=k.data)==null?void 0:Pe.calendar.activity,(De=k.data)==null?void 0:De.calendar.observations,F,s,C,R,D]),wt=m.useMemo(()=>O.filter(T).length,[O]),jt=m.useMemo(()=>O.filter(t=>!T(t)).length,[O]),Ie=m.useMemo(()=>{const t=new Map;for(const a of O){const d=new Date(a.observedAt),l=`${G(d)}:${d.getHours()}`,c=t.get(l)??[];c.push(a),t.set(l,c)}for(const a of t.values())a.sort((d,l)=>d.observedAt.localeCompare(l.observedAt));return t},[O]),Ce=t=>{const a=y==="compact",d=y==="extended",l=ms(t,a?92:d?144:112),c=a?"":os(t.note,d?220:120),p=ps(t),I=d?4:2;return e.jsx("div",{draggable:!a,"data-self-observation-card":t.note.id,onDragStart:g=>{a||(re(t.note.id),g.dataTransfer.setData("text/forge-self-observation-id",t.note.id))},onDragEnd:()=>re(null),className:v("min-w-0 rounded-[8px] border p-3 text-[var(--ui-ink-strong)] transition",ot(t)?"border-[color-mix(in_srgb,var(--info)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-info-soft)] hover:bg-[color-mix(in_srgb,var(--info)_12%,var(--ui-surface-1)_88%)]":"border-[color-mix(in_srgb,var(--success)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-success-soft)] hover:bg-[color-mix(in_srgb,var(--success)_12%,var(--ui-surface-1)_88%)]",a&&"px-2.5 py-2"),children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>Nt(t),children:a?e.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[e.jsx("div",{className:"shrink-0 text-[11px] uppercase tracking-[0.16em] text-[color-mix(in_srgb,var(--success)_72%,var(--ui-ink-strong)_28%)]",children:X(t.observedAt)}),e.jsx(f,{className:v("shrink-0",me),children:p}),e.jsx("div",{className:"min-w-0 truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:l})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-start justify-between gap-2",children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-[color-mix(in_srgb,var(--success)_72%,var(--ui-ink-strong)_28%)]",children:X(t.observedAt)}),e.jsx(f,{className:me,children:p}),e.jsx(We,{user:t.note.user,compact:!0})]})}),e.jsx("div",{className:"mt-2 break-words text-sm font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:l}),e.jsx("div",{className:v("mt-1 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",d?"line-clamp-3":"line-clamp-1"),children:c}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[t.note.author?e.jsx(f,{className:K,children:t.note.author}):null,t.tags.slice(0,I).map(g=>e.jsx(f,{className:me,children:g},`${t.id}-${g}`)),ws(t),t.linkedPatterns.slice(0,d?2:1).map(g=>e.jsx(Ue,{kind:"pattern",label:g.title,compact:!0,gradient:!1},g.id)),t.linkedReports.slice(0,1).map(g=>e.jsx(Ue,{kind:"report",label:g.title,compact:!0,gradient:!1},g.id))]})]})}),a?null:e.jsx("button",{type:"button",className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-danger-soft)] hover:text-[color-mix(in_srgb,var(--danger)_74%,var(--ui-ink-strong)_26%)]","aria-label":`Delete observation ${t.note.id}`,onClick:g=>{g.stopPropagation(),ae.mutateAsync(t.note.id)},children:e.jsx(Be,{className:"size-3.5"})})]})},t.id)},Ae=t=>{const a=y==="compact",d=y==="extended",l=Xt(t.event),c=Jt(t.event),p=H(t.event.title||"Forge activity",a?92:d?144:112),I=a?"":us(t.event,d?220:120),g=d?4:2;return e.jsx("div",{role:a&&l?"button":void 0,tabIndex:a&&l?0:void 0,className:v("min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3 text-[var(--ui-ink-medium)]",a&&"px-2.5 py-2",a&&l&&"cursor-pointer"),onClick:a&&l?()=>n(l):void 0,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("div",{className:"min-w-0 flex-1",children:a?e.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[e.jsx("div",{className:v("shrink-0 text-[11px] uppercase tracking-[0.16em]",ue),children:X(t.observedAt)}),e.jsx(f,{className:v("shrink-0",pe),children:st(t)}),e.jsx("div",{className:"min-w-0 truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:p})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:v("text-xs uppercase tracking-[0.16em]",ue),children:X(t.observedAt)}),e.jsx(f,{className:pe,children:st(t)}),e.jsx(We,{user:t.event.user,compact:!0})]}),e.jsx("div",{className:"mt-2 break-words text-sm font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:p}),t.event.description?e.jsx("div",{className:v("mt-1 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",d?"line-clamp-3":"line-clamp-1"),children:I}):null,e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:t.tags.slice(0,g).map(B=>e.jsx(f,{className:K,children:B},`${t.id}-${B}`))})]})}),!a&&l&&c?e.jsxs(w,{size:"sm",variant:"secondary",onClick:()=>n(l),className:"shrink-0",children:[e.jsx(Ke,{className:"size-4"}),c]}):null]})},t.id)},kt=t=>{b({...q,userId:x,tags:z(),observedAtInput:t?it(t.toISOString()):""})},$=(t,a)=>{const d=new Date(t);d.setHours(a,0,0,0),kt(d),E(!0)},Nt=t=>{b(xs(t,x)),E(!0)},St=async(t,a,d)=>{await vt.mutateAsync({noteId:t.note.id,frontmatter:{...t.note.frontmatter,observedAt:hs(t.observedAt,a,d)}})},Tt=async()=>{const t=await U.mutateAsync(u),a=new URLSearchParams;a.set("create","1"),a.set("sourceObservationNoteId",t.note.id),t.note.userId&&a.set("userId",t.note.userId),n(`/psyche/patterns?${a.toString()}`)};return k.isLoading?e.jsx(Et,{}):k.isError?e.jsx(Mt,{eyebrow:"Self Observation",error:k.error,onRetry:()=>void k.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Qt,{title:"Self Observation",titleText:"Self Observation",description:"Map handwritten reflections and lower-priority Forge activity onto the real week by hour, so the calendar shows both what you noticed and what the system recorded you doing.",badge:`${O.length} visible this week`,actions:e.jsxs(w,{onClick:()=>$(new Date,new Date().getHours()),children:[e.jsx(Q,{className:"size-4"}),"Add observation"]})}),e.jsx(Lt,{}),e.jsxs(He,{className:v("grid gap-4 p-5",Je),children:[e.jsx(Wt,{eyebrow:"Observation week",description:"True self-observation stays primary. Forge activity sits underneath it as supporting context, so you can review the week as lived evidence and export exactly the slice you want to share.",weekStart:h,badges:e.jsxs(e.Fragment,{children:[e.jsx(f,{className:K,children:yt}),e.jsxs(f,{className:"max-w-full border border-[color-mix(in_srgb,var(--success)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[wt," observations"]}),e.jsxs(f,{className:pe,children:[jt," activity"]}),e.jsx(f,{className:K,children:F?"Human-owned only":"All owners"})]}),onPrevious:()=>_(de(h,-7)),onCurrent:()=>_(Ye()),onNext:()=>_(de(h,7))}),e.jsxs("div",{className:"grid min-w-0 max-w-full gap-4 xl:grid-cols-[minmax(0,1.4fr)_minmax(18rem,0.8fr)]",children:[e.jsxs("div",{className:v("grid min-w-0 w-full max-w-[calc(100vw-4rem)] box-border gap-3 p-4 sm:max-w-full",Y),children:[e.jsxs("div",{children:[e.jsx("div",{className:ce,children:"Filter timeline"}),e.jsx("div",{className:v("mt-1 break-words text-sm [overflow-wrap:anywhere]",Ze),children:"Search the week, focus a specific entity kind, switch density, and narrow the timeline before you review it."})]}),e.jsxs("div",{className:"grid min-w-0 max-w-full gap-3 lg:grid-cols-[minmax(0,1.1fr)_minmax(15rem,0.8fr)_minmax(15rem,0.8fr)]",children:[e.jsx(oe,{value:s,onChange:t=>te(t.target.value),placeholder:"Search notes, authors, activity, or entity labels"}),e.jsx(le,{label:"Entity kind",value:A,options:ht,onChange:he}),e.jsx(le,{label:"Entry view",value:y,options:ss,onChange:ct})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:ce,children:"Extra tags"}),e.jsx("div",{className:v("break-words text-xs [overflow-wrap:anywhere]",ue),children:"Add narrower filters like `focus`, `Forge activity`, or `Source · UI`."}),e.jsx(qe,{value:C,onChange:ee,availableTags:V,placeholder:"Filter by tag"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(w,{variant:D?"primary":"ghost",onClick:()=>lt(t=>!t),children:D?"Hide observations":"Show observations"}),e.jsx(w,{variant:R?"secondary":"ghost",onClick:()=>dt(t=>!t),children:R?"Hide Forge activity":"Show Forge activity"}),e.jsx(w,{variant:F?"secondary":"primary",onClick:()=>xe(!1),children:"All owners"}),e.jsx(w,{variant:F?"primary":"ghost",onClick:()=>xe(!0),children:"Human only"})]})]}),e.jsxs("div",{className:v("grid min-w-0 w-full max-w-[calc(100vw-4rem)] box-border gap-3 p-4 sm:max-w-full",Y),children:[e.jsxs("div",{className:"min-w-0 max-w-full",children:[e.jsx("div",{className:ce,children:"Export week"}),e.jsx("div",{className:v("mt-1 break-words text-sm [overflow-wrap:anywhere]",Ze),children:"Export respects the current search, entity, tag, owner, and observation/activity filters."})]}),e.jsx(le,{label:"Export format",value:se,options:rs,onChange:ut}),e.jsxs(w,{variant:"secondary",pending:Te.isPending,pendingLabel:"Exporting",onClick:()=>void Te.mutateAsync(),children:[e.jsx(Ct,{className:"size-4"}),"Export week"]})]})]})]}),e.jsxs(He,{className:v("min-w-0 overflow-hidden p-0",Je),children:[e.jsx("div",{className:"hidden overflow-x-auto lg:block",children:e.jsxs("div",{className:"min-w-[76rem]",children:[e.jsxs("div",{className:"grid grid-cols-[5rem_repeat(7,minmax(10rem,1fr))] border-b border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",children:[e.jsx("div",{className:"border-r border-[var(--ui-border-subtle)] px-3 py-4 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Hour"}),ne.map(t=>e.jsxs("div",{className:"border-r border-[var(--ui-border-subtle)] px-3 py-4 last:border-r-0",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--ui-ink-strong)]",children:Ge(t)}),e.jsx("div",{className:"mt-1 text-xs text-[var(--ui-ink-faint)]",children:G(t)})]},t.toISOString()))]}),fe.map(t=>e.jsxs("div",{className:"grid grid-cols-[5rem_repeat(7,minmax(10rem,1fr))] border-b border-[var(--ui-border-subtle)] last:border-b-0",children:[e.jsx("div",{className:"border-r border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-4 text-sm text-[var(--ui-ink-soft)]",children:Xe(t)}),ne.map(a=>{const l=`${G(a)}:${t}`,c=Ie.get(l)??[];return e.jsx("div",{"data-self-observation-slot":l,className:v("border-r border-[var(--ui-border-subtle)] px-2 py-2 last:border-r-0",y==="compact"?"min-h-[4.25rem]":y==="extended"?"min-h-[7rem]":"min-h-[5.5rem]"),onDragOver:p=>p.preventDefault(),onDrop:p=>{p.preventDefault();const I=p.dataTransfer.getData("text/forge-self-observation-id")||pt;if(!I)return;const g=O.find(B=>T(B)&&B.observation.note.id===I);!g||!T(g)||(St(g.observation,a,t),re(null))},children:e.jsxs("div",{className:"grid gap-2",children:[c.length>0?e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{type:"button",className:et,onClick:()=>$(a,t),children:[e.jsx(Q,{className:"size-3.5"}),"Add"]})}):null,c.map(p=>T(p)?Ce(p.observation):Ae(p.activity)),c.length===0?e.jsx("button",{type:"button",className:v(tt,y==="compact"?"px-3 py-2":"px-3 py-4"),onClick:()=>$(a,t),children:y==="compact"?"Add":"Add observation"}):null]})},l)})]},t))]})}),e.jsx("div",{className:"grid gap-4 p-4 lg:hidden",children:ne.map(t=>{const a=G(t);return e.jsxs("div",{className:v("p-3",Y),children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3 rounded-[8px] bg-[var(--ui-surface-2)] px-3 py-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:Ge(t)}),e.jsx("div",{className:"mt-1 text-xs text-[var(--ui-ink-faint)]",children:a})]}),e.jsxs(w,{size:"sm",variant:"secondary",onClick:()=>$(t,new Date().getHours()),children:[e.jsx(Q,{className:"size-4"}),"Add"]})]}),e.jsx("div",{className:"mt-3 grid gap-2",children:fe.map(d=>{const l=`${a}:${d}`,c=Ie.get(l)??[];return e.jsxs("div",{"data-self-observation-slot-mobile":l,className:"min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:Xe(d)}),e.jsxs("button",{type:"button",className:et,onClick:()=>$(t,d),children:[e.jsx(Q,{className:"size-3.5"}),"Add"]})]}),e.jsx("div",{className:"mt-2 grid gap-2",children:c.length===0?e.jsx("button",{type:"button",className:v(tt,y==="compact"?"px-3 py-2":"px-3 py-3"),onClick:()=>$(t,d),children:y==="compact"?"Add":"Add observation"}):c.map(p=>T(p)?Ce(p.observation):Ae(p.activity))})]},l)})})]},a)})})]}),e.jsx(Ft,{open:mt,onOpenChange:E,eyebrow:"Self Observation",title:u.noteId?"Edit observation":"Add observation",description:"Capture the note, set the exact observation time, then attach the pattern, trigger report, and any other Forge records that belong to that moment.",children:e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsx(Yt,{value:u.userId,users:i.snapshot.users,onChange:t=>b(a=>({...a,userId:t})),defaultLabel:es(i.snapshot.users.find(t=>t.id===x)??null,"Choose observation owner"),help:"Observation notes stay multi-user aware just like the rest of Forge."}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:P,children:"Author"}),e.jsx(oe,{value:u.author,onChange:t=>b(a=>({...a,author:t.target.value})),placeholder:"Albert"})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:P,children:"Observed at"}),e.jsx(oe,{type:"datetime-local",value:u.observedAtInput,onChange:t=>b(a=>({...a,observedAtInput:t.target.value}))})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:P,children:"Observation note"}),e.jsx($t,{value:u.contentMarkdown,onChange:t=>b(a=>({...a,contentMarkdown:t.target.value})),className:"min-h-[14rem]",placeholder:"What happened in this hour, what did you notice, and what mattered?"})]}),e.jsx(qe,{value:u.tags,onChange:t=>b(a=>({...a,tags:t})),availableTags:V,placeholder:"Add note tags for the observation"}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:P,children:"Linked patterns"}),e.jsxs("button",{type:"button",className:ve,onClick:()=>void Tt(),disabled:U.isPending||u.contentMarkdown.trim().length===0,children:[e.jsx(Re,{className:"size-3.5"}),"Create pattern from observation"]})]}),e.jsx(ie,{options:gt,selectedValues:u.linkedPatternIds,onChange:t=>b(a=>({...a,linkedPatternIds:t})),placeholder:"Search patterns in scope",emptyMessage:"No patterns in scope yet."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:P,children:"Trigger report"}),e.jsxs("button",{type:"button",className:ve,onClick:()=>{const t=new URLSearchParams;t.set("create","1"),u.observedAtInput&&t.set("occurredAt",ze(u.observedAtInput)??new Date().toISOString()),u.userId&&t.set("userId",u.userId),n(`/psyche/reports?${t.toString()}`),E(!1)},children:[e.jsx(Re,{className:"size-3.5"}),"Create report from time"]})]}),e.jsx(ie,{options:xt,selectedValues:u.linkedTriggerReportId?[u.linkedTriggerReportId]:[],onChange:t=>b(a=>({...a,linkedTriggerReportId:t.at(-1)??null})),placeholder:"Search trigger reports in scope",emptyMessage:"No trigger reports in scope yet."})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:P,children:"Linked records"}),e.jsx(ie,{options:bt,selectedValues:u.linkedEntityValues,onChange:t=>b(a=>({...a,linkedEntityValues:t})),placeholder:"Link goals, projects, tasks, values, beliefs, modes, or other Forge records",emptyMessage:"No linked records in scope yet."})]}),e.jsxs("div",{className:v("px-4 py-4",Y),children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 break-words text-sm text-[var(--ui-ink-medium)] [overflow-wrap:anywhere]",children:[e.jsx(At,{className:"size-4 text-[var(--tertiary)]"}),"Cards appear in the hourly week grid at the exact observation time, whether they came from deliberate reflection or rolling movement sync."]}),e.jsx("div",{className:"mt-2 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:"Move them later by drag-and-drop, edit the timestamp directly here, or delete them from the card itself when the observation should not stay on the calendar."})]}),e.jsxs("div",{className:"flex flex-wrap justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.noteId?e.jsxs(w,{variant:"secondary",pending:ae.isPending,pendingLabel:"Deleting",onClick:()=>u.noteId?void ae.mutateAsync(u.noteId):void 0,children:[e.jsx(Be,{className:"size-4"}),"Delete observation"]}):null,u.linkedTriggerReportId?e.jsxs("button",{type:"button",className:v(ve,"py-2 text-sm"),onClick:()=>n(`/psyche/reports/${u.linkedTriggerReportId}`),children:[e.jsx(Ke,{className:"size-4"}),"Open linked report"]}):null]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(w,{variant:"secondary",onClick:()=>E(!1),children:"Cancel"}),e.jsx(w,{pending:U.isPending,pendingLabel:"Saving",disabled:u.contentMarkdown.trim().length===0,onClick:()=>void U.mutateAsync(u),children:"Save observation"})]})]})]})})]})}export{Bs as PsycheSelfObservationPage};
@@ -1,5 +1,5 @@
1
- import{bZ as $,r as g,j as e}from"./vendor-y_uz1Wft.js";import{j as _,i as O,k as Q}from"./state-DWw8Jay_.js";import{Q as K,F as l}from"./question-flow-dialog-CPyXCqA-.js";import{E as q}from"./entity-note-count-link-FOK_qhcC.js";import{A as R}from"./atlas-panel-B95nrYpZ.js";import{O as W}from"./orbit-map-De0qpMpY.js";import{d as z,L as H,e as Y,B as k,E as T,bB as Z,a0 as J,b as f,cM as X,bY as ee,I as F,T as b,bT as w,bc as se}from"./index-Dj8q65se.js";import{u as te,p as ae}from"./use-psyche-focus-target-DvRgu-94.js";import{P as ie}from"./page-hero-DYmFM6-q.js";import{U as re}from"./user-badge-B8hYK6NU.js";import{U as ne}from"./user-select-field-akGHK-2t.js";import{p as D}from"./psyche-schemas-CvRSkI_u.js";import{g as le,a as oe}from"./user-ownership-DJGl4rAj.js";import"./ui-CdEDMtXF.js";import"./motion-DeJZhOSA.js";import"./board-CGgOvBP9.js";import"./forms-DhEGHkFR.js";const y={title:"",description:"",valuedDirection:"",whyItMatters:"",linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],committedActions:[],userId:null};function I(a,u){return a.includes(u)?a.filter(m=>m!==u):[...a,u]}function de(a){return{title:a.title,description:a.description,valuedDirection:a.valuedDirection,whyItMatters:a.whyItMatters,linkedGoalIds:a.linkedGoalIds,linkedProjectIds:a.linkedProjectIds,linkedTaskIds:a.linkedTaskIds,committedActions:a.committedActions,userId:a.userId??null}}function Ce(){var E;const a=z(),u=_(),[m,N]=$(),[L,o]=g.useState(!1),[p,h]=g.useState(null),[P,d]=g.useState(y),[A,v]=g.useState(null),j=O({queryKey:["forge-psyche-values"],queryFn:se}),x=((E=j.data)==null?void 0:E.values)??[],c=le(a.selectedUserIds),C=m.get("focus"),M=a.snapshot.dashboard.notesSummaryByEntity;te(C),g.useEffect(()=>{if(m.get("create")==="1"){o(!0),h(null),d({...y,userId:c});const s=new URLSearchParams(m);s.delete("create"),N(s,{replace:!0})}},[c,m,N]);const S=Q({mutationFn:async s=>{const i=D.parse(s);return p?X(p.id,i):ee(i)},onSuccess:async()=>{o(!1),h(null),d({...y,userId:c}),v(null),await Promise.all([u.invalidateQueries({queryKey:["forge-psyche-values"]}),u.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),U=g.useMemo(()=>x.slice(0,5).map((s,i)=>({id:s.id,label:`${s.linkedGoalIds.length} goals`,title:s.title,detail:s.valuedDirection,href:`/psyche/values?focus=${s.id}#values-atlas`,angle:-90+i*68,radius:150+i%2*20,tone:["mint","sky","violet","rose"][i%4]})),[x]),V=[{id:"direction",eyebrow:"Compass",title:"Name the direction you want to protect",description:"Start with the value itself and the life-direction it points toward.",render:(s,i)=>e.jsxs(e.Fragment,{children:[e.jsx(ne,{value:s.userId??null,users:a.snapshot.users,onChange:t=>i({userId:t}),defaultLabel:oe(a.snapshot.users.find(t=>t.id===c)??null,"Choose value owner"),help:"Values can belong to a human or bot user while still linking to goals, projects, and tasks across Forge."}),e.jsx(l,{label:"Value name",children:e.jsx(F,{value:s.title,onChange:t=>i({title:t.target.value}),placeholder:"Repair with steadiness"})}),e.jsx(l,{label:"Valued direction",children:e.jsx(F,{value:s.valuedDirection,onChange:t=>i({valuedDirection:t.target.value}),placeholder:"Warm, brave, and honest connection"})}),e.jsx(l,{label:"Why it matters",children:e.jsx(b,{value:s.whyItMatters,onChange:t=>i({whyItMatters:t.target.value}),placeholder:"Why is this direction important enough to protect when pressure rises?"})})]})},{id:"shape",eyebrow:"Texture",title:"Describe how the value should feel in lived form",description:"Keep this concrete enough that later reports and behaviors can map back to it.",render:(s,i)=>e.jsxs(e.Fragment,{children:[e.jsx(l,{label:"Description",children:e.jsx(b,{value:s.description,onChange:t=>i({description:t.target.value}),placeholder:"Describe what this value looks like in daily behavior, not just in theory."})}),e.jsx(l,{label:"Committed action ideas",children:e.jsx(b,{value:s.committedActions.join(`
1
+ import{bZ as $,r as g,j as e}from"./vendor-Dgw7UY7q.js";import{j as B,i as O,k as Q}from"./state-CkEUXgqt.js";import{Q as K,F as l}from"./question-flow-dialog-B4B3BI8e.js";import{E as q}from"./entity-note-count-link-BDLj5ezr.js";import{A as R}from"./atlas-panel-DRMA3RbG.js";import{O as W}from"./orbit-map-BpNCTagm.js";import{d as z,L as H,e as Z,B as k,E as T,bD as J,a2 as X,b as f,cO as Y,b_ as ee,I as F,T as b,bV as w,be as se}from"./index-C0CztQTU.js";import{u as te,p as ae}from"./use-psyche-focus-target-p2l8W-Af.js";import{P as ie}from"./page-hero-ED69y6m0.js";import{U as re}from"./user-badge-BWoSrGA-.js";import{U as ne}from"./user-select-field-DbB9v7Lf.js";import{p as D}from"./psyche-schemas-B00gm5HO.js";import{g as le,a as oe}from"./user-ownership-DJGl4rAj.js";import"./ui-CDt36qNz.js";import"./motion-eRlWWQT8.js";import"./board-Dl7As76Q.js";import"./forms-DznAv9hZ.js";const y={title:"",description:"",valuedDirection:"",whyItMatters:"",linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],committedActions:[],userId:null};function I(a,u){return a.includes(u)?a.filter(m=>m!==u):[...a,u]}function de(a){return{title:a.title,description:a.description,valuedDirection:a.valuedDirection,whyItMatters:a.whyItMatters,linkedGoalIds:a.linkedGoalIds,linkedProjectIds:a.linkedProjectIds,linkedTaskIds:a.linkedTaskIds,committedActions:a.committedActions,userId:a.userId??null}}function Ce(){var E;const a=z(),u=B(),[m,N]=$(),[L,o]=g.useState(!1),[p,h]=g.useState(null),[P,d]=g.useState(y),[A,v]=g.useState(null),j=O({queryKey:["forge-psyche-values"],queryFn:se}),x=((E=j.data)==null?void 0:E.values)??[],c=le(a.selectedUserIds),C=m.get("focus"),V=a.snapshot.dashboard.notesSummaryByEntity;te(C),g.useEffect(()=>{if(m.get("create")==="1"){o(!0),h(null),d({...y,userId:c});const s=new URLSearchParams(m);s.delete("create"),N(s,{replace:!0})}},[c,m,N]);const S=Q({mutationFn:async s=>{const i=D.parse(s);return p?Y(p.id,i):ee(i)},onSuccess:async()=>{o(!1),h(null),d({...y,userId:c}),v(null),await Promise.all([u.invalidateQueries({queryKey:["forge-psyche-values"]}),u.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),U=g.useMemo(()=>x.slice(0,5).map((s,i)=>({id:s.id,label:`${s.linkedGoalIds.length} goals`,title:s.title,detail:s.valuedDirection,href:`/psyche/values?focus=${s.id}#values-atlas`,angle:-90+i*68,radius:150+i%2*20,tone:["mint","sky","violet","rose"][i%4]})),[x]),M=[{id:"direction",eyebrow:"Compass",title:"Name the direction you want to protect",description:"Start with the value itself and the life-direction it points toward.",render:(s,i)=>e.jsxs(e.Fragment,{children:[e.jsx(ne,{value:s.userId??null,users:a.snapshot.users,onChange:t=>i({userId:t}),defaultLabel:oe(a.snapshot.users.find(t=>t.id===c)??null,"Choose value owner"),help:"Values can belong to a human or bot user while still linking to goals, projects, and tasks across Forge."}),e.jsx(l,{label:"Value name",children:e.jsx(F,{value:s.title,onChange:t=>i({title:t.target.value}),placeholder:"Repair with steadiness"})}),e.jsx(l,{label:"Valued direction",children:e.jsx(F,{value:s.valuedDirection,onChange:t=>i({valuedDirection:t.target.value}),placeholder:"Warm, brave, and honest connection"})}),e.jsx(l,{label:"Why it matters",children:e.jsx(b,{value:s.whyItMatters,onChange:t=>i({whyItMatters:t.target.value}),placeholder:"Why is this direction important enough to protect when pressure rises?"})})]})},{id:"shape",eyebrow:"Texture",title:"Describe how the value should feel in lived form",description:"Keep this concrete enough that later reports and behaviors can map back to it.",render:(s,i)=>e.jsxs(e.Fragment,{children:[e.jsx(l,{label:"Description",children:e.jsx(b,{value:s.description,onChange:t=>i({description:t.target.value}),placeholder:"Describe what this value looks like in daily behavior, not just in theory."})}),e.jsx(l,{label:"Committed action ideas",children:e.jsx(b,{value:s.committedActions.join(`
2
2
  `),onChange:t=>i({committedActions:t.target.value.split(`
3
3
  `).map(n=>n.trim()).filter(Boolean)}),placeholder:`One line per action
4
4
  Text your sister before Friday
5
- Take a ten-minute reset walk`})})]})},{id:"links",eyebrow:"Placement",title:"Place the value into the real system of work",description:"This is where values become graphical anchors across goals, projects, and tasks instead of standalone notes.",render:(s,i)=>e.jsxs(e.Fragment,{children:[e.jsx(l,{label:"Linked goals",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:a.snapshot.goals.map(t=>{const n=s.linkedGoalIds.includes(t.id);return e.jsx("button",{type:"button",className:`rounded-full px-2.5 py-2 text-sm transition ${w("goal",n)}`,onClick:()=>i({linkedGoalIds:I(s.linkedGoalIds,t.id)}),children:e.jsx(f,{kind:"goal",label:t.title,compact:!0,gradient:!1})},t.id)})})}),e.jsx(l,{label:"Linked projects",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:a.snapshot.dashboard.projects.map(t=>{const n=s.linkedProjectIds.includes(t.id);return e.jsx("button",{type:"button",className:`rounded-full px-2.5 py-2 text-sm transition ${w("project",n)}`,onClick:()=>i({linkedProjectIds:I(s.linkedProjectIds,t.id)}),children:e.jsx(f,{kind:"project",label:t.title,compact:!0,gradient:!1})},t.id)})})}),e.jsx(l,{label:"Linked tasks",children:e.jsx("div",{className:"flex max-h-48 flex-wrap gap-2 overflow-y-auto",children:a.snapshot.tasks.slice(0,24).map(t=>{const n=s.linkedTaskIds.includes(t.id);return e.jsx("button",{type:"button",className:`rounded-full px-2.5 py-2 text-sm transition ${w("task",n)}`,onClick:()=>i({linkedTaskIds:I(s.linkedTaskIds,t.id)}),children:e.jsx(f,{kind:"task",label:t.title,compact:!0,gradient:!1})},t.id)})})})]})}];return j.isLoading?e.jsx(H,{eyebrow:"Psyche values",title:"Loading value constellation",description:"Hydrating values, linked goals, projects, and tasks."}):j.isError?e.jsx(Y,{eyebrow:"Psyche values",error:j.error,onRetry:()=>void j.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(ie,{entityKind:"value",title:e.jsx(T,{kind:"value",label:"Values",variant:"heading",size:"lg"}),description:"Map values as living anchors. Each one should visibly relate to goals, projects, and tasks so reflection stops feeling separate from the rest of life.",badge:`${x.length} values`,actions:e.jsx(k,{onClick:()=>{h(null),d({...y,userId:c}),o(!0)},children:"Add value"})}),e.jsx(Z,{}),e.jsx(W,{title:"Place values inside the wider life system",description:"Values are not just notes. This constellation shows which directions are already attached to real goals, projects, and concrete tasks.",centerLabel:"Value field",centerValue:`${x.length} mapped`,nodes:U,action:e.jsx(k,{onClick:()=>{h(null),d({...y,userId:c}),o(!0)},children:"Add value"})}),e.jsx(R,{eyebrow:"Values in context",title:"See why each value matters and where it lives",description:"Each card combines the value narrative with its linked goals, projects, tasks, and committed actions so you can understand the shape immediately.",tone:"mint",className:"scroll-mt-24",children:e.jsx("div",{id:"values-atlas",className:"grid gap-4",children:x.length===0?e.jsx("div",{className:"flex justify-start",children:e.jsx(k,{onClick:()=>{h(null),d({...y,userId:c}),o(!0)},children:"Add value"})}):x.map(s=>{const i=a.snapshot.goals.filter(r=>s.linkedGoalIds.includes(r.id)),t=a.snapshot.dashboard.projects.filter(r=>s.linkedProjectIds.includes(r.id)),n=a.snapshot.tasks.filter(r=>s.linkedTaskIds.includes(r.id)),G=C===s.id,B=J(M,"psyche_value",s.id).count;return e.jsxs("div",{"data-psyche-focus-id":s.id,className:`min-w-0 rounded-[26px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 transition ${ae(G)}`,children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(T,{kind:"value",label:s.title,variant:"heading",size:"xl",lines:2,labelClassName:"[overflow-wrap:anywhere]"}),e.jsx("div",{className:"mt-2 text-sm text-[var(--tertiary)]",children:s.valuedDirection})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.user?e.jsx(re,{user:s.user,compact:!0}):null,e.jsx(q,{entityType:"psyche_value",entityId:s.id,count:B}),e.jsx(k,{variant:"secondary",onClick:()=>{h(s),d(de(s)),o(!0)},children:"Edit"})]})]}),e.jsx("p",{className:"mt-4 max-w-3xl break-words text-sm leading-7 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:s.description}),e.jsxs("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Why it matters"}),e.jsx("div",{className:"mt-2 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:s.whyItMatters})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Goals"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:i.length===0?e.jsx("span",{className:"text-sm text-[var(--ui-ink-faint)]",children:"None linked"}):i.map(r=>e.jsx(f,{kind:"goal",label:r.title,compact:!0,wrap:!0},r.id))})]}),e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Projects"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.length===0?e.jsx("span",{className:"text-sm text-[var(--ui-ink-faint)]",children:"None linked"}):t.map(r=>e.jsx(f,{kind:"project",label:r.title,compact:!0,wrap:!0},r.id))})]}),e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Tasks"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:n.length===0?e.jsx("span",{className:"text-sm text-[var(--ui-ink-faint)]",children:"None linked"}):n.slice(0,4).map(r=>e.jsx(f,{kind:"task",label:r.title,compact:!0,wrap:!0},r.id))})]})]})]}),e.jsx("div",{className:"mt-4 grid gap-2 md:grid-cols-2",children:s.committedActions.map(r=>e.jsx("div",{className:"min-w-0 break-words rounded-[18px] bg-[color-mix(in_srgb,var(--success)_10%,var(--ui-surface-1)_90%)] px-4 py-3 text-sm text-[var(--ui-ink-medium)] [overflow-wrap:anywhere]",children:r},r))})]},s.id)})})}),e.jsx(K,{open:L,onOpenChange:o,eyebrow:"Value",title:p?"Refine value placement":"Create value",description:"Forge should capture values through guided placement, not a raw admin form.",value:P,onChange:d,draftPersistenceKey:p?`psyche.value.${p.id}`:"psyche.value.new",steps:V,submitLabel:p?"Save value":"Create value",pending:S.isPending,error:A,onSubmit:async()=>{v(null);const s=D.safeParse(P);if(!s.success){v("This value still needs a title and valued direction before it can be saved.");return}try{await S.mutateAsync(s.data)}catch(i){v(i instanceof Error?i.message:"Unable to save this value right now.")}}})]})}export{Ce as PsycheValuesPage};
5
+ Take a ten-minute reset walk`})})]})},{id:"links",eyebrow:"Placement",title:"Place the value into the real system of work",description:"This is where values become graphical anchors across goals, projects, and tasks instead of standalone notes.",render:(s,i)=>e.jsxs(e.Fragment,{children:[e.jsx(l,{label:"Linked goals",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:a.snapshot.goals.map(t=>{const n=s.linkedGoalIds.includes(t.id);return e.jsx("button",{type:"button",className:`rounded-full px-2.5 py-2 text-sm transition ${w("goal",n)}`,onClick:()=>i({linkedGoalIds:I(s.linkedGoalIds,t.id)}),children:e.jsx(f,{kind:"goal",label:t.title,compact:!0,gradient:!1})},t.id)})})}),e.jsx(l,{label:"Linked projects",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:a.snapshot.dashboard.projects.map(t=>{const n=s.linkedProjectIds.includes(t.id);return e.jsx("button",{type:"button",className:`rounded-full px-2.5 py-2 text-sm transition ${w("project",n)}`,onClick:()=>i({linkedProjectIds:I(s.linkedProjectIds,t.id)}),children:e.jsx(f,{kind:"project",label:t.title,compact:!0,gradient:!1})},t.id)})})}),e.jsx(l,{label:"Linked tasks",children:e.jsx("div",{className:"flex max-h-48 flex-wrap gap-2 overflow-y-auto",children:a.snapshot.tasks.slice(0,24).map(t=>{const n=s.linkedTaskIds.includes(t.id);return e.jsx("button",{type:"button",className:`rounded-full px-2.5 py-2 text-sm transition ${w("task",n)}`,onClick:()=>i({linkedTaskIds:I(s.linkedTaskIds,t.id)}),children:e.jsx(f,{kind:"task",label:t.title,compact:!0,gradient:!1})},t.id)})})})]})}];return j.isLoading?e.jsx(H,{eyebrow:"Psyche values",title:"Loading value constellation",description:"Hydrating values, linked goals, projects, and tasks."}):j.isError?e.jsx(Z,{eyebrow:"Psyche values",error:j.error,onRetry:()=>void j.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(ie,{entityKind:"value",title:e.jsx(T,{kind:"value",label:"Values",variant:"heading",size:"lg"}),description:"Map values as living anchors. Each one should visibly relate to goals, projects, and tasks so reflection stops feeling separate from the rest of life.",badge:`${x.length} values`,actions:e.jsx(k,{onClick:()=>{h(null),d({...y,userId:c}),o(!0)},children:"Add value"})}),e.jsx(J,{}),e.jsx(W,{title:"Place values inside the wider life system",description:"Values are not just notes. This constellation shows which directions are already attached to real goals, projects, and concrete tasks.",centerLabel:"Value field",centerValue:`${x.length} mapped`,nodes:U,action:e.jsx(k,{onClick:()=>{h(null),d({...y,userId:c}),o(!0)},children:"Add value"})}),e.jsx(R,{eyebrow:"Values in context",title:"See why each value matters and where it lives",description:"Each card combines the value narrative with its linked goals, projects, tasks, and committed actions so you can understand the shape immediately.",tone:"mint",className:"scroll-mt-24",children:e.jsx("div",{id:"values-atlas",className:"grid gap-4",children:x.length===0?e.jsx("div",{className:"flex justify-start",children:e.jsx(k,{onClick:()=>{h(null),d({...y,userId:c}),o(!0)},children:"Add value"})}):x.map(s=>{const i=a.snapshot.goals.filter(r=>s.linkedGoalIds.includes(r.id)),t=a.snapshot.dashboard.projects.filter(r=>s.linkedProjectIds.includes(r.id)),n=a.snapshot.tasks.filter(r=>s.linkedTaskIds.includes(r.id)),G=C===s.id,_=X(V,"psyche_value",s.id).count;return e.jsxs("div",{"data-psyche-focus-id":s.id,className:`min-w-0 rounded-[26px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 transition ${ae(G)}`,children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(T,{kind:"value",label:s.title,variant:"heading",size:"xl",lines:2,labelClassName:"[overflow-wrap:anywhere]"}),e.jsx("div",{className:"mt-2 text-sm text-[var(--tertiary)]",children:s.valuedDirection})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.user?e.jsx(re,{user:s.user,compact:!0}):null,e.jsx(q,{entityType:"psyche_value",entityId:s.id,count:_}),e.jsx(k,{variant:"secondary",onClick:()=>{h(s),d(de(s)),o(!0)},children:"Edit"})]})]}),e.jsx("p",{className:"mt-4 max-w-3xl break-words text-sm leading-7 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:s.description}),e.jsxs("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Why it matters"}),e.jsx("div",{className:"mt-2 break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:s.whyItMatters})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Goals"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:i.length===0?e.jsx("span",{className:"text-sm text-[var(--ui-ink-faint)]",children:"None linked"}):i.map(r=>e.jsx(f,{kind:"goal",label:r.title,compact:!0,wrap:!0},r.id))})]}),e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Projects"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.length===0?e.jsx("span",{className:"text-sm text-[var(--ui-ink-faint)]",children:"None linked"}):t.map(r=>e.jsx(f,{kind:"project",label:r.title,compact:!0,wrap:!0},r.id))})]}),e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Tasks"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:n.length===0?e.jsx("span",{className:"text-sm text-[var(--ui-ink-faint)]",children:"None linked"}):n.slice(0,4).map(r=>e.jsx(f,{kind:"task",label:r.title,compact:!0,wrap:!0},r.id))})]})]})]}),e.jsx("div",{className:"mt-4 grid gap-2 md:grid-cols-2",children:s.committedActions.map(r=>e.jsx("div",{className:"min-w-0 break-words rounded-[18px] bg-[color-mix(in_srgb,var(--success)_10%,var(--ui-surface-1)_90%)] px-4 py-3 text-sm text-[var(--ui-ink-medium)] [overflow-wrap:anywhere]",children:r},r))})]},s.id)})})}),e.jsx(K,{open:L,onOpenChange:o,eyebrow:"Value",title:p?"Refine value placement":"Create value",description:"Forge should capture values through guided placement, not a raw admin form.",value:P,onChange:d,draftPersistenceKey:p?`psyche.value.${p.id}`:"psyche.value.new",steps:M,submitLabel:p?"Save value":"Create value",pending:S.isPending,error:A,onSubmit:async()=>{v(null);const s=D.safeParse(P);if(!s.success){v("This value still needs a title and valued direction before it can be saved.");return}try{await S.mutateAsync(s.data)}catch(i){v(i instanceof Error?i.message:"Unable to save this value right now.")}}})]})}export{Ce as PsycheValuesPage};
@@ -1,2 +1,2 @@
1
- import{r as o,j as e,cP as ee,bX as te,bH as ne}from"./vendor-y_uz1Wft.js";import{R as re,P as se,O as ae,C as ie,T as le,D as ce,a as B}from"./ui-CdEDMtXF.js";import{u as oe,aL as de,B as j,c as N,ad as ue,ac as me}from"./index-Dj8q65se.js";import{m as I,A as fe}from"./motion-DeJZhOSA.js";const U="(max-width: 1023px)",xe="forge.question-flow-draft",J=1,pe=1e3;function he({open:t,wasOpen:i,initialStepId:n,previousInitialStepId:r,currentStepIndex:s,steps:l}){if(!t)return 0;const c=()=>{if(!n)return 0;const g=l.findIndex(k=>k.id===n);return g>=0?g:0};return!i||r!==n?c():l.length===0?0:s>=l.length?Math.max(0,l.length-1):s<0?0:s}function we(t){const i=t.split(/\n\s*\n/g).map(n=>n.split(`
2
- `).map(r=>r.trim()).filter(r=>r.length>0)).filter(n=>n.length>0);return i.length===0?null:e.jsx("div",{className:"grid gap-2",children:i.map((n,r)=>{const s=n.filter(c=>c.startsWith("- ")),l=n.filter(c=>!c.startsWith("- "));return e.jsxs("div",{className:"grid gap-2",children:[l.map((c,x)=>e.jsx("p",{children:c},`${r}-${c}-${x}`)),s.length>0?e.jsx("ul",{className:"grid list-disc gap-1 pl-5",children:s.map((c,x)=>e.jsx("li",{children:c.slice(2)},`${r}-${c}-${x}`))}):null]},`section-${r}`)})})}function ge(){const[t,i]=o.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(U).matches);return o.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(U),r=s=>{i(s.matches)};return i(n.matches),typeof n.addEventListener=="function"?(n.addEventListener("change",r),()=>n.removeEventListener("change",r)):(n.addListener(r),()=>n.removeListener(r))},[]),t}function y(){return typeof window<"u"&&typeof window.localStorage<"u"}function E(t){return`${xe}.${t}`}function V(t){try{return JSON.stringify(t)}catch{return null}}function ve(t){if(!y())return null;try{const i=window.localStorage.getItem(E(t));if(!i)return null;const n=JSON.parse(i);return n.version!==J||typeof n.baseline!="string"||typeof n.draft!="string"?null:n}catch{return null}}function be(t,i){if(y())try{window.localStorage.setItem(E(t),JSON.stringify(i))}catch{}}function W(t){if(y())try{window.localStorage.removeItem(E(t))}catch{}}function Re({label:t,description:i,labelHelp:n,hint:r,error:s,children:l}){return e.jsxs("label",{className:"grid min-w-0 max-w-full gap-2",children:[e.jsxs("span",{className:"flex min-w-0 max-w-full items-center gap-2 text-sm font-medium text-[var(--ui-ink-strong)]",children:[e.jsx("span",{className:"min-w-0 break-words",children:t}),n?e.jsx(ue,{content:n,label:`Explain ${t}`}):null]}),i?e.jsx("span",{className:"min-w-0 break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:i}):null,l,r?e.jsx(me,{children:r}):null,s?e.jsx("span",{className:"text-sm text-rose-300",children:s}):null]})}function Se({options:t,value:i,onChange:n,columns:r=2}){return e.jsx("div",{className:N("grid min-w-0 max-w-full gap-3",r===3?"md:grid-cols-3":"md:grid-cols-2"),children:t.map(s=>{const l=s.value===i;return e.jsxs("button",{type:"button",className:N("min-w-0 max-w-full overflow-hidden rounded-[22px] border px-4 py-4 text-left transition",l?"border-[var(--primary)]/28 bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)]"),onClick:()=>n(s.value),children:[e.jsx("div",{className:"min-w-0 break-words font-medium",children:s.label}),s.description?e.jsx("div",{className:"mt-2 min-w-0 break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:s.description}):null]},s.value)})})}function _e({open:t,onOpenChange:i,eyebrow:n,title:r,description:s,value:l,onChange:c,steps:x,onSubmit:g,submitLabel:k,pending:q=!1,pendingLabel:G,error:H,resolveError:R,resolveContinueNudge:S,initialStepId:v,contentClassName:X,draftPersistenceKey:u}){const{t:F}=oe(),Y=ge(),[m,D]=o.useState(0),M=o.useRef(!1),A=o.useRef(v),L=o.useRef(t),_=o.useRef(null),O=o.useRef(null),w=o.useRef(null),Q=o.useRef(l),f=x[m];Q.current=l,o.useEffect(()=>{const a=M.current,d=A.current,C=he({open:t,wasOpen:a,initialStepId:v,previousInitialStepId:d,currentStepIndex:m,steps:x});M.current=t,A.current=v,C!==m&&D(C)},[v,t,m,x]);const Z=a=>{c({...l,...a})},p=x.length,P=p===0?0:(m+1)/p*100,T=f?R==null?void 0:R(f.id):void 0,$=T===void 0?H:T,b=f&&m<p-1?S==null?void 0:S(f.id,l):null,h=o.useCallback(()=>{if(!u)return;const a=O.current,d=V(Q.current);if(!(!a||!d)){if(d===a){W(u),w.current=d;return}w.current!==d&&(be(u,{version:J,baseline:a,draft:d,updatedAt:Date.now()}),w.current=d)}},[u]);o.useEffect(()=>{if(!t){_.current=null;return}if(!u){O.current=null,w.current=null;return}const a=V(l);if(!a||_.current===u)return;_.current=u,O.current=a;const d=ve(u);if(d&&d.baseline===a&&d.draft!==a)try{c(JSON.parse(d.draft)),w.current=d.draft;return}catch{W(u)}w.current=a},[u,c,t,l]),o.useEffect(()=>{if(!u||!t||!y())return;const a=window.setInterval(()=>{h()},pe);return()=>window.clearInterval(a)},[u,t,h]),o.useEffect(()=>{L.current&&!t&&h(),L.current=t},[t,h]);const z=a=>{h(),D(a)},K=a=>{a||h(),i(a)};return e.jsx(re,{open:t,onOpenChange:K,children:e.jsxs(se,{children:[e.jsx(ae,{className:"surface-overlay fixed inset-0 z-40 backdrop-blur-xl"}),e.jsxs(ie,{"data-testid":"question-flow-dialog",className:N("surface-modal-panel fixed z-50 flex flex-col overflow-hidden border",Y?"inset-x-3 bottom-3 top-4 rounded-[30px]":"left-1/2 top-1/2 h-[min(52rem,calc(100vh-1rem))] w-[min(56rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 rounded-[34px]",X),children:[e.jsx(le,{className:"sr-only",children:r}),e.jsx(ce,{className:"sr-only",children:s}),e.jsx("div",{className:"sticky top-0 z-10 border-b border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-4 py-2.5 backdrop-blur-xl md:px-6",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:[e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"shrink-0 text-right",children:["Step ",m+1," of ",p]})]}),e.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-[var(--ui-surface-2)]",children:e.jsx(I.div,{className:"h-full rounded-full bg-[linear-gradient(90deg,var(--primary),var(--secondary))]",animate:{width:`${P}%`},transition:{duration:.35,ease:"easeOut"}})})]}),e.jsx(B,{asChild:!0,children:e.jsx(de,{"aria-label":F("common.dialogs.closeDialog")})})]})}),e.jsx("div",{"data-testid":"question-flow-canvas",className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 md:px-6 md:py-5",children:e.jsx(fe,{mode:"wait",children:e.jsx(I.div,{initial:{opacity:0,y:18},animate:{opacity:1,y:0},exit:{opacity:0,y:-18},transition:{duration:.28,ease:"easeOut"},className:"flex min-h-full min-w-0 flex-col gap-5",children:e.jsxs("div",{className:"flex min-h-full min-w-0 flex-col justify-start",children:[f.eyebrow?e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--secondary)]",children:f.eyebrow}):null,e.jsx("h3",{className:"mt-1.5 font-display text-[clamp(1.45rem,2.15vw,2rem)] leading-tight text-[var(--ui-ink-strong)]",children:f.title}),f.description?e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:f.description}):null,$?e.jsx("div",{className:"mt-4 rounded-[20px] border border-[color-mix(in_srgb,var(--danger)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-danger-soft)] px-4 py-3 text-sm leading-6 text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:we($)}):null,e.jsx("div",{className:"mt-5 grid flex-1 content-start gap-5",children:f.render(l,Z)})]})},f.id)})}),e.jsx("div",{className:"sticky bottom-0 border-t border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-4 pt-2.5 pb-[calc(env(safe-area-inset-bottom)+0.75rem)] backdrop-blur-xl md:px-6 md:pb-3",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 sm:justify-between",children:[e.jsx("div",{className:"hidden min-w-0 shrink text-[12px] text-[var(--ui-ink-faint)] sm:block",children:e.jsx("span",{className:"truncate",children:b||`Step ${m+1}/${p}`})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center justify-end gap-1.5 sm:gap-2",children:[m>0?e.jsxs(j,{type:"button",variant:"secondary",className:"min-w-0 px-3 text-[12px]",onClick:()=>z(Math.max(0,m-1)),children:[e.jsx(ee,{className:"size-4"}),"Back"]}):e.jsx(B,{asChild:!0,children:e.jsx(j,{type:"button",variant:"secondary",className:"min-w-0 px-3 text-[12px]",children:F("common.actions.cancel")})}),m<p-1?e.jsxs(j,{type:"button",className:N("min-w-0 px-3 text-[12px]",b?"shadow-[0_0_0_5px_color-mix(in_srgb,var(--primary)_14%,transparent)]":""),onClick:()=>z(Math.min(p-1,m+1)),children:[e.jsx(I.span,{animate:b?{scale:[1,1.04,1],x:[0,1.5,0]}:{scale:1,x:0},transition:b?{duration:1.1,repeat:1/0,ease:"easeInOut"}:{duration:.2},children:"Continue"}),e.jsx(te,{className:"size-4"})]}):e.jsxs(j,{type:"button",className:"min-w-0 px-3 text-[12px]",pending:q,pendingLabel:G,onClick:()=>{h(),g()},children:[e.jsx(ne,{className:"size-4"}),k]})]})]})})]})]})})}export{Re as F,_e as Q,Se as a};
1
+ import{r as o,j as e,cQ as ee,bX as te,bH as ne}from"./vendor-Dgw7UY7q.js";import{R as re,P as se,O as ae,C as ie,T as le,D as ce,a as B}from"./ui-CDt36qNz.js";import{u as oe,aN as de,B as j,c as N,af as ue,ae as me}from"./index-C0CztQTU.js";import{m as I,A as fe}from"./motion-eRlWWQT8.js";const U="(max-width: 1023px)",xe="forge.question-flow-draft",J=1,pe=1e3;function he({open:t,wasOpen:i,initialStepId:n,previousInitialStepId:r,currentStepIndex:s,steps:l}){if(!t)return 0;const c=()=>{if(!n)return 0;const g=l.findIndex(k=>k.id===n);return g>=0?g:0};return!i||r!==n?c():l.length===0?0:s>=l.length?Math.max(0,l.length-1):s<0?0:s}function we(t){const i=t.split(/\n\s*\n/g).map(n=>n.split(`
2
+ `).map(r=>r.trim()).filter(r=>r.length>0)).filter(n=>n.length>0);return i.length===0?null:e.jsx("div",{className:"grid gap-2",children:i.map((n,r)=>{const s=n.filter(c=>c.startsWith("- ")),l=n.filter(c=>!c.startsWith("- "));return e.jsxs("div",{className:"grid gap-2",children:[l.map((c,x)=>e.jsx("p",{children:c},`${r}-${c}-${x}`)),s.length>0?e.jsx("ul",{className:"grid list-disc gap-1 pl-5",children:s.map((c,x)=>e.jsx("li",{children:c.slice(2)},`${r}-${c}-${x}`))}):null]},`section-${r}`)})})}function ge(){const[t,i]=o.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(U).matches);return o.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(U),r=s=>{i(s.matches)};return i(n.matches),typeof n.addEventListener=="function"?(n.addEventListener("change",r),()=>n.removeEventListener("change",r)):(n.addListener(r),()=>n.removeListener(r))},[]),t}function y(){return typeof window<"u"&&typeof window.localStorage<"u"}function E(t){return`${xe}.${t}`}function V(t){try{return JSON.stringify(t)}catch{return null}}function ve(t){if(!y())return null;try{const i=window.localStorage.getItem(E(t));if(!i)return null;const n=JSON.parse(i);return n.version!==J||typeof n.baseline!="string"||typeof n.draft!="string"?null:n}catch{return null}}function be(t,i){if(y())try{window.localStorage.setItem(E(t),JSON.stringify(i))}catch{}}function W(t){if(y())try{window.localStorage.removeItem(E(t))}catch{}}function Re({label:t,description:i,labelHelp:n,hint:r,error:s,children:l}){return e.jsxs("label",{className:"grid min-w-0 max-w-full gap-2",children:[e.jsxs("span",{className:"flex min-w-0 max-w-full items-center gap-2 text-sm font-medium text-[var(--ui-ink-strong)]",children:[e.jsx("span",{className:"min-w-0 break-words",children:t}),n?e.jsx(ue,{content:n,label:`Explain ${t}`}):null]}),i?e.jsx("span",{className:"min-w-0 break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:i}):null,l,r?e.jsx(me,{children:r}):null,s?e.jsx("span",{className:"text-sm text-rose-300",children:s}):null]})}function Se({options:t,value:i,onChange:n,columns:r=2}){return e.jsx("div",{className:N("grid min-w-0 max-w-full gap-3",r===3?"md:grid-cols-3":"md:grid-cols-2"),children:t.map(s=>{const l=s.value===i;return e.jsxs("button",{type:"button",className:N("min-w-0 max-w-full overflow-hidden rounded-[22px] border px-4 py-4 text-left transition",l?"border-[var(--primary)]/28 bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)]"),onClick:()=>n(s.value),children:[e.jsx("div",{className:"min-w-0 break-words font-medium",children:s.label}),s.description?e.jsx("div",{className:"mt-2 min-w-0 break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:s.description}):null]},s.value)})})}function _e({open:t,onOpenChange:i,eyebrow:n,title:r,description:s,value:l,onChange:c,steps:x,onSubmit:g,submitLabel:k,pending:q=!1,pendingLabel:G,error:H,resolveError:R,resolveContinueNudge:S,initialStepId:v,contentClassName:X,draftPersistenceKey:u}){const{t:F}=oe(),Y=ge(),[m,D]=o.useState(0),M=o.useRef(!1),Q=o.useRef(v),A=o.useRef(t),_=o.useRef(null),O=o.useRef(null),w=o.useRef(null),T=o.useRef(l),f=x[m];T.current=l,o.useEffect(()=>{const a=M.current,d=Q.current,C=he({open:t,wasOpen:a,initialStepId:v,previousInitialStepId:d,currentStepIndex:m,steps:x});M.current=t,Q.current=v,C!==m&&D(C)},[v,t,m,x]);const Z=a=>{c({...l,...a})},p=x.length,P=p===0?0:(m+1)/p*100,L=f?R==null?void 0:R(f.id):void 0,$=L===void 0?H:L,b=f&&m<p-1?S==null?void 0:S(f.id,l):null,h=o.useCallback(()=>{if(!u)return;const a=O.current,d=V(T.current);if(!(!a||!d)){if(d===a){W(u),w.current=d;return}w.current!==d&&(be(u,{version:J,baseline:a,draft:d,updatedAt:Date.now()}),w.current=d)}},[u]);o.useEffect(()=>{if(!t){_.current=null;return}if(!u){O.current=null,w.current=null;return}const a=V(l);if(!a||_.current===u)return;_.current=u,O.current=a;const d=ve(u);if(d&&d.baseline===a&&d.draft!==a)try{c(JSON.parse(d.draft)),w.current=d.draft;return}catch{W(u)}w.current=a},[u,c,t,l]),o.useEffect(()=>{if(!u||!t||!y())return;const a=window.setInterval(()=>{h()},pe);return()=>window.clearInterval(a)},[u,t,h]),o.useEffect(()=>{A.current&&!t&&h(),A.current=t},[t,h]);const z=a=>{h(),D(a)},K=a=>{a||h(),i(a)};return e.jsx(re,{open:t,onOpenChange:K,children:e.jsxs(se,{children:[e.jsx(ae,{className:"surface-overlay fixed inset-0 z-40 backdrop-blur-xl"}),e.jsxs(ie,{"data-testid":"question-flow-dialog",className:N("surface-modal-panel fixed z-50 flex flex-col overflow-hidden border",Y?"inset-x-3 bottom-3 top-4 rounded-[30px]":"left-1/2 top-1/2 h-[min(52rem,calc(100vh-1rem))] w-[min(56rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 rounded-[34px]",X),children:[e.jsx(le,{className:"sr-only",children:r}),e.jsx(ce,{className:"sr-only",children:s}),e.jsx("div",{className:"sticky top-0 z-10 border-b border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-4 py-2.5 backdrop-blur-xl md:px-6",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:[e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"shrink-0 text-right",children:["Step ",m+1," of ",p]})]}),e.jsx("div",{className:"mt-2 h-1.5 rounded-full bg-[var(--ui-surface-2)]",children:e.jsx(I.div,{className:"h-full rounded-full bg-[linear-gradient(90deg,var(--primary),var(--secondary))]",animate:{width:`${P}%`},transition:{duration:.35,ease:"easeOut"}})})]}),e.jsx(B,{asChild:!0,children:e.jsx(de,{"aria-label":F("common.dialogs.closeDialog")})})]})}),e.jsx("div",{"data-testid":"question-flow-canvas",className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 md:px-6 md:py-5",children:e.jsx(fe,{mode:"wait",children:e.jsx(I.div,{initial:{opacity:0,y:18},animate:{opacity:1,y:0},exit:{opacity:0,y:-18},transition:{duration:.28,ease:"easeOut"},className:"flex min-h-full min-w-0 flex-col gap-5",children:e.jsxs("div",{className:"flex min-h-full min-w-0 flex-col justify-start",children:[f.eyebrow?e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--secondary)]",children:f.eyebrow}):null,e.jsx("h3",{className:"mt-1.5 font-display text-[clamp(1.45rem,2.15vw,2rem)] leading-tight text-[var(--ui-ink-strong)]",children:f.title}),f.description?e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:f.description}):null,$?e.jsx("div",{className:"mt-4 rounded-[20px] border border-[color-mix(in_srgb,var(--danger)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-danger-soft)] px-4 py-3 text-sm leading-6 text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:we($)}):null,e.jsx("div",{className:"mt-5 grid flex-1 content-start gap-5",children:f.render(l,Z)})]})},f.id)})}),e.jsx("div",{className:"sticky bottom-0 border-t border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-4 pt-2.5 pb-[calc(env(safe-area-inset-bottom)+0.75rem)] backdrop-blur-xl md:px-6 md:pb-3",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 sm:justify-between",children:[e.jsx("div",{className:"hidden min-w-0 shrink text-[12px] text-[var(--ui-ink-faint)] sm:block",children:e.jsx("span",{className:"truncate",children:b||`Step ${m+1}/${p}`})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center justify-end gap-1.5 sm:gap-2",children:[m>0?e.jsxs(j,{type:"button",variant:"secondary",className:"min-w-0 px-3 text-[12px]",onClick:()=>z(Math.max(0,m-1)),children:[e.jsx(ee,{className:"size-4"}),"Back"]}):e.jsx(B,{asChild:!0,children:e.jsx(j,{type:"button",variant:"secondary",className:"min-w-0 px-3 text-[12px]",children:F("common.actions.cancel")})}),m<p-1?e.jsxs(j,{type:"button",className:N("min-w-0 px-3 text-[12px]",b?"shadow-[0_0_0_5px_color-mix(in_srgb,var(--primary)_14%,transparent)]":""),onClick:()=>z(Math.min(p-1,m+1)),children:[e.jsx(I.span,{animate:b?{scale:[1,1.04,1],x:[0,1.5,0]}:{scale:1,x:0},transition:b?{duration:1.1,repeat:1/0,ease:"easeInOut"}:{duration:.2},children:"Continue"}),e.jsx(te,{className:"size-4"})]}):e.jsxs(j,{type:"button",className:"min-w-0 px-3 text-[12px]",pending:q,pendingLabel:G,onClick:()=>{h(),g()},children:[e.jsx(ne,{className:"size-4"}),k]})]})]})})]})]})})}export{Re as F,_e as Q,Se as a};
@@ -1 +1 @@
1
- import{j as e,bY as m,aK as b}from"./vendor-y_uz1Wft.js";import{I as h,T as u,B as j}from"./index-Dj8q65se.js";function x(r){return`${r}_${Math.random().toString(36).slice(2,10)}`}function f(){return{id:x("emotion"),emotionDefinitionId:null,label:"",intensity:55,note:""}}function N(){return{id:x("thought"),text:"",parentMode:"",criticMode:"",beliefId:null}}function k(){return{id:x("behavior"),text:"",mode:"",behaviorId:null}}function w(){return{id:x("timeline"),stage:"",modeId:null,label:"",note:""}}function n({title:r,description:t,onAdd:o,addLabel:l}){return e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium text-[var(--ui-ink-strong)]",children:r}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:t})]}),e.jsxs(j,{type:"button",variant:"secondary",size:"sm",onClick:o,children:[e.jsx(m,{className:"size-4"}),l]})]})}function c({onClick:r}){return e.jsx("button",{type:"button",className:"rounded-full bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-faint)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:r,"aria-label":"Remove row",children:e.jsx(b,{className:"size-4"})})}function A({title:r,description:t,addLabel:o,items:l,onChange:i,placeholder:a}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:r,description:t,addLabel:o,onAdd:()=>i([...l,""])}),e.jsx("div",{className:"grid gap-3",children:l.map((s,d)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsx(h,{value:s,onChange:v=>i(l.map((p,g)=>g===d?v.target.value:p)),placeholder:a}),e.jsx(c,{onClick:()=>i(l.filter((v,p)=>p!==d))})]},`${r}-${d}`))})]})}function E({items:r,onChange:t,definitions:o}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:"What emotions were present?",description:"Add one emotion at a time, set the intensity, and note what stood out.",addLabel:"Add emotion",onAdd:()=>t([...r,f()])}),e.jsx("div",{className:"grid gap-3",children:r.map(l=>e.jsxs("div",{className:"grid gap-4 rounded-[24px] border 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",{className:"grid flex-1 gap-4 md:grid-cols-[minmax(0,1fr)_9rem]",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Emotion"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:l.emotionDefinitionId??"",onChange:i=>{const a=o.find(s=>s.id===i.target.value);t(r.map(s=>s.id===l.id?{...s,emotionDefinitionId:i.target.value||null,label:(a==null?void 0:a.label)??s.label}:s))},children:[e.jsx("option",{value:"",children:"Choose or type your own"}),o.map(i=>e.jsx("option",{value:i.id,children:i.label},i.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Intensity"}),e.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[e.jsx("input",{type:"range",min:0,max:100,value:l.intensity,onChange:i=>t(r.map(a=>a.id===l.id?{...a,intensity:Number(i.target.value)}:a))}),e.jsxs("div",{className:"mt-2 text-sm text-[var(--ui-ink-faint)]",children:[l.intensity,"%"]})]})]})]}),e.jsx(c,{onClick:()=>t(r.filter(i=>i.id!==l.id))})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"If the preset is not right, how would you name it?"}),e.jsx(h,{value:l.label,onChange:i=>t(r.map(a=>a.id===l.id?{...a,label:i.target.value}:a)),placeholder:"Tight sadness, panic, shame, relief..."})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"What was notable about this emotion?"}),e.jsx(u,{value:l.note,onChange:i=>t(r.map(a=>a.id===l.id?{...a,note:i.target.value}:a)),placeholder:"Short note about what made this emotion stand out."})]})]},l.id))})]})}function T({items:r,onChange:t,beliefs:o,modes:l}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:"What did your mind start saying?",description:"Capture the thought itself first, then optionally link a belief or mode influence.",addLabel:"Add thought",onAdd:()=>t([...r,N()])}),e.jsx("div",{className:"grid gap-3",children:r.map(i=>e.jsxs("div",{className:"grid gap-4 rounded-[24px] border 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("label",{className:"grid flex-1 gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Thought"}),e.jsx(u,{value:i.text,onChange:a=>t(r.map(s=>s.id===i.id?{...s,text:a.target.value}:s)),placeholder:"What sentence, image, or conclusion showed up?"})]}),e.jsx(c,{onClick:()=>t(r.filter(a=>a.id!==i.id))})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Parent mode influence"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.parentMode,onChange:a=>t(r.map(s=>s.id===i.id?{...s,parentMode:a.target.value}:s)),children:[e.jsx("option",{value:"",children:"None"}),l.map(a=>e.jsx("option",{value:a.title,children:a.title},a.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Critic mode influence"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.criticMode,onChange:a=>t(r.map(s=>s.id===i.id?{...s,criticMode:a.target.value}:s)),children:[e.jsx("option",{value:"",children:"None"}),l.map(a=>e.jsx("option",{value:a.title,children:a.title},a.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Linked belief"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.beliefId??"",onChange:a=>t(r.map(s=>s.id===i.id?{...s,beliefId:a.target.value||null}:s)),children:[e.jsx("option",{value:"",children:"None"}),o.map(a=>e.jsx("option",{value:a.id,children:a.statement},a.id))]})]})]})]},i.id))})]})}function B({items:r,onChange:t,behaviors:o,modes:l}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:"What did you do, or want to do?",description:"Capture the move itself, then optionally link an existing behavior and the mode context around it.",addLabel:"Add behavior",onAdd:()=>t([...r,k()])}),e.jsx("div",{className:"grid gap-3",children:r.map(i=>e.jsxs("div",{className:"grid gap-4 rounded-[24px] border 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("label",{className:"grid flex-1 gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Behavior or urge"}),e.jsx(u,{value:i.text,onChange:a=>t(r.map(s=>s.id===i.id?{...s,text:a.target.value}:s)),placeholder:"What did you do, or what move did you feel pulled toward?"})]}),e.jsx(c,{onClick:()=>t(r.filter(a=>a.id!==i.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 text-[var(--ui-ink-soft)]",children:"Linked existing behavior"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.behaviorId??"",onChange:a=>{const s=o.find(d=>d.id===a.target.value);t(r.map(d=>d.id===i.id?{...d,behaviorId:a.target.value||null,text:s&&!d.text?s.title:d.text}:d))},children:[e.jsx("option",{value:"",children:"None"}),o.map(a=>e.jsx("option",{value:a.id,children:a.title},a.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Mode or urge context"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.mode,onChange:a=>t(r.map(s=>s.id===i.id?{...s,mode:a.target.value}:s)),children:[e.jsx("option",{value:"",children:"None"}),l.map(a=>e.jsx("option",{value:a.title,children:a.title},a.id))]})]})]})]},i.id))})]})}function L({items:r,onChange:t,modes:o,stages:l}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:"How did your state shift through the chain?",description:"Build the mode timeline one moment at a time instead of typing parser syntax.",addLabel:"Add timeline moment",onAdd:()=>t([...r,w()])}),e.jsx("div",{className:"grid gap-3",children:r.map(i=>e.jsxs("div",{className:"grid gap-4 rounded-[24px] border 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",{className:"grid flex-1 gap-4 md:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Stage"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.stage,onChange:a=>t(r.map(s=>s.id===i.id?{...s,stage:a.target.value}:s)),children:[e.jsx("option",{value:"",children:"Choose stage"}),l.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Mode"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.modeId??"",onChange:a=>{const s=o.find(d=>d.id===a.target.value);t(r.map(d=>d.id===i.id?{...d,modeId:a.target.value||null,label:s&&!d.label?s.title:d.label}:d))},children:[e.jsx("option",{value:"",children:"Choose mode"}),o.map(a=>e.jsx("option",{value:a.id,children:a.title},a.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Moment label"}),e.jsx(h,{value:i.label,onChange:a=>t(r.map(s=>s.id===i.id?{...s,label:a.target.value}:s)),placeholder:"What was happening in this moment?"})]})]}),e.jsx(c,{onClick:()=>t(r.filter(a=>a.id!==i.id))})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"What was important about this shift?"}),e.jsx(u,{value:i.note,onChange:a=>t(r.map(s=>s.id===i.id?{...s,note:a.target.value}:s)),placeholder:"Short note about how the mode showed up or what it was protecting."})]})]},i.id))})]})}export{B,E,L as M,A as S,T};
1
+ import{j as e,bY as m,aK as b}from"./vendor-Dgw7UY7q.js";import{I as h,T as u,B as j}from"./index-C0CztQTU.js";function x(r){return`${r}_${Math.random().toString(36).slice(2,10)}`}function f(){return{id:x("emotion"),emotionDefinitionId:null,label:"",intensity:55,note:""}}function N(){return{id:x("thought"),text:"",parentMode:"",criticMode:"",beliefId:null}}function k(){return{id:x("behavior"),text:"",mode:"",behaviorId:null}}function w(){return{id:x("timeline"),stage:"",modeId:null,label:"",note:""}}function n({title:r,description:t,onAdd:o,addLabel:l}){return e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-medium text-[var(--ui-ink-strong)]",children:r}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:t})]}),e.jsxs(j,{type:"button",variant:"secondary",size:"sm",onClick:o,children:[e.jsx(m,{className:"size-4"}),l]})]})}function c({onClick:r}){return e.jsx("button",{type:"button",className:"rounded-full bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-faint)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:r,"aria-label":"Remove row",children:e.jsx(b,{className:"size-4"})})}function A({title:r,description:t,addLabel:o,items:l,onChange:i,placeholder:a}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:r,description:t,addLabel:o,onAdd:()=>i([...l,""])}),e.jsx("div",{className:"grid gap-3",children:l.map((s,d)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsx(h,{value:s,onChange:v=>i(l.map((p,g)=>g===d?v.target.value:p)),placeholder:a}),e.jsx(c,{onClick:()=>i(l.filter((v,p)=>p!==d))})]},`${r}-${d}`))})]})}function E({items:r,onChange:t,definitions:o}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:"What emotions were present?",description:"Add one emotion at a time, set the intensity, and note what stood out.",addLabel:"Add emotion",onAdd:()=>t([...r,f()])}),e.jsx("div",{className:"grid gap-3",children:r.map(l=>e.jsxs("div",{className:"grid gap-4 rounded-[24px] border 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",{className:"grid flex-1 gap-4 md:grid-cols-[minmax(0,1fr)_9rem]",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Emotion"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:l.emotionDefinitionId??"",onChange:i=>{const a=o.find(s=>s.id===i.target.value);t(r.map(s=>s.id===l.id?{...s,emotionDefinitionId:i.target.value||null,label:(a==null?void 0:a.label)??s.label}:s))},children:[e.jsx("option",{value:"",children:"Choose or type your own"}),o.map(i=>e.jsx("option",{value:i.id,children:i.label},i.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Intensity"}),e.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:[e.jsx("input",{type:"range",min:0,max:100,value:l.intensity,onChange:i=>t(r.map(a=>a.id===l.id?{...a,intensity:Number(i.target.value)}:a))}),e.jsxs("div",{className:"mt-2 text-sm text-[var(--ui-ink-faint)]",children:[l.intensity,"%"]})]})]})]}),e.jsx(c,{onClick:()=>t(r.filter(i=>i.id!==l.id))})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"If the preset is not right, how would you name it?"}),e.jsx(h,{value:l.label,onChange:i=>t(r.map(a=>a.id===l.id?{...a,label:i.target.value}:a)),placeholder:"Tight sadness, panic, shame, relief..."})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"What was notable about this emotion?"}),e.jsx(u,{value:l.note,onChange:i=>t(r.map(a=>a.id===l.id?{...a,note:i.target.value}:a)),placeholder:"Short note about what made this emotion stand out."})]})]},l.id))})]})}function T({items:r,onChange:t,beliefs:o,modes:l}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:"What did your mind start saying?",description:"Capture the thought itself first, then optionally link a belief or mode influence.",addLabel:"Add thought",onAdd:()=>t([...r,N()])}),e.jsx("div",{className:"grid gap-3",children:r.map(i=>e.jsxs("div",{className:"grid gap-4 rounded-[24px] border 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("label",{className:"grid flex-1 gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Thought"}),e.jsx(u,{value:i.text,onChange:a=>t(r.map(s=>s.id===i.id?{...s,text:a.target.value}:s)),placeholder:"What sentence, image, or conclusion showed up?"})]}),e.jsx(c,{onClick:()=>t(r.filter(a=>a.id!==i.id))})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Parent mode influence"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.parentMode,onChange:a=>t(r.map(s=>s.id===i.id?{...s,parentMode:a.target.value}:s)),children:[e.jsx("option",{value:"",children:"None"}),l.map(a=>e.jsx("option",{value:a.title,children:a.title},a.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Critic mode influence"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.criticMode,onChange:a=>t(r.map(s=>s.id===i.id?{...s,criticMode:a.target.value}:s)),children:[e.jsx("option",{value:"",children:"None"}),l.map(a=>e.jsx("option",{value:a.title,children:a.title},a.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Linked belief"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.beliefId??"",onChange:a=>t(r.map(s=>s.id===i.id?{...s,beliefId:a.target.value||null}:s)),children:[e.jsx("option",{value:"",children:"None"}),o.map(a=>e.jsx("option",{value:a.id,children:a.statement},a.id))]})]})]})]},i.id))})]})}function B({items:r,onChange:t,behaviors:o,modes:l}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:"What did you do, or want to do?",description:"Capture the move itself, then optionally link an existing behavior and the mode context around it.",addLabel:"Add behavior",onAdd:()=>t([...r,k()])}),e.jsx("div",{className:"grid gap-3",children:r.map(i=>e.jsxs("div",{className:"grid gap-4 rounded-[24px] border 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("label",{className:"grid flex-1 gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Behavior or urge"}),e.jsx(u,{value:i.text,onChange:a=>t(r.map(s=>s.id===i.id?{...s,text:a.target.value}:s)),placeholder:"What did you do, or what move did you feel pulled toward?"})]}),e.jsx(c,{onClick:()=>t(r.filter(a=>a.id!==i.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 text-[var(--ui-ink-soft)]",children:"Linked existing behavior"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.behaviorId??"",onChange:a=>{const s=o.find(d=>d.id===a.target.value);t(r.map(d=>d.id===i.id?{...d,behaviorId:a.target.value||null,text:s&&!d.text?s.title:d.text}:d))},children:[e.jsx("option",{value:"",children:"None"}),o.map(a=>e.jsx("option",{value:a.id,children:a.title},a.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Mode or urge context"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.mode,onChange:a=>t(r.map(s=>s.id===i.id?{...s,mode:a.target.value}:s)),children:[e.jsx("option",{value:"",children:"None"}),l.map(a=>e.jsx("option",{value:a.title,children:a.title},a.id))]})]})]})]},i.id))})]})}function L({items:r,onChange:t,modes:o,stages:l}){return e.jsxs("div",{className:"grid gap-3",children:[e.jsx(n,{title:"How did your state shift through the chain?",description:"Build the mode timeline one moment at a time instead of typing parser syntax.",addLabel:"Add timeline moment",onAdd:()=>t([...r,w()])}),e.jsx("div",{className:"grid gap-3",children:r.map(i=>e.jsxs("div",{className:"grid gap-4 rounded-[24px] border 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",{className:"grid flex-1 gap-4 md:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Stage"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.stage,onChange:a=>t(r.map(s=>s.id===i.id?{...s,stage:a.target.value}:s)),children:[e.jsx("option",{value:"",children:"Choose stage"}),l.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Mode"}),e.jsxs("select",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-strong)]",value:i.modeId??"",onChange:a=>{const s=o.find(d=>d.id===a.target.value);t(r.map(d=>d.id===i.id?{...d,modeId:a.target.value||null,label:s&&!d.label?s.title:d.label}:d))},children:[e.jsx("option",{value:"",children:"Choose mode"}),o.map(a=>e.jsx("option",{value:a.id,children:a.title},a.id))]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Moment label"}),e.jsx(h,{value:i.label,onChange:a=>t(r.map(s=>s.id===i.id?{...s,label:a.target.value}:s)),placeholder:"What was happening in this moment?"})]})]}),e.jsx(c,{onClick:()=>t(r.filter(a=>a.id!==i.id))})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"What was important about this shift?"}),e.jsx(u,{value:i.note,onChange:a=>t(r.map(s=>s.id===i.id?{...s,note:a.target.value}:s)),placeholder:"Short note about how the mode showed up or what it was protecting."})]})]},i.id))})]})}export{B,E,L as M,A as S,T};
@@ -0,0 +1 @@
1
+ import{r as S,j as t,aF as le,dw as ce,aI as J,aG as Z,dx as ee,b8 as de,bH as ue}from"./vendor-Dgw7UY7q.js";import{j as me,i as he,k as pe}from"./state-CkEUXgqt.js";import{d as ke,e5 as ge,aB as fe,bm as ye,e as Ce,a4 as be,B as j,e6 as A,j as N,C as H,c as P,a0 as re,cZ as ve,e7 as xe,e8 as we}from"./index-C0CztQTU.js";import{P as Se}from"./page-hero-ED69y6m0.js";import"./motion-eRlWWQT8.js";import"./ui-CDt36qNz.js";import"./board-Dl7As76Q.js";import"./forms-DznAv9hZ.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"})],Ye=[...Re,...Fe,...Ee,...Ie,...Me,...Ke,...$e,...Le,...Ge,...Oe,...He,...De,...ze,...Be,...We,...Ue];function Xe(){let r=0,l=0,u=0;const d=new Map;return Ye.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=Xe();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 X,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),Y=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=(X=I.data)==null?void 0:X.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||Y.isPending,className:"mt-4 w-full",onClick:()=>{!c||!f||Y.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 +1 @@
1
- import{r as l,j as e}from"./vendor-y_uz1Wft.js";import{C as J,I as c,B as z}from"./index-Dj8q65se.js";const F=[{value:"main_activity",label:"Main activity"},{value:"secondary_activity",label:"Secondary activity"},{value:"third_activity",label:"Third activity"},{value:"rest",label:"Rest"},{value:"holiday",label:"Holiday"},{value:"custom",label:"Custom"}],G=[{value:"busy",label:"Busy"},{value:"free",label:"Free"}],t={allowWorkBlockKinds:[],blockWorkBlockKinds:[],allowCalendarIds:[],blockCalendarIds:[],allowEventTypes:[],blockEventTypes:[],allowEventKeywords:[],blockEventKeywords:[],allowAvailability:[],blockAvailability:[]};function n(r){return r.join(", ")}function d(r){return r.split(",").map(v=>v.trim()).filter(Boolean)}function y({label:r,selected:v,onToggle:a,options:p}){return e.jsxs("div",{className:"grid min-w-0 gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:r}),e.jsx("div",{className:"flex min-w-0 flex-wrap gap-2",children:p.map(o=>{const b=v.includes(o.value);return e.jsx("button",{type:"button",onClick:()=>a(o.value),className:`rounded-full px-3 py-2 text-sm transition ${b?"bg-[var(--ui-accent-soft)] text-[var(--primary)] ring-1 ring-[color-mix(in_srgb,var(--primary)_24%,transparent)]":"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"}`,children:o.label},o.value)})})]})}function Z({title:r,subtitle:v,initialRules:a,initialPlannedDurationSeconds:p,onSave:o,saveLabel:b="Save scheduling rules",allowPlannedDuration:w=!1}){const[k,A]=l.useState((a==null?void 0:a.allowWorkBlockKinds)??t.allowWorkBlockKinds),[g,T]=l.useState((a==null?void 0:a.blockWorkBlockKinds)??t.blockWorkBlockKinds),[i,S]=l.useState((a==null?void 0:a.allowAvailability)??t.allowAvailability),[x,I]=l.useState((a==null?void 0:a.blockAvailability)??t.blockAvailability),[h,W]=l.useState(n((a==null?void 0:a.allowCalendarIds)??t.allowCalendarIds)),[j,_]=l.useState(n((a==null?void 0:a.blockCalendarIds)??t.blockCalendarIds)),[f,M]=l.useState(n((a==null?void 0:a.allowEventTypes)??t.allowEventTypes)),[C,O]=l.useState(n((a==null?void 0:a.blockEventTypes)??t.blockEventTypes)),[E,L]=l.useState(n((a==null?void 0:a.allowEventKeywords)??t.allowEventKeywords)),[N,P]=l.useState(n((a==null?void 0:a.blockEventKeywords)??t.blockEventKeywords)),[B,H]=l.useState(p?String(Math.round(p/60)):"30"),[U,m]=l.useState(!1),Y=l.useMemo(()=>({allowWorkBlockKinds:k,blockWorkBlockKinds:g,allowCalendarIds:d(h),blockCalendarIds:d(j),allowEventTypes:d(f),blockEventTypes:d(C),allowEventKeywords:d(E),blockEventKeywords:d(N),allowAvailability:i,blockAvailability:x}),[i,h,E,f,k,x,j,N,C,g]),V=Object.values(Y).every(s=>s.length===0),u=(s,$,K)=>{$(s.includes(K)?s.filter(q=>q!==K):[...s,K])};return e.jsxs(J,{className:"grid min-w-0 gap-4 overflow-hidden border-[var(--ui-border-subtle)] !bg-[var(--ui-surface-1)]",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:r}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:v})]}),w?e.jsxs("div",{className:"grid min-w-0 gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Planned duration"}),e.jsx(c,{type:"number",min:15,step:15,value:B,onChange:s=>H(s.target.value),placeholder:"30"})]}):null,e.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-2",children:[e.jsx(y,{label:"Allow work blocks",selected:k,onToggle:s=>u(k,A,s),options:F}),e.jsx(y,{label:"Block work blocks",selected:g,onToggle:s=>u(g,T,s),options:F}),e.jsx(y,{label:"Allow availability",selected:i,onToggle:s=>u(i,S,s),options:G}),e.jsx(y,{label:"Block availability",selected:x,onToggle:s=>u(x,I,s),options:G})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Allow calendar ids"}),e.jsx(c,{value:h,onChange:s=>W(s.target.value),placeholder:"calendar_123, primary"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Block calendar ids"}),e.jsx(c,{value:j,onChange:s=>_(s.target.value),placeholder:"calendar_456"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Allow event types"}),e.jsx(c,{value:f,onChange:s=>M(s.target.value),placeholder:"focus, personal"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Block event types"}),e.jsx(c,{value:C,onChange:s=>O(s.target.value),placeholder:"out-of-office, main-work"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Allow event keywords"}),e.jsx(c,{value:E,onChange:s=>L(s.target.value),placeholder:"creative, writing"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Block event keywords"}),e.jsx(c,{value:N,onChange:s=>P(s.target.value),placeholder:"psychiatrist, clinic, rest"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(z,{pending:U,pendingLabel:"Saving",onClick:async()=>{m(!0);try{await o({schedulingRules:V?t:Y,plannedDurationSeconds:w?Math.max(15,Number(B||30))*60:void 0})}finally{m(!1)}},children:b}),e.jsx(z,{variant:"secondary",onClick:async()=>{m(!0);try{A([]),T([]),S([]),I([]),W(""),_(""),M(""),O(""),L(""),P(""),await o({schedulingRules:null,plannedDurationSeconds:w?Math.max(15,Number(B||30))*60:void 0})}finally{m(!1)}},children:"Clear custom rules"})]})]})}export{Z as S};
1
+ import{r as l,j as e}from"./vendor-Dgw7UY7q.js";import{C as J,I as c,B as z}from"./index-C0CztQTU.js";const F=[{value:"main_activity",label:"Main activity"},{value:"secondary_activity",label:"Secondary activity"},{value:"third_activity",label:"Third activity"},{value:"rest",label:"Rest"},{value:"holiday",label:"Holiday"},{value:"custom",label:"Custom"}],G=[{value:"busy",label:"Busy"},{value:"free",label:"Free"}],t={allowWorkBlockKinds:[],blockWorkBlockKinds:[],allowCalendarIds:[],blockCalendarIds:[],allowEventTypes:[],blockEventTypes:[],allowEventKeywords:[],blockEventKeywords:[],allowAvailability:[],blockAvailability:[]};function n(r){return r.join(", ")}function d(r){return r.split(",").map(v=>v.trim()).filter(Boolean)}function y({label:r,selected:v,onToggle:a,options:p}){return e.jsxs("div",{className:"grid min-w-0 gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:r}),e.jsx("div",{className:"flex min-w-0 flex-wrap gap-2",children:p.map(o=>{const b=v.includes(o.value);return e.jsx("button",{type:"button",onClick:()=>a(o.value),className:`rounded-full px-3 py-2 text-sm transition ${b?"bg-[var(--ui-accent-soft)] text-[var(--primary)] ring-1 ring-[color-mix(in_srgb,var(--primary)_24%,transparent)]":"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"}`,children:o.label},o.value)})})]})}function Z({title:r,subtitle:v,initialRules:a,initialPlannedDurationSeconds:p,onSave:o,saveLabel:b="Save scheduling rules",allowPlannedDuration:w=!1}){const[k,A]=l.useState((a==null?void 0:a.allowWorkBlockKinds)??t.allowWorkBlockKinds),[g,T]=l.useState((a==null?void 0:a.blockWorkBlockKinds)??t.blockWorkBlockKinds),[i,S]=l.useState((a==null?void 0:a.allowAvailability)??t.allowAvailability),[x,I]=l.useState((a==null?void 0:a.blockAvailability)??t.blockAvailability),[h,W]=l.useState(n((a==null?void 0:a.allowCalendarIds)??t.allowCalendarIds)),[j,_]=l.useState(n((a==null?void 0:a.blockCalendarIds)??t.blockCalendarIds)),[f,M]=l.useState(n((a==null?void 0:a.allowEventTypes)??t.allowEventTypes)),[C,O]=l.useState(n((a==null?void 0:a.blockEventTypes)??t.blockEventTypes)),[E,L]=l.useState(n((a==null?void 0:a.allowEventKeywords)??t.allowEventKeywords)),[N,P]=l.useState(n((a==null?void 0:a.blockEventKeywords)??t.blockEventKeywords)),[B,H]=l.useState(p?String(Math.round(p/60)):"30"),[U,m]=l.useState(!1),Y=l.useMemo(()=>({allowWorkBlockKinds:k,blockWorkBlockKinds:g,allowCalendarIds:d(h),blockCalendarIds:d(j),allowEventTypes:d(f),blockEventTypes:d(C),allowEventKeywords:d(E),blockEventKeywords:d(N),allowAvailability:i,blockAvailability:x}),[i,h,E,f,k,x,j,N,C,g]),V=Object.values(Y).every(s=>s.length===0),u=(s,$,K)=>{$(s.includes(K)?s.filter(q=>q!==K):[...s,K])};return e.jsxs(J,{className:"grid min-w-0 gap-4 overflow-hidden border-[var(--ui-border-subtle)] !bg-[var(--ui-surface-1)]",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:r}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:v})]}),w?e.jsxs("div",{className:"grid min-w-0 gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Planned duration"}),e.jsx(c,{type:"number",min:15,step:15,value:B,onChange:s=>H(s.target.value),placeholder:"30"})]}):null,e.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-2",children:[e.jsx(y,{label:"Allow work blocks",selected:k,onToggle:s=>u(k,A,s),options:F}),e.jsx(y,{label:"Block work blocks",selected:g,onToggle:s=>u(g,T,s),options:F}),e.jsx(y,{label:"Allow availability",selected:i,onToggle:s=>u(i,S,s),options:G}),e.jsx(y,{label:"Block availability",selected:x,onToggle:s=>u(x,I,s),options:G})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Allow calendar ids"}),e.jsx(c,{value:h,onChange:s=>W(s.target.value),placeholder:"calendar_123, primary"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Block calendar ids"}),e.jsx(c,{value:j,onChange:s=>_(s.target.value),placeholder:"calendar_456"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Allow event types"}),e.jsx(c,{value:f,onChange:s=>M(s.target.value),placeholder:"focus, personal"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Block event types"}),e.jsx(c,{value:C,onChange:s=>O(s.target.value),placeholder:"out-of-office, main-work"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Allow event keywords"}),e.jsx(c,{value:E,onChange:s=>L(s.target.value),placeholder:"creative, writing"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Block event keywords"}),e.jsx(c,{value:N,onChange:s=>P(s.target.value),placeholder:"psychiatrist, clinic, rest"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(z,{pending:U,pendingLabel:"Saving",onClick:async()=>{m(!0);try{await o({schedulingRules:V?t:Y,plannedDurationSeconds:w?Math.max(15,Number(B||30))*60:void 0})}finally{m(!1)}},children:b}),e.jsx(z,{variant:"secondary",onClick:async()=>{m(!0);try{A([]),T([]),S([]),I([]),W(""),_(""),M(""),O(""),L(""),P(""),await o({schedulingRules:null,plannedDurationSeconds:w?Math.max(15,Number(B||30))*60:void 0})}finally{m(!1)}},children:"Clear custom rules"})]})]})}export{Z as S};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-y_uz1Wft.js";import{c as l}from"./index-Dj8q65se.js";import{a as m,b as o}from"./schema-visuals-CvC9a3i6.js";function u({label:s,schemaType:a,compact:n=!1,showType:r=!1,className:t}){const i=o(a);return e.jsxs("span",{className:l("inline-flex max-w-full min-w-0 items-center gap-2 rounded-full border px-3 py-1.5 text-sm leading-tight shadow-[inset_0_1px_0_var(--ui-border-subtle)]",n?"min-h-8":"min-h-9",i.badgeTone,t),children:[r?e.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-soft)]",children:m(a)}):null,e.jsx("span",{className:"min-w-0 break-words whitespace-normal",children:s})]})}export{u as S};
1
+ import{j as e}from"./vendor-Dgw7UY7q.js";import{c as l}from"./index-C0CztQTU.js";import{a as m,b as o}from"./schema-visuals-CvC9a3i6.js";function u({label:s,schemaType:a,compact:n=!1,showType:r=!1,className:t}){const i=o(a);return e.jsxs("span",{className:l("inline-flex max-w-full min-w-0 items-center gap-2 rounded-full border px-3 py-1.5 text-sm leading-tight shadow-[inset_0_1px_0_var(--ui-border-subtle)]",n?"min-h-8":"min-h-9",i.badgeTone,t),children:[r?e.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-soft)]",children:m(a)}):null,e.jsx("span",{className:"min-w-0 break-words whitespace-normal",children:s})]})}export{u as S};
@@ -1 +1 @@
1
- import{ck as I,cl as f}from"./index-Dj8q65se.js";import{o as t,a as i,s as e,c as r,e as n,l,b as a,Z as d,n as k}from"./forms-DhEGHkFR.js";const T=n(["en","fr"]),x=n(["dark-fantasy","dramatic-smithie","mind-locksmith"]),c=t({contentMarkdown:e().trim().min(1,"Note content is required"),author:e().trim()}),v=t({title:e().trim().min(1,"Title is required"),description:e().trim(),horizon:n(["quarter","year","lifetime"]),status:n(["active","paused","completed"]),userId:e().trim().nullable().optional(),targetPoints:r.number().int().min(25).max(1e4),themeColor:e().trim().regex(/^#[0-9a-fA-F]{6}$/,"Theme color must be a valid hex value"),tagIds:i(e()),notes:i(c)}),w=t({goalId:e().trim().min(1,"Life goal is required"),title:e().trim().min(1,"Title is required"),description:e().trim(),status:n(["active","paused","completed"]),workflowStatus:n(["backlog","focus","in_progress","blocked","done"]),userId:e().trim().nullable().optional(),assigneeUserIds:i(e().trim()),targetPoints:r.number().int().min(25).max(1e4),themeColor:e().trim().regex(/^#[0-9a-fA-F]{6}$/,"Theme color must be a valid hex value"),productRequirementsDocument:e().trim(),notes:i(c)}),C=t({profile:t({operatorName:e().trim().min(1,"Name is required"),operatorEmail:e().trim().min(1,"Email is required"),operatorTitle:e().trim().min(1,"Title is required")}),notifications:t({goalDriftAlerts:a(),dailyQuestReminders:a(),achievementCelebrations:a()}),execution:t({maxActiveTasks:r.number().int().min(1).max(8),timeAccountingMode:n(["split","parallel","primary_only"])}),themePreference:I,gamificationTheme:x.default("dramatic-smithie"),customTheme:f.nullable().optional(),localePreference:T,calendarProviders:t({google:t({clientId:e().trim().optional(),clientSecret:e().trim().optional(),storedClientId:e().optional(),storedClientSecret:e().optional(),appBaseUrl:e().optional(),redirectUri:e().optional(),allowedOrigins:i(e()).optional(),usesPkce:l(!0).optional(),requiresServerClientSecret:l(!1).optional(),oauthClientType:l("desktop_app").optional(),authMode:l("localhost_pkce").optional(),isConfigured:a().optional(),isReadyForPairing:a().optional(),isLocalOnly:l(!0).optional(),runtimeOrigin:e().optional(),setupMessage:e().optional()}).optional(),microsoft:t({clientId:e().trim(),tenantId:e().trim(),redirectUri:e().trim()}).optional()}).optional().superRefine((o,s)=>{var g,h;const m=o==null?void 0:o.google;if(!m)return;const u=m.clientId!==void 0,b=m.clientSecret!==void 0,p=(((g=m.clientId)==null?void 0:g.length)??0)>0,y=(((h=m.clientSecret)==null?void 0:h.length)??0)>0;if(u!==b){s.addIssue({code:d.custom,path:["google",u?"clientSecret":"clientId"],message:"Provide both the Google client ID and client secret together, or clear both together."});return}p!==y&&s.addIssue({code:d.custom,path:["google",p?"clientSecret":"clientId"],message:"Provide both the Google client ID and client secret together, or clear both together."})}),modelSettings:t({forgeAgent:t({basicChat:t({connectionId:e().trim().nullable().optional(),model:e().trim().optional()}).optional(),wiki:t({connectionId:e().trim().nullable().optional(),model:e().trim().optional()}).optional()}).optional()}).optional()}),P=t({label:e().trim().min(1,"Label is required"),agentLabel:e().trim().min(1,"Agent name is required"),agentType:e().trim().min(1,"Agent type is required"),description:e().trim(),trustLevel:n(["standard","trusted","autonomous"]),autonomyMode:n(["approval_required","scoped_write","autonomous"]),approvalMode:n(["approval_by_default","high_impact_only","none"]),scopes:i(e().trim().min(1)).min(1),bootstrapPolicy:t({mode:n(["disabled","active_only","scoped","full"]),goalsLimit:r.number().int().min(0).max(100),projectsLimit:r.number().int().min(0).max(100),tasksLimit:r.number().int().min(0).max(100),habitsLimit:r.number().int().min(0).max(100),strategiesLimit:r.number().int().min(0).max(100),peoplePageLimit:r.number().int().min(0).max(50),includePeoplePages:a()}),scopePolicy:t({userIds:i(e().trim().min(1)),projectIds:i(e().trim().min(1)),tagIds:i(e().trim().min(1))})}),L=t({originType:n(["system","user","agent"]),originAgentId:e().trim(),originLabel:e().trim(),entityType:e().trim(),entityId:e().trim(),timeframeLabel:e().trim(),title:e().trim().min(1,"Title is required"),summary:e().trim().min(1,"Summary is required"),recommendation:e().trim().min(1,"Recommendation is required"),rationale:e().trim(),confidence:r.number().min(0).max(1),ctaLabel:e().trim().min(1,"CTA label is required")}),M=t({title:e().trim().min(1,"Title is required"),description:e().trim(),level:n(["issue","task","subtask"]),owner:e().trim().min(1,"Owner is required"),userId:e().trim().nullable().optional(),assigneeUserIds:i(e().trim()),goalId:e().trim(),projectId:e().trim().min(1,"Project is required"),parentWorkItemId:e().trim().nullable().optional(),priority:n(["low","medium","high","critical"]),status:n(["backlog","focus","in_progress","blocked","done"]),effort:n(["light","deep","marathon"]),energy:n(["low","steady","high"]),dueDate:e().trim(),points:r.number().int().min(5).max(500),plannedDurationSeconds:r.number().int().min(60).max(7*86400).nullable().optional(),actionCostBand:n(["tiny","light","standard","heavy","brutal"]).optional(),aiInstructions:e().trim(),executionMode:n(["afk","hitl"]).nullable().optional(),acceptanceCriteria:i(e().trim()),blockerLinks:i(t({entityType:e().trim().min(1),entityId:e().trim().min(1),label:e().trim().optional()})),completionReport:t({modifiedFiles:i(e().trim()),workSummary:e().trim(),linkedGitRefIds:i(e().trim())}).nullable().optional(),gitRefs:i(t({id:e().trim().min(1).optional(),workItemId:e().trim().optional(),refType:n(["commit","branch","pull_request"]),provider:e().trim().default("git"),repository:e().trim().default(""),refValue:e().trim().min(1),url:e().trim().url().nullable().optional(),displayTitle:e().trim().default("")})).default([]),tagIds:i(e()),notes:i(c)}),A=t({title:e().trim().min(1,"Title is required"),description:e().trim(),status:n(["active","paused","archived"]),userId:e().trim().nullable().optional(),polarity:n(["positive","negative"]),frequency:n(["daily","weekly"]),targetCount:r.number().int().min(1).max(14),weekDays:i(k().int().min(0).max(6)).max(7),linkedGoalIds:i(e().trim().min(1)),linkedProjectIds:i(e().trim().min(1)),linkedTaskIds:i(e().trim().min(1)),linkedValueIds:i(e().trim().min(1)),linkedPatternIds:i(e().trim().min(1)),linkedBehaviorIds:i(e().trim().min(1)),linkedBeliefIds:i(e().trim().min(1)),linkedModeIds:i(e().trim().min(1)),linkedReportIds:i(e().trim().min(1)),linkedBehaviorId:e().trim(),rewardXp:r.number().int().min(1).max(100),penaltyXp:r.number().int().min(1).max(100),generatedHealthEventTemplate:t({enabled:a(),workoutType:e().trim(),title:e().trim(),durationMinutes:r.number().int().min(1).max(1440),xpReward:r.number().int().min(0).max(500),tags:i(e().trim()),links:i(t({entityType:e().trim().min(1),entityId:e().trim().min(1),relationshipType:e().trim().default("context")})),notesTemplate:e().trim()})}).superRefine((o,s)=>{o.frequency==="weekly"&&o.weekDays.length===0&&s.addIssue({code:d.custom,path:["weekDays"],message:"Pick at least one weekday"})}),_=t({entityType:n(["task","project"]),entityId:e().trim().min(1,"A target is required"),deltaMinutes:r.number().int().refine(o=>o!==0,"Minutes must not be zero"),note:e().trim()});t({name:e().trim().min(1,"Name is required"),kind:n(["value","category","execution"]),userId:e().trim().nullable().optional(),color:e().trim().regex(/^#[0-9a-fA-F]{6}$/,"Color must be a valid hex value"),description:e().trim()});export{P as a,L as c,v as g,A as h,w as p,M as q,C as s,_ as w};
1
+ import{cm as I,cn as f}from"./index-C0CztQTU.js";import{o as t,a as i,s as e,c as r,e as n,l,b as a,Z as d,n as k}from"./forms-DznAv9hZ.js";const T=n(["en","fr"]),x=n(["dark-fantasy","dramatic-smithie","mind-locksmith"]),c=t({contentMarkdown:e().trim().min(1,"Note content is required"),author:e().trim()}),v=t({title:e().trim().min(1,"Title is required"),description:e().trim(),horizon:n(["quarter","year","lifetime"]),status:n(["active","paused","completed"]),userId:e().trim().nullable().optional(),targetPoints:r.number().int().min(25).max(1e4),themeColor:e().trim().regex(/^#[0-9a-fA-F]{6}$/,"Theme color must be a valid hex value"),tagIds:i(e()),notes:i(c)}),w=t({goalId:e().trim().min(1,"Life goal is required"),title:e().trim().min(1,"Title is required"),description:e().trim(),status:n(["active","paused","completed"]),workflowStatus:n(["backlog","focus","in_progress","blocked","done"]),userId:e().trim().nullable().optional(),assigneeUserIds:i(e().trim()),targetPoints:r.number().int().min(25).max(1e4),themeColor:e().trim().regex(/^#[0-9a-fA-F]{6}$/,"Theme color must be a valid hex value"),productRequirementsDocument:e().trim(),notes:i(c)}),C=t({profile:t({operatorName:e().trim().min(1,"Name is required"),operatorEmail:e().trim().min(1,"Email is required"),operatorTitle:e().trim().min(1,"Title is required")}),notifications:t({goalDriftAlerts:a(),dailyQuestReminders:a(),achievementCelebrations:a()}),execution:t({maxActiveTasks:r.number().int().min(1).max(8),timeAccountingMode:n(["split","parallel","primary_only"])}),themePreference:I,gamificationTheme:x.default("dramatic-smithie"),customTheme:f.nullable().optional(),localePreference:T,calendarProviders:t({google:t({clientId:e().trim().optional(),clientSecret:e().trim().optional(),storedClientId:e().optional(),storedClientSecret:e().optional(),appBaseUrl:e().optional(),redirectUri:e().optional(),allowedOrigins:i(e()).optional(),usesPkce:l(!0).optional(),requiresServerClientSecret:l(!1).optional(),oauthClientType:l("desktop_app").optional(),authMode:l("localhost_pkce").optional(),isConfigured:a().optional(),isReadyForPairing:a().optional(),isLocalOnly:l(!0).optional(),runtimeOrigin:e().optional(),setupMessage:e().optional()}).optional(),microsoft:t({clientId:e().trim(),tenantId:e().trim(),redirectUri:e().trim()}).optional()}).optional().superRefine((o,s)=>{var g,h;const m=o==null?void 0:o.google;if(!m)return;const u=m.clientId!==void 0,b=m.clientSecret!==void 0,p=(((g=m.clientId)==null?void 0:g.length)??0)>0,y=(((h=m.clientSecret)==null?void 0:h.length)??0)>0;if(u!==b){s.addIssue({code:d.custom,path:["google",u?"clientSecret":"clientId"],message:"Provide both the Google client ID and client secret together, or clear both together."});return}p!==y&&s.addIssue({code:d.custom,path:["google",p?"clientSecret":"clientId"],message:"Provide both the Google client ID and client secret together, or clear both together."})}),modelSettings:t({forgeAgent:t({basicChat:t({connectionId:e().trim().nullable().optional(),model:e().trim().optional()}).optional(),wiki:t({connectionId:e().trim().nullable().optional(),model:e().trim().optional()}).optional()}).optional()}).optional()}),P=t({label:e().trim().min(1,"Label is required"),agentLabel:e().trim().min(1,"Agent name is required"),agentType:e().trim().min(1,"Agent type is required"),description:e().trim(),trustLevel:n(["standard","trusted","autonomous"]),autonomyMode:n(["approval_required","scoped_write","autonomous"]),approvalMode:n(["approval_by_default","high_impact_only","none"]),scopes:i(e().trim().min(1)).min(1),bootstrapPolicy:t({mode:n(["disabled","active_only","scoped","full"]),goalsLimit:r.number().int().min(0).max(100),projectsLimit:r.number().int().min(0).max(100),tasksLimit:r.number().int().min(0).max(100),habitsLimit:r.number().int().min(0).max(100),strategiesLimit:r.number().int().min(0).max(100),peoplePageLimit:r.number().int().min(0).max(50),includePeoplePages:a()}),scopePolicy:t({userIds:i(e().trim().min(1)),projectIds:i(e().trim().min(1)),tagIds:i(e().trim().min(1))})}),L=t({originType:n(["system","user","agent"]),originAgentId:e().trim(),originLabel:e().trim(),entityType:e().trim(),entityId:e().trim(),timeframeLabel:e().trim(),title:e().trim().min(1,"Title is required"),summary:e().trim().min(1,"Summary is required"),recommendation:e().trim().min(1,"Recommendation is required"),rationale:e().trim(),confidence:r.number().min(0).max(1),ctaLabel:e().trim().min(1,"CTA label is required")}),M=t({title:e().trim().min(1,"Title is required"),description:e().trim(),level:n(["issue","task","subtask"]),owner:e().trim().min(1,"Owner is required"),userId:e().trim().nullable().optional(),assigneeUserIds:i(e().trim()),goalId:e().trim(),projectId:e().trim().min(1,"Project is required"),parentWorkItemId:e().trim().nullable().optional(),priority:n(["low","medium","high","critical"]),status:n(["backlog","focus","in_progress","blocked","done"]),effort:n(["light","deep","marathon"]),energy:n(["low","steady","high"]),dueDate:e().trim(),points:r.number().int().min(5).max(500),plannedDurationSeconds:r.number().int().min(60).max(7*86400).nullable().optional(),actionCostBand:n(["tiny","light","standard","heavy","brutal"]).optional(),aiInstructions:e().trim(),executionMode:n(["afk","hitl"]).nullable().optional(),acceptanceCriteria:i(e().trim()),blockerLinks:i(t({entityType:e().trim().min(1),entityId:e().trim().min(1),label:e().trim().optional()})),completionReport:t({modifiedFiles:i(e().trim()),workSummary:e().trim(),linkedGitRefIds:i(e().trim())}).nullable().optional(),gitRefs:i(t({id:e().trim().min(1).optional(),workItemId:e().trim().optional(),refType:n(["commit","branch","pull_request"]),provider:e().trim().default("git"),repository:e().trim().default(""),refValue:e().trim().min(1),url:e().trim().url().nullable().optional(),displayTitle:e().trim().default("")})).default([]),tagIds:i(e()),notes:i(c)}),A=t({title:e().trim().min(1,"Title is required"),description:e().trim(),status:n(["active","paused","archived"]),userId:e().trim().nullable().optional(),polarity:n(["positive","negative"]),frequency:n(["daily","weekly"]),targetCount:r.number().int().min(1).max(14),weekDays:i(k().int().min(0).max(6)).max(7),linkedGoalIds:i(e().trim().min(1)),linkedProjectIds:i(e().trim().min(1)),linkedTaskIds:i(e().trim().min(1)),linkedValueIds:i(e().trim().min(1)),linkedPatternIds:i(e().trim().min(1)),linkedBehaviorIds:i(e().trim().min(1)),linkedBeliefIds:i(e().trim().min(1)),linkedModeIds:i(e().trim().min(1)),linkedReportIds:i(e().trim().min(1)),linkedBehaviorId:e().trim(),rewardXp:r.number().int().min(1).max(100),penaltyXp:r.number().int().min(1).max(100),generatedHealthEventTemplate:t({enabled:a(),workoutType:e().trim(),title:e().trim(),durationMinutes:r.number().int().min(1).max(1440),xpReward:r.number().int().min(0).max(500),tags:i(e().trim()),links:i(t({entityType:e().trim().min(1),entityId:e().trim().min(1),relationshipType:e().trim().default("context")})),notesTemplate:e().trim()})}).superRefine((o,s)=>{o.frequency==="weekly"&&o.weekDays.length===0&&s.addIssue({code:d.custom,path:["weekDays"],message:"Pick at least one weekday"})}),_=t({entityType:n(["task","project"]),entityId:e().trim().min(1,"A target is required"),deltaMinutes:r.number().int().refine(o=>o!==0,"Minutes must not be zero"),note:e().trim()});t({name:e().trim().min(1,"Name is required"),kind:n(["value","category","execution"]),userId:e().trim().nullable().optional(),color:e().trim().regex(/^#[0-9a-fA-F]{6}$/,"Color must be a valid hex value"),description:e().trim()});export{P as a,L as c,v as g,A as h,w as p,M as q,C as s,_ as w};