forge-openclaw-plugin 0.3.0 → 0.3.2

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 (119) hide show
  1. package/dist/assets/{activity-page-DPPiiyLO.js → activity-page-DRRbpVK-.js} +1 -1
  2. package/dist/assets/{ai-surface-workspace-B_fV9C4s.js → ai-surface-workspace-DJPt-OaW.js} +1 -1
  3. package/dist/assets/{atlas-panel-BPTJyMcI.js → atlas-panel-G3wGxjYf.js} +1 -1
  4. package/dist/assets/{calendar-page-D4DcRQv7.js → calendar-page-y8G1ige8.js} +1 -1
  5. package/dist/assets/{calendar-rules-Cl_xMrBn.js → calendar-rules-CRhXqGQu.js} +1 -1
  6. package/dist/assets/{calendar-week-toolbar-BARSOEO9.js → calendar-week-toolbar-CWSK5hJl.js} +1 -1
  7. package/dist/assets/{companion-sync-lab-page-COFYDI3w.js → companion-sync-lab-page-kEgOF3c6.js} +1 -1
  8. package/dist/assets/daily-metrics-dashboard-BJjUIZVA.js +1 -0
  9. package/dist/assets/{entity-note-count-link-BX93WYgh.js → entity-note-count-link-ef3ZOpKM.js} +1 -1
  10. package/dist/assets/{entity-notes-surface-CBlKc-x-.js → entity-notes-surface-CaCjjUaq.js} +1 -1
  11. package/dist/assets/{execution-board-Dh41UeKR.js → execution-board-RRWm2srb.js} +1 -1
  12. package/dist/assets/{faceted-token-search-BgxYH_gW.js → faceted-token-search-CZmtyJTT.js} +1 -1
  13. package/dist/assets/{flagship-signal-deck-bolzzK8q.js → flagship-signal-deck-DxRfmfpN.js} +1 -1
  14. package/dist/assets/{floating-action-menu-C5H-Wr2B.js → floating-action-menu-cKjNsPYD.js} +1 -1
  15. package/dist/assets/{goal-detail-page-CQeFnGDJ.js → goal-detail-page-BgQlK7yT.js} +1 -1
  16. package/dist/assets/{goals-page-BTg9crEK.js → goals-page-Cz2i3pVy.js} +1 -1
  17. package/dist/assets/{habits-page-C4vqk346.js → habits-page-BmEmWCGv.js} +1 -1
  18. package/dist/assets/index-Bcem7l5u.css +1 -0
  19. package/dist/assets/{index-By3tQxiE.js → index-QJkjKYzZ.js} +2 -2
  20. package/dist/assets/{insight-flow-dialog-JPYCsTKI.js → insight-flow-dialog-CdYMHwMP.js} +1 -1
  21. package/dist/assets/{insights-page-CFhVMlVL.js → insights-page-DHG-o9P_.js} +1 -1
  22. package/dist/assets/{kanban-page-DC3IDsnh.js → kanban-page-C6S_fJRc.js} +1 -1
  23. package/dist/assets/{knowledge-graph-page-DucyRYTZ.js → knowledge-graph-page-juA9QCy0.js} +1 -1
  24. package/dist/assets/{life-force-page-UrXfxaSO.js → life-force-page-ChTIA4mV.js} +1 -1
  25. package/dist/assets/{life-force-workspace-BhPNH7ad.js → life-force-workspace-sszLD-Yn.js} +1 -1
  26. package/dist/assets/{metric-tile-DtRPjN4V.js → metric-tile-B-tDTcBt.js} +1 -1
  27. package/dist/assets/{movement-page-DCIdTQEN.js → movement-page-Dx3T3HrG.js} +1 -1
  28. package/dist/assets/{note-markdown-CepDxj3v.js → note-markdown-CCyyE85h.js} +1 -1
  29. package/dist/assets/{note-tags-input-BXYaDkOr.js → note-tags-input-BS14YXHn.js} +1 -1
  30. package/dist/assets/{notes-page-Bl1LlCLo.js → notes-page-D3yGl8TN.js} +1 -1
  31. package/dist/assets/{open-in-graph-button-C263zl5l.js → open-in-graph-button-CMjJZX7G.js} +1 -1
  32. package/dist/assets/{orbit-map-Cb_AJyIj.js → orbit-map-v2Pv9RU_.js} +1 -1
  33. package/dist/assets/{overview-page-C2yLity7.js → overview-page-DSOpBpHf.js} +1 -1
  34. package/dist/assets/{page-hero-5RTqAI88.js → page-hero-CONuJu5J.js} +1 -1
  35. package/dist/assets/{pill-cluster-CBrrtZBm.js → pill-cluster-W2fY48OM.js} +1 -1
  36. package/dist/assets/{preference-entity-handoff-button-BQzg2J4k.js → preference-entity-handoff-button-CKDxCnbl.js} +1 -1
  37. package/dist/assets/{preferences-page-DekYF-Yz.js → preferences-page-Br3zrLlH.js} +1 -1
  38. package/dist/assets/{project-collections-BVXB8PPF.js → project-collections-NBwk6yV-.js} +1 -1
  39. package/dist/assets/{project-detail-page-CQlrLEn9.js → project-detail-page-BIU9_TRN.js} +1 -1
  40. package/dist/assets/{project-management-hierarchy-page--mzM_zRE.js → project-management-hierarchy-page-C2H620xD.js} +1 -1
  41. package/dist/assets/{project-management-section-nav-DQl0qRWy.js → project-management-section-nav-DRPVS1Eh.js} +1 -1
  42. package/dist/assets/{projects-page-Dr_0NdVP.js → projects-page-w7a_L2-z.js} +1 -1
  43. package/dist/assets/{psyche-behaviors-page-DOUaCWON.js → psyche-behaviors-page-Dt4CMC-q.js} +1 -1
  44. package/dist/assets/{psyche-flashcards-page-BA84fO_X.js → psyche-flashcards-page-rXz06dqO.js} +1 -1
  45. package/dist/assets/{psyche-goal-map-page-DpXAg1Vf.js → psyche-goal-map-page-BCcD6Jkl.js} +1 -1
  46. package/dist/assets/{psyche-graph-BxcbAbXt.js → psyche-graph-CXlAj4ED.js} +1 -1
  47. package/dist/assets/psyche-metrics-page-B1otiir6.js +1 -0
  48. package/dist/assets/{psyche-mode-guide-page-CBlIS5N_.js → psyche-mode-guide-page-C6AdVIAv.js} +1 -1
  49. package/dist/assets/{psyche-modes-page-DE6KDK_1.js → psyche-modes-page-DoUqz2mR.js} +1 -1
  50. package/dist/assets/psyche-page-BJNLQn8W.js +1 -0
  51. package/dist/assets/{psyche-patterns-page-DbCNRuww.js → psyche-patterns-page-CzpMSAPu.js} +1 -1
  52. package/dist/assets/{psyche-questionnaire-builder-page-DnraDj1H.js → psyche-questionnaire-builder-page-DjzatGVZ.js} +1 -1
  53. package/dist/assets/{psyche-questionnaire-detail-page-DQ6zNQkk.js → psyche-questionnaire-detail-page-B0Qfowfg.js} +1 -1
  54. package/dist/assets/{psyche-questionnaire-run-detail-page-BGrOIX0B.js → psyche-questionnaire-run-detail-page-B2dNj4jJ.js} +1 -1
  55. package/dist/assets/{psyche-questionnaire-run-page-Bg3BhBHb.js → psyche-questionnaire-run-page-DyD9Ui-g.js} +1 -1
  56. package/dist/assets/{psyche-questionnaires-page-BEreTNjG.js → psyche-questionnaires-page-BxfKcoi3.js} +1 -1
  57. package/dist/assets/{psyche-report-detail-page-Br9KlJBG.js → psyche-report-detail-page-Ci14mNUK.js} +1 -1
  58. package/dist/assets/{psyche-reports-page-Bk6QpAEF.js → psyche-reports-page-ALhNueiV.js} +1 -1
  59. package/dist/assets/{psyche-schemas-beliefs-page-Db8d2ga7.js → psyche-schemas-beliefs-page-C0P2Vw6-.js} +1 -1
  60. package/dist/assets/{psyche-screen-time-page-NazHUAkT.js → psyche-screen-time-page-BYnaT3cb.js} +1 -1
  61. package/dist/assets/{psyche-self-observation-page-H6FToucM.js → psyche-self-observation-page-eM9vpwIB.js} +1 -1
  62. package/dist/assets/{psyche-values-page-DqM382-6.js → psyche-values-page-BqrGIDok.js} +1 -1
  63. package/dist/assets/{report-chain-fields-nW4zndrM.js → report-chain-fields-CbkT7WOO.js} +1 -1
  64. package/dist/assets/{rewards-page-C-tZVnIK.js → rewards-page-DpAJ8IxE.js} +1 -1
  65. package/dist/assets/{scheduling-rules-editor-DGF-044c.js → scheduling-rules-editor-BUGnZJ0g.js} +1 -1
  66. package/dist/assets/{schema-badge-57AJ3FY-.js → schema-badge-CLAA4p-b.js} +1 -1
  67. package/dist/assets/{select-menu-mfaklv7r.js → select-menu-Cqs5t3ng.js} +1 -1
  68. package/dist/assets/{settings-agents-page-CPJeeYg0.js → settings-agents-page-pmkVrOO8.js} +1 -1
  69. package/dist/assets/{settings-bin-page-D3eX5aNf.js → settings-bin-page-BwtLrweW.js} +1 -1
  70. package/dist/assets/{settings-calendar-page-Bgx8NIsP.js → settings-calendar-page-BBjAMOCf.js} +1 -1
  71. package/dist/assets/{settings-data-page-BuMSUjpp.js → settings-data-page-Bqy5SukM.js} +1 -1
  72. package/dist/assets/{settings-logs-page-CHb2GNUM.js → settings-logs-page-8khtrf4T.js} +1 -1
  73. package/dist/assets/{settings-mobile-page-ClUvXhJg.js → settings-mobile-page-BcyRjEU_.js} +1 -1
  74. package/dist/assets/{settings-models-page-njK6D7zc.js → settings-models-page-DlSnO9WX.js} +1 -1
  75. package/dist/assets/{settings-page-Dm--cx6B.js → settings-page-CyBQ2qcB.js} +1 -1
  76. package/dist/assets/{settings-rewards-page-3aShLM3A.js → settings-rewards-page-BBX2WtVM.js} +1 -1
  77. package/dist/assets/{settings-section-nav-BWox23Qv.js → settings-section-nav-Co0AaDG-.js} +1 -1
  78. package/dist/assets/{settings-users-page-D-hEPpgQ.js → settings-users-page-JSnfFFPu.js} +1 -1
  79. package/dist/assets/{settings-wiki-page-CC-rOtDm.js → settings-wiki-page--nT23Fdy.js} +1 -1
  80. package/dist/assets/{sleep-page-Cm_Ei2w1.js → sleep-page-CGMi3MtV.js} +1 -1
  81. package/dist/assets/{sports-page-CqSI-j-H.js → sports-page-Kv5bBoLr.js} +1 -1
  82. package/dist/assets/{strategies-page-BuJ4zLLv.js → strategies-page-Br7RdUJO.js} +1 -1
  83. package/dist/assets/{strategy-detail-page-CLmy0jbW.js → strategy-detail-page-CBWXjUhC.js} +1 -1
  84. package/dist/assets/{strategy-dialog-DnJix1ys.js → strategy-dialog-BTwkaSxI.js} +1 -1
  85. package/dist/assets/{surface-DRNu5Fpz.js → surface-CyWI7e1R.js} +1 -1
  86. package/dist/assets/{task-detail-page-DTnNjW33.js → task-detail-page-Qis9354n.js} +1 -1
  87. package/dist/assets/{timebox-planning-dialog-DckIr1K4.js → timebox-planning-dialog-DB8snOBD.js} +1 -1
  88. package/dist/assets/{today-page-Cgk4HBPK.js → today-page-D9A5PU0S.js} +1 -1
  89. package/dist/assets/{training-load-page-C-7iINaB.js → training-load-page-Bpd4DQAh.js} +1 -1
  90. package/dist/assets/vitals-page-CVYC-4RG.js +1 -0
  91. package/dist/assets/{weekly-review-page-DFmuzzig.js → weekly-review-page-BP7N3fNB.js} +1 -1
  92. package/dist/assets/{weight-loss-page-CWtgeuti.js → weight-loss-page-_fX3N1UK.js} +1 -1
  93. package/dist/assets/{wiki-article-markdown-BkQg8Hne.js → wiki-article-markdown-Bi02AsVt.js} +1 -1
  94. package/dist/assets/{wiki-editor-page-BYKcdX5I.js → wiki-editor-page-OZf9l4Tg.js} +1 -1
  95. package/dist/assets/{wiki-ingest-history-page-D_p4myw1.js → wiki-ingest-history-page-CzeNSL7N.js} +1 -1
  96. package/dist/assets/{wiki-ingest-modal-C-CidueO.js → wiki-ingest-modal-Ig_xnyc6.js} +1 -1
  97. package/dist/assets/wiki-page-B4xuNgY4.js +1 -0
  98. package/dist/assets/{workbench-flow-page-Q3r2IJty.js → workbench-flow-page-BhRJCALC.js} +1 -1
  99. package/dist/assets/{workbench-page-BFfWMGm6.js → workbench-page-DxVs2AOY.js} +1 -1
  100. package/dist/assets/{workout-detail-page-DeDyz1Kk.js → workout-detail-page-D4wfkE98.js} +1 -1
  101. package/dist/index.html +2 -2
  102. package/dist/server/server/migrations/069_psyche_devrage_cumulative_rage.sql +5 -0
  103. package/dist/server/server/src/app.js +3 -2
  104. package/dist/server/server/src/openapi.js +48 -8
  105. package/dist/server/server/src/psyche-types.js +18 -4
  106. package/dist/server/server/src/services/devrage-scanner.js +115 -10
  107. package/dist/server/server/src/services/devrage.js +82 -13
  108. package/openclaw.plugin.json +1 -1
  109. package/package.json +1 -1
  110. package/server/migrations/069_psyche_devrage_cumulative_rage.sql +5 -0
  111. package/skills/forge-openclaw/SKILL.md +7 -0
  112. package/skills/forge-openclaw/entity_conversation_playbooks.md +23 -0
  113. package/skills/forge-openclaw/psyche_entity_playbooks.md +32 -0
  114. package/dist/assets/daily-metrics-dashboard-BNGQlJkQ.js +0 -1
  115. package/dist/assets/index-BAXYM89v.css +0 -1
  116. package/dist/assets/psyche-metrics-page-D8JQEoOl.js +0 -1
  117. package/dist/assets/psyche-page-Dkh7R2Dc.js +0 -1
  118. package/dist/assets/vitals-page-CqE4bYMf.js +0 -1
  119. package/dist/assets/wiki-page-DYpg9ZEO.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c2 as be,r as x,j as t}from"./vendor-Dnkkx2co.js";import{j as je,i as k,k as we}from"./state-vCcAT5Hq.js";import{S as re}from"./schema-badge-57AJ3FY-.js";import{u as ke,s as Ie,d9 as Te,cB as Se,bk as A,bl as F,cn as M,L as Ne,E as Ce,B as R,ch as Be,U as Le,_ as Ee,c as I,b as Ae,Q as Fe,aq as ne,a0 as Me,a1 as Pe,F as d,ah as qe,I as Oe,T as P,m as q,cp as Qe,cm as $e,cq as Re,d2 as Ue,cr as He,bz as Ke,by as De,bA as Ve,bw as _e,bC as Ge}from"./index-By3tQxiE.js";import{E as ze}from"./entity-note-count-link-BX93WYgh.js";import{A as se}from"./atlas-panel-BPTJyMcI.js";import{u as We,p as Je}from"./use-psyche-focus-target-Ct-acS9G.js";import{P as Ye}from"./page-hero-5RTqAI88.js";import{p as O}from"./query-cache-IQ8W-LNC.js";import{d as ie}from"./psyche-schemas-Dxj554nU.js";import{c as U,b as K,g as Xe,a as Ze,f as et}from"./schema-visuals-CvC9a3i6.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const S={schemaId:null,statement:"",beliefType:"absolute",originNote:"",confidence:60,evidenceFor:[],evidenceAgainst:[],flexibleAlternative:"",linkedValueIds:[],linkedBehaviorIds:[],linkedModeIds:[],linkedReportIds:[],userId:null};function H(a){return{schemaId:a.schemaId,statement:a.statement,beliefType:a.beliefType,originNote:a.originNote,confidence:a.confidence,evidenceFor:a.evidenceFor,evidenceAgainst:a.evidenceAgainst,flexibleAlternative:a.flexibleAlternative,linkedValueIds:a.linkedValueIds,linkedBehaviorIds:a.linkedBehaviorIds,linkedModeIds:a.linkedModeIds,linkedReportIds:a.linkedReportIds,userId:a.userId??null}}function tt({schema:a,beliefs:o,behaviors:f,reports:v}){const g=o.filter(n=>n.schemaId===a.id).length,l=f.filter(n=>n.linkedSchemaIds.includes(a.id)).length,c=v.filter(n=>n.schemaLinks.some(h=>{const r=et(h,[a]);return(r==null?void 0:r.id)===a.id})).length;return{beliefCount:g,behaviorCount:l,reportCount:c,total:g+l+c}}function ae({title:a,description:o,titleHelp:f,schemas:v,beliefs:g,behaviors:l,reports:c,onOpenBelief:n}){if(v.length===0)return null;const h=K(v[0].schemaType);return t.jsxs("section",{className:`min-w-0 grid gap-4 rounded-[30px] border p-4 md:p-5 ${h.sectionTone}`,children:[t.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-3 sm:flex-row sm:flex-wrap sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"grid min-w-0 gap-2",children:[t.jsxs("div",{className:`flex items-center gap-2 text-[11px] uppercase tracking-[0.18em] ${h.sectionEyebrow}`,children:[t.jsx("span",{children:a}),f?t.jsx(ne,{content:f,label:`Explain ${a.toLowerCase()}`}):null]}),t.jsx("div",{className:"max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:o})]}),t.jsxs(I,{children:[v.length," schemas"]})]}),t.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:v.map(r=>{const j=tt({schema:r,beliefs:g,behaviors:l,reports:c}),p=g.filter(u=>u.schemaId===r.id),y=K(r.schemaType);return t.jsxs("div",{className:`min-w-0 rounded-[26px] border p-5 ${y.cardTone}`,children:[t.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-3 sm:flex-row sm:justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(re,{label:r.title,schemaType:r.schemaType}),t.jsx("div",{className:"mt-3 text-sm text-[var(--ui-ink-faint)]",children:Xe(r.family)}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:r.description})]}),t.jsxs(I,{children:[j.total," ",y.countLabel]})]}),t.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[t.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[j.beliefCount," beliefs"]}),t.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[j.behaviorCount," behaviors"]}),t.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[j.reportCount," reports"]})]}),t.jsxs("div",{className:"mt-4 grid gap-3",children:[p.length>0?t.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-1)] p-4 text-sm text-[var(--ui-ink-soft)]",children:`${p.length} ${y.linkSummary}${p.length===1?"":"s"} live here.`}):t.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-1)] p-4 text-sm leading-6 text-[var(--ui-ink-faint)]",children:y.emptyCopy}),p.slice(0,2).map(u=>t.jsxs("button",{type:"button",className:"rounded-[20px] bg-[var(--ui-surface-1)] p-4 text-left transition hover:bg-[var(--ui-surface-2)]",onClick:()=>n(u),children:[t.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:u.statement}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:u.flexibleAlternative||"No flexible alternative recorded yet."})]},u.id))]})]},r.id)})})]})}function yt(){var J,Y,X,Z,ee,te;const a=ke(),o=je(),[f,v]=be(),[g,l]=x.useState(!1),[c,n]=x.useState(null),[h,r]=x.useState(S),[j,p]=x.useState(null),y=k({queryKey:["forge-psyche-schema-catalog"],queryFn:He}),u=k({queryKey:["forge-psyche-beliefs"],queryFn:Ke}),N=k({queryKey:["forge-psyche-behaviors"],queryFn:De}),C=k({queryKey:["forge-psyche-modes"],queryFn:Ve}),B=k({queryKey:["forge-psyche-values"],queryFn:_e}),L=k({queryKey:["forge-psyche-reports"],queryFn:Ge}),b=((J=y.data)==null?void 0:J.schemas)??[],T=((Y=u.data)==null?void 0:Y.beliefs)??[],Q=((X=N.data)==null?void 0:X.behaviors)??[],D=((Z=C.data)==null?void 0:Z.modes)??[],oe=((ee=B.data)==null?void 0:ee.values)??[],$=((te=L.data)==null?void 0:te.reports)??[],w=Ie(a.selectedUserIds),V=f.get("focus"),le=a.snapshot.dashboard.notesSummaryByEntity;We(V),x.useEffect(()=>{if(f.get("create")==="1"){l(!0),n(null),r({...S,userId:w});const e=new URLSearchParams(f);e.delete("create"),v(e,{replace:!0})}},[w,f,v]);const _=we({mutationFn:async e=>{const s=ie.parse(e);return c?Te(c.id,s):Se(s)},onSuccess:async()=>{l(!1),n(null),r({...S,userId:w}),p(null),await Promise.all([o.invalidateQueries({queryKey:["forge-psyche-beliefs"]}),o.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),de=oe.map(e=>({value:e.id,label:M(e.title,e.user),description:F(e.valuedDirection,e.user),searchText:A([e.title,e.valuedDirection,e.description],e),kind:"value"})),ce=Q.map(e=>({value:e.id,label:M(e.title,e.user),description:F(e.kind,e.user),searchText:A([e.title,e.kind,e.description],e),kind:"behavior"})),he=D.map(e=>({value:e.id,label:M(e.title,e.user),description:F(e.archetype||e.family,e.user),searchText:A([e.title,e.archetype,e.family,e.persona],e),kind:"mode"})),ue=$.map(e=>({value:e.id,label:M(e.title,e.user),description:F(e.customEventType||e.eventSituation,e.user),searchText:A([e.title,e.customEventType,e.eventSituation],e),kind:"report"})),me=x.useMemo(()=>new Map(b.map(e=>[e.id,e])),[b]),G=x.useMemo(()=>b.filter(e=>e.schemaType==="maladaptive"),[b]),z=x.useMemo(()=>b.filter(e=>e.schemaType==="adaptive"),[b]),pe=async e=>{const{value:s}=await Qe({title:e,description:"",valuedDirection:e,whyItMatters:"",linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],committedActions:[],userId:h.userId});return O(o,["forge-psyche-values"],"values",s),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:s.id,label:s.title,description:s.valuedDirection,kind:"value"}},fe=async e=>{const{behavior:s}=await $e({kind:"away",title:e,description:"",commonCues:[],urgeStory:"",shortTermPayoff:"",longTermCost:"",replacementMove:"",repairPlan:"",linkedPatternIds:[],linkedValueIds:[],linkedSchemaIds:[],linkedModeIds:[],userId:h.userId});return O(o,["forge-psyche-behaviors"],"behaviors",s),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:s.id,label:s.title,description:s.kind,kind:"behavior"}},ve=async e=>{const{mode:s}=await Re({family:"coping",archetype:"",title:e,persona:"",imagery:"",symbolicForm:"",facialExpression:"",fear:"",burden:"",protectiveJob:"",originContext:"",firstAppearanceAt:null,linkedPatternIds:[],linkedBehaviorIds:[],linkedValueIds:[],userId:h.userId});return O(o,["forge-psyche-modes"],"modes",s),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:s.id,label:s.title,description:s.archetype||s.family,kind:"mode"}},ge=async e=>{const{report:s}=await Ue({title:e,status:"draft",eventTypeId:null,customEventType:"",eventSituation:e,occurredAt:null,emotions:[],thoughts:[],behaviors:[],consequences:{selfShortTerm:[],selfLongTerm:[],othersShortTerm:[],othersLongTerm:[]},linkedPatternIds:[],linkedValueIds:[],linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],linkedBehaviorIds:[],linkedBeliefIds:[],linkedModeIds:[],modeOverlays:[],schemaLinks:[],modeTimeline:[],nextMoves:[],userId:h.userId});return O(o,["forge-psyche-reports"],"reports",s),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:s.id,label:s.title,description:s.customEventType||s.eventSituation,kind:"report"}};x.useEffect(()=>{g&&p(null)},[g]);const ye=[{id:"lens",eyebrow:"Lens",title:"Choose the schema and belief script",description:"Place the belief inside the right schema system, then write the actual inner line that tends to fire there.",render:(e,s)=>t.jsxs(t.Fragment,{children:[t.jsx(Me,{value:e.userId??null,users:a.snapshot.users,onChange:i=>s({userId:i}),defaultLabel:Pe(a.snapshot.users.find(i=>i.id===w)??null,"Choose belief owner"),help:"Beliefs can belong to a human or bot user even when they connect to shared behaviors, modes, and reports."}),t.jsx(d,{label:"Schema",description:"Choose the schema this belief belongs to, whether it is a recurring old pattern or a healthier pattern you want to strengthen.",labelHelp:"Schemas are the broader repeating themes. Beliefs are the personal scripts that fire inside those themes.",children:t.jsx("div",{className:"grid gap-4",children:[{title:"Maladaptive schemas",schemas:G,description:"Recurring old patterns that tend to get activated and distort how the situation feels.",schemaType:"maladaptive"},{title:"Adaptive schemas",schemas:z,description:"Healthier stable themes you want to strengthen, trust, and live from more often.",schemaType:"adaptive"}].map(i=>{const m=K(i.schemaType);return t.jsxs("div",{className:`rounded-[24px] border p-4 ${m.cardTone}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm font-medium text-[var(--ui-ink-strong)]",children:i.title}),t.jsx(ne,{content:U(i.schemaType),label:`Explain ${Ze(i.schemaType)}`})]}),t.jsx(qe,{className:"mt-2",children:i.description}),t.jsx("div",{className:"mt-4 grid gap-2 sm:flex sm:flex-wrap",children:i.schemas.map(E=>{const xe=e.schemaId===E.id;return t.jsx("button",{type:"button",className:`w-full rounded-[18px] border px-3 py-2 text-left text-sm leading-5 transition sm:w-auto sm:rounded-full ${xe?`${m.badgeTone} ring-1 ring-[var(--ui-ring)]`:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"}`,onClick:()=>s({schemaId:E.id}),children:E.title},E.id)})})]},i.schemaType)})})}),t.jsx(d,{label:"Belief statement",description:"Write the sentence the mind tends to say in the moment.",labelHelp:"A belief script should sound like the actual inner line that shows up under pressure, not a formal summary.",children:t.jsx(Oe,{value:e.statement,onChange:i=>s({statement:i.target.value}),placeholder:"If they go quiet, I am already being left."})}),t.jsx(d,{label:"Belief type",description:"Choose whether the script sounds absolute or conditional.",labelHelp:"Absolute beliefs sound fixed and global. Conditional beliefs sound more like if-then rules about safety, worth, or closeness.",children:t.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:["absolute","conditional"].map(i=>t.jsx("button",{type:"button",className:`rounded-[22px] border px-4 py-4 text-left transition ${e.beliefType===i?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)]"}`,onClick:()=>s({beliefType:i}),children:i==="absolute"?"Absolute: this is simply true":"Conditional: if this happens, then..."},i))})})]})},{id:"origin",eyebrow:"Origin",title:"Capture the origin and confidence of the script",description:"This keeps the belief from turning into a generic note divorced from actual history.",render:(e,s)=>t.jsxs(t.Fragment,{children:[t.jsx(d,{label:"Origin context",description:"Capture where this script learned its force or usefulness.",children:t.jsx(P,{value:e.originNote,onChange:i=>s({originNote:i.target.value}),placeholder:"It got stronger in periods where silence usually meant anger, distance, or punishment."})}),t.jsxs(d,{label:"Grip right now",description:"How strongly does this belief feel true when it gets activated?",labelHelp:"Grip is the felt strength of the script in the moment, not whether it is objectively true.",children:[t.jsx("input",{type:"range",min:0,max:100,value:e.confidence,onChange:i=>s({confidence:Number(i.target.value)})}),t.jsxs("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:[e.confidence,"% grip"]})]}),t.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[t.jsx(d,{label:"Evidence for",description:"Add one supporting memory, sign, or interpretation per line.",children:t.jsx(P,{value:e.evidenceFor.join(`
1
+ import{c2 as be,r as x,j as t}from"./vendor-Dnkkx2co.js";import{j as je,i as k,k as we}from"./state-vCcAT5Hq.js";import{S as re}from"./schema-badge-CLAA4p-b.js";import{u as ke,s as Ie,d9 as Te,cB as Se,bk as A,bl as F,cn as M,L as Ne,E as Ce,B as R,ch as Be,U as Le,_ as Ee,c as I,b as Ae,Q as Fe,aq as ne,a0 as Me,a1 as Pe,F as d,ah as qe,I as Oe,T as P,m as q,cp as Qe,cm as $e,cq as Re,d2 as Ue,cr as He,bz as Ke,by as De,bA as Ve,bw as _e,bC as Ge}from"./index-QJkjKYzZ.js";import{E as ze}from"./entity-note-count-link-ef3ZOpKM.js";import{A as se}from"./atlas-panel-G3wGxjYf.js";import{u as We,p as Je}from"./use-psyche-focus-target-Ct-acS9G.js";import{P as Ye}from"./page-hero-CONuJu5J.js";import{p as O}from"./query-cache-IQ8W-LNC.js";import{d as ie}from"./psyche-schemas-Dxj554nU.js";import{c as U,b as K,g as Xe,a as Ze,f as et}from"./schema-visuals-CvC9a3i6.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const S={schemaId:null,statement:"",beliefType:"absolute",originNote:"",confidence:60,evidenceFor:[],evidenceAgainst:[],flexibleAlternative:"",linkedValueIds:[],linkedBehaviorIds:[],linkedModeIds:[],linkedReportIds:[],userId:null};function H(a){return{schemaId:a.schemaId,statement:a.statement,beliefType:a.beliefType,originNote:a.originNote,confidence:a.confidence,evidenceFor:a.evidenceFor,evidenceAgainst:a.evidenceAgainst,flexibleAlternative:a.flexibleAlternative,linkedValueIds:a.linkedValueIds,linkedBehaviorIds:a.linkedBehaviorIds,linkedModeIds:a.linkedModeIds,linkedReportIds:a.linkedReportIds,userId:a.userId??null}}function tt({schema:a,beliefs:o,behaviors:f,reports:v}){const g=o.filter(n=>n.schemaId===a.id).length,l=f.filter(n=>n.linkedSchemaIds.includes(a.id)).length,c=v.filter(n=>n.schemaLinks.some(h=>{const r=et(h,[a]);return(r==null?void 0:r.id)===a.id})).length;return{beliefCount:g,behaviorCount:l,reportCount:c,total:g+l+c}}function ae({title:a,description:o,titleHelp:f,schemas:v,beliefs:g,behaviors:l,reports:c,onOpenBelief:n}){if(v.length===0)return null;const h=K(v[0].schemaType);return t.jsxs("section",{className:`min-w-0 grid gap-4 rounded-[30px] border p-4 md:p-5 ${h.sectionTone}`,children:[t.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-3 sm:flex-row sm:flex-wrap sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"grid min-w-0 gap-2",children:[t.jsxs("div",{className:`flex items-center gap-2 text-[11px] uppercase tracking-[0.18em] ${h.sectionEyebrow}`,children:[t.jsx("span",{children:a}),f?t.jsx(ne,{content:f,label:`Explain ${a.toLowerCase()}`}):null]}),t.jsx("div",{className:"max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:o})]}),t.jsxs(I,{children:[v.length," schemas"]})]}),t.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:v.map(r=>{const j=tt({schema:r,beliefs:g,behaviors:l,reports:c}),p=g.filter(u=>u.schemaId===r.id),y=K(r.schemaType);return t.jsxs("div",{className:`min-w-0 rounded-[26px] border p-5 ${y.cardTone}`,children:[t.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-3 sm:flex-row sm:justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(re,{label:r.title,schemaType:r.schemaType}),t.jsx("div",{className:"mt-3 text-sm text-[var(--ui-ink-faint)]",children:Xe(r.family)}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:r.description})]}),t.jsxs(I,{children:[j.total," ",y.countLabel]})]}),t.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[t.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[j.beliefCount," beliefs"]}),t.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[j.behaviorCount," behaviors"]}),t.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[j.reportCount," reports"]})]}),t.jsxs("div",{className:"mt-4 grid gap-3",children:[p.length>0?t.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-1)] p-4 text-sm text-[var(--ui-ink-soft)]",children:`${p.length} ${y.linkSummary}${p.length===1?"":"s"} live here.`}):t.jsx("div",{className:"rounded-[18px] bg-[var(--ui-surface-1)] p-4 text-sm leading-6 text-[var(--ui-ink-faint)]",children:y.emptyCopy}),p.slice(0,2).map(u=>t.jsxs("button",{type:"button",className:"rounded-[20px] bg-[var(--ui-surface-1)] p-4 text-left transition hover:bg-[var(--ui-surface-2)]",onClick:()=>n(u),children:[t.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:u.statement}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:u.flexibleAlternative||"No flexible alternative recorded yet."})]},u.id))]})]},r.id)})})]})}function yt(){var J,Y,X,Z,ee,te;const a=ke(),o=je(),[f,v]=be(),[g,l]=x.useState(!1),[c,n]=x.useState(null),[h,r]=x.useState(S),[j,p]=x.useState(null),y=k({queryKey:["forge-psyche-schema-catalog"],queryFn:He}),u=k({queryKey:["forge-psyche-beliefs"],queryFn:Ke}),N=k({queryKey:["forge-psyche-behaviors"],queryFn:De}),C=k({queryKey:["forge-psyche-modes"],queryFn:Ve}),B=k({queryKey:["forge-psyche-values"],queryFn:_e}),L=k({queryKey:["forge-psyche-reports"],queryFn:Ge}),b=((J=y.data)==null?void 0:J.schemas)??[],T=((Y=u.data)==null?void 0:Y.beliefs)??[],Q=((X=N.data)==null?void 0:X.behaviors)??[],D=((Z=C.data)==null?void 0:Z.modes)??[],oe=((ee=B.data)==null?void 0:ee.values)??[],$=((te=L.data)==null?void 0:te.reports)??[],w=Ie(a.selectedUserIds),V=f.get("focus"),le=a.snapshot.dashboard.notesSummaryByEntity;We(V),x.useEffect(()=>{if(f.get("create")==="1"){l(!0),n(null),r({...S,userId:w});const e=new URLSearchParams(f);e.delete("create"),v(e,{replace:!0})}},[w,f,v]);const _=we({mutationFn:async e=>{const s=ie.parse(e);return c?Te(c.id,s):Se(s)},onSuccess:async()=>{l(!1),n(null),r({...S,userId:w}),p(null),await Promise.all([o.invalidateQueries({queryKey:["forge-psyche-beliefs"]}),o.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),de=oe.map(e=>({value:e.id,label:M(e.title,e.user),description:F(e.valuedDirection,e.user),searchText:A([e.title,e.valuedDirection,e.description],e),kind:"value"})),ce=Q.map(e=>({value:e.id,label:M(e.title,e.user),description:F(e.kind,e.user),searchText:A([e.title,e.kind,e.description],e),kind:"behavior"})),he=D.map(e=>({value:e.id,label:M(e.title,e.user),description:F(e.archetype||e.family,e.user),searchText:A([e.title,e.archetype,e.family,e.persona],e),kind:"mode"})),ue=$.map(e=>({value:e.id,label:M(e.title,e.user),description:F(e.customEventType||e.eventSituation,e.user),searchText:A([e.title,e.customEventType,e.eventSituation],e),kind:"report"})),me=x.useMemo(()=>new Map(b.map(e=>[e.id,e])),[b]),G=x.useMemo(()=>b.filter(e=>e.schemaType==="maladaptive"),[b]),z=x.useMemo(()=>b.filter(e=>e.schemaType==="adaptive"),[b]),pe=async e=>{const{value:s}=await Qe({title:e,description:"",valuedDirection:e,whyItMatters:"",linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],committedActions:[],userId:h.userId});return O(o,["forge-psyche-values"],"values",s),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:s.id,label:s.title,description:s.valuedDirection,kind:"value"}},fe=async e=>{const{behavior:s}=await $e({kind:"away",title:e,description:"",commonCues:[],urgeStory:"",shortTermPayoff:"",longTermCost:"",replacementMove:"",repairPlan:"",linkedPatternIds:[],linkedValueIds:[],linkedSchemaIds:[],linkedModeIds:[],userId:h.userId});return O(o,["forge-psyche-behaviors"],"behaviors",s),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:s.id,label:s.title,description:s.kind,kind:"behavior"}},ve=async e=>{const{mode:s}=await Re({family:"coping",archetype:"",title:e,persona:"",imagery:"",symbolicForm:"",facialExpression:"",fear:"",burden:"",protectiveJob:"",originContext:"",firstAppearanceAt:null,linkedPatternIds:[],linkedBehaviorIds:[],linkedValueIds:[],userId:h.userId});return O(o,["forge-psyche-modes"],"modes",s),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:s.id,label:s.title,description:s.archetype||s.family,kind:"mode"}},ge=async e=>{const{report:s}=await Ue({title:e,status:"draft",eventTypeId:null,customEventType:"",eventSituation:e,occurredAt:null,emotions:[],thoughts:[],behaviors:[],consequences:{selfShortTerm:[],selfLongTerm:[],othersShortTerm:[],othersLongTerm:[]},linkedPatternIds:[],linkedValueIds:[],linkedGoalIds:[],linkedProjectIds:[],linkedTaskIds:[],linkedBehaviorIds:[],linkedBeliefIds:[],linkedModeIds:[],modeOverlays:[],schemaLinks:[],modeTimeline:[],nextMoves:[],userId:h.userId});return O(o,["forge-psyche-reports"],"reports",s),await o.invalidateQueries({queryKey:["forge-psyche-overview"]}),{value:s.id,label:s.title,description:s.customEventType||s.eventSituation,kind:"report"}};x.useEffect(()=>{g&&p(null)},[g]);const ye=[{id:"lens",eyebrow:"Lens",title:"Choose the schema and belief script",description:"Place the belief inside the right schema system, then write the actual inner line that tends to fire there.",render:(e,s)=>t.jsxs(t.Fragment,{children:[t.jsx(Me,{value:e.userId??null,users:a.snapshot.users,onChange:i=>s({userId:i}),defaultLabel:Pe(a.snapshot.users.find(i=>i.id===w)??null,"Choose belief owner"),help:"Beliefs can belong to a human or bot user even when they connect to shared behaviors, modes, and reports."}),t.jsx(d,{label:"Schema",description:"Choose the schema this belief belongs to, whether it is a recurring old pattern or a healthier pattern you want to strengthen.",labelHelp:"Schemas are the broader repeating themes. Beliefs are the personal scripts that fire inside those themes.",children:t.jsx("div",{className:"grid gap-4",children:[{title:"Maladaptive schemas",schemas:G,description:"Recurring old patterns that tend to get activated and distort how the situation feels.",schemaType:"maladaptive"},{title:"Adaptive schemas",schemas:z,description:"Healthier stable themes you want to strengthen, trust, and live from more often.",schemaType:"adaptive"}].map(i=>{const m=K(i.schemaType);return t.jsxs("div",{className:`rounded-[24px] border p-4 ${m.cardTone}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"text-sm font-medium text-[var(--ui-ink-strong)]",children:i.title}),t.jsx(ne,{content:U(i.schemaType),label:`Explain ${Ze(i.schemaType)}`})]}),t.jsx(qe,{className:"mt-2",children:i.description}),t.jsx("div",{className:"mt-4 grid gap-2 sm:flex sm:flex-wrap",children:i.schemas.map(E=>{const xe=e.schemaId===E.id;return t.jsx("button",{type:"button",className:`w-full rounded-[18px] border px-3 py-2 text-left text-sm leading-5 transition sm:w-auto sm:rounded-full ${xe?`${m.badgeTone} ring-1 ring-[var(--ui-ring)]`:"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"}`,onClick:()=>s({schemaId:E.id}),children:E.title},E.id)})})]},i.schemaType)})})}),t.jsx(d,{label:"Belief statement",description:"Write the sentence the mind tends to say in the moment.",labelHelp:"A belief script should sound like the actual inner line that shows up under pressure, not a formal summary.",children:t.jsx(Oe,{value:e.statement,onChange:i=>s({statement:i.target.value}),placeholder:"If they go quiet, I am already being left."})}),t.jsx(d,{label:"Belief type",description:"Choose whether the script sounds absolute or conditional.",labelHelp:"Absolute beliefs sound fixed and global. Conditional beliefs sound more like if-then rules about safety, worth, or closeness.",children:t.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:["absolute","conditional"].map(i=>t.jsx("button",{type:"button",className:`rounded-[22px] border px-4 py-4 text-left transition ${e.beliefType===i?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-hover)]"}`,onClick:()=>s({beliefType:i}),children:i==="absolute"?"Absolute: this is simply true":"Conditional: if this happens, then..."},i))})})]})},{id:"origin",eyebrow:"Origin",title:"Capture the origin and confidence of the script",description:"This keeps the belief from turning into a generic note divorced from actual history.",render:(e,s)=>t.jsxs(t.Fragment,{children:[t.jsx(d,{label:"Origin context",description:"Capture where this script learned its force or usefulness.",children:t.jsx(P,{value:e.originNote,onChange:i=>s({originNote:i.target.value}),placeholder:"It got stronger in periods where silence usually meant anger, distance, or punishment."})}),t.jsxs(d,{label:"Grip right now",description:"How strongly does this belief feel true when it gets activated?",labelHelp:"Grip is the felt strength of the script in the moment, not whether it is objectively true.",children:[t.jsx("input",{type:"range",min:0,max:100,value:e.confidence,onChange:i=>s({confidence:Number(i.target.value)})}),t.jsxs("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:[e.confidence,"% grip"]})]}),t.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[t.jsx(d,{label:"Evidence for",description:"Add one supporting memory, sign, or interpretation per line.",children:t.jsx(P,{value:e.evidenceFor.join(`
2
2
  `),onChange:i=>s({evidenceFor:i.target.value.split(`
3
3
  `).map(m=>m.trim()).filter(Boolean)}),placeholder:`One line per sign
4
4
  They stopped replying for days
@@ -1 +1 @@
1
- import{r as Q,j as e}from"./vendor-Dnkkx2co.js";import{i as N}from"./state-vCcAT5Hq.js";import{S as B,E as G,c as l,ch as U,C as i,Z as x,B as V,d5 as X,d6 as Y,d7 as z,d8 as Z}from"./index-By3tQxiE.js";import{P as J}from"./page-hero-5RTqAI88.js";import{R as w,A,C,X as L,Y as F,T,a as k}from"./charts-DFnEuIMB.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const S="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] p-5 shadow-[var(--card-shadow)]",_="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",j="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5",d="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",P="font-label text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",b="text-[var(--ui-ink-soft)]",m="border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",O="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%)]",K="var(--ui-border-subtle)",h="var(--ui-ink-faint)",ee="color-mix(in_srgb,var(--success)_82%,var(--primary)_18%)",se="color-mix(in_srgb,var(--success)_18%,transparent)",M="color-mix(in_srgb,var(--info)_86%,var(--primary)_14%)",W="color-mix(in_srgb,var(--info)_16%,transparent)",te="var(--ui-ink-strong)",ae="color-mix(in_srgb,var(--ui-ink-strong)_12%,transparent)",D={background:"var(--ui-surface-modal)",border:"1px solid var(--ui-border-subtle)",borderRadius:"8px",color:"var(--ui-ink-strong)"};function re(t){switch(t){case"fresh":return"border border-[color-mix(in_srgb,var(--success)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]";case"stale":return"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%)]";case"unavailable":return"border border-[color-mix(in_srgb,var(--danger)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_74%,var(--ui-ink-strong)_26%)]";default:return m}}function n(t){return t>=3600?`${(t/3600).toFixed(1)}h`:`${Math.round(t/60)}m`}function R(t){return`${String(t).padStart(2,"0")}:00`}function $(t){return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t]??"Day"}function ie(t,r,c){return!t||!r?c:`${new Date(t).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})} → ${new Date(r).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`}function H(t,r){const c=typeof t=="number"?t:typeof t=="string"?Number(t):0;return[r==="totalActivitySeconds"||r==="averageActivitySeconds"?n(c):String(Math.round(c)),r==="totalActivitySeconds"?"Activity":r==="averageActivitySeconds"?"Avg activity":r==="pickupCount"||r==="averagePickups"?r==="averagePickups"?"Avg pickups":"Pickups":r==="averageNotifications"?"Avg notifications":"Notifications"]}function fe(){const[t,r]=Q.useState("day"),c=N({queryKey:["forge-screen-time-settings"],queryFn:()=>X().then(s=>s.settings)}),v=N({queryKey:["forge-screen-time-day"],queryFn:()=>Y().then(s=>s.screenTime)}),p=N({queryKey:["forge-screen-time-month"],queryFn:()=>z().then(s=>s.screenTime)}),f=N({queryKey:["forge-screen-time-all-time"],queryFn:()=>Z().then(s=>s.screenTime)});if(c.isLoading||v.isLoading||p.isLoading||f.isLoading)return e.jsx(B,{});const q=c.error??v.error??p.error??f.error;if(q||!c.data||!v.data||!p.data||!f.data)return e.jsx(G,{eyebrow:"Psyche",error:q,onRetry:()=>{c.refetch(),v.refetch(),p.refetch(),f.refetch()}});const a=c.data,o=v.data,g=p.data,u=f.data,E=o.topApps.slice(0,3).map(s=>s.displayName||s.bundleIdentifier),I=typeof a.metadata.snapshot_source=="string"?a.metadata.snapshot_source.replaceAll("_"," "):"device activity report";return e.jsxs("div",{className:"space-y-5",children:[e.jsx(J,{title:"Screen Time",titleText:"Screen Time",description:"Apple-compliant device activity, hourly usage, and reflective phone context woven into Psyche.",actions:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(l,{tone:"default",className:m,children:a.authorizationStatus.replaceAll("_"," ")}),e.jsx(l,{tone:"default",className:m,children:a.captureState.replaceAll("_"," ")}),e.jsx(l,{tone:"default",className:re(a.captureFreshness),children:a.captureFreshness}),e.jsx(l,{tone:"default",className:m,children:a.syncEnabled?"Sync on":"Sync paused"})]})}),e.jsx(U,{}),e.jsxs(i,{className:S,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:d,children:"Reflective device activity"}),e.jsx("div",{className:x("mt-2 max-w-3xl text-sm",b),children:"Forge treats Screen Time as reflective evidence, not as fake exact foreground traces. Movement overlap is estimated from hourly bins and stays truthful about that."})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:["day","month","all_time"].map(s=>e.jsx(V,{variant:"ghost",className:t===s?"h-9 rounded-full border border-[color-mix(in_srgb,var(--success)_35%,var(--ui-border-subtle)_65%)] bg-[var(--ui-success-soft)] px-4 text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":"h-9 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 text-[var(--ui-ink-soft)]",onClick:()=>r(s),children:s==="all_time"?"All time":s},s))})]}),e.jsxs("div",{className:"mt-5 grid gap-3 md:grid-cols-3",children:[e.jsxs(i,{className:_,children:[e.jsx("div",{className:P,children:"Today on screen"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:n(o.summary.totalActivitySeconds)}),e.jsxs("div",{className:x("mt-2 text-sm",b),children:["Across ",o.summary.activeHourCount," active hours."]})]}),e.jsxs(i,{className:_,children:[e.jsx("div",{className:P,children:"Pickups today"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:o.summary.pickupCount}),e.jsxs("div",{className:x("mt-2 text-sm",b),children:["First pickup"," ",o.summary.firstPickupAt?new Date(o.summary.firstPickupAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"not captured","."]})]}),e.jsxs(i,{className:_,children:[e.jsx("div",{className:P,children:"Capture health"}),e.jsx("div",{className:"mt-3 text-lg text-[var(--ui-ink-strong)]",children:a.captureFreshness==="fresh"?a.captureAgeHours!==null?`Updated ${a.captureAgeHours.toFixed(1)}h ago`:"Fresh capture":a.captureFreshness==="stale"?a.captureAgeHours!==null?`Last refresh ${a.captureAgeHours.toFixed(1)}h ago`:"Capture is stale":a.captureFreshness==="unavailable"?"Unavailable":"Waiting for capture"}),e.jsxs("div",{className:x("mt-2 text-sm",b),children:[a.capturedDayCount," days, ",a.capturedHourCount," ","hourly slices, ",a.captureWindowDays," day window."]})]})]}),e.jsx(i,{className:x("mt-3",_),children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(l,{tone:"default",className:m,children:I}),e.jsx(l,{tone:"default",className:m,children:"Hourly model"}),e.jsx(l,{tone:"default",className:m,children:ie(a.lastCaptureStartedAt,a.lastCaptureEndedAt,"No captured range yet")}),E.map(s=>e.jsx(l,{tone:"default",className:O,children:s},s))]})})]}),t==="day"?e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]",children:[e.jsxs(i,{className:S,children:[e.jsx("div",{className:d,children:"Hourly rhythm"}),e.jsx("div",{className:x("mt-2 text-sm",b),children:"Activity, pickups, and notification pressure across the day."}),e.jsx("div",{className:"mt-5 h-72",children:e.jsx(w,{width:"100%",height:"100%",children:e.jsxs(A,{data:o.hourlySegments,children:[e.jsx(C,{stroke:K,vertical:!1}),e.jsx(L,{dataKey:"hourIndex",tickFormatter:R,stroke:h,tickLine:!1,axisLine:!1}),e.jsx(F,{stroke:h,tickLine:!1,axisLine:!1,tickFormatter:s=>n(Number(s))}),e.jsx(T,{contentStyle:D,formatter:(s,y)=>H(s,String(y)),labelFormatter:s=>R(Number(s))}),e.jsx(k,{type:"monotone",dataKey:"totalActivitySeconds",stroke:ee,fill:se,strokeWidth:2}),e.jsx(k,{type:"monotone",dataKey:"pickupCount",stroke:M,fill:W,strokeWidth:1.6})]})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Top apps"}),e.jsx("div",{className:"mt-4 space-y-3",children:o.topApps.slice(0,6).map(s=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:s.displayName||s.bundleIdentifier}),e.jsx("div",{className:"truncate text-xs text-[var(--ui-ink-faint)]",children:s.categoryLabel||s.bundleIdentifier})]}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:n(s.totalActivitySeconds)})]},s.id))})]}),e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Top categories"}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:o.topCategories.slice(0,8).map(s=>e.jsxs(l,{tone:"default",className:m,children:[s.categoryLabel," ·"," ",n(s.totalActivitySeconds)]},s.id))})]})]})]}):null,t==="month"?e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]",children:[e.jsxs(i,{className:S,children:[e.jsx("div",{className:d,children:"Monthly drift"}),e.jsx("div",{className:"mt-5 h-72",children:e.jsx(w,{width:"100%",height:"100%",children:e.jsxs(A,{data:g.days,children:[e.jsx(C,{stroke:K,vertical:!1}),e.jsx(L,{dataKey:"dateKey",stroke:h,tickLine:!1,axisLine:!1}),e.jsx(F,{stroke:h,tickLine:!1,axisLine:!1,tickFormatter:s=>n(Number(s))}),e.jsx(T,{contentStyle:D,formatter:(s,y)=>H(s,String(y))}),e.jsx(k,{type:"monotone",dataKey:"totalActivitySeconds",stroke:te,fill:ae,strokeWidth:2})]})})})]}),e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Month summary"}),e.jsxs("div",{className:"mt-4 space-y-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Total activity"}),e.jsx("span",{children:n(g.totals.totalActivitySeconds)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Pickups"}),e.jsx("span",{children:g.totals.pickupCount})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Notifications"}),e.jsx("span",{children:g.totals.notificationCount})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Active days"}),e.jsx("span",{children:g.totals.activeDays})]})]})]})]}):null,t==="all_time"?e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]",children:[e.jsxs(i,{className:S,children:[e.jsx("div",{className:d,children:"Weekday pattern"}),e.jsx("div",{className:"mt-5 h-72",children:e.jsx(w,{width:"100%",height:"100%",children:e.jsxs(A,{data:u.weekdayPattern,children:[e.jsx(C,{stroke:K,vertical:!1}),e.jsx(L,{dataKey:"weekday",tickFormatter:$,stroke:h,tickLine:!1,axisLine:!1}),e.jsx(F,{stroke:h,tickLine:!1,axisLine:!1,tickFormatter:s=>n(Number(s))}),e.jsx(T,{contentStyle:D,formatter:(s,y)=>H(s,String(y)),labelFormatter:s=>$(Number(s))}),e.jsx(k,{type:"monotone",dataKey:"averageActivitySeconds",stroke:M,fill:W,strokeWidth:2})]})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Lifetime summary"}),e.jsxs("div",{className:"mt-4 space-y-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Days captured"}),e.jsx("span",{children:u.summary.dayCount})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Total activity"}),e.jsx("span",{children:n(u.summary.totalActivitySeconds)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Average per day"}),e.jsx("span",{children:n(u.summary.averageDailyActivitySeconds)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Total pickups"}),e.jsx("span",{children:u.summary.totalPickups})]})]})]}),e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Dominant categories"}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:u.topCategories.slice(0,10).map(s=>e.jsxs(l,{tone:"default",className:m,children:[s.categoryLabel," ·"," ",n(s.totalActivitySeconds)]},s.id))})]})]})]}):null]})}export{fe as PsycheScreenTimePage};
1
+ import{r as Q,j as e}from"./vendor-Dnkkx2co.js";import{i as N}from"./state-vCcAT5Hq.js";import{S as B,E as G,c as l,ch as U,C as i,Z as x,B as V,d5 as X,d6 as Y,d7 as z,d8 as Z}from"./index-QJkjKYzZ.js";import{P as J}from"./page-hero-CONuJu5J.js";import{R as w,A,C,X as L,Y as F,T,a as k}from"./charts-DFnEuIMB.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const S="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] p-5 shadow-[var(--card-shadow)]",_="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",j="min-w-0 rounded-[8px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5",d="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",P="font-label text-[10px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",b="text-[var(--ui-ink-soft)]",m="border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",O="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%)]",K="var(--ui-border-subtle)",h="var(--ui-ink-faint)",ee="color-mix(in_srgb,var(--success)_82%,var(--primary)_18%)",se="color-mix(in_srgb,var(--success)_18%,transparent)",M="color-mix(in_srgb,var(--info)_86%,var(--primary)_14%)",W="color-mix(in_srgb,var(--info)_16%,transparent)",te="var(--ui-ink-strong)",ae="color-mix(in_srgb,var(--ui-ink-strong)_12%,transparent)",D={background:"var(--ui-surface-modal)",border:"1px solid var(--ui-border-subtle)",borderRadius:"8px",color:"var(--ui-ink-strong)"};function re(t){switch(t){case"fresh":return"border border-[color-mix(in_srgb,var(--success)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]";case"stale":return"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%)]";case"unavailable":return"border border-[color-mix(in_srgb,var(--danger)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_74%,var(--ui-ink-strong)_26%)]";default:return m}}function n(t){return t>=3600?`${(t/3600).toFixed(1)}h`:`${Math.round(t/60)}m`}function R(t){return`${String(t).padStart(2,"0")}:00`}function $(t){return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t]??"Day"}function ie(t,r,c){return!t||!r?c:`${new Date(t).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})} → ${new Date(r).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`}function H(t,r){const c=typeof t=="number"?t:typeof t=="string"?Number(t):0;return[r==="totalActivitySeconds"||r==="averageActivitySeconds"?n(c):String(Math.round(c)),r==="totalActivitySeconds"?"Activity":r==="averageActivitySeconds"?"Avg activity":r==="pickupCount"||r==="averagePickups"?r==="averagePickups"?"Avg pickups":"Pickups":r==="averageNotifications"?"Avg notifications":"Notifications"]}function fe(){const[t,r]=Q.useState("day"),c=N({queryKey:["forge-screen-time-settings"],queryFn:()=>X().then(s=>s.settings)}),v=N({queryKey:["forge-screen-time-day"],queryFn:()=>Y().then(s=>s.screenTime)}),p=N({queryKey:["forge-screen-time-month"],queryFn:()=>z().then(s=>s.screenTime)}),f=N({queryKey:["forge-screen-time-all-time"],queryFn:()=>Z().then(s=>s.screenTime)});if(c.isLoading||v.isLoading||p.isLoading||f.isLoading)return e.jsx(B,{});const q=c.error??v.error??p.error??f.error;if(q||!c.data||!v.data||!p.data||!f.data)return e.jsx(G,{eyebrow:"Psyche",error:q,onRetry:()=>{c.refetch(),v.refetch(),p.refetch(),f.refetch()}});const a=c.data,o=v.data,g=p.data,u=f.data,E=o.topApps.slice(0,3).map(s=>s.displayName||s.bundleIdentifier),I=typeof a.metadata.snapshot_source=="string"?a.metadata.snapshot_source.replaceAll("_"," "):"device activity report";return e.jsxs("div",{className:"space-y-5",children:[e.jsx(J,{title:"Screen Time",titleText:"Screen Time",description:"Apple-compliant device activity, hourly usage, and reflective phone context woven into Psyche.",actions:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(l,{tone:"default",className:m,children:a.authorizationStatus.replaceAll("_"," ")}),e.jsx(l,{tone:"default",className:m,children:a.captureState.replaceAll("_"," ")}),e.jsx(l,{tone:"default",className:re(a.captureFreshness),children:a.captureFreshness}),e.jsx(l,{tone:"default",className:m,children:a.syncEnabled?"Sync on":"Sync paused"})]})}),e.jsx(U,{}),e.jsxs(i,{className:S,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:d,children:"Reflective device activity"}),e.jsx("div",{className:x("mt-2 max-w-3xl text-sm",b),children:"Forge treats Screen Time as reflective evidence, not as fake exact foreground traces. Movement overlap is estimated from hourly bins and stays truthful about that."})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:["day","month","all_time"].map(s=>e.jsx(V,{variant:"ghost",className:t===s?"h-9 rounded-full border border-[color-mix(in_srgb,var(--success)_35%,var(--ui-border-subtle)_65%)] bg-[var(--ui-success-soft)] px-4 text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]":"h-9 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 text-[var(--ui-ink-soft)]",onClick:()=>r(s),children:s==="all_time"?"All time":s},s))})]}),e.jsxs("div",{className:"mt-5 grid gap-3 md:grid-cols-3",children:[e.jsxs(i,{className:_,children:[e.jsx("div",{className:P,children:"Today on screen"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:n(o.summary.totalActivitySeconds)}),e.jsxs("div",{className:x("mt-2 text-sm",b),children:["Across ",o.summary.activeHourCount," active hours."]})]}),e.jsxs(i,{className:_,children:[e.jsx("div",{className:P,children:"Pickups today"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:o.summary.pickupCount}),e.jsxs("div",{className:x("mt-2 text-sm",b),children:["First pickup"," ",o.summary.firstPickupAt?new Date(o.summary.firstPickupAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"not captured","."]})]}),e.jsxs(i,{className:_,children:[e.jsx("div",{className:P,children:"Capture health"}),e.jsx("div",{className:"mt-3 text-lg text-[var(--ui-ink-strong)]",children:a.captureFreshness==="fresh"?a.captureAgeHours!==null?`Updated ${a.captureAgeHours.toFixed(1)}h ago`:"Fresh capture":a.captureFreshness==="stale"?a.captureAgeHours!==null?`Last refresh ${a.captureAgeHours.toFixed(1)}h ago`:"Capture is stale":a.captureFreshness==="unavailable"?"Unavailable":"Waiting for capture"}),e.jsxs("div",{className:x("mt-2 text-sm",b),children:[a.capturedDayCount," days, ",a.capturedHourCount," ","hourly slices, ",a.captureWindowDays," day window."]})]})]}),e.jsx(i,{className:x("mt-3",_),children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(l,{tone:"default",className:m,children:I}),e.jsx(l,{tone:"default",className:m,children:"Hourly model"}),e.jsx(l,{tone:"default",className:m,children:ie(a.lastCaptureStartedAt,a.lastCaptureEndedAt,"No captured range yet")}),E.map(s=>e.jsx(l,{tone:"default",className:O,children:s},s))]})})]}),t==="day"?e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]",children:[e.jsxs(i,{className:S,children:[e.jsx("div",{className:d,children:"Hourly rhythm"}),e.jsx("div",{className:x("mt-2 text-sm",b),children:"Activity, pickups, and notification pressure across the day."}),e.jsx("div",{className:"mt-5 h-72",children:e.jsx(w,{width:"100%",height:"100%",children:e.jsxs(A,{data:o.hourlySegments,children:[e.jsx(C,{stroke:K,vertical:!1}),e.jsx(L,{dataKey:"hourIndex",tickFormatter:R,stroke:h,tickLine:!1,axisLine:!1}),e.jsx(F,{stroke:h,tickLine:!1,axisLine:!1,tickFormatter:s=>n(Number(s))}),e.jsx(T,{contentStyle:D,formatter:(s,y)=>H(s,String(y)),labelFormatter:s=>R(Number(s))}),e.jsx(k,{type:"monotone",dataKey:"totalActivitySeconds",stroke:ee,fill:se,strokeWidth:2}),e.jsx(k,{type:"monotone",dataKey:"pickupCount",stroke:M,fill:W,strokeWidth:1.6})]})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Top apps"}),e.jsx("div",{className:"mt-4 space-y-3",children:o.topApps.slice(0,6).map(s=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-[var(--ui-ink-strong)]",children:s.displayName||s.bundleIdentifier}),e.jsx("div",{className:"truncate text-xs text-[var(--ui-ink-faint)]",children:s.categoryLabel||s.bundleIdentifier})]}),e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:n(s.totalActivitySeconds)})]},s.id))})]}),e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Top categories"}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:o.topCategories.slice(0,8).map(s=>e.jsxs(l,{tone:"default",className:m,children:[s.categoryLabel," ·"," ",n(s.totalActivitySeconds)]},s.id))})]})]})]}):null,t==="month"?e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]",children:[e.jsxs(i,{className:S,children:[e.jsx("div",{className:d,children:"Monthly drift"}),e.jsx("div",{className:"mt-5 h-72",children:e.jsx(w,{width:"100%",height:"100%",children:e.jsxs(A,{data:g.days,children:[e.jsx(C,{stroke:K,vertical:!1}),e.jsx(L,{dataKey:"dateKey",stroke:h,tickLine:!1,axisLine:!1}),e.jsx(F,{stroke:h,tickLine:!1,axisLine:!1,tickFormatter:s=>n(Number(s))}),e.jsx(T,{contentStyle:D,formatter:(s,y)=>H(s,String(y))}),e.jsx(k,{type:"monotone",dataKey:"totalActivitySeconds",stroke:te,fill:ae,strokeWidth:2})]})})})]}),e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Month summary"}),e.jsxs("div",{className:"mt-4 space-y-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Total activity"}),e.jsx("span",{children:n(g.totals.totalActivitySeconds)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Pickups"}),e.jsx("span",{children:g.totals.pickupCount})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Notifications"}),e.jsx("span",{children:g.totals.notificationCount})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Active days"}),e.jsx("span",{children:g.totals.activeDays})]})]})]})]}):null,t==="all_time"?e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]",children:[e.jsxs(i,{className:S,children:[e.jsx("div",{className:d,children:"Weekday pattern"}),e.jsx("div",{className:"mt-5 h-72",children:e.jsx(w,{width:"100%",height:"100%",children:e.jsxs(A,{data:u.weekdayPattern,children:[e.jsx(C,{stroke:K,vertical:!1}),e.jsx(L,{dataKey:"weekday",tickFormatter:$,stroke:h,tickLine:!1,axisLine:!1}),e.jsx(F,{stroke:h,tickLine:!1,axisLine:!1,tickFormatter:s=>n(Number(s))}),e.jsx(T,{contentStyle:D,formatter:(s,y)=>H(s,String(y)),labelFormatter:s=>$(Number(s))}),e.jsx(k,{type:"monotone",dataKey:"averageActivitySeconds",stroke:M,fill:W,strokeWidth:2})]})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Lifetime summary"}),e.jsxs("div",{className:"mt-4 space-y-3 text-sm text-[var(--ui-ink-soft)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Days captured"}),e.jsx("span",{children:u.summary.dayCount})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Total activity"}),e.jsx("span",{children:n(u.summary.totalActivitySeconds)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Average per day"}),e.jsx("span",{children:n(u.summary.averageDailyActivitySeconds)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:"Total pickups"}),e.jsx("span",{children:u.summary.totalPickups})]})]})]}),e.jsxs(i,{className:j,children:[e.jsx("div",{className:d,children:"Dominant categories"}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:u.topCategories.slice(0,10).map(s=>e.jsxs(l,{tone:"default",className:m,children:[s.categoryLabel," ·"," ",n(s.totalActivitySeconds)]},s.id))})]})]})]}):null]})}export{fe as PsycheScreenTimePage};
@@ -1 +1 @@
1
- import{b5 as It,r as m,j as e,b4 as Q,aD as Ct,aG as Re,aT as At,c7 as Be,bg as Ke}from"./vendor-Dnkkx2co.js";import{j as Ot,i as M,k as W}from"./state-vCcAT5Hq.js";import{u as _t,s as Et,d3 as Mt,i as qe,bm as ze,ao as Ft,bn as Lt,H as he,S as $t,E as Pt,B as w,ch as Dt,C as He,c as f,Z as v,I as ie,aT as Rt,a0 as Bt,a1 as Kt,T as qt,m as oe,bk as N,bl as S,U as Ue,b as Ve,bu as rt,d4 as zt,bw as Ht,bx as Ut,by as Vt,bz as Qt,bA as Wt,bC as Yt}from"./index-By3tQxiE.js";import{n as F,p as Qe,N as We}from"./note-tags-input-BXYaDkOr.js";import{P as Gt}from"./page-hero-5RTqAI88.js";import{C as Xt}from"./calendar-week-toolbar-BARSOEO9.js";import{S as le}from"./select-menu-mfaklv7r.js";import{s as Ye,b as de,c as Jt,f as Ge,d as Xe}from"./calendar-ui-Cy1XRwzV.js";import{g as Zt,a as es}from"./entity-links-DwpxhW2H.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.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 F([nt,...n])}function k(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"),g=String(r.getHours()).padStart(2,"0"),_=String(r.getMinutes()).padStart(2,"0");return`${i}-${o}-${x}T${g}:${_}`}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 hs(n,r){const i=URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=r,o.click(),URL.revokeObjectURL(i)}function gs(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=>k(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?` · ${he(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?` · ${he(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:g,values:_,behaviors:C,beliefs:ee,modes:A}){return[...[...n.map(s=>({value:k("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:k("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:k("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:k("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:k("habit",s.id),label:s.title,description:S(s.description,s.user,"Habit"),searchText:N([s.title,s.description??""],s),kind:"habit"})),...g.map(s=>({value:k("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:k("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:k("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:k("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:k("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 $s(){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=Et(o),[g,_]=m.useState(()=>Ye()),[C,ee]=m.useState([]),[A,ge]=m.useState(J),[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(g,7),[g]),ne=m.useMemo(()=>Jt(g),[g]),fe=m.useMemo(()=>Array.from({length:24},(t,a)=>a),[]),j=M({queryKey:["forge-psyche-self-observation-calendar",g.toISOString(),...o],queryFn:()=>zt({from:g.toISOString(),to:be.toISOString(),userIds:o})}),ye=M({queryKey:["forge-psyche-values",...o],queryFn:()=>Ht(o)}),we=M({queryKey:["forge-psyche-patterns",...o],queryFn:()=>Ut(o)}),ke=M({queryKey:["forge-psyche-behaviors",...o],queryFn:()=>Vt(o)}),je=M({queryKey:["forge-psyche-beliefs",...o],queryFn:()=>Qt(o)}),Ne=M({queryKey:["forge-psyche-modes",...o],queryFn:()=>Wt(o)}),Se=M({queryKey:["forge-psyche-reports",...o],queryFn:()=>Yt(o)}),Te=W({mutationFn:()=>Mt({from:g.toISOString(),to:be.toISOString(),userIds:o,tags:F(A===J?C:[...C,A]),includeObservations:D,includeActivity:R,onlyHumanOwned:L,search:s.trim(),format:se}),onSuccess:t=>{hs(t.blob,t.fileName??`forge-self-observation.${se}`)}}),U=W({mutationFn:async t=>{const a=Qe(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?ze(t.noteId,{contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null,tags:F(t.tags),userId:t.userId,frontmatter:{observedAt:a},links:d}):Ft({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"]}),qe(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),vt=W({mutationFn:async({noteId:t,frontmatter:a})=>ze(t,{frontmatter:a}),onSuccess:async()=>{await r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]})}}),ae=W({mutationFn:t=>Lt(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"]}),qe(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),V=m.useMemo(()=>{var t;return F([nt,ts,...((t=j.data)==null?void 0:t.calendar.availableTags)??[]])},[(Oe=j.data)==null?void 0:Oe.calendar.availableTags]),ht=m.useMemo(()=>{var t;return bs(((t=we.data)==null?void 0:t.patterns)??[])},[(_e=we.data)==null?void 0:_e.patterns]),gt=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=ke.data)==null?void 0:a.behaviors)??[],beliefs:((d=je.data)==null?void 0:d.beliefs)??[],modes:((l=Ne.data)==null?void 0:l.modes)??[]})},[(Me=ke.data)==null?void 0:Me.behaviors,(Fe=je.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?he(ft[0]??null):`${o.length} owners selected`,O=m.useMemo(()=>{var d,l;const t=F(A===J?C:[...C,A]);return[...(((d=j.data)==null?void 0:d.calendar.observations)??[]).map(c=>({kind:"observation",id:c.note.id,observedAt:c.observedAt,tags:c.tags,observation:c})),...(((l=j.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=j.data)==null?void 0:Pe.calendar.activity,(De=j.data)==null?void 0:De.calendar.observations,L,s,C,R,D]),wt=m.useMemo(()=>O.filter(T).length,[O]),kt=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:h=>{a||(re(t.note.id),h.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(Ue,{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(h=>e.jsx(f,{className:me,children:h},`${t.id}-${h}`)),ws(t),t.linkedPatterns.slice(0,d?2:1).map(h=>e.jsx(Ve,{kind:"pattern",label:h.title,compact:!0,gradient:!1},h.id)),t.linkedReports.slice(0,1).map(h=>e.jsx(Ve,{kind:"report",label:h.title,compact:!0,gradient:!1},h.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:h=>{h.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=Zt(t.event),c=es(t.event),p=H(t.event.title||"Forge activity",a?92:d?144:112),I=a?"":us(t.event,d?220:120),h=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(Ue,{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,h).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)},jt=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),jt(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:gs(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 j.isLoading?e.jsx($t,{}):j.isError?e.jsx(Pt,{eyebrow:"Self Observation",error:j.error,onRetry:()=>void j.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Gt,{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(Dt,{}),e.jsxs(He,{className:v("grid gap-4 p-5",Je),children:[e.jsx(Xt,{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:g,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:[kt," activity"]}),e.jsx(f,{className:K,children:L?"Human-owned only":"All owners"})]}),onPrevious:()=>_(de(g,-7)),onCurrent:()=>_(Ye()),onNext:()=>_(de(g,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(ie,{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:gt,onChange:ge}),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(We,{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(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 h=O.find(B=>T(B)&&B.observation.note.id===I);!h||!T(h)||(St(h.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(Rt,{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(Bt,{value:u.userId,users:i.snapshot.users,onChange:t=>b(a=>({...a,userId:t})),defaultLabel:Kt(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(ie,{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(ie,{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(qt,{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(We,{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(oe,{options:ht,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",Qe(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(oe,{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(oe,{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{$s as PsycheSelfObservationPage};
1
+ import{b5 as It,r as m,j as e,b4 as Q,aD as Ct,aG as Re,aT as At,c7 as Be,bg as Ke}from"./vendor-Dnkkx2co.js";import{j as Ot,i as M,k as W}from"./state-vCcAT5Hq.js";import{u as _t,s as Et,d3 as Mt,i as qe,bm as ze,ao as Ft,bn as Lt,H as he,S as $t,E as Pt,B as w,ch as Dt,C as He,c as f,Z as v,I as ie,aT as Rt,a0 as Bt,a1 as Kt,T as qt,m as oe,bk as N,bl as S,U as Ue,b as Ve,bu as rt,d4 as zt,bw as Ht,bx as Ut,by as Vt,bz as Qt,bA as Wt,bC as Yt}from"./index-QJkjKYzZ.js";import{n as F,p as Qe,N as We}from"./note-tags-input-BS14YXHn.js";import{P as Gt}from"./page-hero-CONuJu5J.js";import{C as Xt}from"./calendar-week-toolbar-CWSK5hJl.js";import{S as le}from"./select-menu-Cqs5t3ng.js";import{s as Ye,b as de,c as Jt,f as Ge,d as Xe}from"./calendar-ui-Cy1XRwzV.js";import{g as Zt,a as es}from"./entity-links-DwpxhW2H.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.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 F([nt,...n])}function k(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"),g=String(r.getHours()).padStart(2,"0"),_=String(r.getMinutes()).padStart(2,"0");return`${i}-${o}-${x}T${g}:${_}`}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 hs(n,r){const i=URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=r,o.click(),URL.revokeObjectURL(i)}function gs(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=>k(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?` · ${he(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?` · ${he(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:g,values:_,behaviors:C,beliefs:ee,modes:A}){return[...[...n.map(s=>({value:k("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:k("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:k("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:k("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:k("habit",s.id),label:s.title,description:S(s.description,s.user,"Habit"),searchText:N([s.title,s.description??""],s),kind:"habit"})),...g.map(s=>({value:k("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:k("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:k("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:k("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:k("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 $s(){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=Et(o),[g,_]=m.useState(()=>Ye()),[C,ee]=m.useState([]),[A,ge]=m.useState(J),[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(g,7),[g]),ne=m.useMemo(()=>Jt(g),[g]),fe=m.useMemo(()=>Array.from({length:24},(t,a)=>a),[]),j=M({queryKey:["forge-psyche-self-observation-calendar",g.toISOString(),...o],queryFn:()=>zt({from:g.toISOString(),to:be.toISOString(),userIds:o})}),ye=M({queryKey:["forge-psyche-values",...o],queryFn:()=>Ht(o)}),we=M({queryKey:["forge-psyche-patterns",...o],queryFn:()=>Ut(o)}),ke=M({queryKey:["forge-psyche-behaviors",...o],queryFn:()=>Vt(o)}),je=M({queryKey:["forge-psyche-beliefs",...o],queryFn:()=>Qt(o)}),Ne=M({queryKey:["forge-psyche-modes",...o],queryFn:()=>Wt(o)}),Se=M({queryKey:["forge-psyche-reports",...o],queryFn:()=>Yt(o)}),Te=W({mutationFn:()=>Mt({from:g.toISOString(),to:be.toISOString(),userIds:o,tags:F(A===J?C:[...C,A]),includeObservations:D,includeActivity:R,onlyHumanOwned:L,search:s.trim(),format:se}),onSuccess:t=>{hs(t.blob,t.fileName??`forge-self-observation.${se}`)}}),U=W({mutationFn:async t=>{const a=Qe(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?ze(t.noteId,{contentMarkdown:t.contentMarkdown.trim(),author:t.author.trim()||null,tags:F(t.tags),userId:t.userId,frontmatter:{observedAt:a},links:d}):Ft({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"]}),qe(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),vt=W({mutationFn:async({noteId:t,frontmatter:a})=>ze(t,{frontmatter:a}),onSuccess:async()=>{await r.invalidateQueries({queryKey:["forge-psyche-self-observation-calendar"]})}}),ae=W({mutationFn:t=>Lt(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"]}),qe(r),r.invalidateQueries({queryKey:["forge-psyche-overview"]})])}}),V=m.useMemo(()=>{var t;return F([nt,ts,...((t=j.data)==null?void 0:t.calendar.availableTags)??[]])},[(Oe=j.data)==null?void 0:Oe.calendar.availableTags]),ht=m.useMemo(()=>{var t;return bs(((t=we.data)==null?void 0:t.patterns)??[])},[(_e=we.data)==null?void 0:_e.patterns]),gt=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=ke.data)==null?void 0:a.behaviors)??[],beliefs:((d=je.data)==null?void 0:d.beliefs)??[],modes:((l=Ne.data)==null?void 0:l.modes)??[]})},[(Me=ke.data)==null?void 0:Me.behaviors,(Fe=je.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?he(ft[0]??null):`${o.length} owners selected`,O=m.useMemo(()=>{var d,l;const t=F(A===J?C:[...C,A]);return[...(((d=j.data)==null?void 0:d.calendar.observations)??[]).map(c=>({kind:"observation",id:c.note.id,observedAt:c.observedAt,tags:c.tags,observation:c})),...(((l=j.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=j.data)==null?void 0:Pe.calendar.activity,(De=j.data)==null?void 0:De.calendar.observations,L,s,C,R,D]),wt=m.useMemo(()=>O.filter(T).length,[O]),kt=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:h=>{a||(re(t.note.id),h.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(Ue,{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(h=>e.jsx(f,{className:me,children:h},`${t.id}-${h}`)),ws(t),t.linkedPatterns.slice(0,d?2:1).map(h=>e.jsx(Ve,{kind:"pattern",label:h.title,compact:!0,gradient:!1},h.id)),t.linkedReports.slice(0,1).map(h=>e.jsx(Ve,{kind:"report",label:h.title,compact:!0,gradient:!1},h.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:h=>{h.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=Zt(t.event),c=es(t.event),p=H(t.event.title||"Forge activity",a?92:d?144:112),I=a?"":us(t.event,d?220:120),h=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(Ue,{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,h).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)},jt=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),jt(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:gs(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 j.isLoading?e.jsx($t,{}):j.isError?e.jsx(Pt,{eyebrow:"Self Observation",error:j.error,onRetry:()=>void j.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Gt,{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(Dt,{}),e.jsxs(He,{className:v("grid gap-4 p-5",Je),children:[e.jsx(Xt,{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:g,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:[kt," activity"]}),e.jsx(f,{className:K,children:L?"Human-owned only":"All owners"})]}),onPrevious:()=>_(de(g,-7)),onCurrent:()=>_(Ye()),onNext:()=>_(de(g,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(ie,{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:gt,onChange:ge}),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(We,{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(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 h=O.find(B=>T(B)&&B.observation.note.id===I);!h||!T(h)||(St(h.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(Rt,{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(Bt,{value:u.userId,users:i.snapshot.users,onChange:t=>b(a=>({...a,userId:t})),defaultLabel:Kt(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(ie,{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(ie,{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(qt,{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(We,{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(oe,{options:ht,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",Qe(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(oe,{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(oe,{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{$s as PsycheSelfObservationPage};
@@ -1,4 +1,4 @@
1
- import{c2 as $,r as g,j as e}from"./vendor-Dnkkx2co.js";import{j as B,i as O,k as Q}from"./state-vCcAT5Hq.js";import{u as K,s as q,da as R,cp as W,L as z,E as H,B as k,V as T,ch as J,_ as X,U as Y,b as f,Q as Z,a0 as ee,a1 as se,F as l,I as F,T as w,cj as b,bw as te}from"./index-By3tQxiE.js";import{E as ae}from"./entity-note-count-link-BX93WYgh.js";import{A as ie}from"./atlas-panel-BPTJyMcI.js";import{O as re}from"./orbit-map-Cb_AJyIj.js";import{u as ne,p as le}from"./use-psyche-focus-target-Ct-acS9G.js";import{P as oe}from"./page-hero-5RTqAI88.js";import{p as D}from"./psyche-schemas-Dxj554nU.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.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 Ie(){var E;const a=K(),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:te}),x=((E=j.data)==null?void 0:E.values)??[],c=q(a.selectedUserIds),C=m.get("focus"),V=a.snapshot.dashboard.notesSummaryByEntity;ne(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?R(p.id,i):W(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"]})])}}),M=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]),U=[{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(ee,{value:s.userId??null,users:a.snapshot.users,onChange:t=>i({userId:t}),defaultLabel:se(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(w,{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(w,{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(w,{value:s.committedActions.join(`
1
+ import{c2 as $,r as g,j as e}from"./vendor-Dnkkx2co.js";import{j as B,i as O,k as Q}from"./state-vCcAT5Hq.js";import{u as K,s as q,da as R,cp as W,L as z,E as H,B as k,V as T,ch as J,_ as X,U as Y,b as f,Q as Z,a0 as ee,a1 as se,F as l,I as F,T as w,cj as b,bw as te}from"./index-QJkjKYzZ.js";import{E as ae}from"./entity-note-count-link-ef3ZOpKM.js";import{A as ie}from"./atlas-panel-G3wGxjYf.js";import{O as re}from"./orbit-map-v2Pv9RU_.js";import{u as ne,p as le}from"./use-psyche-focus-target-Ct-acS9G.js";import{P as oe}from"./page-hero-CONuJu5J.js";import{p as D}from"./psyche-schemas-Dxj554nU.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.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 Ie(){var E;const a=K(),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:te}),x=((E=j.data)==null?void 0:E.values)??[],c=q(a.selectedUserIds),C=m.get("focus"),V=a.snapshot.dashboard.notesSummaryByEntity;ne(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?R(p.id,i):W(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"]})])}}),M=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]),U=[{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(ee,{value:s.userId??null,users:a.snapshot.users,onChange:t=>i({userId:t}),defaultLabel:se(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(w,{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(w,{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(w,{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
@@ -1 +1 @@
1
- import{j as e,b4 as m,aK as b}from"./vendor-Dnkkx2co.js";import{I as h,T as u,B as j}from"./index-By3tQxiE.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,b4 as m,aK as b}from"./vendor-Dnkkx2co.js";import{I as h,T as u,B as j}from"./index-QJkjKYzZ.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};