@mrpatronz/nexusflow 2.20.1 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/gui/assets/AgentsPage-Dhd1ZqwZ.js +3 -0
  2. package/dist/gui/assets/DashboardPage-DuG3Nx62.js +1 -0
  3. package/dist/gui/assets/{DocumentPreview-Os281E1X.js → DocumentPreview-BlUlSRK0.js} +1 -1
  4. package/dist/gui/assets/{GettingStartedPage-bcbneczR.js → GettingStartedPage-C-2t-udq.js} +1 -1
  5. package/dist/gui/assets/{MonacoDiffAdapter-D1wWcPlt.js → MonacoDiffAdapter-C1gYxNl1.js} +1 -1
  6. package/dist/gui/assets/{ProjectsPage-CIEM54GU.js → ProjectsPage-Bll4qUCc.js} +1 -1
  7. package/dist/gui/assets/ScaffoldRepoInline-BYGKL4qv.js +1 -0
  8. package/dist/gui/assets/SettingsPage-DP1pJNJm.js +1 -0
  9. package/dist/gui/assets/SkillsPage-CLGLrRq3.js +7 -0
  10. package/dist/gui/assets/StartWorkPage-CcCPKOv8.js +1 -0
  11. package/dist/gui/assets/{StrategiesPage-UIiETHGq.js → StrategiesPage-nNBMOxvu.js} +2 -2
  12. package/dist/gui/assets/WorkroomsPage-CnH1E8mW.js +4 -0
  13. package/dist/gui/assets/{WorkspacesPage-2tYcZu28.js → WorkspacesPage-DblU6U2z.js} +11 -11
  14. package/dist/gui/assets/{alert-dialog-CdWem4Th.js → alert-dialog-DnwZtA87.js} +1 -1
  15. package/dist/gui/assets/index-BO8b3Dk2.css +2 -0
  16. package/dist/gui/assets/index-R0fvXNEi.js +75 -0
  17. package/dist/gui/assets/{queries-CtxmqmGJ.js → queries-F2H3SwGY.js} +2 -2
  18. package/dist/gui/assets/{tabs-7VC4aq4J.js → tabs-CIkN5ISA.js} +1 -1
  19. package/dist/gui/index.html +3 -3
  20. package/package.json +1 -1
  21. package/dist/gui/assets/AgentsPage-BKwrbZTW.js +0 -3
  22. package/dist/gui/assets/DashboardPage-B5DuTyhZ.js +0 -1
  23. package/dist/gui/assets/ScaffoldRepoInline-DoqywP_g.js +0 -1
  24. package/dist/gui/assets/SettingsPage-sCzTlpxr.js +0 -1
  25. package/dist/gui/assets/SkillsPage-CoMf5sLE.js +0 -7
  26. package/dist/gui/assets/StartWorkPage-CVnUwx7O.js +0 -1
  27. package/dist/gui/assets/WorkroomsPage-BTcKu4E8.js +0 -4
  28. package/dist/gui/assets/index-qvc4aLwP.js +0 -75
  29. package/dist/gui/assets/index-zHrkxd7h.css +0 -2
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{t as r}from"./input-LtE7Sz4D.js";import{h as i,t as a}from"./button-BrcP8Wxx.js";import{t as ee}from"./shield-check-FLrrAOFP.js";import{t as o}from"./trash-2-BrrLX4tD.js";import{i as s,n as te,r as c,t as ne}from"./tabs-CIkN5ISA.js";import{_ as re,l,n as ie,t as u,v as d,y as f}from"./brand-Bj6g9sFF.js";import{n as p,t as m}from"./client-CQ3EdyuW.js";import{$ as ae,$t as oe,A as h,Et as g,Ft as se,Kt as _,Lt as ce,M as v,N as y,P as b,Q as x,Qt as le,Ut as ue,X as S,Z as C,Zt as w,bt as de,et as fe,gt as pe,j as T,qt as me,wt as E,x as D,y as he,zt as O}from"./index-R0fvXNEi.js";import{t as k}from"./badge-DQIZRRDZ.js";import{a as A,i as j,n as M,r as N,t as P}from"./card-BMggHY3n.js";import{t as F}from"./label-C610MHwq.js";import{t as I}from"./textarea-0lXkxsuX.js";import{n as ge,r as _e,t as ve}from"./alert-CHAmIFAx.js";var ye=i(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),be=i(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),xe=i(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Se=i(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ce=i(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),we=i(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),L=i(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Te=i(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Ee=i(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),De=i(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),Oe=i(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),ke=i(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Ae=i(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),je=i(`user-check`,[[`path`,{d:`m16 11 2 2 4-4`,key:`9rsbq5`}],[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Me=i(`user-minus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),R=i(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),z=e(t(),1),B=n(),Ne=[{pattern:/plan|decision|context|document|handoff/i,label:`Shared context`,tool:`context`},{pattern:/resource|package|skill|agent/i,label:`Resource evidence`,tool:`resources`},{pattern:/workflow|step|completion|evidence/i,label:`Workflow evidence`,tool:`workflow`},{pattern:/member|join|participant|invite/i,label:`People`,tool:`members`},{pattern:/password|credential|security|certificate|tls/i,label:`Security record`,tool:`security`}],Pe=[{tool:`overview`,label:`Project & privacy`,icon:ee},{tool:`context`,label:`Shared context`,icon:ce},{tool:`resources`,label:`Resources`,icon:De},{tool:`workflow`,label:`Workflow`,icon:se},{tool:`members`,label:`People`,icon:pe},{tool:`activity`,label:`Full activity log`,icon:oe},{tool:`security`,label:`Security & export`,icon:L}];function Fe(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t)}function Ie(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function V(e){return e.role===`host`?`host`:e.role===`publisher`?`publisher`:`member`}function H(e){switch(e){case`in_progress`:return`In progress`;case`completion_proposed`:return`Review requested`;case`completed`:return`Complete`;case`skipped`:return`Skipped`;default:return`Pending`}}function Le({status:e}){return e===`completed`?(0,B.jsx)(me,{"aria-hidden":`true`,className:`text-success`,size:14}):e===`in_progress`?(0,B.jsx)(ye,{"aria-hidden":`true`,className:`text-primary`,size:14}):e===`completion_proposed`?(0,B.jsx)(xe,{"aria-hidden":`true`,className:`text-warning`,size:14}):(0,B.jsx)(ue,{"aria-hidden":`true`,className:`text-muted-foreground`,size:14})}function U({participant:e,emphasized:t=!1}){return(0,B.jsx)(`span`,{"aria-hidden":`true`,"data-role":e?.role??`system`,className:`grid shrink-0 place-items-center rounded-full border ${t?`size-9 border-primary/60 bg-primary/15 text-primary`:`size-8 border-border bg-muted text-muted-foreground`}`,children:(0,B.jsx)(R,{"aria-hidden":`true`,size:t?17:15})})}function Re({snapshot:e,roomUrl:t,isHost:n,me:r,busy:i,message:o,hasUnsavedHandoffDraft:s,headingRef:te,onCreateInvite:c,onRefresh:ne,onStopOrLeave:re,onOpenTool:l,onMessageChange:ie,onPostUpdate:u}){let d=(0,z.useMemo)(()=>e.participants.filter(e=>!e.revokedAt),[e.participants]),f=(0,z.useMemo)(()=>new Map(e.participants.map(e=>[e.id,e])),[e.participants]),p=e.workflowProgress,m=p?.steps.findIndex(e=>e.status===`completion_proposed`)??-1,h=p?.steps.findIndex(e=>e.status===`in_progress`)??-1,g=m>=0?m:h,v=p?.steps.findIndex(e=>e.status===`pending`)??-1,y=g>=0?p?.steps[g]:void 0,b=v>=0?p?.steps[v]:void 0,le=p?.package.steps.find(e=>e.id===y?.stepId),ue=p?.package.steps.find(e=>e.id===b?.stepId),pe=g>=0?p?.steps.slice(g+1).find(e=>e.status===`pending`):void 0,T=p?.package.steps.find(e=>e.id===pe?.stepId),me=y?f.get(y.updatedBy):void 0,D=!!(p?.steps.length&&p.steps.every(e=>e.status===`completed`||e.status===`skipped`)),he=e.activity.slice(-20);return(0,B.jsxs)(`section`,{"aria-labelledby":`handoff-stream-title`,className:`animate-fade-in`,"data-testid":`handoff-stream`,children:[(0,B.jsx)(`header`,{className:`border-b border-border pb-4`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4 xl:flex-row xl:items-center xl:justify-between`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 xl:flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(oe,{"aria-hidden":`true`,className:`text-muted-foreground`,size:17}),(0,B.jsx)(`h1`,{ref:te,id:`handoff-stream-title`,tabIndex:-1,className:`text-lg font-semibold tracking-tight outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Handoff Stream`}),(0,B.jsxs)(k,{variant:`success`,children:[(0,B.jsx)(`span`,{className:`mr-1 inline-block size-1.5 rounded-full bg-success`}),`Live`]})]}),(0,B.jsx)(`p`,{className:`mt-1 truncate text-sm text-muted-foreground`,children:e.bundle.feature.goal})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 sm:gap-3`,children:[(0,B.jsxs)(`div`,{"aria-label":`${d.length} participants`,className:`flex items-center gap-1`,children:[d.slice(0,4).map(e=>(0,B.jsxs)(`span`,{className:`flex items-center gap-2 rounded-md px-1 py-0.5`,title:`${e.displayName} · ${V(e)}`,children:[(0,B.jsx)(U,{participant:e,emphasized:e.id===r?.id}),(0,B.jsxs)(`span`,{className:`hidden max-w-24 leading-tight 2xl:block`,children:[(0,B.jsx)(`span`,{className:`block truncate text-xs font-semibold`,children:e.displayName}),(0,B.jsx)(`span`,{className:`block text-[10px] text-muted-foreground`,children:V(e)})]})]},e.id)),d.length>4&&(0,B.jsxs)(`span`,{className:`grid size-8 place-items-center rounded-full border border-border bg-muted text-[10px] font-semibold text-muted-foreground`,children:[`+`,d.length-4]})]}),n&&(0,B.jsxs)(a,{variant:`outline`,onClick:c,disabled:i!==null,children:[(0,B.jsx)(we,{"aria-hidden":`true`}),` Invite`,e.pendingJoins.length>0&&(0,B.jsx)(`span`,{className:`ml-0.5 rounded bg-warning/15 px-1 text-[10px] text-warning-foreground`,children:e.pendingJoins.length})]}),(0,B.jsxs)(S,{children:[(0,B.jsx)(fe,{"aria-label":`Open room tools`,className:`grid size-8 cursor-pointer place-items-center rounded-md border border-border bg-card text-muted-foreground shadow-2xs transition-colors hover:bg-accent hover:text-foreground`,children:(0,B.jsx)(O,{"aria-hidden":`true`,size:16})}),(0,B.jsxs)(x,{align:`end`,className:`w-56`,children:[Pe.map(({tool:t,label:n,icon:r})=>(0,B.jsxs)(C,{onClick:()=>l(t),children:[(0,B.jsx)(r,{"aria-hidden":`true`}),` `,n,t===`members`&&e.pendingJoins.length>0&&(0,B.jsx)(`span`,{className:`ml-auto text-[10px] text-warning-foreground`,children:e.pendingJoins.length})]},t)),(0,B.jsx)(ae,{}),(0,B.jsxs)(C,{onClick:ne,children:[(0,B.jsx)(E,{"aria-hidden":`true`}),` Refresh room`]}),(0,B.jsxs)(C,{variant:`destructive`,disabled:i!==null,onClick:()=>{let e=n?`stop hosting this Workroom`:`leave this Workroom`;window.confirm(`Are you sure you want to ${e}?`)&&re()},children:[(0,B.jsx)(de,{"aria-hidden":`true`}),` `,n?`Stop room`:`Leave room`]})]})]})]})]})}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-4 xl:grid-cols-[minmax(0,1fr)_17rem]`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-primary/35 bg-primary/10 px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-full border border-primary/50 bg-primary/12 text-primary`,children:(0,B.jsx)(se,{"aria-hidden":`true`,size:17})}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm font-semibold`,children:p?D?`Workflow complete`:y?.status===`completion_proposed`?`A review is ready`:y?`Work is moving`:`Workflow ready`:`No shared workflow yet`}),(0,B.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:D?`Every shared step has been completed.`:p&&y?`${me?.displayName||`A participant`} updated ${le?.title||y.stepId} · step ${g+1} of ${p.steps.length}${T?` · next: ${T.title}`:``}`:p&&b?`Next: ${ue?.title||b.stepId} · step ${v+1} of ${p.steps.length}`:p?`The shared workflow is ready to start.`:n?`Choose a reviewed workflow to make the next handoff explicit.`:`The host has not selected a shared workflow yet.`})]})]}),(p||n)&&(0,B.jsxs)(a,{size:`sm`,onClick:()=>l(`workflow`),children:[y?.status===`completion_proposed`?`Review proposal`:p?`Open workflow`:`Set workflow`,(0,B.jsx)(_,{"aria-hidden":`true`})]})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border border-border bg-card`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Room activity`}),(0,B.jsx)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:`Decisions, evidence, and handoffs shared with this room.`})]}),(0,B.jsxs)(a,{variant:`ghost`,size:`xs`,onClick:()=>l(`activity`),children:[`View log `,(0,B.jsx)(w,{"aria-hidden":`true`})]})]}),he.length>0?(0,B.jsx)(`ol`,{"aria-label":`Workroom activity`,className:`relative divide-y divide-border/70 before:absolute before:bottom-8 before:left-[2.05rem] before:top-8 before:w-px before:bg-border`,children:he.map(e=>{let t=f.get(e.actorId),n=Ne.find(({pattern:t})=>t.test(e.type));return(0,B.jsxs)(`li`,{className:`relative flex gap-3 px-4 py-4 sm:gap-4`,children:[(0,B.jsx)(`span`,{className:`relative z-10 rounded-full bg-card p-0.5`,children:(0,B.jsx)(U,{participant:t,emphasized:t?.id===r?.id})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,B.jsx)(`span`,{className:`min-w-0 break-words text-xs font-semibold [overflow-wrap:anywhere]`,children:t?.displayName||`Historical participant`}),t&&(0,B.jsx)(k,{variant:t.role===`host`?`info`:`secondary`,children:V(t)}),(0,B.jsx)(`time`,{className:`text-[10px] text-muted-foreground`,dateTime:e.createdAt,children:Fe(e.createdAt)})]}),(0,B.jsx)(`p`,{className:`mt-1.5 break-words text-sm font-medium text-foreground [overflow-wrap:anywhere]`,children:e.summary}),(0,B.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[e.type,` · event #`,e.sequence]}),n&&(0,B.jsxs)(`button`,{type:`button`,className:`mt-2 inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-border bg-muted/35 px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,onClick:()=>l(n.tool),children:[(0,B.jsx)(ce,{"aria-hidden":`true`,size:12}),` `,n.label]})]})]},e.sequence)})}):(0,B.jsxs)(`div`,{className:`px-4 py-10 text-center`,children:[(0,B.jsx)(oe,{"aria-hidden":`true`,className:`mx-auto text-muted-foreground`,size:20}),(0,B.jsx)(`p`,{className:`mt-2 text-sm font-medium`,children:`No shared activity yet`}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Post an update below to begin the handoff stream.`})]}),(0,B.jsxs)(`form`,{className:`border-t border-border p-3`,onSubmit:async e=>{e.preventDefault();let t=o.trim();!t||i!==null||s||await u(t)},children:[(0,B.jsx)(`label`,{className:`sr-only`,htmlFor:`handoff-stream-message`,children:`Share a handoff update`}),(0,B.jsx)(I,{id:`handoff-stream-message`,className:`min-h-20 resize-y border-0 bg-transparent px-1 py-1 shadow-none focus-visible:ring-0`,maxLength:4e3,placeholder:`Share a decision, result, blocker, or next step…`,value:o,onChange:e=>ie(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&e.currentTarget.form?.requestSubmit()}}),(0,B.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Only the text you enter is shared from this composer. No files, diffs, paths, credentials, or transcripts are collected automatically.`}),s&&(0,B.jsx)(`p`,{className:`text-[10px] text-warning-foreground`,children:`Resolve your unsaved Handoff draft in Shared context before posting another update.`})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2`,children:[s&&(0,B.jsx)(a,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>l(`context`),children:`Review draft`}),(0,B.jsxs)(a,{type:`submit`,size:`sm`,disabled:!o.trim()||i!==null||s,children:[(0,B.jsx)(Oe,{"aria-hidden":`true`}),` `,i===`stream-post`?`Posting…`:`Post update`]})]})]})]})]})]}),(0,B.jsxs)(`aside`,{"aria-label":`Workroom details`,className:`h-fit divide-y divide-border rounded-lg border border-border bg-card xl:sticky xl:top-4`,children:[(0,B.jsxs)(`section`,{className:`p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`h2`,{className:`text-xs font-semibold`,children:[`Steps `,p?`(${p.steps.length})`:``]}),(p||n)&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>l(`workflow`),className:`cursor-pointer text-muted-foreground hover:text-foreground`,"aria-label":`Open workflow tools`,children:(0,B.jsx)(ke,{"aria-hidden":`true`,size:14})})]}),p?(0,B.jsx)(`ol`,{className:`mt-3 space-y-1`,children:p.steps.map((e,t)=>{let n=p.package.steps.find(t=>t.id===e.stepId),r=f.get(e.updatedBy),i=H(e.status);return(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>l(`workflow`),className:`group flex w-full cursor-pointer items-start gap-2 rounded-md px-1 py-2 text-left hover:bg-accent/60`,children:[(0,B.jsx)(`span`,{className:`mt-0.5 grid size-5 shrink-0 place-items-center rounded-full border border-border bg-background text-[10px]`,children:t+1}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-xs ${e.status===`in_progress`||e.status===`completion_proposed`?`font-semibold text-foreground`:`text-muted-foreground`}`,children:n?.title||e.stepId}),(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground`,children:e.status===`pending`||!r?i:`${i} · updated by ${r.displayName}`})]}),(0,B.jsx)(`span`,{className:`mt-1`,children:(0,B.jsx)(Le,{status:e.status})})]})},e.stepId)})}):n?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>l(`workflow`),className:`mt-3 w-full cursor-pointer rounded-md border border-dashed border-border px-3 py-4 text-left hover:bg-accent/50`,children:[(0,B.jsx)(`span`,{className:`text-xs font-medium`,children:`Make turns explicit`}),(0,B.jsx)(`span`,{className:`mt-1 block text-[10px] text-muted-foreground`,children:`Select a shared workflow and require evidence for completion.`})]}):(0,B.jsxs)(`div`,{className:`mt-3 rounded-md border border-dashed border-border px-3 py-4`,children:[(0,B.jsx)(`span`,{className:`text-xs font-medium`,children:`Waiting for a workflow`}),(0,B.jsx)(`span`,{className:`mt-1 block text-[10px] text-muted-foreground`,children:`The host can select a shared workflow for this room.`})]})]}),(0,B.jsxs)(`section`,{className:`p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`h2`,{className:`text-xs font-semibold`,children:[`Participants (`,d.length,`)`]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>l(`members`),className:`cursor-pointer text-[10px] text-muted-foreground hover:text-foreground`,children:`Manage`})]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2.5`,children:d.slice(0,6).map(e=>(0,B.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(U,{participant:e,emphasized:e.id===r?.id}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.displayName}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:V(e)})]},e.id))})]}),(0,B.jsxs)(`section`,{className:`space-y-2.5 p-4`,children:[(0,B.jsx)(`h2`,{className:`text-xs font-semibold`,children:`Room details`}),(0,B.jsxs)(`dl`,{className:`space-y-2 text-[11px]`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,B.jsx)(`dt`,{className:`text-muted-foreground`,children:`Created by`}),(0,B.jsx)(`dd`,{className:`truncate text-right`,children:e.participants.find(e=>e.role===`host`)?.displayName||`Host`})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,B.jsx)(`dt`,{className:`text-muted-foreground`,children:`Created`}),(0,B.jsx)(`dd`,{className:`text-right`,children:Ie(e.createdAt)})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,B.jsx)(`dt`,{className:`text-muted-foreground`,children:`Workspace`}),(0,B.jsx)(`dd`,{className:`truncate text-right`,children:e.bundle.feature.id})]}),(0,B.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,B.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,B.jsxs)(`dd`,{className:`inline-flex items-center gap-1.5`,children:[`Live `,(0,B.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`})]})]})]}),(0,B.jsx)(`p`,{className:`truncate border-t border-border pt-2 font-mono text-[9px] text-muted-foreground`,title:t,children:t})]}),(0,B.jsx)(`section`,{className:`p-3`,children:(0,B.jsxs)(a,{variant:`ghost`,className:`w-full justify-start`,onClick:()=>l(`security`),children:[(0,B.jsx)(ee,{"aria-hidden":`true`}),` Security & encrypted export`]})})]})]})]})}var W={plan:`Plan`,decisions:`Decisions & knowledge`,handoff:`Handoff`},ze={overview:`Project & privacy`,context:`Shared context`,resources:`Resources`,workflow:`Workflow`,members:`People`,activity:`Full activity log`,security:`Security & encrypted export`};function Be(){let e=new Uint8Array(18);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,``).slice(0,24)}function Ve(e){return e instanceof Error?e.message:String(e)}function G(e){return e.mode===`host`||e.mode===`guest`?e.snapshot:void 0}function He(e,t){return e.mode===`host`||e.mode===`guest`?{...e,snapshot:t}:e}function Ue(e,t){let n=G(e),r=G(t);if(!n||!r||n.roomId!==r.roomId)return t;let i=r.revision>=n.revision?r:n,a={plan:r.documents.plan.revision>=n.documents.plan.revision?r.documents.plan:n.documents.plan,decisions:r.documents.decisions.revision>=n.documents.decisions.revision?r.documents.decisions:n.documents.decisions,handoff:r.documents.handoff.revision>=n.documents.handoff.revision?r.documents.handoff:n.documents.handoff};return He(t,{...i,documents:a})}function We(e,t,n){let r=G(e);return!r||r.roomId!==t||n.revision<r.documents.handoff.revision?e:He(e,{...r,documents:{...r.documents,handoff:n}})}async function Ge(e,t){let n=JSON.stringify({bundle:e,documents:{plan:t.plan,decisions:t.decisions,handoff:t.handoff}}),r=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(n));return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function Ke({workspaces:e,showToast:t}){let[n,i]=(0,z.useState)({mode:`idle`}),[ae,se]=(0,z.useState)([]),[_,ce]=(0,z.useState)(null),[x,ue]=(0,z.useState)(``),[S,C]=(0,z.useState)(null),[w,fe]=(0,z.useState)({plan:``,decisions:``,handoff:``}),[O,ye]=(0,z.useState)({plan:!1,decisions:!1,handoff:!1}),[xe,L]=(0,z.useState)(!1),[Oe,ke]=(0,z.useState)(``),[R,Ne]=(0,z.useState)(``),[Pe,Fe]=(0,z.useState)(`4242`),[Ie,V]=(0,z.useState)(``),[H,Le]=(0,z.useState)(()=>Be()),[U,G]=(0,z.useState)(``),[He,Ke]=(0,z.useState)(``),[qe,Je]=(0,z.useState)(``),[Ye,Xe]=(0,z.useState)(``),[Ze,Qe]=(0,z.useState)(``),[$e,et]=(0,z.useState)(``),[tt,nt]=(0,z.useState)({plan:``,decisions:``,handoff:``}),[K,rt]=(0,z.useState)({plan:!1,decisions:!1,handoff:!1}),[q,it]=(0,z.useState)([]),[at,ot]=(0,z.useState)(``),[st,ct]=(0,z.useState)(`0.1.0`),[lt,ut]=(0,z.useState)({}),[dt,ft]=(0,z.useState)(``),[pt,mt]=(0,z.useState)(`0.1.0`),[ht,gt]=(0,z.useState)(`Plan
2
+ Implement
3
+ Verify
4
+ Review`),[_t,vt]=(0,z.useState)({}),[yt,bt]=(0,z.useState)(()=>Be()),[J,xt]=(0,z.useState)(()=>Be()),[St,Ct]=(0,z.useState)(null),[wt,Tt]=(0,z.useState)(`stream`),[Et,Dt]=(0,z.useState)(``),[Ot,kt]=(0,z.useState)([]),[At,jt]=(0,z.useState)([]),Mt=(0,z.useRef)(null),Nt=(0,z.useRef)(null),Pt=(0,z.useRef)(null),Ft=(0,z.useRef)(!1),Y=n.mode===`host`||n.mode===`guest`?n.snapshot:void 0,X=n.mode===`host`,It=n.mode===`guest`&&n.status===`pending`,Lt=n.mode===`host`?Y?.participants.find(e=>e.role===`host`):n.mode===`guest`?Y?.participants.find(e=>e.id===n.memberId):void 0,Rt=Lt?.role===`host`||Lt?.role===`publisher`,zt=!!Y,Z=(0,z.useCallback)(async(e=!1)=>{try{let e=await p(`/api/workrooms/status`);i(t=>Ue(t,e.status))}catch(n){if(n instanceof m&&n.status===401)try{let e=await p(`/api/workrooms/session`);i(e.active&&e.locked&&e.roomType?{mode:`locked`,roomType:e.roomType}:{mode:`idle`});return}catch(n){e&&t(Ve(n),`error`);return}e&&t(Ve(n),`error`)}},[t]),Bt=(0,z.useCallback)(async()=>{let[e,t]=await Promise.all([p(`/api/workrooms/paused`),p(`/api/workrooms/quarantined`)]);kt(e.rooms),jt(t.rooms)},[]);(0,z.useEffect)(()=>{Promise.all([Z(),p(`/api/workrooms/interfaces`).then(e=>{se(e.interfaces),Ne(t=>t||e.interfaces.find(e=>!e.internal&&e.family===`IPv4`)?.address||e.interfaces[0]?.address||``)}),Bt()]);let e=window.setInterval(()=>void Z(),3e3);return()=>window.clearInterval(e)},[Z,Bt]),(0,z.useEffect)(()=>{if(!x){C(null);return}p(`/api/workrooms/preview/${encodeURIComponent(x)}`).then(({preview:e})=>{C(e),fe(e.documents),ye({plan:!1,decisions:!1,handoff:!1}),L(!1),ke(t=>t||`${e.bundle.feature.id} workroom`)}).catch(e=>t(Ve(e),`error`))},[x,t]),(0,z.useEffect)(()=>{Y&&nt(e=>({plan:K.plan?e.plan:Y.documents.plan.content,decisions:K.decisions?e.decisions:Y.documents.decisions.content,handoff:K.handoff?e.handoff:Y.documents.handoff.content}))},[Y,K]),(0,z.useEffect)(()=>{Y?.workflowProgress&&vt(e=>Object.fromEntries(Y.workflowProgress.steps.map(t=>[t.stepId,e[t.stepId]??t.evidence??``])))},[Y?.workflowProgress]),(0,z.useEffect)(()=>{zt&&p(`/api/workrooms/local-resources`).then(({resources:e})=>{it(e),ot(t=>t||(e[0]?`${e[0].kind}:${e[0].id}`:``)),ft(t=>t||e.find(e=>e.kind===`workflow`)?.id||``)}).catch(()=>{})},[zt]),(0,z.useEffect)(()=>{n.mode===`idle`&&(Dt(``),Tt(`stream`))},[n.mode]),(0,z.useEffect)(()=>{if(!zt){Ft.current=!1;return}if(!Ft.current){Ft.current=!0;return}let e=window.requestAnimationFrame(()=>{wt===`stream`?Nt.current?.focus():Pt.current?.focus()});return()=>window.cancelAnimationFrame(e)},[wt,zt]);let Q=async(e,n,r)=>{if(Mt.current!==null)return!1;Mt.current=e,ce(e);try{return await n(),await Z(),await Bt().catch(()=>{}),r&&t(r,`success`),!0}catch(e){return t(Ve(e),`error`,8e3),!1}finally{Mt.current=null,ce(null)}},Vt=()=>Q(`start`,async()=>{if(!S)throw Error(`Select and preview a workspace first.`);let e={plan:O.plan?w.plan:``,decisions:O.decisions?w.decisions:``,handoff:O.handoff?w.handoff:``},t=await p(`/api/workrooms/start`,{method:`POST`,body:JSON.stringify({workspaceId:x,name:Oe,address:R,port:Number(Pe),password:H,hostDisplayName:Ie,contextConfirmed:xe,contextDigest:await Ge(S.bundle,e),documents:e})});i(t.status)},`Workroom started.`),Ht=e=>Q(`resume-${e}`,async()=>{let t=await p(`/api/workrooms/${encodeURIComponent(e)}/resume`,{method:`POST`,body:JSON.stringify({password:H})});i(t.status)},`Workroom resumed with its existing identity and memberships.`),Ut=e=>{window.confirm(`Discard failed import ${e}? This removes only its quarantined local files so you can retry the original encrypted export.`)&&Q(`discard-${e}`,async()=>{await p(`/api/workrooms/quarantined/${encodeURIComponent(e)}/discard`,{method:`POST`,body:JSON.stringify({confirmRoomId:e})})},`Failed import discarded. You can retry the encrypted export.`)},Wt=()=>Q(`join`,async()=>{let e=await p(`/api/workrooms/join`,{method:`POST`,body:JSON.stringify({invite:qe,password:Ye,displayName:Ze,workspaceId:x||void 0})});i(e.status)},`Join request sent to the host.`),Gt=()=>Q(`poll`,async()=>{let e=await p(`/api/workrooms/join/poll`,{method:`POST`});i(e.status)}),Kt=()=>Q(`stop`,async()=>{await p(`/api/workrooms/stop`,{method:`POST`}),i({mode:`idle`}),Tt(`stream`),Dt(``),G(``)},X?`Workroom stopped.`:`Left the Workroom.`),qt=()=>Q(`invite`,async()=>{let e=await p(`/api/workrooms/invites`,{method:`POST`});G(e.invite),Ke(e.expiresAt),await he(e.invite)},`One-use invitation copied. Share the password separately.`),Jt=e=>Q(`doc-${e}`,async()=>{if(Y)try{await p(`/api/workrooms/documents/${e}`,{method:`PUT`,body:JSON.stringify({content:tt[e],expectedRevision:Y.documents[e].revision})}),rt(t=>({...t,[e]:!1}))}catch(e){throw e instanceof m&&e.status===409?(await Z(),Error(`Someone updated this document first. Your draft is preserved; compare it with the latest revision and save again.`,{cause:e})):e}},`${W[e]} shared.`),Yt=()=>Q(`publish-resource`,async()=>{let[e,t]=at.split(`:`);await p(`/api/workrooms/resources/publish`,{method:`POST`,body:JSON.stringify({kind:e,id:t,version:st})})},`Immutable resource version published.`),Xt=e=>Q(`download-${e}`,async()=>{let t=await p(`/api/workrooms/resources/${e}/download`,{method:`POST`});ut(n=>({...n,[e]:t.preview}))},`Resource downloaded to the local quarantine cache. Review it before applying.`),Zt=e=>Q(`apply-${e}`,async()=>{let t=lt[e];if(!t)throw Error(`Download and review this resource again before applying it.`);await p(`/api/workrooms/resources/${e}/apply`,{method:`POST`,body:JSON.stringify({approvedDigest:e,approvedLocalDigest:t.localDigest})})},`Resource applied to your local ${u} catalog.`),Qt=e=>Q(`quarantine-${e}`,async()=>{await p(`/api/workrooms/resources/${e}/quarantine`,{method:`POST`})},`Resource version quarantined and removed from future exports and downloads.`),$t=e=>{window.confirm(`Permanently purge quarantined resource ${e}? Its package bytes and catalog entry will be removed so the room quota can be reused.`)&&Q(`purge-${e}`,async()=>{await p(`/api/workrooms/resources/${e}/purge`,{method:`POST`,body:JSON.stringify({confirmDigest:e})})},`Quarantined resource permanently purged and its room quota released.`)},en=()=>Q(`select-workflow`,async()=>{let e=q.find(e=>e.kind===`workflow`&&e.id===dt);if(!e)throw Error(`Select a local workflow.`);let t=ht.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map((e,t)=>({id:`${t+1}-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`step`}`,title:e,requiresEvidence:!0}));await p(`/api/workrooms/workflow/select`,{method:`POST`,body:JSON.stringify({workflowId:e.id,version:pt,steps:t,expectedRevision:Y?.workflowProgress?.revision??0})})},`Shared workflow selected.`),$=(e,t)=>Q(`step-${e.stepId}`,async()=>{let n=Y?.workflowProgress?.package.steps.find(t=>t.id===e.stepId),r=(_t[e.stepId]??e.evidence??``).trim();if(t===`completed`&&n?.requiresEvidence&&!r)throw Error(`Add evidence before completing this workflow step.`);await p(`/api/workrooms/workflow/steps/${encodeURIComponent(e.stepId)}/transition`,{method:`POST`,body:JSON.stringify({status:t,expectedRevision:e.revision,...t===`completed`&&r?{evidence:r}:{}})})}),tn=async e=>{let t=e.trim(),n=await Q(`stream-post`,async()=>{if(!Y)throw Error(`The Workroom snapshot is not available.`);if(K.handoff)throw Error(`Resolve the unsaved Handoff draft in Shared context before posting another update.`);let e=Y.documents.handoff.content.trimEnd(),n=e?`${e}\n\n${t}\n`:`${t}\n`;try{let e=await p(`/api/workrooms/documents/handoff`,{method:`PUT`,body:JSON.stringify({content:n,expectedRevision:Y.documents.handoff.revision})});i(t=>We(t,Y.roomId,e.document))}catch(e){throw e instanceof m&&e.status===409?(await Z(),Error(`Someone updated the handoff first. Your update is preserved; review the latest shared context and post again.`,{cause:e})):e}},`Handoff update shared.`);return n&&Dt(e=>e.trim()===t?``:e),n},nn=()=>Q(`export`,async()=>{let e=await p(`/api/workrooms/export`,{method:`POST`,body:JSON.stringify({passphrase:J})}),t=new Blob([JSON.stringify(e.export,null,2)],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`${Y?.roomId??`${ie}-workroom`}${f}`,n.click(),URL.revokeObjectURL(n.href)},`Encrypted Workroom export created.`),rn=()=>Q(`import`,async()=>{if(!St)throw Error(`Choose a ${f} or ${d} export first.`);let e=await p(`/api/workrooms/import`,{method:`POST`,body:JSON.stringify({export:St,exportPassphrase:J,name:Oe||void 0,address:R,port:Number(Pe),password:H,hostDisplayName:Ie})});i(e.status)},`Encrypted export imported as a new Workroom with new credentials.`);if(n.mode===`locked`)return(0,B.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col gap-5 py-16 text-center`,children:[(0,B.jsx)(`div`,{className:`mx-auto grid size-14 place-items-center rounded-full bg-amber-500/10 text-amber-700`,children:(0,B.jsx)(Ce,{})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Active Workroom is locked`}),(0,B.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`This browser lost its local human-session cookie. `,n.roomType===`host`?`Enter the room password to regain host dashboard controls.`:`For safety, leave this local guest connection and join again with the invitation and room password.`]})]}),n.roomType===`host`?(0,B.jsxs)(`div`,{className:`mx-auto flex w-full max-w-sm flex-col gap-3`,children:[(0,B.jsx)(F,{htmlFor:`workroom-recovery-password`,children:`Room password`}),(0,B.jsx)(r,{id:`workroom-recovery-password`,type:`password`,value:$e,onChange:e=>et(e.target.value)}),(0,B.jsxs)(a,{onClick:()=>Q(`reclaim`,async()=>{await p(`/api/workrooms/session/reclaim`,{method:`POST`,body:JSON.stringify({password:$e})}),et(``)},`Local Workroom dashboard reconnected.`),disabled:_!==null||!$e,children:[_===`reclaim`?(0,B.jsx)(D,{}):(0,B.jsx)(Ce,{}),` Unlock host dashboard`]})]}):(0,B.jsx)(`div`,{children:(0,B.jsxs)(a,{variant:`destructive-outline`,onClick:()=>Q(`abandon-locked-guest`,async()=>{await p(`/api/workrooms/session/abandon`,{method:`POST`,body:JSON.stringify({confirm:!0})}),i({mode:`idle`})},`Locked guest connection left. Join the Workroom again.`),disabled:_!==null,children:[_===`abandon-locked-guest`?(0,B.jsx)(D,{}):(0,B.jsx)(Te,{}),` Leave and rejoin`]})})]});if(n.mode===`idle`)return(0,B.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in space-y-6`,children:[(0,B.jsxs)(`header`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(pe,{className:`text-primary`,size:20}),(0,B.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Workrooms`}),(0,B.jsx)(k,{variant:`info`,children:`Experimental`})]}),(0,B.jsxs)(`p`,{className:`mt-1 max-w-3xl text-sm text-muted-foreground`,children:[`Share only the project context and reusable agent resources you explicitly review over a private LAN or VPN. `,u,` never adds code, diffs, credentials, terminals, or AI sessions automatically.`]})]}),(0,B.jsxs)(ve,{variant:`info`,children:[(0,B.jsx)(ee,{}),(0,B.jsx)(_e,{children:`No listener runs by default`}),(0,B.jsxs)(ge,{children:[`A Workroom binds only to the network address you select and stops with `,u,`.`]})]}),Ot.length>0&&(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsx)(A,{children:`Paused Workrooms`}),(0,B.jsx)(M,{children:`Enter the room password in the host form below, then resume on the same saved address and port. The password unlocks human authority; agent credentials remain read-and-propose-only.`})]}),(0,B.jsx)(j,{className:`grid gap-2 sm:grid-cols-2`,children:Ot.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border p-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,B.jsxs)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground`,children:[e.address,`:`,e.port,` · `,e.workspaceId]})]}),(0,B.jsxs)(a,{size:`sm`,variant:`outline`,onClick:()=>Ht(e.roomId),disabled:_!==null||H.length<12,children:[_===`resume-${e.roomId}`?(0,B.jsx)(D,{}):(0,B.jsx)(g,{}),` Resume`]})]},e.roomId))})]}),At.length>0&&(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsx)(A,{children:`Failed imports`}),(0,B.jsx)(M,{children:`These rooms never completed import and cannot be resumed. Inspect the identity below, discard its quarantined local files, then retry the original encrypted export.`})]}),(0,B.jsx)(j,{className:`grid gap-2 sm:grid-cols-2`,children:At.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-amber-500/40 p-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:e.name||e.roomId}),(0,B.jsxs)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground`,children:[e.status===`failed`?`Import failed`:`Import interrupted`,e.workspaceId?` · ${e.workspaceId}`:``]})]}),(0,B.jsxs)(a,{size:`sm`,variant:`destructive-outline`,onClick:()=>Ut(e.roomId),disabled:_!==null,children:[_===`discard-${e.roomId}`?(0,B.jsx)(D,{}):(0,B.jsx)(o,{}),` Discard`]})]},e.roomId))})]}),(0,B.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsxs)(A,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Ee,{size:15}),` Start a Workroom`]}),(0,B.jsx)(M,{children:`Host collaboration from this computer. Your existing dashboard remains localhost-only.`})]}),(0,B.jsxs)(j,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Workspace`}),(0,B.jsxs)(h,{value:x,onValueChange:e=>typeof e==`string`&&ue(e),children:[(0,B.jsx)(y,{children:(0,B.jsx)(b,{children:e.find(e=>e.branchName===x)?.branchName||`Select a workspace`})}),(0,B.jsx)(v,{children:e.map(e=>(0,B.jsx)(T,{value:e.branchName,children:e.branchName},e.id))})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Room name`}),(0,B.jsx)(r,{value:Oe,onChange:e=>ke(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Your display name`}),(0,B.jsx)(r,{value:Ie,onChange:e=>V(e.target.value),placeholder:`Defaults to OS user`})]})]}),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[1fr_100px]`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Network interface`}),(0,B.jsxs)(h,{value:R,onValueChange:e=>typeof e==`string`&&Ne(e),children:[(0,B.jsx)(y,{children:(0,B.jsx)(b,{children:R||`Select an address`})}),(0,B.jsx)(v,{children:ae.map(e=>(0,B.jsxs)(T,{value:e.address,children:[e.name,` · `,e.address,e.internal?` (local only)`:``]},`${e.name}-${e.address}`))})]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Port`}),(0,B.jsx)(r,{type:`number`,value:Pe,onChange:e=>Fe(e.target.value)})]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(F,{children:`Room password`}),(0,B.jsx)(a,{size:`xs`,variant:`ghost`,onClick:()=>Le(Be()),children:`Generate`})]}),(0,B.jsx)(r,{type:`password`,value:H,onChange:e=>Le(e.target.value)}),(0,B.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Share this separately from the invitation. Minimum 12 characters.`})]}),S&&(0,B.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-muted/30 p-3 text-xs`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`font-semibold text-foreground`,children:`Exact sharing review`}),(0,B.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Repository identities below are always included. Local context files are excluded until you explicitly include each one.`})]}),S.bundleWarnings.map(e=>(0,B.jsxs)(`p`,{className:`text-amber-700 dark:text-amber-300`,children:[`Bundle warning: `,e]},e)),(0,B.jsx)(`div`,{className:`space-y-1 font-mono text-[10px] text-muted-foreground`,children:S.bundle.repos.map(e=>(0,B.jsxs)(`div`,{className:`break-all`,children:[e.name,`: `,e.remoteUrl]},e.id))}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{className:`cursor-pointer font-semibold text-foreground`,children:`Complete shared feature metadata`}),(0,B.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 font-mono text-[10px]`,children:JSON.stringify(S.bundle,null,2)})]}),Object.keys(W).map(e=>(0,B.jsxs)(`div`,{className:`space-y-1.5 rounded border border-border bg-background p-2`,children:[(0,B.jsxs)(`label`,{className:`flex items-center gap-2 font-semibold text-foreground`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:O[e],onChange:t=>{ye(n=>({...n,[e]:t.target.checked})),L(!1)}}),` Include `,W[e]]}),S.warnings[e].map(e=>(0,B.jsxs)(`p`,{className:`text-amber-700 dark:text-amber-300`,children:[`Warning: `,e]},e)),(0,B.jsx)(I,{"aria-label":`${W[e]} exact outbound content`,className:`min-h-28 font-mono text-[10px]`,value:w[e],onChange:t=>{fe(n=>({...n,[e]:t.target.value})),L(!1)}}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:O[e]?`${w[e].length.toLocaleString()} characters will be shared.`:`Excluded from the Workroom.`})]},e)),(0,B.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background p-2 text-[11px]`,children:[(0,B.jsx)(`input`,{className:`mt-0.5`,type:`checkbox`,checked:xe,onChange:e=>L(e.target.checked)}),(0,B.jsx)(`span`,{children:`I reviewed the exact included text and repository identities, including any credential, path, diff, or transcript warnings.`})]})]}),(0,B.jsxs)(a,{className:`w-full`,onClick:Vt,disabled:!S||!xe||!R||H.length<12||_!==null,children:[_===`start`?(0,B.jsx)(D,{}):(0,B.jsx)(g,{}),` Start private Workroom`]})]})]}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsxs)(A,{className:`flex items-center gap-2`,children:[(0,B.jsx)(we,{size:15}),` Join a Workroom`]}),(0,B.jsx)(M,{children:`Paste the invitation and enter the separately shared password. The host must approve this device.`})]}),(0,B.jsxs)(j,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Invitation`}),(0,B.jsx)(I,{className:`min-h-24 font-mono text-xs`,value:qe,onChange:e=>Je(e.target.value),placeholder:`${re}//workroom/join?...`})]}),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Password`}),(0,B.jsx)(r,{type:`password`,value:Ye,onChange:e=>Xe(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Your display name`}),(0,B.jsx)(r,{value:Ze,onChange:e=>Qe(e.target.value)})]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Local workspace mapping`}),(0,B.jsxs)(h,{value:x,onValueChange:e=>typeof e==`string`&&ue(e),children:[(0,B.jsx)(y,{children:(0,B.jsx)(b,{children:e.find(e=>e.branchName===x)?.branchName||`Select your checkout (recommended)`})}),(0,B.jsx)(v,{children:e.map(e=>(0,B.jsx)(T,{value:e.branchName,children:e.branchName},e.id))})]}),(0,B.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Used for local agent proposals and handoff snapshots; code remains in this checkout.`})]}),(0,B.jsxs)(a,{className:`w-full`,onClick:Wt,disabled:!qe||!Ye||_!==null,children:[_===`join`?(0,B.jsx)(D,{}):(0,B.jsx)(je,{}),` Request to join`]})]})]}),(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsxs)(A,{className:`flex items-center gap-2`,children:[(0,B.jsx)(Ae,{size:15}),` Import an encrypted room`]}),(0,B.jsx)(M,{children:`Creates a new room identity, certificate, password, and membership set.`})]}),(0,B.jsxs)(j,{className:`space-y-3`,children:[(0,B.jsx)(r,{type:`file`,accept:`.json,${f},${d}`,onChange:e=>{let n=e.target.files?.[0];if(n){if(n.size>157286400){t(`Workroom export files are limited to 150 MiB.`,`error`);return}n.text().then(e=>Ct(JSON.parse(e))).catch(()=>t(`Invalid Workroom export file.`,`error`))}}}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Export passphrase`}),(0,B.jsx)(r,{type:`password`,value:J,onChange:e=>xt(e.target.value)})]}),(0,B.jsxs)(a,{variant:`outline`,className:`w-full`,onClick:rn,disabled:!St||!R||H.length<12||_!==null,children:[_===`import`?(0,B.jsx)(D,{}):(0,B.jsx)(Ae,{}),` Import and host`]})]})]})]})]})]});if(It||n.mode===`guest`&&n.status===`rejected`)return(0,B.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col gap-5 py-16 text-center`,children:[(0,B.jsx)(`div`,{className:`mx-auto grid size-14 place-items-center rounded-full bg-primary/10 text-primary`,children:It?(0,B.jsx)(E,{className:`animate-spin`}):(0,B.jsx)(Me,{})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold`,children:It?`Waiting for host approval`:`Join request rejected`}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:It?`Your device credential is ready, but no room context is available until the host accepts you.`:`Ask the host for a new one-use invitation if this was unexpected.`})]}),(0,B.jsxs)(`div`,{className:`flex justify-center gap-2`,children:[It&&(0,B.jsxs)(a,{onClick:Gt,disabled:_!==null,children:[_===`poll`?(0,B.jsx)(D,{}):(0,B.jsx)(E,{}),` Check approval`]}),(0,B.jsx)(a,{variant:`outline`,onClick:Kt,children:`Cancel`})]})]});if(n.mode===`guest`&&n.status===`accepted`&&!Y){let e=n.connection===`revoked`;return(0,B.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col gap-5 py-16 text-center`,children:[(0,B.jsx)(`div`,{className:`mx-auto grid size-14 place-items-center rounded-full bg-amber-500/10 text-amber-700`,children:e?(0,B.jsx)(Me,{}):(0,B.jsx)(Ee,{})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-xl font-semibold`,children:e?`Workroom access was revoked`:`Workroom connection is unavailable`}),(0,B.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e?`Leave this local connection, then ask the host for a new one-use invitation if you should rejoin.`:`The host or VPN may be offline. You can retry without losing the local connection, or leave immediately.`})]}),(0,B.jsxs)(`div`,{className:`flex justify-center gap-2`,children:[!e&&(0,B.jsxs)(a,{onClick:()=>Z(!0),disabled:_!==null,children:[(0,B.jsx)(E,{}),` Retry connection`]}),(0,B.jsxs)(a,{variant:`outline`,onClick:Kt,disabled:_!==null,children:[_===`stop`?(0,B.jsx)(D,{}):(0,B.jsx)(de,{}),` Leave local connection`]})]})]})}return Y?(0,B.jsxs)(`div`,{className:`mx-auto max-w-[1500px] animate-fade-in space-y-4`,children:[wt!==`stream`&&(0,B.jsxs)(`header`,{className:`flex flex-col gap-3 border-b border-border pb-4 sm:flex-row sm:items-center`,children:[(0,B.jsxs)(a,{ref:Pt,variant:`ghost`,onClick:()=>Tt(`stream`),children:[(0,B.jsx)(le,{}),` Back to Handoff Stream`]}),(0,B.jsxs)(`div`,{className:`min-w-0 sm:border-l sm:border-border sm:pl-4`,children:[(0,B.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:Y.name}),(0,B.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:ze[wt]})]})]}),U&&(0,B.jsxs)(ve,{variant:`success`,children:[(0,B.jsx)(Ce,{}),(0,B.jsx)(_e,{children:`One-use invitation ready`}),(0,B.jsxs)(ge,{children:[(0,B.jsx)(`span`,{className:`break-all font-mono text-[10px]`,children:U}),(0,B.jsxs)(`span`,{children:[`Expires `,new Date(He).toLocaleString(),`. Share the password separately.`]})]}),(0,B.jsxs)(a,{size:`sm`,variant:`outline`,onClick:()=>void he(U),children:[(0,B.jsx)(be,{}),` Copy`]})]}),(0,B.jsxs)(ne,{value:wt,onValueChange:e=>Tt(e),children:[(0,B.jsxs)(te,{className:`hidden`,children:[(0,B.jsx)(s,{value:`stream`,children:`Handoff Stream`}),Object.keys(ze).map(e=>(0,B.jsx)(s,{value:e,children:ze[e]},e))]}),(0,B.jsx)(c,{value:`stream`,className:`mt-0`,children:(0,B.jsx)(Re,{snapshot:Y,roomUrl:n.url,isHost:X,me:Lt,busy:_,message:Et,hasUnsavedHandoffDraft:K.handoff,headingRef:Nt,onCreateInvite:qt,onRefresh:()=>Z(!0),onStopOrLeave:Kt,onOpenTool:Tt,onMessageChange:Dt,onPostUpdate:tn})}),(0,B.jsxs)(c,{value:`overview`,className:`space-y-5`,children:[(0,B.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,B.jsx)(P,{children:(0,B.jsxs)(N,{children:[(0,B.jsx)(M,{children:`Members`}),(0,B.jsx)(A,{className:`text-2xl`,children:Y.participants.filter(e=>!e.revokedAt).length})]})}),(0,B.jsx)(P,{children:(0,B.jsxs)(N,{children:[(0,B.jsx)(M,{children:`Shared resources`}),(0,B.jsx)(A,{className:`text-2xl`,children:Y.resources.filter(e=>!e.quarantinedAt).length})]})}),(0,B.jsx)(P,{children:(0,B.jsxs)(N,{children:[(0,B.jsx)(M,{children:`Repository identities`}),(0,B.jsx)(A,{className:`text-2xl`,children:Y.bundle.repos.length})]})})]}),(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsx)(A,{children:Y.bundle.feature.goal}),(0,B.jsxs)(M,{children:[Y.bundle.project.name,` · portable feature `,Y.bundle.feature.id]})]}),(0,B.jsx)(j,{className:`space-y-2`,children:Y.bundle.repos.map(e=>(0,B.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium`,children:e.name}),(0,B.jsx)(k,{variant:`secondary`,children:e.defaultBranch})]}),(0,B.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:e.remoteUrl}),e.handoff&&(0,B.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.handoff.branch,` @ `,e.handoff.commit.slice(0,12),` · `,e.handoff.dirty?`dirty`:`clean`,` · ↑`,e.handoff.ahead,` ↓`,e.handoff.behind]})]},e.id))})]}),(0,B.jsxs)(ve,{variant:`info`,children:[(0,B.jsx)(ee,{}),(0,B.jsx)(_e,{children:`Never collected automatically`}),(0,B.jsxs)(ge,{children:[u,` does not add source archives, filenames, diffs, local paths, credentials, terminals, editor state, or AI transcripts. A developer can still include sensitive text in a reviewed shared document.`]})]})]}),(0,B.jsx)(c,{value:`context`,className:`space-y-4`,children:Object.keys(W).map(e=>(0,B.jsxs)(P,{children:[(0,B.jsx)(N,{children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(A,{children:W[e]}),(0,B.jsxs)(M,{children:[`Revision `,Y.documents[e].revision,` · updated `,new Date(Y.documents[e].updatedAt).toLocaleString()]})]}),K[e]&&(0,B.jsx)(k,{variant:`warning`,children:`Local draft`})]})}),(0,B.jsxs)(j,{className:`space-y-3`,children:[(0,B.jsx)(I,{className:`min-h-64 font-mono text-xs`,value:tt[e],disabled:_!==null,onChange:t=>{nt(n=>({...n,[e]:t.target.value})),rt(t=>({...t,[e]:!0}))}}),(0,B.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[e===`handoff`&&(0,B.jsxs)(a,{variant:`outline`,onClick:()=>Q(`handoff`,()=>p(`/api/workrooms/handoff`,{method:`POST`,body:JSON.stringify({workspaceId:n.localWorkspaceId})}).then(()=>void 0),`Git metadata handoff published.`),disabled:!n.localWorkspaceId||_!==null,children:[(0,B.jsx)(E,{}),` Publish Git snapshot`]}),(0,B.jsxs)(a,{onClick:()=>Jt(e),disabled:!K[e]||_!==null,children:[_===`doc-${e}`?(0,B.jsx)(D,{}):(0,B.jsx)(Ae,{}),` Share revision`]})]})]})]},e))}),(0,B.jsxs)(c,{value:`resources`,className:`space-y-4`,children:[Rt&&(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsx)(A,{children:`Publish a local resource`}),(0,B.jsx)(M,{children:`Published versions are immutable. Connected developers are notified and choose whether to download and apply them.`})]}),(0,B.jsxs)(j,{className:`flex flex-col gap-3 sm:flex-row sm:items-end`,children:[(0,B.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,B.jsx)(F,{children:`Resource`}),(0,B.jsxs)(h,{value:at,onValueChange:e=>typeof e==`string`&&ot(e),children:[(0,B.jsx)(y,{children:(0,B.jsx)(b,{children:q.find(e=>`${e.kind}:${e.id}`===at)?.name||`Select resource`})}),(0,B.jsx)(v,{children:q.map(e=>(0,B.jsxs)(T,{value:`${e.kind}:${e.id}`,children:[e.kind,` · `,e.name]},`${e.kind}:${e.id}`))})]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Version`}),(0,B.jsx)(r,{className:`w-32 font-mono`,value:st,onChange:e=>ct(e.target.value)})]}),(0,B.jsxs)(a,{onClick:Yt,disabled:!at||_!==null,children:[(0,B.jsx)(Ae,{}),` Publish`]})]})]}),(0,B.jsx)(`div`,{className:`grid gap-3`,children:Y.resources.length===0?(0,B.jsx)(P,{className:`p-8 text-center text-sm text-muted-foreground`,children:`No resources have been published.`}):Y.resources.map(e=>{let t=lt[e.digest],n=[e.compatibility?.platforms?.length?`platforms: ${e.compatibility.platforms.join(`, `)}`:void 0,e.compatibility?.contextspace?`${u} ${e.compatibility.contextspace}`:e.compatibility?.nexusflow?`${l} ${e.compatibility.nexusflow}`:void 0].filter(Boolean).join(` · `);return(0,B.jsx)(P,{className:e.quarantinedAt?`opacity-60`:``,children:(0,B.jsxs)(j,{className:`space-y-3 p-4`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(k,{variant:`secondary`,children:e.kind}),(0,B.jsxs)(`span`,{className:`text-sm font-semibold`,children:[e.id,`@`,e.version]}),e.quarantinedAt&&(0,B.jsx)(k,{variant:`error`,children:`Quarantined`})]}),(0,B.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`SHA-256 `,e.digest]}),n&&(0,B.jsxs)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[`Compatibility · `,n]})]}),e.quarantinedAt?X&&(0,B.jsxs)(a,{variant:`destructive-outline`,onClick:()=>$t(e.digest),disabled:_!==null,children:[_===`purge-${e.digest}`?(0,B.jsx)(D,{}):(0,B.jsx)(o,{}),` Purge permanently`]}):(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t?(0,B.jsxs)(a,{onClick:()=>Zt(e.digest),disabled:_!==null,children:[(0,B.jsx)(De,{}),` Approve exact digest & apply`]}):(0,B.jsxs)(a,{variant:`outline`,onClick:()=>Xt(e.digest),disabled:_!==null,children:[(0,B.jsx)(Se,{}),` Download for review`]}),X&&(0,B.jsx)(a,{variant:`ghost`,onClick:()=>Qt(e.digest),disabled:_!==null,children:`Quarantine`})]})]}),t&&(0,B.jsxs)(`div`,{className:`space-y-3 rounded border border-border bg-muted/30 p-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`p`,{className:`text-xs font-semibold`,children:[`Exact package review · `,t.action===`update`?`updates an existing local resource`:`creates a new local resource`]}),(0,B.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Applying installs the incoming definition shown below and is bound to SHA-256 `,e.digest,`.`]})]}),t.existingDefinition&&(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-xs font-semibold`,children:`Current local definition`}),(0,B.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-[10px]`,children:t.existingDefinition})]}),(0,B.jsxs)(`details`,{open:!0,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-xs font-semibold`,children:`Incoming applied definition`}),(0,B.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-[10px]`,children:t.incomingDefinition})]}),(0,B.jsx)(`div`,{className:`space-y-2`,children:t.files.map(e=>(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-mono text-[10px]`,children:[e.path,` · `,e.bytes.toLocaleString(),` bytes · `,e.encoding,e.executable?` · executable`:``]}),(0,B.jsx)(`pre`,{className:`mt-1 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-[10px]`,children:e.content})]},e.path))})]})]})},e.digest)})})]}),(0,B.jsxs)(c,{value:`workflow`,className:`space-y-4`,children:[X&&!Y.workflowProgress&&(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsx)(A,{children:`Start shared workflow tracking`}),(0,B.jsx)(M,{children:`Convert a local strategy into explicit ordered steps. Agents may propose completion; a developer confirms it.`})]}),(0,B.jsxs)(j,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[1fr_130px]`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Workflow`}),(0,B.jsxs)(h,{value:dt,onValueChange:e=>typeof e==`string`&&ft(e),children:[(0,B.jsx)(y,{children:(0,B.jsx)(b,{children:q.find(e=>e.id===dt&&e.kind===`workflow`)?.name||`Select workflow`})}),(0,B.jsx)(v,{children:q.filter(e=>e.kind===`workflow`).map(e=>(0,B.jsx)(T,{value:e.id,children:e.name},e.id))})]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Version`}),(0,B.jsx)(r,{value:pt,onChange:e=>mt(e.target.value)})]})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Ordered steps, one per line`}),(0,B.jsx)(I,{className:`min-h-32`,value:ht,onChange:e=>gt(e.target.value)})]}),(0,B.jsxs)(a,{onClick:en,disabled:!dt||_!==null,children:[(0,B.jsx)(g,{}),` Start workflow`]})]})]}),!X&&!Y.workflowProgress&&(0,B.jsx)(P,{children:(0,B.jsxs)(N,{children:[(0,B.jsx)(A,{children:`No shared workflow yet`}),(0,B.jsx)(M,{children:`The host can select a reviewed workflow for this room. You can continue sharing context and handoff updates while you wait.`})]})}),Y.workflowProgress&&(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsxs)(A,{children:[Y.workflowProgress.package.name,`@`,Y.workflowProgress.workflow.version]}),(0,B.jsxs)(M,{children:[`Exact strategy retained at digest `,Y.workflowProgress.workflow.digest.slice(0,12),`… · shared progress revision `,Y.workflowProgress.revision]})]}),(0,B.jsx)(j,{className:`space-y-3`,children:Y.workflowProgress.steps.map((e,t)=>{let n=Y.workflowProgress.package.steps.find(t=>t.id===e.stepId);return(0,B.jsx)(`div`,{className:`rounded-lg border border-border p-3`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`grid size-5 place-items-center rounded-full bg-muted text-[10px]`,children:t+1}),(0,B.jsx)(`span`,{className:`text-xs font-semibold`,children:n?.title||e.stepId}),(0,B.jsx)(k,{variant:e.status===`completed`?`success`:e.status===`completion_proposed`?`warning`:`secondary`,children:e.status.replace(`_`,` `)})]}),(0,B.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.stepId}),e.evidence&&(0,B.jsxs)(`p`,{className:`mt-2 whitespace-pre-wrap text-xs text-muted-foreground`,children:[`Evidence: `,e.evidence]}),n?.requiresEvidence&&(0,B.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,B.jsx)(F,{htmlFor:`workflow-evidence-${e.stepId}`,children:`Completion evidence`}),(0,B.jsx)(I,{id:`workflow-evidence-${e.stepId}`,className:`min-h-20 text-xs`,value:_t[e.stepId]??e.evidence??``,onChange:t=>vt(n=>({...n,[e.stepId]:t.target.value})),placeholder:`Tests, review result, or other verification`})]})]}),(0,B.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.status===`completion_proposed`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(a,{size:`sm`,onClick:()=>$(e,`completed`),children:[(0,B.jsx)(me,{}),` Confirm`]}),(0,B.jsx)(a,{size:`sm`,variant:`outline`,onClick:()=>$(e,`in_progress`),children:`Reject`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(a,{size:`sm`,variant:`outline`,onClick:()=>$(e,`in_progress`),children:`In progress`}),(0,B.jsx)(a,{size:`sm`,variant:`outline`,onClick:()=>$(e,`completed`),children:`Complete`}),(0,B.jsx)(a,{size:`sm`,variant:`ghost`,onClick:()=>$(e,`pending`),children:`Reopen`})]})})]})},e.stepId)})})]})]}),(0,B.jsxs)(c,{value:`members`,className:`space-y-4`,children:[X&&Y.pendingJoins.map(e=>(0,B.jsxs)(ve,{variant:`warning`,children:[(0,B.jsx)(je,{}),(0,B.jsxs)(_e,{children:[e.displayName,` wants to join`]}),(0,B.jsxs)(ge,{children:[`Requested `,new Date(e.requestedAt).toLocaleString()]}),(0,B.jsxs)(`div`,{className:`flex gap-1`,children:[(0,B.jsx)(a,{size:`sm`,onClick:()=>Q(`accept-${e.id}`,()=>p(`/api/workrooms/members/${e.id}/decision`,{method:`POST`,body:JSON.stringify({accept:!0})}).then(()=>void 0)),children:`Accept`}),(0,B.jsx)(a,{size:`sm`,variant:`outline`,onClick:()=>Q(`reject-${e.id}`,()=>p(`/api/workrooms/members/${e.id}/decision`,{method:`POST`,body:JSON.stringify({accept:!1})}).then(()=>void 0)),children:`Reject`})]})]},e.id)),(0,B.jsx)(P,{children:(0,B.jsx)(j,{className:`divide-y divide-border p-0`,children:Y.participants.map(e=>(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`size-2 rounded-full ${e.revokedAt?`bg-muted-foreground`:`bg-emerald-500`}`}),(0,B.jsx)(`span`,{className:`text-sm font-semibold`,children:e.displayName}),(0,B.jsx)(k,{variant:e.role===`host`?`info`:`secondary`,children:e.role}),e.id===Lt?.id&&(0,B.jsx)(k,{variant:`success`,children:`You`})]}),(0,B.jsxs)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:[`Joined `,new Date(e.joinedAt).toLocaleString()]})]}),X&&e.role!==`host`&&!e.revokedAt&&(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(a,{size:`sm`,variant:`outline`,onClick:()=>Q(`role-${e.id}`,()=>p(`/api/workrooms/members/${e.id}/role`,{method:`PUT`,body:JSON.stringify({role:e.role===`publisher`?`member`:`publisher`})}).then(()=>void 0)),children:e.role===`publisher`?`Make member`:`Make publisher`}),(0,B.jsxs)(a,{size:`sm`,variant:`destructive-outline`,onClick:()=>Q(`revoke-${e.id}`,()=>p(`/api/workrooms/members/${e.id}`,{method:`DELETE`}).then(()=>void 0)),children:[(0,B.jsx)(Me,{}),` Revoke`]})]})]},e.id))})})]}),(0,B.jsx)(c,{value:`activity`,children:(0,B.jsx)(P,{children:(0,B.jsx)(j,{className:`divide-y divide-border p-0`,children:[...Y.activity].reverse().map(e=>(0,B.jsxs)(`div`,{className:`flex gap-3 p-4`,children:[(0,B.jsx)(oe,{className:`mt-0.5 shrink-0 text-muted-foreground`,size:14}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`text-sm`,children:e.summary}),(0,B.jsxs)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[`#`,e.sequence,` · `,e.type,` · `,new Date(e.createdAt).toLocaleString()]})]})]},e.sequence))})})}),(0,B.jsxs)(c,{value:`security`,className:`space-y-4`,children:[(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsx)(A,{children:`TLS identity`}),(0,B.jsx)(M,{children:`Guests pin this SHA-256 fingerprint from the invitation. Mismatches stop before any password or device credential is sent.`})]}),(0,B.jsx)(j,{children:(0,B.jsx)(`code`,{className:`break-all text-xs`,children:Y.certificateFingerprint})})]}),X&&(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsx)(A,{children:`Rotate room password`}),(0,B.jsx)(M,{children:`Outstanding invitations are revoked. Existing device credentials are revoked by default.`})]}),(0,B.jsxs)(j,{className:`space-y-3`,children:[(0,B.jsx)(r,{type:`password`,value:yt,onChange:e=>bt(e.target.value)}),(0,B.jsxs)(a,{variant:`destructive-outline`,onClick:()=>Q(`rotate`,()=>p(`/api/workrooms/password/rotate`,{method:`POST`,body:JSON.stringify({password:yt,revokeDevices:!0})}).then(()=>void 0),`Password rotated and guest devices revoked.`),children:[(0,B.jsx)(Ce,{}),` Rotate and revoke`]})]})]}),(0,B.jsxs)(P,{children:[(0,B.jsxs)(N,{children:[(0,B.jsx)(A,{children:`Encrypted portable export`}),(0,B.jsx)(M,{children:`Excludes certificates, password hashes, invitations, and device credentials.`})]}),(0,B.jsxs)(j,{className:`space-y-3`,children:[(0,B.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,B.jsx)(F,{children:`Export passphrase`}),(0,B.jsx)(r,{type:`password`,value:J,onChange:e=>xt(e.target.value)})]}),(0,B.jsxs)(a,{variant:`outline`,onClick:nn,disabled:J.length<12||_!==null,children:[(0,B.jsx)(Se,{}),` Export room`]})]})]})]})]})]})]}):(0,B.jsx)(`div`,{className:`flex justify-center py-24`,children:(0,B.jsx)(D,{className:`size-6`})})}export{Ke as WorkroomsPage};