@wkoutre/teamwork-os 1.0.0 → 1.0.1
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/README.md +3 -2
- package/cli.jsc +0 -0
- package/dist/assets/AnalyticsPage-BoafbdRY.js +1 -0
- package/dist/assets/BriefsPage-BsBjNIJT.js +1 -0
- package/dist/assets/BriefsPage-C2lUZ05b.css +1 -0
- package/dist/assets/Button-BOCZ-tMU.css +1 -0
- package/dist/assets/Button-xBBZQ0ie.js +1 -0
- package/dist/assets/Card-Q-x7mRn3.css +1 -0
- package/dist/assets/Card-u29day7d.js +1 -0
- package/dist/assets/ChatPanel-BUNJ-rXp.js +29 -0
- package/dist/assets/ChatPanel-CK_zI3mg.css +1 -0
- package/dist/assets/ContinuousImprovementPage-DQDtZtX3.css +1 -0
- package/dist/assets/ContinuousImprovementPage-F6fizSUr.js +1 -0
- package/dist/assets/HeartbeatPanel-D5azjMkJ.css +1 -0
- package/dist/assets/HeartbeatPanel-q7mW5VDk.js +1 -0
- package/dist/assets/IdeasContainer-Cl1WkgLe.css +1 -0
- package/dist/assets/IdeasContainer-DDhsyl1f.js +3 -0
- package/dist/assets/Input-C6Eciq4Y.css +1 -0
- package/dist/assets/Input-HhV6M0tu.js +1 -0
- package/dist/assets/KpiTile-pXTBj77S.js +1 -0
- package/dist/assets/MemoryExplore-DXgmdeOp.css +1 -0
- package/dist/assets/MemoryExplore-wFiVBkXu.js +1 -0
- package/dist/assets/MemoryHygiene-C_lFMujk.js +2 -0
- package/dist/assets/MemoryHygiene-D9-lcjQc.css +1 -0
- package/dist/assets/MemoryInjections-CG5Jnfc2.css +1 -0
- package/dist/assets/MemoryInjections-F6D1_uAX.js +1 -0
- package/dist/assets/MemoryOverview-BG2lpis1.js +1 -0
- package/dist/assets/MemoryOverview-BuFrUzre.css +1 -0
- package/dist/assets/MemoryPage-DS6LWMdS.js +2 -0
- package/dist/assets/MemoryPage-DkvxMEXj.css +1 -0
- package/dist/assets/MemoryWiki-Mh-mjN1m.css +1 -0
- package/dist/assets/MemoryWiki-cypT6R3l.js +3 -0
- package/dist/assets/OrgPage-DP2-hcbf.js +33 -0
- package/dist/assets/OrgPage-nDdhTt3V.css +1 -0
- package/dist/assets/PipelinesPage-BzYkkX-n.js +1 -0
- package/dist/assets/PipelinesPage-VXjq7839.css +1 -0
- package/dist/assets/RelativeTime-CARWwY-H.js +1 -0
- package/dist/assets/ScheduleOptimizerPage-Cmje0CoX.js +10 -0
- package/dist/assets/SessionHistory-DwX-i9Io.js +2 -0
- package/dist/assets/SettingsPage-C6Xq22uB.js +49 -0
- package/dist/assets/SettingsRow-4w9Ab9mk.js +1 -0
- package/dist/assets/SupervisorDashboardPage-BEuElLHE.css +1 -0
- package/dist/assets/SupervisorDashboardPage-CrsOGBZ8.js +1 -0
- package/dist/assets/UsagePage-Cm8NsPw7.js +4 -0
- package/dist/assets/UsagePage-DlwHL1zI.css +1 -0
- package/dist/assets/dagre-CHpVij2M.css +1 -0
- package/dist/assets/dagre.esm-DBOl5nQa.js +7 -0
- package/dist/assets/events-CCBP4a9s.js +1 -0
- package/dist/assets/generateCategoricalChart-pfORgeJG.js +60 -0
- package/dist/assets/index-C57L9wdB.css +1 -0
- package/dist/assets/index-tOLuwPW6.js +93 -0
- package/dist/assets/jsx-runtime-Bq3x7umQ.js +1 -0
- package/dist/assets/lib-osArdP58.js +16 -0
- package/dist/assets/react-dom-Cnw6SoYl.js +8 -0
- package/dist/assets/shared-CHkcO7VT.css +1 -0
- package/dist/assets/shared-wI40KN7Y.js +1 -0
- package/dist/assets/styles-Ds5gMQAQ.js +1 -0
- package/dist/assets/types-CNhs8RVF.js +1 -0
- package/dist/assets/ui-Bx41p7g8.js +1 -0
- package/dist/assets/useGet-CU5_p7vA.js +1 -0
- package/dist/assets/useWebSocket-Hg3RO6sx.js +1 -0
- package/dist/assets/value-A1VqfRmL.js +1 -0
- package/dist/index.html +45 -0
- package/gateway.jsc +0 -0
- package/package.json +3 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{t as r}from"./react-dom-Cnw6SoYl.js";import{r as i}from"./useWebSocket-Hg3RO6sx.js";import{c as a,n as o}from"./styles-Ds5gMQAQ.js";import{C as s,f as c,g as l,h as u,m as d,p as f,t as p}from"./events-CCBP4a9s.js";import{a as m,c as h,i as g,l as _,n as v,o as y,r as b,s as x,u as S}from"./types-CNhs8RVF.js";import{n as C,t as w}from"./Input-HhV6M0tu.js";import{t as T}from"./Button-xBBZQ0ie.js";import{t as E}from"./RelativeTime-CARWwY-H.js";import{Ct as ee,Dt as D,Et as te,M as O,Mt as ne,Nt as k,O as re,Ot as ie,S as ae,St as oe,Tt as A,_ as se,_t as ce,b as le,bt as ue,d as de,g as fe,h as pe,j,v as me,wt as he,x as ge,xt as _e,y as ve}from"./index-tOLuwPW6.js";import{n as ye,t as be}from"./lib-osArdP58.js";import{t as M}from"./SettingsRow-4w9Ab9mk.js";import"./ui-Bx41p7g8.js";import{_ as xe,a as Se,g as Ce,h as we,i as Te,n as Ee,o as De,r as Oe,t as ke}from"./generateCategoricalChart-pfORgeJG.js";var Ae=new Set([`merged`,`done`,`archived`]),je=[`critical`,`high`,`medium`,`low`,`all`],Me=[`critical`,`high`,`medium`,`low`],N=t(e(),1),Ne={statuses:[],projects:[],priorities:[],sizes:[],autoHarvestedOnly:!1};function Pe(e){return e.statuses.length===0&&e.projects.length===0&&e.priorities.length===0&&e.sizes.length===0&&!e.autoHarvestedOnly}function Fe(e,t){return e.filter(e=>!(t.statuses.length>0&&!t.statuses.includes(e.status)||t.projects.length>0&&!t.projects.includes(e.project)||t.priorities.length>0&&!t.priorities.includes(e.priority)||t.sizes.length>0&&!t.sizes.includes(e.size)||t.autoHarvestedOnly&&e.createdBy!==`harvest`))}var Ie=`tos.ideas.view.v1`,Le=`tos.ideas.filters.v1`,Re=`tos.ideas.sort.v1`,ze=`tos.ideas.boardSort.v1`,Be=`tos.ideas.groupBy.v1`,Ve=`tos.ideas.density.v1`,He=`tos.ideas.listColumns.v1`,Ue=`tos.ideas.visibleColumns.v2`,We=[`board`,`list`],Ge=[`none`,`status`,`priority`,`project`],Ke=[`comfortable`,`compact`],qe=[`low`,`normal`,`high`],Je=[`feature`,`epic`],Ye=[`draft`,`ready`,`in_progress`,`awaiting_input`,`opened`,`changes_requested`,`merged`,`closed`,`blocked`,`done`,`archived`];function Xe(e,t){console.warn(`tos:ideas`,`Malformed localStorage key ${e}, reset to defaults${t?` (${t})`:``}`)}function Ze(e,t,n){try{let r=localStorage.getItem(e);if(r==null)return n;let i=JSON.parse(r);return t(i)?i:(Xe(e,`shape rejected`),n)}catch(t){return Xe(e,t.message),n}}function Qe(){let e=localStorage.getItem(Ie);return e==null?`board`:We.includes(e)?e:(Xe(Ie),`board`)}function $e(e){localStorage.setItem(Ie,e)}function et(){return Ze(Le,nt,Ne)}function tt(e){localStorage.setItem(Le,JSON.stringify(e))}function nt(e){if(!e||typeof e!=`object`)return!1;let t=e;return Array.isArray(t.statuses)&&t.statuses.every(e=>Ye.includes(e))&&Array.isArray(t.projects)&&t.projects.every(e=>typeof e==`string`)&&Array.isArray(t.priorities)&&t.priorities.every(e=>qe.includes(e))&&Array.isArray(t.sizes)&&t.sizes.every(e=>Je.includes(e))}var rt={columnId:`createdAt`,direction:`desc`};function it(){return Ze(Re,ot,rt)}function at(e){localStorage.setItem(Re,JSON.stringify(e))}function ot(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.columnId==`string`&&(t.direction===`asc`||t.direction===`desc`)}var st=[`updatedAt`,`statusUpdatedAt`,`createdAt`,`priority`,`title`],ct={key:`updatedAt`,direction:`desc`};function lt(){return Ze(ze,dt,ct)}function ut(e){localStorage.setItem(ze,JSON.stringify(e))}function dt(e){if(!e||typeof e!=`object`)return!1;let t=e;return st.includes(t.key)&&(t.direction===`asc`||t.direction===`desc`)}function ft(){let e=localStorage.getItem(Be);return e==null?`none`:Ge.includes(e)?e:(Xe(Be),`none`)}function pt(e){localStorage.setItem(Be,e)}function mt(){let e=localStorage.getItem(Ve);return e==null?`comfortable`:Ke.includes(e)?e:(Xe(Ve),`comfortable`)}function ht(e){localStorage.setItem(Ve,e)}function gt(){return Ze(He,vt,{})}function _t(e){localStorage.setItem(He,JSON.stringify(e))}function vt(e){return!e||typeof e!=`object`?!1:Object.values(e).every(e=>typeof e==`boolean`)}function yt(){try{let e=localStorage.getItem(Ue);if(e==null)return null;let t=JSON.parse(e);return!Array.isArray(t)||!t.every(e=>typeof e==`string`)?(Xe(Ue),null):t}catch{return Xe(Ue),null}}function bt(e){localStorage.setItem(Ue,JSON.stringify(e))}var xt=`tos.ideas.viewHelper.dismissed.v1`,St={sectionLabel:`_sectionLabel_1h68k_7`,row:`_row_1h68k_16`,rowLabel:`_rowLabel_1h68k_27`},P=n(),Ct=[{value:`updatedAt`,label:`Last updated`},{value:`statusUpdatedAt`,label:`Status updated`},{value:`createdAt`,label:`Created`},{value:`priority`,label:`Priority`},{value:`title`,label:`Title`}],wt=Object.fromEntries(Ct.map(e=>[e.value,e.label])),Tt=[{value:`asc`,label:`Asc`},{value:`desc`,label:`Desc`}];function Et({sort:e,onChange:t}){return(0,P.jsxs)(pe,{triggerIcon:(0,P.jsx)(Dt,{}),triggerLabel:wt[e.key],triggerAriaLabel:`Sort: ${wt[e.key]} ${e.direction===`asc`?`ascending`:`descending`}`,triggerSuffix:(0,P.jsx)(Ot,{direction:e.direction}),size:`narrow`,children:[(0,P.jsx)(`header`,{className:St.sectionLabel,children:`Sort by`}),(0,P.jsx)(fe,{children:Ct.map(n=>(0,P.jsx)(se,{label:n.label,active:e.key===n.value,onClick:()=>t({key:n.value,direction:e.direction})},n.value))}),(0,P.jsxs)(`div`,{className:St.row,children:[(0,P.jsx)(`span`,{className:St.rowLabel,children:`Direction`}),(0,P.jsx)(me,{ariaLabel:`Sort direction`,value:e.direction,options:Tt,onChange:n=>t({key:e.key,direction:n})})]})]})}function Dt(){return(0,P.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,children:[(0,P.jsx)(`path`,{d:`M2 3.5h7M2 7h5M2 10.5h3`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`}),(0,P.jsx)(`path`,{d:`M11 3.5v7m0 0l-2-2m2 2l2-2`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function Ot({direction:e}){return(0,P.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:e===`asc`?`M2.5 6.5L5 4l2.5 2.5`:`M2.5 3.5L5 6l2.5-2.5`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function kt(e,t){if(!e.blockedBy||e.blockedBy.length===0)return 0;let n=new Map(t.map(e=>[e.id,e])),r=0;for(let t of e.blockedBy){let e=n.get(t);(!e||!Ae.has(e.status))&&(r+=1)}return r}function At(e){return e.prUrl?e.prMergedAt?`merged`:e.prClosedAt?`closed`:e.status===`changes_requested`?`changes_requested`:`opened`:null}var jt={high:0,normal:1,low:2},Mt={merged:0,changes_requested:1,opened:2,closed:3,none:4},Nt=[{id:`title`,label:`Title`,sortKey:e=>e.title.toLowerCase(),defaultVisible:!0,pinned:!0,renderCell:e=>(0,P.jsx)(`span`,{children:e.title})},{id:`status`,label:`Status`,sortKey:e=>e.status,defaultVisible:!0,pinned:!0,renderCell:()=>null},{id:`priority`,label:`Priority`,sortKey:e=>jt[e.priority]??99,defaultVisible:!0,pinned:!0,renderCell:()=>null},{id:`project`,label:`Project`,sortKey:e=>e.project,defaultVisible:!0,renderCell:e=>(0,P.jsx)(`span`,{title:e.project,"data-meta":`project`,children:e.project})},{id:`size`,label:`Size`,sortKey:e=>e.size,defaultVisible:!1,renderCell:e=>(0,P.jsx)(`span`,{"data-meta":`size`,children:e.size})},{id:`createdAt`,label:`Created`,sortKey:e=>Date.parse(e.createdAt)||0,defaultVisible:!0,renderCell:e=>(0,P.jsx)(`span`,{title:new Date(e.createdAt).toLocaleString(),"data-meta":`created`,children:Rt(e.createdAt)})},{id:`blockers`,label:`Blockers`,sortKey:e=>0,defaultVisible:!1,renderCell:(e,t)=>{let n=kt(e,t.allIdeas);return n===0?null:(0,P.jsxs)(`span`,{title:e.blockedBy.join(`, `),"data-meta":`blockers`,children:[(0,P.jsx)(Ut,{}),` `,n]})}},{id:`pr`,label:`PR`,sortKey:e=>Mt[At(e)??`none`]??4,defaultVisible:!0,renderCell:e=>{let t=At(e);return t?(0,P.jsx)(`span`,{"data-meta":`pr`,"data-pr-state":t,children:Lt(t)}):null}},{id:`autoMerge`,label:`Auto-merge`,sortKey:null,defaultVisible:!0,renderCell:e=>(0,P.jsx)(`span`,{"data-meta":`auto-merge`,"data-auto-merge":e.autoMerge?`on`:`off`,"aria-label":e.autoMerge?`auto-merge on`:`auto-merge off`,title:e.autoMerge?`Auto-merge enabled`:`Auto-merge disabled`,children:(0,P.jsx)(Wt,{on:e.autoMerge})})},{id:`autoFixCI`,label:`Auto-fix`,sortKey:null,defaultVisible:!1,renderCell:e=>{let t=e.autoFixCI!==!1;return(0,P.jsxs)(`span`,{"aria-label":t?`auto-fix on`:`auto-fix off`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,children:t?`●`:`○`}),(0,P.jsx)(`span`,{className:`visually-hidden`,children:t?`auto-fix on`:`auto-fix off`})]})}}];function Pt(){return Nt.filter(e=>e.defaultVisible).map(e=>e.id)}function Ft(){return new Set(Nt.filter(e=>e.pinned).map(e=>e.id))}function It(){return Nt.filter(e=>!e.pinned)}function Lt(e){return e===`changes_requested`?`changes`:e}function Rt(e){let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.floor((Date.now()-t)/864e5);return n<1?`today`:n===1?`1d`:n<30?`${n}d`:n<365?`${Math.floor(n/30)}mo`:`${Math.floor(n/365)}y`}function zt(e,t){return kt(e,t)}function Bt(e){let t=Vt(e);if(!t)return 0;let n=Date.parse(t);return Number.isNaN(n)?0:n}function Vt(e){switch(e.status){case`merged`:return e.prMergedAt??e.updatedAt??e.createdAt;case`closed`:return e.prClosedAt??e.updatedAt??e.createdAt;case`ready`:return e.promotedAt??e.updatedAt??e.createdAt;default:return e.updatedAt??e.createdAt}}function Ht(e,t){return e===`statusUpdatedAt`?Bt:e===`blockers`?e=>zt(e,t):Nt.find(t=>t.id===e)?.sortKey??null}function Ut(){return(0,P.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:`M3 3l6 6M3 9l6-6`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`})})}function Wt({on:e}){return e?(0,P.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`circle`,{cx:`5`,cy:`5`,r:`4`,fill:`currentColor`})}):(0,P.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`circle`,{cx:`5`,cy:`5`,r:`3.5`,stroke:`currentColor`,strokeWidth:`1`})})}var Gt={high:0,normal:1,low:2};function Kt(e){if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t}function qt(e,t){switch(t){case`updatedAt`:return Kt(e.updatedAt??e.createdAt);case`statusUpdatedAt`:return Bt(e);case`createdAt`:return Kt(e.createdAt);case`priority`:return Gt[e.priority]??99;case`title`:return e.title.toLowerCase()}}function Jt(e,t){let n=t.direction===`asc`?1:-1;return[...e].sort((e,r)=>{let i=qt(e,t.key),a=qt(r,t.key);return i<a?-1*n:i>a?1*n:0})}var Yt=new Set([`static`,`runtime-api`,`runtime-ui`,`runtime-cron`,`behavioral-manual`]),Xt=new Set([`verified`,`failed`,`unverifiable`]);function Zt(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.acIndex==`number`&&Number.isInteger(t.acIndex)&&t.acIndex>=0&&typeof t.acText==`string`&&typeof t.acKind==`string`&&Yt.has(t.acKind)&&typeof t.verdict==`string`&&Xt.has(t.verdict)&&typeof t.reason==`string`}function Qt(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.ideaId!=`string`||!Array.isArray(t.verdicts)?!1:t.verdicts.every(Zt)}function $t(e){let[t,n]=(0,N.useState)([]),[r,a]=(0,N.useState)(null),[o,c]=(0,N.useState)(e!==null),[l,u]=(0,N.useState)(null);(0,N.useEffect)(()=>{if(!e)return;let t=new AbortController;return c(!0),u(null),fetch(`/api/ideas/${encodeURIComponent(e)}/verifications`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} ${e.statusText||``}`.trim());return await e.json()}).then(e=>{n(e.verdicts),a(e.phaseOutcome),c(!1)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||(u(e instanceof Error?e.message:String(e)),c(!1))}),()=>t.abort()},[e]),i(s,(0,N.useCallback)(t=>{Qt(t)&&t.ideaId===e&&n(t.verdicts)},[e]));let d=(0,N.useRef)(null);return i(`ws:reconnected`,(0,N.useCallback)(()=>{if(!e)return;d.current?.abort();let t=new AbortController;d.current=t,fetch(`/api/ideas/${encodeURIComponent(e)}/verifications`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return await e.json()}).then(e=>{n(e.verdicts),a(e.phaseOutcome)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||u(e instanceof Error?e.message:String(e))})},[e])),(0,N.useEffect)(()=>()=>{d.current?.abort()},[]),{verdicts:t,phaseOutcome:r,isLoading:o,error:l}}function en(e){if(e.length===0)return null;if(e.every(e=>e.verdict===`unverifiable`))return{label:`needs manual`,status:`needs-manual`};let t=e.filter(e=>e.verdict===`verified`).length;return{label:`${t}/${e.length} verified`,status:t===e.length?`pass`:`partial`}}function tn({ideaId:e}){let{verdicts:t}=$t(e),n=en(t);return n?(0,P.jsx)(`span`,{className:`idea-verif-summary`,"data-status":n.status,children:n.label}):null}var nn={badge:`_badge_nyr3s_1`,dots:`_dots_nyr3s_30`,dot:`_dot_nyr3s_30`,phasePulse:`_phasePulse_nyr3s_1`,label:`_label_nyr3s_63`},rn={brainstorming:`Brainstorming`,"writing-plans":`Writing plans`,implementing:`Implementing`,reviewing:`Reviewing`},an=y;function on(e,t,n){return e?t<n?`past`:t===n?`active`:`future`:`idle`}function sn({phase:e}){let t=e?an.indexOf(e):-1,n=t!==-1,r=e?rn[e]:`between phases`,i=e?`Pipeline phase: ${rn[e]} (step ${t+1} of ${an.length})`:`Pipeline running, between phases`;return(0,P.jsxs)(`div`,{className:nn.badge,"data-active":n?`true`:`false`,role:`img`,"aria-label":i,title:i,children:[(0,P.jsx)(`span`,{className:nn.dots,"aria-hidden":`true`,children:an.map((e,r)=>(0,P.jsx)(`span`,{className:nn.dot,"data-state":on(n,r,t)},e))}),(0,P.jsx)(`span`,{className:nn.label,children:r})]})}var cn={elapsed:`_elapsed_1ydki_1`};function ln({startedAt:e,now:t}){let[,n]=(0,N.useState)(0);(0,N.useEffect)(()=>{if(t!==void 0)return;let e=setInterval(()=>n(e=>e+1),6e4);return()=>clearInterval(e)},[t]);let r=t??Date.now(),i=Date.parse(e),a=ce(Number.isNaN(i)?0:Math.max(0,Math.floor((r-i)/1e3)));return(0,P.jsx)(`span`,{className:cn.elapsed,"aria-label":`Running for ${a}`,children:a})}var un={blockedBy:`Blocked by`,blocks:`Blocks`,relatesTo:`Relates to`};function dn(e){return e.replace(/^ide-\d{4}-\d{2}-\d{2}-/,``)}function fn(e,t,n){if(n)return e===t?`self`:n.has(e)?`related`:`unrelated`}function pn({kind:e,idea:t,ideaIndex:n,onSelect:r}){let i=t[e];return i.length===0?null:(0,P.jsxs)(`div`,{className:`idea-relation-group`,"data-kind":e,children:[(0,P.jsx)(`span`,{className:`idea-relation-group-label`,children:un[e]}),(0,P.jsx)(`ul`,{className:`idea-relation-list`,children:i.map(e=>{let t=n.get(e),i=t?.status??`unknown`,a=dn(e);return(0,P.jsx)(`li`,{className:`idea-relation-row`,"data-status":i,children:(0,P.jsxs)(`button`,{type:`button`,className:`idea-relation-button`,onClick:t=>{t.stopPropagation(),r(e)},disabled:!t,title:t?`${e} - ${t.title}`:`${e} (not found)`,children:[(0,P.jsx)(`span`,{className:`idea-relation-dot`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`idea-relation-slug`,children:a}),(0,P.jsx)(`span`,{className:`idea-relation-title`,children:t?t.title:`(unknown)`})]})},e)})})]})}function mn(e){let t=new Map;for(let n of e)t.set(n.id,n);let n=new Map,r=new Set;for(let i of e){if(i.size!==`epic`||i.blockedBy.length===0)continue;let e=[],a=new Set;for(let n of i.blockedBy){let r=t.get(n);r&&(e.push(r),a.add(r.id))}if(e.length===0)continue;let o=hn(e,a),s=0;for(let e of o)Ae.has(e.status)&&(s+=1),r.add(e.id);n.set(i.id,{ordered:o,doneCount:s,totalCount:o.length})}return{byEpicId:n,childIds:r}}function hn(e,t){let n=[...e].sort((e,t)=>e.id<t.id?-1:+(e.id>t.id)),r=new Map;for(let e of n){let n=0;for(let r of e.blockedBy)t.has(r)&&(n+=1);r.set(e.id,n)}let i=[],a=new Map;for(let e of n)a.set(e.id,e);for(;a.size>0;){let e=n.filter(e=>a.has(e.id)&&(r.get(e.id)??0)===0);if(e.length===0){console.warn(`[epicChildren] cycle detected among siblings; emitting remainder in id order`,{remaining:Array.from(a.keys())});for(let e of n)a.has(e.id)&&(i.push(e),a.delete(e.id));break}for(let t of e)i.push(t),a.delete(t.id);for(let t of e)for(let e of n)a.has(e.id)&&e.blockedBy.includes(t.id)&&r.set(e.id,(r.get(e.id)??0)-1)}return i}var gn={glyph:`_glyph_12z6u_1`,faded:`_faded_12z6u_9`,glyphPulse:`_glyphPulse_12z6u_1`},_n={draft:{shape:`dashed`,color:`var(--color-text-subtle)`},ready:{shape:`empty`,color:`var(--color-text-muted)`},in_progress:{shape:`wedge`,wedge:.6,color:`var(--color-primary)`,pulse:!0},awaiting_input:{shape:`wedge`,wedge:.4,color:`var(--color-warning)`,pulse:!0},opened:{shape:`wedge`,wedge:.5,color:`var(--color-info)`},changes_requested:{shape:`wedge`,wedge:.75,color:`var(--color-warning)`},blocked:{shape:`wedge`,wedge:.5,color:`var(--color-negative)`},merged:{shape:`check`,color:`var(--color-primary)`},done:{shape:`check`,color:`var(--color-positive)`},closed:{shape:`x`,color:`var(--color-text-subtle)`},archived:{shape:`x`,color:`var(--color-text-subtle)`,faded:!0}},F={draft:`Draft`,ready:`Ready`,in_progress:`In progress`,awaiting_input:`Awaiting input`,opened:`PR open`,changes_requested:`Changes requested`,blocked:`Blocked`,merged:`Merged`,done:`Done`,closed:`Closed`,archived:`Archived`};function vn({status:e,size:t=16,staticOnly:n,decorative:r=!0,className:i}){let a=_n[e],o=F[e],s=r?{"aria-hidden":!0}:{role:`img`,"aria-label":o};return(0,P.jsx)(`span`,{className:[gn.glyph,a.faded?gn.faded:``,i].filter(Boolean).join(` `),style:{color:a.color,width:t,height:t},"data-status":e,"data-pulse":a.pulse&&!n?`on`:void 0,...s,children:(0,P.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,focusable:`false`,children:yn(a)})})}function yn(e){switch(e.shape){case`dashed`:return(0,P.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeDasharray:`2.2 2.6`});case`empty`:return(0,P.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`,stroke:`currentColor`,strokeWidth:`1.6`});case`wedge`:return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`,stroke:`currentColor`,strokeWidth:`1.6`}),(0,P.jsx)(`path`,{d:bn(12,12,6.4,e.wedge??.5),fill:`currentColor`})]});case`check`:return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`,fill:`currentColor`}),(0,P.jsx)(`path`,{d:`M8.4 12.4l2.6 2.6L16 9.4`,stroke:`var(--color-bg)`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})]});case`x`:return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`,fill:`currentColor`}),(0,P.jsx)(`path`,{d:`M9 9l6 6M15 9l-6 6`,stroke:`var(--color-bg)`,strokeWidth:`1.8`,strokeLinecap:`round`})]})}}function bn(e,t,n,r){let i=Math.max(0,Math.min(1,r));if(i<=0)return``;if(i>=1)return`M ${e} ${t-n} A ${n} ${n} 0 1 1 ${e-.001} ${t-n} Z`;let a=i*2*Math.PI,o=e+n*Math.sin(a),s=t-n*Math.cos(a),c=+(i>.5);return`M ${e} ${t} L ${e} ${t-n} A ${n} ${n} 0 ${c} 1 ${o} ${s} Z`}function xn({childSet:e,onSelect:t}){let{ordered:n,doneCount:r,totalCount:i}=e,a=r===i&&i>0,o=i===0?0:Math.round(r/i*100);return(0,P.jsxs)(`div`,{className:`idea-subtasks`,"data-complete":a?`true`:void 0,children:[(0,P.jsxs)(`div`,{className:`idea-subtasks-header`,children:[(0,P.jsx)(`span`,{className:`idea-subtasks-label`,children:`Subtasks`}),(0,P.jsxs)(`span`,{className:`idea-subtasks-progress`,"data-complete":a?`true`:void 0,title:`${r} of ${i} subtasks complete`,"aria-label":`${r} of ${i} subtasks complete`,children:[r,` / `,i]})]}),(0,P.jsx)(`div`,{className:`idea-subtasks-bar`,role:`progressbar`,"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":i,"aria-label":`Subtask progress: ${r} of ${i}`,children:(0,P.jsx)(`span`,{className:`idea-subtasks-bar-fill`,style:{width:`${o}%`}})}),(0,P.jsx)(`ul`,{className:`idea-subtasks-list`,children:n.map(e=>{let n=dn(e.id);return(0,P.jsx)(`li`,{className:`idea-subtasks-row`,"data-status":e.status,children:(0,P.jsxs)(`button`,{type:`button`,className:`idea-subtasks-button`,onClick:n=>{n.stopPropagation(),t(e.id)},title:`${e.id} — ${F[e.status]}`,children:[(0,P.jsx)(vn,{status:e.status,size:12,staticOnly:!0}),(0,P.jsx)(`span`,{className:`idea-subtasks-slug`,children:n}),(0,P.jsx)(`span`,{className:`idea-subtasks-title`,children:e.title})]})},e.id)})})]})}var Sn=`ideas:hideEmptyColumns`;function Cn(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(Sn)===`1`}catch{return!1}}var wn=[{key:`draft`,label:`Draft`},{key:`ready`,label:`Ready`},{key:`in_progress`,label:`In Progress`},{key:`awaiting_input`,label:`Awaiting Input`},{key:`opened`,label:`Opened`},{key:`changes_requested`,label:`Changes Requested`},{key:`blocked`,label:`Blocked`},{key:`merged`,label:`Merged`,collapsed:!0},{key:`closed`,label:`Closed`,collapsed:!0},{key:`archived`,label:`Archived`,collapsed:!0}];function Tn({ideas:e,runningPhases:t,pipelineFeatures:n,onPromote:r,onStart:i,onOpenTimeline:a,onOpenSettings:o,onOpenReconciler:s,reconcilerHasError:c,onOpenProfiles:l,onOpenUsage:u,onRepromote:d,onArchive:f,headerSlot:p,boardSort:m=ct,onBoardSortChange:h}){let[g,_]=(0,N.useState)(()=>new Set(wn.filter(e=>e.collapsed).map(e=>e.key))),[v,y]=(0,N.useState)(()=>Cn()),[b,x]=(0,N.useState)(null),[S,C]=(0,N.useState)(null),w=e=>{if(typeof navigator>`u`||!navigator.clipboard){window.prompt(`Copy idea id:`,e);return}navigator.clipboard.writeText(e).then(()=>{C(e),window.setTimeout(()=>{C(t=>t===e?null:t)},1200)},e=>{console.warn(`[ideas] clipboard write failed`,e)})},T=(0,N.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n);return t},[e]),E=(0,N.useMemo)(()=>{if(!b)return null;let e=T.get(b);if(!e)return null;let t=new Set;for(let n of e.blockedBy)t.add(n);for(let n of e.blocks)t.add(n);for(let n of e.relatesTo)t.add(n);return t.size>0?t:null},[b,T]),ee=(0,N.useMemo)(()=>mn(e),[e]);(0,N.useEffect)(()=>{let e=()=>y(Cn());return window.addEventListener(`storage`,e),window.addEventListener(`ideas:settingsChanged`,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(`ideas:settingsChanged`,e)}},[]);let D=e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},te=e.filter(e=>e.status!==`merged`&&e.status!==`closed`&&e.status!==`archived`).length,O=v?wn.filter(t=>e.some(e=>e.status===t.key)):wn;return(0,P.jsxs)(`div`,{className:`ideas-page`,children:[(0,P.jsxs)(`header`,{className:`ideas-header`,children:[(0,P.jsxs)(`div`,{className:`ideas-header-title`,children:[(0,P.jsx)(`h1`,{children:`Ideas`}),(0,P.jsxs)(`span`,{className:`ideas-header-count`,children:[te,` active`]})]}),(0,P.jsxs)(`div`,{className:`ideas-header-actions`,children:[h&&(0,P.jsx)(Et,{sort:m,onChange:h}),u&&(0,P.jsx)(`button`,{type:`button`,className:`ideas-header-button`,"aria-label":`Open usage dashboard`,title:`Usage`,onClick:u,children:`Usage`}),s&&(0,P.jsxs)(`button`,{type:`button`,className:`ideas-header-button`,onClick:s,"aria-label":c?`Open PR reconciler (last run had an error)`:`Open PR reconciler`,title:c?`PR Reconciler (last run had an error)`:`PR Reconciler`,children:[(0,P.jsx)(`span`,{children:`PR Reconciler`}),c&&(0,P.jsx)(`span`,{className:`ideas-header-button-dot`,"data-testid":`reconciler-error-dot`,"aria-hidden":`true`})]}),l&&(0,P.jsx)(`button`,{type:`button`,className:`ideas-header-button`,onClick:l,"aria-label":`Open project profiles`,title:`Project Profiles`,children:(0,P.jsx)(`span`,{children:`Profiles`})}),o&&(0,P.jsxs)(`button`,{type:`button`,className:`ideas-settings-button`,onClick:o,"aria-label":`Open ideas settings`,title:`Settings`,children:[(0,P.jsx)(ue,{size:16}),(0,P.jsx)(`span`,{children:`Settings`})]})]})]}),p,(0,P.jsx)(`div`,{className:`ideas-board`,role:`list`,"aria-label":`Ideas kanban board`,children:O.map(o=>{let s=Jt(e.filter(e=>e.status===o.key),m),c=o.collapsed!==void 0,l=g.has(o.key);return(0,P.jsxs)(`section`,{className:[`ideas-column`,l?`ideas-column--collapsed`:``,s.length===0&&!l?`ideas-column--empty`:``].filter(Boolean).join(` `),"data-status":o.key,role:`listitem`,children:[(0,P.jsxs)(`header`,{className:`ideas-column-header`,children:[(0,P.jsxs)(`div`,{className:`ideas-column-title`,children:[(0,P.jsx)(`span`,{className:`ideas-column-dot`,"aria-hidden":`true`}),(0,P.jsx)(`h2`,{children:o.label}),(0,P.jsx)(`span`,{className:`ideas-count`,children:s.length})]}),c&&(0,P.jsx)(`button`,{type:`button`,className:`ideas-column-toggle`,onClick:()=>D(o.key),"aria-label":l?`Expand ${o.label}`:`Collapse ${o.label}`,"aria-expanded":!l,children:(0,P.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:l?`M5 3l4 4-4 4`:`M3 5l4 4 4-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})})]}),!l&&(0,P.jsx)(`ul`,{className:`ideas-column-list`,children:s.length===0?(0,P.jsx)(`li`,{className:`ideas-empty`,"aria-hidden":`true`,children:`No ideas`}):s.map(o=>{let s=o.blockedBy.length>0||o.blocks.length>0||o.relatesTo.length>0,c=fn(o.id,b,E),l=kt(o,e),u=o.status===`ready`&&l>0,p=()=>{s&&x(o.id)},m=()=>{b===o.id&&x(null)};return(0,P.jsxs)(`li`,{className:`idea-card`,"data-idea-id":o.id,"data-relation-state":c,"data-blocked":u?`true`:void 0,onMouseEnter:p,onMouseLeave:m,onFocus:p,onBlur:m,children:[(0,P.jsx)(`button`,{type:`button`,className:`idea-card-copy-uid`,onClick:e=>{e.stopPropagation(),w(o.id)},"aria-label":S===o.id?`Copied ${o.id}`:`Copy idea id ${o.id}`,title:S===o.id?`Copied!`:`Copy id: ${o.id}`,"data-copied":S===o.id?`true`:void 0,children:S===o.id?(0,P.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:`M3.5 8.5l3 3 6-6`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`})}):(0,P.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,P.jsx)(`rect`,{x:`5`,y:`5`,width:`8.5`,height:`8.5`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,P.jsx)(`path`,{d:`M3.5 10.5V3.5a1 1 0 0 1 1-1h7`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}),(0,P.jsxs)(`button`,{className:`idea-card-body`,onClick:()=>a(o.id),type:`button`,children:[(0,P.jsx)(`h3`,{children:o.title}),(0,P.jsxs)(`div`,{className:`idea-meta-row`,children:[(0,P.jsxs)(`span`,{className:`idea-meta-chip idea-meta-chip--project`,children:[o.project,!o.resolvedProjectPath&&(0,P.jsx)(`span`,{className:`idea-project-unresolved`,title:`Cannot resolve project path for "${o.project}". Click the card to fix.`,"aria-label":`Project path unresolved`,children:`!`})]}),(0,P.jsx)(`span`,{className:`idea-meta-chip`,children:o.size}),(0,P.jsx)(`span`,{className:`idea-meta-chip idea-priority idea-priority--${o.priority}`,children:o.priority}),o.autoMerge===!1&&(0,P.jsx)(`span`,{className:`autoMergeOffBadge`,title:`Auto-merge disabled; operator merges manually`,"aria-label":`Auto-merge off`,children:`manual`})]}),(0,P.jsx)(tn,{ideaId:o.id}),(()=>{let e=o.status===`in_progress`,r=o.status===`opened`||o.status===`changes_requested`;if(!e&&!r)return null;let i=t?.get(o.id)??null;if(r&&!i)return null;let a=o.reviewSeverityFloor??n?.review.arguments?.[`review-fix-loop`]?.severityFloor??`all`;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`idea-card-phase-row`,children:[(0,P.jsx)(sn,{phase:i?.phase??null}),i?.startedAt&&(0,P.jsx)(ln,{startedAt:i.startedAt})]}),e&&a!==`all`&&(0,P.jsxs)(`span`,{className:`idea-floor-chip`,children:[`Floor: `,a]})]})})(),u&&(0,P.jsxs)(`span`,{className:`idea-blocked-chip`,title:`Queued; waiting on ${l} blocker${l===1?``:`s`} to reach a terminal status`,"aria-label":`Queued; waiting on ${l} blocker${l===1?``:`s`}`,children:[`Queued · waiting on `,l]}),o.status===`merged`&&o.prMergedAt&&(0,P.jsxs)(`p`,{className:`idea-meta idea-meta--timestamp`,children:[`merged `,new Date(o.prMergedAt).toLocaleDateString()]}),o.status===`closed`&&o.prClosedAt&&(0,P.jsxs)(`p`,{className:`idea-meta idea-meta--timestamp`,children:[`closed `,new Date(o.prClosedAt).toLocaleDateString()]})]}),(()=>{let e=ee.byEpicId.get(o.id),t=e!==void 0;return s||t?(0,P.jsxs)(`div`,{className:`idea-card-relations`,"data-has-subtasks":t?`true`:void 0,role:`group`,"aria-label":`Relationships`,children:[t?(0,P.jsx)(xn,{childSet:e,onSelect:a}):(0,P.jsx)(pn,{kind:`blockedBy`,idea:o,ideaIndex:T,onSelect:a}),(0,P.jsx)(pn,{kind:`blocks`,idea:o,ideaIndex:T,onSelect:a}),(0,P.jsx)(pn,{kind:`relatesTo`,idea:o,ideaIndex:T,onSelect:a})]}):null})(),(o.status===`draft`||o.status===`ready`||o.status===`closed`||o.status===`changes_requested`||o.prUrl)&&(0,P.jsxs)(`div`,{className:`idea-card-actions`,children:[o.status===`draft`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{onClick:()=>r(o.id),type:`button`,className:`idea-action idea-action--primary`,title:o.size===`epic`?`Promote this epic and all draft descendants to ready`:`Mark this idea ready`,children:o.size===`epic`&&o.blockedBy.length>0?`Cascade to ${o.blockedBy.length} child${o.blockedBy.length===1?``:`ren`}`:`Mark Ready`}),(0,P.jsx)(`button`,{onClick:()=>f(o.id),type:`button`,className:`idea-action`,title:`Archive this draft`,children:`Archive`})]}),o.status===`ready`&&(0,P.jsx)(`button`,{onClick:()=>i(o.id),type:`button`,className:`idea-action idea-action--primary`,children:`Start Now`}),(o.status===`closed`||o.status===`changes_requested`)&&(0,P.jsx)(`button`,{onClick:()=>d(o.id),type:`button`,className:`idea-action idea-action--repromote`,children:`Re-promote`}),o.prUrl&&(0,P.jsx)(`a`,{href:o.prUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`View PR`,className:`idea-action idea-action--link`,onClick:e=>e.stopPropagation(),children:`PR ↗`})]})]},o.id)})})]},o.key)})})]})}var En=300;function Dn({ideaId:e,currentProject:t,onResolved:n}){let[r,i]=(0,N.useState)(t),[s,c]=(0,N.useState)([]),[l,u]=(0,N.useState)(!1),[d,f]=(0,N.useState)(null),[p,m]=(0,N.useState)(!1),h=(0,N.useRef)(null),g=(0,N.useCallback)(async e=>{try{let t=await fetch(`/api/projects/completions?q=${encodeURIComponent(e)}`);if(!t.ok)return;let n=await t.json();c(n.completions),u(n.completions.length>0)}catch{}},[]),_=(0,N.useCallback)(e=>{let t=e.target.value;i(t),f(null),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{g(t)},En)},[g]),v=(0,N.useCallback)(async t=>{u(!1),m(!0),f(null);try{let r=await fetch(`/api/ideas/${e}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({projectPath:t})});if(!r.ok){f((await r.json()).error??`Failed to save path`);return}i(t),n()}catch{f(`Network error — please try again`)}finally{m(!1)}},[e,n]),y=(0,N.useCallback)(e=>{e.key===`Escape`&&u(!1)},[]);return(0,N.useEffect)(()=>()=>{h.current&&clearTimeout(h.current)},[]),(0,P.jsxs)(`div`,{style:{position:`relative`,flex:1},children:[(0,P.jsx)(`input`,{type:`text`,value:r,onChange:_,onKeyDown:y,onBlur:()=>{setTimeout(()=>u(!1),150)},disabled:p,placeholder:`Type project name or absolute path...`,style:{width:`100%`,background:`rgba(139, 148, 158, 0.08)`,border:`1px solid ${o.border}`,borderRadius:4,padding:`3px 8px`,color:o.text,fontFamily:a,fontSize:11,boxSizing:`border-box`}}),d&&(0,P.jsx)(`p`,{style:{margin:`4px 0 0`,fontFamily:`var(--font-mono)`,fontSize:11,color:`var(--color-danger, #ff6b6b)`},children:d}),l&&s.length>0&&(0,P.jsx)(`ul`,{style:{position:`absolute`,top:`100%`,left:0,right:0,zIndex:200,margin:`2px 0 0`,padding:0,listStyle:`none`,background:o.cardBg,border:`1px solid ${o.border}`,borderRadius:4,maxHeight:200,overflowY:`auto`},children:s.map(e=>(0,P.jsx)(`li`,{onClick:()=>{v(e.path)},style:{padding:`6px 10px`,cursor:`pointer`,fontFamily:`var(--font-mono)`,fontSize:11,color:o.text,borderBottom:`1px solid ${o.border}`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(139,148,158,0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:e.path},e.path))})]})}function On(e){return typeof e==`string`&&y.includes(e)?e:null}async function kn(e){let t=await fetch(e);if(t.status===404)return null;if(!t.ok)throw Error(`${t.status} ${t.statusText}`);return t.json()}function An(e){let[t,n]=(0,N.useState)([]),[r,a]=(0,N.useState)([]),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(null),[u,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(!1),[m,h]=(0,N.useState)(null),g=(0,N.useRef)(null),_=(0,N.useRef)(!0);(0,N.useEffect)(()=>(_.current=!0,()=>{_.current=!1,g.current&&clearTimeout(g.current)}),[]);let v=(0,N.useCallback)(async e=>{let t=await kn(`/api/pipeline-runs/${e}/metrics`);_.current&&t&&s(t)},[]);return(0,N.useEffect)(()=>{if(!e){n([]),a([]),s(null),l(null),d(null),p(!1),h(null);return}let t=!1;return p(!0),h(null),Promise.all([kn(`/api/pipeline-runs/${e}/trace`),kn(`/api/pipeline-runs/${e}/metrics`),kn(`/api/pipeline-runs/${e}/artifacts`),kn(`/api/pipeline-runs/${e}/running-phase`)]).then(([e,r,i,o])=>{if(t)return;let c=e?.events??[];n(c.filter(e=>!x(e))),a(c.filter(x)),s(r),l(i),d(On(o?.phase)),p(!1)}).catch(e=>{t||(h(e instanceof Error?e.message:`Failed to load pipeline data`),p(!1))}),()=>{t=!0}},[e]),i(`pipeline:run-update`,t=>{let r=t;!e||r.ideaId!==e||(n(e=>[...e,r.event]),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{v(e).catch(()=>{})},500))}),i(`pipeline:phase-state`,t=>{let n=t;!e||n.ideaId!==e||d(On(n.phase))}),{events:t,ghBlocked:r,metrics:o,artifacts:c,runningPhase:u,loading:f,error:m}}var jn=t(r(),1),I={container:`_container_pngy1_8`,empty:`_empty_pngy1_14`,phaseCard:`_phaseCard_pngy1_23`,phaseCardRunning:`_phaseCardRunning_pngy1_37`,phaseHeader:`_phaseHeader_pngy1_42`,phaseName:`_phaseName_pngy1_67`,phaseDuration:`_phaseDuration_pngy1_75`,outcomeBadge:`_outcomeBadge_pngy1_82`,outcomePass:`_outcomePass_pngy1_92`,outcomeFail:`_outcomeFail_pngy1_97`,outcomeTimeout:`_outcomeTimeout_pngy1_102`,outcomeHalted:`_outcomeHalted_pngy1_107`,runningBadge:`_runningBadge_pngy1_112`,"pipeline-pulse":`_pipeline-pulse_pngy1_1`,attemptCount:`_attemptCount_pngy1_125`,chevron:`_chevron_pngy1_131`,chevronOpen:`_chevronOpen_pngy1_137`,phaseBody:`_phaseBody_pngy1_141`,attemptRow:`_attemptRow_pngy1_149`,attemptRowExpanded:`_attemptRowExpanded_pngy1_170`,attemptLabel:`_attemptLabel_pngy1_179`,attemptModel:`_attemptModel_pngy1_187`,attemptDuration:`_attemptDuration_pngy1_197`,attemptDetail:`_attemptDetail_pngy1_205`,attemptError:`_attemptError_pngy1_215`,artifactsHeading:`_artifactsHeading_pngy1_228`,artifactItem:`_artifactItem_pngy1_236`,artifactOpening:`_artifactOpening_pngy1_268`,artifactError:`_artifactError_pngy1_273`,viewLogButton:`_viewLogButton_pngy1_282`,runningPhaseRow:`_runningPhaseRow_pngy1_309`,runningPhaseRowInner:`_runningPhaseRowInner_pngy1_316`,modalBackdrop:`_modalBackdrop_pngy1_327`,modal:`_modal_pngy1_327`,modalHeader:`_modalHeader_pngy1_351`,modalTitle:`_modalTitle_pngy1_359`,modalActions:`_modalActions_pngy1_365`,modalButton:`_modalButton_pngy1_370`,modalBody:`_modalBody_pngy1_389`,modalLog:`_modalLog_pngy1_395`,modalLoading:`_modalLoading_pngy1_405`,modalError:`_modalError_pngy1_410`},Mn={1:``,2:`self-recover`,3:`escalated`,4:`escalated`,5:`halted`},Nn={brainstorming:`brainstorming`,"writing-plans":`writing-plans`,implementing:`implementing`,reviewing:`reviewing`};function Pn(e){if(e<1e3)return`${e}ms`;let t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}function Fn(e){switch(e){case`pass`:return I.outcomePass;case`fail`:return I.outcomeFail;case`timeout`:return I.outcomeTimeout;case`halted`:return I.outcomeHalted;case`rate-limited`:return I.outcomeHalted;default:return I.outcomeHalted}}function In(e){return e.length===0?null:e[e.length-1].runId??`legacy`}function Ln(e){let t=e.filter(_),n=In(t),r=n===null?t:t.filter(e=>(e.runId??`legacy`)===n),i=new Map;for(let e of r){let t=i.get(e.phase)??[];t.push(e),i.set(e.phase,t)}return Array.from(i.entries()).map(([e,t])=>{let n=t.some(e=>typeof e.taskIndex==`number`)?t.filter(e=>typeof e.taskIndex==`number`):t;return{phase:e,attempts:n,totalDurationMs:n.reduce((e,t)=>e+t.durationMs,0),outcome:n[n.length-1].outcome}})}function Rn({ideaId:e,phase:t,attempt:n,onClose:r}){let[i,a]=(0,N.useState)(null),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(!0);(0,N.useEffect)(()=>{let r=new AbortController;return(async()=>{try{let i=await fetch(`/api/pipeline-runs/${e}/phases/${encodeURIComponent(t)}/${n}/log`,{signal:r.signal});if(!i.ok)throw Error(`${i.status} ${i.statusText}`);a(await i.text())}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;s(e instanceof Error?e.message:`Failed to load log`)}finally{l(!1)}})(),()=>r.abort()},[e,t,n]);function u(){navigator.clipboard&&navigator.clipboard.writeText(i??``).catch(e=>{console.warn(`clipboard copy failed`,e)})}return(0,jn.createPortal)((0,P.jsx)(`div`,{className:I.modalBackdrop,onClick:r,children:(0,P.jsxs)(`div`,{className:I.modal,onClick:e=>e.stopPropagation(),children:[(0,P.jsxs)(`div`,{className:I.modalHeader,children:[(0,P.jsxs)(`span`,{className:I.modalTitle,children:[Nn[t]??t,` — attempt `,n]}),(0,P.jsxs)(`div`,{className:I.modalActions,children:[i&&(0,P.jsx)(`button`,{type:`button`,onClick:u,className:I.modalButton,children:`Copy`}),(0,P.jsx)(`button`,{type:`button`,onClick:r,className:I.modalButton,children:`Close`})]})]}),(0,P.jsxs)(`div`,{className:I.modalBody,children:[c&&(0,P.jsx)(`div`,{className:I.modalLoading,children:`Loading log...`}),o&&(0,P.jsx)(`div`,{className:I.modalError,children:o}),i!==null&&(0,P.jsx)(`pre`,{className:I.modalLog,children:i})]})]})}),document.body)}function zn({ev:e,ideaId:t,artifacts:n}){let[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(null),d=Mn[e.rung]??``,f=n?.phaseLogPaths??{},p=!!(f[`${e.phase}:${e.attempt}`]??f[e.phase]);async function m(e){c(e),u(null);try{let n=await fetch(`/api/pipeline-runs/${t}/open-artifact`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`${n.status} ${n.statusText}`)}}catch(e){u(e instanceof Error?e.message:`failed to open`)}finally{c(null)}}return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`${I.attemptRow} ${r?I.attemptRowExpanded:``}`,"aria-expanded":r,title:typeof e.taskGoal==`string`?e.taskGoal:void 0,children:[(0,P.jsx)(`span`,{className:I.attemptLabel,children:typeof e.taskIndex==`number`?`Task ${e.taskIndex+1}${e.attempt>1?` (try ${e.attempt})`:``}`:`#${e.attempt}${d?` (${d})`:``}`}),typeof e.taskGoal==`string`&&(0,P.jsx)(`span`,{className:I.attemptModel,"aria-hidden":`true`,children:e.taskGoal.length>60?`${e.taskGoal.slice(0,60)}…`:e.taskGoal}),(0,P.jsx)(`span`,{className:`${I.outcomeBadge} ${Fn(e.outcome)}`,children:e.outcome}),e.model&&(0,P.jsx)(`span`,{className:I.attemptModel,children:e.model}),e.effortLevel&&(0,P.jsxs)(`span`,{className:I.attemptModel,children:[`effort:`,e.effortLevel]}),(0,P.jsx)(`span`,{className:I.attemptDuration,children:Pn(e.durationMs)}),(0,P.jsx)(`span`,{className:`${I.chevron} ${r?I.chevronOpen:``}`,children:`▼`})]}),r&&(0,P.jsxs)(`div`,{className:I.attemptDetail,children:[e.error&&(0,P.jsx)(`div`,{className:I.attemptError,children:e.error}),e.artifacts&&e.artifacts.length>0&&(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`div`,{className:I.artifactsHeading,children:`Artifacts`}),e.artifacts.map((e,t)=>(0,P.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),m(e)},disabled:s===e,className:I.artifactItem,title:`Open ${e}`,children:[e,s===e&&(0,P.jsx)(`span`,{className:I.artifactOpening,children:` opening...`})]},t)),l&&(0,P.jsx)(`div`,{className:I.artifactError,children:l})]}),p&&(0,P.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o(!0)},className:I.viewLogButton,children:`View log`})]}),a&&(0,P.jsx)(Rn,{ideaId:t,phase:e.phase,attempt:e.attempt,onClose:()=>o(!1)})]})}function Bn({ideaId:e,events:t,artifacts:n,runningPhase:r}){let[i,a]=(0,N.useState)(new Set),o=Ln(t),s=new Set(o.map(e=>e.phase)),c=r!==null&&!s.has(r);if(t.length===0&&r===null)return(0,P.jsx)(`div`,{className:I.empty,children:`No phases recorded yet.`});function l(e){a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{"aria-live":`polite`,className:I.container,children:[o.map(t=>{let a=i.has(t.phase),o=t.phase===r;return(0,P.jsxs)(`div`,{className:`${I.phaseCard} ${o?I.phaseCardRunning:``}`,"data-running":o?`true`:void 0,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>l(t.phase),className:I.phaseHeader,"aria-expanded":a,children:[(0,P.jsx)(`span`,{className:I.phaseName,children:Nn[t.phase]??t.phase}),(0,P.jsx)(`span`,{className:I.phaseDuration,children:Pn(t.totalDurationMs)}),o&&(0,P.jsx)(`span`,{className:I.runningBadge,children:`retrying`}),(0,P.jsx)(`span`,{className:`${I.outcomeBadge} ${Fn(t.outcome)}`,children:t.outcome}),t.attempts.length>1&&(0,P.jsx)(`span`,{className:I.attemptCount,children:t.attempts.every(e=>typeof e.taskIndex==`number`)?`${t.attempts.length} tasks`:`${t.attempts.length} attempts`}),(0,P.jsx)(`span`,{className:`${I.chevron} ${a?I.chevronOpen:``}`,children:`▼`})]}),a&&(0,P.jsx)(`div`,{className:I.phaseBody,children:t.attempts.map(t=>(0,P.jsx)(zn,{ev:t,ideaId:e,artifacts:n},`${t.phase}-${t.attempt}`))})]},t.phase)}),c&&r&&(0,P.jsx)(`div`,{className:I.runningPhaseRow,"data-running":`true`,children:(0,P.jsxs)(`div`,{className:I.runningPhaseRowInner,children:[(0,P.jsx)(`span`,{className:I.phaseName,children:Nn[r]??r}),(0,P.jsx)(`span`,{className:I.runningBadge,children:`running`})]})})]})}var L={wrapper:`_wrapper_1gvit_1`,table:`_table_1gvit_8`,headerCell:`_headerCell_1gvit_16`,headerCellLeft:`_headerCellLeft_1gvit_27`,headerCellRight:`_headerCellRight_1gvit_28`,cell:`_cell_1gvit_30`,cellLeft:`_cellLeft_1gvit_36`,cellRight:`_cellRight_1gvit_37`,totalCell:`_totalCell_1gvit_39`,totalCellLeft:`_totalCellLeft_1gvit_48`,totalCellRight:`_totalCellRight_1gvit_49`,naCell:`_naCell_1gvit_51`,note:`_note_1gvit_55`};function Vn(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Hn(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:`${n}m ${r}s`}var Un=(0,P.jsx)(`span`,{className:L.naCell,children:`N/A`});function Wn({metrics:e}){let{phases:t,hasTokenData:n}=e;return(0,P.jsxs)(`div`,{className:L.wrapper,children:[(0,P.jsxs)(`table`,{className:L.table,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{className:`${L.headerCell} ${L.headerCellLeft}`,children:`Phase`}),(0,P.jsx)(`th`,{className:`${L.headerCell} ${L.headerCellRight}`,children:`Input`}),(0,P.jsx)(`th`,{className:`${L.headerCell} ${L.headerCellRight}`,children:`Output`}),(0,P.jsx)(`th`,{className:`${L.headerCell} ${L.headerCellRight}`,children:`Cache R`}),(0,P.jsx)(`th`,{className:`${L.headerCell} ${L.headerCellRight}`,children:`Cache W`}),(0,P.jsx)(`th`,{className:`${L.headerCell} ${L.headerCellRight}`,children:`Duration`})]})}),(0,P.jsx)(`tbody`,{children:t.map(e=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{className:`${L.cell} ${L.cellLeft}`,children:e.phase}),(0,P.jsx)(`td`,{className:`${L.cell} ${L.cellRight}`,children:n?Vn(e.tokensInput):Un}),(0,P.jsx)(`td`,{className:`${L.cell} ${L.cellRight}`,children:n?Vn(e.tokensOutput):Un}),(0,P.jsx)(`td`,{className:`${L.cell} ${L.cellRight}`,children:n?Vn(e.tokensCacheRead):Un}),(0,P.jsx)(`td`,{className:`${L.cell} ${L.cellRight}`,children:n?Vn(e.tokensCacheWrite):Un}),(0,P.jsx)(`td`,{className:`${L.cell} ${L.cellRight}`,children:Hn(e.totalDurationMs)})]},e.phase))}),(0,P.jsx)(`tfoot`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`td`,{className:`${L.totalCell} ${L.totalCellLeft}`,children:`Total`}),(0,P.jsx)(`td`,{className:`${L.totalCell} ${L.totalCellRight}`,children:n?Vn(e.totalTokensInput):Un}),(0,P.jsx)(`td`,{className:`${L.totalCell} ${L.totalCellRight}`,children:n?Vn(e.totalTokensOutput):Un}),(0,P.jsx)(`td`,{className:`${L.totalCell} ${L.totalCellRight}`,children:n?Vn(e.totalTokensCacheRead):Un}),(0,P.jsx)(`td`,{className:`${L.totalCell} ${L.totalCellRight}`,children:n?Vn(e.totalTokensCacheWrite):Un}),(0,P.jsx)(`td`,{className:`${L.totalCell} ${L.totalCellRight}`,children:Hn(e.totalDurationMs)})]})})]}),!n&&(0,P.jsx)(`div`,{className:L.note,children:`Token data not captured for this run. Re-run the idea to see metrics.`})]})}var Gn=ke({chartName:`BarChart`,GraphicalChild:De,defaultTooltipEventType:`axis`,validateTooltipEventTypes:[`axis`,`item`],axisComponents:[{axisType:`xAxis`,AxisComp:Oe},{axisType:`yAxis`,AxisComp:Ee}],formatAxisMap:Se}),Kn={wrapper:`_wrapper_721bk_1`,empty:`_empty_721bk_10`,tooltip:`_tooltip_721bk_16`,tooltipPhase:`_tooltipPhase_721bk_26`},qn={brainstorming:`brain`,"writing-plans":`plans`,implementing:`impl`,reviewing:`review`};function Jn(e,t){return typeof window>`u`?t:window.getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}function Yn(){return{positive:Jn(`--color-positive`,`#3fb950`),negative:Jn(`--color-negative`,`#f85149`),warning:Jn(`--color-warning`,`#d29922`),border:Jn(`--color-border`,`#30363d`),textMuted:Jn(`--color-text-muted`,`#8b949e`)}}function Xn(e,t){switch(e){case`pass`:return t.positive;case`fail`:return t.negative;case`timeout`:return t.warning;case`halted`:return t.textMuted;case`rate-limited`:return t.warning;default:return t.textMuted}}function Zn(e){let t=new Map;for(let n of e.filter(_)){let e=t.get(n.phase)??[];e.push(n),t.set(n.phase,e)}return Array.from(t.entries()).map(([e,t])=>{let n=t.reduce((e,t)=>e+t.durationMs,0),r=t[t.length-1];return{name:qn[e]??e,phase:e,minutes:Math.round(n/6e4*100)/100,outcome:r.outcome,attempts:t.length,durationMs:n}})}function Qn({active:e,payload:t}){if(!e||!t||t.length===0)return null;let n=t[0].payload,r=Math.floor(n.durationMs/6e4),i=Math.floor(n.durationMs%6e4/1e3),a=r>0?`${r}m ${i}s`:`${i}s`;return(0,P.jsxs)(`div`,{className:Kn.tooltip,children:[(0,P.jsx)(`div`,{className:Kn.tooltipPhase,children:n.phase}),(0,P.jsxs)(`div`,{children:[a,n.attempts>1?` (${n.attempts} attempts)`:``]})]})}function $n({events:e}){let[t]=(0,N.useState)(Yn);if(e.length===0)return(0,P.jsx)(`div`,{className:Kn.empty,children:`No timing data yet.`});let n=Zn(e),r=n.filter(e=>e.attempts>1);return(0,P.jsx)(`div`,{className:Kn.wrapper,children:(0,P.jsx)(Ce,{width:`100%`,height:`100%`,children:(0,P.jsxs)(Gn,{data:n,margin:{top:4,right:8,left:-20,bottom:0},children:[(0,P.jsx)(Oe,{dataKey:`name`,tick:{fontSize:10,fill:t.textMuted},axisLine:!1,tickLine:!1}),(0,P.jsx)(Ee,{tick:{fontSize:10,fill:t.textMuted},axisLine:!1,tickLine:!1,unit:`m`}),(0,P.jsx)(xe,{content:(0,P.jsx)(Qn,{}),cursor:{fill:`${t.border}66`}}),r.map(e=>(0,P.jsx)(Te,{x:e.name,stroke:t.warning,strokeDasharray:`3 3`,strokeWidth:1},e.phase)),(0,P.jsx)(De,{dataKey:`minutes`,radius:[4,4,0,0],children:n.map(e=>(0,P.jsx)(we,{fill:Xn(e.outcome,t)},e.phase))})]})})})}var er={empty:`_empty_6g8nu_1`,list:`_list_6g8nu_7`,row:`_row_6g8nu_14`,label:`_label_6g8nu_26`,value:`_value_6g8nu_36`,link:`_link_6g8nu_46`,copyButton:`_copyButton_6g8nu_61`};function tr({value:e}){function t(){navigator.clipboard&&navigator.clipboard.writeText(e).catch(e=>{console.warn(`clipboard copy failed`,e)})}return(0,P.jsx)(`button`,{type:`button`,onClick:t,className:er.copyButton,title:`Copy to clipboard`,children:`Copy`})}function nr({label:e,value:t,copyable:n,href:r}){return(0,P.jsxs)(`div`,{className:er.row,children:[(0,P.jsx)(`span`,{className:er.label,children:e}),r?(0,P.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:er.link,children:t}):(0,P.jsx)(`span`,{className:er.value,children:t}),n&&(0,P.jsx)(tr,{value:t})]})}function rr({artifacts:e}){if(!e)return(0,P.jsx)(`div`,{className:er.empty,children:`No artifacts produced yet.`});let{specPath:t,planPath:n,prUrl:r,commitCount:i,modifiedFiles:a}=e;return t||n||r||i!==void 0||a&&a.length>0?(0,P.jsxs)(`div`,{className:er.list,children:[t&&(0,P.jsx)(nr,{label:`Spec`,value:t,copyable:!0}),n&&(0,P.jsx)(nr,{label:`Plan`,value:n,copyable:!0}),r&&(0,P.jsx)(nr,{label:`Pull Request`,value:r,href:r}),i!==void 0&&(0,P.jsx)(nr,{label:`Commits`,value:String(i)}),a&&a.length>0&&(0,P.jsx)(nr,{label:`Files changed`,value:String(a.length)})]}):(0,P.jsx)(`div`,{className:er.empty,children:`No artifacts produced yet.`})}var R={section:`_section_q0l4v_4`,heading:`_heading_q0l4v_20`,filterBar:`_filterBar_q0l4v_24`,filterChip:`_filterChip_q0l4v_30`,filterChipActiveCritical:`_filterChipActiveCritical_q0l4v_55`,filterChipActiveHigh:`_filterChipActiveHigh_q0l4v_61`,filterChipActiveMedium:`_filterChipActiveMedium_q0l4v_67`,filterChipActiveLow:`_filterChipActiveLow_q0l4v_73`,list:`_list_q0l4v_79`,findingRow:`_findingRow_q0l4v_85`,findingRowCritical:`_findingRowCritical_q0l4v_97`,findingRowHigh:`_findingRowHigh_q0l4v_98`,findingRowMedium:`_findingRowMedium_q0l4v_99`,findingRowLow:`_findingRowLow_q0l4v_100`,findingButton:`_findingButton_q0l4v_102`,severityBadge:`_severityBadge_q0l4v_121`,severityBadgeCritical:`_severityBadgeCritical_q0l4v_134`,severityBadgeHigh:`_severityBadgeHigh_q0l4v_135`,severityBadgeMedium:`_severityBadgeMedium_q0l4v_136`,severityBadgeLow:`_severityBadgeLow_q0l4v_137`,findingDetails:`_findingDetails_q0l4v_139`,findingCategory:`_findingCategory_q0l4v_144`,findingTitle:`_findingTitle_q0l4v_153`,findingFile:`_findingFile_q0l4v_160`,findingExpansion:`_findingExpansion_q0l4v_168`,fixOutcomeFixed:`_fixOutcomeFixed_q0l4v_185`,fixOutcomeDeferred:`_fixOutcomeDeferred_q0l4v_186`,fixOutcomeSkipped:`_fixOutcomeSkipped_q0l4v_187`,fixOutcomeRegression:`_fixOutcomeRegression_q0l4v_188`,cleanRow:`_cleanRow_q0l4v_190`,phaseOutcomeRow:`_phaseOutcomeRow_q0l4v_197`,errorState:`_errorState_q0l4v_204`,loadingState:`_loadingState_q0l4v_210`,allFiltersOff:`_allFiltersOff_q0l4v_215`},ir=[`critical`,`high`,`medium`,`low`],ar={critical:R.filterChipActiveCritical,high:R.filterChipActiveHigh,medium:R.filterChipActiveMedium,low:R.filterChipActiveLow},or={critical:R.severityBadgeCritical,high:R.severityBadgeHigh,medium:R.severityBadgeMedium,low:R.severityBadgeLow},sr={critical:R.findingRowCritical,high:R.findingRowHigh,medium:R.findingRowMedium,low:R.findingRowLow},cr={fixed:R.fixOutcomeFixed,deferred:R.fixOutcomeDeferred,skipped:R.fixOutcomeSkipped,regression:R.fixOutcomeRegression};function lr({ideaId:e}){let[t,n]=(0,N.useState)([]),[r,i]=(0,N.useState)(!0),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(()=>new Set(ir)),[l,u]=(0,N.useState)(new Set);if((0,N.useEffect)(()=>{let t=new AbortController;return i(!0),o(null),(async()=>{try{let r=await fetch(`/api/ideas/${e}/findings`,{signal:t.signal});if(!r.ok)throw Error(`${r.status} ${r.statusText}`);let a=await r.json(),o=Array.isArray(a?.events)?a.events.filter(e=>typeof e==`object`&&!!e&&`type`in e):[];if(t.signal.aborted)return;n(o),i(!1)}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;o(e instanceof Error?e.message:`failed`),i(!1)}})(),()=>{t.abort()}},[e]),r)return null;if(a)return(0,P.jsxs)(`section`,{className:R.section,children:[(0,P.jsx)(O,{className:R.heading,children:`Review Findings`}),(0,P.jsxs)(`div`,{className:R.errorState,children:[`Could not load findings: `,a]})]});if(!t.some(e=>e.type===`finding`))return null;let d=s.size===0,f=t.filter(e=>e.type===`finding`&&s.has(e.severity)).length,p=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},m=e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,P.jsxs)(`section`,{className:R.section,children:[(0,P.jsx)(O,{className:R.heading,children:`Review Findings`}),(0,P.jsx)(`div`,{className:R.filterBar,role:`group`,"aria-label":`Filter findings by severity`,children:ir.map(e=>{let t=s.has(e);return(0,P.jsx)(`button`,{type:`button`,onClick:()=>p(e),"aria-pressed":t,className:`${R.filterChip} ${t?ar[e]:``}`,children:e},e)})}),d?(0,P.jsx)(`div`,{className:R.allFiltersOff,children:`All severity filters are off. Toggle a chip above to show findings.`}):f===0?(0,P.jsx)(`div`,{className:R.allFiltersOff,children:`No findings match the active severity filter.`}):null,(0,P.jsx)(`div`,{className:R.list,children:t.map((e,t)=>{if(e.type===`clean-round`)return(0,P.jsxs)(`div`,{className:R.cleanRow,children:[`✓ Round `,e.round,` — clean`]},t);if(e.type===`phase-outcome`)return(0,P.jsxs)(`div`,{className:R.phaseOutcomeRow,children:[`Review outcome: `,e.outcome,e.error?` — ${e.error}`:``]},t);if(!s.has(e.severity))return null;let n=l.has(t);return(0,P.jsxs)(`div`,{className:`${R.findingRow} ${sr[e.severity]}`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>m(t),className:R.findingButton,"aria-expanded":n,children:[(0,P.jsx)(`span`,{className:`${R.severityBadge} ${or[e.severity]}`,children:e.severity}),(0,P.jsxs)(`div`,{className:R.findingDetails,children:[(0,P.jsx)(`div`,{className:R.findingCategory,children:e.category}),(0,P.jsx)(`div`,{className:R.findingTitle,children:e.title}),(0,P.jsxs)(`div`,{className:R.findingFile,children:[e.file,e.line===void 0?``:`:${e.line}`]})]})]}),n&&(0,P.jsxs)(`div`,{className:R.findingExpansion,children:[e.fixOutcome&&(0,P.jsxs)(`div`,{children:[`fix:`,` `,(0,P.jsx)(`strong`,{className:cr[e.fixOutcome],children:e.fixOutcome}),e.fixCommit&&` (${e.fixCommit.slice(0,8)})`]}),(0,P.jsxs)(`div`,{children:[`reviewer: `,e.reviewer]}),(0,P.jsxs)(`div`,{children:[`round: `,e.round]})]})]},t)})})]})}function ur(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.attempt==`number`&&(t.kind===`rebase`||t.kind===`ci`)&&(t.result===`success`||t.result===`failure`||t.result===`error`)&&typeof t.finishedAt==`string`&&typeof t.logFile==`string`}function dr(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.maxAttempts!=`number`||!Array.isArray(t.attempts)||!t.attempts.every(ur)||typeof t.headRefOid!=`string`?!1:t.status===`in_flight`?typeof t.attempt==`number`&&(t.kind===`rebase`||t.kind===`ci`)&&typeof t.startedAt==`string`&&typeof t.logFile==`string`:t.status===`budget_exhausted`?typeof t.exhaustedAt==`string`:t.status===`idle`}function fr(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.ideaId==`string`&&dr(t.state)}function pr(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.maxAttempts!=`number`||typeof t.enabled!=`boolean`?null:t.state===null?{state:null,maxAttempts:t.maxAttempts,enabled:t.enabled}:dr(t.state)?{state:t.state,maxAttempts:t.maxAttempts,enabled:t.enabled}:null}function mr(e){let[t,n]=(0,N.useState)(null),[r,a]=(0,N.useState)(5),[o,s]=(0,N.useState)(!0),[c,u]=(0,N.useState)(e!==null),[d,f]=(0,N.useState)(null),p=(0,N.useCallback)(async(e,t,r)=>{try{let i=await fetch(`/api/pr-auto-fix/state/${encodeURIComponent(e)}`,{signal:t});if(!i.ok)throw Error(`HTTP ${i.status} ${i.statusText||``}`.trim());let o=pr(await i.json());if(!o)throw Error(`malformed pr-auto-fix state response`);n(o.state),a(o.maxAttempts),s(o.enabled),r?.onLoaded?.()}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;f(e instanceof Error?e.message:String(e)),r?.onLoaded?.()}},[]);(0,N.useEffect)(()=>{if(!e){n(null),u(!1);return}let t=new AbortController;return u(!0),f(null),p(e,t.signal,{onLoaded:()=>u(!1)}),()=>t.abort()},[e,p]),i(l,(0,N.useCallback)(t=>{fr(t)&&t.ideaId===e&&n(t.state)},[e]));let m=(0,N.useRef)(null);return i(`ws:reconnected`,(0,N.useCallback)(()=>{if(!e)return;m.current?.abort();let t=new AbortController;m.current=t,p(e,t.signal)},[e,p])),(0,N.useEffect)(()=>()=>{m.current?.abort()},[]),{state:t,maxAttempts:r,enabled:o,isLoading:c,error:d}}var z={strip:`_strip_13buc_1`,stripInFlight:`_stripInFlight_13buc_14`,stripExhausted:`_stripExhausted_13buc_19`,dot:`_dot_13buc_24`,dotInFlight:`_dotInFlight_13buc_32`,pulse:`_pulse_13buc_1`,dotExhausted:`_dotExhausted_13buc_37`,label:`_label_13buc_53`,detail:`_detail_13buc_59`,attempts:`_attempts_13buc_68`,attemptPip:`_attemptPip_13buc_74`,attemptPipSuccess:`_attemptPipSuccess_13buc_82`,attemptPipFailure:`_attemptPipFailure_13buc_83`,attemptPipError:`_attemptPipError_13buc_84`,attemptPipPending:`_attemptPipPending_13buc_85`,pipPulse:`_pipPulse_13buc_1`};function hr(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`?`;let r=Math.max(0,Math.round((t-n)/1e3));if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?a===0?`${i}m`:`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function gr(e,t){if(t)return`${z.attemptPip} ${z.attemptPipPending}`;if(!e)return z.attemptPip;switch(e.result){case`success`:return`${z.attemptPip} ${z.attemptPipSuccess}`;case`failure`:return`${z.attemptPip} ${z.attemptPipFailure}`;case`error`:return`${z.attemptPip} ${z.attemptPipError}`;default:return e.result,z.attemptPip}}function _r(e,t){switch(e.status){case`in_flight`:{let n=e.kind===`ci`?`fixing CI failure`:`rebasing onto main`,r=hr(e.startedAt,t);return{label:`Auto-fix attempt ${e.attempt} of ${e.maxAttempts}`,detail:`${n} — ${r} elapsed`}}case`budget_exhausted`:return{label:`Auto-fix paused`,detail:`Used all ${e.maxAttempts} attempts on this push. Push a fix or reset to retry.`};case`idle`:{let t=e.attempts.length;return t===0?{label:`Auto-fix idle`,detail:`Watching — will act if the PR falls behind, conflicts, or CI fails.`}:{label:`Auto-fix idle — ${t} of ${e.maxAttempts} attempts used`,detail:`Will retry on the next watcher tick if CI is still red.`}}default:return{label:`Auto-fix`,detail:``}}}function vr({ideaId:e}){let{state:t,enabled:n,isLoading:r}=mr(e),[i,a]=(0,N.useState)(()=>Date.now());if((0,N.useEffect)(()=>{if(t?.status!==`in_flight`)return;let e=window.setInterval(()=>a(Date.now()),1e3);return()=>window.clearInterval(e)},[t?.status]),!n||r||!t)return null;let o=t.status===`in_flight`?`${z.strip} ${z.stripInFlight}`:t.status===`budget_exhausted`?`${z.strip} ${z.stripExhausted}`:z.strip,s=t.status===`in_flight`?`${z.dot} ${z.dotInFlight}`:t.status===`budget_exhausted`?`${z.dot} ${z.dotExhausted}`:z.dot,c=t.maxAttempts,l=t.attempts,u=t.status===`in_flight`?t.attempt:null,d=new Map(l.map(e=>[e.attempt,e])),{label:f,detail:p}=_r(t,i);return(0,P.jsxs)(`div`,{className:o,role:`status`,"aria-live":`polite`,children:[(0,P.jsx)(`span`,{className:s,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:z.label,children:f}),(0,P.jsx)(`span`,{className:z.detail,children:p}),(0,P.jsx)(`span`,{className:z.attempts,"aria-label":`Attempts ${l.length} of ${c}`,children:Array.from({length:c},(e,t)=>{let n=t+1,r=n===u;return(0,P.jsx)(`span`,{className:gr(d.get(n)??null,r)},n)})})]})}var B={container:`_container_9hl57_1`,section:`_section_9hl57_8`,sectionHeading:`_sectionHeading_9hl57_14`,loadingState:`_loadingState_9hl57_18`,errorState:`_errorState_9hl57_24`,emptyState:`_emptyState_9hl57_34`},yr=new Set([`opened`,`changes_requested`]);function br({idea:e}){let{events:t,metrics:n,artifacts:r,runningPhase:i,loading:a,error:o}=An(e.id);if(a)return(0,P.jsx)(`div`,{className:B.loadingState,children:`Loading pipeline data...`});if(o)return(0,P.jsxs)(`div`,{className:B.errorState,children:[`Could not load pipeline data: `,o]});let s=t.length>0,c=!s&&(e.status===`draft`||e.status===`ready`),l=!s&&e.status===`in_progress`;return c?(0,P.jsx)(`div`,{className:B.emptyState,children:`No pipeline run yet — start the idea to see progress.`}):l?(0,P.jsx)(`div`,{className:B.container,children:(0,P.jsxs)(`section`,{className:B.section,children:[(0,P.jsx)(O,{className:B.sectionHeading,children:`Phase Timeline`}),(0,P.jsx)(Bn,{ideaId:e.id,events:t,artifacts:r,runningPhase:i})]})}):(0,P.jsxs)(`div`,{className:B.container,children:[yr.has(e.status)&&(0,P.jsx)(vr,{ideaId:e.id}),(0,P.jsxs)(`section`,{className:B.section,children:[(0,P.jsx)(O,{className:B.sectionHeading,children:`Phase Timeline`}),(0,P.jsx)(Bn,{ideaId:e.id,events:t,artifacts:r,runningPhase:i})]}),s&&(0,P.jsxs)(`section`,{className:B.section,children:[(0,P.jsx)(O,{className:B.sectionHeading,children:`Duration`}),(0,P.jsx)($n,{events:t})]}),n&&(0,P.jsxs)(`section`,{className:B.section,children:[(0,P.jsx)(O,{className:B.sectionHeading,children:`Token Metrics`}),(0,P.jsx)(Wn,{metrics:n})]}),(0,P.jsxs)(`section`,{className:B.section,children:[(0,P.jsx)(O,{className:B.sectionHeading,children:`Artifacts`}),(0,P.jsx)(rr,{artifacts:r})]}),(0,P.jsx)(lr,{ideaId:e.id})]})}var V={state:`_state_y39xn_1`,stateError:`_stateError_y39xn_7`,list:`_list_y39xn_13`,entry:`_entry_y39xn_22`,entryHeader:`_entryHeader_y39xn_29`,title:`_title_y39xn_37`,phase:`_phase_y39xn_45`,harvested:`_harvested_y39xn_54`,body:`_body_y39xn_63`};function xr({ideaId:e}){let[t,n]=(0,N.useState)(null),[r,i]=(0,N.useState)(!0),[a,o]=(0,N.useState)(null);if((0,N.useEffect)(()=>{let t=new AbortController;return i(!0),o(null),fetch(`/api/ideas/${e}/jotter`,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(e.statusText||String(e.status));return e.json()}).then(e=>{n(e),i(!1)}).catch(e=>{e instanceof Error&&e.name===`AbortError`||(o(e instanceof Error?e.message:String(e)),i(!1))}),()=>t.abort()},[e]),r)return(0,P.jsx)(`div`,{className:V.state,children:`Loading notebook entries...`});if(a)return(0,P.jsxs)(`div`,{className:V.stateError,children:[`Could not load: `,a]});if(!t||t.notes.length===0)return(0,P.jsxs)(`div`,{className:V.state,children:[`No notebook entries yet. Phase agents emit entries using the`,` `,(0,P.jsx)(`code`,{children:`notebook: title=`}),` / `,(0,P.jsx)(`code`,{children:`notebook: end`}),` protocol.`]});let s=new Set(t.harvested.map(e=>e.noteId));return(0,P.jsx)(`ul`,{className:V.list,children:t.notes.map(e=>(0,P.jsxs)(`li`,{className:V.entry,children:[(0,P.jsxs)(`div`,{className:V.entryHeader,children:[(0,P.jsx)(`span`,{className:V.title,children:e.title}),(0,P.jsx)(`span`,{className:V.phase,children:e.phase}),s.has(e.id)&&(0,P.jsx)(`span`,{className:V.harvested,children:`drafted`})]}),(0,P.jsx)(`p`,{className:V.body,children:e.body})]},e.id))})}var Sr={margin:`18px 0 6px`,fontSize:15,fontWeight:600,letterSpacing:.1,lineHeight:1.3,color:o.text},Cr={margin:`16px 0 6px`,fontSize:13,fontWeight:600,letterSpacing:.4,textTransform:`uppercase`,lineHeight:1.3,color:o.muted,fontFamily:a},wr={margin:`14px 0 4px`,fontSize:13,fontWeight:600,letterSpacing:.1,lineHeight:1.3,color:o.text},Tr={margin:`8px 0`,fontSize:13.5,lineHeight:1.55,color:o.text},Er={margin:`8px 0`,paddingLeft:22,fontSize:13.5,lineHeight:1.55,color:o.text},Dr={fontFamily:a,fontSize:12,padding:`1px 5px`,borderRadius:3,background:`rgba(139, 148, 158, 0.12)`,color:o.text},Or={margin:`10px 0`,padding:`10px 12px`,borderRadius:6,background:`rgba(139, 148, 158, 0.08)`,border:`1px solid ${o.border}`,fontFamily:a,fontSize:12,lineHeight:1.45,color:o.text,overflowX:`auto`},kr={margin:`10px 0`,padding:`6px 12px`,borderLeft:`3px solid ${o.border}`,color:o.muted,fontSize:13,lineHeight:1.55},Ar={margin:`16px 0`,border:`none`,borderTop:`1px solid ${o.border}`},jr={color:`var(--color-primary)`,textDecoration:`underline`,textUnderlineOffset:2},Mr={h1:({children:e})=>(0,P.jsx)(`h1`,{style:Sr,children:e}),h2:({children:e})=>(0,P.jsx)(`h2`,{style:Cr,children:e}),h3:({children:e})=>(0,P.jsx)(`h3`,{style:wr,children:e}),h4:({children:e})=>(0,P.jsx)(`h4`,{style:wr,children:e}),h5:({children:e})=>(0,P.jsx)(`h5`,{style:wr,children:e}),h6:({children:e})=>(0,P.jsx)(`h6`,{style:wr,children:e}),p:({children:e})=>(0,P.jsx)(`p`,{style:Tr,children:e}),ul:({children:e})=>(0,P.jsx)(`ul`,{style:Er,children:e}),ol:({children:e})=>(0,P.jsx)(`ol`,{style:Er,children:e}),li:({children:e})=>(0,P.jsx)(`li`,{style:{marginBottom:3},children:e}),code:({children:e,className:t})=>typeof t==`string`&&/language-/.test(t)?(0,P.jsx)(`code`,{className:t,children:e}):(0,P.jsx)(`code`,{style:Dr,children:e}),pre:({children:e})=>(0,P.jsx)(`pre`,{style:Or,children:e}),blockquote:({children:e})=>(0,P.jsx)(`blockquote`,{style:kr,children:e}),hr:()=>(0,P.jsx)(`hr`,{style:Ar}),a:({children:e,href:t})=>(0,P.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,style:jr,children:e}),strong:({children:e})=>(0,P.jsx)(`strong`,{style:{fontWeight:600,color:o.text},children:e}),em:({children:e})=>(0,P.jsx)(`em`,{style:{fontStyle:`italic`,color:o.text},children:e})},Nr={draft:`rgba(139, 148, 158, 0.7)`,ready:`rgba(63, 185, 80, 0.85)`,in_progress:`rgba(188, 140, 255, 0.85)`,awaiting_input:`rgba(210, 153, 34, 0.85)`,opened:`rgba(63, 185, 80, 0.85)`,blocked:`rgba(248, 81, 73, 0.85)`,done:`rgba(139, 148, 158, 0.5)`};function Pr({id:e,ideas:t,onSelectIdea:n}){let r=t.find(t=>t.id===e),i=e.replace(/^ide-\d{4}-\d{2}-\d{2}-/,``),s=r?Nr[r.status]??o.muted:o.muted;return(0,P.jsxs)(`div`,{onClick:r&&n?()=>n(e):void 0,role:r&&n?`button`:void 0,tabIndex:r&&n?0:void 0,onKeyDown:r&&n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))}:void 0,style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 10px`,borderRadius:6,border:`1px solid ${o.border}`,background:`rgba(139, 148, 158, 0.05)`,cursor:r&&n?`pointer`:`default`,marginBottom:4},children:[(0,P.jsx)(`span`,{style:{display:`inline-block`,width:8,height:8,borderRadius:`50%`,background:s,flexShrink:0}}),(0,P.jsx)(`span`,{style:{fontFamily:a,fontSize:11,color:o.muted,flexShrink:0},children:i}),(0,P.jsx)(`span`,{style:{fontSize:13,color:o.text,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:r?r.title:e})]})}function Fr({idea:e,ideas:t,onSelectIdea:n}){let r=e.blockedBy.length+e.blocks.length+e.relatesTo.length;return r===0?null:(0,P.jsxs)(j,{title:`Relationships`,persistKey:`ideaDrawer.relationships`,defaultExpanded:!0,badge:String(r),children:[e.blockedBy.length>0&&(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`p`,{style:{margin:`0 0 6px`,fontSize:11,fontFamily:`var(--font-mono)`,color:o.muted,opacity:.75},children:[`Blocked by (`,e.blockedBy.length,`)`]}),e.blockedBy.map(e=>(0,P.jsx)(Pr,{id:e,ideas:t,onSelectIdea:n},e))]}),e.blocks.length>0&&(0,P.jsxs)(`div`,{style:{marginTop:e.blockedBy.length>0?12:10},children:[(0,P.jsxs)(`p`,{style:{margin:`0 0 6px`,fontSize:11,fontFamily:`var(--font-mono)`,color:o.muted,opacity:.75},children:[`Blocking (`,e.blocks.length,`)`]}),e.blocks.map(e=>(0,P.jsx)(Pr,{id:e,ideas:t,onSelectIdea:n},e))]}),e.relatesTo.length>0&&(0,P.jsxs)(`div`,{style:{marginTop:e.blockedBy.length>0||e.blocks.length>0?12:10},children:[(0,P.jsxs)(`p`,{style:{margin:`0 0 6px`,fontSize:11,fontFamily:`var(--font-mono)`,color:o.muted,opacity:.75},children:[`Related (`,e.relatesTo.length,`)`]}),e.relatesTo.map(e=>(0,P.jsx)(Pr,{id:e,ideas:t,onSelectIdea:n},e))]})]})}var H={panel:`_panel_x07df_1`,errorBanner:`_errorBanner_x07df_5`,loading:`_loading_x07df_13`,empty:`_empty_x07df_14`,list:`_list_x07df_20`,row:`_row_x07df_29`,rowHeader:`_rowHeader_x07df_35`,badge:`_badge_x07df_41`,badge_verified:`_badge_verified_x07df_52`,badge_failed:`_badge_failed_x07df_57`,badge_unverifiable:`_badge_unverifiable_x07df_62`,acText:`_acText_x07df_67`,expandBtn:`_expandBtn_x07df_75`,reason:`_reason_x07df_95`},Ir={verified:`Verified`,failed:`Failed`,unverifiable:`Manual`};function Lr(e,t,n){return e&&n.length===0?`Loading...`:t?.outcome===`fail`||t?.outcome===`timeout`?`Phase failed`:n.length===0?``:n.every(e=>e.verdict===`unverifiable`)?`Needs manual`:`${n.filter(e=>e.verdict===`verified`).length}/${n.length} verified`}function Rr({ideaId:e,testVerdicts:t,testPhaseOutcome:n,testIsLoading:r,testError:i}){let a=$t(e),o=t===void 0?a.verdicts:t,s=n===void 0?a.phaseOutcome:n,c=r===void 0?a.isLoading:r,l=i===void 0?a.error:i,[u,d]=(0,N.useState)(new Set),f=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},p=Lr(c,s,o);return(0,P.jsxs)(j,{title:`Verification`,defaultExpanded:o.length>0||c||l!==null,badge:p||void 0,persistKey:`ideaDrawer.verification`,className:H.panel,children:[l&&(0,P.jsx)(`div`,{role:`alert`,className:H.errorBanner,children:l}),!l&&!c&&o.length===0&&(0,P.jsx)(`div`,{className:H.empty,children:`No verifications recorded yet.`}),o.length>0&&(0,P.jsx)(`ul`,{className:H.list,children:o.map(e=>{let t=u.has(e.acIndex);return(0,P.jsxs)(`li`,{className:H.row,children:[(0,P.jsxs)(`div`,{className:H.rowHeader,children:[(0,P.jsx)(`span`,{className:`${H.badge} ${H[`badge_${e.verdict}`]}`,title:`${Ir[e.verdict]??e.verdict}: ${e.reason}`,children:Ir[e.verdict]??e.verdict}),(0,P.jsx)(`span`,{className:H.acText,children:e.acText}),e.verdict===`failed`&&(0,P.jsx)(T,{variant:`ghost`,size:`sm`,className:H.expandBtn,"aria-expanded":t,"aria-label":`expand reason for AC ${e.acIndex}`,onClick:()=>f(e.acIndex),children:t?`▲`:`▼`})]}),e.verdict===`unverifiable`&&(0,P.jsx)(`div`,{className:H.reason,children:e.reason}),e.verdict===`failed`&&t&&(0,P.jsx)(`div`,{className:H.reason,children:e.reason})]},e.acIndex)})})]})}var U={backdrop:`_backdrop_n97pr_13`,backdropOpen:`_backdropOpen_n97pr_23`,drawer:`_drawer_n97pr_28`,drawerOpen:`_drawerOpen_n97pr_44`,header:`_header_n97pr_50`,"drawer-fade-in":`_drawer-fade-in_n97pr_1`,headerTitleColumn:`_headerTitleColumn_n97pr_61`,title:`_title_n97pr_66`,subtitle:`_subtitle_n97pr_76`,closeButton:`_closeButton_n97pr_84`,metadataStrip:`_metadataStrip_n97pr_112`,chip:`_chip_n97pr_122`,chipLabel:`_chipLabel_n97pr_136`,chipValue:`_chipValue_n97pr_140`,chipPriorityHigh:`_chipPriorityHigh_n97pr_144`,chipPriorityCritical:`_chipPriorityCritical_n97pr_145`,chipStatusInProgress:`_chipStatusInProgress_n97pr_155`,chipStatusReady:`_chipStatusReady_n97pr_156`,chipStatusBlocked:`_chipStatusBlocked_n97pr_157`,chipStatusMerged:`_chipStatusMerged_n97pr_158`,chipStatusOpened:`_chipStatusOpened_n97pr_159`,chipStatusChangesRequested:`_chipStatusChangesRequested_n97pr_160`,chipStatusAwaitingInput:`_chipStatusAwaitingInput_n97pr_161`,projectEditorRow:`_projectEditorRow_n97pr_163`,projectEditorLabel:`_projectEditorLabel_n97pr_170`,actionBar:`_actionBar_n97pr_179`,action:`_action_n97pr_179`,actionPrimary:`_actionPrimary_n97pr_221`,floorPicker:`_floorPicker_n97pr_232`,floorPickerRow:`_floorPickerRow_n97pr_240`,floorPickerLabel:`_floorPickerLabel_n97pr_246`,floorPickerSelect:`_floorPickerSelect_n97pr_251`,floorPickerActions:`_floorPickerActions_n97pr_262`,actionError:`_actionError_n97pr_269`,tabBar:`_tabBar_n97pr_287`,tab:`_tab_n97pr_287`,tabActive:`_tabActive_n97pr_321`,body:`_body_n97pr_339`,bodyScroll:`_bodyScroll_n97pr_346`,bodyHidden:`_bodyHidden_n97pr_352`,acceptanceList:`_acceptanceList_n97pr_356`,emptyDescription:`_emptyDescription_n97pr_368`,descriptionWrapper:`_descriptionWrapper_n97pr_376`,calloutBlocked:`_calloutBlocked_n97pr_381`,calloutAwaiting:`_calloutAwaiting_n97pr_395`,prRow:`_prRow_n97pr_411`,prBadge:`_prBadge_n97pr_419`,prBadgeOpened:`_prBadgeOpened_n97pr_426`,prBadgeMerged:`_prBadgeMerged_n97pr_431`,prBadgeClosed:`_prBadgeClosed_n97pr_436`,prBadgeChangesRequested:`_prBadgeChangesRequested_n97pr_441`,prLink:`_prLink_n97pr_446`,prTimestamp:`_prTimestamp_n97pr_457`,fileMeta:`_fileMeta_n97pr_465`,phaseModelsHint:`_phaseModelsHint_n97pr_475`,phaseModelsList:`_phaseModelsList_n97pr_482`,phaseModelRow:`_phaseModelRow_n97pr_488`,phaseModelMeta:`_phaseModelMeta_n97pr_497`,phaseModelLabel:`_phaseModelLabel_n97pr_502`,phaseModelHint:`_phaseModelHint_n97pr_508`,phaseModelSelect:`_phaseModelSelect_n97pr_514`,phaseModelSelectOverride:`_phaseModelSelectOverride_n97pr_528`,behaviorRow:`_behaviorRow_n97pr_534`,behaviorLabel:`_behaviorLabel_n97pr_542`,behaviorTitle:`_behaviorTitle_n97pr_549`,behaviorHint:`_behaviorHint_n97pr_553`};function zr({idea:e,onPatchIdea:t}){let n=e.autoMerge===!0,r=e.autoFixCI!==!1,i=[...n?[]:[`manual merge`],...r?[]:[`no auto-fix`]];return(0,P.jsxs)(j,{title:`Behavior`,persistKey:`ideaDrawer.behavior`,defaultExpanded:!1,badge:i.length>0?i.join(`, `):void 0,children:[(0,P.jsxs)(`label`,{className:U.behaviorRow,children:[(0,P.jsxs)(`span`,{className:U.behaviorLabel,children:[(0,P.jsx)(`span`,{className:U.behaviorTitle,children:`Auto-merge`}),(0,P.jsx)(`span`,{className:U.behaviorHint,children:`When a PR is opened for this idea, set GitHub auto-merge. The PR merges as soon as required checks and reviews pass. Off means the operator merges manually.`})]}),(0,P.jsx)(`input`,{type:`checkbox`,"aria-label":`Auto-merge`,checked:n,onChange:n=>{t(e.id,{autoMerge:n.target.checked})}})]}),(0,P.jsxs)(`label`,{className:U.behaviorRow,children:[(0,P.jsxs)(`span`,{className:U.behaviorLabel,children:[(0,P.jsx)(`span`,{className:U.behaviorTitle,children:`Auto-fix CI`}),(0,P.jsx)(`span`,{className:U.behaviorHint,children:`Allow the pr-auto-fix watcher to automatically rebase this branch when it falls behind main or attempt a conflict resolution session. Disable to manage merging manually.`})]}),(0,P.jsx)(`input`,{type:`checkbox`,"aria-label":`Auto-fix CI`,checked:r,onChange:n=>{t(e.id,{autoFixCI:n.target.checked})}})]})]})}function Br({idea:e,pipelineFeatures:t,onPatchIdea:n}){let r=e.phaseModels??{},i=t?.phaseModels??{};function a(t,i){let a={...r};i===``?delete a[t]:a[t]=i,n(e.id,{phaseModels:a})}let o=Object.keys(r).filter(e=>g[e]).length;return(0,P.jsxs)(j,{title:`Phase models`,persistKey:`ideaDrawer.phase-models`,defaultExpanded:!1,badge:o>0?`${o} overridden`:void 0,children:[(0,P.jsx)(`p`,{className:U.phaseModelsHint,children:`Override the model used for each phase of this idea's pipeline. Empty falls back to the global default in Ideas Settings.`}),(0,P.jsx)(`div`,{className:U.phaseModelsList,children:y.filter(e=>g[e]).map(e=>{let t=r[e],{model:n,source:o}=S(e,r,i),s=o===`idea`?`this idea`:o===`settings`?`Ideas Settings`:`compile-time`,c=S(e,void 0,i),l=c.source===`settings`?`Ideas Settings`:`compile-time`,u=`inherit (${c.model} · ${l})`,d=`effective: ${n} · ${s}`,f=t?`${U.phaseModelSelect} ${U.phaseModelSelectOverride}`:U.phaseModelSelect;return(0,P.jsxs)(`label`,{className:U.phaseModelRow,children:[(0,P.jsxs)(`div`,{className:U.phaseModelMeta,children:[(0,P.jsx)(`div`,{className:U.phaseModelLabel,children:m[e]}),(0,P.jsx)(`div`,{className:U.phaseModelHint,children:d})]}),(0,P.jsxs)(`select`,{value:t??``,onChange:t=>a(e,t.target.value),className:f,children:[(0,P.jsx)(`option`,{value:``,children:u}),v.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})]},e)})})]})}function Vr({idea:e,defaultWorkflow:t,onPatchIdea:n}){let[r,i]=(0,N.useState)([]),[a,o]=(0,N.useState)(null);(0,N.useEffect)(()=>{let e=new AbortController;return fetch(`/api/workflows`,{signal:e.signal}).then(e=>{if(!e.ok)throw Error(e.statusText||`HTTP ${e.status}`);return e.json()}).then(e=>i(e.workflows??[])).catch(e=>{e instanceof Error&&e.name===`AbortError`||(console.warn(`IdeaDetailDrawer: GET /api/workflows failed`,e),o(e instanceof Error?e.message:String(e)))}),()=>e.abort()},[]);let s=e.workflow??``,c=t?`Inherit project default (${r.find(e=>e.name===t)?.displayName??t})`:`Inherit project default (superpowers)`;return(0,P.jsx)(j,{title:`Workflow`,persistKey:`ideaDrawer.workflow`,defaultExpanded:!1,badge:e.workflow&&e.workflow!==`superpowers`?e.workflow:void 0,children:(0,P.jsxs)(`label`,{className:U.behaviorRow,children:[(0,P.jsxs)(`span`,{className:U.behaviorLabel,children:[(0,P.jsx)(`span`,{className:U.behaviorTitle,children:`Phase chain`}),(0,P.jsx)(`span`,{className:U.behaviorHint,children:a?`Pipeline phase chain for this idea. Could not load workflow list (${a}); showing current value only.`:`Pipeline phase chain for this idea. Leave on the inherit option to follow the project default.`})]}),(0,P.jsxs)(C,{compact:!0,value:s,onChange:t=>{let r=t.target.value===``?null:t.target.value;n(e.id,{workflow:r})},children:[(0,P.jsx)(`option`,{value:``,children:c}),r.length>0?r.map(e=>(0,P.jsx)(`option`,{value:e.name,children:e.displayName},e.name)):e.workflow?(0,P.jsx)(`option`,{value:e.workflow,children:e.workflow}):null]})]})})}var Hr={in_progress:U.chipStatusInProgress,ready:U.chipStatusReady,blocked:U.chipStatusBlocked,merged:U.chipStatusMerged,opened:U.chipStatusOpened,changes_requested:U.chipStatusChangesRequested,awaiting_input:U.chipStatusAwaitingInput},Ur={critical:U.chipPriorityCritical,high:U.chipPriorityHigh},Wr={...Mr,p:({children:e})=>(0,P.jsx)(P.Fragment,{children:e})};function Gr(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now();if(t<=n)return`any moment now`;let r=new Date(t),i=r.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});return r.toDateString()===new Date(n).toDateString()?i:`${r.toLocaleDateString()} ${i}`}function Kr(e){try{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}catch{return e}}function qr({label:e,value:t,accent:n}){return(0,P.jsxs)(`span`,{className:`${U.chip} ${n??``}`,children:[(0,P.jsxs)(`span`,{className:U.chipLabel,children:[e,`:`]}),(0,P.jsx)(`span`,{className:U.chipValue,children:t})]})}function Jr(e,t){switch(e){case`merged`:return t.prBadgeMerged;case`closed`:return t.prBadgeClosed;case`changes_requested`:return t.prBadgeChangesRequested;default:return t.prBadgeOpened}}function Yr(e){switch(e){case`merged`:return`Merged`;case`closed`:return`Closed`;case`changes_requested`:return`Changes Requested`;default:return`Open`}}function Xr({idea:e,ideas:t,pipelineFeatures:n,hidden:r,onRepromote:i,onSelectIdea:a,onPatchIdea:o}){return(0,P.jsxs)(`div`,{className:`${U.body} ${r?U.bodyHidden:``}`,children:[(e.blockedReason||e.awaitingInputContext||e.awaitingRateLimitUntil)&&(0,P.jsxs)(j,{title:`Status detail`,persistKey:`ideaDrawer.status-detail`,defaultExpanded:!0,children:[e.blockedReason&&(0,P.jsxs)(`p`,{className:U.calloutBlocked,children:[(0,P.jsx)(`strong`,{children:`blocked:`}),` `,e.blockedReason]}),e.awaitingInputContext&&(()=>{let t=null;try{t=JSON.parse(e.awaitingInputContext)}catch{}return t?.reason===`auto-fix-budget-exhausted`?(0,P.jsxs)(`p`,{className:U.calloutAwaiting,children:[(0,P.jsx)(`strong`,{children:`auto-fix budget exhausted:`}),` The watcher failed `,t.lastAttempts?.length??3,` consecutive attempts on this PR. Re-enable auto-fix or resolve manually, then clear this field to resume.`]}):(0,P.jsxs)(`p`,{className:U.calloutAwaiting,children:[(0,P.jsx)(`strong`,{children:`awaiting input:`}),` `,e.awaitingInputContext]})})(),e.awaitingRateLimitUntil&&(0,P.jsxs)(`p`,{className:U.calloutAwaiting,children:[(0,P.jsx)(`strong`,{children:`rate-limited:`}),` retrying at`,` `,Gr(e.awaitingRateLimitUntil)]})]}),e.acceptanceCriteria.length>0&&(0,P.jsx)(j,{title:`Acceptance criteria`,persistKey:`ideaDrawer.acceptance-criteria`,defaultExpanded:!0,badge:String(e.acceptanceCriteria.length),children:(0,P.jsx)(`ul`,{className:U.acceptanceList,children:e.acceptanceCriteria.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsx)(k,{remarkPlugins:[ye],components:Wr,children:e})},t))})}),(0,P.jsx)(Rr,{ideaId:e.id}),(0,P.jsx)(j,{title:`Description`,persistKey:`ideaDrawer.description`,defaultExpanded:!0,children:e.body.trim().length===0?(0,P.jsx)(`p`,{className:U.emptyDescription,children:`(no description)`}):(0,P.jsx)(`div`,{className:`idea-body-md ${U.descriptionWrapper}`,children:(0,P.jsx)(k,{remarkPlugins:[ye,be],components:Mr,children:e.body})})}),e.prUrl&&(0,P.jsxs)(j,{title:`Pull request`,persistKey:`ideaDrawer.pull-request`,defaultExpanded:!0,badge:Yr(e.status),children:[(0,P.jsxs)(`div`,{className:U.prRow,children:[(0,P.jsx)(`span`,{className:`${U.prBadge} ${Jr(e.status,U)}`,children:Yr(e.status)}),(0,P.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noreferrer`,className:U.prLink,children:`View PR`})]}),e.prMergedAt&&(0,P.jsxs)(`div`,{className:U.prTimestamp,children:[`Merged `,new Date(e.prMergedAt).toLocaleDateString()]}),e.prClosedAt&&(0,P.jsxs)(`div`,{className:U.prTimestamp,children:[`Closed `,new Date(e.prClosedAt).toLocaleDateString()]}),(e.status===`closed`||e.status===`changes_requested`)&&i&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),className:U.action,children:`Re-promote to Ready`})]}),(0,P.jsx)(Fr,{idea:e,ideas:t,onSelectIdea:a}),o&&(0,P.jsx)(Br,{idea:e,pipelineFeatures:n,onPatchIdea:o}),o&&(0,P.jsx)(Vr,{idea:e,defaultWorkflow:n?.defaultWorkflow??void 0,onPatchIdea:o}),o&&(0,P.jsx)(zr,{idea:e,onPatchIdea:o}),(0,P.jsxs)(j,{title:`File`,persistKey:`ideaDrawer.file`,defaultExpanded:!1,children:[(0,P.jsx)(`p`,{className:U.fileMeta,children:e.filePath}),(0,P.jsxs)(`p`,{className:U.fileMeta,children:[`Created: `,Kr(e.createdAt),e.promotedAt&&` · Promoted: ${Kr(e.promotedAt)}`]})]})]})}function Zr({floor:e,onChange:t,onConfirm:n,onCancel:r}){return(0,P.jsxs)(`div`,{className:U.floorPicker,children:[(0,P.jsxs)(`div`,{className:U.floorPickerRow,children:[(0,P.jsx)(`label`,{className:U.floorPickerLabel,children:`Severity floor:`}),(0,P.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),className:U.floorPickerSelect,children:je.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),(0,P.jsxs)(`div`,{className:U.floorPickerActions,children:[(0,P.jsx)(`button`,{type:`button`,className:`${U.action} ${U.actionPrimary}`,onClick:n,children:`Confirm Start`}),(0,P.jsx)(`button`,{type:`button`,className:U.action,onClick:r,children:`Cancel`})]})]})}function Qr({idea:e,ideas:t,pipelineFeatures:n,onClose:r,onPromote:i,onStart:a,onRepromote:o,onArchive:s,onProjectPathResolved:c,onSelectIdea:l,onPatchIdea:u}){let d=e!==null,[f,p]=(0,N.useState)(`details`);(0,N.useEffect)(()=>{p(`details`)},[e?.id]);let[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(`all`),[v,y]=(0,N.useState)({pending:null,error:null});(0,N.useEffect)(()=>{y({pending:null,error:null})},[e?.id]);let b=async(e,t)=>{if(!u)return;y({pending:t,error:null});let n=await u(e,{status:t,blockedReason:null});n&&`ok`in n&&!n.ok?y({pending:null,error:n.error}):y({pending:null,error:null})};return(0,N.useEffect)(()=>{if(!e){h(!1);return}_(e.reviewSeverityFloor??n?.review.arguments?.[`review-fix-loop`]?.severityFloor??`all`),h(!1)},[e,n]),(0,N.useEffect)(()=>{if(!d)return;function e(e){e.key===`Escape`&&r()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d,r]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{onClick:r,className:`${U.backdrop} ${d?U.backdropOpen:``}`,"aria-hidden":!d}),(0,P.jsx)(`aside`,{role:`dialog`,"aria-label":e?`Idea details: ${e.title}`:`Idea details`,"aria-modal":`true`,className:`${U.drawer} ${d?U.drawerOpen:``}`,children:e&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:U.header,children:[(0,P.jsxs)(`div`,{className:U.headerTitleColumn,children:[(0,P.jsx)(`h2`,{className:U.title,children:e.title}),(0,P.jsx)(`p`,{className:U.subtitle,children:e.id})]}),(0,P.jsx)(`button`,{onClick:r,"aria-label":`Close idea details`,className:U.closeButton,type:`button`,children:`×`})]}),(0,P.jsxs)(`div`,{className:U.metadataStrip,children:[(0,P.jsx)(qr,{label:`status`,value:e.status,accent:Hr[e.status]}),e.resolvedProjectPath?(0,P.jsx)(qr,{label:`project`,value:e.resolvedProjectPath.split(`/`).pop()??e.resolvedProjectPath}):e.status===`draft`||e.status===`ready`?(0,P.jsxs)(`div`,{className:U.projectEditorRow,children:[(0,P.jsx)(`span`,{className:U.projectEditorLabel,children:`project:`}),(0,P.jsx)(Dn,{ideaId:e.id,currentProject:e.project,onResolved:()=>c?.()})]}):(0,P.jsx)(qr,{label:`project`,value:e.project}),(0,P.jsx)(qr,{label:`size`,value:e.size}),(0,P.jsx)(qr,{label:`priority`,value:e.priority,accent:Ur[e.priority]}),(0,P.jsx)(qr,{label:`createdBy`,value:e.createdBy})]}),(()=>{let r=e.status===`draft`,o=e.status===`ready`,c=e.status===`blocked`&&!!u;return r||o||c||e.prUrl?(0,P.jsxs)(`div`,{className:U.actionBar,children:[r&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{type:`button`,className:`${U.action} ${U.actionPrimary}`,onClick:()=>i(e.id),title:e.size===`epic`?`Promote this epic and all draft descendants to ready in one action`:`Mark this idea ready to be picked up by the pipeline`,children:e.size===`epic`&&e.blockedBy.length>0?`Cascade to ${e.blockedBy.length} child${e.blockedBy.length===1?``:`ren`}`:`Mark Ready`}),s&&(0,P.jsx)(`button`,{type:`button`,className:U.action,onClick:()=>s(e.id),title:`Archive this draft`,children:`Archive`})]}),o&&!m&&(0,P.jsx)(`button`,{type:`button`,className:`${U.action} ${U.actionPrimary}`,onClick:()=>h(!0),children:`Start Now`}),o&&m&&(0,P.jsx)(Zr,{floor:g,onChange:_,onConfirm:()=>{let t=e.reviewSeverityFloor??n?.review.arguments?.[`review-fix-loop`]?.severityFloor??`all`;a(e.id,g===t?void 0:g),h(!1)},onCancel:()=>h(!1)}),c&&(()=>{let n=e.blockedBy.every(e=>{let n=t.find(t=>t.id===e);return!!n&&Ae.has(n.status)}),r=e.blockedBy.length>0&&!n,i=v.pending!==null;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`button`,{type:`button`,className:`${U.action} ${U.actionPrimary}`,onClick:()=>{b(e.id,`ready`)},disabled:i,title:r?`Move back to Ready (will sit queued until every blocker reaches a terminal status)`:`Clear blocked status and move back to Ready`,children:v.pending===`ready`?`Resetting…`:`Reset to Ready`}),(0,P.jsx)(`button`,{type:`button`,className:U.action,onClick:()=>{b(e.id,`draft`)},disabled:i,title:`Clear blocked status and move back to Draft`,children:v.pending===`draft`?`Resetting…`:`Reset to Draft`})]})})(),e.prUrl&&(0,P.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noreferrer`,className:U.action,children:`View PR`})]}):null})(),v.error&&(0,P.jsxs)(`div`,{role:`alert`,className:U.actionError,children:[(0,P.jsx)(`strong`,{children:`Reset failed:`}),` `,v.error]}),(0,P.jsxs)(`div`,{className:U.tabBar,role:`tablist`,children:[(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":f===`details`,className:`${U.tab} ${f===`details`?U.tabActive:``}`,onClick:()=>p(`details`),children:`Details`}),(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":f===`pipeline`,className:`${U.tab} ${f===`pipeline`?U.tabActive:``}`,onClick:()=>p(`pipeline`),children:`Pipeline`}),n?.inflightNotebookEnabled&&(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":f===`jotter`,className:`${U.tab} ${f===`jotter`?U.tabActive:``}`,onClick:()=>p(`jotter`),children:`Notebook`})]}),(0,P.jsx)(Xr,{idea:e,ideas:t,pipelineFeatures:n,hidden:f!==`details`,onRepromote:o,onSelectIdea:l,onPatchIdea:u}),f===`pipeline`&&(0,P.jsx)(`div`,{className:U.bodyScroll,children:(0,P.jsx)(br,{idea:e})}),f===`jotter`&&(0,P.jsx)(`div`,{className:U.bodyScroll,children:(0,P.jsx)(xr,{ideaId:e.id})})]})})]})}var $r={description:`_description_1mapc_1`,primaryAction:`_primaryAction_1mapc_8`};function W({title:e,persistKey:t,description:n,defaultExpanded:r=!0,badge:i,action:a,children:o}){return(0,P.jsxs)(j,{title:e,persistKey:t,defaultExpanded:r,badge:i,children:[n&&(0,P.jsx)(`p`,{className:$r.description,children:n}),a&&(0,P.jsx)(`div`,{className:$r.primaryAction,children:a}),o]})}var G={backdrop:`_backdrop_1t8ci_6`,backdropOpen:`_backdropOpen_1t8ci_16`,drawer:`_drawer_1t8ci_21`,drawerOpen:`_drawerOpen_1t8ci_37`,header:`_header_1t8ci_41`,"drawer-fade-in":`_drawer-fade-in_1t8ci_1`,title:`_title_1t8ci_52`,closeButton:`_closeButton_1t8ci_59`,body:`_body_1t8ci_79`,sectionHint:`_sectionHint_1t8ci_85`,phasePills:`_phasePills_1t8ci_92`,phaseItem:`_phaseItem_1t8ci_102`,phasePill:`_phasePill_1t8ci_92`,phaseArrow:`_phaseArrow_1t8ci_116`,columnList:`_columnList_1t8ci_120`,inlineCode:`_inlineCode_1t8ci_129`,selectActive:`_selectActive_1t8ci_138`,wideControl:`_wideControl_1t8ci_142`},ei=`ideas:hideEmptyColumns`;function ti(){try{return typeof window<`u`&&window.localStorage.getItem(ei)===`1`}catch{return!1}}function ni(e){try{window.localStorage.setItem(ei,e?`1`:`0`),window.dispatchEvent(new Event(`ideas:settingsChanged`))}catch{}}function ri({open:e}){let[t,n]=(0,N.useState)(()=>ti()),[r,i]=(0,N.useState)(()=>gt()),a=e=>e in r?r[e]:Nt.find(t=>t.id===e)?.defaultVisible??!0,o=e=>{let t={...r,[e]:!a(e)};_t(t),i(t)};return(0,N.useEffect)(()=>{e&&n(ti())},[e]),(0,P.jsxs)(W,{title:`Board & Columns`,persistKey:`ideas-settings.board-columns`,description:`Board rendering and list-view column visibility.`,children:[(0,P.jsx)(M,{label:`Hide empty columns`,hint:`Don't render status columns that have no ideas in them.`,children:(0,P.jsx)(T,{variant:t?`primary`:`ghost`,size:`sm`,onClick:()=>{let e=!t;n(e),ni(e)},children:t?`On`:`Off`})}),(0,P.jsx)(M,{label:`List columns`,hint:`Choose which columns appear in the List view.`,divider:!0,children:(0,P.jsx)(`ul`,{className:G.columnList,"aria-label":`Visible columns`,children:Nt.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(T,{variant:a(e.id)?`primary`:`ghost`,size:`sm`,onClick:()=>o(e.id),children:e.label})},e.id))})})]})}var ii={projectOverrideHint:`_projectOverrideHint_rmm3b_1`,projectSelect:`_projectSelect_rmm3b_8`};function ai(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return typeof t.path==`string`&&t.path.length>0}function oi({pf:e,patchPf:t}){let n=e.profileDiscovery?.defaultEnabled??!1;return(0,P.jsxs)(W,{title:`Profile discovery`,persistKey:`ideas-settings.profile-discovery`,description:`When enabled, the pipeline opens a CLAUDE.md pull request for projects that don't yet have a Teamwork profile. Disabled by default; turn on globally below or override per-project.`,children:[(0,P.jsx)(M,{label:`Default enabled`,hint:`Applies to any project without an explicit per-project override.`,children:(0,P.jsx)(T,{variant:n?`primary`:`ghost`,size:`sm`,onClick:()=>t({profileDiscovery:{defaultEnabled:!n}}),children:n?`On`:`Off`})}),Object.entries(e.projects??{}).length>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{className:ii.projectOverrideHint,children:`Per-project override (takes precedence over the global default).`}),Object.entries(e.projects??{}).map(([n,r],i)=>{let a=ai(r)?r:null,o=a?.profileDiscovery===void 0?``:a.profileDiscovery.enabled?`enabled`:`disabled`,s=typeof r!=`string`&&a===null?`(invalid: missing or malformed path)`:typeof r==`string`?r:a?.path??``;return(0,P.jsx)(M,{label:n,hint:s,divider:i>0,children:(0,P.jsxs)(C,{compact:!0,className:ii.projectSelect,value:o,onChange:r=>{let i=r.target.value,o=a?{...a}:{path:s},c;i===``?(delete o.profileDiscovery,c=o):c={...o,profileDiscovery:{enabled:i===`enabled`}},t({projects:{...e.projects??{},[n]:c}})},children:[(0,P.jsx)(`option`,{value:``,children:`Use global default`}),(0,P.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,P.jsx)(`option`,{value:`disabled`,children:`Disabled`})]})},n)})]})]})}var si={taskCapInput:`_taskCapInput_1v4vg_1`},ci={maxTasks:15};function li({writingPlans:e,onPatchWritingPlans:t}){let n=e??ci;return(0,P.jsx)(W,{title:`Implementing phase (orchestrator)`,persistKey:`ideas-settings.implementing`,children:(0,P.jsx)(M,{label:`Plan task cap`,hint:`Reject plans with more than this many tasks. The implementing phase runs each task on its own budget; long plans hit time limits across rungs. Default 15. Range 1-50.`,children:(0,P.jsx)(w,{compact:!0,type:`number`,className:si.taskCapInput,min:1,max:50,step:1,value:n.maxTasks,onChange:e=>{let n=Number(e.target.value);Number.isInteger(n)&&t({maxTasks:Math.max(1,Math.min(50,n))})}})})})}var ui={"":`Default`,low:`Low`,medium:`Medium`,high:`High`,xhigh:`Extra high`,max:`Max`},di={description:`_description_uczvq_1`,inlineCode:`_inlineCode_uczvq_8`,effortSelect:`_effortSelect_uczvq_17`,selectActive:`_selectActive_uczvq_21`};function fi({phaseEffortLevels:e,onPatch:t}){let n=e??{};function r(e,r){let i={...n};r===null||r===``?delete i[e]:i[e]=r,t(Object.keys(i).length>0?i:void 0)}return(0,P.jsxs)(W,{title:`Per-phase effort`,persistKey:`ideas-settings.per-phase-effort`,children:[(0,P.jsxs)(`p`,{className:di.description,children:[`Effort level passed as `,(0,P.jsx)(`code`,{className:di.inlineCode,children:`--effort`}),` to each phase. Falls back to `,(0,P.jsx)(`code`,{className:di.inlineCode,children:`engine.defaultEffortLevel`}),` when unset.`]}),y.filter(e=>g[e]).map((e,t)=>{let i=n[e];return(0,P.jsx)(M,{label:m[e],divider:t>0,children:(0,P.jsx)(C,{compact:!0,className:[di.effortSelect,i?di.selectActive:void 0].filter(Boolean).join(` `),value:i??``,onChange:t=>{let n=t.target.value;r(e,n===``?null:n)},children:Object.entries(ui).map(([e,t])=>(0,P.jsx)(`option`,{value:e,children:t},e||`default`))})},e)})]})}var pi=1,mi=.9,hi=.8,gi=.17,_i=.1,vi=.999,yi=.9999,bi=.99,xi=/[\\\/_+.#"@\[\(\{&]/,Si=/[\\\/_+.#"@\[\(\{&]/g,Ci=/[\s-]/,wi=/[\s-]/g;function Ti(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?pi:bi;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Ti(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=pi:xi.test(e.charAt(l-1))?(d*=hi,p=e.slice(i,l-1).match(Si),p&&i>0&&(d*=vi**+p.length)):Ci.test(e.charAt(l-1))?(d*=mi,m=e.slice(i,l-1).match(wi),m&&i>0&&(d*=vi**+m.length)):(d*=gi,i>0&&(d*=vi**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=yi)),(d<_i&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Ti(e,t,n,r,l+1,a+2,o),f*_i>d&&(d=f*_i)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ei(e){return e.toLowerCase().replace(wi,` `)}function Di(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Ti(e,t,Ei(e),Ei(t),0,0,{})}var Oi=`[cmdk-group=""]`,ki=`[cmdk-group-items=""]`,Ai=`[cmdk-group-heading=""]`,ji=`[cmdk-item=""]`,Mi=`${ji}:not([aria-disabled="true"])`,Ni=`cmdk-item-select`,Pi=`data-value`,Fi=(e,t,n)=>Di(e,t,n),Ii=N.createContext(void 0),Li=()=>N.useContext(Ii),Ri=N.createContext(void 0),zi=()=>N.useContext(Ri),Bi=N.createContext(void 0),Vi=N.forwardRef((e,t)=>{let n=ta(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=ta(()=>new Set),i=ta(()=>new Map),a=ta(()=>new Map),o=ta(()=>new Set),s=$i(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=te(),y=te(),b=te(),x=N.useRef(null),S=ia();ea(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),ea(()=>{S(6,O)},[]);let C=N.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)D(),E(),S(1,ee);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=ne()?.id,C.emit()}),r||S(5,O),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=N.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{D(),E(),n.current.value||ee(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=ne();S(4,()=>{D(),t?.getAttribute(`id`)===e&&ee(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??Fi;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;k().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ki);t?t.appendChild(e.parentElement===t?e:e.closest(`${ki} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ki} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Oi}[${Pi}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function ee(){let e=k().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Pi);C.setState(`value`,e||void 0)}function D(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function O(){var e;let t=ne();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Oi)?.querySelector(Ai))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function ne(){return x.current?.querySelector(`${ji}[aria-selected="true"]`)}function k(){return Array.from(x.current?.querySelectorAll(Mi)||[])}function re(e){let t=k()[e];t&&C.setState(`value`,t.getAttribute(Pi))}function ie(e){var t;let n=ne(),r=k(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Pi))}function ae(e){let t=ne()?.closest(Oi),n;for(;t&&!n;)t=e>0?Zi(t,Oi):Qi(t,Oi),n=t?.querySelector(Mi);n?C.setState(`value`,n.getAttribute(Pi)):ie(e)}let oe=()=>re(k().length-1),se=e=>{e.preventDefault(),e.metaKey?oe():e.altKey?ae(1):ie(1)},ce=e=>{e.preventDefault(),e.metaKey?re(0):e.altKey?ae(-1):ie(-1)};return N.createElement(A.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&se(e);break;case`ArrowDown`:se(e);break;case`p`:case`k`:g&&e.ctrlKey&&ce(e);break;case`ArrowUp`:ce(e);break;case`Home`:e.preventDefault(),re(0);break;case`End`:e.preventDefault(),oe();break;case`Enter`:{e.preventDefault();let t=ne();if(t){let e=new Event(Ni);t.dispatchEvent(e)}}}}},N.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:sa},c),oa(e,e=>N.createElement(Ri.Provider,{value:C},N.createElement(Ii.Provider,{value:w},e))))}),Hi=N.forwardRef((e,t)=>{let n=te(),r=N.useRef(null),i=N.useContext(Bi),a=Li(),o=$i(e),s=o.current?.forceMount??i?.forceMount;ea(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=ra(n,r,[e.value,e.children,r],e.keywords),l=zi(),u=na(e=>e.value&&e.value===c.current),d=na(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);N.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Ni,f),()=>t.removeEventListener(Ni,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return N.createElement(A.div,{ref:D(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Ui=N.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=te(),s=N.useRef(null),c=N.useRef(null),l=te(),u=Li(),d=na(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);ea(()=>u.group(o),[]),ra(o,s,[e.value,e.heading,c]);let f=N.useMemo(()=>({id:o,forceMount:i}),[i]);return N.createElement(A.div,{ref:D(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&N.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),oa(e,e=>N.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},N.createElement(Bi.Provider,{value:f},e))))}),Wi=N.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=N.useRef(null),a=na(e=>!e.search);return!n&&!a?null:N.createElement(A.div,{ref:D(i,t),...r,"cmdk-separator":``,role:`separator`})}),Gi=N.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=zi(),o=na(e=>e.search),s=na(e=>e.selectedItemId),c=Li();return N.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),N.createElement(A.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Ki=N.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=N.useRef(null),o=N.useRef(null),s=na(e=>e.selectedItemId),c=Li();return N.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),N.createElement(A.div,{ref:D(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},oa(e,e=>N.createElement(`div`,{ref:D(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),qi=N.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return N.createElement(he,{open:n,onOpenChange:r},N.createElement(ee,{container:o},N.createElement(oe,{"cmdk-overlay":``,className:i}),N.createElement(_e,{"aria-label":e.label,"cmdk-dialog":``,className:a},N.createElement(Vi,{ref:t,...s}))))}),Ji=N.forwardRef((e,t)=>na(e=>e.filtered.count===0)?N.createElement(A.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Yi=N.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return N.createElement(A.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},oa(e,e=>N.createElement(`div`,{"aria-hidden":!0},e)))}),Xi=Object.assign(Vi,{List:Ki,Item:Hi,Input:Gi,Group:Ui,Separator:Wi,Dialog:qi,Empty:Ji,Loading:Yi});function Zi(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Qi(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function $i(e){let t=N.useRef(e);return ea(()=>{t.current=e}),t}var ea=typeof window>`u`?N.useEffect:N.useLayoutEffect;function ta(e){let t=N.useRef();return t.current===void 0&&(t.current=e()),t}function na(e){let t=zi(),n=()=>e(t.snapshot());return N.useSyncExternalStore(t.subscribe,n,n)}function ra(e,t,n,r=[]){let i=N.useRef(),a=Li();return ea(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Pi,s),i.current=s}),i}var ia=()=>{let[e,t]=N.useState(),n=ta(()=>new Map);return ea(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function aa(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function oa({asChild:e,children:t},n){return e&&N.isValidElement(t)?N.cloneElement(aa(t),{ref:t.ref},n(t.props.children)):n(t)}var sa={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},ca=[{label:`All`,pattern:``},{label:`Review`,pattern:`review`},{label:`PR`,pattern:`pr`},{label:`Quality`,pattern:`quality`}];function la(e,t){return t?`${e.invocation} ${e.description}`.toLowerCase().includes(t):!0}var ua={display:`inline-flex`,alignItems:`center`,gap:8,padding:`6px 10px`,background:o.cardBg,border:`1px solid ${o.border}`,borderRadius:6,color:o.text,cursor:`pointer`,fontFamily:`inherit`,fontSize:13,minWidth:280,justifyContent:`space-between`},da={background:o.cardBg,border:`1px solid ${o.border}`,borderRadius:8,boxShadow:`0 8px 24px rgba(0,0,0,0.4)`,width:420,maxHeight:440,display:`flex`,flexDirection:`column`,overflow:`hidden`,zIndex:1e3},fa={display:`flex`,gap:4,padding:`8px 8px 0 8px`,flexWrap:`wrap`},pa={width:`100%`,background:`transparent`,border:`none`,borderBottom:`1px solid ${o.border}`,color:o.text,fontSize:13,padding:`10px 12px`,outline:`none`,fontFamily:`inherit`},ma={overflowY:`auto`,padding:6,flex:1},ha={color:o.muted,fontSize:10,textTransform:`uppercase`,letterSpacing:.5,padding:`8px 8px 4px 8px`},ga={padding:`8px 10px`,borderRadius:6,cursor:`pointer`,display:`flex`,flexDirection:`column`,gap:2},_a={color:o.code,fontFamily:a,fontSize:12},va={color:o.muted,fontSize:11,lineHeight:1.4,overflow:`hidden`,textOverflow:`ellipsis`,display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`},ya={color:o.muted,fontSize:12,padding:`16px 12px`,textAlign:`center`};function ba(e){return{padding:`4px 10px`,borderRadius:999,border:`1px solid ${e?o.toggleAccent:o.border}`,background:e?o.toggleAccent:`transparent`,color:e?o.darkBg:o.text,fontSize:11,cursor:`pointer`,fontFamily:`inherit`}}function xa({value:e,onChange:t,skills:n,loading:r,error:i}){let[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(``),d=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(s){let e=setTimeout(()=>d.current?.focus(),0);return()=>clearTimeout(e)}},[s]);let f=(0,N.useMemo)(()=>n.filter(e=>la(e,l)),[n,l]),p=f.filter(e=>e.source===`global`),m=f.filter(e=>e.source===`plugin`);return(0,P.jsxs)(ge,{open:s,onOpenChange:c,children:[(0,P.jsx)(ae,{asChild:!0,children:(0,P.jsxs)(`button`,{type:`button`,style:ua,"aria-label":`Pick reviewing-phase skill`,children:[(0,P.jsx)(`span`,{style:{fontFamily:a,color:o.code,fontSize:12},children:`/${e}`}),(0,P.jsx)(`span`,{style:{color:o.muted,fontSize:11},children:s?`▴`:`▾`})]})}),(0,P.jsx)(le,{children:(0,P.jsx)(ve,{sideOffset:4,align:`start`,style:da,children:(0,P.jsxs)(Xi,{shouldFilter:!0,loop:!0,children:[(0,P.jsx)(`div`,{style:fa,children:ca.map(e=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>u(e.pattern),style:ba(l===e.pattern),children:e.label},e.label))}),(0,P.jsx)(Xi.Input,{ref:d,placeholder:`Search skills…`,style:pa}),(0,P.jsx)(Xi.List,{style:ma,children:r?(0,P.jsx)(`div`,{style:ya,children:`Loading skills…`}):i?(0,P.jsx)(`div`,{style:{...ya,color:o.red},children:i}):f.length===0?(0,P.jsx)(Xi.Empty,{style:ya,children:`No skills match.`}):(0,P.jsxs)(P.Fragment,{children:[p.length>0&&(0,P.jsxs)(Xi.Group,{heading:`Global`,children:[(0,P.jsx)(`div`,{style:ha,children:`Global (~/.claude/skills)`}),p.map(e=>(0,P.jsx)(Sa,{skill:e,onSelect:e=>{t(e),c(!1)}},e.invocation))]}),m.length>0&&(0,P.jsxs)(Xi.Group,{heading:`Plugin`,children:[(0,P.jsx)(`div`,{style:ha,children:`Plugin`}),m.map(e=>(0,P.jsx)(Sa,{skill:e,onSelect:e=>{t(e),c(!1)}},e.invocation))]})]})})]})})})]})}function Sa({skill:e,onSelect:t}){let n=`${e.invocation} ${e.description}`;return(0,P.jsxs)(Xi.Item,{value:n,onSelect:()=>t(e.invocation),style:ga,children:[(0,P.jsx)(`span`,{style:_a,children:`/${e.invocation}`}),e.description&&(0,P.jsx)(`span`,{style:va,children:e.description})]})}function Ca({arg:e,value:t,onChange:n}){switch(e.type){case`enum`:return(0,P.jsx)(wa,{arg:e,value:t,onChange:n});case`integer`:return(0,P.jsx)(Ta,{arg:e,value:t,onChange:n});case`boolean`:return(0,P.jsx)(Da,{arg:e,value:t,onChange:n});default:return(0,P.jsx)(Ea,{arg:e,value:t,onChange:n})}}function wa({arg:e,value:t,onChange:n}){return(0,P.jsx)(`select`,{value:typeof t==`string`?t:typeof e.default==`string`?e.default:``,onChange:e=>n(e.target.value),style:ka,children:(e.values??[]).map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})}function Ta({arg:e,value:t,onChange:n}){let r=typeof t==`number`?t:typeof e.default==`number`?e.default:``;return(0,P.jsx)(`input`,{type:`number`,min:e.min,max:e.max,step:e.step??1,value:r===``?``:r,onChange:t=>{let r=t.target.value;if(r===``){n(void 0);return}let i=Number(r);!Number.isFinite(i)||!Number.isInteger(i)||n(Math.max(e.min??-1/0,Math.min(e.max??1/0,i)))},style:{...Oa,width:96,textAlign:`right`}})}function Ea({arg:e,value:t,onChange:n}){return(0,P.jsx)(`input`,{type:`text`,value:typeof t==`string`?t:typeof e.default==`string`?e.default:``,placeholder:e.default===void 0?``:String(e.default),onChange:e=>n(e.target.value),style:{...Oa,minWidth:200}})}function Da({arg:e,value:t,onChange:n}){return(0,P.jsx)(`label`,{style:{display:`inline-flex`,alignItems:`center`,cursor:`pointer`},children:(0,P.jsx)(`input`,{type:`checkbox`,checked:typeof t==`boolean`?t:typeof e.default==`boolean`?e.default:!1,onChange:e=>n(e.target.checked),style:{width:18,height:18,cursor:`pointer`}})})}var Oa={background:o.cardBg,color:o.text,border:`1px solid ${o.border}`,borderRadius:4,padding:`6px 8px`,fontSize:12,fontFamily:a},ka={...Oa,cursor:`pointer`,paddingRight:24},Aa={description:`_description_1ocr4_1`,argHint:`_argHint_1ocr4_8`,inlineCode:`_inlineCode_1ocr4_15`,pickerWrapper:`_pickerWrapper_1ocr4_24`,undiscoverableWarning:`_undiscoverableWarning_1ocr4_31`};function ja({review:e,open:t,onPatchReview:n}){let[r,i]=(0,N.useState)([]),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null);(0,N.useEffect)(()=>{if(!t)return;let e=new AbortController;return o(!0),c(null),fetch(`/api/claude-skills`,{signal:e.signal}).then(e=>{if(!e.ok)throw Error(e.statusText||String(e.status));return e.json()}).then(e=>{i(Array.isArray(e)?e:[]),o(!1)}).catch(e=>{e?.name!==`AbortError`&&(c(e.message||`Failed to load skills`),o(!1))}),()=>e.abort()},[t]);let l=r.find(t=>t.invocation===e.skill),u=!a&&!s&&r.length>0&&!l,d=e.arguments?.[e.skill]??{};function f(t,r){let i={...d};r===void 0||r===``||r===null?delete i[t]:i[t]=r,n({arguments:{...e.arguments??{},[e.skill]:i}})}return(0,P.jsxs)(W,{title:`Review phase`,persistKey:`ideas-settings.review`,children:[(0,P.jsxs)(`p`,{className:Aa.description,children:[`How the pipeline's reviewing phase analyzes pull requests. The default is `,(0,P.jsx)(`code`,{className:Aa.inlineCode,children:`/superpowers:requesting-code-review`}),` `,`(single-pass review against the current branch). Pick any installed skill from your global library or installed plugins; the skill's declared arguments will render below.`]}),(0,P.jsx)(M,{label:`Skill`,hint:`If the chosen skill isn't installed where Claude can resolve it, the pipeline falls back to /superpowers:requesting-code-review.`,children:(0,P.jsxs)(`div`,{className:Aa.pickerWrapper,children:[(0,P.jsx)(xa,{value:e.skill,onChange:e=>n({skill:e}),skills:r,loading:a,error:s}),u&&(0,P.jsx)(`span`,{className:Aa.undiscoverableWarning,children:`Not discoverable on this machine; will fall back at run time.`})]})}),l&&l.argumentHint&&(0,P.jsxs)(`p`,{className:Aa.argHint,children:[`Argument hint:`,` `,(0,P.jsx)(`code`,{className:Aa.inlineCode,children:l.argumentHint})]}),l&&l.args.length===0&&(0,P.jsx)(`p`,{className:Aa.argHint,children:`This skill declares no arguments.`}),l?.args.map((e,t)=>(0,P.jsx)(M,{label:e.name,hint:e.description??Ma(e.name),divider:t>0,children:(0,P.jsx)(Ca,{arg:e,value:d[e.name],onChange:t=>f(e.name,t)})},e.name))]})}function Ma(e){switch(e){case`severityFloor`:return`Lowest severity to fix. 'all' = fix everything.`;case`maxRounds`:return`Cap on review-fix iterations per PR.`;case`scope`:return`What to review (e.g. branch, staged, files:foo).`;default:return}}var Na={skill:`superpowers:requesting-code-review`,arguments:{}},Pa={defaultOwner:null,defaultVisibility:`private`,enableBranchProtection:!0,defaultGitignoreTemplate:`Node`},Fa={ideasDir:null,maxConcurrent:3,notificationChannel:`dashboard`,projects:{},phaseTimeoutMs:18e5,autonomyLadderBudgets:{selfRecover:2,switchTactic:1,userPing:1},selfImproveSchedule:`0 6 * * 1`,review:Na,promptCache:!0,injectReviewRules:!0,phasePatternLearning:!0,prPollerIntervalSeconds:120};function Ia({open:e,onClose:t,settings:n,onUpdateSettings:r}){(0,N.useEffect)(()=>{if(!e)return;function n(e){e.key===`Escape`&&t()}return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let[i,a]=(0,N.useState)([]),[o,s]=(0,N.useState)(null);(0,N.useEffect)(()=>{let e=new AbortController;return fetch(`/api/workflows`,{signal:e.signal}).then(e=>{if(!e.ok)throw Error(e.statusText||`HTTP ${e.status}`);return e.json()}).then(e=>a(e.workflows??[])).catch(e=>{e instanceof Error&&e.name===`AbortError`||(console.warn(`IdeasSettingsDrawer: GET /api/workflows failed`,e),s(e instanceof Error?e.message:String(e)))}),()=>e.abort()},[]);let c=n?.pipelineFeatures??Fa,l=c.review??Na,u=c.phaseModels??{},d=c.phasePatternLearning??!0;function f(e){let t={...l,...e};r({pipelineFeatures:{...c,review:t}})}function p(e,t){let n={...c.phaseModels??{}};t===null?delete n[e]:n[e]=t,r({pipelineFeatures:{...c,phaseModels:n}})}let h=c.newProjectBootstrap??Pa;function _(e){let t={...h,...e};r({pipelineFeatures:{...c,newProjectBootstrap:t}})}function x(e){r({pipelineFeatures:{...c,...e}})}function E(e){let t=c.writingPlans??{maxTasks:15};r({pipelineFeatures:{...c,writingPlans:{...t,...e}}})}return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:e?`${G.backdrop} ${G.backdropOpen}`:G.backdrop,onClick:t,"aria-hidden":`true`}),(0,P.jsxs)(`aside`,{role:`dialog`,"aria-label":`Ideas settings`,"aria-modal":`true`,ref:t=>{t&&(e?t.removeAttribute(`inert`):t.setAttribute(`inert`,``))},className:e?`${G.drawer} ${G.drawerOpen}`:G.drawer,children:[(0,P.jsxs)(`div`,{className:G.header,children:[(0,P.jsx)(`h2`,{className:G.title,children:`Ideas Settings`}),(0,P.jsx)(T,{onClick:t,"aria-label":`Close ideas settings`,className:G.closeButton,variant:`ghost`,children:`×`})]}),(0,P.jsxs)(`div`,{className:G.body,children:[(0,P.jsx)(ri,{open:e}),(0,P.jsxs)(W,{title:`Pipeline phases`,persistKey:`ideas-settings.pipeline-phases`,description:`Each idea flows through these phases in order. The picker below sets the default model per phase; an idea can override any of them from its detail drawer.`,children:[(0,P.jsx)(M,{label:`Default workflow`,hint:o?`Phase chain used for new ideas. Could not load workflow list (${o}); showing current value only.`:`Phase chain used for new ideas. An idea can override this from its detail drawer.`,children:(0,P.jsx)(C,{compact:!0,value:c.defaultWorkflow??`superpowers`,onChange:e=>x({defaultWorkflow:e.target.value===`superpowers`?null:e.target.value}),children:i.length>0?i.map(e=>(0,P.jsx)(`option`,{value:e.name,children:e.displayName},e.name)):(0,P.jsx)(`option`,{value:c.defaultWorkflow??`superpowers`,children:c.defaultWorkflow??`superpowers`})})}),(0,P.jsx)(`div`,{className:G.phasePills,children:y.map((e,t)=>(0,P.jsxs)(`span`,{className:G.phaseItem,children:[(0,P.jsx)(`span`,{className:G.phasePill,children:m[e]}),t<y.length-1&&(0,P.jsx)(`span`,{className:G.phaseArrow,children:`→`})]},e))})]}),(0,P.jsxs)(W,{title:`Per-phase model`,persistKey:`ideas-settings.per-phase-model`,children:[(0,P.jsxs)(`p`,{className:G.sectionHint,children:[`Default model used by each phase. Recorded in`,` `,(0,P.jsx)(`code`,{className:G.inlineCode,children:`trace.ndjson`}),` per attempt for cost analysis.`]}),y.filter(e=>g[e]).map((e,t)=>{let n=u[e],r=b[e],{model:i,source:a}=S(e,void 0,u),o=a===`settings`?`this setting`:`compile-time`;return(0,P.jsx)(M,{label:m[e],hint:`effective: ${i} · ${o}`,divider:t>0,children:(0,P.jsxs)(C,{compact:!0,className:[G.wideControl,n?G.selectActive:void 0].filter(Boolean).join(` `),value:n??``,onChange:t=>{let n=t.target.value;p(e,n===``?null:n)},children:[(0,P.jsxs)(`option`,{value:``,children:[`Default (`,r,`)`]}),v.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})},e)})]}),(0,P.jsx)(fi,{phaseEffortLevels:c.phaseEffortLevels,onPatch:e=>void r({pipelineFeatures:{...c,phaseEffortLevels:e}})}),(0,P.jsx)(ja,{review:l,open:e,onPatchReview:f}),(0,P.jsxs)(W,{title:`Prompt context injection`,persistKey:`ideas-settings.prompt-context`,description:`Controls which ambient context blocks are prepended to each phase prompt.`,children:[(0,P.jsx)(M,{label:`Inject review-derived rules`,hint:`When enabled, each phase prompt includes the project's review-derived rules (curated patterns from past review runs) between the project context block and the prior findings block.`,children:(0,P.jsx)(T,{variant:c.injectReviewRules??!0?`primary`:`ghost`,size:`sm`,"aria-pressed":c.injectReviewRules??!0,onClick:()=>x({injectReviewRules:!(c.injectReviewRules??!0)}),children:c.injectReviewRules??!0?`On`:`Off`})}),(0,P.jsx)(M,{label:`Auto-harvest deferred review suggestions`,hint:`When enabled, findings the reviewer marks as 'defer' are saved as draft ideas at the end of each pipeline run.`,children:(0,P.jsx)(T,{variant:c.harvestDeferredSuggestions??!1?`primary`:`ghost`,size:`sm`,"aria-pressed":c.harvestDeferredSuggestions??!1,onClick:()=>x({harvestDeferredSuggestions:!(c.harvestDeferredSuggestions??!1)}),children:c.harvestDeferredSuggestions??!1?`On`:`Off`})}),(0,P.jsx)(M,{label:`In-flight notebook`,hint:`When enabled, phase agents are invited to emit notebook entries mid-run. Entries are stored per-idea and harvested as draft ideas after each pipeline run. Visible in the Notebook tab of the idea detail drawer.`,children:(0,P.jsx)(T,{variant:c.inflightNotebookEnabled??!1?`primary`:`ghost`,size:`sm`,onClick:()=>x({inflightNotebookEnabled:!(c.inflightNotebookEnabled??!1)}),children:c.inflightNotebookEnabled??!1?`On`:`Off`})}),(0,P.jsx)(M,{label:`Phase-specific pattern learning`,hint:`When enabled, note-only review findings are recorded to the implementing-phase pattern store and injected as prompt context for future runs. The weekly clusterer produces draft ideas (not direct file edits) for operator review.`,children:(0,P.jsx)(T,{variant:d?`primary`:`ghost`,size:`sm`,"aria-pressed":d,onClick:()=>x({phasePatternLearning:!d}),children:d?`On`:`Off`})}),(0,P.jsx)(M,{label:`Record implementing patterns`,hint:`When enabled, each successful implementing run records its plan task titles as low-severity pattern findings. These appear in the 'Ambient prior findings' block of future brainstorming and writing-plans prompts.`,divider:!0,children:(0,P.jsx)(T,{variant:c.recordImplementingPatterns??!1?`primary`:`ghost`,size:`sm`,onClick:()=>x({recordImplementingPatterns:!(c.recordImplementingPatterns??!1)}),children:c.recordImplementingPatterns??!1?`On`:`Off`})})]}),(0,P.jsx)(li,{writingPlans:c.writingPlans,onPatchWritingPlans:E}),(0,P.jsxs)(W,{title:`New project bootstrap`,persistKey:`ideas-settings.bootstrap`,description:`Defaults applied when the pipeline bootstraps a new GitHub repository for an idea. Each idea can override these from its detail drawer.`,children:[(0,P.jsx)(M,{label:`Default owner`,hint:`GitHub username or organization that owns new repos.`,children:(0,P.jsx)(w,{compact:!0,className:G.wideControl,type:`text`,value:h.defaultOwner??``,placeholder:`Your GitHub username or org`,onChange:e=>_({defaultOwner:e.target.value||null})})}),(0,P.jsx)(M,{label:`Default visibility`,hint:`Repository visibility for newly created repos.`,divider:!0,children:(0,P.jsxs)(C,{compact:!0,className:G.wideControl,value:h.defaultVisibility,onChange:e=>_({defaultVisibility:e.target.value}),children:[(0,P.jsx)(`option`,{value:`private`,children:`private`}),(0,P.jsx)(`option`,{value:`public`,children:`public`}),(0,P.jsx)(`option`,{value:`internal`,children:`internal`})]})}),(0,P.jsx)(M,{label:`Branch protection`,hint:`Enable branch protection rules on the default branch.`,divider:!0,children:(0,P.jsx)(T,{variant:h.enableBranchProtection?`primary`:`ghost`,size:`sm`,onClick:()=>_({enableBranchProtection:!h.enableBranchProtection}),children:h.enableBranchProtection?`On`:`Off`})}),(0,P.jsx)(M,{label:`Gitignore template`,hint:`GitHub gitignore template name.`,divider:!0,children:(0,P.jsx)(w,{compact:!0,className:G.wideControl,type:`text`,value:h.defaultGitignoreTemplate,placeholder:`Node`,onChange:e=>_({defaultGitignoreTemplate:e.target.value})})})]}),(0,P.jsx)(oi,{pf:c,patchPf:x})]})]})]})}var K={section:`_section_150be_1`,empty:`_empty_150be_7`,error:`_error_150be_13`,retry:`_retry_150be_23`,list:`_list_150be_38`,row:`_row_150be_47`,rowIn:`_rowIn_150be_1`,rowMalformed:`_rowMalformed_150be_64`,malformedLabel:`_malformedLabel_150be_74`,malformedDetail:`_malformedDetail_150be_82`,rowHeader:`_rowHeader_150be_89`,rowTime:`_rowTime_150be_98`,rowDuration:`_rowDuration_150be_103`,rowCounts:`_rowCounts_150be_108`,count:`_count_150be_116`,countLabel:`_countLabel_150be_127`,countValue:`_countValue_150be_134`,count_merged:`_count_merged_150be_139`,count_closed:`_count_closed_150be_140`,count_changesRequested:`_count_changesRequested_150be_141`,count_noOp:`_count_noOp_150be_142`,errorPill:`_errorPill_150be_144`,fatalPill:`_fatalPill_150be_158`},La=10;function Ra(){let[e,t]=(0,N.useState)([]),[n,r]=(0,N.useState)(!1),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(null),l=(0,N.useCallback)(async()=>{o(!0),c(null);try{let e=await fetch(`/api/ideas/reconciler-runs?limit=10`);if(!e.ok){let t=`${e.status} ${e.statusText||`request failed`}`;try{let n=await e.json();n?.error&&(t=n.error)}catch{}c(t);return}t((await e.json()).runs),r(!0)}catch(e){c(e instanceof Error?e.message:`network error`)}finally{o(!1)}},[]);return i(f,(0,N.useCallback)(e=>{if(!e||typeof e!=`object`)return;let n=e.trace;if(!n||typeof n!=`object`)return;let r=Ua(n);t(e=>[r.length===0?{ok:!0,trace:n}:{ok:!1,reason:`shape-mismatch`,raw:Wa(n),missing:r},...e].slice(0,La))},[])),(0,N.useEffect)(()=>{!n&&!a&&!s&&l()},[n,a,s,l]),(0,P.jsxs)(j,{title:`Recent runs`,persistKey:`reconciler.recentRuns`,defaultExpanded:!1,badge:(0,N.useMemo)(()=>n?e.length:void 0,[n,e.length]),className:K.section,children:[a&&!n&&(0,P.jsx)(`div`,{className:K.empty,children:`Loading recent runs…`}),s&&(0,P.jsxs)(`div`,{className:K.error,role:`alert`,children:[`Couldn't load recent runs: `,s,` `,(0,P.jsx)(T,{variant:`ghost`,size:`sm`,className:K.retry,onClick:()=>{l()},children:`Retry`})]}),n&&e.length===0&&(0,P.jsx)(`div`,{className:K.empty,children:`No reconciler runs recorded yet. The reconciler runs every 120 seconds; the first row will appear after the next pass.`}),n&&e.length>0&&(0,P.jsx)(`ol`,{className:K.list,children:e.map((e,t)=>(0,P.jsx)(Ba,{run:e},t))})]})}function za(e){switch(e.reason){case`parse-error`:return{label:`Unparseable line`,detail:e.error};case`shape-mismatch`:return{label:`Bad shape`,detail:`missing: ${e.missing.join(`, `)}`};default:return{label:`Unknown`,detail:``}}}function Ba({run:e}){if(!e.ok){let{label:t,detail:n}=za(e);return(0,P.jsxs)(`li`,{className:K.rowMalformed,children:[(0,P.jsx)(`span`,{className:K.malformedLabel,children:t}),(0,P.jsx)(`span`,{className:K.malformedDetail,children:n})]})}let{trace:t}=e,n=t.errors.length,r=Object.values(t.transitions).reduce((e,t)=>e+t,0);return(0,P.jsxs)(`li`,{className:K.row,children:[(0,P.jsxs)(`div`,{className:K.rowHeader,children:[(0,P.jsx)(E,{iso:t.at,className:K.rowTime}),(0,P.jsx)(`span`,{className:K.rowDuration,children:Ha(t.durationMs)})]}),(0,P.jsxs)(`div`,{className:K.rowCounts,"aria-label":`scanned ${t.scanned} of ${r} ideas`,children:[(0,P.jsx)(Va,{label:`M`,value:t.transitions.merged,variant:`merged`}),(0,P.jsx)(Va,{label:`C`,value:t.transitions.closed,variant:`closed`}),(0,P.jsx)(Va,{label:`CR`,value:t.transitions.changesRequested,variant:`changesRequested`}),(0,P.jsx)(Va,{label:`—`,value:t.transitions.noOp,variant:`noOp`}),n>0&&(0,P.jsxs)(`span`,{className:K.errorPill,title:t.errors.map(e=>`${e.ideaId}: ${e.error}`).join(`
|
|
2
|
+
`),children:[n,` `,n===1?`error`:`errors`]}),t.disabledOnFatal&&(0,P.jsx)(`span`,{className:K.fatalPill,title:`Reconciler disabled by a fatal gh error during this pass`,children:`disabled`})]})]})}function Va({label:e,value:t,variant:n}){return(0,P.jsxs)(`span`,{className:`${K.count} ${K[`count_${n}`]}`,children:[(0,P.jsx)(`span`,{className:K.countLabel,children:e}),(0,P.jsx)(`span`,{className:K.countValue,children:t})]})}function Ha(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return r===0?`${n}m`:`${n}m ${r}s`}function Ua(e){let t=e,n=[],r=t.transitions;if(typeof r!=`object`||!r||Array.isArray(r))n.push(`transitions:type`);else{for(let e of[`merged`,`closed`,`changesRequested`,`noOp`]){let t=r[e];(typeof t!=`number`||!Number.isFinite(t))&&n.push(`transitions.${e}:type`)}let e=r[`heal-stale-blocked`];e!==void 0&&(typeof e!=`number`||!Number.isFinite(e))&&n.push(`transitions.heal-stale-blocked:type`)}return Array.isArray(t.errors)||n.push(`errors:type`),n}function Wa(e){try{return JSON.stringify(e)}catch{return`[unserializable]`}}var q={card:`_card_a9m5r_1`,fadeIn:`_fadeIn_a9m5r_1`,header:`_header_a9m5r_17`,headerLeft:`_headerLeft_a9m5r_25`,title:`_title_a9m5r_32`,lastRun:`_lastRun_a9m5r_39`,lastRunStrong:`_lastRunStrong_a9m5r_45`,button:`_button_a9m5r_50`,spinner:`_spinner_a9m5r_82`,spin:`_spin_a9m5r_82`,counts:`_counts_a9m5r_97`,countCell:`_countCell_a9m5r_103`,countLabel:`_countLabel_a9m5r_115`,countValue:`_countValue_a9m5r_123`,countPulse:`_countPulse_a9m5r_1`,countValueMerged:`_countValueMerged_a9m5r_137`,countValueClosed:`_countValueClosed_a9m5r_138`,countValueChangesRequested:`_countValueChangesRequested_a9m5r_139`,countValueNoOp:`_countValueNoOp_a9m5r_140`,errorBanner:`_errorBanner_a9m5r_142`,errorIcon:`_errorIcon_a9m5r_156`,disabledNote:`_disabledNote_a9m5r_161`};function Ga({status:e,loading:t,onReconcile:n}){let[r,i]=(0,N.useState)(!1),a=t||r,o=(0,N.useCallback)(async()=>{if(!a){i(!0);try{await n()}finally{i(!1)}}},[a,n]),s=e?.enabled??!1,c=a||!s,l=e?.lastRunAt??null,u=e?.transitions??{merged:0,closed:0,changesRequested:0,noOp:0};return(0,P.jsxs)(`section`,{className:q.card,"aria-label":`PR reconciler status`,children:[(0,P.jsxs)(`div`,{className:q.header,children:[(0,P.jsxs)(`div`,{className:q.headerLeft,children:[(0,P.jsx)(`span`,{className:q.title,children:`PR Reconciler`}),(0,P.jsx)(`span`,{className:q.lastRun,children:s?l?(0,P.jsxs)(P.Fragment,{children:[`Last reconciled`,` `,(0,P.jsx)(E,{iso:l,className:q.lastRunStrong})]}):`Never run`:(0,P.jsx)(`span`,{className:q.disabledNote,children:`Reconciler not running`})})]}),(0,P.jsxs)(T,{variant:`primary`,className:q.button,onClick:()=>{o()},disabled:c,"aria-busy":a,children:[a&&(0,P.jsx)(`span`,{className:q.spinner,"aria-hidden":`true`}),a?`Reconciling…`:`Reconcile now`]})]}),(0,P.jsxs)(`div`,{className:q.counts,role:`list`,"aria-label":`Last-run transition counts`,children:[(0,P.jsx)(Ka,{label:`Merged`,value:u.merged,valueClass:q.countValueMerged}),(0,P.jsx)(Ka,{label:`Closed`,value:u.closed,valueClass:q.countValueClosed}),(0,P.jsx)(Ka,{label:`Changes requested`,value:u.changesRequested,valueClass:q.countValueChangesRequested}),(0,P.jsx)(Ka,{label:`No-op`,value:u.noOp,valueClass:q.countValueNoOp})]}),e?.lastError&&(0,P.jsxs)(`div`,{className:q.errorBanner,role:`alert`,children:[(0,P.jsx)(`span`,{className:q.errorIcon,"aria-hidden":`true`,children:`!`}),(0,P.jsxs)(`span`,{children:[`Last reconcile error: `,e.lastError]})]}),(0,P.jsx)(Ra,{})]})}function Ka({label:e,value:t,valueClass:n}){return(0,P.jsxs)(`div`,{className:q.countCell,role:`listitem`,children:[(0,P.jsx)(`span`,{className:q.countLabel,children:e}),(0,P.jsx)(`span`,{className:`${q.countValue} ${n}`,children:t},t)]})}function qa({open:e,onClose:t,status:n,loading:r,onReconcile:i}){return(0,N.useEffect)(()=>{if(!e)return;function n(e){e.key===`Escape`&&t()}return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{onClick:t,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,zIndex:80,opacity:+!!e,pointerEvents:e?`auto`:`none`,transition:`opacity 0.2s ease`},"aria-hidden":!e}),(0,P.jsxs)(`aside`,{role:`dialog`,"aria-label":`PR Reconciler`,"aria-modal":`true`,style:{position:`fixed`,top:0,right:0,bottom:`var(--tw-bottom-nav-h, 0px)`,width:`min(480px, 95vw)`,background:o.cardBg,borderLeft:`1px solid ${o.border}`,zIndex:81,display:`flex`,flexDirection:`column`,transform:e?`translateX(0)`:`translateX(100%)`,transition:`transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,overflow:`hidden`},children:[(0,P.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,padding:`14px 16px`,borderBottom:`1px solid ${o.border}`,flexShrink:0},children:[(0,P.jsx)(`h2`,{style:{margin:0,fontSize:16,fontWeight:600,color:o.text},children:`PR Reconciler`}),(0,P.jsx)(`button`,{onClick:t,"aria-label":`Close PR reconciler`,style:{background:`transparent`,border:`none`,color:o.muted,cursor:`pointer`,fontSize:22,lineHeight:1,padding:`4px 8px`,minHeight:44,minWidth:44,display:`flex`,alignItems:`center`,justifyContent:`center`},children:`×`})]}),(0,P.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`16px 18px 32px`},children:e&&(0,P.jsx)(Ga,{status:n,loading:r,onReconcile:i})})]})]})}function Ja(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.slug==`string`?t.state===null||typeof t.state==`object`&&t.state!==null:!1}function Ya(){let[e,t]=(0,N.useState)([]),[n,r]=(0,N.useState)(!0),[a,o]=(0,N.useState)(null);(0,N.useEffect)(()=>{let e=new AbortController;return r(!0),o(null),fetch(`/api/profiles`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} ${e.statusText||``}`.trim());return await e.json()}).then(e=>{if(!Array.isArray(e))throw Error(`expected array response`);t(e),r(!1)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||(o(e instanceof Error?e.message:String(e)),r(!1))}),()=>e.abort()},[]),i(u,(0,N.useCallback)(e=>{if(!Ja(e))return;let{slug:n,state:r}=e;t(e=>{if(r===null)return e.filter(e=>e.slug!==n);let t=e.findIndex(e=>e.slug===n);if(t>=0){let n=[...e];return n[t]={...n[t],bootstrapState:r},n}return[...e,{slug:n,rootPath:``,lastRefreshedAt:``,inputsHash:``,stackTags:[],bootstrapState:r,pendingPrUrl:null}]})},[]));let s=(0,N.useRef)(null);return i(`ws:reconnected`,(0,N.useCallback)(()=>{s.current?.abort();let e=new AbortController;s.current=e,fetch(`/api/profiles`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return await e.json()}).then(e=>{Array.isArray(e)&&t(e)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||o(e instanceof Error?e.message:String(e))})},[])),(0,N.useEffect)(()=>()=>{s.current?.abort()},[]),{profiles:e,isLoading:n,error:a,refresh:(0,N.useCallback)(async e=>{o(null);try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}/refresh`,{method:`POST`});if(!t.ok){let e=await t.json().then(e=>e.error??`HTTP ${t.status}`).catch(e=>(console.warn(`refresh: failed to parse error body`,{status:t.status,message:e.message}),`HTTP ${t.status}`));throw Error(e)}}catch(e){o(e instanceof Error?e.message:String(e))}},[])}}var J={card:`_card_o3qo0_1`,fadeIn:`_fadeIn_o3qo0_1`,header:`_header_o3qo0_17`,title:`_title_o3qo0_25`,empty:`_empty_o3qo0_32`,errorBanner:`_errorBanner_o3qo0_38`,list:`_list_o3qo0_48`,row:`_row_o3qo0_57`,rowHeader:`_rowHeader_o3qo0_68`,slug:`_slug_o3qo0_76`,tags:`_tags_o3qo0_84`,tag:`_tag_o3qo0_84`,stateBadge:`_stateBadge_o3qo0_102`,stateInFlight:`_stateInFlight_o3qo0_114`,statePrOpen:`_statePrOpen_o3qo0_120`,stateDone:`_stateDone_o3qo0_126`,stateFailed:`_stateFailed_o3qo0_132`,actions:`_actions_o3qo0_139`,actionButton:`_actionButton_o3qo0_147`,prLink:`_prLink_o3qo0_178`,spinner:`_spinner_o3qo0_192`,spin:`_spin_o3qo0_192`,rootPath:`_rootPath_o3qo0_206`,watchingHint:`_watchingHint_o3qo0_217`,watchingDot:`_watchingDot_o3qo0_226`,watchingPulse:`_watchingPulse_o3qo0_1`};function Xa({state:e}){switch(e.kind){case`in-flight`:return(0,P.jsxs)(`span`,{className:`${J.stateBadge} ${J.stateInFlight}`,title:`Bootstrap in flight since ${e.startedAt}`,children:[(0,P.jsx)(`span`,{className:J.spinner,"aria-hidden":`true`}),`In flight`]});case`pr-open`:return(0,P.jsx)(`span`,{className:`${J.stateBadge} ${J.statePrOpen}`,title:`PR opened ${e.openedAt}`,children:`PR open`});case`done`:return(0,P.jsx)(`span`,{className:`${J.stateBadge} ${J.stateDone}`,title:`Done ${e.completedAt}`,children:`Done`});case`failed`:return(0,P.jsx)(`span`,{className:`${J.stateBadge} ${J.stateFailed}`,title:e.reason,children:`Failed`});default:return null}}function Za({profile:e,onRefresh:t,onViewPatterns:n}){let[r,i]=(0,N.useState)(!1),a=(0,N.useCallback)(async()=>{if(!r){i(!0);try{await t(e.slug)}finally{i(!1)}}},[r,t,e.slug]),o=e.bootstrapState.kind===`failed`,s=e.bootstrapState.kind===`pr-open`?e.bootstrapState.prUrl:e.pendingPrUrl,c=e.bootstrapState.kind===`pr-open`;return(0,P.jsxs)(`li`,{className:J.row,"data-slug":e.slug,children:[(0,P.jsxs)(`div`,{className:J.rowHeader,children:[(0,P.jsx)(`span`,{className:J.slug,children:e.slug}),(0,P.jsx)(Xa,{state:e.bootstrapState})]}),e.rootPath&&(0,P.jsx)(`span`,{className:J.rootPath,children:e.rootPath}),e.stackTags.length>0&&(0,P.jsx)(`div`,{className:J.tags,children:e.stackTags.map(e=>(0,P.jsx)(`span`,{className:J.tag,children:e},e))}),c&&(0,P.jsxs)(`span`,{className:J.watchingHint,title:`Gateway auto-finalizes this row to Done when the bootstrap PR merges, on the next sidebar open or Refresh click.`,children:[(0,P.jsx)(`span`,{className:J.watchingDot,"aria-hidden":`true`}),`Watching for merge`]}),(0,P.jsxs)(`div`,{className:J.actions,children:[(0,P.jsx)(`button`,{type:`button`,className:J.actionButton,onClick:()=>{a()},disabled:r||!e.rootPath,"aria-label":o?`Retry bootstrap for ${e.slug}`:`Refresh ${e.slug}`,children:r?`Refreshing…`:o?`Retry`:`Refresh`}),(0,P.jsx)(`button`,{type:`button`,className:J.actionButton,onClick:()=>n?.(e.slug),"aria-label":`View patterns for ${e.slug}`,children:`Patterns`}),s&&(0,P.jsx)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:J.prLink,onClick:e=>e.stopPropagation(),"aria-label":`Open ${e.slug} bootstrap PR in a new tab`,children:`PR ↗`})]})]})}function Qa(e={}){let t=Ya(),n=e.testProfiles??t.profiles,r=e.testOnRefresh??t.refresh,i=e.testIsLoading??t.isLoading,a=e.testError??t.error,{onViewPatterns:o}=e;return(0,P.jsxs)(`section`,{className:J.card,"aria-label":`Project profiles`,children:[(0,P.jsxs)(`div`,{className:J.header,children:[(0,P.jsx)(`span`,{className:J.title,children:`Project Profiles`}),(0,P.jsx)(`span`,{className:J.empty,"aria-live":`polite`,children:i?`Loading…`:`${n.length} known`})]}),a&&(0,P.jsx)(`div`,{className:J.errorBanner,role:`alert`,children:a}),!i&&n.length===0&&(0,P.jsx)(`span`,{className:J.empty,children:`No profiles yet. Drop an idea on a project to bootstrap one.`}),n.length>0&&(0,P.jsx)(`ul`,{className:J.list,children:n.map(e=>(0,P.jsx)(Za,{profile:e,onRefresh:r,onViewPatterns:o},e.slug))})]})}function $a({open:e,onClose:t,onViewPatterns:n,testProps:r}){return(0,N.useEffect)(()=>{if(!e)return;function n(e){e.key===`Escape`&&t()}return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{onClick:t,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,zIndex:80,opacity:+!!e,pointerEvents:e?`auto`:`none`,transition:`opacity 0.2s ease`},"aria-hidden":!e}),(0,P.jsxs)(`aside`,{role:`dialog`,"aria-label":`Project Profiles`,"aria-modal":`true`,style:{position:`fixed`,top:0,right:0,bottom:`var(--tw-bottom-nav-h, 0px)`,width:`min(480px, 95vw)`,background:o.cardBg,borderLeft:`1px solid ${o.border}`,zIndex:81,display:`flex`,flexDirection:`column`,transform:e?`translateX(0)`:`translateX(100%)`,transition:`transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,overflow:`hidden`},children:[(0,P.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,padding:`14px 16px`,borderBottom:`1px solid ${o.border}`,flexShrink:0},children:[(0,P.jsx)(`h2`,{style:{margin:0,fontSize:16,fontWeight:600,color:o.text},children:`Project Profiles`}),(0,P.jsx)(`button`,{onClick:t,"aria-label":`Close project profiles`,style:{background:`transparent`,border:`none`,color:o.muted,cursor:`pointer`,fontSize:22,lineHeight:1,padding:`4px 8px`,minHeight:44,minWidth:44,display:`flex`,alignItems:`center`,justifyContent:`center`},children:`×`})]}),(0,P.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`16px 18px 32px`},children:e&&(0,P.jsx)(Qa,{...r??{},onViewPatterns:n})})]})]})}var eo=50;function to(e){let[t,n]=(0,N.useState)([]),[r,i]=(0,N.useState)(0),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(!1),[l,u]=(0,N.useState)(null),[d,f]=(0,N.useState)(0),p=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(p.current?.abort(),n([]),i(0),o(!1),u(null),f(0),e===null){c(!1);return}let t=new AbortController;return p.current=t,c(!0),fetch(`/api/profiles/${encodeURIComponent(e)}/patterns?limit=${eo}&offset=0`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} ${e.statusText||``}`.trim());let t=await e.json();if(!Array.isArray(t.findings))throw Error(`malformed response: findings is not an array`);return t}).then(e=>{n(e.findings),i(e.total),o(e.truncated),f(e.findings.length),c(!1)}).catch(e=>{if(e instanceof DOMException&&e.name===`AbortError`){c(!1);return}u(e instanceof Error?e.message:String(e)),c(!1)}),()=>t.abort()},[e]);let m=t.length<r,h=(0,N.useCallback)(()=>{if(e===null||!m||s)return;p.current?.abort();let t=new AbortController;p.current=t,c(!0),u(null),fetch(`/api/profiles/${encodeURIComponent(e)}/patterns?limit=${eo}&offset=${d}`,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status} ${e.statusText||``}`.trim());let t=await e.json();if(!Array.isArray(t.findings))throw Error(`malformed response: findings is not an array`);return t}).then(e=>{n(t=>[...t,...e.findings]),i(e.total),o(e.truncated),f(t=>t+e.findings.length),c(!1)}).catch(e=>{if(e instanceof DOMException&&e.name===`AbortError`){c(!1);return}u(e instanceof Error?e.message:String(e)),c(!1)})},[e,d,m,s]);return(0,N.useEffect)(()=>()=>p.current?.abort(),[]),{findings:t,total:r,truncated:a,isLoading:s,error:l,hasMore:m,loadMore:h}}var Y={card:`_card_14h1w_1`,fadeIn:`_fadeIn_14h1w_1`,header:`_header_14h1w_17`,headerTitle:`_headerTitle_14h1w_25`,count:`_count_14h1w_31`,truncatedBanner:`_truncatedBanner_14h1w_36`,errorBanner:`_errorBanner_14h1w_45`,filters:`_filters_14h1w_55`,severityGroup:`_severityGroup_14h1w_62`,filterPill:`_filterPill_14h1w_68`,filterPillActive:`_filterPillActive_14h1w_87`,categoryInput:`_categoryInput_14h1w_92`,empty:`_empty_14h1w_104`,list:`_list_14h1w_111`,row:`_row_14h1w_120`,rowHeader:`_rowHeader_14h1w_130`,severityBadge:`_severityBadge_14h1w_138`,severityCritical:`_severityCritical_14h1w_151`,severityHigh:`_severityHigh_14h1w_157`,severityMedium:`_severityMedium_14h1w_163`,severityLow:`_severityLow_14h1w_169`,category:`_category_14h1w_92`,findingTitle:`_findingTitle_14h1w_187`,file:`_file_14h1w_194`,timestamp:`_timestamp_14h1w_201`,fixOutcome:`_fixOutcome_14h1w_207`,loadMore:`_loadMore_14h1w_219`},no={critical:`Critical`,high:`High`,medium:`Medium`,low:`Low`},ro={critical:Y.severityCritical,high:Y.severityHigh,medium:Y.severityMedium,low:Y.severityLow};function io({severity:e}){return(0,P.jsx)(`span`,{className:`${Y.severityBadge} ${ro[e]}`,children:no[e]})}function ao({entry:e}){return(0,P.jsxs)(`li`,{className:Y.row,children:[(0,P.jsxs)(`div`,{className:Y.rowHeader,children:[(0,P.jsx)(io,{severity:e.severity}),(0,P.jsx)(`span`,{className:Y.category,children:e.category}),e.fixOutcome&&(0,P.jsx)(`span`,{className:Y.fixOutcome,children:e.fixOutcome})]}),(0,P.jsx)(`span`,{className:Y.findingTitle,children:e.title}),(0,P.jsx)(`span`,{className:Y.file,children:e.file}),(0,P.jsx)(`span`,{className:Y.timestamp,children:e.timestamp})]})}function oo(e){let t=to(e.slug),n=e.testFindings??t.findings,r=e.testTotal??t.total,i=e.testTruncated??t.truncated,a=e.testIsLoading??t.isLoading,o=e.testError===void 0?t.error:e.testError,s=e.testFindings===void 0?t.hasMore:!1,c=e.testFindings===void 0?t.loadMore:()=>{},[l,u]=(0,N.useState)(`all`),[d,f]=(0,N.useState)(``),p=(0,N.useMemo)(()=>{let e=d.trim().toLowerCase();return n.filter(t=>!(l!==`all`&&t.severity!==l||e.length>0&&!t.category.toLowerCase().includes(e)))},[n,l,d]),m=n.length>0;return(0,P.jsxs)(`section`,{className:Y.card,"aria-label":`Pattern findings`,children:[(0,P.jsxs)(`div`,{className:Y.header,children:[(0,P.jsx)(`span`,{className:Y.headerTitle,children:`Findings`}),(0,P.jsx)(`span`,{className:Y.count,"aria-live":`polite`,children:a?`Loading…`:`${p.length} of ${r}`})]}),o&&(0,P.jsx)(`div`,{className:Y.errorBanner,role:`alert`,children:o}),i&&(0,P.jsx)(`div`,{className:Y.truncatedBanner,children:`Findings file exceeded 4MB cap; showing latest entries only. (truncated)`}),(0,P.jsxs)(`div`,{className:Y.filters,children:[(0,P.jsxs)(`div`,{className:Y.severityGroup,role:`group`,"aria-label":`Filter by severity`,children:[(0,P.jsx)(T,{className:`${Y.filterPill} ${l===`all`?Y.filterPillActive:``}`,onClick:()=>u(`all`),children:`All`}),Me.map(e=>(0,P.jsx)(T,{className:`${Y.filterPill} ${l===e?Y.filterPillActive:``}`,onClick:()=>u(e),children:no[e]},e))]}),(0,P.jsx)(w,{type:`text`,className:Y.categoryInput,placeholder:`Filter by category`,"aria-label":`Filter by category`,value:d,onChange:e=>f(e.target.value)})]}),!m&&!a&&(0,P.jsx)(`span`,{className:Y.empty,children:`No review findings recorded for this project yet.`}),m&&p.length===0&&(0,P.jsx)(`span`,{className:Y.empty,children:`No findings match the current filters.`}),p.length>0&&(0,P.jsx)(`ul`,{className:Y.list,children:p.map((e,t)=>(0,P.jsx)(ao,{entry:e},`${e.timestamp}-${t}`))}),s&&(0,P.jsx)(T,{className:Y.loadMore,onClick:c,disabled:a,children:a?`Loading…`:`Load more (${r-n.length} remaining)`})]})}function so({open:e,slug:t,onClose:n,testProps:r}){return(0,N.useEffect)(()=>{if(!e)return;function t(e){e.key===`Escape`&&n()}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{onClick:n,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,zIndex:82,opacity:+!!e,pointerEvents:e?`auto`:`none`,transition:`opacity 0.2s ease`},"aria-hidden":!e}),(0,P.jsxs)(`aside`,{role:`dialog`,"aria-label":t?`Patterns for ${t}`:`Patterns`,"aria-modal":`true`,ref:t=>{t&&(e?t.removeAttribute(`inert`):t.setAttribute(`inert`,``))},style:{position:`fixed`,top:0,right:0,bottom:`var(--tw-bottom-nav-h, 0px)`,width:`min(480px, 95vw)`,background:o.cardBg,borderLeft:`1px solid ${o.border}`,zIndex:83,display:`flex`,flexDirection:`column`,transform:e?`translateX(0)`:`translateX(100%)`,transition:`transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)`,overflow:`hidden`},children:[(0,P.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,padding:`14px 16px`,borderBottom:`1px solid ${o.border}`,flexShrink:0},children:[(0,P.jsxs)(`h2`,{style:{margin:0,fontSize:16,fontWeight:600,color:o.text},children:[`Patterns`,t&&(0,P.jsxs)(P.Fragment,{children:[` `,(0,P.jsx)(`code`,{style:{fontWeight:400,fontSize:13,color:o.muted},children:t})]})]}),(0,P.jsx)(`button`,{onClick:n,"aria-label":`Close patterns`,style:{background:`transparent`,border:`none`,color:o.muted,cursor:`pointer`,fontSize:22,lineHeight:1,padding:`4px 8px`,minHeight:44,minWidth:44,display:`flex`,alignItems:`center`,justifyContent:`center`},children:`×`})]}),(0,P.jsx)(`div`,{style:{flex:1,overflowY:`auto`,padding:`16px 18px 32px`},children:e&&t!==null&&(0,P.jsx)(oo,{slug:t,...r??{}})})]})]})}function co(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.attempt==`number`&&(t.kind===`rebase`||t.kind===`ci`)&&(t.result===`success`||t.result===`failure`||t.result===`error`)&&typeof t.finishedAt==`string`&&typeof t.logFile==`string`}function lo(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.maxAttempts!=`number`||!Array.isArray(t.attempts)||!t.attempts.every(co)||typeof t.headRefOid!=`string`?!1:t.status===`in_flight`?typeof t.attempt==`number`&&(t.kind===`rebase`||t.kind===`ci`)&&typeof t.startedAt==`string`&&typeof t.logFile==`string`:t.status===`budget_exhausted`?typeof t.exhaustedAt==`string`:t.status===`idle`}function uo(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.ideaId==`string`&&lo(t.state)}function fo(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.maxAttempts!=`number`||typeof t.enabled!=`boolean`||!t.states||typeof t.states!=`object`)return null;let n={};for(let[e,r]of Object.entries(t.states))typeof e==`string`&&lo(r)&&(n[e]=r);return{states:n,maxAttempts:t.maxAttempts,enabled:t.enabled}}function po(){let[e,t]=(0,N.useState)({}),[n,r]=(0,N.useState)(5),[a,o]=(0,N.useState)(!0),[s,c]=(0,N.useState)(!0),[u,d]=(0,N.useState)(null),f=(0,N.useCallback)(async(e,n)=>{try{let i=await fetch(`/api/pr-auto-fix/state`,{signal:e});if(!i.ok)throw Error(`HTTP ${i.status} ${i.statusText||``}`.trim());let a=fo(await i.json());if(!a)throw Error(`malformed pr-auto-fix list response`);t(a.states),r(a.maxAttempts),o(a.enabled),n?.onLoaded?.()}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;d(e instanceof Error?e.message:String(e)),n?.onLoaded?.()}},[]);(0,N.useEffect)(()=>{let e=new AbortController;return c(!0),d(null),f(e.signal,{onLoaded:()=>c(!1)}),()=>e.abort()},[f]),i(l,(0,N.useCallback)(e=>{uo(e)&&t(t=>({...t,[e.ideaId]:e.state}))},[]));let p=(0,N.useRef)(null);return i(`ws:reconnected`,(0,N.useCallback)(()=>{p.current?.abort();let e=new AbortController;p.current=e,f(e.signal)},[f])),(0,N.useEffect)(()=>()=>{p.current?.abort()},[]),{states:e,maxAttempts:n,enabled:a,isLoading:s,error:u}}var X={panel:`_panel_tap8o_1`,header:`_header_tap8o_15`,chevron:`_chevron_tap8o_34`,title:`_title_tap8o_41`,subtitle:`_subtitle_tap8o_46`,body:`_body_tap8o_55`,bodyCollapsed:`_bodyCollapsed_tap8o_62`,empty:`_empty_tap8o_66`,row:`_row_tap8o_72`,dot:`_dot_tap8o_92`,dotInFlight:`_dotInFlight_tap8o_100`,pulse:`_pulse_tap8o_1`,dotExhausted:`_dotExhausted_tap8o_105`,ideaId:`_ideaId_tap8o_118`,statusLabel:`_statusLabel_tap8o_125`,detail:`_detail_tap8o_130`};function mo(e){switch(e.status){case`in_flight`:return 0;case`budget_exhausted`:return 1;case`idle`:return 2;default:return 3}}function ho(e){switch(e.status){case`in_flight`:{let t=e.kind===`ci`?`fixing CI`:`rebasing`;return{label:`in flight (${e.attempt}/${e.maxAttempts})`,detail:t}}case`budget_exhausted`:return{label:`paused`,detail:`used all ${e.maxAttempts} attempts`};case`idle`:{let t=e.attempts.length;return{label:`idle`,detail:t===0?`watching`:`${t}/${e.maxAttempts} attempts used`}}default:return{label:``,detail:``}}}function go(e){switch(e.status){case`in_flight`:return`${X.dot} ${X.dotInFlight}`;case`budget_exhausted`:return`${X.dot} ${X.dotExhausted}`;case`idle`:return X.dot;default:return X.dot}}function _o({onOpenIdea:e}){let{states:t,enabled:n,isLoading:r}=po(),[i,a]=(0,N.useState)(!1);if(!n||r)return null;let o=Object.entries(t);if(o.length===0)return null;let s=o.map(([e,t])=>({ideaId:e,state:t})).sort((e,t)=>mo(e.state)-mo(t.state)),c=s.filter(e=>e.state.status===`in_flight`).length,l=s.filter(e=>e.state.status===`budget_exhausted`).length,u=[c>0?`${c} in flight`:null,l>0?`${l} paused`:null,s.length>0?`${s.length} total`:null].filter(Boolean).join(` · `);return(0,P.jsxs)(`section`,{className:X.panel,"aria-label":`PR auto-fix activity`,children:[(0,P.jsxs)(T,{variant:`ghost`,className:X.header,onClick:()=>a(e=>!e),"aria-expanded":i,children:[(0,P.jsx)(`span`,{className:X.chevron,"aria-hidden":`true`,children:i?`▾`:`▸`}),(0,P.jsx)(`span`,{className:X.title,children:`Auto-fix activity`}),(0,P.jsx)(`span`,{className:X.subtitle,children:u})]}),(0,P.jsx)(`div`,{className:i?X.body:X.bodyCollapsed,children:s.length===0?(0,P.jsx)(`div`,{className:X.empty,children:`No activity yet this gateway session.`}):s.map(({ideaId:t,state:n})=>{let{label:r,detail:i}=ho(n);return(0,P.jsxs)(T,{variant:`ghost`,className:X.row,onClick:()=>e(t),children:[(0,P.jsx)(`span`,{className:go(n),"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:X.statusLabel,children:r}),(0,P.jsx)(`span`,{className:X.ideaId,children:t}),(0,P.jsx)(`span`,{className:X.detail,children:i})]},t)})})]})}function vo(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return!(typeof t.ideaId!=`string`||t.phase!==null&&!h(t.phase)||t.startedAt!==null&&typeof t.startedAt!=`string`)}async function yo(e){let t=await fetch(`/api/pipeline-runs/running-phases`,{signal:e});if(!t.ok)throw Error(`${t.status} ${t.statusText}`);let n=await t.json();if(typeof n!=`object`||!n||!(`phases`in n)||typeof n.phases!=`object`||n.phases===null||Array.isArray(n.phases))throw Error(`malformed phases payload`);let r=n.phases,i=new Map;for(let[e,t]of Object.entries(r))typeof t==`object`&&t&&h(t.phase)&&typeof t.startedAt==`string`&&i.set(e,{phase:t.phase,startedAt:t.startedAt});return i}function bo(){let[e,t]=(0,N.useState)(()=>new Map),n=(0,N.useRef)(!0),r=(0,N.useRef)(0),a=(0,N.useRef)(!1);(0,N.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);let o=(0,N.useCallback)(e=>{r.current+=1;let i=r.current;a.current=!1,yo(e).then(e=>{n.current&&i===r.current&&(a.current||t(e))}).catch(e=>{e instanceof Error&&e.name===`AbortError`||console.warn(`useRunningPhases: snapshot fetch failed`,e)})},[]);return(0,N.useEffect)(()=>{let e=new AbortController;return o(e.signal),()=>e.abort()},[o]),i(`pipeline:phase-state`,(0,N.useCallback)(e=>{if(!vo(e)){console.warn(`useRunningPhases: malformed phase-state payload`,e);return}if(a.current=!0,e.ideaId===`*`){t(e=>e.size===0?e:new Map);return}let{phase:n,startedAt:r}=e;t(t=>{let i=t.get(e.ideaId)??null;if(n===null||r===null){if(i===null)return t;let n=new Map(t);return n.delete(e.ideaId),n}let a=new Map(t);return a.set(e.ideaId,{phase:n,startedAt:r}),a})},[])),i(`ws:reconnected`,(0,N.useCallback)(()=>{o(new AbortController().signal)},[o])),e}var xo={toggle:`_toggle_1yykc_1`,button:`_button_1yykc_8`,active:`_active_1yykc_17`,helper:`_helper_1yykc_25`,helperDismiss:`_helperDismiss_1yykc_33`};function So({viewMode:e,onChange:t}){return(0,P.jsx)(`div`,{role:`group`,"aria-label":`View mode`,className:xo.toggle,children:[`board`,`list`].map(n=>(0,P.jsx)(`button`,{type:`button`,"aria-pressed":e===n,className:`${xo.button} ${e===n?xo.active:``}`,onClick:()=>t(n),children:n===`board`?`Board`:`List`},n))})}function Co({onDismiss:e}){return(0,P.jsxs)(`div`,{className:xo.helper,children:[(0,P.jsx)(`span`,{children:`Board for spatial flow. List for filter and scan.`}),(0,P.jsx)(`button`,{type:`button`,className:xo.helperDismiss,"aria-label":`Dismiss helper`,onClick:e,children:`×`})]})}var wo={bars:`_bars_1eirt_1`,filled:`_filled_1eirt_9`,empty:`_empty_1eirt_13`,level3:`_level3_1eirt_22`,level2:`_level2_1eirt_23`,level1:`_level1_1eirt_24`},To={low:`Low`,normal:`Normal`,high:`High`},Eo={low:1,normal:2,high:3};function Do({priority:e,size:t=16,decorative:n=!0,className:r}){let i=To[e],a=Eo[e],o=n?{"aria-hidden":!0}:{role:`img`,"aria-label":`Priority: ${i}`},s=[{x:5,height:5},{x:10,height:9},{x:15,height:13}];return(0,P.jsx)(`span`,{className:[wo.bars,wo[`level${a}`],r].filter(Boolean).join(` `),style:{width:t,height:t},"data-priority":e,...o,children:(0,P.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 22 22`,focusable:`false`,children:s.map((e,t)=>{let n=t<a;return(0,P.jsx)(`rect`,{x:e.x,y:18-e.height,width:3,height:e.height,rx:.8,className:n?wo.filled:wo.empty},t)})})})}var Oo={row:`_row_1g2yl_1`},ko=[`draft`,`ready`,`in_progress`,`awaiting_input`,`opened`,`changes_requested`,`merged`,`closed`,`blocked`,`done`,`archived`],Ao=[`high`,`normal`,`low`],jo=[`feature`,`epic`],Mo={feature:`Feature`,epic:`Epic`};function No({filters:e,ideas:t,onChange:n}){let r=(0,N.useMemo)(()=>{let e=new Set;for(let n of t)e.add(n.project);return Array.from(e).sort()},[t]),i=(e,t)=>t>0?`${e}·${t}`:e;return(0,P.jsxs)(`div`,{className:Oo.row,children:[(0,P.jsx)(de,{emptyLabel:i(`Status`,e.statuses.length),options:ko.map(e=>({value:e,label:F[e]})),selected:e.statuses,onChange:t=>n({...e,statuses:t}),renderGlyph:e=>(0,P.jsx)(vn,{status:e.value,size:14,staticOnly:!0})}),(0,P.jsx)(de,{emptyLabel:i(`Project`,e.projects.length),options:r.map(e=>({value:e,label:e})),selected:e.projects,onChange:t=>n({...e,projects:t})}),(0,P.jsx)(de,{emptyLabel:i(`Priority`,e.priorities.length),options:Ao.map(e=>({value:e,label:To[e]})),selected:e.priorities,onChange:t=>n({...e,priorities:t}),renderGlyph:e=>(0,P.jsx)(Do,{priority:e.value,size:14})}),(0,P.jsx)(de,{emptyLabel:i(`Size`,e.sizes.length),options:jo.map(e=>({value:e,label:Mo[e]})),selected:e.sizes,onChange:t=>n({...e,sizes:t})}),(0,P.jsx)(de,{emptyLabel:`Auto-harvested`,options:[{value:`harvest`,label:`Auto-harvested`}],selected:e.autoHarvestedOnly?[`harvest`]:[],onChange:t=>n({...e,autoHarvestedOnly:t.includes(`harvest`)})})]})}var Z={bar:`_bar_1sorc_1`,chipRow:`_chipRow_1sorc_12`,endSlot:`_endSlot_1sorc_19`,chip:`_chip_1sorc_12`,chipBody:`_chipBody_1sorc_45`,chipProperty:`_chipProperty_1sorc_59`,chipOperator:`_chipOperator_1sorc_64`,chipValue:`_chipValue_1sorc_68`,chipRemove:`_chipRemove_1sorc_76`,addButton:`_addButton_1sorc_96`,clearAll:`_clearAll_1sorc_119`,toggleChip:`_toggleChip_1sorc_139`,toggleChipOn:`_toggleChipOn_1sorc_159`,popover:`_popover_1sorc_167`,popIn:`_popIn_1sorc_1`,propList:`_propList_1sorc_191`,propItem:`_propItem_1sorc_197`,picker:`_picker_1sorc_216`,pickerSearch:`_pickerSearch_1sorc_223`,pickerList:`_pickerList_1sorc_238`,pickerEmpty:`_pickerEmpty_1sorc_246`,pickerOption:`_pickerOption_1sorc_253`,pickerCheck:`_pickerCheck_1sorc_273`,pickerOptionLabel:`_pickerOptionLabel_1sorc_292`},Po=[`draft`,`ready`,`in_progress`,`awaiting_input`,`opened`,`changes_requested`,`merged`,`closed`,`blocked`,`done`,`archived`],Fo=[`high`,`normal`,`low`],Io=[`feature`,`epic`],Lo={statuses:`Status`,projects:`Project`,priorities:`Priority`,sizes:`Size`},Ro=[`statuses`,`priorities`,`projects`,`sizes`];function zo({filters:e,ideas:t,onChange:n,endSlot:r}){let i=(0,N.useMemo)(()=>{let e=new Set;for(let n of t)e.add(n.project);return Array.from(e).sort()},[t]),a=(0,N.useMemo)(()=>Ro.filter(t=>e[t].length>0),[e]),o=(0,N.useMemo)(()=>Ro.filter(t=>e[t].length===0),[e]),s=(t,r)=>{n({...e,[t]:r})},c=e=>s(e,[]),l=Pe(e);return(0,P.jsxs)(`div`,{className:Z.bar,role:`toolbar`,"aria-label":`Filter ideas`,children:[(0,P.jsxs)(`div`,{className:Z.chipRow,children:[a.map(t=>(0,P.jsx)(Ho,{property:t,values:e[t],options:Bo(t,i),onChangeValues:e=>s(t,e),onRemove:()=>c(t)},t)),o.length>0&&(0,P.jsx)(Wo,{properties:o,options:e=>Bo(e,i),onAdd:(e,t)=>s(e,t)}),(0,P.jsx)(`button`,{type:`button`,className:e.autoHarvestedOnly?`${Z.toggleChip} ${Z.toggleChipOn}`:Z.toggleChip,"aria-pressed":e.autoHarvestedOnly??!1,"aria-label":`Show only auto-harvested ideas`,onClick:()=>n({...e,autoHarvestedOnly:!e.autoHarvestedOnly}),children:`Auto-harvested`}),!l&&(0,P.jsx)(`button`,{type:`button`,className:Z.clearAll,onClick:()=>n(Ne),children:`Clear`})]}),r&&(0,P.jsx)(`div`,{className:Z.endSlot,children:r})]})}function Bo(e,t){switch(e){case`statuses`:return Po.map(e=>({value:e,label:F[e],glyphKey:`statuses`}));case`priorities`:return Fo.map(e=>({value:e,label:To[e],glyphKey:`priorities`}));case`sizes`:return Io.map(e=>({value:e,label:Vo(e)}));case`projects`:return t.map(e=>({value:e,label:e}))}}function Vo(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ho({property:e,values:t,options:n,onChangeValues:r,onRemove:i}){let[a,o]=(0,N.useState)(!1),s=Uo(e,t);return(0,P.jsxs)(ge,{open:a,onOpenChange:o,children:[(0,P.jsxs)(`span`,{className:Z.chip,children:[(0,P.jsx)(ae,{asChild:!0,children:(0,P.jsxs)(`button`,{type:`button`,className:Z.chipBody,"aria-haspopup":`listbox`,"aria-expanded":a,"aria-label":`Filter: ${Lo[e]} ${s}`,children:[(0,P.jsx)(`span`,{className:Z.chipProperty,children:Lo[e]}),(0,P.jsx)(`span`,{className:Z.chipOperator,children:`is`}),(0,P.jsx)(`span`,{className:Z.chipValue,children:s})]})}),(0,P.jsx)(`button`,{type:`button`,className:Z.chipRemove,onClick:i,"aria-label":`Remove ${Lo[e]} filter`,tabIndex:-1,children:(0,P.jsx)(Jo,{})})]}),(0,P.jsx)(le,{children:(0,P.jsx)(ve,{sideOffset:6,align:`start`,className:Z.popover,children:(0,P.jsx)(Go,{options:n,selected:t,onChange:r})})})]})}function Uo(e,t){return t.length===0?`any`:t.length===1?e===`statuses`?F[t[0]]??t[0]:e===`priorities`?To[t[0]]??t[0]:t[0]:t.length<=3?t.map(t=>e===`statuses`?F[t]??t:e===`priorities`?To[t]??t:t).join(`, `):`${t.length} ${Lo[e].toLowerCase()}s`}function Wo({properties:e,options:t,onAdd:n}){let[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)([]);return(0,P.jsxs)(ge,{open:r,onOpenChange:e=>{i(e),e||(o(null),c([]))},children:[(0,P.jsx)(ae,{asChild:!0,children:(0,P.jsxs)(`button`,{type:`button`,className:Z.addButton,"aria-label":`Add filter`,children:[(0,P.jsx)(qo,{}),(0,P.jsx)(`span`,{children:`Filter`})]})}),(0,P.jsx)(le,{children:(0,P.jsx)(ve,{sideOffset:6,align:`start`,className:Z.popover,children:a==null?(0,P.jsx)(`ul`,{className:Z.propList,role:`listbox`,"aria-label":`Choose property to filter`,children:e.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:Z.propItem,onClick:()=>{o(e),c([])},children:Lo[e]})},e))}):(0,P.jsx)(Go,{options:t(a),selected:s,onChange:e=>{c(e),n(a,e)},autoFocusSearch:!0})})})]})}function Go({options:e,selected:t,onChange:n,autoFocusSearch:r}){let[i,a]=(0,N.useState)(``),o=(0,N.useMemo)(()=>{let t=i.trim().toLowerCase();return t?e.filter(e=>e.label.toLowerCase().includes(t)||e.value.toLowerCase().includes(t)):e},[e,i]),s=e=>{t.includes(e)?n(t.filter(t=>t!==e)):n([...t,e])};return(0,P.jsxs)(`div`,{className:Z.picker,children:[(0,P.jsx)(`input`,{autoFocus:r,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`Search…`,className:Z.pickerSearch,"aria-label":`Search options`}),o.length===0?(0,P.jsx)(`div`,{className:Z.pickerEmpty,children:`No matches`}):(0,P.jsx)(`ul`,{role:`listbox`,"aria-multiselectable":`true`,className:Z.pickerList,children:o.map(e=>{let n=t.includes(e.value);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,className:Z.pickerOption,onClick:()=>s(e.value),children:[(0,P.jsx)(`span`,{className:Z.pickerCheck,"aria-hidden":`true`,children:n?(0,P.jsx)(Yo,{}):null}),(0,P.jsxs)(`span`,{className:Z.pickerOptionLabel,children:[Ko(e),(0,P.jsx)(`span`,{children:e.label})]})]})},e.value)})})]})}function Ko(e){return e.glyphKey===`statuses`?(0,P.jsx)(vn,{status:e.value,size:14,staticOnly:!0}):e.glyphKey===`priorities`?(0,P.jsx)(Do,{priority:e.value,size:14}):null}function qo(){return(0,P.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:`M6 1.75v8.5M1.75 6h8.5`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`})})}function Jo(){return(0,P.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:`M2 2l6 6M8 2l-6 6`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`})})}function Yo(){return(0,P.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:`M2.5 6.25l2.4 2.4L9.5 3.6`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var Q={section:`_section_1y77e_11`,sectionLabel:`_sectionLabel_1y77e_19`,row:`_row_1y77e_28`,rowLabel:`_rowLabel_1y77e_37`,colList:`_colList_1y77e_41`,colRow:`_colRow_1y77e_47`,colLabel:`_colLabel_1y77e_66`,toggle:`_toggle_1y77e_68`,toggleThumb:`_toggleThumb_1y77e_79`,toggleOn:`_toggleOn_1y77e_90`},Xo=[{value:`status`,label:`Status`},{value:`priority`,label:`Priority`},{value:`project`,label:`Project`},{value:`none`,label:`None`}],Zo=[{value:`createdAt`,label:`Created`},{value:`statusUpdatedAt`,label:`Status updated`},{value:`title`,label:`Title`},{value:`priority`,label:`Priority`},{value:`status`,label:`Status`},{value:`project`,label:`Project`},{value:`pr`,label:`PR state`},{value:`blockers`,label:`Blockers`}],Qo=[{value:`asc`,label:`Asc`},{value:`desc`,label:`Desc`}],$o=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`}];function es(e){let{groupBy:t,onGroupByChange:n,sort:r,onSortChange:i,density:a,onDensityChange:o,columns:s,visibleColumnIds:c,onVisibleColumnsChange:l}=e,u=s.filter(e=>e.id!==`title`),d=e=>c.includes(e),f=e=>{if(d(e))l(c.filter(t=>t!==e));else{let t=s.map(e=>e.id),n=[...c,e];n.sort((e,n)=>t.indexOf(e)-t.indexOf(n)),l(n)}};return(0,P.jsxs)(pe,{triggerIcon:(0,P.jsx)(ns,{}),triggerLabel:`Display`,triggerAriaLabel:`Display options`,triggerSuffix:(0,P.jsx)(rs,{}),size:`wide`,children:[(0,P.jsx)(ts,{label:`Grouping`,children:(0,P.jsx)(me,{ariaLabel:`Group by`,value:t,options:Xo,onChange:n})}),(0,P.jsxs)(ts,{label:`Ordering`,children:[(0,P.jsxs)(`div`,{className:Q.row,children:[(0,P.jsx)(`label`,{className:Q.rowLabel,htmlFor:`display-sort-by`,children:`Sort by`}),(0,P.jsx)(C,{id:`display-sort-by`,compact:!0,value:r.columnId,onChange:e=>i({...r,columnId:e.target.value}),children:Zo.map(e=>(0,P.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,P.jsxs)(`div`,{className:Q.row,children:[(0,P.jsx)(`span`,{className:Q.rowLabel,children:`Direction`}),(0,P.jsx)(me,{ariaLabel:`Sort direction`,value:r.direction,options:Qo,onChange:e=>i({...r,direction:e})})]})]}),(0,P.jsx)(ts,{label:`Density`,children:(0,P.jsx)(me,{ariaLabel:`Row density`,value:a,options:$o,onChange:o})}),(0,P.jsx)(ts,{label:`Properties`,children:(0,P.jsx)(`ul`,{className:Q.colList,children:u.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":d(e.id),className:Q.colRow,onClick:()=>f(e.id),children:[(0,P.jsx)(`span`,{className:Q.colLabel,children:e.label}),(0,P.jsx)(`span`,{className:`${Q.toggle} ${d(e.id)?Q.toggleOn:``}`,"aria-hidden":`true`,children:(0,P.jsx)(`span`,{className:Q.toggleThumb})})]})},e.id))})})]})}function ts({label:e,children:t}){return(0,P.jsxs)(`section`,{className:Q.section,children:[(0,P.jsx)(`header`,{className:Q.sectionLabel,children:e}),t]})}function ns(){return(0,P.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:`M2 3.5h10M2 7h10M2 10.5h6`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`})})}function rs(){return(0,P.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:`M2.5 4l2.5 2.5L7.5 4`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var is={trigger:`_trigger_1w0qc_1`,trigger_glyph:`_trigger_glyph_1w0qc_24`,trigger_pill:`_trigger_pill_1w0qc_30`,triggerLabel:`_triggerLabel_1w0qc_42`,popoverContent:`_popoverContent_1w0qc_49`,popoverIn:`_popoverIn_1w0qc_1`,optionRow:`_optionRow_1w0qc_73`,optionLabel:`_optionLabel_1w0qc_96`,noTransitions:`_noTransitions_1w0qc_101`};function as({idea:e,onStatusTransition:t,variant:n=`glyph`}){return(0,P.jsxs)(ge,{children:[(0,P.jsx)(ae,{asChild:!0,children:(0,P.jsxs)(`button`,{type:`button`,className:`${is.trigger} ${is[`trigger_${n}`]??``}`,"aria-haspopup":`listbox`,"aria-label":`Status: ${F[e.status]}. Click to change.`,onClick:e=>e.stopPropagation(),children:[(0,P.jsx)(vn,{status:e.status,size:16}),n===`pill`&&(0,P.jsx)(`span`,{className:is.triggerLabel,children:F[e.status]})]})}),(0,P.jsx)(le,{children:(0,P.jsx)(ve,{className:is.popoverContent,sideOffset:6,align:`start`,role:`listbox`,"aria-label":`Change status for ${e.title}`,onClick:e=>e.stopPropagation(),children:e.allowedNextStatuses.length===0?(0,P.jsx)(`p`,{className:is.noTransitions,children:`No transitions available`}):e.allowedNextStatuses.map(n=>(0,P.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":!1,className:is.optionRow,onClick:()=>void t(e.id,n),children:[(0,P.jsx)(vn,{status:n,size:14,staticOnly:!0}),(0,P.jsx)(`span`,{className:is.optionLabel,children:F[n]})]},n))})})]})}var os={chip:`_chip_v15cr_1`};function ss({workflow:e,displayName:t}){return!e||e===`superpowers`?null:(0,P.jsx)(`span`,{className:os.chip,children:t??e})}var $={listWrapper:`_listWrapper_1nibf_13`,scrollArea:`_scrollArea_1nibf_21`,grid:`_grid_1nibf_27`,errorBanner:`_errorBanner_1nibf_35`,visuallyHiddenHeader:`_visuallyHiddenHeader_1nibf_46`,group:`_group_1nibf_60`,groupHeader:`_groupHeader_1nibf_64`,groupChevron:`_groupChevron_1nibf_81`,groupGlyph:`_groupGlyph_1nibf_97`,groupLabel:`_groupLabel_1nibf_102`,groupCount:`_groupCount_1nibf_113`,groupAdd:`_groupAdd_1nibf_121`,groupAddLabel:`_groupAddLabel_1nibf_141`,groupEmpty:`_groupEmpty_1nibf_143`,row:`_row_1nibf_155`,rowIn:`_rowIn_1nibf_1`,densityCompact:`_densityCompact_1nibf_171`,rowCompact:`_rowCompact_1nibf_172`,priorityCell:`_priorityCell_1nibf_213`,statusCell:`_statusCell_1nibf_219`,titleCell:`_titleCell_1nibf_225`,titleText:`_titleText_1nibf_232`,disclosure:`_disclosure_1nibf_248`,disclosureSpacer:`_disclosureSpacer_1nibf_286`,copyIdButton:`_copyIdButton_1nibf_299`,subtaskProgress:`_subtaskProgress_1nibf_305`,rowChild:`_rowChild_1nibf_329`,subtaskIn:`_subtaskIn_1nibf_1`,metaCluster:`_metaCluster_1nibf_382`,metaCell:`_metaCell_1nibf_390`,meta_project:`_meta_project_1nibf_402`,meta_size:`_meta_size_1nibf_415`,meta_createdAt:`_meta_createdAt_1nibf_422`,meta_blockers:`_meta_blockers_1nibf_428`,meta_pr:`_meta_pr_1nibf_402`,meta_autoMerge:`_meta_autoMerge_1nibf_470`,skeletonRow:`_skeletonRow_1nibf_483`,skeletonBar:`_skeletonBar_1nibf_492`,skeletonPulse:`_skeletonPulse_1nibf_1`,emptyState:`_emptyState_1nibf_510`,emptyInner:`_emptyInner_1nibf_517`,emptyTitle:`_emptyTitle_1nibf_525`,emptyAction:`_emptyAction_1nibf_530`};function cs({idea:e,rowIndex:t,rightColumns:n,cellCtx:r,density:i,onOpenDrawer:a,onStatusTransition:o,depth:s=0,isEpicParent:c=!1,isExpanded:l=!1,onToggleExpand:u,childCount:d=0,doneCount:f=0}){let p=(0,N.useCallback)(t=>{t.target.closest(`button, [role="option"], [role="listbox"]`)||a(e.id)},[e.id,a]),m=(0,N.useCallback)(t=>{if(t.key===`Enter`||t.key===` `){if(t.target.closest(`button`))return;a(e.id),t.preventDefault();return}if(u&&(t.key===`ArrowRight`||t.key===`ArrowLeft`)&&t.key===`ArrowRight`!==l){u(),t.preventDefault();return}if(t.key!==`ArrowDown`&&t.key!==`ArrowUp`)return;let n=t.currentTarget,r=n.closest(`[role="grid"]`);if(!r)return;let i=Array.from(r.querySelectorAll(`[data-idea-id]`)),o=i.indexOf(n);if(o===-1)return;let s=t.key===`ArrowDown`?i[o+1]:i[o-1];s&&(s.focus(),t.preventDefault())},[e.id,a,l,u]),h=(0,N.useCallback)(e=>{e.stopPropagation(),u?.()},[u]);return(0,P.jsxs)(`div`,{role:`row`,tabIndex:0,"data-idea-id":e.id,"data-status":e.status,"data-depth":s||void 0,"data-epic-parent":c?`true`:void 0,"data-hover-reveal":`true`,"aria-expanded":c&&u?l:void 0,className:`${$.row} ${i===`compact`?$.rowCompact:``} ${s>0?$.rowChild:``}`,style:{"--row-index":t},onClick:p,onKeyDown:m,"aria-label":`${e.title} — ${F[e.status]} — ${To[e.priority]}`,children:[(0,P.jsx)(`div`,{role:`gridcell`,className:$.priorityCell,children:(0,P.jsx)(Do,{priority:e.priority})}),(0,P.jsx)(`div`,{role:`gridcell`,className:$.statusCell,children:(0,P.jsx)(as,{idea:e,onStatusTransition:o})}),(0,P.jsxs)(`div`,{role:`gridcell`,className:$.titleCell,children:[c?u?(0,P.jsx)(`button`,{type:`button`,className:$.disclosure,"aria-label":l?`Collapse subtasks of ${e.title}`:`Expand subtasks of ${e.title}`,"aria-expanded":l,onClick:h,"data-interactive":`true`,children:(0,P.jsx)(ls,{open:l})}):(0,P.jsx)(`span`,{className:$.disclosure,"aria-hidden":`true`,children:(0,P.jsx)(ls,{open:!0})}):s===0?(0,P.jsx)(`span`,{className:$.disclosureSpacer,"aria-hidden":`true`}):null,(0,P.jsx)(`span`,{className:$.titleText,title:e.title,children:e.title}),e.createdBy===`harvest`||e.createdBy===`cluster`?(0,P.jsx)(ie,{size:`sm`,children:`auto`}):null,(0,P.jsx)(ss,{workflow:e.workflow}),c&&d>0&&(0,P.jsxs)(`span`,{className:$.subtaskProgress,"data-complete":f===d?`true`:void 0,"aria-label":`${f} of ${d} subtasks complete`,title:`${f} of ${d} subtasks complete`,children:[f,` / `,d]}),(0,P.jsx)(re,{value:e.id,label:`idea id`,className:$.copyIdButton})]}),(0,P.jsx)(`div`,{className:$.metaCluster,role:`presentation`,children:n.map(t=>(0,P.jsx)(`div`,{role:`gridcell`,className:`${$.metaCell} ${$[`meta_${t.id}`]??``}`,children:t.renderCell(e,r)},t.id))})]})}function ls({open:e}){return(0,P.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,style:{transform:e?`rotate(90deg)`:`rotate(0deg)`,transition:`transform 160ms ease`},children:(0,P.jsx)(`path`,{d:`M3 2l3.5 3L3 8`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function us({sorted:e,epicChildren:t,expandedEpics:n,onToggleEpic:r,rightColumns:i,cellCtx:a,density:o,onOpenDrawer:s,onStatusTransition:c}){let l=e.filter(e=>!t.childIds.has(e.id)),u=0;return(0,P.jsx)(`div`,{role:`rowgroup`,children:l.map(e=>{let l=t.byEpicId.get(e.id)??null,d=l!==null,f=d&&n.has(e.id);return(0,P.jsxs)(`div`,{role:`presentation`,children:[(0,P.jsx)(cs,{idea:e,rowIndex:u++,rightColumns:i,cellCtx:a,density:o,onOpenDrawer:s,onStatusTransition:c,depth:0,isEpicParent:d,isExpanded:f,onToggleExpand:d?()=>r(e.id):void 0,childCount:l?.totalCount??0,doneCount:l?.doneCount??0}),f&&l&&l.ordered.map(e=>(0,P.jsx)(cs,{idea:e,rowIndex:u++,rightColumns:i,cellCtx:a,density:o,onOpenDrawer:s,onStatusTransition:c,depth:1},e.id))]},e.id)})})}var ds=Ft();function fs(e){let{ideas:t,filters:n,onFiltersChange:r,sort:i,onSortChange:a,groupBy:o,onGroupByChange:s,density:c,onDensityChange:l,visibleColumnIds:u,onVisibleColumnsChange:d,onOpenDrawer:f,onStatusTransition:p,onClearFilters:m,onCreateInGroup:h,isLoading:g,error:_}=e,v=(0,N.useMemo)(()=>ys(t,i),[t,i]),y=(0,N.useMemo)(()=>o===`none`?null:bs(v,o),[v,o]),b=(0,N.useMemo)(()=>mn(t),[t]),[x,S]=(0,N.useState)(()=>new Set),C=(0,N.useCallback)(e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),w=(0,N.useMemo)(()=>({onOpenDrawer:f,onStatusTransition:p,allIdeas:t}),[f,p,t]),T=(0,N.useMemo)(()=>{let e=new Set(u);return Nt.filter(t=>!ds.has(t.id)&&e.has(t.id))},[u]);return(0,P.jsxs)(`div`,{className:$.listWrapper,children:[(0,P.jsx)(zo,{filters:n,ideas:t,onChange:r,endSlot:(0,P.jsx)(es,{groupBy:o,onGroupByChange:s,sort:i,onSortChange:a,density:c,onDensityChange:l,columns:It(),visibleColumnIds:u,onVisibleColumnsChange:d})}),_&&(0,P.jsxs)(`div`,{role:`alert`,className:$.errorBanner,children:[`Failed to load ideas. `,_]}),(0,P.jsx)(`div`,{className:$.scrollArea,children:(0,P.jsxs)(`div`,{role:`grid`,"aria-label":`Ideas list`,className:`${$.grid} ${c===`compact`?$.densityCompact:``}`,children:[(0,P.jsx)(`div`,{role:`row`,className:$.visuallyHiddenHeader,children:Nt.map(e=>(0,P.jsx)(`div`,{role:`columnheader`,"aria-sort":i.columnId===e.id?i.direction===`asc`?`ascending`:`descending`:`none`,children:e.label},e.id))}),g?(0,P.jsx)(hs,{}):t.length===0?(0,P.jsx)(gs,{onClearFilters:m}):y?y.map(e=>(0,P.jsx)(ps,{group:e,groupBy:o,epicChildren:b,expandedEpics:x,onToggleEpic:C,rightColumns:T,cellCtx:w,density:c,onOpenDrawer:f,onStatusTransition:p,onCreateInGroup:h},e.key)):(0,P.jsx)(us,{sorted:v,epicChildren:b,expandedEpics:x,onToggleEpic:C,rightColumns:T,cellCtx:w,density:c,onOpenDrawer:f,onStatusTransition:p})]})})]})}function ps({group:e,groupBy:t,epicChildren:n,expandedEpics:r,onToggleEpic:i,rightColumns:a,cellCtx:o,density:s,onOpenDrawer:c,onStatusTransition:l,onCreateInGroup:u}){let[d,f]=(0,N.useState)(!1),p=ms(t,e.label),m=(0,N.useMemo)(()=>new Set(e.ideas.map(e=>e.id)),[e.ideas]),h=(0,N.useMemo)(()=>{let t=new Set;for(let r of e.ideas){let e=n.byEpicId.get(r.id);if(e)for(let n of e.ordered)m.has(n.id)&&t.add(n.id)}return t},[e.ideas,m,n]),g=e.ideas.filter(e=>!h.has(e.id));return(0,P.jsxs)(`div`,{role:`rowgroup`,className:$.group,children:[(0,P.jsxs)(`div`,{role:`row`,className:$.groupHeader,children:[(0,P.jsx)(`button`,{type:`button`,className:$.groupChevron,"aria-label":d?`Expand ${p}`:`Collapse ${p}`,"aria-expanded":!d,onClick:()=>f(e=>!e),children:(0,P.jsx)(_s,{open:!d})}),(0,P.jsx)(`div`,{className:$.groupGlyph,"aria-hidden":`true`,children:t===`status`&&(0,P.jsx)(vn,{status:e.key,size:14,staticOnly:!0})}),(0,P.jsxs)(`div`,{className:$.groupLabel,children:[(0,P.jsx)(`span`,{children:p}),(0,P.jsx)(`span`,{className:$.groupCount,children:e.ideas.length})]}),u&&(0,P.jsxs)(`button`,{type:`button`,className:$.groupAdd,"aria-label":`New idea in ${p}`,onClick:()=>u(t,e.key),children:[(0,P.jsx)(vs,{}),(0,P.jsx)(`span`,{className:$.groupAddLabel,children:`New`})]})]}),!d&&(g.length===0?(0,P.jsx)(`div`,{role:`row`,className:$.groupEmpty,children:(0,P.jsx)(`div`,{role:`gridcell`,children:`No ideas`})}):(()=>{let e=0;return g.map(t=>{let u=n.byEpicId.get(t.id)??null,d=u!==null,f=d&&r.has(t.id);return(0,P.jsxs)(`div`,{role:`presentation`,children:[(0,P.jsx)(cs,{idea:t,rowIndex:e++,rightColumns:a,cellCtx:o,density:s,onOpenDrawer:c,onStatusTransition:l,isEpicParent:d,isExpanded:f,onToggleExpand:d?()=>i(t.id):void 0,childCount:u?.totalCount??0,doneCount:u?.doneCount??0}),f&&u&&u.ordered.map(t=>(0,P.jsx)(cs,{idea:t,rowIndex:e++,rightColumns:a,cellCtx:o,density:s,onOpenDrawer:c,onStatusTransition:l,depth:1},t.id))]},t.id)})})())]})}function ms(e,t){return e===`status`?F[t]??t:e===`priority`?To[t]??t:t}function hs(){return(0,P.jsx)(`div`,{role:`rowgroup`,"aria-busy":`true`,children:Array.from({length:8}).map((e,t)=>(0,P.jsxs)(`div`,{role:`row`,className:$.skeletonRow,children:[(0,P.jsx)(`div`,{className:$.skeletonBar,style:{width:`50%`}}),(0,P.jsx)(`div`,{className:$.skeletonBar,style:{width:`14%`}}),(0,P.jsx)(`div`,{className:$.skeletonBar,style:{width:`10%`}})]},t))})}function gs({onClearFilters:e}){return(0,P.jsx)(`div`,{role:`row`,className:$.emptyState,children:(0,P.jsxs)(`div`,{role:`gridcell`,className:$.emptyInner,children:[(0,P.jsx)(`div`,{className:$.emptyTitle,children:`No ideas match the current filters.`}),(0,P.jsx)(`button`,{type:`button`,className:$.emptyAction,onClick:e,children:`Clear filters`})]})})}function _s({open:e}){return(0,P.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,style:{transform:e?`rotate(90deg)`:`rotate(0deg)`,transition:`transform 160ms ease`},children:(0,P.jsx)(`path`,{d:`M3 2l3.5 3L3 8`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function vs(){return(0,P.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,"aria-hidden":`true`,children:(0,P.jsx)(`path`,{d:`M5 1.5v7M1.5 5h7`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`})})}function ys(e,t){let n=Ht(t.columnId,e);if(!n)return e;let r=t.direction===`asc`?1:-1;return[...e].sort((e,t)=>{let i=n(e)??``,a=n(t)??``;return i<a?-1*r:i>a?1*r:0})}function bs(e,t){let n=new Map,r=e=>t===`status`?e.status:t===`priority`?e.priority:t===`project`?e.project:`all`;for(let t of e){let e=r(t),i=n.get(e)??[];i.push(t),n.set(e,i)}return Array.from(n.entries()).map(([e,t])=>({key:e,label:e,ideas:t}))}var xs={toast:`_toast_1l8nf_1`,toastIn:`_toastIn_1l8nf_1`,button:`_button_1l8nf_24`,dismiss:`_dismiss_1l8nf_35`};function Ss({message:e,onUndo:t,onDismiss:n}){return(0,P.jsxs)(`div`,{role:`status`,className:xs.toast,children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsx)(`button`,{type:`button`,className:xs.button,onClick:t,children:`Undo`}),(0,P.jsx)(`button`,{type:`button`,className:xs.dismiss,"aria-label":`Dismiss`,onClick:n,children:`×`})]})}var Cs={viewBar:`_viewBar_1ygdg_1`,parseErrorsBanner:`_parseErrorsBanner_1ygdg_3`,parseErrorsHeader:`_parseErrorsHeader_1ygdg_14`,parseErrorsList:`_parseErrorsList_1ygdg_19`,parseErrorsItem:`_parseErrorsItem_1ygdg_24`,parseErrorsCode:`_parseErrorsCode_1ygdg_28`,parseErrorsMessage:`_parseErrorsMessage_1ygdg_32`};function ws({errors:e}){let t=e.length===1?`idea file`:`idea files`;return(0,P.jsxs)(`div`,{role:`alert`,className:Cs.parseErrorsBanner,children:[(0,P.jsxs)(`div`,{className:Cs.parseErrorsHeader,children:[e.length,` `,t,` failed to load and `,e.length===1?`is`:`are`,` hidden from every status until fixed:`]}),(0,P.jsx)(`ul`,{className:Cs.parseErrorsList,children:e.map(e=>(0,P.jsxs)(`li`,{className:Cs.parseErrorsItem,children:[(0,P.jsxs)(`code`,{className:Cs.parseErrorsCode,children:[e.basename,`.md`]}),` — `,(0,P.jsx)(`span`,{className:Cs.parseErrorsMessage,children:e.error})]},e.filePath))})]})}function Ts(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.fixed!=`number`||typeof t.scanned!=`number`)return null;let n=t.fixed===1?`record`:`records`;return`Migration: ${t.fixed} ${n} corrected (of ${t.scanned} scanned)`}var Es=6e4,Ds=Object.freeze({lastRunAt:null,lastRunDurationMs:null,lastError:null,enabled:!1,transitions:Object.freeze({merged:0,closed:0,changesRequested:0,noOp:0})});function Os(){let[e,t]=(0,N.useState)([]),[n,r]=(0,N.useState)([]),[a,o]=(0,N.useState)(!0),[s,l]=(0,N.useState)(null),[u,f]=(0,N.useState)(!1),[m,h]=(0,N.useState)(null),g=(0,N.useRef)(0),_=(0,N.useRef)(!0),v=(0,N.useCallback)(async()=>{try{let e=await fetch(`/api/ideas`);if(!e.ok){console.warn(`GET /api/ideas non-ok:`,e.status,e.statusText);return}let n=await e.json();t(n.ideas),r(n.parseErrors??[])}catch(e){console.warn(`GET /api/ideas failed:`,e)}finally{o(!1)}},[]),y=(0,N.useCallback)(async()=>{try{let e=await fetch(`/api/ideas/reconciler-status`);if(!e.ok)return l(Ds),Ds;let t=await e.json();return l(t),t}catch(e){return console.warn(`GET /api/ideas/reconciler-status failed:`,e),null}},[]);i(p,(0,N.useCallback)(()=>{v()},[v])),i(d,(0,N.useCallback)(e=>{if(!e||typeof e!=`object`){console.warn(`IDEAS_RECONCILER_UPDATE: non-object payload, skipping update`,e);return}let t=e.status;t&&typeof t==`object`?l(t):console.warn(`IDEAS_RECONCILER_UPDATE: missing or wrong-shape status, skipping update`,e)},[])),i(c,(0,N.useCallback)(e=>{let t=Ts(e);t===null?console.warn(`IDEAS_MIGRATION_COMPLETE: malformed payload, skipping toast`,e):h(t)},[])),i(`ws:reconnected`,(0,N.useCallback)(()=>{v(),y()},[v,y]));let b=(0,N.useCallback)(e=>{l(t=>t?{...t,lastError:e}:{...Ds,lastError:e})},[]),x=(0,N.useCallback)(async()=>{f(!0);try{let e=await fetch(`/api/ideas/reconcile`,{method:`POST`});if(!e.ok){let t=`${e.status} ${e.statusText||`request failed`}`;try{let n=await e.json();n?.error&&(t=n.error)}catch(t){console.warn(`POST /api/ideas/reconcile non-JSON error body:`,e.status,t instanceof Error?t.message:t)}console.warn(`POST /api/ideas/reconcile failed:`,t),b(t);return}let t;try{t=await e.json()}catch(e){console.warn(`POST /api/ideas/reconcile returned 200 with malformed JSON:`,e),b(`reconciler returned malformed status (refresh queued)`),v();return}l(t),v()}catch(e){let t=e instanceof Error?e.message:`reconcile request threw`;console.warn(`POST /api/ideas/reconcile threw:`,e),b(t)}finally{f(!1)}},[v,b]),S=(0,N.useCallback)(async e=>{if(!e||e.enabled===!1)return;let t=Date.now(),n=e.lastRunAt?Date.parse(e.lastRunAt):0;t-Math.max(Number.isNaN(n)?0:n,g.current)<Es||(g.current=t,await x())},[x]);return(0,N.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]),(0,N.useEffect)(()=>{v(),(async()=>{try{let e=await y();if(!_.current)return;await S(e)}catch(e){console.warn(`mount auto-reconcile chain threw:`,e)}})()},[v,y,S]),(0,N.useEffect)(()=>{let e=()=>{typeof document>`u`||document.visibilityState===`visible`&&(async()=>{try{let e=await y();if(!_.current)return;await S(e)}catch(e){console.warn(`visibility auto-reconcile chain threw:`,e)}})()};return typeof document<`u`&&document.addEventListener(`visibilitychange`,e),()=>{typeof document<`u`&&document.removeEventListener(`visibilitychange`,e)}},[y,S]),{ideas:e,setIdeas:t,parseErrors:n,loading:a,reconcilerStatus:s,reconcilerLoading:u,migrationToast:m,setMigrationToast:h,refresh:v,handleReconcileClick:x}}function ks(){let[e,t]=(0,N.useState)(()=>{if(typeof window>`u`)return null;let e=window.history.state;return typeof e?.ideaDrawer==`string`?e.ideaDrawer:null}),n=(0,N.useRef)(0),r=(0,N.useCallback)(e=>{t(t=>t===e?t:(typeof window<`u`&&(window.history.pushState({ideaDrawer:e},``,window.location.href),n.current+=1),e))},[]),i=(0,N.useCallback)(()=>{if(typeof window>`u`){t(null);return}let e=n.current;e>0?(n.current=0,window.history.go(-e)):t(null)},[]);return(0,N.useEffect)(()=>{typeof window>`u`||typeof window.history.state?.ideaDrawer==`string`&&n.current===0&&(n.current=1)},[]),(0,N.useEffect)(()=>{if(typeof window>`u`)return;let e=e=>{let r=e.state,i=typeof r?.ideaDrawer==`string`?r.ideaDrawer:null;t(i),i===null?n.current=0:n.current>0&&--n.current};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),{selectedIdeaId:e,onOpenDetail:r,onCloseDetail:i}}var As=new Set([`archived`,`closed`]);function js(e,t,n,r,i){let[a,o]=(0,N.useState)(null),s=(0,N.useCallback)(async t=>{let n=e.find(e=>e.id===t);if(n&&n.size===`epic`){let e=await fetch(`/api/ideas/${t}/cascade-ready`,{method:`POST`});if(!e.ok)try{let t=await e.json();if(t.failingChildren&&t.failingChildren.length>0){let e=t.failingChildren.map(e=>`• ${e.id}: ${e.reason}`).join(`
|
|
3
|
+
`);alert(`Cascade rejected — ${t.failingChildren.length} child idea(s) need fixing:\n\n${e}`)}else alert(`Cascade failed: ${t.error??e.statusText}`)}catch{alert(`Cascade failed: ${e.statusText}`)}}else await fetch(`/api/ideas/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({status:`ready`})});i()},[e,i]),c=(0,N.useCallback)(async(e,t)=>{await fetch(`/api/ideas/${e}/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t===void 0?{}:{severityFloor:t})}),i()},[i]),l=(0,N.useCallback)(async e=>{(await fetch(`/api/ideas/${e}/repromote`,{method:`POST`})).ok&&i()},[i]),u=(0,N.useCallback)(async e=>{(await fetch(`/api/ideas/${e}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({status:`archived`})})).ok&&(n===e&&r(),i())},[i,n,r]),d=(0,N.useCallback)(async(e,t)=>{try{let n=await fetch(`/api/ideas/${e}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let r=`${n.status} ${n.statusText||`request failed`}`;try{let e=await n.json();e?.error&&(r=e.error)}catch{}return console.warn(`PATCH /api/ideas/${e} failed:`,r,t),{ok:!1,error:r}}return i(),{ok:!0}}catch(t){let n=t instanceof Error?t.message:`network error`;return console.warn(`PATCH /api/ideas/${e} threw:`,n),{ok:!1,error:n}}},[i]),f=(0,N.useCallback)(async(n,r)=>{let i=e.find(e=>e.id===n);if(!i)return;let s=i.status;t(e=>e.map(e=>e.id===n?{...e,status:r}:e));try{let e=await fetch(`/api/ideas/${encodeURIComponent(n)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({status:r})});if(!e.ok)throw Error(`PATCH failed: ${e.status}`);if(As.has(r)){a&&clearTimeout(a.timerId);let e=setTimeout(()=>o(null),5e3);o({ideaId:n,message:`Idea ${r}.`,revertStatus:s,timerId:e})}}catch{t(e=>e.map(e=>e.id===n?{...e,status:s}:e))}},[e,a,t]),p=(0,N.useCallback)(async()=>{if(!a)return;let{ideaId:e,revertStatus:n,timerId:r}=a;clearTimeout(r),o(null),t(t=>t.map(t=>t.id===e?{...t,status:n}:t));try{await fetch(`/api/ideas/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({status:n})})}catch{}},[a,t]),m=(0,N.useCallback)(()=>{a&&(clearTimeout(a.timerId),o(null))},[a]);return(0,N.useEffect)(()=>()=>{a&&clearTimeout(a.timerId)},[a]),{undoToast:a,onPromote:s,onStart:c,onRepromote:l,onArchive:u,onPatchIdea:d,onStatusTransition:f,onUndoTransition:p,dismissUndoToast:m}}function Ms({settings:e,onUpdateSettings:t,onOpenUsage:n}){let{ideas:r,setIdeas:i,parseErrors:a,loading:o,reconcilerStatus:s,reconcilerLoading:c,migrationToast:l,setMigrationToast:u,refresh:d,handleReconcileClick:f}=Os(),{selectedIdeaId:p,onOpenDetail:m,onCloseDetail:h}=ks(),{undoToast:g,onPromote:_,onStart:v,onRepromote:y,onArchive:b,onPatchIdea:x,onStatusTransition:S,onUndoTransition:C,dismissUndoToast:w}=js(r,i,p,h,d),[T,E]=(0,N.useState)(!1),[ee,D]=(0,N.useState)(!1),[te,O]=(0,N.useState)(!1),[k,re]=(0,N.useState)(null),[ie,ae]=(0,N.useState)(()=>Qe()),[oe,A]=(0,N.useState)(()=>localStorage.getItem(xt)===`true`),[se,ce]=(0,N.useState)(()=>et()),[le,ue]=(0,N.useState)(()=>it()),[de,fe]=(0,N.useState)(()=>lt()),[pe,j]=(0,N.useState)(()=>ft()),[me,he]=(0,N.useState)(()=>mt()),[ge,_e]=(0,N.useState)(()=>yt()??Pt()),ve=e?.pipelineFeatures??null,ye=bo(),be=(0,N.useCallback)(e=>{$e(e),ae(e)},[]),M=(0,N.useCallback)(e=>{tt(e),ce(e)},[]),xe=(0,N.useCallback)(e=>{at(e),ue(e)},[]),Se=(0,N.useCallback)(e=>{ut(e),fe(e)},[]),Ce=(0,N.useCallback)(e=>{pt(e),j(e)},[]),we=(0,N.useCallback)(e=>{ht(e),he(e)},[]),Te=(0,N.useCallback)(e=>{bt(e),_e(e)},[]),Ee=(0,N.useCallback)(()=>{localStorage.setItem(xt,`true`),A(!0)},[]),De=(0,N.useMemo)(()=>Fe(r,se),[r,se]),Oe=(0,N.useMemo)(()=>r.find(e=>e.id===p)??null,[r,p]);return o?(0,P.jsx)(`div`,{className:`ideas-page`,children:`Loading…`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:Cs.viewBar,children:(0,P.jsx)(So,{viewMode:ie,onChange:be})}),!oe&&(0,P.jsx)(Co,{onDismiss:Ee}),(0,P.jsx)(_o,{onOpenIdea:m}),ie===`board`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(No,{filters:se,ideas:r,onChange:M}),(0,P.jsx)(Tn,{ideas:De,runningPhases:ye,pipelineFeatures:ve,onPromote:e=>{_(e)},onStart:(e,t)=>{v(e,t)},onOpenTimeline:m,onOpenSettings:()=>E(!0),onOpenReconciler:()=>D(!0),reconcilerHasError:!!s?.lastError,onOpenProfiles:()=>O(!0),onOpenUsage:n,onRepromote:e=>{y(e)},onArchive:e=>{b(e)},boardSort:de,onBoardSortChange:Se,headerSlot:a.length>0?(0,P.jsx)(ws,{errors:a}):null})]}):(0,P.jsx)(fs,{ideas:De,filters:se,onFiltersChange:M,sort:le,onSortChange:xe,groupBy:pe,onGroupByChange:Ce,density:me,onDensityChange:we,visibleColumnIds:ge,onVisibleColumnsChange:Te,onOpenDrawer:m,onStatusTransition:S,onClearFilters:()=>M(Ne)}),(0,P.jsx)(Qr,{idea:Oe,ideas:r,pipelineFeatures:ve,onClose:h,onPromote:e=>{_(e)},onStart:(e,t)=>{v(e,t)},onRepromote:e=>{y(e)},onArchive:e=>{b(e)},onProjectPathResolved:()=>{d()},onSelectIdea:m,onPatchIdea:x}),(0,P.jsx)(Ia,{open:T,settings:e,onUpdateSettings:t,onClose:()=>E(!1)}),(0,P.jsx)(qa,{open:ee,onClose:()=>D(!1),status:s,loading:c,onReconcile:f}),(0,P.jsx)($a,{open:te,onClose:()=>O(!1),onViewPatterns:re}),(0,P.jsx)(so,{open:k!==null,slug:k,onClose:()=>re(null)}),l!==null&&(0,P.jsx)(ne,{message:l,onDone:()=>u(null)}),g&&(0,P.jsx)(Ss,{message:g.message,onUndo:C,onDismiss:w})]})}export{Ms as IdeasContainer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._input_1vfuy_1{border-radius:var(--radius-lg);border:1px solid var(--color-border);background:var(--color-bg);width:100%;color:var(--color-text);box-sizing:border-box;outline:none;padding:8px 12px;font-family:inherit;font-size:14px;transition:border-color .15s}._input_1vfuy_1:focus{border-color:var(--color-focus-ring)}._input_1vfuy_1:disabled{opacity:.6;cursor:not-allowed}._input_1vfuy_1::placeholder{color:var(--color-text-subtle)}._compact_1vfuy_28{border-radius:var(--radius-md);background:var(--color-bg-raised);font-size:13px;font-family:var(--font-mono);padding:6px 10px}._select_1vfuy_36{appearance:none;cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b949e'/%3E%3C/svg%3E");background-position:right 14px center;background-repeat:no-repeat;padding-right:36px}._select_1vfuy_36._compact_1vfuy_28{background-position:right 14px center;padding-right:36px}._textarea_1vfuy_50{resize:vertical;min-height:80px;line-height:1.5}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-Bq3x7umQ.js";var t={input:`_input_1vfuy_1`,compact:`_compact_1vfuy_28`,select:`_select_1vfuy_36`,textarea:`_textarea_1vfuy_50`},n=e();function r({compact:e=!1,className:r,...i}){return(0,n.jsx)(`input`,{className:[t.input,e&&t.compact,r].filter(Boolean).join(` `),...i})}function i({compact:e=!1,className:r,children:i,...a}){return(0,n.jsx)(`select`,{className:[t.input,t.select,e&&t.compact,r].filter(Boolean).join(` `),...a,children:i})}function a({compact:e=!1,className:r,...i}){return(0,n.jsx)(`textarea`,{className:[t.input,t.textarea,e&&t.compact,r].filter(Boolean).join(` `),...i})}export{i as n,a as r,r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-Bq3x7umQ.js";import{n as t}from"./styles-Ds5gMQAQ.js";var n=e();function r({label:e,value:r,color:i}){return(0,n.jsxs)(`div`,{style:{background:t.cardBg,border:`1px solid ${t.border}`,borderRadius:10,padding:`16px 20px`},children:[(0,n.jsx)(`div`,{style:{fontSize:11,color:t.muted,textTransform:`uppercase`,letterSpacing:.5,marginBottom:6},children:e}),(0,n.jsx)(`div`,{style:{fontSize:22,fontWeight:700,color:i||`var(--color-text)`},children:r})]})}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._root_viy6r_1{flex-direction:column;gap:16px;min-width:0;display:flex}._header_viy6r_8{flex-direction:column;gap:4px;display:flex}._headerMeta_viy6r_14{color:var(--color-text-muted);font-size:12px}._controls_viy6r_19{border:1px solid var(--color-border);background:var(--color-bg-raised);border-radius:10px;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;padding:12px;display:grid}._control_viy6r_19{flex-direction:column;gap:4px;min-width:0;display:flex}._controlLabel_viy6r_36{color:var(--color-text-muted);letter-spacing:.03em;text-transform:uppercase;font-size:11px;font-weight:500}._controlInput_viy6r_44,._controlSelect_viy6r_45{border:1px solid var(--color-border);background:var(--color-bg);min-height:36px;color:var(--color-text);border-radius:6px;padding:8px 10px;font-family:inherit;font-size:13px}._controlInput_viy6r_44:focus,._controlSelect_viy6r_45:focus{outline:2px solid var(--color-primary);outline-offset:1px;border-color:var(--color-primary)}._controlButtons_viy6r_63{align-self:end;gap:8px;padding-bottom:2px;display:flex}._button_viy6r_70,._buttonSecondary_viy6r_71{cursor:pointer;border-radius:6px;min-height:36px;padding:8px 14px;font-family:inherit;font-size:13px;font-weight:500;transition:background-color .12s,border-color .12s}._button_viy6r_70{background:var(--color-primary);color:var(--color-on-primary,#fff);border:1px solid var(--color-primary)}._button_viy6r_70:hover{filter:brightness(1.1)}._buttonSecondary_viy6r_71{background:var(--color-bg);color:var(--color-text);border:1px solid var(--color-border)}._buttonSecondary_viy6r_71:hover{background:var(--color-bg-hover,var(--color-bg-raised))}._emptyState_viy6r_102{text-align:center;border:1px dashed var(--color-border);color:var(--color-text-muted);border-radius:10px;padding:24px;font-size:13px;line-height:1.6}._tableWrap_viy6r_112{border:1px solid var(--color-border);background:var(--color-bg-raised);border-radius:10px;overflow-x:auto}._table_viy6r_112{border-collapse:collapse;width:100%;min-width:800px;font-size:13px}._table_viy6r_112 thead th{background:var(--color-bg-raised);border-bottom:1px solid var(--color-border);text-align:left;color:var(--color-text-muted);text-transform:uppercase;letter-spacing:.04em;padding:10px 12px;font-size:11px;font-weight:600;position:sticky;top:0}._numericHeader_viy6r_140{text-align:right!important}._table_viy6r_112 tbody td{border-bottom:1px solid var(--color-border);vertical-align:top;color:var(--color-text);padding:10px 12px}._table_viy6r_112 tbody tr:last-child td{border-bottom:none}._row_viy6r_155{cursor:pointer}._row_viy6r_155:hover{background:var(--color-bg-hover,#ffffff08)}._row_viy6r_155:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}._rowSelected_viy6r_168{background:var(--color-bg-hover,#ffffff0a)}._whenCell_viy6r_172{font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--color-text-muted);font-size:12px}._tagsCell_viy6r_179{flex-wrap:wrap;gap:4px;max-width:200px;display:flex}._contentCell_viy6r_186{-webkit-line-clamp:2;-webkit-box-orient:vertical;max-width:360px;line-height:1.4;display:-webkit-box;overflow:hidden}._idCell_viy6r_195{justify-content:flex-end;align-items:center;gap:6px;min-width:140px;display:flex}._codeChip_viy6r_203{background:var(--color-bg);border:1px solid var(--color-border);font-family:var(--font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--color-text);text-overflow:ellipsis;white-space:nowrap;border-radius:4px;max-width:220px;padding:2px 6px;font-size:11px;display:inline-block;overflow:hidden}._codeChipFull_viy6r_218{background:var(--color-bg);border:1px solid var(--color-border);font-family:var(--font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--color-text);word-break:break-all;border-radius:4px;max-width:100%;padding:4px 8px;font-size:11px;display:inline-block}._copyButton_viy6r_231{color:var(--color-text-muted);cursor:pointer;background:0 0;border:1px solid #0000;border-radius:4px;padding:4px 6px;font-size:12px}._copyButton_viy6r_231:hover{color:var(--color-primary);background:color-mix(in oklab, var(--color-primary) 10%, transparent)}._muted_viy6r_246{color:var(--color-text-muted)}._chipPersistent_viy6r_250{background:color-mix(in oklab, var(--color-warning,#f59e0b) 20%, transparent);color:var(--color-warning,#f59e0b);text-transform:uppercase;letter-spacing:.04em;border-radius:999px;margin-left:6px;padding:1px 8px;font-size:10px;font-weight:500;display:inline-block}._tagChip_viy6r_263{background:color-mix(in oklab, var(--color-primary) 14%, transparent);color:var(--color-primary);white-space:nowrap;border-radius:999px;padding:2px 6px;font-size:10px}._drawerBackdrop_viy6r_272{z-index:30;background:#0006;justify-content:flex-end;display:flex;position:fixed;inset:0}._drawer_viy6r_272{background:var(--color-bg);border-left:1px solid var(--color-border);flex-direction:column;gap:16px;width:min(540px,100vw);height:100vh;padding:20px;display:flex;overflow-y:auto;box-shadow:-8px 0 24px #0003}._drawerHeader_viy6r_294{justify-content:space-between;align-items:center;display:flex}._drawerTitle_viy6r_300{color:var(--color-text);margin:0;font-size:15px;font-weight:600}._closeButton_viy6r_307{color:var(--color-text-muted);border:1px solid var(--color-border);cursor:pointer;background:0 0;border-radius:6px;padding:4px 10px;font-size:14px}._closeButton_viy6r_307:hover{color:var(--color-text);background:var(--color-bg-raised)}._drawerMeta_viy6r_322{border:1px solid var(--color-border);background:var(--color-bg-raised);border-radius:8px;flex-direction:column;gap:8px;margin:0;padding:12px;display:flex}._drawerMetaRow_viy6r_333{grid-template-columns:110px 1fr;align-items:start;gap:12px;font-size:12px;display:grid}._drawerMetaRow_viy6r_333 dt{color:var(--color-text-muted);text-transform:uppercase;letter-spacing:.04em;margin:0;padding-top:2px;font-size:11px}._drawerMetaRow_viy6r_333 dd{color:var(--color-text);word-break:break-word;flex-wrap:wrap;align-items:center;gap:6px;margin:0;display:flex}._drawerSection_viy6r_360{flex-direction:column;gap:8px;display:flex}._drawerSectionLabel_viy6r_366{color:var(--color-text-muted);text-transform:uppercase;letter-spacing:.04em;font-size:11px;font-weight:500}._drawerContent_viy6r_374{color:var(--color-text);background:var(--color-bg-raised);border:1px solid var(--color-border);white-space:pre-wrap;word-break:break-word;border-radius:8px;padding:12px;font-size:13px;line-height:1.55}._jumpLink_viy6r_386{color:var(--color-primary);border:1px solid color-mix(in oklab, var(--color-primary) 40%, transparent);cursor:pointer;background:0 0;border-radius:4px;padding:4px 10px;font-size:11px;font-weight:500}._jumpLink_viy6r_386:hover{background:color-mix(in oklab, var(--color-primary) 10%, transparent)}._neighborList_viy6r_401{flex-direction:column;gap:6px;margin:0;padding:0;list-style:none;display:flex}._neighborItem_viy6r_410{background:var(--color-bg-raised);border:1px solid var(--color-border);border-radius:6px;flex-direction:column;gap:4px;padding:8px 10px;display:flex}._neighborHeader_viy6r_420{justify-content:space-between;align-items:center;gap:8px;display:flex}._neighborDist_viy6r_427{font-family:var(--font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--color-text-muted);font-variant-numeric:tabular-nums;font-size:11px}._neighborPreview_viy6r_434{color:var(--color-text-muted);-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12px;line-height:1.4;display:-webkit-box;overflow:hidden}@media (width<=767px){._controls_viy6r_19{grid-template-columns:1fr}._controlButtons_viy6r_63{flex-direction:row;justify-content:flex-end;align-self:stretch}._drawer_viy6r_272{width:100vw}._contentCell_viy6r_186{max-width:100%}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{d as r}from"./index-tOLuwPW6.js";import"./ui-Bx41p7g8.js";import{n as i,t as a}from"./shared-wI40KN7Y.js";var o=t(e(),1),s={root:`_root_viy6r_1`,header:`_header_viy6r_8`,headerMeta:`_headerMeta_viy6r_14`,controls:`_controls_viy6r_19`,control:`_control_viy6r_19`,controlLabel:`_controlLabel_viy6r_36`,controlInput:`_controlInput_viy6r_44`,controlSelect:`_controlSelect_viy6r_45`,controlButtons:`_controlButtons_viy6r_63`,button:`_button_viy6r_70`,buttonSecondary:`_buttonSecondary_viy6r_71`,emptyState:`_emptyState_viy6r_102`,tableWrap:`_tableWrap_viy6r_112`,table:`_table_viy6r_112`,numericHeader:`_numericHeader_viy6r_140`,row:`_row_viy6r_155`,rowSelected:`_rowSelected_viy6r_168`,whenCell:`_whenCell_viy6r_172`,tagsCell:`_tagsCell_viy6r_179`,contentCell:`_contentCell_viy6r_186`,idCell:`_idCell_viy6r_195`,codeChip:`_codeChip_viy6r_203`,codeChipFull:`_codeChipFull_viy6r_218`,copyButton:`_copyButton_viy6r_231`,muted:`_muted_viy6r_246`,chipPersistent:`_chipPersistent_viy6r_250`,tagChip:`_tagChip_viy6r_263`,drawerBackdrop:`_drawerBackdrop_viy6r_272`,drawer:`_drawer_viy6r_272`,drawerHeader:`_drawerHeader_viy6r_294`,drawerTitle:`_drawerTitle_viy6r_300`,closeButton:`_closeButton_viy6r_307`,drawerMeta:`_drawerMeta_viy6r_322`,drawerMetaRow:`_drawerMetaRow_viy6r_333`,drawerSection:`_drawerSection_viy6r_360`,drawerSectionLabel:`_drawerSectionLabel_viy6r_366`,drawerContent:`_drawerContent_viy6r_374`,jumpLink:`_jumpLink_viy6r_386`,neighborList:`_neighborList_viy6r_401`,neighborItem:`_neighborItem_viy6r_410`,neighborHeader:`_neighborHeader_viy6r_420`,neighborDist:`_neighborDist_viy6r_427`,neighborPreview:`_neighborPreview_viy6r_434`},c=n(),l=`__null__`,u=`__null__`;function d(e){let t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toISOString().slice(0,16).replace(`T`,` `)}function f(e){let[t,n]=(0,o.useState)([]),[f,p]=(0,o.useState)([]),[m,h]=(0,o.useState)([]),[g,_]=(0,o.useState)(`all`),[v,y]=(0,o.useState)(``),[b,x]=(0,o.useState)(null),[S,C]=(0,o.useState)(null),[w,T]=(0,o.useState)([]),[E,D]=(0,o.useState)(`loading`),[O,k]=(0,o.useState)(null),[A,j]=(0,o.useState)(0),[M,N]=(0,o.useState)(null),[P,F]=(0,o.useState)(`idle`),I=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=new AbortController;return D(`loading`),fetch(`/api/memory/observations?limit=500`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);T(await e.json()),D(`ok`),k(null)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||(k(e instanceof Error?e.message:String(e)),D(`error`))}),()=>e.abort()},[A]),(0,o.useEffect)(()=>{if(!b){N(null),F(`idle`);return}I.current?.abort();let e=new AbortController;I.current=e,F(`loading`),fetch(`/api/memory/observations/${encodeURIComponent(b)}/neighbors?limit=10`,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);N((await e.json()).neighbors),F(`idle`)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||(F(`error`),N(null))})},[b]);let L=(0,o.useMemo)(()=>{let e=new Map,t=0;for(let n of w)n.employee?e.set(n.employee,(e.get(n.employee)??0)+1):t+=1;let n=Array.from(e.entries()).map(([e,t])=>({value:e,count:t})).sort((e,t)=>(t.count??0)-(e.count??0));return t>0&&n.push({value:l,label:`(unattributed)`,count:t}),n},[w]),R=(0,o.useMemo)(()=>{let e=new Map,t=0;for(let n of w)n.department?e.set(n.department,(e.get(n.department)??0)+1):t+=1;let n=Array.from(e.entries()).map(([e,t])=>({value:e,count:t})).sort((e,t)=>(t.count??0)-(e.count??0));return t>0&&n.push({value:u,label:`(unset)`,count:t}),n},[w]),z=(0,o.useMemo)(()=>{let e=new Map;for(let t of w)for(let n of t.tags??[])e.set(n,(e.get(n)??0)+1);return Array.from(e.entries()).map(([e,t])=>({value:e,count:t})).sort((e,t)=>(t.count??0)-(e.count??0))},[w]),B=(0,o.useMemo)(()=>{let e=v.trim().toLowerCase();return w.filter(n=>{if(t.length>0){let e=n.employee??l;if(!t.includes(e))return!1}if(f.length>0){let e=n.department??u;if(!f.includes(e))return!1}if(m.length>0){let e=n.tags??[];if(!m.some(t=>e.includes(t)))return!1}return!(g===`yes`&&!n.persistent||g===`no`&&n.persistent||e&&!n.content.toLowerCase().includes(e))})},[w,t,f,m,g,v]),V=(0,o.useMemo)(()=>b?w.find(e=>e.id===b)??null:null,[b,w]),H=(0,o.useCallback)(async e=>{try{navigator.clipboard?await navigator.clipboard.writeText(e):window.prompt(`Copy observation id:`,e),C(e),window.setTimeout(()=>C(t=>t===e?null:t),1500)}catch{window.prompt(`Copy observation id:`,e)}},[]),U=(0,o.useCallback)(()=>{n([]),p([]),h([]),_(`all`),y(``)},[]),W=B.length,G=w.length;return(0,c.jsxs)(`div`,{className:s.root,children:[(0,c.jsxs)(`div`,{className:s.header,children:[(0,c.jsx)(i,{title:`Observation browser`,subtitle:`Live view of every observation in memory.db. Filter, search, and inspect nearest neighbors.`}),(0,c.jsx)(`div`,{className:s.headerMeta,children:E===`loading`?`Loading…`:E===`error`?`Error: ${O}`:`${W} of ${G} shown`})]}),E===`error`?(0,c.jsxs)(a,{children:[(0,c.jsx)(`strong`,{children:`Could not load observations.`}),` `,O,(0,c.jsx)(`br`,{}),(0,c.jsxs)(`small`,{children:[`The Memory Explorer requires the gateway at `,(0,c.jsx)(`code`,{children:`http://localhost:7463`}),`.`]})]}):null,(0,c.jsxs)(`div`,{className:s.controls,children:[(0,c.jsxs)(`div`,{className:s.control,children:[(0,c.jsx)(`span`,{className:s.controlLabel,children:`Employee`}),(0,c.jsx)(r,{options:L,selected:t,onChange:n,emptyLabel:`All employees`,searchPlaceholder:`Filter employees…`})]}),(0,c.jsxs)(`div`,{className:s.control,children:[(0,c.jsx)(`span`,{className:s.controlLabel,children:`Department`}),(0,c.jsx)(r,{options:R,selected:f,onChange:p,emptyLabel:`All departments`,searchPlaceholder:`Filter departments…`})]}),(0,c.jsxs)(`div`,{className:s.control,children:[(0,c.jsx)(`span`,{className:s.controlLabel,children:`Tag`}),(0,c.jsx)(r,{options:z,selected:m,onChange:h,emptyLabel:`All tags`,searchPlaceholder:`Filter tags…`})]}),(0,c.jsxs)(`div`,{className:s.control,children:[(0,c.jsx)(`label`,{className:s.controlLabel,htmlFor:`exp-pers`,children:`Persistent`}),(0,c.jsxs)(`select`,{id:`exp-pers`,className:s.controlSelect,value:g,onChange:e=>_(e.target.value),children:[(0,c.jsx)(`option`,{value:`all`,children:`All`}),(0,c.jsx)(`option`,{value:`yes`,children:`Persistent only`}),(0,c.jsx)(`option`,{value:`no`,children:`Non-persistent`})]})]}),(0,c.jsxs)(`div`,{className:s.control,children:[(0,c.jsx)(`label`,{className:s.controlLabel,htmlFor:`exp-search`,children:`Search content`}),(0,c.jsx)(`input`,{id:`exp-search`,className:s.controlInput,type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`substring match`})]}),(0,c.jsxs)(`div`,{className:s.controlButtons,children:[(0,c.jsx)(`button`,{type:`button`,className:s.buttonSecondary,onClick:U,children:`Clear`}),(0,c.jsx)(`button`,{type:`button`,className:s.button,onClick:()=>j(e=>e+1),children:`Refresh`})]})]}),E===`ok`&&B.length===0?(0,c.jsxs)(`div`,{className:s.emptyState,children:[(0,c.jsx)(`strong`,{children:`No rows match your filters.`}),(0,c.jsx)(`br`,{}),`Clear filters to see the full corpus, or refresh if the gateway just started.`]}):null,B.length>0?(0,c.jsx)(`div`,{className:s.tableWrap,children:(0,c.jsxs)(`table`,{className:s.table,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{scope:`col`,children:`When`}),(0,c.jsx)(`th`,{scope:`col`,children:`Employee`}),(0,c.jsx)(`th`,{scope:`col`,children:`Tags`}),(0,c.jsx)(`th`,{scope:`col`,children:`Content`}),(0,c.jsx)(`th`,{scope:`col`,className:s.numericHeader,children:`ID`})]})}),(0,c.jsx)(`tbody`,{children:B.map(e=>(0,c.jsxs)(`tr`,{className:`${s.row} ${b===e.id?s.rowSelected:``}`,onClick:()=>x(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),x(e.id))},tabIndex:0,role:`button`,"aria-label":`Observation ${e.id} by ${e.employee??`unattributed`}`,children:[(0,c.jsx)(`td`,{className:s.whenCell,children:d(e.timestamp)}),(0,c.jsxs)(`td`,{children:[e.employee??(0,c.jsx)(`span`,{className:s.muted,children:`unattributed`}),e.persistent?(0,c.jsx)(`span`,{className:s.chipPersistent,children:`persistent`}):null]}),(0,c.jsx)(`td`,{className:s.tagsCell,children:(e.tags??[]).slice(0,3).map(e=>(0,c.jsx)(`span`,{className:s.tagChip,children:e},e))}),(0,c.jsx)(`td`,{className:s.contentCell,children:e.content}),(0,c.jsxs)(`td`,{className:s.idCell,children:[(0,c.jsxs)(`code`,{className:s.codeChip,children:[e.id.slice(0,10),`…`]}),(0,c.jsx)(`button`,{type:`button`,className:s.copyButton,onClick:t=>{t.stopPropagation(),H(e.id)},title:`Copy full ID`,children:S===e.id?`✓`:`⎘`})]})]},e.id))})]})}):null,V?(0,c.jsx)(`div`,{className:s.drawerBackdrop,onClick:()=>x(null),role:`presentation`,children:(0,c.jsxs)(`div`,{className:s.drawer,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`observation-drawer-title`,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&x(null)},children:[(0,c.jsxs)(`div`,{className:s.drawerHeader,children:[(0,c.jsx)(`h3`,{id:`observation-drawer-title`,className:s.drawerTitle,children:`Observation detail`}),(0,c.jsx)(`button`,{type:`button`,className:s.closeButton,onClick:()=>x(null),"aria-label":`Close`,children:`✕`})]}),(0,c.jsxs)(`dl`,{className:s.drawerMeta,children:[(0,c.jsxs)(`div`,{className:s.drawerMetaRow,children:[(0,c.jsx)(`dt`,{children:`ID`}),(0,c.jsxs)(`dd`,{children:[(0,c.jsx)(`code`,{className:s.codeChipFull,children:V.id}),(0,c.jsx)(`button`,{type:`button`,className:s.jumpLink,onClick:()=>void H(V.id),children:S===V.id?`Copied`:`Copy`})]})]}),(0,c.jsxs)(`div`,{className:s.drawerMetaRow,children:[(0,c.jsx)(`dt`,{children:`Employee`}),(0,c.jsx)(`dd`,{children:V.employee??`—`})]}),(0,c.jsxs)(`div`,{className:s.drawerMetaRow,children:[(0,c.jsx)(`dt`,{children:`Department`}),(0,c.jsx)(`dd`,{children:V.department??`—`})]}),(0,c.jsxs)(`div`,{className:s.drawerMetaRow,children:[(0,c.jsx)(`dt`,{children:`Tags`}),(0,c.jsx)(`dd`,{children:(V.tags??[]).length>0?(V.tags??[]).map(e=>(0,c.jsx)(`span`,{className:s.tagChip,children:e},e)):`—`})]}),(0,c.jsxs)(`div`,{className:s.drawerMetaRow,children:[(0,c.jsx)(`dt`,{children:`Persistent`}),(0,c.jsx)(`dd`,{children:V.persistent?`yes`:`no`})]}),(0,c.jsxs)(`div`,{className:s.drawerMetaRow,children:[(0,c.jsx)(`dt`,{children:`Source`}),(0,c.jsx)(`dd`,{children:V.source??`—`})]}),(0,c.jsxs)(`div`,{className:s.drawerMetaRow,children:[(0,c.jsx)(`dt`,{children:`Created`}),(0,c.jsx)(`dd`,{children:d(V.timestamp)})]})]}),(0,c.jsxs)(`div`,{className:s.drawerSection,children:[(0,c.jsx)(`div`,{className:s.drawerSectionLabel,children:`Content`}),(0,c.jsx)(`div`,{className:s.drawerContent,children:V.content})]}),(0,c.jsxs)(`div`,{className:s.drawerSection,children:[(0,c.jsxs)(`div`,{className:s.drawerSectionLabel,children:[`Nearest neighbors `,M?`(${M.length})`:``]}),P===`loading`?(0,c.jsx)(`div`,{className:s.muted,children:`Loading…`}):P===`error`?(0,c.jsx)(`div`,{className:s.muted,children:`Failed to load neighbors (gateway error or no embedding for this observation).`}):M&&M.length>0?(0,c.jsx)(`ul`,{className:s.neighborList,children:M.map(e=>{let t=w.find(t=>t.id===e.observationId);return(0,c.jsxs)(`li`,{className:s.neighborItem,children:[(0,c.jsxs)(`div`,{className:s.neighborHeader,children:[(0,c.jsxs)(`code`,{className:s.codeChip,children:[e.observationId.slice(0,12),`…`]}),(0,c.jsxs)(`span`,{className:s.neighborDist,children:[`d=`,e.distance.toFixed(3)]})]}),t?(0,c.jsx)(`div`,{className:s.neighborPreview,children:t.content.slice(0,140)}):(0,c.jsx)(`div`,{className:s.muted,children:`observation not in current fetch`})]},e.observationId)})}):(0,c.jsx)(`div`,{className:s.muted,children:`No neighbors found. The observation may not have an embedding (e.g. pre-O5 seam-retro rows) or sqlite-vec is unavailable.`})]})]})}):null]})}export{f as MemoryExplore};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,s as t,t as n}from"./jsx-runtime-Bq3x7umQ.js";import{t as r}from"./react-dom-Cnw6SoYl.js";import{r as i}from"./useWebSocket-Hg3RO6sx.js";import{r as a,t as o}from"./Input-HhV6M0tu.js";import{t as s}from"./Button-xBBZQ0ie.js";import{t as c}from"./useGet-CU5_p7vA.js";import{A as l,k as u}from"./index-tOLuwPW6.js";var d=t(e(),1);function f(e){let[t,n]=(0,d.useState)([]),[r,a]=(0,d.useState)(!0),[o,s]=(0,d.useState)(null),[c,l]=(0,d.useState)(0);(0,d.useEffect)(()=>{let t=!1,r=new AbortController;a(!0),s(null);let i=new URLSearchParams;e?.status&&i.set(`status`,e.status),e?.project&&i.set(`project`,e.project);let o=`/api/memory/hygiene/proposals${i.toString()?`?${i}`:``}`;return fetch(o,{signal:r.signal}).then(e=>{if(!e.ok)throw Error(`${e.status} ${e.statusText}`);return e.json()}).then(e=>{t||n(e)}).catch(e=>{t||s(e.message)}).finally(()=>{t||a(!1)}),()=>{t=!0,r.abort()}},[e?.status,e?.project,c]),i(`memory:proposal`,t=>{let r=t;e?.status&&r.status!==e.status||e?.project&&r.project!==e.project||n(e=>[r,...e])});let u=(0,d.useCallback)(async(e,t,r)=>{try{let i=await fetch(`/api/memory/hygiene/proposals/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t,...r?{reason:r}:{}})});if(!i.ok)throw Error(`${i.status} ${i.statusText}`);let a=await i.json();n(t=>t.map(t=>t.id===e?a:t).filter(e=>e.status===`pending`))}catch(n){let r=n.message;throw console.warn(`[memory-proposals] ${t} ${e} failed:`,r),n}},[]);return{proposals:t,loading:r,error:o,approve:(0,d.useCallback)(e=>u(e,`approve`),[u]),reject:(0,d.useCallback)((e,t)=>u(e,`reject`,t),[u]),refresh:(0,d.useCallback)(()=>l(e=>e+1),[])}}function p(e=10){let[t,n]=(0,d.useState)([]),[r,a]=(0,d.useState)([]),[o,s]=(0,d.useState)(!0),[c,l]=(0,d.useState)(null),[u,f]=(0,d.useState)(0);return(0,d.useEffect)(()=>{let t=!1,r=new AbortController;return s(!0),l(null),Promise.all([fetch(`/api/memory/hygiene/runs?limit=${e}`,{signal:r.signal}).then(e=>{if(!e.ok)throw Error(e.statusText);return e.json()}),fetch(`/api/memory/hygiene/runs/timeline`,{signal:r.signal}).then(e=>{if(!e.ok)throw Error(e.statusText);return e.json()})]).then(([e,r])=>{t||(n(e),a(r))}).catch(e=>{t||l(e.message)}).finally(()=>{t||s(!1)}),()=>{t=!0,r.abort()}},[e,u]),i(`memory:steward-run-complete`,()=>{f(e=>e+1)}),{runs:t,timeline:r,loading:o,error:c}}var m={container:`_container_z76tk_1`,empty:`_empty_z76tk_7`,emptyTitle:`_emptyTitle_z76tk_20`,emptySub:`_emptySub_z76tk_26`,card:`_card_z76tk_31`,cardIn:`_cardIn_z76tk_1`,cardHeader:`_cardHeader_z76tk_51`,typeBadge:`_typeBadge_z76tk_59`,typeBadgeSynthesis:`_typeBadgeSynthesis_z76tk_71`,typeBadgeTombstone:`_typeBadgeTombstone_z76tk_77`,typeBadgeContradiction:`_typeBadgeContradiction_z76tk_83`,targetRow:`_targetRow_z76tk_89`,primaryFile:`_primaryFile_z76tk_97`,extraFilesToggle:`_extraFilesToggle_z76tk_111`,timestamp:`_timestamp_z76tk_146`,extraFilesList:`_extraFilesList_z76tk_153`,action:`_action_z76tk_172`,bodyDisclosure:`_bodyDisclosure_z76tk_180`,bodySummary:`_bodySummary_z76tk_187`,bodyMeta:`_bodyMeta_z76tk_228`,bodyPre:`_bodyPre_z76tk_235`,actions:`_actions_z76tk_250`,rejectGroup:`_rejectGroup_z76tk_257`,rejectLabel:`_rejectLabel_z76tk_265`,rejectHint:`_rejectHint_z76tk_272`,rejectInput:`_rejectInput_z76tk_277`,kbdHint:`_kbdHint_z76tk_282`,actionError:`_actionError_z76tk_296`},h=n(),g={synthesis:`Synthesis`,tombstone:`Tombstone`,contradiction:`Contradiction`},_={synthesis:m.typeBadgeSynthesis,tombstone:m.typeBadgeTombstone,contradiction:m.typeBadgeContradiction};function v(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.round(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function y({proposal:e,onApprove:t,onReject:n}){let[r,i]=(0,d.useState)(!1),[o,c]=(0,d.useState)(``),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(null),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(!1),C=g[e.type]??e.type,w=_[e.type]??m.typeBadgeSynthesis,T=e.targetFiles[0],E=e.targetFiles.slice(1),D=e.draftBody.split(`
|
|
2
|
+
`).length,O=e.draftBody.length,k=`extra-files-${e.id}`,A=async()=>{u(!0),p(null);try{await t()}catch(e){p(`Approve failed: ${e.message}`)}finally{u(!1)}},j=async()=>{if(o.trim()){u(!0),p(null);try{await n(o.trim())}catch(e){p(`Reject failed: ${e.message}`)}finally{u(!1)}}},M=()=>{i(!1),c(``),p(null)};return(0,h.jsxs)(`article`,{className:m.card,"aria-label":`${C} proposal for ${T}${E.length?` and ${E.length} more`:``}`,"aria-busy":l,children:[(0,h.jsxs)(`div`,{className:m.cardHeader,children:[(0,h.jsx)(`span`,{className:`${m.typeBadge} ${w}`,children:C}),(0,h.jsxs)(`div`,{className:m.targetRow,children:[(0,h.jsx)(`code`,{className:m.primaryFile,children:T}),E.length>0&&(0,h.jsxs)(`button`,{type:`button`,className:m.extraFilesToggle,onClick:()=>b(e=>!e),"aria-expanded":y,"aria-controls":k,"aria-label":y?`Hide additional files`:`Show ${E.length} more file${E.length===1?``:`s`}`,children:[y?`−`:`+`,` `,E.length,` more`]})]}),(0,h.jsx)(`span`,{className:m.timestamp,children:v(e.createdAt)})]}),y&&E.length>0&&(0,h.jsx)(`ul`,{className:m.extraFilesList,id:k,children:E.map(e=>(0,h.jsx)(`li`,{children:(0,h.jsx)(`code`,{children:e})},e))}),(0,h.jsx)(`p`,{className:m.action,children:e.proposedAction}),(0,h.jsxs)(`details`,{className:m.bodyDisclosure,open:x,onToggle:e=>S(e.target.open),children:[(0,h.jsxs)(`summary`,{className:m.bodySummary,children:[(0,h.jsx)(`span`,{children:x?`Hide proposed body`:`Show proposed body`}),(0,h.jsxs)(`span`,{className:m.bodyMeta,children:[D,` line`,D===1?``:`s`,` · `,O.toLocaleString(),` chars`]})]}),(0,h.jsx)(`pre`,{className:m.bodyPre,children:e.draftBody})]}),r?(0,h.jsxs)(`div`,{className:m.rejectGroup,onKeyDown:e=>{e.key===`Escape`&&!l&&(e.stopPropagation(),M())},children:[(0,h.jsxs)(`label`,{htmlFor:`reason-${e.id}`,className:m.rejectLabel,children:[`Why reject? `,(0,h.jsx)(`span`,{className:m.rejectHint,children:`(required)`})]}),(0,h.jsx)(a,{id:`reason-${e.id}`,className:m.rejectInput,placeholder:`e.g. duplicates existing canonical file; topic too broad; etc.`,value:o,onChange:e=>c(e.target.value),rows:2,autoFocus:!0}),(0,h.jsxs)(`div`,{className:m.actions,children:[(0,h.jsx)(s,{variant:`danger`,size:`sm`,disabled:l||!o.trim(),onClick:j,children:l?`Rejecting…`:`Confirm reject`}),(0,h.jsxs)(s,{variant:`ghost`,size:`sm`,disabled:l,onClick:M,children:[`Cancel `,(0,h.jsx)(`kbd`,{className:m.kbdHint,"aria-hidden":`true`,children:`Esc`})]})]})]}):(0,h.jsxs)(`div`,{className:m.actions,children:[(0,h.jsx)(s,{variant:`primary`,size:`sm`,disabled:l,onClick:A,"aria-label":`Approve proposal ${e.id}`,children:l?`Approving…`:`Approve`}),(0,h.jsx)(s,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>{i(!0),p(null)},"aria-label":`Reject proposal ${e.id}`,children:`Reject`})]}),f&&(0,h.jsx)(`div`,{className:m.actionError,role:`alert`,children:f})]})}function b({proposals:e,loading:t,error:n,approve:r,reject:i}){return t?(0,h.jsx)(`p`,{className:m.empty,children:`Loading proposals…`}):n?(0,h.jsxs)(`p`,{className:m.empty,role:`alert`,children:[`Error: `,n]}):e.length===0?(0,h.jsxs)(`p`,{className:m.empty,children:[(0,h.jsx)(`span`,{className:m.emptyTitle,children:`Inbox zero.`}),(0,h.jsx)(`span`,{className:m.emptySub,children:`The steward has no pending proposals right now.`})]}):(0,h.jsx)(`div`,{className:m.container,"aria-live":`polite`,children:e.map(e=>(0,h.jsx)(y,{proposal:e,onApprove:()=>r(e.id),onReject:t=>i(e.id,t)},e.id))})}var x={wrap:`_wrap_1t8pi_1`,tableHeader:`_tableHeader_1t8pi_10`,chevronSpacer:`_chevronSpacer_1t8pi_25`,empty:`_empty_1t8pi_29`,emptyTitle:`_emptyTitle_1t8pi_42`,emptySub:`_emptySub_1t8pi_48`,runGroup:`_runGroup_1t8pi_53`,row:`_row_1t8pi_61`,rowOpen:`_rowOpen_1t8pi_86`,chevron:`_chevron_1t8pi_25`,col:`_col_1t8pi_105`,colPrimary:`_colPrimary_1t8pi_112`,colSecondary:`_colSecondary_1t8pi_117`,colValue:`_colValue_1t8pi_126`,status:`_status_1t8pi_132`,statusDot:`_statusDot_1t8pi_146`,statusOk:`_statusOk_1t8pi_153`,statusError:`_statusError_1t8pi_159`,detail:`_detail_1t8pi_165`,detailOpen:`_detailOpen_1t8pi_173`,detailInner:`_detailInner_1t8pi_179`,detailEmpty:`_detailEmpty_1t8pi_186`,projectList:`_projectList_1t8pi_193`,projectRow:`_projectRow_1t8pi_202`,projectName:`_projectName_1t8pi_214`,metric:`_metric_1t8pi_223`,metricLabel:`_metricLabel_1t8pi_230`,metricValue:`_metricValue_1t8pi_237`,metricWarn:`_metricWarn_1t8pi_244`,errorBlock:`_errorBlock_1t8pi_248`},S=10;function C(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${(e/6e4).toFixed(1)}m`}function w(e){let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.round(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function T({run:e,isOpen:t,onToggle:n}){let r=e.projects.length,i=!e.error,a=`run-detail-${e.id}`,o=(0,d.useRef)(null);return(0,d.useEffect)(()=>{let e=o.current;e&&(t?e.removeAttribute(`inert`):e.setAttribute(`inert`,``))},[t]),(0,h.jsxs)(`div`,{className:x.runGroup,children:[(0,h.jsxs)(`button`,{type:`button`,className:`${x.row} ${t?x.rowOpen:``}`,onClick:n,"aria-expanded":t,"aria-controls":a,children:[(0,h.jsx)(`span`,{className:x.chevron,"aria-hidden":`true`,children:`▸`}),(0,h.jsxs)(`span`,{className:x.col,"data-label":`When`,children:[(0,h.jsx)(`span`,{className:x.colPrimary,children:w(e.startedAt)}),(0,h.jsx)(`span`,{className:x.colSecondary,children:new Date(e.startedAt).toLocaleString()})]}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Duration`,children:(0,h.jsx)(`span`,{className:x.colValue,children:C(e.durationMs)})}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Projects`,children:(0,h.jsx)(`span`,{className:x.colValue,children:r})}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Fixes`,children:(0,h.jsx)(`span`,{className:x.colValue,children:e.totalAutoFixes})}),(0,h.jsx)(`span`,{className:x.col,"data-label":`Judgments`,children:(0,h.jsx)(`span`,{className:x.colValue,children:e.totalJudgments})}),(0,h.jsxs)(`span`,{className:`${x.status} ${i?x.statusOk:x.statusError}`,children:[(0,h.jsx)(`span`,{className:x.statusDot,"aria-hidden":`true`}),i?`OK`:`Error`]})]}),(0,h.jsx)(`div`,{id:a,ref:o,className:`${x.detail} ${t?x.detailOpen:``}`,role:`region`,"aria-label":`Details for run at ${new Date(e.startedAt).toLocaleString()}`,children:(0,h.jsxs)(`div`,{className:x.detailInner,children:[e.projects.length===0?(0,h.jsx)(`p`,{className:x.detailEmpty,children:`No projects scanned.`}):(0,h.jsx)(`ul`,{className:x.projectList,children:e.projects.map(e=>{let t=e.structureCompliancePct<90,n=e.freshnessPct<90;return(0,h.jsxs)(`li`,{className:x.projectRow,children:[(0,h.jsx)(`span`,{className:x.projectName,children:e.project}),(0,h.jsxs)(`span`,{className:`${x.metric} ${t?x.metricWarn:``}`,children:[(0,h.jsx)(`span`,{className:x.metricLabel,children:`Structure`}),(0,h.jsxs)(`span`,{className:x.metricValue,children:[e.structureCompliancePct,`%`]})]}),(0,h.jsxs)(`span`,{className:`${x.metric} ${n?x.metricWarn:``}`,children:[(0,h.jsx)(`span`,{className:x.metricLabel,children:`Freshness`}),(0,h.jsxs)(`span`,{className:x.metricValue,children:[e.freshnessPct,`%`]})]}),(0,h.jsxs)(`span`,{className:x.metric,children:[(0,h.jsx)(`span`,{className:x.metricLabel,children:`Fixes`}),(0,h.jsx)(`span`,{className:x.metricValue,children:e.autoFixCount})]})]},e.project)})}),e.error&&(0,h.jsxs)(`div`,{className:x.errorBlock,role:`alert`,children:[(0,h.jsx)(`strong`,{children:`Error:`}),` `,e.error]})]})})]})}function E({runs:e,loading:t,error:n}){let[r,i]=(0,d.useState)(null),a=e.slice(0,S);return t?(0,h.jsx)(`p`,{className:x.empty,children:`Loading runs…`}):n?(0,h.jsxs)(`p`,{className:x.empty,role:`alert`,children:[`Error: `,n]}):e.length===0?(0,h.jsxs)(`p`,{className:x.empty,children:[(0,h.jsx)(`span`,{className:x.emptyTitle,children:`No steward runs yet.`}),(0,h.jsx)(`span`,{className:x.emptySub,children:`Runs will appear here once the steward fires.`})]}):(0,h.jsxs)(`div`,{className:x.wrap,"aria-label":`Steward run history`,children:[(0,h.jsxs)(`div`,{className:x.tableHeader,children:[(0,h.jsx)(`span`,{className:x.chevronSpacer,"aria-hidden":`true`}),(0,h.jsx)(`span`,{children:`When`}),(0,h.jsx)(`span`,{children:`Duration`}),(0,h.jsx)(`span`,{children:`Projects`}),(0,h.jsx)(`span`,{children:`Fixes`}),(0,h.jsx)(`span`,{children:`Judgments`}),(0,h.jsx)(`span`,{children:`Status`})]}),a.map(e=>(0,h.jsx)(T,{run:e,isOpen:r===e.id,onToggle:()=>i(r===e.id?null:e.id)},e.id))]})}var D={wrap:`_wrap_1xug7_1`,empty:`_empty_1xug7_7`,emptyTitle:`_emptyTitle_1xug7_20`,emptySub:`_emptySub_1xug7_26`,row:`_row_1xug7_31`,project:`_project_1xug7_47`,projectName:`_projectName_1xug7_54`,projectMeta:`_projectMeta_1xug7_64`,metric:`_metric_1xug7_70`,metricLabel:`_metricLabel_1xug7_77`,sparkWrap:`_sparkWrap_1xug7_85`,spark:`_spark_1xug7_85`,sparkEmpty:`_sparkEmpty_1xug7_98`,sparkMeta:`_sparkMeta_1xug7_105`,sparkValue:`_sparkValue_1xug7_112`,sparkValueWarn:`_sparkValueWarn_1xug7_119`,sparkDelta:`_sparkDelta_1xug7_123`,sparkDeltaUp:`_sparkDeltaUp_1xug7_130`,sparkDeltaDown:`_sparkDeltaDown_1xug7_134`},O={structure:`Structure compliance`,freshness:`Freshness`};function k({points:e,metric:t}){if(e.length<2)return(0,h.jsx)(`div`,{className:D.sparkEmpty,children:`not enough data`});let n=e.map(e=>t===`structure`?e.structurePct:e.freshnessPct),r=Math.max(100,...n),i=Math.min(0,...n),a=Math.max(1,r-i),o=200/(e.length-1),s=n.map((e,t)=>{let n=t*o,r=36-(e-i)/a*36;return`${t===0?`M`:`L`} ${n.toFixed(1)} ${r.toFixed(1)}`}).join(` `),c=`${s} L 200 36 L 0 36 Z`,l=n[n.length-1],u=l-n[0],d=Math.round(u),f=l<90,p=d>0,m=d<0;return(0,h.jsxs)(`div`,{className:D.sparkWrap,children:[(0,h.jsxs)(`svg`,{className:D.spark,viewBox:`0 0 200 36`,preserveAspectRatio:`none`,role:`img`,"aria-label":`${O[t]}: ${l}% now (${d>=0?`+`:``}${d}% from ${e.length} runs ago)`,children:[(0,h.jsx)(`title`,{children:`${O[t]}: ${l}% (${d>=0?`+`:``}${d}%)`}),(0,h.jsx)(`path`,{d:c,fill:f?`var(--color-warning)`:`var(--color-positive)`,fillOpacity:`0.12`}),(0,h.jsx)(`path`,{d:s,fill:`none`,stroke:f?`var(--color-warning)`:`var(--color-positive)`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),(0,h.jsxs)(`div`,{className:D.sparkMeta,children:[(0,h.jsxs)(`span`,{className:`${D.sparkValue} ${f?D.sparkValueWarn:``}`,children:[l,`%`]}),Math.abs(d)>=1&&(0,h.jsxs)(`span`,{className:`${D.sparkDelta} ${p?D.sparkDeltaUp:``} ${m?D.sparkDeltaDown:``}`,"aria-hidden":`true`,children:[p?`▲`:`▼`,Math.abs(d)]})]})]})}function A({timeline:e,loading:t,error:n}){return t?(0,h.jsx)(`p`,{className:D.empty,children:`Loading trends…`}):n?(0,h.jsxs)(`p`,{className:D.empty,role:`alert`,children:[`Error: `,n]}):e.length===0?(0,h.jsxs)(`p`,{className:D.empty,children:[(0,h.jsx)(`span`,{className:D.emptyTitle,children:`No timeline data yet.`}),(0,h.jsx)(`span`,{className:D.emptySub,children:`Trends will appear here after a few steward runs.`})]}):(0,h.jsx)(`div`,{className:D.wrap,children:e.map(e=>(0,h.jsxs)(`div`,{className:D.row,children:[(0,h.jsxs)(`div`,{className:D.project,children:[(0,h.jsx)(`span`,{className:D.projectName,children:e.project}),(0,h.jsxs)(`span`,{className:D.projectMeta,children:[e.points.length,` point`,e.points.length===1?``:`s`]})]}),(0,h.jsxs)(`div`,{className:D.metric,children:[(0,h.jsx)(`div`,{className:D.metricLabel,children:`Structure compliance`}),(0,h.jsx)(k,{points:e.points,metric:`structure`})]}),(0,h.jsxs)(`div`,{className:D.metric,children:[(0,h.jsx)(`div`,{className:D.metricLabel,children:`Freshness`}),(0,h.jsx)(k,{points:e.points,metric:`freshness`})]})]},e.project))})}var j=t(r(),1),M={backdrop:`_backdrop_37dat_1`,fadeIn:`_fadeIn_37dat_1`,panel:`_panel_37dat_7`,slideUp:`_slideUp_37dat_1`,header:`_header_37dat_17`,close:`_close_37dat_18`,member:`_member_37dat_19`,synthBtn:`_synthBtn_37dat_20`};function N({cluster:e,project:t,onClose:n}){let r=(0,d.useRef)(null),[i,a]=(0,d.useState)(!1),[o,c]=(0,d.useState)(null);return(0,d.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n()};document.addEventListener(`keydown`,t);let i=document.getElementById(`root`);return i&&i.setAttribute(`inert`,``),r.current?.focus(),()=>{document.removeEventListener(`keydown`,t),i&&i.removeAttribute(`inert`)}},[e,n]),e?(0,j.createPortal)((0,h.jsx)(`div`,{className:M.backdrop,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`cluster-drill-title`,onClick:n,children:(0,h.jsxs)(`div`,{ref:r,className:M.panel,tabIndex:-1,onClick:e=>e.stopPropagation(),children:[(0,h.jsxs)(`div`,{className:M.header,children:[(0,h.jsxs)(`h2`,{id:`cluster-drill-title`,children:[`Cluster: `,e.topic,` (`,e.size,` files)`]}),(0,h.jsx)(s,{className:M.close,onClick:n,"aria-label":`Close`,children:`×`})]}),e.files.map(t=>(0,h.jsxs)(`div`,{className:M.member,children:[(0,h.jsx)(`strong`,{children:t}),(0,h.jsxs)(`p`,{children:[`Keywords: `,e.keywords.join(`, `)]})]},t)),(0,h.jsx)(s,{variant:`primary`,className:M.synthBtn,disabled:i,onClick:async()=>{a(!0),c(null);try{let n=await fetch(`/api/memory/hygiene/synthesize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project:t,clusterTopic:e.topic})});if(!n.ok)throw Error(`${n.status} ${n.statusText}`);c(`Proposal queued. Check the inbox.`)}catch(e){c(`Failed: ${e.message}`)}finally{a(!1)}},children:i?`Queueing…`:`Synthesize`}),o&&(0,h.jsx)(`p`,{role:`status`,children:o})]})}),document.body):null}function P(e=`claude-cron`,t){return c(`/api/memory/hygiene?${new URLSearchParams({project:e}).toString()}`,{refreshToken:t})}var F={card:`_card_u7jav_1`,header:`_header_u7jav_12`,headerLeft:`_headerLeft_u7jav_19`,title:`_title_u7jav_26`,generatedAt:`_generatedAt_u7jav_33`,refreshBtn:`_refreshBtn_u7jav_39`,loading:`_loading_u7jav_43`,error:`_error_u7jav_49`,metaRow:`_metaRow_u7jav_59`,metaChip:`_metaChip_u7jav_65`,metaChipLabel:`_metaChipLabel_u7jav_78`,metaChipValue:`_metaChipValue_u7jav_85`,metaWarn:`_metaWarn_u7jav_91`,gaugeGrid:`_gaugeGrid_u7jav_99`,gaugeItem:`_gaugeItem_u7jav_105`,gaugeLabel:`_gaugeLabel_u7jav_111`,gaugeValue:`_gaugeValue_u7jav_122`,gaugeTrack:`_gaugeTrack_u7jav_131`,gaugeFill:`_gaugeFill_u7jav_139`,issueList:`_issueList_u7jav_148`,issueRow:`_issueRow_u7jav_157`,issueKind:`_issueKind_u7jav_172`,issueFile:`_issueFile_u7jav_180`,issueAction:`_issueAction_u7jav_190`,issueDetail:`_issueDetail_u7jav_217`,allClear:`_allClear_u7jav_225`,clusters:`_clusters_u7jav_232`,clustersHeader:`_clustersHeader_u7jav_241`,clustersTitleRow:`_clustersTitleRow_u7jav_247`,clustersTitle:`_clustersTitle_u7jav_247`,clustersCount:`_clustersCount_u7jav_260`,clustersControls:`_clustersControls_u7jav_266`,clustersSearch:`_clustersSearch_u7jav_273`,minSizeControl:`_minSizeControl_u7jav_279`,minSizeLabel:`_minSizeLabel_u7jav_289`,minSizeSlider:`_minSizeSlider_u7jav_295`,minSizeValue:`_minSizeValue_u7jav_301`,emptyClusters:`_emptyClusters_u7jav_308`,clusterGrid:`_clusterGrid_u7jav_315`,clustersFadeIn:`_clustersFadeIn_u7jav_1`,showAllBtn:`_showAllBtn_u7jav_333`,showAllHint:`_showAllHint_u7jav_362`},I=24,L=3,R={orphan:`Orphan`,dangling:`Dangling pointer`,frontmatter:`Frontmatter`,structure:`Structure`,"undocumented-type":`Unknown type`,"stale-ref":`Stale ref`};function z({pct:e,warn:t}){let n={"--hc-gauge-fill":`${e}%`,"--hc-gauge-color":t?`var(--color-warning)`:`var(--color-positive)`};return(0,h.jsx)(`div`,{className:F.gaugeTrack,role:`progressbar`,"aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:(0,h.jsx)(`div`,{className:F.gaugeFill,style:n})})}function B({issue:e,onCopy:t,copied:n}){return(0,h.jsxs)(`div`,{className:F.issueRow,children:[(0,h.jsx)(`span`,{className:F.issueKind,children:R[e.kind]??e.kind}),(0,h.jsxs)(`span`,{className:F.issueFile,children:[e.file,e.line==null?``:`:${e.line}`]}),(0,h.jsx)(`span`,{className:F.issueDetail,children:e.detail}),(0,h.jsx)(`button`,{type:`button`,className:F.issueAction,onClick:()=>t(e.file),"aria-label":`Copy path ${e.file}`,children:n?`Copied`:`Copy path`})]})}function V({onClusterClick:e}={}){let[t,n]=(0,d.useState)(0),[r,i]=(0,d.useState)(``),[a,c]=(0,d.useState)(L),[f,p]=(0,d.useState)(!1),[m,g]=(0,d.useState)(null),_=(0,d.useRef)(null),v=(0,d.useRef)(!0),y=P(`claude-cron`,t);(0,d.useEffect)(()=>(v.current=!0,()=>{v.current=!1,_.current!==null&&window.clearTimeout(_.current)}),[]);let b=(0,d.useDeferredValue)(r),x=y.status===`ok`?y.data.clusters??[]:[],S=(0,d.useMemo)(()=>x.reduce((e,t)=>t.size>e?t.size:e,0),[x]),C=(0,d.useMemo)(()=>{let e=b.trim().toLowerCase();return x.filter(t=>t.size<a?!1:e?t.topic.toLowerCase().includes(e):!0)},[x,b,a]),w=(0,d.useMemo)(()=>f?C:C.slice(0,I),[C,f]),T=x.length,E=T-C.length,D=C.length-w.length,O=e=>{v.current&&(g(e),_.current!==null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{_.current=null,g(t=>t===e?null:t)},1500))},k=e=>{if(!navigator.clipboard){window.prompt(`Copy memory file path:`,e),O(e);return}let t;try{t=navigator.clipboard.writeText(e)}catch{window.prompt(`Copy memory file path:`,e),O(e);return}t.then(()=>O(e)).catch(t=>{v.current&&(console.warn(`[memory-health] clipboard.writeText failed; falling back to prompt`,t),window.prompt(`Copy memory file path:`,e),O(e))})};return(0,h.jsxs)(`section`,{className:F.card,"aria-label":`Memory hygiene`,children:[(0,h.jsxs)(`div`,{className:F.header,children:[(0,h.jsxs)(`div`,{className:F.headerLeft,children:[(0,h.jsx)(`h3`,{className:F.title,children:`Memory Health`}),y.status===`ok`&&(0,h.jsxs)(`span`,{className:F.generatedAt,children:[`Updated `,new Date(y.data.generatedAt).toLocaleTimeString()]})]}),(0,h.jsx)(s,{size:`sm`,className:F.refreshBtn,onClick:()=>n(e=>e+1),"aria-label":`Refresh memory health`,children:`Refresh`})]}),y.status===`loading`&&(0,h.jsx)(`p`,{className:F.loading,children:`Loading…`}),y.status===`error`&&(0,h.jsx)(`p`,{className:F.error,children:y.error}),y.status===`ok`&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:F.metaRow,children:[(0,h.jsxs)(`span`,{className:F.metaChip,children:[(0,h.jsx)(`span`,{className:F.metaChipLabel,children:`Memory files`}),(0,h.jsx)(`span`,{className:F.metaChipValue,children:y.data.totalFiles})]}),y.data.orphanCount>0&&(0,h.jsxs)(`span`,{className:`${F.metaChip} ${F.metaWarn}`,children:[(0,h.jsx)(`span`,{className:F.metaChipLabel,children:`Orphans`}),(0,h.jsx)(`span`,{className:F.metaChipValue,children:y.data.orphanCount})]}),y.data.danglingCount>0&&(0,h.jsxs)(`span`,{className:`${F.metaChip} ${F.metaWarn}`,children:[(0,h.jsx)(`span`,{className:F.metaChipLabel,children:`Dangling`}),(0,h.jsx)(`span`,{className:F.metaChipValue,children:y.data.danglingCount})]})]}),(0,h.jsxs)(`div`,{className:F.gaugeGrid,children:[(0,h.jsxs)(`div`,{className:F.gaugeItem,children:[(0,h.jsxs)(`div`,{className:F.gaugeLabel,children:[`Structure compliance`,(0,h.jsxs)(`span`,{className:F.gaugeValue,children:[y.data.structureCompliancePct,`%`]})]}),(0,h.jsx)(z,{pct:y.data.structureCompliancePct,warn:y.data.structureCompliancePct<90})]}),(0,h.jsxs)(`div`,{className:F.gaugeItem,children:[(0,h.jsxs)(`div`,{className:F.gaugeLabel,children:[`Freshness`,(0,h.jsxs)(`span`,{className:F.gaugeValue,children:[y.data.freshnessPct,`%`]})]}),(0,h.jsx)(z,{pct:y.data.freshnessPct,warn:y.data.freshnessPct<90})]})]}),y.data.issues.length>0?(0,h.jsx)(`div`,{className:F.issueList,children:y.data.issues.map((e,t)=>(0,h.jsx)(B,{issue:e,copied:m===e.file,onCopy:k},`${e.file}-${e.kind}-${t}`))}):(0,h.jsx)(`p`,{className:F.allClear,children:`No issues found.`}),T>0&&(0,h.jsxs)(`div`,{className:F.clusters,children:[(0,h.jsxs)(`div`,{className:F.clustersHeader,children:[(0,h.jsxs)(`div`,{className:F.clustersTitleRow,children:[(0,h.jsx)(`h4`,{className:F.clustersTitle,children:`Topic clusters`}),(0,h.jsx)(`span`,{className:F.clustersCount,children:C.length===T?`${T} topics`:`${C.length} of ${T}`})]}),(0,h.jsxs)(`div`,{className:F.clustersControls,children:[(0,h.jsx)(o,{type:`search`,placeholder:`Filter topics…`,value:r,onChange:e=>i(e.target.value),className:F.clustersSearch,"aria-label":`Filter topic clusters`}),(0,h.jsxs)(`label`,{className:F.minSizeControl,children:[(0,h.jsx)(`span`,{className:F.minSizeLabel,children:`Min size`}),(0,h.jsx)(`input`,{type:`range`,min:2,max:Math.max(S,2),value:a,onChange:e=>c(Number(e.target.value)),className:F.minSizeSlider,"aria-label":`Minimum cluster size`}),(0,h.jsxs)(`span`,{className:F.minSizeValue,children:[a,`+`]})]})]})]}),C.length===0?(0,h.jsx)(`p`,{className:F.emptyClusters,children:E===T&&r?`No topics match "${r}".`:`No topics meet the current filters.`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:F.clusterGrid,children:w.map(t=>(0,h.jsx)(u,{topic:t.topic,count:t.size,weight:l(t.size,S),onClick:()=>e?.(t),disabled:!e},t.topic))}),D>0&&!f&&(0,h.jsxs)(`button`,{type:`button`,className:F.showAllBtn,onClick:()=>p(!0),children:[`Show all `,C.length,` topics`,(0,h.jsxs)(`span`,{className:F.showAllHint,children:[`(+`,D,`)`]})]}),f&&C.length>I&&(0,h.jsxs)(`button`,{type:`button`,className:F.showAllBtn,onClick:()=>p(!1),children:[`Show top `,I]})]})]})]})]})}var H={root:`_root_c6kv5_1`,section:`_section_c6kv5_7`,sectionHead:`_sectionHead_c6kv5_14`,sectionTitle:`_sectionTitle_c6kv5_20`,sectionCount:`_sectionCount_c6kv5_31`,sectionDescription:`_sectionDescription_c6kv5_46`},U=50;function W({id:e,title:t,count:n,description:r}){return(0,h.jsxs)(`div`,{className:H.sectionHead,children:[(0,h.jsxs)(`h2`,{id:e,className:H.sectionTitle,children:[t,n!==void 0&&n>0&&(0,h.jsx)(`span`,{className:H.sectionCount,"aria-label":`${n} item${n===1?``:`s`}`,children:n})]}),r&&(0,h.jsx)(`p`,{className:H.sectionDescription,children:r})]})}function G(){let[e,t]=(0,d.useState)(null),{proposals:n,loading:r,error:i,approve:a,reject:o}=f({status:`pending`}),{runs:s,timeline:c,loading:l,error:u}=p(U);return(0,h.jsxs)(`div`,{className:H.root,children:[(0,h.jsx)(`section`,{className:H.section,children:(0,h.jsx)(V,{onClusterClick:t})}),(0,h.jsxs)(`section`,{className:H.section,"aria-labelledby":`proposals-heading`,children:[(0,h.jsx)(W,{id:`proposals-heading`,title:`Proposals Inbox`,count:n.length,description:`Synthesis, tombstone, and contradiction proposals queued by the steward. Approve to apply, reject with a reason to skip.`}),(0,h.jsx)(b,{proposals:n,loading:r,error:i,approve:a,reject:o})]}),(0,h.jsxs)(`section`,{className:H.section,"aria-labelledby":`runlog-heading`,children:[(0,h.jsx)(W,{id:`runlog-heading`,title:`Steward Run Log`,description:`Last 10 runs. Expand a row for per-project metrics.`}),(0,h.jsx)(E,{runs:s,loading:l,error:u})]}),(0,h.jsxs)(`section`,{className:H.section,"aria-labelledby":`trends-heading`,children:[(0,h.jsx)(W,{id:`trends-heading`,title:`Cross-Project Trends`,description:`Structure compliance and freshness over the last 50 runs, per project.`}),(0,h.jsx)(A,{timeline:c,loading:l,error:u})]}),(0,h.jsx)(N,{cluster:e,project:`claude-cron`,onClose:()=>t(null)})]})}export{G as MemoryHygiene};
|