@spexcode/spec-dashboard 0.7.0-next.1 → 0.7.0-next.10

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 (43) hide show
  1. package/dist/assets/{App-BBoP1IyU.js → App-CskIZN7M.js} +2 -2
  2. package/{dist-public/assets/EmptyView-BdrTMUAy.js → dist/assets/EmptyView-DrmGSR0q.js} +1 -1
  3. package/{dist-public/assets/EvalsPage-DIfyOQXb.js → dist/assets/EvalsPage-Dse2VjXa.js} +1 -1
  4. package/dist/assets/{FileView-BqSwsBx0.js → FileView-DEWsmuDI.js} +2 -2
  5. package/dist/assets/{GraphView-DmtM56Gf.js → GraphView-BJV5fFPW.js} +3 -3
  6. package/dist/assets/{IssuesPage-BZ36PpJ-.js → IssuesPage-CoC3ad75.js} +1 -1
  7. package/dist/assets/{MobileApp-DuXKCmKv.js → MobileApp-CgCtuOrT.js} +2 -2
  8. package/dist/assets/{Modal-oF4JAL6H.js → Modal-CXu9FXk6.js} +1 -1
  9. package/dist/assets/{NodeView-CZYwYCCu.js → NodeView-Tm5GZlX6.js} +1 -1
  10. package/{dist-public/assets/ProjectsPage-Ctzz8z3E.js → dist/assets/ProjectsPage-Dlinowv6.js} +1 -1
  11. package/dist/assets/{ProseActions-CSG_3k1b.js → ProseActions-B1qp09lF.js} +1 -1
  12. package/dist/assets/{Settings-qIX2_HmP.js → Settings-DpeqwCpR.js} +1 -1
  13. package/dist/assets/{SpecView-CM3BOtTy.js → SpecView-gWPAa6fO.js} +1 -1
  14. package/dist/assets/{Thread-4tohzgUo.js → Thread-HfBnROTU.js} +1 -1
  15. package/dist/assets/{WorkspaceSurface-BysfRmg3.js → WorkspaceSurface-CCwYtvnX.js} +1 -1
  16. package/dist/assets/{index-Co8kmYQY.js → index-BRUJ2MhY.js} +1 -1
  17. package/dist/assets/index-CDeR37ZW.css +1 -0
  18. package/{dist-public/assets/index-Ix7HFN0I.js → dist/assets/index-CoSbRVO9.js} +1 -1
  19. package/dist/assets/{tabs-C4phsoFs.js → tabs-BeVb9hdn.js} +55 -55
  20. package/dist/index.html +2 -2
  21. package/dist-public/assets/{App-DI39ygL3.js → App-EA8glWd5.js} +2 -2
  22. package/{dist/assets/EmptyView-DvUslJmJ.js → dist-public/assets/EmptyView-B-CpxL7t.js} +1 -1
  23. package/{dist/assets/EvalsPage-DBVkF_F0.js → dist-public/assets/EvalsPage-BBabasZA.js} +1 -1
  24. package/dist-public/assets/{FileView-BmDYhU9C.js → FileView-DKbQBM93.js} +2 -2
  25. package/dist-public/assets/{GraphView-nuH0yFnk.js → GraphView-mxreYVXr.js} +3 -3
  26. package/dist-public/assets/{IssuesPage-0kQamj5x.js → IssuesPage-DZW22uek.js} +1 -1
  27. package/dist-public/assets/{MobileApp-DxiBJpdL.js → MobileApp-BZQdrmI4.js} +2 -2
  28. package/dist-public/assets/{Modal-DvHG_lvi.js → Modal-b-jG6-T3.js} +1 -1
  29. package/dist-public/assets/{NodeView-BQwIXw15.js → NodeView-BsvhyaG-.js} +1 -1
  30. package/{dist/assets/ProjectsPage-DUpxEHcM.js → dist-public/assets/ProjectsPage-C7wxDxZj.js} +1 -1
  31. package/dist-public/assets/{ProseActions-3FcAR01Y.js → ProseActions-DPXlFqFW.js} +1 -1
  32. package/dist-public/assets/{Settings-GX7a1idU.js → Settings-BYnKTJxM.js} +1 -1
  33. package/dist-public/assets/{SpecView-OcNkvuaj.js → SpecView-NPoKgAta.js} +1 -1
  34. package/dist-public/assets/{Thread-UIOe-Brh.js → Thread-De7CwTom.js} +1 -1
  35. package/dist-public/assets/{WorkspaceSurface-r01RoZft.js → WorkspaceSurface-DvL5TJlF.js} +1 -1
  36. package/{dist/assets/index-cI0gAOhx.js → dist-public/assets/index-CA7RZFf0.js} +1 -1
  37. package/dist-public/assets/index-CDeR37ZW.css +1 -0
  38. package/dist-public/assets/{index-DkZ_7FOT.js → index-DlgNLzN7.js} +1 -1
  39. package/dist-public/assets/{tabs-Dv9P0FBJ.js → tabs-BAAX-hgY.js} +55 -55
  40. package/dist-public/index.html +2 -2
  41. package/package.json +8 -9
  42. package/dist/assets/index-B948v2sT.css +0 -1
  43. package/dist-public/assets/index-B948v2sT.css +0 -1
@@ -1 +1 @@
1
- import{u as D,T as Q,i as X,r as b,af as Z,j as e,ag as W,ah as ee,ai as se,I as $,aj as le,ak as te}from"./index-DkZ_7FOT.js";import{aK as ne,N as ie,aG as F,aE as I,aF as A,P as _,g as U,R as Y,aL as M,az as ae,aA as oe,aB as re,aC as ce,a2 as ue,aM as de,aN as fe,ah as O,aO as pe,aP as K,aQ as H,ag as me}from"./tabs-Dv9P0FBJ.js";import{b as q,c as z}from"./NodeView-BQwIXw15.js";import{c as ve,R as be,O as xe,r as ge}from"./Thread-UIOe-Brh.js";import{l as je,V as P,r as R,S as V,Q as T,U as he,T as we}from"./App-DI39ygL3.js";import"./Modal-DvHG_lvi.js";import"./ProseActions-3FcAR01Y.js";const ye={},G="new",Ne=s=>s.status!=="open",Se=s=>{const c=Math.max(0,(Date.now()-new Date(s).getTime())/1e3);return Number.isFinite(c)?c<3600?`${Math.max(1,Math.floor(c/60))}m`:c<86400?`${Math.floor(c/3600)}h`:`${Math.floor(c/86400)}d`:""},Le=s=>{const c=String(s||"").split("#"),p=c.length>1?c.at(-1):c[0];return`#${p.length>16?`${p.slice(0,13)}…`:p}`},ke=["is","state","store","author","node","label","session"],C=(s,c,p,v=t=>t)=>{var t,i;return(((i=(t=s==null?void 0:s.facets)==null?void 0:t[c])==null?void 0:i.options)??[]).map(a=>({value:a.value,label:a.value===""?p:v(a.value)}))};function Ee({data:s,loading:c,error:p,query:v,onQueryText:t}){var o,h,r,k;const i=D();if(s&&!s.enabled)return e.jsx("div",{className:"fv-note",children:i("session.issuesOff")});const a=Array.isArray(s==null?void 0:s.items)?s.items:[],u=String(v.q??"").trim()||P,S=l=>t==null?void 0:t(l),d=(l,n)=>S(V(u,l,n)),f=(((h=(o=s==null?void 0:s.facets)==null?void 0:o.store)==null?void 0:h.options)??[]).map(l=>l.value).filter(Boolean),w=a,E=((r=s==null?void 0:s.counts)==null?void 0:r.open)||0,x=((k=s==null?void 0:s.counts)==null?void 0:k.closed)||0,m=T(u,"state"),j=w.map(l=>{var g,B;const n=l.status||"open";return{key:l.id,label:l.concern,href:R("issues",l.id),content:e.jsx(e.Fragment,{children:e.jsx(ae,{state:e.jsx(Y,{kind:"issue",state:n}),title:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"rl-row-title-text",children:l.concern}),e.jsx(z,{labels:l.labels,onSelect:J=>d("label",J)})]}),meta:e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-tip":l.id,children:Le(l.id)}),l.by&&e.jsx("span",{"data-tip":l.by,children:i("reviewList.openedBy",{by:ge(l.by)})}),l.created&&e.jsx("span",{children:i("reviewList.openedAt",{at:Se(l.created)})})]}),aside:e.jsxs(e.Fragment,{children:[(((g=l.replies)==null?void 0:g.length)??0)>0&&e.jsxs("span",{className:"rl-comments","data-tip":i("session.issuesReplies",{n:l.replies.length}),children:[e.jsx($,{name:"message-square",size:14}),l.replies.length]}),f.length>1&&e.jsx("span",{className:`rl-tag fv-store-${l.store==="local"?"local":"forge"}`,children:l.store}),((B=l.nodes)==null?void 0:B[0])&&e.jsx("a",{className:"rl-tag node",href:_(U(l.nodes[0])),children:l.nodes[0]})]})})})}}),L=e.jsxs("a",{className:"rl-new",href:R("issues",G),children:[e.jsx($,{name:"plus",size:14}),i("session.issuesNew")]}),y={label:i("reviewList.facetStore"),value:T(u,"store"),options:C(s,"store",i("reviewList.all"))},N={label:i("reviewList.facetSession"),value:T(u,"session"),options:C(s,"session",i("reviewList.all"),l=>i(l==="present"?"reviewList.sessionPresent":"reviewList.sessionMissing"))};return e.jsx(oe,{loading:c,error:p,title:i("reviewList.issuesTitle"),action:L,search:{value:String(v.q??"").trim()?v.q:P,onSubmit:S,placeholder:i("reviewList.searchIssues"),label:i("reviewList.search"),keys:ke,suggest:{author:C(s,"author",i("reviewList.all")).filter(l=>l.value),node:C(s,"node",i("reviewList.all")).filter(l=>l.value),label:C(s,"label",i("reviewList.all")).filter(l=>l.value)}},sections:[{key:"open",label:i("reviewList.open"),count:E,active:m===""||m==="open",onSelect:()=>d("state","open")},{key:"closed",label:i("reviewList.closed"),count:x,active:m!==""&&m!=="open",onSelect:()=>d("state","closed")}],facets:e.jsx(ce,{label:y.label,value:y.value,options:y.options,clearLabel:i("reviewList.all"),onChange:l=>d("store",l),mobile:!0}),secondaryFilters:e.jsx(re,{label:i("reviewList.filters"),clearLabel:i("reviewList.all"),groups:[{label:N.label,value:N.value,active:!!N.value,options:N.options,onChange:l=>d("session",l)}]}),rows:j,pagination:s?{page:s.page,pageCount:s.pageCount,prev:s.prev,next:s.next,hrefFor:l=>R("issues",null,he(u,P,l))}:null,empty:{hasData:((s==null?void 0:s.sourceTotal)??0)>0,dataset:i("session.issuesEmpty"),filtered:i("session.issuesNoMatch")}})}function Ie({issue:s,specs:c,sessions:p,onOpenSession:v,onWrite:t,onQueryText:i}){const a=D(),u=s.store==="local",S=Ne(s),[d,f]=b.useState(""),[w,E]=b.useState(""),x=Array.isArray(s.nodes)?s.nodes:[],m=Array.isArray(s.labels)?s.labels:[],j=Array.isArray(s.replies)?s.replies:[],L=s.status||"open",y=(o,h)=>async()=>{if(!d){f(o);try{const r=await h();r!=null&&r.ok?(E(""),await(t==null?void 0:t(""))):E((r==null?void 0:r.error)||`${o} failed`)}finally{f("")}}},N=(o,h,r,k)=>e.jsx("button",{type:"button",className:`fv-close-issue fv-life-${o}`,disabled:!!d,"data-tip":k,onMouseDown:l=>l.preventDefault(),onClick:y(o,r),children:d===o?a("session.issuesActing"):h});return e.jsxs(F,{title:s.concern,backHref:M("issues"),backLabel:a("detail.backToIssues"),status:e.jsx(Y,{kind:"issue",state:L,showLabel:!0,className:"ds-status-pill",size:16}),side:e.jsxs(e.Fragment,{children:[e.jsx(I,{label:a("detail.sideIssue"),children:e.jsx(A,{text:s.id,mono:!0})}),e.jsxs(I,{label:a("detail.sideStore"),children:[e.jsx(A,{text:s.store,className:`fv-store fv-store-${u?"local":"forge"}`}),s.url&&e.jsx(A,{text:a("session.issuesOpenOnStore",{store:Re(s.store)}),href:s.url,external:!0})]}),m.length>0&&e.jsx(I,{label:a("detail.sideLabels"),children:e.jsx(z,{labels:m,onSelect:o=>i==null?void 0:i(V(P,"label",o))})}),s.by&&e.jsx(I,{label:a("detail.sideOriginator"),children:u?e.jsx(xe,{originator:s.by,sessions:p,kind:"issue",onOpenSession:v}):e.jsx(A,{text:s.by,dim:!0})}),x.length>0&&e.jsx(I,{label:a("detail.sideNodes"),children:x.map(o=>e.jsx(A,{text:o,mono:!0,tip:a("session.issuesFocusNode"),href:_(U(o))},o))})]}),composer:e.jsx(be,{onSend:(o,h)=>se(s.id,o,h),specs:c,sessions:p,focusId:x[0]||null,onDone:t,actionsEnd:!S&&e.jsxs(e.Fragment,{children:[w&&e.jsx("span",{className:"fv-error",children:w}),u&&N("promote",a("session.issuesPromote"),()=>W(s.id),a("session.issuesPromoteTitle")),N("close",a("session.issuesCloseIssue"),()=>ee(s.id),a("session.issuesCloseIssueTitle"))]})},s.id),children:[s.body&&e.jsx("div",{className:"fvd-body",children:e.jsx(q,{body:s.body})}),e.jsx(ve,{replies:j,threadId:u?s.id:null,onRemarkChange:()=>t==null?void 0:t("")})]})}function Ae(s,c){const[p,v]=b.useState(null),[t,i]=b.useState(null),a=b.useRef(0),u=b.useCallback(async()=>{if(!s)return null;const d=++a.current;i(null);try{const f=await le(s);return d===a.current&&v(f),f}catch(f){return d===a.current&&(v(!1),i(f instanceof Error?f.message:String(f))),null}},[s]),S=b.useRef(null);return b.useEffect(()=>{s!==S.current&&(S.current=s,v(null),i(null)),s&&u()},[s,c,u]),{issue:p,error:t,reload:u}}function Ke({param:s=null,query:c=ye,onOpenSession:p,specs:v=[],sessions:t=[],issuesStamp:i=null}){var o,h;const a=D(),u=Q(),S=je(),{notify:d}=X(),f=s===G,w=String(c.q??"").trim()||P,E=ne(c.page),x=b.useMemo(()=>t.map(r=>r.id).join(","),[t]),m=ie("issues",w,E,{enabled:(!s||f)&&S,refreshKey:`${i??""}|${x}`}),j=Ae(f?null:s,i);Z(s&&!f?R("issues",s):null,(o=j.issue)==null?void 0:o.concern);const L=r=>{r&&d(r)},y=async r=>{L(r),await(s?j.reload():m.reload())},N=r=>u.ownQuery(we(r,P));if(f){if(m.data&&!m.data.enabled)return e.jsx("div",{className:"fv-note",children:a("session.issuesOff")});const r=Array.isArray((h=m.data)==null?void 0:h.stores)&&m.data.stores.length?m.data.stores:[{id:"local",label:"local",kind:"local"}];return e.jsx(Ce,{specs:v,sessions:t,stores:r,onCreated:(k,l)=>{L(l),u.open({page:"issues",param:k,query:null},{replace:!0})}})}return s?j.issue==null?e.jsx("div",{className:"fv-note",children:a("session.issuesLoading")}):j.error?e.jsx(F,{failure:j.error,listHref:R("issues"),listLabel:a("reviewShell.backToIssues")}):j.issue===!1?e.jsx(F,{missing:a("reviewShell.issueNotFound",{id:s}),listHref:R("issues"),listLabel:a("reviewShell.backToIssues")}):e.jsx(Ie,{issue:j.issue,specs:v,sessions:t,onOpenSession:p,onWrite:y,onQueryText:N}):e.jsx(Ee,{data:m.data,loading:m.loading,error:m.error,query:c,onQueryText:N})}const Pe={github:"GitHub",gitlab:"GitLab"},Re=s=>Pe[s]||s;function Ce({specs:s,sessions:c,stores:p,onCreated:v}){var l;const t=D(),[i,a]=b.useState(((l=p[0])==null?void 0:l.id)||"local"),[u,S]=b.useState(""),[d,f]=b.useState(""),[w,E]=b.useState(!1),[x,m]=b.useState(!1),[j,L]=b.useState(""),y=b.useRef(null),{launchers:N}=ue(),o=de({inputRef:y,value:d,setValue:f,specs:s,sessions:c,launchers:N});b.useEffect(()=>{var n;p.some(g=>g.id===i)||a(((n=p[0])==null?void 0:n.id)||"local")},[p,i]);const h=[...new Set([...d.matchAll(fe)].map(n=>n[1]))],r=async()=>{const n=u.trim();if(!(!n||x)){m(!0),L("");try{const g=await te({concern:n,body:d.trim()||void 0,store:i});g!=null&&g.ok&&g.id?v==null||v(g.id,g.outcomes||""):L((g==null?void 0:g.error)||t("session.issuesPostFailed"))}finally{m(!1)}}},k=(n,g)=>e.jsx("button",{type:"button",role:"tab","aria-selected":w===n,className:`fv-tab ${w===n?"on":""}`,onClick:()=>E(n),children:g});return e.jsx(F,{title:t("session.issuesNewTitle"),backHref:M("issues"),backLabel:t("detail.backToIssues"),side:e.jsxs(e.Fragment,{children:[e.jsx(I,{label:t("session.issuesStoreLabel"),children:e.jsxs("label",{className:"fv-store-pick",children:[e.jsx("span",{className:"sr-only",children:t("session.issuesStoreLabel")}),e.jsx("select",{value:i,disabled:x,onChange:n=>a(n.target.value),children:p.map(n=>e.jsx("option",{value:n.id,children:n.label||n.id},n.id))})]})}),e.jsx(I,{label:t("detail.sideNodes"),children:h.length>0?h.map(n=>e.jsx(A,{text:n,mono:!0},n)):e.jsx(A,{text:t("session.issuesNodesHint"),dim:!0})})]}),children:e.jsxs("div",{className:"fv-new-page",children:[e.jsxs("label",{className:"fv-field",children:[e.jsx("span",{className:"fv-field-label",children:t("session.issuesTitleLabel")}),e.jsx("input",{className:"fv-input fv-new-title",value:u,placeholder:t("session.issuesConcernPlaceholder"),disabled:x,autoFocus:!0,onChange:n=>S(n.target.value),onKeyDown:n=>{O(n)||n.key==="Enter"&&(n.preventDefault(),r())}})]}),e.jsxs("div",{className:"fv-field",children:[e.jsxs("div",{className:"fv-field-head",children:[e.jsx("span",{className:"fv-field-label",children:t("session.issuesBodyLabel")}),e.jsxs("div",{className:"fv-tabs",role:"tablist","aria-label":t("session.issuesBodyLabel"),children:[k(!1,t("session.issuesWrite")),k(!0,t("session.issuesPreview"))]})]}),e.jsx(pe,{className:"fv-new-compose",editor:w?e.jsx("div",{className:"fv-new-preview",role:"tabpanel",children:d.trim()?e.jsx(q,{body:d}):e.jsx("span",{className:"fv-new-hint",children:t("session.issuesPreviewEmpty")})}):e.jsxs("div",{className:"fv-tawrap",role:"tabpanel",children:[e.jsx(me,{ref:y,className:"fv-textarea",rows:1,value:d,placeholder:t("session.issuesBodyPlaceholder"),disabled:x,onChange:n=>{f(n.target.value),o.sync(n.target)},onSelect:n=>o.sync(n.target),onBlur:o.close,onKeyDown:n=>{O(n)||o.onKeyDown(n)||n.key==="Enter"&&(n.metaKey||n.ctrlKey)&&(n.preventDefault(),r())}}),o.menuEl]}),footer:e.jsxs("div",{className:"fv-actions",children:[e.jsx(K,{label:t("thread.mentionActor"),disabled:x||w,onClick:()=>H(y.current,"@",f,o.sync),children:"@"}),e.jsx(K,{label:t("thread.mentionNode"),disabled:x||w,onClick:()=>H(y.current,"[[",f,o.sync),children:"[["})]})})]}),e.jsxs("div",{className:"fv-new-actions",children:[j&&e.jsx("span",{className:"fv-error",children:j}),e.jsx("a",{className:"fv-cancel",href:M("issues"),children:t("session.issuesCancel")}),e.jsx("button",{type:"button",className:"fv-post",disabled:x||!u.trim(),onClick:r,children:t(x?"session.issuesSending":"session.issuesPost")})]})]})})}export{ke as ISSUE_QUERY_KEYS,Ie as IssueDetailPage,Ee as IssuesListPage,G as NEW_PARAM,Ke as default};
1
+ import{u as D,T as Q,i as X,r as b,af as Z,j as e,ag as W,ah as ee,ai as se,I as $,aj as le,ak as te}from"./index-DlgNLzN7.js";import{aK as ne,N as ie,aG as F,aE as I,aF as A,P as _,g as U,R as Y,aL as M,az as ae,aA as oe,aB as re,aC as ce,a2 as ue,aM as de,aN as fe,ah as O,aO as pe,aP as K,aQ as H,ag as me}from"./tabs-BAAX-hgY.js";import{b as q,c as z}from"./NodeView-BsvhyaG-.js";import{c as ve,R as be,O as xe,r as ge}from"./Thread-De7CwTom.js";import{l as je,V as P,r as R,S as V,Q as T,U as he,T as we}from"./App-EA8glWd5.js";import"./Modal-b-jG6-T3.js";import"./ProseActions-DPXlFqFW.js";const ye={},G="new",Ne=s=>s.status!=="open",Se=s=>{const c=Math.max(0,(Date.now()-new Date(s).getTime())/1e3);return Number.isFinite(c)?c<3600?`${Math.max(1,Math.floor(c/60))}m`:c<86400?`${Math.floor(c/3600)}h`:`${Math.floor(c/86400)}d`:""},Le=s=>{const c=String(s||"").split("#"),p=c.length>1?c.at(-1):c[0];return`#${p.length>16?`${p.slice(0,13)}…`:p}`},ke=["is","state","store","author","node","label","session"],C=(s,c,p,v=t=>t)=>{var t,i;return(((i=(t=s==null?void 0:s.facets)==null?void 0:t[c])==null?void 0:i.options)??[]).map(a=>({value:a.value,label:a.value===""?p:v(a.value)}))};function Ee({data:s,loading:c,error:p,query:v,onQueryText:t}){var o,h,r,k;const i=D();if(s&&!s.enabled)return e.jsx("div",{className:"fv-note",children:i("session.issuesOff")});const a=Array.isArray(s==null?void 0:s.items)?s.items:[],u=String(v.q??"").trim()||P,S=l=>t==null?void 0:t(l),d=(l,n)=>S(V(u,l,n)),f=(((h=(o=s==null?void 0:s.facets)==null?void 0:o.store)==null?void 0:h.options)??[]).map(l=>l.value).filter(Boolean),w=a,E=((r=s==null?void 0:s.counts)==null?void 0:r.open)||0,x=((k=s==null?void 0:s.counts)==null?void 0:k.closed)||0,m=T(u,"state"),j=w.map(l=>{var g,B;const n=l.status||"open";return{key:l.id,label:l.concern,href:R("issues",l.id),content:e.jsx(e.Fragment,{children:e.jsx(ae,{state:e.jsx(Y,{kind:"issue",state:n}),title:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"rl-row-title-text",children:l.concern}),e.jsx(z,{labels:l.labels,onSelect:J=>d("label",J)})]}),meta:e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-tip":l.id,children:Le(l.id)}),l.by&&e.jsx("span",{"data-tip":l.by,children:i("reviewList.openedBy",{by:ge(l.by)})}),l.created&&e.jsx("span",{children:i("reviewList.openedAt",{at:Se(l.created)})})]}),aside:e.jsxs(e.Fragment,{children:[(((g=l.replies)==null?void 0:g.length)??0)>0&&e.jsxs("span",{className:"rl-comments","data-tip":i("session.issuesReplies",{n:l.replies.length}),children:[e.jsx($,{name:"message-square",size:14}),l.replies.length]}),f.length>1&&e.jsx("span",{className:`rl-tag fv-store-${l.store==="local"?"local":"forge"}`,children:l.store}),((B=l.nodes)==null?void 0:B[0])&&e.jsx("a",{className:"rl-tag node",href:_(U(l.nodes[0])),children:l.nodes[0]})]})})})}}),L=e.jsxs("a",{className:"rl-new",href:R("issues",G),children:[e.jsx($,{name:"plus",size:14}),i("session.issuesNew")]}),y={label:i("reviewList.facetStore"),value:T(u,"store"),options:C(s,"store",i("reviewList.all"))},N={label:i("reviewList.facetSession"),value:T(u,"session"),options:C(s,"session",i("reviewList.all"),l=>i(l==="present"?"reviewList.sessionPresent":"reviewList.sessionMissing"))};return e.jsx(oe,{loading:c,error:p,title:i("reviewList.issuesTitle"),action:L,search:{value:String(v.q??"").trim()?v.q:P,onSubmit:S,placeholder:i("reviewList.searchIssues"),label:i("reviewList.search"),keys:ke,suggest:{author:C(s,"author",i("reviewList.all")).filter(l=>l.value),node:C(s,"node",i("reviewList.all")).filter(l=>l.value),label:C(s,"label",i("reviewList.all")).filter(l=>l.value)}},sections:[{key:"open",label:i("reviewList.open"),count:E,active:m===""||m==="open",onSelect:()=>d("state","open")},{key:"closed",label:i("reviewList.closed"),count:x,active:m!==""&&m!=="open",onSelect:()=>d("state","closed")}],facets:e.jsx(ce,{label:y.label,value:y.value,options:y.options,clearLabel:i("reviewList.all"),onChange:l=>d("store",l),mobile:!0}),secondaryFilters:e.jsx(re,{label:i("reviewList.filters"),clearLabel:i("reviewList.all"),groups:[{label:N.label,value:N.value,active:!!N.value,options:N.options,onChange:l=>d("session",l)}]}),rows:j,pagination:s?{page:s.page,pageCount:s.pageCount,prev:s.prev,next:s.next,hrefFor:l=>R("issues",null,he(u,P,l))}:null,empty:{hasData:((s==null?void 0:s.sourceTotal)??0)>0,dataset:i("session.issuesEmpty"),filtered:i("session.issuesNoMatch")}})}function Ie({issue:s,specs:c,sessions:p,onOpenSession:v,onWrite:t,onQueryText:i}){const a=D(),u=s.store==="local",S=Ne(s),[d,f]=b.useState(""),[w,E]=b.useState(""),x=Array.isArray(s.nodes)?s.nodes:[],m=Array.isArray(s.labels)?s.labels:[],j=Array.isArray(s.replies)?s.replies:[],L=s.status||"open",y=(o,h)=>async()=>{if(!d){f(o);try{const r=await h();r!=null&&r.ok?(E(""),await(t==null?void 0:t(""))):E((r==null?void 0:r.error)||`${o} failed`)}finally{f("")}}},N=(o,h,r,k)=>e.jsx("button",{type:"button",className:`fv-close-issue fv-life-${o}`,disabled:!!d,"data-tip":k,onMouseDown:l=>l.preventDefault(),onClick:y(o,r),children:d===o?a("session.issuesActing"):h});return e.jsxs(F,{title:s.concern,backHref:M("issues"),backLabel:a("detail.backToIssues"),status:e.jsx(Y,{kind:"issue",state:L,showLabel:!0,className:"ds-status-pill",size:16}),side:e.jsxs(e.Fragment,{children:[e.jsx(I,{label:a("detail.sideIssue"),children:e.jsx(A,{text:s.id,mono:!0})}),e.jsxs(I,{label:a("detail.sideStore"),children:[e.jsx(A,{text:s.store,className:`fv-store fv-store-${u?"local":"forge"}`}),s.url&&e.jsx(A,{text:a("session.issuesOpenOnStore",{store:Re(s.store)}),href:s.url,external:!0})]}),m.length>0&&e.jsx(I,{label:a("detail.sideLabels"),children:e.jsx(z,{labels:m,onSelect:o=>i==null?void 0:i(V(P,"label",o))})}),s.by&&e.jsx(I,{label:a("detail.sideOriginator"),children:u?e.jsx(xe,{originator:s.by,sessions:p,kind:"issue",onOpenSession:v}):e.jsx(A,{text:s.by,dim:!0})}),x.length>0&&e.jsx(I,{label:a("detail.sideNodes"),children:x.map(o=>e.jsx(A,{text:o,mono:!0,tip:a("session.issuesFocusNode"),href:_(U(o))},o))})]}),composer:e.jsx(be,{onSend:(o,h)=>se(s.id,o,h),specs:c,sessions:p,focusId:x[0]||null,onDone:t,actionsEnd:!S&&e.jsxs(e.Fragment,{children:[w&&e.jsx("span",{className:"fv-error",children:w}),u&&N("promote",a("session.issuesPromote"),()=>W(s.id),a("session.issuesPromoteTitle")),N("close",a("session.issuesCloseIssue"),()=>ee(s.id),a("session.issuesCloseIssueTitle"))]})},s.id),children:[s.body&&e.jsx("div",{className:"fvd-body",children:e.jsx(q,{body:s.body})}),e.jsx(ve,{replies:j,threadId:u?s.id:null,onRemarkChange:()=>t==null?void 0:t("")})]})}function Ae(s,c){const[p,v]=b.useState(null),[t,i]=b.useState(null),a=b.useRef(0),u=b.useCallback(async()=>{if(!s)return null;const d=++a.current;i(null);try{const f=await le(s);return d===a.current&&v(f),f}catch(f){return d===a.current&&(v(!1),i(f instanceof Error?f.message:String(f))),null}},[s]),S=b.useRef(null);return b.useEffect(()=>{s!==S.current&&(S.current=s,v(null),i(null)),s&&u()},[s,c,u]),{issue:p,error:t,reload:u}}function Ke({param:s=null,query:c=ye,onOpenSession:p,specs:v=[],sessions:t=[],issuesStamp:i=null}){var o,h;const a=D(),u=Q(),S=je(),{notify:d}=X(),f=s===G,w=String(c.q??"").trim()||P,E=ne(c.page),x=b.useMemo(()=>t.map(r=>r.id).join(","),[t]),m=ie("issues",w,E,{enabled:(!s||f)&&S,refreshKey:`${i??""}|${x}`}),j=Ae(f?null:s,i);Z(s&&!f?R("issues",s):null,(o=j.issue)==null?void 0:o.concern);const L=r=>{r&&d(r)},y=async r=>{L(r),await(s?j.reload():m.reload())},N=r=>u.ownQuery(we(r,P));if(f){if(m.data&&!m.data.enabled)return e.jsx("div",{className:"fv-note",children:a("session.issuesOff")});const r=Array.isArray((h=m.data)==null?void 0:h.stores)&&m.data.stores.length?m.data.stores:[{id:"local",label:"local",kind:"local"}];return e.jsx(Ce,{specs:v,sessions:t,stores:r,onCreated:(k,l)=>{L(l),u.open({page:"issues",param:k,query:null},{replace:!0})}})}return s?j.issue==null?e.jsx("div",{className:"fv-note",children:a("session.issuesLoading")}):j.error?e.jsx(F,{failure:j.error,listHref:R("issues"),listLabel:a("reviewShell.backToIssues")}):j.issue===!1?e.jsx(F,{missing:a("reviewShell.issueNotFound",{id:s}),listHref:R("issues"),listLabel:a("reviewShell.backToIssues")}):e.jsx(Ie,{issue:j.issue,specs:v,sessions:t,onOpenSession:p,onWrite:y,onQueryText:N}):e.jsx(Ee,{data:m.data,loading:m.loading,error:m.error,query:c,onQueryText:N})}const Pe={github:"GitHub",gitlab:"GitLab"},Re=s=>Pe[s]||s;function Ce({specs:s,sessions:c,stores:p,onCreated:v}){var l;const t=D(),[i,a]=b.useState(((l=p[0])==null?void 0:l.id)||"local"),[u,S]=b.useState(""),[d,f]=b.useState(""),[w,E]=b.useState(!1),[x,m]=b.useState(!1),[j,L]=b.useState(""),y=b.useRef(null),{launchers:N}=ue(),o=de({inputRef:y,value:d,setValue:f,specs:s,sessions:c,launchers:N});b.useEffect(()=>{var n;p.some(g=>g.id===i)||a(((n=p[0])==null?void 0:n.id)||"local")},[p,i]);const h=[...new Set([...d.matchAll(fe)].map(n=>n[1]))],r=async()=>{const n=u.trim();if(!(!n||x)){m(!0),L("");try{const g=await te({concern:n,body:d.trim()||void 0,store:i});g!=null&&g.ok&&g.id?v==null||v(g.id,g.outcomes||""):L((g==null?void 0:g.error)||t("session.issuesPostFailed"))}finally{m(!1)}}},k=(n,g)=>e.jsx("button",{type:"button",role:"tab","aria-selected":w===n,className:`fv-tab ${w===n?"on":""}`,onClick:()=>E(n),children:g});return e.jsx(F,{title:t("session.issuesNewTitle"),backHref:M("issues"),backLabel:t("detail.backToIssues"),side:e.jsxs(e.Fragment,{children:[e.jsx(I,{label:t("session.issuesStoreLabel"),children:e.jsxs("label",{className:"fv-store-pick",children:[e.jsx("span",{className:"sr-only",children:t("session.issuesStoreLabel")}),e.jsx("select",{value:i,disabled:x,onChange:n=>a(n.target.value),children:p.map(n=>e.jsx("option",{value:n.id,children:n.label||n.id},n.id))})]})}),e.jsx(I,{label:t("detail.sideNodes"),children:h.length>0?h.map(n=>e.jsx(A,{text:n,mono:!0},n)):e.jsx(A,{text:t("session.issuesNodesHint"),dim:!0})})]}),children:e.jsxs("div",{className:"fv-new-page",children:[e.jsxs("label",{className:"fv-field",children:[e.jsx("span",{className:"fv-field-label",children:t("session.issuesTitleLabel")}),e.jsx("input",{className:"fv-input fv-new-title",value:u,placeholder:t("session.issuesConcernPlaceholder"),disabled:x,autoFocus:!0,onChange:n=>S(n.target.value),onKeyDown:n=>{O(n)||n.key==="Enter"&&(n.preventDefault(),r())}})]}),e.jsxs("div",{className:"fv-field",children:[e.jsxs("div",{className:"fv-field-head",children:[e.jsx("span",{className:"fv-field-label",children:t("session.issuesBodyLabel")}),e.jsxs("div",{className:"fv-tabs",role:"tablist","aria-label":t("session.issuesBodyLabel"),children:[k(!1,t("session.issuesWrite")),k(!0,t("session.issuesPreview"))]})]}),e.jsx(pe,{className:"fv-new-compose",editor:w?e.jsx("div",{className:"fv-new-preview",role:"tabpanel",children:d.trim()?e.jsx(q,{body:d}):e.jsx("span",{className:"fv-new-hint",children:t("session.issuesPreviewEmpty")})}):e.jsxs("div",{className:"fv-tawrap",role:"tabpanel",children:[e.jsx(me,{ref:y,className:"fv-textarea",rows:1,value:d,placeholder:t("session.issuesBodyPlaceholder"),disabled:x,onChange:n=>{f(n.target.value),o.sync(n.target)},onSelect:n=>o.sync(n.target),onBlur:o.close,onKeyDown:n=>{O(n)||o.onKeyDown(n)||n.key==="Enter"&&(n.metaKey||n.ctrlKey)&&(n.preventDefault(),r())}}),o.menuEl]}),footer:e.jsxs("div",{className:"fv-actions",children:[e.jsx(K,{label:t("thread.mentionActor"),disabled:x||w,onClick:()=>H(y.current,"@",f,o.sync),children:"@"}),e.jsx(K,{label:t("thread.mentionNode"),disabled:x||w,onClick:()=>H(y.current,"[[",f,o.sync),children:"[["})]})})]}),e.jsxs("div",{className:"fv-new-actions",children:[j&&e.jsx("span",{className:"fv-error",children:j}),e.jsx("a",{className:"fv-cancel",href:M("issues"),children:t("session.issuesCancel")}),e.jsx("button",{type:"button",className:"fv-post",disabled:x||!u.trim(),onClick:r,children:t(x?"session.issuesSending":"session.issuesPost")})]})]})})}export{ke as ISSUE_QUERY_KEYS,Ie as IssueDetailPage,Ee as IssuesListPage,G as NEW_PARAM,Ke as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./EvalsPage-DIfyOQXb.js","./index-DkZ_7FOT.js","./index-B948v2sT.css","./Thread-UIOe-Brh.js","./tabs-Dv9P0FBJ.js","./App-DI39ygL3.js","./Modal-DvHG_lvi.js","./tabs-PFmT6UqQ.css","./IssuesPage-0kQamj5x.js","./NodeView-BQwIXw15.js","./ProseActions-3FcAR01Y.js","./Settings-GX7a1idU.js"])))=>i.map(i=>d[i]);
2
- import{u as P,r,j as s,_ as O,I as H}from"./index-DkZ_7FOT.js";import{a9 as D,J as M,aa as $,x as K,ab as B,ac as U,ad as J,ae as Q,S as L,af as W,a2 as Z,ag as q,ah as G,I as X,K as Y,P as ss,ai as es,aj as as,ak as ns}from"./tabs-Dv9P0FBJ.js";import{p as ts,u as ls,S as is,H as cs,I as rs,E as os,a as ms}from"./NodeView-BQwIXw15.js";import{n as I}from"./App-DI39ygL3.js";import"./Modal-DvHG_lvi.js";import"./Thread-UIOe-Brh.js";import"./ProseActions-3FcAR01Y.js";const ds=r.lazy(()=>O(()=>import("./EvalsPage-DIfyOQXb.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),us=r.lazy(()=>O(()=>import("./IssuesPage-0kQamj5x.js"),__vite__mapDeps([8,1,2,4,5,6,7,9,3,10]),import.meta.url)),hs=r.lazy(()=>O(()=>import("./Settings-GX7a1idU.js"),__vite__mapDeps([11,1,2,5,4,6,7]),import.meta.url)),bs={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"},z=(e,l)=>l.filter(o=>{var m;return(m=o.ops)==null?void 0:m.some(c=>c.nodeId===e.id)});function R({status:e}){const l=L[e]||L.pending;return s.jsx("span",{className:"m-dot",style:{background:l.color}})}function ps({node:e,kids:l,editors:o,onTap:m}){return s.jsxs("button",{className:"m-row",onClick:m,children:[s.jsx(R,{status:e.status}),s.jsx("span",{className:"m-row-title",children:e.title}),o.length>0&&s.jsx("span",{className:"m-row-faces",children:o.slice(0,3).map(c=>s.jsx(D,{seed:c.id,status:c.status,title:M(c)},c.id))}),e.version?s.jsxs("span",{className:"m-row-ver",children:["v",e.version]}):null,l>0&&s.jsxs("span",{className:"m-row-kids",children:["▸",l]}),s.jsx("span",{className:"m-row-chev",children:"›"})]})}function xs({node:e,childrenOf:l,sessions:o,onOpenChild:m}){const c=P(),u=l(e.id),b=ts(e),h=[...u.length?[{key:"children",label:c("mobile.childrenTab",{n:u.length})}]:[],...b.map(a=>({key:a.key,label:c(bs[a.key])}))],[j,N]=r.useState(null),[p,k]=r.useState({issues:{},eval:{}});r.useEffect(()=>{N(null),k({issues:{},eval:{}})},[e.id]);const x=(a,S)=>k(y=>({...y,[a]:W(y[a],S)})),n=j&&h.some(a=>a.key===j)?j:h[0].key,v=ls(e.id,n==="history"),i=z(e,o);return s.jsxs("div",{className:"m-node",children:[s.jsxs("div",{className:"m-node-head",children:[s.jsx(R,{status:e.status}),s.jsx("span",{className:"m-node-title",children:e.title}),e.version?s.jsxs("span",{className:"m-node-ver",children:["v",e.version]}):null,s.jsx("span",{className:"m-node-status",children:c(`status.${e.status}`)}),i.length>0&&s.jsx("span",{className:"m-node-faces",title:c("mobile.liveEditors",{n:i.length}),children:i.map(a=>s.jsx(D,{seed:a.id,status:a.status,title:M(a)},a.id))})]}),e.desc&&s.jsx("div",{className:"m-node-desc",children:e.desc}),s.jsx("div",{className:"m-tabs",children:h.map(a=>s.jsx("button",{className:a.key===n?"m-tab on":"m-tab",onClick:()=>N(a.key),children:a.label},a.key))}),s.jsxs("div",{className:n==="history"?"m-pane-host fixed":"m-pane-host",children:[n==="children"&&s.jsx("div",{className:"m-children",children:u.map(a=>s.jsx(ps,{node:a,kids:l(a.id).length,editors:z(a,o),onTap:()=>m(a.id)},a.id))}),n==="spec"&&s.jsx(is,{node:e}),n==="history"&&s.jsx(cs,{node:e,rows:v}),n==="issues"&&s.jsx(rs,{node:e,sessions:o,filter:p.issues,onFilter:a=>x("issues",a)}),n==="eval"&&s.jsx(os,{node:e,sessions:o,filter:p.eval,onFilter:a=>x("eval",a)}),n==="edit"&&s.jsx(ms,{node:e})]})]})}function js({s:e,sessions:l,onBack:o}){const m=P();return s.jsxs("div",{className:"m-sessdetail chat",children:[s.jsxs("div",{className:"m-sess-card",children:[s.jsx("button",{className:"m-sess-back",onClick:o,"aria-label":m("mobile.back"),children:"‹"}),s.jsxs("div",{className:"m-sess-meta",children:[s.jsx("span",{className:"m-sess-name",children:X(e)}),s.jsxs("span",{className:"m-sess-status",style:{color:Y[e.status]},children:[m(`status.${e.status}`),e.merges?` · ×${e.merges}`:""," · ",s.jsx("span",{className:"m-sess-id8",children:e.id.slice(0,8)})]})]}),s.jsx("a",{className:"m-sess-evalbtn",href:ss(es(e.id)),title:m("sessionEval.btnTitle"),children:m("sessionEval.btn")})]}),s.jsx(as,{s:e,sessions:l})]})}function fs({draft:e,setDraft:l,onBack:o,onLaunched:m}){const c=P(),{launchers:u,launcher:b,pickLauncher:h}=Z(),[j,N]=r.useState(!1),[p,k]=r.useState(null),x=async()=>{const n=e.trim();if(!n||j)return;N(!0),k(null);const v=await ns(n,b);N(!1),v.ok?(l(""),m()):k(v.error||c("mobile.launchFailed"))};return s.jsxs("div",{className:"m-sessdetail m-new",children:[s.jsxs("div",{className:"m-sess-card",children:[s.jsx("button",{className:"m-sess-back",onClick:o,"aria-label":c("mobile.back"),children:"‹"}),s.jsx("div",{className:"m-sess-meta",children:s.jsx("span",{className:"m-sess-name",children:c("mobile.newSession")})})]}),s.jsxs("div",{className:"m-new-body",children:[s.jsx(q,{className:"m-input m-new-input",rows:5,placeholder:c("mobile.newPlaceholder"),value:e,onKeyDown:n=>{n.key!=="Enter"||n.shiftKey||G(n)||(n.preventDefault(),n.stopPropagation(),x())},onChange:n=>l(n.target.value)}),u.length>0&&s.jsxs("label",{className:"m-new-launcher",children:[s.jsx("span",{className:"m-new-launcher-label",children:c("session.launcherLabel")}),s.jsx("select",{className:"m-new-launcher-select",value:b,onChange:n=>h(n.target.value),children:u.map(n=>s.jsx("option",{value:n.name,children:n.name},n.name))})]}),p&&s.jsx("div",{className:"m-senderr",children:p}),s.jsx("button",{className:"m-send m-new-go",disabled:!e.trim()||j,onClick:x,children:c(j?"mobile.launching":"mobile.launch")})]})]})}function Ns({specs:e,sessions:l,openId:o,setOpenId:m,creating:c,setCreating:u,newDraft:b,setNewDraft:h}){const j=P(),N=o?l.find(i=>i.id===o):null,{expanded:p,toggle:k}=$(),[x,n]=r.useState(!1),v=r.useMemo(()=>K(l,i=>p.has(i),{zoneFolded:i=>i==="offline"&&!x}),[l,p,x]);return c?s.jsx(fs,{draft:b,setDraft:h,onBack:()=>u(!1),onLaunched:()=>u(!1)}):N?s.jsx(js,{s:N,sessions:l,onBack:()=>m(null)}):s.jsxs("div",{className:"m-sesslist",children:[s.jsxs("button",{className:"m-new-btn",onClick:()=>u(!0),children:[s.jsx(H,{name:"plus",size:16,strokeWidth:1.9,"aria-hidden":"true"}),s.jsx("span",{children:j("mobile.newSession")})]}),!l.length&&s.jsx("div",{className:"m-empty big",children:j("mobile.noSessions")}),v.map(i=>{if(i.type==="zone")return s.jsx(B,{item:i,baseClass:"m-zone",onToggle:()=>n(y=>!y)},`z-${i.zone}`);const a=i.s,S=i.expandable||i.depth?s.jsx(U,{guides:i.guides,expandable:i.expandable,kin:i.kin}):null;return s.jsxs("div",{className:"sess-tree-row m-sess-tree-row",style:{"--sess-fold-indent":`${i.depth*14}px`},children:[s.jsx("button",{type:"button",className:"m-sess-row",onClick:()=>m(a.id),children:s.jsx(J,{s:a,locked:!1,showAvatar:!1,lead:S})}),i.expandable&&s.jsx(Q,{expanded:i.expanded,rollup:i.rollup,kin:i.kin,onToggle:()=>k(a.id)})]},a.id)})]})}function Ps({specs:e,sessions:l,issuesStamp:o,reloadBoard:m,route:c={}}){const u=P(),b=r.useMemo(()=>Object.fromEntries(e.map(t=>[t.id,t])),[e]),h=r.useMemo(()=>e.find(t=>!t.parent)||e[0],[e]),j=r.useMemo(()=>{const t={};return e.forEach(d=>{var _;d.parent&&(t[_=d.parent]??(t[_]=[])).push(d)}),d=>t[d]||[]},[e]),[N,p]=r.useState("specs"),[k,x]=r.useState(()=>h?[h.id]:[]),[n,v]=r.useState(null),[i,a]=r.useState(!1),[S,y]=r.useState(""),{page:f="graph",param:w=null}=c,g=f==="evals"||f==="issues"||f==="settings"?f:N;r.useEffect(()=>{f==="sessions"&&w&&(p("sessions"),v(w))},[f,w]),r.useLayoutEffect(()=>{if(f!=="graph"||!w)return;if(p("specs"),!b[w]){x(h?[h.id]:[]);return}const t=[];for(let d=b[w];d;d=d.parent?b[d.parent]:null)t.unshift(d.id);x(t)},[f,w,b,h]);const T=t=>{if(t==="evals"||t==="issues"){I(t);return}p(t),(f==="evals"||f==="issues"||f==="settings")&&I(t==="specs"?"graph":"sessions")},A=t=>{p("sessions"),v(t),I("sessions",t)},E=k.filter(t=>b[t]),F=E[E.length-1]||(h==null?void 0:h.id),C=F?b[F]:null,V=t=>x(d=>[...d.filter(_=>b[_]),t]);return s.jsxs("div",{className:"m-app",children:[s.jsx("main",{className:"m-main",children:g==="evals"||g==="issues"||g==="settings"?s.jsx("div",{className:"m-review",children:s.jsx(r.Suspense,{fallback:s.jsx("div",{className:"m-empty",children:u("common.loading")}),children:g==="settings"?s.jsx(hs,{}):g==="evals"?s.jsx(ds,{specs:e,sessions:l,issuesStamp:o,reloadBoard:m,onOpenSession:A}):s.jsx(us,{specs:e,sessions:l,issuesStamp:o,onOpenSession:A})})}):g==="specs"?s.jsxs("div",{className:"m-specs",children:[s.jsx("nav",{className:"m-crumbs",children:E.map((t,d)=>s.jsxs("span",{className:"m-crumb",children:[d>0&&s.jsx("span",{className:"m-crumb-sep",children:"›"}),s.jsx("button",{className:d===E.length-1?"m-crumb-btn cur":"m-crumb-btn",onClick:()=>x(E.slice(0,d+1)),children:b[t].title})]},t))}),C&&s.jsx(xs,{node:C,childrenOf:j,sessions:l,onOpenChild:V},C.id)]}):s.jsx(Ns,{specs:e,sessions:l,openId:n,setOpenId:v,creating:i,setCreating:a,newDraft:S,setNewDraft:y})}),s.jsxs("nav",{className:"m-tabbar",children:[s.jsxs("button",{className:g==="specs"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("specs"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"❯_"}),u("mobile.specsTab")]}),s.jsxs("button",{className:g==="sessions"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("sessions"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"◐"}),u("mobile.sessionsTab"),l.length>0&&s.jsx("span",{className:"m-tabbar-badge",children:l.length})]}),s.jsxs("button",{className:g==="evals"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("evals"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"✓"}),u("mobile.evalsTab")]}),s.jsxs("button",{className:g==="issues"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("issues"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"◎"}),u("mobile.issuesTab")]})]})]})}export{Ps as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./EvalsPage-BBabasZA.js","./index-DlgNLzN7.js","./index-CDeR37ZW.css","./Thread-De7CwTom.js","./tabs-BAAX-hgY.js","./App-EA8glWd5.js","./Modal-b-jG6-T3.js","./tabs-PFmT6UqQ.css","./IssuesPage-DZW22uek.js","./NodeView-BsvhyaG-.js","./ProseActions-DPXlFqFW.js","./Settings-BYnKTJxM.js"])))=>i.map(i=>d[i]);
2
+ import{u as P,r,j as s,_ as O,I as H}from"./index-DlgNLzN7.js";import{a9 as D,J as M,aa as $,x as K,ab as B,ac as U,ad as J,ae as Q,S as L,af as W,a2 as Z,ag as q,ah as G,I as X,K as Y,P as ss,ai as es,aj as as,ak as ns}from"./tabs-BAAX-hgY.js";import{p as ts,u as ls,S as is,H as cs,I as rs,E as os,a as ms}from"./NodeView-BsvhyaG-.js";import{n as I}from"./App-EA8glWd5.js";import"./Modal-b-jG6-T3.js";import"./Thread-De7CwTom.js";import"./ProseActions-DPXlFqFW.js";const ds=r.lazy(()=>O(()=>import("./EvalsPage-BBabasZA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),us=r.lazy(()=>O(()=>import("./IssuesPage-DZW22uek.js"),__vite__mapDeps([8,1,2,4,5,6,7,9,3,10]),import.meta.url)),hs=r.lazy(()=>O(()=>import("./Settings-BYnKTJxM.js"),__vite__mapDeps([11,1,2,5,4,6,7]),import.meta.url)),bs={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"},z=(e,l)=>l.filter(o=>{var m;return(m=o.ops)==null?void 0:m.some(c=>c.nodeId===e.id)});function R({status:e}){const l=L[e]||L.pending;return s.jsx("span",{className:"m-dot",style:{background:l.color}})}function ps({node:e,kids:l,editors:o,onTap:m}){return s.jsxs("button",{className:"m-row",onClick:m,children:[s.jsx(R,{status:e.status}),s.jsx("span",{className:"m-row-title",children:e.title}),o.length>0&&s.jsx("span",{className:"m-row-faces",children:o.slice(0,3).map(c=>s.jsx(D,{seed:c.id,status:c.status,title:M(c)},c.id))}),e.version?s.jsxs("span",{className:"m-row-ver",children:["v",e.version]}):null,l>0&&s.jsxs("span",{className:"m-row-kids",children:["▸",l]}),s.jsx("span",{className:"m-row-chev",children:"›"})]})}function xs({node:e,childrenOf:l,sessions:o,onOpenChild:m}){const c=P(),u=l(e.id),b=ts(e),h=[...u.length?[{key:"children",label:c("mobile.childrenTab",{n:u.length})}]:[],...b.map(a=>({key:a.key,label:c(bs[a.key])}))],[j,N]=r.useState(null),[p,k]=r.useState({issues:{},eval:{}});r.useEffect(()=>{N(null),k({issues:{},eval:{}})},[e.id]);const x=(a,S)=>k(y=>({...y,[a]:W(y[a],S)})),n=j&&h.some(a=>a.key===j)?j:h[0].key,v=ls(e.id,n==="history"),i=z(e,o);return s.jsxs("div",{className:"m-node",children:[s.jsxs("div",{className:"m-node-head",children:[s.jsx(R,{status:e.status}),s.jsx("span",{className:"m-node-title",children:e.title}),e.version?s.jsxs("span",{className:"m-node-ver",children:["v",e.version]}):null,s.jsx("span",{className:"m-node-status",children:c(`status.${e.status}`)}),i.length>0&&s.jsx("span",{className:"m-node-faces",title:c("mobile.liveEditors",{n:i.length}),children:i.map(a=>s.jsx(D,{seed:a.id,status:a.status,title:M(a)},a.id))})]}),e.desc&&s.jsx("div",{className:"m-node-desc",children:e.desc}),s.jsx("div",{className:"m-tabs",children:h.map(a=>s.jsx("button",{className:a.key===n?"m-tab on":"m-tab",onClick:()=>N(a.key),children:a.label},a.key))}),s.jsxs("div",{className:n==="history"?"m-pane-host fixed":"m-pane-host",children:[n==="children"&&s.jsx("div",{className:"m-children",children:u.map(a=>s.jsx(ps,{node:a,kids:l(a.id).length,editors:z(a,o),onTap:()=>m(a.id)},a.id))}),n==="spec"&&s.jsx(is,{node:e}),n==="history"&&s.jsx(cs,{node:e,rows:v}),n==="issues"&&s.jsx(rs,{node:e,sessions:o,filter:p.issues,onFilter:a=>x("issues",a)}),n==="eval"&&s.jsx(os,{node:e,sessions:o,filter:p.eval,onFilter:a=>x("eval",a)}),n==="edit"&&s.jsx(ms,{node:e})]})]})}function js({s:e,sessions:l,onBack:o}){const m=P();return s.jsxs("div",{className:"m-sessdetail chat",children:[s.jsxs("div",{className:"m-sess-card",children:[s.jsx("button",{className:"m-sess-back",onClick:o,"aria-label":m("mobile.back"),children:"‹"}),s.jsxs("div",{className:"m-sess-meta",children:[s.jsx("span",{className:"m-sess-name",children:X(e)}),s.jsxs("span",{className:"m-sess-status",style:{color:Y[e.status]},children:[m(`status.${e.status}`),e.merges?` · ×${e.merges}`:""," · ",s.jsx("span",{className:"m-sess-id8",children:e.id.slice(0,8)})]})]}),s.jsx("a",{className:"m-sess-evalbtn",href:ss(es(e.id)),title:m("sessionEval.btnTitle"),children:m("sessionEval.btn")})]}),s.jsx(as,{s:e,sessions:l})]})}function fs({draft:e,setDraft:l,onBack:o,onLaunched:m}){const c=P(),{launchers:u,launcher:b,pickLauncher:h}=Z(),[j,N]=r.useState(!1),[p,k]=r.useState(null),x=async()=>{const n=e.trim();if(!n||j)return;N(!0),k(null);const v=await ns(n,b);N(!1),v.ok?(l(""),m()):k(v.error||c("mobile.launchFailed"))};return s.jsxs("div",{className:"m-sessdetail m-new",children:[s.jsxs("div",{className:"m-sess-card",children:[s.jsx("button",{className:"m-sess-back",onClick:o,"aria-label":c("mobile.back"),children:"‹"}),s.jsx("div",{className:"m-sess-meta",children:s.jsx("span",{className:"m-sess-name",children:c("mobile.newSession")})})]}),s.jsxs("div",{className:"m-new-body",children:[s.jsx(q,{className:"m-input m-new-input",rows:5,placeholder:c("mobile.newPlaceholder"),value:e,onKeyDown:n=>{n.key!=="Enter"||n.shiftKey||G(n)||(n.preventDefault(),n.stopPropagation(),x())},onChange:n=>l(n.target.value)}),u.length>0&&s.jsxs("label",{className:"m-new-launcher",children:[s.jsx("span",{className:"m-new-launcher-label",children:c("session.launcherLabel")}),s.jsx("select",{className:"m-new-launcher-select",value:b,onChange:n=>h(n.target.value),children:u.map(n=>s.jsx("option",{value:n.name,children:n.name},n.name))})]}),p&&s.jsx("div",{className:"m-senderr",children:p}),s.jsx("button",{className:"m-send m-new-go",disabled:!e.trim()||j,onClick:x,children:c(j?"mobile.launching":"mobile.launch")})]})]})}function Ns({specs:e,sessions:l,openId:o,setOpenId:m,creating:c,setCreating:u,newDraft:b,setNewDraft:h}){const j=P(),N=o?l.find(i=>i.id===o):null,{expanded:p,toggle:k}=$(),[x,n]=r.useState(!1),v=r.useMemo(()=>K(l,i=>p.has(i),{zoneFolded:i=>i==="offline"&&!x}),[l,p,x]);return c?s.jsx(fs,{draft:b,setDraft:h,onBack:()=>u(!1),onLaunched:()=>u(!1)}):N?s.jsx(js,{s:N,sessions:l,onBack:()=>m(null)}):s.jsxs("div",{className:"m-sesslist",children:[s.jsxs("button",{className:"m-new-btn",onClick:()=>u(!0),children:[s.jsx(H,{name:"plus",size:16,strokeWidth:1.9,"aria-hidden":"true"}),s.jsx("span",{children:j("mobile.newSession")})]}),!l.length&&s.jsx("div",{className:"m-empty big",children:j("mobile.noSessions")}),v.map(i=>{if(i.type==="zone")return s.jsx(B,{item:i,baseClass:"m-zone",onToggle:()=>n(y=>!y)},`z-${i.zone}`);const a=i.s,S=i.expandable||i.depth?s.jsx(U,{guides:i.guides,expandable:i.expandable,kin:i.kin}):null;return s.jsxs("div",{className:"sess-tree-row m-sess-tree-row",style:{"--sess-fold-indent":`${i.depth*14}px`},children:[s.jsx("button",{type:"button",className:"m-sess-row",onClick:()=>m(a.id),children:s.jsx(J,{s:a,locked:!1,showAvatar:!1,lead:S})}),i.expandable&&s.jsx(Q,{expanded:i.expanded,rollup:i.rollup,kin:i.kin,onToggle:()=>k(a.id)})]},a.id)})]})}function Ps({specs:e,sessions:l,issuesStamp:o,reloadBoard:m,route:c={}}){const u=P(),b=r.useMemo(()=>Object.fromEntries(e.map(t=>[t.id,t])),[e]),h=r.useMemo(()=>e.find(t=>!t.parent)||e[0],[e]),j=r.useMemo(()=>{const t={};return e.forEach(d=>{var _;d.parent&&(t[_=d.parent]??(t[_]=[])).push(d)}),d=>t[d]||[]},[e]),[N,p]=r.useState("specs"),[k,x]=r.useState(()=>h?[h.id]:[]),[n,v]=r.useState(null),[i,a]=r.useState(!1),[S,y]=r.useState(""),{page:f="graph",param:w=null}=c,g=f==="evals"||f==="issues"||f==="settings"?f:N;r.useEffect(()=>{f==="sessions"&&w&&(p("sessions"),v(w))},[f,w]),r.useLayoutEffect(()=>{if(f!=="graph"||!w)return;if(p("specs"),!b[w]){x(h?[h.id]:[]);return}const t=[];for(let d=b[w];d;d=d.parent?b[d.parent]:null)t.unshift(d.id);x(t)},[f,w,b,h]);const T=t=>{if(t==="evals"||t==="issues"){I(t);return}p(t),(f==="evals"||f==="issues"||f==="settings")&&I(t==="specs"?"graph":"sessions")},A=t=>{p("sessions"),v(t),I("sessions",t)},E=k.filter(t=>b[t]),F=E[E.length-1]||(h==null?void 0:h.id),C=F?b[F]:null,V=t=>x(d=>[...d.filter(_=>b[_]),t]);return s.jsxs("div",{className:"m-app",children:[s.jsx("main",{className:"m-main",children:g==="evals"||g==="issues"||g==="settings"?s.jsx("div",{className:"m-review",children:s.jsx(r.Suspense,{fallback:s.jsx("div",{className:"m-empty",children:u("common.loading")}),children:g==="settings"?s.jsx(hs,{}):g==="evals"?s.jsx(ds,{specs:e,sessions:l,issuesStamp:o,reloadBoard:m,onOpenSession:A}):s.jsx(us,{specs:e,sessions:l,issuesStamp:o,onOpenSession:A})})}):g==="specs"?s.jsxs("div",{className:"m-specs",children:[s.jsx("nav",{className:"m-crumbs",children:E.map((t,d)=>s.jsxs("span",{className:"m-crumb",children:[d>0&&s.jsx("span",{className:"m-crumb-sep",children:"›"}),s.jsx("button",{className:d===E.length-1?"m-crumb-btn cur":"m-crumb-btn",onClick:()=>x(E.slice(0,d+1)),children:b[t].title})]},t))}),C&&s.jsx(xs,{node:C,childrenOf:j,sessions:l,onOpenChild:V},C.id)]}):s.jsx(Ns,{specs:e,sessions:l,openId:n,setOpenId:v,creating:i,setCreating:a,newDraft:S,setNewDraft:y})}),s.jsxs("nav",{className:"m-tabbar",children:[s.jsxs("button",{className:g==="specs"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("specs"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"❯_"}),u("mobile.specsTab")]}),s.jsxs("button",{className:g==="sessions"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("sessions"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"◐"}),u("mobile.sessionsTab"),l.length>0&&s.jsx("span",{className:"m-tabbar-badge",children:l.length})]}),s.jsxs("button",{className:g==="evals"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("evals"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"✓"}),u("mobile.evalsTab")]}),s.jsxs("button",{className:g==="issues"?"m-tabbar-btn on":"m-tabbar-btn",onClick:()=>T("issues"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"◎"}),u("mobile.issuesTab")]})]})]})}export{Ps as default};
@@ -1 +1 @@
1
- import{r as b,j as i,a as L}from"./index-DkZ_7FOT.js";import{N as k}from"./App-DI39ygL3.js";let w=null;const T=e=>!!(e&&e.closest&&e.closest("[data-focus-overlay]")),P=e=>e!=null&&e.getClientRects().length?typeof e.checkVisibility=="function"?e.checkVisibility({visibilityProperty:!0}):getComputedStyle(e).visibility!=="hidden"&&getComputedStyle(e).display!=="none":!1,E=e=>!!(e&&e.isConnected&&!e.disabled&&P(e));typeof window<"u"&&window.addEventListener("focusin",e=>{const t=e.target;t&&t!==document.body&&!T(t)&&(w=t)},!0);function R(){requestAnimationFrame(()=>{if(T(document.activeElement))return;if(E(w)){w.focus();return}const e=[...document.querySelectorAll("[data-focus-sink]")].find(E);E(e)&&e.focus()})}const N='input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm',$="[data-selectable]",j=(e,t)=>{if(!(e instanceof HTMLElement))return!1;const s=e.getBoundingClientRect();return t.clientX-s.left-e.clientLeft>=e.clientWidth||t.clientY-s.top-e.clientTop>=e.clientHeight};function I(e){const t=e.target;t instanceof Element&&(t.closest(N)||t.closest($)||j(t,e)||e.preventDefault())}const A="spex.page-scroll:",C=()=>typeof window>"u"?"":`${window.location.pathname}${window.location.search}${window.location.hash}`,F=e=>{try{return Number(sessionStorage.getItem(`${A}${e}`))||0}catch{return 0}},y=(e,t)=>{try{sessionStorage.setItem(`${A}${e}`,String(t))}catch{}};function _({className:e="",scrollKey:t,children:s,...d}){const p=k(),o=t??p??C(),x=b.useRef(null);return b.useLayoutEffect(()=>{const n=x.current;if(!n)return;const a=F(o);let l=a,f=a>0,g=0,r=0,u;const v=()=>{f=!1,r&&cancelAnimationFrame(r),r=0,u==null||u.disconnect()},m=()=>{if(r=0,!f)return;const S=Math.max(0,n.scrollHeight-n.clientHeight);if(n.scrollTop=Math.min(a,S),S<a){g=0;return}if(Math.abs(n.scrollTop-a)>1){g=0,r=requestAnimationFrame(m);return}l=n.scrollTop,y(o,l),++g<2?r=requestAnimationFrame(m):v()},h=()=>{f||(l=n.scrollTop,y(o,l))},c=()=>{v(),h()};return n.scrollTop=a,f&&(u=new MutationObserver(()=>{r||(r=requestAnimationFrame(m))}),u.observe(n,{childList:!0,subtree:!0,characterData:!0}),r=requestAnimationFrame(m)),n.addEventListener("scroll",h,{passive:!0}),n.addEventListener("pointerdown",c,!0),n.addEventListener("wheel",c,{passive:!0,capture:!0}),n.addEventListener("keydown",c,!0),()=>{n.removeEventListener("scroll",h),n.removeEventListener("pointerdown",c,!0),n.removeEventListener("wheel",c,!0),n.removeEventListener("keydown",c,!0),v(),y(o,l)}},[o]),i.jsx("div",{ref:x,className:`page-scroll${e?` ${e}`:""}`,...d,children:s})}function G({title:e,closeLabel:t,onClose:s,className:d,children:p}){return b.useEffect(()=>()=>R(),[]),i.jsx("div",{className:"legend-backdrop","data-focus-overlay":!0,onClick:s,children:i.jsxs("div",{className:d?`legend ${d}`:"legend",role:"dialog","aria-modal":"true","aria-label":e,onClick:o=>o.stopPropagation(),children:[i.jsxs("div",{className:"legend-head",children:[i.jsx("span",{className:"legend-title",children:e}),i.jsx(L,{icon:"x",size:13,className:"legend-close",label:t,onClick:s})]}),i.jsx("div",{className:"legend-body",children:p})]})})}export{G as M,_ as P,I as i,R as r};
1
+ import{r as b,j as i,a as L}from"./index-DlgNLzN7.js";import{N as k}from"./App-EA8glWd5.js";let w=null;const T=e=>!!(e&&e.closest&&e.closest("[data-focus-overlay]")),P=e=>e!=null&&e.getClientRects().length?typeof e.checkVisibility=="function"?e.checkVisibility({visibilityProperty:!0}):getComputedStyle(e).visibility!=="hidden"&&getComputedStyle(e).display!=="none":!1,E=e=>!!(e&&e.isConnected&&!e.disabled&&P(e));typeof window<"u"&&window.addEventListener("focusin",e=>{const t=e.target;t&&t!==document.body&&!T(t)&&(w=t)},!0);function R(){requestAnimationFrame(()=>{if(T(document.activeElement))return;if(E(w)){w.focus();return}const e=[...document.querySelectorAll("[data-focus-sink]")].find(E);E(e)&&e.focus()})}const N='input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm',$="[data-selectable]",j=(e,t)=>{if(!(e instanceof HTMLElement))return!1;const s=e.getBoundingClientRect();return t.clientX-s.left-e.clientLeft>=e.clientWidth||t.clientY-s.top-e.clientTop>=e.clientHeight};function I(e){const t=e.target;t instanceof Element&&(t.closest(N)||t.closest($)||j(t,e)||e.preventDefault())}const A="spex.page-scroll:",C=()=>typeof window>"u"?"":`${window.location.pathname}${window.location.search}${window.location.hash}`,F=e=>{try{return Number(sessionStorage.getItem(`${A}${e}`))||0}catch{return 0}},y=(e,t)=>{try{sessionStorage.setItem(`${A}${e}`,String(t))}catch{}};function _({className:e="",scrollKey:t,children:s,...d}){const p=k(),o=t??p??C(),x=b.useRef(null);return b.useLayoutEffect(()=>{const n=x.current;if(!n)return;const a=F(o);let l=a,f=a>0,g=0,r=0,u;const v=()=>{f=!1,r&&cancelAnimationFrame(r),r=0,u==null||u.disconnect()},m=()=>{if(r=0,!f)return;const S=Math.max(0,n.scrollHeight-n.clientHeight);if(n.scrollTop=Math.min(a,S),S<a){g=0;return}if(Math.abs(n.scrollTop-a)>1){g=0,r=requestAnimationFrame(m);return}l=n.scrollTop,y(o,l),++g<2?r=requestAnimationFrame(m):v()},h=()=>{f||(l=n.scrollTop,y(o,l))},c=()=>{v(),h()};return n.scrollTop=a,f&&(u=new MutationObserver(()=>{r||(r=requestAnimationFrame(m))}),u.observe(n,{childList:!0,subtree:!0,characterData:!0}),r=requestAnimationFrame(m)),n.addEventListener("scroll",h,{passive:!0}),n.addEventListener("pointerdown",c,!0),n.addEventListener("wheel",c,{passive:!0,capture:!0}),n.addEventListener("keydown",c,!0),()=>{n.removeEventListener("scroll",h),n.removeEventListener("pointerdown",c,!0),n.removeEventListener("wheel",c,!0),n.removeEventListener("keydown",c,!0),v(),y(o,l)}},[o]),i.jsx("div",{ref:x,className:`page-scroll${e?` ${e}`:""}`,...d,children:s})}function G({title:e,closeLabel:t,onClose:s,className:d,children:p}){return b.useEffect(()=>()=>R(),[]),i.jsx("div",{className:"legend-backdrop","data-focus-overlay":!0,onClick:s,children:i.jsxs("div",{className:d?`legend ${d}`:"legend",role:"dialog","aria-modal":"true","aria-label":e,onClick:o=>o.stopPropagation(),children:[i.jsxs("div",{className:"legend-head",children:[i.jsx("span",{className:"legend-title",children:e}),i.jsx(L,{icon:"x",size:13,className:"legend-close",label:t,onClick:s})]}),i.jsx("div",{className:"legend-body",children:p})]})})}export{G as M,_ as P,I as i,R as r};
@@ -1,3 +1,3 @@
1
- import{j as e,r as v,al as Q,u as f,I as $,h as re,m as ce}from"./index-DkZ_7FOT.js";import{T as oe,R as de,P as y,am as he,Q as Y,N as J,aR as X,aS as Z,a5 as ee,aD as ue,aT as pe,aU as me,aV as ve,k as I,aW as fe,aI as xe,U as je,aX as k,af as Ne}from"./tabs-Dv9P0FBJ.js";import{f as se,E as L,c as ge,e as we}from"./Thread-UIOe-Brh.js";import{r as R,d as be,O as ye,S as U}from"./App-DI39ygL3.js";import{u as Ve,l as q,P as ke}from"./ProseActions-3FcAR01Y.js";const M=s=>{const a=String(s||"").trim().replace(/^#/,"");return/^(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(a)?`#${(a.length===3?[...a].map(n=>`${n}${n}`).join(""):a).toLowerCase()}`:null},Le=s=>{const a=[1,3,5].map(t=>parseInt(s.slice(t,t+2),16));return(a[0]*299+a[1]*587+a[2]*114)/1e3>=150?"#1f2328":"#ffffff"};function Se({labels:s,onSelect:a=null}){return!Array.isArray(s)||!s.length?null:e.jsx("span",{className:"issue-labels",children:s.map((t,n)=>{const i=typeof t=="string"?{name:t}:t||{},l=String(i.name||"").trim();if(!l)return null;const c=M(i.color),o=M(i.textColor)||(c?Le(c):null),u=c?{"--issue-label-bg":c,"--issue-label-fg":o,"--issue-label-border":c}:void 0,x={key:`${l}-${n}`,className:`issue-label${a?" selectable":""}`,style:u,title:l};return a?e.jsx("button",{type:"button",...x,onClick:()=>a(l),children:l}):e.jsx("span",{...x,children:l})})})}function O({issue:s,onNavigateAddress:a}){const t=(s==null?void 0:s.store)||"local",n=(s==null?void 0:s.status)||"open",i=oe(s.id);return e.jsxs("a",{className:"issue-card",href:y(i),"data-tip":s.concern||s.id,onClick:a?l=>{l.defaultPrevented||l.button!==0||l.metaKey||l.ctrlKey||l.shiftKey||l.altKey||(l.preventDefault(),a(i))}:void 0,children:[e.jsxs("span",{className:"issue-card-top",children:[e.jsx("span",{className:"issue-num",children:s.id}),e.jsx("span",{className:`fv-store fv-store-${t==="local"?"local":"forge"}`,children:t}),e.jsx(de,{kind:"issue",state:n,showLabel:!0,size:12,className:"issue-card-state"})]}),e.jsx("span",{className:"issue-card-title",children:s.concern}),e.jsx(Se,{labels:s.labels})]})}const G=[{key:"spec",label:"spec"},{key:"history",label:"history"},{key:"issues",label:"issues"},{key:"eval",label:"eval"}];function Ee(s,a=!1){var t;return a?[{key:"spec",label:"spec"}]:(t=s==null?void 0:s.overlays)!=null&&t.length?[{key:"edit",label:"edit"},...G]:G}const ae=(s,a,t={})=>{let n=`${s==="issue"?"is:issue":ye}${t.q?` ${String(t.q).trim()}`:""}`.trim();const i=s==="issue"?{state:"state",author:"author",store:"store",session:"session"}:{verdict:"verdict",review:"state",freshness:"freshness",kind:"evidence",filer:"filer",session:"session"};for(const[l,c]of Object.entries(i))t[l]&&(n=U(n,c,t[l]));return U(n,"node",a)},$e={state:"reviewList.facetState",verdict:"reviewList.facetVerdict",author:"reviewList.facetAuthor",store:"reviewList.facetStore",review:"reviewList.facetReview",freshness:"reviewList.facetFreshness",kind:"reviewList.facetKind",filer:"reviewList.facetFiler",session:"reviewList.facetSession"},ne=(s,a)=>{const t=n=>n&&{...n,label:a($e[n.key]||n.label||n.key)};return{section:t(s==null?void 0:s.section),facets:Object.fromEntries(Object.entries((s==null?void 0:s.facets)||{}).map(([n,i])=>[n,t(i)]))}};function C({body:s,lineBase:a=0}){if(!s)return null;const{source:t,removedLines:n}=pe(s),i=a>0?a+n:0;return e.jsx(me,{className:"doc-body",lineBase:i,renderSpecRef:(l,c,o)=>{const u=R("spec",l);return e.jsx("a",{className:"doc-link",href:u,...o,onClick:x=>I(x,u),children:l})},renderEvidence:(l,c,o)=>e.jsx("span",{className:"rich-evidence","data-evidence-hash":l.hash,...o,children:e.jsx(ve,{hash:l.hash,alt:l.alt})}),children:t})}function z({kind:s,title:a,owner:t,ownerLabel:n,note:i,children:l}){return e.jsxs("section",{className:`spec-part part-${s}`,children:[e.jsxs("header",{className:"part-head",children:[e.jsx("span",{className:"part-title",children:a}),e.jsx("span",{className:`part-owner owner-${t}`,children:n}),i&&e.jsx("span",{className:"part-note",children:i})]}),e.jsx("div",{className:"part-body",children:l})]})}function Ce({parts:s,body:a}){const t=f(),n=q(a,s.rawSource),i=q(a,s.expandedSpec);return e.jsxs("div",{className:"spec-parts",children:[e.jsx(z,{kind:"raw",title:t("nodeView.rawTitle"),owner:"human",ownerLabel:t("nodeView.rawOwner"),note:t("nodeView.rawNote"),children:e.jsx(C,{body:s.rawSource,lineBase:(n==null?void 0:n.startLine)||0})}),e.jsx(z,{kind:"expanded",title:t("nodeView.expandedTitle"),owner:"agent",ownerLabel:t("nodeView.expandedOwner"),note:t("nodeView.expandedNote"),children:e.jsx(C,{body:s.expandedSpec,lineBase:(i==null?void 0:i.startLine)||0})})]})}function Ie({files:s,count:a}){const t=f(),n=i=>i.split("#")[0];return e.jsxs("div",{className:"doc-gov",children:[e.jsxs("span",{className:"doc-gov-h",children:[t("nodeView.governs")," ",e.jsx("b",{children:a})]}),e.jsx("div",{className:"doc-gov-files",children:s.map(i=>{const l=n(i),c=R("file",l);return e.jsx("a",{className:"gov-f",href:c,onClick:o=>I(o,c),children:i},i)})})]})}const Re=(s,a)=>`.spec/${s}/${a}`;function Te({nodeId:s,enabled:a}){const t=f(),[n,i]=v.useState(null);return v.useEffect(()=>{if(!a)return;let l=!0;return re(s).then(c=>l&&i(c)).catch(()=>l&&i([])),()=>{l=!1}},[s,a]),n!=null&&n.length?e.jsxs("div",{className:"doc-gov doc-att",children:[e.jsxs("span",{className:"doc-gov-h",children:[t("nodeView.carries")," ",e.jsx("b",{children:n.length})]}),e.jsx("div",{className:"doc-gov-files",children:n.map(l=>{const c=R("file",Re(s,l.name));return e.jsx("a",{className:"gov-f",href:c,"data-tip":`${(l.size/1024).toFixed(1)} KB`,onClick:o=>I(o,c),children:l.name},l.name)})})]}):null}function De({node:s,graphOnly:a=!1}){var l,c;const t=f(),n=Ve(s.id,s.version,{embedded:s.body!=null,publicGraph:a}),i=(s.driftFiles||[]).map(o=>`${o.file}: ${t("specNode.driftAhead",{n:o.behind})}`).join(`
1
+ import{j as e,r as v,al as Q,u as f,I as $,h as re,m as ce}from"./index-DlgNLzN7.js";import{T as oe,R as de,P as y,am as he,Q as Y,N as J,aR as X,aS as Z,a5 as ee,aD as ue,aT as pe,aU as me,aV as ve,k as I,aW as fe,aI as xe,U as je,aX as k,af as Ne}from"./tabs-BAAX-hgY.js";import{f as se,E as L,c as ge,e as we}from"./Thread-De7CwTom.js";import{r as R,d as be,O as ye,S as U}from"./App-EA8glWd5.js";import{u as Ve,l as q,P as ke}from"./ProseActions-DPXlFqFW.js";const M=s=>{const a=String(s||"").trim().replace(/^#/,"");return/^(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(a)?`#${(a.length===3?[...a].map(n=>`${n}${n}`).join(""):a).toLowerCase()}`:null},Le=s=>{const a=[1,3,5].map(t=>parseInt(s.slice(t,t+2),16));return(a[0]*299+a[1]*587+a[2]*114)/1e3>=150?"#1f2328":"#ffffff"};function Se({labels:s,onSelect:a=null}){return!Array.isArray(s)||!s.length?null:e.jsx("span",{className:"issue-labels",children:s.map((t,n)=>{const i=typeof t=="string"?{name:t}:t||{},l=String(i.name||"").trim();if(!l)return null;const c=M(i.color),o=M(i.textColor)||(c?Le(c):null),u=c?{"--issue-label-bg":c,"--issue-label-fg":o,"--issue-label-border":c}:void 0,x={key:`${l}-${n}`,className:`issue-label${a?" selectable":""}`,style:u,title:l};return a?e.jsx("button",{type:"button",...x,onClick:()=>a(l),children:l}):e.jsx("span",{...x,children:l})})})}function O({issue:s,onNavigateAddress:a}){const t=(s==null?void 0:s.store)||"local",n=(s==null?void 0:s.status)||"open",i=oe(s.id);return e.jsxs("a",{className:"issue-card",href:y(i),"data-tip":s.concern||s.id,onClick:a?l=>{l.defaultPrevented||l.button!==0||l.metaKey||l.ctrlKey||l.shiftKey||l.altKey||(l.preventDefault(),a(i))}:void 0,children:[e.jsxs("span",{className:"issue-card-top",children:[e.jsx("span",{className:"issue-num",children:s.id}),e.jsx("span",{className:`fv-store fv-store-${t==="local"?"local":"forge"}`,children:t}),e.jsx(de,{kind:"issue",state:n,showLabel:!0,size:12,className:"issue-card-state"})]}),e.jsx("span",{className:"issue-card-title",children:s.concern}),e.jsx(Se,{labels:s.labels})]})}const G=[{key:"spec",label:"spec"},{key:"history",label:"history"},{key:"issues",label:"issues"},{key:"eval",label:"eval"}];function Ee(s,a=!1){var t;return a?[{key:"spec",label:"spec"}]:(t=s==null?void 0:s.overlays)!=null&&t.length?[{key:"edit",label:"edit"},...G]:G}const ae=(s,a,t={})=>{let n=`${s==="issue"?"is:issue":ye}${t.q?` ${String(t.q).trim()}`:""}`.trim();const i=s==="issue"?{state:"state",author:"author",store:"store",session:"session"}:{verdict:"verdict",review:"state",freshness:"freshness",kind:"evidence",filer:"filer",session:"session"};for(const[l,c]of Object.entries(i))t[l]&&(n=U(n,c,t[l]));return U(n,"node",a)},$e={state:"reviewList.facetState",verdict:"reviewList.facetVerdict",author:"reviewList.facetAuthor",store:"reviewList.facetStore",review:"reviewList.facetReview",freshness:"reviewList.facetFreshness",kind:"reviewList.facetKind",filer:"reviewList.facetFiler",session:"reviewList.facetSession"},ne=(s,a)=>{const t=n=>n&&{...n,label:a($e[n.key]||n.label||n.key)};return{section:t(s==null?void 0:s.section),facets:Object.fromEntries(Object.entries((s==null?void 0:s.facets)||{}).map(([n,i])=>[n,t(i)]))}};function C({body:s,lineBase:a=0}){if(!s)return null;const{source:t,removedLines:n}=pe(s),i=a>0?a+n:0;return e.jsx(me,{className:"doc-body",lineBase:i,renderSpecRef:(l,c,o)=>{const u=R("spec",l);return e.jsx("a",{className:"doc-link",href:u,...o,onClick:x=>I(x,u),children:l})},renderEvidence:(l,c,o)=>e.jsx("span",{className:"rich-evidence","data-evidence-hash":l.hash,...o,children:e.jsx(ve,{hash:l.hash,alt:l.alt})}),children:t})}function z({kind:s,title:a,owner:t,ownerLabel:n,note:i,children:l}){return e.jsxs("section",{className:`spec-part part-${s}`,children:[e.jsxs("header",{className:"part-head",children:[e.jsx("span",{className:"part-title",children:a}),e.jsx("span",{className:`part-owner owner-${t}`,children:n}),i&&e.jsx("span",{className:"part-note",children:i})]}),e.jsx("div",{className:"part-body",children:l})]})}function Ce({parts:s,body:a}){const t=f(),n=q(a,s.rawSource),i=q(a,s.expandedSpec);return e.jsxs("div",{className:"spec-parts",children:[e.jsx(z,{kind:"raw",title:t("nodeView.rawTitle"),owner:"human",ownerLabel:t("nodeView.rawOwner"),note:t("nodeView.rawNote"),children:e.jsx(C,{body:s.rawSource,lineBase:(n==null?void 0:n.startLine)||0})}),e.jsx(z,{kind:"expanded",title:t("nodeView.expandedTitle"),owner:"agent",ownerLabel:t("nodeView.expandedOwner"),note:t("nodeView.expandedNote"),children:e.jsx(C,{body:s.expandedSpec,lineBase:(i==null?void 0:i.startLine)||0})})]})}function Ie({files:s,count:a}){const t=f(),n=i=>i.split("#")[0];return e.jsxs("div",{className:"doc-gov",children:[e.jsxs("span",{className:"doc-gov-h",children:[t("nodeView.governs")," ",e.jsx("b",{children:a})]}),e.jsx("div",{className:"doc-gov-files",children:s.map(i=>{const l=n(i),c=R("file",l);return e.jsx("a",{className:"gov-f",href:c,onClick:o=>I(o,c),children:i},i)})})]})}const Re=(s,a)=>`.spec/${s}/${a}`;function Te({nodeId:s,enabled:a}){const t=f(),[n,i]=v.useState(null);return v.useEffect(()=>{if(!a)return;let l=!0;return re(s).then(c=>l&&i(c)).catch(()=>l&&i([])),()=>{l=!1}},[s,a]),n!=null&&n.length?e.jsxs("div",{className:"doc-gov doc-att",children:[e.jsxs("span",{className:"doc-gov-h",children:[t("nodeView.carries")," ",e.jsx("b",{children:n.length})]}),e.jsx("div",{className:"doc-gov-files",children:n.map(l=>{const c=R("file",Re(s,l.name));return e.jsx("a",{className:"gov-f",href:c,"data-tip":`${(l.size/1024).toFixed(1)} KB`,onClick:o=>I(o,c),children:l.name},l.name)})})]}):null}function De({node:s,graphOnly:a=!1}){var l,c;const t=f(),n=Ve(s.id,s.version,{embedded:s.body!=null,publicGraph:a}),i=(s.driftFiles||[]).map(o=>`${o.file}: ${t("specNode.driftAhead",{n:o.behind})}`).join(`
2
2
  `);return e.jsxs("div",{className:"pane-doc",children:[e.jsx("h1",{className:"doc-title",children:s.title}),e.jsx("blockquote",{className:"doc-desc",children:s.desc}),e.jsxs("div",{className:"doc-stat",children:[e.jsxs("span",{className:`stat-status st-${s.status}`,"data-tip":t("nodeView.statusLabel"),children:[e.jsx("i",{className:"stat-dot"}),t(`status.${s.status}`)]}),e.jsxs("span",{className:"stat-chip","data-tip":t("nodeView.versionLabel"),children:["v",s.version||0]}),e.jsx(he,{summary:(l=s.reviewSummary)==null?void 0:l.evals,href:y(Y(s.id))}),s.drift>0&&e.jsxs("span",{className:"stat-chip stat-drift","data-tip":i,children:["⚠",s.drift]}),e.jsxs("span",{className:"stat-sess","data-tip":t("nodeView.lastEditedBy"),children:["✎ ",e.jsx("b",{children:s.session||t("common.none")})]})]}),((c=s.code)==null?void 0:c.length)>0?e.jsx(Ie,{files:s.code,count:s.code.length}):e.jsx("div",{className:"doc-gov prose",children:e.jsx("span",{className:"doc-gov-h",children:t("nodeView.proseNode")})}),!a&&e.jsx(Te,{nodeId:s.id,enabled:!0}),(()=>{if(n===null&&s.body==null)return e.jsx("div",{className:"pane-loading",children:e.jsx("span",{className:"spinner","aria-label":t("common.loading")})});const o=s.body??(n==null?void 0:n.body)??"",u=s.parts??(n==null?void 0:n.parts)??null;return u?e.jsx(Ce,{parts:u,body:o}):e.jsx(C,{body:o,lineBase:1})})()]})}function Fe(s,a=!0){const[t,n]=v.useState(null);return v.useEffect(()=>{if(!a)return;let i=!0;return fetch(Q(s,"history")).then(l=>l.json()).then(l=>{i&&n(l)}).catch(()=>i&&n([])),()=>{i=!1}},[s,a]),t}const S=new Map;function Pe(s,a,t){const n=`${s}/${a}`,[i,l]=v.useState(()=>S.get(n)??null);return v.useEffect(()=>{const c=S.get(n);if(c){l(c);return}let o=!0;return fetch(Q(s,"diff",a)).then(u=>u.json()).then(u=>{S.set(n,u),o&&l(u)}).catch(()=>o&&l({patch:""})),()=>{o=!1}},[s,a,t,n]),i}function Ae(s){const a=[];let t=!1;for(const n of s.split(`
3
3
  `)){if(n.startsWith("@@")){t=!0,a.push({t:"hunk",s:n});continue}!t||n.startsWith("\\")||(n.startsWith("+")?a.push({t:"add",s:n.slice(1)}):n.startsWith("-")?a.push({t:"del",s:n.slice(1)}):a.push({t:"ctx",s:n.slice(1)}))}for(;a.length&&a[a.length-1].t==="ctx"&&a[a.length-1].s==="";)a.pop();return a}function te({diff:s}){const a=f();if(s==null)return e.jsx("figcaption",{className:"ev-note",children:a("nodeView.loadingChange")});const t=s.patch?Ae(s.patch):[];return t.length?e.jsxs(e.Fragment,{children:[e.jsx("figcaption",{className:"ev-difflabel",children:a("nodeView.diffLabel")}),e.jsx("pre",{className:"ev-diff",children:t.map((n,i)=>e.jsx("div",{className:`dl dl-${n.t}`,children:n.s||" "},i))})]}):e.jsx("figcaption",{className:"ev-note",children:a("nodeView.noChange")})}function ie({items:s,itemKey:a,classes:t,rowClass:n,renderHeader:i,renderEvidence:l,renderAction:c,leading:o,trailing:u,resetKey:x}){const j=v.useRef(null),[g,w]=v.useState(()=>new Set([0]));v.useEffect(()=>{x!==void 0&&w(new Set([0]))},[x]);const b=v.useCallback(d=>w(r=>{const h=new Set(r);return h.has(d)?h.delete(d):h.add(d),h}),[]),N=v.useCallback(()=>w(d=>{const r=j.current;if(!r)return d;let h=-1;for(;d.has(h+1);)h++;if(h<0||h>=s.length-1)return d;const p=r.querySelector(`[data-i="${h}"]`);return!p||p.getBoundingClientRect().bottom-r.getBoundingClientRect().top>r.clientHeight+40?d:new Set(d).add(h+1)}),[s]);return v.useEffect(()=>{const d=j.current;if(!d)return;let r=d.scrollTop;const h=()=>{const p=d.scrollTop,V=p>r;r=p,V&&N()};return d.addEventListener("scroll",h,{passive:!0}),()=>d.removeEventListener("scroll",h)},[N]),be(d=>{if(d.key!=="j"&&d.key!=="ArrowDown")return!1;const r=j.current;return!r||r.scrollHeight-r.clientHeight-r.scrollTop>1?!1:(d.preventDefault(),N(),!0)},5),e.jsxs("div",{className:t.pane,ref:j,children:[o,s.map((d,r)=>{const h=g.has(r),p=n?n(d,r):"";return e.jsxs("div",{"data-i":r,className:`${t.row}${p?` ${p}`:""}${h?" open":""}`,children:[e.jsx("button",{className:t.head,onClick:()=>b(r),"aria-expanded":h,children:i(d,r,h)}),c==null?void 0:c(d,r),h&&e.jsx("figure",{className:t.evidence,children:l(d,r)})]},a(d,r))}),u]})}function Be({node:s,r:a,latest:t}){const n=Pe(s.id,a.hash,!0);return e.jsx(te,{diff:n})}function He({node:s,rows:a}){const t=f();return a?a.length?e.jsx(ie,{items:a,itemKey:n=>n.hash,classes:{pane:"pane-hist",row:"ver-row",head:"rec-toggle",evidence:"rec-evidence"},rowClass:(n,i)=>i===0?"latest":"",renderHeader:(n,i,l)=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rec-head",children:[e.jsx("span",{className:"rec-caret",children:l?"▾":"▸"}),e.jsxs("span",{className:"rec-v",children:["v",a.length-i]}),e.jsx("code",{className:"rec-hash",children:n.hash.slice(0,7)}),e.jsx("span",{className:"rec-date",children:(n.date||"").slice(0,10)}),e.jsxs("span",{className:"rec-diff",children:[e.jsxs("b",{className:"rec-add",children:["+",n.additions??0]}),e.jsxs("b",{className:"rec-del",children:["−",n.deletions??0]})]})]}),e.jsx("div",{className:"rec-msg",children:n.reason}),e.jsxs("div",{className:"rec-sub",children:[t("nodeView.filesChanged",{n:n.files??0})," · ",n.session||t("common.idle")]})]}),renderEvidence:(n,i)=>e.jsx(Be,{node:s,r:n,latest:i===0})}):e.jsx("div",{className:"pane-hist empty",children:t("common.noVersions")}):e.jsx("div",{className:"pane-hist empty",children:t("nodeView.loadingHistory")})}function Ke({node:s,sessions:a=[],filter:t={},onFilter:n=()=>{}}){var b,N,d,r,h;const i=f(),l=ae("issue",s.id,t),c=J("issues",l,1,{pollMs:0});if(c.loading)return e.jsx("div",{className:"pane-issues pane-loading",children:e.jsx("span",{className:"spinner","aria-label":i("common.loading")})});if(c.error)return e.jsx("div",{className:"pane-issues empty",children:c.error});const o=((b=c.data)==null?void 0:b.items)||[],u=(((d=(N=s.reviewSummary)==null?void 0:N.issues)==null?void 0:d.open)||0)+(((h=(r=s.reviewSummary)==null?void 0:r.issues)==null?void 0:h.closed)||0);if(!u)return e.jsx("div",{className:"pane-issues empty",children:i("nodeView.noIssues")});const x=ne(c.data,i),j=o.filter(p=>p.status==="open"),g=o.filter(p=>p.status!=="open"),w=se(x,n,["section","author","store","session"]);return e.jsxs("div",{className:"pane-issues",children:[u>4&&e.jsx(X,{value:t.q||"",onChange:p=>n({q:p||null}),summary:{shown:o.length,total:c.data.total},placeholder:i("nodeView.filterIssues"),searchLabel:i("reviewList.searchIssues"),filterLabel:i("reviewList.filters"),clearLabel:i("reviewList.all"),clearSearchLabel:i("reviewList.clearSearch"),groups:w}),!o.length&&e.jsx("div",{className:"pane-filter-none",children:i("nodeView.filterNone")}),j.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"issue-group-head",children:i("nodeView.openIssues",{n:j.length})}),j.map(p=>e.jsx(O,{issue:p},p.id))]}),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"issue-group-head closed",children:i("nodeView.closedIssues",{n:g.length})}),g.map(p=>e.jsx(O,{issue:p},p.id))]}),c.data.total>o.length&&e.jsxs("a",{className:"pane-view-all",href:y(Z("issues",l)),children:[i("reviewList.showing",{shown:o.length,total:c.data.total})," ",e.jsx($,{name:"chevron-right",size:13})]})]})}const E=new Map;function Ue(s,a,t){const n=`${s} ${a}`,[i,l]=v.useState(()=>E.get(n)??null);return v.useEffect(()=>{if(!s||!a)return;const c=E.get(n);c&&l(c);let o=!0;return fetch(ce(`/api/edit?source=${encodeURIComponent(s)}&path=${encodeURIComponent(a)}`)).then(u=>u.json()).then(u=>{E.set(n,u),o&&l(u)}).catch(()=>o&&l(u=>u??{patch:""})),()=>{o=!1}},[s,a,t,n]),i}function qe({node:s,ov:a}){const t=f(),n=Ue(a.source,s.path,!0);return e.jsxs("figure",{className:"edit-rev",children:[e.jsxs("figcaption",{className:"edit-by",children:[e.jsx("span",{className:`ov-mark ov-${a.op}`,children:je[a.op]||"•"}),e.jsx("span",{className:"edit-by-label",children:a.label}),e.jsx("span",{className:"edit-state",children:a.committed?t("nodeView.editCommitted"):t("nodeView.editDirty")})]}),e.jsx(te,{diff:n})]})}function Me({node:s}){const a=f(),t=s.overlays||[];return t.length?e.jsx("div",{className:"pane-edit",children:t.map((n,i)=>e.jsx(qe,{node:s,ov:n},i))}):e.jsx("div",{className:"pane-edit empty",children:a("nodeView.noEdit")})}function Oe({verdict:s}){const a=f();return s?s.status==="pass"?e.jsx("span",{className:"eval-verdict pass",children:a("nodeView.eval.pass")}):s.status==="fail"?e.jsx("span",{className:"eval-verdict fail",children:a("nodeView.eval.fail")}):e.jsx("span",{className:"eval-verdict note","data-tip":s.note,children:a("nodeView.eval.note")}):e.jsx("span",{className:"eval-verdict legacy",children:a("nodeView.eval.legacy")})}function Ge({r:s}){var n;const a=f(),t=we(s);return e.jsxs(e.Fragment,{children:[s.expected&&e.jsxs("div",{className:"eval-expected",children:[e.jsx("span",{className:"eval-expected-label",children:a("nodeView.eval.expected")})," ",s.expected]}),((n=s.verdict)==null?void 0:n.note)&&e.jsxs("div",{className:"eval-note",children:[e.jsx("span",{className:"eval-expected-label",children:a("nodeView.eval.noteLabel")})," ",s.verdict.note]}),t.length>0?e.jsx("div",{className:"eval-gallery",style:{display:"flex",flexDirection:"column",gap:8},children:t.map((i,l)=>e.jsx(xe,{e:i,alt:a("nodeView.eval.shotAlt",{scenario:s.scenario})},`${i.hash}-${l}`))}):e.jsx("figcaption",{className:"eval-noimg",children:s.blobState==="miss"?a("nodeView.eval.miss"):a("nodeView.eval.noImage")})]})}function _({s}){var t;const a=f();return e.jsxs("div",{className:"eval-row eval-declared-row",children:[e.jsxs("span",{className:"eval-top",children:[e.jsx(ee,{state:"empty",title:a("score.missing")}),e.jsx("span",{className:"eval-scenario",children:s.name}),e.jsx(fe,{tags:s.tags}),((t=s.code)==null?void 0:t.length)>0&&e.jsx("code",{className:"eval-tracks",children:s.code.join(", ")})]}),s.expected&&e.jsxs("div",{className:"eval-expected",children:[e.jsx("span",{className:"eval-expected-label",children:a("nodeView.eval.expected")})," ",s.expected]})]})}function W({track:s}){const a=f();return e.jsxs("div",{className:"eval-row eval-dangling-row",children:[e.jsxs("span",{className:"eval-top",children:[e.jsx("span",{className:"eval-dangling-badge","data-tip":a("nodeView.eval.danglingTitle"),children:"⚠"}),e.jsx("span",{className:"eval-scenario eval-dangling-name",children:s.scenario}),e.jsx("span",{className:"eval-dangling-tag",children:a("nodeView.eval.danglingGone")})]}),e.jsx("div",{className:"eval-dangling-remarks",children:e.jsx(ge,{replies:s.remarks})})]})}function ze({node:s,sessions:a=[],filter:t={},onFilter:n=()=>{}}){var d;const i=f(),l=ae("eval",s.id,t),c=J("evals",l,1,{pollMs:0,view:"timeline"});if(c.loading)return e.jsx("div",{className:"pane-eval pane-loading",children:e.jsx("span",{className:"spinner","aria-label":i("common.loading")})});if(c.error)return e.jsx("div",{className:"pane-eval empty",children:c.error});if(!((d=c.data)!=null&&d.hasEvalFile))return e.jsx("div",{className:"pane-eval empty",children:i("nodeView.eval.noScenarios")});const o=c.data.items||[],u=o.filter(r=>r.filterKind===L.RESULT),x=o.filter(r=>r.filterKind===L.UNMEASURED),j=o.filter(r=>r.filterKind===L.DANGLING),g=ne(c.data,i),w=se(g,n,["section","review","freshness","kind","filer","session"]),b=e.jsx("a",{className:"pane-eval-list-door",href:y(Z("evals",l)),"data-tip":i("score.openList"),"aria-label":i("score.openList"),children:e.jsx($,{name:"chevron-right",size:14})}),N=c.data.sourceTotal>4?e.jsx(X,{value:t.q||"",onChange:r=>n({q:r||null}),summary:{shown:o.length,total:c.data.total},placeholder:i("nodeView.filterScenarios"),searchLabel:i("reviewList.searchEvals"),filterLabel:i("reviewList.filters"),clearLabel:i("reviewList.all"),clearSearchLabel:i("reviewList.clearSearch"),groups:w,trailing:b},"filter"):e.jsx("div",{className:"pane-eval-list-door-row",children:b});return u.length?e.jsx(e.Fragment,{children:e.jsx(ie,{items:u,resetKey:`${c.data.revision}:${JSON.stringify(t)}`,leading:[N,o.length?null:e.jsx("div",{className:"pane-filter-none",children:i("nodeView.filterNone")},"none"),...x.map(r=>e.jsx(_,{s:r},r.name))],trailing:j.map(r=>e.jsx(W,{track:r},r.threadId)),itemKey:(r,h)=>`${r.scenario}-${r.ts}-${h}`,classes:{pane:"pane-eval",row:"eval-row",head:"eval-head",evidence:"eval-shot"},renderAction:r=>e.jsx("a",{className:"eval-open",href:y(Y(s.id,r.scenario)),"data-tip":i("nodeView.eval.openDetail"),"aria-label":i("nodeView.eval.openDetail"),children:e.jsx($,{name:"chevron-right",size:14})}),renderHeader:(r,h,p)=>e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"eval-top",children:[e.jsx("span",{className:"eval-caret",children:p?"▾":"▸"}),e.jsx("span",{className:"eval-scenario",children:r.scenario}),e.jsx(Oe,{verdict:r.verdict}),e.jsx(ee,{state:ue(r),title:r.fresh?void 0:i("nodeView.eval.staleAxes",{axes:r.staleAxes.join(", ")})})]}),e.jsxs("span",{className:"eval-meta",children:[r.evaluator&&e.jsx("span",{className:"eval-evaluator",children:r.evaluator}),e.jsx("code",{className:"eval-sha",children:r.codeSha.slice(0,7)}),e.jsx("span",{className:"eval-ts",children:r.ts.replace("T"," ").slice(0,16)})]})]}),renderEvidence:r=>e.jsx(Ge,{r})})}):e.jsxs("div",{className:"pane-eval pane-eval-declared",children:[N,e.jsx("div",{className:"eval-todo-note",children:o.length?i("nodeView.eval.noReadings"):i("nodeView.filterNone")}),x.map(r=>e.jsx(_,{s:r},r.name)),j.map(r=>e.jsx(W,{track:r},r.threadId))]})}const _e={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"};function Ze({node:s,pane:a,setPane:t,onClose:n,sessions:i=[],graphOnly:l=!1}){var V,T,D,F,P,A,B,H;const c=f(),o=v.useRef(null),[u,x]=v.useState({issues:{},eval:{}}),j=(m,le)=>x(K=>({...K,[m]:Ne(K[m],le)})),g=((T=(V=s.reviewSummary)==null?void 0:V.issues)==null?void 0:T.open)||0,w=((F=(D=s.reviewSummary)==null?void 0:D.issues)==null?void 0:F.closed)||0,b=((A=(P=s.reviewSummary)==null?void 0:P.evals)==null?void 0:A.pass)||0,N=((H=(B=s.reviewSummary)==null?void 0:B.evals)==null?void 0:H.fail)||0,d=(s.overlays||[]).length,r=Ee(s,l),h=r.some(m=>m.key===a)?a:r[0].key,p=Fe(s.id,h==="history");return e.jsx("div",{className:"ov-backdrop","data-focus-overlay":!0,onMouseDown:n,children:e.jsxs("div",{className:"ov-panel",onMouseDown:m=>m.stopPropagation(),children:[e.jsxs("div",{className:"ov-head",children:[e.jsx("span",{className:"ov-title",children:s.title}),e.jsx("div",{className:"ov-tabs",children:r.map(m=>e.jsxs("button",{className:m.key===h?"ov-tab on":"ov-tab",onClick:()=>t(m.key),children:[c(_e[m.key]),m.key==="issues"&&(g>0||w>0)&&e.jsxs("span",{className:"ov-tab-counts",children:[g>0&&e.jsx(k,{kind:"issue",state:"open",cls:"st-open",n:g,label:c("nodeView.openIssues",{n:g})}),w>0&&e.jsx(k,{kind:"issue",state:"closed",cls:"st-closed",n:w,label:c("nodeView.closedIssues",{n:w})})]}),m.key==="eval"&&(b>0||N>0)&&e.jsxs("span",{className:"ov-tab-counts",children:[b>0&&e.jsx(k,{kind:"eval",state:"pass",cls:"st-pass",n:b,label:c("nodeView.eval.passCount",{n:b})}),N>0&&e.jsx(k,{kind:"eval",state:"fail",cls:"st-fail",n:N,label:c("nodeView.eval.failCount",{n:N})})]}),m.key==="edit"&&d>0&&e.jsx("span",{className:"ov-tab-counts",children:e.jsx("span",{className:"ovc st-edit","data-tip":c("nodeView.pendingEdits",{n:d}),children:d})})]},m.key))}),e.jsx("span",{className:"ov-hint",children:c("nodeView.hint")})]}),e.jsxs("div",{className:"ov-body",children:[h==="spec"&&e.jsxs("div",{className:"pane-solo",ref:o,children:[e.jsx(De,{node:s,graphOnly:l}),!l&&e.jsx(ke,{node:s,hostRef:o})]}),h==="history"&&e.jsx(He,{node:s,rows:p}),h==="issues"&&e.jsx(Ke,{node:s,sessions:i,filter:u.issues,onFilter:m=>j("issues",m)}),h==="eval"&&e.jsx(ze,{node:s,sessions:i,filter:u.eval,onFilter:m=>j("eval",m)}),h==="edit"&&e.jsx(Me,{node:s})]})]})})}export{ze as E,He as H,Ke as I,Ze as N,De as S,Me as a,C as b,Se as c,Ee as p,Fe as u};
@@ -1 +1 @@
1
- import{u as q,r,j as e,I as B,a as G,e as J,q as U}from"./index-Co8kmYQY.js";import{o as _,q as K,t as V,C as W,I as D,v as Q,w as X,x as Y,y as H,b as Z,z as ee,A as se,B as te,D as ae,E as oe,F as re,G as A,H as ne,J as ce,K as ie,L as le,M as de}from"./App-BBoP1IyU.js";import{P as pe,M as T}from"./Modal-oF4JAL6H.js";const M=["claude","codex","opencode","pi"];function O({onSet:a,onClear:n,placeholder:t,busy:o,t:c}){const[s,f]=r.useState("");return e.jsxs("form",{className:"proj-drawer proj-pw",onSubmit:j=>{j.preventDefault(),s&&(a(s),f(""))},children:[e.jsx("input",{className:"proj-add-path",type:"password",value:s,onChange:j=>f(j.target.value),placeholder:t,"aria-label":t}),e.jsx("button",{className:"proj-act primary",type:"submit",disabled:!s||o,children:c("projects.passwordSet")}),e.jsx("button",{className:"proj-act",type:"button",disabled:o,onClick:n,children:c("projects.passwordClear")})]})}function je({onAdded:a,onClose:n,t}){const[o,c]=r.useState(""),[s,f]=r.useState(null),[j,h]=r.useState(!0),[d,x]=r.useState(!1),[v,m]=r.useState(null),[E,k]=r.useState(""),[I,F]=r.useState(!1),[S,C]=r.useState(!1),[P,N]=r.useState([]);Z(!d,n);const y=r.useCallback(async u=>{if(d)return;h(!0),m(null),k("");const w=await ee(u);if(h(!1),!w.ok){m(w.error==="network"?t("projects.actionFailed"):w.error);return}f(w),c(w.path),F(!1),C(!1),N([])},[d,t]);r.useEffect(()=>{y("")},[]);const R=!!(s!=null&&s.exists)&&o===s.path,l=!!s&&!s.exists&&o===s.path,g=R&&!s.gitRoot,i=R&&!s.initialized,p=R&&!j&&!d&&!s.cataloged&&(!g||I)&&(!S||!!P.length),b=u=>N(w=>w.includes(u)?w.filter($=>$!==u):[...w,u]),L=async u=>{if(u.preventDefault(),!p)return;x(!0),m(null),k("");const w=await A(s.path,{...g?{initGit:I}:{},...i&&S?{init:{harness:P.join(",")}}:{}});if(x(!1),w.ok){a(w.project);return}m(w.error==="network"?t("projects.actionFailed"):w.error),k(w.output||"")},z=async()=>{if(!l||d)return;x(!0),m(null),k("");const u=await A(s.path,{createDir:!0,initGit:!0});if(x(!1),u.ok){a(u.project);return}m(u.error==="network"?t("projects.actionFailed"):u.error),k(u.output||"")};return e.jsx(T,{title:t("projects.addTitle"),closeLabel:t("common.close"),onClose:()=>{d||n()},className:"proj-add-modal",children:e.jsxs("form",{className:"proj-add-flow",onSubmit:L,children:[e.jsxs("div",{className:"proj-add-pathbar",children:[e.jsx(G,{icon:"arrow-left",size:14,className:"proj-act icon",label:t("projects.browseParent"),disabled:!(s!=null&&s.parent)||j||d,onClick:()=>y(s.parent)}),e.jsx("button",{type:"button",className:"proj-act icon proj-home-btn","data-tip":t("projects.browseHome"),"aria-label":t("projects.browseHome"),disabled:!(s!=null&&s.home)||j||d,onClick:()=>y(s.home),children:"~"}),e.jsx("input",{className:"proj-add-path",value:o,autoFocus:!0,spellCheck:!1,onChange:u=>{c(u.target.value),m(null)},onKeyDown:u=>{u.key!=="Enter"||!o.trim()||(u.preventDefault(),l?z():y(o.trim()))},placeholder:t("projects.addPlaceholder"),"aria-label":t("projects.addPlaceholder"),disabled:d}),e.jsx("button",{className:l?"proj-act primary":"proj-act",type:"button",disabled:!o.trim()||j||d,onClick:()=>{l?z():y(o.trim())},children:t(j?"projects.browseLoading":d&&l?"projects.browseCreating":l?"projects.browseNew":"projects.browseGo")})]}),e.jsxs("div",{className:"proj-folder-list","aria-label":t("projects.folderList"),"aria-busy":j,children:[!j&&(s==null?void 0:s.entries.map(u=>e.jsxs("button",{type:"button",className:"proj-folder-row",onClick:()=>y(u.path),disabled:d,children:[e.jsx(B,{name:"chevron-right",size:13}),e.jsx("span",{className:"proj-folder-name",children:u.name}),u.git&&e.jsx("span",{className:"proj-folder-tag",children:"Git"}),u.initialized&&e.jsx("span",{className:"proj-folder-tag spex",children:"SpexCode"})]},u.path))),!j&&s&&!s.exists&&e.jsx("div",{className:"proj-folder-empty",children:t("projects.folderMissing")}),!j&&(s==null?void 0:s.exists)&&!s.entries.length&&e.jsx("div",{className:"proj-folder-empty",children:t("projects.folderEmpty")}),j&&e.jsx("div",{className:"proj-folder-empty",children:t("projects.browseLoading")})]}),R&&e.jsxs("div",{className:"proj-add-options",children:[e.jsx("div",{className:"proj-add-selected",title:s.path,children:s.path}),s.gitRoot?e.jsxs("div",{className:"proj-add-state",children:[e.jsx(B,{name:"check",size:13})," Git ",e.jsx("code",{children:s.gitRoot})]}):e.jsxs("label",{className:"proj-add-check",children:[e.jsx("input",{type:"checkbox",checked:I,onChange:u=>F(u.target.checked),disabled:d}),e.jsx("span",{children:t("projects.initGit")})]}),s.initialized?e.jsxs("div",{className:"proj-add-state",children:[e.jsx(B,{name:"check",size:13})," ",t("projects.spexInitialized")]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"proj-add-check",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:u=>{C(u.target.checked),k(""),m(null)},disabled:d}),e.jsx("span",{children:t("projects.initSpex")})]}),S&&e.jsxs("fieldset",{className:"proj-add-harnesses",disabled:d,children:[e.jsx("legend",{children:t("projects.harnessTargets")}),M.map(u=>e.jsxs("label",{className:"proj-add-harness",children:[e.jsx("input",{type:"checkbox",checked:P.includes(u),onChange:()=>b(u)}),e.jsx("span",{children:u})]},u))]})]}),s.cataloged&&e.jsx("div",{className:"proj-op-status ok",children:t("projects.alreadyAdded")})]}),(v||E)&&e.jsxs("div",{className:"proj-add-result",children:[v&&e.jsx("div",{className:"proj-err",children:v}),E&&e.jsx("pre",{className:"proj-log",children:E})]}),e.jsxs("div",{className:"proj-add-actions",children:[e.jsx("button",{className:"proj-act",type:"button",disabled:d,onClick:n,children:t("common.cancel")}),e.jsx("button",{className:"proj-act primary",type:"submit",disabled:!p,children:t(d?"projects.addBusy":"projects.addSubmit")})]})]})})}function ue({p:a,onRefresh:n,t}){const[o,c]=r.useState(null),[s,f]=r.useState(""),[j,h]=r.useState(!1),[d,x]=r.useState(null),[v,m]=r.useState(!1),[E,k]=r.useState(0),[I,F]=r.useState(a.identity.icon),[S,C]=r.useState(!1),[P,N]=r.useState(null);r.useEffect(()=>{let i=!0;return c(null),x(null),m(!1),se(a.id).then(p=>{if(i){if(!p.ok){x(p.error==="network"?t("projects.actionFailed"):p.error);return}c({content:p.content,revision:p.revision}),f(p.content),F(a.identity.icon)}}),()=>{i=!1}},[a.id,a.identity.icon,E,t]);let y=!1;try{const i=JSON.parse(s);y=!i||typeof i!="object"||Array.isArray(i)}catch{y=!0}const R=!!o&&s!==o.content,l=async()=>{var p,b;if(!o||y||!R||j)return;h(!0),x(null),m(!1);const i=await ne(a.id,s,o.revision);if(h(!1),!i.ok){x(i.error==="network"?t("projects.actionFailed"):i.error);return}c({content:i.content,revision:i.revision}),f(i.content),m(!0);try{F(((b=(p=JSON.parse(i.content))==null?void 0:p.dashboard)==null?void 0:b.icon)||a.identity.icon)}catch{}n()},g=async i=>{if(!o||S)return!1;const p=I;F(i),C(!0),N(null),m(!1);const b=await ce(a.id,i,o.revision);return C(!1),b.ok?(c({content:b.content,revision:b.revision}),f(b.content),F(b.identity.icon),m(!0),n(),!0):(F(p),N(b.error==="network"?t("projects.actionFailed"):b.error),!1)};return e.jsxs("div",{className:"proj-drawer proj-config",children:[e.jsxs("div",{className:"proj-config-head",children:[e.jsx("code",{children:"spexcode.json"}),v&&e.jsx("span",{className:"proj-op-status ok",children:t("projects.configSaved")})]}),o?e.jsxs(e.Fragment,{children:[e.jsx("textarea",{className:y?"proj-config-editor invalid":"proj-config-editor",value:s,onChange:i=>{f(i.target.value),m(!1),x(null)},"aria-label":t("projects.configEditor"),spellCheck:!1,disabled:j}),e.jsxs("div",{className:"proj-setup-row",children:[e.jsx("button",{className:"proj-act primary",type:"button",disabled:!R||y||j,onClick:l,children:t(j?"projects.configSaving":"projects.configSave")}),e.jsx("button",{className:"proj-act",type:"button",disabled:j,onClick:()=>k(i=>i+1),children:t("projects.configReload")}),y&&e.jsx("span",{className:"proj-err",children:t("projects.configInvalid")}),d&&e.jsx("span",{className:"proj-err",children:d})]}),e.jsx(H,{value:I,onChange:g,label:t("projects.projectIcon"),editLabel:t("projects.editProjectIcon"),name:`project-icon-${a.id}`,disabled:j||S}),P&&e.jsx("span",{className:"proj-err",children:P})]}):e.jsxs("div",{className:"proj-setup-row",children:[!d&&e.jsx("span",{className:"proj-dim",children:t("projects.configLoading")}),d&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"proj-err",children:d}),e.jsx("button",{className:"proj-act",type:"button",onClick:()=>k(i=>i+1),children:t("projects.configReload")})]})]})]})}function me({p:a,busyOp:n,run:t,result:o,t:c}){const[s,f]=r.useState([]),j=h=>f(d=>d.includes(h)?d.filter(x=>x!==h):[...d,h]);return e.jsxs("div",{className:"proj-drawer proj-setup",children:[e.jsxs("div",{className:"proj-setup-row",children:[e.jsx("span",{className:"proj-dim",children:c("projects.harnessLabel")}),M.map(h=>e.jsx("button",{type:"button",className:s.includes(h)?"proj-act on":"proj-act","aria-pressed":s.includes(h),disabled:!!n,onClick:()=>j(h),children:h},h))]}),e.jsxs("div",{className:"proj-setup-row",children:[e.jsx("button",{className:"proj-act primary",type:"button",disabled:!!n||!s.length,title:s.length?void 0:c("projects.harnessRequired"),onClick:()=>t("init",()=>te(a.id,s.join(","))),children:c(n==="init"?"projects.running":"projects.init")}),e.jsx("button",{className:"proj-act",type:"button",disabled:!!n,onClick:()=>t("doctor",()=>ae(a.id)),children:c(n==="doctor"?"projects.running":"projects.doctor")})]}),o&&e.jsxs("div",{className:"proj-op-result proj-full",children:[e.jsx("div",{className:o.ok?"proj-op-status ok":"proj-op-status fail",children:o.ok?c("projects.opOk",{op:c(`projects.${o.op}`)}):c("projects.opFail",{op:c(`projects.${o.op}`),code:o.code??"?"})}),o.output?e.jsx("pre",{className:"proj-log",children:o.output}):null]})]})}function he({project:a,busy:n,error:t,onClose:o,onRemove:c,t:s}){const[f,j]=r.useState(""),[h,d]=r.useState(!1),x=`REMOVE ${a.identity.title}`,v=h&&f===x&&!n;return e.jsx(T,{title:s("projects.removeTitle"),closeLabel:s("common.close"),onClose:()=>{n||o()},className:"proj-remove-modal",children:e.jsxs("div",{className:"proj-remove-copy",children:[e.jsx("p",{className:"proj-remove-warning",children:s("projects.removeWarning")}),e.jsx("p",{children:s("projects.removeKeepsFiles")}),e.jsx("p",{children:s("projects.removeStopsFirst")}),e.jsxs("label",{className:"proj-remove-check",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:m=>d(m.target.checked),disabled:n}),e.jsx("span",{children:s("projects.removeUnderstand")})]}),e.jsxs("label",{className:"proj-remove-confirm",children:[e.jsx("span",{children:s("projects.removeTypePrompt")}),e.jsx("code",{children:x}),e.jsx("input",{value:f,onChange:m=>j(m.target.value),"aria-label":s("projects.removeTypeLabel"),autoComplete:"off",spellCheck:!1,disabled:n})]}),t&&e.jsx("div",{className:"proj-err",children:t}),e.jsxs("div",{className:"proj-remove-actions",children:[e.jsx("button",{className:"proj-act",type:"button",disabled:n,onClick:o,children:s("common.cancel")}),e.jsx("button",{className:"proj-act danger",type:"button",disabled:!v,onClick:()=>c(f),children:s(n?"projects.removeBusy":"projects.removeConfirm")})]})]})})}function xe({p:a,health:n,onRefresh:t,t:o}){const[c,s]=r.useState(null),[f,j]=r.useState(!1),[h,d]=r.useState(null),[x,v]=r.useState(null),[m,E]=r.useState(null),[k,I]=r.useState(!1),[F,S]=r.useState(!1),[C,P]=r.useState(null),N=a.id===J,y=a.online===!1,R=y?"stopped":n||"probing",l=async p=>{j(!0),v(null);const b=await p();j(!1),b.ok?s(null):v(b.error||o("projects.actionFailed")),t()},g=async(p,b)=>{d(p),v(null),E(null);const L=await b();d(null),p!=="serve"?E({op:p,ok:L.ok,code:L.code,output:L.output||(L.ok?"":L.error||"")}):L.ok||v(L.error||o("projects.actionFailed")),t()},i=async p=>{S(!0),P(null);const b=await oe(a.id,p);if(S(!1),!b.ok){P(b.error||o("projects.actionFailed"));return}I(!1),t()};return e.jsxs("li",{className:N?"proj-row current":"proj-row",children:[e.jsxs("div",{className:"proj-row-main",children:[e.jsx("span",{className:`proj-health h-${R}`,"data-tip":o(`projects.health.${R}`)}),e.jsx(D,{icon:a.identity.icon,size:26}),e.jsx("span",{className:"proj-name",children:a.identity.title}),a.gated&&e.jsx(B,{name:"lock",size:12,className:"proj-locked"}),N&&e.jsx("span",{className:"proj-tag",children:o("projects.current")}),e.jsx("span",{className:"proj-path",title:a.id,children:a.root||a.id}),e.jsxs("span",{className:"proj-actions",children:[e.jsx(G,{icon:"settings",label:o("projects.configTitle"),className:c==="config"?"proj-act icon on":"proj-act icon",size:13,onClick:()=>{s(p=>p==="config"?null:"config"),v(null)}}),e.jsx(G,{icon:"terminal",label:o("projects.setupTitle"),className:c==="setup"?"proj-act icon on":"proj-act icon",size:13,onClick:()=>{s(p=>p==="setup"?null:"setup"),v(null)}}),e.jsx(G,{icon:"lock",label:o("projects.passwordTitle"),className:c==="pw"?"proj-act icon on":"proj-act icon",size:13,onClick:()=>{s(p=>p==="pw"?null:"pw"),v(null)}}),y?e.jsx("button",{className:"proj-act primary",type:"button",disabled:!!h,onClick:()=>g("serve",()=>ie(a.id)),children:o(h==="serve"?"projects.startBusy":"projects.start")}):e.jsx("a",{className:"proj-act primary",href:U(a.id),children:o("projects.open")})]})]}),x&&e.jsx("div",{className:"proj-err",children:x}),c==="pw"&&e.jsx(O,{t:o,busy:f,placeholder:o("projects.passwordPlaceholder"),onSet:p=>l(()=>de(a.id,p)),onClear:()=>l(()=>le(a.id))}),c==="config"&&e.jsx(ue,{p:a,onRefresh:t,t:o}),c==="config"&&e.jsxs("div",{className:"proj-remove-disclosure",children:[e.jsx("button",{className:"proj-remove-link",type:"button",onClick:()=>{P(null),I(!0)},children:o("projects.removeRegistration")}),e.jsx("span",{children:o("projects.removeRegistrationHint")})]}),c==="setup"&&e.jsx(me,{p:a,busyOp:h,run:g,result:m,t:o}),k&&e.jsx(he,{project:a,busy:F,error:C,onClose:()=>I(!1),onRemove:i,t:o})]})}function fe({gateway:a,onRefresh:n,t}){const[o,c]=r.useState(a.identity.icon),[s,f]=r.useState(!1),[j,h]=r.useState(null);r.useEffect(()=>{c(a.identity.icon)},[a.identity.icon]);const d=async x=>{if(s||!a.revision)return!1;const v=o;c(x),f(!0),h(null);const m=await re(x,a.revision);return f(!1),m.ok?(c(m.gateway.identity.icon),n(),!0):(c(v),h(m.error==="network"?t("projects.actionFailed"):m.error),!1)};return e.jsxs("div",{className:"proj-gateway-identity",children:[e.jsx(H,{value:o,onChange:d,label:t("projects.gatewayIcon"),editLabel:t("projects.editGatewayIcon"),name:"gateway-icon",fallback:"gateway",disabled:s||!a.revision}),j&&e.jsx("span",{className:"proj-err",children:j})]})}function Ne(){const a=q(),[n,t]=r.useState({kind:"loading"}),[o,c]=r.useState({}),[s,f]=r.useState(null),[j,h]=r.useState(!1),[d,x]=r.useState(!1),[v,m]=r.useState(null),[E,k]=r.useState(1),[I,F]=r.useState(0),S=r.useRef(0),C=r.useCallback(async()=>{const l=++S.current,g=await _();return l!==S.current?null:(g.state==="ok"?(t({kind:"ok",adminGated:g.adminGated,gateway:g.gateway,projects:g.projects}),g.projects.filter(i=>i.online!==!1).forEach(i=>{K(i.id).then(p=>{l===S.current&&c(b=>({...b,[i.id]:p}))})})):g.state==="denied"?t({kind:"denied",reason:g.reason}):t(i=>i.kind==="ok"?i:{kind:"absent"}),g)},[]);r.useEffect(()=>{let l,g=!0,i=!1;const p=async()=>{const z=await C();return(z==null?void 0:z.state)==="denied"&&(i=!0,l&&(clearInterval(l),l=void 0)),z};(async()=>{const z=await p();g&&(z==null?void 0:z.state)!=="denied"&&(l=setInterval(p,Q))})();const L=()=>{!document.hidden&&!i&&p()};return document.addEventListener("visibilitychange",L),()=>{g=!1,l&&clearInterval(l),document.removeEventListener("visibilitychange",L)}},[C,I]);const P=async l=>{x(!0),m(null);const g=await l();x(!1),g.ok?f(null):m(g.error||a("projects.actionFailed")),C()},N=V(n.kind==="ok"?n.projects:[],E);r.useEffect(()=>{N.page!==E&&k(N.page)},[N.page,E]);const y=n.kind==="loading"?e.jsx("div",{className:"loading",children:a("hud.loading")}):n.kind==="denied"?e.jsx(W,{scope:"admin",locked:n.reason==="locked",onUnlocked:()=>F(l=>l+1)}):n.kind==="absent"?e.jsx("div",{className:"proj-empty",children:e.jsx("p",{children:a("projects.absent")})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"proj-head",children:[e.jsx("span",{className:"proj-count",children:a("projects.count",{n:n.projects.length})}),e.jsxs("button",{className:j?"proj-act on":"proj-act",onClick:()=>h(!0),children:[e.jsx(B,{name:"plus",size:12})," ",a("projects.add")]}),e.jsxs("button",{className:s==="admin"?"proj-act on":"proj-act",onClick:()=>{f(l=>l==="admin"?null:"admin"),m(null)},children:[e.jsx(B,{name:"lock",size:12})," ",a("projects.adminPassword")]})]}),!n.adminGated&&e.jsx("div",{className:"proj-hint",children:a("projects.adminUngated")}),s==="admin"&&e.jsxs("div",{className:"proj-admin-pw",children:[e.jsx(O,{t:a,busy:d,placeholder:a("projects.adminPasswordPlaceholder"),onSet:l=>P(()=>Y(l)),onClear:()=>P(()=>X())}),v&&e.jsx("div",{className:"proj-err",children:v})]}),n.projects.length?e.jsx("ul",{className:"proj-list",children:N.items.map(l=>e.jsx(xe,{p:l,health:o[l.id],onRefresh:C,t:a},l.id))}):e.jsx("div",{className:"proj-empty",children:e.jsx("p",{children:a("projects.empty")})}),N.pageCount>1&&e.jsxs("nav",{className:"proj-pagination","aria-label":a("projects.pagination"),children:[e.jsx(G,{icon:"arrow-left",label:a("projects.previousPage"),className:"proj-act icon",size:14,disabled:N.page===1,onClick:()=>k(l=>l-1)}),e.jsx("span",{className:"proj-page-label",children:a("projects.pageOf",{page:N.page,pages:N.pageCount})}),e.jsx(G,{icon:"chevron-right",label:a("projects.nextPage"),className:"proj-act icon",size:14,disabled:N.page===N.pageCount,onClick:()=>k(l=>l+1)})]}),e.jsx("div",{className:"proj-page-details","aria-label":a("projects.gatewaySettings"),children:e.jsx(fe,{gateway:n.gateway,onRefresh:C,t:a})})]}),R=n.kind==="ok"?n.gateway.identity:{icon:"gateway"};return e.jsxs("div",{className:"page-pane page-projects",children:[e.jsx(pe,{className:"page-projects-scroll",children:e.jsxs("div",{className:"proj-body",children:[e.jsxs("div",{className:"cred-brand proj-brand",children:[e.jsx(D,{icon:R.icon,fallback:"gateway",size:30}),e.jsx("span",{children:"$ spexcode"})]}),e.jsx("h1",{className:"page-title",children:a("projects.title")}),y]})}),j&&e.jsx(je,{t:a,onClose:()=>h(!1),onAdded:()=>{h(!1),C()}})]})}export{Ne as default};
1
+ import{u as q,r,j as e,I as B,a as G,e as J,q as U}from"./index-DlgNLzN7.js";import{o as _,q as K,t as V,C as W,I as D,v as Q,w as X,x as Y,y as H,b as Z,z as ee,A as se,B as te,D as ae,E as oe,F as re,G as A,H as ne,J as ce,K as ie,L as le,M as de}from"./App-EA8glWd5.js";import{P as pe,M as T}from"./Modal-b-jG6-T3.js";const M=["claude","codex","opencode","pi"];function O({onSet:a,onClear:n,placeholder:t,busy:o,t:c}){const[s,f]=r.useState("");return e.jsxs("form",{className:"proj-drawer proj-pw",onSubmit:j=>{j.preventDefault(),s&&(a(s),f(""))},children:[e.jsx("input",{className:"proj-add-path",type:"password",value:s,onChange:j=>f(j.target.value),placeholder:t,"aria-label":t}),e.jsx("button",{className:"proj-act primary",type:"submit",disabled:!s||o,children:c("projects.passwordSet")}),e.jsx("button",{className:"proj-act",type:"button",disabled:o,onClick:n,children:c("projects.passwordClear")})]})}function je({onAdded:a,onClose:n,t}){const[o,c]=r.useState(""),[s,f]=r.useState(null),[j,h]=r.useState(!0),[d,x]=r.useState(!1),[v,m]=r.useState(null),[E,k]=r.useState(""),[I,F]=r.useState(!1),[S,C]=r.useState(!1),[P,N]=r.useState([]);Z(!d,n);const y=r.useCallback(async u=>{if(d)return;h(!0),m(null),k("");const w=await ee(u);if(h(!1),!w.ok){m(w.error==="network"?t("projects.actionFailed"):w.error);return}f(w),c(w.path),F(!1),C(!1),N([])},[d,t]);r.useEffect(()=>{y("")},[]);const R=!!(s!=null&&s.exists)&&o===s.path,l=!!s&&!s.exists&&o===s.path,g=R&&!s.gitRoot,i=R&&!s.initialized,p=R&&!j&&!d&&!s.cataloged&&(!g||I)&&(!S||!!P.length),b=u=>N(w=>w.includes(u)?w.filter($=>$!==u):[...w,u]),L=async u=>{if(u.preventDefault(),!p)return;x(!0),m(null),k("");const w=await A(s.path,{...g?{initGit:I}:{},...i&&S?{init:{harness:P.join(",")}}:{}});if(x(!1),w.ok){a(w.project);return}m(w.error==="network"?t("projects.actionFailed"):w.error),k(w.output||"")},z=async()=>{if(!l||d)return;x(!0),m(null),k("");const u=await A(s.path,{createDir:!0,initGit:!0});if(x(!1),u.ok){a(u.project);return}m(u.error==="network"?t("projects.actionFailed"):u.error),k(u.output||"")};return e.jsx(T,{title:t("projects.addTitle"),closeLabel:t("common.close"),onClose:()=>{d||n()},className:"proj-add-modal",children:e.jsxs("form",{className:"proj-add-flow",onSubmit:L,children:[e.jsxs("div",{className:"proj-add-pathbar",children:[e.jsx(G,{icon:"arrow-left",size:14,className:"proj-act icon",label:t("projects.browseParent"),disabled:!(s!=null&&s.parent)||j||d,onClick:()=>y(s.parent)}),e.jsx("button",{type:"button",className:"proj-act icon proj-home-btn","data-tip":t("projects.browseHome"),"aria-label":t("projects.browseHome"),disabled:!(s!=null&&s.home)||j||d,onClick:()=>y(s.home),children:"~"}),e.jsx("input",{className:"proj-add-path",value:o,autoFocus:!0,spellCheck:!1,onChange:u=>{c(u.target.value),m(null)},onKeyDown:u=>{u.key!=="Enter"||!o.trim()||(u.preventDefault(),l?z():y(o.trim()))},placeholder:t("projects.addPlaceholder"),"aria-label":t("projects.addPlaceholder"),disabled:d}),e.jsx("button",{className:l?"proj-act primary":"proj-act",type:"button",disabled:!o.trim()||j||d,onClick:()=>{l?z():y(o.trim())},children:t(j?"projects.browseLoading":d&&l?"projects.browseCreating":l?"projects.browseNew":"projects.browseGo")})]}),e.jsxs("div",{className:"proj-folder-list","aria-label":t("projects.folderList"),"aria-busy":j,children:[!j&&(s==null?void 0:s.entries.map(u=>e.jsxs("button",{type:"button",className:"proj-folder-row",onClick:()=>y(u.path),disabled:d,children:[e.jsx(B,{name:"chevron-right",size:13}),e.jsx("span",{className:"proj-folder-name",children:u.name}),u.git&&e.jsx("span",{className:"proj-folder-tag",children:"Git"}),u.initialized&&e.jsx("span",{className:"proj-folder-tag spex",children:"SpexCode"})]},u.path))),!j&&s&&!s.exists&&e.jsx("div",{className:"proj-folder-empty",children:t("projects.folderMissing")}),!j&&(s==null?void 0:s.exists)&&!s.entries.length&&e.jsx("div",{className:"proj-folder-empty",children:t("projects.folderEmpty")}),j&&e.jsx("div",{className:"proj-folder-empty",children:t("projects.browseLoading")})]}),R&&e.jsxs("div",{className:"proj-add-options",children:[e.jsx("div",{className:"proj-add-selected",title:s.path,children:s.path}),s.gitRoot?e.jsxs("div",{className:"proj-add-state",children:[e.jsx(B,{name:"check",size:13})," Git ",e.jsx("code",{children:s.gitRoot})]}):e.jsxs("label",{className:"proj-add-check",children:[e.jsx("input",{type:"checkbox",checked:I,onChange:u=>F(u.target.checked),disabled:d}),e.jsx("span",{children:t("projects.initGit")})]}),s.initialized?e.jsxs("div",{className:"proj-add-state",children:[e.jsx(B,{name:"check",size:13})," ",t("projects.spexInitialized")]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"proj-add-check",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:u=>{C(u.target.checked),k(""),m(null)},disabled:d}),e.jsx("span",{children:t("projects.initSpex")})]}),S&&e.jsxs("fieldset",{className:"proj-add-harnesses",disabled:d,children:[e.jsx("legend",{children:t("projects.harnessTargets")}),M.map(u=>e.jsxs("label",{className:"proj-add-harness",children:[e.jsx("input",{type:"checkbox",checked:P.includes(u),onChange:()=>b(u)}),e.jsx("span",{children:u})]},u))]})]}),s.cataloged&&e.jsx("div",{className:"proj-op-status ok",children:t("projects.alreadyAdded")})]}),(v||E)&&e.jsxs("div",{className:"proj-add-result",children:[v&&e.jsx("div",{className:"proj-err",children:v}),E&&e.jsx("pre",{className:"proj-log",children:E})]}),e.jsxs("div",{className:"proj-add-actions",children:[e.jsx("button",{className:"proj-act",type:"button",disabled:d,onClick:n,children:t("common.cancel")}),e.jsx("button",{className:"proj-act primary",type:"submit",disabled:!p,children:t(d?"projects.addBusy":"projects.addSubmit")})]})]})})}function ue({p:a,onRefresh:n,t}){const[o,c]=r.useState(null),[s,f]=r.useState(""),[j,h]=r.useState(!1),[d,x]=r.useState(null),[v,m]=r.useState(!1),[E,k]=r.useState(0),[I,F]=r.useState(a.identity.icon),[S,C]=r.useState(!1),[P,N]=r.useState(null);r.useEffect(()=>{let i=!0;return c(null),x(null),m(!1),se(a.id).then(p=>{if(i){if(!p.ok){x(p.error==="network"?t("projects.actionFailed"):p.error);return}c({content:p.content,revision:p.revision}),f(p.content),F(a.identity.icon)}}),()=>{i=!1}},[a.id,a.identity.icon,E,t]);let y=!1;try{const i=JSON.parse(s);y=!i||typeof i!="object"||Array.isArray(i)}catch{y=!0}const R=!!o&&s!==o.content,l=async()=>{var p,b;if(!o||y||!R||j)return;h(!0),x(null),m(!1);const i=await ne(a.id,s,o.revision);if(h(!1),!i.ok){x(i.error==="network"?t("projects.actionFailed"):i.error);return}c({content:i.content,revision:i.revision}),f(i.content),m(!0);try{F(((b=(p=JSON.parse(i.content))==null?void 0:p.dashboard)==null?void 0:b.icon)||a.identity.icon)}catch{}n()},g=async i=>{if(!o||S)return!1;const p=I;F(i),C(!0),N(null),m(!1);const b=await ce(a.id,i,o.revision);return C(!1),b.ok?(c({content:b.content,revision:b.revision}),f(b.content),F(b.identity.icon),m(!0),n(),!0):(F(p),N(b.error==="network"?t("projects.actionFailed"):b.error),!1)};return e.jsxs("div",{className:"proj-drawer proj-config",children:[e.jsxs("div",{className:"proj-config-head",children:[e.jsx("code",{children:"spexcode.json"}),v&&e.jsx("span",{className:"proj-op-status ok",children:t("projects.configSaved")})]}),o?e.jsxs(e.Fragment,{children:[e.jsx("textarea",{className:y?"proj-config-editor invalid":"proj-config-editor",value:s,onChange:i=>{f(i.target.value),m(!1),x(null)},"aria-label":t("projects.configEditor"),spellCheck:!1,disabled:j}),e.jsxs("div",{className:"proj-setup-row",children:[e.jsx("button",{className:"proj-act primary",type:"button",disabled:!R||y||j,onClick:l,children:t(j?"projects.configSaving":"projects.configSave")}),e.jsx("button",{className:"proj-act",type:"button",disabled:j,onClick:()=>k(i=>i+1),children:t("projects.configReload")}),y&&e.jsx("span",{className:"proj-err",children:t("projects.configInvalid")}),d&&e.jsx("span",{className:"proj-err",children:d})]}),e.jsx(H,{value:I,onChange:g,label:t("projects.projectIcon"),editLabel:t("projects.editProjectIcon"),name:`project-icon-${a.id}`,disabled:j||S}),P&&e.jsx("span",{className:"proj-err",children:P})]}):e.jsxs("div",{className:"proj-setup-row",children:[!d&&e.jsx("span",{className:"proj-dim",children:t("projects.configLoading")}),d&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"proj-err",children:d}),e.jsx("button",{className:"proj-act",type:"button",onClick:()=>k(i=>i+1),children:t("projects.configReload")})]})]})]})}function me({p:a,busyOp:n,run:t,result:o,t:c}){const[s,f]=r.useState([]),j=h=>f(d=>d.includes(h)?d.filter(x=>x!==h):[...d,h]);return e.jsxs("div",{className:"proj-drawer proj-setup",children:[e.jsxs("div",{className:"proj-setup-row",children:[e.jsx("span",{className:"proj-dim",children:c("projects.harnessLabel")}),M.map(h=>e.jsx("button",{type:"button",className:s.includes(h)?"proj-act on":"proj-act","aria-pressed":s.includes(h),disabled:!!n,onClick:()=>j(h),children:h},h))]}),e.jsxs("div",{className:"proj-setup-row",children:[e.jsx("button",{className:"proj-act primary",type:"button",disabled:!!n||!s.length,title:s.length?void 0:c("projects.harnessRequired"),onClick:()=>t("init",()=>te(a.id,s.join(","))),children:c(n==="init"?"projects.running":"projects.init")}),e.jsx("button",{className:"proj-act",type:"button",disabled:!!n,onClick:()=>t("doctor",()=>ae(a.id)),children:c(n==="doctor"?"projects.running":"projects.doctor")})]}),o&&e.jsxs("div",{className:"proj-op-result proj-full",children:[e.jsx("div",{className:o.ok?"proj-op-status ok":"proj-op-status fail",children:o.ok?c("projects.opOk",{op:c(`projects.${o.op}`)}):c("projects.opFail",{op:c(`projects.${o.op}`),code:o.code??"?"})}),o.output?e.jsx("pre",{className:"proj-log",children:o.output}):null]})]})}function he({project:a,busy:n,error:t,onClose:o,onRemove:c,t:s}){const[f,j]=r.useState(""),[h,d]=r.useState(!1),x=`REMOVE ${a.identity.title}`,v=h&&f===x&&!n;return e.jsx(T,{title:s("projects.removeTitle"),closeLabel:s("common.close"),onClose:()=>{n||o()},className:"proj-remove-modal",children:e.jsxs("div",{className:"proj-remove-copy",children:[e.jsx("p",{className:"proj-remove-warning",children:s("projects.removeWarning")}),e.jsx("p",{children:s("projects.removeKeepsFiles")}),e.jsx("p",{children:s("projects.removeStopsFirst")}),e.jsxs("label",{className:"proj-remove-check",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:m=>d(m.target.checked),disabled:n}),e.jsx("span",{children:s("projects.removeUnderstand")})]}),e.jsxs("label",{className:"proj-remove-confirm",children:[e.jsx("span",{children:s("projects.removeTypePrompt")}),e.jsx("code",{children:x}),e.jsx("input",{value:f,onChange:m=>j(m.target.value),"aria-label":s("projects.removeTypeLabel"),autoComplete:"off",spellCheck:!1,disabled:n})]}),t&&e.jsx("div",{className:"proj-err",children:t}),e.jsxs("div",{className:"proj-remove-actions",children:[e.jsx("button",{className:"proj-act",type:"button",disabled:n,onClick:o,children:s("common.cancel")}),e.jsx("button",{className:"proj-act danger",type:"button",disabled:!v,onClick:()=>c(f),children:s(n?"projects.removeBusy":"projects.removeConfirm")})]})]})})}function xe({p:a,health:n,onRefresh:t,t:o}){const[c,s]=r.useState(null),[f,j]=r.useState(!1),[h,d]=r.useState(null),[x,v]=r.useState(null),[m,E]=r.useState(null),[k,I]=r.useState(!1),[F,S]=r.useState(!1),[C,P]=r.useState(null),N=a.id===J,y=a.online===!1,R=y?"stopped":n||"probing",l=async p=>{j(!0),v(null);const b=await p();j(!1),b.ok?s(null):v(b.error||o("projects.actionFailed")),t()},g=async(p,b)=>{d(p),v(null),E(null);const L=await b();d(null),p!=="serve"?E({op:p,ok:L.ok,code:L.code,output:L.output||(L.ok?"":L.error||"")}):L.ok||v(L.error||o("projects.actionFailed")),t()},i=async p=>{S(!0),P(null);const b=await oe(a.id,p);if(S(!1),!b.ok){P(b.error||o("projects.actionFailed"));return}I(!1),t()};return e.jsxs("li",{className:N?"proj-row current":"proj-row",children:[e.jsxs("div",{className:"proj-row-main",children:[e.jsx("span",{className:`proj-health h-${R}`,"data-tip":o(`projects.health.${R}`)}),e.jsx(D,{icon:a.identity.icon,size:26}),e.jsx("span",{className:"proj-name",children:a.identity.title}),a.gated&&e.jsx(B,{name:"lock",size:12,className:"proj-locked"}),N&&e.jsx("span",{className:"proj-tag",children:o("projects.current")}),e.jsx("span",{className:"proj-path",title:a.id,children:a.root||a.id}),e.jsxs("span",{className:"proj-actions",children:[e.jsx(G,{icon:"settings",label:o("projects.configTitle"),className:c==="config"?"proj-act icon on":"proj-act icon",size:13,onClick:()=>{s(p=>p==="config"?null:"config"),v(null)}}),e.jsx(G,{icon:"terminal",label:o("projects.setupTitle"),className:c==="setup"?"proj-act icon on":"proj-act icon",size:13,onClick:()=>{s(p=>p==="setup"?null:"setup"),v(null)}}),e.jsx(G,{icon:"lock",label:o("projects.passwordTitle"),className:c==="pw"?"proj-act icon on":"proj-act icon",size:13,onClick:()=>{s(p=>p==="pw"?null:"pw"),v(null)}}),y?e.jsx("button",{className:"proj-act primary",type:"button",disabled:!!h,onClick:()=>g("serve",()=>ie(a.id)),children:o(h==="serve"?"projects.startBusy":"projects.start")}):e.jsx("a",{className:"proj-act primary",href:U(a.id),children:o("projects.open")})]})]}),x&&e.jsx("div",{className:"proj-err",children:x}),c==="pw"&&e.jsx(O,{t:o,busy:f,placeholder:o("projects.passwordPlaceholder"),onSet:p=>l(()=>de(a.id,p)),onClear:()=>l(()=>le(a.id))}),c==="config"&&e.jsx(ue,{p:a,onRefresh:t,t:o}),c==="config"&&e.jsxs("div",{className:"proj-remove-disclosure",children:[e.jsx("button",{className:"proj-remove-link",type:"button",onClick:()=>{P(null),I(!0)},children:o("projects.removeRegistration")}),e.jsx("span",{children:o("projects.removeRegistrationHint")})]}),c==="setup"&&e.jsx(me,{p:a,busyOp:h,run:g,result:m,t:o}),k&&e.jsx(he,{project:a,busy:F,error:C,onClose:()=>I(!1),onRemove:i,t:o})]})}function fe({gateway:a,onRefresh:n,t}){const[o,c]=r.useState(a.identity.icon),[s,f]=r.useState(!1),[j,h]=r.useState(null);r.useEffect(()=>{c(a.identity.icon)},[a.identity.icon]);const d=async x=>{if(s||!a.revision)return!1;const v=o;c(x),f(!0),h(null);const m=await re(x,a.revision);return f(!1),m.ok?(c(m.gateway.identity.icon),n(),!0):(c(v),h(m.error==="network"?t("projects.actionFailed"):m.error),!1)};return e.jsxs("div",{className:"proj-gateway-identity",children:[e.jsx(H,{value:o,onChange:d,label:t("projects.gatewayIcon"),editLabel:t("projects.editGatewayIcon"),name:"gateway-icon",fallback:"gateway",disabled:s||!a.revision}),j&&e.jsx("span",{className:"proj-err",children:j})]})}function Ne(){const a=q(),[n,t]=r.useState({kind:"loading"}),[o,c]=r.useState({}),[s,f]=r.useState(null),[j,h]=r.useState(!1),[d,x]=r.useState(!1),[v,m]=r.useState(null),[E,k]=r.useState(1),[I,F]=r.useState(0),S=r.useRef(0),C=r.useCallback(async()=>{const l=++S.current,g=await _();return l!==S.current?null:(g.state==="ok"?(t({kind:"ok",adminGated:g.adminGated,gateway:g.gateway,projects:g.projects}),g.projects.filter(i=>i.online!==!1).forEach(i=>{K(i.id).then(p=>{l===S.current&&c(b=>({...b,[i.id]:p}))})})):g.state==="denied"?t({kind:"denied",reason:g.reason}):t(i=>i.kind==="ok"?i:{kind:"absent"}),g)},[]);r.useEffect(()=>{let l,g=!0,i=!1;const p=async()=>{const z=await C();return(z==null?void 0:z.state)==="denied"&&(i=!0,l&&(clearInterval(l),l=void 0)),z};(async()=>{const z=await p();g&&(z==null?void 0:z.state)!=="denied"&&(l=setInterval(p,Q))})();const L=()=>{!document.hidden&&!i&&p()};return document.addEventListener("visibilitychange",L),()=>{g=!1,l&&clearInterval(l),document.removeEventListener("visibilitychange",L)}},[C,I]);const P=async l=>{x(!0),m(null);const g=await l();x(!1),g.ok?f(null):m(g.error||a("projects.actionFailed")),C()},N=V(n.kind==="ok"?n.projects:[],E);r.useEffect(()=>{N.page!==E&&k(N.page)},[N.page,E]);const y=n.kind==="loading"?e.jsx("div",{className:"loading",children:a("hud.loading")}):n.kind==="denied"?e.jsx(W,{scope:"admin",locked:n.reason==="locked",onUnlocked:()=>F(l=>l+1)}):n.kind==="absent"?e.jsx("div",{className:"proj-empty",children:e.jsx("p",{children:a("projects.absent")})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"proj-head",children:[e.jsx("span",{className:"proj-count",children:a("projects.count",{n:n.projects.length})}),e.jsxs("button",{className:j?"proj-act on":"proj-act",onClick:()=>h(!0),children:[e.jsx(B,{name:"plus",size:12})," ",a("projects.add")]}),e.jsxs("button",{className:s==="admin"?"proj-act on":"proj-act",onClick:()=>{f(l=>l==="admin"?null:"admin"),m(null)},children:[e.jsx(B,{name:"lock",size:12})," ",a("projects.adminPassword")]})]}),!n.adminGated&&e.jsx("div",{className:"proj-hint",children:a("projects.adminUngated")}),s==="admin"&&e.jsxs("div",{className:"proj-admin-pw",children:[e.jsx(O,{t:a,busy:d,placeholder:a("projects.adminPasswordPlaceholder"),onSet:l=>P(()=>Y(l)),onClear:()=>P(()=>X())}),v&&e.jsx("div",{className:"proj-err",children:v})]}),n.projects.length?e.jsx("ul",{className:"proj-list",children:N.items.map(l=>e.jsx(xe,{p:l,health:o[l.id],onRefresh:C,t:a},l.id))}):e.jsx("div",{className:"proj-empty",children:e.jsx("p",{children:a("projects.empty")})}),N.pageCount>1&&e.jsxs("nav",{className:"proj-pagination","aria-label":a("projects.pagination"),children:[e.jsx(G,{icon:"arrow-left",label:a("projects.previousPage"),className:"proj-act icon",size:14,disabled:N.page===1,onClick:()=>k(l=>l-1)}),e.jsx("span",{className:"proj-page-label",children:a("projects.pageOf",{page:N.page,pages:N.pageCount})}),e.jsx(G,{icon:"chevron-right",label:a("projects.nextPage"),className:"proj-act icon",size:14,disabled:N.page===N.pageCount,onClick:()=>k(l=>l+1)})]}),e.jsx("div",{className:"proj-page-details","aria-label":a("projects.gatewaySettings"),children:e.jsx(fe,{gateway:n.gateway,onRefresh:C,t:a})})]}),R=n.kind==="ok"?n.gateway.identity:{icon:"gateway"};return e.jsxs("div",{className:"page-pane page-projects",children:[e.jsx(pe,{className:"page-projects-scroll",children:e.jsxs("div",{className:"proj-body",children:[e.jsxs("div",{className:"cred-brand proj-brand",children:[e.jsx(D,{icon:R.icon,fallback:"gateway",size:30}),e.jsx("span",{children:"$ spexcode"})]}),e.jsx("h1",{className:"page-title",children:a("projects.title")}),y]})}),j&&e.jsx(je,{t:a,onClose:()=>h(!1),onAdded:()=>{h(!1),C()}})]})}export{Ne as default};
@@ -1,4 +1,4 @@
1
- import{r as f,am as je,al as ke,u as Le,i as Ae,j as t,an as we,ao as Ne,I as G,a as ve}from"./index-DkZ_7FOT.js";import{a2 as Ee,aY as Ce,aZ as De,ak as Me,I as ae,a_ as Te,d as Pe,e as $e,aM as me,aO as Ie,aP as ne,ag as Re,ah as de,a$ as ze,b0 as Be,b1 as Oe,b2 as qe,a9 as Ke,aQ as Fe,b3 as He}from"./tabs-Dv9P0FBJ.js";import{e as Ye,b as re,n as pe}from"./App-DI39ygL3.js";function as(e,n){const s=typeof e=="string"?e:"",c=typeof n=="string"?n:"";if(!s||!c)return null;const i=s.indexOf(c);if(i<0)return null;const o=s.slice(0,i).split(`
1
+ import{r as f,am as je,al as ke,u as Le,i as Ae,j as t,an as we,ao as Ne,I as G,a as ve}from"./index-DlgNLzN7.js";import{a2 as Ee,aY as Ce,aZ as De,ak as Me,I as ae,a_ as Te,d as Pe,e as $e,aM as me,aO as Ie,aP as ne,ag as Re,ah as de,a$ as ze,b0 as Be,b1 as Oe,b2 as qe,a9 as Ke,aQ as Fe,b3 as He}from"./tabs-BAAX-hgY.js";import{e as Ye,b as re,n as pe}from"./App-EA8glWd5.js";function as(e,n){const s=typeof e=="string"?e:"",c=typeof n=="string"?n:"";if(!s||!c)return null;const i=s.indexOf(c);if(i<0)return null;const o=s.slice(0,i).split(`
2
2
  `).length,u=o+c.split(`
3
3
  `).length-1;return ee(s,o,u).trim()===c.trim()?{startLine:o,endLine:u}:null}function ee(e,n,s){const c=(typeof e=="string"?e:"").split(`
4
4
  `);return!Number.isInteger(n)||!Number.isInteger(s)||n<1||s<n||s>c.length?"":c.slice(n-1,s).join(`
@@ -1 +1 @@
1
- import{J as k,r as d,j as e,aq as T}from"./index-DkZ_7FOT.js";import{d as y}from"./App-DI39ygL3.js";import{b6 as w,b7 as E,b8 as v,b9 as C,ba as A,bb as F,bc as I,bd as _,be as L,bf as M,V as O,W as R,X as D,Y as P,bg as z,bh as U}from"./tabs-Dv9P0FBJ.js";import{P as G}from"./Modal-DvHG_lvi.js";const m="spexcode.theme",p=[{code:"minimal",label:"Minimal",swatch:{ground:"#1b1b1b",paper:"#262626",ink:"#d1d1d1",accent:"#6c99bb"}},{code:"notion",label:"Notion",swatch:{ground:"#f7f7f5",paper:"#ffffff",ink:"#37352f",accent:"#2383e2"}},{code:"things",label:"Things",swatch:{ground:"#eceef0",paper:"#ffffff",ink:"#555e68",accent:"#2e80f2"}},{code:"tokyonight",label:"Tokyo Night",swatch:{ground:"#101018",paper:"#1a1b26",ink:"#a9b1d6",accent:"#7aa2f7"}},{code:"catppuccin",label:"Catppuccin",swatch:{ground:"#11111b",paper:"#1e1e2e",ink:"#cdd6f4",accent:"#89b4fa"}},{code:"everforest",label:"Everforest",swatch:{ground:"#232a2e",paper:"#333c43",ink:"#d3c6aa",accent:"#7fbbb3"}},{code:"gruvbox",label:"Gruvbox",swatch:{ground:"#151718",paper:"#282828",ink:"#ebdbb2",accent:"#83a598"}},{code:"rosepine",label:"Rosé Pine Dawn",swatch:{ground:"#eee4d9",paper:"#faf4ed",ink:"#575279",accent:"#56949f"}},{code:"dracula",label:"Dracula",swatch:{ground:"#191a21",paper:"#282a36",ink:"#f8f8f2",accent:"#bd93f9"}}],f=new Set(p.map(s=>s.code)),g="minimal";function H(){try{const s=localStorage.getItem(m);if(f.has(s))return s}catch{}return g}function K(s){const a=f.has(s)?s:g;try{document.documentElement.setAttribute("data-theme",a)}catch{}try{localStorage.setItem(m,a)}catch{}return a}function u({title:s,children:a}){return e.jsxs("section",{className:"set-sec",children:[e.jsx("h2",{className:"set-h",children:s}),a]})}function h({label:s,children:a}){return e.jsxs("div",{className:"set-row",children:[e.jsx("span",{className:"set-label",children:s}),e.jsx("div",{className:"set-control",children:a})]})}function b({label:s,value:a,options:l,onPick:i}){return e.jsx("div",{className:"set-seg",role:"group","aria-label":s,children:l.map(c=>e.jsx("button",{type:"button",className:c.value===a?"set-lang on":"set-lang","aria-pressed":c.value===a,onClick:()=>i(c.value),children:c.label},c.value))})}function $({t:s}){const[,a]=d.useState(0),[l,i]=d.useState(null),c=()=>a(t=>t+1);return y(t=>l?(t.preventDefault(),t.stopPropagation(),t.key==="Escape"?(i(null),!0):(["Shift","Control","Alt","Meta"].includes(t.key)||(M(l,{keys:[t.key]}),i(null),c()),!0)):!1,20),e.jsxs(u,{title:s("settings.secShortcuts"),children:[e.jsx("div",{className:"set-keys",children:O.map(t=>e.jsxs("div",{className:"set-key-row",children:[e.jsx("span",{className:"set-key-desc",children:s(t.desc)}),e.jsx("button",{className:`bind-cell${l===t.id?" capturing":""}${t.rebind?"":" fixed"}${z(t.id)?" custom":""}`,disabled:!t.rebind,onClick:()=>t.rebind&&i(t.id),children:l===t.id?e.jsx("span",{className:"bind-hint",children:s("settings.bindPrompt")}):R(t,D(t.id)).map((r,o)=>e.jsx("kbd",{children:P(r)},o))})]},t.id))}),e.jsxs("div",{className:"set-foot",children:[e.jsx("span",{className:"set-hint",children:s("settings.shortcutsHint")}),e.jsx("button",{className:"set-reset",onClick:()=>{U(),i(null),c()},children:s("settings.reset")})]})]})}function B({theme:s,on:a,onPick:l,label:i}){const{ground:c,paper:t,ink:r,accent:o}=s.swatch;return e.jsxs("button",{type:"button",className:a?"set-swatch on":"set-swatch","aria-pressed":a,onClick:l,children:[e.jsx("span",{className:"set-swatch-chip","aria-hidden":"true",style:{background:c},children:e.jsxs("span",{className:"set-swatch-paper",style:{background:t,color:r},children:[e.jsx("span",{className:"set-swatch-line",style:{background:r}}),e.jsx("span",{className:"set-swatch-line short",style:{background:o}})]})}),e.jsx("span",{className:"set-swatch-name",children:i})]})}function J(){const{t:s,lang:a,setLang:l}=k(),[i,c]=d.useState(H),[t,r]=d.useState(w),[o,S]=d.useState(E),x=n=>{K(n),c(n)},j=n=>r(_(n)),N=n=>S(L(n));return e.jsx(G,{className:"page-settings-scroll",children:e.jsxs("div",{className:"settings-body",children:[e.jsx("h1",{className:"page-title",children:s("settings.title")}),e.jsx(u,{title:s("settings.secLanguage"),children:e.jsx(h,{label:s("settings.uiLanguage"),children:e.jsx(b,{label:s("settings.secLanguage"),value:a,onPick:l,options:T.map(n=>({value:n.code,label:n.label}))})})}),e.jsx(u,{title:s("settings.secTheme"),children:e.jsx("div",{className:"set-swatches",role:"group","aria-label":s("settings.secTheme"),children:p.map(n=>e.jsx(B,{theme:n,label:s(n.label),on:n.code===i,onPick:()=>x(n.code)},n.code))})}),e.jsxs(u,{title:s("settings.secTerminal"),children:[e.jsx(h,{label:s("settings.defaultSessionSurface"),children:e.jsx(b,{label:s("settings.defaultSessionSurface"),value:o,onPick:N,options:[{value:v,label:s("session.tabTerminal")},{value:C,label:s("session.tabConversation")}]})}),e.jsx(h,{label:s("settings.terminalFontSize"),children:e.jsxs("label",{className:"set-terminal-font",children:[e.jsx("input",{type:"range",min:I,max:F,step:A,value:t,onChange:n=>j(n.target.value),"aria-label":s("settings.terminalFontSize")}),e.jsxs("output",{children:[t,"px"]})]})})]}),e.jsx($,{t:s})]})})}export{J as default};
1
+ import{J as k,r as d,j as e,aq as T}from"./index-DlgNLzN7.js";import{d as y}from"./App-EA8glWd5.js";import{b6 as w,b7 as E,b8 as v,b9 as C,ba as A,bb as F,bc as I,bd as _,be as L,bf as M,V as O,W as R,X as D,Y as P,bg as z,bh as U}from"./tabs-BAAX-hgY.js";import{P as G}from"./Modal-b-jG6-T3.js";const m="spexcode.theme",p=[{code:"minimal",label:"Minimal",swatch:{ground:"#1b1b1b",paper:"#262626",ink:"#d1d1d1",accent:"#6c99bb"}},{code:"notion",label:"Notion",swatch:{ground:"#f7f7f5",paper:"#ffffff",ink:"#37352f",accent:"#2383e2"}},{code:"things",label:"Things",swatch:{ground:"#eceef0",paper:"#ffffff",ink:"#555e68",accent:"#2e80f2"}},{code:"tokyonight",label:"Tokyo Night",swatch:{ground:"#101018",paper:"#1a1b26",ink:"#a9b1d6",accent:"#7aa2f7"}},{code:"catppuccin",label:"Catppuccin",swatch:{ground:"#11111b",paper:"#1e1e2e",ink:"#cdd6f4",accent:"#89b4fa"}},{code:"everforest",label:"Everforest",swatch:{ground:"#232a2e",paper:"#333c43",ink:"#d3c6aa",accent:"#7fbbb3"}},{code:"gruvbox",label:"Gruvbox",swatch:{ground:"#151718",paper:"#282828",ink:"#ebdbb2",accent:"#83a598"}},{code:"rosepine",label:"Rosé Pine Dawn",swatch:{ground:"#eee4d9",paper:"#faf4ed",ink:"#575279",accent:"#56949f"}},{code:"dracula",label:"Dracula",swatch:{ground:"#191a21",paper:"#282a36",ink:"#f8f8f2",accent:"#bd93f9"}}],f=new Set(p.map(s=>s.code)),g="minimal";function H(){try{const s=localStorage.getItem(m);if(f.has(s))return s}catch{}return g}function K(s){const a=f.has(s)?s:g;try{document.documentElement.setAttribute("data-theme",a)}catch{}try{localStorage.setItem(m,a)}catch{}return a}function u({title:s,children:a}){return e.jsxs("section",{className:"set-sec",children:[e.jsx("h2",{className:"set-h",children:s}),a]})}function h({label:s,children:a}){return e.jsxs("div",{className:"set-row",children:[e.jsx("span",{className:"set-label",children:s}),e.jsx("div",{className:"set-control",children:a})]})}function b({label:s,value:a,options:l,onPick:i}){return e.jsx("div",{className:"set-seg",role:"group","aria-label":s,children:l.map(c=>e.jsx("button",{type:"button",className:c.value===a?"set-lang on":"set-lang","aria-pressed":c.value===a,onClick:()=>i(c.value),children:c.label},c.value))})}function $({t:s}){const[,a]=d.useState(0),[l,i]=d.useState(null),c=()=>a(t=>t+1);return y(t=>l?(t.preventDefault(),t.stopPropagation(),t.key==="Escape"?(i(null),!0):(["Shift","Control","Alt","Meta"].includes(t.key)||(M(l,{keys:[t.key]}),i(null),c()),!0)):!1,20),e.jsxs(u,{title:s("settings.secShortcuts"),children:[e.jsx("div",{className:"set-keys",children:O.map(t=>e.jsxs("div",{className:"set-key-row",children:[e.jsx("span",{className:"set-key-desc",children:s(t.desc)}),e.jsx("button",{className:`bind-cell${l===t.id?" capturing":""}${t.rebind?"":" fixed"}${z(t.id)?" custom":""}`,disabled:!t.rebind,onClick:()=>t.rebind&&i(t.id),children:l===t.id?e.jsx("span",{className:"bind-hint",children:s("settings.bindPrompt")}):R(t,D(t.id)).map((r,o)=>e.jsx("kbd",{children:P(r)},o))})]},t.id))}),e.jsxs("div",{className:"set-foot",children:[e.jsx("span",{className:"set-hint",children:s("settings.shortcutsHint")}),e.jsx("button",{className:"set-reset",onClick:()=>{U(),i(null),c()},children:s("settings.reset")})]})]})}function B({theme:s,on:a,onPick:l,label:i}){const{ground:c,paper:t,ink:r,accent:o}=s.swatch;return e.jsxs("button",{type:"button",className:a?"set-swatch on":"set-swatch","aria-pressed":a,onClick:l,children:[e.jsx("span",{className:"set-swatch-chip","aria-hidden":"true",style:{background:c},children:e.jsxs("span",{className:"set-swatch-paper",style:{background:t,color:r},children:[e.jsx("span",{className:"set-swatch-line",style:{background:r}}),e.jsx("span",{className:"set-swatch-line short",style:{background:o}})]})}),e.jsx("span",{className:"set-swatch-name",children:i})]})}function J(){const{t:s,lang:a,setLang:l}=k(),[i,c]=d.useState(H),[t,r]=d.useState(w),[o,S]=d.useState(E),x=n=>{K(n),c(n)},j=n=>r(_(n)),N=n=>S(L(n));return e.jsx(G,{className:"page-settings-scroll",children:e.jsxs("div",{className:"settings-body",children:[e.jsx("h1",{className:"page-title",children:s("settings.title")}),e.jsx(u,{title:s("settings.secLanguage"),children:e.jsx(h,{label:s("settings.uiLanguage"),children:e.jsx(b,{label:s("settings.secLanguage"),value:a,onPick:l,options:T.map(n=>({value:n.code,label:n.label}))})})}),e.jsx(u,{title:s("settings.secTheme"),children:e.jsx("div",{className:"set-swatches",role:"group","aria-label":s("settings.secTheme"),children:p.map(n=>e.jsx(B,{theme:n,label:s(n.label),on:n.code===i,onPick:()=>x(n.code)},n.code))})}),e.jsxs(u,{title:s("settings.secTerminal"),children:[e.jsx(h,{label:s("settings.defaultSessionSurface"),children:e.jsx(b,{label:s("settings.defaultSessionSurface"),value:o,onPick:N,options:[{value:v,label:s("session.tabTerminal")},{value:C,label:s("session.tabConversation")}]})}),e.jsx(h,{label:s("settings.terminalFontSize"),children:e.jsxs("label",{className:"set-terminal-font",children:[e.jsx("input",{type:"range",min:I,max:F,step:A,value:t,onChange:n=>j(n.target.value),"aria-label":s("settings.terminalFontSize")}),e.jsxs("output",{children:[t,"px"]})]})})]}),e.jsx($,{t:s})]})})}export{J as default};
@@ -1 +1 @@
1
- import{u as d,r as n,j as s}from"./index-DkZ_7FOT.js";import{S as m}from"./NodeView-BQwIXw15.js";import{P as a}from"./ProseActions-3FcAR01Y.js";import{e as p}from"./App-DI39ygL3.js";import"./tabs-Dv9P0FBJ.js";import"./Modal-DvHG_lvi.js";import"./Thread-UIOe-Brh.js";function w({param:i}){const r=d(),{specs:e}=p(),o=n.useMemo(()=>e==null?void 0:e.find(c=>c.id===i),[e,i]),t=n.useRef(null);return e!=null&&e.length?o?s.jsx("div",{className:"specview",children:s.jsxs("div",{className:"specview-prose",ref:t,children:[s.jsx(m,{node:o}),s.jsx(a,{node:o,hostRef:t})]})}):s.jsx("div",{className:"doc-empty",children:r("specView.missing",{id:i})}):s.jsx("div",{className:"doc-empty",children:r("hud.loading")})}export{w as default};
1
+ import{u as d,r as n,j as s}from"./index-DlgNLzN7.js";import{S as m}from"./NodeView-BsvhyaG-.js";import{P as a}from"./ProseActions-DPXlFqFW.js";import{e as p}from"./App-EA8glWd5.js";import"./tabs-BAAX-hgY.js";import"./Modal-b-jG6-T3.js";import"./Thread-De7CwTom.js";function w({param:i}){const r=d(),{specs:e}=p(),o=n.useMemo(()=>e==null?void 0:e.find(c=>c.id===i),[e,i]),t=n.useRef(null);return e!=null&&e.length?o?s.jsx("div",{className:"specview",children:s.jsxs("div",{className:"specview-prose",ref:t,children:[s.jsx(m,{node:o}),s.jsx(a,{node:o,hostRef:t})]})}):s.jsx("div",{className:"doc-empty",children:r("specView.missing",{id:i})}):s.jsx("div",{className:"doc-empty",children:r("hud.loading")})}export{w as default};
@@ -1,4 +1,4 @@
1
- import{u as K,j as n,r as E,I as G,a as Q,ap as W}from"./index-DkZ_7FOT.js";import{b4 as J,K as D,aF as X,a2 as Y,aM as Z,ag as ee,ah as se,b0 as te,aP as I,aO as le,aU as ne,aV as F,k as ae,a$ as re,aQ as ie,b5 as oe}from"./tabs-Dv9P0FBJ.js";import{r as ce}from"./App-DI39ygL3.js";const xe=Object.freeze({RESULT:"result",BLIND:"blind",UNMEASURED:"unmeasured",DEFERRED:"deferred",DANGLING:"dangling"}),ue=e=>{var l;return(l=e==null?void 0:e.evidence)!=null&&l.length?e.evidence:(e==null?void 0:e.blob)!=null?[{hash:e.blob,kind:e.blobKind||"image",state:e.blobState||"present"}]:[]},ke=e=>{const l=ue(e);return l.length?["video","image","transcript","data"].filter(o=>l.some(t=>t.kind===o)):["note"]},je=e=>String(e||"").length>22?`${String(e).slice(0,8)}…`:e;function ge(e,l,o){return o.map(t=>t==="section"?e.section:e.facets[t]).filter(t=>{var u;return(t==null?void 0:t.meaningful)!==!1&&(((u=t==null?void 0:t.options)==null?void 0:u.length)>1||(t==null?void 0:t.value)!=null&&t.value!==""&&t.value!=="all")}).map(t=>({key:t.key,label:t.label,value:t.value,active:t.value!=null&&t.value!==""&&t.value!=="all",options:t.options,clearLabel:t.value==="all"?null:void 0,onChange:u=>l({[t.key]:u||null})}))}const de=/^▶\s*(\d+):([0-5]?\d)(?:\s*·\s*([^\n]*))?/,_=/^!\[frame\]\(\/api\/(?:evidence|yatsu\/blob)\/[0-9a-f]{64}\)\n?/,pe=/\/api\/(?:evidence|yatsu\/blob)\/([0-9a-f]{64})/g,he=e=>{const l=Math.floor(e/1e3);return`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`};function U(e){var h;const l=e||"",o=l.split(`
1
+ import{u as K,j as n,r as E,I as G,a as Q,ap as W}from"./index-DlgNLzN7.js";import{b4 as J,K as D,aF as X,a2 as Y,aM as Z,ag as ee,ah as se,b0 as te,aP as I,aO as le,aU as ne,aV as F,k as ae,a$ as re,aQ as ie,b5 as oe}from"./tabs-BAAX-hgY.js";import{r as ce}from"./App-EA8glWd5.js";const xe=Object.freeze({RESULT:"result",BLIND:"blind",UNMEASURED:"unmeasured",DEFERRED:"deferred",DANGLING:"dangling"}),ue=e=>{var l;return(l=e==null?void 0:e.evidence)!=null&&l.length?e.evidence:(e==null?void 0:e.blob)!=null?[{hash:e.blob,kind:e.blobKind||"image",state:e.blobState||"present"}]:[]},ke=e=>{const l=ue(e);return l.length?["video","image","transcript","data"].filter(o=>l.some(t=>t.kind===o)):["note"]},je=e=>String(e||"").length>22?`${String(e).slice(0,8)}…`:e;function ge(e,l,o){return o.map(t=>t==="section"?e.section:e.facets[t]).filter(t=>{var u;return(t==null?void 0:t.meaningful)!==!1&&(((u=t==null?void 0:t.options)==null?void 0:u.length)>1||(t==null?void 0:t.value)!=null&&t.value!==""&&t.value!=="all")}).map(t=>({key:t.key,label:t.label,value:t.value,active:t.value!=null&&t.value!==""&&t.value!=="all",options:t.options,clearLabel:t.value==="all"?null:void 0,onChange:u=>l({[t.key]:u||null})}))}const de=/^▶\s*(\d+):([0-5]?\d)(?:\s*·\s*([^\n]*))?/,_=/^!\[frame\]\(\/api\/(?:evidence|yatsu\/blob)\/[0-9a-f]{64}\)\n?/,pe=/\/api\/(?:evidence|yatsu\/blob)\/([0-9a-f]{64})/g,he=e=>{const l=Math.floor(e/1e3);return`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`};function U(e){var h;const l=e||"",o=l.split(`
2
2
  `,1)[0],t=de.exec(o);return t?{tMs:(parseInt(t[1],10)*60+parseInt(t[2],10))*1e3,step:((h=t[3])==null?void 0:h.trim())||null,label:o.trim(),rest:l.slice(o.length).replace(/^\n/,"")}:null}const H=(e,l)=>`▶${he(e)}${l?` · ${l}`:""}`,q=e=>[...(e||"").matchAll(pe)].map(l=>l[1]);function fe(e,l){if(!e)return null;if(e.step&&(l!=null&&l.length)){const o=l.find(t=>t.step===e.step);return o?{tMs:o.at,step:e.step,label:H(o.at,e.step),seekable:!0,degraded:!1}:{tMs:e.tMs,step:e.step,label:e.label,seekable:!1,degraded:!0}}return{tMs:e.tMs,step:e.step,label:e.label,seekable:!0,degraded:!1}}function Ne({originator:e,sessions:l=[],kind:o="issue",onOpenSession:t=null}){const u=K();if(!e)return null;const h=J(l,e),v=!!h,N=v?D[h.status]||D.working:D.offline,r=u(o==="eval"?"thread.originatorEval":"thread.originatorIssue",{by:e}),f=n.jsx("span",{className:"fv-originator-dot",style:{background:N},"aria-hidden":"true"});return n.jsx(X,{text:e,tip:r,label:r,lead:f,className:`fv-originator ${v?"alive":"offline"}${v&&t?" openable":""}`,onClick:v&&t?()=>t(e):null})}function Se({replies:e,onSeek:l,selIdx:o=null,activeIdx:t=null,onSelect:u=null,events:h=null,threadId:v=null,onRemarkChange:N=null}){const r=K(),[f,x]=E.useState(null),[b,k]=E.useState(null),w=async(c,y)=>{if(!f){x(y),k(null);try{const d=await W(c,y);d!=null&&d.ok?await(N==null?void 0:N()):k({ref:y,msg:(d==null?void 0:d.error)||`${c} failed`})}finally{x(null)}}};return e.map((c,y)=>{const d=c.rid!==void 0,T=d?c.resolved?" remark resolved":" remark open":"",S=`fv-reply${o===y?" sel":""}${t===y?" active":""}${T}`,m=d&&v?`${v}#${c.rid}`:null;return n.jsxs("div",{className:S,children:[n.jsxs("div",{className:"fv-reply-meta",children:[n.jsx("span",{className:"fv-reply-by",children:c.by}),c.at&&n.jsx("span",{className:"fv-reply-at",children:c.at}),d&&(c.resolved?n.jsxs("span",{className:"fv-remark-state resolved","data-tip":c.resolvedBy?r("thread.resolvedBy",{by:c.resolvedBy}):r("thread.resolved"),children:["✓ ",r("thread.resolved")]}):n.jsxs("span",{className:"fv-remark-state open","data-tip":r("thread.openRemark"),children:["● ",r("thread.openRemark")]})),m&&N&&!c.resolved&&(c.by==="human"?n.jsx("button",{type:"button",className:"fv-remark-act retract",disabled:!!f,"data-tip":r("thread.retractTitle"),onClick:()=>w("retract",m),children:r("thread.retract")}):n.jsx("button",{type:"button",className:"fv-remark-act resolve",disabled:!!f,"data-tip":r("thread.resolveTitle"),onClick:()=>w("resolve",m),children:r("thread.resolve")}))]}),b&&b.ref===m&&n.jsx("div",{className:"fv-error",children:b.msg}),c.body&&n.jsx("div",{className:"fvd-body",children:n.jsx(ne,{className:"doc-body",renderSpecRef:(p,A,g)=>{const a=ce("spec",p);return n.jsx("a",{className:"doc-link",href:a,...g,onClick:$=>ae($,a),children:p})},renderTimeAnchor:(p,A,g)=>{const a=fe({tMs:p.tMs,step:p.step,label:p.label},h),$=a!=null&&a.seekable&&l?()=>u?u(y,a.tMs):l(a.tMs):null,L=(a==null?void 0:a.label)||p.label;return $?n.jsx("button",{type:"button",className:"fv-anchor",...g,onClick:$,"data-tip":"seek the clip to this moment",children:L}):n.jsxs("span",{className:`fv-anchor static${a!=null&&a.degraded?" degraded":""}`,...g,"data-tip":a!=null&&a.degraded?r("thread.anchorDegraded"):void 0,children:[L,a!=null&&a.degraded?" ⚠":""]})},renderEvidence:(p,A,g)=>n.jsx("span",{className:"fv-reply-media","data-evidence-hash":p.hash,...g,children:n.jsx(F,{hash:p.hash,alt:p.alt||"evidence"})}),children:c.body})})]},y)})}function ve(e,l,o){const t=e.lastIndexOf(`
3
3
  `,l-1)+1,u=/^\/(\S*)$/.exec(e.slice(t,l));if(!u)return null;const h=oe(o,u[1]);return h.length?{items:h,index:0,start:t,end:l,query:u[1]}:null}function Ee({onSend:e,specs:l=[],sessions:o=[],focusId:t=null,onDone:u,anchorNow:h=null,draft:v=null,actionsEnd:N=null,commands:r=null}){const f=K(),[x,b]=E.useState(""),[k,w]=E.useState(!1),[c,y]=E.useState(""),d=E.useRef(null),{launchers:T}=Y(),S=Z({inputRef:d,value:x,setValue:b,specs:l,sessions:o,launchers:T,focusId:t,up:!0}),[m,p]=E.useState(null),A=s=>p(s&&(r!=null&&r.length)?ve(s.value,s.selectionStart,r):null),g=s=>{var C;if(!s||!m)return;const i=x.slice(0,m.start)+x.slice(m.end);if(p(null),s.run){b(i.trim()?i:""),s.run();return}const R=U(i);let M="";if(R){const j=((C=_.exec(R.rest))==null?void 0:C[0])??"";M=`${R.label}
4
4
  ${j}`,M.endsWith(`