forge-openclaw-plugin 0.2.111 → 0.2.113
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.
- package/dist/assets/{activity-page-BdeoV3N4.js → activity-page-DPPiiyLO.js} +1 -1
- package/dist/assets/{ai-surface-workspace-BCbQUekv.js → ai-surface-workspace-B_fV9C4s.js} +1 -1
- package/dist/assets/{atlas-panel-DTnRBOZx.js → atlas-panel-BPTJyMcI.js} +1 -1
- package/dist/assets/{calendar-page-YDexXy_e.js → calendar-page-D4DcRQv7.js} +1 -1
- package/dist/assets/{calendar-rules-B_aOcMi3.js → calendar-rules-Cl_xMrBn.js} +1 -1
- package/dist/assets/{calendar-week-toolbar-BTbIzq3e.js → calendar-week-toolbar-BARSOEO9.js} +1 -1
- package/dist/assets/{companion-sync-lab-page-DKouMut9.js → companion-sync-lab-page-COFYDI3w.js} +1 -1
- package/dist/assets/{daily-metrics-dashboard-B3UCGG1t.js → daily-metrics-dashboard-BNGQlJkQ.js} +1 -1
- package/dist/assets/{entity-note-count-link-DUxobQUt.js → entity-note-count-link-BX93WYgh.js} +1 -1
- package/dist/assets/{entity-notes-surface-BdHBn8rx.js → entity-notes-surface-CBlKc-x-.js} +1 -1
- package/dist/assets/{execution-board-R5-oyf-Z.js → execution-board-Dh41UeKR.js} +1 -1
- package/dist/assets/{faceted-token-search-DtO6OUwQ.js → faceted-token-search-BgxYH_gW.js} +1 -1
- package/dist/assets/{flagship-signal-deck-B9k46sWA.js → flagship-signal-deck-bolzzK8q.js} +1 -1
- package/dist/assets/{floating-action-menu-DBzfnJOx.js → floating-action-menu-C5H-Wr2B.js} +1 -1
- package/dist/assets/{goal-detail-page-Mr_gnZ2l.js → goal-detail-page-CQeFnGDJ.js} +1 -1
- package/dist/assets/{goals-page-BG7FuqK1.js → goals-page-BTg9crEK.js} +1 -1
- package/dist/assets/{habits-page-CGdaOqL3.js → habits-page-C4vqk346.js} +1 -1
- package/dist/assets/{index-BP9__l6C.js → index-By3tQxiE.js} +2 -2
- package/dist/assets/{insight-flow-dialog-BUv06Vn-.js → insight-flow-dialog-JPYCsTKI.js} +1 -1
- package/dist/assets/{insights-page-BgD1_1we.js → insights-page-CFhVMlVL.js} +1 -1
- package/dist/assets/{kanban-page-DvZSN-Bi.js → kanban-page-DC3IDsnh.js} +1 -1
- package/dist/assets/{knowledge-graph-page-BXWXtPvo.js → knowledge-graph-page-DucyRYTZ.js} +1 -1
- package/dist/assets/{life-force-page-CwjHvpzu.js → life-force-page-UrXfxaSO.js} +1 -1
- package/dist/assets/{life-force-workspace-Ct70SsNQ.js → life-force-workspace-BhPNH7ad.js} +1 -1
- package/dist/assets/{metric-tile-DCxLxNli.js → metric-tile-DtRPjN4V.js} +1 -1
- package/dist/assets/{movement-page-C06ebiYk.js → movement-page-DCIdTQEN.js} +1 -1
- package/dist/assets/{note-markdown-3wB52NOn.js → note-markdown-CepDxj3v.js} +1 -1
- package/dist/assets/{note-tags-input-Blg5Gqz_.js → note-tags-input-BXYaDkOr.js} +1 -1
- package/dist/assets/{notes-page-CSkjizyK.js → notes-page-Bl1LlCLo.js} +1 -1
- package/dist/assets/{open-in-graph-button-CDHxzS8B.js → open-in-graph-button-C263zl5l.js} +1 -1
- package/dist/assets/{orbit-map-OV-GcUZl.js → orbit-map-Cb_AJyIj.js} +1 -1
- package/dist/assets/{overview-page-Cw3pI34n.js → overview-page-C2yLity7.js} +1 -1
- package/dist/assets/{page-hero-DgnhI5es.js → page-hero-5RTqAI88.js} +1 -1
- package/dist/assets/{pill-cluster-DIGkIvKN.js → pill-cluster-CBrrtZBm.js} +1 -1
- package/dist/assets/{preference-entity-handoff-button-LT_GBuqB.js → preference-entity-handoff-button-BQzg2J4k.js} +1 -1
- package/dist/assets/{preferences-page-Dkvz7nkU.js → preferences-page-DekYF-Yz.js} +1 -1
- package/dist/assets/{project-collections-BsAT8WYE.js → project-collections-BVXB8PPF.js} +1 -1
- package/dist/assets/{project-detail-page-DsJUWg8k.js → project-detail-page-CQlrLEn9.js} +1 -1
- package/dist/assets/{project-management-hierarchy-page-CIy0wAp8.js → project-management-hierarchy-page--mzM_zRE.js} +1 -1
- package/dist/assets/{project-management-section-nav-ClB2S1FW.js → project-management-section-nav-DQl0qRWy.js} +1 -1
- package/dist/assets/{projects-page-Da1bZLSH.js → projects-page-Dr_0NdVP.js} +1 -1
- package/dist/assets/{psyche-behaviors-page-D0uwf78o.js → psyche-behaviors-page-DOUaCWON.js} +1 -1
- package/dist/assets/{psyche-flashcards-page-e_qwwsOf.js → psyche-flashcards-page-BA84fO_X.js} +1 -1
- package/dist/assets/{psyche-goal-map-page-BIY028Wx.js → psyche-goal-map-page-DpXAg1Vf.js} +1 -1
- package/dist/assets/{psyche-graph-Y1UKALEm.js → psyche-graph-BxcbAbXt.js} +1 -1
- package/dist/assets/{psyche-metrics-page-DDkGJzo_.js → psyche-metrics-page-D8JQEoOl.js} +1 -1
- package/dist/assets/{psyche-mode-guide-page-C7mD9uiv.js → psyche-mode-guide-page-CBlIS5N_.js} +1 -1
- package/dist/assets/{psyche-modes-page-RUdaOQWr.js → psyche-modes-page-DE6KDK_1.js} +1 -1
- package/dist/assets/{psyche-page-D3FZy__c.js → psyche-page-Dkh7R2Dc.js} +1 -1
- package/dist/assets/{psyche-patterns-page-BSD35F41.js → psyche-patterns-page-DbCNRuww.js} +1 -1
- package/dist/assets/{psyche-questionnaire-builder-page-BpgUTMgj.js → psyche-questionnaire-builder-page-DnraDj1H.js} +1 -1
- package/dist/assets/{psyche-questionnaire-detail-page-DwjyjNhg.js → psyche-questionnaire-detail-page-DQ6zNQkk.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-detail-page-mJ-DgeB-.js → psyche-questionnaire-run-detail-page-BGrOIX0B.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-page-YuMBkH1G.js → psyche-questionnaire-run-page-Bg3BhBHb.js} +1 -1
- package/dist/assets/{psyche-questionnaires-page-CNglToKh.js → psyche-questionnaires-page-BEreTNjG.js} +1 -1
- package/dist/assets/{psyche-report-detail-page-CV6tbLxz.js → psyche-report-detail-page-Br9KlJBG.js} +1 -1
- package/dist/assets/{psyche-reports-page-BEOe8OPA.js → psyche-reports-page-Bk6QpAEF.js} +1 -1
- package/dist/assets/{psyche-schemas-beliefs-page-KIRqmO8C.js → psyche-schemas-beliefs-page-Db8d2ga7.js} +1 -1
- package/dist/assets/{psyche-screen-time-page-DvXuwgU1.js → psyche-screen-time-page-NazHUAkT.js} +1 -1
- package/dist/assets/{psyche-self-observation-page-E6yDPBm1.js → psyche-self-observation-page-H6FToucM.js} +1 -1
- package/dist/assets/{psyche-values-page-CSLG7C6a.js → psyche-values-page-DqM382-6.js} +1 -1
- package/dist/assets/{report-chain-fields-BYEp3tRr.js → report-chain-fields-nW4zndrM.js} +1 -1
- package/dist/assets/{rewards-page-pAa_MIte.js → rewards-page-C-tZVnIK.js} +1 -1
- package/dist/assets/{scheduling-rules-editor-BmGrjC9q.js → scheduling-rules-editor-DGF-044c.js} +1 -1
- package/dist/assets/{schema-badge-IVJ4SoeC.js → schema-badge-57AJ3FY-.js} +1 -1
- package/dist/assets/{select-menu-BE5AIdgO.js → select-menu-mfaklv7r.js} +1 -1
- package/dist/assets/{settings-agents-page-hqI0IaNx.js → settings-agents-page-CPJeeYg0.js} +1 -1
- package/dist/assets/{settings-bin-page-2bPjFtZ3.js → settings-bin-page-D3eX5aNf.js} +1 -1
- package/dist/assets/{settings-calendar-page-u_TfZJEh.js → settings-calendar-page-Bgx8NIsP.js} +1 -1
- package/dist/assets/{settings-data-page-DSQ14F2i.js → settings-data-page-BuMSUjpp.js} +1 -1
- package/dist/assets/{settings-logs-page-BU0CJhDM.js → settings-logs-page-CHb2GNUM.js} +1 -1
- package/dist/assets/{settings-mobile-page-B1fQ61BB.js → settings-mobile-page-ClUvXhJg.js} +1 -1
- package/dist/assets/{settings-models-page-B0Dis_c_.js → settings-models-page-njK6D7zc.js} +1 -1
- package/dist/assets/{settings-page-V4ibXIp9.js → settings-page-Dm--cx6B.js} +1 -1
- package/dist/assets/{settings-rewards-page-DeCGBNn5.js → settings-rewards-page-3aShLM3A.js} +1 -1
- package/dist/assets/{settings-section-nav-DV5umEkp.js → settings-section-nav-BWox23Qv.js} +1 -1
- package/dist/assets/{settings-users-page-BB8Dzd_P.js → settings-users-page-D-hEPpgQ.js} +1 -1
- package/dist/assets/{settings-wiki-page-B0k0KRsU.js → settings-wiki-page-CC-rOtDm.js} +1 -1
- package/dist/assets/{sleep-page-CPwUb-em.js → sleep-page-Cm_Ei2w1.js} +1 -1
- package/dist/assets/{sports-page-Cl4vZVwh.js → sports-page-CqSI-j-H.js} +1 -1
- package/dist/assets/{strategies-page-DhFXf-g3.js → strategies-page-BuJ4zLLv.js} +1 -1
- package/dist/assets/{strategy-detail-page-B2gotRKI.js → strategy-detail-page-CLmy0jbW.js} +1 -1
- package/dist/assets/{strategy-dialog-DD1bbrRB.js → strategy-dialog-DnJix1ys.js} +1 -1
- package/dist/assets/{surface-98myBzix.js → surface-DRNu5Fpz.js} +1 -1
- package/dist/assets/{task-detail-page-nx4eQbMW.js → task-detail-page-DTnNjW33.js} +1 -1
- package/dist/assets/{timebox-planning-dialog-DoZ9zUra.js → timebox-planning-dialog-DckIr1K4.js} +1 -1
- package/dist/assets/{today-page-7BH7Yne1.js → today-page-Cgk4HBPK.js} +1 -1
- package/dist/assets/{training-load-page-E82pNn1-.js → training-load-page-C-7iINaB.js} +1 -1
- package/dist/assets/{vitals-page-D64WlwVv.js → vitals-page-CqE4bYMf.js} +1 -1
- package/dist/assets/{weekly-review-page-BkRxxm7Q.js → weekly-review-page-DFmuzzig.js} +1 -1
- package/dist/assets/{weight-loss-page-DPbg7rTC.js → weight-loss-page-CWtgeuti.js} +3 -3
- package/dist/assets/{wiki-article-markdown-B0Q6082A.js → wiki-article-markdown-BkQg8Hne.js} +1 -1
- package/dist/assets/{wiki-editor-page-Tkb50wEA.js → wiki-editor-page-BYKcdX5I.js} +1 -1
- package/dist/assets/{wiki-ingest-history-page-CcQzkZRr.js → wiki-ingest-history-page-D_p4myw1.js} +1 -1
- package/dist/assets/{wiki-ingest-modal-D6yft0Qb.js → wiki-ingest-modal-C-CidueO.js} +1 -1
- package/dist/assets/{wiki-page-DEND1jmD.js → wiki-page-DYpg9ZEO.js} +1 -1
- package/dist/assets/{workbench-flow-page-CkNI03j_.js → workbench-flow-page-Q3r2IJty.js} +1 -1
- package/dist/assets/{workbench-page-W3zQpeWr.js → workbench-page-BFfWMGm6.js} +1 -1
- package/dist/assets/{workout-detail-page-BVSZv53z.js → workout-detail-page-DeDyz1Kk.js} +1 -1
- package/dist/companion-iroh/win32-x64/forge-companion-iroh.exe +0 -0
- package/dist/index.html +1 -1
- package/dist/server/server/src/health-weight-loss.js +30 -11
- package/dist/server/server/src/services/companion-iroh.js +19 -12
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as r,r as w}from"./vendor-Dnkkx2co.js";import{Z as x,cL as b,bq as $}from"./index-
|
|
1
|
+
import{j as r,r as w}from"./vendor-Dnkkx2co.js";import{Z as x,cL as b,bq as $}from"./index-By3tQxiE.js";function m(d,s){const i=[],e=/(!?\[\[([^\]]+)\]\]|\[([^\]]+)\]\(([^)]+)\)|`([^`]+)`|\*\*([^*]+)\*\*|\*([^*]+)\*)/g;let l=0,n=null,a=0;for(;(n=e.exec(d))!==null;){if(n.index>l&&(i.push(r.jsx(w.Fragment,{children:d.slice(l,n.index)},`${s}-text-${a}`)),a+=1),n[1]&&n[2]){const o=n[2].trim(),t=n[1].startsWith("!"),c=o.indexOf("|"),h=c>=0?o.slice(0,c).trim():o,p=c>=0?o.slice(c+1).trim():h;if(h.toLowerCase().startsWith("forge:")){const[,u,g]=h.split(":"),f=u&&g?$(u,g):null,v=f?b(f):null;i.push(v?r.jsxs("a",{href:v,className:"inline-flex max-w-full items-center gap-1 rounded-full border border-[var(--warning)]/20 bg-[var(--ui-warning-soft)] px-2 py-0.5 text-[0.9em] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)] transition hover:bg-[var(--ui-surface-3)]",children:[r.jsx("span",{className:"shrink-0 text-[0.72em] uppercase tracking-[0.14em] text-[var(--ui-ink-faint)]",children:"Forge"}),r.jsx("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:p})]},`${s}-forge-${a}`):r.jsx("span",{className:"inline-flex max-w-full items-center gap-1 rounded-full bg-[var(--ui-surface-2)] px-2 py-0.5 text-[0.9em] text-[var(--ui-ink-soft)]",children:r.jsx("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:p})},`${s}-forge-${a}`))}else{const u=b(`/wiki/page/${encodeURIComponent(h)}`);i.push(r.jsxs("a",{href:u,className:x("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[0.9em] transition",t?"border border-[var(--info)]/20 bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)] hover:bg-[var(--ui-surface-3)]":"bg-[var(--ui-surface-2)] text-[var(--secondary)] hover:bg-[var(--ui-surface-3)]"),children:[t?r.jsx("span",{className:"shrink-0 text-[0.72em] uppercase tracking-[0.14em] text-[var(--ui-ink-faint)]",children:"Embed"}):null,r.jsx("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:p})]},`${s}-wiki-${a}`))}}else if(n[3]&&n[4]){const o=n[4].trim(),t=/^https?:\/\//i.test(o);i.push(r.jsx("a",{href:o,className:"break-words text-[var(--secondary)] underline decoration-current/35 underline-offset-4 transition hover:text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",target:t?"_blank":void 0,rel:t?"noreferrer":void 0,children:n[3]},`${s}-link-${a}`))}else n[5]?i.push(r.jsx("code",{className:"rounded bg-[var(--ui-surface-2)] px-1.5 py-0.5 text-[0.92em] text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:n[5]},`${s}-code-${a}`)):n[6]?i.push(r.jsx("strong",{className:"font-semibold text-[var(--ui-ink-strong)]",children:n[6]},`${s}-strong-${a}`)):n[7]&&i.push(r.jsx("em",{className:"italic text-[var(--ui-ink-medium)]",children:n[7]},`${s}-em-${a}`));l=e.lastIndex,a+=1}return l<d.length&&i.push(r.jsx(w.Fragment,{children:d.slice(l)},`${s}-tail-${a}`)),i}function j(d){const s=d.replace(/\r/g,"").split(`
|
|
2
2
|
`),i=[];let e=0;for(;e<s.length;){const l=s[e]??"",n=l.trim();if(!n){e+=1;continue}if(n.startsWith("```")){const t=[];for(e+=1;e<s.length&&!(s[e]??"").trim().startsWith("```");)t.push(s[e]??""),e+=1;e+=1,i.push(r.jsx("pre",{className:"max-w-full overflow-x-auto rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3 text-xs leading-6 text-[var(--ui-ink-strong)]",children:r.jsx("code",{className:"block min-w-0 whitespace-pre",children:t.join(`
|
|
3
3
|
`)})},`code-${e}`));continue}const a=l.match(/^(#{1,6})\s+(.*)$/);if(a){const t=a[1].length,c=t===1?"text-xl":t===2?"text-lg":t===3?"text-base":"text-sm";i.push(r.jsx("div",{className:x("font-semibold text-[var(--ui-ink-strong)]",c),children:m(a[2],`heading-${e}`)},`heading-${e}`)),e+=1;continue}if(/^>\s?/.test(l)){const t=[];for(;e<s.length&&/^>\s?/.test(s[e]??"");)t.push((s[e]??"").replace(/^>\s?/,"")),e+=1;i.push(r.jsx("blockquote",{className:"border-l-2 border-[var(--secondary)]/50 pl-4 text-sm leading-7 text-[var(--ui-ink-soft)]",children:m(t.join(" "),`quote-${e}`)},`quote-${e}`));continue}if(/^[-*+]\s+/.test(l)||/^\d+\.\s+/.test(l)){const t=/^\d+\.\s+/.test(l),c=[];for(;e<s.length&&(/^[-*+]\s+/.test(s[e]??"")||/^\d+\.\s+/.test(s[e]??""));)c.push((s[e]??"").replace(/^[-*+]\s+/,"").replace(/^\d+\.\s+/,"")),e+=1;const h=t?"ol":"ul";i.push(r.jsx(h,{className:x("space-y-1 pl-5 text-sm leading-7 text-[var(--ui-ink-soft)]",t?"list-decimal":"list-disc"),children:c.map((p,u)=>r.jsx("li",{children:m(p,`list-${e}-${u}`)},`item-${e}-${u}`))},`list-${e}`));continue}const o=[];for(;e<s.length;){const t=s[e]??"";if(!t.trim()||t.trim().startsWith("```")||/^#{1,6}\s+/.test(t)||/^>\s?/.test(t)||/^[-*+]\s+/.test(t)||/^\d+\.\s+/.test(t))break;o.push(t.trim()),e+=1}i.push(r.jsx("p",{className:"text-sm leading-7 text-[var(--ui-ink-soft)]",children:m(o.join(" "),`paragraph-${e}`)},`paragraph-${e}`))}return i}function y({markdown:d,className:s}){return r.jsx("div",{className:x("grid gap-3",s),children:j(d)})}export{y as N};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./vendor-Dnkkx2co.js";import{m as c,c as s}from"./index-
|
|
1
|
+
import{j as i}from"./vendor-Dnkkx2co.js";import{m as c,c as s}from"./index-By3tQxiE.js";const m=[{value:"Working memory",label:"Working memory",description:"What you are actively working on right now."},{value:"Short-term memory",label:"Short-term memory",description:"What just happened and still needs near-term recall."},{value:"Episodic memory",label:"Episodic memory",description:"Long-term recall for what happened or what you did."},{value:"Semantic memory",label:"Semantic memory",description:"Long-term knowledge about what something is."},{value:"Procedural memory",label:"Procedural memory",description:"Long-term know-how and repeatable how-to knowledge."}];function l(o){const r=new Set;return o.map(t=>t.trim()).filter(Boolean).filter(t=>{const a=t.toLowerCase();return r.has(a)?!1:(r.add(a),!0)})}function p(o){const r=o.trim();if(!r)return null;const t=new Date(r);return Number.isNaN(t.getTime())?null:t.toISOString()}function f(o){if(!o)return"";const r=new Date(o);if(Number.isNaN(r.getTime()))return"";const t=r.getFullYear(),a=String(r.getMonth()+1).padStart(2,"0"),e=String(r.getDate()).padStart(2,"0"),u=String(r.getHours()).padStart(2,"0"),n=String(r.getMinutes()).padStart(2,"0");return`${t}-${a}-${e}T${u}:${n}`}function v(o,r){const t=Number(o);if(!Number.isFinite(t)||t<=0)return null;const a=r==="hours"?3600*1e3:1440*60*1e3;return new Date(Date.now()+t*a).toISOString()}function d(o){const r=new Set(m.map(e=>e.value.toLowerCase())),t=m.map(e=>({value:e.value,label:e.label,description:e.description,searchText:`${e.label} ${e.description}`,badge:i.jsx(s,{className:"border border-[color-mix(in_srgb,var(--info)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_74%,var(--ui-ink-strong)_26%)]",children:e.label}),menuBadge:i.jsx(s,{className:"border border-[color-mix(in_srgb,var(--info)_32%,var(--ui-border-subtle)_68%)] bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_74%,var(--ui-ink-strong)_26%)]",children:e.label})})),a=l(o).filter(e=>!r.has(e.toLowerCase())).map(e=>({value:e,label:e,description:"Custom note tag",searchText:e,badge:i.jsx(s,{className:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:e}),menuBadge:i.jsx(s,{className:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:e})}));return[...t,...a]}function h({value:o,onChange:r,availableTags:t=[],placeholder:a="Add a memory tag or create a custom tag"}){const e=d([...t,...o]);return i.jsx(c,{options:e,selectedValues:l(o),onChange:u=>r(l(u)),placeholder:a,emptyMessage:"No note tags yet.",createLabel:"Add custom tag",onCreate:async u=>{const n=u.trim();return{value:n,label:n,description:"Custom note tag",searchText:n,badge:i.jsx(s,{className:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:n}),menuBadge:i.jsx(s,{className:"border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:n})}}})}export{h as N,v as b,f,l as n,p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m,j as e,aK as Ce,cu as Me,b3 as Qe,b5 as Re,c2 as ze,bg as He,ce as Ye,c7 as Ge,b4 as Je,ca as We}from"./vendor-Dnkkx2co.js";import{j as Xe,i as F,k as ie}from"./state-vCcAT5Hq.js";import{b as Fe,c as z,Z as Ze,u as et,g as f,bk as b,bl as k,ao as tt,bm as at,bn as st,bo as W,bp as De,bq as _e,E as it,B as Q,C as _,h as B,d as nt,br as rt,I as D,bs as lt,T as Ie,m as Le,a as ot,bt as dt,bu as ct,bv as ut,i as mt,bw as pt,bx as xt,by as ht,bz as gt,bA as vt,bB as yt,bC as ft,O as bt,bD as kt}from"./index-BP9__l6C.js";import{N as ne}from"./note-markdown-3wB52NOn.js";import{n as Z,N as re,f as jt,p as Nt,b as wt}from"./note-tags-input-Blg5Gqz_.js";import{P as Tt}from"./page-hero-DgnhI5es.js";import{F as St}from"./floating-action-menu-DBzfnJOx.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";function At(i){return i.trim().toLowerCase()}function Ct(i,l){return i.includes(l)?i:[...i,l]}function Mt({entityOptions:i,selectedEntityValues:l,onSelectedEntityValuesChange:d,selectedTextTerms:u,onSelectedTextTermsChange:I,placeholder:j="Filter by linked entity or add free text"}){const[S,A]=m.useState(""),[ee,g]=m.useState(!1),[H,v]=m.useState(0),P=At(S),C=m.useMemo(()=>l.map(s=>i.find(c=>c.value===s)).filter(Boolean),[i,l]),L=m.useMemo(()=>{const s=i.filter(c=>!l.includes(c.value));return P?s.filter(c=>`${c.label} ${c.description??""} ${c.searchText??""}`.toLowerCase().includes(P)).slice(0,8):s.slice(0,8)},[i,P,l]),N=S.trim().length>0&&!u.includes(S.trim()),Y=s=>{d(Ct(l,s)),A(""),v(0),g(!1)},K=(s=S)=>{const c=s.trim();!c||u.includes(c)||(I([...u,c]),A(""),v(0),g(!1))},q=s=>{d(l.filter(c=>c!==s))},p=s=>{I(u.filter(c=>c!==s))};return e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-muted)]",children:[e.jsx("span",{children:"Search hints: entity chips match linked records, free-text chips match note body or author."}),e.jsx("button",{type:"button",onClick:()=>K(),disabled:!N,className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2.5 py-1 text-[10px] tracking-[0.14em] text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)] disabled:cursor-not-allowed disabled:opacity-40",children:"Free text"})]}),e.jsxs("div",{className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-section)] px-4 py-3 shadow-[var(--ui-shadow-floating)]",children:[C.length>0||u.length>0?e.jsxs("div",{className:"mb-3 flex flex-wrap gap-2",children:[C.map(s=>e.jsxs("span",{className:"inline-flex max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2.5 py-1.5",children:[s.kind?e.jsx(Fe,{kind:s.kind,label:s.label,compact:!0,gradient:!1,className:"max-w-[16rem]"}):e.jsx(z,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:s.label}),e.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-muted)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>q(s.value),"aria-label":`Remove ${s.label}`,children:e.jsx(Ce,{className:"size-3.5"})})]},s.value)),u.map(s=>e.jsxs("span",{className:"inline-flex max-w-full items-center gap-2 rounded-full border border-[color-mix(in_srgb,var(--info)_24%,transparent)] bg-[var(--ui-info-soft)] px-2.5 py-1.5 text-sm text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Me,{className:"size-3.5"}),e.jsx("span",{className:"max-w-[16rem] truncate",children:s})]}),e.jsx("button",{type:"button",className:"rounded-full text-[color-mix(in_srgb,var(--info)_70%,var(--ui-ink-strong)_30%)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>p(s),"aria-label":`Remove free-text filter ${s}`,children:e.jsx(Ce,{className:"size-3.5"})})]},s))]}):null,u.length>1?e.jsx("div",{className:"mb-3 text-xs text-[var(--ui-ink-muted)]",children:"Free-text chips are combined with OR."}):null,e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Qe,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx("input",{value:S,onChange:s=>{A(s.target.value),g(!0),v(0)},onFocus:()=>g(!0),onBlur:()=>{window.setTimeout(()=>g(!1),120)},onKeyDown:s=>{if(s.key==="Backspace"&&!S){if(u.length>0){p(u[u.length-1]);return}l.length>0&&q(l[l.length-1]);return}if(s.key==="ArrowDown"){s.preventDefault(),g(!0),v(w=>L.length===0?0:Math.min(L.length-1,w+1));return}if(s.key==="ArrowUp"){s.preventDefault(),v(w=>Math.max(0,w-1));return}if(s.key==="Escape"){g(!1);return}if(s.key!=="Enter")return;s.preventDefault();const c=L[H];if(c){Y(c.value);return}K()},placeholder:j,className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-muted)] focus:outline-none"})]}),ee?e.jsxs("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] p-2 shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",children:[L.map((s,c)=>e.jsx("button",{type:"button",className:Ze("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",c===H?"bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>v(c),onMouseDown:w=>w.preventDefault(),onClick:()=>Y(s.value),children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:s.kind?e.jsx(Fe,{kind:s.kind,label:s.label,compact:!0,gradient:!1}):s.label}),s.description?e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-muted)]",children:s.description}):null]})},s.value)),N?e.jsxs("button",{type:"button",className:"mt-1 flex w-full items-center gap-2 rounded-[18px] px-3 py-2.5 text-left text-sm text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)] transition hover:bg-[var(--ui-surface-2)]",onMouseDown:s=>s.preventDefault(),onClick:()=>K(),children:[e.jsx(Me,{className:"size-4"}),e.jsxs("span",{className:"truncate",children:['Add free text "',S.trim(),'"']})]}):null,L.length===0&&!N?e.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-muted)]",children:"Keep typing to find a linked entity, or press Enter to add a free-text badge."}):null]}):null]})]})]})}const Ft=new Set(["goal","project","task","strategy","habit","tag","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","flashcard","trigger_report"]);function Be(i){return Ft.has(i)}function x(i,l){return`${i}:${l}`}function X(i){const l=i.indexOf(":");if(l<=0||l>=i.length-1)return null;const d=i.slice(0,l);return Be(d)?{entityType:d,entityId:i.slice(l+1)}:null}function Ee(i){return i!==null}function qe(i){const l=i.getAll("linkedTo"),d=i.get("entityType"),u=i.get("entityId");return d&&u&&Be(d)&&l.unshift(x(d,u)),Array.from(new Set(l.map(I=>I.trim()).filter(Boolean)))}function Dt(i){return Array.from(new Set(i.getAll("textTerms").map(l=>l.trim()).filter(Boolean)))}function _t(i){return Z(i.getAll("tags"))}function R(i,l=[]){return{contentMarkdown:(i==null?void 0:i.contentMarkdown)??"",author:(i==null?void 0:i.author)??"",linkedValues:(i==null?void 0:i.links.map(d=>x(d.entityType,d.entityId)))??l,tags:Z((i==null?void 0:i.tags)??[]),destroyAtInput:jt((i==null?void 0:i.destroyAt)??null),destroyDelayValue:"",destroyDelayUnit:"days"}}function It(i){return[...i].sort((l,d)=>l.label.localeCompare(d.label))}function $e(i){return Nt(i.destroyAtInput)??wt(i.destroyDelayValue,i.destroyDelayUnit)}function Ht(){var ye,fe,be,ke,je,Ne,we,Te;const i=Re(),l=Xe(),d=et(),[u,I]=ze(),[j,S]=m.useState(()=>qe(u)),[A,ee]=m.useState(()=>_t(u)),[g,H]=m.useState(()=>Dt(u)),[v,P]=m.useState(u.get("author")??""),[C,L]=m.useState(u.get("updatedFrom")??""),[N,Y]=m.useState(u.get("updatedTo")??""),[K,q]=m.useState(!1),[p,s]=m.useState(()=>R(null,qe(u))),[c,w]=m.useState(null),[y,T]=m.useState(null),[$,le]=m.useState(null),oe=F({queryKey:["forge-psyche-values"],queryFn:pt}),de=F({queryKey:["forge-psyche-patterns"],queryFn:xt}),ce=F({queryKey:["forge-psyche-behaviors"],queryFn:ht}),ue=F({queryKey:["forge-psyche-beliefs"],queryFn:gt}),me=F({queryKey:["forge-psyche-modes"],queryFn:vt}),pe=F({queryKey:["forge-psyche-flashcards"],queryFn:yt}),xe=F({queryKey:["forge-psyche-reports"],queryFn:ft}),he=Array.isArray(d.selectedUserIds)?d.selectedUserIds:[],U=F({queryKey:["forge-life-force",...he],queryFn:async()=>(await bt(he)).lifeForce});m.useEffect(()=>{const a=new URLSearchParams;for(const n of j)a.append("linkedTo",n);for(const n of A)a.append("tags",n);for(const n of g)a.append("textTerms",n);v.trim()&&a.set("author",v.trim()),C&&a.set("updatedFrom",C),N&&a.set("updatedTo",N),I(a,{replace:!0})},[v,j,A,g,I,C,N]);const G=m.useMemo(()=>{var n,h,J,o,r,Se,Ae;const a=[...d.snapshot.goals.map(t=>({value:x("goal",t.id),label:t.title,description:k(t.description,t.user,"Goal"),searchText:b([t.title,t.description],t),kind:f("goal")??void 0})),...d.snapshot.dashboard.projects.map(t=>({value:x("project",t.id),label:t.title,description:k(`${t.description}${t.description?" · ":""}${t.goalTitle}`,t.user,t.goalTitle),searchText:b([t.title,t.description,t.goalTitle],t),kind:f("project")??void 0})),...d.snapshot.tasks.map(t=>({value:x("task",t.id),label:t.title,description:k(`${t.description}${t.description?" · ":""}${t.owner}`,t.user,t.owner),searchText:b([t.title,t.description,t.owner],t),kind:f("task")??void 0})),...d.snapshot.strategies.map(t=>({value:x("strategy",t.id),label:t.title,description:k(t.overview,t.user,"Strategy"),searchText:b([t.title,t.overview,t.endStateDescription],t),kind:f("strategy")??void 0})),...d.snapshot.habits.map(t=>({value:x("habit",t.id),label:t.title,description:k(t.description,t.user,"Habit"),searchText:b([t.title,t.description],t),kind:f("habit")??void 0})),...d.snapshot.tags.map(t=>({value:x("tag",t.id),label:t.name,description:k(t.description,t.user,t.kind),searchText:b([t.name,t.kind,t.description],t),kind:f("tag")??void 0})),...(((n=oe.data)==null?void 0:n.values)??[]).map(t=>({value:x("psyche_value",t.id),label:t.title,description:k(t.description,t.user,"Psyche value"),searchText:b([t.title,t.description,t.valuedDirection],t),kind:f("psyche_value")??void 0})),...(((h=de.data)==null?void 0:h.patterns)??[]).map(t=>({value:x("behavior_pattern",t.id),label:t.title,description:k(t.description,t.user,"Behavior pattern"),searchText:b([t.title,t.description,t.targetBehavior],t),kind:f("behavior_pattern")??void 0})),...(((J=ce.data)==null?void 0:J.behaviors)??[]).map(t=>({value:x("behavior",t.id),label:t.title,description:k(t.description,t.user,"Behavior"),searchText:b([t.title,t.description,t.kind],t),kind:f("behavior")??void 0})),...(((o=ue.data)==null?void 0:o.beliefs)??[]).map(t=>({value:x("belief_entry",t.id),label:t.statement,description:k(t.flexibleAlternative||t.originNote,t.user,"Belief"),searchText:b([t.statement,t.flexibleAlternative,t.originNote],t),kind:f("belief_entry")??void 0})),...(((r=me.data)==null?void 0:r.modes)??[]).map(t=>({value:x("mode_profile",t.id),label:t.title,description:k(t.archetype||t.family,t.user,"Mode"),searchText:b([t.title,t.archetype,t.family,t.persona],t),kind:f("mode_profile")??void 0})),...(((Se=pe.data)==null?void 0:Se.flashcards)??[]).map(t=>({value:x("flashcard",t.id),label:t.title||t.message,description:k(t.triggerSentence||t.triggerSituation,t.user,"Flashcard"),searchText:b([t.title,t.message,t.triggerSentence,t.triggerSituation,...t.tags],t),kind:f("flashcard")??void 0})),...(((Ae=xe.data)==null?void 0:Ae.reports)??[]).map(t=>({value:x("trigger_report",t.id),label:t.title,description:k(t.eventSituation,t.user,"Trigger report"),searchText:b([t.title,t.eventSituation,t.customEventType??""],t),kind:f("trigger_report")??void 0}))];return It(a)},[(ye=ce.data)==null?void 0:ye.behaviors,(fe=ue.data)==null?void 0:fe.beliefs,(be=pe.data)==null?void 0:be.flashcards,(ke=me.data)==null?void 0:ke.modes,(je=de.data)==null?void 0:je.patterns,(Ne=xe.data)==null?void 0:Ne.reports,d.snapshot.dashboard.projects,d.snapshot.goals,d.snapshot.habits,d.snapshot.strategies,d.snapshot.tags,d.snapshot.tasks,(we=oe.data)==null?void 0:we.values]),Pe=m.useMemo(()=>G.map(a=>{const n=X(a.value);return{value:a.value,label:a.label,description:a.description,searchText:a.searchText,kind:a.kind,entityType:(n==null?void 0:n.entityType)??"goal",entityId:(n==null?void 0:n.entityId)??""}}),[G]),Ke=m.useMemo(()=>j.map(a=>X(a)).filter(Boolean),[j]),O=F({queryKey:["notes-index",j.join("|"),A.join("|"),g.join("|"),v.trim(),C,N],queryFn:()=>kt({linkedTo:Ke,tags:A,textTerms:g,author:v.trim()||void 0,updatedFrom:C||void 0,updatedTo:N||void 0,limit:200})}),te=async()=>{await Promise.all([l.invalidateQueries({queryKey:["notes-index"]}),mt(l)])},ge=ie({mutationFn:async a=>tt({contentMarkdown:a.contentMarkdown.trim(),author:a.author.trim()||null,tags:Z(a.tags),destroyAt:$e(a),links:a.linkedValues.map(n=>X(n)).filter(Ee).map(n=>({entityType:n.entityType,entityId:n.entityId}))}),onSuccess:async()=>{s(R(null,j)),q(!1),await te()}}),ve=ie({mutationFn:async({noteId:a,draft:n})=>at(a,{contentMarkdown:n.contentMarkdown.trim(),author:n.author.trim()||null,tags:Z(n.tags),destroyAt:$e(n),links:n.linkedValues.map(h=>X(h)).filter(Ee).map(h=>({entityType:h.entityType,entityId:h.entityId}))}),onSuccess:async()=>{w(null),T(null),await te()}}),ae=ie({mutationFn:a=>st(a),onSuccess:te}),V=((Te=O.data)==null?void 0:Te.notes)??[],Ue=new Date().toISOString().slice(0,10),Oe=V.filter(a=>a.createdAt.slice(0,10)===Ue).length*W().totalAp,M=$?V.find(a=>a.id===$.noteId)??null:null,se=M?De(M):null,E=se?_e(se.entityType,se.entityId):null,Ve=m.useMemo(()=>M?[{id:"open-linked",label:"Open linked record",description:E?"Jump back into the main entity this note is attached to.":"This note has no navigable linked record yet.",icon:He,disabled:!E,onSelect:()=>{E&&i(E.includes("#")?E:`${E}#notes`)}},{id:"edit-note",label:"Edit note",description:"Update the Markdown body, note tags, expiry, or connected entity links.",icon:Ye,onSelect:()=>{w(M.id),T(R(M))}},{id:"delete-note",label:"Delete note",description:"Soft-delete this note from the main workspace.",icon:Ge,tone:"danger",disabled:ae.isPending,onSelect:()=>{ae.mutateAsync(M.id)}}]:[],[E,M,ae,i]);return O.isError?e.jsx(it,{eyebrow:"Notes",error:O.error,onRetry:()=>void O.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Tt,{title:"Notes",titleText:"Notes",description:"Notes are first-class Markdown entities in Forge. Search them by linked records, note tags, date, or free text, then create durable or ephemeral notes that stay connected to the rest of the graph.",badge:`${V.length} visible`,actions:e.jsxs(Q,{onClick:()=>{s(R(null,j)),q(!0)},children:[e.jsx(Je,{className:"size-4"}),"New note"]})}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-4",children:[e.jsxs(_,{className:"border-[var(--primary)]/16 shadow-[var(--card-shadow)]",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Quick note default"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--primary)]",children:B(W().totalAp)}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Standalone notes count as a tiny Action Point impulse unless a richer active work context already covers them."})]}),e.jsxs(_,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Notes created today"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:B(Oe)}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Visible notes created today in this workspace at the default quick note cost."})]}),e.jsxs(_,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Life Force sync"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-[var(--ui-ink-strong)]",children:U.data?`${B(U.data.spentTodayAp)} / ${B(U.data.dailyBudgetAp)}`:"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Notes participate in the same Action Point ledger as tasks, habits, movement, and calendar work."})]}),e.jsxs(_,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Instant headroom"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-[var(--ui-ink-strong)]",children:U.data?nt(U.data.instantFreeApPerHour):"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Useful when deciding whether to just capture a quick note or stay inside a heavier work stream."})]})]}),e.jsx(rt,{children:e.jsxs(_,{className:"grid gap-4",children:[e.jsx(Mt,{entityOptions:Pe,selectedEntityValues:j,onSelectedEntityValuesChange:S,selectedTextTerms:g,onSelectedTextTermsChange:H}),e.jsx(re,{value:A,onChange:ee,placeholder:"Filter by memory tag or custom note tag"}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(12rem,0.38fr)_minmax(12rem,0.38fr)]",children:[e.jsx(D,{value:v,onChange:a=>P(a.target.value),placeholder:"Filter by author"}),e.jsx(D,{type:"date",value:C,onChange:a=>L(a.target.value)}),e.jsx(D,{type:"date",value:N,onChange:a=>Y(a.target.value)})]})]})}),K?e.jsx(lt,{children:e.jsxs(_,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"New note"}),e.jsxs("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:["Notes are independent Markdown entities. Link them to one or more real records, add memory-system or custom tags, and optionally make them ephemeral with an automatic destroy time. Standalone notes default to"," ",B(W().totalAp),"."]})]}),e.jsx(Q,{variant:"ghost",onClick:()=>{q(!1),s(R(null,j))},children:"Cancel"})]}),e.jsx(Ie,{value:p.contentMarkdown,onChange:a=>s(n=>({...n,contentMarkdown:a.target.value})),className:"min-h-[16rem]",placeholder:"Write the note in Markdown. This can be as short as a handoff line or as long as a wiki page."}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[e.jsx(D,{value:p.author,onChange:a=>s(n=>({...n,author:a.target.value})),placeholder:"Optional author"}),e.jsx(Le,{options:G,selectedValues:p.linkedValues,onChange:a=>s(n=>({...n,linkedValues:a})),placeholder:"Link this note to strategies, goals, projects, tasks, habits, or human/bot-owned records",emptyMessage:"No matching entities found yet."})]}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(re,{value:p.tags,onChange:a=>s(n=>({...n,tags:a}))}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-[var(--ui-ink-soft)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(D,{type:"datetime-local",value:p.destroyAtInput,onChange:a=>s(n=>({...n,destroyAtInput:a.target.value}))}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(D,{type:"number",min:"1",value:p.destroyDelayValue,onChange:a=>s(n=>({...n,destroyDelayValue:a.target.value})),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-strong)]",value:p.destroyDelayUnit,onChange:a=>s(n=>({...n,destroyDelayUnit:a.target.value})),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:p.contentMarkdown.trim()?e.jsx(ne,{markdown:p.contentMarkdown}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:"Markdown preview appears here."})})]}),e.jsx("div",{className:"flex flex-wrap justify-end gap-2",children:e.jsx(Q,{pending:ge.isPending,pendingLabel:"Saving",disabled:p.contentMarkdown.trim().length===0||p.linkedValues.length===0,onClick:()=>void ge.mutateAsync(p),children:"Save note"})})]})}):null,O.isLoading?e.jsx(_,{className:"text-sm text-[var(--ui-ink-soft)]",children:"Loading notes…"}):V.length===0?e.jsx(ot,{eyebrow:"Notes",title:"No matching notes yet",description:"Try broader linked-entity filters, remove a date bound, or add the first durable note from the button above."}):e.jsx(dt,{children:e.jsx("div",{className:"grid gap-3",children:V.map(a=>{const n=De(a),h=n?_e(n.entityType,n.entityId):null,J=c===a.id&&y!==null;return e.jsxs(_,{className:"min-w-0 overflow-hidden p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-xs uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[(a.author??"Unknown author").toString()," •"," ",new Date(a.updatedAt).toLocaleString()]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(z,{className:"bg-[var(--primary)]/12 text-[var(--primary)]",wrap:!0,children:[B(W().totalAp)," ","quick note"]}),a.links.map(o=>e.jsxs(z,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",wrap:!0,children:[ct(o.entityType),o.anchorKey?` · ${ut(o.anchorKey)}`:""]},`${a.id}-${o.entityType}-${o.entityId}-${o.anchorKey??""}`)),(a.tags??[]).map(o=>e.jsx(z,{className:"border-[var(--info)]/20 bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]",wrap:!0,children:o},`${a.id}-tag-${o}`)),a.destroyAt?e.jsxs(z,{className:"border-[var(--warning)]/20 bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",wrap:!0,children:["Ephemeral · deletes"," ",new Date(a.destroyAt).toLocaleString()]}):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-surface-3)] hover:text-[var(--ui-ink-strong)]",onClick:o=>{o.preventDefault(),o.stopPropagation();const r=o.currentTarget.getBoundingClientRect();le({noteId:a.id,position:{x:r.right-8,y:r.bottom+8}})},"aria-label":`Open actions for note ${a.id}`,children:e.jsx(We,{className:"size-4"})})]}),J?e.jsxs("div",{className:"mt-4 grid gap-4",children:[e.jsx(Ie,{value:y.contentMarkdown,onChange:o=>T(r=>r&&{...r,contentMarkdown:o.target.value}),className:"min-h-[14rem]"}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[e.jsx(D,{value:y.author,onChange:o=>T(r=>r&&{...r,author:o.target.value}),placeholder:"Optional author"}),e.jsx(Le,{options:G,selectedValues:y.linkedValues,onChange:o=>T(r=>r&&{...r,linkedValues:o}),placeholder:"Update the linked entities",emptyMessage:"No matching entities found yet."})]}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(re,{value:y.tags,onChange:o=>T(r=>r&&{...r,tags:o})}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-[var(--ui-ink-soft)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(D,{type:"datetime-local",value:y.destroyAtInput,onChange:o=>T(r=>r&&{...r,destroyAtInput:o.target.value})}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(D,{type:"number",min:"1",value:y.destroyDelayValue,onChange:o=>T(r=>r&&{...r,destroyDelayValue:o.target.value}),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-strong)]",value:y.destroyDelayUnit,onChange:o=>T(r=>r&&{...r,destroyDelayUnit:o.target.value}),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:y.contentMarkdown.trim()?e.jsx(ne,{markdown:y.contentMarkdown}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:"No content yet."})})]}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",onClick:()=>{w(null),T(null)},children:"Cancel"}),e.jsx(Q,{pending:ve.isPending,pendingLabel:"Saving",disabled:y.contentMarkdown.trim().length===0||y.linkedValues.length===0,onClick:()=>void ve.mutateAsync({noteId:a.id,draft:y}),children:"Save changes"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"mt-4 w-full text-left",onClick:()=>{h&&i(h.includes("#")?h:`${h}#notes`)},disabled:!h,children:e.jsx(ne,{markdown:a.contentMarkdown,className:"line-clamp-none"})}),h?e.jsx("div",{className:"mt-4 inline-flex text-xs uppercase tracking-[0.16em] text-[var(--secondary)]",children:"Open linked record"}):null]})]},a.id)})})}),e.jsx(St,{open:!!$,title:"Note actions",subtitle:M?M.contentPlain.slice(0,80)||"Markdown note":void 0,items:Ve,position:($==null?void 0:$.position)??null,onClose:()=>le(null)})]})}export{Ht as NotesPage};
|
|
1
|
+
import{r as m,j as e,aK as Ce,cu as Me,b3 as Qe,b5 as Re,c2 as ze,bg as He,ce as Ye,c7 as Ge,b4 as Je,ca as We}from"./vendor-Dnkkx2co.js";import{j as Xe,i as F,k as ie}from"./state-vCcAT5Hq.js";import{b as Fe,c as z,Z as Ze,u as et,g as f,bk as b,bl as k,ao as tt,bm as at,bn as st,bo as W,bp as De,bq as _e,E as it,B as Q,C as _,h as B,d as nt,br as rt,I as D,bs as lt,T as Ie,m as Le,a as ot,bt as dt,bu as ct,bv as ut,i as mt,bw as pt,bx as xt,by as ht,bz as gt,bA as vt,bB as yt,bC as ft,O as bt,bD as kt}from"./index-By3tQxiE.js";import{N as ne}from"./note-markdown-CepDxj3v.js";import{n as Z,N as re,f as jt,p as Nt,b as wt}from"./note-tags-input-BXYaDkOr.js";import{P as Tt}from"./page-hero-5RTqAI88.js";import{F as St}from"./floating-action-menu-C5H-Wr2B.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";function At(i){return i.trim().toLowerCase()}function Ct(i,l){return i.includes(l)?i:[...i,l]}function Mt({entityOptions:i,selectedEntityValues:l,onSelectedEntityValuesChange:d,selectedTextTerms:u,onSelectedTextTermsChange:I,placeholder:j="Filter by linked entity or add free text"}){const[S,A]=m.useState(""),[ee,g]=m.useState(!1),[H,v]=m.useState(0),P=At(S),C=m.useMemo(()=>l.map(s=>i.find(c=>c.value===s)).filter(Boolean),[i,l]),L=m.useMemo(()=>{const s=i.filter(c=>!l.includes(c.value));return P?s.filter(c=>`${c.label} ${c.description??""} ${c.searchText??""}`.toLowerCase().includes(P)).slice(0,8):s.slice(0,8)},[i,P,l]),N=S.trim().length>0&&!u.includes(S.trim()),Y=s=>{d(Ct(l,s)),A(""),v(0),g(!1)},K=(s=S)=>{const c=s.trim();!c||u.includes(c)||(I([...u,c]),A(""),v(0),g(!1))},q=s=>{d(l.filter(c=>c!==s))},p=s=>{I(u.filter(c=>c!==s))};return e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-muted)]",children:[e.jsx("span",{children:"Search hints: entity chips match linked records, free-text chips match note body or author."}),e.jsx("button",{type:"button",onClick:()=>K(),disabled:!N,className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2.5 py-1 text-[10px] tracking-[0.14em] text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)] disabled:cursor-not-allowed disabled:opacity-40",children:"Free text"})]}),e.jsxs("div",{className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-section)] px-4 py-3 shadow-[var(--ui-shadow-floating)]",children:[C.length>0||u.length>0?e.jsxs("div",{className:"mb-3 flex flex-wrap gap-2",children:[C.map(s=>e.jsxs("span",{className:"inline-flex max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2.5 py-1.5",children:[s.kind?e.jsx(Fe,{kind:s.kind,label:s.label,compact:!0,gradient:!1,className:"max-w-[16rem]"}):e.jsx(z,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:s.label}),e.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-muted)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>q(s.value),"aria-label":`Remove ${s.label}`,children:e.jsx(Ce,{className:"size-3.5"})})]},s.value)),u.map(s=>e.jsxs("span",{className:"inline-flex max-w-full items-center gap-2 rounded-full border border-[color-mix(in_srgb,var(--info)_24%,transparent)] bg-[var(--ui-info-soft)] px-2.5 py-1.5 text-sm text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Me,{className:"size-3.5"}),e.jsx("span",{className:"max-w-[16rem] truncate",children:s})]}),e.jsx("button",{type:"button",className:"rounded-full text-[color-mix(in_srgb,var(--info)_70%,var(--ui-ink-strong)_30%)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>p(s),"aria-label":`Remove free-text filter ${s}`,children:e.jsx(Ce,{className:"size-3.5"})})]},s))]}):null,u.length>1?e.jsx("div",{className:"mb-3 text-xs text-[var(--ui-ink-muted)]",children:"Free-text chips are combined with OR."}):null,e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Qe,{className:"size-4 text-[var(--ui-ink-muted)]"}),e.jsx("input",{value:S,onChange:s=>{A(s.target.value),g(!0),v(0)},onFocus:()=>g(!0),onBlur:()=>{window.setTimeout(()=>g(!1),120)},onKeyDown:s=>{if(s.key==="Backspace"&&!S){if(u.length>0){p(u[u.length-1]);return}l.length>0&&q(l[l.length-1]);return}if(s.key==="ArrowDown"){s.preventDefault(),g(!0),v(w=>L.length===0?0:Math.min(L.length-1,w+1));return}if(s.key==="ArrowUp"){s.preventDefault(),v(w=>Math.max(0,w-1));return}if(s.key==="Escape"){g(!1);return}if(s.key!=="Enter")return;s.preventDefault();const c=L[H];if(c){Y(c.value);return}K()},placeholder:j,className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-muted)] focus:outline-none"})]}),ee?e.jsxs("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] p-2 shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",children:[L.map((s,c)=>e.jsx("button",{type:"button",className:Ze("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",c===H?"bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>v(c),onMouseDown:w=>w.preventDefault(),onClick:()=>Y(s.value),children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:s.kind?e.jsx(Fe,{kind:s.kind,label:s.label,compact:!0,gradient:!1}):s.label}),s.description?e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-muted)]",children:s.description}):null]})},s.value)),N?e.jsxs("button",{type:"button",className:"mt-1 flex w-full items-center gap-2 rounded-[18px] px-3 py-2.5 text-left text-sm text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)] transition hover:bg-[var(--ui-surface-2)]",onMouseDown:s=>s.preventDefault(),onClick:()=>K(),children:[e.jsx(Me,{className:"size-4"}),e.jsxs("span",{className:"truncate",children:['Add free text "',S.trim(),'"']})]}):null,L.length===0&&!N?e.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-muted)]",children:"Keep typing to find a linked entity, or press Enter to add a free-text badge."}):null]}):null]})]})]})}const Ft=new Set(["goal","project","task","strategy","habit","tag","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","flashcard","trigger_report"]);function Be(i){return Ft.has(i)}function x(i,l){return`${i}:${l}`}function X(i){const l=i.indexOf(":");if(l<=0||l>=i.length-1)return null;const d=i.slice(0,l);return Be(d)?{entityType:d,entityId:i.slice(l+1)}:null}function Ee(i){return i!==null}function qe(i){const l=i.getAll("linkedTo"),d=i.get("entityType"),u=i.get("entityId");return d&&u&&Be(d)&&l.unshift(x(d,u)),Array.from(new Set(l.map(I=>I.trim()).filter(Boolean)))}function Dt(i){return Array.from(new Set(i.getAll("textTerms").map(l=>l.trim()).filter(Boolean)))}function _t(i){return Z(i.getAll("tags"))}function R(i,l=[]){return{contentMarkdown:(i==null?void 0:i.contentMarkdown)??"",author:(i==null?void 0:i.author)??"",linkedValues:(i==null?void 0:i.links.map(d=>x(d.entityType,d.entityId)))??l,tags:Z((i==null?void 0:i.tags)??[]),destroyAtInput:jt((i==null?void 0:i.destroyAt)??null),destroyDelayValue:"",destroyDelayUnit:"days"}}function It(i){return[...i].sort((l,d)=>l.label.localeCompare(d.label))}function $e(i){return Nt(i.destroyAtInput)??wt(i.destroyDelayValue,i.destroyDelayUnit)}function Ht(){var ye,fe,be,ke,je,Ne,we,Te;const i=Re(),l=Xe(),d=et(),[u,I]=ze(),[j,S]=m.useState(()=>qe(u)),[A,ee]=m.useState(()=>_t(u)),[g,H]=m.useState(()=>Dt(u)),[v,P]=m.useState(u.get("author")??""),[C,L]=m.useState(u.get("updatedFrom")??""),[N,Y]=m.useState(u.get("updatedTo")??""),[K,q]=m.useState(!1),[p,s]=m.useState(()=>R(null,qe(u))),[c,w]=m.useState(null),[y,T]=m.useState(null),[$,le]=m.useState(null),oe=F({queryKey:["forge-psyche-values"],queryFn:pt}),de=F({queryKey:["forge-psyche-patterns"],queryFn:xt}),ce=F({queryKey:["forge-psyche-behaviors"],queryFn:ht}),ue=F({queryKey:["forge-psyche-beliefs"],queryFn:gt}),me=F({queryKey:["forge-psyche-modes"],queryFn:vt}),pe=F({queryKey:["forge-psyche-flashcards"],queryFn:yt}),xe=F({queryKey:["forge-psyche-reports"],queryFn:ft}),he=Array.isArray(d.selectedUserIds)?d.selectedUserIds:[],U=F({queryKey:["forge-life-force",...he],queryFn:async()=>(await bt(he)).lifeForce});m.useEffect(()=>{const a=new URLSearchParams;for(const n of j)a.append("linkedTo",n);for(const n of A)a.append("tags",n);for(const n of g)a.append("textTerms",n);v.trim()&&a.set("author",v.trim()),C&&a.set("updatedFrom",C),N&&a.set("updatedTo",N),I(a,{replace:!0})},[v,j,A,g,I,C,N]);const G=m.useMemo(()=>{var n,h,J,o,r,Se,Ae;const a=[...d.snapshot.goals.map(t=>({value:x("goal",t.id),label:t.title,description:k(t.description,t.user,"Goal"),searchText:b([t.title,t.description],t),kind:f("goal")??void 0})),...d.snapshot.dashboard.projects.map(t=>({value:x("project",t.id),label:t.title,description:k(`${t.description}${t.description?" · ":""}${t.goalTitle}`,t.user,t.goalTitle),searchText:b([t.title,t.description,t.goalTitle],t),kind:f("project")??void 0})),...d.snapshot.tasks.map(t=>({value:x("task",t.id),label:t.title,description:k(`${t.description}${t.description?" · ":""}${t.owner}`,t.user,t.owner),searchText:b([t.title,t.description,t.owner],t),kind:f("task")??void 0})),...d.snapshot.strategies.map(t=>({value:x("strategy",t.id),label:t.title,description:k(t.overview,t.user,"Strategy"),searchText:b([t.title,t.overview,t.endStateDescription],t),kind:f("strategy")??void 0})),...d.snapshot.habits.map(t=>({value:x("habit",t.id),label:t.title,description:k(t.description,t.user,"Habit"),searchText:b([t.title,t.description],t),kind:f("habit")??void 0})),...d.snapshot.tags.map(t=>({value:x("tag",t.id),label:t.name,description:k(t.description,t.user,t.kind),searchText:b([t.name,t.kind,t.description],t),kind:f("tag")??void 0})),...(((n=oe.data)==null?void 0:n.values)??[]).map(t=>({value:x("psyche_value",t.id),label:t.title,description:k(t.description,t.user,"Psyche value"),searchText:b([t.title,t.description,t.valuedDirection],t),kind:f("psyche_value")??void 0})),...(((h=de.data)==null?void 0:h.patterns)??[]).map(t=>({value:x("behavior_pattern",t.id),label:t.title,description:k(t.description,t.user,"Behavior pattern"),searchText:b([t.title,t.description,t.targetBehavior],t),kind:f("behavior_pattern")??void 0})),...(((J=ce.data)==null?void 0:J.behaviors)??[]).map(t=>({value:x("behavior",t.id),label:t.title,description:k(t.description,t.user,"Behavior"),searchText:b([t.title,t.description,t.kind],t),kind:f("behavior")??void 0})),...(((o=ue.data)==null?void 0:o.beliefs)??[]).map(t=>({value:x("belief_entry",t.id),label:t.statement,description:k(t.flexibleAlternative||t.originNote,t.user,"Belief"),searchText:b([t.statement,t.flexibleAlternative,t.originNote],t),kind:f("belief_entry")??void 0})),...(((r=me.data)==null?void 0:r.modes)??[]).map(t=>({value:x("mode_profile",t.id),label:t.title,description:k(t.archetype||t.family,t.user,"Mode"),searchText:b([t.title,t.archetype,t.family,t.persona],t),kind:f("mode_profile")??void 0})),...(((Se=pe.data)==null?void 0:Se.flashcards)??[]).map(t=>({value:x("flashcard",t.id),label:t.title||t.message,description:k(t.triggerSentence||t.triggerSituation,t.user,"Flashcard"),searchText:b([t.title,t.message,t.triggerSentence,t.triggerSituation,...t.tags],t),kind:f("flashcard")??void 0})),...(((Ae=xe.data)==null?void 0:Ae.reports)??[]).map(t=>({value:x("trigger_report",t.id),label:t.title,description:k(t.eventSituation,t.user,"Trigger report"),searchText:b([t.title,t.eventSituation,t.customEventType??""],t),kind:f("trigger_report")??void 0}))];return It(a)},[(ye=ce.data)==null?void 0:ye.behaviors,(fe=ue.data)==null?void 0:fe.beliefs,(be=pe.data)==null?void 0:be.flashcards,(ke=me.data)==null?void 0:ke.modes,(je=de.data)==null?void 0:je.patterns,(Ne=xe.data)==null?void 0:Ne.reports,d.snapshot.dashboard.projects,d.snapshot.goals,d.snapshot.habits,d.snapshot.strategies,d.snapshot.tags,d.snapshot.tasks,(we=oe.data)==null?void 0:we.values]),Pe=m.useMemo(()=>G.map(a=>{const n=X(a.value);return{value:a.value,label:a.label,description:a.description,searchText:a.searchText,kind:a.kind,entityType:(n==null?void 0:n.entityType)??"goal",entityId:(n==null?void 0:n.entityId)??""}}),[G]),Ke=m.useMemo(()=>j.map(a=>X(a)).filter(Boolean),[j]),O=F({queryKey:["notes-index",j.join("|"),A.join("|"),g.join("|"),v.trim(),C,N],queryFn:()=>kt({linkedTo:Ke,tags:A,textTerms:g,author:v.trim()||void 0,updatedFrom:C||void 0,updatedTo:N||void 0,limit:200})}),te=async()=>{await Promise.all([l.invalidateQueries({queryKey:["notes-index"]}),mt(l)])},ge=ie({mutationFn:async a=>tt({contentMarkdown:a.contentMarkdown.trim(),author:a.author.trim()||null,tags:Z(a.tags),destroyAt:$e(a),links:a.linkedValues.map(n=>X(n)).filter(Ee).map(n=>({entityType:n.entityType,entityId:n.entityId}))}),onSuccess:async()=>{s(R(null,j)),q(!1),await te()}}),ve=ie({mutationFn:async({noteId:a,draft:n})=>at(a,{contentMarkdown:n.contentMarkdown.trim(),author:n.author.trim()||null,tags:Z(n.tags),destroyAt:$e(n),links:n.linkedValues.map(h=>X(h)).filter(Ee).map(h=>({entityType:h.entityType,entityId:h.entityId}))}),onSuccess:async()=>{w(null),T(null),await te()}}),ae=ie({mutationFn:a=>st(a),onSuccess:te}),V=((Te=O.data)==null?void 0:Te.notes)??[],Ue=new Date().toISOString().slice(0,10),Oe=V.filter(a=>a.createdAt.slice(0,10)===Ue).length*W().totalAp,M=$?V.find(a=>a.id===$.noteId)??null:null,se=M?De(M):null,E=se?_e(se.entityType,se.entityId):null,Ve=m.useMemo(()=>M?[{id:"open-linked",label:"Open linked record",description:E?"Jump back into the main entity this note is attached to.":"This note has no navigable linked record yet.",icon:He,disabled:!E,onSelect:()=>{E&&i(E.includes("#")?E:`${E}#notes`)}},{id:"edit-note",label:"Edit note",description:"Update the Markdown body, note tags, expiry, or connected entity links.",icon:Ye,onSelect:()=>{w(M.id),T(R(M))}},{id:"delete-note",label:"Delete note",description:"Soft-delete this note from the main workspace.",icon:Ge,tone:"danger",disabled:ae.isPending,onSelect:()=>{ae.mutateAsync(M.id)}}]:[],[E,M,ae,i]);return O.isError?e.jsx(it,{eyebrow:"Notes",error:O.error,onRetry:()=>void O.refetch()}):e.jsxs("div",{className:"grid gap-5",children:[e.jsx(Tt,{title:"Notes",titleText:"Notes",description:"Notes are first-class Markdown entities in Forge. Search them by linked records, note tags, date, or free text, then create durable or ephemeral notes that stay connected to the rest of the graph.",badge:`${V.length} visible`,actions:e.jsxs(Q,{onClick:()=>{s(R(null,j)),q(!0)},children:[e.jsx(Je,{className:"size-4"}),"New note"]})}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-4",children:[e.jsxs(_,{className:"border-[var(--primary)]/16 shadow-[var(--card-shadow)]",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Quick note default"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--primary)]",children:B(W().totalAp)}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Standalone notes count as a tiny Action Point impulse unless a richer active work context already covers them."})]}),e.jsxs(_,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Notes created today"}),e.jsx("div",{className:"mt-3 font-display text-4xl text-[var(--ui-ink-strong)]",children:B(Oe)}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Visible notes created today in this workspace at the default quick note cost."})]}),e.jsxs(_,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Life Force sync"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-[var(--ui-ink-strong)]",children:U.data?`${B(U.data.spentTodayAp)} / ${B(U.data.dailyBudgetAp)}`:"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Notes participate in the same Action Point ledger as tasks, habits, movement, and calendar work."})]}),e.jsxs(_,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:"Instant headroom"}),e.jsx("div",{className:"mt-3 text-2xl font-display text-[var(--ui-ink-strong)]",children:U.data?nt(U.data.instantFreeApPerHour):"Loading..."}),e.jsx("div",{className:"mt-2 text-sm text-[var(--ui-ink-soft)]",children:"Useful when deciding whether to just capture a quick note or stay inside a heavier work stream."})]})]}),e.jsx(rt,{children:e.jsxs(_,{className:"grid gap-4",children:[e.jsx(Mt,{entityOptions:Pe,selectedEntityValues:j,onSelectedEntityValuesChange:S,selectedTextTerms:g,onSelectedTextTermsChange:H}),e.jsx(re,{value:A,onChange:ee,placeholder:"Filter by memory tag or custom note tag"}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(12rem,0.38fr)_minmax(12rem,0.38fr)]",children:[e.jsx(D,{value:v,onChange:a=>P(a.target.value),placeholder:"Filter by author"}),e.jsx(D,{type:"date",value:C,onChange:a=>L(a.target.value)}),e.jsx(D,{type:"date",value:N,onChange:a=>Y(a.target.value)})]})]})}),K?e.jsx(lt,{children:e.jsxs(_,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"New note"}),e.jsxs("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:["Notes are independent Markdown entities. Link them to one or more real records, add memory-system or custom tags, and optionally make them ephemeral with an automatic destroy time. Standalone notes default to"," ",B(W().totalAp),"."]})]}),e.jsx(Q,{variant:"ghost",onClick:()=>{q(!1),s(R(null,j))},children:"Cancel"})]}),e.jsx(Ie,{value:p.contentMarkdown,onChange:a=>s(n=>({...n,contentMarkdown:a.target.value})),className:"min-h-[16rem]",placeholder:"Write the note in Markdown. This can be as short as a handoff line or as long as a wiki page."}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[e.jsx(D,{value:p.author,onChange:a=>s(n=>({...n,author:a.target.value})),placeholder:"Optional author"}),e.jsx(Le,{options:G,selectedValues:p.linkedValues,onChange:a=>s(n=>({...n,linkedValues:a})),placeholder:"Link this note to strategies, goals, projects, tasks, habits, or human/bot-owned records",emptyMessage:"No matching entities found yet."})]}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(re,{value:p.tags,onChange:a=>s(n=>({...n,tags:a}))}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-[var(--ui-ink-soft)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(D,{type:"datetime-local",value:p.destroyAtInput,onChange:a=>s(n=>({...n,destroyAtInput:a.target.value}))}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(D,{type:"number",min:"1",value:p.destroyDelayValue,onChange:a=>s(n=>({...n,destroyDelayValue:a.target.value})),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-strong)]",value:p.destroyDelayUnit,onChange:a=>s(n=>({...n,destroyDelayUnit:a.target.value})),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:p.contentMarkdown.trim()?e.jsx(ne,{markdown:p.contentMarkdown}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:"Markdown preview appears here."})})]}),e.jsx("div",{className:"flex flex-wrap justify-end gap-2",children:e.jsx(Q,{pending:ge.isPending,pendingLabel:"Saving",disabled:p.contentMarkdown.trim().length===0||p.linkedValues.length===0,onClick:()=>void ge.mutateAsync(p),children:"Save note"})})]})}):null,O.isLoading?e.jsx(_,{className:"text-sm text-[var(--ui-ink-soft)]",children:"Loading notes…"}):V.length===0?e.jsx(ot,{eyebrow:"Notes",title:"No matching notes yet",description:"Try broader linked-entity filters, remove a date bound, or add the first durable note from the button above."}):e.jsx(dt,{children:e.jsx("div",{className:"grid gap-3",children:V.map(a=>{const n=De(a),h=n?_e(n.entityType,n.entityId):null,J=c===a.id&&y!==null;return e.jsxs(_,{className:"min-w-0 overflow-hidden p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-xs uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[(a.author??"Unknown author").toString()," •"," ",new Date(a.updatedAt).toLocaleString()]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(z,{className:"bg-[var(--primary)]/12 text-[var(--primary)]",wrap:!0,children:[B(W().totalAp)," ","quick note"]}),a.links.map(o=>e.jsxs(z,{className:"bg-[var(--ui-surface-3)] text-[var(--ui-ink-soft)]",wrap:!0,children:[ct(o.entityType),o.anchorKey?` · ${ut(o.anchorKey)}`:""]},`${a.id}-${o.entityType}-${o.entityId}-${o.anchorKey??""}`)),(a.tags??[]).map(o=>e.jsx(z,{className:"border-[var(--info)]/20 bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]",wrap:!0,children:o},`${a.id}-tag-${o}`)),a.destroyAt?e.jsxs(z,{className:"border-[var(--warning)]/20 bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",wrap:!0,children:["Ephemeral · deletes"," ",new Date(a.destroyAt).toLocaleString()]}):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-surface-3)] hover:text-[var(--ui-ink-strong)]",onClick:o=>{o.preventDefault(),o.stopPropagation();const r=o.currentTarget.getBoundingClientRect();le({noteId:a.id,position:{x:r.right-8,y:r.bottom+8}})},"aria-label":`Open actions for note ${a.id}`,children:e.jsx(We,{className:"size-4"})})]}),J?e.jsxs("div",{className:"mt-4 grid gap-4",children:[e.jsx(Ie,{value:y.contentMarkdown,onChange:o=>T(r=>r&&{...r,contentMarkdown:o.target.value}),className:"min-h-[14rem]"}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[e.jsx(D,{value:y.author,onChange:o=>T(r=>r&&{...r,author:o.target.value}),placeholder:"Optional author"}),e.jsx(Le,{options:G,selectedValues:y.linkedValues,onChange:o=>T(r=>r&&{...r,linkedValues:o}),placeholder:"Update the linked entities",emptyMessage:"No matching entities found yet."})]}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(re,{value:y.tags,onChange:o=>T(r=>r&&{...r,tags:o})}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Ephemeral auto-destroy"}),e.jsx("div",{className:"mt-2 text-xs leading-5 text-[var(--ui-ink-soft)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(D,{type:"datetime-local",value:y.destroyAtInput,onChange:o=>T(r=>r&&{...r,destroyAtInput:o.target.value})}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(D,{type:"number",min:"1",value:y.destroyDelayValue,onChange:o=>T(r=>r&&{...r,destroyDelayValue:o.target.value}),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-sm text-[var(--ui-ink-strong)]",value:y.destroyDelayUnit,onChange:o=>T(r=>r&&{...r,destroyDelayUnit:o.target.value}),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"rounded-[22px] bg-[var(--ui-surface-1)] p-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:y.contentMarkdown.trim()?e.jsx(ne,{markdown:y.contentMarkdown}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:"No content yet."})})]}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",onClick:()=>{w(null),T(null)},children:"Cancel"}),e.jsx(Q,{pending:ve.isPending,pendingLabel:"Saving",disabled:y.contentMarkdown.trim().length===0||y.linkedValues.length===0,onClick:()=>void ve.mutateAsync({noteId:a.id,draft:y}),children:"Save changes"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"mt-4 w-full text-left",onClick:()=>{h&&i(h.includes("#")?h:`${h}#notes`)},disabled:!h,children:e.jsx(ne,{markdown:a.contentMarkdown,className:"line-clamp-none"})}),h?e.jsx("div",{className:"mt-4 inline-flex text-xs uppercase tracking-[0.16em] text-[var(--secondary)]",children:"Open linked record"}):null]})]},a.id)})})}),e.jsx(St,{open:!!$,title:"Note actions",subtitle:M?M.contentPlain.slice(0,80)||"Markdown note":void 0,items:Ve,position:($==null?void 0:$.position)??null,onClose:()=>le(null)})]})}export{Ht as NotesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b5 as p,j as s,aU as c}from"./vendor-Dnkkx2co.js";import{B as u,cK as m}from"./index-
|
|
1
|
+
import{b5 as p,j as s,aU as c}from"./vendor-Dnkkx2co.js";import{B as u,cK as m}from"./index-By3tQxiE.js";function d({entityType:a,entityId:e,view:n,label:o="Open in graph",variant:r="secondary",size:t}){const i=p();return s.jsxs(u,{variant:r,size:t,onClick:()=>i(m(a,e,{view:n})),children:[s.jsx(c,{className:"size-4"}),o]})}export{d as O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as w,j as r,aC as R}from"./vendor-Dnkkx2co.js";import{Z as O}from"./index-
|
|
1
|
+
import{r as w,j as r,aC as R}from"./vendor-Dnkkx2co.js";import{Z as O}from"./index-By3tQxiE.js";import{m as B}from"./motion-Lt5B1XuE.js";const z={mint:"border-[color-mix(in_srgb,var(--success)_28%,var(--ui-border-subtle)_72%)] bg-[color-mix(in_srgb,var(--success)_12%,var(--ui-surface-1)_88%)] text-[color-mix(in_srgb,var(--success)_62%,var(--ui-ink-strong)_38%)]",sky:"border-[color-mix(in_srgb,var(--info)_28%,var(--ui-border-subtle)_72%)] bg-[color-mix(in_srgb,var(--info)_12%,var(--ui-surface-1)_88%)] text-[color-mix(in_srgb,var(--info)_62%,var(--ui-ink-strong)_38%)]",violet:"border-[color-mix(in_srgb,var(--primary)_28%,var(--ui-border-subtle)_72%)] bg-[color-mix(in_srgb,var(--primary)_12%,var(--ui-surface-1)_88%)] text-[color-mix(in_srgb,var(--primary)_62%,var(--ui-ink-strong)_38%)]",rose:"border-[color-mix(in_srgb,var(--danger)_28%,var(--ui-border-subtle)_72%)] bg-[color-mix(in_srgb,var(--danger)_12%,var(--ui-surface-1)_88%)] text-[color-mix(in_srgb,var(--danger)_62%,var(--ui-ink-strong)_38%)]"};function M(d,a,n){return Math.min(Math.max(d,a),n)}function X(d){const a=d.detail.trim().length;return a>84?130:a>44?118:106}function Y(d,a,n){const v=a/2,p=n/2,b=M(Math.min(a/620,n/430),.64,1.06),s=d.map(i=>{const e=i.angle*Math.PI/180,o=i.radius*b,l=Math.min(184,Math.max(154,a-48)),c=X(i),x=v+Math.cos(e)*o,h=p+Math.sin(e)*o;return{...i,x,y:h,width:l,height:c,homeX:x,homeY:h}}),u=a<720?16:22,y=20,m=a-20,_=18,t=n-18;for(let i=0;i<220;i+=1){for(const e of s)e.x+=(e.homeX-e.x)*.065,e.y+=(e.homeY-e.y)*.065;for(let e=0;e<s.length;e+=1)for(let o=e+1;o<s.length;o+=1){const l=s[e],c=s[o],x=c.x-l.x,h=c.y-l.y,k=l.width/2+c.width/2+u-Math.abs(x),N=l.height/2+c.height/2+u-Math.abs(h);if(k<=0||N<=0)continue;const j=k<N?"x":"y",f=Math.sign(j==="x"?x||o-e||1:h||o-e||1),g=(j==="x"?k:N)/2;j==="x"?(l.x-=f*g,c.x+=f*g):(l.y-=f*g,c.y+=f*g)}for(const e of s)e.x=M(e.x,y+e.width/2,m-e.width/2),e.y=M(e.y,_+e.height/2,t-e.height/2)}return s}function A({title:d,description:a,centerLabel:n,centerValue:v,nodes:p,action:b}){const s=w.useRef(null),[u,y]=w.useState({width:0,height:0});w.useEffect(()=>{if(!s.current||typeof ResizeObserver>"u")return;const t=new ResizeObserver(i=>{const e=i[0];y({width:e.contentRect.width,height:e.contentRect.height})});return t.observe(s.current),()=>t.disconnect()},[]);const m=p.length>0?p:[{id:"values",label:"Values",title:"Add value",detail:"Name what matters",href:"/psyche/values?create=1",angle:-86,radius:112,tone:"mint"},{id:"patterns",label:"Patterns",title:"Add pattern",detail:"Map a loop",href:"/psyche/patterns?create=1",angle:-14,radius:122,tone:"rose"},{id:"beliefs",label:"Beliefs",title:"Add belief",detail:"Capture a script",href:"/psyche/schemas-beliefs?create=1",angle:72,radius:118,tone:"violet"},{id:"reports",label:"Reports",title:"Reflect",detail:"Open the chain",href:"/psyche/reports?create=1",angle:160,radius:124,tone:"sky"}],_=w.useMemo(()=>Y(m,Math.max(u.width,320),Math.max(u.height,320)),[m,u.height,u.width]);return r.jsxs("section",{className:"overflow-hidden rounded-[32px] border border-[var(--ui-border-subtle)] bg-[radial-gradient(circle_at_top,color-mix(in_srgb,var(--success)_12%,transparent),transparent_42%),var(--ui-surface-section)] px-4 py-4 shadow-[var(--card-shadow)] lg:px-5",children:[r.jsxs("div",{className:"mb-4 flex flex-wrap items-end justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--success)]",children:"Reflective map"}),r.jsx("h2",{className:"mt-2 break-words font-display text-[clamp(1.35rem,2.3vw,2rem)] leading-none text-[var(--ui-ink-strong)]",children:d}),r.jsx("p",{className:"mt-2 max-w-2xl break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:a})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("div",{className:"inline-flex min-w-0 items-center gap-3 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-2",children:[r.jsx("span",{className:"text-xs uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:n}),r.jsx("span",{className:"min-w-0 break-words text-sm font-medium text-[var(--ui-ink-strong)]",children:v})]}),b?r.jsx("div",{className:"shrink-0",children:b}):null]})]}),r.jsx("div",{className:"grid gap-3 md:hidden",children:m.map(t=>r.jsxs(R,{to:t.href,className:O("block min-w-0 rounded-[20px] border px-4 py-3 shadow-[var(--ui-shadow-soft)] transition hover:bg-[var(--ui-surface-hover)]",z[t.tone??"mint"]),children:[r.jsx("div",{className:"break-words text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:t.label}),r.jsx("div",{className:"mt-1.5 break-words font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:t.title}),r.jsx("div",{className:"mt-1.5 break-words text-sm leading-5 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:t.detail})]},t.id))}),r.jsxs("div",{ref:s,className:"relative hidden min-h-[20rem] overflow-hidden rounded-[30px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] md:block lg:min-h-[22rem]",children:[r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_center,color-mix(in_srgb,var(--success)_8%,transparent),transparent_32%),var(--ui-surface-section)]"}),[112,168,224].map(t=>r.jsx("div",{className:"absolute left-1/2 top-1/2 rounded-full border border-[var(--ui-border-subtle)]",style:{width:`${t*2}px`,height:`${t*2}px`,transform:"translate(-50%, -50%)"}},t)),r.jsx("div",{className:"absolute inset-1/2 size-32 -translate-x-1/2 -translate-y-1/2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] shadow-[var(--card-shadow)]",children:r.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:n}),r.jsx("div",{className:"mt-2 font-display text-2xl text-[var(--ui-ink-strong)]",children:v})]})}),_.map((t,i)=>r.jsx(B.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},transition:{duration:.35,delay:i*.05,ease:"easeOut"},className:"absolute w-[min(11.5rem,calc(100vw-4rem))] max-w-[11.5rem] -translate-x-1/2 -translate-y-1/2",style:{left:`${t.x}px`,top:`${t.y}px`},whileHover:{y:-6,scale:1.03},children:r.jsxs(R,{to:t.href,className:O("block min-w-0 rounded-[22px] border px-3.5 py-3 shadow-[var(--ui-shadow-soft)] backdrop-blur-sm transition hover:-translate-y-0.5 hover:bg-[var(--ui-surface-hover)]",z[t.tone??"mint"]),children:[r.jsx("div",{className:"break-words text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:t.label}),r.jsx("div",{className:"mt-1.5 break-words font-medium text-[var(--ui-ink-strong)] [overflow-wrap:anywhere]",children:t.title}),r.jsx("div",{className:"mt-1.5 break-words text-sm leading-5 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:t.detail})]})},t.id))]})]})}export{A as O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as E,j as e,aC as S}from"./vendor-Dnkkx2co.js";import{A as U}from"./ai-surface-workspace-BCbQUekv.js";import{i as $}from"./state-vCcAT5Hq.js";import{P as B,u as Q,bE as z,h as R,d as L,bF as D,c as p,aq as G,Z as J,C as M,b as Y,V as Z,W as ee,_ as te,bG as ie,bH as se,bI as ae,bJ as re,bK as ne,bL as le,bM as oe,be as de,bN as ce}from"./index-BP9__l6C.js";import{F as ue}from"./flagship-signal-deck-B9k46sWA.js";import{L as me}from"./life-force-workspace-Ct70SsNQ.js";import{E as pe}from"./entity-note-count-link-DUxobQUt.js";import{P as fe}from"./page-hero-DgnhI5es.js";import{a as ve,g as xe}from"./activity-copy-Bj4h9OcF.js";import"./board-dIX6etHh.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./graph-DDUZNRsO.js";import"./floating-action-menu-DBzfnJOx.js";import"./charts-DFnEuIMB.js";const f={"Life Force":"Life Force compares today's spent Action Points with the modeled daily budget. It is Forge's local capacity planning layer, not a medical score.",Momentum:"Momentum summarizes recent execution, XP, streak context, and movement across Forge records. Use it as an attention signal.",Instant:"Instant AP/hour estimates current headroom from the Life Force drain model. Higher values mean Forge thinks the next block can absorb more effort.",Level:"Level comes from the XP ledger. It represents accumulated meaningful Forge activity for the selected user scope.","Weekly XP":"Weekly XP is recent reward-ledger movement. It helps separate a genuinely active week from old accumulated progress."};function he(a){const n=["gamification","summary","pipeline","body-signals","signals"],t=[...a.order];let r=!1;for(const v of n)t.includes(v)||(t.push(v),r=!0);const j=t.indexOf("summary"),c=t.indexOf("pipeline"),x=t.indexOf("body-signals"),g=t.indexOf("signals");if(j===-1||c===-1||x===-1||g===-1)return r?{...a,order:t}:a;if(j<c&&c<x&&x<g&&!r)return a;for(const v of n){const y=t.indexOf(v);y!==-1&&t.splice(y,1)}const b=t.indexOf("goals");return t.splice(b===-1?0:b,0,...n),{...a,order:t}}function ge(a=new Date){const n=a.getFullYear(),t=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${n}-${t}-${r}`}function P(a){if(a>=3600){const n=a/3600;return n>=10||Number.isInteger(n)?`${Math.round(n)}h`:`${n.toFixed(1)}h`}return`${Math.max(1,Math.round(a/60))}m`}function be(a){return a>=1e3?`${(a/1e3).toFixed(1)} km`:`${Math.round(a)} m`}function ye(a){if(!a)return[];const n=new Map;for(const t of a.segments){if(t.kind!=="stay"||t.durationSeconds<=0)continue;const r=t.label.trim()||"Unlabeled stay";n.set(r,(n.get(r)??0)+t.durationSeconds)}return[...n.entries()].map(([t,r])=>({label:t,seconds:r})).sort((t,r)=>r.seconds-t.seconds).slice(0,3)}function ke(a){return a?["restingHeartRate","heartRateVariabilitySDNN","vo2Max","oxygenSaturation"].map(t=>a.metrics.find(r=>r.metric===t)).filter(t=>!!t).slice(0,3):[]}function we(a){if(a.latestValue==null)return"No reading";const n=a.unit==="steps"||a.unit==="flights"||a.unit==="kcal"||a.unit==="min"?0:1;return`${a.latestValue.toLocaleString(void 0,{maximumFractionDigits:n,minimumFractionDigits:n===0||a.latestValue>=100?0:1})} ${a.unit}`}function Ee(){var X,C;const{t:a}=B(),n=Q(),t=n.snapshot,r=Array.isArray(n.selectedUserIds)?n.selectedUserIds:[],j=r.join("|"),[c,x]=E.useState(!1);E.useEffect(()=>{x(!1);const i=window.setTimeout(()=>{x(!0)},650);return()=>window.clearTimeout(i)},[j]);const g=ge(),b=$({queryKey:["forge-overview-sleep",...r],queryFn:async()=>(await le(r)).sleep,enabled:c,staleTime:6e4})??{},v=$({queryKey:["forge-overview-fitness",...r],queryFn:async()=>(await oe(r)).fitness,enabled:c,staleTime:6e4})??{},y=$({queryKey:["forge-overview-movement-day",g,...r],queryFn:async()=>(await de({date:g,userIds:r})).movement,enabled:c,staleTime:6e4})??{},H=$({queryKey:["forge-overview-vitals",...r],queryFn:async()=>(await ce(r)).vitals,enabled:c,staleTime:6e4})??{},I=z(r,{skip:!c}),u=t.dashboard.milestoneRewards.find(i=>!i.completed)??t.dashboard.milestoneRewards[0]??null,o=t.overview.topTasks[0]??null,d=t.overview.dueHabits[0]??null,m=t.overview.recentEvidence[0]??null,V=new Map(t.projects.map(i=>[i.id,i])),N=t.metrics.momentumScore>=80?"Strong":t.metrics.momentumScore>=60?"Steady":"Needs attention",k=((X=b.data)==null?void 0:X.summary)??null,h=((C=v.data)==null?void 0:C.summary)??null,l=y.data,F=H.data??null,A=ke(F??void 0),O=ye(l),T=k!==null||h!==null||F!==null,W=l!==void 0&&(l.summary.tripCount>0||l.summary.stayCount>0||l.summary.totalMovingSeconds>0||O.length>0),K=t.lifeForce?[{label:"Life Force",value:`${Math.round(t.lifeForce.spentTodayAp)} / ${Math.round(t.lifeForce.dailyBudgetAp)} AP`,detail:`Remaining ${R(t.lifeForce.remainingAp)}`,help:f["Life Force"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${N} · ${t.metrics.streakDays} day streak`,help:f.Momentum},{label:"Instant",value:L(t.lifeForce.instantFreeApPerHour),detail:t.lifeForce.overloadApPerHour>0?`${L(t.lifeForce.overloadApPerHour)} overload`:"Headroom right now",help:f.Instant},{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:f.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:f["Weekly XP"]}]:[{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:f.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:f["Weekly XP"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${N} · ${t.metrics.streakDays} day streak`,help:f.Momentum}];function _(i){return i.entityType==="goal"?`/goals/${i.entityId}`:i.entityType==="project"?`/projects/${i.entityId}`:i.entityType==="task"?`/tasks/${i.entityId}`:i.entityType==="habit"?"/habits":i.entityType==="task_run"&&typeof i.metadata.taskId=="string"?`/tasks/${i.metadata.taskId}`:`/activity?eventId=${i.id}`}const q=[{id:"hero",title:"Overview",description:"The route header stays movable like any other surface block.",defaultWidth:12,defaultHeight:2,removable:!1,minHeight:2,maxHeight:3,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(fe,{title:"Overview",titleText:"Overview",description:`${N}. Life Force, momentum, XP, goals, active projects, and top tasks all start here.`,badge:`Momentum ${t.metrics.momentumScore}`})},{id:"gamification",title:"Forge Smith",description:"Selected-user level, XP, streak, trophy, and unlock state.",defaultWidth:12,defaultHeight:4,removable:!1,minHeight:3,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:({compact:i})=>{var s;return I.data?e.jsx(D,{metrics:I.data.metrics,compact:i}):e.jsx(D,{metrics:{scope:{mode:"operator_fallback",userIds:t.userScope.selectedUserIds,users:t.userScope.selectedUsers,label:((s=t.userScope.selectedUsers[0])==null?void 0:s.displayName)??"Forge"},profile:t.metrics,achievements:[],milestoneRewards:[],momentumPulse:{status:t.metrics.momentumScore>=80?"surging":t.metrics.momentumScore>=60?"steady":"recovering",headline:`${t.metrics.streakDays}-day streak`,detail:`${t.metrics.currentLevelXp}/${t.metrics.nextLevelXp} XP in level ${t.metrics.level}.`,celebrationLabel:"Forge Smith",nextMilestoneId:null,nextMilestoneLabel:"Next unlock"},catalogPreview:[],unlockedItemCount:0,totalItemCount:144,nextUnlock:null,newestUnlock:null,nextTargets:[],equipment:{selectedMascotSkin:null,selectedHudTreatment:null,selectedStreakEffect:null,selectedTrophyShelf:null,selectedCelebrationVariant:null,updatedAt:null},mascot:{mood:"wise",spriteKey:"mascot-state-014",streakSpriteKey:"mascot-state-017",headline:"Small heat still counts.",line:"Return to the anvil today.",pressureLevel:0,missedDays:0,lastActiveDateKey:null},celebrations:[],recentLedger:[],rules:[],dailyAmbientXp:0,dailyAmbientCap:12},compact:i})}},{id:"summary",title:"Momentum summary",description:"Smaller titles and denser metrics free space for the widgets themselves.",defaultWidth:12,defaultHeight:3,minWidth:6,render:({compact:i})=>e.jsxs("div",{className:"rounded-[24px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Momentum summary"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:"Core live metrics"}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Life Force, momentum, XP, and instant headroom stay grouped here."})]}),e.jsx(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:N})]}),e.jsx("div",{className:J("mt-4 grid gap-3",i?"grid-cols-2":"sm:grid-cols-2 xl:grid-cols-5"),children:K.map(s=>e.jsxs("div",{className:"rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[e.jsx("span",{children:s.label}),e.jsx(G,{label:`Explain ${s.label}`,title:s.label,content:s.help,panelClassName:"normal-case tracking-normal"})]}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-[var(--ui-ink-strong)]",children:s.value}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-faint)]",children:s.detail})]},s.label))})]})},{id:"life-force",title:"Life Force",description:"Dynamic Action Points, the editable capacity curve, current drains, and stat growth all live here.",defaultWidth:12,defaultHeight:7,minWidth:6,render:()=>t.lifeForce?e.jsx(me,{selectedUserIds:r,fallbackLifeForce:t.lifeForce,onRefresh:n.refresh,showEditor:!1}):e.jsx(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Life Force is not configured for this user yet. Once a profile exists, the full capacity curve, drains, and recommendations will appear here."})},{id:"body-signals",title:"Life, health, movement",description:"Health imports and movement context make the overview feel like a real daily operating page.",defaultWidth:12,defaultHeight:4,minWidth:6,render:()=>e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-3",children:[e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Life Force"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:t.lifeForce?`${Math.round(t.lifeForce.remainingAp)} AP remaining`:"No Life Force profile yet"})]}),t.lifeForce?e.jsx(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:L(t.lifeForce.instantFreeApPerHour)}):null]}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:t.lifeForce?`${Math.round(t.lifeForce.spentTodayAp)} / ${Math.round(t.lifeForce.dailyBudgetAp)} AP spent today. Remaining ${R(t.lifeForce.remainingAp)} with ${L(t.lifeForce.currentDrainApPerHour)} current drain.`:"Once Life Force is configured, this block will show today's budget, remaining headroom, and live drain."})]}),e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Body signals"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:T?"Recovery, training, and vitals":"No health data yet"})]}),F?e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[F.summary.metricCount," metrics"]}):null]}),b.isLoading||v.isLoading||H.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Loading recent sleep, workout, and body-signal metrics…"}):T?e.jsxs("div",{className:"mt-3 grid gap-2 text-sm text-[var(--ui-ink-soft)]",children:[k?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Average sleep"}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:P(k.averageSleepSeconds)})]}):null,k?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Sleep score"}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:Math.round(k.averageSleepScore)})]}):null,h?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Exercise"}),e.jsxs("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:[Math.round(h.exerciseMinutes)," min"]})]}):null,h?e.jsx("div",{className:"text-xs leading-5 text-[var(--ui-ink-faint)]",children:h.topWorkoutType?`${h.topWorkoutType} is the top workout type right now.`:"Workout imports are available when Apple Health or habit-generated sessions exist."}):null,A.length>0?e.jsx("div",{className:"mt-1 grid gap-2",children:A.map(i=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-2",children:[e.jsx("span",{children:i.label}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:we(i)})]},i.metric))}):null]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Sleep, workout, and vitals summaries appear here as soon as Forge has recent HealthKit records."})]}),e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Movement"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:W?"Today's place balance":"No movement timeline yet"})]}),W?e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[P((l==null?void 0:l.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),y.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Loading today's stays, trips, and place balance…"}):W?e.jsxs("div",{className:"mt-3 grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[O.map(i=>e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[P(i.seconds)," at ",i.label]},i.label)),((l==null?void 0:l.summary.totalMovingSeconds)??0)>0?e.jsxs(p,{className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[P((l==null?void 0:l.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),e.jsxs("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:[(l==null?void 0:l.summary.tripCount)??0," trip",((l==null?void 0:l.summary.tripCount)??0)===1?"":"s"," and"," ",be((l==null?void 0:l.summary.totalDistanceMeters)??0)," ","tracked today."]})]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Movement summaries appear here once the companion has synced stays, trips, or known places."})]})]})},{id:"signals",title:"Action signals",description:"Direct links to the next things worth opening.",defaultWidth:7,defaultHeight:4,minWidth:4,render:()=>e.jsx(ue,{eyebrow:"Actions",title:"Open what matters now",description:"These cards stay compact by default so the page can fit more live context at once.",items:[{id:"top-task",label:o?"Top task":d?"Due habit":"Recovery lane",title:(o==null?void 0:o.title)??(d==null?void 0:d.title)??"Get a real task moving",detail:(o==null?void 0:o.description)||(d==null?void 0:d.description)||"There is no single top task yet, so use this surface to choose one clean next move.",badge:o?`${o.points} xp`:d?`${d.rewardXp} xp`:`${t.metrics.weeklyXp} weekly xp`,href:o?`/tasks/${o.id}`:d?"/habits":"/today",actionLabel:o?"Open task":d?"Open habits":"Open today"},{id:"reward",label:"Next reward",title:(u==null?void 0:u.title)??"Keep the streak alive",detail:(u==null?void 0:u.progressLabel)??`Level ${t.metrics.level} is active. ${t.metrics.weeklyXp} weekly XP is already logged.`,badge:(u==null?void 0:u.rewardLabel)??`${t.metrics.comboMultiplier.toFixed(2)}x combo`,href:"/rewards",actionLabel:"Open rewards"},{id:"recent-activity",label:"Recent activity",title:m?xe(m):"No recent evidence",detail:m?ve(m):"The next work closeout or note will appear here.",badge:(m==null?void 0:m.source)??"activity",href:m?_(m):"/activity",actionLabel:"Open"}]})},{id:"goals",title:"Goals",description:"Long-range direction stays visible without taking over the whole page.",defaultWidth:8,defaultHeight:5,minWidth:4,render:({compact:i})=>e.jsx("div",{className:"grid gap-3",children:t.overview.activeGoals.slice(0,i?2:4).map(s=>{var w;return e.jsxs("div",{className:"group relative rounded-[20px] bg-[var(--ui-surface-1)] p-4 transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsx(S,{to:`/goals/${s.id}`,className:"absolute inset-0 rounded-[20px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--primary)]","aria-label":`Open goal ${s.title}`}),e.jsxs("div",{className:"pointer-events-none relative z-10",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsx(Y,{kind:"goal",label:((w=s.tags[0])==null?void 0:w.name)??s.horizon,compact:!0,gradient:!1}),e.jsxs("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[s.progress,"%"]})]}),e.jsx("div",{className:"mt-3",children:e.jsx(Z,{kind:"goal",label:s.title,variant:"heading",size:i?"md":"lg",lines:2,className:"max-w-full",labelClassName:"[overflow-wrap:anywhere]"})}),i?null:e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:s.description}),e.jsx("div",{className:"mt-3",children:e.jsx(ee,{value:s.progress})})]}),e.jsx("div",{className:"relative z-20 mt-3",children:e.jsx(pe,{entityType:"goal",entityId:s.id,count:te(t.dashboard.notesSummaryByEntity,"goal",s.id).count})})]},s.id)})})},{id:"pipeline",title:"Projects, habits, tasks",description:"Execution blocks can shrink while keeping the useful subtitles visible.",defaultWidth:12,defaultHeight:5,minWidth:6,render:({compact:i})=>e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-3",children:[e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Projects"}),t.overview.projects.slice(0,i?3:4).map(s=>{var w;return e.jsxs(S,{to:`/projects/${s.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:((w=V.get(s.id))==null?void 0:w.status)??"active"})]}),e.jsxs(p,{wrap:!0,className:"max-w-[7rem] shrink-0",children:[s.earnedPoints," xp"]})]}),i?null:e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:s.description})]},s.id)})]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Due habits"}),t.overview.dueHabits.slice(0,i?3:4).map(s=>e.jsx(S,{to:"/habits","aria-label":`Open habit ${s.title}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:s.title}),i?null:e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:s.description})]}),e.jsxs(p,{wrap:!0,className:"max-w-[7rem] shrink-0 bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[s.rewardXp," xp"]})]})},s.id))]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Top tasks"}),t.overview.topTasks.slice(0,i?3:4).map(s=>e.jsx(S,{to:`/tasks/${s.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:s.status.replaceAll("_"," ")})]}),e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[s.points," xp"]})]})},s.id))]})]})},{id:"time",title:"Clock",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(ie,{compact:i})},{id:"weather",title:"Weather",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(se,{compact:i})},{id:"mini-calendar",title:"Mini calendar",description:"Optional utility widget.",defaultWidth:4,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>e.jsx(ae,{compact:i})},{id:"spotify",title:"Spotify",description:"Optional utility widget.",defaultWidth:4,defaultHeight:2,defaultHidden:!0,render:()=>e.jsx(re,{surfaceId:"overview"})},{id:"quick-capture",title:"Quick capture",description:"Save a standalone note or wiki draft from any dashboard.",defaultWidth:5,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>{var s;return e.jsx(ne,{compact:i,defaultUserId:r[0]??((s=t.users[0])==null?void 0:s.id)??null})}}];return e.jsx(U,{surfaceId:"overview",baseWidgets:q,normalizeLayout:he})}export{Ee as OverviewPage};
|
|
1
|
+
import{r as E,j as e,aC as S}from"./vendor-Dnkkx2co.js";import{A as U}from"./ai-surface-workspace-B_fV9C4s.js";import{i as $}from"./state-vCcAT5Hq.js";import{P as B,u as Q,bE as z,h as R,d as L,bF as D,c as p,aq as G,Z as J,C as M,b as Y,V as Z,W as ee,_ as te,bG as ie,bH as se,bI as ae,bJ as re,bK as ne,bL as le,bM as oe,be as de,bN as ce}from"./index-By3tQxiE.js";import{F as ue}from"./flagship-signal-deck-bolzzK8q.js";import{L as me}from"./life-force-workspace-BhPNH7ad.js";import{E as pe}from"./entity-note-count-link-BX93WYgh.js";import{P as fe}from"./page-hero-5RTqAI88.js";import{a as ve,g as xe}from"./activity-copy-Bj4h9OcF.js";import"./board-dIX6etHh.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./graph-DDUZNRsO.js";import"./floating-action-menu-C5H-Wr2B.js";import"./charts-DFnEuIMB.js";const f={"Life Force":"Life Force compares today's spent Action Points with the modeled daily budget. It is Forge's local capacity planning layer, not a medical score.",Momentum:"Momentum summarizes recent execution, XP, streak context, and movement across Forge records. Use it as an attention signal.",Instant:"Instant AP/hour estimates current headroom from the Life Force drain model. Higher values mean Forge thinks the next block can absorb more effort.",Level:"Level comes from the XP ledger. It represents accumulated meaningful Forge activity for the selected user scope.","Weekly XP":"Weekly XP is recent reward-ledger movement. It helps separate a genuinely active week from old accumulated progress."};function he(a){const n=["gamification","summary","pipeline","body-signals","signals"],t=[...a.order];let r=!1;for(const v of n)t.includes(v)||(t.push(v),r=!0);const j=t.indexOf("summary"),c=t.indexOf("pipeline"),x=t.indexOf("body-signals"),g=t.indexOf("signals");if(j===-1||c===-1||x===-1||g===-1)return r?{...a,order:t}:a;if(j<c&&c<x&&x<g&&!r)return a;for(const v of n){const y=t.indexOf(v);y!==-1&&t.splice(y,1)}const b=t.indexOf("goals");return t.splice(b===-1?0:b,0,...n),{...a,order:t}}function ge(a=new Date){const n=a.getFullYear(),t=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${n}-${t}-${r}`}function P(a){if(a>=3600){const n=a/3600;return n>=10||Number.isInteger(n)?`${Math.round(n)}h`:`${n.toFixed(1)}h`}return`${Math.max(1,Math.round(a/60))}m`}function be(a){return a>=1e3?`${(a/1e3).toFixed(1)} km`:`${Math.round(a)} m`}function ye(a){if(!a)return[];const n=new Map;for(const t of a.segments){if(t.kind!=="stay"||t.durationSeconds<=0)continue;const r=t.label.trim()||"Unlabeled stay";n.set(r,(n.get(r)??0)+t.durationSeconds)}return[...n.entries()].map(([t,r])=>({label:t,seconds:r})).sort((t,r)=>r.seconds-t.seconds).slice(0,3)}function ke(a){return a?["restingHeartRate","heartRateVariabilitySDNN","vo2Max","oxygenSaturation"].map(t=>a.metrics.find(r=>r.metric===t)).filter(t=>!!t).slice(0,3):[]}function we(a){if(a.latestValue==null)return"No reading";const n=a.unit==="steps"||a.unit==="flights"||a.unit==="kcal"||a.unit==="min"?0:1;return`${a.latestValue.toLocaleString(void 0,{maximumFractionDigits:n,minimumFractionDigits:n===0||a.latestValue>=100?0:1})} ${a.unit}`}function Ee(){var X,C;const{t:a}=B(),n=Q(),t=n.snapshot,r=Array.isArray(n.selectedUserIds)?n.selectedUserIds:[],j=r.join("|"),[c,x]=E.useState(!1);E.useEffect(()=>{x(!1);const i=window.setTimeout(()=>{x(!0)},650);return()=>window.clearTimeout(i)},[j]);const g=ge(),b=$({queryKey:["forge-overview-sleep",...r],queryFn:async()=>(await le(r)).sleep,enabled:c,staleTime:6e4})??{},v=$({queryKey:["forge-overview-fitness",...r],queryFn:async()=>(await oe(r)).fitness,enabled:c,staleTime:6e4})??{},y=$({queryKey:["forge-overview-movement-day",g,...r],queryFn:async()=>(await de({date:g,userIds:r})).movement,enabled:c,staleTime:6e4})??{},H=$({queryKey:["forge-overview-vitals",...r],queryFn:async()=>(await ce(r)).vitals,enabled:c,staleTime:6e4})??{},I=z(r,{skip:!c}),u=t.dashboard.milestoneRewards.find(i=>!i.completed)??t.dashboard.milestoneRewards[0]??null,o=t.overview.topTasks[0]??null,d=t.overview.dueHabits[0]??null,m=t.overview.recentEvidence[0]??null,V=new Map(t.projects.map(i=>[i.id,i])),N=t.metrics.momentumScore>=80?"Strong":t.metrics.momentumScore>=60?"Steady":"Needs attention",k=((X=b.data)==null?void 0:X.summary)??null,h=((C=v.data)==null?void 0:C.summary)??null,l=y.data,F=H.data??null,A=ke(F??void 0),O=ye(l),T=k!==null||h!==null||F!==null,W=l!==void 0&&(l.summary.tripCount>0||l.summary.stayCount>0||l.summary.totalMovingSeconds>0||O.length>0),K=t.lifeForce?[{label:"Life Force",value:`${Math.round(t.lifeForce.spentTodayAp)} / ${Math.round(t.lifeForce.dailyBudgetAp)} AP`,detail:`Remaining ${R(t.lifeForce.remainingAp)}`,help:f["Life Force"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${N} · ${t.metrics.streakDays} day streak`,help:f.Momentum},{label:"Instant",value:L(t.lifeForce.instantFreeApPerHour),detail:t.lifeForce.overloadApPerHour>0?`${L(t.lifeForce.overloadApPerHour)} overload`:"Headroom right now",help:f.Instant},{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:f.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:f["Weekly XP"]}]:[{label:"Level",value:`L${t.metrics.level}`,detail:`${t.metrics.currentLevelXp} XP in level`,help:f.Level},{label:"Weekly XP",value:`${t.metrics.weeklyXp}`,detail:`${t.metrics.totalXp} total XP`,help:f["Weekly XP"]},{label:"Momentum",value:`${t.metrics.momentumScore}`,detail:`${N} · ${t.metrics.streakDays} day streak`,help:f.Momentum}];function _(i){return i.entityType==="goal"?`/goals/${i.entityId}`:i.entityType==="project"?`/projects/${i.entityId}`:i.entityType==="task"?`/tasks/${i.entityId}`:i.entityType==="habit"?"/habits":i.entityType==="task_run"&&typeof i.metadata.taskId=="string"?`/tasks/${i.metadata.taskId}`:`/activity?eventId=${i.id}`}const q=[{id:"hero",title:"Overview",description:"The route header stays movable like any other surface block.",defaultWidth:12,defaultHeight:2,removable:!1,minHeight:2,maxHeight:3,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(fe,{title:"Overview",titleText:"Overview",description:`${N}. Life Force, momentum, XP, goals, active projects, and top tasks all start here.`,badge:`Momentum ${t.metrics.momentumScore}`})},{id:"gamification",title:"Forge Smith",description:"Selected-user level, XP, streak, trophy, and unlock state.",defaultWidth:12,defaultHeight:4,removable:!1,minHeight:3,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:({compact:i})=>{var s;return I.data?e.jsx(D,{metrics:I.data.metrics,compact:i}):e.jsx(D,{metrics:{scope:{mode:"operator_fallback",userIds:t.userScope.selectedUserIds,users:t.userScope.selectedUsers,label:((s=t.userScope.selectedUsers[0])==null?void 0:s.displayName)??"Forge"},profile:t.metrics,achievements:[],milestoneRewards:[],momentumPulse:{status:t.metrics.momentumScore>=80?"surging":t.metrics.momentumScore>=60?"steady":"recovering",headline:`${t.metrics.streakDays}-day streak`,detail:`${t.metrics.currentLevelXp}/${t.metrics.nextLevelXp} XP in level ${t.metrics.level}.`,celebrationLabel:"Forge Smith",nextMilestoneId:null,nextMilestoneLabel:"Next unlock"},catalogPreview:[],unlockedItemCount:0,totalItemCount:144,nextUnlock:null,newestUnlock:null,nextTargets:[],equipment:{selectedMascotSkin:null,selectedHudTreatment:null,selectedStreakEffect:null,selectedTrophyShelf:null,selectedCelebrationVariant:null,updatedAt:null},mascot:{mood:"wise",spriteKey:"mascot-state-014",streakSpriteKey:"mascot-state-017",headline:"Small heat still counts.",line:"Return to the anvil today.",pressureLevel:0,missedDays:0,lastActiveDateKey:null},celebrations:[],recentLedger:[],rules:[],dailyAmbientXp:0,dailyAmbientCap:12},compact:i})}},{id:"summary",title:"Momentum summary",description:"Smaller titles and denser metrics free space for the widgets themselves.",defaultWidth:12,defaultHeight:3,minWidth:6,render:({compact:i})=>e.jsxs("div",{className:"rounded-[24px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Momentum summary"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:"Core live metrics"}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Life Force, momentum, XP, and instant headroom stay grouped here."})]}),e.jsx(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:N})]}),e.jsx("div",{className:J("mt-4 grid gap-3",i?"grid-cols-2":"sm:grid-cols-2 xl:grid-cols-5"),children:K.map(s=>e.jsxs("div",{className:"rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[e.jsx("span",{children:s.label}),e.jsx(G,{label:`Explain ${s.label}`,title:s.label,content:s.help,panelClassName:"normal-case tracking-normal"})]}),e.jsx("div",{className:"mt-1 text-lg font-semibold text-[var(--ui-ink-strong)]",children:s.value}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-faint)]",children:s.detail})]},s.label))})]})},{id:"life-force",title:"Life Force",description:"Dynamic Action Points, the editable capacity curve, current drains, and stat growth all live here.",defaultWidth:12,defaultHeight:7,minWidth:6,render:()=>t.lifeForce?e.jsx(me,{selectedUserIds:r,fallbackLifeForce:t.lifeForce,onRefresh:n.refresh,showEditor:!1}):e.jsx(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Life Force is not configured for this user yet. Once a profile exists, the full capacity curve, drains, and recommendations will appear here."})},{id:"body-signals",title:"Life, health, movement",description:"Health imports and movement context make the overview feel like a real daily operating page.",defaultWidth:12,defaultHeight:4,minWidth:6,render:()=>e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-3",children:[e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Life Force"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:t.lifeForce?`${Math.round(t.lifeForce.remainingAp)} AP remaining`:"No Life Force profile yet"})]}),t.lifeForce?e.jsx(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:L(t.lifeForce.instantFreeApPerHour)}):null]}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:t.lifeForce?`${Math.round(t.lifeForce.spentTodayAp)} / ${Math.round(t.lifeForce.dailyBudgetAp)} AP spent today. Remaining ${R(t.lifeForce.remainingAp)} with ${L(t.lifeForce.currentDrainApPerHour)} current drain.`:"Once Life Force is configured, this block will show today's budget, remaining headroom, and live drain."})]}),e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Body signals"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:T?"Recovery, training, and vitals":"No health data yet"})]}),F?e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[F.summary.metricCount," metrics"]}):null]}),b.isLoading||v.isLoading||H.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Loading recent sleep, workout, and body-signal metrics…"}):T?e.jsxs("div",{className:"mt-3 grid gap-2 text-sm text-[var(--ui-ink-soft)]",children:[k?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Average sleep"}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:P(k.averageSleepSeconds)})]}):null,k?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Sleep score"}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:Math.round(k.averageSleepScore)})]}):null,h?e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("span",{children:"Exercise"}),e.jsxs("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:[Math.round(h.exerciseMinutes)," min"]})]}):null,h?e.jsx("div",{className:"text-xs leading-5 text-[var(--ui-ink-faint)]",children:h.topWorkoutType?`${h.topWorkoutType} is the top workout type right now.`:"Workout imports are available when Apple Health or habit-generated sessions exist."}):null,A.length>0?e.jsx("div",{className:"mt-1 grid gap-2",children:A.map(i=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-2",children:[e.jsx("span",{children:i.label}),e.jsx("span",{className:"font-medium text-[var(--ui-ink-strong)]",children:we(i)})]},i.metric))}):null]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Sleep, workout, and vitals summaries appear here as soon as Forge has recent HealthKit records."})]}),e.jsxs(M,{className:"rounded-[24px] border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Movement"}),e.jsx("div",{className:"mt-2 text-lg font-semibold text-[var(--ui-ink-strong)]",children:W?"Today's place balance":"No movement timeline yet"})]}),W?e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[P((l==null?void 0:l.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),y.isLoading?e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Loading today's stays, trips, and place balance…"}):W?e.jsxs("div",{className:"mt-3 grid gap-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[O.map(i=>e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[P(i.seconds)," at ",i.label]},i.label)),((l==null?void 0:l.summary.totalMovingSeconds)??0)>0?e.jsxs(p,{className:"bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[P((l==null?void 0:l.summary.totalMovingSeconds)??0)," ","moving"]}):null]}),e.jsxs("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:[(l==null?void 0:l.summary.tripCount)??0," trip",((l==null?void 0:l.summary.tripCount)??0)===1?"":"s"," and"," ",be((l==null?void 0:l.summary.totalDistanceMeters)??0)," ","tracked today."]})]}):e.jsx("div",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Movement summaries appear here once the companion has synced stays, trips, or known places."})]})]})},{id:"signals",title:"Action signals",description:"Direct links to the next things worth opening.",defaultWidth:7,defaultHeight:4,minWidth:4,render:()=>e.jsx(ue,{eyebrow:"Actions",title:"Open what matters now",description:"These cards stay compact by default so the page can fit more live context at once.",items:[{id:"top-task",label:o?"Top task":d?"Due habit":"Recovery lane",title:(o==null?void 0:o.title)??(d==null?void 0:d.title)??"Get a real task moving",detail:(o==null?void 0:o.description)||(d==null?void 0:d.description)||"There is no single top task yet, so use this surface to choose one clean next move.",badge:o?`${o.points} xp`:d?`${d.rewardXp} xp`:`${t.metrics.weeklyXp} weekly xp`,href:o?`/tasks/${o.id}`:d?"/habits":"/today",actionLabel:o?"Open task":d?"Open habits":"Open today"},{id:"reward",label:"Next reward",title:(u==null?void 0:u.title)??"Keep the streak alive",detail:(u==null?void 0:u.progressLabel)??`Level ${t.metrics.level} is active. ${t.metrics.weeklyXp} weekly XP is already logged.`,badge:(u==null?void 0:u.rewardLabel)??`${t.metrics.comboMultiplier.toFixed(2)}x combo`,href:"/rewards",actionLabel:"Open rewards"},{id:"recent-activity",label:"Recent activity",title:m?xe(m):"No recent evidence",detail:m?ve(m):"The next work closeout or note will appear here.",badge:(m==null?void 0:m.source)??"activity",href:m?_(m):"/activity",actionLabel:"Open"}]})},{id:"goals",title:"Goals",description:"Long-range direction stays visible without taking over the whole page.",defaultWidth:8,defaultHeight:5,minWidth:4,render:({compact:i})=>e.jsx("div",{className:"grid gap-3",children:t.overview.activeGoals.slice(0,i?2:4).map(s=>{var w;return e.jsxs("div",{className:"group relative rounded-[20px] bg-[var(--ui-surface-1)] p-4 transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsx(S,{to:`/goals/${s.id}`,className:"absolute inset-0 rounded-[20px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--primary)]","aria-label":`Open goal ${s.title}`}),e.jsxs("div",{className:"pointer-events-none relative z-10",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsx(Y,{kind:"goal",label:((w=s.tags[0])==null?void 0:w.name)??s.horizon,compact:!0,gradient:!1}),e.jsxs("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:[s.progress,"%"]})]}),e.jsx("div",{className:"mt-3",children:e.jsx(Z,{kind:"goal",label:s.title,variant:"heading",size:i?"md":"lg",lines:2,className:"max-w-full",labelClassName:"[overflow-wrap:anywhere]"})}),i?null:e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:s.description}),e.jsx("div",{className:"mt-3",children:e.jsx(ee,{value:s.progress})})]}),e.jsx("div",{className:"relative z-20 mt-3",children:e.jsx(pe,{entityType:"goal",entityId:s.id,count:te(t.dashboard.notesSummaryByEntity,"goal",s.id).count})})]},s.id)})})},{id:"pipeline",title:"Projects, habits, tasks",description:"Execution blocks can shrink while keeping the useful subtitles visible.",defaultWidth:12,defaultHeight:5,minWidth:6,render:({compact:i})=>e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-3",children:[e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Projects"}),t.overview.projects.slice(0,i?3:4).map(s=>{var w;return e.jsxs(S,{to:`/projects/${s.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:((w=V.get(s.id))==null?void 0:w.status)??"active"})]}),e.jsxs(p,{wrap:!0,className:"max-w-[7rem] shrink-0",children:[s.earnedPoints," xp"]})]}),i?null:e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:s.description})]},s.id)})]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Due habits"}),t.overview.dueHabits.slice(0,i?3:4).map(s=>e.jsx(S,{to:"/habits","aria-label":`Open habit ${s.title}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:s.title}),i?null:e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:s.description})]}),e.jsxs(p,{wrap:!0,className:"max-w-[7rem] shrink-0 bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]",children:[s.rewardXp," xp"]})]})},s.id))]}),e.jsxs("div",{className:"grid min-w-0 gap-3",children:[e.jsx("div",{className:"text-[12px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Top tasks"}),t.overview.topTasks.slice(0,i?3:4).map(s=>e.jsx(S,{to:`/tasks/${s.id}`,className:"block min-w-0 max-w-full rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-hover)]",children:e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-[var(--ui-ink-strong)]",children:s.title}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:s.status.replaceAll("_"," ")})]}),e.jsxs(p,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[s.points," xp"]})]})},s.id))]})]})},{id:"time",title:"Clock",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(ie,{compact:i})},{id:"weather",title:"Weather",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(se,{compact:i})},{id:"mini-calendar",title:"Mini calendar",description:"Optional utility widget.",defaultWidth:4,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>e.jsx(ae,{compact:i})},{id:"spotify",title:"Spotify",description:"Optional utility widget.",defaultWidth:4,defaultHeight:2,defaultHidden:!0,render:()=>e.jsx(re,{surfaceId:"overview"})},{id:"quick-capture",title:"Quick capture",description:"Save a standalone note or wiki draft from any dashboard.",defaultWidth:5,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>{var s;return e.jsx(ne,{compact:i,defaultUserId:r[0]??((s=t.users[0])==null?void 0:s.id)??null})}}];return e.jsx(U,{surfaceId:"overview",baseWidgets:q,normalizeLayout:he})}export{Ee as OverviewPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-Dnkkx2co.js";import{aS as h,Z as v,c as y,aq as j}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-Dnkkx2co.js";import{aS as h,Z as v,c as y,aq as j}from"./index-By3tQxiE.js";function u(r){return r.trim().toLowerCase().replace(/[^a-z0-9]+/g," ")}function N({eyebrow:r,titleText:t,entityKind:n,copyMode:i}){if(!r||i==="title_only"||typeof r!="string")return null;const l=u(r),s=t?u(t):null,o=n?u(h(n).label):null;return!l||s&&(l===s||s.includes(l)||l.includes(s))||o&&l===o?null:r}function E({eyebrow:r,entityKind:t,title:n,titleText:i,description:l,helpTitle:s,helpContent:o,helpLabel:b,badge:m,actions:p,copyMode:w="title_only"}){const a=t?h(t):null,d=a==null?void 0:a.icon,c=N({eyebrow:r,titleText:i,entityKind:t,copyMode:w}),x=i??(typeof n=="string"?n:"this page"),g=o??(typeof l=="string"?l:null),f=!!(a||c||m);return e.jsxs("header",{className:"relative min-w-0 w-full max-w-full overflow-visible border-b border-[var(--ui-border-subtle)] px-5 py-5 sm:px-6 lg:grid lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end lg:px-7 lg:py-6",style:{background:"var(--hero-gradient)",paddingTop:"var(--forge-shell-hero-padding-top)",paddingBottom:"var(--forge-shell-hero-padding-bottom)"},children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(circle at top right, color-mix(in srgb, var(--forge-body-ambient-primary) 94%, transparent), transparent 34%)"}}),e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-px bg-[var(--ui-border-strong)]"}),e.jsxs("div",{className:"relative min-w-0 w-full max-w-full",children:[f?e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 text-[11px] font-medium uppercase tracking-[0.2em] text-[var(--ui-ink-faint)]",children:[a&&d?e.jsxs("span",{className:"inline-flex items-center gap-2 text-[var(--ui-ink-soft)]","aria-label":a.label,title:a.label,children:[e.jsx(d,{className:v("size-3.5",a.iconClassName)}),e.jsx("span",{children:a.label})]}):null,c?e.jsx("span",{className:"text-[var(--secondary)]/80",children:c}):null,m?e.jsx(y,{tone:"signal",className:"h-8 overflow-visible rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-[11px] font-medium tracking-[0.14em] text-[var(--ui-ink-medium)] uppercase",children:m}):null]}):null,e.jsxs("div",{className:v("flex min-w-0 max-w-4xl items-start gap-2",f?"mt-3":""),children:[e.jsx("div",{className:"min-w-0 text-[clamp(1.85rem,3.5vw,4rem)] font-medium leading-[0.92] text-[var(--ui-ink-strong)]",style:{transform:"translateY(var(--forge-shell-hero-title-translate-y)) scale(var(--forge-shell-hero-title-scale))",transformOrigin:"top left",willChange:"transform"},children:n}),g?e.jsx(j,{className:"mt-2 shrink-0",label:b??`Explain what the ${x} page shows and how to interpret it`,title:s??`${x} explained`,content:g}):null]}),e.jsx("div",{className:"mt-2 min-w-0 max-w-3xl text-[14px] leading-6 text-[var(--ui-ink-soft)] sm:text-[15px]",style:{opacity:"var(--forge-shell-hero-description-opacity)",transform:"translateY(var(--forge-shell-hero-description-translate-y))",willChange:"opacity, transform"},children:l})]}),p?e.jsx("div",{className:"relative mt-4 flex min-w-0 w-full max-w-full flex-wrap items-center gap-2 lg:mt-0 lg:max-w-[26rem] lg:justify-end",children:p}):null]})}export{E as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./vendor-Dnkkx2co.js";import{Z as a}from"./index-
|
|
1
|
+
import{j as t}from"./vendor-Dnkkx2co.js";import{Z as a}from"./index-By3tQxiE.js";function i({children:r,className:s}){return t.jsx("div",{className:a("flex flex-wrap gap-2",s),children:r})}export{i as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b5 as p,j as s,b0 as l}from"./vendor-Dnkkx2co.js";import{j as g,k as y}from"./state-vCcAT5Hq.js";import{c1 as P,B as C}from"./index-
|
|
1
|
+
import{b5 as p,j as s,b0 as l}from"./vendor-Dnkkx2co.js";import{j as g,k as y}from"./state-vCcAT5Hq.js";import{c1 as P,B as C}from"./index-By3tQxiE.js";function v({userId:e,domain:n,entityType:o,entityId:r,label:i,description:a,tags:c,size:f="sm"}){const u=p(),d=g(),t=y({mutationFn:async()=>{if(!e)throw new Error("Select a single owner before sending entities to Preferences.");return P({userId:e,domain:n,entityType:o,entityId:r,label:i,description:a,tags:c})},onSuccess:async({item:m})=>{await d.invalidateQueries({queryKey:["forge-preferences"]}),u(`/preferences?userId=${encodeURIComponent(e??"")}&domain=${encodeURIComponent(n)}&focusItem=${encodeURIComponent(m.id)}`)}});return s.jsxs(C,{variant:"secondary",size:f,disabled:!e,pending:t.isPending,pendingLabel:"Sending to Preferences",onClick:()=>void t.mutateAsync(),title:e?"Add this entity to the Preferences compare queue.":"Select a single user scope before sending entities to Preferences.",children:[s.jsx(l,{className:"size-4"}),"Send to Preferences"]})}export{v as P};
|