forge-openclaw-plugin 0.2.109 → 0.2.110
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-DWHZ8_sJ.js → activity-page-BdeoV3N4.js} +1 -1
- package/dist/assets/{ai-surface-workspace-DPygfyhc.js → ai-surface-workspace-BCbQUekv.js} +1 -1
- package/dist/assets/{atlas-panel-D261RUQF.js → atlas-panel-DTnRBOZx.js} +1 -1
- package/dist/assets/{calendar-page-BQbJkdPF.js → calendar-page-YDexXy_e.js} +1 -1
- package/dist/assets/{calendar-rules-BoFsuvZ8.js → calendar-rules-B_aOcMi3.js} +1 -1
- package/dist/assets/{calendar-week-toolbar-LetevPI7.js → calendar-week-toolbar-BTbIzq3e.js} +1 -1
- package/dist/assets/{companion-sync-lab-page-Bid-4B8W.js → companion-sync-lab-page-DKouMut9.js} +1 -1
- package/dist/assets/{daily-metrics-dashboard-CqnGJNeI.js → daily-metrics-dashboard-B3UCGG1t.js} +1 -1
- package/dist/assets/{entity-note-count-link-VMURwBMi.js → entity-note-count-link-DUxobQUt.js} +1 -1
- package/dist/assets/{entity-notes-surface-DGXcyNzo.js → entity-notes-surface-BdHBn8rx.js} +1 -1
- package/dist/assets/{execution-board-BGf6zZqJ.js → execution-board-R5-oyf-Z.js} +1 -1
- package/dist/assets/{faceted-token-search-CAsZrhZ4.js → faceted-token-search-DtO6OUwQ.js} +1 -1
- package/dist/assets/{flagship-signal-deck-DJsq3jn2.js → flagship-signal-deck-B9k46sWA.js} +1 -1
- package/dist/assets/{floating-action-menu-B3tQStUN.js → floating-action-menu-DBzfnJOx.js} +1 -1
- package/dist/assets/{goal-detail-page-DBs-9wpk.js → goal-detail-page-Mr_gnZ2l.js} +1 -1
- package/dist/assets/{goals-page-CPmhjsG-.js → goals-page-BG7FuqK1.js} +1 -1
- package/dist/assets/{habits-page-DkW8zT6_.js → habits-page-CGdaOqL3.js} +1 -1
- package/dist/assets/{index-BhkubYaC.js → index-BP9__l6C.js} +2 -2
- package/dist/assets/{insight-flow-dialog-BvgRjkPi.js → insight-flow-dialog-BUv06Vn-.js} +1 -1
- package/dist/assets/{insights-page-Dtij6pm5.js → insights-page-BgD1_1we.js} +1 -1
- package/dist/assets/{kanban-page-R1x5hUU-.js → kanban-page-DvZSN-Bi.js} +1 -1
- package/dist/assets/{knowledge-graph-page-BRBB5Vvz.js → knowledge-graph-page-BXWXtPvo.js} +1 -1
- package/dist/assets/{life-force-page-DGPWKM9I.js → life-force-page-CwjHvpzu.js} +1 -1
- package/dist/assets/{life-force-workspace-DoRIQoU_.js → life-force-workspace-Ct70SsNQ.js} +1 -1
- package/dist/assets/{metric-tile-NJiFcFxW.js → metric-tile-DCxLxNli.js} +1 -1
- package/dist/assets/{movement-page-Dk8aV737.js → movement-page-C06ebiYk.js} +1 -1
- package/dist/assets/{note-markdown-CZHjJDve.js → note-markdown-3wB52NOn.js} +1 -1
- package/dist/assets/{note-tags-input-DFpxZHPg.js → note-tags-input-Blg5Gqz_.js} +1 -1
- package/dist/assets/{notes-page-r3kymlqg.js → notes-page-CSkjizyK.js} +1 -1
- package/dist/assets/{open-in-graph-button-B_XHtHZD.js → open-in-graph-button-CDHxzS8B.js} +1 -1
- package/dist/assets/{orbit-map-C_xy4kYC.js → orbit-map-OV-GcUZl.js} +1 -1
- package/dist/assets/{overview-page-Dwg4uYe9.js → overview-page-Cw3pI34n.js} +1 -1
- package/dist/assets/{page-hero-DzEsy8i5.js → page-hero-DgnhI5es.js} +1 -1
- package/dist/assets/{pill-cluster-DcBUeEMT.js → pill-cluster-DIGkIvKN.js} +1 -1
- package/dist/assets/{preference-entity-handoff-button-BX2n07ob.js → preference-entity-handoff-button-LT_GBuqB.js} +1 -1
- package/dist/assets/{preferences-page-BSnwiWBt.js → preferences-page-Dkvz7nkU.js} +1 -1
- package/dist/assets/{project-collections-BR6YdlCZ.js → project-collections-BsAT8WYE.js} +1 -1
- package/dist/assets/{project-detail-page-DeYshcCb.js → project-detail-page-DsJUWg8k.js} +1 -1
- package/dist/assets/{project-management-hierarchy-page-Bhdt79Ea.js → project-management-hierarchy-page-CIy0wAp8.js} +1 -1
- package/dist/assets/{project-management-section-nav-DnXuWUfe.js → project-management-section-nav-ClB2S1FW.js} +1 -1
- package/dist/assets/{projects-page-BA9W0ZPk.js → projects-page-Da1bZLSH.js} +1 -1
- package/dist/assets/{psyche-behaviors-page-DpTj53GI.js → psyche-behaviors-page-D0uwf78o.js} +1 -1
- package/dist/assets/{psyche-flashcards-page-CV58hAJA.js → psyche-flashcards-page-e_qwwsOf.js} +1 -1
- package/dist/assets/{psyche-goal-map-page-C07CALFg.js → psyche-goal-map-page-BIY028Wx.js} +1 -1
- package/dist/assets/{psyche-graph-CP7mxfMP.js → psyche-graph-Y1UKALEm.js} +1 -1
- package/dist/assets/{psyche-metrics-page-CY8e9R0D.js → psyche-metrics-page-DDkGJzo_.js} +1 -1
- package/dist/assets/{psyche-mode-guide-page-DYt6AmHl.js → psyche-mode-guide-page-C7mD9uiv.js} +1 -1
- package/dist/assets/{psyche-modes-page-Dd77kTtJ.js → psyche-modes-page-RUdaOQWr.js} +1 -1
- package/dist/assets/{psyche-page-DNXZjIKp.js → psyche-page-D3FZy__c.js} +1 -1
- package/dist/assets/{psyche-patterns-page-DxGzpeT5.js → psyche-patterns-page-BSD35F41.js} +1 -1
- package/dist/assets/{psyche-questionnaire-builder-page-5EQctRHO.js → psyche-questionnaire-builder-page-BpgUTMgj.js} +1 -1
- package/dist/assets/{psyche-questionnaire-detail-page-W8nhUGAc.js → psyche-questionnaire-detail-page-DwjyjNhg.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-detail-page-DVwzSuqg.js → psyche-questionnaire-run-detail-page-mJ-DgeB-.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-page-BHResQgL.js → psyche-questionnaire-run-page-YuMBkH1G.js} +1 -1
- package/dist/assets/{psyche-questionnaires-page-DFTOXpyp.js → psyche-questionnaires-page-CNglToKh.js} +1 -1
- package/dist/assets/{psyche-report-detail-page-BqDE_tf7.js → psyche-report-detail-page-CV6tbLxz.js} +1 -1
- package/dist/assets/{psyche-reports-page-B75pDz0l.js → psyche-reports-page-BEOe8OPA.js} +1 -1
- package/dist/assets/{psyche-schemas-beliefs-page-BjSO4tYL.js → psyche-schemas-beliefs-page-KIRqmO8C.js} +1 -1
- package/dist/assets/{psyche-screen-time-page-B7lKf1g7.js → psyche-screen-time-page-DvXuwgU1.js} +1 -1
- package/dist/assets/{psyche-self-observation-page-C6RMThwc.js → psyche-self-observation-page-E6yDPBm1.js} +1 -1
- package/dist/assets/{psyche-values-page-1O158mIJ.js → psyche-values-page-CSLG7C6a.js} +1 -1
- package/dist/assets/{report-chain-fields-CyJ_VFY5.js → report-chain-fields-BYEp3tRr.js} +1 -1
- package/dist/assets/{rewards-page-sPlDYuVo.js → rewards-page-pAa_MIte.js} +1 -1
- package/dist/assets/{scheduling-rules-editor-DGgcBs1W.js → scheduling-rules-editor-BmGrjC9q.js} +1 -1
- package/dist/assets/{schema-badge-Do-YvNHm.js → schema-badge-IVJ4SoeC.js} +1 -1
- package/dist/assets/{select-menu-CAM7rMdO.js → select-menu-BE5AIdgO.js} +1 -1
- package/dist/assets/{settings-agents-page-BsZY71kz.js → settings-agents-page-hqI0IaNx.js} +1 -1
- package/dist/assets/{settings-bin-page-kB3jtHo_.js → settings-bin-page-2bPjFtZ3.js} +1 -1
- package/dist/assets/{settings-calendar-page-C-IGNk3_.js → settings-calendar-page-u_TfZJEh.js} +1 -1
- package/dist/assets/{settings-data-page-CFGSL9g3.js → settings-data-page-DSQ14F2i.js} +1 -1
- package/dist/assets/{settings-logs-page-C7e9FIN_.js → settings-logs-page-BU0CJhDM.js} +1 -1
- package/dist/assets/{settings-mobile-page-DzKeZQDM.js → settings-mobile-page-B1fQ61BB.js} +1 -1
- package/dist/assets/{settings-models-page-dFhaOV3E.js → settings-models-page-B0Dis_c_.js} +1 -1
- package/dist/assets/{settings-page-C0fSyYUx.js → settings-page-V4ibXIp9.js} +1 -1
- package/dist/assets/{settings-rewards-page-D-LuZHhv.js → settings-rewards-page-DeCGBNn5.js} +1 -1
- package/dist/assets/{settings-section-nav-kFFQSJEe.js → settings-section-nav-DV5umEkp.js} +1 -1
- package/dist/assets/{settings-users-page-CX797HPB.js → settings-users-page-BB8Dzd_P.js} +1 -1
- package/dist/assets/{settings-wiki-page-CWLAvcsf.js → settings-wiki-page-B0k0KRsU.js} +1 -1
- package/dist/assets/{sleep-page-QgBkKyk_.js → sleep-page-CPwUb-em.js} +1 -1
- package/dist/assets/{sports-page-C8tLMl7V.js → sports-page-Cl4vZVwh.js} +1 -1
- package/dist/assets/{strategies-page-CGgh-KXu.js → strategies-page-DhFXf-g3.js} +1 -1
- package/dist/assets/{strategy-detail-page-CnzqjjoD.js → strategy-detail-page-B2gotRKI.js} +1 -1
- package/dist/assets/{strategy-dialog-C6AThZ9L.js → strategy-dialog-DD1bbrRB.js} +1 -1
- package/dist/assets/{surface-CIDhCEsF.js → surface-98myBzix.js} +1 -1
- package/dist/assets/{task-detail-page-Dp0r_qZP.js → task-detail-page-nx4eQbMW.js} +1 -1
- package/dist/assets/{timebox-planning-dialog-B3uaSsWI.js → timebox-planning-dialog-DoZ9zUra.js} +1 -1
- package/dist/assets/{today-page-CTnMYrPi.js → today-page-7BH7Yne1.js} +1 -1
- package/dist/assets/{training-load-page-D0WB5_Tq.js → training-load-page-E82pNn1-.js} +1 -1
- package/dist/assets/{vitals-page-0vg8nqwj.js → vitals-page-D64WlwVv.js} +1 -1
- package/dist/assets/{weekly-review-page-CSSKlkbH.js → weekly-review-page-BkRxxm7Q.js} +1 -1
- package/dist/assets/weight-loss-page-DPbg7rTC.js +5 -0
- package/dist/assets/{wiki-article-markdown-CBFvfJx_.js → wiki-article-markdown-B0Q6082A.js} +1 -1
- package/dist/assets/{wiki-editor-page-CL1uxpih.js → wiki-editor-page-Tkb50wEA.js} +1 -1
- package/dist/assets/{wiki-ingest-history-page-XX8DeNCC.js → wiki-ingest-history-page-CcQzkZRr.js} +1 -1
- package/dist/assets/{wiki-ingest-modal-j-ftDmzp.js → wiki-ingest-modal-D6yft0Qb.js} +1 -1
- package/dist/assets/{wiki-page-B46TQYpy.js → wiki-page-DEND1jmD.js} +1 -1
- package/dist/assets/{workbench-flow-page-CicEuBKq.js → workbench-flow-page-CkNI03j_.js} +1 -1
- package/dist/assets/{workbench-page-tXezYLh_.js → workbench-page-W3zQpeWr.js} +1 -1
- package/dist/assets/{workout-detail-page-BTO5X0Of.js → workout-detail-page-BVSZv53z.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/server/server/src/app.js +2 -0
- package/dist/server/server/src/health-weight-loss.js +160 -10
- package/dist/server/src/lib/weight-loss-energy-model.js +64 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/forge-openclaw/SKILL.md +10 -0
- package/skills/forge-openclaw/entity_conversation_playbooks.md +33 -0
- package/skills/forge-openclaw/psyche_entity_playbooks.md +31 -0
- package/dist/assets/weight-loss-page-Dcr4wjjy.js +0 -5
package/dist/assets/{companion-sync-lab-page-Bid-4B8W.js → companion-sync-lab-page-DKouMut9.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-Dnkkx2co.js";import{C as h,c as d}from"./index-BhkubYaC.js";import{P as $}from"./page-hero-DzEsy8i5.js";import"./state-vCcAT5Hq.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const B=[{id:"health-ready",title:"Health ready",desiredEnabled:!0,appliedEnabled:!0,authorizationStatus:"approved",syncEligible:!0,lastObservedAt:"2026-04-12T09:00:00.000Z"},{id:"movement-pending-phone",title:"Movement pending on phone",desiredEnabled:!0,appliedEnabled:!1,authorizationStatus:"pending",syncEligible:!1,lastObservedAt:"2026-04-12T09:04:00.000Z"},{id:"screen-time-denied",title:"Screen Time denied",desiredEnabled:!0,appliedEnabled:!0,authorizationStatus:"denied",syncEligible:!1,lastObservedAt:"2026-04-12T08:54:00.000Z"},{id:"health-off",title:"Health off",desiredEnabled:!1,appliedEnabled:!1,authorizationStatus:"disabled",syncEligible:!1,lastObservedAt:null}],Z=[{id:"gap-stay",title:"Quiet short gap",gapSeconds:1080,displacementMeters:42,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-short-jump",title:"Suppressed short jump",gapSeconds:240,displacementMeters:260,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-trip",title:"Repaired move",gapSeconds:1320,displacementMeters:1850,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-missing-long",title:"Long missing gap",gapSeconds:7200,displacementMeters:320,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-missing-boundary",title:"Missing boundary anchor",gapSeconds:960,displacementMeters:null,hasStartBoundary:!1,hasEndBoundary:!0}],D=[{id:"overnight-gap-before-move",title:"Exact overnight stay-gap-move bug",rangeStart:"2026-04-05T21:15:00.000Z",rangeEnd:"2026-04-06T02:40:00.000Z",segments:[{id:"stay-home-evening",kind:"stay",startedAt:"2026-04-05T21:15:00.000Z",endedAt:"2026-04-05T21:30:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.5191,longitude:6.6323},endCoordinate:{latitude:46.5191,longitude:6.6323}},{id:"trip-night-move",kind:"trip",startedAt:"2026-04-06T02:34:00.000Z",endedAt:"2026-04-06T02:40:00.000Z",placeLabel:"Night move",placeExternalUid:null,startCoordinate:{latitude:46.5216,longitude:6.6404},endCoordinate:{latitude:46.5226,longitude:6.6424}}]},{id:"repeated-home-stays",title:"Repeated home stays coalesce",rangeStart:"2026-04-05T07:00:00.000Z",rangeEnd:"2026-04-05T08:44:00.000Z",segments:[{id:"stay-home-1",kind:"stay",startedAt:"2026-04-05T07:00:00.000Z",endedAt:"2026-04-05T08:00:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.5191,longitude:6.6323},endCoordinate:{latitude:46.5191,longitude:6.6323}},{id:"stay-home-2",kind:"stay",startedAt:"2026-04-05T08:20:00.000Z",endedAt:"2026-04-05T08:40:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.51912,longitude:6.63231},endCoordinate:{latitude:46.51912,longitude:6.63231}},{id:"trip-start-anchor",kind:"trip",startedAt:"2026-04-05T08:44:00.000Z",endedAt:"2026-04-05T08:49:00.000Z",placeLabel:"Walk out",placeExternalUid:null,startCoordinate:{latitude:46.5217,longitude:6.6405},endCoordinate:{latitude:46.5221,longitude:6.6412}}]}],U=[{id:"user-override-home-window",title:"User-defined missing box overrides one automatic home stay",rawMeasurements:[{id:"raw-stay-home",label:"Raw stay · Home",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z"}],automaticBoxes:[{id:"auto-stay-home",kind:"stay",origin:"recorded",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z",title:"Home"}],userBoxes:[{id:"user-missing-home-window",kind:"missing",origin:"user_invalidated",startedAt:"2026-04-05T08:30:00.000Z",endedAt:"2026-04-05T09:00:00.000Z",title:"User invalidated automatic movement",overrideCount:1}],projectedBoxes:[{id:"projected-home-early",kind:"stay",sourceKind:"automatic",origin:"recorded",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T08:30:00.000Z",title:"Home",overrideCount:0},{id:"projected-home-user-missing",kind:"missing",sourceKind:"user_defined",origin:"user_invalidated",startedAt:"2026-04-05T08:30:00.000Z",endedAt:"2026-04-05T09:00:00.000Z",title:"User invalidated automatic movement",overrideCount:1},{id:"projected-home-late",kind:"stay",sourceKind:"automatic",origin:"recorded",startedAt:"2026-04-05T09:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z",title:"Home",overrideCount:0}]}],T=3600,O=300,R=100;function N(t,s){return Math.max(0,Math.round((Date.parse(s)-Date.parse(t))/1e3))}function L(t,s){if(!t||!s)return null;const i=6371e3,g=(s.latitude-t.latitude)*Math.PI/180,l=(s.longitude-t.longitude)*Math.PI/180,u=t.latitude*Math.PI/180,c=s.latitude*Math.PI/180,m=Math.sin(g/2)**2+Math.cos(u)*Math.cos(c)*Math.sin(l/2)**2,r=2*Math.atan2(Math.sqrt(m),Math.sqrt(1-m));return i*r}function I(t,s){if(t.placeExternalUid&&s.placeExternalUid&&t.placeExternalUid===s.placeExternalUid)return!0;const i=L(t.endCoordinate,s.startCoordinate);return i!==null&&i<=R}function H(t){return t.gapSeconds>3600?{kind:"missing",origin:"missing",reason:"Gap exceeded one hour, so Forge keeps it as explicit missing data.",suppressedShortJump:!1}:!t.hasStartBoundary||!t.hasEndBoundary||t.displacementMeters===null?{kind:"missing",origin:"missing",reason:"One or both boundary anchors were missing, so the gap stays missing instead of inventing movement.",suppressedShortJump:!1}:t.displacementMeters<=100?{kind:"stay",origin:"repaired_gap",reason:"Boundary displacement stayed within 100 m, so the gap repairs into one stay.",suppressedShortJump:!1}:t.gapSeconds<300?{kind:"stay",origin:"repaired_gap",reason:"The jump crossed 100 m but stayed under five minutes, so Forge suppresses it into stay continuity.",suppressedShortJump:!0}:{kind:"trip",origin:"repaired_gap",reason:"The gap stayed under one hour, crossed 100 m, and lasted at least five minutes, so Forge repairs it into a move.",suppressedShortJump:!1}}function P(t){var E,w,_,C;const s=[...t.segments].sort((a,o)=>a.startedAt.localeCompare(o.startedAt)),i=[];if(s.length===0)return{segments:[],uncoveredIntervals:[]};const g=s[0];N(t.rangeStart,g.startedAt)>0&&i.push({id:`missing_${t.rangeStart}_${g.startedAt}`,kind:"missing",origin:"missing",startedAt:t.rangeStart,endedAt:g.startedAt,title:"Missing data"}),s.forEach((a,o)=>{if(o>0){const n=s[o-1],y=N(n.endedAt,a.startedAt);y>0&&(y>T?i.push({id:`missing_${n.id}_${a.id}`,kind:"missing",origin:"missing",startedAt:n.endedAt,endedAt:a.startedAt,title:"Missing data"}):I(n,a)?i.push({id:`repaired_stay_${n.id}_${a.id}`,kind:"stay",origin:"repaired_gap",startedAt:n.endedAt,endedAt:a.startedAt,title:n.placeLabel??a.placeLabel??"Repaired stay"}):L(n.endCoordinate,a.startCoordinate)===null?i.push({id:`missing_${n.id}_${a.id}`,kind:"missing",origin:"missing",startedAt:n.endedAt,endedAt:a.startedAt,title:"Missing data"}):y<O?i.push({id:`repaired_short_jump_${n.id}_${a.id}`,kind:"stay",origin:"repaired_gap",startedAt:n.endedAt,endedAt:a.startedAt,title:n.placeLabel??a.placeLabel??"Repaired stay"}):i.push({id:`repaired_trip_${n.id}_${a.id}`,kind:"trip",origin:"repaired_gap",startedAt:n.endedAt,endedAt:a.startedAt,title:"Repaired move"}))}i.push({id:a.id,kind:a.kind,origin:"recorded",startedAt:a.startedAt,endedAt:a.endedAt,title:a.placeLabel??a.kind})});const l=s[s.length-1],u=N(l.endedAt,t.rangeEnd);u>0&&(l.kind==="stay"&&u<=T?i.push({id:`continued_${l.id}_${t.rangeEnd}`,kind:"stay",origin:"continued_stay",startedAt:l.endedAt,endedAt:t.rangeEnd,title:l.placeLabel??"Continued stay"}):i.push({id:`missing_${l.endedAt}_${t.rangeEnd}`,kind:"missing",origin:"missing",startedAt:l.endedAt,endedAt:t.rangeEnd,title:"Missing data"}));const c=[];for(const a of i){const o=c[c.length-1];if(o&&o.kind==="stay"&&a.kind==="stay"&&(o.origin!=="recorded"||a.origin!=="recorded")&&o.endedAt===a.startedAt){c[c.length-1]={...o,id:`${o.id}_${a.id}`,origin:o.origin==="continued_stay"||a.origin==="continued_stay"?"continued_stay":"repaired_gap",endedAt:a.endedAt};continue}c.push(a)}const m=[],r=[...c].sort((a,o)=>a.startedAt.localeCompare(o.startedAt));((E=r[0])==null?void 0:E.startedAt)!==t.rangeStart&&m.push({startedAt:t.rangeStart,endedAt:((w=r[0])==null?void 0:w.startedAt)??t.rangeEnd});for(let a=1;a<r.length;a+=1)r[a-1].endedAt!==r[a].startedAt&&m.push({startedAt:r[a-1].endedAt,endedAt:r[a].startedAt});return((_=r[r.length-1])==null?void 0:_.endedAt)!==t.rangeEnd&&m.push({startedAt:((C=r[r.length-1])==null?void 0:C.endedAt)??t.rangeStart,endedAt:t.rangeEnd}),{segments:r,uncoveredIntervals:m}}function F(t){return t?new Date(t).toLocaleString():"Waiting for device update"}const v="grid min-w-0 gap-4 rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5",x="grid min-w-0 gap-2 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-4",b="grid min-w-0 gap-2 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3",j="rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-xs text-[var(--ui-ink-soft)]",A="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",S="text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",f="text-sm font-medium text-[var(--ui-ink-strong)]",p="text-[var(--ui-ink-soft)]",k="text-[var(--ui-ink-faint)]",z="bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",G="bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]",M="bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",J="bg-[var(--ui-accent-soft)] text-[var(--primary)]";function ae(){return e.jsxs("div",{className:"mx-auto grid min-w-0 w-full max-w-[1180px] gap-5",children:[e.jsx($,{title:"Companion Sync Lab",description:"Deterministic fixtures for source-state reconciliation and movement gap repair. This route is dev-only and exists to make QA faster than recreating every phone state by hand.",badge:"Dev only"}),e.jsxs("section",{className:"grid min-w-0 gap-4 lg:grid-cols-[1.05fr_0.95fr]",children:[e.jsxs(h,{className:v,children:[e.jsxs("div",{children:[e.jsx("div",{className:A,children:"Source matrix"}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${p}`,children:"These rows mirror the pairing source-state contract that the web and phone now share."})]}),e.jsx("div",{className:"grid gap-3",children:B.map(t=>e.jsxs("div",{className:x,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:f,children:t.title}),e.jsx(d,{tone:t.desiredEnabled?"signal":"meta",children:t.desiredEnabled?"Enabled":"Off"}),e.jsx(d,{tone:"meta",children:t.desiredEnabled===t.appliedEnabled?"Applied":"Pending on phone"})]}),e.jsxs("div",{className:`grid gap-1 text-xs ${p} sm:grid-cols-2`,children:[e.jsxs("div",{children:["Authorization: ",t.authorizationStatus]}),e.jsxs("div",{children:["Sync eligible: ",t.syncEligible?"Yes":"No"]}),e.jsxs("div",{children:["Desired: ",t.desiredEnabled?"On":"Off"]}),e.jsxs("div",{children:["Applied: ",t.appliedEnabled?"On":"Off"]}),e.jsxs("div",{className:"sm:col-span-2",children:["Last observed: ",F(t.lastObservedAt)]})]})]},t.id))})]}),e.jsxs(h,{className:v,children:[e.jsxs("div",{children:[e.jsx("div",{className:A,children:"Gap classifier"}),e.jsxs("div",{className:`mt-2 text-sm leading-6 ${p}`,children:["Every gap resolves to exactly one of ",e.jsx("code",{children:"stay"}),","," ",e.jsx("code",{children:"trip"}),", or ",e.jsx("code",{children:"missing"}),"."]})]}),e.jsx("div",{className:"grid gap-3",children:Z.map(t=>{const s=H(t);return e.jsxs("div",{className:x,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:f,children:t.title}),e.jsx(d,{tone:s.kind==="missing"?"meta":s.kind==="trip"?"signal":"default",children:s.kind}),e.jsx(d,{tone:"meta",children:s.origin}),s.suppressedShortJump?e.jsx(d,{className:z,children:"Suppressed short jump"}):null]}),e.jsxs("div",{className:`grid gap-1 text-xs ${p} sm:grid-cols-2`,children:[e.jsxs("div",{children:["Gap: ",Math.round(t.gapSeconds/60)," min"]}),e.jsxs("div",{children:["Displacement:"," ",t.displacementMeters===null?"unknown":`${Math.round(t.displacementMeters)} m`]}),e.jsxs("div",{children:["Start boundary:"," ",t.hasStartBoundary?"present":"missing"]}),e.jsxs("div",{children:["End boundary:"," ",t.hasEndBoundary?"present":"missing"]})]}),e.jsx("div",{className:`text-sm leading-6 ${p}`,children:s.reason})]},t.id)})})]})]}),e.jsxs(h,{className:v,children:[e.jsxs("div",{children:[e.jsx("div",{className:A,children:"Coverage preview"}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${p}`,children:"These fixtures normalize a full window and highlight whether any interval would still be left uncovered."})]}),e.jsx("div",{className:"grid gap-3",children:D.map(t=>{const s=P(t);return e.jsxs("div",{className:x,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:f,children:t.title}),e.jsx(d,{className:s.uncoveredIntervals.length===0?G:M,children:s.uncoveredIntervals.length===0?"Coverage locked":"Coverage broken"}),e.jsxs(d,{tone:"meta",children:[s.segments.length," normalized segment",s.segments.length===1?"":"s"]})]}),e.jsx("div",{className:"grid gap-2",children:s.segments.map(i=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-xs text-[var(--ui-ink-soft)]",children:[e.jsx(d,{tone:i.kind==="trip"?"signal":i.kind==="missing"?"meta":"default",children:i.kind}),e.jsx(d,{tone:"meta",children:i.origin}),e.jsxs("span",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]}),e.jsx("span",{className:k,children:i.title})]},i.id))}),s.uncoveredIntervals.length>0?e.jsx("div",{className:"grid gap-2",children:s.uncoveredIntervals.map(i=>e.jsxs("div",{className:`rounded-[14px] border border-[color-mix(in_srgb,var(--danger)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-danger-soft)] px-3 py-2 text-xs ${M}`,children:["Uncovered:"," ",new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]},`${i.startedAt}-${i.endedAt}`))}):null]},t.id)})})]}),e.jsxs(h,{className:v,children:[e.jsxs("div",{children:[e.jsx("div",{className:A,children:"Canonical box layers"}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${p}`,children:"Raw phone measurements stay immutable. Forge generates automatic boxes from them, user-defined boxes override them, and the final projected boxes are what both the web and iPhone should render."})]}),e.jsx("div",{className:"grid gap-4",children:U.map(t=>e.jsxs("div",{className:x,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:f,children:t.title}),e.jsxs(d,{tone:"meta",children:["Raw: ",t.rawMeasurements.length]}),e.jsxs(d,{tone:"meta",children:["Automatic: ",t.automaticBoxes.length]}),e.jsxs(d,{tone:"meta",children:["User: ",t.userBoxes.length]}),e.jsxs(d,{tone:"signal",children:["Projected: ",t.projectedBoxes.length]})]}),e.jsxs("div",{className:"grid gap-3 xl:grid-cols-4",children:[e.jsxs("div",{className:b,children:[e.jsx("div",{className:S,children:"Raw measurements"}),t.rawMeasurements.map(s=>e.jsxs("div",{className:j,children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.label}),e.jsxs("div",{children:[new Date(s.startedAt).toLocaleTimeString()," →"," ",new Date(s.endedAt).toLocaleTimeString()]})]},s.id))]}),e.jsxs("div",{className:b,children:[e.jsx("div",{className:S,children:"Automatic boxes"}),t.automaticBoxes.map(s=>e.jsxs("div",{className:j,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{tone:s.kind==="trip"?"signal":s.kind==="missing"?"meta":"default",children:s.kind}),e.jsx(d,{tone:"meta",children:s.origin})]}),e.jsx("div",{className:"mt-2 font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsxs("div",{children:[new Date(s.startedAt).toLocaleTimeString()," →"," ",new Date(s.endedAt).toLocaleTimeString()]})]},s.id))]}),e.jsxs("div",{className:b,children:[e.jsx("div",{className:S,children:"User-defined boxes"}),t.userBoxes.map(s=>e.jsxs("div",{className:j,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{tone:s.kind==="missing"?"meta":"default",children:s.kind}),e.jsx(d,{className:J,children:s.origin})]}),e.jsx("div",{className:"mt-2 font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsxs("div",{children:[new Date(s.startedAt).toLocaleTimeString()," →"," ",new Date(s.endedAt).toLocaleTimeString()]}),e.jsxs("div",{className:`mt-1 ${k}`,children:["Overrides ",s.overrideCount," automatic box",s.overrideCount===1?"":"es"]})]},s.id))]}),e.jsxs("div",{className:b,children:[e.jsx("div",{className:S,children:"Projected visible boxes"}),t.projectedBoxes.map(s=>e.jsxs("div",{className:j,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{tone:s.kind==="trip"?"signal":s.kind==="missing"?"meta":"default",children:s.kind}),e.jsx(d,{tone:"meta",children:s.sourceKind})]}),e.jsx("div",{className:"mt-2 font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsxs("div",{children:[new Date(s.startedAt).toLocaleTimeString()," →"," ",new Date(s.endedAt).toLocaleTimeString()]}),e.jsxs("div",{className:`mt-1 ${k}`,children:[s.origin,s.overrideCount>0?` · overrides ${s.overrideCount}`:""]})]},s.id))]})]})]},t.id))})]})]})}export{ae as CompanionSyncLabPage};
|
|
1
|
+
import{j as e}from"./vendor-Dnkkx2co.js";import{C as h,c as d}from"./index-BP9__l6C.js";import{P as $}from"./page-hero-DgnhI5es.js";import"./state-vCcAT5Hq.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";const B=[{id:"health-ready",title:"Health ready",desiredEnabled:!0,appliedEnabled:!0,authorizationStatus:"approved",syncEligible:!0,lastObservedAt:"2026-04-12T09:00:00.000Z"},{id:"movement-pending-phone",title:"Movement pending on phone",desiredEnabled:!0,appliedEnabled:!1,authorizationStatus:"pending",syncEligible:!1,lastObservedAt:"2026-04-12T09:04:00.000Z"},{id:"screen-time-denied",title:"Screen Time denied",desiredEnabled:!0,appliedEnabled:!0,authorizationStatus:"denied",syncEligible:!1,lastObservedAt:"2026-04-12T08:54:00.000Z"},{id:"health-off",title:"Health off",desiredEnabled:!1,appliedEnabled:!1,authorizationStatus:"disabled",syncEligible:!1,lastObservedAt:null}],Z=[{id:"gap-stay",title:"Quiet short gap",gapSeconds:1080,displacementMeters:42,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-short-jump",title:"Suppressed short jump",gapSeconds:240,displacementMeters:260,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-trip",title:"Repaired move",gapSeconds:1320,displacementMeters:1850,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-missing-long",title:"Long missing gap",gapSeconds:7200,displacementMeters:320,hasStartBoundary:!0,hasEndBoundary:!0},{id:"gap-missing-boundary",title:"Missing boundary anchor",gapSeconds:960,displacementMeters:null,hasStartBoundary:!1,hasEndBoundary:!0}],D=[{id:"overnight-gap-before-move",title:"Exact overnight stay-gap-move bug",rangeStart:"2026-04-05T21:15:00.000Z",rangeEnd:"2026-04-06T02:40:00.000Z",segments:[{id:"stay-home-evening",kind:"stay",startedAt:"2026-04-05T21:15:00.000Z",endedAt:"2026-04-05T21:30:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.5191,longitude:6.6323},endCoordinate:{latitude:46.5191,longitude:6.6323}},{id:"trip-night-move",kind:"trip",startedAt:"2026-04-06T02:34:00.000Z",endedAt:"2026-04-06T02:40:00.000Z",placeLabel:"Night move",placeExternalUid:null,startCoordinate:{latitude:46.5216,longitude:6.6404},endCoordinate:{latitude:46.5226,longitude:6.6424}}]},{id:"repeated-home-stays",title:"Repeated home stays coalesce",rangeStart:"2026-04-05T07:00:00.000Z",rangeEnd:"2026-04-05T08:44:00.000Z",segments:[{id:"stay-home-1",kind:"stay",startedAt:"2026-04-05T07:00:00.000Z",endedAt:"2026-04-05T08:00:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.5191,longitude:6.6323},endCoordinate:{latitude:46.5191,longitude:6.6323}},{id:"stay-home-2",kind:"stay",startedAt:"2026-04-05T08:20:00.000Z",endedAt:"2026-04-05T08:40:00.000Z",placeLabel:"Home",placeExternalUid:"place_home",startCoordinate:{latitude:46.51912,longitude:6.63231},endCoordinate:{latitude:46.51912,longitude:6.63231}},{id:"trip-start-anchor",kind:"trip",startedAt:"2026-04-05T08:44:00.000Z",endedAt:"2026-04-05T08:49:00.000Z",placeLabel:"Walk out",placeExternalUid:null,startCoordinate:{latitude:46.5217,longitude:6.6405},endCoordinate:{latitude:46.5221,longitude:6.6412}}]}],U=[{id:"user-override-home-window",title:"User-defined missing box overrides one automatic home stay",rawMeasurements:[{id:"raw-stay-home",label:"Raw stay · Home",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z"}],automaticBoxes:[{id:"auto-stay-home",kind:"stay",origin:"recorded",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z",title:"Home"}],userBoxes:[{id:"user-missing-home-window",kind:"missing",origin:"user_invalidated",startedAt:"2026-04-05T08:30:00.000Z",endedAt:"2026-04-05T09:00:00.000Z",title:"User invalidated automatic movement",overrideCount:1}],projectedBoxes:[{id:"projected-home-early",kind:"stay",sourceKind:"automatic",origin:"recorded",startedAt:"2026-04-05T08:00:00.000Z",endedAt:"2026-04-05T08:30:00.000Z",title:"Home",overrideCount:0},{id:"projected-home-user-missing",kind:"missing",sourceKind:"user_defined",origin:"user_invalidated",startedAt:"2026-04-05T08:30:00.000Z",endedAt:"2026-04-05T09:00:00.000Z",title:"User invalidated automatic movement",overrideCount:1},{id:"projected-home-late",kind:"stay",sourceKind:"automatic",origin:"recorded",startedAt:"2026-04-05T09:00:00.000Z",endedAt:"2026-04-05T10:00:00.000Z",title:"Home",overrideCount:0}]}],T=3600,O=300,R=100;function N(t,s){return Math.max(0,Math.round((Date.parse(s)-Date.parse(t))/1e3))}function L(t,s){if(!t||!s)return null;const i=6371e3,g=(s.latitude-t.latitude)*Math.PI/180,l=(s.longitude-t.longitude)*Math.PI/180,u=t.latitude*Math.PI/180,c=s.latitude*Math.PI/180,m=Math.sin(g/2)**2+Math.cos(u)*Math.cos(c)*Math.sin(l/2)**2,r=2*Math.atan2(Math.sqrt(m),Math.sqrt(1-m));return i*r}function I(t,s){if(t.placeExternalUid&&s.placeExternalUid&&t.placeExternalUid===s.placeExternalUid)return!0;const i=L(t.endCoordinate,s.startCoordinate);return i!==null&&i<=R}function H(t){return t.gapSeconds>3600?{kind:"missing",origin:"missing",reason:"Gap exceeded one hour, so Forge keeps it as explicit missing data.",suppressedShortJump:!1}:!t.hasStartBoundary||!t.hasEndBoundary||t.displacementMeters===null?{kind:"missing",origin:"missing",reason:"One or both boundary anchors were missing, so the gap stays missing instead of inventing movement.",suppressedShortJump:!1}:t.displacementMeters<=100?{kind:"stay",origin:"repaired_gap",reason:"Boundary displacement stayed within 100 m, so the gap repairs into one stay.",suppressedShortJump:!1}:t.gapSeconds<300?{kind:"stay",origin:"repaired_gap",reason:"The jump crossed 100 m but stayed under five minutes, so Forge suppresses it into stay continuity.",suppressedShortJump:!0}:{kind:"trip",origin:"repaired_gap",reason:"The gap stayed under one hour, crossed 100 m, and lasted at least five minutes, so Forge repairs it into a move.",suppressedShortJump:!1}}function P(t){var E,w,_,C;const s=[...t.segments].sort((a,o)=>a.startedAt.localeCompare(o.startedAt)),i=[];if(s.length===0)return{segments:[],uncoveredIntervals:[]};const g=s[0];N(t.rangeStart,g.startedAt)>0&&i.push({id:`missing_${t.rangeStart}_${g.startedAt}`,kind:"missing",origin:"missing",startedAt:t.rangeStart,endedAt:g.startedAt,title:"Missing data"}),s.forEach((a,o)=>{if(o>0){const n=s[o-1],y=N(n.endedAt,a.startedAt);y>0&&(y>T?i.push({id:`missing_${n.id}_${a.id}`,kind:"missing",origin:"missing",startedAt:n.endedAt,endedAt:a.startedAt,title:"Missing data"}):I(n,a)?i.push({id:`repaired_stay_${n.id}_${a.id}`,kind:"stay",origin:"repaired_gap",startedAt:n.endedAt,endedAt:a.startedAt,title:n.placeLabel??a.placeLabel??"Repaired stay"}):L(n.endCoordinate,a.startCoordinate)===null?i.push({id:`missing_${n.id}_${a.id}`,kind:"missing",origin:"missing",startedAt:n.endedAt,endedAt:a.startedAt,title:"Missing data"}):y<O?i.push({id:`repaired_short_jump_${n.id}_${a.id}`,kind:"stay",origin:"repaired_gap",startedAt:n.endedAt,endedAt:a.startedAt,title:n.placeLabel??a.placeLabel??"Repaired stay"}):i.push({id:`repaired_trip_${n.id}_${a.id}`,kind:"trip",origin:"repaired_gap",startedAt:n.endedAt,endedAt:a.startedAt,title:"Repaired move"}))}i.push({id:a.id,kind:a.kind,origin:"recorded",startedAt:a.startedAt,endedAt:a.endedAt,title:a.placeLabel??a.kind})});const l=s[s.length-1],u=N(l.endedAt,t.rangeEnd);u>0&&(l.kind==="stay"&&u<=T?i.push({id:`continued_${l.id}_${t.rangeEnd}`,kind:"stay",origin:"continued_stay",startedAt:l.endedAt,endedAt:t.rangeEnd,title:l.placeLabel??"Continued stay"}):i.push({id:`missing_${l.endedAt}_${t.rangeEnd}`,kind:"missing",origin:"missing",startedAt:l.endedAt,endedAt:t.rangeEnd,title:"Missing data"}));const c=[];for(const a of i){const o=c[c.length-1];if(o&&o.kind==="stay"&&a.kind==="stay"&&(o.origin!=="recorded"||a.origin!=="recorded")&&o.endedAt===a.startedAt){c[c.length-1]={...o,id:`${o.id}_${a.id}`,origin:o.origin==="continued_stay"||a.origin==="continued_stay"?"continued_stay":"repaired_gap",endedAt:a.endedAt};continue}c.push(a)}const m=[],r=[...c].sort((a,o)=>a.startedAt.localeCompare(o.startedAt));((E=r[0])==null?void 0:E.startedAt)!==t.rangeStart&&m.push({startedAt:t.rangeStart,endedAt:((w=r[0])==null?void 0:w.startedAt)??t.rangeEnd});for(let a=1;a<r.length;a+=1)r[a-1].endedAt!==r[a].startedAt&&m.push({startedAt:r[a-1].endedAt,endedAt:r[a].startedAt});return((_=r[r.length-1])==null?void 0:_.endedAt)!==t.rangeEnd&&m.push({startedAt:((C=r[r.length-1])==null?void 0:C.endedAt)??t.rangeStart,endedAt:t.rangeEnd}),{segments:r,uncoveredIntervals:m}}function F(t){return t?new Date(t).toLocaleString():"Waiting for device update"}const v="grid min-w-0 gap-4 rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5",x="grid min-w-0 gap-2 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-4",b="grid min-w-0 gap-2 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] p-3",j="rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-xs text-[var(--ui-ink-soft)]",A="font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",S="text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",f="text-sm font-medium text-[var(--ui-ink-strong)]",p="text-[var(--ui-ink-soft)]",k="text-[var(--ui-ink-faint)]",z="bg-[var(--ui-warning-soft)] text-[color-mix(in_srgb,var(--warning)_78%,var(--ui-ink-strong)_22%)]",G="bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_76%,var(--ui-ink-strong)_24%)]",M="bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",J="bg-[var(--ui-accent-soft)] text-[var(--primary)]";function ae(){return e.jsxs("div",{className:"mx-auto grid min-w-0 w-full max-w-[1180px] gap-5",children:[e.jsx($,{title:"Companion Sync Lab",description:"Deterministic fixtures for source-state reconciliation and movement gap repair. This route is dev-only and exists to make QA faster than recreating every phone state by hand.",badge:"Dev only"}),e.jsxs("section",{className:"grid min-w-0 gap-4 lg:grid-cols-[1.05fr_0.95fr]",children:[e.jsxs(h,{className:v,children:[e.jsxs("div",{children:[e.jsx("div",{className:A,children:"Source matrix"}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${p}`,children:"These rows mirror the pairing source-state contract that the web and phone now share."})]}),e.jsx("div",{className:"grid gap-3",children:B.map(t=>e.jsxs("div",{className:x,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:f,children:t.title}),e.jsx(d,{tone:t.desiredEnabled?"signal":"meta",children:t.desiredEnabled?"Enabled":"Off"}),e.jsx(d,{tone:"meta",children:t.desiredEnabled===t.appliedEnabled?"Applied":"Pending on phone"})]}),e.jsxs("div",{className:`grid gap-1 text-xs ${p} sm:grid-cols-2`,children:[e.jsxs("div",{children:["Authorization: ",t.authorizationStatus]}),e.jsxs("div",{children:["Sync eligible: ",t.syncEligible?"Yes":"No"]}),e.jsxs("div",{children:["Desired: ",t.desiredEnabled?"On":"Off"]}),e.jsxs("div",{children:["Applied: ",t.appliedEnabled?"On":"Off"]}),e.jsxs("div",{className:"sm:col-span-2",children:["Last observed: ",F(t.lastObservedAt)]})]})]},t.id))})]}),e.jsxs(h,{className:v,children:[e.jsxs("div",{children:[e.jsx("div",{className:A,children:"Gap classifier"}),e.jsxs("div",{className:`mt-2 text-sm leading-6 ${p}`,children:["Every gap resolves to exactly one of ",e.jsx("code",{children:"stay"}),","," ",e.jsx("code",{children:"trip"}),", or ",e.jsx("code",{children:"missing"}),"."]})]}),e.jsx("div",{className:"grid gap-3",children:Z.map(t=>{const s=H(t);return e.jsxs("div",{className:x,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:f,children:t.title}),e.jsx(d,{tone:s.kind==="missing"?"meta":s.kind==="trip"?"signal":"default",children:s.kind}),e.jsx(d,{tone:"meta",children:s.origin}),s.suppressedShortJump?e.jsx(d,{className:z,children:"Suppressed short jump"}):null]}),e.jsxs("div",{className:`grid gap-1 text-xs ${p} sm:grid-cols-2`,children:[e.jsxs("div",{children:["Gap: ",Math.round(t.gapSeconds/60)," min"]}),e.jsxs("div",{children:["Displacement:"," ",t.displacementMeters===null?"unknown":`${Math.round(t.displacementMeters)} m`]}),e.jsxs("div",{children:["Start boundary:"," ",t.hasStartBoundary?"present":"missing"]}),e.jsxs("div",{children:["End boundary:"," ",t.hasEndBoundary?"present":"missing"]})]}),e.jsx("div",{className:`text-sm leading-6 ${p}`,children:s.reason})]},t.id)})})]})]}),e.jsxs(h,{className:v,children:[e.jsxs("div",{children:[e.jsx("div",{className:A,children:"Coverage preview"}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${p}`,children:"These fixtures normalize a full window and highlight whether any interval would still be left uncovered."})]}),e.jsx("div",{className:"grid gap-3",children:D.map(t=>{const s=P(t);return e.jsxs("div",{className:x,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:f,children:t.title}),e.jsx(d,{className:s.uncoveredIntervals.length===0?G:M,children:s.uncoveredIntervals.length===0?"Coverage locked":"Coverage broken"}),e.jsxs(d,{tone:"meta",children:[s.segments.length," normalized segment",s.segments.length===1?"":"s"]})]}),e.jsx("div",{className:"grid gap-2",children:s.segments.map(i=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-xs text-[var(--ui-ink-soft)]",children:[e.jsx(d,{tone:i.kind==="trip"?"signal":i.kind==="missing"?"meta":"default",children:i.kind}),e.jsx(d,{tone:"meta",children:i.origin}),e.jsxs("span",{children:[new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]}),e.jsx("span",{className:k,children:i.title})]},i.id))}),s.uncoveredIntervals.length>0?e.jsx("div",{className:"grid gap-2",children:s.uncoveredIntervals.map(i=>e.jsxs("div",{className:`rounded-[14px] border border-[color-mix(in_srgb,var(--danger)_28%,var(--ui-border-subtle)_72%)] bg-[var(--ui-danger-soft)] px-3 py-2 text-xs ${M}`,children:["Uncovered:"," ",new Date(i.startedAt).toLocaleTimeString()," →"," ",new Date(i.endedAt).toLocaleTimeString()]},`${i.startedAt}-${i.endedAt}`))}):null]},t.id)})})]}),e.jsxs(h,{className:v,children:[e.jsxs("div",{children:[e.jsx("div",{className:A,children:"Canonical box layers"}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${p}`,children:"Raw phone measurements stay immutable. Forge generates automatic boxes from them, user-defined boxes override them, and the final projected boxes are what both the web and iPhone should render."})]}),e.jsx("div",{className:"grid gap-4",children:U.map(t=>e.jsxs("div",{className:x,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:f,children:t.title}),e.jsxs(d,{tone:"meta",children:["Raw: ",t.rawMeasurements.length]}),e.jsxs(d,{tone:"meta",children:["Automatic: ",t.automaticBoxes.length]}),e.jsxs(d,{tone:"meta",children:["User: ",t.userBoxes.length]}),e.jsxs(d,{tone:"signal",children:["Projected: ",t.projectedBoxes.length]})]}),e.jsxs("div",{className:"grid gap-3 xl:grid-cols-4",children:[e.jsxs("div",{className:b,children:[e.jsx("div",{className:S,children:"Raw measurements"}),t.rawMeasurements.map(s=>e.jsxs("div",{className:j,children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.label}),e.jsxs("div",{children:[new Date(s.startedAt).toLocaleTimeString()," →"," ",new Date(s.endedAt).toLocaleTimeString()]})]},s.id))]}),e.jsxs("div",{className:b,children:[e.jsx("div",{className:S,children:"Automatic boxes"}),t.automaticBoxes.map(s=>e.jsxs("div",{className:j,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{tone:s.kind==="trip"?"signal":s.kind==="missing"?"meta":"default",children:s.kind}),e.jsx(d,{tone:"meta",children:s.origin})]}),e.jsx("div",{className:"mt-2 font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsxs("div",{children:[new Date(s.startedAt).toLocaleTimeString()," →"," ",new Date(s.endedAt).toLocaleTimeString()]})]},s.id))]}),e.jsxs("div",{className:b,children:[e.jsx("div",{className:S,children:"User-defined boxes"}),t.userBoxes.map(s=>e.jsxs("div",{className:j,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{tone:s.kind==="missing"?"meta":"default",children:s.kind}),e.jsx(d,{className:J,children:s.origin})]}),e.jsx("div",{className:"mt-2 font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsxs("div",{children:[new Date(s.startedAt).toLocaleTimeString()," →"," ",new Date(s.endedAt).toLocaleTimeString()]}),e.jsxs("div",{className:`mt-1 ${k}`,children:["Overrides ",s.overrideCount," automatic box",s.overrideCount===1?"":"es"]})]},s.id))]}),e.jsxs("div",{className:b,children:[e.jsx("div",{className:S,children:"Projected visible boxes"}),t.projectedBoxes.map(s=>e.jsxs("div",{className:j,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{tone:s.kind==="trip"?"signal":s.kind==="missing"?"meta":"default",children:s.kind}),e.jsx(d,{tone:"meta",children:s.sourceKind})]}),e.jsx("div",{className:"mt-2 font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsxs("div",{children:[new Date(s.startedAt).toLocaleTimeString()," →"," ",new Date(s.endedAt).toLocaleTimeString()]}),e.jsxs("div",{className:`mt-1 ${k}`,children:[s.origin,s.overrideCount>0?` · overrides ${s.overrideCount}`:""]})]},s.id))]})]})]},t.id))})]})]})}export{ae as CompanionSyncLabPage};
|
package/dist/assets/{daily-metrics-dashboard-CqnGJNeI.js → daily-metrics-dashboard-B3UCGG1t.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bL as j,j as e,d0 as S,d1 as V,aI as L,d2 as P,d3 as T,d4 as R,aG as $,aX as z,r as v,cW as K,aK as F}from"./vendor-Dnkkx2co.js";import{R as O,P as B,O as A,C as W,T as G,D as I,a as E}from"./ui-C1iwpj2-.js";import{C as w,Z as c,c as u}from"./index-BhkubYaC.js";import{R as X,d as H,C as _,X as Y,Y as Z,b as q,T as J,B as Q,a as U}from"./charts-DFnEuIMB.js";function g(a){return a?new Date(`${a}T12:00:00`).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"No date yet"}function ee(a,r){return r==="cumulative"?a.total??a.latest??a.maximum??a.average:a.latest??a.average??a.maximum??a.minimum}function o(a,r){if(r==null)return"No reading";const s=a.unit==="steps"||a.unit==="flights"||a.unit==="kcal"||a.unit==="min"||a.unit==="swears"||a.unit==="conversations"||a.unit==="messages"?0:(a.unit==="%",1);return`${r.toLocaleString(void 0,{maximumFractionDigits:s,minimumFractionDigits:s===0||r>=100?0:1})} ${a.unit}`}function k(a){return a.deltaValue==null?"No baseline yet":`${a.deltaValue>0?"+":""}${o(a,a.deltaValue)}`}function ae(a){return Math.round(a*10)/10}const p={fill:"var(--ui-ink-faint)",fontSize:11},se={stroke:"var(--ui-border-subtle)"},re="var(--ui-border-subtle)",te={stroke:"var(--ui-border-strong)",strokeWidth:1};function N(a,r){return ee(a,r)}function f(a){const r=a.days.map(s=>N(s,a.aggregation)).filter(s=>s!=null);return r.length===0?{minimum:null,average:null,maximum:null,count:0}:{minimum:Math.min(...r),average:r.reduce((s,i)=>s+i,0)/r.length,maximum:Math.max(...r),count:r.length}}function y(a){return new Date(`${a}T12:00:00`).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ie({active:a,payload:r,label:s,metric:i}){var t;if(!a||!(r!=null&&r.length)||typeof s!="string")return null;const l=((t=r.find(n=>typeof n.value=="number"))==null?void 0:t.value)??null;return e.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-3 py-2 text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:y(s)}),e.jsx("div",{className:"mt-1 text-sm font-semibold text-[var(--ui-ink-strong)]",children:o(i,l)})]})}function D({metric:a,height:r=180,detailed:s=!1}){const i=v.useMemo(()=>f(a),[a]),l=v.useMemo(()=>a.days.map(d=>({dateKey:d.dateKey,value:N(d,a.aggregation),sampleCount:d.sampleCount})),[a]),t=l.map(d=>d.value).filter(d=>d!=null),n=t.length>0?Math.min(...t):0,h=t.length>0?Math.max(...t):1,b=Math.max((h-n)*.12,a.unit==="%"?2:1),M=x(a.category),m=`metric-gradient-${a.metric.replace(/[^a-z0-9]/gi,"-")}`;return t.length===0?e.jsx("div",{className:"flex items-center justify-center rounded-[22px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-center text-sm text-[var(--ui-ink-faint)]",style:{height:r},children:"Waiting for chart data"}):e.jsx("div",{className:c("overflow-hidden rounded-[22px] border bg-[var(--ui-surface-1)] p-3",M.ring),style:{height:r},children:e.jsx(X,{width:"100%",height:"100%",children:e.jsxs(H,{data:l,margin:{top:s?18:8,right:s?18:4,bottom:s?12:0,left:s?8:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:m,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--primary)",stopOpacity:.55}),e.jsx("stop",{offset:"56%",stopColor:"var(--warning)",stopOpacity:.22}),e.jsx("stop",{offset:"100%",stopColor:"var(--warning)",stopOpacity:.02})]})}),e.jsx(_,{stroke:re,vertical:s}),e.jsx(Y,{dataKey:"dateKey",tickFormatter:y,minTickGap:s?22:34,tick:p,axisLine:se,tickLine:!1}),e.jsx(Z,{width:s?62:36,domain:[Math.max(0,n-b),h+b],tickFormatter:d=>o(a,Number(d)).replace(` ${a.unit}`,""),tick:p,axisLine:!1,tickLine:!1}),i.average!=null?e.jsx(q,{y:ae(i.average),stroke:"var(--ui-ink-faint)",strokeDasharray:"5 5",ifOverflow:"extendDomain"}):null,e.jsx(J,{cursor:te,content:e.jsx(ie,{metric:a})}),a.aggregation==="cumulative"?e.jsx(Q,{dataKey:"value",radius:[8,8,2,2],fill:`url(#${m})`,maxBarSize:s?34:20}):e.jsx(U,{type:"monotone",dataKey:"value",stroke:"var(--primary)",strokeWidth:s?3:2,fill:`url(#${m})`,dot:s?{r:3,fill:"var(--warning)"}:!1,activeDot:{r:5,fill:"var(--warning)"}})]})})})}function ne({metric:a,open:r,onOpenChange:s}){const i=f(a),l=x(a.category);return e.jsx(O,{open:r,onOpenChange:s,children:e.jsxs(B,{children:[e.jsx(A,{className:"fixed inset-0 z-50 bg-[var(--overlay)] backdrop-blur-xl"}),e.jsxs(W,{className:"fixed inset-3 z-[51] grid min-h-0 overflow-hidden rounded-[32px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] shadow-[var(--ui-shadow-floating)] sm:inset-5",children:[e.jsxs(G,{className:"sr-only",children:[a.label," chart"]}),e.jsx(I,{className:"sr-only",children:"Full-screen time-series chart for the selected daily metric."}),e.jsxs("div",{className:"grid min-h-0 grid-rows-[auto_minmax(0,1fr)]",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-[var(--ui-border-subtle)] px-5 py-4 sm:px-6",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:[a.category," time series"]}),e.jsx("div",{className:"mt-1 break-words text-2xl font-semibold text-[var(--ui-ink-strong)] sm:text-3xl",children:a.label}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-[var(--ui-ink-soft)]",children:[e.jsx(u,{className:l.badge,children:a.aggregation}),e.jsxs(u,{tone:"meta",children:[a.coverageDays," tracked days"]}),e.jsxs(u,{tone:"meta",children:["latest ",g(a.latestDateKey)]})]})]}),e.jsx(E,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex size-11 items-center justify-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]","aria-label":"Close metric chart",children:e.jsx(F,{className:"size-5"})})})]}),e.jsxs("div",{className:"grid min-h-0 gap-4 overflow-y-auto p-4 sm:p-6 lg:grid-cols-[minmax(0,1fr)_18rem]",children:[e.jsx(D,{metric:a,height:560,detailed:!0}),e.jsx("div",{className:"grid content-start gap-3",children:[["Latest",a.latestValue],["Period min",i.minimum],["Period average",i.average],["Period max",i.maximum],["Baseline",a.baselineValue],["Delta",a.deltaValue]].map(([t,n])=>e.jsxs("div",{className:"rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:t}),e.jsx("div",{className:"mt-1 break-words text-xl font-semibold text-[var(--ui-ink-strong)]",children:o(a,typeof n=="number"?n:null)})]},String(t)))})]})]})]})]})})}function le(a){return a.deltaValue==null||a.deltaValue===0?"steady":a.deltaValue>0?"up":"down"}function x(a){switch(a){case"recovery":return{ring:"border-[var(--danger)]/20",badge:"bg-[var(--ui-danger-soft)] text-[var(--danger)]",glow:"from-[var(--ui-danger-soft)] via-[var(--ui-surface-2)] to-transparent"};case"cardio":return{ring:"border-[var(--info)]/24",badge:"bg-[var(--ui-info-soft)] text-[var(--info)]",glow:"from-[var(--ui-info-soft)] via-[var(--ui-surface-2)] to-transparent"};case"breathing":return{ring:"border-[var(--success)]/22",badge:"bg-[var(--ui-success-soft)] text-[var(--success)]",glow:"from-[var(--ui-success-soft)] via-[var(--ui-surface-2)] to-transparent"};case"composition":return{ring:"border-[var(--warning)]/22",badge:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",glow:"from-[var(--ui-warning-soft)] via-[var(--ui-surface-2)] to-transparent"};case"temperature":return{ring:"border-[var(--warning)]/22",badge:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",glow:"from-[var(--ui-warning-soft)] via-[var(--ui-surface-2)] to-transparent"};case"conversationTone":return{ring:"border-[var(--warning)]/22",badge:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",glow:"from-[var(--ui-warning-soft)] via-[var(--ui-surface-2)] to-transparent"};default:return{ring:"border-[var(--ui-border-subtle)]",badge:"bg-[var(--ui-accent-soft)] text-[var(--primary)]",glow:"from-[var(--ui-accent-soft)] via-[var(--ui-surface-2)] to-transparent"}}}function C(a){switch(a){case"restingHeartRate":case"walkingHeartRateAverage":case"heartRateRecoveryOneMinute":return z;case"heartRateVariabilitySDNN":case"vo2Max":return $;case"oxygenSaturation":case"respiratoryRate":return R;case"bodyMass":case"bodyFatPercentage":case"leanBodyMass":return T;case"stepCount":case"flightsClimbed":case"appleExerciseTime":return P;case"basalEnergyBurned":return L;case"swearingMessagePercent":return V;case"devrageSwearCount":return S;default:return j}}function me({title:a,description:r,metric:s,emptyDescription:i}){const l=s?C(s.metric):j,t=x(s?s.category:"default"),n=s?le(s):"steady";return e.jsxs(w,{className:c("relative overflow-hidden rounded-[28px] border bg-[var(--ui-surface-section)] p-5 shadow-[var(--card-shadow)]",t.ring),children:[e.jsx("div",{className:c("pointer-events-none absolute inset-0 bg-gradient-to-br opacity-90",t.glow)}),e.jsxs("div",{className:"relative grid gap-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"grid min-w-0 gap-1",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:a}),e.jsx("div",{className:"break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:r})]}),e.jsx("div",{className:"shrink-0 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3 text-[var(--ui-ink-medium)]",children:e.jsx(l,{className:"size-5"})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"break-words text-xl font-semibold text-[var(--ui-ink-strong)]",children:s?o(s,s.latestValue):"No signal yet"}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-[var(--ui-ink-soft)]",children:[s?e.jsx(u,{className:t.badge,children:s.label}):null,s?e.jsx(u,{className:c("border-none",n==="up"?"bg-[var(--ui-success-soft)] text-[var(--success)]":n==="down"?"bg-[var(--ui-danger-soft)] text-[var(--danger)]":"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]"),children:k(s)}):null,s?e.jsxs(u,{tone:"meta",children:[s.coverageDays," days tracked"]}):null]}),e.jsx("div",{className:"break-words text-xs text-[var(--ui-ink-faint)]",children:s?`Latest reading on ${g(s.latestDateKey)}`:i??"Forge will populate this card as soon as daily readings are available."})]})]})]})}function oe({metric:a}){const[r,s]=v.useState(!1),i=C(a.metric),l=x(a.category),t=a.days.at(-1),n=f(a);return e.jsxs(w,{className:c("overflow-hidden rounded-[28px] border bg-[var(--ui-surface-section)] p-5",l.ring),children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-4",children:[e.jsx("div",{className:"shrink-0 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3 text-[var(--ui-ink-medium)]",children:e.jsx(i,{className:"size-5"})}),e.jsxs("div",{className:"grid min-w-0 gap-1",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:a.category}),e.jsx("div",{className:"break-words text-xl font-semibold text-[var(--ui-ink-strong)]",children:a.label}),e.jsxs("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:[a.coverageDays," tracked day",a.coverageDays===1?"":"s"]})]})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 sm:shrink-0 sm:justify-end",children:[e.jsx(u,{className:l.badge,children:a.aggregation}),e.jsxs("button",{type:"button",className:"inline-flex min-h-9 min-w-0 max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-1.5 text-xs font-medium text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:()=>s(!0),children:[e.jsx(K,{className:"size-3.5"}),"Full screen"]})]})]}),e.jsxs("div",{className:"mt-5 grid gap-4 md:grid-cols-[minmax(0,0.95fr)_minmax(220px,1.05fr)]",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Latest"}),e.jsx("div",{className:"mt-1 break-words text-3xl font-semibold text-[var(--ui-ink-strong)]",children:o(a,a.latestValue)}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:a.latestDateKey?`Latest reading on ${g(a.latestDateKey)}`:"Waiting for the first successful reading"})]}),e.jsxs("div",{className:"grid gap-2 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 text-sm text-[var(--ui-ink-medium)]",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[e.jsx("span",{className:"min-w-0",children:"Baseline"}),e.jsx("span",{className:"min-w-0 break-words text-right font-medium text-[var(--ui-ink-strong)]",children:o(a,a.baselineValue)})]}),e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[e.jsx("span",{className:"min-w-0",children:"Delta"}),e.jsx("span",{className:c("min-w-0 break-words text-right font-medium",a.deltaValue==null?"text-[var(--ui-ink-soft)]":a.deltaValue>0?"text-[var(--success)]":a.deltaValue<0?"text-[var(--danger)]":"text-[var(--ui-ink-strong)]"),children:k(a)})]}),e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[e.jsx("span",{className:"min-w-0",children:"Latest samples"}),e.jsx("span",{className:"min-w-0 break-words text-right font-medium text-[var(--ui-ink-strong)]",children:(t==null?void 0:t.sampleCount)??0})]})]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(D,{metric:a}),e.jsxs("div",{className:"grid gap-2 text-xs text-[var(--ui-ink-faint)] sm:grid-cols-3",children:[e.jsxs("div",{className:"min-w-0 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2",children:[e.jsx("div",{children:"Period min"}),e.jsx("div",{className:"mt-1 break-words font-medium text-[var(--ui-ink-medium)]",children:o(a,n.minimum)})]}),e.jsxs("div",{className:"min-w-0 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2",children:[e.jsx("div",{children:"Period avg"}),e.jsx("div",{className:"mt-1 break-words font-medium text-[var(--ui-ink-medium)]",children:o(a,n.average)})]}),e.jsxs("div",{className:"min-w-0 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2",children:[e.jsx("div",{children:"Period max"}),e.jsx("div",{className:"mt-1 break-words font-medium text-[var(--ui-ink-medium)]",children:o(a,n.maximum)})]})]})]})]}),e.jsx(ne,{metric:a,open:r,onOpenChange:s})]})}function ve({groups:a}){return e.jsx("section",{className:"grid gap-5",children:a.map(r=>e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:r.category}),e.jsxs("div",{className:"mt-1 break-words text-2xl font-semibold text-[var(--ui-ink-strong)]",children:[r.metrics.length," signals in this lane"]})]}),e.jsxs(u,{className:x(r.category).badge,children:[r.coverageDays," days of coverage"]})]}),e.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:r.metrics.map(s=>e.jsx(oe,{metric:s},s.metric))})]},r.category))})}export{ve as M,me as S,g as f,x as m};
|
|
1
|
+
import{bL as j,j as e,d0 as S,d1 as V,aI as L,d2 as P,d3 as T,d4 as R,aG as $,aX as z,r as v,cW as K,aK as F}from"./vendor-Dnkkx2co.js";import{R as O,P as B,O as A,C as W,T as G,D as I,a as E}from"./ui-C1iwpj2-.js";import{C as w,Z as c,c as u}from"./index-BP9__l6C.js";import{R as X,d as H,C as _,X as Y,Y as Z,b as q,T as J,B as Q,a as U}from"./charts-DFnEuIMB.js";function g(a){return a?new Date(`${a}T12:00:00`).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"No date yet"}function ee(a,r){return r==="cumulative"?a.total??a.latest??a.maximum??a.average:a.latest??a.average??a.maximum??a.minimum}function o(a,r){if(r==null)return"No reading";const s=a.unit==="steps"||a.unit==="flights"||a.unit==="kcal"||a.unit==="min"||a.unit==="swears"||a.unit==="conversations"||a.unit==="messages"?0:(a.unit==="%",1);return`${r.toLocaleString(void 0,{maximumFractionDigits:s,minimumFractionDigits:s===0||r>=100?0:1})} ${a.unit}`}function k(a){return a.deltaValue==null?"No baseline yet":`${a.deltaValue>0?"+":""}${o(a,a.deltaValue)}`}function ae(a){return Math.round(a*10)/10}const p={fill:"var(--ui-ink-faint)",fontSize:11},se={stroke:"var(--ui-border-subtle)"},re="var(--ui-border-subtle)",te={stroke:"var(--ui-border-strong)",strokeWidth:1};function N(a,r){return ee(a,r)}function f(a){const r=a.days.map(s=>N(s,a.aggregation)).filter(s=>s!=null);return r.length===0?{minimum:null,average:null,maximum:null,count:0}:{minimum:Math.min(...r),average:r.reduce((s,i)=>s+i,0)/r.length,maximum:Math.max(...r),count:r.length}}function y(a){return new Date(`${a}T12:00:00`).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ie({active:a,payload:r,label:s,metric:i}){var t;if(!a||!(r!=null&&r.length)||typeof s!="string")return null;const l=((t=r.find(n=>typeof n.value=="number"))==null?void 0:t.value)??null;return e.jsxs("div",{className:"rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--surface-glass)] px-3 py-2 text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:y(s)}),e.jsx("div",{className:"mt-1 text-sm font-semibold text-[var(--ui-ink-strong)]",children:o(i,l)})]})}function D({metric:a,height:r=180,detailed:s=!1}){const i=v.useMemo(()=>f(a),[a]),l=v.useMemo(()=>a.days.map(d=>({dateKey:d.dateKey,value:N(d,a.aggregation),sampleCount:d.sampleCount})),[a]),t=l.map(d=>d.value).filter(d=>d!=null),n=t.length>0?Math.min(...t):0,h=t.length>0?Math.max(...t):1,b=Math.max((h-n)*.12,a.unit==="%"?2:1),M=x(a.category),m=`metric-gradient-${a.metric.replace(/[^a-z0-9]/gi,"-")}`;return t.length===0?e.jsx("div",{className:"flex items-center justify-center rounded-[22px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 text-center text-sm text-[var(--ui-ink-faint)]",style:{height:r},children:"Waiting for chart data"}):e.jsx("div",{className:c("overflow-hidden rounded-[22px] border bg-[var(--ui-surface-1)] p-3",M.ring),style:{height:r},children:e.jsx(X,{width:"100%",height:"100%",children:e.jsxs(H,{data:l,margin:{top:s?18:8,right:s?18:4,bottom:s?12:0,left:s?8:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:m,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--primary)",stopOpacity:.55}),e.jsx("stop",{offset:"56%",stopColor:"var(--warning)",stopOpacity:.22}),e.jsx("stop",{offset:"100%",stopColor:"var(--warning)",stopOpacity:.02})]})}),e.jsx(_,{stroke:re,vertical:s}),e.jsx(Y,{dataKey:"dateKey",tickFormatter:y,minTickGap:s?22:34,tick:p,axisLine:se,tickLine:!1}),e.jsx(Z,{width:s?62:36,domain:[Math.max(0,n-b),h+b],tickFormatter:d=>o(a,Number(d)).replace(` ${a.unit}`,""),tick:p,axisLine:!1,tickLine:!1}),i.average!=null?e.jsx(q,{y:ae(i.average),stroke:"var(--ui-ink-faint)",strokeDasharray:"5 5",ifOverflow:"extendDomain"}):null,e.jsx(J,{cursor:te,content:e.jsx(ie,{metric:a})}),a.aggregation==="cumulative"?e.jsx(Q,{dataKey:"value",radius:[8,8,2,2],fill:`url(#${m})`,maxBarSize:s?34:20}):e.jsx(U,{type:"monotone",dataKey:"value",stroke:"var(--primary)",strokeWidth:s?3:2,fill:`url(#${m})`,dot:s?{r:3,fill:"var(--warning)"}:!1,activeDot:{r:5,fill:"var(--warning)"}})]})})})}function ne({metric:a,open:r,onOpenChange:s}){const i=f(a),l=x(a.category);return e.jsx(O,{open:r,onOpenChange:s,children:e.jsxs(B,{children:[e.jsx(A,{className:"fixed inset-0 z-50 bg-[var(--overlay)] backdrop-blur-xl"}),e.jsxs(W,{className:"fixed inset-3 z-[51] grid min-h-0 overflow-hidden rounded-[32px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] shadow-[var(--ui-shadow-floating)] sm:inset-5",children:[e.jsxs(G,{className:"sr-only",children:[a.label," chart"]}),e.jsx(I,{className:"sr-only",children:"Full-screen time-series chart for the selected daily metric."}),e.jsxs("div",{className:"grid min-h-0 grid-rows-[auto_minmax(0,1fr)]",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-[var(--ui-border-subtle)] px-5 py-4 sm:px-6",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:[a.category," time series"]}),e.jsx("div",{className:"mt-1 break-words text-2xl font-semibold text-[var(--ui-ink-strong)] sm:text-3xl",children:a.label}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-[var(--ui-ink-soft)]",children:[e.jsx(u,{className:l.badge,children:a.aggregation}),e.jsxs(u,{tone:"meta",children:[a.coverageDays," tracked days"]}),e.jsxs(u,{tone:"meta",children:["latest ",g(a.latestDateKey)]})]})]}),e.jsx(E,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex size-11 items-center justify-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]","aria-label":"Close metric chart",children:e.jsx(F,{className:"size-5"})})})]}),e.jsxs("div",{className:"grid min-h-0 gap-4 overflow-y-auto p-4 sm:p-6 lg:grid-cols-[minmax(0,1fr)_18rem]",children:[e.jsx(D,{metric:a,height:560,detailed:!0}),e.jsx("div",{className:"grid content-start gap-3",children:[["Latest",a.latestValue],["Period min",i.minimum],["Period average",i.average],["Period max",i.maximum],["Baseline",a.baselineValue],["Delta",a.deltaValue]].map(([t,n])=>e.jsxs("div",{className:"rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:t}),e.jsx("div",{className:"mt-1 break-words text-xl font-semibold text-[var(--ui-ink-strong)]",children:o(a,typeof n=="number"?n:null)})]},String(t)))})]})]})]})]})})}function le(a){return a.deltaValue==null||a.deltaValue===0?"steady":a.deltaValue>0?"up":"down"}function x(a){switch(a){case"recovery":return{ring:"border-[var(--danger)]/20",badge:"bg-[var(--ui-danger-soft)] text-[var(--danger)]",glow:"from-[var(--ui-danger-soft)] via-[var(--ui-surface-2)] to-transparent"};case"cardio":return{ring:"border-[var(--info)]/24",badge:"bg-[var(--ui-info-soft)] text-[var(--info)]",glow:"from-[var(--ui-info-soft)] via-[var(--ui-surface-2)] to-transparent"};case"breathing":return{ring:"border-[var(--success)]/22",badge:"bg-[var(--ui-success-soft)] text-[var(--success)]",glow:"from-[var(--ui-success-soft)] via-[var(--ui-surface-2)] to-transparent"};case"composition":return{ring:"border-[var(--warning)]/22",badge:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",glow:"from-[var(--ui-warning-soft)] via-[var(--ui-surface-2)] to-transparent"};case"temperature":return{ring:"border-[var(--warning)]/22",badge:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",glow:"from-[var(--ui-warning-soft)] via-[var(--ui-surface-2)] to-transparent"};case"conversationTone":return{ring:"border-[var(--warning)]/22",badge:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",glow:"from-[var(--ui-warning-soft)] via-[var(--ui-surface-2)] to-transparent"};default:return{ring:"border-[var(--ui-border-subtle)]",badge:"bg-[var(--ui-accent-soft)] text-[var(--primary)]",glow:"from-[var(--ui-accent-soft)] via-[var(--ui-surface-2)] to-transparent"}}}function C(a){switch(a){case"restingHeartRate":case"walkingHeartRateAverage":case"heartRateRecoveryOneMinute":return z;case"heartRateVariabilitySDNN":case"vo2Max":return $;case"oxygenSaturation":case"respiratoryRate":return R;case"bodyMass":case"bodyFatPercentage":case"leanBodyMass":return T;case"stepCount":case"flightsClimbed":case"appleExerciseTime":return P;case"basalEnergyBurned":return L;case"swearingMessagePercent":return V;case"devrageSwearCount":return S;default:return j}}function me({title:a,description:r,metric:s,emptyDescription:i}){const l=s?C(s.metric):j,t=x(s?s.category:"default"),n=s?le(s):"steady";return e.jsxs(w,{className:c("relative overflow-hidden rounded-[28px] border bg-[var(--ui-surface-section)] p-5 shadow-[var(--card-shadow)]",t.ring),children:[e.jsx("div",{className:c("pointer-events-none absolute inset-0 bg-gradient-to-br opacity-90",t.glow)}),e.jsxs("div",{className:"relative grid gap-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"grid min-w-0 gap-1",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:a}),e.jsx("div",{className:"break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:r})]}),e.jsx("div",{className:"shrink-0 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3 text-[var(--ui-ink-medium)]",children:e.jsx(l,{className:"size-5"})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"break-words text-xl font-semibold text-[var(--ui-ink-strong)]",children:s?o(s,s.latestValue):"No signal yet"}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-[var(--ui-ink-soft)]",children:[s?e.jsx(u,{className:t.badge,children:s.label}):null,s?e.jsx(u,{className:c("border-none",n==="up"?"bg-[var(--ui-success-soft)] text-[var(--success)]":n==="down"?"bg-[var(--ui-danger-soft)] text-[var(--danger)]":"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]"),children:k(s)}):null,s?e.jsxs(u,{tone:"meta",children:[s.coverageDays," days tracked"]}):null]}),e.jsx("div",{className:"break-words text-xs text-[var(--ui-ink-faint)]",children:s?`Latest reading on ${g(s.latestDateKey)}`:i??"Forge will populate this card as soon as daily readings are available."})]})]})]})}function oe({metric:a}){const[r,s]=v.useState(!1),i=C(a.metric),l=x(a.category),t=a.days.at(-1),n=f(a);return e.jsxs(w,{className:c("overflow-hidden rounded-[28px] border bg-[var(--ui-surface-section)] p-5",l.ring),children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-4",children:[e.jsx("div",{className:"shrink-0 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3 text-[var(--ui-ink-medium)]",children:e.jsx(i,{className:"size-5"})}),e.jsxs("div",{className:"grid min-w-0 gap-1",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:a.category}),e.jsx("div",{className:"break-words text-xl font-semibold text-[var(--ui-ink-strong)]",children:a.label}),e.jsxs("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:[a.coverageDays," tracked day",a.coverageDays===1?"":"s"]})]})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 sm:shrink-0 sm:justify-end",children:[e.jsx(u,{className:l.badge,children:a.aggregation}),e.jsxs("button",{type:"button",className:"inline-flex min-h-9 min-w-0 max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-1.5 text-xs font-medium text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:()=>s(!0),children:[e.jsx(K,{className:"size-3.5"}),"Full screen"]})]})]}),e.jsxs("div",{className:"mt-5 grid gap-4 md:grid-cols-[minmax(0,0.95fr)_minmax(220px,1.05fr)]",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Latest"}),e.jsx("div",{className:"mt-1 break-words text-3xl font-semibold text-[var(--ui-ink-strong)]",children:o(a,a.latestValue)}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:a.latestDateKey?`Latest reading on ${g(a.latestDateKey)}`:"Waiting for the first successful reading"})]}),e.jsxs("div",{className:"grid gap-2 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4 text-sm text-[var(--ui-ink-medium)]",children:[e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[e.jsx("span",{className:"min-w-0",children:"Baseline"}),e.jsx("span",{className:"min-w-0 break-words text-right font-medium text-[var(--ui-ink-strong)]",children:o(a,a.baselineValue)})]}),e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[e.jsx("span",{className:"min-w-0",children:"Delta"}),e.jsx("span",{className:c("min-w-0 break-words text-right font-medium",a.deltaValue==null?"text-[var(--ui-ink-soft)]":a.deltaValue>0?"text-[var(--success)]":a.deltaValue<0?"text-[var(--danger)]":"text-[var(--ui-ink-strong)]"),children:k(a)})]}),e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[e.jsx("span",{className:"min-w-0",children:"Latest samples"}),e.jsx("span",{className:"min-w-0 break-words text-right font-medium text-[var(--ui-ink-strong)]",children:(t==null?void 0:t.sampleCount)??0})]})]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsx(D,{metric:a}),e.jsxs("div",{className:"grid gap-2 text-xs text-[var(--ui-ink-faint)] sm:grid-cols-3",children:[e.jsxs("div",{className:"min-w-0 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2",children:[e.jsx("div",{children:"Period min"}),e.jsx("div",{className:"mt-1 break-words font-medium text-[var(--ui-ink-medium)]",children:o(a,n.minimum)})]}),e.jsxs("div",{className:"min-w-0 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2",children:[e.jsx("div",{children:"Period avg"}),e.jsx("div",{className:"mt-1 break-words font-medium text-[var(--ui-ink-medium)]",children:o(a,n.average)})]}),e.jsxs("div",{className:"min-w-0 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2",children:[e.jsx("div",{children:"Period max"}),e.jsx("div",{className:"mt-1 break-words font-medium text-[var(--ui-ink-medium)]",children:o(a,n.maximum)})]})]})]})]}),e.jsx(ne,{metric:a,open:r,onOpenChange:s})]})}function ve({groups:a}){return e.jsx("section",{className:"grid gap-5",children:a.map(r=>e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:r.category}),e.jsxs("div",{className:"mt-1 break-words text-2xl font-semibold text-[var(--ui-ink-strong)]",children:[r.metrics.length," signals in this lane"]})]}),e.jsxs(u,{className:x(r.category).badge,children:[r.coverageDays," days of coverage"]})]}),e.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:r.metrics.map(s=>e.jsx(oe,{metric:s},s.metric))})]},r.category))})}export{ve as M,me as S,g as f,x as m};
|
package/dist/assets/{entity-note-count-link-VMURwBMi.js → entity-note-count-link-DUxobQUt.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b5 as p,j as o,aS as l}from"./vendor-Dnkkx2co.js";import{ap as x,cN as f}from"./index-
|
|
1
|
+
import{b5 as p,j as o,aS as l}from"./vendor-Dnkkx2co.js";import{ap as x,cN as f}from"./index-BP9__l6C.js";function g({entityType:n,entityId:i,count:s,compact:r=!1,className:u=""}){const a=p(),t=x(n,i);return t?o.jsxs("span",{role:"link",tabIndex:0,className:`inline-flex items-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)] ${r?"min-h-5 gap-1 px-2 py-0.5 text-[10px]":"min-h-10 gap-2 px-3 py-2 text-xs"} ${u}`,onClick:e=>{e.stopPropagation(),a(t)},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),a(t))},children:[o.jsx(l,{className:r?"size-3":"size-3.5"}),f(s)]}):null}export{g as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as e,b4 as $e,b3 as We,cQ as Ke,ce as Xe,c7 as Pe}from"./vendor-Dnkkx2co.js";import{j as Ye,i as y,k as X}from"./state-vCcAT5Hq.js";import{u as Ze,bv as Y,cM as es,cn as u,ao as ss,bm as ts,bn as as,C as rs,aq as is,c as b,cN as ns,B as v,I as j,T as ze,bu as N,i as ls,bD as os,bw as ds,bx as cs,by as us,bz as ms,bA as ps,bB as xs,bC as ys}from"./index-BhkubYaC.js";import{N as Z}from"./note-markdown-CZHjJDve.js";import{n as ee,N as Me,f as vs,p as gs,b as hs}from"./note-tags-input-DFpxZHPg.js";function fs(o,d,c){return o.links.filter(p=>!(p.entityType===d&&p.entityId===c))}function bs(o,d){return o.entityType===d.entityType&&o.entityId===d.entityId&&(o.anchorKey??null)===(d.anchorKey??null)}function se(o){const d=new Set;return o.filter(c=>{const p=`${c.entityType}:${c.entityId}:${c.anchorKey??""}`;return d.has(p)?!1:(d.add(p),!0)})}function Fe(o,d,c){return gs(o)??hs(d,c)}function Cs({entityType:o,entityId:d,anchorKey:c,includeAnchorlessWhenAnchored:p=!1,title:Qe="Notes",description:Be="Markdown notes linked to this entity stay searchable, editable, and visible alongside the work.",invalidateQueryKeys:Ve=[],compact:te=!1}){var Ce,Se,De,Te,Le,Ie,Ee,Ae,qe;const m=Ze(),L=Ye(),[I,Oe]=l.useState(""),[ae,E]=l.useState(!1),[h,A]=l.useState(""),[re,q]=l.useState(!1),[Ue,$]=l.useState({entityType:"goal",entityId:""}),[ie,K]=l.useState([]),[ne,P]=l.useState([]),[le,z]=l.useState(""),[oe,M]=l.useState(""),[de,F]=l.useState("days"),[He,Q]=l.useState(null),[f,B]=l.useState(""),[ce,k]=l.useState(!1),[V,O]=l.useState([]),[Re,U]=l.useState({entityType:"goal",entityId:""}),[ue,w]=l.useState([]),[me,_]=l.useState(""),[pe,C]=l.useState(""),[xe,S]=l.useState("days"),H=Y(c),ye=es(o,c),g=y({queryKey:["notes",o,d],queryFn:()=>os({linkedEntityType:o,linkedEntityId:d,limit:100})}),ve=y({queryKey:["forge-psyche-values"],queryFn:ds}),ge=y({queryKey:["forge-psyche-patterns"],queryFn:cs}),he=y({queryKey:["forge-psyche-behaviors"],queryFn:us}),fe=y({queryKey:["forge-psyche-beliefs"],queryFn:ms}),be=y({queryKey:["forge-psyche-modes"],queryFn:ps}),je=y({queryKey:["forge-psyche-flashcards"],queryFn:xs}),Ne=y({queryKey:["forge-psyche-reports"],queryFn:ys}),R=l.useMemo(()=>{var s,n,r,a,x,i,D,T;return{goal:m.snapshot.goals.map(t=>({id:t.id,label:u(t.title,t.user)})),project:m.snapshot.dashboard.projects.map(t=>({id:t.id,label:u(t.title,t.user)})),task:m.snapshot.tasks.map(t=>({id:t.id,label:u(t.title,t.user)})),strategy:m.snapshot.strategies.map(t=>({id:t.id,label:u(t.title,t.user)})),habit:m.snapshot.habits.map(t=>({id:t.id,label:u(t.title,t.user)})),tag:m.snapshot.tags.map(t=>({id:t.id,label:u(t.name,t.user)})),note:(((s=g.data)==null?void 0:s.notes)??[]).map(t=>({id:t.id,label:t.contentPlain||t.contentMarkdown})),insight:[],psyche_value:(((n=ve.data)==null?void 0:n.values)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),behavior_pattern:(((r=ge.data)==null?void 0:r.patterns)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),behavior:(((a=he.data)==null?void 0:a.behaviors)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),belief_entry:(((x=fe.data)==null?void 0:x.beliefs)??[]).map(t=>({id:t.id,label:u(t.statement,t.user)})),mode_profile:(((i=be.data)==null?void 0:i.modes)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),flashcard:(((D=je.data)==null?void 0:D.flashcards)??[]).map(t=>({id:t.id,label:u(t.title||t.message,t.user)})),mode_guide_session:[],event_type:[],emotion_definition:[],trigger_report:(((T=Ne.data)==null?void 0:T.reports)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),calendar_event:[],work_block_template:[],task_timebox:[],preference_catalog:[],preference_catalog_item:[],preference_context:[],preference_item:[],questionnaire_instrument:[],sleep_session:[],workout_session:[]}},[(Ce=he.data)==null?void 0:Ce.behaviors,(Se=fe.data)==null?void 0:Se.beliefs,(De=je.data)==null?void 0:De.flashcards,(Te=be.data)==null?void 0:Te.modes,(Le=g.data)==null?void 0:Le.notes,(Ie=ge.data)==null?void 0:Ie.patterns,(Ee=Ne.data)==null?void 0:Ee.reports,m.snapshot.dashboard.projects,m.snapshot.goals,m.snapshot.habits,m.snapshot.strategies,m.snapshot.tags,m.snapshot.tasks,(Ae=ve.data)==null?void 0:Ae.values]),G=async()=>{await Promise.all([L.invalidateQueries({queryKey:["notes",o,d]}),ls(L),...Ve.map(s=>L.invalidateQueries({queryKey:s}))])},ke=X({mutationFn:async s=>ss({contentMarkdown:s,tags:ee(ne),destroyAt:Fe(le,oe,de),links:se([{entityType:o,entityId:d,anchorKey:c??null},...ie])}),onSuccess:async()=>{A(""),q(!1),K([]),$({entityType:"goal",entityId:""}),P([]),z(""),M(""),F("days"),await G()}}),we=X({mutationFn:async({noteId:s,contentMarkdown:n,links:r,tags:a,destroyAt:x})=>ts(s,{contentMarkdown:n,links:r,tags:a,destroyAt:x}),onSuccess:async()=>{Q(null),B(""),k(!1),O([]),U({entityType:"goal",entityId:""}),w([]),_(""),C(""),S("days"),await G()}}),Ge=X({mutationFn:async s=>as(s),onSuccess:G}),J=l.useMemo(()=>{var n;return(((n=g.data)==null?void 0:n.notes)??[]).filter(r=>c===void 0?!0:r.links.some(a=>a.entityType===o&&a.entityId===d&&((a.anchorKey??null)===c||p&&(a.anchorKey??null)===null))).filter(r=>{const a=I.trim().toLowerCase();return a?`${r.contentPlain} ${r.author??""} ${(r.tags??[]).join(" ")}`.toLowerCase().includes(a):!0})},[c,d,o,p,(qe=g.data)==null?void 0:qe.notes,I]),Je=(s,n,r)=>{const a=s.entityId.trim();return a?(n(se([...r,{entityType:s.entityType,entityId:a,anchorKey:null}])),!0):!1},W=s=>{var r,a;const n=(r=R[s.entityType])==null?void 0:r.find(x=>x.id===s.entityId);return(a=n==null?void 0:n.label)!=null&&a.trim()?n.label.trim():`Deleted ${N(s.entityType)}`},_e=(s,n,r,a,x)=>e.jsxs("div",{className:"min-w-0 rounded-[20px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Linked entities"}),e.jsxs(b,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[s.length," linked"]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:s.map(i=>{const D=s.length>1;return e.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-full bg-[var(--ui-surface-2)] px-3 py-2 text-sm text-[var(--ui-ink-medium)]",children:[e.jsxs("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:[N(i.entityType)," · ",W(i)]}),i.anchorKey?e.jsx("span",{className:"shrink-0 rounded-full bg-[var(--ui-surface-3)] px-2 py-0.5 text-[11px] text-[var(--ui-ink-soft)]",children:Y(i.anchorKey)}):null,e.jsx("button",{type:"button",disabled:!D,className:"shrink-0 text-[var(--ui-ink-faint)] transition hover:text-[var(--ui-ink-strong)] disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>n(s.filter(T=>!bs(T,i))),"aria-label":`Remove ${N(i.entityType)} link to ${W(i)}`,children:e.jsx(Pe,{className:"size-3.5"})})]},`${x}-${i.entityType}-${i.entityId}-${i.anchorKey??""}`)})}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,11rem)_minmax(0,1fr)_auto]",children:[e.jsx("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)]",value:r.entityType,onChange:i=>a({...r,entityType:i.target.value,entityId:""}),children:["goal","project","task","strategy","habit","tag","note","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","mode_guide_session","flashcard","event_type","emotion_definition","trigger_report"].map(i=>e.jsx("option",{value:i,children:N(i)},i))}),e.jsxs("select",{className:"min-w-0 rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)]",value:r.entityId,onChange:i=>a({...r,entityId:i.target.value}),children:[e.jsx("option",{value:"",children:(R[r.entityType]??[]).length>0?"Choose linked item":"No linked items available"}),(R[r.entityType]??[]).map(i=>e.jsx("option",{value:i.id,children:i.label},i.id))]}),e.jsx(v,{variant:"secondary",disabled:!r.entityId,onClick:()=>{Je(r,n,s)&&a({...r,entityId:""})},children:"Add link"})]})]});return e.jsx(rs,{id:"notes",className:te?"min-w-0 overflow-hidden p-0":"min-w-0 overflow-hidden",children:e.jsxs("div",{className:te?"p-4":void 0,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:Qe}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:Be}),H?e.jsxs("div",{className:"mt-3 inline-flex max-w-full items-center gap-2 rounded-full bg-[var(--ui-surface-1)] px-3 py-2 text-xs text-[var(--ui-ink-soft)]",children:[e.jsxs("span",{children:["Pinned to ",H]}),ye?e.jsx(is,{content:ye,label:`Explain ${H}`}):null]}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(b,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:ns(J.length)}),ae?null:e.jsxs(v,{type:"button",size:"sm",onClick:()=>E(!0),children:[e.jsx($e,{className:"size-4"}),"Add note"]})]})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3",children:[e.jsx(We,{className:"size-4 text-[var(--ui-ink-faint)]"}),e.jsx(j,{value:I,onChange:s=>Oe(s.target.value),placeholder:"Search notes by content, author, or note tag",className:"border-0 bg-transparent px-0 py-0"})]}),ae?e.jsxs("div",{className:"mt-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-medium)]",children:[e.jsx($e,{className:"size-4 text-[var(--secondary)]"}),"Add note"]}),e.jsxs(v,{type:"button",variant:"secondary",size:"sm",className:"gap-2",onClick:()=>q(s=>!s),children:[e.jsx(Ke,{className:"size-4"}),re?"Back to editor":"Preview"]})]}),e.jsx("div",{className:"mt-3",children:re?e.jsxs("div",{className:"rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:h.trim()?e.jsx(Z,{markdown:h}):e.jsx("div",{className:"text-sm leading-6 text-[var(--ui-ink-faint)]",children:"Markdown preview appears here once you have note content."})})]}):e.jsx(ze,{value:h,onChange:s=>A(s.target.value),placeholder:"Write in Markdown. Summaries, blockers, what changed, and why all work well here.",className:"min-h-[12rem]"})}),e.jsx("div",{className:"mt-3",children:_e(se([{entityType:o,entityId:d,anchorKey:c??null},...ie]),s=>K(s.filter(n=>!(n.entityType===o&&n.entityId===d&&(n.anchorKey??null)===(c??null)))),Ue,$,"composer-note-links")}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(Me,{value:ne,onChange:P}),e.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"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-faint)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(j,{type:"datetime-local",value:le,onChange:s=>z(s.target.value)}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(j,{type:"number",min:"1",value:oe,onChange:s=>M(s.target.value),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)]",value:de,onChange:s=>F(s.target.value),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"secondary",onClick:()=>{E(!1),q(!1),A(""),K([]),$({entityType:"goal",entityId:""}),P([]),z(""),M(""),F("days")},children:"Cancel"}),e.jsx(v,{pending:ke.isPending,pendingLabel:"Saving",disabled:h.trim().length===0,onClick:async()=>{await ke.mutateAsync(h.trim()),E(!1)},children:"Save note"})]})]}):null,e.jsxs("div",{className:"mt-4 grid gap-3",children:[g.isLoading?e.jsx("div",{className:"rounded-[20px] bg-[var(--ui-surface-1)] p-4 text-sm text-[var(--ui-ink-soft)]",children:"Loading notes…"}):null,!g.isLoading&&J.length===0?e.jsx("div",{className:"rounded-[20px] bg-[var(--ui-surface-1)] p-4 text-sm text-[var(--ui-ink-soft)]",children:"No notes are linked here yet."}):null,J.map(s=>{const n=He===s.id,r=fs(s,o,d);return e.jsxs("article",{className:"min-w-0 rounded-[24px] border border-[var(--ui-border-subtle)] 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",{className:"min-w-0",children:[e.jsxs("div",{className:"break-words text-xs uppercase tracking-[0.16em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:[(s.author??"Unknown author").toString()," •"," ",new Date(s.updatedAt).toLocaleString()]}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[r.map(a=>e.jsxs(b,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",wrap:!0,children:[N(a.entityType)," ·"," ",W(a),a.anchorKey?` · ${Y(a.anchorKey)}`:""]},`${s.id}-${a.entityType}-${a.entityId}-${a.anchorKey??""}`)),(s.tags??[]).map(a=>e.jsx(b,{className:"bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]",wrap:!0,children:a},`${s.id}-tag-${a}`)),s.destroyAt?e.jsxs(b,{className:"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(s.destroyAt).toLocaleString()]}):null]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",className:"inline-flex size-9 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:()=>{Q(s.id),B(s.contentMarkdown),k(!1),O(s.links),U({entityType:"goal",entityId:""}),w(ee(s.tags??[])),_(vs(s.destroyAt??null)),C(""),S("days")},children:e.jsx(Xe,{className:"size-4"})}),e.jsx("button",{type:"button",className:"inline-flex size-9 items-center justify-center rounded-full bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)] transition hover:bg-[color-mix(in_srgb,var(--danger)_18%,var(--ui-surface-hover)_82%)]",onClick:()=>{Ge.mutateAsync(s.id)},children:e.jsx(Pe,{className:"size-4"})})]})]}),n?e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"flex flex-wrap items-center justify-end gap-2",children:e.jsxs(v,{type:"button",variant:"secondary",size:"sm",className:"gap-2",onClick:()=>k(a=>!a),children:[e.jsx(Ke,{className:"size-4"}),ce?"Back to editor":"Preview"]})}),e.jsx("div",{className:"mt-3",children:ce?e.jsxs("div",{className:"rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:f.trim()?e.jsx(Z,{markdown:f}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:"No content yet."})})]}):e.jsx(ze,{value:f,onChange:a=>B(a.target.value),className:"min-h-[12rem]"})}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(Me,{value:ue,onChange:w}),e.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"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-faint)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(j,{type:"datetime-local",value:me,onChange:a=>_(a.target.value)}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(j,{type:"number",min:"1",value:pe,onChange:a=>C(a.target.value),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)]",value:xe,onChange:a=>S(a.target.value),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsx("div",{className:"mt-3",children:_e(V,O,Re,U,`edit-note-links-${s.id}`)}),e.jsxs("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:[e.jsx(v,{variant:"secondary",onClick:()=>{Q(null),k(!1),w([]),_(""),C(""),S("days")},children:"Cancel"}),e.jsx(v,{pending:we.isPending,pendingLabel:"Saving",disabled:f.trim().length===0||V.length===0,onClick:async()=>{await we.mutateAsync({noteId:s.id,contentMarkdown:f.trim(),links:V,tags:ee(ue),destroyAt:Fe(me,pe,xe)})},children:"Save changes"})]})]}):e.jsx("div",{className:"mt-4",children:e.jsx(Z,{markdown:s.contentMarkdown})})]},s.id)})]})]})})}export{Cs as E};
|
|
1
|
+
import{r as l,j as e,b4 as $e,b3 as We,cQ as Ke,ce as Xe,c7 as Pe}from"./vendor-Dnkkx2co.js";import{j as Ye,i as y,k as X}from"./state-vCcAT5Hq.js";import{u as Ze,bv as Y,cM as es,cn as u,ao as ss,bm as ts,bn as as,C as rs,aq as is,c as b,cN as ns,B as v,I as j,T as ze,bu as N,i as ls,bD as os,bw as ds,bx as cs,by as us,bz as ms,bA as ps,bB as xs,bC as ys}from"./index-BP9__l6C.js";import{N as Z}from"./note-markdown-3wB52NOn.js";import{n as ee,N as Me,f as vs,p as gs,b as hs}from"./note-tags-input-Blg5Gqz_.js";function fs(o,d,c){return o.links.filter(p=>!(p.entityType===d&&p.entityId===c))}function bs(o,d){return o.entityType===d.entityType&&o.entityId===d.entityId&&(o.anchorKey??null)===(d.anchorKey??null)}function se(o){const d=new Set;return o.filter(c=>{const p=`${c.entityType}:${c.entityId}:${c.anchorKey??""}`;return d.has(p)?!1:(d.add(p),!0)})}function Fe(o,d,c){return gs(o)??hs(d,c)}function Cs({entityType:o,entityId:d,anchorKey:c,includeAnchorlessWhenAnchored:p=!1,title:Qe="Notes",description:Be="Markdown notes linked to this entity stay searchable, editable, and visible alongside the work.",invalidateQueryKeys:Ve=[],compact:te=!1}){var Ce,Se,De,Te,Le,Ie,Ee,Ae,qe;const m=Ze(),L=Ye(),[I,Oe]=l.useState(""),[ae,E]=l.useState(!1),[h,A]=l.useState(""),[re,q]=l.useState(!1),[Ue,$]=l.useState({entityType:"goal",entityId:""}),[ie,K]=l.useState([]),[ne,P]=l.useState([]),[le,z]=l.useState(""),[oe,M]=l.useState(""),[de,F]=l.useState("days"),[He,Q]=l.useState(null),[f,B]=l.useState(""),[ce,k]=l.useState(!1),[V,O]=l.useState([]),[Re,U]=l.useState({entityType:"goal",entityId:""}),[ue,w]=l.useState([]),[me,_]=l.useState(""),[pe,C]=l.useState(""),[xe,S]=l.useState("days"),H=Y(c),ye=es(o,c),g=y({queryKey:["notes",o,d],queryFn:()=>os({linkedEntityType:o,linkedEntityId:d,limit:100})}),ve=y({queryKey:["forge-psyche-values"],queryFn:ds}),ge=y({queryKey:["forge-psyche-patterns"],queryFn:cs}),he=y({queryKey:["forge-psyche-behaviors"],queryFn:us}),fe=y({queryKey:["forge-psyche-beliefs"],queryFn:ms}),be=y({queryKey:["forge-psyche-modes"],queryFn:ps}),je=y({queryKey:["forge-psyche-flashcards"],queryFn:xs}),Ne=y({queryKey:["forge-psyche-reports"],queryFn:ys}),R=l.useMemo(()=>{var s,n,r,a,x,i,D,T;return{goal:m.snapshot.goals.map(t=>({id:t.id,label:u(t.title,t.user)})),project:m.snapshot.dashboard.projects.map(t=>({id:t.id,label:u(t.title,t.user)})),task:m.snapshot.tasks.map(t=>({id:t.id,label:u(t.title,t.user)})),strategy:m.snapshot.strategies.map(t=>({id:t.id,label:u(t.title,t.user)})),habit:m.snapshot.habits.map(t=>({id:t.id,label:u(t.title,t.user)})),tag:m.snapshot.tags.map(t=>({id:t.id,label:u(t.name,t.user)})),note:(((s=g.data)==null?void 0:s.notes)??[]).map(t=>({id:t.id,label:t.contentPlain||t.contentMarkdown})),insight:[],psyche_value:(((n=ve.data)==null?void 0:n.values)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),behavior_pattern:(((r=ge.data)==null?void 0:r.patterns)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),behavior:(((a=he.data)==null?void 0:a.behaviors)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),belief_entry:(((x=fe.data)==null?void 0:x.beliefs)??[]).map(t=>({id:t.id,label:u(t.statement,t.user)})),mode_profile:(((i=be.data)==null?void 0:i.modes)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),flashcard:(((D=je.data)==null?void 0:D.flashcards)??[]).map(t=>({id:t.id,label:u(t.title||t.message,t.user)})),mode_guide_session:[],event_type:[],emotion_definition:[],trigger_report:(((T=Ne.data)==null?void 0:T.reports)??[]).map(t=>({id:t.id,label:u(t.title,t.user)})),calendar_event:[],work_block_template:[],task_timebox:[],preference_catalog:[],preference_catalog_item:[],preference_context:[],preference_item:[],questionnaire_instrument:[],sleep_session:[],workout_session:[]}},[(Ce=he.data)==null?void 0:Ce.behaviors,(Se=fe.data)==null?void 0:Se.beliefs,(De=je.data)==null?void 0:De.flashcards,(Te=be.data)==null?void 0:Te.modes,(Le=g.data)==null?void 0:Le.notes,(Ie=ge.data)==null?void 0:Ie.patterns,(Ee=Ne.data)==null?void 0:Ee.reports,m.snapshot.dashboard.projects,m.snapshot.goals,m.snapshot.habits,m.snapshot.strategies,m.snapshot.tags,m.snapshot.tasks,(Ae=ve.data)==null?void 0:Ae.values]),G=async()=>{await Promise.all([L.invalidateQueries({queryKey:["notes",o,d]}),ls(L),...Ve.map(s=>L.invalidateQueries({queryKey:s}))])},ke=X({mutationFn:async s=>ss({contentMarkdown:s,tags:ee(ne),destroyAt:Fe(le,oe,de),links:se([{entityType:o,entityId:d,anchorKey:c??null},...ie])}),onSuccess:async()=>{A(""),q(!1),K([]),$({entityType:"goal",entityId:""}),P([]),z(""),M(""),F("days"),await G()}}),we=X({mutationFn:async({noteId:s,contentMarkdown:n,links:r,tags:a,destroyAt:x})=>ts(s,{contentMarkdown:n,links:r,tags:a,destroyAt:x}),onSuccess:async()=>{Q(null),B(""),k(!1),O([]),U({entityType:"goal",entityId:""}),w([]),_(""),C(""),S("days"),await G()}}),Ge=X({mutationFn:async s=>as(s),onSuccess:G}),J=l.useMemo(()=>{var n;return(((n=g.data)==null?void 0:n.notes)??[]).filter(r=>c===void 0?!0:r.links.some(a=>a.entityType===o&&a.entityId===d&&((a.anchorKey??null)===c||p&&(a.anchorKey??null)===null))).filter(r=>{const a=I.trim().toLowerCase();return a?`${r.contentPlain} ${r.author??""} ${(r.tags??[]).join(" ")}`.toLowerCase().includes(a):!0})},[c,d,o,p,(qe=g.data)==null?void 0:qe.notes,I]),Je=(s,n,r)=>{const a=s.entityId.trim();return a?(n(se([...r,{entityType:s.entityType,entityId:a,anchorKey:null}])),!0):!1},W=s=>{var r,a;const n=(r=R[s.entityType])==null?void 0:r.find(x=>x.id===s.entityId);return(a=n==null?void 0:n.label)!=null&&a.trim()?n.label.trim():`Deleted ${N(s.entityType)}`},_e=(s,n,r,a,x)=>e.jsxs("div",{className:"min-w-0 rounded-[20px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Linked entities"}),e.jsxs(b,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[s.length," linked"]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:s.map(i=>{const D=s.length>1;return e.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-full bg-[var(--ui-surface-2)] px-3 py-2 text-sm text-[var(--ui-ink-medium)]",children:[e.jsxs("span",{className:"min-w-0 break-words [overflow-wrap:anywhere]",children:[N(i.entityType)," · ",W(i)]}),i.anchorKey?e.jsx("span",{className:"shrink-0 rounded-full bg-[var(--ui-surface-3)] px-2 py-0.5 text-[11px] text-[var(--ui-ink-soft)]",children:Y(i.anchorKey)}):null,e.jsx("button",{type:"button",disabled:!D,className:"shrink-0 text-[var(--ui-ink-faint)] transition hover:text-[var(--ui-ink-strong)] disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>n(s.filter(T=>!bs(T,i))),"aria-label":`Remove ${N(i.entityType)} link to ${W(i)}`,children:e.jsx(Pe,{className:"size-3.5"})})]},`${x}-${i.entityType}-${i.entityId}-${i.anchorKey??""}`)})}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,11rem)_minmax(0,1fr)_auto]",children:[e.jsx("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)]",value:r.entityType,onChange:i=>a({...r,entityType:i.target.value,entityId:""}),children:["goal","project","task","strategy","habit","tag","note","psyche_value","behavior_pattern","behavior","belief_entry","mode_profile","mode_guide_session","flashcard","event_type","emotion_definition","trigger_report"].map(i=>e.jsx("option",{value:i,children:N(i)},i))}),e.jsxs("select",{className:"min-w-0 rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-3 py-3 text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)]",value:r.entityId,onChange:i=>a({...r,entityId:i.target.value}),children:[e.jsx("option",{value:"",children:(R[r.entityType]??[]).length>0?"Choose linked item":"No linked items available"}),(R[r.entityType]??[]).map(i=>e.jsx("option",{value:i.id,children:i.label},i.id))]}),e.jsx(v,{variant:"secondary",disabled:!r.entityId,onClick:()=>{Je(r,n,s)&&a({...r,entityId:""})},children:"Add link"})]})]});return e.jsx(rs,{id:"notes",className:te?"min-w-0 overflow-hidden p-0":"min-w-0 overflow-hidden",children:e.jsxs("div",{className:te?"p-4":void 0,children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:Qe}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:Be}),H?e.jsxs("div",{className:"mt-3 inline-flex max-w-full items-center gap-2 rounded-full bg-[var(--ui-surface-1)] px-3 py-2 text-xs text-[var(--ui-ink-soft)]",children:[e.jsxs("span",{children:["Pinned to ",H]}),ye?e.jsx(is,{content:ye,label:`Explain ${H}`}):null]}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(b,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:ns(J.length)}),ae?null:e.jsxs(v,{type:"button",size:"sm",onClick:()=>E(!0),children:[e.jsx($e,{className:"size-4"}),"Add note"]})]})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3",children:[e.jsx(We,{className:"size-4 text-[var(--ui-ink-faint)]"}),e.jsx(j,{value:I,onChange:s=>Oe(s.target.value),placeholder:"Search notes by content, author, or note tag",className:"border-0 bg-transparent px-0 py-0"})]}),ae?e.jsxs("div",{className:"mt-4 rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--ui-ink-medium)]",children:[e.jsx($e,{className:"size-4 text-[var(--secondary)]"}),"Add note"]}),e.jsxs(v,{type:"button",variant:"secondary",size:"sm",className:"gap-2",onClick:()=>q(s=>!s),children:[e.jsx(Ke,{className:"size-4"}),re?"Back to editor":"Preview"]})]}),e.jsx("div",{className:"mt-3",children:re?e.jsxs("div",{className:"rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:h.trim()?e.jsx(Z,{markdown:h}):e.jsx("div",{className:"text-sm leading-6 text-[var(--ui-ink-faint)]",children:"Markdown preview appears here once you have note content."})})]}):e.jsx(ze,{value:h,onChange:s=>A(s.target.value),placeholder:"Write in Markdown. Summaries, blockers, what changed, and why all work well here.",className:"min-h-[12rem]"})}),e.jsx("div",{className:"mt-3",children:_e(se([{entityType:o,entityId:d,anchorKey:c??null},...ie]),s=>K(s.filter(n=>!(n.entityType===o&&n.entityId===d&&(n.anchorKey??null)===(c??null)))),Ue,$,"composer-note-links")}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(Me,{value:ne,onChange:P}),e.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"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-faint)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(j,{type:"datetime-local",value:le,onChange:s=>z(s.target.value)}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(j,{type:"number",min:"1",value:oe,onChange:s=>M(s.target.value),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)]",value:de,onChange:s=>F(s.target.value),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"secondary",onClick:()=>{E(!1),q(!1),A(""),K([]),$({entityType:"goal",entityId:""}),P([]),z(""),M(""),F("days")},children:"Cancel"}),e.jsx(v,{pending:ke.isPending,pendingLabel:"Saving",disabled:h.trim().length===0,onClick:async()=>{await ke.mutateAsync(h.trim()),E(!1)},children:"Save note"})]})]}):null,e.jsxs("div",{className:"mt-4 grid gap-3",children:[g.isLoading?e.jsx("div",{className:"rounded-[20px] bg-[var(--ui-surface-1)] p-4 text-sm text-[var(--ui-ink-soft)]",children:"Loading notes…"}):null,!g.isLoading&&J.length===0?e.jsx("div",{className:"rounded-[20px] bg-[var(--ui-surface-1)] p-4 text-sm text-[var(--ui-ink-soft)]",children:"No notes are linked here yet."}):null,J.map(s=>{const n=He===s.id,r=fs(s,o,d);return e.jsxs("article",{className:"min-w-0 rounded-[24px] border border-[var(--ui-border-subtle)] 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",{className:"min-w-0",children:[e.jsxs("div",{className:"break-words text-xs uppercase tracking-[0.16em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:[(s.author??"Unknown author").toString()," •"," ",new Date(s.updatedAt).toLocaleString()]}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[r.map(a=>e.jsxs(b,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",wrap:!0,children:[N(a.entityType)," ·"," ",W(a),a.anchorKey?` · ${Y(a.anchorKey)}`:""]},`${s.id}-${a.entityType}-${a.entityId}-${a.anchorKey??""}`)),(s.tags??[]).map(a=>e.jsx(b,{className:"bg-[var(--ui-info-soft)] text-[color-mix(in_srgb,var(--info)_78%,var(--ui-ink-strong)_22%)]",wrap:!0,children:a},`${s.id}-tag-${a}`)),s.destroyAt?e.jsxs(b,{className:"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(s.destroyAt).toLocaleString()]}):null]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",className:"inline-flex size-9 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:()=>{Q(s.id),B(s.contentMarkdown),k(!1),O(s.links),U({entityType:"goal",entityId:""}),w(ee(s.tags??[])),_(vs(s.destroyAt??null)),C(""),S("days")},children:e.jsx(Xe,{className:"size-4"})}),e.jsx("button",{type:"button",className:"inline-flex size-9 items-center justify-center rounded-full bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)] transition hover:bg-[color-mix(in_srgb,var(--danger)_18%,var(--ui-surface-hover)_82%)]",onClick:()=>{Ge.mutateAsync(s.id)},children:e.jsx(Pe,{className:"size-4"})})]})]}),n?e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"flex flex-wrap items-center justify-end gap-2",children:e.jsxs(v,{type:"button",variant:"secondary",size:"sm",className:"gap-2",onClick:()=>k(a=>!a),children:[e.jsx(Ke,{className:"size-4"}),ce?"Back to editor":"Preview"]})}),e.jsx("div",{className:"mt-3",children:ce?e.jsxs("div",{className:"rounded-[20px] bg-[var(--ui-surface-2)] p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Preview"}),e.jsx("div",{className:"mt-3",children:f.trim()?e.jsx(Z,{markdown:f}):e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:"No content yet."})})]}):e.jsx(ze,{value:f,onChange:a=>B(a.target.value),className:"min-h-[12rem]"})}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1.15fr)_minmax(0,0.85fr)]",children:[e.jsx(Me,{value:ue,onChange:w}),e.jsxs("div",{className:"grid gap-3 rounded-[20px] bg-[var(--ui-surface-1)] p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"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-faint)]",children:"Set an exact destroy time or a relative delay. Leaving both blank keeps the note durable."})]}),e.jsx(j,{type:"datetime-local",value:me,onChange:a=>_(a.target.value)}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_10rem]",children:[e.jsx(j,{type:"number",min:"1",value:pe,onChange:a=>C(a.target.value),placeholder:"Destroy after"}),e.jsxs("select",{className:"rounded-[14px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)]",value:xe,onChange:a=>S(a.target.value),children:[e.jsx("option",{value:"hours",children:"Hours"}),e.jsx("option",{value:"days",children:"Days"})]})]})]})]}),e.jsx("div",{className:"mt-3",children:_e(V,O,Re,U,`edit-note-links-${s.id}`)}),e.jsxs("div",{className:"mt-3 flex flex-wrap justify-end gap-2",children:[e.jsx(v,{variant:"secondary",onClick:()=>{Q(null),k(!1),w([]),_(""),C(""),S("days")},children:"Cancel"}),e.jsx(v,{pending:we.isPending,pendingLabel:"Saving",disabled:f.trim().length===0||V.length===0,onClick:async()=>{await we.mutateAsync({noteId:s.id,contentMarkdown:f.trim(),links:V,tags:ee(ue),destroyAt:Fe(me,pe,xe)})},children:"Save changes"})]})]}):e.jsx("div",{className:"mt-4",children:e.jsx(Z,{markdown:s.contentMarkdown})})]},s.id)})]})]})})}export{Cs as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as N,bg as Je,ce as Fe,cb as Qe,cv as he,j as t,c7 as je,b2 as pt,ca as Xe,cw as Ze,cx as Ye,bM as xt,br as gt,c9 as bt,aO as ht,aP as ve,bo as Ue,cy as vt}from"./vendor-Dnkkx2co.js";import{u as wt,a as jt,D as yt,S as Pe,v as Ve,e as Nt,p as kt,f as St,P as It,g as Te,b as et,C as tt}from"./board-dIX6etHh.js";import{P as ye,C as it,B as qe,Z as W,_ as Ct,aS as rt,b as le,c as S,V as at,U as we}from"./index-BhkubYaC.js";import{E as zt}from"./entity-note-count-link-VMURwBMi.js";import{F as Dt}from"./floating-action-menu-B3tQStUN.js";function $t(e){if(typeof e=="number"&&Number.isInteger(e)&&e>0)return e;if(typeof e=="string"){const r=e.match(/(\d+)/);if(r){const l=Number.parseInt(r[1]??"",10);return Number.isInteger(l)&&l>0?l:null}}return null}function Ge(e){return e.split(/\r?\n/).map(r=>r.trim()).reduce((r,l)=>{const o=l.match(/^[-*+]\s+\[([ xX])\]\s+(.+)$/);if(o)return r.push({label:o[2].trim(),completed:o[1].toLowerCase()==="x"}),r;const c=l.match(/^(?:[-*+]|\d+\.)\s+(.+)$/);return c&&r.push({label:c[1].trim(),completed:null}),r},[]).filter(r=>r.label.length>0)}function _t(e){if(e.acceptanceCriteria.length>0)return{total:e.acceptanceCriteria.length,completed:e.status==="done"?e.acceptanceCriteria.length:0,source:"acceptance_criteria",items:e.acceptanceCriteria};const r=Ge(e.aiInstructions);if(r.length>0){const o=e.status==="done"?r.length:r.filter(c=>c.completed===!0).length;return{total:r.length,completed:o,source:"ai_instructions",items:r.map(c=>c.label)}}const l=Ge(e.description);if(l.length>0){const o=e.status==="done"?l.length:l.filter(c=>c.completed===!0).length;return{total:l.length,completed:o,source:"description",items:l.map(c=>c.label)}}return null}function He(e,r){return e.find(l=>l.refType===r)??null}function nt(e,r=null){var f,x,w,D,k,C,$,U,_,B,R;const l=new Set(((f=e.completionReport)==null?void 0:f.linkedGitRefIds)??[]),o=He(e.gitRefs,"branch"),c=He(e.gitRefs,"pull_request"),u=(r==null?void 0:r.gitContext)??null,m=(u==null?void 0:u.pullRequestNumber)??$t((c==null?void 0:c.refValue)??(c==null?void 0:c.displayTitle)??null);return{actor:(r==null?void 0:r.actor)??null,activeRun:r,stepSummary:_t(e),changedFileCount:((x=e.completionReport)==null?void 0:x.modifiedFiles.length)??0,changedFilesPreview:(((w=e.completionReport)==null?void 0:w.modifiedFiles)??[]).slice(0,2),git:{provider:((D=u==null?void 0:u.provider)==null?void 0:D.trim())||((k=o==null?void 0:o.provider)==null?void 0:k.trim())||((C=c==null?void 0:c.provider)==null?void 0:C.trim())||null,repository:(($=u==null?void 0:u.repository)==null?void 0:$.trim())||((U=o==null?void 0:o.repository)==null?void 0:U.trim())||((_=c==null?void 0:c.repository)==null?void 0:_.trim())||null,branch:((B=u==null?void 0:u.branch)==null?void 0:B.trim())||((R=o==null?void 0:o.refValue)==null?void 0:R.trim())||null,branchUrl:(u==null?void 0:u.branchUrl)??(o==null?void 0:o.url)??null,pullRequestNumber:m,pullRequestUrl:(u==null?void 0:u.pullRequestUrl)??(c==null?void 0:c.url)??null,compareUrl:(u==null?void 0:u.compareUrl)??null,linkedRefCount:l.size}}}const I=["backlog","focus","in_progress","blocked","done"];function Bt(e){if(!e)return null;const r=Date.parse(e);return Number.isNaN(r)?null:new Date(r).toISOString().slice(0,10)}function Mt({task:e,onOpenTask:r,onEditTask:l,onLinkTask:o,onCreateTaskForIssue:c,onCreateSubtaskForTask:u,onMove:m,onDeleteTask:f,deletePendingTaskId:x,onRequestDelete:w}){const D=e.level==="issue"?{id:"create-task",label:"Create task",description:"Add a focused execution task under this issue.",icon:he,onSelect:()=>c==null?void 0:c(e.id)}:e.level==="task"?{id:"create-subtask",label:"Create subtask",description:"Add a granular child step under this task.",icon:he,onSelect:()=>u==null?void 0:u(e.id)}:null;return[{id:"open-task",label:"Open",description:"Jump to the work-item detail view.",icon:Je,onSelect:()=>r==null?void 0:r(e.id)},{id:"edit-task",label:"Edit",description:"Open the guided work-item editor.",icon:Fe,onSelect:()=>l==null?void 0:l(e.id)},{id:"link-task",label:"Link",description:"Open the placement step to relink this work item.",icon:Qe,onSelect:()=>o==null?void 0:o(e.id)},...D?[D]:[],{id:"delete-task",label:e.level==="issue"?"Delete issue":e.level==="subtask"?"Delete subtask":"Delete task",description:"Remove this work item directly from the board menu.",icon:je,tone:"danger",disabled:!f||x===e.id,onSelect:()=>w(e)},...I.filter(k=>k!==e.status).map(k=>({id:`move-task-${k}`,label:`Move to ${k.replaceAll("_"," ")}`,description:"Update the workflow lane for this work item.",onSelect:()=>void m(e.id,k)}))]}function st(e){return e.startsWith("lane:")||e.includes(":lane:")}function At(e){var r,l;return((l=(r=e.data)==null?void 0:r.current)==null?void 0:l.type)==="lane"||st(String(e.id))}function Lt(e){var r,l;return((l=(r=e.data)==null?void 0:r.current)==null?void 0:l.type)==="trash"}function Et(e,r){const l=Math.max(0,Math.min(e.right,r.right)-Math.max(e.left,r.left)),o=Math.max(0,Math.min(e.bottom,r.bottom)-Math.max(e.top,r.top));return l*o}const Rt=e=>{const r=kt(e),l=r.find(m=>{const f=e.droppableContainers.find(x=>x.id===m.id);return f?Lt(f):!1});if(l)return[l];const o=r.find(m=>st(String(m.id)));if(o)return[o];const u=e.droppableContainers.filter(m=>At(m)).map(m=>{const f=e.droppableRects.get(m.id);if(!f)return null;const x=Et(e.collisionRect,f);return x<=0?null:{id:m.id,data:{droppableContainer:m,value:x}}}).filter(Boolean).sort((m,f)=>{var x,w;return(((x=f==null?void 0:f.data)==null?void 0:x.value)??0)-(((w=m==null?void 0:m.data)==null?void 0:w.value)??0)});return u.length>0?u:r.length>0?r:St(e)};function Ot(e,r){return r&&r.trim().length>0?r:e!=null&&e.actor?`${e.actor} session`:"Active work"}function Ut(e,r){return[(e==null?void 0:e.actor)??null,r].filter(Boolean).join(" · ")}function Ke(e){e.preventDefault(),e.stopPropagation()}function lt({task:e,goal:r,tags:l,activeRun:o,isSelected:c,isDragging:u=!1,isOverlay:m=!1,style:f,setNodeRef:x,dragAttributes:w,dragListeners:D,isMobile:k=!1,onSelect:C,onStartTask:$,onStopTask:U,onQuickReopen:_,onStepTask:B,onSplitTask:R,onOpenMenu:P,notesSummaryByEntity:V}){var X;const{t:M,formatDate:ae}=ye(),j=nt(e,o??null),z=j.stepSummary,h=I[I.indexOf(e.status)-1]??null,A=I[I.indexOf(e.status)+1]??null,oe=Ct(V,"task",e.id).count,L=e.level==="issue"?"issue":"task",ce=rt(L),te=e.level==="subtask"?"136,146,255":ce.colorToken.rgb.join(", "),q=e.dueDate&&!Number.isNaN(Date.parse(e.dueDate))?ae(e.dueDate):"No due date",J=z&&z.total>0?Math.max(8,Math.round(z.completed/z.total*100)):null,b=j.git.branch,F=j.git.branchUrl,G=j.git.pullRequestNumber?`PR #${j.git.pullRequestNumber}`:null,Q=j.git.pullRequestUrl;return t.jsxs("article",{ref:x,style:{...f,"--board-card-accent":te},className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[18px] p-3 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.12)] transition cursor-grab active:cursor-grabbing",k&&"touch-none select-none",m&&"rotate-[0.5deg] bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.22),rgba(var(--board-card-accent),0.08))] shadow-[var(--ui-shadow-floating)]",u&&!m&&"opacity-35 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.08)]",c?"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.18),rgba(var(--board-card-accent),0.06))] shadow-[var(--ui-shadow-soft)]":"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.08),color-mix(in_srgb,var(--ui-surface-1)_72%,transparent))]"),"data-dragging":u?"true":"false","data-testid":`task-card-${e.id}`,onClick:()=>C(e.id),...w,...D,children:[t.jsx("div",{className:"mb-3 h-px w-full rounded-full",style:{background:`linear-gradient(90deg, rgba(${te}, 0.96), rgba(${te}, 0.18))`}}),t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx(le,{kind:L,label:e.level,compact:!0,size:"xs",gradient:!1,className:"shrink-0"}),t.jsx(S,{size:"xs",className:"shrink-0 text-[10px] text-[var(--tertiary)]",children:e.priority}),j.actor?t.jsxs(S,{size:"xs",className:"shrink-0 bg-cyan-400/12 text-[var(--info)]",children:[t.jsx(pt,{className:"mr-1 size-3"}),j.actor]}):null]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[P?t.jsx("button",{type:"button","aria-label":`Open ${e.title} actions`,className:"inline-flex size-8 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)]",onClick:g=>{g.preventDefault(),g.stopPropagation(),P(g,e)},children:t.jsx(Xe,{className:"size-3.5"})}):null,k?t.jsxs("div",{className:"flex items-center gap-1",onClick:g=>g.stopPropagation(),children:[t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the previous lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)] disabled:opacity-35",disabled:!h,onClick:()=>{h&&(B==null||B(e.id,"previous"))},children:t.jsx(Ze,{className:"size-3.5"})}),t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the next lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)] disabled:opacity-35",disabled:!A,onClick:()=>{A&&(B==null||B(e.id,"next"))},children:t.jsx(Ye,{className:"size-3.5"})})]}):null,o?t.jsx("button",{type:"button","aria-label":`Stop work on ${e.title}`,className:"inline-flex size-8 items-center justify-center rounded-full bg-rose-500/16 text-[var(--danger)] transition hover:bg-rose-500/24",onClick:g=>{g.preventDefault(),g.stopPropagation(),U==null||U(o)},children:t.jsx(xt,{className:"size-3.5 fill-current"})}):e.status!=="done"?t.jsx("button",{type:"button","aria-label":`Start work on ${e.title}`,className:"inline-flex size-8 items-center justify-center rounded-full bg-[var(--primary)]/16 text-[var(--primary)] transition hover:bg-[var(--primary)]/24",onClick:g=>{g.preventDefault(),g.stopPropagation(),$==null||$(e.id)},children:t.jsx(gt,{className:"size-4 fill-current"})}):null,(X=e.splitSuggestion)!=null&&X.shouldSplit&&R?t.jsxs("button",{type:"button","aria-label":`Split ${e.title}`,className:"inline-flex items-center gap-1 rounded-full bg-amber-400/12 px-2.5 py-1 text-[10px] font-medium tracking-[0.14em] text-[var(--warning)] transition hover:bg-amber-400/18",onClick:g=>{g.preventDefault(),g.stopPropagation(),R(e.id)},children:[t.jsx(bt,{className:"size-3.5"}),"Split it"]}):null,t.jsxs("span",{className:"shrink-0 text-[11px] text-[var(--ui-ink-faint)]",children:[e.points," xp"]})]})]}),t.jsx(at,{kind:L,label:e.title,className:"max-w-full",lines:3,labelClassName:"[overflow-wrap:anywhere]"}),t.jsx("p",{className:"mt-1.5 line-clamp-3 [overflow-wrap:anywhere] text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:e.description||M("common.executionBoard.noExecutionNote")}),z?t.jsxs("div",{className:"mt-3 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] text-[var(--ui-ink-soft)]",children:[t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(ht,{className:"size-3.5 text-[var(--info)]"}),z.total," step",z.total===1?"":"s"]}),t.jsxs("span",{className:"tabular-nums text-[var(--ui-ink-soft)]",children:[z.completed,"/",z.total]})]}),t.jsx("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-[var(--ui-surface-2)]",children:t.jsx("div",{className:"h-full rounded-full bg-[linear-gradient(90deg,rgba(56,189,248,0.96),rgba(125,211,252,0.62))]",style:{width:`${J??0}%`}})}),t.jsx("div",{className:"mt-2 grid gap-1.5",children:z.items.slice(0,2).map(g=>t.jsx("div",{className:"truncate text-[11px] text-[var(--ui-ink-soft)]",children:g},`${e.id}-${g}`))})]}):null,t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[b?F?t.jsxs("a",{href:F,target:"_blank",rel:"noreferrer",className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-sky-300/18 bg-sky-400/12 px-2.5 py-1 text-[11px] text-[var(--info)] transition hover:bg-sky-400/18",onClick:Ke,children:[t.jsx(ve,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"truncate",children:b})]}):t.jsxs(S,{size:"xs",className:"min-w-0 max-w-full bg-sky-400/12 text-[var(--info)]",children:[t.jsx(ve,{className:"mr-1 size-3"}),t.jsx("span",{className:"truncate",children:b})]}):null,G?Q?t.jsxs("a",{href:Q,target:"_blank",rel:"noreferrer",className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-fuchsia-300/18 bg-fuchsia-400/12 px-2.5 py-1 text-[11px] text-[var(--primary)] transition hover:bg-fuchsia-400/18",onClick:Ke,children:[t.jsx(Ue,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"truncate",children:G})]}):t.jsxs(S,{size:"xs",className:"bg-fuchsia-400/12 text-[var(--primary)]",children:[t.jsx(Ue,{className:"mr-1 size-3"}),G]}):null,j.changedFileCount>0?t.jsxs(S,{size:"xs",className:"bg-amber-400/12 text-[var(--warning)]",children:[t.jsx(vt,{className:"mr-1 size-3"}),j.changedFileCount," file",j.changedFileCount===1?"":"s"]}):null,j.git.repository?t.jsx(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:j.git.repository}):null]}),j.changedFilesPreview.length>0?t.jsx("div",{className:"mt-2 flex min-w-0 flex-wrap gap-1.5",children:j.changedFilesPreview.map(g=>t.jsx(S,{size:"xs",wrap:!0,className:"min-w-0 max-w-full bg-[var(--ui-surface-2)] font-mono text-[10px] text-[var(--ui-ink-soft)]",children:g},g))}):null,t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[r?t.jsx(le,{kind:"goal",label:r.title,compact:!0,size:"xs",wrap:!0,className:"min-w-0 max-w-full"}):null,t.jsx(we,{user:e.user,compact:!0,size:"xs"}),t.jsx(zt,{entityType:"task",entityId:e.id,count:oe,compact:!0}),e.actionPointSummary?t.jsxs(S,{size:"xs",className:"bg-[var(--primary)]/12 text-[var(--primary)]",children:[Math.round(e.actionPointSummary.totalCostAp)," AP"]}):null,e.actionPointSummary?t.jsx(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:e.actionPointSummary.costBand}):null,e.actionPointSummary?t.jsxs(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[Math.round(e.actionPointSummary.expectedDurationSeconds/3600)," ","h target"]}):null,e.time.totalCreditedSeconds>0?t.jsxs(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[Math.floor(e.time.totalCreditedSeconds/60)," min"]}):null,e.time.activeRunCount>0?t.jsxs(S,{size:"xs",className:"bg-emerald-500/12 text-[var(--success)]",children:[e.time.activeRunCount," live"]}):null,l.slice(0,2).map(g=>t.jsx(S,{size:"xs",className:"bg-[var(--ui-surface-2)]",style:{color:g.color},children:g.name},g.id))]}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 items-center justify-between gap-2 text-[11px] text-[var(--ui-ink-faint)]",children:[t.jsxs("span",{className:"min-w-0 truncate",children:[e.effort," / ",e.energy]}),t.jsxs("div",{className:"flex min-w-0 shrink-0 items-center gap-2 text-right",children:[e.status==="done"&&_?t.jsx("button",{type:"button",className:"rounded-full bg-[var(--ui-surface-2)] px-3 py-1 text-[10px] tracking-[0.16em] text-[var(--ui-ink-strong)] transition hover:bg-[var(--ui-surface-3)]",onClick:g=>{g.preventDefault(),g.stopPropagation(),_(e.id)},children:M("common.executionBoard.reopen")}):null,t.jsx("span",{children:q})]})]})]})}function ge(e){const{task:r,sortableId:l}=e,{attributes:o,listeners:c,setNodeRef:u,transform:m,transition:f,isDragging:x}=et({id:l,data:{type:"task",taskId:r.id,status:r.status}});return t.jsx(lt,{...e,setNodeRef:u,dragAttributes:o,dragListeners:c,isDragging:x,isMobile:e.isMobile,onStartTask:e.onStartTask,onStopTask:e.onStopTask,onStepTask:e.onStepTask,onSplitTask:e.onSplitTask,notesSummaryByEntity:e.notesSummaryByEntity,style:{transform:tt.Transform.toString(m),transition:f}})}function ot({project:e,goal:r,isDragging:l=!1,isOverlay:o=!1,style:c,setNodeRef:u,dragAttributes:m,dragListeners:f,isMobile:x=!1,onStepProject:w,onOpenMenu:D}){const{formatDate:k}=ye(),C=I[I.indexOf(e.workflowStatus)-1]??null,$=I[I.indexOf(e.workflowStatus)+1]??null,_=rt("project").colorToken.rgb.join(", "),B=e.workflowStatus.replaceAll("_"," "),R=e.status.replaceAll("_"," "),P=Bt(e.updatedAt),V=P?k(P):"No recent update";return t.jsxs("article",{ref:u,style:{...c,"--board-card-accent":_},className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[18px] p-3 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.12)] transition cursor-grab active:cursor-grabbing",x&&"touch-none select-none",o&&"rotate-[0.5deg] bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.22),rgba(var(--board-card-accent),0.08))] shadow-[var(--ui-shadow-floating)]",l&&!o&&"opacity-35 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.08)]",!l&&!o&&"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.08),color-mix(in_srgb,var(--ui-surface-1)_72%,transparent))]"),"data-testid":`project-card-${e.id}`,...m,...f,children:[t.jsx("div",{className:"mb-3 h-px w-full rounded-full",style:{background:`linear-gradient(90deg, rgba(${_}, 0.96), rgba(${_}, 0.18))`}}),t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx(le,{kind:"project",label:"project",compact:!0,size:"xs",gradient:!1,className:"shrink-0"}),t.jsx(S,{size:"xs",className:"shrink-0 bg-[var(--primary)]/12 text-[var(--primary)]",children:B}),t.jsx(S,{size:"xs",className:"shrink-0 bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:R})]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[D?t.jsx("button",{type:"button","aria-label":`Open ${e.title} actions`,className:"inline-flex size-8 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)]",onClick:M=>{M.preventDefault(),M.stopPropagation(),D(M,e)},children:t.jsx(Xe,{className:"size-3.5"})}):null,x?t.jsxs("div",{className:"flex items-center gap-1",onClick:M=>M.stopPropagation(),children:[t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the previous lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)] disabled:opacity-35",disabled:!C,onClick:()=>{C&&(w==null||w(e.id,"previous"))},children:t.jsx(Ze,{className:"size-3.5"})}),t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the next lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)] disabled:opacity-35",disabled:!$,onClick:()=>{$&&(w==null||w(e.id,"next"))},children:t.jsx(Ye,{className:"size-3.5"})})]}):null]})]}),t.jsx(at,{kind:"project",label:e.title,className:"max-w-full",lines:3,labelClassName:"[overflow-wrap:anywhere]"}),t.jsx("p",{className:"mt-1.5 line-clamp-3 [overflow-wrap:anywhere] text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:e.description||"PRD-backed initiative spanning multiple work items."}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[r?t.jsx(le,{kind:"goal",label:r.title,compact:!0,size:"xs",wrap:!0,className:"min-w-0 max-w-full"}):null,t.jsx(we,{user:e.user,compact:!0,size:"xs"}),(e.assignees??[]).slice(0,2).map(M=>t.jsx(we,{user:M,compact:!0,size:"xs"},M.id)),t.jsxs(S,{size:"xs",className:"bg-[var(--primary)]/12 text-[var(--primary)]",children:[e.progress,"% progress"]}),t.jsxs(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[e.totalTasks," linked tasks"]})]}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 items-center justify-between gap-2 text-[11px] text-[var(--ui-ink-faint)]",children:[t.jsx("span",{className:"min-w-0 truncate",children:e.goalTitle}),t.jsx("span",{children:V})]})]})}function be(e){const{project:r,sortableId:l}=e,{attributes:o,listeners:c,setNodeRef:u,transform:m,transition:f,isDragging:x}=et({id:l,data:{type:"project",projectId:r.id,status:r.workflowStatus}});return t.jsx(ot,{...e,setNodeRef:u,dragAttributes:o,dragListeners:c,isDragging:x,style:{transform:tt.Transform.toString(m),transition:f}})}function We({droppableId:e,status:r,title:l,detail:o,count:c,dragging:u,children:m}){const{setNodeRef:f,isOver:x}=Te({id:e,data:{type:"lane",status:r}});return t.jsx("div",{ref:f,className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[24px] transition",x&&"scale-[1.005]"),"data-lane-id":r,"data-testid":`kanban-lane-${r}`,"data-lane-hover":x?"true":"false",children:t.jsxs(it,{className:W("h-full w-full max-w-full min-w-0 overflow-hidden p-3 transition-[background-color,box-shadow,border-color,transform]",u&&"border border-[var(--ui-border-subtle)]",x?"border border-[color-mix(in_srgb,var(--info)_38%,transparent)] bg-[var(--ui-info-soft)] shadow-[var(--ui-shadow-soft)]":"border border-transparent"),children:[t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:o}),t.jsx("h3",{className:"mt-1 break-words text-[1.45rem] leading-[1] text-[var(--ui-ink-strong)]",children:l})]}),t.jsx("div",{className:"shrink-0 font-display text-[1.45rem] text-[var(--primary)]",children:c})]}),t.jsx("div",{className:W("grid w-full max-w-full min-w-0 min-h-48 content-start gap-2 rounded-[18px] p-2 transition",x?"bg-[var(--ui-info-soft)]":"bg-[var(--ui-surface-1)]"),children:m})]})})}function Pt({title:e,detail:r,children:l}){return t.jsxs("div",{className:"rounded-[20px] border border-[color-mix(in_srgb,var(--info)_24%,transparent)] bg-[var(--ui-info-soft)] p-2.5 shadow-[inset_0_0_0_1px_var(--ui-border-subtle)]",children:[t.jsx("div",{className:"mb-2 flex items-start justify-between gap-3 px-1",children:t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--info)]/86",children:[t.jsx(ve,{className:"size-3.5"}),t.jsx("span",{className:"truncate",children:e})]}),r?t.jsx("div",{className:"mt-1 text-[11px] text-[var(--ui-ink-faint)]",children:r}):null]})}),t.jsx("div",{className:"grid gap-2",children:l})]})}function Vt({droppableId:e,title:r,detail:l}){const{setNodeRef:o,isOver:c}=Te({id:e,data:{type:"trash"}});return t.jsx("div",{ref:o,className:W("pointer-events-auto fixed right-4 top-4 z-50 w-[min(18rem,calc(100vw-2rem))] rounded-[28px] border px-5 py-4 shadow-[var(--ui-shadow-floating)] backdrop-blur-2xl transition lg:right-6 lg:top-6",c?"border-[color-mix(in_srgb,var(--danger)_38%,transparent)] bg-[var(--ui-danger-soft)] text-[var(--ui-ink-strong)] scale-[1.02]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] text-[var(--ui-ink-medium)]"),"data-testid":"kanban-trash-dropzone","data-trash-hover":c?"true":"false",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:W("flex size-12 items-center justify-center rounded-full border transition",c?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-3)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]"),children:t.jsx(je,{className:"size-5"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-[var(--ui-ink-soft)]",children:"Bin"}),t.jsx("div",{className:"mt-1 text-base font-medium text-[var(--ui-ink-strong)]",children:r}),t.jsx("div",{className:"mt-1 text-sm leading-5 text-[var(--ui-ink-soft)]",children:l})]})]})})}function Jt({tasks:e,projects:r=[],activeRuns:l=[],goals:o,tags:c,selectedTaskId:u,onMove:m,onMoveProject:f,onSelectTask:x,onStartTask:w,onStopTask:D,onQuickReopenTask:k,onDeleteTask:C,onOpenProject:$,onOpenTask:U,onEditProject:_,onEditTask:B,onLinkProject:R,onLinkTask:P,onCreateIssueForProject:V,onCreateTaskForIssue:M,onCreateSubtaskForTask:ae,onSplitTask:j,notesSummaryByEntity:z}){var _e,Be;const{t:h}=ye(),A=N.useId(),oe=`${A}:trash`,[L,ce]=N.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 1023px)").matches),te=wt(jt(It,{activationConstraint:{distance:6}})),[q,J]=N.useState(null),[b,F]=N.useState(null),[G,Q]=N.useState(null),[X,g]=N.useState(null),[Ne,ct]=N.useState(()=>typeof window>"u"?!1:window.localStorage.getItem("forge.kanban-skip-delete-confirmation")==="true"),[ke,ne]=N.useState(!1),[Se,Z]=N.useState({}),[Ie,ie]=N.useState({}),se={backlog:{title:h("common.executionBoard.laneBacklogTitle"),detail:h("common.executionBoard.laneBacklogDetail")},focus:{title:h("common.executionBoard.laneFocusTitle"),detail:h("common.executionBoard.laneFocusDetail")},in_progress:{title:h("common.executionBoard.laneProgressTitle"),detail:h("common.executionBoard.laneProgressDetail")},blocked:{title:h("common.executionBoard.laneBlockedTitle"),detail:h("common.executionBoard.laneBlockedDetail")},done:{title:h("common.executionBoard.laneDoneTitle"),detail:h("common.executionBoard.laneDoneDetail")}},Y=N.useMemo(()=>e.map(i=>{const a=Se[i.id];return a?{...i,status:a}:i}),[Se,e]),T=N.useMemo(()=>r.map(i=>{const a=Ie[i.id];return a?{...i,workflowStatus:a}:i}),[Ie,r]),Ce=N.useMemo(()=>{const i=new Map;for(const a of l){if(a.status!=="active")continue;const n=i.get(a.taskId);(!n||a.isCurrent||a.updatedAt>n.updatedAt)&&i.set(a.taskId,a)}return i},[l]),K=N.useMemo(()=>[...T.map(i=>({kind:"project",id:i.id,status:i.workflowStatus,project:i,goal:o.find(a=>a.id===i.goalId)})),...Y.map(i=>({kind:"task",id:i.id,status:i.status,task:i,goal:o.find(a=>a.id===i.goalId),tags:i.tagIds.map(a=>c.find(n=>n.id===a)).filter(Boolean),activeRun:Ce.get(i.id)??null}))],[Ce,T,Y,o,c]),O=q?K.find(i=>i.id===q)??null:null,dt=N.useMemo(()=>{if(!b)return[];if(b.kind==="project"){const a=T.find(n=>n.id===b.entityId);return a?[{id:"open-project",label:"Open",description:"Jump to the project detail view.",icon:Je,onSelect:()=>$==null?void 0:$(a.id)},{id:"edit-project",label:"Edit",description:"Open the guided project editor.",icon:Fe,onSelect:()=>_==null?void 0:_(a.id)},{id:"link-project",label:"Link",description:"Open the anchor step to relink the project to its goal.",icon:Qe,onSelect:()=>R==null?void 0:R(a.id)},{id:"create-issue",label:"Create issue",description:"Break this project into a new vertical slice issue.",icon:he,onSelect:()=>V==null?void 0:V(a.id)},...I.filter(n=>n!==a.workflowStatus).map(n=>({id:`move-project-${n}`,label:`Move to ${n.replaceAll("_"," ")}`,description:"Update the project workflow lane without leaving the board.",onSelect:()=>void(f==null?void 0:f(a.id,n))}))]:[]}const i=Y.find(a=>a.id===b.entityId);return i?Mt({task:i,onOpenTask:U,onEditTask:B,onLinkTask:P,onCreateTaskForIssue:M,onCreateSubtaskForTask:ae,onMove:m,onDeleteTask:C,deletePendingTaskId:X,onRequestDelete:$e}):[]},[T,Y,b,V,ae,M,_,B,R,P,m,f,C,$,U,X,Ne]);function ze(i){var n;if(i.length===0)return t.jsx("div",{className:"w-full max-w-full rounded-[18px] border border-dashed border-[var(--ui-border-subtle)] px-4 py-8 text-center text-sm text-[var(--ui-ink-faint)]",children:h("common.executionBoard.emptyLane")});if(((n=i[0])==null?void 0:n.status)!=="in_progress")return i.map(d=>d.kind==="task"?t.jsx(ge,{sortableId:`${A}:task:${d.task.id}`,task:d.task,goal:d.goal,tags:d.tags,activeRun:d.activeRun,isSelected:u===d.task.id,isMobile:L,onSelect:x,onStartTask:w,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:j,notesSummaryByEntity:z},d.task.id):t.jsx(be,{sortableId:`${A}:project:${d.project.id}`,project:d.project,goal:d.goal,isMobile:L,onStepProject:ue,onOpenMenu:fe},d.project.id));const a=new Map;for(const d of i){if(d.kind!=="task"||!d.activeRun){const E=a.get("ungrouped");E?E.items.push(d):a.set("ungrouped",{title:"Active work",detail:"Tasks in progress without a tracked branch",items:[d]});continue}const p=nt(d.task,d.activeRun),s=[d.activeRun.actor,p.git.repository??"",p.git.branch??""].join("::"),v=a.get(s);if(v){v.items.push(d);continue}a.set(s,{title:Ot(d.activeRun,p.git.branch),detail:Ut(d.activeRun,p.git.repository),items:[d]})}return Array.from(a.entries()).map(([d,p])=>d==="ungrouped"?p.items.map(s=>s.kind==="task"?t.jsx(ge,{sortableId:`${A}:task:${s.task.id}`,task:s.task,goal:s.goal,tags:s.tags,activeRun:s.activeRun,isSelected:u===s.task.id,isMobile:L,onSelect:x,onStartTask:w,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:j,notesSummaryByEntity:z},s.task.id):t.jsx(be,{sortableId:`${A}:project:${s.project.id}`,project:s.project,goal:s.goal,isMobile:L,onStepProject:ue,onOpenMenu:fe},s.project.id)):t.jsx(Pt,{title:p.title,detail:p.detail,children:p.items.map(s=>s.kind==="task"?t.jsx(ge,{sortableId:`${A}:task:${s.task.id}`,task:s.task,goal:s.goal,tags:s.tags,activeRun:s.activeRun,isSelected:u===s.task.id,isMobile:L,onSelect:x,onStartTask:w,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:j,notesSummaryByEntity:z},s.task.id):t.jsx(be,{sortableId:`${A}:project:${s.project.id}`,project:s.project,goal:s.goal,isMobile:L,onStepProject:ue,onOpenMenu:fe},s.project.id))},d))}N.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 1023px)"),a=n=>{ce(n?n.matches:i.matches)};return a(),typeof i.addEventListener=="function"?(i.addEventListener("change",a),()=>i.removeEventListener("change",a)):(i.addListener(a),()=>i.removeListener(a))},[]),N.useEffect(()=>{if(!q){document.body.style.cursor="";return}return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=""}},[q]),N.useEffect(()=>{Z(i=>{const a=new Set(e.map(p=>p.id));let n=!1;const d={};for(const[p,s]of Object.entries(i)){const v=e.find(E=>E.id===p);if(!a.has(p)||!v||v.status===s){n=!0;continue}d[p]=s}return n?d:i})},[e]),N.useEffect(()=>{ie(i=>{const a=new Set(r.map(p=>p.id));let n=!1;const d={};for(const[p,s]of Object.entries(i)){const v=r.find(E=>E.id===p);if(!a.has(p)||!v||v.workflowStatus===s){n=!0;continue}d[p]=s}return n?d:i})},[r]);function ut(i){var d,p;const a=(d=i.active.data.current)==null?void 0:d.taskId,n=(p=i.active.data.current)==null?void 0:p.projectId;typeof a=="string"?J(a):typeof n=="string"&&J(n)}const mt=i=>{ct(i),typeof window<"u"&&window.localStorage.setItem("forge.kanban-skip-delete-confirmation","true")},De=async(i,a)=>{if(C){g(i.id);try{a&&mt(!0),await C(i.id),Q(null),ne(!1),Z(n=>{const d={...n};return delete d[i.id],d})}finally{g(null)}}};function $e(i){if(C){if(Ne){De(i,!1);return}ne(!1),Q(i)}}async function ft(i){var Me,Ae,Le,Ee,Re,Oe;const{active:a,over:n}=i;if(J(null),!n||a.id===n.id)return;const d=typeof((Me=a.data.current)==null?void 0:Me.taskId)=="string"?a.data.current.taskId:null,p=typeof((Ae=a.data.current)==null?void 0:Ae.projectId)=="string"?a.data.current.projectId:null,s=(d?K.find(y=>y.kind==="task"&&y.id===d):null)??(p?K.find(y=>y.kind==="project"&&y.id===p):null);if(!s)return;if(((Le=n.data.current)==null?void 0:Le.type)==="trash"){if(s.kind!=="task"||!C)return;$e(s.task);return}const v=typeof((Ee=n.data.current)==null?void 0:Ee.status)=="string"?n.data.current.status:null,E=typeof((Re=n.data.current)==null?void 0:Re.taskId)=="string"?n.data.current.taskId:null,H=typeof((Oe=n.data.current)==null?void 0:Oe.projectId)=="string"?n.data.current.projectId:null,pe=(E?K.find(y=>y.kind==="task"&&y.id===E):null)??(H?K.find(y=>y.kind==="project"&&y.id===H):null),ee=v??(pe==null?void 0:pe.status)??s.status;if(!(ee===s.status||!I.includes(ee))){if(s.kind==="task"){Z(y=>({...y,[s.task.id]:ee}));try{await m(s.task.id,ee)}catch(y){throw Z(xe=>{const re={...xe};return delete re[s.task.id],re}),y}return}if(f){ie(y=>({...y,[s.project.id]:ee}));try{await f(s.project.id,ee)}catch(y){throw ie(xe=>{const re={...xe};return delete re[s.project.id],re}),y}}}}async function de(i,a){const n=Y.find(v=>v.id===i);if(!n)return;const d=I.indexOf(n.status),p=a==="previous"?d-1:d+1,s=I[p]??null;if(!(!s||s===n.status)){Z(v=>({...v,[n.id]:s}));try{await m(n.id,s)}catch(v){throw Z(E=>{const H={...E};return delete H[n.id],H}),v}}}async function ue(i,a){const n=T.find(v=>v.id===i);if(!n||!f)return;const d=I.indexOf(n.workflowStatus),p=a==="previous"?d-1:d+1,s=I[p]??null;if(!(!s||s===n.workflowStatus)){ie(v=>({...v,[n.id]:s}));try{await f(n.id,s)}catch(v){throw ie(E=>{const H={...E};return delete H[n.id],H}),v}}}function me(i,a){const n=i.currentTarget.getBoundingClientRect();F({kind:"task",entityId:a.id,position:{x:n.right-8,y:n.bottom+8}})}function fe(i,a){const n=i.currentTarget.getBoundingClientRect();F({kind:"project",entityId:a.id,position:{x:n.right-8,y:n.bottom+8}})}return t.jsxs(yt,{sensors:te,collisionDetection:Rt,onDragStart:ut,onDragCancel:()=>J(null),onDragEnd:i=>void ft(i),children:[(O==null?void 0:O.kind)==="task"&&C?t.jsx(Vt,{droppableId:oe,title:h("common.executionBoard.deleteDropTitle"),detail:h("common.executionBoard.deleteDropDetail")}):null,t.jsx("div",{className:"w-full max-w-full min-w-0 pb-2",children:L?t.jsx("div",{className:"grid w-full max-w-full min-w-0 gap-2",children:I.map(i=>{const a=K.filter(n=>n.status===i);return t.jsx(Pe,{items:a.map(n=>`${A}:${n.kind}:${n.id}`),strategy:Ve,children:t.jsx(We,{droppableId:`${A}:lane:${i}`,status:i,title:se[i].title,detail:se[i].detail,count:a.length,dragging:q!==null,children:ze(a)})},i)})}):t.jsx("div",{className:"grid w-full min-w-0 gap-0.5 xl:grid-cols-[repeat(5,minmax(0,1fr))]",children:I.map(i=>{const a=K.filter(n=>n.status===i);return t.jsx(Pe,{items:a.map(n=>`${A}:${n.kind}:${n.id}`),strategy:Ve,children:t.jsx(We,{droppableId:`${A}:lane:${i}`,status:i,title:se[i].title,detail:se[i].detail,count:a.length,dragging:q!==null,children:ze(a)})},i)})})}),t.jsx(Nt,{adjustScale:!1,dropAnimation:null,children:O?t.jsx("div",{className:"w-[20rem] max-w-[calc(100vw-2rem)]",children:O.kind==="task"?t.jsx(lt,{task:O.task,goal:O.goal,tags:O.tags,activeRun:O.activeRun,isSelected:u===O.task.id,isDragging:!0,isOverlay:!0,isMobile:L,onSelect:()=>{},onStartTask:w,onSplitTask:j,notesSummaryByEntity:z}):t.jsx(ot,{project:O.project,goal:O.goal,isDragging:!0,isOverlay:!0,isMobile:L})}):null}),t.jsx(Dt,{open:b!==null,title:(b==null?void 0:b.kind)==="project"?((_e=T.find(i=>i.id===b.entityId))==null?void 0:_e.title)??"Project actions":((Be=Y.find(i=>i.id===(b==null?void 0:b.entityId)))==null?void 0:Be.title)??"Work item actions",subtitle:(b==null?void 0:b.kind)==="project"?"Edit, relink, move, or break this project into issues.":"Edit, relink, move, or create the next child work item.",items:dt,position:(b==null?void 0:b.position)??null,onClose:()=>F(null)}),G?t.jsx("div",{className:"surface-overlay fixed inset-0 z-[60] flex items-center justify-center p-4 backdrop-blur-xl",children:t.jsxs(it,{className:"surface-modal-panel w-full max-w-md",children:[t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"mt-1 flex size-11 shrink-0 items-center justify-center rounded-full bg-[var(--ui-danger-soft)] text-[var(--danger)]",children:t.jsx(je,{className:"size-5"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-display text-[1.35rem] leading-tight text-[var(--ui-ink-strong)]",children:h("common.executionBoard.deleteConfirmTitle")}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:h("common.executionBoard.deleteConfirmDescription",{title:G.title})})]})]}),t.jsxs("label",{className:"mt-5 flex items-center gap-3 rounded-[18px] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-medium)]",children:[t.jsx("input",{type:"checkbox",checked:ke,onChange:i=>ne(i.target.checked),className:"size-4 rounded border-[var(--ui-border-strong)] bg-transparent text-[var(--primary)]"}),t.jsx("span",{children:h("common.executionBoard.deleteConfirmCheckbox")})]}),t.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-3",children:[t.jsx(qe,{variant:"secondary",onClick:()=>{Q(null),ne(!1)},children:h("common.executionBoard.deleteConfirmCancel")}),t.jsx(qe,{className:"bg-[var(--ui-danger-soft)] text-[var(--danger)] shadow-[var(--ui-shadow-soft)]",pending:X===G.id,pendingLabel:h("common.executionBoard.deletingTask"),onClick:()=>void De(G,ke),children:h("common.executionBoard.deleteConfirmSubmit")})]})]})}):null]})}export{Jt as E};
|
|
1
|
+
import{r as N,bg as Je,ce as Fe,cb as Qe,cv as he,j as t,c7 as je,b2 as pt,ca as Xe,cw as Ze,cx as Ye,bM as xt,br as gt,c9 as bt,aO as ht,aP as ve,bo as Ue,cy as vt}from"./vendor-Dnkkx2co.js";import{u as wt,a as jt,D as yt,S as Pe,v as Ve,e as Nt,p as kt,f as St,P as It,g as Te,b as et,C as tt}from"./board-dIX6etHh.js";import{P as ye,C as it,B as qe,Z as W,_ as Ct,aS as rt,b as le,c as S,V as at,U as we}from"./index-BP9__l6C.js";import{E as zt}from"./entity-note-count-link-DUxobQUt.js";import{F as Dt}from"./floating-action-menu-DBzfnJOx.js";function $t(e){if(typeof e=="number"&&Number.isInteger(e)&&e>0)return e;if(typeof e=="string"){const r=e.match(/(\d+)/);if(r){const l=Number.parseInt(r[1]??"",10);return Number.isInteger(l)&&l>0?l:null}}return null}function Ge(e){return e.split(/\r?\n/).map(r=>r.trim()).reduce((r,l)=>{const o=l.match(/^[-*+]\s+\[([ xX])\]\s+(.+)$/);if(o)return r.push({label:o[2].trim(),completed:o[1].toLowerCase()==="x"}),r;const c=l.match(/^(?:[-*+]|\d+\.)\s+(.+)$/);return c&&r.push({label:c[1].trim(),completed:null}),r},[]).filter(r=>r.label.length>0)}function _t(e){if(e.acceptanceCriteria.length>0)return{total:e.acceptanceCriteria.length,completed:e.status==="done"?e.acceptanceCriteria.length:0,source:"acceptance_criteria",items:e.acceptanceCriteria};const r=Ge(e.aiInstructions);if(r.length>0){const o=e.status==="done"?r.length:r.filter(c=>c.completed===!0).length;return{total:r.length,completed:o,source:"ai_instructions",items:r.map(c=>c.label)}}const l=Ge(e.description);if(l.length>0){const o=e.status==="done"?l.length:l.filter(c=>c.completed===!0).length;return{total:l.length,completed:o,source:"description",items:l.map(c=>c.label)}}return null}function He(e,r){return e.find(l=>l.refType===r)??null}function nt(e,r=null){var f,x,w,D,k,C,$,U,_,B,R;const l=new Set(((f=e.completionReport)==null?void 0:f.linkedGitRefIds)??[]),o=He(e.gitRefs,"branch"),c=He(e.gitRefs,"pull_request"),u=(r==null?void 0:r.gitContext)??null,m=(u==null?void 0:u.pullRequestNumber)??$t((c==null?void 0:c.refValue)??(c==null?void 0:c.displayTitle)??null);return{actor:(r==null?void 0:r.actor)??null,activeRun:r,stepSummary:_t(e),changedFileCount:((x=e.completionReport)==null?void 0:x.modifiedFiles.length)??0,changedFilesPreview:(((w=e.completionReport)==null?void 0:w.modifiedFiles)??[]).slice(0,2),git:{provider:((D=u==null?void 0:u.provider)==null?void 0:D.trim())||((k=o==null?void 0:o.provider)==null?void 0:k.trim())||((C=c==null?void 0:c.provider)==null?void 0:C.trim())||null,repository:(($=u==null?void 0:u.repository)==null?void 0:$.trim())||((U=o==null?void 0:o.repository)==null?void 0:U.trim())||((_=c==null?void 0:c.repository)==null?void 0:_.trim())||null,branch:((B=u==null?void 0:u.branch)==null?void 0:B.trim())||((R=o==null?void 0:o.refValue)==null?void 0:R.trim())||null,branchUrl:(u==null?void 0:u.branchUrl)??(o==null?void 0:o.url)??null,pullRequestNumber:m,pullRequestUrl:(u==null?void 0:u.pullRequestUrl)??(c==null?void 0:c.url)??null,compareUrl:(u==null?void 0:u.compareUrl)??null,linkedRefCount:l.size}}}const I=["backlog","focus","in_progress","blocked","done"];function Bt(e){if(!e)return null;const r=Date.parse(e);return Number.isNaN(r)?null:new Date(r).toISOString().slice(0,10)}function Mt({task:e,onOpenTask:r,onEditTask:l,onLinkTask:o,onCreateTaskForIssue:c,onCreateSubtaskForTask:u,onMove:m,onDeleteTask:f,deletePendingTaskId:x,onRequestDelete:w}){const D=e.level==="issue"?{id:"create-task",label:"Create task",description:"Add a focused execution task under this issue.",icon:he,onSelect:()=>c==null?void 0:c(e.id)}:e.level==="task"?{id:"create-subtask",label:"Create subtask",description:"Add a granular child step under this task.",icon:he,onSelect:()=>u==null?void 0:u(e.id)}:null;return[{id:"open-task",label:"Open",description:"Jump to the work-item detail view.",icon:Je,onSelect:()=>r==null?void 0:r(e.id)},{id:"edit-task",label:"Edit",description:"Open the guided work-item editor.",icon:Fe,onSelect:()=>l==null?void 0:l(e.id)},{id:"link-task",label:"Link",description:"Open the placement step to relink this work item.",icon:Qe,onSelect:()=>o==null?void 0:o(e.id)},...D?[D]:[],{id:"delete-task",label:e.level==="issue"?"Delete issue":e.level==="subtask"?"Delete subtask":"Delete task",description:"Remove this work item directly from the board menu.",icon:je,tone:"danger",disabled:!f||x===e.id,onSelect:()=>w(e)},...I.filter(k=>k!==e.status).map(k=>({id:`move-task-${k}`,label:`Move to ${k.replaceAll("_"," ")}`,description:"Update the workflow lane for this work item.",onSelect:()=>void m(e.id,k)}))]}function st(e){return e.startsWith("lane:")||e.includes(":lane:")}function At(e){var r,l;return((l=(r=e.data)==null?void 0:r.current)==null?void 0:l.type)==="lane"||st(String(e.id))}function Lt(e){var r,l;return((l=(r=e.data)==null?void 0:r.current)==null?void 0:l.type)==="trash"}function Et(e,r){const l=Math.max(0,Math.min(e.right,r.right)-Math.max(e.left,r.left)),o=Math.max(0,Math.min(e.bottom,r.bottom)-Math.max(e.top,r.top));return l*o}const Rt=e=>{const r=kt(e),l=r.find(m=>{const f=e.droppableContainers.find(x=>x.id===m.id);return f?Lt(f):!1});if(l)return[l];const o=r.find(m=>st(String(m.id)));if(o)return[o];const u=e.droppableContainers.filter(m=>At(m)).map(m=>{const f=e.droppableRects.get(m.id);if(!f)return null;const x=Et(e.collisionRect,f);return x<=0?null:{id:m.id,data:{droppableContainer:m,value:x}}}).filter(Boolean).sort((m,f)=>{var x,w;return(((x=f==null?void 0:f.data)==null?void 0:x.value)??0)-(((w=m==null?void 0:m.data)==null?void 0:w.value)??0)});return u.length>0?u:r.length>0?r:St(e)};function Ot(e,r){return r&&r.trim().length>0?r:e!=null&&e.actor?`${e.actor} session`:"Active work"}function Ut(e,r){return[(e==null?void 0:e.actor)??null,r].filter(Boolean).join(" · ")}function Ke(e){e.preventDefault(),e.stopPropagation()}function lt({task:e,goal:r,tags:l,activeRun:o,isSelected:c,isDragging:u=!1,isOverlay:m=!1,style:f,setNodeRef:x,dragAttributes:w,dragListeners:D,isMobile:k=!1,onSelect:C,onStartTask:$,onStopTask:U,onQuickReopen:_,onStepTask:B,onSplitTask:R,onOpenMenu:P,notesSummaryByEntity:V}){var X;const{t:M,formatDate:ae}=ye(),j=nt(e,o??null),z=j.stepSummary,h=I[I.indexOf(e.status)-1]??null,A=I[I.indexOf(e.status)+1]??null,oe=Ct(V,"task",e.id).count,L=e.level==="issue"?"issue":"task",ce=rt(L),te=e.level==="subtask"?"136,146,255":ce.colorToken.rgb.join(", "),q=e.dueDate&&!Number.isNaN(Date.parse(e.dueDate))?ae(e.dueDate):"No due date",J=z&&z.total>0?Math.max(8,Math.round(z.completed/z.total*100)):null,b=j.git.branch,F=j.git.branchUrl,G=j.git.pullRequestNumber?`PR #${j.git.pullRequestNumber}`:null,Q=j.git.pullRequestUrl;return t.jsxs("article",{ref:x,style:{...f,"--board-card-accent":te},className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[18px] p-3 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.12)] transition cursor-grab active:cursor-grabbing",k&&"touch-none select-none",m&&"rotate-[0.5deg] bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.22),rgba(var(--board-card-accent),0.08))] shadow-[var(--ui-shadow-floating)]",u&&!m&&"opacity-35 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.08)]",c?"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.18),rgba(var(--board-card-accent),0.06))] shadow-[var(--ui-shadow-soft)]":"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.08),color-mix(in_srgb,var(--ui-surface-1)_72%,transparent))]"),"data-dragging":u?"true":"false","data-testid":`task-card-${e.id}`,onClick:()=>C(e.id),...w,...D,children:[t.jsx("div",{className:"mb-3 h-px w-full rounded-full",style:{background:`linear-gradient(90deg, rgba(${te}, 0.96), rgba(${te}, 0.18))`}}),t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx(le,{kind:L,label:e.level,compact:!0,size:"xs",gradient:!1,className:"shrink-0"}),t.jsx(S,{size:"xs",className:"shrink-0 text-[10px] text-[var(--tertiary)]",children:e.priority}),j.actor?t.jsxs(S,{size:"xs",className:"shrink-0 bg-cyan-400/12 text-[var(--info)]",children:[t.jsx(pt,{className:"mr-1 size-3"}),j.actor]}):null]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[P?t.jsx("button",{type:"button","aria-label":`Open ${e.title} actions`,className:"inline-flex size-8 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)]",onClick:g=>{g.preventDefault(),g.stopPropagation(),P(g,e)},children:t.jsx(Xe,{className:"size-3.5"})}):null,k?t.jsxs("div",{className:"flex items-center gap-1",onClick:g=>g.stopPropagation(),children:[t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the previous lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)] disabled:opacity-35",disabled:!h,onClick:()=>{h&&(B==null||B(e.id,"previous"))},children:t.jsx(Ze,{className:"size-3.5"})}),t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the next lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)] disabled:opacity-35",disabled:!A,onClick:()=>{A&&(B==null||B(e.id,"next"))},children:t.jsx(Ye,{className:"size-3.5"})})]}):null,o?t.jsx("button",{type:"button","aria-label":`Stop work on ${e.title}`,className:"inline-flex size-8 items-center justify-center rounded-full bg-rose-500/16 text-[var(--danger)] transition hover:bg-rose-500/24",onClick:g=>{g.preventDefault(),g.stopPropagation(),U==null||U(o)},children:t.jsx(xt,{className:"size-3.5 fill-current"})}):e.status!=="done"?t.jsx("button",{type:"button","aria-label":`Start work on ${e.title}`,className:"inline-flex size-8 items-center justify-center rounded-full bg-[var(--primary)]/16 text-[var(--primary)] transition hover:bg-[var(--primary)]/24",onClick:g=>{g.preventDefault(),g.stopPropagation(),$==null||$(e.id)},children:t.jsx(gt,{className:"size-4 fill-current"})}):null,(X=e.splitSuggestion)!=null&&X.shouldSplit&&R?t.jsxs("button",{type:"button","aria-label":`Split ${e.title}`,className:"inline-flex items-center gap-1 rounded-full bg-amber-400/12 px-2.5 py-1 text-[10px] font-medium tracking-[0.14em] text-[var(--warning)] transition hover:bg-amber-400/18",onClick:g=>{g.preventDefault(),g.stopPropagation(),R(e.id)},children:[t.jsx(bt,{className:"size-3.5"}),"Split it"]}):null,t.jsxs("span",{className:"shrink-0 text-[11px] text-[var(--ui-ink-faint)]",children:[e.points," xp"]})]})]}),t.jsx(at,{kind:L,label:e.title,className:"max-w-full",lines:3,labelClassName:"[overflow-wrap:anywhere]"}),t.jsx("p",{className:"mt-1.5 line-clamp-3 [overflow-wrap:anywhere] text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:e.description||M("common.executionBoard.noExecutionNote")}),z?t.jsxs("div",{className:"mt-3 rounded-[16px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-3",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] text-[var(--ui-ink-soft)]",children:[t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(ht,{className:"size-3.5 text-[var(--info)]"}),z.total," step",z.total===1?"":"s"]}),t.jsxs("span",{className:"tabular-nums text-[var(--ui-ink-soft)]",children:[z.completed,"/",z.total]})]}),t.jsx("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-[var(--ui-surface-2)]",children:t.jsx("div",{className:"h-full rounded-full bg-[linear-gradient(90deg,rgba(56,189,248,0.96),rgba(125,211,252,0.62))]",style:{width:`${J??0}%`}})}),t.jsx("div",{className:"mt-2 grid gap-1.5",children:z.items.slice(0,2).map(g=>t.jsx("div",{className:"truncate text-[11px] text-[var(--ui-ink-soft)]",children:g},`${e.id}-${g}`))})]}):null,t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[b?F?t.jsxs("a",{href:F,target:"_blank",rel:"noreferrer",className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-sky-300/18 bg-sky-400/12 px-2.5 py-1 text-[11px] text-[var(--info)] transition hover:bg-sky-400/18",onClick:Ke,children:[t.jsx(ve,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"truncate",children:b})]}):t.jsxs(S,{size:"xs",className:"min-w-0 max-w-full bg-sky-400/12 text-[var(--info)]",children:[t.jsx(ve,{className:"mr-1 size-3"}),t.jsx("span",{className:"truncate",children:b})]}):null,G?Q?t.jsxs("a",{href:Q,target:"_blank",rel:"noreferrer",className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-fuchsia-300/18 bg-fuchsia-400/12 px-2.5 py-1 text-[11px] text-[var(--primary)] transition hover:bg-fuchsia-400/18",onClick:Ke,children:[t.jsx(Ue,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"truncate",children:G})]}):t.jsxs(S,{size:"xs",className:"bg-fuchsia-400/12 text-[var(--primary)]",children:[t.jsx(Ue,{className:"mr-1 size-3"}),G]}):null,j.changedFileCount>0?t.jsxs(S,{size:"xs",className:"bg-amber-400/12 text-[var(--warning)]",children:[t.jsx(vt,{className:"mr-1 size-3"}),j.changedFileCount," file",j.changedFileCount===1?"":"s"]}):null,j.git.repository?t.jsx(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:j.git.repository}):null]}),j.changedFilesPreview.length>0?t.jsx("div",{className:"mt-2 flex min-w-0 flex-wrap gap-1.5",children:j.changedFilesPreview.map(g=>t.jsx(S,{size:"xs",wrap:!0,className:"min-w-0 max-w-full bg-[var(--ui-surface-2)] font-mono text-[10px] text-[var(--ui-ink-soft)]",children:g},g))}):null,t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[r?t.jsx(le,{kind:"goal",label:r.title,compact:!0,size:"xs",wrap:!0,className:"min-w-0 max-w-full"}):null,t.jsx(we,{user:e.user,compact:!0,size:"xs"}),t.jsx(zt,{entityType:"task",entityId:e.id,count:oe,compact:!0}),e.actionPointSummary?t.jsxs(S,{size:"xs",className:"bg-[var(--primary)]/12 text-[var(--primary)]",children:[Math.round(e.actionPointSummary.totalCostAp)," AP"]}):null,e.actionPointSummary?t.jsx(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:e.actionPointSummary.costBand}):null,e.actionPointSummary?t.jsxs(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[Math.round(e.actionPointSummary.expectedDurationSeconds/3600)," ","h target"]}):null,e.time.totalCreditedSeconds>0?t.jsxs(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[Math.floor(e.time.totalCreditedSeconds/60)," min"]}):null,e.time.activeRunCount>0?t.jsxs(S,{size:"xs",className:"bg-emerald-500/12 text-[var(--success)]",children:[e.time.activeRunCount," live"]}):null,l.slice(0,2).map(g=>t.jsx(S,{size:"xs",className:"bg-[var(--ui-surface-2)]",style:{color:g.color},children:g.name},g.id))]}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 items-center justify-between gap-2 text-[11px] text-[var(--ui-ink-faint)]",children:[t.jsxs("span",{className:"min-w-0 truncate",children:[e.effort," / ",e.energy]}),t.jsxs("div",{className:"flex min-w-0 shrink-0 items-center gap-2 text-right",children:[e.status==="done"&&_?t.jsx("button",{type:"button",className:"rounded-full bg-[var(--ui-surface-2)] px-3 py-1 text-[10px] tracking-[0.16em] text-[var(--ui-ink-strong)] transition hover:bg-[var(--ui-surface-3)]",onClick:g=>{g.preventDefault(),g.stopPropagation(),_(e.id)},children:M("common.executionBoard.reopen")}):null,t.jsx("span",{children:q})]})]})]})}function ge(e){const{task:r,sortableId:l}=e,{attributes:o,listeners:c,setNodeRef:u,transform:m,transition:f,isDragging:x}=et({id:l,data:{type:"task",taskId:r.id,status:r.status}});return t.jsx(lt,{...e,setNodeRef:u,dragAttributes:o,dragListeners:c,isDragging:x,isMobile:e.isMobile,onStartTask:e.onStartTask,onStopTask:e.onStopTask,onStepTask:e.onStepTask,onSplitTask:e.onSplitTask,notesSummaryByEntity:e.notesSummaryByEntity,style:{transform:tt.Transform.toString(m),transition:f}})}function ot({project:e,goal:r,isDragging:l=!1,isOverlay:o=!1,style:c,setNodeRef:u,dragAttributes:m,dragListeners:f,isMobile:x=!1,onStepProject:w,onOpenMenu:D}){const{formatDate:k}=ye(),C=I[I.indexOf(e.workflowStatus)-1]??null,$=I[I.indexOf(e.workflowStatus)+1]??null,_=rt("project").colorToken.rgb.join(", "),B=e.workflowStatus.replaceAll("_"," "),R=e.status.replaceAll("_"," "),P=Bt(e.updatedAt),V=P?k(P):"No recent update";return t.jsxs("article",{ref:u,style:{...c,"--board-card-accent":_},className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[18px] p-3 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.12)] transition cursor-grab active:cursor-grabbing",x&&"touch-none select-none",o&&"rotate-[0.5deg] bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.22),rgba(var(--board-card-accent),0.08))] shadow-[var(--ui-shadow-floating)]",l&&!o&&"opacity-35 shadow-[inset_0_0_0_1px_rgba(var(--board-card-accent),0.08)]",!l&&!o&&"bg-[linear-gradient(180deg,rgba(var(--board-card-accent),0.08),color-mix(in_srgb,var(--ui-surface-1)_72%,transparent))]"),"data-testid":`project-card-${e.id}`,...m,...f,children:[t.jsx("div",{className:"mb-3 h-px w-full rounded-full",style:{background:`linear-gradient(90deg, rgba(${_}, 0.96), rgba(${_}, 0.18))`}}),t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx(le,{kind:"project",label:"project",compact:!0,size:"xs",gradient:!1,className:"shrink-0"}),t.jsx(S,{size:"xs",className:"shrink-0 bg-[var(--primary)]/12 text-[var(--primary)]",children:B}),t.jsx(S,{size:"xs",className:"shrink-0 bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:R})]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-1.5",children:[D?t.jsx("button",{type:"button","aria-label":`Open ${e.title} actions`,className:"inline-flex size-8 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)]",onClick:M=>{M.preventDefault(),M.stopPropagation(),D(M,e)},children:t.jsx(Xe,{className:"size-3.5"})}):null,x?t.jsxs("div",{className:"flex items-center gap-1",onClick:M=>M.stopPropagation(),children:[t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the previous lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)] disabled:opacity-35",disabled:!C,onClick:()=>{C&&(w==null||w(e.id,"previous"))},children:t.jsx(Ze,{className:"size-3.5"})}),t.jsx("button",{type:"button","aria-label":`Move ${e.title} to the next lane`,className:"inline-flex size-7 items-center justify-center rounded-full bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)] disabled:opacity-35",disabled:!$,onClick:()=>{$&&(w==null||w(e.id,"next"))},children:t.jsx(Ye,{className:"size-3.5"})})]}):null]})]}),t.jsx(at,{kind:"project",label:e.title,className:"max-w-full",lines:3,labelClassName:"[overflow-wrap:anywhere]"}),t.jsx("p",{className:"mt-1.5 line-clamp-3 [overflow-wrap:anywhere] text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:e.description||"PRD-backed initiative spanning multiple work items."}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 flex-wrap gap-1.5",children:[r?t.jsx(le,{kind:"goal",label:r.title,compact:!0,size:"xs",wrap:!0,className:"min-w-0 max-w-full"}):null,t.jsx(we,{user:e.user,compact:!0,size:"xs"}),(e.assignees??[]).slice(0,2).map(M=>t.jsx(we,{user:M,compact:!0,size:"xs"},M.id)),t.jsxs(S,{size:"xs",className:"bg-[var(--primary)]/12 text-[var(--primary)]",children:[e.progress,"% progress"]}),t.jsxs(S,{size:"xs",className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:[e.totalTasks," linked tasks"]})]}),t.jsxs("div",{className:"mt-2.5 flex min-w-0 items-center justify-between gap-2 text-[11px] text-[var(--ui-ink-faint)]",children:[t.jsx("span",{className:"min-w-0 truncate",children:e.goalTitle}),t.jsx("span",{children:V})]})]})}function be(e){const{project:r,sortableId:l}=e,{attributes:o,listeners:c,setNodeRef:u,transform:m,transition:f,isDragging:x}=et({id:l,data:{type:"project",projectId:r.id,status:r.workflowStatus}});return t.jsx(ot,{...e,setNodeRef:u,dragAttributes:o,dragListeners:c,isDragging:x,style:{transform:tt.Transform.toString(m),transition:f}})}function We({droppableId:e,status:r,title:l,detail:o,count:c,dragging:u,children:m}){const{setNodeRef:f,isOver:x}=Te({id:e,data:{type:"lane",status:r}});return t.jsx("div",{ref:f,className:W("w-full max-w-full min-w-0 overflow-hidden rounded-[24px] transition",x&&"scale-[1.005]"),"data-lane-id":r,"data-testid":`kanban-lane-${r}`,"data-lane-hover":x?"true":"false",children:t.jsxs(it,{className:W("h-full w-full max-w-full min-w-0 overflow-hidden p-3 transition-[background-color,box-shadow,border-color,transform]",u&&"border border-[var(--ui-border-subtle)]",x?"border border-[color-mix(in_srgb,var(--info)_38%,transparent)] bg-[var(--ui-info-soft)] shadow-[var(--ui-shadow-soft)]":"border border-transparent"),children:[t.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"type-label text-[var(--ui-ink-faint)]",children:o}),t.jsx("h3",{className:"mt-1 break-words text-[1.45rem] leading-[1] text-[var(--ui-ink-strong)]",children:l})]}),t.jsx("div",{className:"shrink-0 font-display text-[1.45rem] text-[var(--primary)]",children:c})]}),t.jsx("div",{className:W("grid w-full max-w-full min-w-0 min-h-48 content-start gap-2 rounded-[18px] p-2 transition",x?"bg-[var(--ui-info-soft)]":"bg-[var(--ui-surface-1)]"),children:m})]})})}function Pt({title:e,detail:r,children:l}){return t.jsxs("div",{className:"rounded-[20px] border border-[color-mix(in_srgb,var(--info)_24%,transparent)] bg-[var(--ui-info-soft)] p-2.5 shadow-[inset_0_0_0_1px_var(--ui-border-subtle)]",children:[t.jsx("div",{className:"mb-2 flex items-start justify-between gap-3 px-1",children:t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"inline-flex items-center gap-2 text-[11px] uppercase tracking-[0.16em] text-[var(--info)]/86",children:[t.jsx(ve,{className:"size-3.5"}),t.jsx("span",{className:"truncate",children:e})]}),r?t.jsx("div",{className:"mt-1 text-[11px] text-[var(--ui-ink-faint)]",children:r}):null]})}),t.jsx("div",{className:"grid gap-2",children:l})]})}function Vt({droppableId:e,title:r,detail:l}){const{setNodeRef:o,isOver:c}=Te({id:e,data:{type:"trash"}});return t.jsx("div",{ref:o,className:W("pointer-events-auto fixed right-4 top-4 z-50 w-[min(18rem,calc(100vw-2rem))] rounded-[28px] border px-5 py-4 shadow-[var(--ui-shadow-floating)] backdrop-blur-2xl transition lg:right-6 lg:top-6",c?"border-[color-mix(in_srgb,var(--danger)_38%,transparent)] bg-[var(--ui-danger-soft)] text-[var(--ui-ink-strong)] scale-[1.02]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] text-[var(--ui-ink-medium)]"),"data-testid":"kanban-trash-dropzone","data-trash-hover":c?"true":"false",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:W("flex size-12 items-center justify-center rounded-full border transition",c?"border-[var(--ui-border-strong)] bg-[var(--ui-surface-3)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]"),children:t.jsx(je,{className:"size-5"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-[var(--ui-ink-soft)]",children:"Bin"}),t.jsx("div",{className:"mt-1 text-base font-medium text-[var(--ui-ink-strong)]",children:r}),t.jsx("div",{className:"mt-1 text-sm leading-5 text-[var(--ui-ink-soft)]",children:l})]})]})})}function Jt({tasks:e,projects:r=[],activeRuns:l=[],goals:o,tags:c,selectedTaskId:u,onMove:m,onMoveProject:f,onSelectTask:x,onStartTask:w,onStopTask:D,onQuickReopenTask:k,onDeleteTask:C,onOpenProject:$,onOpenTask:U,onEditProject:_,onEditTask:B,onLinkProject:R,onLinkTask:P,onCreateIssueForProject:V,onCreateTaskForIssue:M,onCreateSubtaskForTask:ae,onSplitTask:j,notesSummaryByEntity:z}){var _e,Be;const{t:h}=ye(),A=N.useId(),oe=`${A}:trash`,[L,ce]=N.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 1023px)").matches),te=wt(jt(It,{activationConstraint:{distance:6}})),[q,J]=N.useState(null),[b,F]=N.useState(null),[G,Q]=N.useState(null),[X,g]=N.useState(null),[Ne,ct]=N.useState(()=>typeof window>"u"?!1:window.localStorage.getItem("forge.kanban-skip-delete-confirmation")==="true"),[ke,ne]=N.useState(!1),[Se,Z]=N.useState({}),[Ie,ie]=N.useState({}),se={backlog:{title:h("common.executionBoard.laneBacklogTitle"),detail:h("common.executionBoard.laneBacklogDetail")},focus:{title:h("common.executionBoard.laneFocusTitle"),detail:h("common.executionBoard.laneFocusDetail")},in_progress:{title:h("common.executionBoard.laneProgressTitle"),detail:h("common.executionBoard.laneProgressDetail")},blocked:{title:h("common.executionBoard.laneBlockedTitle"),detail:h("common.executionBoard.laneBlockedDetail")},done:{title:h("common.executionBoard.laneDoneTitle"),detail:h("common.executionBoard.laneDoneDetail")}},Y=N.useMemo(()=>e.map(i=>{const a=Se[i.id];return a?{...i,status:a}:i}),[Se,e]),T=N.useMemo(()=>r.map(i=>{const a=Ie[i.id];return a?{...i,workflowStatus:a}:i}),[Ie,r]),Ce=N.useMemo(()=>{const i=new Map;for(const a of l){if(a.status!=="active")continue;const n=i.get(a.taskId);(!n||a.isCurrent||a.updatedAt>n.updatedAt)&&i.set(a.taskId,a)}return i},[l]),K=N.useMemo(()=>[...T.map(i=>({kind:"project",id:i.id,status:i.workflowStatus,project:i,goal:o.find(a=>a.id===i.goalId)})),...Y.map(i=>({kind:"task",id:i.id,status:i.status,task:i,goal:o.find(a=>a.id===i.goalId),tags:i.tagIds.map(a=>c.find(n=>n.id===a)).filter(Boolean),activeRun:Ce.get(i.id)??null}))],[Ce,T,Y,o,c]),O=q?K.find(i=>i.id===q)??null:null,dt=N.useMemo(()=>{if(!b)return[];if(b.kind==="project"){const a=T.find(n=>n.id===b.entityId);return a?[{id:"open-project",label:"Open",description:"Jump to the project detail view.",icon:Je,onSelect:()=>$==null?void 0:$(a.id)},{id:"edit-project",label:"Edit",description:"Open the guided project editor.",icon:Fe,onSelect:()=>_==null?void 0:_(a.id)},{id:"link-project",label:"Link",description:"Open the anchor step to relink the project to its goal.",icon:Qe,onSelect:()=>R==null?void 0:R(a.id)},{id:"create-issue",label:"Create issue",description:"Break this project into a new vertical slice issue.",icon:he,onSelect:()=>V==null?void 0:V(a.id)},...I.filter(n=>n!==a.workflowStatus).map(n=>({id:`move-project-${n}`,label:`Move to ${n.replaceAll("_"," ")}`,description:"Update the project workflow lane without leaving the board.",onSelect:()=>void(f==null?void 0:f(a.id,n))}))]:[]}const i=Y.find(a=>a.id===b.entityId);return i?Mt({task:i,onOpenTask:U,onEditTask:B,onLinkTask:P,onCreateTaskForIssue:M,onCreateSubtaskForTask:ae,onMove:m,onDeleteTask:C,deletePendingTaskId:X,onRequestDelete:$e}):[]},[T,Y,b,V,ae,M,_,B,R,P,m,f,C,$,U,X,Ne]);function ze(i){var n;if(i.length===0)return t.jsx("div",{className:"w-full max-w-full rounded-[18px] border border-dashed border-[var(--ui-border-subtle)] px-4 py-8 text-center text-sm text-[var(--ui-ink-faint)]",children:h("common.executionBoard.emptyLane")});if(((n=i[0])==null?void 0:n.status)!=="in_progress")return i.map(d=>d.kind==="task"?t.jsx(ge,{sortableId:`${A}:task:${d.task.id}`,task:d.task,goal:d.goal,tags:d.tags,activeRun:d.activeRun,isSelected:u===d.task.id,isMobile:L,onSelect:x,onStartTask:w,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:j,notesSummaryByEntity:z},d.task.id):t.jsx(be,{sortableId:`${A}:project:${d.project.id}`,project:d.project,goal:d.goal,isMobile:L,onStepProject:ue,onOpenMenu:fe},d.project.id));const a=new Map;for(const d of i){if(d.kind!=="task"||!d.activeRun){const E=a.get("ungrouped");E?E.items.push(d):a.set("ungrouped",{title:"Active work",detail:"Tasks in progress without a tracked branch",items:[d]});continue}const p=nt(d.task,d.activeRun),s=[d.activeRun.actor,p.git.repository??"",p.git.branch??""].join("::"),v=a.get(s);if(v){v.items.push(d);continue}a.set(s,{title:Ot(d.activeRun,p.git.branch),detail:Ut(d.activeRun,p.git.repository),items:[d]})}return Array.from(a.entries()).map(([d,p])=>d==="ungrouped"?p.items.map(s=>s.kind==="task"?t.jsx(ge,{sortableId:`${A}:task:${s.task.id}`,task:s.task,goal:s.goal,tags:s.tags,activeRun:s.activeRun,isSelected:u===s.task.id,isMobile:L,onSelect:x,onStartTask:w,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:j,notesSummaryByEntity:z},s.task.id):t.jsx(be,{sortableId:`${A}:project:${s.project.id}`,project:s.project,goal:s.goal,isMobile:L,onStepProject:ue,onOpenMenu:fe},s.project.id)):t.jsx(Pt,{title:p.title,detail:p.detail,children:p.items.map(s=>s.kind==="task"?t.jsx(ge,{sortableId:`${A}:task:${s.task.id}`,task:s.task,goal:s.goal,tags:s.tags,activeRun:s.activeRun,isSelected:u===s.task.id,isMobile:L,onSelect:x,onStartTask:w,onStopTask:D,onQuickReopen:k,onStepTask:de,onOpenMenu:me,onSplitTask:j,notesSummaryByEntity:z},s.task.id):t.jsx(be,{sortableId:`${A}:project:${s.project.id}`,project:s.project,goal:s.goal,isMobile:L,onStepProject:ue,onOpenMenu:fe},s.project.id))},d))}N.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 1023px)"),a=n=>{ce(n?n.matches:i.matches)};return a(),typeof i.addEventListener=="function"?(i.addEventListener("change",a),()=>i.removeEventListener("change",a)):(i.addListener(a),()=>i.removeListener(a))},[]),N.useEffect(()=>{if(!q){document.body.style.cursor="";return}return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=""}},[q]),N.useEffect(()=>{Z(i=>{const a=new Set(e.map(p=>p.id));let n=!1;const d={};for(const[p,s]of Object.entries(i)){const v=e.find(E=>E.id===p);if(!a.has(p)||!v||v.status===s){n=!0;continue}d[p]=s}return n?d:i})},[e]),N.useEffect(()=>{ie(i=>{const a=new Set(r.map(p=>p.id));let n=!1;const d={};for(const[p,s]of Object.entries(i)){const v=r.find(E=>E.id===p);if(!a.has(p)||!v||v.workflowStatus===s){n=!0;continue}d[p]=s}return n?d:i})},[r]);function ut(i){var d,p;const a=(d=i.active.data.current)==null?void 0:d.taskId,n=(p=i.active.data.current)==null?void 0:p.projectId;typeof a=="string"?J(a):typeof n=="string"&&J(n)}const mt=i=>{ct(i),typeof window<"u"&&window.localStorage.setItem("forge.kanban-skip-delete-confirmation","true")},De=async(i,a)=>{if(C){g(i.id);try{a&&mt(!0),await C(i.id),Q(null),ne(!1),Z(n=>{const d={...n};return delete d[i.id],d})}finally{g(null)}}};function $e(i){if(C){if(Ne){De(i,!1);return}ne(!1),Q(i)}}async function ft(i){var Me,Ae,Le,Ee,Re,Oe;const{active:a,over:n}=i;if(J(null),!n||a.id===n.id)return;const d=typeof((Me=a.data.current)==null?void 0:Me.taskId)=="string"?a.data.current.taskId:null,p=typeof((Ae=a.data.current)==null?void 0:Ae.projectId)=="string"?a.data.current.projectId:null,s=(d?K.find(y=>y.kind==="task"&&y.id===d):null)??(p?K.find(y=>y.kind==="project"&&y.id===p):null);if(!s)return;if(((Le=n.data.current)==null?void 0:Le.type)==="trash"){if(s.kind!=="task"||!C)return;$e(s.task);return}const v=typeof((Ee=n.data.current)==null?void 0:Ee.status)=="string"?n.data.current.status:null,E=typeof((Re=n.data.current)==null?void 0:Re.taskId)=="string"?n.data.current.taskId:null,H=typeof((Oe=n.data.current)==null?void 0:Oe.projectId)=="string"?n.data.current.projectId:null,pe=(E?K.find(y=>y.kind==="task"&&y.id===E):null)??(H?K.find(y=>y.kind==="project"&&y.id===H):null),ee=v??(pe==null?void 0:pe.status)??s.status;if(!(ee===s.status||!I.includes(ee))){if(s.kind==="task"){Z(y=>({...y,[s.task.id]:ee}));try{await m(s.task.id,ee)}catch(y){throw Z(xe=>{const re={...xe};return delete re[s.task.id],re}),y}return}if(f){ie(y=>({...y,[s.project.id]:ee}));try{await f(s.project.id,ee)}catch(y){throw ie(xe=>{const re={...xe};return delete re[s.project.id],re}),y}}}}async function de(i,a){const n=Y.find(v=>v.id===i);if(!n)return;const d=I.indexOf(n.status),p=a==="previous"?d-1:d+1,s=I[p]??null;if(!(!s||s===n.status)){Z(v=>({...v,[n.id]:s}));try{await m(n.id,s)}catch(v){throw Z(E=>{const H={...E};return delete H[n.id],H}),v}}}async function ue(i,a){const n=T.find(v=>v.id===i);if(!n||!f)return;const d=I.indexOf(n.workflowStatus),p=a==="previous"?d-1:d+1,s=I[p]??null;if(!(!s||s===n.workflowStatus)){ie(v=>({...v,[n.id]:s}));try{await f(n.id,s)}catch(v){throw ie(E=>{const H={...E};return delete H[n.id],H}),v}}}function me(i,a){const n=i.currentTarget.getBoundingClientRect();F({kind:"task",entityId:a.id,position:{x:n.right-8,y:n.bottom+8}})}function fe(i,a){const n=i.currentTarget.getBoundingClientRect();F({kind:"project",entityId:a.id,position:{x:n.right-8,y:n.bottom+8}})}return t.jsxs(yt,{sensors:te,collisionDetection:Rt,onDragStart:ut,onDragCancel:()=>J(null),onDragEnd:i=>void ft(i),children:[(O==null?void 0:O.kind)==="task"&&C?t.jsx(Vt,{droppableId:oe,title:h("common.executionBoard.deleteDropTitle"),detail:h("common.executionBoard.deleteDropDetail")}):null,t.jsx("div",{className:"w-full max-w-full min-w-0 pb-2",children:L?t.jsx("div",{className:"grid w-full max-w-full min-w-0 gap-2",children:I.map(i=>{const a=K.filter(n=>n.status===i);return t.jsx(Pe,{items:a.map(n=>`${A}:${n.kind}:${n.id}`),strategy:Ve,children:t.jsx(We,{droppableId:`${A}:lane:${i}`,status:i,title:se[i].title,detail:se[i].detail,count:a.length,dragging:q!==null,children:ze(a)})},i)})}):t.jsx("div",{className:"grid w-full min-w-0 gap-0.5 xl:grid-cols-[repeat(5,minmax(0,1fr))]",children:I.map(i=>{const a=K.filter(n=>n.status===i);return t.jsx(Pe,{items:a.map(n=>`${A}:${n.kind}:${n.id}`),strategy:Ve,children:t.jsx(We,{droppableId:`${A}:lane:${i}`,status:i,title:se[i].title,detail:se[i].detail,count:a.length,dragging:q!==null,children:ze(a)})},i)})})}),t.jsx(Nt,{adjustScale:!1,dropAnimation:null,children:O?t.jsx("div",{className:"w-[20rem] max-w-[calc(100vw-2rem)]",children:O.kind==="task"?t.jsx(lt,{task:O.task,goal:O.goal,tags:O.tags,activeRun:O.activeRun,isSelected:u===O.task.id,isDragging:!0,isOverlay:!0,isMobile:L,onSelect:()=>{},onStartTask:w,onSplitTask:j,notesSummaryByEntity:z}):t.jsx(ot,{project:O.project,goal:O.goal,isDragging:!0,isOverlay:!0,isMobile:L})}):null}),t.jsx(Dt,{open:b!==null,title:(b==null?void 0:b.kind)==="project"?((_e=T.find(i=>i.id===b.entityId))==null?void 0:_e.title)??"Project actions":((Be=Y.find(i=>i.id===(b==null?void 0:b.entityId)))==null?void 0:Be.title)??"Work item actions",subtitle:(b==null?void 0:b.kind)==="project"?"Edit, relink, move, or break this project into issues.":"Edit, relink, move, or create the next child work item.",items:dt,position:(b==null?void 0:b.position)??null,onClose:()=>F(null)}),G?t.jsx("div",{className:"surface-overlay fixed inset-0 z-[60] flex items-center justify-center p-4 backdrop-blur-xl",children:t.jsxs(it,{className:"surface-modal-panel w-full max-w-md",children:[t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"mt-1 flex size-11 shrink-0 items-center justify-center rounded-full bg-[var(--ui-danger-soft)] text-[var(--danger)]",children:t.jsx(je,{className:"size-5"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-display text-[1.35rem] leading-tight text-[var(--ui-ink-strong)]",children:h("common.executionBoard.deleteConfirmTitle")}),t.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:h("common.executionBoard.deleteConfirmDescription",{title:G.title})})]})]}),t.jsxs("label",{className:"mt-5 flex items-center gap-3 rounded-[18px] bg-[var(--ui-surface-2)] px-4 py-3 text-sm text-[var(--ui-ink-medium)]",children:[t.jsx("input",{type:"checkbox",checked:ke,onChange:i=>ne(i.target.checked),className:"size-4 rounded border-[var(--ui-border-strong)] bg-transparent text-[var(--primary)]"}),t.jsx("span",{children:h("common.executionBoard.deleteConfirmCheckbox")})]}),t.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-3",children:[t.jsx(qe,{variant:"secondary",onClick:()=>{Q(null),ne(!1)},children:h("common.executionBoard.deleteConfirmCancel")}),t.jsx(qe,{className:"bg-[var(--ui-danger-soft)] text-[var(--danger)] shadow-[var(--ui-shadow-soft)]",pending:X===G.id,pendingLabel:h("common.executionBoard.deletingTask"),onClick:()=>void De(G,ke),children:h("common.executionBoard.deleteConfirmSubmit")})]})]})}):null]})}export{Jt as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h,j as r,aK as D,b3 as M}from"./vendor-Dnkkx2co.js";import{Z as a}from"./index-
|
|
1
|
+
import{r as h,j as r,aK as D,b3 as M}from"./vendor-Dnkkx2co.js";import{Z as a}from"./index-BP9__l6C.js";function B(f){return f.trim().toLowerCase()}function A({title:f,description:m,query:u,onQueryChange:c,onQuerySubmit:b,options:v,selectedOptionIds:i,onSelectedOptionIdsChange:p,resultSummary:E,clearLabel:g="Clear filters",submitLabel:k="Search",placeholder:C="Search title, alias, domain, source, or filter chip",emptyStateMessage:F="Keep typing to search the library or pick one of the suggested filter chips.",compact:t=!1,minimal:l=!1,hideSummary:_=!1}){const[$,n]=h.useState(!1),[w,d]=h.useState(0),j=h.useMemo(()=>i.map(e=>v.find(s=>s.id===e)).filter(Boolean),[v,i]),x=h.useMemo(()=>{const e=B(u),s=v.filter(o=>!i.includes(o.id));return e?s.filter(o=>`${o.label} ${o.description??""} ${o.searchText??""}`.toLowerCase().includes(e)).slice(0,12):s.slice(0,12)},[v,u,i]),y=e=>{i.includes(e)||(p([...i,e]),c(""),n(!1),d(0))},N=e=>{p(i.filter(s=>s!==e))},z=()=>{c(""),p([]),d(0),n(!1)};return r.jsxs("div",{className:a("rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-section)] shadow-[var(--card-shadow)]",l?"overflow-hidden rounded-full border-[var(--ui-border-subtle)] bg-[color-mix(in_srgb,var(--ui-surface-1)_88%,transparent)] px-3 py-1.5 shadow-[var(--ui-shadow-soft)] backdrop-blur":t?"rounded-[24px] p-2.5":"p-4 sm:p-5"),children:[r.jsxs("div",{className:a("flex flex-wrap items-start justify-between gap-3",l&&"hidden"),children:[r.jsxs("div",{className:"min-w-0",children:[f.trim().length>0?r.jsx("div",{className:"break-words font-label text-[11px] uppercase tracking-[0.2em] text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",children:f}):null,m.trim().length>0?r.jsx("div",{className:"mt-2 max-w-3xl break-words text-sm leading-6 text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",children:m}):null]}),i.length>0||u.trim().length>0?r.jsx("button",{type:"button",onClick:z,className:a("rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",t?"px-2.5 py-1.5 text-[11px]":"px-3 py-2 text-sm"),children:g}):null]}),r.jsxs("div",{className:a("rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",l?"rounded-full border-0 bg-transparent px-0 py-0":t?"mt-1.5 rounded-[18px] px-2.5 py-2":"mt-4 px-4 py-3"),children:[j.length>0?r.jsx("div",{className:a("flex flex-wrap gap-2",l?"mb-0 mr-2 inline-flex max-w-[38%] flex-nowrap items-center gap-1 overflow-hidden":t?"mb-2":"mb-3"),children:j.map(e=>r.jsxs("span",{className:a("inline-flex min-w-0 items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",l?"max-w-full shrink-0 px-2 py-0.5":t?"px-2 py-0.5":"px-2.5 py-1.5"),children:[e.badge??r.jsx("span",{className:"min-w-0 break-words text-sm text-[var(--ui-ink-medium)] [overflow-wrap:anywhere]",children:e.label}),r.jsx("button",{type:"button",className:"shrink-0 rounded-full text-[var(--ui-ink-faint)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>N(e.id),"aria-label":`Remove ${e.label}`,children:r.jsx(D,{className:"size-3.5"})})]},e.id))}):null,r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:a("flex items-center",l?"gap-2 whitespace-nowrap":t?"gap-2":"gap-3"),children:[r.jsx(M,{className:a("text-[var(--ui-ink-faint)]",t?"size-3.5":"size-4")}),r.jsx("input",{value:u,onChange:e=>{c(e.target.value),n(!0),d(0)},onFocus:()=>n(!0),onBlur:()=>window.setTimeout(()=>n(!1),120),onKeyDown:e=>{if(e.key==="Backspace"&&!u&&i.length>0){N(i[i.length-1]);return}if(e.key==="ArrowDown"){e.preventDefault(),n(!0),d(s=>x.length===0?0:Math.min(x.length-1,s+1));return}if(e.key==="ArrowUp"){e.preventDefault(),d(s=>Math.max(0,s-1));return}if(e.key==="Escape"){n(!1);return}if(e.key==="Enter"&&b){e.preventDefault(),b(u),n(!1);return}e.key==="Enter"&&x[w]&&(e.preventDefault(),y(x[w].id))},placeholder:C,className:a("min-w-0 flex-1 bg-transparent text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-faint)] focus:outline-none",l||t?"text-[12px]":"text-sm")}),l&&(i.length>0||u.trim().length>0)?r.jsx("button",{type:"button",onClick:z,className:"inline-flex size-6 items-center justify-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:text-[var(--ui-ink-strong)]","aria-label":g,children:r.jsx(D,{className:"size-3.5"})}):null,b?r.jsx("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:()=>{b(u),n(!1)},className:a("inline-flex items-center justify-center rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",l?"size-6":t?"size-7":"size-8"),"aria-label":k,title:k,children:r.jsx(M,{className:a(t?"size-3.5":"size-4")})}):null]}),$?r.jsx("div",{className:a("absolute top-full z-20 w-full border border-[var(--ui-border-subtle)] bg-[color-mix(in_srgb,var(--ui-surface-1)_96%,transparent)] shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",t?"mt-1.5 rounded-[18px] p-1.5":"mt-2 rounded-[22px] p-2"),children:x.length>0?x.map((e,s)=>r.jsx("button",{type:"button",className:a("flex w-full items-start justify-between gap-3 text-left transition",t?"rounded-[14px] px-2.5 py-2":"rounded-[18px] px-3 py-2.5",s===w?"bg-[var(--ui-surface-3)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),onMouseEnter:()=>d(s),onMouseDown:o=>o.preventDefault(),onClick:()=>y(e.id),children:r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:a("break-words font-medium [overflow-wrap:anywhere]",t?"text-[12px]":"text-sm"),children:e.badge??e.label}),e.description?r.jsx("div",{className:a("mt-1 break-words text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",t?"text-[11px] leading-[1.125rem]":"text-xs leading-5"),children:e.description}):null]})},e.id)):r.jsx("div",{className:a("break-words text-[var(--ui-ink-faint)] [overflow-wrap:anywhere]",t?"px-2.5 py-2 text-[12px]":"px-3 py-2.5 text-sm"),children:F})}):null]})]}),_?null:r.jsx("div",{className:a("break-words text-[var(--ui-ink-soft)] [overflow-wrap:anywhere]",t?"mt-2 text-xs":"mt-3 text-sm"),children:E})]})}export{A as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,aC as l,b8 as x}from"./vendor-Dnkkx2co.js";import{Z as s,c as v}from"./index-
|
|
1
|
+
import{j as r,aC as l,b8 as x}from"./vendor-Dnkkx2co.js";import{Z as s,c as v}from"./index-BP9__l6C.js";import{m as g}from"./motion-Lt5B1XuE.js";function f({eyebrow:c,title:o,description:d,items:i,tone:a="core",className:m}){return r.jsxs("section",{className:s("min-w-0 overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] shadow-[var(--ui-shadow-soft)]",a==="core"?"bg-[var(--ui-surface-section)]":"bg-[color-mix(in_srgb,var(--success)_6%,var(--ui-surface-section)_94%)]",m),children:[r.jsxs("div",{className:s("grid min-w-0 gap-3 px-4 py-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,26rem)] lg:px-5",a==="core"?"bg-[radial-gradient(circle_at_top_right,color-mix(in_srgb,var(--primary)_12%,transparent),transparent_36%)]":"bg-[radial-gradient(circle_at_top_right,color-mix(in_srgb,var(--success)_12%,transparent),transparent_36%)]"),children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:s("font-label text-[11px] uppercase tracking-[0.2em]",a==="core"?"text-[var(--secondary)]":"text-[color-mix(in_srgb,var(--success)_74%,var(--ui-ink-strong)_26%)]"),children:c}),r.jsx("h2",{className:"mt-2 max-w-3xl font-display text-[clamp(1.35rem,2vw,1.9rem)] leading-none text-[var(--ui-ink-strong)]",children:o}),r.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--ui-ink-soft)]",children:d})]}),r.jsx("div",{className:"grid min-w-0 gap-2 sm:grid-cols-3",children:i.slice(0,3).map(e=>e.href?r.jsxs(l,{to:e.href,className:s("min-w-0 rounded-[20px] border border-[var(--ui-border-subtle)] px-3 py-3 backdrop-blur-sm transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]",a==="core"?"bg-[var(--ui-surface-1)]":"bg-[color-mix(in_srgb,var(--success)_6%,var(--ui-surface-1)_94%)]"),children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:e.label}),r.jsx("div",{className:"mt-1.5 min-w-0 font-medium text-[var(--ui-ink-strong)]",children:e.title})]},e.id):r.jsxs("div",{className:s("min-w-0 rounded-[20px] border border-[var(--ui-border-subtle)] px-3 py-3 backdrop-blur-sm",a==="core"?"bg-[var(--ui-surface-1)]":"bg-[color-mix(in_srgb,var(--success)_6%,var(--ui-surface-1)_94%)]"),children:[r.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:e.label}),r.jsx("div",{className:"mt-1.5 min-w-0 font-medium text-[var(--ui-ink-strong)]",children:e.title})]},e.id))})]}),r.jsx("div",{className:"grid min-w-0 gap-3 px-4 py-4 lg:grid-cols-2 lg:px-5",children:i.map((e,u)=>{const n=s("group flex min-h-[13.5rem] min-w-0 flex-col overflow-hidden rounded-[24px] border border-[var(--ui-border-subtle)] p-0 transition hover:-translate-y-0.5 hover:border-[var(--ui-border-strong)] hover:shadow-[var(--ui-shadow-floating)] sm:min-h-[15.5rem]",a==="core"?"bg-[var(--ui-surface-1)] hover:bg-[var(--ui-surface-hover)]":"bg-[color-mix(in_srgb,var(--success)_6%,var(--ui-surface-1)_94%)] hover:bg-[color-mix(in_srgb,var(--success)_10%,var(--ui-surface-hover)_90%)]"),t=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:s("flex min-w-0 flex-1 flex-col p-4",a==="core"?"bg-[radial-gradient(circle_at_top_left,color-mix(in_srgb,var(--primary)_10%,transparent),transparent_28%)]":"bg-[radial-gradient(circle_at_top_left,color-mix(in_srgb,var(--success)_10%,transparent),transparent_28%)]"),children:[r.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:e.label}),r.jsx("div",{className:"mt-2.5 min-w-0 font-display text-[1.25rem] leading-tight text-[var(--ui-ink-strong)] sm:text-[1.4rem]",children:e.title})]}),e.badge?r.jsx(v,{wrap:!0,className:"max-w-[10rem] shrink-0 self-start bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:e.badge}):null]}),r.jsx("div",{className:"mt-2.5 text-sm leading-6 text-[var(--ui-ink-soft)]",children:e.detail}),r.jsx("div",{className:"flex-1"})]}),e.href?r.jsx("div",{className:"border-t border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-3",children:r.jsxs("div",{className:"inline-flex min-h-10 min-w-0 max-w-full items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 text-sm text-[var(--ui-ink-medium)] transition group-hover:border-[var(--ui-border-strong)] group-hover:bg-[var(--ui-surface-hover)] group-hover:text-[var(--ui-ink-strong)]",children:[e.actionLabel??"Open",r.jsx(x,{className:"size-3.5"})]})}):null]});return r.jsx(g.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.22,delay:.04*u,ease:"easeOut"},children:e.href?r.jsx(l,{to:e.href,className:n,children:t}):r.jsx("div",{className:n,children:t})},e.id)})})]})}export{f as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,F as m,j as r,aK as f}from"./vendor-Dnkkx2co.js";import{Z as l}from"./index-
|
|
1
|
+
import{r as v,F as m,j as r,aK as f}from"./vendor-Dnkkx2co.js";import{Z as l}from"./index-BP9__l6C.js";function b({open:i,title:c,subtitle:s,items:u,position:t,onClose:n}){return v.useEffect(()=>{if(!i)return;let e=!1;const a=window.setTimeout(()=>{e=!0},0),o=x=>{x.key==="Escape"&&n()},d=()=>{e&&n()};return window.addEventListener("keydown",o),window.addEventListener("pointerdown",d),()=>{window.clearTimeout(a),window.removeEventListener("keydown",o),window.removeEventListener("pointerdown",d)}},[n,i]),!i||!t||typeof document>"u"?null:m.createPortal(r.jsx("div",{className:"fixed inset-0 z-[70]","aria-hidden":"true",children:r.jsxs("div",{className:"fixed z-[71] flex max-h-[min(34rem,calc(100dvh-1.5rem))] w-[min(22rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-[26px] border border-[var(--ui-border-subtle)] bg-[image:var(--ui-surface-modal)] p-2 shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",style:{left:Math.min(t.x,window.innerWidth-24-352),top:Math.min(t.y,window.innerHeight-24-544)},onPointerDown:e=>e.stopPropagation(),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[20px] bg-[var(--ui-surface-1)] px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-[var(--ui-ink-strong)]",children:c}),s?r.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-soft)]",children:s}):null]}),r.jsx("button",{type:"button",className:"rounded-full bg-[var(--ui-surface-2)] p-2 text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",onClick:n,children:r.jsx(f,{className:"size-4"})})]}),r.jsx("div",{className:"mt-2 min-h-0 overflow-y-auto overscroll-contain pr-1",children:r.jsx("div",{className:"grid gap-1",children:u.map(e=>{const a=e.icon;return r.jsxs("button",{type:"button",disabled:e.disabled,onClick:()=>{e.disabled||(e.onSelect(),n())},className:l("flex w-full items-start gap-3 rounded-[20px] px-4 py-3 text-left transition",e.disabled?"cursor-not-allowed bg-[var(--ui-surface-1)] text-[var(--ui-ink-faint)] opacity-55":e.tone==="danger"?"bg-[var(--ui-danger-soft)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)] hover:bg-[color-mix(in_srgb,var(--danger)_22%,var(--ui-surface-hover)_78%)]":"bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]"),children:[a?r.jsx("span",{className:l("mt-0.5 rounded-[14px] p-2",e.disabled?"bg-[var(--ui-surface-2)] text-[var(--ui-ink-faint)]":e.tone==="danger"?"bg-[color-mix(in_srgb,var(--danger)_18%,var(--ui-surface-1)_82%)] text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]":"bg-[var(--primary)]/12 text-[var(--primary)]"),children:r.jsx(a,{className:"size-4"})}):null,r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block text-sm font-medium",children:e.label}),e.description?r.jsx("span",{className:"mt-1 block text-xs leading-5 text-[var(--ui-ink-soft)]",children:e.description}):null]})]},e.id)})})})]})}),document.body)}export{b as F};
|