forge-openclaw-plugin 0.2.100 → 0.2.101
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-5oyCFOns.js → activity-page-CpjuNSHw.js} +1 -1
- package/dist/assets/{ai-surface-workspace-qgk_B57-.js → ai-surface-workspace-DEAFZruS.js} +1 -1
- package/dist/assets/{atlas-panel-rfH2qOez.js → atlas-panel-CdVNPotj.js} +1 -1
- package/dist/assets/{calendar-page-Bo2iua-a.js → calendar-page-DNNt6lfz.js} +1 -1
- package/dist/assets/{calendar-rules-DA1g3QUk.js → calendar-rules-DNJFNsxi.js} +1 -1
- package/dist/assets/{calendar-week-toolbar-DU1Q4RYj.js → calendar-week-toolbar-BbPwYeN0.js} +1 -1
- package/dist/assets/{companion-sync-lab-page-CosNknOK.js → companion-sync-lab-page-KxEDigM6.js} +1 -1
- package/dist/assets/{daily-metrics-dashboard-LjuGAB3f.js → daily-metrics-dashboard-B3cqJgDt.js} +1 -1
- package/dist/assets/{entity-note-count-link-BmGDB572.js → entity-note-count-link-DrhjJZ4i.js} +1 -1
- package/dist/assets/{entity-notes-surface-DgEgicaE.js → entity-notes-surface-CkcRsKJQ.js} +1 -1
- package/dist/assets/{execution-board-CDRXQB85.js → execution-board-D07gOocB.js} +1 -1
- package/dist/assets/{faceted-token-search-CE1YauRd.js → faceted-token-search-BxRRcM3q.js} +1 -1
- package/dist/assets/{flagship-signal-deck-DDds90Gl.js → flagship-signal-deck-cmy82b8_.js} +1 -1
- package/dist/assets/{floating-action-menu-CJkI2iFy.js → floating-action-menu-Fs_ZiUMo.js} +1 -1
- package/dist/assets/{goal-detail-page-cJvHaLMQ.js → goal-detail-page-CqLiNz4f.js} +1 -1
- package/dist/assets/{goals-page-f_39hvUV.js → goals-page-BTk7mg_T.js} +1 -1
- package/dist/assets/{habits-page-DKb96_mj.js → habits-page-BJxagdzx.js} +1 -1
- package/dist/assets/{index-BHTUu_4M.js → index-CF4J4R9L.js} +2 -2
- package/dist/assets/{insight-flow-dialog-pzAzyayN.js → insight-flow-dialog-8f3D0GuC.js} +1 -1
- package/dist/assets/{insights-page-Dc9oFltJ.js → insights-page-D6rOa7uk.js} +1 -1
- package/dist/assets/{kanban-page-JAxerYh6.js → kanban-page-XQ7Se6dH.js} +1 -1
- package/dist/assets/{knowledge-graph-page-UQ3skqEi.js → knowledge-graph-page-BtAg8iv3.js} +1 -1
- package/dist/assets/{life-force-page-BGDbQuVh.js → life-force-page-Dy0JTS2G.js} +1 -1
- package/dist/assets/{life-force-workspace-B1fYSXRC.js → life-force-workspace-OfyB9HJM.js} +1 -1
- package/dist/assets/{metric-tile-DX6TclqM.js → metric-tile-DKpo-8xw.js} +1 -1
- package/dist/assets/{movement-page-6HP6nGJx.js → movement-page-Bg_T_Stx.js} +1 -1
- package/dist/assets/{note-markdown-DiW2-5d3.js → note-markdown-N-uxD3Xt.js} +1 -1
- package/dist/assets/{note-tags-input-DDLXf54U.js → note-tags-input-Cdu7wiw6.js} +1 -1
- package/dist/assets/{notes-page-BuguDjhz.js → notes-page-CKXnF_KU.js} +1 -1
- package/dist/assets/{open-in-graph-button-Cg5VrKsC.js → open-in-graph-button-IXe9SGth.js} +1 -1
- package/dist/assets/{orbit-map-GD05-0oS.js → orbit-map-Dzi6KliQ.js} +1 -1
- package/dist/assets/{overview-page-DuOs2OCB.js → overview-page-1miYqaVS.js} +1 -1
- package/dist/assets/{page-hero-CQWo1Mm_.js → page-hero-DRy5b2MU.js} +1 -1
- package/dist/assets/{pill-cluster-BJogDRDJ.js → pill-cluster-C9QczVJ2.js} +1 -1
- package/dist/assets/{preference-entity-handoff-button-D4WAs9pC.js → preference-entity-handoff-button-5PzUn42S.js} +1 -1
- package/dist/assets/{preferences-page-BaJTMU1I.js → preferences-page-DtNaF5Q3.js} +1 -1
- package/dist/assets/{project-collections-DvaX20q_.js → project-collections-xPz2mlRr.js} +1 -1
- package/dist/assets/{project-detail-page-drPIFZGb.js → project-detail-page-BXK5-4xW.js} +1 -1
- package/dist/assets/{project-management-hierarchy-page-BUbRXvny.js → project-management-hierarchy-page-DtRpMABw.js} +1 -1
- package/dist/assets/{project-management-section-nav-C2Ud8Zdd.js → project-management-section-nav-P3ixzPa-.js} +1 -1
- package/dist/assets/{projects-page-BGzEZUtg.js → projects-page-C5ViRuf4.js} +1 -1
- package/dist/assets/{psyche-behaviors-page-Dmm_Io9D.js → psyche-behaviors-page-Dco46sC4.js} +1 -1
- package/dist/assets/{psyche-flashcards-page-BgNKJ6QJ.js → psyche-flashcards-page-ZcoEB8gV.js} +1 -1
- package/dist/assets/{psyche-goal-map-page-DXJs98Vr.js → psyche-goal-map-page-CLBAQOI0.js} +1 -1
- package/dist/assets/{psyche-graph-CFgs_Bqc.js → psyche-graph-k4tX2tdp.js} +1 -1
- package/dist/assets/{psyche-metrics-page-zYTJDbyZ.js → psyche-metrics-page-CuR9oqEy.js} +1 -1
- package/dist/assets/{psyche-mode-guide-page-XPgRfCOf.js → psyche-mode-guide-page-hIVXcCnE.js} +1 -1
- package/dist/assets/{psyche-modes-page-B-GA8oRF.js → psyche-modes-page-0lYtBlhO.js} +1 -1
- package/dist/assets/{psyche-page--r6a3e1t.js → psyche-page-VZ9k9ISp.js} +1 -1
- package/dist/assets/{psyche-patterns-page-BM5-3bMm.js → psyche-patterns-page-gx5nmdGq.js} +1 -1
- package/dist/assets/{psyche-questionnaire-builder-page-CJshQ-mg.js → psyche-questionnaire-builder-page-Bn0TOISd.js} +1 -1
- package/dist/assets/{psyche-questionnaire-detail-page-USmR5G5A.js → psyche-questionnaire-detail-page-CmVzSd_s.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-detail-page-D7iBCmTi.js → psyche-questionnaire-run-detail-page-BsMbmXCG.js} +1 -1
- package/dist/assets/{psyche-questionnaire-run-page-Cpil-kDh.js → psyche-questionnaire-run-page-CgkRL2vi.js} +1 -1
- package/dist/assets/{psyche-questionnaires-page-C-_y3VwS.js → psyche-questionnaires-page-D7V8uLXM.js} +1 -1
- package/dist/assets/{psyche-report-detail-page--dkSPRaj.js → psyche-report-detail-page-OlFq57eL.js} +1 -1
- package/dist/assets/{psyche-reports-page-CUaOXmIN.js → psyche-reports-page-dVUZjna1.js} +1 -1
- package/dist/assets/{psyche-schemas-beliefs-page-BX6xaap3.js → psyche-schemas-beliefs-page-BCgc8FUd.js} +1 -1
- package/dist/assets/{psyche-screen-time-page-CAAI4mD7.js → psyche-screen-time-page-B_6BT_WN.js} +1 -1
- package/dist/assets/{psyche-self-observation-page-BZ6FLuwa.js → psyche-self-observation-page-CEG5mluK.js} +1 -1
- package/dist/assets/{psyche-values-page-yEV6MGt8.js → psyche-values-page-DRbRfEd6.js} +1 -1
- package/dist/assets/{report-chain-fields-fZ8Xd4H6.js → report-chain-fields-CALCV3V5.js} +1 -1
- package/dist/assets/{rewards-page-C2HQjIAf.js → rewards-page-DmC4R_Ps.js} +1 -1
- package/dist/assets/{scheduling-rules-editor-BHOpHOrV.js → scheduling-rules-editor-D02s70hr.js} +1 -1
- package/dist/assets/{schema-badge-DyKbxb51.js → schema-badge-BZO-qNhO.js} +1 -1
- package/dist/assets/{select-menu-BX-pZNqL.js → select-menu-fYyreSdQ.js} +1 -1
- package/dist/assets/{settings-agents-page-VuYXTiyc.js → settings-agents-page-C_v_hMJF.js} +1 -1
- package/dist/assets/{settings-bin-page-BNzvYaOk.js → settings-bin-page-DY5bg81n.js} +1 -1
- package/dist/assets/{settings-calendar-page-CjSFB53S.js → settings-calendar-page-D1CzE6cg.js} +1 -1
- package/dist/assets/{settings-data-page-CGSlryuI.js → settings-data-page-CHRQFU9H.js} +1 -1
- package/dist/assets/{settings-logs-page-BTK5fine.js → settings-logs-page-B04pUwEv.js} +1 -1
- package/dist/assets/{settings-mobile-page-CRaObOGo.js → settings-mobile-page-D9kTlYDS.js} +1 -1
- package/dist/assets/{settings-models-page-DFshpYF8.js → settings-models-page-D26270R2.js} +1 -1
- package/dist/assets/{settings-page-BP81Mb5R.js → settings-page-DYDTFlnv.js} +1 -1
- package/dist/assets/{settings-rewards-page-CDJ1PH2G.js → settings-rewards-page-cl4vqqO_.js} +1 -1
- package/dist/assets/{settings-section-nav-CCFm27r2.js → settings-section-nav-DSOuht_F.js} +1 -1
- package/dist/assets/{settings-users-page-TdUocFPa.js → settings-users-page-BU79JB_T.js} +1 -1
- package/dist/assets/{settings-wiki-page-B2zX0QQG.js → settings-wiki-page-DwAUlyA3.js} +1 -1
- package/dist/assets/{sleep-page-cI1GMVzk.js → sleep-page-D8NbdhyS.js} +1 -1
- package/dist/assets/{sports-page-06LTqp0V.js → sports-page-CV4Cnzwn.js} +1 -1
- package/dist/assets/{strategies-page-DXP9Kx8s.js → strategies-page-C4qvXnql.js} +1 -1
- package/dist/assets/{strategy-detail-page-D6mx_Mik.js → strategy-detail-page-DJLo5rfy.js} +1 -1
- package/dist/assets/{strategy-dialog-BvzomTaF.js → strategy-dialog-D3AuUlVz.js} +1 -1
- package/dist/assets/{task-detail-page-BIWIggdp.js → task-detail-page-z-9u9rF0.js} +1 -1
- package/dist/assets/{timebox-planning-dialog-CaCnoslG.js → timebox-planning-dialog-DB6FLqmI.js} +1 -1
- package/dist/assets/{today-page-DO2mRPT2.js → today-page-BKlu6gx5.js} +1 -1
- package/dist/assets/{training-load-page-CyZ0mlEr.js → training-load-page-CyJQqo_3.js} +1 -1
- package/dist/assets/{vitals-page-BQvEjTc6.js → vitals-page-qre17Nw8.js} +1 -1
- package/dist/assets/{weekly-review-page-Tp6Q9CRj.js → weekly-review-page-Cz4vkRcx.js} +1 -1
- package/dist/assets/weight-loss-page-BQrnOI0y.js +1 -0
- package/dist/assets/{wiki-article-markdown-DQYohmW2.js → wiki-article-markdown-DdiR2TJE.js} +1 -1
- package/dist/assets/{wiki-editor-page-Dem_3eZv.js → wiki-editor-page-DqwoqVFb.js} +1 -1
- package/dist/assets/{wiki-ingest-history-page-BxoOcCoJ.js → wiki-ingest-history-page--evBLbOw.js} +1 -1
- package/dist/assets/{wiki-ingest-modal-DhguKk3J.js → wiki-ingest-modal--ohzFnj2.js} +1 -1
- package/dist/assets/{wiki-page-BLRxVXkl.js → wiki-page-B_VJFBPA.js} +1 -1
- package/dist/assets/{workbench-flow-page-DqMkCCTy.js → workbench-flow-page-Du62mtJU.js} +1 -1
- package/dist/assets/{workbench-page-BWd02wPw.js → workbench-page-4MKr3iRm.js} +1 -1
- package/dist/assets/{workout-detail-page-BD8u7GyL.js → workout-detail-page-DfUbYYw1.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/server/server/src/watch-mobile.js +22 -10
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/dist/assets/weight-loss-page-BBzlhLVV.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c2 as ft,r as h,j as e,b0 as jt,bH as wt,cG as yt,cH as Nt,bf as Ct,aG as It,aC as ue,b3 as se,c7 as St,b4 as kt,aK as Ft}from"./vendor-DHkYh85p.js";import{R as Pt,P as Lt,O as Tt,C as Mt,T as At,D as Dt,a as Et}from"./ui-C13Nbgas.js";import{j as _t,i as Ze,k as j}from"./state-B-4sS1xO.js";import{u as zt,s as Ot,c4 as Ve,c5 as $t,c6 as Bt,c7 as Wt,c8 as qt,c9 as Rt,ca as Qt,cb as Ut,cc as Gt,cd as Ht,ce as Kt,cf as Jt,cg as Yt,ch as Xt,ci as Zt,cj as Vt,a as et,L as tt,E as es,B as o,ck as ts,C as v,U as st,H as ss,Z as $,c as y,I as x,T,bk as H,cl as at}from"./index-BHTUu_4M.js";import{P as as}from"./page-hero-CQWo1Mm_.js";import"./board-BkDRaMp6.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const rt=[{id:"overview",label:"Overview",icon:jt},{id:"map",label:"Map",icon:wt},{id:"table",label:"Table",icon:yt},{id:"history",label:"History",icon:Nt},{id:"contexts",label:"Contexts",icon:Ct},{id:"concepts",label:"Concepts",icon:It}],is=new Set(["projects","tasks","strategies","habits"]),ae=[{value:"projects",label:"Projects",description:"Goals and projects already living in Forge.",mode:"forge"},{value:"tasks",label:"Tasks",description:"Execution-level work choices inside Forge.",mode:"forge"},{value:"strategies",label:"Strategies",description:"Plan shapes and sequencing choices in Forge.",mode:"forge"},{value:"habits",label:"Habits",description:"Recurring behaviors and routines from Forge.",mode:"forge"},{value:"activities",label:"Activities",description:"Movement, leisure, and social setting concepts.",mode:"concept"},{value:"food",label:"Food",description:"Cuisine, meal mood, and drink preferences.",mode:"concept"},{value:"places",label:"Places",description:"Living environments, venues, and trip shapes.",mode:"concept"},{value:"countries",label:"Countries",description:"Country-level attraction and lifestyle fit.",mode:"concept"},{value:"fashion",label:"Fashion",description:"Silhouette, material, and palette preferences.",mode:"concept"},{value:"people",label:"People",description:"Presence, body-type, and conversation preferences.",mode:"concept"},{value:"media",label:"Media",description:"Film, reading, and music taste.",mode:"concept"},{value:"tools",label:"Tools",description:"Workflow and capture preferences.",mode:"concept"},{value:"custom",label:"Custom",description:"General-purpose concept libraries you control.",mode:"concept"}],ve={novelty:"Novelty",simplicity:"Simplicity",rigor:"Rigor",aesthetics:"Aesthetics",depth:"Depth",structure:"Structure",familiarity:"Familiarity",surprise:"Surprise"},ie={novelty:0,simplicity:0,rigor:0,aesthetics:0,depth:0,structure:0,familiarity:0,surprise:0},it={liked:"bg-emerald-500/12 text-emerald-200",disliked:"bg-rose-500/12 text-rose-200",uncertain:"bg-white/[0.08] text-white/70",vetoed:"bg-rose-500/15 text-rose-100",bookmarked:"bg-sky-500/12 text-sky-200",favorite:"bg-amber-500/12 text-amber-200",must_have:"bg-indigo-500/15 text-indigo-100",neutral:"bg-white/[0.08] text-white/70"},ns=[{signalType:"favorite",label:"Favorite"},{signalType:"must_have",label:"Must-have"},{signalType:"bookmark",label:"Bookmark"},{signalType:"compare_later",label:"Later"},{signalType:"neutral",label:"Neutral"},{signalType:"veto",label:"Veto"}];function ne(c){return c.trim().toLowerCase()}function B(c){return`${Math.round(c*100)}%`}function rs(c){return[...c.goals.map(a=>({entityType:"goal",entityId:a.id,domain:"projects",label:a.title,description:a.description,user:a.user,href:`/goals/${a.id}`,searchText:H([a.title,a.description,a.status,a.horizon],a)})),...c.dashboard.projects.map(a=>({entityType:"project",entityId:a.id,domain:"projects",label:a.title,description:a.description,user:a.user,href:`/projects/${a.id}`,searchText:H([a.title,a.description,a.status,a.goalTitle],a)})),...c.tasks.map(a=>({entityType:"task",entityId:a.id,domain:"tasks",label:a.title,description:a.description,user:a.user,href:`/tasks/${a.id}`,searchText:H([a.title,a.description,a.status,a.priority,a.owner],a)})),...c.strategies.map(a=>({entityType:"strategy",entityId:a.id,domain:"strategies",label:a.title,description:a.overview||a.endStateDescription,user:a.user,href:`/strategies/${a.id}`,searchText:H([a.title,a.overview,a.endStateDescription,a.status],a)})),...c.habits.map(a=>({entityType:"habit",entityId:a.id,domain:"habits",label:a.title,description:a.description,user:a.user,href:null,searchText:H([a.title,a.description,a.status,a.frequency],a)}))]}function ls(c,a){return!c||!a?null:c==="goal"?`/goals/${a}`:c==="project"?`/projects/${a}`:c==="task"?`/tasks/${a}`:c==="strategy"?`/strategies/${a}`:null}function re(c){return c.manualStatus??c.status}function ds(c){return c&&rt.some(a=>a.id===c)?c:"overview"}function cs(c){return c.summary.totalItems<2?{title:"Forge does not know enough yet.",description:"Start the game so Forge can ask a few clean comparisons and build a real preference model."}:c.summary.averageConfidence<.28?{title:"Forge has a rough sketch, not a stable read.",description:"There is some signal, but the model still needs more rounds before its preferences are trustworthy."}:{title:"This is what Forge currently thinks.",description:"The summary below is the current best model for this user, this domain, and the active context."}}function os({summary:c}){const a=Math.max(-1,Math.min(1,c.leaning)),N=(a+1)/2*100;return e.jsxs("div",{className:"grid gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-white/56",children:[e.jsx("span",{children:ve[c.dimensionId]}),e.jsxs("span",{children:[c.movement>.08?"Rising":c.movement<-.08?"Falling":"Stable"," ","· ",B(c.confidence)]})]}),e.jsxs("div",{className:"relative h-2 rounded-full bg-white/[0.08]",children:[e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/10"}),e.jsx("div",{className:$("absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white/12",a>=0?"bg-emerald-300":"bg-rose-300"),style:{left:`${N}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.12em] text-white/38",children:[e.jsxs("span",{children:[a>=0?"Leans toward":"Leans away from"," ",ve[c.dimensionId].toLowerCase()]}),e.jsxs("span",{children:["Context ",B(c.contextSensitivity)]})]})]})}function nt({title:c,description:a,sideLabel:N,onClick:W}){return e.jsxs("button",{type:"button",className:"grid min-h-[220px] gap-4 rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(255,255,255,0.07),rgba(255,255,255,0.03))] p-5 text-left transition hover:border-[var(--primary)]/40 hover:bg-[linear-gradient(180deg,rgba(192,193,255,0.14),rgba(255,255,255,0.05))]",onClick:W,children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/42",children:N}),e.jsx("div",{className:"font-display text-3xl text-white",children:c}),e.jsx("div",{className:"max-w-[36ch] text-sm leading-6 text-white/56",children:a||"Choose the one that feels more right."}),e.jsx("div",{className:"mt-auto text-sm text-[var(--primary)]",children:"Click this card"})]})}function js(){var Qe,Ue,Ge,He,Ke;const c=zt(),a=_t(),[N,W]=ft(),[le,lt]=h.useState(""),[de,dt]=h.useState(""),[D,be]=h.useState(""),[K,fe]=h.useState(""),[J,je]=h.useState(""),[f,F]=h.useState({open:!1,phase:"domain",domain:N.get("domain")??"projects"}),[we,P]=h.useState(null),[ct,ce]=h.useState(!1),[ye,E]=h.useState(null),[p,C]=h.useState({label:"",description:"",tags:"",manualStatus:"",manualScore:"",confidenceLock:"",bookmarked:!1,compareLater:!1,frozen:!1,featureWeights:{novelty:"0",simplicity:"0",rigor:"0",aesthetics:"0",depth:"0",structure:"0",familiarity:"0",surprise:"0"}}),[M,Y]=h.useState({label:"",description:"",tags:""}),[I,q]=h.useState({name:"",description:"",shareMode:"blended",decayDays:"90"}),[R,oe]=h.useState({title:"",description:""}),[ot,X]=h.useState({}),[Ne,me]=h.useState(null),[Z,he]=h.useState({title:"",description:""}),[mt,xe]=h.useState(null),[_,V]=h.useState({label:"",description:"",tags:""}),m=N.get("userId")??Ot(c.selectedUserIds)??((Qe=c.snapshot.users[0])==null?void 0:Qe.id)??null,w=N.get("domain")??"projects",S=ds(N.get("tab")),Q=N.get("contextId"),ee=N.get("focusItem"),Ce=h.useMemo(()=>c.snapshot.users.find(t=>t.id===m)??null,[m,c.snapshot.users]),te=h.useMemo(()=>rs(c.snapshot),[c.snapshot]),U=Ze({queryKey:["forge-preferences",m,w,Q],queryFn:async()=>(await at({userId:m??void 0,domain:w,contextId:Q??void 0})).workspace,enabled:!!m}),Ie=Ze({queryKey:["forge-preferences-game",m,f.domain,Q],queryFn:async()=>(await at({userId:m??void 0,domain:f.domain,contextId:Q??void 0})).workspace,enabled:!!m&&f.open}),i=U.data??null,g=f.domain===w?i:Ie.data??null;h.useEffect(()=>{var s;if(!i)return;const t=ee&&i.scores.some(l=>l.itemId===ee)?ee:((s=i.scores[0])==null?void 0:s.itemId)??null;E(l=>l&&i.scores.some(n=>n.itemId===l)?l:t)},[ee,i]);const pe=h.useMemo(()=>{if(!i)return[];const t=ne(le);return t?i.scores.filter(s=>{var l,n,r;return[((l=s.item)==null?void 0:l.label)??"",((n=s.item)==null?void 0:n.description)??"",((r=s.item)==null?void 0:r.tags.join(" "))??"",s.status,s.manualStatus??"",s.dominantDimensions.join(" "),s.explanation.join(" ")].join(" ").toLowerCase().includes(t)}):i.scores},[le,i]),d=pe.find(t=>t.itemId===ye)??(i==null?void 0:i.scores.find(t=>t.itemId===ye))??pe[0]??(i==null?void 0:i.scores[0])??null;h.useEffect(()=>{var t,s,l,n,r,b,G,O,Je,Ye,Xe;d&&C({label:((t=d.item)==null?void 0:t.label)??"",description:((s=d.item)==null?void 0:s.description)??"",tags:((l=d.item)==null?void 0:l.tags.join(", "))??"",manualStatus:d.manualStatus??"",manualScore:typeof d.manualScore=="number"?String(d.manualScore):"",confidenceLock:typeof d.confidenceLock=="number"?String(d.confidenceLock):"",bookmarked:d.bookmarked,compareLater:d.compareLater,frozen:d.frozen,featureWeights:{novelty:String(((n=d.item)==null?void 0:n.featureWeights.novelty)??0),simplicity:String(((r=d.item)==null?void 0:r.featureWeights.simplicity)??0),rigor:String(((b=d.item)==null?void 0:b.featureWeights.rigor)??0),aesthetics:String(((G=d.item)==null?void 0:G.featureWeights.aesthetics)??0),depth:String(((O=d.item)==null?void 0:O.featureWeights.depth)??0),structure:String(((Je=d.item)==null?void 0:Je.featureWeights.structure)??0),familiarity:String(((Ye=d.item)==null?void 0:Ye.featureWeights.familiarity)??0),surprise:String(((Xe=d.item)==null?void 0:Xe.featureWeights.surprise)??0)}})},[d]);const Se=h.useMemo(()=>{const t=ne(de);return te.filter(s=>s.domain===w).filter(s=>t?s.searchText.includes(t):!0).slice(0,12)},[te,de,w]),ge=h.useMemo(()=>{const t=S==="concepts"?i:g??i,s=(t==null?void 0:t.catalogs)??[],l=ne(D);return l?s.filter(n=>[n.title,n.description,n.source,...n.items.flatMap(r=>[r.label,r.description,r.tags.join(" ")])].join(" ").toLowerCase().includes(l)):s},[g,D,S,i]),u=async()=>{await a.invalidateQueries({queryKey:["forge-preferences"]}),await a.invalidateQueries({queryKey:["forge-preferences-game"]})},ke=j({mutationFn:Ve,onSuccess:u}),Fe=j({mutationFn:$t,onSuccess:async({item:t})=>{await u(),Y({label:"",description:"",tags:""}),E(t.id)}}),Pe=j({mutationFn:Bt,onSuccess:async()=>{await u(),oe({title:"",description:""}),W(t=>{const s=new URLSearchParams(t);return s.set("tab","concepts"),s})}}),Le=j({mutationFn:({catalogId:t,patch:s})=>Wt(t,s),onSuccess:async()=>{await u(),me(null)}}),Te=j({mutationFn:qt,onSuccess:u}),Me=j({mutationFn:Rt,onSuccess:async()=>{await u()}}),Ae=j({mutationFn:({catalogItemId:t,patch:s})=>Qt(t,s),onSuccess:async()=>{await u(),xe(null)}}),De=j({mutationFn:Ut,onSuccess:u}),ht=j({mutationFn:Gt,onSuccess:async()=>{await u(),F(t=>({...t,phase:"play"}))}}),xt=j({mutationFn:Ht,onSuccess:u}),pt=j({mutationFn:Kt,onSuccess:u}),Ee=j({mutationFn:async()=>{!(d!=null&&d.item)||!m||!i||(await Jt(d.item.id,{label:p.label,description:p.description,tags:p.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:Object.fromEntries(Object.keys(ie).map(t=>[t,Number(p.featureWeights[t]||0)]))}),await Yt(d.item.id,{userId:m,domain:w,contextId:i.selectedContext.id,manualStatus:p.manualStatus||null,manualScore:p.manualScore.trim().length>0?Number(p.manualScore):null,confidenceLock:p.confidenceLock.trim().length>0?Number(p.confidenceLock):null,bookmarked:p.bookmarked,compareLater:p.compareLater,frozen:p.frozen}))},onSuccess:u}),_e=j({mutationFn:Xt,onSuccess:async({context:t})=>{await u(),q({name:"",description:"",shareMode:"blended",decayDays:"90"}),W(s=>{const l=new URLSearchParams(s);return l.set("contextId",t.id),l.set("tab","contexts"),l})}}),ze=j({mutationFn:Zt,onSuccess:async()=>{await u(),fe(""),je("")}}),z=j({mutationFn:({contextId:t,patch:s})=>Vt(t,s),onSuccess:u}),k=t=>{W(s=>{const l=new URLSearchParams(s);for(const[n,r]of Object.entries(t))r?l.set(n,r):l.delete(n);return l})},Oe=(t=w)=>{P(null),F({open:!0,phase:"domain",domain:t})},gt=async t=>{if(!m)return;P(null),ce(!0);const s=te.filter(r=>{var b;return r.domain===t&&((b=r.user)==null?void 0:b.id)===m}),l=te.filter(r=>r.domain===t),n=(s.length>0?s:l).slice(0,12);if(n.length<2){P("Forge needs at least two matching records in this domain before it can start the game."),ce(!1),F(r=>({...r,phase:"domain"}));return}try{k({domain:t,tab:"overview",contextId:null,focusItem:null}),await Promise.all(n.map(r=>Ve({userId:m,domain:t,entityType:r.entityType,entityId:r.entityId,label:r.label,description:r.description,tags:[]}))),await u(),F({open:!0,phase:"play",domain:t})}catch(r){P(r instanceof Error?r.message:"Forge could not start the game."),F(b=>({...b,phase:"domain"}))}finally{ce(!1)}},$e=async(t,s)=>{if(m){P(null),k({domain:t,tab:"overview",contextId:null,focusItem:null});try{await ht.mutateAsync({userId:m,domain:t,contextId:Q??void 0,catalogId:s}),F({open:!0,phase:"play",domain:t})}catch(l){P(l instanceof Error?l.message:"Forge could not start the game.")}}},ut=async t=>{if(is.has(t)){await gt(t);return}P(null),F({open:!0,phase:"catalog",domain:t})},L=async(t,s=1)=>{if(!m||!(g!=null&&g.compare.nextPair))return;const l=g.compare.nextPair;await xt.mutateAsync({userId:m,domain:f.domain,contextId:g.selectedContext.id,leftItemId:l.left.id,rightItemId:l.right.id,outcome:t,strength:s})},vt=async(t,s)=>{!m||!g||await pt.mutateAsync({userId:m,domain:f.domain,contextId:g.selectedContext.id,itemId:t,signalType:s,strength:1})};if(!m)return e.jsx(et,{eyebrow:"Preferences",title:"No Forge user available",description:"Forge needs at least one human or bot user before it can learn preferences."});if(U.isLoading&&!i)return e.jsx(tt,{eyebrow:"Preferences",title:"Loading preference model",description:"Reconstructing current scores, uncertainty, and concept libraries."});if(U.isError)return e.jsx(es,{eyebrow:"Preferences",error:U.error,onRetry:()=>void U.refetch()});if(!i)return null;const bt=[...i.dimensions].sort((t,s)=>s.confidence-t.confidence).slice(0,6),Be=i.scores.filter(t=>re(t)==="liked"||re(t)==="favorite").slice(0,4),We=i.scores.filter(t=>t.uncertainty>=.5).slice(0,4),qe=cs(i),Re=ls(((Ue=d==null?void 0:d.item)==null?void 0:Ue.sourceEntityType)??null,((Ge=d==null?void 0:d.item)==null?void 0:Ge.sourceEntityId)??null),A=(g==null?void 0:g.compare.nextPair)??null;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-5",children:[e.jsx(as,{title:"Preferences",titleText:"Preferences",description:"Forge keeps an explicit, editable model of what one user prefers in one domain. The first job of this page is to show what Forge currently knows.",badge:`${i.summary.totalItems} items · ${B(i.summary.averageConfidence)} confidence`,actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{className:"min-w-[10rem]",onClick:()=>Oe(),children:"Start the game"}),e.jsx(o,{variant:"secondary",onClick:()=>void u(),children:"Refresh model"})]})}),e.jsx(ts,{}),e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Active user"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("select",{value:m,onChange:t=>k({userId:t.target.value,contextId:null,focusItem:null}),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:c.snapshot.users.map(t=>e.jsxs("option",{value:t.id,children:[t.displayName," · ",t.kind]},t.id))}),e.jsx(st,{user:Ce}),e.jsx("div",{className:"text-sm text-white/54",children:ss(Ce)})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Domain"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ae.map(t=>e.jsx("button",{type:"button",className:$("rounded-full border px-3 py-2 text-sm transition",t.value===w?"border-[var(--primary)] bg-[var(--primary)]/14 text-white":"border-white/8 bg-white/[0.04] text-white/62 hover:bg-white/[0.08]"),onClick:()=>k({domain:t.value,contextId:null,focusItem:null}),children:t.label},t.value))}),e.jsx("div",{className:"text-sm text-white/48",children:(He=ae.find(t=>t.value===w))==null?void 0:He.description})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/50",children:[e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:i.selectedContext.name}),e.jsx("span",{children:i.selectedContext.shareMode}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[i.compare.pendingCount," queued comparisons"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[i.libraries.totalCatalogItems," concept items ready"]})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:rt.map(t=>e.jsxs("button",{type:"button",className:$("inline-flex items-center gap-2 rounded-full border px-3 py-2 text-sm transition",t.id===S?"border-[var(--primary)] bg-[var(--primary)]/14 text-white":"border-white/8 bg-white/[0.04] text-white/62 hover:bg-white/[0.08]"),onClick:()=>k({tab:t.id}),children:[e.jsx(t.icon,{className:"size-4"}),t.label]},t.id))}),S==="overview"?e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.3fr)_360px]",children:[e.jsxs(v,{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"What Forge knows"}),e.jsx("div",{className:"font-display text-3xl text-white",children:qe.title}),e.jsx("div",{className:"max-w-[70ch] text-sm leading-6 text-white/58",children:qe.description})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[{label:"Known items",value:i.summary.totalItems,detail:"Items inside this domain"},{label:"Confidence",value:B(i.summary.averageConfidence),detail:"Average certainty"},{label:"Unknowns",value:i.summary.uncertainCount,detail:"Need more rounds"},{label:"Libraries",value:i.libraries.totalCatalogItems,detail:"Seeded concepts ready"}].map(t=>e.jsxs("div",{className:"rounded-[22px] bg-white/[0.04] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:t.label}),e.jsx("div",{className:"mt-2 font-display text-3xl text-white",children:t.value}),e.jsx("div",{className:"mt-1 text-sm text-white/52",children:t.detail})]},t.label))}),e.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:bt.map(t=>e.jsx(os,{summary:t},t.dimensionId))})]}),e.jsxs(v,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Next move"}),e.jsx("div",{className:"font-display text-2xl text-white",children:"Start the game"}),e.jsx("div",{className:"text-sm leading-6 text-white/58",children:"Forge will ask a small number of pairwise questions. You choose a domain, Forge supplies the candidates, and the model tightens from there."}),e.jsx(o,{className:"w-full",onClick:()=>Oe(),children:"Start the game"}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-white/[0.04] px-4 py-4 text-sm text-white/58",children:[e.jsxs("div",{children:["Current queue: ",i.compare.pendingCount," comparison",i.compare.pendingCount===1?"":"s"]}),e.jsxs("div",{children:["Active context: ",i.selectedContext.name]}),e.jsxs("div",{children:["Library coverage: ",i.libraries.seededCatalogCount," ","seeded lists and ",i.libraries.customCatalogCount," ","custom lists"]})]})]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.3fr)_360px]",children:[e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Preference map"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Green drifts positive, red drifts negative, and low opacity still means uncertainty."})]}),e.jsx(ue,{to:"?tab=map",className:"text-sm text-[var(--primary)]",children:"Open full map"})]}),e.jsxs("div",{className:"relative min-h-[340px] overflow-hidden rounded-[24px] border border-white/8 bg-[radial-gradient(circle_at_top,rgba(87,196,138,0.18),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(255,104,130,0.14),transparent_30%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0.01))]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-white/8"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/8"}),i.map.map(t=>e.jsx("button",{type:"button",className:$("absolute -translate-x-1/2 -translate-y-1/2 rounded-full border px-2 py-1 text-[11px] shadow-[0_10px_25px_rgba(5,8,16,0.32)] transition hover:scale-[1.04]",t.itemId===(d==null?void 0:d.itemId)?"border-white/30 bg-white/16 text-white":t.score>=0?"border-emerald-300/30 bg-emerald-500/14 text-emerald-100":"border-rose-300/30 bg-rose-500/14 text-rose-100"),style:{left:`${50+t.x*30}%`,top:`${50-t.y*30}%`,opacity:.55+t.confidence*.45},onClick:()=>E(t.itemId),children:t.label},t.itemId))]})]}),e.jsxs(v,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Best read so far"}),e.jsx("div",{className:"grid gap-2",children:Be.length>0?Be.map(t=>{var s;return e.jsxs("button",{type:"button",className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-left transition hover:bg-white/[0.07]",onClick:()=>{E(t.itemId),k({focusItem:t.itemId})},children:[e.jsx("div",{className:"font-medium text-white",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:t.explanation[0]||"Forge has positive evidence here."})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:"No clear positives yet. A few comparison rounds will change that."})}),e.jsxs("div",{className:"border-t border-white/8 pt-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Biggest unknowns"}),e.jsx("div",{className:"mt-3 grid gap-2",children:We.length>0?We.map(t=>{var s;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:[e.jsx("div",{className:"font-medium text-white",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsxs("div",{className:"mt-1",children:["Uncertainty ",B(t.uncertainty)]})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:"The current unknown list is short."})})]})]})]}),e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Bring in Forge records"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Search goals, projects, tasks, strategies, or habits across human and bot users, then send them straight into this model."})]}),e.jsxs(y,{className:"bg-white/[0.08] text-white/70",children:[Se.length," visible"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:de,onChange:t=>dt(t.target.value),placeholder:"Search across owners, handles, user kind, title, and description"})]}),e.jsx("div",{className:"grid gap-2",children:Se.map(t=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-medium text-white",children:t.label}),e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.entityType}),t.user?e.jsx(st,{user:t.user,compact:!0}):null]}),e.jsx("div",{className:"mt-1 text-sm text-white/52",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.href?e.jsx(ue,{to:t.href,children:e.jsx(o,{variant:"ghost",size:"sm",children:"Open"})}):null,e.jsx(o,{variant:"secondary",size:"sm",pending:ke.isPending,pendingLabel:"Adding",onClick:()=>void ke.mutateAsync({userId:m,domain:w,entityType:t.entityType,entityId:t.entityId,label:t.label,description:t.description,tags:[]}),children:"Add to model"})]})]},`${t.entityType}-${t.entityId}`))})]})]}):null,S==="map"?e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Full map"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Click a point to inspect why Forge believes it belongs there."})]}),e.jsxs("div",{className:"text-sm text-white/52",children:[i.map.length," plotted items"]})]}),e.jsxs("div",{className:"relative min-h-[520px] overflow-hidden rounded-[24px] border border-white/8 bg-[radial-gradient(circle_at_20%_20%,rgba(87,196,138,0.2),transparent_25%),radial-gradient(circle_at_80%_80%,rgba(255,104,130,0.2),transparent_26%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0.01))]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-white/8"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/8"}),i.map.map(t=>e.jsx("button",{type:"button",className:$("absolute -translate-x-1/2 -translate-y-1/2 rounded-full border px-3 py-1 text-xs transition hover:scale-[1.04]",t.itemId===(d==null?void 0:d.itemId)?"border-white/30 bg-white/16 text-white":t.score>=0?"border-emerald-300/30 bg-emerald-500/14 text-emerald-100":"border-rose-300/30 bg-rose-500/14 text-rose-100"),style:{left:`${50+t.x*34}%`,top:`${50-t.y*34}%`,opacity:.45+t.confidence*.55},onClick:()=>{E(t.itemId),k({focusItem:t.itemId})},children:t.label},t.itemId))]})]}):null,S==="table"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.2fr)_380px]",children:[e.jsxs(v,{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:le,onChange:t=>lt(t.target.value),placeholder:"Search learned items, explanations, tags, or dominant dimensions"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-left text-sm",children:[e.jsx("thead",{className:"text-[11px] uppercase tracking-[0.14em] text-white/38",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2",children:"Item"}),e.jsx("th",{className:"px-3 py-2",children:"Score"}),e.jsx("th",{className:"px-3 py-2",children:"Confidence"}),e.jsx("th",{className:"px-3 py-2",children:"Status"}),e.jsx("th",{className:"px-3 py-2",children:"Evidence"})]})}),e.jsx("tbody",{children:pe.map(t=>{var s,l;return e.jsxs("tr",{className:$("cursor-pointer border-t border-white/6 transition hover:bg-white/[0.04]",t.itemId===(d==null?void 0:d.itemId)?"bg-white/[0.05]":""),onClick:()=>{E(t.itemId),k({focusItem:t.itemId})},children:[e.jsxs("td",{className:"px-3 py-3",children:[e.jsx("div",{className:"font-medium text-white",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"text-xs text-white/48",children:(((l=t.item)==null?void 0:l.tags)??[]).join(" · ")})]}),e.jsx("td",{className:"px-3 py-3 text-white/68",children:t.latentScore.toFixed(2)}),e.jsx("td",{className:"px-3 py-3 text-white/68",children:B(t.confidence)}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(y,{className:it[re(t)],children:re(t)})}),e.jsx("td",{className:"px-3 py-3 text-white/68",children:t.evidenceCount})]},t.itemId)})})]})})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Item editor"}),d!=null&&d.item?e.jsxs(e.Fragment,{children:[e.jsx(x,{value:p.label,onChange:t=>C(s=>({...s,label:t.target.value})),placeholder:"Item label"}),e.jsx(T,{value:p.description,onChange:t=>C(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"Item description"}),e.jsx(x,{value:p.tags,onChange:t=>C(s=>({...s,tags:t.target.value})),placeholder:"comma, separated, tags"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("select",{value:p.manualStatus,onChange:t=>C(s=>({...s,manualStatus:t.target.value})),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"",children:"Inferred status"}),Object.keys(it).map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(x,{value:p.manualScore,onChange:t=>C(s=>({...s,manualScore:t.target.value})),placeholder:"Manual score"}),e.jsx(x,{value:p.confidenceLock,onChange:t=>C(s=>({...s,confidenceLock:t.target.value})),placeholder:"Confidence lock 0-1"})]}),e.jsx("div",{className:"grid gap-2",children:Object.keys(ie).map(t=>e.jsxs("div",{className:"grid grid-cols-[110px_minmax(0,1fr)] items-center gap-3",children:[e.jsx("div",{className:"text-sm text-white/56",children:ve[t]}),e.jsx(x,{value:p.featureWeights[t],onChange:s=>C(l=>({...l,featureWeights:{...l.featureWeights,[t]:s.target.value}}))})]},t))}),e.jsx("div",{className:"grid gap-2 text-sm text-white/58",children:[["bookmarked","Bookmarked"],["compareLater","Compare later"],["frozen","Frozen"]].map(([t,s])=>e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:p[t],onChange:l=>C(n=>({...n,[t]:l.target.checked}))}),e.jsx("span",{children:s})]},t))}),e.jsx(o,{pending:Ee.isPending,pendingLabel:"Saving item",onClick:()=>void Ee.mutateAsync(),children:"Save item model"}),Re?e.jsx(ue,{className:"text-sm text-[var(--primary)]",to:Re,children:"Open linked entity"}):null]}):e.jsx("div",{className:"text-sm text-white/52",children:"Select a row to inspect or edit it."}),e.jsxs("div",{className:"mt-3 border-t border-white/8 pt-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Add custom item"}),e.jsxs("div",{className:"mt-3 grid gap-3",children:[e.jsx(x,{value:M.label,onChange:t=>Y(s=>({...s,label:t.target.value})),placeholder:"Custom item label"}),e.jsx(T,{value:M.description,onChange:t=>Y(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What is this preference item?"}),e.jsx(x,{value:M.tags,onChange:t=>Y(s=>({...s,tags:t.target.value})),placeholder:"comma, separated, tags"}),e.jsx(o,{disabled:!M.label.trim(),pending:Fe.isPending,pendingLabel:"Creating item",onClick:()=>void Fe.mutateAsync({userId:m,domain:w,label:M.label,description:M.description,tags:M.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:ie,queueForCompare:!0}),children:"Create custom item"})]})]})]})]}):null,S==="history"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-3",children:[e.jsxs(v,{className:"grid gap-3 xl:col-span-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Recent pairwise judgments"}),e.jsx("div",{className:"grid gap-2",children:i.history.judgments.slice(0,12).map(t=>{var n,r,b,G;const s=((r=(n=i.scores.find(O=>O.itemId===t.leftItemId))==null?void 0:n.item)==null?void 0:r.label)??t.leftItemId,l=((G=(b=i.scores.find(O=>O.itemId===t.rightItemId))==null?void 0:b.item)==null?void 0:G.label)??t.rightItemId;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm text-white/58",children:[e.jsxs("div",{className:"font-medium text-white",children:[s," vs ",l]}),e.jsxs("div",{className:"mt-1",children:["Outcome ",t.outcome," · strength"," ",t.strength," ·"," ",new Date(t.createdAt).toLocaleString()]})]},t.id)})})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Signals and snapshots"}),e.jsx("div",{className:"grid gap-2",children:i.history.signals.slice(0,8).map(t=>{var l,n;const s=((n=(l=i.scores.find(r=>r.itemId===t.itemId))==null?void 0:l.item)==null?void 0:n.label)??t.itemId;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-2 text-sm text-white/58",children:[s," · ",t.signalType," ·"," ",new Date(t.createdAt).toLocaleString()]},t.id)})}),e.jsx("div",{className:"grid gap-2",children:i.history.snapshots.slice(0,5).map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-2 text-sm text-white/58",children:["Snapshot ",new Date(t.createdAt).toLocaleString()]},t.id))}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:["Stale items: ",i.history.staleItemIds.length," · Flipped items: ",i.history.flippedItemIds.length]})]})]}):null,S==="contexts"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_360px]",children:[e.jsx("div",{className:"grid gap-4",children:i.contexts.map(t=>e.jsxs(v,{className:"grid gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-display text-2xl text-white",children:t.name}),e.jsx("div",{className:"text-sm text-white/54",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.isDefault?e.jsx(y,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:"Default"}):null,e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.shareMode}),t.active?null:e.jsx(y,{className:"bg-amber-500/12 text-amber-200",children:"Inactive"})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-4",children:[e.jsx(x,{value:t.name,onChange:s=>void z.mutateAsync({contextId:t.id,patch:{name:s.target.value}}),placeholder:"Context name"}),e.jsxs("select",{value:t.shareMode,onChange:s=>void z.mutateAsync({contextId:t.id,patch:{shareMode:s.target.value}}),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"shared",children:"shared"}),e.jsx("option",{value:"blended",children:"blended"}),e.jsx("option",{value:"isolated",children:"isolated"})]}),e.jsx(x,{value:String(t.decayDays),onChange:s=>void z.mutateAsync({contextId:t.id,patch:{decayDays:Number(s.target.value||90)}}),placeholder:"Decay days"}),e.jsx(o,{variant:"secondary",onClick:()=>k({contextId:t.id,tab:"overview"}),children:"Open context"})]}),e.jsx(T,{value:t.description,onChange:s=>void z.mutateAsync({contextId:t.id,patch:{description:s.target.value}}),className:"min-h-20"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"secondary",onClick:()=>void z.mutateAsync({contextId:t.id,patch:{active:!t.active}}),children:t.active?"Deactivate":"Activate"}),t.isDefault?null:e.jsx(o,{variant:"secondary",onClick:()=>void z.mutateAsync({contextId:t.id,patch:{isDefault:!0}}),children:"Make default"})]})]},t.id))}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Create context"}),e.jsx(x,{value:I.name,onChange:t=>q(s=>({...s,name:t.target.value})),placeholder:"Context name"}),e.jsx(T,{value:I.description,onChange:t=>q(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What changes in this context?"}),e.jsxs("select",{value:I.shareMode,onChange:t=>q(s=>({...s,shareMode:t.target.value})),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"blended",children:"blended"}),e.jsx("option",{value:"shared",children:"shared"}),e.jsx("option",{value:"isolated",children:"isolated"})]}),e.jsx(x,{value:I.decayDays,onChange:t=>q(s=>({...s,decayDays:t.target.value})),placeholder:"Decay days"}),e.jsx(o,{disabled:!I.name.trim(),pending:_e.isPending,pendingLabel:"Creating context",onClick:()=>void _e.mutateAsync({userId:m,domain:w,name:I.name,description:I.description,shareMode:I.shareMode,decayDays:Number(I.decayDays||90),active:!0,isDefault:!1}),children:"Create context"})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Merge contexts"}),e.jsxs("select",{value:K,onChange:t=>fe(t.target.value),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"",children:"Source context"}),i.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsxs("select",{value:J,onChange:t=>je(t.target.value),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"",children:"Target context"}),i.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsx(o,{pending:ze.isPending,pendingLabel:"Merging",disabled:!K||!J||K===J,onClick:()=>void ze.mutateAsync({sourceContextId:K,targetContextId:J}),children:"Merge into target"})]})]})]}):null,S==="concepts"?e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_380px]",children:[e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Concept libraries"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"These are the lists Forge can use when you start the game in a concept domain. Seeded lists are editable, and custom lists are fully yours."})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-4",children:[["Lists",i.libraries.totalCatalogs],["Concepts",i.libraries.totalCatalogItems],["Seeded",i.libraries.seededCatalogCount],["Custom",i.libraries.customCatalogCount]].map(([t,s])=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:t}),e.jsx("div",{className:"mt-2 font-display text-3xl text-white",children:s})]},t))}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:D,onChange:t=>be(t.target.value),placeholder:"Search lists, concepts, tags, and seeded domains"})]})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Create concept list"}),e.jsx(x,{value:R.title,onChange:t=>oe(s=>({...s,title:t.target.value})),placeholder:"List title"}),e.jsx(T,{value:R.description,onChange:t=>oe(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What should this list help compare?"}),e.jsx(o,{disabled:!R.title.trim(),pending:Pe.isPending,pendingLabel:"Creating list",onClick:()=>void Pe.mutateAsync({userId:m,domain:w,title:R.title,description:R.description}),children:"Create list"})]})]}),e.jsx("div",{className:"grid gap-4",children:ge.map(t=>{const s=ot[t.id]??{label:"",description:"",tags:""},l=t.items.filter(n=>D.trim()?[n.label,n.description,n.tags.join(" ")].join(" ").toLowerCase().includes(ne(D)):!0);return e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsx("div",{className:"min-w-0",children:Ne===t.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(x,{value:Z.title,onChange:n=>he(r=>({...r,title:n.target.value}))}),e.jsx(T,{value:Z.description,onChange:n=>he(r=>({...r,description:n.target.value})),className:"min-h-24"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"font-display text-2xl text-white",children:t.title}),e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.source}),e.jsxs(y,{className:"bg-white/[0.08] text-white/70",children:[t.items.length," items"]})]}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:t.description||"No description yet."})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"secondary",size:"sm",onClick:()=>void $e(w,t.id),children:"Start from this list"}),Ne===t.id?e.jsxs(e.Fragment,{children:[e.jsx(o,{size:"sm",pending:Le.isPending,pendingLabel:"Saving",onClick:()=>void Le.mutateAsync({catalogId:t.id,patch:{title:Z.title,description:Z.description}}),children:"Save"}),e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>me(null),children:"Cancel"})]}):e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>{me(t.id),he({title:t.title,description:t.description})},children:"Edit list"}),e.jsx(o,{variant:"ghost",size:"sm",pending:Te.isPending,pendingLabel:"Deleting",onClick:()=>void Te.mutateAsync(t.id),children:"Delete list"})]})]}),e.jsx("div",{className:"grid gap-2",children:l.map(n=>e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:mt===n.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(x,{value:_.label,onChange:r=>V(b=>({...b,label:r.target.value}))}),e.jsx(T,{value:_.description,onChange:r=>V(b=>({...b,description:r.target.value})),className:"min-h-20"}),e.jsx(x,{value:_.tags,onChange:r=>V(b=>({...b,tags:r.target.value})),placeholder:"comma, separated, tags"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{size:"sm",pending:Ae.isPending,pendingLabel:"Saving",onClick:()=>void Ae.mutateAsync({catalogItemId:n.id,patch:{label:_.label,description:_.description,tags:_.tags.split(",").map(r=>r.trim()).filter(Boolean)}}),children:"Save concept"}),e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>xe(null),children:"Cancel"})]})]}):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-medium text-white",children:n.label}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:n.description||"No description yet."}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:n.tags.map(r=>e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:r},`${n.id}-${r}`))})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>{xe(n.id),V({label:n.label,description:n.description,tags:n.tags.join(", ")})},children:"Edit"}),e.jsxs(o,{variant:"ghost",size:"sm",pending:De.isPending,pendingLabel:"Deleting",onClick:()=>void De.mutateAsync(n.id),children:[e.jsx(St,{className:"mr-1 size-4"}),"Delete"]})]})]})},n.id))}),e.jsxs("div",{className:"grid gap-3 rounded-[18px] border border-white/8 bg-white/[0.02] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/68",children:[e.jsx(kt,{className:"size-4"}),"Add concept to ",t.title]}),e.jsx(x,{value:s.label,onChange:n=>X(r=>({...r,[t.id]:{...s,label:n.target.value}})),placeholder:"Concept label"}),e.jsx(T,{value:s.description,onChange:n=>X(r=>({...r,[t.id]:{...s,description:n.target.value}})),className:"min-h-20",placeholder:"Short description"}),e.jsx(x,{value:s.tags,onChange:n=>X(r=>({...r,[t.id]:{...s,tags:n.target.value}})),placeholder:"comma, separated, tags"}),e.jsx(o,{disabled:!s.label.trim(),pending:Me.isPending,pendingLabel:"Adding",onClick:()=>void Me.mutateAsync({catalogId:t.id,label:s.label,description:s.description,tags:s.tags.split(",").map(n=>n.trim()).filter(Boolean),featureWeights:ie}).then(()=>X(n=>({...n,[t.id]:{label:"",description:"",tags:""}}))),children:"Add concept"})]})]},t.id)})})]}):null]}),e.jsx(Pt,{open:f.open,onOpenChange:t=>{t||P(null),F(s=>({...s,open:t}))},children:e.jsxs(Lt,{children:[e.jsx(Tt,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.74)] backdrop-blur-xl"}),e.jsxs(Mt,{className:"fixed inset-x-4 bottom-4 top-4 z-50 overflow-y-auto rounded-[32px] border border-white/10 bg-[linear-gradient(180deg,rgba(17,24,39,0.98),rgba(10,14,24,0.98))] shadow-[0_30px_90px_rgba(3,8,18,0.45)] md:inset-x-10 lg:left-1/2 lg:right-auto lg:w-[min(72rem,calc(100vw-3rem))] lg:-translate-x-1/2",children:[e.jsx(At,{className:"sr-only",children:"Preference game"}),e.jsx(Dt,{className:"sr-only",children:"Start comparison rounds from a Forge domain or concept list."}),e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-4 border-b border-white/8 bg-[rgba(10,14,24,0.92)] px-5 py-4 backdrop-blur-xl",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Preference game"}),e.jsx("div",{className:"mt-1 font-display text-2xl text-white",children:f.phase==="domain"?"Choose a domain":f.phase==="catalog"?"Choose a concept list":"Pick the better fit"})]}),e.jsx(Et,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close preference game",className:"rounded-full bg-white/6 p-2 text-white/65 transition hover:bg-white/10 hover:text-white",children:e.jsx(Ft,{className:"size-4"})})})]}),e.jsxs("div",{className:"grid gap-5 px-5 py-5",children:[we?e.jsx("div",{className:"rounded-[18px] border border-rose-400/25 bg-rose-500/10 px-4 py-3 text-sm text-rose-100",children:we}):null,f.phase==="domain"?e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:ae.map(t=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-white/8 bg-white/[0.04] px-5 py-5 text-left transition hover:border-[var(--primary)]/30 hover:bg-[var(--primary)]/10",onClick:()=>void ut(t.value),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.mode==="forge"?"Forge":"Concept"})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:t.description})]},t.value))}):null,f.phase==="catalog"?e.jsxs("div",{className:"grid gap-4",children:[e.jsx("div",{className:"text-sm text-white/58",children:"Pick the concept list Forge should draw from. You do not need to assemble the items yourself."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:D,onChange:t=>be(t.target.value),placeholder:"Search concept lists"})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:ge.length>0?ge.map(t=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-white/8 bg-white/[0.04] px-5 py-5 text-left transition hover:border-[var(--primary)]/30 hover:bg-[var(--primary)]/10",onClick:()=>void $e(f.domain,t.id),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:t.title}),e.jsxs(y,{className:"bg-white/[0.08] text-white/70",children:[t.items.length," items"]})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:t.description||"No description yet."})]},t.id)):e.jsx("div",{className:"rounded-[24px] bg-white/[0.04] px-5 py-6 text-sm text-white/58",children:"No concept list matches that search yet."})})]}):null,f.phase==="play"?e.jsx("div",{className:"grid gap-5",children:ct||Ie.isLoading?e.jsx(tt,{eyebrow:"Preference game",title:"Preparing the next round",description:"Forge is lining up comparison candidates."}):A?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/52",children:[e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:((Ke=ae.find(t=>t.value===f.domain))==null?void 0:Ke.label)??f.domain}),e.jsx("span",{children:g==null?void 0:g.selectedContext.name}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[(g==null?void 0:g.compare.pendingCount)??0," ","queued comparisons"]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(nt,{title:A.left.label,description:A.left.description,sideLabel:"Left",onClick:()=>void L("left",1)}),e.jsx(nt,{title:A.right.label,description:A.right.description,sideLabel:"Right",onClick:()=>void L("right",1)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{onClick:()=>void L("left",1),children:"Left"}),e.jsx(o,{onClick:()=>void L("right",1),children:"Right"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("left",1.75),children:"Strong left"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("right",1.75),children:"Strong right"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("tie",1),children:"Tie"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("skip",1),children:"Skip"})]}),e.jsx("div",{className:"grid gap-4 rounded-[24px] border border-white/8 bg-white/[0.03] px-4 py-4 lg:grid-cols-2",children:[A.left,A.right].map(t=>e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsx("div",{className:"text-sm text-white/56",children:"Quick signals"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ns.map(s=>e.jsx(o,{variant:"secondary",size:"sm",onClick:()=>void vt(t.id,s.signalType),children:s.label},`${t.id}-${s.signalType}`))})]},t.id))})]}):e.jsx(et,{eyebrow:"Preference game",title:"No pair is ready yet",description:"Forge needs more items in this domain before it can keep asking comparisons."})}):null]})]})]})})]})}export{js as PreferencesPage};
|
|
1
|
+
import{c2 as ft,r as h,j as e,b0 as jt,bH as wt,cG as yt,cH as Nt,bf as Ct,aG as It,aC as ue,b3 as se,c7 as St,b4 as kt,aK as Ft}from"./vendor-DHkYh85p.js";import{R as Pt,P as Lt,O as Tt,C as Mt,T as At,D as Dt,a as Et}from"./ui-C13Nbgas.js";import{j as _t,i as Ze,k as j}from"./state-B-4sS1xO.js";import{u as zt,s as Ot,c4 as Ve,c5 as $t,c6 as Bt,c7 as Wt,c8 as qt,c9 as Rt,ca as Qt,cb as Ut,cc as Gt,cd as Ht,ce as Kt,cf as Jt,cg as Yt,ch as Xt,ci as Zt,cj as Vt,a as et,L as tt,E as es,B as o,ck as ts,C as v,U as st,H as ss,Z as $,c as y,I as x,T,bk as H,cl as at}from"./index-CF4J4R9L.js";import{P as as}from"./page-hero-DRy5b2MU.js";import"./board-BkDRaMp6.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const rt=[{id:"overview",label:"Overview",icon:jt},{id:"map",label:"Map",icon:wt},{id:"table",label:"Table",icon:yt},{id:"history",label:"History",icon:Nt},{id:"contexts",label:"Contexts",icon:Ct},{id:"concepts",label:"Concepts",icon:It}],is=new Set(["projects","tasks","strategies","habits"]),ae=[{value:"projects",label:"Projects",description:"Goals and projects already living in Forge.",mode:"forge"},{value:"tasks",label:"Tasks",description:"Execution-level work choices inside Forge.",mode:"forge"},{value:"strategies",label:"Strategies",description:"Plan shapes and sequencing choices in Forge.",mode:"forge"},{value:"habits",label:"Habits",description:"Recurring behaviors and routines from Forge.",mode:"forge"},{value:"activities",label:"Activities",description:"Movement, leisure, and social setting concepts.",mode:"concept"},{value:"food",label:"Food",description:"Cuisine, meal mood, and drink preferences.",mode:"concept"},{value:"places",label:"Places",description:"Living environments, venues, and trip shapes.",mode:"concept"},{value:"countries",label:"Countries",description:"Country-level attraction and lifestyle fit.",mode:"concept"},{value:"fashion",label:"Fashion",description:"Silhouette, material, and palette preferences.",mode:"concept"},{value:"people",label:"People",description:"Presence, body-type, and conversation preferences.",mode:"concept"},{value:"media",label:"Media",description:"Film, reading, and music taste.",mode:"concept"},{value:"tools",label:"Tools",description:"Workflow and capture preferences.",mode:"concept"},{value:"custom",label:"Custom",description:"General-purpose concept libraries you control.",mode:"concept"}],ve={novelty:"Novelty",simplicity:"Simplicity",rigor:"Rigor",aesthetics:"Aesthetics",depth:"Depth",structure:"Structure",familiarity:"Familiarity",surprise:"Surprise"},ie={novelty:0,simplicity:0,rigor:0,aesthetics:0,depth:0,structure:0,familiarity:0,surprise:0},it={liked:"bg-emerald-500/12 text-emerald-200",disliked:"bg-rose-500/12 text-rose-200",uncertain:"bg-white/[0.08] text-white/70",vetoed:"bg-rose-500/15 text-rose-100",bookmarked:"bg-sky-500/12 text-sky-200",favorite:"bg-amber-500/12 text-amber-200",must_have:"bg-indigo-500/15 text-indigo-100",neutral:"bg-white/[0.08] text-white/70"},ns=[{signalType:"favorite",label:"Favorite"},{signalType:"must_have",label:"Must-have"},{signalType:"bookmark",label:"Bookmark"},{signalType:"compare_later",label:"Later"},{signalType:"neutral",label:"Neutral"},{signalType:"veto",label:"Veto"}];function ne(c){return c.trim().toLowerCase()}function B(c){return`${Math.round(c*100)}%`}function rs(c){return[...c.goals.map(a=>({entityType:"goal",entityId:a.id,domain:"projects",label:a.title,description:a.description,user:a.user,href:`/goals/${a.id}`,searchText:H([a.title,a.description,a.status,a.horizon],a)})),...c.dashboard.projects.map(a=>({entityType:"project",entityId:a.id,domain:"projects",label:a.title,description:a.description,user:a.user,href:`/projects/${a.id}`,searchText:H([a.title,a.description,a.status,a.goalTitle],a)})),...c.tasks.map(a=>({entityType:"task",entityId:a.id,domain:"tasks",label:a.title,description:a.description,user:a.user,href:`/tasks/${a.id}`,searchText:H([a.title,a.description,a.status,a.priority,a.owner],a)})),...c.strategies.map(a=>({entityType:"strategy",entityId:a.id,domain:"strategies",label:a.title,description:a.overview||a.endStateDescription,user:a.user,href:`/strategies/${a.id}`,searchText:H([a.title,a.overview,a.endStateDescription,a.status],a)})),...c.habits.map(a=>({entityType:"habit",entityId:a.id,domain:"habits",label:a.title,description:a.description,user:a.user,href:null,searchText:H([a.title,a.description,a.status,a.frequency],a)}))]}function ls(c,a){return!c||!a?null:c==="goal"?`/goals/${a}`:c==="project"?`/projects/${a}`:c==="task"?`/tasks/${a}`:c==="strategy"?`/strategies/${a}`:null}function re(c){return c.manualStatus??c.status}function ds(c){return c&&rt.some(a=>a.id===c)?c:"overview"}function cs(c){return c.summary.totalItems<2?{title:"Forge does not know enough yet.",description:"Start the game so Forge can ask a few clean comparisons and build a real preference model."}:c.summary.averageConfidence<.28?{title:"Forge has a rough sketch, not a stable read.",description:"There is some signal, but the model still needs more rounds before its preferences are trustworthy."}:{title:"This is what Forge currently thinks.",description:"The summary below is the current best model for this user, this domain, and the active context."}}function os({summary:c}){const a=Math.max(-1,Math.min(1,c.leaning)),N=(a+1)/2*100;return e.jsxs("div",{className:"grid gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-white/56",children:[e.jsx("span",{children:ve[c.dimensionId]}),e.jsxs("span",{children:[c.movement>.08?"Rising":c.movement<-.08?"Falling":"Stable"," ","· ",B(c.confidence)]})]}),e.jsxs("div",{className:"relative h-2 rounded-full bg-white/[0.08]",children:[e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/10"}),e.jsx("div",{className:$("absolute top-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white/12",a>=0?"bg-emerald-300":"bg-rose-300"),style:{left:`${N}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-[11px] uppercase tracking-[0.12em] text-white/38",children:[e.jsxs("span",{children:[a>=0?"Leans toward":"Leans away from"," ",ve[c.dimensionId].toLowerCase()]}),e.jsxs("span",{children:["Context ",B(c.contextSensitivity)]})]})]})}function nt({title:c,description:a,sideLabel:N,onClick:W}){return e.jsxs("button",{type:"button",className:"grid min-h-[220px] gap-4 rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(255,255,255,0.07),rgba(255,255,255,0.03))] p-5 text-left transition hover:border-[var(--primary)]/40 hover:bg-[linear-gradient(180deg,rgba(192,193,255,0.14),rgba(255,255,255,0.05))]",onClick:W,children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/42",children:N}),e.jsx("div",{className:"font-display text-3xl text-white",children:c}),e.jsx("div",{className:"max-w-[36ch] text-sm leading-6 text-white/56",children:a||"Choose the one that feels more right."}),e.jsx("div",{className:"mt-auto text-sm text-[var(--primary)]",children:"Click this card"})]})}function js(){var Qe,Ue,Ge,He,Ke;const c=zt(),a=_t(),[N,W]=ft(),[le,lt]=h.useState(""),[de,dt]=h.useState(""),[D,be]=h.useState(""),[K,fe]=h.useState(""),[J,je]=h.useState(""),[f,F]=h.useState({open:!1,phase:"domain",domain:N.get("domain")??"projects"}),[we,P]=h.useState(null),[ct,ce]=h.useState(!1),[ye,E]=h.useState(null),[p,C]=h.useState({label:"",description:"",tags:"",manualStatus:"",manualScore:"",confidenceLock:"",bookmarked:!1,compareLater:!1,frozen:!1,featureWeights:{novelty:"0",simplicity:"0",rigor:"0",aesthetics:"0",depth:"0",structure:"0",familiarity:"0",surprise:"0"}}),[M,Y]=h.useState({label:"",description:"",tags:""}),[I,q]=h.useState({name:"",description:"",shareMode:"blended",decayDays:"90"}),[R,oe]=h.useState({title:"",description:""}),[ot,X]=h.useState({}),[Ne,me]=h.useState(null),[Z,he]=h.useState({title:"",description:""}),[mt,xe]=h.useState(null),[_,V]=h.useState({label:"",description:"",tags:""}),m=N.get("userId")??Ot(c.selectedUserIds)??((Qe=c.snapshot.users[0])==null?void 0:Qe.id)??null,w=N.get("domain")??"projects",S=ds(N.get("tab")),Q=N.get("contextId"),ee=N.get("focusItem"),Ce=h.useMemo(()=>c.snapshot.users.find(t=>t.id===m)??null,[m,c.snapshot.users]),te=h.useMemo(()=>rs(c.snapshot),[c.snapshot]),U=Ze({queryKey:["forge-preferences",m,w,Q],queryFn:async()=>(await at({userId:m??void 0,domain:w,contextId:Q??void 0})).workspace,enabled:!!m}),Ie=Ze({queryKey:["forge-preferences-game",m,f.domain,Q],queryFn:async()=>(await at({userId:m??void 0,domain:f.domain,contextId:Q??void 0})).workspace,enabled:!!m&&f.open}),i=U.data??null,g=f.domain===w?i:Ie.data??null;h.useEffect(()=>{var s;if(!i)return;const t=ee&&i.scores.some(l=>l.itemId===ee)?ee:((s=i.scores[0])==null?void 0:s.itemId)??null;E(l=>l&&i.scores.some(n=>n.itemId===l)?l:t)},[ee,i]);const pe=h.useMemo(()=>{if(!i)return[];const t=ne(le);return t?i.scores.filter(s=>{var l,n,r;return[((l=s.item)==null?void 0:l.label)??"",((n=s.item)==null?void 0:n.description)??"",((r=s.item)==null?void 0:r.tags.join(" "))??"",s.status,s.manualStatus??"",s.dominantDimensions.join(" "),s.explanation.join(" ")].join(" ").toLowerCase().includes(t)}):i.scores},[le,i]),d=pe.find(t=>t.itemId===ye)??(i==null?void 0:i.scores.find(t=>t.itemId===ye))??pe[0]??(i==null?void 0:i.scores[0])??null;h.useEffect(()=>{var t,s,l,n,r,b,G,O,Je,Ye,Xe;d&&C({label:((t=d.item)==null?void 0:t.label)??"",description:((s=d.item)==null?void 0:s.description)??"",tags:((l=d.item)==null?void 0:l.tags.join(", "))??"",manualStatus:d.manualStatus??"",manualScore:typeof d.manualScore=="number"?String(d.manualScore):"",confidenceLock:typeof d.confidenceLock=="number"?String(d.confidenceLock):"",bookmarked:d.bookmarked,compareLater:d.compareLater,frozen:d.frozen,featureWeights:{novelty:String(((n=d.item)==null?void 0:n.featureWeights.novelty)??0),simplicity:String(((r=d.item)==null?void 0:r.featureWeights.simplicity)??0),rigor:String(((b=d.item)==null?void 0:b.featureWeights.rigor)??0),aesthetics:String(((G=d.item)==null?void 0:G.featureWeights.aesthetics)??0),depth:String(((O=d.item)==null?void 0:O.featureWeights.depth)??0),structure:String(((Je=d.item)==null?void 0:Je.featureWeights.structure)??0),familiarity:String(((Ye=d.item)==null?void 0:Ye.featureWeights.familiarity)??0),surprise:String(((Xe=d.item)==null?void 0:Xe.featureWeights.surprise)??0)}})},[d]);const Se=h.useMemo(()=>{const t=ne(de);return te.filter(s=>s.domain===w).filter(s=>t?s.searchText.includes(t):!0).slice(0,12)},[te,de,w]),ge=h.useMemo(()=>{const t=S==="concepts"?i:g??i,s=(t==null?void 0:t.catalogs)??[],l=ne(D);return l?s.filter(n=>[n.title,n.description,n.source,...n.items.flatMap(r=>[r.label,r.description,r.tags.join(" ")])].join(" ").toLowerCase().includes(l)):s},[g,D,S,i]),u=async()=>{await a.invalidateQueries({queryKey:["forge-preferences"]}),await a.invalidateQueries({queryKey:["forge-preferences-game"]})},ke=j({mutationFn:Ve,onSuccess:u}),Fe=j({mutationFn:$t,onSuccess:async({item:t})=>{await u(),Y({label:"",description:"",tags:""}),E(t.id)}}),Pe=j({mutationFn:Bt,onSuccess:async()=>{await u(),oe({title:"",description:""}),W(t=>{const s=new URLSearchParams(t);return s.set("tab","concepts"),s})}}),Le=j({mutationFn:({catalogId:t,patch:s})=>Wt(t,s),onSuccess:async()=>{await u(),me(null)}}),Te=j({mutationFn:qt,onSuccess:u}),Me=j({mutationFn:Rt,onSuccess:async()=>{await u()}}),Ae=j({mutationFn:({catalogItemId:t,patch:s})=>Qt(t,s),onSuccess:async()=>{await u(),xe(null)}}),De=j({mutationFn:Ut,onSuccess:u}),ht=j({mutationFn:Gt,onSuccess:async()=>{await u(),F(t=>({...t,phase:"play"}))}}),xt=j({mutationFn:Ht,onSuccess:u}),pt=j({mutationFn:Kt,onSuccess:u}),Ee=j({mutationFn:async()=>{!(d!=null&&d.item)||!m||!i||(await Jt(d.item.id,{label:p.label,description:p.description,tags:p.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:Object.fromEntries(Object.keys(ie).map(t=>[t,Number(p.featureWeights[t]||0)]))}),await Yt(d.item.id,{userId:m,domain:w,contextId:i.selectedContext.id,manualStatus:p.manualStatus||null,manualScore:p.manualScore.trim().length>0?Number(p.manualScore):null,confidenceLock:p.confidenceLock.trim().length>0?Number(p.confidenceLock):null,bookmarked:p.bookmarked,compareLater:p.compareLater,frozen:p.frozen}))},onSuccess:u}),_e=j({mutationFn:Xt,onSuccess:async({context:t})=>{await u(),q({name:"",description:"",shareMode:"blended",decayDays:"90"}),W(s=>{const l=new URLSearchParams(s);return l.set("contextId",t.id),l.set("tab","contexts"),l})}}),ze=j({mutationFn:Zt,onSuccess:async()=>{await u(),fe(""),je("")}}),z=j({mutationFn:({contextId:t,patch:s})=>Vt(t,s),onSuccess:u}),k=t=>{W(s=>{const l=new URLSearchParams(s);for(const[n,r]of Object.entries(t))r?l.set(n,r):l.delete(n);return l})},Oe=(t=w)=>{P(null),F({open:!0,phase:"domain",domain:t})},gt=async t=>{if(!m)return;P(null),ce(!0);const s=te.filter(r=>{var b;return r.domain===t&&((b=r.user)==null?void 0:b.id)===m}),l=te.filter(r=>r.domain===t),n=(s.length>0?s:l).slice(0,12);if(n.length<2){P("Forge needs at least two matching records in this domain before it can start the game."),ce(!1),F(r=>({...r,phase:"domain"}));return}try{k({domain:t,tab:"overview",contextId:null,focusItem:null}),await Promise.all(n.map(r=>Ve({userId:m,domain:t,entityType:r.entityType,entityId:r.entityId,label:r.label,description:r.description,tags:[]}))),await u(),F({open:!0,phase:"play",domain:t})}catch(r){P(r instanceof Error?r.message:"Forge could not start the game."),F(b=>({...b,phase:"domain"}))}finally{ce(!1)}},$e=async(t,s)=>{if(m){P(null),k({domain:t,tab:"overview",contextId:null,focusItem:null});try{await ht.mutateAsync({userId:m,domain:t,contextId:Q??void 0,catalogId:s}),F({open:!0,phase:"play",domain:t})}catch(l){P(l instanceof Error?l.message:"Forge could not start the game.")}}},ut=async t=>{if(is.has(t)){await gt(t);return}P(null),F({open:!0,phase:"catalog",domain:t})},L=async(t,s=1)=>{if(!m||!(g!=null&&g.compare.nextPair))return;const l=g.compare.nextPair;await xt.mutateAsync({userId:m,domain:f.domain,contextId:g.selectedContext.id,leftItemId:l.left.id,rightItemId:l.right.id,outcome:t,strength:s})},vt=async(t,s)=>{!m||!g||await pt.mutateAsync({userId:m,domain:f.domain,contextId:g.selectedContext.id,itemId:t,signalType:s,strength:1})};if(!m)return e.jsx(et,{eyebrow:"Preferences",title:"No Forge user available",description:"Forge needs at least one human or bot user before it can learn preferences."});if(U.isLoading&&!i)return e.jsx(tt,{eyebrow:"Preferences",title:"Loading preference model",description:"Reconstructing current scores, uncertainty, and concept libraries."});if(U.isError)return e.jsx(es,{eyebrow:"Preferences",error:U.error,onRetry:()=>void U.refetch()});if(!i)return null;const bt=[...i.dimensions].sort((t,s)=>s.confidence-t.confidence).slice(0,6),Be=i.scores.filter(t=>re(t)==="liked"||re(t)==="favorite").slice(0,4),We=i.scores.filter(t=>t.uncertainty>=.5).slice(0,4),qe=cs(i),Re=ls(((Ue=d==null?void 0:d.item)==null?void 0:Ue.sourceEntityType)??null,((Ge=d==null?void 0:d.item)==null?void 0:Ge.sourceEntityId)??null),A=(g==null?void 0:g.compare.nextPair)??null;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-5",children:[e.jsx(as,{title:"Preferences",titleText:"Preferences",description:"Forge keeps an explicit, editable model of what one user prefers in one domain. The first job of this page is to show what Forge currently knows.",badge:`${i.summary.totalItems} items · ${B(i.summary.averageConfidence)} confidence`,actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{className:"min-w-[10rem]",onClick:()=>Oe(),children:"Start the game"}),e.jsx(o,{variant:"secondary",onClick:()=>void u(),children:"Refresh model"})]})}),e.jsx(ts,{}),e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Active user"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("select",{value:m,onChange:t=>k({userId:t.target.value,contextId:null,focusItem:null}),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:c.snapshot.users.map(t=>e.jsxs("option",{value:t.id,children:[t.displayName," · ",t.kind]},t.id))}),e.jsx(st,{user:Ce}),e.jsx("div",{className:"text-sm text-white/54",children:ss(Ce)})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Domain"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ae.map(t=>e.jsx("button",{type:"button",className:$("rounded-full border px-3 py-2 text-sm transition",t.value===w?"border-[var(--primary)] bg-[var(--primary)]/14 text-white":"border-white/8 bg-white/[0.04] text-white/62 hover:bg-white/[0.08]"),onClick:()=>k({domain:t.value,contextId:null,focusItem:null}),children:t.label},t.value))}),e.jsx("div",{className:"text-sm text-white/48",children:(He=ae.find(t=>t.value===w))==null?void 0:He.description})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/50",children:[e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:i.selectedContext.name}),e.jsx("span",{children:i.selectedContext.shareMode}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[i.compare.pendingCount," queued comparisons"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[i.libraries.totalCatalogItems," concept items ready"]})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:rt.map(t=>e.jsxs("button",{type:"button",className:$("inline-flex items-center gap-2 rounded-full border px-3 py-2 text-sm transition",t.id===S?"border-[var(--primary)] bg-[var(--primary)]/14 text-white":"border-white/8 bg-white/[0.04] text-white/62 hover:bg-white/[0.08]"),onClick:()=>k({tab:t.id}),children:[e.jsx(t.icon,{className:"size-4"}),t.label]},t.id))}),S==="overview"?e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.3fr)_360px]",children:[e.jsxs(v,{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"What Forge knows"}),e.jsx("div",{className:"font-display text-3xl text-white",children:qe.title}),e.jsx("div",{className:"max-w-[70ch] text-sm leading-6 text-white/58",children:qe.description})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[{label:"Known items",value:i.summary.totalItems,detail:"Items inside this domain"},{label:"Confidence",value:B(i.summary.averageConfidence),detail:"Average certainty"},{label:"Unknowns",value:i.summary.uncertainCount,detail:"Need more rounds"},{label:"Libraries",value:i.libraries.totalCatalogItems,detail:"Seeded concepts ready"}].map(t=>e.jsxs("div",{className:"rounded-[22px] bg-white/[0.04] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:t.label}),e.jsx("div",{className:"mt-2 font-display text-3xl text-white",children:t.value}),e.jsx("div",{className:"mt-1 text-sm text-white/52",children:t.detail})]},t.label))}),e.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:bt.map(t=>e.jsx(os,{summary:t},t.dimensionId))})]}),e.jsxs(v,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Next move"}),e.jsx("div",{className:"font-display text-2xl text-white",children:"Start the game"}),e.jsx("div",{className:"text-sm leading-6 text-white/58",children:"Forge will ask a small number of pairwise questions. You choose a domain, Forge supplies the candidates, and the model tightens from there."}),e.jsx(o,{className:"w-full",onClick:()=>Oe(),children:"Start the game"}),e.jsxs("div",{className:"grid gap-3 rounded-[22px] bg-white/[0.04] px-4 py-4 text-sm text-white/58",children:[e.jsxs("div",{children:["Current queue: ",i.compare.pendingCount," comparison",i.compare.pendingCount===1?"":"s"]}),e.jsxs("div",{children:["Active context: ",i.selectedContext.name]}),e.jsxs("div",{children:["Library coverage: ",i.libraries.seededCatalogCount," ","seeded lists and ",i.libraries.customCatalogCount," ","custom lists"]})]})]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.3fr)_360px]",children:[e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Preference map"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Green drifts positive, red drifts negative, and low opacity still means uncertainty."})]}),e.jsx(ue,{to:"?tab=map",className:"text-sm text-[var(--primary)]",children:"Open full map"})]}),e.jsxs("div",{className:"relative min-h-[340px] overflow-hidden rounded-[24px] border border-white/8 bg-[radial-gradient(circle_at_top,rgba(87,196,138,0.18),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(255,104,130,0.14),transparent_30%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0.01))]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-white/8"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/8"}),i.map.map(t=>e.jsx("button",{type:"button",className:$("absolute -translate-x-1/2 -translate-y-1/2 rounded-full border px-2 py-1 text-[11px] shadow-[0_10px_25px_rgba(5,8,16,0.32)] transition hover:scale-[1.04]",t.itemId===(d==null?void 0:d.itemId)?"border-white/30 bg-white/16 text-white":t.score>=0?"border-emerald-300/30 bg-emerald-500/14 text-emerald-100":"border-rose-300/30 bg-rose-500/14 text-rose-100"),style:{left:`${50+t.x*30}%`,top:`${50-t.y*30}%`,opacity:.55+t.confidence*.45},onClick:()=>E(t.itemId),children:t.label},t.itemId))]})]}),e.jsxs(v,{className:"grid gap-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Best read so far"}),e.jsx("div",{className:"grid gap-2",children:Be.length>0?Be.map(t=>{var s;return e.jsxs("button",{type:"button",className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-left transition hover:bg-white/[0.07]",onClick:()=>{E(t.itemId),k({focusItem:t.itemId})},children:[e.jsx("div",{className:"font-medium text-white",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:t.explanation[0]||"Forge has positive evidence here."})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:"No clear positives yet. A few comparison rounds will change that."})}),e.jsxs("div",{className:"border-t border-white/8 pt-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Biggest unknowns"}),e.jsx("div",{className:"mt-3 grid gap-2",children:We.length>0?We.map(t=>{var s;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:[e.jsx("div",{className:"font-medium text-white",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsxs("div",{className:"mt-1",children:["Uncertainty ",B(t.uncertainty)]})]},t.itemId)}):e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:"The current unknown list is short."})})]})]})]}),e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Bring in Forge records"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Search goals, projects, tasks, strategies, or habits across human and bot users, then send them straight into this model."})]}),e.jsxs(y,{className:"bg-white/[0.08] text-white/70",children:[Se.length," visible"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:de,onChange:t=>dt(t.target.value),placeholder:"Search across owners, handles, user kind, title, and description"})]}),e.jsx("div",{className:"grid gap-2",children:Se.map(t=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-medium text-white",children:t.label}),e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.entityType}),t.user?e.jsx(st,{user:t.user,compact:!0}):null]}),e.jsx("div",{className:"mt-1 text-sm text-white/52",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.href?e.jsx(ue,{to:t.href,children:e.jsx(o,{variant:"ghost",size:"sm",children:"Open"})}):null,e.jsx(o,{variant:"secondary",size:"sm",pending:ke.isPending,pendingLabel:"Adding",onClick:()=>void ke.mutateAsync({userId:m,domain:w,entityType:t.entityType,entityId:t.entityId,label:t.label,description:t.description,tags:[]}),children:"Add to model"})]})]},`${t.entityType}-${t.entityId}`))})]})]}):null,S==="map"?e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Full map"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"Click a point to inspect why Forge believes it belongs there."})]}),e.jsxs("div",{className:"text-sm text-white/52",children:[i.map.length," plotted items"]})]}),e.jsxs("div",{className:"relative min-h-[520px] overflow-hidden rounded-[24px] border border-white/8 bg-[radial-gradient(circle_at_20%_20%,rgba(87,196,138,0.2),transparent_25%),radial-gradient(circle_at_80%_80%,rgba(255,104,130,0.2),transparent_26%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0.01))]",children:[e.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-white/8"}),e.jsx("div",{className:"absolute inset-y-0 left-1/2 w-px bg-white/8"}),i.map.map(t=>e.jsx("button",{type:"button",className:$("absolute -translate-x-1/2 -translate-y-1/2 rounded-full border px-3 py-1 text-xs transition hover:scale-[1.04]",t.itemId===(d==null?void 0:d.itemId)?"border-white/30 bg-white/16 text-white":t.score>=0?"border-emerald-300/30 bg-emerald-500/14 text-emerald-100":"border-rose-300/30 bg-rose-500/14 text-rose-100"),style:{left:`${50+t.x*34}%`,top:`${50-t.y*34}%`,opacity:.45+t.confidence*.55},onClick:()=>{E(t.itemId),k({focusItem:t.itemId})},children:t.label},t.itemId))]})]}):null,S==="table"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.2fr)_380px]",children:[e.jsxs(v,{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:le,onChange:t=>lt(t.target.value),placeholder:"Search learned items, explanations, tags, or dominant dimensions"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-left text-sm",children:[e.jsx("thead",{className:"text-[11px] uppercase tracking-[0.14em] text-white/38",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2",children:"Item"}),e.jsx("th",{className:"px-3 py-2",children:"Score"}),e.jsx("th",{className:"px-3 py-2",children:"Confidence"}),e.jsx("th",{className:"px-3 py-2",children:"Status"}),e.jsx("th",{className:"px-3 py-2",children:"Evidence"})]})}),e.jsx("tbody",{children:pe.map(t=>{var s,l;return e.jsxs("tr",{className:$("cursor-pointer border-t border-white/6 transition hover:bg-white/[0.04]",t.itemId===(d==null?void 0:d.itemId)?"bg-white/[0.05]":""),onClick:()=>{E(t.itemId),k({focusItem:t.itemId})},children:[e.jsxs("td",{className:"px-3 py-3",children:[e.jsx("div",{className:"font-medium text-white",children:((s=t.item)==null?void 0:s.label)??t.itemId}),e.jsx("div",{className:"text-xs text-white/48",children:(((l=t.item)==null?void 0:l.tags)??[]).join(" · ")})]}),e.jsx("td",{className:"px-3 py-3 text-white/68",children:t.latentScore.toFixed(2)}),e.jsx("td",{className:"px-3 py-3 text-white/68",children:B(t.confidence)}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(y,{className:it[re(t)],children:re(t)})}),e.jsx("td",{className:"px-3 py-3 text-white/68",children:t.evidenceCount})]},t.itemId)})})]})})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Item editor"}),d!=null&&d.item?e.jsxs(e.Fragment,{children:[e.jsx(x,{value:p.label,onChange:t=>C(s=>({...s,label:t.target.value})),placeholder:"Item label"}),e.jsx(T,{value:p.description,onChange:t=>C(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"Item description"}),e.jsx(x,{value:p.tags,onChange:t=>C(s=>({...s,tags:t.target.value})),placeholder:"comma, separated, tags"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("select",{value:p.manualStatus,onChange:t=>C(s=>({...s,manualStatus:t.target.value})),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"",children:"Inferred status"}),Object.keys(it).map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(x,{value:p.manualScore,onChange:t=>C(s=>({...s,manualScore:t.target.value})),placeholder:"Manual score"}),e.jsx(x,{value:p.confidenceLock,onChange:t=>C(s=>({...s,confidenceLock:t.target.value})),placeholder:"Confidence lock 0-1"})]}),e.jsx("div",{className:"grid gap-2",children:Object.keys(ie).map(t=>e.jsxs("div",{className:"grid grid-cols-[110px_minmax(0,1fr)] items-center gap-3",children:[e.jsx("div",{className:"text-sm text-white/56",children:ve[t]}),e.jsx(x,{value:p.featureWeights[t],onChange:s=>C(l=>({...l,featureWeights:{...l.featureWeights,[t]:s.target.value}}))})]},t))}),e.jsx("div",{className:"grid gap-2 text-sm text-white/58",children:[["bookmarked","Bookmarked"],["compareLater","Compare later"],["frozen","Frozen"]].map(([t,s])=>e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:p[t],onChange:l=>C(n=>({...n,[t]:l.target.checked}))}),e.jsx("span",{children:s})]},t))}),e.jsx(o,{pending:Ee.isPending,pendingLabel:"Saving item",onClick:()=>void Ee.mutateAsync(),children:"Save item model"}),Re?e.jsx(ue,{className:"text-sm text-[var(--primary)]",to:Re,children:"Open linked entity"}):null]}):e.jsx("div",{className:"text-sm text-white/52",children:"Select a row to inspect or edit it."}),e.jsxs("div",{className:"mt-3 border-t border-white/8 pt-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Add custom item"}),e.jsxs("div",{className:"mt-3 grid gap-3",children:[e.jsx(x,{value:M.label,onChange:t=>Y(s=>({...s,label:t.target.value})),placeholder:"Custom item label"}),e.jsx(T,{value:M.description,onChange:t=>Y(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What is this preference item?"}),e.jsx(x,{value:M.tags,onChange:t=>Y(s=>({...s,tags:t.target.value})),placeholder:"comma, separated, tags"}),e.jsx(o,{disabled:!M.label.trim(),pending:Fe.isPending,pendingLabel:"Creating item",onClick:()=>void Fe.mutateAsync({userId:m,domain:w,label:M.label,description:M.description,tags:M.tags.split(",").map(t=>t.trim()).filter(Boolean),featureWeights:ie,queueForCompare:!0}),children:"Create custom item"})]})]})]})]}):null,S==="history"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-3",children:[e.jsxs(v,{className:"grid gap-3 xl:col-span-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Recent pairwise judgments"}),e.jsx("div",{className:"grid gap-2",children:i.history.judgments.slice(0,12).map(t=>{var n,r,b,G;const s=((r=(n=i.scores.find(O=>O.itemId===t.leftItemId))==null?void 0:n.item)==null?void 0:r.label)??t.leftItemId,l=((G=(b=i.scores.find(O=>O.itemId===t.rightItemId))==null?void 0:b.item)==null?void 0:G.label)??t.rightItemId;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm text-white/58",children:[e.jsxs("div",{className:"font-medium text-white",children:[s," vs ",l]}),e.jsxs("div",{className:"mt-1",children:["Outcome ",t.outcome," · strength"," ",t.strength," ·"," ",new Date(t.createdAt).toLocaleString()]})]},t.id)})})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Signals and snapshots"}),e.jsx("div",{className:"grid gap-2",children:i.history.signals.slice(0,8).map(t=>{var l,n;const s=((n=(l=i.scores.find(r=>r.itemId===t.itemId))==null?void 0:l.item)==null?void 0:n.label)??t.itemId;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-2 text-sm text-white/58",children:[s," · ",t.signalType," ·"," ",new Date(t.createdAt).toLocaleString()]},t.id)})}),e.jsx("div",{className:"grid gap-2",children:i.history.snapshots.slice(0,5).map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-2 text-sm text-white/58",children:["Snapshot ",new Date(t.createdAt).toLocaleString()]},t.id))}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-3 py-3 text-sm text-white/58",children:["Stale items: ",i.history.staleItemIds.length," · Flipped items: ",i.history.flippedItemIds.length]})]})]}):null,S==="contexts"?e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_360px]",children:[e.jsx("div",{className:"grid gap-4",children:i.contexts.map(t=>e.jsxs(v,{className:"grid gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-display text-2xl text-white",children:t.name}),e.jsx("div",{className:"text-sm text-white/54",children:t.description||"No description yet."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.isDefault?e.jsx(y,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:"Default"}):null,e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.shareMode}),t.active?null:e.jsx(y,{className:"bg-amber-500/12 text-amber-200",children:"Inactive"})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-4",children:[e.jsx(x,{value:t.name,onChange:s=>void z.mutateAsync({contextId:t.id,patch:{name:s.target.value}}),placeholder:"Context name"}),e.jsxs("select",{value:t.shareMode,onChange:s=>void z.mutateAsync({contextId:t.id,patch:{shareMode:s.target.value}}),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"shared",children:"shared"}),e.jsx("option",{value:"blended",children:"blended"}),e.jsx("option",{value:"isolated",children:"isolated"})]}),e.jsx(x,{value:String(t.decayDays),onChange:s=>void z.mutateAsync({contextId:t.id,patch:{decayDays:Number(s.target.value||90)}}),placeholder:"Decay days"}),e.jsx(o,{variant:"secondary",onClick:()=>k({contextId:t.id,tab:"overview"}),children:"Open context"})]}),e.jsx(T,{value:t.description,onChange:s=>void z.mutateAsync({contextId:t.id,patch:{description:s.target.value}}),className:"min-h-20"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"secondary",onClick:()=>void z.mutateAsync({contextId:t.id,patch:{active:!t.active}}),children:t.active?"Deactivate":"Activate"}),t.isDefault?null:e.jsx(o,{variant:"secondary",onClick:()=>void z.mutateAsync({contextId:t.id,patch:{isDefault:!0}}),children:"Make default"})]})]},t.id))}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Create context"}),e.jsx(x,{value:I.name,onChange:t=>q(s=>({...s,name:t.target.value})),placeholder:"Context name"}),e.jsx(T,{value:I.description,onChange:t=>q(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What changes in this context?"}),e.jsxs("select",{value:I.shareMode,onChange:t=>q(s=>({...s,shareMode:t.target.value})),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"blended",children:"blended"}),e.jsx("option",{value:"shared",children:"shared"}),e.jsx("option",{value:"isolated",children:"isolated"})]}),e.jsx(x,{value:I.decayDays,onChange:t=>q(s=>({...s,decayDays:t.target.value})),placeholder:"Decay days"}),e.jsx(o,{disabled:!I.name.trim(),pending:_e.isPending,pendingLabel:"Creating context",onClick:()=>void _e.mutateAsync({userId:m,domain:w,name:I.name,description:I.description,shareMode:I.shareMode,decayDays:Number(I.decayDays||90),active:!0,isDefault:!1}),children:"Create context"})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Merge contexts"}),e.jsxs("select",{value:K,onChange:t=>fe(t.target.value),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"",children:"Source context"}),i.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsxs("select",{value:J,onChange:t=>je(t.target.value),className:"min-h-10 rounded-[18px] border border-white/8 bg-white/[0.05] px-3 text-sm text-white outline-none",children:[e.jsx("option",{value:"",children:"Target context"}),i.contexts.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsx(o,{pending:ze.isPending,pendingLabel:"Merging",disabled:!K||!J||K===J,onClick:()=>void ze.mutateAsync({sourceContextId:K,targetContextId:J}),children:"Merge into target"})]})]})]}):null,S==="concepts"?e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_380px]",children:[e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Concept libraries"}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:"These are the lists Forge can use when you start the game in a concept domain. Seeded lists are editable, and custom lists are fully yours."})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-4",children:[["Lists",i.libraries.totalCatalogs],["Concepts",i.libraries.totalCatalogItems],["Seeded",i.libraries.seededCatalogCount],["Custom",i.libraries.customCatalogCount]].map(([t,s])=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:t}),e.jsx("div",{className:"mt-2 font-display text-3xl text-white",children:s})]},t))}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:D,onChange:t=>be(t.target.value),placeholder:"Search lists, concepts, tags, and seeded domains"})]})]}),e.jsxs(v,{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Create concept list"}),e.jsx(x,{value:R.title,onChange:t=>oe(s=>({...s,title:t.target.value})),placeholder:"List title"}),e.jsx(T,{value:R.description,onChange:t=>oe(s=>({...s,description:t.target.value})),className:"min-h-24",placeholder:"What should this list help compare?"}),e.jsx(o,{disabled:!R.title.trim(),pending:Pe.isPending,pendingLabel:"Creating list",onClick:()=>void Pe.mutateAsync({userId:m,domain:w,title:R.title,description:R.description}),children:"Create list"})]})]}),e.jsx("div",{className:"grid gap-4",children:ge.map(t=>{const s=ot[t.id]??{label:"",description:"",tags:""},l=t.items.filter(n=>D.trim()?[n.label,n.description,n.tags.join(" ")].join(" ").toLowerCase().includes(ne(D)):!0);return e.jsxs(v,{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsx("div",{className:"min-w-0",children:Ne===t.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(x,{value:Z.title,onChange:n=>he(r=>({...r,title:n.target.value}))}),e.jsx(T,{value:Z.description,onChange:n=>he(r=>({...r,description:n.target.value})),className:"min-h-24"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"font-display text-2xl text-white",children:t.title}),e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.source}),e.jsxs(y,{className:"bg-white/[0.08] text-white/70",children:[t.items.length," items"]})]}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:t.description||"No description yet."})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"secondary",size:"sm",onClick:()=>void $e(w,t.id),children:"Start from this list"}),Ne===t.id?e.jsxs(e.Fragment,{children:[e.jsx(o,{size:"sm",pending:Le.isPending,pendingLabel:"Saving",onClick:()=>void Le.mutateAsync({catalogId:t.id,patch:{title:Z.title,description:Z.description}}),children:"Save"}),e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>me(null),children:"Cancel"})]}):e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>{me(t.id),he({title:t.title,description:t.description})},children:"Edit list"}),e.jsx(o,{variant:"ghost",size:"sm",pending:Te.isPending,pendingLabel:"Deleting",onClick:()=>void Te.mutateAsync(t.id),children:"Delete list"})]})]}),e.jsx("div",{className:"grid gap-2",children:l.map(n=>e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:mt===n.id?e.jsxs("div",{className:"grid gap-3",children:[e.jsx(x,{value:_.label,onChange:r=>V(b=>({...b,label:r.target.value}))}),e.jsx(T,{value:_.description,onChange:r=>V(b=>({...b,description:r.target.value})),className:"min-h-20"}),e.jsx(x,{value:_.tags,onChange:r=>V(b=>({...b,tags:r.target.value})),placeholder:"comma, separated, tags"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{size:"sm",pending:Ae.isPending,pendingLabel:"Saving",onClick:()=>void Ae.mutateAsync({catalogItemId:n.id,patch:{label:_.label,description:_.description,tags:_.tags.split(",").map(r=>r.trim()).filter(Boolean)}}),children:"Save concept"}),e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>xe(null),children:"Cancel"})]})]}):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-medium text-white",children:n.label}),e.jsx("div",{className:"mt-1 text-sm text-white/54",children:n.description||"No description yet."}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:n.tags.map(r=>e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:r},`${n.id}-${r}`))})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>{xe(n.id),V({label:n.label,description:n.description,tags:n.tags.join(", ")})},children:"Edit"}),e.jsxs(o,{variant:"ghost",size:"sm",pending:De.isPending,pendingLabel:"Deleting",onClick:()=>void De.mutateAsync(n.id),children:[e.jsx(St,{className:"mr-1 size-4"}),"Delete"]})]})]})},n.id))}),e.jsxs("div",{className:"grid gap-3 rounded-[18px] border border-white/8 bg-white/[0.02] px-4 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/68",children:[e.jsx(kt,{className:"size-4"}),"Add concept to ",t.title]}),e.jsx(x,{value:s.label,onChange:n=>X(r=>({...r,[t.id]:{...s,label:n.target.value}})),placeholder:"Concept label"}),e.jsx(T,{value:s.description,onChange:n=>X(r=>({...r,[t.id]:{...s,description:n.target.value}})),className:"min-h-20",placeholder:"Short description"}),e.jsx(x,{value:s.tags,onChange:n=>X(r=>({...r,[t.id]:{...s,tags:n.target.value}})),placeholder:"comma, separated, tags"}),e.jsx(o,{disabled:!s.label.trim(),pending:Me.isPending,pendingLabel:"Adding",onClick:()=>void Me.mutateAsync({catalogId:t.id,label:s.label,description:s.description,tags:s.tags.split(",").map(n=>n.trim()).filter(Boolean),featureWeights:ie}).then(()=>X(n=>({...n,[t.id]:{label:"",description:"",tags:""}}))),children:"Add concept"})]})]},t.id)})})]}):null]}),e.jsx(Pt,{open:f.open,onOpenChange:t=>{t||P(null),F(s=>({...s,open:t}))},children:e.jsxs(Lt,{children:[e.jsx(Tt,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.74)] backdrop-blur-xl"}),e.jsxs(Mt,{className:"fixed inset-x-4 bottom-4 top-4 z-50 overflow-y-auto rounded-[32px] border border-white/10 bg-[linear-gradient(180deg,rgba(17,24,39,0.98),rgba(10,14,24,0.98))] shadow-[0_30px_90px_rgba(3,8,18,0.45)] md:inset-x-10 lg:left-1/2 lg:right-auto lg:w-[min(72rem,calc(100vw-3rem))] lg:-translate-x-1/2",children:[e.jsx(At,{className:"sr-only",children:"Preference game"}),e.jsx(Dt,{className:"sr-only",children:"Start comparison rounds from a Forge domain or concept list."}),e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-4 border-b border-white/8 bg-[rgba(10,14,24,0.92)] px-5 py-4 backdrop-blur-xl",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Preference game"}),e.jsx("div",{className:"mt-1 font-display text-2xl text-white",children:f.phase==="domain"?"Choose a domain":f.phase==="catalog"?"Choose a concept list":"Pick the better fit"})]}),e.jsx(Et,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close preference game",className:"rounded-full bg-white/6 p-2 text-white/65 transition hover:bg-white/10 hover:text-white",children:e.jsx(Ft,{className:"size-4"})})})]}),e.jsxs("div",{className:"grid gap-5 px-5 py-5",children:[we?e.jsx("div",{className:"rounded-[18px] border border-rose-400/25 bg-rose-500/10 px-4 py-3 text-sm text-rose-100",children:we}):null,f.phase==="domain"?e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:ae.map(t=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-white/8 bg-white/[0.04] px-5 py-5 text-left transition hover:border-[var(--primary)]/30 hover:bg-[var(--primary)]/10",onClick:()=>void ut(t.value),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:t.mode==="forge"?"Forge":"Concept"})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:t.description})]},t.value))}):null,f.phase==="catalog"?e.jsxs("div",{className:"grid gap-4",children:[e.jsx("div",{className:"text-sm text-white/58",children:"Pick the concept list Forge should draw from. You do not need to assemble the items yourself."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"size-4 text-white/38"}),e.jsx(x,{value:D,onChange:t=>be(t.target.value),placeholder:"Search concept lists"})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:ge.length>0?ge.map(t=>e.jsxs("button",{type:"button",className:"rounded-[24px] border border-white/8 bg-white/[0.04] px-5 py-5 text-left transition hover:border-[var(--primary)]/30 hover:bg-[var(--primary)]/10",onClick:()=>void $e(f.domain,t.id),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:t.title}),e.jsxs(y,{className:"bg-white/[0.08] text-white/70",children:[t.items.length," items"]})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/56",children:t.description||"No description yet."})]},t.id)):e.jsx("div",{className:"rounded-[24px] bg-white/[0.04] px-5 py-6 text-sm text-white/58",children:"No concept list matches that search yet."})})]}):null,f.phase==="play"?e.jsx("div",{className:"grid gap-5",children:ct||Ie.isLoading?e.jsx(tt,{eyebrow:"Preference game",title:"Preparing the next round",description:"Forge is lining up comparison candidates."}):A?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/52",children:[e.jsx(y,{className:"bg-white/[0.08] text-white/70",children:((Ke=ae.find(t=>t.value===f.domain))==null?void 0:Ke.label)??f.domain}),e.jsx("span",{children:g==null?void 0:g.selectedContext.name}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[(g==null?void 0:g.compare.pendingCount)??0," ","queued comparisons"]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(nt,{title:A.left.label,description:A.left.description,sideLabel:"Left",onClick:()=>void L("left",1)}),e.jsx(nt,{title:A.right.label,description:A.right.description,sideLabel:"Right",onClick:()=>void L("right",1)})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{onClick:()=>void L("left",1),children:"Left"}),e.jsx(o,{onClick:()=>void L("right",1),children:"Right"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("left",1.75),children:"Strong left"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("right",1.75),children:"Strong right"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("tie",1),children:"Tie"}),e.jsx(o,{variant:"secondary",onClick:()=>void L("skip",1),children:"Skip"})]}),e.jsx("div",{className:"grid gap-4 rounded-[24px] border border-white/8 bg-white/[0.03] px-4 py-4 lg:grid-cols-2",children:[A.left,A.right].map(t=>e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsx("div",{className:"text-sm text-white/56",children:"Quick signals"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ns.map(s=>e.jsx(o,{variant:"secondary",size:"sm",onClick:()=>void vt(t.id,s.signalType),children:s.label},`${t.id}-${s.signalType}`))})]},t.id))})]}):e.jsx(et,{eyebrow:"Preference game",title:"No pair is ready yet",description:"Forge needs more items in this domain before it can keep asking comparisons."})}):null]})]})]})})]})}export{js as PreferencesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./vendor-DHkYh85p.js";import{Z as l}from"./index-
|
|
1
|
+
import{j as i}from"./vendor-DHkYh85p.js";import{Z as l}from"./index-CF4J4R9L.js";const r={active:"Active",paused:"Suspended",completed:"Finished",all:"All"};function d({value:e,counts:t,onChange:s,className:o}){return i.jsx("div",{className:l("flex flex-wrap gap-2",o),children:Object.keys(r).map(n=>{const a=n===e;return i.jsxs("button",{type:"button",onClick:()=>s(n),className:l("inline-flex min-h-10 items-center gap-2 rounded-full border px-4 py-2 text-sm transition",a?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.16)] text-white shadow-[0_16px_36px_rgba(8,12,24,0.18)]":"border-white/8 bg-white/[0.04] text-white/62 hover:bg-white/[0.08] hover:text-white"),children:[i.jsx("span",{children:r[n]}),i.jsx("span",{className:l("rounded-full px-2 py-0.5 text-[11px]",a?"bg-white/12 text-white/88":"bg-white/8 text-white/54"),children:t[n]})]},n)})})}function h(e){return{active:e.filter(t=>t.status==="active").length,paused:e.filter(t=>t.status==="paused").length,completed:e.filter(t=>t.status==="completed").length,all:e.length}}function x(e,t){return t==="all"?e:e.filter(s=>s.status===t)}export{d as P,h as b,x as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cc as ee,b5 as te,r as k,j as e,aC as j}from"./vendor-DHkYh85p.js";import{j as se,i as F,k as w}from"./state-B-4sS1xO.js";import{S as ae}from"./scheduling-rules-editor-BHOpHOrV.js";import{P as ie,u as re,s as oe,i as y,ay as ne,at as ce,bO as le,bP as de,as as pe,E as me,S as xe,a8 as je,b as v,V as ue,U,C as u,B as m,c as h,Y as he,az as ge,bQ as we,N as ye}from"./index-BHTUu_4M.js";import{O as ve}from"./open-in-graph-button-Cg5VrKsC.js";import{P as fe}from"./project-management-section-nav-C2Ud8Zdd.js";import{e as be,W as ke}from"./calendar-rules-DA1g3QUk.js";import{E as Ne}from"./execution-board-CDRXQB85.js";import{N as H}from"./note-markdown-DiW2-5d3.js";import{E as Ie}from"./entity-notes-surface-DgEgicaE.js";import{P as De}from"./preference-entity-handoff-button-D4WAs9pC.js";import{P as Se}from"./page-hero-CQWo1Mm_.js";import{g as Pe,a as qe}from"./activity-copy-Bj4h9OcF.js";import{g as Qe}from"./entity-links-DwpxhW2H.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";import"./entity-note-count-link-BmGDB572.js";import"./floating-action-menu-CJkI2iFy.js";import"./note-tags-input-DDLXf54U.js";function Te(a){return!!(a&&a.startsWith("campaign:"))}function et(){var M;const{t:a}=ie(),i=re(),N=Array.isArray(i.selectedUserIds)?i.selectedUserIds:[],o=ee(),K=te(),r=se(),[W,C]=k.useState(!1),[G,E]=k.useState(!1),[_,R]=k.useState(!1),[I]=k.useState(()=>{const t=new Date,l=new Date(t);l.setHours(0,0,0,0);const $=new Date(t);return $.setHours(23,59,59,999),{from:l.toISOString(),to:$.toISOString()}}),D=oe(N),c=i.snapshot.dashboard.projects.find(t=>t.id===o.projectId)??null,A=c?i.snapshot.goals.find(t=>t.id===c.goalId)??null:null,O=c?i.snapshot.tasks.filter(t=>t.projectId===c.id||!t.projectId&&t.goalId===c.goalId):[],B=new Set(O.map(t=>t.id)),z=c?i.snapshot.activity.filter(t=>t.entityId===c.goalId||t.entityId===c.id||B.has(t.entityId)||t.entityType==="task_run"&&typeof t.metadata.taskId=="string"&&B.has(t.metadata.taskId)):[],n=Te(o.projectId),f=F({queryKey:["project-board",o.projectId],queryFn:()=>we(o.projectId),enabled:!!o.projectId&&!n}),V=F({queryKey:["project-calendar-overview",o.projectId,I.from,I.to,...N],queryFn:()=>ye({...I,userIds:N}),enabled:!!o.projectId&&!n}),Y=w({mutationFn:t=>ne(t),onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]})])}}),L=w({mutationFn:ce,onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]}),r.invalidateQueries({queryKey:["forge-xp-metrics"]}),r.invalidateQueries({queryKey:["forge-reward-ledger"]}),r.invalidateQueries({queryKey:["forge-operator-context"]})])}}),g=w({mutationFn:t=>le(o.projectId,{status:t}),onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]}),r.invalidateQueries({queryKey:["forge-xp-metrics"]}),r.invalidateQueries({queryKey:["forge-reward-ledger"]}),r.invalidateQueries({queryKey:["forge-operator-context"]})])}}),S=w({mutationFn:()=>de(o.projectId),onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]})]),K("/projects")}}),J=w({mutationFn:t=>pe(t),onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]}),r.invalidateQueries({queryKey:["task-context"]})])}}),s=f.data??(c&&A?{project:c,goal:A,tasks:O,activity:z}:void 0),b=i.snapshot.dashboard.projects.find(t=>t.id===o.projectId)??null;if(f.isError&&!n)return e.jsx(me,{eyebrow:a("common.projectDetail.errorEyebrow"),error:f.error,onRetry:()=>void f.refetch()});if(!s)return e.jsx(xe,{});const d=s.tasks.find(t=>t.status==="focus"||t.status==="in_progress")??s.tasks[0]??null,p=s.tasks.find(t=>t.status==="blocked")??s.tasks.find(t=>t.status==="backlog")??null;s.activity[0];const X="notesSummaryByEntity"in s?s.notesSummaryByEntity:i.snapshot.dashboard.notesSummaryByEntity,P=g.isPending||S.isPending,x=be({rules:s.project.schedulingRules,overview:(M=V.data)==null?void 0:M.calendar}),q=i.snapshot.strategies.filter(t=>t.targetGoalIds.includes(s.goal.id)),Q=i.snapshot.strategies.filter(t=>t.targetProjectIds.includes(s.project.id)),T=async t=>{await g.mutateAsync(t)},Z=async()=>{window.confirm(a("common.projectDetail.deleteProjectConfirm",{title:s.project.title}))&&await S.mutateAsync()};return e.jsxs("div",{className:"grid min-w-0 gap-5",children:[e.jsx(fe,{}),e.jsx(Se,{entityKind:"project",title:e.jsx(ue,{kind:"project",label:s.project.title,variant:"heading",size:"lg"}),titleText:s.project.title,description:s.project.description?e.jsx(H,{markdown:s.project.description,className:"[&>p]:text-[13px] [&>p]:leading-6 [&>blockquote]:text-[13px] [&>ul]:text-[13px] [&>ol]:text-[13px]"}):"No project description yet.",badge:e.jsx(v,{kind:"goal",label:s.goal.title,compact:!0,gradient:!1}),actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(je,{metrics:i.snapshot.metrics}),e.jsx(De,{userId:D,domain:"projects",entityType:"project",entityId:s.project.id,label:s.project.title,description:s.project.description}),e.jsx(ve,{entityType:"project",entityId:s.project.id})]})}),s.project.user?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/62",children:[e.jsx("span",{className:"text-white/42",children:"Owned by"}),e.jsx(U,{user:s.project.user}),s.project.assignees&&s.project.assignees.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-white/35",children:"Assigned with"}),e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.project.assignees.map(t=>e.jsx(U,{user:t,compact:!0},t.id))})]}):null]}):null,s.project.productRequirementsDocument?e.jsxs(u,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Product requirements document"}),e.jsx("div",{className:"mt-3",children:e.jsx(H,{markdown:s.project.productRequirementsDocument,className:"[&>p]:text-[13px] [&>p]:leading-6 [&>blockquote]:text-[13px] [&>ul]:text-[13px] [&>ol]:text-[13px]"})})]}):null,q.length>0||Q.length>0?e.jsxs(u,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Strategy stack"}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-white/42",children:"Goal-level strategies"}),q.length===0?e.jsx("div",{className:"text-sm text-white/48",children:"No goal-level strategies linked yet."}):q.map(t=>e.jsxs(j,{to:`/strategies/${t.id}`,className:"rounded-[18px] border border-white/8 bg-white/[0.04] px-4 py-3 transition hover:bg-white/[0.07]",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx("div",{className:"mt-1 text-xs text-white/48",children:t.overview||t.endStateDescription})]},t.id))]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-white/42",children:"Project-level strategies"}),Q.length===0?e.jsx("div",{className:"text-sm text-white/48",children:"No lower-level strategies linked yet."}):Q.map(t=>e.jsxs(j,{to:`/strategies/${t.id}`,className:"rounded-[18px] border border-white/8 bg-white/[0.04] px-4 py-3 transition hover:bg-white/[0.07]",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx("div",{className:"mt-1 text-xs text-white/48",children:t.overview||t.endStateDescription})]},t.id))]})]})]}):null,n?e.jsxs(u,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.projectDetail.compatibility")}),e.jsx("p",{className:"mt-3 text-sm leading-7 text-white/60",children:a("common.projectDetail.compatibilityDescription")})]}):null,e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(m,{onClick:()=>E(!0),children:a("common.projectDetail.addTask")}),n?null:e.jsx(m,{variant:"secondary",onClick:()=>R(!0),children:"Adjust work"}),n?null:e.jsx(m,{variant:"secondary",onClick:()=>C(!0),children:a("common.projectDetail.editProject")}),!n&&s.project.status==="active"?e.jsx(m,{variant:"secondary",pending:P&&g.variables==="paused",pendingLabel:a("common.projectDetail.suspending"),onClick:()=>void T("paused"),children:a("common.projectDetail.suspendProject")}):null,!n&&s.project.status!=="completed"?e.jsx(m,{pending:P&&g.variables==="completed",pendingLabel:a("common.projectDetail.finishing"),onClick:()=>void T("completed"),children:a("common.projectDetail.finishProject")}):null,!n&&s.project.status!=="active"?e.jsx(m,{variant:"secondary",pending:P&&g.variables==="active",pendingLabel:a("common.projectDetail.restarting"),onClick:()=>void T("active"),children:a("common.projectDetail.restartProject")}):null,n?null:e.jsx(m,{variant:"ghost",pending:S.isPending,pendingLabel:a("common.projectDetail.deleting"),onClick:()=>void Z(),children:a("common.projectDetail.deleteProject")}),e.jsx(j,{to:`/goals/${s.goal.id}`,children:e.jsx(m,{variant:"ghost",children:a("common.projectDetail.openGoal")})})]}),e.jsxs("section",{className:"grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1fr)_22rem]",children:[e.jsxs(u,{children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.projectDetail.commandEyebrow")}),e.jsx("h2",{className:"mt-2 font-display text-[clamp(1.35rem,2vw,1.9rem)] text-white",children:a("common.projectDetail.commandTitle")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:a("common.projectDetail.commandDescription")})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(v,{kind:"project",compact:!0,gradient:!1}),e.jsx(v,{kind:"goal",label:s.goal.title,compact:!0,gradient:!1})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:[e.jsxs(j,{to:d?`/tasks/${d.id}`:`/projects/${s.project.id}`,className:"rounded-[20px] bg-white/[0.04] p-4 transition hover:bg-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:a("common.projectDetail.signalNext")}),d?e.jsx(v,{kind:"task",compact:!0,gradient:!1}):null]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(d==null?void 0:d.title)??a("common.projectDetail.noNextTask")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:(d==null?void 0:d.description)||a("common.projectDetail.noNextTaskDetail")})]}),e.jsxs(j,{to:p?`/tasks/${p.id}`:`/projects/${s.project.id}`,className:"rounded-[20px] bg-white/[0.04] p-4 transition hover:bg-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:a("common.projectDetail.signalRisk")}),p?e.jsx(v,{kind:"task",compact:!0,gradient:!1}):null]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(p==null?void 0:p.title)??a("common.projectDetail.noRisk")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:(p==null?void 0:p.description)||a("common.projectDetail.noRiskDetail")})]})]})]}),e.jsxs(u,{className:"h-fit min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.projectDetail.sectionHealth")}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:a(`common.enums.projectStatus.${s.project.status}`)}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:s.project.momentumLabel}),e.jsxs(h,{className:"bg-white/[0.08] text-white/72",children:[Math.floor(s.project.time.totalCreditedSeconds/60)," min tracked"]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:a("common.projectDetail.fieldProgress")}),e.jsxs("div",{className:"mt-2 font-display text-xl text-white",children:[s.project.progress,"%"]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:a("common.projectDetail.fieldMomentum")}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:s.project.momentumLabel})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:a("common.projectDetail.fieldStatus")}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:a(`common.enums.projectStatus.${s.project.status}`)})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Live tasks"}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:s.tasks.filter(t=>t.status==="focus"||t.status==="in_progress").length})]})]})]})]}),n?null:e.jsxs("section",{className:"grid gap-5 xl:grid-cols-[minmax(0,1fr)_22rem]",children:[e.jsx(ae,{title:"Project scheduling defaults",subtitle:"Define the calendar contexts where work from this project is allowed or blocked. Tasks can inherit these defaults or override them.",initialRules:s.project.schedulingRules,saveLabel:"Save project scheduling",onSave:async({schedulingRules:t})=>{await i.patchProject(s.project.id,{schedulingRules:t}),await r.invalidateQueries({queryKey:["project-board",o.projectId]}),await r.invalidateQueries({queryKey:["project-calendar-overview",o.projectId]})}}),e.jsxs(u,{className:"h-fit min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Calendar status"}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(h,{className:x.tone==="blocked"?"bg-rose-500/14 text-rose-100":x.tone==="waiting"?"bg-amber-500/14 text-amber-100":"bg-emerald-500/14 text-emerald-100",children:x.label}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:"Project defaults"})]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-white/58",children:"These rules act as the default calendar gate for every task in the project unless a task sets its own override."}),x.context.length>0?e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Current context"}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:x.context.map(t=>e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:t},t))})]}):null,x.conflicts.length>0?e.jsx("div",{className:"mt-4 grid gap-2",children:x.conflicts.map(t=>e.jsx("div",{className:"rounded-[16px] bg-rose-500/10 px-3 py-2 text-sm text-rose-100",children:t},t))}):null,e.jsx("div",{className:"mt-4",children:e.jsx(j,{to:"/calendar",children:e.jsx(m,{variant:"secondary",children:"Open calendar workspace"})})})]})]}),e.jsx(Ne,{tasks:s.tasks,activeRuns:i.snapshot.activeTaskRuns,goals:i.snapshot.goals,tags:i.snapshot.tags,notesSummaryByEntity:X,selectedTaskId:null,onMove:async(t,l)=>{await i.patchTaskStatus(t,l),await r.invalidateQueries({queryKey:["project-board",o.projectId]})},onSelectTask:t=>K(`/tasks/${t}`),onStopTask:async t=>{await i.stopTaskRun(t),await r.invalidateQueries({queryKey:["project-board",o.projectId]}),await r.invalidateQueries({queryKey:["task-context",t.taskId]})},onQuickReopenTask:async t=>{await Y.mutateAsync(t)},onDeleteTask:async t=>{await J.mutateAsync(t)}}),n?null:e.jsx(Ie,{entityType:"project",entityId:s.project.id,title:"Project notes",description:"Keep rollout notes, checkpoints, and cross-task context attached to the project itself.",invalidateQueryKeys:[["project-board",o.projectId]]}),e.jsxs(u,{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.projectDetail.sectionEvidence")}),e.jsx("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:s.activity.slice(0,6).map(t=>e.jsxs(j,{to:Qe(t)??`/activity?eventId=${t.id}`,className:"rounded-[18px] bg-white/[0.04] p-4 transition hover:bg-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:Pe(t)}),e.jsx(h,{children:t.source})]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:qe(t)})]},t.id))})]}),e.jsx(he,{open:W,goals:i.snapshot.goals,users:i.snapshot.users,editingProject:b,defaultUserId:(b==null?void 0:b.userId)??D,onOpenChange:C,onSubmit:async(t,l)=>{l&&(await i.patchProject(l,t),await r.invalidateQueries({queryKey:["project-board",o.projectId]}))}}),e.jsx(ge,{open:G,goals:i.snapshot.goals,projects:i.snapshot.dashboard.projects,workItems:i.snapshot.workItems,tags:i.snapshot.tags,users:i.snapshot.users,editingTask:null,initialProjectId:n?null:s.project.id,defaultUserId:s.project.userId??D,onRefreshEntities:i.refresh,onOpenChange:E,onSubmit:async(t,l)=>{l?await i.patchTask(l,t):await i.createTask(t),await r.invalidateQueries({queryKey:["project-board",o.projectId]})}}),n?null:e.jsx(ke,{open:_,onOpenChange:R,entityType:"project",entityId:s.project.id,targetLabel:s.project.title,currentCreditedSeconds:s.project.time.totalCreditedSeconds,pending:L.isPending,onSubmit:async t=>{await L.mutateAsync(t)}})]})}export{et as ProjectDetailPage};
|
|
1
|
+
import{cc as ee,b5 as te,r as k,j as e,aC as j}from"./vendor-DHkYh85p.js";import{j as se,i as F,k as w}from"./state-B-4sS1xO.js";import{S as ae}from"./scheduling-rules-editor-D02s70hr.js";import{P as ie,u as re,s as oe,i as y,ay as ne,at as ce,bO as le,bP as de,as as pe,E as me,S as xe,a8 as je,b as v,V as ue,U,C as u,B as m,c as h,Y as he,az as ge,bQ as we,N as ye}from"./index-CF4J4R9L.js";import{O as ve}from"./open-in-graph-button-IXe9SGth.js";import{P as fe}from"./project-management-section-nav-P3ixzPa-.js";import{e as be,W as ke}from"./calendar-rules-DNJFNsxi.js";import{E as Ne}from"./execution-board-D07gOocB.js";import{N as H}from"./note-markdown-N-uxD3Xt.js";import{E as Ie}from"./entity-notes-surface-CkcRsKJQ.js";import{P as De}from"./preference-entity-handoff-button-5PzUn42S.js";import{P as Se}from"./page-hero-DRy5b2MU.js";import{g as Pe,a as qe}from"./activity-copy-Bj4h9OcF.js";import{g as Qe}from"./entity-links-DwpxhW2H.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";import"./entity-note-count-link-DrhjJZ4i.js";import"./floating-action-menu-Fs_ZiUMo.js";import"./note-tags-input-Cdu7wiw6.js";function Te(a){return!!(a&&a.startsWith("campaign:"))}function et(){var M;const{t:a}=ie(),i=re(),N=Array.isArray(i.selectedUserIds)?i.selectedUserIds:[],o=ee(),K=te(),r=se(),[W,C]=k.useState(!1),[G,E]=k.useState(!1),[_,R]=k.useState(!1),[I]=k.useState(()=>{const t=new Date,l=new Date(t);l.setHours(0,0,0,0);const $=new Date(t);return $.setHours(23,59,59,999),{from:l.toISOString(),to:$.toISOString()}}),D=oe(N),c=i.snapshot.dashboard.projects.find(t=>t.id===o.projectId)??null,A=c?i.snapshot.goals.find(t=>t.id===c.goalId)??null:null,O=c?i.snapshot.tasks.filter(t=>t.projectId===c.id||!t.projectId&&t.goalId===c.goalId):[],B=new Set(O.map(t=>t.id)),z=c?i.snapshot.activity.filter(t=>t.entityId===c.goalId||t.entityId===c.id||B.has(t.entityId)||t.entityType==="task_run"&&typeof t.metadata.taskId=="string"&&B.has(t.metadata.taskId)):[],n=Te(o.projectId),f=F({queryKey:["project-board",o.projectId],queryFn:()=>we(o.projectId),enabled:!!o.projectId&&!n}),V=F({queryKey:["project-calendar-overview",o.projectId,I.from,I.to,...N],queryFn:()=>ye({...I,userIds:N}),enabled:!!o.projectId&&!n}),Y=w({mutationFn:t=>ne(t),onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]})])}}),L=w({mutationFn:ce,onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]}),r.invalidateQueries({queryKey:["forge-xp-metrics"]}),r.invalidateQueries({queryKey:["forge-reward-ledger"]}),r.invalidateQueries({queryKey:["forge-operator-context"]})])}}),g=w({mutationFn:t=>le(o.projectId,{status:t}),onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]}),r.invalidateQueries({queryKey:["forge-xp-metrics"]}),r.invalidateQueries({queryKey:["forge-reward-ledger"]}),r.invalidateQueries({queryKey:["forge-operator-context"]})])}}),S=w({mutationFn:()=>de(o.projectId),onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]})]),K("/projects")}}),J=w({mutationFn:t=>pe(t),onSuccess:async()=>{await Promise.all([y(r),r.invalidateQueries({queryKey:["project-board",o.projectId]}),r.invalidateQueries({queryKey:["task-context"]})])}}),s=f.data??(c&&A?{project:c,goal:A,tasks:O,activity:z}:void 0),b=i.snapshot.dashboard.projects.find(t=>t.id===o.projectId)??null;if(f.isError&&!n)return e.jsx(me,{eyebrow:a("common.projectDetail.errorEyebrow"),error:f.error,onRetry:()=>void f.refetch()});if(!s)return e.jsx(xe,{});const d=s.tasks.find(t=>t.status==="focus"||t.status==="in_progress")??s.tasks[0]??null,p=s.tasks.find(t=>t.status==="blocked")??s.tasks.find(t=>t.status==="backlog")??null;s.activity[0];const X="notesSummaryByEntity"in s?s.notesSummaryByEntity:i.snapshot.dashboard.notesSummaryByEntity,P=g.isPending||S.isPending,x=be({rules:s.project.schedulingRules,overview:(M=V.data)==null?void 0:M.calendar}),q=i.snapshot.strategies.filter(t=>t.targetGoalIds.includes(s.goal.id)),Q=i.snapshot.strategies.filter(t=>t.targetProjectIds.includes(s.project.id)),T=async t=>{await g.mutateAsync(t)},Z=async()=>{window.confirm(a("common.projectDetail.deleteProjectConfirm",{title:s.project.title}))&&await S.mutateAsync()};return e.jsxs("div",{className:"grid min-w-0 gap-5",children:[e.jsx(fe,{}),e.jsx(Se,{entityKind:"project",title:e.jsx(ue,{kind:"project",label:s.project.title,variant:"heading",size:"lg"}),titleText:s.project.title,description:s.project.description?e.jsx(H,{markdown:s.project.description,className:"[&>p]:text-[13px] [&>p]:leading-6 [&>blockquote]:text-[13px] [&>ul]:text-[13px] [&>ol]:text-[13px]"}):"No project description yet.",badge:e.jsx(v,{kind:"goal",label:s.goal.title,compact:!0,gradient:!1}),actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(je,{metrics:i.snapshot.metrics}),e.jsx(De,{userId:D,domain:"projects",entityType:"project",entityId:s.project.id,label:s.project.title,description:s.project.description}),e.jsx(ve,{entityType:"project",entityId:s.project.id})]})}),s.project.user?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-white/62",children:[e.jsx("span",{className:"text-white/42",children:"Owned by"}),e.jsx(U,{user:s.project.user}),s.project.assignees&&s.project.assignees.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-white/35",children:"Assigned with"}),e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.project.assignees.map(t=>e.jsx(U,{user:t,compact:!0},t.id))})]}):null]}):null,s.project.productRequirementsDocument?e.jsxs(u,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Product requirements document"}),e.jsx("div",{className:"mt-3",children:e.jsx(H,{markdown:s.project.productRequirementsDocument,className:"[&>p]:text-[13px] [&>p]:leading-6 [&>blockquote]:text-[13px] [&>ul]:text-[13px] [&>ol]:text-[13px]"})})]}):null,q.length>0||Q.length>0?e.jsxs(u,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Strategy stack"}),e.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-white/42",children:"Goal-level strategies"}),q.length===0?e.jsx("div",{className:"text-sm text-white/48",children:"No goal-level strategies linked yet."}):q.map(t=>e.jsxs(j,{to:`/strategies/${t.id}`,className:"rounded-[18px] border border-white/8 bg-white/[0.04] px-4 py-3 transition hover:bg-white/[0.07]",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx("div",{className:"mt-1 text-xs text-white/48",children:t.overview||t.endStateDescription})]},t.id))]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.16em] text-white/42",children:"Project-level strategies"}),Q.length===0?e.jsx("div",{className:"text-sm text-white/48",children:"No lower-level strategies linked yet."}):Q.map(t=>e.jsxs(j,{to:`/strategies/${t.id}`,className:"rounded-[18px] border border-white/8 bg-white/[0.04] px-4 py-3 transition hover:bg-white/[0.07]",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:t.title}),e.jsx("div",{className:"mt-1 text-xs text-white/48",children:t.overview||t.endStateDescription})]},t.id))]})]})]}):null,n?e.jsxs(u,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.projectDetail.compatibility")}),e.jsx("p",{className:"mt-3 text-sm leading-7 text-white/60",children:a("common.projectDetail.compatibilityDescription")})]}):null,e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(m,{onClick:()=>E(!0),children:a("common.projectDetail.addTask")}),n?null:e.jsx(m,{variant:"secondary",onClick:()=>R(!0),children:"Adjust work"}),n?null:e.jsx(m,{variant:"secondary",onClick:()=>C(!0),children:a("common.projectDetail.editProject")}),!n&&s.project.status==="active"?e.jsx(m,{variant:"secondary",pending:P&&g.variables==="paused",pendingLabel:a("common.projectDetail.suspending"),onClick:()=>void T("paused"),children:a("common.projectDetail.suspendProject")}):null,!n&&s.project.status!=="completed"?e.jsx(m,{pending:P&&g.variables==="completed",pendingLabel:a("common.projectDetail.finishing"),onClick:()=>void T("completed"),children:a("common.projectDetail.finishProject")}):null,!n&&s.project.status!=="active"?e.jsx(m,{variant:"secondary",pending:P&&g.variables==="active",pendingLabel:a("common.projectDetail.restarting"),onClick:()=>void T("active"),children:a("common.projectDetail.restartProject")}):null,n?null:e.jsx(m,{variant:"ghost",pending:S.isPending,pendingLabel:a("common.projectDetail.deleting"),onClick:()=>void Z(),children:a("common.projectDetail.deleteProject")}),e.jsx(j,{to:`/goals/${s.goal.id}`,children:e.jsx(m,{variant:"ghost",children:a("common.projectDetail.openGoal")})})]}),e.jsxs("section",{className:"grid min-w-0 gap-5 xl:grid-cols-[minmax(0,1fr)_22rem]",children:[e.jsxs(u,{children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.projectDetail.commandEyebrow")}),e.jsx("h2",{className:"mt-2 font-display text-[clamp(1.35rem,2vw,1.9rem)] text-white",children:a("common.projectDetail.commandTitle")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-white/60",children:a("common.projectDetail.commandDescription")})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(v,{kind:"project",compact:!0,gradient:!1}),e.jsx(v,{kind:"goal",label:s.goal.title,compact:!0,gradient:!1})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:[e.jsxs(j,{to:d?`/tasks/${d.id}`:`/projects/${s.project.id}`,className:"rounded-[20px] bg-white/[0.04] p-4 transition hover:bg-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:a("common.projectDetail.signalNext")}),d?e.jsx(v,{kind:"task",compact:!0,gradient:!1}):null]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(d==null?void 0:d.title)??a("common.projectDetail.noNextTask")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:(d==null?void 0:d.description)||a("common.projectDetail.noNextTaskDetail")})]}),e.jsxs(j,{to:p?`/tasks/${p.id}`:`/projects/${s.project.id}`,className:"rounded-[20px] bg-white/[0.04] p-4 transition hover:bg-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:a("common.projectDetail.signalRisk")}),p?e.jsx(v,{kind:"task",compact:!0,gradient:!1}):null]}),e.jsx("div",{className:"mt-2 font-medium text-white",children:(p==null?void 0:p.title)??a("common.projectDetail.noRisk")}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:(p==null?void 0:p.description)||a("common.projectDetail.noRiskDetail")})]})]})]}),e.jsxs(u,{className:"h-fit min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.projectDetail.sectionHealth")}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:a(`common.enums.projectStatus.${s.project.status}`)}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:s.project.momentumLabel}),e.jsxs(h,{className:"bg-white/[0.08] text-white/72",children:[Math.floor(s.project.time.totalCreditedSeconds/60)," min tracked"]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:a("common.projectDetail.fieldProgress")}),e.jsxs("div",{className:"mt-2 font-display text-xl text-white",children:[s.project.progress,"%"]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:a("common.projectDetail.fieldMomentum")}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:s.project.momentumLabel})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:a("common.projectDetail.fieldStatus")}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:a(`common.enums.projectStatus.${s.project.status}`)})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/42",children:"Live tasks"}),e.jsx("div",{className:"mt-2 font-display text-xl text-white",children:s.tasks.filter(t=>t.status==="focus"||t.status==="in_progress").length})]})]})]})]}),n?null:e.jsxs("section",{className:"grid gap-5 xl:grid-cols-[minmax(0,1fr)_22rem]",children:[e.jsx(ae,{title:"Project scheduling defaults",subtitle:"Define the calendar contexts where work from this project is allowed or blocked. Tasks can inherit these defaults or override them.",initialRules:s.project.schedulingRules,saveLabel:"Save project scheduling",onSave:async({schedulingRules:t})=>{await i.patchProject(s.project.id,{schedulingRules:t}),await r.invalidateQueries({queryKey:["project-board",o.projectId]}),await r.invalidateQueries({queryKey:["project-calendar-overview",o.projectId]})}}),e.jsxs(u,{className:"h-fit min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Calendar status"}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(h,{className:x.tone==="blocked"?"bg-rose-500/14 text-rose-100":x.tone==="waiting"?"bg-amber-500/14 text-amber-100":"bg-emerald-500/14 text-emerald-100",children:x.label}),e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:"Project defaults"})]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-white/58",children:"These rules act as the default calendar gate for every task in the project unless a task sets its own override."}),x.context.length>0?e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-white/40",children:"Current context"}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:x.context.map(t=>e.jsx(h,{className:"bg-white/[0.08] text-white/72",children:t},t))})]}):null,x.conflicts.length>0?e.jsx("div",{className:"mt-4 grid gap-2",children:x.conflicts.map(t=>e.jsx("div",{className:"rounded-[16px] bg-rose-500/10 px-3 py-2 text-sm text-rose-100",children:t},t))}):null,e.jsx("div",{className:"mt-4",children:e.jsx(j,{to:"/calendar",children:e.jsx(m,{variant:"secondary",children:"Open calendar workspace"})})})]})]}),e.jsx(Ne,{tasks:s.tasks,activeRuns:i.snapshot.activeTaskRuns,goals:i.snapshot.goals,tags:i.snapshot.tags,notesSummaryByEntity:X,selectedTaskId:null,onMove:async(t,l)=>{await i.patchTaskStatus(t,l),await r.invalidateQueries({queryKey:["project-board",o.projectId]})},onSelectTask:t=>K(`/tasks/${t}`),onStopTask:async t=>{await i.stopTaskRun(t),await r.invalidateQueries({queryKey:["project-board",o.projectId]}),await r.invalidateQueries({queryKey:["task-context",t.taskId]})},onQuickReopenTask:async t=>{await Y.mutateAsync(t)},onDeleteTask:async t=>{await J.mutateAsync(t)}}),n?null:e.jsx(Ie,{entityType:"project",entityId:s.project.id,title:"Project notes",description:"Keep rollout notes, checkpoints, and cross-task context attached to the project itself.",invalidateQueryKeys:[["project-board",o.projectId]]}),e.jsxs(u,{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:a("common.projectDetail.sectionEvidence")}),e.jsx("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:s.activity.slice(0,6).map(t=>e.jsxs(j,{to:Qe(t)??`/activity?eventId=${t.id}`,className:"rounded-[18px] bg-white/[0.04] p-4 transition hover:bg-white/[0.08]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-white",children:Pe(t)}),e.jsx(h,{children:t.source})]}),e.jsx("div",{className:"mt-2 text-sm text-white/58",children:qe(t)})]},t.id))})]}),e.jsx(he,{open:W,goals:i.snapshot.goals,users:i.snapshot.users,editingProject:b,defaultUserId:(b==null?void 0:b.userId)??D,onOpenChange:C,onSubmit:async(t,l)=>{l&&(await i.patchProject(l,t),await r.invalidateQueries({queryKey:["project-board",o.projectId]}))}}),e.jsx(ge,{open:G,goals:i.snapshot.goals,projects:i.snapshot.dashboard.projects,workItems:i.snapshot.workItems,tags:i.snapshot.tags,users:i.snapshot.users,editingTask:null,initialProjectId:n?null:s.project.id,defaultUserId:s.project.userId??D,onRefreshEntities:i.refresh,onOpenChange:E,onSubmit:async(t,l)=>{l?await i.patchTask(l,t):await i.createTask(t),await r.invalidateQueries({queryKey:["project-board",o.projectId]})}}),n?null:e.jsx(ke,{open:_,onOpenChange:R,entityType:"project",entityId:s.project.id,targetLabel:s.project.title,currentCreditedSeconds:s.project.time.totalCreditedSeconds,pending:L.isPending,onSubmit:async t=>{await L.mutateAsync(t)}})]})}export{et as ProjectDetailPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as s,cz as X,cx as Y,cA as Z,aC as J,aK as ee,b3 as se}from"./vendor-DHkYh85p.js";import{i as te}from"./state-B-4sS1xO.js";import{u as ae,c as v,U as R,b as D,L as re,E as ie,C as O,B,m as A,a as ne,aR as le,Z as F,bR as de}from"./index-BHTUu_4M.js";import{P as ce}from"./project-management-section-nav-C2Ud8Zdd.js";import{P as oe}from"./page-hero-CQWo1Mm_.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const $={user:"user:",kind:"kind:"},q=["goal","strategy","project","issue","task","subtask"],L=[...q],P=["active","paused","completed","backlog","focus","in_progress","blocked","done"];function I(t){return t.trim().toLowerCase()}function ue(t){return t.reduce((i,n)=>{if(n.startsWith($.user))i.userIds.push(n.slice($.user.length));else if(n.startsWith($.kind)){const o=n.slice($.kind.length);(o==="human"||o==="bot")&&i.kinds.push(o)}return i},{userIds:[],kinds:[]})}function he(t,i){return`${i}:${I(t)}`}function pe(t){const i=t.trim();return i.length===0?[]:["any",...q].map(n=>({id:he(i,n),query:i,kind:n}))}function ge(t){switch(t){case"done":case"completed":return 1;case"in_progress":case"active":return .66;case"focus":return .45;case"blocked":return .5;case"paused":return .28;default:return .08}}function C(t,i){const n=t.replace(/\s+/g," ").trim();return n.length===0?i:n}function M(t){const i=(t.children??[]).map(M);if(t.kind==="project")return{...t,children:i,progressPercent:t.progressPercent,progressLabel:t.progressLabel??(typeof t.progressPercent=="number"?`${t.progressPercent}% complete`:null)};if(i.length>0){const o=i.map(p=>p.progressPercent).filter(p=>typeof p=="number");if(o.length>0){const p=Math.round(o.reduce((j,h)=>j+h,0)/o.length);return{...t,children:i,progressPercent:p,progressLabel:`${i.length} child item${i.length===1?"":"s"}`}}}const n=Math.round(ge(t.statusLabel)*100);return{...t,children:i,progressPercent:n,progressLabel:t.statusLabel?t.statusLabel.replaceAll("_"," "):null}}function V(t){const{goals:i,strategies:n,projects:o,workItems:p,tagNameById:j}=t,h=new Map,f=new Map,g=new Map;for(const e of p)if(e.parentWorkItemId){const r=h.get(e.parentWorkItemId)??[];r.push(e),h.set(e.parentWorkItemId,r)}else if(e.level==="issue"&&e.projectId){const r=f.get(e.projectId)??[];r.push(e),f.set(e.projectId,r)}else if(e.projectId){const r=g.get(e.projectId)??[];r.push(e),g.set(e.projectId,r)}const b=e=>{var r;return M({id:`${e.level}:${e.id}`,entityId:e.id,kind:e.level,label:e.title,description:C(e.description,e.level==="issue"?"Vertical slice issue":e.level==="subtask"?"Granular child step":"Focused AI session task"),searchText:I([e.title,e.description,e.aiInstructions,e.executionMode??"",e.status,((r=e.user)==null?void 0:r.displayName)??"",...(e.assignees??[]).map(c=>c.displayName),...e.tagIds.map(c=>j.get(c)??"")].join(" ")),href:`/tasks/${e.id}`,statusLabel:e.status,executionMode:e.executionMode,goalId:e.goalId,projectId:e.projectId,tagIds:e.tagIds,user:e.user,assignees:e.assignees??[],linkedUserIds:[...e.user?[e.user.id]:[],...e.assigneeUserIds??[]],progressPercent:null,progressLabel:null,children:(h.get(e.id)??[]).map(b)})},w=e=>{var c;const r=n.filter(d=>d.targetProjectIds.includes(e.id));return M({id:`project:${e.id}`,entityId:e.id,kind:"project",label:e.title,description:C(e.description||e.productRequirementsDocument,"PRD-backed initiative"),searchText:I([e.title,e.description,e.productRequirementsDocument,e.goalTitle,e.workflowStatus,e.status,((c=e.user)==null?void 0:c.displayName)??"",...(e.assignees??[]).map(d=>d.displayName)].join(" ")),href:`/projects/${e.id}`,statusLabel:e.workflowStatus,executionMode:null,goalId:e.goalId,projectId:e.id,tagIds:[],user:e.user,assignees:e.assignees??[],linkedUserIds:[...e.user?[e.user.id]:[],...e.assigneeUserIds??[]],progressPercent:e.progress,progressLabel:`${e.completedTaskCount}/${e.totalTasks} done`,children:[...r.map(d=>{var m;return M({id:`strategy:${d.id}`,entityId:d.id,kind:"strategy",label:d.title,description:C(d.overview||d.endStateDescription,"Execution strategy"),searchText:I([d.title,d.overview,d.endStateDescription,d.status,((m=d.user)==null?void 0:m.displayName)??""].join(" ")),href:`/strategies/${d.id}`,statusLabel:d.status,executionMode:null,goalId:e.goalId,projectId:e.id,tagIds:[],user:d.user,assignees:[],linkedUserIds:d.user?[d.user.id]:[],progressPercent:null,progressLabel:null,children:[]})}),...(f.get(e.id)??[]).map(b),...(g.get(e.id)??[]).map(b)]})};return i.map(e=>{var _,N;const r=o.filter(l=>l.goalId===e.id),c=n.filter(l=>l.targetGoalIds.includes(e.id)),d=new Map(c.map(l=>[l.id,[]])),m=new Set;for(const l of r){const y=c.find(U=>U.targetProjectIds.includes(l.id));y&&((_=d.get(y.id))==null||_.push(l),m.add(l.id))}const T=c.map(l=>{var y;return M({id:`strategy:${l.id}`,entityId:l.id,kind:"strategy",label:l.title,description:C(l.overview||l.endStateDescription,"High-level strategy"),searchText:I([l.title,l.overview,l.endStateDescription,l.status,((y=l.user)==null?void 0:y.displayName)??""].join(" ")),href:`/strategies/${l.id}`,statusLabel:l.status,executionMode:null,goalId:e.id,projectId:null,tagIds:[],user:l.user,assignees:[],linkedUserIds:l.user?[l.user.id]:[],progressPercent:null,progressLabel:null,children:(d.get(l.id)??[]).map(w)})}),S=r.filter(l=>!m.has(l.id)).map(w);return M({id:`goal:${e.id}`,entityId:e.id,kind:"goal",label:e.title,description:C(e.description,"Strategic goal"),searchText:I([e.title,e.description,e.status,((N=e.user)==null?void 0:N.displayName)??""].join(" ")),href:`/goals/${e.id}`,statusLabel:e.status,executionMode:null,goalId:e.id,projectId:null,tagIds:e.tagIds,user:e.user,assignees:[],linkedUserIds:e.user?[e.user.id]:[],progressPercent:null,progressLabel:null,children:[...T,...S]})})}function K(t){return t.reduce((i,n)=>i+1+K(n.children??[]),0)}function me(t,i){return t.searchText.includes(I(i.query))&&(i.kind==="any"||i.kind===t.kind)}function G(t,i,n=!1){const{clauses:o,statusFilters:p,ownerUserIds:j,ownerKinds:h,selectedUserIds:f}=i,g=o.length===0||o.some(m=>me(t,m)),b=p.length===0||t.statusLabel!==null&&p.includes(t.statusLabel),w=j.length===0&&f.length===0?!0:[...j,...f].some(m=>t.linkedUserIds.includes(m)),e=h.length===0||[t.user,...t.assignees].some(m=>m&&h.includes(m.kind)),r=b&&w&&e,c=o.length===0||n||g,d=(t.children??[]).map(m=>G(m,i,n||r&&g)).filter(m=>m!==null);return r&&c||d.length>0?{...t,children:d}:null}function Q(t,i){return t.flatMap(n=>{const o=Q(n.children??[],i);return i.includes(n.kind)?[{...n,children:o}]:o})}function xe(t){switch(t){case"goal":return"bg-amber-400/12 text-amber-100";case"strategy":return"bg-cyan-400/12 text-cyan-100";case"project":return"bg-sky-400/12 text-sky-100";case"issue":return"bg-orange-400/12 text-orange-100";case"subtask":return"border-indigo-300/18 bg-indigo-400/12 text-indigo-100";default:return"bg-indigo-400/12 text-indigo-100"}}function z(t){switch(t){case"done":case"completed":return"bg-emerald-400/12 text-emerald-100";case"blocked":return"bg-rose-400/12 text-rose-100";case"in_progress":case"active":return"bg-sky-400/12 text-sky-100";case"focus":return"bg-violet-400/12 text-violet-100";default:return"bg-white/[0.08] text-white/70"}}function W(t){return t==="any"?s.jsx(v,{className:"bg-white/[0.08] text-white/76",children:"Any"}):t==="subtask"?s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-indigo-300/18 bg-indigo-400/12 text-indigo-100"}):s.jsx(D,{kind:t==="issue"?"issue":t,label:t,compact:!0,gradient:!1})}function be({query:t,onQueryChange:i,clauses:n,onClausesChange:o,resultSummary:p}){const[j,h]=x.useState(!1),[f,g]=x.useState(0),b=x.useMemo(()=>pe(t).filter(r=>!n.some(c=>c.id===r.id)),[n,t]),w=r=>{o([...n,r]),i(""),g(0),h(!1)},e=r=>{o(n.filter(c=>c.id!==r))};return s.jsx("div",{className:"grid gap-3",children:s.jsxs("div",{className:"rounded-[28px] border border-white/8 bg-[linear-gradient(135deg,rgba(19,28,48,0.9),rgba(10,14,26,0.98))] p-4 shadow-[0_30px_80px_rgba(3,8,18,0.28)] sm:p-5",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-white/42",children:"Hierarchy search"}),s.jsxs("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/62",children:["Build OR clauses like ",s.jsx("span",{className:"text-white",children:'Goal + "MD"'})," or ",s.jsx("span",{className:"text-white",children:'Any + "Happy"'}),". Matching ancestors keep their branches visible so you can explore the hierarchy, not lose it."]})]}),n.length>0||t.trim().length>0?s.jsx(B,{variant:"secondary",size:"sm",onClick:()=>{i(""),o([]),g(0),h(!1)},children:"Clear search"}):null]}),s.jsxs("div",{className:"mt-4 rounded-[24px] border border-white/8 bg-white/[0.04] px-4 py-3",children:[n.length>0?s.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:n.map(r=>s.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-white/8 bg-white/[0.06] px-2.5 py-1.5",children:[W(r.kind),s.jsxs("span",{className:"max-w-[14rem] truncate text-sm text-white/78",children:['"',r.query,'"']}),s.jsx("button",{type:"button",className:"rounded-full text-white/52 transition hover:text-white",onClick:()=>e(r.id),"aria-label":`Remove ${r.kind} ${r.query}`,children:s.jsx(ee,{className:"size-3.5"})})]},r.id))}):null,s.jsxs("div",{className:"relative",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(se,{className:"size-4 text-white/36"}),s.jsx("input",{value:t,onChange:r=>{i(r.target.value),h(!0),g(0)},onFocus:()=>h(!0),onBlur:()=>{window.setTimeout(()=>h(!1),120)},onKeyDown:r=>{if(r.key==="Backspace"&&!t&&n.length>0){e(n[n.length-1].id);return}if(r.key==="ArrowDown"){r.preventDefault(),h(!0),g(c=>b.length===0?0:Math.min(b.length-1,c+1));return}if(r.key==="ArrowUp"){r.preventDefault(),g(c=>Math.max(0,c-1));return}if(r.key==="Escape"){h(!1);return}r.key==="Enter"&&b[f]&&(r.preventDefault(),w(b[f]))},placeholder:'Type text, then pick a clause like Goal + "MD" or Any + "Happy"',className:"min-w-0 flex-1 bg-transparent text-sm text-white placeholder:text-white/34 focus:outline-none"})]}),j?s.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-white/8 bg-[rgba(8,13,24,0.96)] p-2 shadow-[0_26px_60px_rgba(4,8,18,0.32)] backdrop-blur-xl",children:b.length>0?b.map((r,c)=>s.jsx("button",{type:"button",className:F("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",c===f?"bg-white/[0.1] text-white":"text-white/70 hover:bg-white/[0.06] hover:text-white"),onMouseEnter:()=>g(c),onMouseDown:d=>d.preventDefault(),onClick:()=>w(r),children:s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[W(r.kind),s.jsxs("span",{className:"truncate text-sm font-medium text-white",children:['"',r.query,'"']})]}),s.jsxs("div",{className:"mt-1 text-xs leading-5 text-white/46",children:["Match ",r.kind==="any"?"any visible hierarchy node":`${r.kind} nodes`," that mention this text."]})]})},r.id)):s.jsx("div",{className:"px-3 py-2.5 text-sm text-white/42",children:"Type a word or phrase to create a new OR clause."})}):null]})]}),s.jsx("div",{className:"mt-3 text-sm text-white/52",children:p})]})})}function Me(){const t=ae(),i=x.useRef(null),[n,o]=x.useState(""),[p,j]=x.useState([]),[h,f]=x.useState([]),[g,b]=x.useState([...P]),[w,e]=x.useState(L),r=te({queryKey:["work-items-hierarchy",...t.selectedUserIds],queryFn:()=>de({userIds:t.selectedUserIds})}),c=x.useMemo(()=>{const a=t.snapshot.users.filter(u=>u.kind==="bot"),k=t.snapshot.users.filter(u=>u.kind==="human");return[{value:`${$.kind}bot`,label:"Bots",description:`${a.length} bot collaborators`,searchText:`bots bot ai agents assistants ${a.map(u=>`${u.displayName} ${u.handle}`).join(" ")}`,badge:s.jsx(v,{className:"border-cyan-300/18 bg-cyan-400/12 text-cyan-50",children:"Bots"}),menuBadge:s.jsx(v,{className:"border-cyan-300/18 bg-cyan-400/12 text-cyan-50",children:"Bots"})},{value:`${$.kind}human`,label:"Humans",description:`${k.length} human collaborators`,searchText:`humans human people operators ${k.map(u=>`${u.displayName} ${u.handle}`).join(" ")}`,badge:s.jsx(v,{className:"border-amber-300/18 bg-amber-400/12 text-amber-50",children:"Humans"}),menuBadge:s.jsx(v,{className:"border-amber-300/18 bg-amber-400/12 text-amber-50",children:"Humans"})},...t.snapshot.users.map(u=>({value:`${$.user}${u.id}`,label:u.displayName,description:`${u.kind}${u.handle?` · @${u.handle}`:""}`,searchText:`${u.displayName} ${u.handle} ${u.kind} ${u.description}`,badge:s.jsx(R,{user:u,compact:!0}),menuBadge:s.jsx(R,{user:u,compact:!0})}))]},[t.snapshot.users]),d=x.useMemo(()=>[{value:"goal",label:"Goal",searchText:"goal direction objective",kind:"goal"},{value:"strategy",label:"Strategy",searchText:"strategy plan sequencing",kind:"strategy"},{value:"project",label:"Project",searchText:"project initiative prd",kind:"project"},{value:"issue",label:"Issue",searchText:"issue vertical slice tracer bullet",kind:"issue"},{value:"task",label:"Task",searchText:"task execution ai session",kind:"task"},{value:"subtask",label:"Subtask",searchText:"subtask child step",badge:s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-indigo-300/18 bg-indigo-400/12 text-indigo-100"}),menuBadge:s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-indigo-300/18 bg-indigo-400/12 text-indigo-100"})}],[]),m=x.useMemo(()=>[{value:"active",label:"Active",searchText:"active in progress live"},{value:"paused",label:"Paused",searchText:"paused suspended"},{value:"completed",label:"Completed",searchText:"completed finished"},{value:"backlog",label:"Backlog",searchText:"backlog queued"},{value:"focus",label:"Focus",searchText:"focus ready"},{value:"in_progress",label:"In progress",searchText:"in progress active doing"},{value:"blocked",label:"Blocked",searchText:"blocked stuck"},{value:"done",label:"Done",searchText:"done complete finished"}].map(a=>({...a,badge:s.jsx(v,{className:z(a.value),children:a.label}),menuBadge:s.jsx(v,{className:z(a.value),children:a.label})})),[]),T=x.useMemo(()=>new Map(t.snapshot.tags.map(a=>[a.id,a.name])),[t.snapshot.tags]),S=x.useMemo(()=>r.data?V({...r.data,tagNameById:T}):V({goals:t.snapshot.goals,strategies:t.snapshot.strategies,projects:t.snapshot.dashboard.projects,tagNameById:T,workItems:t.snapshot.workItems&&t.snapshot.workItems.length>0?t.snapshot.workItems:t.snapshot.tasks}),[r.data,t.snapshot,T]),_=n.trim().length>0||p.length>0||h.length>0||g.length!==P.length||P.some(a=>!g.includes(a))||w.length!==L.length||L.some(a=>!w.includes(a)),N=x.useMemo(()=>ue(h),[h]),l=x.useMemo(()=>{const a=S.map(k=>G(k,{clauses:p,statusFilters:g,ownerUserIds:N.userIds,ownerKinds:N.kinds,selectedUserIds:t.selectedUserIds})).filter(k=>k!==null);return Q(a,w)},[S,N.kinds,N.userIds,p,g,t.selectedUserIds,w]),y=x.useMemo(()=>K(l),[l]),U=`${p.length>0?`${p.length} OR clause${p.length===1?"":"s"} active`:"Search across the full hierarchy"} · ${y} visible node${y===1?"":"s"}.`;return r.isLoading&&S.length===0?s.jsx(re,{eyebrow:"Hierarchy",title:"Building Forge hierarchy",description:"Loading goals, strategies, projects, issues, tasks, and subtasks into the compact hierarchy view."}):r.isError&&S.length===0?s.jsx(ie,{eyebrow:"Hierarchy",error:r.error,onRetry:()=>void r.refetch()}):s.jsxs("div",{className:"grid min-w-0 gap-5",children:[s.jsx(ce,{}),s.jsx(oe,{title:"Hierarchy",description:"Explore the full Forge stack from goal to subtask in one compact operational tree, with both strategy layers visible and the same control surfaces as the board.",badge:`${y} visible nodes`}),s.jsxs(O,{className:"min-w-0 overflow-hidden border-white/8 bg-[linear-gradient(180deg,rgba(16,23,38,0.92),rgba(9,14,24,0.98))]",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-white/8 px-5 py-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Hierarchy controls"}),s.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/60",children:"Filter across goals, projects, tags, humans, bots, and work-item types, then expand or collapse the full tree without losing the hierarchy context."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(B,{variant:"secondary",size:"sm",onClick:()=>{var a,k;return(k=(a=i.current)==null?void 0:a.openAll)==null?void 0:k.call(a)},children:"Expand all"}),s.jsx(B,{variant:"secondary",size:"sm",onClick:()=>{var a,k;return(k=(a=i.current)==null?void 0:a.closeAll)==null?void 0:k.call(a)},children:"Collapse all"}),_?s.jsx(B,{variant:"secondary",size:"sm",onClick:()=>{o(""),j([]),f([]),b([...P]),e(L)},children:"Reset"}):null]})]}),s.jsxs("div",{className:"grid gap-4 px-5 py-5",children:[s.jsx(be,{query:n,onQueryChange:o,clauses:p,onClausesChange:j,resultSummary:U}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)_minmax(0,1fr)]",children:[s.jsx(A,{options:m,selectedValues:g,onChange:a=>b(a),placeholder:"Visible states",emptyMessage:"No states available.",variant:"action-bar"}),s.jsx(A,{options:d,selectedValues:w,onChange:a=>e(a),placeholder:"Visible levels",emptyMessage:"No hierarchy levels.",className:"min-w-0",variant:"action-bar"}),s.jsx(A,{options:c,selectedValues:h,onChange:f,placeholder:"Filter by human, bot, or collaborator",emptyMessage:"No matching collaborators."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(v,{className:"bg-white/[0.08] text-white/72",children:[l.length," top-level nodes"]}),s.jsxs(v,{className:"bg-white/[0.08] text-white/72",children:[y," visible nodes"]}),s.jsx(v,{className:"bg-white/[0.08] text-white/72",children:w.join(" + ")})]})]})]}),l.length===0?s.jsx(ne,{eyebrow:"Hierarchy",title:"No hierarchy nodes match the current filters",description:"Clear some filters or broaden the search to bring the full planning ladder back into view.",action:s.jsx(B,{variant:"secondary",onClick:()=>{o(""),j([]),f([]),b([...P]),e(L)},children:"Reset hierarchy filters"})}):s.jsxs(O,{className:"min-w-0 overflow-hidden border-white/8 bg-[linear-gradient(180deg,rgba(13,20,31,0.96),rgba(9,15,24,0.98))] p-0",children:[s.jsxs("div",{className:"grid grid-cols-[minmax(0,1.8fr)_auto_auto_auto] gap-3 border-b border-white/8 px-5 py-3 text-[11px] uppercase tracking-[0.18em] text-white/38",children:[s.jsx("div",{children:"Name"}),s.jsx("div",{className:"hidden lg:block",children:"State"}),s.jsx("div",{className:"hidden xl:block",children:"People"}),s.jsx("div",{className:"hidden lg:block",children:"Progress"})]}),s.jsx("div",{className:"p-2",children:s.jsx(X,{ref:i,data:l,width:"100%",height:760,rowHeight:64,overscanCount:10,childrenAccessor:a=>a.children??null,openByDefault:!0,paddingTop:8,paddingBottom:8,disableDrag:!0,className:"text-sm",children:({node:a,style:k})=>{const u=a.data.kind==="subtask"?"task":a.data.kind,E=le(u),H=E.colorToken.rgb.join(", ");return s.jsx("div",{style:k,className:"px-2 py-1.5",children:s.jsxs("div",{className:F("grid min-w-0 items-center gap-3 rounded-[16px] border border-white/8 px-3 py-2 transition hover:border-white/14 hover:bg-white/[0.05]","grid-cols-[minmax(0,1.8fr)_auto] lg:grid-cols-[minmax(0,1.8fr)_auto_auto] xl:grid-cols-[minmax(0,1.8fr)_auto_auto_auto]"),style:{marginLeft:`${a.level*14}px`,background:`linear-gradient(180deg, rgba(${H}, 0.07), rgba(255,255,255,0.02))`},children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("button",{type:"button",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-white/[0.06] text-white/62 transition hover:bg-white/[0.1] hover:text-white",onClick:()=>a.toggle(),disabled:a.isLeaf,"aria-label":a.isOpen?`Collapse ${a.data.label}`:`Expand ${a.data.label}`,children:a.isLeaf?s.jsx("span",{className:"size-2 rounded-full bg-white/22"}):a.isOpen?s.jsx(Y,{className:"size-4"}):s.jsx(Z,{className:"size-4"})}),s.jsx("span",{className:F("inline-flex size-9 shrink-0 items-center justify-center rounded-[12px] border",E.subtleBadgeClassName),children:s.jsx(E.icon,{className:F("size-4",E.iconClassName)})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(v,{className:xe(a.data.kind),children:a.data.kind}),a.data.executionMode?s.jsx(v,{className:a.data.executionMode==="afk"?"bg-emerald-400/12 text-emerald-100":"bg-amber-400/12 text-amber-100",children:a.data.executionMode.toUpperCase()}):null,s.jsx("div",{className:"truncate text-[13px] font-medium text-white",children:a.data.label})]}),s.jsx("div",{className:"mt-0.5 truncate text-[11px] leading-5 text-white/46",children:a.data.description})]})]}),s.jsx("div",{className:"hidden lg:flex justify-end",children:s.jsx(v,{className:z(a.data.statusLabel),children:a.data.statusLabel?a.data.statusLabel.replaceAll("_"," "):"linked"})}),s.jsxs("div",{className:"hidden xl:flex items-center justify-end gap-2",children:[a.data.user?s.jsx(R,{user:a.data.user,compact:!0}):null,a.data.assignees.length>0?s.jsxs(v,{className:"bg-white/[0.08] text-white/72",children:["+",a.data.assignees.length]}):null]}),s.jsxs("div",{className:"hidden lg:flex min-w-[11rem] items-center justify-end gap-3",children:[s.jsxs("div",{className:"min-w-[7.5rem]",children:[s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-white/[0.08]",children:s.jsx("div",{className:"h-full rounded-full",style:{width:`${a.data.progressPercent??0}%`,background:`linear-gradient(90deg, rgba(${H}, 0.96), rgba(${H}, 0.72))`}})}),s.jsx("div",{className:"mt-1 text-[11px] text-white/44",children:a.data.progressLabel??`${a.data.progressPercent??0}% complete`})]}),a.data.href?s.jsx(J,{to:a.data.href,className:"rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-[11px] uppercase tracking-[0.16em] text-white/72 transition hover:border-white/18 hover:bg-white/[0.08] hover:text-white",children:"Open"}):s.jsx("span",{className:"w-[3.75rem]"})]})]})})}})})]})]})}export{Me as ProjectManagementHierarchyPage};
|
|
1
|
+
import{r as x,j as s,cz as X,cx as Y,cA as Z,aC as J,aK as ee,b3 as se}from"./vendor-DHkYh85p.js";import{i as te}from"./state-B-4sS1xO.js";import{u as ae,c as v,U as R,b as D,L as re,E as ie,C as O,B,m as A,a as ne,aR as le,Z as F,bR as de}from"./index-CF4J4R9L.js";import{P as ce}from"./project-management-section-nav-P3ixzPa-.js";import{P as oe}from"./page-hero-DRy5b2MU.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const $={user:"user:",kind:"kind:"},q=["goal","strategy","project","issue","task","subtask"],L=[...q],P=["active","paused","completed","backlog","focus","in_progress","blocked","done"];function I(t){return t.trim().toLowerCase()}function ue(t){return t.reduce((i,n)=>{if(n.startsWith($.user))i.userIds.push(n.slice($.user.length));else if(n.startsWith($.kind)){const o=n.slice($.kind.length);(o==="human"||o==="bot")&&i.kinds.push(o)}return i},{userIds:[],kinds:[]})}function he(t,i){return`${i}:${I(t)}`}function pe(t){const i=t.trim();return i.length===0?[]:["any",...q].map(n=>({id:he(i,n),query:i,kind:n}))}function ge(t){switch(t){case"done":case"completed":return 1;case"in_progress":case"active":return .66;case"focus":return .45;case"blocked":return .5;case"paused":return .28;default:return .08}}function C(t,i){const n=t.replace(/\s+/g," ").trim();return n.length===0?i:n}function M(t){const i=(t.children??[]).map(M);if(t.kind==="project")return{...t,children:i,progressPercent:t.progressPercent,progressLabel:t.progressLabel??(typeof t.progressPercent=="number"?`${t.progressPercent}% complete`:null)};if(i.length>0){const o=i.map(p=>p.progressPercent).filter(p=>typeof p=="number");if(o.length>0){const p=Math.round(o.reduce((j,h)=>j+h,0)/o.length);return{...t,children:i,progressPercent:p,progressLabel:`${i.length} child item${i.length===1?"":"s"}`}}}const n=Math.round(ge(t.statusLabel)*100);return{...t,children:i,progressPercent:n,progressLabel:t.statusLabel?t.statusLabel.replaceAll("_"," "):null}}function V(t){const{goals:i,strategies:n,projects:o,workItems:p,tagNameById:j}=t,h=new Map,f=new Map,g=new Map;for(const e of p)if(e.parentWorkItemId){const r=h.get(e.parentWorkItemId)??[];r.push(e),h.set(e.parentWorkItemId,r)}else if(e.level==="issue"&&e.projectId){const r=f.get(e.projectId)??[];r.push(e),f.set(e.projectId,r)}else if(e.projectId){const r=g.get(e.projectId)??[];r.push(e),g.set(e.projectId,r)}const b=e=>{var r;return M({id:`${e.level}:${e.id}`,entityId:e.id,kind:e.level,label:e.title,description:C(e.description,e.level==="issue"?"Vertical slice issue":e.level==="subtask"?"Granular child step":"Focused AI session task"),searchText:I([e.title,e.description,e.aiInstructions,e.executionMode??"",e.status,((r=e.user)==null?void 0:r.displayName)??"",...(e.assignees??[]).map(c=>c.displayName),...e.tagIds.map(c=>j.get(c)??"")].join(" ")),href:`/tasks/${e.id}`,statusLabel:e.status,executionMode:e.executionMode,goalId:e.goalId,projectId:e.projectId,tagIds:e.tagIds,user:e.user,assignees:e.assignees??[],linkedUserIds:[...e.user?[e.user.id]:[],...e.assigneeUserIds??[]],progressPercent:null,progressLabel:null,children:(h.get(e.id)??[]).map(b)})},w=e=>{var c;const r=n.filter(d=>d.targetProjectIds.includes(e.id));return M({id:`project:${e.id}`,entityId:e.id,kind:"project",label:e.title,description:C(e.description||e.productRequirementsDocument,"PRD-backed initiative"),searchText:I([e.title,e.description,e.productRequirementsDocument,e.goalTitle,e.workflowStatus,e.status,((c=e.user)==null?void 0:c.displayName)??"",...(e.assignees??[]).map(d=>d.displayName)].join(" ")),href:`/projects/${e.id}`,statusLabel:e.workflowStatus,executionMode:null,goalId:e.goalId,projectId:e.id,tagIds:[],user:e.user,assignees:e.assignees??[],linkedUserIds:[...e.user?[e.user.id]:[],...e.assigneeUserIds??[]],progressPercent:e.progress,progressLabel:`${e.completedTaskCount}/${e.totalTasks} done`,children:[...r.map(d=>{var m;return M({id:`strategy:${d.id}`,entityId:d.id,kind:"strategy",label:d.title,description:C(d.overview||d.endStateDescription,"Execution strategy"),searchText:I([d.title,d.overview,d.endStateDescription,d.status,((m=d.user)==null?void 0:m.displayName)??""].join(" ")),href:`/strategies/${d.id}`,statusLabel:d.status,executionMode:null,goalId:e.goalId,projectId:e.id,tagIds:[],user:d.user,assignees:[],linkedUserIds:d.user?[d.user.id]:[],progressPercent:null,progressLabel:null,children:[]})}),...(f.get(e.id)??[]).map(b),...(g.get(e.id)??[]).map(b)]})};return i.map(e=>{var _,N;const r=o.filter(l=>l.goalId===e.id),c=n.filter(l=>l.targetGoalIds.includes(e.id)),d=new Map(c.map(l=>[l.id,[]])),m=new Set;for(const l of r){const y=c.find(U=>U.targetProjectIds.includes(l.id));y&&((_=d.get(y.id))==null||_.push(l),m.add(l.id))}const T=c.map(l=>{var y;return M({id:`strategy:${l.id}`,entityId:l.id,kind:"strategy",label:l.title,description:C(l.overview||l.endStateDescription,"High-level strategy"),searchText:I([l.title,l.overview,l.endStateDescription,l.status,((y=l.user)==null?void 0:y.displayName)??""].join(" ")),href:`/strategies/${l.id}`,statusLabel:l.status,executionMode:null,goalId:e.id,projectId:null,tagIds:[],user:l.user,assignees:[],linkedUserIds:l.user?[l.user.id]:[],progressPercent:null,progressLabel:null,children:(d.get(l.id)??[]).map(w)})}),S=r.filter(l=>!m.has(l.id)).map(w);return M({id:`goal:${e.id}`,entityId:e.id,kind:"goal",label:e.title,description:C(e.description,"Strategic goal"),searchText:I([e.title,e.description,e.status,((N=e.user)==null?void 0:N.displayName)??""].join(" ")),href:`/goals/${e.id}`,statusLabel:e.status,executionMode:null,goalId:e.id,projectId:null,tagIds:e.tagIds,user:e.user,assignees:[],linkedUserIds:e.user?[e.user.id]:[],progressPercent:null,progressLabel:null,children:[...T,...S]})})}function K(t){return t.reduce((i,n)=>i+1+K(n.children??[]),0)}function me(t,i){return t.searchText.includes(I(i.query))&&(i.kind==="any"||i.kind===t.kind)}function G(t,i,n=!1){const{clauses:o,statusFilters:p,ownerUserIds:j,ownerKinds:h,selectedUserIds:f}=i,g=o.length===0||o.some(m=>me(t,m)),b=p.length===0||t.statusLabel!==null&&p.includes(t.statusLabel),w=j.length===0&&f.length===0?!0:[...j,...f].some(m=>t.linkedUserIds.includes(m)),e=h.length===0||[t.user,...t.assignees].some(m=>m&&h.includes(m.kind)),r=b&&w&&e,c=o.length===0||n||g,d=(t.children??[]).map(m=>G(m,i,n||r&&g)).filter(m=>m!==null);return r&&c||d.length>0?{...t,children:d}:null}function Q(t,i){return t.flatMap(n=>{const o=Q(n.children??[],i);return i.includes(n.kind)?[{...n,children:o}]:o})}function xe(t){switch(t){case"goal":return"bg-amber-400/12 text-amber-100";case"strategy":return"bg-cyan-400/12 text-cyan-100";case"project":return"bg-sky-400/12 text-sky-100";case"issue":return"bg-orange-400/12 text-orange-100";case"subtask":return"border-indigo-300/18 bg-indigo-400/12 text-indigo-100";default:return"bg-indigo-400/12 text-indigo-100"}}function z(t){switch(t){case"done":case"completed":return"bg-emerald-400/12 text-emerald-100";case"blocked":return"bg-rose-400/12 text-rose-100";case"in_progress":case"active":return"bg-sky-400/12 text-sky-100";case"focus":return"bg-violet-400/12 text-violet-100";default:return"bg-white/[0.08] text-white/70"}}function W(t){return t==="any"?s.jsx(v,{className:"bg-white/[0.08] text-white/76",children:"Any"}):t==="subtask"?s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-indigo-300/18 bg-indigo-400/12 text-indigo-100"}):s.jsx(D,{kind:t==="issue"?"issue":t,label:t,compact:!0,gradient:!1})}function be({query:t,onQueryChange:i,clauses:n,onClausesChange:o,resultSummary:p}){const[j,h]=x.useState(!1),[f,g]=x.useState(0),b=x.useMemo(()=>pe(t).filter(r=>!n.some(c=>c.id===r.id)),[n,t]),w=r=>{o([...n,r]),i(""),g(0),h(!1)},e=r=>{o(n.filter(c=>c.id!==r))};return s.jsx("div",{className:"grid gap-3",children:s.jsxs("div",{className:"rounded-[28px] border border-white/8 bg-[linear-gradient(135deg,rgba(19,28,48,0.9),rgba(10,14,26,0.98))] p-4 shadow-[0_30px_80px_rgba(3,8,18,0.28)] sm:p-5",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.2em] text-white/42",children:"Hierarchy search"}),s.jsxs("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/62",children:["Build OR clauses like ",s.jsx("span",{className:"text-white",children:'Goal + "MD"'})," or ",s.jsx("span",{className:"text-white",children:'Any + "Happy"'}),". Matching ancestors keep their branches visible so you can explore the hierarchy, not lose it."]})]}),n.length>0||t.trim().length>0?s.jsx(B,{variant:"secondary",size:"sm",onClick:()=>{i(""),o([]),g(0),h(!1)},children:"Clear search"}):null]}),s.jsxs("div",{className:"mt-4 rounded-[24px] border border-white/8 bg-white/[0.04] px-4 py-3",children:[n.length>0?s.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:n.map(r=>s.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-white/8 bg-white/[0.06] px-2.5 py-1.5",children:[W(r.kind),s.jsxs("span",{className:"max-w-[14rem] truncate text-sm text-white/78",children:['"',r.query,'"']}),s.jsx("button",{type:"button",className:"rounded-full text-white/52 transition hover:text-white",onClick:()=>e(r.id),"aria-label":`Remove ${r.kind} ${r.query}`,children:s.jsx(ee,{className:"size-3.5"})})]},r.id))}):null,s.jsxs("div",{className:"relative",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(se,{className:"size-4 text-white/36"}),s.jsx("input",{value:t,onChange:r=>{i(r.target.value),h(!0),g(0)},onFocus:()=>h(!0),onBlur:()=>{window.setTimeout(()=>h(!1),120)},onKeyDown:r=>{if(r.key==="Backspace"&&!t&&n.length>0){e(n[n.length-1].id);return}if(r.key==="ArrowDown"){r.preventDefault(),h(!0),g(c=>b.length===0?0:Math.min(b.length-1,c+1));return}if(r.key==="ArrowUp"){r.preventDefault(),g(c=>Math.max(0,c-1));return}if(r.key==="Escape"){h(!1);return}r.key==="Enter"&&b[f]&&(r.preventDefault(),w(b[f]))},placeholder:'Type text, then pick a clause like Goal + "MD" or Any + "Happy"',className:"min-w-0 flex-1 bg-transparent text-sm text-white placeholder:text-white/34 focus:outline-none"})]}),j?s.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-white/8 bg-[rgba(8,13,24,0.96)] p-2 shadow-[0_26px_60px_rgba(4,8,18,0.32)] backdrop-blur-xl",children:b.length>0?b.map((r,c)=>s.jsx("button",{type:"button",className:F("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",c===f?"bg-white/[0.1] text-white":"text-white/70 hover:bg-white/[0.06] hover:text-white"),onMouseEnter:()=>g(c),onMouseDown:d=>d.preventDefault(),onClick:()=>w(r),children:s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[W(r.kind),s.jsxs("span",{className:"truncate text-sm font-medium text-white",children:['"',r.query,'"']})]}),s.jsxs("div",{className:"mt-1 text-xs leading-5 text-white/46",children:["Match ",r.kind==="any"?"any visible hierarchy node":`${r.kind} nodes`," that mention this text."]})]})},r.id)):s.jsx("div",{className:"px-3 py-2.5 text-sm text-white/42",children:"Type a word or phrase to create a new OR clause."})}):null]})]}),s.jsx("div",{className:"mt-3 text-sm text-white/52",children:p})]})})}function Me(){const t=ae(),i=x.useRef(null),[n,o]=x.useState(""),[p,j]=x.useState([]),[h,f]=x.useState([]),[g,b]=x.useState([...P]),[w,e]=x.useState(L),r=te({queryKey:["work-items-hierarchy",...t.selectedUserIds],queryFn:()=>de({userIds:t.selectedUserIds})}),c=x.useMemo(()=>{const a=t.snapshot.users.filter(u=>u.kind==="bot"),k=t.snapshot.users.filter(u=>u.kind==="human");return[{value:`${$.kind}bot`,label:"Bots",description:`${a.length} bot collaborators`,searchText:`bots bot ai agents assistants ${a.map(u=>`${u.displayName} ${u.handle}`).join(" ")}`,badge:s.jsx(v,{className:"border-cyan-300/18 bg-cyan-400/12 text-cyan-50",children:"Bots"}),menuBadge:s.jsx(v,{className:"border-cyan-300/18 bg-cyan-400/12 text-cyan-50",children:"Bots"})},{value:`${$.kind}human`,label:"Humans",description:`${k.length} human collaborators`,searchText:`humans human people operators ${k.map(u=>`${u.displayName} ${u.handle}`).join(" ")}`,badge:s.jsx(v,{className:"border-amber-300/18 bg-amber-400/12 text-amber-50",children:"Humans"}),menuBadge:s.jsx(v,{className:"border-amber-300/18 bg-amber-400/12 text-amber-50",children:"Humans"})},...t.snapshot.users.map(u=>({value:`${$.user}${u.id}`,label:u.displayName,description:`${u.kind}${u.handle?` · @${u.handle}`:""}`,searchText:`${u.displayName} ${u.handle} ${u.kind} ${u.description}`,badge:s.jsx(R,{user:u,compact:!0}),menuBadge:s.jsx(R,{user:u,compact:!0})}))]},[t.snapshot.users]),d=x.useMemo(()=>[{value:"goal",label:"Goal",searchText:"goal direction objective",kind:"goal"},{value:"strategy",label:"Strategy",searchText:"strategy plan sequencing",kind:"strategy"},{value:"project",label:"Project",searchText:"project initiative prd",kind:"project"},{value:"issue",label:"Issue",searchText:"issue vertical slice tracer bullet",kind:"issue"},{value:"task",label:"Task",searchText:"task execution ai session",kind:"task"},{value:"subtask",label:"Subtask",searchText:"subtask child step",badge:s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-indigo-300/18 bg-indigo-400/12 text-indigo-100"}),menuBadge:s.jsx(D,{kind:"task",label:"Subtask",compact:!0,gradient:!1,className:"border-indigo-300/18 bg-indigo-400/12 text-indigo-100"})}],[]),m=x.useMemo(()=>[{value:"active",label:"Active",searchText:"active in progress live"},{value:"paused",label:"Paused",searchText:"paused suspended"},{value:"completed",label:"Completed",searchText:"completed finished"},{value:"backlog",label:"Backlog",searchText:"backlog queued"},{value:"focus",label:"Focus",searchText:"focus ready"},{value:"in_progress",label:"In progress",searchText:"in progress active doing"},{value:"blocked",label:"Blocked",searchText:"blocked stuck"},{value:"done",label:"Done",searchText:"done complete finished"}].map(a=>({...a,badge:s.jsx(v,{className:z(a.value),children:a.label}),menuBadge:s.jsx(v,{className:z(a.value),children:a.label})})),[]),T=x.useMemo(()=>new Map(t.snapshot.tags.map(a=>[a.id,a.name])),[t.snapshot.tags]),S=x.useMemo(()=>r.data?V({...r.data,tagNameById:T}):V({goals:t.snapshot.goals,strategies:t.snapshot.strategies,projects:t.snapshot.dashboard.projects,tagNameById:T,workItems:t.snapshot.workItems&&t.snapshot.workItems.length>0?t.snapshot.workItems:t.snapshot.tasks}),[r.data,t.snapshot,T]),_=n.trim().length>0||p.length>0||h.length>0||g.length!==P.length||P.some(a=>!g.includes(a))||w.length!==L.length||L.some(a=>!w.includes(a)),N=x.useMemo(()=>ue(h),[h]),l=x.useMemo(()=>{const a=S.map(k=>G(k,{clauses:p,statusFilters:g,ownerUserIds:N.userIds,ownerKinds:N.kinds,selectedUserIds:t.selectedUserIds})).filter(k=>k!==null);return Q(a,w)},[S,N.kinds,N.userIds,p,g,t.selectedUserIds,w]),y=x.useMemo(()=>K(l),[l]),U=`${p.length>0?`${p.length} OR clause${p.length===1?"":"s"} active`:"Search across the full hierarchy"} · ${y} visible node${y===1?"":"s"}.`;return r.isLoading&&S.length===0?s.jsx(re,{eyebrow:"Hierarchy",title:"Building Forge hierarchy",description:"Loading goals, strategies, projects, issues, tasks, and subtasks into the compact hierarchy view."}):r.isError&&S.length===0?s.jsx(ie,{eyebrow:"Hierarchy",error:r.error,onRetry:()=>void r.refetch()}):s.jsxs("div",{className:"grid min-w-0 gap-5",children:[s.jsx(ce,{}),s.jsx(oe,{title:"Hierarchy",description:"Explore the full Forge stack from goal to subtask in one compact operational tree, with both strategy layers visible and the same control surfaces as the board.",badge:`${y} visible nodes`}),s.jsxs(O,{className:"min-w-0 overflow-hidden border-white/8 bg-[linear-gradient(180deg,rgba(16,23,38,0.92),rgba(9,14,24,0.98))]",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b border-white/8 px-5 py-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Hierarchy controls"}),s.jsx("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-white/60",children:"Filter across goals, projects, tags, humans, bots, and work-item types, then expand or collapse the full tree without losing the hierarchy context."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(B,{variant:"secondary",size:"sm",onClick:()=>{var a,k;return(k=(a=i.current)==null?void 0:a.openAll)==null?void 0:k.call(a)},children:"Expand all"}),s.jsx(B,{variant:"secondary",size:"sm",onClick:()=>{var a,k;return(k=(a=i.current)==null?void 0:a.closeAll)==null?void 0:k.call(a)},children:"Collapse all"}),_?s.jsx(B,{variant:"secondary",size:"sm",onClick:()=>{o(""),j([]),f([]),b([...P]),e(L)},children:"Reset"}):null]})]}),s.jsxs("div",{className:"grid gap-4 px-5 py-5",children:[s.jsx(be,{query:n,onQueryChange:o,clauses:p,onClausesChange:j,resultSummary:U}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)_minmax(0,1fr)]",children:[s.jsx(A,{options:m,selectedValues:g,onChange:a=>b(a),placeholder:"Visible states",emptyMessage:"No states available.",variant:"action-bar"}),s.jsx(A,{options:d,selectedValues:w,onChange:a=>e(a),placeholder:"Visible levels",emptyMessage:"No hierarchy levels.",className:"min-w-0",variant:"action-bar"}),s.jsx(A,{options:c,selectedValues:h,onChange:f,placeholder:"Filter by human, bot, or collaborator",emptyMessage:"No matching collaborators."})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(v,{className:"bg-white/[0.08] text-white/72",children:[l.length," top-level nodes"]}),s.jsxs(v,{className:"bg-white/[0.08] text-white/72",children:[y," visible nodes"]}),s.jsx(v,{className:"bg-white/[0.08] text-white/72",children:w.join(" + ")})]})]})]}),l.length===0?s.jsx(ne,{eyebrow:"Hierarchy",title:"No hierarchy nodes match the current filters",description:"Clear some filters or broaden the search to bring the full planning ladder back into view.",action:s.jsx(B,{variant:"secondary",onClick:()=>{o(""),j([]),f([]),b([...P]),e(L)},children:"Reset hierarchy filters"})}):s.jsxs(O,{className:"min-w-0 overflow-hidden border-white/8 bg-[linear-gradient(180deg,rgba(13,20,31,0.96),rgba(9,15,24,0.98))] p-0",children:[s.jsxs("div",{className:"grid grid-cols-[minmax(0,1.8fr)_auto_auto_auto] gap-3 border-b border-white/8 px-5 py-3 text-[11px] uppercase tracking-[0.18em] text-white/38",children:[s.jsx("div",{children:"Name"}),s.jsx("div",{className:"hidden lg:block",children:"State"}),s.jsx("div",{className:"hidden xl:block",children:"People"}),s.jsx("div",{className:"hidden lg:block",children:"Progress"})]}),s.jsx("div",{className:"p-2",children:s.jsx(X,{ref:i,data:l,width:"100%",height:760,rowHeight:64,overscanCount:10,childrenAccessor:a=>a.children??null,openByDefault:!0,paddingTop:8,paddingBottom:8,disableDrag:!0,className:"text-sm",children:({node:a,style:k})=>{const u=a.data.kind==="subtask"?"task":a.data.kind,E=le(u),H=E.colorToken.rgb.join(", ");return s.jsx("div",{style:k,className:"px-2 py-1.5",children:s.jsxs("div",{className:F("grid min-w-0 items-center gap-3 rounded-[16px] border border-white/8 px-3 py-2 transition hover:border-white/14 hover:bg-white/[0.05]","grid-cols-[minmax(0,1.8fr)_auto] lg:grid-cols-[minmax(0,1.8fr)_auto_auto] xl:grid-cols-[minmax(0,1.8fr)_auto_auto_auto]"),style:{marginLeft:`${a.level*14}px`,background:`linear-gradient(180deg, rgba(${H}, 0.07), rgba(255,255,255,0.02))`},children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("button",{type:"button",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-white/[0.06] text-white/62 transition hover:bg-white/[0.1] hover:text-white",onClick:()=>a.toggle(),disabled:a.isLeaf,"aria-label":a.isOpen?`Collapse ${a.data.label}`:`Expand ${a.data.label}`,children:a.isLeaf?s.jsx("span",{className:"size-2 rounded-full bg-white/22"}):a.isOpen?s.jsx(Y,{className:"size-4"}):s.jsx(Z,{className:"size-4"})}),s.jsx("span",{className:F("inline-flex size-9 shrink-0 items-center justify-center rounded-[12px] border",E.subtleBadgeClassName),children:s.jsx(E.icon,{className:F("size-4",E.iconClassName)})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(v,{className:xe(a.data.kind),children:a.data.kind}),a.data.executionMode?s.jsx(v,{className:a.data.executionMode==="afk"?"bg-emerald-400/12 text-emerald-100":"bg-amber-400/12 text-amber-100",children:a.data.executionMode.toUpperCase()}):null,s.jsx("div",{className:"truncate text-[13px] font-medium text-white",children:a.data.label})]}),s.jsx("div",{className:"mt-0.5 truncate text-[11px] leading-5 text-white/46",children:a.data.description})]})]}),s.jsx("div",{className:"hidden lg:flex justify-end",children:s.jsx(v,{className:z(a.data.statusLabel),children:a.data.statusLabel?a.data.statusLabel.replaceAll("_"," "):"linked"})}),s.jsxs("div",{className:"hidden xl:flex items-center justify-end gap-2",children:[a.data.user?s.jsx(R,{user:a.data.user,compact:!0}):null,a.data.assignees.length>0?s.jsxs(v,{className:"bg-white/[0.08] text-white/72",children:["+",a.data.assignees.length]}):null]}),s.jsxs("div",{className:"hidden lg:flex min-w-[11rem] items-center justify-end gap-3",children:[s.jsxs("div",{className:"min-w-[7.5rem]",children:[s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-white/[0.08]",children:s.jsx("div",{className:"h-full rounded-full",style:{width:`${a.data.progressPercent??0}%`,background:`linear-gradient(90deg, rgba(${H}, 0.96), rgba(${H}, 0.72))`}})}),s.jsx("div",{className:"mt-1 text-[11px] text-white/44",children:a.data.progressLabel??`${a.data.progressPercent??0}% complete`})]}),a.data.href?s.jsx(J,{to:a.data.href,className:"rounded-full border border-white/10 bg-white/[0.04] px-3 py-1.5 text-[11px] uppercase tracking-[0.16em] text-white/72 transition hover:border-white/18 hover:bg-white/[0.08] hover:text-white",children:"Open"}):s.jsx("span",{className:"w-[3.75rem]"})]})]})})}})})]})]})}export{Me as ProjectManagementHierarchyPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aJ as p,r as l,cB as b,cC as f,aU as g,j as e,bz as m,o as w,aK as u}from"./vendor-DHkYh85p.js";import{C as j,Z as c}from"./index-
|
|
1
|
+
import{aJ as p,r as l,cB as b,cC as f,aU as g,j as e,bz as m,o as w,aK as u}from"./vendor-DHkYh85p.js";import{C as j,Z as c}from"./index-CF4J4R9L.js";const i=[{to:"/projects",label:"Projects",icon:b},{to:"/kanban",label:"Board",icon:f},{to:"/projects/hierarchy",label:"Hierarchy",icon:g}];function d(a,s){return s==="/projects"?a==="/projects"||/^\/projects\/[^/]+$/.test(a):a===s||a.startsWith(`${s}/`)}function y({className:a}){const s=p(),[o,n]=l.useState(!1),x=l.useMemo(()=>[...i].sort((t,r)=>r.to.length-t.to.length).find(t=>d(s.pathname,t.to))??i[0],[s.pathname]);return l.useEffect(()=>{if(!o)return;const t=document.body.style.overflow,r=h=>{h.key==="Escape"&&n(!1)};return document.body.style.overflow="hidden",window.addEventListener("keydown",r),()=>{document.body.style.overflow=t,window.removeEventListener("keydown",r)}},[o]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{className:c("overflow-hidden bg-[linear-gradient(180deg,rgba(15,24,31,0.94),rgba(10,18,25,0.92))] p-2",a),children:[e.jsx("div",{className:"hidden items-center gap-3 lg:flex",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(t=>e.jsxs(m,{to:t.to,end:t.to==="/projects",className:({isActive:r})=>c("inline-flex items-center gap-2 whitespace-nowrap rounded-full px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",r||d(s.pathname,t.to)?"bg-[rgba(125,211,252,0.16)] text-[#c7f0ff]":"bg-white/[0.04] text-white/58 hover:bg-white/[0.08] hover:text-white"),children:[e.jsx(t.icon,{className:"size-3.5"}),e.jsx("span",{children:t.label})]},t.to))})}),e.jsx("div",{className:"flex items-center justify-between gap-3 lg:hidden",children:e.jsx("button",{type:"button",className:"inline-flex min-w-0 flex-1 items-center gap-3 rounded-[22px] border border-white/8 bg-[linear-gradient(180deg,rgba(19,28,42,0.96),rgba(11,17,30,0.94))] px-3.5 py-2.5 text-left shadow-[0_18px_38px_rgba(3,8,18,0.2)] transition hover:border-white/12",onClick:()=>n(!0),children:e.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-2xl border border-[rgba(125,211,252,0.2)] bg-[rgba(125,211,252,0.12)]",children:e.jsx(x.icon,{className:"size-4 text-[#c7f0ff]"})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-[10px] uppercase tracking-[0.18em] text-white/40",children:"Project management"}),e.jsx("span",{className:"mt-0.5 block truncate text-sm font-medium text-white",children:x.label})]})]})})})]}),o&&typeof document<"u"?w.createPortal(e.jsxs("div",{className:"lg:hidden",children:[e.jsx("div",{className:"fixed inset-0 z-50 bg-[rgba(5,10,18,0.78)] backdrop-blur-xl"}),e.jsx("button",{type:"button","aria-label":"Close project management sections",className:"fixed inset-0 z-[51]",onClick:()=>n(!1)}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-[52] flex items-end justify-center px-3 pt-3 sm:px-4 sm:pt-4",style:{paddingBottom:"calc(var(--forge-mobile-nav-clearance) - 0.25rem)"},children:e.jsxs("div",{className:"pointer-events-auto flex max-h-[min(34rem,calc(100dvh-var(--forge-mobile-nav-clearance)-1rem))] w-full max-w-xl min-h-0 flex-col overflow-hidden rounded-[30px] border border-white/10 bg-[radial-gradient(circle_at_top,rgba(125,211,252,0.12),transparent_40%),linear-gradient(180deg,rgba(18,27,42,0.98),rgba(10,15,28,0.98))] shadow-[0_36px_110px_rgba(3,8,18,0.5)]",children:[e.jsx("div",{className:"shrink-0 border-b border-white/8 px-4 pb-2.5 pt-3 sm:px-5",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[10px] uppercase tracking-[0.22em] text-white/38",children:"Forge PM"}),e.jsx("div",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-2",children:e.jsx("div",{className:"truncate text-[1.05rem] font-semibold text-white",children:"Browse the hierarchy"})})]}),e.jsx("button",{type:"button","aria-label":"Close project management sections",className:"inline-flex size-10 shrink-0 items-center justify-center rounded-full border border-white/8 bg-white/[0.05] text-white/65 transition hover:border-white/12 hover:bg-white/[0.09] hover:text-white",onClick:()=>n(!1),children:e.jsx(u,{className:"size-4"})})]})}),e.jsx("div",{className:"min-h-0 overflow-y-auto p-3 overscroll-contain sm:p-4",children:e.jsx("div",{className:"grid gap-2",children:i.map(t=>{const r=d(s.pathname,t.to);return e.jsx(m,{to:t.to,end:t.to==="/projects",onClick:()=>n(!1),className:c("group flex items-center justify-between gap-3 rounded-[22px] border px-3.5 py-3 transition hover:-translate-y-[1px] hover:text-white",r?"border-[rgba(125,211,252,0.18)] bg-[rgba(125,211,252,0.12)] text-white":"border-white/8 bg-white/[0.04] text-white/72 hover:border-white/12 hover:bg-white/[0.06]"),children:e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex size-10 items-center justify-center rounded-2xl border border-white/8 bg-white/[0.04]",children:e.jsx(t.icon,{className:"size-4"})}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]})},t.to)})})})]})})]}),document.body):null]})}export{y as P};
|