local-operator-ui 0.31.24 → 0.31.26
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/out/main/index.js +91 -4
- package/out/renderer/assets/{_basePickBy-DvYnhuYU.js → _basePickBy-D0wlCvva.js} +1 -1
- package/out/renderer/assets/{_baseUniq-bfmokOo7.js → _baseUniq-DPa_8DrG.js} +1 -1
- package/out/renderer/assets/{agent-details-page-CKuk0h6D.js → agent-details-page-CrARDEtK.js} +2 -2
- package/out/renderer/assets/agent-hub-page-tj8FYJ7M.js +11 -0
- package/out/renderer/assets/agents-page-CbQN_5wE.js +7 -0
- package/out/renderer/assets/aida-control-BuMafqCb.js +50 -0
- package/out/renderer/assets/arc-BG4bHuQI.js +1 -0
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-iKar6Oic.js → architectureDiagram-IEHRJDOE-CkYkkIY9.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-B2zh8hXK.js → blockDiagram-JOT3LUYC-D0DwK5Ey.js} +1 -1
- package/out/renderer/assets/{book-open-ARKlovXx.js → book-open-DeQc_I6g.js} +1 -1
- package/out/renderer/assets/browser-page-CIhGr6vl.js +1 -0
- package/out/renderer/assets/browser-webauthn-prompt-CYou_6QY.js +1 -0
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-BMHJDEcf.js → c4Diagram-VJAJSXHY-CubzqfYr.js} +1 -1
- package/out/renderer/assets/channel-B-eIVFbM.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-DRAVdspP.js → chunk-4BMEZGHF-AysrzODh.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-Cud6VnlY.js → chunk-A2AXSNBT-DfDo-OSy.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-BDCFuoNl.js → chunk-AEK57VVT-5xgHbFtp.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-DlMa4UAs.js → chunk-D6G4REZN-pYCMpQiN.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-EHEIhkiY.js → chunk-RZ5BOZE2-C5bWxzka.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-D6SPBzK4.js → chunk-XZIHB7SX-B4wB3iEG.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BN6aG5Qf.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BN6aG5Qf.js +1 -0
- package/out/renderer/assets/clone-C3CHGd7j.js +1 -0
- package/out/renderer/assets/{console-mirror-iQjAVQrh.js → console-mirror-45f9-7QH.js} +1 -1
- package/out/renderer/assets/{consoleCapture-f4bHcMlg.js → consoleCapture-GiahzrSM.js} +1 -1
- package/out/renderer/assets/{dagre-OKDRZEBW-C69-0hU9.js → dagre-OKDRZEBW-CBRdPb8k.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-DsUPj3k9.js → diagram-SSKATNLV-DyGZgIL1.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-3cLE7l86.js → diagram-VNBRO52H-Con45RzE.js} +1 -1
- package/out/renderer/assets/{en-US-BkS8Ixxl.js → en-US-BcB1DWxG.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-Gqm9ZUtK.js → erDiagram-Q7BY3M3F-Cpuc-IVT.js} +1 -1
- package/out/renderer/assets/{error-boundary-BheI-_hJ.js → error-boundary-CdtTgj_c.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-bu5rejsx.js → flowDiagram-4HSFHLVR-CsO4ubSn.js} +1 -1
- package/out/renderer/assets/format-CZUObkkr.js +1 -0
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-DOpEB0OK.js → ganttDiagram-APWFNJXF-LYPPAOmY.js} +3 -3
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-BitJPB27.js → gitGraphDiagram-7IBYFJ6S-BO_dix1Z.js} +1 -1
- package/out/renderer/assets/{graph-CyyuMUaw.js → graph-uBeiISg2.js} +1 -1
- package/out/renderer/assets/index-2qmFWi_F.css +1 -0
- package/out/renderer/assets/index-Bi4c5ZZH.js +7 -0
- package/out/renderer/assets/{index-D-d-ykb4.js → index-CIj3B-eB.js} +1 -1
- package/out/renderer/assets/{index-FOmxzVhB.js → index-COUHPq03.js} +411 -402
- package/out/renderer/assets/index-D8ujEXbz.css +1 -0
- package/out/renderer/assets/infoDiagram-PH2N3AL5-BqRYyG2a.js +2 -0
- package/out/renderer/assets/{installer-Dq_j5D8p.js → installer-zpOWwoWQ.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-CMXDard0.js → journeyDiagram-U35MCT3I-B6AH0Dcn.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-CGZPXBz-.js → kanban-definition-NDS4AKOZ-C7dciPrH.js} +1 -1
- package/out/renderer/assets/{layout-TTjt9cpH.js → layout-hxpgEDIm.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-DsEHBb_T.js → legacy-agents-page-C6kd3fjG.js} +4 -4
- package/out/renderer/assets/{mermaid.core-BGnJVp5q.js → mermaid.core-CC8CflzC.js} +5 -5
- package/out/renderer/assets/mesh-page-M4Y20e0t.js +2 -0
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-CaLpfI_E.js → mindmap-definition-ALO5MXBD-BWI1IBWM.js} +1 -1
- package/out/renderer/assets/{mini-KOisKeMi.js → mini-Dtj-bCUA.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-CZiYqd1P.js → org-surface-gate-CjPxDSXP.js} +1 -1
- package/out/renderer/assets/{page-header-B2VyeyKK.js → page-header-Dt6h8jvu.js} +1 -1
- package/out/renderer/assets/parseISO-CZfAC2_J.js +1 -0
- package/out/renderer/assets/pieDiagram-IB7DONF6-DNymJR3P.js +30 -0
- package/out/renderer/assets/{projects-page-D8CTmXCv.js → projects-page-C3N6NYIX.js} +11 -11
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-8FVHpZVN.js → quadrantDiagram-7GDLP6J5-bRmQaOWY.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-4pgGQ-2B.js → radar-MK3ICKWK-B1I3333M.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-DUT18lNx.js → radient-auth-buttons-CCXHTNWU.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-BubgmAeX.js → requirementDiagram-KVF5MWMF-B29w6CHz.js} +1 -1
- package/out/renderer/assets/sankeyDiagram-QLVOVGJD-BNv_qf23.js +10 -0
- package/out/renderer/assets/{schedules-page-CajtG50s.js → schedules-page-CXz63fN5.js} +10 -10
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DyNeye_f.js → sequenceDiagram-X6HHIX6F-D7gyUvnw.js} +1 -1
- package/out/renderer/assets/{settings-page-DZNyJZ23.js → settings-page-CsCf63si.js} +6 -6
- package/out/renderer/assets/{settings-section-DQ45Riip.js → settings-section-DMXSpP_D.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-DRqrOBmL.js → stateDiagram-DGXRK772-Dd3BswSO.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-D9cOpOSm.js +1 -0
- package/out/renderer/assets/{textarea-CaRKMTTG.js → textarea-DsHM-W2p.js} +2 -2
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-DC76uMim.js → timeline-definition-BDJGKUSR-MePOCWzB.js} +1 -1
- package/out/renderer/assets/{ui-preferences-store-qSXgzAHu.js → ui-preferences-store-BmAT9G_p.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-B_qjSLGd.js → use-download-agent-mutation-BNAfnIa9.js} +2 -2
- package/out/renderer/assets/use-memberships-query-PWqngUAl.js +1 -0
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-CyMpnVUJ.js → xychartDiagram-VJFVF3MP-heZP1JY-.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +9 -9
- package/out/renderer/installer.html +5 -5
- package/out/renderer/mini.html +6 -6
- package/package.json +2 -2
- package/out/renderer/assets/agent-hub-page-mjoCtkLM.js +0 -11
- package/out/renderer/assets/agents-page-CKyDYjEM.js +0 -2
- package/out/renderer/assets/aida-control-B8b5SXix.js +0 -50
- package/out/renderer/assets/arc-CFcKtuSP.js +0 -1
- package/out/renderer/assets/browser-page-UoqCN-xN.js +0 -1
- package/out/renderer/assets/browser-webauthn-prompt-CFO8FunV.js +0 -1
- package/out/renderer/assets/channel-CIrWsSCo.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BDlMBcMy.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BDlMBcMy.js +0 -1
- package/out/renderer/assets/clone-DkQdBey4.js +0 -1
- package/out/renderer/assets/index-CSPo12AE.css +0 -1
- package/out/renderer/assets/index-CsbIIOFq.css +0 -1
- package/out/renderer/assets/index-Db927tvJ.js +0 -7
- package/out/renderer/assets/infoDiagram-PH2N3AL5-D3FD5ygR.js +0 -2
- package/out/renderer/assets/mesh-page-BuM1oQ_i.js +0 -2
- package/out/renderer/assets/parseISO-BWtr7JL9.js +0 -1
- package/out/renderer/assets/pieDiagram-IB7DONF6-DgCZ_Tpy.js +0 -30
- package/out/renderer/assets/sankeyDiagram-QLVOVGJD-C8luu1Ce.js +0 -10
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-o-zf-20f.js +0 -1
- package/out/renderer/assets/use-memberships-query-Q1_CwjZE.js +0 -1
- /package/out/renderer/assets/{index-C8q85hqs.js → index-Dn3kYWFt.js} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import{p as V}from"./chunk-4BMEZGHF-AysrzODh.js";import{_ as p,g as U,s as j,a as q,b as H,t as K,q as Q,l as F,c as Z,F as J,K as X,Q as Y,e as tt,z as et,H as at}from"./mermaid.core-CC8CflzC.js";import{p as rt}from"./radar-MK3ICKWK-B1I3333M.js";import{d as O}from"./arc-BG4bHuQI.js";import{a as y,t as z,R as nt,S as it}from"./index-COUHPq03.js";import"./index-Dn3kYWFt.js";import"./_baseUniq-DPa_8DrG.js";import"./_basePickBy-D0wlCvva.js";import"./clone-C3CHGd7j.js";import"./aida-control-BuMafqCb.js";import"./ui-preferences-store-BmAT9G_p.js";import"./textarea-DsHM-W2p.js";import"./error-boundary-CdtTgj_c.js";import"./console-mirror-45f9-7QH.js";function st(t,a){return a<t?-1:a>t?1:a>=t?0:NaN}function ot(t){return t}function lt(){var t=ot,a=st,m=null,s=y(0),u=y(z),x=y(0);function i(e){var r,l=(e=nt(e)).length,d,A,h=0,c=new Array(l),n=new Array(l),v=+s.apply(this,arguments),w=Math.min(z,Math.max(-z,u.apply(this,arguments)-v)),f,T=Math.min(Math.abs(w)/l,x.apply(this,arguments)),$=T*(w<0?-1:1),g;for(r=0;r<l;++r)(g=n[c[r]=r]=+t(e[r],r,e))>0&&(h+=g);for(a!=null?c.sort(function(S,C){return a(n[S],n[C])}):m!=null&&c.sort(function(S,C){return m(e[S],e[C])}),r=0,A=h?(w-l*$)/h:0;r<l;++r,v=f)d=c[r],g=n[d],f=v+(g>0?g*A:0)+$,n[d]={data:e[d],index:r,value:g,startAngle:v,endAngle:f,padAngle:T};return n}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:y(+e),i):t},i.sortValues=function(e){return arguments.length?(a=e,m=null,i):a},i.sort=function(e){return arguments.length?(m=e,a=null,i):m},i.startAngle=function(e){return arguments.length?(s=typeof e=="function"?e:y(+e),i):s},i.endAngle=function(e){return arguments.length?(u=typeof e=="function"?e:y(+e),i):u},i.padAngle=function(e){return arguments.length?(x=typeof e=="function"?e:y(+e),i):x},i}var ct=at.pie,G={sections:new Map,showData:!1},b=G.sections,R=G.showData,pt=structuredClone(ct),ut=p(()=>structuredClone(pt),"getConfig"),dt=p(()=>{b=new Map,R=G.showData,et()},"clear"),gt=p(({label:t,value:a})=>{b.has(t)||(b.set(t,a),F.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),ft=p(()=>b,"getSections"),mt=p(t=>{R=t},"setShowData"),ht=p(()=>R,"getShowData"),P={getConfig:ut,clear:dt,setDiagramTitle:Q,getDiagramTitle:K,setAccTitle:H,getAccTitle:q,setAccDescription:j,getAccDescription:U,addSection:gt,getSections:ft,setShowData:mt,getShowData:ht},vt=p((t,a)=>{V(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),St={parse:p(async t=>{const a=await rt("pie",t);F.debug(a),vt(a,P)},"parse")},yt=p(t=>`
|
|
2
|
+
.pieCircle{
|
|
3
|
+
stroke: ${t.pieStrokeColor};
|
|
4
|
+
stroke-width : ${t.pieStrokeWidth};
|
|
5
|
+
opacity : ${t.pieOpacity};
|
|
6
|
+
}
|
|
7
|
+
.pieOuterCircle{
|
|
8
|
+
stroke: ${t.pieOuterStrokeColor};
|
|
9
|
+
stroke-width: ${t.pieOuterStrokeWidth};
|
|
10
|
+
fill: none;
|
|
11
|
+
}
|
|
12
|
+
.pieTitleText {
|
|
13
|
+
text-anchor: middle;
|
|
14
|
+
font-size: ${t.pieTitleTextSize};
|
|
15
|
+
fill: ${t.pieTitleTextColor};
|
|
16
|
+
font-family: ${t.fontFamily};
|
|
17
|
+
}
|
|
18
|
+
.slice {
|
|
19
|
+
font-family: ${t.fontFamily};
|
|
20
|
+
fill: ${t.pieSectionTextColor};
|
|
21
|
+
font-size:${t.pieSectionTextSize};
|
|
22
|
+
// fill: white;
|
|
23
|
+
}
|
|
24
|
+
.legend text {
|
|
25
|
+
fill: ${t.pieLegendTextColor};
|
|
26
|
+
font-family: ${t.fontFamily};
|
|
27
|
+
font-size: ${t.pieLegendTextSize};
|
|
28
|
+
}
|
|
29
|
+
`,"getStyles"),xt=yt,At=p(t=>{const a=[...t.entries()].map(s=>({label:s[0],value:s[1]})).sort((s,u)=>u.value-s.value);return lt().value(s=>s.value)(a)},"createPieArcs"),wt=p((t,a,m,s)=>{F.debug(`rendering pie chart
|
|
30
|
+
`+t);const u=s.db,x=Z(),i=J(u.getConfig(),x.pie),e=40,r=18,l=4,d=450,A=d,h=X(a),c=h.append("g");c.attr("transform","translate("+A/2+","+d/2+")");const{themeVariables:n}=x;let[v]=Y(n.pieOuterStrokeWidth);v??=2;const w=i.textPosition,f=Math.min(A,d)/2-e,T=O().innerRadius(0).outerRadius(f),$=O().innerRadius(f*w).outerRadius(f*w);c.append("circle").attr("cx",0).attr("cy",0).attr("r",f+v/2).attr("class","pieOuterCircle");const g=u.getSections(),S=At(g),C=[n.pie1,n.pie2,n.pie3,n.pie4,n.pie5,n.pie6,n.pie7,n.pie8,n.pie9,n.pie10,n.pie11,n.pie12],D=it(C);c.selectAll("mySlices").data(S).enter().append("path").attr("d",T).attr("fill",o=>D(o.data.label)).attr("class","pieCircle");let W=0;g.forEach(o=>{W+=o}),c.selectAll("mySlices").data(S).enter().append("text").text(o=>(o.data.value/W*100).toFixed(0)+"%").attr("transform",o=>"translate("+$.centroid(o)+")").style("text-anchor","middle").attr("class","slice"),c.append("text").text(u.getDiagramTitle()).attr("x",0).attr("y",-400/2).attr("class","pieTitleText");const M=c.selectAll(".legend").data(D.domain()).enter().append("g").attr("class","legend").attr("transform",(o,k)=>{const E=r+l,L=E*D.domain().length/2,_=12*r,B=k*E-L;return"translate("+_+","+B+")"});M.append("rect").attr("width",r).attr("height",r).style("fill",D).style("stroke",D),M.data(S).append("text").attr("x",r+l).attr("y",r-l).text(o=>{const{label:k,value:E}=o.data;return u.getShowData()?`${k} [${E}]`:k});const I=Math.max(...M.selectAll("text").nodes().map(o=>o?.getBoundingClientRect().width??0)),N=A+e+r+l+I;h.attr("viewBox",`0 0 ${N} ${d}`),tt(h,d,N,i.useMaxWidth)},"draw"),Ct={draw:wt},Pt={parser:St,db:P,renderer:Ct,styles:xt};export{Pt as diagram};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{r as x,j as t,c as R}from"./index-
|
|
1
|
+
import{r as x,j as t,c as R}from"./index-Dn3kYWFt.js";import{N as ts,O as Ae,Q as ss,R as yt,u as kt,U as as,V as ns,W as rs,X as is,Y as os,Z as ls,_ as Je,$ as Ze,a0 as cs,a1 as ds,B as Nt,h as H,C as Ye,a2 as pe,a3 as us,a4 as ms,j as ge,a as wt,D as hs,d as et,p as fs,k as ps,a5 as xs,I as gs}from"./aida-control-BuMafqCb.js";import{P as tt}from"./page-header-Dt6h8jvu.js";import{c as qe,s as je,g as St,t as be,u as ve,v as ye,w as ue,B as L,D as js,j as bs,k as vs,n as Me,Q as ys,R as ks,U as Ns,V as ws,W as Ss,m as Ts,p as re,P as _s,Y as Ds,K as Cs,I as z,S as de,L as q,a as Es,y as Tt,N as Os,X as Ms,C as Ps,A as $e,M as As,z as $s,E as Rs,F as Ls,f as ce}from"./textarea-DsHM-W2p.js";import{_ as ie,c1 as Is,au as Fs,a3 as Te,c2 as _t,T as _e,aa as De,c3 as Us,c4 as Bs,c5 as Ys,c6 as qs,ab as Dt,c7 as Ws,bE as zs,aS as ke,aW as Ks,aV as Qs,c8 as Hs,c9 as Gs,ca as Vs,cb as Xs,cc as Js,cd as Zs,ce as ea,a5 as st,cf as ta,a2 as sa,U as V,$ as se,a4 as aa,cg as at,ch as na}from"./index-COUHPq03.js";import"./ui-preferences-store-BmAT9G_p.js";import"./error-boundary-CdtTgj_c.js";import"./console-mirror-45f9-7QH.js";function nt(e,s){return e.filter(a=>!s.includes(a))}function ra(e,s,a){const n=e.slice(0);return n[s]=a,n}var ia=class extends ts{#a;#e;#n;#r;#t;#s;#i;#o;#l=[];constructor(e,s,a){super(),this.#a=e,this.#r=a,this.#n=[],this.#t=[],this.#e=[],this.setQueries(s)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(s=>{this.#m(e,s)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,s){this.#n=e,this.#r=s,Ae.batch(()=>{const a=this.#t,n=this.#u(this.#n);this.#l=n,n.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const r=n.map(o=>o.observer),i=r.map(o=>o.getCurrentResult()),l=r.some((o,m)=>o!==a[m]);a.length===r.length&&!l||(this.#t=r,this.#e=i,this.hasListeners()&&(nt(a,r).forEach(o=>{o.destroy()}),nt(r,a).forEach(o=>{o.subscribe(m=>{this.#m(o,m)})}),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,s){const a=this.#u(e),n=a.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions));return[n,r=>this.#d(r??n,s),()=>this.#c(n,a)]}#c(e,s){return s.map((a,n)=>{const r=e[n];return a.defaultedQueryOptions.notifyOnChangeProps?r:a.observer.trackResult(r,i=>{s.forEach(l=>{l.observer.trackProp(i)})})})}#d(e,s){return s?((!this.#s||this.#e!==this.#o||s!==this.#i)&&(this.#i=s,this.#o=this.#e,this.#s=ss(this.#s,s(e))),this.#s):e}#u(e){const s=new Map(this.#t.map(n=>[n.options.queryHash,n])),a=[];return e.forEach(n=>{const r=this.#a.defaultQueryOptions(n),i=s.get(r.queryHash);i?a.push({defaultedQueryOptions:r,observer:i}):a.push({defaultedQueryOptions:r,observer:new yt(this.#a,r)})}),a}#m(e,s){const a=this.#t.indexOf(e);a!==-1&&(this.#e=ra(this.#e,a,s),this.#h())}#h(){if(this.hasListeners()){const e=this.#s,s=this.#c(this.#e,this.#l),a=this.#d(s,this.#r?.combine);e!==a&&Ae.batch(()=>{this.listeners.forEach(n=>{n(this.#e)})})}}};function oa({queries:e,...s},a){const n=kt(a),r=as(),i=ns(),l=x.useMemo(()=>e.map(N=>{const g=n.defaultQueryOptions(N);return g._optimisticResults=r?"isRestoring":"optimistic",g}),[e,n,r]);l.forEach(N=>{rs(N),is(N,i)}),os(i);const[o]=x.useState(()=>new ia(n,l,s)),[m,h,d]=o.getOptimisticResult(l,s.combine),b=!r&&s.subscribed!==!1;x.useSyncExternalStore(x.useCallback(N=>b?o.subscribe(Ae.batchCalls(N)):ls,[o,b]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),x.useEffect(()=>{o.setQueries(l,s)},[l,s,o]);const u=m.some((N,g)=>Je(l[g],N))?m.flatMap((N,g)=>{const v=l[g];if(v){const c=new yt(n,v);if(Je(v,N))return Ze(v,c,i);cs(N,r)&&Ze(v,c,i)}return[]}):[];if(u.length>0)throw Promise.all(u);const w=m.find((N,g)=>{const v=l[g];return v&&ds({result:N,errorResetBoundary:i,throwOnError:v.throwOnError,query:n.getQueryCache().get(v.queryHash),suspense:v.suspense})});if(w?.error)throw w.error;return h(d())}/**
|
|
2
2
|
* @license lucide-react v0.507.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const la=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],ca=qe("link-2",la);/**
|
|
7
7
|
* @license lucide-react v0.507.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const da=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],ua=qe("send-horizontal",da);/**
|
|
12
12
|
* @license lucide-react v0.507.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ua=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],ma=qe("unlink",ua),Ce={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function ha(e){return Nt({queryKey:Ce.list,enabled:e,queryFn:()=>H({op:"projects.list"}).then(s=>s.projects),retry:Ye,staleTime:1e4})}function fa(e,s){return ia({queries:e.map(a=>({queryKey:Ce.detail(a),enabled:s&&!!a,queryFn:()=>H({op:"projects.get",key:a}),retry:Ye,staleTime:1e4}))})}function Ct(e,s){return Nt({queryKey:Ce.detail(e??""),enabled:s&&!!e,queryFn:()=>H({op:"projects.get",key:e??""}),retry:Ye,staleTime:1e4})}function oe(){const e=kt();return()=>{e.invalidateQueries({queryKey:Ce.list})}}function pa(){const e=oe();return ie({mutationFn:s=>H({op:"projects.create",name:s.name,...s.description!==void 0?{description:s.description}:{},...s.status!==void 0?{status:s.status}:{},...s.tags!==void 0?{tags:s.tags}:{}}),onSuccess:()=>e()})}function Et(){const e=oe();return ie({mutationFn:s=>H({op:"projects.update",key:s.key,fields:s.fields}),onSuccess:()=>e()})}function Ot(){const e=oe();return ie({mutationFn:s=>H({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function xa(){const e=oe();return ie({mutationFn:s=>H({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function ga(){const e=oe();return ie({mutationFn:s=>H({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function ja(){const e=oe();return ie({mutationFn:s=>H({op:"projects.milestone",key:s.key,name:s.name,...s.targetDate!==void 0?{targetDate:s.targetDate}:{},...s.completed!==void 0?{completed:s.completed}:{}}),onSuccess:()=>e()})}function ba(){const e=oe();return ie({mutationFn:s=>H({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>e()})}const va={planning:{label:"Planning",variant:"info"},active:{label:"Active",variant:"accent"},qa:{label:"QA",variant:"attention"},validation:{label:"Validation",variant:"warning"},done:{label:"Done",variant:"success"},paused:{label:"Paused",variant:"neutral"},archived:{label:"Archived",variant:"outline"}};function W(e){return va[e]??{label:e||"Unknown",variant:"neutral"}}function ya(e){return e==="done"}const ka={completed:{label:"Completed",variant:"success"},overdue:{label:"Overdue",variant:"warning"},upcoming:{label:"Upcoming",variant:"neutral"}};function Na(e){return ka[e]??{label:String(e),variant:"neutral"}}const Ne="Stale",wa=/^(\d{4})-(\d{2})-(\d{2})$/;function X(e,s,a=new Date){if(!e)return"";const n=wa.exec(e);if(!n)return e;const r=new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));if(Number.isNaN(r.getTime()))return e;const i=r.toLocaleDateString(s,{month:"short",day:"numeric"});return r.getFullYear()===a.getFullYear()?i:`${i}, ${r.getFullYear()}`}function he(e,s){if(e==null)return"";const a=Math.max(0,Math.floor(s/1e3-e));return a<60?"just now":a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function fe(e){return e==="just now"?"just now":`${e} ago`}function Sa(e){return e?`reported ${fe(e)}`:"no progress"}const Pt=/^$|^\d{4}-\d{2}-\d{2}$/;function At(e){return e?e==="operator"?"the operator":`session ${e}`:""}function Ta(e,s){if(!e.progress)return"not reported yet";const a=he(e.progress_updated_at,s),n=At(e.progress_reported_by),r=[a?`reported ${fe(a)}`:"reported"];return n&&r.push(`by ${n}`),r.join(" ")}function Mt(e,s){if(e==null)return"";const a=String(e);return s==="points"?`${a} pt`:s==="days"?`${a}d`:a}function $t(e,s){return s<=0?"":`${e}/${s}`}function We(e){return e<=0?"":`${e} live`}function _a(e){return e<=0?"":e===1?"1 session":`${e} sessions`}function Da(e){const s=_a(e.sessions);if(!s)return"";const a=We(e.live_sessions);return a?`${s} · ${a}`:s}function Ca(e){if(!e.exists)return{label:"Missing",variant:"outline"};if(e.archived)return{label:"Archived",variant:"neutral"};switch(e.runtime?.state){case"live":return{label:"Live",variant:"success"};case"wedged":return{label:"Wedged",variant:"warning"};case"stale":return{label:"Stale",variant:"warning"};case"stopped":return{label:"Stopped",variant:"neutral"};default:return{label:String(e.runtime?.state??"Unknown"),variant:"neutral"}}}function Ea(e){return e?e.running>0?e.running===1?"1 subagent running":`${e.running} subagents running`:e.settled===1?"1 subagent":`${e.settled} subagents`:""}function Oa(e){return e?e.total===1?"1 todo":`${e.total} todos`:""}function Rt(e,s){const a=[],n=X(e.completed_at??e.target_date,s);n&&a.push({key:e.completed_at?"completed":"target",text:e.completed_at?`completed ${n}`:`due ${n}`});const r=Mt(e.estimate,e.estimate_unit);r&&a.push({key:"estimate",text:r});const i=$t(e.milestones_completed,e.milestones_total);i&&a.push({key:"milestones",text:`milestones ${i}`});const l=We(e.live_sessions);return l&&a.push({key:"live",text:l}),a}const me=864e5,Pa=/^(\d{4})-(\d{2})-(\d{2})$/;function ne(e){if(!e)return null;const s=Pa.exec(e);if(!s)return null;const a=Number(s[1]),n=Number(s[2]),r=Number(s[3]),i=Date.UTC(a,n-1,r),l=new Date(i);return l.getUTCFullYear()!==a||l.getUTCMonth()!==n-1||l.getUTCDate()!==r?null:i}const Re=["planning","active","qa","validation","done"],Le=["paused","archived"],Ee=[{value:"24h",label:"Last 24 hours",phrase:"the last 24 hours",seconds:86400},{value:"7d",label:"Last 7 days",phrase:"the last 7 days",seconds:604800},{value:"30d",label:"Last 30 days",phrase:"the last 30 days",seconds:2592e3},{value:"90d",label:"Last 90 days",phrase:"the last 90 days",seconds:7776e3},{value:"all",label:"All time",phrase:null,seconds:null}],Lt="7d",Aa=Ee.find(e=>e.value===Lt);function It(e){return Ee.find(s=>s.value===e)??Aa}function Ma(e){return Ee.some(s=>s.value===e)}function $a(e,s,a){const n=It(s);return n.seconds===null?e:e.filter(r=>a/1e3-r.updated_at<=n.seconds)}function Ra(e){const s=It(e);return s.seconds===null?null:`Nothing changed in ${s.phrase}.`}const Ft="projects-board-window";function La(){try{const e=localStorage.getItem(Ft);if(e!==null&&Ma(e))return e}catch{}return Lt}function rt(e){try{localStorage.setItem(Ft,e)}catch{}}const Ut="projects-board-column-order";let Ie=null;function Ia(){if(Ie)return[...Ie];try{const e=localStorage.getItem(Ut);if(!e)return[];const s=JSON.parse(e);if(!Array.isArray(s))return[];const a=[];for(const n of s){if(typeof n!="string"||n.length===0)return[];a.includes(n)||a.push(n)}return a}catch{return[]}}function Fa(e){Ie=[...e];try{localStorage.setItem(Ut,JSON.stringify(e))}catch{}}function Ua(e,s,a){const n=e.filter(i=>i!==s),r=Math.max(0,Math.min(a,n.length));return n.splice(r,0,s),n}function Ba(e,s=[]){const a=new Map;for(const o of e){const m=a.get(o.status)??[];m.push(o),a.set(o.status,m)}const n=Re.map(o=>({status:o,projects:a.get(o)??[]}));for(const o of Le){const m=a.get(o)??[];m.length>0&&n.push({status:o,projects:m})}for(const[o,m]of a)!Le.includes(o)&&!Re.includes(o)&&n.push({status:o,projects:m});if(s.length===0)return n;const r=new Map(s.map((o,m)=>[o,m])),i=n.filter(o=>r.has(o.status));i.sort((o,m)=>(r.get(o.status)??0)-(r.get(m.status)??0));const l=n.filter(o=>!r.has(o.status));return[...i,...l]}function Ya(e,s){if(e.status==="done"||e.status==="archived"||e.completed_at)return!1;const a=ne(e.target_date);return a===null?!1:a<s}function le(e){return e.title||e.name}function qa(e,s){const a=[];for(const n of[e,s]){const r=n?.trim();r&&!a.includes(r)&&a.push(r)}return a.join(" · ")}const ze="No team";function Ke(e){const s=e.team?.trim();if(s)return s;const a=e.owner?.trim();return a||null}function Qe(e,s){const a=new Map,n=[];for(const i of e){const l=s(i);if(l===null){n.push(i);continue}const o=a.get(l);o?o.push(i):a.set(l,[i])}const r=[...a.entries()].sort(([i],[l])=>i.localeCompare(l,void 0,{sensitivity:"base"})).map(([i,l])=>({team:i,items:l}));return n.length>0&&r.push({team:null,items:n}),r}function He(e){return e.title||e.session_id}function Wa(e){return[...e].reverse()}function za(e){return e<=0?"":e===1?"1 update":`${e} updates`}const it=e=>String(e).padStart(2,"0");function Fe(e){return`${e.getFullYear()}-${it(e.getMonth()+1)}-${it(e.getDate())}`}function Ka(e){const s=Date.parse(e);return Number.isNaN(s)?"":Fe(new Date(s))}function Qa(e,s,a=new Date){if(!e)return"";if(e===Fe(a))return"Today";const n=new Date(a.getFullYear(),a.getMonth(),a.getDate()-1);return e===Fe(n)?"Yesterday":X(e,s,a)}function Ha(e,s){const a=Date.parse(e);return Number.isNaN(a)?"":new Date(a).toLocaleTimeString(s,{hour:"numeric",minute:"2-digit"})}function Ga(e,s){const a=Date.parse(e);return Number.isNaN(a)?"":fe(he(a/1e3,s))}function Va(e,s,a=Date.now()){const n=[],r=At(e.by);r&&n.push({key:"author",text:r});const i=Ha(e.at,s);i&&n.push({key:"time",text:i});const l=Ga(e.at,a);return l&&n.push({key:"age",text:l}),n}function Xa(e,s,a=new Date){const n=[];for(const r of Wa(e)){const i=Ka(r.at),l=n[n.length-1];if(l&&l.key===i){l.entries.push(r);continue}n.push({key:i,label:Qa(i,s,a),entries:[r]})}return n}function Ja(e){return!Number.isFinite(e)||e<0?"":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} KB`:`${e} B`}function Za(e,s){return s<=0?"":`${e} of ${s} complete`}function en(e){let s=0,a=0,n=!1;for(const r of e)r.todos&&(n=!0,s+=r.todos.open,a+=r.todos.total);return n?{open:s,total:a}:null}function ot(e){return`${e.open} open of ${e.total}`}function tn(e){const s=e.filter(n=>n.exists);return(s.find(n=>n.runtime?.state==="live")??s[0])?.session_id??null}function sn(e){const s=le(e),a=e.progress.trim()||"not reported yet";return[`Continue work on project "${s}" (${e.name}).`,`Latest progress: ${a}`,"Review the project details and continue or complete the work."].join(`
|
|
17
|
-
`)}function an(e){return e?e.kind==="team"?`team ${e.name}`:`agent ${e.name}`:""}const lt="complete them, or pass force_done=true to close with them open",nn="complete or remove the incomplete milestones, then mark it done";function Bt(e){return e.includes(lt)?e.replace(lt,nn):e}const rn="Shows projects last updated within this window; older ones are hidden.",on=({value:e,onChange:s})=>t.jsxs(je,{value:e,onValueChange:a=>s(a),children:[t.jsx(St,{content:e==="all"?null:rn,side:"bottom",disableHoverableContent:!0,children:t.jsx(be,{"aria-label":"Projects updated within",className:R("w-36 shrink-0"),"data-tour-tag":"projects-board-window",children:t.jsx(ve,{})})}),t.jsx(ye,{children:Ee.map(a=>t.jsx(ue,{value:a.value,children:a.label},a.value))})]}),te=["day","week","month","quarter"],Ge={day:24,week:9,month:3,quarter:1};function Yt(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function ae(e,s){return Math.round((s-e)/me)}function ct(e,s){return ae(e,s)+1}function ln(e,s){for(const a of te)if(e*Ge[a]<=s)return a;return te[te.length-1]}function cn(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(a=>!!a.target_date)}function dn(e,s){const a=[s];for(const n of e){for(const r of[n.project.start_date,n.project.target_date,n.project.completed_at]){const i=ne(r);i!==null&&a.push(i)}for(const r of n.milestones){const i=ne(r.target_date);i!==null&&a.push(i)}}return a.length===1?null:{startMs:Math.min(...a),endMs:Math.max(...a)}}function un(e){const s=[],a=[];for(const n of e)(cn(n)?s:a).push(n);return{dated:s,undated:a}}function mn(e){const{project:s}=e,a=ne(s.start_date),n=ne(s.target_date),r=ne(s.completed_at),i=s.status==="done"&&r!==null?r:n,l=a??i,o=i??a;return l===null||o===null?null:{fromMs:Math.min(l,o),toMs:Math.max(l,o)}}function hn(e){const s=[];for(const a of e.milestones){const n=ne(a.target_date);n!==null&&s.push({name:a.name,dayMs:n,status:a.status})}return s}const xe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function K(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function fn(e){const{year:s,month:a}=K(e);return Date.UTC(s,a-1,1)}function pn(e){const{year:s,month:a}=K(e);return a===12?Date.UTC(s+1,0,1):Date.UTC(s,a,1)}function xn(e){const{year:s,month:a}=K(e);return Date.UTC(s,Math.floor((a-1)/3)*3,1)}function gn(e){const{year:s,month:a}=K(e),n=Math.floor((a-1)/3);return n===3?Date.UTC(s+1,0,1):Date.UTC(s,n*3+3,1)}function jn(e){const{weekday:s}=K(e);return e-(s+6)%7*me}const bn=26;function vn(e,s,a){const n=[],r=(d,b,f)=>{d<e||d>s||n.push({dayMs:d,label:b,major:f})};if(a==="day"){let d=!1;for(let b=e;b<=s;b+=me){const{day:f,month:u}=K(b);f===1?(r(b,xe[u-1],!0),d=!0):d?(r(b,"",!1),d=!1):r(b,String(f),!1)}return n}if(a==="week"){for(let d=jn(e);d<=s;d+=7*me){if(d<e)continue;const{day:b,month:f}=K(d);K(d-7*me).month!==f?r(d,`${xe[f-1]} ${b}`,!0):r(d,String(b),!1)}return n}const i=a==="month"?fn:xn,l=a==="month"?pn:gn,o=d=>{const{year:b,month:f}=K(d);if(a==="month")return f===1&&b!==K(e).year?`${xe[0]} '${String(b%100).padStart(2,"0")}`:xe[f-1];const u=Math.floor((f-1)/3)+1;return u===1&&b!==K(e).year?`Q1 '${String(b%100).padStart(2,"0")}`:`Q${u}`};r(e,o(i(e)),!0);const m=Math.ceil(bn/Ge[a]);let h=e;for(let d=l(i(e));d<=s;d=l(d))ae(h,d)<m||(r(d,o(d),!0),h=d);return n}const dt={active:"In flight",paused:"On hold",done:"Finished"};function yn(){const[e,s]=x.useState(null);return x.useEffect(()=>{if(!e)return;const a=document.querySelector(`[data-project-menu="${e}"]`);a&&(a.focus(),s(null))}),x.useCallback(a=>s(a),[])}const kn=4,Ae="Drag the header, or press the arrow keys, to move this column.",ut="board-column-move-hint",Nn=({projects:e,nowMs:s,onOpen:a,onEdit:n,onDelete:r,onMove:i,movingKeys:l=[]})=>{const[o,m]=x.useState(Ia),h=Ba(e,o),d=Qe(e,Ke),[b,f]=x.useState(null),[u,w]=x.useState(""),N=x.useRef(null),g=x.useRef(null),v=x.useRef(null),c=x.useRef(null),_=x.useRef(null),A=new Set(l),D=(j,y)=>{const S=Ua(h.map(P=>P.status),j,y);m(S),Fa(S),w(`Moved ${W(j).label} column to position ${S.indexOf(j)+1} of ${S.length}.`)},M=(j,y)=>{const S=N.current;if(!S)return 0;let P=0;const I=S.querySelectorAll("[data-board-column]");for(const U of I){if(U.dataset.boardColumn===y)continue;const Z=U.getBoundingClientRect();j>(Z.left+Z.right)/2&&(P+=1)}return P},B=(j,y)=>{const S=h.filter(U=>U.status!==j),P=S[y-1]?.status,I=S[y]?.status;return P&&I?`between ${W(P).label} and ${W(I).label}`:I?`before ${W(I).label}`:P?`after ${W(P).label}`:"in place"},Q=(j,y)=>{const S=M(j,y.status);S!==y.over&&(y.over=S,f({status:y.status,over:S}),w(`Moving ${W(y.status).label} column; it will drop ${B(y.status,S)}.`))},C=()=>{c.current!==null&&(cancelAnimationFrame(c.current),c.current=null)},O=32,p=12,$=()=>{c.current=null;const j=_.current,y=N.current,S=v.current;if(!j?.armed||!y||S===null)return;const P=y.getBoundingClientRect(),I=y.scrollWidth-y.clientWidth;let U=0;if(S-P.left<O&&y.scrollLeft>0?U=-1:P.right-S<O&&y.scrollLeft<I&&(U=1),U!==0){const Z=y.scrollLeft;y.scrollLeft=Z+U*p,y.scrollLeft!==Z&&Q(S,j)}else Q(S,j);G(j.status,j.over),c.current=requestAnimationFrame($)};x.useEffect(()=>()=>{c.current!==null&&cancelAnimationFrame(c.current)},[]);const E=(j,y)=>{if(j.button===0){try{j.currentTarget.setPointerCapture(j.pointerId)}catch{}_.current={pointerId:j.pointerId,status:y,startX:j.clientX,startY:j.clientY,armed:!1,over:h.findIndex(S=>S.status===y)},v.current=j.clientX}},T=j=>{const y=_.current;if(!(!y||j.pointerId!==y.pointerId)){if(v.current=j.clientX,!y.armed){if(Math.hypot(j.clientX-y.startX,j.clientY-y.startY)<kn)return;y.armed=!0,f({status:y.status,over:y.over}),w(`Moving ${W(y.status).label} column.`),c.current===null&&(c.current=requestAnimationFrame($))}Q(j.clientX,y)}},F=j=>{const y=_.current;if(_.current=null,C(),f(null),!y?.armed)return;if(!j){w("Move cancelled.");return}const S=h.findIndex(P=>P.status===y.status);if(y.over===S){w("");return}D(y.status,y.over)},k=j=>{const y=_.current;!y||j.pointerId!==y.pointerId||F(!0)},Y=()=>{F(!1)};x.useEffect(()=>{if(!b)return;const j=y=>{y.key==="Escape"&&F(!1)};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[b!==null]);const G=x.useCallback((j,y)=>{const S=N.current,P=g.current;if(!S||!P)return;const I=S.getBoundingClientRect(),U=[];for(const Xe of S.querySelectorAll("[data-board-column]"))Xe.dataset.boardColumn!==j&&U.push(Xe.getBoundingClientRect());const Z=6,Vt=y>=U.length?(U[U.length-1]?.right??I.left)+Z:(U[y]?.left??I.right)-Z,Oe=S.scrollLeft,Xt=2,Jt=Vt-I.left+Oe,Ve=Oe+1,Zt=Oe+I.width-Xt-1,es=Math.round(Math.min(Math.max(Jt,Ve),Math.max(Ve,Zt)));P.style.left=`${es}px`},[]);x.useLayoutEffect(()=>{b&&G(b.status,b.over)},[b,G]);const J=(j,y)=>{if(j.key==="Enter"||j.key===" "){j.preventDefault(),w(Ae);return}if(j.key!=="ArrowLeft"&&j.key!=="ArrowRight")return;j.preventDefault();const S=h.map(U=>U.status),P=S.indexOf(y),I=j.key==="ArrowLeft"?P-1:P+1;if(I<0||I>=S.length){w(`${W(y).label} column is already ${I<0?"the first column":"the last column"}.`);return}D(y,I)};return t.jsxs("div",{className:"[container-type:size] flex min-h-0 flex-1 flex-col","data-testid":"project-board",children:[t.jsx("output",{"aria-live":"polite",className:"sr-only","data-board-column-announcement":"",children:u}),t.jsx("span",{id:ut,className:"sr-only",children:Ae}),t.jsxs("div",{ref:N,"data-board-strip":"",className:R("relative flex min-h-0 flex-1 items-start overflow-auto px-9 pb-9",b&&"cursor-grabbing select-none"),children:[b&&t.jsx("div",{ref:g,"aria-hidden":"true","data-board-drop-indicator":"",className:"pointer-events-none absolute top-3 bottom-3 w-0.5 rounded-full bg-accent"}),t.jsxs("div",{className:"flex w-max flex-col",children:[t.jsx("div",{className:"sticky top-0 z-30 flex gap-3",children:h.map(j=>{const y=W(j.status);return t.jsxs("header",{"data-board-column":j.status,"data-board-column-handle":j.status,onPointerDown:S=>E(S,j.status),onPointerMove:T,onPointerUp:k,onPointerCancel:Y,className:R("flex h-11 w-64 shrink-0 cursor-grab items-center justify-between gap-2 rounded-t-md bg-sunken px-3 active:cursor-grabbing",b?.status===j.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(L,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":j.status,"aria-label":`Move ${y.label} column`,"aria-describedby":ut,title:Ae,className:"-ml-1.5 cursor-grab text-ink-muted active:cursor-grabbing",onKeyDown:S=>J(S,j.status),children:t.jsx(Is,{"aria-hidden":"true"})}),t.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[t.jsx("span",{className:"truncate text-body-sm font-medium text-ink",children:y.label}),dt[j.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:dt[j.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:j.projects.length})]},j.status)})}),d.map(j=>t.jsxs("section",{className:"flex flex-col",children:[t.jsx("div",{"data-board-team":j.team??"",className:"sticky top-11 z-20 flex h-8 items-center bg-canvas px-3 text-meta",children:t.jsxs("span",{className:"sticky left-3 flex min-w-0 max-w-[calc(100cqw-2.25rem)] items-center gap-2",children:[t.jsx("span",{className:"truncate text-ink",children:j.team??ze}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:j.items.length})]})}),t.jsx("div",{className:"flex gap-3 rounded-md bg-sunken py-2",children:h.map(y=>{const S=j.items.filter(P=>P.status===y.status);return t.jsx("div",{"data-board-cell":y.status,className:"flex max-h-[calc(100cqh-92px)] w-64 shrink-0 flex-col gap-2 overflow-y-auto px-2",children:S.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:S.map(P=>t.jsx("li",{children:t.jsx(wn,{project:P,nowMs:s,busy:A.has(P.id),onOpen:()=>a(P),onEdit:()=>n(P),onDelete:()=>r(P),onMove:I=>i(P,I)})},P.id))})},y.status)})})]},j.team??""))]})]})]})},wn=({project:e,nowMs:s,busy:a,onOpen:n,onEdit:r,onDelete:i,onMove:l})=>{const o=Rt(e,typeof navigator>"u"?void 0:navigator.language),m=le(e),h=x.useRef(null),[d,b]=x.useState(!1);x.useEffect(()=>{const g=h.current;if(!g)return;const v=()=>{g.isConnected&&b(g.scrollWidth-g.clientWidth>.5)},c=requestAnimationFrame(v),_=new ResizeObserver(v);return _.observe(g),document.fonts?.ready.then(v).catch(()=>{}),()=>{cancelAnimationFrame(c),_.disconnect()}},[m,d]);const f=Ya(e,Yt(s)),u=he(e.progress_updated_at,s),w=()=>{const g=window.getSelection();g&&!g.isCollapsed||n()},N=g=>{g.key!=="Enter"&&g.key!==" "||g.target===g.currentTarget&&(g.preventDefault(),n())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":`Open ${m}`,onClick:w,onKeyDown:N,className:R("group/card flex flex-col gap-2 rounded-sm bg-surface p-3","transition-colors duration-fast ease-out-quart hover:bg-elevated",f&&"border border-warning-border"),children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx(St,{content:d?m:null,side:"top",disableHoverableContent:!0,children:t.jsx("span",{ref:h,"data-project-title":e.name,tabIndex:d?0:void 0,className:"block truncate text-body-sm font-medium text-ink",children:m})}),e.title&&t.jsx("span",{className:"mt-0.5 block truncate text-meta text-ink-muted",children:e.name}),e.description&&t.jsx("span",{className:"mt-0.5 block truncate text-meta text-ink-muted",children:e.description})]}),t.jsxs(js,{children:[t.jsx(bs,{"data-project-menu":e.id,"aria-label":`Actions for ${m}`,disabled:a,onClick:g=>g.stopPropagation(),className:R("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:t.jsx(Fs,{className:"size-4"})}),t.jsxs(vs,{align:"end",onClick:g=>g.stopPropagation(),children:[t.jsx(Pe,{onSelect:n,children:"Open"}),t.jsxs(ys,{children:[t.jsx(ks,{children:"Set status"}),t.jsx(Ns,{children:t.jsx(ws,{value:e.status,onValueChange:l,children:[...Re,...Le].map(g=>t.jsx(Ss,{value:g,children:W(g).label},g))})})]}),t.jsx(Ts,{}),t.jsx(Pe,{onSelect:r,children:"Edit"}),t.jsx(Pe,{onSelect:i,children:"Delete"})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[o.filter(g=>g.key!=="live").map(g=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:g.text},g.key)),f&&t.jsx(re,{variant:"warning",children:"Overdue"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-meta text-ink-muted",children:Sa(u)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(e.progress_stale||!u)&&t.jsx("span",{"aria-label":Ne,title:Ne,className:"size-1.5 rounded-full bg-warning"}),e.sessions>0&&t.jsx(Sn,{project:e})]})]})]})},Sn=({project:e})=>{const[s,a]=x.useState(!1),n=Te(),r=Ct(e.id,s),i=r.data?.links??[],l=Da(e),o=le(e);return t.jsxs(_s,{open:s,onOpenChange:a,children:[t.jsx(Ds,{"data-project-sessions":e.id,"aria-label":`Sessions linked to ${o}`,onClick:m=>m.stopPropagation(),className:R("rounded-sm px-1 text-meta whitespace-nowrap",e.live_sessions>0?"text-success hover:bg-sunken":"text-ink-muted hover:bg-sunken"),children:l}),t.jsx(Cs,{align:"end",className:"w-64 p-2 outline-none",onClick:m=>m.stopPropagation(),children:r.isLoading?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:"Loading linked sessions…"}):r.isError?t.jsxs("div",{className:"flex flex-col items-start gap-1.5 px-1 py-2",children:[t.jsx("p",{className:"text-meta text-ink-muted",children:r.error instanceof Error&&r.error.message?r.error.message:"The linked sessions could not be read."}),t.jsx(L,{variant:"secondary",size:"sm",onClick:()=>void r.refetch(),children:"Try again"})]}):i.length===0?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:"No sessions linked yet."}):t.jsx("ul",{className:"flex flex-col",children:i.map(m=>t.jsx("li",{children:t.jsx("button",{type:"button",disabled:!m.exists,onClick:()=>{m.exists&&(a(!1),_t(n,m.session_id))},className:R("flex w-full items-center gap-2 rounded-sm px-1 py-1.5 text-left text-meta",m.exists?"text-ink hover:bg-elevated":"text-ink-disabled"),children:t.jsx("span",{className:"truncate",children:m.title||m.session_id})})},m.session_id))})})]})},qt=({open:e,projectName:s,onClose:a,onConfirm:n})=>{const[r,i]=x.useState(""),[l,o]=x.useState(null),[m,h]=x.useState(!1),d=x.useId();x.useEffect(()=>{e&&(i(""),o(null),h(!1))},[e]);const b=r.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,f=async()=>{h(!0),o(null);try{await n(r.trim()),a()}catch(u){o(u instanceof Error&&u.message?u.message:"The project was not deleted.")}finally{h(!1)}};return t.jsx(_e,{open:e,onClose:a,title:"Delete this project?",dataTourTag:"project-delete-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(De,{onClick:a,disabled:m,children:"Cancel"}),t.jsxs(Us,{onClick:()=>void f(),disabled:!b||m,children:[m&&t.jsx(de,{size:"xs"}),"Delete project"]})]}),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"text-body-sm text-ink",children:"This deletes the project and its milestones. The sessions linked to it are not touched."}),t.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Type"," ",t.jsx("span",{className:"font-mono text-mono-sm text-ink",children:s})," ","to confirm."]}),t.jsx(z,{id:`${d}-confirm`,value:r,onChange:u=>i(u.target.value),placeholder:s,"aria-label":"Type the project name to confirm","aria-invalid":r.length>0&&!b,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})},Tn=/^(https?:|mailto:)/i,_n={a:({href:e,children:s})=>typeof e=="string"&&Tn.test(e)?t.jsx("a",{href:e,target:"_blank",rel:"noreferrer",children:s}):t.jsx("span",{className:"font-mono text-mono-sm",children:s})},we=x.memo(({children:e,className:s})=>t.jsx("div",{className:R("lo-markdown",s),children:t.jsx(Bs,{remarkPlugins:[Ys],components:_n,children:e})})),mt=`## Summary
|
|
16
|
+
*/const ma=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],ha=qe("unlink",ma),Ce={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function fa(e){return Nt({queryKey:Ce.list,enabled:e,queryFn:()=>H({op:"projects.list"}).then(s=>s.projects),retry:Ye,staleTime:1e4})}function pa(e,s){return oa({queries:e.map(a=>({queryKey:Ce.detail(a),enabled:s&&!!a,queryFn:()=>H({op:"projects.get",key:a}),retry:Ye,staleTime:1e4}))})}function Ct(e,s){return Nt({queryKey:Ce.detail(e??""),enabled:s&&!!e,queryFn:()=>H({op:"projects.get",key:e??""}),retry:Ye,staleTime:1e4})}function oe(){const e=kt();return()=>{e.invalidateQueries({queryKey:Ce.list})}}function xa(){const e=oe();return ie({mutationFn:s=>H({op:"projects.create",name:s.name,...s.description!==void 0?{description:s.description}:{},...s.status!==void 0?{status:s.status}:{},...s.tags!==void 0?{tags:s.tags}:{}}),onSuccess:()=>e()})}function Et(){const e=oe();return ie({mutationFn:s=>H({op:"projects.update",key:s.key,fields:s.fields}),onSuccess:()=>e()})}function Ot(){const e=oe();return ie({mutationFn:s=>H({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function ga(){const e=oe();return ie({mutationFn:s=>H({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function ja(){const e=oe();return ie({mutationFn:s=>H({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function ba(){const e=oe();return ie({mutationFn:s=>H({op:"projects.milestone",key:s.key,name:s.name,...s.targetDate!==void 0?{targetDate:s.targetDate}:{},...s.completed!==void 0?{completed:s.completed}:{}}),onSuccess:()=>e()})}function va(){const e=oe();return ie({mutationFn:s=>H({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>e()})}const ya={planning:{label:"Planning",variant:"info"},active:{label:"Active",variant:"accent"},qa:{label:"QA",variant:"attention"},validation:{label:"Validation",variant:"warning"},done:{label:"Done",variant:"success"},paused:{label:"Paused",variant:"neutral"},archived:{label:"Archived",variant:"outline"}};function W(e){return ya[e]??{label:e||"Unknown",variant:"neutral"}}function ka(e){return e==="done"}const Na={completed:{label:"Completed",variant:"success"},overdue:{label:"Overdue",variant:"warning"},upcoming:{label:"Upcoming",variant:"neutral"}};function wa(e){return Na[e]??{label:String(e),variant:"neutral"}}const Ne="Stale",Sa=/^(\d{4})-(\d{2})-(\d{2})$/;function X(e,s,a=new Date){if(!e)return"";const n=Sa.exec(e);if(!n)return e;const r=new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));if(Number.isNaN(r.getTime()))return e;const i=r.toLocaleDateString(s,{month:"short",day:"numeric"});return r.getFullYear()===a.getFullYear()?i:`${i}, ${r.getFullYear()}`}function he(e,s){if(e==null)return"";const a=Math.max(0,Math.floor(s/1e3-e));return a<60?"just now":a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function fe(e){return e==="just now"?"just now":`${e} ago`}function Ta(e){return e?`reported ${fe(e)}`:"no progress"}const Mt=/^$|^\d{4}-\d{2}-\d{2}$/;function Pt(e){return e?e==="operator"?"the operator":`session ${e}`:""}function _a(e,s){if(!e.progress)return"not reported yet";const a=he(e.progress_updated_at,s),n=Pt(e.progress_reported_by),r=[a?`reported ${fe(a)}`:"reported"];return n&&r.push(`by ${n}`),r.join(" ")}function At(e,s){if(e==null)return"";const a=String(e);return s==="points"?`${a} pt`:s==="days"?`${a}d`:a}function $t(e,s){return s<=0?"":`${e}/${s}`}function We(e){return e<=0?"":`${e} live`}function Da(e){return e<=0?"":e===1?"1 session":`${e} sessions`}function Ca(e){const s=Da(e.sessions);if(!s)return"";const a=We(e.live_sessions);return a?`${s} · ${a}`:s}function Ea(e){if(!e.exists)return{label:"Missing",variant:"outline"};if(e.archived)return{label:"Archived",variant:"neutral"};switch(e.runtime?.state){case"live":return{label:"Live",variant:"success"};case"wedged":return{label:"Wedged",variant:"warning"};case"stale":return{label:"Stale",variant:"warning"};case"stopped":return{label:"Stopped",variant:"neutral"};default:return{label:String(e.runtime?.state??"Unknown"),variant:"neutral"}}}function Oa(e){return e?e.running>0?e.running===1?"1 subagent running":`${e.running} subagents running`:e.settled===1?"1 subagent":`${e.settled} subagents`:""}function Ma(e){return e?e.total===1?"1 todo":`${e.total} todos`:""}function Rt(e,s){const a=[],n=X(e.completed_at??e.target_date,s);n&&a.push({key:e.completed_at?"completed":"target",text:e.completed_at?`completed ${n}`:`due ${n}`});const r=At(e.estimate,e.estimate_unit);r&&a.push({key:"estimate",text:r});const i=$t(e.milestones_completed,e.milestones_total);i&&a.push({key:"milestones",text:`milestones ${i}`});const l=We(e.live_sessions);return l&&a.push({key:"live",text:l}),a}const me=864e5,Pa=/^(\d{4})-(\d{2})-(\d{2})$/;function ne(e){if(!e)return null;const s=Pa.exec(e);if(!s)return null;const a=Number(s[1]),n=Number(s[2]),r=Number(s[3]),i=Date.UTC(a,n-1,r),l=new Date(i);return l.getUTCFullYear()!==a||l.getUTCMonth()!==n-1||l.getUTCDate()!==r?null:i}const Re=["planning","active","qa","validation","done"],Le=["paused","archived"],Ee=[{value:"24h",label:"Last 24 hours",phrase:"the last 24 hours",seconds:86400},{value:"7d",label:"Last 7 days",phrase:"the last 7 days",seconds:604800},{value:"30d",label:"Last 30 days",phrase:"the last 30 days",seconds:2592e3},{value:"90d",label:"Last 90 days",phrase:"the last 90 days",seconds:7776e3},{value:"all",label:"All time",phrase:null,seconds:null}],Lt="7d",Aa=Ee.find(e=>e.value===Lt);function It(e){return Ee.find(s=>s.value===e)??Aa}function $a(e){return Ee.some(s=>s.value===e)}function Ra(e,s,a){const n=It(s);return n.seconds===null?e:e.filter(r=>a/1e3-r.updated_at<=n.seconds)}function La(e){const s=It(e);return s.seconds===null?null:`Nothing changed in ${s.phrase}.`}const Ft="projects-board-window";function Ia(){try{const e=localStorage.getItem(Ft);if(e!==null&&$a(e))return e}catch{}return Lt}function rt(e){try{localStorage.setItem(Ft,e)}catch{}}const Ut="projects-board-column-order";let Ie=null;function Fa(){if(Ie)return[...Ie];try{const e=localStorage.getItem(Ut);if(!e)return[];const s=JSON.parse(e);if(!Array.isArray(s))return[];const a=[];for(const n of s){if(typeof n!="string"||n.length===0)return[];a.includes(n)||a.push(n)}return a}catch{return[]}}function Ua(e){Ie=[...e];try{localStorage.setItem(Ut,JSON.stringify(e))}catch{}}function Ba(e,s,a){const n=e.filter(i=>i!==s),r=Math.max(0,Math.min(a,n.length));return n.splice(r,0,s),n}function Ya(e,s=[]){const a=new Map;for(const o of e){const m=a.get(o.status)??[];m.push(o),a.set(o.status,m)}const n=Re.map(o=>({status:o,projects:a.get(o)??[]}));for(const o of Le){const m=a.get(o)??[];m.length>0&&n.push({status:o,projects:m})}for(const[o,m]of a)!Le.includes(o)&&!Re.includes(o)&&n.push({status:o,projects:m});if(s.length===0)return n;const r=new Map(s.map((o,m)=>[o,m])),i=n.filter(o=>r.has(o.status));i.sort((o,m)=>(r.get(o.status)??0)-(r.get(m.status)??0));const l=n.filter(o=>!r.has(o.status));return[...i,...l]}function qa(e,s){if(e.status==="done"||e.status==="archived"||e.completed_at)return!1;const a=ne(e.target_date);return a===null?!1:a<s}function le(e){return e.title||e.name}function Wa(e,s){const a=[];for(const n of[e,s]){const r=n?.trim();r&&!a.includes(r)&&a.push(r)}return a.join(" · ")}const ze="No team";function Ke(e){const s=e.team?.trim();if(s)return s;const a=e.owner?.trim();return a||null}function Qe(e,s){const a=new Map,n=[];for(const i of e){const l=s(i);if(l===null){n.push(i);continue}const o=a.get(l);o?o.push(i):a.set(l,[i])}const r=[...a.entries()].sort(([i],[l])=>i.localeCompare(l,void 0,{sensitivity:"base"})).map(([i,l])=>({team:i,items:l}));return n.length>0&&r.push({team:null,items:n}),r}function He(e){return e.title||e.session_id}function za(e){return[...e].reverse()}function Ka(e){return e<=0?"":e===1?"1 update":`${e} updates`}const it=e=>String(e).padStart(2,"0");function Fe(e){return`${e.getFullYear()}-${it(e.getMonth()+1)}-${it(e.getDate())}`}function Qa(e){const s=Date.parse(e);return Number.isNaN(s)?"":Fe(new Date(s))}function Ha(e,s,a=new Date){if(!e)return"";if(e===Fe(a))return"Today";const n=new Date(a.getFullYear(),a.getMonth(),a.getDate()-1);return e===Fe(n)?"Yesterday":X(e,s,a)}function Ga(e,s){const a=Date.parse(e);return Number.isNaN(a)?"":new Date(a).toLocaleTimeString(s,{hour:"numeric",minute:"2-digit"})}function Va(e,s){const a=Date.parse(e);return Number.isNaN(a)?"":fe(he(a/1e3,s))}function Xa(e,s,a=Date.now()){const n=[],r=Pt(e.by);r&&n.push({key:"author",text:r});const i=Ga(e.at,s);i&&n.push({key:"time",text:i});const l=Va(e.at,a);return l&&n.push({key:"age",text:l}),n}function Ja(e,s,a=new Date){const n=[];for(const r of za(e)){const i=Qa(r.at),l=n[n.length-1];if(l&&l.key===i){l.entries.push(r);continue}n.push({key:i,label:Ha(i,s,a),entries:[r]})}return n}function Za(e){return!Number.isFinite(e)||e<0?"":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} KB`:`${e} B`}function en(e,s){return s<=0?"":`${e} of ${s} complete`}function tn(e){let s=0,a=0,n=!1;for(const r of e)r.todos&&(n=!0,s+=r.todos.open,a+=r.todos.total);return n?{open:s,total:a}:null}function ot(e){return`${e.open} open of ${e.total}`}function sn(e){const s=e.filter(n=>n.exists);return(s.find(n=>n.runtime?.state==="live")??s[0])?.session_id??null}function an(e){const s=le(e),a=e.progress.trim()||"not reported yet";return[`Continue work on project "${s}" (${e.name}).`,`Latest progress: ${a}`,"Review the project details and continue or complete the work."].join(`
|
|
17
|
+
`)}function nn(e){return e?e.kind==="team"?`team ${e.name}`:`agent ${e.name}`:""}const lt="complete them, or pass force_done=true to close with them open",rn="complete or remove the incomplete milestones, then mark it done";function Bt(e){return e.includes(lt)?e.replace(lt,rn):e}const on="Shows projects last updated within this window; older ones are hidden.",ln=({value:e,onChange:s})=>t.jsxs(je,{value:e,onValueChange:a=>s(a),children:[t.jsx(St,{content:e==="all"?null:on,side:"bottom",disableHoverableContent:!0,children:t.jsx(be,{"aria-label":"Projects updated within",className:R("w-36 shrink-0"),"data-tour-tag":"projects-board-window",children:t.jsx(ve,{})})}),t.jsx(ye,{children:Ee.map(a=>t.jsx(ue,{value:a.value,children:a.label},a.value))})]}),te=["day","week","month","quarter"],Ge={day:24,week:9,month:3,quarter:1};function Yt(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function ae(e,s){return Math.round((s-e)/me)}function ct(e,s){return ae(e,s)+1}function cn(e,s){for(const a of te)if(e*Ge[a]<=s)return a;return te[te.length-1]}function dn(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(a=>!!a.target_date)}function un(e,s){const a=[s];for(const n of e){for(const r of[n.project.start_date,n.project.target_date,n.project.completed_at]){const i=ne(r);i!==null&&a.push(i)}for(const r of n.milestones){const i=ne(r.target_date);i!==null&&a.push(i)}}return a.length===1?null:{startMs:Math.min(...a),endMs:Math.max(...a)}}function mn(e){const s=[],a=[];for(const n of e)(dn(n)?s:a).push(n);return{dated:s,undated:a}}function hn(e){const{project:s}=e,a=ne(s.start_date),n=ne(s.target_date),r=ne(s.completed_at),i=s.status==="done"&&r!==null?r:n,l=a??i,o=i??a;return l===null||o===null?null:{fromMs:Math.min(l,o),toMs:Math.max(l,o)}}function fn(e){const s=[];for(const a of e.milestones){const n=ne(a.target_date);n!==null&&s.push({name:a.name,dayMs:n,status:a.status})}return s}const xe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function K(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function pn(e){const{year:s,month:a}=K(e);return Date.UTC(s,a-1,1)}function xn(e){const{year:s,month:a}=K(e);return a===12?Date.UTC(s+1,0,1):Date.UTC(s,a,1)}function gn(e){const{year:s,month:a}=K(e);return Date.UTC(s,Math.floor((a-1)/3)*3,1)}function jn(e){const{year:s,month:a}=K(e),n=Math.floor((a-1)/3);return n===3?Date.UTC(s+1,0,1):Date.UTC(s,n*3+3,1)}function bn(e){const{weekday:s}=K(e);return e-(s+6)%7*me}const vn=26;function yn(e,s,a){const n=[],r=(d,b,f)=>{d<e||d>s||n.push({dayMs:d,label:b,major:f})};if(a==="day"){let d=!1;for(let b=e;b<=s;b+=me){const{day:f,month:u}=K(b);f===1?(r(b,xe[u-1],!0),d=!0):d?(r(b,"",!1),d=!1):r(b,String(f),!1)}return n}if(a==="week"){for(let d=bn(e);d<=s;d+=7*me){if(d<e)continue;const{day:b,month:f}=K(d);K(d-7*me).month!==f?r(d,`${xe[f-1]} ${b}`,!0):r(d,String(b),!1)}return n}const i=a==="month"?pn:gn,l=a==="month"?xn:jn,o=d=>{const{year:b,month:f}=K(d);if(a==="month")return f===1&&b!==K(e).year?`${xe[0]} '${String(b%100).padStart(2,"0")}`:xe[f-1];const u=Math.floor((f-1)/3)+1;return u===1&&b!==K(e).year?`Q1 '${String(b%100).padStart(2,"0")}`:`Q${u}`};r(e,o(i(e)),!0);const m=Math.ceil(vn/Ge[a]);let h=e;for(let d=l(i(e));d<=s;d=l(d))ae(h,d)<m||(r(d,o(d),!0),h=d);return n}const dt={active:"In flight",paused:"On hold",done:"Finished"};function kn(){const[e,s]=x.useState(null);return x.useEffect(()=>{if(!e)return;const a=document.querySelector(`[data-project-menu="${e}"]`);a&&(a.focus(),s(null))}),x.useCallback(a=>s(a),[])}const Nn=4,Pe="Drag the header, or press the arrow keys, to move this column.",ut="board-column-move-hint",wn=({projects:e,nowMs:s,onOpen:a,onEdit:n,onDelete:r,onMove:i,movingKeys:l=[]})=>{const[o,m]=x.useState(Fa),h=Ya(e,o),d=Qe(e,Ke),[b,f]=x.useState(null),[u,w]=x.useState(""),N=x.useRef(null),g=x.useRef(null),v=x.useRef(null),c=x.useRef(null),_=x.useRef(null),P=new Set(l),D=(j,y)=>{const S=Ba(h.map(M=>M.status),j,y);m(S),Ua(S),w(`Moved ${W(j).label} column to position ${S.indexOf(j)+1} of ${S.length}.`)},A=(j,y)=>{const S=N.current;if(!S)return 0;let M=0;const I=S.querySelectorAll("[data-board-column]");for(const U of I){if(U.dataset.boardColumn===y)continue;const Z=U.getBoundingClientRect();j>(Z.left+Z.right)/2&&(M+=1)}return M},B=(j,y)=>{const S=h.filter(U=>U.status!==j),M=S[y-1]?.status,I=S[y]?.status;return M&&I?`between ${W(M).label} and ${W(I).label}`:I?`before ${W(I).label}`:M?`after ${W(M).label}`:"in place"},Q=(j,y)=>{const S=A(j,y.status);S!==y.over&&(y.over=S,f({status:y.status,over:S}),w(`Moving ${W(y.status).label} column; it will drop ${B(y.status,S)}.`))},C=()=>{c.current!==null&&(cancelAnimationFrame(c.current),c.current=null)},O=32,p=12,$=()=>{c.current=null;const j=_.current,y=N.current,S=v.current;if(!j?.armed||!y||S===null)return;const M=y.getBoundingClientRect(),I=y.scrollWidth-y.clientWidth;let U=0;if(S-M.left<O&&y.scrollLeft>0?U=-1:M.right-S<O&&y.scrollLeft<I&&(U=1),U!==0){const Z=y.scrollLeft;y.scrollLeft=Z+U*p,y.scrollLeft!==Z&&Q(S,j)}else Q(S,j);G(j.status,j.over),c.current=requestAnimationFrame($)};x.useEffect(()=>()=>{c.current!==null&&cancelAnimationFrame(c.current)},[]);const E=(j,y)=>{if(j.button===0){try{j.currentTarget.setPointerCapture(j.pointerId)}catch{}_.current={pointerId:j.pointerId,status:y,startX:j.clientX,startY:j.clientY,armed:!1,over:h.findIndex(S=>S.status===y)},v.current=j.clientX}},T=j=>{const y=_.current;if(!(!y||j.pointerId!==y.pointerId)){if(v.current=j.clientX,!y.armed){if(Math.hypot(j.clientX-y.startX,j.clientY-y.startY)<Nn)return;y.armed=!0,f({status:y.status,over:y.over}),w(`Moving ${W(y.status).label} column.`),c.current===null&&(c.current=requestAnimationFrame($))}Q(j.clientX,y)}},F=j=>{const y=_.current;if(_.current=null,C(),f(null),!y?.armed)return;if(!j){w("Move cancelled.");return}const S=h.findIndex(M=>M.status===y.status);if(y.over===S){w("");return}D(y.status,y.over)},k=j=>{const y=_.current;!y||j.pointerId!==y.pointerId||F(!0)},Y=()=>{F(!1)};x.useEffect(()=>{if(!b)return;const j=y=>{y.key==="Escape"&&F(!1)};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[b!==null]);const G=x.useCallback((j,y)=>{const S=N.current,M=g.current;if(!S||!M)return;const I=S.getBoundingClientRect(),U=[];for(const Xe of S.querySelectorAll("[data-board-column]"))Xe.dataset.boardColumn!==j&&U.push(Xe.getBoundingClientRect());const Z=6,Vt=y>=U.length?(U[U.length-1]?.right??I.left)+Z:(U[y]?.left??I.right)-Z,Oe=S.scrollLeft,Xt=2,Jt=Vt-I.left+Oe,Ve=Oe+1,Zt=Oe+I.width-Xt-1,es=Math.round(Math.min(Math.max(Jt,Ve),Math.max(Ve,Zt)));M.style.left=`${es}px`},[]);x.useLayoutEffect(()=>{b&&G(b.status,b.over)},[b,G]);const J=(j,y)=>{if(j.key==="Enter"||j.key===" "){j.preventDefault(),w(Pe);return}if(j.key!=="ArrowLeft"&&j.key!=="ArrowRight")return;j.preventDefault();const S=h.map(U=>U.status),M=S.indexOf(y),I=j.key==="ArrowLeft"?M-1:M+1;if(I<0||I>=S.length){w(`${W(y).label} column is already ${I<0?"the first column":"the last column"}.`);return}D(y,I)};return t.jsxs("div",{className:"[container-type:size] flex min-h-0 flex-1 flex-col","data-testid":"project-board",children:[t.jsx("output",{"aria-live":"polite",className:"sr-only","data-board-column-announcement":"",children:u}),t.jsx("span",{id:ut,className:"sr-only",children:Pe}),t.jsxs("div",{ref:N,"data-board-strip":"",className:R("relative flex min-h-0 flex-1 items-start overflow-auto px-9 pb-9",b&&"cursor-grabbing select-none"),children:[b&&t.jsx("div",{ref:g,"aria-hidden":"true","data-board-drop-indicator":"",className:"pointer-events-none absolute top-3 bottom-3 w-0.5 rounded-full bg-accent"}),t.jsxs("div",{className:"flex w-max flex-col",children:[t.jsx("div",{className:"sticky top-0 z-30 flex gap-3",children:h.map(j=>{const y=W(j.status);return t.jsxs("header",{"data-board-column":j.status,"data-board-column-handle":j.status,onPointerDown:S=>E(S,j.status),onPointerMove:T,onPointerUp:k,onPointerCancel:Y,className:R("flex h-11 w-64 shrink-0 cursor-grab items-center justify-between gap-2 rounded-t-md bg-sunken px-3 active:cursor-grabbing",b?.status===j.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(L,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":j.status,"aria-label":`Move ${y.label} column`,"aria-describedby":ut,title:Pe,className:"-ml-1.5 cursor-grab text-ink-muted active:cursor-grabbing",onKeyDown:S=>J(S,j.status),children:t.jsx(Is,{"aria-hidden":"true"})}),t.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[t.jsx("span",{className:"truncate text-body-sm font-medium text-ink",children:y.label}),dt[j.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:dt[j.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:j.projects.length})]},j.status)})}),d.map(j=>t.jsxs("section",{className:"flex flex-col",children:[t.jsx("div",{"data-board-team":j.team??"",className:"sticky top-11 z-20 flex h-8 items-center bg-canvas px-3 text-meta",children:t.jsxs("span",{className:"sticky left-3 flex min-w-0 max-w-[calc(100cqw-2.25rem)] items-center gap-2",children:[t.jsx("span",{className:"truncate text-ink",children:j.team??ze}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:j.items.length})]})}),t.jsx("div",{className:"flex gap-3 rounded-md bg-sunken py-2",children:h.map(y=>{const S=j.items.filter(M=>M.status===y.status);return t.jsx("div",{"data-board-cell":y.status,className:"flex max-h-[calc(100cqh-92px)] w-64 shrink-0 flex-col gap-2 overflow-y-auto px-2",children:S.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:S.map(M=>t.jsx("li",{children:t.jsx(Sn,{project:M,nowMs:s,busy:P.has(M.id),onOpen:()=>a(M),onEdit:()=>n(M),onDelete:()=>r(M),onMove:I=>i(M,I)})},M.id))})},y.status)})})]},j.team??""))]})]})]})},Sn=({project:e,nowMs:s,busy:a,onOpen:n,onEdit:r,onDelete:i,onMove:l})=>{const o=Rt(e,typeof navigator>"u"?void 0:navigator.language),m=le(e),h=x.useRef(null),[d,b]=x.useState(!1);x.useEffect(()=>{const g=h.current;if(!g)return;const v=()=>{g.isConnected&&b(g.scrollWidth-g.clientWidth>.5)},c=requestAnimationFrame(v),_=new ResizeObserver(v);return _.observe(g),document.fonts?.ready.then(v).catch(()=>{}),()=>{cancelAnimationFrame(c),_.disconnect()}},[m,d]);const f=qa(e,Yt(s)),u=he(e.progress_updated_at,s),w=()=>{const g=window.getSelection();g&&!g.isCollapsed||n()},N=g=>{g.key!=="Enter"&&g.key!==" "||g.target===g.currentTarget&&(g.preventDefault(),n())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":`Open ${m}`,onClick:w,onKeyDown:N,className:R("group/card flex flex-col gap-2 rounded-sm bg-surface p-3","transition-colors duration-fast ease-out-quart hover:bg-elevated",f&&"border border-warning-border"),children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx(St,{content:d?m:null,side:"top",disableHoverableContent:!0,children:t.jsx("span",{ref:h,"data-project-title":e.name,tabIndex:d?0:void 0,className:"block truncate text-body-sm font-medium text-ink",children:m})}),e.title&&t.jsx("span",{className:"mt-0.5 block truncate text-meta text-ink-muted",children:e.name}),e.description&&t.jsx("span",{className:"mt-0.5 block truncate text-meta text-ink-muted",children:e.description})]}),t.jsxs(js,{children:[t.jsx(bs,{"data-project-menu":e.id,"aria-label":`Actions for ${m}`,disabled:a,onClick:g=>g.stopPropagation(),className:R("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:t.jsx(Fs,{className:"size-4"})}),t.jsxs(vs,{align:"end",onClick:g=>g.stopPropagation(),children:[t.jsx(Me,{onSelect:n,children:"Open"}),t.jsxs(ys,{children:[t.jsx(ks,{children:"Set status"}),t.jsx(Ns,{children:t.jsx(ws,{value:e.status,onValueChange:l,children:[...Re,...Le].map(g=>t.jsx(Ss,{value:g,children:W(g).label},g))})})]}),t.jsx(Ts,{}),t.jsx(Me,{onSelect:r,children:"Edit"}),t.jsx(Me,{onSelect:i,children:"Delete"})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[o.filter(g=>g.key!=="live").map(g=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:g.text},g.key)),f&&t.jsx(re,{variant:"warning",children:"Overdue"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-meta text-ink-muted",children:Ta(u)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(e.progress_stale||!u)&&t.jsx("span",{"aria-label":Ne,title:Ne,className:"size-1.5 rounded-full bg-warning"}),e.sessions>0&&t.jsx(Tn,{project:e})]})]})]})},Tn=({project:e})=>{const[s,a]=x.useState(!1),n=Te(),r=Ct(e.id,s),i=r.data?.links??[],l=Ca(e),o=le(e);return t.jsxs(_s,{open:s,onOpenChange:a,children:[t.jsx(Ds,{"data-project-sessions":e.id,"aria-label":`Sessions linked to ${o}`,onClick:m=>m.stopPropagation(),className:R("rounded-sm px-1 text-meta whitespace-nowrap",e.live_sessions>0?"text-success hover:bg-sunken":"text-ink-muted hover:bg-sunken"),children:l}),t.jsx(Cs,{align:"end",className:"w-64 p-2 outline-none",onClick:m=>m.stopPropagation(),children:r.isLoading?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:"Loading linked sessions…"}):r.isError?t.jsxs("div",{className:"flex flex-col items-start gap-1.5 px-1 py-2",children:[t.jsx("p",{className:"text-meta text-ink-muted",children:r.error instanceof Error&&r.error.message?r.error.message:"The linked sessions could not be read."}),t.jsx(L,{variant:"secondary",size:"sm",onClick:()=>void r.refetch(),children:"Try again"})]}):i.length===0?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:"No sessions linked yet."}):t.jsx("ul",{className:"flex flex-col",children:i.map(m=>t.jsx("li",{children:t.jsx("button",{type:"button",disabled:!m.exists,onClick:()=>{m.exists&&(a(!1),_t(n,m.session_id))},className:R("flex w-full items-center gap-2 rounded-sm px-1 py-1.5 text-left text-meta",m.exists?"text-ink hover:bg-elevated":"text-ink-disabled"),children:t.jsx("span",{className:"truncate",children:m.title||m.session_id})})},m.session_id))})})]})},qt=({open:e,projectName:s,onClose:a,onConfirm:n})=>{const[r,i]=x.useState(""),[l,o]=x.useState(null),[m,h]=x.useState(!1),d=x.useId();x.useEffect(()=>{e&&(i(""),o(null),h(!1))},[e]);const b=r.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,f=async()=>{h(!0),o(null);try{await n(r.trim()),a()}catch(u){o(u instanceof Error&&u.message?u.message:"The project was not deleted.")}finally{h(!1)}};return t.jsx(_e,{open:e,onClose:a,title:"Delete this project?",dataTourTag:"project-delete-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(De,{onClick:a,disabled:m,children:"Cancel"}),t.jsxs(Us,{onClick:()=>void f(),disabled:!b||m,children:[m&&t.jsx(de,{size:"xs"}),"Delete project"]})]}),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"text-body-sm text-ink",children:"This deletes the project and its milestones. The sessions linked to it are not touched."}),t.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Type"," ",t.jsx("span",{className:"font-mono text-mono-sm text-ink",children:s})," ","to confirm."]}),t.jsx(z,{id:`${d}-confirm`,value:r,onChange:u=>i(u.target.value),placeholder:s,"aria-label":"Type the project name to confirm","aria-invalid":r.length>0&&!b,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})},_n=/^(https?:|mailto:)/i,Dn={a:({href:e,children:s})=>typeof e=="string"&&_n.test(e)?t.jsx("a",{href:e,target:"_blank",rel:"noreferrer",children:s}):t.jsx("span",{className:"font-mono text-mono-sm",children:s}),table:Ys},we=x.memo(({children:e,className:s})=>t.jsx("div",{className:R("lo-markdown",s),children:t.jsx(Bs,{remarkPlugins:[qs],components:Dn,children:e})})),mt=`## Summary
|
|
18
18
|
|
|
19
19
|
## Goals
|
|
20
20
|
|
|
21
|
-
## Notes`,
|
|
22
|
-
`))},m=e.match(
|
|
21
|
+
## Notes`,Cn=new RegExp("\\p{Mn}","gu"),En=/[^a-z0-9._-]+/g,On=/[._-]{2,}/g,Mn=/^[^a-z0-9]+/,ht=/[^a-z0-9]+$/;function Pn(e){return e.normalize("NFKD").replace(Cn,"").toLowerCase().replace(En,"-").replace(On,"-").replace(Mn,"").replace(ht,"").slice(0,64).replace(ht,"")}const An=/&#x([0-9a-f]+);/gi,$n=/&#(\d+);/g,Rn=/ /g,Ln=/</g,In=/>/g,Fn=/"/g,Un=/'|'/g,Bn=/&/g,ft=e=>e.replace(An,(s,a)=>String.fromCodePoint(Number.parseInt(a,16))).replace($n,(s,a)=>String.fromCodePoint(Number.parseInt(a,10))).replace(Rn," ").replace(Ln,"<").replace(In,">").replace(Fn,'"').replace(Un,"'").replace(Bn,"&"),Yn=/<[^>]*>|[^<]+/g,qn=/^<\//,Wn=/^<\/?\s*([a-zA-Z][a-zA-Z0-9]*)/,zn=/\s+/g,pt=/class="[^"]*language-([\w+-]+)/,Kn=/href="([^"]*)"/,Qn=/src="([^"]*)"/,Hn=/alt="([^"]*)"/,Gn=/[ \t]+\n/g,Vn=/\n{3,}/g;function Xn(e){const s=[],a=(...h)=>{for(let d=s.length-1;d>=0;d--)if(h.includes(s[d].tag)){const[b]=s.splice(d,1);return b}},n=[],r=()=>s.some(h=>h.tag==="pre"),i=()=>s.filter(h=>h.tag==="blockquote").length;let l=!0;const o=h=>{h&&(i()>0&&l&&!r()&&n.push("> ".repeat(i())),n.push(h),l=h.endsWith(`
|
|
22
|
+
`))},m=e.match(Yn)??[];for(let h=0;h<m.length;h++){const d=m[h];if(!d.startsWith("<")){o(r()?ft(d):ft(d).replace(zn," "));continue}const b=qn.test(d),f=(d.match(Wn)?.[1]??"").toLowerCase();if(b){switch(f){case"p":case"div":o(`
|
|
23
23
|
|
|
24
24
|
`);break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":a(f),o(`
|
|
25
25
|
|
|
@@ -28,8 +28,8 @@ import{r as x,j as t,c as R}from"./index-C8q85hqs.js";import{L as ts,N as Me,O a
|
|
|
28
28
|
`);break;case"strong":case"b":a("strong","b")&&o("**");break;case"em":case"i":a("em","i")&&o("*");break;case"del":case"s":a("del","s")&&o("~~");break;case"code":{a("code")?.inline&&o("`");break}case"pre":a("pre")&&o("\n```\n\n");break;case"a":{const u=a("a");u?.href&&o(`](${u.href})`);break}case"blockquote":a("blockquote")&&o(`
|
|
29
29
|
`);break}continue}switch(f){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{const u=Number(f[1]);s.push({tag:f}),o(`${"#".repeat(u)} `);break}case"ul":case"ol":s.push({tag:f,ordered:f==="ol",index:1});break;case"li":{const u=[...s].reverse().find(w=>w.tag==="ul"||w.tag==="ol");s.push({tag:"li"}),u?.ordered?o(`${u.index??1}. `):o("- ");break}case"strong":case"b":s.push({tag:f}),o("**");break;case"em":case"i":s.push({tag:f}),o("*");break;case"del":case"s":s.push({tag:f}),o("~~");break;case"code":{const u=s[s.length-1]?.tag!=="pre";s.push({tag:"code",inline:u}),u&&o("`");break}case"pre":{const u=d.match(pt)?.[1]??m[h+1]?.match(pt)?.[1]??"";s.push({tag:"pre"}),o(`
|
|
30
30
|
\`\`\`${u}
|
|
31
|
-
`);break}case"a":{const u=d.match(
|
|
32
|
-
`);break;case"blockquote":s.push({tag:"blockquote"});break}}return n.join("").replace(
|
|
33
|
-
`).replace(
|
|
31
|
+
`);break}case"a":{const u=d.match(Kn)?.[1]??"";s.push({tag:"a",href:u}),u&&o("[");break}case"img":{const u=d.match(Qn)?.[1]??"",w=d.match(Hn)?.[1]??"";u&&o(``);break}case"br":o(`
|
|
32
|
+
`);break;case"blockquote":s.push({tag:"blockquote"});break}}return n.join("").replace(Gn,`
|
|
33
|
+
`).replace(Vn,`
|
|
34
34
|
|
|
35
|
-
`).trim()}const Xn=[{value:"planning",label:"Planning"},{value:"active",label:"Active"},{value:"qa",label:"QA"},{value:"validation",label:"Validation"},{value:"done",label:"Done"},{value:"paused",label:"Paused"},{value:"archived",label:"Archived"}],Ue={name:"",title:"",owner:"",team:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},xt=Pt;function gt(e){return e.split(",").map(s=>s.trim()).filter(s=>s.length>0)}function Jn(e){return e?{name:e.name,title:e.title??"",owner:e.owner??"",team:e.team??"",description:e.description,status:e.status,tags:e.tags.join(", "),startDate:e.start_date??"",targetDate:e.target_date??"",estimate:e.estimate===null||e.estimate===void 0?"":String(e.estimate),estimateUnit:e.estimate_unit||"points"}:Ue}const Be=({open:e,mode:s,initial:a,onClose:n,onSubmit:r})=>{const[i,l]=x.useState(Ue),[o,m]=x.useState({}),[h,d]=x.useState(null),b=x.useRef(null),[f,u]=x.useState(!1),[w,N]=x.useState(s==="edit"),[g,v]=x.useState(!1),c=x.useId(),_=x.useRef(null);x.useEffect(()=>{e&&(l(s==="create"?{...Ue,description:mt}:Jn(a)),m({}),d(null),u(!1),N(s==="edit"),v(!1))},[e]),x.useEffect(()=>{h&&b.current?.scrollIntoView({block:"nearest"})},[h]);const A=(p,$)=>{l(E=>({...E,[p]:$}))},D=s==="create"&&!w?Pn(i.title):i.name,M=p=>{const $=p.clipboardData?.getData("text/html");if(!$)return;const E=Vn($);if(!E)return;p.preventDefault();const T=p.currentTarget,F=T.selectionStart??T.value.length,k=T.selectionEnd??F,Y=T.value.slice(0,F)+E+T.value.slice(k);A("description",Y),requestAnimationFrame(()=>{const G=_.current;if(!G)return;const J=F+E.length;G.setSelectionRange(J,J)})},B=(p,$)=>{const E={},T=us($);T&&(E.name=T),p.description.length>pe&&(E.description=`Keep the description within ${pe} characters.`);const F=gt(p.tags);if(F.length>8)E.tags="At most 8 tags.";else for(const k of F){const Y=ms(k);if(Y){E.tags=Y;break}}if(xt.test(p.startDate)||(E.startDate="Dates are YYYY-MM-DD, or empty."),xt.test(p.targetDate)||(E.targetDate="Dates are YYYY-MM-DD, or empty."),!E.startDate&&!E.targetDate&&p.startDate&&p.targetDate&&p.targetDate<p.startDate&&(E.targetDate="The target date is before the start date."),p.estimate){const k=Number(p.estimate);(!Number.isFinite(k)||!(k>0)||k>1e3)&&(E.estimate="Estimates are greater than 0 and at most 1000.")}for(const k of["title","owner","team"])p[k].trim().length>80&&(E[k]=`${k==="title"?"Titles":k==="owner"?"Owners":"Teams"} are at most 80 characters.`);return E},Q=async()=>{const p=D.trim(),$=B(i,p);if(m($),Object.keys($).length>0)return;u(!0),d(null);const E=gt(i.tags);try{if(s==="create"){const T={};i.title.trim()&&(T.title=i.title.trim()),i.owner.trim()&&(T.owner=i.owner.trim()),i.team.trim()&&(T.team=i.team.trim()),i.startDate&&(T.start_date=i.startDate),i.targetDate&&(T.target_date=i.targetDate),i.estimate&&(T.estimate=Number(i.estimate),T.estimate_unit=i.estimateUnit),await r({mode:"create",fields:{name:p,...i.description.trim()&&i.description.trim()!==mt?{description:i.description.trim()}:{},status:i.status,...E.length>0?{tags:E}:{}},...Object.keys(T).length>0?{followUp:T}:{}})}else await r({mode:"edit",key:a?.key??"",fields:{name:p,description:i.description.trim(),title:i.title.trim(),owner:i.owner.trim(),team:i.team.trim(),status:i.status,tags:E,start_date:i.startDate,target_date:i.targetDate,...i.estimate?{estimate:Number(i.estimate)}:{},estimate_unit:i.estimateUnit}});n()}catch(T){const F=T instanceof Error&&T.message?T.message:"";d(Bt(F)||"The project was not saved.")}finally{u(!1)}},C=s==="create"?"New project":"Edit project",O=i.description.length>pe;return t.jsx(_e,{open:e,onClose:n,title:C,fullWidth:!0,maxWidth:"md",dialogProps:{closeDisabled:f,onEscapeKeyDown:p=>{f&&p.preventDefault()},onInteractOutside:p=>{f&&p.preventDefault()}},dataTourTag:s==="create"?"project-create-dialog":"project-edit-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(De,{onClick:n,disabled:f,children:"Cancel"}),t.jsxs(Dt,{"data-project-submit":"",onClick:()=>void Q(),disabled:f,children:[f&&t.jsx(de,{size:"xs"}),s==="create"?"Create project":"Save changes"]})]}),children:t.jsxs("form",{className:"flex flex-col gap-6 px-1 py-1",onSubmit:p=>{p.preventDefault(),Q()},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-title`,children:"Title"}),t.jsx(z,{id:`${c}-title`,"data-project-title":"",value:i.title,onChange:p=>A("title",p.target.value),placeholder:"Payments migration",autoFocus:!0,className:"h-10 text-heading","aria-invalid":!!o.title}),o.title&&t.jsx("p",{className:"text-meta text-danger",children:o.title}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(q,{htmlFor:`${c}-key`,className:"shrink-0 text-meta text-ink-muted",children:"Key"}),t.jsx(z,{id:`${c}-key`,"data-project-key":"",value:D,onChange:p=>{N(!0),A("name",p.target.value)},placeholder:"payments-migration","aria-invalid":!!o.name,className:"h-7 max-w-56 font-mono text-mono-sm"}),t.jsx("span",{className:"text-meta text-ink-muted",children:s==="create"&&!w?"Derived from the title until you edit it.":"Letters, digits, dot, underscore or dash; no spaces."})]}),o.name&&t.jsx("p",{className:"text-meta text-danger",children:o.name})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(q,{htmlFor:`${c}-description`,children:"Description"}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:"Description mode"}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:["write","preview"].map(p=>t.jsx("button",{type:"button","data-project-description-mode":p,"aria-pressed":g===(p==="preview"),onClick:()=>v(p==="preview"),className:R("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",g===(p==="preview")&&"bg-surface text-ink"),children:p==="write"?"Write":"Preview"},p))})]})]}),g?t.jsx("div",{"data-project-description-preview":"",className:"h-44 overflow-y-auto rounded-md border border-hairline bg-sunken px-3 py-2",children:i.description.trim()?t.jsx(we,{className:"text-body-sm",children:i.description}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:"Nothing to preview yet."})}):t.jsx(Es,{ref:_,id:`${c}-description`,"data-project-description":"",value:i.description,onChange:p=>A("description",p.target.value),onPaste:M,rows:8,placeholder:"Markdown — headings, lists, code.","aria-invalid":O||!!o.description,className:"h-44 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.description?t.jsx("p",{className:"text-meta text-danger",children:o.description}):t.jsx("span",{}),t.jsxs("p",{className:R("text-meta tabular-nums",O?"text-danger":"text-ink-muted"),children:[i.description.length,"/",pe]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{children:"Status"}),t.jsxs(je,{value:i.status,onValueChange:p=>A("status",p),children:[t.jsx(be,{"aria-label":"Status",children:t.jsx(ve,{})}),t.jsx(ye,{children:Xn.map(p=>t.jsx(ue,{value:p.value,children:p.label},p.value))})]}),i.status==="done"&&t.jsx("p",{className:"text-meta text-ink-muted",children:"Moving a project to Done stamps today as its completion date."})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-owner`,children:"Owner"}),t.jsx(z,{id:`${c}-owner`,"data-project-owner":"",value:i.owner,onChange:p=>A("owner",p.target.value),placeholder:"atlas","aria-invalid":!!o.owner}),o.owner&&t.jsx("p",{className:"text-meta text-danger",children:o.owner})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-team`,children:"Team"}),t.jsx(z,{id:`${c}-team`,value:i.team,onChange:p=>A("team",p.target.value),placeholder:"platform","aria-invalid":!!o.team}),o.team&&t.jsx("p",{className:"text-meta text-danger",children:o.team})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-target`,children:"Target date"}),t.jsx(z,{id:`${c}-target`,"data-project-target":"",value:i.targetDate,onChange:p=>A("targetDate",p.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!o.targetDate}),o.targetDate&&t.jsx("p",{className:"text-meta text-danger",children:o.targetDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-start`,children:"Start date"}),t.jsx(z,{id:`${c}-start`,value:i.startDate,onChange:p=>A("startDate",p.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!o.startDate}),o.startDate&&t.jsx("p",{className:"text-meta text-danger",children:o.startDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-estimate`,children:"Estimate"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(z,{id:`${c}-estimate`,value:i.estimate,onChange:p=>A("estimate",p.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!o.estimate,className:"max-w-28"}),t.jsxs(je,{value:i.estimateUnit,onValueChange:p=>A("estimateUnit",p),children:[t.jsx(be,{"aria-label":"Estimate unit",className:"max-w-32",children:t.jsx(ve,{})}),t.jsxs(ye,{children:[t.jsx(ue,{value:"points",children:"Points"}),t.jsx(ue,{value:"days",children:"Days"})]})]})]}),o.estimate&&t.jsx("p",{className:"text-meta text-danger",children:o.estimate}),s==="edit"&&i.estimate.trim()===""&&a?.estimate!==null&&a?.estimate!==void 0&&t.jsx("p",{className:"text-meta text-ink-muted",children:"Clearing an estimate is not supported yet — saving keeps its current value."})]}),t.jsxs("div",{className:"col-span-2 flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-tags`,children:"Tags"}),t.jsx(z,{id:`${c}-tags`,value:i.tags,onChange:p=>A("tags",p.target.value),placeholder:"q4, payments","aria-invalid":!!o.tags}),o.tags?t.jsx("p",{className:"text-meta text-danger",children:o.tags}):t.jsx("p",{className:"text-meta text-ink-muted",children:"Comma-separated, up to 8. Lowercase letters, digits, underscore or dash."})]})]}),h&&t.jsx("p",{ref:b,className:"text-body-sm text-danger",children:h})]})})},Zn=({links:e,target:s,onTargetChange:a,onSend:n,focusTick:r})=>{const[i,l]=x.useState(""),[o,m]=x.useState(!1),h=x.useRef(null);x.useEffect(()=>{r>0&&h.current?.focus()},[r]);const d=e.filter(N=>N.exists),f=(d.find(N=>N.session_id===s)??null)?.runtime?.busy===!0,u=!!s&&i.trim().length>0&&!o,w=async()=>{if(!(!u||!s)){m(!0);try{await n(s,i.trim(),f?"steer":"prompt")&&l("")}finally{m(!1),h.current?.focus()}}};return t.jsxs("div",{className:"flex flex-col gap-2 rounded-md bg-elevated p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-meta text-ink-muted",children:"Send to"}),t.jsxs(je,{value:s??void 0,onValueChange:N=>a(N),children:[t.jsx(be,{"aria-label":"Select the session to message",className:"max-w-72",children:t.jsx(ve,{placeholder:"No session selected"})}),t.jsx(ye,{children:d.map(N=>t.jsx(ue,{value:N.session_id,children:He(N)},N.session_id))})]}),f&&t.jsx("span",{className:"text-meta text-ink-muted",children:"The session is working — this message steers the running turn."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(z,{ref:h,"aria-label":"Message the selected session",placeholder:"Message the session",value:i,onChange:N=>l(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),w())}}),t.jsxs(L,{variant:"secondary",disabled:!u,onClick:()=>void w(),"data-tour-tag":"project-quick-send",children:[o?t.jsx(de,{size:"xs"}):t.jsx(da,{}),"Send"]})]})]})},er=({links:e,busy:s,onUnlink:a,onLink:n,onQuickSend:r,onStartSession:i})=>{const l=Te(),o=ge(v=>v.sessions),[m,h]=x.useState(!1),[d,b]=x.useState(null),[f,u]=x.useState(0),w=d&&e.some(v=>v.session_id===d&&v.exists)?d:tn(e),N=x.useMemo(()=>{const v=new Set(e.map(c=>c.session_id));return o.filter(c=>!v.has(c.session_id)).map(c=>({id:c.session_id,name:c.title||c.session_id,description:c.cwd??void 0}))},[o,e]),g=v=>{ge.getState().openSession(v).then(c=>{c&&l(`/chat/${v}`)})};return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Linked sessions"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(L,{variant:"secondary",size:"sm",disabled:s,onClick:i,"data-tour-tag":"project-start-session",children:[t.jsx(qs,{}),"New session"]}),t.jsxs(L,{variant:"secondary",size:"sm",disabled:s,onClick:()=>h(!0),"data-tour-tag":"project-link-session",children:[t.jsx(la,{}),"Link session"]})]})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No sessions linked yet. Link the conversations that are working on this project so its progress stays with them."}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(v=>{const c=Ca(v),_=Ea(v.subagents),A=Oa(v.todos),D=v.title||v.session_id,M=v.exists;return t.jsxs("li",{className:R("flex items-center gap-2 rounded-sm px-2 py-2",M&&"hover:bg-row-hover"),children:[t.jsx("button",{type:"button",disabled:!M,onClick:()=>{M&&g(v.session_id)},className:R("flex min-w-0 flex-1 items-center gap-2 text-left",M?"cursor-pointer":"cursor-default opacity-100"),children:t.jsx("span",{className:R("min-w-0 truncate text-body-sm",v.title?"text-ink":"font-mono text-mono-sm text-ink-muted"),children:D})}),v.runtime?.busy===!0&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:"busy"}),_&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:_}),A&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:A}),t.jsx(re,{variant:c.variant,children:c.label}),M&&t.jsx(L,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Message ${D}`,title:`Message ${D}`,onClick:()=>{b(v.session_id),u(B=>B+1)},children:t.jsx(Ws,{})}),t.jsx(L,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Unlink ${D}`,onClick:()=>a(v.session_id),children:t.jsx(ma,{})})]},v.session_id)})}),e.length>0&&t.jsx(Zn,{links:e,target:w,onTargetChange:b,onSend:r,focusTick:f}),t.jsx(_e,{open:m,onClose:()=>h(!1),title:"Link a session",maxWidth:"sm",dataTourTag:"project-link-dialog",actions:t.jsx(De,{onClick:()=>h(!1),children:"Close"}),children:t.jsxs("div",{className:"flex flex-col gap-2 px-1 py-1",children:[t.jsx(q,{children:"Session"}),t.jsx(Tt,{showLabel:!1,ariaLabel:"Search sessions",busyLabel:"Loading sessions",placeholder:"Search conversations",options:N,selected:null,onSelect:v=>{h(!1),n(v.id)}}),t.jsx("p",{className:"text-meta text-ink-muted",children:"Conversations already linked to this project are not listed."})]})})]})},tr=({milestones:e,summary:s,busy:a,onToggle:n,onRemove:r,onAdd:i})=>{const[l,o]=x.useState(""),[m,h]=x.useState(""),d=!Pt.test(m.trim()),b=l.trim().length>0&&!d&&!a,f=()=>{b&&(i(l.trim(),m.trim()),o(""),h(""))};return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Milestones"}),s&&e.length>0&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:s})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No milestones yet. Add one below to mark the dates this project is planned around."}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(u=>{const w=Na(u.status),N=u.completed_at!==null;return t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx(Os,{checked:N,disabled:a,onCheckedChange:g=>n(u.name,g===!0),"aria-label":N?`Mark ${u.name} not complete`:`Mark ${u.name} complete`}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:u.name}),u.target_date&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:X(u.target_date,typeof navigator>"u"?void 0:navigator.language)}),t.jsx(re,{variant:w.variant,children:w.label}),t.jsx(L,{variant:"ghost",size:"icon-sm",disabled:a,"aria-label":`Remove ${u.name}`,onClick:()=>r(u.name),children:t.jsx(Ps,{})})]},u.name)})}),t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[t.jsx(q,{htmlFor:"project-milestone-name",children:"New milestone"}),t.jsx(z,{id:"project-milestone-name",value:l,onChange:u=>o(u.target.value),placeholder:"beta cut",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),f())}})]}),t.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[t.jsx(q,{htmlFor:"project-milestone-date",children:"Target date"}),t.jsx(z,{id:"project-milestone-date",value:m,onChange:u=>h(u.target.value),placeholder:"YYYY-MM-DD","aria-invalid":d}),d&&t.jsx("p",{className:"text-meta text-danger",children:"Dates are YYYY-MM-DD, or empty."})]}),t.jsxs(L,{variant:"secondary",disabled:!b,onClick:f,"data-tour-tag":"project-milestone-add",children:[t.jsx(ke,{}),"Add"]})]})]})},sr=({project:e,nowMs:s})=>{const a=typeof navigator>"u"?void 0:navigator.language,n=new Date(s),r=[],i=X(e.start_date,a,n);i&&r.push({label:"Start",value:i});const l=X(e.target_date,a,n);l&&r.push({label:"Target",value:l});const o=X(e.completed_at,a,n);o&&r.push({label:"Completed",value:o});const m=Mt(e.estimate,e.estimate_unit);if(m&&r.push({label:"Estimate",value:m}),e.tags.length>0&&r.push({label:"Tags",value:t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:e.tags.map(h=>t.jsx(re,{variant:"outline",children:h},h))})}),e.updated_at>0){const h=fe(he(e.updated_at,s)),d=new Date(e.updated_at*1e3).toLocaleString(a);r.push({label:"Updated",value:t.jsx("time",{dateTime:new Date(e.updated_at*1e3).toISOString(),title:d,children:h})})}return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Properties"}),r.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No dates, estimate or tags yet."}):t.jsx("dl",{className:"flex flex-col gap-2",children:r.map(h=>t.jsxs("div",{className:"flex items-baseline gap-3",children:[t.jsx("dt",{className:"w-24 shrink-0 text-body-sm text-ink-muted",children:h.label}),t.jsx("dd",{className:"min-w-0 text-body-sm text-ink",children:h.value})]},h.label))})]})},Wt="plain",zt=e=>`team:${e}`,Kt=e=>`agent:${e}`;function ar(e){return e.startsWith("team:")?{kind:"team",name:e.slice(5)}:e.startsWith("agent:")?{kind:"agent",name:e.slice(6)}:{kind:"plain"}}function nr(e){return e.kind==="team"?zt(e.name):e.kind==="agent"?Kt(e.name):Wt}const jt={kind:"plain"},rr=({open:e,onClose:s,onStart:a,teamsEnabled:n,profilesEnabled:r})=>{const[i,l]=x.useState(jt),[o,m]=x.useState(null),[h,d]=x.useState(!1),b=zs(e&&n),f=Ks(e&&r);x.useEffect(()=>{e&&(l(jt),m(null),d(!1))},[e]);const u=x.useMemo(()=>{const c=[{id:Wt,name:"Nothing in particular",description:"A plain session; assign a team or agent later.",group:"Plain"}];for(const _ of b.data??[])c.push({id:zt(_.name),name:_.name,description:`Team · manager: ${_.manager}`,group:"Teams"});for(const _ of(f.data??[]).filter(A=>A.source!=="builtin"))c.push({id:Kt(_.name),name:_.name,description:_.description||_.kind,group:"Agents"});return c},[b.data,f.data]),w=u.find(c=>c.id===nr(i))??u[0],N=!n||!r,g=b.isLoading||f.isLoading,v=async()=>{d(!0),m(null);try{await a(i),s()}catch(c){m(c instanceof Error&&c.message?c.message:"The session could not be started.")}finally{d(!1)}};return t.jsx(_e,{open:e,onClose:s,title:"Start a session",maxWidth:"sm",dataTourTag:"project-start-session-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(De,{onClick:s,disabled:h,children:"Cancel"}),t.jsxs(Dt,{onClick:()=>void v(),disabled:h,children:[h&&t.jsx(de,{size:"xs"}),"Start session"]})]}),children:t.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[t.jsx(Tt,{label:"Work with",placeholder:"Search teams and agents",options:u,selected:w,onSelect:c=>l(ar(c.id)),busy:g,busyLabel:"Loading teams and agents"}),t.jsx("p",{className:"text-meta text-ink-muted",children:"The session starts now, links itself to this project, and opens with a prompt you can edit before sending."}),N&&t.jsx("p",{className:"text-meta text-ink-muted",children:"This server does not offer the team or agent catalogues yet, so only a plain session can be started."}),o&&t.jsx("p",{className:"text-body-sm text-danger",children:o})]})})},Qt=({status:e})=>{const s=W(e);return t.jsxs(re,{variant:s.variant,children:[ya(e)&&t.jsx(As,{"aria-hidden":!0}),s.label]})},ir=({links:e})=>{const s=en(e),a=e.filter(n=>n.todos!==null);return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"To-dos"}),s&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:ot(s)})]}),a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No to-do snapshots from the linked sessions yet. A session publishes its list as it works, and it appears here once it has."}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:a.map(n=>t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx("span",{className:n.title?"min-w-0 flex-1 truncate text-body-sm text-ink":"min-w-0 flex-1 truncate font-mono text-mono-sm text-ink-muted",children:He(n)}),n.todos&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:ot(n.todos)})]},n.session_id))})]})},or=/[/\\]/;function Ht(e){if(e.name)return e.name;const s=e.path.split(or);return s[s.length-1]||"Attachment"}const lr=({attachment:e})=>{const s=Ht(e),a=Ja(e.bytes);return t.jsxs("div",{className:"flex w-fit max-w-full items-center gap-2.5 rounded-sm border border-hairline bg-surface px-3 py-2",children:[t.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2.5 text-left",onClick:()=>{window.api?.openFile(e.path)},title:`Open ${s}`,children:[t.jsx(Js,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),t.jsx("span",{className:"truncate text-body-sm text-ink",children:s})]}),a&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:a}),t.jsx(Zs,{filePath:e.path,"aria-label":`File actions for ${s}`})]})},cr=({attachment:e})=>{const s=Ht(e),a=Qs(e.path,{mimeType:Hs(e.name||e.path),sizeBytes:e.bytes});return a.status==="ready"?t.jsx("div",{className:"inline-block max-w-full",children:t.jsx(Gs,{file:e.path,src:a.url,label:s,conversationId:""})}):a.status==="loading"?t.jsx(Vs,{children:t.jsxs("span",{className:"sr-only",children:["Loading ",s]})}):t.jsx(Xs,{name:s})},dr=({attachments:e})=>t.jsx("div",{className:"flex flex-wrap items-start gap-2",children:e.map(s=>s.kind==="image"?t.jsx(cr,{attachment:s},`${s.path}:${s.added_at}`):t.jsx(lr,{attachment:s},`${s.path}:${s.added_at}`))}),ur=({update:e,nowMs:s})=>{const a=typeof navigator>"u"?void 0:navigator.language,n=Va(e,a,s);return t.jsxs("article",{className:"flex flex-col gap-2 rounded-sm px-2 py-3",children:[n.length>0&&t.jsx("p",{className:"flex flex-wrap items-baseline gap-x-2 text-meta text-ink-muted",children:n.map((r,i)=>t.jsxs(x.Fragment,{children:[i>0&&t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:r.text})]},r.key))}),e.text&&t.jsx(we,{children:e.text}),e.attachments.length>0&&t.jsx(dr,{attachments:e.attachments})]})},mr=({updates:e,nowMs:s})=>{const a=typeof navigator>"u"?void 0:navigator.language,n=za(e.length),r=Xa(e,a,new Date(s));return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Updates"}),n&&t.jsx("span",{className:"text-meta text-ink-muted",children:n})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No updates yet. Progress reported by you or by the sessions working on this project is appended here."}):t.jsx("div",{className:"flex flex-col gap-4",children:r.map(i=>t.jsxs("div",{className:"flex flex-col gap-2",children:[i.label&&t.jsx("h3",{className:"text-meta text-ink-muted",children:i.label}),t.jsx("div",{className:"flex flex-col divide-y divide-hairline",children:i.entries.map((l,o)=>t.jsx(ur,{update:l,nowMs:s},`${l.at}:${l.by}:${o}`))})]},i.key||"ungrouped"))})]})},hr="project_not_found",fr=({projectKey:e,nowMs:s})=>{const a=Te(),n=wt(),r=Ct(e,!0),i=Et(),l=Ot(),o=ja(),m=ba(),h=xa(),d=ga(),[b,f]=x.useState(!1),[u,w]=x.useState(!1),[N,g]=x.useState(!1),v=i.isPending||l.isPending||o.isPending||m.isPending||h.isPending||d.isPending;if(r.isLoading)return t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(de,{label:"Loading project"})});if(r.isError||!r.data){const C=r.error instanceof hs&&(r.error.code===hr||r.error.status===404);return t.jsxs("div",{className:"mx-auto flex w-full max-w-200 flex-col items-start gap-4",children:[t.jsx($e,{variant:"danger",className:"w-full",children:C?"This project could not be found. It may have been deleted.":r.error instanceof Error&&r.error.message?r.error.message:"The project could not be read."}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(L,{variant:"secondary",onClick:()=>void r.refetch(),children:"Try again"}),t.jsxs(L,{variant:"secondary",onClick:()=>void a("/projects"),children:[t.jsx(st,{}),"All projects"]})]})]})}const{project:c,links:_}=r.data,A=le(c),D=qa(c.owner,c.team),M=Za(c.milestones.filter(C=>C.completed_at!==null).length,c.milestones.length),B=async(C,O,p)=>{const $=ge.getState(),E=fs(null,C,$.drafts);if(!E)return!1;try{if(await ps(E,{text:O,attachments:[],images:[],mode:p,cwd:$.cwd},C)===null)return V("That session already has a message going out. Try again in a moment."),!1;const F=_.find(k=>k.session_id===C);return se(`Sent to ${F?He(F):C}`),!0}catch(T){return V(T instanceof Error&&T.message?T.message:"The message was not sent."),!1}},Q=async C=>{const O=ge.getState(),p=C.kind==="plain"?void 0:{kind:C.kind,name:C.name},$=await O.createSession(O.cwd||"~",p);if(!$)throw new Error(O.error??"The session could not be started.");xs.getState().setCurrentInput($,sn(c));let E=null;try{await h.mutateAsync({key:c.id,sessionId:$})}catch(T){E=T instanceof Error&&T.message?T.message:"the link was refused"}if(E)V(`Session started, but linking it failed: ${E}`);else{const T=p?` with ${an(p)}`:"";se(`Session started${T} and linked to ${A}.`)}await _t(a,$)};return t.jsxs("div",{className:"mx-auto flex w-full max-w-200 flex-col gap-8",children:[t.jsxs("header",{className:"flex flex-col gap-4",children:[t.jsxs("button",{type:"button",onClick:()=>void a("/projects"),className:"flex w-fit items-center gap-1.5 text-body-sm text-ink-muted hover:text-ink",children:[t.jsx(st,{className:"size-4"}),"All projects"]}),t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h1",{"data-project-title":c.name,className:"min-w-0 break-words text-display text-ink",children:A}),t.jsx(Qt,{status:c.status}),c.progress_stale&&t.jsx(re,{variant:"warning",children:Ne})]}),c.title&&t.jsx("p",{className:"font-mono text-mono-sm text-ink-muted",children:c.name}),D&&t.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Managed by ",D]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(L,{variant:"secondary",onClick:()=>f(!0),"data-tour-tag":"project-edit",children:[t.jsx(ea,{}),"Edit"]}),t.jsxs(L,{variant:"secondary",onClick:()=>w(!0),"data-tour-tag":"project-delete",children:[t.jsx(ta,{}),"Delete"]})]})]})]}),c.description.trim()&&t.jsx(we,{className:"text-body",children:c.description}),t.jsx(sr,{project:c,nowMs:s}),c.updates.length===0&&c.progress&&t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h2",{className:"text-title text-ink",children:"Progress"}),t.jsx(we,{className:"text-body",children:c.progress}),t.jsx("p",{className:"text-meta text-ink-muted",children:Ta(c,s)})]}),t.jsx(tr,{milestones:c.milestones,summary:M,busy:v,onToggle:(C,O)=>{o.mutateAsync({key:c.id,name:C,completed:O}).catch(p=>{V(p instanceof Error&&p.message?p.message:"The milestone was not updated.")})},onRemove:C=>{m.mutateAsync({key:c.id,name:C}).catch(O=>{V(O instanceof Error&&O.message?O.message:"The milestone was not removed.")})},onAdd:(C,O)=>{o.mutateAsync({key:c.id,name:C,targetDate:O}).catch(p=>{V(p instanceof Error&&p.message?p.message:"The milestone was not added.")})}}),t.jsx(er,{projectKey:c.id,links:_,busy:v,onStartSession:()=>g(!0),onQuickSend:B,onLink:C=>{h.mutateAsync({key:c.id,sessionId:C}).catch(O=>{V(O instanceof Error&&O.message?O.message:"The session was not linked.")})},onUnlink:C=>{d.mutateAsync({key:c.id,sessionId:C}).catch(O=>{V(O instanceof Error&&O.message?O.message:"The session was not unlinked.")})}}),t.jsx(ir,{links:_}),t.jsx(mr,{updates:c.updates,nowMs:s}),t.jsx(Be,{open:b,mode:"edit",initial:{key:c.id,name:c.name,title:c.title,owner:c.owner,team:c.team,description:c.description,status:c.status,tags:c.tags,start_date:c.start_date,target_date:c.target_date,estimate:c.estimate,estimate_unit:c.estimate_unit},onClose:()=>f(!1),onSubmit:async C=>{C.mode==="edit"&&(await i.mutateAsync({key:C.key,fields:C.fields}),se("Project saved"))}}),t.jsx(qt,{open:u,projectName:c.name,onClose:()=>w(!1),onConfirm:async C=>{await l.mutateAsync({key:c.id,confirmedName:C}),se("Project deleted"),a("/projects")}}),t.jsx(rr,{open:N,onClose:()=>g(!1),onStart:Q,teamsEnabled:et(n.data,"team_catalogue"),profilesEnabled:et(n.data,"profile_catalogue")})]})},ee=[{key:"name",label:"Project",className:"min-w-0 flex-1"},{key:"status",label:"Status",className:"w-20 shrink-0"},{key:"target",label:"Target",className:"hidden w-32 shrink-0 @[40rem]:block"},{key:"estimate",label:"Estimate",className:"hidden w-16 shrink-0 @[40rem]:block"},{key:"milestones",label:"Milestones",className:"hidden w-20 shrink-0 @[34rem]:block"},{key:"live",label:"Live",className:"hidden w-14 shrink-0 @[34rem]:block"},{key:"progress",label:"Progress",className:"w-40 shrink-0"}];function pr(e,s){const a=he(e.progress_updated_at,s);return a?fe(a):"not reported"}const xr=({projects:e,nowMs:s,onOpen:a})=>{const n=Qe(e,Ke);return t.jsxs("div",{className:"@container flex min-h-0 flex-1 flex-col","data-testid":"project-list",children:[t.jsx("div",{className:"flex shrink-0 items-center gap-3 px-9 py-2 text-meta text-ink-muted","aria-hidden":"true",children:ee.map(r=>t.jsx("span",{className:r.className,children:r.label},r.key))}),t.jsx("ul",{className:"min-h-0 flex-1 overflow-y-auto px-6",children:n.map(r=>t.jsxs("li",{children:[t.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 bg-canvas px-3 py-1.5 text-meta","data-project-team":r.team??"",children:[t.jsx("span",{className:"truncate text-ink",children:r.team??ze}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:r.items.length})]}),t.jsx("ul",{className:"divide-y divide-hairline",children:r.items.map(i=>{const l=new Map(Rt(i,typeof navigator>"u"?void 0:navigator.language).map(h=>[h.key,h.text])),o=$t(i.milestones_completed,i.milestones_total),m=We(i.live_sessions);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>a(i),"data-project-name":i.name,className:R("flex w-full items-center gap-3 px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","hover:bg-elevated"),children:[t.jsx("span",{className:R(ee[0].className,"truncate text-body-sm text-ink"),children:le(i)}),t.jsx("span",{className:ee[1].className,children:t.jsx(Qt,{status:i.status})}),t.jsx("span",{className:R(ee[2].className,"truncate text-meta text-ink-muted"),children:l.get("target")??l.get("completed")??""}),t.jsx("span",{className:R(ee[3].className,"truncate text-meta text-ink-muted"),children:l.get("estimate")??""}),t.jsx("span",{className:R(ee[4].className,"truncate text-meta text-ink-muted"),children:o}),t.jsx("span",{className:R(ee[5].className,"truncate text-meta text-ink-muted"),children:m}),t.jsxs("span",{className:R(ee[6].className,"flex items-center gap-2"),children:[t.jsx("span",{className:"truncate text-meta text-ink-muted",children:pr(i,s)}),i.progress_stale&&t.jsx(re,{variant:"warning",children:Ne})]})]})},i.id)})})]},r.team??""))})]})},Se=224,bt=36,gr={day:"Days",week:"Weeks",month:"Months",quarter:"Quarters"},jr=({items:e,nowMs:s,onOpen:a,pendingDetails:n,failedDetails:r,onRetryDetails:i})=>{const[l,o]=x.useState(null),[m,h]=x.useState(0),d=x.useRef(null),b=Yt(s),f=x.useMemo(()=>dn(e,b),[e,b]),u=x.useMemo(()=>un(e),[e]),w=x.useMemo(()=>Qe(u.dated,D=>Ke(D.project)),[u]);x.useLayoutEffect(()=>{const D=d.current;if(!D)return;const M=()=>h(D.clientWidth);if(M(),typeof ResizeObserver>"u")return;const B=new ResizeObserver(M);return B.observe(D),()=>B.disconnect()},[]);const N=Math.max(m-Se-24,160),g=f?ln(ct(f.startMs,f.endMs),N):"month",v=l??g,c=D=>{const M=te.indexOf(v),B=te[M-D];B&&o(B)},_=Ge[v],A=f?ct(f.startMs,f.endMs)*_:0;return t.jsxs("div",{ref:d,className:"flex min-h-0 flex-1 flex-col","data-testid":"project-timeline",children:[t.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-9 py-2",children:[t.jsx("span",{className:"truncate text-meta text-ink-muted","data-timeline-note":!0,children:r>0?`Milestones could not be read for ${r} project${r===1?"":"s"}.`:n>0?`Loading milestones for ${n} project${n===1?"":"s"}…`:`${u.dated.length} dated · ${u.undated.length} without dates`}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[r>0&&t.jsx(L,{variant:"secondary",size:"sm",onClick:i,children:"Try again"}),t.jsx(L,{variant:"secondary",size:"icon","aria-label":"Zoom in",title:"Zoom in (finer)",disabled:!f||v===te[0],onClick:()=>c(1),children:t.jsx(ke,{})}),t.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:gr[v]}),t.jsx(L,{variant:"secondary",size:"icon","aria-label":"Zoom out",title:"Zoom out (coarser)",disabled:!f||v===te[te.length-1],onClick:()=>c(-1),children:t.jsx(Ms,{})})]})]}),f&&u.dated.length>0?t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 pb-6",children:t.jsxs("div",{className:"min-w-max",children:[t.jsx(br,{startMs:f.startMs,endMs:f.endMs,tier:v,pxPerDay:_,trackPx:A}),w.map(D=>t.jsxs("div",{children:[t.jsx("div",{className:"sticky top-0 z-20 flex items-stretch bg-canvas","data-project-team":D.team??"",children:t.jsxs("span",{className:"sticky left-0 z-20 flex shrink-0 items-center gap-2 bg-canvas px-3 py-1 text-meta",style:{width:Se},children:[t.jsx("span",{className:"truncate text-ink",children:D.team??ze}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:D.items.length})]})}),D.items.map(M=>t.jsx(vr,{item:M,spanStart:f.startMs,pxPerDay:_,trackPx:A,today:b,onOpen:()=>a(M)},M.project.id))]},D.team??""))]})}):t.jsx("p",{className:"px-9 py-6 text-body-sm text-ink-muted",children:"No dates on any project yet. Set a start date, a target date or a milestone date and it will appear on the timeline."}),u.undated.length>0&&t.jsxs("div",{className:"shrink-0 px-9 py-2 text-meta text-ink-muted",children:["No dates (",u.undated.length,"):"," ",u.undated.map((D,M)=>t.jsxs("span",{children:[M>0&&", ",t.jsx("button",{type:"button",className:"text-ink hover:underline",onClick:()=>a(D),children:le(D.project)})]},D.project.id))]})]})},br=({startMs:e,endMs:s,tier:a,pxPerDay:n,trackPx:r})=>{const i=vn(e,s,a);return t.jsxs("div",{className:"flex items-stretch",children:[t.jsx("span",{className:"sticky left-0 z-10 shrink-0 bg-canvas",style:{width:Se}}),t.jsx("span",{className:"relative block h-6",style:{width:r},children:i.map(l=>t.jsxs("span",{className:"absolute top-0 h-full",style:{left:ae(e,l.dayMs)*n},children:[t.jsx("span",{className:R("absolute top-0 h-full w-px",l.major?"bg-hairline":"bg-hairline/60"),"aria-hidden":"true"}),t.jsx("span",{className:"absolute top-1/2 left-1 -translate-y-1/2 whitespace-nowrap text-meta text-ink-muted",children:l.label})]},l.dayMs))})]})},vr=({item:e,spanStart:s,pxPerDay:a,trackPx:n,today:r,onOpen:i})=>{const{project:l}=e,o=mn(e),m=hn(e),h=d=>new Date(d).toISOString().slice(0,10);return t.jsxs("button",{type:"button",onClick:i,"data-project-name":l.name,className:"flex w-full items-stretch text-left transition-colors duration-fast ease-out-quart hover:bg-elevated",children:[t.jsx("span",{className:"sticky left-0 z-10 flex shrink-0 items-center gap-2 border-r border-hairline bg-canvas px-3",style:{width:Se,height:bt},children:t.jsx("span",{className:"truncate text-body-sm text-ink",children:le(l)})}),t.jsxs("span",{className:"relative block",style:{width:n,height:bt},children:[o&&t.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:ae(s,o.fromMs)*a,width:(ae(o.fromMs,o.toMs)+1)*a},title:`${X(h(o.fromMs))} → ${X(h(o.toMs))}`}),m.map(d=>t.jsx("span",{"data-milestone":d.status,className:R("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45",d.status==="completed"&&"bg-success",d.status==="overdue"&&"bg-warning",d.status==="upcoming"&&"border-[1.5px] border-ink-muted bg-surface"),style:{left:ae(s,d.dayMs)*a},title:`${d.name} · ${d.status} · ${X(h(d.dayMs))}`},`${d.name}-${d.dayMs}`)),t.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:ae(s,r)*a},"aria-hidden":"true"})]})]})},Gt="projects-view",yr=[{value:"list",label:"List"},{value:"board",label:"Board"},{value:"timeline",label:"Timeline"}];function kr(){try{const e=localStorage.getItem(Gt);if(e==="board"||e==="timeline"||e==="list")return e}catch{}return"list"}function Nr(e){try{localStorage.setItem(Gt,e)}catch{}}const wr=({value:e,onChange:s})=>t.jsx($s,{value:e,onValueChange:a=>s(a),children:t.jsx(Rs,{"aria-label":"Project view","data-tour-tag":"projects-view-switcher",children:yr.map(a=>t.jsx(Ls,{value:a.value,children:a.label},a.value))})}),Sr=["r1","r2","r3","r4","r5","r6"],vt={unpaired:"This app is not paired with the Local Operator server, so Projects are unavailable.","below-version":"The Local Operator server is older than this app expects, so Projects are unavailable. Update the server and try again.",unknown:"The server's capabilities could not be read, so Projects are unavailable."},Mr=({nowMs:e=Date.now()})=>{const{projectId:s}=sa(),a=Te(),n=wt(),r=gs(n.data,"projects",1),i=r==="enabled",l=ha(i),o=pa(),m=Et(),h=Ot(),[d,b]=x.useState(!1),[f,u]=x.useState(()=>kr()),[w,N]=x.useState(()=>La()),[g,v]=x.useState(null),[c,_]=x.useState(null),A=yn(),D=l.data??[],M=x.useMemo(()=>$a(D,w,e),[D,w,e]),B=Ra(w),[Q,C]=x.useState(!1);x.useEffect(()=>{if(!Q)return;const k=document.querySelector('[data-tour-tag="projects-board-window"]');k&&(k.focus(),C(!1))});const O=fa(f==="timeline"?D.map(k=>k.id):[],i),p=D.map((k,Y)=>({project:k,milestones:O[Y]?.data?.project.milestones??[]})),$=f==="timeline"?O.filter(k=>k.isLoading).length:0,E=f==="timeline"?O.filter(k=>k.isError).length:0,T=()=>{for(const k of O)k.isError&&k.refetch()},F=(k,Y)=>{m.mutate({key:k.id,fields:{status:Y}},{onSuccess:()=>{se(`Moved to ${W(Y).label}`),l.refetch().then(()=>A(k.id))}})};return i?s?t.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto overflow-x-hidden p-6 [scrollbar-gutter:stable_both-edges]",children:t.jsx(fr,{projectKey:s,nowMs:e})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"flex shrink-0 flex-col gap-8 px-6 pt-6",children:[t.jsx(tt,{title:"Projects",icon:at,subtitle:"Workstreams you and your agents track across sessions.",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(L,{variant:"secondary",size:"icon","aria-label":"Refresh projects",title:"Refresh projects",disabled:l.isFetching,onClick:()=>void l.refetch(),"data-tour-tag":"refresh-projects-button",children:t.jsx(aa,{})}),t.jsxs(L,{variant:"secondary",onClick:()=>b(!0),"data-tour-tag":"create-project-button",children:[t.jsx(ke,{}),"New project"]})]})}),t.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[t.jsx(wr,{value:f,onChange:k=>{u(k),Nr(k)}}),f==="board"&&!(l.isSuccess&&l.data.length===0)&&t.jsx(on,{value:w,onChange:k=>{N(k),rt(k)}})]})]}),t.jsxs("div",{className:"mt-8 flex min-h-0 flex-1 flex-col",children:[l.isLoading&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[t.jsx("output",{className:"px-9 py-2 text-meta text-ink-dim",children:"Loading projects…"}),Sr.map(k=>t.jsxs("div",{className:"flex items-center gap-3 px-9 py-2","aria-hidden":"true",children:[t.jsx(ce,{className:"h-4 min-w-0 flex-1 bg-elevated"}),t.jsx(ce,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(ce,{className:"h-4 w-32 shrink-0 bg-elevated"}),t.jsx(ce,{className:"h-4 w-16 shrink-0 bg-elevated"}),t.jsx(ce,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(ce,{className:"h-4 w-40 shrink-0 bg-elevated"})]},k))]}),l.isError&&t.jsxs("div",{className:"flex flex-col items-start gap-2 px-6",children:[t.jsx($e,{variant:"danger",children:l.error instanceof Error&&l.error.message?l.error.message:"The projects could not be read."}),t.jsx(L,{variant:"secondary",size:"sm",onClick:()=>void l.refetch(),children:"Try again"})]}),l.isSuccess&&l.data.length===0&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4",children:[t.jsx("p",{className:"text-heading text-ink",children:"No projects yet."}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:"Create one here, or ask an agent to create one and link this session."}),t.jsxs(L,{variant:"primary",onClick:()=>b(!0),"data-tour-tag":"create-project-empty-button",children:[t.jsx(ke,{}),"New project"]})]}),l.isSuccess&&l.data.length>0&&f==="list"&&t.jsx(xr,{projects:l.data,nowMs:e,onOpen:k=>void a(`/projects/${k.id}`)}),l.isSuccess&&l.data.length>0&&f==="board"&&M.length>0&&t.jsx(Nn,{projects:M,nowMs:e,onOpen:k=>void a(`/projects/${k.id}`),onEdit:v,onDelete:_,onMove:F,movingKeys:m.isPending&&m.variables?[m.variables.key]:[]}),l.isSuccess&&l.data.length>0&&f==="board"&&M.length===0&&B!==null&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4",children:[t.jsx("p",{className:"text-heading text-ink",children:B}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:"Older projects are hidden by the window."}),t.jsx(L,{variant:"secondary",onClick:()=>{N("all"),rt("all"),C(!0)},children:"Show all time"})]}),l.isSuccess&&l.data.length>0&&f==="timeline"&&t.jsx(jr,{items:p,nowMs:e,onOpen:k=>void a(`/projects/${k.project.id}`),pendingDetails:$,failedDetails:E,onRetryDetails:T})]}),t.jsx(Be,{open:g!==null,mode:"edit",initial:g?{key:g.id,name:g.name,title:g.title,owner:g.owner,team:g.team,description:g.description,status:g.status,tags:g.tags,start_date:g.start_date,target_date:g.target_date,estimate:g.estimate,estimate_unit:g.estimate_unit}:null,onClose:()=>v(null),onSubmit:async k=>{k.mode==="edit"&&(await m.mutateAsync({key:k.key,fields:k.fields}),se("Project saved"),v(null))}}),t.jsx(qt,{open:c!==null,projectName:c?.name??"",onClose:()=>_(null),onConfirm:async k=>{c&&(await h.mutateAsync({key:c.id,confirmedName:k}),se("Project deleted"),_(null))}}),t.jsx(Be,{open:d,mode:"create",onClose:()=>b(!1),onSubmit:async k=>{if(k.mode!=="create")return;const Y=await o.mutateAsync(k.fields),G=k.followUp?.title??k.fields.name;if(k.followUp)try{await m.mutateAsync({key:Y.id,fields:k.followUp})}catch(J){const j=J instanceof Error&&J.message?J.message:"";V(`Project ${G} was created, but the extra fields were not saved: ${Bt(j)||"the server refused them."} Open the project and use Edit to set them.`);return}se(`Project ${G} created`)}})]}):t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx(tt,{title:"Projects",icon:at}),n.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(de,{label:"Checking the server's Projects support"})}):t.jsx($e,{variant:"warning",children:vt[r]??vt.unknown})]})};export{Mr as ProjectsPage};
|
|
35
|
+
`).trim()}const Jn=[{value:"planning",label:"Planning"},{value:"active",label:"Active"},{value:"qa",label:"QA"},{value:"validation",label:"Validation"},{value:"done",label:"Done"},{value:"paused",label:"Paused"},{value:"archived",label:"Archived"}],Ue={name:"",title:"",owner:"",team:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},xt=Mt;function gt(e){return e.split(",").map(s=>s.trim()).filter(s=>s.length>0)}function Zn(e){return e?{name:e.name,title:e.title??"",owner:e.owner??"",team:e.team??"",description:e.description,status:e.status,tags:e.tags.join(", "),startDate:e.start_date??"",targetDate:e.target_date??"",estimate:e.estimate===null||e.estimate===void 0?"":String(e.estimate),estimateUnit:e.estimate_unit||"points"}:Ue}const Be=({open:e,mode:s,initial:a,onClose:n,onSubmit:r})=>{const[i,l]=x.useState(Ue),[o,m]=x.useState({}),[h,d]=x.useState(null),b=x.useRef(null),[f,u]=x.useState(!1),[w,N]=x.useState(s==="edit"),[g,v]=x.useState(!1),c=x.useId(),_=x.useRef(null);x.useEffect(()=>{e&&(l(s==="create"?{...Ue,description:mt}:Zn(a)),m({}),d(null),u(!1),N(s==="edit"),v(!1))},[e]),x.useEffect(()=>{h&&b.current?.scrollIntoView({block:"nearest"})},[h]);const P=(p,$)=>{l(E=>({...E,[p]:$}))},D=s==="create"&&!w?Pn(i.title):i.name,A=p=>{const $=p.clipboardData?.getData("text/html");if(!$)return;const E=Xn($);if(!E)return;p.preventDefault();const T=p.currentTarget,F=T.selectionStart??T.value.length,k=T.selectionEnd??F,Y=T.value.slice(0,F)+E+T.value.slice(k);P("description",Y),requestAnimationFrame(()=>{const G=_.current;if(!G)return;const J=F+E.length;G.setSelectionRange(J,J)})},B=(p,$)=>{const E={},T=us($);T&&(E.name=T),p.description.length>pe&&(E.description=`Keep the description within ${pe} characters.`);const F=gt(p.tags);if(F.length>8)E.tags="At most 8 tags.";else for(const k of F){const Y=ms(k);if(Y){E.tags=Y;break}}if(xt.test(p.startDate)||(E.startDate="Dates are YYYY-MM-DD, or empty."),xt.test(p.targetDate)||(E.targetDate="Dates are YYYY-MM-DD, or empty."),!E.startDate&&!E.targetDate&&p.startDate&&p.targetDate&&p.targetDate<p.startDate&&(E.targetDate="The target date is before the start date."),p.estimate){const k=Number(p.estimate);(!Number.isFinite(k)||!(k>0)||k>1e3)&&(E.estimate="Estimates are greater than 0 and at most 1000.")}for(const k of["title","owner","team"])p[k].trim().length>80&&(E[k]=`${k==="title"?"Titles":k==="owner"?"Owners":"Teams"} are at most 80 characters.`);return E},Q=async()=>{const p=D.trim(),$=B(i,p);if(m($),Object.keys($).length>0)return;u(!0),d(null);const E=gt(i.tags);try{if(s==="create"){const T={};i.title.trim()&&(T.title=i.title.trim()),i.owner.trim()&&(T.owner=i.owner.trim()),i.team.trim()&&(T.team=i.team.trim()),i.startDate&&(T.start_date=i.startDate),i.targetDate&&(T.target_date=i.targetDate),i.estimate&&(T.estimate=Number(i.estimate),T.estimate_unit=i.estimateUnit),await r({mode:"create",fields:{name:p,...i.description.trim()&&i.description.trim()!==mt?{description:i.description.trim()}:{},status:i.status,...E.length>0?{tags:E}:{}},...Object.keys(T).length>0?{followUp:T}:{}})}else await r({mode:"edit",key:a?.key??"",fields:{name:p,description:i.description.trim(),title:i.title.trim(),owner:i.owner.trim(),team:i.team.trim(),status:i.status,tags:E,start_date:i.startDate,target_date:i.targetDate,...i.estimate?{estimate:Number(i.estimate)}:{},estimate_unit:i.estimateUnit}});n()}catch(T){const F=T instanceof Error&&T.message?T.message:"";d(Bt(F)||"The project was not saved.")}finally{u(!1)}},C=s==="create"?"New project":"Edit project",O=i.description.length>pe;return t.jsx(_e,{open:e,onClose:n,title:C,fullWidth:!0,maxWidth:"md",dialogProps:{closeDisabled:f,onEscapeKeyDown:p=>{f&&p.preventDefault()},onInteractOutside:p=>{f&&p.preventDefault()}},dataTourTag:s==="create"?"project-create-dialog":"project-edit-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(De,{onClick:n,disabled:f,children:"Cancel"}),t.jsxs(Dt,{"data-project-submit":"",onClick:()=>void Q(),disabled:f,children:[f&&t.jsx(de,{size:"xs"}),s==="create"?"Create project":"Save changes"]})]}),children:t.jsxs("form",{className:"flex flex-col gap-6 px-1 py-1",onSubmit:p=>{p.preventDefault(),Q()},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-title`,children:"Title"}),t.jsx(z,{id:`${c}-title`,"data-project-title":"",value:i.title,onChange:p=>P("title",p.target.value),placeholder:"Payments migration",autoFocus:!0,className:"h-10 text-heading","aria-invalid":!!o.title}),o.title&&t.jsx("p",{className:"text-meta text-danger",children:o.title}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(q,{htmlFor:`${c}-key`,className:"shrink-0 text-meta text-ink-muted",children:"Key"}),t.jsx(z,{id:`${c}-key`,"data-project-key":"",value:D,onChange:p=>{N(!0),P("name",p.target.value)},placeholder:"payments-migration","aria-invalid":!!o.name,className:"h-7 max-w-56 font-mono text-mono-sm"}),t.jsx("span",{className:"text-meta text-ink-muted",children:s==="create"&&!w?"Derived from the title until you edit it.":"Letters, digits, dot, underscore or dash; no spaces."})]}),o.name&&t.jsx("p",{className:"text-meta text-danger",children:o.name})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(q,{htmlFor:`${c}-description`,children:"Description"}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:"Description mode"}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:["write","preview"].map(p=>t.jsx("button",{type:"button","data-project-description-mode":p,"aria-pressed":g===(p==="preview"),onClick:()=>v(p==="preview"),className:R("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",g===(p==="preview")&&"bg-surface text-ink"),children:p==="write"?"Write":"Preview"},p))})]})]}),g?t.jsx("div",{"data-project-description-preview":"",className:"h-44 overflow-y-auto rounded-md border border-hairline bg-sunken px-3 py-2",children:i.description.trim()?t.jsx(we,{className:"text-body-sm",children:i.description}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:"Nothing to preview yet."})}):t.jsx(Es,{ref:_,id:`${c}-description`,"data-project-description":"",value:i.description,onChange:p=>P("description",p.target.value),onPaste:A,rows:8,placeholder:"Markdown — headings, lists, code.","aria-invalid":O||!!o.description,className:"h-44 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.description?t.jsx("p",{className:"text-meta text-danger",children:o.description}):t.jsx("span",{}),t.jsxs("p",{className:R("text-meta tabular-nums",O?"text-danger":"text-ink-muted"),children:[i.description.length,"/",pe]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{children:"Status"}),t.jsxs(je,{value:i.status,onValueChange:p=>P("status",p),children:[t.jsx(be,{"aria-label":"Status",children:t.jsx(ve,{})}),t.jsx(ye,{children:Jn.map(p=>t.jsx(ue,{value:p.value,children:p.label},p.value))})]}),i.status==="done"&&t.jsx("p",{className:"text-meta text-ink-muted",children:"Moving a project to Done stamps today as its completion date."})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-owner`,children:"Owner"}),t.jsx(z,{id:`${c}-owner`,"data-project-owner":"",value:i.owner,onChange:p=>P("owner",p.target.value),placeholder:"atlas","aria-invalid":!!o.owner}),o.owner&&t.jsx("p",{className:"text-meta text-danger",children:o.owner})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-team`,children:"Team"}),t.jsx(z,{id:`${c}-team`,value:i.team,onChange:p=>P("team",p.target.value),placeholder:"platform","aria-invalid":!!o.team}),o.team&&t.jsx("p",{className:"text-meta text-danger",children:o.team})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-target`,children:"Target date"}),t.jsx(z,{id:`${c}-target`,"data-project-target":"",value:i.targetDate,onChange:p=>P("targetDate",p.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!o.targetDate}),o.targetDate&&t.jsx("p",{className:"text-meta text-danger",children:o.targetDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-start`,children:"Start date"}),t.jsx(z,{id:`${c}-start`,value:i.startDate,onChange:p=>P("startDate",p.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!o.startDate}),o.startDate&&t.jsx("p",{className:"text-meta text-danger",children:o.startDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-estimate`,children:"Estimate"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(z,{id:`${c}-estimate`,value:i.estimate,onChange:p=>P("estimate",p.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!o.estimate,className:"max-w-28"}),t.jsxs(je,{value:i.estimateUnit,onValueChange:p=>P("estimateUnit",p),children:[t.jsx(be,{"aria-label":"Estimate unit",className:"max-w-32",children:t.jsx(ve,{})}),t.jsxs(ye,{children:[t.jsx(ue,{value:"points",children:"Points"}),t.jsx(ue,{value:"days",children:"Days"})]})]})]}),o.estimate&&t.jsx("p",{className:"text-meta text-danger",children:o.estimate}),s==="edit"&&i.estimate.trim()===""&&a?.estimate!==null&&a?.estimate!==void 0&&t.jsx("p",{className:"text-meta text-ink-muted",children:"Clearing an estimate is not supported yet — saving keeps its current value."})]}),t.jsxs("div",{className:"col-span-2 flex flex-col gap-1.5",children:[t.jsx(q,{htmlFor:`${c}-tags`,children:"Tags"}),t.jsx(z,{id:`${c}-tags`,value:i.tags,onChange:p=>P("tags",p.target.value),placeholder:"q4, payments","aria-invalid":!!o.tags}),o.tags?t.jsx("p",{className:"text-meta text-danger",children:o.tags}):t.jsx("p",{className:"text-meta text-ink-muted",children:"Comma-separated, up to 8. Lowercase letters, digits, underscore or dash."})]})]}),h&&t.jsx("p",{ref:b,className:"text-body-sm text-danger",children:h})]})})},er=({links:e,target:s,onTargetChange:a,onSend:n,focusTick:r})=>{const[i,l]=x.useState(""),[o,m]=x.useState(!1),h=x.useRef(null);x.useEffect(()=>{r>0&&h.current?.focus()},[r]);const d=e.filter(N=>N.exists),f=(d.find(N=>N.session_id===s)??null)?.runtime?.busy===!0,u=!!s&&i.trim().length>0&&!o,w=async()=>{if(!(!u||!s)){m(!0);try{await n(s,i.trim(),f?"steer":"prompt")&&l("")}finally{m(!1),h.current?.focus()}}};return t.jsxs("div",{className:"flex flex-col gap-2 rounded-md bg-elevated p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-meta text-ink-muted",children:"Send to"}),t.jsxs(je,{value:s??void 0,onValueChange:N=>a(N),children:[t.jsx(be,{"aria-label":"Select the session to message",className:"max-w-72",children:t.jsx(ve,{placeholder:"No session selected"})}),t.jsx(ye,{children:d.map(N=>t.jsx(ue,{value:N.session_id,children:He(N)},N.session_id))})]}),f&&t.jsx("span",{className:"text-meta text-ink-muted",children:"The session is working — this message steers the running turn."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(z,{ref:h,"aria-label":"Message the selected session",placeholder:"Message the session",value:i,onChange:N=>l(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),w())}}),t.jsxs(L,{variant:"secondary",disabled:!u,onClick:()=>void w(),"data-tour-tag":"project-quick-send",children:[o?t.jsx(de,{size:"xs"}):t.jsx(ua,{}),"Send"]})]})]})},tr=({links:e,busy:s,onUnlink:a,onLink:n,onQuickSend:r,onStartSession:i})=>{const l=Te(),o=ge(v=>v.sessions),[m,h]=x.useState(!1),[d,b]=x.useState(null),[f,u]=x.useState(0),w=d&&e.some(v=>v.session_id===d&&v.exists)?d:sn(e),N=x.useMemo(()=>{const v=new Set(e.map(c=>c.session_id));return o.filter(c=>!v.has(c.session_id)).map(c=>({id:c.session_id,name:c.title||c.session_id,description:c.cwd??void 0}))},[o,e]),g=v=>{ge.getState().openSession(v).then(c=>{c&&l(`/chat/${v}`)})};return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Linked sessions"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(L,{variant:"secondary",size:"sm",disabled:s,onClick:i,"data-tour-tag":"project-start-session",children:[t.jsx(Ws,{}),"New session"]}),t.jsxs(L,{variant:"secondary",size:"sm",disabled:s,onClick:()=>h(!0),"data-tour-tag":"project-link-session",children:[t.jsx(ca,{}),"Link session"]})]})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No sessions linked yet. Link the conversations that are working on this project so its progress stays with them."}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(v=>{const c=Ea(v),_=Oa(v.subagents),P=Ma(v.todos),D=v.title||v.session_id,A=v.exists;return t.jsxs("li",{className:R("flex items-center gap-2 rounded-sm px-2 py-2",A&&"hover:bg-row-hover"),children:[t.jsx("button",{type:"button",disabled:!A,onClick:()=>{A&&g(v.session_id)},className:R("flex min-w-0 flex-1 items-center gap-2 text-left",A?"cursor-pointer":"cursor-default opacity-100"),children:t.jsx("span",{className:R("min-w-0 truncate text-body-sm",v.title?"text-ink":"font-mono text-mono-sm text-ink-muted"),children:D})}),v.runtime?.busy===!0&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:"busy"}),_&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:_}),P&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:P}),t.jsx(re,{variant:c.variant,children:c.label}),A&&t.jsx(L,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Message ${D}`,title:`Message ${D}`,onClick:()=>{b(v.session_id),u(B=>B+1)},children:t.jsx(zs,{})}),t.jsx(L,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Unlink ${D}`,onClick:()=>a(v.session_id),children:t.jsx(ha,{})})]},v.session_id)})}),e.length>0&&t.jsx(er,{links:e,target:w,onTargetChange:b,onSend:r,focusTick:f}),t.jsx(_e,{open:m,onClose:()=>h(!1),title:"Link a session",maxWidth:"sm",dataTourTag:"project-link-dialog",actions:t.jsx(De,{onClick:()=>h(!1),children:"Close"}),children:t.jsxs("div",{className:"flex flex-col gap-2 px-1 py-1",children:[t.jsx(q,{children:"Session"}),t.jsx(Tt,{showLabel:!1,ariaLabel:"Search sessions",busyLabel:"Loading sessions",placeholder:"Search conversations",options:N,selected:null,onSelect:v=>{h(!1),n(v.id)}}),t.jsx("p",{className:"text-meta text-ink-muted",children:"Conversations already linked to this project are not listed."})]})})]})},sr=({milestones:e,summary:s,busy:a,onToggle:n,onRemove:r,onAdd:i})=>{const[l,o]=x.useState(""),[m,h]=x.useState(""),d=!Mt.test(m.trim()),b=l.trim().length>0&&!d&&!a,f=()=>{b&&(i(l.trim(),m.trim()),o(""),h(""))};return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Milestones"}),s&&e.length>0&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:s})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No milestones yet. Add one below to mark the dates this project is planned around."}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(u=>{const w=wa(u.status),N=u.completed_at!==null;return t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx(Os,{checked:N,disabled:a,onCheckedChange:g=>n(u.name,g===!0),"aria-label":N?`Mark ${u.name} not complete`:`Mark ${u.name} complete`}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:u.name}),u.target_date&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:X(u.target_date,typeof navigator>"u"?void 0:navigator.language)}),t.jsx(re,{variant:w.variant,children:w.label}),t.jsx(L,{variant:"ghost",size:"icon-sm",disabled:a,"aria-label":`Remove ${u.name}`,onClick:()=>r(u.name),children:t.jsx(Ms,{})})]},u.name)})}),t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[t.jsx(q,{htmlFor:"project-milestone-name",children:"New milestone"}),t.jsx(z,{id:"project-milestone-name",value:l,onChange:u=>o(u.target.value),placeholder:"beta cut",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),f())}})]}),t.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[t.jsx(q,{htmlFor:"project-milestone-date",children:"Target date"}),t.jsx(z,{id:"project-milestone-date",value:m,onChange:u=>h(u.target.value),placeholder:"YYYY-MM-DD","aria-invalid":d}),d&&t.jsx("p",{className:"text-meta text-danger",children:"Dates are YYYY-MM-DD, or empty."})]}),t.jsxs(L,{variant:"secondary",disabled:!b,onClick:f,"data-tour-tag":"project-milestone-add",children:[t.jsx(ke,{}),"Add"]})]})]})},ar=({project:e,nowMs:s})=>{const a=typeof navigator>"u"?void 0:navigator.language,n=new Date(s),r=[],i=X(e.start_date,a,n);i&&r.push({label:"Start",value:i});const l=X(e.target_date,a,n);l&&r.push({label:"Target",value:l});const o=X(e.completed_at,a,n);o&&r.push({label:"Completed",value:o});const m=At(e.estimate,e.estimate_unit);if(m&&r.push({label:"Estimate",value:m}),e.tags.length>0&&r.push({label:"Tags",value:t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:e.tags.map(h=>t.jsx(re,{variant:"outline",children:h},h))})}),e.updated_at>0){const h=fe(he(e.updated_at,s)),d=new Date(e.updated_at*1e3).toLocaleString(a);r.push({label:"Updated",value:t.jsx("time",{dateTime:new Date(e.updated_at*1e3).toISOString(),title:d,children:h})})}return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Properties"}),r.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No dates, estimate or tags yet."}):t.jsx("dl",{className:"flex flex-col gap-2",children:r.map(h=>t.jsxs("div",{className:"flex items-baseline gap-3",children:[t.jsx("dt",{className:"w-24 shrink-0 text-body-sm text-ink-muted",children:h.label}),t.jsx("dd",{className:"min-w-0 text-body-sm text-ink",children:h.value})]},h.label))})]})},Wt="plain",zt=e=>`team:${e}`,Kt=e=>`agent:${e}`;function nr(e){return e.startsWith("team:")?{kind:"team",name:e.slice(5)}:e.startsWith("agent:")?{kind:"agent",name:e.slice(6)}:{kind:"plain"}}function rr(e){return e.kind==="team"?zt(e.name):e.kind==="agent"?Kt(e.name):Wt}const jt={kind:"plain"},ir=({open:e,onClose:s,onStart:a,teamsEnabled:n,profilesEnabled:r})=>{const[i,l]=x.useState(jt),[o,m]=x.useState(null),[h,d]=x.useState(!1),b=Ks(e&&n),f=Qs(e&&r);x.useEffect(()=>{e&&(l(jt),m(null),d(!1))},[e]);const u=x.useMemo(()=>{const c=[{id:Wt,name:"Nothing in particular",description:"A plain session; assign a team or agent later.",group:"Plain"}];for(const _ of b.data??[])c.push({id:zt(_.name),name:_.name,description:`Team · manager: ${_.manager}`,group:"Teams"});for(const _ of(f.data??[]).filter(P=>P.source!=="builtin"))c.push({id:Kt(_.name),name:_.name,description:_.description||_.kind,group:"Agents"});return c},[b.data,f.data]),w=u.find(c=>c.id===rr(i))??u[0],N=!n||!r,g=b.isLoading||f.isLoading,v=async()=>{d(!0),m(null);try{await a(i),s()}catch(c){m(c instanceof Error&&c.message?c.message:"The session could not be started.")}finally{d(!1)}};return t.jsx(_e,{open:e,onClose:s,title:"Start a session",maxWidth:"sm",dataTourTag:"project-start-session-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(De,{onClick:s,disabled:h,children:"Cancel"}),t.jsxs(Dt,{onClick:()=>void v(),disabled:h,children:[h&&t.jsx(de,{size:"xs"}),"Start session"]})]}),children:t.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[t.jsx(Tt,{label:"Work with",placeholder:"Search teams and agents",options:u,selected:w,onSelect:c=>l(nr(c.id)),busy:g,busyLabel:"Loading teams and agents"}),t.jsx("p",{className:"text-meta text-ink-muted",children:"The session starts now, links itself to this project, and opens with a prompt you can edit before sending."}),N&&t.jsx("p",{className:"text-meta text-ink-muted",children:"This server does not offer the team or agent catalogues yet, so only a plain session can be started."}),o&&t.jsx("p",{className:"text-body-sm text-danger",children:o})]})})},Qt=({status:e})=>{const s=W(e);return t.jsxs(re,{variant:s.variant,children:[ka(e)&&t.jsx(Ps,{"aria-hidden":!0}),s.label]})},or=({links:e})=>{const s=tn(e),a=e.filter(n=>n.todos!==null);return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"To-dos"}),s&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:ot(s)})]}),a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No to-do snapshots from the linked sessions yet. A session publishes its list as it works, and it appears here once it has."}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:a.map(n=>t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx("span",{className:n.title?"min-w-0 flex-1 truncate text-body-sm text-ink":"min-w-0 flex-1 truncate font-mono text-mono-sm text-ink-muted",children:He(n)}),n.todos&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:ot(n.todos)})]},n.session_id))})]})},lr=/[/\\]/;function Ht(e){if(e.name)return e.name;const s=e.path.split(lr);return s[s.length-1]||"Attachment"}const cr=({attachment:e})=>{const s=Ht(e),a=Za(e.bytes);return t.jsxs("div",{className:"flex w-fit max-w-full items-center gap-2.5 rounded-sm border border-hairline bg-surface px-3 py-2",children:[t.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2.5 text-left",onClick:()=>{window.api?.openFile(e.path)},title:`Open ${s}`,children:[t.jsx(Zs,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),t.jsx("span",{className:"truncate text-body-sm text-ink",children:s})]}),a&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:a}),t.jsx(ea,{filePath:e.path,"aria-label":`File actions for ${s}`})]})},dr=({attachment:e})=>{const s=Ht(e),a=Hs(e.path,{mimeType:Gs(e.name||e.path),sizeBytes:e.bytes});return a.status==="ready"?t.jsx("div",{className:"inline-block max-w-full",children:t.jsx(Vs,{file:e.path,src:a.url,label:s,conversationId:""})}):a.status==="loading"?t.jsx(Xs,{children:t.jsxs("span",{className:"sr-only",children:["Loading ",s]})}):t.jsx(Js,{name:s})},ur=({attachments:e})=>t.jsx("div",{className:"flex flex-wrap items-start gap-2",children:e.map(s=>s.kind==="image"?t.jsx(dr,{attachment:s},`${s.path}:${s.added_at}`):t.jsx(cr,{attachment:s},`${s.path}:${s.added_at}`))}),mr=({update:e,nowMs:s})=>{const a=typeof navigator>"u"?void 0:navigator.language,n=Xa(e,a,s);return t.jsxs("article",{className:"flex flex-col gap-2 rounded-sm px-2 py-3",children:[n.length>0&&t.jsx("p",{className:"flex flex-wrap items-baseline gap-x-2 text-meta text-ink-muted",children:n.map((r,i)=>t.jsxs(x.Fragment,{children:[i>0&&t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:r.text})]},r.key))}),e.text&&t.jsx(we,{children:e.text}),e.attachments.length>0&&t.jsx(ur,{attachments:e.attachments})]})},hr=({updates:e,nowMs:s})=>{const a=typeof navigator>"u"?void 0:navigator.language,n=Ka(e.length),r=Ja(e,a,new Date(s));return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:"Updates"}),n&&t.jsx("span",{className:"text-meta text-ink-muted",children:n})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:"No updates yet. Progress reported by you or by the sessions working on this project is appended here."}):t.jsx("div",{className:"flex flex-col gap-4",children:r.map(i=>t.jsxs("div",{className:"flex flex-col gap-2",children:[i.label&&t.jsx("h3",{className:"text-meta text-ink-muted",children:i.label}),t.jsx("div",{className:"flex flex-col divide-y divide-hairline",children:i.entries.map((l,o)=>t.jsx(mr,{update:l,nowMs:s},`${l.at}:${l.by}:${o}`))})]},i.key||"ungrouped"))})]})},fr="project_not_found",pr=({projectKey:e,nowMs:s})=>{const a=Te(),n=wt(),r=Ct(e,!0),i=Et(),l=Ot(),o=ba(),m=va(),h=ga(),d=ja(),[b,f]=x.useState(!1),[u,w]=x.useState(!1),[N,g]=x.useState(!1),v=i.isPending||l.isPending||o.isPending||m.isPending||h.isPending||d.isPending;if(r.isLoading)return t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(de,{label:"Loading project"})});if(r.isError||!r.data){const C=r.error instanceof hs&&(r.error.code===fr||r.error.status===404);return t.jsxs("div",{className:"mx-auto flex w-full max-w-200 flex-col items-start gap-4",children:[t.jsx($e,{variant:"danger",className:"w-full",children:C?"This project could not be found. It may have been deleted.":r.error instanceof Error&&r.error.message?r.error.message:"The project could not be read."}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(L,{variant:"secondary",onClick:()=>void r.refetch(),children:"Try again"}),t.jsxs(L,{variant:"secondary",onClick:()=>void a("/projects"),children:[t.jsx(st,{}),"All projects"]})]})]})}const{project:c,links:_}=r.data,P=le(c),D=Wa(c.owner,c.team),A=en(c.milestones.filter(C=>C.completed_at!==null).length,c.milestones.length),B=async(C,O,p)=>{const $=ge.getState(),E=fs(null,C,$.drafts);if(!E)return!1;try{if(await ps(E,{text:O,attachments:[],images:[],mode:p,cwd:$.cwd},C)===null)return V("That session already has a message going out. Try again in a moment."),!1;const F=_.find(k=>k.session_id===C);return se(`Sent to ${F?He(F):C}`),!0}catch(T){return V(T instanceof Error&&T.message?T.message:"The message was not sent."),!1}},Q=async C=>{const O=ge.getState(),p=C.kind==="plain"?void 0:{kind:C.kind,name:C.name},$=await O.createSession(O.cwd||"~",p);if(!$)throw new Error(O.error??"The session could not be started.");xs.getState().setCurrentInput($,an(c));let E=null;try{await h.mutateAsync({key:c.id,sessionId:$})}catch(T){E=T instanceof Error&&T.message?T.message:"the link was refused"}if(E)V(`Session started, but linking it failed: ${E}`);else{const T=p?` with ${nn(p)}`:"";se(`Session started${T} and linked to ${P}.`)}await _t(a,$)};return t.jsxs("div",{className:"mx-auto flex w-full max-w-200 flex-col gap-8",children:[t.jsxs("header",{className:"flex flex-col gap-4",children:[t.jsxs("button",{type:"button",onClick:()=>void a("/projects"),className:"flex w-fit items-center gap-1.5 text-body-sm text-ink-muted hover:text-ink",children:[t.jsx(st,{className:"size-4"}),"All projects"]}),t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h1",{"data-project-title":c.name,className:"min-w-0 break-words text-display text-ink",children:P}),t.jsx(Qt,{status:c.status}),c.progress_stale&&t.jsx(re,{variant:"warning",children:Ne})]}),c.title&&t.jsx("p",{className:"font-mono text-mono-sm text-ink-muted",children:c.name}),D&&t.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Managed by ",D]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(L,{variant:"secondary",onClick:()=>f(!0),"data-tour-tag":"project-edit",children:[t.jsx(ta,{}),"Edit"]}),t.jsxs(L,{variant:"secondary",onClick:()=>w(!0),"data-tour-tag":"project-delete",children:[t.jsx(sa,{}),"Delete"]})]})]})]}),c.description.trim()&&t.jsx(we,{className:"text-body",children:c.description}),t.jsx(ar,{project:c,nowMs:s}),c.updates.length===0&&c.progress&&t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h2",{className:"text-title text-ink",children:"Progress"}),t.jsx(we,{className:"text-body",children:c.progress}),t.jsx("p",{className:"text-meta text-ink-muted",children:_a(c,s)})]}),t.jsx(sr,{milestones:c.milestones,summary:A,busy:v,onToggle:(C,O)=>{o.mutateAsync({key:c.id,name:C,completed:O}).catch(p=>{V(p instanceof Error&&p.message?p.message:"The milestone was not updated.")})},onRemove:C=>{m.mutateAsync({key:c.id,name:C}).catch(O=>{V(O instanceof Error&&O.message?O.message:"The milestone was not removed.")})},onAdd:(C,O)=>{o.mutateAsync({key:c.id,name:C,targetDate:O}).catch(p=>{V(p instanceof Error&&p.message?p.message:"The milestone was not added.")})}}),t.jsx(tr,{projectKey:c.id,links:_,busy:v,onStartSession:()=>g(!0),onQuickSend:B,onLink:C=>{h.mutateAsync({key:c.id,sessionId:C}).catch(O=>{V(O instanceof Error&&O.message?O.message:"The session was not linked.")})},onUnlink:C=>{d.mutateAsync({key:c.id,sessionId:C}).catch(O=>{V(O instanceof Error&&O.message?O.message:"The session was not unlinked.")})}}),t.jsx(or,{links:_}),t.jsx(hr,{updates:c.updates,nowMs:s}),t.jsx(Be,{open:b,mode:"edit",initial:{key:c.id,name:c.name,title:c.title,owner:c.owner,team:c.team,description:c.description,status:c.status,tags:c.tags,start_date:c.start_date,target_date:c.target_date,estimate:c.estimate,estimate_unit:c.estimate_unit},onClose:()=>f(!1),onSubmit:async C=>{C.mode==="edit"&&(await i.mutateAsync({key:C.key,fields:C.fields}),se("Project saved"))}}),t.jsx(qt,{open:u,projectName:c.name,onClose:()=>w(!1),onConfirm:async C=>{await l.mutateAsync({key:c.id,confirmedName:C}),se("Project deleted"),a("/projects")}}),t.jsx(ir,{open:N,onClose:()=>g(!1),onStart:Q,teamsEnabled:et(n.data,"team_catalogue"),profilesEnabled:et(n.data,"profile_catalogue")})]})},ee=[{key:"name",label:"Project",className:"min-w-0 flex-1"},{key:"status",label:"Status",className:"w-20 shrink-0"},{key:"target",label:"Target",className:"hidden w-32 shrink-0 @[40rem]:block"},{key:"estimate",label:"Estimate",className:"hidden w-16 shrink-0 @[40rem]:block"},{key:"milestones",label:"Milestones",className:"hidden w-20 shrink-0 @[34rem]:block"},{key:"live",label:"Live",className:"hidden w-14 shrink-0 @[34rem]:block"},{key:"progress",label:"Progress",className:"w-40 shrink-0"}];function xr(e,s){const a=he(e.progress_updated_at,s);return a?fe(a):"not reported"}const gr=({projects:e,nowMs:s,onOpen:a})=>{const n=Qe(e,Ke);return t.jsxs("div",{className:"@container flex min-h-0 flex-1 flex-col","data-testid":"project-list",children:[t.jsx("div",{className:"flex shrink-0 items-center gap-3 px-9 py-2 text-meta text-ink-muted","aria-hidden":"true",children:ee.map(r=>t.jsx("span",{className:r.className,children:r.label},r.key))}),t.jsx("ul",{className:"min-h-0 flex-1 overflow-y-auto px-6",children:n.map(r=>t.jsxs("li",{children:[t.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 bg-canvas px-3 py-1.5 text-meta","data-project-team":r.team??"",children:[t.jsx("span",{className:"truncate text-ink",children:r.team??ze}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:r.items.length})]}),t.jsx("ul",{className:"divide-y divide-hairline",children:r.items.map(i=>{const l=new Map(Rt(i,typeof navigator>"u"?void 0:navigator.language).map(h=>[h.key,h.text])),o=$t(i.milestones_completed,i.milestones_total),m=We(i.live_sessions);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>a(i),"data-project-name":i.name,className:R("flex w-full items-center gap-3 px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","hover:bg-elevated"),children:[t.jsx("span",{className:R(ee[0].className,"truncate text-body-sm text-ink"),children:le(i)}),t.jsx("span",{className:ee[1].className,children:t.jsx(Qt,{status:i.status})}),t.jsx("span",{className:R(ee[2].className,"truncate text-meta text-ink-muted"),children:l.get("target")??l.get("completed")??""}),t.jsx("span",{className:R(ee[3].className,"truncate text-meta text-ink-muted"),children:l.get("estimate")??""}),t.jsx("span",{className:R(ee[4].className,"truncate text-meta text-ink-muted"),children:o}),t.jsx("span",{className:R(ee[5].className,"truncate text-meta text-ink-muted"),children:m}),t.jsxs("span",{className:R(ee[6].className,"flex items-center gap-2"),children:[t.jsx("span",{className:"truncate text-meta text-ink-muted",children:xr(i,s)}),i.progress_stale&&t.jsx(re,{variant:"warning",children:Ne})]})]})},i.id)})})]},r.team??""))})]})},Se=224,bt=36,jr={day:"Days",week:"Weeks",month:"Months",quarter:"Quarters"},br=({items:e,nowMs:s,onOpen:a,pendingDetails:n,failedDetails:r,onRetryDetails:i})=>{const[l,o]=x.useState(null),[m,h]=x.useState(0),d=x.useRef(null),b=Yt(s),f=x.useMemo(()=>un(e,b),[e,b]),u=x.useMemo(()=>mn(e),[e]),w=x.useMemo(()=>Qe(u.dated,D=>Ke(D.project)),[u]);x.useLayoutEffect(()=>{const D=d.current;if(!D)return;const A=()=>h(D.clientWidth);if(A(),typeof ResizeObserver>"u")return;const B=new ResizeObserver(A);return B.observe(D),()=>B.disconnect()},[]);const N=Math.max(m-Se-24,160),g=f?cn(ct(f.startMs,f.endMs),N):"month",v=l??g,c=D=>{const A=te.indexOf(v),B=te[A-D];B&&o(B)},_=Ge[v],P=f?ct(f.startMs,f.endMs)*_:0;return t.jsxs("div",{ref:d,className:"flex min-h-0 flex-1 flex-col","data-testid":"project-timeline",children:[t.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-9 py-2",children:[t.jsx("span",{className:"truncate text-meta text-ink-muted","data-timeline-note":!0,children:r>0?`Milestones could not be read for ${r} project${r===1?"":"s"}.`:n>0?`Loading milestones for ${n} project${n===1?"":"s"}…`:`${u.dated.length} dated · ${u.undated.length} without dates`}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[r>0&&t.jsx(L,{variant:"secondary",size:"sm",onClick:i,children:"Try again"}),t.jsx(L,{variant:"secondary",size:"icon","aria-label":"Zoom in",title:"Zoom in (finer)",disabled:!f||v===te[0],onClick:()=>c(1),children:t.jsx(ke,{})}),t.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:jr[v]}),t.jsx(L,{variant:"secondary",size:"icon","aria-label":"Zoom out",title:"Zoom out (coarser)",disabled:!f||v===te[te.length-1],onClick:()=>c(-1),children:t.jsx(As,{})})]})]}),f&&u.dated.length>0?t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 pb-6",children:t.jsxs("div",{className:"min-w-max",children:[t.jsx(vr,{startMs:f.startMs,endMs:f.endMs,tier:v,pxPerDay:_,trackPx:P}),w.map(D=>t.jsxs("div",{children:[t.jsx("div",{className:"sticky top-0 z-20 flex items-stretch bg-canvas","data-project-team":D.team??"",children:t.jsxs("span",{className:"sticky left-0 z-20 flex shrink-0 items-center gap-2 bg-canvas px-3 py-1 text-meta",style:{width:Se},children:[t.jsx("span",{className:"truncate text-ink",children:D.team??ze}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:D.items.length})]})}),D.items.map(A=>t.jsx(yr,{item:A,spanStart:f.startMs,pxPerDay:_,trackPx:P,today:b,onOpen:()=>a(A)},A.project.id))]},D.team??""))]})}):t.jsx("p",{className:"px-9 py-6 text-body-sm text-ink-muted",children:"No dates on any project yet. Set a start date, a target date or a milestone date and it will appear on the timeline."}),u.undated.length>0&&t.jsxs("div",{className:"shrink-0 px-9 py-2 text-meta text-ink-muted",children:["No dates (",u.undated.length,"):"," ",u.undated.map((D,A)=>t.jsxs("span",{children:[A>0&&", ",t.jsx("button",{type:"button",className:"text-ink hover:underline",onClick:()=>a(D),children:le(D.project)})]},D.project.id))]})]})},vr=({startMs:e,endMs:s,tier:a,pxPerDay:n,trackPx:r})=>{const i=yn(e,s,a);return t.jsxs("div",{className:"flex items-stretch",children:[t.jsx("span",{className:"sticky left-0 z-10 shrink-0 bg-canvas",style:{width:Se}}),t.jsx("span",{className:"relative block h-6",style:{width:r},children:i.map(l=>t.jsxs("span",{className:"absolute top-0 h-full",style:{left:ae(e,l.dayMs)*n},children:[t.jsx("span",{className:R("absolute top-0 h-full w-px",l.major?"bg-hairline":"bg-hairline/60"),"aria-hidden":"true"}),t.jsx("span",{className:"absolute top-1/2 left-1 -translate-y-1/2 whitespace-nowrap text-meta text-ink-muted",children:l.label})]},l.dayMs))})]})},yr=({item:e,spanStart:s,pxPerDay:a,trackPx:n,today:r,onOpen:i})=>{const{project:l}=e,o=hn(e),m=fn(e),h=d=>new Date(d).toISOString().slice(0,10);return t.jsxs("button",{type:"button",onClick:i,"data-project-name":l.name,className:"flex w-full items-stretch text-left transition-colors duration-fast ease-out-quart hover:bg-elevated",children:[t.jsx("span",{className:"sticky left-0 z-10 flex shrink-0 items-center gap-2 border-r border-hairline bg-canvas px-3",style:{width:Se,height:bt},children:t.jsx("span",{className:"truncate text-body-sm text-ink",children:le(l)})}),t.jsxs("span",{className:"relative block",style:{width:n,height:bt},children:[o&&t.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:ae(s,o.fromMs)*a,width:(ae(o.fromMs,o.toMs)+1)*a},title:`${X(h(o.fromMs))} → ${X(h(o.toMs))}`}),m.map(d=>t.jsx("span",{"data-milestone":d.status,className:R("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45",d.status==="completed"&&"bg-success",d.status==="overdue"&&"bg-warning",d.status==="upcoming"&&"border-[1.5px] border-ink-muted bg-surface"),style:{left:ae(s,d.dayMs)*a},title:`${d.name} · ${d.status} · ${X(h(d.dayMs))}`},`${d.name}-${d.dayMs}`)),t.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:ae(s,r)*a},"aria-hidden":"true"})]})]})},Gt="projects-view",kr=[{value:"list",label:"List"},{value:"board",label:"Board"},{value:"timeline",label:"Timeline"}];function Nr(){try{const e=localStorage.getItem(Gt);if(e==="board"||e==="timeline"||e==="list")return e}catch{}return"list"}function wr(e){try{localStorage.setItem(Gt,e)}catch{}}const Sr=({value:e,onChange:s})=>t.jsx($s,{value:e,onValueChange:a=>s(a),children:t.jsx(Rs,{"aria-label":"Project view","data-tour-tag":"projects-view-switcher",children:kr.map(a=>t.jsx(Ls,{value:a.value,children:a.label},a.value))})}),Tr=["r1","r2","r3","r4","r5","r6"],vt={unpaired:"This app is not paired with the Local Operator server, so Projects are unavailable.","below-version":"The Local Operator server is older than this app expects, so Projects are unavailable. Update the server and try again.",unknown:"The server's capabilities could not be read, so Projects are unavailable."},$r=({nowMs:e=Date.now()})=>{const{projectId:s}=aa(),a=Te(),n=wt(),r=gs(n.data,"projects",1),i=r==="enabled",l=fa(i),o=xa(),m=Et(),h=Ot(),[d,b]=x.useState(!1),[f,u]=x.useState(()=>Nr()),[w,N]=x.useState(()=>Ia()),[g,v]=x.useState(null),[c,_]=x.useState(null),P=kn(),D=l.data??[],A=x.useMemo(()=>Ra(D,w,e),[D,w,e]),B=La(w),[Q,C]=x.useState(!1);x.useEffect(()=>{if(!Q)return;const k=document.querySelector('[data-tour-tag="projects-board-window"]');k&&(k.focus(),C(!1))});const O=pa(f==="timeline"?D.map(k=>k.id):[],i),p=D.map((k,Y)=>({project:k,milestones:O[Y]?.data?.project.milestones??[]})),$=f==="timeline"?O.filter(k=>k.isLoading).length:0,E=f==="timeline"?O.filter(k=>k.isError).length:0,T=()=>{for(const k of O)k.isError&&k.refetch()},F=(k,Y)=>{m.mutate({key:k.id,fields:{status:Y}},{onSuccess:()=>{se(`Moved to ${W(Y).label}`),l.refetch().then(()=>P(k.id))}})};return i?s?t.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto overflow-x-hidden p-6 [scrollbar-gutter:stable_both-edges]",children:t.jsx(pr,{projectKey:s,nowMs:e})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"flex shrink-0 flex-col gap-8 px-6 pt-6",children:[t.jsx(tt,{title:"Projects",icon:at,subtitle:"Workstreams you and your agents track across sessions.",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(L,{variant:"secondary",size:"icon","aria-label":"Refresh projects",title:"Refresh projects",disabled:l.isFetching,onClick:()=>void l.refetch(),"data-tour-tag":"refresh-projects-button",children:t.jsx(na,{})}),t.jsxs(L,{variant:"secondary",onClick:()=>b(!0),"data-tour-tag":"create-project-button",children:[t.jsx(ke,{}),"New project"]})]})}),t.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[t.jsx(Sr,{value:f,onChange:k=>{u(k),wr(k)}}),f==="board"&&!(l.isSuccess&&l.data.length===0)&&t.jsx(ln,{value:w,onChange:k=>{N(k),rt(k)}})]})]}),t.jsxs("div",{className:"mt-8 flex min-h-0 flex-1 flex-col",children:[l.isLoading&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[t.jsx("output",{className:"px-9 py-2 text-meta text-ink-dim",children:"Loading projects…"}),Tr.map(k=>t.jsxs("div",{className:"flex items-center gap-3 px-9 py-2","aria-hidden":"true",children:[t.jsx(ce,{className:"h-4 min-w-0 flex-1 bg-elevated"}),t.jsx(ce,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(ce,{className:"h-4 w-32 shrink-0 bg-elevated"}),t.jsx(ce,{className:"h-4 w-16 shrink-0 bg-elevated"}),t.jsx(ce,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(ce,{className:"h-4 w-40 shrink-0 bg-elevated"})]},k))]}),l.isError&&t.jsxs("div",{className:"flex flex-col items-start gap-2 px-6",children:[t.jsx($e,{variant:"danger",children:l.error instanceof Error&&l.error.message?l.error.message:"The projects could not be read."}),t.jsx(L,{variant:"secondary",size:"sm",onClick:()=>void l.refetch(),children:"Try again"})]}),l.isSuccess&&l.data.length===0&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4",children:[t.jsx("p",{className:"text-heading text-ink",children:"No projects yet."}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:"Create one here, or ask an agent to create one and link this session."}),t.jsxs(L,{variant:"primary",onClick:()=>b(!0),"data-tour-tag":"create-project-empty-button",children:[t.jsx(ke,{}),"New project"]})]}),l.isSuccess&&l.data.length>0&&f==="list"&&t.jsx(gr,{projects:l.data,nowMs:e,onOpen:k=>void a(`/projects/${k.id}`)}),l.isSuccess&&l.data.length>0&&f==="board"&&A.length>0&&t.jsx(wn,{projects:A,nowMs:e,onOpen:k=>void a(`/projects/${k.id}`),onEdit:v,onDelete:_,onMove:F,movingKeys:m.isPending&&m.variables?[m.variables.key]:[]}),l.isSuccess&&l.data.length>0&&f==="board"&&A.length===0&&B!==null&&t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4",children:[t.jsx("p",{className:"text-heading text-ink",children:B}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:"Older projects are hidden by the window."}),t.jsx(L,{variant:"secondary",onClick:()=>{N("all"),rt("all"),C(!0)},children:"Show all time"})]}),l.isSuccess&&l.data.length>0&&f==="timeline"&&t.jsx(br,{items:p,nowMs:e,onOpen:k=>void a(`/projects/${k.project.id}`),pendingDetails:$,failedDetails:E,onRetryDetails:T})]}),t.jsx(Be,{open:g!==null,mode:"edit",initial:g?{key:g.id,name:g.name,title:g.title,owner:g.owner,team:g.team,description:g.description,status:g.status,tags:g.tags,start_date:g.start_date,target_date:g.target_date,estimate:g.estimate,estimate_unit:g.estimate_unit}:null,onClose:()=>v(null),onSubmit:async k=>{k.mode==="edit"&&(await m.mutateAsync({key:k.key,fields:k.fields}),se("Project saved"),v(null))}}),t.jsx(qt,{open:c!==null,projectName:c?.name??"",onClose:()=>_(null),onConfirm:async k=>{c&&(await h.mutateAsync({key:c.id,confirmedName:k}),se("Project deleted"),_(null))}}),t.jsx(Be,{open:d,mode:"create",onClose:()=>b(!1),onSubmit:async k=>{if(k.mode!=="create")return;const Y=await o.mutateAsync(k.fields),G=k.followUp?.title??k.fields.name;if(k.followUp)try{await m.mutateAsync({key:Y.id,fields:k.followUp})}catch(J){const j=J instanceof Error&&J.message?J.message:"";V(`Project ${G} was created, but the extra fields were not saved: ${Bt(j)||"the server refused them."} Open the project and use Edit to set them.`);return}se(`Project ${G} created`)}})]}):t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx(tt,{title:"Projects",icon:at}),n.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(de,{label:"Checking the server's Projects support"})}):t.jsx($e,{variant:"warning",children:vt[r]??vt.unknown})]})};export{$r as ProjectsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as r,s as be,g as Se,t as te,q as _e,a as Ae,b as ke,c as Et,l as mt,d as vt,e as Fe,z as Pe,H as D,M as ve,i as Ce}from"./mermaid.core-
|
|
1
|
+
import{_ as r,s as be,g as Se,t as te,q as _e,a as Ae,b as ke,c as Et,l as mt,d as vt,e as Fe,z as Pe,H as D,M as ve,i as Ce}from"./mermaid.core-CC8CflzC.js";import{l as $t}from"./index-COUHPq03.js";import"./index-Dn3kYWFt.js";import"./aida-control-BuMafqCb.js";import"./ui-preferences-store-BmAT9G_p.js";import"./textarea-DsHM-W2p.js";import"./error-boundary-CdtTgj_c.js";import"./console-mirror-45f9-7QH.js";var Ct=function(){var t=r(function(M,s,l,u){for(l=l||{},u=M.length;u--;l[M[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],q=[1,37],b=[1,36],y=[1,38],T=[1,35],m=[1,43],g=[1,41],rt=[1,14],ct=[1,23],dt=[1,18],ut=[1,19],xt=[1,20],ot=[1,21],bt=[1,22],lt=[1,24],i=[1,25],Dt=[1,26],zt=[1,27],Vt=[1,28],It=[1,29],W=[1,32],U=[1,33],k=[1,34],F=[1,39],P=[1,40],v=[1,42],C=[1,44],O=[1,62],H=[1,61],L=[4,5,8,10,12,13,14,18,44,47,49,55,56,57,63,64,65,66,67],wt=[1,65],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],I=[4,5,6,7,8,9,10,11,12,13,14,15,18],G=[1,90],K=[1,91],Z=[1,92],J=[1,99],$=[1,93],tt=[1,96],et=[1,94],it=[1,95],at=[1,97],nt=[1,98],St=[1,102],jt=[10,55,56,57],R=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:q,5:b,10:y,12:T,13:m,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(_,[2,34]),{27:45,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:46,4:q,5:b,10:y,12:T,13:m,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,47]},{38:[1,48]},{40:[1,49]},t(c,[2,45]),t(c,[2,46]),{18:[1,50]},{4:q,5:b,10:y,12:T,13:m,14:g,43:51,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:52,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:53,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:54,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:55,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,10:y,12:T,13:m,14:g,43:56,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,44:[1,57],47:[1,58],58:60,59:59,63:k,64:F,65:P,66:v,67:C},t(L,[2,64]),t(L,[2,66]),t(L,[2,67]),t(L,[2,70]),t(L,[2,71]),t(L,[2,72]),t(L,[2,73]),t(L,[2,74]),t(L,[2,75]),t(L,[2,76]),t(L,[2,77]),t(L,[2,78]),t(L,[2,79]),t(L,[2,80]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:64,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,21:63},t(c,[2,53],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,49:[1,77],63:k,64:F,65:P,66:v,67:C}),t(c,[2,56],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,49:[1,78],63:k,64:F,65:P,66:v,67:C}),t(c,[2,57],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,58],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,59],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,60],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),{45:[1,79]},{44:[1,80]},t(L,[2,65]),t(L,[2,81]),t(L,[2,82]),t(L,[2,83]),{3:82,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,18:[1,81]},t(I,[2,23]),t(I,[2,1]),t(I,[2,2]),t(I,[2,3]),t(I,[2,4]),t(I,[2,5]),t(I,[2,6]),t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12]),t(c,[2,52],{58:31,43:83,4:q,5:b,10:y,12:T,13:m,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,55],{58:31,43:84,4:q,5:b,10:y,12:T,13:m,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),{46:[1,85]},{45:[1,86]},{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:88,23:87},t(I,[2,24]),t(c,[2,51],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,54],{59:59,58:60,4:q,5:b,8:O,10:y,12:T,13:m,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,47],{22:88,16:89,23:100,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{46:[1,101]},t(c,[2,29],{10:St}),t(jt,[2,27],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),t(R,[2,25]),t(R,[2,13]),t(R,[2,14]),t(R,[2,15]),t(R,[2,16]),t(R,[2,17]),t(R,[2,18]),t(R,[2,19]),t(R,[2,20]),t(R,[2,21]),t(R,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:88,16:89,23:104,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:105},t(R,[2,26]),t(c,[2,50],{10:St}),t(jt,[2,28],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Gt=0,ye=2,Kt=1,Te=e.slice.call(arguments,1),E=Object.create(this.lexer),Y={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(Y.yy[At]=this.yy[At]);E.setInput(s,Y.yy),Y.yy.lexer=E,Y.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var kt=E.yylloc;e.push(kt);var me=E.options&&E.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function qe(B){u.length=u.length-2*B,A.length=A.length-B,e.length=e.length-B}r(qe,"popStack");function Zt(){var B;return B=d.pop()||E.lex()||Kt,typeof B!="number"&&(B instanceof Array&&(d=B,B=d.pop()),B=l.symbols_[B]||B),B}r(Zt,"lex");for(var w,j,N,Ft,st={},pt,X,Jt,yt;;){if(j=u[u.length-1],this.defaultActions[j]?N=this.defaultActions[j]:((w===null||typeof w>"u")&&(w=Zt()),N=ht[j]&&ht[j][w]),typeof N>"u"||!N.length||!N[0]){var Pt="";yt=[];for(pt in ht[j])this.terminals_[pt]&&pt>ye&&yt.push("'"+this.terminals_[pt]+"'");E.showPosition?Pt="Parse error on line "+(gt+1)+`:
|
|
2
2
|
`+E.showPosition()+`
|
|
3
3
|
Expecting `+yt.join(", ")+", got '"+(this.terminals_[w]||w)+"'":Pt="Parse error on line "+(gt+1)+": Unexpected "+(w==Kt?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(Pt,{text:E.match,token:this.terminals_[w]||w,line:E.yylineno,loc:kt,expected:yt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+w);switch(N[0]){case 1:u.push(w),A.push(E.yytext),e.push(E.yylloc),u.push(N[1]),w=null,Gt=E.yyleng,n=E.yytext,gt=E.yylineno,kt=E.yylloc;break;case 2:if(X=this.productions_[N[1]][1],st.$=A[A.length-X],st._$={first_line:e[e.length-(X||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(X||1)].first_column,last_column:e[e.length-1].last_column},me&&(st._$.range=[e[e.length-(X||1)].range[0],e[e.length-1].range[1]]),Ft=this.performAction.apply(st,[n,Gt,gt,Y.yy,N[1],A,e].concat(Te)),typeof Ft<"u")return Ft;X&&(u=u.slice(0,-1*X*2),A=A.slice(0,-1*X),e=e.slice(0,-1*X)),u.push(this.productions_[N[1]][0]),A.push(st.$),e.push(st._$),Jt=ht[u[u.length-2]][u[u.length-1]],u.push(Jt);break;case 3:return!0}}return!0},"parse")},pe=function(){var M={EOF:1,parseError:r(function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},"parseError"),setInput:r(function(s,l){return this.yy=l||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:r(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var l=s.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:r(function(s){var l=s.length,u=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===d.length?this.yylloc.first_column:0)+d[d.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:r(function(s){this.unput(this.match.slice(s))},"less"),pastInput:r(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var s=this.pastInput(),l=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|