forge-openclaw-plugin 0.2.101 → 0.2.102

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 (188) hide show
  1. package/dist/assets/{activity-page-CpjuNSHw.js → activity-page-CgF7K2ww.js} +1 -1
  2. package/dist/assets/ai-surface-workspace-xtB5RFQu.js +1 -0
  3. package/dist/assets/atlas-panel-B3dPHCmZ.js +1 -0
  4. package/dist/assets/{board-BkDRaMp6.js → board-DqHzdCPQ.js} +1 -1
  5. package/dist/assets/{calendar-page-DNNt6lfz.js → calendar-page-C1Wfd2Fy.js} +1 -1
  6. package/dist/assets/{calendar-rules-DNJFNsxi.js → calendar-rules-CaZXtlxt.js} +1 -1
  7. package/dist/assets/calendar-week-toolbar-BZ_-X3Wb.js +1 -0
  8. package/dist/assets/{charts-P7EVhIog.js → charts-FcU0F3XV.js} +8 -8
  9. package/dist/assets/{companion-sync-lab-page-KxEDigM6.js → companion-sync-lab-page-NgeK-O-P.js} +1 -1
  10. package/dist/assets/daily-metrics-dashboard-BMyL0Qr4.js +1 -0
  11. package/dist/assets/{entity-note-count-link-DrhjJZ4i.js → entity-note-count-link-BrS1-O0o.js} +1 -1
  12. package/dist/assets/entity-notes-surface-CBylYDwy.js +1 -0
  13. package/dist/assets/{execution-board-D07gOocB.js → execution-board-CpO2ch6v.js} +1 -1
  14. package/dist/assets/faceted-token-search-D7xPWfOl.js +1 -0
  15. package/dist/assets/flagship-signal-deck-BEFKOhvx.js +1 -0
  16. package/dist/assets/{floating-action-menu-Fs_ZiUMo.js → floating-action-menu-zzC2r0Ob.js} +1 -1
  17. package/dist/assets/{forms-BFlTgZ3W.js → forms-CmLAyGqz.js} +1 -1
  18. package/dist/assets/{goal-detail-page-CqLiNz4f.js → goal-detail-page-JK_Nva8e.js} +1 -1
  19. package/dist/assets/goals-page-yeoJ06Vw.js +1 -0
  20. package/dist/assets/{graph-D6JLqDbD.js → graph-BTa79qum.js} +14 -14
  21. package/dist/assets/{habits-page-BJxagdzx.js → habits-page-Dx5EhkJi.js} +1 -1
  22. package/dist/assets/index-BHIKoiZ6.js +19 -0
  23. package/dist/assets/index-H8R-ABM3.css +1 -0
  24. package/dist/assets/insight-flow-dialog-BtIQXXsS.js +1 -0
  25. package/dist/assets/{insights-page-D6rOa7uk.js → insights-page-CujrosD_.js} +1 -1
  26. package/dist/assets/{kanban-page-XQ7Se6dH.js → kanban-page-Q9NuIz5w.js} +1 -1
  27. package/dist/assets/knowledge-graph-page-DaJmlvvM.js +1 -0
  28. package/dist/assets/{life-force-page-Dy0JTS2G.js → life-force-page-BGDkKfbJ.js} +1 -1
  29. package/dist/assets/{life-force-workspace-OfyB9HJM.js → life-force-workspace-CLVexVnb.js} +1 -1
  30. package/dist/assets/{maps-ClgJoCjz.js → maps-CF1RagUX.js} +1 -1
  31. package/dist/assets/metric-tile-4iMd_WnJ.js +1 -0
  32. package/dist/assets/{motion-BeD44FeG.js → motion-CfdU2F35.js} +1 -1
  33. package/dist/assets/movement-page-ClaoTNuX.js +1 -0
  34. package/dist/assets/note-markdown-CsGQhQXF.js +3 -0
  35. package/dist/assets/note-tags-input-DdZi93tj.js +1 -0
  36. package/dist/assets/notes-page-DYI8s3NN.js +1 -0
  37. package/dist/assets/{open-in-graph-button-IXe9SGth.js → open-in-graph-button-C0TGev7c.js} +1 -1
  38. package/dist/assets/orbit-map-DVXkfQdd.js +1 -0
  39. package/dist/assets/overview-page-BwMlFQKX.js +1 -0
  40. package/dist/assets/page-hero-oFHaAjtL.js +1 -0
  41. package/dist/assets/pill-cluster-7UZd_lHp.js +1 -0
  42. package/dist/assets/{preference-entity-handoff-button-5PzUn42S.js → preference-entity-handoff-button-DOKV9bZc.js} +1 -1
  43. package/dist/assets/preferences-page-BrKEkmfD.js +1 -0
  44. package/dist/assets/{project-collections-xPz2mlRr.js → project-collections-CZagCmeH.js} +1 -1
  45. package/dist/assets/{project-detail-page-BXK5-4xW.js → project-detail-page-DogvVNEn.js} +1 -1
  46. package/dist/assets/{project-management-hierarchy-page-DtRpMABw.js → project-management-hierarchy-page-Dr7hW9PW.js} +1 -1
  47. package/dist/assets/{project-management-section-nav-P3ixzPa-.js → project-management-section-nav-BLdAgTge.js} +1 -1
  48. package/dist/assets/{projects-page-C5ViRuf4.js → projects-page-UKrby_5-.js} +1 -1
  49. package/dist/assets/psyche-behaviors-page-BeVlXvbj.js +5 -0
  50. package/dist/assets/psyche-flashcards-page-CqAWCO4E.js +1 -0
  51. package/dist/assets/psyche-goal-map-page-IyNnbk_W.js +1 -0
  52. package/dist/assets/psyche-graph-IkUQRaDK.js +1 -0
  53. package/dist/assets/{psyche-metrics-page-CuR9oqEy.js → psyche-metrics-page-uai0a7Lx.js} +1 -1
  54. package/dist/assets/psyche-mode-guide-page-C7p-ABiF.js +1 -0
  55. package/dist/assets/psyche-modes-page-CLQ5V3w0.js +1 -0
  56. package/dist/assets/psyche-page-NQBHkkpU.js +1 -0
  57. package/dist/assets/psyche-patterns-page-BkRiNpI_.js +5 -0
  58. package/dist/assets/psyche-questionnaire-builder-page-Du-7HwPC.js +1 -0
  59. package/dist/assets/psyche-questionnaire-detail-page-C5-yf8MF.js +1 -0
  60. package/dist/assets/psyche-questionnaire-run-detail-page-CoSH5O6R.js +1 -0
  61. package/dist/assets/psyche-questionnaire-run-page-ChI7c1wy.js +1 -0
  62. package/dist/assets/psyche-questionnaires-page-xUcJJzbI.js +1 -0
  63. package/dist/assets/psyche-report-detail-page-BPrZCFZS.js +3 -0
  64. package/dist/assets/psyche-reports-page-D2EXJmm6.js +1 -0
  65. package/dist/assets/{psyche-schemas-HFmg37Wj.js → psyche-schemas-RcZYaokx.js} +1 -1
  66. package/dist/assets/psyche-schemas-beliefs-page-h0ooZ1lp.js +9 -0
  67. package/dist/assets/psyche-screen-time-page-_3-4LikV.js +1 -0
  68. package/dist/assets/psyche-self-observation-page-BdbCsgR5.js +1 -0
  69. package/dist/assets/psyche-values-page-DuUVki5e.js +5 -0
  70. package/dist/assets/report-chain-fields-BBMz0sGI.js +1 -0
  71. package/dist/assets/{rewards-page-DmC4R_Ps.js → rewards-page-PZFPa6rR.js} +1 -1
  72. package/dist/assets/{scheduling-rules-editor-D02s70hr.js → scheduling-rules-editor-B9KNKsQz.js} +1 -1
  73. package/dist/assets/schema-badge-D93RcG36.js +1 -0
  74. package/dist/assets/schema-visuals-CvC9a3i6.js +1 -0
  75. package/dist/assets/select-menu-Cdq7foRu.js +1 -0
  76. package/dist/assets/{settings-agents-page-C_v_hMJF.js → settings-agents-page-DPx2F6wf.js} +3 -3
  77. package/dist/assets/{settings-bin-page-DY5bg81n.js → settings-bin-page-COwP3gjo.js} +1 -1
  78. package/dist/assets/settings-calendar-page-C-ghE0YT.js +5 -0
  79. package/dist/assets/{settings-data-page-CHRQFU9H.js → settings-data-page-CBubzKBw.js} +1 -1
  80. package/dist/assets/{settings-logs-page-B04pUwEv.js → settings-logs-page-uOuXMeBm.js} +1 -1
  81. package/dist/assets/{settings-mobile-page-D9kTlYDS.js → settings-mobile-page-C5rfj8_r.js} +1 -1
  82. package/dist/assets/settings-models-page-DijmUWdU.js +1 -0
  83. package/dist/assets/{settings-page-DYDTFlnv.js → settings-page-B4u5TR5g.js} +1 -1
  84. package/dist/assets/{settings-rewards-page-cl4vqqO_.js → settings-rewards-page-COiTwkMH.js} +1 -1
  85. package/dist/assets/{settings-section-nav-DSOuht_F.js → settings-section-nav-Dc4IeVBt.js} +1 -1
  86. package/dist/assets/{settings-users-page-BU79JB_T.js → settings-users-page-DEGa5DNn.js} +1 -1
  87. package/dist/assets/settings-wiki-page-Cvsiz5_e.js +1 -0
  88. package/dist/assets/{sleep-page-D8NbdhyS.js → sleep-page-BnSOwkEU.js} +1 -1
  89. package/dist/assets/{sports-page-CV4Cnzwn.js → sports-page-l1RqXzA_.js} +1 -1
  90. package/dist/assets/{state-B-4sS1xO.js → state-VYvD1QVP.js} +1 -1
  91. package/dist/assets/{strategies-page-C4qvXnql.js → strategies-page-DEnPlpAs.js} +1 -1
  92. package/dist/assets/{strategy-detail-page-DJLo5rfy.js → strategy-detail-page-Ls8bxKeH.js} +1 -1
  93. package/dist/assets/strategy-dialog-DMyRKrWf.js +1 -0
  94. package/dist/assets/surface-Bfz_sLX6.js +1 -0
  95. package/dist/assets/{table-WfAPUppN.js → table-C0VTeqw0.js} +1 -1
  96. package/dist/assets/task-detail-page-CgrYgQLD.js +1 -0
  97. package/dist/assets/{timebox-planning-dialog-DB6FLqmI.js → timebox-planning-dialog-Ww0NGLLo.js} +1 -1
  98. package/dist/assets/today-page-CIuFHMi1.js +1 -0
  99. package/dist/assets/training-load-page-BIwc648i.js +1 -0
  100. package/dist/assets/{ui-C13Nbgas.js → ui-CsEkP2V8.js} +4 -4
  101. package/dist/assets/use-psyche-focus-target-qxT5Oy_z.js +1 -0
  102. package/dist/assets/{vendor-DHkYh85p.js → vendor-kIz9EZnX.js} +237 -222
  103. package/dist/assets/{vitals-page-qre17Nw8.js → vitals-page-Dz1Jt5H8.js} +1 -1
  104. package/dist/assets/{weekly-review-page-Cz4vkRcx.js → weekly-review-page-BFpBe1kI.js} +1 -1
  105. package/dist/assets/weight-loss-page-BgMoBpBt.js +5 -0
  106. package/dist/assets/{wiki-article-markdown-DdiR2TJE.js → wiki-article-markdown-gsPTXTg1.js} +1 -1
  107. package/dist/assets/{wiki-editor-page-DqwoqVFb.js → wiki-editor-page-BpAZHooY.js} +7 -7
  108. package/dist/assets/{wiki-ingest-history-page--evBLbOw.js → wiki-ingest-history-page-C-ig8O22.js} +1 -1
  109. package/dist/assets/{wiki-ingest-modal--ohzFnj2.js → wiki-ingest-modal-BK4eQgqs.js} +1 -1
  110. package/dist/assets/{wiki-page-B_VJFBPA.js → wiki-page-CMTZ60Zt.js} +1 -1
  111. package/dist/assets/workbench-flow-page-BIpWUcLJ.js +5 -0
  112. package/dist/assets/workbench-page-CtCjYSRe.js +1 -0
  113. package/dist/assets/workout-detail-page-DD9IGN6l.js +2 -0
  114. package/dist/index.html +9 -9
  115. package/dist/openclaw/local-runtime.js +41 -14
  116. package/dist/server/server/migrations/067_weight_loss_daily_active_overrides.sql +13 -0
  117. package/dist/server/server/src/app.js +103 -30
  118. package/dist/server/server/src/health-weight-loss.js +457 -55
  119. package/dist/server/server/src/health.js +12 -4
  120. package/dist/server/server/src/movement.js +84 -1
  121. package/dist/server/server/src/openapi.js +123 -18
  122. package/dist/server/server/src/repositories/model-settings.js +12 -9
  123. package/dist/server/server/src/repositories/settings.js +19 -5
  124. package/dist/server/src/components/ui/info-tooltip.js +6 -6
  125. package/dist/server/src/lib/api.js +14 -4
  126. package/dist/server/src/lib/theme-system.js +8 -0
  127. package/openclaw.plugin.json +1 -1
  128. package/package.json +3 -3
  129. package/server/migrations/067_weight_loss_daily_active_overrides.sql +13 -0
  130. package/skills/forge-openclaw/SKILL.md +13 -0
  131. package/skills/forge-openclaw/entity_conversation_playbooks.md +7 -1
  132. package/dist/assets/ai-surface-workspace-DEAFZruS.js +0 -1
  133. package/dist/assets/atlas-panel-CdVNPotj.js +0 -1
  134. package/dist/assets/calendar-week-toolbar-BbPwYeN0.js +0 -1
  135. package/dist/assets/daily-metrics-dashboard-B3cqJgDt.js +0 -1
  136. package/dist/assets/entity-notes-surface-CkcRsKJQ.js +0 -1
  137. package/dist/assets/faceted-token-search-BxRRcM3q.js +0 -1
  138. package/dist/assets/flagship-signal-deck-cmy82b8_.js +0 -1
  139. package/dist/assets/goals-page-BTk7mg_T.js +0 -1
  140. package/dist/assets/index-CF4J4R9L.js +0 -19
  141. package/dist/assets/index-CZbuZQjw.css +0 -1
  142. package/dist/assets/insight-flow-dialog-8f3D0GuC.js +0 -1
  143. package/dist/assets/knowledge-graph-page-BtAg8iv3.js +0 -1
  144. package/dist/assets/metric-tile-DKpo-8xw.js +0 -1
  145. package/dist/assets/movement-page-Bg_T_Stx.js +0 -1
  146. package/dist/assets/note-markdown-N-uxD3Xt.js +0 -3
  147. package/dist/assets/note-tags-input-Cdu7wiw6.js +0 -1
  148. package/dist/assets/notes-page-CKXnF_KU.js +0 -1
  149. package/dist/assets/orbit-map-Dzi6KliQ.js +0 -1
  150. package/dist/assets/overview-page-1miYqaVS.js +0 -1
  151. package/dist/assets/page-hero-DRy5b2MU.js +0 -1
  152. package/dist/assets/pill-cluster-C9QczVJ2.js +0 -1
  153. package/dist/assets/preferences-page-DtNaF5Q3.js +0 -1
  154. package/dist/assets/psyche-behaviors-page-Dco46sC4.js +0 -5
  155. package/dist/assets/psyche-flashcards-page-ZcoEB8gV.js +0 -1
  156. package/dist/assets/psyche-goal-map-page-CLBAQOI0.js +0 -1
  157. package/dist/assets/psyche-graph-k4tX2tdp.js +0 -1
  158. package/dist/assets/psyche-mode-guide-page-hIVXcCnE.js +0 -1
  159. package/dist/assets/psyche-modes-page-0lYtBlhO.js +0 -1
  160. package/dist/assets/psyche-page-VZ9k9ISp.js +0 -1
  161. package/dist/assets/psyche-patterns-page-gx5nmdGq.js +0 -5
  162. package/dist/assets/psyche-questionnaire-builder-page-Bn0TOISd.js +0 -1
  163. package/dist/assets/psyche-questionnaire-detail-page-CmVzSd_s.js +0 -1
  164. package/dist/assets/psyche-questionnaire-run-detail-page-BsMbmXCG.js +0 -1
  165. package/dist/assets/psyche-questionnaire-run-page-CgkRL2vi.js +0 -1
  166. package/dist/assets/psyche-questionnaires-page-D7V8uLXM.js +0 -1
  167. package/dist/assets/psyche-report-detail-page-OlFq57eL.js +0 -3
  168. package/dist/assets/psyche-reports-page-dVUZjna1.js +0 -1
  169. package/dist/assets/psyche-schemas-beliefs-page-BCgc8FUd.js +0 -9
  170. package/dist/assets/psyche-screen-time-page-B_6BT_WN.js +0 -1
  171. package/dist/assets/psyche-self-observation-page-CEG5mluK.js +0 -1
  172. package/dist/assets/psyche-values-page-DRbRfEd6.js +0 -5
  173. package/dist/assets/report-chain-fields-CALCV3V5.js +0 -1
  174. package/dist/assets/schema-badge-BZO-qNhO.js +0 -1
  175. package/dist/assets/schema-visuals-D6nxjbYC.js +0 -1
  176. package/dist/assets/select-menu-fYyreSdQ.js +0 -1
  177. package/dist/assets/settings-calendar-page-D1CzE6cg.js +0 -5
  178. package/dist/assets/settings-models-page-D26270R2.js +0 -1
  179. package/dist/assets/settings-wiki-page-DwAUlyA3.js +0 -1
  180. package/dist/assets/strategy-dialog-D3AuUlVz.js +0 -1
  181. package/dist/assets/task-detail-page-z-9u9rF0.js +0 -1
  182. package/dist/assets/today-page-BKlu6gx5.js +0 -1
  183. package/dist/assets/training-load-page-CyJQqo_3.js +0 -1
  184. package/dist/assets/use-psyche-focus-target-C1C_XjYG.js +0 -1
  185. package/dist/assets/weight-loss-page-BQrnOI0y.js +0 -1
  186. package/dist/assets/workbench-flow-page-Du62mtJU.js +0 -5
  187. package/dist/assets/workbench-page-4MKr3iRm.js +0 -1
  188. package/dist/assets/workout-detail-page-DfUbYYw1.js +0 -2
@@ -0,0 +1,13 @@
1
+ CREATE TABLE IF NOT EXISTS nutrition_daily_energy_overrides (
2
+ id TEXT PRIMARY KEY,
3
+ user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
4
+ day_key TEXT NOT NULL,
5
+ active_calories_kcal REAL NOT NULL,
6
+ notes TEXT NOT NULL DEFAULT '',
7
+ created_at TEXT NOT NULL,
8
+ updated_at TEXT NOT NULL,
9
+ UNIQUE (user_id, day_key)
10
+ );
11
+
12
+ CREATE INDEX IF NOT EXISTS idx_nutrition_daily_energy_overrides_user_day
13
+ ON nutrition_daily_energy_overrides(user_id, day_key DESC);
@@ -802,6 +802,19 @@ When the user asks which Forge tools are available, list exactly these tools:
802
802
  `forge_get_sleep_overview`
803
803
  `forge_get_sports_overview`
804
804
  `forge_get_training_load_overview`
805
+ `forge_get_weight_loss_overview`
806
+ `forge_search_nutrition_foods`
807
+ `forge_search_foods`
808
+ `forge_lookup_nutrition_barcode`
809
+ `forge_log_food`
810
+ `forge_parse_food_log_with_chatgpt`
811
+ `forge_log_body_checkin`
812
+ `forge_log_appearance_checkin`
813
+ `forge_log_subjective_food_effect`
814
+ `forge_log_gut_checkin`
815
+ `forge_get_nutrition_patterns`
816
+ `forge_start_nutrition_experiment`
817
+ `forge_update_nutrition_experiment`
805
818
  `forge_update_sleep_session`
806
819
  `forge_update_workout_session`
807
820
  `forge_get_preferences_workspace`
@@ -408,7 +408,7 @@ still knowing the exact write/read family before it acts.
408
408
  user wants training-load trends, acute/chronic ratio, HR zone distribution,
409
409
  threshold exposure, VO2max/resting-HR context, or optimization targets before
410
410
  deciding whether a specific `workout_session` needs notes or links.
411
- - `weight_loss`: nutrition and body-composition health surface. Use
411
+ - `weight_loss`: health read model plus dedicated nutrition write workflow. Use
412
412
  `forge_get_weight_loss_overview` or `/api/v1/health/weight-loss` when the user
413
413
  wants calorie balance, food quality, protein/fiber targets, training fuel,
414
414
  body trend, aesthetic look, subjective energy, cravings, gut comfort,
@@ -1616,6 +1616,12 @@ Route note:
1616
1616
  overview. Do not invent generic batch entities for food logs or body check-ins
1617
1617
  when the dedicated tools exist.
1618
1618
 
1619
+ Ready to review when:
1620
+
1621
+ - the food, body, training-fuel, gut, craving, appearance, energy, or experiment
1622
+ question is clear enough to choose the overview, log, check-in, or experiment
1623
+ path
1624
+
1619
1625
  Preferred opening question:
1620
1626
 
1621
1627
  - "What food-body link are you trying to test or understand right now?"
@@ -1 +0,0 @@
1
- import{r as m,j as i,cL as Q,cT as ee,bT as te,cU as ie,cV as ne,cW as se,cX as re,cY as ae,aC as le,b1 as oe}from"./vendor-DHkYh85p.js";import{u as de,a as ce,P as ue,D as he,c as fe,S as me,v as xe,d as pe,b as be,C as ge}from"./board-BkDRaMp6.js";import{i as ve,k as J}from"./state-B-4sS1xO.js";import{cU as je,cV as Ne,B as H,Z as W,cW as ye,C as we,cX as Se}from"./index-CF4J4R9L.js";const S={lg:1280,md:996,sm:768,xs:480},R={lg:12,md:10,sm:6,xs:4,xxs:2},We="forge.surface-layout.v3";function X(e){return`${We}.${e}`}function A(e,n,s){return Math.min(Math.max(e,n),s)}function Ce(e){return e>=S.lg?"lg":e>=S.md?"md":e>=S.sm?"sm":e>=S.xs?"xs":"xxs"}function Ee(e,n){const s=R[n];if(n==="lg")return A(e.defaultWidth,e.minWidth??1,Math.min(e.maxWidth??s,s));const r=Math.round(e.defaultWidth/R.lg*s);return A(Math.max(e.minWidth??1,r||(e.minWidth??1)),e.minWidth??1,Math.min(e.maxWidth??s,s))}function Me(e){return{hidden:e.defaultHidden??!1,fullWidth:e.defaultFullWidth??!1,titleVisible:e.defaultTitleVisible??!0,descriptionVisible:e.defaultDescriptionVisible??!0}}function T(e,n){const s=[...n.filter(r=>r.defaultPlacement==="top"),...n.filter(r=>r.defaultPlacement!=="top")];return{surfaceId:e,order:s.map(r=>r.id),widgets:Object.fromEntries(n.map(r=>[r.id,Me(r)])),updatedAt:new Date(0).toISOString()}}function V(e,n,s){const r=T(e,n),l=new Set(n.map(o=>o.id)),c=((s==null?void 0:s.order)??[]).filter(o=>l.has(o)),x=r.order.filter(o=>!c.includes(o)),u=Object.fromEntries(n.map(o=>{var N,v,f,b,g;const h=(N=s==null?void 0:s.widgets)==null?void 0:N[o.id];return[o.id,{...r.widgets[o.id],hidden:(h==null?void 0:h.hidden)??((v=r.widgets[o.id])==null?void 0:v.hidden)??!1,fullWidth:(h==null?void 0:h.fullWidth)??((f=r.widgets[o.id])==null?void 0:f.fullWidth)??!1,titleVisible:(h==null?void 0:h.titleVisible)??((b=r.widgets[o.id])==null?void 0:b.titleVisible)??!0,descriptionVisible:(h==null?void 0:h.descriptionVisible)??((g=r.widgets[o.id])==null?void 0:g.descriptionVisible)??!0}]}));return{surfaceId:e,order:[...c,...x],widgets:u,updatedAt:typeof(s==null?void 0:s.updatedAt)=="string"?s.updatedAt:r.updatedAt}}function Ve(e,n){const s=new Map(n.order.map((r,l)=>[r,l]));return[...e].sort((r,l)=>{const c=s.get(r.id)??Number.MAX_SAFE_INTEGER,x=s.get(l.id)??Number.MAX_SAFE_INTEGER;return c!==x?c-x:r.id.localeCompare(l.id)})}function ke(e,n,s){const r=e.indexOf(n);if(r===-1)return e;const l=A(s,0,e.length-1);if(r===l)return e;const c=[...e];return c.splice(r,1),c.splice(l,0,n),c}function k(e){if(typeof window>"u")return null;try{const n=window.localStorage.getItem(X(e));return n?JSON.parse(n):null}catch{return null}}function O(e){if(!(typeof window>"u"))try{window.localStorage.setItem(X(e.surfaceId),JSON.stringify(e))}catch{}}const Oe=500;function G(e,n){return e.surfaceId===n.surfaceId&&JSON.stringify(e.order)===JSON.stringify(n.order)&&JSON.stringify(e.widgets)===JSON.stringify(n.widgets)}function Re({definition:e,preferences:n,editing:s,width:r,children:l}){const c=r<=4;return e.surfaceChrome==="none"?i.jsx("div",{"data-surface-card":"true",className:W("min-w-0",s&&"rounded-[28px] ring-1 ring-white/8 ring-inset"),children:l}):i.jsxs(we,{"data-surface-card":"true",className:W("surface-grid-card flex min-w-0 flex-col gap-3 overflow-visible p-4 md:p-5",s&&"ring-1 ring-white/8"),children:[n.titleVisible||n.descriptionVisible&&e.description?i.jsxs("div",{className:"min-w-0",children:[n.titleVisible?i.jsx("div",{className:"truncate text-[0.72rem] font-semibold uppercase tracking-[0.16em] text-white/40",children:e.title}):null,n.descriptionVisible&&e.description&&!c?i.jsx("div",{className:"mt-1 text-[12px] leading-5 text-white/52",children:e.description}):null]}):null,i.jsx("div",{className:"min-h-0 flex-1",children:l})]})}function Ae({widget:e,preferences:n,index:s,total:r,onMove:l,onToggleHidden:c,onToggleFullWidth:x}){const u=be({id:e.id});return i.jsxs("div",{ref:u.setNodeRef,style:{transform:ge.Transform.toString(u.transform),transition:u.transition},className:"flex min-w-0 items-center gap-2 rounded-[18px] border border-white/8 bg-white/[0.04] px-3 py-2.5",children:[i.jsx("button",{type:"button",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-full bg-white/[0.05] text-white/50 transition hover:bg-white/[0.08] hover:text-white","aria-label":`Drag ${e.title}`,...u.attributes,...u.listeners,children:i.jsx(te,{className:"size-4"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-sm font-medium text-white",children:e.title}),e.description?i.jsx("div",{className:"truncate text-[12px] text-white/48",children:e.description}):null]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-full bg-white/[0.05] text-white/60 transition hover:bg-white/[0.08] hover:text-white disabled:opacity-40",onClick:()=>l(s-1),disabled:s===0,"aria-label":`Move ${e.title} up`,children:i.jsx(ie,{className:"size-3.5"})}),i.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-full bg-white/[0.05] text-white/60 transition hover:bg-white/[0.08] hover:text-white disabled:opacity-40",onClick:()=>l(s+1),disabled:s===r-1,"aria-label":`Move ${e.title} down`,children:i.jsx(ne,{className:"size-3.5"})}),i.jsxs("button",{type:"button",className:W("inline-flex h-8 items-center gap-2 rounded-full px-3 text-[12px] transition",n.fullWidth?"bg-[var(--primary)] text-slate-950":"bg-white/[0.05] text-white/72 hover:bg-white/[0.08] hover:text-white"),onClick:x,children:[n.fullWidth?i.jsx(se,{className:"size-3.5"}):i.jsx(re,{className:"size-3.5"}),n.fullWidth?"Normal width":"Full width"]}),e.removable!==!1?i.jsxs("button",{type:"button",className:"inline-flex h-8 items-center gap-2 rounded-full bg-white/[0.05] px-3 text-[12px] text-white/72 transition hover:bg-white/[0.08] hover:text-white",onClick:c,children:[i.jsx(ae,{className:"size-3.5"}),"Hide"]}):null]})]})}function Te({surfaceId:e,widgets:n,defaultEditing:s=!1,actions:r,normalizeLayout:l}){var U;const c=m.useMemo(()=>JSON.stringify(n.map(t=>({id:t.id,defaultWidth:t.defaultWidth,defaultHidden:t.defaultHidden,defaultPlacement:t.defaultPlacement,defaultFullWidth:t.defaultFullWidth,defaultTitleVisible:t.defaultTitleVisible,defaultDescriptionVisible:t.defaultDescriptionVisible}))),[n]),x=m.useMemo(()=>{const t=T(e,n);return l?l(t):t},[l,e,c]),u=t=>l?l(t):t,[o,h]=m.useState(s),[N,v]=m.useState(1280),[f,b]=m.useState(()=>u(V(e,n,k(e)??x))),g=m.useRef(null),P=m.useRef(!1),y=m.useRef(u(V(e,n,k(e)??x))),F=m.useRef(null),I=de(ce(ue,{activationConstraint:{distance:6}})),C=ve({queryKey:["forge-surface-layout",e],queryFn:()=>Se(e)}),z=(U=C==null?void 0:C.data)==null?void 0:U.layout,D=J({mutationFn:t=>je(e,{order:t.order,widgets:t.widgets})}),q=J({mutationFn:()=>Ne(e)});m.useEffect(()=>{const t=u(V(e,n,z??k(e)??x));b(a=>G(a,t)?a:t),O(t),y.current=t,P.current=!0},[x,z,l,e,c,n]),m.useEffect(()=>{const t=F.current;if(!t||typeof ResizeObserver>"u")return;const a=new ResizeObserver(d=>{var j;const p=((j=d[0])==null?void 0:j.contentRect.width)??t.clientWidth;v(Math.max(320,Math.round(p)))});return a.observe(t),v(Math.max(320,Math.round(t.clientWidth||1280))),()=>a.disconnect()},[]),m.useEffect(()=>{if(P.current&&!G(f,y.current))return O(f),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const t=f;D.mutateAsync(t).then(()=>{y.current=t})},Oe),()=>{g.current!==null&&window.clearTimeout(g.current)}},[f,D,e]);const L=Ce(N),E=R[L],$=m.useMemo(()=>Ve(n,f),[f,n]),w=$.filter(t=>{var a;return!((a=f.widgets[t.id])!=null&&a.hidden)}),_=$.filter(t=>{var a;return(a=f.widgets[t.id])==null?void 0:a.hidden});function M(t,a){b(d=>u({...d,widgets:{...d.widgets,[t]:{...d.widgets[t],...a}}}))}function K(t,a){b(d=>u({...d,order:ke(d.order,t,a)}))}function Y(t){const{active:a,over:d}=t;!d||a.id===d.id||b(p=>{const j=p.order.indexOf(String(a.id)),B=p.order.indexOf(String(d.id));return j===-1||B===-1?p:u({...p,order:pe(p.order,j,B)})})}function Z(){const t=u(T(e,n));b(t),O(t),y.current=t,q.mutateAsync()}return i.jsxs("div",{className:"grid gap-4",children:[o?i.jsx(he,{sensors:I,collisionDetection:fe,onDragEnd:Y,children:i.jsxs("div",{className:"grid gap-3 rounded-[24px] border border-white/8 bg-white/[0.03] p-4",children:[i.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-white/40",children:"Visible boxes"}),i.jsx(me,{items:w.map(t=>t.id),strategy:xe,children:i.jsx("div",{className:"grid gap-2",children:w.map((t,a)=>{const d=f.widgets[t.id]??{hidden:!1,fullWidth:!1,titleVisible:!0,descriptionVisible:!0};return i.jsx(Ae,{widget:t,preferences:d,index:a,total:w.length,onMove:p=>K(t.id,p),onToggleHidden:()=>M(t.id,{hidden:!0}),onToggleFullWidth:()=>M(t.id,{fullWidth:!d.fullWidth})},t.id)})})}),_.length>0?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"pt-2 text-[12px] uppercase tracking-[0.16em] text-white/40",children:"Hidden boxes"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(t=>i.jsx("button",{type:"button",className:"rounded-full bg-white/[0.06] px-3 py-2 text-sm text-white/76 transition hover:bg-white/[0.1] hover:text-white",onClick:()=>M(t.id,{hidden:!1}),children:t.title},t.id))})]}):null]})}):null,i.jsxs("div",{ref:F,className:"relative",children:[i.jsx("div",{className:"pointer-events-none absolute top-3 right-3 z-20 flex max-w-[calc(100%-1.5rem)] flex-wrap items-center justify-end gap-1.5",children:i.jsxs("div",{className:"pointer-events-auto flex flex-wrap items-center justify-end gap-1.5",children:[r,o?i.jsxs(H,{type:"button",size:"sm",variant:"secondary",className:"h-8 rounded-full border-white/10 bg-[rgba(30,39,69,0.82)] px-2.5 text-[12px] text-white/78 backdrop-blur-xl hover:bg-[rgba(37,47,81,0.94)] hover:text-white",onClick:Z,children:[i.jsx(Q,{className:"size-3.5"}),i.jsx("span",{className:"hidden sm:inline",children:"Reset"})]}):null,i.jsxs(H,{type:"button",size:"sm",variant:o?"primary":"secondary",className:W("h-8 rounded-full px-2 text-[12px] backdrop-blur-xl [&>span]:gap-1.5",o?"bg-[var(--primary)] text-slate-950 hover:opacity-95":"border-white/10 bg-[rgba(30,39,69,0.82)] text-white/78 hover:bg-[rgba(37,47,81,0.94)] hover:text-white"),onClick:()=>h(t=>!t),children:[i.jsx(ee,{className:"size-3.5"}),i.jsx("span",{className:"hidden xl:inline",children:o?"Done":"Layout"})]})]})}),i.jsx("div",{className:"surface-flow-grid",style:{display:"grid",gap:"16px",gridTemplateColumns:`repeat(${E}, minmax(0, 1fr))`,alignItems:"start"},children:w.map(t=>{const a=f.widgets[t.id]??{hidden:!1,fullWidth:!1,titleVisible:!0,descriptionVisible:!0},d=a.fullWidth?E:Math.min(Ee(t,L),E);return i.jsx("div",{style:{gridColumn:`span ${d} / span ${d}`},children:i.jsx(Re,{definition:t,preferences:a,editing:o,width:d,children:i.jsx(ye,{boxId:t.workbenchBoxId??`surface:${e}:${t.id}`,surfaceId:e,children:t.render({compact:d<=4,width:d,editing:o,preferences:a})})})},t.id)})})]})]})}function Le({surfaceId:e,baseWidgets:n,actions:s,normalizeLayout:r}){return i.jsx(Te,{surfaceId:e,widgets:n,normalizeLayout:r,actions:i.jsxs(i.Fragment,{children:[s,i.jsxs(le,{to:`/workbench?surface=${encodeURIComponent(e)}`,className:"inline-flex h-8 items-center gap-1.5 rounded-full border border-white/10 bg-[rgba(32,40,70,0.78)] px-2.5 text-[12px] font-medium text-white/78 backdrop-blur-xl transition hover:border-white/16 hover:bg-[rgba(40,49,82,0.9)] hover:text-white",children:[i.jsx(oe,{className:"size-3.5"}),i.jsx("span",{className:"hidden sm:inline",children:"Workbench"})]})]})})}export{Le as A};
@@ -1 +0,0 @@
1
- import{j as a}from"./vendor-DHkYh85p.js";import{aq as d,Z as o}from"./index-CF4J4R9L.js";function c({eyebrow:n,title:e,description:r,titleHelp:t,tone:i="default",children:l,className:s}){const g={default:"bg-[linear-gradient(180deg,rgba(17,24,35,0.96),rgba(11,16,24,0.94))]",mint:"bg-[radial-gradient(circle_at_top_left,rgba(110,231,183,0.14),transparent_42%),linear-gradient(180deg,rgba(14,28,31,0.96),rgba(10,20,24,0.94))]",sky:"bg-[radial-gradient(circle_at_top_left,rgba(125,211,252,0.14),transparent_42%),linear-gradient(180deg,rgba(16,25,34,0.96),rgba(10,17,24,0.94))]",violet:"bg-[radial-gradient(circle_at_top_left,rgba(196,181,253,0.14),transparent_42%),linear-gradient(180deg,rgba(20,19,35,0.96),rgba(12,13,24,0.94))]",rose:"bg-[radial-gradient(circle_at_top_left,rgba(251,113,133,0.14),transparent_42%),linear-gradient(180deg,rgba(31,18,24,0.96),rgba(18,11,16,0.94))]",amber:"bg-[radial-gradient(circle_at_top_left,rgba(251,191,36,0.14),transparent_42%),linear-gradient(180deg,rgba(32,24,16,0.96),rgba(20,15,10,0.94))]"};return a.jsxs("section",{className:o("min-w-0 overflow-hidden rounded-[30px] border border-white/8 px-4 py-5 shadow-[0_24px_70px_rgba(4,8,18,0.28)] sm:px-5 lg:px-6",g[i],s),children:[a.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:n}),a.jsxs("div",{className:"mt-3 flex min-w-0 items-start gap-2",children:[a.jsx("h2",{className:"min-w-0 font-display text-[clamp(1.8rem,3.2vw,3rem)] leading-none text-white",children:e}),t?a.jsx(d,{content:t,label:`Explain ${e.toLowerCase()}`,className:"mt-1 shrink-0"}):null]}),r?a.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-7 text-white/60",children:r}):null,a.jsx("div",{className:"mt-5 min-w-0",children:l})]})}export{c as A};
@@ -1 +0,0 @@
1
- import{j as e,aV as m}from"./vendor-DHkYh85p.js";import{c as d,B as a}from"./index-CF4J4R9L.js";import{f as o}from"./calendar-ui-Cy1XRwzV.js";function f({eyebrow:r="Week view",description:i,weekStart:t,status:s,badges:l,onPrevious:n,onCurrent:c,onNext:x}){return e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/45",children:r}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/60",children:i}),s?e.jsx("div",{className:"mt-3",children:s}):null]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(d,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:[e.jsx(m,{className:"mr-1 size-3.5"}),"Week of ",o(t)]}),l,e.jsx(a,{variant:"secondary",onClick:n,children:"Previous"}),e.jsx(a,{variant:"secondary",onClick:c,children:"This week"}),e.jsx(a,{variant:"secondary",onClick:x,children:"Next"})]})]})}export{f as C};
@@ -1 +0,0 @@
1
- import{bU as j,j as e,d1 as M,d2 as V,aI as _,d3 as S,d4 as P,d5 as L,aG as T,aX as z,r as u,cX as R,aK as $}from"./vendor-DHkYh85p.js";import{R as K,P as F,O as B,C as O,T as A,D as W,a as I}from"./ui-C13Nbgas.js";import{C as v,Z as x,c}from"./index-CF4J4R9L.js";import{R as X,e as E,C as G,X as H,Y,d as U,T as Z,B as q,a as J}from"./charts-P7EVhIog.js";function m(a){return a?new Date(`${a}T12:00:00`).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"No date yet"}function Q(a,s){return s==="cumulative"?a.total??a.latest??a.maximum??a.average:a.latest??a.average??a.maximum??a.minimum}function d(a,s){if(s==null)return"No reading";const t=a.unit==="steps"||a.unit==="flights"||a.unit==="kcal"||a.unit==="min"||a.unit==="swears"||a.unit==="conversations"||a.unit==="messages"?0:(a.unit==="%",1);return`${s.toLocaleString(void 0,{maximumFractionDigits:t,minimumFractionDigits:t===0||s>=100?0:1})} ${a.unit}`}function w(a){return a.deltaValue==null?"No baseline yet":`${a.deltaValue>0?"+":""}${d(a,a.deltaValue)}`}function ee(a){return Math.round(a*10)/10}function N(a,s){return Q(a,s)}function b(a){const s=a.days.map(t=>N(t,a.aggregation)).filter(t=>t!=null);return s.length===0?{minimum:null,average:null,maximum:null,count:0}:{minimum:Math.min(...s),average:s.reduce((t,i)=>t+i,0)/s.length,maximum:Math.max(...s),count:s.length}}function y(a){return new Date(`${a}T12:00:00`).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ae({active:a,payload:s,label:t,metric:i}){var r;if(!a||!(s!=null&&s.length)||typeof t!="string")return null;const l=((r=s.find(n=>typeof n.value=="number"))==null?void 0:r.value)??null;return e.jsxs("div",{className:"rounded-[18px] border border-white/10 bg-[rgba(9,13,24,0.94)] px-3 py-2 shadow-[0_18px_48px_rgba(0,0,0,0.38)] backdrop-blur-xl",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/40",children:y(t)}),e.jsx("div",{className:"mt-1 text-sm font-semibold text-white",children:d(i,l)})]})}function k({metric:a,height:s=180,detailed:t=!1}){const i=u.useMemo(()=>b(a),[a]),l=u.useMemo(()=>a.days.map(o=>({dateKey:o.dateKey,value:N(o,a.aggregation),sampleCount:o.sampleCount})),[a]),r=l.map(o=>o.value).filter(o=>o!=null),n=r.length>0?Math.min(...r):0,p=r.length>0?Math.max(...r):1,f=Math.max((p-n)*.12,a.unit==="%"?2:1),C=g(a.category),h=`metric-gradient-${a.metric.replace(/[^a-z0-9]/gi,"-")}`;return r.length===0?e.jsx("div",{className:"flex items-center justify-center rounded-[22px] border border-dashed border-white/8 bg-white/[0.025] text-sm text-white/40",style:{height:s},children:"Waiting for chart data"}):e.jsx("div",{className:x("overflow-hidden rounded-[22px] border bg-[radial-gradient(circle_at_top_left,rgba(171,232,255,0.08),transparent_34%),rgba(255,255,255,0.025)] p-3",C.ring),style:{height:s},children:e.jsx(X,{width:"100%",height:"100%",children:e.jsxs(E,{data:l,margin:{top:t?18:8,right:t?18:4,bottom:t?12:0,left:t?8:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:h,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgba(171,232,255,0.55)"}),e.jsx("stop",{offset:"56%",stopColor:"rgba(251,191,36,0.22)"}),e.jsx("stop",{offset:"100%",stopColor:"rgba(251,191,36,0.02)"})]})}),e.jsx(G,{stroke:"rgba(255,255,255,0.07)",vertical:t}),e.jsx(H,{dataKey:"dateKey",tickFormatter:y,minTickGap:t?22:34,tick:{fill:"rgba(255,255,255,0.46)",fontSize:11},axisLine:{stroke:"rgba(255,255,255,0.1)"},tickLine:!1}),e.jsx(Y,{width:t?62:36,domain:[Math.max(0,n-f),p+f],tickFormatter:o=>d(a,Number(o)).replace(` ${a.unit}`,""),tick:{fill:"rgba(255,255,255,0.46)",fontSize:11},axisLine:!1,tickLine:!1}),i.average!=null?e.jsx(U,{y:ee(i.average),stroke:"rgba(255,255,255,0.34)",strokeDasharray:"5 5",ifOverflow:"extendDomain"}):null,e.jsx(Z,{cursor:{stroke:"rgba(255,255,255,0.22)",strokeWidth:1},content:e.jsx(ae,{metric:a})}),a.aggregation==="cumulative"?e.jsx(q,{dataKey:"value",radius:[8,8,2,2],fill:`url(#${h})`,maxBarSize:t?34:20}):e.jsx(J,{type:"monotone",dataKey:"value",stroke:"rgba(171,232,255,0.92)",strokeWidth:t?3:2,fill:`url(#${h})`,dot:t?{r:3,fill:"rgba(251,191,36,0.9)"}:!1,activeDot:{r:5,fill:"rgba(251,191,36,0.95)"}})]})})})}function te({metric:a,open:s,onOpenChange:t}){const i=b(a),l=g(a.category);return e.jsx(K,{open:s,onOpenChange:t,children:e.jsxs(F,{children:[e.jsx(B,{className:"fixed inset-0 z-50 bg-[rgba(3,7,18,0.82)] backdrop-blur-xl"}),e.jsxs(O,{className:"fixed inset-3 z-[51] grid min-h-0 overflow-hidden rounded-[32px] border border-white/10 bg-[radial-gradient(circle_at_top_left,rgba(171,232,255,0.12),transparent_34%),linear-gradient(180deg,rgba(12,18,32,0.98),rgba(7,10,20,0.99))] shadow-[0_34px_110px_rgba(0,0,0,0.58)] sm:inset-5",children:[e.jsxs(A,{className:"sr-only",children:[a.label," chart"]}),e.jsx(W,{className:"sr-only",children:"Full-screen time-series chart for the selected daily metric."}),e.jsxs("div",{className:"grid min-h-0 grid-rows-[auto_minmax(0,1fr)]",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-white/8 px-5 py-4 sm:px-6",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:[a.category," time series"]}),e.jsx("div",{className:"mt-1 text-2xl font-semibold text-white sm:text-3xl",children:a.label}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-white/54",children:[e.jsx(c,{className:l.badge,children:a.aggregation}),e.jsxs(c,{tone:"meta",children:[a.coverageDays," tracked days"]}),e.jsxs(c,{tone:"meta",children:["latest ",m(a.latestDateKey)]})]})]}),e.jsx(I,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex size-11 items-center justify-center rounded-full border border-white/10 bg-white/[0.06] text-white/72 transition hover:bg-white/[0.1] hover:text-white","aria-label":"Close metric chart",children:e.jsx($,{className:"size-5"})})})]}),e.jsxs("div",{className:"grid min-h-0 gap-4 overflow-y-auto p-4 sm:p-6 lg:grid-cols-[minmax(0,1fr)_18rem]",children:[e.jsx(k,{metric:a,height:560,detailed:!0}),e.jsx("div",{className:"grid content-start gap-3",children:[["Latest",a.latestValue],["Period min",i.minimum],["Period average",i.average],["Period max",i.maximum],["Baseline",a.baselineValue],["Delta",a.deltaValue]].map(([r,n])=>e.jsxs("div",{className:"rounded-[22px] border border-white/8 bg-white/[0.035] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:r}),e.jsx("div",{className:"mt-1 text-xl font-semibold text-white",children:d(a,typeof n=="number"?n:null)})]},String(r)))})]})]})]})]})})}function se(a){return a.deltaValue==null||a.deltaValue===0?"steady":a.deltaValue>0?"up":"down"}function g(a){switch(a){case"recovery":return{ring:"border-[rgba(255,122,167,0.18)]",badge:"bg-[rgba(255,122,167,0.16)] text-[rgb(255,179,205)]",glow:"from-[rgba(255,122,167,0.2)] via-[rgba(109,76,255,0.06)] to-transparent"};case"cardio":return{ring:"border-[rgba(109,173,255,0.22)]",badge:"bg-[rgba(109,173,255,0.16)] text-[rgb(186,220,255)]",glow:"from-[rgba(109,173,255,0.22)] via-[rgba(64,108,255,0.08)] to-transparent"};case"breathing":return{ring:"border-[rgba(111,232,195,0.2)]",badge:"bg-[rgba(111,232,195,0.15)] text-[rgb(195,255,237)]",glow:"from-[rgba(111,232,195,0.2)] via-[rgba(29,154,123,0.08)] to-transparent"};case"composition":return{ring:"border-[rgba(247,211,110,0.18)]",badge:"bg-[rgba(247,211,110,0.15)] text-[rgb(255,235,176)]",glow:"from-[rgba(247,211,110,0.18)] via-[rgba(184,128,24,0.08)] to-transparent"};case"temperature":return{ring:"border-[rgba(255,153,102,0.18)]",badge:"bg-[rgba(255,153,102,0.16)] text-[rgb(255,214,190)]",glow:"from-[rgba(255,153,102,0.2)] via-[rgba(255,91,46,0.06)] to-transparent"};case"conversationTone":return{ring:"border-[rgba(251,191,36,0.2)]",badge:"bg-[rgba(251,191,36,0.16)] text-[rgb(255,232,166)]",glow:"from-[rgba(251,191,36,0.18)] via-[rgba(244,114,182,0.08)] to-transparent"};default:return{ring:"border-[rgba(163,174,208,0.16)]",badge:"bg-[rgba(163,174,208,0.14)] text-[rgb(220,228,255)]",glow:"from-[rgba(163,174,208,0.14)] via-[rgba(112,120,167,0.06)] to-transparent"}}}function D(a){switch(a){case"restingHeartRate":case"walkingHeartRateAverage":case"heartRateRecoveryOneMinute":return z;case"heartRateVariabilitySDNN":case"vo2Max":return T;case"oxygenSaturation":case"respiratoryRate":return L;case"bodyMass":case"bodyFatPercentage":case"leanBodyMass":return P;case"stepCount":case"flightsClimbed":case"appleExerciseTime":return S;case"basalEnergyBurned":return _;case"swearingMessagePercent":return V;case"devrageSwearCount":return M;default:return j}}function oe({title:a,description:s,metric:t,emptyDescription:i}){const l=t?D(t.metric):j,r=g(t?t.category:"default"),n=t?se(t):"steady";return e.jsxs(v,{className:x("relative overflow-hidden rounded-[28px] border bg-[rgba(12,18,36,0.82)] p-5 shadow-[0_18px_60px_rgba(4,8,18,0.3)]",r.ring),children:[e.jsx("div",{className:x("pointer-events-none absolute inset-0 bg-gradient-to-br opacity-90",r.glow)}),e.jsxs("div",{className:"relative grid gap-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"grid gap-1",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/38",children:a}),e.jsx("div",{className:"text-sm leading-6 text-white/56",children:s})]}),e.jsx("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.05] p-3 text-white/80",children:e.jsx(l,{className:"size-5"})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-xl font-semibold text-white",children:t?d(t,t.latestValue):"No signal yet"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-white/56",children:[t?e.jsx(c,{className:r.badge,children:t.label}):null,t?e.jsx(c,{className:x("border-none",n==="up"?"bg-[rgba(111,232,195,0.14)] text-[rgb(190,255,231)]":n==="down"?"bg-[rgba(255,122,167,0.14)] text-[rgb(255,193,215)]":"bg-white/[0.08] text-white/72"),children:w(t)}):null,t?e.jsxs(c,{tone:"meta",children:[t.coverageDays," days tracked"]}):null]}),e.jsx("div",{className:"text-xs text-white/48",children:t?`Latest reading on ${m(t.latestDateKey)}`:i??"Forge will populate this card as soon as daily readings are available."})]})]})]})}function re({metric:a}){const[s,t]=u.useState(!1),i=D(a.metric),l=g(a.category),r=a.days.at(-1),n=b(a);return e.jsxs(v,{className:x("overflow-hidden rounded-[28px] border bg-[linear-gradient(180deg,rgba(12,18,36,0.94),rgba(8,12,24,0.98))] p-5",l.ring),children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.04] p-3 text-white/84",children:e.jsx(i,{className:"size-5"})}),e.jsxs("div",{className:"grid gap-1",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:a.category}),e.jsx("div",{className:"text-xl font-semibold text-white",children:a.label}),e.jsxs("div",{className:"text-sm text-white/52",children:[a.coverageDays," tracked day",a.coverageDays===1?"":"s"]})]})]}),e.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:[e.jsx(c,{className:l.badge,children:a.aggregation}),e.jsxs("button",{type:"button",className:"inline-flex min-h-9 items-center gap-2 rounded-full border border-white/10 bg-white/[0.055] px-3 py-1.5 text-xs font-medium text-white/72 transition hover:bg-white/[0.09] hover:text-white",onClick:()=>t(!0),children:[e.jsx(R,{className:"size-3.5"}),"Full screen"]})]})]}),e.jsxs("div",{className:"mt-5 grid gap-4 md:grid-cols-[minmax(0,0.95fr)_minmax(220px,1.05fr)]",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Latest"}),e.jsx("div",{className:"mt-1 text-3xl font-semibold text-white",children:d(a,a.latestValue)}),e.jsx("div",{className:"mt-1 text-sm text-white/52",children:a.latestDateKey?`Latest reading on ${m(a.latestDateKey)}`:"Waiting for the first successful reading"})]}),e.jsxs("div",{className:"grid gap-2 rounded-[22px] border border-white/8 bg-white/[0.03] p-4 text-sm text-white/70",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Baseline"}),e.jsx("span",{className:"font-medium text-white",children:d(a,a.baselineValue)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Delta"}),e.jsx("span",{className:x("font-medium",a.deltaValue==null?"text-white/58":a.deltaValue>0?"text-[rgb(190,255,231)]":a.deltaValue<0?"text-[rgb(255,198,219)]":"text-white"),children:w(a)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Latest samples"}),e.jsx("span",{className:"font-medium text-white",children:(r==null?void 0:r.sampleCount)??0})]})]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(k,{metric:a}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs text-white/48",children:[e.jsxs("div",{className:"rounded-[16px] border border-white/8 bg-white/[0.025] px-3 py-2",children:[e.jsx("div",{children:"Period min"}),e.jsx("div",{className:"mt-1 font-medium text-white/78",children:d(a,n.minimum)})]}),e.jsxs("div",{className:"rounded-[16px] border border-white/8 bg-white/[0.025] px-3 py-2",children:[e.jsx("div",{children:"Period avg"}),e.jsx("div",{className:"mt-1 font-medium text-white/78",children:d(a,n.average)})]}),e.jsxs("div",{className:"rounded-[16px] border border-white/8 bg-white/[0.025] px-3 py-2",children:[e.jsx("div",{children:"Period max"}),e.jsx("div",{className:"mt-1 font-medium text-white/78",children:d(a,n.maximum)})]})]})]})]}),e.jsx(te,{metric:a,open:s,onOpenChange:t})]})}function ce({groups:a}){return e.jsx("section",{className:"grid gap-5",children:a.map(s=>e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/38",children:s.category}),e.jsxs("div",{className:"mt-1 text-2xl font-semibold text-white",children:[s.metrics.length," signals in this lane"]})]}),e.jsxs(c,{className:g(s.category).badge,children:[s.coverageDays," days of coverage"]})]}),e.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:s.metrics.map(t=>e.jsx(re,{metric:t},t.metric))})]},s.category))})}export{ce as M,oe as S,m as f,g as m};
@@ -1 +0,0 @@
1
- import{r as l,j as e,b4 as $e,b3 as We,cR as Ke,ce as Xe,c7 as Pe}from"./vendor-DHkYh85p.js";import{j as Ye,i as x,k as X}from"./state-B-4sS1xO.js";import{u as Ze,bv as Y,cP as et,cq as m,ao as tt,bm as st,bn as at,C as it,aq as nt,c as j,cQ as rt,B as y,I as w,T as ze,bu as f,i as lt,bD as ot,bw as dt,bx as ct,by as mt,bz as ut,bA as pt,bB as ht,bC as xt}from"./index-CF4J4R9L.js";import{N as Z}from"./note-markdown-N-uxD3Xt.js";import{n as ee,N as Fe,f as yt,p as gt,b as vt}from"./note-tags-input-Cdu7wiw6.js";function bt(o,d,c){return o.links.filter(p=>!(p.entityType===d&&p.entityId===c))}function jt(o,d){return o.entityType===d.entityType&&o.entityId===d.entityId&&(o.anchorKey??null)===(d.anchorKey??null)}function te(o){const d=new Set;return o.filter(c=>{const p=`${c.entityType}:${c.entityId}:${c.anchorKey??""}`;return d.has(p)?!1:(d.add(p),!0)})}function Me(o,d,c){return gt(o)??vt(d,c)}function St({entityType:o,entityId:d,anchorKey:c,includeAnchorlessWhenAnchored:p=!1,title:Qe="Notes",description:Be="Markdown notes linked to this entity stay searchable, editable, and visible alongside the work.",invalidateQueryKeys:Ve=[],compact:se=!1}){var Se,De,_e,Te,Le,Ie,Ee,qe,Ae;const u=Ze(),L=Ye(),[I,Oe]=l.useState(""),[ae,E]=l.useState(!1),[v,q]=l.useState(""),[ie,A]=l.useState(!1),[Ue,$]=l.useState({entityType:"goal",entityId:""}),[ne,K]=l.useState([]),[re,P]=l.useState([]),[le,z]=l.useState(""),[oe,F]=l.useState(""),[de,M]=l.useState("days"),[He,Q]=l.useState(null),[b,B]=l.useState(""),[ce,N]=l.useState(!1),[V,O]=l.useState([]),[Re,U]=l.useState({entityType:"goal",entityId:""}),[me,k]=l.useState([]),[ue,C]=l.useState(""),[pe,S]=l.useState(""),[he,D]=l.useState("days"),H=Y(c),xe=et(o,c),g=x({queryKey:["notes",o,d],queryFn:()=>ot({linkedEntityType:o,linkedEntityId:d,limit:100})}),ye=x({queryKey:["forge-psyche-values"],queryFn:dt}),ge=x({queryKey:["forge-psyche-patterns"],queryFn:ct}),ve=x({queryKey:["forge-psyche-behaviors"],queryFn:mt}),be=x({queryKey:["forge-psyche-beliefs"],queryFn:ut}),je=x({queryKey:["forge-psyche-modes"],queryFn:pt}),we=x({queryKey:["forge-psyche-flashcards"],queryFn:ht}),fe=x({queryKey:["forge-psyche-reports"],queryFn:xt}),R=l.useMemo(()=>{var t,r,i,a,h,n,_,T;return{goal:u.snapshot.goals.map(s=>({id:s.id,label:m(s.title,s.user)})),project:u.snapshot.dashboard.projects.map(s=>({id:s.id,label:m(s.title,s.user)})),task:u.snapshot.tasks.map(s=>({id:s.id,label:m(s.title,s.user)})),strategy:u.snapshot.strategies.map(s=>({id:s.id,label:m(s.title,s.user)})),habit:u.snapshot.habits.map(s=>({id:s.id,label:m(s.title,s.user)})),tag:u.snapshot.tags.map(s=>({id:s.id,label:m(s.name,s.user)})),note:(((t=g.data)==null?void 0:t.notes)??[]).map(s=>({id:s.id,label:s.contentPlain||s.contentMarkdown})),insight:[],psyche_value:(((r=ye.data)==null?void 0:r.values)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),behavior_pattern:(((i=ge.data)==null?void 0:i.patterns)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),behavior:(((a=ve.data)==null?void 0:a.behaviors)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),belief_entry:(((h=be.data)==null?void 0:h.beliefs)??[]).map(s=>({id:s.id,label:m(s.statement,s.user)})),mode_profile:(((n=je.data)==null?void 0:n.modes)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),flashcard:(((_=we.data)==null?void 0:_.flashcards)??[]).map(s=>({id:s.id,label:m(s.title||s.message,s.user)})),mode_guide_session:[],event_type:[],emotion_definition:[],trigger_report:(((T=fe.data)==null?void 0:T.reports)??[]).map(s=>({id:s.id,label:m(s.title,s.user)})),calendar_event:[],work_block_template:[],task_timebox:[],preference_catalog:[],preference_catalog_item:[],preference_context:[],preference_item:[],questionnaire_instrument:[],sleep_session:[],workout_session:[]}},[(Se=ve.data)==null?void 0:Se.behaviors,(De=be.data)==null?void 0:De.beliefs,(_e=we.data)==null?void 0:_e.flashcards,(Te=je.data)==null?void 0:Te.modes,(Le=g.data)==null?void 0:Le.notes,(Ie=ge.data)==null?void 0:Ie.patterns,(Ee=fe.data)==null?void 0:Ee.reports,u.snapshot.dashboard.projects,u.snapshot.goals,u.snapshot.habits,u.snapshot.strategies,u.snapshot.tags,u.snapshot.tasks,(qe=ye.data)==null?void 0:qe.values]),G=async()=>{await Promise.all([L.invalidateQueries({queryKey:["notes",o,d]}),lt(L),...Ve.map(t=>L.invalidateQueries({queryKey:t}))])},Ne=X({mutationFn:async t=>tt({contentMarkdown:t,tags:ee(re),destroyAt:Me(le,oe,de),links:te([{entityType:o,entityId:d,anchorKey:c??null},...ne])}),onSuccess:async()=>{q(""),A(!1),K([]),$({entityType:"goal",entityId:""}),P([]),z(""),F(""),M("days"),await G()}}),ke=X({mutationFn:async({noteId:t,contentMarkdown:r,links:i,tags:a,destroyAt:h})=>st(t,{contentMarkdown:r,links:i,tags:a,destroyAt:h}),onSuccess:async()=>{Q(null),B(""),N(!1),O([]),U({entityType:"goal",entityId:""}),k([]),C(""),S(""),D("days"),await G()}}),Ge=X({mutationFn:async t=>at(t),onSuccess:G}),J=l.useMemo(()=>{var r;return(((r=g.data)==null?void 0:r.notes)??[]).filter(i=>c===void 0?!0:i.links.some(a=>a.entityType===o&&a.entityId===d&&((a.anchorKey??null)===c||p&&(a.anchorKey??null)===null))).filter(i=>{const a=I.trim().toLowerCase();return a?`${i.contentPlain} ${i.author??""} ${(i.tags??[]).join(" ")}`.toLowerCase().includes(a):!0})},[c,d,o,p,(Ae=g.data)==null?void 0:Ae.notes,I]),Je=(t,r,i)=>{const a=t.entityId.trim();return a?(r(te([...i,{entityType:t.entityType,entityId:a,anchorKey:null}])),!0):!1},W=t=>{var i,a;const r=(i=R[t.entityType])==null?void 0:i.find(h=>h.id===t.entityId);return(a=r==null?void 0:r.label)!=null&&a.trim()?r.label.trim():`Deleted ${f(t.entityType)}`},Ce=(t,r,i,a,h)=>e.jsxs("div",{className:"rounded-[20px] bg-white/[0.03] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Linked entities"}),e.jsxs(j,{className:"bg-white/[0.08] text-white/68",children:[t.length," linked"]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.map(n=>{const _=t.length>1;return e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full bg-white/[0.08] px-3 py-2 text-sm text-white/72",children:[e.jsxs("span",{children:[f(n.entityType)," · ",W(n)]}),n.anchorKey?e.jsx("span",{className:"rounded-full bg-white/[0.08] px-2 py-0.5 text-[11px] text-white/54",children:Y(n.anchorKey)}):null,e.jsx("button",{type:"button",disabled:!_,className:"text-white/44 transition hover:text-white disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>r(t.filter(T=>!jt(T,n))),"aria-label":`Remove ${f(n.entityType)} link to ${W(n)}`,children:e.jsx(Pe,{className:"size-3.5"})})]},`${h}-${n.entityType}-${n.entityId}-${n.anchorKey??""}`)})}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,11rem)_minmax(0,1fr)_auto]",children:[e.jsx("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.entityType,onChange:n=>a({...i,entityType:n.target.value,entityId:""}),children:["goal","project","task","strategy","habit","tag","note","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","mode_guide_session","flashcard","event_type","emotion_definition","trigger_report"].map(n=>e.jsx("option",{value:n,children:f(n)},n))}),e.jsxs("select",{className:"min-w-0 rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.entityId,onChange:n=>a({...i,entityId:n.target.value}),children:[e.jsx("option",{value:"",children:(R[i.entityType]??[]).length>0?"Choose linked item":"No linked items available"}),(R[i.entityType]??[]).map(n=>e.jsx("option",{value:n.id,children:n.label},n.id))]}),e.jsx(y,{variant:"secondary",disabled:!i.entityId,onClick:()=>{Je(i,r,t)&&a({...i,entityId:""})},children:"Add link"})]})]});return e.jsx(it,{id:"notes",className:se?"min-w-0 overflow-hidden p-0":"min-w-0 overflow-hidden",children:e.jsxs("div",{className:se?"p-4":void 0,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:Qe}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/60",children:Be}),H?e.jsxs("div",{className:"mt-3 inline-flex items-center gap-2 rounded-full bg-white/[0.05] px-3 py-2 text-xs text-white/64",children:[e.jsxs("span",{children:["Pinned to ",H]}),xe?e.jsx(nt,{content:xe,label:`Explain ${H}`}):null]}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(j,{className:"bg-white/[0.08] text-white/72",children:rt(J.length)}),ae?null:e.jsxs(y,{type:"button",size:"sm",onClick:()=>E(!0),children:[e.jsx($e,{className:"size-4"}),"Add note"]})]})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 rounded-[22px] border border-white/8 bg-white/[0.04] px-3 py-3",children:[e.jsx(We,{className:"size-4 text-white/34"}),e.jsx(w,{value:I,onChange:t=>Oe(t.target.value),placeholder:"Search notes by content, author, or note tag",className:"border-0 bg-transparent px-0 py-0"})]}),ae?e.jsxs("div",{className:"mt-4 rounded-[24px] border border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/70",children:[e.jsx($e,{className:"size-4 text-[var(--secondary)]"}),"Add note"]}),e.jsxs(y,{type:"button",variant:"secondary",size:"sm",className:"gap-2",onClick:()=>A(t=>!t),children:[e.jsx(Ke,{className:"size-4"}),ie?"Back to editor":"Preview"]})]}),e.jsx("div",{className:"mt-3",children:ie?e.jsxs("div",{className:"rounded-[20px] bg-[rgba(9,14,25,0.78)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Preview"}),e.jsx("div",{className:"mt-3",children:v.trim()?e.jsx(Z,{markdown:v}):e.jsx("div",{className:"text-sm leading-6 text-white/42",children:"Markdown preview appears here once you have note content."})})]}):e.jsx(ze,{value:v,onChange:t=>q(t.target.value),placeholder:"Write in Markdown. Summaries, blockers, what changed, and why all work well here.",className:"min-h-[12rem]"})}),e.jsx("div",{className:"mt-3",children:Ce(te([{entityType:o,entityId:d,anchorKey:c??null},...ne]),t=>K(t.filter(r=>!(r.entityType===o&&r.entityId===d&&(r.anchorKey??null)===(c??null)))),Ue,$,"composer-note-links")}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(Fe,{value:re,onChange:P}),e.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-white/46",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(w,{type:"datetime-local",value:le,onChange:t=>z(t.target.value)}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(w,{type:"number",min:"1",value:oe,onChange:t=>F(t.target.value),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-white/10 bg-white/[0.04] px-3 py-3 text-sm text-white",value:de,onChange:t=>M(t.target.value),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:[e.jsx(y,{type:"button",variant:"secondary",onClick:()=>{E(!1),A(!1),q(""),K([]),$({entityType:"goal",entityId:""}),P([]),z(""),F(""),M("days")},children:"Cancel"}),e.jsx(y,{pending:Ne.isPending,pendingLabel:"Saving",disabled:v.trim().length===0,onClick:async()=>{await Ne.mutateAsync(v.trim()),E(!1)},children:"Save note"})]})]}):null,e.jsxs("div",{className:"mt-4 grid gap-3",children:[g.isLoading?e.jsx("div",{className:"rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/56",children:"Loading notes…"}):null,!g.isLoading&&J.length===0?e.jsx("div",{className:"rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/56",children:"No notes are linked here yet."}):null,J.map(t=>{const r=He===t.id,i=bt(t,o,d);return e.jsxs("article",{className:"rounded-[24px] border border-white/8 bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-xs uppercase tracking-[0.16em] text-white/38",children:[(t.author??"Unknown author").toString()," •"," ",new Date(t.updatedAt).toLocaleString()]}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[i.map(a=>e.jsxs(j,{className:"bg-white/[0.08] text-white/68",wrap:!0,children:[f(a.entityType)," ·"," ",W(a),a.anchorKey?` · ${Y(a.anchorKey)}`:""]},`${t.id}-${a.entityType}-${a.entityId}-${a.anchorKey??""}`)),(t.tags??[]).map(a=>e.jsx(j,{className:"bg-cyan-400/10 text-cyan-50",wrap:!0,children:a},`${t.id}-tag-${a}`)),t.destroyAt?e.jsxs(j,{className:"bg-amber-400/10 text-amber-100",wrap:!0,children:["Ephemeral · deletes"," ",new Date(t.destroyAt).toLocaleString()]}):null]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",className:"inline-flex size-9 items-center justify-center rounded-full bg-white/[0.06] text-white/60 transition hover:bg-white/[0.1] hover:text-white",onClick:()=>{Q(t.id),B(t.contentMarkdown),N(!1),O(t.links),U({entityType:"goal",entityId:""}),k(ee(t.tags??[])),C(yt(t.destroyAt??null)),S(""),D("days")},children:e.jsx(Xe,{className:"size-4"})}),e.jsx("button",{type:"button",className:"inline-flex size-9 items-center justify-center rounded-full bg-rose-500/10 text-rose-200 transition hover:bg-rose-500/16",onClick:()=>{Ge.mutateAsync(t.id)},children:e.jsx(Pe,{className:"size-4"})})]})]}),r?e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"flex flex-wrap items-center justify-end gap-2",children:e.jsxs(y,{type:"button",variant:"secondary",size:"sm",className:"gap-2",onClick:()=>N(a=>!a),children:[e.jsx(Ke,{className:"size-4"}),ce?"Back to editor":"Preview"]})}),e.jsx("div",{className:"mt-3",children:ce?e.jsxs("div",{className:"rounded-[20px] bg-[rgba(9,14,25,0.78)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Preview"}),e.jsx("div",{className:"mt-3",children:b.trim()?e.jsx(Z,{markdown:b}):e.jsx("div",{className:"text-sm text-white/42",children:"No content yet."})})]}):e.jsx(ze,{value:b,onChange:a=>B(a.target.value),className:"min-h-[12rem]"})}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(Fe,{value:me,onChange:k}),e.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-white/[0.03] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/38",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-white/46",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(w,{type:"datetime-local",value:ue,onChange:a=>C(a.target.value)}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(w,{type:"number",min:"1",value:pe,onChange:a=>S(a.target.value),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-white/10 bg-white/[0.04] px-3 py-3 text-sm text-white",value:he,onChange:a=>D(a.target.value),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsx("div",{className:"mt-3",children:Ce(V,O,Re,U,`edit-note-links-${t.id}`)}),e.jsxs("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:[e.jsx(y,{variant:"secondary",onClick:()=>{Q(null),N(!1),k([]),C(""),S(""),D("days")},children:"Cancel"}),e.jsx(y,{pending:ke.isPending,pendingLabel:"Saving",disabled:b.trim().length===0||V.length===0,onClick:async()=>{await ke.mutateAsync({noteId:t.id,contentMarkdown:b.trim(),links:V,tags:ee(me),destroyAt:Me(ue,pe,he)})},children:"Save changes"})]})]}):e.jsx("div",{className:"mt-4",children:e.jsx(Z,{markdown:t.contentMarkdown})})]},t.id)})]})]})})}export{St as E};
@@ -1 +0,0 @@
1
- import{r as w,j as t,aK as D,b3 as _}from"./vendor-DHkYh85p.js";import{Z as r}from"./index-CF4J4R9L.js";function B(o){return o.trim().toLowerCase()}function A({title:o,description:m,query:x,onQueryChange:b,onQuerySubmit:f,options:p,selectedOptionIds:i,onSelectedOptionIdsChange:c,resultSummary:M,clearLabel:j="Clear filters",submitLabel:v="Search",placeholder:E="Search title, alias, domain, source, or filter chip",emptyStateMessage:C="Keep typing to search the library or pick one of the suggested filter chips.",compact:l=!1,minimal:a=!1,hideSummary:F=!1}){const[$,n]=w.useState(!1),[g,d]=w.useState(0),N=w.useMemo(()=>i.map(e=>p.find(s=>s.id===e)).filter(Boolean),[p,i]),u=w.useMemo(()=>{const e=B(x),s=p.filter(h=>!i.includes(h.id));return e?s.filter(h=>`${h.label} ${h.description??""} ${h.searchText??""}`.toLowerCase().includes(e)).slice(0,12):s.slice(0,12)},[p,x,i]),y=e=>{i.includes(e)||(c([...i,e]),b(""),n(!1),d(0))},k=e=>{c(i.filter(s=>s!==e))},z=()=>{b(""),c([]),d(0),n(!1)};return t.jsxs("div",{className:r("rounded-[28px] border border-white/8 bg-[linear-gradient(135deg,rgba(19,30,42,0.92),rgba(9,15,24,0.98))] shadow-[0_30px_80px_rgba(3,8,18,0.28)]",a?"overflow-hidden rounded-full border-white/10 bg-[rgba(8,12,20,0.82)] px-3 py-1.5 shadow-[0_18px_50px_rgba(0,0,0,0.26)] backdrop-blur":l?"rounded-[24px] p-2.5":"p-4 sm:p-5"),children:[t.jsxs("div",{className:r("flex flex-wrap items-start justify-between gap-3",a&&"hidden"),children:[t.jsxs("div",{children:[o.trim().length>0?t.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-white/42",children:o}):null,m.trim().length>0?t.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/62",children:m}):null]}),i.length>0||x.trim().length>0?t.jsx("button",{type:"button",onClick:z,className:r("rounded-full border border-white/8 bg-white/[0.04] text-white/62 transition hover:bg-white/[0.08] hover:text-white",l?"px-2.5 py-1.5 text-[11px]":"px-3 py-2 text-sm"),children:j}):null]}),t.jsxs("div",{className:r("rounded-[24px] border border-white/8 bg-white/[0.04]",a?"rounded-full border-0 bg-transparent px-0 py-0":l?"mt-1.5 rounded-[18px] px-2.5 py-2":"mt-4 px-4 py-3"),children:[N.length>0?t.jsx("div",{className:r("flex flex-wrap gap-2",a?"mb-0 mr-2 inline-flex max-w-[38%] flex-nowrap items-center gap-1 overflow-hidden":l?"mb-2":"mb-3"),children:N.map(e=>t.jsxs("span",{className:r("inline-flex items-center gap-2 rounded-full border border-white/8 bg-white/[0.06]",a?"max-w-full shrink-0 border-white/10 bg-white/[0.08] px-2 py-0.5":l?"px-2 py-0.5":"px-2.5 py-1.5"),children:[e.badge??t.jsx("span",{className:"text-sm text-white/78",children:e.label}),t.jsx("button",{type:"button",className:"rounded-full text-white/52 transition hover:text-white",onClick:()=>k(e.id),"aria-label":`Remove ${e.label}`,children:t.jsx(D,{className:"size-3.5"})})]},e.id))}):null,t.jsxs("div",{className:"relative",children:[t.jsxs("div",{className:r("flex items-center",a?"gap-2 whitespace-nowrap":l?"gap-2":"gap-3"),children:[t.jsx(_,{className:r("text-white/36",l?"size-3.5":"size-4")}),t.jsx("input",{value:x,onChange:e=>{b(e.target.value),n(!0),d(0)},onFocus:()=>n(!0),onBlur:()=>window.setTimeout(()=>n(!1),120),onKeyDown:e=>{if(e.key==="Backspace"&&!x&&i.length>0){k(i[i.length-1]);return}if(e.key==="ArrowDown"){e.preventDefault(),n(!0),d(s=>u.length===0?0:Math.min(u.length-1,s+1));return}if(e.key==="ArrowUp"){e.preventDefault(),d(s=>Math.max(0,s-1));return}if(e.key==="Escape"){n(!1);return}if(e.key==="Enter"&&f){e.preventDefault(),f(x),n(!1);return}e.key==="Enter"&&u[g]&&(e.preventDefault(),y(u[g].id))},placeholder:E,className:r("min-w-0 flex-1 bg-transparent text-white placeholder:text-white/34 focus:outline-none",a||l?"text-[12px]":"text-sm")}),a&&(i.length>0||x.trim().length>0)?t.jsx("button",{type:"button",onClick:z,className:"inline-flex size-6 items-center justify-center rounded-full border border-white/10 bg-white/[0.06] text-white/62 transition hover:text-white","aria-label":j,children:t.jsx(D,{className:"size-3.5"})}):null,f?t.jsx("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:()=>{f(x),n(!1)},className:r("inline-flex items-center justify-center rounded-full border border-white/10 bg-white/[0.08] text-white/72 transition hover:bg-white/[0.14] hover:text-white",a?"size-6":l?"size-7":"size-8"),"aria-label":v,title:v,children:t.jsx(_,{className:r(l?"size-3.5":"size-4")})}):null]}),$?t.jsx("div",{className:r("absolute top-full z-20 w-full border border-white/8 bg-[rgba(8,13,24,0.96)] shadow-[0_26px_60px_rgba(4,8,18,0.32)] backdrop-blur-xl",l?"mt-1.5 rounded-[18px] p-1.5":"mt-2 rounded-[22px] p-2"),children:u.length>0?u.map((e,s)=>t.jsx("button",{type:"button",className:r("flex w-full items-start justify-between gap-3 text-left transition",l?"rounded-[14px] px-2.5 py-2":"rounded-[18px] px-3 py-2.5",s===g?"bg-white/[0.1] text-white":"text-white/70 hover:bg-white/[0.06] hover:text-white"),onMouseEnter:()=>d(s),onMouseDown:h=>h.preventDefault(),onClick:()=>y(e.id),children:t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:r("truncate font-medium",l?"text-[12px]":"text-sm"),children:e.badge??e.label}),e.description?t.jsx("div",{className:r("mt-1 text-white/46",l?"text-[11px] leading-[1.125rem]":"text-xs leading-5"),children:e.description}):null]})},e.id)):t.jsx("div",{className:r("text-white/42",l?"px-2.5 py-2 text-[12px]":"px-3 py-2.5 text-sm"),children:C})}):null]})]}),F?null:t.jsx("div",{className:r("text-white/52",l?"mt-2 text-xs":"mt-3 text-sm"),children:M})]})}export{A as F};
@@ -1 +0,0 @@
1
- import{j as e,aC as l,b8 as b}from"./vendor-DHkYh85p.js";import{Z as i,c as m}from"./index-CF4J4R9L.js";import{m as h}from"./motion-BeD44FeG.js";function f({eyebrow:n,title:g,description:c,items:t,tone:a="core",className:x}){return e.jsxs("section",{className:i("min-w-0 overflow-hidden rounded-[28px] border border-white/6 shadow-[0_20px_54px_rgba(4,8,18,0.24)]",a==="core"?"bg-[linear-gradient(180deg,rgba(22,28,46,0.98),rgba(12,17,30,0.95))]":"bg-[linear-gradient(180deg,rgba(16,29,33,0.98),rgba(12,22,27,0.95))]",x),children:[e.jsxs("div",{className:i("grid min-w-0 gap-3 px-4 py-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,26rem)] lg:px-5",a==="core"?"bg-[radial-gradient(circle_at_top_right,rgba(192,193,255,0.12),transparent_36%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0))]":"bg-[radial-gradient(circle_at_top_right,rgba(110,231,183,0.1),transparent_36%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0))]"),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:i("font-label text-[11px] uppercase tracking-[0.2em]",a==="core"?"text-[var(--secondary)]":"text-[rgba(110,231,183,0.82)]"),children:n}),e.jsx("h2",{className:"mt-2 max-w-3xl font-display text-[clamp(1.35rem,2vw,1.9rem)] leading-none text-white",children:g}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/60",children:c})]}),e.jsx("div",{className:"grid min-w-0 gap-2 sm:grid-cols-3",children:t.slice(0,3).map(r=>r.href?e.jsxs(l,{to:r.href,className:i("min-w-0 rounded-[20px] border border-white/6 px-3 py-3 backdrop-blur-sm transition hover:bg-white/[0.08]",a==="core"?"bg-[linear-gradient(180deg,rgba(255,255,255,0.05),rgba(255,255,255,0.025))]":"bg-[linear-gradient(180deg,rgba(110,231,183,0.08),rgba(255,255,255,0.02))]"),children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:r.label}),e.jsx("div",{className:"mt-1.5 min-w-0 font-medium text-white",children:r.title})]},r.id):e.jsxs("div",{className:i("min-w-0 rounded-[20px] border border-white/6 px-3 py-3 backdrop-blur-sm",a==="core"?"bg-[linear-gradient(180deg,rgba(255,255,255,0.05),rgba(255,255,255,0.025))]":"bg-[linear-gradient(180deg,rgba(110,231,183,0.08),rgba(255,255,255,0.02))]"),children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:r.label}),e.jsx("div",{className:"mt-1.5 min-w-0 font-medium text-white",children:r.title})]},r.id))})]}),e.jsx("div",{className:"grid min-w-0 gap-3 px-4 py-4 lg:grid-cols-2 lg:px-5",children:t.map((r,o)=>{const s=i("group flex min-h-[13.5rem] min-w-0 flex-col overflow-hidden rounded-[24px] border border-white/7 p-0 transition hover:-translate-y-0.5 hover:shadow-[0_22px_46px_rgba(3,8,18,0.28)] sm:min-h-[15.5rem]",a==="core"?"bg-[linear-gradient(180deg,rgba(19,26,42,0.98),rgba(11,16,28,0.96))] hover:border-white/12 hover:bg-[linear-gradient(180deg,rgba(24,31,50,0.98),rgba(13,19,33,0.97))]":"bg-[linear-gradient(180deg,rgba(17,29,32,0.98),rgba(9,18,22,0.97))] hover:border-white/12 hover:bg-[linear-gradient(180deg,rgba(21,36,40,0.98),rgba(11,22,27,0.97))]"),d=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:i("flex min-w-0 flex-1 flex-col p-4",a==="core"?"bg-[radial-gradient(circle_at_top_left,rgba(192,193,255,0.1),transparent_28%),linear-gradient(180deg,rgba(255,255,255,0.025),rgba(255,255,255,0))]":"bg-[radial-gradient(circle_at_top_left,rgba(110,231,183,0.08),transparent_28%),linear-gradient(180deg,rgba(255,255,255,0.025),rgba(255,255,255,0))]"),children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:r.label}),e.jsx("div",{className:"mt-2.5 min-w-0 font-display text-[1.25rem] leading-tight text-white sm:text-[1.4rem]",children:r.title})]}),r.badge?e.jsx(m,{wrap:!0,className:"max-w-[10rem] shrink-0 self-start bg-white/[0.08] text-white/72",children:r.badge}):null]}),e.jsx("div",{className:"mt-2.5 text-sm leading-6 text-white/60",children:r.detail}),e.jsx("div",{className:"flex-1"})]}),r.href?e.jsx("div",{className:"border-t border-white/6 bg-[linear-gradient(180deg,rgba(255,255,255,0.02),rgba(255,255,255,0.01))] px-4 py-3",children:e.jsxs("div",{className:"inline-flex min-h-10 min-w-0 max-w-full items-center gap-2 rounded-full border border-white/8 bg-white/[0.05] px-4 text-sm text-white/68 transition group-hover:border-white/14 group-hover:bg-white/[0.08] group-hover:text-white",children:[r.actionLabel??"Open",e.jsx(b,{className:"size-3.5"})]})}):null]});return e.jsx(h.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.22,delay:.04*o,ease:"easeOut"},children:r.href?e.jsx(l,{to:r.href,className:s,children:d}):e.jsx("div",{className:s,children:d})},r.id)})})]})}export{f as F};
@@ -1 +0,0 @@
1
- import{r as g,j as e,aC as b,c4 as P,b8 as C}from"./vendor-DHkYh85p.js";import{P as S}from"./page-hero-DRy5b2MU.js";import{E as G}from"./entity-note-count-link-DrhjJZ4i.js";import{C as N,B as y,b as k,V as p,c as l,X as E,Z as v,u as z,s as L,a as T,_ as B,U as I,W as R}from"./index-CF4J4R9L.js";import{P as D}from"./pill-cluster-C9QczVJ2.js";import{b as F,f as U,P as M}from"./project-collections-xPz2mlRr.js";import"./state-B-4sS1xO.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";function O({goals:s,tags:n,users:c,defaultUserId:o=null,pending:d=!1,onCreate:r,onUpdate:j}){const[u,x]=g.useState(!1),[w,m]=g.useState(null),a=s.find(t=>t.id===w)??null;return e.jsxs(e.Fragment,{children:[e.jsxs(N,{children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Goal arcs"}),e.jsx("h3",{className:"mt-2 font-display text-3xl text-white",children:"Strategic arcs before tickets"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-7 text-white/60",children:"This is the long-horizon map. Each arc shows why it matters, how much ground has been covered, and which project should move next."})]}),e.jsx(y,{onClick:()=>{m(null),x(!0)},children:"Create goal"})]}),e.jsxs("div",{className:"mt-5 grid gap-3 xl:grid-cols-2",children:[s.length===0?e.jsx("div",{className:"rounded-[24px] bg-white/[0.04] p-5 text-sm leading-7 text-white/60 xl:col-span-2",children:"Start with a life goal. Once the destination is clear, you can attach projects and then fill those projects with tasks."}):null,s.map(t=>{const h=`${Math.max(6,Math.min(100,t.progress))}%`;return e.jsxs(b,{to:`/goals/${t.id}`,className:"rounded-[24px] border border-white/6 bg-[linear-gradient(180deg,rgba(255,255,255,0.06),rgba(255,255,255,0.03))] p-4 transition hover:bg-[linear-gradient(180deg,rgba(255,255,255,0.09),rgba(255,255,255,0.04))]",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(k,{kind:"goal",compact:!0,gradient:!1}),e.jsx("div",{className:"mt-2",children:e.jsx(p,{kind:"goal",label:t.title,variant:"heading",size:"lg",showKind:!1,lines:2})}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-white/58",children:t.description||"No strategic note attached yet."})]}),e.jsx("button",{className:"rounded-full bg-white/6 p-2 text-white/60 transition hover:bg-white/10 hover:text-white",type:"button",onClick:i=>{i.preventDefault(),i.stopPropagation(),m(t.id),x(!0)},children:e.jsx(P,{className:"size-4"})})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(l,{className:"bg-white/[0.08] text-white/70",children:t.horizon}),e.jsx(l,{className:t.status==="active"?"text-emerald-300":t.status==="paused"?"text-amber-300":"text-[var(--tertiary)]",children:t.status}),e.jsxs(l,{className:"bg-white/[0.08] text-white/70",children:[t.earnedPoints," / ",t.targetPoints," xp"]}),e.jsxs(l,{className:"bg-white/[0.08] text-white/70",children:[t.totalTasks," tasks"]})]}),e.jsx("div",{className:"mt-4 h-1.5 rounded-full bg-white/[0.08]",children:e.jsx("div",{className:"h-full rounded-full bg-[linear-gradient(90deg,var(--primary)_0%,var(--secondary)_100%)]",style:{width:h}})}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.tags.map(i=>e.jsx(l,{className:"bg-white/[0.06] text-white/58",children:i.name},i.id))}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.16em] text-white/42",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.momentumLabel}),e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-2",style:{color:t.themeColor},children:["Open arc",e.jsx(C,{className:"size-3.5"})]})]})]},t.id)})]})]}),e.jsx(E,{open:u,pending:d,editingGoal:a,tags:n,users:c,defaultUserId:o,onOpenChange:t=>{x(t),t||m(null)},onSubmit:async(t,h)=>{if(h){await j(h,t);return}await r(t)}})]})}function _({eyebrow:s,title:n,description:c,meta:o,actions:d,className:r}){return e.jsxs("div",{className:v("flex flex-wrap items-start justify-between gap-3",r),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[s?e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:s}):null,e.jsxs("div",{className:v("min-w-0",s&&"mt-2"),children:[e.jsx("div",{className:"min-w-0 text-lg text-white",children:n}),c?e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:c}):null]})]}),o||d?e.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:[o,d]}):null]})}function ee(){const s=z(),[n,c]=g.useState("active"),[o,d]=g.useState(null),r=s.snapshot.dashboard.goals.length>0,j=F(s.snapshot.dashboard.projects),u=U(s.snapshot.dashboard.projects,n),x=L(s.selectedUserIds),w=new Map(s.snapshot.dashboard.goals.map(a=>[a.id,u.filter(t=>t.goalId===a.id)])),m=async a=>{d(a);try{await s.patchProject(a,{status:"active"})}finally{d(null)}};return e.jsxs("div",{className:"grid gap-5",children:[e.jsx(S,{entityKind:"goal",title:e.jsx(p,{kind:"goal",label:"Life Goals",variant:"heading",size:"lg"}),titleText:"Life Goals",description:"Life goals are the destinations you care about over the long run. Each one can hold several projects, and those projects turn direction into real work.",badge:`${s.snapshot.dashboard.goals.length} active goals`,actions:r?e.jsxs("div",{className:"inline-flex min-h-10 items-center rounded-full border border-white/8 bg-white/[0.04] px-4 py-2 text-sm whitespace-nowrap text-white/68",children:[s.snapshot.dashboard.projects.length," live project",s.snapshot.dashboard.projects.length===1?"":"s"," ","attached"]}):null}),e.jsx(O,{goals:s.snapshot.dashboard.goals,tags:s.snapshot.tags,users:s.snapshot.users,defaultUserId:x,onCreate:s.createGoal,onUpdate:s.patchGoal}),r?e.jsx(M,{value:n,counts:j,onChange:c}):null,r?null:e.jsx(T,{eyebrow:"Life goals",title:"No life goals yet",description:"Define the first long-horizon direction above so Forge can attach projects, tasks, momentum, and evidence to something meaningful."}),r?e.jsx("div",{className:"grid gap-4",children:s.snapshot.dashboard.goals.map(a=>{const t=w.get(a.id)??[],h=B(s.snapshot.dashboard.notesSummaryByEntity,"goal",a.id);return e.jsx(b,{to:`/goals/${a.id}`,className:"min-w-0 overflow-hidden rounded-[28px] border border-white/6 bg-[linear-gradient(180deg,rgba(255,255,255,0.05),rgba(255,255,255,0.03))] p-4 transition hover:bg-[linear-gradient(180deg,rgba(255,255,255,0.08),rgba(255,255,255,0.04))] sm:p-5",children:e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)] xl:gap-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs(D,{children:[a.tags.slice(0,3).map(i=>e.jsx(l,{className:"bg-white/[0.08]",style:{color:i.color},children:i.name},i.id)),e.jsx(l,{className:"bg-white/[0.08] text-white/72",children:a.horizon}),e.jsx(I,{user:a.user,compact:!0})]}),e.jsx("div",{className:"mt-4",children:e.jsx(p,{kind:"goal",label:a.title,variant:"heading",size:"xl",lines:2})}),e.jsx("p",{className:"mt-3 max-w-2xl text-sm leading-7 text-white/58",children:a.description}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-3.5 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Progress"}),e.jsxs("div",{className:"mt-2 text-xl text-white",children:[a.progress,"%"]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-3.5 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Tasks done"}),e.jsxs("div",{className:"mt-2 text-xl text-white",children:[a.completedTasks,"/",Math.max(a.totalTasks,1)]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.03] px-3.5 py-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-white/40",children:"XP banked"}),e.jsx("div",{className:"mt-2 text-xl text-white",children:a.earnedPoints})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx(R,{value:a.progress})}),e.jsx("div",{className:"mt-4",children:e.jsx(G,{entityType:"goal",entityId:a.id,count:h.count})})]}),e.jsxs("div",{className:"min-w-0 rounded-[24px] bg-white/[0.04] p-4",children:[e.jsx(_,{title:"Projects carrying this direction",meta:e.jsx("div",{className:"shrink-0 text-sm text-white/48",children:t.length}),className:"gap-2"}),t.length===0?e.jsx("div",{className:"mt-4 text-sm leading-6 text-white/56",children:n==="active"?"No active project is attached yet. Create one so this direction starts producing visible work.":"No projects in this lifecycle view are attached yet. Switch filters or restart one to bring it back into active motion."}):e.jsx("div",{className:"mt-4 grid gap-3",children:t.slice(0,3).map(i=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.05] px-4 py-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx(k,{kind:"project",compact:!0,gradient:!1}),e.jsx(p,{kind:"project",label:i.title,className:"min-w-0",showIcon:!1,lines:2})]}),e.jsx(l,{className:"shrink-0",children:i.status})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:i.description}),e.jsxs("div",{className:"mt-3 text-sm text-white/42",children:["Next move:"," ",i.nextTaskTitle??"Define the first attached task"]}),n!=="active"&&i.status!=="active"?e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(y,{variant:"secondary",size:"sm",pending:o===i.id,pendingLabel:"Restarting…",onClick:f=>{f.preventDefault(),f.stopPropagation(),m(i.id)},children:"Restart"})}):null]},i.id))})]})]})},a.id)})}):e.jsx(N,{children:e.jsx("div",{className:"rounded-[20px] bg-white/[0.04] p-4 text-sm text-white/58",children:"Goal cards will appear here once the first long-horizon direction is created."})})]})}export{ee as GoalsPage};