@spexcode/spec-dashboard 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/App-DANZYsFg.js +2 -0
- package/dist/assets/EmptyView-xnSRh3XP.js +1 -0
- package/dist/assets/EvalsPage-DDxIUAuR.js +2 -0
- package/dist/assets/FileView-DZaiEPRK.js +2 -0
- package/dist/assets/GraphStats-CxHsXNy-.js +1 -0
- package/dist/assets/GraphView-DHEhg_eI.js +26 -0
- package/dist/assets/IssuesPage-B5qjvpP1.js +1 -0
- package/dist/assets/MobileApp-fvc4gfCx.js +2 -0
- package/dist/assets/NodeView-D6JZc3ap.js +3 -0
- package/dist/assets/PageScroll-DE6nL5p-.js +1 -0
- package/dist/assets/ProjectsPage-I7XFn8kG.js +1 -0
- package/dist/assets/ProseActions-LG4ve4AO.js +7 -0
- package/dist/assets/Settings-D7NeDdd1.js +1 -0
- package/dist/assets/SpecView-mkyrBxLO.js +1 -0
- package/dist/assets/Thread-Cx5fJkFO.js +9 -0
- package/dist/assets/WorkspaceSurface-DgbzdTEl.js +2 -0
- package/dist/assets/index-B-qrQ2QS.js +40 -0
- package/dist/assets/index-RoVUefLX.js +13 -0
- package/dist/assets/index-nweIph9V.css +1 -0
- package/dist/assets/tabs-Brk4lg7l.css +32 -0
- package/dist/assets/tabs-BxFTq-sB.js +334 -0
- package/dist/index.html +3 -3
- package/dist-public/assets/App-Bz1E7Es7.js +2 -0
- package/dist-public/assets/EmptyView-CX3NC0Nq.js +1 -0
- package/dist-public/assets/EvalsPage-BBzomD1v.js +2 -0
- package/dist-public/assets/FileView-Cf5bY14h.js +2 -0
- package/dist-public/assets/GraphStats-CxHsXNy-.js +1 -0
- package/dist-public/assets/GraphView-5dgjv4t6.js +26 -0
- package/dist-public/assets/IssuesPage-B_knZkH6.js +1 -0
- package/dist-public/assets/MobileApp-BpnF0xSz.js +2 -0
- package/dist-public/assets/NodeView-cN_xZ1kR.js +3 -0
- package/dist-public/assets/PageScroll-CEYT-x2I.js +1 -0
- package/dist-public/assets/ProjectsPage-CWaOO-Y7.js +1 -0
- package/dist-public/assets/ProseActions-rr5Mm1WB.js +7 -0
- package/dist-public/assets/Settings-louVIHfW.js +1 -0
- package/dist-public/assets/SpecView-qZMzQH75.js +1 -0
- package/dist-public/assets/Thread-Ca_r1oDT.js +9 -0
- package/dist-public/assets/WorkspaceSurface-bsUptX-4.js +2 -0
- package/dist-public/assets/index-3mcnUCQ1.js +40 -0
- package/dist-public/assets/index-BmOx7kVX.js +13 -0
- package/dist-public/assets/index-nweIph9V.css +1 -0
- package/dist-public/assets/tabs-BL3Okd06.js +334 -0
- package/dist-public/assets/tabs-PFmT6UqQ.css +32 -0
- package/dist-public/index.html +3 -3
- package/package.json +9 -3
- package/dist/assets/App-CyvuxJYw.js +0 -2
- package/dist/assets/Dashboard-DUitEyrD.js +0 -27
- package/dist/assets/EvalsPage-PLgW05y7.js +0 -2
- package/dist/assets/IssuesPage-BcFWiFjF.js +0 -1
- package/dist/assets/MobileApp-Dky_U9DL.js +0 -2
- package/dist/assets/Modal-8cCCnDgy.js +0 -1
- package/dist/assets/PageScroll-GBlw382O.js +0 -1
- package/dist/assets/ProjectsPage-CdKKLnBH.js +0 -1
- package/dist/assets/SessionInterface-6GBZ9nXN.css +0 -32
- package/dist/assets/SessionInterface-Dp-rUO1H.js +0 -40
- package/dist/assets/SessionWindow-D2zgUVTT.js +0 -1
- package/dist/assets/Settings-7cKD-jHj.js +0 -1
- package/dist/assets/Thread-BkaL_dog.js +0 -13
- package/dist/assets/TimelineChat-Cp579UoJ.css +0 -1
- package/dist/assets/TimelineChat-DOKwQ3Sd.js +0 -276
- package/dist/assets/bindings-BC9vqpYU.js +0 -1
- package/dist/assets/data-CHkRTrsm.js +0 -1
- package/dist/assets/index-Ba-oHmxn.css +0 -1
- package/dist/assets/index-Di9gWPc6.js +0 -41
- package/dist/assets/sessionSurface-H34ExWBA.js +0 -1
- package/dist-public/assets/App-DebAWelc.js +0 -2
- package/dist-public/assets/Dashboard-DhuzsOUh.js +0 -27
- package/dist-public/assets/EvalsPage-CHc1tT-0.js +0 -2
- package/dist-public/assets/IssuesPage-BqojZnnr.js +0 -1
- package/dist-public/assets/MobileApp-DevENU8x.js +0 -2
- package/dist-public/assets/Modal-DAUYhrDn.js +0 -1
- package/dist-public/assets/PageScroll-Bxaqks4c.js +0 -1
- package/dist-public/assets/ProjectsPage-GHR6vTck.js +0 -1
- package/dist-public/assets/SessionInterface-6GBZ9nXN.css +0 -32
- package/dist-public/assets/SessionInterface-C0Fy_tWd.js +0 -40
- package/dist-public/assets/SessionWindow-CkdNpele.js +0 -1
- package/dist-public/assets/Settings-1XN_EQnW.js +0 -1
- package/dist-public/assets/Thread-BHCpsJIa.js +0 -13
- package/dist-public/assets/TimelineChat-N9RZ6v95.js +0 -276
- package/dist-public/assets/TimelineChat-dIRGbAJA.css +0 -1
- package/dist-public/assets/bindings-BC9vqpYU.js +0 -1
- package/dist-public/assets/data-BmO9k_xP.js +0 -1
- package/dist-public/assets/index-Ba-oHmxn.css +0 -1
- package/dist-public/assets/index-oM1cUuGR.js +0 -41
- package/dist-public/assets/sessionSurface-BNwc7E-I.js +0 -1
- /package/dist/assets/{Dashboard-BnuhLJ6X.css → GraphView-BnuhLJ6X.css} +0 -0
- /package/dist-public/assets/{Dashboard-BnuhLJ6X.css → GraphView-BnuhLJ6X.css} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EvalsPage-DDxIUAuR.js","assets/index-B-qrQ2QS.js","assets/index-nweIph9V.css","assets/Thread-Cx5fJkFO.js","assets/tabs-BxFTq-sB.js","assets/App-DANZYsFg.js","assets/PageScroll-DE6nL5p-.js","assets/tabs-Brk4lg7l.css","assets/IssuesPage-B5qjvpP1.js","assets/NodeView-D6JZc3ap.js","assets/ProseActions-LG4ve4AO.js","assets/Settings-D7NeDdd1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as T,r as o,j as s,_ as O,I as H}from"./index-B-qrQ2QS.js";import{aa as D,K as M,ab as $,x as K,ac as B,ad as Q,ae as U,af as J,S as F,ag as W,a3 as Z,ah as q,ai as G,J as X,L as Y,Q as ss,aj as es,ak as as,al as ns}from"./tabs-BxFTq-sB.js";import{p as ts,u as ls,S as is,H as cs,I as os,E as rs,a as ms}from"./NodeView-D6JZc3ap.js";import{n as I}from"./App-DANZYsFg.js";import"./PageScroll-DE6nL5p-.js";import"./Thread-Cx5fJkFO.js";import"./ProseActions-LG4ve4AO.js";const ds=o.lazy(()=>O(()=>import("./EvalsPage-DDxIUAuR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),us=o.lazy(()=>O(()=>import("./IssuesPage-B5qjvpP1.js"),__vite__mapDeps([8,1,2,4,5,6,7,9,3,10]))),hs=o.lazy(()=>O(()=>import("./Settings-D7NeDdd1.js"),__vite__mapDeps([11,1,2,5,4,6,7]))),bs={spec:"nodeView.paneSpec",history:"nodeView.paneHistory",issues:"nodeView.paneIssues",eval:"nodeView.paneEval",edit:"nodeView.paneEdit"},z=(e,l)=>l.filter(r=>{var m;return(m=r.ops)==null?void 0:m.some(c=>c.nodeId===e.id)});function R({status:e}){const l=F[e]||F.pending;return s.jsx("span",{className:"m-dot",style:{background:l.color}})}function ps({node:e,kids:l,editors:r,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}),r.length>0&&s.jsx("span",{className:"m-row-faces",children:r.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:r,onOpenChild:m}){const c=T(),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]=o.useState(null),[p,k]=o.useState({issues:{},eval:{}});o.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,r);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,r),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(os,{node:e,sessions:r,filter:p.issues,onFilter:a=>x("issues",a)}),n==="eval"&&s.jsx(rs,{node:e,sessions:r,filter:p.eval,onFilter:a=>x("eval",a)}),n==="edit"&&s.jsx(ms,{node:e})]})]})}function js({s:e,sessions:l,onBack:r}){const m=T();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:r,"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:r,onLaunched:m}){const c=T(),{launchers:u,launcher:b,pickLauncher:h}=Z(),[j,N]=o.useState(!1),[p,k]=o.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:r,"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:r,setOpenId:m,creating:c,setCreating:u,newDraft:b,setNewDraft:h}){const j=T(),N=r?l.find(i=>i.id===r):null,{expanded:p,toggle:k}=$(),[x,n]=o.useState(!1),v=o.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(Q,{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(U,{s:a,locked:!1,showAvatar:!1,lead:S})}),i.expandable&&s.jsx(J,{expanded:i.expanded,rollup:i.rollup,kin:i.kin,onToggle:()=>k(a.id)})]},a.id)})]})}function Ts({specs:e,sessions:l,issuesStamp:r,reloadBoard:m,route:c={}}){const u=T(),b=o.useMemo(()=>Object.fromEntries(e.map(t=>[t.id,t])),[e]),h=o.useMemo(()=>e.find(t=>!t.parent)||e[0],[e]),j=o.useMemo(()=>{const t={};return e.forEach(d=>{var P;d.parent&&(t[P=d.parent]??(t[P]=[])).push(d)}),d=>t[d]||[]},[e]),[N,p]=o.useState("specs"),[k,x]=o.useState(()=>h?[h.id]:[]),[n,v]=o.useState(null),[i,a]=o.useState(!1),[S,y]=o.useState(""),{page:f="graph",param:w=null}=c,g=f==="evals"||f==="issues"||f==="settings"?f:N;o.useEffect(()=>{f==="sessions"&&w&&(p("sessions"),v(w))},[f,w]),o.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=>{if(t==="evals"||t==="issues"){I(t);return}p(t),(f==="evals"||f==="issues"||f==="settings")&&I(t==="specs"?"graph":"sessions")},L=t=>{p("sessions"),v(t),I("sessions",t)},E=k.filter(t=>b[t]),A=E[E.length-1]||(h==null?void 0:h.id),C=A?b[A]:null,V=t=>x(d=>[...d.filter(P=>b[P]),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(o.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:r,reloadBoard:m,onOpenSession:L}):s.jsx(us,{specs:e,sessions:l,issuesStamp:r,onOpenSession:L})})}):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:()=>_("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:()=>_("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:()=>_("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:()=>_("issues"),children:[s.jsx("span",{className:"m-tabbar-ico",children:"◎"}),u("mobile.issuesTab")]})]})]})}export{Ts as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{j as e,r as v,ai as Q,u as f,I as $,h as re,m as ce}from"./index-B-qrQ2QS.js";import{U as oe,T as de,Q as y,an as he,R as Y,O as J,aS as X,aT as Z,a6 as ee,aE as ue,aU as pe,aV as me,aW as ve,k as I,aX as fe,aJ as xe,V as je,aY as k,ag as Ne}from"./tabs-BxFTq-sB.js";import{f as se,E as L,c as ge,e as we}from"./Thread-Cx5fJkFO.js";import{r as R,d as be,O as ye,S as U}from"./App-DANZYsFg.js";import{u as Ve,l as q,P as ke}from"./ProseActions-LG4ve4AO.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
|
+
`);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
|
+
`)){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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as b,j as i,a as L}from"./index-B-qrQ2QS.js";import{N as k}from"./App-DANZYsFg.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())}function _({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})]})})}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 G({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})}export{_ as M,G as P,I as i,R as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as q,r,j as e,I as B,a as G,e as J,q as U}from"./index-B-qrQ2QS.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-DANZYsFg.js";import{P as pe,M as T}from"./PageScroll-DE6nL5p-.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};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as f,aj as Q,ai as V,u as S,i as ss,j as a,A as ts,ak as ns,I as W}from"./index-B-qrQ2QS.js";import{e as es,b as Y,n as J}from"./App-DANZYsFg.js";import{a3 as as,aZ as rs,a_ as is,al as ls,J as _,a$ as us,b0 as cs,ao as os}from"./tabs-BxFTq-sB.js";function js(s,n){const t=typeof s=="string"?s:"",l=typeof n=="string"?n:"";if(!t||!l)return null;const r=t.indexOf(l);if(r<0)return null;const d=t.slice(0,r).split(`
|
|
2
|
+
`).length,c=d+l.split(`
|
|
3
|
+
`).length-1;return M(t,d,c).trim()===l.trim()?{startLine:d,endLine:c}:null}function M(s,n,t){const l=(typeof s=="string"?s:"").split(`
|
|
4
|
+
`);return!Number.isInteger(n)||!Number.isInteger(t)||n<1||t<n||t>l.length?"":l.slice(n-1,t).join(`
|
|
5
|
+
`)}function U(s,n){if(!s||!n||s.collapsed)return null;const t=[...n.querySelectorAll("[data-l0]")].filter(c=>{try{return s.intersectsNode(c)}catch{return!1}}),l=t.filter(c=>!t.some(u=>u!==c&&c.contains(u)));let r=1/0,d=-1/0;for(const c of l){const u=Number(c.dataset.l0),p=Number(c.dataset.l1);!Number.isInteger(u)||!Number.isInteger(p)||u<1||p<u||(u<r&&(r=u),p>d&&(d=p))}return d>=r?{startLine:r,endLine:d}:null}function ps(s,n,t){if(!(s!=null&&s.id)||!(s!=null&&s.path)||!t)return null;const l=M(n,t.startLine,t.endLine);return l.trim()?{node:s.id,path:s.path,startLine:t.startLine,endLine:t.endLine,text:l}:null}const ms=["edit","polish","explain"],H=new Map;function fs(s,n,{embedded:t=!1,publicGraph:l=!1}={}){const r=`${l?"public:":""}${s}@${n??""}`,[d,c]=f.useState(()=>H.get(r)??null);return f.useEffect(()=>{if(t||!s)return;const u=H.get(r);if(u){c(u);return}c(null);let p=!0;return(l?Q(s):fetch(V(s,"content")).then(y=>y.ok?y.json():Promise.reject(y.status))).then(y=>{H.set(r,y),p&&c(y)}).catch(()=>{p&&c({body:"",parts:null})}),()=>{p=!1}},[t,s,n,r,l]),d}const I=8;function z(s,n,t){const l=f.useRef(null),[r,d]=f.useState({left:s,top:n,visibility:"hidden"});return f.useLayoutEffect(()=>{var u;const c=(u=l.current)==null?void 0:u.getBoundingClientRect();c&&d({left:Math.max(I,Math.min(s,window.innerWidth-c.width-I)),top:Math.max(I,Math.min(n,window.innerHeight-c.height-I)),visibility:"visible"})},[s,n,...t]),[l,r]}const ds=[{key:"send",icon:"send",preset:null,jump:!1},{key:"editSend",icon:"message-square",preset:"edit",jump:!1},{key:"explain",icon:"info",preset:"explain",jump:!0},{key:"manual",icon:"pencil",preset:null,jump:!1}];function ks({node:s,hostRef:n,codeSelection:t=null,onCodeSelectionClear:l}){const r=S(),{sessions:d=[]}=es(),{launcher:c}=as(),{notify:u}=ss(),p=fs(s==null?void 0:s.id,s==null?void 0:s.version),N=(s==null?void 0:s.body)??(p==null?void 0:p.body)??"",y=!!t||(s==null?void 0:s.body)!=null||p!==null,[i,j]=f.useState(null),[m,E]=f.useState(null),[w,h]=f.useState(""),[B,O]=f.useState(""),[R,A]=f.useState(!1),[X,v]=f.useState(null),$=d.filter(e=>rs(e)==="live"),C=f.useCallback(()=>{E(null),v(null),A(!1)},[]),T=f.useCallback(()=>{j(null),l==null||l(),C()},[C,l]);f.useEffect(()=>{t||(E(null),v(null),A(!1))},[t==null?void 0:t.path,t==null?void 0:t.startLine,t==null?void 0:t.endLine,t==null?void 0:t.text]);const D=f.useRef(!1);D.current=!!m,f.useEffect(()=>{const e=n==null?void 0:n.current;if(!e)return;const g=()=>{if(D.current)return;const b=document.getSelection();if(!b||b.isCollapsed||b.rangeCount===0){j(null);return}const k=b.getRangeAt(0);if(!e.contains(k.commonAncestorContainer))return;const P=U(k,e);if(!P){j(null);return}const L=k.getBoundingClientRect();j({lines:P,x:L.left,y:L.top})},x=()=>window.setTimeout(g,0);return e.addEventListener("mouseup",x),e.addEventListener("keyup",x),()=>{e.removeEventListener("mouseup",x),e.removeEventListener("keyup",x)}},[n]),f.useEffect(()=>{const e=n==null?void 0:n.current;if(!e)return;const g=x=>{if(D.current)return;if(t){x.preventDefault(),E(null),j({lines:{startLine:t.startLine,endLine:t.endLine},x:x.clientX,y:x.clientY+18});return}const b=document.getSelection();if(!b||b.isCollapsed||b.rangeCount===0)return;const k=U(b.getRangeAt(0),e);k&&(x.preventDefault(),E(null),j({lines:k,x:x.clientX,y:x.clientY+18}))};return e.addEventListener("contextmenu",g),()=>e.removeEventListener("contextmenu",g)},[n,t==null?void 0:t.path,t==null?void 0:t.startLine,t==null?void 0:t.endLine,t==null?void 0:t.text]),Y(!!m,C),Y(!!(i||t)&&!m,T),f.useEffect(()=>{if(!m)return;const e=g=>{var x,b;(b=(x=g.target).closest)!=null&&b.call(x,".pa-card")||C()};return document.addEventListener("mousedown",e,!0),()=>document.removeEventListener("mousedown",e,!0)},[m,C]);const o=t||i&&(y?ps(s,N,i.lines):{node:s==null?void 0:s.id,path:s==null?void 0:s.path,startLine:i.lines.startLine,endLine:i.lines.endLine,text:""}),q=!t&&!!i&&!y,Z=(e,g)=>{var k;const x=(g==null?void 0:g.clientX)??(i==null?void 0:i.x)??(o==null?void 0:o.x)??0,b=((g==null?void 0:g.clientY)??(i==null?void 0:i.y)??(o==null?void 0:o.y)??0)+14;if(v(null),e.key==="manual"&&!t){h(M(N,i.lines.startLine,i.lines.endLine)),E({kind:"manual",x,y:b});return}h(e.preset?r(`proseActions.prompt.${e.preset}`):""),$.some(P=>P.id===B)||O(((k=$[0])==null?void 0:k.id)||"new"),E({kind:"send",x,y:b,jump:e.jump})},G=async e=>{var P;if(!o)return;const g=B||"new",x=is(w,[o]);if(g==="new"){A(!0),v(null);const L=await ls(x,c);if(A(!1),!L.ok){v(L.error||r("proseActions.sendFailed"));return}u(r("proseActions.sentTo",{name:_(L.session)||((P=L.id)==null?void 0:P.slice(0,8))||r("proseActions.newSession")}),{kind:"success"}),T(),L.id&&(us("sessions",L.id,null),J("sessions",L.id));return}A(!0),v(null);const b=await ts(g,x);if(A(!1),!b.ok){v(b.error||r("proseActions.sendFailed"));return}const k=_($.find(L=>L.id===g))||g.slice(0,8);u(r("proseActions.sentTo",{name:k}),{kind:"success"}),T(),e&&J("sessions",g)},K=async()=>{if(i){A(!0),v(null);try{const e=await ns(s.id,{startLine:i.lines.startLine,endLine:i.lines.endLine,original:M(N,i.lines.startLine,i.lines.endLine),replacement:w});A(!1),u(e.changed?r("proseActions.committed",{sha:(e.commit||"").slice(0,7)}):r("proseActions.noChange"),{kind:e.changed?"success":"info"}),T()}catch(e){A(!1),v(e!=null&&e.current?`${e.message}
|
|
6
|
+
|
|
7
|
+
${e.current}`:String((e==null?void 0:e.message)||e))}}};if(!s&&!t||!o&&!q)return null;const F={lines:(i==null?void 0:i.lines)||{startLine:(o==null?void 0:o.startLine)||1,endLine:(o==null?void 0:o.endLine)||1},x:(i==null?void 0:i.x)??(o==null?void 0:o.x)??0,y:(i==null?void 0:i.y)??(o==null?void 0:o.y)??0};return a.jsxs(a.Fragment,{children:[!m&&o&&a.jsx(xs,{t:r,hit:F,disabled:q,manualEnabled:!t,onPick:Z}),!m&&q&&a.jsx("span",{className:"pa-loading",role:"status",style:{left:F.x,top:F.y},children:a.jsx("span",{className:"spinner","aria-label":r("common.loading")})}),(m==null?void 0:m.kind)==="send"&&a.jsx(gs,{t:r,panel:m,selection:o,sessions:$,target:B,setTarget:O,draft:w,setDraft:h,busy:R,error:X,onSend:G,onRemove:T,onClose:C}),(m==null?void 0:m.kind)==="manual"&&a.jsx(bs,{t:r,panel:m,node:s,lines:i.lines,draft:w,setDraft:h,busy:R,error:X,onCommit:K,onClose:C})]})}function xs({t:s,hit:n,onPick:t,disabled:l=!1,manualEnabled:r=!0}){const[d,c]=z(n.x,n.y-44,[n.lines.startLine,n.lines.endLine]);return a.jsx("div",{ref:d,className:"pa-group",role:"menu","aria-label":s("proseActions.groupLabel"),style:c,children:ds.map(u=>a.jsxs("button",{type:"button",role:"menuitem",className:"pa-act",disabled:l||u.key==="manual"&&!r,onMouseDown:p=>p.preventDefault(),onClick:p=>t(u,p),children:[a.jsx(W,{name:u.icon,size:13,className:"pa-act-icon"}),s(`proseActions.act.${u.key}`)]},u.key))})}function gs({t:s,panel:n,selection:t,sessions:l,target:r,setTarget:d,draft:c,setDraft:u,busy:p,error:N,onSend:y,onRemove:i,onClose:j}){const[m,E]=z(n.x,n.y,[]),w=f.useRef(null);return f.useEffect(()=>{var h;(h=w.current)==null||h.focus()},[]),a.jsxs("div",{ref:m,className:"pa-card pa-send",role:"dialog","aria-label":s("proseActions.sendLabel"),style:E,children:[a.jsx(cs,{selection:t,onRemove:i}),a.jsx("textarea",{ref:w,className:"pa-input",rows:3,value:c,placeholder:s("proseActions.messagePlaceholder"),onChange:h=>u(h.target.value)}),a.jsx("div",{className:"pa-presets",children:ms.map(h=>a.jsx("button",{type:"button",className:"pa-preset",onClick:()=>u(s(`proseActions.prompt.${h}`)),children:s(`proseActions.preset.${h}`)},h))}),a.jsxs("div",{className:"pa-target",children:[a.jsx("span",{className:"pa-target-label",children:s("proseActions.target")}),a.jsx(os,{sessions:l,value:r,onChange:d,includeNew:!0,filter:!0,compact:!0,className:"pa-session-picker",ariaLabel:s("proseActions.target")})]}),N&&a.jsx("div",{className:"pa-error",role:"alert",children:N}),a.jsxs("div",{className:"pa-foot",children:[a.jsx("button",{type:"button",className:"pa-btn",onClick:j,children:s("common.cancel")}),a.jsx("button",{type:"button",className:"pa-btn",disabled:p,onClick:()=>y(!1),children:s("proseActions.send")}),a.jsx("button",{type:"button",className:"pa-btn pa-go",disabled:p,onClick:()=>y(!0),children:s("proseActions.sendJump")})]})]})}function bs({t:s,panel:n,node:t,lines:l,draft:r,setDraft:d,busy:c,error:u,onCommit:p,onClose:N}){const[y,i]=z(n.x,n.y,[]),j=f.useRef(null);return f.useEffect(()=>{var m;(m=j.current)==null||m.focus()},[]),a.jsxs("div",{ref:y,className:"pa-card pa-edit",role:"dialog","aria-label":s("proseActions.editLabel"),style:i,children:[a.jsxs("div",{className:"pa-edit-head",children:[a.jsx(W,{name:"pencil",size:12}),a.jsx("span",{className:"pa-edit-where",children:t.path}),a.jsx("span",{className:"pa-edit-lines",children:s("proseActions.lines",{a:l.startLine,b:l.endLine})})]}),a.jsx("textarea",{ref:j,className:"pa-input pa-edit-input",rows:10,value:r,spellCheck:!1,onChange:m=>d(m.target.value)}),u&&a.jsx("div",{className:"pa-error",role:"alert",children:u}),a.jsxs("div",{className:"pa-foot",children:[a.jsx("span",{className:"pa-note",children:s("proseActions.editNote")}),a.jsx("button",{type:"button",className:"pa-btn",onClick:N,children:s("common.cancel")}),a.jsx("button",{type:"button",className:"pa-btn pa-go",disabled:c,onClick:p,children:s(c?"proseActions.committing":"proseActions.commit")})]})]})}export{ks as P,js as l,fs as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as k,r as d,j as e,am as T}from"./index-B-qrQ2QS.js";import{d as y}from"./App-DANZYsFg.js";import{b4 as w,b5 as E,b6 as v,b7 as C,b8 as A,b9 as F,ba as I,bb as _,bc as L,bd as M,W as O,X as R,Y as D,Z as P,be as z,bf as U}from"./tabs-BxFTq-sB.js";import{P as B}from"./PageScroll-DE6nL5p-.js";const b="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 G(){try{const s=localStorage.getItem(b);if(f.has(s))return s}catch{}return g}function H(s){const a=f.has(s)?s:g;try{document.documentElement.setAttribute("data-theme",a)}catch{}try{localStorage.setItem(b,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 m({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 K({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 $({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 Z(){const{t:s,lang:a,setLang:l}=k(),[i,c]=d.useState(G),[t,r]=d.useState(w),[o,S]=d.useState(E),x=n=>{H(n),c(n)},j=n=>r(_(n)),N=n=>S(L(n));return e.jsx(B,{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(m,{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($,{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(m,{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(K,{t:s})]})})}export{Z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as d,r as n,j as s}from"./index-B-qrQ2QS.js";import{S as m}from"./NodeView-D6JZc3ap.js";import{P as a}from"./ProseActions-LG4ve4AO.js";import{e as p}from"./App-DANZYsFg.js";import"./tabs-BxFTq-sB.js";import"./PageScroll-DE6nL5p-.js";import"./Thread-Cx5fJkFO.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};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{u as K,j as n,r as E,I as z,a as W,al as Q}from"./index-B-qrQ2QS.js";import{b1 as J,L as B,aG as X,a3 as Y,aN as Z,ah as ee,ai as se,b2 as te,aQ as I,aP as le,aV as ne,aW as q,k as ae,aR as re,b3 as ie}from"./tabs-BxFTq-sB.js";import{r as oe}from"./App-DANZYsFg.js";const ye=Object.freeze({RESULT:"result",BLIND:"blind",UNMEASURED:"unmeasured",DEFERRED:"deferred",DANGLING:"dangling"}),ce=s=>{var l;return(l=s==null?void 0:s.evidence)!=null&&l.length?s.evidence:(s==null?void 0:s.blob)!=null?[{hash:s.blob,kind:s.blobKind||"image",state:s.blobState||"present"}]:[]},xe=s=>{const l=ce(s);return l.length?["video","image","transcript","data"].filter(o=>l.some(t=>t.kind===o)):["note"]},ke=s=>String(s||"").length>22?`${String(s).slice(0,8)}…`:s;function ge(s,l,o){return o.map(t=>t==="section"?s.section:s.facets[t]).filter(t=>{var d;return(t==null?void 0:t.meaningful)!==!1&&(((d=t==null?void 0:t.options)==null?void 0:d.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:d=>l({[t.key]:d||null})}))}const ue=/^▶\s*(\d+):([0-5]?\d)(?:\s*·\s*([^\n]*))?/,O=/^!\[frame\]\(\/api\/(?:evidence|yatsu\/blob)\/[0-9a-f]{64}\)\n?/,de=/\/api\/(?:evidence|yatsu\/blob)\/([0-9a-f]{64})/g,pe=s=>{const l=Math.floor(s/1e3);return`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`};function _(s){var f;const l=s||"",o=l.split(`
|
|
2
|
+
`,1)[0],t=ue.exec(o);return t?{tMs:(parseInt(t[1],10)*60+parseInt(t[2],10))*1e3,step:((f=t[3])==null?void 0:f.trim())||null,label:o.trim(),rest:l.slice(o.length).replace(/^\n/,"")}:null}const F=(s,l)=>`▶${pe(s)}${l?` · ${l}`:""}`,U=s=>[...(s||"").matchAll(de)].map(l=>l[1]);function fe(s,l){if(!s)return null;if(s.step&&(l!=null&&l.length)){const o=l.find(t=>t.step===s.step);return o?{tMs:o.at,step:s.step,label:F(o.at,s.step),seekable:!0,degraded:!1}:{tMs:s.tMs,step:s.step,label:s.label,seekable:!1,degraded:!0}}return{tMs:s.tMs,step:s.step,label:s.label,seekable:!0,degraded:!1}}function je({originator:s,sessions:l=[],kind:o="issue",onOpenSession:t=null}){const d=K();if(!s)return null;const f=J(l,s),b=!!f,N=b?B[f.status]||B.working:B.offline,i=d(o==="eval"?"thread.originatorEval":"thread.originatorIssue",{by:s}),h=n.jsx("span",{className:"fv-originator-dot",style:{background:N},"aria-hidden":"true"});return n.jsx(X,{text:s,tip:i,label:i,lead:h,className:`fv-originator ${b?"alive":"offline"}${b&&t?" openable":""}`,onClick:b&&t?()=>t(s):null})}function Ne({replies:s,onSeek:l,selIdx:o=null,activeIdx:t=null,onSelect:d=null,events:f=null,threadId:b=null,onRemarkChange:N=null}){const i=K(),[h,x]=E.useState(null),[m,k]=E.useState(null),D=async(c,y)=>{if(!h){x(y),k(null);try{const p=await Q(c,y);p!=null&&p.ok?await(N==null?void 0:N()):k({ref:y,msg:(p==null?void 0:p.error)||`${c} failed`})}finally{x(null)}}};return s.map((c,y)=>{const p=c.rid!==void 0,C=p?c.resolved?" remark resolved":" remark open":"",S=`fv-reply${o===y?" sel":""}${t===y?" active":""}${C}`,v=p&&b?`${b}#${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}),p&&(c.resolved?n.jsxs("span",{className:"fv-remark-state resolved","data-tip":c.resolvedBy?i("thread.resolvedBy",{by:c.resolvedBy}):i("thread.resolved"),children:["✓ ",i("thread.resolved")]}):n.jsxs("span",{className:"fv-remark-state open","data-tip":i("thread.openRemark"),children:["● ",i("thread.openRemark")]})),v&&N&&!c.resolved&&(c.by==="human"?n.jsx("button",{type:"button",className:"fv-remark-act retract",disabled:!!h,"data-tip":i("thread.retractTitle"),onClick:()=>D("retract",v),children:i("thread.retract")}):n.jsx("button",{type:"button",className:"fv-remark-act resolve",disabled:!!h,"data-tip":i("thread.resolveTitle"),onClick:()=>D("resolve",v),children:i("thread.resolve")}))]}),m&&m.ref===v&&n.jsx("div",{className:"fv-error",children:m.msg}),c.body&&n.jsx("div",{className:"fvd-body",children:n.jsx(ne,{className:"doc-body",renderSpecRef:(u,M,j)=>{const r=oe("spec",u);return n.jsx("a",{className:"doc-link",href:r,...j,onClick:A=>ae(A,r),children:u})},renderTimeAnchor:(u,M,j)=>{const r=fe({tMs:u.tMs,step:u.step,label:u.label},f),A=r!=null&&r.seekable&&l?()=>d?d(y,r.tMs):l(r.tMs):null,L=(r==null?void 0:r.label)||u.label;return A?n.jsx("button",{type:"button",className:"fv-anchor",...j,onClick:A,"data-tip":"seek the clip to this moment",children:L}):n.jsxs("span",{className:`fv-anchor static${r!=null&&r.degraded?" degraded":""}`,...j,"data-tip":r!=null&&r.degraded?i("thread.anchorDegraded"):void 0,children:[L,r!=null&&r.degraded?" ⚠":""]})},renderEvidence:(u,M,j)=>n.jsx("span",{className:"fv-reply-media","data-evidence-hash":u.hash,...j,children:n.jsx(q,{hash:u.hash,alt:u.alt||"evidence"})}),children:c.body})})]},y)})}function he(s,l,o){const t=s.lastIndexOf(`
|
|
3
|
+
`,l-1)+1,d=/^\/(\S*)$/.exec(s.slice(t,l));if(!d)return null;const f=ie(o,d[1]);return f.length?{items:f,index:0,start:t,end:l,query:d[1]}:null}function Se({onSend:s,specs:l=[],sessions:o=[],focusId:t=null,onDone:d,anchorNow:f=null,draft:b=null,actionsEnd:N=null,commands:i=null}){const h=K(),[x,m]=E.useState(""),[k,D]=E.useState(!1),[c,y]=E.useState(""),p=E.useRef(null),{launchers:C}=Y(),S=Z({inputRef:p,value:x,setValue:m,specs:l,sessions:o,launchers:C,focusId:t,up:!0}),[v,u]=E.useState(null),M=e=>u(e&&(i!=null&&i.length)?he(e.value,e.selectionStart,i):null),j=e=>{var w;if(!e||!v)return;const a=x.slice(0,v.start)+x.slice(v.end);if(u(null),e.run){m(a.trim()?a:""),e.run();return}const R=_(a);let $="";if(R){const g=((w=O.exec(R.rest))==null?void 0:w[0])??"";$=`${R.label}
|
|
4
|
+
${g}`,$.endsWith(`
|
|
5
|
+
`)||($+=`
|
|
6
|
+
`)}m($+e.prefill()),requestAnimationFrame(()=>{const g=p.current;g&&(g.focus(),g.setSelectionRange(g.value.length,g.value.length))})},r=e=>v?e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),u(a=>({...a,index:(a.index+1)%a.items.length})),!0):e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),u(a=>({...a,index:(a.index-1+a.items.length)%a.items.length})),!0):e.key==="Enter"||e.key==="Tab"?(e.preventDefault(),e.stopPropagation(),j(v.items[v.index]),!0):e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),u(null),!0):!1:!1,A=U(x);E.useEffect(()=>{var e;if(!b){m("");return}m(b.body||""),(e=p.current)==null||e.focus()},[b==null?void 0:b.seq]);const L=async()=>{var R;const e=await(f==null?void 0:f());if(!e)return;const a=F(e.tMs,e.step)+(e.frame?`
|
|
7
|
+
`:"");m($=>{const w=_($),g=(w?w.rest:$).replace(O,"");return g?`${a}
|
|
8
|
+
${g}`:`${a}
|
|
9
|
+
`}),(R=p.current)==null||R.focus()},T=e=>re(p.current,e,m,a=>{S.sync(a),M(a)}),P=async()=>{const e=x.trim();if(!(!e||k)){D(!0);try{const a=await s(e,U(e));a!=null&&a.ok?(m(""),y(""),await(d==null?void 0:d(a.outcomes||""))):y((a==null?void 0:a.error)||"reply failed")}finally{D(!1)}}},G=A.length>0?n.jsx("div",{className:"fv-frames",children:A.map(e=>n.jsx(q,{hash:e,alt:"frame"},e))}):null,H=n.jsxs("div",{className:"fv-tawrap",children:[n.jsx(ee,{ref:p,className:"fv-textarea",rows:1,value:x,placeholder:h("session.issuesReplyPlaceholder"),disabled:k,onChange:e=>{m(e.target.value),S.sync(e.target),M(e.target)},onSelect:e=>{S.sync(e.target),M(e.target)},onBlur:()=>{S.close(),u(null)},onKeyDown:e=>{se(e)||r(e)||S.onKeyDown(e)||e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),P())}}),S.menuEl,v&&n.jsx(te,{menu:v,up:!0,head:v.query?`/${v.query}`:h("annotator.menuReview"),onPick:j,onHover:e=>u(a=>a&&{...a,index:e})})]}),V=n.jsxs("div",{className:"fv-actions",children:[n.jsx(I,{label:h("thread.mentionActor"),disabled:k,onClick:()=>T("@"),children:"@"}),n.jsx(I,{label:h("thread.mentionNode"),disabled:k,onClick:()=>T("[["),children:"[["}),(i==null?void 0:i.length)>0&&n.jsx(I,{label:h("thread.reviewCommands"),disabled:k,onClick:()=>T("/"),children:"/"}),f&&n.jsxs("button",{type:"button",className:"fv-anchor-btn","data-tip":h("thread.anchorTitle"),onMouseDown:e=>e.preventDefault(),onClick:L,children:[n.jsx(z,{name:"clock",size:11})," ",h("thread.anchorNow")]}),c&&n.jsx("span",{className:"fv-error",children:c}),n.jsxs("div",{className:"fv-actions-end",children:[N,n.jsx(W,{icon:"send",size:14,className:"fv-send",label:h(k?"session.issuesSending":"session.issuesSend"),disabled:k||!x.trim(),onMouseDown:e=>e.preventDefault(),onClick:P})]})]});return n.jsx(le,{className:"fv-compose",preview:G,editor:H,footer:V})}export{ye as E,je as O,Se as R,fe as a,F as b,Ne as c,ce as e,ge as f,xe as k,pe as m,_ as p,ke as r};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var Ts=Object.defineProperty;var $s=(s,t,n)=>t in s?Ts(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var Ce=(s,t,n)=>$s(s,typeof t!="symbol"?t+"":t,n);import{u as D,j as e,I as K,r as f,f as Ms,g as Os,h as Ps,b as ke,a as Ls,i as Ze,k as Rs,m as As,n as Ks,o as Y,S as De,e as Te,q as zs,t as $e,V as Bs}from"./index-B-qrQ2QS.js";import{i as Ws,M as Is}from"./PageScroll-DE6nL5p-.js";import{u as q,R as _s,a as re,n as M,r as Z,b as Ne,c as qs,d as es,e as we,f as Fs,g as Hs,h as Ys,I as oe,P as ss}from"./App-DANZYsFg.js";import{f as Me,w as ee,i as Oe,s as Gs,C as Vs,a as J,b as B,c as Pe,p as R,n as ge,g as Us,d as Le,e as je,h as ce,j as Js,k as ts,u as ae,D as G,l as L,S as V,m as X,o as Qs,q as Re,r as Ae,t as se,v as Ke,x as Xs,y as Zs,z as ze,A as ie,B as et,E as st,F as tt,G as le,H as nt,I as rt,J as ns,K as at,L as Be,M as ot,N as rs,O as as,P as ct,Q as os,R as it,T as lt,U as dt,V as ut,W as pt,X as ht,Y as ft,Z as mt,_ as xt,$ as te,a0 as Q,a1 as gt,a2 as jt,a3 as yt,a4 as bt,a5 as kt,a6 as Nt,a7 as cs,a8 as de,a9 as wt}from"./tabs-BxFTq-sB.js";import{n as vt}from"./GraphStats-CxHsXNy-.js";const We=_s,St=s=>Z(s),Et={evals:["shell.evals"]};function Ct(){const s=D(),{dock:t}=re(),{setDock:n}=q();if(!n)return null;const r=s(t?"dockModes.collapse":"dockModes.expand");return e.jsx("button",{type:"button",className:"rail-btn rail-panel-toggle","data-tip":r,"aria-label":r,"aria-pressed":t,onClick:()=>n(o=>!o),children:e.jsx(K,{name:t?"panel-left":"panel-right",size:18})})}function Dt({page:s,active:t,label:n,disabled:r=!1,onNavigate:o,badge:a=0}){return r?e.jsxs("span",{className:"rail-btn disabled","data-tip":n,"aria-label":n,"aria-disabled":"true",children:[e.jsx(K,{name:Oe(s)||s,size:18}),a>0&&e.jsx("span",{className:"rail-badge","aria-label":`${a} needs you`,children:a>99?"99+":a})]}):e.jsxs("a",{className:t?"rail-btn on":"rail-btn","data-tip":n,"aria-label":n,"aria-current":t?"page":void 0,href:St(s),onClick:l=>{if(l.defaultPrevented||l.button!==0||l.metaKey||l.ctrlKey||l.shiftKey||l.altKey)return;l.preventDefault(),(o==null?void 0:o())===!0||M(s)},children:[e.jsx(K,{name:Oe(s)||s,size:18}),a>0&&e.jsx("span",{className:"rail-badge","aria-label":`${a} needs you`,children:a>99?"99+":a})]})}function Ie({page:s,graphOnly:t=!1,needsYou:n=0,hideDockToggle:r=!1}){const o=D(),{setDock:a,setDockMode:l}=q(),d=t?["graph",...We]:We;return e.jsxs("nav",{className:"side-rail","aria-label":o("nav.railLabel"),onMouseDownCapture:Ws,children:[!r&&e.jsx(Ct,{}),d.map(c=>e.jsx(Dt,{page:c,active:s===c||c==="spec"&&s==="file",label:ee(o(`nav.${c}`),...Et[c]||[]),badge:c==="sessions"?n:0,disabled:t&&c!=="graph",onNavigate:()=>c==="sessions"?(a==null||a(!0),l==null||l("sessions"),Me(i=>i.page==="sessions"&&i.param)):c==="spec"?(a==null||a(!0),l==null||l("explorer"),Me(i=>i.page==="spec")):(c==="graph"&&(a==null||a(!0),l==null||l("explorer")),!1)},c)),e.jsx("div",{className:"rail-spacer"})]})}const Tt=400,$t=80,ue=7,pe=6;function _e(){const[s,t]=f.useState(null),n=f.useRef(null),r=f.useRef(0),o=f.useRef(null),a=f.useRef(null),l=f.useRef(!1),d=f.useRef(()=>{});return Ne(!!s,()=>d.current()),f.useEffect(()=>{const c=()=>{r.current&&(clearTimeout(r.current),r.current=0)},i=()=>{c(),o.current=null,a.current&&(a.current.getAttribute("aria-describedby")==="ui-tip"&&a.current.removeAttribute("aria-describedby"),a.current=null),t(k=>(k&&(l.current=!0,setTimeout(()=>{o.current||(l.current=!1)},300)),null))};d.current=i;const h=k=>{const v=k.getAttribute("data-tip");!v||!k.isConnected||(o.current=k,k.getAttribute("aria-describedby")||(k.setAttribute("aria-describedby","ui-tip"),a.current=k),t({text:v,anchor:k}))},g=(k,v)=>{o.current!==k&&(c(),o.current=k,r.current=setTimeout(()=>{r.current=0,h(k)},v))},y=k=>{var E,C;const v=(C=(E=k.target).closest)==null?void 0:C.call(E,"[data-tip]");v&&g(v,l.current?$t:Tt)},p=k=>{var E,C;const v=(C=(E=k.target).closest)==null?void 0:C.call(E,"[data-tip]");!v||v!==o.current||v.contains(k.relatedTarget)||i()},u=k=>{var C,w;const v=(w=(C=k.target).closest)==null?void 0:w.call(C,"[data-tip]");if(!v)return;let E=!0;try{E=v.matches(":focus-visible")}catch{}E&&(c(),h(v))},S=k=>{var E,C;const v=(C=(E=k.target).closest)==null?void 0:C.call(E,"[data-tip]");v&&v===o.current&&i()};return document.addEventListener("pointerover",y,!0),document.addEventListener("pointerout",p,!0),document.addEventListener("focusin",u,!0),document.addEventListener("focusout",S,!0),document.addEventListener("pointerdown",i,!0),window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),()=>{c(),document.removeEventListener("pointerover",y,!0),document.removeEventListener("pointerout",p,!0),document.removeEventListener("focusin",u,!0),document.removeEventListener("focusout",S,!0),document.removeEventListener("pointerdown",i,!0),window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i),d.current=()=>{}}},[]),f.useEffect(()=>{const c=n.current;if(!s||!c)return;if(!s.anchor.isConnected){t(null);return}const i=s.anchor.getBoundingClientRect(),h=c.offsetWidth,g=c.offsetHeight,y=i.top-g-ue>=pe?"top":"bottom",p=y==="top"?i.top-g-ue:i.bottom+ue,u=Math.min(Math.max(i.left+i.width/2-h/2,pe),window.innerWidth-h-pe);c.dataset.place=y,c.style.top=`${Math.round(p)}px`,c.style.left=`${Math.round(u)}px`;const S=c.querySelector(".ui-tip-arrow");S&&(S.style.left=`${Math.round(Math.min(Math.max(i.left+i.width/2-u,10),h-10))-4}px`);const k=requestAnimationFrame(()=>c.classList.add("show"));return()=>cancelAnimationFrame(k)},[s]),s?Ms.createPortal(e.jsxs("div",{id:"ui-tip",role:"tooltip",ref:n,className:"ui-tip",children:[s.text,e.jsx("span",{className:"ui-tip-arrow","aria-hidden":"true"})]}),document.body):null}function Mt({menu:s,onClose:t,owningNodeOf:n}){const r=D(),[o,a]=f.useState(null);if(f.useEffect(()=>{if(s)return window.addEventListener("click",t),window.addEventListener("contextmenu",t,!0),()=>{window.removeEventListener("click",t),window.removeEventListener("contextmenu",t,!0)}},[s,t]),Ne(!!s,t),f.useEffect(()=>{a(null)},[s]),f.useEffect(()=>{if(!o)return;const g=setTimeout(t,900);return()=>clearTimeout(g)},[o,t]),!s)return null;const l=g=>y=>{y.stopPropagation(),t(),g()},d=g=>async y=>{y.stopPropagation(),a(await g()?"copied":"failed")},c=g=>r(o?`explorerMenu.${o}`:g),i=Gs("explorer.openInNewTab"),h=s.kind==="file"?n==null?void 0:n(s.path):null;return e.jsxs(Vs,{x:s.x,y:s.y,anchorKey:s.key,keyboard:s.keyboard,label:r(s.kind==="node"?"explorerMenu.nodeLabel":"explorerMenu.fileLabel"),children:[s.kind==="node"&&e.jsxs(e.Fragment,{children:[e.jsxs(J,{children:[e.jsx(B,{icon:"plus",hint:i,onClick:l(()=>R("spec",s.id)),children:r("tabs.openInNewTab")}),e.jsx(B,{icon:"graph",onClick:l(()=>ge(Us(s.id))),children:r("explorerMenu.revealOnGraph")})]}),e.jsx(Pe,{}),e.jsxs(J,{children:[e.jsx(B,{icon:"copy",onClick:d(()=>Le(je(s.id))),children:c("explorerMenu.copyLink")}),e.jsx(B,{icon:"copy",onClick:d(()=>ce(s.id)),children:c("explorerMenu.copyNodeId")})]})]}),s.kind==="file"&&e.jsxs(e.Fragment,{children:[e.jsxs(J,{children:[e.jsx(B,{icon:"plus",hint:i,onClick:l(()=>R("file",s.path)),children:r("tabs.openInNewTab")}),h&&e.jsx(B,{icon:"node",onClick:l(()=>ge(je(h))),children:r("explorerMenu.revealOwner")})]}),e.jsx(Pe,{}),e.jsxs(J,{children:[e.jsx(B,{icon:"copy",onClick:d(()=>Le(Js(Z("file",s.path)))),children:c("explorerMenu.copyLink")}),e.jsx(B,{icon:"copy",onClick:d(()=>ce(s.path)),children:c("explorerMenu.copyPath")})]})]}),s.kind==="dir"&&e.jsx(J,{children:e.jsx(B,{icon:"copy",onClick:d(()=>ce(s.path)),children:c("explorerMenu.copyPath")})})]})}function is(s,t){const[n,r]=f.useState(null);return f.useEffect(()=>{if(!t||n)return;let o=!0;return Os(s).then(a=>o&&r(a)).catch(a=>o&&r({error:a instanceof Error?a.message:String(a)})),()=>{o=!1}},[t,n,s]),n}function Ot({entry:s,depth:t}){const n=D(),[r,o]=f.useState(!1),a=is(s.path,r);return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"ft-row ft-dir",style:{paddingLeft:6+t*11},"aria-expanded":r,"data-tip":s.path,"data-menu-kind":"dir","data-menu-path":s.path,onClick:()=>o(l=>!l),children:[e.jsx("span",{className:"ft-caret",children:r?"▾":"▸"}),e.jsx("span",{className:"ft-label",children:s.name})]}),r&&e.jsx(ls,{state:a,depth:t+1,loading:n("diskTree.loading")})]})}function Pt({entry:s,depth:t}){const n=Z("file",s.path);return e.jsxs("a",{className:"ft-row ft-code",style:{paddingLeft:6+t*11},href:n,"data-tip":s.path,"data-menu-kind":"file","data-menu-path":s.path,onClick:r=>ts(r,n),onDoubleClick:r=>{r.preventDefault(),M("file",s.path)},children:[e.jsx("span",{className:"ft-caret"}),e.jsx("span",{className:"ft-label",children:s.name})]})}function ls({state:s,depth:t,loading:n}){return s?s.error?e.jsx("div",{className:"ft-note ft-note-error",style:{paddingLeft:6+t*11},children:s.error}):e.jsxs(e.Fragment,{children:[s.entries.map(r=>r.kind==="dir"?e.jsx(Ot,{entry:r,depth:t},r.path):e.jsx(Pt,{entry:r,depth:t},r.path)),s.truncated&&e.jsx("div",{className:"ft-note",style:{paddingLeft:6+t*11},children:"…"})]}):e.jsx("div",{className:"ft-note",style:{paddingLeft:6+t*11},children:n})}function Lt(){const s=D(),t=is("",!0);return e.jsx("div",{className:"ft-files",children:e.jsx(ls,{state:t,depth:0,loading:s("diskTree.loading")})})}const ds="spex.specTreeOpen",Rt=()=>{try{const s=JSON.parse(localStorage.getItem(ds)||"[]");return new Set(Array.isArray(s)?s.filter(t=>typeof t=="string"):[])}catch{return new Set}};let U={open:Rt()};const ye=new Set,us=s=>{U={open:s};try{localStorage.setItem(ds,JSON.stringify([...s]))}catch{}ye.forEach(t=>t())},At=s=>(ye.add(s),()=>ye.delete(s)),Kt=()=>f.useSyncExternalStore(At,()=>U,()=>U),zt=s=>{if(!s)return;const t=new Set(U.open);t.has(s)?t.delete(s):t.add(s),us(t)},Bt=(s=[])=>{const t=s.filter(Boolean);if(!t.length||t.every(r=>U.open.has(r)))return;const n=new Set(U.open);t.forEach(r=>n.add(r)),us(n)},Wt=s=>{const t=new Map;for(const n of s){const r=n.parent||"";t.has(r)||t.set(r,[]),t.get(r).push(n)}return t};function he({depth:s,onClick:t,onDoubleClick:n,open:r,hasKids:o,dot:a,label:l,kind:d,active:c,subject:i=null}){return e.jsxs("button",{type:"button",className:`ft-row ft-${d}${c?" on":""}`,style:{paddingLeft:6+s*11},onClick:t,onDoubleClick:n,"data-tip":l,"data-menu-kind":i==null?void 0:i.kind,"data-menu-id":i==null?void 0:i.id,"data-menu-path":i==null?void 0:i.path,children:[e.jsx("span",{className:"ft-caret",children:o?r?"▾":"▸":""}),a?e.jsx("i",{className:"ft-dot",style:{background:a}}):e.jsx("span",{className:"ft-dot ft-none"}),e.jsx("span",{className:"ft-label",children:l})]})}function ps({node:s,depth:t,kids:n,focusId:r,onOpenFile:o}){var p;const{open:a}=Kt(),l=a.has(s.id),d=u=>{(typeof u=="function"?u(l):u)!==l&&zt(s.id)},[c,i]=f.useState(null);f.useEffect(()=>{if(!l||c)return;let u=!0;return Ps(s.id).then(S=>u&&i(S)).catch(()=>u&&i([])),()=>{u=!1}},[l,c,s.id]);const h=n.get(s.id)||[],g=(s.code||[]).map(u=>u.split("#")[0]).filter((u,S,k)=>k.indexOf(u)===S),y=h.length>0||g.length>0;return e.jsxs(e.Fragment,{children:[e.jsx(he,{depth:t,kind:"node",label:s.title||s.id,active:r===s.id,subject:{kind:"node",id:s.id},dot:(p=V[s.status])==null?void 0:p.color,hasKids:y,open:l,onClick:u=>{d(S=>!S),X(u)?R("spec",s.id):M("spec",s.id)},onDoubleClick:()=>R("spec",s.id)}),l&&e.jsxs(e.Fragment,{children:[g.map(u=>e.jsx(he,{depth:t+1,kind:"code",label:u.split("/").pop(),subject:{kind:"file",path:u},onClick:S=>(X(S)?R:M)("file",u),onDoubleClick:()=>R("file",u)},`c:${u}`)),(c||[]).map(u=>e.jsx(he,{depth:t+1,kind:"att",label:u.name,subject:{kind:"file",path:`.spec/${s.id}/${u.name}`},onClick:S=>(X(S)?R:M)("file",`.spec/${s.id}/${u.name}`),onDoubleClick:()=>R("file",`.spec/${s.id}/${u.name}`)},`a:${u.name}`)),h.map(u=>e.jsx(ps,{node:u,depth:t+1,kids:n,focusId:r,onOpenFile:o},u.id))]})]})}const hs="spexcode.ftSections",It=()=>{try{const s=JSON.parse(localStorage.getItem(hs)||"null");return{specs:(s==null?void 0:s.specs)!==!1,files:(s==null?void 0:s.files)===!0}}catch{return{specs:!0,files:!1}}};function qe({name:s,open:t,onToggle:n,children:r}){return e.jsxs("section",{className:"ft-section",children:[e.jsxs("button",{type:"button",className:"ft-section-head","aria-expanded":t,onClick:n,children:[e.jsx("span",{className:"ft-caret",children:t?"▾":"▸"}),e.jsx("span",{className:"ft-section-name",children:s})]}),t&&e.jsx("div",{className:"ft-section-body",children:r})]})}function _t({specs:s,focusId:t,onOpenFile:n,embedded:r=!1}){const o=D(),[a,l,d]=ae(G.key,G.initial,G),[c,i]=f.useState(It),h=f.useMemo(()=>Wt(s||[]),[s]),g=h.get("")||[],y=f.useMemo(()=>{const m=new Map;for(const j of s||[])m.set(j.id,j.parent||null);return m},[s]);f.useEffect(()=>{if(!t||!y.has(t))return;const m=[];for(let j=y.get(t),N=0;j&&N<64;j=y.get(j),N++)m.push(j);Bt(m)},[t,y]);const p=f.useCallback(m=>n==null?void 0:n(m),[n]),[u,S]=f.useState(null),k=f.useMemo(()=>{const m=new Map;for(const j of s||[])for(const N of j.code||[]){const T=N.split("#")[0];m.has(T)||m.set(T,j.id)}return m},[s]),v=f.useCallback(m=>k.get(m)||null,[k]),E=m=>{var $;const j=($=m==null?void 0:m.closest)==null?void 0:$.call(m,"[data-menu-kind]");if(!j)return null;const{menuKind:N,menuId:T,menuPath:z}=j.dataset;return{kind:N,id:T||null,path:z||null,key:`${N}:${T||z}`,row:j}},C=f.useCallback(()=>{var m,j;u!=null&&u.keyboard&&((j=(m=u.row)==null?void 0:m.focus)==null||j.call(m)),S(null)},[u]),w=m=>{const j=E(m.target);j&&(m.preventDefault(),S({...j,x:m.clientX,y:m.clientY,keyboard:!1}))},O=m=>{const j=L("explorer.menu",m);if(!j&&!L("explorer.openInNewTab",m))return;const N=E(m.target);if(N){if(m.preventDefault(),j){const T=N.row.getBoundingClientRect();S({...N,x:T.left+12,y:T.bottom,keyboard:!0});return}N.kind==="node"?R("spec",N.id):N.kind==="file"&&R("file",N.path)}},A=m=>i(j=>{const N={...j,[m]:!j[m]};try{localStorage.setItem(hs,JSON.stringify(N))}catch{}return N}),b=()=>{M("spec")};return s!=null&&s.length?e.jsxs("div",{className:"filetree",style:r?{width:"100%"}:{width:a},children:[e.jsxs("div",{className:"ft-body",onContextMenu:w,onKeyDown:O,children:[e.jsx(qe,{name:o("fileTree.specs"),open:c.specs,onToggle:()=>A("specs"),children:g.map(m=>e.jsx(ps,{node:m,depth:0,kids:h,focusId:t,onOpenFile:p},m.id))}),e.jsx(qe,{name:o("fileTree.files"),open:c.files,onToggle:()=>A("files"),children:e.jsx(Lt,{})})]}),e.jsx(Mt,{menu:u,onClose:C,owningNodeOf:v}),e.jsxs("button",{type:"button",className:"ft-graph-entry","data-tip":o("fileTree.graph"),"aria-label":o("fileTree.graph"),onClick:b,children:[e.jsx(K,{name:"graph",size:14}),e.jsx("span",{children:o("fileTree.graph")})]}),!r&&e.jsx("div",{className:"ft-resize",onMouseDown:l,onDoubleClick:d,role:"separator","aria-orientation":"vertical"})]}):null}function qt({sessions:s,activeId:t,suppressRows:n=!1}){const r=D(),{offline:o}=ke(),{expanded:a,offlineOpen:l}=Qs(),{lockedSource:d}=re(),{lockGraphTo:c}=q(),{reload:i}=qs(),{notify:h}=Ze(),[g,y]=f.useState(null),[p,u]=f.useState(null),[S,k]=f.useState(null),v=f.useRef(null);f.useEffect(()=>()=>{var b;return(b=v.current)==null?void 0:b.call(v)},[]),f.useEffect(()=>{if(!t)return;const b=(s||[]).find(m=>m.id===t);Re(Ae(s||[],t)),b&&se(b)==="offline"&&Ke(!0)},[t,s]);const E=f.useMemo(()=>Xs(s||[],b=>a.has(b),{zoneFolded:b=>b==="offline"&&!l,keepVisible:b=>b.id===t}),[s,a,l,t]);es(b=>{if(n)return!1;const m=Zs(E,t,b);if(!m)return!1;if(b.preventDefault(),m.type==="move")ze(m.id,j=>M(j.page,j.param,{query:j.query}));else if(m.type==="expand"){const j=E.find(N=>N.type==="row"&&N.s.id===m.id);j&&!j.expanded&&ie(m.id)}else if(m.type==="collapse"){const j=E.find(N=>N.type==="row"&&N.s.id===m.id);j!=null&&j.expanded&&ie(m.id)}return!0},20);const C=f.useCallback(async(b,m)=>{const j=(s||[]).find(N=>N.id===b);if(!(!j||(j.parent||null)===m))try{const N=await Rs("/api/sessions/reparent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({children:[b],parent:m})}),T=await N.json().catch(()=>null);if(!N.ok||(T==null?void 0:T.ok)===!1)throw new Error((T==null?void 0:T.error)||`session parent update refused (HTTP ${N.status})`);m&&Re([m]),i==null||i()}catch(N){h(N instanceof Error?N.message:String(N),{kind:"error"})}},[s,i,h]),w=(b,m)=>{if(le(b.x,b.y,"[data-session-archive-drop]"))return"archive";const j=le(b.x,b.y,"[data-session-drop-id]");if(j){const N=j.dataset.sessionDropId;return N===m.id||N===m.parent||Ae(s||[],N).includes(m.id)?void 0:N}return m.parent&&le(b.x,b.y,"[data-session-root-drop]")?null:void 0},O=(b,m)=>{const j={id:m.id,parent:m.parent||null},N=$=>document.body.classList.toggle("is-session-dragging",$),T=$=>{const W=w($,j);u(F=>F&&F.id===j.id&&F.target===W?F:{...j,target:W})},z=()=>{N(!1),u(null),v.current=null};v.current=tt(b,{onStart:$=>{N(!0),T($)},onMove:T,onDrop:$=>{const W=w($,j);z(),W==="archive"?k(m):W!==void 0&&C(j.id,W)},onCancel:z})},A=!!(p!=null&&p.parent);return n?null:e.jsxs("div",{className:"dock-session-body",children:[e.jsx("div",{className:`dock-session-list${A?" root-armed":""}${(p==null?void 0:p.target)===null?" root-on":""}`,...A?{"data-session-root-drop":""}:{},children:E.length?E.map(b=>{if(b.type==="zone"){const j=b.zone==="offline",N=r(`sessionZone.${b.zone}`);return e.jsxs("button",{type:"button",className:`dock-session-zone dock-session-zone-${b.zone}`,"aria-expanded":j?!b.folded:void 0,onClick:j?()=>Ke(b.folded):void 0,children:[e.jsx("span",{children:N}),e.jsxs("span",{className:"dock-session-count",children:[b.count,o&&e.jsx("em",{className:"dock-stale",children:r("backend.stale")})]})]},`zone-${b.zone}`)}const m=!!b.s.source&&b.s.source===d;return e.jsx(et,{item:b,activeId:t,dragging:(p==null?void 0:p.id)===b.s.id,dropTarget:(p==null?void 0:p.target)===b.s.id,onToggleFold:()=>ie(b.s.id),rowProps:{"data-sid":b.s.id,"data-locked":m?"":void 0,"data-tip":r("dockSessions.rowTip"),"aria-grabbed":(p==null?void 0:p.id)===b.s.id||void 0,onMouseDown:j=>{j.preventDefault(),O(j,b.s)},onClick:j=>{if(j.altKey){j.preventDefault(),c(b.s.source);return}X(j)?R("sessions",b.s.id):ze(b.s.id,N=>M(N.page,N.param,{query:N.query}))},onDoubleClick:()=>R("sessions",b.s.id),onContextMenu:j=>{j.preventDefault(),y({x:j.clientX,y:j.clientY,session:b.s})}}},b.s.id)}):e.jsx("div",{className:"dock-empty",children:"—"})}),A&&e.jsx("div",{className:"dock-root-hint","aria-hidden":"true",children:r("session.rootDrop")}),e.jsx(st,{menu:g,closeRequest:S,onCloseRequestDone:()=>k(null),onClose:()=>y(null),onChanged:i,onError:b=>h(b,{kind:"error"}),onLock:b=>c(b.source,{toggle:!1})})]})}function Ft({mode:s,specs:t,sessions:n}){const r=D(),{offline:o}=ke(),{openPalette:a}=q(),l=s==="sessions",d=l?(n==null?void 0:n.length)||0:(t==null?void 0:t.length)||0,c=r(l?"dockModes.searchSessions":"dockModes.searchNodes");return e.jsxs("div",{className:"dock-head",children:[e.jsx("span",{className:"dock-head-name",children:r(l?"dockModes.sessions":"dockModes.explorer")}),e.jsxs("span",{className:"dock-head-count",children:[d,o&&e.jsx("em",{className:"dock-stale",children:r("backend.stale")})]}),e.jsxs("span",{className:"dock-head-acts",children:[e.jsx("button",{type:"button",className:"dock-head-act","data-tip":ee(c,"graph.search"),"aria-label":c,onClick:()=>a(l?"sessions":"nodes"),children:e.jsx(K,{name:"search",size:13})}),l&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"dock-head-act dock-archive-door","data-session-archive-drop":!0,"data-tip":r("dockSessions.archive"),"aria-label":r("dockSessions.archive"),onClick:()=>M("sessions",null,{query:{archive:"1"}}),children:e.jsx(K,{name:"archive",size:13})}),e.jsx(Ls,{icon:"plus",size:15,className:"dock-head-act dock-head-act-new",label:r("dockSessions.new"),onClick:()=>M("sessions","new")})]})]})]})}function Ht({mode:s,specs:t,sessions:n,focusId:r,activeSessionId:o,suppressSessionRows:a=!1,closing:l=!1,opening:d=!1}){const[c,i,h]=ae(G.key,G.initial,G);return e.jsxs("aside",{className:l?"dock dock-closing":"dock","data-fold":d?"in":void 0,style:{width:c},"aria-hidden":l?"true":void 0,children:[e.jsx(Ft,{mode:s,specs:t,sessions:n}),s==="sessions"?e.jsx(qt,{sessions:n,activeId:o,suppressRows:a}):e.jsx(_t,{specs:t,focusId:r,embedded:!0}),e.jsx("div",{className:"ft-resize",onMouseDown:i,onDoubleClick:h,role:"separator","aria-orientation":"vertical"})]})}const fs=8,Yt=5,Gt=2.2,Vt=1,Ut=new Set(["the","a","an","and","or","of","to","in","on","is","it","its","as","at","by","for","how","does","do","what","which","that","this","these","those","with","from","into","are","be","can","just","them","they","their","so","if","not","no","but","vs","us","we","you"]),ms="\\u3400-\\u4dbf\\u4e00-\\u9fff\\uf900-\\ufaff\\u3040-\\u30ff",Jt=new RegExp(`[a-z0-9]+|[${ms}]`,"g"),Qt=new RegExp(`[${ms}]`);function xs(s){return Qt.test(s)}function gs(s){return s.toLowerCase().match(Jt)??[]}function Xt(s){const t=new Set;for(const n of gs(s))(xs(n)||n.length>1&&!Ut.has(n))&&t.add(n);return[...t]}function fe(s){return gs(s)}function ve(s){let t=s;return t.length>=4&&t.endsWith("s")&&!t.endsWith("ss")&&(t=t.slice(0,-1)),t.length>=5&&t.endsWith("e")&&(t=t.slice(0,-1)),t}function Zt(s,t){return t.startsWith(ve(s))}function ne(s,t){return t.startsWith(ve(s))||t.length>=3&&s.startsWith(t)}const en=.5;function sn(s,t){const n=ve(s);let r=0;for(const o of t.nameWords)if(o.startsWith(n)){const a=n.length/o.length;a>r&&(r=a)}return r>0?Math.max(en,r):0}const Fe=1.2,He=.4;function Ye(s,t,n){return s<=0?0:s*(Fe+1)/(s+Fe*(1-He+He*t/(n||1)))}function tn(s,t,n,r){const o=sn(s,t);if(o>0)return fs*o;if(t.name.includes(s))return Yt;if(t.descWords.some(l=>ne(s,l)))return Gt*Ye(1,t.descWords.length,r);const a=t.bodyWords.reduce((l,d)=>l+(ne(s,d)?1:0),0);return Vt*Ye(a,t.bodyWords.length,n)}function nn(s,t,n,r=140){const o=s.replace(/\s+/g," ").trim(),a=o.toLowerCase();let l=-1;for(const i of n){const h=xs(i)?a.indexOf(i):a.search(new RegExp("\\b"+i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")));h>=0&&(l<0||h<l)&&(l=h)}if(l<0){const i=(t||o).replace(/\s+/g," ").trim();return i.length>r?i.slice(0,r).trimEnd()+"…":i}const d=Math.max(0,l-Math.floor(r/3));let c=o.slice(d,d+r).trim();return d>0&&(c="…"+c),d+r<o.length&&(c=c+"…"),c}function rn(s,t,n={}){const r=n.limit??10,o=Xt(s);if(!o.length)return[];const a=t.map(g=>{const y=g.name.toLowerCase();return{ref:g.ref,name:y,nameWords:fe(y),desc:g.desc.toLowerCase(),descWords:fe(g.desc),bodyWords:fe(g.body),snippetText:`${g.desc}
|
|
2
|
+
${g.body}`}}),l=a.length,d=a.reduce((g,y)=>g+y.bodyWords.length,0)/(l||1),c=a.reduce((g,y)=>g+y.descWords.length,0)/(l||1),i={};for(const g of o){let y=0;for(const p of a)(p.nameWords.some(u=>Zt(g,u))||p.descWords.some(u=>ne(g,u))||p.bodyWords.some(u=>ne(g,u)))&&y++;i[g]=y>0?Math.log(l/y):0}const h=[];for(const g of a){let y=0;for(const p of o)y+=Math.min(tn(p,g,d,c)*i[p],fs);y<=0||h.push({ref:g.ref,score:Math.round(y*100)/100,snippet:nn(g.snippetText,g.desc,o)})}return h.sort((g,y)=>y.score-g.score),h.slice(0,r)}let me=null;function an(s=!0){const[t,n]=f.useState(me),r=f.useRef(!1);return f.useEffect(()=>{!s||r.current||(r.current=!0,fetch(As("/api/specs/lite")).then(o=>o.ok?o.json():[]).then(o=>{me={bodies:Object.fromEntries((o||[]).map(a=>[a.id,a.body||""]))},n(me)}).catch(()=>{}))},[s]),t}const Ge=["spec","session"],on=s=>s?[s,...Ge.filter(t=>t!==s)]:Ge;function cn(s,t,n){const r=n==null?void 0:n.bodies,o=[];for(const a of s){const l=nt(a.path);o.push({kind:"spec",key:`spec:${a.id}`,target:a.id,address:je(a.id),color:(V[a.status]||V.pending).color,title:a.title||a.id,sub:l,name:`${a.title||a.id} ${a.id}`,desc:a.desc||"",body:(r==null?void 0:r[a.id])??a.body??""})}for(const a of rt(t)){const l=ns(a),d=at(a),c=a.status||a.promptPreview||a.note||"";o.push({kind:"session",key:`session:${a.id}`,target:a.id,address:ot(a.id),color:Be[a.status]||Be.offline,title:l,sub:c,name:l||"",desc:a.status||"",body:`${a.promptPreview||a.note||""} ${d}`.trim()})}return o}function ln(s,t,n){const r=Object.fromEntries(n.map((d,c)=>[d,c])),o=(d,c)=>r[d.kind]-r[c.kind];if(!t.trim())return s.slice().sort(o).slice(0,15);const a={};for(const d of n){const c=s.filter(i=>i.kind===d);a[d]=rn(t,c.sort((i,h)=>i.name.length-h.name.length||i.key.localeCompare(h.key)).map(i=>({ref:i,name:i.name,desc:i.desc,body:i.body})),{limit:15}).map(i=>i.ref)}const l=[];for(let d=0;l.length<15;d++){let c=!1;for(const i of n)a[i][d]&&l.length<15&&(l.push(a[i][d]),c=!0);if(!c)break}return l}function dn({specs:s,sessions:t,onPick:n,onClose:r,boost:o=null}){const a=D(),l=an(),[d,c]=f.useState(""),[i,h]=f.useState("");f.useEffect(()=>{if(!d.trim()){h(d);return}const w=setTimeout(()=>h(d),120);return()=>clearTimeout(w)},[d]);const[g,y]=f.useState(0),p=f.useRef(null),u=f.useRef(null),S=f.useMemo(()=>on(o),[o]),k=f.useMemo(()=>cn(s,t,l),[s,t,l]),v=f.useMemo(()=>ln(k,i,S),[k,i,S]);f.useEffect(()=>{var w;(w=p.current)==null||w.focus()},[]),f.useEffect(()=>{y(0)},[d]),f.useEffect(()=>{var w,O;(O=(w=u.current)==null?void 0:w.querySelector(".search-item.on"))==null||O.scrollIntoView({block:"nearest"})},[g,v]);const E=(w,O=!1)=>{w&&(n(w,{hold:O}),r())},C=w=>{w.key==="ArrowDown"?(w.preventDefault(),y(O=>Math.min(v.length-1,O+1))):w.key==="ArrowUp"?(w.preventDefault(),y(O=>Math.max(0,O-1))):w.key==="Enter"?(w.preventDefault(),E(v[g],w.ctrlKey||w.metaKey)):w.key==="Escape"&&(w.preventDefault(),r())};return e.jsx("div",{className:"search-backdrop","data-focus-overlay":!0,onClick:r,children:e.jsxs("div",{className:"search-panel",role:"dialog","aria-modal":"true","aria-label":a("search.title"),onClick:w=>w.stopPropagation(),children:[e.jsxs("div",{className:"search-bar",children:[e.jsx("span",{className:"search-icon",children:"⌕"}),e.jsx("input",{ref:p,className:"search-input",value:d,placeholder:a("search.placeholder"),onChange:w=>c(w.target.value),onKeyDown:C})]}),e.jsxs("ul",{className:"search-results",ref:u,children:[v.length===0&&e.jsx("li",{className:"search-empty",children:a("search.empty")}),v.map((w,O)=>e.jsxs("li",{className:`search-item${O===g?" on":""}`,"data-kind":w.kind,"data-target":w.target,onMouseEnter:()=>y(O),onClick:A=>E(w,X(A)),children:[e.jsx("span",{className:"node-dot",style:{background:w.color}}),e.jsx("span",{className:`search-kind k-${w.kind}`,children:a(`search.kind.${w.kind}`)}),e.jsx("span",{className:"search-title",children:w.title||w.target}),e.jsx("span",{className:"search-path",children:w.sub})]},w.key))]}),e.jsx("div",{className:"search-foot",children:a("search.hint")})]})})}class un extends f.Component{constructor(){super(...arguments);Ce(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error(`view crashed (${this.props.resetKey}):`,n,r==null?void 0:r.componentStack)}componentDidUpdate(n){this.state.error&&n.resetKey!==this.props.resetKey&&this.setState({error:null})}render(){const{error:n}=this.state;return n?e.jsx("div",{className:"view-error",children:e.jsxs("div",{className:"view-error-box",children:[e.jsx("p",{className:"view-error-title",children:this.props.t("viewError.title")}),e.jsx("p",{className:"view-error-detail",children:String((n==null?void 0:n.message)||n)}),e.jsx("button",{type:"button",className:"view-error-retry",onClick:()=>this.setState({error:null}),children:this.props.t("viewError.retry")})]})}):this.props.children}}function Se({resetKey:s,children:t}){const n=D();return e.jsx(un,{resetKey:s,t:n,children:t})}const js="spexcode.ctxPanels";function pn(){try{const s=JSON.parse(localStorage.getItem(js)||"null");return{scenarios:(s==null?void 0:s.scenarios)!==!1,issues:(s==null?void 0:s.issues)!==!1}}catch{return{scenarios:!0,issues:!0}}}function ys({href:s,children:t}){return e.jsx("a",{className:"ctx-row",href:s,onClick:n=>ts(n,s),children:t})}function hn({id:s}){var d;const t=D(),n=as("evals",Fs(s),1,{pollMs:0,view:"timeline"});if(n.loading)return e.jsx("div",{className:"ctx-empty",children:t("contextDock.loading")});if(n.error)return e.jsx("div",{className:"ctx-empty ctx-error",children:n.error});const r=((d=n.data)==null?void 0:d.items)||[],o=[...new Map(r.filter(c=>c==null?void 0:c.scenario).map(c=>[c.scenario,{name:c.scenario}])).values()],a=r.filter(c=>c.filterKind==="result"),l=ct(o,a);return l.length?e.jsx("div",{className:"ctx-list",children:l.map(c=>e.jsxs(ys,{href:os(it(s,c.name)),children:[e.jsx("span",{className:`ctx-score ${c.state}`,"aria-label":t(`contextDock.states.${c.state}`),children:c.state==="pass"||c.state==="stalePass"?"✓":c.state==="fail"||c.state==="staleFail"?"×":"○"}),e.jsx("span",{className:"ctx-row-label",children:c.name}),e.jsx("span",{className:"ctx-state",children:t(`contextDock.states.${c.state}`)})]},c.name))}):e.jsx("div",{className:"ctx-empty",children:t("contextDock.noScenarios")})}function fn({id:s}){var o;const t=D(),n=as("issues",Hs(s),1,{pollMs:0});if(n.loading)return e.jsx("div",{className:"ctx-empty",children:t("contextDock.loadingIssues")});if(n.error)return e.jsx("div",{className:"ctx-empty ctx-error",children:n.error});const r=((o=n.data)==null?void 0:o.items)||[];return r.length?e.jsx("div",{className:"ctx-list",children:r.map(a=>e.jsxs(ys,{href:os(dt(a.id)),children:[e.jsx(lt,{kind:"issue",state:a.status||"open",size:12,className:"ctx-issue-state"}),e.jsx("span",{className:"ctx-row-label",children:a.concern})]},a.id))}):e.jsx("div",{className:"ctx-empty",children:t("contextDock.noIssues")})}function Ve({title:s,open:t,onToggle:n,children:r}){return e.jsxs("section",{className:"ctx-panel",children:[e.jsxs("button",{type:"button",className:"ctx-panel-head","aria-expanded":t,onClick:n,children:[e.jsx("span",{children:s}),e.jsx(K,{name:t?"chevron-down":"chevron-right",size:12})]}),t&&r]})}function mn({page:s,param:t,open:n=!0,onToggle:r}){const o=D(),{specs:a}=we(),[l,d,c]=ae("spex.ctxWidth",276,{min:220,max:460,dir:-1}),[i,h]=f.useState(pn),[g,y]=rs(n);if(s!=="spec"||!t||!g)return null;const p=a==null?void 0:a.find(S=>S.id===t);if(!p)return null;const u=S=>h(k=>{const v={...k,[S]:!k[S]};try{localStorage.setItem(js,JSON.stringify(v))}catch{}return v});return e.jsxs("aside",{className:y?"context-dock dock-closing":"context-dock",style:{width:l},"aria-hidden":y?"true":void 0,"aria-label":o("contextDock.title"),children:[e.jsx("div",{className:"ctx-resize",onMouseDown:d,onDoubleClick:c,role:"separator","aria-orientation":"vertical"}),e.jsxs("div",{className:"ctx-head",children:[e.jsx("span",{children:o("contextDock.title")}),e.jsx("span",{className:"ctx-node-id",children:p.id})]}),e.jsxs("div",{className:"ctx-body",children:[e.jsx(Ve,{title:o("contextDock.scenarios"),open:i.scenarios,onToggle:()=>u("scenarios"),children:e.jsx(hn,{id:t})}),e.jsx(Ve,{title:o("contextDock.issues"),open:i.issues,onToggle:()=>u("issues"),children:e.jsx(fn,{id:t})})]})]})}const xn=new Set(["=","_","I","H","J","K","L"]),gn=(()=>{const s=[];for(const t of pt){const n=ht(t,ft(t.id)).filter(o=>!xn.has(o)).map(mt),r=s[s.length-1];r&&r.desc===t.desc?r.keys.push(...n):s.push({desc:t.desc,keys:n})}return s})(),jn=[[["←","→","h","l","⇥","1","2"],"legend.popup.switch"],[["j","k","↑","↓"],"legend.popup.scroll"],[["⇧h","⇧j","⇧k","⇧l","⇧←↑↓→"],"legend.popup.lens"],[["⏎"],"legend.popup.enter"],[["esc"],"legend.popup.esc"]],yn=["merged","active","drift","pending"],bn=["added","edited","deleted","moved"];function kn({t:s}){return e.jsxs("section",{className:"legend-sec",children:[e.jsx("div",{className:"legend-h",children:s("legend.secBoard")}),gn.map(t=>e.jsxs("div",{className:"legend-row",children:[e.jsx("span",{className:"keymap-keys",children:t.keys.map((n,r)=>e.jsx("kbd",{children:n},r))}),e.jsx("span",{className:"legend-desc",children:s(t.desc)})]},t.desc))]})}function Nn({title:s,rows:t,t:n}){return e.jsxs("section",{className:"legend-sec",children:[e.jsx("div",{className:"legend-h",children:s}),t.map(([r,o])=>e.jsxs("div",{className:"legend-row",children:[e.jsx("span",{className:"keymap-keys",children:r.map((a,l)=>e.jsx("kbd",{children:a},l))}),e.jsx("span",{className:"legend-desc",children:n(o)})]},o))]})}function wn({onClose:s}){const t=D();return e.jsxs(Is,{title:t("legend.title"),closeLabel:ee(t("legend.close"),"graph.help"),onClose:s,children:[e.jsx(kn,{t}),e.jsx(Nn,{title:t("legend.secPopup"),rows:jn,t}),e.jsxs("section",{className:"legend-sec",children:[e.jsx("div",{className:"legend-h",children:t("legend.secStatus")}),yn.map(n=>e.jsxs("div",{className:"legend-row",children:[e.jsx("span",{className:"node-dot",style:{background:V[n].color},children:n==="active"&&e.jsx("span",{className:"pulse",style:{background:V[n].color}})}),e.jsx("span",{className:"legend-name",children:t(`status.${n}`)}),e.jsx("span",{className:"legend-desc",children:t(`legend.statusRows.${n}`)})]},n))]}),e.jsxs("section",{className:"legend-sec",children:[e.jsxs("div",{className:"legend-h",children:[t("legend.secOp")," ",e.jsx("span",{className:"legend-sub",children:t("legend.secOpSub")})]}),bn.map(n=>e.jsxs("div",{className:"legend-row",children:[e.jsx("span",{className:`ov-mark ov-${n}`,children:ut[n]}),e.jsx("span",{className:"legend-desc",children:t(`legend.opRows.${n}`)})]},n))]}),e.jsxs("section",{className:"legend-sec",children:[e.jsx("div",{className:"legend-h",children:t("legend.secBadges")}),e.jsxs("div",{className:"legend-row",children:[e.jsx("span",{className:"drift-badge",children:"⚠N"}),e.jsx("span",{className:"legend-desc",children:t("legend.badgeDrift")})]}),e.jsxs("div",{className:"legend-row",children:[e.jsx("span",{className:"legend-glyph legend-ver",children:"vN"}),e.jsx("span",{className:"legend-desc",children:t("legend.badgeVer")})]})]}),e.jsxs("section",{className:"legend-sec",children:[e.jsx("div",{className:"legend-h",children:t("legend.secRing")}),e.jsxs("div",{className:"legend-row",children:[e.jsx("span",{className:"legend-ring ring-dashed"}),e.jsx("span",{className:"legend-desc",children:t("legend.ringDashed")})]}),e.jsxs("div",{className:"legend-row",children:[e.jsx("span",{className:"legend-ring ring-solid"}),e.jsx("span",{className:"legend-desc",children:t("legend.ringSolid")})]}),e.jsxs("div",{className:"legend-row",children:[e.jsx("span",{className:"legend-ring ring-ghost"}),e.jsx("span",{className:"legend-desc",children:t("legend.ringGhost")})]})]})]})}const vn=/^[a-z][a-z0-9-]*$/,Sn=/^[A-Za-z0-9_-]+$/,bs=Object.freeze(["open","hold","own-query"]),En=Object.freeze({intents:bs,samePage:(s,t)=>_(s,"from").page===_(t,"to").page,assertAddress:s=>_(s)}),ks=s=>{if(s==null||typeof s!="object"||Array.isArray(s))return!1;const t=Object.getPrototypeOf(s);return t===Object.prototype||t===null};function Ns(s,t="query"){if(s==null)return null;if(!ks(s))throw new TypeError(`${t} must be a plain object or null`);const n={};for(const[r,o]of Object.entries(s)){if(!Sn.test(r))throw new TypeError(`${t} key must be URL-safe: ${r}`);if(o!=null&&!["string","number","boolean"].includes(typeof o))throw new TypeError(`${t}.${r} must be a primitive value`);n[r]=o}return Object.freeze(n)}function _(s,t="address"){if(!ks(s))throw new TypeError(`${t} must be an address object`);const{page:n,param:r=null,query:o=null}=s;if(typeof n!="string"||!vn.test(n))throw new TypeError(`${t}.page must be lowercase kebab-case`);if(r!=null&&typeof r!="string")throw new TypeError(`${t}.param must be a string or null`);return Object.freeze({page:n,param:r,query:Ns(o,`${t}.query`)})}function Ue(s,t){return t===void 0?{accepted:!0,intent:s}:t}function Cn({route:s,dispatch:t,active:n=!0,contract:r=En,owner:o=null}={}){if(typeof t!="function")throw new TypeError("view scope requires a dispatch function");if(!r||typeof r.assertAddress!="function")throw new TypeError("view scope requires a route contract");if(o!=null&&(typeof o!="object"||o.kind!=="view"||typeof o.page!="string"))throw new TypeError("view scope owner must identify a view");let a=_(s,"route"),l=n!==!1;const d=(h,g,y=null)=>{if(!l)return{accepted:!1,reason:"inactive",type:h};const p=r.assertAddress(g,`${h}.address`),u=Object.freeze({type:h,address:_(p,`${h}.address`),...h==="open"&&(y==null?void 0:y.replace)===!0?{replace:!0}:{}});return Ue(u,t(u))},c={};Object.defineProperties(c,{route:{enumerable:!0,get:()=>a},active:{enumerable:!0,get:()=>l},owner:{enumerable:!0,value:o?Object.freeze({...o}):null}}),c.open=(h,g=null)=>d("open",h,g),c.hold=h=>d("hold",h),c.ownQuery=h=>{if(!l)return{accepted:!1,reason:"inactive",type:"own-query"};const g={page:a.page,param:a.param,query:Ns(h,"own-query.query")},y=Object.freeze({type:"own-query",address:_(r.assertAddress(g,"own-query.address"),"own-query.address")});return Ue(y,t(y))};const i=({route:h=a,active:g=l}={})=>{a=_(h,"route"),l=g!==!1};return{scope:Object.freeze(c),update:i,intents:bs}}const Dn=(s,t)=>s==="issues"||s==="evals"||s==="settings"||s==="sessions"?"none":s==="spec"||s==="file"?"explorer":"keep",Tn=new Set(["graph","sessions"]),ws=(s,t)=>Tn.has(s)?s:`${s}/${t??""}`,$n=6;function vs({page:s,param:t,query:n,active:r,children:o}){const{splitTo:a}=q(),l=f.useCallback(c=>{const{page:i,param:h,query:g}=c.address;return c.type==="hold"?(a(c.address),{accepted:!0,intent:c}):(M(i,h,{query:g,replace:c.replace===!0}),{accepted:!0,intent:c})},[a]),d=f.useMemo(()=>Cn({route:{page:s,param:t,query:n},dispatch:l,active:r,contract:wt,owner:{kind:"view",page:s,param:t??null}}),[]);return f.useEffect(()=>{d.update({route:{page:s,param:t,query:n},active:r})},[d,s,t,n,r]),e.jsx(Bs,{scope:d.scope,children:o})}function Mn({page:s,param:t,query:n,inactive:r=!1}){const o=ws(s,t),a=Z(s,t,n),l=f.useRef(0),[d,c]=f.useState(()=>[{key:o,address:a,page:s,param:t,query:n,seq:0}]);return f.useEffect(()=>{c(i=>{const h=++l.current;let y=i.find(p=>p.key===o)?i.map(p=>p.key===o?{...p,address:a,page:s,param:t,query:n,seq:h}:p):[...i,{key:o,address:a,page:s,param:t,query:n,seq:h}];if(y.length>$n){const p=y.reduce((u,S)=>S.seq<u.seq?S:u);y=y.filter(u=>u!==p)}return y})},[o,a]),d.map(i=>e.jsx(On,{entry:i,showing:!r&&i.key===o},i.key))}const On=f.memo(function({entry:t,showing:n}){const r=D(),{component:o,className:a}=cs(t.page),l=f.useMemo(()=>({address:t.address,active:n}),[t.address,n]);return e.jsx("div",{className:`viewhost ${a}`,"aria-hidden":n?void 0:"true",style:n?void 0:{display:"none"},children:e.jsx(Se,{resetKey:t.address,children:e.jsx(ss,{value:l,children:e.jsx(vs,{page:t.page,param:t.param,query:t.query,active:n,children:e.jsx(f.Suspense,{fallback:e.jsx("div",{className:"loading",children:r("hud.loading")}),children:e.jsx(o,{param:t.param,query:t.query})})})})})})});function be({page:s,param:t,query:n,inactive:r=!1}){const o=D(),{component:a,className:l}=cs(s),d=Z(s,t,n);return e.jsx("div",{className:`viewhost ${l}`,"aria-hidden":r?"true":void 0,style:r?{display:"none"}:void 0,children:e.jsx(Se,{resetKey:d,children:e.jsx(ss,{value:{address:d,active:!r},children:e.jsx(vs,{page:s,param:t,query:n,active:!r,children:e.jsx(f.Suspense,{fallback:e.jsx("div",{className:"loading",children:o("hud.loading")}),children:e.jsx(a,{param:t,query:n},ws(s,t))})})})})})}function Je(){var p;const s=D(),{identity:t,catalog:n}=we(),[r,o]=f.useState(!1);Ne(r,()=>o(!1));const a=(n==null?void 0:n.state)==="ok",l=(n==null?void 0:n.state)==="denied",d=a?n.projects:null,c=(t==null?void 0:t.title)||Te||"spexcode",i=l?s("nav.projectChipLogin",{name:c}):s("nav.projectChip",{name:c});f.useEffect(()=>{if(!r)return;const u=S=>{var k,v;(v=(k=S.target).closest)!=null&&v.call(k,"[data-status-project], .status-project-menu")||o(!1)};return document.addEventListener("mousedown",u,!0),()=>{document.removeEventListener("mousedown",u,!0)}},[r]);const h=e.jsxs(e.Fragment,{children:[e.jsx(oe,{icon:t==null?void 0:t.icon,size:14,className:"sb-project-mark"}),e.jsx("span",{className:"sb-project-name",children:c})]}),g=d?e.jsx("button",{type:"button",className:r?"sb-project-trigger open":"sb-project-trigger","data-status-project":"","data-tip":i,"aria-label":i,"aria-haspopup":"menu","aria-expanded":r,"aria-controls":r?"status-project-menu":void 0,onClick:()=>o(u=>!u),children:h}):e.jsx("a",{className:"sb-project-trigger","data-status-project":"","data-tip":i,"aria-label":i,href:$e(),children:h}),y=r&&d?e.jsxs("div",{id:"status-project-menu",className:"proj-menu status-project-menu",role:"menu",onContextMenu:u=>u.stopPropagation(),children:[d.map(u=>{const S=u.online===!1,k=u.id===Te,v=S?s("nav.projectOffline"):u.online===!0?s("nav.projectOnline"):null,E=`proj-menu-item${k?" current":""}${S?" offline":""}`,C=e.jsxs(e.Fragment,{children:[e.jsx(oe,{icon:u.identity.icon,size:16,className:"proj-menu-mark"}),u.gated&&e.jsx(K,{name:"lock",size:11}),e.jsx("span",{className:"proj-menu-name",children:u.identity.title}),v&&e.jsx("span",{className:`proj-menu-status ${S?"offline":"online"}`,"aria-hidden":"true",children:v}),k&&e.jsx(K,{name:"check",size:12})]});return S?e.jsx("div",{role:"menuitem","aria-disabled":"true",className:E,children:C},u.id):e.jsx("a",{role:"menuitem",className:E,href:zs(u.id),children:C},u.id)}),e.jsxs("a",{role:"menuitem",className:"proj-menu-item all",href:$e(),children:[e.jsx(oe,{icon:(p=n.gateway.identity)==null?void 0:p.icon,fallback:"gateway",size:16,className:"proj-menu-mark"}),e.jsx("span",{className:"proj-menu-name",children:s("nav.allProjects")})]})]}):null;return Y({id:"project",side:"left",priority:1e3,kind:"prominent",overflow:r,node:e.jsxs("span",{className:"sb-project-slot",children:[g,y]})}),null}const Pn=[{state:"pass",always:!0,titleKey:"scorePass"},{state:"fail",always:!0,titleKey:"scoreFail"},{state:"stalePass",titleKey:"scoreStalePass"},{state:"staleFail",titleKey:"scoreStaleFail"},{state:"empty",titleKey:"scoreEmpty"}];function xe({name:s,count:t,title:n,onClick:r,children:o}){return e.jsxs("button",{type:"button",className:"sb-tally-button","data-board-stat":s,"data-tip":n,"aria-label":n,disabled:!r,onClick:r,children:[o,t]})}const Ln=()=>{try{return sessionStorage.getItem("spex.focus")}catch{return null}};function Rn({launcher:s,sessions:t,onOpen:n,tooltip:r}){var c;const o=((c=s.harness)==null?void 0:c.replace(/-headless$/,""))||"claude",l=(de[s.harness]||de[o]||de.claude).Glyph,d=t.reduce((i,h)=>{const g=se(h);return g==="run"?i.running+=1:g==="need"?i.needsYou+=1:i.other+=1,i},{running:0,needsYou:0,other:0});return e.jsxs("button",{type:"button",className:"sb-launcher-group","data-launcher":s.name,"data-tip":r,"aria-label":r,onClick:n,children:[e.jsx("span",{className:"sb-launcher-glyph","aria-hidden":"true",children:e.jsx(l,{})}),e.jsx("span",{className:"sb-launcher-name",children:s.name}),e.jsxs("span",{className:"sb-launcher-counts","aria-hidden":"true",children:[e.jsx("span",{className:"sb-launcher-running",children:d.running}),e.jsx("span",{className:"sb-launcher-slash",children:"/"}),e.jsx("span",{className:"sb-launcher-needs",children:d.needsYou}),e.jsx("span",{className:"sb-launcher-slash",children:"/"}),e.jsx("span",{className:"sb-launcher-other",children:d.other})]})]})}function An({launchers:s,sessions:t,onOpen:n,tooltip:r}){if(!t.length)return null;const o=t.reduce((a,l)=>{const d=se(l);return d==="run"?a.running+=1:d==="need"?a.needsYou+=1:a.other+=1,a},{running:0,needsYou:0,other:0});return e.jsxs("button",{type:"button",className:"sb-launcher-summary","data-launcher-summary":s.map(a=>a.name).join(","),"data-tip":r,"aria-label":r,onClick:n,children:[e.jsx("span",{className:"sb-launcher-summary-mark","aria-hidden":"true",children:s.length}),e.jsxs("span",{className:"sb-launcher-counts","aria-hidden":"true",children:[e.jsx("span",{className:"sb-launcher-running",children:o.running}),e.jsx("span",{className:"sb-launcher-slash",children:"/"}),e.jsx("span",{className:"sb-launcher-needs",children:o.needsYou}),e.jsx("span",{className:"sb-launcher-slash",children:"/"}),e.jsx("span",{className:"sb-launcher-other",children:o.other})]})]})}function Kn(s,t){const n=(s||[]).filter(a=>(t||[]).some(l=>l.launcher===a.name)).map(a=>({...a,sessions:t.filter(l=>l.launcher===a.name)})),r=new Set((s||[]).map(a=>a.name)),o=(t||[]).filter(a=>!r.has(a.launcher));return o.length?[...n,{name:"other",harness:"claude",sessions:o}]:n}function Qe({specs:s,sessions:t,page:n}){const r=D(),{offline:o}=ke(),{launchers:a}=yt(),l=f.useMemo(()=>Kn(a,t||[]),[a,t]),d=f.useMemo(()=>(t||[]).filter(p=>se(p)==="need").length,[t]),c=o?e.jsx("span",{className:"sb-stale","aria-label":r("backend.stale"),"data-tip":r("backend.stale")}):null,i=f.useMemo(()=>bt(s||[]),[s]),{fail:h}=i.scoreCount,g=p=>{const u=vt(p,Ln());u&&M("graph",u,{replace:n==="graph"})},y=(p,u)=>p.length?n==="graph"?()=>g(p):()=>M(u):null;return Y({id:"ledger-nodes",side:"right",priority:41,tooltip:r("statusBar.nodes",{n:i.total}),node:e.jsxs("span",{className:"sb-tally",children:[kt.map(p=>e.jsx(xe,{name:`status-${p}`,count:i.status[p].length,onClick:i.status[p].length?()=>g(i.status[p]):null,title:r("stats.statusTitle",{n:i.status[p].length,status:r(`status.${p}`)}),children:e.jsx("i",{className:"sb-status-dot",style:{background:V[p].color}})},p)),c]})}),Y({id:"ledger-evals",side:"right",priority:42,kind:h>0?"error":void 0,tooltip:r("statusBar.evals",i.scoreCount),node:e.jsxs("span",{className:"sb-tally",children:[Pn.map(({state:p,always:u,titleKey:S})=>{const k=i.scoreCount[p];return!k&&!u?null:e.jsx(xe,{name:`eval-${p}`,count:k,onClick:y(i.scoreNodes[p],"evals"),title:n==="graph"?r(`stats.${S}`,{n:k}):`${r(`score.${p}`)} · ${r("statusBar.openEvals")}`,children:e.jsx(Nt,{state:p})},p)}),c]})}),Y({id:"ledger-issues",side:"right",priority:43,tooltip:r("statusBar.issues",{n:i.issueCount}),node:e.jsxs("span",{className:"sb-tally",children:[e.jsx(xe,{name:"issues",count:i.issueCount,onClick:y(i.issueIds,"issues"),title:n==="graph"?r("stats.issueTitle",{n:i.issueCount}):r("statusBar.issues",{n:i.issueCount}),children:e.jsx(K,{name:"issue-opened",size:13})}),c]})}),Y({id:"ledger-sessions",side:"right",priority:44,kind:d>0?"warning":void 0,tooltip:r("statusBar.sessions"),node:e.jsxs("span",{className:"sb-launcher-groups",children:[e.jsx("span",{className:"sb-launcher-list",children:l.map(p=>e.jsx(Rn,{launcher:p,sessions:p.sessions,tooltip:r("statusBar.launcher",{name:p.name}),onOpen:()=>M("sessions")},p.name))}),e.jsx(An,{launchers:l,sessions:t||[],onOpen:()=>M("sessions"),tooltip:r("statusBar.launcherSummary",{n:l.length})}),c]})}),null}function Xe({page:s,param:t,query:n,inactive:r=!1}){const o=D(),{split:a}=re(),{closeSplit:l}=q(),[d,c,i]=ae("spex.splitWidth",620,{min:320,max:1400,dir:-1});return a?e.jsxs("div",{className:"content-split",children:[e.jsx(be,{page:s,param:t,query:n,inactive:r}),e.jsx("div",{className:"content-divider",onMouseDown:c,onDoubleClick:i,role:"separator","aria-orientation":"vertical"}),e.jsxs("div",{className:"content-second",style:{width:d},children:[e.jsx("button",{type:"button",className:"content-close",onClick:l,"aria-label":o("tabs.close"),children:e.jsx(K,{name:"x",size:12})}),e.jsx(be,{page:a.page,param:a.param,query:a.query,inactive:r})]})]}):e.jsx(Mn,{page:s,param:t,query:n,inactive:r})}function zn({visible:s,onToggle:t}){const n=D(),r=ee(n(s?"contextDock.close":"contextDock.open"),"shell.contextToggle");return e.jsx("button",{type:"button",className:`context-toggle${s?" on":""}`,onClick:t,"aria-pressed":s,"aria-label":r,"data-tip":r,children:e.jsx(K,{name:"panel-right",size:14})})}function Bn({routeOverride:s=null,inactive:t=!1}){const n=D(),r=Ys(),{page:o,param:a,query:l}=s||r,{specs:d,sessions:c,identity:i,graphOnly:h}=we(),{notify:g}=Ze(),y=f.useRef(null),p=f.useMemo(()=>(c||[]).filter(x=>se(x)==="need").length,[c]);f.useEffect(()=>{const x=y.current;if(y.current=new Map((c||[]).map(P=>[P.id,P.status])),!!x)for(const P of c||[])P.status!=="asking"||x.get(P.id)==="asking"||g(`${ns(P)} · ${n("status.asking")}`,{kind:"info",onClick:()=>M("sessions",P.id)})},[c,g,n]);const u=Ks(),{dock:S,dockMode:k,palette:v,helpOpen:E}=re(),{closePalette:C,openPalette:w,toggleHelp:O,closeHelp:A,setDock:b,setDockMode:m,splitTo:j}=q();Y({id:"help",side:"left",priority:-1/0,text:"?",tooltip:ee(n("hud.helpTitle"),"graph.help"),onClick:O});const[N,T]=f.useState(()=>{try{return localStorage.getItem("spexcode.ctxOpen")==="1"}catch{return!1}}),z=()=>T(x=>{const P=!x;try{localStorage.setItem("spexcode.ctxOpen",P?"1":"0")}catch{}return P}),$=Dn(o),W=$!=="none"||o==="sessions",F=`${o}/${a??""}`,[Ss,Es,Cs]=rs(S);f.useEffect(()=>{($==="sessions"||$==="explorer")&&m($)},[F]);const Ee=xt({page:o,param:a,query:l},{specs:d,sessions:c,names:u,t:n});f.useEffect(()=>{document.title=`${p>0?`(${p}) `:""}${Ee} · ${(i==null?void 0:i.title)||"spexcode"}`},[Ee,i==null?void 0:i.title,p]);const Ds=f.useCallback(x=>{var P,H;if(t)return!1;if(v)return x.key==="Escape"?(x.preventDefault(),C(),!0):!1;if(E){if(x.key==="Escape"||!x.altKey&&!x.ctrlKey&&!x.metaKey&&te("graph.help",x.key))return x.preventDefault(),A(),!0;if(x.key==="j"||x.key==="k"||x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();const I=document.querySelector(".legend-body");return I&&(I.scrollTop+=x.key==="j"||x.key==="ArrowDown"?120:-120),!0}return!0}if((x.key==="Enter"||x.key===" ")&&((H=(P=x.target)==null?void 0:P.closest)!=null&&H.call(P,"button, a[href], input, select, textarea, summary")))return!1;if(!x.altKey&&!x.ctrlKey&&!x.metaKey&&te("graph.help",x.key))return x.preventDefault(),C(),O(),!0;if(x.altKey&&!x.metaKey&&!x.ctrlKey){if(!h&&L("shell.newSession",x))return x.preventDefault(),M("sessions","new"),!0;if(!h&&L("shell.evals",x))return x.preventDefault(),C(),M("evals"),!0;if(!h&&L("shell.search",x))return x.preventDefault(),w("sessions"),!0}if(L("shell.dockToggle",x))return x.preventDefault(),b(I=>!I),!0;if(L("shell.dockMode",x))return x.preventDefault(),m(k==="explorer"?"sessions":"explorer"),!0;if(!h&&L("shell.contextToggle",x))return x.preventDefault(),z(),!0;if(!h&&L("shell.tabClose",x))return x.preventDefault(),Q("closeActive"),!0;if(!h&&L("shell.tabNext",x))return x.preventDefault(),Q("move",1),!0;if(!h&&L("shell.tabPrevious",x))return x.preventDefault(),Q("move",-1),!0;if(!h&&L("shell.tabHold",x))return x.preventDefault(),Q("hold"),!0;if(!h&&L("shell.tabSplit",x)){x.preventDefault();const I=Q("active");return I&&j(I),!0}return!x.altKey&&!x.ctrlKey&&!x.metaKey&&te("graph.settings",x.key)?(x.preventDefault(),o==="settings"?M("sessions"):M("settings"),!0):!x.altKey&&!x.ctrlKey&&!x.metaKey&&te("graph.search",x.key)?(x.preventDefault(),w(($==="sessions"||$==="explorer"?$:k)==="sessions"?"sessions":"nodes"),!0):!1},[A,C,$,k,h,E,t,w,o,v,b,m,j,O,N]);return es(Ds,t?-1e3:-100),t?e.jsxs("div",{style:{display:"none"},"aria-hidden":"true",children:[e.jsx(Xe,{page:o,param:a,query:l,inactive:!0}),e.jsx(Je,{}),e.jsx(Qe,{specs:d,sessions:c,page:o})]}):h?e.jsxs("div",{className:"app-shell",children:[e.jsxs("div",{className:"app",children:[e.jsx(_e,{}),e.jsx(Ie,{page:"graph",graphOnly:!0}),e.jsx("div",{className:"app-main",children:e.jsx(be,{page:"graph",param:a,query:l})})]}),e.jsx(De,{})]}):e.jsxs("div",{className:"app-shell",children:[e.jsxs("div",{className:"app",children:[e.jsx(_e,{}),E&&e.jsx(wn,{onClose:A}),e.jsx(Ie,{page:o,needsYou:p,hideDockToggle:!W}),Ss&&$!=="none"&&e.jsx(Se,{resetKey:"dock",children:e.jsx(Ht,{closing:Es,opening:Cs,mode:k,specs:d,sessions:c,focusId:o==="spec"?a:null,activeSessionId:o==="sessions"?a:null,suppressSessionRows:o==="sessions"})}),e.jsxs("div",{className:"app-content-column",children:[e.jsxs("div",{className:"app-content-row",children:[e.jsxs("div",{className:"app-main",children:[o!=="sessions"&&e.jsx(gt,{specs:d,sessions:c,route:{page:o,param:a,query:l},trailing:o==="spec"?e.jsx(zn,{visible:N,onToggle:z}):null}),e.jsx(Xe,{page:o,param:a,query:l,inactive:t})]}),e.jsx(mn,{page:o,param:a,open:N,onToggle:z})]}),e.jsx(Je,{}),e.jsx(Qe,{specs:d,sessions:c,page:o})]})]}),e.jsx(De,{}),v&&e.jsx(dn,{specs:d,sessions:c,boost:v==="sessions"?"session":null,onClose:C,onPick:(x,P)=>{if(C(),!(P!=null&&P.hold))return ge(x==null?void 0:x.address);const H=jt(x==null?void 0:x.address);R(H.page,H.param,H.query)}}),e.jsx("span",{className:"sr-only",children:n("nav.railLabel")})]})}function Yn({route:s=null,inactive:t=!1}){return e.jsx(Bn,{routeOverride:s,inactive:t})}export{Yn as default};
|